1 2009-02-04 Duncan Sands <baldrick@free.fr>
4 * reduced_debug_output.h
5 (Output_reduced_debug_abbrev_section::failed): Use format for
7 (Output_reduced_debug_info_section::faild): Likewise.
9 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
11 * script.cc (Lazy_demangler): New class.
12 (Version_script_info::get_symbol_version_helper): Demangle a
15 2009-01-29 Cary Coutant <ccoutant@google.com>
17 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
19 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
21 2009-01-28 Ian Lance Taylor <iant@google.com>
23 * version.cc (version_string): Bump to 1.9.
25 * gold.h: Include <cstring> and <stdint.h>.
26 * version.cc: Include <cstdio>.
27 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
29 * reduced_debug_output.cc (insert_into_vector): Rename from
30 Insert_into_vector; change all callers. Use Swap_unaligned to
31 avoid aliasing issue; remove union since it is unnecessary.
33 2009-01-27 Sriraman Tallam <tmsriram@google.com>
35 * Makefile.am (CCFILES): Add gc.cc.
37 * Makefile.in: Regenerate.
38 * gold.cc (Gc_runner): New class.
39 (queue_initial_tasks): Call garbage collection related tasks
40 when corresponding options are invoked.
41 (queue_middle_gc_tasks): New function.
42 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
43 processed early before laying out sections during garbage collection.
44 * gold.h (queue_middle_gc_tasks): New function.
45 (is_prefix_of): Move from "layout.cc".
46 * i386.cc (Target_i386::gc_process_relocs): New function.
47 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
48 * main.cc (main): Create object of class "Garbage_collection".
49 * object.cc (Relobj::copy_symbols_data): New function.
50 (Relobj::is_section_name_included): New function.
51 (Sized_relobj::do_layout): Allow this function to be called twice
52 during garbage collection and defer layout of section during the
54 * object.h (Relobj::get_symbols_data): New function.
55 (Relobj::is_section_name_included): New function.
56 (Relobj::copy_symbols_data): New function.
57 (Relobj::set_symbols_data): New function.
58 (Relobj::get_relocs_data): New function.
59 (Relobj::set_relocs_data): New function.
60 (Relobj::is_output_section_offset_invalid): New pure virtual function.
61 (Relobj::gc_process_relocs): New function.
62 (Relobj::do_gc_process_relocs): New pure virtual function.
63 (Relobj::sd_): New data member.
64 (Sized_relobj::is_output_section_offset_invalid): New function.
65 (Sized_relobj::do_gc_process_relocs): New function.
66 * options.h (General_options::gc_sections): Modify to not be a no-op.
67 (General_options::print_gc_sections): New option.
68 * plugin.cc (Plugin_finish::run): Remove function call to
69 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
70 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
71 * reloc.cc (Read_relocs::run): Add task to process relocs and
72 determine unreferenced sections when doing garbage collection.
73 (Gc_process_relocs): New class.
74 (Sized_relobj::do_gc_process_relocs): New function.
75 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
76 sections that are garbage collected.
77 * reloc.h (Gc_process_relocs): New class.
78 * sparc.cc (Target_sparc::gc_process_relocs): New function.
79 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
80 symbols whose corresponding sections are garbage collected.
81 (Symbol_table::Symbol_table): Add new parameter for the garbage
83 (Symbol_table::gc_mark_undef_symbols): New function.
84 (Symbol_table::gc_mark_symbol_for_shlib): New function.
85 (Symbol_table::gc_mark_dyn_syms): New function.
86 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
88 (Symbol_table::add_from_object): Likewise.
89 (Symbol_table::add_from_relobj): When building shared objects, do not
90 treat externally visible symbols as garbage.
91 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
92 table information for static and relocatable links.
93 * symtab.h (Symbol_table::set_gc): New function.
94 (Symbol_table::gc): New function.
95 (Symbol_table::gc_mark_undef_symbols): New function.
96 (Symbol_table::gc_mark_symbol_for_shlib): New function.
97 (Symbol_table::gc_mark_dyn_syms): New function.
98 (Symbol_table::gc_): New data member.
99 * target.h (Sized_target::gc_process_relocs): New pure virtual
101 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
102 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
104 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
106 * options.h (General_options::gc_sections): Define as a no-op for now.
107 (General_options::no_keep_memory): Ditto.
108 (General_options::Bshareable): Define.
109 * options.cc (General_options::finalize): Honor -Bshareable.
111 2009-01-20 Andreas Schwab <schwab@suse.de>
113 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
114 read the value in the contents, since we don't use it. Use the
115 template endianness when writing.
116 (Relocate::relocate): Use it for R_PPC_REL16_HA.
118 2009-01-19 Andreas Schwab <schwab@suse.de>
120 * configure.tgt (powerpc64-*): Fix targ_obj.
122 2009-01-15 Ian Lance Taylor <iant@google.com>
124 * object.cc (Sized_relobj::write_local_symbols): Don't write out
125 local symbols when stripping all symbols.
127 2009-01-14 Cary Coutant <ccoutant@google.com>
129 * output.cc (Output_reloc): Add explicit instantiations.
131 2009-01-14 Cary Coutant <ccoutant@google.com>
133 * archive.cc (Archive::get_elf_object_for_member): Remove call
134 to File_read::claim_for_plugin.
135 * descriptors.cc (Descriptors::open): Remove reference to
137 (Descriptors::claim_for_plugin): Remove.
138 * descriptors.h (Descriptors::claim_for_plugin): Remove.
139 (Descriptors::is_claimed): Remove.
140 (claim_descriptor_for_plugin): Remove.
141 * fileread.cc (File_read::claim_for_plugin): Remove.
142 * fileread.h (File_read::claim_for_plugin): Remove.
143 (File_read::descriptor): Reopen descriptor if necessary.
144 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
145 (Plugin_manager::all_symbols_read): Add task parameter. Change
147 (Plugin_manager::get_input_file): New function.
148 (Plugin_manager::release_input_file): New function.
149 (Pluginobj::Pluginobj): Add filesize parameter and initialize
150 corresponding data member.
151 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
152 and pass to base constructor. Change all callers.
153 (get_input_file, release_input_file): New functions.
154 (make_sized_plugin_object): Add filesize parameter. Change all callers.
155 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
156 (Plugin_manager::all_symbols_read): Add task parameter.
157 (Plugin_manager::get_input_file): New function.
158 (Plugin_manager::release_input_file): New function.
159 (Plugin_manager::task_): New data member.
160 (Pluginobj::Pluginobj): Add filesize parameter.
161 (Pluginobj::filename): New function.
162 (Pluginobj::descriptor): New function.
163 (Pluginobj::filesize): New function.
164 (Pluginobj::filesize_): New data member.
165 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
166 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
167 File_read::claim_for_plugin; use Object::unlock to unlock the file.
169 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
170 with archive libraries.
171 * testsuite/Makefile.in: Regenerate.
172 * testsuite/plugin_test.c (struct sym_info): New type.
173 (get_input_file, release_input_file): New static variables.
174 (onload): Capture new transfer vector entries.
175 (claim_file_hook): Stop reading at end of file according to filesize.
176 Factor out parsing of readelf output into separate function.
177 (all_symbols_read_hook): Exercise get_input_file and release_input_file
178 APIs and get the source file name from the symbol table. Convert
179 source file name to corresponding object file name. Print info
180 message when adding new input files.
181 (parse_readelf_line): New function.
182 * testsuite/plugin_test_1.sh: Add checks for new info messages.
183 * testsuite/plugin_test_2.sh: Likewise.
184 * testsuite/plugin_test_3.sh: Likewise.
185 * testsuite/plugin_test_4.sh: New test case.
187 2009-01-07 Ian Lance Taylor <iant@google.com>
189 * version.cc (version_string): Bump to 1.8.
191 2008-12-23 Cary Coutant <ccoutant@google.com>
193 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
194 * plugin.cc (Plugin_manager::finish): Rename as
195 layout_deferred_objects. Move cleanup to separate function.
196 (Plugin_manager::cleanup): New function.
197 (Plugin_finish::run): Call layout_deferred_objects and cleanup
199 * plugin.h (Plugin_manager::finish): Rename as
200 layout_deferred_objects.
201 (Plugin_manager::cleanup): New function.
202 (Plugin_manager::cleanup_done): New field.
204 2008-12-23 Cary Coutant <ccoutant@google.com>
206 * plugin.cc (is_visible_from_outside): New function.
207 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
208 so we don't return "IR only" status for exported symbols or -r links.
210 * testsuite/Makefile.am (plugin_test_3): New test case.
211 * testsuite/Makefile.in: Regenerate.
212 * testsuite/plugin_test_3.sh: New file.
214 2008-12-22 Cary Coutant <ccoutant@google.com>
216 * object.cc (Sized_relobj::layout_section): New function.
217 (Sized_relobj::do_layout): Defer layout of input sections until after
218 plugin has provided replacement files.
219 (Sized_relobj::do_layout_deferred_sections): New function.
220 * object.h (Relobj::set_section_offset): Remove virtual keyword.
221 (Relobj::layout_deferred_sections): New function.
222 (Relobj::do_layout_deferred_sections): New function.
223 (Sized_relobj::do_layout_deferred_sections): New function.
224 (Sized_relobj::layout_section): New function.
225 (Sized_relobj::Deferred_layout): New structure.
226 (Sized_relobj::deferred_layout_): New field.
227 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
228 Change all callers. Layout deferred sections.
229 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
231 (Plugin_hook::run): Move code from do_plugin_hook inline.
232 (Plugin_hook::do_plugin_hook): Remove.
233 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
234 (Plugin_manager::finish): Renamed, was cleanup.
235 (Plugin_manager::should_defer_layout): New function.
236 (Plugin_manager::add_deferred_layout_object): New function.
237 (Plugin_manager::Deferred_layout_list): New type.
238 (Plugin_manager::deferred_layout_objects_): New field.
239 (Plugin_hook::do_plugin_hook): Remove.
241 2008-12-17 Ian Lance Taylor <iant@google.com>
243 * options.h (class General_options): Add --no case for
246 2008-12-16 Cary Coutant <ccoutant@google.com>
248 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
250 (Plugin_manager::claim_file): Create plugin object even if
251 plugin did not call the add_symbols callback.
252 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
253 asking for more symbols than were added.
254 * testsuite/Makefile.am (plugin_test_1): Add test case with
256 (empty.syms): New target.
257 * testsuite/Makefile.in: Regenerate.
258 * testsuite/plugin_test.c (claim_file_hook): Add new debug
259 message. Don't call add_symbols if no globals.
260 (all_symbols_read_hook): Don't provide replacement for empty
263 2008-12-12 Ian Lance Taylor <iant@google.com>
265 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
266 r_type == 0 for a local symbol with r_sym == 0.
267 (scan_relocatable_relocs): Pass r_sym to
268 local_non_section_strategy.
269 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
272 * configure.ac: Update test for TLS descriptors: they are
273 supported as of glibc 2.9.
274 * configure: Rebuild.
276 2008-12-11 Ian Lance Taylor <iant@google.com>
279 * target-reloc.h (Default_scan_relocatable_relocs): For each
280 function, map r_type == 0 to RELOC_DISCARD.
282 2008-12-10 Cary Coutant <ccoutant@google.com>
284 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
285 object to override a kept COMDAT group from a plugin object.
287 2008-12-09 Ian Lance Taylor <iant@google.com>
290 * yyscript.y (file_cmd): Handle INPUT.
292 * testsuite/initpri1.c: Change all declarations to be full
293 prototypes by adding void, to avoid compiler warnings.
295 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
297 * options.cc (General_options::parse_plugin_opt): New.
298 (General_options::add_plugin): The argument now is just the filename.
299 (General_options::add_plugin_option): New.
300 * options.h (plugin_opt): New.
301 (add_plugin): Change argument name.
302 (add_plugin_option): New.
303 * plugin.cc (Plugin::load): Don't parse the plugin option.
304 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
305 (Plugin::add_option): New.
306 (Plugin::args_): Change type.
307 (Plugin::filename_): New.
308 (Plugin_manager::add_plugin_option): New.
309 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
310 * testsuite/Makefile.in: Regenerate.
312 2008-12-05 Cary Coutant <ccoutant@google.com>
314 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
315 Handle --strip-lto-sections option.
316 * options.h (strip_lto_sections): New option.
318 2008-12-01 Cary Coutant <ccoutant@google.com>
320 * plugin.cc (ld_plugin_message): Change format parameter to const.
321 Fix mismatch between new[] and delete.
323 2008-11-14 Cary Coutant <ccoutant@google.com>
325 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
328 2008-11-05 Craig Silverstein <csilvers@google.com>
330 * options.cc (General_options::parse_dynamic_list): New function.
331 * options.h (General_options): New flags dynamic_list,
332 dynamic_list_data, dynamic_list_cpp_new, and
333 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
334 (General_options::in_dynamic_list): New function.
335 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
336 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
337 (Lex::can_continue_name): Likewise.
339 (read_script_file): New parameter script_options.
340 (read_dynamic_list): New function.
341 (Script_options::define_dynamic_list): New function.
342 (dynamic_list_keyword_parsecodes): New variable.
343 (dynamic_list_keywords): New variable.
344 * script.h (Script_options::define_dynamic_list): New function
346 (read_dynamic_list): New function prototype.
347 * symtab.cc (strprefix): New macro.
348 (Symbol::should_add_dynsym_entry): Support dynamic_list,
349 dynamic_list_data, dynamic_list_cpp_new, and
350 dynamic_list_cpp_typeinfo.
351 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
352 (dynamic_list_expr): New rule.
353 (dynamic_list_nodes): Likewise.
354 (dynamic_list_node): Likewise.
355 * testsuite/Makefile.am (dynamic_list): New test.
356 * testsuite/Makefile.in: Regenerated.
357 * testsuite/dynamic_list.t: New file.
358 * testsuite/dynamic_list.sh: New file.
360 2008-11-05 Craig Silverstein <csilvers@google.com>
362 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
363 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
364 (t11_last): Likewise.
365 * testsuite/ver_test_6.c (main): Likewise.
367 2008-10-07 Cary Coutant <ccoutant@google.com>
369 * options.c (General_options::finalize): Add check for -static and
371 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
374 2008-10-02 Cary Coutant <ccoutant@google.com>
376 * plugin.cc (make_sized_plugin_object): Fix conditional
377 compilation to work when not all targets are enabled.
379 2008-09-29 Cary Coutant <ccoutant@google.com>
381 * archive.cc (Archive::get_file_and_offset): Use filename instead
382 of name to get library path.
383 (Archive::include_member): Unlock external member of a thin archive.
385 * testsuite/Makefile.am (TEST_AR): New variable.
386 (thin_archive_test_1): New test.
387 (thin_archive_test_2): New test.
388 * testsuite/Makefile.in: Regenerate.
389 * testsuite/thin_archive_main.cc: New file.
390 * testsuite/thin_archive_test_1.cc: New file.
391 * testsuite/thin_archive_test_2.cc: New file.
392 * testsuite/thin_archive_test_3.cc: New file.
393 * testsuite/thin_archive_test_4.cc: New file.
395 2008-09-29 Cary Coutant <ccoutant@google.com>
397 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
398 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
400 (Sized_relobj::do_finalize_local_symbols): Likewise.
401 (Sized_relobj::map_to_kept_section): Likewise.
402 * object.h (Sized_relobj::invalid_address): New constant.
403 (Sized_relobj::do_output_section_offset): Check for invalid_address
405 * output.cc (Output_reloc::local_section_offset): Use constant
406 invalid_address instead of -1U.
407 (Output_reloc::get_address): Likewise.
408 (Output_section::output_address): Change -1U to -1ULL.
409 * output.h (Output_reloc::invalid_address): New constant.
410 * reloc.cc (Sized_relobj::write_sections): Use constant
411 invalid_address instead of -1U.
412 (Sized_relobj::relocate_sections): Likewise.
413 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
414 values for merge sections.
415 * target-reloc.h (relocate_for_relocatable): Use constant
416 invalid_address instead of -1U.
418 2008-09-19 Cary Coutant <ccoutant@google.com>
420 Add plugin functionality for link-time optimization (LTO).
421 * configure.ac (plugins): Add --enable-plugins option.
422 * configure: Regenerate.
423 * config.in: Regenerate.
424 * Makefile.am (LIBDL): New variable.
425 (CCFILES): Add plugin.cc.
426 (HFILES): Add plugin.h.
427 (ldadd_var): Add LIBDL.
428 * Makefile.in: Regenerate.
430 * archive.cc: Include "plugin.h".
431 (Archive::setup): Don't preread archive symbols when using a plugin.
432 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
433 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
435 (Archive::include_member): Add symbols from plugin objects.
436 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
437 * descriptors.cc (Descriptors::open): Check for file descriptors
438 abandoned by plugins.
439 (Descriptors::claim_for_plugin): New function.
440 * descriptors.h (Descriptors::claim_for_plugin): New function.
441 (Open_descriptor::is_claimed): New field.
442 (claim_descriptor_for_plugin): New function.
443 * fileread.cc (File_read::claim_for_plugin): New function.
444 * fileread.h (File_read::claim_for_plugin): New function.
445 (File_read::descriptor): New function.
446 * gold.cc: Include "plugin.h".
447 (queue_initial_tasks): Add task to call plugin hooks for generating
449 * main.cc: Include "plugin.h".
450 (main): Load plugin libraries.
451 * object.h (Pluginobj): Declare.
452 (Object::pluginobj): New function.
453 (Object::do_pluginobj): New function.
454 (Object::set_target): New function.
455 * options.cc: Include "plugin.h".
456 (General_options::parse_plugin): New function.
457 (General_options::General_options): Initialize plugins_ field.
458 (General_options::add_plugin): New function.
459 * options.h (Plugin_manager): Declare.
460 (General_options): Add --plugin option.
461 (General_options::has_plugins): New function.
462 (General_options::plugins): New function.
463 (General_options::add_plugin): New function.
464 (General_options::plugins_): New field.
465 * plugin.cc: New file.
466 * plugin.h: New file.
467 * readsyms.cc: Include "plugin.h".
468 (Read_symbols::do_read_symbols): Check for archive before checking
469 for ELF file. Call plugin hooks to claim files.
470 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
471 from a real object file; force override when processing replacement
473 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
474 (Symbol::init_base_object): Likewise.
475 (Symbol::init_base_output_data): Likewise.
476 (Symbol::init_base_output_segment): Likewise.
477 (Symbol::init_base_constant): Likewise.
478 (Symbol::init_base_undefined): Likewise.
479 (Symbol::output_section): Assert that object is not a plugin.
480 (Symbol_table::add_from_pluginobj): New function.
481 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
483 (Symbol_table::sized_write_globals): Likewise.
484 (Symbol_table::add_from_pluginobj): Instantiate template.
485 * symtab.h (Sized_pluginobj): Declare.
486 (Symbol::in_real_elf): New function.
487 (Symbol::set_in_real_elf): New function.
488 (Symbol::in_real_elf_): New field.
489 (Symbol_table::add_from_pluginobj): New function.
491 * testsuite/Makefile.am (AM_CFLAGS): New variable.
492 (LIBDL): New variable.
494 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
495 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
496 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
497 (MOSTLYCLEANFILES): Likewise.
498 * testsuite/Makefile.in: Regenerate.
499 * testsuite/plugin_test.c: New file.
500 * testsuite/plugin_test_1.sh: New file.
501 * testsuite/plugin_test_2.sh: New file.
503 2008-09-16 Ian Lance Taylor <iant@google.com>
505 * target-reloc.h (relocate_section): Check whether a symbol is
506 defined by the ABI before reporting an undefined symbol error.
507 * target.h (Target::is_defined_by_abi): Make parameter const.
508 (Target::do_is_defined_by_abi): Likewise.
509 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
510 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
511 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
512 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
513 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
514 * testsuite/Makefile.in: Rebuild.
516 * fileread.cc (make_view): Add casts to avoid warning.
518 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
520 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
521 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
523 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
525 * options.h (General_options::output_is_executable): New.
526 (General_options::output_is_pie): New.
527 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
528 for shared libraries.
529 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
531 2008-09-11 Chris Demetriou <cgd@google.com>
533 * options.h (origin): New -z option.
534 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
535 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
538 2008-09-05 Cary Coutant <ccoutant@google.com>
540 * fileread.cc (File_read::make_view): Add check for attempt to map
543 2008-09-05 Cary Coutant <ccoutant@google.com>
545 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
546 explicit instantiations.
548 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
551 * options.cc (General_options::finalize): Allow undefined symbols
552 in shlibs if linking -shared.
555 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
556 symbols as not needing a dynsym entry.
558 2008-08-20 Craig Silverstein <csilvers@google.com>
560 * fileread.cc (File_read::open): Do not lock the file unless it
561 was successfully opened.
563 2008-08-14 Cary Coutant <ccoutant@google.com>
565 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
566 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
567 * testsuite/tls_test.cc (struct int128): 128-bit struct
568 for testing TLS relocs with non-zero addend.
569 (v12): New TLS variable.
571 (t_last): Add check for v12.
572 * testsuite/tls_test.h (t12): New function.
573 * testsuite/tls_test_main.cc (thread_routine): Call new test.
575 2008-08-13 Ian Lance Taylor <iant@google.com>
577 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
578 set tls_segment_ or relro_segment_.
579 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
581 * output.h (Output_section::clear_is_relro): New function.
582 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
583 sections specially even when output_data_ is empty.
584 (Output_segment::maximum_alignment): When first section is relro,
585 only force alignment for PT_LOAD segments.
586 * script.cc (script_data_segment_align): New function.
587 (script_data_segment_relro_end): New function.
588 * script-c.h (script_data_segment_align): Declare.
589 (script_data_segment_relro_end): Declare.
590 * script-sections.h (class Script_sections): Declare
591 data_segment_align and data_segment_relro_end. Add fields
592 segment_align_index_ and saw_relro_end_.
593 * script-sections.cc (class Sections_element): Add set_is_relro
594 virtual function. Add new bool* parameter to place_orphan_here.
595 Add get_output_section virtual function.
596 (class Output_section_definition): Add set_is_relro. Add new
597 bool* parameter to place_orphan_here. Add get_output_section.
599 (Output_section_definition::Output_section_definition): Initialize
600 evaluated_address_, evaluated_load_address, evaluated_addralign_,
601 and is_relro_ fields.
602 (Output_section_definition::place_orphan_here): Add is_relro
604 (Output_section_definition::set_section_addresses): Set relro for
606 (Output_section_definition::alternate_constraint): Likewise.
607 (class Orphan_output_section): Add new bool* parameter to
608 place_orphan_here. Add get_output_section.
609 (Orphan_output_section::place_orphan_here): Add is_relro
611 (Script_sections::Script_sections): Initialize
612 data_segment_align_index_ and saw_relro_end_.
613 (Script_sections::data_segment_align): New function.
614 (Script_sections::data_segment_relro_end): New function.
615 (Script_sections::place_orphan): Set or clear is_relro.
616 (Script_sections::set_section_addresses): Force alignment of first
618 * yyscript.y (exp): Call script_data_segment_align and
619 script_data_segment_relro_end.
620 * testsuite/relro_script_test.t: New file.
621 * testsuite/relro_test.cc (using_script): Declare.
622 (t1, t2): Test using_script.
623 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
624 (relro_script_test_SOURCES): Define.
625 (relro_script_test_DEPENDENCIES): Define.
626 (relro_script_test_LDFLAGS): Define.
627 (relro_script_test_LDADD): Define.
628 (relro_script_test.so): New target.
629 * testsuite/Makefile.in: Rebuild.
631 2008-08-06 Cary Coutant <ccoutant@google.com>
633 * archive.cc (Archive::total_archives, Archive::total_members)
634 (Archive::total_members_loaded): New variables.
635 (Archive::setup): Add parameter. Add option to preread
637 (Archive::read_armap): Add counter.
638 (Archive::get_file_and_offset): New function.
639 (Archive::get_elf_object_for_member): New function.
640 (Archive::read_all_symbols): New function.
641 (Archive::read_symbols): New function.
642 (Archive::add_symbols): Add counters.
643 (Archive::include_all_members): Use armap to find members if it's
645 (Archive::include_member): Skip reading symbols if already read.
646 Factored code into Archive::get_file_and_offset and
647 Archive::get_elf_object_for_member. Changed call to
648 Mapfile::report_include_archive_member.
649 (Archive::print_stats): New function.
650 * archive.h: Declare Object and Read_symbols_data classes.
651 (Archive::Archive): Add initializers for new members.
652 (Archive::setup): Add parameter.
653 (Archive::print_stats): New function.
654 (Archive::total_archives, Archive::total_members)
655 (Archive::total_members_loaded): New variables.
656 (Archive::get_file_and_offset): New function.
657 (Archive::get_elf_object_for_member): New function.
658 (Archive::read_all_symbols): New function.
659 (Archive::read_symbols): New function.
660 (Archive::Archive_member): New class.
661 (Archive::members_): New member.
662 (Archive::num_members_): New member.
663 * main.cc: Include archive.h.
664 (main): Call Archive::print_stats.
665 * mapfile.cc (Mapfile::report_include_archive_member): Delete
666 archive parameter; member_name is now the fully-decorated name.
667 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
668 * options.h: (General_options): Add --preread-archive-symbols option.
669 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
672 2008-08-04 Ian Lance Taylor <iant@google.com>
674 * symtab.h (Symbol::use_plt_offset): New function.
675 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
676 * powerpc.cc (Relocate::relocate): Likewise.
677 * sparc.cc (Relocate::relocate): Likewise.
678 * x86_64.cc (Relocate::relocate): Likewise.
679 * testsuite/weak_plt.sh: New test.
680 * testsuite/weak_plt_main.cc: New test.
681 * testsuite/weak_plt_shared.cc: New test.
682 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
683 (check_PROGRAMS): Add weak_plt.
684 (check_DATA): Add weak_plt_shared.so.
685 (weak_plt_main_pic.o, weak_plt): New targets.
686 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
687 * testsuite/Makefile.in: Rebuild.
689 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
691 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
692 * testsuite/Makefile.in: Rebuild.
694 2008-08-04 Alan Modra <amodra@bigpond.net.au>
696 * Makefile.am (POTFILES.in): Set LC_ALL=C.
697 * Makefile.in: Regenerate.
698 * po/POTFILES.in: Regenerate.
700 2008-07-29 Ian Lance Taylor <iant@google.com>
702 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
703 symbols before other symbols.
704 * testsuite/script_test_2.cc (test_addr): Declare.
705 (test_addr_alias): Declare.
706 (main): Check that test_addr and test_addr_alias have the right
708 * testsuite/script_test_2.t: Define test_addr_alias and
711 2008-07-24 Ian Lance Taylor <iant@google.com>
714 * descriptors.cc: New file.
715 * descriptors.h: New file.
716 * gold-threads.h (class Hold_optional_lock): New class.
717 * fileread.cc: Include "descriptors.h".
718 (File_read::~File_read): Release descriptor rather than closing
720 (File_read::open) [file]: Call open_descriptor rather than open.
721 Set is_descriptor_opened_.
722 (File_read::open) [memory]: Assert that descriptor is not open.
723 (File_read::reopen_descriptor): New function.
724 (File_read::release): Release descriptor.
725 (File_read::do_read): Make non-const. Reopen descriptor.
726 (File_read::read): Make non-const.
727 (File_read::make_view): Reopen descriptor.
728 (File_read::do_readv): Likewise.
729 * fileread.h (class File_read): Add is_descriptor_opened_ field.
731 * layout.cc: Include "descriptors.h".
732 (Layout::create_build_id): Use open_descriptor rather than open.
733 * output.cc: Include "descriptors.h".
734 (Output_file::open): Use open_descriptor rather than open.
735 * archive.cc (Archive::const_iterator): Change Archive to be
737 (Archive::begin, Archive::end): Make non-const.
738 (Archive::count_members): Likewise.
739 * archive.h (class Archive): Update declarations.
740 * object.h (Object::read): Make non-const.
741 * Makefile.am (CCFILES): Add descriptors.cc.
742 (HFILES): Add descriptors.h.
743 * Makefile.in: Rebuild.
746 * gold.h: Always include <clocale>. Add Solaris workarounds
747 following code in binutils/sysdep.h.
750 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
751 this->eh_frame_hdr_ is NULL before using it.
753 * dynobj.cc (Versions::Versions): Update comment.
755 * dynobj.cc (Versions::Versions): If there is an soname, use it as
756 the base version name.
758 * stringpool.cc (Stringpool_template::add_with_length): Set key to
760 (Stringpool_template::set_string_offsets): Subtract one from key
761 before using it as an array index.
762 (Stringpool_template::get_offset_with_length): Likewise.
763 (Stringpool_template::write_to_buffer): Likewise.
764 * stringpool.h (Stringpool_template::get_offset_from_key):
767 2008-07-23 Ian Lance Taylor <iant@google.com>
770 * object.h (Merged_symbol_value::value): Do our best to handle a
774 * script.cc (Version_script_info::get_versions): Don't add empty
775 version tag to return value.
776 (Version_script_info::get_symbol_version_helper): Change return
777 type to bool. Add pversion parameter. Change all callers.
778 (script_register_vers_node): Don't require a non-NULL tag.
779 * script.h (class Version_script_info): Update declarations.
780 (Version_script_info::get_symbol_version): Change return type to
781 bool. Add version parameter. Change all callers.
782 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
783 handling. Handle an empty version from a version script.
784 (Symbol_table::define_special_symbol): Likewise.
785 * testsuite/ver_test_10.script: New file.
786 * testsuite/ver_test_10.sh: New file.
787 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
788 (check_DATA): Add ver_test_10.syms.
789 (ver_test_10.syms, ver_test_10.so): New target.
790 * testsuite/Makefile.in: Rebuild.
792 2008-07-23 Simon Baldwin <simonb@google.com>
794 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
795 to zero for undefined symbols from dynamic libraries.
797 2008-07-23 Ian Lance Taylor <iant@google.com>
799 * symtab.cc (Symbol_table::resolve): Remove version parameter.
801 * symtab.h (class Symbol_table): Update declaration.
802 * testsuite/ver_test_9.cc: New file.
803 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
804 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
805 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
806 (ver_test_9.so, ver_test_9.o): New targets.
807 * testsuite/Makefile.in: Rebuild.
809 2008-07-22 Ian Lance Taylor <iant@google.com>
811 * options.h (class General_options): Define --check-sections.
812 * layout.cc (Layout::set_segment_offsets): Handle
815 * options.h (class General_options): Define -n/--nmagic and
817 * options.cc (General_options::finalize): For -n/--nmagic or
818 -N/--omagic, set -static.
819 * layout.cc (Layout::attach_allocated_section_to_segment): If
820 -N/--omagic, don't put read-only and read-write sections in
822 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
823 finding a read-only segment.
824 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
825 don't set the minimum segment alignment to the common page size,
826 and don't set the file offset to the address modulo the page size.
827 * script-sections.cc (Script_sections::create_segments): If
828 -n/--omagic, don't put read-only and read-write sections in
833 * options.h (class General_options): Add --print-symbol-counts.
834 * main.cc (main): Issue defined symbol report if requested.
835 * archive.cc (Archive::interpret_header): Make into a const member
837 (Archive::add_symbols): Call Input_objects::archive_start and
839 (Archive::const_iterator): Define new class.
840 (Archive::begin, Archive::end): New functions.
841 (Archive::include_all_members): Rewrite to use iterator.
842 (Archive::count_members): New function.
843 * archive.h (class Archive): Update declarations.
844 (Archive::filename): New function.
845 * object.cc: Include "cref.h".
846 (Sized_relobj::Sized_relobj): Initialize defined_count_.
847 (Sized_relobj::do_get_global_symbol_counts): New function.
848 (Input_objects::add_object): Add object to cross-referencer.
849 (Input_objects::archive_start): New function.
850 (Input_objects::archive_stop): New function.
851 (Input_objects::print_symbol_counts): New function.
852 * object.h: Declare Cref and Archive.
853 (Object::get_global_symbol_counts): New function.
854 (Object::do_get_global_symbol_counts): New pure virtual function.
855 (class Sized_relobj): Add defined_count_ field. Update
857 (class Input_objects): Add cref_ field. Update constructor.
859 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
861 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
863 (Sized_dynobj::do_get_global_symbol_counts): New function.
864 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
865 defined_count_. Update declarations. Define Symbols typedef.
866 * symtab.cc (Symbol_table::add_from_relobj): Add defined
867 parameter. Change all callers.
868 (Symbol_table::add_from_dynobj): Add sympointers and defined
869 parameters. Change all callers.
870 * symtab.h (class Symbol_table): Update declarations.
871 * Makefile.am (CCFILES): Add cref.cc.
872 (HFILES): Add cref.h.
873 * Makefile.in: Rebuild.
875 2008-07-22 Simon Baldwin <simonb@google.com>
877 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
878 to zero when writing undefined symbols.
880 2008-07-22 Ian Lance Taylor <iant@google.com>
882 * output.cc (Output_section::add_input_section): Don't try to
883 merge empty merge sections.
885 2008-07-21 Craig Silverstein <csilvers@google.com>
887 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
888 Include symbol version in error message.
890 2008-07-20 Chris Demetriou <cgd@google.com>
892 * configure.ac (gold_cv_c_random_seed): New configured variable.
893 (RANDOM_SEED_CFLAGS): New substituted variable.
894 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
895 * configure: Rebuild.
896 * Makefile.in: Likewise.
897 * testsuite/Makefile.in: Likewise.
899 2008-07-18 Ian Lance Taylor <iant@google.com>
901 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
902 where we see NAME/NULL and NAME/VERSION as separate symbols.
903 * testsuite/ver_test_main.cc (main): Call t4.
905 * testsuite/ver_test_2.cc (t4_2): Define.
906 * testsuite/ver_test_2.script: Put t4_2a in VER2.
907 * testsuite/ver_test_4.cc (t4_2a): Define.
908 * testsuite/ver_test_4.script: Put t4_2a in VER2.
909 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
911 2008-07-17 Ian Lance Taylor <iant@google.com>
913 * dynobj.cc (Versions::add_def): If we give an error about a
914 missing version, go ahead and create the version anyhow.
916 2008-07-10 Ian Lance Taylor <iant@google.com>
918 Handle output sections with more than 0x7fffffff bytes.
919 * object.h (class Relobj): Change map_to_output_ to
920 output_sections_, and just keep a section pointer. Change all
921 uses. Move comdat group support to Sized_relobj.
922 (Relobj::is_section_specially_mapped): Remove.
923 (Relobj::output_section): Remove poff parameter. Change all
925 (Relobj::output_section_offset): New function.
926 (Relobj::set_section_offset): Rewrite.
927 (Relobj::map_to_output): Remove.
928 (Relobj::output_sections): New function.
929 (Relobj::do_output_section_offset): New pure virtual function.
930 (Relobj::do_set_section_offset): Likewise.
931 (class Sized_relobj): Add section_offsets_ field. Add comdat
932 group support from Relobj. Update declarations.
933 (Sized_relobj::get_output_section_offset): New function.
934 (Sized_relobj::do_output_section_offset): New function.
935 (Sized_relobj::do_set_section_offset): New function.
936 * object.cc (Relobj::output_section_address): Remove.
937 (Sized_relobj::Sized_relobj): Initialize new fields.
938 (Sized_relobj::include_section_group): Cast find_kept_object to
940 (Sized_relobj::include_linkonce_section): Likewise.
941 (Sized_relobj::do_layout): Use separate arrays for output section
943 (Sized_relobj::do_count_local_symbols): Change map_to_output to
945 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
946 output_sections and section_offsets.
947 (Sized_relobj::write_local_symbols): Likewise.
948 (map_to_kept_section): Compute output address directly.
949 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
950 output_sections and section_offsets.
951 (Sized_relobj::write_sections): Likewise.
952 (Sized_relobj::relocate_sections): Likewise.
953 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
954 * output.h (class Output_reloc): Update declarations. Change
955 u2_.relobj to Sized_relobj*.
956 (class Output_data_reloc): Change add functions to use
958 * output.cc (Output_reloc::Output_reloc): Change relobj to
960 (Output_reloc::local_section_offset): Change return type to
961 Elf_Addr. Use get_output_section_offset.
962 (Output_reloc::get_address): Likewise.
963 (Output_section::is_input_address_mapped): Don't call
964 is_section_specially_mapped.
965 (Output_section::output_offset): Likewise.
966 (Output_section::output_address): Likewise.
967 (Output_section::starting_output_address): Likewise.
968 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
969 parameter to Sized_relobj*.
970 (Copy_relocs::need_copy_reloc): Likewise.
971 (Copy_relocs::save): Likewise.
972 * copy-relocs.h (class Copy_relocs): Update declarations.
973 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
974 Sized_relobj*. Change relobj_ field to Sized_relobj*.
975 * target-reloc.h (relocate_for_relocatable): Change
976 offset_in_output_section type to Elf_Addr. Change code that uses
978 * layout.cc (Layout::layout): Always set *off.
979 * mapfile.cc (Mapfile::print_input_section): Use
980 output_section_offset.
981 * i386.cc (Target_i386::copy_reloc): Change object parameter to
983 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
984 * sparc.cc (Target_sparc::copy_reloc): Likewise.
985 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
987 2008-07-03 Ian Lance Taylor <iant@google.com>
989 * layout.cc (Layout::include_section): Do not discard unrecognized
992 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
994 * script.cc (Lex::can_continue_name): Make '?' allowable in
995 version-script names.
996 * testsuite/version_script.map: Change glob pattern to use '?'
998 2008-06-30 Manish Singh <yosh@gimp.org>
1001 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
1004 2008-06-30 Ian Lance Taylor <iant@google.com>
1008 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
1009 versions]: Don't try to read the value in the contents, since we
1010 don't use it. Use the template endianness when writing.
1012 2008-06-25 Cary Coutant <ccoutant@google.com>
1014 * fileread.cc (File_read::make_view): Assert on zero-length view.
1015 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
1016 symbol table when there are no symbols to read.
1018 2008-06-23 Craig Silverstein <csilvers@google.com>
1020 * version.cc (version_string): Bump to 1.7
1022 2008-06-18 Craig Silverstein <csilvers@google.com>
1024 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
1025 constant 0xFFFF to type Valtype.
1026 (Powerpc_relocate_functions::rel16_ha): Likewise.
1028 2008-06-17 Ian Lance Taylor <iant@google.com>
1030 * output.h (Output_section::Input_section): Initialize p2align_ to
1031 zero for Output_section_data constructors.
1032 (Output_section::Input_section::addralign): If not an input
1033 section, return the alignment of the Output_section_data.
1034 * testsuite/copy_test.cc: New file.
1035 * testsuite/copy_test_1.cc: New file.
1036 * testsuite/copy_test_2.cc: New file.
1037 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
1038 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
1039 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
1040 (copy_test_1_pic.o, copy_test_1.so): New targets.
1041 (copy_test_2_pic.o, copy_test_2.so): New targets.
1042 * testsuite/Makefile.in: Rebuild.
1044 * script-sections.cc (Script_sections::place_orphan): Initialize
1045 local variable exact.
1047 2008-06-13 David Edelsohn <edelsohn@gnu.org>
1049 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
1051 2008-06-12 David Edelsohn <edelsohn@gnu.org>
1052 David S. Miller <davem@davemloft.net>
1054 * powerpc.cc: New file.
1055 * Makefile.am (TARGETSOURCES): Add powerpc.cc
1056 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
1057 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
1058 * Makefile.in: Rebuild.
1060 2008-06-09 Ian Lance Taylor <iant@google.com>
1062 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
1064 (throwing, orig_terminate): New static variables.
1065 (terminate_handler): New static function.
1066 (t2): Set terminate handler.
1068 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
1071 * binary.cc (Binary_to_elf::sized_convert): Fix .data
1074 2008-05-30 Cary Coutant <ccoutant@google.com>
1076 * archive.cc (Archive::include_all_members) Correct to step
1077 over symbol table and extended name table in thin archives.
1079 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
1082 * target-reloc.h (relocate_for_relocatable): Fix new_offset
1085 2008-05-28 Caleb Howe <cshowe@google.com>
1087 * reduced_debug_output.cc: New file.
1088 * reduced_debug_output.h: New file.
1089 * options.h (class General_options): Add --strip-debug-non-line.
1090 * options.cc (General_options::finalize): Add strip_debug_non_line
1091 to the strip heirarchy.
1092 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
1094 * layout.cc: Include "reduced_debug_output.h".
1095 (Layout::Layout): Initialize new fields.
1096 (line_only_debug_sections): New static array.
1097 (is_lines_only_debug_sections): New static inline function.
1098 (Layout::include_section): Handle --strip-debug-non-line.
1099 (Layout::make_output_section): If --strip-debug-non-line, build
1100 new output sections for .debug_abbrev and .debug_info.
1101 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
1102 gold. Warn about possible overflow.
1103 (read_signed_LEB_128): Likewise.
1104 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
1105 (read_signed_LEB_128): Declare.
1106 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
1107 (HFILES): Add reduced_debug_output.h.
1108 * Makefile.in: Rebuild.
1110 2008-05-21 Ian Lance Taylor <iant@google.com>
1112 * mapfile.cc: New file.
1113 * mapfile.h: New file.
1114 * options.h (class General_options): Add -M/--print-map and -Map.
1115 * options.cc (General_options::finalize): Make -M equivalent to
1117 * main.cc: Include <cstdio> and "mapfile.h".
1118 (main): Open mapfile if requested.
1119 * gold.cc (class Middle_runner): Add mapfile_ field. Update
1120 constructor. Change caller.
1121 (queue_initial_tasks): Add mapfile parameter. Change caller.
1122 (queue_middle_tasks): Likewise.
1123 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
1125 * archive.cc: Include "mapfile.h".
1126 (Archive::add_symbols): Add mapfile parameter. Change all
1127 callers. Pass mapfile, symbol, and reason to include_member.
1128 (Archive::include_all_members): Add mapfile parameter. Change all
1130 (Archive::include_member): Add mapfile, sym, and why parameters.
1131 Change all callers. Report inclusion to map file.
1132 * archive.h: Include "fileread.h".
1133 (class Archive): Update declarations.
1134 (Archive::file): New const method.
1135 (class Add_archive_symbols): Add mapfile_ field. Update
1136 constructor. Change all callers.
1137 * readsyms.h (class Read_symbols): Likewise.
1138 (class Finish_group): Likewise.
1139 (class Read_script): Likewise.
1140 * common.cc: Include "mapfile.h".
1141 (Symbol_table::allocate_commons): Add mapfile parameter. Change
1143 (Symbol_table::do_allocate_commons): Likewise.
1144 (Symbol_table::do_allocate_commons_list): Likewise. Report common
1145 symbol allocation to mapfile.
1146 * common.h (class Allocate_commons_task): Add mapfile_ field.
1147 Update constructor. Change all callers.
1148 * symtab.h (class Symbol_table): Update declarations.
1149 * layout.cc: Include "mapfile.h".
1150 (Layout_task_runner::run): Print information to mapfile.
1151 (Layout::create_gold_note): Change Output_data_fixed_space to
1152 Output_data_zero_fill.
1153 (Layout::create_build_id): Likewise.
1154 (Layout::print_to_mapfile): New function.
1155 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
1156 constructor. Change caller.
1157 (class Layout): Declare print_to_mapfile.
1158 * output.cc (Output_section::Input_section::print_to_mapfile): New
1160 (Output_section::add_input_section): If producing a map, always
1161 add to input_sections_ list.
1162 (Output_section::do_print_to_mapfile): New function.
1163 (Output_segment::print_sections_to_mapfile): New function.
1164 (Output_segment::print_section_list_to_mapfile): New function.
1165 * output.h: Include "mapfile.h".
1166 (Output_data::print_to_mapfile): New function.
1167 (Output_data::do_print_to_mapfile): New virtual function.
1168 (Output_segment_headers::do_print_to_mapfile): New function.
1169 (Output_file_header::do_print_to_mapfile): New function.
1170 (Output_data_const::do_print_to_mapfile): New function.
1171 (class Output_data_const_buffer): Add map_name_ field. Update
1172 constructor. Change all callers. Add do_print_to_mapfile
1174 (class Output_data_fixed_space): Likewise.
1175 (class Output_data_space): Likewise.
1176 (class Output_data_zero_fill): New class.
1177 (Output_data_strtab::do_print_to_mapfile): New function.
1178 (Output_data_reloc_base::do_print_to_mapfile): New function.
1179 (Output_relocatable_relocs::do_print_to_mapfile): New function.
1180 (Output_data_group::do_print_to_mapfile): New function.
1181 (Output_data_got::do_print_to_mapfile): New function.
1182 (Output_data_dynamic::do_print_to_mapfile): New function.
1183 (Output_symtab_xindex::do_print_to_mapfile): New function.
1184 (class Output_section): Declare do_print_to_mapflie. Declare
1185 print_to_mapfile in Input_section.
1186 (class Output_segment): Declare new functions.
1187 * object.h (Sized_relobj::symbol_count): New function.
1188 * script-sections.cc
1189 (Output_section_element_dot_assignment::set_section_addresses):
1190 Change Output_data_fixed_space to Output_data_zero_fill.
1191 (Output_data_expression::do_print_to_mapfile): New function.
1192 * script.cc (read_input_script): Add mapfile parameter. Change
1194 * script.h (read_input_script): Update declaration.
1195 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
1196 (Eh_frame::do_print_to_mapfile): New function.
1197 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
1198 (Output_merge_string::do_print_to_mapfile): New function.
1199 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
1201 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
1203 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
1205 * Makefile.am (CCFILES): Add mapfile.cc.
1206 (HFILES): Add mapfile.h.
1207 * Makefile.in: Rebuild.
1209 2008-05-19 Ian Lance Taylor <iant@google.com>
1211 * options.h (class General_options): Add -z relro.
1212 * layout.cc (Layout::Layout): Initialize relro_segment_.
1213 (Layout::add_output_section_data): Return the output section.
1214 (Layout::make_output_section): Rcognize relro sections and mark
1216 (Layout::attach_allocated_section_to_segment): Put relro sections
1217 in a PT_GNU_RELRO segment.
1218 (Layout::create_initial_dynamic_sections): Mark the .dynamic
1220 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
1222 (Layout::linkonce_mapping): Map d.rel.ro.local to
1224 (Layout::output_section_name): Us .data.rel.ro.local for any
1225 section which begins with that.
1226 * layout.h (class Layout): Update add_output_section_data
1227 declaration. Add relro_segment_ field.
1228 * output.cc (Output_section::Output_section): Initialize is_relro_
1229 and is_relro_local_ fields.
1230 (Output_segment::add_output_section): Group relro sections.
1231 (Output_segment::is_first_section_relro): New function.
1232 (Output_segment::maximum_alignment): If there is a relro section,
1233 align the segment to the common page size.
1234 (Output_segment::set_section_addresses): Track whether we are
1235 looking at relro sections. If the last section is a relro
1236 section, align to the common page size.
1237 (Output_segment::set_section_list_addresses): Add in_relro
1238 parameter. Change all callers. Align to the page size when
1239 moving from relro to non-relro section.
1240 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
1242 * output.h (class Output_section): Add is_relro_ and
1243 is_relro_local_ fields.
1244 (Output_section::is_relro): New function.
1245 (Output_section::set_is_relro): New function.
1246 (Output_section::is_relro_local): New function.
1247 (Output_section::set_is_relro_local): New function.
1248 (class Output_segment): Update declarations.
1249 * i386.cc (Target_i386::got_section): Mark .got section as relro.
1250 * sparc.cc (Target_sparc::got_section): Likewise.
1251 * x86_64.cc (Target_x86_64::got_section): Likewise.
1252 * testsuite/relro_test_main.cc: New file.
1253 * testsuite/relro_test.cc: New file.
1254 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
1255 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
1256 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
1257 (relro_test.so, relro_test_pic.o): New targets.
1258 * testsuite/Makefile.in: Rebuild.
1260 2008-05-16 Ian Lance Taylor <iant@google.com>
1262 * output.cc (Output_segment::add_output_section): Remove front
1264 * output.h (class Output_segment): Remove
1265 add_initial_output_section and overloaded add_output_section.
1266 Update declaration of remaining add_output_section.
1267 * layout.cc (Layout::create_interp): Call add_output_section
1268 rather than add_initial_output_section.
1269 (Layout::finish_dynamic_section): Likewise.
1271 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
1272 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
1273 know the dynamic type.
1274 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
1275 field. Initialize it in constructor.
1276 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
1277 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
1278 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
1281 * output.cc (Output_reloc::get_address): Change return type to
1283 * output.h (class Output_reloc): Update get_address declaration.
1284 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
1285 for section addresses.
1287 2008-05-09 Ian Lance Taylor <iant@google.com>
1290 * gold.cc (gold_nomem): Use return value of write.
1292 2008-05-08 Ian Lance Taylor <iant@google.com>
1294 * symtab.c (Symbol::init_base_output_data): Add version
1295 parameter. Change all callers.
1296 (Symbol::init_base_output_segment): Likewise.
1297 (Symbol::init_base_constant): Likewise.
1298 (Symbol::init_base_undefined): Likewise.
1299 (Sized_symbol::init_output_data): Likewise.
1300 (Sized_symbol::init_output_segment): Likewise.
1301 (Sized_symbol::init_constant): Likewise.
1302 (Sized_symbol::init_undefined): Likewise.
1303 (Symbol_table::do_define_in_output_data): If the new symbol has a
1304 version, mark it as the default.
1305 (Symbol_table::do_define_in_output_segment): Likewise.
1306 (Symbol_table::do_define_as_constant): Likewise.
1307 * symtab.h (class Symbol): Update declarations.
1308 (class Sized_symbol): Likewise.
1309 * resolve.cc (Symbol::override_version): New function.
1310 (Symbol::override_base): Call override_version.
1311 (Symbol::override_base_with_special): Likewise.
1312 * testsuite/ver_script_8.script: New file.
1313 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
1314 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
1315 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
1316 (ver_test_8_1.so, ver_test_8_2.so): New targets.
1318 2008-05-06 Ian Lance Taylor <iant@google.com>
1321 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
1323 (class General_options): Remove existing --undefined, and add
1324 --no-undefined instead. Add new --undefined as synonym for -u.
1325 * archive.cc (Archive::add_symbols): Check whether symbol was
1327 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
1328 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
1329 all uses. Add IS_UNDEFINED. Update declarations to split
1330 different versions of init_base. Declare init_base_undefined.
1331 (Symbol::is_defined): Handle IS_UNDEFINED.
1332 (Symbol::is_undefined): Likewise.
1333 (Symbol::is_weak_undefined): Call is_undefined.
1334 (Symbol::is_absolute): Handle IS_CONSTANT.
1335 (class Sized_symbol): Update declarations to split different
1336 versions of init. Declare init_undefined.
1337 (class Symbol_table): Declare new functions.
1338 * symtab.cc (Symbol::init_base_object): Rename from init_base.
1340 (Symbol::init_base_output_data): Likewise.
1341 (Symbol::init_base_output_segment): Likewise.
1342 (Symbol::init_base_constant): Likewise.
1343 (Symbol::init_base_undefined): New function.
1344 (Sized_symbol::init_object): Rename from init. Change all
1346 (Sized_symbol::init_output_data): Likewise.
1347 (Sized_symbol::init_output_segment): Likewise.
1348 (Sized_symbol::init_constant): Likewise.
1349 (Sized_symbol::init_undefined): New function.
1350 (Symbol_table::add_undefined_symbols_from_command_line): New
1352 (Symbol_table::do_add_undefined_symbols_from_command_line): New
1354 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
1355 (Symbol::output_section): Likewise.
1356 (Symbol::set_output_section): Likewise.
1357 (Symbol_table::sized_finalize_symbol): Likewise.
1358 (Symbol_table::sized_write_globals): Likewise.
1359 * resolve.cc (Symbol_table::should_override): Likewise.
1360 (Symbol::override_base_with_special): Likewise.
1362 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
1363 symbol, change it to have default visibility.
1364 * testsuite/protected_1.cc: New file.
1365 * testsuite/protected_2.cc: New file.
1366 * testsuite/protected_3.cc: New file.
1367 * testsuite/protected_main_1.cc: New file.
1368 * testsuite/protected_main_2.cc: New file.
1369 * testsuite/protected_main_3.cc: New file.
1370 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
1371 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
1372 (protected_1_LDFLAGS, protected_1_LDADD): Define.
1373 (protected_1.so): New target.
1374 (protected_1_pic.o, protected_2_pic.o): New targets.
1375 (protected_3_pic.o): New target.
1376 (check_PROGRAMS): Add protected_2.
1377 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
1378 (protected_2_LDFLAGS, protected_2_LDADD): Define.
1379 * testsuite/Makefile.in: Rebuild.
1381 * options.h (DEFINE_var): Add set_user_set_##varname__.
1382 (DEFINE_bool_alias): New macro.
1383 (class General_options): Define -Bstatic using DEFINE_bool_alias
1384 rather than DEFINE_special. Add --undefined as an alias for -z
1386 * options.cc (General_options::parse_Bstatic): Remove.
1388 * options.h (class General_options): Add --fatal-warnings.
1389 * main.cc (main): Implement --fatal-warnings.
1390 * errors.h (Errors::warning_count): New function.
1392 * options.h (class General_options): Add -Bsymbolic-functions.
1393 * symtab.h (Symbol::is_preemptible): Check for
1394 -Bsymbolic-functions.
1396 2008-05-05 Ian Lance Taylor <iant@google.com>
1398 * options.h (DEFINE_bool): For DASH_Z, create the negative option
1399 as noVARNAME rather than no-VARNAME.
1400 (class General_options): Add option -z combreloc.
1401 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
1403 (Output_reloc::sort_before) [SHT_REL]: New function.
1404 (Output_reloc::sort_before) [SHT_RELA]: New function.
1405 (class Output_data_reloc_base): Add sort_relocs_ field. Define
1406 Sort_relocs_comparison.
1407 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
1408 parameter. Change all callers.
1409 (Output_data_reloc::Output_data_reloc) [both versions]: Add
1410 sort_relocs parameter. Change all callers.
1411 * output.cc (Output_reloc::get_address): New function, broken out
1413 (Output_reloc::write_rel): Call it.
1414 (Output_reloc::compare): New function.
1415 (Output_data_reloc_base::do_write): Optionally sort relocs.
1417 * configure.ac: If targ_extra_obj is set, link it in.
1418 * configure.tgt: Initialize all variables.
1419 (x86_64*): Set targ_extra_obj and targ_extra_size.
1420 * configure: Rebuild.
1422 * object.cc (Sized_relobj::include_section_group): Adjust section
1423 indexes read from group data. Build vector to pass to
1425 * layout.cc (Layout::layout_group): Add flags and shndxes
1426 parameters. Remove contents parameter. Change caller. Update
1427 explicit instantiations.
1428 * layout.h (class Layout): Update layout_group declaration.
1429 * output.cc (Output_data_group::Output_data_group): Add flags and
1430 input_shndxes parameters. Remove contents parameter. Change
1432 (Output_data_group::do_write): Change input_sections_ to
1434 * output.h (class Output_data_group): Update constructor
1435 declaration. Rename input_sections_ to input_shndxes_.
1436 * testsuite/many_sections_test.cc: Add template.
1438 2008-04-30 Cary Coutant <ccoutant@google.com>
1440 * target-reloc.h (relocate_section): Fix dead-pointer bug.
1442 * layout.cc (Layout::include_section): Refactored check for debug
1444 (Layout::add_comdat): Add new parameters. Change type
1445 of signature parameter. Add object and shndx to signatures table.
1446 (Layout::find_kept_object): New function.
1447 * layout.h: Include <cstring>.
1448 (Layout::is_debug_info_section): New function.
1449 (Layout::add_comdat): Add new parameters.
1450 (Layout::find_kept_object): New function.
1451 (Layout::Kept_section): New struct.
1452 (Layout::Signatures): Change type of map range.
1453 * object.cc (Relobj::output_section_address): New function.
1454 (Sized_relobj::include_section_group): Add new parameters. Change
1455 calls to Layout::add_comdat. Change to build table of kept comdat
1456 groups and table mapping discarded sections to kept sections.
1457 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
1458 (Sized_relobj::do_layout): Change calls to include_section_group and
1459 include_linkonce_section.
1460 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
1461 value to zero when section is discarded.
1462 (Sized_relobj::map_to_kept_section): New function.
1463 * object.h (Relobj::output_section_address): New function.
1464 (Relobj::Comdat_group): New type.
1465 (Relobj::find_comdat_group): New function.
1466 (Relobj::Comdat_group_table): New type.
1467 (Relobj::Kept_comdat_section): New type.
1468 (Relobj::Kept_comdat_section_table): New type.
1469 (Relobj::add_comdat_group): New function.
1470 (Relobj::set_kept_comdat_section): New function.
1471 (Relobj::get_kept_comdat_section): New function.
1472 (Relobj::comdat_groups_): New field.
1473 (Relobj::kept_comdat_sections_): New field.
1474 (Symbol_value::input_value): Update comment.
1475 (Sized_relobj::map_to_kept_section) New function.
1476 (Sized_relobj::include_linkonce_section): Add new parameter.
1477 * target-reloc.h (Comdat_behavior): New type.
1478 (get_comdat_behavior): New function.
1479 (relocate_section): Add code to map a discarded section to the
1480 corresponding kept section when applying a relocation.
1482 2008-04-30 Craig Silverstein <csilvers@google.com>
1484 * dwarf_reader.cc (next_generation_count): New static var.
1485 (Addr2line_cache_entry): New struct.
1486 (addr2line_cache): New static var.
1487 (Dwarf_line_info::one_addr2line): Added caching.
1488 (Dwarf_line_info::clear_addr2line_cache): New function.
1489 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
1490 cache-size parameter.
1491 (Dwarf_line_info::one_addr2line_cache): New function.
1492 * symtab.cc (Symbol_table::detect_odr_violations): Pass
1493 new cache-size argument to one_addr2line(), and clear cache.
1495 2008-04-28 Cary Coutant <ccoutant@google.com>
1497 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
1498 R_386_PC8 relocations.
1500 2008-04-23 Ian Lance Taylor <iant@google.com>
1502 * object.cc (Sized_relobj::include_section_group): Check for
1503 invalid section group.
1505 * object.cc (make_elf_object): Correct test for 64-bit ELF file
1508 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
1509 than read for file header.
1510 * archive.cc (Archive::include_member): Likewise.
1512 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
1514 * aclocal.m4: Regenerate.
1515 * configure: Regenerate.
1517 2008-04-19 Ian Lance Taylor <iant@google.com>
1519 * version.cc (version_string): Bump to 1.6.
1521 * testsuite/Makefile.am (many_sections_r_test): New target.
1522 (many_sections_r_test_SOURCES): Remove.
1523 (many_sections_r_test_DEPENDENCIES): Remove.
1524 (many_sections_r_test_LDFLAGS): Remove.
1525 (many_sections_r_test_LDADD): Remove.
1527 * object.cc (Sized_relobj::do_add_symbols): Always pass
1528 local_symbol_count_ to add_from_relobj.
1530 * testsuite/Makefile.am (many_sections_check.h): Only check one in
1531 every thousand variables.
1532 * testsuite/Makefile.in: Rebuild.
1534 * object.cc (Xindex::initialize_symtab_xindex): New function.
1535 (Xindex::read_symtab_xindex): New function.
1536 (Xindex::sym_xindex_to_shndx): New function.
1537 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
1539 (Sized_relobj::do_initialize_xindex): New function.
1540 (Sized_relobj::do_read_symbols): Adjust section links.
1541 (Sized_relobj::symbol_section_and_value): Add is_ordinary
1542 parameter. Change all callers.
1543 (Sized_relobj::include_section_group): Adjust section links and
1544 symbol section indexes.
1545 (Sized_relobj::do_layout): Adjust section links.
1546 (Sized_relobj::do_count_local_symbols): Adjust section links and
1547 symbol section indexes.
1548 (Sized_relobj::do_finalize_local_symbols): Distinguish between
1549 ordinary and special symbols.
1550 (Sized_relobj::write_local_symbols): Add symtab_xindex and
1551 dynsym_xindex parameters. Change all callers. Adjust section
1552 links. Use SHN_XINDEX when needed.
1553 (Sized_relobj::get_symbol_location_info): Adjust section links.
1554 Don't get fooled by special symbols.
1555 * object.h (class Xindex): Define.
1556 (class Object): Add xindex_ parameter. Declare virtual functoin
1557 do_initialize_xindex.
1558 (Object::adjust_sym_shndx): New function.
1559 (Object::set_xindex): New protected function.
1560 (class Symbol_value): Add is_ordinary_shndx_ field.
1561 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
1562 (Symbol_value::value): Assert ordinary section.
1563 (Symbol_value::initialize_input_to_output_map): Likewise.
1564 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
1566 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
1568 (class Sized_relobj): Update declarations.
1569 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
1570 parameter. Change all callers.
1571 (Sized_relobj::adjust_shndx): New function.
1572 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
1574 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
1575 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
1576 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
1577 (Sized_dynobj::read_dynsym_section): Adjust section links.
1578 (Sized_dynobj::read_dynamic): Likewise.
1579 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
1581 (Sized_dynobj::do_initialize_xindex): New function.
1582 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
1583 do_initialize_xindex.
1584 (Sized_dynobj::adjust_shndx): New function.
1585 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
1586 dynsym_xindex_ fields.
1587 (Layout::finalize): Add a call to set_section_indexes before
1588 creating the symtab sections.
1589 (Layout::set_section_indexes): Don't do anything if the section
1590 already has a section index.
1591 (Layout::create_symtab_sections): Add shnum parameter. Change
1592 caller. Create .symtab_shndx section if needed.
1593 (Layout::create_shdrs): Add shstrtab_section parameter. Change
1595 (Layout::allocated_output_section_count): New function.
1596 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
1598 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
1599 fields. Update declarations.
1600 (Layout::symtab_xindex): New function.
1601 (Layout::dynsym_xindex): New function.
1602 (class Write_symbols_task): Add layout_ field.
1603 (Write_symbols_task::Write_symbols_task): Add layout parameter.
1605 * output.cc (Output_section_headers::Output_section_headers): Add
1606 shstrtab_section parameter. Change all callers.
1607 (Output_section_headers::do_sized_write): Store overflow values
1608 for section count and section string table section index in
1609 section header zero.
1610 (Output_file_header::do_sized_write): Check for overflow of
1611 section count and section string table section index.
1612 (Output_symtab_xindex::do_write): New function.
1613 (Output_symtab_xindex::endian_do_write): New function.
1614 * output.h (class Output_section_headers): Add shstrtab_section_.
1615 Update declarations.
1616 (class Output_symtab_xindex): Define.
1617 (Output_section::has_out_shndx): New function.
1618 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
1620 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
1622 (Sized_symbol::init): Likewise.
1623 (Symbol::output_section): Check for ordinary symbol.
1624 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
1625 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
1627 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
1628 Change all callers. Simplify handling of symbols from sections
1629 not included in the link.
1630 (Symbol_table::add_from_dynobj): Handle ordinary symbol
1632 (Weak_alias_sorter::operator()): Assert that symbols are
1634 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
1636 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
1637 parameters. Change all callers.
1638 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
1639 symbol distinction. Use SHN_XINDEX when needed.
1640 (Symbol_table::write_section_symbol): Add symtab_xindex
1641 parameter. Change all callers.
1642 (Symbol_table::sized_write_section_symbol): Likewise. Use
1643 SHN_XINDEX when needed.
1644 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
1646 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
1647 (Symbol::is_defined): Check is_ordinary.
1648 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
1649 (Symbol::is_absolute, Symbol::is_common): Likewise.
1650 (class Sized_symbol): Update declarations.
1651 (class Symbol_table): Update declarations.
1652 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
1653 parameters. Change all callers.
1654 (Sized_symbol::override): Likewise.
1655 (Symbol_table::override): Likewise.
1656 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
1657 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
1658 is_ordinary, and orig_st_shndx parameters. Change all callers.
1659 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
1660 to be in an ordinary section.
1661 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
1662 object and is_ordinary parameters. Change all callers.
1663 (Sized_dwarf_line_info::read_relocs): Add object parameter.
1664 Change all callers. Don't add undefined or non-ordinary symbols
1666 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
1668 * dwarf_reader.h (class Sized_dwarf_line_info): Update
1670 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
1671 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
1672 (Sized_relobj::relocate_sections): Likewise.
1673 * target-reloc.h (scan_relocs): Adjust section symbol index.
1674 (scan_relocatable_relocs): Likewise.
1675 * i386.cc (Scan::local): Check for ordinary symbols.
1676 * sparc.cc (Scan::local): Likewise.
1677 * x86_64.cc (Scan::local): Likewise.
1678 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
1679 to symbol_section_and_value.
1680 * testsuite/many_sections_test.cc: New file.
1681 * testsuite/Makefile.am (BUILT_SOURCES): Define.
1682 (check_PROGRAMS): Add many_sections_test.
1683 (many_sections_test_SOURCES): Define.
1684 (many_sections_test_DEPENDENCIES): Define.
1685 (many_sections_test_LDFLAGS): Define.
1686 (BUILT_SOURCES): Add many_sections_define.h.
1687 (many_sections_define.h): New target.
1688 (BUILT_SOURCES): Add many_sections_check.h.
1689 (many_sections_check.h): New target.
1690 (check_PROGRAMS): Add many_sections_r_test.
1691 (many_sections_r_test_SOURCES): Define.
1692 (many_sections_r_test_DEPENDENCIES): Define.
1693 (many_sections_r_test_LDFLAGS): Define.
1694 (many_sections_r_test_LDADD): Define.
1695 (many_sections_r_test.o): New target.
1696 * testsuite/Makefile.in: Rebuild.
1698 2008-04-17 Cary Coutant <ccoutant@google.com>
1700 * errors.cc (Errors::info): New function.
1701 (gold_info): New function.
1702 * errors.h (Errors::info): New function.
1703 * gold.h (gold_info): New function.
1704 * object.cc (Input_objects::add_object): Print trace output.
1705 * options.cc (options::parse_set): New function.
1706 (General_options::parse_wrap): Deleted.
1707 (General_options::General_options): Deleted initializer.
1708 * options.h (options::String_set): New typedef.
1709 (options::parse_set): New function.
1710 (DEFINE_set): New macro.
1711 (General_options::wrap): Changed to use DEFINE_set. Changed
1712 callers of any_wrap_symbols and is_wrap_symbol.
1713 (General_options::trace, General_options::trace_symbol):
1715 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
1716 (General_options::wrap_symbols_): Deleted.
1717 * symtab.cc (Symbol_table::add_from_object): Print trace output.
1719 2008-04-17 David S. Miller <davem@davemloft.net>
1721 * options.cc (General_options::parse_V): New function.
1722 * options.h: Add entries for -V and -Qy.
1724 2008-04-17 Ian Lance Taylor <iant@google.com>
1726 * common.cc (Symbol_table::allocate_commons): Remove options
1727 parameter. Change caller.
1728 (Symbol_table::do_allocate_commons): Remove options parameter.
1729 Change caller. Just call do_allocate_commons_list twice.
1730 (Symbol_table::do_allocate_commons_list): New function, broken out
1731 of do_allocate_commons.
1732 * common.h (class Allocate_commons_task): Remove options_ field.
1734 * symtab.cc (Symbol_table::Symbol_table): Initialize
1736 (Symbol_table::add_from_object): Put TLS common symbols on
1738 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
1739 which are IN_OUTPUT_DATA.
1740 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
1741 allocate_commons and do_allocate_commons declarations. Declare
1742 do_allocate_commons_list.
1743 * gold.cc (queue_middle_tasks): Update creation of
1744 Allocate_commons_task to not pass options.
1745 * testsuite/Makefile.am (INCLUDES): Add -I.. .
1746 (TLS_TEST_C_FLAGS): New variable.
1747 (tls_test_c_pic.o): New target.
1748 (tls_test_shared.so): Link in tls_test_c_pic.o.
1749 (tls_test_c_pic_ie.o): New target.
1750 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
1751 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
1752 (tls_test_c.o): New target.
1753 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
1754 (tls_pic_test_LDADD): Likewise.
1755 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
1756 (tls_shared_gd_to_ie_test_LDADD): Likewise.
1757 (tls_test_c_gnu2.o): New target.
1758 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
1760 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
1761 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
1762 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
1763 * testsuite/tls_test.cc: Include "config.h".
1764 (t_last): Call t11_last.
1765 * testsuite/tls_test.h (t11, t11_last): Declare.
1766 * testsuite/tls_test_c.c: New file.
1767 * testsuite/tls_test_main.cc (thread_routine): Call t11.
1768 * configure.ac: Check for OpenMP support.
1769 * configure, config.in, Makefile.in: Rebuild.
1770 * testsuite/Makefile.in: Rebuild.
1772 2008-04-16 Cary Coutant <ccoutant@google.com>
1774 * i386.cc (Target_i386::define_tls_base_symbol): New function.
1775 (Target_i386::tls_base_symbol_defined_): New field.
1776 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
1777 (Target_i386::Scan::global): Likewise.
1778 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
1779 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
1780 (Target_x86_64::tls_base_symbol_defined_): New field.
1781 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
1782 (Target_x86_64::Scan::global): Likewise.
1784 2008-04-16 Cary Coutant <ccoutant@google.com>
1786 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
1787 (Symbol::needs_plt_entry): Allow weak undefined symbols.
1788 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
1789 building shared libraries.
1790 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
1791 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
1792 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
1793 * testsuite/Makefile.in: Rebuild.
1794 * testsuite/weak_undef.h: New file.
1795 * testsuite/weak_undef_file1.cc: Add extra test cases.
1796 * testsuite/weak_undef_file2.cc: Likewise.
1797 * testsuite/weak_undef_test.cc: Likewise.
1799 2008-04-16 David S. Miller <davem@davemloft.net>
1801 * sparc.cc (Target_sparc::Scan): Change from struct to class.
1802 Add issued_non_pic_error_ field. Declare check_non_pic.
1803 (Target_sparc::Scan::check_non_pic): New function.
1804 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
1805 (Target_sparc::Scan::global): Likewise.
1807 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
1808 * configure: Rebuild.
1810 * options.h (DEFINE_enable): New macro.
1811 (new_dtags): New enable option.
1812 (initfirst, interpose, loadfltr, nodefaultlib,
1813 nodelete, nodlopen, nodump): New -z options.
1814 * layout.cc (Layout:finish_dynamic_section): If new
1815 dtags enabled, emit DT_RUNPATH. Also, emit a
1816 DT_FLAGS_1 containing any specified -z flags.
1818 2008-04-16 Ian Lance Taylor <iant@google.com>
1820 * copy-relocs.cc: New file.
1821 * copy-relocs.h: New file.
1822 * reloc.cc: Remove Copy_relocs code.
1823 * reloc.h: Likewise.
1824 * reloc-types.h (struct Reloc_types) [both versions]: Add
1825 get_reloc_addend_noerror.
1826 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
1827 variants of add_global which take an addend which must be zero.
1828 * i386.cc: Include "copy-relocs.h".
1829 (class Target_i386): Change type of copy_relocs_ to variable,
1831 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
1833 (Target_i386::do_finalize_sections): Change handling of
1835 * sparc.cc: Include "copy-relocs.h".
1836 (class Target_sparc): Change type of copy_relocs_ to variable,
1838 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
1840 (Target_sparc::do_finalize_sections): Change handling of
1842 * x86_64.cc: Include "copy-relocs.h".
1843 (class Target_x86_64): Change type of copy_relocs_ to variable,
1845 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
1846 class. Change all callers.
1847 (Target_x86_64::do_finalize_sections): Change handling of
1849 * Makefile.am (CCFILES): Add copy-relocs.cc.
1850 (HFILES): Add copy-relocs.h.
1852 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
1854 * testsuite/script_test_4.sh: Permit leading zeroes.
1856 2008-04-15 Ian Lance Taylor <iant@google.com>
1858 * script-sections.cc (Script_sections::create_segments): Use
1859 header_size_adjustment even when there is enough room for the
1861 * testsuite/script_test_4.sh: New file.
1862 * testsuite/script_test_4.t: New file.
1863 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
1864 (check_DATA): Add script_test_4.stdout.
1865 (MOSTLYCLEANFILES): Likewise.
1866 (script_test_4): New target.
1867 (script_test_4.stdout): New target.
1868 * testsuite/Makefile.in: Rebuild.
1870 * sparc.cc: Add definitions for Output_data_plt_sparc class
1873 2008-04-14 David S. Miller <davem@davemloft.net>
1875 * sparc.cc: New file.
1876 * Makefile.am (TARGETSOURCES): Add sparc.cc
1877 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
1878 * configure.tgt: Document targ_extra_size and
1879 targ_extra_big_endian. Add entries for sparc-* and
1881 * configure.ac: Handle targ_extra_size and
1882 targ_extra_big_endian.
1883 * Makefile.in: Rebuild.
1884 * configure: Likewise.
1885 * po/POTFILES.in: Likewise.
1886 * po/gold.pot: Likewise.
1888 2008-04-14 Ian Lance Taylor <iant@google.com>
1890 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
1891 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
1892 in the name/type/flags to section mapping. Don't call
1893 allocate_output_section.
1894 (Layout::choose_output_section): Change parameter from adjust_name
1895 to is_input_section. Don't permit input sections after sections
1896 are attached to segments. Don't call allocate_output_section.
1897 (Layout::layout_eh_frame): Call update_flags_for_input_section,
1898 not write_enable_output_section.
1899 (Layout::make_output_section): Don't push to
1900 unattached_section_list_ nor call attach_to_segment. Call
1901 attach_section_to_segment if sections are attached.
1902 (Layout::attach_sections_to_segments): New function.
1903 (Layout::attach_section_to_segment): New function.
1904 (Layout::attach_allocated_section_to_segment): Rename from
1905 attach_to_segment. Remove flags parameter.
1906 (Layout::allocate_output_section): Remove function.
1907 (Layout::write_enable_output_section): Remove function.
1908 * layout.h (class Layout): Update for above changes. Add new
1909 field sections_are_attached_.
1910 * output.h (Output_section::update_flags_for_input_section): New
1912 * output.cc (Output_section::add_input_section): Call
1913 update_flags_for_input_section.
1914 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
1916 2008-04-11 Cary Coutant <ccoutant@google.com>
1918 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
1919 thought unnecessary.
1920 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
1922 2008-04-11 Ian Lance Taylor <iant@google.com>
1924 * output.h (class Output_section_data): Remove inline definition
1926 * output.cc (Output_section_data::set_addralign): New function.
1928 2008-04-11 Cary Coutant <ccoutant@google.com>
1930 Add support for TLS descriptors for i386 and x86_64.
1931 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
1932 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
1933 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
1935 (Target_i386::got_mod_index_entry): Remove unnecessary code.
1936 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
1937 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
1939 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
1940 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
1941 Fix problem with initial-exec relocations.
1942 (Target_i386::Relocate::relocate_tls): Likewise.
1943 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
1945 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
1946 support for section-plus-offset dynamic table entries.
1947 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
1948 (Output_data_dynamic::Dynamic_entry): Add support for
1949 section-plus-offset dynamic table entries.
1950 (Output_data_dynamic::Classification): Likewise.
1951 (Output_data_dynamic::classification_): Renamed offset_.
1952 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
1953 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
1954 (Target_x86_64::make_plt_section): New function.
1955 (Target_x86_64::reserve_tlsdesc_entries): New function.
1956 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
1957 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
1958 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
1959 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
1960 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
1961 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
1962 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
1963 add extra PLT entry for TLS descriptors.
1964 (Output_data_plt_x86_64::got_): New field.
1965 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
1966 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
1968 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
1970 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
1971 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
1972 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
1973 R_386_TLS_DESC_CALL relocations.
1974 (Target_x86_64::Scan::global): Likewise.
1975 (Target_x86_64::do_finalize_sections): Add dynamic table entries
1976 for TLS descriptors.
1977 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
1978 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
1979 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
1980 GD-to-IE relaxation.
1981 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
1982 and TLS_DESCRIPTORS.
1983 * Makefile.in: Rebuild.
1984 * configure: Rebuild.
1985 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
1986 (tls_test_shared2.so): New target.
1987 (tls_shared_gd_to_ie_test_SOURCES): New variable.
1988 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
1989 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
1990 (tls_shared_gd_to_ie_test_LDADD): New variable.
1991 (tls_shared_gnu2_gd_to_ie_test): New target.
1992 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
1994 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
1995 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
1996 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
1997 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
1998 (tls_shared_gnu2_test): New target.
1999 (tls_test_gnu2_shared.so): New target.
2000 (tls_shared_gnu2_test_SOURCES): New variable.
2001 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
2002 (tls_shared_gnu2_test_LDFLAGS): New variable.
2003 (tls_shared_gnu2_test_LDADD): New variable.
2004 * testsuite/Makefile.in: Rebuild.
2005 * testsuite/Makefile.
2007 2008-04-11 Ian Lance Taylor <iant@google.com>
2009 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
2011 * testsuite/Makefile.in: Rebuild.
2013 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
2015 * testsuite/script_test_2.cc (main): Adjust test.
2017 2008-04-11 David S. Miller <davem@davemloft.net>
2018 Ian Lance Taylor <iant@google.com>
2020 * options.h (General_options): Add entries for '-Y' and
2022 * options.cc (General_options:finalize): If -Y was used, add those
2023 entries to the library path instead of the default "/lib" and
2026 2008-04-11 David S. Miller <davem@davemloft.net>
2028 * testsuite/justsyms.t: Start at 0x100.
2029 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
2030 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
2032 * testsuite/script_test_2.cc: Adjust string and section length
2035 2008-04-09 Ian Lance Taylor <iant@google.com>
2038 * script-sections.cc (Sections_element::allocate_to_segment): Add
2040 (Output_section_definition::allocate_to_segment): Likewise.
2041 (Orphan_output_section::allocate_to_segment): Likewise.
2042 (Script_sections::attach_sections_using_phdrs_clause): Don't
2043 propagate non-PT_LOAD segments to orphan sections.
2044 * testsuite/Makefile.am (script_test_3.stdout): Generate using
2045 readelf rather than objdump.
2046 * testsuite/script_test_3.sh: Adjust accordingly. Test that
2047 .interp section and PT_INTERP segment are the same size.
2048 * testsuite/Makefile.in: Rebuild.
2050 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
2051 aliases for symbols defined in the same object.
2052 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
2053 (weak_alias_test_SOURCES): New variable.
2054 (weak_alias_test_DEPENDENCIES): New variable.
2055 (weak_alias_test_LDFLAGS): New variable.
2056 (weak_alias_test_LDADD): New variable.
2057 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
2058 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
2059 (weak_alias_test_3.o): New target.
2060 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
2061 * testsuite/weak_alias_test_main.cc: New file.
2062 * testsuite/weak_alias_test_1.cc: New file.
2063 * testsuite/weak_alias_test_2.cc: New file.
2064 * testsuite/weak_alias_test_3.cc: New file.
2066 2008-04-08 Ian Lance Taylor <iant@google.com>
2068 * options.h (class General_options): Add --noinhibit-exec option.
2069 * main.cc (main): Check --noinhibit-exec.
2071 * options.h (class General_options): Define --wrap as a special
2072 option. Add wrap_symbols_ field.
2073 (General_options::any_wrap_symbols): New function.
2074 (General_options::is_wrap_symbol): New function.
2075 * options.cc (General_options::parse_wrap): New function.
2076 (General_options::General_options): Initialize wrap_symbols_.
2077 * symtab.cc (Symbol_table::wrap_symbol): New function.
2078 (Symbol_table::add_from_object): Handle --wrap.
2079 * symtab.h (class Symbol_table): Declare wrap_symbol.
2080 * target.h (Target::wrap_char): New function.
2081 (Target::Target_info): Add wrap_char field.
2082 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
2083 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2084 * testsuite/testfile.cc (Target_test::test_target_info):
2087 * errors.cc (Errors::undefined_symbol): Mention symbol version if
2090 * layout.h (class Layout): Add added_eh_frame_data_ field.
2091 * layout.cc (Layout::Layout): Initialize new field.
2092 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
2093 output section until we find a section we merged successfully.
2094 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
2095 that the size be non-zero.
2097 * merge.cc (Object_merge_map::get_output_offset): Remove inline
2100 2008-04-08 Craig Silverstein <csilvers@google.com>
2102 * configure.ac: Export new conditional variable HAVE_ZLIB.
2103 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
2105 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
2106 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
2108 2008-04-07 Ian Lance Taylor <iant@google.com>
2110 * version.cc (version_string): Set to "1.5".
2112 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
2113 Add issued_non_pic_error_ field. Declare check_non_pic.
2114 (Target_x86_64::Scan::check_non_pic): New function.
2115 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
2116 (Target_x86_64::Scan::global): Likewise.
2118 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
2119 addend parameter. Change caller. Handle merge sections.
2120 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
2121 Address to Addend. Don't add in the result of
2122 local_section_offset, pass down the addend and use the returned
2124 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
2125 Update declarations of local_section_offset and symbol_value.
2126 * testsuite/two_file_test_1.cc (t18): New function.
2127 * testsuite/two_file_test_2.cc (f18): New function.
2128 * testsuite/two_file_test_main.cc (main): Call t18.
2129 * testsuite/two_file_test.h (t18, f18): Declare.
2131 * configure.ac: Don't test for objdump, c++filt, or readelf.
2132 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
2134 (TEST_READELF): New variable.
2135 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
2136 (check_PROGRAMS): Add two_file_strip_test.
2137 (two_file_strip_test): New target.
2138 (check_PROGRAMS): Add two_file_same_shared_strip_test.
2139 (two_file_same_shared_strip_test_SOURCES): New variable.
2140 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
2141 (two_file_same_shared_strip_test_LDFLAGS): New variable.
2142 (two_file_same_shared_strip_test_LDADD): New variable.
2143 (two_file_shared_strip.so): New target.
2144 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
2145 (ver_test_5.syms, ver_test_7.syms): Likewise.
2146 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
2147 (strip_test_3.stdout): Use TEST_OBJDUMP.
2148 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
2150 2008-04-04 Cary Coutant <ccoutant@google.com>
2152 * symtab.h (Symbol::is_weak_undefined): New function.
2153 (Symbol::is_strong_undefined): New function.
2154 (Symbol::is_absolute): New function.
2155 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
2156 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
2158 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
2159 (weak_undef_test): New target.
2160 * testsuite/Makefile.in: Rebuild.
2161 * testsuite/weak_undef_file1.cc: New file.
2162 * testsuite/weak_undef_file2.cc: New file.
2163 * testsuite/weak_undef_test.cc: New file.
2165 2008-04-03 Craig Silverstein <csilvers@google.com>
2167 * compressed_output.h (class Output_compressed_section): Use
2169 * compressed_output.cc (zlib_compress): Use unsigned buffers,
2171 (zlib_compressed_suffix): Removed.
2172 (Output_compressed_section::set_final_data_size): Use unsigned
2174 * testsuite/Makefile.am (flagstest_compress_debug_sections):
2175 Fix linker invocation.
2176 (flagstest_o_specialfile_and_compress_debug_sections):
2178 * testsuite/Makefile.in: Regenerated.
2180 2008-04-02 David S. Miller <davem@davemloft.net>
2182 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
2183 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
2185 2008-04-02 Craig Silverstein <csilvers@google.com>
2189 2008-04-02 Ian Lance Taylor <iant@google.com>
2191 * fileread.cc (File_read::find_view): Add byteshift and vshifted
2192 parameters. Update for new key type to views_. Change all
2194 (File_read::read): Adjust for byteshift in returned view.
2195 (File_read::add_view): New function, broken out of
2197 (File_read::make_view): New function, broken out of
2199 (File_read::find_or_make_view): Add offset and aligned
2200 parameters. Rewrite accordingly. Change all callers.
2201 (File_read::get_view): Add offset and aligned parameters. Adjust
2202 for byteshift in return value.
2203 (File_read::get_lasting_view): Likewise.
2204 * fileread.h (class File_read): Update declarations.
2205 (class File_read::View): Add byteshift_ field. Add byteshift to
2206 constructor. Add byteshift method.
2207 * archive.h (Archive::clear_uncached_views): New function.
2208 (Archive::get_view): Add aligned parameter. Change all callers.
2209 * object.h (Object::get_view): Add aligned parameter. Change all
2211 (Object::get_lasting_view): Likewise.
2213 * fileread.cc (File_read::release): Don't call clear_views if
2214 there are multiple objects.
2215 * fileread.h (File_read::clear_uncached_views): New function.
2216 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
2219 2008-03-31 Cary Coutant <ccoutant@google.com>
2221 Add thin archive support.
2222 * archive.cc (Archive::armagt): New const.
2223 (Archive::setup): Remove task parameter and calls to unlock.
2224 (Archive::unlock_nested_archives): New function.
2225 (Archive::read_header): Add nested_off parameter. Change
2227 (Archive::interpret_header): Likewise.
2228 (Archive::include_all_members): Change to handle thin
2230 (Archive::include_member): Likewise.
2231 * archive.h (Archive::Archive): Add new parameters and
2233 (Archive::armagt): New const.
2234 (Archive::setup): Remove task parameter.
2235 (Archive::unlock_nested_archives): New function.
2236 (Archive::read_header): Add nested_off parameter.
2237 (Archive::interpret_header): Likewise.
2238 (Archive::Nested_archive_table): New typedef.
2239 (Archive::is_thin_archive_): New field.
2240 (Archive::nested_archives_): New field.
2241 (Archive::options_): New field.
2242 (Archive::dirpath_): New field.
2243 (Archive::task_): New field.
2244 * readsyms.cc (Read_symbols::do_read_symbols): Add check
2245 for thin archives. Pass additional parameters to
2246 Archive::Archive. Unlock the archive file after calling
2249 2008-03-29 Ian Lance Taylor <iant@google.com>
2251 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
2252 version symbol to be local.
2253 * testsuite/ver_test_4.sh: New file.
2254 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
2255 (check_DATA): Add ver_test_4.syms.
2256 (ver_test_4.syms): New target.
2257 * testsuite/Makefile.in: Rebuild.
2260 (Output_section::Input_section_sort_entry::has_priority): New
2262 (Output_section::Input_section_sort_entry::match_file_name): New
2264 (Output_section::Input_section_sort_entry::match_section_name):
2266 (Output_section::Input_section_sort_entry::match_section_name_prefix):
2268 (Output_section::Input_section_sort_entry::match_section_file):
2270 (Output_section::Input_section_sort_compare::operator()): Rewrite
2271 using new Input_section_sort_entry functions. Sort crtbegin and
2272 crtend first. Sort sections with no priority before sections with
2274 * testsuite/initpri1.c (d3): Check j != 4.
2275 (cd5): New constructor/destructor function.
2276 (main): Check j != 2.
2278 * symtab.cc (Symbol_table::add_from_object): If we don't use the
2279 new symbol when resolving, don't call set_is_default.
2280 * testsuite/ver_test_7.cc: New file.
2281 * testsuite/ver_test_7.sh: New file.
2282 * testsuite/Makefile.am (ver_test_7.so): New target.
2283 (ver_test_7.o): New target.
2284 (check_SCRIPTS): Add ver_test_7.sh.
2285 (check_DATA): Add ver_test_7.syms.
2286 (ver_test_7.syms): New target.
2288 2008-03-28 Ian Lance Taylor <iant@google.com>
2290 * layout.cc (Layout::layout): If we see an input section with a
2291 name that needs sorting, set the must_sort flag for the output
2293 (Layout::make_output_section): If the name of the output section
2294 indicates that it might require sorting, set the may_sort flag.
2295 * output.h (Output_section::may_sort_attached_input_sections): New
2297 (Output_section::set_may_sort_attached_input_sections): New
2299 (Output_section::must_sort_attached_input_sections): New
2301 (Output_section::set_must_sort_attached_input_sections): New
2303 (class Output_section): Declare Input_section_sort_entry. Define
2304 Input_section_sort_compare. Declare
2305 sort_attached_input_sections. Add new fields:
2306 may_sort_attached_input_sections_,
2307 must_sort_attached_input_sections_,
2308 attached_input_sections_are_sorted_.
2309 * output.cc (Output_section::Output_section): Initialize new
2311 (Output_section::add_input_section): Add an entry to
2312 input_sections_ if may_sort or must_sort are true.
2313 (Output_section::set_final_data_size): Call
2314 sort_attached_input_sections if necessary.
2315 (Output_section::Input_section_sort_entry): Define new class.
2316 (Output_section::Input_section_sort_compare::operator()): New
2318 (Output_section::sort_attached_input_sections): New function.
2319 * configure.ac: Check whether the compiler supports constructor
2320 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
2321 * testsuite/initpri1.c: New file.
2322 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
2323 CONSTRUCTOR_PRIORITY.
2324 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
2325 (initpri1_LDFLAGS): New variable.
2326 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
2328 2008-03-27 Ian Lance Taylor <iant@google.com>
2330 * common.cc (Sort_commons::operator): Correct sorting algorithm.
2331 * testsuite/common_test_1.c: New file.
2332 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
2333 (common_test_1_SOURCES): New variable.
2334 (common_test_1_DEPENDENCIES): New variable.
2335 (common_test_1_LDFLAGS): New variable.
2337 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
2338 and commons_ correctly when NAME/VERSION does not override
2340 * testsuite/ver_test_6.c: New file.
2341 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
2342 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
2343 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
2345 2008-03-26 Ian Lance Taylor <iant@google.com>
2347 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
2348 of an undefined symbol from a version script.
2349 * testsuite/Makefile.am (ver_test_5.so): New target.
2350 (ver_test_5.o): New target.
2351 (check_SCRIPTS): Add ver_test_5.sh.
2352 (check_DATA): Add ver_test_5.syms.
2353 (ver_test_5.syms): New target.
2354 * testsuite/ver_test_5.cc: New file.
2355 * testsuite/ver_test_5.script: New file.
2356 * testsuite/ver_test_5.sh: New file.
2357 * Makefile.in, testsuite/Makefile.in: Rebuild.
2360 Fix problems building gold with gcc 4.3.0.
2361 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
2362 (gold_error_at_location, gold_warning_at_location): Use it.
2363 * configure.ac: Check whether we can compile and use a template
2364 function with a printf attribute.
2365 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
2366 when jumping over bytes.
2367 * object.cc: Instantiate Object::read_section_data.
2368 * debug.h: Include <cstring>
2369 * dwarf_reader.cc: Include <algorithm>
2370 * main.cc: Include <cstring>.
2371 * options.cc: Include <cstring>.
2372 * output.cc: Include <cstring>.
2373 * script.cc: Include <cstring>.
2374 * script.h: Include <string>.
2375 * symtab.cc: Include <cstring> and <algorithm>.
2376 * target-select.cc: Include <cstring>.
2377 * version.cc: Include <string>.
2378 * testsuite/testmain.cc: Include <cstdlib>.
2379 * configure, config.in: Rebuild.
2381 2008-03-25 Ian Lance Taylor <iant@google.com>
2383 * options.cc: Include "../bfd/bfdver.h".
2384 (options::help): Print bug reporting address.
2386 * version.cc (print_version): Adjust output for current value of
2391 * options.cc (options::help): Print list of supported targets.
2392 * target-select.h: Include <vector>.
2393 (class Target_selector): Make machine_, size_, and is_big_endian_
2394 fields const. Add bfd_name_ and instantiated_target_ fields.
2395 (Target_selector::Target_selector): Add bfd_name parameter.
2396 (Target_selector::recognize): Make non-virtual, call
2398 (Target_selector::recognize_by_name): Make non-virtual, call
2399 do_recognize_by_name.
2400 (Target_selector::supported_names): New function.
2401 (Target_selector::bfd_name): New function.
2402 (Target_selector::do_instantiate_target): New pure virtual
2404 (Target_selector::do_recognize): New virtual function.
2405 (Target_selector::do_recognize_by_name): New virtual function.
2406 (Target_selector::instantiate_target): New private function.
2407 (supported_target_names): Declare.
2408 * target-select.cc (Target_selector::Target_selector): Update for
2409 new parameter and fields.
2410 (select_target_by_name): Check that the name matches before
2411 calling recognize_by_name.
2412 (supported_target_names): New function.
2413 * i386.cc (class Target_selector_i386): Update Target_selector
2414 constructor call. Remove recognize and recognize_by_name. Add
2415 do_instantiate_target.
2416 * x86_64.cc (class Target_selector_x86_64): Likewise.
2417 * testsuite/testfile.cc (class Target_selector_test): Update for
2418 changes to Target_selector.
2420 * README: Rewrite, with some notes on unsupported features.
2422 2008-03-24 Cary Coutant <ccoutant@google.com>
2424 * i386.cc (Target_i386::Got_type): New enum declaration.
2425 (Target_i386::Scan::local): Updated callers of Output_data_got
2427 (Target_i386::Scan::global): Likewise.
2428 (Target_i386::Relocate::relocate): Likewise.
2429 (Target_i386::Relocate::relocate_tls): Likewise.
2430 * object.h (Got_offset_list): New class.
2431 (Sized_relobj::local_has_got_offset): Added got_type parameter.
2432 (Sized_relobj::local_got_offset): Likewise.
2433 (Sized_relobj::set_local_got_offset): Likewise.
2434 (Sized_relobj::local_has_tls_got_offset): Removed.
2435 (Sized_relobj::local_tls_got_offset): Removed.
2436 (Sized_relobj::set_local_tls_got_offset): Removed.
2437 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
2438 * output.cc (Output_data_got::add_global): Added got_type parameter.
2439 (Output_data_got::add_global_with_rel): Likewise.
2440 (Output_data_got::add_global_with_rela): Likewise.
2441 (Output_data_got::add_global_pair_with_rel): New function.
2442 (Output_data_got::add_global_pair_with_rela): New function.
2443 (Output_data_got::add_local): Added got_type parameter.
2444 (Output_data_got::add_local_with_rel): Likewise.
2445 (Output_data_got::add_local_with_rela): Likewise.
2446 (Output_data_got::add_local_pair_with_rel): New function.
2447 (Output_data_got::add_local_pair_with_rela): New function.
2448 (Output_data_got::add_global_tls): Removed.
2449 (Output_data_got::add_global_tls_with_rel): Removed.
2450 (Output_data_got::add_global_tls_with_rela): Removed.
2451 (Output_data_got::add_local_tls): Removed.
2452 (Output_data_got::add_local_tls_with_rel): Removed.
2453 (Output_data_got::add_local_tls_with_rela): Removed.
2454 * output.h (Output_data_got::add_global): Added got_type parameter.
2455 (Output_data_got::add_global_with_rel): Likewise.
2456 (Output_data_got::add_global_with_rela): Likewise.
2457 (Output_data_got::add_global_pair_with_rel): New function.
2458 (Output_data_got::add_global_pair_with_rela): New function.
2459 (Output_data_got::add_local): Added got_type parameter.
2460 (Output_data_got::add_local_with_rel): Likewise.
2461 (Output_data_got::add_local_with_rela): Likewise.
2462 (Output_data_got::add_local_pair_with_rel): New function.
2463 (Output_data_got::add_local_pair_with_rela): New function.
2464 (Output_data_got::add_global_tls): Removed.
2465 (Output_data_got::add_global_tls_with_rel): Removed.
2466 (Output_data_got::add_global_tls_with_rela): Removed.
2467 (Output_data_got::add_local_tls): Removed.
2468 (Output_data_got::add_local_tls_with_rel): Removed.
2469 (Output_data_got::add_local_tls_with_rela): Removed.
2470 * resolve.cc (Symbol::override_base_with_special): Removed
2471 reference to has_got_offset_ field.
2472 * symtab.cc (Symbol::init_fields): Replaced initialization
2473 of got_offset_ with got_offsets_. Removed initialization
2475 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
2476 (Symbol::got_offset): Likewise.
2477 (Symbol::set_got_offset): Likewise.
2478 (Symbol::has_tls_got_offset): Removed.
2479 (Symbol::tls_got_offset): Removed.
2480 (Symbol::set_tls_got_offset): Removed.
2481 (Symbol::got_offset_): Removed.
2482 (Symbol::tls_mod_got_offset_): Removed.
2483 (Symbol::tls_pair_got_offset_): Removed.
2484 (Symbol::got_offsets_): New field.
2485 (Symbol::has_got_offset): Removed.
2486 (Symbol::has_tls_mod_got_offset): Removed.
2487 (Symbol::has_tls_pair_got_offset): Removed.
2488 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
2489 (Target_x86_64::Scan::local): Updated callers of Output_data_got
2491 (Target_x86_64::Scan::global): Likewise.
2492 (Target_x86_64::Relocate::relocate): Likewise.
2493 (Target_x86_64::Relocate::relocate_tls): Likewise.
2495 2008-03-25 Ben Elliston <bje@au.ibm.com>
2497 * yyscript.y: Fix spelling error in comment.
2499 2008-03-24 Ian Lance Taylor <iant@google.com>
2501 * options.h (class General_options): Define build_id option.
2502 * layout.h (class Layout): Declare write_build_id, create_note,
2503 create_build_id. Add build_id_note_ member.
2504 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
2505 "libiberty.h", "md5.h", "sha1.h".
2506 (Layout::Layout): Initialize eh_frame_data_,
2507 eh_frame_hdr_section_, and build_id_note_.
2508 (Layout::finalize): Call create_build_id.
2509 (Layout::create_note): New function, broken out of
2510 Layout::create_gold_note.
2511 (Layout::create_gold_note): Call create_note.
2512 (Layout::create_build_id): New function.
2513 (Layout::write_build_id): New function.
2514 (Close_task_runner::run): Call write_build_id.
2516 * x86_64.cc: Correct license to GPLv3.
2518 2008-03-23 Ian Lance Taylor <iant@google.com>
2520 * options.cc: Include "demangle.h".
2521 (parse_optional_string): New function.
2522 (parse_long_option): Handle takes_optional_argument.
2523 (parse_short_option): Update dash_z initializer. Handle
2524 takes_optional_argument.
2525 (General_options::General_options): Initialize do_demangle_.
2526 (General_options::finalize): Set do_demangle_. Handle demangling
2528 * options.h (parse_optional_string): Declare.
2529 (struct One_option): Add optional_arg field. Update constructor.
2530 Update call constructor calls. Add takes_optional_argument
2532 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
2533 (DEFINE_optional_string): Define.
2534 (General_options::demangle): Change from DEFINE_bool to
2535 DEFINE_optional_string.
2536 (General_options::no_demangle): New function.
2537 (General_options::do_demangle): New function.
2538 (General_options::set_do_demangle): New function.
2539 (General_options::execstack_status_): Move definition to end of
2541 (General_options::static_): Likewise.
2542 (General_options::do_demangle_): New field.
2543 * object.cc (big_endian>::get_symbol_location_info): Call
2544 Options::do_demangle, not Options::demangle.
2545 * symtab.cc (demangle): Likewise.
2547 2008-03-22 Ian Lance Taylor <iant@google.com>
2549 * gold.h: Include <cstddef> and <sys/types.h>
2550 * options.h: Include <cstring>.
2552 2008-03-21 Ian Lance Taylor <iant@google.com>
2554 * Added source code to GNU binutils.