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