1 2008-08-13 Ian Lance Taylor <iant@google.com>
3 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
4 set tls_segment_ or relro_segment_.
5 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
7 * output.h (Output_section::clear_is_relro): New function.
8 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
9 sections specially even when output_data_ is empty.
10 (Output_segment::maximum_alignment): When first section is relro,
11 only force alignment for PT_LOAD segments.
12 * script.cc (script_data_segment_align): New function.
13 (script_data_segment_relro_end): New function.
14 * script-c.h (script_data_segment_align): Declare.
15 (script_data_segment_relro_end): Declare.
16 * script-sections.h (class Script_sections): Declare
17 data_segment_align and data_segment_relro_end. Add fields
18 segment_align_index_ and saw_relro_end_.
19 * script-sections.cc (class Sections_element): Add set_is_relro
20 virtual function. Add new bool* parameter to place_orphan_here.
21 Add get_output_section virtual function.
22 (class Output_section_definition): Add set_is_relro. Add new
23 bool* parameter to place_orphan_here. Add get_output_section.
25 (Output_section_definition::Output_section_definition): Initialize
26 evaluated_address_, evaluated_load_address, evaluated_addralign_,
28 (Output_section_definition::place_orphan_here): Add is_relro
30 (Output_section_definition::set_section_addresses): Set relro for
32 (Output_section_definition::alternate_constraint): Likewise.
33 (class Orphan_output_section): Add new bool* parameter to
34 place_orphan_here. Add get_output_section.
35 (Orphan_output_section::place_orphan_here): Add is_relro
37 (Script_sections::Script_sections): Initialize
38 data_segment_align_index_ and saw_relro_end_.
39 (Script_sections::data_segment_align): New function.
40 (Script_sections::data_segment_relro_end): New function.
41 (Script_sections::place_orphan): Set or clear is_relro.
42 (Script_sections::set_section_addresses): Force alignment of first
44 * yyscript.y (exp): Call script_data_segment_align and
45 script_data_segment_relro_end.
46 * testsuite/relro_script_test.t: New file.
47 * testsuite/relro_test.cc (using_script): Declare.
48 (t1, t2): Test using_script.
49 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
50 (relro_script_test_SOURCES): Define.
51 (relro_script_test_DEPENDENCIES): Define.
52 (relro_script_test_LDFLAGS): Define.
53 (relro_script_test_LDADD): Define.
54 (relro_script_test.so): New target.
55 * testsuite/Makefile.in: Rebuild.
57 2008-08-06 Cary Coutant <ccoutant@google.com>
59 * archive.cc (Archive::total_archives, Archive::total_members)
60 (Archive::total_members_loaded): New variables.
61 (Archive::setup): Add parameter. Add option to preread
63 (Archive::read_armap): Add counter.
64 (Archive::get_file_and_offset): New function.
65 (Archive::get_elf_object_for_member): New function.
66 (Archive::read_all_symbols): New function.
67 (Archive::read_symbols): New function.
68 (Archive::add_symbols): Add counters.
69 (Archive::include_all_members): Use armap to find members if it's
71 (Archive::include_member): Skip reading symbols if already read.
72 Factored code into Archive::get_file_and_offset and
73 Archive::get_elf_object_for_member. Changed call to
74 Mapfile::report_include_archive_member.
75 (Archive::print_stats): New function.
76 * archive.h: Declare Object and Read_symbols_data classes.
77 (Archive::Archive): Add initializers for new members.
78 (Archive::setup): Add parameter.
79 (Archive::print_stats): New function.
80 (Archive::total_archives, Archive::total_members)
81 (Archive::total_members_loaded): New variables.
82 (Archive::get_file_and_offset): New function.
83 (Archive::get_elf_object_for_member): New function.
84 (Archive::read_all_symbols): New function.
85 (Archive::read_symbols): New function.
86 (Archive::Archive_member): New class.
87 (Archive::members_): New member.
88 (Archive::num_members_): New member.
89 * main.cc: Include archive.h.
90 (main): Call Archive::print_stats.
91 * mapfile.cc (Mapfile::report_include_archive_member): Delete
92 archive parameter; member_name is now the fully-decorated name.
93 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
94 * options.h: (General_options): Add --preread-archive-symbols option.
95 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
98 2008-08-04 Ian Lance Taylor <iant@google.com>
100 * symtab.h (Symbol::use_plt_offset): New function.
101 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
102 * powerpc.cc (Relocate::relocate): Likewise.
103 * sparc.cc (Relocate::relocate): Likewise.
104 * x86_64.cc (Relocate::relocate): Likewise.
105 * testsuite/weak_plt.sh: New test.
106 * testsuite/weak_plt_main.cc: New test.
107 * testsuite/weak_plt_shared.cc: New test.
108 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
109 (check_PROGRAMS): Add weak_plt.
110 (check_DATA): Add weak_plt_shared.so.
111 (weak_plt_main_pic.o, weak_plt): New targets.
112 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
113 * testsuite/Makefile.in: Rebuild.
115 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
117 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
118 * testsuite/Makefile.in: Rebuild.
120 2008-08-04 Alan Modra <amodra@bigpond.net.au>
122 * Makefile.am (POTFILES.in): Set LC_ALL=C.
123 * Makefile.in: Regenerate.
124 * po/POTFILES.in: Regenerate.
126 2008-07-29 Ian Lance Taylor <iant@google.com>
128 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
129 symbols before other symbols.
130 * testsuite/script_test_2.cc (test_addr): Declare.
131 (test_addr_alias): Declare.
132 (main): Check that test_addr and test_addr_alias have the right
134 * testsuite/script_test_2.t: Define test_addr_alias and
137 2008-07-24 Ian Lance Taylor <iant@google.com>
140 * descriptors.cc: New file.
141 * descriptors.h: New file.
142 * gold-threads.h (class Hold_optional_lock): New class.
143 * fileread.cc: Include "descriptors.h".
144 (File_read::~File_read): Release descriptor rather than closing
146 (File_read::open) [file]: Call open_descriptor rather than open.
147 Set is_descriptor_opened_.
148 (File_read::open) [memory]: Assert that descriptor is not open.
149 (File_read::reopen_descriptor): New function.
150 (File_read::release): Release descriptor.
151 (File_read::do_read): Make non-const. Reopen descriptor.
152 (File_read::read): Make non-const.
153 (File_read::make_view): Reopen descriptor.
154 (File_read::do_readv): Likewise.
155 * fileread.h (class File_read): Add is_descriptor_opened_ field.
157 * layout.cc: Include "descriptors.h".
158 (Layout::create_build_id): Use open_descriptor rather than open.
159 * output.cc: Include "descriptors.h".
160 (Output_file::open): Use open_descriptor rather than open.
161 * archive.cc (Archive::const_iterator): Change Archive to be
163 (Archive::begin, Archive::end): Make non-const.
164 (Archive::count_members): Likewise.
165 * archive.h (class Archive): Update declarations.
166 * object.h (Object::read): Make non-const.
167 * Makefile.am (CCFILES): Add descriptors.cc.
168 (HFILES): Add descriptors.h.
169 * Makefile.in: Rebuild.
172 * gold.h: Always include <clocale>. Add Solaris workarounds
173 following code in binutils/sysdep.h.
176 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
177 this->eh_frame_hdr_ is NULL before using it.
179 * dynobj.cc (Versions::Versions): Update comment.
181 * dynobj.cc (Versions::Versions): If there is an soname, use it as
182 the base version name.
184 * stringpool.cc (Stringpool_template::add_with_length): Set key to
186 (Stringpool_template::set_string_offsets): Subtract one from key
187 before using it as an array index.
188 (Stringpool_template::get_offset_with_length): Likewise.
189 (Stringpool_template::write_to_buffer): Likewise.
190 * stringpool.h (Stringpool_template::get_offset_from_key):
193 2008-07-23 Ian Lance Taylor <iant@google.com>
196 * object.h (Merged_symbol_value::value): Do our best to handle a
200 * script.cc (Version_script_info::get_versions): Don't add empty
201 version tag to return value.
202 (Version_script_info::get_symbol_version_helper): Change return
203 type to bool. Add pversion parameter. Change all callers.
204 (script_register_vers_node): Don't require a non-NULL tag.
205 * script.h (class Version_script_info): Update declarations.
206 (Version_script_info::get_symbol_version): Change return type to
207 bool. Add version parameter. Change all callers.
208 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
209 handling. Handle an empty version from a version script.
210 (Symbol_table::define_special_symbol): Likewise.
211 * testsuite/ver_test_10.script: New file.
212 * testsuite/ver_test_10.sh: New file.
213 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
214 (check_DATA): Add ver_test_10.syms.
215 (ver_test_10.syms, ver_test_10.so): New target.
216 * testsuite/Makefile.in: Rebuild.
218 2008-07-23 Simon Baldwin <simonb@google.com>
220 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
221 to zero for undefined symbols from dynamic libraries.
223 2008-07-23 Ian Lance Taylor <iant@google.com>
225 * symtab.cc (Symbol_table::resolve): Remove version parameter.
227 * symtab.h (class Symbol_table): Update declaration.
228 * testsuite/ver_test_9.cc: New file.
229 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
230 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
231 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
232 (ver_test_9.so, ver_test_9.o): New targets.
233 * testsuite/Makefile.in: Rebuild.
235 2008-07-22 Ian Lance Taylor <iant@google.com>
237 * options.h (class General_options): Define --check-sections.
238 * layout.cc (Layout::set_segment_offsets): Handle
241 * options.h (class General_options): Define -n/--nmagic and
243 * options.cc (General_options::finalize): For -n/--nmagic or
244 -N/--omagic, set -static.
245 * layout.cc (Layout::attach_allocated_section_to_segment): If
246 -N/--omagic, don't put read-only and read-write sections in
248 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
249 finding a read-only segment.
250 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
251 don't set the minimum segment alignment to the common page size,
252 and don't set the file offset to the address modulo the page size.
253 * script-sections.cc (Script_sections::create_segments): If
254 -n/--omagic, don't put read-only and read-write sections in
259 * options.h (class General_options): Add --print-symbol-counts.
260 * main.cc (main): Issue defined symbol report if requested.
261 * archive.cc (Archive::interpret_header): Make into a const member
263 (Archive::add_symbols): Call Input_objects::archive_start and
265 (Archive::const_iterator): Define new class.
266 (Archive::begin, Archive::end): New functions.
267 (Archive::include_all_members): Rewrite to use iterator.
268 (Archive::count_members): New function.
269 * archive.h (class Archive): Update declarations.
270 (Archive::filename): New function.
271 * object.cc: Include "cref.h".
272 (Sized_relobj::Sized_relobj): Initialize defined_count_.
273 (Sized_relobj::do_get_global_symbol_counts): New function.
274 (Input_objects::add_object): Add object to cross-referencer.
275 (Input_objects::archive_start): New function.
276 (Input_objects::archive_stop): New function.
277 (Input_objects::print_symbol_counts): New function.
278 * object.h: Declare Cref and Archive.
279 (Object::get_global_symbol_counts): New function.
280 (Object::do_get_global_symbol_counts): New pure virtual function.
281 (class Sized_relobj): Add defined_count_ field. Update
283 (class Input_objects): Add cref_ field. Update constructor.
285 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
287 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
289 (Sized_dynobj::do_get_global_symbol_counts): New function.
290 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
291 defined_count_. Update declarations. Define Symbols typedef.
292 * symtab.cc (Symbol_table::add_from_relobj): Add defined
293 parameter. Change all callers.
294 (Symbol_table::add_from_dynobj): Add sympointers and defined
295 parameters. Change all callers.
296 * symtab.h (class Symbol_table): Update declarations.
297 * Makefile.am (CCFILES): Add cref.cc.
298 (HFILES): Add cref.h.
299 * Makefile.in: Rebuild.
301 2008-07-22 Simon Baldwin <simonb@google.com>
303 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
304 to zero when writing undefined symbols.
306 2008-07-22 Ian Lance Taylor <iant@google.com>
308 * output.cc (Output_section::add_input_section): Don't try to
309 merge empty merge sections.
311 2008-07-21 Craig Silverstein <csilvers@google.com>
313 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
314 Include symbol version in error message.
316 2008-07-20 Chris Demetriou <cgd@google.com>
318 * configure.ac (gold_cv_c_random_seed): New configured variable.
319 (RANDOM_SEED_CFLAGS): New substituted variable.
320 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
321 * configure: Rebuild.
322 * Makefile.in: Likewise.
323 * testsuite/Makefile.in: Likewise.
325 2008-07-18 Ian Lance Taylor <iant@google.com>
327 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
328 where we see NAME/NULL and NAME/VERSION as separate symbols.
329 * testsuite/ver_test_main.cc (main): Call t4.
331 * testsuite/ver_test_2.cc (t4_2): Define.
332 * testsuite/ver_test_2.script: Put t4_2a in VER2.
333 * testsuite/ver_test_4.cc (t4_2a): Define.
334 * testsuite/ver_test_4.script: Put t4_2a in VER2.
335 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
337 2008-07-17 Ian Lance Taylor <iant@google.com>
339 * dynobj.cc (Versions::add_def): If we give an error about a
340 missing version, go ahead and create the version anyhow.
342 2008-07-10 Ian Lance Taylor <iant@google.com>
344 Handle output sections with more than 0x7fffffff bytes.
345 * object.h (class Relobj): Change map_to_output_ to
346 output_sections_, and just keep a section pointer. Change all
347 uses. Move comdat group support to Sized_relobj.
348 (Relobj::is_section_specially_mapped): Remove.
349 (Relobj::output_section): Remove poff parameter. Change all
351 (Relobj::output_section_offset): New function.
352 (Relobj::set_section_offset): Rewrite.
353 (Relobj::map_to_output): Remove.
354 (Relobj::output_sections): New function.
355 (Relobj::do_output_section_offset): New pure virtual function.
356 (Relobj::do_set_section_offset): Likewise.
357 (class Sized_relobj): Add section_offsets_ field. Add comdat
358 group support from Relobj. Update declarations.
359 (Sized_relobj::get_output_section_offset): New function.
360 (Sized_relobj::do_output_section_offset): New function.
361 (Sized_relobj::do_set_section_offset): New function.
362 * object.cc (Relobj::output_section_address): Remove.
363 (Sized_relobj::Sized_relobj): Initialize new fields.
364 (Sized_relobj::include_section_group): Cast find_kept_object to
366 (Sized_relobj::include_linkonce_section): Likewise.
367 (Sized_relobj::do_layout): Use separate arrays for output section
369 (Sized_relobj::do_count_local_symbols): Change map_to_output to
371 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
372 output_sections and section_offsets.
373 (Sized_relobj::write_local_symbols): Likewise.
374 (map_to_kept_section): Compute output address directly.
375 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
376 output_sections and section_offsets.
377 (Sized_relobj::write_sections): Likewise.
378 (Sized_relobj::relocate_sections): Likewise.
379 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
380 * output.h (class Output_reloc): Update declarations. Change
381 u2_.relobj to Sized_relobj*.
382 (class Output_data_reloc): Change add functions to use
384 * output.cc (Output_reloc::Output_reloc): Change relobj to
386 (Output_reloc::local_section_offset): Change return type to
387 Elf_Addr. Use get_output_section_offset.
388 (Output_reloc::get_address): Likewise.
389 (Output_section::is_input_address_mapped): Don't call
390 is_section_specially_mapped.
391 (Output_section::output_offset): Likewise.
392 (Output_section::output_address): Likewise.
393 (Output_section::starting_output_address): Likewise.
394 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
395 parameter to Sized_relobj*.
396 (Copy_relocs::need_copy_reloc): Likewise.
397 (Copy_relocs::save): Likewise.
398 * copy-relocs.h (class Copy_relocs): Update declarations.
399 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
400 Sized_relobj*. Change relobj_ field to Sized_relobj*.
401 * target-reloc.h (relocate_for_relocatable): Change
402 offset_in_output_section type to Elf_Addr. Change code that uses
404 * layout.cc (Layout::layout): Always set *off.
405 * mapfile.cc (Mapfile::print_input_section): Use
406 output_section_offset.
407 * i386.cc (Target_i386::copy_reloc): Change object parameter to
409 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
410 * sparc.cc (Target_sparc::copy_reloc): Likewise.
411 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
413 2008-07-03 Ian Lance Taylor <iant@google.com>
415 * layout.cc (Layout::include_section): Do not discard unrecognized
418 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
420 * script.cc (Lex::can_continue_name): Make '?' allowable in
421 version-script names.
422 * testsuite/version_script.map: Change glob pattern to use '?'
424 2008-06-30 Manish Singh <yosh@gimp.org>
427 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
430 2008-06-30 Ian Lance Taylor <iant@google.com>
434 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
435 versions]: Don't try to read the value in the contents, since we
436 don't use it. Use the template endianness when writing.
438 2008-06-25 Cary Coutant <ccoutant@google.com>
440 * fileread.cc (File_read::make_view): Assert on zero-length view.
441 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
442 symbol table when there are no symbols to read.
444 2008-06-23 Craig Silverstein <csilvers@google.com>
446 * version.cc (version_string): Bump to 1.7
448 2008-06-18 Craig Silverstein <csilvers@google.com>
450 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
451 constant 0xFFFF to type Valtype.
452 (Powerpc_relocate_functions::rel16_ha): Likewise.
454 2008-06-17 Ian Lance Taylor <iant@google.com>
456 * output.h (Output_section::Input_section): Initialize p2align_ to
457 zero for Output_section_data constructors.
458 (Output_section::Input_section::addralign): If not an input
459 section, return the alignment of the Output_section_data.
460 * testsuite/copy_test.cc: New file.
461 * testsuite/copy_test_1.cc: New file.
462 * testsuite/copy_test_2.cc: New file.
463 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
464 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
465 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
466 (copy_test_1_pic.o, copy_test_1.so): New targets.
467 (copy_test_2_pic.o, copy_test_2.so): New targets.
468 * testsuite/Makefile.in: Rebuild.
470 * script-sections.cc (Script_sections::place_orphan): Initialize
471 local variable exact.
473 2008-06-13 David Edelsohn <edelsohn@gnu.org>
475 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
477 2008-06-12 David Edelsohn <edelsohn@gnu.org>
478 David S. Miller <davem@davemloft.net>
480 * powerpc.cc: New file.
481 * Makefile.am (TARGETSOURCES): Add powerpc.cc
482 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
483 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
484 * Makefile.in: Rebuild.
486 2008-06-09 Ian Lance Taylor <iant@google.com>
488 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
490 (throwing, orig_terminate): New static variables.
491 (terminate_handler): New static function.
492 (t2): Set terminate handler.
494 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
497 * binary.cc (Binary_to_elf::sized_convert): Fix .data
500 2008-05-30 Cary Coutant <ccoutant@google.com>
502 * archive.cc (Archive::include_all_members) Correct to step
503 over symbol table and extended name table in thin archives.
505 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
508 * target-reloc.h (relocate_for_relocatable): Fix new_offset
511 2008-05-28 Caleb Howe <cshowe@google.com>
513 * reduced_debug_output.cc: New file.
514 * reduced_debug_output.h: New file.
515 * options.h (class General_options): Add --strip-debug-non-line.
516 * options.cc (General_options::finalize): Add strip_debug_non_line
517 to the strip heirarchy.
518 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
520 * layout.cc: Include "reduced_debug_output.h".
521 (Layout::Layout): Initialize new fields.
522 (line_only_debug_sections): New static array.
523 (is_lines_only_debug_sections): New static inline function.
524 (Layout::include_section): Handle --strip-debug-non-line.
525 (Layout::make_output_section): If --strip-debug-non-line, build
526 new output sections for .debug_abbrev and .debug_info.
527 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
528 gold. Warn about possible overflow.
529 (read_signed_LEB_128): Likewise.
530 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
531 (read_signed_LEB_128): Declare.
532 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
533 (HFILES): Add reduced_debug_output.h.
534 * Makefile.in: Rebuild.
536 2008-05-21 Ian Lance Taylor <iant@google.com>
538 * mapfile.cc: New file.
539 * mapfile.h: New file.
540 * options.h (class General_options): Add -M/--print-map and -Map.
541 * options.cc (General_options::finalize): Make -M equivalent to
543 * main.cc: Include <cstdio> and "mapfile.h".
544 (main): Open mapfile if requested.
545 * gold.cc (class Middle_runner): Add mapfile_ field. Update
546 constructor. Change caller.
547 (queue_initial_tasks): Add mapfile parameter. Change caller.
548 (queue_middle_tasks): Likewise.
549 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
551 * archive.cc: Include "mapfile.h".
552 (Archive::add_symbols): Add mapfile parameter. Change all
553 callers. Pass mapfile, symbol, and reason to include_member.
554 (Archive::include_all_members): Add mapfile parameter. Change all
556 (Archive::include_member): Add mapfile, sym, and why parameters.
557 Change all callers. Report inclusion to map file.
558 * archive.h: Include "fileread.h".
559 (class Archive): Update declarations.
560 (Archive::file): New const method.
561 (class Add_archive_symbols): Add mapfile_ field. Update
562 constructor. Change all callers.
563 * readsyms.h (class Read_symbols): Likewise.
564 (class Finish_group): Likewise.
565 (class Read_script): Likewise.
566 * common.cc: Include "mapfile.h".
567 (Symbol_table::allocate_commons): Add mapfile parameter. Change
569 (Symbol_table::do_allocate_commons): Likewise.
570 (Symbol_table::do_allocate_commons_list): Likewise. Report common
571 symbol allocation to mapfile.
572 * common.h (class Allocate_commons_task): Add mapfile_ field.
573 Update constructor. Change all callers.
574 * symtab.h (class Symbol_table): Update declarations.
575 * layout.cc: Include "mapfile.h".
576 (Layout_task_runner::run): Print information to mapfile.
577 (Layout::create_gold_note): Change Output_data_fixed_space to
578 Output_data_zero_fill.
579 (Layout::create_build_id): Likewise.
580 (Layout::print_to_mapfile): New function.
581 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
582 constructor. Change caller.
583 (class Layout): Declare print_to_mapfile.
584 * output.cc (Output_section::Input_section::print_to_mapfile): New
586 (Output_section::add_input_section): If producing a map, always
587 add to input_sections_ list.
588 (Output_section::do_print_to_mapfile): New function.
589 (Output_segment::print_sections_to_mapfile): New function.
590 (Output_segment::print_section_list_to_mapfile): New function.
591 * output.h: Include "mapfile.h".
592 (Output_data::print_to_mapfile): New function.
593 (Output_data::do_print_to_mapfile): New virtual function.
594 (Output_segment_headers::do_print_to_mapfile): New function.
595 (Output_file_header::do_print_to_mapfile): New function.
596 (Output_data_const::do_print_to_mapfile): New function.
597 (class Output_data_const_buffer): Add map_name_ field. Update
598 constructor. Change all callers. Add do_print_to_mapfile
600 (class Output_data_fixed_space): Likewise.
601 (class Output_data_space): Likewise.
602 (class Output_data_zero_fill): New class.
603 (Output_data_strtab::do_print_to_mapfile): New function.
604 (Output_data_reloc_base::do_print_to_mapfile): New function.
605 (Output_relocatable_relocs::do_print_to_mapfile): New function.
606 (Output_data_group::do_print_to_mapfile): New function.
607 (Output_data_got::do_print_to_mapfile): New function.
608 (Output_data_dynamic::do_print_to_mapfile): New function.
609 (Output_symtab_xindex::do_print_to_mapfile): New function.
610 (class Output_section): Declare do_print_to_mapflie. Declare
611 print_to_mapfile in Input_section.
612 (class Output_segment): Declare new functions.
613 * object.h (Sized_relobj::symbol_count): New function.
615 (Output_section_element_dot_assignment::set_section_addresses):
616 Change Output_data_fixed_space to Output_data_zero_fill.
617 (Output_data_expression::do_print_to_mapfile): New function.
618 * script.cc (read_input_script): Add mapfile parameter. Change
620 * script.h (read_input_script): Update declaration.
621 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
622 (Eh_frame::do_print_to_mapfile): New function.
623 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
624 (Output_merge_string::do_print_to_mapfile): New function.
625 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
627 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
629 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
631 * Makefile.am (CCFILES): Add mapfile.cc.
632 (HFILES): Add mapfile.h.
633 * Makefile.in: Rebuild.
635 2008-05-19 Ian Lance Taylor <iant@google.com>
637 * options.h (class General_options): Add -z relro.
638 * layout.cc (Layout::Layout): Initialize relro_segment_.
639 (Layout::add_output_section_data): Return the output section.
640 (Layout::make_output_section): Rcognize relro sections and mark
642 (Layout::attach_allocated_section_to_segment): Put relro sections
643 in a PT_GNU_RELRO segment.
644 (Layout::create_initial_dynamic_sections): Mark the .dynamic
646 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
648 (Layout::linkonce_mapping): Map d.rel.ro.local to
650 (Layout::output_section_name): Us .data.rel.ro.local for any
651 section which begins with that.
652 * layout.h (class Layout): Update add_output_section_data
653 declaration. Add relro_segment_ field.
654 * output.cc (Output_section::Output_section): Initialize is_relro_
655 and is_relro_local_ fields.
656 (Output_segment::add_output_section): Group relro sections.
657 (Output_segment::is_first_section_relro): New function.
658 (Output_segment::maximum_alignment): If there is a relro section,
659 align the segment to the common page size.
660 (Output_segment::set_section_addresses): Track whether we are
661 looking at relro sections. If the last section is a relro
662 section, align to the common page size.
663 (Output_segment::set_section_list_addresses): Add in_relro
664 parameter. Change all callers. Align to the page size when
665 moving from relro to non-relro section.
666 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
668 * output.h (class Output_section): Add is_relro_ and
669 is_relro_local_ fields.
670 (Output_section::is_relro): New function.
671 (Output_section::set_is_relro): New function.
672 (Output_section::is_relro_local): New function.
673 (Output_section::set_is_relro_local): New function.
674 (class Output_segment): Update declarations.
675 * i386.cc (Target_i386::got_section): Mark .got section as relro.
676 * sparc.cc (Target_sparc::got_section): Likewise.
677 * x86_64.cc (Target_x86_64::got_section): Likewise.
678 * testsuite/relro_test_main.cc: New file.
679 * testsuite/relro_test.cc: New file.
680 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
681 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
682 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
683 (relro_test.so, relro_test_pic.o): New targets.
684 * testsuite/Makefile.in: Rebuild.
686 2008-05-16 Ian Lance Taylor <iant@google.com>
688 * output.cc (Output_segment::add_output_section): Remove front
690 * output.h (class Output_segment): Remove
691 add_initial_output_section and overloaded add_output_section.
692 Update declaration of remaining add_output_section.
693 * layout.cc (Layout::create_interp): Call add_output_section
694 rather than add_initial_output_section.
695 (Layout::finish_dynamic_section): Likewise.
697 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
698 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
699 know the dynamic type.
700 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
701 field. Initialize it in constructor.
702 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
703 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
704 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
707 * output.cc (Output_reloc::get_address): Change return type to
709 * output.h (class Output_reloc): Update get_address declaration.
710 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
711 for section addresses.
713 2008-05-09 Ian Lance Taylor <iant@google.com>
716 * gold.cc (gold_nomem): Use return value of write.
718 2008-05-08 Ian Lance Taylor <iant@google.com>
720 * symtab.c (Symbol::init_base_output_data): Add version
721 parameter. Change all callers.
722 (Symbol::init_base_output_segment): Likewise.
723 (Symbol::init_base_constant): Likewise.
724 (Symbol::init_base_undefined): Likewise.
725 (Sized_symbol::init_output_data): Likewise.
726 (Sized_symbol::init_output_segment): Likewise.
727 (Sized_symbol::init_constant): Likewise.
728 (Sized_symbol::init_undefined): Likewise.
729 (Symbol_table::do_define_in_output_data): If the new symbol has a
730 version, mark it as the default.
731 (Symbol_table::do_define_in_output_segment): Likewise.
732 (Symbol_table::do_define_as_constant): Likewise.
733 * symtab.h (class Symbol): Update declarations.
734 (class Sized_symbol): Likewise.
735 * resolve.cc (Symbol::override_version): New function.
736 (Symbol::override_base): Call override_version.
737 (Symbol::override_base_with_special): Likewise.
738 * testsuite/ver_script_8.script: New file.
739 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
740 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
741 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
742 (ver_test_8_1.so, ver_test_8_2.so): New targets.
744 2008-05-06 Ian Lance Taylor <iant@google.com>
747 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
749 (class General_options): Remove existing --undefined, and add
750 --no-undefined instead. Add new --undefined as synonym for -u.
751 * archive.cc (Archive::add_symbols): Check whether symbol was
753 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
754 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
755 all uses. Add IS_UNDEFINED. Update declarations to split
756 different versions of init_base. Declare init_base_undefined.
757 (Symbol::is_defined): Handle IS_UNDEFINED.
758 (Symbol::is_undefined): Likewise.
759 (Symbol::is_weak_undefined): Call is_undefined.
760 (Symbol::is_absolute): Handle IS_CONSTANT.
761 (class Sized_symbol): Update declarations to split different
762 versions of init. Declare init_undefined.
763 (class Symbol_table): Declare new functions.
764 * symtab.cc (Symbol::init_base_object): Rename from init_base.
766 (Symbol::init_base_output_data): Likewise.
767 (Symbol::init_base_output_segment): Likewise.
768 (Symbol::init_base_constant): Likewise.
769 (Symbol::init_base_undefined): New function.
770 (Sized_symbol::init_object): Rename from init. Change all
772 (Sized_symbol::init_output_data): Likewise.
773 (Sized_symbol::init_output_segment): Likewise.
774 (Sized_symbol::init_constant): Likewise.
775 (Sized_symbol::init_undefined): New function.
776 (Symbol_table::add_undefined_symbols_from_command_line): New
778 (Symbol_table::do_add_undefined_symbols_from_command_line): New
780 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
781 (Symbol::output_section): Likewise.
782 (Symbol::set_output_section): Likewise.
783 (Symbol_table::sized_finalize_symbol): Likewise.
784 (Symbol_table::sized_write_globals): Likewise.
785 * resolve.cc (Symbol_table::should_override): Likewise.
786 (Symbol::override_base_with_special): Likewise.
788 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
789 symbol, change it to have default visibility.
790 * testsuite/protected_1.cc: New file.
791 * testsuite/protected_2.cc: New file.
792 * testsuite/protected_3.cc: New file.
793 * testsuite/protected_main_1.cc: New file.
794 * testsuite/protected_main_2.cc: New file.
795 * testsuite/protected_main_3.cc: New file.
796 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
797 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
798 (protected_1_LDFLAGS, protected_1_LDADD): Define.
799 (protected_1.so): New target.
800 (protected_1_pic.o, protected_2_pic.o): New targets.
801 (protected_3_pic.o): New target.
802 (check_PROGRAMS): Add protected_2.
803 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
804 (protected_2_LDFLAGS, protected_2_LDADD): Define.
805 * testsuite/Makefile.in: Rebuild.
807 * options.h (DEFINE_var): Add set_user_set_##varname__.
808 (DEFINE_bool_alias): New macro.
809 (class General_options): Define -Bstatic using DEFINE_bool_alias
810 rather than DEFINE_special. Add --undefined as an alias for -z
812 * options.cc (General_options::parse_Bstatic): Remove.
814 * options.h (class General_options): Add --fatal-warnings.
815 * main.cc (main): Implement --fatal-warnings.
816 * errors.h (Errors::warning_count): New function.
818 * options.h (class General_options): Add -Bsymbolic-functions.
819 * symtab.h (Symbol::is_preemptible): Check for
820 -Bsymbolic-functions.
822 2008-05-05 Ian Lance Taylor <iant@google.com>
824 * options.h (DEFINE_bool): For DASH_Z, create the negative option
825 as noVARNAME rather than no-VARNAME.
826 (class General_options): Add option -z combreloc.
827 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
829 (Output_reloc::sort_before) [SHT_REL]: New function.
830 (Output_reloc::sort_before) [SHT_RELA]: New function.
831 (class Output_data_reloc_base): Add sort_relocs_ field. Define
832 Sort_relocs_comparison.
833 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
834 parameter. Change all callers.
835 (Output_data_reloc::Output_data_reloc) [both versions]: Add
836 sort_relocs parameter. Change all callers.
837 * output.cc (Output_reloc::get_address): New function, broken out
839 (Output_reloc::write_rel): Call it.
840 (Output_reloc::compare): New function.
841 (Output_data_reloc_base::do_write): Optionally sort relocs.
843 * configure.ac: If targ_extra_obj is set, link it in.
844 * configure.tgt: Initialize all variables.
845 (x86_64*): Set targ_extra_obj and targ_extra_size.
846 * configure: Rebuild.
848 * object.cc (Sized_relobj::include_section_group): Adjust section
849 indexes read from group data. Build vector to pass to
851 * layout.cc (Layout::layout_group): Add flags and shndxes
852 parameters. Remove contents parameter. Change caller. Update
853 explicit instantiations.
854 * layout.h (class Layout): Update layout_group declaration.
855 * output.cc (Output_data_group::Output_data_group): Add flags and
856 input_shndxes parameters. Remove contents parameter. Change
858 (Output_data_group::do_write): Change input_sections_ to
860 * output.h (class Output_data_group): Update constructor
861 declaration. Rename input_sections_ to input_shndxes_.
862 * testsuite/many_sections_test.cc: Add template.
864 2008-04-30 Cary Coutant <ccoutant@google.com>
866 * target-reloc.h (relocate_section): Fix dead-pointer bug.
868 * layout.cc (Layout::include_section): Refactored check for debug
870 (Layout::add_comdat): Add new parameters. Change type
871 of signature parameter. Add object and shndx to signatures table.
872 (Layout::find_kept_object): New function.
873 * layout.h: Include <cstring>.
874 (Layout::is_debug_info_section): New function.
875 (Layout::add_comdat): Add new parameters.
876 (Layout::find_kept_object): New function.
877 (Layout::Kept_section): New struct.
878 (Layout::Signatures): Change type of map range.
879 * object.cc (Relobj::output_section_address): New function.
880 (Sized_relobj::include_section_group): Add new parameters. Change
881 calls to Layout::add_comdat. Change to build table of kept comdat
882 groups and table mapping discarded sections to kept sections.
883 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
884 (Sized_relobj::do_layout): Change calls to include_section_group and
885 include_linkonce_section.
886 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
887 value to zero when section is discarded.
888 (Sized_relobj::map_to_kept_section): New function.
889 * object.h (Relobj::output_section_address): New function.
890 (Relobj::Comdat_group): New type.
891 (Relobj::find_comdat_group): New function.
892 (Relobj::Comdat_group_table): New type.
893 (Relobj::Kept_comdat_section): New type.
894 (Relobj::Kept_comdat_section_table): New type.
895 (Relobj::add_comdat_group): New function.
896 (Relobj::set_kept_comdat_section): New function.
897 (Relobj::get_kept_comdat_section): New function.
898 (Relobj::comdat_groups_): New field.
899 (Relobj::kept_comdat_sections_): New field.
900 (Symbol_value::input_value): Update comment.
901 (Sized_relobj::map_to_kept_section) New function.
902 (Sized_relobj::include_linkonce_section): Add new parameter.
903 * target-reloc.h (Comdat_behavior): New type.
904 (get_comdat_behavior): New function.
905 (relocate_section): Add code to map a discarded section to the
906 corresponding kept section when applying a relocation.
908 2008-04-30 Craig Silverstein <csilvers@google.com>
910 * dwarf_reader.cc (next_generation_count): New static var.
911 (Addr2line_cache_entry): New struct.
912 (addr2line_cache): New static var.
913 (Dwarf_line_info::one_addr2line): Added caching.
914 (Dwarf_line_info::clear_addr2line_cache): New function.
915 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
916 cache-size parameter.
917 (Dwarf_line_info::one_addr2line_cache): New function.
918 * symtab.cc (Symbol_table::detect_odr_violations): Pass
919 new cache-size argument to one_addr2line(), and clear cache.
921 2008-04-28 Cary Coutant <ccoutant@google.com>
923 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
924 R_386_PC8 relocations.
926 2008-04-23 Ian Lance Taylor <iant@google.com>
928 * object.cc (Sized_relobj::include_section_group): Check for
929 invalid section group.
931 * object.cc (make_elf_object): Correct test for 64-bit ELF file
934 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
935 than read for file header.
936 * archive.cc (Archive::include_member): Likewise.
938 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
940 * aclocal.m4: Regenerate.
941 * configure: Regenerate.
943 2008-04-19 Ian Lance Taylor <iant@google.com>
945 * version.cc (version_string): Bump to 1.6.
947 * testsuite/Makefile.am (many_sections_r_test): New target.
948 (many_sections_r_test_SOURCES): Remove.
949 (many_sections_r_test_DEPENDENCIES): Remove.
950 (many_sections_r_test_LDFLAGS): Remove.
951 (many_sections_r_test_LDADD): Remove.
953 * object.cc (Sized_relobj::do_add_symbols): Always pass
954 local_symbol_count_ to add_from_relobj.
956 * testsuite/Makefile.am (many_sections_check.h): Only check one in
957 every thousand variables.
958 * testsuite/Makefile.in: Rebuild.
960 * object.cc (Xindex::initialize_symtab_xindex): New function.
961 (Xindex::read_symtab_xindex): New function.
962 (Xindex::sym_xindex_to_shndx): New function.
963 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
965 (Sized_relobj::do_initialize_xindex): New function.
966 (Sized_relobj::do_read_symbols): Adjust section links.
967 (Sized_relobj::symbol_section_and_value): Add is_ordinary
968 parameter. Change all callers.
969 (Sized_relobj::include_section_group): Adjust section links and
970 symbol section indexes.
971 (Sized_relobj::do_layout): Adjust section links.
972 (Sized_relobj::do_count_local_symbols): Adjust section links and
973 symbol section indexes.
974 (Sized_relobj::do_finalize_local_symbols): Distinguish between
975 ordinary and special symbols.
976 (Sized_relobj::write_local_symbols): Add symtab_xindex and
977 dynsym_xindex parameters. Change all callers. Adjust section
978 links. Use SHN_XINDEX when needed.
979 (Sized_relobj::get_symbol_location_info): Adjust section links.
980 Don't get fooled by special symbols.
981 * object.h (class Xindex): Define.
982 (class Object): Add xindex_ parameter. Declare virtual functoin
983 do_initialize_xindex.
984 (Object::adjust_sym_shndx): New function.
985 (Object::set_xindex): New protected function.
986 (class Symbol_value): Add is_ordinary_shndx_ field.
987 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
988 (Symbol_value::value): Assert ordinary section.
989 (Symbol_value::initialize_input_to_output_map): Likewise.
990 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
992 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
994 (class Sized_relobj): Update declarations.
995 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
996 parameter. Change all callers.
997 (Sized_relobj::adjust_shndx): New function.
998 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
1000 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
1001 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
1002 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
1003 (Sized_dynobj::read_dynsym_section): Adjust section links.
1004 (Sized_dynobj::read_dynamic): Likewise.
1005 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
1007 (Sized_dynobj::do_initialize_xindex): New function.
1008 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
1009 do_initialize_xindex.
1010 (Sized_dynobj::adjust_shndx): New function.
1011 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
1012 dynsym_xindex_ fields.
1013 (Layout::finalize): Add a call to set_section_indexes before
1014 creating the symtab sections.
1015 (Layout::set_section_indexes): Don't do anything if the section
1016 already has a section index.
1017 (Layout::create_symtab_sections): Add shnum parameter. Change
1018 caller. Create .symtab_shndx section if needed.
1019 (Layout::create_shdrs): Add shstrtab_section parameter. Change
1021 (Layout::allocated_output_section_count): New function.
1022 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
1024 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
1025 fields. Update declarations.
1026 (Layout::symtab_xindex): New function.
1027 (Layout::dynsym_xindex): New function.
1028 (class Write_symbols_task): Add layout_ field.
1029 (Write_symbols_task::Write_symbols_task): Add layout parameter.
1031 * output.cc (Output_section_headers::Output_section_headers): Add
1032 shstrtab_section parameter. Change all callers.
1033 (Output_section_headers::do_sized_write): Store overflow values
1034 for section count and section string table section index in
1035 section header zero.
1036 (Output_file_header::do_sized_write): Check for overflow of
1037 section count and section string table section index.
1038 (Output_symtab_xindex::do_write): New function.
1039 (Output_symtab_xindex::endian_do_write): New function.
1040 * output.h (class Output_section_headers): Add shstrtab_section_.
1041 Update declarations.
1042 (class Output_symtab_xindex): Define.
1043 (Output_section::has_out_shndx): New function.
1044 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
1046 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
1048 (Sized_symbol::init): Likewise.
1049 (Symbol::output_section): Check for ordinary symbol.
1050 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
1051 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
1053 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
1054 Change all callers. Simplify handling of symbols from sections
1055 not included in the link.
1056 (Symbol_table::add_from_dynobj): Handle ordinary symbol
1058 (Weak_alias_sorter::operator()): Assert that symbols are
1060 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
1062 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
1063 parameters. Change all callers.
1064 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
1065 symbol distinction. Use SHN_XINDEX when needed.
1066 (Symbol_table::write_section_symbol): Add symtab_xindex
1067 parameter. Change all callers.
1068 (Symbol_table::sized_write_section_symbol): Likewise. Use
1069 SHN_XINDEX when needed.
1070 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
1072 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
1073 (Symbol::is_defined): Check is_ordinary.
1074 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
1075 (Symbol::is_absolute, Symbol::is_common): Likewise.
1076 (class Sized_symbol): Update declarations.
1077 (class Symbol_table): Update declarations.
1078 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
1079 parameters. Change all callers.
1080 (Sized_symbol::override): Likewise.
1081 (Symbol_table::override): Likewise.
1082 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
1083 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
1084 is_ordinary, and orig_st_shndx parameters. Change all callers.
1085 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
1086 to be in an ordinary section.
1087 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
1088 object and is_ordinary parameters. Change all callers.
1089 (Sized_dwarf_line_info::read_relocs): Add object parameter.
1090 Change all callers. Don't add undefined or non-ordinary symbols
1092 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
1094 * dwarf_reader.h (class Sized_dwarf_line_info): Update
1096 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
1097 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
1098 (Sized_relobj::relocate_sections): Likewise.
1099 * target-reloc.h (scan_relocs): Adjust section symbol index.
1100 (scan_relocatable_relocs): Likewise.
1101 * i386.cc (Scan::local): Check for ordinary symbols.
1102 * sparc.cc (Scan::local): Likewise.
1103 * x86_64.cc (Scan::local): Likewise.
1104 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
1105 to symbol_section_and_value.
1106 * testsuite/many_sections_test.cc: New file.
1107 * testsuite/Makefile.am (BUILT_SOURCES): Define.
1108 (check_PROGRAMS): Add many_sections_test.
1109 (many_sections_test_SOURCES): Define.
1110 (many_sections_test_DEPENDENCIES): Define.
1111 (many_sections_test_LDFLAGS): Define.
1112 (BUILT_SOURCES): Add many_sections_define.h.
1113 (many_sections_define.h): New target.
1114 (BUILT_SOURCES): Add many_sections_check.h.
1115 (many_sections_check.h): New target.
1116 (check_PROGRAMS): Add many_sections_r_test.
1117 (many_sections_r_test_SOURCES): Define.
1118 (many_sections_r_test_DEPENDENCIES): Define.
1119 (many_sections_r_test_LDFLAGS): Define.
1120 (many_sections_r_test_LDADD): Define.
1121 (many_sections_r_test.o): New target.
1122 * testsuite/Makefile.in: Rebuild.
1124 2008-04-17 Cary Coutant <ccoutant@google.com>
1126 * errors.cc (Errors::info): New function.
1127 (gold_info): New function.
1128 * errors.h (Errors::info): New function.
1129 * gold.h (gold_info): New function.
1130 * object.cc (Input_objects::add_object): Print trace output.
1131 * options.cc (options::parse_set): New function.
1132 (General_options::parse_wrap): Deleted.
1133 (General_options::General_options): Deleted initializer.
1134 * options.h (options::String_set): New typedef.
1135 (options::parse_set): New function.
1136 (DEFINE_set): New macro.
1137 (General_options::wrap): Changed to use DEFINE_set. Changed
1138 callers of any_wrap_symbols and is_wrap_symbol.
1139 (General_options::trace, General_options::trace_symbol):
1141 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
1142 (General_options::wrap_symbols_): Deleted.
1143 * symtab.cc (Symbol_table::add_from_object): Print trace output.
1145 2008-04-17 David S. Miller <davem@davemloft.net>
1147 * options.cc (General_options::parse_V): New function.
1148 * options.h: Add entries for -V and -Qy.
1150 2008-04-17 Ian Lance Taylor <iant@google.com>
1152 * common.cc (Symbol_table::allocate_commons): Remove options
1153 parameter. Change caller.
1154 (Symbol_table::do_allocate_commons): Remove options parameter.
1155 Change caller. Just call do_allocate_commons_list twice.
1156 (Symbol_table::do_allocate_commons_list): New function, broken out
1157 of do_allocate_commons.
1158 * common.h (class Allocate_commons_task): Remove options_ field.
1160 * symtab.cc (Symbol_table::Symbol_table): Initialize
1162 (Symbol_table::add_from_object): Put TLS common symbols on
1164 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
1165 which are IN_OUTPUT_DATA.
1166 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
1167 allocate_commons and do_allocate_commons declarations. Declare
1168 do_allocate_commons_list.
1169 * gold.cc (queue_middle_tasks): Update creation of
1170 Allocate_commons_task to not pass options.
1171 * testsuite/Makefile.am (INCLUDES): Add -I.. .
1172 (TLS_TEST_C_FLAGS): New variable.
1173 (tls_test_c_pic.o): New target.
1174 (tls_test_shared.so): Link in tls_test_c_pic.o.
1175 (tls_test_c_pic_ie.o): New target.
1176 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
1177 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
1178 (tls_test_c.o): New target.
1179 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
1180 (tls_pic_test_LDADD): Likewise.
1181 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
1182 (tls_shared_gd_to_ie_test_LDADD): Likewise.
1183 (tls_test_c_gnu2.o): New target.
1184 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
1186 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
1187 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
1188 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
1189 * testsuite/tls_test.cc: Include "config.h".
1190 (t_last): Call t11_last.
1191 * testsuite/tls_test.h (t11, t11_last): Declare.
1192 * testsuite/tls_test_c.c: New file.
1193 * testsuite/tls_test_main.cc (thread_routine): Call t11.
1194 * configure.ac: Check for OpenMP support.
1195 * configure, config.in, Makefile.in: Rebuild.
1196 * testsuite/Makefile.in: Rebuild.
1198 2008-04-16 Cary Coutant <ccoutant@google.com>
1200 * i386.cc (Target_i386::define_tls_base_symbol): New function.
1201 (Target_i386::tls_base_symbol_defined_): New field.
1202 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
1203 (Target_i386::Scan::global): Likewise.
1204 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
1205 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
1206 (Target_x86_64::tls_base_symbol_defined_): New field.
1207 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
1208 (Target_x86_64::Scan::global): Likewise.
1210 2008-04-16 Cary Coutant <ccoutant@google.com>
1212 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
1213 (Symbol::needs_plt_entry): Allow weak undefined symbols.
1214 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
1215 building shared libraries.
1216 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
1217 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
1218 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
1219 * testsuite/Makefile.in: Rebuild.
1220 * testsuite/weak_undef.h: New file.
1221 * testsuite/weak_undef_file1.cc: Add extra test cases.
1222 * testsuite/weak_undef_file2.cc: Likewise.
1223 * testsuite/weak_undef_test.cc: Likewise.
1225 2008-04-16 David S. Miller <davem@davemloft.net>
1227 * sparc.cc (Target_sparc::Scan): Change from struct to class.
1228 Add issued_non_pic_error_ field. Declare check_non_pic.
1229 (Target_sparc::Scan::check_non_pic): New function.
1230 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
1231 (Target_sparc::Scan::global): Likewise.
1233 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
1234 * configure: Rebuild.
1236 * options.h (DEFINE_enable): New macro.
1237 (new_dtags): New enable option.
1238 (initfirst, interpose, loadfltr, nodefaultlib,
1239 nodelete, nodlopen, nodump): New -z options.
1240 * layout.cc (Layout:finish_dynamic_section): If new
1241 dtags enabled, emit DT_RUNPATH. Also, emit a
1242 DT_FLAGS_1 containing any specified -z flags.
1244 2008-04-16 Ian Lance Taylor <iant@google.com>
1246 * copy-relocs.cc: New file.
1247 * copy-relocs.h: New file.
1248 * reloc.cc: Remove Copy_relocs code.
1249 * reloc.h: Likewise.
1250 * reloc-types.h (struct Reloc_types) [both versions]: Add
1251 get_reloc_addend_noerror.
1252 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
1253 variants of add_global which take an addend which must be zero.
1254 * i386.cc: Include "copy-relocs.h".
1255 (class Target_i386): Change type of copy_relocs_ to variable,
1257 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
1259 (Target_i386::do_finalize_sections): Change handling of
1261 * sparc.cc: Include "copy-relocs.h".
1262 (class Target_sparc): Change type of copy_relocs_ to variable,
1264 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
1266 (Target_sparc::do_finalize_sections): Change handling of
1268 * x86_64.cc: Include "copy-relocs.h".
1269 (class Target_x86_64): Change type of copy_relocs_ to variable,
1271 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
1272 class. Change all callers.
1273 (Target_x86_64::do_finalize_sections): Change handling of
1275 * Makefile.am (CCFILES): Add copy-relocs.cc.
1276 (HFILES): Add copy-relocs.h.
1278 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
1280 * testsuite/script_test_4.sh: Permit leading zeroes.
1282 2008-04-15 Ian Lance Taylor <iant@google.com>
1284 * script-sections.cc (Script_sections::create_segments): Use
1285 header_size_adjustment even when there is enough room for the
1287 * testsuite/script_test_4.sh: New file.
1288 * testsuite/script_test_4.t: New file.
1289 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
1290 (check_DATA): Add script_test_4.stdout.
1291 (MOSTLYCLEANFILES): Likewise.
1292 (script_test_4): New target.
1293 (script_test_4.stdout): New target.
1294 * testsuite/Makefile.in: Rebuild.
1296 * sparc.cc: Add definitions for Output_data_plt_sparc class
1299 2008-04-14 David S. Miller <davem@davemloft.net>
1301 * sparc.cc: New file.
1302 * Makefile.am (TARGETSOURCES): Add sparc.cc
1303 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
1304 * configure.tgt: Document targ_extra_size and
1305 targ_extra_big_endian. Add entries for sparc-* and
1307 * configure.ac: Handle targ_extra_size and
1308 targ_extra_big_endian.
1309 * Makefile.in: Rebuild.
1310 * configure: Likewise.
1311 * po/POTFILES.in: Likewise.
1312 * po/gold.pot: Likewise.
1314 2008-04-14 Ian Lance Taylor <iant@google.com>
1316 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
1317 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
1318 in the name/type/flags to section mapping. Don't call
1319 allocate_output_section.
1320 (Layout::choose_output_section): Change parameter from adjust_name
1321 to is_input_section. Don't permit input sections after sections
1322 are attached to segments. Don't call allocate_output_section.
1323 (Layout::layout_eh_frame): Call update_flags_for_input_section,
1324 not write_enable_output_section.
1325 (Layout::make_output_section): Don't push to
1326 unattached_section_list_ nor call attach_to_segment. Call
1327 attach_section_to_segment if sections are attached.
1328 (Layout::attach_sections_to_segments): New function.
1329 (Layout::attach_section_to_segment): New function.
1330 (Layout::attach_allocated_section_to_segment): Rename from
1331 attach_to_segment. Remove flags parameter.
1332 (Layout::allocate_output_section): Remove function.
1333 (Layout::write_enable_output_section): Remove function.
1334 * layout.h (class Layout): Update for above changes. Add new
1335 field sections_are_attached_.
1336 * output.h (Output_section::update_flags_for_input_section): New
1338 * output.cc (Output_section::add_input_section): Call
1339 update_flags_for_input_section.
1340 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
1342 2008-04-11 Cary Coutant <ccoutant@google.com>
1344 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
1345 thought unnecessary.
1346 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
1348 2008-04-11 Ian Lance Taylor <iant@google.com>
1350 * output.h (class Output_section_data): Remove inline definition
1352 * output.cc (Output_section_data::set_addralign): New function.
1354 2008-04-11 Cary Coutant <ccoutant@google.com>
1356 Add support for TLS descriptors for i386 and x86_64.
1357 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
1358 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
1359 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
1361 (Target_i386::got_mod_index_entry): Remove unnecessary code.
1362 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
1363 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
1365 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
1366 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
1367 Fix problem with initial-exec relocations.
1368 (Target_i386::Relocate::relocate_tls): Likewise.
1369 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
1371 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
1372 support for section-plus-offset dynamic table entries.
1373 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
1374 (Output_data_dynamic::Dynamic_entry): Add support for
1375 section-plus-offset dynamic table entries.
1376 (Output_data_dynamic::Classification): Likewise.
1377 (Output_data_dynamic::classification_): Renamed offset_.
1378 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
1379 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
1380 (Target_x86_64::make_plt_section): New function.
1381 (Target_x86_64::reserve_tlsdesc_entries): New function.
1382 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
1383 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
1384 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
1385 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
1386 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
1387 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
1388 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
1389 add extra PLT entry for TLS descriptors.
1390 (Output_data_plt_x86_64::got_): New field.
1391 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
1392 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
1394 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
1396 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
1397 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
1398 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
1399 R_386_TLS_DESC_CALL relocations.
1400 (Target_x86_64::Scan::global): Likewise.
1401 (Target_x86_64::do_finalize_sections): Add dynamic table entries
1402 for TLS descriptors.
1403 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
1404 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
1405 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
1406 GD-to-IE relaxation.
1407 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
1408 and TLS_DESCRIPTORS.
1409 * Makefile.in: Rebuild.
1410 * configure: Rebuild.
1411 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
1412 (tls_test_shared2.so): New target.
1413 (tls_shared_gd_to_ie_test_SOURCES): New variable.
1414 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
1415 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
1416 (tls_shared_gd_to_ie_test_LDADD): New variable.
1417 (tls_shared_gnu2_gd_to_ie_test): New target.
1418 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
1420 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
1421 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
1422 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
1423 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
1424 (tls_shared_gnu2_test): New target.
1425 (tls_test_gnu2_shared.so): New target.
1426 (tls_shared_gnu2_test_SOURCES): New variable.
1427 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
1428 (tls_shared_gnu2_test_LDFLAGS): New variable.
1429 (tls_shared_gnu2_test_LDADD): New variable.
1430 * testsuite/Makefile.in: Rebuild.
1431 * testsuite/Makefile.
1433 2008-04-11 Ian Lance Taylor <iant@google.com>
1435 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
1437 * testsuite/Makefile.in: Rebuild.
1439 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
1441 * testsuite/script_test_2.cc (main): Adjust test.
1443 2008-04-11 David S. Miller <davem@davemloft.net>
1444 Ian Lance Taylor <iant@google.com>
1446 * options.h (General_options): Add entries for '-Y' and
1448 * options.cc (General_options:finalize): If -Y was used, add those
1449 entries to the library path instead of the default "/lib" and
1452 2008-04-11 David S. Miller <davem@davemloft.net>
1454 * testsuite/justsyms.t: Start at 0x100.
1455 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
1456 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
1458 * testsuite/script_test_2.cc: Adjust string and section length
1461 2008-04-09 Ian Lance Taylor <iant@google.com>
1464 * script-sections.cc (Sections_element::allocate_to_segment): Add
1466 (Output_section_definition::allocate_to_segment): Likewise.
1467 (Orphan_output_section::allocate_to_segment): Likewise.
1468 (Script_sections::attach_sections_using_phdrs_clause): Don't
1469 propagate non-PT_LOAD segments to orphan sections.
1470 * testsuite/Makefile.am (script_test_3.stdout): Generate using
1471 readelf rather than objdump.
1472 * testsuite/script_test_3.sh: Adjust accordingly. Test that
1473 .interp section and PT_INTERP segment are the same size.
1474 * testsuite/Makefile.in: Rebuild.
1476 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
1477 aliases for symbols defined in the same object.
1478 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
1479 (weak_alias_test_SOURCES): New variable.
1480 (weak_alias_test_DEPENDENCIES): New variable.
1481 (weak_alias_test_LDFLAGS): New variable.
1482 (weak_alias_test_LDADD): New variable.
1483 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
1484 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
1485 (weak_alias_test_3.o): New target.
1486 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
1487 * testsuite/weak_alias_test_main.cc: New file.
1488 * testsuite/weak_alias_test_1.cc: New file.
1489 * testsuite/weak_alias_test_2.cc: New file.
1490 * testsuite/weak_alias_test_3.cc: New file.
1492 2008-04-08 Ian Lance Taylor <iant@google.com>
1494 * options.h (class General_options): Add --noinhibit-exec option.
1495 * main.cc (main): Check --noinhibit-exec.
1497 * options.h (class General_options): Define --wrap as a special
1498 option. Add wrap_symbols_ field.
1499 (General_options::any_wrap_symbols): New function.
1500 (General_options::is_wrap_symbol): New function.
1501 * options.cc (General_options::parse_wrap): New function.
1502 (General_options::General_options): Initialize wrap_symbols_.
1503 * symtab.cc (Symbol_table::wrap_symbol): New function.
1504 (Symbol_table::add_from_object): Handle --wrap.
1505 * symtab.h (class Symbol_table): Declare wrap_symbol.
1506 * target.h (Target::wrap_char): New function.
1507 (Target::Target_info): Add wrap_char field.
1508 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
1509 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1510 * testsuite/testfile.cc (Target_test::test_target_info):
1513 * errors.cc (Errors::undefined_symbol): Mention symbol version if
1516 * layout.h (class Layout): Add added_eh_frame_data_ field.
1517 * layout.cc (Layout::Layout): Initialize new field.
1518 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
1519 output section until we find a section we merged successfully.
1520 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
1521 that the size be non-zero.
1523 * merge.cc (Object_merge_map::get_output_offset): Remove inline
1526 2008-04-08 Craig Silverstein <csilvers@google.com>
1528 * configure.ac: Export new conditional variable HAVE_ZLIB.
1529 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
1531 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
1532 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
1534 2008-04-07 Ian Lance Taylor <iant@google.com>
1536 * version.cc (version_string): Set to "1.5".
1538 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
1539 Add issued_non_pic_error_ field. Declare check_non_pic.
1540 (Target_x86_64::Scan::check_non_pic): New function.
1541 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
1542 (Target_x86_64::Scan::global): Likewise.
1544 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
1545 addend parameter. Change caller. Handle merge sections.
1546 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
1547 Address to Addend. Don't add in the result of
1548 local_section_offset, pass down the addend and use the returned
1550 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
1551 Update declarations of local_section_offset and symbol_value.
1552 * testsuite/two_file_test_1.cc (t18): New function.
1553 * testsuite/two_file_test_2.cc (f18): New function.
1554 * testsuite/two_file_test_main.cc (main): Call t18.
1555 * testsuite/two_file_test.h (t18, f18): Declare.
1557 * configure.ac: Don't test for objdump, c++filt, or readelf.
1558 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
1560 (TEST_READELF): New variable.
1561 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
1562 (check_PROGRAMS): Add two_file_strip_test.
1563 (two_file_strip_test): New target.
1564 (check_PROGRAMS): Add two_file_same_shared_strip_test.
1565 (two_file_same_shared_strip_test_SOURCES): New variable.
1566 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
1567 (two_file_same_shared_strip_test_LDFLAGS): New variable.
1568 (two_file_same_shared_strip_test_LDADD): New variable.
1569 (two_file_shared_strip.so): New target.
1570 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
1571 (ver_test_5.syms, ver_test_7.syms): Likewise.
1572 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
1573 (strip_test_3.stdout): Use TEST_OBJDUMP.
1574 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
1576 2008-04-04 Cary Coutant <ccoutant@google.com>
1578 * symtab.h (Symbol::is_weak_undefined): New function.
1579 (Symbol::is_strong_undefined): New function.
1580 (Symbol::is_absolute): New function.
1581 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
1582 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
1584 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
1585 (weak_undef_test): New target.
1586 * testsuite/Makefile.in: Rebuild.
1587 * testsuite/weak_undef_file1.cc: New file.
1588 * testsuite/weak_undef_file2.cc: New file.
1589 * testsuite/weak_undef_test.cc: New file.
1591 2008-04-03 Craig Silverstein <csilvers@google.com>
1593 * compressed_output.h (class Output_compressed_section): Use
1595 * compressed_output.cc (zlib_compress): Use unsigned buffers,
1597 (zlib_compressed_suffix): Removed.
1598 (Output_compressed_section::set_final_data_size): Use unsigned
1600 * testsuite/Makefile.am (flagstest_compress_debug_sections):
1601 Fix linker invocation.
1602 (flagstest_o_specialfile_and_compress_debug_sections):
1604 * testsuite/Makefile.in: Regenerated.
1606 2008-04-02 David S. Miller <davem@davemloft.net>
1608 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
1609 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
1611 2008-04-02 Craig Silverstein <csilvers@google.com>
1615 2008-04-02 Ian Lance Taylor <iant@google.com>
1617 * fileread.cc (File_read::find_view): Add byteshift and vshifted
1618 parameters. Update for new key type to views_. Change all
1620 (File_read::read): Adjust for byteshift in returned view.
1621 (File_read::add_view): New function, broken out of
1623 (File_read::make_view): New function, broken out of
1625 (File_read::find_or_make_view): Add offset and aligned
1626 parameters. Rewrite accordingly. Change all callers.
1627 (File_read::get_view): Add offset and aligned parameters. Adjust
1628 for byteshift in return value.
1629 (File_read::get_lasting_view): Likewise.
1630 * fileread.h (class File_read): Update declarations.
1631 (class File_read::View): Add byteshift_ field. Add byteshift to
1632 constructor. Add byteshift method.
1633 * archive.h (Archive::clear_uncached_views): New function.
1634 (Archive::get_view): Add aligned parameter. Change all callers.
1635 * object.h (Object::get_view): Add aligned parameter. Change all
1637 (Object::get_lasting_view): Likewise.
1639 * fileread.cc (File_read::release): Don't call clear_views if
1640 there are multiple objects.
1641 * fileread.h (File_read::clear_uncached_views): New function.
1642 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
1645 2008-03-31 Cary Coutant <ccoutant@google.com>
1647 Add thin archive support.
1648 * archive.cc (Archive::armagt): New const.
1649 (Archive::setup): Remove task parameter and calls to unlock.
1650 (Archive::unlock_nested_archives): New function.
1651 (Archive::read_header): Add nested_off parameter. Change
1653 (Archive::interpret_header): Likewise.
1654 (Archive::include_all_members): Change to handle thin
1656 (Archive::include_member): Likewise.
1657 * archive.h (Archive::Archive): Add new parameters and
1659 (Archive::armagt): New const.
1660 (Archive::setup): Remove task parameter.
1661 (Archive::unlock_nested_archives): New function.
1662 (Archive::read_header): Add nested_off parameter.
1663 (Archive::interpret_header): Likewise.
1664 (Archive::Nested_archive_table): New typedef.
1665 (Archive::is_thin_archive_): New field.
1666 (Archive::nested_archives_): New field.
1667 (Archive::options_): New field.
1668 (Archive::dirpath_): New field.
1669 (Archive::task_): New field.
1670 * readsyms.cc (Read_symbols::do_read_symbols): Add check
1671 for thin archives. Pass additional parameters to
1672 Archive::Archive. Unlock the archive file after calling
1675 2008-03-29 Ian Lance Taylor <iant@google.com>
1677 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
1678 version symbol to be local.
1679 * testsuite/ver_test_4.sh: New file.
1680 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
1681 (check_DATA): Add ver_test_4.syms.
1682 (ver_test_4.syms): New target.
1683 * testsuite/Makefile.in: Rebuild.
1686 (Output_section::Input_section_sort_entry::has_priority): New
1688 (Output_section::Input_section_sort_entry::match_file_name): New
1690 (Output_section::Input_section_sort_entry::match_section_name):
1692 (Output_section::Input_section_sort_entry::match_section_name_prefix):
1694 (Output_section::Input_section_sort_entry::match_section_file):
1696 (Output_section::Input_section_sort_compare::operator()): Rewrite
1697 using new Input_section_sort_entry functions. Sort crtbegin and
1698 crtend first. Sort sections with no priority before sections with
1700 * testsuite/initpri1.c (d3): Check j != 4.
1701 (cd5): New constructor/destructor function.
1702 (main): Check j != 2.
1704 * symtab.cc (Symbol_table::add_from_object): If we don't use the
1705 new symbol when resolving, don't call set_is_default.
1706 * testsuite/ver_test_7.cc: New file.
1707 * testsuite/ver_test_7.sh: New file.
1708 * testsuite/Makefile.am (ver_test_7.so): New target.
1709 (ver_test_7.o): New target.
1710 (check_SCRIPTS): Add ver_test_7.sh.
1711 (check_DATA): Add ver_test_7.syms.
1712 (ver_test_7.syms): New target.
1714 2008-03-28 Ian Lance Taylor <iant@google.com>
1716 * layout.cc (Layout::layout): If we see an input section with a
1717 name that needs sorting, set the must_sort flag for the output
1719 (Layout::make_output_section): If the name of the output section
1720 indicates that it might require sorting, set the may_sort flag.
1721 * output.h (Output_section::may_sort_attached_input_sections): New
1723 (Output_section::set_may_sort_attached_input_sections): New
1725 (Output_section::must_sort_attached_input_sections): New
1727 (Output_section::set_must_sort_attached_input_sections): New
1729 (class Output_section): Declare Input_section_sort_entry. Define
1730 Input_section_sort_compare. Declare
1731 sort_attached_input_sections. Add new fields:
1732 may_sort_attached_input_sections_,
1733 must_sort_attached_input_sections_,
1734 attached_input_sections_are_sorted_.
1735 * output.cc (Output_section::Output_section): Initialize new
1737 (Output_section::add_input_section): Add an entry to
1738 input_sections_ if may_sort or must_sort are true.
1739 (Output_section::set_final_data_size): Call
1740 sort_attached_input_sections if necessary.
1741 (Output_section::Input_section_sort_entry): Define new class.
1742 (Output_section::Input_section_sort_compare::operator()): New
1744 (Output_section::sort_attached_input_sections): New function.
1745 * configure.ac: Check whether the compiler supports constructor
1746 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
1747 * testsuite/initpri1.c: New file.
1748 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
1749 CONSTRUCTOR_PRIORITY.
1750 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
1751 (initpri1_LDFLAGS): New variable.
1752 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
1754 2008-03-27 Ian Lance Taylor <iant@google.com>
1756 * common.cc (Sort_commons::operator): Correct sorting algorithm.
1757 * testsuite/common_test_1.c: New file.
1758 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
1759 (common_test_1_SOURCES): New variable.
1760 (common_test_1_DEPENDENCIES): New variable.
1761 (common_test_1_LDFLAGS): New variable.
1763 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
1764 and commons_ correctly when NAME/VERSION does not override
1766 * testsuite/ver_test_6.c: New file.
1767 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
1768 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
1769 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
1771 2008-03-26 Ian Lance Taylor <iant@google.com>
1773 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
1774 of an undefined symbol from a version script.
1775 * testsuite/Makefile.am (ver_test_5.so): New target.
1776 (ver_test_5.o): New target.
1777 (check_SCRIPTS): Add ver_test_5.sh.
1778 (check_DATA): Add ver_test_5.syms.
1779 (ver_test_5.syms): New target.
1780 * testsuite/ver_test_5.cc: New file.
1781 * testsuite/ver_test_5.script: New file.
1782 * testsuite/ver_test_5.sh: New file.
1783 * Makefile.in, testsuite/Makefile.in: Rebuild.
1786 Fix problems building gold with gcc 4.3.0.
1787 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
1788 (gold_error_at_location, gold_warning_at_location): Use it.
1789 * configure.ac: Check whether we can compile and use a template
1790 function with a printf attribute.
1791 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
1792 when jumping over bytes.
1793 * object.cc: Instantiate Object::read_section_data.
1794 * debug.h: Include <cstring>
1795 * dwarf_reader.cc: Include <algorithm>
1796 * main.cc: Include <cstring>.
1797 * options.cc: Include <cstring>.
1798 * output.cc: Include <cstring>.
1799 * script.cc: Include <cstring>.
1800 * script.h: Include <string>.
1801 * symtab.cc: Include <cstring> and <algorithm>.
1802 * target-select.cc: Include <cstring>.
1803 * version.cc: Include <string>.
1804 * testsuite/testmain.cc: Include <cstdlib>.
1805 * configure, config.in: Rebuild.
1807 2008-03-25 Ian Lance Taylor <iant@google.com>
1809 * options.cc: Include "../bfd/bfdver.h".
1810 (options::help): Print bug reporting address.
1812 * version.cc (print_version): Adjust output for current value of
1817 * options.cc (options::help): Print list of supported targets.
1818 * target-select.h: Include <vector>.
1819 (class Target_selector): Make machine_, size_, and is_big_endian_
1820 fields const. Add bfd_name_ and instantiated_target_ fields.
1821 (Target_selector::Target_selector): Add bfd_name parameter.
1822 (Target_selector::recognize): Make non-virtual, call
1824 (Target_selector::recognize_by_name): Make non-virtual, call
1825 do_recognize_by_name.
1826 (Target_selector::supported_names): New function.
1827 (Target_selector::bfd_name): New function.
1828 (Target_selector::do_instantiate_target): New pure virtual
1830 (Target_selector::do_recognize): New virtual function.
1831 (Target_selector::do_recognize_by_name): New virtual function.
1832 (Target_selector::instantiate_target): New private function.
1833 (supported_target_names): Declare.
1834 * target-select.cc (Target_selector::Target_selector): Update for
1835 new parameter and fields.
1836 (select_target_by_name): Check that the name matches before
1837 calling recognize_by_name.
1838 (supported_target_names): New function.
1839 * i386.cc (class Target_selector_i386): Update Target_selector
1840 constructor call. Remove recognize and recognize_by_name. Add
1841 do_instantiate_target.
1842 * x86_64.cc (class Target_selector_x86_64): Likewise.
1843 * testsuite/testfile.cc (class Target_selector_test): Update for
1844 changes to Target_selector.
1846 * README: Rewrite, with some notes on unsupported features.
1848 2008-03-24 Cary Coutant <ccoutant@google.com>
1850 * i386.cc (Target_i386::Got_type): New enum declaration.
1851 (Target_i386::Scan::local): Updated callers of Output_data_got
1853 (Target_i386::Scan::global): Likewise.
1854 (Target_i386::Relocate::relocate): Likewise.
1855 (Target_i386::Relocate::relocate_tls): Likewise.
1856 * object.h (Got_offset_list): New class.
1857 (Sized_relobj::local_has_got_offset): Added got_type parameter.
1858 (Sized_relobj::local_got_offset): Likewise.
1859 (Sized_relobj::set_local_got_offset): Likewise.
1860 (Sized_relobj::local_has_tls_got_offset): Removed.
1861 (Sized_relobj::local_tls_got_offset): Removed.
1862 (Sized_relobj::set_local_tls_got_offset): Removed.
1863 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
1864 * output.cc (Output_data_got::add_global): Added got_type parameter.
1865 (Output_data_got::add_global_with_rel): Likewise.
1866 (Output_data_got::add_global_with_rela): Likewise.
1867 (Output_data_got::add_global_pair_with_rel): New function.
1868 (Output_data_got::add_global_pair_with_rela): New function.
1869 (Output_data_got::add_local): Added got_type parameter.
1870 (Output_data_got::add_local_with_rel): Likewise.
1871 (Output_data_got::add_local_with_rela): Likewise.
1872 (Output_data_got::add_local_pair_with_rel): New function.
1873 (Output_data_got::add_local_pair_with_rela): New function.
1874 (Output_data_got::add_global_tls): Removed.
1875 (Output_data_got::add_global_tls_with_rel): Removed.
1876 (Output_data_got::add_global_tls_with_rela): Removed.
1877 (Output_data_got::add_local_tls): Removed.
1878 (Output_data_got::add_local_tls_with_rel): Removed.
1879 (Output_data_got::add_local_tls_with_rela): Removed.
1880 * output.h (Output_data_got::add_global): Added got_type parameter.
1881 (Output_data_got::add_global_with_rel): Likewise.
1882 (Output_data_got::add_global_with_rela): Likewise.
1883 (Output_data_got::add_global_pair_with_rel): New function.
1884 (Output_data_got::add_global_pair_with_rela): New function.
1885 (Output_data_got::add_local): Added got_type parameter.
1886 (Output_data_got::add_local_with_rel): Likewise.
1887 (Output_data_got::add_local_with_rela): Likewise.
1888 (Output_data_got::add_local_pair_with_rel): New function.
1889 (Output_data_got::add_local_pair_with_rela): New function.
1890 (Output_data_got::add_global_tls): Removed.
1891 (Output_data_got::add_global_tls_with_rel): Removed.
1892 (Output_data_got::add_global_tls_with_rela): Removed.
1893 (Output_data_got::add_local_tls): Removed.
1894 (Output_data_got::add_local_tls_with_rel): Removed.
1895 (Output_data_got::add_local_tls_with_rela): Removed.
1896 * resolve.cc (Symbol::override_base_with_special): Removed
1897 reference to has_got_offset_ field.
1898 * symtab.cc (Symbol::init_fields): Replaced initialization
1899 of got_offset_ with got_offsets_. Removed initialization
1901 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
1902 (Symbol::got_offset): Likewise.
1903 (Symbol::set_got_offset): Likewise.
1904 (Symbol::has_tls_got_offset): Removed.
1905 (Symbol::tls_got_offset): Removed.
1906 (Symbol::set_tls_got_offset): Removed.
1907 (Symbol::got_offset_): Removed.
1908 (Symbol::tls_mod_got_offset_): Removed.
1909 (Symbol::tls_pair_got_offset_): Removed.
1910 (Symbol::got_offsets_): New field.
1911 (Symbol::has_got_offset): Removed.
1912 (Symbol::has_tls_mod_got_offset): Removed.
1913 (Symbol::has_tls_pair_got_offset): Removed.
1914 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
1915 (Target_x86_64::Scan::local): Updated callers of Output_data_got
1917 (Target_x86_64::Scan::global): Likewise.
1918 (Target_x86_64::Relocate::relocate): Likewise.
1919 (Target_x86_64::Relocate::relocate_tls): Likewise.
1921 2008-03-25 Ben Elliston <bje@au.ibm.com>
1923 * yyscript.y: Fix spelling error in comment.
1925 2008-03-24 Ian Lance Taylor <iant@google.com>
1927 * options.h (class General_options): Define build_id option.
1928 * layout.h (class Layout): Declare write_build_id, create_note,
1929 create_build_id. Add build_id_note_ member.
1930 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
1931 "libiberty.h", "md5.h", "sha1.h".
1932 (Layout::Layout): Initialize eh_frame_data_,
1933 eh_frame_hdr_section_, and build_id_note_.
1934 (Layout::finalize): Call create_build_id.
1935 (Layout::create_note): New function, broken out of
1936 Layout::create_gold_note.
1937 (Layout::create_gold_note): Call create_note.
1938 (Layout::create_build_id): New function.
1939 (Layout::write_build_id): New function.
1940 (Close_task_runner::run): Call write_build_id.
1942 * x86_64.cc: Correct license to GPLv3.
1944 2008-03-23 Ian Lance Taylor <iant@google.com>
1946 * options.cc: Include "demangle.h".
1947 (parse_optional_string): New function.
1948 (parse_long_option): Handle takes_optional_argument.
1949 (parse_short_option): Update dash_z initializer. Handle
1950 takes_optional_argument.
1951 (General_options::General_options): Initialize do_demangle_.
1952 (General_options::finalize): Set do_demangle_. Handle demangling
1954 * options.h (parse_optional_string): Declare.
1955 (struct One_option): Add optional_arg field. Update constructor.
1956 Update call constructor calls. Add takes_optional_argument
1958 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
1959 (DEFINE_optional_string): Define.
1960 (General_options::demangle): Change from DEFINE_bool to
1961 DEFINE_optional_string.
1962 (General_options::no_demangle): New function.
1963 (General_options::do_demangle): New function.
1964 (General_options::set_do_demangle): New function.
1965 (General_options::execstack_status_): Move definition to end of
1967 (General_options::static_): Likewise.
1968 (General_options::do_demangle_): New field.
1969 * object.cc (big_endian>::get_symbol_location_info): Call
1970 Options::do_demangle, not Options::demangle.
1971 * symtab.cc (demangle): Likewise.
1973 2008-03-22 Ian Lance Taylor <iant@google.com>
1975 * gold.h: Include <cstddef> and <sys/types.h>
1976 * options.h: Include <cstring>.
1978 2008-03-21 Ian Lance Taylor <iant@google.com>
1980 * Added source code to GNU binutils.