1 2008-07-29 Ian Lance Taylor <iant@google.com>
3 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
4 symbols before other symbols.
5 * testsuite/script_test_2.cc (test_addr): Declare.
6 (test_addr_alias): Declare.
7 (main): Check that test_addr and test_addr_alias have the right
9 * testsuite/script_test_2.t: Define test_addr_alias and
12 2008-07-24 Ian Lance Taylor <iant@google.com>
15 * descriptors.cc: New file.
16 * descriptors.h: New file.
17 * gold-threads.h (class Hold_optional_lock): New class.
18 * fileread.cc: Include "descriptors.h".
19 (File_read::~File_read): Release descriptor rather than closing
21 (File_read::open) [file]: Call open_descriptor rather than open.
22 Set is_descriptor_opened_.
23 (File_read::open) [memory]: Assert that descriptor is not open.
24 (File_read::reopen_descriptor): New function.
25 (File_read::release): Release descriptor.
26 (File_read::do_read): Make non-const. Reopen descriptor.
27 (File_read::read): Make non-const.
28 (File_read::make_view): Reopen descriptor.
29 (File_read::do_readv): Likewise.
30 * fileread.h (class File_read): Add is_descriptor_opened_ field.
32 * layout.cc: Include "descriptors.h".
33 (Layout::create_build_id): Use open_descriptor rather than open.
34 * output.cc: Include "descriptors.h".
35 (Output_file::open): Use open_descriptor rather than open.
36 * archive.cc (Archive::const_iterator): Change Archive to be
38 (Archive::begin, Archive::end): Make non-const.
39 (Archive::count_members): Likewise.
40 * archive.h (class Archive): Update declarations.
41 * object.h (Object::read): Make non-const.
42 * Makefile.am (CCFILES): Add descriptors.cc.
43 (HFILES): Add descriptors.h.
44 * Makefile.in: Rebuild.
47 * gold.h: Always include <clocale>. Add Solaris workarounds
48 following code in binutils/sysdep.h.
51 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
52 this->eh_frame_hdr_ is NULL before using it.
54 * dynobj.cc (Versions::Versions): Update comment.
56 * dynobj.cc (Versions::Versions): If there is an soname, use it as
57 the base version name.
59 * stringpool.cc (Stringpool_template::add_with_length): Set key to
61 (Stringpool_template::set_string_offsets): Subtract one from key
62 before using it as an array index.
63 (Stringpool_template::get_offset_with_length): Likewise.
64 (Stringpool_template::write_to_buffer): Likewise.
65 * stringpool.h (Stringpool_template::get_offset_from_key):
68 2008-07-23 Ian Lance Taylor <iant@google.com>
71 * object.h (Merged_symbol_value::value): Do our best to handle a
75 * script.cc (Version_script_info::get_versions): Don't add empty
76 version tag to return value.
77 (Version_script_info::get_symbol_version_helper): Change return
78 type to bool. Add pversion parameter. Change all callers.
79 (script_register_vers_node): Don't require a non-NULL tag.
80 * script.h (class Version_script_info): Update declarations.
81 (Version_script_info::get_symbol_version): Change return type to
82 bool. Add version parameter. Change all callers.
83 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
84 handling. Handle an empty version from a version script.
85 (Symbol_table::define_special_symbol): Likewise.
86 * testsuite/ver_test_10.script: New file.
87 * testsuite/ver_test_10.sh: New file.
88 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
89 (check_DATA): Add ver_test_10.syms.
90 (ver_test_10.syms, ver_test_10.so): New target.
91 * testsuite/Makefile.in: Rebuild.
93 2008-07-23 Simon Baldwin <simonb@google.com>
95 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
96 to zero for undefined symbols from dynamic libraries.
98 2008-07-23 Ian Lance Taylor <iant@google.com>
100 * symtab.cc (Symbol_table::resolve): Remove version parameter.
102 * symtab.h (class Symbol_table): Update declaration.
103 * testsuite/ver_test_9.cc: New file.
104 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
105 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
106 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
107 (ver_test_9.so, ver_test_9.o): New targets.
108 * testsuite/Makefile.in: Rebuild.
110 2008-07-22 Ian Lance Taylor <iant@google.com>
112 * options.h (class General_options): Define --check-sections.
113 * layout.cc (Layout::set_segment_offsets): Handle
116 * options.h (class General_options): Define -n/--nmagic and
118 * options.cc (General_options::finalize): For -n/--nmagic or
119 -N/--omagic, set -static.
120 * layout.cc (Layout::attach_allocated_section_to_segment): If
121 -N/--omagic, don't put read-only and read-write sections in
123 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
124 finding a read-only segment.
125 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
126 don't set the minimum segment alignment to the common page size,
127 and don't set the file offset to the address modulo the page size.
128 * script-sections.cc (Script_sections::create_segments): If
129 -n/--omagic, don't put read-only and read-write sections in
134 * options.h (class General_options): Add --print-symbol-counts.
135 * main.cc (main): Issue defined symbol report if requested.
136 * archive.cc (Archive::interpret_header): Make into a const member
138 (Archive::add_symbols): Call Input_objects::archive_start and
140 (Archive::const_iterator): Define new class.
141 (Archive::begin, Archive::end): New functions.
142 (Archive::include_all_members): Rewrite to use iterator.
143 (Archive::count_members): New function.
144 * archive.h (class Archive): Update declarations.
145 (Archive::filename): New function.
146 * object.cc: Include "cref.h".
147 (Sized_relobj::Sized_relobj): Initialize defined_count_.
148 (Sized_relobj::do_get_global_symbol_counts): New function.
149 (Input_objects::add_object): Add object to cross-referencer.
150 (Input_objects::archive_start): New function.
151 (Input_objects::archive_stop): New function.
152 (Input_objects::print_symbol_counts): New function.
153 * object.h: Declare Cref and Archive.
154 (Object::get_global_symbol_counts): New function.
155 (Object::do_get_global_symbol_counts): New pure virtual function.
156 (class Sized_relobj): Add defined_count_ field. Update
158 (class Input_objects): Add cref_ field. Update constructor.
160 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
162 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
164 (Sized_dynobj::do_get_global_symbol_counts): New function.
165 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
166 defined_count_. Update declarations. Define Symbols typedef.
167 * symtab.cc (Symbol_table::add_from_relobj): Add defined
168 parameter. Change all callers.
169 (Symbol_table::add_from_dynobj): Add sympointers and defined
170 parameters. Change all callers.
171 * symtab.h (class Symbol_table): Update declarations.
172 * Makefile.am (CCFILES): Add cref.cc.
173 (HFILES): Add cref.h.
174 * Makefile.in: Rebuild.
176 2008-07-22 Simon Baldwin <simonb@google.com>
178 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
179 to zero when writing undefined symbols.
181 2008-07-22 Ian Lance Taylor <iant@google.com>
183 * output.cc (Output_section::add_input_section): Don't try to
184 merge empty merge sections.
186 2008-07-21 Craig Silverstein <csilvers@google.com>
188 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
189 Include symbol version in error message.
191 2008-07-20 Chris Demetriou <cgd@google.com>
193 * configure.ac (gold_cv_c_random_seed): New configured variable.
194 (RANDOM_SEED_CFLAGS): New substituted variable.
195 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
196 * configure: Rebuild.
197 * Makefile.in: Likewise.
198 * testsuite/Makefile.in: Likewise.
200 2008-07-18 Ian Lance Taylor <iant@google.com>
202 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
203 where we see NAME/NULL and NAME/VERSION as separate symbols.
204 * testsuite/ver_test_main.cc (main): Call t4.
206 * testsuite/ver_test_2.cc (t4_2): Define.
207 * testsuite/ver_test_2.script: Put t4_2a in VER2.
208 * testsuite/ver_test_4.cc (t4_2a): Define.
209 * testsuite/ver_test_4.script: Put t4_2a in VER2.
210 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
212 2008-07-17 Ian Lance Taylor <iant@google.com>
214 * dynobj.cc (Versions::add_def): If we give an error about a
215 missing version, go ahead and create the version anyhow.
217 2008-07-10 Ian Lance Taylor <iant@google.com>
219 Handle output sections with more than 0x7fffffff bytes.
220 * object.h (class Relobj): Change map_to_output_ to
221 output_sections_, and just keep a section pointer. Change all
222 uses. Move comdat group support to Sized_relobj.
223 (Relobj::is_section_specially_mapped): Remove.
224 (Relobj::output_section): Remove poff parameter. Change all
226 (Relobj::output_section_offset): New function.
227 (Relobj::set_section_offset): Rewrite.
228 (Relobj::map_to_output): Remove.
229 (Relobj::output_sections): New function.
230 (Relobj::do_output_section_offset): New pure virtual function.
231 (Relobj::do_set_section_offset): Likewise.
232 (class Sized_relobj): Add section_offsets_ field. Add comdat
233 group support from Relobj. Update declarations.
234 (Sized_relobj::get_output_section_offset): New function.
235 (Sized_relobj::do_output_section_offset): New function.
236 (Sized_relobj::do_set_section_offset): New function.
237 * object.cc (Relobj::output_section_address): Remove.
238 (Sized_relobj::Sized_relobj): Initialize new fields.
239 (Sized_relobj::include_section_group): Cast find_kept_object to
241 (Sized_relobj::include_linkonce_section): Likewise.
242 (Sized_relobj::do_layout): Use separate arrays for output section
244 (Sized_relobj::do_count_local_symbols): Change map_to_output to
246 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
247 output_sections and section_offsets.
248 (Sized_relobj::write_local_symbols): Likewise.
249 (map_to_kept_section): Compute output address directly.
250 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
251 output_sections and section_offsets.
252 (Sized_relobj::write_sections): Likewise.
253 (Sized_relobj::relocate_sections): Likewise.
254 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
255 * output.h (class Output_reloc): Update declarations. Change
256 u2_.relobj to Sized_relobj*.
257 (class Output_data_reloc): Change add functions to use
259 * output.cc (Output_reloc::Output_reloc): Change relobj to
261 (Output_reloc::local_section_offset): Change return type to
262 Elf_Addr. Use get_output_section_offset.
263 (Output_reloc::get_address): Likewise.
264 (Output_section::is_input_address_mapped): Don't call
265 is_section_specially_mapped.
266 (Output_section::output_offset): Likewise.
267 (Output_section::output_address): Likewise.
268 (Output_section::starting_output_address): Likewise.
269 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
270 parameter to Sized_relobj*.
271 (Copy_relocs::need_copy_reloc): Likewise.
272 (Copy_relocs::save): Likewise.
273 * copy-relocs.h (class Copy_relocs): Update declarations.
274 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
275 Sized_relobj*. Change relobj_ field to Sized_relobj*.
276 * target-reloc.h (relocate_for_relocatable): Change
277 offset_in_output_section type to Elf_Addr. Change code that uses
279 * layout.cc (Layout::layout): Always set *off.
280 * mapfile.cc (Mapfile::print_input_section): Use
281 output_section_offset.
282 * i386.cc (Target_i386::copy_reloc): Change object parameter to
284 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
285 * sparc.cc (Target_sparc::copy_reloc): Likewise.
286 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
288 2008-07-03 Ian Lance Taylor <iant@google.com>
290 * layout.cc (Layout::include_section): Do not discard unrecognized
293 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
295 * script.cc (Lex::can_continue_name): Make '?' allowable in
296 version-script names.
297 * testsuite/version_script.map: Change glob pattern to use '?'
299 2008-06-30 Manish Singh <yosh@gimp.org>
302 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
305 2008-06-30 Ian Lance Taylor <iant@google.com>
309 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
310 versions]: Don't try to read the value in the contents, since we
311 don't use it. Use the template endianness when writing.
313 2008-06-25 Cary Coutant <ccoutant@google.com>
315 * fileread.cc (File_read::make_view): Assert on zero-length view.
316 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
317 symbol table when there are no symbols to read.
319 2008-06-23 Craig Silverstein <csilvers@google.com>
321 * version.cc (version_string): Bump to 1.7
323 2008-06-18 Craig Silverstein <csilvers@google.com>
325 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
326 constant 0xFFFF to type Valtype.
327 (Powerpc_relocate_functions::rel16_ha): Likewise.
329 2008-06-17 Ian Lance Taylor <iant@google.com>
331 * output.h (Output_section::Input_section): Initialize p2align_ to
332 zero for Output_section_data constructors.
333 (Output_section::Input_section::addralign): If not an input
334 section, return the alignment of the Output_section_data.
335 * testsuite/copy_test.cc: New file.
336 * testsuite/copy_test_1.cc: New file.
337 * testsuite/copy_test_2.cc: New file.
338 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
339 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
340 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
341 (copy_test_1_pic.o, copy_test_1.so): New targets.
342 (copy_test_2_pic.o, copy_test_2.so): New targets.
343 * testsuite/Makefile.in: Rebuild.
345 * script-sections.cc (Script_sections::place_orphan): Initialize
346 local variable exact.
348 2008-06-13 David Edelsohn <edelsohn@gnu.org>
350 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
352 2008-06-12 David Edelsohn <edelsohn@gnu.org>
353 David S. Miller <davem@davemloft.net>
355 * powerpc.cc: New file.
356 * Makefile.am (TARGETSOURCES): Add powerpc.cc
357 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
358 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
359 * Makefile.in: Rebuild.
361 2008-06-09 Ian Lance Taylor <iant@google.com>
363 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
365 (throwing, orig_terminate): New static variables.
366 (terminate_handler): New static function.
367 (t2): Set terminate handler.
369 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
372 * binary.cc (Binary_to_elf::sized_convert): Fix .data
375 2008-05-30 Cary Coutant <ccoutant@google.com>
377 * archive.cc (Archive::include_all_members) Correct to step
378 over symbol table and extended name table in thin archives.
380 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
383 * target-reloc.h (relocate_for_relocatable): Fix new_offset
386 2008-05-28 Caleb Howe <cshowe@google.com>
388 * reduced_debug_output.cc: New file.
389 * reduced_debug_output.h: New file.
390 * options.h (class General_options): Add --strip-debug-non-line.
391 * options.cc (General_options::finalize): Add strip_debug_non_line
392 to the strip heirarchy.
393 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
395 * layout.cc: Include "reduced_debug_output.h".
396 (Layout::Layout): Initialize new fields.
397 (line_only_debug_sections): New static array.
398 (is_lines_only_debug_sections): New static inline function.
399 (Layout::include_section): Handle --strip-debug-non-line.
400 (Layout::make_output_section): If --strip-debug-non-line, build
401 new output sections for .debug_abbrev and .debug_info.
402 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
403 gold. Warn about possible overflow.
404 (read_signed_LEB_128): Likewise.
405 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
406 (read_signed_LEB_128): Declare.
407 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
408 (HFILES): Add reduced_debug_output.h.
409 * Makefile.in: Rebuild.
411 2008-05-21 Ian Lance Taylor <iant@google.com>
413 * mapfile.cc: New file.
414 * mapfile.h: New file.
415 * options.h (class General_options): Add -M/--print-map and -Map.
416 * options.cc (General_options::finalize): Make -M equivalent to
418 * main.cc: Include <cstdio> and "mapfile.h".
419 (main): Open mapfile if requested.
420 * gold.cc (class Middle_runner): Add mapfile_ field. Update
421 constructor. Change caller.
422 (queue_initial_tasks): Add mapfile parameter. Change caller.
423 (queue_middle_tasks): Likewise.
424 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
426 * archive.cc: Include "mapfile.h".
427 (Archive::add_symbols): Add mapfile parameter. Change all
428 callers. Pass mapfile, symbol, and reason to include_member.
429 (Archive::include_all_members): Add mapfile parameter. Change all
431 (Archive::include_member): Add mapfile, sym, and why parameters.
432 Change all callers. Report inclusion to map file.
433 * archive.h: Include "fileread.h".
434 (class Archive): Update declarations.
435 (Archive::file): New const method.
436 (class Add_archive_symbols): Add mapfile_ field. Update
437 constructor. Change all callers.
438 * readsyms.h (class Read_symbols): Likewise.
439 (class Finish_group): Likewise.
440 (class Read_script): Likewise.
441 * common.cc: Include "mapfile.h".
442 (Symbol_table::allocate_commons): Add mapfile parameter. Change
444 (Symbol_table::do_allocate_commons): Likewise.
445 (Symbol_table::do_allocate_commons_list): Likewise. Report common
446 symbol allocation to mapfile.
447 * common.h (class Allocate_commons_task): Add mapfile_ field.
448 Update constructor. Change all callers.
449 * symtab.h (class Symbol_table): Update declarations.
450 * layout.cc: Include "mapfile.h".
451 (Layout_task_runner::run): Print information to mapfile.
452 (Layout::create_gold_note): Change Output_data_fixed_space to
453 Output_data_zero_fill.
454 (Layout::create_build_id): Likewise.
455 (Layout::print_to_mapfile): New function.
456 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
457 constructor. Change caller.
458 (class Layout): Declare print_to_mapfile.
459 * output.cc (Output_section::Input_section::print_to_mapfile): New
461 (Output_section::add_input_section): If producing a map, always
462 add to input_sections_ list.
463 (Output_section::do_print_to_mapfile): New function.
464 (Output_segment::print_sections_to_mapfile): New function.
465 (Output_segment::print_section_list_to_mapfile): New function.
466 * output.h: Include "mapfile.h".
467 (Output_data::print_to_mapfile): New function.
468 (Output_data::do_print_to_mapfile): New virtual function.
469 (Output_segment_headers::do_print_to_mapfile): New function.
470 (Output_file_header::do_print_to_mapfile): New function.
471 (Output_data_const::do_print_to_mapfile): New function.
472 (class Output_data_const_buffer): Add map_name_ field. Update
473 constructor. Change all callers. Add do_print_to_mapfile
475 (class Output_data_fixed_space): Likewise.
476 (class Output_data_space): Likewise.
477 (class Output_data_zero_fill): New class.
478 (Output_data_strtab::do_print_to_mapfile): New function.
479 (Output_data_reloc_base::do_print_to_mapfile): New function.
480 (Output_relocatable_relocs::do_print_to_mapfile): New function.
481 (Output_data_group::do_print_to_mapfile): New function.
482 (Output_data_got::do_print_to_mapfile): New function.
483 (Output_data_dynamic::do_print_to_mapfile): New function.
484 (Output_symtab_xindex::do_print_to_mapfile): New function.
485 (class Output_section): Declare do_print_to_mapflie. Declare
486 print_to_mapfile in Input_section.
487 (class Output_segment): Declare new functions.
488 * object.h (Sized_relobj::symbol_count): New function.
490 (Output_section_element_dot_assignment::set_section_addresses):
491 Change Output_data_fixed_space to Output_data_zero_fill.
492 (Output_data_expression::do_print_to_mapfile): New function.
493 * script.cc (read_input_script): Add mapfile parameter. Change
495 * script.h (read_input_script): Update declaration.
496 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
497 (Eh_frame::do_print_to_mapfile): New function.
498 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
499 (Output_merge_string::do_print_to_mapfile): New function.
500 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
502 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
504 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
506 * Makefile.am (CCFILES): Add mapfile.cc.
507 (HFILES): Add mapfile.h.
508 * Makefile.in: Rebuild.
510 2008-05-19 Ian Lance Taylor <iant@google.com>
512 * options.h (class General_options): Add -z relro.
513 * layout.cc (Layout::Layout): Initialize relro_segment_.
514 (Layout::add_output_section_data): Return the output section.
515 (Layout::make_output_section): Rcognize relro sections and mark
517 (Layout::attach_allocated_section_to_segment): Put relro sections
518 in a PT_GNU_RELRO segment.
519 (Layout::create_initial_dynamic_sections): Mark the .dynamic
521 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
523 (Layout::linkonce_mapping): Map d.rel.ro.local to
525 (Layout::output_section_name): Us .data.rel.ro.local for any
526 section which begins with that.
527 * layout.h (class Layout): Update add_output_section_data
528 declaration. Add relro_segment_ field.
529 * output.cc (Output_section::Output_section): Initialize is_relro_
530 and is_relro_local_ fields.
531 (Output_segment::add_output_section): Group relro sections.
532 (Output_segment::is_first_section_relro): New function.
533 (Output_segment::maximum_alignment): If there is a relro section,
534 align the segment to the common page size.
535 (Output_segment::set_section_addresses): Track whether we are
536 looking at relro sections. If the last section is a relro
537 section, align to the common page size.
538 (Output_segment::set_section_list_addresses): Add in_relro
539 parameter. Change all callers. Align to the page size when
540 moving from relro to non-relro section.
541 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
543 * output.h (class Output_section): Add is_relro_ and
544 is_relro_local_ fields.
545 (Output_section::is_relro): New function.
546 (Output_section::set_is_relro): New function.
547 (Output_section::is_relro_local): New function.
548 (Output_section::set_is_relro_local): New function.
549 (class Output_segment): Update declarations.
550 * i386.cc (Target_i386::got_section): Mark .got section as relro.
551 * sparc.cc (Target_sparc::got_section): Likewise.
552 * x86_64.cc (Target_x86_64::got_section): Likewise.
553 * testsuite/relro_test_main.cc: New file.
554 * testsuite/relro_test.cc: New file.
555 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
556 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
557 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
558 (relro_test.so, relro_test_pic.o): New targets.
559 * testsuite/Makefile.in: Rebuild.
561 2008-05-16 Ian Lance Taylor <iant@google.com>
563 * output.cc (Output_segment::add_output_section): Remove front
565 * output.h (class Output_segment): Remove
566 add_initial_output_section and overloaded add_output_section.
567 Update declaration of remaining add_output_section.
568 * layout.cc (Layout::create_interp): Call add_output_section
569 rather than add_initial_output_section.
570 (Layout::finish_dynamic_section): Likewise.
572 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
573 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
574 know the dynamic type.
575 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
576 field. Initialize it in constructor.
577 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
578 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
579 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
582 * output.cc (Output_reloc::get_address): Change return type to
584 * output.h (class Output_reloc): Update get_address declaration.
585 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
586 for section addresses.
588 2008-05-09 Ian Lance Taylor <iant@google.com>
591 * gold.cc (gold_nomem): Use return value of write.
593 2008-05-08 Ian Lance Taylor <iant@google.com>
595 * symtab.c (Symbol::init_base_output_data): Add version
596 parameter. Change all callers.
597 (Symbol::init_base_output_segment): Likewise.
598 (Symbol::init_base_constant): Likewise.
599 (Symbol::init_base_undefined): Likewise.
600 (Sized_symbol::init_output_data): Likewise.
601 (Sized_symbol::init_output_segment): Likewise.
602 (Sized_symbol::init_constant): Likewise.
603 (Sized_symbol::init_undefined): Likewise.
604 (Symbol_table::do_define_in_output_data): If the new symbol has a
605 version, mark it as the default.
606 (Symbol_table::do_define_in_output_segment): Likewise.
607 (Symbol_table::do_define_as_constant): Likewise.
608 * symtab.h (class Symbol): Update declarations.
609 (class Sized_symbol): Likewise.
610 * resolve.cc (Symbol::override_version): New function.
611 (Symbol::override_base): Call override_version.
612 (Symbol::override_base_with_special): Likewise.
613 * testsuite/ver_script_8.script: New file.
614 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
615 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
616 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
617 (ver_test_8_1.so, ver_test_8_2.so): New targets.
619 2008-05-06 Ian Lance Taylor <iant@google.com>
622 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
624 (class General_options): Remove existing --undefined, and add
625 --no-undefined instead. Add new --undefined as synonym for -u.
626 * archive.cc (Archive::add_symbols): Check whether symbol was
628 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
629 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
630 all uses. Add IS_UNDEFINED. Update declarations to split
631 different versions of init_base. Declare init_base_undefined.
632 (Symbol::is_defined): Handle IS_UNDEFINED.
633 (Symbol::is_undefined): Likewise.
634 (Symbol::is_weak_undefined): Call is_undefined.
635 (Symbol::is_absolute): Handle IS_CONSTANT.
636 (class Sized_symbol): Update declarations to split different
637 versions of init. Declare init_undefined.
638 (class Symbol_table): Declare new functions.
639 * symtab.cc (Symbol::init_base_object): Rename from init_base.
641 (Symbol::init_base_output_data): Likewise.
642 (Symbol::init_base_output_segment): Likewise.
643 (Symbol::init_base_constant): Likewise.
644 (Symbol::init_base_undefined): New function.
645 (Sized_symbol::init_object): Rename from init. Change all
647 (Sized_symbol::init_output_data): Likewise.
648 (Sized_symbol::init_output_segment): Likewise.
649 (Sized_symbol::init_constant): Likewise.
650 (Sized_symbol::init_undefined): New function.
651 (Symbol_table::add_undefined_symbols_from_command_line): New
653 (Symbol_table::do_add_undefined_symbols_from_command_line): New
655 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
656 (Symbol::output_section): Likewise.
657 (Symbol::set_output_section): Likewise.
658 (Symbol_table::sized_finalize_symbol): Likewise.
659 (Symbol_table::sized_write_globals): Likewise.
660 * resolve.cc (Symbol_table::should_override): Likewise.
661 (Symbol::override_base_with_special): Likewise.
663 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
664 symbol, change it to have default visibility.
665 * testsuite/protected_1.cc: New file.
666 * testsuite/protected_2.cc: New file.
667 * testsuite/protected_3.cc: New file.
668 * testsuite/protected_main_1.cc: New file.
669 * testsuite/protected_main_2.cc: New file.
670 * testsuite/protected_main_3.cc: New file.
671 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
672 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
673 (protected_1_LDFLAGS, protected_1_LDADD): Define.
674 (protected_1.so): New target.
675 (protected_1_pic.o, protected_2_pic.o): New targets.
676 (protected_3_pic.o): New target.
677 (check_PROGRAMS): Add protected_2.
678 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
679 (protected_2_LDFLAGS, protected_2_LDADD): Define.
680 * testsuite/Makefile.in: Rebuild.
682 * options.h (DEFINE_var): Add set_user_set_##varname__.
683 (DEFINE_bool_alias): New macro.
684 (class General_options): Define -Bstatic using DEFINE_bool_alias
685 rather than DEFINE_special. Add --undefined as an alias for -z
687 * options.cc (General_options::parse_Bstatic): Remove.
689 * options.h (class General_options): Add --fatal-warnings.
690 * main.cc (main): Implement --fatal-warnings.
691 * errors.h (Errors::warning_count): New function.
693 * options.h (class General_options): Add -Bsymbolic-functions.
694 * symtab.h (Symbol::is_preemptible): Check for
695 -Bsymbolic-functions.
697 2008-05-05 Ian Lance Taylor <iant@google.com>
699 * options.h (DEFINE_bool): For DASH_Z, create the negative option
700 as noVARNAME rather than no-VARNAME.
701 (class General_options): Add option -z combreloc.
702 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
704 (Output_reloc::sort_before) [SHT_REL]: New function.
705 (Output_reloc::sort_before) [SHT_RELA]: New function.
706 (class Output_data_reloc_base): Add sort_relocs_ field. Define
707 Sort_relocs_comparison.
708 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
709 parameter. Change all callers.
710 (Output_data_reloc::Output_data_reloc) [both versions]: Add
711 sort_relocs parameter. Change all callers.
712 * output.cc (Output_reloc::get_address): New function, broken out
714 (Output_reloc::write_rel): Call it.
715 (Output_reloc::compare): New function.
716 (Output_data_reloc_base::do_write): Optionally sort relocs.
718 * configure.ac: If targ_extra_obj is set, link it in.
719 * configure.tgt: Initialize all variables.
720 (x86_64*): Set targ_extra_obj and targ_extra_size.
721 * configure: Rebuild.
723 * object.cc (Sized_relobj::include_section_group): Adjust section
724 indexes read from group data. Build vector to pass to
726 * layout.cc (Layout::layout_group): Add flags and shndxes
727 parameters. Remove contents parameter. Change caller. Update
728 explicit instantiations.
729 * layout.h (class Layout): Update layout_group declaration.
730 * output.cc (Output_data_group::Output_data_group): Add flags and
731 input_shndxes parameters. Remove contents parameter. Change
733 (Output_data_group::do_write): Change input_sections_ to
735 * output.h (class Output_data_group): Update constructor
736 declaration. Rename input_sections_ to input_shndxes_.
737 * testsuite/many_sections_test.cc: Add template.
739 2008-04-30 Cary Coutant <ccoutant@google.com>
741 * target-reloc.h (relocate_section): Fix dead-pointer bug.
743 * layout.cc (Layout::include_section): Refactored check for debug
745 (Layout::add_comdat): Add new parameters. Change type
746 of signature parameter. Add object and shndx to signatures table.
747 (Layout::find_kept_object): New function.
748 * layout.h: Include <cstring>.
749 (Layout::is_debug_info_section): New function.
750 (Layout::add_comdat): Add new parameters.
751 (Layout::find_kept_object): New function.
752 (Layout::Kept_section): New struct.
753 (Layout::Signatures): Change type of map range.
754 * object.cc (Relobj::output_section_address): New function.
755 (Sized_relobj::include_section_group): Add new parameters. Change
756 calls to Layout::add_comdat. Change to build table of kept comdat
757 groups and table mapping discarded sections to kept sections.
758 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
759 (Sized_relobj::do_layout): Change calls to include_section_group and
760 include_linkonce_section.
761 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
762 value to zero when section is discarded.
763 (Sized_relobj::map_to_kept_section): New function.
764 * object.h (Relobj::output_section_address): New function.
765 (Relobj::Comdat_group): New type.
766 (Relobj::find_comdat_group): New function.
767 (Relobj::Comdat_group_table): New type.
768 (Relobj::Kept_comdat_section): New type.
769 (Relobj::Kept_comdat_section_table): New type.
770 (Relobj::add_comdat_group): New function.
771 (Relobj::set_kept_comdat_section): New function.
772 (Relobj::get_kept_comdat_section): New function.
773 (Relobj::comdat_groups_): New field.
774 (Relobj::kept_comdat_sections_): New field.
775 (Symbol_value::input_value): Update comment.
776 (Sized_relobj::map_to_kept_section) New function.
777 (Sized_relobj::include_linkonce_section): Add new parameter.
778 * target-reloc.h (Comdat_behavior): New type.
779 (get_comdat_behavior): New function.
780 (relocate_section): Add code to map a discarded section to the
781 corresponding kept section when applying a relocation.
783 2008-04-30 Craig Silverstein <csilvers@google.com>
785 * dwarf_reader.cc (next_generation_count): New static var.
786 (Addr2line_cache_entry): New struct.
787 (addr2line_cache): New static var.
788 (Dwarf_line_info::one_addr2line): Added caching.
789 (Dwarf_line_info::clear_addr2line_cache): New function.
790 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
791 cache-size parameter.
792 (Dwarf_line_info::one_addr2line_cache): New function.
793 * symtab.cc (Symbol_table::detect_odr_violations): Pass
794 new cache-size argument to one_addr2line(), and clear cache.
796 2008-04-28 Cary Coutant <ccoutant@google.com>
798 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
799 R_386_PC8 relocations.
801 2008-04-23 Ian Lance Taylor <iant@google.com>
803 * object.cc (Sized_relobj::include_section_group): Check for
804 invalid section group.
806 * object.cc (make_elf_object): Correct test for 64-bit ELF file
809 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
810 than read for file header.
811 * archive.cc (Archive::include_member): Likewise.
813 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
815 * aclocal.m4: Regenerate.
816 * configure: Regenerate.
818 2008-04-19 Ian Lance Taylor <iant@google.com>
820 * version.cc (version_string): Bump to 1.6.
822 * testsuite/Makefile.am (many_sections_r_test): New target.
823 (many_sections_r_test_SOURCES): Remove.
824 (many_sections_r_test_DEPENDENCIES): Remove.
825 (many_sections_r_test_LDFLAGS): Remove.
826 (many_sections_r_test_LDADD): Remove.
828 * object.cc (Sized_relobj::do_add_symbols): Always pass
829 local_symbol_count_ to add_from_relobj.
831 * testsuite/Makefile.am (many_sections_check.h): Only check one in
832 every thousand variables.
833 * testsuite/Makefile.in: Rebuild.
835 * object.cc (Xindex::initialize_symtab_xindex): New function.
836 (Xindex::read_symtab_xindex): New function.
837 (Xindex::sym_xindex_to_shndx): New function.
838 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
840 (Sized_relobj::do_initialize_xindex): New function.
841 (Sized_relobj::do_read_symbols): Adjust section links.
842 (Sized_relobj::symbol_section_and_value): Add is_ordinary
843 parameter. Change all callers.
844 (Sized_relobj::include_section_group): Adjust section links and
845 symbol section indexes.
846 (Sized_relobj::do_layout): Adjust section links.
847 (Sized_relobj::do_count_local_symbols): Adjust section links and
848 symbol section indexes.
849 (Sized_relobj::do_finalize_local_symbols): Distinguish between
850 ordinary and special symbols.
851 (Sized_relobj::write_local_symbols): Add symtab_xindex and
852 dynsym_xindex parameters. Change all callers. Adjust section
853 links. Use SHN_XINDEX when needed.
854 (Sized_relobj::get_symbol_location_info): Adjust section links.
855 Don't get fooled by special symbols.
856 * object.h (class Xindex): Define.
857 (class Object): Add xindex_ parameter. Declare virtual functoin
858 do_initialize_xindex.
859 (Object::adjust_sym_shndx): New function.
860 (Object::set_xindex): New protected function.
861 (class Symbol_value): Add is_ordinary_shndx_ field.
862 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
863 (Symbol_value::value): Assert ordinary section.
864 (Symbol_value::initialize_input_to_output_map): Likewise.
865 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
867 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
869 (class Sized_relobj): Update declarations.
870 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
871 parameter. Change all callers.
872 (Sized_relobj::adjust_shndx): New function.
873 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
875 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
876 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
877 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
878 (Sized_dynobj::read_dynsym_section): Adjust section links.
879 (Sized_dynobj::read_dynamic): Likewise.
880 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
882 (Sized_dynobj::do_initialize_xindex): New function.
883 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
884 do_initialize_xindex.
885 (Sized_dynobj::adjust_shndx): New function.
886 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
887 dynsym_xindex_ fields.
888 (Layout::finalize): Add a call to set_section_indexes before
889 creating the symtab sections.
890 (Layout::set_section_indexes): Don't do anything if the section
891 already has a section index.
892 (Layout::create_symtab_sections): Add shnum parameter. Change
893 caller. Create .symtab_shndx section if needed.
894 (Layout::create_shdrs): Add shstrtab_section parameter. Change
896 (Layout::allocated_output_section_count): New function.
897 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
899 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
900 fields. Update declarations.
901 (Layout::symtab_xindex): New function.
902 (Layout::dynsym_xindex): New function.
903 (class Write_symbols_task): Add layout_ field.
904 (Write_symbols_task::Write_symbols_task): Add layout parameter.
906 * output.cc (Output_section_headers::Output_section_headers): Add
907 shstrtab_section parameter. Change all callers.
908 (Output_section_headers::do_sized_write): Store overflow values
909 for section count and section string table section index in
911 (Output_file_header::do_sized_write): Check for overflow of
912 section count and section string table section index.
913 (Output_symtab_xindex::do_write): New function.
914 (Output_symtab_xindex::endian_do_write): New function.
915 * output.h (class Output_section_headers): Add shstrtab_section_.
917 (class Output_symtab_xindex): Define.
918 (Output_section::has_out_shndx): New function.
919 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
921 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
923 (Sized_symbol::init): Likewise.
924 (Symbol::output_section): Check for ordinary symbol.
925 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
926 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
928 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
929 Change all callers. Simplify handling of symbols from sections
930 not included in the link.
931 (Symbol_table::add_from_dynobj): Handle ordinary symbol
933 (Weak_alias_sorter::operator()): Assert that symbols are
935 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
937 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
938 parameters. Change all callers.
939 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
940 symbol distinction. Use SHN_XINDEX when needed.
941 (Symbol_table::write_section_symbol): Add symtab_xindex
942 parameter. Change all callers.
943 (Symbol_table::sized_write_section_symbol): Likewise. Use
944 SHN_XINDEX when needed.
945 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
947 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
948 (Symbol::is_defined): Check is_ordinary.
949 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
950 (Symbol::is_absolute, Symbol::is_common): Likewise.
951 (class Sized_symbol): Update declarations.
952 (class Symbol_table): Update declarations.
953 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
954 parameters. Change all callers.
955 (Sized_symbol::override): Likewise.
956 (Symbol_table::override): Likewise.
957 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
958 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
959 is_ordinary, and orig_st_shndx parameters. Change all callers.
960 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
961 to be in an ordinary section.
962 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
963 object and is_ordinary parameters. Change all callers.
964 (Sized_dwarf_line_info::read_relocs): Add object parameter.
965 Change all callers. Don't add undefined or non-ordinary symbols
967 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
969 * dwarf_reader.h (class Sized_dwarf_line_info): Update
971 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
972 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
973 (Sized_relobj::relocate_sections): Likewise.
974 * target-reloc.h (scan_relocs): Adjust section symbol index.
975 (scan_relocatable_relocs): Likewise.
976 * i386.cc (Scan::local): Check for ordinary symbols.
977 * sparc.cc (Scan::local): Likewise.
978 * x86_64.cc (Scan::local): Likewise.
979 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
980 to symbol_section_and_value.
981 * testsuite/many_sections_test.cc: New file.
982 * testsuite/Makefile.am (BUILT_SOURCES): Define.
983 (check_PROGRAMS): Add many_sections_test.
984 (many_sections_test_SOURCES): Define.
985 (many_sections_test_DEPENDENCIES): Define.
986 (many_sections_test_LDFLAGS): Define.
987 (BUILT_SOURCES): Add many_sections_define.h.
988 (many_sections_define.h): New target.
989 (BUILT_SOURCES): Add many_sections_check.h.
990 (many_sections_check.h): New target.
991 (check_PROGRAMS): Add many_sections_r_test.
992 (many_sections_r_test_SOURCES): Define.
993 (many_sections_r_test_DEPENDENCIES): Define.
994 (many_sections_r_test_LDFLAGS): Define.
995 (many_sections_r_test_LDADD): Define.
996 (many_sections_r_test.o): New target.
997 * testsuite/Makefile.in: Rebuild.
999 2008-04-17 Cary Coutant <ccoutant@google.com>
1001 * errors.cc (Errors::info): New function.
1002 (gold_info): New function.
1003 * errors.h (Errors::info): New function.
1004 * gold.h (gold_info): New function.
1005 * object.cc (Input_objects::add_object): Print trace output.
1006 * options.cc (options::parse_set): New function.
1007 (General_options::parse_wrap): Deleted.
1008 (General_options::General_options): Deleted initializer.
1009 * options.h (options::String_set): New typedef.
1010 (options::parse_set): New function.
1011 (DEFINE_set): New macro.
1012 (General_options::wrap): Changed to use DEFINE_set. Changed
1013 callers of any_wrap_symbols and is_wrap_symbol.
1014 (General_options::trace, General_options::trace_symbol):
1016 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
1017 (General_options::wrap_symbols_): Deleted.
1018 * symtab.cc (Symbol_table::add_from_object): Print trace output.
1020 2008-04-17 David S. Miller <davem@davemloft.net>
1022 * options.cc (General_options::parse_V): New function.
1023 * options.h: Add entries for -V and -Qy.
1025 2008-04-17 Ian Lance Taylor <iant@google.com>
1027 * common.cc (Symbol_table::allocate_commons): Remove options
1028 parameter. Change caller.
1029 (Symbol_table::do_allocate_commons): Remove options parameter.
1030 Change caller. Just call do_allocate_commons_list twice.
1031 (Symbol_table::do_allocate_commons_list): New function, broken out
1032 of do_allocate_commons.
1033 * common.h (class Allocate_commons_task): Remove options_ field.
1035 * symtab.cc (Symbol_table::Symbol_table): Initialize
1037 (Symbol_table::add_from_object): Put TLS common symbols on
1039 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
1040 which are IN_OUTPUT_DATA.
1041 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
1042 allocate_commons and do_allocate_commons declarations. Declare
1043 do_allocate_commons_list.
1044 * gold.cc (queue_middle_tasks): Update creation of
1045 Allocate_commons_task to not pass options.
1046 * testsuite/Makefile.am (INCLUDES): Add -I.. .
1047 (TLS_TEST_C_FLAGS): New variable.
1048 (tls_test_c_pic.o): New target.
1049 (tls_test_shared.so): Link in tls_test_c_pic.o.
1050 (tls_test_c_pic_ie.o): New target.
1051 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
1052 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
1053 (tls_test_c.o): New target.
1054 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
1055 (tls_pic_test_LDADD): Likewise.
1056 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
1057 (tls_shared_gd_to_ie_test_LDADD): Likewise.
1058 (tls_test_c_gnu2.o): New target.
1059 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
1061 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
1062 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
1063 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
1064 * testsuite/tls_test.cc: Include "config.h".
1065 (t_last): Call t11_last.
1066 * testsuite/tls_test.h (t11, t11_last): Declare.
1067 * testsuite/tls_test_c.c: New file.
1068 * testsuite/tls_test_main.cc (thread_routine): Call t11.
1069 * configure.ac: Check for OpenMP support.
1070 * configure, config.in, Makefile.in: Rebuild.
1071 * testsuite/Makefile.in: Rebuild.
1073 2008-04-16 Cary Coutant <ccoutant@google.com>
1075 * i386.cc (Target_i386::define_tls_base_symbol): New function.
1076 (Target_i386::tls_base_symbol_defined_): New field.
1077 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
1078 (Target_i386::Scan::global): Likewise.
1079 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
1080 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
1081 (Target_x86_64::tls_base_symbol_defined_): New field.
1082 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
1083 (Target_x86_64::Scan::global): Likewise.
1085 2008-04-16 Cary Coutant <ccoutant@google.com>
1087 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
1088 (Symbol::needs_plt_entry): Allow weak undefined symbols.
1089 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
1090 building shared libraries.
1091 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
1092 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
1093 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
1094 * testsuite/Makefile.in: Rebuild.
1095 * testsuite/weak_undef.h: New file.
1096 * testsuite/weak_undef_file1.cc: Add extra test cases.
1097 * testsuite/weak_undef_file2.cc: Likewise.
1098 * testsuite/weak_undef_test.cc: Likewise.
1100 2008-04-16 David S. Miller <davem@davemloft.net>
1102 * sparc.cc (Target_sparc::Scan): Change from struct to class.
1103 Add issued_non_pic_error_ field. Declare check_non_pic.
1104 (Target_sparc::Scan::check_non_pic): New function.
1105 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
1106 (Target_sparc::Scan::global): Likewise.
1108 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
1109 * configure: Rebuild.
1111 * options.h (DEFINE_enable): New macro.
1112 (new_dtags): New enable option.
1113 (initfirst, interpose, loadfltr, nodefaultlib,
1114 nodelete, nodlopen, nodump): New -z options.
1115 * layout.cc (Layout:finish_dynamic_section): If new
1116 dtags enabled, emit DT_RUNPATH. Also, emit a
1117 DT_FLAGS_1 containing any specified -z flags.
1119 2008-04-16 Ian Lance Taylor <iant@google.com>
1121 * copy-relocs.cc: New file.
1122 * copy-relocs.h: New file.
1123 * reloc.cc: Remove Copy_relocs code.
1124 * reloc.h: Likewise.
1125 * reloc-types.h (struct Reloc_types) [both versions]: Add
1126 get_reloc_addend_noerror.
1127 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
1128 variants of add_global which take an addend which must be zero.
1129 * i386.cc: Include "copy-relocs.h".
1130 (class Target_i386): Change type of copy_relocs_ to variable,
1132 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
1134 (Target_i386::do_finalize_sections): Change handling of
1136 * sparc.cc: Include "copy-relocs.h".
1137 (class Target_sparc): Change type of copy_relocs_ to variable,
1139 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
1141 (Target_sparc::do_finalize_sections): Change handling of
1143 * x86_64.cc: Include "copy-relocs.h".
1144 (class Target_x86_64): Change type of copy_relocs_ to variable,
1146 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
1147 class. Change all callers.
1148 (Target_x86_64::do_finalize_sections): Change handling of
1150 * Makefile.am (CCFILES): Add copy-relocs.cc.
1151 (HFILES): Add copy-relocs.h.
1153 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
1155 * testsuite/script_test_4.sh: Permit leading zeroes.
1157 2008-04-15 Ian Lance Taylor <iant@google.com>
1159 * script-sections.cc (Script_sections::create_segments): Use
1160 header_size_adjustment even when there is enough room for the
1162 * testsuite/script_test_4.sh: New file.
1163 * testsuite/script_test_4.t: New file.
1164 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
1165 (check_DATA): Add script_test_4.stdout.
1166 (MOSTLYCLEANFILES): Likewise.
1167 (script_test_4): New target.
1168 (script_test_4.stdout): New target.
1169 * testsuite/Makefile.in: Rebuild.
1171 * sparc.cc: Add definitions for Output_data_plt_sparc class
1174 2008-04-14 David S. Miller <davem@davemloft.net>
1176 * sparc.cc: New file.
1177 * Makefile.am (TARGETSOURCES): Add sparc.cc
1178 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
1179 * configure.tgt: Document targ_extra_size and
1180 targ_extra_big_endian. Add entries for sparc-* and
1182 * configure.ac: Handle targ_extra_size and
1183 targ_extra_big_endian.
1184 * Makefile.in: Rebuild.
1185 * configure: Likewise.
1186 * po/POTFILES.in: Likewise.
1187 * po/gold.pot: Likewise.
1189 2008-04-14 Ian Lance Taylor <iant@google.com>
1191 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
1192 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
1193 in the name/type/flags to section mapping. Don't call
1194 allocate_output_section.
1195 (Layout::choose_output_section): Change parameter from adjust_name
1196 to is_input_section. Don't permit input sections after sections
1197 are attached to segments. Don't call allocate_output_section.
1198 (Layout::layout_eh_frame): Call update_flags_for_input_section,
1199 not write_enable_output_section.
1200 (Layout::make_output_section): Don't push to
1201 unattached_section_list_ nor call attach_to_segment. Call
1202 attach_section_to_segment if sections are attached.
1203 (Layout::attach_sections_to_segments): New function.
1204 (Layout::attach_section_to_segment): New function.
1205 (Layout::attach_allocated_section_to_segment): Rename from
1206 attach_to_segment. Remove flags parameter.
1207 (Layout::allocate_output_section): Remove function.
1208 (Layout::write_enable_output_section): Remove function.
1209 * layout.h (class Layout): Update for above changes. Add new
1210 field sections_are_attached_.
1211 * output.h (Output_section::update_flags_for_input_section): New
1213 * output.cc (Output_section::add_input_section): Call
1214 update_flags_for_input_section.
1215 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
1217 2008-04-11 Cary Coutant <ccoutant@google.com>
1219 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
1220 thought unnecessary.
1221 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
1223 2008-04-11 Ian Lance Taylor <iant@google.com>
1225 * output.h (class Output_section_data): Remove inline definition
1227 * output.cc (Output_section_data::set_addralign): New function.
1229 2008-04-11 Cary Coutant <ccoutant@google.com>
1231 Add support for TLS descriptors for i386 and x86_64.
1232 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
1233 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
1234 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
1236 (Target_i386::got_mod_index_entry): Remove unnecessary code.
1237 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
1238 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
1240 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
1241 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
1242 Fix problem with initial-exec relocations.
1243 (Target_i386::Relocate::relocate_tls): Likewise.
1244 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
1246 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
1247 support for section-plus-offset dynamic table entries.
1248 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
1249 (Output_data_dynamic::Dynamic_entry): Add support for
1250 section-plus-offset dynamic table entries.
1251 (Output_data_dynamic::Classification): Likewise.
1252 (Output_data_dynamic::classification_): Renamed offset_.
1253 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
1254 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
1255 (Target_x86_64::make_plt_section): New function.
1256 (Target_x86_64::reserve_tlsdesc_entries): New function.
1257 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
1258 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
1259 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
1260 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
1261 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
1262 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
1263 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
1264 add extra PLT entry for TLS descriptors.
1265 (Output_data_plt_x86_64::got_): New field.
1266 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
1267 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
1269 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
1271 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
1272 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
1273 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
1274 R_386_TLS_DESC_CALL relocations.
1275 (Target_x86_64::Scan::global): Likewise.
1276 (Target_x86_64::do_finalize_sections): Add dynamic table entries
1277 for TLS descriptors.
1278 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
1279 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
1280 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
1281 GD-to-IE relaxation.
1282 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
1283 and TLS_DESCRIPTORS.
1284 * Makefile.in: Rebuild.
1285 * configure: Rebuild.
1286 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
1287 (tls_test_shared2.so): New target.
1288 (tls_shared_gd_to_ie_test_SOURCES): New variable.
1289 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
1290 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
1291 (tls_shared_gd_to_ie_test_LDADD): New variable.
1292 (tls_shared_gnu2_gd_to_ie_test): New target.
1293 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
1295 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
1296 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
1297 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
1298 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
1299 (tls_shared_gnu2_test): New target.
1300 (tls_test_gnu2_shared.so): New target.
1301 (tls_shared_gnu2_test_SOURCES): New variable.
1302 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
1303 (tls_shared_gnu2_test_LDFLAGS): New variable.
1304 (tls_shared_gnu2_test_LDADD): New variable.
1305 * testsuite/Makefile.in: Rebuild.
1306 * testsuite/Makefile.
1308 2008-04-11 Ian Lance Taylor <iant@google.com>
1310 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
1312 * testsuite/Makefile.in: Rebuild.
1314 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
1316 * testsuite/script_test_2.cc (main): Adjust test.
1318 2008-04-11 David S. Miller <davem@davemloft.net>
1319 Ian Lance Taylor <iant@google.com>
1321 * options.h (General_options): Add entries for '-Y' and
1323 * options.cc (General_options:finalize): If -Y was used, add those
1324 entries to the library path instead of the default "/lib" and
1327 2008-04-11 David S. Miller <davem@davemloft.net>
1329 * testsuite/justsyms.t: Start at 0x100.
1330 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
1331 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
1333 * testsuite/script_test_2.cc: Adjust string and section length
1336 2008-04-09 Ian Lance Taylor <iant@google.com>
1339 * script-sections.cc (Sections_element::allocate_to_segment): Add
1341 (Output_section_definition::allocate_to_segment): Likewise.
1342 (Orphan_output_section::allocate_to_segment): Likewise.
1343 (Script_sections::attach_sections_using_phdrs_clause): Don't
1344 propagate non-PT_LOAD segments to orphan sections.
1345 * testsuite/Makefile.am (script_test_3.stdout): Generate using
1346 readelf rather than objdump.
1347 * testsuite/script_test_3.sh: Adjust accordingly. Test that
1348 .interp section and PT_INTERP segment are the same size.
1349 * testsuite/Makefile.in: Rebuild.
1351 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
1352 aliases for symbols defined in the same object.
1353 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
1354 (weak_alias_test_SOURCES): New variable.
1355 (weak_alias_test_DEPENDENCIES): New variable.
1356 (weak_alias_test_LDFLAGS): New variable.
1357 (weak_alias_test_LDADD): New variable.
1358 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
1359 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
1360 (weak_alias_test_3.o): New target.
1361 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
1362 * testsuite/weak_alias_test_main.cc: New file.
1363 * testsuite/weak_alias_test_1.cc: New file.
1364 * testsuite/weak_alias_test_2.cc: New file.
1365 * testsuite/weak_alias_test_3.cc: New file.
1367 2008-04-08 Ian Lance Taylor <iant@google.com>
1369 * options.h (class General_options): Add --noinhibit-exec option.
1370 * main.cc (main): Check --noinhibit-exec.
1372 * options.h (class General_options): Define --wrap as a special
1373 option. Add wrap_symbols_ field.
1374 (General_options::any_wrap_symbols): New function.
1375 (General_options::is_wrap_symbol): New function.
1376 * options.cc (General_options::parse_wrap): New function.
1377 (General_options::General_options): Initialize wrap_symbols_.
1378 * symtab.cc (Symbol_table::wrap_symbol): New function.
1379 (Symbol_table::add_from_object): Handle --wrap.
1380 * symtab.h (class Symbol_table): Declare wrap_symbol.
1381 * target.h (Target::wrap_char): New function.
1382 (Target::Target_info): Add wrap_char field.
1383 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
1384 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1385 * testsuite/testfile.cc (Target_test::test_target_info):
1388 * errors.cc (Errors::undefined_symbol): Mention symbol version if
1391 * layout.h (class Layout): Add added_eh_frame_data_ field.
1392 * layout.cc (Layout::Layout): Initialize new field.
1393 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
1394 output section until we find a section we merged successfully.
1395 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
1396 that the size be non-zero.
1398 * merge.cc (Object_merge_map::get_output_offset): Remove inline
1401 2008-04-08 Craig Silverstein <csilvers@google.com>
1403 * configure.ac: Export new conditional variable HAVE_ZLIB.
1404 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
1406 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
1407 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
1409 2008-04-07 Ian Lance Taylor <iant@google.com>
1411 * version.cc (version_string): Set to "1.5".
1413 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
1414 Add issued_non_pic_error_ field. Declare check_non_pic.
1415 (Target_x86_64::Scan::check_non_pic): New function.
1416 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
1417 (Target_x86_64::Scan::global): Likewise.
1419 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
1420 addend parameter. Change caller. Handle merge sections.
1421 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
1422 Address to Addend. Don't add in the result of
1423 local_section_offset, pass down the addend and use the returned
1425 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
1426 Update declarations of local_section_offset and symbol_value.
1427 * testsuite/two_file_test_1.cc (t18): New function.
1428 * testsuite/two_file_test_2.cc (f18): New function.
1429 * testsuite/two_file_test_main.cc (main): Call t18.
1430 * testsuite/two_file_test.h (t18, f18): Declare.
1432 * configure.ac: Don't test for objdump, c++filt, or readelf.
1433 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
1435 (TEST_READELF): New variable.
1436 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
1437 (check_PROGRAMS): Add two_file_strip_test.
1438 (two_file_strip_test): New target.
1439 (check_PROGRAMS): Add two_file_same_shared_strip_test.
1440 (two_file_same_shared_strip_test_SOURCES): New variable.
1441 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
1442 (two_file_same_shared_strip_test_LDFLAGS): New variable.
1443 (two_file_same_shared_strip_test_LDADD): New variable.
1444 (two_file_shared_strip.so): New target.
1445 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
1446 (ver_test_5.syms, ver_test_7.syms): Likewise.
1447 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
1448 (strip_test_3.stdout): Use TEST_OBJDUMP.
1449 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
1451 2008-04-04 Cary Coutant <ccoutant@google.com>
1453 * symtab.h (Symbol::is_weak_undefined): New function.
1454 (Symbol::is_strong_undefined): New function.
1455 (Symbol::is_absolute): New function.
1456 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
1457 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
1459 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
1460 (weak_undef_test): New target.
1461 * testsuite/Makefile.in: Rebuild.
1462 * testsuite/weak_undef_file1.cc: New file.
1463 * testsuite/weak_undef_file2.cc: New file.
1464 * testsuite/weak_undef_test.cc: New file.
1466 2008-04-03 Craig Silverstein <csilvers@google.com>
1468 * compressed_output.h (class Output_compressed_section): Use
1470 * compressed_output.cc (zlib_compress): Use unsigned buffers,
1472 (zlib_compressed_suffix): Removed.
1473 (Output_compressed_section::set_final_data_size): Use unsigned
1475 * testsuite/Makefile.am (flagstest_compress_debug_sections):
1476 Fix linker invocation.
1477 (flagstest_o_specialfile_and_compress_debug_sections):
1479 * testsuite/Makefile.in: Regenerated.
1481 2008-04-02 David S. Miller <davem@davemloft.net>
1483 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
1484 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
1486 2008-04-02 Craig Silverstein <csilvers@google.com>
1490 2008-04-02 Ian Lance Taylor <iant@google.com>
1492 * fileread.cc (File_read::find_view): Add byteshift and vshifted
1493 parameters. Update for new key type to views_. Change all
1495 (File_read::read): Adjust for byteshift in returned view.
1496 (File_read::add_view): New function, broken out of
1498 (File_read::make_view): New function, broken out of
1500 (File_read::find_or_make_view): Add offset and aligned
1501 parameters. Rewrite accordingly. Change all callers.
1502 (File_read::get_view): Add offset and aligned parameters. Adjust
1503 for byteshift in return value.
1504 (File_read::get_lasting_view): Likewise.
1505 * fileread.h (class File_read): Update declarations.
1506 (class File_read::View): Add byteshift_ field. Add byteshift to
1507 constructor. Add byteshift method.
1508 * archive.h (Archive::clear_uncached_views): New function.
1509 (Archive::get_view): Add aligned parameter. Change all callers.
1510 * object.h (Object::get_view): Add aligned parameter. Change all
1512 (Object::get_lasting_view): Likewise.
1514 * fileread.cc (File_read::release): Don't call clear_views if
1515 there are multiple objects.
1516 * fileread.h (File_read::clear_uncached_views): New function.
1517 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
1520 2008-03-31 Cary Coutant <ccoutant@google.com>
1522 Add thin archive support.
1523 * archive.cc (Archive::armagt): New const.
1524 (Archive::setup): Remove task parameter and calls to unlock.
1525 (Archive::unlock_nested_archives): New function.
1526 (Archive::read_header): Add nested_off parameter. Change
1528 (Archive::interpret_header): Likewise.
1529 (Archive::include_all_members): Change to handle thin
1531 (Archive::include_member): Likewise.
1532 * archive.h (Archive::Archive): Add new parameters and
1534 (Archive::armagt): New const.
1535 (Archive::setup): Remove task parameter.
1536 (Archive::unlock_nested_archives): New function.
1537 (Archive::read_header): Add nested_off parameter.
1538 (Archive::interpret_header): Likewise.
1539 (Archive::Nested_archive_table): New typedef.
1540 (Archive::is_thin_archive_): New field.
1541 (Archive::nested_archives_): New field.
1542 (Archive::options_): New field.
1543 (Archive::dirpath_): New field.
1544 (Archive::task_): New field.
1545 * readsyms.cc (Read_symbols::do_read_symbols): Add check
1546 for thin archives. Pass additional parameters to
1547 Archive::Archive. Unlock the archive file after calling
1550 2008-03-29 Ian Lance Taylor <iant@google.com>
1552 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
1553 version symbol to be local.
1554 * testsuite/ver_test_4.sh: New file.
1555 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
1556 (check_DATA): Add ver_test_4.syms.
1557 (ver_test_4.syms): New target.
1558 * testsuite/Makefile.in: Rebuild.
1561 (Output_section::Input_section_sort_entry::has_priority): New
1563 (Output_section::Input_section_sort_entry::match_file_name): New
1565 (Output_section::Input_section_sort_entry::match_section_name):
1567 (Output_section::Input_section_sort_entry::match_section_name_prefix):
1569 (Output_section::Input_section_sort_entry::match_section_file):
1571 (Output_section::Input_section_sort_compare::operator()): Rewrite
1572 using new Input_section_sort_entry functions. Sort crtbegin and
1573 crtend first. Sort sections with no priority before sections with
1575 * testsuite/initpri1.c (d3): Check j != 4.
1576 (cd5): New constructor/destructor function.
1577 (main): Check j != 2.
1579 * symtab.cc (Symbol_table::add_from_object): If we don't use the
1580 new symbol when resolving, don't call set_is_default.
1581 * testsuite/ver_test_7.cc: New file.
1582 * testsuite/ver_test_7.sh: New file.
1583 * testsuite/Makefile.am (ver_test_7.so): New target.
1584 (ver_test_7.o): New target.
1585 (check_SCRIPTS): Add ver_test_7.sh.
1586 (check_DATA): Add ver_test_7.syms.
1587 (ver_test_7.syms): New target.
1589 2008-03-28 Ian Lance Taylor <iant@google.com>
1591 * layout.cc (Layout::layout): If we see an input section with a
1592 name that needs sorting, set the must_sort flag for the output
1594 (Layout::make_output_section): If the name of the output section
1595 indicates that it might require sorting, set the may_sort flag.
1596 * output.h (Output_section::may_sort_attached_input_sections): New
1598 (Output_section::set_may_sort_attached_input_sections): New
1600 (Output_section::must_sort_attached_input_sections): New
1602 (Output_section::set_must_sort_attached_input_sections): New
1604 (class Output_section): Declare Input_section_sort_entry. Define
1605 Input_section_sort_compare. Declare
1606 sort_attached_input_sections. Add new fields:
1607 may_sort_attached_input_sections_,
1608 must_sort_attached_input_sections_,
1609 attached_input_sections_are_sorted_.
1610 * output.cc (Output_section::Output_section): Initialize new
1612 (Output_section::add_input_section): Add an entry to
1613 input_sections_ if may_sort or must_sort are true.
1614 (Output_section::set_final_data_size): Call
1615 sort_attached_input_sections if necessary.
1616 (Output_section::Input_section_sort_entry): Define new class.
1617 (Output_section::Input_section_sort_compare::operator()): New
1619 (Output_section::sort_attached_input_sections): New function.
1620 * configure.ac: Check whether the compiler supports constructor
1621 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
1622 * testsuite/initpri1.c: New file.
1623 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
1624 CONSTRUCTOR_PRIORITY.
1625 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
1626 (initpri1_LDFLAGS): New variable.
1627 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
1629 2008-03-27 Ian Lance Taylor <iant@google.com>
1631 * common.cc (Sort_commons::operator): Correct sorting algorithm.
1632 * testsuite/common_test_1.c: New file.
1633 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
1634 (common_test_1_SOURCES): New variable.
1635 (common_test_1_DEPENDENCIES): New variable.
1636 (common_test_1_LDFLAGS): New variable.
1638 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
1639 and commons_ correctly when NAME/VERSION does not override
1641 * testsuite/ver_test_6.c: New file.
1642 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
1643 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
1644 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
1646 2008-03-26 Ian Lance Taylor <iant@google.com>
1648 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
1649 of an undefined symbol from a version script.
1650 * testsuite/Makefile.am (ver_test_5.so): New target.
1651 (ver_test_5.o): New target.
1652 (check_SCRIPTS): Add ver_test_5.sh.
1653 (check_DATA): Add ver_test_5.syms.
1654 (ver_test_5.syms): New target.
1655 * testsuite/ver_test_5.cc: New file.
1656 * testsuite/ver_test_5.script: New file.
1657 * testsuite/ver_test_5.sh: New file.
1658 * Makefile.in, testsuite/Makefile.in: Rebuild.
1661 Fix problems building gold with gcc 4.3.0.
1662 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
1663 (gold_error_at_location, gold_warning_at_location): Use it.
1664 * configure.ac: Check whether we can compile and use a template
1665 function with a printf attribute.
1666 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
1667 when jumping over bytes.
1668 * object.cc: Instantiate Object::read_section_data.
1669 * debug.h: Include <cstring>
1670 * dwarf_reader.cc: Include <algorithm>
1671 * main.cc: Include <cstring>.
1672 * options.cc: Include <cstring>.
1673 * output.cc: Include <cstring>.
1674 * script.cc: Include <cstring>.
1675 * script.h: Include <string>.
1676 * symtab.cc: Include <cstring> and <algorithm>.
1677 * target-select.cc: Include <cstring>.
1678 * version.cc: Include <string>.
1679 * testsuite/testmain.cc: Include <cstdlib>.
1680 * configure, config.in: Rebuild.
1682 2008-03-25 Ian Lance Taylor <iant@google.com>
1684 * options.cc: Include "../bfd/bfdver.h".
1685 (options::help): Print bug reporting address.
1687 * version.cc (print_version): Adjust output for current value of
1692 * options.cc (options::help): Print list of supported targets.
1693 * target-select.h: Include <vector>.
1694 (class Target_selector): Make machine_, size_, and is_big_endian_
1695 fields const. Add bfd_name_ and instantiated_target_ fields.
1696 (Target_selector::Target_selector): Add bfd_name parameter.
1697 (Target_selector::recognize): Make non-virtual, call
1699 (Target_selector::recognize_by_name): Make non-virtual, call
1700 do_recognize_by_name.
1701 (Target_selector::supported_names): New function.
1702 (Target_selector::bfd_name): New function.
1703 (Target_selector::do_instantiate_target): New pure virtual
1705 (Target_selector::do_recognize): New virtual function.
1706 (Target_selector::do_recognize_by_name): New virtual function.
1707 (Target_selector::instantiate_target): New private function.
1708 (supported_target_names): Declare.
1709 * target-select.cc (Target_selector::Target_selector): Update for
1710 new parameter and fields.
1711 (select_target_by_name): Check that the name matches before
1712 calling recognize_by_name.
1713 (supported_target_names): New function.
1714 * i386.cc (class Target_selector_i386): Update Target_selector
1715 constructor call. Remove recognize and recognize_by_name. Add
1716 do_instantiate_target.
1717 * x86_64.cc (class Target_selector_x86_64): Likewise.
1718 * testsuite/testfile.cc (class Target_selector_test): Update for
1719 changes to Target_selector.
1721 * README: Rewrite, with some notes on unsupported features.
1723 2008-03-24 Cary Coutant <ccoutant@google.com>
1725 * i386.cc (Target_i386::Got_type): New enum declaration.
1726 (Target_i386::Scan::local): Updated callers of Output_data_got
1728 (Target_i386::Scan::global): Likewise.
1729 (Target_i386::Relocate::relocate): Likewise.
1730 (Target_i386::Relocate::relocate_tls): Likewise.
1731 * object.h (Got_offset_list): New class.
1732 (Sized_relobj::local_has_got_offset): Added got_type parameter.
1733 (Sized_relobj::local_got_offset): Likewise.
1734 (Sized_relobj::set_local_got_offset): Likewise.
1735 (Sized_relobj::local_has_tls_got_offset): Removed.
1736 (Sized_relobj::local_tls_got_offset): Removed.
1737 (Sized_relobj::set_local_tls_got_offset): Removed.
1738 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
1739 * output.cc (Output_data_got::add_global): Added got_type parameter.
1740 (Output_data_got::add_global_with_rel): Likewise.
1741 (Output_data_got::add_global_with_rela): Likewise.
1742 (Output_data_got::add_global_pair_with_rel): New function.
1743 (Output_data_got::add_global_pair_with_rela): New function.
1744 (Output_data_got::add_local): Added got_type parameter.
1745 (Output_data_got::add_local_with_rel): Likewise.
1746 (Output_data_got::add_local_with_rela): Likewise.
1747 (Output_data_got::add_local_pair_with_rel): New function.
1748 (Output_data_got::add_local_pair_with_rela): New function.
1749 (Output_data_got::add_global_tls): Removed.
1750 (Output_data_got::add_global_tls_with_rel): Removed.
1751 (Output_data_got::add_global_tls_with_rela): Removed.
1752 (Output_data_got::add_local_tls): Removed.
1753 (Output_data_got::add_local_tls_with_rel): Removed.
1754 (Output_data_got::add_local_tls_with_rela): Removed.
1755 * output.h (Output_data_got::add_global): Added got_type parameter.
1756 (Output_data_got::add_global_with_rel): Likewise.
1757 (Output_data_got::add_global_with_rela): Likewise.
1758 (Output_data_got::add_global_pair_with_rel): New function.
1759 (Output_data_got::add_global_pair_with_rela): New function.
1760 (Output_data_got::add_local): Added got_type parameter.
1761 (Output_data_got::add_local_with_rel): Likewise.
1762 (Output_data_got::add_local_with_rela): Likewise.
1763 (Output_data_got::add_local_pair_with_rel): New function.
1764 (Output_data_got::add_local_pair_with_rela): New function.
1765 (Output_data_got::add_global_tls): Removed.
1766 (Output_data_got::add_global_tls_with_rel): Removed.
1767 (Output_data_got::add_global_tls_with_rela): Removed.
1768 (Output_data_got::add_local_tls): Removed.
1769 (Output_data_got::add_local_tls_with_rel): Removed.
1770 (Output_data_got::add_local_tls_with_rela): Removed.
1771 * resolve.cc (Symbol::override_base_with_special): Removed
1772 reference to has_got_offset_ field.
1773 * symtab.cc (Symbol::init_fields): Replaced initialization
1774 of got_offset_ with got_offsets_. Removed initialization
1776 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
1777 (Symbol::got_offset): Likewise.
1778 (Symbol::set_got_offset): Likewise.
1779 (Symbol::has_tls_got_offset): Removed.
1780 (Symbol::tls_got_offset): Removed.
1781 (Symbol::set_tls_got_offset): Removed.
1782 (Symbol::got_offset_): Removed.
1783 (Symbol::tls_mod_got_offset_): Removed.
1784 (Symbol::tls_pair_got_offset_): Removed.
1785 (Symbol::got_offsets_): New field.
1786 (Symbol::has_got_offset): Removed.
1787 (Symbol::has_tls_mod_got_offset): Removed.
1788 (Symbol::has_tls_pair_got_offset): Removed.
1789 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
1790 (Target_x86_64::Scan::local): Updated callers of Output_data_got
1792 (Target_x86_64::Scan::global): Likewise.
1793 (Target_x86_64::Relocate::relocate): Likewise.
1794 (Target_x86_64::Relocate::relocate_tls): Likewise.
1796 2008-03-25 Ben Elliston <bje@au.ibm.com>
1798 * yyscript.y: Fix spelling error in comment.
1800 2008-03-24 Ian Lance Taylor <iant@google.com>
1802 * options.h (class General_options): Define build_id option.
1803 * layout.h (class Layout): Declare write_build_id, create_note,
1804 create_build_id. Add build_id_note_ member.
1805 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
1806 "libiberty.h", "md5.h", "sha1.h".
1807 (Layout::Layout): Initialize eh_frame_data_,
1808 eh_frame_hdr_section_, and build_id_note_.
1809 (Layout::finalize): Call create_build_id.
1810 (Layout::create_note): New function, broken out of
1811 Layout::create_gold_note.
1812 (Layout::create_gold_note): Call create_note.
1813 (Layout::create_build_id): New function.
1814 (Layout::write_build_id): New function.
1815 (Close_task_runner::run): Call write_build_id.
1817 * x86_64.cc: Correct license to GPLv3.
1819 2008-03-23 Ian Lance Taylor <iant@google.com>
1821 * options.cc: Include "demangle.h".
1822 (parse_optional_string): New function.
1823 (parse_long_option): Handle takes_optional_argument.
1824 (parse_short_option): Update dash_z initializer. Handle
1825 takes_optional_argument.
1826 (General_options::General_options): Initialize do_demangle_.
1827 (General_options::finalize): Set do_demangle_. Handle demangling
1829 * options.h (parse_optional_string): Declare.
1830 (struct One_option): Add optional_arg field. Update constructor.
1831 Update call constructor calls. Add takes_optional_argument
1833 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
1834 (DEFINE_optional_string): Define.
1835 (General_options::demangle): Change from DEFINE_bool to
1836 DEFINE_optional_string.
1837 (General_options::no_demangle): New function.
1838 (General_options::do_demangle): New function.
1839 (General_options::set_do_demangle): New function.
1840 (General_options::execstack_status_): Move definition to end of
1842 (General_options::static_): Likewise.
1843 (General_options::do_demangle_): New field.
1844 * object.cc (big_endian>::get_symbol_location_info): Call
1845 Options::do_demangle, not Options::demangle.
1846 * symtab.cc (demangle): Likewise.
1848 2008-03-22 Ian Lance Taylor <iant@google.com>
1850 * gold.h: Include <cstddef> and <sys/types.h>
1851 * options.h: Include <cstring>.
1853 2008-03-21 Ian Lance Taylor <iant@google.com>
1855 * Added source code to GNU binutils.