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