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