1 2008-09-09 Alan Modra <amodra@bigpond.net.au>
3 * po/gold.pot: Regenerate.
5 2008-09-05 Cary Coutant <ccoutant@google.com>
7 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
8 explicit instantiations.
10 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
13 * options.cc (General_options::finalize): Allow undefined symbols
14 in shlibs if linking -shared.
17 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
18 symbols as not needing a dynsym entry.
20 2008-08-20 Craig Silverstein <csilvers@google.com>
22 * fileread.cc (File_read::open): Do not lock the file unless it
23 was successfully opened.
25 2008-08-14 Cary Coutant <ccoutant@google.com>
27 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
28 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
29 * testsuite/tls_test.cc (struct int128): 128-bit struct
30 for testing TLS relocs with non-zero addend.
31 (v12): New TLS variable.
33 (t_last): Add check for v12.
34 * testsuite/tls_test.h (t12): New function.
35 * testsuite/tls_test_main.cc (thread_routine): Call new test.
37 2008-08-13 Ian Lance Taylor <iant@google.com>
39 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
40 set tls_segment_ or relro_segment_.
41 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
43 * output.h (Output_section::clear_is_relro): New function.
44 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
45 sections specially even when output_data_ is empty.
46 (Output_segment::maximum_alignment): When first section is relro,
47 only force alignment for PT_LOAD segments.
48 * script.cc (script_data_segment_align): New function.
49 (script_data_segment_relro_end): New function.
50 * script-c.h (script_data_segment_align): Declare.
51 (script_data_segment_relro_end): Declare.
52 * script-sections.h (class Script_sections): Declare
53 data_segment_align and data_segment_relro_end. Add fields
54 segment_align_index_ and saw_relro_end_.
55 * script-sections.cc (class Sections_element): Add set_is_relro
56 virtual function. Add new bool* parameter to place_orphan_here.
57 Add get_output_section virtual function.
58 (class Output_section_definition): Add set_is_relro. Add new
59 bool* parameter to place_orphan_here. Add get_output_section.
61 (Output_section_definition::Output_section_definition): Initialize
62 evaluated_address_, evaluated_load_address, evaluated_addralign_,
64 (Output_section_definition::place_orphan_here): Add is_relro
66 (Output_section_definition::set_section_addresses): Set relro for
68 (Output_section_definition::alternate_constraint): Likewise.
69 (class Orphan_output_section): Add new bool* parameter to
70 place_orphan_here. Add get_output_section.
71 (Orphan_output_section::place_orphan_here): Add is_relro
73 (Script_sections::Script_sections): Initialize
74 data_segment_align_index_ and saw_relro_end_.
75 (Script_sections::data_segment_align): New function.
76 (Script_sections::data_segment_relro_end): New function.
77 (Script_sections::place_orphan): Set or clear is_relro.
78 (Script_sections::set_section_addresses): Force alignment of first
80 * yyscript.y (exp): Call script_data_segment_align and
81 script_data_segment_relro_end.
82 * testsuite/relro_script_test.t: New file.
83 * testsuite/relro_test.cc (using_script): Declare.
84 (t1, t2): Test using_script.
85 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
86 (relro_script_test_SOURCES): Define.
87 (relro_script_test_DEPENDENCIES): Define.
88 (relro_script_test_LDFLAGS): Define.
89 (relro_script_test_LDADD): Define.
90 (relro_script_test.so): New target.
91 * testsuite/Makefile.in: Rebuild.
93 2008-08-06 Cary Coutant <ccoutant@google.com>
95 * archive.cc (Archive::total_archives, Archive::total_members)
96 (Archive::total_members_loaded): New variables.
97 (Archive::setup): Add parameter. Add option to preread
99 (Archive::read_armap): Add counter.
100 (Archive::get_file_and_offset): New function.
101 (Archive::get_elf_object_for_member): New function.
102 (Archive::read_all_symbols): New function.
103 (Archive::read_symbols): New function.
104 (Archive::add_symbols): Add counters.
105 (Archive::include_all_members): Use armap to find members if it's
107 (Archive::include_member): Skip reading symbols if already read.
108 Factored code into Archive::get_file_and_offset and
109 Archive::get_elf_object_for_member. Changed call to
110 Mapfile::report_include_archive_member.
111 (Archive::print_stats): New function.
112 * archive.h: Declare Object and Read_symbols_data classes.
113 (Archive::Archive): Add initializers for new members.
114 (Archive::setup): Add parameter.
115 (Archive::print_stats): New function.
116 (Archive::total_archives, Archive::total_members)
117 (Archive::total_members_loaded): New variables.
118 (Archive::get_file_and_offset): New function.
119 (Archive::get_elf_object_for_member): New function.
120 (Archive::read_all_symbols): New function.
121 (Archive::read_symbols): New function.
122 (Archive::Archive_member): New class.
123 (Archive::members_): New member.
124 (Archive::num_members_): New member.
125 * main.cc: Include archive.h.
126 (main): Call Archive::print_stats.
127 * mapfile.cc (Mapfile::report_include_archive_member): Delete
128 archive parameter; member_name is now the fully-decorated name.
129 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
130 * options.h: (General_options): Add --preread-archive-symbols option.
131 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
134 2008-08-04 Ian Lance Taylor <iant@google.com>
136 * symtab.h (Symbol::use_plt_offset): New function.
137 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
138 * powerpc.cc (Relocate::relocate): Likewise.
139 * sparc.cc (Relocate::relocate): Likewise.
140 * x86_64.cc (Relocate::relocate): Likewise.
141 * testsuite/weak_plt.sh: New test.
142 * testsuite/weak_plt_main.cc: New test.
143 * testsuite/weak_plt_shared.cc: New test.
144 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
145 (check_PROGRAMS): Add weak_plt.
146 (check_DATA): Add weak_plt_shared.so.
147 (weak_plt_main_pic.o, weak_plt): New targets.
148 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
149 * testsuite/Makefile.in: Rebuild.
151 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
153 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
154 * testsuite/Makefile.in: Rebuild.
156 2008-08-04 Alan Modra <amodra@bigpond.net.au>
158 * Makefile.am (POTFILES.in): Set LC_ALL=C.
159 * Makefile.in: Regenerate.
160 * po/POTFILES.in: Regenerate.
162 2008-07-29 Ian Lance Taylor <iant@google.com>
164 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
165 symbols before other symbols.
166 * testsuite/script_test_2.cc (test_addr): Declare.
167 (test_addr_alias): Declare.
168 (main): Check that test_addr and test_addr_alias have the right
170 * testsuite/script_test_2.t: Define test_addr_alias and
173 2008-07-24 Ian Lance Taylor <iant@google.com>
176 * descriptors.cc: New file.
177 * descriptors.h: New file.
178 * gold-threads.h (class Hold_optional_lock): New class.
179 * fileread.cc: Include "descriptors.h".
180 (File_read::~File_read): Release descriptor rather than closing
182 (File_read::open) [file]: Call open_descriptor rather than open.
183 Set is_descriptor_opened_.
184 (File_read::open) [memory]: Assert that descriptor is not open.
185 (File_read::reopen_descriptor): New function.
186 (File_read::release): Release descriptor.
187 (File_read::do_read): Make non-const. Reopen descriptor.
188 (File_read::read): Make non-const.
189 (File_read::make_view): Reopen descriptor.
190 (File_read::do_readv): Likewise.
191 * fileread.h (class File_read): Add is_descriptor_opened_ field.
193 * layout.cc: Include "descriptors.h".
194 (Layout::create_build_id): Use open_descriptor rather than open.
195 * output.cc: Include "descriptors.h".
196 (Output_file::open): Use open_descriptor rather than open.
197 * archive.cc (Archive::const_iterator): Change Archive to be
199 (Archive::begin, Archive::end): Make non-const.
200 (Archive::count_members): Likewise.
201 * archive.h (class Archive): Update declarations.
202 * object.h (Object::read): Make non-const.
203 * Makefile.am (CCFILES): Add descriptors.cc.
204 (HFILES): Add descriptors.h.
205 * Makefile.in: Rebuild.
208 * gold.h: Always include <clocale>. Add Solaris workarounds
209 following code in binutils/sysdep.h.
212 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
213 this->eh_frame_hdr_ is NULL before using it.
215 * dynobj.cc (Versions::Versions): Update comment.
217 * dynobj.cc (Versions::Versions): If there is an soname, use it as
218 the base version name.
220 * stringpool.cc (Stringpool_template::add_with_length): Set key to
222 (Stringpool_template::set_string_offsets): Subtract one from key
223 before using it as an array index.
224 (Stringpool_template::get_offset_with_length): Likewise.
225 (Stringpool_template::write_to_buffer): Likewise.
226 * stringpool.h (Stringpool_template::get_offset_from_key):
229 2008-07-23 Ian Lance Taylor <iant@google.com>
232 * object.h (Merged_symbol_value::value): Do our best to handle a
236 * script.cc (Version_script_info::get_versions): Don't add empty
237 version tag to return value.
238 (Version_script_info::get_symbol_version_helper): Change return
239 type to bool. Add pversion parameter. Change all callers.
240 (script_register_vers_node): Don't require a non-NULL tag.
241 * script.h (class Version_script_info): Update declarations.
242 (Version_script_info::get_symbol_version): Change return type to
243 bool. Add version parameter. Change all callers.
244 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
245 handling. Handle an empty version from a version script.
246 (Symbol_table::define_special_symbol): Likewise.
247 * testsuite/ver_test_10.script: New file.
248 * testsuite/ver_test_10.sh: New file.
249 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
250 (check_DATA): Add ver_test_10.syms.
251 (ver_test_10.syms, ver_test_10.so): New target.
252 * testsuite/Makefile.in: Rebuild.
254 2008-07-23 Simon Baldwin <simonb@google.com>
256 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
257 to zero for undefined symbols from dynamic libraries.
259 2008-07-23 Ian Lance Taylor <iant@google.com>
261 * symtab.cc (Symbol_table::resolve): Remove version parameter.
263 * symtab.h (class Symbol_table): Update declaration.
264 * testsuite/ver_test_9.cc: New file.
265 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
266 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
267 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
268 (ver_test_9.so, ver_test_9.o): New targets.
269 * testsuite/Makefile.in: Rebuild.
271 2008-07-22 Ian Lance Taylor <iant@google.com>
273 * options.h (class General_options): Define --check-sections.
274 * layout.cc (Layout::set_segment_offsets): Handle
277 * options.h (class General_options): Define -n/--nmagic and
279 * options.cc (General_options::finalize): For -n/--nmagic or
280 -N/--omagic, set -static.
281 * layout.cc (Layout::attach_allocated_section_to_segment): If
282 -N/--omagic, don't put read-only and read-write sections in
284 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
285 finding a read-only segment.
286 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
287 don't set the minimum segment alignment to the common page size,
288 and don't set the file offset to the address modulo the page size.
289 * script-sections.cc (Script_sections::create_segments): If
290 -n/--omagic, don't put read-only and read-write sections in
295 * options.h (class General_options): Add --print-symbol-counts.
296 * main.cc (main): Issue defined symbol report if requested.
297 * archive.cc (Archive::interpret_header): Make into a const member
299 (Archive::add_symbols): Call Input_objects::archive_start and
301 (Archive::const_iterator): Define new class.
302 (Archive::begin, Archive::end): New functions.
303 (Archive::include_all_members): Rewrite to use iterator.
304 (Archive::count_members): New function.
305 * archive.h (class Archive): Update declarations.
306 (Archive::filename): New function.
307 * object.cc: Include "cref.h".
308 (Sized_relobj::Sized_relobj): Initialize defined_count_.
309 (Sized_relobj::do_get_global_symbol_counts): New function.
310 (Input_objects::add_object): Add object to cross-referencer.
311 (Input_objects::archive_start): New function.
312 (Input_objects::archive_stop): New function.
313 (Input_objects::print_symbol_counts): New function.
314 * object.h: Declare Cref and Archive.
315 (Object::get_global_symbol_counts): New function.
316 (Object::do_get_global_symbol_counts): New pure virtual function.
317 (class Sized_relobj): Add defined_count_ field. Update
319 (class Input_objects): Add cref_ field. Update constructor.
321 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
323 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
325 (Sized_dynobj::do_get_global_symbol_counts): New function.
326 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
327 defined_count_. Update declarations. Define Symbols typedef.
328 * symtab.cc (Symbol_table::add_from_relobj): Add defined
329 parameter. Change all callers.
330 (Symbol_table::add_from_dynobj): Add sympointers and defined
331 parameters. Change all callers.
332 * symtab.h (class Symbol_table): Update declarations.
333 * Makefile.am (CCFILES): Add cref.cc.
334 (HFILES): Add cref.h.
335 * Makefile.in: Rebuild.
337 2008-07-22 Simon Baldwin <simonb@google.com>
339 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
340 to zero when writing undefined symbols.
342 2008-07-22 Ian Lance Taylor <iant@google.com>
344 * output.cc (Output_section::add_input_section): Don't try to
345 merge empty merge sections.
347 2008-07-21 Craig Silverstein <csilvers@google.com>
349 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
350 Include symbol version in error message.
352 2008-07-20 Chris Demetriou <cgd@google.com>
354 * configure.ac (gold_cv_c_random_seed): New configured variable.
355 (RANDOM_SEED_CFLAGS): New substituted variable.
356 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
357 * configure: Rebuild.
358 * Makefile.in: Likewise.
359 * testsuite/Makefile.in: Likewise.
361 2008-07-18 Ian Lance Taylor <iant@google.com>
363 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
364 where we see NAME/NULL and NAME/VERSION as separate symbols.
365 * testsuite/ver_test_main.cc (main): Call t4.
367 * testsuite/ver_test_2.cc (t4_2): Define.
368 * testsuite/ver_test_2.script: Put t4_2a in VER2.
369 * testsuite/ver_test_4.cc (t4_2a): Define.
370 * testsuite/ver_test_4.script: Put t4_2a in VER2.
371 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
373 2008-07-17 Ian Lance Taylor <iant@google.com>
375 * dynobj.cc (Versions::add_def): If we give an error about a
376 missing version, go ahead and create the version anyhow.
378 2008-07-10 Ian Lance Taylor <iant@google.com>
380 Handle output sections with more than 0x7fffffff bytes.
381 * object.h (class Relobj): Change map_to_output_ to
382 output_sections_, and just keep a section pointer. Change all
383 uses. Move comdat group support to Sized_relobj.
384 (Relobj::is_section_specially_mapped): Remove.
385 (Relobj::output_section): Remove poff parameter. Change all
387 (Relobj::output_section_offset): New function.
388 (Relobj::set_section_offset): Rewrite.
389 (Relobj::map_to_output): Remove.
390 (Relobj::output_sections): New function.
391 (Relobj::do_output_section_offset): New pure virtual function.
392 (Relobj::do_set_section_offset): Likewise.
393 (class Sized_relobj): Add section_offsets_ field. Add comdat
394 group support from Relobj. Update declarations.
395 (Sized_relobj::get_output_section_offset): New function.
396 (Sized_relobj::do_output_section_offset): New function.
397 (Sized_relobj::do_set_section_offset): New function.
398 * object.cc (Relobj::output_section_address): Remove.
399 (Sized_relobj::Sized_relobj): Initialize new fields.
400 (Sized_relobj::include_section_group): Cast find_kept_object to
402 (Sized_relobj::include_linkonce_section): Likewise.
403 (Sized_relobj::do_layout): Use separate arrays for output section
405 (Sized_relobj::do_count_local_symbols): Change map_to_output to
407 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
408 output_sections and section_offsets.
409 (Sized_relobj::write_local_symbols): Likewise.
410 (map_to_kept_section): Compute output address directly.
411 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
412 output_sections and section_offsets.
413 (Sized_relobj::write_sections): Likewise.
414 (Sized_relobj::relocate_sections): Likewise.
415 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
416 * output.h (class Output_reloc): Update declarations. Change
417 u2_.relobj to Sized_relobj*.
418 (class Output_data_reloc): Change add functions to use
420 * output.cc (Output_reloc::Output_reloc): Change relobj to
422 (Output_reloc::local_section_offset): Change return type to
423 Elf_Addr. Use get_output_section_offset.
424 (Output_reloc::get_address): Likewise.
425 (Output_section::is_input_address_mapped): Don't call
426 is_section_specially_mapped.
427 (Output_section::output_offset): Likewise.
428 (Output_section::output_address): Likewise.
429 (Output_section::starting_output_address): Likewise.
430 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
431 parameter to Sized_relobj*.
432 (Copy_relocs::need_copy_reloc): Likewise.
433 (Copy_relocs::save): Likewise.
434 * copy-relocs.h (class Copy_relocs): Update declarations.
435 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
436 Sized_relobj*. Change relobj_ field to Sized_relobj*.
437 * target-reloc.h (relocate_for_relocatable): Change
438 offset_in_output_section type to Elf_Addr. Change code that uses
440 * layout.cc (Layout::layout): Always set *off.
441 * mapfile.cc (Mapfile::print_input_section): Use
442 output_section_offset.
443 * i386.cc (Target_i386::copy_reloc): Change object parameter to
445 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
446 * sparc.cc (Target_sparc::copy_reloc): Likewise.
447 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
449 2008-07-03 Ian Lance Taylor <iant@google.com>
451 * layout.cc (Layout::include_section): Do not discard unrecognized
454 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
456 * script.cc (Lex::can_continue_name): Make '?' allowable in
457 version-script names.
458 * testsuite/version_script.map: Change glob pattern to use '?'
460 2008-06-30 Manish Singh <yosh@gimp.org>
463 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
466 2008-06-30 Ian Lance Taylor <iant@google.com>
470 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
471 versions]: Don't try to read the value in the contents, since we
472 don't use it. Use the template endianness when writing.
474 2008-06-25 Cary Coutant <ccoutant@google.com>
476 * fileread.cc (File_read::make_view): Assert on zero-length view.
477 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
478 symbol table when there are no symbols to read.
480 2008-06-23 Craig Silverstein <csilvers@google.com>
482 * version.cc (version_string): Bump to 1.7
484 2008-06-18 Craig Silverstein <csilvers@google.com>
486 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
487 constant 0xFFFF to type Valtype.
488 (Powerpc_relocate_functions::rel16_ha): Likewise.
490 2008-06-17 Ian Lance Taylor <iant@google.com>
492 * output.h (Output_section::Input_section): Initialize p2align_ to
493 zero for Output_section_data constructors.
494 (Output_section::Input_section::addralign): If not an input
495 section, return the alignment of the Output_section_data.
496 * testsuite/copy_test.cc: New file.
497 * testsuite/copy_test_1.cc: New file.
498 * testsuite/copy_test_2.cc: New file.
499 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
500 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
501 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
502 (copy_test_1_pic.o, copy_test_1.so): New targets.
503 (copy_test_2_pic.o, copy_test_2.so): New targets.
504 * testsuite/Makefile.in: Rebuild.
506 * script-sections.cc (Script_sections::place_orphan): Initialize
507 local variable exact.
509 2008-06-13 David Edelsohn <edelsohn@gnu.org>
511 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
513 2008-06-12 David Edelsohn <edelsohn@gnu.org>
514 David S. Miller <davem@davemloft.net>
516 * powerpc.cc: New file.
517 * Makefile.am (TARGETSOURCES): Add powerpc.cc
518 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
519 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
520 * Makefile.in: Rebuild.
522 2008-06-09 Ian Lance Taylor <iant@google.com>
524 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
526 (throwing, orig_terminate): New static variables.
527 (terminate_handler): New static function.
528 (t2): Set terminate handler.
530 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
533 * binary.cc (Binary_to_elf::sized_convert): Fix .data
536 2008-05-30 Cary Coutant <ccoutant@google.com>
538 * archive.cc (Archive::include_all_members) Correct to step
539 over symbol table and extended name table in thin archives.
541 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
544 * target-reloc.h (relocate_for_relocatable): Fix new_offset
547 2008-05-28 Caleb Howe <cshowe@google.com>
549 * reduced_debug_output.cc: New file.
550 * reduced_debug_output.h: New file.
551 * options.h (class General_options): Add --strip-debug-non-line.
552 * options.cc (General_options::finalize): Add strip_debug_non_line
553 to the strip heirarchy.
554 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
556 * layout.cc: Include "reduced_debug_output.h".
557 (Layout::Layout): Initialize new fields.
558 (line_only_debug_sections): New static array.
559 (is_lines_only_debug_sections): New static inline function.
560 (Layout::include_section): Handle --strip-debug-non-line.
561 (Layout::make_output_section): If --strip-debug-non-line, build
562 new output sections for .debug_abbrev and .debug_info.
563 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
564 gold. Warn about possible overflow.
565 (read_signed_LEB_128): Likewise.
566 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
567 (read_signed_LEB_128): Declare.
568 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
569 (HFILES): Add reduced_debug_output.h.
570 * Makefile.in: Rebuild.
572 2008-05-21 Ian Lance Taylor <iant@google.com>
574 * mapfile.cc: New file.
575 * mapfile.h: New file.
576 * options.h (class General_options): Add -M/--print-map and -Map.
577 * options.cc (General_options::finalize): Make -M equivalent to
579 * main.cc: Include <cstdio> and "mapfile.h".
580 (main): Open mapfile if requested.
581 * gold.cc (class Middle_runner): Add mapfile_ field. Update
582 constructor. Change caller.
583 (queue_initial_tasks): Add mapfile parameter. Change caller.
584 (queue_middle_tasks): Likewise.
585 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
587 * archive.cc: Include "mapfile.h".
588 (Archive::add_symbols): Add mapfile parameter. Change all
589 callers. Pass mapfile, symbol, and reason to include_member.
590 (Archive::include_all_members): Add mapfile parameter. Change all
592 (Archive::include_member): Add mapfile, sym, and why parameters.
593 Change all callers. Report inclusion to map file.
594 * archive.h: Include "fileread.h".
595 (class Archive): Update declarations.
596 (Archive::file): New const method.
597 (class Add_archive_symbols): Add mapfile_ field. Update
598 constructor. Change all callers.
599 * readsyms.h (class Read_symbols): Likewise.
600 (class Finish_group): Likewise.
601 (class Read_script): Likewise.
602 * common.cc: Include "mapfile.h".
603 (Symbol_table::allocate_commons): Add mapfile parameter. Change
605 (Symbol_table::do_allocate_commons): Likewise.
606 (Symbol_table::do_allocate_commons_list): Likewise. Report common
607 symbol allocation to mapfile.
608 * common.h (class Allocate_commons_task): Add mapfile_ field.
609 Update constructor. Change all callers.
610 * symtab.h (class Symbol_table): Update declarations.
611 * layout.cc: Include "mapfile.h".
612 (Layout_task_runner::run): Print information to mapfile.
613 (Layout::create_gold_note): Change Output_data_fixed_space to
614 Output_data_zero_fill.
615 (Layout::create_build_id): Likewise.
616 (Layout::print_to_mapfile): New function.
617 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
618 constructor. Change caller.
619 (class Layout): Declare print_to_mapfile.
620 * output.cc (Output_section::Input_section::print_to_mapfile): New
622 (Output_section::add_input_section): If producing a map, always
623 add to input_sections_ list.
624 (Output_section::do_print_to_mapfile): New function.
625 (Output_segment::print_sections_to_mapfile): New function.
626 (Output_segment::print_section_list_to_mapfile): New function.
627 * output.h: Include "mapfile.h".
628 (Output_data::print_to_mapfile): New function.
629 (Output_data::do_print_to_mapfile): New virtual function.
630 (Output_segment_headers::do_print_to_mapfile): New function.
631 (Output_file_header::do_print_to_mapfile): New function.
632 (Output_data_const::do_print_to_mapfile): New function.
633 (class Output_data_const_buffer): Add map_name_ field. Update
634 constructor. Change all callers. Add do_print_to_mapfile
636 (class Output_data_fixed_space): Likewise.
637 (class Output_data_space): Likewise.
638 (class Output_data_zero_fill): New class.
639 (Output_data_strtab::do_print_to_mapfile): New function.
640 (Output_data_reloc_base::do_print_to_mapfile): New function.
641 (Output_relocatable_relocs::do_print_to_mapfile): New function.
642 (Output_data_group::do_print_to_mapfile): New function.
643 (Output_data_got::do_print_to_mapfile): New function.
644 (Output_data_dynamic::do_print_to_mapfile): New function.
645 (Output_symtab_xindex::do_print_to_mapfile): New function.
646 (class Output_section): Declare do_print_to_mapflie. Declare
647 print_to_mapfile in Input_section.
648 (class Output_segment): Declare new functions.
649 * object.h (Sized_relobj::symbol_count): New function.
651 (Output_section_element_dot_assignment::set_section_addresses):
652 Change Output_data_fixed_space to Output_data_zero_fill.
653 (Output_data_expression::do_print_to_mapfile): New function.
654 * script.cc (read_input_script): Add mapfile parameter. Change
656 * script.h (read_input_script): Update declaration.
657 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
658 (Eh_frame::do_print_to_mapfile): New function.
659 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
660 (Output_merge_string::do_print_to_mapfile): New function.
661 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
663 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
665 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
667 * Makefile.am (CCFILES): Add mapfile.cc.
668 (HFILES): Add mapfile.h.
669 * Makefile.in: Rebuild.
671 2008-05-19 Ian Lance Taylor <iant@google.com>
673 * options.h (class General_options): Add -z relro.
674 * layout.cc (Layout::Layout): Initialize relro_segment_.
675 (Layout::add_output_section_data): Return the output section.
676 (Layout::make_output_section): Rcognize relro sections and mark
678 (Layout::attach_allocated_section_to_segment): Put relro sections
679 in a PT_GNU_RELRO segment.
680 (Layout::create_initial_dynamic_sections): Mark the .dynamic
682 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
684 (Layout::linkonce_mapping): Map d.rel.ro.local to
686 (Layout::output_section_name): Us .data.rel.ro.local for any
687 section which begins with that.
688 * layout.h (class Layout): Update add_output_section_data
689 declaration. Add relro_segment_ field.
690 * output.cc (Output_section::Output_section): Initialize is_relro_
691 and is_relro_local_ fields.
692 (Output_segment::add_output_section): Group relro sections.
693 (Output_segment::is_first_section_relro): New function.
694 (Output_segment::maximum_alignment): If there is a relro section,
695 align the segment to the common page size.
696 (Output_segment::set_section_addresses): Track whether we are
697 looking at relro sections. If the last section is a relro
698 section, align to the common page size.
699 (Output_segment::set_section_list_addresses): Add in_relro
700 parameter. Change all callers. Align to the page size when
701 moving from relro to non-relro section.
702 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
704 * output.h (class Output_section): Add is_relro_ and
705 is_relro_local_ fields.
706 (Output_section::is_relro): New function.
707 (Output_section::set_is_relro): New function.
708 (Output_section::is_relro_local): New function.
709 (Output_section::set_is_relro_local): New function.
710 (class Output_segment): Update declarations.
711 * i386.cc (Target_i386::got_section): Mark .got section as relro.
712 * sparc.cc (Target_sparc::got_section): Likewise.
713 * x86_64.cc (Target_x86_64::got_section): Likewise.
714 * testsuite/relro_test_main.cc: New file.
715 * testsuite/relro_test.cc: New file.
716 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
717 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
718 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
719 (relro_test.so, relro_test_pic.o): New targets.
720 * testsuite/Makefile.in: Rebuild.
722 2008-05-16 Ian Lance Taylor <iant@google.com>
724 * output.cc (Output_segment::add_output_section): Remove front
726 * output.h (class Output_segment): Remove
727 add_initial_output_section and overloaded add_output_section.
728 Update declaration of remaining add_output_section.
729 * layout.cc (Layout::create_interp): Call add_output_section
730 rather than add_initial_output_section.
731 (Layout::finish_dynamic_section): Likewise.
733 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
734 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
735 know the dynamic type.
736 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
737 field. Initialize it in constructor.
738 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
739 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
740 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
743 * output.cc (Output_reloc::get_address): Change return type to
745 * output.h (class Output_reloc): Update get_address declaration.
746 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
747 for section addresses.
749 2008-05-09 Ian Lance Taylor <iant@google.com>
752 * gold.cc (gold_nomem): Use return value of write.
754 2008-05-08 Ian Lance Taylor <iant@google.com>
756 * symtab.c (Symbol::init_base_output_data): Add version
757 parameter. Change all callers.
758 (Symbol::init_base_output_segment): Likewise.
759 (Symbol::init_base_constant): Likewise.
760 (Symbol::init_base_undefined): Likewise.
761 (Sized_symbol::init_output_data): Likewise.
762 (Sized_symbol::init_output_segment): Likewise.
763 (Sized_symbol::init_constant): Likewise.
764 (Sized_symbol::init_undefined): Likewise.
765 (Symbol_table::do_define_in_output_data): If the new symbol has a
766 version, mark it as the default.
767 (Symbol_table::do_define_in_output_segment): Likewise.
768 (Symbol_table::do_define_as_constant): Likewise.
769 * symtab.h (class Symbol): Update declarations.
770 (class Sized_symbol): Likewise.
771 * resolve.cc (Symbol::override_version): New function.
772 (Symbol::override_base): Call override_version.
773 (Symbol::override_base_with_special): Likewise.
774 * testsuite/ver_script_8.script: New file.
775 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
776 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
777 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
778 (ver_test_8_1.so, ver_test_8_2.so): New targets.
780 2008-05-06 Ian Lance Taylor <iant@google.com>
783 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
785 (class General_options): Remove existing --undefined, and add
786 --no-undefined instead. Add new --undefined as synonym for -u.
787 * archive.cc (Archive::add_symbols): Check whether symbol was
789 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
790 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
791 all uses. Add IS_UNDEFINED. Update declarations to split
792 different versions of init_base. Declare init_base_undefined.
793 (Symbol::is_defined): Handle IS_UNDEFINED.
794 (Symbol::is_undefined): Likewise.
795 (Symbol::is_weak_undefined): Call is_undefined.
796 (Symbol::is_absolute): Handle IS_CONSTANT.
797 (class Sized_symbol): Update declarations to split different
798 versions of init. Declare init_undefined.
799 (class Symbol_table): Declare new functions.
800 * symtab.cc (Symbol::init_base_object): Rename from init_base.
802 (Symbol::init_base_output_data): Likewise.
803 (Symbol::init_base_output_segment): Likewise.
804 (Symbol::init_base_constant): Likewise.
805 (Symbol::init_base_undefined): New function.
806 (Sized_symbol::init_object): Rename from init. Change all
808 (Sized_symbol::init_output_data): Likewise.
809 (Sized_symbol::init_output_segment): Likewise.
810 (Sized_symbol::init_constant): Likewise.
811 (Sized_symbol::init_undefined): New function.
812 (Symbol_table::add_undefined_symbols_from_command_line): New
814 (Symbol_table::do_add_undefined_symbols_from_command_line): New
816 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
817 (Symbol::output_section): Likewise.
818 (Symbol::set_output_section): Likewise.
819 (Symbol_table::sized_finalize_symbol): Likewise.
820 (Symbol_table::sized_write_globals): Likewise.
821 * resolve.cc (Symbol_table::should_override): Likewise.
822 (Symbol::override_base_with_special): Likewise.
824 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
825 symbol, change it to have default visibility.
826 * testsuite/protected_1.cc: New file.
827 * testsuite/protected_2.cc: New file.
828 * testsuite/protected_3.cc: New file.
829 * testsuite/protected_main_1.cc: New file.
830 * testsuite/protected_main_2.cc: New file.
831 * testsuite/protected_main_3.cc: New file.
832 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
833 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
834 (protected_1_LDFLAGS, protected_1_LDADD): Define.
835 (protected_1.so): New target.
836 (protected_1_pic.o, protected_2_pic.o): New targets.
837 (protected_3_pic.o): New target.
838 (check_PROGRAMS): Add protected_2.
839 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
840 (protected_2_LDFLAGS, protected_2_LDADD): Define.
841 * testsuite/Makefile.in: Rebuild.
843 * options.h (DEFINE_var): Add set_user_set_##varname__.
844 (DEFINE_bool_alias): New macro.
845 (class General_options): Define -Bstatic using DEFINE_bool_alias
846 rather than DEFINE_special. Add --undefined as an alias for -z
848 * options.cc (General_options::parse_Bstatic): Remove.
850 * options.h (class General_options): Add --fatal-warnings.
851 * main.cc (main): Implement --fatal-warnings.
852 * errors.h (Errors::warning_count): New function.
854 * options.h (class General_options): Add -Bsymbolic-functions.
855 * symtab.h (Symbol::is_preemptible): Check for
856 -Bsymbolic-functions.
858 2008-05-05 Ian Lance Taylor <iant@google.com>
860 * options.h (DEFINE_bool): For DASH_Z, create the negative option
861 as noVARNAME rather than no-VARNAME.
862 (class General_options): Add option -z combreloc.
863 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
865 (Output_reloc::sort_before) [SHT_REL]: New function.
866 (Output_reloc::sort_before) [SHT_RELA]: New function.
867 (class Output_data_reloc_base): Add sort_relocs_ field. Define
868 Sort_relocs_comparison.
869 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
870 parameter. Change all callers.
871 (Output_data_reloc::Output_data_reloc) [both versions]: Add
872 sort_relocs parameter. Change all callers.
873 * output.cc (Output_reloc::get_address): New function, broken out
875 (Output_reloc::write_rel): Call it.
876 (Output_reloc::compare): New function.
877 (Output_data_reloc_base::do_write): Optionally sort relocs.
879 * configure.ac: If targ_extra_obj is set, link it in.
880 * configure.tgt: Initialize all variables.
881 (x86_64*): Set targ_extra_obj and targ_extra_size.
882 * configure: Rebuild.
884 * object.cc (Sized_relobj::include_section_group): Adjust section
885 indexes read from group data. Build vector to pass to
887 * layout.cc (Layout::layout_group): Add flags and shndxes
888 parameters. Remove contents parameter. Change caller. Update
889 explicit instantiations.
890 * layout.h (class Layout): Update layout_group declaration.
891 * output.cc (Output_data_group::Output_data_group): Add flags and
892 input_shndxes parameters. Remove contents parameter. Change
894 (Output_data_group::do_write): Change input_sections_ to
896 * output.h (class Output_data_group): Update constructor
897 declaration. Rename input_sections_ to input_shndxes_.
898 * testsuite/many_sections_test.cc: Add template.
900 2008-04-30 Cary Coutant <ccoutant@google.com>
902 * target-reloc.h (relocate_section): Fix dead-pointer bug.
904 * layout.cc (Layout::include_section): Refactored check for debug
906 (Layout::add_comdat): Add new parameters. Change type
907 of signature parameter. Add object and shndx to signatures table.
908 (Layout::find_kept_object): New function.
909 * layout.h: Include <cstring>.
910 (Layout::is_debug_info_section): New function.
911 (Layout::add_comdat): Add new parameters.
912 (Layout::find_kept_object): New function.
913 (Layout::Kept_section): New struct.
914 (Layout::Signatures): Change type of map range.
915 * object.cc (Relobj::output_section_address): New function.
916 (Sized_relobj::include_section_group): Add new parameters. Change
917 calls to Layout::add_comdat. Change to build table of kept comdat
918 groups and table mapping discarded sections to kept sections.
919 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
920 (Sized_relobj::do_layout): Change calls to include_section_group and
921 include_linkonce_section.
922 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
923 value to zero when section is discarded.
924 (Sized_relobj::map_to_kept_section): New function.
925 * object.h (Relobj::output_section_address): New function.
926 (Relobj::Comdat_group): New type.
927 (Relobj::find_comdat_group): New function.
928 (Relobj::Comdat_group_table): New type.
929 (Relobj::Kept_comdat_section): New type.
930 (Relobj::Kept_comdat_section_table): New type.
931 (Relobj::add_comdat_group): New function.
932 (Relobj::set_kept_comdat_section): New function.
933 (Relobj::get_kept_comdat_section): New function.
934 (Relobj::comdat_groups_): New field.
935 (Relobj::kept_comdat_sections_): New field.
936 (Symbol_value::input_value): Update comment.
937 (Sized_relobj::map_to_kept_section) New function.
938 (Sized_relobj::include_linkonce_section): Add new parameter.
939 * target-reloc.h (Comdat_behavior): New type.
940 (get_comdat_behavior): New function.
941 (relocate_section): Add code to map a discarded section to the
942 corresponding kept section when applying a relocation.
944 2008-04-30 Craig Silverstein <csilvers@google.com>
946 * dwarf_reader.cc (next_generation_count): New static var.
947 (Addr2line_cache_entry): New struct.
948 (addr2line_cache): New static var.
949 (Dwarf_line_info::one_addr2line): Added caching.
950 (Dwarf_line_info::clear_addr2line_cache): New function.
951 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
952 cache-size parameter.
953 (Dwarf_line_info::one_addr2line_cache): New function.
954 * symtab.cc (Symbol_table::detect_odr_violations): Pass
955 new cache-size argument to one_addr2line(), and clear cache.
957 2008-04-28 Cary Coutant <ccoutant@google.com>
959 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
960 R_386_PC8 relocations.
962 2008-04-23 Ian Lance Taylor <iant@google.com>
964 * object.cc (Sized_relobj::include_section_group): Check for
965 invalid section group.
967 * object.cc (make_elf_object): Correct test for 64-bit ELF file
970 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
971 than read for file header.
972 * archive.cc (Archive::include_member): Likewise.
974 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
976 * aclocal.m4: Regenerate.
977 * configure: Regenerate.
979 2008-04-19 Ian Lance Taylor <iant@google.com>
981 * version.cc (version_string): Bump to 1.6.
983 * testsuite/Makefile.am (many_sections_r_test): New target.
984 (many_sections_r_test_SOURCES): Remove.
985 (many_sections_r_test_DEPENDENCIES): Remove.
986 (many_sections_r_test_LDFLAGS): Remove.
987 (many_sections_r_test_LDADD): Remove.
989 * object.cc (Sized_relobj::do_add_symbols): Always pass
990 local_symbol_count_ to add_from_relobj.
992 * testsuite/Makefile.am (many_sections_check.h): Only check one in
993 every thousand variables.
994 * testsuite/Makefile.in: Rebuild.
996 * object.cc (Xindex::initialize_symtab_xindex): New function.
997 (Xindex::read_symtab_xindex): New function.
998 (Xindex::sym_xindex_to_shndx): New function.
999 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
1001 (Sized_relobj::do_initialize_xindex): New function.
1002 (Sized_relobj::do_read_symbols): Adjust section links.
1003 (Sized_relobj::symbol_section_and_value): Add is_ordinary
1004 parameter. Change all callers.
1005 (Sized_relobj::include_section_group): Adjust section links and
1006 symbol section indexes.
1007 (Sized_relobj::do_layout): Adjust section links.
1008 (Sized_relobj::do_count_local_symbols): Adjust section links and
1009 symbol section indexes.
1010 (Sized_relobj::do_finalize_local_symbols): Distinguish between
1011 ordinary and special symbols.
1012 (Sized_relobj::write_local_symbols): Add symtab_xindex and
1013 dynsym_xindex parameters. Change all callers. Adjust section
1014 links. Use SHN_XINDEX when needed.
1015 (Sized_relobj::get_symbol_location_info): Adjust section links.
1016 Don't get fooled by special symbols.
1017 * object.h (class Xindex): Define.
1018 (class Object): Add xindex_ parameter. Declare virtual functoin
1019 do_initialize_xindex.
1020 (Object::adjust_sym_shndx): New function.
1021 (Object::set_xindex): New protected function.
1022 (class Symbol_value): Add is_ordinary_shndx_ field.
1023 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
1024 (Symbol_value::value): Assert ordinary section.
1025 (Symbol_value::initialize_input_to_output_map): Likewise.
1026 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
1028 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
1030 (class Sized_relobj): Update declarations.
1031 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
1032 parameter. Change all callers.
1033 (Sized_relobj::adjust_shndx): New function.
1034 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
1036 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
1037 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
1038 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
1039 (Sized_dynobj::read_dynsym_section): Adjust section links.
1040 (Sized_dynobj::read_dynamic): Likewise.
1041 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
1043 (Sized_dynobj::do_initialize_xindex): New function.
1044 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
1045 do_initialize_xindex.
1046 (Sized_dynobj::adjust_shndx): New function.
1047 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
1048 dynsym_xindex_ fields.
1049 (Layout::finalize): Add a call to set_section_indexes before
1050 creating the symtab sections.
1051 (Layout::set_section_indexes): Don't do anything if the section
1052 already has a section index.
1053 (Layout::create_symtab_sections): Add shnum parameter. Change
1054 caller. Create .symtab_shndx section if needed.
1055 (Layout::create_shdrs): Add shstrtab_section parameter. Change
1057 (Layout::allocated_output_section_count): New function.
1058 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
1060 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
1061 fields. Update declarations.
1062 (Layout::symtab_xindex): New function.
1063 (Layout::dynsym_xindex): New function.
1064 (class Write_symbols_task): Add layout_ field.
1065 (Write_symbols_task::Write_symbols_task): Add layout parameter.
1067 * output.cc (Output_section_headers::Output_section_headers): Add
1068 shstrtab_section parameter. Change all callers.
1069 (Output_section_headers::do_sized_write): Store overflow values
1070 for section count and section string table section index in
1071 section header zero.
1072 (Output_file_header::do_sized_write): Check for overflow of
1073 section count and section string table section index.
1074 (Output_symtab_xindex::do_write): New function.
1075 (Output_symtab_xindex::endian_do_write): New function.
1076 * output.h (class Output_section_headers): Add shstrtab_section_.
1077 Update declarations.
1078 (class Output_symtab_xindex): Define.
1079 (Output_section::has_out_shndx): New function.
1080 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
1082 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
1084 (Sized_symbol::init): Likewise.
1085 (Symbol::output_section): Check for ordinary symbol.
1086 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
1087 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
1089 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
1090 Change all callers. Simplify handling of symbols from sections
1091 not included in the link.
1092 (Symbol_table::add_from_dynobj): Handle ordinary symbol
1094 (Weak_alias_sorter::operator()): Assert that symbols are
1096 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
1098 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
1099 parameters. Change all callers.
1100 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
1101 symbol distinction. Use SHN_XINDEX when needed.
1102 (Symbol_table::write_section_symbol): Add symtab_xindex
1103 parameter. Change all callers.
1104 (Symbol_table::sized_write_section_symbol): Likewise. Use
1105 SHN_XINDEX when needed.
1106 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
1108 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
1109 (Symbol::is_defined): Check is_ordinary.
1110 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
1111 (Symbol::is_absolute, Symbol::is_common): Likewise.
1112 (class Sized_symbol): Update declarations.
1113 (class Symbol_table): Update declarations.
1114 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
1115 parameters. Change all callers.
1116 (Sized_symbol::override): Likewise.
1117 (Symbol_table::override): Likewise.
1118 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
1119 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
1120 is_ordinary, and orig_st_shndx parameters. Change all callers.
1121 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
1122 to be in an ordinary section.
1123 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
1124 object and is_ordinary parameters. Change all callers.
1125 (Sized_dwarf_line_info::read_relocs): Add object parameter.
1126 Change all callers. Don't add undefined or non-ordinary symbols
1128 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
1130 * dwarf_reader.h (class Sized_dwarf_line_info): Update
1132 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
1133 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
1134 (Sized_relobj::relocate_sections): Likewise.
1135 * target-reloc.h (scan_relocs): Adjust section symbol index.
1136 (scan_relocatable_relocs): Likewise.
1137 * i386.cc (Scan::local): Check for ordinary symbols.
1138 * sparc.cc (Scan::local): Likewise.
1139 * x86_64.cc (Scan::local): Likewise.
1140 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
1141 to symbol_section_and_value.
1142 * testsuite/many_sections_test.cc: New file.
1143 * testsuite/Makefile.am (BUILT_SOURCES): Define.
1144 (check_PROGRAMS): Add many_sections_test.
1145 (many_sections_test_SOURCES): Define.
1146 (many_sections_test_DEPENDENCIES): Define.
1147 (many_sections_test_LDFLAGS): Define.
1148 (BUILT_SOURCES): Add many_sections_define.h.
1149 (many_sections_define.h): New target.
1150 (BUILT_SOURCES): Add many_sections_check.h.
1151 (many_sections_check.h): New target.
1152 (check_PROGRAMS): Add many_sections_r_test.
1153 (many_sections_r_test_SOURCES): Define.
1154 (many_sections_r_test_DEPENDENCIES): Define.
1155 (many_sections_r_test_LDFLAGS): Define.
1156 (many_sections_r_test_LDADD): Define.
1157 (many_sections_r_test.o): New target.
1158 * testsuite/Makefile.in: Rebuild.
1160 2008-04-17 Cary Coutant <ccoutant@google.com>
1162 * errors.cc (Errors::info): New function.
1163 (gold_info): New function.
1164 * errors.h (Errors::info): New function.
1165 * gold.h (gold_info): New function.
1166 * object.cc (Input_objects::add_object): Print trace output.
1167 * options.cc (options::parse_set): New function.
1168 (General_options::parse_wrap): Deleted.
1169 (General_options::General_options): Deleted initializer.
1170 * options.h (options::String_set): New typedef.
1171 (options::parse_set): New function.
1172 (DEFINE_set): New macro.
1173 (General_options::wrap): Changed to use DEFINE_set. Changed
1174 callers of any_wrap_symbols and is_wrap_symbol.
1175 (General_options::trace, General_options::trace_symbol):
1177 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
1178 (General_options::wrap_symbols_): Deleted.
1179 * symtab.cc (Symbol_table::add_from_object): Print trace output.
1181 2008-04-17 David S. Miller <davem@davemloft.net>
1183 * options.cc (General_options::parse_V): New function.
1184 * options.h: Add entries for -V and -Qy.
1186 2008-04-17 Ian Lance Taylor <iant@google.com>
1188 * common.cc (Symbol_table::allocate_commons): Remove options
1189 parameter. Change caller.
1190 (Symbol_table::do_allocate_commons): Remove options parameter.
1191 Change caller. Just call do_allocate_commons_list twice.
1192 (Symbol_table::do_allocate_commons_list): New function, broken out
1193 of do_allocate_commons.
1194 * common.h (class Allocate_commons_task): Remove options_ field.
1196 * symtab.cc (Symbol_table::Symbol_table): Initialize
1198 (Symbol_table::add_from_object): Put TLS common symbols on
1200 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
1201 which are IN_OUTPUT_DATA.
1202 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
1203 allocate_commons and do_allocate_commons declarations. Declare
1204 do_allocate_commons_list.
1205 * gold.cc (queue_middle_tasks): Update creation of
1206 Allocate_commons_task to not pass options.
1207 * testsuite/Makefile.am (INCLUDES): Add -I.. .
1208 (TLS_TEST_C_FLAGS): New variable.
1209 (tls_test_c_pic.o): New target.
1210 (tls_test_shared.so): Link in tls_test_c_pic.o.
1211 (tls_test_c_pic_ie.o): New target.
1212 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
1213 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
1214 (tls_test_c.o): New target.
1215 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
1216 (tls_pic_test_LDADD): Likewise.
1217 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
1218 (tls_shared_gd_to_ie_test_LDADD): Likewise.
1219 (tls_test_c_gnu2.o): New target.
1220 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
1222 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
1223 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
1224 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
1225 * testsuite/tls_test.cc: Include "config.h".
1226 (t_last): Call t11_last.
1227 * testsuite/tls_test.h (t11, t11_last): Declare.
1228 * testsuite/tls_test_c.c: New file.
1229 * testsuite/tls_test_main.cc (thread_routine): Call t11.
1230 * configure.ac: Check for OpenMP support.
1231 * configure, config.in, Makefile.in: Rebuild.
1232 * testsuite/Makefile.in: Rebuild.
1234 2008-04-16 Cary Coutant <ccoutant@google.com>
1236 * i386.cc (Target_i386::define_tls_base_symbol): New function.
1237 (Target_i386::tls_base_symbol_defined_): New field.
1238 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
1239 (Target_i386::Scan::global): Likewise.
1240 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
1241 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
1242 (Target_x86_64::tls_base_symbol_defined_): New field.
1243 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
1244 (Target_x86_64::Scan::global): Likewise.
1246 2008-04-16 Cary Coutant <ccoutant@google.com>
1248 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
1249 (Symbol::needs_plt_entry): Allow weak undefined symbols.
1250 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
1251 building shared libraries.
1252 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
1253 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
1254 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
1255 * testsuite/Makefile.in: Rebuild.
1256 * testsuite/weak_undef.h: New file.
1257 * testsuite/weak_undef_file1.cc: Add extra test cases.
1258 * testsuite/weak_undef_file2.cc: Likewise.
1259 * testsuite/weak_undef_test.cc: Likewise.
1261 2008-04-16 David S. Miller <davem@davemloft.net>
1263 * sparc.cc (Target_sparc::Scan): Change from struct to class.
1264 Add issued_non_pic_error_ field. Declare check_non_pic.
1265 (Target_sparc::Scan::check_non_pic): New function.
1266 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
1267 (Target_sparc::Scan::global): Likewise.
1269 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
1270 * configure: Rebuild.
1272 * options.h (DEFINE_enable): New macro.
1273 (new_dtags): New enable option.
1274 (initfirst, interpose, loadfltr, nodefaultlib,
1275 nodelete, nodlopen, nodump): New -z options.
1276 * layout.cc (Layout:finish_dynamic_section): If new
1277 dtags enabled, emit DT_RUNPATH. Also, emit a
1278 DT_FLAGS_1 containing any specified -z flags.
1280 2008-04-16 Ian Lance Taylor <iant@google.com>
1282 * copy-relocs.cc: New file.
1283 * copy-relocs.h: New file.
1284 * reloc.cc: Remove Copy_relocs code.
1285 * reloc.h: Likewise.
1286 * reloc-types.h (struct Reloc_types) [both versions]: Add
1287 get_reloc_addend_noerror.
1288 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
1289 variants of add_global which take an addend which must be zero.
1290 * i386.cc: Include "copy-relocs.h".
1291 (class Target_i386): Change type of copy_relocs_ to variable,
1293 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
1295 (Target_i386::do_finalize_sections): Change handling of
1297 * sparc.cc: Include "copy-relocs.h".
1298 (class Target_sparc): Change type of copy_relocs_ to variable,
1300 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
1302 (Target_sparc::do_finalize_sections): Change handling of
1304 * x86_64.cc: Include "copy-relocs.h".
1305 (class Target_x86_64): Change type of copy_relocs_ to variable,
1307 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
1308 class. Change all callers.
1309 (Target_x86_64::do_finalize_sections): Change handling of
1311 * Makefile.am (CCFILES): Add copy-relocs.cc.
1312 (HFILES): Add copy-relocs.h.
1314 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
1316 * testsuite/script_test_4.sh: Permit leading zeroes.
1318 2008-04-15 Ian Lance Taylor <iant@google.com>
1320 * script-sections.cc (Script_sections::create_segments): Use
1321 header_size_adjustment even when there is enough room for the
1323 * testsuite/script_test_4.sh: New file.
1324 * testsuite/script_test_4.t: New file.
1325 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
1326 (check_DATA): Add script_test_4.stdout.
1327 (MOSTLYCLEANFILES): Likewise.
1328 (script_test_4): New target.
1329 (script_test_4.stdout): New target.
1330 * testsuite/Makefile.in: Rebuild.
1332 * sparc.cc: Add definitions for Output_data_plt_sparc class
1335 2008-04-14 David S. Miller <davem@davemloft.net>
1337 * sparc.cc: New file.
1338 * Makefile.am (TARGETSOURCES): Add sparc.cc
1339 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
1340 * configure.tgt: Document targ_extra_size and
1341 targ_extra_big_endian. Add entries for sparc-* and
1343 * configure.ac: Handle targ_extra_size and
1344 targ_extra_big_endian.
1345 * Makefile.in: Rebuild.
1346 * configure: Likewise.
1347 * po/POTFILES.in: Likewise.
1348 * po/gold.pot: Likewise.
1350 2008-04-14 Ian Lance Taylor <iant@google.com>
1352 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
1353 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
1354 in the name/type/flags to section mapping. Don't call
1355 allocate_output_section.
1356 (Layout::choose_output_section): Change parameter from adjust_name
1357 to is_input_section. Don't permit input sections after sections
1358 are attached to segments. Don't call allocate_output_section.
1359 (Layout::layout_eh_frame): Call update_flags_for_input_section,
1360 not write_enable_output_section.
1361 (Layout::make_output_section): Don't push to
1362 unattached_section_list_ nor call attach_to_segment. Call
1363 attach_section_to_segment if sections are attached.
1364 (Layout::attach_sections_to_segments): New function.
1365 (Layout::attach_section_to_segment): New function.
1366 (Layout::attach_allocated_section_to_segment): Rename from
1367 attach_to_segment. Remove flags parameter.
1368 (Layout::allocate_output_section): Remove function.
1369 (Layout::write_enable_output_section): Remove function.
1370 * layout.h (class Layout): Update for above changes. Add new
1371 field sections_are_attached_.
1372 * output.h (Output_section::update_flags_for_input_section): New
1374 * output.cc (Output_section::add_input_section): Call
1375 update_flags_for_input_section.
1376 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
1378 2008-04-11 Cary Coutant <ccoutant@google.com>
1380 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
1381 thought unnecessary.
1382 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
1384 2008-04-11 Ian Lance Taylor <iant@google.com>
1386 * output.h (class Output_section_data): Remove inline definition
1388 * output.cc (Output_section_data::set_addralign): New function.
1390 2008-04-11 Cary Coutant <ccoutant@google.com>
1392 Add support for TLS descriptors for i386 and x86_64.
1393 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
1394 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
1395 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
1397 (Target_i386::got_mod_index_entry): Remove unnecessary code.
1398 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
1399 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
1401 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
1402 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
1403 Fix problem with initial-exec relocations.
1404 (Target_i386::Relocate::relocate_tls): Likewise.
1405 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
1407 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
1408 support for section-plus-offset dynamic table entries.
1409 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
1410 (Output_data_dynamic::Dynamic_entry): Add support for
1411 section-plus-offset dynamic table entries.
1412 (Output_data_dynamic::Classification): Likewise.
1413 (Output_data_dynamic::classification_): Renamed offset_.
1414 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
1415 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
1416 (Target_x86_64::make_plt_section): New function.
1417 (Target_x86_64::reserve_tlsdesc_entries): New function.
1418 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
1419 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
1420 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
1421 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
1422 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
1423 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
1424 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
1425 add extra PLT entry for TLS descriptors.
1426 (Output_data_plt_x86_64::got_): New field.
1427 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
1428 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
1430 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
1432 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
1433 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
1434 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
1435 R_386_TLS_DESC_CALL relocations.
1436 (Target_x86_64::Scan::global): Likewise.
1437 (Target_x86_64::do_finalize_sections): Add dynamic table entries
1438 for TLS descriptors.
1439 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
1440 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
1441 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
1442 GD-to-IE relaxation.
1443 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
1444 and TLS_DESCRIPTORS.
1445 * Makefile.in: Rebuild.
1446 * configure: Rebuild.
1447 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
1448 (tls_test_shared2.so): New target.
1449 (tls_shared_gd_to_ie_test_SOURCES): New variable.
1450 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
1451 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
1452 (tls_shared_gd_to_ie_test_LDADD): New variable.
1453 (tls_shared_gnu2_gd_to_ie_test): New target.
1454 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
1456 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
1457 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
1458 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
1459 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
1460 (tls_shared_gnu2_test): New target.
1461 (tls_test_gnu2_shared.so): New target.
1462 (tls_shared_gnu2_test_SOURCES): New variable.
1463 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
1464 (tls_shared_gnu2_test_LDFLAGS): New variable.
1465 (tls_shared_gnu2_test_LDADD): New variable.
1466 * testsuite/Makefile.in: Rebuild.
1467 * testsuite/Makefile.
1469 2008-04-11 Ian Lance Taylor <iant@google.com>
1471 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
1473 * testsuite/Makefile.in: Rebuild.
1475 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
1477 * testsuite/script_test_2.cc (main): Adjust test.
1479 2008-04-11 David S. Miller <davem@davemloft.net>
1480 Ian Lance Taylor <iant@google.com>
1482 * options.h (General_options): Add entries for '-Y' and
1484 * options.cc (General_options:finalize): If -Y was used, add those
1485 entries to the library path instead of the default "/lib" and
1488 2008-04-11 David S. Miller <davem@davemloft.net>
1490 * testsuite/justsyms.t: Start at 0x100.
1491 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
1492 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
1494 * testsuite/script_test_2.cc: Adjust string and section length
1497 2008-04-09 Ian Lance Taylor <iant@google.com>
1500 * script-sections.cc (Sections_element::allocate_to_segment): Add
1502 (Output_section_definition::allocate_to_segment): Likewise.
1503 (Orphan_output_section::allocate_to_segment): Likewise.
1504 (Script_sections::attach_sections_using_phdrs_clause): Don't
1505 propagate non-PT_LOAD segments to orphan sections.
1506 * testsuite/Makefile.am (script_test_3.stdout): Generate using
1507 readelf rather than objdump.
1508 * testsuite/script_test_3.sh: Adjust accordingly. Test that
1509 .interp section and PT_INTERP segment are the same size.
1510 * testsuite/Makefile.in: Rebuild.
1512 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
1513 aliases for symbols defined in the same object.
1514 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
1515 (weak_alias_test_SOURCES): New variable.
1516 (weak_alias_test_DEPENDENCIES): New variable.
1517 (weak_alias_test_LDFLAGS): New variable.
1518 (weak_alias_test_LDADD): New variable.
1519 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
1520 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
1521 (weak_alias_test_3.o): New target.
1522 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
1523 * testsuite/weak_alias_test_main.cc: New file.
1524 * testsuite/weak_alias_test_1.cc: New file.
1525 * testsuite/weak_alias_test_2.cc: New file.
1526 * testsuite/weak_alias_test_3.cc: New file.
1528 2008-04-08 Ian Lance Taylor <iant@google.com>
1530 * options.h (class General_options): Add --noinhibit-exec option.
1531 * main.cc (main): Check --noinhibit-exec.
1533 * options.h (class General_options): Define --wrap as a special
1534 option. Add wrap_symbols_ field.
1535 (General_options::any_wrap_symbols): New function.
1536 (General_options::is_wrap_symbol): New function.
1537 * options.cc (General_options::parse_wrap): New function.
1538 (General_options::General_options): Initialize wrap_symbols_.
1539 * symtab.cc (Symbol_table::wrap_symbol): New function.
1540 (Symbol_table::add_from_object): Handle --wrap.
1541 * symtab.h (class Symbol_table): Declare wrap_symbol.
1542 * target.h (Target::wrap_char): New function.
1543 (Target::Target_info): Add wrap_char field.
1544 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
1545 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1546 * testsuite/testfile.cc (Target_test::test_target_info):
1549 * errors.cc (Errors::undefined_symbol): Mention symbol version if
1552 * layout.h (class Layout): Add added_eh_frame_data_ field.
1553 * layout.cc (Layout::Layout): Initialize new field.
1554 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
1555 output section until we find a section we merged successfully.
1556 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
1557 that the size be non-zero.
1559 * merge.cc (Object_merge_map::get_output_offset): Remove inline
1562 2008-04-08 Craig Silverstein <csilvers@google.com>
1564 * configure.ac: Export new conditional variable HAVE_ZLIB.
1565 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
1567 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
1568 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
1570 2008-04-07 Ian Lance Taylor <iant@google.com>
1572 * version.cc (version_string): Set to "1.5".
1574 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
1575 Add issued_non_pic_error_ field. Declare check_non_pic.
1576 (Target_x86_64::Scan::check_non_pic): New function.
1577 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
1578 (Target_x86_64::Scan::global): Likewise.
1580 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
1581 addend parameter. Change caller. Handle merge sections.
1582 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
1583 Address to Addend. Don't add in the result of
1584 local_section_offset, pass down the addend and use the returned
1586 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
1587 Update declarations of local_section_offset and symbol_value.
1588 * testsuite/two_file_test_1.cc (t18): New function.
1589 * testsuite/two_file_test_2.cc (f18): New function.
1590 * testsuite/two_file_test_main.cc (main): Call t18.
1591 * testsuite/two_file_test.h (t18, f18): Declare.
1593 * configure.ac: Don't test for objdump, c++filt, or readelf.
1594 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
1596 (TEST_READELF): New variable.
1597 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
1598 (check_PROGRAMS): Add two_file_strip_test.
1599 (two_file_strip_test): New target.
1600 (check_PROGRAMS): Add two_file_same_shared_strip_test.
1601 (two_file_same_shared_strip_test_SOURCES): New variable.
1602 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
1603 (two_file_same_shared_strip_test_LDFLAGS): New variable.
1604 (two_file_same_shared_strip_test_LDADD): New variable.
1605 (two_file_shared_strip.so): New target.
1606 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
1607 (ver_test_5.syms, ver_test_7.syms): Likewise.
1608 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
1609 (strip_test_3.stdout): Use TEST_OBJDUMP.
1610 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
1612 2008-04-04 Cary Coutant <ccoutant@google.com>
1614 * symtab.h (Symbol::is_weak_undefined): New function.
1615 (Symbol::is_strong_undefined): New function.
1616 (Symbol::is_absolute): New function.
1617 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
1618 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
1620 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
1621 (weak_undef_test): New target.
1622 * testsuite/Makefile.in: Rebuild.
1623 * testsuite/weak_undef_file1.cc: New file.
1624 * testsuite/weak_undef_file2.cc: New file.
1625 * testsuite/weak_undef_test.cc: New file.
1627 2008-04-03 Craig Silverstein <csilvers@google.com>
1629 * compressed_output.h (class Output_compressed_section): Use
1631 * compressed_output.cc (zlib_compress): Use unsigned buffers,
1633 (zlib_compressed_suffix): Removed.
1634 (Output_compressed_section::set_final_data_size): Use unsigned
1636 * testsuite/Makefile.am (flagstest_compress_debug_sections):
1637 Fix linker invocation.
1638 (flagstest_o_specialfile_and_compress_debug_sections):
1640 * testsuite/Makefile.in: Regenerated.
1642 2008-04-02 David S. Miller <davem@davemloft.net>
1644 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
1645 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
1647 2008-04-02 Craig Silverstein <csilvers@google.com>
1651 2008-04-02 Ian Lance Taylor <iant@google.com>
1653 * fileread.cc (File_read::find_view): Add byteshift and vshifted
1654 parameters. Update for new key type to views_. Change all
1656 (File_read::read): Adjust for byteshift in returned view.
1657 (File_read::add_view): New function, broken out of
1659 (File_read::make_view): New function, broken out of
1661 (File_read::find_or_make_view): Add offset and aligned
1662 parameters. Rewrite accordingly. Change all callers.
1663 (File_read::get_view): Add offset and aligned parameters. Adjust
1664 for byteshift in return value.
1665 (File_read::get_lasting_view): Likewise.
1666 * fileread.h (class File_read): Update declarations.
1667 (class File_read::View): Add byteshift_ field. Add byteshift to
1668 constructor. Add byteshift method.
1669 * archive.h (Archive::clear_uncached_views): New function.
1670 (Archive::get_view): Add aligned parameter. Change all callers.
1671 * object.h (Object::get_view): Add aligned parameter. Change all
1673 (Object::get_lasting_view): Likewise.
1675 * fileread.cc (File_read::release): Don't call clear_views if
1676 there are multiple objects.
1677 * fileread.h (File_read::clear_uncached_views): New function.
1678 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
1681 2008-03-31 Cary Coutant <ccoutant@google.com>
1683 Add thin archive support.
1684 * archive.cc (Archive::armagt): New const.
1685 (Archive::setup): Remove task parameter and calls to unlock.
1686 (Archive::unlock_nested_archives): New function.
1687 (Archive::read_header): Add nested_off parameter. Change
1689 (Archive::interpret_header): Likewise.
1690 (Archive::include_all_members): Change to handle thin
1692 (Archive::include_member): Likewise.
1693 * archive.h (Archive::Archive): Add new parameters and
1695 (Archive::armagt): New const.
1696 (Archive::setup): Remove task parameter.
1697 (Archive::unlock_nested_archives): New function.
1698 (Archive::read_header): Add nested_off parameter.
1699 (Archive::interpret_header): Likewise.
1700 (Archive::Nested_archive_table): New typedef.
1701 (Archive::is_thin_archive_): New field.
1702 (Archive::nested_archives_): New field.
1703 (Archive::options_): New field.
1704 (Archive::dirpath_): New field.
1705 (Archive::task_): New field.
1706 * readsyms.cc (Read_symbols::do_read_symbols): Add check
1707 for thin archives. Pass additional parameters to
1708 Archive::Archive. Unlock the archive file after calling
1711 2008-03-29 Ian Lance Taylor <iant@google.com>
1713 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
1714 version symbol to be local.
1715 * testsuite/ver_test_4.sh: New file.
1716 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
1717 (check_DATA): Add ver_test_4.syms.
1718 (ver_test_4.syms): New target.
1719 * testsuite/Makefile.in: Rebuild.
1722 (Output_section::Input_section_sort_entry::has_priority): New
1724 (Output_section::Input_section_sort_entry::match_file_name): New
1726 (Output_section::Input_section_sort_entry::match_section_name):
1728 (Output_section::Input_section_sort_entry::match_section_name_prefix):
1730 (Output_section::Input_section_sort_entry::match_section_file):
1732 (Output_section::Input_section_sort_compare::operator()): Rewrite
1733 using new Input_section_sort_entry functions. Sort crtbegin and
1734 crtend first. Sort sections with no priority before sections with
1736 * testsuite/initpri1.c (d3): Check j != 4.
1737 (cd5): New constructor/destructor function.
1738 (main): Check j != 2.
1740 * symtab.cc (Symbol_table::add_from_object): If we don't use the
1741 new symbol when resolving, don't call set_is_default.
1742 * testsuite/ver_test_7.cc: New file.
1743 * testsuite/ver_test_7.sh: New file.
1744 * testsuite/Makefile.am (ver_test_7.so): New target.
1745 (ver_test_7.o): New target.
1746 (check_SCRIPTS): Add ver_test_7.sh.
1747 (check_DATA): Add ver_test_7.syms.
1748 (ver_test_7.syms): New target.
1750 2008-03-28 Ian Lance Taylor <iant@google.com>
1752 * layout.cc (Layout::layout): If we see an input section with a
1753 name that needs sorting, set the must_sort flag for the output
1755 (Layout::make_output_section): If the name of the output section
1756 indicates that it might require sorting, set the may_sort flag.
1757 * output.h (Output_section::may_sort_attached_input_sections): New
1759 (Output_section::set_may_sort_attached_input_sections): New
1761 (Output_section::must_sort_attached_input_sections): New
1763 (Output_section::set_must_sort_attached_input_sections): New
1765 (class Output_section): Declare Input_section_sort_entry. Define
1766 Input_section_sort_compare. Declare
1767 sort_attached_input_sections. Add new fields:
1768 may_sort_attached_input_sections_,
1769 must_sort_attached_input_sections_,
1770 attached_input_sections_are_sorted_.
1771 * output.cc (Output_section::Output_section): Initialize new
1773 (Output_section::add_input_section): Add an entry to
1774 input_sections_ if may_sort or must_sort are true.
1775 (Output_section::set_final_data_size): Call
1776 sort_attached_input_sections if necessary.
1777 (Output_section::Input_section_sort_entry): Define new class.
1778 (Output_section::Input_section_sort_compare::operator()): New
1780 (Output_section::sort_attached_input_sections): New function.
1781 * configure.ac: Check whether the compiler supports constructor
1782 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
1783 * testsuite/initpri1.c: New file.
1784 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
1785 CONSTRUCTOR_PRIORITY.
1786 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
1787 (initpri1_LDFLAGS): New variable.
1788 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
1790 2008-03-27 Ian Lance Taylor <iant@google.com>
1792 * common.cc (Sort_commons::operator): Correct sorting algorithm.
1793 * testsuite/common_test_1.c: New file.
1794 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
1795 (common_test_1_SOURCES): New variable.
1796 (common_test_1_DEPENDENCIES): New variable.
1797 (common_test_1_LDFLAGS): New variable.
1799 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
1800 and commons_ correctly when NAME/VERSION does not override
1802 * testsuite/ver_test_6.c: New file.
1803 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
1804 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
1805 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
1807 2008-03-26 Ian Lance Taylor <iant@google.com>
1809 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
1810 of an undefined symbol from a version script.
1811 * testsuite/Makefile.am (ver_test_5.so): New target.
1812 (ver_test_5.o): New target.
1813 (check_SCRIPTS): Add ver_test_5.sh.
1814 (check_DATA): Add ver_test_5.syms.
1815 (ver_test_5.syms): New target.
1816 * testsuite/ver_test_5.cc: New file.
1817 * testsuite/ver_test_5.script: New file.
1818 * testsuite/ver_test_5.sh: New file.
1819 * Makefile.in, testsuite/Makefile.in: Rebuild.
1822 Fix problems building gold with gcc 4.3.0.
1823 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
1824 (gold_error_at_location, gold_warning_at_location): Use it.
1825 * configure.ac: Check whether we can compile and use a template
1826 function with a printf attribute.
1827 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
1828 when jumping over bytes.
1829 * object.cc: Instantiate Object::read_section_data.
1830 * debug.h: Include <cstring>
1831 * dwarf_reader.cc: Include <algorithm>
1832 * main.cc: Include <cstring>.
1833 * options.cc: Include <cstring>.
1834 * output.cc: Include <cstring>.
1835 * script.cc: Include <cstring>.
1836 * script.h: Include <string>.
1837 * symtab.cc: Include <cstring> and <algorithm>.
1838 * target-select.cc: Include <cstring>.
1839 * version.cc: Include <string>.
1840 * testsuite/testmain.cc: Include <cstdlib>.
1841 * configure, config.in: Rebuild.
1843 2008-03-25 Ian Lance Taylor <iant@google.com>
1845 * options.cc: Include "../bfd/bfdver.h".
1846 (options::help): Print bug reporting address.
1848 * version.cc (print_version): Adjust output for current value of
1853 * options.cc (options::help): Print list of supported targets.
1854 * target-select.h: Include <vector>.
1855 (class Target_selector): Make machine_, size_, and is_big_endian_
1856 fields const. Add bfd_name_ and instantiated_target_ fields.
1857 (Target_selector::Target_selector): Add bfd_name parameter.
1858 (Target_selector::recognize): Make non-virtual, call
1860 (Target_selector::recognize_by_name): Make non-virtual, call
1861 do_recognize_by_name.
1862 (Target_selector::supported_names): New function.
1863 (Target_selector::bfd_name): New function.
1864 (Target_selector::do_instantiate_target): New pure virtual
1866 (Target_selector::do_recognize): New virtual function.
1867 (Target_selector::do_recognize_by_name): New virtual function.
1868 (Target_selector::instantiate_target): New private function.
1869 (supported_target_names): Declare.
1870 * target-select.cc (Target_selector::Target_selector): Update for
1871 new parameter and fields.
1872 (select_target_by_name): Check that the name matches before
1873 calling recognize_by_name.
1874 (supported_target_names): New function.
1875 * i386.cc (class Target_selector_i386): Update Target_selector
1876 constructor call. Remove recognize and recognize_by_name. Add
1877 do_instantiate_target.
1878 * x86_64.cc (class Target_selector_x86_64): Likewise.
1879 * testsuite/testfile.cc (class Target_selector_test): Update for
1880 changes to Target_selector.
1882 * README: Rewrite, with some notes on unsupported features.
1884 2008-03-24 Cary Coutant <ccoutant@google.com>
1886 * i386.cc (Target_i386::Got_type): New enum declaration.
1887 (Target_i386::Scan::local): Updated callers of Output_data_got
1889 (Target_i386::Scan::global): Likewise.
1890 (Target_i386::Relocate::relocate): Likewise.
1891 (Target_i386::Relocate::relocate_tls): Likewise.
1892 * object.h (Got_offset_list): New class.
1893 (Sized_relobj::local_has_got_offset): Added got_type parameter.
1894 (Sized_relobj::local_got_offset): Likewise.
1895 (Sized_relobj::set_local_got_offset): Likewise.
1896 (Sized_relobj::local_has_tls_got_offset): Removed.
1897 (Sized_relobj::local_tls_got_offset): Removed.
1898 (Sized_relobj::set_local_tls_got_offset): Removed.
1899 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
1900 * output.cc (Output_data_got::add_global): Added got_type parameter.
1901 (Output_data_got::add_global_with_rel): Likewise.
1902 (Output_data_got::add_global_with_rela): Likewise.
1903 (Output_data_got::add_global_pair_with_rel): New function.
1904 (Output_data_got::add_global_pair_with_rela): New function.
1905 (Output_data_got::add_local): Added got_type parameter.
1906 (Output_data_got::add_local_with_rel): Likewise.
1907 (Output_data_got::add_local_with_rela): Likewise.
1908 (Output_data_got::add_local_pair_with_rel): New function.
1909 (Output_data_got::add_local_pair_with_rela): New function.
1910 (Output_data_got::add_global_tls): Removed.
1911 (Output_data_got::add_global_tls_with_rel): Removed.
1912 (Output_data_got::add_global_tls_with_rela): Removed.
1913 (Output_data_got::add_local_tls): Removed.
1914 (Output_data_got::add_local_tls_with_rel): Removed.
1915 (Output_data_got::add_local_tls_with_rela): Removed.
1916 * output.h (Output_data_got::add_global): Added got_type parameter.
1917 (Output_data_got::add_global_with_rel): Likewise.
1918 (Output_data_got::add_global_with_rela): Likewise.
1919 (Output_data_got::add_global_pair_with_rel): New function.
1920 (Output_data_got::add_global_pair_with_rela): New function.
1921 (Output_data_got::add_local): Added got_type parameter.
1922 (Output_data_got::add_local_with_rel): Likewise.
1923 (Output_data_got::add_local_with_rela): Likewise.
1924 (Output_data_got::add_local_pair_with_rel): New function.
1925 (Output_data_got::add_local_pair_with_rela): New function.
1926 (Output_data_got::add_global_tls): Removed.
1927 (Output_data_got::add_global_tls_with_rel): Removed.
1928 (Output_data_got::add_global_tls_with_rela): Removed.
1929 (Output_data_got::add_local_tls): Removed.
1930 (Output_data_got::add_local_tls_with_rel): Removed.
1931 (Output_data_got::add_local_tls_with_rela): Removed.
1932 * resolve.cc (Symbol::override_base_with_special): Removed
1933 reference to has_got_offset_ field.
1934 * symtab.cc (Symbol::init_fields): Replaced initialization
1935 of got_offset_ with got_offsets_. Removed initialization
1937 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
1938 (Symbol::got_offset): Likewise.
1939 (Symbol::set_got_offset): Likewise.
1940 (Symbol::has_tls_got_offset): Removed.
1941 (Symbol::tls_got_offset): Removed.
1942 (Symbol::set_tls_got_offset): Removed.
1943 (Symbol::got_offset_): Removed.
1944 (Symbol::tls_mod_got_offset_): Removed.
1945 (Symbol::tls_pair_got_offset_): Removed.
1946 (Symbol::got_offsets_): New field.
1947 (Symbol::has_got_offset): Removed.
1948 (Symbol::has_tls_mod_got_offset): Removed.
1949 (Symbol::has_tls_pair_got_offset): Removed.
1950 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
1951 (Target_x86_64::Scan::local): Updated callers of Output_data_got
1953 (Target_x86_64::Scan::global): Likewise.
1954 (Target_x86_64::Relocate::relocate): Likewise.
1955 (Target_x86_64::Relocate::relocate_tls): Likewise.
1957 2008-03-25 Ben Elliston <bje@au.ibm.com>
1959 * yyscript.y: Fix spelling error in comment.
1961 2008-03-24 Ian Lance Taylor <iant@google.com>
1963 * options.h (class General_options): Define build_id option.
1964 * layout.h (class Layout): Declare write_build_id, create_note,
1965 create_build_id. Add build_id_note_ member.
1966 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
1967 "libiberty.h", "md5.h", "sha1.h".
1968 (Layout::Layout): Initialize eh_frame_data_,
1969 eh_frame_hdr_section_, and build_id_note_.
1970 (Layout::finalize): Call create_build_id.
1971 (Layout::create_note): New function, broken out of
1972 Layout::create_gold_note.
1973 (Layout::create_gold_note): Call create_note.
1974 (Layout::create_build_id): New function.
1975 (Layout::write_build_id): New function.
1976 (Close_task_runner::run): Call write_build_id.
1978 * x86_64.cc: Correct license to GPLv3.
1980 2008-03-23 Ian Lance Taylor <iant@google.com>
1982 * options.cc: Include "demangle.h".
1983 (parse_optional_string): New function.
1984 (parse_long_option): Handle takes_optional_argument.
1985 (parse_short_option): Update dash_z initializer. Handle
1986 takes_optional_argument.
1987 (General_options::General_options): Initialize do_demangle_.
1988 (General_options::finalize): Set do_demangle_. Handle demangling
1990 * options.h (parse_optional_string): Declare.
1991 (struct One_option): Add optional_arg field. Update constructor.
1992 Update call constructor calls. Add takes_optional_argument
1994 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
1995 (DEFINE_optional_string): Define.
1996 (General_options::demangle): Change from DEFINE_bool to
1997 DEFINE_optional_string.
1998 (General_options::no_demangle): New function.
1999 (General_options::do_demangle): New function.
2000 (General_options::set_do_demangle): New function.
2001 (General_options::execstack_status_): Move definition to end of
2003 (General_options::static_): Likewise.
2004 (General_options::do_demangle_): New field.
2005 * object.cc (big_endian>::get_symbol_location_info): Call
2006 Options::do_demangle, not Options::demangle.
2007 * symtab.cc (demangle): Likewise.
2009 2008-03-22 Ian Lance Taylor <iant@google.com>
2011 * gold.h: Include <cstddef> and <sys/types.h>
2012 * options.h: Include <cstring>.
2014 2008-03-21 Ian Lance Taylor <iant@google.com>
2016 * Added source code to GNU binutils.