* options.h (DEFINE_var): Add set_user_set_##varname__.
[external/binutils.git] / gold / ChangeLog
1 2008-05-06  Ian Lance Taylor  <iant@google.com>
2
3         * options.h (DEFINE_var): Add set_user_set_##varname__.
4         (DEFINE_bool_alias): New macro.
5         (class General_options): Define -Bstatic using DEFINE_bool_alias
6         rather than DEFINE_special.  Add --undefined as an alias for -z
7         defs.
8         * options.cc (General_options::parse_Bstatic): Remove.
9
10         * options.h (class General_options): Add --fatal-warnings.
11         * main.cc (main): Implement --fatal-warnings.
12         * errors.h (Errors::warning_count): New function.
13
14         * options.h (class General_options): Add -Bsymbolic-functions.
15         * symtab.h (Symbol::is_preemptible): Check for
16         -Bsymbolic-functions.
17
18 2008-05-05  Ian Lance Taylor  <iant@google.com>
19
20         * options.h (DEFINE_bool): For DASH_Z, create the negative option
21         as noVARNAME rather than no-VARNAME.
22         (class General_options): Add option -z combreloc.
23         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
24         get_address.
25         (Output_reloc::sort_before) [SHT_REL]: New function.
26         (Output_reloc::sort_before) [SHT_RELA]: New function.
27         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
28         Sort_relocs_comparison.
29         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
30         parameter.  Change all callers.
31         (Output_data_reloc::Output_data_reloc) [both versions]: Add
32         sort_relocs parameter.  Change all callers.
33         * output.cc (Output_reloc::get_address): New function, broken out
34         of write_rel.
35         (Output_reloc::write_rel): Call it.
36         (Output_reloc::compare): New function.
37         (Output_data_reloc_base::do_write): Optionally sort relocs.
38
39         * configure.ac: If targ_extra_obj is set, link it in.
40         * configure.tgt: Initialize all variables.
41         (x86_64*): Set targ_extra_obj and targ_extra_size.
42         * configure: Rebuild.
43
44         * object.cc (Sized_relobj::include_section_group): Adjust section
45         indexes read from group data.  Build vector to pass to
46         layout_group.
47         * layout.cc (Layout::layout_group): Add flags and shndxes
48         parameters.  Remove contents parameter.  Change caller.  Update
49         explicit instantiations.
50         * layout.h (class Layout): Update layout_group declaration.
51         * output.cc (Output_data_group::Output_data_group): Add flags and
52         input_shndxes parameters.  Remove contents parameter.  Change
53         caller.
54         (Output_data_group::do_write): Change input_sections_ to
55         input_shndxes_.
56         * output.h (class Output_data_group): Update constructor
57         declaration.  Rename input_sections_ to input_shndxes_.
58         * testsuite/many_sections_test.cc: Add template.
59
60 2008-04-30  Cary Coutant  <ccoutant@google.com>
61
62         * target-reloc.h (relocate_section): Fix dead-pointer bug.
63
64         * layout.cc (Layout::include_section): Refactored check for debug
65         info section.
66         (Layout::add_comdat): Add new parameters.  Change type
67         of signature parameter.  Add object and shndx to signatures table.
68         (Layout::find_kept_object): New function.
69         * layout.h: Include <cstring>.
70         (Layout::is_debug_info_section): New function.
71         (Layout::add_comdat): Add new parameters.
72         (Layout::find_kept_object): New function.
73         (Layout::Kept_section): New struct.
74         (Layout::Signatures): Change type of map range.
75         * object.cc (Relobj::output_section_address): New function.
76         (Sized_relobj::include_section_group): Add new parameters.  Change
77         calls to Layout::add_comdat.  Change to build table of kept comdat
78         groups and table mapping discarded sections to kept sections.
79         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
80         (Sized_relobj::do_layout): Change calls to include_section_group and
81         include_linkonce_section.
82         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
83         value to zero when section is discarded.
84         (Sized_relobj::map_to_kept_section): New function.
85         * object.h (Relobj::output_section_address): New function.
86         (Relobj::Comdat_group): New type.
87         (Relobj::find_comdat_group): New function.
88         (Relobj::Comdat_group_table): New type.
89         (Relobj::Kept_comdat_section): New type.
90         (Relobj::Kept_comdat_section_table): New type.
91         (Relobj::add_comdat_group): New function.
92         (Relobj::set_kept_comdat_section): New function.
93         (Relobj::get_kept_comdat_section): New function.
94         (Relobj::comdat_groups_): New field.
95         (Relobj::kept_comdat_sections_): New field.
96         (Symbol_value::input_value): Update comment.
97         (Sized_relobj::map_to_kept_section) New function.
98         (Sized_relobj::include_linkonce_section): Add new parameter.
99         * target-reloc.h (Comdat_behavior): New type.
100         (get_comdat_behavior): New function.
101         (relocate_section): Add code to map a discarded section to the
102         corresponding kept section when applying a relocation.
103
104 2008-04-30  Craig Silverstein  <csilvers@google.com>
105
106         * dwarf_reader.cc (next_generation_count): New static var.
107         (Addr2line_cache_entry): New struct.
108         (addr2line_cache): New static var.
109         (Dwarf_line_info::one_addr2line): Added caching.
110         (Dwarf_line_info::clear_addr2line_cache): New function.
111         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
112         cache-size parameter.
113         (Dwarf_line_info::one_addr2line_cache): New function.
114         * symtab.cc (Symbol_table::detect_odr_violations): Pass
115         new cache-size argument to one_addr2line(), and clear cache.
116
117 2008-04-28  Cary Coutant  <ccoutant@google.com>
118
119         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
120         R_386_PC8 relocations.
121
122 2008-04-23  Ian Lance Taylor  <iant@google.com>
123
124         * object.cc (Sized_relobj::include_section_group): Check for
125         invalid section group.
126
127         * object.cc (make_elf_object): Correct test for 64-bit ELF file
128         header size.
129
130         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
131         than read for file header.
132         * archive.cc (Archive::include_member): Likewise.
133
134 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
135
136         * aclocal.m4: Regenerate.
137         * configure: Regenerate.
138
139 2008-04-19  Ian Lance Taylor  <iant@google.com>
140
141         * version.cc (version_string): Bump to 1.6.
142
143         * testsuite/Makefile.am (many_sections_r_test): New target.
144         (many_sections_r_test_SOURCES): Remove.
145         (many_sections_r_test_DEPENDENCIES): Remove.
146         (many_sections_r_test_LDFLAGS): Remove.
147         (many_sections_r_test_LDADD): Remove.
148
149         * object.cc (Sized_relobj::do_add_symbols): Always pass
150         local_symbol_count_ to add_from_relobj.
151
152         * testsuite/Makefile.am (many_sections_check.h): Only check one in
153         every thousand variables.
154         * testsuite/Makefile.in: Rebuild.
155
156         * object.cc (Xindex::initialize_symtab_xindex): New function.
157         (Xindex::read_symtab_xindex): New function.
158         (Xindex::sym_xindex_to_shndx): New function.
159         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
160         available.
161         (Sized_relobj::do_initialize_xindex): New function.
162         (Sized_relobj::do_read_symbols): Adjust section links.
163         (Sized_relobj::symbol_section_and_value): Add is_ordinary
164         parameter.  Change all callers.
165         (Sized_relobj::include_section_group): Adjust section links and
166         symbol section indexes.
167         (Sized_relobj::do_layout): Adjust section links.
168         (Sized_relobj::do_count_local_symbols): Adjust section links and
169         symbol section indexes.
170         (Sized_relobj::do_finalize_local_symbols): Distinguish between
171         ordinary and special symbols.
172         (Sized_relobj::write_local_symbols): Add symtab_xindex and
173         dynsym_xindex parameters.  Change all callers.  Adjust section
174         links.  Use SHN_XINDEX when needed.
175         (Sized_relobj::get_symbol_location_info): Adjust section links.
176         Don't get fooled by special symbols.
177         * object.h (class Xindex): Define.
178         (class Object): Add xindex_ parameter.  Declare virtual functoin
179         do_initialize_xindex.
180         (Object::adjust_sym_shndx): New function.
181         (Object::set_xindex): New protected function.
182         (class Symbol_value): Add is_ordinary_shndx_ field.
183         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
184         (Symbol_value::value): Assert ordinary section.
185         (Symbol_value::initialize_input_to_output_map): Likewise.
186         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
187         Change all callers.
188         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
189         all callers.
190         (class Sized_relobj): Update declarations.
191         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
192         parameter.  Change all callers.
193         (Sized_relobj::adjust_shndx): New function.
194         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
195         field.
196         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
197         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
198         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
199         (Sized_dynobj::read_dynsym_section): Adjust section links.
200         (Sized_dynobj::read_dynamic): Likewise.
201         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
202         section links.
203         (Sized_dynobj::do_initialize_xindex): New function.
204         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
205         do_initialize_xindex.
206         (Sized_dynobj::adjust_shndx): New function.
207         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
208         dynsym_xindex_ fields.
209         (Layout::finalize): Add a call to set_section_indexes before
210         creating the symtab sections.
211         (Layout::set_section_indexes): Don't do anything if the section
212         already has a section index.
213         (Layout::create_symtab_sections): Add shnum parameter.  Change
214         caller.  Create .symtab_shndx section if needed.
215         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
216         caller.
217         (Layout::allocated_output_section_count): New function.
218         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
219         needed.
220         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
221         fields.  Update declarations.
222         (Layout::symtab_xindex): New function.
223         (Layout::dynsym_xindex): New function.
224         (class Write_symbols_task): Add layout_ field.
225         (Write_symbols_task::Write_symbols_task): Add layout parameter.
226         Change caller.
227         * output.cc (Output_section_headers::Output_section_headers): Add
228         shstrtab_section parameter.  Change all callers.
229         (Output_section_headers::do_sized_write): Store overflow values
230         for section count and section string table section index in
231         section header zero.
232         (Output_file_header::do_sized_write): Check for overflow of
233         section count and section string table section index.
234         (Output_symtab_xindex::do_write): New function.
235         (Output_symtab_xindex::endian_do_write): New function.
236         * output.h (class Output_section_headers): Add shstrtab_section_.
237         Update declarations.
238         (class Output_symtab_xindex): Define.
239         (Output_section::has_out_shndx): New function.
240         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
241         field.
242         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
243         Change all callers.
244         (Sized_symbol::init): Likewise.
245         (Symbol::output_section): Check for ordinary symbol.
246         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
247         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
248         callers.
249         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
250         Change all callers.  Simplify handling of symbols from sections
251         not included in the link.
252         (Symbol_table::add_from_dynobj): Handle ordinary symbol
253         distinction.
254         (Weak_alias_sorter::operator()): Assert that symbols are
255         ordinary.
256         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
257         distinction.
258         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
259         parameters.  Change all callers.
260         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
261         symbol distinction.  Use SHN_XINDEX when needed.
262         (Symbol_table::write_section_symbol): Add symtab_xindex
263         parameter.  Change all callers.
264         (Symbol_table::sized_write_section_symbol): Likewise.  Use
265         SHN_XINDEX when needed.
266         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
267         declarations.
268         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
269         (Symbol::is_defined): Check is_ordinary.
270         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
271         (Symbol::is_absolute, Symbol::is_common): Likewise.
272         (class Sized_symbol): Update declarations.
273         (class Symbol_table): Update declarations.
274         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
275         parameters.  Change all callers.
276         (Sized_symbol::override): Likewise.
277         (Symbol_table::override): Likewise.
278         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
279         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
280         is_ordinary, and orig_st_shndx parameters.  Change all callers.
281         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
282         to be in an ordinary section.
283         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
284         object and is_ordinary parameters.  Change all callers.
285         (Sized_dwarf_line_info::read_relocs): Add object parameter.
286         Change all callers.  Don't add undefined or non-ordinary symbols
287         to reloc_map_.
288         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
289         Change all callers.
290         * dwarf_reader.h (class Sized_dwarf_line_info): Update
291         declarations.
292         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
293         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
294         (Sized_relobj::relocate_sections): Likewise.
295         * target-reloc.h (scan_relocs): Adjust section symbol index.
296         (scan_relocatable_relocs): Likewise.
297         * i386.cc (Scan::local): Check for ordinary symbols.
298         * sparc.cc (Scan::local): Likewise.
299         * x86_64.cc (Scan::local): Likewise.
300         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
301         to symbol_section_and_value.
302         * testsuite/many_sections_test.cc: New file.
303         * testsuite/Makefile.am (BUILT_SOURCES): Define.
304         (check_PROGRAMS): Add many_sections_test.
305         (many_sections_test_SOURCES): Define.
306         (many_sections_test_DEPENDENCIES): Define.
307         (many_sections_test_LDFLAGS): Define.
308         (BUILT_SOURCES): Add many_sections_define.h.
309         (many_sections_define.h): New target.
310         (BUILT_SOURCES): Add many_sections_check.h.
311         (many_sections_check.h): New target.
312         (check_PROGRAMS): Add many_sections_r_test.
313         (many_sections_r_test_SOURCES): Define.
314         (many_sections_r_test_DEPENDENCIES): Define.
315         (many_sections_r_test_LDFLAGS): Define.
316         (many_sections_r_test_LDADD): Define.
317         (many_sections_r_test.o): New target.
318         * testsuite/Makefile.in: Rebuild.
319
320 2008-04-17  Cary Coutant  <ccoutant@google.com>
321
322         * errors.cc (Errors::info): New function.
323         (gold_info): New function.
324         * errors.h (Errors::info): New function.
325         * gold.h (gold_info): New function.
326         * object.cc (Input_objects::add_object): Print trace output.
327         * options.cc (options::parse_set): New function.
328         (General_options::parse_wrap): Deleted.
329         (General_options::General_options): Deleted initializer.
330         * options.h (options::String_set): New typedef.
331         (options::parse_set): New function.
332         (DEFINE_set): New macro.
333         (General_options::wrap): Changed to use DEFINE_set. Changed
334         callers of any_wrap_symbols and is_wrap_symbol.
335         (General_options::trace, General_options::trace_symbol):
336         New options.
337         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
338         (General_options::wrap_symbols_): Deleted.
339         * symtab.cc (Symbol_table::add_from_object): Print trace output.
340
341 2008-04-17  David S. Miller  <davem@davemloft.net>
342
343         * options.cc (General_options::parse_V): New function.
344         * options.h: Add entries for -V and -Qy.
345
346 2008-04-17  Ian Lance Taylor  <iant@google.com>
347
348         * common.cc (Symbol_table::allocate_commons): Remove options
349         parameter.  Change caller.
350         (Symbol_table::do_allocate_commons): Remove options parameter.
351         Change caller.  Just call do_allocate_commons_list twice.
352         (Symbol_table::do_allocate_commons_list): New function, broken out
353         of do_allocate_commons.
354         * common.h (class Allocate_commons_task): Remove options_ field.
355         Update constructor.
356         * symtab.cc (Symbol_table::Symbol_table): Initialize
357         tls_commons_.
358         (Symbol_table::add_from_object): Put TLS common symbols on
359         tls_commons_ list.
360         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
361         which are IN_OUTPUT_DATA.
362         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
363         allocate_commons and do_allocate_commons declarations.  Declare
364         do_allocate_commons_list.
365         * gold.cc (queue_middle_tasks): Update creation of
366         Allocate_commons_task to not pass options.
367         * testsuite/Makefile.am (INCLUDES): Add -I.. .
368         (TLS_TEST_C_FLAGS): New variable.
369         (tls_test_c_pic.o): New target.
370         (tls_test_shared.so): Link in tls_test_c_pic.o.
371         (tls_test_c_pic_ie.o): New target.
372         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
373         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
374         (tls_test_c.o): New target.
375         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
376         (tls_pic_test_LDADD): Likewise.
377         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
378         (tls_shared_gd_to_ie_test_LDADD): Likewise.
379         (tls_test_c_gnu2.o): New target.
380         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
381         tls_test_c_gnu2.o.
382         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
383         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
384         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
385         * testsuite/tls_test.cc: Include "config.h".
386         (t_last): Call t11_last.
387         * testsuite/tls_test.h (t11, t11_last): Declare.
388         * testsuite/tls_test_c.c: New file.
389         * testsuite/tls_test_main.cc (thread_routine): Call t11.
390         * configure.ac: Check for OpenMP support.
391         * configure, config.in, Makefile.in: Rebuild.
392         * testsuite/Makefile.in: Rebuild.
393
394 2008-04-16  Cary Coutant  <ccoutant@google.com>
395
396         * i386.cc (Target_i386::define_tls_base_symbol): New function.
397         (Target_i386::tls_base_symbol_defined_): New field.
398         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
399         (Target_i386::Scan::global): Likewise.
400         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
401         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
402         (Target_x86_64::tls_base_symbol_defined_): New field.
403         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
404         (Target_x86_64::Scan::global): Likewise.
405
406 2008-04-16  Cary Coutant  <ccoutant@google.com>
407
408         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
409         (Symbol::needs_plt_entry): Allow weak undefined symbols.
410         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
411         building shared libraries.
412         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
413         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
414         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
415         * testsuite/Makefile.in: Rebuild.
416         * testsuite/weak_undef.h: New file.
417         * testsuite/weak_undef_file1.cc: Add extra test cases.
418         * testsuite/weak_undef_file2.cc: Likewise.
419         * testsuite/weak_undef_test.cc: Likewise.
420
421 2008-04-16  David S. Miller  <davem@davemloft.net>
422
423         * sparc.cc (Target_sparc::Scan): Change from struct to class.
424         Add issued_non_pic_error_ field.  Declare check_non_pic.
425         (Target_sparc::Scan::check_non_pic): New function.
426         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
427         (Target_sparc::Scan::global): Likewise.
428
429         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
430         * configure: Rebuild.
431
432         * options.h (DEFINE_enable): New macro.
433         (new_dtags): New enable option.
434         (initfirst, interpose, loadfltr, nodefaultlib,
435         nodelete, nodlopen, nodump): New -z options.
436         * layout.cc (Layout:finish_dynamic_section): If new
437         dtags enabled, emit DT_RUNPATH.  Also, emit a
438         DT_FLAGS_1 containing any specified -z flags.
439
440 2008-04-16  Ian Lance Taylor  <iant@google.com>
441
442         * copy-relocs.cc: New file.
443         * copy-relocs.h: New file.
444         * reloc.cc: Remove Copy_relocs code.
445         * reloc.h: Likewise.
446         * reloc-types.h (struct Reloc_types) [both versions]: Add
447         get_reloc_addend_noerror.
448         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
449         variants of add_global which take an addend which must be zero.
450         * i386.cc: Include "copy-relocs.h".
451         (class Target_i386): Change type of copy_relocs_ to variable,
452         update initializer.
453         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
454         Change all callers.
455         (Target_i386::do_finalize_sections): Change handling of
456         copy_relocs_.
457         * sparc.cc: Include "copy-relocs.h".
458         (class Target_sparc): Change type of copy_relocs_ to variable,
459         update initializer.
460         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
461         Change all callers.
462         (Target_sparc::do_finalize_sections): Change handling of
463         copy_relocs_.
464         * x86_64.cc: Include "copy-relocs.h".
465         (class Target_x86_64): Change type of copy_relocs_ to variable,
466         update initializer.
467         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
468         class.  Change all callers.
469         (Target_x86_64::do_finalize_sections): Change handling of
470         copy_relocs_.
471         * Makefile.am (CCFILES): Add copy-relocs.cc.
472         (HFILES): Add copy-relocs.h.
473
474         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
475
476         * testsuite/script_test_4.sh: Permit leading zeroes.
477
478 2008-04-15  Ian Lance Taylor  <iant@google.com>
479
480         * script-sections.cc (Script_sections::create_segments): Use
481         header_size_adjustment even when there is enough room for the
482         headers.
483         * testsuite/script_test_4.sh: New file.
484         * testsuite/script_test_4.t: New file.
485         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
486         (check_DATA): Add script_test_4.stdout.
487         (MOSTLYCLEANFILES): Likewise.
488         (script_test_4): New target.
489         (script_test_4.stdout): New target.
490         * testsuite/Makefile.in: Rebuild.
491
492         * sparc.cc: Add definitions for Output_data_plt_sparc class
493         constants.
494
495 2008-04-14  David S. Miller  <davem@davemloft.net>
496
497         * sparc.cc: New file.
498         * Makefile.am (TARGETSOURCES): Add sparc.cc
499         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
500         * configure.tgt: Document targ_extra_size and
501         targ_extra_big_endian.  Add entries for sparc-* and
502         sparc64-*.
503         * configure.ac: Handle targ_extra_size and
504         targ_extra_big_endian.
505         * Makefile.in: Rebuild.
506         * configure: Likewise.
507         * po/POTFILES.in: Likewise.
508         * po/gold.pot: Likewise.
509
510 2008-04-14  Ian Lance Taylor  <iant@google.com>
511
512         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
513         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
514         in the name/type/flags to section mapping.  Don't call
515         allocate_output_section.
516         (Layout::choose_output_section): Change parameter from adjust_name
517         to is_input_section.  Don't permit input sections after sections
518         are attached to segments.  Don't call allocate_output_section.
519         (Layout::layout_eh_frame): Call update_flags_for_input_section,
520         not write_enable_output_section.
521         (Layout::make_output_section): Don't push to
522         unattached_section_list_ nor call attach_to_segment.  Call
523         attach_section_to_segment if sections are attached.
524         (Layout::attach_sections_to_segments): New function.
525         (Layout::attach_section_to_segment): New function.
526         (Layout::attach_allocated_section_to_segment): Rename from
527         attach_to_segment.  Remove flags parameter.
528         (Layout::allocate_output_section): Remove function.
529         (Layout::write_enable_output_section): Remove function.
530         * layout.h (class Layout): Update for above changes.  Add new
531         field sections_are_attached_.
532         * output.h (Output_section::update_flags_for_input_section): New
533         function.
534         * output.cc (Output_section::add_input_section): Call
535         update_flags_for_input_section.
536         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
537
538 2008-04-11  Cary Coutant  <ccoutant@google.com>
539
540         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
541         thought unnecessary.
542         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
543
544 2008-04-11  Ian Lance Taylor  <iant@google.com>
545
546         * output.h (class Output_section_data): Remove inline definition
547         of set_addralign.
548         * output.cc (Output_section_data::set_addralign): New function.
549
550 2008-04-11  Cary Coutant  <ccoutant@google.com>
551
552         Add support for TLS descriptors for i386 and x86_64.
553         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
554         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
555         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
556         GOT_TYPE_TLS_DESC.
557         (Target_i386::got_mod_index_entry): Remove unnecessary code.
558         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
559         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
560         relocations.
561         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
562         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
563         Fix problem with initial-exec relocations.
564         (Target_i386::Relocate::relocate_tls): Likewise.
565         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
566         relaxation.
567         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
568         support for section-plus-offset dynamic table entries.
569         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
570         (Output_data_dynamic::Dynamic_entry): Add support for
571         section-plus-offset dynamic table entries.
572         (Output_data_dynamic::Classification): Likewise.
573         (Output_data_dynamic::classification_): Renamed offset_.
574         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
575         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
576         (Target_x86_64::make_plt_section): New function.
577         (Target_x86_64::reserve_tlsdesc_entries): New function.
578         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
579         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
580         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
581         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
582         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
583         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
584         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
585         add extra PLT entry for TLS descriptors.
586         (Output_data_plt_x86_64::got_): New field.
587         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
588         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
589         fields.
590         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
591         descriptors.
592         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
593         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
594         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
595         R_386_TLS_DESC_CALL relocations.
596         (Target_x86_64::Scan::global): Likewise.
597         (Target_x86_64::do_finalize_sections): Add dynamic table entries
598         for TLS descriptors.
599         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
600         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
601         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
602         GD-to-IE relaxation.
603         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
604         and TLS_DESCRIPTORS.
605         * Makefile.in: Rebuild.
606         * configure: Rebuild.
607         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
608         (tls_test_shared2.so): New target.
609         (tls_shared_gd_to_ie_test_SOURCES): New variable.
610         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
611         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
612         (tls_shared_gd_to_ie_test_LDADD): New variable.
613         (tls_shared_gnu2_gd_to_ie_test): New target.
614         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
615         New targets.
616         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
617         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
618         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
619         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
620         (tls_shared_gnu2_test): New target.
621         (tls_test_gnu2_shared.so): New target.
622         (tls_shared_gnu2_test_SOURCES): New variable.
623         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
624         (tls_shared_gnu2_test_LDFLAGS): New variable.
625         (tls_shared_gnu2_test_LDADD): New variable.
626         * testsuite/Makefile.in: Rebuild.
627         * testsuite/Makefile.
628
629 2008-04-11  Ian Lance Taylor  <iant@google.com>
630
631         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
632         justsyms.t.
633         * testsuite/Makefile.in: Rebuild.
634
635         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
636         long.
637         * testsuite/script_test_2.cc (main): Adjust test.
638
639 2008-04-11  David S. Miller  <davem@davemloft.net>
640             Ian Lance Taylor  <iant@google.com>
641
642         * options.h (General_options): Add entries for '-Y' and
643         '-relax'.
644         * options.cc (General_options:finalize): If -Y was used, add those
645         entries to the library path instead of the default "/lib" and
646         "/usr/lib".
647
648 2008-04-11  David S. Miller  <davem@davemloft.net>
649
650         * testsuite/justsyms.t: Start at 0x100.
651         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
652         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
653         long.
654         * testsuite/script_test_2.cc: Adjust string and section length
655         checks.
656
657 2008-04-09  Ian Lance Taylor  <iant@google.com>
658
659         PR gold/5996
660         * script-sections.cc (Sections_element::allocate_to_segment): Add
661         orphan parameter.
662         (Output_section_definition::allocate_to_segment): Likewise.
663         (Orphan_output_section::allocate_to_segment): Likewise.
664         (Script_sections::attach_sections_using_phdrs_clause): Don't
665         propagate non-PT_LOAD segments to orphan sections.
666         * testsuite/Makefile.am (script_test_3.stdout): Generate using
667         readelf rather than objdump.
668         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
669         .interp section and PT_INTERP segment are the same size.
670         * testsuite/Makefile.in: Rebuild.
671
672         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
673         aliases for symbols defined in the same object.
674         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
675         (weak_alias_test_SOURCES): New variable.
676         (weak_alias_test_DEPENDENCIES): New variable.
677         (weak_alias_test_LDFLAGS): New variable.
678         (weak_alias_test_LDADD): New variable.
679         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
680         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
681         (weak_alias_test_3.o): New target.
682         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
683         * testsuite/weak_alias_test_main.cc: New file.
684         * testsuite/weak_alias_test_1.cc: New file.
685         * testsuite/weak_alias_test_2.cc: New file.
686         * testsuite/weak_alias_test_3.cc: New file.
687
688 2008-04-08  Ian Lance Taylor  <iant@google.com>
689
690         * options.h (class General_options): Add --noinhibit-exec option.
691         * main.cc (main): Check --noinhibit-exec.
692
693         * options.h (class General_options): Define --wrap as a special
694         option.  Add wrap_symbols_ field.
695         (General_options::any_wrap_symbols): New function.
696         (General_options::is_wrap_symbol): New function.
697         * options.cc (General_options::parse_wrap): New function.
698         (General_options::General_options): Initialize wrap_symbols_.
699         * symtab.cc (Symbol_table::wrap_symbol): New function.
700         (Symbol_table::add_from_object): Handle --wrap.
701         * symtab.h (class Symbol_table): Declare wrap_symbol.
702         * target.h (Target::wrap_char): New function.
703         (Target::Target_info): Add wrap_char field.
704         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
705         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
706         * testsuite/testfile.cc (Target_test::test_target_info):
707         Likewise.
708
709         * errors.cc (Errors::undefined_symbol): Mention symbol version if
710         there is one.
711
712         * layout.h (class Layout): Add added_eh_frame_data_ field.
713         * layout.cc (Layout::Layout): Initialize new field.
714         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
715         output section until we find a section we merged successfully.
716         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
717         that the size be non-zero.
718
719         * merge.cc (Object_merge_map::get_output_offset): Remove inline
720         qualifier.
721
722 2008-04-08  Craig Silverstein  <csilvers@google.com>
723
724         * configure.ac: Export new conditional variable HAVE_ZLIB.
725         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
726         on HAVE_ZLIB.
727         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
728         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
729
730 2008-04-07  Ian Lance Taylor  <iant@google.com>
731
732         * version.cc (version_string): Set to "1.5".
733
734         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
735         Add issued_non_pic_error_ field.  Declare check_non_pic.
736         (Target_x86_64::Scan::check_non_pic): New function.
737         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
738         (Target_x86_64::Scan::global): Likewise.
739
740         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
741         addend parameter.  Change caller.  Handle merge sections.
742         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
743         Address to Addend.  Don't add in the result of
744         local_section_offset, pass down the addend and use the returned
745         value.
746         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
747         Update declarations of local_section_offset and symbol_value.
748         * testsuite/two_file_test_1.cc (t18): New function.
749         * testsuite/two_file_test_2.cc (f18): New function.
750         * testsuite/two_file_test_main.cc (main): Call t18.
751         * testsuite/two_file_test.h (t18, f18): Declare.
752
753         * configure.ac: Don't test for objdump, c++filt, or readelf.
754         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
755         conditionals.
756         (TEST_READELF): New variable.
757         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
758         (check_PROGRAMS): Add two_file_strip_test.
759         (two_file_strip_test): New target.
760         (check_PROGRAMS): Add two_file_same_shared_strip_test.
761         (two_file_same_shared_strip_test_SOURCES): New variable.
762         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
763         (two_file_same_shared_strip_test_LDFLAGS): New variable.
764         (two_file_same_shared_strip_test_LDADD): New variable.
765         (two_file_shared_strip.so): New target.
766         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
767         (ver_test_5.syms, ver_test_7.syms): Likewise.
768         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
769         (strip_test_3.stdout): Use TEST_OBJDUMP.
770         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
771
772 2008-04-04  Cary Coutant  <ccoutant@google.com>
773
774         * symtab.h (Symbol::is_weak_undefined): New function.
775         (Symbol::is_strong_undefined): New function.
776         (Symbol::is_absolute): New function.
777         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
778         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
779         absolute symbols.
780         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
781         (weak_undef_test): New target.
782         * testsuite/Makefile.in: Rebuild.
783         * testsuite/weak_undef_file1.cc: New file.
784         * testsuite/weak_undef_file2.cc: New file.
785         * testsuite/weak_undef_test.cc: New file.
786
787 2008-04-03  Craig Silverstein  <csilvers@google.com>
788
789         * compressed_output.h (class Output_compressed_section): Use
790         unsigned buffer.
791         * compressed_output.cc (zlib_compress): Use unsigned buffers,
792         add zlib header.
793         (zlib_compressed_suffix): Removed.
794         (Output_compressed_section::set_final_data_size): Use unsigned
795         buffers.
796         * testsuite/Makefile.am (flagstest_compress_debug_sections):
797         Fix linker invocation.
798         (flagstest_o_specialfile_and_compress_debug_sections):
799         Likewise.
800         * testsuite/Makefile.in: Regenerated.
801
802 2008-04-02  David S. Miller  <davem@davemloft.net>
803
804         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
805         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
806
807 2008-04-02  Craig Silverstein  <csilvers@google.com>
808
809         * TODO: New file.
810
811 2008-04-02  Ian Lance Taylor  <iant@google.com>
812
813         * fileread.cc (File_read::find_view): Add byteshift and vshifted
814         parameters.  Update for new key type to views_.  Change all
815         callers.
816         (File_read::read): Adjust for byteshift in returned view.
817         (File_read::add_view): New function, broken out of
818         find_and_make_view.
819         (File_read::make_view): New function, broken out of
820         find_and_make_view.
821         (File_read::find_or_make_view): Add offset and aligned
822         parameters.  Rewrite accordingly.  Change all callers.
823         (File_read::get_view): Add offset and aligned parameters.  Adjust
824         for byteshift in return value.
825         (File_read::get_lasting_view): Likewise.
826         * fileread.h (class File_read): Update declarations.
827         (class File_read::View): Add byteshift_ field.  Add byteshift to
828         constructor.  Add byteshift method.
829         * archive.h (Archive::clear_uncached_views): New function.
830         (Archive::get_view): Add aligned parameter.  Change all callers.
831         * object.h (Object::get_view): Add aligned parameter.  Change all
832         callers.
833         (Object::get_lasting_view): Likewise.
834
835         * fileread.cc (File_read::release): Don't call clear_views if
836         there are multiple objects.
837         * fileread.h (File_read::clear_uncached_views): New function.
838         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
839         on the archive.
840
841 2008-03-31  Cary Coutant  <ccoutant@google.com>
842
843         Add thin archive support.
844         * archive.cc (Archive::armagt): New const.
845         (Archive::setup): Remove task parameter and calls to unlock.
846         (Archive::unlock_nested_archives): New function.
847         (Archive::read_header): Add nested_off parameter. Change
848         all callers.
849         (Archive::interpret_header): Likewise.
850         (Archive::include_all_members): Change to handle thin
851         archives.
852         (Archive::include_member): Likewise.
853         * archive.h (Archive::Archive): Add new parameters and
854         initializers.
855         (Archive::armagt): New const.
856         (Archive::setup): Remove task parameter.
857         (Archive::unlock_nested_archives): New function.
858         (Archive::read_header): Add nested_off parameter.
859         (Archive::interpret_header): Likewise.
860         (Archive::Nested_archive_table): New typedef.
861         (Archive::is_thin_archive_): New field.
862         (Archive::nested_archives_): New field.
863         (Archive::options_): New field.
864         (Archive::dirpath_): New field.
865         (Archive::task_): New field.
866         * readsyms.cc (Read_symbols::do_read_symbols): Add check
867         for thin archives.  Pass additional parameters to
868         Archive::Archive.  Unlock the archive file after calling
869         Archive::setup.
870         
871 2008-03-29  Ian Lance Taylor  <iant@google.com>
872
873         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
874         version symbol to be local.
875         * testsuite/ver_test_4.sh: New file.
876         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
877         (check_DATA): Add ver_test_4.syms.
878         (ver_test_4.syms): New target.
879         * testsuite/Makefile.in: Rebuild.
880
881         * output.cc
882         (Output_section::Input_section_sort_entry::has_priority): New
883         function.
884         (Output_section::Input_section_sort_entry::match_file_name): New
885         function.
886         (Output_section::Input_section_sort_entry::match_section_name):
887         Remove.
888         (Output_section::Input_section_sort_entry::match_section_name_prefix):
889         Remove.
890         (Output_section::Input_section_sort_entry::match_section_file):
891         Remove.
892         (Output_section::Input_section_sort_compare::operator()): Rewrite
893         using new Input_section_sort_entry functions.  Sort crtbegin and
894         crtend first.  Sort sections with no priority before sections with
895         a priority.
896         * testsuite/initpri1.c (d3): Check j != 4.
897         (cd5): New constructor/destructor function.
898         (main): Check j != 2.
899
900         * symtab.cc (Symbol_table::add_from_object): If we don't use the
901         new symbol when resolving, don't call set_is_default.
902         * testsuite/ver_test_7.cc: New file.
903         * testsuite/ver_test_7.sh: New file.
904         * testsuite/Makefile.am (ver_test_7.so): New target.
905         (ver_test_7.o): New target.
906         (check_SCRIPTS): Add ver_test_7.sh.
907         (check_DATA): Add ver_test_7.syms.
908         (ver_test_7.syms): New target.
909
910 2008-03-28  Ian Lance Taylor  <iant@google.com>
911
912         * layout.cc (Layout::layout): If we see an input section with a
913         name that needs sorting, set the must_sort flag for the output
914         section.
915         (Layout::make_output_section): If the name of the output section
916         indicates that it might require sorting, set the may_sort flag.
917         * output.h (Output_section::may_sort_attached_input_sections): New
918         function.
919         (Output_section::set_may_sort_attached_input_sections): New
920         function.
921         (Output_section::must_sort_attached_input_sections): New
922         function.
923         (Output_section::set_must_sort_attached_input_sections): New
924         function.
925         (class Output_section): Declare Input_section_sort_entry.  Define
926         Input_section_sort_compare.  Declare
927         sort_attached_input_sections.  Add new fields:
928         may_sort_attached_input_sections_,
929         must_sort_attached_input_sections_,
930         attached_input_sections_are_sorted_.
931         * output.cc (Output_section::Output_section): Initialize new
932         fields.
933         (Output_section::add_input_section): Add an entry to
934         input_sections_ if may_sort or must_sort are true.
935         (Output_section::set_final_data_size): Call
936         sort_attached_input_sections if necessary.
937         (Output_section::Input_section_sort_entry): Define new class.
938         (Output_section::Input_section_sort_compare::operator()): New
939         function.
940         (Output_section::sort_attached_input_sections): New function.
941         * configure.ac: Check whether the compiler supports constructor
942         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
943         * testsuite/initpri1.c: New file.
944         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
945         CONSTRUCTOR_PRIORITY.
946         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
947         (initpri1_LDFLAGS): New variable.
948         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
949
950 2008-03-27  Ian Lance Taylor  <iant@google.com>
951
952         * common.cc (Sort_commons::operator): Correct sorting algorithm.
953         * testsuite/common_test_1.c: New file.
954         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
955         (common_test_1_SOURCES): New variable.
956         (common_test_1_DEPENDENCIES): New variable.
957         (common_test_1_LDFLAGS): New variable.
958
959         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
960         and commons_ correctly when NAME/VERSION does not override
961         NAME/NULL.
962         * testsuite/ver_test_6.c: New file.
963         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
964         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
965         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
966
967 2008-03-26  Ian Lance Taylor  <iant@google.com>
968
969         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
970         of an undefined symbol from a version script.
971         * testsuite/Makefile.am (ver_test_5.so): New target.
972         (ver_test_5.o): New target.
973         (check_SCRIPTS): Add ver_test_5.sh.
974         (check_DATA): Add ver_test_5.syms.
975         (ver_test_5.syms): New target.
976         * testsuite/ver_test_5.cc: New file.
977         * testsuite/ver_test_5.script: New file.
978         * testsuite/ver_test_5.sh: New file.
979         * Makefile.in, testsuite/Makefile.in: Rebuild.
980
981         PR gold/5986
982         Fix problems building gold with gcc 4.3.0.
983         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
984         (gold_error_at_location, gold_warning_at_location): Use it.
985         * configure.ac: Check whether we can compile and use a template
986         function with a printf attribute.
987         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
988         when jumping over bytes.
989         * object.cc: Instantiate Object::read_section_data.
990         * debug.h: Include <cstring>
991         * dwarf_reader.cc: Include <algorithm>
992         * main.cc: Include <cstring>.
993         * options.cc: Include <cstring>.
994         * output.cc: Include <cstring>.
995         * script.cc: Include <cstring>.
996         * script.h: Include <string>.
997         * symtab.cc: Include <cstring> and <algorithm>.
998         * target-select.cc: Include <cstring>.
999         * version.cc: Include <string>.
1000         * testsuite/testmain.cc: Include <cstdlib>.
1001         * configure, config.in: Rebuild.
1002
1003 2008-03-25  Ian Lance Taylor  <iant@google.com>
1004
1005         * options.cc: Include "../bfd/bfdver.h".
1006         (options::help): Print bug reporting address.
1007
1008         * version.cc (print_version): Adjust output for current value of
1009         BFD_VERSION_STRING.
1010
1011         * NEWS: New file.
1012
1013         * options.cc (options::help): Print list of supported targets.
1014         * target-select.h: Include <vector>.
1015         (class Target_selector): Make machine_, size_, and is_big_endian_
1016         fields const.  Add bfd_name_ and instantiated_target_ fields.
1017         (Target_selector::Target_selector): Add bfd_name parameter.
1018         (Target_selector::recognize): Make non-virtual, call
1019         do_recognize.
1020         (Target_selector::recognize_by_name): Make non-virtual, call
1021         do_recognize_by_name.
1022         (Target_selector::supported_names): New function.
1023         (Target_selector::bfd_name): New function.
1024         (Target_selector::do_instantiate_target): New pure virtual
1025         function.
1026         (Target_selector::do_recognize): New virtual function.
1027         (Target_selector::do_recognize_by_name): New virtual function.
1028         (Target_selector::instantiate_target): New private function.
1029         (supported_target_names): Declare.
1030         * target-select.cc (Target_selector::Target_selector): Update for
1031         new parameter and fields.
1032         (select_target_by_name): Check that the name matches before
1033         calling recognize_by_name.
1034         (supported_target_names): New function.
1035         * i386.cc (class Target_selector_i386): Update Target_selector
1036         constructor call.  Remove recognize and recognize_by_name.  Add
1037         do_instantiate_target.
1038         * x86_64.cc (class Target_selector_x86_64): Likewise.
1039         * testsuite/testfile.cc (class Target_selector_test): Update for
1040         changes to Target_selector.
1041
1042         * README: Rewrite, with some notes on unsupported features.
1043
1044 2008-03-24  Cary Coutant  <ccoutant@google.com>
1045
1046         * i386.cc (Target_i386::Got_type): New enum declaration.
1047         (Target_i386::Scan::local): Updated callers of Output_data_got
1048         member functions.
1049         (Target_i386::Scan::global): Likewise.
1050         (Target_i386::Relocate::relocate): Likewise.
1051         (Target_i386::Relocate::relocate_tls): Likewise.
1052         * object.h (Got_offset_list): New class.
1053         (Sized_relobj::local_has_got_offset): Added got_type parameter.
1054         (Sized_relobj::local_got_offset): Likewise.
1055         (Sized_relobj::set_local_got_offset): Likewise.
1056         (Sized_relobj::local_has_tls_got_offset): Removed.
1057         (Sized_relobj::local_tls_got_offset): Removed.
1058         (Sized_relobj::set_local_tls_got_offset): Removed.
1059         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
1060         * output.cc (Output_data_got::add_global): Added got_type parameter.
1061         (Output_data_got::add_global_with_rel): Likewise.
1062         (Output_data_got::add_global_with_rela): Likewise.
1063         (Output_data_got::add_global_pair_with_rel): New function.
1064         (Output_data_got::add_global_pair_with_rela): New function.
1065         (Output_data_got::add_local): Added got_type parameter.
1066         (Output_data_got::add_local_with_rel): Likewise.
1067         (Output_data_got::add_local_with_rela): Likewise.
1068         (Output_data_got::add_local_pair_with_rel): New function.
1069         (Output_data_got::add_local_pair_with_rela): New function.
1070         (Output_data_got::add_global_tls): Removed.
1071         (Output_data_got::add_global_tls_with_rel): Removed.
1072         (Output_data_got::add_global_tls_with_rela): Removed.
1073         (Output_data_got::add_local_tls): Removed.
1074         (Output_data_got::add_local_tls_with_rel): Removed.
1075         (Output_data_got::add_local_tls_with_rela): Removed.
1076         * output.h (Output_data_got::add_global): Added got_type parameter.
1077         (Output_data_got::add_global_with_rel): Likewise.
1078         (Output_data_got::add_global_with_rela): Likewise.
1079         (Output_data_got::add_global_pair_with_rel): New function.
1080         (Output_data_got::add_global_pair_with_rela): New function.
1081         (Output_data_got::add_local): Added got_type parameter.
1082         (Output_data_got::add_local_with_rel): Likewise.
1083         (Output_data_got::add_local_with_rela): Likewise.
1084         (Output_data_got::add_local_pair_with_rel): New function.
1085         (Output_data_got::add_local_pair_with_rela): New function.
1086         (Output_data_got::add_global_tls): Removed.
1087         (Output_data_got::add_global_tls_with_rel): Removed.
1088         (Output_data_got::add_global_tls_with_rela): Removed.
1089         (Output_data_got::add_local_tls): Removed.
1090         (Output_data_got::add_local_tls_with_rel): Removed.
1091         (Output_data_got::add_local_tls_with_rela): Removed.
1092         * resolve.cc (Symbol::override_base_with_special): Removed
1093         reference to has_got_offset_ field.
1094         * symtab.cc (Symbol::init_fields): Replaced initialization
1095         of got_offset_ with got_offsets_.  Removed initialization
1096         of has_got_offset_
1097         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
1098         (Symbol::got_offset): Likewise.
1099         (Symbol::set_got_offset): Likewise.
1100         (Symbol::has_tls_got_offset): Removed.
1101         (Symbol::tls_got_offset): Removed.
1102         (Symbol::set_tls_got_offset): Removed.
1103         (Symbol::got_offset_): Removed.
1104         (Symbol::tls_mod_got_offset_): Removed.
1105         (Symbol::tls_pair_got_offset_): Removed.
1106         (Symbol::got_offsets_): New field.
1107         (Symbol::has_got_offset): Removed.
1108         (Symbol::has_tls_mod_got_offset): Removed.
1109         (Symbol::has_tls_pair_got_offset): Removed.
1110         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
1111         (Target_x86_64::Scan::local): Updated callers of Output_data_got
1112         member functions.
1113         (Target_x86_64::Scan::global): Likewise.
1114         (Target_x86_64::Relocate::relocate): Likewise.
1115         (Target_x86_64::Relocate::relocate_tls): Likewise.
1116
1117 2008-03-25  Ben Elliston  <bje@au.ibm.com>
1118
1119         * yyscript.y: Fix spelling error in comment.
1120
1121 2008-03-24  Ian Lance Taylor  <iant@google.com>
1122
1123         * options.h (class General_options): Define build_id option.
1124         * layout.h (class Layout): Declare write_build_id, create_note,
1125         create_build_id.  Add build_id_note_ member.
1126         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
1127         "libiberty.h", "md5.h", "sha1.h".
1128         (Layout::Layout): Initialize eh_frame_data_,
1129         eh_frame_hdr_section_, and build_id_note_.
1130         (Layout::finalize): Call create_build_id.
1131         (Layout::create_note): New function, broken out of
1132         Layout::create_gold_note.
1133         (Layout::create_gold_note): Call create_note.
1134         (Layout::create_build_id): New function.
1135         (Layout::write_build_id): New function.
1136         (Close_task_runner::run): Call write_build_id.
1137
1138         * x86_64.cc: Correct license to GPLv3.
1139
1140 2008-03-23  Ian Lance Taylor  <iant@google.com>
1141
1142         * options.cc: Include "demangle.h".
1143         (parse_optional_string): New function.
1144         (parse_long_option): Handle takes_optional_argument.
1145         (parse_short_option): Update dash_z initializer.  Handle
1146         takes_optional_argument.
1147         (General_options::General_options): Initialize do_demangle_.
1148         (General_options::finalize): Set do_demangle_.  Handle demangling
1149         style.
1150         * options.h (parse_optional_string): Declare.
1151         (struct One_option): Add optional_arg field.  Update constructor.
1152         Update call constructor calls.  Add takes_optional_argument
1153         function.
1154         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
1155         (DEFINE_optional_string): Define.
1156         (General_options::demangle): Change from DEFINE_bool to
1157         DEFINE_optional_string.
1158         (General_options::no_demangle): New function.
1159         (General_options::do_demangle): New function.
1160         (General_options::set_do_demangle): New function.
1161         (General_options::execstack_status_): Move definition to end of
1162         class definition.
1163         (General_options::static_): Likewise.
1164         (General_options::do_demangle_): New field.
1165         * object.cc (big_endian>::get_symbol_location_info): Call
1166         Options::do_demangle, not Options::demangle.
1167         * symtab.cc (demangle): Likewise.
1168
1169 2008-03-22  Ian Lance Taylor  <iant@google.com>
1170
1171         * gold.h: Include <cstddef> and <sys/types.h>
1172         * options.h: Include <cstring>.
1173
1174 2008-03-21  Ian Lance Taylor  <iant@google.com>
1175
1176         * Added source code to GNU binutils.
1177