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