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