* options.cc (General_options::parse_V): New function.
[external/binutils.git] / gold / ChangeLog
1 2008-04-17  David S. Miller  <davem@davemloft.net>
2
3         * options.cc (General_options::parse_V): New function.
4         * options.h: Add entries for -V and -Qy.
5
6 2008-04-17  Ian Lance Taylor  <iant@google.com>
7
8         * common.cc (Symbol_table::allocate_commons): Remove options
9         parameter.  Change caller.
10         (Symbol_table::do_allocate_commons): Remove options parameter.
11         Change caller.  Just call do_allocate_commons_list twice.
12         (Symbol_table::do_allocate_commons_list): New function, broken out
13         of do_allocate_commons.
14         * common.h (class Allocate_commons_task): Remove options_ field.
15         Update constructor.
16         * symtab.cc (Symbol_table::Symbol_table): Initialize
17         tls_commons_.
18         (Symbol_table::add_from_object): Put TLS common symbols on
19         tls_commons_ list.
20         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
21         which are IN_OUTPUT_DATA.
22         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
23         allocate_commons and do_allocate_commons declarations.  Declare
24         do_allocate_commons_list.
25         * gold.cc (queue_middle_tasks): Update creation of
26         Allocate_commons_task to not pass options.
27         * testsuite/Makefile.am (INCLUDES): Add -I.. .
28         (TLS_TEST_C_FLAGS): New variable.
29         (tls_test_c_pic.o): New target.
30         (tls_test_shared.so): Link in tls_test_c_pic.o.
31         (tls_test_c_pic_ie.o): New target.
32         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
33         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
34         (tls_test_c.o): New target.
35         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
36         (tls_pic_test_LDADD): Likewise.
37         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
38         (tls_shared_gd_to_ie_test_LDADD): Likewise.
39         (tls_test_c_gnu2.o): New target.
40         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
41         tls_test_c_gnu2.o.
42         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
43         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
44         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
45         * testsuite/tls_test.cc: Include "config.h".
46         (t_last): Call t11_last.
47         * testsuite/tls_test.h (t11, t11_last): Declare.
48         * testsuite/tls_test_c.c: New file.
49         * testsuite/tls_test_main.cc (thread_routine): Call t11.
50         * configure.ac: Check for OpenMP support.
51         * configure, config.in, Makefile.in: Rebuild.
52         * testsuite/Makefile.in: Rebuild.
53
54 2008-04-16  Cary Coutant  <ccoutant@google.com>
55
56         * i386.cc (Target_i386::define_tls_base_symbol): New function.
57         (Target_i386::tls_base_symbol_defined_): New field.
58         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
59         (Target_i386::Scan::global): Likewise.
60         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
61         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
62         (Target_x86_64::tls_base_symbol_defined_): New field.
63         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
64         (Target_x86_64::Scan::global): Likewise.
65
66 2008-04-16  Cary Coutant  <ccoutant@google.com>
67
68         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
69         (Symbol::needs_plt_entry): Allow weak undefined symbols.
70         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
71         building shared libraries.
72         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
73         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
74         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
75         * testsuite/Makefile.in: Rebuild.
76         * testsuite/weak_undef.h: New file.
77         * testsuite/weak_undef_file1.cc: Add extra test cases.
78         * testsuite/weak_undef_file2.cc: Likewise.
79         * testsuite/weak_undef_test.cc: Likewise.
80
81 2008-04-16  David S. Miller  <davem@davemloft.net>
82
83         * sparc.cc (Target_sparc::Scan): Change from struct to class.
84         Add issued_non_pic_error_ field.  Declare check_non_pic.
85         (Target_sparc::Scan::check_non_pic): New function.
86         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
87         (Target_sparc::Scan::global): Likewise.
88
89         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
90         * configure: Rebuild.
91
92         * options.h (DEFINE_enable): New macro.
93         (new_dtags): New enable option.
94         (initfirst, interpose, loadfltr, nodefaultlib,
95         nodelete, nodlopen, nodump): New -z options.
96         * layout.cc (Layout:finish_dynamic_section): If new
97         dtags enabled, emit DT_RUNPATH.  Also, emit a
98         DT_FLAGS_1 containing any specified -z flags.
99
100 2008-04-16  Ian Lance Taylor  <iant@google.com>
101
102         * copy-relocs.cc: New file.
103         * copy-relocs.h: New file.
104         * reloc.cc: Remove Copy_relocs code.
105         * reloc.h: Likewise.
106         * reloc-types.h (struct Reloc_types) [both versions]: Add
107         get_reloc_addend_noerror.
108         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
109         variants of add_global which take an addend which must be zero.
110         * i386.cc: Include "copy-relocs.h".
111         (class Target_i386): Change type of copy_relocs_ to variable,
112         update initializer.
113         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
114         Change all callers.
115         (Target_i386::do_finalize_sections): Change handling of
116         copy_relocs_.
117         * sparc.cc: Include "copy-relocs.h".
118         (class Target_sparc): Change type of copy_relocs_ to variable,
119         update initializer.
120         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
121         Change all callers.
122         (Target_sparc::do_finalize_sections): Change handling of
123         copy_relocs_.
124         * x86_64.cc: Include "copy-relocs.h".
125         (class Target_x86_64): Change type of copy_relocs_ to variable,
126         update initializer.
127         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
128         class.  Change all callers.
129         (Target_x86_64::do_finalize_sections): Change handling of
130         copy_relocs_.
131         * Makefile.am (CCFILES): Add copy-relocs.cc.
132         (HFILES): Add copy-relocs.h.
133
134         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
135
136         * testsuite/script_test_4.sh: Permit leading zeroes.
137
138 2008-04-15  Ian Lance Taylor  <iant@google.com>
139
140         * script-sections.cc (Script_sections::create_segments): Use
141         header_size_adjustment even when there is enough room for the
142         headers.
143         * testsuite/script_test_4.sh: New file.
144         * testsuite/script_test_4.t: New file.
145         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
146         (check_DATA): Add script_test_4.stdout.
147         (MOSTLYCLEANFILES): Likewise.
148         (script_test_4): New target.
149         (script_test_4.stdout): New target.
150         * testsuite/Makefile.in: Rebuild.
151
152         * sparc.cc: Add definitions for Output_data_plt_sparc class
153         constants.
154
155 2008-04-14  David S. Miller  <davem@davemloft.net>
156
157         * sparc.cc: New file.
158         * Makefile.am (TARGETSOURCES): Add sparc.cc
159         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
160         * configure.tgt: Document targ_extra_size and
161         targ_extra_big_endian.  Add entries for sparc-* and
162         sparc64-*.
163         * configure.ac: Handle targ_extra_size and
164         targ_extra_big_endian.
165         * Makefile.in: Rebuild.
166         * configure: Likewise.
167         * po/POTFILES.in: Likewise.
168         * po/gold.pot: Likewise.
169
170 2008-04-14  Ian Lance Taylor  <iant@google.com>
171
172         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
173         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
174         in the name/type/flags to section mapping.  Don't call
175         allocate_output_section.
176         (Layout::choose_output_section): Change parameter from adjust_name
177         to is_input_section.  Don't permit input sections after sections
178         are attached to segments.  Don't call allocate_output_section.
179         (Layout::layout_eh_frame): Call update_flags_for_input_section,
180         not write_enable_output_section.
181         (Layout::make_output_section): Don't push to
182         unattached_section_list_ nor call attach_to_segment.  Call
183         attach_section_to_segment if sections are attached.
184         (Layout::attach_sections_to_segments): New function.
185         (Layout::attach_section_to_segment): New function.
186         (Layout::attach_allocated_section_to_segment): Rename from
187         attach_to_segment.  Remove flags parameter.
188         (Layout::allocate_output_section): Remove function.
189         (Layout::write_enable_output_section): Remove function.
190         * layout.h (class Layout): Update for above changes.  Add new
191         field sections_are_attached_.
192         * output.h (Output_section::update_flags_for_input_section): New
193         function.
194         * output.cc (Output_section::add_input_section): Call
195         update_flags_for_input_section.
196         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
197
198 2008-04-11  Cary Coutant  <ccoutant@google.com>
199
200         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
201         thought unnecessary.
202         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
203
204 2008-04-11  Ian Lance Taylor  <iant@google.com>
205
206         * output.h (class Output_section_data): Remove inline definition
207         of set_addralign.
208         * output.cc (Output_section_data::set_addralign): New function.
209
210 2008-04-11  Cary Coutant  <ccoutant@google.com>
211
212         Add support for TLS descriptors for i386 and x86_64.
213         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
214         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
215         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
216         GOT_TYPE_TLS_DESC.
217         (Target_i386::got_mod_index_entry): Remove unnecessary code.
218         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
219         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
220         relocations.
221         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
222         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
223         Fix problem with initial-exec relocations.
224         (Target_i386::Relocate::relocate_tls): Likewise.
225         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
226         relaxation.
227         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
228         support for section-plus-offset dynamic table entries.
229         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
230         (Output_data_dynamic::Dynamic_entry): Add support for
231         section-plus-offset dynamic table entries.
232         (Output_data_dynamic::Classification): Likewise.
233         (Output_data_dynamic::classification_): Renamed offset_.
234         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
235         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
236         (Target_x86_64::make_plt_section): New function.
237         (Target_x86_64::reserve_tlsdesc_entries): New function.
238         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
239         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
240         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
241         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
242         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
243         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
244         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
245         add extra PLT entry for TLS descriptors.
246         (Output_data_plt_x86_64::got_): New field.
247         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
248         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
249         fields.
250         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
251         descriptors.
252         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
253         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
254         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
255         R_386_TLS_DESC_CALL relocations.
256         (Target_x86_64::Scan::global): Likewise.
257         (Target_x86_64::do_finalize_sections): Add dynamic table entries
258         for TLS descriptors.
259         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
260         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
261         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
262         GD-to-IE relaxation.
263         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
264         and TLS_DESCRIPTORS.
265         * Makefile.in: Rebuild.
266         * configure: Rebuild.
267         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
268         (tls_test_shared2.so): New target.
269         (tls_shared_gd_to_ie_test_SOURCES): New variable.
270         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
271         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
272         (tls_shared_gd_to_ie_test_LDADD): New variable.
273         (tls_shared_gnu2_gd_to_ie_test): New target.
274         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
275         New targets.
276         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
277         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
278         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
279         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
280         (tls_shared_gnu2_test): New target.
281         (tls_test_gnu2_shared.so): New target.
282         (tls_shared_gnu2_test_SOURCES): New variable.
283         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
284         (tls_shared_gnu2_test_LDFLAGS): New variable.
285         (tls_shared_gnu2_test_LDADD): New variable.
286         * testsuite/Makefile.in: Rebuild.
287         * testsuite/Makefile.
288
289 2008-04-11  Ian Lance Taylor  <iant@google.com>
290
291         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
292         justsyms.t.
293         * testsuite/Makefile.in: Rebuild.
294
295         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
296         long.
297         * testsuite/script_test_2.cc (main): Adjust test.
298
299 2008-04-11  David S. Miller  <davem@davemloft.net>
300             Ian Lance Taylor  <iant@google.com>
301
302         * options.h (General_options): Add entries for '-Y' and
303         '-relax'.
304         * options.cc (General_options:finalize): If -Y was used, add those
305         entries to the library path instead of the default "/lib" and
306         "/usr/lib".
307
308 2008-04-11  David S. Miller  <davem@davemloft.net>
309
310         * testsuite/justsyms.t: Start at 0x100.
311         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
312         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
313         long.
314         * testsuite/script_test_2.cc: Adjust string and section length
315         checks.
316
317 2008-04-09  Ian Lance Taylor  <iant@google.com>
318
319         PR gold/5996
320         * script-sections.cc (Sections_element::allocate_to_segment): Add
321         orphan parameter.
322         (Output_section_definition::allocate_to_segment): Likewise.
323         (Orphan_output_section::allocate_to_segment): Likewise.
324         (Script_sections::attach_sections_using_phdrs_clause): Don't
325         propagate non-PT_LOAD segments to orphan sections.
326         * testsuite/Makefile.am (script_test_3.stdout): Generate using
327         readelf rather than objdump.
328         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
329         .interp section and PT_INTERP segment are the same size.
330         * testsuite/Makefile.in: Rebuild.
331
332         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
333         aliases for symbols defined in the same object.
334         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
335         (weak_alias_test_SOURCES): New variable.
336         (weak_alias_test_DEPENDENCIES): New variable.
337         (weak_alias_test_LDFLAGS): New variable.
338         (weak_alias_test_LDADD): New variable.
339         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
340         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
341         (weak_alias_test_3.o): New target.
342         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
343         * testsuite/weak_alias_test_main.cc: New file.
344         * testsuite/weak_alias_test_1.cc: New file.
345         * testsuite/weak_alias_test_2.cc: New file.
346         * testsuite/weak_alias_test_3.cc: New file.
347
348 2008-04-08  Ian Lance Taylor  <iant@google.com>
349
350         * options.h (class General_options): Add --noinhibit-exec option.
351         * main.cc (main): Check --noinhibit-exec.
352
353         * options.h (class General_options): Define --wrap as a special
354         option.  Add wrap_symbols_ field.
355         (General_options::any_wrap_symbols): New function.
356         (General_options::is_wrap_symbol): New function.
357         * options.cc (General_options::parse_wrap): New function.
358         (General_options::General_options): Initialize wrap_symbols_.
359         * symtab.cc (Symbol_table::wrap_symbol): New function.
360         (Symbol_table::add_from_object): Handle --wrap.
361         * symtab.h (class Symbol_table): Declare wrap_symbol.
362         * target.h (Target::wrap_char): New function.
363         (Target::Target_info): Add wrap_char field.
364         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
365         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
366         * testsuite/testfile.cc (Target_test::test_target_info):
367         Likewise.
368
369         * errors.cc (Errors::undefined_symbol): Mention symbol version if
370         there is one.
371
372         * layout.h (class Layout): Add added_eh_frame_data_ field.
373         * layout.cc (Layout::Layout): Initialize new field.
374         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
375         output section until we find a section we merged successfully.
376         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
377         that the size be non-zero.
378
379         * merge.cc (Object_merge_map::get_output_offset): Remove inline
380         qualifier.
381
382 2008-04-08  Craig Silverstein  <csilvers@google.com>
383
384         * configure.ac: Export new conditional variable HAVE_ZLIB.
385         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
386         on HAVE_ZLIB.
387         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
388         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
389
390 2008-04-07  Ian Lance Taylor  <iant@google.com>
391
392         * version.cc (version_string): Set to "1.5".
393
394         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
395         Add issued_non_pic_error_ field.  Declare check_non_pic.
396         (Target_x86_64::Scan::check_non_pic): New function.
397         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
398         (Target_x86_64::Scan::global): Likewise.
399
400         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
401         addend parameter.  Change caller.  Handle merge sections.
402         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
403         Address to Addend.  Don't add in the result of
404         local_section_offset, pass down the addend and use the returned
405         value.
406         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
407         Update declarations of local_section_offset and symbol_value.
408         * testsuite/two_file_test_1.cc (t18): New function.
409         * testsuite/two_file_test_2.cc (f18): New function.
410         * testsuite/two_file_test_main.cc (main): Call t18.
411         * testsuite/two_file_test.h (t18, f18): Declare.
412
413         * configure.ac: Don't test for objdump, c++filt, or readelf.
414         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
415         conditionals.
416         (TEST_READELF): New variable.
417         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
418         (check_PROGRAMS): Add two_file_strip_test.
419         (two_file_strip_test): New target.
420         (check_PROGRAMS): Add two_file_same_shared_strip_test.
421         (two_file_same_shared_strip_test_SOURCES): New variable.
422         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
423         (two_file_same_shared_strip_test_LDFLAGS): New variable.
424         (two_file_same_shared_strip_test_LDADD): New variable.
425         (two_file_shared_strip.so): New target.
426         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
427         (ver_test_5.syms, ver_test_7.syms): Likewise.
428         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
429         (strip_test_3.stdout): Use TEST_OBJDUMP.
430         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
431
432 2008-04-04  Cary Coutant  <ccoutant@google.com>
433
434         * symtab.h (Symbol::is_weak_undefined): New function.
435         (Symbol::is_strong_undefined): New function.
436         (Symbol::is_absolute): New function.
437         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
438         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
439         absolute symbols.
440         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
441         (weak_undef_test): New target.
442         * testsuite/Makefile.in: Rebuild.
443         * testsuite/weak_undef_file1.cc: New file.
444         * testsuite/weak_undef_file2.cc: New file.
445         * testsuite/weak_undef_test.cc: New file.
446
447 2008-04-03  Craig Silverstein  <csilvers@google.com>
448
449         * compressed_output.h (class Output_compressed_section): Use
450         unsigned buffer.
451         * compressed_output.cc (zlib_compress): Use unsigned buffers,
452         add zlib header.
453         (zlib_compressed_suffix): Removed.
454         (Output_compressed_section::set_final_data_size): Use unsigned
455         buffers.
456         * testsuite/Makefile.am (flagstest_compress_debug_sections):
457         Fix linker invocation.
458         (flagstest_o_specialfile_and_compress_debug_sections):
459         Likewise.
460         * testsuite/Makefile.in: Regenerated.
461
462 2008-04-02  David S. Miller  <davem@davemloft.net>
463
464         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
465         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
466
467 2008-04-02  Craig Silverstein  <csilvers@google.com>
468
469         * TODO: New file.
470
471 2008-04-02  Ian Lance Taylor  <iant@google.com>
472
473         * fileread.cc (File_read::find_view): Add byteshift and vshifted
474         parameters.  Update for new key type to views_.  Change all
475         callers.
476         (File_read::read): Adjust for byteshift in returned view.
477         (File_read::add_view): New function, broken out of
478         find_and_make_view.
479         (File_read::make_view): New function, broken out of
480         find_and_make_view.
481         (File_read::find_or_make_view): Add offset and aligned
482         parameters.  Rewrite accordingly.  Change all callers.
483         (File_read::get_view): Add offset and aligned parameters.  Adjust
484         for byteshift in return value.
485         (File_read::get_lasting_view): Likewise.
486         * fileread.h (class File_read): Update declarations.
487         (class File_read::View): Add byteshift_ field.  Add byteshift to
488         constructor.  Add byteshift method.
489         * archive.h (Archive::clear_uncached_views): New function.
490         (Archive::get_view): Add aligned parameter.  Change all callers.
491         * object.h (Object::get_view): Add aligned parameter.  Change all
492         callers.
493         (Object::get_lasting_view): Likewise.
494
495         * fileread.cc (File_read::release): Don't call clear_views if
496         there are multiple objects.
497         * fileread.h (File_read::clear_uncached_views): New function.
498         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
499         on the archive.
500
501 2008-03-31  Cary Coutant  <ccoutant@google.com>
502
503         Add thin archive support.
504         * archive.cc (Archive::armagt): New const.
505         (Archive::setup): Remove task parameter and calls to unlock.
506         (Archive::unlock_nested_archives): New function.
507         (Archive::read_header): Add nested_off parameter. Change
508         all callers.
509         (Archive::interpret_header): Likewise.
510         (Archive::include_all_members): Change to handle thin
511         archives.
512         (Archive::include_member): Likewise.
513         * archive.h (Archive::Archive): Add new parameters and
514         initializers.
515         (Archive::armagt): New const.
516         (Archive::setup): Remove task parameter.
517         (Archive::unlock_nested_archives): New function.
518         (Archive::read_header): Add nested_off parameter.
519         (Archive::interpret_header): Likewise.
520         (Archive::Nested_archive_table): New typedef.
521         (Archive::is_thin_archive_): New field.
522         (Archive::nested_archives_): New field.
523         (Archive::options_): New field.
524         (Archive::dirpath_): New field.
525         (Archive::task_): New field.
526         * readsyms.cc (Read_symbols::do_read_symbols): Add check
527         for thin archives.  Pass additional parameters to
528         Archive::Archive.  Unlock the archive file after calling
529         Archive::setup.
530         
531 2008-03-29  Ian Lance Taylor  <iant@google.com>
532
533         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
534         version symbol to be local.
535         * testsuite/ver_test_4.sh: New file.
536         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
537         (check_DATA): Add ver_test_4.syms.
538         (ver_test_4.syms): New target.
539         * testsuite/Makefile.in: Rebuild.
540
541         * output.cc
542         (Output_section::Input_section_sort_entry::has_priority): New
543         function.
544         (Output_section::Input_section_sort_entry::match_file_name): New
545         function.
546         (Output_section::Input_section_sort_entry::match_section_name):
547         Remove.
548         (Output_section::Input_section_sort_entry::match_section_name_prefix):
549         Remove.
550         (Output_section::Input_section_sort_entry::match_section_file):
551         Remove.
552         (Output_section::Input_section_sort_compare::operator()): Rewrite
553         using new Input_section_sort_entry functions.  Sort crtbegin and
554         crtend first.  Sort sections with no priority before sections with
555         a priority.
556         * testsuite/initpri1.c (d3): Check j != 4.
557         (cd5): New constructor/destructor function.
558         (main): Check j != 2.
559
560         * symtab.cc (Symbol_table::add_from_object): If we don't use the
561         new symbol when resolving, don't call set_is_default.
562         * testsuite/ver_test_7.cc: New file.
563         * testsuite/ver_test_7.sh: New file.
564         * testsuite/Makefile.am (ver_test_7.so): New target.
565         (ver_test_7.o): New target.
566         (check_SCRIPTS): Add ver_test_7.sh.
567         (check_DATA): Add ver_test_7.syms.
568         (ver_test_7.syms): New target.
569
570 2008-03-28  Ian Lance Taylor  <iant@google.com>
571
572         * layout.cc (Layout::layout): If we see an input section with a
573         name that needs sorting, set the must_sort flag for the output
574         section.
575         (Layout::make_output_section): If the name of the output section
576         indicates that it might require sorting, set the may_sort flag.
577         * output.h (Output_section::may_sort_attached_input_sections): New
578         function.
579         (Output_section::set_may_sort_attached_input_sections): New
580         function.
581         (Output_section::must_sort_attached_input_sections): New
582         function.
583         (Output_section::set_must_sort_attached_input_sections): New
584         function.
585         (class Output_section): Declare Input_section_sort_entry.  Define
586         Input_section_sort_compare.  Declare
587         sort_attached_input_sections.  Add new fields:
588         may_sort_attached_input_sections_,
589         must_sort_attached_input_sections_,
590         attached_input_sections_are_sorted_.
591         * output.cc (Output_section::Output_section): Initialize new
592         fields.
593         (Output_section::add_input_section): Add an entry to
594         input_sections_ if may_sort or must_sort are true.
595         (Output_section::set_final_data_size): Call
596         sort_attached_input_sections if necessary.
597         (Output_section::Input_section_sort_entry): Define new class.
598         (Output_section::Input_section_sort_compare::operator()): New
599         function.
600         (Output_section::sort_attached_input_sections): New function.
601         * configure.ac: Check whether the compiler supports constructor
602         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
603         * testsuite/initpri1.c: New file.
604         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
605         CONSTRUCTOR_PRIORITY.
606         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
607         (initpri1_LDFLAGS): New variable.
608         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
609
610 2008-03-27  Ian Lance Taylor  <iant@google.com>
611
612         * common.cc (Sort_commons::operator): Correct sorting algorithm.
613         * testsuite/common_test_1.c: New file.
614         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
615         (common_test_1_SOURCES): New variable.
616         (common_test_1_DEPENDENCIES): New variable.
617         (common_test_1_LDFLAGS): New variable.
618
619         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
620         and commons_ correctly when NAME/VERSION does not override
621         NAME/NULL.
622         * testsuite/ver_test_6.c: New file.
623         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
624         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
625         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
626
627 2008-03-26  Ian Lance Taylor  <iant@google.com>
628
629         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
630         of an undefined symbol from a version script.
631         * testsuite/Makefile.am (ver_test_5.so): New target.
632         (ver_test_5.o): New target.
633         (check_SCRIPTS): Add ver_test_5.sh.
634         (check_DATA): Add ver_test_5.syms.
635         (ver_test_5.syms): New target.
636         * testsuite/ver_test_5.cc: New file.
637         * testsuite/ver_test_5.script: New file.
638         * testsuite/ver_test_5.sh: New file.
639         * Makefile.in, testsuite/Makefile.in: Rebuild.
640
641         PR gold/5986
642         Fix problems building gold with gcc 4.3.0.
643         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
644         (gold_error_at_location, gold_warning_at_location): Use it.
645         * configure.ac: Check whether we can compile and use a template
646         function with a printf attribute.
647         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
648         when jumping over bytes.
649         * object.cc: Instantiate Object::read_section_data.
650         * debug.h: Include <cstring>
651         * dwarf_reader.cc: Include <algorithm>
652         * main.cc: Include <cstring>.
653         * options.cc: Include <cstring>.
654         * output.cc: Include <cstring>.
655         * script.cc: Include <cstring>.
656         * script.h: Include <string>.
657         * symtab.cc: Include <cstring> and <algorithm>.
658         * target-select.cc: Include <cstring>.
659         * version.cc: Include <string>.
660         * testsuite/testmain.cc: Include <cstdlib>.
661         * configure, config.in: Rebuild.
662
663 2008-03-25  Ian Lance Taylor  <iant@google.com>
664
665         * options.cc: Include "../bfd/bfdver.h".
666         (options::help): Print bug reporting address.
667
668         * version.cc (print_version): Adjust output for current value of
669         BFD_VERSION_STRING.
670
671         * NEWS: New file.
672
673         * options.cc (options::help): Print list of supported targets.
674         * target-select.h: Include <vector>.
675         (class Target_selector): Make machine_, size_, and is_big_endian_
676         fields const.  Add bfd_name_ and instantiated_target_ fields.
677         (Target_selector::Target_selector): Add bfd_name parameter.
678         (Target_selector::recognize): Make non-virtual, call
679         do_recognize.
680         (Target_selector::recognize_by_name): Make non-virtual, call
681         do_recognize_by_name.
682         (Target_selector::supported_names): New function.
683         (Target_selector::bfd_name): New function.
684         (Target_selector::do_instantiate_target): New pure virtual
685         function.
686         (Target_selector::do_recognize): New virtual function.
687         (Target_selector::do_recognize_by_name): New virtual function.
688         (Target_selector::instantiate_target): New private function.
689         (supported_target_names): Declare.
690         * target-select.cc (Target_selector::Target_selector): Update for
691         new parameter and fields.
692         (select_target_by_name): Check that the name matches before
693         calling recognize_by_name.
694         (supported_target_names): New function.
695         * i386.cc (class Target_selector_i386): Update Target_selector
696         constructor call.  Remove recognize and recognize_by_name.  Add
697         do_instantiate_target.
698         * x86_64.cc (class Target_selector_x86_64): Likewise.
699         * testsuite/testfile.cc (class Target_selector_test): Update for
700         changes to Target_selector.
701
702         * README: Rewrite, with some notes on unsupported features.
703
704 2008-03-24  Cary Coutant  <ccoutant@google.com>
705
706         * i386.cc (Target_i386::Got_type): New enum declaration.
707         (Target_i386::Scan::local): Updated callers of Output_data_got
708         member functions.
709         (Target_i386::Scan::global): Likewise.
710         (Target_i386::Relocate::relocate): Likewise.
711         (Target_i386::Relocate::relocate_tls): Likewise.
712         * object.h (Got_offset_list): New class.
713         (Sized_relobj::local_has_got_offset): Added got_type parameter.
714         (Sized_relobj::local_got_offset): Likewise.
715         (Sized_relobj::set_local_got_offset): Likewise.
716         (Sized_relobj::local_has_tls_got_offset): Removed.
717         (Sized_relobj::local_tls_got_offset): Removed.
718         (Sized_relobj::set_local_tls_got_offset): Removed.
719         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
720         * output.cc (Output_data_got::add_global): Added got_type parameter.
721         (Output_data_got::add_global_with_rel): Likewise.
722         (Output_data_got::add_global_with_rela): Likewise.
723         (Output_data_got::add_global_pair_with_rel): New function.
724         (Output_data_got::add_global_pair_with_rela): New function.
725         (Output_data_got::add_local): Added got_type parameter.
726         (Output_data_got::add_local_with_rel): Likewise.
727         (Output_data_got::add_local_with_rela): Likewise.
728         (Output_data_got::add_local_pair_with_rel): New function.
729         (Output_data_got::add_local_pair_with_rela): New function.
730         (Output_data_got::add_global_tls): Removed.
731         (Output_data_got::add_global_tls_with_rel): Removed.
732         (Output_data_got::add_global_tls_with_rela): Removed.
733         (Output_data_got::add_local_tls): Removed.
734         (Output_data_got::add_local_tls_with_rel): Removed.
735         (Output_data_got::add_local_tls_with_rela): Removed.
736         * output.h (Output_data_got::add_global): Added got_type parameter.
737         (Output_data_got::add_global_with_rel): Likewise.
738         (Output_data_got::add_global_with_rela): Likewise.
739         (Output_data_got::add_global_pair_with_rel): New function.
740         (Output_data_got::add_global_pair_with_rela): New function.
741         (Output_data_got::add_local): Added got_type parameter.
742         (Output_data_got::add_local_with_rel): Likewise.
743         (Output_data_got::add_local_with_rela): Likewise.
744         (Output_data_got::add_local_pair_with_rel): New function.
745         (Output_data_got::add_local_pair_with_rela): New function.
746         (Output_data_got::add_global_tls): Removed.
747         (Output_data_got::add_global_tls_with_rel): Removed.
748         (Output_data_got::add_global_tls_with_rela): Removed.
749         (Output_data_got::add_local_tls): Removed.
750         (Output_data_got::add_local_tls_with_rel): Removed.
751         (Output_data_got::add_local_tls_with_rela): Removed.
752         * resolve.cc (Symbol::override_base_with_special): Removed
753         reference to has_got_offset_ field.
754         * symtab.cc (Symbol::init_fields): Replaced initialization
755         of got_offset_ with got_offsets_.  Removed initialization
756         of has_got_offset_
757         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
758         (Symbol::got_offset): Likewise.
759         (Symbol::set_got_offset): Likewise.
760         (Symbol::has_tls_got_offset): Removed.
761         (Symbol::tls_got_offset): Removed.
762         (Symbol::set_tls_got_offset): Removed.
763         (Symbol::got_offset_): Removed.
764         (Symbol::tls_mod_got_offset_): Removed.
765         (Symbol::tls_pair_got_offset_): Removed.
766         (Symbol::got_offsets_): New field.
767         (Symbol::has_got_offset): Removed.
768         (Symbol::has_tls_mod_got_offset): Removed.
769         (Symbol::has_tls_pair_got_offset): Removed.
770         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
771         (Target_x86_64::Scan::local): Updated callers of Output_data_got
772         member functions.
773         (Target_x86_64::Scan::global): Likewise.
774         (Target_x86_64::Relocate::relocate): Likewise.
775         (Target_x86_64::Relocate::relocate_tls): Likewise.
776
777 2008-03-25  Ben Elliston  <bje@au.ibm.com>
778
779         * yyscript.y: Fix spelling error in comment.
780
781 2008-03-24  Ian Lance Taylor  <iant@google.com>
782
783         * options.h (class General_options): Define build_id option.
784         * layout.h (class Layout): Declare write_build_id, create_note,
785         create_build_id.  Add build_id_note_ member.
786         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
787         "libiberty.h", "md5.h", "sha1.h".
788         (Layout::Layout): Initialize eh_frame_data_,
789         eh_frame_hdr_section_, and build_id_note_.
790         (Layout::finalize): Call create_build_id.
791         (Layout::create_note): New function, broken out of
792         Layout::create_gold_note.
793         (Layout::create_gold_note): Call create_note.
794         (Layout::create_build_id): New function.
795         (Layout::write_build_id): New function.
796         (Close_task_runner::run): Call write_build_id.
797
798         * x86_64.cc: Correct license to GPLv3.
799
800 2008-03-23  Ian Lance Taylor  <iant@google.com>
801
802         * options.cc: Include "demangle.h".
803         (parse_optional_string): New function.
804         (parse_long_option): Handle takes_optional_argument.
805         (parse_short_option): Update dash_z initializer.  Handle
806         takes_optional_argument.
807         (General_options::General_options): Initialize do_demangle_.
808         (General_options::finalize): Set do_demangle_.  Handle demangling
809         style.
810         * options.h (parse_optional_string): Declare.
811         (struct One_option): Add optional_arg field.  Update constructor.
812         Update call constructor calls.  Add takes_optional_argument
813         function.
814         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
815         (DEFINE_optional_string): Define.
816         (General_options::demangle): Change from DEFINE_bool to
817         DEFINE_optional_string.
818         (General_options::no_demangle): New function.
819         (General_options::do_demangle): New function.
820         (General_options::set_do_demangle): New function.
821         (General_options::execstack_status_): Move definition to end of
822         class definition.
823         (General_options::static_): Likewise.
824         (General_options::do_demangle_): New field.
825         * object.cc (big_endian>::get_symbol_location_info): Call
826         Options::do_demangle, not Options::demangle.
827         * symtab.cc (demangle): Likewise.
828
829 2008-03-22  Ian Lance Taylor  <iant@google.com>
830
831         * gold.h: Include <cstddef> and <sys/types.h>
832         * options.h: Include <cstring>.
833
834 2008-03-21  Ian Lance Taylor  <iant@google.com>
835
836         * Added source code to GNU binutils.
837