1 2009-01-19 Andreas Schwab <schwab@suse.de>
3 * configure.tgt (powerpc64-*): Fix targ_obj.
5 2009-01-15 Ian Lance Taylor <iant@google.com>
7 * object.cc (Sized_relobj::write_local_symbols): Don't write out
8 local symbols when stripping all symbols.
10 2009-01-14 Cary Coutant <ccoutant@google.com>
12 * output.cc (Output_reloc): Add explicit instantiations.
14 2009-01-14 Cary Coutant <ccoutant@google.com>
16 * archive.cc (Archive::get_elf_object_for_member): Remove call
17 to File_read::claim_for_plugin.
18 * descriptors.cc (Descriptors::open): Remove reference to
20 (Descriptors::claim_for_plugin): Remove.
21 * descriptors.h (Descriptors::claim_for_plugin): Remove.
22 (Descriptors::is_claimed): Remove.
23 (claim_descriptor_for_plugin): Remove.
24 * fileread.cc (File_read::claim_for_plugin): Remove.
25 * fileread.h (File_read::claim_for_plugin): Remove.
26 (File_read::descriptor): Reopen descriptor if necessary.
27 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
28 (Plugin_manager::all_symbols_read): Add task parameter. Change
30 (Plugin_manager::get_input_file): New function.
31 (Plugin_manager::release_input_file): New function.
32 (Pluginobj::Pluginobj): Add filesize parameter and initialize
33 corresponding data member.
34 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
35 and pass to base constructor. Change all callers.
36 (get_input_file, release_input_file): New functions.
37 (make_sized_plugin_object): Add filesize parameter. Change all callers.
38 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
39 (Plugin_manager::all_symbols_read): Add task parameter.
40 (Plugin_manager::get_input_file): New function.
41 (Plugin_manager::release_input_file): New function.
42 (Plugin_manager::task_): New data member.
43 (Pluginobj::Pluginobj): Add filesize parameter.
44 (Pluginobj::filename): New function.
45 (Pluginobj::descriptor): New function.
46 (Pluginobj::filesize): New function.
47 (Pluginobj::filesize_): New data member.
48 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
49 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
50 File_read::claim_for_plugin; use Object::unlock to unlock the file.
52 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
53 with archive libraries.
54 * testsuite/Makefile.in: Regenerate.
55 * testsuite/plugin_test.c (struct sym_info): New type.
56 (get_input_file, release_input_file): New static variables.
57 (onload): Capture new transfer vector entries.
58 (claim_file_hook): Stop reading at end of file according to filesize.
59 Factor out parsing of readelf output into separate function.
60 (all_symbols_read_hook): Exercise get_input_file and release_input_file
61 APIs and get the source file name from the symbol table. Convert
62 source file name to corresponding object file name. Print info
63 message when adding new input files.
64 (parse_readelf_line): New function.
65 * testsuite/plugin_test_1.sh: Add checks for new info messages.
66 * testsuite/plugin_test_2.sh: Likewise.
67 * testsuite/plugin_test_3.sh: Likewise.
68 * testsuite/plugin_test_4.sh: New test case.
70 2009-01-07 Ian Lance Taylor <iant@google.com>
72 * version.cc (version_string): Bump to 1.8.
74 2008-12-23 Cary Coutant <ccoutant@google.com>
76 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
77 * plugin.cc (Plugin_manager::finish): Rename as
78 layout_deferred_objects. Move cleanup to separate function.
79 (Plugin_manager::cleanup): New function.
80 (Plugin_finish::run): Call layout_deferred_objects and cleanup
82 * plugin.h (Plugin_manager::finish): Rename as
83 layout_deferred_objects.
84 (Plugin_manager::cleanup): New function.
85 (Plugin_manager::cleanup_done): New field.
87 2008-12-23 Cary Coutant <ccoutant@google.com>
89 * plugin.cc (is_visible_from_outside): New function.
90 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
91 so we don't return "IR only" status for exported symbols or -r links.
93 * testsuite/Makefile.am (plugin_test_3): New test case.
94 * testsuite/Makefile.in: Regenerate.
95 * testsuite/plugin_test_3.sh: New file.
97 2008-12-22 Cary Coutant <ccoutant@google.com>
99 * object.cc (Sized_relobj::layout_section): New function.
100 (Sized_relobj::do_layout): Defer layout of input sections until after
101 plugin has provided replacement files.
102 (Sized_relobj::do_layout_deferred_sections): New function.
103 * object.h (Relobj::set_section_offset): Remove virtual keyword.
104 (Relobj::layout_deferred_sections): New function.
105 (Relobj::do_layout_deferred_sections): New function.
106 (Sized_relobj::do_layout_deferred_sections): New function.
107 (Sized_relobj::layout_section): New function.
108 (Sized_relobj::Deferred_layout): New structure.
109 (Sized_relobj::deferred_layout_): New field.
110 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
111 Change all callers. Layout deferred sections.
112 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
114 (Plugin_hook::run): Move code from do_plugin_hook inline.
115 (Plugin_hook::do_plugin_hook): Remove.
116 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
117 (Plugin_manager::finish): Renamed, was cleanup.
118 (Plugin_manager::should_defer_layout): New function.
119 (Plugin_manager::add_deferred_layout_object): New function.
120 (Plugin_manager::Deferred_layout_list): New type.
121 (Plugin_manager::deferred_layout_objects_): New field.
122 (Plugin_hook::do_plugin_hook): Remove.
124 2008-12-17 Ian Lance Taylor <iant@google.com>
126 * options.h (class General_options): Add --no case for
129 2008-12-16 Cary Coutant <ccoutant@google.com>
131 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
133 (Plugin_manager::claim_file): Create plugin object even if
134 plugin did not call the add_symbols callback.
135 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
136 asking for more symbols than were added.
137 * testsuite/Makefile.am (plugin_test_1): Add test case with
139 (empty.syms): New target.
140 * testsuite/Makefile.in: Regenerate.
141 * testsuite/plugin_test.c (claim_file_hook): Add new debug
142 message. Don't call add_symbols if no globals.
143 (all_symbols_read_hook): Don't provide replacement for empty
146 2008-12-12 Ian Lance Taylor <iant@google.com>
148 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
149 r_type == 0 for a local symbol with r_sym == 0.
150 (scan_relocatable_relocs): Pass r_sym to
151 local_non_section_strategy.
152 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
155 * configure.ac: Update test for TLS descriptors: they are
156 supported as of glibc 2.9.
157 * configure: Rebuild.
159 2008-12-11 Ian Lance Taylor <iant@google.com>
162 * target-reloc.h (Default_scan_relocatable_relocs): For each
163 function, map r_type == 0 to RELOC_DISCARD.
165 2008-12-10 Cary Coutant <ccoutant@google.com>
167 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
168 object to override a kept COMDAT group from a plugin object.
170 2008-12-09 Ian Lance Taylor <iant@google.com>
173 * yyscript.y (file_cmd): Handle INPUT.
175 * testsuite/initpri1.c: Change all declarations to be full
176 prototypes by adding void, to avoid compiler warnings.
178 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
180 * options.cc (General_options::parse_plugin_opt): New.
181 (General_options::add_plugin): The argument now is just the filename.
182 (General_options::add_plugin_option): New.
183 * options.h (plugin_opt): New.
184 (add_plugin): Change argument name.
185 (add_plugin_option): New.
186 * plugin.cc (Plugin::load): Don't parse the plugin option.
187 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
188 (Plugin::add_option): New.
189 (Plugin::args_): Change type.
190 (Plugin::filename_): New.
191 (Plugin_manager::add_plugin_option): New.
192 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
193 * testsuite/Makefile.in: Regenerate.
195 2008-12-05 Cary Coutant <ccoutant@google.com>
197 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
198 Handle --strip-lto-sections option.
199 * options.h (strip_lto_sections): New option.
201 2008-12-01 Cary Coutant <ccoutant@google.com>
203 * plugin.cc (ld_plugin_message): Change format parameter to const.
204 Fix mismatch between new[] and delete.
206 2008-11-14 Cary Coutant <ccoutant@google.com>
208 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
211 2008-11-05 Craig Silverstein <csilvers@google.com>
213 * options.cc (General_options::parse_dynamic_list): New function.
214 * options.h (General_options): New flags dynamic_list,
215 dynamic_list_data, dynamic_list_cpp_new, and
216 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
217 (General_options::in_dynamic_list): New function.
218 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
219 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
220 (Lex::can_continue_name): Likewise.
222 (read_script_file): New parameter script_options.
223 (read_dynamic_list): New function.
224 (Script_options::define_dynamic_list): New function.
225 (dynamic_list_keyword_parsecodes): New variable.
226 (dynamic_list_keywords): New variable.
227 * script.h (Script_options::define_dynamic_list): New function
229 (read_dynamic_list): New function prototype.
230 * symtab.cc (strprefix): New macro.
231 (Symbol::should_add_dynsym_entry): Support dynamic_list,
232 dynamic_list_data, dynamic_list_cpp_new, and
233 dynamic_list_cpp_typeinfo.
234 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
235 (dynamic_list_expr): New rule.
236 (dynamic_list_nodes): Likewise.
237 (dynamic_list_node): Likewise.
238 * testsuite/Makefile.am (dynamic_list): New test.
239 * testsuite/Makefile.in: Regenerated.
240 * testsuite/dynamic_list.t: New file.
241 * testsuite/dynamic_list.sh: New file.
243 2008-11-05 Craig Silverstein <csilvers@google.com>
245 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
246 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
247 (t11_last): Likewise.
248 * testsuite/ver_test_6.c (main): Likewise.
250 2008-10-07 Cary Coutant <ccoutant@google.com>
252 * options.c (General_options::finalize): Add check for -static and
254 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
257 2008-10-02 Cary Coutant <ccoutant@google.com>
259 * plugin.cc (make_sized_plugin_object): Fix conditional
260 compilation to work when not all targets are enabled.
262 2008-09-29 Cary Coutant <ccoutant@google.com>
264 * archive.cc (Archive::get_file_and_offset): Use filename instead
265 of name to get library path.
266 (Archive::include_member): Unlock external member of a thin archive.
268 * testsuite/Makefile.am (TEST_AR): New variable.
269 (thin_archive_test_1): New test.
270 (thin_archive_test_2): New test.
271 * testsuite/Makefile.in: Regenerate.
272 * testsuite/thin_archive_main.cc: New file.
273 * testsuite/thin_archive_test_1.cc: New file.
274 * testsuite/thin_archive_test_2.cc: New file.
275 * testsuite/thin_archive_test_3.cc: New file.
276 * testsuite/thin_archive_test_4.cc: New file.
278 2008-09-29 Cary Coutant <ccoutant@google.com>
280 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
281 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
283 (Sized_relobj::do_finalize_local_symbols): Likewise.
284 (Sized_relobj::map_to_kept_section): Likewise.
285 * object.h (Sized_relobj::invalid_address): New constant.
286 (Sized_relobj::do_output_section_offset): Check for invalid_address
288 * output.cc (Output_reloc::local_section_offset): Use constant
289 invalid_address instead of -1U.
290 (Output_reloc::get_address): Likewise.
291 (Output_section::output_address): Change -1U to -1ULL.
292 * output.h (Output_reloc::invalid_address): New constant.
293 * reloc.cc (Sized_relobj::write_sections): Use constant
294 invalid_address instead of -1U.
295 (Sized_relobj::relocate_sections): Likewise.
296 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
297 values for merge sections.
298 * target-reloc.h (relocate_for_relocatable): Use constant
299 invalid_address instead of -1U.
301 2008-09-19 Cary Coutant <ccoutant@google.com>
303 Add plugin functionality for link-time optimization (LTO).
304 * configure.ac (plugins): Add --enable-plugins option.
305 * configure: Regenerate.
306 * config.in: Regenerate.
307 * Makefile.am (LIBDL): New variable.
308 (CCFILES): Add plugin.cc.
309 (HFILES): Add plugin.h.
310 (ldadd_var): Add LIBDL.
311 * Makefile.in: Regenerate.
313 * archive.cc: Include "plugin.h".
314 (Archive::setup): Don't preread archive symbols when using a plugin.
315 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
316 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
318 (Archive::include_member): Add symbols from plugin objects.
319 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
320 * descriptors.cc (Descriptors::open): Check for file descriptors
321 abandoned by plugins.
322 (Descriptors::claim_for_plugin): New function.
323 * descriptors.h (Descriptors::claim_for_plugin): New function.
324 (Open_descriptor::is_claimed): New field.
325 (claim_descriptor_for_plugin): New function.
326 * fileread.cc (File_read::claim_for_plugin): New function.
327 * fileread.h (File_read::claim_for_plugin): New function.
328 (File_read::descriptor): New function.
329 * gold.cc: Include "plugin.h".
330 (queue_initial_tasks): Add task to call plugin hooks for generating
332 * main.cc: Include "plugin.h".
333 (main): Load plugin libraries.
334 * object.h (Pluginobj): Declare.
335 (Object::pluginobj): New function.
336 (Object::do_pluginobj): New function.
337 (Object::set_target): New function.
338 * options.cc: Include "plugin.h".
339 (General_options::parse_plugin): New function.
340 (General_options::General_options): Initialize plugins_ field.
341 (General_options::add_plugin): New function.
342 * options.h (Plugin_manager): Declare.
343 (General_options): Add --plugin option.
344 (General_options::has_plugins): New function.
345 (General_options::plugins): New function.
346 (General_options::add_plugin): New function.
347 (General_options::plugins_): New field.
348 * plugin.cc: New file.
349 * plugin.h: New file.
350 * readsyms.cc: Include "plugin.h".
351 (Read_symbols::do_read_symbols): Check for archive before checking
352 for ELF file. Call plugin hooks to claim files.
353 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
354 from a real object file; force override when processing replacement
356 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
357 (Symbol::init_base_object): Likewise.
358 (Symbol::init_base_output_data): Likewise.
359 (Symbol::init_base_output_segment): Likewise.
360 (Symbol::init_base_constant): Likewise.
361 (Symbol::init_base_undefined): Likewise.
362 (Symbol::output_section): Assert that object is not a plugin.
363 (Symbol_table::add_from_pluginobj): New function.
364 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
366 (Symbol_table::sized_write_globals): Likewise.
367 (Symbol_table::add_from_pluginobj): Instantiate template.
368 * symtab.h (Sized_pluginobj): Declare.
369 (Symbol::in_real_elf): New function.
370 (Symbol::set_in_real_elf): New function.
371 (Symbol::in_real_elf_): New field.
372 (Symbol_table::add_from_pluginobj): New function.
374 * testsuite/Makefile.am (AM_CFLAGS): New variable.
375 (LIBDL): New variable.
377 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
378 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
379 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
380 (MOSTLYCLEANFILES): Likewise.
381 * testsuite/Makefile.in: Regenerate.
382 * testsuite/plugin_test.c: New file.
383 * testsuite/plugin_test_1.sh: New file.
384 * testsuite/plugin_test_2.sh: New file.
386 2008-09-16 Ian Lance Taylor <iant@google.com>
388 * target-reloc.h (relocate_section): Check whether a symbol is
389 defined by the ABI before reporting an undefined symbol error.
390 * target.h (Target::is_defined_by_abi): Make parameter const.
391 (Target::do_is_defined_by_abi): Likewise.
392 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
393 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
394 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
395 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
396 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
397 * testsuite/Makefile.in: Rebuild.
399 * fileread.cc (make_view): Add casts to avoid warning.
401 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
403 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
404 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
406 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
408 * options.h (General_options::output_is_executable): New.
409 (General_options::output_is_pie): New.
410 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
411 for shared libraries.
412 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
414 2008-09-11 Chris Demetriou <cgd@google.com>
416 * options.h (origin): New -z option.
417 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
418 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
421 2008-09-05 Cary Coutant <ccoutant@google.com>
423 * fileread.cc (File_read::make_view): Add check for attempt to map
426 2008-09-05 Cary Coutant <ccoutant@google.com>
428 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
429 explicit instantiations.
431 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
434 * options.cc (General_options::finalize): Allow undefined symbols
435 in shlibs if linking -shared.
438 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
439 symbols as not needing a dynsym entry.
441 2008-08-20 Craig Silverstein <csilvers@google.com>
443 * fileread.cc (File_read::open): Do not lock the file unless it
444 was successfully opened.
446 2008-08-14 Cary Coutant <ccoutant@google.com>
448 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
449 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
450 * testsuite/tls_test.cc (struct int128): 128-bit struct
451 for testing TLS relocs with non-zero addend.
452 (v12): New TLS variable.
454 (t_last): Add check for v12.
455 * testsuite/tls_test.h (t12): New function.
456 * testsuite/tls_test_main.cc (thread_routine): Call new test.
458 2008-08-13 Ian Lance Taylor <iant@google.com>
460 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
461 set tls_segment_ or relro_segment_.
462 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
464 * output.h (Output_section::clear_is_relro): New function.
465 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
466 sections specially even when output_data_ is empty.
467 (Output_segment::maximum_alignment): When first section is relro,
468 only force alignment for PT_LOAD segments.
469 * script.cc (script_data_segment_align): New function.
470 (script_data_segment_relro_end): New function.
471 * script-c.h (script_data_segment_align): Declare.
472 (script_data_segment_relro_end): Declare.
473 * script-sections.h (class Script_sections): Declare
474 data_segment_align and data_segment_relro_end. Add fields
475 segment_align_index_ and saw_relro_end_.
476 * script-sections.cc (class Sections_element): Add set_is_relro
477 virtual function. Add new bool* parameter to place_orphan_here.
478 Add get_output_section virtual function.
479 (class Output_section_definition): Add set_is_relro. Add new
480 bool* parameter to place_orphan_here. Add get_output_section.
482 (Output_section_definition::Output_section_definition): Initialize
483 evaluated_address_, evaluated_load_address, evaluated_addralign_,
484 and is_relro_ fields.
485 (Output_section_definition::place_orphan_here): Add is_relro
487 (Output_section_definition::set_section_addresses): Set relro for
489 (Output_section_definition::alternate_constraint): Likewise.
490 (class Orphan_output_section): Add new bool* parameter to
491 place_orphan_here. Add get_output_section.
492 (Orphan_output_section::place_orphan_here): Add is_relro
494 (Script_sections::Script_sections): Initialize
495 data_segment_align_index_ and saw_relro_end_.
496 (Script_sections::data_segment_align): New function.
497 (Script_sections::data_segment_relro_end): New function.
498 (Script_sections::place_orphan): Set or clear is_relro.
499 (Script_sections::set_section_addresses): Force alignment of first
501 * yyscript.y (exp): Call script_data_segment_align and
502 script_data_segment_relro_end.
503 * testsuite/relro_script_test.t: New file.
504 * testsuite/relro_test.cc (using_script): Declare.
505 (t1, t2): Test using_script.
506 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
507 (relro_script_test_SOURCES): Define.
508 (relro_script_test_DEPENDENCIES): Define.
509 (relro_script_test_LDFLAGS): Define.
510 (relro_script_test_LDADD): Define.
511 (relro_script_test.so): New target.
512 * testsuite/Makefile.in: Rebuild.
514 2008-08-06 Cary Coutant <ccoutant@google.com>
516 * archive.cc (Archive::total_archives, Archive::total_members)
517 (Archive::total_members_loaded): New variables.
518 (Archive::setup): Add parameter. Add option to preread
520 (Archive::read_armap): Add counter.
521 (Archive::get_file_and_offset): New function.
522 (Archive::get_elf_object_for_member): New function.
523 (Archive::read_all_symbols): New function.
524 (Archive::read_symbols): New function.
525 (Archive::add_symbols): Add counters.
526 (Archive::include_all_members): Use armap to find members if it's
528 (Archive::include_member): Skip reading symbols if already read.
529 Factored code into Archive::get_file_and_offset and
530 Archive::get_elf_object_for_member. Changed call to
531 Mapfile::report_include_archive_member.
532 (Archive::print_stats): New function.
533 * archive.h: Declare Object and Read_symbols_data classes.
534 (Archive::Archive): Add initializers for new members.
535 (Archive::setup): Add parameter.
536 (Archive::print_stats): New function.
537 (Archive::total_archives, Archive::total_members)
538 (Archive::total_members_loaded): New variables.
539 (Archive::get_file_and_offset): New function.
540 (Archive::get_elf_object_for_member): New function.
541 (Archive::read_all_symbols): New function.
542 (Archive::read_symbols): New function.
543 (Archive::Archive_member): New class.
544 (Archive::members_): New member.
545 (Archive::num_members_): New member.
546 * main.cc: Include archive.h.
547 (main): Call Archive::print_stats.
548 * mapfile.cc (Mapfile::report_include_archive_member): Delete
549 archive parameter; member_name is now the fully-decorated name.
550 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
551 * options.h: (General_options): Add --preread-archive-symbols option.
552 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
555 2008-08-04 Ian Lance Taylor <iant@google.com>
557 * symtab.h (Symbol::use_plt_offset): New function.
558 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
559 * powerpc.cc (Relocate::relocate): Likewise.
560 * sparc.cc (Relocate::relocate): Likewise.
561 * x86_64.cc (Relocate::relocate): Likewise.
562 * testsuite/weak_plt.sh: New test.
563 * testsuite/weak_plt_main.cc: New test.
564 * testsuite/weak_plt_shared.cc: New test.
565 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
566 (check_PROGRAMS): Add weak_plt.
567 (check_DATA): Add weak_plt_shared.so.
568 (weak_plt_main_pic.o, weak_plt): New targets.
569 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
570 * testsuite/Makefile.in: Rebuild.
572 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
574 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
575 * testsuite/Makefile.in: Rebuild.
577 2008-08-04 Alan Modra <amodra@bigpond.net.au>
579 * Makefile.am (POTFILES.in): Set LC_ALL=C.
580 * Makefile.in: Regenerate.
581 * po/POTFILES.in: Regenerate.
583 2008-07-29 Ian Lance Taylor <iant@google.com>
585 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
586 symbols before other symbols.
587 * testsuite/script_test_2.cc (test_addr): Declare.
588 (test_addr_alias): Declare.
589 (main): Check that test_addr and test_addr_alias have the right
591 * testsuite/script_test_2.t: Define test_addr_alias and
594 2008-07-24 Ian Lance Taylor <iant@google.com>
597 * descriptors.cc: New file.
598 * descriptors.h: New file.
599 * gold-threads.h (class Hold_optional_lock): New class.
600 * fileread.cc: Include "descriptors.h".
601 (File_read::~File_read): Release descriptor rather than closing
603 (File_read::open) [file]: Call open_descriptor rather than open.
604 Set is_descriptor_opened_.
605 (File_read::open) [memory]: Assert that descriptor is not open.
606 (File_read::reopen_descriptor): New function.
607 (File_read::release): Release descriptor.
608 (File_read::do_read): Make non-const. Reopen descriptor.
609 (File_read::read): Make non-const.
610 (File_read::make_view): Reopen descriptor.
611 (File_read::do_readv): Likewise.
612 * fileread.h (class File_read): Add is_descriptor_opened_ field.
614 * layout.cc: Include "descriptors.h".
615 (Layout::create_build_id): Use open_descriptor rather than open.
616 * output.cc: Include "descriptors.h".
617 (Output_file::open): Use open_descriptor rather than open.
618 * archive.cc (Archive::const_iterator): Change Archive to be
620 (Archive::begin, Archive::end): Make non-const.
621 (Archive::count_members): Likewise.
622 * archive.h (class Archive): Update declarations.
623 * object.h (Object::read): Make non-const.
624 * Makefile.am (CCFILES): Add descriptors.cc.
625 (HFILES): Add descriptors.h.
626 * Makefile.in: Rebuild.
629 * gold.h: Always include <clocale>. Add Solaris workarounds
630 following code in binutils/sysdep.h.
633 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
634 this->eh_frame_hdr_ is NULL before using it.
636 * dynobj.cc (Versions::Versions): Update comment.
638 * dynobj.cc (Versions::Versions): If there is an soname, use it as
639 the base version name.
641 * stringpool.cc (Stringpool_template::add_with_length): Set key to
643 (Stringpool_template::set_string_offsets): Subtract one from key
644 before using it as an array index.
645 (Stringpool_template::get_offset_with_length): Likewise.
646 (Stringpool_template::write_to_buffer): Likewise.
647 * stringpool.h (Stringpool_template::get_offset_from_key):
650 2008-07-23 Ian Lance Taylor <iant@google.com>
653 * object.h (Merged_symbol_value::value): Do our best to handle a
657 * script.cc (Version_script_info::get_versions): Don't add empty
658 version tag to return value.
659 (Version_script_info::get_symbol_version_helper): Change return
660 type to bool. Add pversion parameter. Change all callers.
661 (script_register_vers_node): Don't require a non-NULL tag.
662 * script.h (class Version_script_info): Update declarations.
663 (Version_script_info::get_symbol_version): Change return type to
664 bool. Add version parameter. Change all callers.
665 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
666 handling. Handle an empty version from a version script.
667 (Symbol_table::define_special_symbol): Likewise.
668 * testsuite/ver_test_10.script: New file.
669 * testsuite/ver_test_10.sh: New file.
670 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
671 (check_DATA): Add ver_test_10.syms.
672 (ver_test_10.syms, ver_test_10.so): New target.
673 * testsuite/Makefile.in: Rebuild.
675 2008-07-23 Simon Baldwin <simonb@google.com>
677 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
678 to zero for undefined symbols from dynamic libraries.
680 2008-07-23 Ian Lance Taylor <iant@google.com>
682 * symtab.cc (Symbol_table::resolve): Remove version parameter.
684 * symtab.h (class Symbol_table): Update declaration.
685 * testsuite/ver_test_9.cc: New file.
686 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
687 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
688 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
689 (ver_test_9.so, ver_test_9.o): New targets.
690 * testsuite/Makefile.in: Rebuild.
692 2008-07-22 Ian Lance Taylor <iant@google.com>
694 * options.h (class General_options): Define --check-sections.
695 * layout.cc (Layout::set_segment_offsets): Handle
698 * options.h (class General_options): Define -n/--nmagic and
700 * options.cc (General_options::finalize): For -n/--nmagic or
701 -N/--omagic, set -static.
702 * layout.cc (Layout::attach_allocated_section_to_segment): If
703 -N/--omagic, don't put read-only and read-write sections in
705 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
706 finding a read-only segment.
707 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
708 don't set the minimum segment alignment to the common page size,
709 and don't set the file offset to the address modulo the page size.
710 * script-sections.cc (Script_sections::create_segments): If
711 -n/--omagic, don't put read-only and read-write sections in
716 * options.h (class General_options): Add --print-symbol-counts.
717 * main.cc (main): Issue defined symbol report if requested.
718 * archive.cc (Archive::interpret_header): Make into a const member
720 (Archive::add_symbols): Call Input_objects::archive_start and
722 (Archive::const_iterator): Define new class.
723 (Archive::begin, Archive::end): New functions.
724 (Archive::include_all_members): Rewrite to use iterator.
725 (Archive::count_members): New function.
726 * archive.h (class Archive): Update declarations.
727 (Archive::filename): New function.
728 * object.cc: Include "cref.h".
729 (Sized_relobj::Sized_relobj): Initialize defined_count_.
730 (Sized_relobj::do_get_global_symbol_counts): New function.
731 (Input_objects::add_object): Add object to cross-referencer.
732 (Input_objects::archive_start): New function.
733 (Input_objects::archive_stop): New function.
734 (Input_objects::print_symbol_counts): New function.
735 * object.h: Declare Cref and Archive.
736 (Object::get_global_symbol_counts): New function.
737 (Object::do_get_global_symbol_counts): New pure virtual function.
738 (class Sized_relobj): Add defined_count_ field. Update
740 (class Input_objects): Add cref_ field. Update constructor.
742 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
744 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
746 (Sized_dynobj::do_get_global_symbol_counts): New function.
747 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
748 defined_count_. Update declarations. Define Symbols typedef.
749 * symtab.cc (Symbol_table::add_from_relobj): Add defined
750 parameter. Change all callers.
751 (Symbol_table::add_from_dynobj): Add sympointers and defined
752 parameters. Change all callers.
753 * symtab.h (class Symbol_table): Update declarations.
754 * Makefile.am (CCFILES): Add cref.cc.
755 (HFILES): Add cref.h.
756 * Makefile.in: Rebuild.
758 2008-07-22 Simon Baldwin <simonb@google.com>
760 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
761 to zero when writing undefined symbols.
763 2008-07-22 Ian Lance Taylor <iant@google.com>
765 * output.cc (Output_section::add_input_section): Don't try to
766 merge empty merge sections.
768 2008-07-21 Craig Silverstein <csilvers@google.com>
770 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
771 Include symbol version in error message.
773 2008-07-20 Chris Demetriou <cgd@google.com>
775 * configure.ac (gold_cv_c_random_seed): New configured variable.
776 (RANDOM_SEED_CFLAGS): New substituted variable.
777 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
778 * configure: Rebuild.
779 * Makefile.in: Likewise.
780 * testsuite/Makefile.in: Likewise.
782 2008-07-18 Ian Lance Taylor <iant@google.com>
784 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
785 where we see NAME/NULL and NAME/VERSION as separate symbols.
786 * testsuite/ver_test_main.cc (main): Call t4.
788 * testsuite/ver_test_2.cc (t4_2): Define.
789 * testsuite/ver_test_2.script: Put t4_2a in VER2.
790 * testsuite/ver_test_4.cc (t4_2a): Define.
791 * testsuite/ver_test_4.script: Put t4_2a in VER2.
792 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
794 2008-07-17 Ian Lance Taylor <iant@google.com>
796 * dynobj.cc (Versions::add_def): If we give an error about a
797 missing version, go ahead and create the version anyhow.
799 2008-07-10 Ian Lance Taylor <iant@google.com>
801 Handle output sections with more than 0x7fffffff bytes.
802 * object.h (class Relobj): Change map_to_output_ to
803 output_sections_, and just keep a section pointer. Change all
804 uses. Move comdat group support to Sized_relobj.
805 (Relobj::is_section_specially_mapped): Remove.
806 (Relobj::output_section): Remove poff parameter. Change all
808 (Relobj::output_section_offset): New function.
809 (Relobj::set_section_offset): Rewrite.
810 (Relobj::map_to_output): Remove.
811 (Relobj::output_sections): New function.
812 (Relobj::do_output_section_offset): New pure virtual function.
813 (Relobj::do_set_section_offset): Likewise.
814 (class Sized_relobj): Add section_offsets_ field. Add comdat
815 group support from Relobj. Update declarations.
816 (Sized_relobj::get_output_section_offset): New function.
817 (Sized_relobj::do_output_section_offset): New function.
818 (Sized_relobj::do_set_section_offset): New function.
819 * object.cc (Relobj::output_section_address): Remove.
820 (Sized_relobj::Sized_relobj): Initialize new fields.
821 (Sized_relobj::include_section_group): Cast find_kept_object to
823 (Sized_relobj::include_linkonce_section): Likewise.
824 (Sized_relobj::do_layout): Use separate arrays for output section
826 (Sized_relobj::do_count_local_symbols): Change map_to_output to
828 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
829 output_sections and section_offsets.
830 (Sized_relobj::write_local_symbols): Likewise.
831 (map_to_kept_section): Compute output address directly.
832 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
833 output_sections and section_offsets.
834 (Sized_relobj::write_sections): Likewise.
835 (Sized_relobj::relocate_sections): Likewise.
836 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
837 * output.h (class Output_reloc): Update declarations. Change
838 u2_.relobj to Sized_relobj*.
839 (class Output_data_reloc): Change add functions to use
841 * output.cc (Output_reloc::Output_reloc): Change relobj to
843 (Output_reloc::local_section_offset): Change return type to
844 Elf_Addr. Use get_output_section_offset.
845 (Output_reloc::get_address): Likewise.
846 (Output_section::is_input_address_mapped): Don't call
847 is_section_specially_mapped.
848 (Output_section::output_offset): Likewise.
849 (Output_section::output_address): Likewise.
850 (Output_section::starting_output_address): Likewise.
851 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
852 parameter to Sized_relobj*.
853 (Copy_relocs::need_copy_reloc): Likewise.
854 (Copy_relocs::save): Likewise.
855 * copy-relocs.h (class Copy_relocs): Update declarations.
856 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
857 Sized_relobj*. Change relobj_ field to Sized_relobj*.
858 * target-reloc.h (relocate_for_relocatable): Change
859 offset_in_output_section type to Elf_Addr. Change code that uses
861 * layout.cc (Layout::layout): Always set *off.
862 * mapfile.cc (Mapfile::print_input_section): Use
863 output_section_offset.
864 * i386.cc (Target_i386::copy_reloc): Change object parameter to
866 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
867 * sparc.cc (Target_sparc::copy_reloc): Likewise.
868 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
870 2008-07-03 Ian Lance Taylor <iant@google.com>
872 * layout.cc (Layout::include_section): Do not discard unrecognized
875 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
877 * script.cc (Lex::can_continue_name): Make '?' allowable in
878 version-script names.
879 * testsuite/version_script.map: Change glob pattern to use '?'
881 2008-06-30 Manish Singh <yosh@gimp.org>
884 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
887 2008-06-30 Ian Lance Taylor <iant@google.com>
891 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
892 versions]: Don't try to read the value in the contents, since we
893 don't use it. Use the template endianness when writing.
895 2008-06-25 Cary Coutant <ccoutant@google.com>
897 * fileread.cc (File_read::make_view): Assert on zero-length view.
898 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
899 symbol table when there are no symbols to read.
901 2008-06-23 Craig Silverstein <csilvers@google.com>
903 * version.cc (version_string): Bump to 1.7
905 2008-06-18 Craig Silverstein <csilvers@google.com>
907 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
908 constant 0xFFFF to type Valtype.
909 (Powerpc_relocate_functions::rel16_ha): Likewise.
911 2008-06-17 Ian Lance Taylor <iant@google.com>
913 * output.h (Output_section::Input_section): Initialize p2align_ to
914 zero for Output_section_data constructors.
915 (Output_section::Input_section::addralign): If not an input
916 section, return the alignment of the Output_section_data.
917 * testsuite/copy_test.cc: New file.
918 * testsuite/copy_test_1.cc: New file.
919 * testsuite/copy_test_2.cc: New file.
920 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
921 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
922 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
923 (copy_test_1_pic.o, copy_test_1.so): New targets.
924 (copy_test_2_pic.o, copy_test_2.so): New targets.
925 * testsuite/Makefile.in: Rebuild.
927 * script-sections.cc (Script_sections::place_orphan): Initialize
928 local variable exact.
930 2008-06-13 David Edelsohn <edelsohn@gnu.org>
932 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
934 2008-06-12 David Edelsohn <edelsohn@gnu.org>
935 David S. Miller <davem@davemloft.net>
937 * powerpc.cc: New file.
938 * Makefile.am (TARGETSOURCES): Add powerpc.cc
939 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
940 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
941 * Makefile.in: Rebuild.
943 2008-06-09 Ian Lance Taylor <iant@google.com>
945 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
947 (throwing, orig_terminate): New static variables.
948 (terminate_handler): New static function.
949 (t2): Set terminate handler.
951 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
954 * binary.cc (Binary_to_elf::sized_convert): Fix .data
957 2008-05-30 Cary Coutant <ccoutant@google.com>
959 * archive.cc (Archive::include_all_members) Correct to step
960 over symbol table and extended name table in thin archives.
962 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
965 * target-reloc.h (relocate_for_relocatable): Fix new_offset
968 2008-05-28 Caleb Howe <cshowe@google.com>
970 * reduced_debug_output.cc: New file.
971 * reduced_debug_output.h: New file.
972 * options.h (class General_options): Add --strip-debug-non-line.
973 * options.cc (General_options::finalize): Add strip_debug_non_line
974 to the strip heirarchy.
975 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
977 * layout.cc: Include "reduced_debug_output.h".
978 (Layout::Layout): Initialize new fields.
979 (line_only_debug_sections): New static array.
980 (is_lines_only_debug_sections): New static inline function.
981 (Layout::include_section): Handle --strip-debug-non-line.
982 (Layout::make_output_section): If --strip-debug-non-line, build
983 new output sections for .debug_abbrev and .debug_info.
984 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
985 gold. Warn about possible overflow.
986 (read_signed_LEB_128): Likewise.
987 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
988 (read_signed_LEB_128): Declare.
989 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
990 (HFILES): Add reduced_debug_output.h.
991 * Makefile.in: Rebuild.
993 2008-05-21 Ian Lance Taylor <iant@google.com>
995 * mapfile.cc: New file.
996 * mapfile.h: New file.
997 * options.h (class General_options): Add -M/--print-map and -Map.
998 * options.cc (General_options::finalize): Make -M equivalent to
1000 * main.cc: Include <cstdio> and "mapfile.h".
1001 (main): Open mapfile if requested.
1002 * gold.cc (class Middle_runner): Add mapfile_ field. Update
1003 constructor. Change caller.
1004 (queue_initial_tasks): Add mapfile parameter. Change caller.
1005 (queue_middle_tasks): Likewise.
1006 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
1008 * archive.cc: Include "mapfile.h".
1009 (Archive::add_symbols): Add mapfile parameter. Change all
1010 callers. Pass mapfile, symbol, and reason to include_member.
1011 (Archive::include_all_members): Add mapfile parameter. Change all
1013 (Archive::include_member): Add mapfile, sym, and why parameters.
1014 Change all callers. Report inclusion to map file.
1015 * archive.h: Include "fileread.h".
1016 (class Archive): Update declarations.
1017 (Archive::file): New const method.
1018 (class Add_archive_symbols): Add mapfile_ field. Update
1019 constructor. Change all callers.
1020 * readsyms.h (class Read_symbols): Likewise.
1021 (class Finish_group): Likewise.
1022 (class Read_script): Likewise.
1023 * common.cc: Include "mapfile.h".
1024 (Symbol_table::allocate_commons): Add mapfile parameter. Change
1026 (Symbol_table::do_allocate_commons): Likewise.
1027 (Symbol_table::do_allocate_commons_list): Likewise. Report common
1028 symbol allocation to mapfile.
1029 * common.h (class Allocate_commons_task): Add mapfile_ field.
1030 Update constructor. Change all callers.
1031 * symtab.h (class Symbol_table): Update declarations.
1032 * layout.cc: Include "mapfile.h".
1033 (Layout_task_runner::run): Print information to mapfile.
1034 (Layout::create_gold_note): Change Output_data_fixed_space to
1035 Output_data_zero_fill.
1036 (Layout::create_build_id): Likewise.
1037 (Layout::print_to_mapfile): New function.
1038 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
1039 constructor. Change caller.
1040 (class Layout): Declare print_to_mapfile.
1041 * output.cc (Output_section::Input_section::print_to_mapfile): New
1043 (Output_section::add_input_section): If producing a map, always
1044 add to input_sections_ list.
1045 (Output_section::do_print_to_mapfile): New function.
1046 (Output_segment::print_sections_to_mapfile): New function.
1047 (Output_segment::print_section_list_to_mapfile): New function.
1048 * output.h: Include "mapfile.h".
1049 (Output_data::print_to_mapfile): New function.
1050 (Output_data::do_print_to_mapfile): New virtual function.
1051 (Output_segment_headers::do_print_to_mapfile): New function.
1052 (Output_file_header::do_print_to_mapfile): New function.
1053 (Output_data_const::do_print_to_mapfile): New function.
1054 (class Output_data_const_buffer): Add map_name_ field. Update
1055 constructor. Change all callers. Add do_print_to_mapfile
1057 (class Output_data_fixed_space): Likewise.
1058 (class Output_data_space): Likewise.
1059 (class Output_data_zero_fill): New class.
1060 (Output_data_strtab::do_print_to_mapfile): New function.
1061 (Output_data_reloc_base::do_print_to_mapfile): New function.
1062 (Output_relocatable_relocs::do_print_to_mapfile): New function.
1063 (Output_data_group::do_print_to_mapfile): New function.
1064 (Output_data_got::do_print_to_mapfile): New function.
1065 (Output_data_dynamic::do_print_to_mapfile): New function.
1066 (Output_symtab_xindex::do_print_to_mapfile): New function.
1067 (class Output_section): Declare do_print_to_mapflie. Declare
1068 print_to_mapfile in Input_section.
1069 (class Output_segment): Declare new functions.
1070 * object.h (Sized_relobj::symbol_count): New function.
1071 * script-sections.cc
1072 (Output_section_element_dot_assignment::set_section_addresses):
1073 Change Output_data_fixed_space to Output_data_zero_fill.
1074 (Output_data_expression::do_print_to_mapfile): New function.
1075 * script.cc (read_input_script): Add mapfile parameter. Change
1077 * script.h (read_input_script): Update declaration.
1078 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
1079 (Eh_frame::do_print_to_mapfile): New function.
1080 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
1081 (Output_merge_string::do_print_to_mapfile): New function.
1082 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
1084 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
1086 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
1088 * Makefile.am (CCFILES): Add mapfile.cc.
1089 (HFILES): Add mapfile.h.
1090 * Makefile.in: Rebuild.
1092 2008-05-19 Ian Lance Taylor <iant@google.com>
1094 * options.h (class General_options): Add -z relro.
1095 * layout.cc (Layout::Layout): Initialize relro_segment_.
1096 (Layout::add_output_section_data): Return the output section.
1097 (Layout::make_output_section): Rcognize relro sections and mark
1099 (Layout::attach_allocated_section_to_segment): Put relro sections
1100 in a PT_GNU_RELRO segment.
1101 (Layout::create_initial_dynamic_sections): Mark the .dynamic
1103 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
1105 (Layout::linkonce_mapping): Map d.rel.ro.local to
1107 (Layout::output_section_name): Us .data.rel.ro.local for any
1108 section which begins with that.
1109 * layout.h (class Layout): Update add_output_section_data
1110 declaration. Add relro_segment_ field.
1111 * output.cc (Output_section::Output_section): Initialize is_relro_
1112 and is_relro_local_ fields.
1113 (Output_segment::add_output_section): Group relro sections.
1114 (Output_segment::is_first_section_relro): New function.
1115 (Output_segment::maximum_alignment): If there is a relro section,
1116 align the segment to the common page size.
1117 (Output_segment::set_section_addresses): Track whether we are
1118 looking at relro sections. If the last section is a relro
1119 section, align to the common page size.
1120 (Output_segment::set_section_list_addresses): Add in_relro
1121 parameter. Change all callers. Align to the page size when
1122 moving from relro to non-relro section.
1123 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
1125 * output.h (class Output_section): Add is_relro_ and
1126 is_relro_local_ fields.
1127 (Output_section::is_relro): New function.
1128 (Output_section::set_is_relro): New function.
1129 (Output_section::is_relro_local): New function.
1130 (Output_section::set_is_relro_local): New function.
1131 (class Output_segment): Update declarations.
1132 * i386.cc (Target_i386::got_section): Mark .got section as relro.
1133 * sparc.cc (Target_sparc::got_section): Likewise.
1134 * x86_64.cc (Target_x86_64::got_section): Likewise.
1135 * testsuite/relro_test_main.cc: New file.
1136 * testsuite/relro_test.cc: New file.
1137 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
1138 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
1139 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
1140 (relro_test.so, relro_test_pic.o): New targets.
1141 * testsuite/Makefile.in: Rebuild.
1143 2008-05-16 Ian Lance Taylor <iant@google.com>
1145 * output.cc (Output_segment::add_output_section): Remove front
1147 * output.h (class Output_segment): Remove
1148 add_initial_output_section and overloaded add_output_section.
1149 Update declaration of remaining add_output_section.
1150 * layout.cc (Layout::create_interp): Call add_output_section
1151 rather than add_initial_output_section.
1152 (Layout::finish_dynamic_section): Likewise.
1154 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
1155 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
1156 know the dynamic type.
1157 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
1158 field. Initialize it in constructor.
1159 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
1160 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
1161 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
1164 * output.cc (Output_reloc::get_address): Change return type to
1166 * output.h (class Output_reloc): Update get_address declaration.
1167 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
1168 for section addresses.
1170 2008-05-09 Ian Lance Taylor <iant@google.com>
1173 * gold.cc (gold_nomem): Use return value of write.
1175 2008-05-08 Ian Lance Taylor <iant@google.com>
1177 * symtab.c (Symbol::init_base_output_data): Add version
1178 parameter. Change all callers.
1179 (Symbol::init_base_output_segment): Likewise.
1180 (Symbol::init_base_constant): Likewise.
1181 (Symbol::init_base_undefined): Likewise.
1182 (Sized_symbol::init_output_data): Likewise.
1183 (Sized_symbol::init_output_segment): Likewise.
1184 (Sized_symbol::init_constant): Likewise.
1185 (Sized_symbol::init_undefined): Likewise.
1186 (Symbol_table::do_define_in_output_data): If the new symbol has a
1187 version, mark it as the default.
1188 (Symbol_table::do_define_in_output_segment): Likewise.
1189 (Symbol_table::do_define_as_constant): Likewise.
1190 * symtab.h (class Symbol): Update declarations.
1191 (class Sized_symbol): Likewise.
1192 * resolve.cc (Symbol::override_version): New function.
1193 (Symbol::override_base): Call override_version.
1194 (Symbol::override_base_with_special): Likewise.
1195 * testsuite/ver_script_8.script: New file.
1196 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
1197 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
1198 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
1199 (ver_test_8_1.so, ver_test_8_2.so): New targets.
1201 2008-05-06 Ian Lance Taylor <iant@google.com>
1204 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
1206 (class General_options): Remove existing --undefined, and add
1207 --no-undefined instead. Add new --undefined as synonym for -u.
1208 * archive.cc (Archive::add_symbols): Check whether symbol was
1210 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
1211 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
1212 all uses. Add IS_UNDEFINED. Update declarations to split
1213 different versions of init_base. Declare init_base_undefined.
1214 (Symbol::is_defined): Handle IS_UNDEFINED.
1215 (Symbol::is_undefined): Likewise.
1216 (Symbol::is_weak_undefined): Call is_undefined.
1217 (Symbol::is_absolute): Handle IS_CONSTANT.
1218 (class Sized_symbol): Update declarations to split different
1219 versions of init. Declare init_undefined.
1220 (class Symbol_table): Declare new functions.
1221 * symtab.cc (Symbol::init_base_object): Rename from init_base.
1223 (Symbol::init_base_output_data): Likewise.
1224 (Symbol::init_base_output_segment): Likewise.
1225 (Symbol::init_base_constant): Likewise.
1226 (Symbol::init_base_undefined): New function.
1227 (Sized_symbol::init_object): Rename from init. Change all
1229 (Sized_symbol::init_output_data): Likewise.
1230 (Sized_symbol::init_output_segment): Likewise.
1231 (Sized_symbol::init_constant): Likewise.
1232 (Sized_symbol::init_undefined): New function.
1233 (Symbol_table::add_undefined_symbols_from_command_line): New
1235 (Symbol_table::do_add_undefined_symbols_from_command_line): New
1237 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
1238 (Symbol::output_section): Likewise.
1239 (Symbol::set_output_section): Likewise.
1240 (Symbol_table::sized_finalize_symbol): Likewise.
1241 (Symbol_table::sized_write_globals): Likewise.
1242 * resolve.cc (Symbol_table::should_override): Likewise.
1243 (Symbol::override_base_with_special): Likewise.
1245 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
1246 symbol, change it to have default visibility.
1247 * testsuite/protected_1.cc: New file.
1248 * testsuite/protected_2.cc: New file.
1249 * testsuite/protected_3.cc: New file.
1250 * testsuite/protected_main_1.cc: New file.
1251 * testsuite/protected_main_2.cc: New file.
1252 * testsuite/protected_main_3.cc: New file.
1253 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
1254 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
1255 (protected_1_LDFLAGS, protected_1_LDADD): Define.
1256 (protected_1.so): New target.
1257 (protected_1_pic.o, protected_2_pic.o): New targets.
1258 (protected_3_pic.o): New target.
1259 (check_PROGRAMS): Add protected_2.
1260 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
1261 (protected_2_LDFLAGS, protected_2_LDADD): Define.
1262 * testsuite/Makefile.in: Rebuild.
1264 * options.h (DEFINE_var): Add set_user_set_##varname__.
1265 (DEFINE_bool_alias): New macro.
1266 (class General_options): Define -Bstatic using DEFINE_bool_alias
1267 rather than DEFINE_special. Add --undefined as an alias for -z
1269 * options.cc (General_options::parse_Bstatic): Remove.
1271 * options.h (class General_options): Add --fatal-warnings.
1272 * main.cc (main): Implement --fatal-warnings.
1273 * errors.h (Errors::warning_count): New function.
1275 * options.h (class General_options): Add -Bsymbolic-functions.
1276 * symtab.h (Symbol::is_preemptible): Check for
1277 -Bsymbolic-functions.
1279 2008-05-05 Ian Lance Taylor <iant@google.com>
1281 * options.h (DEFINE_bool): For DASH_Z, create the negative option
1282 as noVARNAME rather than no-VARNAME.
1283 (class General_options): Add option -z combreloc.
1284 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
1286 (Output_reloc::sort_before) [SHT_REL]: New function.
1287 (Output_reloc::sort_before) [SHT_RELA]: New function.
1288 (class Output_data_reloc_base): Add sort_relocs_ field. Define
1289 Sort_relocs_comparison.
1290 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
1291 parameter. Change all callers.
1292 (Output_data_reloc::Output_data_reloc) [both versions]: Add
1293 sort_relocs parameter. Change all callers.
1294 * output.cc (Output_reloc::get_address): New function, broken out
1296 (Output_reloc::write_rel): Call it.
1297 (Output_reloc::compare): New function.
1298 (Output_data_reloc_base::do_write): Optionally sort relocs.
1300 * configure.ac: If targ_extra_obj is set, link it in.
1301 * configure.tgt: Initialize all variables.
1302 (x86_64*): Set targ_extra_obj and targ_extra_size.
1303 * configure: Rebuild.
1305 * object.cc (Sized_relobj::include_section_group): Adjust section
1306 indexes read from group data. Build vector to pass to
1308 * layout.cc (Layout::layout_group): Add flags and shndxes
1309 parameters. Remove contents parameter. Change caller. Update
1310 explicit instantiations.
1311 * layout.h (class Layout): Update layout_group declaration.
1312 * output.cc (Output_data_group::Output_data_group): Add flags and
1313 input_shndxes parameters. Remove contents parameter. Change
1315 (Output_data_group::do_write): Change input_sections_ to
1317 * output.h (class Output_data_group): Update constructor
1318 declaration. Rename input_sections_ to input_shndxes_.
1319 * testsuite/many_sections_test.cc: Add template.
1321 2008-04-30 Cary Coutant <ccoutant@google.com>
1323 * target-reloc.h (relocate_section): Fix dead-pointer bug.
1325 * layout.cc (Layout::include_section): Refactored check for debug
1327 (Layout::add_comdat): Add new parameters. Change type
1328 of signature parameter. Add object and shndx to signatures table.
1329 (Layout::find_kept_object): New function.
1330 * layout.h: Include <cstring>.
1331 (Layout::is_debug_info_section): New function.
1332 (Layout::add_comdat): Add new parameters.
1333 (Layout::find_kept_object): New function.
1334 (Layout::Kept_section): New struct.
1335 (Layout::Signatures): Change type of map range.
1336 * object.cc (Relobj::output_section_address): New function.
1337 (Sized_relobj::include_section_group): Add new parameters. Change
1338 calls to Layout::add_comdat. Change to build table of kept comdat
1339 groups and table mapping discarded sections to kept sections.
1340 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
1341 (Sized_relobj::do_layout): Change calls to include_section_group and
1342 include_linkonce_section.
1343 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
1344 value to zero when section is discarded.
1345 (Sized_relobj::map_to_kept_section): New function.
1346 * object.h (Relobj::output_section_address): New function.
1347 (Relobj::Comdat_group): New type.
1348 (Relobj::find_comdat_group): New function.
1349 (Relobj::Comdat_group_table): New type.
1350 (Relobj::Kept_comdat_section): New type.
1351 (Relobj::Kept_comdat_section_table): New type.
1352 (Relobj::add_comdat_group): New function.
1353 (Relobj::set_kept_comdat_section): New function.
1354 (Relobj::get_kept_comdat_section): New function.
1355 (Relobj::comdat_groups_): New field.
1356 (Relobj::kept_comdat_sections_): New field.
1357 (Symbol_value::input_value): Update comment.
1358 (Sized_relobj::map_to_kept_section) New function.
1359 (Sized_relobj::include_linkonce_section): Add new parameter.
1360 * target-reloc.h (Comdat_behavior): New type.
1361 (get_comdat_behavior): New function.
1362 (relocate_section): Add code to map a discarded section to the
1363 corresponding kept section when applying a relocation.
1365 2008-04-30 Craig Silverstein <csilvers@google.com>
1367 * dwarf_reader.cc (next_generation_count): New static var.
1368 (Addr2line_cache_entry): New struct.
1369 (addr2line_cache): New static var.
1370 (Dwarf_line_info::one_addr2line): Added caching.
1371 (Dwarf_line_info::clear_addr2line_cache): New function.
1372 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
1373 cache-size parameter.
1374 (Dwarf_line_info::one_addr2line_cache): New function.
1375 * symtab.cc (Symbol_table::detect_odr_violations): Pass
1376 new cache-size argument to one_addr2line(), and clear cache.
1378 2008-04-28 Cary Coutant <ccoutant@google.com>
1380 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
1381 R_386_PC8 relocations.
1383 2008-04-23 Ian Lance Taylor <iant@google.com>
1385 * object.cc (Sized_relobj::include_section_group): Check for
1386 invalid section group.
1388 * object.cc (make_elf_object): Correct test for 64-bit ELF file
1391 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
1392 than read for file header.
1393 * archive.cc (Archive::include_member): Likewise.
1395 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
1397 * aclocal.m4: Regenerate.
1398 * configure: Regenerate.
1400 2008-04-19 Ian Lance Taylor <iant@google.com>
1402 * version.cc (version_string): Bump to 1.6.
1404 * testsuite/Makefile.am (many_sections_r_test): New target.
1405 (many_sections_r_test_SOURCES): Remove.
1406 (many_sections_r_test_DEPENDENCIES): Remove.
1407 (many_sections_r_test_LDFLAGS): Remove.
1408 (many_sections_r_test_LDADD): Remove.
1410 * object.cc (Sized_relobj::do_add_symbols): Always pass
1411 local_symbol_count_ to add_from_relobj.
1413 * testsuite/Makefile.am (many_sections_check.h): Only check one in
1414 every thousand variables.
1415 * testsuite/Makefile.in: Rebuild.
1417 * object.cc (Xindex::initialize_symtab_xindex): New function.
1418 (Xindex::read_symtab_xindex): New function.
1419 (Xindex::sym_xindex_to_shndx): New function.
1420 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
1422 (Sized_relobj::do_initialize_xindex): New function.
1423 (Sized_relobj::do_read_symbols): Adjust section links.
1424 (Sized_relobj::symbol_section_and_value): Add is_ordinary
1425 parameter. Change all callers.
1426 (Sized_relobj::include_section_group): Adjust section links and
1427 symbol section indexes.
1428 (Sized_relobj::do_layout): Adjust section links.
1429 (Sized_relobj::do_count_local_symbols): Adjust section links and
1430 symbol section indexes.
1431 (Sized_relobj::do_finalize_local_symbols): Distinguish between
1432 ordinary and special symbols.
1433 (Sized_relobj::write_local_symbols): Add symtab_xindex and
1434 dynsym_xindex parameters. Change all callers. Adjust section
1435 links. Use SHN_XINDEX when needed.
1436 (Sized_relobj::get_symbol_location_info): Adjust section links.
1437 Don't get fooled by special symbols.
1438 * object.h (class Xindex): Define.
1439 (class Object): Add xindex_ parameter. Declare virtual functoin
1440 do_initialize_xindex.
1441 (Object::adjust_sym_shndx): New function.
1442 (Object::set_xindex): New protected function.
1443 (class Symbol_value): Add is_ordinary_shndx_ field.
1444 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
1445 (Symbol_value::value): Assert ordinary section.
1446 (Symbol_value::initialize_input_to_output_map): Likewise.
1447 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
1449 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
1451 (class Sized_relobj): Update declarations.
1452 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
1453 parameter. Change all callers.
1454 (Sized_relobj::adjust_shndx): New function.
1455 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
1457 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
1458 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
1459 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
1460 (Sized_dynobj::read_dynsym_section): Adjust section links.
1461 (Sized_dynobj::read_dynamic): Likewise.
1462 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
1464 (Sized_dynobj::do_initialize_xindex): New function.
1465 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
1466 do_initialize_xindex.
1467 (Sized_dynobj::adjust_shndx): New function.
1468 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
1469 dynsym_xindex_ fields.
1470 (Layout::finalize): Add a call to set_section_indexes before
1471 creating the symtab sections.
1472 (Layout::set_section_indexes): Don't do anything if the section
1473 already has a section index.
1474 (Layout::create_symtab_sections): Add shnum parameter. Change
1475 caller. Create .symtab_shndx section if needed.
1476 (Layout::create_shdrs): Add shstrtab_section parameter. Change
1478 (Layout::allocated_output_section_count): New function.
1479 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
1481 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
1482 fields. Update declarations.
1483 (Layout::symtab_xindex): New function.
1484 (Layout::dynsym_xindex): New function.
1485 (class Write_symbols_task): Add layout_ field.
1486 (Write_symbols_task::Write_symbols_task): Add layout parameter.
1488 * output.cc (Output_section_headers::Output_section_headers): Add
1489 shstrtab_section parameter. Change all callers.
1490 (Output_section_headers::do_sized_write): Store overflow values
1491 for section count and section string table section index in
1492 section header zero.
1493 (Output_file_header::do_sized_write): Check for overflow of
1494 section count and section string table section index.
1495 (Output_symtab_xindex::do_write): New function.
1496 (Output_symtab_xindex::endian_do_write): New function.
1497 * output.h (class Output_section_headers): Add shstrtab_section_.
1498 Update declarations.
1499 (class Output_symtab_xindex): Define.
1500 (Output_section::has_out_shndx): New function.
1501 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
1503 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
1505 (Sized_symbol::init): Likewise.
1506 (Symbol::output_section): Check for ordinary symbol.
1507 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
1508 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
1510 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
1511 Change all callers. Simplify handling of symbols from sections
1512 not included in the link.
1513 (Symbol_table::add_from_dynobj): Handle ordinary symbol
1515 (Weak_alias_sorter::operator()): Assert that symbols are
1517 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
1519 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
1520 parameters. Change all callers.
1521 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
1522 symbol distinction. Use SHN_XINDEX when needed.
1523 (Symbol_table::write_section_symbol): Add symtab_xindex
1524 parameter. Change all callers.
1525 (Symbol_table::sized_write_section_symbol): Likewise. Use
1526 SHN_XINDEX when needed.
1527 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
1529 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
1530 (Symbol::is_defined): Check is_ordinary.
1531 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
1532 (Symbol::is_absolute, Symbol::is_common): Likewise.
1533 (class Sized_symbol): Update declarations.
1534 (class Symbol_table): Update declarations.
1535 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
1536 parameters. Change all callers.
1537 (Sized_symbol::override): Likewise.
1538 (Symbol_table::override): Likewise.
1539 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
1540 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
1541 is_ordinary, and orig_st_shndx parameters. Change all callers.
1542 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
1543 to be in an ordinary section.
1544 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
1545 object and is_ordinary parameters. Change all callers.
1546 (Sized_dwarf_line_info::read_relocs): Add object parameter.
1547 Change all callers. Don't add undefined or non-ordinary symbols
1549 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
1551 * dwarf_reader.h (class Sized_dwarf_line_info): Update
1553 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
1554 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
1555 (Sized_relobj::relocate_sections): Likewise.
1556 * target-reloc.h (scan_relocs): Adjust section symbol index.
1557 (scan_relocatable_relocs): Likewise.
1558 * i386.cc (Scan::local): Check for ordinary symbols.
1559 * sparc.cc (Scan::local): Likewise.
1560 * x86_64.cc (Scan::local): Likewise.
1561 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
1562 to symbol_section_and_value.
1563 * testsuite/many_sections_test.cc: New file.
1564 * testsuite/Makefile.am (BUILT_SOURCES): Define.
1565 (check_PROGRAMS): Add many_sections_test.
1566 (many_sections_test_SOURCES): Define.
1567 (many_sections_test_DEPENDENCIES): Define.
1568 (many_sections_test_LDFLAGS): Define.
1569 (BUILT_SOURCES): Add many_sections_define.h.
1570 (many_sections_define.h): New target.
1571 (BUILT_SOURCES): Add many_sections_check.h.
1572 (many_sections_check.h): New target.
1573 (check_PROGRAMS): Add many_sections_r_test.
1574 (many_sections_r_test_SOURCES): Define.
1575 (many_sections_r_test_DEPENDENCIES): Define.
1576 (many_sections_r_test_LDFLAGS): Define.
1577 (many_sections_r_test_LDADD): Define.
1578 (many_sections_r_test.o): New target.
1579 * testsuite/Makefile.in: Rebuild.
1581 2008-04-17 Cary Coutant <ccoutant@google.com>
1583 * errors.cc (Errors::info): New function.
1584 (gold_info): New function.
1585 * errors.h (Errors::info): New function.
1586 * gold.h (gold_info): New function.
1587 * object.cc (Input_objects::add_object): Print trace output.
1588 * options.cc (options::parse_set): New function.
1589 (General_options::parse_wrap): Deleted.
1590 (General_options::General_options): Deleted initializer.
1591 * options.h (options::String_set): New typedef.
1592 (options::parse_set): New function.
1593 (DEFINE_set): New macro.
1594 (General_options::wrap): Changed to use DEFINE_set. Changed
1595 callers of any_wrap_symbols and is_wrap_symbol.
1596 (General_options::trace, General_options::trace_symbol):
1598 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
1599 (General_options::wrap_symbols_): Deleted.
1600 * symtab.cc (Symbol_table::add_from_object): Print trace output.
1602 2008-04-17 David S. Miller <davem@davemloft.net>
1604 * options.cc (General_options::parse_V): New function.
1605 * options.h: Add entries for -V and -Qy.
1607 2008-04-17 Ian Lance Taylor <iant@google.com>
1609 * common.cc (Symbol_table::allocate_commons): Remove options
1610 parameter. Change caller.
1611 (Symbol_table::do_allocate_commons): Remove options parameter.
1612 Change caller. Just call do_allocate_commons_list twice.
1613 (Symbol_table::do_allocate_commons_list): New function, broken out
1614 of do_allocate_commons.
1615 * common.h (class Allocate_commons_task): Remove options_ field.
1617 * symtab.cc (Symbol_table::Symbol_table): Initialize
1619 (Symbol_table::add_from_object): Put TLS common symbols on
1621 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
1622 which are IN_OUTPUT_DATA.
1623 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
1624 allocate_commons and do_allocate_commons declarations. Declare
1625 do_allocate_commons_list.
1626 * gold.cc (queue_middle_tasks): Update creation of
1627 Allocate_commons_task to not pass options.
1628 * testsuite/Makefile.am (INCLUDES): Add -I.. .
1629 (TLS_TEST_C_FLAGS): New variable.
1630 (tls_test_c_pic.o): New target.
1631 (tls_test_shared.so): Link in tls_test_c_pic.o.
1632 (tls_test_c_pic_ie.o): New target.
1633 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
1634 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
1635 (tls_test_c.o): New target.
1636 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
1637 (tls_pic_test_LDADD): Likewise.
1638 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
1639 (tls_shared_gd_to_ie_test_LDADD): Likewise.
1640 (tls_test_c_gnu2.o): New target.
1641 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
1643 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
1644 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
1645 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
1646 * testsuite/tls_test.cc: Include "config.h".
1647 (t_last): Call t11_last.
1648 * testsuite/tls_test.h (t11, t11_last): Declare.
1649 * testsuite/tls_test_c.c: New file.
1650 * testsuite/tls_test_main.cc (thread_routine): Call t11.
1651 * configure.ac: Check for OpenMP support.
1652 * configure, config.in, Makefile.in: Rebuild.
1653 * testsuite/Makefile.in: Rebuild.
1655 2008-04-16 Cary Coutant <ccoutant@google.com>
1657 * i386.cc (Target_i386::define_tls_base_symbol): New function.
1658 (Target_i386::tls_base_symbol_defined_): New field.
1659 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
1660 (Target_i386::Scan::global): Likewise.
1661 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
1662 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
1663 (Target_x86_64::tls_base_symbol_defined_): New field.
1664 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
1665 (Target_x86_64::Scan::global): Likewise.
1667 2008-04-16 Cary Coutant <ccoutant@google.com>
1669 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
1670 (Symbol::needs_plt_entry): Allow weak undefined symbols.
1671 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
1672 building shared libraries.
1673 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
1674 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
1675 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
1676 * testsuite/Makefile.in: Rebuild.
1677 * testsuite/weak_undef.h: New file.
1678 * testsuite/weak_undef_file1.cc: Add extra test cases.
1679 * testsuite/weak_undef_file2.cc: Likewise.
1680 * testsuite/weak_undef_test.cc: Likewise.
1682 2008-04-16 David S. Miller <davem@davemloft.net>
1684 * sparc.cc (Target_sparc::Scan): Change from struct to class.
1685 Add issued_non_pic_error_ field. Declare check_non_pic.
1686 (Target_sparc::Scan::check_non_pic): New function.
1687 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
1688 (Target_sparc::Scan::global): Likewise.
1690 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
1691 * configure: Rebuild.
1693 * options.h (DEFINE_enable): New macro.
1694 (new_dtags): New enable option.
1695 (initfirst, interpose, loadfltr, nodefaultlib,
1696 nodelete, nodlopen, nodump): New -z options.
1697 * layout.cc (Layout:finish_dynamic_section): If new
1698 dtags enabled, emit DT_RUNPATH. Also, emit a
1699 DT_FLAGS_1 containing any specified -z flags.
1701 2008-04-16 Ian Lance Taylor <iant@google.com>
1703 * copy-relocs.cc: New file.
1704 * copy-relocs.h: New file.
1705 * reloc.cc: Remove Copy_relocs code.
1706 * reloc.h: Likewise.
1707 * reloc-types.h (struct Reloc_types) [both versions]: Add
1708 get_reloc_addend_noerror.
1709 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
1710 variants of add_global which take an addend which must be zero.
1711 * i386.cc: Include "copy-relocs.h".
1712 (class Target_i386): Change type of copy_relocs_ to variable,
1714 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
1716 (Target_i386::do_finalize_sections): Change handling of
1718 * sparc.cc: Include "copy-relocs.h".
1719 (class Target_sparc): Change type of copy_relocs_ to variable,
1721 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
1723 (Target_sparc::do_finalize_sections): Change handling of
1725 * x86_64.cc: Include "copy-relocs.h".
1726 (class Target_x86_64): Change type of copy_relocs_ to variable,
1728 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
1729 class. Change all callers.
1730 (Target_x86_64::do_finalize_sections): Change handling of
1732 * Makefile.am (CCFILES): Add copy-relocs.cc.
1733 (HFILES): Add copy-relocs.h.
1735 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
1737 * testsuite/script_test_4.sh: Permit leading zeroes.
1739 2008-04-15 Ian Lance Taylor <iant@google.com>
1741 * script-sections.cc (Script_sections::create_segments): Use
1742 header_size_adjustment even when there is enough room for the
1744 * testsuite/script_test_4.sh: New file.
1745 * testsuite/script_test_4.t: New file.
1746 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
1747 (check_DATA): Add script_test_4.stdout.
1748 (MOSTLYCLEANFILES): Likewise.
1749 (script_test_4): New target.
1750 (script_test_4.stdout): New target.
1751 * testsuite/Makefile.in: Rebuild.
1753 * sparc.cc: Add definitions for Output_data_plt_sparc class
1756 2008-04-14 David S. Miller <davem@davemloft.net>
1758 * sparc.cc: New file.
1759 * Makefile.am (TARGETSOURCES): Add sparc.cc
1760 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
1761 * configure.tgt: Document targ_extra_size and
1762 targ_extra_big_endian. Add entries for sparc-* and
1764 * configure.ac: Handle targ_extra_size and
1765 targ_extra_big_endian.
1766 * Makefile.in: Rebuild.
1767 * configure: Likewise.
1768 * po/POTFILES.in: Likewise.
1769 * po/gold.pot: Likewise.
1771 2008-04-14 Ian Lance Taylor <iant@google.com>
1773 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
1774 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
1775 in the name/type/flags to section mapping. Don't call
1776 allocate_output_section.
1777 (Layout::choose_output_section): Change parameter from adjust_name
1778 to is_input_section. Don't permit input sections after sections
1779 are attached to segments. Don't call allocate_output_section.
1780 (Layout::layout_eh_frame): Call update_flags_for_input_section,
1781 not write_enable_output_section.
1782 (Layout::make_output_section): Don't push to
1783 unattached_section_list_ nor call attach_to_segment. Call
1784 attach_section_to_segment if sections are attached.
1785 (Layout::attach_sections_to_segments): New function.
1786 (Layout::attach_section_to_segment): New function.
1787 (Layout::attach_allocated_section_to_segment): Rename from
1788 attach_to_segment. Remove flags parameter.
1789 (Layout::allocate_output_section): Remove function.
1790 (Layout::write_enable_output_section): Remove function.
1791 * layout.h (class Layout): Update for above changes. Add new
1792 field sections_are_attached_.
1793 * output.h (Output_section::update_flags_for_input_section): New
1795 * output.cc (Output_section::add_input_section): Call
1796 update_flags_for_input_section.
1797 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
1799 2008-04-11 Cary Coutant <ccoutant@google.com>
1801 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
1802 thought unnecessary.
1803 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
1805 2008-04-11 Ian Lance Taylor <iant@google.com>
1807 * output.h (class Output_section_data): Remove inline definition
1809 * output.cc (Output_section_data::set_addralign): New function.
1811 2008-04-11 Cary Coutant <ccoutant@google.com>
1813 Add support for TLS descriptors for i386 and x86_64.
1814 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
1815 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
1816 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
1818 (Target_i386::got_mod_index_entry): Remove unnecessary code.
1819 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
1820 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
1822 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
1823 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
1824 Fix problem with initial-exec relocations.
1825 (Target_i386::Relocate::relocate_tls): Likewise.
1826 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
1828 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
1829 support for section-plus-offset dynamic table entries.
1830 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
1831 (Output_data_dynamic::Dynamic_entry): Add support for
1832 section-plus-offset dynamic table entries.
1833 (Output_data_dynamic::Classification): Likewise.
1834 (Output_data_dynamic::classification_): Renamed offset_.
1835 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
1836 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
1837 (Target_x86_64::make_plt_section): New function.
1838 (Target_x86_64::reserve_tlsdesc_entries): New function.
1839 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
1840 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
1841 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
1842 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
1843 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
1844 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
1845 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
1846 add extra PLT entry for TLS descriptors.
1847 (Output_data_plt_x86_64::got_): New field.
1848 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
1849 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
1851 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
1853 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
1854 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
1855 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
1856 R_386_TLS_DESC_CALL relocations.
1857 (Target_x86_64::Scan::global): Likewise.
1858 (Target_x86_64::do_finalize_sections): Add dynamic table entries
1859 for TLS descriptors.
1860 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
1861 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
1862 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
1863 GD-to-IE relaxation.
1864 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
1865 and TLS_DESCRIPTORS.
1866 * Makefile.in: Rebuild.
1867 * configure: Rebuild.
1868 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
1869 (tls_test_shared2.so): New target.
1870 (tls_shared_gd_to_ie_test_SOURCES): New variable.
1871 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
1872 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
1873 (tls_shared_gd_to_ie_test_LDADD): New variable.
1874 (tls_shared_gnu2_gd_to_ie_test): New target.
1875 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
1877 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
1878 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
1879 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
1880 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
1881 (tls_shared_gnu2_test): New target.
1882 (tls_test_gnu2_shared.so): New target.
1883 (tls_shared_gnu2_test_SOURCES): New variable.
1884 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
1885 (tls_shared_gnu2_test_LDFLAGS): New variable.
1886 (tls_shared_gnu2_test_LDADD): New variable.
1887 * testsuite/Makefile.in: Rebuild.
1888 * testsuite/Makefile.
1890 2008-04-11 Ian Lance Taylor <iant@google.com>
1892 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
1894 * testsuite/Makefile.in: Rebuild.
1896 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
1898 * testsuite/script_test_2.cc (main): Adjust test.
1900 2008-04-11 David S. Miller <davem@davemloft.net>
1901 Ian Lance Taylor <iant@google.com>
1903 * options.h (General_options): Add entries for '-Y' and
1905 * options.cc (General_options:finalize): If -Y was used, add those
1906 entries to the library path instead of the default "/lib" and
1909 2008-04-11 David S. Miller <davem@davemloft.net>
1911 * testsuite/justsyms.t: Start at 0x100.
1912 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
1913 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
1915 * testsuite/script_test_2.cc: Adjust string and section length
1918 2008-04-09 Ian Lance Taylor <iant@google.com>
1921 * script-sections.cc (Sections_element::allocate_to_segment): Add
1923 (Output_section_definition::allocate_to_segment): Likewise.
1924 (Orphan_output_section::allocate_to_segment): Likewise.
1925 (Script_sections::attach_sections_using_phdrs_clause): Don't
1926 propagate non-PT_LOAD segments to orphan sections.
1927 * testsuite/Makefile.am (script_test_3.stdout): Generate using
1928 readelf rather than objdump.
1929 * testsuite/script_test_3.sh: Adjust accordingly. Test that
1930 .interp section and PT_INTERP segment are the same size.
1931 * testsuite/Makefile.in: Rebuild.
1933 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
1934 aliases for symbols defined in the same object.
1935 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
1936 (weak_alias_test_SOURCES): New variable.
1937 (weak_alias_test_DEPENDENCIES): New variable.
1938 (weak_alias_test_LDFLAGS): New variable.
1939 (weak_alias_test_LDADD): New variable.
1940 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
1941 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
1942 (weak_alias_test_3.o): New target.
1943 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
1944 * testsuite/weak_alias_test_main.cc: New file.
1945 * testsuite/weak_alias_test_1.cc: New file.
1946 * testsuite/weak_alias_test_2.cc: New file.
1947 * testsuite/weak_alias_test_3.cc: New file.
1949 2008-04-08 Ian Lance Taylor <iant@google.com>
1951 * options.h (class General_options): Add --noinhibit-exec option.
1952 * main.cc (main): Check --noinhibit-exec.
1954 * options.h (class General_options): Define --wrap as a special
1955 option. Add wrap_symbols_ field.
1956 (General_options::any_wrap_symbols): New function.
1957 (General_options::is_wrap_symbol): New function.
1958 * options.cc (General_options::parse_wrap): New function.
1959 (General_options::General_options): Initialize wrap_symbols_.
1960 * symtab.cc (Symbol_table::wrap_symbol): New function.
1961 (Symbol_table::add_from_object): Handle --wrap.
1962 * symtab.h (class Symbol_table): Declare wrap_symbol.
1963 * target.h (Target::wrap_char): New function.
1964 (Target::Target_info): Add wrap_char field.
1965 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
1966 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1967 * testsuite/testfile.cc (Target_test::test_target_info):
1970 * errors.cc (Errors::undefined_symbol): Mention symbol version if
1973 * layout.h (class Layout): Add added_eh_frame_data_ field.
1974 * layout.cc (Layout::Layout): Initialize new field.
1975 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
1976 output section until we find a section we merged successfully.
1977 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
1978 that the size be non-zero.
1980 * merge.cc (Object_merge_map::get_output_offset): Remove inline
1983 2008-04-08 Craig Silverstein <csilvers@google.com>
1985 * configure.ac: Export new conditional variable HAVE_ZLIB.
1986 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
1988 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
1989 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
1991 2008-04-07 Ian Lance Taylor <iant@google.com>
1993 * version.cc (version_string): Set to "1.5".
1995 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
1996 Add issued_non_pic_error_ field. Declare check_non_pic.
1997 (Target_x86_64::Scan::check_non_pic): New function.
1998 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
1999 (Target_x86_64::Scan::global): Likewise.
2001 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
2002 addend parameter. Change caller. Handle merge sections.
2003 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
2004 Address to Addend. Don't add in the result of
2005 local_section_offset, pass down the addend and use the returned
2007 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
2008 Update declarations of local_section_offset and symbol_value.
2009 * testsuite/two_file_test_1.cc (t18): New function.
2010 * testsuite/two_file_test_2.cc (f18): New function.
2011 * testsuite/two_file_test_main.cc (main): Call t18.
2012 * testsuite/two_file_test.h (t18, f18): Declare.
2014 * configure.ac: Don't test for objdump, c++filt, or readelf.
2015 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
2017 (TEST_READELF): New variable.
2018 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
2019 (check_PROGRAMS): Add two_file_strip_test.
2020 (two_file_strip_test): New target.
2021 (check_PROGRAMS): Add two_file_same_shared_strip_test.
2022 (two_file_same_shared_strip_test_SOURCES): New variable.
2023 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
2024 (two_file_same_shared_strip_test_LDFLAGS): New variable.
2025 (two_file_same_shared_strip_test_LDADD): New variable.
2026 (two_file_shared_strip.so): New target.
2027 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
2028 (ver_test_5.syms, ver_test_7.syms): Likewise.
2029 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
2030 (strip_test_3.stdout): Use TEST_OBJDUMP.
2031 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
2033 2008-04-04 Cary Coutant <ccoutant@google.com>
2035 * symtab.h (Symbol::is_weak_undefined): New function.
2036 (Symbol::is_strong_undefined): New function.
2037 (Symbol::is_absolute): New function.
2038 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
2039 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
2041 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
2042 (weak_undef_test): New target.
2043 * testsuite/Makefile.in: Rebuild.
2044 * testsuite/weak_undef_file1.cc: New file.
2045 * testsuite/weak_undef_file2.cc: New file.
2046 * testsuite/weak_undef_test.cc: New file.
2048 2008-04-03 Craig Silverstein <csilvers@google.com>
2050 * compressed_output.h (class Output_compressed_section): Use
2052 * compressed_output.cc (zlib_compress): Use unsigned buffers,
2054 (zlib_compressed_suffix): Removed.
2055 (Output_compressed_section::set_final_data_size): Use unsigned
2057 * testsuite/Makefile.am (flagstest_compress_debug_sections):
2058 Fix linker invocation.
2059 (flagstest_o_specialfile_and_compress_debug_sections):
2061 * testsuite/Makefile.in: Regenerated.
2063 2008-04-02 David S. Miller <davem@davemloft.net>
2065 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
2066 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
2068 2008-04-02 Craig Silverstein <csilvers@google.com>
2072 2008-04-02 Ian Lance Taylor <iant@google.com>
2074 * fileread.cc (File_read::find_view): Add byteshift and vshifted
2075 parameters. Update for new key type to views_. Change all
2077 (File_read::read): Adjust for byteshift in returned view.
2078 (File_read::add_view): New function, broken out of
2080 (File_read::make_view): New function, broken out of
2082 (File_read::find_or_make_view): Add offset and aligned
2083 parameters. Rewrite accordingly. Change all callers.
2084 (File_read::get_view): Add offset and aligned parameters. Adjust
2085 for byteshift in return value.
2086 (File_read::get_lasting_view): Likewise.
2087 * fileread.h (class File_read): Update declarations.
2088 (class File_read::View): Add byteshift_ field. Add byteshift to
2089 constructor. Add byteshift method.
2090 * archive.h (Archive::clear_uncached_views): New function.
2091 (Archive::get_view): Add aligned parameter. Change all callers.
2092 * object.h (Object::get_view): Add aligned parameter. Change all
2094 (Object::get_lasting_view): Likewise.
2096 * fileread.cc (File_read::release): Don't call clear_views if
2097 there are multiple objects.
2098 * fileread.h (File_read::clear_uncached_views): New function.
2099 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
2102 2008-03-31 Cary Coutant <ccoutant@google.com>
2104 Add thin archive support.
2105 * archive.cc (Archive::armagt): New const.
2106 (Archive::setup): Remove task parameter and calls to unlock.
2107 (Archive::unlock_nested_archives): New function.
2108 (Archive::read_header): Add nested_off parameter. Change
2110 (Archive::interpret_header): Likewise.
2111 (Archive::include_all_members): Change to handle thin
2113 (Archive::include_member): Likewise.
2114 * archive.h (Archive::Archive): Add new parameters and
2116 (Archive::armagt): New const.
2117 (Archive::setup): Remove task parameter.
2118 (Archive::unlock_nested_archives): New function.
2119 (Archive::read_header): Add nested_off parameter.
2120 (Archive::interpret_header): Likewise.
2121 (Archive::Nested_archive_table): New typedef.
2122 (Archive::is_thin_archive_): New field.
2123 (Archive::nested_archives_): New field.
2124 (Archive::options_): New field.
2125 (Archive::dirpath_): New field.
2126 (Archive::task_): New field.
2127 * readsyms.cc (Read_symbols::do_read_symbols): Add check
2128 for thin archives. Pass additional parameters to
2129 Archive::Archive. Unlock the archive file after calling
2132 2008-03-29 Ian Lance Taylor <iant@google.com>
2134 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
2135 version symbol to be local.
2136 * testsuite/ver_test_4.sh: New file.
2137 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
2138 (check_DATA): Add ver_test_4.syms.
2139 (ver_test_4.syms): New target.
2140 * testsuite/Makefile.in: Rebuild.
2143 (Output_section::Input_section_sort_entry::has_priority): New
2145 (Output_section::Input_section_sort_entry::match_file_name): New
2147 (Output_section::Input_section_sort_entry::match_section_name):
2149 (Output_section::Input_section_sort_entry::match_section_name_prefix):
2151 (Output_section::Input_section_sort_entry::match_section_file):
2153 (Output_section::Input_section_sort_compare::operator()): Rewrite
2154 using new Input_section_sort_entry functions. Sort crtbegin and
2155 crtend first. Sort sections with no priority before sections with
2157 * testsuite/initpri1.c (d3): Check j != 4.
2158 (cd5): New constructor/destructor function.
2159 (main): Check j != 2.
2161 * symtab.cc (Symbol_table::add_from_object): If we don't use the
2162 new symbol when resolving, don't call set_is_default.
2163 * testsuite/ver_test_7.cc: New file.
2164 * testsuite/ver_test_7.sh: New file.
2165 * testsuite/Makefile.am (ver_test_7.so): New target.
2166 (ver_test_7.o): New target.
2167 (check_SCRIPTS): Add ver_test_7.sh.
2168 (check_DATA): Add ver_test_7.syms.
2169 (ver_test_7.syms): New target.
2171 2008-03-28 Ian Lance Taylor <iant@google.com>
2173 * layout.cc (Layout::layout): If we see an input section with a
2174 name that needs sorting, set the must_sort flag for the output
2176 (Layout::make_output_section): If the name of the output section
2177 indicates that it might require sorting, set the may_sort flag.
2178 * output.h (Output_section::may_sort_attached_input_sections): New
2180 (Output_section::set_may_sort_attached_input_sections): New
2182 (Output_section::must_sort_attached_input_sections): New
2184 (Output_section::set_must_sort_attached_input_sections): New
2186 (class Output_section): Declare Input_section_sort_entry. Define
2187 Input_section_sort_compare. Declare
2188 sort_attached_input_sections. Add new fields:
2189 may_sort_attached_input_sections_,
2190 must_sort_attached_input_sections_,
2191 attached_input_sections_are_sorted_.
2192 * output.cc (Output_section::Output_section): Initialize new
2194 (Output_section::add_input_section): Add an entry to
2195 input_sections_ if may_sort or must_sort are true.
2196 (Output_section::set_final_data_size): Call
2197 sort_attached_input_sections if necessary.
2198 (Output_section::Input_section_sort_entry): Define new class.
2199 (Output_section::Input_section_sort_compare::operator()): New
2201 (Output_section::sort_attached_input_sections): New function.
2202 * configure.ac: Check whether the compiler supports constructor
2203 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
2204 * testsuite/initpri1.c: New file.
2205 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
2206 CONSTRUCTOR_PRIORITY.
2207 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
2208 (initpri1_LDFLAGS): New variable.
2209 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
2211 2008-03-27 Ian Lance Taylor <iant@google.com>
2213 * common.cc (Sort_commons::operator): Correct sorting algorithm.
2214 * testsuite/common_test_1.c: New file.
2215 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
2216 (common_test_1_SOURCES): New variable.
2217 (common_test_1_DEPENDENCIES): New variable.
2218 (common_test_1_LDFLAGS): New variable.
2220 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
2221 and commons_ correctly when NAME/VERSION does not override
2223 * testsuite/ver_test_6.c: New file.
2224 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
2225 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
2226 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
2228 2008-03-26 Ian Lance Taylor <iant@google.com>
2230 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
2231 of an undefined symbol from a version script.
2232 * testsuite/Makefile.am (ver_test_5.so): New target.
2233 (ver_test_5.o): New target.
2234 (check_SCRIPTS): Add ver_test_5.sh.
2235 (check_DATA): Add ver_test_5.syms.
2236 (ver_test_5.syms): New target.
2237 * testsuite/ver_test_5.cc: New file.
2238 * testsuite/ver_test_5.script: New file.
2239 * testsuite/ver_test_5.sh: New file.
2240 * Makefile.in, testsuite/Makefile.in: Rebuild.
2243 Fix problems building gold with gcc 4.3.0.
2244 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
2245 (gold_error_at_location, gold_warning_at_location): Use it.
2246 * configure.ac: Check whether we can compile and use a template
2247 function with a printf attribute.
2248 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
2249 when jumping over bytes.
2250 * object.cc: Instantiate Object::read_section_data.
2251 * debug.h: Include <cstring>
2252 * dwarf_reader.cc: Include <algorithm>
2253 * main.cc: Include <cstring>.
2254 * options.cc: Include <cstring>.
2255 * output.cc: Include <cstring>.
2256 * script.cc: Include <cstring>.
2257 * script.h: Include <string>.
2258 * symtab.cc: Include <cstring> and <algorithm>.
2259 * target-select.cc: Include <cstring>.
2260 * version.cc: Include <string>.
2261 * testsuite/testmain.cc: Include <cstdlib>.
2262 * configure, config.in: Rebuild.
2264 2008-03-25 Ian Lance Taylor <iant@google.com>
2266 * options.cc: Include "../bfd/bfdver.h".
2267 (options::help): Print bug reporting address.
2269 * version.cc (print_version): Adjust output for current value of
2274 * options.cc (options::help): Print list of supported targets.
2275 * target-select.h: Include <vector>.
2276 (class Target_selector): Make machine_, size_, and is_big_endian_
2277 fields const. Add bfd_name_ and instantiated_target_ fields.
2278 (Target_selector::Target_selector): Add bfd_name parameter.
2279 (Target_selector::recognize): Make non-virtual, call
2281 (Target_selector::recognize_by_name): Make non-virtual, call
2282 do_recognize_by_name.
2283 (Target_selector::supported_names): New function.
2284 (Target_selector::bfd_name): New function.
2285 (Target_selector::do_instantiate_target): New pure virtual
2287 (Target_selector::do_recognize): New virtual function.
2288 (Target_selector::do_recognize_by_name): New virtual function.
2289 (Target_selector::instantiate_target): New private function.
2290 (supported_target_names): Declare.
2291 * target-select.cc (Target_selector::Target_selector): Update for
2292 new parameter and fields.
2293 (select_target_by_name): Check that the name matches before
2294 calling recognize_by_name.
2295 (supported_target_names): New function.
2296 * i386.cc (class Target_selector_i386): Update Target_selector
2297 constructor call. Remove recognize and recognize_by_name. Add
2298 do_instantiate_target.
2299 * x86_64.cc (class Target_selector_x86_64): Likewise.
2300 * testsuite/testfile.cc (class Target_selector_test): Update for
2301 changes to Target_selector.
2303 * README: Rewrite, with some notes on unsupported features.
2305 2008-03-24 Cary Coutant <ccoutant@google.com>
2307 * i386.cc (Target_i386::Got_type): New enum declaration.
2308 (Target_i386::Scan::local): Updated callers of Output_data_got
2310 (Target_i386::Scan::global): Likewise.
2311 (Target_i386::Relocate::relocate): Likewise.
2312 (Target_i386::Relocate::relocate_tls): Likewise.
2313 * object.h (Got_offset_list): New class.
2314 (Sized_relobj::local_has_got_offset): Added got_type parameter.
2315 (Sized_relobj::local_got_offset): Likewise.
2316 (Sized_relobj::set_local_got_offset): Likewise.
2317 (Sized_relobj::local_has_tls_got_offset): Removed.
2318 (Sized_relobj::local_tls_got_offset): Removed.
2319 (Sized_relobj::set_local_tls_got_offset): Removed.
2320 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
2321 * output.cc (Output_data_got::add_global): Added got_type parameter.
2322 (Output_data_got::add_global_with_rel): Likewise.
2323 (Output_data_got::add_global_with_rela): Likewise.
2324 (Output_data_got::add_global_pair_with_rel): New function.
2325 (Output_data_got::add_global_pair_with_rela): New function.
2326 (Output_data_got::add_local): Added got_type parameter.
2327 (Output_data_got::add_local_with_rel): Likewise.
2328 (Output_data_got::add_local_with_rela): Likewise.
2329 (Output_data_got::add_local_pair_with_rel): New function.
2330 (Output_data_got::add_local_pair_with_rela): New function.
2331 (Output_data_got::add_global_tls): Removed.
2332 (Output_data_got::add_global_tls_with_rel): Removed.
2333 (Output_data_got::add_global_tls_with_rela): Removed.
2334 (Output_data_got::add_local_tls): Removed.
2335 (Output_data_got::add_local_tls_with_rel): Removed.
2336 (Output_data_got::add_local_tls_with_rela): Removed.
2337 * output.h (Output_data_got::add_global): Added got_type parameter.
2338 (Output_data_got::add_global_with_rel): Likewise.
2339 (Output_data_got::add_global_with_rela): Likewise.
2340 (Output_data_got::add_global_pair_with_rel): New function.
2341 (Output_data_got::add_global_pair_with_rela): New function.
2342 (Output_data_got::add_local): Added got_type parameter.
2343 (Output_data_got::add_local_with_rel): Likewise.
2344 (Output_data_got::add_local_with_rela): Likewise.
2345 (Output_data_got::add_local_pair_with_rel): New function.
2346 (Output_data_got::add_local_pair_with_rela): New function.
2347 (Output_data_got::add_global_tls): Removed.
2348 (Output_data_got::add_global_tls_with_rel): Removed.
2349 (Output_data_got::add_global_tls_with_rela): Removed.
2350 (Output_data_got::add_local_tls): Removed.
2351 (Output_data_got::add_local_tls_with_rel): Removed.
2352 (Output_data_got::add_local_tls_with_rela): Removed.
2353 * resolve.cc (Symbol::override_base_with_special): Removed
2354 reference to has_got_offset_ field.
2355 * symtab.cc (Symbol::init_fields): Replaced initialization
2356 of got_offset_ with got_offsets_. Removed initialization
2358 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
2359 (Symbol::got_offset): Likewise.
2360 (Symbol::set_got_offset): Likewise.
2361 (Symbol::has_tls_got_offset): Removed.
2362 (Symbol::tls_got_offset): Removed.
2363 (Symbol::set_tls_got_offset): Removed.
2364 (Symbol::got_offset_): Removed.
2365 (Symbol::tls_mod_got_offset_): Removed.
2366 (Symbol::tls_pair_got_offset_): Removed.
2367 (Symbol::got_offsets_): New field.
2368 (Symbol::has_got_offset): Removed.
2369 (Symbol::has_tls_mod_got_offset): Removed.
2370 (Symbol::has_tls_pair_got_offset): Removed.
2371 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
2372 (Target_x86_64::Scan::local): Updated callers of Output_data_got
2374 (Target_x86_64::Scan::global): Likewise.
2375 (Target_x86_64::Relocate::relocate): Likewise.
2376 (Target_x86_64::Relocate::relocate_tls): Likewise.
2378 2008-03-25 Ben Elliston <bje@au.ibm.com>
2380 * yyscript.y: Fix spelling error in comment.
2382 2008-03-24 Ian Lance Taylor <iant@google.com>
2384 * options.h (class General_options): Define build_id option.
2385 * layout.h (class Layout): Declare write_build_id, create_note,
2386 create_build_id. Add build_id_note_ member.
2387 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
2388 "libiberty.h", "md5.h", "sha1.h".
2389 (Layout::Layout): Initialize eh_frame_data_,
2390 eh_frame_hdr_section_, and build_id_note_.
2391 (Layout::finalize): Call create_build_id.
2392 (Layout::create_note): New function, broken out of
2393 Layout::create_gold_note.
2394 (Layout::create_gold_note): Call create_note.
2395 (Layout::create_build_id): New function.
2396 (Layout::write_build_id): New function.
2397 (Close_task_runner::run): Call write_build_id.
2399 * x86_64.cc: Correct license to GPLv3.
2401 2008-03-23 Ian Lance Taylor <iant@google.com>
2403 * options.cc: Include "demangle.h".
2404 (parse_optional_string): New function.
2405 (parse_long_option): Handle takes_optional_argument.
2406 (parse_short_option): Update dash_z initializer. Handle
2407 takes_optional_argument.
2408 (General_options::General_options): Initialize do_demangle_.
2409 (General_options::finalize): Set do_demangle_. Handle demangling
2411 * options.h (parse_optional_string): Declare.
2412 (struct One_option): Add optional_arg field. Update constructor.
2413 Update call constructor calls. Add takes_optional_argument
2415 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
2416 (DEFINE_optional_string): Define.
2417 (General_options::demangle): Change from DEFINE_bool to
2418 DEFINE_optional_string.
2419 (General_options::no_demangle): New function.
2420 (General_options::do_demangle): New function.
2421 (General_options::set_do_demangle): New function.
2422 (General_options::execstack_status_): Move definition to end of
2424 (General_options::static_): Likewise.
2425 (General_options::do_demangle_): New field.
2426 * object.cc (big_endian>::get_symbol_location_info): Call
2427 Options::do_demangle, not Options::demangle.
2428 * symtab.cc (demangle): Likewise.
2430 2008-03-22 Ian Lance Taylor <iant@google.com>
2432 * gold.h: Include <cstddef> and <sys/types.h>
2433 * options.h: Include <cstring>.
2435 2008-03-21 Ian Lance Taylor <iant@google.com>
2437 * Added source code to GNU binutils.