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