1 2009-01-07 Ian Lance Taylor <iant@google.com>
3 * version.cc (version_string): Bump to 1.8.
5 2008-12-23 Cary Coutant <ccoutant@google.com>
7 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
8 * plugin.cc (Plugin_manager::finish): Rename as
9 layout_deferred_objects. Move cleanup to separate function.
10 (Plugin_manager::cleanup): New function.
11 (Plugin_finish::run): Call layout_deferred_objects and cleanup
13 * plugin.h (Plugin_manager::finish): Rename as
14 layout_deferred_objects.
15 (Plugin_manager::cleanup): New function.
16 (Plugin_manager::cleanup_done): New field.
18 2008-12-23 Cary Coutant <ccoutant@google.com>
20 * plugin.cc (is_visible_from_outside): New function.
21 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
22 so we don't return "IR only" status for exported symbols or -r links.
24 * testsuite/Makefile.am (plugin_test_3): New test case.
25 * testsuite/Makefile.in: Regenerate.
26 * testsuite/plugin_test_3.sh: New file.
28 2008-12-22 Cary Coutant <ccoutant@google.com>
30 * object.cc (Sized_relobj::layout_section): New function.
31 (Sized_relobj::do_layout): Defer layout of input sections until after
32 plugin has provided replacement files.
33 (Sized_relobj::do_layout_deferred_sections): New function.
34 * object.h (Relobj::set_section_offset): Remove virtual keyword.
35 (Relobj::layout_deferred_sections): New function.
36 (Relobj::do_layout_deferred_sections): New function.
37 (Sized_relobj::do_layout_deferred_sections): New function.
38 (Sized_relobj::layout_section): New function.
39 (Sized_relobj::Deferred_layout): New structure.
40 (Sized_relobj::deferred_layout_): New field.
41 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
42 Change all callers. Layout deferred sections.
43 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
45 (Plugin_hook::run): Move code from do_plugin_hook inline.
46 (Plugin_hook::do_plugin_hook): Remove.
47 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
48 (Plugin_manager::finish): Renamed, was cleanup.
49 (Plugin_manager::should_defer_layout): New function.
50 (Plugin_manager::add_deferred_layout_object): New function.
51 (Plugin_manager::Deferred_layout_list): New type.
52 (Plugin_manager::deferred_layout_objects_): New field.
53 (Plugin_hook::do_plugin_hook): Remove.
55 2008-12-17 Ian Lance Taylor <iant@google.com>
57 * options.h (class General_options): Add --no case for
60 2008-12-16 Cary Coutant <ccoutant@google.com>
62 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
64 (Plugin_manager::claim_file): Create plugin object even if
65 plugin did not call the add_symbols callback.
66 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
67 asking for more symbols than were added.
68 * testsuite/Makefile.am (plugin_test_1): Add test case with
70 (empty.syms): New target.
71 * testsuite/Makefile.in: Regenerate.
72 * testsuite/plugin_test.c (claim_file_hook): Add new debug
73 message. Don't call add_symbols if no globals.
74 (all_symbols_read_hook): Don't provide replacement for empty
77 2008-12-12 Ian Lance Taylor <iant@google.com>
79 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
80 r_type == 0 for a local symbol with r_sym == 0.
81 (scan_relocatable_relocs): Pass r_sym to
82 local_non_section_strategy.
83 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
86 * configure.ac: Update test for TLS descriptors: they are
87 supported as of glibc 2.9.
90 2008-12-11 Ian Lance Taylor <iant@google.com>
93 * target-reloc.h (Default_scan_relocatable_relocs): For each
94 function, map r_type == 0 to RELOC_DISCARD.
96 2008-12-10 Cary Coutant <ccoutant@google.com>
98 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
99 object to override a kept COMDAT group from a plugin object.
101 2008-12-09 Ian Lance Taylor <iant@google.com>
104 * yyscript.y (file_cmd): Handle INPUT.
106 * testsuite/initpri1.c: Change all declarations to be full
107 prototypes by adding void, to avoid compiler warnings.
109 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
111 * options.cc (General_options::parse_plugin_opt): New.
112 (General_options::add_plugin): The argument now is just the filename.
113 (General_options::add_plugin_option): New.
114 * options.h (plugin_opt): New.
115 (add_plugin): Change argument name.
116 (add_plugin_option): New.
117 * plugin.cc (Plugin::load): Don't parse the plugin option.
118 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
119 (Plugin::add_option): New.
120 (Plugin::args_): Change type.
121 (Plugin::filename_): New.
122 (Plugin_manager::add_plugin_option): New.
123 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
124 * testsuite/Makefile.in: Regenerate.
126 2008-12-05 Cary Coutant <ccoutant@google.com>
128 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
129 Handle --strip-lto-sections option.
130 * options.h (strip_lto_sections): New option.
132 2008-12-01 Cary Coutant <ccoutant@google.com>
134 * plugin.cc (ld_plugin_message): Change format parameter to const.
135 Fix mismatch between new[] and delete.
137 2008-11-14 Cary Coutant <ccoutant@google.com>
139 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
142 2008-11-05 Craig Silverstein <csilvers@google.com>
144 * options.cc (General_options::parse_dynamic_list): New function.
145 * options.h (General_options): New flags dynamic_list,
146 dynamic_list_data, dynamic_list_cpp_new, and
147 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
148 (General_options::in_dynamic_list): New function.
149 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
150 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
151 (Lex::can_continue_name): Likewise.
153 (read_script_file): New parameter script_options.
154 (read_dynamic_list): New function.
155 (Script_options::define_dynamic_list): New function.
156 (dynamic_list_keyword_parsecodes): New variable.
157 (dynamic_list_keywords): New variable.
158 * script.h (Script_options::define_dynamic_list): New function
160 (read_dynamic_list): New function prototype.
161 * symtab.cc (strprefix): New macro.
162 (Symbol::should_add_dynsym_entry): Support dynamic_list,
163 dynamic_list_data, dynamic_list_cpp_new, and
164 dynamic_list_cpp_typeinfo.
165 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
166 (dynamic_list_expr): New rule.
167 (dynamic_list_nodes): Likewise.
168 (dynamic_list_node): Likewise.
169 * testsuite/Makefile.am (dynamic_list): New test.
170 * testsuite/Makefile.in: Regenerated.
171 * testsuite/dynamic_list.t: New file.
172 * testsuite/dynamic_list.sh: New file.
174 2008-11-05 Craig Silverstein <csilvers@google.com>
176 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
177 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
178 (t11_last): Likewise.
179 * testsuite/ver_test_6.c (main): Likewise.
181 2008-10-07 Cary Coutant <ccoutant@google.com>
183 * options.c (General_options::finalize): Add check for -static and
185 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
188 2008-10-02 Cary Coutant <ccoutant@google.com>
190 * plugin.cc (make_sized_plugin_object): Fix conditional
191 compilation to work when not all targets are enabled.
193 2008-09-29 Cary Coutant <ccoutant@google.com>
195 * archive.cc (Archive::get_file_and_offset): Use filename instead
196 of name to get library path.
197 (Archive::include_member): Unlock external member of a thin archive.
199 * testsuite/Makefile.am (TEST_AR): New variable.
200 (thin_archive_test_1): New test.
201 (thin_archive_test_2): New test.
202 * testsuite/Makefile.in: Regenerate.
203 * testsuite/thin_archive_main.cc: New file.
204 * testsuite/thin_archive_test_1.cc: New file.
205 * testsuite/thin_archive_test_2.cc: New file.
206 * testsuite/thin_archive_test_3.cc: New file.
207 * testsuite/thin_archive_test_4.cc: New file.
209 2008-09-29 Cary Coutant <ccoutant@google.com>
211 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
212 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
214 (Sized_relobj::do_finalize_local_symbols): Likewise.
215 (Sized_relobj::map_to_kept_section): Likewise.
216 * object.h (Sized_relobj::invalid_address): New constant.
217 (Sized_relobj::do_output_section_offset): Check for invalid_address
219 * output.cc (Output_reloc::local_section_offset): Use constant
220 invalid_address instead of -1U.
221 (Output_reloc::get_address): Likewise.
222 (Output_section::output_address): Change -1U to -1ULL.
223 * output.h (Output_reloc::invalid_address): New constant.
224 * reloc.cc (Sized_relobj::write_sections): Use constant
225 invalid_address instead of -1U.
226 (Sized_relobj::relocate_sections): Likewise.
227 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
228 values for merge sections.
229 * target-reloc.h (relocate_for_relocatable): Use constant
230 invalid_address instead of -1U.
232 2008-09-19 Cary Coutant <ccoutant@google.com>
234 Add plugin functionality for link-time optimization (LTO).
235 * configure.ac (plugins): Add --enable-plugins option.
236 * configure: Regenerate.
237 * config.in: Regenerate.
238 * Makefile.am (LIBDL): New variable.
239 (CCFILES): Add plugin.cc.
240 (HFILES): Add plugin.h.
241 (ldadd_var): Add LIBDL.
242 * Makefile.in: Regenerate.
244 * archive.cc: Include "plugin.h".
245 (Archive::setup): Don't preread archive symbols when using a plugin.
246 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
247 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
249 (Archive::include_member): Add symbols from plugin objects.
250 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
251 * descriptors.cc (Descriptors::open): Check for file descriptors
252 abandoned by plugins.
253 (Descriptors::claim_for_plugin): New function.
254 * descriptors.h (Descriptors::claim_for_plugin): New function.
255 (Open_descriptor::is_claimed): New field.
256 (claim_descriptor_for_plugin): New function.
257 * fileread.cc (File_read::claim_for_plugin): New function.
258 * fileread.h (File_read::claim_for_plugin): New function.
259 (File_read::descriptor): New function.
260 * gold.cc: Include "plugin.h".
261 (queue_initial_tasks): Add task to call plugin hooks for generating
263 * main.cc: Include "plugin.h".
264 (main): Load plugin libraries.
265 * object.h (Pluginobj): Declare.
266 (Object::pluginobj): New function.
267 (Object::do_pluginobj): New function.
268 (Object::set_target): New function.
269 * options.cc: Include "plugin.h".
270 (General_options::parse_plugin): New function.
271 (General_options::General_options): Initialize plugins_ field.
272 (General_options::add_plugin): New function.
273 * options.h (Plugin_manager): Declare.
274 (General_options): Add --plugin option.
275 (General_options::has_plugins): New function.
276 (General_options::plugins): New function.
277 (General_options::add_plugin): New function.
278 (General_options::plugins_): New field.
279 * plugin.cc: New file.
280 * plugin.h: New file.
281 * readsyms.cc: Include "plugin.h".
282 (Read_symbols::do_read_symbols): Check for archive before checking
283 for ELF file. Call plugin hooks to claim files.
284 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
285 from a real object file; force override when processing replacement
287 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
288 (Symbol::init_base_object): Likewise.
289 (Symbol::init_base_output_data): Likewise.
290 (Symbol::init_base_output_segment): Likewise.
291 (Symbol::init_base_constant): Likewise.
292 (Symbol::init_base_undefined): Likewise.
293 (Symbol::output_section): Assert that object is not a plugin.
294 (Symbol_table::add_from_pluginobj): New function.
295 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
297 (Symbol_table::sized_write_globals): Likewise.
298 (Symbol_table::add_from_pluginobj): Instantiate template.
299 * symtab.h (Sized_pluginobj): Declare.
300 (Symbol::in_real_elf): New function.
301 (Symbol::set_in_real_elf): New function.
302 (Symbol::in_real_elf_): New field.
303 (Symbol_table::add_from_pluginobj): New function.
305 * testsuite/Makefile.am (AM_CFLAGS): New variable.
306 (LIBDL): New variable.
308 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
309 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
310 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
311 (MOSTLYCLEANFILES): Likewise.
312 * testsuite/Makefile.in: Regenerate.
313 * testsuite/plugin_test.c: New file.
314 * testsuite/plugin_test_1.sh: New file.
315 * testsuite/plugin_test_2.sh: New file.
317 2008-09-16 Ian Lance Taylor <iant@google.com>
319 * target-reloc.h (relocate_section): Check whether a symbol is
320 defined by the ABI before reporting an undefined symbol error.
321 * target.h (Target::is_defined_by_abi): Make parameter const.
322 (Target::do_is_defined_by_abi): Likewise.
323 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
324 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
325 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
326 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
327 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
328 * testsuite/Makefile.in: Rebuild.
330 * fileread.cc (make_view): Add casts to avoid warning.
332 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
334 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
335 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
337 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
339 * options.h (General_options::output_is_executable): New.
340 (General_options::output_is_pie): New.
341 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
342 for shared libraries.
343 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
345 2008-09-11 Chris Demetriou <cgd@google.com>
347 * options.h (origin): New -z option.
348 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
349 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
352 2008-09-05 Cary Coutant <ccoutant@google.com>
354 * fileread.cc (File_read::make_view): Add check for attempt to map
357 2008-09-05 Cary Coutant <ccoutant@google.com>
359 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
360 explicit instantiations.
362 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
365 * options.cc (General_options::finalize): Allow undefined symbols
366 in shlibs if linking -shared.
369 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
370 symbols as not needing a dynsym entry.
372 2008-08-20 Craig Silverstein <csilvers@google.com>
374 * fileread.cc (File_read::open): Do not lock the file unless it
375 was successfully opened.
377 2008-08-14 Cary Coutant <ccoutant@google.com>
379 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
380 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
381 * testsuite/tls_test.cc (struct int128): 128-bit struct
382 for testing TLS relocs with non-zero addend.
383 (v12): New TLS variable.
385 (t_last): Add check for v12.
386 * testsuite/tls_test.h (t12): New function.
387 * testsuite/tls_test_main.cc (thread_routine): Call new test.
389 2008-08-13 Ian Lance Taylor <iant@google.com>
391 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
392 set tls_segment_ or relro_segment_.
393 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
395 * output.h (Output_section::clear_is_relro): New function.
396 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
397 sections specially even when output_data_ is empty.
398 (Output_segment::maximum_alignment): When first section is relro,
399 only force alignment for PT_LOAD segments.
400 * script.cc (script_data_segment_align): New function.
401 (script_data_segment_relro_end): New function.
402 * script-c.h (script_data_segment_align): Declare.
403 (script_data_segment_relro_end): Declare.
404 * script-sections.h (class Script_sections): Declare
405 data_segment_align and data_segment_relro_end. Add fields
406 segment_align_index_ and saw_relro_end_.
407 * script-sections.cc (class Sections_element): Add set_is_relro
408 virtual function. Add new bool* parameter to place_orphan_here.
409 Add get_output_section virtual function.
410 (class Output_section_definition): Add set_is_relro. Add new
411 bool* parameter to place_orphan_here. Add get_output_section.
413 (Output_section_definition::Output_section_definition): Initialize
414 evaluated_address_, evaluated_load_address, evaluated_addralign_,
415 and is_relro_ fields.
416 (Output_section_definition::place_orphan_here): Add is_relro
418 (Output_section_definition::set_section_addresses): Set relro for
420 (Output_section_definition::alternate_constraint): Likewise.
421 (class Orphan_output_section): Add new bool* parameter to
422 place_orphan_here. Add get_output_section.
423 (Orphan_output_section::place_orphan_here): Add is_relro
425 (Script_sections::Script_sections): Initialize
426 data_segment_align_index_ and saw_relro_end_.
427 (Script_sections::data_segment_align): New function.
428 (Script_sections::data_segment_relro_end): New function.
429 (Script_sections::place_orphan): Set or clear is_relro.
430 (Script_sections::set_section_addresses): Force alignment of first
432 * yyscript.y (exp): Call script_data_segment_align and
433 script_data_segment_relro_end.
434 * testsuite/relro_script_test.t: New file.
435 * testsuite/relro_test.cc (using_script): Declare.
436 (t1, t2): Test using_script.
437 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
438 (relro_script_test_SOURCES): Define.
439 (relro_script_test_DEPENDENCIES): Define.
440 (relro_script_test_LDFLAGS): Define.
441 (relro_script_test_LDADD): Define.
442 (relro_script_test.so): New target.
443 * testsuite/Makefile.in: Rebuild.
445 2008-08-06 Cary Coutant <ccoutant@google.com>
447 * archive.cc (Archive::total_archives, Archive::total_members)
448 (Archive::total_members_loaded): New variables.
449 (Archive::setup): Add parameter. Add option to preread
451 (Archive::read_armap): Add counter.
452 (Archive::get_file_and_offset): New function.
453 (Archive::get_elf_object_for_member): New function.
454 (Archive::read_all_symbols): New function.
455 (Archive::read_symbols): New function.
456 (Archive::add_symbols): Add counters.
457 (Archive::include_all_members): Use armap to find members if it's
459 (Archive::include_member): Skip reading symbols if already read.
460 Factored code into Archive::get_file_and_offset and
461 Archive::get_elf_object_for_member. Changed call to
462 Mapfile::report_include_archive_member.
463 (Archive::print_stats): New function.
464 * archive.h: Declare Object and Read_symbols_data classes.
465 (Archive::Archive): Add initializers for new members.
466 (Archive::setup): Add parameter.
467 (Archive::print_stats): New function.
468 (Archive::total_archives, Archive::total_members)
469 (Archive::total_members_loaded): New variables.
470 (Archive::get_file_and_offset): New function.
471 (Archive::get_elf_object_for_member): New function.
472 (Archive::read_all_symbols): New function.
473 (Archive::read_symbols): New function.
474 (Archive::Archive_member): New class.
475 (Archive::members_): New member.
476 (Archive::num_members_): New member.
477 * main.cc: Include archive.h.
478 (main): Call Archive::print_stats.
479 * mapfile.cc (Mapfile::report_include_archive_member): Delete
480 archive parameter; member_name is now the fully-decorated name.
481 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
482 * options.h: (General_options): Add --preread-archive-symbols option.
483 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
486 2008-08-04 Ian Lance Taylor <iant@google.com>
488 * symtab.h (Symbol::use_plt_offset): New function.
489 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
490 * powerpc.cc (Relocate::relocate): Likewise.
491 * sparc.cc (Relocate::relocate): Likewise.
492 * x86_64.cc (Relocate::relocate): Likewise.
493 * testsuite/weak_plt.sh: New test.
494 * testsuite/weak_plt_main.cc: New test.
495 * testsuite/weak_plt_shared.cc: New test.
496 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
497 (check_PROGRAMS): Add weak_plt.
498 (check_DATA): Add weak_plt_shared.so.
499 (weak_plt_main_pic.o, weak_plt): New targets.
500 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
501 * testsuite/Makefile.in: Rebuild.
503 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
505 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
506 * testsuite/Makefile.in: Rebuild.
508 2008-08-04 Alan Modra <amodra@bigpond.net.au>
510 * Makefile.am (POTFILES.in): Set LC_ALL=C.
511 * Makefile.in: Regenerate.
512 * po/POTFILES.in: Regenerate.
514 2008-07-29 Ian Lance Taylor <iant@google.com>
516 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
517 symbols before other symbols.
518 * testsuite/script_test_2.cc (test_addr): Declare.
519 (test_addr_alias): Declare.
520 (main): Check that test_addr and test_addr_alias have the right
522 * testsuite/script_test_2.t: Define test_addr_alias and
525 2008-07-24 Ian Lance Taylor <iant@google.com>
528 * descriptors.cc: New file.
529 * descriptors.h: New file.
530 * gold-threads.h (class Hold_optional_lock): New class.
531 * fileread.cc: Include "descriptors.h".
532 (File_read::~File_read): Release descriptor rather than closing
534 (File_read::open) [file]: Call open_descriptor rather than open.
535 Set is_descriptor_opened_.
536 (File_read::open) [memory]: Assert that descriptor is not open.
537 (File_read::reopen_descriptor): New function.
538 (File_read::release): Release descriptor.
539 (File_read::do_read): Make non-const. Reopen descriptor.
540 (File_read::read): Make non-const.
541 (File_read::make_view): Reopen descriptor.
542 (File_read::do_readv): Likewise.
543 * fileread.h (class File_read): Add is_descriptor_opened_ field.
545 * layout.cc: Include "descriptors.h".
546 (Layout::create_build_id): Use open_descriptor rather than open.
547 * output.cc: Include "descriptors.h".
548 (Output_file::open): Use open_descriptor rather than open.
549 * archive.cc (Archive::const_iterator): Change Archive to be
551 (Archive::begin, Archive::end): Make non-const.
552 (Archive::count_members): Likewise.
553 * archive.h (class Archive): Update declarations.
554 * object.h (Object::read): Make non-const.
555 * Makefile.am (CCFILES): Add descriptors.cc.
556 (HFILES): Add descriptors.h.
557 * Makefile.in: Rebuild.
560 * gold.h: Always include <clocale>. Add Solaris workarounds
561 following code in binutils/sysdep.h.
564 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
565 this->eh_frame_hdr_ is NULL before using it.
567 * dynobj.cc (Versions::Versions): Update comment.
569 * dynobj.cc (Versions::Versions): If there is an soname, use it as
570 the base version name.
572 * stringpool.cc (Stringpool_template::add_with_length): Set key to
574 (Stringpool_template::set_string_offsets): Subtract one from key
575 before using it as an array index.
576 (Stringpool_template::get_offset_with_length): Likewise.
577 (Stringpool_template::write_to_buffer): Likewise.
578 * stringpool.h (Stringpool_template::get_offset_from_key):
581 2008-07-23 Ian Lance Taylor <iant@google.com>
584 * object.h (Merged_symbol_value::value): Do our best to handle a
588 * script.cc (Version_script_info::get_versions): Don't add empty
589 version tag to return value.
590 (Version_script_info::get_symbol_version_helper): Change return
591 type to bool. Add pversion parameter. Change all callers.
592 (script_register_vers_node): Don't require a non-NULL tag.
593 * script.h (class Version_script_info): Update declarations.
594 (Version_script_info::get_symbol_version): Change return type to
595 bool. Add version parameter. Change all callers.
596 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
597 handling. Handle an empty version from a version script.
598 (Symbol_table::define_special_symbol): Likewise.
599 * testsuite/ver_test_10.script: New file.
600 * testsuite/ver_test_10.sh: New file.
601 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
602 (check_DATA): Add ver_test_10.syms.
603 (ver_test_10.syms, ver_test_10.so): New target.
604 * testsuite/Makefile.in: Rebuild.
606 2008-07-23 Simon Baldwin <simonb@google.com>
608 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
609 to zero for undefined symbols from dynamic libraries.
611 2008-07-23 Ian Lance Taylor <iant@google.com>
613 * symtab.cc (Symbol_table::resolve): Remove version parameter.
615 * symtab.h (class Symbol_table): Update declaration.
616 * testsuite/ver_test_9.cc: New file.
617 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
618 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
619 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
620 (ver_test_9.so, ver_test_9.o): New targets.
621 * testsuite/Makefile.in: Rebuild.
623 2008-07-22 Ian Lance Taylor <iant@google.com>
625 * options.h (class General_options): Define --check-sections.
626 * layout.cc (Layout::set_segment_offsets): Handle
629 * options.h (class General_options): Define -n/--nmagic and
631 * options.cc (General_options::finalize): For -n/--nmagic or
632 -N/--omagic, set -static.
633 * layout.cc (Layout::attach_allocated_section_to_segment): If
634 -N/--omagic, don't put read-only and read-write sections in
636 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
637 finding a read-only segment.
638 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
639 don't set the minimum segment alignment to the common page size,
640 and don't set the file offset to the address modulo the page size.
641 * script-sections.cc (Script_sections::create_segments): If
642 -n/--omagic, don't put read-only and read-write sections in
647 * options.h (class General_options): Add --print-symbol-counts.
648 * main.cc (main): Issue defined symbol report if requested.
649 * archive.cc (Archive::interpret_header): Make into a const member
651 (Archive::add_symbols): Call Input_objects::archive_start and
653 (Archive::const_iterator): Define new class.
654 (Archive::begin, Archive::end): New functions.
655 (Archive::include_all_members): Rewrite to use iterator.
656 (Archive::count_members): New function.
657 * archive.h (class Archive): Update declarations.
658 (Archive::filename): New function.
659 * object.cc: Include "cref.h".
660 (Sized_relobj::Sized_relobj): Initialize defined_count_.
661 (Sized_relobj::do_get_global_symbol_counts): New function.
662 (Input_objects::add_object): Add object to cross-referencer.
663 (Input_objects::archive_start): New function.
664 (Input_objects::archive_stop): New function.
665 (Input_objects::print_symbol_counts): New function.
666 * object.h: Declare Cref and Archive.
667 (Object::get_global_symbol_counts): New function.
668 (Object::do_get_global_symbol_counts): New pure virtual function.
669 (class Sized_relobj): Add defined_count_ field. Update
671 (class Input_objects): Add cref_ field. Update constructor.
673 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
675 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
677 (Sized_dynobj::do_get_global_symbol_counts): New function.
678 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
679 defined_count_. Update declarations. Define Symbols typedef.
680 * symtab.cc (Symbol_table::add_from_relobj): Add defined
681 parameter. Change all callers.
682 (Symbol_table::add_from_dynobj): Add sympointers and defined
683 parameters. Change all callers.
684 * symtab.h (class Symbol_table): Update declarations.
685 * Makefile.am (CCFILES): Add cref.cc.
686 (HFILES): Add cref.h.
687 * Makefile.in: Rebuild.
689 2008-07-22 Simon Baldwin <simonb@google.com>
691 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
692 to zero when writing undefined symbols.
694 2008-07-22 Ian Lance Taylor <iant@google.com>
696 * output.cc (Output_section::add_input_section): Don't try to
697 merge empty merge sections.
699 2008-07-21 Craig Silverstein <csilvers@google.com>
701 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
702 Include symbol version in error message.
704 2008-07-20 Chris Demetriou <cgd@google.com>
706 * configure.ac (gold_cv_c_random_seed): New configured variable.
707 (RANDOM_SEED_CFLAGS): New substituted variable.
708 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
709 * configure: Rebuild.
710 * Makefile.in: Likewise.
711 * testsuite/Makefile.in: Likewise.
713 2008-07-18 Ian Lance Taylor <iant@google.com>
715 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
716 where we see NAME/NULL and NAME/VERSION as separate symbols.
717 * testsuite/ver_test_main.cc (main): Call t4.
719 * testsuite/ver_test_2.cc (t4_2): Define.
720 * testsuite/ver_test_2.script: Put t4_2a in VER2.
721 * testsuite/ver_test_4.cc (t4_2a): Define.
722 * testsuite/ver_test_4.script: Put t4_2a in VER2.
723 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
725 2008-07-17 Ian Lance Taylor <iant@google.com>
727 * dynobj.cc (Versions::add_def): If we give an error about a
728 missing version, go ahead and create the version anyhow.
730 2008-07-10 Ian Lance Taylor <iant@google.com>
732 Handle output sections with more than 0x7fffffff bytes.
733 * object.h (class Relobj): Change map_to_output_ to
734 output_sections_, and just keep a section pointer. Change all
735 uses. Move comdat group support to Sized_relobj.
736 (Relobj::is_section_specially_mapped): Remove.
737 (Relobj::output_section): Remove poff parameter. Change all
739 (Relobj::output_section_offset): New function.
740 (Relobj::set_section_offset): Rewrite.
741 (Relobj::map_to_output): Remove.
742 (Relobj::output_sections): New function.
743 (Relobj::do_output_section_offset): New pure virtual function.
744 (Relobj::do_set_section_offset): Likewise.
745 (class Sized_relobj): Add section_offsets_ field. Add comdat
746 group support from Relobj. Update declarations.
747 (Sized_relobj::get_output_section_offset): New function.
748 (Sized_relobj::do_output_section_offset): New function.
749 (Sized_relobj::do_set_section_offset): New function.
750 * object.cc (Relobj::output_section_address): Remove.
751 (Sized_relobj::Sized_relobj): Initialize new fields.
752 (Sized_relobj::include_section_group): Cast find_kept_object to
754 (Sized_relobj::include_linkonce_section): Likewise.
755 (Sized_relobj::do_layout): Use separate arrays for output section
757 (Sized_relobj::do_count_local_symbols): Change map_to_output to
759 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
760 output_sections and section_offsets.
761 (Sized_relobj::write_local_symbols): Likewise.
762 (map_to_kept_section): Compute output address directly.
763 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
764 output_sections and section_offsets.
765 (Sized_relobj::write_sections): Likewise.
766 (Sized_relobj::relocate_sections): Likewise.
767 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
768 * output.h (class Output_reloc): Update declarations. Change
769 u2_.relobj to Sized_relobj*.
770 (class Output_data_reloc): Change add functions to use
772 * output.cc (Output_reloc::Output_reloc): Change relobj to
774 (Output_reloc::local_section_offset): Change return type to
775 Elf_Addr. Use get_output_section_offset.
776 (Output_reloc::get_address): Likewise.
777 (Output_section::is_input_address_mapped): Don't call
778 is_section_specially_mapped.
779 (Output_section::output_offset): Likewise.
780 (Output_section::output_address): Likewise.
781 (Output_section::starting_output_address): Likewise.
782 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
783 parameter to Sized_relobj*.
784 (Copy_relocs::need_copy_reloc): Likewise.
785 (Copy_relocs::save): Likewise.
786 * copy-relocs.h (class Copy_relocs): Update declarations.
787 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
788 Sized_relobj*. Change relobj_ field to Sized_relobj*.
789 * target-reloc.h (relocate_for_relocatable): Change
790 offset_in_output_section type to Elf_Addr. Change code that uses
792 * layout.cc (Layout::layout): Always set *off.
793 * mapfile.cc (Mapfile::print_input_section): Use
794 output_section_offset.
795 * i386.cc (Target_i386::copy_reloc): Change object parameter to
797 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
798 * sparc.cc (Target_sparc::copy_reloc): Likewise.
799 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
801 2008-07-03 Ian Lance Taylor <iant@google.com>
803 * layout.cc (Layout::include_section): Do not discard unrecognized
806 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
808 * script.cc (Lex::can_continue_name): Make '?' allowable in
809 version-script names.
810 * testsuite/version_script.map: Change glob pattern to use '?'
812 2008-06-30 Manish Singh <yosh@gimp.org>
815 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
818 2008-06-30 Ian Lance Taylor <iant@google.com>
822 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
823 versions]: Don't try to read the value in the contents, since we
824 don't use it. Use the template endianness when writing.
826 2008-06-25 Cary Coutant <ccoutant@google.com>
828 * fileread.cc (File_read::make_view): Assert on zero-length view.
829 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
830 symbol table when there are no symbols to read.
832 2008-06-23 Craig Silverstein <csilvers@google.com>
834 * version.cc (version_string): Bump to 1.7
836 2008-06-18 Craig Silverstein <csilvers@google.com>
838 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
839 constant 0xFFFF to type Valtype.
840 (Powerpc_relocate_functions::rel16_ha): Likewise.
842 2008-06-17 Ian Lance Taylor <iant@google.com>
844 * output.h (Output_section::Input_section): Initialize p2align_ to
845 zero for Output_section_data constructors.
846 (Output_section::Input_section::addralign): If not an input
847 section, return the alignment of the Output_section_data.
848 * testsuite/copy_test.cc: New file.
849 * testsuite/copy_test_1.cc: New file.
850 * testsuite/copy_test_2.cc: New file.
851 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
852 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
853 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
854 (copy_test_1_pic.o, copy_test_1.so): New targets.
855 (copy_test_2_pic.o, copy_test_2.so): New targets.
856 * testsuite/Makefile.in: Rebuild.
858 * script-sections.cc (Script_sections::place_orphan): Initialize
859 local variable exact.
861 2008-06-13 David Edelsohn <edelsohn@gnu.org>
863 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
865 2008-06-12 David Edelsohn <edelsohn@gnu.org>
866 David S. Miller <davem@davemloft.net>
868 * powerpc.cc: New file.
869 * Makefile.am (TARGETSOURCES): Add powerpc.cc
870 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
871 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
872 * Makefile.in: Rebuild.
874 2008-06-09 Ian Lance Taylor <iant@google.com>
876 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
878 (throwing, orig_terminate): New static variables.
879 (terminate_handler): New static function.
880 (t2): Set terminate handler.
882 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
885 * binary.cc (Binary_to_elf::sized_convert): Fix .data
888 2008-05-30 Cary Coutant <ccoutant@google.com>
890 * archive.cc (Archive::include_all_members) Correct to step
891 over symbol table and extended name table in thin archives.
893 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
896 * target-reloc.h (relocate_for_relocatable): Fix new_offset
899 2008-05-28 Caleb Howe <cshowe@google.com>
901 * reduced_debug_output.cc: New file.
902 * reduced_debug_output.h: New file.
903 * options.h (class General_options): Add --strip-debug-non-line.
904 * options.cc (General_options::finalize): Add strip_debug_non_line
905 to the strip heirarchy.
906 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
908 * layout.cc: Include "reduced_debug_output.h".
909 (Layout::Layout): Initialize new fields.
910 (line_only_debug_sections): New static array.
911 (is_lines_only_debug_sections): New static inline function.
912 (Layout::include_section): Handle --strip-debug-non-line.
913 (Layout::make_output_section): If --strip-debug-non-line, build
914 new output sections for .debug_abbrev and .debug_info.
915 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
916 gold. Warn about possible overflow.
917 (read_signed_LEB_128): Likewise.
918 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
919 (read_signed_LEB_128): Declare.
920 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
921 (HFILES): Add reduced_debug_output.h.
922 * Makefile.in: Rebuild.
924 2008-05-21 Ian Lance Taylor <iant@google.com>
926 * mapfile.cc: New file.
927 * mapfile.h: New file.
928 * options.h (class General_options): Add -M/--print-map and -Map.
929 * options.cc (General_options::finalize): Make -M equivalent to
931 * main.cc: Include <cstdio> and "mapfile.h".
932 (main): Open mapfile if requested.
933 * gold.cc (class Middle_runner): Add mapfile_ field. Update
934 constructor. Change caller.
935 (queue_initial_tasks): Add mapfile parameter. Change caller.
936 (queue_middle_tasks): Likewise.
937 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
939 * archive.cc: Include "mapfile.h".
940 (Archive::add_symbols): Add mapfile parameter. Change all
941 callers. Pass mapfile, symbol, and reason to include_member.
942 (Archive::include_all_members): Add mapfile parameter. Change all
944 (Archive::include_member): Add mapfile, sym, and why parameters.
945 Change all callers. Report inclusion to map file.
946 * archive.h: Include "fileread.h".
947 (class Archive): Update declarations.
948 (Archive::file): New const method.
949 (class Add_archive_symbols): Add mapfile_ field. Update
950 constructor. Change all callers.
951 * readsyms.h (class Read_symbols): Likewise.
952 (class Finish_group): Likewise.
953 (class Read_script): Likewise.
954 * common.cc: Include "mapfile.h".
955 (Symbol_table::allocate_commons): Add mapfile parameter. Change
957 (Symbol_table::do_allocate_commons): Likewise.
958 (Symbol_table::do_allocate_commons_list): Likewise. Report common
959 symbol allocation to mapfile.
960 * common.h (class Allocate_commons_task): Add mapfile_ field.
961 Update constructor. Change all callers.
962 * symtab.h (class Symbol_table): Update declarations.
963 * layout.cc: Include "mapfile.h".
964 (Layout_task_runner::run): Print information to mapfile.
965 (Layout::create_gold_note): Change Output_data_fixed_space to
966 Output_data_zero_fill.
967 (Layout::create_build_id): Likewise.
968 (Layout::print_to_mapfile): New function.
969 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
970 constructor. Change caller.
971 (class Layout): Declare print_to_mapfile.
972 * output.cc (Output_section::Input_section::print_to_mapfile): New
974 (Output_section::add_input_section): If producing a map, always
975 add to input_sections_ list.
976 (Output_section::do_print_to_mapfile): New function.
977 (Output_segment::print_sections_to_mapfile): New function.
978 (Output_segment::print_section_list_to_mapfile): New function.
979 * output.h: Include "mapfile.h".
980 (Output_data::print_to_mapfile): New function.
981 (Output_data::do_print_to_mapfile): New virtual function.
982 (Output_segment_headers::do_print_to_mapfile): New function.
983 (Output_file_header::do_print_to_mapfile): New function.
984 (Output_data_const::do_print_to_mapfile): New function.
985 (class Output_data_const_buffer): Add map_name_ field. Update
986 constructor. Change all callers. Add do_print_to_mapfile
988 (class Output_data_fixed_space): Likewise.
989 (class Output_data_space): Likewise.
990 (class Output_data_zero_fill): New class.
991 (Output_data_strtab::do_print_to_mapfile): New function.
992 (Output_data_reloc_base::do_print_to_mapfile): New function.
993 (Output_relocatable_relocs::do_print_to_mapfile): New function.
994 (Output_data_group::do_print_to_mapfile): New function.
995 (Output_data_got::do_print_to_mapfile): New function.
996 (Output_data_dynamic::do_print_to_mapfile): New function.
997 (Output_symtab_xindex::do_print_to_mapfile): New function.
998 (class Output_section): Declare do_print_to_mapflie. Declare
999 print_to_mapfile in Input_section.
1000 (class Output_segment): Declare new functions.
1001 * object.h (Sized_relobj::symbol_count): New function.
1002 * script-sections.cc
1003 (Output_section_element_dot_assignment::set_section_addresses):
1004 Change Output_data_fixed_space to Output_data_zero_fill.
1005 (Output_data_expression::do_print_to_mapfile): New function.
1006 * script.cc (read_input_script): Add mapfile parameter. Change
1008 * script.h (read_input_script): Update declaration.
1009 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
1010 (Eh_frame::do_print_to_mapfile): New function.
1011 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
1012 (Output_merge_string::do_print_to_mapfile): New function.
1013 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
1015 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
1017 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
1019 * Makefile.am (CCFILES): Add mapfile.cc.
1020 (HFILES): Add mapfile.h.
1021 * Makefile.in: Rebuild.
1023 2008-05-19 Ian Lance Taylor <iant@google.com>
1025 * options.h (class General_options): Add -z relro.
1026 * layout.cc (Layout::Layout): Initialize relro_segment_.
1027 (Layout::add_output_section_data): Return the output section.
1028 (Layout::make_output_section): Rcognize relro sections and mark
1030 (Layout::attach_allocated_section_to_segment): Put relro sections
1031 in a PT_GNU_RELRO segment.
1032 (Layout::create_initial_dynamic_sections): Mark the .dynamic
1034 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
1036 (Layout::linkonce_mapping): Map d.rel.ro.local to
1038 (Layout::output_section_name): Us .data.rel.ro.local for any
1039 section which begins with that.
1040 * layout.h (class Layout): Update add_output_section_data
1041 declaration. Add relro_segment_ field.
1042 * output.cc (Output_section::Output_section): Initialize is_relro_
1043 and is_relro_local_ fields.
1044 (Output_segment::add_output_section): Group relro sections.
1045 (Output_segment::is_first_section_relro): New function.
1046 (Output_segment::maximum_alignment): If there is a relro section,
1047 align the segment to the common page size.
1048 (Output_segment::set_section_addresses): Track whether we are
1049 looking at relro sections. If the last section is a relro
1050 section, align to the common page size.
1051 (Output_segment::set_section_list_addresses): Add in_relro
1052 parameter. Change all callers. Align to the page size when
1053 moving from relro to non-relro section.
1054 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
1056 * output.h (class Output_section): Add is_relro_ and
1057 is_relro_local_ fields.
1058 (Output_section::is_relro): New function.
1059 (Output_section::set_is_relro): New function.
1060 (Output_section::is_relro_local): New function.
1061 (Output_section::set_is_relro_local): New function.
1062 (class Output_segment): Update declarations.
1063 * i386.cc (Target_i386::got_section): Mark .got section as relro.
1064 * sparc.cc (Target_sparc::got_section): Likewise.
1065 * x86_64.cc (Target_x86_64::got_section): Likewise.
1066 * testsuite/relro_test_main.cc: New file.
1067 * testsuite/relro_test.cc: New file.
1068 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
1069 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
1070 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
1071 (relro_test.so, relro_test_pic.o): New targets.
1072 * testsuite/Makefile.in: Rebuild.
1074 2008-05-16 Ian Lance Taylor <iant@google.com>
1076 * output.cc (Output_segment::add_output_section): Remove front
1078 * output.h (class Output_segment): Remove
1079 add_initial_output_section and overloaded add_output_section.
1080 Update declaration of remaining add_output_section.
1081 * layout.cc (Layout::create_interp): Call add_output_section
1082 rather than add_initial_output_section.
1083 (Layout::finish_dynamic_section): Likewise.
1085 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
1086 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
1087 know the dynamic type.
1088 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
1089 field. Initialize it in constructor.
1090 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
1091 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
1092 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
1095 * output.cc (Output_reloc::get_address): Change return type to
1097 * output.h (class Output_reloc): Update get_address declaration.
1098 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
1099 for section addresses.
1101 2008-05-09 Ian Lance Taylor <iant@google.com>
1104 * gold.cc (gold_nomem): Use return value of write.
1106 2008-05-08 Ian Lance Taylor <iant@google.com>
1108 * symtab.c (Symbol::init_base_output_data): Add version
1109 parameter. Change all callers.
1110 (Symbol::init_base_output_segment): Likewise.
1111 (Symbol::init_base_constant): Likewise.
1112 (Symbol::init_base_undefined): Likewise.
1113 (Sized_symbol::init_output_data): Likewise.
1114 (Sized_symbol::init_output_segment): Likewise.
1115 (Sized_symbol::init_constant): Likewise.
1116 (Sized_symbol::init_undefined): Likewise.
1117 (Symbol_table::do_define_in_output_data): If the new symbol has a
1118 version, mark it as the default.
1119 (Symbol_table::do_define_in_output_segment): Likewise.
1120 (Symbol_table::do_define_as_constant): Likewise.
1121 * symtab.h (class Symbol): Update declarations.
1122 (class Sized_symbol): Likewise.
1123 * resolve.cc (Symbol::override_version): New function.
1124 (Symbol::override_base): Call override_version.
1125 (Symbol::override_base_with_special): Likewise.
1126 * testsuite/ver_script_8.script: New file.
1127 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
1128 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
1129 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
1130 (ver_test_8_1.so, ver_test_8_2.so): New targets.
1132 2008-05-06 Ian Lance Taylor <iant@google.com>
1135 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
1137 (class General_options): Remove existing --undefined, and add
1138 --no-undefined instead. Add new --undefined as synonym for -u.
1139 * archive.cc (Archive::add_symbols): Check whether symbol was
1141 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
1142 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
1143 all uses. Add IS_UNDEFINED. Update declarations to split
1144 different versions of init_base. Declare init_base_undefined.
1145 (Symbol::is_defined): Handle IS_UNDEFINED.
1146 (Symbol::is_undefined): Likewise.
1147 (Symbol::is_weak_undefined): Call is_undefined.
1148 (Symbol::is_absolute): Handle IS_CONSTANT.
1149 (class Sized_symbol): Update declarations to split different
1150 versions of init. Declare init_undefined.
1151 (class Symbol_table): Declare new functions.
1152 * symtab.cc (Symbol::init_base_object): Rename from init_base.
1154 (Symbol::init_base_output_data): Likewise.
1155 (Symbol::init_base_output_segment): Likewise.
1156 (Symbol::init_base_constant): Likewise.
1157 (Symbol::init_base_undefined): New function.
1158 (Sized_symbol::init_object): Rename from init. Change all
1160 (Sized_symbol::init_output_data): Likewise.
1161 (Sized_symbol::init_output_segment): Likewise.
1162 (Sized_symbol::init_constant): Likewise.
1163 (Sized_symbol::init_undefined): New function.
1164 (Symbol_table::add_undefined_symbols_from_command_line): New
1166 (Symbol_table::do_add_undefined_symbols_from_command_line): New
1168 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
1169 (Symbol::output_section): Likewise.
1170 (Symbol::set_output_section): Likewise.
1171 (Symbol_table::sized_finalize_symbol): Likewise.
1172 (Symbol_table::sized_write_globals): Likewise.
1173 * resolve.cc (Symbol_table::should_override): Likewise.
1174 (Symbol::override_base_with_special): Likewise.
1176 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
1177 symbol, change it to have default visibility.
1178 * testsuite/protected_1.cc: New file.
1179 * testsuite/protected_2.cc: New file.
1180 * testsuite/protected_3.cc: New file.
1181 * testsuite/protected_main_1.cc: New file.
1182 * testsuite/protected_main_2.cc: New file.
1183 * testsuite/protected_main_3.cc: New file.
1184 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
1185 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
1186 (protected_1_LDFLAGS, protected_1_LDADD): Define.
1187 (protected_1.so): New target.
1188 (protected_1_pic.o, protected_2_pic.o): New targets.
1189 (protected_3_pic.o): New target.
1190 (check_PROGRAMS): Add protected_2.
1191 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
1192 (protected_2_LDFLAGS, protected_2_LDADD): Define.
1193 * testsuite/Makefile.in: Rebuild.
1195 * options.h (DEFINE_var): Add set_user_set_##varname__.
1196 (DEFINE_bool_alias): New macro.
1197 (class General_options): Define -Bstatic using DEFINE_bool_alias
1198 rather than DEFINE_special. Add --undefined as an alias for -z
1200 * options.cc (General_options::parse_Bstatic): Remove.
1202 * options.h (class General_options): Add --fatal-warnings.
1203 * main.cc (main): Implement --fatal-warnings.
1204 * errors.h (Errors::warning_count): New function.
1206 * options.h (class General_options): Add -Bsymbolic-functions.
1207 * symtab.h (Symbol::is_preemptible): Check for
1208 -Bsymbolic-functions.
1210 2008-05-05 Ian Lance Taylor <iant@google.com>
1212 * options.h (DEFINE_bool): For DASH_Z, create the negative option
1213 as noVARNAME rather than no-VARNAME.
1214 (class General_options): Add option -z combreloc.
1215 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
1217 (Output_reloc::sort_before) [SHT_REL]: New function.
1218 (Output_reloc::sort_before) [SHT_RELA]: New function.
1219 (class Output_data_reloc_base): Add sort_relocs_ field. Define
1220 Sort_relocs_comparison.
1221 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
1222 parameter. Change all callers.
1223 (Output_data_reloc::Output_data_reloc) [both versions]: Add
1224 sort_relocs parameter. Change all callers.
1225 * output.cc (Output_reloc::get_address): New function, broken out
1227 (Output_reloc::write_rel): Call it.
1228 (Output_reloc::compare): New function.
1229 (Output_data_reloc_base::do_write): Optionally sort relocs.
1231 * configure.ac: If targ_extra_obj is set, link it in.
1232 * configure.tgt: Initialize all variables.
1233 (x86_64*): Set targ_extra_obj and targ_extra_size.
1234 * configure: Rebuild.
1236 * object.cc (Sized_relobj::include_section_group): Adjust section
1237 indexes read from group data. Build vector to pass to
1239 * layout.cc (Layout::layout_group): Add flags and shndxes
1240 parameters. Remove contents parameter. Change caller. Update
1241 explicit instantiations.
1242 * layout.h (class Layout): Update layout_group declaration.
1243 * output.cc (Output_data_group::Output_data_group): Add flags and
1244 input_shndxes parameters. Remove contents parameter. Change
1246 (Output_data_group::do_write): Change input_sections_ to
1248 * output.h (class Output_data_group): Update constructor
1249 declaration. Rename input_sections_ to input_shndxes_.
1250 * testsuite/many_sections_test.cc: Add template.
1252 2008-04-30 Cary Coutant <ccoutant@google.com>
1254 * target-reloc.h (relocate_section): Fix dead-pointer bug.
1256 * layout.cc (Layout::include_section): Refactored check for debug
1258 (Layout::add_comdat): Add new parameters. Change type
1259 of signature parameter. Add object and shndx to signatures table.
1260 (Layout::find_kept_object): New function.
1261 * layout.h: Include <cstring>.
1262 (Layout::is_debug_info_section): New function.
1263 (Layout::add_comdat): Add new parameters.
1264 (Layout::find_kept_object): New function.
1265 (Layout::Kept_section): New struct.
1266 (Layout::Signatures): Change type of map range.
1267 * object.cc (Relobj::output_section_address): New function.
1268 (Sized_relobj::include_section_group): Add new parameters. Change
1269 calls to Layout::add_comdat. Change to build table of kept comdat
1270 groups and table mapping discarded sections to kept sections.
1271 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
1272 (Sized_relobj::do_layout): Change calls to include_section_group and
1273 include_linkonce_section.
1274 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
1275 value to zero when section is discarded.
1276 (Sized_relobj::map_to_kept_section): New function.
1277 * object.h (Relobj::output_section_address): New function.
1278 (Relobj::Comdat_group): New type.
1279 (Relobj::find_comdat_group): New function.
1280 (Relobj::Comdat_group_table): New type.
1281 (Relobj::Kept_comdat_section): New type.
1282 (Relobj::Kept_comdat_section_table): New type.
1283 (Relobj::add_comdat_group): New function.
1284 (Relobj::set_kept_comdat_section): New function.
1285 (Relobj::get_kept_comdat_section): New function.
1286 (Relobj::comdat_groups_): New field.
1287 (Relobj::kept_comdat_sections_): New field.
1288 (Symbol_value::input_value): Update comment.
1289 (Sized_relobj::map_to_kept_section) New function.
1290 (Sized_relobj::include_linkonce_section): Add new parameter.
1291 * target-reloc.h (Comdat_behavior): New type.
1292 (get_comdat_behavior): New function.
1293 (relocate_section): Add code to map a discarded section to the
1294 corresponding kept section when applying a relocation.
1296 2008-04-30 Craig Silverstein <csilvers@google.com>
1298 * dwarf_reader.cc (next_generation_count): New static var.
1299 (Addr2line_cache_entry): New struct.
1300 (addr2line_cache): New static var.
1301 (Dwarf_line_info::one_addr2line): Added caching.
1302 (Dwarf_line_info::clear_addr2line_cache): New function.
1303 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
1304 cache-size parameter.
1305 (Dwarf_line_info::one_addr2line_cache): New function.
1306 * symtab.cc (Symbol_table::detect_odr_violations): Pass
1307 new cache-size argument to one_addr2line(), and clear cache.
1309 2008-04-28 Cary Coutant <ccoutant@google.com>
1311 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
1312 R_386_PC8 relocations.
1314 2008-04-23 Ian Lance Taylor <iant@google.com>
1316 * object.cc (Sized_relobj::include_section_group): Check for
1317 invalid section group.
1319 * object.cc (make_elf_object): Correct test for 64-bit ELF file
1322 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
1323 than read for file header.
1324 * archive.cc (Archive::include_member): Likewise.
1326 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
1328 * aclocal.m4: Regenerate.
1329 * configure: Regenerate.
1331 2008-04-19 Ian Lance Taylor <iant@google.com>
1333 * version.cc (version_string): Bump to 1.6.
1335 * testsuite/Makefile.am (many_sections_r_test): New target.
1336 (many_sections_r_test_SOURCES): Remove.
1337 (many_sections_r_test_DEPENDENCIES): Remove.
1338 (many_sections_r_test_LDFLAGS): Remove.
1339 (many_sections_r_test_LDADD): Remove.
1341 * object.cc (Sized_relobj::do_add_symbols): Always pass
1342 local_symbol_count_ to add_from_relobj.
1344 * testsuite/Makefile.am (many_sections_check.h): Only check one in
1345 every thousand variables.
1346 * testsuite/Makefile.in: Rebuild.
1348 * object.cc (Xindex::initialize_symtab_xindex): New function.
1349 (Xindex::read_symtab_xindex): New function.
1350 (Xindex::sym_xindex_to_shndx): New function.
1351 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
1353 (Sized_relobj::do_initialize_xindex): New function.
1354 (Sized_relobj::do_read_symbols): Adjust section links.
1355 (Sized_relobj::symbol_section_and_value): Add is_ordinary
1356 parameter. Change all callers.
1357 (Sized_relobj::include_section_group): Adjust section links and
1358 symbol section indexes.
1359 (Sized_relobj::do_layout): Adjust section links.
1360 (Sized_relobj::do_count_local_symbols): Adjust section links and
1361 symbol section indexes.
1362 (Sized_relobj::do_finalize_local_symbols): Distinguish between
1363 ordinary and special symbols.
1364 (Sized_relobj::write_local_symbols): Add symtab_xindex and
1365 dynsym_xindex parameters. Change all callers. Adjust section
1366 links. Use SHN_XINDEX when needed.
1367 (Sized_relobj::get_symbol_location_info): Adjust section links.
1368 Don't get fooled by special symbols.
1369 * object.h (class Xindex): Define.
1370 (class Object): Add xindex_ parameter. Declare virtual functoin
1371 do_initialize_xindex.
1372 (Object::adjust_sym_shndx): New function.
1373 (Object::set_xindex): New protected function.
1374 (class Symbol_value): Add is_ordinary_shndx_ field.
1375 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
1376 (Symbol_value::value): Assert ordinary section.
1377 (Symbol_value::initialize_input_to_output_map): Likewise.
1378 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
1380 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
1382 (class Sized_relobj): Update declarations.
1383 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
1384 parameter. Change all callers.
1385 (Sized_relobj::adjust_shndx): New function.
1386 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
1388 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
1389 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
1390 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
1391 (Sized_dynobj::read_dynsym_section): Adjust section links.
1392 (Sized_dynobj::read_dynamic): Likewise.
1393 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
1395 (Sized_dynobj::do_initialize_xindex): New function.
1396 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
1397 do_initialize_xindex.
1398 (Sized_dynobj::adjust_shndx): New function.
1399 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
1400 dynsym_xindex_ fields.
1401 (Layout::finalize): Add a call to set_section_indexes before
1402 creating the symtab sections.
1403 (Layout::set_section_indexes): Don't do anything if the section
1404 already has a section index.
1405 (Layout::create_symtab_sections): Add shnum parameter. Change
1406 caller. Create .symtab_shndx section if needed.
1407 (Layout::create_shdrs): Add shstrtab_section parameter. Change
1409 (Layout::allocated_output_section_count): New function.
1410 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
1412 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
1413 fields. Update declarations.
1414 (Layout::symtab_xindex): New function.
1415 (Layout::dynsym_xindex): New function.
1416 (class Write_symbols_task): Add layout_ field.
1417 (Write_symbols_task::Write_symbols_task): Add layout parameter.
1419 * output.cc (Output_section_headers::Output_section_headers): Add
1420 shstrtab_section parameter. Change all callers.
1421 (Output_section_headers::do_sized_write): Store overflow values
1422 for section count and section string table section index in
1423 section header zero.
1424 (Output_file_header::do_sized_write): Check for overflow of
1425 section count and section string table section index.
1426 (Output_symtab_xindex::do_write): New function.
1427 (Output_symtab_xindex::endian_do_write): New function.
1428 * output.h (class Output_section_headers): Add shstrtab_section_.
1429 Update declarations.
1430 (class Output_symtab_xindex): Define.
1431 (Output_section::has_out_shndx): New function.
1432 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
1434 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
1436 (Sized_symbol::init): Likewise.
1437 (Symbol::output_section): Check for ordinary symbol.
1438 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
1439 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
1441 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
1442 Change all callers. Simplify handling of symbols from sections
1443 not included in the link.
1444 (Symbol_table::add_from_dynobj): Handle ordinary symbol
1446 (Weak_alias_sorter::operator()): Assert that symbols are
1448 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
1450 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
1451 parameters. Change all callers.
1452 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
1453 symbol distinction. Use SHN_XINDEX when needed.
1454 (Symbol_table::write_section_symbol): Add symtab_xindex
1455 parameter. Change all callers.
1456 (Symbol_table::sized_write_section_symbol): Likewise. Use
1457 SHN_XINDEX when needed.
1458 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
1460 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
1461 (Symbol::is_defined): Check is_ordinary.
1462 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
1463 (Symbol::is_absolute, Symbol::is_common): Likewise.
1464 (class Sized_symbol): Update declarations.
1465 (class Symbol_table): Update declarations.
1466 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
1467 parameters. Change all callers.
1468 (Sized_symbol::override): Likewise.
1469 (Symbol_table::override): Likewise.
1470 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
1471 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
1472 is_ordinary, and orig_st_shndx parameters. Change all callers.
1473 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
1474 to be in an ordinary section.
1475 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
1476 object and is_ordinary parameters. Change all callers.
1477 (Sized_dwarf_line_info::read_relocs): Add object parameter.
1478 Change all callers. Don't add undefined or non-ordinary symbols
1480 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
1482 * dwarf_reader.h (class Sized_dwarf_line_info): Update
1484 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
1485 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
1486 (Sized_relobj::relocate_sections): Likewise.
1487 * target-reloc.h (scan_relocs): Adjust section symbol index.
1488 (scan_relocatable_relocs): Likewise.
1489 * i386.cc (Scan::local): Check for ordinary symbols.
1490 * sparc.cc (Scan::local): Likewise.
1491 * x86_64.cc (Scan::local): Likewise.
1492 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
1493 to symbol_section_and_value.
1494 * testsuite/many_sections_test.cc: New file.
1495 * testsuite/Makefile.am (BUILT_SOURCES): Define.
1496 (check_PROGRAMS): Add many_sections_test.
1497 (many_sections_test_SOURCES): Define.
1498 (many_sections_test_DEPENDENCIES): Define.
1499 (many_sections_test_LDFLAGS): Define.
1500 (BUILT_SOURCES): Add many_sections_define.h.
1501 (many_sections_define.h): New target.
1502 (BUILT_SOURCES): Add many_sections_check.h.
1503 (many_sections_check.h): New target.
1504 (check_PROGRAMS): Add many_sections_r_test.
1505 (many_sections_r_test_SOURCES): Define.
1506 (many_sections_r_test_DEPENDENCIES): Define.
1507 (many_sections_r_test_LDFLAGS): Define.
1508 (many_sections_r_test_LDADD): Define.
1509 (many_sections_r_test.o): New target.
1510 * testsuite/Makefile.in: Rebuild.
1512 2008-04-17 Cary Coutant <ccoutant@google.com>
1514 * errors.cc (Errors::info): New function.
1515 (gold_info): New function.
1516 * errors.h (Errors::info): New function.
1517 * gold.h (gold_info): New function.
1518 * object.cc (Input_objects::add_object): Print trace output.
1519 * options.cc (options::parse_set): New function.
1520 (General_options::parse_wrap): Deleted.
1521 (General_options::General_options): Deleted initializer.
1522 * options.h (options::String_set): New typedef.
1523 (options::parse_set): New function.
1524 (DEFINE_set): New macro.
1525 (General_options::wrap): Changed to use DEFINE_set. Changed
1526 callers of any_wrap_symbols and is_wrap_symbol.
1527 (General_options::trace, General_options::trace_symbol):
1529 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
1530 (General_options::wrap_symbols_): Deleted.
1531 * symtab.cc (Symbol_table::add_from_object): Print trace output.
1533 2008-04-17 David S. Miller <davem@davemloft.net>
1535 * options.cc (General_options::parse_V): New function.
1536 * options.h: Add entries for -V and -Qy.
1538 2008-04-17 Ian Lance Taylor <iant@google.com>
1540 * common.cc (Symbol_table::allocate_commons): Remove options
1541 parameter. Change caller.
1542 (Symbol_table::do_allocate_commons): Remove options parameter.
1543 Change caller. Just call do_allocate_commons_list twice.
1544 (Symbol_table::do_allocate_commons_list): New function, broken out
1545 of do_allocate_commons.
1546 * common.h (class Allocate_commons_task): Remove options_ field.
1548 * symtab.cc (Symbol_table::Symbol_table): Initialize
1550 (Symbol_table::add_from_object): Put TLS common symbols on
1552 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
1553 which are IN_OUTPUT_DATA.
1554 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
1555 allocate_commons and do_allocate_commons declarations. Declare
1556 do_allocate_commons_list.
1557 * gold.cc (queue_middle_tasks): Update creation of
1558 Allocate_commons_task to not pass options.
1559 * testsuite/Makefile.am (INCLUDES): Add -I.. .
1560 (TLS_TEST_C_FLAGS): New variable.
1561 (tls_test_c_pic.o): New target.
1562 (tls_test_shared.so): Link in tls_test_c_pic.o.
1563 (tls_test_c_pic_ie.o): New target.
1564 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
1565 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
1566 (tls_test_c.o): New target.
1567 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
1568 (tls_pic_test_LDADD): Likewise.
1569 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
1570 (tls_shared_gd_to_ie_test_LDADD): Likewise.
1571 (tls_test_c_gnu2.o): New target.
1572 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
1574 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
1575 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
1576 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
1577 * testsuite/tls_test.cc: Include "config.h".
1578 (t_last): Call t11_last.
1579 * testsuite/tls_test.h (t11, t11_last): Declare.
1580 * testsuite/tls_test_c.c: New file.
1581 * testsuite/tls_test_main.cc (thread_routine): Call t11.
1582 * configure.ac: Check for OpenMP support.
1583 * configure, config.in, Makefile.in: Rebuild.
1584 * testsuite/Makefile.in: Rebuild.
1586 2008-04-16 Cary Coutant <ccoutant@google.com>
1588 * i386.cc (Target_i386::define_tls_base_symbol): New function.
1589 (Target_i386::tls_base_symbol_defined_): New field.
1590 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
1591 (Target_i386::Scan::global): Likewise.
1592 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
1593 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
1594 (Target_x86_64::tls_base_symbol_defined_): New field.
1595 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
1596 (Target_x86_64::Scan::global): Likewise.
1598 2008-04-16 Cary Coutant <ccoutant@google.com>
1600 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
1601 (Symbol::needs_plt_entry): Allow weak undefined symbols.
1602 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
1603 building shared libraries.
1604 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
1605 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
1606 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
1607 * testsuite/Makefile.in: Rebuild.
1608 * testsuite/weak_undef.h: New file.
1609 * testsuite/weak_undef_file1.cc: Add extra test cases.
1610 * testsuite/weak_undef_file2.cc: Likewise.
1611 * testsuite/weak_undef_test.cc: Likewise.
1613 2008-04-16 David S. Miller <davem@davemloft.net>
1615 * sparc.cc (Target_sparc::Scan): Change from struct to class.
1616 Add issued_non_pic_error_ field. Declare check_non_pic.
1617 (Target_sparc::Scan::check_non_pic): New function.
1618 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
1619 (Target_sparc::Scan::global): Likewise.
1621 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
1622 * configure: Rebuild.
1624 * options.h (DEFINE_enable): New macro.
1625 (new_dtags): New enable option.
1626 (initfirst, interpose, loadfltr, nodefaultlib,
1627 nodelete, nodlopen, nodump): New -z options.
1628 * layout.cc (Layout:finish_dynamic_section): If new
1629 dtags enabled, emit DT_RUNPATH. Also, emit a
1630 DT_FLAGS_1 containing any specified -z flags.
1632 2008-04-16 Ian Lance Taylor <iant@google.com>
1634 * copy-relocs.cc: New file.
1635 * copy-relocs.h: New file.
1636 * reloc.cc: Remove Copy_relocs code.
1637 * reloc.h: Likewise.
1638 * reloc-types.h (struct Reloc_types) [both versions]: Add
1639 get_reloc_addend_noerror.
1640 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
1641 variants of add_global which take an addend which must be zero.
1642 * i386.cc: Include "copy-relocs.h".
1643 (class Target_i386): Change type of copy_relocs_ to variable,
1645 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
1647 (Target_i386::do_finalize_sections): Change handling of
1649 * sparc.cc: Include "copy-relocs.h".
1650 (class Target_sparc): Change type of copy_relocs_ to variable,
1652 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
1654 (Target_sparc::do_finalize_sections): Change handling of
1656 * x86_64.cc: Include "copy-relocs.h".
1657 (class Target_x86_64): Change type of copy_relocs_ to variable,
1659 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
1660 class. Change all callers.
1661 (Target_x86_64::do_finalize_sections): Change handling of
1663 * Makefile.am (CCFILES): Add copy-relocs.cc.
1664 (HFILES): Add copy-relocs.h.
1666 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
1668 * testsuite/script_test_4.sh: Permit leading zeroes.
1670 2008-04-15 Ian Lance Taylor <iant@google.com>
1672 * script-sections.cc (Script_sections::create_segments): Use
1673 header_size_adjustment even when there is enough room for the
1675 * testsuite/script_test_4.sh: New file.
1676 * testsuite/script_test_4.t: New file.
1677 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
1678 (check_DATA): Add script_test_4.stdout.
1679 (MOSTLYCLEANFILES): Likewise.
1680 (script_test_4): New target.
1681 (script_test_4.stdout): New target.
1682 * testsuite/Makefile.in: Rebuild.
1684 * sparc.cc: Add definitions for Output_data_plt_sparc class
1687 2008-04-14 David S. Miller <davem@davemloft.net>
1689 * sparc.cc: New file.
1690 * Makefile.am (TARGETSOURCES): Add sparc.cc
1691 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
1692 * configure.tgt: Document targ_extra_size and
1693 targ_extra_big_endian. Add entries for sparc-* and
1695 * configure.ac: Handle targ_extra_size and
1696 targ_extra_big_endian.
1697 * Makefile.in: Rebuild.
1698 * configure: Likewise.
1699 * po/POTFILES.in: Likewise.
1700 * po/gold.pot: Likewise.
1702 2008-04-14 Ian Lance Taylor <iant@google.com>
1704 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
1705 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
1706 in the name/type/flags to section mapping. Don't call
1707 allocate_output_section.
1708 (Layout::choose_output_section): Change parameter from adjust_name
1709 to is_input_section. Don't permit input sections after sections
1710 are attached to segments. Don't call allocate_output_section.
1711 (Layout::layout_eh_frame): Call update_flags_for_input_section,
1712 not write_enable_output_section.
1713 (Layout::make_output_section): Don't push to
1714 unattached_section_list_ nor call attach_to_segment. Call
1715 attach_section_to_segment if sections are attached.
1716 (Layout::attach_sections_to_segments): New function.
1717 (Layout::attach_section_to_segment): New function.
1718 (Layout::attach_allocated_section_to_segment): Rename from
1719 attach_to_segment. Remove flags parameter.
1720 (Layout::allocate_output_section): Remove function.
1721 (Layout::write_enable_output_section): Remove function.
1722 * layout.h (class Layout): Update for above changes. Add new
1723 field sections_are_attached_.
1724 * output.h (Output_section::update_flags_for_input_section): New
1726 * output.cc (Output_section::add_input_section): Call
1727 update_flags_for_input_section.
1728 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
1730 2008-04-11 Cary Coutant <ccoutant@google.com>
1732 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
1733 thought unnecessary.
1734 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
1736 2008-04-11 Ian Lance Taylor <iant@google.com>
1738 * output.h (class Output_section_data): Remove inline definition
1740 * output.cc (Output_section_data::set_addralign): New function.
1742 2008-04-11 Cary Coutant <ccoutant@google.com>
1744 Add support for TLS descriptors for i386 and x86_64.
1745 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
1746 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
1747 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
1749 (Target_i386::got_mod_index_entry): Remove unnecessary code.
1750 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
1751 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
1753 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
1754 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
1755 Fix problem with initial-exec relocations.
1756 (Target_i386::Relocate::relocate_tls): Likewise.
1757 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
1759 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
1760 support for section-plus-offset dynamic table entries.
1761 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
1762 (Output_data_dynamic::Dynamic_entry): Add support for
1763 section-plus-offset dynamic table entries.
1764 (Output_data_dynamic::Classification): Likewise.
1765 (Output_data_dynamic::classification_): Renamed offset_.
1766 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
1767 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
1768 (Target_x86_64::make_plt_section): New function.
1769 (Target_x86_64::reserve_tlsdesc_entries): New function.
1770 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
1771 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
1772 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
1773 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
1774 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
1775 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
1776 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
1777 add extra PLT entry for TLS descriptors.
1778 (Output_data_plt_x86_64::got_): New field.
1779 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
1780 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
1782 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
1784 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
1785 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
1786 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
1787 R_386_TLS_DESC_CALL relocations.
1788 (Target_x86_64::Scan::global): Likewise.
1789 (Target_x86_64::do_finalize_sections): Add dynamic table entries
1790 for TLS descriptors.
1791 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
1792 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
1793 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
1794 GD-to-IE relaxation.
1795 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
1796 and TLS_DESCRIPTORS.
1797 * Makefile.in: Rebuild.
1798 * configure: Rebuild.
1799 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
1800 (tls_test_shared2.so): New target.
1801 (tls_shared_gd_to_ie_test_SOURCES): New variable.
1802 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
1803 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
1804 (tls_shared_gd_to_ie_test_LDADD): New variable.
1805 (tls_shared_gnu2_gd_to_ie_test): New target.
1806 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
1808 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
1809 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
1810 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
1811 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
1812 (tls_shared_gnu2_test): New target.
1813 (tls_test_gnu2_shared.so): New target.
1814 (tls_shared_gnu2_test_SOURCES): New variable.
1815 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
1816 (tls_shared_gnu2_test_LDFLAGS): New variable.
1817 (tls_shared_gnu2_test_LDADD): New variable.
1818 * testsuite/Makefile.in: Rebuild.
1819 * testsuite/Makefile.
1821 2008-04-11 Ian Lance Taylor <iant@google.com>
1823 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
1825 * testsuite/Makefile.in: Rebuild.
1827 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
1829 * testsuite/script_test_2.cc (main): Adjust test.
1831 2008-04-11 David S. Miller <davem@davemloft.net>
1832 Ian Lance Taylor <iant@google.com>
1834 * options.h (General_options): Add entries for '-Y' and
1836 * options.cc (General_options:finalize): If -Y was used, add those
1837 entries to the library path instead of the default "/lib" and
1840 2008-04-11 David S. Miller <davem@davemloft.net>
1842 * testsuite/justsyms.t: Start at 0x100.
1843 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
1844 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
1846 * testsuite/script_test_2.cc: Adjust string and section length
1849 2008-04-09 Ian Lance Taylor <iant@google.com>
1852 * script-sections.cc (Sections_element::allocate_to_segment): Add
1854 (Output_section_definition::allocate_to_segment): Likewise.
1855 (Orphan_output_section::allocate_to_segment): Likewise.
1856 (Script_sections::attach_sections_using_phdrs_clause): Don't
1857 propagate non-PT_LOAD segments to orphan sections.
1858 * testsuite/Makefile.am (script_test_3.stdout): Generate using
1859 readelf rather than objdump.
1860 * testsuite/script_test_3.sh: Adjust accordingly. Test that
1861 .interp section and PT_INTERP segment are the same size.
1862 * testsuite/Makefile.in: Rebuild.
1864 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
1865 aliases for symbols defined in the same object.
1866 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
1867 (weak_alias_test_SOURCES): New variable.
1868 (weak_alias_test_DEPENDENCIES): New variable.
1869 (weak_alias_test_LDFLAGS): New variable.
1870 (weak_alias_test_LDADD): New variable.
1871 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
1872 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
1873 (weak_alias_test_3.o): New target.
1874 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
1875 * testsuite/weak_alias_test_main.cc: New file.
1876 * testsuite/weak_alias_test_1.cc: New file.
1877 * testsuite/weak_alias_test_2.cc: New file.
1878 * testsuite/weak_alias_test_3.cc: New file.
1880 2008-04-08 Ian Lance Taylor <iant@google.com>
1882 * options.h (class General_options): Add --noinhibit-exec option.
1883 * main.cc (main): Check --noinhibit-exec.
1885 * options.h (class General_options): Define --wrap as a special
1886 option. Add wrap_symbols_ field.
1887 (General_options::any_wrap_symbols): New function.
1888 (General_options::is_wrap_symbol): New function.
1889 * options.cc (General_options::parse_wrap): New function.
1890 (General_options::General_options): Initialize wrap_symbols_.
1891 * symtab.cc (Symbol_table::wrap_symbol): New function.
1892 (Symbol_table::add_from_object): Handle --wrap.
1893 * symtab.h (class Symbol_table): Declare wrap_symbol.
1894 * target.h (Target::wrap_char): New function.
1895 (Target::Target_info): Add wrap_char field.
1896 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
1897 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1898 * testsuite/testfile.cc (Target_test::test_target_info):
1901 * errors.cc (Errors::undefined_symbol): Mention symbol version if
1904 * layout.h (class Layout): Add added_eh_frame_data_ field.
1905 * layout.cc (Layout::Layout): Initialize new field.
1906 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
1907 output section until we find a section we merged successfully.
1908 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
1909 that the size be non-zero.
1911 * merge.cc (Object_merge_map::get_output_offset): Remove inline
1914 2008-04-08 Craig Silverstein <csilvers@google.com>
1916 * configure.ac: Export new conditional variable HAVE_ZLIB.
1917 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
1919 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
1920 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
1922 2008-04-07 Ian Lance Taylor <iant@google.com>
1924 * version.cc (version_string): Set to "1.5".
1926 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
1927 Add issued_non_pic_error_ field. Declare check_non_pic.
1928 (Target_x86_64::Scan::check_non_pic): New function.
1929 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
1930 (Target_x86_64::Scan::global): Likewise.
1932 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
1933 addend parameter. Change caller. Handle merge sections.
1934 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
1935 Address to Addend. Don't add in the result of
1936 local_section_offset, pass down the addend and use the returned
1938 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
1939 Update declarations of local_section_offset and symbol_value.
1940 * testsuite/two_file_test_1.cc (t18): New function.
1941 * testsuite/two_file_test_2.cc (f18): New function.
1942 * testsuite/two_file_test_main.cc (main): Call t18.
1943 * testsuite/two_file_test.h (t18, f18): Declare.
1945 * configure.ac: Don't test for objdump, c++filt, or readelf.
1946 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
1948 (TEST_READELF): New variable.
1949 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
1950 (check_PROGRAMS): Add two_file_strip_test.
1951 (two_file_strip_test): New target.
1952 (check_PROGRAMS): Add two_file_same_shared_strip_test.
1953 (two_file_same_shared_strip_test_SOURCES): New variable.
1954 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
1955 (two_file_same_shared_strip_test_LDFLAGS): New variable.
1956 (two_file_same_shared_strip_test_LDADD): New variable.
1957 (two_file_shared_strip.so): New target.
1958 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
1959 (ver_test_5.syms, ver_test_7.syms): Likewise.
1960 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
1961 (strip_test_3.stdout): Use TEST_OBJDUMP.
1962 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
1964 2008-04-04 Cary Coutant <ccoutant@google.com>
1966 * symtab.h (Symbol::is_weak_undefined): New function.
1967 (Symbol::is_strong_undefined): New function.
1968 (Symbol::is_absolute): New function.
1969 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
1970 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
1972 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
1973 (weak_undef_test): New target.
1974 * testsuite/Makefile.in: Rebuild.
1975 * testsuite/weak_undef_file1.cc: New file.
1976 * testsuite/weak_undef_file2.cc: New file.
1977 * testsuite/weak_undef_test.cc: New file.
1979 2008-04-03 Craig Silverstein <csilvers@google.com>
1981 * compressed_output.h (class Output_compressed_section): Use
1983 * compressed_output.cc (zlib_compress): Use unsigned buffers,
1985 (zlib_compressed_suffix): Removed.
1986 (Output_compressed_section::set_final_data_size): Use unsigned
1988 * testsuite/Makefile.am (flagstest_compress_debug_sections):
1989 Fix linker invocation.
1990 (flagstest_o_specialfile_and_compress_debug_sections):
1992 * testsuite/Makefile.in: Regenerated.
1994 2008-04-02 David S. Miller <davem@davemloft.net>
1996 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
1997 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
1999 2008-04-02 Craig Silverstein <csilvers@google.com>
2003 2008-04-02 Ian Lance Taylor <iant@google.com>
2005 * fileread.cc (File_read::find_view): Add byteshift and vshifted
2006 parameters. Update for new key type to views_. Change all
2008 (File_read::read): Adjust for byteshift in returned view.
2009 (File_read::add_view): New function, broken out of
2011 (File_read::make_view): New function, broken out of
2013 (File_read::find_or_make_view): Add offset and aligned
2014 parameters. Rewrite accordingly. Change all callers.
2015 (File_read::get_view): Add offset and aligned parameters. Adjust
2016 for byteshift in return value.
2017 (File_read::get_lasting_view): Likewise.
2018 * fileread.h (class File_read): Update declarations.
2019 (class File_read::View): Add byteshift_ field. Add byteshift to
2020 constructor. Add byteshift method.
2021 * archive.h (Archive::clear_uncached_views): New function.
2022 (Archive::get_view): Add aligned parameter. Change all callers.
2023 * object.h (Object::get_view): Add aligned parameter. Change all
2025 (Object::get_lasting_view): Likewise.
2027 * fileread.cc (File_read::release): Don't call clear_views if
2028 there are multiple objects.
2029 * fileread.h (File_read::clear_uncached_views): New function.
2030 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
2033 2008-03-31 Cary Coutant <ccoutant@google.com>
2035 Add thin archive support.
2036 * archive.cc (Archive::armagt): New const.
2037 (Archive::setup): Remove task parameter and calls to unlock.
2038 (Archive::unlock_nested_archives): New function.
2039 (Archive::read_header): Add nested_off parameter. Change
2041 (Archive::interpret_header): Likewise.
2042 (Archive::include_all_members): Change to handle thin
2044 (Archive::include_member): Likewise.
2045 * archive.h (Archive::Archive): Add new parameters and
2047 (Archive::armagt): New const.
2048 (Archive::setup): Remove task parameter.
2049 (Archive::unlock_nested_archives): New function.
2050 (Archive::read_header): Add nested_off parameter.
2051 (Archive::interpret_header): Likewise.
2052 (Archive::Nested_archive_table): New typedef.
2053 (Archive::is_thin_archive_): New field.
2054 (Archive::nested_archives_): New field.
2055 (Archive::options_): New field.
2056 (Archive::dirpath_): New field.
2057 (Archive::task_): New field.
2058 * readsyms.cc (Read_symbols::do_read_symbols): Add check
2059 for thin archives. Pass additional parameters to
2060 Archive::Archive. Unlock the archive file after calling
2063 2008-03-29 Ian Lance Taylor <iant@google.com>
2065 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
2066 version symbol to be local.
2067 * testsuite/ver_test_4.sh: New file.
2068 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
2069 (check_DATA): Add ver_test_4.syms.
2070 (ver_test_4.syms): New target.
2071 * testsuite/Makefile.in: Rebuild.
2074 (Output_section::Input_section_sort_entry::has_priority): New
2076 (Output_section::Input_section_sort_entry::match_file_name): New
2078 (Output_section::Input_section_sort_entry::match_section_name):
2080 (Output_section::Input_section_sort_entry::match_section_name_prefix):
2082 (Output_section::Input_section_sort_entry::match_section_file):
2084 (Output_section::Input_section_sort_compare::operator()): Rewrite
2085 using new Input_section_sort_entry functions. Sort crtbegin and
2086 crtend first. Sort sections with no priority before sections with
2088 * testsuite/initpri1.c (d3): Check j != 4.
2089 (cd5): New constructor/destructor function.
2090 (main): Check j != 2.
2092 * symtab.cc (Symbol_table::add_from_object): If we don't use the
2093 new symbol when resolving, don't call set_is_default.
2094 * testsuite/ver_test_7.cc: New file.
2095 * testsuite/ver_test_7.sh: New file.
2096 * testsuite/Makefile.am (ver_test_7.so): New target.
2097 (ver_test_7.o): New target.
2098 (check_SCRIPTS): Add ver_test_7.sh.
2099 (check_DATA): Add ver_test_7.syms.
2100 (ver_test_7.syms): New target.
2102 2008-03-28 Ian Lance Taylor <iant@google.com>
2104 * layout.cc (Layout::layout): If we see an input section with a
2105 name that needs sorting, set the must_sort flag for the output
2107 (Layout::make_output_section): If the name of the output section
2108 indicates that it might require sorting, set the may_sort flag.
2109 * output.h (Output_section::may_sort_attached_input_sections): New
2111 (Output_section::set_may_sort_attached_input_sections): New
2113 (Output_section::must_sort_attached_input_sections): New
2115 (Output_section::set_must_sort_attached_input_sections): New
2117 (class Output_section): Declare Input_section_sort_entry. Define
2118 Input_section_sort_compare. Declare
2119 sort_attached_input_sections. Add new fields:
2120 may_sort_attached_input_sections_,
2121 must_sort_attached_input_sections_,
2122 attached_input_sections_are_sorted_.
2123 * output.cc (Output_section::Output_section): Initialize new
2125 (Output_section::add_input_section): Add an entry to
2126 input_sections_ if may_sort or must_sort are true.
2127 (Output_section::set_final_data_size): Call
2128 sort_attached_input_sections if necessary.
2129 (Output_section::Input_section_sort_entry): Define new class.
2130 (Output_section::Input_section_sort_compare::operator()): New
2132 (Output_section::sort_attached_input_sections): New function.
2133 * configure.ac: Check whether the compiler supports constructor
2134 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
2135 * testsuite/initpri1.c: New file.
2136 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
2137 CONSTRUCTOR_PRIORITY.
2138 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
2139 (initpri1_LDFLAGS): New variable.
2140 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
2142 2008-03-27 Ian Lance Taylor <iant@google.com>
2144 * common.cc (Sort_commons::operator): Correct sorting algorithm.
2145 * testsuite/common_test_1.c: New file.
2146 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
2147 (common_test_1_SOURCES): New variable.
2148 (common_test_1_DEPENDENCIES): New variable.
2149 (common_test_1_LDFLAGS): New variable.
2151 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
2152 and commons_ correctly when NAME/VERSION does not override
2154 * testsuite/ver_test_6.c: New file.
2155 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
2156 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
2157 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
2159 2008-03-26 Ian Lance Taylor <iant@google.com>
2161 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
2162 of an undefined symbol from a version script.
2163 * testsuite/Makefile.am (ver_test_5.so): New target.
2164 (ver_test_5.o): New target.
2165 (check_SCRIPTS): Add ver_test_5.sh.
2166 (check_DATA): Add ver_test_5.syms.
2167 (ver_test_5.syms): New target.
2168 * testsuite/ver_test_5.cc: New file.
2169 * testsuite/ver_test_5.script: New file.
2170 * testsuite/ver_test_5.sh: New file.
2171 * Makefile.in, testsuite/Makefile.in: Rebuild.
2174 Fix problems building gold with gcc 4.3.0.
2175 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
2176 (gold_error_at_location, gold_warning_at_location): Use it.
2177 * configure.ac: Check whether we can compile and use a template
2178 function with a printf attribute.
2179 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
2180 when jumping over bytes.
2181 * object.cc: Instantiate Object::read_section_data.
2182 * debug.h: Include <cstring>
2183 * dwarf_reader.cc: Include <algorithm>
2184 * main.cc: Include <cstring>.
2185 * options.cc: Include <cstring>.
2186 * output.cc: Include <cstring>.
2187 * script.cc: Include <cstring>.
2188 * script.h: Include <string>.
2189 * symtab.cc: Include <cstring> and <algorithm>.
2190 * target-select.cc: Include <cstring>.
2191 * version.cc: Include <string>.
2192 * testsuite/testmain.cc: Include <cstdlib>.
2193 * configure, config.in: Rebuild.
2195 2008-03-25 Ian Lance Taylor <iant@google.com>
2197 * options.cc: Include "../bfd/bfdver.h".
2198 (options::help): Print bug reporting address.
2200 * version.cc (print_version): Adjust output for current value of
2205 * options.cc (options::help): Print list of supported targets.
2206 * target-select.h: Include <vector>.
2207 (class Target_selector): Make machine_, size_, and is_big_endian_
2208 fields const. Add bfd_name_ and instantiated_target_ fields.
2209 (Target_selector::Target_selector): Add bfd_name parameter.
2210 (Target_selector::recognize): Make non-virtual, call
2212 (Target_selector::recognize_by_name): Make non-virtual, call
2213 do_recognize_by_name.
2214 (Target_selector::supported_names): New function.
2215 (Target_selector::bfd_name): New function.
2216 (Target_selector::do_instantiate_target): New pure virtual
2218 (Target_selector::do_recognize): New virtual function.
2219 (Target_selector::do_recognize_by_name): New virtual function.
2220 (Target_selector::instantiate_target): New private function.
2221 (supported_target_names): Declare.
2222 * target-select.cc (Target_selector::Target_selector): Update for
2223 new parameter and fields.
2224 (select_target_by_name): Check that the name matches before
2225 calling recognize_by_name.
2226 (supported_target_names): New function.
2227 * i386.cc (class Target_selector_i386): Update Target_selector
2228 constructor call. Remove recognize and recognize_by_name. Add
2229 do_instantiate_target.
2230 * x86_64.cc (class Target_selector_x86_64): Likewise.
2231 * testsuite/testfile.cc (class Target_selector_test): Update for
2232 changes to Target_selector.
2234 * README: Rewrite, with some notes on unsupported features.
2236 2008-03-24 Cary Coutant <ccoutant@google.com>
2238 * i386.cc (Target_i386::Got_type): New enum declaration.
2239 (Target_i386::Scan::local): Updated callers of Output_data_got
2241 (Target_i386::Scan::global): Likewise.
2242 (Target_i386::Relocate::relocate): Likewise.
2243 (Target_i386::Relocate::relocate_tls): Likewise.
2244 * object.h (Got_offset_list): New class.
2245 (Sized_relobj::local_has_got_offset): Added got_type parameter.
2246 (Sized_relobj::local_got_offset): Likewise.
2247 (Sized_relobj::set_local_got_offset): Likewise.
2248 (Sized_relobj::local_has_tls_got_offset): Removed.
2249 (Sized_relobj::local_tls_got_offset): Removed.
2250 (Sized_relobj::set_local_tls_got_offset): Removed.
2251 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
2252 * output.cc (Output_data_got::add_global): Added got_type parameter.
2253 (Output_data_got::add_global_with_rel): Likewise.
2254 (Output_data_got::add_global_with_rela): Likewise.
2255 (Output_data_got::add_global_pair_with_rel): New function.
2256 (Output_data_got::add_global_pair_with_rela): New function.
2257 (Output_data_got::add_local): Added got_type parameter.
2258 (Output_data_got::add_local_with_rel): Likewise.
2259 (Output_data_got::add_local_with_rela): Likewise.
2260 (Output_data_got::add_local_pair_with_rel): New function.
2261 (Output_data_got::add_local_pair_with_rela): New function.
2262 (Output_data_got::add_global_tls): Removed.
2263 (Output_data_got::add_global_tls_with_rel): Removed.
2264 (Output_data_got::add_global_tls_with_rela): Removed.
2265 (Output_data_got::add_local_tls): Removed.
2266 (Output_data_got::add_local_tls_with_rel): Removed.
2267 (Output_data_got::add_local_tls_with_rela): Removed.
2268 * output.h (Output_data_got::add_global): Added got_type parameter.
2269 (Output_data_got::add_global_with_rel): Likewise.
2270 (Output_data_got::add_global_with_rela): Likewise.
2271 (Output_data_got::add_global_pair_with_rel): New function.
2272 (Output_data_got::add_global_pair_with_rela): New function.
2273 (Output_data_got::add_local): Added got_type parameter.
2274 (Output_data_got::add_local_with_rel): Likewise.
2275 (Output_data_got::add_local_with_rela): Likewise.
2276 (Output_data_got::add_local_pair_with_rel): New function.
2277 (Output_data_got::add_local_pair_with_rela): New function.
2278 (Output_data_got::add_global_tls): Removed.
2279 (Output_data_got::add_global_tls_with_rel): Removed.
2280 (Output_data_got::add_global_tls_with_rela): Removed.
2281 (Output_data_got::add_local_tls): Removed.
2282 (Output_data_got::add_local_tls_with_rel): Removed.
2283 (Output_data_got::add_local_tls_with_rela): Removed.
2284 * resolve.cc (Symbol::override_base_with_special): Removed
2285 reference to has_got_offset_ field.
2286 * symtab.cc (Symbol::init_fields): Replaced initialization
2287 of got_offset_ with got_offsets_. Removed initialization
2289 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
2290 (Symbol::got_offset): Likewise.
2291 (Symbol::set_got_offset): Likewise.
2292 (Symbol::has_tls_got_offset): Removed.
2293 (Symbol::tls_got_offset): Removed.
2294 (Symbol::set_tls_got_offset): Removed.
2295 (Symbol::got_offset_): Removed.
2296 (Symbol::tls_mod_got_offset_): Removed.
2297 (Symbol::tls_pair_got_offset_): Removed.
2298 (Symbol::got_offsets_): New field.
2299 (Symbol::has_got_offset): Removed.
2300 (Symbol::has_tls_mod_got_offset): Removed.
2301 (Symbol::has_tls_pair_got_offset): Removed.
2302 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
2303 (Target_x86_64::Scan::local): Updated callers of Output_data_got
2305 (Target_x86_64::Scan::global): Likewise.
2306 (Target_x86_64::Relocate::relocate): Likewise.
2307 (Target_x86_64::Relocate::relocate_tls): Likewise.
2309 2008-03-25 Ben Elliston <bje@au.ibm.com>
2311 * yyscript.y: Fix spelling error in comment.
2313 2008-03-24 Ian Lance Taylor <iant@google.com>
2315 * options.h (class General_options): Define build_id option.
2316 * layout.h (class Layout): Declare write_build_id, create_note,
2317 create_build_id. Add build_id_note_ member.
2318 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
2319 "libiberty.h", "md5.h", "sha1.h".
2320 (Layout::Layout): Initialize eh_frame_data_,
2321 eh_frame_hdr_section_, and build_id_note_.
2322 (Layout::finalize): Call create_build_id.
2323 (Layout::create_note): New function, broken out of
2324 Layout::create_gold_note.
2325 (Layout::create_gold_note): Call create_note.
2326 (Layout::create_build_id): New function.
2327 (Layout::write_build_id): New function.
2328 (Close_task_runner::run): Call write_build_id.
2330 * x86_64.cc: Correct license to GPLv3.
2332 2008-03-23 Ian Lance Taylor <iant@google.com>
2334 * options.cc: Include "demangle.h".
2335 (parse_optional_string): New function.
2336 (parse_long_option): Handle takes_optional_argument.
2337 (parse_short_option): Update dash_z initializer. Handle
2338 takes_optional_argument.
2339 (General_options::General_options): Initialize do_demangle_.
2340 (General_options::finalize): Set do_demangle_. Handle demangling
2342 * options.h (parse_optional_string): Declare.
2343 (struct One_option): Add optional_arg field. Update constructor.
2344 Update call constructor calls. Add takes_optional_argument
2346 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
2347 (DEFINE_optional_string): Define.
2348 (General_options::demangle): Change from DEFINE_bool to
2349 DEFINE_optional_string.
2350 (General_options::no_demangle): New function.
2351 (General_options::do_demangle): New function.
2352 (General_options::set_do_demangle): New function.
2353 (General_options::execstack_status_): Move definition to end of
2355 (General_options::static_): Likewise.
2356 (General_options::do_demangle_): New field.
2357 * object.cc (big_endian>::get_symbol_location_info): Call
2358 Options::do_demangle, not Options::demangle.
2359 * symtab.cc (demangle): Likewise.
2361 2008-03-22 Ian Lance Taylor <iant@google.com>
2363 * gold.h: Include <cstddef> and <sys/types.h>
2364 * options.h: Include <cstring>.
2366 2008-03-21 Ian Lance Taylor <iant@google.com>
2368 * Added source code to GNU binutils.