OSDN Git Service

2009-01-20 Sriraman Tallam <tmsriram@google.com>
[pf3gnuchains/pf3gnuchains3x.git] / gold / ChangeLog
1 2009-01-20  Sriraman Tallam <tmsriram@google.com>
2
3         * Makefile.am (CCFILES): Add gc.cc.
4         (HFILES): Add gc.h.
5         * Makefile.in: Regenerate.
6         * gold.cc (Gc_runner): New class.
7         (queue_initial_tasks): Call garbage collection related tasks
8         when corresponding options are invoked.
9         (queue_middle_gc_tasks): New function.
10         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
11         processed early before laying out sections during garbage collection.
12         * gold.h (queue_middle_gc_tasks): New function.
13         (is_prefix_of): Move from "layout.cc".
14         * i386.cc (Target_i386::gc_process_relocs): New function.
15         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
16         * main.cc (main): Create object of class "Garbage_collection".
17         * object.cc (Relobj::copy_symbols_data): New function.
18         (Relobj::is_section_name_included): New function.
19         (Sized_relobj::do_layout): Allow this function to be called twice 
20         during garbage collection and defer layout of section during the 
21         first call.
22         * object.h (Relobj::get_symbols_data): New function.
23         (Relobj::is_section_name_included): New function.
24         (Relobj::copy_symbols_data): New function.
25         (Relobj::set_symbols_data): New function.
26         (Relobj::get_relocs_data): New function.
27         (Relobj::set_relocs_data): New function.
28         (Relobj::is_output_section_offset_invalid): New pure virtual function.
29         (Relobj::gc_process_relocs): New function.
30         (Relobj::do_gc_process_relocs): New pure virtual function.
31         (Relobj::sd_): New data member.
32         (Sized_relobj::is_output_section_offset_invalid): New function.
33         (Sized_relobj::do_gc_process_relocs): New function.
34         * options.h (General_options::gc_sections): Modify to not be a no-op.
35         (General_options::print_gc_sections): New option.
36         * plugin.cc (Plugin_finish::run): Remove function call to
37         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
38         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
39         * reloc.cc (Read_relocs::run): Add task to process relocs and
40         determine unreferenced sections when doing garbage collection.
41         (Gc_process_relocs): New class.
42         (Sized_relobj::do_gc_process_relocs): New function.
43         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
44         sections that are garbage collected.
45         * reloc.h (Gc_process_relocs): New class.
46         * sparc.cc (Target_sparc::gc_process_relocs): New function.
47         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
48         symbols whose corresponding sections are garbage collected.
49         (Symbol_table::Symbol_table): Add new parameter for the garbage
50         collection object.
51         (Symbol_table::gc_mark_undef_symbols): New function.
52         (Symbol_table::gc_mark_symbol_for_shlib): New function.
53         (Symbol_table::gc_mark_dyn_syms): New function.
54         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
55         as garbage.
56         (Symbol_table::add_from_object): Likewise.
57         (Symbol_table::add_from_relobj): When building shared objects, do not
58         treat externally visible symbols as garbage.
59         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
60         table information for static and relocatable links.
61         * symtab.h (Symbol_table::set_gc): New function.
62         (Symbol_table::gc): New function.
63         (Symbol_table::gc_mark_undef_symbols): New function.
64         (Symbol_table::gc_mark_symbol_for_shlib): New function.
65         (Symbol_table::gc_mark_dyn_syms): New function.
66         (Symbol_table::gc_): New data member.
67         * target.h (Sized_target::gc_process_relocs): New pure virtual 
68         function.
69         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
70         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
71
72 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
73
74         * options.h (General_options::gc_sections): Define as a no-op for now.
75         (General_options::no_keep_memory): Ditto.
76         (General_options::Bshareable): Define.
77         * options.cc (General_options::finalize): Honor -Bshareable.
78
79 2009-01-20  Andreas Schwab  <schwab@suse.de>
80
81         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
82         read the value in the contents, since we don't use it.  Use the
83         template endianness when writing.
84         (Relocate::relocate): Use it for R_PPC_REL16_HA.
85
86 2009-01-19  Andreas Schwab  <schwab@suse.de>
87
88         * configure.tgt (powerpc64-*): Fix targ_obj.
89
90 2009-01-15  Ian Lance Taylor  <iant@google.com>
91
92         * object.cc (Sized_relobj::write_local_symbols): Don't write out
93         local symbols when stripping all symbols.
94
95 2009-01-14  Cary Coutant  <ccoutant@google.com>
96
97         * output.cc (Output_reloc): Add explicit instantiations.
98
99 2009-01-14  Cary Coutant  <ccoutant@google.com>
100
101         * archive.cc (Archive::get_elf_object_for_member): Remove call
102         to File_read::claim_for_plugin.
103         * descriptors.cc (Descriptors::open): Remove reference to
104         is_claimed.
105         (Descriptors::claim_for_plugin): Remove.
106         * descriptors.h (Descriptors::claim_for_plugin): Remove.
107         (Descriptors::is_claimed): Remove.
108         (claim_descriptor_for_plugin): Remove.
109         * fileread.cc (File_read::claim_for_plugin): Remove.
110         * fileread.h (File_read::claim_for_plugin): Remove.
111         (File_read::descriptor): Reopen descriptor if necessary.
112         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
113         (Plugin_manager::all_symbols_read): Add task parameter. Change
114         all callers.
115         (Plugin_manager::get_input_file): New function.
116         (Plugin_manager::release_input_file): New function.
117         (Pluginobj::Pluginobj): Add filesize parameter and initialize
118         corresponding data member.
119         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
120         and pass to base constructor. Change all callers.
121         (get_input_file, release_input_file): New functions.
122         (make_sized_plugin_object): Add filesize parameter. Change all callers.
123         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
124         (Plugin_manager::all_symbols_read): Add task parameter.
125         (Plugin_manager::get_input_file): New function.
126         (Plugin_manager::release_input_file): New function.
127         (Plugin_manager::task_): New data member.
128         (Pluginobj::Pluginobj): Add filesize parameter.
129         (Pluginobj::filename): New function.
130         (Pluginobj::descriptor): New function.
131         (Pluginobj::filesize): New function.
132         (Pluginobj::filesize_): New data member.
133         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
134         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
135         File_read::claim_for_plugin; use Object::unlock to unlock the file.
136
137         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
138         with archive libraries.
139         * testsuite/Makefile.in: Regenerate.
140         * testsuite/plugin_test.c (struct sym_info): New type.
141         (get_input_file, release_input_file): New static variables.
142         (onload): Capture new transfer vector entries.
143         (claim_file_hook): Stop reading at end of file according to filesize.
144         Factor out parsing of readelf output into separate function.
145         (all_symbols_read_hook): Exercise get_input_file and release_input_file
146         APIs and get the source file name from the symbol table.  Convert
147         source file name to corresponding object file name.  Print info
148         message when adding new input files.
149         (parse_readelf_line): New function.
150         * testsuite/plugin_test_1.sh: Add checks for new info messages.
151         * testsuite/plugin_test_2.sh: Likewise.
152         * testsuite/plugin_test_3.sh: Likewise.
153         * testsuite/plugin_test_4.sh: New test case.
154
155 2009-01-07  Ian Lance Taylor  <iant@google.com>
156
157         * version.cc (version_string): Bump to 1.8.
158
159 2008-12-23  Cary Coutant  <ccoutant@google.com>
160
161         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
162         * plugin.cc (Plugin_manager::finish): Rename as
163         layout_deferred_objects.  Move cleanup to separate function.
164         (Plugin_manager::cleanup): New function.
165         (Plugin_finish::run): Call layout_deferred_objects and cleanup
166         separately.
167         * plugin.h (Plugin_manager::finish): Rename as
168         layout_deferred_objects.
169         (Plugin_manager::cleanup): New function.
170         (Plugin_manager::cleanup_done): New field.
171
172 2008-12-23  Cary Coutant  <ccoutant@google.com>
173
174         * plugin.cc (is_visible_from_outside): New function.
175         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
176         so we don't return "IR only" status for exported symbols or -r links.
177
178         * testsuite/Makefile.am (plugin_test_3): New test case.
179         * testsuite/Makefile.in: Regenerate.
180         * testsuite/plugin_test_3.sh: New file.
181
182 2008-12-22  Cary Coutant  <ccoutant@google.com>
183
184         * object.cc (Sized_relobj::layout_section): New function.
185         (Sized_relobj::do_layout): Defer layout of input sections until after
186         plugin has provided replacement files.
187         (Sized_relobj::do_layout_deferred_sections): New function.
188         * object.h (Relobj::set_section_offset): Remove virtual keyword.
189         (Relobj::layout_deferred_sections): New function.
190         (Relobj::do_layout_deferred_sections): New function.
191         (Sized_relobj::do_layout_deferred_sections): New function.
192         (Sized_relobj::layout_section): New function.
193         (Sized_relobj::Deferred_layout): New structure.
194         (Sized_relobj::deferred_layout_): New field.
195         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
196         Change all callers.  Layout deferred sections.
197         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
198         references.
199         (Plugin_hook::run): Move code from do_plugin_hook inline.
200         (Plugin_hook::do_plugin_hook): Remove.
201         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
202         (Plugin_manager::finish): Renamed, was cleanup.
203         (Plugin_manager::should_defer_layout): New function.
204         (Plugin_manager::add_deferred_layout_object): New function.
205         (Plugin_manager::Deferred_layout_list): New type.
206         (Plugin_manager::deferred_layout_objects_): New field.
207         (Plugin_hook::do_plugin_hook): Remove.
208
209 2008-12-17  Ian Lance Taylor  <iant@google.com>
210
211         * options.h (class General_options): Add --no case for
212         --export-dynamic.
213
214 2008-12-16  Cary Coutant  <ccoutant@google.com>
215
216         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
217         vector.
218         (Plugin_manager::claim_file): Create plugin object even if
219         plugin did not call the add_symbols callback.
220         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
221         asking for more symbols than were added.
222         * testsuite/Makefile.am (plugin_test_1): Add test case with
223         no global symbols.
224         (empty.syms): New target.
225         * testsuite/Makefile.in: Regenerate.
226         * testsuite/plugin_test.c (claim_file_hook): Add new debug
227         message. Don't call add_symbols if no globals.
228         (all_symbols_read_hook): Don't provide replacement for empty
229         claimed file.
230
231 2008-12-12  Ian Lance Taylor  <iant@google.com>
232
233         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
234         r_type == 0 for a local symbol with r_sym == 0.
235         (scan_relocatable_relocs): Pass r_sym to
236         local_non_section_strategy.
237         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
238         r_sym parameter.
239
240         * configure.ac: Update test for TLS descriptors: they are
241         supported as of glibc 2.9.
242         * configure: Rebuild.
243
244 2008-12-11  Ian Lance Taylor  <iant@google.com>
245
246         PR 7091
247         * target-reloc.h (Default_scan_relocatable_relocs): For each
248         function, map r_type == 0 to RELOC_DISCARD.
249
250 2008-12-10  Cary Coutant  <ccoutant@google.com>
251
252         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
253         object to override a kept COMDAT group from a plugin object.
254
255 2008-12-09  Ian Lance Taylor  <iant@google.com>
256
257         PR 7088
258         * yyscript.y (file_cmd): Handle INPUT.
259
260         * testsuite/initpri1.c: Change all declarations to be full
261         prototypes by adding void, to avoid compiler warnings.
262
263 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
264
265         * options.cc (General_options::parse_plugin_opt): New.
266         (General_options::add_plugin): The argument now is just the filename.
267         (General_options::add_plugin_option): New.
268         * options.h (plugin_opt): New.
269         (add_plugin): Change argument name.
270         (add_plugin_option): New.
271         * plugin.cc (Plugin::load): Don't parse the plugin option.
272         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
273         (Plugin::add_option): New.
274         (Plugin::args_): Change type.
275         (Plugin::filename_): New.
276         (Plugin_manager::add_plugin_option): New.
277         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
278         * testsuite/Makefile.in: Regenerate.
279
280 2008-12-05  Cary Coutant  <ccoutant@google.com>
281
282         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
283         Handle --strip-lto-sections option.
284         * options.h (strip_lto_sections): New option.
285
286 2008-12-01  Cary Coutant  <ccoutant@google.com>
287
288         * plugin.cc (ld_plugin_message): Change format parameter to const.
289         Fix mismatch between new[] and delete.
290
291 2008-11-14  Cary Coutant  <ccoutant@google.com>
292
293         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
294         instead of -1U.
295
296 2008-11-05  Craig Silverstein  <csilvers@google.com>
297
298         * options.cc (General_options::parse_dynamic_list): New function.
299         * options.h (General_options): New flags dynamic_list,
300         dynamic_list_data, dynamic_list_cpp_new, and
301         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
302         (General_options::in_dynamic_list): New function.
303         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
304         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
305         (Lex::can_continue_name): Likewise.
306         (yylex): Likewise.
307         (read_script_file): New parameter script_options.
308         (read_dynamic_list): New function.
309         (Script_options::define_dynamic_list): New function.
310         (dynamic_list_keyword_parsecodes): New variable.
311         (dynamic_list_keywords): New variable.
312         * script.h (Script_options::define_dynamic_list): New function
313         prototype.
314         (read_dynamic_list): New function prototype.
315         * symtab.cc (strprefix): New macro.
316         (Symbol::should_add_dynsym_entry): Support dynamic_list,
317         dynamic_list_data, dynamic_list_cpp_new, and
318         dynamic_list_cpp_typeinfo.
319         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
320         (dynamic_list_expr): New rule.
321         (dynamic_list_nodes): Likewise.
322         (dynamic_list_node): Likewise.
323         * testsuite/Makefile.am (dynamic_list): New test.
324         * testsuite/Makefile.in: Regenerated.
325         * testsuite/dynamic_list.t: New file.
326         * testsuite/dynamic_list.sh: New file.
327
328 2008-11-05  Craig Silverstein  <csilvers@google.com>
329
330         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
331         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
332         (t11_last): Likewise.
333         * testsuite/ver_test_6.c (main): Likewise.
334
335 2008-10-07  Cary Coutant  <ccoutant@google.com>
336
337         * options.c (General_options::finalize): Add check for -static and
338         -shared.
339         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
340         is not empty.
341
342 2008-10-02  Cary Coutant  <ccoutant@google.com>
343
344         * plugin.cc (make_sized_plugin_object): Fix conditional
345         compilation to work when not all targets are enabled.
346
347 2008-09-29  Cary Coutant  <ccoutant@google.com>
348
349         * archive.cc (Archive::get_file_and_offset): Use filename instead
350         of name to get library path.
351         (Archive::include_member): Unlock external member of a thin archive.
352
353         * testsuite/Makefile.am (TEST_AR): New variable.
354         (thin_archive_test_1): New test.
355         (thin_archive_test_2): New test.
356         * testsuite/Makefile.in: Regenerate.
357         * testsuite/thin_archive_main.cc: New file.
358         * testsuite/thin_archive_test_1.cc: New file.
359         * testsuite/thin_archive_test_2.cc: New file.
360         * testsuite/thin_archive_test_3.cc: New file.
361         * testsuite/thin_archive_test_4.cc: New file.
362
363 2008-09-29  Cary Coutant  <ccoutant@google.com>
364
365         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
366         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
367         instead of -1U.
368         (Sized_relobj::do_finalize_local_symbols): Likewise.
369         (Sized_relobj::map_to_kept_section): Likewise.
370         * object.h (Sized_relobj::invalid_address): New constant.
371         (Sized_relobj::do_output_section_offset): Check for invalid_address
372         and return -1ULL.
373         * output.cc (Output_reloc::local_section_offset): Use constant
374         invalid_address instead of -1U.
375         (Output_reloc::get_address): Likewise.
376         (Output_section::output_address): Change -1U to -1ULL.
377         * output.h (Output_reloc::invalid_address): New constant.
378         * reloc.cc (Sized_relobj::write_sections): Use constant
379         invalid_address instead of -1U.
380         (Sized_relobj::relocate_sections): Likewise.
381         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
382         values for merge sections.
383         * target-reloc.h (relocate_for_relocatable): Use constant
384         invalid_address instead of -1U.
385
386 2008-09-19  Cary Coutant  <ccoutant@google.com>
387
388         Add plugin functionality for link-time optimization (LTO).
389         * configure.ac (plugins): Add --enable-plugins option.
390         * configure: Regenerate.
391         * config.in: Regenerate.
392         * Makefile.am (LIBDL): New variable.
393         (CCFILES): Add plugin.cc.
394         (HFILES): Add plugin.h.
395         (ldadd_var): Add LIBDL.
396         * Makefile.in: Regenerate.
397
398         * archive.cc: Include "plugin.h".
399         (Archive::setup): Don't preread archive symbols when using a plugin.
400         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
401         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
402         files.
403         (Archive::include_member): Add symbols from plugin objects.
404         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
405         * descriptors.cc (Descriptors::open): Check for file descriptors
406         abandoned by plugins.
407         (Descriptors::claim_for_plugin): New function.
408         * descriptors.h (Descriptors::claim_for_plugin): New function.
409         (Open_descriptor::is_claimed): New field.
410         (claim_descriptor_for_plugin): New function.
411         * fileread.cc (File_read::claim_for_plugin): New function.
412         * fileread.h (File_read::claim_for_plugin): New function.
413         (File_read::descriptor): New function.
414         * gold.cc: Include "plugin.h".
415         (queue_initial_tasks): Add task to call plugin hooks for generating
416         new object files.
417         * main.cc: Include "plugin.h".
418         (main): Load plugin libraries.
419         * object.h (Pluginobj): Declare.
420         (Object::pluginobj): New function.
421         (Object::do_pluginobj): New function.
422         (Object::set_target): New function.
423         * options.cc: Include "plugin.h".
424         (General_options::parse_plugin): New function.
425         (General_options::General_options): Initialize plugins_ field.
426         (General_options::add_plugin): New function.
427         * options.h (Plugin_manager): Declare.
428         (General_options): Add --plugin option.
429         (General_options::has_plugins): New function.
430         (General_options::plugins): New function.
431         (General_options::add_plugin): New function.
432         (General_options::plugins_): New field.
433         * plugin.cc: New file.
434         * plugin.h: New file.
435         * readsyms.cc: Include "plugin.h".
436         (Read_symbols::do_read_symbols): Check for archive before checking
437         for ELF file.  Call plugin hooks to claim files.
438         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
439         from a real object file; force override when processing replacement
440         files.
441         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
442         (Symbol::init_base_object): Likewise.
443         (Symbol::init_base_output_data): Likewise.
444         (Symbol::init_base_output_segment): Likewise.
445         (Symbol::init_base_constant): Likewise.
446         (Symbol::init_base_undefined): Likewise.
447         (Symbol::output_section): Assert that object is not a plugin.
448         (Symbol_table::add_from_pluginobj): New function.
449         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
450         undefined.
451         (Symbol_table::sized_write_globals): Likewise.
452         (Symbol_table::add_from_pluginobj): Instantiate template.
453         * symtab.h (Sized_pluginobj): Declare.
454         (Symbol::in_real_elf): New function.
455         (Symbol::set_in_real_elf): New function.
456         (Symbol::in_real_elf_): New field.
457         (Symbol_table::add_from_pluginobj): New function.
458
459         * testsuite/Makefile.am (AM_CFLAGS): New variable.
460         (LIBDL): New variable.
461         (LDADD): Add LIBDL.
462         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
463         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
464         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
465         (MOSTLYCLEANFILES): Likewise.
466         * testsuite/Makefile.in: Regenerate.
467         * testsuite/plugin_test.c: New file.
468         * testsuite/plugin_test_1.sh: New file.
469         * testsuite/plugin_test_2.sh: New file.
470
471 2008-09-16  Ian Lance Taylor  <iant@google.com>
472
473         * target-reloc.h (relocate_section): Check whether a symbol is
474         defined by the ABI before reporting an undefined symbol error.
475         * target.h (Target::is_defined_by_abi): Make parameter const.
476         (Target::do_is_defined_by_abi): Likewise.
477         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
478         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
479         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
480         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
481         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
482         * testsuite/Makefile.in: Rebuild.
483
484         * fileread.cc (make_view): Add casts to avoid warning.
485
486 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
487
488         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
489         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
490
491 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
492
493         * options.h (General_options::output_is_executable): New.
494         (General_options::output_is_pie): New.
495         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
496         for shared libraries.
497         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
498
499 2008-09-11  Chris Demetriou  <cgd@google.com>
500
501         * options.h (origin): New -z option.
502         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
503         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
504         in DT_FLAGS_1.
505
506 2008-09-05  Cary Coutant  <ccoutant@google.com>
507
508         * fileread.cc (File_read::make_view): Add check for attempt to map
509         beyond end of file.
510
511 2008-09-05  Cary Coutant  <ccoutant@google.com>
512
513         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
514         explicit instantiations.
515
516 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
517
518         PR gold/6858
519         * options.cc (General_options::finalize): Allow undefined symbols
520         in shlibs if linking -shared.
521
522         PR gold/6859
523         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
524         symbols as not needing a dynsym entry.
525
526 2008-08-20  Craig Silverstein  <csilvers@google.com>
527
528         * fileread.cc (File_read::open): Do not lock the file unless it
529         was successfully opened.
530
531 2008-08-14  Cary Coutant  <ccoutant@google.com>
532
533         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
534         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
535         * testsuite/tls_test.cc (struct int128): 128-bit struct
536         for testing TLS relocs with non-zero addend.
537         (v12): New TLS variable.
538         (t12): New test.
539         (t_last): Add check for v12.
540         * testsuite/tls_test.h (t12): New function.
541         * testsuite/tls_test_main.cc (thread_routine): Call new test.
542
543 2008-08-13  Ian Lance Taylor  <iant@google.com>
544
545         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
546         set tls_segment_ or relro_segment_.
547         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
548         when appropriate.
549         * output.h (Output_section::clear_is_relro): New function.
550         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
551         sections specially even when output_data_ is empty.
552         (Output_segment::maximum_alignment): When first section is relro,
553         only force alignment for PT_LOAD segments.
554         * script.cc (script_data_segment_align): New function.
555         (script_data_segment_relro_end): New function.
556         * script-c.h (script_data_segment_align): Declare.
557         (script_data_segment_relro_end): Declare.
558         * script-sections.h (class Script_sections): Declare
559         data_segment_align and data_segment_relro_end.  Add fields
560         segment_align_index_ and saw_relro_end_.
561         * script-sections.cc (class Sections_element): Add set_is_relro
562         virtual function.  Add new bool* parameter to place_orphan_here.
563         Add get_output_section virtual function.
564         (class Output_section_definition): Add set_is_relro.  Add new
565         bool* parameter to place_orphan_here.  Add get_output_section.
566         Add is_relro_ field.
567         (Output_section_definition::Output_section_definition): Initialize
568         evaluated_address_, evaluated_load_address, evaluated_addralign_,
569         and is_relro_ fields.
570         (Output_section_definition::place_orphan_here): Add is_relro
571         parameter.
572         (Output_section_definition::set_section_addresses): Set relro for
573         output section.
574         (Output_section_definition::alternate_constraint): Likewise.
575         (class Orphan_output_section): Add new bool* parameter to
576         place_orphan_here.  Add get_output_section.
577         (Orphan_output_section::place_orphan_here): Add is_relro
578         parameter.
579         (Script_sections::Script_sections): Initialize
580         data_segment_align_index_ and saw_relro_end_.
581         (Script_sections::data_segment_align): New function.
582         (Script_sections::data_segment_relro_end): New function.
583         (Script_sections::place_orphan): Set or clear is_relro.
584         (Script_sections::set_section_addresses): Force alignment of first
585         TLS section.
586         * yyscript.y (exp): Call script_data_segment_align and
587         script_data_segment_relro_end.
588         * testsuite/relro_script_test.t: New file.
589         * testsuite/relro_test.cc (using_script): Declare.
590         (t1, t2): Test using_script.
591         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
592         (relro_script_test_SOURCES): Define.
593         (relro_script_test_DEPENDENCIES): Define.
594         (relro_script_test_LDFLAGS): Define.
595         (relro_script_test_LDADD): Define.
596         (relro_script_test.so): New target.
597         * testsuite/Makefile.in: Rebuild.
598
599 2008-08-06  Cary Coutant <ccoutant@google.com>
600
601         * archive.cc (Archive::total_archives, Archive::total_members)
602         (Archive::total_members_loaded): New variables.
603         (Archive::setup): Add parameter.  Add option to preread
604         archive symbols.
605         (Archive::read_armap): Add counter.
606         (Archive::get_file_and_offset): New function.
607         (Archive::get_elf_object_for_member): New function.
608         (Archive::read_all_symbols): New function.
609         (Archive::read_symbols): New function.
610         (Archive::add_symbols): Add counters.
611         (Archive::include_all_members): Use armap to find members if it's
612         already built.
613         (Archive::include_member): Skip reading symbols if already read.
614         Factored code into Archive::get_file_and_offset and
615         Archive::get_elf_object_for_member.  Changed call to
616         Mapfile::report_include_archive_member.
617         (Archive::print_stats): New function.
618         * archive.h: Declare Object and Read_symbols_data classes.
619         (Archive::Archive): Add initializers for new members.
620         (Archive::setup): Add parameter.
621         (Archive::print_stats): New function.
622         (Archive::total_archives, Archive::total_members)
623         (Archive::total_members_loaded): New variables.
624         (Archive::get_file_and_offset): New function.
625         (Archive::get_elf_object_for_member): New function.
626         (Archive::read_all_symbols): New function.
627         (Archive::read_symbols): New function.
628         (Archive::Archive_member): New class.
629         (Archive::members_): New member.
630         (Archive::num_members_): New member.
631         * main.cc: Include archive.h.
632         (main): Call Archive::print_stats.
633         * mapfile.cc (Mapfile::report_include_archive_member): Delete
634         archive parameter; member_name is now the fully-decorated name.
635         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
636         * options.h: (General_options): Add --preread-archive-symbols option.
637         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
638         Archive::setup.
639
640 2008-08-04  Ian Lance Taylor  <iant@google.com>
641
642         * symtab.h (Symbol::use_plt_offset): New function.
643         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
644         * powerpc.cc (Relocate::relocate): Likewise.
645         * sparc.cc (Relocate::relocate): Likewise.
646         * x86_64.cc (Relocate::relocate): Likewise.
647         * testsuite/weak_plt.sh: New test.
648         * testsuite/weak_plt_main.cc: New test.
649         * testsuite/weak_plt_shared.cc: New test.
650         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
651         (check_PROGRAMS): Add weak_plt.
652         (check_DATA): Add weak_plt_shared.so.
653         (weak_plt_main_pic.o, weak_plt): New targets.
654         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
655         * testsuite/Makefile.in: Rebuild.
656
657         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
658         gcctestdir/ld.
659         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
660         * testsuite/Makefile.in: Rebuild.
661
662 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
663
664         * Makefile.am (POTFILES.in): Set LC_ALL=C.
665         * Makefile.in: Regenerate.
666         * po/POTFILES.in: Regenerate.
667
668 2008-07-29  Ian Lance Taylor  <iant@google.com>
669
670         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
671         symbols before other symbols.
672         * testsuite/script_test_2.cc (test_addr): Declare.
673         (test_addr_alias): Declare.
674         (main): Check that test_addr and test_addr_alias have the right
675         values.
676         * testsuite/script_test_2.t: Define test_addr_alias and
677         test_addr.
678
679 2008-07-24  Ian Lance Taylor  <iant@google.com>
680
681         PR 5990
682         * descriptors.cc: New file.
683         * descriptors.h: New file.
684         * gold-threads.h (class Hold_optional_lock): New class.
685         * fileread.cc: Include "descriptors.h".
686         (File_read::~File_read): Release descriptor rather than closing
687         it.
688         (File_read::open) [file]: Call open_descriptor rather than open.
689         Set is_descriptor_opened_.
690         (File_read::open) [memory]: Assert that descriptor is not open.
691         (File_read::reopen_descriptor): New function.
692         (File_read::release): Release descriptor.
693         (File_read::do_read): Make non-const.  Reopen descriptor.
694         (File_read::read): Make non-const.
695         (File_read::make_view): Reopen descriptor.
696         (File_read::do_readv): Likewise.
697         * fileread.h (class File_read): Add is_descriptor_opened_ field.
698         Update declarations.
699         * layout.cc: Include "descriptors.h".
700         (Layout::create_build_id): Use open_descriptor rather than open.
701         * output.cc: Include "descriptors.h".
702         (Output_file::open): Use open_descriptor rather than open.
703         * archive.cc (Archive::const_iterator): Change Archive to be
704         non-const.
705         (Archive::begin, Archive::end): Make non-const.
706         (Archive::count_members): Likewise.
707         * archive.h (class Archive): Update declarations.
708         * object.h (Object::read): Make non-const.
709         * Makefile.am (CCFILES): Add descriptors.cc.
710         (HFILES): Add descriptors.h.
711         * Makefile.in: Rebuild.
712
713         PR 6716
714         * gold.h: Always include <clocale>.  Add Solaris workarounds
715         following code in binutils/sysdep.h.
716
717         PR 6048
718         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
719         this->eh_frame_hdr_ is NULL before using it.
720
721         * dynobj.cc (Versions::Versions): Update comment.
722
723         * dynobj.cc (Versions::Versions): If there is an soname, use it as
724         the base version name.
725
726         * stringpool.cc (Stringpool_template::add_with_length): Set key to
727         array size plus one.
728         (Stringpool_template::set_string_offsets): Subtract one from key
729         before using it as an array index.
730         (Stringpool_template::get_offset_with_length): Likewise.
731         (Stringpool_template::write_to_buffer): Likewise.
732         * stringpool.h (Stringpool_template::get_offset_from_key):
733         Likewise.
734
735 2008-07-23  Ian Lance Taylor  <iant@google.com>
736
737         PR 6658
738         * object.h (Merged_symbol_value::value): Do our best to handle a
739         negative addend.
740
741         PR 6647
742         * script.cc (Version_script_info::get_versions): Don't add empty
743         version tag to return value.
744         (Version_script_info::get_symbol_version_helper): Change return
745         type to bool.  Add pversion parameter.  Change all callers.
746         (script_register_vers_node): Don't require a non-NULL tag.
747         * script.h (class Version_script_info): Update declarations.
748         (Version_script_info::get_symbol_version): Change return type to
749         bool.  Add version parameter.  Change all callers.
750         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
751         handling.  Handle an empty version from a version script.
752         (Symbol_table::define_special_symbol): Likewise.
753         * testsuite/ver_test_10.script: New file.
754         * testsuite/ver_test_10.sh: New file.
755         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
756         (check_DATA): Add ver_test_10.syms.
757         (ver_test_10.syms, ver_test_10.so): New target.
758         * testsuite/Makefile.in: Rebuild.
759
760 2008-07-23  Simon Baldwin  <simonb@google.com>
761
762         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
763         to zero for undefined symbols from dynamic libraries.
764
765 2008-07-23  Ian Lance Taylor  <iant@google.com>
766
767         * symtab.cc (Symbol_table::resolve): Remove version parameter.
768         Change all callers.
769         * symtab.h (class Symbol_table): Update declaration.
770         * testsuite/ver_test_9.cc: New file.
771         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
772         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
773         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
774         (ver_test_9.so, ver_test_9.o): New targets.
775         * testsuite/Makefile.in: Rebuild.
776
777 2008-07-22  Ian Lance Taylor  <iant@google.com>
778
779         * options.h (class General_options): Define --check-sections.
780         * layout.cc (Layout::set_segment_offsets): Handle
781         --check-sections.
782
783         * options.h (class General_options): Define -n/--nmagic and
784         -N/--omagic.
785         * options.cc (General_options::finalize): For -n/--nmagic or
786         -N/--omagic, set -static.
787         * layout.cc (Layout::attach_allocated_section_to_segment): If
788         -N/--omagic, don't put read-only and read-write sections in
789         different segments.
790         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
791         finding a read-only segment.
792         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
793         don't set the minimum segment alignment to the common page size,
794         and don't set the file offset to the address modulo the page size.
795         * script-sections.cc (Script_sections::create_segments): If
796         -n/--omagic, don't put read-only and read-write sections in
797         different segments.
798
799         * cref.cc: New file.
800         * cref.h: New file.
801         * options.h (class General_options): Add --print-symbol-counts.
802         * main.cc (main): Issue defined symbol report if requested.
803         * archive.cc (Archive::interpret_header): Make into a const member
804         function.
805         (Archive::add_symbols): Call Input_objects::archive_start and
806         archive_stop.
807         (Archive::const_iterator): Define new class.
808         (Archive::begin, Archive::end): New functions.
809         (Archive::include_all_members): Rewrite to use iterator.
810         (Archive::count_members): New function.
811         * archive.h (class Archive): Update declarations.
812         (Archive::filename): New function.
813         * object.cc: Include "cref.h".
814         (Sized_relobj::Sized_relobj): Initialize defined_count_.
815         (Sized_relobj::do_get_global_symbol_counts): New function.
816         (Input_objects::add_object): Add object to cross-referencer.
817         (Input_objects::archive_start): New function.
818         (Input_objects::archive_stop): New function.
819         (Input_objects::print_symbol_counts): New function.
820         * object.h: Declare Cref and Archive.
821         (Object::get_global_symbol_counts): New function.
822         (Object::do_get_global_symbol_counts): New pure virtual function.
823         (class Sized_relobj): Add defined_count_ field.  Update
824         declarations.
825         (class Input_objects): Add cref_ field.  Update constructor.
826         Update declarations.
827         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
828         defined_count_.
829         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
830         symbol counts.
831         (Sized_dynobj::do_get_global_symbol_counts): New function.
832         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
833         defined_count_.  Update declarations.  Define Symbols typedef.
834         * symtab.cc (Symbol_table::add_from_relobj): Add defined
835         parameter.  Change all callers.
836         (Symbol_table::add_from_dynobj): Add sympointers and defined
837         parameters.  Change all callers.
838         * symtab.h (class Symbol_table): Update declarations.
839         * Makefile.am (CCFILES): Add cref.cc.
840         (HFILES): Add cref.h.
841         * Makefile.in: Rebuild.
842
843 2008-07-22  Simon Baldwin  <simonb@google.com>
844
845         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
846         to zero when writing undefined symbols.
847
848 2008-07-22  Ian Lance Taylor  <iant@google.com>
849
850         * output.cc (Output_section::add_input_section): Don't try to
851         merge empty merge sections.
852
853 2008-07-21  Craig Silverstein  <csilvers@google.com>
854
855         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
856         Include symbol version in error message.
857
858 2008-07-20  Chris Demetriou  <cgd@google.com>
859
860         * configure.ac (gold_cv_c_random_seed): New configured variable.
861         (RANDOM_SEED_CFLAGS): New substituted variable.
862         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
863         * configure: Rebuild.
864         * Makefile.in: Likewise.
865         * testsuite/Makefile.in: Likewise.
866
867 2008-07-18  Ian Lance Taylor  <iant@google.com>
868
869         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
870         where we see NAME/NULL and NAME/VERSION  as separate symbols.
871         * testsuite/ver_test_main.cc (main): Call t4.
872         (t4, t4_2a): Define.
873         * testsuite/ver_test_2.cc (t4_2): Define.
874         * testsuite/ver_test_2.script: Put t4_2a in VER2.
875         * testsuite/ver_test_4.cc (t4_2a): Define.
876         * testsuite/ver_test_4.script: Put t4_2a in VER2.
877         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
878
879 2008-07-17  Ian Lance Taylor  <iant@google.com>
880
881         * dynobj.cc (Versions::add_def): If we give an error about a
882         missing version, go ahead and create the version anyhow.
883
884 2008-07-10  Ian Lance Taylor  <iant@google.com>
885
886         Handle output sections with more than 0x7fffffff bytes.
887         * object.h (class Relobj): Change map_to_output_ to
888         output_sections_, and just keep a section pointer.  Change all
889         uses.  Move comdat group support to Sized_relobj.
890         (Relobj::is_section_specially_mapped): Remove.
891         (Relobj::output_section): Remove poff parameter.  Change all
892         callers.
893         (Relobj::output_section_offset): New function.
894         (Relobj::set_section_offset): Rewrite.
895         (Relobj::map_to_output): Remove.
896         (Relobj::output_sections): New function.
897         (Relobj::do_output_section_offset): New pure virtual function.
898         (Relobj::do_set_section_offset): Likewise.
899         (class Sized_relobj): Add section_offsets_ field.  Add comdat
900         group support from Relobj.  Update declarations.
901         (Sized_relobj::get_output_section_offset): New function.
902         (Sized_relobj::do_output_section_offset): New function.
903         (Sized_relobj::do_set_section_offset): New function.
904         * object.cc (Relobj::output_section_address): Remove.
905         (Sized_relobj::Sized_relobj): Initialize new fields.
906         (Sized_relobj::include_section_group): Cast find_kept_object to
907         Sized_relobj.
908         (Sized_relobj::include_linkonce_section): Likewise.
909         (Sized_relobj::do_layout): Use separate arrays for output section
910         and output offset.
911         (Sized_relobj::do_count_local_symbols): Change map_to_output to
912         output_sections.
913         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
914         output_sections and section_offsets.
915         (Sized_relobj::write_local_symbols): Likewise.
916         (map_to_kept_section): Compute output address directly.
917         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
918         output_sections and section_offsets.
919         (Sized_relobj::write_sections): Likewise.
920         (Sized_relobj::relocate_sections): Likewise.
921         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
922         * output.h (class Output_reloc): Update declarations.  Change
923         u2_.relobj to Sized_relobj*.
924         (class Output_data_reloc): Change add functions to use
925         Sized_relobj*.
926         * output.cc (Output_reloc::Output_reloc): Change relobj to
927         Sized_relobj*.
928         (Output_reloc::local_section_offset): Change return type to
929         Elf_Addr.  Use get_output_section_offset.
930         (Output_reloc::get_address): Likewise.
931         (Output_section::is_input_address_mapped): Don't call
932         is_section_specially_mapped.
933         (Output_section::output_offset): Likewise.
934         (Output_section::output_address): Likewise.
935         (Output_section::starting_output_address): Likewise.
936         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
937         parameter to Sized_relobj*.
938         (Copy_relocs::need_copy_reloc): Likewise.
939         (Copy_relocs::save): Likewise.
940         * copy-relocs.h (class Copy_relocs): Update declarations.
941         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
942         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
943         * target-reloc.h (relocate_for_relocatable): Change
944         offset_in_output_section type to Elf_Addr.  Change code that uses
945         it as well.
946         * layout.cc (Layout::layout): Always set *off.
947         * mapfile.cc (Mapfile::print_input_section): Use
948         output_section_offset.
949         * i386.cc (Target_i386::copy_reloc): Change object parameter to
950         Sized_relobj*.
951         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
952         * sparc.cc (Target_sparc::copy_reloc): Likewise.
953         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
954
955 2008-07-03  Ian Lance Taylor  <iant@google.com>
956
957         * layout.cc (Layout::include_section): Do not discard unrecognized
958         SHT_STRTAB sections.
959
960 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
961
962         * script.cc (Lex::can_continue_name): Make '?' allowable in
963         version-script names.
964         * testsuite/version_script.map: Change glob pattern to use '?'
965
966 2008-06-30  Manish Singh  <yosh@gimp.org>
967
968         PR 6585
969         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
970         Correct typo.
971
972 2008-06-30  Ian Lance Taylor  <iant@google.com>
973
974         PR 6660
975         PR 6682
976         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
977         versions]: Don't try to read the value in the contents, since we
978         don't use it.  Use the template endianness when writing.
979
980 2008-06-25  Cary Coutant  <ccoutant@google.com>
981
982         * fileread.cc (File_read::make_view): Assert on zero-length view.
983         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
984         symbol table when there are no symbols to read.
985
986 2008-06-23  Craig Silverstein  <csilvers@google.com>
987
988         * version.cc (version_string): Bump to 1.7
989
990 2008-06-18  Craig Silverstein  <csilvers@google.com>
991
992         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
993         constant 0xFFFF to type Valtype.
994         (Powerpc_relocate_functions::rel16_ha): Likewise.
995
996 2008-06-17  Ian Lance Taylor  <iant@google.com>
997
998         * output.h (Output_section::Input_section): Initialize p2align_ to
999         zero for Output_section_data constructors.
1000         (Output_section::Input_section::addralign): If not an input
1001         section, return the alignment of the Output_section_data.
1002         * testsuite/copy_test.cc: New file.
1003         * testsuite/copy_test_1.cc: New file.
1004         * testsuite/copy_test_2.cc: New file.
1005         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
1006         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
1007         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
1008         (copy_test_1_pic.o, copy_test_1.so): New targets.
1009         (copy_test_2_pic.o, copy_test_2.so): New targets.
1010         * testsuite/Makefile.in: Rebuild.
1011
1012         * script-sections.cc (Script_sections::place_orphan): Initialize
1013         local variable exact.
1014
1015 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
1016
1017         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
1018
1019 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
1020             David S. Miller  <davem@davemloft.net>
1021
1022         * powerpc.cc: New file.
1023         * Makefile.am (TARGETSOURCES): Add powerpc.cc
1024         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
1025         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
1026         * Makefile.in: Rebuild.
1027
1028 2008-06-09  Ian Lance Taylor  <iant@google.com>
1029
1030         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
1031         <exception>.
1032         (throwing, orig_terminate): New static variables.
1033         (terminate_handler): New static function.
1034         (t2): Set terminate handler.
1035
1036 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
1037
1038         PR 6584
1039         * binary.cc (Binary_to_elf::sized_convert): Fix .data
1040         alignment.
1041
1042 2008-05-30  Cary Coutant  <ccoutant@google.com>
1043
1044         * archive.cc (Archive::include_all_members) Correct to step
1045         over symbol table and extended name table in thin archives.
1046
1047 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
1048
1049         PR 6407
1050         * target-reloc.h (relocate_for_relocatable): Fix new_offset
1051         calculation.
1052
1053 2008-05-28  Caleb Howe  <cshowe@google.com>
1054
1055         * reduced_debug_output.cc: New file.
1056         * reduced_debug_output.h: New file.
1057         * options.h (class General_options): Add --strip-debug-non-line.
1058         * options.cc (General_options::finalize): Add strip_debug_non_line
1059         to the strip heirarchy.
1060         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
1061         fields.
1062         * layout.cc: Include "reduced_debug_output.h".
1063         (Layout::Layout): Initialize new fields.
1064         (line_only_debug_sections): New static array.
1065         (is_lines_only_debug_sections): New static inline function.
1066         (Layout::include_section): Handle --strip-debug-non-line.
1067         (Layout::make_output_section): If --strip-debug-non-line, build
1068         new output sections for .debug_abbrev and .debug_info.
1069         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
1070         gold.  Warn about possible overflow.
1071         (read_signed_LEB_128): Likewise.
1072         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
1073         (read_signed_LEB_128): Declare.
1074         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
1075         (HFILES): Add reduced_debug_output.h.
1076         * Makefile.in: Rebuild.
1077
1078 2008-05-21  Ian Lance Taylor  <iant@google.com>
1079
1080         * mapfile.cc: New file.
1081         * mapfile.h: New file.
1082         * options.h (class General_options): Add -M/--print-map and -Map.
1083         * options.cc (General_options::finalize): Make -M equivalent to
1084         -Map -.
1085         * main.cc: Include <cstdio> and "mapfile.h".
1086         (main): Open mapfile if requested.
1087         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
1088         constructor.  Change caller.
1089         (queue_initial_tasks): Add mapfile parameter.  Change caller.
1090         (queue_middle_tasks): Likewise.
1091         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
1092         declarations.
1093         * archive.cc: Include "mapfile.h".
1094         (Archive::add_symbols): Add mapfile parameter.  Change all
1095         callers.  Pass mapfile, symbol, and reason to include_member.
1096         (Archive::include_all_members): Add mapfile parameter.  Change all
1097         callers.
1098         (Archive::include_member): Add mapfile, sym, and why parameters.
1099         Change all callers.  Report inclusion to map file.
1100         * archive.h: Include "fileread.h".
1101         (class Archive): Update declarations.
1102         (Archive::file): New const method.
1103         (class Add_archive_symbols): Add mapfile_ field.  Update
1104         constructor.  Change all callers.
1105         * readsyms.h (class Read_symbols): Likewise.
1106         (class Finish_group): Likewise.
1107         (class Read_script): Likewise.
1108         * common.cc: Include "mapfile.h".
1109         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
1110         all callers.
1111         (Symbol_table::do_allocate_commons): Likewise.
1112         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
1113         symbol allocation to mapfile.
1114         * common.h (class Allocate_commons_task): Add mapfile_ field.
1115         Update constructor.  Change all callers.
1116         * symtab.h (class Symbol_table): Update declarations.
1117         * layout.cc: Include "mapfile.h".
1118         (Layout_task_runner::run): Print information to mapfile.
1119         (Layout::create_gold_note): Change Output_data_fixed_space to
1120         Output_data_zero_fill.
1121         (Layout::create_build_id): Likewise.
1122         (Layout::print_to_mapfile): New function.
1123         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
1124         constructor.  Change caller.
1125         (class Layout): Declare print_to_mapfile.
1126         * output.cc (Output_section::Input_section::print_to_mapfile): New
1127         function.
1128         (Output_section::add_input_section): If producing a map, always
1129         add to input_sections_ list.
1130         (Output_section::do_print_to_mapfile): New function.
1131         (Output_segment::print_sections_to_mapfile): New function.
1132         (Output_segment::print_section_list_to_mapfile): New function.
1133         * output.h: Include "mapfile.h".
1134         (Output_data::print_to_mapfile): New function.
1135         (Output_data::do_print_to_mapfile): New virtual function.
1136         (Output_segment_headers::do_print_to_mapfile): New function.
1137         (Output_file_header::do_print_to_mapfile): New function.
1138         (Output_data_const::do_print_to_mapfile): New function.
1139         (class Output_data_const_buffer): Add map_name_ field.  Update
1140         constructor.  Change all callers.  Add do_print_to_mapfile
1141         function.
1142         (class Output_data_fixed_space): Likewise.
1143         (class Output_data_space): Likewise.
1144         (class Output_data_zero_fill): New class.
1145         (Output_data_strtab::do_print_to_mapfile): New function.
1146         (Output_data_reloc_base::do_print_to_mapfile): New function.
1147         (Output_relocatable_relocs::do_print_to_mapfile): New function.
1148         (Output_data_group::do_print_to_mapfile): New function.
1149         (Output_data_got::do_print_to_mapfile): New function.
1150         (Output_data_dynamic::do_print_to_mapfile): New function.
1151         (Output_symtab_xindex::do_print_to_mapfile): New function.
1152         (class Output_section): Declare do_print_to_mapflie.  Declare
1153         print_to_mapfile in Input_section.
1154         (class Output_segment): Declare new functions.
1155         * object.h (Sized_relobj::symbol_count): New function.
1156         * script-sections.cc
1157         (Output_section_element_dot_assignment::set_section_addresses):
1158         Change Output_data_fixed_space to Output_data_zero_fill.
1159         (Output_data_expression::do_print_to_mapfile): New function.
1160         * script.cc (read_input_script): Add mapfile parameter.  Change
1161         all callers.
1162         * script.h (read_input_script): Update declaration.
1163         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
1164         (Eh_frame::do_print_to_mapfile): New function.
1165         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
1166         (Output_merge_string::do_print_to_mapfile): New function.
1167         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
1168         function.
1169         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
1170         function.
1171         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
1172         function.
1173         * Makefile.am (CCFILES): Add mapfile.cc.
1174         (HFILES): Add mapfile.h.
1175         * Makefile.in: Rebuild.
1176
1177 2008-05-19  Ian Lance Taylor  <iant@google.com>
1178
1179         * options.h (class General_options): Add -z relro.
1180         * layout.cc (Layout::Layout): Initialize relro_segment_.
1181         (Layout::add_output_section_data): Return the output section.
1182         (Layout::make_output_section): Rcognize relro sections and mark
1183         them appropriately.
1184         (Layout::attach_allocated_section_to_segment): Put relro sections
1185         in a PT_GNU_RELRO segment.
1186         (Layout::create_initial_dynamic_sections): Mark the .dynamic
1187         section as relro.
1188         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
1189         PT_TLS segments.
1190         (Layout::linkonce_mapping): Map d.rel.ro.local to
1191         .data.rel.ro.local.
1192         (Layout::output_section_name): Us .data.rel.ro.local for any
1193         section which begins with that.
1194         * layout.h (class Layout): Update add_output_section_data
1195         declaration.  Add relro_segment_ field.
1196         * output.cc (Output_section::Output_section): Initialize is_relro_
1197         and is_relro_local_ fields.
1198         (Output_segment::add_output_section): Group relro sections.
1199         (Output_segment::is_first_section_relro): New function.
1200         (Output_segment::maximum_alignment): If there is a relro section,
1201         align the segment to the common page size.
1202         (Output_segment::set_section_addresses): Track whether we are
1203         looking at relro sections.  If the last section is a relro
1204         section, align to the common page size.
1205         (Output_segment::set_section_list_addresses): Add in_relro
1206         parameter.  Change all callers.  Align to the page size when
1207         moving from relro to non-relro section.
1208         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
1209         segment.
1210         * output.h (class Output_section): Add is_relro_ and
1211         is_relro_local_ fields.
1212         (Output_section::is_relro): New function.
1213         (Output_section::set_is_relro): New function.
1214         (Output_section::is_relro_local): New function.
1215         (Output_section::set_is_relro_local): New function.
1216         (class Output_segment): Update declarations.
1217         * i386.cc (Target_i386::got_section): Mark .got section as relro.
1218         * sparc.cc (Target_sparc::got_section): Likewise.
1219         * x86_64.cc (Target_x86_64::got_section): Likewise.
1220         * testsuite/relro_test_main.cc: New file.
1221         * testsuite/relro_test.cc: New file.
1222         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
1223         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
1224         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
1225         (relro_test.so, relro_test_pic.o): New targets.
1226         * testsuite/Makefile.in: Rebuild.
1227
1228 2008-05-16  Ian Lance Taylor  <iant@google.com>
1229
1230         * output.cc (Output_segment::add_output_section): Remove front
1231         parameter.
1232         * output.h (class Output_segment): Remove
1233         add_initial_output_section and overloaded add_output_section.
1234         Update declaration of remaining add_output_section.
1235         * layout.cc (Layout::create_interp): Call add_output_section
1236         rather than add_initial_output_section.
1237         (Layout::finish_dynamic_section): Likewise.
1238
1239         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
1240         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
1241         know the dynamic type.
1242         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
1243         field.  Initialize it in constructor.
1244         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
1245         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
1246         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
1247         reloc.
1248
1249         * output.cc (Output_reloc::get_address): Change return type to
1250         Elf_Addr.
1251         * output.h (class Output_reloc): Update get_address declaration.
1252         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
1253         for section addresses.
1254
1255 2008-05-09  Ian Lance Taylor  <iant@google.com>
1256
1257         PR 6493
1258         * gold.cc (gold_nomem): Use return value of write.
1259
1260 2008-05-08  Ian Lance Taylor  <iant@google.com>
1261
1262         * symtab.c (Symbol::init_base_output_data): Add version
1263         parameter.  Change all callers.
1264         (Symbol::init_base_output_segment): Likewise.
1265         (Symbol::init_base_constant): Likewise.
1266         (Symbol::init_base_undefined): Likewise.
1267         (Sized_symbol::init_output_data): Likewise.
1268         (Sized_symbol::init_output_segment): Likewise.
1269         (Sized_symbol::init_constant): Likewise.
1270         (Sized_symbol::init_undefined): Likewise.
1271         (Symbol_table::do_define_in_output_data): If the new symbol has a
1272         version, mark it as the default.
1273         (Symbol_table::do_define_in_output_segment): Likewise.
1274         (Symbol_table::do_define_as_constant): Likewise.
1275         * symtab.h (class Symbol): Update declarations.
1276         (class Sized_symbol): Likewise.
1277         * resolve.cc (Symbol::override_version): New function.
1278         (Symbol::override_base): Call override_version.
1279         (Symbol::override_base_with_special): Likewise.
1280         * testsuite/ver_script_8.script: New file.
1281         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
1282         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
1283         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
1284         (ver_test_8_1.so, ver_test_8_2.so): New targets.
1285
1286 2008-05-06  Ian Lance Taylor  <iant@google.com>
1287
1288         PR 6049
1289         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
1290         functions.
1291         (class General_options): Remove existing --undefined, and add
1292         --no-undefined instead.  Add new --undefined as synonym for -u.
1293         * archive.cc (Archive::add_symbols): Check whether symbol was
1294         named with -u.
1295         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
1296         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
1297         all uses.  Add IS_UNDEFINED.  Update declarations to split
1298         different versions of init_base.  Declare init_base_undefined.
1299         (Symbol::is_defined): Handle IS_UNDEFINED.
1300         (Symbol::is_undefined): Likewise.
1301         (Symbol::is_weak_undefined): Call is_undefined.
1302         (Symbol::is_absolute): Handle IS_CONSTANT.
1303         (class Sized_symbol): Update declarations to split different
1304         versions of init.  Declare init_undefined.
1305         (class Symbol_table): Declare new functions.
1306         * symtab.cc (Symbol::init_base_object): Rename from init_base.
1307         Change all callers.
1308         (Symbol::init_base_output_data): Likewise.
1309         (Symbol::init_base_output_segment): Likewise.
1310         (Symbol::init_base_constant): Likewise.
1311         (Symbol::init_base_undefined): New function.
1312         (Sized_symbol::init_object): Rename from init.  Change all
1313         callers.
1314         (Sized_symbol::init_output_data): Likewise.
1315         (Sized_symbol::init_output_segment): Likewise.
1316         (Sized_symbol::init_constant): Likewise.
1317         (Sized_symbol::init_undefined): New function.
1318         (Symbol_table::add_undefined_symbols_from_command_line): New
1319         function.
1320         (Symbol_table::do_add_undefined_symbols_from_command_line): New
1321         function.
1322         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
1323         (Symbol::output_section): Likewise.
1324         (Symbol::set_output_section): Likewise.
1325         (Symbol_table::sized_finalize_symbol): Likewise.
1326         (Symbol_table::sized_write_globals): Likewise.
1327         * resolve.cc (Symbol_table::should_override): Likewise.
1328         (Symbol::override_base_with_special): Likewise.
1329
1330         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
1331         symbol, change it to have default visibility.
1332         * testsuite/protected_1.cc: New file.
1333         * testsuite/protected_2.cc: New file.
1334         * testsuite/protected_3.cc: New file.
1335         * testsuite/protected_main_1.cc: New file.
1336         * testsuite/protected_main_2.cc: New file.
1337         * testsuite/protected_main_3.cc: New file.
1338         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
1339         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
1340         (protected_1_LDFLAGS, protected_1_LDADD): Define.
1341         (protected_1.so): New target.
1342         (protected_1_pic.o, protected_2_pic.o): New targets.
1343         (protected_3_pic.o): New target.
1344         (check_PROGRAMS): Add protected_2.
1345         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
1346         (protected_2_LDFLAGS, protected_2_LDADD): Define.
1347         * testsuite/Makefile.in: Rebuild.
1348
1349         * options.h (DEFINE_var): Add set_user_set_##varname__.
1350         (DEFINE_bool_alias): New macro.
1351         (class General_options): Define -Bstatic using DEFINE_bool_alias
1352         rather than DEFINE_special.  Add --undefined as an alias for -z
1353         defs.
1354         * options.cc (General_options::parse_Bstatic): Remove.
1355
1356         * options.h (class General_options): Add --fatal-warnings.
1357         * main.cc (main): Implement --fatal-warnings.
1358         * errors.h (Errors::warning_count): New function.
1359
1360         * options.h (class General_options): Add -Bsymbolic-functions.
1361         * symtab.h (Symbol::is_preemptible): Check for
1362         -Bsymbolic-functions.
1363
1364 2008-05-05  Ian Lance Taylor  <iant@google.com>
1365
1366         * options.h (DEFINE_bool): For DASH_Z, create the negative option
1367         as noVARNAME rather than no-VARNAME.
1368         (class General_options): Add option -z combreloc.
1369         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
1370         get_address.
1371         (Output_reloc::sort_before) [SHT_REL]: New function.
1372         (Output_reloc::sort_before) [SHT_RELA]: New function.
1373         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
1374         Sort_relocs_comparison.
1375         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
1376         parameter.  Change all callers.
1377         (Output_data_reloc::Output_data_reloc) [both versions]: Add
1378         sort_relocs parameter.  Change all callers.
1379         * output.cc (Output_reloc::get_address): New function, broken out
1380         of write_rel.
1381         (Output_reloc::write_rel): Call it.
1382         (Output_reloc::compare): New function.
1383         (Output_data_reloc_base::do_write): Optionally sort relocs.
1384
1385         * configure.ac: If targ_extra_obj is set, link it in.
1386         * configure.tgt: Initialize all variables.
1387         (x86_64*): Set targ_extra_obj and targ_extra_size.
1388         * configure: Rebuild.
1389
1390         * object.cc (Sized_relobj::include_section_group): Adjust section
1391         indexes read from group data.  Build vector to pass to
1392         layout_group.
1393         * layout.cc (Layout::layout_group): Add flags and shndxes
1394         parameters.  Remove contents parameter.  Change caller.  Update
1395         explicit instantiations.
1396         * layout.h (class Layout): Update layout_group declaration.
1397         * output.cc (Output_data_group::Output_data_group): Add flags and
1398         input_shndxes parameters.  Remove contents parameter.  Change
1399         caller.
1400         (Output_data_group::do_write): Change input_sections_ to
1401         input_shndxes_.
1402         * output.h (class Output_data_group): Update constructor
1403         declaration.  Rename input_sections_ to input_shndxes_.
1404         * testsuite/many_sections_test.cc: Add template.
1405
1406 2008-04-30  Cary Coutant  <ccoutant@google.com>
1407
1408         * target-reloc.h (relocate_section): Fix dead-pointer bug.
1409
1410         * layout.cc (Layout::include_section): Refactored check for debug
1411         info section.
1412         (Layout::add_comdat): Add new parameters.  Change type
1413         of signature parameter.  Add object and shndx to signatures table.
1414         (Layout::find_kept_object): New function.
1415         * layout.h: Include <cstring>.
1416         (Layout::is_debug_info_section): New function.
1417         (Layout::add_comdat): Add new parameters.
1418         (Layout::find_kept_object): New function.
1419         (Layout::Kept_section): New struct.
1420         (Layout::Signatures): Change type of map range.
1421         * object.cc (Relobj::output_section_address): New function.
1422         (Sized_relobj::include_section_group): Add new parameters.  Change
1423         calls to Layout::add_comdat.  Change to build table of kept comdat
1424         groups and table mapping discarded sections to kept sections.
1425         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
1426         (Sized_relobj::do_layout): Change calls to include_section_group and
1427         include_linkonce_section.
1428         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
1429         value to zero when section is discarded.
1430         (Sized_relobj::map_to_kept_section): New function.
1431         * object.h (Relobj::output_section_address): New function.
1432         (Relobj::Comdat_group): New type.
1433         (Relobj::find_comdat_group): New function.
1434         (Relobj::Comdat_group_table): New type.
1435         (Relobj::Kept_comdat_section): New type.
1436         (Relobj::Kept_comdat_section_table): New type.
1437         (Relobj::add_comdat_group): New function.
1438         (Relobj::set_kept_comdat_section): New function.
1439         (Relobj::get_kept_comdat_section): New function.
1440         (Relobj::comdat_groups_): New field.
1441         (Relobj::kept_comdat_sections_): New field.
1442         (Symbol_value::input_value): Update comment.
1443         (Sized_relobj::map_to_kept_section) New function.
1444         (Sized_relobj::include_linkonce_section): Add new parameter.
1445         * target-reloc.h (Comdat_behavior): New type.
1446         (get_comdat_behavior): New function.
1447         (relocate_section): Add code to map a discarded section to the
1448         corresponding kept section when applying a relocation.
1449
1450 2008-04-30  Craig Silverstein  <csilvers@google.com>
1451
1452         * dwarf_reader.cc (next_generation_count): New static var.
1453         (Addr2line_cache_entry): New struct.
1454         (addr2line_cache): New static var.
1455         (Dwarf_line_info::one_addr2line): Added caching.
1456         (Dwarf_line_info::clear_addr2line_cache): New function.
1457         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
1458         cache-size parameter.
1459         (Dwarf_line_info::one_addr2line_cache): New function.
1460         * symtab.cc (Symbol_table::detect_odr_violations): Pass
1461         new cache-size argument to one_addr2line(), and clear cache.
1462
1463 2008-04-28  Cary Coutant  <ccoutant@google.com>
1464
1465         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
1466         R_386_PC8 relocations.
1467
1468 2008-04-23  Ian Lance Taylor  <iant@google.com>
1469
1470         * object.cc (Sized_relobj::include_section_group): Check for
1471         invalid section group.
1472
1473         * object.cc (make_elf_object): Correct test for 64-bit ELF file
1474         header size.
1475
1476         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
1477         than read for file header.
1478         * archive.cc (Archive::include_member): Likewise.
1479
1480 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
1481
1482         * aclocal.m4: Regenerate.
1483         * configure: Regenerate.
1484
1485 2008-04-19  Ian Lance Taylor  <iant@google.com>
1486
1487         * version.cc (version_string): Bump to 1.6.
1488
1489         * testsuite/Makefile.am (many_sections_r_test): New target.
1490         (many_sections_r_test_SOURCES): Remove.
1491         (many_sections_r_test_DEPENDENCIES): Remove.
1492         (many_sections_r_test_LDFLAGS): Remove.
1493         (many_sections_r_test_LDADD): Remove.
1494
1495         * object.cc (Sized_relobj::do_add_symbols): Always pass
1496         local_symbol_count_ to add_from_relobj.
1497
1498         * testsuite/Makefile.am (many_sections_check.h): Only check one in
1499         every thousand variables.
1500         * testsuite/Makefile.in: Rebuild.
1501
1502         * object.cc (Xindex::initialize_symtab_xindex): New function.
1503         (Xindex::read_symtab_xindex): New function.
1504         (Xindex::sym_xindex_to_shndx): New function.
1505         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
1506         available.
1507         (Sized_relobj::do_initialize_xindex): New function.
1508         (Sized_relobj::do_read_symbols): Adjust section links.
1509         (Sized_relobj::symbol_section_and_value): Add is_ordinary
1510         parameter.  Change all callers.
1511         (Sized_relobj::include_section_group): Adjust section links and
1512         symbol section indexes.
1513         (Sized_relobj::do_layout): Adjust section links.
1514         (Sized_relobj::do_count_local_symbols): Adjust section links and
1515         symbol section indexes.
1516         (Sized_relobj::do_finalize_local_symbols): Distinguish between
1517         ordinary and special symbols.
1518         (Sized_relobj::write_local_symbols): Add symtab_xindex and
1519         dynsym_xindex parameters.  Change all callers.  Adjust section
1520         links.  Use SHN_XINDEX when needed.
1521         (Sized_relobj::get_symbol_location_info): Adjust section links.
1522         Don't get fooled by special symbols.
1523         * object.h (class Xindex): Define.
1524         (class Object): Add xindex_ parameter.  Declare virtual functoin
1525         do_initialize_xindex.
1526         (Object::adjust_sym_shndx): New function.
1527         (Object::set_xindex): New protected function.
1528         (class Symbol_value): Add is_ordinary_shndx_ field.
1529         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
1530         (Symbol_value::value): Assert ordinary section.
1531         (Symbol_value::initialize_input_to_output_map): Likewise.
1532         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
1533         Change all callers.
1534         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
1535         all callers.
1536         (class Sized_relobj): Update declarations.
1537         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
1538         parameter.  Change all callers.
1539         (Sized_relobj::adjust_shndx): New function.
1540         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
1541         field.
1542         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
1543         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
1544         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
1545         (Sized_dynobj::read_dynsym_section): Adjust section links.
1546         (Sized_dynobj::read_dynamic): Likewise.
1547         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
1548         section links.
1549         (Sized_dynobj::do_initialize_xindex): New function.
1550         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
1551         do_initialize_xindex.
1552         (Sized_dynobj::adjust_shndx): New function.
1553         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
1554         dynsym_xindex_ fields.
1555         (Layout::finalize): Add a call to set_section_indexes before
1556         creating the symtab sections.
1557         (Layout::set_section_indexes): Don't do anything if the section
1558         already has a section index.
1559         (Layout::create_symtab_sections): Add shnum parameter.  Change
1560         caller.  Create .symtab_shndx section if needed.
1561         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
1562         caller.
1563         (Layout::allocated_output_section_count): New function.
1564         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
1565         needed.
1566         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
1567         fields.  Update declarations.
1568         (Layout::symtab_xindex): New function.
1569         (Layout::dynsym_xindex): New function.
1570         (class Write_symbols_task): Add layout_ field.
1571         (Write_symbols_task::Write_symbols_task): Add layout parameter.
1572         Change caller.
1573         * output.cc (Output_section_headers::Output_section_headers): Add
1574         shstrtab_section parameter.  Change all callers.
1575         (Output_section_headers::do_sized_write): Store overflow values
1576         for section count and section string table section index in
1577         section header zero.
1578         (Output_file_header::do_sized_write): Check for overflow of
1579         section count and section string table section index.
1580         (Output_symtab_xindex::do_write): New function.
1581         (Output_symtab_xindex::endian_do_write): New function.
1582         * output.h (class Output_section_headers): Add shstrtab_section_.
1583         Update declarations.
1584         (class Output_symtab_xindex): Define.
1585         (Output_section::has_out_shndx): New function.
1586         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
1587         field.
1588         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
1589         Change all callers.
1590         (Sized_symbol::init): Likewise.
1591         (Symbol::output_section): Check for ordinary symbol.
1592         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
1593         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
1594         callers.
1595         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
1596         Change all callers.  Simplify handling of symbols from sections
1597         not included in the link.
1598         (Symbol_table::add_from_dynobj): Handle ordinary symbol
1599         distinction.
1600         (Weak_alias_sorter::operator()): Assert that symbols are
1601         ordinary.
1602         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
1603         distinction.
1604         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
1605         parameters.  Change all callers.
1606         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
1607         symbol distinction.  Use SHN_XINDEX when needed.
1608         (Symbol_table::write_section_symbol): Add symtab_xindex
1609         parameter.  Change all callers.
1610         (Symbol_table::sized_write_section_symbol): Likewise.  Use
1611         SHN_XINDEX when needed.
1612         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
1613         declarations.
1614         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
1615         (Symbol::is_defined): Check is_ordinary.
1616         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
1617         (Symbol::is_absolute, Symbol::is_common): Likewise.
1618         (class Sized_symbol): Update declarations.
1619         (class Symbol_table): Update declarations.
1620         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
1621         parameters.  Change all callers.
1622         (Sized_symbol::override): Likewise.
1623         (Symbol_table::override): Likewise.
1624         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
1625         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
1626         is_ordinary, and orig_st_shndx parameters.  Change all callers.
1627         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
1628         to be in an ordinary section.
1629         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
1630         object and is_ordinary parameters.  Change all callers.
1631         (Sized_dwarf_line_info::read_relocs): Add object parameter.
1632         Change all callers.  Don't add undefined or non-ordinary symbols
1633         to reloc_map_.
1634         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
1635         Change all callers.
1636         * dwarf_reader.h (class Sized_dwarf_line_info): Update
1637         declarations.
1638         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
1639         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
1640         (Sized_relobj::relocate_sections): Likewise.
1641         * target-reloc.h (scan_relocs): Adjust section symbol index.
1642         (scan_relocatable_relocs): Likewise.
1643         * i386.cc (Scan::local): Check for ordinary symbols.
1644         * sparc.cc (Scan::local): Likewise.
1645         * x86_64.cc (Scan::local): Likewise.
1646         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
1647         to symbol_section_and_value.
1648         * testsuite/many_sections_test.cc: New file.
1649         * testsuite/Makefile.am (BUILT_SOURCES): Define.
1650         (check_PROGRAMS): Add many_sections_test.
1651         (many_sections_test_SOURCES): Define.
1652         (many_sections_test_DEPENDENCIES): Define.
1653         (many_sections_test_LDFLAGS): Define.
1654         (BUILT_SOURCES): Add many_sections_define.h.
1655         (many_sections_define.h): New target.
1656         (BUILT_SOURCES): Add many_sections_check.h.
1657         (many_sections_check.h): New target.
1658         (check_PROGRAMS): Add many_sections_r_test.
1659         (many_sections_r_test_SOURCES): Define.
1660         (many_sections_r_test_DEPENDENCIES): Define.
1661         (many_sections_r_test_LDFLAGS): Define.
1662         (many_sections_r_test_LDADD): Define.
1663         (many_sections_r_test.o): New target.
1664         * testsuite/Makefile.in: Rebuild.
1665
1666 2008-04-17  Cary Coutant  <ccoutant@google.com>
1667
1668         * errors.cc (Errors::info): New function.
1669         (gold_info): New function.
1670         * errors.h (Errors::info): New function.
1671         * gold.h (gold_info): New function.
1672         * object.cc (Input_objects::add_object): Print trace output.
1673         * options.cc (options::parse_set): New function.
1674         (General_options::parse_wrap): Deleted.
1675         (General_options::General_options): Deleted initializer.
1676         * options.h (options::String_set): New typedef.
1677         (options::parse_set): New function.
1678         (DEFINE_set): New macro.
1679         (General_options::wrap): Changed to use DEFINE_set. Changed
1680         callers of any_wrap_symbols and is_wrap_symbol.
1681         (General_options::trace, General_options::trace_symbol):
1682         New options.
1683         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
1684         (General_options::wrap_symbols_): Deleted.
1685         * symtab.cc (Symbol_table::add_from_object): Print trace output.
1686
1687 2008-04-17  David S. Miller  <davem@davemloft.net>
1688
1689         * options.cc (General_options::parse_V): New function.
1690         * options.h: Add entries for -V and -Qy.
1691
1692 2008-04-17  Ian Lance Taylor  <iant@google.com>
1693
1694         * common.cc (Symbol_table::allocate_commons): Remove options
1695         parameter.  Change caller.
1696         (Symbol_table::do_allocate_commons): Remove options parameter.
1697         Change caller.  Just call do_allocate_commons_list twice.
1698         (Symbol_table::do_allocate_commons_list): New function, broken out
1699         of do_allocate_commons.
1700         * common.h (class Allocate_commons_task): Remove options_ field.
1701         Update constructor.
1702         * symtab.cc (Symbol_table::Symbol_table): Initialize
1703         tls_commons_.
1704         (Symbol_table::add_from_object): Put TLS common symbols on
1705         tls_commons_ list.
1706         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
1707         which are IN_OUTPUT_DATA.
1708         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
1709         allocate_commons and do_allocate_commons declarations.  Declare
1710         do_allocate_commons_list.
1711         * gold.cc (queue_middle_tasks): Update creation of
1712         Allocate_commons_task to not pass options.
1713         * testsuite/Makefile.am (INCLUDES): Add -I.. .
1714         (TLS_TEST_C_FLAGS): New variable.
1715         (tls_test_c_pic.o): New target.
1716         (tls_test_shared.so): Link in tls_test_c_pic.o.
1717         (tls_test_c_pic_ie.o): New target.
1718         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
1719         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
1720         (tls_test_c.o): New target.
1721         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
1722         (tls_pic_test_LDADD): Likewise.
1723         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
1724         (tls_shared_gd_to_ie_test_LDADD): Likewise.
1725         (tls_test_c_gnu2.o): New target.
1726         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
1727         tls_test_c_gnu2.o.
1728         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
1729         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
1730         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
1731         * testsuite/tls_test.cc: Include "config.h".
1732         (t_last): Call t11_last.
1733         * testsuite/tls_test.h (t11, t11_last): Declare.
1734         * testsuite/tls_test_c.c: New file.
1735         * testsuite/tls_test_main.cc (thread_routine): Call t11.
1736         * configure.ac: Check for OpenMP support.
1737         * configure, config.in, Makefile.in: Rebuild.
1738         * testsuite/Makefile.in: Rebuild.
1739
1740 2008-04-16  Cary Coutant  <ccoutant@google.com>
1741
1742         * i386.cc (Target_i386::define_tls_base_symbol): New function.
1743         (Target_i386::tls_base_symbol_defined_): New field.
1744         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
1745         (Target_i386::Scan::global): Likewise.
1746         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
1747         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
1748         (Target_x86_64::tls_base_symbol_defined_): New field.
1749         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
1750         (Target_x86_64::Scan::global): Likewise.
1751
1752 2008-04-16  Cary Coutant  <ccoutant@google.com>
1753
1754         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
1755         (Symbol::needs_plt_entry): Allow weak undefined symbols.
1756         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
1757         building shared libraries.
1758         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
1759         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
1760         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
1761         * testsuite/Makefile.in: Rebuild.
1762         * testsuite/weak_undef.h: New file.
1763         * testsuite/weak_undef_file1.cc: Add extra test cases.
1764         * testsuite/weak_undef_file2.cc: Likewise.
1765         * testsuite/weak_undef_test.cc: Likewise.
1766
1767 2008-04-16  David S. Miller  <davem@davemloft.net>
1768
1769         * sparc.cc (Target_sparc::Scan): Change from struct to class.
1770         Add issued_non_pic_error_ field.  Declare check_non_pic.
1771         (Target_sparc::Scan::check_non_pic): New function.
1772         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
1773         (Target_sparc::Scan::global): Likewise.
1774
1775         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
1776         * configure: Rebuild.
1777
1778         * options.h (DEFINE_enable): New macro.
1779         (new_dtags): New enable option.
1780         (initfirst, interpose, loadfltr, nodefaultlib,
1781         nodelete, nodlopen, nodump): New -z options.
1782         * layout.cc (Layout:finish_dynamic_section): If new
1783         dtags enabled, emit DT_RUNPATH.  Also, emit a
1784         DT_FLAGS_1 containing any specified -z flags.
1785
1786 2008-04-16  Ian Lance Taylor  <iant@google.com>
1787
1788         * copy-relocs.cc: New file.
1789         * copy-relocs.h: New file.
1790         * reloc.cc: Remove Copy_relocs code.
1791         * reloc.h: Likewise.
1792         * reloc-types.h (struct Reloc_types) [both versions]: Add
1793         get_reloc_addend_noerror.
1794         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
1795         variants of add_global which take an addend which must be zero.
1796         * i386.cc: Include "copy-relocs.h".
1797         (class Target_i386): Change type of copy_relocs_ to variable,
1798         update initializer.
1799         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
1800         Change all callers.
1801         (Target_i386::do_finalize_sections): Change handling of
1802         copy_relocs_.
1803         * sparc.cc: Include "copy-relocs.h".
1804         (class Target_sparc): Change type of copy_relocs_ to variable,
1805         update initializer.
1806         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
1807         Change all callers.
1808         (Target_sparc::do_finalize_sections): Change handling of
1809         copy_relocs_.
1810         * x86_64.cc: Include "copy-relocs.h".
1811         (class Target_x86_64): Change type of copy_relocs_ to variable,
1812         update initializer.
1813         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
1814         class.  Change all callers.
1815         (Target_x86_64::do_finalize_sections): Change handling of
1816         copy_relocs_.
1817         * Makefile.am (CCFILES): Add copy-relocs.cc.
1818         (HFILES): Add copy-relocs.h.
1819
1820         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
1821
1822         * testsuite/script_test_4.sh: Permit leading zeroes.
1823
1824 2008-04-15  Ian Lance Taylor  <iant@google.com>
1825
1826         * script-sections.cc (Script_sections::create_segments): Use
1827         header_size_adjustment even when there is enough room for the
1828         headers.
1829         * testsuite/script_test_4.sh: New file.
1830         * testsuite/script_test_4.t: New file.
1831         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
1832         (check_DATA): Add script_test_4.stdout.
1833         (MOSTLYCLEANFILES): Likewise.
1834         (script_test_4): New target.
1835         (script_test_4.stdout): New target.
1836         * testsuite/Makefile.in: Rebuild.
1837
1838         * sparc.cc: Add definitions for Output_data_plt_sparc class
1839         constants.
1840
1841 2008-04-14  David S. Miller  <davem@davemloft.net>
1842
1843         * sparc.cc: New file.
1844         * Makefile.am (TARGETSOURCES): Add sparc.cc
1845         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
1846         * configure.tgt: Document targ_extra_size and
1847         targ_extra_big_endian.  Add entries for sparc-* and
1848         sparc64-*.
1849         * configure.ac: Handle targ_extra_size and
1850         targ_extra_big_endian.
1851         * Makefile.in: Rebuild.
1852         * configure: Likewise.
1853         * po/POTFILES.in: Likewise.
1854         * po/gold.pot: Likewise.
1855
1856 2008-04-14  Ian Lance Taylor  <iant@google.com>
1857
1858         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
1859         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
1860         in the name/type/flags to section mapping.  Don't call
1861         allocate_output_section.
1862         (Layout::choose_output_section): Change parameter from adjust_name
1863         to is_input_section.  Don't permit input sections after sections
1864         are attached to segments.  Don't call allocate_output_section.
1865         (Layout::layout_eh_frame): Call update_flags_for_input_section,
1866         not write_enable_output_section.
1867         (Layout::make_output_section): Don't push to
1868         unattached_section_list_ nor call attach_to_segment.  Call
1869         attach_section_to_segment if sections are attached.
1870         (Layout::attach_sections_to_segments): New function.
1871         (Layout::attach_section_to_segment): New function.
1872         (Layout::attach_allocated_section_to_segment): Rename from
1873         attach_to_segment.  Remove flags parameter.
1874         (Layout::allocate_output_section): Remove function.
1875         (Layout::write_enable_output_section): Remove function.
1876         * layout.h (class Layout): Update for above changes.  Add new
1877         field sections_are_attached_.
1878         * output.h (Output_section::update_flags_for_input_section): New
1879         function.
1880         * output.cc (Output_section::add_input_section): Call
1881         update_flags_for_input_section.
1882         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
1883
1884 2008-04-11  Cary Coutant  <ccoutant@google.com>
1885
1886         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
1887         thought unnecessary.
1888         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
1889
1890 2008-04-11  Ian Lance Taylor  <iant@google.com>
1891
1892         * output.h (class Output_section_data): Remove inline definition
1893         of set_addralign.
1894         * output.cc (Output_section_data::set_addralign): New function.
1895
1896 2008-04-11  Cary Coutant  <ccoutant@google.com>
1897
1898         Add support for TLS descriptors for i386 and x86_64.
1899         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
1900         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
1901         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
1902         GOT_TYPE_TLS_DESC.
1903         (Target_i386::got_mod_index_entry): Remove unnecessary code.
1904         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
1905         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
1906         relocations.
1907         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
1908         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
1909         Fix problem with initial-exec relocations.
1910         (Target_i386::Relocate::relocate_tls): Likewise.
1911         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
1912         relaxation.
1913         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
1914         support for section-plus-offset dynamic table entries.
1915         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
1916         (Output_data_dynamic::Dynamic_entry): Add support for
1917         section-plus-offset dynamic table entries.
1918         (Output_data_dynamic::Classification): Likewise.
1919         (Output_data_dynamic::classification_): Renamed offset_.
1920         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
1921         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
1922         (Target_x86_64::make_plt_section): New function.
1923         (Target_x86_64::reserve_tlsdesc_entries): New function.
1924         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
1925         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
1926         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
1927         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
1928         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
1929         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
1930         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
1931         add extra PLT entry for TLS descriptors.
1932         (Output_data_plt_x86_64::got_): New field.
1933         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
1934         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
1935         fields.
1936         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
1937         descriptors.
1938         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
1939         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
1940         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
1941         R_386_TLS_DESC_CALL relocations.
1942         (Target_x86_64::Scan::global): Likewise.
1943         (Target_x86_64::do_finalize_sections): Add dynamic table entries
1944         for TLS descriptors.
1945         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
1946         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
1947         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
1948         GD-to-IE relaxation.
1949         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
1950         and TLS_DESCRIPTORS.
1951         * Makefile.in: Rebuild.
1952         * configure: Rebuild.
1953         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
1954         (tls_test_shared2.so): New target.
1955         (tls_shared_gd_to_ie_test_SOURCES): New variable.
1956         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
1957         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
1958         (tls_shared_gd_to_ie_test_LDADD): New variable.
1959         (tls_shared_gnu2_gd_to_ie_test): New target.
1960         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
1961         New targets.
1962         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
1963         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
1964         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
1965         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
1966         (tls_shared_gnu2_test): New target.
1967         (tls_test_gnu2_shared.so): New target.
1968         (tls_shared_gnu2_test_SOURCES): New variable.
1969         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
1970         (tls_shared_gnu2_test_LDFLAGS): New variable.
1971         (tls_shared_gnu2_test_LDADD): New variable.
1972         * testsuite/Makefile.in: Rebuild.
1973         * testsuite/Makefile.
1974
1975 2008-04-11  Ian Lance Taylor  <iant@google.com>
1976
1977         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
1978         justsyms.t.
1979         * testsuite/Makefile.in: Rebuild.
1980
1981         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
1982         long.
1983         * testsuite/script_test_2.cc (main): Adjust test.
1984
1985 2008-04-11  David S. Miller  <davem@davemloft.net>
1986             Ian Lance Taylor  <iant@google.com>
1987
1988         * options.h (General_options): Add entries for '-Y' and
1989         '-relax'.
1990         * options.cc (General_options:finalize): If -Y was used, add those
1991         entries to the library path instead of the default "/lib" and
1992         "/usr/lib".
1993
1994 2008-04-11  David S. Miller  <davem@davemloft.net>
1995
1996         * testsuite/justsyms.t: Start at 0x100.
1997         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
1998         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
1999         long.
2000         * testsuite/script_test_2.cc: Adjust string and section length
2001         checks.
2002
2003 2008-04-09  Ian Lance Taylor  <iant@google.com>
2004
2005         PR gold/5996
2006         * script-sections.cc (Sections_element::allocate_to_segment): Add
2007         orphan parameter.
2008         (Output_section_definition::allocate_to_segment): Likewise.
2009         (Orphan_output_section::allocate_to_segment): Likewise.
2010         (Script_sections::attach_sections_using_phdrs_clause): Don't
2011         propagate non-PT_LOAD segments to orphan sections.
2012         * testsuite/Makefile.am (script_test_3.stdout): Generate using
2013         readelf rather than objdump.
2014         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
2015         .interp section and PT_INTERP segment are the same size.
2016         * testsuite/Makefile.in: Rebuild.
2017
2018         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
2019         aliases for symbols defined in the same object.
2020         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
2021         (weak_alias_test_SOURCES): New variable.
2022         (weak_alias_test_DEPENDENCIES): New variable.
2023         (weak_alias_test_LDFLAGS): New variable.
2024         (weak_alias_test_LDADD): New variable.
2025         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
2026         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
2027         (weak_alias_test_3.o): New target.
2028         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
2029         * testsuite/weak_alias_test_main.cc: New file.
2030         * testsuite/weak_alias_test_1.cc: New file.
2031         * testsuite/weak_alias_test_2.cc: New file.
2032         * testsuite/weak_alias_test_3.cc: New file.
2033
2034 2008-04-08  Ian Lance Taylor  <iant@google.com>
2035
2036         * options.h (class General_options): Add --noinhibit-exec option.
2037         * main.cc (main): Check --noinhibit-exec.
2038
2039         * options.h (class General_options): Define --wrap as a special
2040         option.  Add wrap_symbols_ field.
2041         (General_options::any_wrap_symbols): New function.
2042         (General_options::is_wrap_symbol): New function.
2043         * options.cc (General_options::parse_wrap): New function.
2044         (General_options::General_options): Initialize wrap_symbols_.
2045         * symtab.cc (Symbol_table::wrap_symbol): New function.
2046         (Symbol_table::add_from_object): Handle --wrap.
2047         * symtab.h (class Symbol_table): Declare wrap_symbol.
2048         * target.h (Target::wrap_char): New function.
2049         (Target::Target_info): Add wrap_char field.
2050         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
2051         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2052         * testsuite/testfile.cc (Target_test::test_target_info):
2053         Likewise.
2054
2055         * errors.cc (Errors::undefined_symbol): Mention symbol version if
2056         there is one.
2057
2058         * layout.h (class Layout): Add added_eh_frame_data_ field.
2059         * layout.cc (Layout::Layout): Initialize new field.
2060         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
2061         output section until we find a section we merged successfully.
2062         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
2063         that the size be non-zero.
2064
2065         * merge.cc (Object_merge_map::get_output_offset): Remove inline
2066         qualifier.
2067
2068 2008-04-08  Craig Silverstein  <csilvers@google.com>
2069
2070         * configure.ac: Export new conditional variable HAVE_ZLIB.
2071         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
2072         on HAVE_ZLIB.
2073         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
2074         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
2075
2076 2008-04-07  Ian Lance Taylor  <iant@google.com>
2077
2078         * version.cc (version_string): Set to "1.5".
2079
2080         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
2081         Add issued_non_pic_error_ field.  Declare check_non_pic.
2082         (Target_x86_64::Scan::check_non_pic): New function.
2083         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
2084         (Target_x86_64::Scan::global): Likewise.
2085
2086         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
2087         addend parameter.  Change caller.  Handle merge sections.
2088         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
2089         Address to Addend.  Don't add in the result of
2090         local_section_offset, pass down the addend and use the returned
2091         value.
2092         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
2093         Update declarations of local_section_offset and symbol_value.
2094         * testsuite/two_file_test_1.cc (t18): New function.
2095         * testsuite/two_file_test_2.cc (f18): New function.
2096         * testsuite/two_file_test_main.cc (main): Call t18.
2097         * testsuite/two_file_test.h (t18, f18): Declare.
2098
2099         * configure.ac: Don't test for objdump, c++filt, or readelf.
2100         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
2101         conditionals.
2102         (TEST_READELF): New variable.
2103         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
2104         (check_PROGRAMS): Add two_file_strip_test.
2105         (two_file_strip_test): New target.
2106         (check_PROGRAMS): Add two_file_same_shared_strip_test.
2107         (two_file_same_shared_strip_test_SOURCES): New variable.
2108         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
2109         (two_file_same_shared_strip_test_LDFLAGS): New variable.
2110         (two_file_same_shared_strip_test_LDADD): New variable.
2111         (two_file_shared_strip.so): New target.
2112         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
2113         (ver_test_5.syms, ver_test_7.syms): Likewise.
2114         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
2115         (strip_test_3.stdout): Use TEST_OBJDUMP.
2116         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
2117
2118 2008-04-04  Cary Coutant  <ccoutant@google.com>
2119
2120         * symtab.h (Symbol::is_weak_undefined): New function.
2121         (Symbol::is_strong_undefined): New function.
2122         (Symbol::is_absolute): New function.
2123         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
2124         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
2125         absolute symbols.
2126         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
2127         (weak_undef_test): New target.
2128         * testsuite/Makefile.in: Rebuild.
2129         * testsuite/weak_undef_file1.cc: New file.
2130         * testsuite/weak_undef_file2.cc: New file.
2131         * testsuite/weak_undef_test.cc: New file.
2132
2133 2008-04-03  Craig Silverstein  <csilvers@google.com>
2134
2135         * compressed_output.h (class Output_compressed_section): Use
2136         unsigned buffer.
2137         * compressed_output.cc (zlib_compress): Use unsigned buffers,
2138         add zlib header.
2139         (zlib_compressed_suffix): Removed.
2140         (Output_compressed_section::set_final_data_size): Use unsigned
2141         buffers.
2142         * testsuite/Makefile.am (flagstest_compress_debug_sections):
2143         Fix linker invocation.
2144         (flagstest_o_specialfile_and_compress_debug_sections):
2145         Likewise.
2146         * testsuite/Makefile.in: Regenerated.
2147
2148 2008-04-02  David S. Miller  <davem@davemloft.net>
2149
2150         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
2151         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
2152
2153 2008-04-02  Craig Silverstein  <csilvers@google.com>
2154
2155         * TODO: New file.
2156
2157 2008-04-02  Ian Lance Taylor  <iant@google.com>
2158
2159         * fileread.cc (File_read::find_view): Add byteshift and vshifted
2160         parameters.  Update for new key type to views_.  Change all
2161         callers.
2162         (File_read::read): Adjust for byteshift in returned view.
2163         (File_read::add_view): New function, broken out of
2164         find_and_make_view.
2165         (File_read::make_view): New function, broken out of
2166         find_and_make_view.
2167         (File_read::find_or_make_view): Add offset and aligned
2168         parameters.  Rewrite accordingly.  Change all callers.
2169         (File_read::get_view): Add offset and aligned parameters.  Adjust
2170         for byteshift in return value.
2171         (File_read::get_lasting_view): Likewise.
2172         * fileread.h (class File_read): Update declarations.
2173         (class File_read::View): Add byteshift_ field.  Add byteshift to
2174         constructor.  Add byteshift method.
2175         * archive.h (Archive::clear_uncached_views): New function.
2176         (Archive::get_view): Add aligned parameter.  Change all callers.
2177         * object.h (Object::get_view): Add aligned parameter.  Change all
2178         callers.
2179         (Object::get_lasting_view): Likewise.
2180
2181         * fileread.cc (File_read::release): Don't call clear_views if
2182         there are multiple objects.
2183         * fileread.h (File_read::clear_uncached_views): New function.
2184         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
2185         on the archive.
2186
2187 2008-03-31  Cary Coutant  <ccoutant@google.com>
2188
2189         Add thin archive support.
2190         * archive.cc (Archive::armagt): New const.
2191         (Archive::setup): Remove task parameter and calls to unlock.
2192         (Archive::unlock_nested_archives): New function.
2193         (Archive::read_header): Add nested_off parameter. Change
2194         all callers.
2195         (Archive::interpret_header): Likewise.
2196         (Archive::include_all_members): Change to handle thin
2197         archives.
2198         (Archive::include_member): Likewise.
2199         * archive.h (Archive::Archive): Add new parameters and
2200         initializers.
2201         (Archive::armagt): New const.
2202         (Archive::setup): Remove task parameter.
2203         (Archive::unlock_nested_archives): New function.
2204         (Archive::read_header): Add nested_off parameter.
2205         (Archive::interpret_header): Likewise.
2206         (Archive::Nested_archive_table): New typedef.
2207         (Archive::is_thin_archive_): New field.
2208         (Archive::nested_archives_): New field.
2209         (Archive::options_): New field.
2210         (Archive::dirpath_): New field.
2211         (Archive::task_): New field.
2212         * readsyms.cc (Read_symbols::do_read_symbols): Add check
2213         for thin archives.  Pass additional parameters to
2214         Archive::Archive.  Unlock the archive file after calling
2215         Archive::setup.
2216
2217 2008-03-29  Ian Lance Taylor  <iant@google.com>
2218
2219         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
2220         version symbol to be local.
2221         * testsuite/ver_test_4.sh: New file.
2222         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
2223         (check_DATA): Add ver_test_4.syms.
2224         (ver_test_4.syms): New target.
2225         * testsuite/Makefile.in: Rebuild.
2226
2227         * output.cc
2228         (Output_section::Input_section_sort_entry::has_priority): New
2229         function.
2230         (Output_section::Input_section_sort_entry::match_file_name): New
2231         function.
2232         (Output_section::Input_section_sort_entry::match_section_name):
2233         Remove.
2234         (Output_section::Input_section_sort_entry::match_section_name_prefix):
2235         Remove.
2236         (Output_section::Input_section_sort_entry::match_section_file):
2237         Remove.
2238         (Output_section::Input_section_sort_compare::operator()): Rewrite
2239         using new Input_section_sort_entry functions.  Sort crtbegin and
2240         crtend first.  Sort sections with no priority before sections with
2241         a priority.
2242         * testsuite/initpri1.c (d3): Check j != 4.
2243         (cd5): New constructor/destructor function.
2244         (main): Check j != 2.
2245
2246         * symtab.cc (Symbol_table::add_from_object): If we don't use the
2247         new symbol when resolving, don't call set_is_default.
2248         * testsuite/ver_test_7.cc: New file.
2249         * testsuite/ver_test_7.sh: New file.
2250         * testsuite/Makefile.am (ver_test_7.so): New target.
2251         (ver_test_7.o): New target.
2252         (check_SCRIPTS): Add ver_test_7.sh.
2253         (check_DATA): Add ver_test_7.syms.
2254         (ver_test_7.syms): New target.
2255
2256 2008-03-28  Ian Lance Taylor  <iant@google.com>
2257
2258         * layout.cc (Layout::layout): If we see an input section with a
2259         name that needs sorting, set the must_sort flag for the output
2260         section.
2261         (Layout::make_output_section): If the name of the output section
2262         indicates that it might require sorting, set the may_sort flag.
2263         * output.h (Output_section::may_sort_attached_input_sections): New
2264         function.
2265         (Output_section::set_may_sort_attached_input_sections): New
2266         function.
2267         (Output_section::must_sort_attached_input_sections): New
2268         function.
2269         (Output_section::set_must_sort_attached_input_sections): New
2270         function.
2271         (class Output_section): Declare Input_section_sort_entry.  Define
2272         Input_section_sort_compare.  Declare
2273         sort_attached_input_sections.  Add new fields:
2274         may_sort_attached_input_sections_,
2275         must_sort_attached_input_sections_,
2276         attached_input_sections_are_sorted_.
2277         * output.cc (Output_section::Output_section): Initialize new
2278         fields.
2279         (Output_section::add_input_section): Add an entry to
2280         input_sections_ if may_sort or must_sort are true.
2281         (Output_section::set_final_data_size): Call
2282         sort_attached_input_sections if necessary.
2283         (Output_section::Input_section_sort_entry): Define new class.
2284         (Output_section::Input_section_sort_compare::operator()): New
2285         function.
2286         (Output_section::sort_attached_input_sections): New function.
2287         * configure.ac: Check whether the compiler supports constructor
2288         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
2289         * testsuite/initpri1.c: New file.
2290         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
2291         CONSTRUCTOR_PRIORITY.
2292         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
2293         (initpri1_LDFLAGS): New variable.
2294         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
2295
2296 2008-03-27  Ian Lance Taylor  <iant@google.com>
2297
2298         * common.cc (Sort_commons::operator): Correct sorting algorithm.
2299         * testsuite/common_test_1.c: New file.
2300         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
2301         (common_test_1_SOURCES): New variable.
2302         (common_test_1_DEPENDENCIES): New variable.
2303         (common_test_1_LDFLAGS): New variable.
2304
2305         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
2306         and commons_ correctly when NAME/VERSION does not override
2307         NAME/NULL.
2308         * testsuite/ver_test_6.c: New file.
2309         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
2310         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
2311         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
2312
2313 2008-03-26  Ian Lance Taylor  <iant@google.com>
2314
2315         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
2316         of an undefined symbol from a version script.
2317         * testsuite/Makefile.am (ver_test_5.so): New target.
2318         (ver_test_5.o): New target.
2319         (check_SCRIPTS): Add ver_test_5.sh.
2320         (check_DATA): Add ver_test_5.syms.
2321         (ver_test_5.syms): New target.
2322         * testsuite/ver_test_5.cc: New file.
2323         * testsuite/ver_test_5.script: New file.
2324         * testsuite/ver_test_5.sh: New file.
2325         * Makefile.in, testsuite/Makefile.in: Rebuild.
2326
2327         PR gold/5986
2328         Fix problems building gold with gcc 4.3.0.
2329         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
2330         (gold_error_at_location, gold_warning_at_location): Use it.
2331         * configure.ac: Check whether we can compile and use a template
2332         function with a printf attribute.
2333         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
2334         when jumping over bytes.
2335         * object.cc: Instantiate Object::read_section_data.
2336         * debug.h: Include <cstring>
2337         * dwarf_reader.cc: Include <algorithm>
2338         * main.cc: Include <cstring>.
2339         * options.cc: Include <cstring>.
2340         * output.cc: Include <cstring>.
2341         * script.cc: Include <cstring>.
2342         * script.h: Include <string>.
2343         * symtab.cc: Include <cstring> and <algorithm>.
2344         * target-select.cc: Include <cstring>.
2345         * version.cc: Include <string>.
2346         * testsuite/testmain.cc: Include <cstdlib>.
2347         * configure, config.in: Rebuild.
2348
2349 2008-03-25  Ian Lance Taylor  <iant@google.com>
2350
2351         * options.cc: Include "../bfd/bfdver.h".
2352         (options::help): Print bug reporting address.
2353
2354         * version.cc (print_version): Adjust output for current value of
2355         BFD_VERSION_STRING.
2356
2357         * NEWS: New file.
2358
2359         * options.cc (options::help): Print list of supported targets.
2360         * target-select.h: Include <vector>.
2361         (class Target_selector): Make machine_, size_, and is_big_endian_
2362         fields const.  Add bfd_name_ and instantiated_target_ fields.
2363         (Target_selector::Target_selector): Add bfd_name parameter.
2364         (Target_selector::recognize): Make non-virtual, call
2365         do_recognize.
2366         (Target_selector::recognize_by_name): Make non-virtual, call
2367         do_recognize_by_name.
2368         (Target_selector::supported_names): New function.
2369         (Target_selector::bfd_name): New function.
2370         (Target_selector::do_instantiate_target): New pure virtual
2371         function.
2372         (Target_selector::do_recognize): New virtual function.
2373         (Target_selector::do_recognize_by_name): New virtual function.
2374         (Target_selector::instantiate_target): New private function.
2375         (supported_target_names): Declare.
2376         * target-select.cc (Target_selector::Target_selector): Update for
2377         new parameter and fields.
2378         (select_target_by_name): Check that the name matches before
2379         calling recognize_by_name.
2380         (supported_target_names): New function.
2381         * i386.cc (class Target_selector_i386): Update Target_selector
2382         constructor call.  Remove recognize and recognize_by_name.  Add
2383         do_instantiate_target.
2384         * x86_64.cc (class Target_selector_x86_64): Likewise.
2385         * testsuite/testfile.cc (class Target_selector_test): Update for
2386         changes to Target_selector.
2387
2388         * README: Rewrite, with some notes on unsupported features.
2389
2390 2008-03-24  Cary Coutant  <ccoutant@google.com>
2391
2392         * i386.cc (Target_i386::Got_type): New enum declaration.
2393         (Target_i386::Scan::local): Updated callers of Output_data_got
2394         member functions.
2395         (Target_i386::Scan::global): Likewise.
2396         (Target_i386::Relocate::relocate): Likewise.
2397         (Target_i386::Relocate::relocate_tls): Likewise.
2398         * object.h (Got_offset_list): New class.
2399         (Sized_relobj::local_has_got_offset): Added got_type parameter.
2400         (Sized_relobj::local_got_offset): Likewise.
2401         (Sized_relobj::set_local_got_offset): Likewise.
2402         (Sized_relobj::local_has_tls_got_offset): Removed.
2403         (Sized_relobj::local_tls_got_offset): Removed.
2404         (Sized_relobj::set_local_tls_got_offset): Removed.
2405         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
2406         * output.cc (Output_data_got::add_global): Added got_type parameter.
2407         (Output_data_got::add_global_with_rel): Likewise.
2408         (Output_data_got::add_global_with_rela): Likewise.
2409         (Output_data_got::add_global_pair_with_rel): New function.
2410         (Output_data_got::add_global_pair_with_rela): New function.
2411         (Output_data_got::add_local): Added got_type parameter.
2412         (Output_data_got::add_local_with_rel): Likewise.
2413         (Output_data_got::add_local_with_rela): Likewise.
2414         (Output_data_got::add_local_pair_with_rel): New function.
2415         (Output_data_got::add_local_pair_with_rela): New function.
2416         (Output_data_got::add_global_tls): Removed.
2417         (Output_data_got::add_global_tls_with_rel): Removed.
2418         (Output_data_got::add_global_tls_with_rela): Removed.
2419         (Output_data_got::add_local_tls): Removed.
2420         (Output_data_got::add_local_tls_with_rel): Removed.
2421         (Output_data_got::add_local_tls_with_rela): Removed.
2422         * output.h (Output_data_got::add_global): Added got_type parameter.
2423         (Output_data_got::add_global_with_rel): Likewise.
2424         (Output_data_got::add_global_with_rela): Likewise.
2425         (Output_data_got::add_global_pair_with_rel): New function.
2426         (Output_data_got::add_global_pair_with_rela): New function.
2427         (Output_data_got::add_local): Added got_type parameter.
2428         (Output_data_got::add_local_with_rel): Likewise.
2429         (Output_data_got::add_local_with_rela): Likewise.
2430         (Output_data_got::add_local_pair_with_rel): New function.
2431         (Output_data_got::add_local_pair_with_rela): New function.
2432         (Output_data_got::add_global_tls): Removed.
2433         (Output_data_got::add_global_tls_with_rel): Removed.
2434         (Output_data_got::add_global_tls_with_rela): Removed.
2435         (Output_data_got::add_local_tls): Removed.
2436         (Output_data_got::add_local_tls_with_rel): Removed.
2437         (Output_data_got::add_local_tls_with_rela): Removed.
2438         * resolve.cc (Symbol::override_base_with_special): Removed
2439         reference to has_got_offset_ field.
2440         * symtab.cc (Symbol::init_fields): Replaced initialization
2441         of got_offset_ with got_offsets_.  Removed initialization
2442         of has_got_offset_
2443         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
2444         (Symbol::got_offset): Likewise.
2445         (Symbol::set_got_offset): Likewise.
2446         (Symbol::has_tls_got_offset): Removed.
2447         (Symbol::tls_got_offset): Removed.
2448         (Symbol::set_tls_got_offset): Removed.
2449         (Symbol::got_offset_): Removed.
2450         (Symbol::tls_mod_got_offset_): Removed.
2451         (Symbol::tls_pair_got_offset_): Removed.
2452         (Symbol::got_offsets_): New field.
2453         (Symbol::has_got_offset): Removed.
2454         (Symbol::has_tls_mod_got_offset): Removed.
2455         (Symbol::has_tls_pair_got_offset): Removed.
2456         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
2457         (Target_x86_64::Scan::local): Updated callers of Output_data_got
2458         member functions.
2459         (Target_x86_64::Scan::global): Likewise.
2460         (Target_x86_64::Relocate::relocate): Likewise.
2461         (Target_x86_64::Relocate::relocate_tls): Likewise.
2462
2463 2008-03-25  Ben Elliston  <bje@au.ibm.com>
2464
2465         * yyscript.y: Fix spelling error in comment.
2466
2467 2008-03-24  Ian Lance Taylor  <iant@google.com>
2468
2469         * options.h (class General_options): Define build_id option.
2470         * layout.h (class Layout): Declare write_build_id, create_note,
2471         create_build_id.  Add build_id_note_ member.
2472         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
2473         "libiberty.h", "md5.h", "sha1.h".
2474         (Layout::Layout): Initialize eh_frame_data_,
2475         eh_frame_hdr_section_, and build_id_note_.
2476         (Layout::finalize): Call create_build_id.
2477         (Layout::create_note): New function, broken out of
2478         Layout::create_gold_note.
2479         (Layout::create_gold_note): Call create_note.
2480         (Layout::create_build_id): New function.
2481         (Layout::write_build_id): New function.
2482         (Close_task_runner::run): Call write_build_id.
2483
2484         * x86_64.cc: Correct license to GPLv3.
2485
2486 2008-03-23  Ian Lance Taylor  <iant@google.com>
2487
2488         * options.cc: Include "demangle.h".
2489         (parse_optional_string): New function.
2490         (parse_long_option): Handle takes_optional_argument.
2491         (parse_short_option): Update dash_z initializer.  Handle
2492         takes_optional_argument.
2493         (General_options::General_options): Initialize do_demangle_.
2494         (General_options::finalize): Set do_demangle_.  Handle demangling
2495         style.
2496         * options.h (parse_optional_string): Declare.
2497         (struct One_option): Add optional_arg field.  Update constructor.
2498         Update call constructor calls.  Add takes_optional_argument
2499         function.
2500         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
2501         (DEFINE_optional_string): Define.
2502         (General_options::demangle): Change from DEFINE_bool to
2503         DEFINE_optional_string.
2504         (General_options::no_demangle): New function.
2505         (General_options::do_demangle): New function.
2506         (General_options::set_do_demangle): New function.
2507         (General_options::execstack_status_): Move definition to end of
2508         class definition.
2509         (General_options::static_): Likewise.
2510         (General_options::do_demangle_): New field.
2511         * object.cc (big_endian>::get_symbol_location_info): Call
2512         Options::do_demangle, not Options::demangle.
2513         * symtab.cc (demangle): Likewise.
2514
2515 2008-03-22  Ian Lance Taylor  <iant@google.com>
2516
2517         * gold.h: Include <cstddef> and <sys/types.h>
2518         * options.h: Include <cstring>.
2519
2520 2008-03-21  Ian Lance Taylor  <iant@google.com>
2521
2522         * Added source code to GNU binutils.