* gold.h (Incremental_argument_list): Remove (invalid) forward
[deliverable/binutils-gdb.git] / gold / ChangeLog
CommitLineData
072fe7ce
ILT
12009-05-15 Mikolaj Zalewski <mikolajz@google.com>
2
3 * gold.h (Incremental_argument_list): Remove (invalid) forward
4 declaration.
5 * incremental.cc (Incremental_inputs::report_achive): New method.
6 (Incremental_inputs::report_object): New method.
7 (Incremental_inputs::report_script): New method.
8 (Incremental_inputs::finalize_inputs): New method.
9 (Incremental_inputs::finalize): Call finalize_inputs().
10 (Incremental_inputs::sized_create_incremental_inputs_section_data):
11 Create inputs entries.
12 * incremental.h (Incremental_input_type): New enum.
13 (Incremental_inputs::Incremental_input): Initialize new fields.
14 (Incremental_inputs::report_inputs): New method.
15 (Incremental_inputs::report_achive): New method.
16 (Incremental_inputs::report_object): New method.
17 (Incremental_inputs::report_script): New method.
18 (Incremental_inputs::finalize_inputs): New method.
19 (Incremental_inputs::Input_info): New struct.
20 (Incremental_inputs::Input_info_map): New typedef.
21 (Incremental_inputs::lock_): New field.
22 (Incremental_inputs::Inputs_): New field.
23 (Incremental_inputs::Inputs_map): New field.
24 * main.cc (main): Call Incremental_input::report_inputs.
25 * options.h (Input_argument_list): Typedef moved from
26 Input_arguments.
27 (Input_file_group::Files): Remove, use ::Input_argument_list.
28 (Input_file_group::Input_argument_list): Remove, use
29 ::Input_argument_list.
30 * plugin.cc (Plugin_manager::add_input_file): Add error in
31 incremental build.
32 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
33 functions.
34 * script.cc (read_input_script): Call
35 Incremental_input::report_script.
36 * script.h (Script_info): New class.
37
b0481b0b
ILT
382009-04-27 Ian Lance Taylor <iant@google.com>
39
40 * x86_64.cc (do_adjust_output_section): Set entsize to
41 plt_entry_size.
42
b22a5a41 432009-04-23 Elliott Hughes <enh@google.com>
6d1e3092
CD
44
45 * output.cc (Output_file::close): After short writes, continue
46 writing from the correct offset in the buffer being written.
47
40fde488
CD
482009-04-23 Chris Demetriou <cgd@google.com>
49
50 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
51 * configure: Regenerate.
52 * config.in: Regenerate.
53 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
54 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
55
3ce2c28e
ILT
562009-04-21 Mikolaj Zalewski <mikolajz@google.com>
57
58 * incremental.cc (Incremental_inputs_header_data): Renamed from
59 Incremental_input_header_data.
60 (Incremental_inputs_header_data::data_size): New field.
61 (Incremental_inputs_header_data::put_input_file_count): Renamed
62 from input_file_count.
63 (Incremental_inputs_header_data::put_command_line_offset): Renamed
64 from command_line_offset.
65 (Incremental_inputs_header_data::put_reserved): Renamed from
66 put_reserved.
67 (Incremental_inputs_entry_data): Renamed from
68 Incremental_input_entry_data.
69 (Incremental_inputs_entry_data::data_size): New field.
70 (Incremental_inputs::report_command_line): New method.
71 (Incremental_inputs::finalize): New method.
72 (Incremental_inputs::create_incremental_inputs_data): New method.
73 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
74 * incremental.h: New file.
75 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
76 (Layout::finalize): Create incremental inputs section in
77 incremental builds.
78 (Layout::create_incremental_info_sections): New method.
79 * layout.h (Layout::incremental_inputs): New method.
80 (Layout::create_incremental_info_sections): New method.
81 (Layout::incremental_inputs_): New field.
82 * main.cc (main): Notify Incremental_input of the command line.
83
e55bde5e
ILT
842009-04-01 Ian Lance Taylor <iant@google.com>
85 Mikolaj Zalewski <mikolajz@google.com>
86
87 * gold.h (reserve_unordered_map): Define, three versions, one for
88 each version of Unordered_map.
89 * layout.cc (Layout::Layout): Remove options parameter. Add
90 number_of_input_files parameter. Don't initialize options_.
91 Initialize number_of_input_files_ and resized_signatures_. Move
92 sections_are_attached_.
93 (Layout::layout_group): Reserve space for group_signatures_.
94 (Layout::find_or_add_kept_section): Change name parameter to be a
95 reference. Resize signatures_ map when it gets large enough.
96 (Layout::layout_eh_frame): Use parameters->options() instead of
97 this->options_.
98 (Layout::make_output_section): Likewise.
99 (Layout::attach_allocated_section_to_segment): Likewise.
100 (Layout::finalize, Layout::create_executable_stack): Likewise.
101 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
102 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
103 * layout.h (class Layout): Update declarations. Remove options_
104 field. Add number_of_input_files_ and resized_signatures_
105 fields. Move sections_are_attached_ field.
106 * main.cc (main): Pass number of input files to Layout
107 constructor. Don't pass options.
108
154b857c
ILT
1092009-03-30 Ian Lance Taylor <iant@google.com>
110
111 * ffsll.c (ffsll): Correct implementation.
112
2f35ab9b
ILT
1132009-03-27 Ian Lance Taylor <iant@google.com>
114
fd03461a
ILT
115 * ffsll.c: New file.
116 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
117 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
118 * ftruncate.c (ftruncate): Declare before definition.
119 * mremap.c (mremap): Likewise.
120 * pread.c (pread): Likewise.
121 * configure, Makefile.in, config.in: Rebuild.
122
2f35ab9b
ILT
123 * mremap.c: New file.
124 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
125 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
126 (mremap): Declare if HAVE_MREMAP is not defined.
127 * configure, Makefile.in, config.in: Rebuild.
128
33aea2fd
CC
1292009-03-27 Cary Coutant <ccoutant@google.com>
130
131 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
132 position independent.
133 * sparc.cc (Target_sparc::check_non_pic): Likewise.
134 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
135
6d479619
CC
1362009-03-24 Cary Coutant <ccoutant@google.com>
137
138 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
139 an executable.
140 (needs_dynamic_reloc): Likewise.
141
afc06bb8
ILT
1422009-03-24 Ian Lance Taylor <iant@google.com>
143
144 * yyscript.y (file_cmd): Recognize EXTERN.
145 (extern_name_list, extern_name_list_body): New nonterminals.
146 * script.cc (script_add_extern): Define.
147 * script-c.h (script_add_extern): Declare.
148
f6060a4d
ILT
1492009-03-24 Rafael Avila de Espindola <espindola@google.com>
150
151 * object.cc (is_elf_object): Define.
152 * object.h (is_elf_object): Declare.
153 * archive.cc (Archive::get_elf_object_for_member): Call
154 is_elf_object.
33aea2fd 155 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
f6060a4d 156
26736d8e
ILT
1572009-03-24 Elliott Hughes <enh@google.com>
158
159 * output.cc (Output_file::map_anonymous): Define.
160 (Output_file::map): Use map_anonymous. If the regular mmap fails,
161 try an anonymous one. Report the size if the mmap fails.
162 * output.h (class Output_file): Declare map_anonymous.
163
22fd9730
ILT
1642009-03-24 Ian Lance Taylor <iant@google.com>
165
166 * target-select.cc (instantiate_target): Don't acquire the lock if
167 the instantiated_target_ field has already been set.
168
cb010894
ILT
1692009-03-23 Ian Lance Taylor <iant@google.com>
170
7f055c20
ILT
171 * gold-threads.h (class Initialize_lock): Define.
172 * gold-threads.cc (class Initialize_lock_once): Define.
173 (initialize_lock_control): New static variable.
174 (initialize_lock_pointer): New static variable.
175 (initialize_lock_once): New static function.
176 (Initialize_lock::Initialize_lock): Define.
177 (Initialize_lock::initialize): Define.
178 * target-select.h: Include "gold-threads.h".
179 (class Target_selector): Add lock_ and initialize_lock_ fields.
180 Don't define instantiate_target, just declare it.
181 * target-select.cc (Target_selector::Target_selector): Initialize
182 new fields.
183 (Target_selector::instantiate_target): Define.
184 * descriptors.h: Include "gold-threads.h".
185 (class Descriptors): Add initialize_lock_ field.
186 * descriptors.cc (Descriptors::Descriptors): Initialize new
187 field.
188 (Descriptors::open): Use initialize_lock_ field
189 * errors.h (class Errors): Add initialize_lock_ field.
190 * errors.cc (Errors::Errors): Initialize new field.
191 (Errors::initialize_lock): Use initialize_lock_ field.
192 * powerpc.cc (class Target_selector_powerpc): Remove
193 instantiated_target_ field. In do_recognize call
194 instantiate_target rather than do_instantiate_target. In
195 do_instantiate_target just allocate a new target.
196 * sparc.cc (class Target_selector_sparc): Likewise.
197
36959681
ILT
198 * freebsd.h: New file.
199 * i386.cc: Include "freebsd.h".
200 (Target_i386): Derive from Target_freebsd rather than
201 Sized_target.
202 (Target_selector_i386): Derive from Target_selector_freebsd rather
203 than Target_selector.
204 * x86_64.cc: Include "freebsd.h".
205 (Target_x86_64): Derive from Target_freebsd rather than
206 Sized_target.
207 (Target_selector_x86_64): Derive from Target_selector_freebsd
208 rather than Target_selector.
209 * target.h (class Target): Add adjust_elf_header and
210 do_adjust_elf_header.
211 * output.cc (Output_file_header:: do_sized_write): Call target
212 adjust_elf_header routine.
213 * configure.tgt: Set targ_osabi.
214 * configure.ac: Define GOLD_DEFAULT_OSABI.
215 * parameters.cc (Parameters::default_target): Pass
216 GOLD_DEFAULT_OSABI to select_target.
217 * target-select.h (class Target_selector): Make instantiate_target
218 protected rather than private.
219 * Makefile.am (HFILES): Add freebsd.h.
220 * configure, Makefile.in, config.in: Rebuild.
221
cb010894
ILT
222 * merge.cc (do_add_input_section): Correct pend value. Change
223 message about last entry not being null terminated from error to
224 warning.
225
0e879927
ILT
2262009-03-20 Mikolaj Zalewski <mikolajz@google.com>
227
228 * incremental.cc: New file.
229 * Makefile.am (CCFILES): Add incremental.cc.
230 * Makefile.in: Rebuild.
231
41105937
PP
2322009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
233
234 * layout.cc (Layout::output_section_name): Preserve names
235 of '.note.' sections.
236
60439920
ILT
2372009-03-19 Ian Lance Taylor <iant@google.com>
238
239 * descriptors.cc (Descriptors::open): Check that the options are
240 valid before using them.
241
0d371ad3
ILT
2422009-03-18 Ian Lance Taylor <iant@google.com>
243
244 * script-sections.h: Include <list>.
245 (class Script_sections): Change Sections_elements from std::vector
246 to std::list. Typedef public Elements_iterator. Add
247 orphan_section_placement_, data_segment_align_start_, and
248 saw_data_segment_align_ fields. Remove data_segment_align_index_
249 field.
250 * script-sections.cc (class Orphan_section_placement): New class.
251 (class Sections_element): Add virtual functions is_relro and
252 orphan_section_init. Remove virtual function place_orphan_here.
253 (class Output_section_definition): Add is_relro and
254 orphan_section_init. Remove place_orphan_here.
255 (class Orphan_output_section): Likewise.
256 (Script_sections::Script_sections): Update for field changes.
257 (Script_sections::data_segment_align): Set saw_data_segment_align_
258 and data_segment_align_start_, not data_segment_align_index.
259 (Script_sections::data_segment_relro_end): Check
260 saw_data_segment_align_. Use data_segment_align_start_ rather
261 than data_segment_align_index_.
262 (Script_sections::place_orphan): Rewrite to use
263 Orphan_section_placement.
264
9201d894
ILT
2652009-03-17 Ian Lance Taylor <iant@google.com>
266
9c5b8369
ILT
267 * archive.cc (Archive::add_symbols): Check for a version attached
268 to the symbol name in the archive map.
269 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
270 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
271 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
272 (ver_test_11.a): New target.
273 * testsuite/Makefile.in: Rebuild.
274
9201d894
ILT
275 * configure.ac: Check for chsize and posix_fallocate. Replace
276 ftruncate.
277 * ftruncate.c: New file, from gnulib.
278 * output.cc (posix_fallocate): Define dummy version if not
279 HAVE_POSIX_FALLOCATE.
280 (Output_file::map): Call posix_fallocate rather than lseek and
281 write.
282 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
283 * configure, Makefile.in, config.in: Rebuild.
284
ef4ab7a8
PP
2852009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
286
287 * layout.h (Layout::create_note): Add section_name parameter.
288 * layout.cc (Layout::create_note): Likewise.
289 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
290
8c500701
ILT
2912009-03-17 Ian Lance Taylor <iant@google.com>
292
e85b18e1
ILT
293 * descriptors.cc: Include "options.h".
294 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
295 (Descriptors::open): Always use O_CLOEXEC when opening a new
296 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
297 then set FD_CLOEXEC.
298
9efe6174
ILT
299 * sparc.cc (class Target_sparc): Add has_got_section.
300 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
301 make sure we have a GOT section.
302
303 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
304 (Target_sparc::Scan::local): Likewise.
305 (Target_sparc::Scan::global): Likewise.
306 (Target_sparc::Relocate::relocate): Likewise.
307 (Target_sparc::Relocate::relocate_tls): Likewise.
308
8c500701
ILT
309 * symtab.cc (Symbol_table::define_default_version): New function,
310 broken out of add_from_object.
311 (Symbol_table::add_from_object): Call define_default_version.
312 (Symbol_table::define_special_symbol): Add resolve_oldsym
313 parameter. Change all callers. If the version for a symbol comes
314 from a version script, resolve it with the symbol with the same
315 name with no version. Also add the symbol without a version if
316 appropriate.
317 (do_define_in_output_data): If resolving with oldsym, don't delete
318 sym.
319 (do_define_in_output_segment): Likewise.
320 (do_define_as_constant): Likewise.
321 * symtab.h (class Symbol_table): Update declarations.
322
f1ed28fb
ILT
3232009-03-13 Ian Lance Taylor <iant@google.com>
324
15f8229b
ILT
325 * readsyms.cc (Read_symbols::incompatible_warning): New function.
326 (Read_symbols::requeue): New function.
327 (Read_symbols::do_read_symbols): If make_elf_object fails because
328 the target type is not configured, and the file was searched for,
329 issue a warning and retry with the next directory.
330 (Add_symbols::run): If the file has an incompatible format, and
331 it was searched for, requeue the Read_symbols task. On error,
332 release the object.
333 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
334 dirindex parameter to constructor. Change all callers. Declare
335 incompatible_warning and requeue.
336 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
337 input_argument_ and input_group_ fields. Add them to
338 constructor. Change all callers.
339 (class Read_script): Add dirindex_ field. Add it to constructor.
340 Change all callers.
341 * archive.cc (Archive::setup): Remove input_objects parameter.
342 Change all callers.
343 (Archive::get_file_and_offset): Likewise.
344 (Archive::read_all_symbols): Likewise.
345 (Archive::read_symbols): Likewise.
346 (Archive::get_elf_object_for_member): Remove input_objects
347 parameter. Add punconfigured parameter. Change all callers.
348 (Archive::add_symbols): Change return type to bool. Check return
349 value of include_member.
350 (Archive::include_all_members): Likewise.
351 (Archive::include_member): Change return type to bool. Return
352 false if first included object has incompatible target. Set
353 included_member_ field.
354 (Add_archive_symbols::run): If add_symbols returns false, requeue
355 Read_symbols task.
356 * archive.h (class Archive): Add included_member_ field.
357 Initialize it in constructor. Add input_file and searched_for
358 methods. Update declarations.
359 (class Add_archive_symbols): Add dirpath_, dirindex_, and
360 input_argument_ fields. Add them to constructor. Change all
361 callers.
362 * script.cc: Include "target-select.h".
363 (class Parser_closure): Add skip_on_incompatible_target_ and
364 found_incompatible_target_ fields. Add
365 skip_on_incompatible_target parameter to constructor. Change all
366 callers. Add methods skip_on_incompatible_target,
367 clear_skip_on_incompatible_target, found_incompatible_target, and
368 set_found_incompatible_target.
369 (read_input_script): Add dirindex parameter. Change all callers.
370 If parser finds an incompatible target, requeue Read_symbols
371 task.
372 (script_set_symbol): Clear skip_on_incompatible_target in
373 closure.
374 (script_add_assertion, script_parse_option): Likewise.
375 (script_start_sections, script_add_phdr): Likewise.
376 (script_check_output_format): New function.
377 * script.h (read_input_script): Update declaration.
378 * script-c.h (script_check_output_format): Declare.
379 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
380 (ignore_cmd): Remove OUTPUT_FORMAT.
381 * fileread.cc (Input_file::Input_file): Add explicit this.
382 (Input_file::will_search_for): New function.
383 (Input_file::open): Add pindex parameter. Change all callers.
384 * fileread.h (class Input_file): Add input_file_argument method.
385 Declare will_search_for. Update declarations.
386 * object.cc (make_elf_object): Add punconfigured parameter.
387 Change all callers.
388 * object.h (class Object): Make input_file public. Add
389 searched_for method.
390 (make_elf_object): Update declaration.
391 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
392 restart search.
393 * dirsearch.h (class Dirsearch): Update declaration.
394 * options.h (class General_options): Add --warn-search-mismatch.
395 * parameters.cc (Parameters::is_compatible_target): New function.
396 * parameters.h (class Parameters): Declare is_compatible_target.
397 * workqueue.cc (Workqueue::add_blocker): New function.
398 * workqueue.h (class Workqueue): Declare add_blocker.
399
f1ed28fb
ILT
400 * fileread.cc (Input_file::open): Remove options parameter.
401 Change all callers.
402 (Input_file::open_binary): Likewise.
403 * script.cc (read_input_script): Likewise.
404 * readsyms.h (class Read_symbols): Remove options_ field. Remove
405 options parameter from constructor. Change all callers.
406 (class Read_script): Likewise.
407 * fileread.h (class Input_file): Update declarations.
408 * script.h (read_input_script): Update declaration.
409
34dd024a
NC
4102009-03-10 Nick Clifton <nickc@redhat.com>
411
412 * po/es.po: New Spanish translation.
413
6d71b17c
CC
4142009-03-06 Cary Coutant <ccoutant@google.com>
415
416 * options.cc (parse_short_option): Keep dash_z from registering itself.
417
031cdbed
ILT
4182009-03-03 Ian Lance Taylor <iant@google.com>
419
420 PR 9918
421 * target-reloc.h (relocate_section): Pass output_section to
422 relocate.
423 * i386.cc (Target_i386::should_apply_static_reloc): Add
424 output_section parameter. Change all callers.
425 (Target_i386::Relocate::relocate): Add output_section parameter.
426 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
427 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
428 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
429 * testsuite/two_file_shared.sh: New script.
430 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
431 (check_DATA): Add two_file_shared.dbg.
432 (two_file_shared.dbg): New target.
433 * testsuite/Makefile.in: Rebuild.
434
15d5fa16
ILT
4352009-03-01 Ian Lance Taylor <iant@google.com>
436
437 * configure.ac: Check for byteswap.h.
438 * configure: Rebuild.
439 * config.in: Rebuild.
440
8a4c0b0d
ILT
4412009-03-01 Mikolaj Zalewski <mikolajz@google.com>
442
443 * layout.cc (Layout::find_or_add_kept_section): New function.
444 (Layout::add_comdat): Removed.
445 * layout.h (struct Kept_section): Move out of class Layout.
446 Remove trailing underscores from field names. Add group_sections
447 field. Rename group_ field to is_group. Change all uses.
448 (class Layout): Declare find_or_add_kept_section, not add_comdat.
449 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
450 comdat_groups_ field.
451 (Sized_relobj::include_section_group): Use
452 find_or_add_kept_section and Kept_section::group_sections.
453 (Sized_relobj::include_linkonce_section): Likewise.
454 * object.cc (class Sized_relobj): Don't define Comdat_group or
455 Comdat_group_table. Remove find_comdat_group and
456 add_comdat_group. Remove comdat_groups_ field.
457 * plugin.cc (include_comdat_group): Use
458 Layout::find_or_add_kept_section.
459
b4ecf66b
ILT
4602009-02-28 Ian Lance Taylor <iant@google.com>
461
14359ca0
ILT
462 * README: --gc-sections and map files are now supported. Document
463 some build requirements.
464
b4ecf66b
ILT
465 PR 6992
466 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
467 relocatable link set the value of the section symbol to zero.
468 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
469 relocatable link don't include the section address in the local
470 symbol value.
471
0602e05a
ILT
4722009-02-27 Ian Lance Taylor <iant@google.com>
473
fd9d194f
ILT
474 PR 6811
475 * options.h (class Search_directory): Add is_system_directory.
476 (class General_options): Declare is_in_system_directory.
477 * options.cc (get_relative_sysroot): Make static.
478 (get_default_sysroot): Make static.
479 (General_optoins::is_in_system_directory): New function.
480 * fileread.cc (Input_file::is_in_system_directory): New function.
481 * fileread.h (class Input_file): Declare is_in_system_directory.
482 * object.h (class Object): Add is_in_system_directory.
483 (class Input_objects): Remove system_library_directory_ field.
484 * object.cc (Input_objects::add_object): Don't set
485 system_library_directory_.
486 (input_objects::found_in_system_library_directory): Remove.
487 * symtab.cc (Symbol_table::write_globals): Remove input_objects
488 parameter. Change all callers.
489 (Symbol_table::sized_write_globals): Likewise.
490 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
491 Call Object::is_in_system_directory.
492 * symtab.h (class Symbol_table): Update declarations.
493
61edd21f
ILT
494 PR 5990
495 * descriptors.h (Open_descriptor): Add is_on_stack field.
496 * descriptors.cc (Descriptors::open): If the descriptor is on the
497 top of the stack, remove it. Initialize is_on_stack field.
498 (Descriptors::release): Only add pod to stack if it is not on the
499 stack already.
500 (Descriptors::close_some_descriptor): Clear stack_next and
501 is_on_stack fields.
502
e29e076a
ILT
503 PR 7091
504 * output.cc (Output_section::find_starting_output_address): Rename
505 from starting_output_address; add PADDR parameter; change return
506 type.
507 * output.h (class Output_section): Declare
508 find_starting_output_address instead of starting_output_address.
509 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
510 section symbol for which we can't find a merge section.
511
0602e05a
ILT
512 PR 9836
513 * symtab.cc (Symbol_table::add_from_object): If the visibility is
514 hidden or internal, force the symbol to be local.
515 * resolve.cc (Symbol::override_visibility): Define.
516 (Symbol::override_base): Use override_visibility.
517 (Symbol_table::resolve): Likewise.
518 (Symbol::override_base_with_special): Likewise.
519 (Symbol_table::override_with_special): If the visibility is hidden
520 or internal, force the symbol to be local.
521 * symtab.h (class Symbol): Add set_visibility and
522 override_visibility.
523 * testsuite/ver_test_1.sh: New file.
524 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
525 (check_DATA): Add ver_test_1.syms.
526 (ver_test_1.syms): New target.
527 * testsuite/Makefile.in: Rebuild.
528
401a9a73
CC
5292009-02-25 Cary Coutant <ccoutant@google.com>
530
531 * layout.cc (Layout::choose_output_section): Don't rename sections
532 when using a linker script that has a SECTIONS clause.
533 * Makefile.in: Regenerate.
534
535 * testsuite/Makefile.am (script_test_5.sh): New test case.
536 * testsuite/Makefile.in: Regenerate.
537 * testsuite/script_test_5.cc: New file.
538 * testsuite/script_test_5.sh: New file.
539 * testsuite/script_test_5.t: New file.
540
f488e4b0
CC
5412009-02-13 Rafael Avila de Espindola <espindola@google.com>
542
543 * archive.cc (Archive::include_member): Update calls to add_symbols.
544 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
545 the Layout argument.
546 * dynobj.h (do_add_symbols): Add the Layout argument.
547 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
548 Layout argument.
549 * object.h (Object::add_symbols): Add the Layout argument.
550 (Object::do_add_symbols): Add the Layout argument.
551 (Sized_relobj::do_add_symbols): Add the Layout argument.
552 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
553 Unify the two versions.
554 (Add_plugin_symbols): Remove.
555 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
556 (Sized_pluginobj::do_add_symbols): Unify the two versions.
557 (Add_plugin_symbols): Remove.
558 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
559 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
560 (Add_symbols::run): Make it work with Pulginobj.
561
89dd1680
ILT
5622009-02-06 Ian Lance Taylor <iant@google.com>
563
564 * object.cc (Sized_relobj::do_layout): Make info message start
565 with lower case letter.
566
266d0a74
ILT
5672009-02-06 Mikolaj Zalewski <mikolajz@google.com>
568
602b464e
ILT
569 * binary.cc: Fix file comment.
570
266d0a74
ILT
571 * options.h (enum Incremental_disposition): Define.
572 (class General_options): Add new options: --incremental,
573 --incremental_changed, --incremental_unchanged,
574 --incremental_unknown. Add incremental_disposition_ and
575 implicit_incremental_ fields.
576 (General_options::incremental_disposition): New function.
577 (class Position_dependent_options): Add incremental_disposition
578 option.
579 (Position_dependent_options::copy_from_options): Set incremental
580 dispositions.
581 * options.cc (General_options::parse_incremental_changed): New
582 function.
583 (General_options::parse_incremental_unchanged): New function.
584 (General_options::parse_incremental_unknown): New function.
585 (General_options::General_options): Initialize new fields
586 incremental_disposition_ and implicit_incremental_.
587 (General_options::finalize): Check for uasge of --incremental-*
588 without --incremental.
589
f073bbf7
CD
5902009-02-06 Chris Demetriou <cgd@google.com>
591
592 * gold.h (gold_undefined_symbol): Change to take only a Symbol
593 pointer and to report location as the file name associated with
594 the symbol.
595 (gold_undefined_symbol_at_location): New function to replace the
596 old gold_undefined_symbol functionality.
597 * target-reloc.h (relocate_section): Update to use
598 gold_undefined_symbol_at_location.
599 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
600 Call gold_undefined_symbol function rather than gold_error.
601 * errors.h (Errors::undefined_symbol): Take location as a
602 string, rather than calculating it from a relocation.
603 * errors.cc (Errors::fatal): Print "fatal error:" before the
604 formatted message.
605 (Errors::error, Errors::error_at_location): Print "error: "
606 before the formatted message.
607 (Errors::undefined_symbol): Take location as a string, rather
608 than calculating it from a relocation.
609 (gold_undefined_symbol_at_location): New function akin to
610 old gold_undefined_symbol, calculates location from relocation.
611 (gold_undefined_symbol): Change to take only a Symbol pointer
612 and to report location as the file name associated with the symbol.
613 * testsuite/debug_msg.sh: Update for changed error messages.
614 * testsuite/undef_symbol.sh: Likewise.
615
8e94a90c
ILT
6162009-02-04 Duncan Sands <baldrick@free.fr>
617
618 PR 9812
619 * reduced_debug_output.h
620 (Output_reduced_debug_abbrev_section::failed): Use format for
621 gold_warning.
622 (Output_reduced_debug_info_section::faild): Likewise.
623
88a0e15b
ILT
6242009-01-31 Mikolaj Zalewski <mikolajz@google.com>
625
626 * script.cc (Lazy_demangler): New class.
627 (Version_script_info::get_symbol_version_helper): Demangle a
628 symbol only once.
629
5efc7cd2
CC
6302009-01-29 Cary Coutant <ccoutant@google.com>
631
632 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
633 to __tls_get_addr.
634 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
635
e0ebcf42
ILT
6362009-01-28 Ian Lance Taylor <iant@google.com>
637
5efc7cd2 638 * version.cc (version_string): Bump to 1.9.
75fe7426 639
e0ebcf42
ILT
640 * gold.h: Include <cstring> and <stdint.h>.
641 * version.cc: Include <cstdio>.
642 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
643 warning.
644 * reduced_debug_output.cc (insert_into_vector): Rename from
645 Insert_into_vector; change all callers. Use Swap_unaligned to
646 avoid aliasing issue; remove union since it is unnecessary.
647
8e2813be 6482009-01-27 Sriraman Tallam <tmsriram@google.com>
6d03d481
ST
649
650 * Makefile.am (CCFILES): Add gc.cc.
651 (HFILES): Add gc.h.
652 * Makefile.in: Regenerate.
653 * gold.cc (Gc_runner): New class.
654 (queue_initial_tasks): Call garbage collection related tasks
655 when corresponding options are invoked.
656 (queue_middle_gc_tasks): New function.
657 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
658 processed early before laying out sections during garbage collection.
659 * gold.h (queue_middle_gc_tasks): New function.
660 (is_prefix_of): Move from "layout.cc".
661 * i386.cc (Target_i386::gc_process_relocs): New function.
662 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
663 * main.cc (main): Create object of class "Garbage_collection".
664 * object.cc (Relobj::copy_symbols_data): New function.
665 (Relobj::is_section_name_included): New function.
666 (Sized_relobj::do_layout): Allow this function to be called twice
667 during garbage collection and defer layout of section during the
668 first call.
669 * object.h (Relobj::get_symbols_data): New function.
670 (Relobj::is_section_name_included): New function.
671 (Relobj::copy_symbols_data): New function.
672 (Relobj::set_symbols_data): New function.
673 (Relobj::get_relocs_data): New function.
674 (Relobj::set_relocs_data): New function.
675 (Relobj::is_output_section_offset_invalid): New pure virtual function.
676 (Relobj::gc_process_relocs): New function.
677 (Relobj::do_gc_process_relocs): New pure virtual function.
678 (Relobj::sd_): New data member.
679 (Sized_relobj::is_output_section_offset_invalid): New function.
680 (Sized_relobj::do_gc_process_relocs): New function.
681 * options.h (General_options::gc_sections): Modify to not be a no-op.
682 (General_options::print_gc_sections): New option.
683 * plugin.cc (Plugin_finish::run): Remove function call to
684 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
685 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
686 * reloc.cc (Read_relocs::run): Add task to process relocs and
687 determine unreferenced sections when doing garbage collection.
688 (Gc_process_relocs): New class.
689 (Sized_relobj::do_gc_process_relocs): New function.
690 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
691 sections that are garbage collected.
692 * reloc.h (Gc_process_relocs): New class.
693 * sparc.cc (Target_sparc::gc_process_relocs): New function.
694 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
695 symbols whose corresponding sections are garbage collected.
696 (Symbol_table::Symbol_table): Add new parameter for the garbage
697 collection object.
698 (Symbol_table::gc_mark_undef_symbols): New function.
699 (Symbol_table::gc_mark_symbol_for_shlib): New function.
700 (Symbol_table::gc_mark_dyn_syms): New function.
701 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
702 as garbage.
703 (Symbol_table::add_from_object): Likewise.
704 (Symbol_table::add_from_relobj): When building shared objects, do not
705 treat externally visible symbols as garbage.
706 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
707 table information for static and relocatable links.
708 * symtab.h (Symbol_table::set_gc): New function.
709 (Symbol_table::gc): New function.
710 (Symbol_table::gc_mark_undef_symbols): New function.
711 (Symbol_table::gc_mark_symbol_for_shlib): New function.
712 (Symbol_table::gc_mark_dyn_syms): New function.
713 (Symbol_table::gc_): New data member.
714 * target.h (Sized_target::gc_process_relocs): New pure virtual
715 function.
716 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
717 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
718
3b293544
CF
7192009-01-20 Chris Faylor <me.sourceware@sourceware.org>
720
721 * options.h (General_options::gc_sections): Define as a no-op for now.
722 (General_options::no_keep_memory): Ditto.
723 (General_options::Bshareable): Define.
724 * options.cc (General_options::finalize): Honor -Bshareable.
725
83d22aa8
AS
7262009-01-20 Andreas Schwab <schwab@suse.de>
727
728 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
729 read the value in the contents, since we don't use it. Use the
730 template endianness when writing.
731 (Relocate::relocate): Use it for R_PPC_REL16_HA.
732
cd536b21
AS
7332009-01-19 Andreas Schwab <schwab@suse.de>
734
735 * configure.tgt (powerpc64-*): Fix targ_obj.
736
99e9a495
ILT
7372009-01-15 Ian Lance Taylor <iant@google.com>
738
739 * object.cc (Sized_relobj::write_local_symbols): Don't write out
740 local symbols when stripping all symbols.
741
bbbfea06
CC
7422009-01-14 Cary Coutant <ccoutant@google.com>
743
99e9a495 744 * output.cc (Output_reloc): Add explicit instantiations.
bbbfea06 745
0f7c0701
CC
7462009-01-14 Cary Coutant <ccoutant@google.com>
747
748 * archive.cc (Archive::get_elf_object_for_member): Remove call
749 to File_read::claim_for_plugin.
750 * descriptors.cc (Descriptors::open): Remove reference to
751 is_claimed.
752 (Descriptors::claim_for_plugin): Remove.
753 * descriptors.h (Descriptors::claim_for_plugin): Remove.
754 (Descriptors::is_claimed): Remove.
755 (claim_descriptor_for_plugin): Remove.
756 * fileread.cc (File_read::claim_for_plugin): Remove.
757 * fileread.h (File_read::claim_for_plugin): Remove.
758 (File_read::descriptor): Reopen descriptor if necessary.
759 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
760 (Plugin_manager::all_symbols_read): Add task parameter. Change
761 all callers.
762 (Plugin_manager::get_input_file): New function.
763 (Plugin_manager::release_input_file): New function.
764 (Pluginobj::Pluginobj): Add filesize parameter and initialize
765 corresponding data member.
766 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
767 and pass to base constructor. Change all callers.
768 (get_input_file, release_input_file): New functions.
769 (make_sized_plugin_object): Add filesize parameter. Change all callers.
770 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
771 (Plugin_manager::all_symbols_read): Add task parameter.
772 (Plugin_manager::get_input_file): New function.
773 (Plugin_manager::release_input_file): New function.
774 (Plugin_manager::task_): New data member.
775 (Pluginobj::Pluginobj): Add filesize parameter.
776 (Pluginobj::filename): New function.
777 (Pluginobj::descriptor): New function.
778 (Pluginobj::filesize): New function.
779 (Pluginobj::filesize_): New data member.
780 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
781 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
782 File_read::claim_for_plugin; use Object::unlock to unlock the file.
783
784 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
785 with archive libraries.
786 * testsuite/Makefile.in: Regenerate.
787 * testsuite/plugin_test.c (struct sym_info): New type.
788 (get_input_file, release_input_file): New static variables.
789 (onload): Capture new transfer vector entries.
790 (claim_file_hook): Stop reading at end of file according to filesize.
791 Factor out parsing of readelf output into separate function.
792 (all_symbols_read_hook): Exercise get_input_file and release_input_file
793 APIs and get the source file name from the symbol table. Convert
794 source file name to corresponding object file name. Print info
795 message when adding new input files.
796 (parse_readelf_line): New function.
797 * testsuite/plugin_test_1.sh: Add checks for new info messages.
798 * testsuite/plugin_test_2.sh: Likewise.
799 * testsuite/plugin_test_3.sh: Likewise.
800 * testsuite/plugin_test_4.sh: New test case.
801
62a6d109
ILT
8022009-01-07 Ian Lance Taylor <iant@google.com>
803
804 * version.cc (version_string): Bump to 1.8.
805
483620e8
CC
8062008-12-23 Cary Coutant <ccoutant@google.com>
807
808 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
809 * plugin.cc (Plugin_manager::finish): Rename as
810 layout_deferred_objects. Move cleanup to separate function.
811 (Plugin_manager::cleanup): New function.
812 (Plugin_finish::run): Call layout_deferred_objects and cleanup
813 separately.
814 * plugin.h (Plugin_manager::finish): Rename as
815 layout_deferred_objects.
816 (Plugin_manager::cleanup): New function.
817 (Plugin_manager::cleanup_done): New field.
818
d66a9eb3
CC
8192008-12-23 Cary Coutant <ccoutant@google.com>
820
821 * plugin.cc (is_visible_from_outside): New function.
822 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
823 so we don't return "IR only" status for exported symbols or -r links.
824
825 * testsuite/Makefile.am (plugin_test_3): New test case.
826 * testsuite/Makefile.in: Regenerate.
827 * testsuite/plugin_test_3.sh: New file.
828
5995b570
CC
8292008-12-22 Cary Coutant <ccoutant@google.com>
830
831 * object.cc (Sized_relobj::layout_section): New function.
832 (Sized_relobj::do_layout): Defer layout of input sections until after
833 plugin has provided replacement files.
834 (Sized_relobj::do_layout_deferred_sections): New function.
835 * object.h (Relobj::set_section_offset): Remove virtual keyword.
836 (Relobj::layout_deferred_sections): New function.
837 (Relobj::do_layout_deferred_sections): New function.
838 (Sized_relobj::do_layout_deferred_sections): New function.
839 (Sized_relobj::layout_section): New function.
840 (Sized_relobj::Deferred_layout): New structure.
841 (Sized_relobj::deferred_layout_): New field.
842 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
843 Change all callers. Layout deferred sections.
844 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
845 references.
846 (Plugin_hook::run): Move code from do_plugin_hook inline.
847 (Plugin_hook::do_plugin_hook): Remove.
848 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
849 (Plugin_manager::finish): Renamed, was cleanup.
850 (Plugin_manager::should_defer_layout): New function.
851 (Plugin_manager::add_deferred_layout_object): New function.
852 (Plugin_manager::Deferred_layout_list): New type.
853 (Plugin_manager::deferred_layout_objects_): New field.
854 (Plugin_hook::do_plugin_hook): Remove.
855
ee769c88
ILT
8562008-12-17 Ian Lance Taylor <iant@google.com>
857
858 * options.h (class General_options): Add --no case for
859 --export-dynamic.
860
abc8dcba
CC
8612008-12-16 Cary Coutant <ccoutant@google.com>
862
863 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
864 vector.
865 (Plugin_manager::claim_file): Create plugin object even if
866 plugin did not call the add_symbols callback.
867 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
868 asking for more symbols than were added.
869 * testsuite/Makefile.am (plugin_test_1): Add test case with
870 no global symbols.
871 (empty.syms): New target.
872 * testsuite/Makefile.in: Regenerate.
873 * testsuite/plugin_test.c (claim_file_hook): Add new debug
874 message. Don't call add_symbols if no globals.
875 (all_symbols_read_hook): Don't provide replacement for empty
876 claimed file.
877
b0074644
ILT
8782008-12-12 Ian Lance Taylor <iant@google.com>
879
68943102
ILT
880 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
881 r_type == 0 for a local symbol with r_sym == 0.
882 (scan_relocatable_relocs): Pass r_sym to
883 local_non_section_strategy.
884 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
885 r_sym parameter.
886
b0074644
ILT
887 * configure.ac: Update test for TLS descriptors: they are
888 supported as of glibc 2.9.
889 * configure: Rebuild.
890
c2508178
ILT
8912008-12-11 Ian Lance Taylor <iant@google.com>
892
893 PR 7091
894 * target-reloc.h (Default_scan_relocatable_relocs): For each
895 function, map r_type == 0 to RELOC_DISCARD.
896
2756a258
CC
8972008-12-10 Cary Coutant <ccoutant@google.com>
898
899 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
900 object to override a kept COMDAT group from a plugin object.
901
bb6f53d3
ILT
9022008-12-09 Ian Lance Taylor <iant@google.com>
903
fbc558e1
ILT
904 PR 7088
905 * yyscript.y (file_cmd): Handle INPUT.
906
bb6f53d3
ILT
907 * testsuite/initpri1.c: Change all declarations to be full
908 prototypes by adding void, to avoid compiler warnings.
909
4674ecfc
CC
9102008-12-05 Rafael Avila de Espindola <espindola@google.com>
911
912 * options.cc (General_options::parse_plugin_opt): New.
913 (General_options::add_plugin): The argument now is just the filename.
914 (General_options::add_plugin_option): New.
915 * options.h (plugin_opt): New.
916 (add_plugin): Change argument name.
917 (add_plugin_option): New.
918 * plugin.cc (Plugin::load): Don't parse the plugin option.
919 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
920 (Plugin::add_option): New.
921 (Plugin::args_): Change type.
922 (Plugin::filename_): New.
923 (Plugin_manager::add_plugin_option): New.
924 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
925 * testsuite/Makefile.in: Regenerate.
926
fd06b4aa
CC
9272008-12-05 Cary Coutant <ccoutant@google.com>
928
929 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
930 Handle --strip-lto-sections option.
931 * options.h (strip_lto_sections): New option.
932
6c52134c
CC
9332008-12-01 Cary Coutant <ccoutant@google.com>
934
935 * plugin.cc (ld_plugin_message): Change format parameter to const.
936 Fix mismatch between new[] and delete.
937
a45248e0
CC
9382008-11-14 Cary Coutant <ccoutant@google.com>
939
940 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
941 instead of -1U.
942
c82fbeee
CS
9432008-11-05 Craig Silverstein <csilvers@google.com>
944
945 * options.cc (General_options::parse_dynamic_list): New function.
946 * options.h (General_options): New flags dynamic_list,
947 dynamic_list_data, dynamic_list_cpp_new, and
948 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
949 (General_options::in_dynamic_list): New function.
950 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
951 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
952 (Lex::can_continue_name): Likewise.
953 (yylex): Likewise.
954 (read_script_file): New parameter script_options.
955 (read_dynamic_list): New function.
956 (Script_options::define_dynamic_list): New function.
957 (dynamic_list_keyword_parsecodes): New variable.
958 (dynamic_list_keywords): New variable.
959 * script.h (Script_options::define_dynamic_list): New function
960 prototype.
961 (read_dynamic_list): New function prototype.
962 * symtab.cc (strprefix): New macro.
963 (Symbol::should_add_dynsym_entry): Support dynamic_list,
964 dynamic_list_data, dynamic_list_cpp_new, and
965 dynamic_list_cpp_typeinfo.
966 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
967 (dynamic_list_expr): New rule.
968 (dynamic_list_nodes): Likewise.
969 (dynamic_list_node): Likewise.
970 * testsuite/Makefile.am (dynamic_list): New test.
971 * testsuite/Makefile.in: Regenerated.
972 * testsuite/dynamic_list.t: New file.
973 * testsuite/dynamic_list.sh: New file.
974
e0bb29a5
CS
9752008-11-05 Craig Silverstein <csilvers@google.com>
976
977 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
978 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
979 (t11_last): Likewise.
980 * testsuite/ver_test_6.c (main): Likewise.
981
4e1e25e0
CC
9822008-10-07 Cary Coutant <ccoutant@google.com>
983
984 * options.c (General_options::finalize): Add check for -static and
985 -shared.
986 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
987 is not empty.
988
92f03fcb
CC
9892008-10-02 Cary Coutant <ccoutant@google.com>
990
991 * plugin.cc (make_sized_plugin_object): Fix conditional
992 compilation to work when not all targets are enabled.
993
fbd8a257
CC
9942008-09-29 Cary Coutant <ccoutant@google.com>
995
996 * archive.cc (Archive::get_file_and_offset): Use filename instead
997 of name to get library path.
998 (Archive::include_member): Unlock external member of a thin archive.
999
1000 * testsuite/Makefile.am (TEST_AR): New variable.
1001 (thin_archive_test_1): New test.
1002 (thin_archive_test_2): New test.
81636b3f
CC
1003 * testsuite/Makefile.in: Regenerate.
1004 * testsuite/thin_archive_main.cc: New file.
1005 * testsuite/thin_archive_test_1.cc: New file.
1006 * testsuite/thin_archive_test_2.cc: New file.
1007 * testsuite/thin_archive_test_3.cc: New file.
1008 * testsuite/thin_archive_test_4.cc: New file.
fbd8a257 1009
eff45813
CC
10102008-09-29 Cary Coutant <ccoutant@google.com>
1011
1012 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
1013 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
1014 instead of -1U.
1015 (Sized_relobj::do_finalize_local_symbols): Likewise.
1016 (Sized_relobj::map_to_kept_section): Likewise.
1017 * object.h (Sized_relobj::invalid_address): New constant.
1018 (Sized_relobj::do_output_section_offset): Check for invalid_address
1019 and return -1ULL.
1020 * output.cc (Output_reloc::local_section_offset): Use constant
1021 invalid_address instead of -1U.
1022 (Output_reloc::get_address): Likewise.
1023 (Output_section::output_address): Change -1U to -1ULL.
1024 * output.h (Output_reloc::invalid_address): New constant.
1025 * reloc.cc (Sized_relobj::write_sections): Use constant
1026 invalid_address instead of -1U.
1027 (Sized_relobj::relocate_sections): Likewise.
1028 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
1029 values for merge sections.
1030 * target-reloc.h (relocate_for_relocatable): Use constant
1031 invalid_address instead of -1U.
1032
89fc3421
CC
10332008-09-19 Cary Coutant <ccoutant@google.com>
1034
1035 Add plugin functionality for link-time optimization (LTO).
1036 * configure.ac (plugins): Add --enable-plugins option.
1037 * configure: Regenerate.
1038 * config.in: Regenerate.
1039 * Makefile.am (LIBDL): New variable.
1040 (CCFILES): Add plugin.cc.
1041 (HFILES): Add plugin.h.
1042 (ldadd_var): Add LIBDL.
1043 * Makefile.in: Regenerate.
1044
1045 * archive.cc: Include "plugin.h".
1046 (Archive::setup): Don't preread archive symbols when using a plugin.
1047 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
1048 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
1049 files.
1050 (Archive::include_member): Add symbols from plugin objects.
1051 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
1052 * descriptors.cc (Descriptors::open): Check for file descriptors
1053 abandoned by plugins.
1054 (Descriptors::claim_for_plugin): New function.
1055 * descriptors.h (Descriptors::claim_for_plugin): New function.
1056 (Open_descriptor::is_claimed): New field.
1057 (claim_descriptor_for_plugin): New function.
1058 * fileread.cc (File_read::claim_for_plugin): New function.
1059 * fileread.h (File_read::claim_for_plugin): New function.
1060 (File_read::descriptor): New function.
1061 * gold.cc: Include "plugin.h".
1062 (queue_initial_tasks): Add task to call plugin hooks for generating
1063 new object files.
1064 * main.cc: Include "plugin.h".
1065 (main): Load plugin libraries.
1066 * object.h (Pluginobj): Declare.
1067 (Object::pluginobj): New function.
1068 (Object::do_pluginobj): New function.
1069 (Object::set_target): New function.
1070 * options.cc: Include "plugin.h".
1071 (General_options::parse_plugin): New function.
1072 (General_options::General_options): Initialize plugins_ field.
1073 (General_options::add_plugin): New function.
1074 * options.h (Plugin_manager): Declare.
1075 (General_options): Add --plugin option.
1076 (General_options::has_plugins): New function.
1077 (General_options::plugins): New function.
1078 (General_options::add_plugin): New function.
1079 (General_options::plugins_): New field.
1080 * plugin.cc: New file.
1081 * plugin.h: New file.
1082 * readsyms.cc: Include "plugin.h".
1083 (Read_symbols::do_read_symbols): Check for archive before checking
1084 for ELF file. Call plugin hooks to claim files.
1085 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
1086 from a real object file; force override when processing replacement
1087 files.
1088 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
1089 (Symbol::init_base_object): Likewise.
1090 (Symbol::init_base_output_data): Likewise.
1091 (Symbol::init_base_output_segment): Likewise.
1092 (Symbol::init_base_constant): Likewise.
1093 (Symbol::init_base_undefined): Likewise.
1094 (Symbol::output_section): Assert that object is not a plugin.
1095 (Symbol_table::add_from_pluginobj): New function.
1096 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
1097 undefined.
1098 (Symbol_table::sized_write_globals): Likewise.
1099 (Symbol_table::add_from_pluginobj): Instantiate template.
1100 * symtab.h (Sized_pluginobj): Declare.
1101 (Symbol::in_real_elf): New function.
1102 (Symbol::set_in_real_elf): New function.
1103 (Symbol::in_real_elf_): New field.
1104 (Symbol_table::add_from_pluginobj): New function.
1105
1106 * testsuite/Makefile.am (AM_CFLAGS): New variable.
1107 (LIBDL): New variable.
1108 (LDADD): Add LIBDL.
1109 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
1110 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
1111 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
1112 (MOSTLYCLEANFILES): Likewise.
1113 * testsuite/Makefile.in: Regenerate.
1114 * testsuite/plugin_test.c: New file.
1115 * testsuite/plugin_test_1.sh: New file.
1116 * testsuite/plugin_test_2.sh: New file.
1117
de31bda5
ILT
11182008-09-16 Ian Lance Taylor <iant@google.com>
1119
9c2d0ef9
ILT
1120 * target-reloc.h (relocate_section): Check whether a symbol is
1121 defined by the ABI before reporting an undefined symbol error.
1122 * target.h (Target::is_defined_by_abi): Make parameter const.
1123 (Target::do_is_defined_by_abi): Likewise.
1124 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
1125 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
1126 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
1127 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
1128 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
1129 * testsuite/Makefile.in: Rebuild.
1130
de31bda5
ILT
1131 * fileread.cc (make_view): Add casts to avoid warning.
1132
9fa33bee
AO
11332008-09-16 Alexandre Oliva <aoliva@redhat.com>
1134
1135 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
1136 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
1137
183fd0e3
AO
11382008-09-16 Alexandre Oliva <aoliva@redhat.com>
1139
1140 * options.h (General_options::output_is_executable): New.
1141 (General_options::output_is_pie): New.
1142 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
1143 for shared libraries.
1144 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
1145
7be8330a
CD
11462008-09-11 Chris Demetriou <cgd@google.com>
1147
1148 * options.h (origin): New -z option.
1149 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
1150 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
1151 in DT_FLAGS_1.
1152
a9caad02
CC
11532008-09-05 Cary Coutant <ccoutant@google.com>
1154
1155 * fileread.cc (File_read::make_view): Add check for attempt to map
1156 beyond end of file.
1157
ae6dce4d
CC
11582008-09-05 Cary Coutant <ccoutant@google.com>
1159
1160 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
1161 explicit instantiations.
1162
d7ab2a47
KVH
11632008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
1164
1165 PR gold/6858
1166 * options.cc (General_options::finalize): Allow undefined symbols
1167 in shlibs if linking -shared.
1168
1169 PR gold/6859
1170 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
1171 symbols as not needing a dynsym entry.
1172
1e52a9c1
CS
11732008-08-20 Craig Silverstein <csilvers@google.com>
1174
1175 * fileread.cc (File_read::open): Do not lock the file unless it
1176 was successfully opened.
1177
d85c80a3
CC
11782008-08-14 Cary Coutant <ccoutant@google.com>
1179
1180 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
1181 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
1182 * testsuite/tls_test.cc (struct int128): 128-bit struct
1183 for testing TLS relocs with non-zero addend.
1184 (v12): New TLS variable.
1185 (t12): New test.
1186 (t_last): Add check for v12.
1187 * testsuite/tls_test.h (t12): New function.
1188 * testsuite/tls_test_main.cc (thread_routine): Call new test.
1189
2d924fd9
ILT
11902008-08-13 Ian Lance Taylor <iant@google.com>
1191
1192 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
1193 set tls_segment_ or relro_segment_.
1194 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
1195 when appropriate.
1196 * output.h (Output_section::clear_is_relro): New function.
1197 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
1198 sections specially even when output_data_ is empty.
1199 (Output_segment::maximum_alignment): When first section is relro,
1200 only force alignment for PT_LOAD segments.
1201 * script.cc (script_data_segment_align): New function.
1202 (script_data_segment_relro_end): New function.
1203 * script-c.h (script_data_segment_align): Declare.
1204 (script_data_segment_relro_end): Declare.
1205 * script-sections.h (class Script_sections): Declare
1206 data_segment_align and data_segment_relro_end. Add fields
1207 segment_align_index_ and saw_relro_end_.
1208 * script-sections.cc (class Sections_element): Add set_is_relro
1209 virtual function. Add new bool* parameter to place_orphan_here.
1210 Add get_output_section virtual function.
1211 (class Output_section_definition): Add set_is_relro. Add new
1212 bool* parameter to place_orphan_here. Add get_output_section.
1213 Add is_relro_ field.
1214 (Output_section_definition::Output_section_definition): Initialize
1215 evaluated_address_, evaluated_load_address, evaluated_addralign_,
1216 and is_relro_ fields.
1217 (Output_section_definition::place_orphan_here): Add is_relro
1218 parameter.
1219 (Output_section_definition::set_section_addresses): Set relro for
1220 output section.
1221 (Output_section_definition::alternate_constraint): Likewise.
1222 (class Orphan_output_section): Add new bool* parameter to
1223 place_orphan_here. Add get_output_section.
1224 (Orphan_output_section::place_orphan_here): Add is_relro
1225 parameter.
1226 (Script_sections::Script_sections): Initialize
1227 data_segment_align_index_ and saw_relro_end_.
1228 (Script_sections::data_segment_align): New function.
1229 (Script_sections::data_segment_relro_end): New function.
1230 (Script_sections::place_orphan): Set or clear is_relro.
1231 (Script_sections::set_section_addresses): Force alignment of first
1232 TLS section.
1233 * yyscript.y (exp): Call script_data_segment_align and
1234 script_data_segment_relro_end.
1235 * testsuite/relro_script_test.t: New file.
1236 * testsuite/relro_test.cc (using_script): Declare.
1237 (t1, t2): Test using_script.
1238 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
1239 (relro_script_test_SOURCES): Define.
1240 (relro_script_test_DEPENDENCIES): Define.
1241 (relro_script_test_LDFLAGS): Define.
1242 (relro_script_test_LDADD): Define.
1243 (relro_script_test.so): New target.
1244 * testsuite/Makefile.in: Rebuild.
1245
f827c9a9
CC
12462008-08-06 Cary Coutant <ccoutant@google.com>
1247
1248 * archive.cc (Archive::total_archives, Archive::total_members)
1249 (Archive::total_members_loaded): New variables.
1250 (Archive::setup): Add parameter. Add option to preread
1251 archive symbols.
1252 (Archive::read_armap): Add counter.
1253 (Archive::get_file_and_offset): New function.
1254 (Archive::get_elf_object_for_member): New function.
1255 (Archive::read_all_symbols): New function.
1256 (Archive::read_symbols): New function.
1257 (Archive::add_symbols): Add counters.
1258 (Archive::include_all_members): Use armap to find members if it's
1259 already built.
1260 (Archive::include_member): Skip reading symbols if already read.
1261 Factored code into Archive::get_file_and_offset and
1262 Archive::get_elf_object_for_member. Changed call to
1263 Mapfile::report_include_archive_member.
1264 (Archive::print_stats): New function.
1265 * archive.h: Declare Object and Read_symbols_data classes.
1266 (Archive::Archive): Add initializers for new members.
1267 (Archive::setup): Add parameter.
1268 (Archive::print_stats): New function.
1269 (Archive::total_archives, Archive::total_members)
1270 (Archive::total_members_loaded): New variables.
1271 (Archive::get_file_and_offset): New function.
1272 (Archive::get_elf_object_for_member): New function.
1273 (Archive::read_all_symbols): New function.
1274 (Archive::read_symbols): New function.
1275 (Archive::Archive_member): New class.
1276 (Archive::members_): New member.
1277 (Archive::num_members_): New member.
1278 * main.cc: Include archive.h.
1279 (main): Call Archive::print_stats.
1280 * mapfile.cc (Mapfile::report_include_archive_member): Delete
1281 archive parameter; member_name is now the fully-decorated name.
1282 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
1283 * options.h: (General_options): Add --preread-archive-symbols option.
1284 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
1285 Archive::setup.
1286
de4c45bd
ILT
12872008-08-04 Ian Lance Taylor <iant@google.com>
1288
1289 * symtab.h (Symbol::use_plt_offset): New function.
1290 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
1291 * powerpc.cc (Relocate::relocate): Likewise.
1292 * sparc.cc (Relocate::relocate): Likewise.
1293 * x86_64.cc (Relocate::relocate): Likewise.
1294 * testsuite/weak_plt.sh: New test.
1295 * testsuite/weak_plt_main.cc: New test.
1296 * testsuite/weak_plt_shared.cc: New test.
1297 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
1298 (check_PROGRAMS): Add weak_plt.
1299 (check_DATA): Add weak_plt_shared.so.
1300 (weak_plt_main_pic.o, weak_plt): New targets.
1301 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
1302 * testsuite/Makefile.in: Rebuild.
1303
1304 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
1305 gcctestdir/ld.
1306 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
1307 * testsuite/Makefile.in: Rebuild.
1308
323ee3f4
AM
13092008-08-04 Alan Modra <amodra@bigpond.net.au>
1310
1311 * Makefile.am (POTFILES.in): Set LC_ALL=C.
1312 * Makefile.in: Regenerate.
1313 * po/POTFILES.in: Regenerate.
1314
7c07ecec
ILT
13152008-07-29 Ian Lance Taylor <iant@google.com>
1316
1317 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
1318 symbols before other symbols.
1319 * testsuite/script_test_2.cc (test_addr): Declare.
1320 (test_addr_alias): Declare.
1321 (main): Check that test_addr and test_addr_alias have the right
cd536b21 1322 values.
7c07ecec
ILT
1323 * testsuite/script_test_2.t: Define test_addr_alias and
1324 test_addr.
1325
5778530e
ILT
13262008-07-24 Ian Lance Taylor <iant@google.com>
1327
2a00e4fb
ILT
1328 PR 5990
1329 * descriptors.cc: New file.
1330 * descriptors.h: New file.
1331 * gold-threads.h (class Hold_optional_lock): New class.
1332 * fileread.cc: Include "descriptors.h".
1333 (File_read::~File_read): Release descriptor rather than closing
1334 it.
1335 (File_read::open) [file]: Call open_descriptor rather than open.
1336 Set is_descriptor_opened_.
1337 (File_read::open) [memory]: Assert that descriptor is not open.
1338 (File_read::reopen_descriptor): New function.
1339 (File_read::release): Release descriptor.
1340 (File_read::do_read): Make non-const. Reopen descriptor.
1341 (File_read::read): Make non-const.
1342 (File_read::make_view): Reopen descriptor.
1343 (File_read::do_readv): Likewise.
1344 * fileread.h (class File_read): Add is_descriptor_opened_ field.
1345 Update declarations.
1346 * layout.cc: Include "descriptors.h".
1347 (Layout::create_build_id): Use open_descriptor rather than open.
1348 * output.cc: Include "descriptors.h".
1349 (Output_file::open): Use open_descriptor rather than open.
1350 * archive.cc (Archive::const_iterator): Change Archive to be
1351 non-const.
1352 (Archive::begin, Archive::end): Make non-const.
1353 (Archive::count_members): Likewise.
1354 * archive.h (class Archive): Update declarations.
1355 * object.h (Object::read): Make non-const.
1356 * Makefile.am (CCFILES): Add descriptors.cc.
1357 (HFILES): Add descriptors.h.
1358 * Makefile.in: Rebuild.
1359
801647d1
ILT
1360 PR 6716
1361 * gold.h: Always include <clocale>. Add Solaris workarounds
1362 following code in binutils/sysdep.h.
1363
5edd166e
ILT
1364 PR 6048
1365 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
1366 this->eh_frame_hdr_ is NULL before using it.
1367
c89ad728
ILT
1368 * dynobj.cc (Versions::Versions): Update comment.
1369
aa86f06b
ILT
1370 * dynobj.cc (Versions::Versions): If there is an soname, use it as
1371 the base version name.
1372
5778530e
ILT
1373 * stringpool.cc (Stringpool_template::add_with_length): Set key to
1374 array size plus one.
1375 (Stringpool_template::set_string_offsets): Subtract one from key
1376 before using it as an array index.
1377 (Stringpool_template::get_offset_with_length): Likewise.
1378 (Stringpool_template::write_to_buffer): Likewise.
1379 * stringpool.h (Stringpool_template::get_offset_from_key):
1380 Likewise.
1381
057ead22
ILT
13822008-07-23 Ian Lance Taylor <iant@google.com>
1383
7f649c59
ILT
1384 PR 6658
1385 * object.h (Merged_symbol_value::value): Do our best to handle a
1386 negative addend.
1387
057ead22
ILT
1388 PR 6647
1389 * script.cc (Version_script_info::get_versions): Don't add empty
1390 version tag to return value.
1391 (Version_script_info::get_symbol_version_helper): Change return
1392 type to bool. Add pversion parameter. Change all callers.
1393 (script_register_vers_node): Don't require a non-NULL tag.
1394 * script.h (class Version_script_info): Update declarations.
1395 (Version_script_info::get_symbol_version): Change return type to
1396 bool. Add version parameter. Change all callers.
1397 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
1398 handling. Handle an empty version from a version script.
1399 (Symbol_table::define_special_symbol): Likewise.
1400 * testsuite/ver_test_10.script: New file.
1401 * testsuite/ver_test_10.sh: New file.
1402 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
1403 (check_DATA): Add ver_test_10.syms.
1404 (ver_test_10.syms, ver_test_10.so): New target.
1405 * testsuite/Makefile.in: Rebuild.
1406
58e54ac2
CD
14072008-07-23 Simon Baldwin <simonb@google.com>
1408
1409 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
1410 to zero for undefined symbols from dynamic libraries.
1411
95d14cd3
ILT
14122008-07-23 Ian Lance Taylor <iant@google.com>
1413
1414 * symtab.cc (Symbol_table::resolve): Remove version parameter.
1415 Change all callers.
1416 * symtab.h (class Symbol_table): Update declaration.
1417 * testsuite/ver_test_9.cc: New file.
1418 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
1419 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
1420 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
1421 (ver_test_9.so, ver_test_9.o): New targets.
1422 * testsuite/Makefile.in: Rebuild.
1423
92de84a6
ILT
14242008-07-22 Ian Lance Taylor <iant@google.com>
1425
34810851
ILT
1426 * options.h (class General_options): Define --check-sections.
1427 * layout.cc (Layout::set_segment_offsets): Handle
1428 --check-sections.
1429
af6156ef
ILT
1430 * options.h (class General_options): Define -n/--nmagic and
1431 -N/--omagic.
1432 * options.cc (General_options::finalize): For -n/--nmagic or
1433 -N/--omagic, set -static.
1434 * layout.cc (Layout::attach_allocated_section_to_segment): If
1435 -N/--omagic, don't put read-only and read-write sections in
1436 different segments.
1437 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
1438 finding a read-only segment.
1439 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
1440 don't set the minimum segment alignment to the common page size,
1441 and don't set the file offset to the address modulo the page size.
1442 * script-sections.cc (Script_sections::create_segments): If
1443 -n/--omagic, don't put read-only and read-write sections in
1444 different segments.
1445
92de84a6
ILT
1446 * cref.cc: New file.
1447 * cref.h: New file.
1448 * options.h (class General_options): Add --print-symbol-counts.
1449 * main.cc (main): Issue defined symbol report if requested.
1450 * archive.cc (Archive::interpret_header): Make into a const member
1451 function.
1452 (Archive::add_symbols): Call Input_objects::archive_start and
1453 archive_stop.
1454 (Archive::const_iterator): Define new class.
1455 (Archive::begin, Archive::end): New functions.
1456 (Archive::include_all_members): Rewrite to use iterator.
1457 (Archive::count_members): New function.
1458 * archive.h (class Archive): Update declarations.
1459 (Archive::filename): New function.
1460 * object.cc: Include "cref.h".
1461 (Sized_relobj::Sized_relobj): Initialize defined_count_.
1462 (Sized_relobj::do_get_global_symbol_counts): New function.
1463 (Input_objects::add_object): Add object to cross-referencer.
1464 (Input_objects::archive_start): New function.
1465 (Input_objects::archive_stop): New function.
1466 (Input_objects::print_symbol_counts): New function.
1467 * object.h: Declare Cref and Archive.
1468 (Object::get_global_symbol_counts): New function.
1469 (Object::do_get_global_symbol_counts): New pure virtual function.
1470 (class Sized_relobj): Add defined_count_ field. Update
1471 declarations.
1472 (class Input_objects): Add cref_ field. Update constructor.
1473 Update declarations.
1474 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
1475 defined_count_.
1476 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
1477 symbol counts.
1478 (Sized_dynobj::do_get_global_symbol_counts): New function.
1479 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
1480 defined_count_. Update declarations. Define Symbols typedef.
1481 * symtab.cc (Symbol_table::add_from_relobj): Add defined
1482 parameter. Change all callers.
1483 (Symbol_table::add_from_dynobj): Add sympointers and defined
1484 parameters. Change all callers.
1485 * symtab.h (class Symbol_table): Update declarations.
1486 * Makefile.am (CCFILES): Add cref.cc.
1487 (HFILES): Add cref.h.
1488 * Makefile.in: Rebuild.
1489
3f7c5e1d
CD
14902008-07-22 Simon Baldwin <simonb@google.com>
1491
1492 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
1493 to zero when writing undefined symbols.
1494
e0b64032
ILT
14952008-07-22 Ian Lance Taylor <iant@google.com>
1496
1497 * output.cc (Output_section::add_input_section): Don't try to
1498 merge empty merge sections.
1499
096b02cf
CS
15002008-07-21 Craig Silverstein <csilvers@google.com>
1501
1502 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
1503 Include symbol version in error message.
cd536b21 1504
1d1f116d
CD
15052008-07-20 Chris Demetriou <cgd@google.com>
1506
cd536b21 1507 * configure.ac (gold_cv_c_random_seed): New configured variable.
1d1f116d
CD
1508 (RANDOM_SEED_CFLAGS): New substituted variable.
1509 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
1510 * configure: Rebuild.
1511 * Makefile.in: Likewise.
1512 * testsuite/Makefile.in: Likewise.
1513
a18f591e
ILT
15142008-07-18 Ian Lance Taylor <iant@google.com>
1515
1516 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
1517 where we see NAME/NULL and NAME/VERSION as separate symbols.
1518 * testsuite/ver_test_main.cc (main): Call t4.
1519 (t4, t4_2a): Define.
1520 * testsuite/ver_test_2.cc (t4_2): Define.
1521 * testsuite/ver_test_2.script: Put t4_2a in VER2.
1522 * testsuite/ver_test_4.cc (t4_2a): Define.
1523 * testsuite/ver_test_4.script: Put t4_2a in VER2.
1524 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
1525
c6e3f6ed
ILT
15262008-07-17 Ian Lance Taylor <iant@google.com>
1527
1528 * dynobj.cc (Versions::add_def): If we give an error about a
1529 missing version, go ahead and create the version anyhow.
1530
ef9beddf
ILT
15312008-07-10 Ian Lance Taylor <iant@google.com>
1532
1533 Handle output sections with more than 0x7fffffff bytes.
1534 * object.h (class Relobj): Change map_to_output_ to
1535 output_sections_, and just keep a section pointer. Change all
1536 uses. Move comdat group support to Sized_relobj.
1537 (Relobj::is_section_specially_mapped): Remove.
1538 (Relobj::output_section): Remove poff parameter. Change all
1539 callers.
1540 (Relobj::output_section_offset): New function.
1541 (Relobj::set_section_offset): Rewrite.
1542 (Relobj::map_to_output): Remove.
1543 (Relobj::output_sections): New function.
1544 (Relobj::do_output_section_offset): New pure virtual function.
1545 (Relobj::do_set_section_offset): Likewise.
1546 (class Sized_relobj): Add section_offsets_ field. Add comdat
1547 group support from Relobj. Update declarations.
1548 (Sized_relobj::get_output_section_offset): New function.
1549 (Sized_relobj::do_output_section_offset): New function.
1550 (Sized_relobj::do_set_section_offset): New function.
1551 * object.cc (Relobj::output_section_address): Remove.
1552 (Sized_relobj::Sized_relobj): Initialize new fields.
1553 (Sized_relobj::include_section_group): Cast find_kept_object to
1554 Sized_relobj.
1555 (Sized_relobj::include_linkonce_section): Likewise.
1556 (Sized_relobj::do_layout): Use separate arrays for output section
1557 and output offset.
1558 (Sized_relobj::do_count_local_symbols): Change map_to_output to
1559 output_sections.
1560 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
1561 output_sections and section_offsets.
1562 (Sized_relobj::write_local_symbols): Likewise.
1563 (map_to_kept_section): Compute output address directly.
1564 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
1565 output_sections and section_offsets.
1566 (Sized_relobj::write_sections): Likewise.
1567 (Sized_relobj::relocate_sections): Likewise.
1568 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
1569 * output.h (class Output_reloc): Update declarations. Change
1570 u2_.relobj to Sized_relobj*.
1571 (class Output_data_reloc): Change add functions to use
1572 Sized_relobj*.
1573 * output.cc (Output_reloc::Output_reloc): Change relobj to
1574 Sized_relobj*.
1575 (Output_reloc::local_section_offset): Change return type to
1576 Elf_Addr. Use get_output_section_offset.
1577 (Output_reloc::get_address): Likewise.
1578 (Output_section::is_input_address_mapped): Don't call
1579 is_section_specially_mapped.
1580 (Output_section::output_offset): Likewise.
1581 (Output_section::output_address): Likewise.
1582 (Output_section::starting_output_address): Likewise.
1583 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
1584 parameter to Sized_relobj*.
1585 (Copy_relocs::need_copy_reloc): Likewise.
1586 (Copy_relocs::save): Likewise.
1587 * copy-relocs.h (class Copy_relocs): Update declarations.
1588 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
1589 Sized_relobj*. Change relobj_ field to Sized_relobj*.
1590 * target-reloc.h (relocate_for_relocatable): Change
1591 offset_in_output_section type to Elf_Addr. Change code that uses
1592 it as well.
1593 * layout.cc (Layout::layout): Always set *off.
1594 * mapfile.cc (Mapfile::print_input_section): Use
1595 output_section_offset.
1596 * i386.cc (Target_i386::copy_reloc): Change object parameter to
1597 Sized_relobj*.
1598 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
1599 * sparc.cc (Target_sparc::copy_reloc): Likewise.
1600 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
1601
5cb66f97
ILT
16022008-07-03 Ian Lance Taylor <iant@google.com>
1603
1604 * layout.cc (Layout::include_section): Do not discard unrecognized
1605 SHT_STRTAB sections.
1606
afe47622
CS
16072008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
1608
1609 * script.cc (Lex::can_continue_name): Make '?' allowable in
1610 version-script names.
1611 * testsuite/version_script.map: Change glob pattern to use '?'
1612
5adf9721
ILT
16132008-06-30 Manish Singh <yosh@gimp.org>
1614
1615 PR 6585
1616 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
1617 Correct typo.
1618
e6fde208
ILT
16192008-06-30 Ian Lance Taylor <iant@google.com>
1620
1621 PR 6660
1622 PR 6682
1623 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
1624 versions]: Don't try to read the value in the contents, since we
1625 don't use it. Use the template endianness when writing.
1626
3f2e6a2d
CC
16272008-06-25 Cary Coutant <ccoutant@google.com>
1628
1629 * fileread.cc (File_read::make_view): Assert on zero-length view.
1630 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
1631 symbol table when there are no symbols to read.
1632
c43d3a48
CS
16332008-06-23 Craig Silverstein <csilvers@google.com>
1634
1635 * version.cc (version_string): Bump to 1.7
1636
5f494ea0
CS
16372008-06-18 Craig Silverstein <csilvers@google.com>
1638
1639 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
1640 constant 0xFFFF to type Valtype.
1641 (Powerpc_relocate_functions::rel16_ha): Likewise.
1642
c42e122e
ILT
16432008-06-17 Ian Lance Taylor <iant@google.com>
1644
f34787f8
ILT
1645 * output.h (Output_section::Input_section): Initialize p2align_ to
1646 zero for Output_section_data constructors.
1647 (Output_section::Input_section::addralign): If not an input
1648 section, return the alignment of the Output_section_data.
1649 * testsuite/copy_test.cc: New file.
1650 * testsuite/copy_test_1.cc: New file.
1651 * testsuite/copy_test_2.cc: New file.
1652 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
1653 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
1654 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
1655 (copy_test_1_pic.o, copy_test_1.so): New targets.
1656 (copy_test_2_pic.o, copy_test_2.so): New targets.
1657 * testsuite/Makefile.in: Rebuild.
1658
c42e122e
ILT
1659 * script-sections.cc (Script_sections::place_orphan): Initialize
1660 local variable exact.
1661
ce3ac18a
DE
16622008-06-13 David Edelsohn <edelsohn@gnu.org>
1663
1664 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
1665
42cacb20
DE
16662008-06-12 David Edelsohn <edelsohn@gnu.org>
1667 David S. Miller <davem@davemloft.net>
1668
1669 * powerpc.cc: New file.
1670 * Makefile.am (TARGETSOURCES): Add powerpc.cc
1671 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
1672 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
1673 * Makefile.in: Rebuild.
1674
7b308235
ILT
16752008-06-09 Ian Lance Taylor <iant@google.com>
1676
1677 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
1678 <exception>.
1679 (throwing, orig_terminate): New static variables.
1680 (terminate_handler): New static function.
1681 (t2): Set terminate handler.
1682
f0b886e3
ILT
16832008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
1684
1685 PR 6584
cd536b21 1686 * binary.cc (Binary_to_elf::sized_convert): Fix .data
f0b886e3
ILT
1687 alignment.
1688
3e90f135
CC
16892008-05-30 Cary Coutant <ccoutant@google.com>
1690
1691 * archive.cc (Archive::include_all_members) Correct to step
1692 over symbol table and extended name table in thin archives.
1693
e09ad04a
ILT
16942008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
1695
1696 PR 6407
1697 * target-reloc.h (relocate_for_relocatable): Fix new_offset
1698 calculation.
1699
62b01cb5
ILT
17002008-05-28 Caleb Howe <cshowe@google.com>
1701
1702 * reduced_debug_output.cc: New file.
1703 * reduced_debug_output.h: New file.
92de84a6 1704 * options.h (class General_options): Add --strip-debug-non-line.
62b01cb5
ILT
1705 * options.cc (General_options::finalize): Add strip_debug_non_line
1706 to the strip heirarchy.
1707 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
1708 fields.
1709 * layout.cc: Include "reduced_debug_output.h".
1710 (Layout::Layout): Initialize new fields.
1711 (line_only_debug_sections): New static array.
1712 (is_lines_only_debug_sections): New static inline function.
1713 (Layout::include_section): Handle --strip-debug-non-line.
1714 (Layout::make_output_section): If --strip-debug-non-line, build
1715 new output sections for .debug_abbrev and .debug_info.
1716 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
1717 gold. Warn about possible overflow.
1718 (read_signed_LEB_128): Likewise.
1719 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
1720 (read_signed_LEB_128): Declare.
1721 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
1722 (HFILES): Add reduced_debug_output.h.
1723 * Makefile.in: Rebuild.
1724
7d9e3d98
ILT
17252008-05-21 Ian Lance Taylor <iant@google.com>
1726
1727 * mapfile.cc: New file.
1728 * mapfile.h: New file.
1729 * options.h (class General_options): Add -M/--print-map and -Map.
1730 * options.cc (General_options::finalize): Make -M equivalent to
1731 -Map -.
1732 * main.cc: Include <cstdio> and "mapfile.h".
1733 (main): Open mapfile if requested.
1734 * gold.cc (class Middle_runner): Add mapfile_ field. Update
1735 constructor. Change caller.
1736 (queue_initial_tasks): Add mapfile parameter. Change caller.
1737 (queue_middle_tasks): Likewise.
1738 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
1739 declarations.
1740 * archive.cc: Include "mapfile.h".
1741 (Archive::add_symbols): Add mapfile parameter. Change all
1742 callers. Pass mapfile, symbol, and reason to include_member.
1743 (Archive::include_all_members): Add mapfile parameter. Change all
1744 callers.
1745 (Archive::include_member): Add mapfile, sym, and why parameters.
1746 Change all callers. Report inclusion to map file.
1747 * archive.h: Include "fileread.h".
1748 (class Archive): Update declarations.
1749 (Archive::file): New const method.
1750 (class Add_archive_symbols): Add mapfile_ field. Update
1751 constructor. Change all callers.
1752 * readsyms.h (class Read_symbols): Likewise.
1753 (class Finish_group): Likewise.
1754 (class Read_script): Likewise.
1755 * common.cc: Include "mapfile.h".
1756 (Symbol_table::allocate_commons): Add mapfile parameter. Change
1757 all callers.
1758 (Symbol_table::do_allocate_commons): Likewise.
1759 (Symbol_table::do_allocate_commons_list): Likewise. Report common
1760 symbol allocation to mapfile.
1761 * common.h (class Allocate_commons_task): Add mapfile_ field.
1762 Update constructor. Change all callers.
1763 * symtab.h (class Symbol_table): Update declarations.
1764 * layout.cc: Include "mapfile.h".
1765 (Layout_task_runner::run): Print information to mapfile.
1766 (Layout::create_gold_note): Change Output_data_fixed_space to
1767 Output_data_zero_fill.
1768 (Layout::create_build_id): Likewise.
1769 (Layout::print_to_mapfile): New function.
1770 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
1771 constructor. Change caller.
1772 (class Layout): Declare print_to_mapfile.
1773 * output.cc (Output_section::Input_section::print_to_mapfile): New
1774 function.
1775 (Output_section::add_input_section): If producing a map, always
1776 add to input_sections_ list.
1777 (Output_section::do_print_to_mapfile): New function.
1778 (Output_segment::print_sections_to_mapfile): New function.
1779 (Output_segment::print_section_list_to_mapfile): New function.
1780 * output.h: Include "mapfile.h".
1781 (Output_data::print_to_mapfile): New function.
1782 (Output_data::do_print_to_mapfile): New virtual function.
1783 (Output_segment_headers::do_print_to_mapfile): New function.
1784 (Output_file_header::do_print_to_mapfile): New function.
1785 (Output_data_const::do_print_to_mapfile): New function.
1786 (class Output_data_const_buffer): Add map_name_ field. Update
1787 constructor. Change all callers. Add do_print_to_mapfile
1788 function.
1789 (class Output_data_fixed_space): Likewise.
1790 (class Output_data_space): Likewise.
1791 (class Output_data_zero_fill): New class.
1792 (Output_data_strtab::do_print_to_mapfile): New function.
1793 (Output_data_reloc_base::do_print_to_mapfile): New function.
1794 (Output_relocatable_relocs::do_print_to_mapfile): New function.
1795 (Output_data_group::do_print_to_mapfile): New function.
1796 (Output_data_got::do_print_to_mapfile): New function.
1797 (Output_data_dynamic::do_print_to_mapfile): New function.
1798 (Output_symtab_xindex::do_print_to_mapfile): New function.
1799 (class Output_section): Declare do_print_to_mapflie. Declare
1800 print_to_mapfile in Input_section.
1801 (class Output_segment): Declare new functions.
1802 * object.h (Sized_relobj::symbol_count): New function.
1803 * script-sections.cc
1804 (Output_section_element_dot_assignment::set_section_addresses):
1805 Change Output_data_fixed_space to Output_data_zero_fill.
1806 (Output_data_expression::do_print_to_mapfile): New function.
1807 * script.cc (read_input_script): Add mapfile parameter. Change
1808 all callers.
1809 * script.h (read_input_script): Update declaration.
1810 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
1811 (Eh_frame::do_print_to_mapfile): New function.
1812 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
1813 (Output_merge_string::do_print_to_mapfile): New function.
1814 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
1815 function.
1816 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
1817 function.
1818 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
1819 function.
1820 * Makefile.am (CCFILES): Add mapfile.cc.
1821 (HFILES): Add mapfile.h.
1822 * Makefile.in: Rebuild.
1823
9f1d377b
ILT
18242008-05-19 Ian Lance Taylor <iant@google.com>
1825
1826 * options.h (class General_options): Add -z relro.
1827 * layout.cc (Layout::Layout): Initialize relro_segment_.
1828 (Layout::add_output_section_data): Return the output section.
1829 (Layout::make_output_section): Rcognize relro sections and mark
1830 them appropriately.
1831 (Layout::attach_allocated_section_to_segment): Put relro sections
1832 in a PT_GNU_RELRO segment.
1833 (Layout::create_initial_dynamic_sections): Mark the .dynamic
1834 section as relro.
1835 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
1836 PT_TLS segments.
1837 (Layout::linkonce_mapping): Map d.rel.ro.local to
1838 .data.rel.ro.local.
1839 (Layout::output_section_name): Us .data.rel.ro.local for any
1840 section which begins with that.
1841 * layout.h (class Layout): Update add_output_section_data
1842 declaration. Add relro_segment_ field.
1843 * output.cc (Output_section::Output_section): Initialize is_relro_
1844 and is_relro_local_ fields.
1845 (Output_segment::add_output_section): Group relro sections.
1846 (Output_segment::is_first_section_relro): New function.
1847 (Output_segment::maximum_alignment): If there is a relro section,
1848 align the segment to the common page size.
1849 (Output_segment::set_section_addresses): Track whether we are
1850 looking at relro sections. If the last section is a relro
1851 section, align to the common page size.
1852 (Output_segment::set_section_list_addresses): Add in_relro
1853 parameter. Change all callers. Align to the page size when
1854 moving from relro to non-relro section.
1855 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
1856 segment.
1857 * output.h (class Output_section): Add is_relro_ and
1858 is_relro_local_ fields.
1859 (Output_section::is_relro): New function.
1860 (Output_section::set_is_relro): New function.
1861 (Output_section::is_relro_local): New function.
1862 (Output_section::set_is_relro_local): New function.
1863 (class Output_segment): Update declarations.
1864 * i386.cc (Target_i386::got_section): Mark .got section as relro.
1865 * sparc.cc (Target_sparc::got_section): Likewise.
1866 * x86_64.cc (Target_x86_64::got_section): Likewise.
1867 * testsuite/relro_test_main.cc: New file.
1868 * testsuite/relro_test.cc: New file.
1869 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
1870 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
1871 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
1872 (relro_test.so, relro_test_pic.o): New targets.
1873 * testsuite/Makefile.in: Rebuild.
1874
a984ee1d
ILT
18752008-05-16 Ian Lance Taylor <iant@google.com>
1876
01676dcd
ILT
1877 * output.cc (Output_segment::add_output_section): Remove front
1878 parameter.
1879 * output.h (class Output_segment): Remove
1880 add_initial_output_section and overloaded add_output_section.
1881 Update declaration of remaining add_output_section.
1882 * layout.cc (Layout::create_interp): Call add_output_section
1883 rather than add_initial_output_section.
1884 (Layout::finish_dynamic_section): Likewise.
1885
497897f9
ILT
1886 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
1887 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
1888 know the dynamic type.
1889 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
1890 field. Initialize it in constructor.
1891 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
1892 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
1893 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
1894 reloc.
1895
a984ee1d
ILT
1896 * output.cc (Output_reloc::get_address): Change return type to
1897 Elf_Addr.
1898 * output.h (class Output_reloc): Update get_address declaration.
1899 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
1900 for section addresses.
1901
55ba0940
ILT
19022008-05-09 Ian Lance Taylor <iant@google.com>
1903
1904 PR 6493
1905 * gold.cc (gold_nomem): Use return value of write.
1906
75517b77
ILT
19072008-05-08 Ian Lance Taylor <iant@google.com>
1908
1909 * symtab.c (Symbol::init_base_output_data): Add version
1910 parameter. Change all callers.
1911 (Symbol::init_base_output_segment): Likewise.
1912 (Symbol::init_base_constant): Likewise.
1913 (Symbol::init_base_undefined): Likewise.
1914 (Sized_symbol::init_output_data): Likewise.
1915 (Sized_symbol::init_output_segment): Likewise.
1916 (Sized_symbol::init_constant): Likewise.
1917 (Sized_symbol::init_undefined): Likewise.
1918 (Symbol_table::do_define_in_output_data): If the new symbol has a
1919 version, mark it as the default.
1920 (Symbol_table::do_define_in_output_segment): Likewise.
1921 (Symbol_table::do_define_as_constant): Likewise.
1922 * symtab.h (class Symbol): Update declarations.
1923 (class Sized_symbol): Likewise.
1924 * resolve.cc (Symbol::override_version): New function.
c42e122e 1925 (Symbol::override_base): Call override_version.
75517b77
ILT
1926 (Symbol::override_base_with_special): Likewise.
1927 * testsuite/ver_script_8.script: New file.
1928 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
1929 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
1930 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
1931 (ver_test_8_1.so, ver_test_8_2.so): New targets.
1932
f1f70eae
ILT
19332008-05-06 Ian Lance Taylor <iant@google.com>
1934
f3e9c5c5
ILT
1935 PR 6049
1936 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
1937 functions.
1938 (class General_options): Remove existing --undefined, and add
1939 --no-undefined instead. Add new --undefined as synonym for -u.
1940 * archive.cc (Archive::add_symbols): Check whether symbol was
1941 named with -u.
1942 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
1943 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
1944 all uses. Add IS_UNDEFINED. Update declarations to split
1945 different versions of init_base. Declare init_base_undefined.
1946 (Symbol::is_defined): Handle IS_UNDEFINED.
1947 (Symbol::is_undefined): Likewise.
1948 (Symbol::is_weak_undefined): Call is_undefined.
1949 (Symbol::is_absolute): Handle IS_CONSTANT.
1950 (class Sized_symbol): Update declarations to split different
1951 versions of init. Declare init_undefined.
1952 (class Symbol_table): Declare new functions.
1953 * symtab.cc (Symbol::init_base_object): Rename from init_base.
1954 Change all callers.
1955 (Symbol::init_base_output_data): Likewise.
1956 (Symbol::init_base_output_segment): Likewise.
1957 (Symbol::init_base_constant): Likewise.
1958 (Symbol::init_base_undefined): New function.
1959 (Sized_symbol::init_object): Rename from init. Change all
1960 callers.
1961 (Sized_symbol::init_output_data): Likewise.
1962 (Sized_symbol::init_output_segment): Likewise.
1963 (Sized_symbol::init_constant): Likewise.
1964 (Sized_symbol::init_undefined): New function.
1965 (Symbol_table::add_undefined_symbols_from_command_line): New
1966 function.
1967 (Symbol_table::do_add_undefined_symbols_from_command_line): New
1968 function.
1969 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
1970 (Symbol::output_section): Likewise.
1971 (Symbol::set_output_section): Likewise.
1972 (Symbol_table::sized_finalize_symbol): Likewise.
1973 (Symbol_table::sized_write_globals): Likewise.
1974 * resolve.cc (Symbol_table::should_override): Likewise.
1975 (Symbol::override_base_with_special): Likewise.
1976
8bdcdf2c
ILT
1977 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
1978 symbol, change it to have default visibility.
1979 * testsuite/protected_1.cc: New file.
1980 * testsuite/protected_2.cc: New file.
1981 * testsuite/protected_3.cc: New file.
1982 * testsuite/protected_main_1.cc: New file.
1983 * testsuite/protected_main_2.cc: New file.
1984 * testsuite/protected_main_3.cc: New file.
1985 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
1986 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
1987 (protected_1_LDFLAGS, protected_1_LDADD): Define.
1988 (protected_1.so): New target.
1989 (protected_1_pic.o, protected_2_pic.o): New targets.
1990 (protected_3_pic.o): New target.
1991 (check_PROGRAMS): Add protected_2.
1992 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
1993 (protected_2_LDFLAGS, protected_2_LDADD): Define.
1994 * testsuite/Makefile.in: Rebuild.
1995
2b706932
ILT
1996 * options.h (DEFINE_var): Add set_user_set_##varname__.
1997 (DEFINE_bool_alias): New macro.
1998 (class General_options): Define -Bstatic using DEFINE_bool_alias
1999 rather than DEFINE_special. Add --undefined as an alias for -z
2000 defs.
2001 * options.cc (General_options::parse_Bstatic): Remove.
2002
d82a5bcc
ILT
2003 * options.h (class General_options): Add --fatal-warnings.
2004 * main.cc (main): Implement --fatal-warnings.
2005 * errors.h (Errors::warning_count): New function.
2006
f1f70eae
ILT
2007 * options.h (class General_options): Add -Bsymbolic-functions.
2008 * symtab.h (Symbol::is_preemptible): Check for
2009 -Bsymbolic-functions.
2010
8825ac63
ILT
20112008-05-05 Ian Lance Taylor <iant@google.com>
2012
d98bc257
ILT
2013 * options.h (DEFINE_bool): For DASH_Z, create the negative option
2014 as noVARNAME rather than no-VARNAME.
2015 (class General_options): Add option -z combreloc.
2016 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
2017 get_address.
2018 (Output_reloc::sort_before) [SHT_REL]: New function.
2019 (Output_reloc::sort_before) [SHT_RELA]: New function.
2020 (class Output_data_reloc_base): Add sort_relocs_ field. Define
2021 Sort_relocs_comparison.
2022 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
2023 parameter. Change all callers.
2024 (Output_data_reloc::Output_data_reloc) [both versions]: Add
2025 sort_relocs parameter. Change all callers.
2026 * output.cc (Output_reloc::get_address): New function, broken out
2027 of write_rel.
2028 (Output_reloc::write_rel): Call it.
2029 (Output_reloc::compare): New function.
2030 (Output_data_reloc_base::do_write): Optionally sort relocs.
2031
60b2b4e7
ILT
2032 * configure.ac: If targ_extra_obj is set, link it in.
2033 * configure.tgt: Initialize all variables.
2034 (x86_64*): Set targ_extra_obj and targ_extra_size.
2035 * configure: Rebuild.
2036
8825ac63
ILT
2037 * object.cc (Sized_relobj::include_section_group): Adjust section
2038 indexes read from group data. Build vector to pass to
2039 layout_group.
2040 * layout.cc (Layout::layout_group): Add flags and shndxes
2041 parameters. Remove contents parameter. Change caller. Update
2042 explicit instantiations.
2043 * layout.h (class Layout): Update layout_group declaration.
2044 * output.cc (Output_data_group::Output_data_group): Add flags and
2045 input_shndxes parameters. Remove contents parameter. Change
2046 caller.
2047 (Output_data_group::do_write): Change input_sections_ to
2048 input_shndxes_.
2049 * output.h (class Output_data_group): Update constructor
2050 declaration. Rename input_sections_ to input_shndxes_.
2051 * testsuite/many_sections_test.cc: Add template.
2052
e94cf127
CC
20532008-04-30 Cary Coutant <ccoutant@google.com>
2054
4418b2d5
CC
2055 * target-reloc.h (relocate_section): Fix dead-pointer bug.
2056
e94cf127
CC
2057 * layout.cc (Layout::include_section): Refactored check for debug
2058 info section.
2059 (Layout::add_comdat): Add new parameters. Change type
2060 of signature parameter. Add object and shndx to signatures table.
2061 (Layout::find_kept_object): New function.
2062 * layout.h: Include <cstring>.
2063 (Layout::is_debug_info_section): New function.
2064 (Layout::add_comdat): Add new parameters.
2065 (Layout::find_kept_object): New function.
2066 (Layout::Kept_section): New struct.
2067 (Layout::Signatures): Change type of map range.
2068 * object.cc (Relobj::output_section_address): New function.
2069 (Sized_relobj::include_section_group): Add new parameters. Change
2070 calls to Layout::add_comdat. Change to build table of kept comdat
2071 groups and table mapping discarded sections to kept sections.
2072 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
2073 (Sized_relobj::do_layout): Change calls to include_section_group and
2074 include_linkonce_section.
2075 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
2076 value to zero when section is discarded.
2077 (Sized_relobj::map_to_kept_section): New function.
2078 * object.h (Relobj::output_section_address): New function.
2079 (Relobj::Comdat_group): New type.
2080 (Relobj::find_comdat_group): New function.
2081 (Relobj::Comdat_group_table): New type.
2082 (Relobj::Kept_comdat_section): New type.
2083 (Relobj::Kept_comdat_section_table): New type.
2084 (Relobj::add_comdat_group): New function.
2085 (Relobj::set_kept_comdat_section): New function.
2086 (Relobj::get_kept_comdat_section): New function.
2087 (Relobj::comdat_groups_): New field.
2088 (Relobj::kept_comdat_sections_): New field.
2089 (Symbol_value::input_value): Update comment.
2090 (Sized_relobj::map_to_kept_section) New function.
2091 (Sized_relobj::include_linkonce_section): Add new parameter.
2092 * target-reloc.h (Comdat_behavior): New type.
2093 (get_comdat_behavior): New function.
2094 (relocate_section): Add code to map a discarded section to the
2095 corresponding kept section when applying a relocation.
2096
e4e5049b
CS
20972008-04-30 Craig Silverstein <csilvers@google.com>
2098
2099 * dwarf_reader.cc (next_generation_count): New static var.
2100 (Addr2line_cache_entry): New struct.
2101 (addr2line_cache): New static var.
2102 (Dwarf_line_info::one_addr2line): Added caching.
2103 (Dwarf_line_info::clear_addr2line_cache): New function.
2104 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
2105 cache-size parameter.
2106 (Dwarf_line_info::one_addr2line_cache): New function.
2107 * symtab.cc (Symbol_table::detect_odr_violations): Pass
2108 new cache-size argument to one_addr2line(), and clear cache.
2109
d09e9154
CC
21102008-04-28 Cary Coutant <ccoutant@google.com>
2111
2112 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
2113 R_386_PC8 relocations.
2114
7ef73768
ILT
21152008-04-23 Ian Lance Taylor <iant@google.com>
2116
55438702
ILT
2117 * object.cc (Sized_relobj::include_section_group): Check for
2118 invalid section group.
2119
c165fb93
ILT
2120 * object.cc (make_elf_object): Correct test for 64-bit ELF file
2121 header size.
2122
7ef73768
ILT
2123 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
2124 than read for file header.
2125 * archive.cc (Archive::include_member): Likewise.
2126
6194aaab
L
21272008-04-23 Paolo Bonzini <bonzini@gnu.org>
2128
2129 * aclocal.m4: Regenerate.
2130 * configure: Regenerate.
2131
d491d34e
ILT
21322008-04-19 Ian Lance Taylor <iant@google.com>
2133
5ea2bac6
ILT
2134 * version.cc (version_string): Bump to 1.6.
2135
7bc3e21a
ILT
2136 * testsuite/Makefile.am (many_sections_r_test): New target.
2137 (many_sections_r_test_SOURCES): Remove.
2138 (many_sections_r_test_DEPENDENCIES): Remove.
2139 (many_sections_r_test_LDFLAGS): Remove.
2140 (many_sections_r_test_LDADD): Remove.
2141
7fcd3aa9
ILT
2142 * object.cc (Sized_relobj::do_add_symbols): Always pass
2143 local_symbol_count_ to add_from_relobj.
2144
4c94d6ae
ILT
2145 * testsuite/Makefile.am (many_sections_check.h): Only check one in
2146 every thousand variables.
2147 * testsuite/Makefile.in: Rebuild.
2148
d491d34e
ILT
2149 * object.cc (Xindex::initialize_symtab_xindex): New function.
2150 (Xindex::read_symtab_xindex): New function.
2151 (Xindex::sym_xindex_to_shndx): New function.
2152 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
2153 available.
2154 (Sized_relobj::do_initialize_xindex): New function.
2155 (Sized_relobj::do_read_symbols): Adjust section links.
2156 (Sized_relobj::symbol_section_and_value): Add is_ordinary
2157 parameter. Change all callers.
2158 (Sized_relobj::include_section_group): Adjust section links and
2159 symbol section indexes.
2160 (Sized_relobj::do_layout): Adjust section links.
2161 (Sized_relobj::do_count_local_symbols): Adjust section links and
2162 symbol section indexes.
2163 (Sized_relobj::do_finalize_local_symbols): Distinguish between
2164 ordinary and special symbols.
2165 (Sized_relobj::write_local_symbols): Add symtab_xindex and
2166 dynsym_xindex parameters. Change all callers. Adjust section
2167 links. Use SHN_XINDEX when needed.
2168 (Sized_relobj::get_symbol_location_info): Adjust section links.
2169 Don't get fooled by special symbols.
2170 * object.h (class Xindex): Define.
2171 (class Object): Add xindex_ parameter. Declare virtual functoin
2172 do_initialize_xindex.
2173 (Object::adjust_sym_shndx): New function.
2174 (Object::set_xindex): New protected function.
2175 (class Symbol_value): Add is_ordinary_shndx_ field.
2176 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
2177 (Symbol_value::value): Assert ordinary section.
2178 (Symbol_value::initialize_input_to_output_map): Likewise.
2179 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
2180 Change all callers.
2181 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
2182 all callers.
2183 (class Sized_relobj): Update declarations.
2184 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
2185 parameter. Change all callers.
2186 (Sized_relobj::adjust_shndx): New function.
2187 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
2188 field.
2189 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
2190 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
2191 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
2192 (Sized_dynobj::read_dynsym_section): Adjust section links.
2193 (Sized_dynobj::read_dynamic): Likewise.
2194 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
2195 section links.
2196 (Sized_dynobj::do_initialize_xindex): New function.
2197 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
2198 do_initialize_xindex.
2199 (Sized_dynobj::adjust_shndx): New function.
2200 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
2201 dynsym_xindex_ fields.
2202 (Layout::finalize): Add a call to set_section_indexes before
2203 creating the symtab sections.
2204 (Layout::set_section_indexes): Don't do anything if the section
2205 already has a section index.
2206 (Layout::create_symtab_sections): Add shnum parameter. Change
2207 caller. Create .symtab_shndx section if needed.
2208 (Layout::create_shdrs): Add shstrtab_section parameter. Change
2209 caller.
2210 (Layout::allocated_output_section_count): New function.
2211 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
2212 needed.
2213 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
2214 fields. Update declarations.
2215 (Layout::symtab_xindex): New function.
2216 (Layout::dynsym_xindex): New function.
2217 (class Write_symbols_task): Add layout_ field.
2218 (Write_symbols_task::Write_symbols_task): Add layout parameter.
2219 Change caller.
2220 * output.cc (Output_section_headers::Output_section_headers): Add
2221 shstrtab_section parameter. Change all callers.
2222 (Output_section_headers::do_sized_write): Store overflow values
2223 for section count and section string table section index in
2224 section header zero.
2225 (Output_file_header::do_sized_write): Check for overflow of
2226 section count and section string table section index.
2227 (Output_symtab_xindex::do_write): New function.
2228 (Output_symtab_xindex::endian_do_write): New function.
2229 * output.h (class Output_section_headers): Add shstrtab_section_.
2230 Update declarations.
2231 (class Output_symtab_xindex): Define.
2232 (Output_section::has_out_shndx): New function.
2233 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
2234 field.
2235 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
2236 Change all callers.
2237 (Sized_symbol::init): Likewise.
2238 (Symbol::output_section): Check for ordinary symbol.
2239 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
2240 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
2241 callers.
2242 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
2243 Change all callers. Simplify handling of symbols from sections
2244 not included in the link.
2245 (Symbol_table::add_from_dynobj): Handle ordinary symbol
2246 distinction.
2247 (Weak_alias_sorter::operator()): Assert that symbols are
2248 ordinary.
2249 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
2250 distinction.
2251 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
2252 parameters. Change all callers.
2253 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
2254 symbol distinction. Use SHN_XINDEX when needed.
2255 (Symbol_table::write_section_symbol): Add symtab_xindex
2256 parameter. Change all callers.
2257 (Symbol_table::sized_write_section_symbol): Likewise. Use
2258 SHN_XINDEX when needed.
2259 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
2260 declarations.
2261 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
2262 (Symbol::is_defined): Check is_ordinary.
2263 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
2264 (Symbol::is_absolute, Symbol::is_common): Likewise.
2265 (class Sized_symbol): Update declarations.
2266 (class Symbol_table): Update declarations.
2267 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
2268 parameters. Change all callers.
2269 (Sized_symbol::override): Likewise.
2270 (Symbol_table::override): Likewise.
2271 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
2272 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
2273 is_ordinary, and orig_st_shndx parameters. Change all callers.
2274 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
2275 to be in an ordinary section.
2276 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
2277 object and is_ordinary parameters. Change all callers.
2278 (Sized_dwarf_line_info::read_relocs): Add object parameter.
2279 Change all callers. Don't add undefined or non-ordinary symbols
2280 to reloc_map_.
2281 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
2282 Change all callers.
2283 * dwarf_reader.h (class Sized_dwarf_line_info): Update
2284 declarations.
2285 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
2286 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
2287 (Sized_relobj::relocate_sections): Likewise.
2288 * target-reloc.h (scan_relocs): Adjust section symbol index.
2289 (scan_relocatable_relocs): Likewise.
2290 * i386.cc (Scan::local): Check for ordinary symbols.
2291 * sparc.cc (Scan::local): Likewise.
2292 * x86_64.cc (Scan::local): Likewise.
2293 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
2294 to symbol_section_and_value.
2295 * testsuite/many_sections_test.cc: New file.
2296 * testsuite/Makefile.am (BUILT_SOURCES): Define.
2297 (check_PROGRAMS): Add many_sections_test.
2298 (many_sections_test_SOURCES): Define.
2299 (many_sections_test_DEPENDENCIES): Define.
2300 (many_sections_test_LDFLAGS): Define.
2301 (BUILT_SOURCES): Add many_sections_define.h.
2302 (many_sections_define.h): New target.
2303 (BUILT_SOURCES): Add many_sections_check.h.
2304 (many_sections_check.h): New target.
2305 (check_PROGRAMS): Add many_sections_r_test.
2306 (many_sections_r_test_SOURCES): Define.
2307 (many_sections_r_test_DEPENDENCIES): Define.
2308 (many_sections_r_test_LDFLAGS): Define.
2309 (many_sections_r_test_LDADD): Define.
2310 (many_sections_r_test.o): New target.
2311 * testsuite/Makefile.in: Rebuild.
2312
c5818ff1
CC
23132008-04-17 Cary Coutant <ccoutant@google.com>
2314
2315 * errors.cc (Errors::info): New function.
2316 (gold_info): New function.
2317 * errors.h (Errors::info): New function.
2318 * gold.h (gold_info): New function.
2319 * object.cc (Input_objects::add_object): Print trace output.
2320 * options.cc (options::parse_set): New function.
2321 (General_options::parse_wrap): Deleted.
2322 (General_options::General_options): Deleted initializer.
2323 * options.h (options::String_set): New typedef.
2324 (options::parse_set): New function.
2325 (DEFINE_set): New macro.
2326 (General_options::wrap): Changed to use DEFINE_set. Changed
2327 callers of any_wrap_symbols and is_wrap_symbol.
2328 (General_options::trace, General_options::trace_symbol):
2329 New options.
2330 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
2331 (General_options::wrap_symbols_): Deleted.
2332 * symtab.cc (Symbol_table::add_from_object): Print trace output.
2333
b5be4a7c
DM
23342008-04-17 David S. Miller <davem@davemloft.net>
2335
2336 * options.cc (General_options::parse_V): New function.
2337 * options.h: Add entries for -V and -Qy.
2338
155a0dd7
ILT
23392008-04-17 Ian Lance Taylor <iant@google.com>
2340
2341 * common.cc (Symbol_table::allocate_commons): Remove options
2342 parameter. Change caller.
2343 (Symbol_table::do_allocate_commons): Remove options parameter.
2344 Change caller. Just call do_allocate_commons_list twice.
2345 (Symbol_table::do_allocate_commons_list): New function, broken out
2346 of do_allocate_commons.
2347 * common.h (class Allocate_commons_task): Remove options_ field.
2348 Update constructor.
2349 * symtab.cc (Symbol_table::Symbol_table): Initialize
2350 tls_commons_.
2351 (Symbol_table::add_from_object): Put TLS common symbols on
2352 tls_commons_ list.
2353 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
2354 which are IN_OUTPUT_DATA.
2355 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
2356 allocate_commons and do_allocate_commons declarations. Declare
2357 do_allocate_commons_list.
2358 * gold.cc (queue_middle_tasks): Update creation of
2359 Allocate_commons_task to not pass options.
2360 * testsuite/Makefile.am (INCLUDES): Add -I.. .
2361 (TLS_TEST_C_FLAGS): New variable.
2362 (tls_test_c_pic.o): New target.
2363 (tls_test_shared.so): Link in tls_test_c_pic.o.
2364 (tls_test_c_pic_ie.o): New target.
2365 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
2366 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
2367 (tls_test_c.o): New target.
2368 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
2369 (tls_pic_test_LDADD): Likewise.
2370 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
2371 (tls_shared_gd_to_ie_test_LDADD): Likewise.
2372 (tls_test_c_gnu2.o): New target.
2373 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
2374 tls_test_c_gnu2.o.
2375 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
2376 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
2377 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
2378 * testsuite/tls_test.cc: Include "config.h".
2379 (t_last): Call t11_last.
2380 * testsuite/tls_test.h (t11, t11_last): Declare.
2381 * testsuite/tls_test_c.c: New file.
2382 * testsuite/tls_test_main.cc (thread_routine): Call t11.
2383 * configure.ac: Check for OpenMP support.
2384 * configure, config.in, Makefile.in: Rebuild.
2385 * testsuite/Makefile.in: Rebuild.
2386
edfbb029
CC
23872008-04-16 Cary Coutant <ccoutant@google.com>
2388
2389 * i386.cc (Target_i386::define_tls_base_symbol): New function.
2390 (Target_i386::tls_base_symbol_defined_): New field.
2391 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
2392 (Target_i386::Scan::global): Likewise.
2393 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
2394 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
2395 (Target_x86_64::tls_base_symbol_defined_): New field.
2396 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
2397 (Target_x86_64::Scan::global): Likewise.
2398
f3c69fca
CC
23992008-04-16 Cary Coutant <ccoutant@google.com>
2400
2401 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
2402 (Symbol::needs_plt_entry): Allow weak undefined symbols.
2403 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
2404 building shared libraries.
2405 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
2406 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
2407 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
2408 * testsuite/Makefile.in: Rebuild.
2409 * testsuite/weak_undef.h: New file.
2410 * testsuite/weak_undef_file1.cc: Add extra test cases.
2411 * testsuite/weak_undef_file2.cc: Likewise.
2412 * testsuite/weak_undef_test.cc: Likewise.
2413
7c414435
DM
24142008-04-16 David S. Miller <davem@davemloft.net>
2415
32b769e1
DM
2416 * sparc.cc (Target_sparc::Scan): Change from struct to class.
2417 Add issued_non_pic_error_ field. Declare check_non_pic.
2418 (Target_sparc::Scan::check_non_pic): New function.
2419 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
2420 (Target_sparc::Scan::global): Likewise.
2421
11936fb1
DM
2422 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
2423 * configure: Rebuild.
2424
7c414435
DM
2425 * options.h (DEFINE_enable): New macro.
2426 (new_dtags): New enable option.
2427 (initfirst, interpose, loadfltr, nodefaultlib,
2428 nodelete, nodlopen, nodump): New -z options.
2429 * layout.cc (Layout:finish_dynamic_section): If new
2430 dtags enabled, emit DT_RUNPATH. Also, emit a
2431 DT_FLAGS_1 containing any specified -z flags.
2432
85c7bf8b
ILT
24332008-04-16 Ian Lance Taylor <iant@google.com>
2434
12c0daef
ILT
2435 * copy-relocs.cc: New file.
2436 * copy-relocs.h: New file.
2437 * reloc.cc: Remove Copy_relocs code.
2438 * reloc.h: Likewise.
2439 * reloc-types.h (struct Reloc_types) [both versions]: Add
2440 get_reloc_addend_noerror.
2441 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
2442 variants of add_global which take an addend which must be zero.
2443 * i386.cc: Include "copy-relocs.h".
2444 (class Target_i386): Change type of copy_relocs_ to variable,
2445 update initializer.
2446 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
2447 Change all callers.
2448 (Target_i386::do_finalize_sections): Change handling of
2449 copy_relocs_.
2450 * sparc.cc: Include "copy-relocs.h".
2451 (class Target_sparc): Change type of copy_relocs_ to variable,
2452 update initializer.
2453 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
2454 Change all callers.
2455 (Target_sparc::do_finalize_sections): Change handling of
2456 copy_relocs_.
2457 * x86_64.cc: Include "copy-relocs.h".
2458 (class Target_x86_64): Change type of copy_relocs_ to variable,
2459 update initializer.
2460 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
2461 class. Change all callers.
2462 (Target_x86_64::do_finalize_sections): Change handling of
2463 copy_relocs_.
2464 * Makefile.am (CCFILES): Add copy-relocs.cc.
2465 (HFILES): Add copy-relocs.h.
2466
4f4995b6
ILT
2467 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
2468
85c7bf8b
ILT
2469 * testsuite/script_test_4.sh: Permit leading zeroes.
2470
4f2a9edd
ILT
24712008-04-15 Ian Lance Taylor <iant@google.com>
2472
e6188289
ILT
2473 * script-sections.cc (Script_sections::create_segments): Use
2474 header_size_adjustment even when there is enough room for the
2475 headers.
2476 * testsuite/script_test_4.sh: New file.
2477 * testsuite/script_test_4.t: New file.
2478 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
2479 (check_DATA): Add script_test_4.stdout.
2480 (MOSTLYCLEANFILES): Likewise.
2481 (script_test_4): New target.
2482 (script_test_4.stdout): New target.
2483 * testsuite/Makefile.in: Rebuild.
2484
4f2a9edd
ILT
2485 * sparc.cc: Add definitions for Output_data_plt_sparc class
2486 constants.
2487
f5314dd5
DM
24882008-04-14 David S. Miller <davem@davemloft.net>
2489
2490 * sparc.cc: New file.
2491 * Makefile.am (TARGETSOURCES): Add sparc.cc
2492 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
2493 * configure.tgt: Document targ_extra_size and
2494 targ_extra_big_endian. Add entries for sparc-* and
2495 sparc64-*.
2496 * configure.ac: Handle targ_extra_size and
2497 targ_extra_big_endian.
2498 * Makefile.in: Rebuild.
2499 * configure: Likewise.
2500 * po/POTFILES.in: Likewise.
2501 * po/gold.pot: Likewise.
2502
154e0e9a
ILT
25032008-04-14 Ian Lance Taylor <iant@google.com>
2504
2505 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
2506 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
2507 in the name/type/flags to section mapping. Don't call
2508 allocate_output_section.
2509 (Layout::choose_output_section): Change parameter from adjust_name
2510 to is_input_section. Don't permit input sections after sections
2511 are attached to segments. Don't call allocate_output_section.
2512 (Layout::layout_eh_frame): Call update_flags_for_input_section,
2513 not write_enable_output_section.
2514 (Layout::make_output_section): Don't push to
2515 unattached_section_list_ nor call attach_to_segment. Call
2516 attach_section_to_segment if sections are attached.
2517 (Layout::attach_sections_to_segments): New function.
2518 (Layout::attach_section_to_segment): New function.
2519 (Layout::attach_allocated_section_to_segment): Rename from
2520 attach_to_segment. Remove flags parameter.
2521 (Layout::allocate_output_section): Remove function.
2522 (Layout::write_enable_output_section): Remove function.
2523 * layout.h (class Layout): Update for above changes. Add new
2524 field sections_are_attached_.
2525 * output.h (Output_section::update_flags_for_input_section): New
2526 function.
2527 * output.cc (Output_section::add_input_section): Call
2528 update_flags_for_input_section.
2529 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
2530
009a67a2
CC
25312008-04-11 Cary Coutant <ccoutant@google.com>
2532
2533 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
2534 thought unnecessary.
2535 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
2536
759b1a24
ILT
25372008-04-11 Ian Lance Taylor <iant@google.com>
2538
2539 * output.h (class Output_section_data): Remove inline definition
2540 of set_addralign.
2541 * output.cc (Output_section_data::set_addralign): New function.
2542
c2b45e22
CC
25432008-04-11 Cary Coutant <ccoutant@google.com>
2544
2545 Add support for TLS descriptors for i386 and x86_64.
2546 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
2547 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
2548 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
2549 GOT_TYPE_TLS_DESC.
2550 (Target_i386::got_mod_index_entry): Remove unnecessary code.
2551 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
2552 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
2553 relocations.
2554 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
2555 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
2556 Fix problem with initial-exec relocations.
2557 (Target_i386::Relocate::relocate_tls): Likewise.
2558 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
2559 relaxation.
2560 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
2561 support for section-plus-offset dynamic table entries.
2562 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
2563 (Output_data_dynamic::Dynamic_entry): Add support for
2564 section-plus-offset dynamic table entries.
2565 (Output_data_dynamic::Classification): Likewise.
2566 (Output_data_dynamic::classification_): Renamed offset_.
2567 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
2568 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
2569 (Target_x86_64::make_plt_section): New function.
2570 (Target_x86_64::reserve_tlsdesc_entries): New function.
2571 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
2572 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
2573 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
2574 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
2575 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
2576 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
2577 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
2578 add extra PLT entry for TLS descriptors.
2579 (Output_data_plt_x86_64::got_): New field.
2580 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
2581 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
2582 fields.
2583 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
2584 descriptors.
2585 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
2586 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
2587 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
2588 R_386_TLS_DESC_CALL relocations.
2589 (Target_x86_64::Scan::global): Likewise.
2590 (Target_x86_64::do_finalize_sections): Add dynamic table entries
2591 for TLS descriptors.
2592 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
2593 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
2594 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
2595 GD-to-IE relaxation.
2596 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
2597 and TLS_DESCRIPTORS.
2598 * Makefile.in: Rebuild.
2599 * configure: Rebuild.
2600 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
2601 (tls_test_shared2.so): New target.
2602 (tls_shared_gd_to_ie_test_SOURCES): New variable.
2603 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
2604 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
2605 (tls_shared_gd_to_ie_test_LDADD): New variable.
2606 (tls_shared_gnu2_gd_to_ie_test): New target.
2607 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
2608 New targets.
2609 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
2610 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
2611 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
2612 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
2613 (tls_shared_gnu2_test): New target.
2614 (tls_test_gnu2_shared.so): New target.
2615 (tls_shared_gnu2_test_SOURCES): New variable.
2616 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
2617 (tls_shared_gnu2_test_LDFLAGS): New variable.
2618 (tls_shared_gnu2_test_LDADD): New variable.
2619 * testsuite/Makefile.in: Rebuild.
2620 * testsuite/Makefile.
2621
83bfb6b7
ILT
26222008-04-11 Ian Lance Taylor <iant@google.com>
2623
2624 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
2625 justsyms.t.
2626 * testsuite/Makefile.in: Rebuild.
2627
2628 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
2629 long.
2630 * testsuite/script_test_2.cc (main): Adjust test.
2631
706e1f5e
ILT
26322008-04-11 David S. Miller <davem@davemloft.net>
2633 Ian Lance Taylor <iant@google.com>
2634
2635 * options.h (General_options): Add entries for '-Y' and
2636 '-relax'.
2637 * options.cc (General_options:finalize): If -Y was used, add those
2638 entries to the library path instead of the default "/lib" and
2639 "/usr/lib".
2640
7c98e6bb
DM
26412008-04-11 David S. Miller <davem@davemloft.net>
2642
2643 * testsuite/justsyms.t: Start at 0x100.
2644 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
83bfb6b7
ILT
2645 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
2646 long.
2647 * testsuite/script_test_2.cc: Adjust string and section length
2648 checks.
7c98e6bb 2649
99a37bfd
ILT
26502008-04-09 Ian Lance Taylor <iant@google.com>
2651
2cefc357
ILT
2652 PR gold/5996
2653 * script-sections.cc (Sections_element::allocate_to_segment): Add
2654 orphan parameter.
2655 (Output_section_definition::allocate_to_segment): Likewise.
2656 (Orphan_output_section::allocate_to_segment): Likewise.
2657 (Script_sections::attach_sections_using_phdrs_clause): Don't
2658 propagate non-PT_LOAD segments to orphan sections.
2659 * testsuite/Makefile.am (script_test_3.stdout): Generate using
2660 readelf rather than objdump.
2661 * testsuite/script_test_3.sh: Adjust accordingly. Test that
2662 .interp section and PT_INTERP segment are the same size.
2663 * testsuite/Makefile.in: Rebuild.
2664
99a37bfd
ILT
2665 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
2666 aliases for symbols defined in the same object.
2667 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
2668 (weak_alias_test_SOURCES): New variable.
2669 (weak_alias_test_DEPENDENCIES): New variable.
2670 (weak_alias_test_LDFLAGS): New variable.
2671 (weak_alias_test_LDADD): New variable.
2672 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
2673 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
2674 (weak_alias_test_3.o): New target.
2675 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
2676 * testsuite/weak_alias_test_main.cc: New file.
2677 * testsuite/weak_alias_test_1.cc: New file.
2678 * testsuite/weak_alias_test_2.cc: New file.
2679 * testsuite/weak_alias_test_3.cc: New file.
2680
780e49c5
ILT
26812008-04-08 Ian Lance Taylor <iant@google.com>
2682
cdb0b8f5
ILT
2683 * options.h (class General_options): Add --noinhibit-exec option.
2684 * main.cc (main): Check --noinhibit-exec.
2685
0864d551
ILT
2686 * options.h (class General_options): Define --wrap as a special
2687 option. Add wrap_symbols_ field.
2688 (General_options::any_wrap_symbols): New function.
2689 (General_options::is_wrap_symbol): New function.
2690 * options.cc (General_options::parse_wrap): New function.
2691 (General_options::General_options): Initialize wrap_symbols_.
2692 * symtab.cc (Symbol_table::wrap_symbol): New function.
2693 (Symbol_table::add_from_object): Handle --wrap.
2694 * symtab.h (class Symbol_table): Declare wrap_symbol.
2695 * target.h (Target::wrap_char): New function.
2696 (Target::Target_info): Add wrap_char field.
2697 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
2698 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2699 * testsuite/testfile.cc (Target_test::test_target_info):
2700 Likewise.
2701
789aa6de
ILT
2702 * errors.cc (Errors::undefined_symbol): Mention symbol version if
2703 there is one.
2704
2c38906f
ILT
2705 * layout.h (class Layout): Add added_eh_frame_data_ field.
2706 * layout.cc (Layout::Layout): Initialize new field.
2707 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
2708 output section until we find a section we merged successfully.
2709 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
2710 that the size be non-zero.
2711
780e49c5
ILT
2712 * merge.cc (Object_merge_map::get_output_offset): Remove inline
2713 qualifier.
2714
7fcd0256
ILT
27152008-04-08 Craig Silverstein <csilvers@google.com>
2716
2717 * configure.ac: Export new conditional variable HAVE_ZLIB.
2718 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
2719 on HAVE_ZLIB.
2720 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
2721 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
2722
6835af53
ILT
27232008-04-07 Ian Lance Taylor <iant@google.com>
2724
e24f324c
ILT
2725 * version.cc (version_string): Set to "1.5".
2726
a036edd8
ILT
2727 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
2728 Add issued_non_pic_error_ field. Declare check_non_pic.
2729 (Target_x86_64::Scan::check_non_pic): New function.
2730 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
2731 (Target_x86_64::Scan::global): Likewise.
2732
624f8810
ILT
2733 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
2734 addend parameter. Change caller. Handle merge sections.
2735 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
2736 Address to Addend. Don't add in the result of
2737 local_section_offset, pass down the addend and use the returned
2738 value.
2739 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
2740 Update declarations of local_section_offset and symbol_value.
2741 * testsuite/two_file_test_1.cc (t18): New function.
2742 * testsuite/two_file_test_2.cc (f18): New function.
2743 * testsuite/two_file_test_main.cc (main): Call t18.
2744 * testsuite/two_file_test.h (t18, f18): Declare.
2745
6835af53
ILT
2746 * configure.ac: Don't test for objdump, c++filt, or readelf.
2747 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
2748 conditionals.
2749 (TEST_READELF): New variable.
2750 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
2751 (check_PROGRAMS): Add two_file_strip_test.
2752 (two_file_strip_test): New target.
2753 (check_PROGRAMS): Add two_file_same_shared_strip_test.
2754 (two_file_same_shared_strip_test_SOURCES): New variable.
2755 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
2756 (two_file_same_shared_strip_test_LDFLAGS): New variable.
2757 (two_file_same_shared_strip_test_LDADD): New variable.
2758 (two_file_shared_strip.so): New target.
2759 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
2760 (ver_test_5.syms, ver_test_7.syms): Likewise.
2761 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
2762 (strip_test_3.stdout): Use TEST_OBJDUMP.
2763 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
2764
86925eef
CC
27652008-04-04 Cary Coutant <ccoutant@google.com>
2766
2767 * symtab.h (Symbol::is_weak_undefined): New function.
2768 (Symbol::is_strong_undefined): New function.
2769 (Symbol::is_absolute): New function.
2770 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
2771 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
2772 absolute symbols.
2773 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
2774 (weak_undef_test): New target.
2775 * testsuite/Makefile.in: Rebuild.
2776 * testsuite/weak_undef_file1.cc: New file.
2777 * testsuite/weak_undef_file2.cc: New file.
2778 * testsuite/weak_undef_test.cc: New file.
2779
126f3ece
ILT
27802008-04-03 Craig Silverstein <csilvers@google.com>
2781
2782 * compressed_output.h (class Output_compressed_section): Use
2783 unsigned buffer.
2784 * compressed_output.cc (zlib_compress): Use unsigned buffers,
2785 add zlib header.
2786 (zlib_compressed_suffix): Removed.
2787 (Output_compressed_section::set_final_data_size): Use unsigned
2788 buffers.
2789 * testsuite/Makefile.am (flagstest_compress_debug_sections):
2790 Fix linker invocation.
2791 (flagstest_o_specialfile_and_compress_debug_sections):
2792 Likewise.
2793 * testsuite/Makefile.in: Regenerated.
2794
deae2a14
DM
27952008-04-02 David S. Miller <davem@davemloft.net>
2796
2797 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
2798 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
2799
70752818
ILT
28002008-04-02 Craig Silverstein <csilvers@google.com>
2801
2802 * TODO: New file.
2803
39d0cb0e
ILT
28042008-04-02 Ian Lance Taylor <iant@google.com>
2805
2806 * fileread.cc (File_read::find_view): Add byteshift and vshifted
2807 parameters. Update for new key type to views_. Change all
2808 callers.
2809 (File_read::read): Adjust for byteshift in returned view.
2810 (File_read::add_view): New function, broken out of
2811 find_and_make_view.
2812 (File_read::make_view): New function, broken out of
2813 find_and_make_view.
2814 (File_read::find_or_make_view): Add offset and aligned
2815 parameters. Rewrite accordingly. Change all callers.
2816 (File_read::get_view): Add offset and aligned parameters. Adjust
2817 for byteshift in return value.
2818 (File_read::get_lasting_view): Likewise.
2819 * fileread.h (class File_read): Update declarations.
2820 (class File_read::View): Add byteshift_ field. Add byteshift to
2821 constructor. Add byteshift method.
2822 * archive.h (Archive::clear_uncached_views): New function.
2823 (Archive::get_view): Add aligned parameter. Change all callers.
2824 * object.h (Object::get_view): Add aligned parameter. Change all
2825 callers.
2826 (Object::get_lasting_view): Likewise.
2827
2828 * fileread.cc (File_read::release): Don't call clear_views if
2829 there are multiple objects.
2830 * fileread.h (File_read::clear_uncached_views): New function.
2831 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
2832 on the archive.
2833
a1207466
CC
28342008-03-31 Cary Coutant <ccoutant@google.com>
2835
2836 Add thin archive support.
2837 * archive.cc (Archive::armagt): New const.
2838 (Archive::setup): Remove task parameter and calls to unlock.
2839 (Archive::unlock_nested_archives): New function.
2840 (Archive::read_header): Add nested_off parameter. Change
2841 all callers.
2842 (Archive::interpret_header): Likewise.
2843 (Archive::include_all_members): Change to handle thin
2844 archives.
2845 (Archive::include_member): Likewise.
2846 * archive.h (Archive::Archive): Add new parameters and
2847 initializers.
2848 (Archive::armagt): New const.
2849 (Archive::setup): Remove task parameter.
2850 (Archive::unlock_nested_archives): New function.
2851 (Archive::read_header): Add nested_off parameter.
2852 (Archive::interpret_header): Likewise.
2853 (Archive::Nested_archive_table): New typedef.
2854 (Archive::is_thin_archive_): New field.
2855 (Archive::nested_archives_): New field.
2856 (Archive::options_): New field.
2857 (Archive::dirpath_): New field.
2858 (Archive::task_): New field.
2859 * readsyms.cc (Read_symbols::do_read_symbols): Add check
2860 for thin archives. Pass additional parameters to
2861 Archive::Archive. Unlock the archive file after calling
2862 Archive::setup.
cd536b21 2863
479f6503
ILT
28642008-03-29 Ian Lance Taylor <iant@google.com>
2865
686c8caf
ILT
2866 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
2867 version symbol to be local.
2868 * testsuite/ver_test_4.sh: New file.
2869 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
2870 (check_DATA): Add ver_test_4.syms.
2871 (ver_test_4.syms): New target.
2872 * testsuite/Makefile.in: Rebuild.
2873
ab794b6b
ILT
2874 * output.cc
2875 (Output_section::Input_section_sort_entry::has_priority): New
2876 function.
2877 (Output_section::Input_section_sort_entry::match_file_name): New
2878 function.
2879 (Output_section::Input_section_sort_entry::match_section_name):
2880 Remove.
2881 (Output_section::Input_section_sort_entry::match_section_name_prefix):
2882 Remove.
2883 (Output_section::Input_section_sort_entry::match_section_file):
2884 Remove.
2885 (Output_section::Input_section_sort_compare::operator()): Rewrite
2886 using new Input_section_sort_entry functions. Sort crtbegin and
2887 crtend first. Sort sections with no priority before sections with
2888 a priority.
2889 * testsuite/initpri1.c (d3): Check j != 4.
2890 (cd5): New constructor/destructor function.
2891 (main): Check j != 2.
2892
479f6503
ILT
2893 * symtab.cc (Symbol_table::add_from_object): If we don't use the
2894 new symbol when resolving, don't call set_is_default.
2895 * testsuite/ver_test_7.cc: New file.
2896 * testsuite/ver_test_7.sh: New file.
2897 * testsuite/Makefile.am (ver_test_7.so): New target.
2898 (ver_test_7.o): New target.
2899 (check_SCRIPTS): Add ver_test_7.sh.
2900 (check_DATA): Add ver_test_7.syms.
2901 (ver_test_7.syms): New target.
2902
2fd32231
ILT
29032008-03-28 Ian Lance Taylor <iant@google.com>
2904
2905 * layout.cc (Layout::layout): If we see an input section with a
2906 name that needs sorting, set the must_sort flag for the output
2907 section.
2908 (Layout::make_output_section): If the name of the output section
2909 indicates that it might require sorting, set the may_sort flag.
2910 * output.h (Output_section::may_sort_attached_input_sections): New
2911 function.
2912 (Output_section::set_may_sort_attached_input_sections): New
2913 function.
2914 (Output_section::must_sort_attached_input_sections): New
2915 function.
2916 (Output_section::set_must_sort_attached_input_sections): New
2917 function.
2918 (class Output_section): Declare Input_section_sort_entry. Define
2919 Input_section_sort_compare. Declare
2920 sort_attached_input_sections. Add new fields:
2921 may_sort_attached_input_sections_,
2922 must_sort_attached_input_sections_,
2923 attached_input_sections_are_sorted_.
2924 * output.cc (Output_section::Output_section): Initialize new
2925 fields.
2926 (Output_section::add_input_section): Add an entry to
2927 input_sections_ if may_sort or must_sort are true.
2928 (Output_section::set_final_data_size): Call
2929 sort_attached_input_sections if necessary.
2930 (Output_section::Input_section_sort_entry): Define new class.
2931 (Output_section::Input_section_sort_compare::operator()): New
2932 function.
2933 (Output_section::sort_attached_input_sections): New function.
2934 * configure.ac: Check whether the compiler supports constructor
2935 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
2936 * testsuite/initpri1.c: New file.
2937 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
2938 CONSTRUCTOR_PRIORITY.
2939 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
2940 (initpri1_LDFLAGS): New variable.
2941 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
2942
18e6b24e
ILT
29432008-03-27 Ian Lance Taylor <iant@google.com>
2944
49bdd526
ILT
2945 * common.cc (Sort_commons::operator): Correct sorting algorithm.
2946 * testsuite/common_test_1.c: New file.
2947 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
2948 (common_test_1_SOURCES): New variable.
2949 (common_test_1_DEPENDENCIES): New variable.
2950 (common_test_1_LDFLAGS): New variable.
2951
18e6b24e
ILT
2952 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
2953 and commons_ correctly when NAME/VERSION does not override
2954 NAME/NULL.
2955 * testsuite/ver_test_6.c: New file.
2956 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
2957 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
2958 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
2959
04bf7072
ILT
29602008-03-26 Ian Lance Taylor <iant@google.com>
2961
5871526f
ILT
2962 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
2963 of an undefined symbol from a version script.
2964 * testsuite/Makefile.am (ver_test_5.so): New target.
2965 (ver_test_5.o): New target.
2966 (check_SCRIPTS): Add ver_test_5.sh.
2967 (check_DATA): Add ver_test_5.syms.
2968 (ver_test_5.syms): New target.
2969 * testsuite/ver_test_5.cc: New file.
2970 * testsuite/ver_test_5.script: New file.
2971 * testsuite/ver_test_5.sh: New file.
2972 * Makefile.in, testsuite/Makefile.in: Rebuild.
2973
04bf7072
ILT
2974 PR gold/5986
2975 Fix problems building gold with gcc 4.3.0.
2976 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
2977 (gold_error_at_location, gold_warning_at_location): Use it.
2978 * configure.ac: Check whether we can compile and use a template
2979 function with a printf attribute.
2980 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
2981 when jumping over bytes.
2982 * object.cc: Instantiate Object::read_section_data.
2983 * debug.h: Include <cstring>
2984 * dwarf_reader.cc: Include <algorithm>
2985 * main.cc: Include <cstring>.
2986 * options.cc: Include <cstring>.
2987 * output.cc: Include <cstring>.
2988 * script.cc: Include <cstring>.
2989 * script.h: Include <string>.
2990 * symtab.cc: Include <cstring> and <algorithm>.
2991 * target-select.cc: Include <cstring>.
2992 * version.cc: Include <string>.
2993 * testsuite/testmain.cc: Include <cstdlib>.
2994 * configure, config.in: Rebuild.
2995
874c5b28
ILT
29962008-03-25 Ian Lance Taylor <iant@google.com>
2997
819d6c3a
ILT
2998 * options.cc: Include "../bfd/bfdver.h".
2999 (options::help): Print bug reporting address.
3000
f4b2c6f5
ILT
3001 * version.cc (print_version): Adjust output for current value of
3002 BFD_VERSION_STRING.
3003
3004 * NEWS: New file.
3005
e96caa79
ILT
3006 * options.cc (options::help): Print list of supported targets.
3007 * target-select.h: Include <vector>.
3008 (class Target_selector): Make machine_, size_, and is_big_endian_
3009 fields const. Add bfd_name_ and instantiated_target_ fields.
3010 (Target_selector::Target_selector): Add bfd_name parameter.
3011 (Target_selector::recognize): Make non-virtual, call
3012 do_recognize.
3013 (Target_selector::recognize_by_name): Make non-virtual, call
3014 do_recognize_by_name.
3015 (Target_selector::supported_names): New function.
3016 (Target_selector::bfd_name): New function.
3017 (Target_selector::do_instantiate_target): New pure virtual
3018 function.
3019 (Target_selector::do_recognize): New virtual function.
3020 (Target_selector::do_recognize_by_name): New virtual function.
3021 (Target_selector::instantiate_target): New private function.
3022 (supported_target_names): Declare.
3023 * target-select.cc (Target_selector::Target_selector): Update for
3024 new parameter and fields.
3025 (select_target_by_name): Check that the name matches before
3026 calling recognize_by_name.
3027 (supported_target_names): New function.
3028 * i386.cc (class Target_selector_i386): Update Target_selector
3029 constructor call. Remove recognize and recognize_by_name. Add
3030 do_instantiate_target.
3031 * x86_64.cc (class Target_selector_x86_64): Likewise.
3032 * testsuite/testfile.cc (class Target_selector_test): Update for
3033 changes to Target_selector.
3034
874c5b28
ILT
3035 * README: Rewrite, with some notes on unsupported features.
3036
0a65a3a7
CC
30372008-03-24 Cary Coutant <ccoutant@google.com>
3038
3039 * i386.cc (Target_i386::Got_type): New enum declaration.
3040 (Target_i386::Scan::local): Updated callers of Output_data_got
3041 member functions.
3042 (Target_i386::Scan::global): Likewise.
3043 (Target_i386::Relocate::relocate): Likewise.
3044 (Target_i386::Relocate::relocate_tls): Likewise.
3045 * object.h (Got_offset_list): New class.
3046 (Sized_relobj::local_has_got_offset): Added got_type parameter.
3047 (Sized_relobj::local_got_offset): Likewise.
3048 (Sized_relobj::set_local_got_offset): Likewise.
3049 (Sized_relobj::local_has_tls_got_offset): Removed.
3050 (Sized_relobj::local_tls_got_offset): Removed.
3051 (Sized_relobj::set_local_tls_got_offset): Removed.
3052 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
3053 * output.cc (Output_data_got::add_global): Added got_type parameter.
3054 (Output_data_got::add_global_with_rel): Likewise.
3055 (Output_data_got::add_global_with_rela): Likewise.
3056 (Output_data_got::add_global_pair_with_rel): New function.
3057 (Output_data_got::add_global_pair_with_rela): New function.
3058 (Output_data_got::add_local): Added got_type parameter.
3059 (Output_data_got::add_local_with_rel): Likewise.
3060 (Output_data_got::add_local_with_rela): Likewise.
3061 (Output_data_got::add_local_pair_with_rel): New function.
3062 (Output_data_got::add_local_pair_with_rela): New function.
3063 (Output_data_got::add_global_tls): Removed.
3064 (Output_data_got::add_global_tls_with_rel): Removed.
3065 (Output_data_got::add_global_tls_with_rela): Removed.
3066 (Output_data_got::add_local_tls): Removed.
3067 (Output_data_got::add_local_tls_with_rel): Removed.
3068 (Output_data_got::add_local_tls_with_rela): Removed.
3069 * output.h (Output_data_got::add_global): Added got_type parameter.
3070 (Output_data_got::add_global_with_rel): Likewise.
3071 (Output_data_got::add_global_with_rela): Likewise.
3072 (Output_data_got::add_global_pair_with_rel): New function.
3073 (Output_data_got::add_global_pair_with_rela): New function.
3074 (Output_data_got::add_local): Added got_type parameter.
3075 (Output_data_got::add_local_with_rel): Likewise.
3076 (Output_data_got::add_local_with_rela): Likewise.
3077 (Output_data_got::add_local_pair_with_rel): New function.
3078 (Output_data_got::add_local_pair_with_rela): New function.
3079 (Output_data_got::add_global_tls): Removed.
3080 (Output_data_got::add_global_tls_with_rel): Removed.
3081 (Output_data_got::add_global_tls_with_rela): Removed.
3082 (Output_data_got::add_local_tls): Removed.
3083 (Output_data_got::add_local_tls_with_rel): Removed.
3084 (Output_data_got::add_local_tls_with_rela): Removed.
3085 * resolve.cc (Symbol::override_base_with_special): Removed
3086 reference to has_got_offset_ field.
3087 * symtab.cc (Symbol::init_fields): Replaced initialization
3088 of got_offset_ with got_offsets_. Removed initialization
3089 of has_got_offset_
53fcba31 3090 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
0a65a3a7
CC
3091 (Symbol::got_offset): Likewise.
3092 (Symbol::set_got_offset): Likewise.
3093 (Symbol::has_tls_got_offset): Removed.
3094 (Symbol::tls_got_offset): Removed.
3095 (Symbol::set_tls_got_offset): Removed.
3096 (Symbol::got_offset_): Removed.
3097 (Symbol::tls_mod_got_offset_): Removed.
3098 (Symbol::tls_pair_got_offset_): Removed.
3099 (Symbol::got_offsets_): New field.
3100 (Symbol::has_got_offset): Removed.
3101 (Symbol::has_tls_mod_got_offset): Removed.
3102 (Symbol::has_tls_pair_got_offset): Removed.
3103 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
3104 (Target_x86_64::Scan::local): Updated callers of Output_data_got
3105 member functions.
3106 (Target_x86_64::Scan::global): Likewise.
3107 (Target_x86_64::Relocate::relocate): Likewise.
3108 (Target_x86_64::Relocate::relocate_tls): Likewise.
3109
bd52eafb
BE
31102008-03-25 Ben Elliston <bje@au.ibm.com>
3111
3112 * yyscript.y: Fix spelling error in comment.
3113
8b105e34
ILT
31142008-03-24 Ian Lance Taylor <iant@google.com>
3115
8ed814a9
ILT
3116 * options.h (class General_options): Define build_id option.
3117 * layout.h (class Layout): Declare write_build_id, create_note,
3118 create_build_id. Add build_id_note_ member.
3119 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
3120 "libiberty.h", "md5.h", "sha1.h".
3121 (Layout::Layout): Initialize eh_frame_data_,
3122 eh_frame_hdr_section_, and build_id_note_.
3123 (Layout::finalize): Call create_build_id.
3124 (Layout::create_note): New function, broken out of
3125 Layout::create_gold_note.
3126 (Layout::create_gold_note): Call create_note.
3127 (Layout::create_build_id): New function.
3128 (Layout::write_build_id): New function.
3129 (Close_task_runner::run): Call write_build_id.
3130
8b105e34
ILT
3131 * x86_64.cc: Correct license to GPLv3.
3132
086a1841
ILT
31332008-03-23 Ian Lance Taylor <iant@google.com>
3134
3135 * options.cc: Include "demangle.h".
3136 (parse_optional_string): New function.
3137 (parse_long_option): Handle takes_optional_argument.
3138 (parse_short_option): Update dash_z initializer. Handle
3139 takes_optional_argument.
3140 (General_options::General_options): Initialize do_demangle_.
3141 (General_options::finalize): Set do_demangle_. Handle demangling
3142 style.
3143 * options.h (parse_optional_string): Declare.
3144 (struct One_option): Add optional_arg field. Update constructor.
3145 Update call constructor calls. Add takes_optional_argument
3146 function.
3147 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
3148 (DEFINE_optional_string): Define.
3149 (General_options::demangle): Change from DEFINE_bool to
3150 DEFINE_optional_string.
3151 (General_options::no_demangle): New function.
3152 (General_options::do_demangle): New function.
3153 (General_options::set_do_demangle): New function.
3154 (General_options::execstack_status_): Move definition to end of
3155 class definition.
3156 (General_options::static_): Likewise.
3157 (General_options::do_demangle_): New field.
3158 * object.cc (big_endian>::get_symbol_location_info): Call
3159 Options::do_demangle, not Options::demangle.
3160 * symtab.cc (demangle): Likewise.
3161
cbb93e63
ILT
31622008-03-22 Ian Lance Taylor <iant@google.com>
3163
3164 * gold.h: Include <cstddef> and <sys/types.h>
3165 * options.h: Include <cstring>.
3166
ec531623
ILT
31672008-03-21 Ian Lance Taylor <iant@google.com>
3168
3169 * Added source code to GNU binutils.
This page took 0.195506 seconds and 4 git commands to generate.