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