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