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