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