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