1 2009-03-13 Ian Lance Taylor <iant@google.com>
3 * fileread.cc (Input_file::open): Remove options parameter.
5 (Input_file::open_binary): Likewise.
6 * script.cc (read_input_script): Likewise.
7 * readsyms.h (class Read_symbols): Remove options_ field. Remove
8 options parameter from constructor. Change all callers.
9 (class Read_script): Likewise.
10 * fileread.h (class Input_file): Update declarations.
11 * script.h (read_input_script): Update declaration.
13 2009-03-10 Nick Clifton <nickc@redhat.com>
15 * po/es.po: New Spanish translation.
17 2009-03-06 Cary Coutant <ccoutant@google.com>
19 * options.cc (parse_short_option): Keep dash_z from registering itself.
21 2009-03-03 Ian Lance Taylor <iant@google.com>
24 * target-reloc.h (relocate_section): Pass output_section to
26 * i386.cc (Target_i386::should_apply_static_reloc): Add
27 output_section parameter. Change all callers.
28 (Target_i386::Relocate::relocate): Add output_section parameter.
29 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
30 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
31 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
32 * testsuite/two_file_shared.sh: New script.
33 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
34 (check_DATA): Add two_file_shared.dbg.
35 (two_file_shared.dbg): New target.
36 * testsuite/Makefile.in: Rebuild.
38 2009-03-01 Ian Lance Taylor <iant@google.com>
40 * configure.ac: Check for byteswap.h.
44 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
46 * layout.cc (Layout::find_or_add_kept_section): New function.
47 (Layout::add_comdat): Removed.
48 * layout.h (struct Kept_section): Move out of class Layout.
49 Remove trailing underscores from field names. Add group_sections
50 field. Rename group_ field to is_group. Change all uses.
51 (class Layout): Declare find_or_add_kept_section, not add_comdat.
52 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
54 (Sized_relobj::include_section_group): Use
55 find_or_add_kept_section and Kept_section::group_sections.
56 (Sized_relobj::include_linkonce_section): Likewise.
57 * object.cc (class Sized_relobj): Don't define Comdat_group or
58 Comdat_group_table. Remove find_comdat_group and
59 add_comdat_group. Remove comdat_groups_ field.
60 * plugin.cc (include_comdat_group): Use
61 Layout::find_or_add_kept_section.
63 2009-02-28 Ian Lance Taylor <iant@google.com>
65 * README: --gc-sections and map files are now supported. Document
66 some build requirements.
69 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
70 relocatable link set the value of the section symbol to zero.
71 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
72 relocatable link don't include the section address in the local
75 2009-02-27 Ian Lance Taylor <iant@google.com>
78 * options.h (class Search_directory): Add is_system_directory.
79 (class General_options): Declare is_in_system_directory.
80 * options.cc (get_relative_sysroot): Make static.
81 (get_default_sysroot): Make static.
82 (General_optoins::is_in_system_directory): New function.
83 * fileread.cc (Input_file::is_in_system_directory): New function.
84 * fileread.h (class Input_file): Declare is_in_system_directory.
85 * object.h (class Object): Add is_in_system_directory.
86 (class Input_objects): Remove system_library_directory_ field.
87 * object.cc (Input_objects::add_object): Don't set
88 system_library_directory_.
89 (input_objects::found_in_system_library_directory): Remove.
90 * symtab.cc (Symbol_table::write_globals): Remove input_objects
91 parameter. Change all callers.
92 (Symbol_table::sized_write_globals): Likewise.
93 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
94 Call Object::is_in_system_directory.
95 * symtab.h (class Symbol_table): Update declarations.
98 * descriptors.h (Open_descriptor): Add is_on_stack field.
99 * descriptors.cc (Descriptors::open): If the descriptor is on the
100 top of the stack, remove it. Initialize is_on_stack field.
101 (Descriptors::release): Only add pod to stack if it is not on the
103 (Descriptors::close_some_descriptor): Clear stack_next and
107 * output.cc (Output_section::find_starting_output_address): Rename
108 from starting_output_address; add PADDR parameter; change return
110 * output.h (class Output_section): Declare
111 find_starting_output_address instead of starting_output_address.
112 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
113 section symbol for which we can't find a merge section.
116 * symtab.cc (Symbol_table::add_from_object): If the visibility is
117 hidden or internal, force the symbol to be local.
118 * resolve.cc (Symbol::override_visibility): Define.
119 (Symbol::override_base): Use override_visibility.
120 (Symbol_table::resolve): Likewise.
121 (Symbol::override_base_with_special): Likewise.
122 (Symbol_table::override_with_special): If the visibility is hidden
123 or internal, force the symbol to be local.
124 * symtab.h (class Symbol): Add set_visibility and
126 * testsuite/ver_test_1.sh: New file.
127 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
128 (check_DATA): Add ver_test_1.syms.
129 (ver_test_1.syms): New target.
130 * testsuite/Makefile.in: Rebuild.
132 2009-02-25 Cary Coutant <ccoutant@google.com>
134 * layout.cc (Layout::choose_output_section): Don't rename sections
135 when using a linker script that has a SECTIONS clause.
136 * Makefile.in: Regenerate.
138 * testsuite/Makefile.am (script_test_5.sh): New test case.
139 * testsuite/Makefile.in: Regenerate.
140 * testsuite/script_test_5.cc: New file.
141 * testsuite/script_test_5.sh: New file.
142 * testsuite/script_test_5.t: New file.
144 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
146 * archive.cc (Archive::include_member): Update calls to add_symbols.
147 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
149 * dynobj.h (do_add_symbols): Add the Layout argument.
150 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
152 * object.h (Object::add_symbols): Add the Layout argument.
153 (Object::do_add_symbols): Add the Layout argument.
154 (Sized_relobj::do_add_symbols): Add the Layout argument.
155 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
156 Unify the two versions.
157 (Add_plugin_symbols): Remove.
158 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
159 (Sized_pluginobj::do_add_symbols): Unify the two versions.
160 (Add_plugin_symbols): Remove.
161 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
162 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
163 (Add_symbols::run): Make it work with Pulginobj.
165 2009-02-06 Ian Lance Taylor <iant@google.com>
167 * object.cc (Sized_relobj::do_layout): Make info message start
168 with lower case letter.
170 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
172 * binary.cc: Fix file comment.
174 * options.h (enum Incremental_disposition): Define.
175 (class General_options): Add new options: --incremental,
176 --incremental_changed, --incremental_unchanged,
177 --incremental_unknown. Add incremental_disposition_ and
178 implicit_incremental_ fields.
179 (General_options::incremental_disposition): New function.
180 (class Position_dependent_options): Add incremental_disposition
182 (Position_dependent_options::copy_from_options): Set incremental
184 * options.cc (General_options::parse_incremental_changed): New
186 (General_options::parse_incremental_unchanged): New function.
187 (General_options::parse_incremental_unknown): New function.
188 (General_options::General_options): Initialize new fields
189 incremental_disposition_ and implicit_incremental_.
190 (General_options::finalize): Check for uasge of --incremental-*
191 without --incremental.
193 2009-02-06 Chris Demetriou <cgd@google.com>
195 * gold.h (gold_undefined_symbol): Change to take only a Symbol
196 pointer and to report location as the file name associated with
198 (gold_undefined_symbol_at_location): New function to replace the
199 old gold_undefined_symbol functionality.
200 * target-reloc.h (relocate_section): Update to use
201 gold_undefined_symbol_at_location.
202 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
203 Call gold_undefined_symbol function rather than gold_error.
204 * errors.h (Errors::undefined_symbol): Take location as a
205 string, rather than calculating it from a relocation.
206 * errors.cc (Errors::fatal): Print "fatal error:" before the
208 (Errors::error, Errors::error_at_location): Print "error: "
209 before the formatted message.
210 (Errors::undefined_symbol): Take location as a string, rather
211 than calculating it from a relocation.
212 (gold_undefined_symbol_at_location): New function akin to
213 old gold_undefined_symbol, calculates location from relocation.
214 (gold_undefined_symbol): Change to take only a Symbol pointer
215 and to report location as the file name associated with the symbol.
216 * testsuite/debug_msg.sh: Update for changed error messages.
217 * testsuite/undef_symbol.sh: Likewise.
219 2009-02-04 Duncan Sands <baldrick@free.fr>
222 * reduced_debug_output.h
223 (Output_reduced_debug_abbrev_section::failed): Use format for
225 (Output_reduced_debug_info_section::faild): Likewise.
227 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
229 * script.cc (Lazy_demangler): New class.
230 (Version_script_info::get_symbol_version_helper): Demangle a
233 2009-01-29 Cary Coutant <ccoutant@google.com>
235 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
237 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
239 2009-01-28 Ian Lance Taylor <iant@google.com>
241 * version.cc (version_string): Bump to 1.9.
243 * gold.h: Include <cstring> and <stdint.h>.
244 * version.cc: Include <cstdio>.
245 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
247 * reduced_debug_output.cc (insert_into_vector): Rename from
248 Insert_into_vector; change all callers. Use Swap_unaligned to
249 avoid aliasing issue; remove union since it is unnecessary.
251 2009-01-27 Sriraman Tallam <tmsriram@google.com>
253 * Makefile.am (CCFILES): Add gc.cc.
255 * Makefile.in: Regenerate.
256 * gold.cc (Gc_runner): New class.
257 (queue_initial_tasks): Call garbage collection related tasks
258 when corresponding options are invoked.
259 (queue_middle_gc_tasks): New function.
260 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
261 processed early before laying out sections during garbage collection.
262 * gold.h (queue_middle_gc_tasks): New function.
263 (is_prefix_of): Move from "layout.cc".
264 * i386.cc (Target_i386::gc_process_relocs): New function.
265 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
266 * main.cc (main): Create object of class "Garbage_collection".
267 * object.cc (Relobj::copy_symbols_data): New function.
268 (Relobj::is_section_name_included): New function.
269 (Sized_relobj::do_layout): Allow this function to be called twice
270 during garbage collection and defer layout of section during the
272 * object.h (Relobj::get_symbols_data): New function.
273 (Relobj::is_section_name_included): New function.
274 (Relobj::copy_symbols_data): New function.
275 (Relobj::set_symbols_data): New function.
276 (Relobj::get_relocs_data): New function.
277 (Relobj::set_relocs_data): New function.
278 (Relobj::is_output_section_offset_invalid): New pure virtual function.
279 (Relobj::gc_process_relocs): New function.
280 (Relobj::do_gc_process_relocs): New pure virtual function.
281 (Relobj::sd_): New data member.
282 (Sized_relobj::is_output_section_offset_invalid): New function.
283 (Sized_relobj::do_gc_process_relocs): New function.
284 * options.h (General_options::gc_sections): Modify to not be a no-op.
285 (General_options::print_gc_sections): New option.
286 * plugin.cc (Plugin_finish::run): Remove function call to
287 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
288 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
289 * reloc.cc (Read_relocs::run): Add task to process relocs and
290 determine unreferenced sections when doing garbage collection.
291 (Gc_process_relocs): New class.
292 (Sized_relobj::do_gc_process_relocs): New function.
293 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
294 sections that are garbage collected.
295 * reloc.h (Gc_process_relocs): New class.
296 * sparc.cc (Target_sparc::gc_process_relocs): New function.
297 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
298 symbols whose corresponding sections are garbage collected.
299 (Symbol_table::Symbol_table): Add new parameter for the garbage
301 (Symbol_table::gc_mark_undef_symbols): New function.
302 (Symbol_table::gc_mark_symbol_for_shlib): New function.
303 (Symbol_table::gc_mark_dyn_syms): New function.
304 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
306 (Symbol_table::add_from_object): Likewise.
307 (Symbol_table::add_from_relobj): When building shared objects, do not
308 treat externally visible symbols as garbage.
309 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
310 table information for static and relocatable links.
311 * symtab.h (Symbol_table::set_gc): New function.
312 (Symbol_table::gc): New function.
313 (Symbol_table::gc_mark_undef_symbols): New function.
314 (Symbol_table::gc_mark_symbol_for_shlib): New function.
315 (Symbol_table::gc_mark_dyn_syms): New function.
316 (Symbol_table::gc_): New data member.
317 * target.h (Sized_target::gc_process_relocs): New pure virtual
319 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
320 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
322 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
324 * options.h (General_options::gc_sections): Define as a no-op for now.
325 (General_options::no_keep_memory): Ditto.
326 (General_options::Bshareable): Define.
327 * options.cc (General_options::finalize): Honor -Bshareable.
329 2009-01-20 Andreas Schwab <schwab@suse.de>
331 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
332 read the value in the contents, since we don't use it. Use the
333 template endianness when writing.
334 (Relocate::relocate): Use it for R_PPC_REL16_HA.
336 2009-01-19 Andreas Schwab <schwab@suse.de>
338 * configure.tgt (powerpc64-*): Fix targ_obj.
340 2009-01-15 Ian Lance Taylor <iant@google.com>
342 * object.cc (Sized_relobj::write_local_symbols): Don't write out
343 local symbols when stripping all symbols.
345 2009-01-14 Cary Coutant <ccoutant@google.com>
347 * output.cc (Output_reloc): Add explicit instantiations.
349 2009-01-14 Cary Coutant <ccoutant@google.com>
351 * archive.cc (Archive::get_elf_object_for_member): Remove call
352 to File_read::claim_for_plugin.
353 * descriptors.cc (Descriptors::open): Remove reference to
355 (Descriptors::claim_for_plugin): Remove.
356 * descriptors.h (Descriptors::claim_for_plugin): Remove.
357 (Descriptors::is_claimed): Remove.
358 (claim_descriptor_for_plugin): Remove.
359 * fileread.cc (File_read::claim_for_plugin): Remove.
360 * fileread.h (File_read::claim_for_plugin): Remove.
361 (File_read::descriptor): Reopen descriptor if necessary.
362 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
363 (Plugin_manager::all_symbols_read): Add task parameter. Change
365 (Plugin_manager::get_input_file): New function.
366 (Plugin_manager::release_input_file): New function.
367 (Pluginobj::Pluginobj): Add filesize parameter and initialize
368 corresponding data member.
369 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
370 and pass to base constructor. Change all callers.
371 (get_input_file, release_input_file): New functions.
372 (make_sized_plugin_object): Add filesize parameter. Change all callers.
373 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
374 (Plugin_manager::all_symbols_read): Add task parameter.
375 (Plugin_manager::get_input_file): New function.
376 (Plugin_manager::release_input_file): New function.
377 (Plugin_manager::task_): New data member.
378 (Pluginobj::Pluginobj): Add filesize parameter.
379 (Pluginobj::filename): New function.
380 (Pluginobj::descriptor): New function.
381 (Pluginobj::filesize): New function.
382 (Pluginobj::filesize_): New data member.
383 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
384 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
385 File_read::claim_for_plugin; use Object::unlock to unlock the file.
387 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
388 with archive libraries.
389 * testsuite/Makefile.in: Regenerate.
390 * testsuite/plugin_test.c (struct sym_info): New type.
391 (get_input_file, release_input_file): New static variables.
392 (onload): Capture new transfer vector entries.
393 (claim_file_hook): Stop reading at end of file according to filesize.
394 Factor out parsing of readelf output into separate function.
395 (all_symbols_read_hook): Exercise get_input_file and release_input_file
396 APIs and get the source file name from the symbol table. Convert
397 source file name to corresponding object file name. Print info
398 message when adding new input files.
399 (parse_readelf_line): New function.
400 * testsuite/plugin_test_1.sh: Add checks for new info messages.
401 * testsuite/plugin_test_2.sh: Likewise.
402 * testsuite/plugin_test_3.sh: Likewise.
403 * testsuite/plugin_test_4.sh: New test case.
405 2009-01-07 Ian Lance Taylor <iant@google.com>
407 * version.cc (version_string): Bump to 1.8.
409 2008-12-23 Cary Coutant <ccoutant@google.com>
411 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
412 * plugin.cc (Plugin_manager::finish): Rename as
413 layout_deferred_objects. Move cleanup to separate function.
414 (Plugin_manager::cleanup): New function.
415 (Plugin_finish::run): Call layout_deferred_objects and cleanup
417 * plugin.h (Plugin_manager::finish): Rename as
418 layout_deferred_objects.
419 (Plugin_manager::cleanup): New function.
420 (Plugin_manager::cleanup_done): New field.
422 2008-12-23 Cary Coutant <ccoutant@google.com>
424 * plugin.cc (is_visible_from_outside): New function.
425 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
426 so we don't return "IR only" status for exported symbols or -r links.
428 * testsuite/Makefile.am (plugin_test_3): New test case.
429 * testsuite/Makefile.in: Regenerate.
430 * testsuite/plugin_test_3.sh: New file.
432 2008-12-22 Cary Coutant <ccoutant@google.com>
434 * object.cc (Sized_relobj::layout_section): New function.
435 (Sized_relobj::do_layout): Defer layout of input sections until after
436 plugin has provided replacement files.
437 (Sized_relobj::do_layout_deferred_sections): New function.
438 * object.h (Relobj::set_section_offset): Remove virtual keyword.
439 (Relobj::layout_deferred_sections): New function.
440 (Relobj::do_layout_deferred_sections): New function.
441 (Sized_relobj::do_layout_deferred_sections): New function.
442 (Sized_relobj::layout_section): New function.
443 (Sized_relobj::Deferred_layout): New structure.
444 (Sized_relobj::deferred_layout_): New field.
445 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
446 Change all callers. Layout deferred sections.
447 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
449 (Plugin_hook::run): Move code from do_plugin_hook inline.
450 (Plugin_hook::do_plugin_hook): Remove.
451 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
452 (Plugin_manager::finish): Renamed, was cleanup.
453 (Plugin_manager::should_defer_layout): New function.
454 (Plugin_manager::add_deferred_layout_object): New function.
455 (Plugin_manager::Deferred_layout_list): New type.
456 (Plugin_manager::deferred_layout_objects_): New field.
457 (Plugin_hook::do_plugin_hook): Remove.
459 2008-12-17 Ian Lance Taylor <iant@google.com>
461 * options.h (class General_options): Add --no case for
464 2008-12-16 Cary Coutant <ccoutant@google.com>
466 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
468 (Plugin_manager::claim_file): Create plugin object even if
469 plugin did not call the add_symbols callback.
470 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
471 asking for more symbols than were added.
472 * testsuite/Makefile.am (plugin_test_1): Add test case with
474 (empty.syms): New target.
475 * testsuite/Makefile.in: Regenerate.
476 * testsuite/plugin_test.c (claim_file_hook): Add new debug
477 message. Don't call add_symbols if no globals.
478 (all_symbols_read_hook): Don't provide replacement for empty
481 2008-12-12 Ian Lance Taylor <iant@google.com>
483 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
484 r_type == 0 for a local symbol with r_sym == 0.
485 (scan_relocatable_relocs): Pass r_sym to
486 local_non_section_strategy.
487 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
490 * configure.ac: Update test for TLS descriptors: they are
491 supported as of glibc 2.9.
492 * configure: Rebuild.
494 2008-12-11 Ian Lance Taylor <iant@google.com>
497 * target-reloc.h (Default_scan_relocatable_relocs): For each
498 function, map r_type == 0 to RELOC_DISCARD.
500 2008-12-10 Cary Coutant <ccoutant@google.com>
502 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
503 object to override a kept COMDAT group from a plugin object.
505 2008-12-09 Ian Lance Taylor <iant@google.com>
508 * yyscript.y (file_cmd): Handle INPUT.
510 * testsuite/initpri1.c: Change all declarations to be full
511 prototypes by adding void, to avoid compiler warnings.
513 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
515 * options.cc (General_options::parse_plugin_opt): New.
516 (General_options::add_plugin): The argument now is just the filename.
517 (General_options::add_plugin_option): New.
518 * options.h (plugin_opt): New.
519 (add_plugin): Change argument name.
520 (add_plugin_option): New.
521 * plugin.cc (Plugin::load): Don't parse the plugin option.
522 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
523 (Plugin::add_option): New.
524 (Plugin::args_): Change type.
525 (Plugin::filename_): New.
526 (Plugin_manager::add_plugin_option): New.
527 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
528 * testsuite/Makefile.in: Regenerate.
530 2008-12-05 Cary Coutant <ccoutant@google.com>
532 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
533 Handle --strip-lto-sections option.
534 * options.h (strip_lto_sections): New option.
536 2008-12-01 Cary Coutant <ccoutant@google.com>
538 * plugin.cc (ld_plugin_message): Change format parameter to const.
539 Fix mismatch between new[] and delete.
541 2008-11-14 Cary Coutant <ccoutant@google.com>
543 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
546 2008-11-05 Craig Silverstein <csilvers@google.com>
548 * options.cc (General_options::parse_dynamic_list): New function.
549 * options.h (General_options): New flags dynamic_list,
550 dynamic_list_data, dynamic_list_cpp_new, and
551 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
552 (General_options::in_dynamic_list): New function.
553 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
554 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
555 (Lex::can_continue_name): Likewise.
557 (read_script_file): New parameter script_options.
558 (read_dynamic_list): New function.
559 (Script_options::define_dynamic_list): New function.
560 (dynamic_list_keyword_parsecodes): New variable.
561 (dynamic_list_keywords): New variable.
562 * script.h (Script_options::define_dynamic_list): New function
564 (read_dynamic_list): New function prototype.
565 * symtab.cc (strprefix): New macro.
566 (Symbol::should_add_dynsym_entry): Support dynamic_list,
567 dynamic_list_data, dynamic_list_cpp_new, and
568 dynamic_list_cpp_typeinfo.
569 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
570 (dynamic_list_expr): New rule.
571 (dynamic_list_nodes): Likewise.
572 (dynamic_list_node): Likewise.
573 * testsuite/Makefile.am (dynamic_list): New test.
574 * testsuite/Makefile.in: Regenerated.
575 * testsuite/dynamic_list.t: New file.
576 * testsuite/dynamic_list.sh: New file.
578 2008-11-05 Craig Silverstein <csilvers@google.com>
580 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
581 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
582 (t11_last): Likewise.
583 * testsuite/ver_test_6.c (main): Likewise.
585 2008-10-07 Cary Coutant <ccoutant@google.com>
587 * options.c (General_options::finalize): Add check for -static and
589 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
592 2008-10-02 Cary Coutant <ccoutant@google.com>
594 * plugin.cc (make_sized_plugin_object): Fix conditional
595 compilation to work when not all targets are enabled.
597 2008-09-29 Cary Coutant <ccoutant@google.com>
599 * archive.cc (Archive::get_file_and_offset): Use filename instead
600 of name to get library path.
601 (Archive::include_member): Unlock external member of a thin archive.
603 * testsuite/Makefile.am (TEST_AR): New variable.
604 (thin_archive_test_1): New test.
605 (thin_archive_test_2): New test.
606 * testsuite/Makefile.in: Regenerate.
607 * testsuite/thin_archive_main.cc: New file.
608 * testsuite/thin_archive_test_1.cc: New file.
609 * testsuite/thin_archive_test_2.cc: New file.
610 * testsuite/thin_archive_test_3.cc: New file.
611 * testsuite/thin_archive_test_4.cc: New file.
613 2008-09-29 Cary Coutant <ccoutant@google.com>
615 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
616 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
618 (Sized_relobj::do_finalize_local_symbols): Likewise.
619 (Sized_relobj::map_to_kept_section): Likewise.
620 * object.h (Sized_relobj::invalid_address): New constant.
621 (Sized_relobj::do_output_section_offset): Check for invalid_address
623 * output.cc (Output_reloc::local_section_offset): Use constant
624 invalid_address instead of -1U.
625 (Output_reloc::get_address): Likewise.
626 (Output_section::output_address): Change -1U to -1ULL.
627 * output.h (Output_reloc::invalid_address): New constant.
628 * reloc.cc (Sized_relobj::write_sections): Use constant
629 invalid_address instead of -1U.
630 (Sized_relobj::relocate_sections): Likewise.
631 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
632 values for merge sections.
633 * target-reloc.h (relocate_for_relocatable): Use constant
634 invalid_address instead of -1U.
636 2008-09-19 Cary Coutant <ccoutant@google.com>
638 Add plugin functionality for link-time optimization (LTO).
639 * configure.ac (plugins): Add --enable-plugins option.
640 * configure: Regenerate.
641 * config.in: Regenerate.
642 * Makefile.am (LIBDL): New variable.
643 (CCFILES): Add plugin.cc.
644 (HFILES): Add plugin.h.
645 (ldadd_var): Add LIBDL.
646 * Makefile.in: Regenerate.
648 * archive.cc: Include "plugin.h".
649 (Archive::setup): Don't preread archive symbols when using a plugin.
650 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
651 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
653 (Archive::include_member): Add symbols from plugin objects.
654 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
655 * descriptors.cc (Descriptors::open): Check for file descriptors
656 abandoned by plugins.
657 (Descriptors::claim_for_plugin): New function.
658 * descriptors.h (Descriptors::claim_for_plugin): New function.
659 (Open_descriptor::is_claimed): New field.
660 (claim_descriptor_for_plugin): New function.
661 * fileread.cc (File_read::claim_for_plugin): New function.
662 * fileread.h (File_read::claim_for_plugin): New function.
663 (File_read::descriptor): New function.
664 * gold.cc: Include "plugin.h".
665 (queue_initial_tasks): Add task to call plugin hooks for generating
667 * main.cc: Include "plugin.h".
668 (main): Load plugin libraries.
669 * object.h (Pluginobj): Declare.
670 (Object::pluginobj): New function.
671 (Object::do_pluginobj): New function.
672 (Object::set_target): New function.
673 * options.cc: Include "plugin.h".
674 (General_options::parse_plugin): New function.
675 (General_options::General_options): Initialize plugins_ field.
676 (General_options::add_plugin): New function.
677 * options.h (Plugin_manager): Declare.
678 (General_options): Add --plugin option.
679 (General_options::has_plugins): New function.
680 (General_options::plugins): New function.
681 (General_options::add_plugin): New function.
682 (General_options::plugins_): New field.
683 * plugin.cc: New file.
684 * plugin.h: New file.
685 * readsyms.cc: Include "plugin.h".
686 (Read_symbols::do_read_symbols): Check for archive before checking
687 for ELF file. Call plugin hooks to claim files.
688 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
689 from a real object file; force override when processing replacement
691 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
692 (Symbol::init_base_object): Likewise.
693 (Symbol::init_base_output_data): Likewise.
694 (Symbol::init_base_output_segment): Likewise.
695 (Symbol::init_base_constant): Likewise.
696 (Symbol::init_base_undefined): Likewise.
697 (Symbol::output_section): Assert that object is not a plugin.
698 (Symbol_table::add_from_pluginobj): New function.
699 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
701 (Symbol_table::sized_write_globals): Likewise.
702 (Symbol_table::add_from_pluginobj): Instantiate template.
703 * symtab.h (Sized_pluginobj): Declare.
704 (Symbol::in_real_elf): New function.
705 (Symbol::set_in_real_elf): New function.
706 (Symbol::in_real_elf_): New field.
707 (Symbol_table::add_from_pluginobj): New function.
709 * testsuite/Makefile.am (AM_CFLAGS): New variable.
710 (LIBDL): New variable.
712 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
713 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
714 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
715 (MOSTLYCLEANFILES): Likewise.
716 * testsuite/Makefile.in: Regenerate.
717 * testsuite/plugin_test.c: New file.
718 * testsuite/plugin_test_1.sh: New file.
719 * testsuite/plugin_test_2.sh: New file.
721 2008-09-16 Ian Lance Taylor <iant@google.com>
723 * target-reloc.h (relocate_section): Check whether a symbol is
724 defined by the ABI before reporting an undefined symbol error.
725 * target.h (Target::is_defined_by_abi): Make parameter const.
726 (Target::do_is_defined_by_abi): Likewise.
727 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
728 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
729 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
730 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
731 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
732 * testsuite/Makefile.in: Rebuild.
734 * fileread.cc (make_view): Add casts to avoid warning.
736 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
738 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
739 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
741 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
743 * options.h (General_options::output_is_executable): New.
744 (General_options::output_is_pie): New.
745 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
746 for shared libraries.
747 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
749 2008-09-11 Chris Demetriou <cgd@google.com>
751 * options.h (origin): New -z option.
752 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
753 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
756 2008-09-05 Cary Coutant <ccoutant@google.com>
758 * fileread.cc (File_read::make_view): Add check for attempt to map
761 2008-09-05 Cary Coutant <ccoutant@google.com>
763 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
764 explicit instantiations.
766 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
769 * options.cc (General_options::finalize): Allow undefined symbols
770 in shlibs if linking -shared.
773 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
774 symbols as not needing a dynsym entry.
776 2008-08-20 Craig Silverstein <csilvers@google.com>
778 * fileread.cc (File_read::open): Do not lock the file unless it
779 was successfully opened.
781 2008-08-14 Cary Coutant <ccoutant@google.com>
783 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
784 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
785 * testsuite/tls_test.cc (struct int128): 128-bit struct
786 for testing TLS relocs with non-zero addend.
787 (v12): New TLS variable.
789 (t_last): Add check for v12.
790 * testsuite/tls_test.h (t12): New function.
791 * testsuite/tls_test_main.cc (thread_routine): Call new test.
793 2008-08-13 Ian Lance Taylor <iant@google.com>
795 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
796 set tls_segment_ or relro_segment_.
797 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
799 * output.h (Output_section::clear_is_relro): New function.
800 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
801 sections specially even when output_data_ is empty.
802 (Output_segment::maximum_alignment): When first section is relro,
803 only force alignment for PT_LOAD segments.
804 * script.cc (script_data_segment_align): New function.
805 (script_data_segment_relro_end): New function.
806 * script-c.h (script_data_segment_align): Declare.
807 (script_data_segment_relro_end): Declare.
808 * script-sections.h (class Script_sections): Declare
809 data_segment_align and data_segment_relro_end. Add fields
810 segment_align_index_ and saw_relro_end_.
811 * script-sections.cc (class Sections_element): Add set_is_relro
812 virtual function. Add new bool* parameter to place_orphan_here.
813 Add get_output_section virtual function.
814 (class Output_section_definition): Add set_is_relro. Add new
815 bool* parameter to place_orphan_here. Add get_output_section.
817 (Output_section_definition::Output_section_definition): Initialize
818 evaluated_address_, evaluated_load_address, evaluated_addralign_,
819 and is_relro_ fields.
820 (Output_section_definition::place_orphan_here): Add is_relro
822 (Output_section_definition::set_section_addresses): Set relro for
824 (Output_section_definition::alternate_constraint): Likewise.
825 (class Orphan_output_section): Add new bool* parameter to
826 place_orphan_here. Add get_output_section.
827 (Orphan_output_section::place_orphan_here): Add is_relro
829 (Script_sections::Script_sections): Initialize
830 data_segment_align_index_ and saw_relro_end_.
831 (Script_sections::data_segment_align): New function.
832 (Script_sections::data_segment_relro_end): New function.
833 (Script_sections::place_orphan): Set or clear is_relro.
834 (Script_sections::set_section_addresses): Force alignment of first
836 * yyscript.y (exp): Call script_data_segment_align and
837 script_data_segment_relro_end.
838 * testsuite/relro_script_test.t: New file.
839 * testsuite/relro_test.cc (using_script): Declare.
840 (t1, t2): Test using_script.
841 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
842 (relro_script_test_SOURCES): Define.
843 (relro_script_test_DEPENDENCIES): Define.
844 (relro_script_test_LDFLAGS): Define.
845 (relro_script_test_LDADD): Define.
846 (relro_script_test.so): New target.
847 * testsuite/Makefile.in: Rebuild.
849 2008-08-06 Cary Coutant <ccoutant@google.com>
851 * archive.cc (Archive::total_archives, Archive::total_members)
852 (Archive::total_members_loaded): New variables.
853 (Archive::setup): Add parameter. Add option to preread
855 (Archive::read_armap): Add counter.
856 (Archive::get_file_and_offset): New function.
857 (Archive::get_elf_object_for_member): New function.
858 (Archive::read_all_symbols): New function.
859 (Archive::read_symbols): New function.
860 (Archive::add_symbols): Add counters.
861 (Archive::include_all_members): Use armap to find members if it's
863 (Archive::include_member): Skip reading symbols if already read.
864 Factored code into Archive::get_file_and_offset and
865 Archive::get_elf_object_for_member. Changed call to
866 Mapfile::report_include_archive_member.
867 (Archive::print_stats): New function.
868 * archive.h: Declare Object and Read_symbols_data classes.
869 (Archive::Archive): Add initializers for new members.
870 (Archive::setup): Add parameter.
871 (Archive::print_stats): New function.
872 (Archive::total_archives, Archive::total_members)
873 (Archive::total_members_loaded): New variables.
874 (Archive::get_file_and_offset): New function.
875 (Archive::get_elf_object_for_member): New function.
876 (Archive::read_all_symbols): New function.
877 (Archive::read_symbols): New function.
878 (Archive::Archive_member): New class.
879 (Archive::members_): New member.
880 (Archive::num_members_): New member.
881 * main.cc: Include archive.h.
882 (main): Call Archive::print_stats.
883 * mapfile.cc (Mapfile::report_include_archive_member): Delete
884 archive parameter; member_name is now the fully-decorated name.
885 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
886 * options.h: (General_options): Add --preread-archive-symbols option.
887 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
890 2008-08-04 Ian Lance Taylor <iant@google.com>
892 * symtab.h (Symbol::use_plt_offset): New function.
893 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
894 * powerpc.cc (Relocate::relocate): Likewise.
895 * sparc.cc (Relocate::relocate): Likewise.
896 * x86_64.cc (Relocate::relocate): Likewise.
897 * testsuite/weak_plt.sh: New test.
898 * testsuite/weak_plt_main.cc: New test.
899 * testsuite/weak_plt_shared.cc: New test.
900 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
901 (check_PROGRAMS): Add weak_plt.
902 (check_DATA): Add weak_plt_shared.so.
903 (weak_plt_main_pic.o, weak_plt): New targets.
904 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
905 * testsuite/Makefile.in: Rebuild.
907 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
909 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
910 * testsuite/Makefile.in: Rebuild.
912 2008-08-04 Alan Modra <amodra@bigpond.net.au>
914 * Makefile.am (POTFILES.in): Set LC_ALL=C.
915 * Makefile.in: Regenerate.
916 * po/POTFILES.in: Regenerate.
918 2008-07-29 Ian Lance Taylor <iant@google.com>
920 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
921 symbols before other symbols.
922 * testsuite/script_test_2.cc (test_addr): Declare.
923 (test_addr_alias): Declare.
924 (main): Check that test_addr and test_addr_alias have the right
926 * testsuite/script_test_2.t: Define test_addr_alias and
929 2008-07-24 Ian Lance Taylor <iant@google.com>
932 * descriptors.cc: New file.
933 * descriptors.h: New file.
934 * gold-threads.h (class Hold_optional_lock): New class.
935 * fileread.cc: Include "descriptors.h".
936 (File_read::~File_read): Release descriptor rather than closing
938 (File_read::open) [file]: Call open_descriptor rather than open.
939 Set is_descriptor_opened_.
940 (File_read::open) [memory]: Assert that descriptor is not open.
941 (File_read::reopen_descriptor): New function.
942 (File_read::release): Release descriptor.
943 (File_read::do_read): Make non-const. Reopen descriptor.
944 (File_read::read): Make non-const.
945 (File_read::make_view): Reopen descriptor.
946 (File_read::do_readv): Likewise.
947 * fileread.h (class File_read): Add is_descriptor_opened_ field.
949 * layout.cc: Include "descriptors.h".
950 (Layout::create_build_id): Use open_descriptor rather than open.
951 * output.cc: Include "descriptors.h".
952 (Output_file::open): Use open_descriptor rather than open.
953 * archive.cc (Archive::const_iterator): Change Archive to be
955 (Archive::begin, Archive::end): Make non-const.
956 (Archive::count_members): Likewise.
957 * archive.h (class Archive): Update declarations.
958 * object.h (Object::read): Make non-const.
959 * Makefile.am (CCFILES): Add descriptors.cc.
960 (HFILES): Add descriptors.h.
961 * Makefile.in: Rebuild.
964 * gold.h: Always include <clocale>. Add Solaris workarounds
965 following code in binutils/sysdep.h.
968 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
969 this->eh_frame_hdr_ is NULL before using it.
971 * dynobj.cc (Versions::Versions): Update comment.
973 * dynobj.cc (Versions::Versions): If there is an soname, use it as
974 the base version name.
976 * stringpool.cc (Stringpool_template::add_with_length): Set key to
978 (Stringpool_template::set_string_offsets): Subtract one from key
979 before using it as an array index.
980 (Stringpool_template::get_offset_with_length): Likewise.
981 (Stringpool_template::write_to_buffer): Likewise.
982 * stringpool.h (Stringpool_template::get_offset_from_key):
985 2008-07-23 Ian Lance Taylor <iant@google.com>
988 * object.h (Merged_symbol_value::value): Do our best to handle a
992 * script.cc (Version_script_info::get_versions): Don't add empty
993 version tag to return value.
994 (Version_script_info::get_symbol_version_helper): Change return
995 type to bool. Add pversion parameter. Change all callers.
996 (script_register_vers_node): Don't require a non-NULL tag.
997 * script.h (class Version_script_info): Update declarations.
998 (Version_script_info::get_symbol_version): Change return type to
999 bool. Add version parameter. Change all callers.
1000 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
1001 handling. Handle an empty version from a version script.
1002 (Symbol_table::define_special_symbol): Likewise.
1003 * testsuite/ver_test_10.script: New file.
1004 * testsuite/ver_test_10.sh: New file.
1005 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
1006 (check_DATA): Add ver_test_10.syms.
1007 (ver_test_10.syms, ver_test_10.so): New target.
1008 * testsuite/Makefile.in: Rebuild.
1010 2008-07-23 Simon Baldwin <simonb@google.com>
1012 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
1013 to zero for undefined symbols from dynamic libraries.
1015 2008-07-23 Ian Lance Taylor <iant@google.com>
1017 * symtab.cc (Symbol_table::resolve): Remove version parameter.
1019 * symtab.h (class Symbol_table): Update declaration.
1020 * testsuite/ver_test_9.cc: New file.
1021 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
1022 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
1023 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
1024 (ver_test_9.so, ver_test_9.o): New targets.
1025 * testsuite/Makefile.in: Rebuild.
1027 2008-07-22 Ian Lance Taylor <iant@google.com>
1029 * options.h (class General_options): Define --check-sections.
1030 * layout.cc (Layout::set_segment_offsets): Handle
1033 * options.h (class General_options): Define -n/--nmagic and
1035 * options.cc (General_options::finalize): For -n/--nmagic or
1036 -N/--omagic, set -static.
1037 * layout.cc (Layout::attach_allocated_section_to_segment): If
1038 -N/--omagic, don't put read-only and read-write sections in
1040 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
1041 finding a read-only segment.
1042 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
1043 don't set the minimum segment alignment to the common page size,
1044 and don't set the file offset to the address modulo the page size.
1045 * script-sections.cc (Script_sections::create_segments): If
1046 -n/--omagic, don't put read-only and read-write sections in
1049 * cref.cc: New file.
1051 * options.h (class General_options): Add --print-symbol-counts.
1052 * main.cc (main): Issue defined symbol report if requested.
1053 * archive.cc (Archive::interpret_header): Make into a const member
1055 (Archive::add_symbols): Call Input_objects::archive_start and
1057 (Archive::const_iterator): Define new class.
1058 (Archive::begin, Archive::end): New functions.
1059 (Archive::include_all_members): Rewrite to use iterator.
1060 (Archive::count_members): New function.
1061 * archive.h (class Archive): Update declarations.
1062 (Archive::filename): New function.
1063 * object.cc: Include "cref.h".
1064 (Sized_relobj::Sized_relobj): Initialize defined_count_.
1065 (Sized_relobj::do_get_global_symbol_counts): New function.
1066 (Input_objects::add_object): Add object to cross-referencer.
1067 (Input_objects::archive_start): New function.
1068 (Input_objects::archive_stop): New function.
1069 (Input_objects::print_symbol_counts): New function.
1070 * object.h: Declare Cref and Archive.
1071 (Object::get_global_symbol_counts): New function.
1072 (Object::do_get_global_symbol_counts): New pure virtual function.
1073 (class Sized_relobj): Add defined_count_ field. Update
1075 (class Input_objects): Add cref_ field. Update constructor.
1076 Update declarations.
1077 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
1079 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
1081 (Sized_dynobj::do_get_global_symbol_counts): New function.
1082 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
1083 defined_count_. Update declarations. Define Symbols typedef.
1084 * symtab.cc (Symbol_table::add_from_relobj): Add defined
1085 parameter. Change all callers.
1086 (Symbol_table::add_from_dynobj): Add sympointers and defined
1087 parameters. Change all callers.
1088 * symtab.h (class Symbol_table): Update declarations.
1089 * Makefile.am (CCFILES): Add cref.cc.
1090 (HFILES): Add cref.h.
1091 * Makefile.in: Rebuild.
1093 2008-07-22 Simon Baldwin <simonb@google.com>
1095 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
1096 to zero when writing undefined symbols.
1098 2008-07-22 Ian Lance Taylor <iant@google.com>
1100 * output.cc (Output_section::add_input_section): Don't try to
1101 merge empty merge sections.
1103 2008-07-21 Craig Silverstein <csilvers@google.com>
1105 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
1106 Include symbol version in error message.
1108 2008-07-20 Chris Demetriou <cgd@google.com>
1110 * configure.ac (gold_cv_c_random_seed): New configured variable.
1111 (RANDOM_SEED_CFLAGS): New substituted variable.
1112 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
1113 * configure: Rebuild.
1114 * Makefile.in: Likewise.
1115 * testsuite/Makefile.in: Likewise.
1117 2008-07-18 Ian Lance Taylor <iant@google.com>
1119 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
1120 where we see NAME/NULL and NAME/VERSION as separate symbols.
1121 * testsuite/ver_test_main.cc (main): Call t4.
1122 (t4, t4_2a): Define.
1123 * testsuite/ver_test_2.cc (t4_2): Define.
1124 * testsuite/ver_test_2.script: Put t4_2a in VER2.
1125 * testsuite/ver_test_4.cc (t4_2a): Define.
1126 * testsuite/ver_test_4.script: Put t4_2a in VER2.
1127 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
1129 2008-07-17 Ian Lance Taylor <iant@google.com>
1131 * dynobj.cc (Versions::add_def): If we give an error about a
1132 missing version, go ahead and create the version anyhow.
1134 2008-07-10 Ian Lance Taylor <iant@google.com>
1136 Handle output sections with more than 0x7fffffff bytes.
1137 * object.h (class Relobj): Change map_to_output_ to
1138 output_sections_, and just keep a section pointer. Change all
1139 uses. Move comdat group support to Sized_relobj.
1140 (Relobj::is_section_specially_mapped): Remove.
1141 (Relobj::output_section): Remove poff parameter. Change all
1143 (Relobj::output_section_offset): New function.
1144 (Relobj::set_section_offset): Rewrite.
1145 (Relobj::map_to_output): Remove.
1146 (Relobj::output_sections): New function.
1147 (Relobj::do_output_section_offset): New pure virtual function.
1148 (Relobj::do_set_section_offset): Likewise.
1149 (class Sized_relobj): Add section_offsets_ field. Add comdat
1150 group support from Relobj. Update declarations.
1151 (Sized_relobj::get_output_section_offset): New function.
1152 (Sized_relobj::do_output_section_offset): New function.
1153 (Sized_relobj::do_set_section_offset): New function.
1154 * object.cc (Relobj::output_section_address): Remove.
1155 (Sized_relobj::Sized_relobj): Initialize new fields.
1156 (Sized_relobj::include_section_group): Cast find_kept_object to
1158 (Sized_relobj::include_linkonce_section): Likewise.
1159 (Sized_relobj::do_layout): Use separate arrays for output section
1161 (Sized_relobj::do_count_local_symbols): Change map_to_output to
1163 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
1164 output_sections and section_offsets.
1165 (Sized_relobj::write_local_symbols): Likewise.
1166 (map_to_kept_section): Compute output address directly.
1167 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
1168 output_sections and section_offsets.
1169 (Sized_relobj::write_sections): Likewise.
1170 (Sized_relobj::relocate_sections): Likewise.
1171 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
1172 * output.h (class Output_reloc): Update declarations. Change
1173 u2_.relobj to Sized_relobj*.
1174 (class Output_data_reloc): Change add functions to use
1176 * output.cc (Output_reloc::Output_reloc): Change relobj to
1178 (Output_reloc::local_section_offset): Change return type to
1179 Elf_Addr. Use get_output_section_offset.
1180 (Output_reloc::get_address): Likewise.
1181 (Output_section::is_input_address_mapped): Don't call
1182 is_section_specially_mapped.
1183 (Output_section::output_offset): Likewise.
1184 (Output_section::output_address): Likewise.
1185 (Output_section::starting_output_address): Likewise.
1186 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
1187 parameter to Sized_relobj*.
1188 (Copy_relocs::need_copy_reloc): Likewise.
1189 (Copy_relocs::save): Likewise.
1190 * copy-relocs.h (class Copy_relocs): Update declarations.
1191 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
1192 Sized_relobj*. Change relobj_ field to Sized_relobj*.
1193 * target-reloc.h (relocate_for_relocatable): Change
1194 offset_in_output_section type to Elf_Addr. Change code that uses
1196 * layout.cc (Layout::layout): Always set *off.
1197 * mapfile.cc (Mapfile::print_input_section): Use
1198 output_section_offset.
1199 * i386.cc (Target_i386::copy_reloc): Change object parameter to
1201 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
1202 * sparc.cc (Target_sparc::copy_reloc): Likewise.
1203 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
1205 2008-07-03 Ian Lance Taylor <iant@google.com>
1207 * layout.cc (Layout::include_section): Do not discard unrecognized
1208 SHT_STRTAB sections.
1210 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
1212 * script.cc (Lex::can_continue_name): Make '?' allowable in
1213 version-script names.
1214 * testsuite/version_script.map: Change glob pattern to use '?'
1216 2008-06-30 Manish Singh <yosh@gimp.org>
1219 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
1222 2008-06-30 Ian Lance Taylor <iant@google.com>
1226 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
1227 versions]: Don't try to read the value in the contents, since we
1228 don't use it. Use the template endianness when writing.
1230 2008-06-25 Cary Coutant <ccoutant@google.com>
1232 * fileread.cc (File_read::make_view): Assert on zero-length view.
1233 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
1234 symbol table when there are no symbols to read.
1236 2008-06-23 Craig Silverstein <csilvers@google.com>
1238 * version.cc (version_string): Bump to 1.7
1240 2008-06-18 Craig Silverstein <csilvers@google.com>
1242 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
1243 constant 0xFFFF to type Valtype.
1244 (Powerpc_relocate_functions::rel16_ha): Likewise.
1246 2008-06-17 Ian Lance Taylor <iant@google.com>
1248 * output.h (Output_section::Input_section): Initialize p2align_ to
1249 zero for Output_section_data constructors.
1250 (Output_section::Input_section::addralign): If not an input
1251 section, return the alignment of the Output_section_data.
1252 * testsuite/copy_test.cc: New file.
1253 * testsuite/copy_test_1.cc: New file.
1254 * testsuite/copy_test_2.cc: New file.
1255 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
1256 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
1257 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
1258 (copy_test_1_pic.o, copy_test_1.so): New targets.
1259 (copy_test_2_pic.o, copy_test_2.so): New targets.
1260 * testsuite/Makefile.in: Rebuild.
1262 * script-sections.cc (Script_sections::place_orphan): Initialize
1263 local variable exact.
1265 2008-06-13 David Edelsohn <edelsohn@gnu.org>
1267 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
1269 2008-06-12 David Edelsohn <edelsohn@gnu.org>
1270 David S. Miller <davem@davemloft.net>
1272 * powerpc.cc: New file.
1273 * Makefile.am (TARGETSOURCES): Add powerpc.cc
1274 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
1275 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
1276 * Makefile.in: Rebuild.
1278 2008-06-09 Ian Lance Taylor <iant@google.com>
1280 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
1282 (throwing, orig_terminate): New static variables.
1283 (terminate_handler): New static function.
1284 (t2): Set terminate handler.
1286 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
1289 * binary.cc (Binary_to_elf::sized_convert): Fix .data
1292 2008-05-30 Cary Coutant <ccoutant@google.com>
1294 * archive.cc (Archive::include_all_members) Correct to step
1295 over symbol table and extended name table in thin archives.
1297 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
1300 * target-reloc.h (relocate_for_relocatable): Fix new_offset
1303 2008-05-28 Caleb Howe <cshowe@google.com>
1305 * reduced_debug_output.cc: New file.
1306 * reduced_debug_output.h: New file.
1307 * options.h (class General_options): Add --strip-debug-non-line.
1308 * options.cc (General_options::finalize): Add strip_debug_non_line
1309 to the strip heirarchy.
1310 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
1312 * layout.cc: Include "reduced_debug_output.h".
1313 (Layout::Layout): Initialize new fields.
1314 (line_only_debug_sections): New static array.
1315 (is_lines_only_debug_sections): New static inline function.
1316 (Layout::include_section): Handle --strip-debug-non-line.
1317 (Layout::make_output_section): If --strip-debug-non-line, build
1318 new output sections for .debug_abbrev and .debug_info.
1319 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
1320 gold. Warn about possible overflow.
1321 (read_signed_LEB_128): Likewise.
1322 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
1323 (read_signed_LEB_128): Declare.
1324 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
1325 (HFILES): Add reduced_debug_output.h.
1326 * Makefile.in: Rebuild.
1328 2008-05-21 Ian Lance Taylor <iant@google.com>
1330 * mapfile.cc: New file.
1331 * mapfile.h: New file.
1332 * options.h (class General_options): Add -M/--print-map and -Map.
1333 * options.cc (General_options::finalize): Make -M equivalent to
1335 * main.cc: Include <cstdio> and "mapfile.h".
1336 (main): Open mapfile if requested.
1337 * gold.cc (class Middle_runner): Add mapfile_ field. Update
1338 constructor. Change caller.
1339 (queue_initial_tasks): Add mapfile parameter. Change caller.
1340 (queue_middle_tasks): Likewise.
1341 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
1343 * archive.cc: Include "mapfile.h".
1344 (Archive::add_symbols): Add mapfile parameter. Change all
1345 callers. Pass mapfile, symbol, and reason to include_member.
1346 (Archive::include_all_members): Add mapfile parameter. Change all
1348 (Archive::include_member): Add mapfile, sym, and why parameters.
1349 Change all callers. Report inclusion to map file.
1350 * archive.h: Include "fileread.h".
1351 (class Archive): Update declarations.
1352 (Archive::file): New const method.
1353 (class Add_archive_symbols): Add mapfile_ field. Update
1354 constructor. Change all callers.
1355 * readsyms.h (class Read_symbols): Likewise.
1356 (class Finish_group): Likewise.
1357 (class Read_script): Likewise.
1358 * common.cc: Include "mapfile.h".
1359 (Symbol_table::allocate_commons): Add mapfile parameter. Change
1361 (Symbol_table::do_allocate_commons): Likewise.
1362 (Symbol_table::do_allocate_commons_list): Likewise. Report common
1363 symbol allocation to mapfile.
1364 * common.h (class Allocate_commons_task): Add mapfile_ field.
1365 Update constructor. Change all callers.
1366 * symtab.h (class Symbol_table): Update declarations.
1367 * layout.cc: Include "mapfile.h".
1368 (Layout_task_runner::run): Print information to mapfile.
1369 (Layout::create_gold_note): Change Output_data_fixed_space to
1370 Output_data_zero_fill.
1371 (Layout::create_build_id): Likewise.
1372 (Layout::print_to_mapfile): New function.
1373 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
1374 constructor. Change caller.
1375 (class Layout): Declare print_to_mapfile.
1376 * output.cc (Output_section::Input_section::print_to_mapfile): New
1378 (Output_section::add_input_section): If producing a map, always
1379 add to input_sections_ list.
1380 (Output_section::do_print_to_mapfile): New function.
1381 (Output_segment::print_sections_to_mapfile): New function.
1382 (Output_segment::print_section_list_to_mapfile): New function.
1383 * output.h: Include "mapfile.h".
1384 (Output_data::print_to_mapfile): New function.
1385 (Output_data::do_print_to_mapfile): New virtual function.
1386 (Output_segment_headers::do_print_to_mapfile): New function.
1387 (Output_file_header::do_print_to_mapfile): New function.
1388 (Output_data_const::do_print_to_mapfile): New function.
1389 (class Output_data_const_buffer): Add map_name_ field. Update
1390 constructor. Change all callers. Add do_print_to_mapfile
1392 (class Output_data_fixed_space): Likewise.
1393 (class Output_data_space): Likewise.
1394 (class Output_data_zero_fill): New class.
1395 (Output_data_strtab::do_print_to_mapfile): New function.
1396 (Output_data_reloc_base::do_print_to_mapfile): New function.
1397 (Output_relocatable_relocs::do_print_to_mapfile): New function.
1398 (Output_data_group::do_print_to_mapfile): New function.
1399 (Output_data_got::do_print_to_mapfile): New function.
1400 (Output_data_dynamic::do_print_to_mapfile): New function.
1401 (Output_symtab_xindex::do_print_to_mapfile): New function.
1402 (class Output_section): Declare do_print_to_mapflie. Declare
1403 print_to_mapfile in Input_section.
1404 (class Output_segment): Declare new functions.
1405 * object.h (Sized_relobj::symbol_count): New function.
1406 * script-sections.cc
1407 (Output_section_element_dot_assignment::set_section_addresses):
1408 Change Output_data_fixed_space to Output_data_zero_fill.
1409 (Output_data_expression::do_print_to_mapfile): New function.
1410 * script.cc (read_input_script): Add mapfile parameter. Change
1412 * script.h (read_input_script): Update declaration.
1413 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
1414 (Eh_frame::do_print_to_mapfile): New function.
1415 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
1416 (Output_merge_string::do_print_to_mapfile): New function.
1417 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
1419 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
1421 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
1423 * Makefile.am (CCFILES): Add mapfile.cc.
1424 (HFILES): Add mapfile.h.
1425 * Makefile.in: Rebuild.
1427 2008-05-19 Ian Lance Taylor <iant@google.com>
1429 * options.h (class General_options): Add -z relro.
1430 * layout.cc (Layout::Layout): Initialize relro_segment_.
1431 (Layout::add_output_section_data): Return the output section.
1432 (Layout::make_output_section): Rcognize relro sections and mark
1434 (Layout::attach_allocated_section_to_segment): Put relro sections
1435 in a PT_GNU_RELRO segment.
1436 (Layout::create_initial_dynamic_sections): Mark the .dynamic
1438 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
1440 (Layout::linkonce_mapping): Map d.rel.ro.local to
1442 (Layout::output_section_name): Us .data.rel.ro.local for any
1443 section which begins with that.
1444 * layout.h (class Layout): Update add_output_section_data
1445 declaration. Add relro_segment_ field.
1446 * output.cc (Output_section::Output_section): Initialize is_relro_
1447 and is_relro_local_ fields.
1448 (Output_segment::add_output_section): Group relro sections.
1449 (Output_segment::is_first_section_relro): New function.
1450 (Output_segment::maximum_alignment): If there is a relro section,
1451 align the segment to the common page size.
1452 (Output_segment::set_section_addresses): Track whether we are
1453 looking at relro sections. If the last section is a relro
1454 section, align to the common page size.
1455 (Output_segment::set_section_list_addresses): Add in_relro
1456 parameter. Change all callers. Align to the page size when
1457 moving from relro to non-relro section.
1458 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
1460 * output.h (class Output_section): Add is_relro_ and
1461 is_relro_local_ fields.
1462 (Output_section::is_relro): New function.
1463 (Output_section::set_is_relro): New function.
1464 (Output_section::is_relro_local): New function.
1465 (Output_section::set_is_relro_local): New function.
1466 (class Output_segment): Update declarations.
1467 * i386.cc (Target_i386::got_section): Mark .got section as relro.
1468 * sparc.cc (Target_sparc::got_section): Likewise.
1469 * x86_64.cc (Target_x86_64::got_section): Likewise.
1470 * testsuite/relro_test_main.cc: New file.
1471 * testsuite/relro_test.cc: New file.
1472 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
1473 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
1474 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
1475 (relro_test.so, relro_test_pic.o): New targets.
1476 * testsuite/Makefile.in: Rebuild.
1478 2008-05-16 Ian Lance Taylor <iant@google.com>
1480 * output.cc (Output_segment::add_output_section): Remove front
1482 * output.h (class Output_segment): Remove
1483 add_initial_output_section and overloaded add_output_section.
1484 Update declaration of remaining add_output_section.
1485 * layout.cc (Layout::create_interp): Call add_output_section
1486 rather than add_initial_output_section.
1487 (Layout::finish_dynamic_section): Likewise.
1489 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
1490 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
1491 know the dynamic type.
1492 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
1493 field. Initialize it in constructor.
1494 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
1495 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
1496 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
1499 * output.cc (Output_reloc::get_address): Change return type to
1501 * output.h (class Output_reloc): Update get_address declaration.
1502 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
1503 for section addresses.
1505 2008-05-09 Ian Lance Taylor <iant@google.com>
1508 * gold.cc (gold_nomem): Use return value of write.
1510 2008-05-08 Ian Lance Taylor <iant@google.com>
1512 * symtab.c (Symbol::init_base_output_data): Add version
1513 parameter. Change all callers.
1514 (Symbol::init_base_output_segment): Likewise.
1515 (Symbol::init_base_constant): Likewise.
1516 (Symbol::init_base_undefined): Likewise.
1517 (Sized_symbol::init_output_data): Likewise.
1518 (Sized_symbol::init_output_segment): Likewise.
1519 (Sized_symbol::init_constant): Likewise.
1520 (Sized_symbol::init_undefined): Likewise.
1521 (Symbol_table::do_define_in_output_data): If the new symbol has a
1522 version, mark it as the default.
1523 (Symbol_table::do_define_in_output_segment): Likewise.
1524 (Symbol_table::do_define_as_constant): Likewise.
1525 * symtab.h (class Symbol): Update declarations.
1526 (class Sized_symbol): Likewise.
1527 * resolve.cc (Symbol::override_version): New function.
1528 (Symbol::override_base): Call override_version.
1529 (Symbol::override_base_with_special): Likewise.
1530 * testsuite/ver_script_8.script: New file.
1531 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
1532 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
1533 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
1534 (ver_test_8_1.so, ver_test_8_2.so): New targets.
1536 2008-05-06 Ian Lance Taylor <iant@google.com>
1539 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
1541 (class General_options): Remove existing --undefined, and add
1542 --no-undefined instead. Add new --undefined as synonym for -u.
1543 * archive.cc (Archive::add_symbols): Check whether symbol was
1545 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
1546 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
1547 all uses. Add IS_UNDEFINED. Update declarations to split
1548 different versions of init_base. Declare init_base_undefined.
1549 (Symbol::is_defined): Handle IS_UNDEFINED.
1550 (Symbol::is_undefined): Likewise.
1551 (Symbol::is_weak_undefined): Call is_undefined.
1552 (Symbol::is_absolute): Handle IS_CONSTANT.
1553 (class Sized_symbol): Update declarations to split different
1554 versions of init. Declare init_undefined.
1555 (class Symbol_table): Declare new functions.
1556 * symtab.cc (Symbol::init_base_object): Rename from init_base.
1558 (Symbol::init_base_output_data): Likewise.
1559 (Symbol::init_base_output_segment): Likewise.
1560 (Symbol::init_base_constant): Likewise.
1561 (Symbol::init_base_undefined): New function.
1562 (Sized_symbol::init_object): Rename from init. Change all
1564 (Sized_symbol::init_output_data): Likewise.
1565 (Sized_symbol::init_output_segment): Likewise.
1566 (Sized_symbol::init_constant): Likewise.
1567 (Sized_symbol::init_undefined): New function.
1568 (Symbol_table::add_undefined_symbols_from_command_line): New
1570 (Symbol_table::do_add_undefined_symbols_from_command_line): New
1572 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
1573 (Symbol::output_section): Likewise.
1574 (Symbol::set_output_section): Likewise.
1575 (Symbol_table::sized_finalize_symbol): Likewise.
1576 (Symbol_table::sized_write_globals): Likewise.
1577 * resolve.cc (Symbol_table::should_override): Likewise.
1578 (Symbol::override_base_with_special): Likewise.
1580 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
1581 symbol, change it to have default visibility.
1582 * testsuite/protected_1.cc: New file.
1583 * testsuite/protected_2.cc: New file.
1584 * testsuite/protected_3.cc: New file.
1585 * testsuite/protected_main_1.cc: New file.
1586 * testsuite/protected_main_2.cc: New file.
1587 * testsuite/protected_main_3.cc: New file.
1588 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
1589 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
1590 (protected_1_LDFLAGS, protected_1_LDADD): Define.
1591 (protected_1.so): New target.
1592 (protected_1_pic.o, protected_2_pic.o): New targets.
1593 (protected_3_pic.o): New target.
1594 (check_PROGRAMS): Add protected_2.
1595 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
1596 (protected_2_LDFLAGS, protected_2_LDADD): Define.
1597 * testsuite/Makefile.in: Rebuild.
1599 * options.h (DEFINE_var): Add set_user_set_##varname__.
1600 (DEFINE_bool_alias): New macro.
1601 (class General_options): Define -Bstatic using DEFINE_bool_alias
1602 rather than DEFINE_special. Add --undefined as an alias for -z
1604 * options.cc (General_options::parse_Bstatic): Remove.
1606 * options.h (class General_options): Add --fatal-warnings.
1607 * main.cc (main): Implement --fatal-warnings.
1608 * errors.h (Errors::warning_count): New function.
1610 * options.h (class General_options): Add -Bsymbolic-functions.
1611 * symtab.h (Symbol::is_preemptible): Check for
1612 -Bsymbolic-functions.
1614 2008-05-05 Ian Lance Taylor <iant@google.com>
1616 * options.h (DEFINE_bool): For DASH_Z, create the negative option
1617 as noVARNAME rather than no-VARNAME.
1618 (class General_options): Add option -z combreloc.
1619 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
1621 (Output_reloc::sort_before) [SHT_REL]: New function.
1622 (Output_reloc::sort_before) [SHT_RELA]: New function.
1623 (class Output_data_reloc_base): Add sort_relocs_ field. Define
1624 Sort_relocs_comparison.
1625 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
1626 parameter. Change all callers.
1627 (Output_data_reloc::Output_data_reloc) [both versions]: Add
1628 sort_relocs parameter. Change all callers.
1629 * output.cc (Output_reloc::get_address): New function, broken out
1631 (Output_reloc::write_rel): Call it.
1632 (Output_reloc::compare): New function.
1633 (Output_data_reloc_base::do_write): Optionally sort relocs.
1635 * configure.ac: If targ_extra_obj is set, link it in.
1636 * configure.tgt: Initialize all variables.
1637 (x86_64*): Set targ_extra_obj and targ_extra_size.
1638 * configure: Rebuild.
1640 * object.cc (Sized_relobj::include_section_group): Adjust section
1641 indexes read from group data. Build vector to pass to
1643 * layout.cc (Layout::layout_group): Add flags and shndxes
1644 parameters. Remove contents parameter. Change caller. Update
1645 explicit instantiations.
1646 * layout.h (class Layout): Update layout_group declaration.
1647 * output.cc (Output_data_group::Output_data_group): Add flags and
1648 input_shndxes parameters. Remove contents parameter. Change
1650 (Output_data_group::do_write): Change input_sections_ to
1652 * output.h (class Output_data_group): Update constructor
1653 declaration. Rename input_sections_ to input_shndxes_.
1654 * testsuite/many_sections_test.cc: Add template.
1656 2008-04-30 Cary Coutant <ccoutant@google.com>
1658 * target-reloc.h (relocate_section): Fix dead-pointer bug.
1660 * layout.cc (Layout::include_section): Refactored check for debug
1662 (Layout::add_comdat): Add new parameters. Change type
1663 of signature parameter. Add object and shndx to signatures table.
1664 (Layout::find_kept_object): New function.
1665 * layout.h: Include <cstring>.
1666 (Layout::is_debug_info_section): New function.
1667 (Layout::add_comdat): Add new parameters.
1668 (Layout::find_kept_object): New function.
1669 (Layout::Kept_section): New struct.
1670 (Layout::Signatures): Change type of map range.
1671 * object.cc (Relobj::output_section_address): New function.
1672 (Sized_relobj::include_section_group): Add new parameters. Change
1673 calls to Layout::add_comdat. Change to build table of kept comdat
1674 groups and table mapping discarded sections to kept sections.
1675 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
1676 (Sized_relobj::do_layout): Change calls to include_section_group and
1677 include_linkonce_section.
1678 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
1679 value to zero when section is discarded.
1680 (Sized_relobj::map_to_kept_section): New function.
1681 * object.h (Relobj::output_section_address): New function.
1682 (Relobj::Comdat_group): New type.
1683 (Relobj::find_comdat_group): New function.
1684 (Relobj::Comdat_group_table): New type.
1685 (Relobj::Kept_comdat_section): New type.
1686 (Relobj::Kept_comdat_section_table): New type.
1687 (Relobj::add_comdat_group): New function.
1688 (Relobj::set_kept_comdat_section): New function.
1689 (Relobj::get_kept_comdat_section): New function.
1690 (Relobj::comdat_groups_): New field.
1691 (Relobj::kept_comdat_sections_): New field.
1692 (Symbol_value::input_value): Update comment.
1693 (Sized_relobj::map_to_kept_section) New function.
1694 (Sized_relobj::include_linkonce_section): Add new parameter.
1695 * target-reloc.h (Comdat_behavior): New type.
1696 (get_comdat_behavior): New function.
1697 (relocate_section): Add code to map a discarded section to the
1698 corresponding kept section when applying a relocation.
1700 2008-04-30 Craig Silverstein <csilvers@google.com>
1702 * dwarf_reader.cc (next_generation_count): New static var.
1703 (Addr2line_cache_entry): New struct.
1704 (addr2line_cache): New static var.
1705 (Dwarf_line_info::one_addr2line): Added caching.
1706 (Dwarf_line_info::clear_addr2line_cache): New function.
1707 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
1708 cache-size parameter.
1709 (Dwarf_line_info::one_addr2line_cache): New function.
1710 * symtab.cc (Symbol_table::detect_odr_violations): Pass
1711 new cache-size argument to one_addr2line(), and clear cache.
1713 2008-04-28 Cary Coutant <ccoutant@google.com>
1715 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
1716 R_386_PC8 relocations.
1718 2008-04-23 Ian Lance Taylor <iant@google.com>
1720 * object.cc (Sized_relobj::include_section_group): Check for
1721 invalid section group.
1723 * object.cc (make_elf_object): Correct test for 64-bit ELF file
1726 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
1727 than read for file header.
1728 * archive.cc (Archive::include_member): Likewise.
1730 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
1732 * aclocal.m4: Regenerate.
1733 * configure: Regenerate.
1735 2008-04-19 Ian Lance Taylor <iant@google.com>
1737 * version.cc (version_string): Bump to 1.6.
1739 * testsuite/Makefile.am (many_sections_r_test): New target.
1740 (many_sections_r_test_SOURCES): Remove.
1741 (many_sections_r_test_DEPENDENCIES): Remove.
1742 (many_sections_r_test_LDFLAGS): Remove.
1743 (many_sections_r_test_LDADD): Remove.
1745 * object.cc (Sized_relobj::do_add_symbols): Always pass
1746 local_symbol_count_ to add_from_relobj.
1748 * testsuite/Makefile.am (many_sections_check.h): Only check one in
1749 every thousand variables.
1750 * testsuite/Makefile.in: Rebuild.
1752 * object.cc (Xindex::initialize_symtab_xindex): New function.
1753 (Xindex::read_symtab_xindex): New function.
1754 (Xindex::sym_xindex_to_shndx): New function.
1755 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
1757 (Sized_relobj::do_initialize_xindex): New function.
1758 (Sized_relobj::do_read_symbols): Adjust section links.
1759 (Sized_relobj::symbol_section_and_value): Add is_ordinary
1760 parameter. Change all callers.
1761 (Sized_relobj::include_section_group): Adjust section links and
1762 symbol section indexes.
1763 (Sized_relobj::do_layout): Adjust section links.
1764 (Sized_relobj::do_count_local_symbols): Adjust section links and
1765 symbol section indexes.
1766 (Sized_relobj::do_finalize_local_symbols): Distinguish between
1767 ordinary and special symbols.
1768 (Sized_relobj::write_local_symbols): Add symtab_xindex and
1769 dynsym_xindex parameters. Change all callers. Adjust section
1770 links. Use SHN_XINDEX when needed.
1771 (Sized_relobj::get_symbol_location_info): Adjust section links.
1772 Don't get fooled by special symbols.
1773 * object.h (class Xindex): Define.
1774 (class Object): Add xindex_ parameter. Declare virtual functoin
1775 do_initialize_xindex.
1776 (Object::adjust_sym_shndx): New function.
1777 (Object::set_xindex): New protected function.
1778 (class Symbol_value): Add is_ordinary_shndx_ field.
1779 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
1780 (Symbol_value::value): Assert ordinary section.
1781 (Symbol_value::initialize_input_to_output_map): Likewise.
1782 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
1784 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
1786 (class Sized_relobj): Update declarations.
1787 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
1788 parameter. Change all callers.
1789 (Sized_relobj::adjust_shndx): New function.
1790 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
1792 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
1793 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
1794 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
1795 (Sized_dynobj::read_dynsym_section): Adjust section links.
1796 (Sized_dynobj::read_dynamic): Likewise.
1797 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
1799 (Sized_dynobj::do_initialize_xindex): New function.
1800 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
1801 do_initialize_xindex.
1802 (Sized_dynobj::adjust_shndx): New function.
1803 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
1804 dynsym_xindex_ fields.
1805 (Layout::finalize): Add a call to set_section_indexes before
1806 creating the symtab sections.
1807 (Layout::set_section_indexes): Don't do anything if the section
1808 already has a section index.
1809 (Layout::create_symtab_sections): Add shnum parameter. Change
1810 caller. Create .symtab_shndx section if needed.
1811 (Layout::create_shdrs): Add shstrtab_section parameter. Change
1813 (Layout::allocated_output_section_count): New function.
1814 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
1816 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
1817 fields. Update declarations.
1818 (Layout::symtab_xindex): New function.
1819 (Layout::dynsym_xindex): New function.
1820 (class Write_symbols_task): Add layout_ field.
1821 (Write_symbols_task::Write_symbols_task): Add layout parameter.
1823 * output.cc (Output_section_headers::Output_section_headers): Add
1824 shstrtab_section parameter. Change all callers.
1825 (Output_section_headers::do_sized_write): Store overflow values
1826 for section count and section string table section index in
1827 section header zero.
1828 (Output_file_header::do_sized_write): Check for overflow of
1829 section count and section string table section index.
1830 (Output_symtab_xindex::do_write): New function.
1831 (Output_symtab_xindex::endian_do_write): New function.
1832 * output.h (class Output_section_headers): Add shstrtab_section_.
1833 Update declarations.
1834 (class Output_symtab_xindex): Define.
1835 (Output_section::has_out_shndx): New function.
1836 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
1838 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
1840 (Sized_symbol::init): Likewise.
1841 (Symbol::output_section): Check for ordinary symbol.
1842 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
1843 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
1845 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
1846 Change all callers. Simplify handling of symbols from sections
1847 not included in the link.
1848 (Symbol_table::add_from_dynobj): Handle ordinary symbol
1850 (Weak_alias_sorter::operator()): Assert that symbols are
1852 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
1854 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
1855 parameters. Change all callers.
1856 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
1857 symbol distinction. Use SHN_XINDEX when needed.
1858 (Symbol_table::write_section_symbol): Add symtab_xindex
1859 parameter. Change all callers.
1860 (Symbol_table::sized_write_section_symbol): Likewise. Use
1861 SHN_XINDEX when needed.
1862 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
1864 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
1865 (Symbol::is_defined): Check is_ordinary.
1866 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
1867 (Symbol::is_absolute, Symbol::is_common): Likewise.
1868 (class Sized_symbol): Update declarations.
1869 (class Symbol_table): Update declarations.
1870 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
1871 parameters. Change all callers.
1872 (Sized_symbol::override): Likewise.
1873 (Symbol_table::override): Likewise.
1874 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
1875 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
1876 is_ordinary, and orig_st_shndx parameters. Change all callers.
1877 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
1878 to be in an ordinary section.
1879 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
1880 object and is_ordinary parameters. Change all callers.
1881 (Sized_dwarf_line_info::read_relocs): Add object parameter.
1882 Change all callers. Don't add undefined or non-ordinary symbols
1884 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
1886 * dwarf_reader.h (class Sized_dwarf_line_info): Update
1888 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
1889 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
1890 (Sized_relobj::relocate_sections): Likewise.
1891 * target-reloc.h (scan_relocs): Adjust section symbol index.
1892 (scan_relocatable_relocs): Likewise.
1893 * i386.cc (Scan::local): Check for ordinary symbols.
1894 * sparc.cc (Scan::local): Likewise.
1895 * x86_64.cc (Scan::local): Likewise.
1896 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
1897 to symbol_section_and_value.
1898 * testsuite/many_sections_test.cc: New file.
1899 * testsuite/Makefile.am (BUILT_SOURCES): Define.
1900 (check_PROGRAMS): Add many_sections_test.
1901 (many_sections_test_SOURCES): Define.
1902 (many_sections_test_DEPENDENCIES): Define.
1903 (many_sections_test_LDFLAGS): Define.
1904 (BUILT_SOURCES): Add many_sections_define.h.
1905 (many_sections_define.h): New target.
1906 (BUILT_SOURCES): Add many_sections_check.h.
1907 (many_sections_check.h): New target.
1908 (check_PROGRAMS): Add many_sections_r_test.
1909 (many_sections_r_test_SOURCES): Define.
1910 (many_sections_r_test_DEPENDENCIES): Define.
1911 (many_sections_r_test_LDFLAGS): Define.
1912 (many_sections_r_test_LDADD): Define.
1913 (many_sections_r_test.o): New target.
1914 * testsuite/Makefile.in: Rebuild.
1916 2008-04-17 Cary Coutant <ccoutant@google.com>
1918 * errors.cc (Errors::info): New function.
1919 (gold_info): New function.
1920 * errors.h (Errors::info): New function.
1921 * gold.h (gold_info): New function.
1922 * object.cc (Input_objects::add_object): Print trace output.
1923 * options.cc (options::parse_set): New function.
1924 (General_options::parse_wrap): Deleted.
1925 (General_options::General_options): Deleted initializer.
1926 * options.h (options::String_set): New typedef.
1927 (options::parse_set): New function.
1928 (DEFINE_set): New macro.
1929 (General_options::wrap): Changed to use DEFINE_set. Changed
1930 callers of any_wrap_symbols and is_wrap_symbol.
1931 (General_options::trace, General_options::trace_symbol):
1933 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
1934 (General_options::wrap_symbols_): Deleted.
1935 * symtab.cc (Symbol_table::add_from_object): Print trace output.
1937 2008-04-17 David S. Miller <davem@davemloft.net>
1939 * options.cc (General_options::parse_V): New function.
1940 * options.h: Add entries for -V and -Qy.
1942 2008-04-17 Ian Lance Taylor <iant@google.com>
1944 * common.cc (Symbol_table::allocate_commons): Remove options
1945 parameter. Change caller.
1946 (Symbol_table::do_allocate_commons): Remove options parameter.
1947 Change caller. Just call do_allocate_commons_list twice.
1948 (Symbol_table::do_allocate_commons_list): New function, broken out
1949 of do_allocate_commons.
1950 * common.h (class Allocate_commons_task): Remove options_ field.
1952 * symtab.cc (Symbol_table::Symbol_table): Initialize
1954 (Symbol_table::add_from_object): Put TLS common symbols on
1956 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
1957 which are IN_OUTPUT_DATA.
1958 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
1959 allocate_commons and do_allocate_commons declarations. Declare
1960 do_allocate_commons_list.
1961 * gold.cc (queue_middle_tasks): Update creation of
1962 Allocate_commons_task to not pass options.
1963 * testsuite/Makefile.am (INCLUDES): Add -I.. .
1964 (TLS_TEST_C_FLAGS): New variable.
1965 (tls_test_c_pic.o): New target.
1966 (tls_test_shared.so): Link in tls_test_c_pic.o.
1967 (tls_test_c_pic_ie.o): New target.
1968 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
1969 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
1970 (tls_test_c.o): New target.
1971 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
1972 (tls_pic_test_LDADD): Likewise.
1973 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
1974 (tls_shared_gd_to_ie_test_LDADD): Likewise.
1975 (tls_test_c_gnu2.o): New target.
1976 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
1978 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
1979 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
1980 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
1981 * testsuite/tls_test.cc: Include "config.h".
1982 (t_last): Call t11_last.
1983 * testsuite/tls_test.h (t11, t11_last): Declare.
1984 * testsuite/tls_test_c.c: New file.
1985 * testsuite/tls_test_main.cc (thread_routine): Call t11.
1986 * configure.ac: Check for OpenMP support.
1987 * configure, config.in, Makefile.in: Rebuild.
1988 * testsuite/Makefile.in: Rebuild.
1990 2008-04-16 Cary Coutant <ccoutant@google.com>
1992 * i386.cc (Target_i386::define_tls_base_symbol): New function.
1993 (Target_i386::tls_base_symbol_defined_): New field.
1994 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
1995 (Target_i386::Scan::global): Likewise.
1996 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
1997 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
1998 (Target_x86_64::tls_base_symbol_defined_): New field.
1999 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
2000 (Target_x86_64::Scan::global): Likewise.
2002 2008-04-16 Cary Coutant <ccoutant@google.com>
2004 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
2005 (Symbol::needs_plt_entry): Allow weak undefined symbols.
2006 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
2007 building shared libraries.
2008 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
2009 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
2010 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
2011 * testsuite/Makefile.in: Rebuild.
2012 * testsuite/weak_undef.h: New file.
2013 * testsuite/weak_undef_file1.cc: Add extra test cases.
2014 * testsuite/weak_undef_file2.cc: Likewise.
2015 * testsuite/weak_undef_test.cc: Likewise.
2017 2008-04-16 David S. Miller <davem@davemloft.net>
2019 * sparc.cc (Target_sparc::Scan): Change from struct to class.
2020 Add issued_non_pic_error_ field. Declare check_non_pic.
2021 (Target_sparc::Scan::check_non_pic): New function.
2022 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
2023 (Target_sparc::Scan::global): Likewise.
2025 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
2026 * configure: Rebuild.
2028 * options.h (DEFINE_enable): New macro.
2029 (new_dtags): New enable option.
2030 (initfirst, interpose, loadfltr, nodefaultlib,
2031 nodelete, nodlopen, nodump): New -z options.
2032 * layout.cc (Layout:finish_dynamic_section): If new
2033 dtags enabled, emit DT_RUNPATH. Also, emit a
2034 DT_FLAGS_1 containing any specified -z flags.
2036 2008-04-16 Ian Lance Taylor <iant@google.com>
2038 * copy-relocs.cc: New file.
2039 * copy-relocs.h: New file.
2040 * reloc.cc: Remove Copy_relocs code.
2041 * reloc.h: Likewise.
2042 * reloc-types.h (struct Reloc_types) [both versions]: Add
2043 get_reloc_addend_noerror.
2044 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
2045 variants of add_global which take an addend which must be zero.
2046 * i386.cc: Include "copy-relocs.h".
2047 (class Target_i386): Change type of copy_relocs_ to variable,
2049 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
2051 (Target_i386::do_finalize_sections): Change handling of
2053 * sparc.cc: Include "copy-relocs.h".
2054 (class Target_sparc): Change type of copy_relocs_ to variable,
2056 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
2058 (Target_sparc::do_finalize_sections): Change handling of
2060 * x86_64.cc: Include "copy-relocs.h".
2061 (class Target_x86_64): Change type of copy_relocs_ to variable,
2063 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
2064 class. Change all callers.
2065 (Target_x86_64::do_finalize_sections): Change handling of
2067 * Makefile.am (CCFILES): Add copy-relocs.cc.
2068 (HFILES): Add copy-relocs.h.
2070 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
2072 * testsuite/script_test_4.sh: Permit leading zeroes.
2074 2008-04-15 Ian Lance Taylor <iant@google.com>
2076 * script-sections.cc (Script_sections::create_segments): Use
2077 header_size_adjustment even when there is enough room for the
2079 * testsuite/script_test_4.sh: New file.
2080 * testsuite/script_test_4.t: New file.
2081 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
2082 (check_DATA): Add script_test_4.stdout.
2083 (MOSTLYCLEANFILES): Likewise.
2084 (script_test_4): New target.
2085 (script_test_4.stdout): New target.
2086 * testsuite/Makefile.in: Rebuild.
2088 * sparc.cc: Add definitions for Output_data_plt_sparc class
2091 2008-04-14 David S. Miller <davem@davemloft.net>
2093 * sparc.cc: New file.
2094 * Makefile.am (TARGETSOURCES): Add sparc.cc
2095 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
2096 * configure.tgt: Document targ_extra_size and
2097 targ_extra_big_endian. Add entries for sparc-* and
2099 * configure.ac: Handle targ_extra_size and
2100 targ_extra_big_endian.
2101 * Makefile.in: Rebuild.
2102 * configure: Likewise.
2103 * po/POTFILES.in: Likewise.
2104 * po/gold.pot: Likewise.
2106 2008-04-14 Ian Lance Taylor <iant@google.com>
2108 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
2109 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
2110 in the name/type/flags to section mapping. Don't call
2111 allocate_output_section.
2112 (Layout::choose_output_section): Change parameter from adjust_name
2113 to is_input_section. Don't permit input sections after sections
2114 are attached to segments. Don't call allocate_output_section.
2115 (Layout::layout_eh_frame): Call update_flags_for_input_section,
2116 not write_enable_output_section.
2117 (Layout::make_output_section): Don't push to
2118 unattached_section_list_ nor call attach_to_segment. Call
2119 attach_section_to_segment if sections are attached.
2120 (Layout::attach_sections_to_segments): New function.
2121 (Layout::attach_section_to_segment): New function.
2122 (Layout::attach_allocated_section_to_segment): Rename from
2123 attach_to_segment. Remove flags parameter.
2124 (Layout::allocate_output_section): Remove function.
2125 (Layout::write_enable_output_section): Remove function.
2126 * layout.h (class Layout): Update for above changes. Add new
2127 field sections_are_attached_.
2128 * output.h (Output_section::update_flags_for_input_section): New
2130 * output.cc (Output_section::add_input_section): Call
2131 update_flags_for_input_section.
2132 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
2134 2008-04-11 Cary Coutant <ccoutant@google.com>
2136 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
2137 thought unnecessary.
2138 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
2140 2008-04-11 Ian Lance Taylor <iant@google.com>
2142 * output.h (class Output_section_data): Remove inline definition
2144 * output.cc (Output_section_data::set_addralign): New function.
2146 2008-04-11 Cary Coutant <ccoutant@google.com>
2148 Add support for TLS descriptors for i386 and x86_64.
2149 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
2150 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
2151 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
2153 (Target_i386::got_mod_index_entry): Remove unnecessary code.
2154 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
2155 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
2157 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
2158 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
2159 Fix problem with initial-exec relocations.
2160 (Target_i386::Relocate::relocate_tls): Likewise.
2161 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
2163 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
2164 support for section-plus-offset dynamic table entries.
2165 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
2166 (Output_data_dynamic::Dynamic_entry): Add support for
2167 section-plus-offset dynamic table entries.
2168 (Output_data_dynamic::Classification): Likewise.
2169 (Output_data_dynamic::classification_): Renamed offset_.
2170 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
2171 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
2172 (Target_x86_64::make_plt_section): New function.
2173 (Target_x86_64::reserve_tlsdesc_entries): New function.
2174 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
2175 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
2176 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
2177 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
2178 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
2179 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
2180 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
2181 add extra PLT entry for TLS descriptors.
2182 (Output_data_plt_x86_64::got_): New field.
2183 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
2184 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
2186 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
2188 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
2189 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
2190 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
2191 R_386_TLS_DESC_CALL relocations.
2192 (Target_x86_64::Scan::global): Likewise.
2193 (Target_x86_64::do_finalize_sections): Add dynamic table entries
2194 for TLS descriptors.
2195 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
2196 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
2197 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
2198 GD-to-IE relaxation.
2199 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
2200 and TLS_DESCRIPTORS.
2201 * Makefile.in: Rebuild.
2202 * configure: Rebuild.
2203 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
2204 (tls_test_shared2.so): New target.
2205 (tls_shared_gd_to_ie_test_SOURCES): New variable.
2206 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
2207 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
2208 (tls_shared_gd_to_ie_test_LDADD): New variable.
2209 (tls_shared_gnu2_gd_to_ie_test): New target.
2210 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
2212 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
2213 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
2214 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
2215 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
2216 (tls_shared_gnu2_test): New target.
2217 (tls_test_gnu2_shared.so): New target.
2218 (tls_shared_gnu2_test_SOURCES): New variable.
2219 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
2220 (tls_shared_gnu2_test_LDFLAGS): New variable.
2221 (tls_shared_gnu2_test_LDADD): New variable.
2222 * testsuite/Makefile.in: Rebuild.
2223 * testsuite/Makefile.
2225 2008-04-11 Ian Lance Taylor <iant@google.com>
2227 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
2229 * testsuite/Makefile.in: Rebuild.
2231 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
2233 * testsuite/script_test_2.cc (main): Adjust test.
2235 2008-04-11 David S. Miller <davem@davemloft.net>
2236 Ian Lance Taylor <iant@google.com>
2238 * options.h (General_options): Add entries for '-Y' and
2240 * options.cc (General_options:finalize): If -Y was used, add those
2241 entries to the library path instead of the default "/lib" and
2244 2008-04-11 David S. Miller <davem@davemloft.net>
2246 * testsuite/justsyms.t: Start at 0x100.
2247 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
2248 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
2250 * testsuite/script_test_2.cc: Adjust string and section length
2253 2008-04-09 Ian Lance Taylor <iant@google.com>
2256 * script-sections.cc (Sections_element::allocate_to_segment): Add
2258 (Output_section_definition::allocate_to_segment): Likewise.
2259 (Orphan_output_section::allocate_to_segment): Likewise.
2260 (Script_sections::attach_sections_using_phdrs_clause): Don't
2261 propagate non-PT_LOAD segments to orphan sections.
2262 * testsuite/Makefile.am (script_test_3.stdout): Generate using
2263 readelf rather than objdump.
2264 * testsuite/script_test_3.sh: Adjust accordingly. Test that
2265 .interp section and PT_INTERP segment are the same size.
2266 * testsuite/Makefile.in: Rebuild.
2268 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
2269 aliases for symbols defined in the same object.
2270 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
2271 (weak_alias_test_SOURCES): New variable.
2272 (weak_alias_test_DEPENDENCIES): New variable.
2273 (weak_alias_test_LDFLAGS): New variable.
2274 (weak_alias_test_LDADD): New variable.
2275 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
2276 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
2277 (weak_alias_test_3.o): New target.
2278 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
2279 * testsuite/weak_alias_test_main.cc: New file.
2280 * testsuite/weak_alias_test_1.cc: New file.
2281 * testsuite/weak_alias_test_2.cc: New file.
2282 * testsuite/weak_alias_test_3.cc: New file.
2284 2008-04-08 Ian Lance Taylor <iant@google.com>
2286 * options.h (class General_options): Add --noinhibit-exec option.
2287 * main.cc (main): Check --noinhibit-exec.
2289 * options.h (class General_options): Define --wrap as a special
2290 option. Add wrap_symbols_ field.
2291 (General_options::any_wrap_symbols): New function.
2292 (General_options::is_wrap_symbol): New function.
2293 * options.cc (General_options::parse_wrap): New function.
2294 (General_options::General_options): Initialize wrap_symbols_.
2295 * symtab.cc (Symbol_table::wrap_symbol): New function.
2296 (Symbol_table::add_from_object): Handle --wrap.
2297 * symtab.h (class Symbol_table): Declare wrap_symbol.
2298 * target.h (Target::wrap_char): New function.
2299 (Target::Target_info): Add wrap_char field.
2300 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
2301 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2302 * testsuite/testfile.cc (Target_test::test_target_info):
2305 * errors.cc (Errors::undefined_symbol): Mention symbol version if
2308 * layout.h (class Layout): Add added_eh_frame_data_ field.
2309 * layout.cc (Layout::Layout): Initialize new field.
2310 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
2311 output section until we find a section we merged successfully.
2312 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
2313 that the size be non-zero.
2315 * merge.cc (Object_merge_map::get_output_offset): Remove inline
2318 2008-04-08 Craig Silverstein <csilvers@google.com>
2320 * configure.ac: Export new conditional variable HAVE_ZLIB.
2321 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
2323 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
2324 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
2326 2008-04-07 Ian Lance Taylor <iant@google.com>
2328 * version.cc (version_string): Set to "1.5".
2330 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
2331 Add issued_non_pic_error_ field. Declare check_non_pic.
2332 (Target_x86_64::Scan::check_non_pic): New function.
2333 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
2334 (Target_x86_64::Scan::global): Likewise.
2336 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
2337 addend parameter. Change caller. Handle merge sections.
2338 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
2339 Address to Addend. Don't add in the result of
2340 local_section_offset, pass down the addend and use the returned
2342 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
2343 Update declarations of local_section_offset and symbol_value.
2344 * testsuite/two_file_test_1.cc (t18): New function.
2345 * testsuite/two_file_test_2.cc (f18): New function.
2346 * testsuite/two_file_test_main.cc (main): Call t18.
2347 * testsuite/two_file_test.h (t18, f18): Declare.
2349 * configure.ac: Don't test for objdump, c++filt, or readelf.
2350 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
2352 (TEST_READELF): New variable.
2353 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
2354 (check_PROGRAMS): Add two_file_strip_test.
2355 (two_file_strip_test): New target.
2356 (check_PROGRAMS): Add two_file_same_shared_strip_test.
2357 (two_file_same_shared_strip_test_SOURCES): New variable.
2358 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
2359 (two_file_same_shared_strip_test_LDFLAGS): New variable.
2360 (two_file_same_shared_strip_test_LDADD): New variable.
2361 (two_file_shared_strip.so): New target.
2362 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
2363 (ver_test_5.syms, ver_test_7.syms): Likewise.
2364 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
2365 (strip_test_3.stdout): Use TEST_OBJDUMP.
2366 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
2368 2008-04-04 Cary Coutant <ccoutant@google.com>
2370 * symtab.h (Symbol::is_weak_undefined): New function.
2371 (Symbol::is_strong_undefined): New function.
2372 (Symbol::is_absolute): New function.
2373 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
2374 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
2376 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
2377 (weak_undef_test): New target.
2378 * testsuite/Makefile.in: Rebuild.
2379 * testsuite/weak_undef_file1.cc: New file.
2380 * testsuite/weak_undef_file2.cc: New file.
2381 * testsuite/weak_undef_test.cc: New file.
2383 2008-04-03 Craig Silverstein <csilvers@google.com>
2385 * compressed_output.h (class Output_compressed_section): Use
2387 * compressed_output.cc (zlib_compress): Use unsigned buffers,
2389 (zlib_compressed_suffix): Removed.
2390 (Output_compressed_section::set_final_data_size): Use unsigned
2392 * testsuite/Makefile.am (flagstest_compress_debug_sections):
2393 Fix linker invocation.
2394 (flagstest_o_specialfile_and_compress_debug_sections):
2396 * testsuite/Makefile.in: Regenerated.
2398 2008-04-02 David S. Miller <davem@davemloft.net>
2400 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
2401 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
2403 2008-04-02 Craig Silverstein <csilvers@google.com>
2407 2008-04-02 Ian Lance Taylor <iant@google.com>
2409 * fileread.cc (File_read::find_view): Add byteshift and vshifted
2410 parameters. Update for new key type to views_. Change all
2412 (File_read::read): Adjust for byteshift in returned view.
2413 (File_read::add_view): New function, broken out of
2415 (File_read::make_view): New function, broken out of
2417 (File_read::find_or_make_view): Add offset and aligned
2418 parameters. Rewrite accordingly. Change all callers.
2419 (File_read::get_view): Add offset and aligned parameters. Adjust
2420 for byteshift in return value.
2421 (File_read::get_lasting_view): Likewise.
2422 * fileread.h (class File_read): Update declarations.
2423 (class File_read::View): Add byteshift_ field. Add byteshift to
2424 constructor. Add byteshift method.
2425 * archive.h (Archive::clear_uncached_views): New function.
2426 (Archive::get_view): Add aligned parameter. Change all callers.
2427 * object.h (Object::get_view): Add aligned parameter. Change all
2429 (Object::get_lasting_view): Likewise.
2431 * fileread.cc (File_read::release): Don't call clear_views if
2432 there are multiple objects.
2433 * fileread.h (File_read::clear_uncached_views): New function.
2434 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
2437 2008-03-31 Cary Coutant <ccoutant@google.com>
2439 Add thin archive support.
2440 * archive.cc (Archive::armagt): New const.
2441 (Archive::setup): Remove task parameter and calls to unlock.
2442 (Archive::unlock_nested_archives): New function.
2443 (Archive::read_header): Add nested_off parameter. Change
2445 (Archive::interpret_header): Likewise.
2446 (Archive::include_all_members): Change to handle thin
2448 (Archive::include_member): Likewise.
2449 * archive.h (Archive::Archive): Add new parameters and
2451 (Archive::armagt): New const.
2452 (Archive::setup): Remove task parameter.
2453 (Archive::unlock_nested_archives): New function.
2454 (Archive::read_header): Add nested_off parameter.
2455 (Archive::interpret_header): Likewise.
2456 (Archive::Nested_archive_table): New typedef.
2457 (Archive::is_thin_archive_): New field.
2458 (Archive::nested_archives_): New field.
2459 (Archive::options_): New field.
2460 (Archive::dirpath_): New field.
2461 (Archive::task_): New field.
2462 * readsyms.cc (Read_symbols::do_read_symbols): Add check
2463 for thin archives. Pass additional parameters to
2464 Archive::Archive. Unlock the archive file after calling
2467 2008-03-29 Ian Lance Taylor <iant@google.com>
2469 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
2470 version symbol to be local.
2471 * testsuite/ver_test_4.sh: New file.
2472 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
2473 (check_DATA): Add ver_test_4.syms.
2474 (ver_test_4.syms): New target.
2475 * testsuite/Makefile.in: Rebuild.
2478 (Output_section::Input_section_sort_entry::has_priority): New
2480 (Output_section::Input_section_sort_entry::match_file_name): New
2482 (Output_section::Input_section_sort_entry::match_section_name):
2484 (Output_section::Input_section_sort_entry::match_section_name_prefix):
2486 (Output_section::Input_section_sort_entry::match_section_file):
2488 (Output_section::Input_section_sort_compare::operator()): Rewrite
2489 using new Input_section_sort_entry functions. Sort crtbegin and
2490 crtend first. Sort sections with no priority before sections with
2492 * testsuite/initpri1.c (d3): Check j != 4.
2493 (cd5): New constructor/destructor function.
2494 (main): Check j != 2.
2496 * symtab.cc (Symbol_table::add_from_object): If we don't use the
2497 new symbol when resolving, don't call set_is_default.
2498 * testsuite/ver_test_7.cc: New file.
2499 * testsuite/ver_test_7.sh: New file.
2500 * testsuite/Makefile.am (ver_test_7.so): New target.
2501 (ver_test_7.o): New target.
2502 (check_SCRIPTS): Add ver_test_7.sh.
2503 (check_DATA): Add ver_test_7.syms.
2504 (ver_test_7.syms): New target.
2506 2008-03-28 Ian Lance Taylor <iant@google.com>
2508 * layout.cc (Layout::layout): If we see an input section with a
2509 name that needs sorting, set the must_sort flag for the output
2511 (Layout::make_output_section): If the name of the output section
2512 indicates that it might require sorting, set the may_sort flag.
2513 * output.h (Output_section::may_sort_attached_input_sections): New
2515 (Output_section::set_may_sort_attached_input_sections): New
2517 (Output_section::must_sort_attached_input_sections): New
2519 (Output_section::set_must_sort_attached_input_sections): New
2521 (class Output_section): Declare Input_section_sort_entry. Define
2522 Input_section_sort_compare. Declare
2523 sort_attached_input_sections. Add new fields:
2524 may_sort_attached_input_sections_,
2525 must_sort_attached_input_sections_,
2526 attached_input_sections_are_sorted_.
2527 * output.cc (Output_section::Output_section): Initialize new
2529 (Output_section::add_input_section): Add an entry to
2530 input_sections_ if may_sort or must_sort are true.
2531 (Output_section::set_final_data_size): Call
2532 sort_attached_input_sections if necessary.
2533 (Output_section::Input_section_sort_entry): Define new class.
2534 (Output_section::Input_section_sort_compare::operator()): New
2536 (Output_section::sort_attached_input_sections): New function.
2537 * configure.ac: Check whether the compiler supports constructor
2538 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
2539 * testsuite/initpri1.c: New file.
2540 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
2541 CONSTRUCTOR_PRIORITY.
2542 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
2543 (initpri1_LDFLAGS): New variable.
2544 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
2546 2008-03-27 Ian Lance Taylor <iant@google.com>
2548 * common.cc (Sort_commons::operator): Correct sorting algorithm.
2549 * testsuite/common_test_1.c: New file.
2550 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
2551 (common_test_1_SOURCES): New variable.
2552 (common_test_1_DEPENDENCIES): New variable.
2553 (common_test_1_LDFLAGS): New variable.
2555 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
2556 and commons_ correctly when NAME/VERSION does not override
2558 * testsuite/ver_test_6.c: New file.
2559 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
2560 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
2561 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
2563 2008-03-26 Ian Lance Taylor <iant@google.com>
2565 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
2566 of an undefined symbol from a version script.
2567 * testsuite/Makefile.am (ver_test_5.so): New target.
2568 (ver_test_5.o): New target.
2569 (check_SCRIPTS): Add ver_test_5.sh.
2570 (check_DATA): Add ver_test_5.syms.
2571 (ver_test_5.syms): New target.
2572 * testsuite/ver_test_5.cc: New file.
2573 * testsuite/ver_test_5.script: New file.
2574 * testsuite/ver_test_5.sh: New file.
2575 * Makefile.in, testsuite/Makefile.in: Rebuild.
2578 Fix problems building gold with gcc 4.3.0.
2579 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
2580 (gold_error_at_location, gold_warning_at_location): Use it.
2581 * configure.ac: Check whether we can compile and use a template
2582 function with a printf attribute.
2583 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
2584 when jumping over bytes.
2585 * object.cc: Instantiate Object::read_section_data.
2586 * debug.h: Include <cstring>
2587 * dwarf_reader.cc: Include <algorithm>
2588 * main.cc: Include <cstring>.
2589 * options.cc: Include <cstring>.
2590 * output.cc: Include <cstring>.
2591 * script.cc: Include <cstring>.
2592 * script.h: Include <string>.
2593 * symtab.cc: Include <cstring> and <algorithm>.
2594 * target-select.cc: Include <cstring>.
2595 * version.cc: Include <string>.
2596 * testsuite/testmain.cc: Include <cstdlib>.
2597 * configure, config.in: Rebuild.
2599 2008-03-25 Ian Lance Taylor <iant@google.com>
2601 * options.cc: Include "../bfd/bfdver.h".
2602 (options::help): Print bug reporting address.
2604 * version.cc (print_version): Adjust output for current value of
2609 * options.cc (options::help): Print list of supported targets.
2610 * target-select.h: Include <vector>.
2611 (class Target_selector): Make machine_, size_, and is_big_endian_
2612 fields const. Add bfd_name_ and instantiated_target_ fields.
2613 (Target_selector::Target_selector): Add bfd_name parameter.
2614 (Target_selector::recognize): Make non-virtual, call
2616 (Target_selector::recognize_by_name): Make non-virtual, call
2617 do_recognize_by_name.
2618 (Target_selector::supported_names): New function.
2619 (Target_selector::bfd_name): New function.
2620 (Target_selector::do_instantiate_target): New pure virtual
2622 (Target_selector::do_recognize): New virtual function.
2623 (Target_selector::do_recognize_by_name): New virtual function.
2624 (Target_selector::instantiate_target): New private function.
2625 (supported_target_names): Declare.
2626 * target-select.cc (Target_selector::Target_selector): Update for
2627 new parameter and fields.
2628 (select_target_by_name): Check that the name matches before
2629 calling recognize_by_name.
2630 (supported_target_names): New function.
2631 * i386.cc (class Target_selector_i386): Update Target_selector
2632 constructor call. Remove recognize and recognize_by_name. Add
2633 do_instantiate_target.
2634 * x86_64.cc (class Target_selector_x86_64): Likewise.
2635 * testsuite/testfile.cc (class Target_selector_test): Update for
2636 changes to Target_selector.
2638 * README: Rewrite, with some notes on unsupported features.
2640 2008-03-24 Cary Coutant <ccoutant@google.com>
2642 * i386.cc (Target_i386::Got_type): New enum declaration.
2643 (Target_i386::Scan::local): Updated callers of Output_data_got
2645 (Target_i386::Scan::global): Likewise.
2646 (Target_i386::Relocate::relocate): Likewise.
2647 (Target_i386::Relocate::relocate_tls): Likewise.
2648 * object.h (Got_offset_list): New class.
2649 (Sized_relobj::local_has_got_offset): Added got_type parameter.
2650 (Sized_relobj::local_got_offset): Likewise.
2651 (Sized_relobj::set_local_got_offset): Likewise.
2652 (Sized_relobj::local_has_tls_got_offset): Removed.
2653 (Sized_relobj::local_tls_got_offset): Removed.
2654 (Sized_relobj::set_local_tls_got_offset): Removed.
2655 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
2656 * output.cc (Output_data_got::add_global): Added got_type parameter.
2657 (Output_data_got::add_global_with_rel): Likewise.
2658 (Output_data_got::add_global_with_rela): Likewise.
2659 (Output_data_got::add_global_pair_with_rel): New function.
2660 (Output_data_got::add_global_pair_with_rela): New function.
2661 (Output_data_got::add_local): Added got_type parameter.
2662 (Output_data_got::add_local_with_rel): Likewise.
2663 (Output_data_got::add_local_with_rela): Likewise.
2664 (Output_data_got::add_local_pair_with_rel): New function.
2665 (Output_data_got::add_local_pair_with_rela): New function.
2666 (Output_data_got::add_global_tls): Removed.
2667 (Output_data_got::add_global_tls_with_rel): Removed.
2668 (Output_data_got::add_global_tls_with_rela): Removed.
2669 (Output_data_got::add_local_tls): Removed.
2670 (Output_data_got::add_local_tls_with_rel): Removed.
2671 (Output_data_got::add_local_tls_with_rela): Removed.
2672 * output.h (Output_data_got::add_global): Added got_type parameter.
2673 (Output_data_got::add_global_with_rel): Likewise.
2674 (Output_data_got::add_global_with_rela): Likewise.
2675 (Output_data_got::add_global_pair_with_rel): New function.
2676 (Output_data_got::add_global_pair_with_rela): New function.
2677 (Output_data_got::add_local): Added got_type parameter.
2678 (Output_data_got::add_local_with_rel): Likewise.
2679 (Output_data_got::add_local_with_rela): Likewise.
2680 (Output_data_got::add_local_pair_with_rel): New function.
2681 (Output_data_got::add_local_pair_with_rela): New function.
2682 (Output_data_got::add_global_tls): Removed.
2683 (Output_data_got::add_global_tls_with_rel): Removed.
2684 (Output_data_got::add_global_tls_with_rela): Removed.
2685 (Output_data_got::add_local_tls): Removed.
2686 (Output_data_got::add_local_tls_with_rel): Removed.
2687 (Output_data_got::add_local_tls_with_rela): Removed.
2688 * resolve.cc (Symbol::override_base_with_special): Removed
2689 reference to has_got_offset_ field.
2690 * symtab.cc (Symbol::init_fields): Replaced initialization
2691 of got_offset_ with got_offsets_. Removed initialization
2693 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
2694 (Symbol::got_offset): Likewise.
2695 (Symbol::set_got_offset): Likewise.
2696 (Symbol::has_tls_got_offset): Removed.
2697 (Symbol::tls_got_offset): Removed.
2698 (Symbol::set_tls_got_offset): Removed.
2699 (Symbol::got_offset_): Removed.
2700 (Symbol::tls_mod_got_offset_): Removed.
2701 (Symbol::tls_pair_got_offset_): Removed.
2702 (Symbol::got_offsets_): New field.
2703 (Symbol::has_got_offset): Removed.
2704 (Symbol::has_tls_mod_got_offset): Removed.
2705 (Symbol::has_tls_pair_got_offset): Removed.
2706 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
2707 (Target_x86_64::Scan::local): Updated callers of Output_data_got
2709 (Target_x86_64::Scan::global): Likewise.
2710 (Target_x86_64::Relocate::relocate): Likewise.
2711 (Target_x86_64::Relocate::relocate_tls): Likewise.
2713 2008-03-25 Ben Elliston <bje@au.ibm.com>
2715 * yyscript.y: Fix spelling error in comment.
2717 2008-03-24 Ian Lance Taylor <iant@google.com>
2719 * options.h (class General_options): Define build_id option.
2720 * layout.h (class Layout): Declare write_build_id, create_note,
2721 create_build_id. Add build_id_note_ member.
2722 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
2723 "libiberty.h", "md5.h", "sha1.h".
2724 (Layout::Layout): Initialize eh_frame_data_,
2725 eh_frame_hdr_section_, and build_id_note_.
2726 (Layout::finalize): Call create_build_id.
2727 (Layout::create_note): New function, broken out of
2728 Layout::create_gold_note.
2729 (Layout::create_gold_note): Call create_note.
2730 (Layout::create_build_id): New function.
2731 (Layout::write_build_id): New function.
2732 (Close_task_runner::run): Call write_build_id.
2734 * x86_64.cc: Correct license to GPLv3.
2736 2008-03-23 Ian Lance Taylor <iant@google.com>
2738 * options.cc: Include "demangle.h".
2739 (parse_optional_string): New function.
2740 (parse_long_option): Handle takes_optional_argument.
2741 (parse_short_option): Update dash_z initializer. Handle
2742 takes_optional_argument.
2743 (General_options::General_options): Initialize do_demangle_.
2744 (General_options::finalize): Set do_demangle_. Handle demangling
2746 * options.h (parse_optional_string): Declare.
2747 (struct One_option): Add optional_arg field. Update constructor.
2748 Update call constructor calls. Add takes_optional_argument
2750 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
2751 (DEFINE_optional_string): Define.
2752 (General_options::demangle): Change from DEFINE_bool to
2753 DEFINE_optional_string.
2754 (General_options::no_demangle): New function.
2755 (General_options::do_demangle): New function.
2756 (General_options::set_do_demangle): New function.
2757 (General_options::execstack_status_): Move definition to end of
2759 (General_options::static_): Likewise.
2760 (General_options::do_demangle_): New field.
2761 * object.cc (big_endian>::get_symbol_location_info): Call
2762 Options::do_demangle, not Options::demangle.
2763 * symtab.cc (demangle): Likewise.
2765 2008-03-22 Ian Lance Taylor <iant@google.com>
2767 * gold.h: Include <cstddef> and <sys/types.h>
2768 * options.h: Include <cstring>.
2770 2008-03-21 Ian Lance Taylor <iant@google.com>
2772 * Added source code to GNU binutils.