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