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