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