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