1 2008-11-14 Cary Coutant <ccoutant@google.com>
3 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
6 2008-11-05 Craig Silverstein <csilvers@google.com>
8 * options.cc (General_options::parse_dynamic_list): New function.
9 * options.h (General_options): New flags dynamic_list,
10 dynamic_list_data, dynamic_list_cpp_new, and
11 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
12 (General_options::in_dynamic_list): New function.
13 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
14 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
15 (Lex::can_continue_name): Likewise.
17 (read_script_file): New parameter script_options.
18 (read_dynamic_list): New function.
19 (Script_options::define_dynamic_list): New function.
20 (dynamic_list_keyword_parsecodes): New variable.
21 (dynamic_list_keywords): New variable.
22 * script.h (Script_options::define_dynamic_list): New function
24 (read_dynamic_list): New function prototype.
25 * symtab.cc (strprefix): New macro.
26 (Symbol::should_add_dynsym_entry): Support dynamic_list,
27 dynamic_list_data, dynamic_list_cpp_new, and
28 dynamic_list_cpp_typeinfo.
29 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
30 (dynamic_list_expr): New rule.
31 (dynamic_list_nodes): Likewise.
32 (dynamic_list_node): Likewise.
33 * testsuite/Makefile.am (dynamic_list): New test.
34 * testsuite/Makefile.in: Regenerated.
35 * testsuite/dynamic_list.t: New file.
36 * testsuite/dynamic_list.sh: New file.
38 2008-11-05 Craig Silverstein <csilvers@google.com>
40 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
41 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
43 * testsuite/ver_test_6.c (main): Likewise.
45 2008-10-07 Cary Coutant <ccoutant@google.com>
47 * options.c (General_options::finalize): Add check for -static and
49 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
52 2008-10-02 Cary Coutant <ccoutant@google.com>
54 * plugin.cc (make_sized_plugin_object): Fix conditional
55 compilation to work when not all targets are enabled.
57 2008-09-29 Cary Coutant <ccoutant@google.com>
59 * archive.cc (Archive::get_file_and_offset): Use filename instead
60 of name to get library path.
61 (Archive::include_member): Unlock external member of a thin archive.
63 * testsuite/Makefile.am (TEST_AR): New variable.
64 (thin_archive_test_1): New test.
65 (thin_archive_test_2): New test.
66 * testsuite/Makefile.in: Regenerate.
67 * testsuite/thin_archive_main.cc: New file.
68 * testsuite/thin_archive_test_1.cc: New file.
69 * testsuite/thin_archive_test_2.cc: New file.
70 * testsuite/thin_archive_test_3.cc: New file.
71 * testsuite/thin_archive_test_4.cc: New file.
73 2008-09-29 Cary Coutant <ccoutant@google.com>
75 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
76 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
78 (Sized_relobj::do_finalize_local_symbols): Likewise.
79 (Sized_relobj::map_to_kept_section): Likewise.
80 * object.h (Sized_relobj::invalid_address): New constant.
81 (Sized_relobj::do_output_section_offset): Check for invalid_address
83 * output.cc (Output_reloc::local_section_offset): Use constant
84 invalid_address instead of -1U.
85 (Output_reloc::get_address): Likewise.
86 (Output_section::output_address): Change -1U to -1ULL.
87 * output.h (Output_reloc::invalid_address): New constant.
88 * reloc.cc (Sized_relobj::write_sections): Use constant
89 invalid_address instead of -1U.
90 (Sized_relobj::relocate_sections): Likewise.
91 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
92 values for merge sections.
93 * target-reloc.h (relocate_for_relocatable): Use constant
94 invalid_address instead of -1U.
96 2008-09-19 Cary Coutant <ccoutant@google.com>
98 Add plugin functionality for link-time optimization (LTO).
99 * configure.ac (plugins): Add --enable-plugins option.
100 * configure: Regenerate.
101 * config.in: Regenerate.
102 * Makefile.am (LIBDL): New variable.
103 (CCFILES): Add plugin.cc.
104 (HFILES): Add plugin.h.
105 (ldadd_var): Add LIBDL.
106 * Makefile.in: Regenerate.
108 * archive.cc: Include "plugin.h".
109 (Archive::setup): Don't preread archive symbols when using a plugin.
110 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
111 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
113 (Archive::include_member): Add symbols from plugin objects.
114 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
115 * descriptors.cc (Descriptors::open): Check for file descriptors
116 abandoned by plugins.
117 (Descriptors::claim_for_plugin): New function.
118 * descriptors.h (Descriptors::claim_for_plugin): New function.
119 (Open_descriptor::is_claimed): New field.
120 (claim_descriptor_for_plugin): New function.
121 * fileread.cc (File_read::claim_for_plugin): New function.
122 * fileread.h (File_read::claim_for_plugin): New function.
123 (File_read::descriptor): New function.
124 * gold.cc: Include "plugin.h".
125 (queue_initial_tasks): Add task to call plugin hooks for generating
127 * main.cc: Include "plugin.h".
128 (main): Load plugin libraries.
129 * object.h (Pluginobj): Declare.
130 (Object::pluginobj): New function.
131 (Object::do_pluginobj): New function.
132 (Object::set_target): New function.
133 * options.cc: Include "plugin.h".
134 (General_options::parse_plugin): New function.
135 (General_options::General_options): Initialize plugins_ field.
136 (General_options::add_plugin): New function.
137 * options.h (Plugin_manager): Declare.
138 (General_options): Add --plugin option.
139 (General_options::has_plugins): New function.
140 (General_options::plugins): New function.
141 (General_options::add_plugin): New function.
142 (General_options::plugins_): New field.
143 * plugin.cc: New file.
144 * plugin.h: New file.
145 * readsyms.cc: Include "plugin.h".
146 (Read_symbols::do_read_symbols): Check for archive before checking
147 for ELF file. Call plugin hooks to claim files.
148 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
149 from a real object file; force override when processing replacement
151 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
152 (Symbol::init_base_object): Likewise.
153 (Symbol::init_base_output_data): Likewise.
154 (Symbol::init_base_output_segment): Likewise.
155 (Symbol::init_base_constant): Likewise.
156 (Symbol::init_base_undefined): Likewise.
157 (Symbol::output_section): Assert that object is not a plugin.
158 (Symbol_table::add_from_pluginobj): New function.
159 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
161 (Symbol_table::sized_write_globals): Likewise.
162 (Symbol_table::add_from_pluginobj): Instantiate template.
163 * symtab.h (Sized_pluginobj): Declare.
164 (Symbol::in_real_elf): New function.
165 (Symbol::set_in_real_elf): New function.
166 (Symbol::in_real_elf_): New field.
167 (Symbol_table::add_from_pluginobj): New function.
169 * testsuite/Makefile.am (AM_CFLAGS): New variable.
170 (LIBDL): New variable.
172 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
173 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
174 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
175 (MOSTLYCLEANFILES): Likewise.
176 * testsuite/Makefile.in: Regenerate.
177 * testsuite/plugin_test.c: New file.
178 * testsuite/plugin_test_1.sh: New file.
179 * testsuite/plugin_test_2.sh: New file.
181 2008-09-16 Ian Lance Taylor <iant@google.com>
183 * target-reloc.h (relocate_section): Check whether a symbol is
184 defined by the ABI before reporting an undefined symbol error.
185 * target.h (Target::is_defined_by_abi): Make parameter const.
186 (Target::do_is_defined_by_abi): Likewise.
187 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
188 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
189 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
190 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
191 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
192 * testsuite/Makefile.in: Rebuild.
194 * fileread.cc (make_view): Add casts to avoid warning.
196 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
198 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
199 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
201 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
203 * options.h (General_options::output_is_executable): New.
204 (General_options::output_is_pie): New.
205 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
206 for shared libraries.
207 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
209 2008-09-11 Chris Demetriou <cgd@google.com>
211 * options.h (origin): New -z option.
212 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
213 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
216 2008-09-05 Cary Coutant <ccoutant@google.com>
218 * fileread.cc (File_read::make_view): Add check for attempt to map
221 2008-09-05 Cary Coutant <ccoutant@google.com>
223 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
224 explicit instantiations.
226 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
229 * options.cc (General_options::finalize): Allow undefined symbols
230 in shlibs if linking -shared.
233 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
234 symbols as not needing a dynsym entry.
236 2008-08-20 Craig Silverstein <csilvers@google.com>
238 * fileread.cc (File_read::open): Do not lock the file unless it
239 was successfully opened.
241 2008-08-14 Cary Coutant <ccoutant@google.com>
243 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
244 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
245 * testsuite/tls_test.cc (struct int128): 128-bit struct
246 for testing TLS relocs with non-zero addend.
247 (v12): New TLS variable.
249 (t_last): Add check for v12.
250 * testsuite/tls_test.h (t12): New function.
251 * testsuite/tls_test_main.cc (thread_routine): Call new test.
253 2008-08-13 Ian Lance Taylor <iant@google.com>
255 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
256 set tls_segment_ or relro_segment_.
257 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
259 * output.h (Output_section::clear_is_relro): New function.
260 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
261 sections specially even when output_data_ is empty.
262 (Output_segment::maximum_alignment): When first section is relro,
263 only force alignment for PT_LOAD segments.
264 * script.cc (script_data_segment_align): New function.
265 (script_data_segment_relro_end): New function.
266 * script-c.h (script_data_segment_align): Declare.
267 (script_data_segment_relro_end): Declare.
268 * script-sections.h (class Script_sections): Declare
269 data_segment_align and data_segment_relro_end. Add fields
270 segment_align_index_ and saw_relro_end_.
271 * script-sections.cc (class Sections_element): Add set_is_relro
272 virtual function. Add new bool* parameter to place_orphan_here.
273 Add get_output_section virtual function.
274 (class Output_section_definition): Add set_is_relro. Add new
275 bool* parameter to place_orphan_here. Add get_output_section.
277 (Output_section_definition::Output_section_definition): Initialize
278 evaluated_address_, evaluated_load_address, evaluated_addralign_,
279 and is_relro_ fields.
280 (Output_section_definition::place_orphan_here): Add is_relro
282 (Output_section_definition::set_section_addresses): Set relro for
284 (Output_section_definition::alternate_constraint): Likewise.
285 (class Orphan_output_section): Add new bool* parameter to
286 place_orphan_here. Add get_output_section.
287 (Orphan_output_section::place_orphan_here): Add is_relro
289 (Script_sections::Script_sections): Initialize
290 data_segment_align_index_ and saw_relro_end_.
291 (Script_sections::data_segment_align): New function.
292 (Script_sections::data_segment_relro_end): New function.
293 (Script_sections::place_orphan): Set or clear is_relro.
294 (Script_sections::set_section_addresses): Force alignment of first
296 * yyscript.y (exp): Call script_data_segment_align and
297 script_data_segment_relro_end.
298 * testsuite/relro_script_test.t: New file.
299 * testsuite/relro_test.cc (using_script): Declare.
300 (t1, t2): Test using_script.
301 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
302 (relro_script_test_SOURCES): Define.
303 (relro_script_test_DEPENDENCIES): Define.
304 (relro_script_test_LDFLAGS): Define.
305 (relro_script_test_LDADD): Define.
306 (relro_script_test.so): New target.
307 * testsuite/Makefile.in: Rebuild.
309 2008-08-06 Cary Coutant <ccoutant@google.com>
311 * archive.cc (Archive::total_archives, Archive::total_members)
312 (Archive::total_members_loaded): New variables.
313 (Archive::setup): Add parameter. Add option to preread
315 (Archive::read_armap): Add counter.
316 (Archive::get_file_and_offset): New function.
317 (Archive::get_elf_object_for_member): New function.
318 (Archive::read_all_symbols): New function.
319 (Archive::read_symbols): New function.
320 (Archive::add_symbols): Add counters.
321 (Archive::include_all_members): Use armap to find members if it's
323 (Archive::include_member): Skip reading symbols if already read.
324 Factored code into Archive::get_file_and_offset and
325 Archive::get_elf_object_for_member. Changed call to
326 Mapfile::report_include_archive_member.
327 (Archive::print_stats): New function.
328 * archive.h: Declare Object and Read_symbols_data classes.
329 (Archive::Archive): Add initializers for new members.
330 (Archive::setup): Add parameter.
331 (Archive::print_stats): New function.
332 (Archive::total_archives, Archive::total_members)
333 (Archive::total_members_loaded): New variables.
334 (Archive::get_file_and_offset): New function.
335 (Archive::get_elf_object_for_member): New function.
336 (Archive::read_all_symbols): New function.
337 (Archive::read_symbols): New function.
338 (Archive::Archive_member): New class.
339 (Archive::members_): New member.
340 (Archive::num_members_): New member.
341 * main.cc: Include archive.h.
342 (main): Call Archive::print_stats.
343 * mapfile.cc (Mapfile::report_include_archive_member): Delete
344 archive parameter; member_name is now the fully-decorated name.
345 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
346 * options.h: (General_options): Add --preread-archive-symbols option.
347 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
350 2008-08-04 Ian Lance Taylor <iant@google.com>
352 * symtab.h (Symbol::use_plt_offset): New function.
353 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
354 * powerpc.cc (Relocate::relocate): Likewise.
355 * sparc.cc (Relocate::relocate): Likewise.
356 * x86_64.cc (Relocate::relocate): Likewise.
357 * testsuite/weak_plt.sh: New test.
358 * testsuite/weak_plt_main.cc: New test.
359 * testsuite/weak_plt_shared.cc: New test.
360 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
361 (check_PROGRAMS): Add weak_plt.
362 (check_DATA): Add weak_plt_shared.so.
363 (weak_plt_main_pic.o, weak_plt): New targets.
364 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
365 * testsuite/Makefile.in: Rebuild.
367 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
369 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
370 * testsuite/Makefile.in: Rebuild.
372 2008-08-04 Alan Modra <amodra@bigpond.net.au>
374 * Makefile.am (POTFILES.in): Set LC_ALL=C.
375 * Makefile.in: Regenerate.
376 * po/POTFILES.in: Regenerate.
378 2008-07-29 Ian Lance Taylor <iant@google.com>
380 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
381 symbols before other symbols.
382 * testsuite/script_test_2.cc (test_addr): Declare.
383 (test_addr_alias): Declare.
384 (main): Check that test_addr and test_addr_alias have the right
386 * testsuite/script_test_2.t: Define test_addr_alias and
389 2008-07-24 Ian Lance Taylor <iant@google.com>
392 * descriptors.cc: New file.
393 * descriptors.h: New file.
394 * gold-threads.h (class Hold_optional_lock): New class.
395 * fileread.cc: Include "descriptors.h".
396 (File_read::~File_read): Release descriptor rather than closing
398 (File_read::open) [file]: Call open_descriptor rather than open.
399 Set is_descriptor_opened_.
400 (File_read::open) [memory]: Assert that descriptor is not open.
401 (File_read::reopen_descriptor): New function.
402 (File_read::release): Release descriptor.
403 (File_read::do_read): Make non-const. Reopen descriptor.
404 (File_read::read): Make non-const.
405 (File_read::make_view): Reopen descriptor.
406 (File_read::do_readv): Likewise.
407 * fileread.h (class File_read): Add is_descriptor_opened_ field.
409 * layout.cc: Include "descriptors.h".
410 (Layout::create_build_id): Use open_descriptor rather than open.
411 * output.cc: Include "descriptors.h".
412 (Output_file::open): Use open_descriptor rather than open.
413 * archive.cc (Archive::const_iterator): Change Archive to be
415 (Archive::begin, Archive::end): Make non-const.
416 (Archive::count_members): Likewise.
417 * archive.h (class Archive): Update declarations.
418 * object.h (Object::read): Make non-const.
419 * Makefile.am (CCFILES): Add descriptors.cc.
420 (HFILES): Add descriptors.h.
421 * Makefile.in: Rebuild.
424 * gold.h: Always include <clocale>. Add Solaris workarounds
425 following code in binutils/sysdep.h.
428 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
429 this->eh_frame_hdr_ is NULL before using it.
431 * dynobj.cc (Versions::Versions): Update comment.
433 * dynobj.cc (Versions::Versions): If there is an soname, use it as
434 the base version name.
436 * stringpool.cc (Stringpool_template::add_with_length): Set key to
438 (Stringpool_template::set_string_offsets): Subtract one from key
439 before using it as an array index.
440 (Stringpool_template::get_offset_with_length): Likewise.
441 (Stringpool_template::write_to_buffer): Likewise.
442 * stringpool.h (Stringpool_template::get_offset_from_key):
445 2008-07-23 Ian Lance Taylor <iant@google.com>
448 * object.h (Merged_symbol_value::value): Do our best to handle a
452 * script.cc (Version_script_info::get_versions): Don't add empty
453 version tag to return value.
454 (Version_script_info::get_symbol_version_helper): Change return
455 type to bool. Add pversion parameter. Change all callers.
456 (script_register_vers_node): Don't require a non-NULL tag.
457 * script.h (class Version_script_info): Update declarations.
458 (Version_script_info::get_symbol_version): Change return type to
459 bool. Add version parameter. Change all callers.
460 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
461 handling. Handle an empty version from a version script.
462 (Symbol_table::define_special_symbol): Likewise.
463 * testsuite/ver_test_10.script: New file.
464 * testsuite/ver_test_10.sh: New file.
465 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
466 (check_DATA): Add ver_test_10.syms.
467 (ver_test_10.syms, ver_test_10.so): New target.
468 * testsuite/Makefile.in: Rebuild.
470 2008-07-23 Simon Baldwin <simonb@google.com>
472 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
473 to zero for undefined symbols from dynamic libraries.
475 2008-07-23 Ian Lance Taylor <iant@google.com>
477 * symtab.cc (Symbol_table::resolve): Remove version parameter.
479 * symtab.h (class Symbol_table): Update declaration.
480 * testsuite/ver_test_9.cc: New file.
481 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
482 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
483 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
484 (ver_test_9.so, ver_test_9.o): New targets.
485 * testsuite/Makefile.in: Rebuild.
487 2008-07-22 Ian Lance Taylor <iant@google.com>
489 * options.h (class General_options): Define --check-sections.
490 * layout.cc (Layout::set_segment_offsets): Handle
493 * options.h (class General_options): Define -n/--nmagic and
495 * options.cc (General_options::finalize): For -n/--nmagic or
496 -N/--omagic, set -static.
497 * layout.cc (Layout::attach_allocated_section_to_segment): If
498 -N/--omagic, don't put read-only and read-write sections in
500 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
501 finding a read-only segment.
502 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
503 don't set the minimum segment alignment to the common page size,
504 and don't set the file offset to the address modulo the page size.
505 * script-sections.cc (Script_sections::create_segments): If
506 -n/--omagic, don't put read-only and read-write sections in
511 * options.h (class General_options): Add --print-symbol-counts.
512 * main.cc (main): Issue defined symbol report if requested.
513 * archive.cc (Archive::interpret_header): Make into a const member
515 (Archive::add_symbols): Call Input_objects::archive_start and
517 (Archive::const_iterator): Define new class.
518 (Archive::begin, Archive::end): New functions.
519 (Archive::include_all_members): Rewrite to use iterator.
520 (Archive::count_members): New function.
521 * archive.h (class Archive): Update declarations.
522 (Archive::filename): New function.
523 * object.cc: Include "cref.h".
524 (Sized_relobj::Sized_relobj): Initialize defined_count_.
525 (Sized_relobj::do_get_global_symbol_counts): New function.
526 (Input_objects::add_object): Add object to cross-referencer.
527 (Input_objects::archive_start): New function.
528 (Input_objects::archive_stop): New function.
529 (Input_objects::print_symbol_counts): New function.
530 * object.h: Declare Cref and Archive.
531 (Object::get_global_symbol_counts): New function.
532 (Object::do_get_global_symbol_counts): New pure virtual function.
533 (class Sized_relobj): Add defined_count_ field. Update
535 (class Input_objects): Add cref_ field. Update constructor.
537 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
539 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
541 (Sized_dynobj::do_get_global_symbol_counts): New function.
542 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
543 defined_count_. Update declarations. Define Symbols typedef.
544 * symtab.cc (Symbol_table::add_from_relobj): Add defined
545 parameter. Change all callers.
546 (Symbol_table::add_from_dynobj): Add sympointers and defined
547 parameters. Change all callers.
548 * symtab.h (class Symbol_table): Update declarations.
549 * Makefile.am (CCFILES): Add cref.cc.
550 (HFILES): Add cref.h.
551 * Makefile.in: Rebuild.
553 2008-07-22 Simon Baldwin <simonb@google.com>
555 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
556 to zero when writing undefined symbols.
558 2008-07-22 Ian Lance Taylor <iant@google.com>
560 * output.cc (Output_section::add_input_section): Don't try to
561 merge empty merge sections.
563 2008-07-21 Craig Silverstein <csilvers@google.com>
565 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
566 Include symbol version in error message.
568 2008-07-20 Chris Demetriou <cgd@google.com>
570 * configure.ac (gold_cv_c_random_seed): New configured variable.
571 (RANDOM_SEED_CFLAGS): New substituted variable.
572 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
573 * configure: Rebuild.
574 * Makefile.in: Likewise.
575 * testsuite/Makefile.in: Likewise.
577 2008-07-18 Ian Lance Taylor <iant@google.com>
579 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
580 where we see NAME/NULL and NAME/VERSION as separate symbols.
581 * testsuite/ver_test_main.cc (main): Call t4.
583 * testsuite/ver_test_2.cc (t4_2): Define.
584 * testsuite/ver_test_2.script: Put t4_2a in VER2.
585 * testsuite/ver_test_4.cc (t4_2a): Define.
586 * testsuite/ver_test_4.script: Put t4_2a in VER2.
587 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
589 2008-07-17 Ian Lance Taylor <iant@google.com>
591 * dynobj.cc (Versions::add_def): If we give an error about a
592 missing version, go ahead and create the version anyhow.
594 2008-07-10 Ian Lance Taylor <iant@google.com>
596 Handle output sections with more than 0x7fffffff bytes.
597 * object.h (class Relobj): Change map_to_output_ to
598 output_sections_, and just keep a section pointer. Change all
599 uses. Move comdat group support to Sized_relobj.
600 (Relobj::is_section_specially_mapped): Remove.
601 (Relobj::output_section): Remove poff parameter. Change all
603 (Relobj::output_section_offset): New function.
604 (Relobj::set_section_offset): Rewrite.
605 (Relobj::map_to_output): Remove.
606 (Relobj::output_sections): New function.
607 (Relobj::do_output_section_offset): New pure virtual function.
608 (Relobj::do_set_section_offset): Likewise.
609 (class Sized_relobj): Add section_offsets_ field. Add comdat
610 group support from Relobj. Update declarations.
611 (Sized_relobj::get_output_section_offset): New function.
612 (Sized_relobj::do_output_section_offset): New function.
613 (Sized_relobj::do_set_section_offset): New function.
614 * object.cc (Relobj::output_section_address): Remove.
615 (Sized_relobj::Sized_relobj): Initialize new fields.
616 (Sized_relobj::include_section_group): Cast find_kept_object to
618 (Sized_relobj::include_linkonce_section): Likewise.
619 (Sized_relobj::do_layout): Use separate arrays for output section
621 (Sized_relobj::do_count_local_symbols): Change map_to_output to
623 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
624 output_sections and section_offsets.
625 (Sized_relobj::write_local_symbols): Likewise.
626 (map_to_kept_section): Compute output address directly.
627 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
628 output_sections and section_offsets.
629 (Sized_relobj::write_sections): Likewise.
630 (Sized_relobj::relocate_sections): Likewise.
631 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
632 * output.h (class Output_reloc): Update declarations. Change
633 u2_.relobj to Sized_relobj*.
634 (class Output_data_reloc): Change add functions to use
636 * output.cc (Output_reloc::Output_reloc): Change relobj to
638 (Output_reloc::local_section_offset): Change return type to
639 Elf_Addr. Use get_output_section_offset.
640 (Output_reloc::get_address): Likewise.
641 (Output_section::is_input_address_mapped): Don't call
642 is_section_specially_mapped.
643 (Output_section::output_offset): Likewise.
644 (Output_section::output_address): Likewise.
645 (Output_section::starting_output_address): Likewise.
646 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
647 parameter to Sized_relobj*.
648 (Copy_relocs::need_copy_reloc): Likewise.
649 (Copy_relocs::save): Likewise.
650 * copy-relocs.h (class Copy_relocs): Update declarations.
651 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
652 Sized_relobj*. Change relobj_ field to Sized_relobj*.
653 * target-reloc.h (relocate_for_relocatable): Change
654 offset_in_output_section type to Elf_Addr. Change code that uses
656 * layout.cc (Layout::layout): Always set *off.
657 * mapfile.cc (Mapfile::print_input_section): Use
658 output_section_offset.
659 * i386.cc (Target_i386::copy_reloc): Change object parameter to
661 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
662 * sparc.cc (Target_sparc::copy_reloc): Likewise.
663 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
665 2008-07-03 Ian Lance Taylor <iant@google.com>
667 * layout.cc (Layout::include_section): Do not discard unrecognized
670 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
672 * script.cc (Lex::can_continue_name): Make '?' allowable in
673 version-script names.
674 * testsuite/version_script.map: Change glob pattern to use '?'
676 2008-06-30 Manish Singh <yosh@gimp.org>
679 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
682 2008-06-30 Ian Lance Taylor <iant@google.com>
686 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
687 versions]: Don't try to read the value in the contents, since we
688 don't use it. Use the template endianness when writing.
690 2008-06-25 Cary Coutant <ccoutant@google.com>
692 * fileread.cc (File_read::make_view): Assert on zero-length view.
693 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
694 symbol table when there are no symbols to read.
696 2008-06-23 Craig Silverstein <csilvers@google.com>
698 * version.cc (version_string): Bump to 1.7
700 2008-06-18 Craig Silverstein <csilvers@google.com>
702 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
703 constant 0xFFFF to type Valtype.
704 (Powerpc_relocate_functions::rel16_ha): Likewise.
706 2008-06-17 Ian Lance Taylor <iant@google.com>
708 * output.h (Output_section::Input_section): Initialize p2align_ to
709 zero for Output_section_data constructors.
710 (Output_section::Input_section::addralign): If not an input
711 section, return the alignment of the Output_section_data.
712 * testsuite/copy_test.cc: New file.
713 * testsuite/copy_test_1.cc: New file.
714 * testsuite/copy_test_2.cc: New file.
715 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
716 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
717 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
718 (copy_test_1_pic.o, copy_test_1.so): New targets.
719 (copy_test_2_pic.o, copy_test_2.so): New targets.
720 * testsuite/Makefile.in: Rebuild.
722 * script-sections.cc (Script_sections::place_orphan): Initialize
723 local variable exact.
725 2008-06-13 David Edelsohn <edelsohn@gnu.org>
727 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
729 2008-06-12 David Edelsohn <edelsohn@gnu.org>
730 David S. Miller <davem@davemloft.net>
732 * powerpc.cc: New file.
733 * Makefile.am (TARGETSOURCES): Add powerpc.cc
734 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
735 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
736 * Makefile.in: Rebuild.
738 2008-06-09 Ian Lance Taylor <iant@google.com>
740 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
742 (throwing, orig_terminate): New static variables.
743 (terminate_handler): New static function.
744 (t2): Set terminate handler.
746 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
749 * binary.cc (Binary_to_elf::sized_convert): Fix .data
752 2008-05-30 Cary Coutant <ccoutant@google.com>
754 * archive.cc (Archive::include_all_members) Correct to step
755 over symbol table and extended name table in thin archives.
757 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
760 * target-reloc.h (relocate_for_relocatable): Fix new_offset
763 2008-05-28 Caleb Howe <cshowe@google.com>
765 * reduced_debug_output.cc: New file.
766 * reduced_debug_output.h: New file.
767 * options.h (class General_options): Add --strip-debug-non-line.
768 * options.cc (General_options::finalize): Add strip_debug_non_line
769 to the strip heirarchy.
770 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
772 * layout.cc: Include "reduced_debug_output.h".
773 (Layout::Layout): Initialize new fields.
774 (line_only_debug_sections): New static array.
775 (is_lines_only_debug_sections): New static inline function.
776 (Layout::include_section): Handle --strip-debug-non-line.
777 (Layout::make_output_section): If --strip-debug-non-line, build
778 new output sections for .debug_abbrev and .debug_info.
779 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
780 gold. Warn about possible overflow.
781 (read_signed_LEB_128): Likewise.
782 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
783 (read_signed_LEB_128): Declare.
784 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
785 (HFILES): Add reduced_debug_output.h.
786 * Makefile.in: Rebuild.
788 2008-05-21 Ian Lance Taylor <iant@google.com>
790 * mapfile.cc: New file.
791 * mapfile.h: New file.
792 * options.h (class General_options): Add -M/--print-map and -Map.
793 * options.cc (General_options::finalize): Make -M equivalent to
795 * main.cc: Include <cstdio> and "mapfile.h".
796 (main): Open mapfile if requested.
797 * gold.cc (class Middle_runner): Add mapfile_ field. Update
798 constructor. Change caller.
799 (queue_initial_tasks): Add mapfile parameter. Change caller.
800 (queue_middle_tasks): Likewise.
801 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
803 * archive.cc: Include "mapfile.h".
804 (Archive::add_symbols): Add mapfile parameter. Change all
805 callers. Pass mapfile, symbol, and reason to include_member.
806 (Archive::include_all_members): Add mapfile parameter. Change all
808 (Archive::include_member): Add mapfile, sym, and why parameters.
809 Change all callers. Report inclusion to map file.
810 * archive.h: Include "fileread.h".
811 (class Archive): Update declarations.
812 (Archive::file): New const method.
813 (class Add_archive_symbols): Add mapfile_ field. Update
814 constructor. Change all callers.
815 * readsyms.h (class Read_symbols): Likewise.
816 (class Finish_group): Likewise.
817 (class Read_script): Likewise.
818 * common.cc: Include "mapfile.h".
819 (Symbol_table::allocate_commons): Add mapfile parameter. Change
821 (Symbol_table::do_allocate_commons): Likewise.
822 (Symbol_table::do_allocate_commons_list): Likewise. Report common
823 symbol allocation to mapfile.
824 * common.h (class Allocate_commons_task): Add mapfile_ field.
825 Update constructor. Change all callers.
826 * symtab.h (class Symbol_table): Update declarations.
827 * layout.cc: Include "mapfile.h".
828 (Layout_task_runner::run): Print information to mapfile.
829 (Layout::create_gold_note): Change Output_data_fixed_space to
830 Output_data_zero_fill.
831 (Layout::create_build_id): Likewise.
832 (Layout::print_to_mapfile): New function.
833 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
834 constructor. Change caller.
835 (class Layout): Declare print_to_mapfile.
836 * output.cc (Output_section::Input_section::print_to_mapfile): New
838 (Output_section::add_input_section): If producing a map, always
839 add to input_sections_ list.
840 (Output_section::do_print_to_mapfile): New function.
841 (Output_segment::print_sections_to_mapfile): New function.
842 (Output_segment::print_section_list_to_mapfile): New function.
843 * output.h: Include "mapfile.h".
844 (Output_data::print_to_mapfile): New function.
845 (Output_data::do_print_to_mapfile): New virtual function.
846 (Output_segment_headers::do_print_to_mapfile): New function.
847 (Output_file_header::do_print_to_mapfile): New function.
848 (Output_data_const::do_print_to_mapfile): New function.
849 (class Output_data_const_buffer): Add map_name_ field. Update
850 constructor. Change all callers. Add do_print_to_mapfile
852 (class Output_data_fixed_space): Likewise.
853 (class Output_data_space): Likewise.
854 (class Output_data_zero_fill): New class.
855 (Output_data_strtab::do_print_to_mapfile): New function.
856 (Output_data_reloc_base::do_print_to_mapfile): New function.
857 (Output_relocatable_relocs::do_print_to_mapfile): New function.
858 (Output_data_group::do_print_to_mapfile): New function.
859 (Output_data_got::do_print_to_mapfile): New function.
860 (Output_data_dynamic::do_print_to_mapfile): New function.
861 (Output_symtab_xindex::do_print_to_mapfile): New function.
862 (class Output_section): Declare do_print_to_mapflie. Declare
863 print_to_mapfile in Input_section.
864 (class Output_segment): Declare new functions.
865 * object.h (Sized_relobj::symbol_count): New function.
867 (Output_section_element_dot_assignment::set_section_addresses):
868 Change Output_data_fixed_space to Output_data_zero_fill.
869 (Output_data_expression::do_print_to_mapfile): New function.
870 * script.cc (read_input_script): Add mapfile parameter. Change
872 * script.h (read_input_script): Update declaration.
873 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
874 (Eh_frame::do_print_to_mapfile): New function.
875 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
876 (Output_merge_string::do_print_to_mapfile): New function.
877 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
879 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
881 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
883 * Makefile.am (CCFILES): Add mapfile.cc.
884 (HFILES): Add mapfile.h.
885 * Makefile.in: Rebuild.
887 2008-05-19 Ian Lance Taylor <iant@google.com>
889 * options.h (class General_options): Add -z relro.
890 * layout.cc (Layout::Layout): Initialize relro_segment_.
891 (Layout::add_output_section_data): Return the output section.
892 (Layout::make_output_section): Rcognize relro sections and mark
894 (Layout::attach_allocated_section_to_segment): Put relro sections
895 in a PT_GNU_RELRO segment.
896 (Layout::create_initial_dynamic_sections): Mark the .dynamic
898 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
900 (Layout::linkonce_mapping): Map d.rel.ro.local to
902 (Layout::output_section_name): Us .data.rel.ro.local for any
903 section which begins with that.
904 * layout.h (class Layout): Update add_output_section_data
905 declaration. Add relro_segment_ field.
906 * output.cc (Output_section::Output_section): Initialize is_relro_
907 and is_relro_local_ fields.
908 (Output_segment::add_output_section): Group relro sections.
909 (Output_segment::is_first_section_relro): New function.
910 (Output_segment::maximum_alignment): If there is a relro section,
911 align the segment to the common page size.
912 (Output_segment::set_section_addresses): Track whether we are
913 looking at relro sections. If the last section is a relro
914 section, align to the common page size.
915 (Output_segment::set_section_list_addresses): Add in_relro
916 parameter. Change all callers. Align to the page size when
917 moving from relro to non-relro section.
918 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
920 * output.h (class Output_section): Add is_relro_ and
921 is_relro_local_ fields.
922 (Output_section::is_relro): New function.
923 (Output_section::set_is_relro): New function.
924 (Output_section::is_relro_local): New function.
925 (Output_section::set_is_relro_local): New function.
926 (class Output_segment): Update declarations.
927 * i386.cc (Target_i386::got_section): Mark .got section as relro.
928 * sparc.cc (Target_sparc::got_section): Likewise.
929 * x86_64.cc (Target_x86_64::got_section): Likewise.
930 * testsuite/relro_test_main.cc: New file.
931 * testsuite/relro_test.cc: New file.
932 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
933 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
934 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
935 (relro_test.so, relro_test_pic.o): New targets.
936 * testsuite/Makefile.in: Rebuild.
938 2008-05-16 Ian Lance Taylor <iant@google.com>
940 * output.cc (Output_segment::add_output_section): Remove front
942 * output.h (class Output_segment): Remove
943 add_initial_output_section and overloaded add_output_section.
944 Update declaration of remaining add_output_section.
945 * layout.cc (Layout::create_interp): Call add_output_section
946 rather than add_initial_output_section.
947 (Layout::finish_dynamic_section): Likewise.
949 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
950 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
951 know the dynamic type.
952 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
953 field. Initialize it in constructor.
954 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
955 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
956 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
959 * output.cc (Output_reloc::get_address): Change return type to
961 * output.h (class Output_reloc): Update get_address declaration.
962 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
963 for section addresses.
965 2008-05-09 Ian Lance Taylor <iant@google.com>
968 * gold.cc (gold_nomem): Use return value of write.
970 2008-05-08 Ian Lance Taylor <iant@google.com>
972 * symtab.c (Symbol::init_base_output_data): Add version
973 parameter. Change all callers.
974 (Symbol::init_base_output_segment): Likewise.
975 (Symbol::init_base_constant): Likewise.
976 (Symbol::init_base_undefined): Likewise.
977 (Sized_symbol::init_output_data): Likewise.
978 (Sized_symbol::init_output_segment): Likewise.
979 (Sized_symbol::init_constant): Likewise.
980 (Sized_symbol::init_undefined): Likewise.
981 (Symbol_table::do_define_in_output_data): If the new symbol has a
982 version, mark it as the default.
983 (Symbol_table::do_define_in_output_segment): Likewise.
984 (Symbol_table::do_define_as_constant): Likewise.
985 * symtab.h (class Symbol): Update declarations.
986 (class Sized_symbol): Likewise.
987 * resolve.cc (Symbol::override_version): New function.
988 (Symbol::override_base): Call override_version.
989 (Symbol::override_base_with_special): Likewise.
990 * testsuite/ver_script_8.script: New file.
991 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
992 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
993 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
994 (ver_test_8_1.so, ver_test_8_2.so): New targets.
996 2008-05-06 Ian Lance Taylor <iant@google.com>
999 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
1001 (class General_options): Remove existing --undefined, and add
1002 --no-undefined instead. Add new --undefined as synonym for -u.
1003 * archive.cc (Archive::add_symbols): Check whether symbol was
1005 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
1006 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
1007 all uses. Add IS_UNDEFINED. Update declarations to split
1008 different versions of init_base. Declare init_base_undefined.
1009 (Symbol::is_defined): Handle IS_UNDEFINED.
1010 (Symbol::is_undefined): Likewise.
1011 (Symbol::is_weak_undefined): Call is_undefined.
1012 (Symbol::is_absolute): Handle IS_CONSTANT.
1013 (class Sized_symbol): Update declarations to split different
1014 versions of init. Declare init_undefined.
1015 (class Symbol_table): Declare new functions.
1016 * symtab.cc (Symbol::init_base_object): Rename from init_base.
1018 (Symbol::init_base_output_data): Likewise.
1019 (Symbol::init_base_output_segment): Likewise.
1020 (Symbol::init_base_constant): Likewise.
1021 (Symbol::init_base_undefined): New function.
1022 (Sized_symbol::init_object): Rename from init. Change all
1024 (Sized_symbol::init_output_data): Likewise.
1025 (Sized_symbol::init_output_segment): Likewise.
1026 (Sized_symbol::init_constant): Likewise.
1027 (Sized_symbol::init_undefined): New function.
1028 (Symbol_table::add_undefined_symbols_from_command_line): New
1030 (Symbol_table::do_add_undefined_symbols_from_command_line): New
1032 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
1033 (Symbol::output_section): Likewise.
1034 (Symbol::set_output_section): Likewise.
1035 (Symbol_table::sized_finalize_symbol): Likewise.
1036 (Symbol_table::sized_write_globals): Likewise.
1037 * resolve.cc (Symbol_table::should_override): Likewise.
1038 (Symbol::override_base_with_special): Likewise.
1040 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
1041 symbol, change it to have default visibility.
1042 * testsuite/protected_1.cc: New file.
1043 * testsuite/protected_2.cc: New file.
1044 * testsuite/protected_3.cc: New file.
1045 * testsuite/protected_main_1.cc: New file.
1046 * testsuite/protected_main_2.cc: New file.
1047 * testsuite/protected_main_3.cc: New file.
1048 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
1049 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
1050 (protected_1_LDFLAGS, protected_1_LDADD): Define.
1051 (protected_1.so): New target.
1052 (protected_1_pic.o, protected_2_pic.o): New targets.
1053 (protected_3_pic.o): New target.
1054 (check_PROGRAMS): Add protected_2.
1055 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
1056 (protected_2_LDFLAGS, protected_2_LDADD): Define.
1057 * testsuite/Makefile.in: Rebuild.
1059 * options.h (DEFINE_var): Add set_user_set_##varname__.
1060 (DEFINE_bool_alias): New macro.
1061 (class General_options): Define -Bstatic using DEFINE_bool_alias
1062 rather than DEFINE_special. Add --undefined as an alias for -z
1064 * options.cc (General_options::parse_Bstatic): Remove.
1066 * options.h (class General_options): Add --fatal-warnings.
1067 * main.cc (main): Implement --fatal-warnings.
1068 * errors.h (Errors::warning_count): New function.
1070 * options.h (class General_options): Add -Bsymbolic-functions.
1071 * symtab.h (Symbol::is_preemptible): Check for
1072 -Bsymbolic-functions.
1074 2008-05-05 Ian Lance Taylor <iant@google.com>
1076 * options.h (DEFINE_bool): For DASH_Z, create the negative option
1077 as noVARNAME rather than no-VARNAME.
1078 (class General_options): Add option -z combreloc.
1079 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
1081 (Output_reloc::sort_before) [SHT_REL]: New function.
1082 (Output_reloc::sort_before) [SHT_RELA]: New function.
1083 (class Output_data_reloc_base): Add sort_relocs_ field. Define
1084 Sort_relocs_comparison.
1085 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
1086 parameter. Change all callers.
1087 (Output_data_reloc::Output_data_reloc) [both versions]: Add
1088 sort_relocs parameter. Change all callers.
1089 * output.cc (Output_reloc::get_address): New function, broken out
1091 (Output_reloc::write_rel): Call it.
1092 (Output_reloc::compare): New function.
1093 (Output_data_reloc_base::do_write): Optionally sort relocs.
1095 * configure.ac: If targ_extra_obj is set, link it in.
1096 * configure.tgt: Initialize all variables.
1097 (x86_64*): Set targ_extra_obj and targ_extra_size.
1098 * configure: Rebuild.
1100 * object.cc (Sized_relobj::include_section_group): Adjust section
1101 indexes read from group data. Build vector to pass to
1103 * layout.cc (Layout::layout_group): Add flags and shndxes
1104 parameters. Remove contents parameter. Change caller. Update
1105 explicit instantiations.
1106 * layout.h (class Layout): Update layout_group declaration.
1107 * output.cc (Output_data_group::Output_data_group): Add flags and
1108 input_shndxes parameters. Remove contents parameter. Change
1110 (Output_data_group::do_write): Change input_sections_ to
1112 * output.h (class Output_data_group): Update constructor
1113 declaration. Rename input_sections_ to input_shndxes_.
1114 * testsuite/many_sections_test.cc: Add template.
1116 2008-04-30 Cary Coutant <ccoutant@google.com>
1118 * target-reloc.h (relocate_section): Fix dead-pointer bug.
1120 * layout.cc (Layout::include_section): Refactored check for debug
1122 (Layout::add_comdat): Add new parameters. Change type
1123 of signature parameter. Add object and shndx to signatures table.
1124 (Layout::find_kept_object): New function.
1125 * layout.h: Include <cstring>.
1126 (Layout::is_debug_info_section): New function.
1127 (Layout::add_comdat): Add new parameters.
1128 (Layout::find_kept_object): New function.
1129 (Layout::Kept_section): New struct.
1130 (Layout::Signatures): Change type of map range.
1131 * object.cc (Relobj::output_section_address): New function.
1132 (Sized_relobj::include_section_group): Add new parameters. Change
1133 calls to Layout::add_comdat. Change to build table of kept comdat
1134 groups and table mapping discarded sections to kept sections.
1135 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
1136 (Sized_relobj::do_layout): Change calls to include_section_group and
1137 include_linkonce_section.
1138 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
1139 value to zero when section is discarded.
1140 (Sized_relobj::map_to_kept_section): New function.
1141 * object.h (Relobj::output_section_address): New function.
1142 (Relobj::Comdat_group): New type.
1143 (Relobj::find_comdat_group): New function.
1144 (Relobj::Comdat_group_table): New type.
1145 (Relobj::Kept_comdat_section): New type.
1146 (Relobj::Kept_comdat_section_table): New type.
1147 (Relobj::add_comdat_group): New function.
1148 (Relobj::set_kept_comdat_section): New function.
1149 (Relobj::get_kept_comdat_section): New function.
1150 (Relobj::comdat_groups_): New field.
1151 (Relobj::kept_comdat_sections_): New field.
1152 (Symbol_value::input_value): Update comment.
1153 (Sized_relobj::map_to_kept_section) New function.
1154 (Sized_relobj::include_linkonce_section): Add new parameter.
1155 * target-reloc.h (Comdat_behavior): New type.
1156 (get_comdat_behavior): New function.
1157 (relocate_section): Add code to map a discarded section to the
1158 corresponding kept section when applying a relocation.
1160 2008-04-30 Craig Silverstein <csilvers@google.com>
1162 * dwarf_reader.cc (next_generation_count): New static var.
1163 (Addr2line_cache_entry): New struct.
1164 (addr2line_cache): New static var.
1165 (Dwarf_line_info::one_addr2line): Added caching.
1166 (Dwarf_line_info::clear_addr2line_cache): New function.
1167 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
1168 cache-size parameter.
1169 (Dwarf_line_info::one_addr2line_cache): New function.
1170 * symtab.cc (Symbol_table::detect_odr_violations): Pass
1171 new cache-size argument to one_addr2line(), and clear cache.
1173 2008-04-28 Cary Coutant <ccoutant@google.com>
1175 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
1176 R_386_PC8 relocations.
1178 2008-04-23 Ian Lance Taylor <iant@google.com>
1180 * object.cc (Sized_relobj::include_section_group): Check for
1181 invalid section group.
1183 * object.cc (make_elf_object): Correct test for 64-bit ELF file
1186 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
1187 than read for file header.
1188 * archive.cc (Archive::include_member): Likewise.
1190 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
1192 * aclocal.m4: Regenerate.
1193 * configure: Regenerate.
1195 2008-04-19 Ian Lance Taylor <iant@google.com>
1197 * version.cc (version_string): Bump to 1.6.
1199 * testsuite/Makefile.am (many_sections_r_test): New target.
1200 (many_sections_r_test_SOURCES): Remove.
1201 (many_sections_r_test_DEPENDENCIES): Remove.
1202 (many_sections_r_test_LDFLAGS): Remove.
1203 (many_sections_r_test_LDADD): Remove.
1205 * object.cc (Sized_relobj::do_add_symbols): Always pass
1206 local_symbol_count_ to add_from_relobj.
1208 * testsuite/Makefile.am (many_sections_check.h): Only check one in
1209 every thousand variables.
1210 * testsuite/Makefile.in: Rebuild.
1212 * object.cc (Xindex::initialize_symtab_xindex): New function.
1213 (Xindex::read_symtab_xindex): New function.
1214 (Xindex::sym_xindex_to_shndx): New function.
1215 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
1217 (Sized_relobj::do_initialize_xindex): New function.
1218 (Sized_relobj::do_read_symbols): Adjust section links.
1219 (Sized_relobj::symbol_section_and_value): Add is_ordinary
1220 parameter. Change all callers.
1221 (Sized_relobj::include_section_group): Adjust section links and
1222 symbol section indexes.
1223 (Sized_relobj::do_layout): Adjust section links.
1224 (Sized_relobj::do_count_local_symbols): Adjust section links and
1225 symbol section indexes.
1226 (Sized_relobj::do_finalize_local_symbols): Distinguish between
1227 ordinary and special symbols.
1228 (Sized_relobj::write_local_symbols): Add symtab_xindex and
1229 dynsym_xindex parameters. Change all callers. Adjust section
1230 links. Use SHN_XINDEX when needed.
1231 (Sized_relobj::get_symbol_location_info): Adjust section links.
1232 Don't get fooled by special symbols.
1233 * object.h (class Xindex): Define.
1234 (class Object): Add xindex_ parameter. Declare virtual functoin
1235 do_initialize_xindex.
1236 (Object::adjust_sym_shndx): New function.
1237 (Object::set_xindex): New protected function.
1238 (class Symbol_value): Add is_ordinary_shndx_ field.
1239 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
1240 (Symbol_value::value): Assert ordinary section.
1241 (Symbol_value::initialize_input_to_output_map): Likewise.
1242 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
1244 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
1246 (class Sized_relobj): Update declarations.
1247 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
1248 parameter. Change all callers.
1249 (Sized_relobj::adjust_shndx): New function.
1250 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
1252 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
1253 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
1254 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
1255 (Sized_dynobj::read_dynsym_section): Adjust section links.
1256 (Sized_dynobj::read_dynamic): Likewise.
1257 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
1259 (Sized_dynobj::do_initialize_xindex): New function.
1260 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
1261 do_initialize_xindex.
1262 (Sized_dynobj::adjust_shndx): New function.
1263 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
1264 dynsym_xindex_ fields.
1265 (Layout::finalize): Add a call to set_section_indexes before
1266 creating the symtab sections.
1267 (Layout::set_section_indexes): Don't do anything if the section
1268 already has a section index.
1269 (Layout::create_symtab_sections): Add shnum parameter. Change
1270 caller. Create .symtab_shndx section if needed.
1271 (Layout::create_shdrs): Add shstrtab_section parameter. Change
1273 (Layout::allocated_output_section_count): New function.
1274 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
1276 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
1277 fields. Update declarations.
1278 (Layout::symtab_xindex): New function.
1279 (Layout::dynsym_xindex): New function.
1280 (class Write_symbols_task): Add layout_ field.
1281 (Write_symbols_task::Write_symbols_task): Add layout parameter.
1283 * output.cc (Output_section_headers::Output_section_headers): Add
1284 shstrtab_section parameter. Change all callers.
1285 (Output_section_headers::do_sized_write): Store overflow values
1286 for section count and section string table section index in
1287 section header zero.
1288 (Output_file_header::do_sized_write): Check for overflow of
1289 section count and section string table section index.
1290 (Output_symtab_xindex::do_write): New function.
1291 (Output_symtab_xindex::endian_do_write): New function.
1292 * output.h (class Output_section_headers): Add shstrtab_section_.
1293 Update declarations.
1294 (class Output_symtab_xindex): Define.
1295 (Output_section::has_out_shndx): New function.
1296 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
1298 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
1300 (Sized_symbol::init): Likewise.
1301 (Symbol::output_section): Check for ordinary symbol.
1302 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
1303 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
1305 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
1306 Change all callers. Simplify handling of symbols from sections
1307 not included in the link.
1308 (Symbol_table::add_from_dynobj): Handle ordinary symbol
1310 (Weak_alias_sorter::operator()): Assert that symbols are
1312 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
1314 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
1315 parameters. Change all callers.
1316 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
1317 symbol distinction. Use SHN_XINDEX when needed.
1318 (Symbol_table::write_section_symbol): Add symtab_xindex
1319 parameter. Change all callers.
1320 (Symbol_table::sized_write_section_symbol): Likewise. Use
1321 SHN_XINDEX when needed.
1322 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
1324 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
1325 (Symbol::is_defined): Check is_ordinary.
1326 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
1327 (Symbol::is_absolute, Symbol::is_common): Likewise.
1328 (class Sized_symbol): Update declarations.
1329 (class Symbol_table): Update declarations.
1330 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
1331 parameters. Change all callers.
1332 (Sized_symbol::override): Likewise.
1333 (Symbol_table::override): Likewise.
1334 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
1335 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
1336 is_ordinary, and orig_st_shndx parameters. Change all callers.
1337 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
1338 to be in an ordinary section.
1339 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
1340 object and is_ordinary parameters. Change all callers.
1341 (Sized_dwarf_line_info::read_relocs): Add object parameter.
1342 Change all callers. Don't add undefined or non-ordinary symbols
1344 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
1346 * dwarf_reader.h (class Sized_dwarf_line_info): Update
1348 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
1349 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
1350 (Sized_relobj::relocate_sections): Likewise.
1351 * target-reloc.h (scan_relocs): Adjust section symbol index.
1352 (scan_relocatable_relocs): Likewise.
1353 * i386.cc (Scan::local): Check for ordinary symbols.
1354 * sparc.cc (Scan::local): Likewise.
1355 * x86_64.cc (Scan::local): Likewise.
1356 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
1357 to symbol_section_and_value.
1358 * testsuite/many_sections_test.cc: New file.
1359 * testsuite/Makefile.am (BUILT_SOURCES): Define.
1360 (check_PROGRAMS): Add many_sections_test.
1361 (many_sections_test_SOURCES): Define.
1362 (many_sections_test_DEPENDENCIES): Define.
1363 (many_sections_test_LDFLAGS): Define.
1364 (BUILT_SOURCES): Add many_sections_define.h.
1365 (many_sections_define.h): New target.
1366 (BUILT_SOURCES): Add many_sections_check.h.
1367 (many_sections_check.h): New target.
1368 (check_PROGRAMS): Add many_sections_r_test.
1369 (many_sections_r_test_SOURCES): Define.
1370 (many_sections_r_test_DEPENDENCIES): Define.
1371 (many_sections_r_test_LDFLAGS): Define.
1372 (many_sections_r_test_LDADD): Define.
1373 (many_sections_r_test.o): New target.
1374 * testsuite/Makefile.in: Rebuild.
1376 2008-04-17 Cary Coutant <ccoutant@google.com>
1378 * errors.cc (Errors::info): New function.
1379 (gold_info): New function.
1380 * errors.h (Errors::info): New function.
1381 * gold.h (gold_info): New function.
1382 * object.cc (Input_objects::add_object): Print trace output.
1383 * options.cc (options::parse_set): New function.
1384 (General_options::parse_wrap): Deleted.
1385 (General_options::General_options): Deleted initializer.
1386 * options.h (options::String_set): New typedef.
1387 (options::parse_set): New function.
1388 (DEFINE_set): New macro.
1389 (General_options::wrap): Changed to use DEFINE_set. Changed
1390 callers of any_wrap_symbols and is_wrap_symbol.
1391 (General_options::trace, General_options::trace_symbol):
1393 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
1394 (General_options::wrap_symbols_): Deleted.
1395 * symtab.cc (Symbol_table::add_from_object): Print trace output.
1397 2008-04-17 David S. Miller <davem@davemloft.net>
1399 * options.cc (General_options::parse_V): New function.
1400 * options.h: Add entries for -V and -Qy.
1402 2008-04-17 Ian Lance Taylor <iant@google.com>
1404 * common.cc (Symbol_table::allocate_commons): Remove options
1405 parameter. Change caller.
1406 (Symbol_table::do_allocate_commons): Remove options parameter.
1407 Change caller. Just call do_allocate_commons_list twice.
1408 (Symbol_table::do_allocate_commons_list): New function, broken out
1409 of do_allocate_commons.
1410 * common.h (class Allocate_commons_task): Remove options_ field.
1412 * symtab.cc (Symbol_table::Symbol_table): Initialize
1414 (Symbol_table::add_from_object): Put TLS common symbols on
1416 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
1417 which are IN_OUTPUT_DATA.
1418 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
1419 allocate_commons and do_allocate_commons declarations. Declare
1420 do_allocate_commons_list.
1421 * gold.cc (queue_middle_tasks): Update creation of
1422 Allocate_commons_task to not pass options.
1423 * testsuite/Makefile.am (INCLUDES): Add -I.. .
1424 (TLS_TEST_C_FLAGS): New variable.
1425 (tls_test_c_pic.o): New target.
1426 (tls_test_shared.so): Link in tls_test_c_pic.o.
1427 (tls_test_c_pic_ie.o): New target.
1428 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
1429 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
1430 (tls_test_c.o): New target.
1431 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
1432 (tls_pic_test_LDADD): Likewise.
1433 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
1434 (tls_shared_gd_to_ie_test_LDADD): Likewise.
1435 (tls_test_c_gnu2.o): New target.
1436 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
1438 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
1439 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
1440 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
1441 * testsuite/tls_test.cc: Include "config.h".
1442 (t_last): Call t11_last.
1443 * testsuite/tls_test.h (t11, t11_last): Declare.
1444 * testsuite/tls_test_c.c: New file.
1445 * testsuite/tls_test_main.cc (thread_routine): Call t11.
1446 * configure.ac: Check for OpenMP support.
1447 * configure, config.in, Makefile.in: Rebuild.
1448 * testsuite/Makefile.in: Rebuild.
1450 2008-04-16 Cary Coutant <ccoutant@google.com>
1452 * i386.cc (Target_i386::define_tls_base_symbol): New function.
1453 (Target_i386::tls_base_symbol_defined_): New field.
1454 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
1455 (Target_i386::Scan::global): Likewise.
1456 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
1457 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
1458 (Target_x86_64::tls_base_symbol_defined_): New field.
1459 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
1460 (Target_x86_64::Scan::global): Likewise.
1462 2008-04-16 Cary Coutant <ccoutant@google.com>
1464 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
1465 (Symbol::needs_plt_entry): Allow weak undefined symbols.
1466 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
1467 building shared libraries.
1468 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
1469 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
1470 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
1471 * testsuite/Makefile.in: Rebuild.
1472 * testsuite/weak_undef.h: New file.
1473 * testsuite/weak_undef_file1.cc: Add extra test cases.
1474 * testsuite/weak_undef_file2.cc: Likewise.
1475 * testsuite/weak_undef_test.cc: Likewise.
1477 2008-04-16 David S. Miller <davem@davemloft.net>
1479 * sparc.cc (Target_sparc::Scan): Change from struct to class.
1480 Add issued_non_pic_error_ field. Declare check_non_pic.
1481 (Target_sparc::Scan::check_non_pic): New function.
1482 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
1483 (Target_sparc::Scan::global): Likewise.
1485 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
1486 * configure: Rebuild.
1488 * options.h (DEFINE_enable): New macro.
1489 (new_dtags): New enable option.
1490 (initfirst, interpose, loadfltr, nodefaultlib,
1491 nodelete, nodlopen, nodump): New -z options.
1492 * layout.cc (Layout:finish_dynamic_section): If new
1493 dtags enabled, emit DT_RUNPATH. Also, emit a
1494 DT_FLAGS_1 containing any specified -z flags.
1496 2008-04-16 Ian Lance Taylor <iant@google.com>
1498 * copy-relocs.cc: New file.
1499 * copy-relocs.h: New file.
1500 * reloc.cc: Remove Copy_relocs code.
1501 * reloc.h: Likewise.
1502 * reloc-types.h (struct Reloc_types) [both versions]: Add
1503 get_reloc_addend_noerror.
1504 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
1505 variants of add_global which take an addend which must be zero.
1506 * i386.cc: Include "copy-relocs.h".
1507 (class Target_i386): Change type of copy_relocs_ to variable,
1509 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
1511 (Target_i386::do_finalize_sections): Change handling of
1513 * sparc.cc: Include "copy-relocs.h".
1514 (class Target_sparc): Change type of copy_relocs_ to variable,
1516 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
1518 (Target_sparc::do_finalize_sections): Change handling of
1520 * x86_64.cc: Include "copy-relocs.h".
1521 (class Target_x86_64): Change type of copy_relocs_ to variable,
1523 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
1524 class. Change all callers.
1525 (Target_x86_64::do_finalize_sections): Change handling of
1527 * Makefile.am (CCFILES): Add copy-relocs.cc.
1528 (HFILES): Add copy-relocs.h.
1530 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
1532 * testsuite/script_test_4.sh: Permit leading zeroes.
1534 2008-04-15 Ian Lance Taylor <iant@google.com>
1536 * script-sections.cc (Script_sections::create_segments): Use
1537 header_size_adjustment even when there is enough room for the
1539 * testsuite/script_test_4.sh: New file.
1540 * testsuite/script_test_4.t: New file.
1541 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
1542 (check_DATA): Add script_test_4.stdout.
1543 (MOSTLYCLEANFILES): Likewise.
1544 (script_test_4): New target.
1545 (script_test_4.stdout): New target.
1546 * testsuite/Makefile.in: Rebuild.
1548 * sparc.cc: Add definitions for Output_data_plt_sparc class
1551 2008-04-14 David S. Miller <davem@davemloft.net>
1553 * sparc.cc: New file.
1554 * Makefile.am (TARGETSOURCES): Add sparc.cc
1555 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
1556 * configure.tgt: Document targ_extra_size and
1557 targ_extra_big_endian. Add entries for sparc-* and
1559 * configure.ac: Handle targ_extra_size and
1560 targ_extra_big_endian.
1561 * Makefile.in: Rebuild.
1562 * configure: Likewise.
1563 * po/POTFILES.in: Likewise.
1564 * po/gold.pot: Likewise.
1566 2008-04-14 Ian Lance Taylor <iant@google.com>
1568 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
1569 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
1570 in the name/type/flags to section mapping. Don't call
1571 allocate_output_section.
1572 (Layout::choose_output_section): Change parameter from adjust_name
1573 to is_input_section. Don't permit input sections after sections
1574 are attached to segments. Don't call allocate_output_section.
1575 (Layout::layout_eh_frame): Call update_flags_for_input_section,
1576 not write_enable_output_section.
1577 (Layout::make_output_section): Don't push to
1578 unattached_section_list_ nor call attach_to_segment. Call
1579 attach_section_to_segment if sections are attached.
1580 (Layout::attach_sections_to_segments): New function.
1581 (Layout::attach_section_to_segment): New function.
1582 (Layout::attach_allocated_section_to_segment): Rename from
1583 attach_to_segment. Remove flags parameter.
1584 (Layout::allocate_output_section): Remove function.
1585 (Layout::write_enable_output_section): Remove function.
1586 * layout.h (class Layout): Update for above changes. Add new
1587 field sections_are_attached_.
1588 * output.h (Output_section::update_flags_for_input_section): New
1590 * output.cc (Output_section::add_input_section): Call
1591 update_flags_for_input_section.
1592 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
1594 2008-04-11 Cary Coutant <ccoutant@google.com>
1596 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
1597 thought unnecessary.
1598 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
1600 2008-04-11 Ian Lance Taylor <iant@google.com>
1602 * output.h (class Output_section_data): Remove inline definition
1604 * output.cc (Output_section_data::set_addralign): New function.
1606 2008-04-11 Cary Coutant <ccoutant@google.com>
1608 Add support for TLS descriptors for i386 and x86_64.
1609 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
1610 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
1611 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
1613 (Target_i386::got_mod_index_entry): Remove unnecessary code.
1614 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
1615 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
1617 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
1618 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
1619 Fix problem with initial-exec relocations.
1620 (Target_i386::Relocate::relocate_tls): Likewise.
1621 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
1623 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
1624 support for section-plus-offset dynamic table entries.
1625 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
1626 (Output_data_dynamic::Dynamic_entry): Add support for
1627 section-plus-offset dynamic table entries.
1628 (Output_data_dynamic::Classification): Likewise.
1629 (Output_data_dynamic::classification_): Renamed offset_.
1630 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
1631 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
1632 (Target_x86_64::make_plt_section): New function.
1633 (Target_x86_64::reserve_tlsdesc_entries): New function.
1634 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
1635 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
1636 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
1637 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
1638 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
1639 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
1640 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
1641 add extra PLT entry for TLS descriptors.
1642 (Output_data_plt_x86_64::got_): New field.
1643 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
1644 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
1646 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
1648 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
1649 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
1650 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
1651 R_386_TLS_DESC_CALL relocations.
1652 (Target_x86_64::Scan::global): Likewise.
1653 (Target_x86_64::do_finalize_sections): Add dynamic table entries
1654 for TLS descriptors.
1655 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
1656 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
1657 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
1658 GD-to-IE relaxation.
1659 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
1660 and TLS_DESCRIPTORS.
1661 * Makefile.in: Rebuild.
1662 * configure: Rebuild.
1663 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
1664 (tls_test_shared2.so): New target.
1665 (tls_shared_gd_to_ie_test_SOURCES): New variable.
1666 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
1667 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
1668 (tls_shared_gd_to_ie_test_LDADD): New variable.
1669 (tls_shared_gnu2_gd_to_ie_test): New target.
1670 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
1672 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
1673 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
1674 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
1675 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
1676 (tls_shared_gnu2_test): New target.
1677 (tls_test_gnu2_shared.so): New target.
1678 (tls_shared_gnu2_test_SOURCES): New variable.
1679 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
1680 (tls_shared_gnu2_test_LDFLAGS): New variable.
1681 (tls_shared_gnu2_test_LDADD): New variable.
1682 * testsuite/Makefile.in: Rebuild.
1683 * testsuite/Makefile.
1685 2008-04-11 Ian Lance Taylor <iant@google.com>
1687 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
1689 * testsuite/Makefile.in: Rebuild.
1691 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
1693 * testsuite/script_test_2.cc (main): Adjust test.
1695 2008-04-11 David S. Miller <davem@davemloft.net>
1696 Ian Lance Taylor <iant@google.com>
1698 * options.h (General_options): Add entries for '-Y' and
1700 * options.cc (General_options:finalize): If -Y was used, add those
1701 entries to the library path instead of the default "/lib" and
1704 2008-04-11 David S. Miller <davem@davemloft.net>
1706 * testsuite/justsyms.t: Start at 0x100.
1707 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
1708 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
1710 * testsuite/script_test_2.cc: Adjust string and section length
1713 2008-04-09 Ian Lance Taylor <iant@google.com>
1716 * script-sections.cc (Sections_element::allocate_to_segment): Add
1718 (Output_section_definition::allocate_to_segment): Likewise.
1719 (Orphan_output_section::allocate_to_segment): Likewise.
1720 (Script_sections::attach_sections_using_phdrs_clause): Don't
1721 propagate non-PT_LOAD segments to orphan sections.
1722 * testsuite/Makefile.am (script_test_3.stdout): Generate using
1723 readelf rather than objdump.
1724 * testsuite/script_test_3.sh: Adjust accordingly. Test that
1725 .interp section and PT_INTERP segment are the same size.
1726 * testsuite/Makefile.in: Rebuild.
1728 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
1729 aliases for symbols defined in the same object.
1730 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
1731 (weak_alias_test_SOURCES): New variable.
1732 (weak_alias_test_DEPENDENCIES): New variable.
1733 (weak_alias_test_LDFLAGS): New variable.
1734 (weak_alias_test_LDADD): New variable.
1735 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
1736 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
1737 (weak_alias_test_3.o): New target.
1738 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
1739 * testsuite/weak_alias_test_main.cc: New file.
1740 * testsuite/weak_alias_test_1.cc: New file.
1741 * testsuite/weak_alias_test_2.cc: New file.
1742 * testsuite/weak_alias_test_3.cc: New file.
1744 2008-04-08 Ian Lance Taylor <iant@google.com>
1746 * options.h (class General_options): Add --noinhibit-exec option.
1747 * main.cc (main): Check --noinhibit-exec.
1749 * options.h (class General_options): Define --wrap as a special
1750 option. Add wrap_symbols_ field.
1751 (General_options::any_wrap_symbols): New function.
1752 (General_options::is_wrap_symbol): New function.
1753 * options.cc (General_options::parse_wrap): New function.
1754 (General_options::General_options): Initialize wrap_symbols_.
1755 * symtab.cc (Symbol_table::wrap_symbol): New function.
1756 (Symbol_table::add_from_object): Handle --wrap.
1757 * symtab.h (class Symbol_table): Declare wrap_symbol.
1758 * target.h (Target::wrap_char): New function.
1759 (Target::Target_info): Add wrap_char field.
1760 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
1761 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1762 * testsuite/testfile.cc (Target_test::test_target_info):
1765 * errors.cc (Errors::undefined_symbol): Mention symbol version if
1768 * layout.h (class Layout): Add added_eh_frame_data_ field.
1769 * layout.cc (Layout::Layout): Initialize new field.
1770 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
1771 output section until we find a section we merged successfully.
1772 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
1773 that the size be non-zero.
1775 * merge.cc (Object_merge_map::get_output_offset): Remove inline
1778 2008-04-08 Craig Silverstein <csilvers@google.com>
1780 * configure.ac: Export new conditional variable HAVE_ZLIB.
1781 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
1783 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
1784 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
1786 2008-04-07 Ian Lance Taylor <iant@google.com>
1788 * version.cc (version_string): Set to "1.5".
1790 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
1791 Add issued_non_pic_error_ field. Declare check_non_pic.
1792 (Target_x86_64::Scan::check_non_pic): New function.
1793 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
1794 (Target_x86_64::Scan::global): Likewise.
1796 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
1797 addend parameter. Change caller. Handle merge sections.
1798 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
1799 Address to Addend. Don't add in the result of
1800 local_section_offset, pass down the addend and use the returned
1802 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
1803 Update declarations of local_section_offset and symbol_value.
1804 * testsuite/two_file_test_1.cc (t18): New function.
1805 * testsuite/two_file_test_2.cc (f18): New function.
1806 * testsuite/two_file_test_main.cc (main): Call t18.
1807 * testsuite/two_file_test.h (t18, f18): Declare.
1809 * configure.ac: Don't test for objdump, c++filt, or readelf.
1810 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
1812 (TEST_READELF): New variable.
1813 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
1814 (check_PROGRAMS): Add two_file_strip_test.
1815 (two_file_strip_test): New target.
1816 (check_PROGRAMS): Add two_file_same_shared_strip_test.
1817 (two_file_same_shared_strip_test_SOURCES): New variable.
1818 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
1819 (two_file_same_shared_strip_test_LDFLAGS): New variable.
1820 (two_file_same_shared_strip_test_LDADD): New variable.
1821 (two_file_shared_strip.so): New target.
1822 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
1823 (ver_test_5.syms, ver_test_7.syms): Likewise.
1824 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
1825 (strip_test_3.stdout): Use TEST_OBJDUMP.
1826 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
1828 2008-04-04 Cary Coutant <ccoutant@google.com>
1830 * symtab.h (Symbol::is_weak_undefined): New function.
1831 (Symbol::is_strong_undefined): New function.
1832 (Symbol::is_absolute): New function.
1833 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
1834 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
1836 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
1837 (weak_undef_test): New target.
1838 * testsuite/Makefile.in: Rebuild.
1839 * testsuite/weak_undef_file1.cc: New file.
1840 * testsuite/weak_undef_file2.cc: New file.
1841 * testsuite/weak_undef_test.cc: New file.
1843 2008-04-03 Craig Silverstein <csilvers@google.com>
1845 * compressed_output.h (class Output_compressed_section): Use
1847 * compressed_output.cc (zlib_compress): Use unsigned buffers,
1849 (zlib_compressed_suffix): Removed.
1850 (Output_compressed_section::set_final_data_size): Use unsigned
1852 * testsuite/Makefile.am (flagstest_compress_debug_sections):
1853 Fix linker invocation.
1854 (flagstest_o_specialfile_and_compress_debug_sections):
1856 * testsuite/Makefile.in: Regenerated.
1858 2008-04-02 David S. Miller <davem@davemloft.net>
1860 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
1861 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
1863 2008-04-02 Craig Silverstein <csilvers@google.com>
1867 2008-04-02 Ian Lance Taylor <iant@google.com>
1869 * fileread.cc (File_read::find_view): Add byteshift and vshifted
1870 parameters. Update for new key type to views_. Change all
1872 (File_read::read): Adjust for byteshift in returned view.
1873 (File_read::add_view): New function, broken out of
1875 (File_read::make_view): New function, broken out of
1877 (File_read::find_or_make_view): Add offset and aligned
1878 parameters. Rewrite accordingly. Change all callers.
1879 (File_read::get_view): Add offset and aligned parameters. Adjust
1880 for byteshift in return value.
1881 (File_read::get_lasting_view): Likewise.
1882 * fileread.h (class File_read): Update declarations.
1883 (class File_read::View): Add byteshift_ field. Add byteshift to
1884 constructor. Add byteshift method.
1885 * archive.h (Archive::clear_uncached_views): New function.
1886 (Archive::get_view): Add aligned parameter. Change all callers.
1887 * object.h (Object::get_view): Add aligned parameter. Change all
1889 (Object::get_lasting_view): Likewise.
1891 * fileread.cc (File_read::release): Don't call clear_views if
1892 there are multiple objects.
1893 * fileread.h (File_read::clear_uncached_views): New function.
1894 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
1897 2008-03-31 Cary Coutant <ccoutant@google.com>
1899 Add thin archive support.
1900 * archive.cc (Archive::armagt): New const.
1901 (Archive::setup): Remove task parameter and calls to unlock.
1902 (Archive::unlock_nested_archives): New function.
1903 (Archive::read_header): Add nested_off parameter. Change
1905 (Archive::interpret_header): Likewise.
1906 (Archive::include_all_members): Change to handle thin
1908 (Archive::include_member): Likewise.
1909 * archive.h (Archive::Archive): Add new parameters and
1911 (Archive::armagt): New const.
1912 (Archive::setup): Remove task parameter.
1913 (Archive::unlock_nested_archives): New function.
1914 (Archive::read_header): Add nested_off parameter.
1915 (Archive::interpret_header): Likewise.
1916 (Archive::Nested_archive_table): New typedef.
1917 (Archive::is_thin_archive_): New field.
1918 (Archive::nested_archives_): New field.
1919 (Archive::options_): New field.
1920 (Archive::dirpath_): New field.
1921 (Archive::task_): New field.
1922 * readsyms.cc (Read_symbols::do_read_symbols): Add check
1923 for thin archives. Pass additional parameters to
1924 Archive::Archive. Unlock the archive file after calling
1927 2008-03-29 Ian Lance Taylor <iant@google.com>
1929 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
1930 version symbol to be local.
1931 * testsuite/ver_test_4.sh: New file.
1932 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
1933 (check_DATA): Add ver_test_4.syms.
1934 (ver_test_4.syms): New target.
1935 * testsuite/Makefile.in: Rebuild.
1938 (Output_section::Input_section_sort_entry::has_priority): New
1940 (Output_section::Input_section_sort_entry::match_file_name): New
1942 (Output_section::Input_section_sort_entry::match_section_name):
1944 (Output_section::Input_section_sort_entry::match_section_name_prefix):
1946 (Output_section::Input_section_sort_entry::match_section_file):
1948 (Output_section::Input_section_sort_compare::operator()): Rewrite
1949 using new Input_section_sort_entry functions. Sort crtbegin and
1950 crtend first. Sort sections with no priority before sections with
1952 * testsuite/initpri1.c (d3): Check j != 4.
1953 (cd5): New constructor/destructor function.
1954 (main): Check j != 2.
1956 * symtab.cc (Symbol_table::add_from_object): If we don't use the
1957 new symbol when resolving, don't call set_is_default.
1958 * testsuite/ver_test_7.cc: New file.
1959 * testsuite/ver_test_7.sh: New file.
1960 * testsuite/Makefile.am (ver_test_7.so): New target.
1961 (ver_test_7.o): New target.
1962 (check_SCRIPTS): Add ver_test_7.sh.
1963 (check_DATA): Add ver_test_7.syms.
1964 (ver_test_7.syms): New target.
1966 2008-03-28 Ian Lance Taylor <iant@google.com>
1968 * layout.cc (Layout::layout): If we see an input section with a
1969 name that needs sorting, set the must_sort flag for the output
1971 (Layout::make_output_section): If the name of the output section
1972 indicates that it might require sorting, set the may_sort flag.
1973 * output.h (Output_section::may_sort_attached_input_sections): New
1975 (Output_section::set_may_sort_attached_input_sections): New
1977 (Output_section::must_sort_attached_input_sections): New
1979 (Output_section::set_must_sort_attached_input_sections): New
1981 (class Output_section): Declare Input_section_sort_entry. Define
1982 Input_section_sort_compare. Declare
1983 sort_attached_input_sections. Add new fields:
1984 may_sort_attached_input_sections_,
1985 must_sort_attached_input_sections_,
1986 attached_input_sections_are_sorted_.
1987 * output.cc (Output_section::Output_section): Initialize new
1989 (Output_section::add_input_section): Add an entry to
1990 input_sections_ if may_sort or must_sort are true.
1991 (Output_section::set_final_data_size): Call
1992 sort_attached_input_sections if necessary.
1993 (Output_section::Input_section_sort_entry): Define new class.
1994 (Output_section::Input_section_sort_compare::operator()): New
1996 (Output_section::sort_attached_input_sections): New function.
1997 * configure.ac: Check whether the compiler supports constructor
1998 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
1999 * testsuite/initpri1.c: New file.
2000 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
2001 CONSTRUCTOR_PRIORITY.
2002 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
2003 (initpri1_LDFLAGS): New variable.
2004 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
2006 2008-03-27 Ian Lance Taylor <iant@google.com>
2008 * common.cc (Sort_commons::operator): Correct sorting algorithm.
2009 * testsuite/common_test_1.c: New file.
2010 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
2011 (common_test_1_SOURCES): New variable.
2012 (common_test_1_DEPENDENCIES): New variable.
2013 (common_test_1_LDFLAGS): New variable.
2015 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
2016 and commons_ correctly when NAME/VERSION does not override
2018 * testsuite/ver_test_6.c: New file.
2019 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
2020 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
2021 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
2023 2008-03-26 Ian Lance Taylor <iant@google.com>
2025 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
2026 of an undefined symbol from a version script.
2027 * testsuite/Makefile.am (ver_test_5.so): New target.
2028 (ver_test_5.o): New target.
2029 (check_SCRIPTS): Add ver_test_5.sh.
2030 (check_DATA): Add ver_test_5.syms.
2031 (ver_test_5.syms): New target.
2032 * testsuite/ver_test_5.cc: New file.
2033 * testsuite/ver_test_5.script: New file.
2034 * testsuite/ver_test_5.sh: New file.
2035 * Makefile.in, testsuite/Makefile.in: Rebuild.
2038 Fix problems building gold with gcc 4.3.0.
2039 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
2040 (gold_error_at_location, gold_warning_at_location): Use it.
2041 * configure.ac: Check whether we can compile and use a template
2042 function with a printf attribute.
2043 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
2044 when jumping over bytes.
2045 * object.cc: Instantiate Object::read_section_data.
2046 * debug.h: Include <cstring>
2047 * dwarf_reader.cc: Include <algorithm>
2048 * main.cc: Include <cstring>.
2049 * options.cc: Include <cstring>.
2050 * output.cc: Include <cstring>.
2051 * script.cc: Include <cstring>.
2052 * script.h: Include <string>.
2053 * symtab.cc: Include <cstring> and <algorithm>.
2054 * target-select.cc: Include <cstring>.
2055 * version.cc: Include <string>.
2056 * testsuite/testmain.cc: Include <cstdlib>.
2057 * configure, config.in: Rebuild.
2059 2008-03-25 Ian Lance Taylor <iant@google.com>
2061 * options.cc: Include "../bfd/bfdver.h".
2062 (options::help): Print bug reporting address.
2064 * version.cc (print_version): Adjust output for current value of
2069 * options.cc (options::help): Print list of supported targets.
2070 * target-select.h: Include <vector>.
2071 (class Target_selector): Make machine_, size_, and is_big_endian_
2072 fields const. Add bfd_name_ and instantiated_target_ fields.
2073 (Target_selector::Target_selector): Add bfd_name parameter.
2074 (Target_selector::recognize): Make non-virtual, call
2076 (Target_selector::recognize_by_name): Make non-virtual, call
2077 do_recognize_by_name.
2078 (Target_selector::supported_names): New function.
2079 (Target_selector::bfd_name): New function.
2080 (Target_selector::do_instantiate_target): New pure virtual
2082 (Target_selector::do_recognize): New virtual function.
2083 (Target_selector::do_recognize_by_name): New virtual function.
2084 (Target_selector::instantiate_target): New private function.
2085 (supported_target_names): Declare.
2086 * target-select.cc (Target_selector::Target_selector): Update for
2087 new parameter and fields.
2088 (select_target_by_name): Check that the name matches before
2089 calling recognize_by_name.
2090 (supported_target_names): New function.
2091 * i386.cc (class Target_selector_i386): Update Target_selector
2092 constructor call. Remove recognize and recognize_by_name. Add
2093 do_instantiate_target.
2094 * x86_64.cc (class Target_selector_x86_64): Likewise.
2095 * testsuite/testfile.cc (class Target_selector_test): Update for
2096 changes to Target_selector.
2098 * README: Rewrite, with some notes on unsupported features.
2100 2008-03-24 Cary Coutant <ccoutant@google.com>
2102 * i386.cc (Target_i386::Got_type): New enum declaration.
2103 (Target_i386::Scan::local): Updated callers of Output_data_got
2105 (Target_i386::Scan::global): Likewise.
2106 (Target_i386::Relocate::relocate): Likewise.
2107 (Target_i386::Relocate::relocate_tls): Likewise.
2108 * object.h (Got_offset_list): New class.
2109 (Sized_relobj::local_has_got_offset): Added got_type parameter.
2110 (Sized_relobj::local_got_offset): Likewise.
2111 (Sized_relobj::set_local_got_offset): Likewise.
2112 (Sized_relobj::local_has_tls_got_offset): Removed.
2113 (Sized_relobj::local_tls_got_offset): Removed.
2114 (Sized_relobj::set_local_tls_got_offset): Removed.
2115 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
2116 * output.cc (Output_data_got::add_global): Added got_type parameter.
2117 (Output_data_got::add_global_with_rel): Likewise.
2118 (Output_data_got::add_global_with_rela): Likewise.
2119 (Output_data_got::add_global_pair_with_rel): New function.
2120 (Output_data_got::add_global_pair_with_rela): New function.
2121 (Output_data_got::add_local): Added got_type parameter.
2122 (Output_data_got::add_local_with_rel): Likewise.
2123 (Output_data_got::add_local_with_rela): Likewise.
2124 (Output_data_got::add_local_pair_with_rel): New function.
2125 (Output_data_got::add_local_pair_with_rela): New function.
2126 (Output_data_got::add_global_tls): Removed.
2127 (Output_data_got::add_global_tls_with_rel): Removed.
2128 (Output_data_got::add_global_tls_with_rela): Removed.
2129 (Output_data_got::add_local_tls): Removed.
2130 (Output_data_got::add_local_tls_with_rel): Removed.
2131 (Output_data_got::add_local_tls_with_rela): Removed.
2132 * output.h (Output_data_got::add_global): Added got_type parameter.
2133 (Output_data_got::add_global_with_rel): Likewise.
2134 (Output_data_got::add_global_with_rela): Likewise.
2135 (Output_data_got::add_global_pair_with_rel): New function.
2136 (Output_data_got::add_global_pair_with_rela): New function.
2137 (Output_data_got::add_local): Added got_type parameter.
2138 (Output_data_got::add_local_with_rel): Likewise.
2139 (Output_data_got::add_local_with_rela): Likewise.
2140 (Output_data_got::add_local_pair_with_rel): New function.
2141 (Output_data_got::add_local_pair_with_rela): New function.
2142 (Output_data_got::add_global_tls): Removed.
2143 (Output_data_got::add_global_tls_with_rel): Removed.
2144 (Output_data_got::add_global_tls_with_rela): Removed.
2145 (Output_data_got::add_local_tls): Removed.
2146 (Output_data_got::add_local_tls_with_rel): Removed.
2147 (Output_data_got::add_local_tls_with_rela): Removed.
2148 * resolve.cc (Symbol::override_base_with_special): Removed
2149 reference to has_got_offset_ field.
2150 * symtab.cc (Symbol::init_fields): Replaced initialization
2151 of got_offset_ with got_offsets_. Removed initialization
2153 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
2154 (Symbol::got_offset): Likewise.
2155 (Symbol::set_got_offset): Likewise.
2156 (Symbol::has_tls_got_offset): Removed.
2157 (Symbol::tls_got_offset): Removed.
2158 (Symbol::set_tls_got_offset): Removed.
2159 (Symbol::got_offset_): Removed.
2160 (Symbol::tls_mod_got_offset_): Removed.
2161 (Symbol::tls_pair_got_offset_): Removed.
2162 (Symbol::got_offsets_): New field.
2163 (Symbol::has_got_offset): Removed.
2164 (Symbol::has_tls_mod_got_offset): Removed.
2165 (Symbol::has_tls_pair_got_offset): Removed.
2166 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
2167 (Target_x86_64::Scan::local): Updated callers of Output_data_got
2169 (Target_x86_64::Scan::global): Likewise.
2170 (Target_x86_64::Relocate::relocate): Likewise.
2171 (Target_x86_64::Relocate::relocate_tls): Likewise.
2173 2008-03-25 Ben Elliston <bje@au.ibm.com>
2175 * yyscript.y: Fix spelling error in comment.
2177 2008-03-24 Ian Lance Taylor <iant@google.com>
2179 * options.h (class General_options): Define build_id option.
2180 * layout.h (class Layout): Declare write_build_id, create_note,
2181 create_build_id. Add build_id_note_ member.
2182 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
2183 "libiberty.h", "md5.h", "sha1.h".
2184 (Layout::Layout): Initialize eh_frame_data_,
2185 eh_frame_hdr_section_, and build_id_note_.
2186 (Layout::finalize): Call create_build_id.
2187 (Layout::create_note): New function, broken out of
2188 Layout::create_gold_note.
2189 (Layout::create_gold_note): Call create_note.
2190 (Layout::create_build_id): New function.
2191 (Layout::write_build_id): New function.
2192 (Close_task_runner::run): Call write_build_id.
2194 * x86_64.cc: Correct license to GPLv3.
2196 2008-03-23 Ian Lance Taylor <iant@google.com>
2198 * options.cc: Include "demangle.h".
2199 (parse_optional_string): New function.
2200 (parse_long_option): Handle takes_optional_argument.
2201 (parse_short_option): Update dash_z initializer. Handle
2202 takes_optional_argument.
2203 (General_options::General_options): Initialize do_demangle_.
2204 (General_options::finalize): Set do_demangle_. Handle demangling
2206 * options.h (parse_optional_string): Declare.
2207 (struct One_option): Add optional_arg field. Update constructor.
2208 Update call constructor calls. Add takes_optional_argument
2210 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
2211 (DEFINE_optional_string): Define.
2212 (General_options::demangle): Change from DEFINE_bool to
2213 DEFINE_optional_string.
2214 (General_options::no_demangle): New function.
2215 (General_options::do_demangle): New function.
2216 (General_options::set_do_demangle): New function.
2217 (General_options::execstack_status_): Move definition to end of
2219 (General_options::static_): Likewise.
2220 (General_options::do_demangle_): New field.
2221 * object.cc (big_endian>::get_symbol_location_info): Call
2222 Options::do_demangle, not Options::demangle.
2223 * symtab.cc (demangle): Likewise.
2225 2008-03-22 Ian Lance Taylor <iant@google.com>
2227 * gold.h: Include <cstddef> and <sys/types.h>
2228 * options.h: Include <cstring>.
2230 2008-03-21 Ian Lance Taylor <iant@google.com>
2232 * Added source code to GNU binutils.