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