* configure.ac: Set TOPLEVEL_CONFIGURE_ARGUMENTS early, when
[binutils.git] / gold / ChangeLog
blobc0b33910783e531ec4e2c1132caee1c9d2a10684
1 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
3         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
5 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
6             David S. Miller  <davem@davemloft.net>
8         * powerpc.cc: New file.
9         * Makefile.am (TARGETSOURCES): Add powerpc.cc
10         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
11         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
12         * Makefile.in: Rebuild.
14 2008-06-09  Ian Lance Taylor  <iant@google.com>
16         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
17         <exception>.
18         (throwing, orig_terminate): New static variables.
19         (terminate_handler): New static function.
20         (t2): Set terminate handler.
22 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
24         PR 6584
25         * binary.cc (Binary_to_elf::sized_convert): Fix .data
26         alignment.
28 2008-05-30  Cary Coutant  <ccoutant@google.com>
30         * archive.cc (Archive::include_all_members) Correct to step
31         over symbol table and extended name table in thin archives.
33 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
35         PR 6407
36         * target-reloc.h (relocate_for_relocatable): Fix new_offset
37         calculation.
39 2008-05-28  Caleb Howe  <cshowe@google.com>
41         * reduced_debug_output.cc: New file.
42         * reduced_debug_output.h: New file.
43         * options.h (class General_optoins): Add --strip-debug-non-line.
44         * options.cc (General_options::finalize): Add strip_debug_non_line
45         to the strip heirarchy.
46         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
47         fields.
48         * layout.cc: Include "reduced_debug_output.h".
49         (Layout::Layout): Initialize new fields.
50         (line_only_debug_sections): New static array.
51         (is_lines_only_debug_sections): New static inline function.
52         (Layout::include_section): Handle --strip-debug-non-line.
53         (Layout::make_output_section): If --strip-debug-non-line, build
54         new output sections for .debug_abbrev and .debug_info.
55         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
56         gold.  Warn about possible overflow.
57         (read_signed_LEB_128): Likewise.
58         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
59         (read_signed_LEB_128): Declare.
60         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
61         (HFILES): Add reduced_debug_output.h.
62         * Makefile.in: Rebuild.
64 2008-05-21  Ian Lance Taylor  <iant@google.com>
66         * mapfile.cc: New file.
67         * mapfile.h: New file.
68         * options.h (class General_options): Add -M/--print-map and -Map.
69         * options.cc (General_options::finalize): Make -M equivalent to
70         -Map -.
71         * main.cc: Include <cstdio> and "mapfile.h".
72         (main): Open mapfile if requested.
73         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
74         constructor.  Change caller.
75         (queue_initial_tasks): Add mapfile parameter.  Change caller.
76         (queue_middle_tasks): Likewise.
77         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
78         declarations.
79         * archive.cc: Include "mapfile.h".
80         (Archive::add_symbols): Add mapfile parameter.  Change all
81         callers.  Pass mapfile, symbol, and reason to include_member.
82         (Archive::include_all_members): Add mapfile parameter.  Change all
83         callers.
84         (Archive::include_member): Add mapfile, sym, and why parameters.
85         Change all callers.  Report inclusion to map file.
86         * archive.h: Include "fileread.h".
87         (class Archive): Update declarations.
88         (Archive::file): New const method.
89         (class Add_archive_symbols): Add mapfile_ field.  Update
90         constructor.  Change all callers.
91         * readsyms.h (class Read_symbols): Likewise.
92         (class Finish_group): Likewise.
93         (class Read_script): Likewise.
94         * common.cc: Include "mapfile.h".
95         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
96         all callers.
97         (Symbol_table::do_allocate_commons): Likewise.
98         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
99         symbol allocation to mapfile.
100         * common.h (class Allocate_commons_task): Add mapfile_ field.
101         Update constructor.  Change all callers.
102         * symtab.h (class Symbol_table): Update declarations.
103         * layout.cc: Include "mapfile.h".
104         (Layout_task_runner::run): Print information to mapfile.
105         (Layout::create_gold_note): Change Output_data_fixed_space to
106         Output_data_zero_fill.
107         (Layout::create_build_id): Likewise.
108         (Layout::print_to_mapfile): New function.
109         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
110         constructor.  Change caller.
111         (class Layout): Declare print_to_mapfile.
112         * output.cc (Output_section::Input_section::print_to_mapfile): New
113         function.
114         (Output_section::add_input_section): If producing a map, always
115         add to input_sections_ list.
116         (Output_section::do_print_to_mapfile): New function.
117         (Output_segment::print_sections_to_mapfile): New function.
118         (Output_segment::print_section_list_to_mapfile): New function.
119         * output.h: Include "mapfile.h".
120         (Output_data::print_to_mapfile): New function.
121         (Output_data::do_print_to_mapfile): New virtual function.
122         (Output_segment_headers::do_print_to_mapfile): New function.
123         (Output_file_header::do_print_to_mapfile): New function.
124         (Output_data_const::do_print_to_mapfile): New function.
125         (class Output_data_const_buffer): Add map_name_ field.  Update
126         constructor.  Change all callers.  Add do_print_to_mapfile
127         function.
128         (class Output_data_fixed_space): Likewise.
129         (class Output_data_space): Likewise.
130         (class Output_data_zero_fill): New class.
131         (Output_data_strtab::do_print_to_mapfile): New function.
132         (Output_data_reloc_base::do_print_to_mapfile): New function.
133         (Output_relocatable_relocs::do_print_to_mapfile): New function.
134         (Output_data_group::do_print_to_mapfile): New function.
135         (Output_data_got::do_print_to_mapfile): New function.
136         (Output_data_dynamic::do_print_to_mapfile): New function.
137         (Output_symtab_xindex::do_print_to_mapfile): New function.
138         (class Output_section): Declare do_print_to_mapflie.  Declare
139         print_to_mapfile in Input_section.
140         (class Output_segment): Declare new functions.
141         * object.h (Sized_relobj::symbol_count): New function.
142         * script-sections.cc
143         (Output_section_element_dot_assignment::set_section_addresses):
144         Change Output_data_fixed_space to Output_data_zero_fill.
145         (Output_data_expression::do_print_to_mapfile): New function.
146         * script.cc (read_input_script): Add mapfile parameter.  Change
147         all callers.
148         * script.h (read_input_script): Update declaration.
149         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
150         (Eh_frame::do_print_to_mapfile): New function.
151         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
152         (Output_merge_string::do_print_to_mapfile): New function.
153         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
154         function.
155         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
156         function.
157         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
158         function.
159         * Makefile.am (CCFILES): Add mapfile.cc.
160         (HFILES): Add mapfile.h.
161         * Makefile.in: Rebuild.
163 2008-05-19  Ian Lance Taylor  <iant@google.com>
165         * options.h (class General_options): Add -z relro.
166         * layout.cc (Layout::Layout): Initialize relro_segment_.
167         (Layout::add_output_section_data): Return the output section.
168         (Layout::make_output_section): Rcognize relro sections and mark
169         them appropriately.
170         (Layout::attach_allocated_section_to_segment): Put relro sections
171         in a PT_GNU_RELRO segment.
172         (Layout::create_initial_dynamic_sections): Mark the .dynamic
173         section as relro.
174         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
175         PT_TLS segments.
176         (Layout::linkonce_mapping): Map d.rel.ro.local to
177         .data.rel.ro.local.
178         (Layout::output_section_name): Us .data.rel.ro.local for any
179         section which begins with that.
180         * layout.h (class Layout): Update add_output_section_data
181         declaration.  Add relro_segment_ field.
182         * output.cc (Output_section::Output_section): Initialize is_relro_
183         and is_relro_local_ fields.
184         (Output_segment::add_output_section): Group relro sections.
185         (Output_segment::is_first_section_relro): New function.
186         (Output_segment::maximum_alignment): If there is a relro section,
187         align the segment to the common page size.
188         (Output_segment::set_section_addresses): Track whether we are
189         looking at relro sections.  If the last section is a relro
190         section, align to the common page size.
191         (Output_segment::set_section_list_addresses): Add in_relro
192         parameter.  Change all callers.  Align to the page size when
193         moving from relro to non-relro section.
194         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
195         segment.
196         * output.h (class Output_section): Add is_relro_ and
197         is_relro_local_ fields.
198         (Output_section::is_relro): New function.
199         (Output_section::set_is_relro): New function.
200         (Output_section::is_relro_local): New function.
201         (Output_section::set_is_relro_local): New function.
202         (class Output_segment): Update declarations.
203         * i386.cc (Target_i386::got_section): Mark .got section as relro.
204         * sparc.cc (Target_sparc::got_section): Likewise.
205         * x86_64.cc (Target_x86_64::got_section): Likewise.
206         * testsuite/relro_test_main.cc: New file.
207         * testsuite/relro_test.cc: New file.
208         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
209         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
210         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
211         (relro_test.so, relro_test_pic.o): New targets.
212         * testsuite/Makefile.in: Rebuild.
214 2008-05-16  Ian Lance Taylor  <iant@google.com>
216         * output.cc (Output_segment::add_output_section): Remove front
217         parameter.
218         * output.h (class Output_segment): Remove
219         add_initial_output_section and overloaded add_output_section.
220         Update declaration of remaining add_output_section.
221         * layout.cc (Layout::create_interp): Call add_output_section
222         rather than add_initial_output_section.
223         (Layout::finish_dynamic_section): Likewise.
225         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
226         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
227         know the dynamic type.
228         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
229         field.  Initialize it in constructor.
230         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
231         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
232         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
233         reloc.
235         * output.cc (Output_reloc::get_address): Change return type to
236         Elf_Addr.
237         * output.h (class Output_reloc): Update get_address declaration.
238         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
239         for section addresses.
241 2008-05-09  Ian Lance Taylor  <iant@google.com>
243         PR 6493
244         * gold.cc (gold_nomem): Use return value of write.
246 2008-05-08  Ian Lance Taylor  <iant@google.com>
248         * symtab.c (Symbol::init_base_output_data): Add version
249         parameter.  Change all callers.
250         (Symbol::init_base_output_segment): Likewise.
251         (Symbol::init_base_constant): Likewise.
252         (Symbol::init_base_undefined): Likewise.
253         (Sized_symbol::init_output_data): Likewise.
254         (Sized_symbol::init_output_segment): Likewise.
255         (Sized_symbol::init_constant): Likewise.
256         (Sized_symbol::init_undefined): Likewise.
257         (Symbol_table::do_define_in_output_data): If the new symbol has a
258         version, mark it as the default.
259         (Symbol_table::do_define_in_output_segment): Likewise.
260         (Symbol_table::do_define_as_constant): Likewise.
261         * symtab.h (class Symbol): Update declarations.
262         (class Sized_symbol): Likewise.
263         * resolve.cc (Symbol::override_version): New function.
264         (Symbol::override_base: Call override_version.
265         (Symbol::override_base_with_special): Likewise.
266         * testsuite/ver_script_8.script: New file.
267         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
268         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
269         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
270         (ver_test_8_1.so, ver_test_8_2.so): New targets.
272 2008-05-06  Ian Lance Taylor  <iant@google.com>
274         PR 6049
275         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
276         functions.
277         (class General_options): Remove existing --undefined, and add
278         --no-undefined instead.  Add new --undefined as synonym for -u.
279         * archive.cc (Archive::add_symbols): Check whether symbol was
280         named with -u.
281         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
282         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
283         all uses.  Add IS_UNDEFINED.  Update declarations to split
284         different versions of init_base.  Declare init_base_undefined.
285         (Symbol::is_defined): Handle IS_UNDEFINED.
286         (Symbol::is_undefined): Likewise.
287         (Symbol::is_weak_undefined): Call is_undefined.
288         (Symbol::is_absolute): Handle IS_CONSTANT.
289         (class Sized_symbol): Update declarations to split different
290         versions of init.  Declare init_undefined.
291         (class Symbol_table): Declare new functions.
292         * symtab.cc (Symbol::init_base_object): Rename from init_base.
293         Change all callers.
294         (Symbol::init_base_output_data): Likewise.
295         (Symbol::init_base_output_segment): Likewise.
296         (Symbol::init_base_constant): Likewise.
297         (Symbol::init_base_undefined): New function.
298         (Sized_symbol::init_object): Rename from init.  Change all
299         callers.
300         (Sized_symbol::init_output_data): Likewise.
301         (Sized_symbol::init_output_segment): Likewise.
302         (Sized_symbol::init_constant): Likewise.
303         (Sized_symbol::init_undefined): New function.
304         (Symbol_table::add_undefined_symbols_from_command_line): New
305         function.
306         (Symbol_table::do_add_undefined_symbols_from_command_line): New
307         function.
308         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
309         (Symbol::output_section): Likewise.
310         (Symbol::set_output_section): Likewise.
311         (Symbol_table::sized_finalize_symbol): Likewise.
312         (Symbol_table::sized_write_globals): Likewise.
313         * resolve.cc (Symbol_table::should_override): Likewise.
314         (Symbol::override_base_with_special): Likewise.
316         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
317         symbol, change it to have default visibility.
318         * testsuite/protected_1.cc: New file.
319         * testsuite/protected_2.cc: New file.
320         * testsuite/protected_3.cc: New file.
321         * testsuite/protected_main_1.cc: New file.
322         * testsuite/protected_main_2.cc: New file.
323         * testsuite/protected_main_3.cc: New file.
324         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
325         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
326         (protected_1_LDFLAGS, protected_1_LDADD): Define.
327         (protected_1.so): New target.
328         (protected_1_pic.o, protected_2_pic.o): New targets.
329         (protected_3_pic.o): New target.
330         (check_PROGRAMS): Add protected_2.
331         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
332         (protected_2_LDFLAGS, protected_2_LDADD): Define.
333         * testsuite/Makefile.in: Rebuild.
335         * options.h (DEFINE_var): Add set_user_set_##varname__.
336         (DEFINE_bool_alias): New macro.
337         (class General_options): Define -Bstatic using DEFINE_bool_alias
338         rather than DEFINE_special.  Add --undefined as an alias for -z
339         defs.
340         * options.cc (General_options::parse_Bstatic): Remove.
342         * options.h (class General_options): Add --fatal-warnings.
343         * main.cc (main): Implement --fatal-warnings.
344         * errors.h (Errors::warning_count): New function.
346         * options.h (class General_options): Add -Bsymbolic-functions.
347         * symtab.h (Symbol::is_preemptible): Check for
348         -Bsymbolic-functions.
350 2008-05-05  Ian Lance Taylor  <iant@google.com>
352         * options.h (DEFINE_bool): For DASH_Z, create the negative option
353         as noVARNAME rather than no-VARNAME.
354         (class General_options): Add option -z combreloc.
355         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
356         get_address.
357         (Output_reloc::sort_before) [SHT_REL]: New function.
358         (Output_reloc::sort_before) [SHT_RELA]: New function.
359         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
360         Sort_relocs_comparison.
361         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
362         parameter.  Change all callers.
363         (Output_data_reloc::Output_data_reloc) [both versions]: Add
364         sort_relocs parameter.  Change all callers.
365         * output.cc (Output_reloc::get_address): New function, broken out
366         of write_rel.
367         (Output_reloc::write_rel): Call it.
368         (Output_reloc::compare): New function.
369         (Output_data_reloc_base::do_write): Optionally sort relocs.
371         * configure.ac: If targ_extra_obj is set, link it in.
372         * configure.tgt: Initialize all variables.
373         (x86_64*): Set targ_extra_obj and targ_extra_size.
374         * configure: Rebuild.
376         * object.cc (Sized_relobj::include_section_group): Adjust section
377         indexes read from group data.  Build vector to pass to
378         layout_group.
379         * layout.cc (Layout::layout_group): Add flags and shndxes
380         parameters.  Remove contents parameter.  Change caller.  Update
381         explicit instantiations.
382         * layout.h (class Layout): Update layout_group declaration.
383         * output.cc (Output_data_group::Output_data_group): Add flags and
384         input_shndxes parameters.  Remove contents parameter.  Change
385         caller.
386         (Output_data_group::do_write): Change input_sections_ to
387         input_shndxes_.
388         * output.h (class Output_data_group): Update constructor
389         declaration.  Rename input_sections_ to input_shndxes_.
390         * testsuite/many_sections_test.cc: Add template.
392 2008-04-30  Cary Coutant  <ccoutant@google.com>
394         * target-reloc.h (relocate_section): Fix dead-pointer bug.
396         * layout.cc (Layout::include_section): Refactored check for debug
397         info section.
398         (Layout::add_comdat): Add new parameters.  Change type
399         of signature parameter.  Add object and shndx to signatures table.
400         (Layout::find_kept_object): New function.
401         * layout.h: Include <cstring>.
402         (Layout::is_debug_info_section): New function.
403         (Layout::add_comdat): Add new parameters.
404         (Layout::find_kept_object): New function.
405         (Layout::Kept_section): New struct.
406         (Layout::Signatures): Change type of map range.
407         * object.cc (Relobj::output_section_address): New function.
408         (Sized_relobj::include_section_group): Add new parameters.  Change
409         calls to Layout::add_comdat.  Change to build table of kept comdat
410         groups and table mapping discarded sections to kept sections.
411         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
412         (Sized_relobj::do_layout): Change calls to include_section_group and
413         include_linkonce_section.
414         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
415         value to zero when section is discarded.
416         (Sized_relobj::map_to_kept_section): New function.
417         * object.h (Relobj::output_section_address): New function.
418         (Relobj::Comdat_group): New type.
419         (Relobj::find_comdat_group): New function.
420         (Relobj::Comdat_group_table): New type.
421         (Relobj::Kept_comdat_section): New type.
422         (Relobj::Kept_comdat_section_table): New type.
423         (Relobj::add_comdat_group): New function.
424         (Relobj::set_kept_comdat_section): New function.
425         (Relobj::get_kept_comdat_section): New function.
426         (Relobj::comdat_groups_): New field.
427         (Relobj::kept_comdat_sections_): New field.
428         (Symbol_value::input_value): Update comment.
429         (Sized_relobj::map_to_kept_section) New function.
430         (Sized_relobj::include_linkonce_section): Add new parameter.
431         * target-reloc.h (Comdat_behavior): New type.
432         (get_comdat_behavior): New function.
433         (relocate_section): Add code to map a discarded section to the
434         corresponding kept section when applying a relocation.
436 2008-04-30  Craig Silverstein  <csilvers@google.com>
438         * dwarf_reader.cc (next_generation_count): New static var.
439         (Addr2line_cache_entry): New struct.
440         (addr2line_cache): New static var.
441         (Dwarf_line_info::one_addr2line): Added caching.
442         (Dwarf_line_info::clear_addr2line_cache): New function.
443         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
444         cache-size parameter.
445         (Dwarf_line_info::one_addr2line_cache): New function.
446         * symtab.cc (Symbol_table::detect_odr_violations): Pass
447         new cache-size argument to one_addr2line(), and clear cache.
449 2008-04-28  Cary Coutant  <ccoutant@google.com>
451         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
452         R_386_PC8 relocations.
454 2008-04-23  Ian Lance Taylor  <iant@google.com>
456         * object.cc (Sized_relobj::include_section_group): Check for
457         invalid section group.
459         * object.cc (make_elf_object): Correct test for 64-bit ELF file
460         header size.
462         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
463         than read for file header.
464         * archive.cc (Archive::include_member): Likewise.
466 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
468         * aclocal.m4: Regenerate.
469         * configure: Regenerate.
471 2008-04-19  Ian Lance Taylor  <iant@google.com>
473         * version.cc (version_string): Bump to 1.6.
475         * testsuite/Makefile.am (many_sections_r_test): New target.
476         (many_sections_r_test_SOURCES): Remove.
477         (many_sections_r_test_DEPENDENCIES): Remove.
478         (many_sections_r_test_LDFLAGS): Remove.
479         (many_sections_r_test_LDADD): Remove.
481         * object.cc (Sized_relobj::do_add_symbols): Always pass
482         local_symbol_count_ to add_from_relobj.
484         * testsuite/Makefile.am (many_sections_check.h): Only check one in
485         every thousand variables.
486         * testsuite/Makefile.in: Rebuild.
488         * object.cc (Xindex::initialize_symtab_xindex): New function.
489         (Xindex::read_symtab_xindex): New function.
490         (Xindex::sym_xindex_to_shndx): New function.
491         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
492         available.
493         (Sized_relobj::do_initialize_xindex): New function.
494         (Sized_relobj::do_read_symbols): Adjust section links.
495         (Sized_relobj::symbol_section_and_value): Add is_ordinary
496         parameter.  Change all callers.
497         (Sized_relobj::include_section_group): Adjust section links and
498         symbol section indexes.
499         (Sized_relobj::do_layout): Adjust section links.
500         (Sized_relobj::do_count_local_symbols): Adjust section links and
501         symbol section indexes.
502         (Sized_relobj::do_finalize_local_symbols): Distinguish between
503         ordinary and special symbols.
504         (Sized_relobj::write_local_symbols): Add symtab_xindex and
505         dynsym_xindex parameters.  Change all callers.  Adjust section
506         links.  Use SHN_XINDEX when needed.
507         (Sized_relobj::get_symbol_location_info): Adjust section links.
508         Don't get fooled by special symbols.
509         * object.h (class Xindex): Define.
510         (class Object): Add xindex_ parameter.  Declare virtual functoin
511         do_initialize_xindex.
512         (Object::adjust_sym_shndx): New function.
513         (Object::set_xindex): New protected function.
514         (class Symbol_value): Add is_ordinary_shndx_ field.
515         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
516         (Symbol_value::value): Assert ordinary section.
517         (Symbol_value::initialize_input_to_output_map): Likewise.
518         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
519         Change all callers.
520         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
521         all callers.
522         (class Sized_relobj): Update declarations.
523         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
524         parameter.  Change all callers.
525         (Sized_relobj::adjust_shndx): New function.
526         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
527         field.
528         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
529         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
530         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
531         (Sized_dynobj::read_dynsym_section): Adjust section links.
532         (Sized_dynobj::read_dynamic): Likewise.
533         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
534         section links.
535         (Sized_dynobj::do_initialize_xindex): New function.
536         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
537         do_initialize_xindex.
538         (Sized_dynobj::adjust_shndx): New function.
539         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
540         dynsym_xindex_ fields.
541         (Layout::finalize): Add a call to set_section_indexes before
542         creating the symtab sections.
543         (Layout::set_section_indexes): Don't do anything if the section
544         already has a section index.
545         (Layout::create_symtab_sections): Add shnum parameter.  Change
546         caller.  Create .symtab_shndx section if needed.
547         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
548         caller.
549         (Layout::allocated_output_section_count): New function.
550         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
551         needed.
552         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
553         fields.  Update declarations.
554         (Layout::symtab_xindex): New function.
555         (Layout::dynsym_xindex): New function.
556         (class Write_symbols_task): Add layout_ field.
557         (Write_symbols_task::Write_symbols_task): Add layout parameter.
558         Change caller.
559         * output.cc (Output_section_headers::Output_section_headers): Add
560         shstrtab_section parameter.  Change all callers.
561         (Output_section_headers::do_sized_write): Store overflow values
562         for section count and section string table section index in
563         section header zero.
564         (Output_file_header::do_sized_write): Check for overflow of
565         section count and section string table section index.
566         (Output_symtab_xindex::do_write): New function.
567         (Output_symtab_xindex::endian_do_write): New function.
568         * output.h (class Output_section_headers): Add shstrtab_section_.
569         Update declarations.
570         (class Output_symtab_xindex): Define.
571         (Output_section::has_out_shndx): New function.
572         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
573         field.
574         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
575         Change all callers.
576         (Sized_symbol::init): Likewise.
577         (Symbol::output_section): Check for ordinary symbol.
578         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
579         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
580         callers.
581         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
582         Change all callers.  Simplify handling of symbols from sections
583         not included in the link.
584         (Symbol_table::add_from_dynobj): Handle ordinary symbol
585         distinction.
586         (Weak_alias_sorter::operator()): Assert that symbols are
587         ordinary.
588         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
589         distinction.
590         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
591         parameters.  Change all callers.
592         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
593         symbol distinction.  Use SHN_XINDEX when needed.
594         (Symbol_table::write_section_symbol): Add symtab_xindex
595         parameter.  Change all callers.
596         (Symbol_table::sized_write_section_symbol): Likewise.  Use
597         SHN_XINDEX when needed.
598         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
599         declarations.
600         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
601         (Symbol::is_defined): Check is_ordinary.
602         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
603         (Symbol::is_absolute, Symbol::is_common): Likewise.
604         (class Sized_symbol): Update declarations.
605         (class Symbol_table): Update declarations.
606         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
607         parameters.  Change all callers.
608         (Sized_symbol::override): Likewise.
609         (Symbol_table::override): Likewise.
610         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
611         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
612         is_ordinary, and orig_st_shndx parameters.  Change all callers.
613         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
614         to be in an ordinary section.
615         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
616         object and is_ordinary parameters.  Change all callers.
617         (Sized_dwarf_line_info::read_relocs): Add object parameter.
618         Change all callers.  Don't add undefined or non-ordinary symbols
619         to reloc_map_.
620         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
621         Change all callers.
622         * dwarf_reader.h (class Sized_dwarf_line_info): Update
623         declarations.
624         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
625         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
626         (Sized_relobj::relocate_sections): Likewise.
627         * target-reloc.h (scan_relocs): Adjust section symbol index.
628         (scan_relocatable_relocs): Likewise.
629         * i386.cc (Scan::local): Check for ordinary symbols.
630         * sparc.cc (Scan::local): Likewise.
631         * x86_64.cc (Scan::local): Likewise.
632         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
633         to symbol_section_and_value.
634         * testsuite/many_sections_test.cc: New file.
635         * testsuite/Makefile.am (BUILT_SOURCES): Define.
636         (check_PROGRAMS): Add many_sections_test.
637         (many_sections_test_SOURCES): Define.
638         (many_sections_test_DEPENDENCIES): Define.
639         (many_sections_test_LDFLAGS): Define.
640         (BUILT_SOURCES): Add many_sections_define.h.
641         (many_sections_define.h): New target.
642         (BUILT_SOURCES): Add many_sections_check.h.
643         (many_sections_check.h): New target.
644         (check_PROGRAMS): Add many_sections_r_test.
645         (many_sections_r_test_SOURCES): Define.
646         (many_sections_r_test_DEPENDENCIES): Define.
647         (many_sections_r_test_LDFLAGS): Define.
648         (many_sections_r_test_LDADD): Define.
649         (many_sections_r_test.o): New target.
650         * testsuite/Makefile.in: Rebuild.
652 2008-04-17  Cary Coutant  <ccoutant@google.com>
654         * errors.cc (Errors::info): New function.
655         (gold_info): New function.
656         * errors.h (Errors::info): New function.
657         * gold.h (gold_info): New function.
658         * object.cc (Input_objects::add_object): Print trace output.
659         * options.cc (options::parse_set): New function.
660         (General_options::parse_wrap): Deleted.
661         (General_options::General_options): Deleted initializer.
662         * options.h (options::String_set): New typedef.
663         (options::parse_set): New function.
664         (DEFINE_set): New macro.
665         (General_options::wrap): Changed to use DEFINE_set. Changed
666         callers of any_wrap_symbols and is_wrap_symbol.
667         (General_options::trace, General_options::trace_symbol):
668         New options.
669         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
670         (General_options::wrap_symbols_): Deleted.
671         * symtab.cc (Symbol_table::add_from_object): Print trace output.
673 2008-04-17  David S. Miller  <davem@davemloft.net>
675         * options.cc (General_options::parse_V): New function.
676         * options.h: Add entries for -V and -Qy.
678 2008-04-17  Ian Lance Taylor  <iant@google.com>
680         * common.cc (Symbol_table::allocate_commons): Remove options
681         parameter.  Change caller.
682         (Symbol_table::do_allocate_commons): Remove options parameter.
683         Change caller.  Just call do_allocate_commons_list twice.
684         (Symbol_table::do_allocate_commons_list): New function, broken out
685         of do_allocate_commons.
686         * common.h (class Allocate_commons_task): Remove options_ field.
687         Update constructor.
688         * symtab.cc (Symbol_table::Symbol_table): Initialize
689         tls_commons_.
690         (Symbol_table::add_from_object): Put TLS common symbols on
691         tls_commons_ list.
692         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
693         which are IN_OUTPUT_DATA.
694         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
695         allocate_commons and do_allocate_commons declarations.  Declare
696         do_allocate_commons_list.
697         * gold.cc (queue_middle_tasks): Update creation of
698         Allocate_commons_task to not pass options.
699         * testsuite/Makefile.am (INCLUDES): Add -I.. .
700         (TLS_TEST_C_FLAGS): New variable.
701         (tls_test_c_pic.o): New target.
702         (tls_test_shared.so): Link in tls_test_c_pic.o.
703         (tls_test_c_pic_ie.o): New target.
704         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
705         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
706         (tls_test_c.o): New target.
707         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
708         (tls_pic_test_LDADD): Likewise.
709         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
710         (tls_shared_gd_to_ie_test_LDADD): Likewise.
711         (tls_test_c_gnu2.o): New target.
712         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
713         tls_test_c_gnu2.o.
714         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
715         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
716         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
717         * testsuite/tls_test.cc: Include "config.h".
718         (t_last): Call t11_last.
719         * testsuite/tls_test.h (t11, t11_last): Declare.
720         * testsuite/tls_test_c.c: New file.
721         * testsuite/tls_test_main.cc (thread_routine): Call t11.
722         * configure.ac: Check for OpenMP support.
723         * configure, config.in, Makefile.in: Rebuild.
724         * testsuite/Makefile.in: Rebuild.
726 2008-04-16  Cary Coutant  <ccoutant@google.com>
728         * i386.cc (Target_i386::define_tls_base_symbol): New function.
729         (Target_i386::tls_base_symbol_defined_): New field.
730         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
731         (Target_i386::Scan::global): Likewise.
732         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
733         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
734         (Target_x86_64::tls_base_symbol_defined_): New field.
735         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
736         (Target_x86_64::Scan::global): Likewise.
738 2008-04-16  Cary Coutant  <ccoutant@google.com>
740         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
741         (Symbol::needs_plt_entry): Allow weak undefined symbols.
742         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
743         building shared libraries.
744         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
745         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
746         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
747         * testsuite/Makefile.in: Rebuild.
748         * testsuite/weak_undef.h: New file.
749         * testsuite/weak_undef_file1.cc: Add extra test cases.
750         * testsuite/weak_undef_file2.cc: Likewise.
751         * testsuite/weak_undef_test.cc: Likewise.
753 2008-04-16  David S. Miller  <davem@davemloft.net>
755         * sparc.cc (Target_sparc::Scan): Change from struct to class.
756         Add issued_non_pic_error_ field.  Declare check_non_pic.
757         (Target_sparc::Scan::check_non_pic): New function.
758         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
759         (Target_sparc::Scan::global): Likewise.
761         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
762         * configure: Rebuild.
764         * options.h (DEFINE_enable): New macro.
765         (new_dtags): New enable option.
766         (initfirst, interpose, loadfltr, nodefaultlib,
767         nodelete, nodlopen, nodump): New -z options.
768         * layout.cc (Layout:finish_dynamic_section): If new
769         dtags enabled, emit DT_RUNPATH.  Also, emit a
770         DT_FLAGS_1 containing any specified -z flags.
772 2008-04-16  Ian Lance Taylor  <iant@google.com>
774         * copy-relocs.cc: New file.
775         * copy-relocs.h: New file.
776         * reloc.cc: Remove Copy_relocs code.
777         * reloc.h: Likewise.
778         * reloc-types.h (struct Reloc_types) [both versions]: Add
779         get_reloc_addend_noerror.
780         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
781         variants of add_global which take an addend which must be zero.
782         * i386.cc: Include "copy-relocs.h".
783         (class Target_i386): Change type of copy_relocs_ to variable,
784         update initializer.
785         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
786         Change all callers.
787         (Target_i386::do_finalize_sections): Change handling of
788         copy_relocs_.
789         * sparc.cc: Include "copy-relocs.h".
790         (class Target_sparc): Change type of copy_relocs_ to variable,
791         update initializer.
792         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
793         Change all callers.
794         (Target_sparc::do_finalize_sections): Change handling of
795         copy_relocs_.
796         * x86_64.cc: Include "copy-relocs.h".
797         (class Target_x86_64): Change type of copy_relocs_ to variable,
798         update initializer.
799         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
800         class.  Change all callers.
801         (Target_x86_64::do_finalize_sections): Change handling of
802         copy_relocs_.
803         * Makefile.am (CCFILES): Add copy-relocs.cc.
804         (HFILES): Add copy-relocs.h.
806         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
808         * testsuite/script_test_4.sh: Permit leading zeroes.
810 2008-04-15  Ian Lance Taylor  <iant@google.com>
812         * script-sections.cc (Script_sections::create_segments): Use
813         header_size_adjustment even when there is enough room for the
814         headers.
815         * testsuite/script_test_4.sh: New file.
816         * testsuite/script_test_4.t: New file.
817         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
818         (check_DATA): Add script_test_4.stdout.
819         (MOSTLYCLEANFILES): Likewise.
820         (script_test_4): New target.
821         (script_test_4.stdout): New target.
822         * testsuite/Makefile.in: Rebuild.
824         * sparc.cc: Add definitions for Output_data_plt_sparc class
825         constants.
827 2008-04-14  David S. Miller  <davem@davemloft.net>
829         * sparc.cc: New file.
830         * Makefile.am (TARGETSOURCES): Add sparc.cc
831         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
832         * configure.tgt: Document targ_extra_size and
833         targ_extra_big_endian.  Add entries for sparc-* and
834         sparc64-*.
835         * configure.ac: Handle targ_extra_size and
836         targ_extra_big_endian.
837         * Makefile.in: Rebuild.
838         * configure: Likewise.
839         * po/POTFILES.in: Likewise.
840         * po/gold.pot: Likewise.
842 2008-04-14  Ian Lance Taylor  <iant@google.com>
844         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
845         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
846         in the name/type/flags to section mapping.  Don't call
847         allocate_output_section.
848         (Layout::choose_output_section): Change parameter from adjust_name
849         to is_input_section.  Don't permit input sections after sections
850         are attached to segments.  Don't call allocate_output_section.
851         (Layout::layout_eh_frame): Call update_flags_for_input_section,
852         not write_enable_output_section.
853         (Layout::make_output_section): Don't push to
854         unattached_section_list_ nor call attach_to_segment.  Call
855         attach_section_to_segment if sections are attached.
856         (Layout::attach_sections_to_segments): New function.
857         (Layout::attach_section_to_segment): New function.
858         (Layout::attach_allocated_section_to_segment): Rename from
859         attach_to_segment.  Remove flags parameter.
860         (Layout::allocate_output_section): Remove function.
861         (Layout::write_enable_output_section): Remove function.
862         * layout.h (class Layout): Update for above changes.  Add new
863         field sections_are_attached_.
864         * output.h (Output_section::update_flags_for_input_section): New
865         function.
866         * output.cc (Output_section::add_input_section): Call
867         update_flags_for_input_section.
868         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
870 2008-04-11  Cary Coutant  <ccoutant@google.com>
872         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
873         thought unnecessary.
874         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
876 2008-04-11  Ian Lance Taylor  <iant@google.com>
878         * output.h (class Output_section_data): Remove inline definition
879         of set_addralign.
880         * output.cc (Output_section_data::set_addralign): New function.
882 2008-04-11  Cary Coutant  <ccoutant@google.com>
884         Add support for TLS descriptors for i386 and x86_64.
885         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
886         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
887         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
888         GOT_TYPE_TLS_DESC.
889         (Target_i386::got_mod_index_entry): Remove unnecessary code.
890         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
891         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
892         relocations.
893         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
894         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
895         Fix problem with initial-exec relocations.
896         (Target_i386::Relocate::relocate_tls): Likewise.
897         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
898         relaxation.
899         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
900         support for section-plus-offset dynamic table entries.
901         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
902         (Output_data_dynamic::Dynamic_entry): Add support for
903         section-plus-offset dynamic table entries.
904         (Output_data_dynamic::Classification): Likewise.
905         (Output_data_dynamic::classification_): Renamed offset_.
906         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
907         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
908         (Target_x86_64::make_plt_section): New function.
909         (Target_x86_64::reserve_tlsdesc_entries): New function.
910         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
911         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
912         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
913         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
914         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
915         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
916         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
917         add extra PLT entry for TLS descriptors.
918         (Output_data_plt_x86_64::got_): New field.
919         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
920         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
921         fields.
922         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
923         descriptors.
924         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
925         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
926         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
927         R_386_TLS_DESC_CALL relocations.
928         (Target_x86_64::Scan::global): Likewise.
929         (Target_x86_64::do_finalize_sections): Add dynamic table entries
930         for TLS descriptors.
931         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
932         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
933         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
934         GD-to-IE relaxation.
935         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
936         and TLS_DESCRIPTORS.
937         * Makefile.in: Rebuild.
938         * configure: Rebuild.
939         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
940         (tls_test_shared2.so): New target.
941         (tls_shared_gd_to_ie_test_SOURCES): New variable.
942         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
943         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
944         (tls_shared_gd_to_ie_test_LDADD): New variable.
945         (tls_shared_gnu2_gd_to_ie_test): New target.
946         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
947         New targets.
948         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
949         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
950         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
951         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
952         (tls_shared_gnu2_test): New target.
953         (tls_test_gnu2_shared.so): New target.
954         (tls_shared_gnu2_test_SOURCES): New variable.
955         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
956         (tls_shared_gnu2_test_LDFLAGS): New variable.
957         (tls_shared_gnu2_test_LDADD): New variable.
958         * testsuite/Makefile.in: Rebuild.
959         * testsuite/Makefile.
961 2008-04-11  Ian Lance Taylor  <iant@google.com>
963         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
964         justsyms.t.
965         * testsuite/Makefile.in: Rebuild.
967         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
968         long.
969         * testsuite/script_test_2.cc (main): Adjust test.
971 2008-04-11  David S. Miller  <davem@davemloft.net>
972             Ian Lance Taylor  <iant@google.com>
974         * options.h (General_options): Add entries for '-Y' and
975         '-relax'.
976         * options.cc (General_options:finalize): If -Y was used, add those
977         entries to the library path instead of the default "/lib" and
978         "/usr/lib".
980 2008-04-11  David S. Miller  <davem@davemloft.net>
982         * testsuite/justsyms.t: Start at 0x100.
983         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
984         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
985         long.
986         * testsuite/script_test_2.cc: Adjust string and section length
987         checks.
989 2008-04-09  Ian Lance Taylor  <iant@google.com>
991         PR gold/5996
992         * script-sections.cc (Sections_element::allocate_to_segment): Add
993         orphan parameter.
994         (Output_section_definition::allocate_to_segment): Likewise.
995         (Orphan_output_section::allocate_to_segment): Likewise.
996         (Script_sections::attach_sections_using_phdrs_clause): Don't
997         propagate non-PT_LOAD segments to orphan sections.
998         * testsuite/Makefile.am (script_test_3.stdout): Generate using
999         readelf rather than objdump.
1000         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
1001         .interp section and PT_INTERP segment are the same size.
1002         * testsuite/Makefile.in: Rebuild.
1004         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
1005         aliases for symbols defined in the same object.
1006         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
1007         (weak_alias_test_SOURCES): New variable.
1008         (weak_alias_test_DEPENDENCIES): New variable.
1009         (weak_alias_test_LDFLAGS): New variable.
1010         (weak_alias_test_LDADD): New variable.
1011         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
1012         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
1013         (weak_alias_test_3.o): New target.
1014         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
1015         * testsuite/weak_alias_test_main.cc: New file.
1016         * testsuite/weak_alias_test_1.cc: New file.
1017         * testsuite/weak_alias_test_2.cc: New file.
1018         * testsuite/weak_alias_test_3.cc: New file.
1020 2008-04-08  Ian Lance Taylor  <iant@google.com>
1022         * options.h (class General_options): Add --noinhibit-exec option.
1023         * main.cc (main): Check --noinhibit-exec.
1025         * options.h (class General_options): Define --wrap as a special
1026         option.  Add wrap_symbols_ field.
1027         (General_options::any_wrap_symbols): New function.
1028         (General_options::is_wrap_symbol): New function.
1029         * options.cc (General_options::parse_wrap): New function.
1030         (General_options::General_options): Initialize wrap_symbols_.
1031         * symtab.cc (Symbol_table::wrap_symbol): New function.
1032         (Symbol_table::add_from_object): Handle --wrap.
1033         * symtab.h (class Symbol_table): Declare wrap_symbol.
1034         * target.h (Target::wrap_char): New function.
1035         (Target::Target_info): Add wrap_char field.
1036         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
1037         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1038         * testsuite/testfile.cc (Target_test::test_target_info):
1039         Likewise.
1041         * errors.cc (Errors::undefined_symbol): Mention symbol version if
1042         there is one.
1044         * layout.h (class Layout): Add added_eh_frame_data_ field.
1045         * layout.cc (Layout::Layout): Initialize new field.
1046         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
1047         output section until we find a section we merged successfully.
1048         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
1049         that the size be non-zero.
1051         * merge.cc (Object_merge_map::get_output_offset): Remove inline
1052         qualifier.
1054 2008-04-08  Craig Silverstein  <csilvers@google.com>
1056         * configure.ac: Export new conditional variable HAVE_ZLIB.
1057         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
1058         on HAVE_ZLIB.
1059         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
1060         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
1062 2008-04-07  Ian Lance Taylor  <iant@google.com>
1064         * version.cc (version_string): Set to "1.5".
1066         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
1067         Add issued_non_pic_error_ field.  Declare check_non_pic.
1068         (Target_x86_64::Scan::check_non_pic): New function.
1069         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
1070         (Target_x86_64::Scan::global): Likewise.
1072         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
1073         addend parameter.  Change caller.  Handle merge sections.
1074         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
1075         Address to Addend.  Don't add in the result of
1076         local_section_offset, pass down the addend and use the returned
1077         value.
1078         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
1079         Update declarations of local_section_offset and symbol_value.
1080         * testsuite/two_file_test_1.cc (t18): New function.
1081         * testsuite/two_file_test_2.cc (f18): New function.
1082         * testsuite/two_file_test_main.cc (main): Call t18.
1083         * testsuite/two_file_test.h (t18, f18): Declare.
1085         * configure.ac: Don't test for objdump, c++filt, or readelf.
1086         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
1087         conditionals.
1088         (TEST_READELF): New variable.
1089         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
1090         (check_PROGRAMS): Add two_file_strip_test.
1091         (two_file_strip_test): New target.
1092         (check_PROGRAMS): Add two_file_same_shared_strip_test.
1093         (two_file_same_shared_strip_test_SOURCES): New variable.
1094         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
1095         (two_file_same_shared_strip_test_LDFLAGS): New variable.
1096         (two_file_same_shared_strip_test_LDADD): New variable.
1097         (two_file_shared_strip.so): New target.
1098         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
1099         (ver_test_5.syms, ver_test_7.syms): Likewise.
1100         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
1101         (strip_test_3.stdout): Use TEST_OBJDUMP.
1102         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
1104 2008-04-04  Cary Coutant  <ccoutant@google.com>
1106         * symtab.h (Symbol::is_weak_undefined): New function.
1107         (Symbol::is_strong_undefined): New function.
1108         (Symbol::is_absolute): New function.
1109         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
1110         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
1111         absolute symbols.
1112         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
1113         (weak_undef_test): New target.
1114         * testsuite/Makefile.in: Rebuild.
1115         * testsuite/weak_undef_file1.cc: New file.
1116         * testsuite/weak_undef_file2.cc: New file.
1117         * testsuite/weak_undef_test.cc: New file.
1119 2008-04-03  Craig Silverstein  <csilvers@google.com>
1121         * compressed_output.h (class Output_compressed_section): Use
1122         unsigned buffer.
1123         * compressed_output.cc (zlib_compress): Use unsigned buffers,
1124         add zlib header.
1125         (zlib_compressed_suffix): Removed.
1126         (Output_compressed_section::set_final_data_size): Use unsigned
1127         buffers.
1128         * testsuite/Makefile.am (flagstest_compress_debug_sections):
1129         Fix linker invocation.
1130         (flagstest_o_specialfile_and_compress_debug_sections):
1131         Likewise.
1132         * testsuite/Makefile.in: Regenerated.
1134 2008-04-02  David S. Miller  <davem@davemloft.net>
1136         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
1137         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
1139 2008-04-02  Craig Silverstein  <csilvers@google.com>
1141         * TODO: New file.
1143 2008-04-02  Ian Lance Taylor  <iant@google.com>
1145         * fileread.cc (File_read::find_view): Add byteshift and vshifted
1146         parameters.  Update for new key type to views_.  Change all
1147         callers.
1148         (File_read::read): Adjust for byteshift in returned view.
1149         (File_read::add_view): New function, broken out of
1150         find_and_make_view.
1151         (File_read::make_view): New function, broken out of
1152         find_and_make_view.
1153         (File_read::find_or_make_view): Add offset and aligned
1154         parameters.  Rewrite accordingly.  Change all callers.
1155         (File_read::get_view): Add offset and aligned parameters.  Adjust
1156         for byteshift in return value.
1157         (File_read::get_lasting_view): Likewise.
1158         * fileread.h (class File_read): Update declarations.
1159         (class File_read::View): Add byteshift_ field.  Add byteshift to
1160         constructor.  Add byteshift method.
1161         * archive.h (Archive::clear_uncached_views): New function.
1162         (Archive::get_view): Add aligned parameter.  Change all callers.
1163         * object.h (Object::get_view): Add aligned parameter.  Change all
1164         callers.
1165         (Object::get_lasting_view): Likewise.
1167         * fileread.cc (File_read::release): Don't call clear_views if
1168         there are multiple objects.
1169         * fileread.h (File_read::clear_uncached_views): New function.
1170         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
1171         on the archive.
1173 2008-03-31  Cary Coutant  <ccoutant@google.com>
1175         Add thin archive support.
1176         * archive.cc (Archive::armagt): New const.
1177         (Archive::setup): Remove task parameter and calls to unlock.
1178         (Archive::unlock_nested_archives): New function.
1179         (Archive::read_header): Add nested_off parameter. Change
1180         all callers.
1181         (Archive::interpret_header): Likewise.
1182         (Archive::include_all_members): Change to handle thin
1183         archives.
1184         (Archive::include_member): Likewise.
1185         * archive.h (Archive::Archive): Add new parameters and
1186         initializers.
1187         (Archive::armagt): New const.
1188         (Archive::setup): Remove task parameter.
1189         (Archive::unlock_nested_archives): New function.
1190         (Archive::read_header): Add nested_off parameter.
1191         (Archive::interpret_header): Likewise.
1192         (Archive::Nested_archive_table): New typedef.
1193         (Archive::is_thin_archive_): New field.
1194         (Archive::nested_archives_): New field.
1195         (Archive::options_): New field.
1196         (Archive::dirpath_): New field.
1197         (Archive::task_): New field.
1198         * readsyms.cc (Read_symbols::do_read_symbols): Add check
1199         for thin archives.  Pass additional parameters to
1200         Archive::Archive.  Unlock the archive file after calling
1201         Archive::setup.
1202         
1203 2008-03-29  Ian Lance Taylor  <iant@google.com>
1205         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
1206         version symbol to be local.
1207         * testsuite/ver_test_4.sh: New file.
1208         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
1209         (check_DATA): Add ver_test_4.syms.
1210         (ver_test_4.syms): New target.
1211         * testsuite/Makefile.in: Rebuild.
1213         * output.cc
1214         (Output_section::Input_section_sort_entry::has_priority): New
1215         function.
1216         (Output_section::Input_section_sort_entry::match_file_name): New
1217         function.
1218         (Output_section::Input_section_sort_entry::match_section_name):
1219         Remove.
1220         (Output_section::Input_section_sort_entry::match_section_name_prefix):
1221         Remove.
1222         (Output_section::Input_section_sort_entry::match_section_file):
1223         Remove.
1224         (Output_section::Input_section_sort_compare::operator()): Rewrite
1225         using new Input_section_sort_entry functions.  Sort crtbegin and
1226         crtend first.  Sort sections with no priority before sections with
1227         a priority.
1228         * testsuite/initpri1.c (d3): Check j != 4.
1229         (cd5): New constructor/destructor function.
1230         (main): Check j != 2.
1232         * symtab.cc (Symbol_table::add_from_object): If we don't use the
1233         new symbol when resolving, don't call set_is_default.
1234         * testsuite/ver_test_7.cc: New file.
1235         * testsuite/ver_test_7.sh: New file.
1236         * testsuite/Makefile.am (ver_test_7.so): New target.
1237         (ver_test_7.o): New target.
1238         (check_SCRIPTS): Add ver_test_7.sh.
1239         (check_DATA): Add ver_test_7.syms.
1240         (ver_test_7.syms): New target.
1242 2008-03-28  Ian Lance Taylor  <iant@google.com>
1244         * layout.cc (Layout::layout): If we see an input section with a
1245         name that needs sorting, set the must_sort flag for the output
1246         section.
1247         (Layout::make_output_section): If the name of the output section
1248         indicates that it might require sorting, set the may_sort flag.
1249         * output.h (Output_section::may_sort_attached_input_sections): New
1250         function.
1251         (Output_section::set_may_sort_attached_input_sections): New
1252         function.
1253         (Output_section::must_sort_attached_input_sections): New
1254         function.
1255         (Output_section::set_must_sort_attached_input_sections): New
1256         function.
1257         (class Output_section): Declare Input_section_sort_entry.  Define
1258         Input_section_sort_compare.  Declare
1259         sort_attached_input_sections.  Add new fields:
1260         may_sort_attached_input_sections_,
1261         must_sort_attached_input_sections_,
1262         attached_input_sections_are_sorted_.
1263         * output.cc (Output_section::Output_section): Initialize new
1264         fields.
1265         (Output_section::add_input_section): Add an entry to
1266         input_sections_ if may_sort or must_sort are true.
1267         (Output_section::set_final_data_size): Call
1268         sort_attached_input_sections if necessary.
1269         (Output_section::Input_section_sort_entry): Define new class.
1270         (Output_section::Input_section_sort_compare::operator()): New
1271         function.
1272         (Output_section::sort_attached_input_sections): New function.
1273         * configure.ac: Check whether the compiler supports constructor
1274         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
1275         * testsuite/initpri1.c: New file.
1276         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
1277         CONSTRUCTOR_PRIORITY.
1278         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
1279         (initpri1_LDFLAGS): New variable.
1280         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
1282 2008-03-27  Ian Lance Taylor  <iant@google.com>
1284         * common.cc (Sort_commons::operator): Correct sorting algorithm.
1285         * testsuite/common_test_1.c: New file.
1286         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
1287         (common_test_1_SOURCES): New variable.
1288         (common_test_1_DEPENDENCIES): New variable.
1289         (common_test_1_LDFLAGS): New variable.
1291         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
1292         and commons_ correctly when NAME/VERSION does not override
1293         NAME/NULL.
1294         * testsuite/ver_test_6.c: New file.
1295         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
1296         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
1297         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
1299 2008-03-26  Ian Lance Taylor  <iant@google.com>
1301         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
1302         of an undefined symbol from a version script.
1303         * testsuite/Makefile.am (ver_test_5.so): New target.
1304         (ver_test_5.o): New target.
1305         (check_SCRIPTS): Add ver_test_5.sh.
1306         (check_DATA): Add ver_test_5.syms.
1307         (ver_test_5.syms): New target.
1308         * testsuite/ver_test_5.cc: New file.
1309         * testsuite/ver_test_5.script: New file.
1310         * testsuite/ver_test_5.sh: New file.
1311         * Makefile.in, testsuite/Makefile.in: Rebuild.
1313         PR gold/5986
1314         Fix problems building gold with gcc 4.3.0.
1315         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
1316         (gold_error_at_location, gold_warning_at_location): Use it.
1317         * configure.ac: Check whether we can compile and use a template
1318         function with a printf attribute.
1319         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
1320         when jumping over bytes.
1321         * object.cc: Instantiate Object::read_section_data.
1322         * debug.h: Include <cstring>
1323         * dwarf_reader.cc: Include <algorithm>
1324         * main.cc: Include <cstring>.
1325         * options.cc: Include <cstring>.
1326         * output.cc: Include <cstring>.
1327         * script.cc: Include <cstring>.
1328         * script.h: Include <string>.
1329         * symtab.cc: Include <cstring> and <algorithm>.
1330         * target-select.cc: Include <cstring>.
1331         * version.cc: Include <string>.
1332         * testsuite/testmain.cc: Include <cstdlib>.
1333         * configure, config.in: Rebuild.
1335 2008-03-25  Ian Lance Taylor  <iant@google.com>
1337         * options.cc: Include "../bfd/bfdver.h".
1338         (options::help): Print bug reporting address.
1340         * version.cc (print_version): Adjust output for current value of
1341         BFD_VERSION_STRING.
1343         * NEWS: New file.
1345         * options.cc (options::help): Print list of supported targets.
1346         * target-select.h: Include <vector>.
1347         (class Target_selector): Make machine_, size_, and is_big_endian_
1348         fields const.  Add bfd_name_ and instantiated_target_ fields.
1349         (Target_selector::Target_selector): Add bfd_name parameter.
1350         (Target_selector::recognize): Make non-virtual, call
1351         do_recognize.
1352         (Target_selector::recognize_by_name): Make non-virtual, call
1353         do_recognize_by_name.
1354         (Target_selector::supported_names): New function.
1355         (Target_selector::bfd_name): New function.
1356         (Target_selector::do_instantiate_target): New pure virtual
1357         function.
1358         (Target_selector::do_recognize): New virtual function.
1359         (Target_selector::do_recognize_by_name): New virtual function.
1360         (Target_selector::instantiate_target): New private function.
1361         (supported_target_names): Declare.
1362         * target-select.cc (Target_selector::Target_selector): Update for
1363         new parameter and fields.
1364         (select_target_by_name): Check that the name matches before
1365         calling recognize_by_name.
1366         (supported_target_names): New function.
1367         * i386.cc (class Target_selector_i386): Update Target_selector
1368         constructor call.  Remove recognize and recognize_by_name.  Add
1369         do_instantiate_target.
1370         * x86_64.cc (class Target_selector_x86_64): Likewise.
1371         * testsuite/testfile.cc (class Target_selector_test): Update for
1372         changes to Target_selector.
1374         * README: Rewrite, with some notes on unsupported features.
1376 2008-03-24  Cary Coutant  <ccoutant@google.com>
1378         * i386.cc (Target_i386::Got_type): New enum declaration.
1379         (Target_i386::Scan::local): Updated callers of Output_data_got
1380         member functions.
1381         (Target_i386::Scan::global): Likewise.
1382         (Target_i386::Relocate::relocate): Likewise.
1383         (Target_i386::Relocate::relocate_tls): Likewise.
1384         * object.h (Got_offset_list): New class.
1385         (Sized_relobj::local_has_got_offset): Added got_type parameter.
1386         (Sized_relobj::local_got_offset): Likewise.
1387         (Sized_relobj::set_local_got_offset): Likewise.
1388         (Sized_relobj::local_has_tls_got_offset): Removed.
1389         (Sized_relobj::local_tls_got_offset): Removed.
1390         (Sized_relobj::set_local_tls_got_offset): Removed.
1391         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
1392         * output.cc (Output_data_got::add_global): Added got_type parameter.
1393         (Output_data_got::add_global_with_rel): Likewise.
1394         (Output_data_got::add_global_with_rela): Likewise.
1395         (Output_data_got::add_global_pair_with_rel): New function.
1396         (Output_data_got::add_global_pair_with_rela): New function.
1397         (Output_data_got::add_local): Added got_type parameter.
1398         (Output_data_got::add_local_with_rel): Likewise.
1399         (Output_data_got::add_local_with_rela): Likewise.
1400         (Output_data_got::add_local_pair_with_rel): New function.
1401         (Output_data_got::add_local_pair_with_rela): New function.
1402         (Output_data_got::add_global_tls): Removed.
1403         (Output_data_got::add_global_tls_with_rel): Removed.
1404         (Output_data_got::add_global_tls_with_rela): Removed.
1405         (Output_data_got::add_local_tls): Removed.
1406         (Output_data_got::add_local_tls_with_rel): Removed.
1407         (Output_data_got::add_local_tls_with_rela): Removed.
1408         * output.h (Output_data_got::add_global): Added got_type parameter.
1409         (Output_data_got::add_global_with_rel): Likewise.
1410         (Output_data_got::add_global_with_rela): Likewise.
1411         (Output_data_got::add_global_pair_with_rel): New function.
1412         (Output_data_got::add_global_pair_with_rela): New function.
1413         (Output_data_got::add_local): Added got_type parameter.
1414         (Output_data_got::add_local_with_rel): Likewise.
1415         (Output_data_got::add_local_with_rela): Likewise.
1416         (Output_data_got::add_local_pair_with_rel): New function.
1417         (Output_data_got::add_local_pair_with_rela): New function.
1418         (Output_data_got::add_global_tls): Removed.
1419         (Output_data_got::add_global_tls_with_rel): Removed.
1420         (Output_data_got::add_global_tls_with_rela): Removed.
1421         (Output_data_got::add_local_tls): Removed.
1422         (Output_data_got::add_local_tls_with_rel): Removed.
1423         (Output_data_got::add_local_tls_with_rela): Removed.
1424         * resolve.cc (Symbol::override_base_with_special): Removed
1425         reference to has_got_offset_ field.
1426         * symtab.cc (Symbol::init_fields): Replaced initialization
1427         of got_offset_ with got_offsets_.  Removed initialization
1428         of has_got_offset_
1429         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
1430         (Symbol::got_offset): Likewise.
1431         (Symbol::set_got_offset): Likewise.
1432         (Symbol::has_tls_got_offset): Removed.
1433         (Symbol::tls_got_offset): Removed.
1434         (Symbol::set_tls_got_offset): Removed.
1435         (Symbol::got_offset_): Removed.
1436         (Symbol::tls_mod_got_offset_): Removed.
1437         (Symbol::tls_pair_got_offset_): Removed.
1438         (Symbol::got_offsets_): New field.
1439         (Symbol::has_got_offset): Removed.
1440         (Symbol::has_tls_mod_got_offset): Removed.
1441         (Symbol::has_tls_pair_got_offset): Removed.
1442         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
1443         (Target_x86_64::Scan::local): Updated callers of Output_data_got
1444         member functions.
1445         (Target_x86_64::Scan::global): Likewise.
1446         (Target_x86_64::Relocate::relocate): Likewise.
1447         (Target_x86_64::Relocate::relocate_tls): Likewise.
1449 2008-03-25  Ben Elliston  <bje@au.ibm.com>
1451         * yyscript.y: Fix spelling error in comment.
1453 2008-03-24  Ian Lance Taylor  <iant@google.com>
1455         * options.h (class General_options): Define build_id option.
1456         * layout.h (class Layout): Declare write_build_id, create_note,
1457         create_build_id.  Add build_id_note_ member.
1458         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
1459         "libiberty.h", "md5.h", "sha1.h".
1460         (Layout::Layout): Initialize eh_frame_data_,
1461         eh_frame_hdr_section_, and build_id_note_.
1462         (Layout::finalize): Call create_build_id.
1463         (Layout::create_note): New function, broken out of
1464         Layout::create_gold_note.
1465         (Layout::create_gold_note): Call create_note.
1466         (Layout::create_build_id): New function.
1467         (Layout::write_build_id): New function.
1468         (Close_task_runner::run): Call write_build_id.
1470         * x86_64.cc: Correct license to GPLv3.
1472 2008-03-23  Ian Lance Taylor  <iant@google.com>
1474         * options.cc: Include "demangle.h".
1475         (parse_optional_string): New function.
1476         (parse_long_option): Handle takes_optional_argument.
1477         (parse_short_option): Update dash_z initializer.  Handle
1478         takes_optional_argument.
1479         (General_options::General_options): Initialize do_demangle_.
1480         (General_options::finalize): Set do_demangle_.  Handle demangling
1481         style.
1482         * options.h (parse_optional_string): Declare.
1483         (struct One_option): Add optional_arg field.  Update constructor.
1484         Update call constructor calls.  Add takes_optional_argument
1485         function.
1486         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
1487         (DEFINE_optional_string): Define.
1488         (General_options::demangle): Change from DEFINE_bool to
1489         DEFINE_optional_string.
1490         (General_options::no_demangle): New function.
1491         (General_options::do_demangle): New function.
1492         (General_options::set_do_demangle): New function.
1493         (General_options::execstack_status_): Move definition to end of
1494         class definition.
1495         (General_options::static_): Likewise.
1496         (General_options::do_demangle_): New field.
1497         * object.cc (big_endian>::get_symbol_location_info): Call
1498         Options::do_demangle, not Options::demangle.
1499         * symtab.cc (demangle): Likewise.
1501 2008-03-22  Ian Lance Taylor  <iant@google.com>
1503         * gold.h: Include <cstddef> and <sys/types.h>
1504         * options.h: Include <cstring>.
1506 2008-03-21  Ian Lance Taylor  <iant@google.com>
1508         * Added source code to GNU binutils.
1509