2008-09-05 Cary Coutant <ccoutant@google.com>
[external/binutils.git] / gold / ChangeLog
1 2008-09-05  Cary Coutant  <ccoutant@google.com>
2
3         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
4         explicit instantiations.
5
6 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
7
8         PR gold/6858
9         * options.cc (General_options::finalize): Allow undefined symbols
10         in shlibs if linking -shared.
11
12         PR gold/6859
13         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
14         symbols as not needing a dynsym entry.
15
16 2008-08-20  Craig Silverstein  <csilvers@google.com>
17
18         * fileread.cc (File_read::open): Do not lock the file unless it
19         was successfully opened.
20
21 2008-08-14  Cary Coutant  <ccoutant@google.com>
22
23         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
24         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
25         * testsuite/tls_test.cc (struct int128): 128-bit struct
26         for testing TLS relocs with non-zero addend.
27         (v12): New TLS variable.
28         (t12): New test.
29         (t_last): Add check for v12.
30         * testsuite/tls_test.h (t12): New function.
31         * testsuite/tls_test_main.cc (thread_routine): Call new test.
32
33 2008-08-13  Ian Lance Taylor  <iant@google.com>
34
35         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
36         set tls_segment_ or relro_segment_.
37         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
38         when appropriate.
39         * output.h (Output_section::clear_is_relro): New function.
40         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
41         sections specially even when output_data_ is empty.
42         (Output_segment::maximum_alignment): When first section is relro,
43         only force alignment for PT_LOAD segments.
44         * script.cc (script_data_segment_align): New function.
45         (script_data_segment_relro_end): New function.
46         * script-c.h (script_data_segment_align): Declare.
47         (script_data_segment_relro_end): Declare.
48         * script-sections.h (class Script_sections): Declare
49         data_segment_align and data_segment_relro_end.  Add fields
50         segment_align_index_ and saw_relro_end_.
51         * script-sections.cc (class Sections_element): Add set_is_relro
52         virtual function.  Add new bool* parameter to place_orphan_here.
53         Add get_output_section virtual function.
54         (class Output_section_definition): Add set_is_relro.  Add new
55         bool* parameter to place_orphan_here.  Add get_output_section.
56         Add is_relro_ field.
57         (Output_section_definition::Output_section_definition): Initialize
58         evaluated_address_, evaluated_load_address, evaluated_addralign_,
59         and is_relro_ fields.
60         (Output_section_definition::place_orphan_here): Add is_relro
61         parameter.
62         (Output_section_definition::set_section_addresses): Set relro for
63         output section.
64         (Output_section_definition::alternate_constraint): Likewise.
65         (class Orphan_output_section): Add new bool* parameter to
66         place_orphan_here.  Add get_output_section.
67         (Orphan_output_section::place_orphan_here): Add is_relro
68         parameter.
69         (Script_sections::Script_sections): Initialize
70         data_segment_align_index_ and saw_relro_end_.
71         (Script_sections::data_segment_align): New function.
72         (Script_sections::data_segment_relro_end): New function.
73         (Script_sections::place_orphan): Set or clear is_relro.
74         (Script_sections::set_section_addresses): Force alignment of first
75         TLS section.
76         * yyscript.y (exp): Call script_data_segment_align and
77         script_data_segment_relro_end.
78         * testsuite/relro_script_test.t: New file.
79         * testsuite/relro_test.cc (using_script): Declare.
80         (t1, t2): Test using_script.
81         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
82         (relro_script_test_SOURCES): Define.
83         (relro_script_test_DEPENDENCIES): Define.
84         (relro_script_test_LDFLAGS): Define.
85         (relro_script_test_LDADD): Define.
86         (relro_script_test.so): New target.
87         * testsuite/Makefile.in: Rebuild.
88
89 2008-08-06  Cary Coutant <ccoutant@google.com>
90
91         * archive.cc (Archive::total_archives, Archive::total_members)
92         (Archive::total_members_loaded): New variables.
93         (Archive::setup): Add parameter.  Add option to preread
94         archive symbols.
95         (Archive::read_armap): Add counter.
96         (Archive::get_file_and_offset): New function.
97         (Archive::get_elf_object_for_member): New function.
98         (Archive::read_all_symbols): New function.
99         (Archive::read_symbols): New function.
100         (Archive::add_symbols): Add counters.
101         (Archive::include_all_members): Use armap to find members if it's
102         already built.
103         (Archive::include_member): Skip reading symbols if already read.
104         Factored code into Archive::get_file_and_offset and
105         Archive::get_elf_object_for_member.  Changed call to
106         Mapfile::report_include_archive_member.
107         (Archive::print_stats): New function.
108         * archive.h: Declare Object and Read_symbols_data classes.
109         (Archive::Archive): Add initializers for new members.
110         (Archive::setup): Add parameter.
111         (Archive::print_stats): New function.
112         (Archive::total_archives, Archive::total_members)
113         (Archive::total_members_loaded): New variables.
114         (Archive::get_file_and_offset): New function.
115         (Archive::get_elf_object_for_member): New function.
116         (Archive::read_all_symbols): New function.
117         (Archive::read_symbols): New function.
118         (Archive::Archive_member): New class.
119         (Archive::members_): New member.
120         (Archive::num_members_): New member.
121         * main.cc: Include archive.h.
122         (main): Call Archive::print_stats.
123         * mapfile.cc (Mapfile::report_include_archive_member): Delete
124         archive parameter; member_name is now the fully-decorated name.
125         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
126         * options.h: (General_options): Add --preread-archive-symbols option.
127         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
128         Archive::setup.
129
130 2008-08-04  Ian Lance Taylor  <iant@google.com>
131
132         * symtab.h (Symbol::use_plt_offset): New function.
133         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
134         * powerpc.cc (Relocate::relocate): Likewise.
135         * sparc.cc (Relocate::relocate): Likewise.
136         * x86_64.cc (Relocate::relocate): Likewise.
137         * testsuite/weak_plt.sh: New test.
138         * testsuite/weak_plt_main.cc: New test.
139         * testsuite/weak_plt_shared.cc: New test.
140         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
141         (check_PROGRAMS): Add weak_plt.
142         (check_DATA): Add weak_plt_shared.so.
143         (weak_plt_main_pic.o, weak_plt): New targets.
144         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
145         * testsuite/Makefile.in: Rebuild.
146
147         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
148         gcctestdir/ld.
149         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
150         * testsuite/Makefile.in: Rebuild.
151
152 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
153
154         * Makefile.am (POTFILES.in): Set LC_ALL=C.
155         * Makefile.in: Regenerate.
156         * po/POTFILES.in: Regenerate.
157
158 2008-07-29  Ian Lance Taylor  <iant@google.com>
159
160         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
161         symbols before other symbols.
162         * testsuite/script_test_2.cc (test_addr): Declare.
163         (test_addr_alias): Declare.
164         (main): Check that test_addr and test_addr_alias have the right
165         values. 
166         * testsuite/script_test_2.t: Define test_addr_alias and
167         test_addr.
168
169 2008-07-24  Ian Lance Taylor  <iant@google.com>
170
171         PR 5990
172         * descriptors.cc: New file.
173         * descriptors.h: New file.
174         * gold-threads.h (class Hold_optional_lock): New class.
175         * fileread.cc: Include "descriptors.h".
176         (File_read::~File_read): Release descriptor rather than closing
177         it.
178         (File_read::open) [file]: Call open_descriptor rather than open.
179         Set is_descriptor_opened_.
180         (File_read::open) [memory]: Assert that descriptor is not open.
181         (File_read::reopen_descriptor): New function.
182         (File_read::release): Release descriptor.
183         (File_read::do_read): Make non-const.  Reopen descriptor.
184         (File_read::read): Make non-const.
185         (File_read::make_view): Reopen descriptor.
186         (File_read::do_readv): Likewise.
187         * fileread.h (class File_read): Add is_descriptor_opened_ field.
188         Update declarations.
189         * layout.cc: Include "descriptors.h".
190         (Layout::create_build_id): Use open_descriptor rather than open.
191         * output.cc: Include "descriptors.h".
192         (Output_file::open): Use open_descriptor rather than open.
193         * archive.cc (Archive::const_iterator): Change Archive to be
194         non-const.
195         (Archive::begin, Archive::end): Make non-const.
196         (Archive::count_members): Likewise.
197         * archive.h (class Archive): Update declarations.
198         * object.h (Object::read): Make non-const.
199         * Makefile.am (CCFILES): Add descriptors.cc.
200         (HFILES): Add descriptors.h.
201         * Makefile.in: Rebuild.
202
203         PR 6716
204         * gold.h: Always include <clocale>.  Add Solaris workarounds
205         following code in binutils/sysdep.h.
206
207         PR 6048
208         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
209         this->eh_frame_hdr_ is NULL before using it.
210
211         * dynobj.cc (Versions::Versions): Update comment.
212
213         * dynobj.cc (Versions::Versions): If there is an soname, use it as
214         the base version name.
215
216         * stringpool.cc (Stringpool_template::add_with_length): Set key to
217         array size plus one.
218         (Stringpool_template::set_string_offsets): Subtract one from key
219         before using it as an array index.
220         (Stringpool_template::get_offset_with_length): Likewise.
221         (Stringpool_template::write_to_buffer): Likewise.
222         * stringpool.h (Stringpool_template::get_offset_from_key):
223         Likewise.
224
225 2008-07-23  Ian Lance Taylor  <iant@google.com>
226
227         PR 6658
228         * object.h (Merged_symbol_value::value): Do our best to handle a
229         negative addend.
230
231         PR 6647
232         * script.cc (Version_script_info::get_versions): Don't add empty
233         version tag to return value.
234         (Version_script_info::get_symbol_version_helper): Change return
235         type to bool.  Add pversion parameter.  Change all callers.
236         (script_register_vers_node): Don't require a non-NULL tag.
237         * script.h (class Version_script_info): Update declarations.
238         (Version_script_info::get_symbol_version): Change return type to
239         bool.  Add version parameter.  Change all callers.
240         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
241         handling.  Handle an empty version from a version script.
242         (Symbol_table::define_special_symbol): Likewise.
243         * testsuite/ver_test_10.script: New file.
244         * testsuite/ver_test_10.sh: New file.
245         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
246         (check_DATA): Add ver_test_10.syms.
247         (ver_test_10.syms, ver_test_10.so): New target.
248         * testsuite/Makefile.in: Rebuild.
249
250 2008-07-23  Simon Baldwin  <simonb@google.com>
251
252         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
253         to zero for undefined symbols from dynamic libraries.
254
255 2008-07-23  Ian Lance Taylor  <iant@google.com>
256
257         * symtab.cc (Symbol_table::resolve): Remove version parameter.
258         Change all callers.
259         * symtab.h (class Symbol_table): Update declaration.
260         * testsuite/ver_test_9.cc: New file.
261         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
262         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
263         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
264         (ver_test_9.so, ver_test_9.o): New targets.
265         * testsuite/Makefile.in: Rebuild.
266
267 2008-07-22  Ian Lance Taylor  <iant@google.com>
268
269         * options.h (class General_options): Define --check-sections.
270         * layout.cc (Layout::set_segment_offsets): Handle
271         --check-sections.
272
273         * options.h (class General_options): Define -n/--nmagic and
274         -N/--omagic.
275         * options.cc (General_options::finalize): For -n/--nmagic or
276         -N/--omagic, set -static.
277         * layout.cc (Layout::attach_allocated_section_to_segment): If
278         -N/--omagic, don't put read-only and read-write sections in
279         different segments.
280         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
281         finding a read-only segment.
282         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
283         don't set the minimum segment alignment to the common page size,
284         and don't set the file offset to the address modulo the page size.
285         * script-sections.cc (Script_sections::create_segments): If
286         -n/--omagic, don't put read-only and read-write sections in
287         different segments.
288
289         * cref.cc: New file.
290         * cref.h: New file.
291         * options.h (class General_options): Add --print-symbol-counts.
292         * main.cc (main): Issue defined symbol report if requested.
293         * archive.cc (Archive::interpret_header): Make into a const member
294         function.
295         (Archive::add_symbols): Call Input_objects::archive_start and
296         archive_stop.
297         (Archive::const_iterator): Define new class.
298         (Archive::begin, Archive::end): New functions.
299         (Archive::include_all_members): Rewrite to use iterator.
300         (Archive::count_members): New function.
301         * archive.h (class Archive): Update declarations.
302         (Archive::filename): New function.
303         * object.cc: Include "cref.h".
304         (Sized_relobj::Sized_relobj): Initialize defined_count_.
305         (Sized_relobj::do_get_global_symbol_counts): New function.
306         (Input_objects::add_object): Add object to cross-referencer.
307         (Input_objects::archive_start): New function.
308         (Input_objects::archive_stop): New function.
309         (Input_objects::print_symbol_counts): New function.
310         * object.h: Declare Cref and Archive.
311         (Object::get_global_symbol_counts): New function.
312         (Object::do_get_global_symbol_counts): New pure virtual function.
313         (class Sized_relobj): Add defined_count_ field.  Update
314         declarations.
315         (class Input_objects): Add cref_ field.  Update constructor.
316         Update declarations.
317         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
318         defined_count_.
319         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
320         symbol counts.
321         (Sized_dynobj::do_get_global_symbol_counts): New function.
322         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
323         defined_count_.  Update declarations.  Define Symbols typedef.
324         * symtab.cc (Symbol_table::add_from_relobj): Add defined
325         parameter.  Change all callers.
326         (Symbol_table::add_from_dynobj): Add sympointers and defined
327         parameters.  Change all callers.
328         * symtab.h (class Symbol_table): Update declarations.
329         * Makefile.am (CCFILES): Add cref.cc.
330         (HFILES): Add cref.h.
331         * Makefile.in: Rebuild.
332
333 2008-07-22  Simon Baldwin  <simonb@google.com>
334
335         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
336         to zero when writing undefined symbols.
337
338 2008-07-22  Ian Lance Taylor  <iant@google.com>
339
340         * output.cc (Output_section::add_input_section): Don't try to
341         merge empty merge sections.
342
343 2008-07-21  Craig Silverstein  <csilvers@google.com>
344
345         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
346         Include symbol version in error message.
347         
348 2008-07-20  Chris Demetriou  <cgd@google.com>
349
350         * configure.ac (gold_cv_c_random_seed): New configured variable.
351         (RANDOM_SEED_CFLAGS): New substituted variable.
352         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
353         * configure: Rebuild.
354         * Makefile.in: Likewise.
355         * testsuite/Makefile.in: Likewise.
356
357 2008-07-18  Ian Lance Taylor  <iant@google.com>
358
359         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
360         where we see NAME/NULL and NAME/VERSION  as separate symbols.
361         * testsuite/ver_test_main.cc (main): Call t4.
362         (t4, t4_2a): Define.
363         * testsuite/ver_test_2.cc (t4_2): Define.
364         * testsuite/ver_test_2.script: Put t4_2a in VER2.
365         * testsuite/ver_test_4.cc (t4_2a): Define.
366         * testsuite/ver_test_4.script: Put t4_2a in VER2.
367         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
368
369 2008-07-17  Ian Lance Taylor  <iant@google.com>
370
371         * dynobj.cc (Versions::add_def): If we give an error about a
372         missing version, go ahead and create the version anyhow.
373
374 2008-07-10  Ian Lance Taylor  <iant@google.com>
375
376         Handle output sections with more than 0x7fffffff bytes.
377         * object.h (class Relobj): Change map_to_output_ to
378         output_sections_, and just keep a section pointer.  Change all
379         uses.  Move comdat group support to Sized_relobj.
380         (Relobj::is_section_specially_mapped): Remove.
381         (Relobj::output_section): Remove poff parameter.  Change all
382         callers.
383         (Relobj::output_section_offset): New function.
384         (Relobj::set_section_offset): Rewrite.
385         (Relobj::map_to_output): Remove.
386         (Relobj::output_sections): New function.
387         (Relobj::do_output_section_offset): New pure virtual function.
388         (Relobj::do_set_section_offset): Likewise.
389         (class Sized_relobj): Add section_offsets_ field.  Add comdat
390         group support from Relobj.  Update declarations.
391         (Sized_relobj::get_output_section_offset): New function.
392         (Sized_relobj::do_output_section_offset): New function.
393         (Sized_relobj::do_set_section_offset): New function.
394         * object.cc (Relobj::output_section_address): Remove.
395         (Sized_relobj::Sized_relobj): Initialize new fields.
396         (Sized_relobj::include_section_group): Cast find_kept_object to
397         Sized_relobj.
398         (Sized_relobj::include_linkonce_section): Likewise.
399         (Sized_relobj::do_layout): Use separate arrays for output section
400         and output offset.
401         (Sized_relobj::do_count_local_symbols): Change map_to_output to
402         output_sections.
403         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
404         output_sections and section_offsets.
405         (Sized_relobj::write_local_symbols): Likewise.
406         (map_to_kept_section): Compute output address directly.
407         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
408         output_sections and section_offsets.
409         (Sized_relobj::write_sections): Likewise.
410         (Sized_relobj::relocate_sections): Likewise.
411         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
412         * output.h (class Output_reloc): Update declarations.  Change
413         u2_.relobj to Sized_relobj*.
414         (class Output_data_reloc): Change add functions to use
415         Sized_relobj*.
416         * output.cc (Output_reloc::Output_reloc): Change relobj to
417         Sized_relobj*.
418         (Output_reloc::local_section_offset): Change return type to
419         Elf_Addr.  Use get_output_section_offset.
420         (Output_reloc::get_address): Likewise.
421         (Output_section::is_input_address_mapped): Don't call
422         is_section_specially_mapped.
423         (Output_section::output_offset): Likewise.
424         (Output_section::output_address): Likewise.
425         (Output_section::starting_output_address): Likewise.
426         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
427         parameter to Sized_relobj*.
428         (Copy_relocs::need_copy_reloc): Likewise.
429         (Copy_relocs::save): Likewise.
430         * copy-relocs.h (class Copy_relocs): Update declarations.
431         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
432         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
433         * target-reloc.h (relocate_for_relocatable): Change
434         offset_in_output_section type to Elf_Addr.  Change code that uses
435         it as well.
436         * layout.cc (Layout::layout): Always set *off.
437         * mapfile.cc (Mapfile::print_input_section): Use
438         output_section_offset.
439         * i386.cc (Target_i386::copy_reloc): Change object parameter to
440         Sized_relobj*.
441         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
442         * sparc.cc (Target_sparc::copy_reloc): Likewise.
443         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
444
445 2008-07-03  Ian Lance Taylor  <iant@google.com>
446
447         * layout.cc (Layout::include_section): Do not discard unrecognized
448         SHT_STRTAB sections.
449
450 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
451
452         * script.cc (Lex::can_continue_name): Make '?' allowable in
453         version-script names.
454         * testsuite/version_script.map: Change glob pattern to use '?'
455
456 2008-06-30  Manish Singh  <yosh@gimp.org>
457
458         PR 6585
459         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
460         Correct typo.
461
462 2008-06-30  Ian Lance Taylor  <iant@google.com>
463
464         PR 6660
465         PR 6682
466         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
467         versions]: Don't try to read the value in the contents, since we
468         don't use it.  Use the template endianness when writing.
469
470 2008-06-25  Cary Coutant  <ccoutant@google.com>
471
472         * fileread.cc (File_read::make_view): Assert on zero-length view.
473         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
474         symbol table when there are no symbols to read.
475
476 2008-06-23  Craig Silverstein  <csilvers@google.com>
477
478         * version.cc (version_string): Bump to 1.7
479
480 2008-06-18  Craig Silverstein  <csilvers@google.com>
481
482         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
483         constant 0xFFFF to type Valtype.
484         (Powerpc_relocate_functions::rel16_ha): Likewise.
485
486 2008-06-17  Ian Lance Taylor  <iant@google.com>
487
488         * output.h (Output_section::Input_section): Initialize p2align_ to
489         zero for Output_section_data constructors.
490         (Output_section::Input_section::addralign): If not an input
491         section, return the alignment of the Output_section_data.
492         * testsuite/copy_test.cc: New file.
493         * testsuite/copy_test_1.cc: New file.
494         * testsuite/copy_test_2.cc: New file.
495         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
496         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
497         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
498         (copy_test_1_pic.o, copy_test_1.so): New targets.
499         (copy_test_2_pic.o, copy_test_2.so): New targets.
500         * testsuite/Makefile.in: Rebuild.
501
502         * script-sections.cc (Script_sections::place_orphan): Initialize
503         local variable exact.
504
505 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
506
507         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
508
509 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
510             David S. Miller  <davem@davemloft.net>
511
512         * powerpc.cc: New file.
513         * Makefile.am (TARGETSOURCES): Add powerpc.cc
514         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
515         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
516         * Makefile.in: Rebuild.
517
518 2008-06-09  Ian Lance Taylor  <iant@google.com>
519
520         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
521         <exception>.
522         (throwing, orig_terminate): New static variables.
523         (terminate_handler): New static function.
524         (t2): Set terminate handler.
525
526 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
527
528         PR 6584
529         * binary.cc (Binary_to_elf::sized_convert): Fix .data
530         alignment.
531
532 2008-05-30  Cary Coutant  <ccoutant@google.com>
533
534         * archive.cc (Archive::include_all_members) Correct to step
535         over symbol table and extended name table in thin archives.
536
537 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
538
539         PR 6407
540         * target-reloc.h (relocate_for_relocatable): Fix new_offset
541         calculation.
542
543 2008-05-28  Caleb Howe  <cshowe@google.com>
544
545         * reduced_debug_output.cc: New file.
546         * reduced_debug_output.h: New file.
547         * options.h (class General_options): Add --strip-debug-non-line.
548         * options.cc (General_options::finalize): Add strip_debug_non_line
549         to the strip heirarchy.
550         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
551         fields.
552         * layout.cc: Include "reduced_debug_output.h".
553         (Layout::Layout): Initialize new fields.
554         (line_only_debug_sections): New static array.
555         (is_lines_only_debug_sections): New static inline function.
556         (Layout::include_section): Handle --strip-debug-non-line.
557         (Layout::make_output_section): If --strip-debug-non-line, build
558         new output sections for .debug_abbrev and .debug_info.
559         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
560         gold.  Warn about possible overflow.
561         (read_signed_LEB_128): Likewise.
562         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
563         (read_signed_LEB_128): Declare.
564         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
565         (HFILES): Add reduced_debug_output.h.
566         * Makefile.in: Rebuild.
567
568 2008-05-21  Ian Lance Taylor  <iant@google.com>
569
570         * mapfile.cc: New file.
571         * mapfile.h: New file.
572         * options.h (class General_options): Add -M/--print-map and -Map.
573         * options.cc (General_options::finalize): Make -M equivalent to
574         -Map -.
575         * main.cc: Include <cstdio> and "mapfile.h".
576         (main): Open mapfile if requested.
577         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
578         constructor.  Change caller.
579         (queue_initial_tasks): Add mapfile parameter.  Change caller.
580         (queue_middle_tasks): Likewise.
581         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
582         declarations.
583         * archive.cc: Include "mapfile.h".
584         (Archive::add_symbols): Add mapfile parameter.  Change all
585         callers.  Pass mapfile, symbol, and reason to include_member.
586         (Archive::include_all_members): Add mapfile parameter.  Change all
587         callers.
588         (Archive::include_member): Add mapfile, sym, and why parameters.
589         Change all callers.  Report inclusion to map file.
590         * archive.h: Include "fileread.h".
591         (class Archive): Update declarations.
592         (Archive::file): New const method.
593         (class Add_archive_symbols): Add mapfile_ field.  Update
594         constructor.  Change all callers.
595         * readsyms.h (class Read_symbols): Likewise.
596         (class Finish_group): Likewise.
597         (class Read_script): Likewise.
598         * common.cc: Include "mapfile.h".
599         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
600         all callers.
601         (Symbol_table::do_allocate_commons): Likewise.
602         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
603         symbol allocation to mapfile.
604         * common.h (class Allocate_commons_task): Add mapfile_ field.
605         Update constructor.  Change all callers.
606         * symtab.h (class Symbol_table): Update declarations.
607         * layout.cc: Include "mapfile.h".
608         (Layout_task_runner::run): Print information to mapfile.
609         (Layout::create_gold_note): Change Output_data_fixed_space to
610         Output_data_zero_fill.
611         (Layout::create_build_id): Likewise.
612         (Layout::print_to_mapfile): New function.
613         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
614         constructor.  Change caller.
615         (class Layout): Declare print_to_mapfile.
616         * output.cc (Output_section::Input_section::print_to_mapfile): New
617         function.
618         (Output_section::add_input_section): If producing a map, always
619         add to input_sections_ list.
620         (Output_section::do_print_to_mapfile): New function.
621         (Output_segment::print_sections_to_mapfile): New function.
622         (Output_segment::print_section_list_to_mapfile): New function.
623         * output.h: Include "mapfile.h".
624         (Output_data::print_to_mapfile): New function.
625         (Output_data::do_print_to_mapfile): New virtual function.
626         (Output_segment_headers::do_print_to_mapfile): New function.
627         (Output_file_header::do_print_to_mapfile): New function.
628         (Output_data_const::do_print_to_mapfile): New function.
629         (class Output_data_const_buffer): Add map_name_ field.  Update
630         constructor.  Change all callers.  Add do_print_to_mapfile
631         function.
632         (class Output_data_fixed_space): Likewise.
633         (class Output_data_space): Likewise.
634         (class Output_data_zero_fill): New class.
635         (Output_data_strtab::do_print_to_mapfile): New function.
636         (Output_data_reloc_base::do_print_to_mapfile): New function.
637         (Output_relocatable_relocs::do_print_to_mapfile): New function.
638         (Output_data_group::do_print_to_mapfile): New function.
639         (Output_data_got::do_print_to_mapfile): New function.
640         (Output_data_dynamic::do_print_to_mapfile): New function.
641         (Output_symtab_xindex::do_print_to_mapfile): New function.
642         (class Output_section): Declare do_print_to_mapflie.  Declare
643         print_to_mapfile in Input_section.
644         (class Output_segment): Declare new functions.
645         * object.h (Sized_relobj::symbol_count): New function.
646         * script-sections.cc
647         (Output_section_element_dot_assignment::set_section_addresses):
648         Change Output_data_fixed_space to Output_data_zero_fill.
649         (Output_data_expression::do_print_to_mapfile): New function.
650         * script.cc (read_input_script): Add mapfile parameter.  Change
651         all callers.
652         * script.h (read_input_script): Update declaration.
653         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
654         (Eh_frame::do_print_to_mapfile): New function.
655         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
656         (Output_merge_string::do_print_to_mapfile): New function.
657         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
658         function.
659         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
660         function.
661         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
662         function.
663         * Makefile.am (CCFILES): Add mapfile.cc.
664         (HFILES): Add mapfile.h.
665         * Makefile.in: Rebuild.
666
667 2008-05-19  Ian Lance Taylor  <iant@google.com>
668
669         * options.h (class General_options): Add -z relro.
670         * layout.cc (Layout::Layout): Initialize relro_segment_.
671         (Layout::add_output_section_data): Return the output section.
672         (Layout::make_output_section): Rcognize relro sections and mark
673         them appropriately.
674         (Layout::attach_allocated_section_to_segment): Put relro sections
675         in a PT_GNU_RELRO segment.
676         (Layout::create_initial_dynamic_sections): Mark the .dynamic
677         section as relro.
678         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
679         PT_TLS segments.
680         (Layout::linkonce_mapping): Map d.rel.ro.local to
681         .data.rel.ro.local.
682         (Layout::output_section_name): Us .data.rel.ro.local for any
683         section which begins with that.
684         * layout.h (class Layout): Update add_output_section_data
685         declaration.  Add relro_segment_ field.
686         * output.cc (Output_section::Output_section): Initialize is_relro_
687         and is_relro_local_ fields.
688         (Output_segment::add_output_section): Group relro sections.
689         (Output_segment::is_first_section_relro): New function.
690         (Output_segment::maximum_alignment): If there is a relro section,
691         align the segment to the common page size.
692         (Output_segment::set_section_addresses): Track whether we are
693         looking at relro sections.  If the last section is a relro
694         section, align to the common page size.
695         (Output_segment::set_section_list_addresses): Add in_relro
696         parameter.  Change all callers.  Align to the page size when
697         moving from relro to non-relro section.
698         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
699         segment.
700         * output.h (class Output_section): Add is_relro_ and
701         is_relro_local_ fields.
702         (Output_section::is_relro): New function.
703         (Output_section::set_is_relro): New function.
704         (Output_section::is_relro_local): New function.
705         (Output_section::set_is_relro_local): New function.
706         (class Output_segment): Update declarations.
707         * i386.cc (Target_i386::got_section): Mark .got section as relro.
708         * sparc.cc (Target_sparc::got_section): Likewise.
709         * x86_64.cc (Target_x86_64::got_section): Likewise.
710         * testsuite/relro_test_main.cc: New file.
711         * testsuite/relro_test.cc: New file.
712         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
713         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
714         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
715         (relro_test.so, relro_test_pic.o): New targets.
716         * testsuite/Makefile.in: Rebuild.
717
718 2008-05-16  Ian Lance Taylor  <iant@google.com>
719
720         * output.cc (Output_segment::add_output_section): Remove front
721         parameter.
722         * output.h (class Output_segment): Remove
723         add_initial_output_section and overloaded add_output_section.
724         Update declaration of remaining add_output_section.
725         * layout.cc (Layout::create_interp): Call add_output_section
726         rather than add_initial_output_section.
727         (Layout::finish_dynamic_section): Likewise.
728
729         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
730         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
731         know the dynamic type.
732         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
733         field.  Initialize it in constructor.
734         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
735         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
736         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
737         reloc.
738
739         * output.cc (Output_reloc::get_address): Change return type to
740         Elf_Addr.
741         * output.h (class Output_reloc): Update get_address declaration.
742         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
743         for section addresses.
744
745 2008-05-09  Ian Lance Taylor  <iant@google.com>
746
747         PR 6493
748         * gold.cc (gold_nomem): Use return value of write.
749
750 2008-05-08  Ian Lance Taylor  <iant@google.com>
751
752         * symtab.c (Symbol::init_base_output_data): Add version
753         parameter.  Change all callers.
754         (Symbol::init_base_output_segment): Likewise.
755         (Symbol::init_base_constant): Likewise.
756         (Symbol::init_base_undefined): Likewise.
757         (Sized_symbol::init_output_data): Likewise.
758         (Sized_symbol::init_output_segment): Likewise.
759         (Sized_symbol::init_constant): Likewise.
760         (Sized_symbol::init_undefined): Likewise.
761         (Symbol_table::do_define_in_output_data): If the new symbol has a
762         version, mark it as the default.
763         (Symbol_table::do_define_in_output_segment): Likewise.
764         (Symbol_table::do_define_as_constant): Likewise.
765         * symtab.h (class Symbol): Update declarations.
766         (class Sized_symbol): Likewise.
767         * resolve.cc (Symbol::override_version): New function.
768         (Symbol::override_base): Call override_version.
769         (Symbol::override_base_with_special): Likewise.
770         * testsuite/ver_script_8.script: New file.
771         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
772         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
773         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
774         (ver_test_8_1.so, ver_test_8_2.so): New targets.
775
776 2008-05-06  Ian Lance Taylor  <iant@google.com>
777
778         PR 6049
779         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
780         functions.
781         (class General_options): Remove existing --undefined, and add
782         --no-undefined instead.  Add new --undefined as synonym for -u.
783         * archive.cc (Archive::add_symbols): Check whether symbol was
784         named with -u.
785         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
786         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
787         all uses.  Add IS_UNDEFINED.  Update declarations to split
788         different versions of init_base.  Declare init_base_undefined.
789         (Symbol::is_defined): Handle IS_UNDEFINED.
790         (Symbol::is_undefined): Likewise.
791         (Symbol::is_weak_undefined): Call is_undefined.
792         (Symbol::is_absolute): Handle IS_CONSTANT.
793         (class Sized_symbol): Update declarations to split different
794         versions of init.  Declare init_undefined.
795         (class Symbol_table): Declare new functions.
796         * symtab.cc (Symbol::init_base_object): Rename from init_base.
797         Change all callers.
798         (Symbol::init_base_output_data): Likewise.
799         (Symbol::init_base_output_segment): Likewise.
800         (Symbol::init_base_constant): Likewise.
801         (Symbol::init_base_undefined): New function.
802         (Sized_symbol::init_object): Rename from init.  Change all
803         callers.
804         (Sized_symbol::init_output_data): Likewise.
805         (Sized_symbol::init_output_segment): Likewise.
806         (Sized_symbol::init_constant): Likewise.
807         (Sized_symbol::init_undefined): New function.
808         (Symbol_table::add_undefined_symbols_from_command_line): New
809         function.
810         (Symbol_table::do_add_undefined_symbols_from_command_line): New
811         function.
812         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
813         (Symbol::output_section): Likewise.
814         (Symbol::set_output_section): Likewise.
815         (Symbol_table::sized_finalize_symbol): Likewise.
816         (Symbol_table::sized_write_globals): Likewise.
817         * resolve.cc (Symbol_table::should_override): Likewise.
818         (Symbol::override_base_with_special): Likewise.
819
820         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
821         symbol, change it to have default visibility.
822         * testsuite/protected_1.cc: New file.
823         * testsuite/protected_2.cc: New file.
824         * testsuite/protected_3.cc: New file.
825         * testsuite/protected_main_1.cc: New file.
826         * testsuite/protected_main_2.cc: New file.
827         * testsuite/protected_main_3.cc: New file.
828         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
829         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
830         (protected_1_LDFLAGS, protected_1_LDADD): Define.
831         (protected_1.so): New target.
832         (protected_1_pic.o, protected_2_pic.o): New targets.
833         (protected_3_pic.o): New target.
834         (check_PROGRAMS): Add protected_2.
835         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
836         (protected_2_LDFLAGS, protected_2_LDADD): Define.
837         * testsuite/Makefile.in: Rebuild.
838
839         * options.h (DEFINE_var): Add set_user_set_##varname__.
840         (DEFINE_bool_alias): New macro.
841         (class General_options): Define -Bstatic using DEFINE_bool_alias
842         rather than DEFINE_special.  Add --undefined as an alias for -z
843         defs.
844         * options.cc (General_options::parse_Bstatic): Remove.
845
846         * options.h (class General_options): Add --fatal-warnings.
847         * main.cc (main): Implement --fatal-warnings.
848         * errors.h (Errors::warning_count): New function.
849
850         * options.h (class General_options): Add -Bsymbolic-functions.
851         * symtab.h (Symbol::is_preemptible): Check for
852         -Bsymbolic-functions.
853
854 2008-05-05  Ian Lance Taylor  <iant@google.com>
855
856         * options.h (DEFINE_bool): For DASH_Z, create the negative option
857         as noVARNAME rather than no-VARNAME.
858         (class General_options): Add option -z combreloc.
859         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
860         get_address.
861         (Output_reloc::sort_before) [SHT_REL]: New function.
862         (Output_reloc::sort_before) [SHT_RELA]: New function.
863         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
864         Sort_relocs_comparison.
865         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
866         parameter.  Change all callers.
867         (Output_data_reloc::Output_data_reloc) [both versions]: Add
868         sort_relocs parameter.  Change all callers.
869         * output.cc (Output_reloc::get_address): New function, broken out
870         of write_rel.
871         (Output_reloc::write_rel): Call it.
872         (Output_reloc::compare): New function.
873         (Output_data_reloc_base::do_write): Optionally sort relocs.
874
875         * configure.ac: If targ_extra_obj is set, link it in.
876         * configure.tgt: Initialize all variables.
877         (x86_64*): Set targ_extra_obj and targ_extra_size.
878         * configure: Rebuild.
879
880         * object.cc (Sized_relobj::include_section_group): Adjust section
881         indexes read from group data.  Build vector to pass to
882         layout_group.
883         * layout.cc (Layout::layout_group): Add flags and shndxes
884         parameters.  Remove contents parameter.  Change caller.  Update
885         explicit instantiations.
886         * layout.h (class Layout): Update layout_group declaration.
887         * output.cc (Output_data_group::Output_data_group): Add flags and
888         input_shndxes parameters.  Remove contents parameter.  Change
889         caller.
890         (Output_data_group::do_write): Change input_sections_ to
891         input_shndxes_.
892         * output.h (class Output_data_group): Update constructor
893         declaration.  Rename input_sections_ to input_shndxes_.
894         * testsuite/many_sections_test.cc: Add template.
895
896 2008-04-30  Cary Coutant  <ccoutant@google.com>
897
898         * target-reloc.h (relocate_section): Fix dead-pointer bug.
899
900         * layout.cc (Layout::include_section): Refactored check for debug
901         info section.
902         (Layout::add_comdat): Add new parameters.  Change type
903         of signature parameter.  Add object and shndx to signatures table.
904         (Layout::find_kept_object): New function.
905         * layout.h: Include <cstring>.
906         (Layout::is_debug_info_section): New function.
907         (Layout::add_comdat): Add new parameters.
908         (Layout::find_kept_object): New function.
909         (Layout::Kept_section): New struct.
910         (Layout::Signatures): Change type of map range.
911         * object.cc (Relobj::output_section_address): New function.
912         (Sized_relobj::include_section_group): Add new parameters.  Change
913         calls to Layout::add_comdat.  Change to build table of kept comdat
914         groups and table mapping discarded sections to kept sections.
915         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
916         (Sized_relobj::do_layout): Change calls to include_section_group and
917         include_linkonce_section.
918         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
919         value to zero when section is discarded.
920         (Sized_relobj::map_to_kept_section): New function.
921         * object.h (Relobj::output_section_address): New function.
922         (Relobj::Comdat_group): New type.
923         (Relobj::find_comdat_group): New function.
924         (Relobj::Comdat_group_table): New type.
925         (Relobj::Kept_comdat_section): New type.
926         (Relobj::Kept_comdat_section_table): New type.
927         (Relobj::add_comdat_group): New function.
928         (Relobj::set_kept_comdat_section): New function.
929         (Relobj::get_kept_comdat_section): New function.
930         (Relobj::comdat_groups_): New field.
931         (Relobj::kept_comdat_sections_): New field.
932         (Symbol_value::input_value): Update comment.
933         (Sized_relobj::map_to_kept_section) New function.
934         (Sized_relobj::include_linkonce_section): Add new parameter.
935         * target-reloc.h (Comdat_behavior): New type.
936         (get_comdat_behavior): New function.
937         (relocate_section): Add code to map a discarded section to the
938         corresponding kept section when applying a relocation.
939
940 2008-04-30  Craig Silverstein  <csilvers@google.com>
941
942         * dwarf_reader.cc (next_generation_count): New static var.
943         (Addr2line_cache_entry): New struct.
944         (addr2line_cache): New static var.
945         (Dwarf_line_info::one_addr2line): Added caching.
946         (Dwarf_line_info::clear_addr2line_cache): New function.
947         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
948         cache-size parameter.
949         (Dwarf_line_info::one_addr2line_cache): New function.
950         * symtab.cc (Symbol_table::detect_odr_violations): Pass
951         new cache-size argument to one_addr2line(), and clear cache.
952
953 2008-04-28  Cary Coutant  <ccoutant@google.com>
954
955         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
956         R_386_PC8 relocations.
957
958 2008-04-23  Ian Lance Taylor  <iant@google.com>
959
960         * object.cc (Sized_relobj::include_section_group): Check for
961         invalid section group.
962
963         * object.cc (make_elf_object): Correct test for 64-bit ELF file
964         header size.
965
966         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
967         than read for file header.
968         * archive.cc (Archive::include_member): Likewise.
969
970 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
971
972         * aclocal.m4: Regenerate.
973         * configure: Regenerate.
974
975 2008-04-19  Ian Lance Taylor  <iant@google.com>
976
977         * version.cc (version_string): Bump to 1.6.
978
979         * testsuite/Makefile.am (many_sections_r_test): New target.
980         (many_sections_r_test_SOURCES): Remove.
981         (many_sections_r_test_DEPENDENCIES): Remove.
982         (many_sections_r_test_LDFLAGS): Remove.
983         (many_sections_r_test_LDADD): Remove.
984
985         * object.cc (Sized_relobj::do_add_symbols): Always pass
986         local_symbol_count_ to add_from_relobj.
987
988         * testsuite/Makefile.am (many_sections_check.h): Only check one in
989         every thousand variables.
990         * testsuite/Makefile.in: Rebuild.
991
992         * object.cc (Xindex::initialize_symtab_xindex): New function.
993         (Xindex::read_symtab_xindex): New function.
994         (Xindex::sym_xindex_to_shndx): New function.
995         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
996         available.
997         (Sized_relobj::do_initialize_xindex): New function.
998         (Sized_relobj::do_read_symbols): Adjust section links.
999         (Sized_relobj::symbol_section_and_value): Add is_ordinary
1000         parameter.  Change all callers.
1001         (Sized_relobj::include_section_group): Adjust section links and
1002         symbol section indexes.
1003         (Sized_relobj::do_layout): Adjust section links.
1004         (Sized_relobj::do_count_local_symbols): Adjust section links and
1005         symbol section indexes.
1006         (Sized_relobj::do_finalize_local_symbols): Distinguish between
1007         ordinary and special symbols.
1008         (Sized_relobj::write_local_symbols): Add symtab_xindex and
1009         dynsym_xindex parameters.  Change all callers.  Adjust section
1010         links.  Use SHN_XINDEX when needed.
1011         (Sized_relobj::get_symbol_location_info): Adjust section links.
1012         Don't get fooled by special symbols.
1013         * object.h (class Xindex): Define.
1014         (class Object): Add xindex_ parameter.  Declare virtual functoin
1015         do_initialize_xindex.
1016         (Object::adjust_sym_shndx): New function.
1017         (Object::set_xindex): New protected function.
1018         (class Symbol_value): Add is_ordinary_shndx_ field.
1019         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
1020         (Symbol_value::value): Assert ordinary section.
1021         (Symbol_value::initialize_input_to_output_map): Likewise.
1022         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
1023         Change all callers.
1024         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
1025         all callers.
1026         (class Sized_relobj): Update declarations.
1027         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
1028         parameter.  Change all callers.
1029         (Sized_relobj::adjust_shndx): New function.
1030         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
1031         field.
1032         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
1033         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
1034         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
1035         (Sized_dynobj::read_dynsym_section): Adjust section links.
1036         (Sized_dynobj::read_dynamic): Likewise.
1037         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
1038         section links.
1039         (Sized_dynobj::do_initialize_xindex): New function.
1040         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
1041         do_initialize_xindex.
1042         (Sized_dynobj::adjust_shndx): New function.
1043         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
1044         dynsym_xindex_ fields.
1045         (Layout::finalize): Add a call to set_section_indexes before
1046         creating the symtab sections.
1047         (Layout::set_section_indexes): Don't do anything if the section
1048         already has a section index.
1049         (Layout::create_symtab_sections): Add shnum parameter.  Change
1050         caller.  Create .symtab_shndx section if needed.
1051         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
1052         caller.
1053         (Layout::allocated_output_section_count): New function.
1054         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
1055         needed.
1056         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
1057         fields.  Update declarations.
1058         (Layout::symtab_xindex): New function.
1059         (Layout::dynsym_xindex): New function.
1060         (class Write_symbols_task): Add layout_ field.
1061         (Write_symbols_task::Write_symbols_task): Add layout parameter.
1062         Change caller.
1063         * output.cc (Output_section_headers::Output_section_headers): Add
1064         shstrtab_section parameter.  Change all callers.
1065         (Output_section_headers::do_sized_write): Store overflow values
1066         for section count and section string table section index in
1067         section header zero.
1068         (Output_file_header::do_sized_write): Check for overflow of
1069         section count and section string table section index.
1070         (Output_symtab_xindex::do_write): New function.
1071         (Output_symtab_xindex::endian_do_write): New function.
1072         * output.h (class Output_section_headers): Add shstrtab_section_.
1073         Update declarations.
1074         (class Output_symtab_xindex): Define.
1075         (Output_section::has_out_shndx): New function.
1076         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
1077         field.
1078         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
1079         Change all callers.
1080         (Sized_symbol::init): Likewise.
1081         (Symbol::output_section): Check for ordinary symbol.
1082         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
1083         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
1084         callers.
1085         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
1086         Change all callers.  Simplify handling of symbols from sections
1087         not included in the link.
1088         (Symbol_table::add_from_dynobj): Handle ordinary symbol
1089         distinction.
1090         (Weak_alias_sorter::operator()): Assert that symbols are
1091         ordinary.
1092         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
1093         distinction.
1094         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
1095         parameters.  Change all callers.
1096         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
1097         symbol distinction.  Use SHN_XINDEX when needed.
1098         (Symbol_table::write_section_symbol): Add symtab_xindex
1099         parameter.  Change all callers.
1100         (Symbol_table::sized_write_section_symbol): Likewise.  Use
1101         SHN_XINDEX when needed.
1102         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
1103         declarations.
1104         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
1105         (Symbol::is_defined): Check is_ordinary.
1106         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
1107         (Symbol::is_absolute, Symbol::is_common): Likewise.
1108         (class Sized_symbol): Update declarations.
1109         (class Symbol_table): Update declarations.
1110         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
1111         parameters.  Change all callers.
1112         (Sized_symbol::override): Likewise.
1113         (Symbol_table::override): Likewise.
1114         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
1115         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
1116         is_ordinary, and orig_st_shndx parameters.  Change all callers.
1117         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
1118         to be in an ordinary section.
1119         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
1120         object and is_ordinary parameters.  Change all callers.
1121         (Sized_dwarf_line_info::read_relocs): Add object parameter.
1122         Change all callers.  Don't add undefined or non-ordinary symbols
1123         to reloc_map_.
1124         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
1125         Change all callers.
1126         * dwarf_reader.h (class Sized_dwarf_line_info): Update
1127         declarations.
1128         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
1129         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
1130         (Sized_relobj::relocate_sections): Likewise.
1131         * target-reloc.h (scan_relocs): Adjust section symbol index.
1132         (scan_relocatable_relocs): Likewise.
1133         * i386.cc (Scan::local): Check for ordinary symbols.
1134         * sparc.cc (Scan::local): Likewise.
1135         * x86_64.cc (Scan::local): Likewise.
1136         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
1137         to symbol_section_and_value.
1138         * testsuite/many_sections_test.cc: New file.
1139         * testsuite/Makefile.am (BUILT_SOURCES): Define.
1140         (check_PROGRAMS): Add many_sections_test.
1141         (many_sections_test_SOURCES): Define.
1142         (many_sections_test_DEPENDENCIES): Define.
1143         (many_sections_test_LDFLAGS): Define.
1144         (BUILT_SOURCES): Add many_sections_define.h.
1145         (many_sections_define.h): New target.
1146         (BUILT_SOURCES): Add many_sections_check.h.
1147         (many_sections_check.h): New target.
1148         (check_PROGRAMS): Add many_sections_r_test.
1149         (many_sections_r_test_SOURCES): Define.
1150         (many_sections_r_test_DEPENDENCIES): Define.
1151         (many_sections_r_test_LDFLAGS): Define.
1152         (many_sections_r_test_LDADD): Define.
1153         (many_sections_r_test.o): New target.
1154         * testsuite/Makefile.in: Rebuild.
1155
1156 2008-04-17  Cary Coutant  <ccoutant@google.com>
1157
1158         * errors.cc (Errors::info): New function.
1159         (gold_info): New function.
1160         * errors.h (Errors::info): New function.
1161         * gold.h (gold_info): New function.
1162         * object.cc (Input_objects::add_object): Print trace output.
1163         * options.cc (options::parse_set): New function.
1164         (General_options::parse_wrap): Deleted.
1165         (General_options::General_options): Deleted initializer.
1166         * options.h (options::String_set): New typedef.
1167         (options::parse_set): New function.
1168         (DEFINE_set): New macro.
1169         (General_options::wrap): Changed to use DEFINE_set. Changed
1170         callers of any_wrap_symbols and is_wrap_symbol.
1171         (General_options::trace, General_options::trace_symbol):
1172         New options.
1173         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
1174         (General_options::wrap_symbols_): Deleted.
1175         * symtab.cc (Symbol_table::add_from_object): Print trace output.
1176
1177 2008-04-17  David S. Miller  <davem@davemloft.net>
1178
1179         * options.cc (General_options::parse_V): New function.
1180         * options.h: Add entries for -V and -Qy.
1181
1182 2008-04-17  Ian Lance Taylor  <iant@google.com>
1183
1184         * common.cc (Symbol_table::allocate_commons): Remove options
1185         parameter.  Change caller.
1186         (Symbol_table::do_allocate_commons): Remove options parameter.
1187         Change caller.  Just call do_allocate_commons_list twice.
1188         (Symbol_table::do_allocate_commons_list): New function, broken out
1189         of do_allocate_commons.
1190         * common.h (class Allocate_commons_task): Remove options_ field.
1191         Update constructor.
1192         * symtab.cc (Symbol_table::Symbol_table): Initialize
1193         tls_commons_.
1194         (Symbol_table::add_from_object): Put TLS common symbols on
1195         tls_commons_ list.
1196         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
1197         which are IN_OUTPUT_DATA.
1198         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
1199         allocate_commons and do_allocate_commons declarations.  Declare
1200         do_allocate_commons_list.
1201         * gold.cc (queue_middle_tasks): Update creation of
1202         Allocate_commons_task to not pass options.
1203         * testsuite/Makefile.am (INCLUDES): Add -I.. .
1204         (TLS_TEST_C_FLAGS): New variable.
1205         (tls_test_c_pic.o): New target.
1206         (tls_test_shared.so): Link in tls_test_c_pic.o.
1207         (tls_test_c_pic_ie.o): New target.
1208         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
1209         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
1210         (tls_test_c.o): New target.
1211         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
1212         (tls_pic_test_LDADD): Likewise.
1213         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
1214         (tls_shared_gd_to_ie_test_LDADD): Likewise.
1215         (tls_test_c_gnu2.o): New target.
1216         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
1217         tls_test_c_gnu2.o.
1218         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
1219         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
1220         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
1221         * testsuite/tls_test.cc: Include "config.h".
1222         (t_last): Call t11_last.
1223         * testsuite/tls_test.h (t11, t11_last): Declare.
1224         * testsuite/tls_test_c.c: New file.
1225         * testsuite/tls_test_main.cc (thread_routine): Call t11.
1226         * configure.ac: Check for OpenMP support.
1227         * configure, config.in, Makefile.in: Rebuild.
1228         * testsuite/Makefile.in: Rebuild.
1229
1230 2008-04-16  Cary Coutant  <ccoutant@google.com>
1231
1232         * i386.cc (Target_i386::define_tls_base_symbol): New function.
1233         (Target_i386::tls_base_symbol_defined_): New field.
1234         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
1235         (Target_i386::Scan::global): Likewise.
1236         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
1237         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
1238         (Target_x86_64::tls_base_symbol_defined_): New field.
1239         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
1240         (Target_x86_64::Scan::global): Likewise.
1241
1242 2008-04-16  Cary Coutant  <ccoutant@google.com>
1243
1244         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
1245         (Symbol::needs_plt_entry): Allow weak undefined symbols.
1246         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
1247         building shared libraries.
1248         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
1249         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
1250         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
1251         * testsuite/Makefile.in: Rebuild.
1252         * testsuite/weak_undef.h: New file.
1253         * testsuite/weak_undef_file1.cc: Add extra test cases.
1254         * testsuite/weak_undef_file2.cc: Likewise.
1255         * testsuite/weak_undef_test.cc: Likewise.
1256
1257 2008-04-16  David S. Miller  <davem@davemloft.net>
1258
1259         * sparc.cc (Target_sparc::Scan): Change from struct to class.
1260         Add issued_non_pic_error_ field.  Declare check_non_pic.
1261         (Target_sparc::Scan::check_non_pic): New function.
1262         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
1263         (Target_sparc::Scan::global): Likewise.
1264
1265         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
1266         * configure: Rebuild.
1267
1268         * options.h (DEFINE_enable): New macro.
1269         (new_dtags): New enable option.
1270         (initfirst, interpose, loadfltr, nodefaultlib,
1271         nodelete, nodlopen, nodump): New -z options.
1272         * layout.cc (Layout:finish_dynamic_section): If new
1273         dtags enabled, emit DT_RUNPATH.  Also, emit a
1274         DT_FLAGS_1 containing any specified -z flags.
1275
1276 2008-04-16  Ian Lance Taylor  <iant@google.com>
1277
1278         * copy-relocs.cc: New file.
1279         * copy-relocs.h: New file.
1280         * reloc.cc: Remove Copy_relocs code.
1281         * reloc.h: Likewise.
1282         * reloc-types.h (struct Reloc_types) [both versions]: Add
1283         get_reloc_addend_noerror.
1284         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
1285         variants of add_global which take an addend which must be zero.
1286         * i386.cc: Include "copy-relocs.h".
1287         (class Target_i386): Change type of copy_relocs_ to variable,
1288         update initializer.
1289         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
1290         Change all callers.
1291         (Target_i386::do_finalize_sections): Change handling of
1292         copy_relocs_.
1293         * sparc.cc: Include "copy-relocs.h".
1294         (class Target_sparc): Change type of copy_relocs_ to variable,
1295         update initializer.
1296         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
1297         Change all callers.
1298         (Target_sparc::do_finalize_sections): Change handling of
1299         copy_relocs_.
1300         * x86_64.cc: Include "copy-relocs.h".
1301         (class Target_x86_64): Change type of copy_relocs_ to variable,
1302         update initializer.
1303         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
1304         class.  Change all callers.
1305         (Target_x86_64::do_finalize_sections): Change handling of
1306         copy_relocs_.
1307         * Makefile.am (CCFILES): Add copy-relocs.cc.
1308         (HFILES): Add copy-relocs.h.
1309
1310         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
1311
1312         * testsuite/script_test_4.sh: Permit leading zeroes.
1313
1314 2008-04-15  Ian Lance Taylor  <iant@google.com>
1315
1316         * script-sections.cc (Script_sections::create_segments): Use
1317         header_size_adjustment even when there is enough room for the
1318         headers.
1319         * testsuite/script_test_4.sh: New file.
1320         * testsuite/script_test_4.t: New file.
1321         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
1322         (check_DATA): Add script_test_4.stdout.
1323         (MOSTLYCLEANFILES): Likewise.
1324         (script_test_4): New target.
1325         (script_test_4.stdout): New target.
1326         * testsuite/Makefile.in: Rebuild.
1327
1328         * sparc.cc: Add definitions for Output_data_plt_sparc class
1329         constants.
1330
1331 2008-04-14  David S. Miller  <davem@davemloft.net>
1332
1333         * sparc.cc: New file.
1334         * Makefile.am (TARGETSOURCES): Add sparc.cc
1335         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
1336         * configure.tgt: Document targ_extra_size and
1337         targ_extra_big_endian.  Add entries for sparc-* and
1338         sparc64-*.
1339         * configure.ac: Handle targ_extra_size and
1340         targ_extra_big_endian.
1341         * Makefile.in: Rebuild.
1342         * configure: Likewise.
1343         * po/POTFILES.in: Likewise.
1344         * po/gold.pot: Likewise.
1345
1346 2008-04-14  Ian Lance Taylor  <iant@google.com>
1347
1348         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
1349         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
1350         in the name/type/flags to section mapping.  Don't call
1351         allocate_output_section.
1352         (Layout::choose_output_section): Change parameter from adjust_name
1353         to is_input_section.  Don't permit input sections after sections
1354         are attached to segments.  Don't call allocate_output_section.
1355         (Layout::layout_eh_frame): Call update_flags_for_input_section,
1356         not write_enable_output_section.
1357         (Layout::make_output_section): Don't push to
1358         unattached_section_list_ nor call attach_to_segment.  Call
1359         attach_section_to_segment if sections are attached.
1360         (Layout::attach_sections_to_segments): New function.
1361         (Layout::attach_section_to_segment): New function.
1362         (Layout::attach_allocated_section_to_segment): Rename from
1363         attach_to_segment.  Remove flags parameter.
1364         (Layout::allocate_output_section): Remove function.
1365         (Layout::write_enable_output_section): Remove function.
1366         * layout.h (class Layout): Update for above changes.  Add new
1367         field sections_are_attached_.
1368         * output.h (Output_section::update_flags_for_input_section): New
1369         function.
1370         * output.cc (Output_section::add_input_section): Call
1371         update_flags_for_input_section.
1372         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
1373
1374 2008-04-11  Cary Coutant  <ccoutant@google.com>
1375
1376         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
1377         thought unnecessary.
1378         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
1379
1380 2008-04-11  Ian Lance Taylor  <iant@google.com>
1381
1382         * output.h (class Output_section_data): Remove inline definition
1383         of set_addralign.
1384         * output.cc (Output_section_data::set_addralign): New function.
1385
1386 2008-04-11  Cary Coutant  <ccoutant@google.com>
1387
1388         Add support for TLS descriptors for i386 and x86_64.
1389         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
1390         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
1391         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
1392         GOT_TYPE_TLS_DESC.
1393         (Target_i386::got_mod_index_entry): Remove unnecessary code.
1394         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
1395         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
1396         relocations.
1397         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
1398         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
1399         Fix problem with initial-exec relocations.
1400         (Target_i386::Relocate::relocate_tls): Likewise.
1401         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
1402         relaxation.
1403         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
1404         support for section-plus-offset dynamic table entries.
1405         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
1406         (Output_data_dynamic::Dynamic_entry): Add support for
1407         section-plus-offset dynamic table entries.
1408         (Output_data_dynamic::Classification): Likewise.
1409         (Output_data_dynamic::classification_): Renamed offset_.
1410         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
1411         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
1412         (Target_x86_64::make_plt_section): New function.
1413         (Target_x86_64::reserve_tlsdesc_entries): New function.
1414         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
1415         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
1416         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
1417         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
1418         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
1419         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
1420         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
1421         add extra PLT entry for TLS descriptors.
1422         (Output_data_plt_x86_64::got_): New field.
1423         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
1424         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
1425         fields.
1426         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
1427         descriptors.
1428         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
1429         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
1430         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
1431         R_386_TLS_DESC_CALL relocations.
1432         (Target_x86_64::Scan::global): Likewise.
1433         (Target_x86_64::do_finalize_sections): Add dynamic table entries
1434         for TLS descriptors.
1435         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
1436         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
1437         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
1438         GD-to-IE relaxation.
1439         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
1440         and TLS_DESCRIPTORS.
1441         * Makefile.in: Rebuild.
1442         * configure: Rebuild.
1443         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
1444         (tls_test_shared2.so): New target.
1445         (tls_shared_gd_to_ie_test_SOURCES): New variable.
1446         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
1447         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
1448         (tls_shared_gd_to_ie_test_LDADD): New variable.
1449         (tls_shared_gnu2_gd_to_ie_test): New target.
1450         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
1451         New targets.
1452         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
1453         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
1454         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
1455         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
1456         (tls_shared_gnu2_test): New target.
1457         (tls_test_gnu2_shared.so): New target.
1458         (tls_shared_gnu2_test_SOURCES): New variable.
1459         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
1460         (tls_shared_gnu2_test_LDFLAGS): New variable.
1461         (tls_shared_gnu2_test_LDADD): New variable.
1462         * testsuite/Makefile.in: Rebuild.
1463         * testsuite/Makefile.
1464
1465 2008-04-11  Ian Lance Taylor  <iant@google.com>
1466
1467         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
1468         justsyms.t.
1469         * testsuite/Makefile.in: Rebuild.
1470
1471         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
1472         long.
1473         * testsuite/script_test_2.cc (main): Adjust test.
1474
1475 2008-04-11  David S. Miller  <davem@davemloft.net>
1476             Ian Lance Taylor  <iant@google.com>
1477
1478         * options.h (General_options): Add entries for '-Y' and
1479         '-relax'.
1480         * options.cc (General_options:finalize): If -Y was used, add those
1481         entries to the library path instead of the default "/lib" and
1482         "/usr/lib".
1483
1484 2008-04-11  David S. Miller  <davem@davemloft.net>
1485
1486         * testsuite/justsyms.t: Start at 0x100.
1487         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
1488         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
1489         long.
1490         * testsuite/script_test_2.cc: Adjust string and section length
1491         checks.
1492
1493 2008-04-09  Ian Lance Taylor  <iant@google.com>
1494
1495         PR gold/5996
1496         * script-sections.cc (Sections_element::allocate_to_segment): Add
1497         orphan parameter.
1498         (Output_section_definition::allocate_to_segment): Likewise.
1499         (Orphan_output_section::allocate_to_segment): Likewise.
1500         (Script_sections::attach_sections_using_phdrs_clause): Don't
1501         propagate non-PT_LOAD segments to orphan sections.
1502         * testsuite/Makefile.am (script_test_3.stdout): Generate using
1503         readelf rather than objdump.
1504         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
1505         .interp section and PT_INTERP segment are the same size.
1506         * testsuite/Makefile.in: Rebuild.
1507
1508         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
1509         aliases for symbols defined in the same object.
1510         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
1511         (weak_alias_test_SOURCES): New variable.
1512         (weak_alias_test_DEPENDENCIES): New variable.
1513         (weak_alias_test_LDFLAGS): New variable.
1514         (weak_alias_test_LDADD): New variable.
1515         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
1516         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
1517         (weak_alias_test_3.o): New target.
1518         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
1519         * testsuite/weak_alias_test_main.cc: New file.
1520         * testsuite/weak_alias_test_1.cc: New file.
1521         * testsuite/weak_alias_test_2.cc: New file.
1522         * testsuite/weak_alias_test_3.cc: New file.
1523
1524 2008-04-08  Ian Lance Taylor  <iant@google.com>
1525
1526         * options.h (class General_options): Add --noinhibit-exec option.
1527         * main.cc (main): Check --noinhibit-exec.
1528
1529         * options.h (class General_options): Define --wrap as a special
1530         option.  Add wrap_symbols_ field.
1531         (General_options::any_wrap_symbols): New function.
1532         (General_options::is_wrap_symbol): New function.
1533         * options.cc (General_options::parse_wrap): New function.
1534         (General_options::General_options): Initialize wrap_symbols_.
1535         * symtab.cc (Symbol_table::wrap_symbol): New function.
1536         (Symbol_table::add_from_object): Handle --wrap.
1537         * symtab.h (class Symbol_table): Declare wrap_symbol.
1538         * target.h (Target::wrap_char): New function.
1539         (Target::Target_info): Add wrap_char field.
1540         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
1541         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1542         * testsuite/testfile.cc (Target_test::test_target_info):
1543         Likewise.
1544
1545         * errors.cc (Errors::undefined_symbol): Mention symbol version if
1546         there is one.
1547
1548         * layout.h (class Layout): Add added_eh_frame_data_ field.
1549         * layout.cc (Layout::Layout): Initialize new field.
1550         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
1551         output section until we find a section we merged successfully.
1552         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
1553         that the size be non-zero.
1554
1555         * merge.cc (Object_merge_map::get_output_offset): Remove inline
1556         qualifier.
1557
1558 2008-04-08  Craig Silverstein  <csilvers@google.com>
1559
1560         * configure.ac: Export new conditional variable HAVE_ZLIB.
1561         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
1562         on HAVE_ZLIB.
1563         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
1564         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
1565
1566 2008-04-07  Ian Lance Taylor  <iant@google.com>
1567
1568         * version.cc (version_string): Set to "1.5".
1569
1570         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
1571         Add issued_non_pic_error_ field.  Declare check_non_pic.
1572         (Target_x86_64::Scan::check_non_pic): New function.
1573         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
1574         (Target_x86_64::Scan::global): Likewise.
1575
1576         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
1577         addend parameter.  Change caller.  Handle merge sections.
1578         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
1579         Address to Addend.  Don't add in the result of
1580         local_section_offset, pass down the addend and use the returned
1581         value.
1582         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
1583         Update declarations of local_section_offset and symbol_value.
1584         * testsuite/two_file_test_1.cc (t18): New function.
1585         * testsuite/two_file_test_2.cc (f18): New function.
1586         * testsuite/two_file_test_main.cc (main): Call t18.
1587         * testsuite/two_file_test.h (t18, f18): Declare.
1588
1589         * configure.ac: Don't test for objdump, c++filt, or readelf.
1590         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
1591         conditionals.
1592         (TEST_READELF): New variable.
1593         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
1594         (check_PROGRAMS): Add two_file_strip_test.
1595         (two_file_strip_test): New target.
1596         (check_PROGRAMS): Add two_file_same_shared_strip_test.
1597         (two_file_same_shared_strip_test_SOURCES): New variable.
1598         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
1599         (two_file_same_shared_strip_test_LDFLAGS): New variable.
1600         (two_file_same_shared_strip_test_LDADD): New variable.
1601         (two_file_shared_strip.so): New target.
1602         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
1603         (ver_test_5.syms, ver_test_7.syms): Likewise.
1604         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
1605         (strip_test_3.stdout): Use TEST_OBJDUMP.
1606         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
1607
1608 2008-04-04  Cary Coutant  <ccoutant@google.com>
1609
1610         * symtab.h (Symbol::is_weak_undefined): New function.
1611         (Symbol::is_strong_undefined): New function.
1612         (Symbol::is_absolute): New function.
1613         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
1614         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
1615         absolute symbols.
1616         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
1617         (weak_undef_test): New target.
1618         * testsuite/Makefile.in: Rebuild.
1619         * testsuite/weak_undef_file1.cc: New file.
1620         * testsuite/weak_undef_file2.cc: New file.
1621         * testsuite/weak_undef_test.cc: New file.
1622
1623 2008-04-03  Craig Silverstein  <csilvers@google.com>
1624
1625         * compressed_output.h (class Output_compressed_section): Use
1626         unsigned buffer.
1627         * compressed_output.cc (zlib_compress): Use unsigned buffers,
1628         add zlib header.
1629         (zlib_compressed_suffix): Removed.
1630         (Output_compressed_section::set_final_data_size): Use unsigned
1631         buffers.
1632         * testsuite/Makefile.am (flagstest_compress_debug_sections):
1633         Fix linker invocation.
1634         (flagstest_o_specialfile_and_compress_debug_sections):
1635         Likewise.
1636         * testsuite/Makefile.in: Regenerated.
1637
1638 2008-04-02  David S. Miller  <davem@davemloft.net>
1639
1640         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
1641         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
1642
1643 2008-04-02  Craig Silverstein  <csilvers@google.com>
1644
1645         * TODO: New file.
1646
1647 2008-04-02  Ian Lance Taylor  <iant@google.com>
1648
1649         * fileread.cc (File_read::find_view): Add byteshift and vshifted
1650         parameters.  Update for new key type to views_.  Change all
1651         callers.
1652         (File_read::read): Adjust for byteshift in returned view.
1653         (File_read::add_view): New function, broken out of
1654         find_and_make_view.
1655         (File_read::make_view): New function, broken out of
1656         find_and_make_view.
1657         (File_read::find_or_make_view): Add offset and aligned
1658         parameters.  Rewrite accordingly.  Change all callers.
1659         (File_read::get_view): Add offset and aligned parameters.  Adjust
1660         for byteshift in return value.
1661         (File_read::get_lasting_view): Likewise.
1662         * fileread.h (class File_read): Update declarations.
1663         (class File_read::View): Add byteshift_ field.  Add byteshift to
1664         constructor.  Add byteshift method.
1665         * archive.h (Archive::clear_uncached_views): New function.
1666         (Archive::get_view): Add aligned parameter.  Change all callers.
1667         * object.h (Object::get_view): Add aligned parameter.  Change all
1668         callers.
1669         (Object::get_lasting_view): Likewise.
1670
1671         * fileread.cc (File_read::release): Don't call clear_views if
1672         there are multiple objects.
1673         * fileread.h (File_read::clear_uncached_views): New function.
1674         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
1675         on the archive.
1676
1677 2008-03-31  Cary Coutant  <ccoutant@google.com>
1678
1679         Add thin archive support.
1680         * archive.cc (Archive::armagt): New const.
1681         (Archive::setup): Remove task parameter and calls to unlock.
1682         (Archive::unlock_nested_archives): New function.
1683         (Archive::read_header): Add nested_off parameter. Change
1684         all callers.
1685         (Archive::interpret_header): Likewise.
1686         (Archive::include_all_members): Change to handle thin
1687         archives.
1688         (Archive::include_member): Likewise.
1689         * archive.h (Archive::Archive): Add new parameters and
1690         initializers.
1691         (Archive::armagt): New const.
1692         (Archive::setup): Remove task parameter.
1693         (Archive::unlock_nested_archives): New function.
1694         (Archive::read_header): Add nested_off parameter.
1695         (Archive::interpret_header): Likewise.
1696         (Archive::Nested_archive_table): New typedef.
1697         (Archive::is_thin_archive_): New field.
1698         (Archive::nested_archives_): New field.
1699         (Archive::options_): New field.
1700         (Archive::dirpath_): New field.
1701         (Archive::task_): New field.
1702         * readsyms.cc (Read_symbols::do_read_symbols): Add check
1703         for thin archives.  Pass additional parameters to
1704         Archive::Archive.  Unlock the archive file after calling
1705         Archive::setup.
1706         
1707 2008-03-29  Ian Lance Taylor  <iant@google.com>
1708
1709         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
1710         version symbol to be local.
1711         * testsuite/ver_test_4.sh: New file.
1712         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
1713         (check_DATA): Add ver_test_4.syms.
1714         (ver_test_4.syms): New target.
1715         * testsuite/Makefile.in: Rebuild.
1716
1717         * output.cc
1718         (Output_section::Input_section_sort_entry::has_priority): New
1719         function.
1720         (Output_section::Input_section_sort_entry::match_file_name): New
1721         function.
1722         (Output_section::Input_section_sort_entry::match_section_name):
1723         Remove.
1724         (Output_section::Input_section_sort_entry::match_section_name_prefix):
1725         Remove.
1726         (Output_section::Input_section_sort_entry::match_section_file):
1727         Remove.
1728         (Output_section::Input_section_sort_compare::operator()): Rewrite
1729         using new Input_section_sort_entry functions.  Sort crtbegin and
1730         crtend first.  Sort sections with no priority before sections with
1731         a priority.
1732         * testsuite/initpri1.c (d3): Check j != 4.
1733         (cd5): New constructor/destructor function.
1734         (main): Check j != 2.
1735
1736         * symtab.cc (Symbol_table::add_from_object): If we don't use the
1737         new symbol when resolving, don't call set_is_default.
1738         * testsuite/ver_test_7.cc: New file.
1739         * testsuite/ver_test_7.sh: New file.
1740         * testsuite/Makefile.am (ver_test_7.so): New target.
1741         (ver_test_7.o): New target.
1742         (check_SCRIPTS): Add ver_test_7.sh.
1743         (check_DATA): Add ver_test_7.syms.
1744         (ver_test_7.syms): New target.
1745
1746 2008-03-28  Ian Lance Taylor  <iant@google.com>
1747
1748         * layout.cc (Layout::layout): If we see an input section with a
1749         name that needs sorting, set the must_sort flag for the output
1750         section.
1751         (Layout::make_output_section): If the name of the output section
1752         indicates that it might require sorting, set the may_sort flag.
1753         * output.h (Output_section::may_sort_attached_input_sections): New
1754         function.
1755         (Output_section::set_may_sort_attached_input_sections): New
1756         function.
1757         (Output_section::must_sort_attached_input_sections): New
1758         function.
1759         (Output_section::set_must_sort_attached_input_sections): New
1760         function.
1761         (class Output_section): Declare Input_section_sort_entry.  Define
1762         Input_section_sort_compare.  Declare
1763         sort_attached_input_sections.  Add new fields:
1764         may_sort_attached_input_sections_,
1765         must_sort_attached_input_sections_,
1766         attached_input_sections_are_sorted_.
1767         * output.cc (Output_section::Output_section): Initialize new
1768         fields.
1769         (Output_section::add_input_section): Add an entry to
1770         input_sections_ if may_sort or must_sort are true.
1771         (Output_section::set_final_data_size): Call
1772         sort_attached_input_sections if necessary.
1773         (Output_section::Input_section_sort_entry): Define new class.
1774         (Output_section::Input_section_sort_compare::operator()): New
1775         function.
1776         (Output_section::sort_attached_input_sections): New function.
1777         * configure.ac: Check whether the compiler supports constructor
1778         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
1779         * testsuite/initpri1.c: New file.
1780         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
1781         CONSTRUCTOR_PRIORITY.
1782         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
1783         (initpri1_LDFLAGS): New variable.
1784         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
1785
1786 2008-03-27  Ian Lance Taylor  <iant@google.com>
1787
1788         * common.cc (Sort_commons::operator): Correct sorting algorithm.
1789         * testsuite/common_test_1.c: New file.
1790         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
1791         (common_test_1_SOURCES): New variable.
1792         (common_test_1_DEPENDENCIES): New variable.
1793         (common_test_1_LDFLAGS): New variable.
1794
1795         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
1796         and commons_ correctly when NAME/VERSION does not override
1797         NAME/NULL.
1798         * testsuite/ver_test_6.c: New file.
1799         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
1800         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
1801         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
1802
1803 2008-03-26  Ian Lance Taylor  <iant@google.com>
1804
1805         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
1806         of an undefined symbol from a version script.
1807         * testsuite/Makefile.am (ver_test_5.so): New target.
1808         (ver_test_5.o): New target.
1809         (check_SCRIPTS): Add ver_test_5.sh.
1810         (check_DATA): Add ver_test_5.syms.
1811         (ver_test_5.syms): New target.
1812         * testsuite/ver_test_5.cc: New file.
1813         * testsuite/ver_test_5.script: New file.
1814         * testsuite/ver_test_5.sh: New file.
1815         * Makefile.in, testsuite/Makefile.in: Rebuild.
1816
1817         PR gold/5986
1818         Fix problems building gold with gcc 4.3.0.
1819         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
1820         (gold_error_at_location, gold_warning_at_location): Use it.
1821         * configure.ac: Check whether we can compile and use a template
1822         function with a printf attribute.
1823         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
1824         when jumping over bytes.
1825         * object.cc: Instantiate Object::read_section_data.
1826         * debug.h: Include <cstring>
1827         * dwarf_reader.cc: Include <algorithm>
1828         * main.cc: Include <cstring>.
1829         * options.cc: Include <cstring>.
1830         * output.cc: Include <cstring>.
1831         * script.cc: Include <cstring>.
1832         * script.h: Include <string>.
1833         * symtab.cc: Include <cstring> and <algorithm>.
1834         * target-select.cc: Include <cstring>.
1835         * version.cc: Include <string>.
1836         * testsuite/testmain.cc: Include <cstdlib>.
1837         * configure, config.in: Rebuild.
1838
1839 2008-03-25  Ian Lance Taylor  <iant@google.com>
1840
1841         * options.cc: Include "../bfd/bfdver.h".
1842         (options::help): Print bug reporting address.
1843
1844         * version.cc (print_version): Adjust output for current value of
1845         BFD_VERSION_STRING.
1846
1847         * NEWS: New file.
1848
1849         * options.cc (options::help): Print list of supported targets.
1850         * target-select.h: Include <vector>.
1851         (class Target_selector): Make machine_, size_, and is_big_endian_
1852         fields const.  Add bfd_name_ and instantiated_target_ fields.
1853         (Target_selector::Target_selector): Add bfd_name parameter.
1854         (Target_selector::recognize): Make non-virtual, call
1855         do_recognize.
1856         (Target_selector::recognize_by_name): Make non-virtual, call
1857         do_recognize_by_name.
1858         (Target_selector::supported_names): New function.
1859         (Target_selector::bfd_name): New function.
1860         (Target_selector::do_instantiate_target): New pure virtual
1861         function.
1862         (Target_selector::do_recognize): New virtual function.
1863         (Target_selector::do_recognize_by_name): New virtual function.
1864         (Target_selector::instantiate_target): New private function.
1865         (supported_target_names): Declare.
1866         * target-select.cc (Target_selector::Target_selector): Update for
1867         new parameter and fields.
1868         (select_target_by_name): Check that the name matches before
1869         calling recognize_by_name.
1870         (supported_target_names): New function.
1871         * i386.cc (class Target_selector_i386): Update Target_selector
1872         constructor call.  Remove recognize and recognize_by_name.  Add
1873         do_instantiate_target.
1874         * x86_64.cc (class Target_selector_x86_64): Likewise.
1875         * testsuite/testfile.cc (class Target_selector_test): Update for
1876         changes to Target_selector.
1877
1878         * README: Rewrite, with some notes on unsupported features.
1879
1880 2008-03-24  Cary Coutant  <ccoutant@google.com>
1881
1882         * i386.cc (Target_i386::Got_type): New enum declaration.
1883         (Target_i386::Scan::local): Updated callers of Output_data_got
1884         member functions.
1885         (Target_i386::Scan::global): Likewise.
1886         (Target_i386::Relocate::relocate): Likewise.
1887         (Target_i386::Relocate::relocate_tls): Likewise.
1888         * object.h (Got_offset_list): New class.
1889         (Sized_relobj::local_has_got_offset): Added got_type parameter.
1890         (Sized_relobj::local_got_offset): Likewise.
1891         (Sized_relobj::set_local_got_offset): Likewise.
1892         (Sized_relobj::local_has_tls_got_offset): Removed.
1893         (Sized_relobj::local_tls_got_offset): Removed.
1894         (Sized_relobj::set_local_tls_got_offset): Removed.
1895         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
1896         * output.cc (Output_data_got::add_global): Added got_type parameter.
1897         (Output_data_got::add_global_with_rel): Likewise.
1898         (Output_data_got::add_global_with_rela): Likewise.
1899         (Output_data_got::add_global_pair_with_rel): New function.
1900         (Output_data_got::add_global_pair_with_rela): New function.
1901         (Output_data_got::add_local): Added got_type parameter.
1902         (Output_data_got::add_local_with_rel): Likewise.
1903         (Output_data_got::add_local_with_rela): Likewise.
1904         (Output_data_got::add_local_pair_with_rel): New function.
1905         (Output_data_got::add_local_pair_with_rela): New function.
1906         (Output_data_got::add_global_tls): Removed.
1907         (Output_data_got::add_global_tls_with_rel): Removed.
1908         (Output_data_got::add_global_tls_with_rela): Removed.
1909         (Output_data_got::add_local_tls): Removed.
1910         (Output_data_got::add_local_tls_with_rel): Removed.
1911         (Output_data_got::add_local_tls_with_rela): Removed.
1912         * output.h (Output_data_got::add_global): Added got_type parameter.
1913         (Output_data_got::add_global_with_rel): Likewise.
1914         (Output_data_got::add_global_with_rela): Likewise.
1915         (Output_data_got::add_global_pair_with_rel): New function.
1916         (Output_data_got::add_global_pair_with_rela): New function.
1917         (Output_data_got::add_local): Added got_type parameter.
1918         (Output_data_got::add_local_with_rel): Likewise.
1919         (Output_data_got::add_local_with_rela): Likewise.
1920         (Output_data_got::add_local_pair_with_rel): New function.
1921         (Output_data_got::add_local_pair_with_rela): New function.
1922         (Output_data_got::add_global_tls): Removed.
1923         (Output_data_got::add_global_tls_with_rel): Removed.
1924         (Output_data_got::add_global_tls_with_rela): Removed.
1925         (Output_data_got::add_local_tls): Removed.
1926         (Output_data_got::add_local_tls_with_rel): Removed.
1927         (Output_data_got::add_local_tls_with_rela): Removed.
1928         * resolve.cc (Symbol::override_base_with_special): Removed
1929         reference to has_got_offset_ field.
1930         * symtab.cc (Symbol::init_fields): Replaced initialization
1931         of got_offset_ with got_offsets_.  Removed initialization
1932         of has_got_offset_
1933         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
1934         (Symbol::got_offset): Likewise.
1935         (Symbol::set_got_offset): Likewise.
1936         (Symbol::has_tls_got_offset): Removed.
1937         (Symbol::tls_got_offset): Removed.
1938         (Symbol::set_tls_got_offset): Removed.
1939         (Symbol::got_offset_): Removed.
1940         (Symbol::tls_mod_got_offset_): Removed.
1941         (Symbol::tls_pair_got_offset_): Removed.
1942         (Symbol::got_offsets_): New field.
1943         (Symbol::has_got_offset): Removed.
1944         (Symbol::has_tls_mod_got_offset): Removed.
1945         (Symbol::has_tls_pair_got_offset): Removed.
1946         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
1947         (Target_x86_64::Scan::local): Updated callers of Output_data_got
1948         member functions.
1949         (Target_x86_64::Scan::global): Likewise.
1950         (Target_x86_64::Relocate::relocate): Likewise.
1951         (Target_x86_64::Relocate::relocate_tls): Likewise.
1952
1953 2008-03-25  Ben Elliston  <bje@au.ibm.com>
1954
1955         * yyscript.y: Fix spelling error in comment.
1956
1957 2008-03-24  Ian Lance Taylor  <iant@google.com>
1958
1959         * options.h (class General_options): Define build_id option.
1960         * layout.h (class Layout): Declare write_build_id, create_note,
1961         create_build_id.  Add build_id_note_ member.
1962         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
1963         "libiberty.h", "md5.h", "sha1.h".
1964         (Layout::Layout): Initialize eh_frame_data_,
1965         eh_frame_hdr_section_, and build_id_note_.
1966         (Layout::finalize): Call create_build_id.
1967         (Layout::create_note): New function, broken out of
1968         Layout::create_gold_note.
1969         (Layout::create_gold_note): Call create_note.
1970         (Layout::create_build_id): New function.
1971         (Layout::write_build_id): New function.
1972         (Close_task_runner::run): Call write_build_id.
1973
1974         * x86_64.cc: Correct license to GPLv3.
1975
1976 2008-03-23  Ian Lance Taylor  <iant@google.com>
1977
1978         * options.cc: Include "demangle.h".
1979         (parse_optional_string): New function.
1980         (parse_long_option): Handle takes_optional_argument.
1981         (parse_short_option): Update dash_z initializer.  Handle
1982         takes_optional_argument.
1983         (General_options::General_options): Initialize do_demangle_.
1984         (General_options::finalize): Set do_demangle_.  Handle demangling
1985         style.
1986         * options.h (parse_optional_string): Declare.
1987         (struct One_option): Add optional_arg field.  Update constructor.
1988         Update call constructor calls.  Add takes_optional_argument
1989         function.
1990         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
1991         (DEFINE_optional_string): Define.
1992         (General_options::demangle): Change from DEFINE_bool to
1993         DEFINE_optional_string.
1994         (General_options::no_demangle): New function.
1995         (General_options::do_demangle): New function.
1996         (General_options::set_do_demangle): New function.
1997         (General_options::execstack_status_): Move definition to end of
1998         class definition.
1999         (General_options::static_): Likewise.
2000         (General_options::do_demangle_): New field.
2001         * object.cc (big_endian>::get_symbol_location_info): Call
2002         Options::do_demangle, not Options::demangle.
2003         * symtab.cc (demangle): Likewise.
2004
2005 2008-03-22  Ian Lance Taylor  <iant@google.com>
2006
2007         * gold.h: Include <cstddef> and <sys/types.h>
2008         * options.h: Include <cstring>.
2009
2010 2008-03-21  Ian Lance Taylor  <iant@google.com>
2011
2012         * Added source code to GNU binutils.
2013