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