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