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