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