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