e79fd7b81bc2b556a7326b9a944d00f06887977a
[external/binutils.git] / gold / ChangeLog
1 2008-04-08  Ian Lance Taylor  <iant@google.com>
2
3         * options.h (class General_options): Add --noinhibit-exec option.
4         * main.cc (main): Check --noinhibit-exec.
5
6         * options.h (class General_options): Define --wrap as a special
7         option.  Add wrap_symbols_ field.
8         (General_options::any_wrap_symbols): New function.
9         (General_options::is_wrap_symbol): New function.
10         * options.cc (General_options::parse_wrap): New function.
11         (General_options::General_options): Initialize wrap_symbols_.
12         * symtab.cc (Symbol_table::wrap_symbol): New function.
13         (Symbol_table::add_from_object): Handle --wrap.
14         * symtab.h (class Symbol_table): Declare wrap_symbol.
15         * target.h (Target::wrap_char): New function.
16         (Target::Target_info): Add wrap_char field.
17         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
18         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
19         * testsuite/testfile.cc (Target_test::test_target_info):
20         Likewise.
21
22         * errors.cc (Errors::undefined_symbol): Mention symbol version if
23         there is one.
24
25         * layout.h (class Layout): Add added_eh_frame_data_ field.
26         * layout.cc (Layout::Layout): Initialize new field.
27         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
28         output section until we find a section we merged successfully.
29         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
30         that the size be non-zero.
31
32         * merge.cc (Object_merge_map::get_output_offset): Remove inline
33         qualifier.
34
35 2008-04-08  Craig Silverstein  <csilvers@google.com>
36
37         * configure.ac: Export new conditional variable HAVE_ZLIB.
38         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
39         on HAVE_ZLIB.
40         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
41         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
42
43 2008-04-07  Ian Lance Taylor  <iant@google.com>
44
45         * version.cc (version_string): Set to "1.5".
46
47         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
48         Add issued_non_pic_error_ field.  Declare check_non_pic.
49         (Target_x86_64::Scan::check_non_pic): New function.
50         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
51         (Target_x86_64::Scan::global): Likewise.
52
53         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
54         addend parameter.  Change caller.  Handle merge sections.
55         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
56         Address to Addend.  Don't add in the result of
57         local_section_offset, pass down the addend and use the returned
58         value.
59         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
60         Update declarations of local_section_offset and symbol_value.
61         * testsuite/two_file_test_1.cc (t18): New function.
62         * testsuite/two_file_test_2.cc (f18): New function.
63         * testsuite/two_file_test_main.cc (main): Call t18.
64         * testsuite/two_file_test.h (t18, f18): Declare.
65
66         * configure.ac: Don't test for objdump, c++filt, or readelf.
67         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
68         conditionals.
69         (TEST_READELF): New variable.
70         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
71         (check_PROGRAMS): Add two_file_strip_test.
72         (two_file_strip_test): New target.
73         (check_PROGRAMS): Add two_file_same_shared_strip_test.
74         (two_file_same_shared_strip_test_SOURCES): New variable.
75         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
76         (two_file_same_shared_strip_test_LDFLAGS): New variable.
77         (two_file_same_shared_strip_test_LDADD): New variable.
78         (two_file_shared_strip.so): New target.
79         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
80         (ver_test_5.syms, ver_test_7.syms): Likewise.
81         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
82         (strip_test_3.stdout): Use TEST_OBJDUMP.
83         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
84
85 2008-04-04  Cary Coutant  <ccoutant@google.com>
86
87         * symtab.h (Symbol::is_weak_undefined): New function.
88         (Symbol::is_strong_undefined): New function.
89         (Symbol::is_absolute): New function.
90         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
91         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
92         absolute symbols.
93         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
94         (weak_undef_test): New target.
95         * testsuite/Makefile.in: Rebuild.
96         * testsuite/weak_undef_file1.cc: New file.
97         * testsuite/weak_undef_file2.cc: New file.
98         * testsuite/weak_undef_test.cc: New file.
99
100 2008-04-03  Craig Silverstein  <csilvers@google.com>
101
102         * compressed_output.h (class Output_compressed_section): Use
103         unsigned buffer.
104         * compressed_output.cc (zlib_compress): Use unsigned buffers,
105         add zlib header.
106         (zlib_compressed_suffix): Removed.
107         (Output_compressed_section::set_final_data_size): Use unsigned
108         buffers.
109         * testsuite/Makefile.am (flagstest_compress_debug_sections):
110         Fix linker invocation.
111         (flagstest_o_specialfile_and_compress_debug_sections):
112         Likewise.
113         * testsuite/Makefile.in: Regenerated.
114
115 2008-04-02  David S. Miller  <davem@davemloft.net>
116
117         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
118         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
119
120 2008-04-02  Craig Silverstein  <csilvers@google.com>
121
122         * TODO: New file.
123
124 2008-04-02  Ian Lance Taylor  <iant@google.com>
125
126         * fileread.cc (File_read::find_view): Add byteshift and vshifted
127         parameters.  Update for new key type to views_.  Change all
128         callers.
129         (File_read::read): Adjust for byteshift in returned view.
130         (File_read::add_view): New function, broken out of
131         find_and_make_view.
132         (File_read::make_view): New function, broken out of
133         find_and_make_view.
134         (File_read::find_or_make_view): Add offset and aligned
135         parameters.  Rewrite accordingly.  Change all callers.
136         (File_read::get_view): Add offset and aligned parameters.  Adjust
137         for byteshift in return value.
138         (File_read::get_lasting_view): Likewise.
139         * fileread.h (class File_read): Update declarations.
140         (class File_read::View): Add byteshift_ field.  Add byteshift to
141         constructor.  Add byteshift method.
142         * archive.h (Archive::clear_uncached_views): New function.
143         (Archive::get_view): Add aligned parameter.  Change all callers.
144         * object.h (Object::get_view): Add aligned parameter.  Change all
145         callers.
146         (Object::get_lasting_view): Likewise.
147
148         * fileread.cc (File_read::release): Don't call clear_views if
149         there are multiple objects.
150         * fileread.h (File_read::clear_uncached_views): New function.
151         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
152         on the archive.
153
154 2008-03-31  Cary Coutant  <ccoutant@google.com>
155
156         Add thin archive support.
157         * archive.cc (Archive::armagt): New const.
158         (Archive::setup): Remove task parameter and calls to unlock.
159         (Archive::unlock_nested_archives): New function.
160         (Archive::read_header): Add nested_off parameter. Change
161         all callers.
162         (Archive::interpret_header): Likewise.
163         (Archive::include_all_members): Change to handle thin
164         archives.
165         (Archive::include_member): Likewise.
166         * archive.h (Archive::Archive): Add new parameters and
167         initializers.
168         (Archive::armagt): New const.
169         (Archive::setup): Remove task parameter.
170         (Archive::unlock_nested_archives): New function.
171         (Archive::read_header): Add nested_off parameter.
172         (Archive::interpret_header): Likewise.
173         (Archive::Nested_archive_table): New typedef.
174         (Archive::is_thin_archive_): New field.
175         (Archive::nested_archives_): New field.
176         (Archive::options_): New field.
177         (Archive::dirpath_): New field.
178         (Archive::task_): New field.
179         * readsyms.cc (Read_symbols::do_read_symbols): Add check
180         for thin archives.  Pass additional parameters to
181         Archive::Archive.  Unlock the archive file after calling
182         Archive::setup.
183         
184 2008-03-29  Ian Lance Taylor  <iant@google.com>
185
186         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
187         version symbol to be local.
188         * testsuite/ver_test_4.sh: New file.
189         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
190         (check_DATA): Add ver_test_4.syms.
191         (ver_test_4.syms): New target.
192         * testsuite/Makefile.in: Rebuild.
193
194         * output.cc
195         (Output_section::Input_section_sort_entry::has_priority): New
196         function.
197         (Output_section::Input_section_sort_entry::match_file_name): New
198         function.
199         (Output_section::Input_section_sort_entry::match_section_name):
200         Remove.
201         (Output_section::Input_section_sort_entry::match_section_name_prefix):
202         Remove.
203         (Output_section::Input_section_sort_entry::match_section_file):
204         Remove.
205         (Output_section::Input_section_sort_compare::operator()): Rewrite
206         using new Input_section_sort_entry functions.  Sort crtbegin and
207         crtend first.  Sort sections with no priority before sections with
208         a priority.
209         * testsuite/initpri1.c (d3): Check j != 4.
210         (cd5): New constructor/destructor function.
211         (main): Check j != 2.
212
213         * symtab.cc (Symbol_table::add_from_object): If we don't use the
214         new symbol when resolving, don't call set_is_default.
215         * testsuite/ver_test_7.cc: New file.
216         * testsuite/ver_test_7.sh: New file.
217         * testsuite/Makefile.am (ver_test_7.so): New target.
218         (ver_test_7.o): New target.
219         (check_SCRIPTS): Add ver_test_7.sh.
220         (check_DATA): Add ver_test_7.syms.
221         (ver_test_7.syms): New target.
222
223 2008-03-28  Ian Lance Taylor  <iant@google.com>
224
225         * layout.cc (Layout::layout): If we see an input section with a
226         name that needs sorting, set the must_sort flag for the output
227         section.
228         (Layout::make_output_section): If the name of the output section
229         indicates that it might require sorting, set the may_sort flag.
230         * output.h (Output_section::may_sort_attached_input_sections): New
231         function.
232         (Output_section::set_may_sort_attached_input_sections): New
233         function.
234         (Output_section::must_sort_attached_input_sections): New
235         function.
236         (Output_section::set_must_sort_attached_input_sections): New
237         function.
238         (class Output_section): Declare Input_section_sort_entry.  Define
239         Input_section_sort_compare.  Declare
240         sort_attached_input_sections.  Add new fields:
241         may_sort_attached_input_sections_,
242         must_sort_attached_input_sections_,
243         attached_input_sections_are_sorted_.
244         * output.cc (Output_section::Output_section): Initialize new
245         fields.
246         (Output_section::add_input_section): Add an entry to
247         input_sections_ if may_sort or must_sort are true.
248         (Output_section::set_final_data_size): Call
249         sort_attached_input_sections if necessary.
250         (Output_section::Input_section_sort_entry): Define new class.
251         (Output_section::Input_section_sort_compare::operator()): New
252         function.
253         (Output_section::sort_attached_input_sections): New function.
254         * configure.ac: Check whether the compiler supports constructor
255         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
256         * testsuite/initpri1.c: New file.
257         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
258         CONSTRUCTOR_PRIORITY.
259         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
260         (initpri1_LDFLAGS): New variable.
261         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
262
263 2008-03-27  Ian Lance Taylor  <iant@google.com>
264
265         * common.cc (Sort_commons::operator): Correct sorting algorithm.
266         * testsuite/common_test_1.c: New file.
267         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
268         (common_test_1_SOURCES): New variable.
269         (common_test_1_DEPENDENCIES): New variable.
270         (common_test_1_LDFLAGS): New variable.
271
272         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
273         and commons_ correctly when NAME/VERSION does not override
274         NAME/NULL.
275         * testsuite/ver_test_6.c: New file.
276         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
277         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
278         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
279
280 2008-03-26  Ian Lance Taylor  <iant@google.com>
281
282         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
283         of an undefined symbol from a version script.
284         * testsuite/Makefile.am (ver_test_5.so): New target.
285         (ver_test_5.o): New target.
286         (check_SCRIPTS): Add ver_test_5.sh.
287         (check_DATA): Add ver_test_5.syms.
288         (ver_test_5.syms): New target.
289         * testsuite/ver_test_5.cc: New file.
290         * testsuite/ver_test_5.script: New file.
291         * testsuite/ver_test_5.sh: New file.
292         * Makefile.in, testsuite/Makefile.in: Rebuild.
293
294         PR gold/5986
295         Fix problems building gold with gcc 4.3.0.
296         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
297         (gold_error_at_location, gold_warning_at_location): Use it.
298         * configure.ac: Check whether we can compile and use a template
299         function with a printf attribute.
300         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
301         when jumping over bytes.
302         * object.cc: Instantiate Object::read_section_data.
303         * debug.h: Include <cstring>
304         * dwarf_reader.cc: Include <algorithm>
305         * main.cc: Include <cstring>.
306         * options.cc: Include <cstring>.
307         * output.cc: Include <cstring>.
308         * script.cc: Include <cstring>.
309         * script.h: Include <string>.
310         * symtab.cc: Include <cstring> and <algorithm>.
311         * target-select.cc: Include <cstring>.
312         * version.cc: Include <string>.
313         * testsuite/testmain.cc: Include <cstdlib>.
314         * configure, config.in: Rebuild.
315
316 2008-03-25  Ian Lance Taylor  <iant@google.com>
317
318         * options.cc: Include "../bfd/bfdver.h".
319         (options::help): Print bug reporting address.
320
321         * version.cc (print_version): Adjust output for current value of
322         BFD_VERSION_STRING.
323
324         * NEWS: New file.
325
326         * options.cc (options::help): Print list of supported targets.
327         * target-select.h: Include <vector>.
328         (class Target_selector): Make machine_, size_, and is_big_endian_
329         fields const.  Add bfd_name_ and instantiated_target_ fields.
330         (Target_selector::Target_selector): Add bfd_name parameter.
331         (Target_selector::recognize): Make non-virtual, call
332         do_recognize.
333         (Target_selector::recognize_by_name): Make non-virtual, call
334         do_recognize_by_name.
335         (Target_selector::supported_names): New function.
336         (Target_selector::bfd_name): New function.
337         (Target_selector::do_instantiate_target): New pure virtual
338         function.
339         (Target_selector::do_recognize): New virtual function.
340         (Target_selector::do_recognize_by_name): New virtual function.
341         (Target_selector::instantiate_target): New private function.
342         (supported_target_names): Declare.
343         * target-select.cc (Target_selector::Target_selector): Update for
344         new parameter and fields.
345         (select_target_by_name): Check that the name matches before
346         calling recognize_by_name.
347         (supported_target_names): New function.
348         * i386.cc (class Target_selector_i386): Update Target_selector
349         constructor call.  Remove recognize and recognize_by_name.  Add
350         do_instantiate_target.
351         * x86_64.cc (class Target_selector_x86_64): Likewise.
352         * testsuite/testfile.cc (class Target_selector_test): Update for
353         changes to Target_selector.
354
355         * README: Rewrite, with some notes on unsupported features.
356
357 2008-03-24  Cary Coutant  <ccoutant@google.com>
358
359         * i386.cc (Target_i386::Got_type): New enum declaration.
360         (Target_i386::Scan::local): Updated callers of Output_data_got
361         member functions.
362         (Target_i386::Scan::global): Likewise.
363         (Target_i386::Relocate::relocate): Likewise.
364         (Target_i386::Relocate::relocate_tls): Likewise.
365         * object.h (Got_offset_list): New class.
366         (Sized_relobj::local_has_got_offset): Added got_type parameter.
367         (Sized_relobj::local_got_offset): Likewise.
368         (Sized_relobj::set_local_got_offset): Likewise.
369         (Sized_relobj::local_has_tls_got_offset): Removed.
370         (Sized_relobj::local_tls_got_offset): Removed.
371         (Sized_relobj::set_local_tls_got_offset): Removed.
372         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
373         * output.cc (Output_data_got::add_global): Added got_type parameter.
374         (Output_data_got::add_global_with_rel): Likewise.
375         (Output_data_got::add_global_with_rela): Likewise.
376         (Output_data_got::add_global_pair_with_rel): New function.
377         (Output_data_got::add_global_pair_with_rela): New function.
378         (Output_data_got::add_local): Added got_type parameter.
379         (Output_data_got::add_local_with_rel): Likewise.
380         (Output_data_got::add_local_with_rela): Likewise.
381         (Output_data_got::add_local_pair_with_rel): New function.
382         (Output_data_got::add_local_pair_with_rela): New function.
383         (Output_data_got::add_global_tls): Removed.
384         (Output_data_got::add_global_tls_with_rel): Removed.
385         (Output_data_got::add_global_tls_with_rela): Removed.
386         (Output_data_got::add_local_tls): Removed.
387         (Output_data_got::add_local_tls_with_rel): Removed.
388         (Output_data_got::add_local_tls_with_rela): Removed.
389         * output.h (Output_data_got::add_global): Added got_type parameter.
390         (Output_data_got::add_global_with_rel): Likewise.
391         (Output_data_got::add_global_with_rela): Likewise.
392         (Output_data_got::add_global_pair_with_rel): New function.
393         (Output_data_got::add_global_pair_with_rela): New function.
394         (Output_data_got::add_local): Added got_type parameter.
395         (Output_data_got::add_local_with_rel): Likewise.
396         (Output_data_got::add_local_with_rela): Likewise.
397         (Output_data_got::add_local_pair_with_rel): New function.
398         (Output_data_got::add_local_pair_with_rela): New function.
399         (Output_data_got::add_global_tls): Removed.
400         (Output_data_got::add_global_tls_with_rel): Removed.
401         (Output_data_got::add_global_tls_with_rela): Removed.
402         (Output_data_got::add_local_tls): Removed.
403         (Output_data_got::add_local_tls_with_rel): Removed.
404         (Output_data_got::add_local_tls_with_rela): Removed.
405         * resolve.cc (Symbol::override_base_with_special): Removed
406         reference to has_got_offset_ field.
407         * symtab.cc (Symbol::init_fields): Replaced initialization
408         of got_offset_ with got_offsets_.  Removed initialization
409         of has_got_offset_
410         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
411         (Symbol::got_offset): Likewise.
412         (Symbol::set_got_offset): Likewise.
413         (Symbol::has_tls_got_offset): Removed.
414         (Symbol::tls_got_offset): Removed.
415         (Symbol::set_tls_got_offset): Removed.
416         (Symbol::got_offset_): Removed.
417         (Symbol::tls_mod_got_offset_): Removed.
418         (Symbol::tls_pair_got_offset_): Removed.
419         (Symbol::got_offsets_): New field.
420         (Symbol::has_got_offset): Removed.
421         (Symbol::has_tls_mod_got_offset): Removed.
422         (Symbol::has_tls_pair_got_offset): Removed.
423         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
424         (Target_x86_64::Scan::local): Updated callers of Output_data_got
425         member functions.
426         (Target_x86_64::Scan::global): Likewise.
427         (Target_x86_64::Relocate::relocate): Likewise.
428         (Target_x86_64::Relocate::relocate_tls): Likewise.
429
430 2008-03-25  Ben Elliston  <bje@au.ibm.com>
431
432         * yyscript.y: Fix spelling error in comment.
433
434 2008-03-24  Ian Lance Taylor  <iant@google.com>
435
436         * options.h (class General_options): Define build_id option.
437         * layout.h (class Layout): Declare write_build_id, create_note,
438         create_build_id.  Add build_id_note_ member.
439         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
440         "libiberty.h", "md5.h", "sha1.h".
441         (Layout::Layout): Initialize eh_frame_data_,
442         eh_frame_hdr_section_, and build_id_note_.
443         (Layout::finalize): Call create_build_id.
444         (Layout::create_note): New function, broken out of
445         Layout::create_gold_note.
446         (Layout::create_gold_note): Call create_note.
447         (Layout::create_build_id): New function.
448         (Layout::write_build_id): New function.
449         (Close_task_runner::run): Call write_build_id.
450
451         * x86_64.cc: Correct license to GPLv3.
452
453 2008-03-23  Ian Lance Taylor  <iant@google.com>
454
455         * options.cc: Include "demangle.h".
456         (parse_optional_string): New function.
457         (parse_long_option): Handle takes_optional_argument.
458         (parse_short_option): Update dash_z initializer.  Handle
459         takes_optional_argument.
460         (General_options::General_options): Initialize do_demangle_.
461         (General_options::finalize): Set do_demangle_.  Handle demangling
462         style.
463         * options.h (parse_optional_string): Declare.
464         (struct One_option): Add optional_arg field.  Update constructor.
465         Update call constructor calls.  Add takes_optional_argument
466         function.
467         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
468         (DEFINE_optional_string): Define.
469         (General_options::demangle): Change from DEFINE_bool to
470         DEFINE_optional_string.
471         (General_options::no_demangle): New function.
472         (General_options::do_demangle): New function.
473         (General_options::set_do_demangle): New function.
474         (General_options::execstack_status_): Move definition to end of
475         class definition.
476         (General_options::static_): Likewise.
477         (General_options::do_demangle_): New field.
478         * object.cc (big_endian>::get_symbol_location_info): Call
479         Options::do_demangle, not Options::demangle.
480         * symtab.cc (demangle): Likewise.
481
482 2008-03-22  Ian Lance Taylor  <iant@google.com>
483
484         * gold.h: Include <cstddef> and <sys/types.h>
485         * options.h: Include <cstring>.
486
487 2008-03-21  Ian Lance Taylor  <iant@google.com>
488
489         * Added source code to GNU binutils.
490