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