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