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