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