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