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