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