1 2009-02-28 Ian Lance Taylor <iant@google.com>
3 * README: --gc-sections and map files are now supported. Document
4 some build requirements.
7 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
8 relocatable link set the value of the section symbol to zero.
9 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
10 relocatable link don't include the section address in the local
13 2009-02-27 Ian Lance Taylor <iant@google.com>
16 * options.h (class Search_directory): Add is_system_directory.
17 (class General_options): Declare is_in_system_directory.
18 * options.cc (get_relative_sysroot): Make static.
19 (get_default_sysroot): Make static.
20 (General_optoins::is_in_system_directory): New function.
21 * fileread.cc (Input_file::is_in_system_directory): New function.
22 * fileread.h (class Input_file): Declare is_in_system_directory.
23 * object.h (class Object): Add is_in_system_directory.
24 (class Input_objects): Remove system_library_directory_ field.
25 * object.cc (Input_objects::add_object): Don't set
26 system_library_directory_.
27 (input_objects::found_in_system_library_directory): Remove.
28 * symtab.cc (Symbol_table::write_globals): Remove input_objects
29 parameter. Change all callers.
30 (Symbol_table::sized_write_globals): Likewise.
31 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
32 Call Object::is_in_system_directory.
33 * symtab.h (class Symbol_table): Update declarations.
36 * descriptors.h (Open_descriptor): Add is_on_stack field.
37 * descriptors.cc (Descriptors::open): If the descriptor is on the
38 top of the stack, remove it. Initialize is_on_stack field.
39 (Descriptors::release): Only add pod to stack if it is not on the
41 (Descriptors::close_some_descriptor): Clear stack_next and
45 * output.cc (Output_section::find_starting_output_address): Rename
46 from starting_output_address; add PADDR parameter; change return
48 * output.h (class Output_section): Declare
49 find_starting_output_address instead of starting_output_address.
50 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
51 section symbol for which we can't find a merge section.
54 * symtab.cc (Symbol_table::add_from_object): If the visibility is
55 hidden or internal, force the symbol to be local.
56 * resolve.cc (Symbol::override_visibility): Define.
57 (Symbol::override_base): Use override_visibility.
58 (Symbol_table::resolve): Likewise.
59 (Symbol::override_base_with_special): Likewise.
60 (Symbol_table::override_with_special): If the visibility is hidden
61 or internal, force the symbol to be local.
62 * symtab.h (class Symbol): Add set_visibility and
64 * testsuite/ver_test_1.sh: New file.
65 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
66 (check_DATA): Add ver_test_1.syms.
67 (ver_test_1.syms): New target.
68 * testsuite/Makefile.in: Rebuild.
70 2009-02-25 Cary Coutant <ccoutant@google.com>
72 * layout.cc (Layout::choose_output_section): Don't rename sections
73 when using a linker script that has a SECTIONS clause.
74 * Makefile.in: Regenerate.
76 * testsuite/Makefile.am (script_test_5.sh): New test case.
77 * testsuite/Makefile.in: Regenerate.
78 * testsuite/script_test_5.cc: New file.
79 * testsuite/script_test_5.sh: New file.
80 * testsuite/script_test_5.t: New file.
82 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
84 * archive.cc (Archive::include_member): Update calls to add_symbols.
85 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
87 * dynobj.h (do_add_symbols): Add the Layout argument.
88 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
90 * object.h (Object::add_symbols): Add the Layout argument.
91 (Object::do_add_symbols): Add the Layout argument.
92 (Sized_relobj::do_add_symbols): Add the Layout argument.
93 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
94 Unify the two versions.
95 (Add_plugin_symbols): Remove.
96 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
97 (Sized_pluginobj::do_add_symbols): Unify the two versions.
98 (Add_plugin_symbols): Remove.
99 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
100 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
101 (Add_symbols::run): Make it work with Pulginobj.
103 2009-02-06 Ian Lance Taylor <iant@google.com>
105 * object.cc (Sized_relobj::do_layout): Make info message start
106 with lower case letter.
108 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
110 * binary.cc: Fix file comment.
112 * options.h (enum Incremental_disposition): Define.
113 (class General_options): Add new options: --incremental,
114 --incremental_changed, --incremental_unchanged,
115 --incremental_unknown. Add incremental_disposition_ and
116 implicit_incremental_ fields.
117 (General_options::incremental_disposition): New function.
118 (class Position_dependent_options): Add incremental_disposition
120 (Position_dependent_options::copy_from_options): Set incremental
122 * options.cc (General_options::parse_incremental_changed): New
124 (General_options::parse_incremental_unchanged): New function.
125 (General_options::parse_incremental_unknown): New function.
126 (General_options::General_options): Initialize new fields
127 incremental_disposition_ and implicit_incremental_.
128 (General_options::finalize): Check for uasge of --incremental-*
129 without --incremental.
131 2009-02-06 Chris Demetriou <cgd@google.com>
133 * gold.h (gold_undefined_symbol): Change to take only a Symbol
134 pointer and to report location as the file name associated with
136 (gold_undefined_symbol_at_location): New function to replace the
137 old gold_undefined_symbol functionality.
138 * target-reloc.h (relocate_section): Update to use
139 gold_undefined_symbol_at_location.
140 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
141 Call gold_undefined_symbol function rather than gold_error.
142 * errors.h (Errors::undefined_symbol): Take location as a
143 string, rather than calculating it from a relocation.
144 * errors.cc (Errors::fatal): Print "fatal error:" before the
146 (Errors::error, Errors::error_at_location): Print "error: "
147 before the formatted message.
148 (Errors::undefined_symbol): Take location as a string, rather
149 than calculating it from a relocation.
150 (gold_undefined_symbol_at_location): New function akin to
151 old gold_undefined_symbol, calculates location from relocation.
152 (gold_undefined_symbol): Change to take only a Symbol pointer
153 and to report location as the file name associated with the symbol.
154 * testsuite/debug_msg.sh: Update for changed error messages.
155 * testsuite/undef_symbol.sh: Likewise.
157 2009-02-04 Duncan Sands <baldrick@free.fr>
160 * reduced_debug_output.h
161 (Output_reduced_debug_abbrev_section::failed): Use format for
163 (Output_reduced_debug_info_section::faild): Likewise.
165 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
167 * script.cc (Lazy_demangler): New class.
168 (Version_script_info::get_symbol_version_helper): Demangle a
171 2009-01-29 Cary Coutant <ccoutant@google.com>
173 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
175 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
177 2009-01-28 Ian Lance Taylor <iant@google.com>
179 * version.cc (version_string): Bump to 1.9.
181 * gold.h: Include <cstring> and <stdint.h>.
182 * version.cc: Include <cstdio>.
183 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
185 * reduced_debug_output.cc (insert_into_vector): Rename from
186 Insert_into_vector; change all callers. Use Swap_unaligned to
187 avoid aliasing issue; remove union since it is unnecessary.
189 2009-01-27 Sriraman Tallam <tmsriram@google.com>
191 * Makefile.am (CCFILES): Add gc.cc.
193 * Makefile.in: Regenerate.
194 * gold.cc (Gc_runner): New class.
195 (queue_initial_tasks): Call garbage collection related tasks
196 when corresponding options are invoked.
197 (queue_middle_gc_tasks): New function.
198 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
199 processed early before laying out sections during garbage collection.
200 * gold.h (queue_middle_gc_tasks): New function.
201 (is_prefix_of): Move from "layout.cc".
202 * i386.cc (Target_i386::gc_process_relocs): New function.
203 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
204 * main.cc (main): Create object of class "Garbage_collection".
205 * object.cc (Relobj::copy_symbols_data): New function.
206 (Relobj::is_section_name_included): New function.
207 (Sized_relobj::do_layout): Allow this function to be called twice
208 during garbage collection and defer layout of section during the
210 * object.h (Relobj::get_symbols_data): New function.
211 (Relobj::is_section_name_included): New function.
212 (Relobj::copy_symbols_data): New function.
213 (Relobj::set_symbols_data): New function.
214 (Relobj::get_relocs_data): New function.
215 (Relobj::set_relocs_data): New function.
216 (Relobj::is_output_section_offset_invalid): New pure virtual function.
217 (Relobj::gc_process_relocs): New function.
218 (Relobj::do_gc_process_relocs): New pure virtual function.
219 (Relobj::sd_): New data member.
220 (Sized_relobj::is_output_section_offset_invalid): New function.
221 (Sized_relobj::do_gc_process_relocs): New function.
222 * options.h (General_options::gc_sections): Modify to not be a no-op.
223 (General_options::print_gc_sections): New option.
224 * plugin.cc (Plugin_finish::run): Remove function call to
225 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
226 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
227 * reloc.cc (Read_relocs::run): Add task to process relocs and
228 determine unreferenced sections when doing garbage collection.
229 (Gc_process_relocs): New class.
230 (Sized_relobj::do_gc_process_relocs): New function.
231 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
232 sections that are garbage collected.
233 * reloc.h (Gc_process_relocs): New class.
234 * sparc.cc (Target_sparc::gc_process_relocs): New function.
235 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
236 symbols whose corresponding sections are garbage collected.
237 (Symbol_table::Symbol_table): Add new parameter for the garbage
239 (Symbol_table::gc_mark_undef_symbols): New function.
240 (Symbol_table::gc_mark_symbol_for_shlib): New function.
241 (Symbol_table::gc_mark_dyn_syms): New function.
242 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
244 (Symbol_table::add_from_object): Likewise.
245 (Symbol_table::add_from_relobj): When building shared objects, do not
246 treat externally visible symbols as garbage.
247 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
248 table information for static and relocatable links.
249 * symtab.h (Symbol_table::set_gc): New function.
250 (Symbol_table::gc): New function.
251 (Symbol_table::gc_mark_undef_symbols): New function.
252 (Symbol_table::gc_mark_symbol_for_shlib): New function.
253 (Symbol_table::gc_mark_dyn_syms): New function.
254 (Symbol_table::gc_): New data member.
255 * target.h (Sized_target::gc_process_relocs): New pure virtual
257 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
258 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
260 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
262 * options.h (General_options::gc_sections): Define as a no-op for now.
263 (General_options::no_keep_memory): Ditto.
264 (General_options::Bshareable): Define.
265 * options.cc (General_options::finalize): Honor -Bshareable.
267 2009-01-20 Andreas Schwab <schwab@suse.de>
269 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
270 read the value in the contents, since we don't use it. Use the
271 template endianness when writing.
272 (Relocate::relocate): Use it for R_PPC_REL16_HA.
274 2009-01-19 Andreas Schwab <schwab@suse.de>
276 * configure.tgt (powerpc64-*): Fix targ_obj.
278 2009-01-15 Ian Lance Taylor <iant@google.com>
280 * object.cc (Sized_relobj::write_local_symbols): Don't write out
281 local symbols when stripping all symbols.
283 2009-01-14 Cary Coutant <ccoutant@google.com>
285 * output.cc (Output_reloc): Add explicit instantiations.
287 2009-01-14 Cary Coutant <ccoutant@google.com>
289 * archive.cc (Archive::get_elf_object_for_member): Remove call
290 to File_read::claim_for_plugin.
291 * descriptors.cc (Descriptors::open): Remove reference to
293 (Descriptors::claim_for_plugin): Remove.
294 * descriptors.h (Descriptors::claim_for_plugin): Remove.
295 (Descriptors::is_claimed): Remove.
296 (claim_descriptor_for_plugin): Remove.
297 * fileread.cc (File_read::claim_for_plugin): Remove.
298 * fileread.h (File_read::claim_for_plugin): Remove.
299 (File_read::descriptor): Reopen descriptor if necessary.
300 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
301 (Plugin_manager::all_symbols_read): Add task parameter. Change
303 (Plugin_manager::get_input_file): New function.
304 (Plugin_manager::release_input_file): New function.
305 (Pluginobj::Pluginobj): Add filesize parameter and initialize
306 corresponding data member.
307 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
308 and pass to base constructor. Change all callers.
309 (get_input_file, release_input_file): New functions.
310 (make_sized_plugin_object): Add filesize parameter. Change all callers.
311 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
312 (Plugin_manager::all_symbols_read): Add task parameter.
313 (Plugin_manager::get_input_file): New function.
314 (Plugin_manager::release_input_file): New function.
315 (Plugin_manager::task_): New data member.
316 (Pluginobj::Pluginobj): Add filesize parameter.
317 (Pluginobj::filename): New function.
318 (Pluginobj::descriptor): New function.
319 (Pluginobj::filesize): New function.
320 (Pluginobj::filesize_): New data member.
321 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
322 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
323 File_read::claim_for_plugin; use Object::unlock to unlock the file.
325 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
326 with archive libraries.
327 * testsuite/Makefile.in: Regenerate.
328 * testsuite/plugin_test.c (struct sym_info): New type.
329 (get_input_file, release_input_file): New static variables.
330 (onload): Capture new transfer vector entries.
331 (claim_file_hook): Stop reading at end of file according to filesize.
332 Factor out parsing of readelf output into separate function.
333 (all_symbols_read_hook): Exercise get_input_file and release_input_file
334 APIs and get the source file name from the symbol table. Convert
335 source file name to corresponding object file name. Print info
336 message when adding new input files.
337 (parse_readelf_line): New function.
338 * testsuite/plugin_test_1.sh: Add checks for new info messages.
339 * testsuite/plugin_test_2.sh: Likewise.
340 * testsuite/plugin_test_3.sh: Likewise.
341 * testsuite/plugin_test_4.sh: New test case.
343 2009-01-07 Ian Lance Taylor <iant@google.com>
345 * version.cc (version_string): Bump to 1.8.
347 2008-12-23 Cary Coutant <ccoutant@google.com>
349 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
350 * plugin.cc (Plugin_manager::finish): Rename as
351 layout_deferred_objects. Move cleanup to separate function.
352 (Plugin_manager::cleanup): New function.
353 (Plugin_finish::run): Call layout_deferred_objects and cleanup
355 * plugin.h (Plugin_manager::finish): Rename as
356 layout_deferred_objects.
357 (Plugin_manager::cleanup): New function.
358 (Plugin_manager::cleanup_done): New field.
360 2008-12-23 Cary Coutant <ccoutant@google.com>
362 * plugin.cc (is_visible_from_outside): New function.
363 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
364 so we don't return "IR only" status for exported symbols or -r links.
366 * testsuite/Makefile.am (plugin_test_3): New test case.
367 * testsuite/Makefile.in: Regenerate.
368 * testsuite/plugin_test_3.sh: New file.
370 2008-12-22 Cary Coutant <ccoutant@google.com>
372 * object.cc (Sized_relobj::layout_section): New function.
373 (Sized_relobj::do_layout): Defer layout of input sections until after
374 plugin has provided replacement files.
375 (Sized_relobj::do_layout_deferred_sections): New function.
376 * object.h (Relobj::set_section_offset): Remove virtual keyword.
377 (Relobj::layout_deferred_sections): New function.
378 (Relobj::do_layout_deferred_sections): New function.
379 (Sized_relobj::do_layout_deferred_sections): New function.
380 (Sized_relobj::layout_section): New function.
381 (Sized_relobj::Deferred_layout): New structure.
382 (Sized_relobj::deferred_layout_): New field.
383 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
384 Change all callers. Layout deferred sections.
385 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
387 (Plugin_hook::run): Move code from do_plugin_hook inline.
388 (Plugin_hook::do_plugin_hook): Remove.
389 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
390 (Plugin_manager::finish): Renamed, was cleanup.
391 (Plugin_manager::should_defer_layout): New function.
392 (Plugin_manager::add_deferred_layout_object): New function.
393 (Plugin_manager::Deferred_layout_list): New type.
394 (Plugin_manager::deferred_layout_objects_): New field.
395 (Plugin_hook::do_plugin_hook): Remove.
397 2008-12-17 Ian Lance Taylor <iant@google.com>
399 * options.h (class General_options): Add --no case for
402 2008-12-16 Cary Coutant <ccoutant@google.com>
404 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
406 (Plugin_manager::claim_file): Create plugin object even if
407 plugin did not call the add_symbols callback.
408 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
409 asking for more symbols than were added.
410 * testsuite/Makefile.am (plugin_test_1): Add test case with
412 (empty.syms): New target.
413 * testsuite/Makefile.in: Regenerate.
414 * testsuite/plugin_test.c (claim_file_hook): Add new debug
415 message. Don't call add_symbols if no globals.
416 (all_symbols_read_hook): Don't provide replacement for empty
419 2008-12-12 Ian Lance Taylor <iant@google.com>
421 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
422 r_type == 0 for a local symbol with r_sym == 0.
423 (scan_relocatable_relocs): Pass r_sym to
424 local_non_section_strategy.
425 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
428 * configure.ac: Update test for TLS descriptors: they are
429 supported as of glibc 2.9.
430 * configure: Rebuild.
432 2008-12-11 Ian Lance Taylor <iant@google.com>
435 * target-reloc.h (Default_scan_relocatable_relocs): For each
436 function, map r_type == 0 to RELOC_DISCARD.
438 2008-12-10 Cary Coutant <ccoutant@google.com>
440 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
441 object to override a kept COMDAT group from a plugin object.
443 2008-12-09 Ian Lance Taylor <iant@google.com>
446 * yyscript.y (file_cmd): Handle INPUT.
448 * testsuite/initpri1.c: Change all declarations to be full
449 prototypes by adding void, to avoid compiler warnings.
451 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
453 * options.cc (General_options::parse_plugin_opt): New.
454 (General_options::add_plugin): The argument now is just the filename.
455 (General_options::add_plugin_option): New.
456 * options.h (plugin_opt): New.
457 (add_plugin): Change argument name.
458 (add_plugin_option): New.
459 * plugin.cc (Plugin::load): Don't parse the plugin option.
460 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
461 (Plugin::add_option): New.
462 (Plugin::args_): Change type.
463 (Plugin::filename_): New.
464 (Plugin_manager::add_plugin_option): New.
465 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
466 * testsuite/Makefile.in: Regenerate.
468 2008-12-05 Cary Coutant <ccoutant@google.com>
470 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
471 Handle --strip-lto-sections option.
472 * options.h (strip_lto_sections): New option.
474 2008-12-01 Cary Coutant <ccoutant@google.com>
476 * plugin.cc (ld_plugin_message): Change format parameter to const.
477 Fix mismatch between new[] and delete.
479 2008-11-14 Cary Coutant <ccoutant@google.com>
481 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
484 2008-11-05 Craig Silverstein <csilvers@google.com>
486 * options.cc (General_options::parse_dynamic_list): New function.
487 * options.h (General_options): New flags dynamic_list,
488 dynamic_list_data, dynamic_list_cpp_new, and
489 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
490 (General_options::in_dynamic_list): New function.
491 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
492 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
493 (Lex::can_continue_name): Likewise.
495 (read_script_file): New parameter script_options.
496 (read_dynamic_list): New function.
497 (Script_options::define_dynamic_list): New function.
498 (dynamic_list_keyword_parsecodes): New variable.
499 (dynamic_list_keywords): New variable.
500 * script.h (Script_options::define_dynamic_list): New function
502 (read_dynamic_list): New function prototype.
503 * symtab.cc (strprefix): New macro.
504 (Symbol::should_add_dynsym_entry): Support dynamic_list,
505 dynamic_list_data, dynamic_list_cpp_new, and
506 dynamic_list_cpp_typeinfo.
507 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
508 (dynamic_list_expr): New rule.
509 (dynamic_list_nodes): Likewise.
510 (dynamic_list_node): Likewise.
511 * testsuite/Makefile.am (dynamic_list): New test.
512 * testsuite/Makefile.in: Regenerated.
513 * testsuite/dynamic_list.t: New file.
514 * testsuite/dynamic_list.sh: New file.
516 2008-11-05 Craig Silverstein <csilvers@google.com>
518 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
519 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
520 (t11_last): Likewise.
521 * testsuite/ver_test_6.c (main): Likewise.
523 2008-10-07 Cary Coutant <ccoutant@google.com>
525 * options.c (General_options::finalize): Add check for -static and
527 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
530 2008-10-02 Cary Coutant <ccoutant@google.com>
532 * plugin.cc (make_sized_plugin_object): Fix conditional
533 compilation to work when not all targets are enabled.
535 2008-09-29 Cary Coutant <ccoutant@google.com>
537 * archive.cc (Archive::get_file_and_offset): Use filename instead
538 of name to get library path.
539 (Archive::include_member): Unlock external member of a thin archive.
541 * testsuite/Makefile.am (TEST_AR): New variable.
542 (thin_archive_test_1): New test.
543 (thin_archive_test_2): New test.
544 * testsuite/Makefile.in: Regenerate.
545 * testsuite/thin_archive_main.cc: New file.
546 * testsuite/thin_archive_test_1.cc: New file.
547 * testsuite/thin_archive_test_2.cc: New file.
548 * testsuite/thin_archive_test_3.cc: New file.
549 * testsuite/thin_archive_test_4.cc: New file.
551 2008-09-29 Cary Coutant <ccoutant@google.com>
553 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
554 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
556 (Sized_relobj::do_finalize_local_symbols): Likewise.
557 (Sized_relobj::map_to_kept_section): Likewise.
558 * object.h (Sized_relobj::invalid_address): New constant.
559 (Sized_relobj::do_output_section_offset): Check for invalid_address
561 * output.cc (Output_reloc::local_section_offset): Use constant
562 invalid_address instead of -1U.
563 (Output_reloc::get_address): Likewise.
564 (Output_section::output_address): Change -1U to -1ULL.
565 * output.h (Output_reloc::invalid_address): New constant.
566 * reloc.cc (Sized_relobj::write_sections): Use constant
567 invalid_address instead of -1U.
568 (Sized_relobj::relocate_sections): Likewise.
569 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
570 values for merge sections.
571 * target-reloc.h (relocate_for_relocatable): Use constant
572 invalid_address instead of -1U.
574 2008-09-19 Cary Coutant <ccoutant@google.com>
576 Add plugin functionality for link-time optimization (LTO).
577 * configure.ac (plugins): Add --enable-plugins option.
578 * configure: Regenerate.
579 * config.in: Regenerate.
580 * Makefile.am (LIBDL): New variable.
581 (CCFILES): Add plugin.cc.
582 (HFILES): Add plugin.h.
583 (ldadd_var): Add LIBDL.
584 * Makefile.in: Regenerate.
586 * archive.cc: Include "plugin.h".
587 (Archive::setup): Don't preread archive symbols when using a plugin.
588 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
589 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
591 (Archive::include_member): Add symbols from plugin objects.
592 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
593 * descriptors.cc (Descriptors::open): Check for file descriptors
594 abandoned by plugins.
595 (Descriptors::claim_for_plugin): New function.
596 * descriptors.h (Descriptors::claim_for_plugin): New function.
597 (Open_descriptor::is_claimed): New field.
598 (claim_descriptor_for_plugin): New function.
599 * fileread.cc (File_read::claim_for_plugin): New function.
600 * fileread.h (File_read::claim_for_plugin): New function.
601 (File_read::descriptor): New function.
602 * gold.cc: Include "plugin.h".
603 (queue_initial_tasks): Add task to call plugin hooks for generating
605 * main.cc: Include "plugin.h".
606 (main): Load plugin libraries.
607 * object.h (Pluginobj): Declare.
608 (Object::pluginobj): New function.
609 (Object::do_pluginobj): New function.
610 (Object::set_target): New function.
611 * options.cc: Include "plugin.h".
612 (General_options::parse_plugin): New function.
613 (General_options::General_options): Initialize plugins_ field.
614 (General_options::add_plugin): New function.
615 * options.h (Plugin_manager): Declare.
616 (General_options): Add --plugin option.
617 (General_options::has_plugins): New function.
618 (General_options::plugins): New function.
619 (General_options::add_plugin): New function.
620 (General_options::plugins_): New field.
621 * plugin.cc: New file.
622 * plugin.h: New file.
623 * readsyms.cc: Include "plugin.h".
624 (Read_symbols::do_read_symbols): Check for archive before checking
625 for ELF file. Call plugin hooks to claim files.
626 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
627 from a real object file; force override when processing replacement
629 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
630 (Symbol::init_base_object): Likewise.
631 (Symbol::init_base_output_data): Likewise.
632 (Symbol::init_base_output_segment): Likewise.
633 (Symbol::init_base_constant): Likewise.
634 (Symbol::init_base_undefined): Likewise.
635 (Symbol::output_section): Assert that object is not a plugin.
636 (Symbol_table::add_from_pluginobj): New function.
637 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
639 (Symbol_table::sized_write_globals): Likewise.
640 (Symbol_table::add_from_pluginobj): Instantiate template.
641 * symtab.h (Sized_pluginobj): Declare.
642 (Symbol::in_real_elf): New function.
643 (Symbol::set_in_real_elf): New function.
644 (Symbol::in_real_elf_): New field.
645 (Symbol_table::add_from_pluginobj): New function.
647 * testsuite/Makefile.am (AM_CFLAGS): New variable.
648 (LIBDL): New variable.
650 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
651 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
652 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
653 (MOSTLYCLEANFILES): Likewise.
654 * testsuite/Makefile.in: Regenerate.
655 * testsuite/plugin_test.c: New file.
656 * testsuite/plugin_test_1.sh: New file.
657 * testsuite/plugin_test_2.sh: New file.
659 2008-09-16 Ian Lance Taylor <iant@google.com>
661 * target-reloc.h (relocate_section): Check whether a symbol is
662 defined by the ABI before reporting an undefined symbol error.
663 * target.h (Target::is_defined_by_abi): Make parameter const.
664 (Target::do_is_defined_by_abi): Likewise.
665 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
666 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
667 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
668 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
669 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
670 * testsuite/Makefile.in: Rebuild.
672 * fileread.cc (make_view): Add casts to avoid warning.
674 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
676 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
677 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
679 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
681 * options.h (General_options::output_is_executable): New.
682 (General_options::output_is_pie): New.
683 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
684 for shared libraries.
685 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
687 2008-09-11 Chris Demetriou <cgd@google.com>
689 * options.h (origin): New -z option.
690 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
691 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
694 2008-09-05 Cary Coutant <ccoutant@google.com>
696 * fileread.cc (File_read::make_view): Add check for attempt to map
699 2008-09-05 Cary Coutant <ccoutant@google.com>
701 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
702 explicit instantiations.
704 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
707 * options.cc (General_options::finalize): Allow undefined symbols
708 in shlibs if linking -shared.
711 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
712 symbols as not needing a dynsym entry.
714 2008-08-20 Craig Silverstein <csilvers@google.com>
716 * fileread.cc (File_read::open): Do not lock the file unless it
717 was successfully opened.
719 2008-08-14 Cary Coutant <ccoutant@google.com>
721 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
722 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
723 * testsuite/tls_test.cc (struct int128): 128-bit struct
724 for testing TLS relocs with non-zero addend.
725 (v12): New TLS variable.
727 (t_last): Add check for v12.
728 * testsuite/tls_test.h (t12): New function.
729 * testsuite/tls_test_main.cc (thread_routine): Call new test.
731 2008-08-13 Ian Lance Taylor <iant@google.com>
733 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
734 set tls_segment_ or relro_segment_.
735 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
737 * output.h (Output_section::clear_is_relro): New function.
738 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
739 sections specially even when output_data_ is empty.
740 (Output_segment::maximum_alignment): When first section is relro,
741 only force alignment for PT_LOAD segments.
742 * script.cc (script_data_segment_align): New function.
743 (script_data_segment_relro_end): New function.
744 * script-c.h (script_data_segment_align): Declare.
745 (script_data_segment_relro_end): Declare.
746 * script-sections.h (class Script_sections): Declare
747 data_segment_align and data_segment_relro_end. Add fields
748 segment_align_index_ and saw_relro_end_.
749 * script-sections.cc (class Sections_element): Add set_is_relro
750 virtual function. Add new bool* parameter to place_orphan_here.
751 Add get_output_section virtual function.
752 (class Output_section_definition): Add set_is_relro. Add new
753 bool* parameter to place_orphan_here. Add get_output_section.
755 (Output_section_definition::Output_section_definition): Initialize
756 evaluated_address_, evaluated_load_address, evaluated_addralign_,
757 and is_relro_ fields.
758 (Output_section_definition::place_orphan_here): Add is_relro
760 (Output_section_definition::set_section_addresses): Set relro for
762 (Output_section_definition::alternate_constraint): Likewise.
763 (class Orphan_output_section): Add new bool* parameter to
764 place_orphan_here. Add get_output_section.
765 (Orphan_output_section::place_orphan_here): Add is_relro
767 (Script_sections::Script_sections): Initialize
768 data_segment_align_index_ and saw_relro_end_.
769 (Script_sections::data_segment_align): New function.
770 (Script_sections::data_segment_relro_end): New function.
771 (Script_sections::place_orphan): Set or clear is_relro.
772 (Script_sections::set_section_addresses): Force alignment of first
774 * yyscript.y (exp): Call script_data_segment_align and
775 script_data_segment_relro_end.
776 * testsuite/relro_script_test.t: New file.
777 * testsuite/relro_test.cc (using_script): Declare.
778 (t1, t2): Test using_script.
779 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
780 (relro_script_test_SOURCES): Define.
781 (relro_script_test_DEPENDENCIES): Define.
782 (relro_script_test_LDFLAGS): Define.
783 (relro_script_test_LDADD): Define.
784 (relro_script_test.so): New target.
785 * testsuite/Makefile.in: Rebuild.
787 2008-08-06 Cary Coutant <ccoutant@google.com>
789 * archive.cc (Archive::total_archives, Archive::total_members)
790 (Archive::total_members_loaded): New variables.
791 (Archive::setup): Add parameter. Add option to preread
793 (Archive::read_armap): Add counter.
794 (Archive::get_file_and_offset): New function.
795 (Archive::get_elf_object_for_member): New function.
796 (Archive::read_all_symbols): New function.
797 (Archive::read_symbols): New function.
798 (Archive::add_symbols): Add counters.
799 (Archive::include_all_members): Use armap to find members if it's
801 (Archive::include_member): Skip reading symbols if already read.
802 Factored code into Archive::get_file_and_offset and
803 Archive::get_elf_object_for_member. Changed call to
804 Mapfile::report_include_archive_member.
805 (Archive::print_stats): New function.
806 * archive.h: Declare Object and Read_symbols_data classes.
807 (Archive::Archive): Add initializers for new members.
808 (Archive::setup): Add parameter.
809 (Archive::print_stats): New function.
810 (Archive::total_archives, Archive::total_members)
811 (Archive::total_members_loaded): New variables.
812 (Archive::get_file_and_offset): New function.
813 (Archive::get_elf_object_for_member): New function.
814 (Archive::read_all_symbols): New function.
815 (Archive::read_symbols): New function.
816 (Archive::Archive_member): New class.
817 (Archive::members_): New member.
818 (Archive::num_members_): New member.
819 * main.cc: Include archive.h.
820 (main): Call Archive::print_stats.
821 * mapfile.cc (Mapfile::report_include_archive_member): Delete
822 archive parameter; member_name is now the fully-decorated name.
823 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
824 * options.h: (General_options): Add --preread-archive-symbols option.
825 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
828 2008-08-04 Ian Lance Taylor <iant@google.com>
830 * symtab.h (Symbol::use_plt_offset): New function.
831 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
832 * powerpc.cc (Relocate::relocate): Likewise.
833 * sparc.cc (Relocate::relocate): Likewise.
834 * x86_64.cc (Relocate::relocate): Likewise.
835 * testsuite/weak_plt.sh: New test.
836 * testsuite/weak_plt_main.cc: New test.
837 * testsuite/weak_plt_shared.cc: New test.
838 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
839 (check_PROGRAMS): Add weak_plt.
840 (check_DATA): Add weak_plt_shared.so.
841 (weak_plt_main_pic.o, weak_plt): New targets.
842 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
843 * testsuite/Makefile.in: Rebuild.
845 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
847 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
848 * testsuite/Makefile.in: Rebuild.
850 2008-08-04 Alan Modra <amodra@bigpond.net.au>
852 * Makefile.am (POTFILES.in): Set LC_ALL=C.
853 * Makefile.in: Regenerate.
854 * po/POTFILES.in: Regenerate.
856 2008-07-29 Ian Lance Taylor <iant@google.com>
858 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
859 symbols before other symbols.
860 * testsuite/script_test_2.cc (test_addr): Declare.
861 (test_addr_alias): Declare.
862 (main): Check that test_addr and test_addr_alias have the right
864 * testsuite/script_test_2.t: Define test_addr_alias and
867 2008-07-24 Ian Lance Taylor <iant@google.com>
870 * descriptors.cc: New file.
871 * descriptors.h: New file.
872 * gold-threads.h (class Hold_optional_lock): New class.
873 * fileread.cc: Include "descriptors.h".
874 (File_read::~File_read): Release descriptor rather than closing
876 (File_read::open) [file]: Call open_descriptor rather than open.
877 Set is_descriptor_opened_.
878 (File_read::open) [memory]: Assert that descriptor is not open.
879 (File_read::reopen_descriptor): New function.
880 (File_read::release): Release descriptor.
881 (File_read::do_read): Make non-const. Reopen descriptor.
882 (File_read::read): Make non-const.
883 (File_read::make_view): Reopen descriptor.
884 (File_read::do_readv): Likewise.
885 * fileread.h (class File_read): Add is_descriptor_opened_ field.
887 * layout.cc: Include "descriptors.h".
888 (Layout::create_build_id): Use open_descriptor rather than open.
889 * output.cc: Include "descriptors.h".
890 (Output_file::open): Use open_descriptor rather than open.
891 * archive.cc (Archive::const_iterator): Change Archive to be
893 (Archive::begin, Archive::end): Make non-const.
894 (Archive::count_members): Likewise.
895 * archive.h (class Archive): Update declarations.
896 * object.h (Object::read): Make non-const.
897 * Makefile.am (CCFILES): Add descriptors.cc.
898 (HFILES): Add descriptors.h.
899 * Makefile.in: Rebuild.
902 * gold.h: Always include <clocale>. Add Solaris workarounds
903 following code in binutils/sysdep.h.
906 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
907 this->eh_frame_hdr_ is NULL before using it.
909 * dynobj.cc (Versions::Versions): Update comment.
911 * dynobj.cc (Versions::Versions): If there is an soname, use it as
912 the base version name.
914 * stringpool.cc (Stringpool_template::add_with_length): Set key to
916 (Stringpool_template::set_string_offsets): Subtract one from key
917 before using it as an array index.
918 (Stringpool_template::get_offset_with_length): Likewise.
919 (Stringpool_template::write_to_buffer): Likewise.
920 * stringpool.h (Stringpool_template::get_offset_from_key):
923 2008-07-23 Ian Lance Taylor <iant@google.com>
926 * object.h (Merged_symbol_value::value): Do our best to handle a
930 * script.cc (Version_script_info::get_versions): Don't add empty
931 version tag to return value.
932 (Version_script_info::get_symbol_version_helper): Change return
933 type to bool. Add pversion parameter. Change all callers.
934 (script_register_vers_node): Don't require a non-NULL tag.
935 * script.h (class Version_script_info): Update declarations.
936 (Version_script_info::get_symbol_version): Change return type to
937 bool. Add version parameter. Change all callers.
938 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
939 handling. Handle an empty version from a version script.
940 (Symbol_table::define_special_symbol): Likewise.
941 * testsuite/ver_test_10.script: New file.
942 * testsuite/ver_test_10.sh: New file.
943 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
944 (check_DATA): Add ver_test_10.syms.
945 (ver_test_10.syms, ver_test_10.so): New target.
946 * testsuite/Makefile.in: Rebuild.
948 2008-07-23 Simon Baldwin <simonb@google.com>
950 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
951 to zero for undefined symbols from dynamic libraries.
953 2008-07-23 Ian Lance Taylor <iant@google.com>
955 * symtab.cc (Symbol_table::resolve): Remove version parameter.
957 * symtab.h (class Symbol_table): Update declaration.
958 * testsuite/ver_test_9.cc: New file.
959 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
960 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
961 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
962 (ver_test_9.so, ver_test_9.o): New targets.
963 * testsuite/Makefile.in: Rebuild.
965 2008-07-22 Ian Lance Taylor <iant@google.com>
967 * options.h (class General_options): Define --check-sections.
968 * layout.cc (Layout::set_segment_offsets): Handle
971 * options.h (class General_options): Define -n/--nmagic and
973 * options.cc (General_options::finalize): For -n/--nmagic or
974 -N/--omagic, set -static.
975 * layout.cc (Layout::attach_allocated_section_to_segment): If
976 -N/--omagic, don't put read-only and read-write sections in
978 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
979 finding a read-only segment.
980 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
981 don't set the minimum segment alignment to the common page size,
982 and don't set the file offset to the address modulo the page size.
983 * script-sections.cc (Script_sections::create_segments): If
984 -n/--omagic, don't put read-only and read-write sections in
989 * options.h (class General_options): Add --print-symbol-counts.
990 * main.cc (main): Issue defined symbol report if requested.
991 * archive.cc (Archive::interpret_header): Make into a const member
993 (Archive::add_symbols): Call Input_objects::archive_start and
995 (Archive::const_iterator): Define new class.
996 (Archive::begin, Archive::end): New functions.
997 (Archive::include_all_members): Rewrite to use iterator.
998 (Archive::count_members): New function.
999 * archive.h (class Archive): Update declarations.
1000 (Archive::filename): New function.
1001 * object.cc: Include "cref.h".
1002 (Sized_relobj::Sized_relobj): Initialize defined_count_.
1003 (Sized_relobj::do_get_global_symbol_counts): New function.
1004 (Input_objects::add_object): Add object to cross-referencer.
1005 (Input_objects::archive_start): New function.
1006 (Input_objects::archive_stop): New function.
1007 (Input_objects::print_symbol_counts): New function.
1008 * object.h: Declare Cref and Archive.
1009 (Object::get_global_symbol_counts): New function.
1010 (Object::do_get_global_symbol_counts): New pure virtual function.
1011 (class Sized_relobj): Add defined_count_ field. Update
1013 (class Input_objects): Add cref_ field. Update constructor.
1014 Update declarations.
1015 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
1017 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
1019 (Sized_dynobj::do_get_global_symbol_counts): New function.
1020 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
1021 defined_count_. Update declarations. Define Symbols typedef.
1022 * symtab.cc (Symbol_table::add_from_relobj): Add defined
1023 parameter. Change all callers.
1024 (Symbol_table::add_from_dynobj): Add sympointers and defined
1025 parameters. Change all callers.
1026 * symtab.h (class Symbol_table): Update declarations.
1027 * Makefile.am (CCFILES): Add cref.cc.
1028 (HFILES): Add cref.h.
1029 * Makefile.in: Rebuild.
1031 2008-07-22 Simon Baldwin <simonb@google.com>
1033 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
1034 to zero when writing undefined symbols.
1036 2008-07-22 Ian Lance Taylor <iant@google.com>
1038 * output.cc (Output_section::add_input_section): Don't try to
1039 merge empty merge sections.
1041 2008-07-21 Craig Silverstein <csilvers@google.com>
1043 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
1044 Include symbol version in error message.
1046 2008-07-20 Chris Demetriou <cgd@google.com>
1048 * configure.ac (gold_cv_c_random_seed): New configured variable.
1049 (RANDOM_SEED_CFLAGS): New substituted variable.
1050 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
1051 * configure: Rebuild.
1052 * Makefile.in: Likewise.
1053 * testsuite/Makefile.in: Likewise.
1055 2008-07-18 Ian Lance Taylor <iant@google.com>
1057 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
1058 where we see NAME/NULL and NAME/VERSION as separate symbols.
1059 * testsuite/ver_test_main.cc (main): Call t4.
1060 (t4, t4_2a): Define.
1061 * testsuite/ver_test_2.cc (t4_2): Define.
1062 * testsuite/ver_test_2.script: Put t4_2a in VER2.
1063 * testsuite/ver_test_4.cc (t4_2a): Define.
1064 * testsuite/ver_test_4.script: Put t4_2a in VER2.
1065 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
1067 2008-07-17 Ian Lance Taylor <iant@google.com>
1069 * dynobj.cc (Versions::add_def): If we give an error about a
1070 missing version, go ahead and create the version anyhow.
1072 2008-07-10 Ian Lance Taylor <iant@google.com>
1074 Handle output sections with more than 0x7fffffff bytes.
1075 * object.h (class Relobj): Change map_to_output_ to
1076 output_sections_, and just keep a section pointer. Change all
1077 uses. Move comdat group support to Sized_relobj.
1078 (Relobj::is_section_specially_mapped): Remove.
1079 (Relobj::output_section): Remove poff parameter. Change all
1081 (Relobj::output_section_offset): New function.
1082 (Relobj::set_section_offset): Rewrite.
1083 (Relobj::map_to_output): Remove.
1084 (Relobj::output_sections): New function.
1085 (Relobj::do_output_section_offset): New pure virtual function.
1086 (Relobj::do_set_section_offset): Likewise.
1087 (class Sized_relobj): Add section_offsets_ field. Add comdat
1088 group support from Relobj. Update declarations.
1089 (Sized_relobj::get_output_section_offset): New function.
1090 (Sized_relobj::do_output_section_offset): New function.
1091 (Sized_relobj::do_set_section_offset): New function.
1092 * object.cc (Relobj::output_section_address): Remove.
1093 (Sized_relobj::Sized_relobj): Initialize new fields.
1094 (Sized_relobj::include_section_group): Cast find_kept_object to
1096 (Sized_relobj::include_linkonce_section): Likewise.
1097 (Sized_relobj::do_layout): Use separate arrays for output section
1099 (Sized_relobj::do_count_local_symbols): Change map_to_output to
1101 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
1102 output_sections and section_offsets.
1103 (Sized_relobj::write_local_symbols): Likewise.
1104 (map_to_kept_section): Compute output address directly.
1105 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
1106 output_sections and section_offsets.
1107 (Sized_relobj::write_sections): Likewise.
1108 (Sized_relobj::relocate_sections): Likewise.
1109 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
1110 * output.h (class Output_reloc): Update declarations. Change
1111 u2_.relobj to Sized_relobj*.
1112 (class Output_data_reloc): Change add functions to use
1114 * output.cc (Output_reloc::Output_reloc): Change relobj to
1116 (Output_reloc::local_section_offset): Change return type to
1117 Elf_Addr. Use get_output_section_offset.
1118 (Output_reloc::get_address): Likewise.
1119 (Output_section::is_input_address_mapped): Don't call
1120 is_section_specially_mapped.
1121 (Output_section::output_offset): Likewise.
1122 (Output_section::output_address): Likewise.
1123 (Output_section::starting_output_address): Likewise.
1124 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
1125 parameter to Sized_relobj*.
1126 (Copy_relocs::need_copy_reloc): Likewise.
1127 (Copy_relocs::save): Likewise.
1128 * copy-relocs.h (class Copy_relocs): Update declarations.
1129 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
1130 Sized_relobj*. Change relobj_ field to Sized_relobj*.
1131 * target-reloc.h (relocate_for_relocatable): Change
1132 offset_in_output_section type to Elf_Addr. Change code that uses
1134 * layout.cc (Layout::layout): Always set *off.
1135 * mapfile.cc (Mapfile::print_input_section): Use
1136 output_section_offset.
1137 * i386.cc (Target_i386::copy_reloc): Change object parameter to
1139 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
1140 * sparc.cc (Target_sparc::copy_reloc): Likewise.
1141 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
1143 2008-07-03 Ian Lance Taylor <iant@google.com>
1145 * layout.cc (Layout::include_section): Do not discard unrecognized
1146 SHT_STRTAB sections.
1148 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
1150 * script.cc (Lex::can_continue_name): Make '?' allowable in
1151 version-script names.
1152 * testsuite/version_script.map: Change glob pattern to use '?'
1154 2008-06-30 Manish Singh <yosh@gimp.org>
1157 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
1160 2008-06-30 Ian Lance Taylor <iant@google.com>
1164 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
1165 versions]: Don't try to read the value in the contents, since we
1166 don't use it. Use the template endianness when writing.
1168 2008-06-25 Cary Coutant <ccoutant@google.com>
1170 * fileread.cc (File_read::make_view): Assert on zero-length view.
1171 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
1172 symbol table when there are no symbols to read.
1174 2008-06-23 Craig Silverstein <csilvers@google.com>
1176 * version.cc (version_string): Bump to 1.7
1178 2008-06-18 Craig Silverstein <csilvers@google.com>
1180 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
1181 constant 0xFFFF to type Valtype.
1182 (Powerpc_relocate_functions::rel16_ha): Likewise.
1184 2008-06-17 Ian Lance Taylor <iant@google.com>
1186 * output.h (Output_section::Input_section): Initialize p2align_ to
1187 zero for Output_section_data constructors.
1188 (Output_section::Input_section::addralign): If not an input
1189 section, return the alignment of the Output_section_data.
1190 * testsuite/copy_test.cc: New file.
1191 * testsuite/copy_test_1.cc: New file.
1192 * testsuite/copy_test_2.cc: New file.
1193 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
1194 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
1195 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
1196 (copy_test_1_pic.o, copy_test_1.so): New targets.
1197 (copy_test_2_pic.o, copy_test_2.so): New targets.
1198 * testsuite/Makefile.in: Rebuild.
1200 * script-sections.cc (Script_sections::place_orphan): Initialize
1201 local variable exact.
1203 2008-06-13 David Edelsohn <edelsohn@gnu.org>
1205 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
1207 2008-06-12 David Edelsohn <edelsohn@gnu.org>
1208 David S. Miller <davem@davemloft.net>
1210 * powerpc.cc: New file.
1211 * Makefile.am (TARGETSOURCES): Add powerpc.cc
1212 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
1213 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
1214 * Makefile.in: Rebuild.
1216 2008-06-09 Ian Lance Taylor <iant@google.com>
1218 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
1220 (throwing, orig_terminate): New static variables.
1221 (terminate_handler): New static function.
1222 (t2): Set terminate handler.
1224 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
1227 * binary.cc (Binary_to_elf::sized_convert): Fix .data
1230 2008-05-30 Cary Coutant <ccoutant@google.com>
1232 * archive.cc (Archive::include_all_members) Correct to step
1233 over symbol table and extended name table in thin archives.
1235 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
1238 * target-reloc.h (relocate_for_relocatable): Fix new_offset
1241 2008-05-28 Caleb Howe <cshowe@google.com>
1243 * reduced_debug_output.cc: New file.
1244 * reduced_debug_output.h: New file.
1245 * options.h (class General_options): Add --strip-debug-non-line.
1246 * options.cc (General_options::finalize): Add strip_debug_non_line
1247 to the strip heirarchy.
1248 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
1250 * layout.cc: Include "reduced_debug_output.h".
1251 (Layout::Layout): Initialize new fields.
1252 (line_only_debug_sections): New static array.
1253 (is_lines_only_debug_sections): New static inline function.
1254 (Layout::include_section): Handle --strip-debug-non-line.
1255 (Layout::make_output_section): If --strip-debug-non-line, build
1256 new output sections for .debug_abbrev and .debug_info.
1257 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
1258 gold. Warn about possible overflow.
1259 (read_signed_LEB_128): Likewise.
1260 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
1261 (read_signed_LEB_128): Declare.
1262 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
1263 (HFILES): Add reduced_debug_output.h.
1264 * Makefile.in: Rebuild.
1266 2008-05-21 Ian Lance Taylor <iant@google.com>
1268 * mapfile.cc: New file.
1269 * mapfile.h: New file.
1270 * options.h (class General_options): Add -M/--print-map and -Map.
1271 * options.cc (General_options::finalize): Make -M equivalent to
1273 * main.cc: Include <cstdio> and "mapfile.h".
1274 (main): Open mapfile if requested.
1275 * gold.cc (class Middle_runner): Add mapfile_ field. Update
1276 constructor. Change caller.
1277 (queue_initial_tasks): Add mapfile parameter. Change caller.
1278 (queue_middle_tasks): Likewise.
1279 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
1281 * archive.cc: Include "mapfile.h".
1282 (Archive::add_symbols): Add mapfile parameter. Change all
1283 callers. Pass mapfile, symbol, and reason to include_member.
1284 (Archive::include_all_members): Add mapfile parameter. Change all
1286 (Archive::include_member): Add mapfile, sym, and why parameters.
1287 Change all callers. Report inclusion to map file.
1288 * archive.h: Include "fileread.h".
1289 (class Archive): Update declarations.
1290 (Archive::file): New const method.
1291 (class Add_archive_symbols): Add mapfile_ field. Update
1292 constructor. Change all callers.
1293 * readsyms.h (class Read_symbols): Likewise.
1294 (class Finish_group): Likewise.
1295 (class Read_script): Likewise.
1296 * common.cc: Include "mapfile.h".
1297 (Symbol_table::allocate_commons): Add mapfile parameter. Change
1299 (Symbol_table::do_allocate_commons): Likewise.
1300 (Symbol_table::do_allocate_commons_list): Likewise. Report common
1301 symbol allocation to mapfile.
1302 * common.h (class Allocate_commons_task): Add mapfile_ field.
1303 Update constructor. Change all callers.
1304 * symtab.h (class Symbol_table): Update declarations.
1305 * layout.cc: Include "mapfile.h".
1306 (Layout_task_runner::run): Print information to mapfile.
1307 (Layout::create_gold_note): Change Output_data_fixed_space to
1308 Output_data_zero_fill.
1309 (Layout::create_build_id): Likewise.
1310 (Layout::print_to_mapfile): New function.
1311 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
1312 constructor. Change caller.
1313 (class Layout): Declare print_to_mapfile.
1314 * output.cc (Output_section::Input_section::print_to_mapfile): New
1316 (Output_section::add_input_section): If producing a map, always
1317 add to input_sections_ list.
1318 (Output_section::do_print_to_mapfile): New function.
1319 (Output_segment::print_sections_to_mapfile): New function.
1320 (Output_segment::print_section_list_to_mapfile): New function.
1321 * output.h: Include "mapfile.h".
1322 (Output_data::print_to_mapfile): New function.
1323 (Output_data::do_print_to_mapfile): New virtual function.
1324 (Output_segment_headers::do_print_to_mapfile): New function.
1325 (Output_file_header::do_print_to_mapfile): New function.
1326 (Output_data_const::do_print_to_mapfile): New function.
1327 (class Output_data_const_buffer): Add map_name_ field. Update
1328 constructor. Change all callers. Add do_print_to_mapfile
1330 (class Output_data_fixed_space): Likewise.
1331 (class Output_data_space): Likewise.
1332 (class Output_data_zero_fill): New class.
1333 (Output_data_strtab::do_print_to_mapfile): New function.
1334 (Output_data_reloc_base::do_print_to_mapfile): New function.
1335 (Output_relocatable_relocs::do_print_to_mapfile): New function.
1336 (Output_data_group::do_print_to_mapfile): New function.
1337 (Output_data_got::do_print_to_mapfile): New function.
1338 (Output_data_dynamic::do_print_to_mapfile): New function.
1339 (Output_symtab_xindex::do_print_to_mapfile): New function.
1340 (class Output_section): Declare do_print_to_mapflie. Declare
1341 print_to_mapfile in Input_section.
1342 (class Output_segment): Declare new functions.
1343 * object.h (Sized_relobj::symbol_count): New function.
1344 * script-sections.cc
1345 (Output_section_element_dot_assignment::set_section_addresses):
1346 Change Output_data_fixed_space to Output_data_zero_fill.
1347 (Output_data_expression::do_print_to_mapfile): New function.
1348 * script.cc (read_input_script): Add mapfile parameter. Change
1350 * script.h (read_input_script): Update declaration.
1351 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
1352 (Eh_frame::do_print_to_mapfile): New function.
1353 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
1354 (Output_merge_string::do_print_to_mapfile): New function.
1355 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
1357 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
1359 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
1361 * Makefile.am (CCFILES): Add mapfile.cc.
1362 (HFILES): Add mapfile.h.
1363 * Makefile.in: Rebuild.
1365 2008-05-19 Ian Lance Taylor <iant@google.com>
1367 * options.h (class General_options): Add -z relro.
1368 * layout.cc (Layout::Layout): Initialize relro_segment_.
1369 (Layout::add_output_section_data): Return the output section.
1370 (Layout::make_output_section): Rcognize relro sections and mark
1372 (Layout::attach_allocated_section_to_segment): Put relro sections
1373 in a PT_GNU_RELRO segment.
1374 (Layout::create_initial_dynamic_sections): Mark the .dynamic
1376 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
1378 (Layout::linkonce_mapping): Map d.rel.ro.local to
1380 (Layout::output_section_name): Us .data.rel.ro.local for any
1381 section which begins with that.
1382 * layout.h (class Layout): Update add_output_section_data
1383 declaration. Add relro_segment_ field.
1384 * output.cc (Output_section::Output_section): Initialize is_relro_
1385 and is_relro_local_ fields.
1386 (Output_segment::add_output_section): Group relro sections.
1387 (Output_segment::is_first_section_relro): New function.
1388 (Output_segment::maximum_alignment): If there is a relro section,
1389 align the segment to the common page size.
1390 (Output_segment::set_section_addresses): Track whether we are
1391 looking at relro sections. If the last section is a relro
1392 section, align to the common page size.
1393 (Output_segment::set_section_list_addresses): Add in_relro
1394 parameter. Change all callers. Align to the page size when
1395 moving from relro to non-relro section.
1396 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
1398 * output.h (class Output_section): Add is_relro_ and
1399 is_relro_local_ fields.
1400 (Output_section::is_relro): New function.
1401 (Output_section::set_is_relro): New function.
1402 (Output_section::is_relro_local): New function.
1403 (Output_section::set_is_relro_local): New function.
1404 (class Output_segment): Update declarations.
1405 * i386.cc (Target_i386::got_section): Mark .got section as relro.
1406 * sparc.cc (Target_sparc::got_section): Likewise.
1407 * x86_64.cc (Target_x86_64::got_section): Likewise.
1408 * testsuite/relro_test_main.cc: New file.
1409 * testsuite/relro_test.cc: New file.
1410 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
1411 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
1412 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
1413 (relro_test.so, relro_test_pic.o): New targets.
1414 * testsuite/Makefile.in: Rebuild.
1416 2008-05-16 Ian Lance Taylor <iant@google.com>
1418 * output.cc (Output_segment::add_output_section): Remove front
1420 * output.h (class Output_segment): Remove
1421 add_initial_output_section and overloaded add_output_section.
1422 Update declaration of remaining add_output_section.
1423 * layout.cc (Layout::create_interp): Call add_output_section
1424 rather than add_initial_output_section.
1425 (Layout::finish_dynamic_section): Likewise.
1427 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
1428 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
1429 know the dynamic type.
1430 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
1431 field. Initialize it in constructor.
1432 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
1433 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
1434 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
1437 * output.cc (Output_reloc::get_address): Change return type to
1439 * output.h (class Output_reloc): Update get_address declaration.
1440 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
1441 for section addresses.
1443 2008-05-09 Ian Lance Taylor <iant@google.com>
1446 * gold.cc (gold_nomem): Use return value of write.
1448 2008-05-08 Ian Lance Taylor <iant@google.com>
1450 * symtab.c (Symbol::init_base_output_data): Add version
1451 parameter. Change all callers.
1452 (Symbol::init_base_output_segment): Likewise.
1453 (Symbol::init_base_constant): Likewise.
1454 (Symbol::init_base_undefined): Likewise.
1455 (Sized_symbol::init_output_data): Likewise.
1456 (Sized_symbol::init_output_segment): Likewise.
1457 (Sized_symbol::init_constant): Likewise.
1458 (Sized_symbol::init_undefined): Likewise.
1459 (Symbol_table::do_define_in_output_data): If the new symbol has a
1460 version, mark it as the default.
1461 (Symbol_table::do_define_in_output_segment): Likewise.
1462 (Symbol_table::do_define_as_constant): Likewise.
1463 * symtab.h (class Symbol): Update declarations.
1464 (class Sized_symbol): Likewise.
1465 * resolve.cc (Symbol::override_version): New function.
1466 (Symbol::override_base): Call override_version.
1467 (Symbol::override_base_with_special): Likewise.
1468 * testsuite/ver_script_8.script: New file.
1469 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
1470 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
1471 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
1472 (ver_test_8_1.so, ver_test_8_2.so): New targets.
1474 2008-05-06 Ian Lance Taylor <iant@google.com>
1477 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
1479 (class General_options): Remove existing --undefined, and add
1480 --no-undefined instead. Add new --undefined as synonym for -u.
1481 * archive.cc (Archive::add_symbols): Check whether symbol was
1483 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
1484 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
1485 all uses. Add IS_UNDEFINED. Update declarations to split
1486 different versions of init_base. Declare init_base_undefined.
1487 (Symbol::is_defined): Handle IS_UNDEFINED.
1488 (Symbol::is_undefined): Likewise.
1489 (Symbol::is_weak_undefined): Call is_undefined.
1490 (Symbol::is_absolute): Handle IS_CONSTANT.
1491 (class Sized_symbol): Update declarations to split different
1492 versions of init. Declare init_undefined.
1493 (class Symbol_table): Declare new functions.
1494 * symtab.cc (Symbol::init_base_object): Rename from init_base.
1496 (Symbol::init_base_output_data): Likewise.
1497 (Symbol::init_base_output_segment): Likewise.
1498 (Symbol::init_base_constant): Likewise.
1499 (Symbol::init_base_undefined): New function.
1500 (Sized_symbol::init_object): Rename from init. Change all
1502 (Sized_symbol::init_output_data): Likewise.
1503 (Sized_symbol::init_output_segment): Likewise.
1504 (Sized_symbol::init_constant): Likewise.
1505 (Sized_symbol::init_undefined): New function.
1506 (Symbol_table::add_undefined_symbols_from_command_line): New
1508 (Symbol_table::do_add_undefined_symbols_from_command_line): New
1510 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
1511 (Symbol::output_section): Likewise.
1512 (Symbol::set_output_section): Likewise.
1513 (Symbol_table::sized_finalize_symbol): Likewise.
1514 (Symbol_table::sized_write_globals): Likewise.
1515 * resolve.cc (Symbol_table::should_override): Likewise.
1516 (Symbol::override_base_with_special): Likewise.
1518 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
1519 symbol, change it to have default visibility.
1520 * testsuite/protected_1.cc: New file.
1521 * testsuite/protected_2.cc: New file.
1522 * testsuite/protected_3.cc: New file.
1523 * testsuite/protected_main_1.cc: New file.
1524 * testsuite/protected_main_2.cc: New file.
1525 * testsuite/protected_main_3.cc: New file.
1526 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
1527 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
1528 (protected_1_LDFLAGS, protected_1_LDADD): Define.
1529 (protected_1.so): New target.
1530 (protected_1_pic.o, protected_2_pic.o): New targets.
1531 (protected_3_pic.o): New target.
1532 (check_PROGRAMS): Add protected_2.
1533 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
1534 (protected_2_LDFLAGS, protected_2_LDADD): Define.
1535 * testsuite/Makefile.in: Rebuild.
1537 * options.h (DEFINE_var): Add set_user_set_##varname__.
1538 (DEFINE_bool_alias): New macro.
1539 (class General_options): Define -Bstatic using DEFINE_bool_alias
1540 rather than DEFINE_special. Add --undefined as an alias for -z
1542 * options.cc (General_options::parse_Bstatic): Remove.
1544 * options.h (class General_options): Add --fatal-warnings.
1545 * main.cc (main): Implement --fatal-warnings.
1546 * errors.h (Errors::warning_count): New function.
1548 * options.h (class General_options): Add -Bsymbolic-functions.
1549 * symtab.h (Symbol::is_preemptible): Check for
1550 -Bsymbolic-functions.
1552 2008-05-05 Ian Lance Taylor <iant@google.com>
1554 * options.h (DEFINE_bool): For DASH_Z, create the negative option
1555 as noVARNAME rather than no-VARNAME.
1556 (class General_options): Add option -z combreloc.
1557 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
1559 (Output_reloc::sort_before) [SHT_REL]: New function.
1560 (Output_reloc::sort_before) [SHT_RELA]: New function.
1561 (class Output_data_reloc_base): Add sort_relocs_ field. Define
1562 Sort_relocs_comparison.
1563 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
1564 parameter. Change all callers.
1565 (Output_data_reloc::Output_data_reloc) [both versions]: Add
1566 sort_relocs parameter. Change all callers.
1567 * output.cc (Output_reloc::get_address): New function, broken out
1569 (Output_reloc::write_rel): Call it.
1570 (Output_reloc::compare): New function.
1571 (Output_data_reloc_base::do_write): Optionally sort relocs.
1573 * configure.ac: If targ_extra_obj is set, link it in.
1574 * configure.tgt: Initialize all variables.
1575 (x86_64*): Set targ_extra_obj and targ_extra_size.
1576 * configure: Rebuild.
1578 * object.cc (Sized_relobj::include_section_group): Adjust section
1579 indexes read from group data. Build vector to pass to
1581 * layout.cc (Layout::layout_group): Add flags and shndxes
1582 parameters. Remove contents parameter. Change caller. Update
1583 explicit instantiations.
1584 * layout.h (class Layout): Update layout_group declaration.
1585 * output.cc (Output_data_group::Output_data_group): Add flags and
1586 input_shndxes parameters. Remove contents parameter. Change
1588 (Output_data_group::do_write): Change input_sections_ to
1590 * output.h (class Output_data_group): Update constructor
1591 declaration. Rename input_sections_ to input_shndxes_.
1592 * testsuite/many_sections_test.cc: Add template.
1594 2008-04-30 Cary Coutant <ccoutant@google.com>
1596 * target-reloc.h (relocate_section): Fix dead-pointer bug.
1598 * layout.cc (Layout::include_section): Refactored check for debug
1600 (Layout::add_comdat): Add new parameters. Change type
1601 of signature parameter. Add object and shndx to signatures table.
1602 (Layout::find_kept_object): New function.
1603 * layout.h: Include <cstring>.
1604 (Layout::is_debug_info_section): New function.
1605 (Layout::add_comdat): Add new parameters.
1606 (Layout::find_kept_object): New function.
1607 (Layout::Kept_section): New struct.
1608 (Layout::Signatures): Change type of map range.
1609 * object.cc (Relobj::output_section_address): New function.
1610 (Sized_relobj::include_section_group): Add new parameters. Change
1611 calls to Layout::add_comdat. Change to build table of kept comdat
1612 groups and table mapping discarded sections to kept sections.
1613 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
1614 (Sized_relobj::do_layout): Change calls to include_section_group and
1615 include_linkonce_section.
1616 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
1617 value to zero when section is discarded.
1618 (Sized_relobj::map_to_kept_section): New function.
1619 * object.h (Relobj::output_section_address): New function.
1620 (Relobj::Comdat_group): New type.
1621 (Relobj::find_comdat_group): New function.
1622 (Relobj::Comdat_group_table): New type.
1623 (Relobj::Kept_comdat_section): New type.
1624 (Relobj::Kept_comdat_section_table): New type.
1625 (Relobj::add_comdat_group): New function.
1626 (Relobj::set_kept_comdat_section): New function.
1627 (Relobj::get_kept_comdat_section): New function.
1628 (Relobj::comdat_groups_): New field.
1629 (Relobj::kept_comdat_sections_): New field.
1630 (Symbol_value::input_value): Update comment.
1631 (Sized_relobj::map_to_kept_section) New function.
1632 (Sized_relobj::include_linkonce_section): Add new parameter.
1633 * target-reloc.h (Comdat_behavior): New type.
1634 (get_comdat_behavior): New function.
1635 (relocate_section): Add code to map a discarded section to the
1636 corresponding kept section when applying a relocation.
1638 2008-04-30 Craig Silverstein <csilvers@google.com>
1640 * dwarf_reader.cc (next_generation_count): New static var.
1641 (Addr2line_cache_entry): New struct.
1642 (addr2line_cache): New static var.
1643 (Dwarf_line_info::one_addr2line): Added caching.
1644 (Dwarf_line_info::clear_addr2line_cache): New function.
1645 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
1646 cache-size parameter.
1647 (Dwarf_line_info::one_addr2line_cache): New function.
1648 * symtab.cc (Symbol_table::detect_odr_violations): Pass
1649 new cache-size argument to one_addr2line(), and clear cache.
1651 2008-04-28 Cary Coutant <ccoutant@google.com>
1653 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
1654 R_386_PC8 relocations.
1656 2008-04-23 Ian Lance Taylor <iant@google.com>
1658 * object.cc (Sized_relobj::include_section_group): Check for
1659 invalid section group.
1661 * object.cc (make_elf_object): Correct test for 64-bit ELF file
1664 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
1665 than read for file header.
1666 * archive.cc (Archive::include_member): Likewise.
1668 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
1670 * aclocal.m4: Regenerate.
1671 * configure: Regenerate.
1673 2008-04-19 Ian Lance Taylor <iant@google.com>
1675 * version.cc (version_string): Bump to 1.6.
1677 * testsuite/Makefile.am (many_sections_r_test): New target.
1678 (many_sections_r_test_SOURCES): Remove.
1679 (many_sections_r_test_DEPENDENCIES): Remove.
1680 (many_sections_r_test_LDFLAGS): Remove.
1681 (many_sections_r_test_LDADD): Remove.
1683 * object.cc (Sized_relobj::do_add_symbols): Always pass
1684 local_symbol_count_ to add_from_relobj.
1686 * testsuite/Makefile.am (many_sections_check.h): Only check one in
1687 every thousand variables.
1688 * testsuite/Makefile.in: Rebuild.
1690 * object.cc (Xindex::initialize_symtab_xindex): New function.
1691 (Xindex::read_symtab_xindex): New function.
1692 (Xindex::sym_xindex_to_shndx): New function.
1693 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
1695 (Sized_relobj::do_initialize_xindex): New function.
1696 (Sized_relobj::do_read_symbols): Adjust section links.
1697 (Sized_relobj::symbol_section_and_value): Add is_ordinary
1698 parameter. Change all callers.
1699 (Sized_relobj::include_section_group): Adjust section links and
1700 symbol section indexes.
1701 (Sized_relobj::do_layout): Adjust section links.
1702 (Sized_relobj::do_count_local_symbols): Adjust section links and
1703 symbol section indexes.
1704 (Sized_relobj::do_finalize_local_symbols): Distinguish between
1705 ordinary and special symbols.
1706 (Sized_relobj::write_local_symbols): Add symtab_xindex and
1707 dynsym_xindex parameters. Change all callers. Adjust section
1708 links. Use SHN_XINDEX when needed.
1709 (Sized_relobj::get_symbol_location_info): Adjust section links.
1710 Don't get fooled by special symbols.
1711 * object.h (class Xindex): Define.
1712 (class Object): Add xindex_ parameter. Declare virtual functoin
1713 do_initialize_xindex.
1714 (Object::adjust_sym_shndx): New function.
1715 (Object::set_xindex): New protected function.
1716 (class Symbol_value): Add is_ordinary_shndx_ field.
1717 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
1718 (Symbol_value::value): Assert ordinary section.
1719 (Symbol_value::initialize_input_to_output_map): Likewise.
1720 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
1722 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
1724 (class Sized_relobj): Update declarations.
1725 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
1726 parameter. Change all callers.
1727 (Sized_relobj::adjust_shndx): New function.
1728 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
1730 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
1731 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
1732 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
1733 (Sized_dynobj::read_dynsym_section): Adjust section links.
1734 (Sized_dynobj::read_dynamic): Likewise.
1735 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
1737 (Sized_dynobj::do_initialize_xindex): New function.
1738 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
1739 do_initialize_xindex.
1740 (Sized_dynobj::adjust_shndx): New function.
1741 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
1742 dynsym_xindex_ fields.
1743 (Layout::finalize): Add a call to set_section_indexes before
1744 creating the symtab sections.
1745 (Layout::set_section_indexes): Don't do anything if the section
1746 already has a section index.
1747 (Layout::create_symtab_sections): Add shnum parameter. Change
1748 caller. Create .symtab_shndx section if needed.
1749 (Layout::create_shdrs): Add shstrtab_section parameter. Change
1751 (Layout::allocated_output_section_count): New function.
1752 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
1754 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
1755 fields. Update declarations.
1756 (Layout::symtab_xindex): New function.
1757 (Layout::dynsym_xindex): New function.
1758 (class Write_symbols_task): Add layout_ field.
1759 (Write_symbols_task::Write_symbols_task): Add layout parameter.
1761 * output.cc (Output_section_headers::Output_section_headers): Add
1762 shstrtab_section parameter. Change all callers.
1763 (Output_section_headers::do_sized_write): Store overflow values
1764 for section count and section string table section index in
1765 section header zero.
1766 (Output_file_header::do_sized_write): Check for overflow of
1767 section count and section string table section index.
1768 (Output_symtab_xindex::do_write): New function.
1769 (Output_symtab_xindex::endian_do_write): New function.
1770 * output.h (class Output_section_headers): Add shstrtab_section_.
1771 Update declarations.
1772 (class Output_symtab_xindex): Define.
1773 (Output_section::has_out_shndx): New function.
1774 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
1776 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
1778 (Sized_symbol::init): Likewise.
1779 (Symbol::output_section): Check for ordinary symbol.
1780 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
1781 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
1783 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
1784 Change all callers. Simplify handling of symbols from sections
1785 not included in the link.
1786 (Symbol_table::add_from_dynobj): Handle ordinary symbol
1788 (Weak_alias_sorter::operator()): Assert that symbols are
1790 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
1792 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
1793 parameters. Change all callers.
1794 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
1795 symbol distinction. Use SHN_XINDEX when needed.
1796 (Symbol_table::write_section_symbol): Add symtab_xindex
1797 parameter. Change all callers.
1798 (Symbol_table::sized_write_section_symbol): Likewise. Use
1799 SHN_XINDEX when needed.
1800 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
1802 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
1803 (Symbol::is_defined): Check is_ordinary.
1804 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
1805 (Symbol::is_absolute, Symbol::is_common): Likewise.
1806 (class Sized_symbol): Update declarations.
1807 (class Symbol_table): Update declarations.
1808 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
1809 parameters. Change all callers.
1810 (Sized_symbol::override): Likewise.
1811 (Symbol_table::override): Likewise.
1812 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
1813 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
1814 is_ordinary, and orig_st_shndx parameters. Change all callers.
1815 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
1816 to be in an ordinary section.
1817 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
1818 object and is_ordinary parameters. Change all callers.
1819 (Sized_dwarf_line_info::read_relocs): Add object parameter.
1820 Change all callers. Don't add undefined or non-ordinary symbols
1822 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
1824 * dwarf_reader.h (class Sized_dwarf_line_info): Update
1826 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
1827 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
1828 (Sized_relobj::relocate_sections): Likewise.
1829 * target-reloc.h (scan_relocs): Adjust section symbol index.
1830 (scan_relocatable_relocs): Likewise.
1831 * i386.cc (Scan::local): Check for ordinary symbols.
1832 * sparc.cc (Scan::local): Likewise.
1833 * x86_64.cc (Scan::local): Likewise.
1834 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
1835 to symbol_section_and_value.
1836 * testsuite/many_sections_test.cc: New file.
1837 * testsuite/Makefile.am (BUILT_SOURCES): Define.
1838 (check_PROGRAMS): Add many_sections_test.
1839 (many_sections_test_SOURCES): Define.
1840 (many_sections_test_DEPENDENCIES): Define.
1841 (many_sections_test_LDFLAGS): Define.
1842 (BUILT_SOURCES): Add many_sections_define.h.
1843 (many_sections_define.h): New target.
1844 (BUILT_SOURCES): Add many_sections_check.h.
1845 (many_sections_check.h): New target.
1846 (check_PROGRAMS): Add many_sections_r_test.
1847 (many_sections_r_test_SOURCES): Define.
1848 (many_sections_r_test_DEPENDENCIES): Define.
1849 (many_sections_r_test_LDFLAGS): Define.
1850 (many_sections_r_test_LDADD): Define.
1851 (many_sections_r_test.o): New target.
1852 * testsuite/Makefile.in: Rebuild.
1854 2008-04-17 Cary Coutant <ccoutant@google.com>
1856 * errors.cc (Errors::info): New function.
1857 (gold_info): New function.
1858 * errors.h (Errors::info): New function.
1859 * gold.h (gold_info): New function.
1860 * object.cc (Input_objects::add_object): Print trace output.
1861 * options.cc (options::parse_set): New function.
1862 (General_options::parse_wrap): Deleted.
1863 (General_options::General_options): Deleted initializer.
1864 * options.h (options::String_set): New typedef.
1865 (options::parse_set): New function.
1866 (DEFINE_set): New macro.
1867 (General_options::wrap): Changed to use DEFINE_set. Changed
1868 callers of any_wrap_symbols and is_wrap_symbol.
1869 (General_options::trace, General_options::trace_symbol):
1871 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
1872 (General_options::wrap_symbols_): Deleted.
1873 * symtab.cc (Symbol_table::add_from_object): Print trace output.
1875 2008-04-17 David S. Miller <davem@davemloft.net>
1877 * options.cc (General_options::parse_V): New function.
1878 * options.h: Add entries for -V and -Qy.
1880 2008-04-17 Ian Lance Taylor <iant@google.com>
1882 * common.cc (Symbol_table::allocate_commons): Remove options
1883 parameter. Change caller.
1884 (Symbol_table::do_allocate_commons): Remove options parameter.
1885 Change caller. Just call do_allocate_commons_list twice.
1886 (Symbol_table::do_allocate_commons_list): New function, broken out
1887 of do_allocate_commons.
1888 * common.h (class Allocate_commons_task): Remove options_ field.
1890 * symtab.cc (Symbol_table::Symbol_table): Initialize
1892 (Symbol_table::add_from_object): Put TLS common symbols on
1894 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
1895 which are IN_OUTPUT_DATA.
1896 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
1897 allocate_commons and do_allocate_commons declarations. Declare
1898 do_allocate_commons_list.
1899 * gold.cc (queue_middle_tasks): Update creation of
1900 Allocate_commons_task to not pass options.
1901 * testsuite/Makefile.am (INCLUDES): Add -I.. .
1902 (TLS_TEST_C_FLAGS): New variable.
1903 (tls_test_c_pic.o): New target.
1904 (tls_test_shared.so): Link in tls_test_c_pic.o.
1905 (tls_test_c_pic_ie.o): New target.
1906 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
1907 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
1908 (tls_test_c.o): New target.
1909 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
1910 (tls_pic_test_LDADD): Likewise.
1911 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
1912 (tls_shared_gd_to_ie_test_LDADD): Likewise.
1913 (tls_test_c_gnu2.o): New target.
1914 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
1916 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
1917 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
1918 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
1919 * testsuite/tls_test.cc: Include "config.h".
1920 (t_last): Call t11_last.
1921 * testsuite/tls_test.h (t11, t11_last): Declare.
1922 * testsuite/tls_test_c.c: New file.
1923 * testsuite/tls_test_main.cc (thread_routine): Call t11.
1924 * configure.ac: Check for OpenMP support.
1925 * configure, config.in, Makefile.in: Rebuild.
1926 * testsuite/Makefile.in: Rebuild.
1928 2008-04-16 Cary Coutant <ccoutant@google.com>
1930 * i386.cc (Target_i386::define_tls_base_symbol): New function.
1931 (Target_i386::tls_base_symbol_defined_): New field.
1932 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
1933 (Target_i386::Scan::global): Likewise.
1934 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
1935 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
1936 (Target_x86_64::tls_base_symbol_defined_): New field.
1937 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
1938 (Target_x86_64::Scan::global): Likewise.
1940 2008-04-16 Cary Coutant <ccoutant@google.com>
1942 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
1943 (Symbol::needs_plt_entry): Allow weak undefined symbols.
1944 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
1945 building shared libraries.
1946 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
1947 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
1948 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
1949 * testsuite/Makefile.in: Rebuild.
1950 * testsuite/weak_undef.h: New file.
1951 * testsuite/weak_undef_file1.cc: Add extra test cases.
1952 * testsuite/weak_undef_file2.cc: Likewise.
1953 * testsuite/weak_undef_test.cc: Likewise.
1955 2008-04-16 David S. Miller <davem@davemloft.net>
1957 * sparc.cc (Target_sparc::Scan): Change from struct to class.
1958 Add issued_non_pic_error_ field. Declare check_non_pic.
1959 (Target_sparc::Scan::check_non_pic): New function.
1960 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
1961 (Target_sparc::Scan::global): Likewise.
1963 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
1964 * configure: Rebuild.
1966 * options.h (DEFINE_enable): New macro.
1967 (new_dtags): New enable option.
1968 (initfirst, interpose, loadfltr, nodefaultlib,
1969 nodelete, nodlopen, nodump): New -z options.
1970 * layout.cc (Layout:finish_dynamic_section): If new
1971 dtags enabled, emit DT_RUNPATH. Also, emit a
1972 DT_FLAGS_1 containing any specified -z flags.
1974 2008-04-16 Ian Lance Taylor <iant@google.com>
1976 * copy-relocs.cc: New file.
1977 * copy-relocs.h: New file.
1978 * reloc.cc: Remove Copy_relocs code.
1979 * reloc.h: Likewise.
1980 * reloc-types.h (struct Reloc_types) [both versions]: Add
1981 get_reloc_addend_noerror.
1982 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
1983 variants of add_global which take an addend which must be zero.
1984 * i386.cc: Include "copy-relocs.h".
1985 (class Target_i386): Change type of copy_relocs_ to variable,
1987 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
1989 (Target_i386::do_finalize_sections): Change handling of
1991 * sparc.cc: Include "copy-relocs.h".
1992 (class Target_sparc): Change type of copy_relocs_ to variable,
1994 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
1996 (Target_sparc::do_finalize_sections): Change handling of
1998 * x86_64.cc: Include "copy-relocs.h".
1999 (class Target_x86_64): Change type of copy_relocs_ to variable,
2001 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
2002 class. Change all callers.
2003 (Target_x86_64::do_finalize_sections): Change handling of
2005 * Makefile.am (CCFILES): Add copy-relocs.cc.
2006 (HFILES): Add copy-relocs.h.
2008 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
2010 * testsuite/script_test_4.sh: Permit leading zeroes.
2012 2008-04-15 Ian Lance Taylor <iant@google.com>
2014 * script-sections.cc (Script_sections::create_segments): Use
2015 header_size_adjustment even when there is enough room for the
2017 * testsuite/script_test_4.sh: New file.
2018 * testsuite/script_test_4.t: New file.
2019 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
2020 (check_DATA): Add script_test_4.stdout.
2021 (MOSTLYCLEANFILES): Likewise.
2022 (script_test_4): New target.
2023 (script_test_4.stdout): New target.
2024 * testsuite/Makefile.in: Rebuild.
2026 * sparc.cc: Add definitions for Output_data_plt_sparc class
2029 2008-04-14 David S. Miller <davem@davemloft.net>
2031 * sparc.cc: New file.
2032 * Makefile.am (TARGETSOURCES): Add sparc.cc
2033 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
2034 * configure.tgt: Document targ_extra_size and
2035 targ_extra_big_endian. Add entries for sparc-* and
2037 * configure.ac: Handle targ_extra_size and
2038 targ_extra_big_endian.
2039 * Makefile.in: Rebuild.
2040 * configure: Likewise.
2041 * po/POTFILES.in: Likewise.
2042 * po/gold.pot: Likewise.
2044 2008-04-14 Ian Lance Taylor <iant@google.com>
2046 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
2047 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
2048 in the name/type/flags to section mapping. Don't call
2049 allocate_output_section.
2050 (Layout::choose_output_section): Change parameter from adjust_name
2051 to is_input_section. Don't permit input sections after sections
2052 are attached to segments. Don't call allocate_output_section.
2053 (Layout::layout_eh_frame): Call update_flags_for_input_section,
2054 not write_enable_output_section.
2055 (Layout::make_output_section): Don't push to
2056 unattached_section_list_ nor call attach_to_segment. Call
2057 attach_section_to_segment if sections are attached.
2058 (Layout::attach_sections_to_segments): New function.
2059 (Layout::attach_section_to_segment): New function.
2060 (Layout::attach_allocated_section_to_segment): Rename from
2061 attach_to_segment. Remove flags parameter.
2062 (Layout::allocate_output_section): Remove function.
2063 (Layout::write_enable_output_section): Remove function.
2064 * layout.h (class Layout): Update for above changes. Add new
2065 field sections_are_attached_.
2066 * output.h (Output_section::update_flags_for_input_section): New
2068 * output.cc (Output_section::add_input_section): Call
2069 update_flags_for_input_section.
2070 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
2072 2008-04-11 Cary Coutant <ccoutant@google.com>
2074 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
2075 thought unnecessary.
2076 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
2078 2008-04-11 Ian Lance Taylor <iant@google.com>
2080 * output.h (class Output_section_data): Remove inline definition
2082 * output.cc (Output_section_data::set_addralign): New function.
2084 2008-04-11 Cary Coutant <ccoutant@google.com>
2086 Add support for TLS descriptors for i386 and x86_64.
2087 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
2088 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
2089 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
2091 (Target_i386::got_mod_index_entry): Remove unnecessary code.
2092 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
2093 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
2095 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
2096 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
2097 Fix problem with initial-exec relocations.
2098 (Target_i386::Relocate::relocate_tls): Likewise.
2099 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
2101 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
2102 support for section-plus-offset dynamic table entries.
2103 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
2104 (Output_data_dynamic::Dynamic_entry): Add support for
2105 section-plus-offset dynamic table entries.
2106 (Output_data_dynamic::Classification): Likewise.
2107 (Output_data_dynamic::classification_): Renamed offset_.
2108 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
2109 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
2110 (Target_x86_64::make_plt_section): New function.
2111 (Target_x86_64::reserve_tlsdesc_entries): New function.
2112 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
2113 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
2114 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
2115 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
2116 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
2117 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
2118 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
2119 add extra PLT entry for TLS descriptors.
2120 (Output_data_plt_x86_64::got_): New field.
2121 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
2122 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
2124 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
2126 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
2127 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
2128 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
2129 R_386_TLS_DESC_CALL relocations.
2130 (Target_x86_64::Scan::global): Likewise.
2131 (Target_x86_64::do_finalize_sections): Add dynamic table entries
2132 for TLS descriptors.
2133 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
2134 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
2135 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
2136 GD-to-IE relaxation.
2137 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
2138 and TLS_DESCRIPTORS.
2139 * Makefile.in: Rebuild.
2140 * configure: Rebuild.
2141 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
2142 (tls_test_shared2.so): New target.
2143 (tls_shared_gd_to_ie_test_SOURCES): New variable.
2144 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
2145 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
2146 (tls_shared_gd_to_ie_test_LDADD): New variable.
2147 (tls_shared_gnu2_gd_to_ie_test): New target.
2148 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
2150 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
2151 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
2152 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
2153 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
2154 (tls_shared_gnu2_test): New target.
2155 (tls_test_gnu2_shared.so): New target.
2156 (tls_shared_gnu2_test_SOURCES): New variable.
2157 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
2158 (tls_shared_gnu2_test_LDFLAGS): New variable.
2159 (tls_shared_gnu2_test_LDADD): New variable.
2160 * testsuite/Makefile.in: Rebuild.
2161 * testsuite/Makefile.
2163 2008-04-11 Ian Lance Taylor <iant@google.com>
2165 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
2167 * testsuite/Makefile.in: Rebuild.
2169 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
2171 * testsuite/script_test_2.cc (main): Adjust test.
2173 2008-04-11 David S. Miller <davem@davemloft.net>
2174 Ian Lance Taylor <iant@google.com>
2176 * options.h (General_options): Add entries for '-Y' and
2178 * options.cc (General_options:finalize): If -Y was used, add those
2179 entries to the library path instead of the default "/lib" and
2182 2008-04-11 David S. Miller <davem@davemloft.net>
2184 * testsuite/justsyms.t: Start at 0x100.
2185 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
2186 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
2188 * testsuite/script_test_2.cc: Adjust string and section length
2191 2008-04-09 Ian Lance Taylor <iant@google.com>
2194 * script-sections.cc (Sections_element::allocate_to_segment): Add
2196 (Output_section_definition::allocate_to_segment): Likewise.
2197 (Orphan_output_section::allocate_to_segment): Likewise.
2198 (Script_sections::attach_sections_using_phdrs_clause): Don't
2199 propagate non-PT_LOAD segments to orphan sections.
2200 * testsuite/Makefile.am (script_test_3.stdout): Generate using
2201 readelf rather than objdump.
2202 * testsuite/script_test_3.sh: Adjust accordingly. Test that
2203 .interp section and PT_INTERP segment are the same size.
2204 * testsuite/Makefile.in: Rebuild.
2206 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
2207 aliases for symbols defined in the same object.
2208 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
2209 (weak_alias_test_SOURCES): New variable.
2210 (weak_alias_test_DEPENDENCIES): New variable.
2211 (weak_alias_test_LDFLAGS): New variable.
2212 (weak_alias_test_LDADD): New variable.
2213 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
2214 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
2215 (weak_alias_test_3.o): New target.
2216 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
2217 * testsuite/weak_alias_test_main.cc: New file.
2218 * testsuite/weak_alias_test_1.cc: New file.
2219 * testsuite/weak_alias_test_2.cc: New file.
2220 * testsuite/weak_alias_test_3.cc: New file.
2222 2008-04-08 Ian Lance Taylor <iant@google.com>
2224 * options.h (class General_options): Add --noinhibit-exec option.
2225 * main.cc (main): Check --noinhibit-exec.
2227 * options.h (class General_options): Define --wrap as a special
2228 option. Add wrap_symbols_ field.
2229 (General_options::any_wrap_symbols): New function.
2230 (General_options::is_wrap_symbol): New function.
2231 * options.cc (General_options::parse_wrap): New function.
2232 (General_options::General_options): Initialize wrap_symbols_.
2233 * symtab.cc (Symbol_table::wrap_symbol): New function.
2234 (Symbol_table::add_from_object): Handle --wrap.
2235 * symtab.h (class Symbol_table): Declare wrap_symbol.
2236 * target.h (Target::wrap_char): New function.
2237 (Target::Target_info): Add wrap_char field.
2238 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
2239 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2240 * testsuite/testfile.cc (Target_test::test_target_info):
2243 * errors.cc (Errors::undefined_symbol): Mention symbol version if
2246 * layout.h (class Layout): Add added_eh_frame_data_ field.
2247 * layout.cc (Layout::Layout): Initialize new field.
2248 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
2249 output section until we find a section we merged successfully.
2250 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
2251 that the size be non-zero.
2253 * merge.cc (Object_merge_map::get_output_offset): Remove inline
2256 2008-04-08 Craig Silverstein <csilvers@google.com>
2258 * configure.ac: Export new conditional variable HAVE_ZLIB.
2259 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
2261 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
2262 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
2264 2008-04-07 Ian Lance Taylor <iant@google.com>
2266 * version.cc (version_string): Set to "1.5".
2268 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
2269 Add issued_non_pic_error_ field. Declare check_non_pic.
2270 (Target_x86_64::Scan::check_non_pic): New function.
2271 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
2272 (Target_x86_64::Scan::global): Likewise.
2274 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
2275 addend parameter. Change caller. Handle merge sections.
2276 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
2277 Address to Addend. Don't add in the result of
2278 local_section_offset, pass down the addend and use the returned
2280 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
2281 Update declarations of local_section_offset and symbol_value.
2282 * testsuite/two_file_test_1.cc (t18): New function.
2283 * testsuite/two_file_test_2.cc (f18): New function.
2284 * testsuite/two_file_test_main.cc (main): Call t18.
2285 * testsuite/two_file_test.h (t18, f18): Declare.
2287 * configure.ac: Don't test for objdump, c++filt, or readelf.
2288 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
2290 (TEST_READELF): New variable.
2291 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
2292 (check_PROGRAMS): Add two_file_strip_test.
2293 (two_file_strip_test): New target.
2294 (check_PROGRAMS): Add two_file_same_shared_strip_test.
2295 (two_file_same_shared_strip_test_SOURCES): New variable.
2296 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
2297 (two_file_same_shared_strip_test_LDFLAGS): New variable.
2298 (two_file_same_shared_strip_test_LDADD): New variable.
2299 (two_file_shared_strip.so): New target.
2300 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
2301 (ver_test_5.syms, ver_test_7.syms): Likewise.
2302 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
2303 (strip_test_3.stdout): Use TEST_OBJDUMP.
2304 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
2306 2008-04-04 Cary Coutant <ccoutant@google.com>
2308 * symtab.h (Symbol::is_weak_undefined): New function.
2309 (Symbol::is_strong_undefined): New function.
2310 (Symbol::is_absolute): New function.
2311 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
2312 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
2314 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
2315 (weak_undef_test): New target.
2316 * testsuite/Makefile.in: Rebuild.
2317 * testsuite/weak_undef_file1.cc: New file.
2318 * testsuite/weak_undef_file2.cc: New file.
2319 * testsuite/weak_undef_test.cc: New file.
2321 2008-04-03 Craig Silverstein <csilvers@google.com>
2323 * compressed_output.h (class Output_compressed_section): Use
2325 * compressed_output.cc (zlib_compress): Use unsigned buffers,
2327 (zlib_compressed_suffix): Removed.
2328 (Output_compressed_section::set_final_data_size): Use unsigned
2330 * testsuite/Makefile.am (flagstest_compress_debug_sections):
2331 Fix linker invocation.
2332 (flagstest_o_specialfile_and_compress_debug_sections):
2334 * testsuite/Makefile.in: Regenerated.
2336 2008-04-02 David S. Miller <davem@davemloft.net>
2338 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
2339 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
2341 2008-04-02 Craig Silverstein <csilvers@google.com>
2345 2008-04-02 Ian Lance Taylor <iant@google.com>
2347 * fileread.cc (File_read::find_view): Add byteshift and vshifted
2348 parameters. Update for new key type to views_. Change all
2350 (File_read::read): Adjust for byteshift in returned view.
2351 (File_read::add_view): New function, broken out of
2353 (File_read::make_view): New function, broken out of
2355 (File_read::find_or_make_view): Add offset and aligned
2356 parameters. Rewrite accordingly. Change all callers.
2357 (File_read::get_view): Add offset and aligned parameters. Adjust
2358 for byteshift in return value.
2359 (File_read::get_lasting_view): Likewise.
2360 * fileread.h (class File_read): Update declarations.
2361 (class File_read::View): Add byteshift_ field. Add byteshift to
2362 constructor. Add byteshift method.
2363 * archive.h (Archive::clear_uncached_views): New function.
2364 (Archive::get_view): Add aligned parameter. Change all callers.
2365 * object.h (Object::get_view): Add aligned parameter. Change all
2367 (Object::get_lasting_view): Likewise.
2369 * fileread.cc (File_read::release): Don't call clear_views if
2370 there are multiple objects.
2371 * fileread.h (File_read::clear_uncached_views): New function.
2372 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
2375 2008-03-31 Cary Coutant <ccoutant@google.com>
2377 Add thin archive support.
2378 * archive.cc (Archive::armagt): New const.
2379 (Archive::setup): Remove task parameter and calls to unlock.
2380 (Archive::unlock_nested_archives): New function.
2381 (Archive::read_header): Add nested_off parameter. Change
2383 (Archive::interpret_header): Likewise.
2384 (Archive::include_all_members): Change to handle thin
2386 (Archive::include_member): Likewise.
2387 * archive.h (Archive::Archive): Add new parameters and
2389 (Archive::armagt): New const.
2390 (Archive::setup): Remove task parameter.
2391 (Archive::unlock_nested_archives): New function.
2392 (Archive::read_header): Add nested_off parameter.
2393 (Archive::interpret_header): Likewise.
2394 (Archive::Nested_archive_table): New typedef.
2395 (Archive::is_thin_archive_): New field.
2396 (Archive::nested_archives_): New field.
2397 (Archive::options_): New field.
2398 (Archive::dirpath_): New field.
2399 (Archive::task_): New field.
2400 * readsyms.cc (Read_symbols::do_read_symbols): Add check
2401 for thin archives. Pass additional parameters to
2402 Archive::Archive. Unlock the archive file after calling
2405 2008-03-29 Ian Lance Taylor <iant@google.com>
2407 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
2408 version symbol to be local.
2409 * testsuite/ver_test_4.sh: New file.
2410 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
2411 (check_DATA): Add ver_test_4.syms.
2412 (ver_test_4.syms): New target.
2413 * testsuite/Makefile.in: Rebuild.
2416 (Output_section::Input_section_sort_entry::has_priority): New
2418 (Output_section::Input_section_sort_entry::match_file_name): New
2420 (Output_section::Input_section_sort_entry::match_section_name):
2422 (Output_section::Input_section_sort_entry::match_section_name_prefix):
2424 (Output_section::Input_section_sort_entry::match_section_file):
2426 (Output_section::Input_section_sort_compare::operator()): Rewrite
2427 using new Input_section_sort_entry functions. Sort crtbegin and
2428 crtend first. Sort sections with no priority before sections with
2430 * testsuite/initpri1.c (d3): Check j != 4.
2431 (cd5): New constructor/destructor function.
2432 (main): Check j != 2.
2434 * symtab.cc (Symbol_table::add_from_object): If we don't use the
2435 new symbol when resolving, don't call set_is_default.
2436 * testsuite/ver_test_7.cc: New file.
2437 * testsuite/ver_test_7.sh: New file.
2438 * testsuite/Makefile.am (ver_test_7.so): New target.
2439 (ver_test_7.o): New target.
2440 (check_SCRIPTS): Add ver_test_7.sh.
2441 (check_DATA): Add ver_test_7.syms.
2442 (ver_test_7.syms): New target.
2444 2008-03-28 Ian Lance Taylor <iant@google.com>
2446 * layout.cc (Layout::layout): If we see an input section with a
2447 name that needs sorting, set the must_sort flag for the output
2449 (Layout::make_output_section): If the name of the output section
2450 indicates that it might require sorting, set the may_sort flag.
2451 * output.h (Output_section::may_sort_attached_input_sections): New
2453 (Output_section::set_may_sort_attached_input_sections): New
2455 (Output_section::must_sort_attached_input_sections): New
2457 (Output_section::set_must_sort_attached_input_sections): New
2459 (class Output_section): Declare Input_section_sort_entry. Define
2460 Input_section_sort_compare. Declare
2461 sort_attached_input_sections. Add new fields:
2462 may_sort_attached_input_sections_,
2463 must_sort_attached_input_sections_,
2464 attached_input_sections_are_sorted_.
2465 * output.cc (Output_section::Output_section): Initialize new
2467 (Output_section::add_input_section): Add an entry to
2468 input_sections_ if may_sort or must_sort are true.
2469 (Output_section::set_final_data_size): Call
2470 sort_attached_input_sections if necessary.
2471 (Output_section::Input_section_sort_entry): Define new class.
2472 (Output_section::Input_section_sort_compare::operator()): New
2474 (Output_section::sort_attached_input_sections): New function.
2475 * configure.ac: Check whether the compiler supports constructor
2476 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
2477 * testsuite/initpri1.c: New file.
2478 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
2479 CONSTRUCTOR_PRIORITY.
2480 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
2481 (initpri1_LDFLAGS): New variable.
2482 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
2484 2008-03-27 Ian Lance Taylor <iant@google.com>
2486 * common.cc (Sort_commons::operator): Correct sorting algorithm.
2487 * testsuite/common_test_1.c: New file.
2488 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
2489 (common_test_1_SOURCES): New variable.
2490 (common_test_1_DEPENDENCIES): New variable.
2491 (common_test_1_LDFLAGS): New variable.
2493 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
2494 and commons_ correctly when NAME/VERSION does not override
2496 * testsuite/ver_test_6.c: New file.
2497 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
2498 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
2499 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
2501 2008-03-26 Ian Lance Taylor <iant@google.com>
2503 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
2504 of an undefined symbol from a version script.
2505 * testsuite/Makefile.am (ver_test_5.so): New target.
2506 (ver_test_5.o): New target.
2507 (check_SCRIPTS): Add ver_test_5.sh.
2508 (check_DATA): Add ver_test_5.syms.
2509 (ver_test_5.syms): New target.
2510 * testsuite/ver_test_5.cc: New file.
2511 * testsuite/ver_test_5.script: New file.
2512 * testsuite/ver_test_5.sh: New file.
2513 * Makefile.in, testsuite/Makefile.in: Rebuild.
2516 Fix problems building gold with gcc 4.3.0.
2517 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
2518 (gold_error_at_location, gold_warning_at_location): Use it.
2519 * configure.ac: Check whether we can compile and use a template
2520 function with a printf attribute.
2521 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
2522 when jumping over bytes.
2523 * object.cc: Instantiate Object::read_section_data.
2524 * debug.h: Include <cstring>
2525 * dwarf_reader.cc: Include <algorithm>
2526 * main.cc: Include <cstring>.
2527 * options.cc: Include <cstring>.
2528 * output.cc: Include <cstring>.
2529 * script.cc: Include <cstring>.
2530 * script.h: Include <string>.
2531 * symtab.cc: Include <cstring> and <algorithm>.
2532 * target-select.cc: Include <cstring>.
2533 * version.cc: Include <string>.
2534 * testsuite/testmain.cc: Include <cstdlib>.
2535 * configure, config.in: Rebuild.
2537 2008-03-25 Ian Lance Taylor <iant@google.com>
2539 * options.cc: Include "../bfd/bfdver.h".
2540 (options::help): Print bug reporting address.
2542 * version.cc (print_version): Adjust output for current value of
2547 * options.cc (options::help): Print list of supported targets.
2548 * target-select.h: Include <vector>.
2549 (class Target_selector): Make machine_, size_, and is_big_endian_
2550 fields const. Add bfd_name_ and instantiated_target_ fields.
2551 (Target_selector::Target_selector): Add bfd_name parameter.
2552 (Target_selector::recognize): Make non-virtual, call
2554 (Target_selector::recognize_by_name): Make non-virtual, call
2555 do_recognize_by_name.
2556 (Target_selector::supported_names): New function.
2557 (Target_selector::bfd_name): New function.
2558 (Target_selector::do_instantiate_target): New pure virtual
2560 (Target_selector::do_recognize): New virtual function.
2561 (Target_selector::do_recognize_by_name): New virtual function.
2562 (Target_selector::instantiate_target): New private function.
2563 (supported_target_names): Declare.
2564 * target-select.cc (Target_selector::Target_selector): Update for
2565 new parameter and fields.
2566 (select_target_by_name): Check that the name matches before
2567 calling recognize_by_name.
2568 (supported_target_names): New function.
2569 * i386.cc (class Target_selector_i386): Update Target_selector
2570 constructor call. Remove recognize and recognize_by_name. Add
2571 do_instantiate_target.
2572 * x86_64.cc (class Target_selector_x86_64): Likewise.
2573 * testsuite/testfile.cc (class Target_selector_test): Update for
2574 changes to Target_selector.
2576 * README: Rewrite, with some notes on unsupported features.
2578 2008-03-24 Cary Coutant <ccoutant@google.com>
2580 * i386.cc (Target_i386::Got_type): New enum declaration.
2581 (Target_i386::Scan::local): Updated callers of Output_data_got
2583 (Target_i386::Scan::global): Likewise.
2584 (Target_i386::Relocate::relocate): Likewise.
2585 (Target_i386::Relocate::relocate_tls): Likewise.
2586 * object.h (Got_offset_list): New class.
2587 (Sized_relobj::local_has_got_offset): Added got_type parameter.
2588 (Sized_relobj::local_got_offset): Likewise.
2589 (Sized_relobj::set_local_got_offset): Likewise.
2590 (Sized_relobj::local_has_tls_got_offset): Removed.
2591 (Sized_relobj::local_tls_got_offset): Removed.
2592 (Sized_relobj::set_local_tls_got_offset): Removed.
2593 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
2594 * output.cc (Output_data_got::add_global): Added got_type parameter.
2595 (Output_data_got::add_global_with_rel): Likewise.
2596 (Output_data_got::add_global_with_rela): Likewise.
2597 (Output_data_got::add_global_pair_with_rel): New function.
2598 (Output_data_got::add_global_pair_with_rela): New function.
2599 (Output_data_got::add_local): Added got_type parameter.
2600 (Output_data_got::add_local_with_rel): Likewise.
2601 (Output_data_got::add_local_with_rela): Likewise.
2602 (Output_data_got::add_local_pair_with_rel): New function.
2603 (Output_data_got::add_local_pair_with_rela): New function.
2604 (Output_data_got::add_global_tls): Removed.
2605 (Output_data_got::add_global_tls_with_rel): Removed.
2606 (Output_data_got::add_global_tls_with_rela): Removed.
2607 (Output_data_got::add_local_tls): Removed.
2608 (Output_data_got::add_local_tls_with_rel): Removed.
2609 (Output_data_got::add_local_tls_with_rela): Removed.
2610 * output.h (Output_data_got::add_global): Added got_type parameter.
2611 (Output_data_got::add_global_with_rel): Likewise.
2612 (Output_data_got::add_global_with_rela): Likewise.
2613 (Output_data_got::add_global_pair_with_rel): New function.
2614 (Output_data_got::add_global_pair_with_rela): New function.
2615 (Output_data_got::add_local): Added got_type parameter.
2616 (Output_data_got::add_local_with_rel): Likewise.
2617 (Output_data_got::add_local_with_rela): Likewise.
2618 (Output_data_got::add_local_pair_with_rel): New function.
2619 (Output_data_got::add_local_pair_with_rela): New function.
2620 (Output_data_got::add_global_tls): Removed.
2621 (Output_data_got::add_global_tls_with_rel): Removed.
2622 (Output_data_got::add_global_tls_with_rela): Removed.
2623 (Output_data_got::add_local_tls): Removed.
2624 (Output_data_got::add_local_tls_with_rel): Removed.
2625 (Output_data_got::add_local_tls_with_rela): Removed.
2626 * resolve.cc (Symbol::override_base_with_special): Removed
2627 reference to has_got_offset_ field.
2628 * symtab.cc (Symbol::init_fields): Replaced initialization
2629 of got_offset_ with got_offsets_. Removed initialization
2631 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
2632 (Symbol::got_offset): Likewise.
2633 (Symbol::set_got_offset): Likewise.
2634 (Symbol::has_tls_got_offset): Removed.
2635 (Symbol::tls_got_offset): Removed.
2636 (Symbol::set_tls_got_offset): Removed.
2637 (Symbol::got_offset_): Removed.
2638 (Symbol::tls_mod_got_offset_): Removed.
2639 (Symbol::tls_pair_got_offset_): Removed.
2640 (Symbol::got_offsets_): New field.
2641 (Symbol::has_got_offset): Removed.
2642 (Symbol::has_tls_mod_got_offset): Removed.
2643 (Symbol::has_tls_pair_got_offset): Removed.
2644 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
2645 (Target_x86_64::Scan::local): Updated callers of Output_data_got
2647 (Target_x86_64::Scan::global): Likewise.
2648 (Target_x86_64::Relocate::relocate): Likewise.
2649 (Target_x86_64::Relocate::relocate_tls): Likewise.
2651 2008-03-25 Ben Elliston <bje@au.ibm.com>
2653 * yyscript.y: Fix spelling error in comment.
2655 2008-03-24 Ian Lance Taylor <iant@google.com>
2657 * options.h (class General_options): Define build_id option.
2658 * layout.h (class Layout): Declare write_build_id, create_note,
2659 create_build_id. Add build_id_note_ member.
2660 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
2661 "libiberty.h", "md5.h", "sha1.h".
2662 (Layout::Layout): Initialize eh_frame_data_,
2663 eh_frame_hdr_section_, and build_id_note_.
2664 (Layout::finalize): Call create_build_id.
2665 (Layout::create_note): New function, broken out of
2666 Layout::create_gold_note.
2667 (Layout::create_gold_note): Call create_note.
2668 (Layout::create_build_id): New function.
2669 (Layout::write_build_id): New function.
2670 (Close_task_runner::run): Call write_build_id.
2672 * x86_64.cc: Correct license to GPLv3.
2674 2008-03-23 Ian Lance Taylor <iant@google.com>
2676 * options.cc: Include "demangle.h".
2677 (parse_optional_string): New function.
2678 (parse_long_option): Handle takes_optional_argument.
2679 (parse_short_option): Update dash_z initializer. Handle
2680 takes_optional_argument.
2681 (General_options::General_options): Initialize do_demangle_.
2682 (General_options::finalize): Set do_demangle_. Handle demangling
2684 * options.h (parse_optional_string): Declare.
2685 (struct One_option): Add optional_arg field. Update constructor.
2686 Update call constructor calls. Add takes_optional_argument
2688 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
2689 (DEFINE_optional_string): Define.
2690 (General_options::demangle): Change from DEFINE_bool to
2691 DEFINE_optional_string.
2692 (General_options::no_demangle): New function.
2693 (General_options::do_demangle): New function.
2694 (General_options::set_do_demangle): New function.
2695 (General_options::execstack_status_): Move definition to end of
2697 (General_options::static_): Likewise.
2698 (General_options::do_demangle_): New field.
2699 * object.cc (big_endian>::get_symbol_location_info): Call
2700 Options::do_demangle, not Options::demangle.
2701 * symtab.cc (demangle): Likewise.
2703 2008-03-22 Ian Lance Taylor <iant@google.com>
2705 * gold.h: Include <cstddef> and <sys/types.h>
2706 * options.h: Include <cstring>.
2708 2008-03-21 Ian Lance Taylor <iant@google.com>
2710 * Added source code to GNU binutils.