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