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