2009-08-12 Sriraman Tallam <tmsriram@google.com>
[binutils-gdb.git] / gold / ChangeLog
1 2009-08-12 Sriraman Tallam <tmsriram@google.com>
2
3 * icf.cc (Icf::find_identical_sections): Issue a warning when a
4 symbol in the --keep-unique list is not found.
5
6 2009-08-12 Sriraman Tallam <tmsriram@google.com>
7
8 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
9 been maked as --keep-unique.
10 (Icf::unfold_section): New function.
11 * icf.h (Icf::unfold_section): New function.
12 * options.h (General_options::keep_unique): New option.
13 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
14 * testsuite/Makefile.in: Regenerate.
15 * testsuite/icf_keep_unique_test.sh: New file.
16 * testsuite/icf_keep_unique_test.cc: New file.
17
18 2009-08-12 Cary Coutant <ccoutant@google.com>
19
20 PR 10471
21 * resolve.cc (Symbol_table::resolve): Check for references from
22 dynamic objects to hidden and internal symbols.
23 * testsuite/Makefile.am (hidden_test.sh): New test.
24 * testsuite/Makefile.in: Regenerate.
25 * testsuite/hidden_test.sh: New script.
26 * testsuite/hidden_test_1.c: New test source.
27 * testsuite/hidden_test_main.c: New test source.
28
29 2009-08-11 Doug Kwan <dougkwan@google.com>
30
31 * arm.cc: Update comments.
32 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
33 segment to locate the .ARM.exidx section if present.
34
35 2009-08-09 Doug Kwan <dougkwan@google.com>
36
37 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
38 patch.
39
40 2009-08-07 Sriraman Tallam <tmsriram@google.com>
41 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
42 compiler warnings.
43
44 2009-08-06 Sriraman Tallam <tmsriram@google.com>
45
46 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
47 valid tls_segment only for non-debug-section relocations.
48 * testsuite/Makefile.am: Add gc_tls_test.
49 * testsuite/Makefile.in: Regenerate.
50 * testsuite/gc_tls_test.cc: New file.
51 * testsuite/gc_tls_test.sh: New file.
52
53 2009-08-05 Sriraman Tallam <tmsriram@google.com>
54
55 * icf.cc: New file.
56 * icf.h: New file.
57 * Makefile.am (CCFILES): Add icf.cc.
58 (HFILES): Add icf.h
59 * Makefile.in: Regenerate.
60 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
61 * gc.h (gc_process_relocs): Populate lists used by icf to contain
62 section, symbol and addend information for the relocs.
63 * gold.cc (queue_middle_tasks): Call identical code folding.
64 * gold.h: Add defines for multimap.
65 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
66 to the call of finalize_local_symbols.
67 * main.cc (main): Create object of class Icf.
68 * object.cc (Sized_relobj::do_layout): Allow this function to be
69 called twice during icf.
70 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
71 to sections marked as identical by icf.
72 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
73 when available.
74 (Sized_relobj::do_section_entsize): New function.
75 * object.h (Object::section_entsize): New function.
76 (Object::do_section_entsize): New pure virtual function.
77 (Relobj::finalize_local_symbols): Add new parameter.
78 (Relobj::do_section_entsize): New function.
79 * options.h (General_options::icf): New option.
80 (General_options::icf_iterations): New option.
81 (General_options::print_icf_sections): New option.
82 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
83 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
84 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
85 icf.
86 * symtab.cc (Symbol_table::is_section_folded): New function.
87 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
88 to sections marked as identical by icf.
89 * symtab.h (Symbol_table::set_icf): New function.
90 (Symbol_table::icf): New function.
91 (Symbol_table::is_section_folded): New function.
92 (Symbol_table::icf_): New data member.
93 * target-reloc.h (relocate_section): Ignore sections folded by icf.
94 * testsuite/Makefile.am: Add commands to build icf_test.
95 * testsuite/Makefile.in: Regenerate.
96 * testsuite/icf_test.sh: New file.
97 * testsuite/icf_test.cc: New file.
98
99 2009-07-24 Chris Demetriou <cgd@google.com>
100
101 * layout.cc (is_compressible_debug_section): Fix incorrect
102 comment about compressed section names.
103
104 2009-07-20 Ian Lance Taylor <ian@airs.com>
105
106 PR 10419
107 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
108
109 2009-07-16 Ian Lance Taylor <iant@google.com>
110
111 PR 10400
112 * layout.h: #include <map>.
113 (class Kept_section): Change from struct to class. Add accessors
114 and setters. Add section size to Comdat_group mapping. Change
115 Comdat_group to std::map. Add is_comdat_ field. Add
116 linkonce_size field in union.
117 (class Layout): Update declaration of find_or_add_kept_section.
118 Don't declare find_kept_object.
119 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
120 parameter. Add object, shndx, is_comdat, and is_group_name
121 parameters. Change all callers. Adjust for new Kept_section.
122 (Layout::find_kept_object): Remove.
123 * object.cc (Sized_relobj::include_section_group): Update use of
124 Kept_section. Rename secnum to shndx. Only record
125 Kept_comdat_section if sections are the same size.
126 (Sized_relobj::include_linkonce_section): Update use of
127 Kept_section. Only record Kept_comdat_section if sections are the
128 same size. Set size of linkonce section.
129 (Sized_relobj::map_to_kept_section): Update call to
130 get_kept_comdat_section.
131 * object.h (class Sized_relobj): Rename fields in
132 Kept_comdat_section to drop trailing underscores; change object
133 field to Relobj*. Change Kept_comdat_section_table to store
134 struct rather than pointer.
135 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
136 Add kept_object and kept_shndx parameters. Change all callers.
137 (Sized_relobj::get_kept_comdat_section): Change return type to
138 bool. Add kept_object and kept_shndx parameters. Change all
139 callers.
140 * plugin.cc (Pluginobj::include_comdat_group): Update call to
141 Layout::find_or_add_kept_section.
142
143 2009-07-09 Ian Lance Taylor <iant@google.com>
144
145 * merge.cc (Object_merge_map::initialize_input_to_output_map):
146 Reserve space in the hash table.
147
148 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
149
150 * fileread.cc (File_read::get_mtime): New method.
151 * fileread.h (Timespec): New structure.
152 (File_read::get_mtime): New method.
153 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
154 Renamed from timestamp_nsec.
155 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
156 Elf_Xword.
157 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
158 timestamp_nsec.
159 (Incremental_inputs::report_archive): Save mtime; style fix.
160 (Incremental_inputs::report_obejct): Save mtime; style fix.
161 (Incremental_inputs::report_script): Save mtime; style fix.
162 (Incremental_inputs::finalize_inputs): Style fix.
163 (Incremental_inputs::finalize): Style fix.
164 (Incremental_inputs::create_input_section_data): Store inputs
165 mtime.
166 * incremental.h (Incremental_inputs::report_script): Add mtime
167 argument.
168 (Incremental_inputs::Input_info::Input_info): Intialize only one
169 union member.
170 (Incremental_inputs::Input_info::archive): Move to nameless
171 union.
172 (Incremental_inputs::Input_info::obejct): Move to nameless union.
173 (Incremental_inputs::Input_info::script): Move to nameless union.
174 (Incremental_inputs::mtime): New field.
175 * script.cc (read_input_script): Pass file mtime to
176 Incremental_input.
177 * script.h (Script_info::inputs): Style fix.
178
179 2009-07-01 Ian Lance Taylor <ian@airs.com>
180
181 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
182 instead of 32.
183
184 2009-06-24 Ian Lance Taylor <iant@google.com>
185
186 PR 10156
187 * layout.cc (Layout::choose_output_section): If we find an
188 existing section, update the flags.
189 (Layout::create_notes): New function, broken out of
190 Layout::finalize.
191 (Layout::finalize): Don't create note sections.
192 (Layout::create_note): Don't crash if linker script discards
193 section.
194 (Layout::create_gold_note): Likewise.
195 (Layout::create_build_id): Likewise. Don't set
196 after_input_sections on the section.
197 (Layout::create_executable_stack_info): Remove target parameter.
198 Change caller.
199 * layout.h (class Layout): Declare create_notes. Update
200 declaration of create_executable_stack_info.
201 * gold.cc (queue_middle_tasks): Call create_notes.
202 * output.cc (Output_section::update_flags_for_input_section): Move
203 here from output.h. If SHF_ALLOC flag is newly set, mark address
204 invalid.
205 * output.h (Output_data::mark_address_invalid): New function.
206 (class Output_section): Only declare, not define,
207 update_flags_for_input_section. Remove set_flags.
208
209 2009-06-24 Ian Lance Taylor <iant@google.com>
210
211 * script-sections.cc (Output_section_definition::
212 set_section_addresses): Rename shadowing local load_address to
213 laddr.
214
215 2009-06-24 Ian Lance Taylor <iant@google.com>
216
217 PR 10244
218 * reloc.cc (relocate_sections): Skip empty relocation sections.
219
220 2009-06-23 Ian Lance Taylor <iant@google.com>
221
222 PR 10156
223 * layout.cc (Layout::create_note): Use choose_output_section
224 rather than make_output_section.
225
226 2009-06-23 Ian Lance Taylor <iant@google.com>
227
228 PR 10237
229 * options.cc (General_options::parse_V): Set printed_version_.
230 (General_options::General_options): Initialize printed_version_.
231 * options.h (class General_options): Add printed_version_ field.
232 * gold.cc (queue_initial_tasks): If there are no input files,
233 don't give a fatal error if we printed the version information.
234 (queue_middle_tasks): If using -r with a shared object, give a
235 fatal error rather than an ordinary error.
236
237 2009-06-23 Ian Lance Taylor <iant@google.com>
238
239 PR 10219
240 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
241 (Layout::make_output_section): Set have_stabstr_section_ if we see
242 a .stab*str section.
243 (Layout::finalize): Call link_stabs_sections.
244 (Layout::link_stabs_sections): New file.
245 * layout.h (class Layout): Add have_stabstr_section_ field.
246 Declare link_stabs_sections.
247
248 2009-06-23 Doug Kwan <dougkwan@google.com>
249
250 * Makefile.am (libgold_a_LIBADD): New.
251 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
252 * Makefile.in: Regenerate.
253 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
254 * configure: Regenerate.
255 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
256 * fileread.cc: Include sys/state.h
257 * gold.h: Declare memmem and strndup if found missing.
258 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
259
260 2009-06-23 Ian Lance Taylor <iant@google.com>
261
262 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
263 * configure: Rebuild.
264
265 2009-06-23 Ian Lance Taylor <iant@google.com>
266
267 PR 10147
268 * object.cc (Object::section_contents): Don't try to get a view if
269 the section has length zero.
270 (Object::handle_gnu_warning_section): If the section is empty, use
271 the name of the section as the warning.
272
273 2009-06-23 Ian Lance Taylor <iant@google.com>
274
275 PR 10133
276 * stringpool.h (class Stringpool_template): Add optimize_ field.
277 (Stringpool_template::set_optimize): New function.
278 * stringpool.cc (Stringpool_template::Stringpool_template):
279 Initialize optimize_ field.
280 (Stringpool_template::set_string_offsets): Test local optimize
281 fild rather than parameter.
282 * layout.cc (Layout::Layout): Call set_optimize on the section
283 name stringpool.
284
285 2009-06-22 Ian Lance Taylor <iant@google.com>
286
287 PR 10030
288 * yyscript.y: Parse TARGET.
289 * script.cc (script_set_target): New function.
290 * script-c.h (script_set_target): Declare.
291 * options.cc (General_options::string_to_object_format): Rename
292 from string_to_object_format in anonymous namespace. Change
293 callers.
294 * options.h (class General_options): Declare
295 string_to_object_format.
296
297 2009-06-22 Ian Lance Taylor <iant@google.com>
298
299 * script-sections.cc (Script_sections::create_segments): Don't put
300 program headers in a PT_LOAD segment if -n or -N.
301
302 2009-06-22 Ian Lance Taylor <iant@google.com>
303
304 PR 10141
305 * options.h (class General_options): Add -z lazy and -z now. Sort
306 -z options into alphabetical order.
307 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
308
309 2009-06-21 Ian Lance Taylor <iant@google.com>
310
311 * layout.cc (Layout::make_output_section): Call
312 Target::new_output_section.
313 (Layout::attach_allocated_section_to_segment): Put large section
314 sections in a separate load segment with the large segment flag
315 set.
316 (Layout::segment_precedes): Sort large data segments after other
317 load segments.
318 (align_file_offset): New static function.
319 (Layout::set_segment_offsets): Use align_file_offset.
320 * output.h (class Output_section): Add is_small_section_ and
321 is_large_section_ fields.
322 (Output_section::is_small_section): New function.
323 (Output_section::set_is_small_section): New function.
324 (Output_section::is_large_section): New function.
325 (Output_section::set_is_large_section): New function.
326 (Output_section::is_large_data_section): New function.
327 (class Output_segment): Add is_large_data_segment_ field.
328 (Output_segment::is_large_data_segment): New function.
329 (Output_segment::set_is_large_data_segment): New function.
330 * output.cc (Output_section::Output_section): Initialize new
331 fields.
332 (Output_segment::Output_segment): Likewise.
333 (Output_segment::add_output_section): Add assertion that large
334 data sections always go in large data segments. Force small data
335 sections to the end of the list of data sections. Force small BSS
336 sections to the start of the list of BSS sections. For large BSS
337 sections to the end of the list of BSS sections.
338 * symtab.h (class Symbol): Declare is_common_shndx.
339 (Symbol::is_defined): Check Symbol::is_common_shndx.
340 (Symbol::is_common): Likewise.
341 (class Symbol_table): Define enum Commons_section_type. Update
342 declarations. Add small_commons_ and large_commons_ fields.
343 * symtab.cc (Symbol::is_common_shndx): New function.
344 (Symbol_table::Symbol_table): Initialize new fields.
345 (Symbol_table::add_from_object): Put small and large common
346 symbols in the right list.
347 (Symbol_table::sized_finalized_symbol): Check
348 Symbol::is_common_shndx.
349 (Symbol_table::sized_write_globals): Likewise.
350 * common.cc (Symbol_table::do_allocate_commons): Allocate new
351 common symbol lists. Don't call do_allocate_commons_list if the
352 list is empty.
353 (Symbol_table::do_allocate_commons_list): Remove is_tls
354 parameter. Add comons_section_type parameter. Change all
355 callers. Handle small and large common symbols.
356 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
357 Symbol::is_common_shndx.
358 * resolve.cc (symbol_to_bits): Likewise.
359 * target.h (Target::small_common_shndx): New function.
360 (Target::small_common_section_flags): New function.
361 (Target::large_common_shndx): New function.
362 (Target::large_common_section_flags): New function.
363 (Target::new_output_section): New function.
364 (Target::Target_info): Add small_common_shndx, large_common_shndx,
365 small_common_section_flags, and large_common_section_flags
366 fields.
367 (Target::do_new_output_section): New virtual function.
368 * arm.cc (Target_arm::arm_info): Initialize new fields.
369 * i386.cc (Target_i386::i386_info): Likewise.
370 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
371 Likewise.
372 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
373 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
374 (Target_x86_64::do_new_output_section): New function.
375 * configure.ac: Define conditional MCMODEL_MEDIUM.
376 * testsuite/Makefile.am (check_PROGRAMS): Add large.
377 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
378 (large_LDFLAGS): Define.
379 * testsuite/large.c: New file.
380 * testsuite/testfile.cc (Target_test::test_target_info):
381 Initialize new fields.
382 * configure, testsuite/Makefile.in: Rebuild.
383
384 2009-06-05 Doug Kwan <dougkwan@google.com>
385
386 * Makefile.am (CCFILES): Add target.cc.
387 * Makefile.in: Regenerate.
388 * i386.cc (class Target_i386): Define new virtual method to
389 override do_is_local_label_name in parent.
390 * object.cc (Sized_relobj::do_count_local_symbols): Discard
391 local symbols if --discard-locals or -X is given.
392 * options.h (class General_options): Declare new options
393 '--discard-locals' and '-X' for discarding locals.
394 * target.h (class Target): Define new methods is_local_label_name.
395 Declare new virtual method do_is_local_label_name.
396 * target.cc: New file.
397 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
398 (check_SCRIPTS): Add discard_locals_test.sh.
399 (check_DATA): Add discard_local_tests.syms.
400 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
401 (discard_local_tests.syms, discard_locals_test.o): New make rules.
402 * testsuite/Makefile.in: Regenerate.
403 * testsuite/discard_locals_test.c: New file.
404 * testsuite/discard_locals_test.sh: Same.
405
406 2009-06-05 Doug Kwan <dougkwan@google.com>
407
408 * object.cc (Sized_relobj::Sized_relobj): Initialize
409 discarded_eh_frame_shndx_ to -1U.
410 (Sized_relobj::do_layout): Record index of a discard .eh_frame
411 section.
412 (Sized_relobj::do_count_local_symbols): Skip local symbols in
413 a discarded .eh_frame section.
414 (Sized_relobj::do_finalize_local_symbols): Ditto.
415 * object.h (class Sized_relobj): Declare new member
416 discarded_eh_frame_shndx_.
417 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
418 (local_labels_test.o, local_labels_test): New rules.
419 * testsuite/Makefile.in: Regenerate.
420
421 2009-06-04 Doug Kwan <dougkwan@google.com>
422
423 * layout.cc (Layout::section_name_mapping): Add mapping for
424 special ARM sections.
425
426 2009-06-03 Doug Kwan <dougkwan@google.com>
427
428 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
429 (utils::has_overflow): Same.
430
431 2009-06-03 Ian Lance Taylor <iant@google.com>
432
433 * layout.cc (Layout::section_name_mapping): New array, replacing
434 Layout::linkonce_mapping.
435 (Layout::section_name_mapping_count): New variable, replacing
436 Layout::linkonce_mapping_count.
437 (Layout::linkonce_output_name): Remove.
438 (Layout::output_section_name): Rewrite.
439 * layout.h (class Layout): Rename Linkonce_mapping to
440 Section_name_mapping, linkonce_mapping to section_name_mapping,
441 linkonce_mapping_count to section_name_mapping_count. Don't
442 declare linkonce_output_name.
443
444 2009-06-03 Doug Kwan <dougkwan@google.com>
445
446 * gold/arm.cc (namespace utils): New.
447 (Target_arm::reloc_is_non_pic): Define new method.
448 (class Arm_relocate_functions): New.
449 (Target_arm::Relocate::relocate): Handle relocation types used by
450 Android.
451
452 2009-06-03 Ian Lance Taylor <iant@google.com>
453
454 * arm.cc (Target_arm::scan::global): Use || instead of |.
455
456 2009-06-02 Doug Kwan <dougkwan@google.com>
457
458 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
459 issued_non_pic_error_.
460 (class Target_arm::Scan): Declare new method check_non_pic.
461 Define new method symbol_needs_plt_entry.
462 Declare new data member issued_non_pic_error_.
463 (class Target_arm::Relocate): Declare new method
464 should_apply_static_reloc.
465 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
466 (Target_arm::Scan::check_non_pic): Define new method.
467 (Target_arm::Scan::local): Handle a small subset of reloc types used
468 by Android.
469 (Target_arm::Scan::local): Same.
470 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
471
472 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
473
474 * incremental.cc (Incremental_inputs::report_command_line): Filter
475 out --incremental-* options.
476
477 2009-05-29 Doug Kwan <dougkwan@google.com>
478
479 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
480 template class.
481 (class Target_arm): Update comment.
482 (Target_arm::Target_arm): Initialize new data members GOT_,
483 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
484 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
485 and Target_arm::rel_dyn_section.
486 Declare new_enum Target_arm::Got_type.
487 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
488 and DYNBSS_.
489 Update commments for member do_dynsym_value.
490 (Target_arm::got_size, Target_arm::plt_section,
491 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
492 new methods inside class defintion.
493 (Target_arm::got_section): Define new method.
494 (Target_arm::rel_dyn_section): Same.
495 (Output_data_plt_arm): New template class.
496 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
497 (Output_data_plt_arm:do_adjust_output_section): Define new method.
498 (Output_data_plt_arm::add_entry): Same.
499 (Output_data_plt_arm::first_plt_entry): Define new
500 static data member for PLT instruction template.
501 (Output_data_plt_arm::plt_entry): Same.
502 (Output_data_plt_arm::do_write): Define new method.
503 (Target_arm::make_plt_entry): Same.
504 (Target_arm::do_finalize_sections): Same.
505 (Target_arm::do_dynsym_value): Same.
506
507 2009-05-28 Doug Kwan <dougkwan@google.com>
508
509 * Makefile.am (TARGETSOURCES): Add arm.cc.
510 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
511 * Makefile.in: Regenerate.
512 * arm.cc: New file.
513 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
514
515 2009-05-26 Doug Kwan <dougkwan@google.com>
516
517 * options.cc (General_options::parse_exclude_libs). Fix a comment.
518 (General_options::check_excluded_libs): Strip off directories in
519 archive name before matching like GNU ld does.
520 * testsuite/Makefile.am (MOSTLYCLEANFILES,
521 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
522 (exclude_libs_test_LDFLAGS): Add linker option
523 -Wl,--exclude-libs,libexclude_libs_test_3
524 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
525 an explicit archive without using -l.
526 (alt/libexclude_libs_test_3.a): New make rule.
527 * testsuite/Makefile.in: Regenerate.
528 * testsuite/exclude_libs_test.c : Declare lib3_default().
529 (main): Call it.
530 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
531 * exclude_libs_test_3.c: New file.
532
533 2009-05-26 Nick Clifton <nickc@redhat.com>
534
535 * po/id.po: New Indonesian translation.
536 * po/gold.pot: Updated template file.
537
538 2009-05-22 Sriraman Tallam <tmsriram@google.com>
539
540 * testsuite/Makefile.am: Add -ffunction-sections to compile
541 gc_comdat_test files. Add -Wl,--gc-sections to build
542 gc_comdat_test.
543 * testsuite/Makefile.in: Regenerate.
544 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
545
546 2009-05-21 Sriraman Tallam <tmsriram@google.com>
547
548 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
549 kept comdat section was garbage collected.
550 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
551 * testsuite/Makefile.in: Regenerate.
552 * testsuite/gc_comdat_test.sh: New file.
553 * testsuite/gc_comdat_test_1.cc: New file.
554 * testsuite/gc_comdat_test_2.cc: New file.
555
556 2009-05-19 Doug Kwan <dougkwan@google.com>
557
558 * archive.cc (Archive::Archive): Move constructor from archive.h
559 to here. Initialize no_export_.
560 (Archive::get_elf_object_for_member): Set no_export flag of object.
561 * archive.h (Archive::Archive): Move constructor body to
562 archive.cc.
563 (Archive::no_export): New method.
564 (Archive::no_export_): New field.
565 * object.h (Object::Object): Initialize no_export_ to false.
566 (Object::no_export, Object::set_no_export): New methods.
567 (Object::no_export_): New field.
568 * options.cc (General_options::parse_exclude_libs): New method.
569 (General_options::check_excluded_libs) Same.
570 * options.h (exclude_libs): New option.
571 (General_options::check_excluded_libs): New method declaration.
572 (General_options::excluded_libs_): New field.
573 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
574 default or protected visibility if an object has no-export flag set.
575 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
576 (check_SCRIPTS): Add exclude_libs_test.sh.
577 (check_DATA): Add exclude_libs_test.syms.
578 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
579 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
580 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
581 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
582 (exclude_libs_test.syms, libexclude_libs_test_1.a,
583 libexclude_libs_test_2.a): New rules.
584 * testsuite/Makefile.in: Regenerate.
585 * testsuite/exclude_libs_test.c: New file.
586 * testsuite/exclude_libs_test.sh: Ditto.
587 * testsuite/exclude_libs_test_1.c: Ditto.
588 * testsuite/exclude_libs_test_2.c: Ditto.
589
590 2009-05-15 Ian Lance Taylor <iant@google.com>
591
592 * configure.ac: Check for declarations for cases where libiberty.h
593 checks HAVE_DECL_xxx.
594 * configure, config.in: Rebuild.
595
596 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
597
598 * gold.h (Incremental_argument_list): Remove (invalid) forward
599 declaration.
600 * incremental.cc (Incremental_inputs::report_achive): New method.
601 (Incremental_inputs::report_object): New method.
602 (Incremental_inputs::report_script): New method.
603 (Incremental_inputs::finalize_inputs): New method.
604 (Incremental_inputs::finalize): Call finalize_inputs().
605 (Incremental_inputs::sized_create_incremental_inputs_section_data):
606 Create inputs entries.
607 * incremental.h (Incremental_input_type): New enum.
608 (Incremental_inputs::Incremental_input): Initialize new fields.
609 (Incremental_inputs::report_inputs): New method.
610 (Incremental_inputs::report_achive): New method.
611 (Incremental_inputs::report_object): New method.
612 (Incremental_inputs::report_script): New method.
613 (Incremental_inputs::finalize_inputs): New method.
614 (Incremental_inputs::Input_info): New struct.
615 (Incremental_inputs::Input_info_map): New typedef.
616 (Incremental_inputs::lock_): New field.
617 (Incremental_inputs::Inputs_): New field.
618 (Incremental_inputs::Inputs_map): New field.
619 * main.cc (main): Call Incremental_input::report_inputs.
620 * options.h (Input_argument_list): Typedef moved from
621 Input_arguments.
622 (Input_file_group::Files): Remove, use ::Input_argument_list.
623 (Input_file_group::Input_argument_list): Remove, use
624 ::Input_argument_list.
625 * plugin.cc (Plugin_manager::add_input_file): Add error in
626 incremental build.
627 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
628 functions.
629 * script.cc (read_input_script): Call
630 Incremental_input::report_script.
631 * script.h (Script_info): New class.
632
633 2009-04-27 Ian Lance Taylor <iant@google.com>
634
635 * x86_64.cc (do_adjust_output_section): Set entsize to
636 plt_entry_size.
637
638 2009-04-23 Elliott Hughes <enh@google.com>
639
640 * output.cc (Output_file::close): After short writes, continue
641 writing from the correct offset in the buffer being written.
642
643 2009-04-23 Chris Demetriou <cgd@google.com>
644
645 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
646 * configure: Regenerate.
647 * config.in: Regenerate.
648 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
649 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
650
651 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
652
653 * incremental.cc (Incremental_inputs_header_data): Renamed from
654 Incremental_input_header_data.
655 (Incremental_inputs_header_data::data_size): New field.
656 (Incremental_inputs_header_data::put_input_file_count): Renamed
657 from input_file_count.
658 (Incremental_inputs_header_data::put_command_line_offset): Renamed
659 from command_line_offset.
660 (Incremental_inputs_header_data::put_reserved): Renamed from
661 put_reserved.
662 (Incremental_inputs_entry_data): Renamed from
663 Incremental_input_entry_data.
664 (Incremental_inputs_entry_data::data_size): New field.
665 (Incremental_inputs::report_command_line): New method.
666 (Incremental_inputs::finalize): New method.
667 (Incremental_inputs::create_incremental_inputs_data): New method.
668 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
669 * incremental.h: New file.
670 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
671 (Layout::finalize): Create incremental inputs section in
672 incremental builds.
673 (Layout::create_incremental_info_sections): New method.
674 * layout.h (Layout::incremental_inputs): New method.
675 (Layout::create_incremental_info_sections): New method.
676 (Layout::incremental_inputs_): New field.
677 * main.cc (main): Notify Incremental_input of the command line.
678
679 2009-04-01 Ian Lance Taylor <iant@google.com>
680 Mikolaj Zalewski <mikolajz@google.com>
681
682 * gold.h (reserve_unordered_map): Define, three versions, one for
683 each version of Unordered_map.
684 * layout.cc (Layout::Layout): Remove options parameter. Add
685 number_of_input_files parameter. Don't initialize options_.
686 Initialize number_of_input_files_ and resized_signatures_. Move
687 sections_are_attached_.
688 (Layout::layout_group): Reserve space for group_signatures_.
689 (Layout::find_or_add_kept_section): Change name parameter to be a
690 reference. Resize signatures_ map when it gets large enough.
691 (Layout::layout_eh_frame): Use parameters->options() instead of
692 this->options_.
693 (Layout::make_output_section): Likewise.
694 (Layout::attach_allocated_section_to_segment): Likewise.
695 (Layout::finalize, Layout::create_executable_stack): Likewise.
696 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
697 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
698 * layout.h (class Layout): Update declarations. Remove options_
699 field. Add number_of_input_files_ and resized_signatures_
700 fields. Move sections_are_attached_ field.
701 * main.cc (main): Pass number of input files to Layout
702 constructor. Don't pass options.
703
704 2009-03-30 Ian Lance Taylor <iant@google.com>
705
706 * ffsll.c (ffsll): Correct implementation.
707
708 2009-03-27 Ian Lance Taylor <iant@google.com>
709
710 * ffsll.c: New file.
711 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
712 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
713 * ftruncate.c (ftruncate): Declare before definition.
714 * mremap.c (mremap): Likewise.
715 * pread.c (pread): Likewise.
716 * configure, Makefile.in, config.in: Rebuild.
717
718 * mremap.c: New file.
719 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
720 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
721 (mremap): Declare if HAVE_MREMAP is not defined.
722 * configure, Makefile.in, config.in: Rebuild.
723
724 2009-03-27 Cary Coutant <ccoutant@google.com>
725
726 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
727 position independent.
728 * sparc.cc (Target_sparc::check_non_pic): Likewise.
729 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
730
731 2009-03-24 Cary Coutant <ccoutant@google.com>
732
733 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
734 an executable.
735 (needs_dynamic_reloc): Likewise.
736
737 2009-03-24 Ian Lance Taylor <iant@google.com>
738
739 * yyscript.y (file_cmd): Recognize EXTERN.
740 (extern_name_list, extern_name_list_body): New nonterminals.
741 * script.cc (script_add_extern): Define.
742 * script-c.h (script_add_extern): Declare.
743
744 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
745
746 * object.cc (is_elf_object): Define.
747 * object.h (is_elf_object): Declare.
748 * archive.cc (Archive::get_elf_object_for_member): Call
749 is_elf_object.
750 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
751
752 2009-03-24 Elliott Hughes <enh@google.com>
753
754 * output.cc (Output_file::map_anonymous): Define.
755 (Output_file::map): Use map_anonymous. If the regular mmap fails,
756 try an anonymous one. Report the size if the mmap fails.
757 * output.h (class Output_file): Declare map_anonymous.
758
759 2009-03-24 Ian Lance Taylor <iant@google.com>
760
761 * target-select.cc (instantiate_target): Don't acquire the lock if
762 the instantiated_target_ field has already been set.
763
764 2009-03-23 Ian Lance Taylor <iant@google.com>
765
766 * gold-threads.h (class Initialize_lock): Define.
767 * gold-threads.cc (class Initialize_lock_once): Define.
768 (initialize_lock_control): New static variable.
769 (initialize_lock_pointer): New static variable.
770 (initialize_lock_once): New static function.
771 (Initialize_lock::Initialize_lock): Define.
772 (Initialize_lock::initialize): Define.
773 * target-select.h: Include "gold-threads.h".
774 (class Target_selector): Add lock_ and initialize_lock_ fields.
775 Don't define instantiate_target, just declare it.
776 * target-select.cc (Target_selector::Target_selector): Initialize
777 new fields.
778 (Target_selector::instantiate_target): Define.
779 * descriptors.h: Include "gold-threads.h".
780 (class Descriptors): Add initialize_lock_ field.
781 * descriptors.cc (Descriptors::Descriptors): Initialize new
782 field.
783 (Descriptors::open): Use initialize_lock_ field
784 * errors.h (class Errors): Add initialize_lock_ field.
785 * errors.cc (Errors::Errors): Initialize new field.
786 (Errors::initialize_lock): Use initialize_lock_ field.
787 * powerpc.cc (class Target_selector_powerpc): Remove
788 instantiated_target_ field. In do_recognize call
789 instantiate_target rather than do_instantiate_target. In
790 do_instantiate_target just allocate a new target.
791 * sparc.cc (class Target_selector_sparc): Likewise.
792
793 * freebsd.h: New file.
794 * i386.cc: Include "freebsd.h".
795 (Target_i386): Derive from Target_freebsd rather than
796 Sized_target.
797 (Target_selector_i386): Derive from Target_selector_freebsd rather
798 than Target_selector.
799 * x86_64.cc: Include "freebsd.h".
800 (Target_x86_64): Derive from Target_freebsd rather than
801 Sized_target.
802 (Target_selector_x86_64): Derive from Target_selector_freebsd
803 rather than Target_selector.
804 * target.h (class Target): Add adjust_elf_header and
805 do_adjust_elf_header.
806 * output.cc (Output_file_header:: do_sized_write): Call target
807 adjust_elf_header routine.
808 * configure.tgt: Set targ_osabi.
809 * configure.ac: Define GOLD_DEFAULT_OSABI.
810 * parameters.cc (Parameters::default_target): Pass
811 GOLD_DEFAULT_OSABI to select_target.
812 * target-select.h (class Target_selector): Make instantiate_target
813 protected rather than private.
814 * Makefile.am (HFILES): Add freebsd.h.
815 * configure, Makefile.in, config.in: Rebuild.
816
817 * merge.cc (do_add_input_section): Correct pend value. Change
818 message about last entry not being null terminated from error to
819 warning.
820
821 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
822
823 * incremental.cc: New file.
824 * Makefile.am (CCFILES): Add incremental.cc.
825 * Makefile.in: Rebuild.
826
827 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
828
829 * layout.cc (Layout::output_section_name): Preserve names
830 of '.note.' sections.
831
832 2009-03-19 Ian Lance Taylor <iant@google.com>
833
834 * descriptors.cc (Descriptors::open): Check that the options are
835 valid before using them.
836
837 2009-03-18 Ian Lance Taylor <iant@google.com>
838
839 * script-sections.h: Include <list>.
840 (class Script_sections): Change Sections_elements from std::vector
841 to std::list. Typedef public Elements_iterator. Add
842 orphan_section_placement_, data_segment_align_start_, and
843 saw_data_segment_align_ fields. Remove data_segment_align_index_
844 field.
845 * script-sections.cc (class Orphan_section_placement): New class.
846 (class Sections_element): Add virtual functions is_relro and
847 orphan_section_init. Remove virtual function place_orphan_here.
848 (class Output_section_definition): Add is_relro and
849 orphan_section_init. Remove place_orphan_here.
850 (class Orphan_output_section): Likewise.
851 (Script_sections::Script_sections): Update for field changes.
852 (Script_sections::data_segment_align): Set saw_data_segment_align_
853 and data_segment_align_start_, not data_segment_align_index.
854 (Script_sections::data_segment_relro_end): Check
855 saw_data_segment_align_. Use data_segment_align_start_ rather
856 than data_segment_align_index_.
857 (Script_sections::place_orphan): Rewrite to use
858 Orphan_section_placement.
859
860 2009-03-17 Ian Lance Taylor <iant@google.com>
861
862 * archive.cc (Archive::add_symbols): Check for a version attached
863 to the symbol name in the archive map.
864 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
865 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
866 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
867 (ver_test_11.a): New target.
868 * testsuite/Makefile.in: Rebuild.
869
870 * configure.ac: Check for chsize and posix_fallocate. Replace
871 ftruncate.
872 * ftruncate.c: New file, from gnulib.
873 * output.cc (posix_fallocate): Define dummy version if not
874 HAVE_POSIX_FALLOCATE.
875 (Output_file::map): Call posix_fallocate rather than lseek and
876 write.
877 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
878 * configure, Makefile.in, config.in: Rebuild.
879
880 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
881
882 * layout.h (Layout::create_note): Add section_name parameter.
883 * layout.cc (Layout::create_note): Likewise.
884 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
885
886 2009-03-17 Ian Lance Taylor <iant@google.com>
887
888 * descriptors.cc: Include "options.h".
889 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
890 (Descriptors::open): Always use O_CLOEXEC when opening a new
891 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
892 then set FD_CLOEXEC.
893
894 * sparc.cc (class Target_sparc): Add has_got_section.
895 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
896 make sure we have a GOT section.
897
898 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
899 (Target_sparc::Scan::local): Likewise.
900 (Target_sparc::Scan::global): Likewise.
901 (Target_sparc::Relocate::relocate): Likewise.
902 (Target_sparc::Relocate::relocate_tls): Likewise.
903
904 * symtab.cc (Symbol_table::define_default_version): New function,
905 broken out of add_from_object.
906 (Symbol_table::add_from_object): Call define_default_version.
907 (Symbol_table::define_special_symbol): Add resolve_oldsym
908 parameter. Change all callers. If the version for a symbol comes
909 from a version script, resolve it with the symbol with the same
910 name with no version. Also add the symbol without a version if
911 appropriate.
912 (do_define_in_output_data): If resolving with oldsym, don't delete
913 sym.
914 (do_define_in_output_segment): Likewise.
915 (do_define_as_constant): Likewise.
916 * symtab.h (class Symbol_table): Update declarations.
917
918 2009-03-13 Ian Lance Taylor <iant@google.com>
919
920 * readsyms.cc (Read_symbols::incompatible_warning): New function.
921 (Read_symbols::requeue): New function.
922 (Read_symbols::do_read_symbols): If make_elf_object fails because
923 the target type is not configured, and the file was searched for,
924 issue a warning and retry with the next directory.
925 (Add_symbols::run): If the file has an incompatible format, and
926 it was searched for, requeue the Read_symbols task. On error,
927 release the object.
928 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
929 dirindex parameter to constructor. Change all callers. Declare
930 incompatible_warning and requeue.
931 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
932 input_argument_ and input_group_ fields. Add them to
933 constructor. Change all callers.
934 (class Read_script): Add dirindex_ field. Add it to constructor.
935 Change all callers.
936 * archive.cc (Archive::setup): Remove input_objects parameter.
937 Change all callers.
938 (Archive::get_file_and_offset): Likewise.
939 (Archive::read_all_symbols): Likewise.
940 (Archive::read_symbols): Likewise.
941 (Archive::get_elf_object_for_member): Remove input_objects
942 parameter. Add punconfigured parameter. Change all callers.
943 (Archive::add_symbols): Change return type to bool. Check return
944 value of include_member.
945 (Archive::include_all_members): Likewise.
946 (Archive::include_member): Change return type to bool. Return
947 false if first included object has incompatible target. Set
948 included_member_ field.
949 (Add_archive_symbols::run): If add_symbols returns false, requeue
950 Read_symbols task.
951 * archive.h (class Archive): Add included_member_ field.
952 Initialize it in constructor. Add input_file and searched_for
953 methods. Update declarations.
954 (class Add_archive_symbols): Add dirpath_, dirindex_, and
955 input_argument_ fields. Add them to constructor. Change all
956 callers.
957 * script.cc: Include "target-select.h".
958 (class Parser_closure): Add skip_on_incompatible_target_ and
959 found_incompatible_target_ fields. Add
960 skip_on_incompatible_target parameter to constructor. Change all
961 callers. Add methods skip_on_incompatible_target,
962 clear_skip_on_incompatible_target, found_incompatible_target, and
963 set_found_incompatible_target.
964 (read_input_script): Add dirindex parameter. Change all callers.
965 If parser finds an incompatible target, requeue Read_symbols
966 task.
967 (script_set_symbol): Clear skip_on_incompatible_target in
968 closure.
969 (script_add_assertion, script_parse_option): Likewise.
970 (script_start_sections, script_add_phdr): Likewise.
971 (script_check_output_format): New function.
972 * script.h (read_input_script): Update declaration.
973 * script-c.h (script_check_output_format): Declare.
974 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
975 (ignore_cmd): Remove OUTPUT_FORMAT.
976 * fileread.cc (Input_file::Input_file): Add explicit this.
977 (Input_file::will_search_for): New function.
978 (Input_file::open): Add pindex parameter. Change all callers.
979 * fileread.h (class Input_file): Add input_file_argument method.
980 Declare will_search_for. Update declarations.
981 * object.cc (make_elf_object): Add punconfigured parameter.
982 Change all callers.
983 * object.h (class Object): Make input_file public. Add
984 searched_for method.
985 (make_elf_object): Update declaration.
986 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
987 restart search.
988 * dirsearch.h (class Dirsearch): Update declaration.
989 * options.h (class General_options): Add --warn-search-mismatch.
990 * parameters.cc (Parameters::is_compatible_target): New function.
991 * parameters.h (class Parameters): Declare is_compatible_target.
992 * workqueue.cc (Workqueue::add_blocker): New function.
993 * workqueue.h (class Workqueue): Declare add_blocker.
994
995 * fileread.cc (Input_file::open): Remove options parameter.
996 Change all callers.
997 (Input_file::open_binary): Likewise.
998 * script.cc (read_input_script): Likewise.
999 * readsyms.h (class Read_symbols): Remove options_ field. Remove
1000 options parameter from constructor. Change all callers.
1001 (class Read_script): Likewise.
1002 * fileread.h (class Input_file): Update declarations.
1003 * script.h (read_input_script): Update declaration.
1004
1005 2009-03-10 Nick Clifton <nickc@redhat.com>
1006
1007 * po/es.po: New Spanish translation.
1008
1009 2009-03-06 Cary Coutant <ccoutant@google.com>
1010
1011 * options.cc (parse_short_option): Keep dash_z from registering itself.
1012
1013 2009-03-03 Ian Lance Taylor <iant@google.com>
1014
1015 PR 9918
1016 * target-reloc.h (relocate_section): Pass output_section to
1017 relocate.
1018 * i386.cc (Target_i386::should_apply_static_reloc): Add
1019 output_section parameter. Change all callers.
1020 (Target_i386::Relocate::relocate): Add output_section parameter.
1021 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
1022 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
1023 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
1024 * testsuite/two_file_shared.sh: New script.
1025 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
1026 (check_DATA): Add two_file_shared.dbg.
1027 (two_file_shared.dbg): New target.
1028 * testsuite/Makefile.in: Rebuild.
1029
1030 2009-03-01 Ian Lance Taylor <iant@google.com>
1031
1032 * configure.ac: Check for byteswap.h.
1033 * configure: Rebuild.
1034 * config.in: Rebuild.
1035
1036 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
1037
1038 * layout.cc (Layout::find_or_add_kept_section): New function.
1039 (Layout::add_comdat): Removed.
1040 * layout.h (struct Kept_section): Move out of class Layout.
1041 Remove trailing underscores from field names. Add group_sections
1042 field. Rename group_ field to is_group. Change all uses.
1043 (class Layout): Declare find_or_add_kept_section, not add_comdat.
1044 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
1045 comdat_groups_ field.
1046 (Sized_relobj::include_section_group): Use
1047 find_or_add_kept_section and Kept_section::group_sections.
1048 (Sized_relobj::include_linkonce_section): Likewise.
1049 * object.cc (class Sized_relobj): Don't define Comdat_group or
1050 Comdat_group_table. Remove find_comdat_group and
1051 add_comdat_group. Remove comdat_groups_ field.
1052 * plugin.cc (include_comdat_group): Use
1053 Layout::find_or_add_kept_section.
1054
1055 2009-02-28 Ian Lance Taylor <iant@google.com>
1056
1057 * README: --gc-sections and map files are now supported. Document
1058 some build requirements.
1059
1060 PR 6992
1061 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
1062 relocatable link set the value of the section symbol to zero.
1063 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
1064 relocatable link don't include the section address in the local
1065 symbol value.
1066
1067 2009-02-27 Ian Lance Taylor <iant@google.com>
1068
1069 PR 6811
1070 * options.h (class Search_directory): Add is_system_directory.
1071 (class General_options): Declare is_in_system_directory.
1072 * options.cc (get_relative_sysroot): Make static.
1073 (get_default_sysroot): Make static.
1074 (General_optoins::is_in_system_directory): New function.
1075 * fileread.cc (Input_file::is_in_system_directory): New function.
1076 * fileread.h (class Input_file): Declare is_in_system_directory.
1077 * object.h (class Object): Add is_in_system_directory.
1078 (class Input_objects): Remove system_library_directory_ field.
1079 * object.cc (Input_objects::add_object): Don't set
1080 system_library_directory_.
1081 (input_objects::found_in_system_library_directory): Remove.
1082 * symtab.cc (Symbol_table::write_globals): Remove input_objects
1083 parameter. Change all callers.
1084 (Symbol_table::sized_write_globals): Likewise.
1085 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
1086 Call Object::is_in_system_directory.
1087 * symtab.h (class Symbol_table): Update declarations.
1088
1089 PR 5990
1090 * descriptors.h (Open_descriptor): Add is_on_stack field.
1091 * descriptors.cc (Descriptors::open): If the descriptor is on the
1092 top of the stack, remove it. Initialize is_on_stack field.
1093 (Descriptors::release): Only add pod to stack if it is not on the
1094 stack already.
1095 (Descriptors::close_some_descriptor): Clear stack_next and
1096 is_on_stack fields.
1097
1098 PR 7091
1099 * output.cc (Output_section::find_starting_output_address): Rename
1100 from starting_output_address; add PADDR parameter; change return
1101 type.
1102 * output.h (class Output_section): Declare
1103 find_starting_output_address instead of starting_output_address.
1104 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
1105 section symbol for which we can't find a merge section.
1106
1107 PR 9836
1108 * symtab.cc (Symbol_table::add_from_object): If the visibility is
1109 hidden or internal, force the symbol to be local.
1110 * resolve.cc (Symbol::override_visibility): Define.
1111 (Symbol::override_base): Use override_visibility.
1112 (Symbol_table::resolve): Likewise.
1113 (Symbol::override_base_with_special): Likewise.
1114 (Symbol_table::override_with_special): If the visibility is hidden
1115 or internal, force the symbol to be local.
1116 * symtab.h (class Symbol): Add set_visibility and
1117 override_visibility.
1118 * testsuite/ver_test_1.sh: New file.
1119 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
1120 (check_DATA): Add ver_test_1.syms.
1121 (ver_test_1.syms): New target.
1122 * testsuite/Makefile.in: Rebuild.
1123
1124 2009-02-25 Cary Coutant <ccoutant@google.com>
1125
1126 * layout.cc (Layout::choose_output_section): Don't rename sections
1127 when using a linker script that has a SECTIONS clause.
1128 * Makefile.in: Regenerate.
1129
1130 * testsuite/Makefile.am (script_test_5.sh): New test case.
1131 * testsuite/Makefile.in: Regenerate.
1132 * testsuite/script_test_5.cc: New file.
1133 * testsuite/script_test_5.sh: New file.
1134 * testsuite/script_test_5.t: New file.
1135
1136 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
1137
1138 * archive.cc (Archive::include_member): Update calls to add_symbols.
1139 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
1140 the Layout argument.
1141 * dynobj.h (do_add_symbols): Add the Layout argument.
1142 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
1143 Layout argument.
1144 * object.h (Object::add_symbols): Add the Layout argument.
1145 (Object::do_add_symbols): Add the Layout argument.
1146 (Sized_relobj::do_add_symbols): Add the Layout argument.
1147 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
1148 Unify the two versions.
1149 (Add_plugin_symbols): Remove.
1150 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
1151 (Sized_pluginobj::do_add_symbols): Unify the two versions.
1152 (Add_plugin_symbols): Remove.
1153 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
1154 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
1155 (Add_symbols::run): Make it work with Pulginobj.
1156
1157 2009-02-06 Ian Lance Taylor <iant@google.com>
1158
1159 * object.cc (Sized_relobj::do_layout): Make info message start
1160 with lower case letter.
1161
1162 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
1163
1164 * binary.cc: Fix file comment.
1165
1166 * options.h (enum Incremental_disposition): Define.
1167 (class General_options): Add new options: --incremental,
1168 --incremental_changed, --incremental_unchanged,
1169 --incremental_unknown. Add incremental_disposition_ and
1170 implicit_incremental_ fields.
1171 (General_options::incremental_disposition): New function.
1172 (class Position_dependent_options): Add incremental_disposition
1173 option.
1174 (Position_dependent_options::copy_from_options): Set incremental
1175 dispositions.
1176 * options.cc (General_options::parse_incremental_changed): New
1177 function.
1178 (General_options::parse_incremental_unchanged): New function.
1179 (General_options::parse_incremental_unknown): New function.
1180 (General_options::General_options): Initialize new fields
1181 incremental_disposition_ and implicit_incremental_.
1182 (General_options::finalize): Check for uasge of --incremental-*
1183 without --incremental.
1184
1185 2009-02-06 Chris Demetriou <cgd@google.com>
1186
1187 * gold.h (gold_undefined_symbol): Change to take only a Symbol
1188 pointer and to report location as the file name associated with
1189 the symbol.
1190 (gold_undefined_symbol_at_location): New function to replace the
1191 old gold_undefined_symbol functionality.
1192 * target-reloc.h (relocate_section): Update to use
1193 gold_undefined_symbol_at_location.
1194 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
1195 Call gold_undefined_symbol function rather than gold_error.
1196 * errors.h (Errors::undefined_symbol): Take location as a
1197 string, rather than calculating it from a relocation.
1198 * errors.cc (Errors::fatal): Print "fatal error:" before the
1199 formatted message.
1200 (Errors::error, Errors::error_at_location): Print "error: "
1201 before the formatted message.
1202 (Errors::undefined_symbol): Take location as a string, rather
1203 than calculating it from a relocation.
1204 (gold_undefined_symbol_at_location): New function akin to
1205 old gold_undefined_symbol, calculates location from relocation.
1206 (gold_undefined_symbol): Change to take only a Symbol pointer
1207 and to report location as the file name associated with the symbol.
1208 * testsuite/debug_msg.sh: Update for changed error messages.
1209 * testsuite/undef_symbol.sh: Likewise.
1210
1211 2009-02-04 Duncan Sands <baldrick@free.fr>
1212
1213 PR 9812
1214 * reduced_debug_output.h
1215 (Output_reduced_debug_abbrev_section::failed): Use format for
1216 gold_warning.
1217 (Output_reduced_debug_info_section::faild): Likewise.
1218
1219 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
1220
1221 * script.cc (Lazy_demangler): New class.
1222 (Version_script_info::get_symbol_version_helper): Demangle a
1223 symbol only once.
1224
1225 2009-01-29 Cary Coutant <ccoutant@google.com>
1226
1227 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
1228 to __tls_get_addr.
1229 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
1230
1231 2009-01-28 Ian Lance Taylor <iant@google.com>
1232
1233 * version.cc (version_string): Bump to 1.9.
1234
1235 * gold.h: Include <cstring> and <stdint.h>.
1236 * version.cc: Include <cstdio>.
1237 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
1238 warning.
1239 * reduced_debug_output.cc (insert_into_vector): Rename from
1240 Insert_into_vector; change all callers. Use Swap_unaligned to
1241 avoid aliasing issue; remove union since it is unnecessary.
1242
1243 2009-01-27 Sriraman Tallam <tmsriram@google.com>
1244
1245 * Makefile.am (CCFILES): Add gc.cc.
1246 (HFILES): Add gc.h.
1247 * Makefile.in: Regenerate.
1248 * gold.cc (Gc_runner): New class.
1249 (queue_initial_tasks): Call garbage collection related tasks
1250 when corresponding options are invoked.
1251 (queue_middle_gc_tasks): New function.
1252 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
1253 processed early before laying out sections during garbage collection.
1254 * gold.h (queue_middle_gc_tasks): New function.
1255 (is_prefix_of): Move from "layout.cc".
1256 * i386.cc (Target_i386::gc_process_relocs): New function.
1257 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
1258 * main.cc (main): Create object of class "Garbage_collection".
1259 * object.cc (Relobj::copy_symbols_data): New function.
1260 (Relobj::is_section_name_included): New function.
1261 (Sized_relobj::do_layout): Allow this function to be called twice
1262 during garbage collection and defer layout of section during the
1263 first call.
1264 * object.h (Relobj::get_symbols_data): New function.
1265 (Relobj::is_section_name_included): New function.
1266 (Relobj::copy_symbols_data): New function.
1267 (Relobj::set_symbols_data): New function.
1268 (Relobj::get_relocs_data): New function.
1269 (Relobj::set_relocs_data): New function.
1270 (Relobj::is_output_section_offset_invalid): New pure virtual function.
1271 (Relobj::gc_process_relocs): New function.
1272 (Relobj::do_gc_process_relocs): New pure virtual function.
1273 (Relobj::sd_): New data member.
1274 (Sized_relobj::is_output_section_offset_invalid): New function.
1275 (Sized_relobj::do_gc_process_relocs): New function.
1276 * options.h (General_options::gc_sections): Modify to not be a no-op.
1277 (General_options::print_gc_sections): New option.
1278 * plugin.cc (Plugin_finish::run): Remove function call to
1279 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
1280 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
1281 * reloc.cc (Read_relocs::run): Add task to process relocs and
1282 determine unreferenced sections when doing garbage collection.
1283 (Gc_process_relocs): New class.
1284 (Sized_relobj::do_gc_process_relocs): New function.
1285 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
1286 sections that are garbage collected.
1287 * reloc.h (Gc_process_relocs): New class.
1288 * sparc.cc (Target_sparc::gc_process_relocs): New function.
1289 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
1290 symbols whose corresponding sections are garbage collected.
1291 (Symbol_table::Symbol_table): Add new parameter for the garbage
1292 collection object.
1293 (Symbol_table::gc_mark_undef_symbols): New function.
1294 (Symbol_table::gc_mark_symbol_for_shlib): New function.
1295 (Symbol_table::gc_mark_dyn_syms): New function.
1296 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
1297 as garbage.
1298 (Symbol_table::add_from_object): Likewise.
1299 (Symbol_table::add_from_relobj): When building shared objects, do not
1300 treat externally visible symbols as garbage.
1301 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
1302 table information for static and relocatable links.
1303 * symtab.h (Symbol_table::set_gc): New function.
1304 (Symbol_table::gc): New function.
1305 (Symbol_table::gc_mark_undef_symbols): New function.
1306 (Symbol_table::gc_mark_symbol_for_shlib): New function.
1307 (Symbol_table::gc_mark_dyn_syms): New function.
1308 (Symbol_table::gc_): New data member.
1309 * target.h (Sized_target::gc_process_relocs): New pure virtual
1310 function.
1311 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
1312 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
1313
1314 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
1315
1316 * options.h (General_options::gc_sections): Define as a no-op for now.
1317 (General_options::no_keep_memory): Ditto.
1318 (General_options::Bshareable): Define.
1319 * options.cc (General_options::finalize): Honor -Bshareable.
1320
1321 2009-01-20 Andreas Schwab <schwab@suse.de>
1322
1323 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
1324 read the value in the contents, since we don't use it. Use the
1325 template endianness when writing.
1326 (Relocate::relocate): Use it for R_PPC_REL16_HA.
1327
1328 2009-01-19 Andreas Schwab <schwab@suse.de>
1329
1330 * configure.tgt (powerpc64-*): Fix targ_obj.
1331
1332 2009-01-15 Ian Lance Taylor <iant@google.com>
1333
1334 * object.cc (Sized_relobj::write_local_symbols): Don't write out
1335 local symbols when stripping all symbols.
1336
1337 2009-01-14 Cary Coutant <ccoutant@google.com>
1338
1339 * output.cc (Output_reloc): Add explicit instantiations.
1340
1341 2009-01-14 Cary Coutant <ccoutant@google.com>
1342
1343 * archive.cc (Archive::get_elf_object_for_member): Remove call
1344 to File_read::claim_for_plugin.
1345 * descriptors.cc (Descriptors::open): Remove reference to
1346 is_claimed.
1347 (Descriptors::claim_for_plugin): Remove.
1348 * descriptors.h (Descriptors::claim_for_plugin): Remove.
1349 (Descriptors::is_claimed): Remove.
1350 (claim_descriptor_for_plugin): Remove.
1351 * fileread.cc (File_read::claim_for_plugin): Remove.
1352 * fileread.h (File_read::claim_for_plugin): Remove.
1353 (File_read::descriptor): Reopen descriptor if necessary.
1354 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
1355 (Plugin_manager::all_symbols_read): Add task parameter. Change
1356 all callers.
1357 (Plugin_manager::get_input_file): New function.
1358 (Plugin_manager::release_input_file): New function.
1359 (Pluginobj::Pluginobj): Add filesize parameter and initialize
1360 corresponding data member.
1361 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
1362 and pass to base constructor. Change all callers.
1363 (get_input_file, release_input_file): New functions.
1364 (make_sized_plugin_object): Add filesize parameter. Change all callers.
1365 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
1366 (Plugin_manager::all_symbols_read): Add task parameter.
1367 (Plugin_manager::get_input_file): New function.
1368 (Plugin_manager::release_input_file): New function.
1369 (Plugin_manager::task_): New data member.
1370 (Pluginobj::Pluginobj): Add filesize parameter.
1371 (Pluginobj::filename): New function.
1372 (Pluginobj::descriptor): New function.
1373 (Pluginobj::filesize): New function.
1374 (Pluginobj::filesize_): New data member.
1375 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
1376 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
1377 File_read::claim_for_plugin; use Object::unlock to unlock the file.
1378
1379 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
1380 with archive libraries.
1381 * testsuite/Makefile.in: Regenerate.
1382 * testsuite/plugin_test.c (struct sym_info): New type.
1383 (get_input_file, release_input_file): New static variables.
1384 (onload): Capture new transfer vector entries.
1385 (claim_file_hook): Stop reading at end of file according to filesize.
1386 Factor out parsing of readelf output into separate function.
1387 (all_symbols_read_hook): Exercise get_input_file and release_input_file
1388 APIs and get the source file name from the symbol table. Convert
1389 source file name to corresponding object file name. Print info
1390 message when adding new input files.
1391 (parse_readelf_line): New function.
1392 * testsuite/plugin_test_1.sh: Add checks for new info messages.
1393 * testsuite/plugin_test_2.sh: Likewise.
1394 * testsuite/plugin_test_3.sh: Likewise.
1395 * testsuite/plugin_test_4.sh: New test case.
1396
1397 2009-01-07 Ian Lance Taylor <iant@google.com>
1398
1399 * version.cc (version_string): Bump to 1.8.
1400
1401 2008-12-23 Cary Coutant <ccoutant@google.com>
1402
1403 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
1404 * plugin.cc (Plugin_manager::finish): Rename as
1405 layout_deferred_objects. Move cleanup to separate function.
1406 (Plugin_manager::cleanup): New function.
1407 (Plugin_finish::run): Call layout_deferred_objects and cleanup
1408 separately.
1409 * plugin.h (Plugin_manager::finish): Rename as
1410 layout_deferred_objects.
1411 (Plugin_manager::cleanup): New function.
1412 (Plugin_manager::cleanup_done): New field.
1413
1414 2008-12-23 Cary Coutant <ccoutant@google.com>
1415
1416 * plugin.cc (is_visible_from_outside): New function.
1417 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
1418 so we don't return "IR only" status for exported symbols or -r links.
1419
1420 * testsuite/Makefile.am (plugin_test_3): New test case.
1421 * testsuite/Makefile.in: Regenerate.
1422 * testsuite/plugin_test_3.sh: New file.
1423
1424 2008-12-22 Cary Coutant <ccoutant@google.com>
1425
1426 * object.cc (Sized_relobj::layout_section): New function.
1427 (Sized_relobj::do_layout): Defer layout of input sections until after
1428 plugin has provided replacement files.
1429 (Sized_relobj::do_layout_deferred_sections): New function.
1430 * object.h (Relobj::set_section_offset): Remove virtual keyword.
1431 (Relobj::layout_deferred_sections): New function.
1432 (Relobj::do_layout_deferred_sections): New function.
1433 (Sized_relobj::do_layout_deferred_sections): New function.
1434 (Sized_relobj::layout_section): New function.
1435 (Sized_relobj::Deferred_layout): New structure.
1436 (Sized_relobj::deferred_layout_): New field.
1437 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
1438 Change all callers. Layout deferred sections.
1439 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
1440 references.
1441 (Plugin_hook::run): Move code from do_plugin_hook inline.
1442 (Plugin_hook::do_plugin_hook): Remove.
1443 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
1444 (Plugin_manager::finish): Renamed, was cleanup.
1445 (Plugin_manager::should_defer_layout): New function.
1446 (Plugin_manager::add_deferred_layout_object): New function.
1447 (Plugin_manager::Deferred_layout_list): New type.
1448 (Plugin_manager::deferred_layout_objects_): New field.
1449 (Plugin_hook::do_plugin_hook): Remove.
1450
1451 2008-12-17 Ian Lance Taylor <iant@google.com>
1452
1453 * options.h (class General_options): Add --no case for
1454 --export-dynamic.
1455
1456 2008-12-16 Cary Coutant <ccoutant@google.com>
1457
1458 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
1459 vector.
1460 (Plugin_manager::claim_file): Create plugin object even if
1461 plugin did not call the add_symbols callback.
1462 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
1463 asking for more symbols than were added.
1464 * testsuite/Makefile.am (plugin_test_1): Add test case with
1465 no global symbols.
1466 (empty.syms): New target.
1467 * testsuite/Makefile.in: Regenerate.
1468 * testsuite/plugin_test.c (claim_file_hook): Add new debug
1469 message. Don't call add_symbols if no globals.
1470 (all_symbols_read_hook): Don't provide replacement for empty
1471 claimed file.
1472
1473 2008-12-12 Ian Lance Taylor <iant@google.com>
1474
1475 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
1476 r_type == 0 for a local symbol with r_sym == 0.
1477 (scan_relocatable_relocs): Pass r_sym to
1478 local_non_section_strategy.
1479 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
1480 r_sym parameter.
1481
1482 * configure.ac: Update test for TLS descriptors: they are
1483 supported as of glibc 2.9.
1484 * configure: Rebuild.
1485
1486 2008-12-11 Ian Lance Taylor <iant@google.com>
1487
1488 PR 7091
1489 * target-reloc.h (Default_scan_relocatable_relocs): For each
1490 function, map r_type == 0 to RELOC_DISCARD.
1491
1492 2008-12-10 Cary Coutant <ccoutant@google.com>
1493
1494 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
1495 object to override a kept COMDAT group from a plugin object.
1496
1497 2008-12-09 Ian Lance Taylor <iant@google.com>
1498
1499 PR 7088
1500 * yyscript.y (file_cmd): Handle INPUT.
1501
1502 * testsuite/initpri1.c: Change all declarations to be full
1503 prototypes by adding void, to avoid compiler warnings.
1504
1505 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
1506
1507 * options.cc (General_options::parse_plugin_opt): New.
1508 (General_options::add_plugin): The argument now is just the filename.
1509 (General_options::add_plugin_option): New.
1510 * options.h (plugin_opt): New.
1511 (add_plugin): Change argument name.
1512 (add_plugin_option): New.
1513 * plugin.cc (Plugin::load): Don't parse the plugin option.
1514 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
1515 (Plugin::add_option): New.
1516 (Plugin::args_): Change type.
1517 (Plugin::filename_): New.
1518 (Plugin_manager::add_plugin_option): New.
1519 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
1520 * testsuite/Makefile.in: Regenerate.
1521
1522 2008-12-05 Cary Coutant <ccoutant@google.com>
1523
1524 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
1525 Handle --strip-lto-sections option.
1526 * options.h (strip_lto_sections): New option.
1527
1528 2008-12-01 Cary Coutant <ccoutant@google.com>
1529
1530 * plugin.cc (ld_plugin_message): Change format parameter to const.
1531 Fix mismatch between new[] and delete.
1532
1533 2008-11-14 Cary Coutant <ccoutant@google.com>
1534
1535 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
1536 instead of -1U.
1537
1538 2008-11-05 Craig Silverstein <csilvers@google.com>
1539
1540 * options.cc (General_options::parse_dynamic_list): New function.
1541 * options.h (General_options): New flags dynamic_list,
1542 dynamic_list_data, dynamic_list_cpp_new, and
1543 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
1544 (General_options::in_dynamic_list): New function.
1545 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
1546 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
1547 (Lex::can_continue_name): Likewise.
1548 (yylex): Likewise.
1549 (read_script_file): New parameter script_options.
1550 (read_dynamic_list): New function.
1551 (Script_options::define_dynamic_list): New function.
1552 (dynamic_list_keyword_parsecodes): New variable.
1553 (dynamic_list_keywords): New variable.
1554 * script.h (Script_options::define_dynamic_list): New function
1555 prototype.
1556 (read_dynamic_list): New function prototype.
1557 * symtab.cc (strprefix): New macro.
1558 (Symbol::should_add_dynsym_entry): Support dynamic_list,
1559 dynamic_list_data, dynamic_list_cpp_new, and
1560 dynamic_list_cpp_typeinfo.
1561 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
1562 (dynamic_list_expr): New rule.
1563 (dynamic_list_nodes): Likewise.
1564 (dynamic_list_node): Likewise.
1565 * testsuite/Makefile.am (dynamic_list): New test.
1566 * testsuite/Makefile.in: Regenerated.
1567 * testsuite/dynamic_list.t: New file.
1568 * testsuite/dynamic_list.sh: New file.
1569
1570 2008-11-05 Craig Silverstein <csilvers@google.com>
1571
1572 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
1573 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
1574 (t11_last): Likewise.
1575 * testsuite/ver_test_6.c (main): Likewise.
1576
1577 2008-10-07 Cary Coutant <ccoutant@google.com>
1578
1579 * options.c (General_options::finalize): Add check for -static and
1580 -shared.
1581 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
1582 is not empty.
1583
1584 2008-10-02 Cary Coutant <ccoutant@google.com>
1585
1586 * plugin.cc (make_sized_plugin_object): Fix conditional
1587 compilation to work when not all targets are enabled.
1588
1589 2008-09-29 Cary Coutant <ccoutant@google.com>
1590
1591 * archive.cc (Archive::get_file_and_offset): Use filename instead
1592 of name to get library path.
1593 (Archive::include_member): Unlock external member of a thin archive.
1594
1595 * testsuite/Makefile.am (TEST_AR): New variable.
1596 (thin_archive_test_1): New test.
1597 (thin_archive_test_2): New test.
1598 * testsuite/Makefile.in: Regenerate.
1599 * testsuite/thin_archive_main.cc: New file.
1600 * testsuite/thin_archive_test_1.cc: New file.
1601 * testsuite/thin_archive_test_2.cc: New file.
1602 * testsuite/thin_archive_test_3.cc: New file.
1603 * testsuite/thin_archive_test_4.cc: New file.
1604
1605 2008-09-29 Cary Coutant <ccoutant@google.com>
1606
1607 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
1608 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
1609 instead of -1U.
1610 (Sized_relobj::do_finalize_local_symbols): Likewise.
1611 (Sized_relobj::map_to_kept_section): Likewise.
1612 * object.h (Sized_relobj::invalid_address): New constant.
1613 (Sized_relobj::do_output_section_offset): Check for invalid_address
1614 and return -1ULL.
1615 * output.cc (Output_reloc::local_section_offset): Use constant
1616 invalid_address instead of -1U.
1617 (Output_reloc::get_address): Likewise.
1618 (Output_section::output_address): Change -1U to -1ULL.
1619 * output.h (Output_reloc::invalid_address): New constant.
1620 * reloc.cc (Sized_relobj::write_sections): Use constant
1621 invalid_address instead of -1U.
1622 (Sized_relobj::relocate_sections): Likewise.
1623 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
1624 values for merge sections.
1625 * target-reloc.h (relocate_for_relocatable): Use constant
1626 invalid_address instead of -1U.
1627
1628 2008-09-19 Cary Coutant <ccoutant@google.com>
1629
1630 Add plugin functionality for link-time optimization (LTO).
1631 * configure.ac (plugins): Add --enable-plugins option.
1632 * configure: Regenerate.
1633 * config.in: Regenerate.
1634 * Makefile.am (LIBDL): New variable.
1635 (CCFILES): Add plugin.cc.
1636 (HFILES): Add plugin.h.
1637 (ldadd_var): Add LIBDL.
1638 * Makefile.in: Regenerate.
1639
1640 * archive.cc: Include "plugin.h".
1641 (Archive::setup): Don't preread archive symbols when using a plugin.
1642 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
1643 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
1644 files.
1645 (Archive::include_member): Add symbols from plugin objects.
1646 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
1647 * descriptors.cc (Descriptors::open): Check for file descriptors
1648 abandoned by plugins.
1649 (Descriptors::claim_for_plugin): New function.
1650 * descriptors.h (Descriptors::claim_for_plugin): New function.
1651 (Open_descriptor::is_claimed): New field.
1652 (claim_descriptor_for_plugin): New function.
1653 * fileread.cc (File_read::claim_for_plugin): New function.
1654 * fileread.h (File_read::claim_for_plugin): New function.
1655 (File_read::descriptor): New function.
1656 * gold.cc: Include "plugin.h".
1657 (queue_initial_tasks): Add task to call plugin hooks for generating
1658 new object files.
1659 * main.cc: Include "plugin.h".
1660 (main): Load plugin libraries.
1661 * object.h (Pluginobj): Declare.
1662 (Object::pluginobj): New function.
1663 (Object::do_pluginobj): New function.
1664 (Object::set_target): New function.
1665 * options.cc: Include "plugin.h".
1666 (General_options::parse_plugin): New function.
1667 (General_options::General_options): Initialize plugins_ field.
1668 (General_options::add_plugin): New function.
1669 * options.h (Plugin_manager): Declare.
1670 (General_options): Add --plugin option.
1671 (General_options::has_plugins): New function.
1672 (General_options::plugins): New function.
1673 (General_options::add_plugin): New function.
1674 (General_options::plugins_): New field.
1675 * plugin.cc: New file.
1676 * plugin.h: New file.
1677 * readsyms.cc: Include "plugin.h".
1678 (Read_symbols::do_read_symbols): Check for archive before checking
1679 for ELF file. Call plugin hooks to claim files.
1680 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
1681 from a real object file; force override when processing replacement
1682 files.
1683 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
1684 (Symbol::init_base_object): Likewise.
1685 (Symbol::init_base_output_data): Likewise.
1686 (Symbol::init_base_output_segment): Likewise.
1687 (Symbol::init_base_constant): Likewise.
1688 (Symbol::init_base_undefined): Likewise.
1689 (Symbol::output_section): Assert that object is not a plugin.
1690 (Symbol_table::add_from_pluginobj): New function.
1691 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
1692 undefined.
1693 (Symbol_table::sized_write_globals): Likewise.
1694 (Symbol_table::add_from_pluginobj): Instantiate template.
1695 * symtab.h (Sized_pluginobj): Declare.
1696 (Symbol::in_real_elf): New function.
1697 (Symbol::set_in_real_elf): New function.
1698 (Symbol::in_real_elf_): New field.
1699 (Symbol_table::add_from_pluginobj): New function.
1700
1701 * testsuite/Makefile.am (AM_CFLAGS): New variable.
1702 (LIBDL): New variable.
1703 (LDADD): Add LIBDL.
1704 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
1705 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
1706 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
1707 (MOSTLYCLEANFILES): Likewise.
1708 * testsuite/Makefile.in: Regenerate.
1709 * testsuite/plugin_test.c: New file.
1710 * testsuite/plugin_test_1.sh: New file.
1711 * testsuite/plugin_test_2.sh: New file.
1712
1713 2008-09-16 Ian Lance Taylor <iant@google.com>
1714
1715 * target-reloc.h (relocate_section): Check whether a symbol is
1716 defined by the ABI before reporting an undefined symbol error.
1717 * target.h (Target::is_defined_by_abi): Make parameter const.
1718 (Target::do_is_defined_by_abi): Likewise.
1719 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
1720 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
1721 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
1722 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
1723 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
1724 * testsuite/Makefile.in: Rebuild.
1725
1726 * fileread.cc (make_view): Add casts to avoid warning.
1727
1728 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
1729
1730 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
1731 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
1732
1733 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
1734
1735 * options.h (General_options::output_is_executable): New.
1736 (General_options::output_is_pie): New.
1737 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
1738 for shared libraries.
1739 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
1740
1741 2008-09-11 Chris Demetriou <cgd@google.com>
1742
1743 * options.h (origin): New -z option.
1744 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
1745 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
1746 in DT_FLAGS_1.
1747
1748 2008-09-05 Cary Coutant <ccoutant@google.com>
1749
1750 * fileread.cc (File_read::make_view): Add check for attempt to map
1751 beyond end of file.
1752
1753 2008-09-05 Cary Coutant <ccoutant@google.com>
1754
1755 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
1756 explicit instantiations.
1757
1758 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
1759
1760 PR gold/6858
1761 * options.cc (General_options::finalize): Allow undefined symbols
1762 in shlibs if linking -shared.
1763
1764 PR gold/6859
1765 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
1766 symbols as not needing a dynsym entry.
1767
1768 2008-08-20 Craig Silverstein <csilvers@google.com>
1769
1770 * fileread.cc (File_read::open): Do not lock the file unless it
1771 was successfully opened.
1772
1773 2008-08-14 Cary Coutant <ccoutant@google.com>
1774
1775 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
1776 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
1777 * testsuite/tls_test.cc (struct int128): 128-bit struct
1778 for testing TLS relocs with non-zero addend.
1779 (v12): New TLS variable.
1780 (t12): New test.
1781 (t_last): Add check for v12.
1782 * testsuite/tls_test.h (t12): New function.
1783 * testsuite/tls_test_main.cc (thread_routine): Call new test.
1784
1785 2008-08-13 Ian Lance Taylor <iant@google.com>
1786
1787 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
1788 set tls_segment_ or relro_segment_.
1789 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
1790 when appropriate.
1791 * output.h (Output_section::clear_is_relro): New function.
1792 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
1793 sections specially even when output_data_ is empty.
1794 (Output_segment::maximum_alignment): When first section is relro,
1795 only force alignment for PT_LOAD segments.
1796 * script.cc (script_data_segment_align): New function.
1797 (script_data_segment_relro_end): New function.
1798 * script-c.h (script_data_segment_align): Declare.
1799 (script_data_segment_relro_end): Declare.
1800 * script-sections.h (class Script_sections): Declare
1801 data_segment_align and data_segment_relro_end. Add fields
1802 segment_align_index_ and saw_relro_end_.
1803 * script-sections.cc (class Sections_element): Add set_is_relro
1804 virtual function. Add new bool* parameter to place_orphan_here.
1805 Add get_output_section virtual function.
1806 (class Output_section_definition): Add set_is_relro. Add new
1807 bool* parameter to place_orphan_here. Add get_output_section.
1808 Add is_relro_ field.
1809 (Output_section_definition::Output_section_definition): Initialize
1810 evaluated_address_, evaluated_load_address, evaluated_addralign_,
1811 and is_relro_ fields.
1812 (Output_section_definition::place_orphan_here): Add is_relro
1813 parameter.
1814 (Output_section_definition::set_section_addresses): Set relro for
1815 output section.
1816 (Output_section_definition::alternate_constraint): Likewise.
1817 (class Orphan_output_section): Add new bool* parameter to
1818 place_orphan_here. Add get_output_section.
1819 (Orphan_output_section::place_orphan_here): Add is_relro
1820 parameter.
1821 (Script_sections::Script_sections): Initialize
1822 data_segment_align_index_ and saw_relro_end_.
1823 (Script_sections::data_segment_align): New function.
1824 (Script_sections::data_segment_relro_end): New function.
1825 (Script_sections::place_orphan): Set or clear is_relro.
1826 (Script_sections::set_section_addresses): Force alignment of first
1827 TLS section.
1828 * yyscript.y (exp): Call script_data_segment_align and
1829 script_data_segment_relro_end.
1830 * testsuite/relro_script_test.t: New file.
1831 * testsuite/relro_test.cc (using_script): Declare.
1832 (t1, t2): Test using_script.
1833 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
1834 (relro_script_test_SOURCES): Define.
1835 (relro_script_test_DEPENDENCIES): Define.
1836 (relro_script_test_LDFLAGS): Define.
1837 (relro_script_test_LDADD): Define.
1838 (relro_script_test.so): New target.
1839 * testsuite/Makefile.in: Rebuild.
1840
1841 2008-08-06 Cary Coutant <ccoutant@google.com>
1842
1843 * archive.cc (Archive::total_archives, Archive::total_members)
1844 (Archive::total_members_loaded): New variables.
1845 (Archive::setup): Add parameter. Add option to preread
1846 archive symbols.
1847 (Archive::read_armap): Add counter.
1848 (Archive::get_file_and_offset): New function.
1849 (Archive::get_elf_object_for_member): New function.
1850 (Archive::read_all_symbols): New function.
1851 (Archive::read_symbols): New function.
1852 (Archive::add_symbols): Add counters.
1853 (Archive::include_all_members): Use armap to find members if it's
1854 already built.
1855 (Archive::include_member): Skip reading symbols if already read.
1856 Factored code into Archive::get_file_and_offset and
1857 Archive::get_elf_object_for_member. Changed call to
1858 Mapfile::report_include_archive_member.
1859 (Archive::print_stats): New function.
1860 * archive.h: Declare Object and Read_symbols_data classes.
1861 (Archive::Archive): Add initializers for new members.
1862 (Archive::setup): Add parameter.
1863 (Archive::print_stats): New function.
1864 (Archive::total_archives, Archive::total_members)
1865 (Archive::total_members_loaded): New variables.
1866 (Archive::get_file_and_offset): New function.
1867 (Archive::get_elf_object_for_member): New function.
1868 (Archive::read_all_symbols): New function.
1869 (Archive::read_symbols): New function.
1870 (Archive::Archive_member): New class.
1871 (Archive::members_): New member.
1872 (Archive::num_members_): New member.
1873 * main.cc: Include archive.h.
1874 (main): Call Archive::print_stats.
1875 * mapfile.cc (Mapfile::report_include_archive_member): Delete
1876 archive parameter; member_name is now the fully-decorated name.
1877 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
1878 * options.h: (General_options): Add --preread-archive-symbols option.
1879 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
1880 Archive::setup.
1881
1882 2008-08-04 Ian Lance Taylor <iant@google.com>
1883
1884 * symtab.h (Symbol::use_plt_offset): New function.
1885 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
1886 * powerpc.cc (Relocate::relocate): Likewise.
1887 * sparc.cc (Relocate::relocate): Likewise.
1888 * x86_64.cc (Relocate::relocate): Likewise.
1889 * testsuite/weak_plt.sh: New test.
1890 * testsuite/weak_plt_main.cc: New test.
1891 * testsuite/weak_plt_shared.cc: New test.
1892 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
1893 (check_PROGRAMS): Add weak_plt.
1894 (check_DATA): Add weak_plt_shared.so.
1895 (weak_plt_main_pic.o, weak_plt): New targets.
1896 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
1897 * testsuite/Makefile.in: Rebuild.
1898
1899 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
1900 gcctestdir/ld.
1901 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
1902 * testsuite/Makefile.in: Rebuild.
1903
1904 2008-08-04 Alan Modra <amodra@bigpond.net.au>
1905
1906 * Makefile.am (POTFILES.in): Set LC_ALL=C.
1907 * Makefile.in: Regenerate.
1908 * po/POTFILES.in: Regenerate.
1909
1910 2008-07-29 Ian Lance Taylor <iant@google.com>
1911
1912 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
1913 symbols before other symbols.
1914 * testsuite/script_test_2.cc (test_addr): Declare.
1915 (test_addr_alias): Declare.
1916 (main): Check that test_addr and test_addr_alias have the right
1917 values.
1918 * testsuite/script_test_2.t: Define test_addr_alias and
1919 test_addr.
1920
1921 2008-07-24 Ian Lance Taylor <iant@google.com>
1922
1923 PR 5990
1924 * descriptors.cc: New file.
1925 * descriptors.h: New file.
1926 * gold-threads.h (class Hold_optional_lock): New class.
1927 * fileread.cc: Include "descriptors.h".
1928 (File_read::~File_read): Release descriptor rather than closing
1929 it.
1930 (File_read::open) [file]: Call open_descriptor rather than open.
1931 Set is_descriptor_opened_.
1932 (File_read::open) [memory]: Assert that descriptor is not open.
1933 (File_read::reopen_descriptor): New function.
1934 (File_read::release): Release descriptor.
1935 (File_read::do_read): Make non-const. Reopen descriptor.
1936 (File_read::read): Make non-const.
1937 (File_read::make_view): Reopen descriptor.
1938 (File_read::do_readv): Likewise.
1939 * fileread.h (class File_read): Add is_descriptor_opened_ field.
1940 Update declarations.
1941 * layout.cc: Include "descriptors.h".
1942 (Layout::create_build_id): Use open_descriptor rather than open.
1943 * output.cc: Include "descriptors.h".
1944 (Output_file::open): Use open_descriptor rather than open.
1945 * archive.cc (Archive::const_iterator): Change Archive to be
1946 non-const.
1947 (Archive::begin, Archive::end): Make non-const.
1948 (Archive::count_members): Likewise.
1949 * archive.h (class Archive): Update declarations.
1950 * object.h (Object::read): Make non-const.
1951 * Makefile.am (CCFILES): Add descriptors.cc.
1952 (HFILES): Add descriptors.h.
1953 * Makefile.in: Rebuild.
1954
1955 PR 6716
1956 * gold.h: Always include <clocale>. Add Solaris workarounds
1957 following code in binutils/sysdep.h.
1958
1959 PR 6048
1960 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
1961 this->eh_frame_hdr_ is NULL before using it.
1962
1963 * dynobj.cc (Versions::Versions): Update comment.
1964
1965 * dynobj.cc (Versions::Versions): If there is an soname, use it as
1966 the base version name.
1967
1968 * stringpool.cc (Stringpool_template::add_with_length): Set key to
1969 array size plus one.
1970 (Stringpool_template::set_string_offsets): Subtract one from key
1971 before using it as an array index.
1972 (Stringpool_template::get_offset_with_length): Likewise.
1973 (Stringpool_template::write_to_buffer): Likewise.
1974 * stringpool.h (Stringpool_template::get_offset_from_key):
1975 Likewise.
1976
1977 2008-07-23 Ian Lance Taylor <iant@google.com>
1978
1979 PR 6658
1980 * object.h (Merged_symbol_value::value): Do our best to handle a
1981 negative addend.
1982
1983 PR 6647
1984 * script.cc (Version_script_info::get_versions): Don't add empty
1985 version tag to return value.
1986 (Version_script_info::get_symbol_version_helper): Change return
1987 type to bool. Add pversion parameter. Change all callers.
1988 (script_register_vers_node): Don't require a non-NULL tag.
1989 * script.h (class Version_script_info): Update declarations.
1990 (Version_script_info::get_symbol_version): Change return type to
1991 bool. Add version parameter. Change all callers.
1992 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
1993 handling. Handle an empty version from a version script.
1994 (Symbol_table::define_special_symbol): Likewise.
1995 * testsuite/ver_test_10.script: New file.
1996 * testsuite/ver_test_10.sh: New file.
1997 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
1998 (check_DATA): Add ver_test_10.syms.
1999 (ver_test_10.syms, ver_test_10.so): New target.
2000 * testsuite/Makefile.in: Rebuild.
2001
2002 2008-07-23 Simon Baldwin <simonb@google.com>
2003
2004 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
2005 to zero for undefined symbols from dynamic libraries.
2006
2007 2008-07-23 Ian Lance Taylor <iant@google.com>
2008
2009 * symtab.cc (Symbol_table::resolve): Remove version parameter.
2010 Change all callers.
2011 * symtab.h (class Symbol_table): Update declaration.
2012 * testsuite/ver_test_9.cc: New file.
2013 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
2014 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
2015 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
2016 (ver_test_9.so, ver_test_9.o): New targets.
2017 * testsuite/Makefile.in: Rebuild.
2018
2019 2008-07-22 Ian Lance Taylor <iant@google.com>
2020
2021 * options.h (class General_options): Define --check-sections.
2022 * layout.cc (Layout::set_segment_offsets): Handle
2023 --check-sections.
2024
2025 * options.h (class General_options): Define -n/--nmagic and
2026 -N/--omagic.
2027 * options.cc (General_options::finalize): For -n/--nmagic or
2028 -N/--omagic, set -static.
2029 * layout.cc (Layout::attach_allocated_section_to_segment): If
2030 -N/--omagic, don't put read-only and read-write sections in
2031 different segments.
2032 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
2033 finding a read-only segment.
2034 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
2035 don't set the minimum segment alignment to the common page size,
2036 and don't set the file offset to the address modulo the page size.
2037 * script-sections.cc (Script_sections::create_segments): If
2038 -n/--omagic, don't put read-only and read-write sections in
2039 different segments.
2040
2041 * cref.cc: New file.
2042 * cref.h: New file.
2043 * options.h (class General_options): Add --print-symbol-counts.
2044 * main.cc (main): Issue defined symbol report if requested.
2045 * archive.cc (Archive::interpret_header): Make into a const member
2046 function.
2047 (Archive::add_symbols): Call Input_objects::archive_start and
2048 archive_stop.
2049 (Archive::const_iterator): Define new class.
2050 (Archive::begin, Archive::end): New functions.
2051 (Archive::include_all_members): Rewrite to use iterator.
2052 (Archive::count_members): New function.
2053 * archive.h (class Archive): Update declarations.
2054 (Archive::filename): New function.
2055 * object.cc: Include "cref.h".
2056 (Sized_relobj::Sized_relobj): Initialize defined_count_.
2057 (Sized_relobj::do_get_global_symbol_counts): New function.
2058 (Input_objects::add_object): Add object to cross-referencer.
2059 (Input_objects::archive_start): New function.
2060 (Input_objects::archive_stop): New function.
2061 (Input_objects::print_symbol_counts): New function.
2062 * object.h: Declare Cref and Archive.
2063 (Object::get_global_symbol_counts): New function.
2064 (Object::do_get_global_symbol_counts): New pure virtual function.
2065 (class Sized_relobj): Add defined_count_ field. Update
2066 declarations.
2067 (class Input_objects): Add cref_ field. Update constructor.
2068 Update declarations.
2069 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
2070 defined_count_.
2071 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
2072 symbol counts.
2073 (Sized_dynobj::do_get_global_symbol_counts): New function.
2074 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
2075 defined_count_. Update declarations. Define Symbols typedef.
2076 * symtab.cc (Symbol_table::add_from_relobj): Add defined
2077 parameter. Change all callers.
2078 (Symbol_table::add_from_dynobj): Add sympointers and defined
2079 parameters. Change all callers.
2080 * symtab.h (class Symbol_table): Update declarations.
2081 * Makefile.am (CCFILES): Add cref.cc.
2082 (HFILES): Add cref.h.
2083 * Makefile.in: Rebuild.
2084
2085 2008-07-22 Simon Baldwin <simonb@google.com>
2086
2087 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
2088 to zero when writing undefined symbols.
2089
2090 2008-07-22 Ian Lance Taylor <iant@google.com>
2091
2092 * output.cc (Output_section::add_input_section): Don't try to
2093 merge empty merge sections.
2094
2095 2008-07-21 Craig Silverstein <csilvers@google.com>
2096
2097 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
2098 Include symbol version in error message.
2099
2100 2008-07-20 Chris Demetriou <cgd@google.com>
2101
2102 * configure.ac (gold_cv_c_random_seed): New configured variable.
2103 (RANDOM_SEED_CFLAGS): New substituted variable.
2104 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
2105 * configure: Rebuild.
2106 * Makefile.in: Likewise.
2107 * testsuite/Makefile.in: Likewise.
2108
2109 2008-07-18 Ian Lance Taylor <iant@google.com>
2110
2111 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
2112 where we see NAME/NULL and NAME/VERSION as separate symbols.
2113 * testsuite/ver_test_main.cc (main): Call t4.
2114 (t4, t4_2a): Define.
2115 * testsuite/ver_test_2.cc (t4_2): Define.
2116 * testsuite/ver_test_2.script: Put t4_2a in VER2.
2117 * testsuite/ver_test_4.cc (t4_2a): Define.
2118 * testsuite/ver_test_4.script: Put t4_2a in VER2.
2119 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
2120
2121 2008-07-17 Ian Lance Taylor <iant@google.com>
2122
2123 * dynobj.cc (Versions::add_def): If we give an error about a
2124 missing version, go ahead and create the version anyhow.
2125
2126 2008-07-10 Ian Lance Taylor <iant@google.com>
2127
2128 Handle output sections with more than 0x7fffffff bytes.
2129 * object.h (class Relobj): Change map_to_output_ to
2130 output_sections_, and just keep a section pointer. Change all
2131 uses. Move comdat group support to Sized_relobj.
2132 (Relobj::is_section_specially_mapped): Remove.
2133 (Relobj::output_section): Remove poff parameter. Change all
2134 callers.
2135 (Relobj::output_section_offset): New function.
2136 (Relobj::set_section_offset): Rewrite.
2137 (Relobj::map_to_output): Remove.
2138 (Relobj::output_sections): New function.
2139 (Relobj::do_output_section_offset): New pure virtual function.
2140 (Relobj::do_set_section_offset): Likewise.
2141 (class Sized_relobj): Add section_offsets_ field. Add comdat
2142 group support from Relobj. Update declarations.
2143 (Sized_relobj::get_output_section_offset): New function.
2144 (Sized_relobj::do_output_section_offset): New function.
2145 (Sized_relobj::do_set_section_offset): New function.
2146 * object.cc (Relobj::output_section_address): Remove.
2147 (Sized_relobj::Sized_relobj): Initialize new fields.
2148 (Sized_relobj::include_section_group): Cast find_kept_object to
2149 Sized_relobj.
2150 (Sized_relobj::include_linkonce_section): Likewise.
2151 (Sized_relobj::do_layout): Use separate arrays for output section
2152 and output offset.
2153 (Sized_relobj::do_count_local_symbols): Change map_to_output to
2154 output_sections.
2155 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
2156 output_sections and section_offsets.
2157 (Sized_relobj::write_local_symbols): Likewise.
2158 (map_to_kept_section): Compute output address directly.
2159 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
2160 output_sections and section_offsets.
2161 (Sized_relobj::write_sections): Likewise.
2162 (Sized_relobj::relocate_sections): Likewise.
2163 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
2164 * output.h (class Output_reloc): Update declarations. Change
2165 u2_.relobj to Sized_relobj*.
2166 (class Output_data_reloc): Change add functions to use
2167 Sized_relobj*.
2168 * output.cc (Output_reloc::Output_reloc): Change relobj to
2169 Sized_relobj*.
2170 (Output_reloc::local_section_offset): Change return type to
2171 Elf_Addr. Use get_output_section_offset.
2172 (Output_reloc::get_address): Likewise.
2173 (Output_section::is_input_address_mapped): Don't call
2174 is_section_specially_mapped.
2175 (Output_section::output_offset): Likewise.
2176 (Output_section::output_address): Likewise.
2177 (Output_section::starting_output_address): Likewise.
2178 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
2179 parameter to Sized_relobj*.
2180 (Copy_relocs::need_copy_reloc): Likewise.
2181 (Copy_relocs::save): Likewise.
2182 * copy-relocs.h (class Copy_relocs): Update declarations.
2183 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
2184 Sized_relobj*. Change relobj_ field to Sized_relobj*.
2185 * target-reloc.h (relocate_for_relocatable): Change
2186 offset_in_output_section type to Elf_Addr. Change code that uses
2187 it as well.
2188 * layout.cc (Layout::layout): Always set *off.
2189 * mapfile.cc (Mapfile::print_input_section): Use
2190 output_section_offset.
2191 * i386.cc (Target_i386::copy_reloc): Change object parameter to
2192 Sized_relobj*.
2193 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
2194 * sparc.cc (Target_sparc::copy_reloc): Likewise.
2195 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
2196
2197 2008-07-03 Ian Lance Taylor <iant@google.com>
2198
2199 * layout.cc (Layout::include_section): Do not discard unrecognized
2200 SHT_STRTAB sections.
2201
2202 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
2203
2204 * script.cc (Lex::can_continue_name): Make '?' allowable in
2205 version-script names.
2206 * testsuite/version_script.map: Change glob pattern to use '?'
2207
2208 2008-06-30 Manish Singh <yosh@gimp.org>
2209
2210 PR 6585
2211 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
2212 Correct typo.
2213
2214 2008-06-30 Ian Lance Taylor <iant@google.com>
2215
2216 PR 6660
2217 PR 6682
2218 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
2219 versions]: Don't try to read the value in the contents, since we
2220 don't use it. Use the template endianness when writing.
2221
2222 2008-06-25 Cary Coutant <ccoutant@google.com>
2223
2224 * fileread.cc (File_read::make_view): Assert on zero-length view.
2225 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
2226 symbol table when there are no symbols to read.
2227
2228 2008-06-23 Craig Silverstein <csilvers@google.com>
2229
2230 * version.cc (version_string): Bump to 1.7
2231
2232 2008-06-18 Craig Silverstein <csilvers@google.com>
2233
2234 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
2235 constant 0xFFFF to type Valtype.
2236 (Powerpc_relocate_functions::rel16_ha): Likewise.
2237
2238 2008-06-17 Ian Lance Taylor <iant@google.com>
2239
2240 * output.h (Output_section::Input_section): Initialize p2align_ to
2241 zero for Output_section_data constructors.
2242 (Output_section::Input_section::addralign): If not an input
2243 section, return the alignment of the Output_section_data.
2244 * testsuite/copy_test.cc: New file.
2245 * testsuite/copy_test_1.cc: New file.
2246 * testsuite/copy_test_2.cc: New file.
2247 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
2248 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
2249 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
2250 (copy_test_1_pic.o, copy_test_1.so): New targets.
2251 (copy_test_2_pic.o, copy_test_2.so): New targets.
2252 * testsuite/Makefile.in: Rebuild.
2253
2254 * script-sections.cc (Script_sections::place_orphan): Initialize
2255 local variable exact.
2256
2257 2008-06-13 David Edelsohn <edelsohn@gnu.org>
2258
2259 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
2260
2261 2008-06-12 David Edelsohn <edelsohn@gnu.org>
2262 David S. Miller <davem@davemloft.net>
2263
2264 * powerpc.cc: New file.
2265 * Makefile.am (TARGETSOURCES): Add powerpc.cc
2266 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
2267 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
2268 * Makefile.in: Rebuild.
2269
2270 2008-06-09 Ian Lance Taylor <iant@google.com>
2271
2272 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
2273 <exception>.
2274 (throwing, orig_terminate): New static variables.
2275 (terminate_handler): New static function.
2276 (t2): Set terminate handler.
2277
2278 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
2279
2280 PR 6584
2281 * binary.cc (Binary_to_elf::sized_convert): Fix .data
2282 alignment.
2283
2284 2008-05-30 Cary Coutant <ccoutant@google.com>
2285
2286 * archive.cc (Archive::include_all_members) Correct to step
2287 over symbol table and extended name table in thin archives.
2288
2289 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
2290
2291 PR 6407
2292 * target-reloc.h (relocate_for_relocatable): Fix new_offset
2293 calculation.
2294
2295 2008-05-28 Caleb Howe <cshowe@google.com>
2296
2297 * reduced_debug_output.cc: New file.
2298 * reduced_debug_output.h: New file.
2299 * options.h (class General_options): Add --strip-debug-non-line.
2300 * options.cc (General_options::finalize): Add strip_debug_non_line
2301 to the strip heirarchy.
2302 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
2303 fields.
2304 * layout.cc: Include "reduced_debug_output.h".
2305 (Layout::Layout): Initialize new fields.
2306 (line_only_debug_sections): New static array.
2307 (is_lines_only_debug_sections): New static inline function.
2308 (Layout::include_section): Handle --strip-debug-non-line.
2309 (Layout::make_output_section): If --strip-debug-non-line, build
2310 new output sections for .debug_abbrev and .debug_info.
2311 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
2312 gold. Warn about possible overflow.
2313 (read_signed_LEB_128): Likewise.
2314 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
2315 (read_signed_LEB_128): Declare.
2316 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
2317 (HFILES): Add reduced_debug_output.h.
2318 * Makefile.in: Rebuild.
2319
2320 2008-05-21 Ian Lance Taylor <iant@google.com>
2321
2322 * mapfile.cc: New file.
2323 * mapfile.h: New file.
2324 * options.h (class General_options): Add -M/--print-map and -Map.
2325 * options.cc (General_options::finalize): Make -M equivalent to
2326 -Map -.
2327 * main.cc: Include <cstdio> and "mapfile.h".
2328 (main): Open mapfile if requested.
2329 * gold.cc (class Middle_runner): Add mapfile_ field. Update
2330 constructor. Change caller.
2331 (queue_initial_tasks): Add mapfile parameter. Change caller.
2332 (queue_middle_tasks): Likewise.
2333 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
2334 declarations.
2335 * archive.cc: Include "mapfile.h".
2336 (Archive::add_symbols): Add mapfile parameter. Change all
2337 callers. Pass mapfile, symbol, and reason to include_member.
2338 (Archive::include_all_members): Add mapfile parameter. Change all
2339 callers.
2340 (Archive::include_member): Add mapfile, sym, and why parameters.
2341 Change all callers. Report inclusion to map file.
2342 * archive.h: Include "fileread.h".
2343 (class Archive): Update declarations.
2344 (Archive::file): New const method.
2345 (class Add_archive_symbols): Add mapfile_ field. Update
2346 constructor. Change all callers.
2347 * readsyms.h (class Read_symbols): Likewise.
2348 (class Finish_group): Likewise.
2349 (class Read_script): Likewise.
2350 * common.cc: Include "mapfile.h".
2351 (Symbol_table::allocate_commons): Add mapfile parameter. Change
2352 all callers.
2353 (Symbol_table::do_allocate_commons): Likewise.
2354 (Symbol_table::do_allocate_commons_list): Likewise. Report common
2355 symbol allocation to mapfile.
2356 * common.h (class Allocate_commons_task): Add mapfile_ field.
2357 Update constructor. Change all callers.
2358 * symtab.h (class Symbol_table): Update declarations.
2359 * layout.cc: Include "mapfile.h".
2360 (Layout_task_runner::run): Print information to mapfile.
2361 (Layout::create_gold_note): Change Output_data_fixed_space to
2362 Output_data_zero_fill.
2363 (Layout::create_build_id): Likewise.
2364 (Layout::print_to_mapfile): New function.
2365 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
2366 constructor. Change caller.
2367 (class Layout): Declare print_to_mapfile.
2368 * output.cc (Output_section::Input_section::print_to_mapfile): New
2369 function.
2370 (Output_section::add_input_section): If producing a map, always
2371 add to input_sections_ list.
2372 (Output_section::do_print_to_mapfile): New function.
2373 (Output_segment::print_sections_to_mapfile): New function.
2374 (Output_segment::print_section_list_to_mapfile): New function.
2375 * output.h: Include "mapfile.h".
2376 (Output_data::print_to_mapfile): New function.
2377 (Output_data::do_print_to_mapfile): New virtual function.
2378 (Output_segment_headers::do_print_to_mapfile): New function.
2379 (Output_file_header::do_print_to_mapfile): New function.
2380 (Output_data_const::do_print_to_mapfile): New function.
2381 (class Output_data_const_buffer): Add map_name_ field. Update
2382 constructor. Change all callers. Add do_print_to_mapfile
2383 function.
2384 (class Output_data_fixed_space): Likewise.
2385 (class Output_data_space): Likewise.
2386 (class Output_data_zero_fill): New class.
2387 (Output_data_strtab::do_print_to_mapfile): New function.
2388 (Output_data_reloc_base::do_print_to_mapfile): New function.
2389 (Output_relocatable_relocs::do_print_to_mapfile): New function.
2390 (Output_data_group::do_print_to_mapfile): New function.
2391 (Output_data_got::do_print_to_mapfile): New function.
2392 (Output_data_dynamic::do_print_to_mapfile): New function.
2393 (Output_symtab_xindex::do_print_to_mapfile): New function.
2394 (class Output_section): Declare do_print_to_mapflie. Declare
2395 print_to_mapfile in Input_section.
2396 (class Output_segment): Declare new functions.
2397 * object.h (Sized_relobj::symbol_count): New function.
2398 * script-sections.cc
2399 (Output_section_element_dot_assignment::set_section_addresses):
2400 Change Output_data_fixed_space to Output_data_zero_fill.
2401 (Output_data_expression::do_print_to_mapfile): New function.
2402 * script.cc (read_input_script): Add mapfile parameter. Change
2403 all callers.
2404 * script.h (read_input_script): Update declaration.
2405 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
2406 (Eh_frame::do_print_to_mapfile): New function.
2407 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
2408 (Output_merge_string::do_print_to_mapfile): New function.
2409 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
2410 function.
2411 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
2412 function.
2413 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
2414 function.
2415 * Makefile.am (CCFILES): Add mapfile.cc.
2416 (HFILES): Add mapfile.h.
2417 * Makefile.in: Rebuild.
2418
2419 2008-05-19 Ian Lance Taylor <iant@google.com>
2420
2421 * options.h (class General_options): Add -z relro.
2422 * layout.cc (Layout::Layout): Initialize relro_segment_.
2423 (Layout::add_output_section_data): Return the output section.
2424 (Layout::make_output_section): Rcognize relro sections and mark
2425 them appropriately.
2426 (Layout::attach_allocated_section_to_segment): Put relro sections
2427 in a PT_GNU_RELRO segment.
2428 (Layout::create_initial_dynamic_sections): Mark the .dynamic
2429 section as relro.
2430 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
2431 PT_TLS segments.
2432 (Layout::linkonce_mapping): Map d.rel.ro.local to
2433 .data.rel.ro.local.
2434 (Layout::output_section_name): Us .data.rel.ro.local for any
2435 section which begins with that.
2436 * layout.h (class Layout): Update add_output_section_data
2437 declaration. Add relro_segment_ field.
2438 * output.cc (Output_section::Output_section): Initialize is_relro_
2439 and is_relro_local_ fields.
2440 (Output_segment::add_output_section): Group relro sections.
2441 (Output_segment::is_first_section_relro): New function.
2442 (Output_segment::maximum_alignment): If there is a relro section,
2443 align the segment to the common page size.
2444 (Output_segment::set_section_addresses): Track whether we are
2445 looking at relro sections. If the last section is a relro
2446 section, align to the common page size.
2447 (Output_segment::set_section_list_addresses): Add in_relro
2448 parameter. Change all callers. Align to the page size when
2449 moving from relro to non-relro section.
2450 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
2451 segment.
2452 * output.h (class Output_section): Add is_relro_ and
2453 is_relro_local_ fields.
2454 (Output_section::is_relro): New function.
2455 (Output_section::set_is_relro): New function.
2456 (Output_section::is_relro_local): New function.
2457 (Output_section::set_is_relro_local): New function.
2458 (class Output_segment): Update declarations.
2459 * i386.cc (Target_i386::got_section): Mark .got section as relro.
2460 * sparc.cc (Target_sparc::got_section): Likewise.
2461 * x86_64.cc (Target_x86_64::got_section): Likewise.
2462 * testsuite/relro_test_main.cc: New file.
2463 * testsuite/relro_test.cc: New file.
2464 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
2465 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
2466 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
2467 (relro_test.so, relro_test_pic.o): New targets.
2468 * testsuite/Makefile.in: Rebuild.
2469
2470 2008-05-16 Ian Lance Taylor <iant@google.com>
2471
2472 * output.cc (Output_segment::add_output_section): Remove front
2473 parameter.
2474 * output.h (class Output_segment): Remove
2475 add_initial_output_section and overloaded add_output_section.
2476 Update declaration of remaining add_output_section.
2477 * layout.cc (Layout::create_interp): Call add_output_section
2478 rather than add_initial_output_section.
2479 (Layout::finish_dynamic_section): Likewise.
2480
2481 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
2482 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
2483 know the dynamic type.
2484 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
2485 field. Initialize it in constructor.
2486 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
2487 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
2488 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
2489 reloc.
2490
2491 * output.cc (Output_reloc::get_address): Change return type to
2492 Elf_Addr.
2493 * output.h (class Output_reloc): Update get_address declaration.
2494 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
2495 for section addresses.
2496
2497 2008-05-09 Ian Lance Taylor <iant@google.com>
2498
2499 PR 6493
2500 * gold.cc (gold_nomem): Use return value of write.
2501
2502 2008-05-08 Ian Lance Taylor <iant@google.com>
2503
2504 * symtab.c (Symbol::init_base_output_data): Add version
2505 parameter. Change all callers.
2506 (Symbol::init_base_output_segment): Likewise.
2507 (Symbol::init_base_constant): Likewise.
2508 (Symbol::init_base_undefined): Likewise.
2509 (Sized_symbol::init_output_data): Likewise.
2510 (Sized_symbol::init_output_segment): Likewise.
2511 (Sized_symbol::init_constant): Likewise.
2512 (Sized_symbol::init_undefined): Likewise.
2513 (Symbol_table::do_define_in_output_data): If the new symbol has a
2514 version, mark it as the default.
2515 (Symbol_table::do_define_in_output_segment): Likewise.
2516 (Symbol_table::do_define_as_constant): Likewise.
2517 * symtab.h (class Symbol): Update declarations.
2518 (class Sized_symbol): Likewise.
2519 * resolve.cc (Symbol::override_version): New function.
2520 (Symbol::override_base): Call override_version.
2521 (Symbol::override_base_with_special): Likewise.
2522 * testsuite/ver_script_8.script: New file.
2523 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
2524 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
2525 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
2526 (ver_test_8_1.so, ver_test_8_2.so): New targets.
2527
2528 2008-05-06 Ian Lance Taylor <iant@google.com>
2529
2530 PR 6049
2531 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
2532 functions.
2533 (class General_options): Remove existing --undefined, and add
2534 --no-undefined instead. Add new --undefined as synonym for -u.
2535 * archive.cc (Archive::add_symbols): Check whether symbol was
2536 named with -u.
2537 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
2538 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
2539 all uses. Add IS_UNDEFINED. Update declarations to split
2540 different versions of init_base. Declare init_base_undefined.
2541 (Symbol::is_defined): Handle IS_UNDEFINED.
2542 (Symbol::is_undefined): Likewise.
2543 (Symbol::is_weak_undefined): Call is_undefined.
2544 (Symbol::is_absolute): Handle IS_CONSTANT.
2545 (class Sized_symbol): Update declarations to split different
2546 versions of init. Declare init_undefined.
2547 (class Symbol_table): Declare new functions.
2548 * symtab.cc (Symbol::init_base_object): Rename from init_base.
2549 Change all callers.
2550 (Symbol::init_base_output_data): Likewise.
2551 (Symbol::init_base_output_segment): Likewise.
2552 (Symbol::init_base_constant): Likewise.
2553 (Symbol::init_base_undefined): New function.
2554 (Sized_symbol::init_object): Rename from init. Change all
2555 callers.
2556 (Sized_symbol::init_output_data): Likewise.
2557 (Sized_symbol::init_output_segment): Likewise.
2558 (Sized_symbol::init_constant): Likewise.
2559 (Sized_symbol::init_undefined): New function.
2560 (Symbol_table::add_undefined_symbols_from_command_line): New
2561 function.
2562 (Symbol_table::do_add_undefined_symbols_from_command_line): New
2563 function.
2564 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
2565 (Symbol::output_section): Likewise.
2566 (Symbol::set_output_section): Likewise.
2567 (Symbol_table::sized_finalize_symbol): Likewise.
2568 (Symbol_table::sized_write_globals): Likewise.
2569 * resolve.cc (Symbol_table::should_override): Likewise.
2570 (Symbol::override_base_with_special): Likewise.
2571
2572 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
2573 symbol, change it to have default visibility.
2574 * testsuite/protected_1.cc: New file.
2575 * testsuite/protected_2.cc: New file.
2576 * testsuite/protected_3.cc: New file.
2577 * testsuite/protected_main_1.cc: New file.
2578 * testsuite/protected_main_2.cc: New file.
2579 * testsuite/protected_main_3.cc: New file.
2580 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
2581 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
2582 (protected_1_LDFLAGS, protected_1_LDADD): Define.
2583 (protected_1.so): New target.
2584 (protected_1_pic.o, protected_2_pic.o): New targets.
2585 (protected_3_pic.o): New target.
2586 (check_PROGRAMS): Add protected_2.
2587 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
2588 (protected_2_LDFLAGS, protected_2_LDADD): Define.
2589 * testsuite/Makefile.in: Rebuild.
2590
2591 * options.h (DEFINE_var): Add set_user_set_##varname__.
2592 (DEFINE_bool_alias): New macro.
2593 (class General_options): Define -Bstatic using DEFINE_bool_alias
2594 rather than DEFINE_special. Add --undefined as an alias for -z
2595 defs.
2596 * options.cc (General_options::parse_Bstatic): Remove.
2597
2598 * options.h (class General_options): Add --fatal-warnings.
2599 * main.cc (main): Implement --fatal-warnings.
2600 * errors.h (Errors::warning_count): New function.
2601
2602 * options.h (class General_options): Add -Bsymbolic-functions.
2603 * symtab.h (Symbol::is_preemptible): Check for
2604 -Bsymbolic-functions.
2605
2606 2008-05-05 Ian Lance Taylor <iant@google.com>
2607
2608 * options.h (DEFINE_bool): For DASH_Z, create the negative option
2609 as noVARNAME rather than no-VARNAME.
2610 (class General_options): Add option -z combreloc.
2611 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
2612 get_address.
2613 (Output_reloc::sort_before) [SHT_REL]: New function.
2614 (Output_reloc::sort_before) [SHT_RELA]: New function.
2615 (class Output_data_reloc_base): Add sort_relocs_ field. Define
2616 Sort_relocs_comparison.
2617 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
2618 parameter. Change all callers.
2619 (Output_data_reloc::Output_data_reloc) [both versions]: Add
2620 sort_relocs parameter. Change all callers.
2621 * output.cc (Output_reloc::get_address): New function, broken out
2622 of write_rel.
2623 (Output_reloc::write_rel): Call it.
2624 (Output_reloc::compare): New function.
2625 (Output_data_reloc_base::do_write): Optionally sort relocs.
2626
2627 * configure.ac: If targ_extra_obj is set, link it in.
2628 * configure.tgt: Initialize all variables.
2629 (x86_64*): Set targ_extra_obj and targ_extra_size.
2630 * configure: Rebuild.
2631
2632 * object.cc (Sized_relobj::include_section_group): Adjust section
2633 indexes read from group data. Build vector to pass to
2634 layout_group.
2635 * layout.cc (Layout::layout_group): Add flags and shndxes
2636 parameters. Remove contents parameter. Change caller. Update
2637 explicit instantiations.
2638 * layout.h (class Layout): Update layout_group declaration.
2639 * output.cc (Output_data_group::Output_data_group): Add flags and
2640 input_shndxes parameters. Remove contents parameter. Change
2641 caller.
2642 (Output_data_group::do_write): Change input_sections_ to
2643 input_shndxes_.
2644 * output.h (class Output_data_group): Update constructor
2645 declaration. Rename input_sections_ to input_shndxes_.
2646 * testsuite/many_sections_test.cc: Add template.
2647
2648 2008-04-30 Cary Coutant <ccoutant@google.com>
2649
2650 * target-reloc.h (relocate_section): Fix dead-pointer bug.
2651
2652 * layout.cc (Layout::include_section): Refactored check for debug
2653 info section.
2654 (Layout::add_comdat): Add new parameters. Change type
2655 of signature parameter. Add object and shndx to signatures table.
2656 (Layout::find_kept_object): New function.
2657 * layout.h: Include <cstring>.
2658 (Layout::is_debug_info_section): New function.
2659 (Layout::add_comdat): Add new parameters.
2660 (Layout::find_kept_object): New function.
2661 (Layout::Kept_section): New struct.
2662 (Layout::Signatures): Change type of map range.
2663 * object.cc (Relobj::output_section_address): New function.
2664 (Sized_relobj::include_section_group): Add new parameters. Change
2665 calls to Layout::add_comdat. Change to build table of kept comdat
2666 groups and table mapping discarded sections to kept sections.
2667 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
2668 (Sized_relobj::do_layout): Change calls to include_section_group and
2669 include_linkonce_section.
2670 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
2671 value to zero when section is discarded.
2672 (Sized_relobj::map_to_kept_section): New function.
2673 * object.h (Relobj::output_section_address): New function.
2674 (Relobj::Comdat_group): New type.
2675 (Relobj::find_comdat_group): New function.
2676 (Relobj::Comdat_group_table): New type.
2677 (Relobj::Kept_comdat_section): New type.
2678 (Relobj::Kept_comdat_section_table): New type.
2679 (Relobj::add_comdat_group): New function.
2680 (Relobj::set_kept_comdat_section): New function.
2681 (Relobj::get_kept_comdat_section): New function.
2682 (Relobj::comdat_groups_): New field.
2683 (Relobj::kept_comdat_sections_): New field.
2684 (Symbol_value::input_value): Update comment.
2685 (Sized_relobj::map_to_kept_section) New function.
2686 (Sized_relobj::include_linkonce_section): Add new parameter.
2687 * target-reloc.h (Comdat_behavior): New type.
2688 (get_comdat_behavior): New function.
2689 (relocate_section): Add code to map a discarded section to the
2690 corresponding kept section when applying a relocation.
2691
2692 2008-04-30 Craig Silverstein <csilvers@google.com>
2693
2694 * dwarf_reader.cc (next_generation_count): New static var.
2695 (Addr2line_cache_entry): New struct.
2696 (addr2line_cache): New static var.
2697 (Dwarf_line_info::one_addr2line): Added caching.
2698 (Dwarf_line_info::clear_addr2line_cache): New function.
2699 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
2700 cache-size parameter.
2701 (Dwarf_line_info::one_addr2line_cache): New function.
2702 * symtab.cc (Symbol_table::detect_odr_violations): Pass
2703 new cache-size argument to one_addr2line(), and clear cache.
2704
2705 2008-04-28 Cary Coutant <ccoutant@google.com>
2706
2707 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
2708 R_386_PC8 relocations.
2709
2710 2008-04-23 Ian Lance Taylor <iant@google.com>
2711
2712 * object.cc (Sized_relobj::include_section_group): Check for
2713 invalid section group.
2714
2715 * object.cc (make_elf_object): Correct test for 64-bit ELF file
2716 header size.
2717
2718 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
2719 than read for file header.
2720 * archive.cc (Archive::include_member): Likewise.
2721
2722 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
2723
2724 * aclocal.m4: Regenerate.
2725 * configure: Regenerate.
2726
2727 2008-04-19 Ian Lance Taylor <iant@google.com>
2728
2729 * version.cc (version_string): Bump to 1.6.
2730
2731 * testsuite/Makefile.am (many_sections_r_test): New target.
2732 (many_sections_r_test_SOURCES): Remove.
2733 (many_sections_r_test_DEPENDENCIES): Remove.
2734 (many_sections_r_test_LDFLAGS): Remove.
2735 (many_sections_r_test_LDADD): Remove.
2736
2737 * object.cc (Sized_relobj::do_add_symbols): Always pass
2738 local_symbol_count_ to add_from_relobj.
2739
2740 * testsuite/Makefile.am (many_sections_check.h): Only check one in
2741 every thousand variables.
2742 * testsuite/Makefile.in: Rebuild.
2743
2744 * object.cc (Xindex::initialize_symtab_xindex): New function.
2745 (Xindex::read_symtab_xindex): New function.
2746 (Xindex::sym_xindex_to_shndx): New function.
2747 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
2748 available.
2749 (Sized_relobj::do_initialize_xindex): New function.
2750 (Sized_relobj::do_read_symbols): Adjust section links.
2751 (Sized_relobj::symbol_section_and_value): Add is_ordinary
2752 parameter. Change all callers.
2753 (Sized_relobj::include_section_group): Adjust section links and
2754 symbol section indexes.
2755 (Sized_relobj::do_layout): Adjust section links.
2756 (Sized_relobj::do_count_local_symbols): Adjust section links and
2757 symbol section indexes.
2758 (Sized_relobj::do_finalize_local_symbols): Distinguish between
2759 ordinary and special symbols.
2760 (Sized_relobj::write_local_symbols): Add symtab_xindex and
2761 dynsym_xindex parameters. Change all callers. Adjust section
2762 links. Use SHN_XINDEX when needed.
2763 (Sized_relobj::get_symbol_location_info): Adjust section links.
2764 Don't get fooled by special symbols.
2765 * object.h (class Xindex): Define.
2766 (class Object): Add xindex_ parameter. Declare virtual functoin
2767 do_initialize_xindex.
2768 (Object::adjust_sym_shndx): New function.
2769 (Object::set_xindex): New protected function.
2770 (class Symbol_value): Add is_ordinary_shndx_ field.
2771 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
2772 (Symbol_value::value): Assert ordinary section.
2773 (Symbol_value::initialize_input_to_output_map): Likewise.
2774 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
2775 Change all callers.
2776 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
2777 all callers.
2778 (class Sized_relobj): Update declarations.
2779 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
2780 parameter. Change all callers.
2781 (Sized_relobj::adjust_shndx): New function.
2782 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
2783 field.
2784 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
2785 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
2786 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
2787 (Sized_dynobj::read_dynsym_section): Adjust section links.
2788 (Sized_dynobj::read_dynamic): Likewise.
2789 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
2790 section links.
2791 (Sized_dynobj::do_initialize_xindex): New function.
2792 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
2793 do_initialize_xindex.
2794 (Sized_dynobj::adjust_shndx): New function.
2795 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
2796 dynsym_xindex_ fields.
2797 (Layout::finalize): Add a call to set_section_indexes before
2798 creating the symtab sections.
2799 (Layout::set_section_indexes): Don't do anything if the section
2800 already has a section index.
2801 (Layout::create_symtab_sections): Add shnum parameter. Change
2802 caller. Create .symtab_shndx section if needed.
2803 (Layout::create_shdrs): Add shstrtab_section parameter. Change
2804 caller.
2805 (Layout::allocated_output_section_count): New function.
2806 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
2807 needed.
2808 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
2809 fields. Update declarations.
2810 (Layout::symtab_xindex): New function.
2811 (Layout::dynsym_xindex): New function.
2812 (class Write_symbols_task): Add layout_ field.
2813 (Write_symbols_task::Write_symbols_task): Add layout parameter.
2814 Change caller.
2815 * output.cc (Output_section_headers::Output_section_headers): Add
2816 shstrtab_section parameter. Change all callers.
2817 (Output_section_headers::do_sized_write): Store overflow values
2818 for section count and section string table section index in
2819 section header zero.
2820 (Output_file_header::do_sized_write): Check for overflow of
2821 section count and section string table section index.
2822 (Output_symtab_xindex::do_write): New function.
2823 (Output_symtab_xindex::endian_do_write): New function.
2824 * output.h (class Output_section_headers): Add shstrtab_section_.
2825 Update declarations.
2826 (class Output_symtab_xindex): Define.
2827 (Output_section::has_out_shndx): New function.
2828 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
2829 field.
2830 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
2831 Change all callers.
2832 (Sized_symbol::init): Likewise.
2833 (Symbol::output_section): Check for ordinary symbol.
2834 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
2835 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
2836 callers.
2837 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
2838 Change all callers. Simplify handling of symbols from sections
2839 not included in the link.
2840 (Symbol_table::add_from_dynobj): Handle ordinary symbol
2841 distinction.
2842 (Weak_alias_sorter::operator()): Assert that symbols are
2843 ordinary.
2844 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
2845 distinction.
2846 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
2847 parameters. Change all callers.
2848 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
2849 symbol distinction. Use SHN_XINDEX when needed.
2850 (Symbol_table::write_section_symbol): Add symtab_xindex
2851 parameter. Change all callers.
2852 (Symbol_table::sized_write_section_symbol): Likewise. Use
2853 SHN_XINDEX when needed.
2854 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
2855 declarations.
2856 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
2857 (Symbol::is_defined): Check is_ordinary.
2858 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
2859 (Symbol::is_absolute, Symbol::is_common): Likewise.
2860 (class Sized_symbol): Update declarations.
2861 (class Symbol_table): Update declarations.
2862 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
2863 parameters. Change all callers.
2864 (Sized_symbol::override): Likewise.
2865 (Symbol_table::override): Likewise.
2866 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
2867 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
2868 is_ordinary, and orig_st_shndx parameters. Change all callers.
2869 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
2870 to be in an ordinary section.
2871 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
2872 object and is_ordinary parameters. Change all callers.
2873 (Sized_dwarf_line_info::read_relocs): Add object parameter.
2874 Change all callers. Don't add undefined or non-ordinary symbols
2875 to reloc_map_.
2876 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
2877 Change all callers.
2878 * dwarf_reader.h (class Sized_dwarf_line_info): Update
2879 declarations.
2880 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
2881 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
2882 (Sized_relobj::relocate_sections): Likewise.
2883 * target-reloc.h (scan_relocs): Adjust section symbol index.
2884 (scan_relocatable_relocs): Likewise.
2885 * i386.cc (Scan::local): Check for ordinary symbols.
2886 * sparc.cc (Scan::local): Likewise.
2887 * x86_64.cc (Scan::local): Likewise.
2888 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
2889 to symbol_section_and_value.
2890 * testsuite/many_sections_test.cc: New file.
2891 * testsuite/Makefile.am (BUILT_SOURCES): Define.
2892 (check_PROGRAMS): Add many_sections_test.
2893 (many_sections_test_SOURCES): Define.
2894 (many_sections_test_DEPENDENCIES): Define.
2895 (many_sections_test_LDFLAGS): Define.
2896 (BUILT_SOURCES): Add many_sections_define.h.
2897 (many_sections_define.h): New target.
2898 (BUILT_SOURCES): Add many_sections_check.h.
2899 (many_sections_check.h): New target.
2900 (check_PROGRAMS): Add many_sections_r_test.
2901 (many_sections_r_test_SOURCES): Define.
2902 (many_sections_r_test_DEPENDENCIES): Define.
2903 (many_sections_r_test_LDFLAGS): Define.
2904 (many_sections_r_test_LDADD): Define.
2905 (many_sections_r_test.o): New target.
2906 * testsuite/Makefile.in: Rebuild.
2907
2908 2008-04-17 Cary Coutant <ccoutant@google.com>
2909
2910 * errors.cc (Errors::info): New function.
2911 (gold_info): New function.
2912 * errors.h (Errors::info): New function.
2913 * gold.h (gold_info): New function.
2914 * object.cc (Input_objects::add_object): Print trace output.
2915 * options.cc (options::parse_set): New function.
2916 (General_options::parse_wrap): Deleted.
2917 (General_options::General_options): Deleted initializer.
2918 * options.h (options::String_set): New typedef.
2919 (options::parse_set): New function.
2920 (DEFINE_set): New macro.
2921 (General_options::wrap): Changed to use DEFINE_set. Changed
2922 callers of any_wrap_symbols and is_wrap_symbol.
2923 (General_options::trace, General_options::trace_symbol):
2924 New options.
2925 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
2926 (General_options::wrap_symbols_): Deleted.
2927 * symtab.cc (Symbol_table::add_from_object): Print trace output.
2928
2929 2008-04-17 David S. Miller <davem@davemloft.net>
2930
2931 * options.cc (General_options::parse_V): New function.
2932 * options.h: Add entries for -V and -Qy.
2933
2934 2008-04-17 Ian Lance Taylor <iant@google.com>
2935
2936 * common.cc (Symbol_table::allocate_commons): Remove options
2937 parameter. Change caller.
2938 (Symbol_table::do_allocate_commons): Remove options parameter.
2939 Change caller. Just call do_allocate_commons_list twice.
2940 (Symbol_table::do_allocate_commons_list): New function, broken out
2941 of do_allocate_commons.
2942 * common.h (class Allocate_commons_task): Remove options_ field.
2943 Update constructor.
2944 * symtab.cc (Symbol_table::Symbol_table): Initialize
2945 tls_commons_.
2946 (Symbol_table::add_from_object): Put TLS common symbols on
2947 tls_commons_ list.
2948 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
2949 which are IN_OUTPUT_DATA.
2950 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
2951 allocate_commons and do_allocate_commons declarations. Declare
2952 do_allocate_commons_list.
2953 * gold.cc (queue_middle_tasks): Update creation of
2954 Allocate_commons_task to not pass options.
2955 * testsuite/Makefile.am (INCLUDES): Add -I.. .
2956 (TLS_TEST_C_FLAGS): New variable.
2957 (tls_test_c_pic.o): New target.
2958 (tls_test_shared.so): Link in tls_test_c_pic.o.
2959 (tls_test_c_pic_ie.o): New target.
2960 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
2961 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
2962 (tls_test_c.o): New target.
2963 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
2964 (tls_pic_test_LDADD): Likewise.
2965 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
2966 (tls_shared_gd_to_ie_test_LDADD): Likewise.
2967 (tls_test_c_gnu2.o): New target.
2968 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
2969 tls_test_c_gnu2.o.
2970 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
2971 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
2972 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
2973 * testsuite/tls_test.cc: Include "config.h".
2974 (t_last): Call t11_last.
2975 * testsuite/tls_test.h (t11, t11_last): Declare.
2976 * testsuite/tls_test_c.c: New file.
2977 * testsuite/tls_test_main.cc (thread_routine): Call t11.
2978 * configure.ac: Check for OpenMP support.
2979 * configure, config.in, Makefile.in: Rebuild.
2980 * testsuite/Makefile.in: Rebuild.
2981
2982 2008-04-16 Cary Coutant <ccoutant@google.com>
2983
2984 * i386.cc (Target_i386::define_tls_base_symbol): New function.
2985 (Target_i386::tls_base_symbol_defined_): New field.
2986 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
2987 (Target_i386::Scan::global): Likewise.
2988 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
2989 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
2990 (Target_x86_64::tls_base_symbol_defined_): New field.
2991 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
2992 (Target_x86_64::Scan::global): Likewise.
2993
2994 2008-04-16 Cary Coutant <ccoutant@google.com>
2995
2996 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
2997 (Symbol::needs_plt_entry): Allow weak undefined symbols.
2998 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
2999 building shared libraries.
3000 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
3001 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
3002 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
3003 * testsuite/Makefile.in: Rebuild.
3004 * testsuite/weak_undef.h: New file.
3005 * testsuite/weak_undef_file1.cc: Add extra test cases.
3006 * testsuite/weak_undef_file2.cc: Likewise.
3007 * testsuite/weak_undef_test.cc: Likewise.
3008
3009 2008-04-16 David S. Miller <davem@davemloft.net>
3010
3011 * sparc.cc (Target_sparc::Scan): Change from struct to class.
3012 Add issued_non_pic_error_ field. Declare check_non_pic.
3013 (Target_sparc::Scan::check_non_pic): New function.
3014 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
3015 (Target_sparc::Scan::global): Likewise.
3016
3017 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
3018 * configure: Rebuild.
3019
3020 * options.h (DEFINE_enable): New macro.
3021 (new_dtags): New enable option.
3022 (initfirst, interpose, loadfltr, nodefaultlib,
3023 nodelete, nodlopen, nodump): New -z options.
3024 * layout.cc (Layout:finish_dynamic_section): If new
3025 dtags enabled, emit DT_RUNPATH. Also, emit a
3026 DT_FLAGS_1 containing any specified -z flags.
3027
3028 2008-04-16 Ian Lance Taylor <iant@google.com>
3029
3030 * copy-relocs.cc: New file.
3031 * copy-relocs.h: New file.
3032 * reloc.cc: Remove Copy_relocs code.
3033 * reloc.h: Likewise.
3034 * reloc-types.h (struct Reloc_types) [both versions]: Add
3035 get_reloc_addend_noerror.
3036 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
3037 variants of add_global which take an addend which must be zero.
3038 * i386.cc: Include "copy-relocs.h".
3039 (class Target_i386): Change type of copy_relocs_ to variable,
3040 update initializer.
3041 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
3042 Change all callers.
3043 (Target_i386::do_finalize_sections): Change handling of
3044 copy_relocs_.
3045 * sparc.cc: Include "copy-relocs.h".
3046 (class Target_sparc): Change type of copy_relocs_ to variable,
3047 update initializer.
3048 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
3049 Change all callers.
3050 (Target_sparc::do_finalize_sections): Change handling of
3051 copy_relocs_.
3052 * x86_64.cc: Include "copy-relocs.h".
3053 (class Target_x86_64): Change type of copy_relocs_ to variable,
3054 update initializer.
3055 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
3056 class. Change all callers.
3057 (Target_x86_64::do_finalize_sections): Change handling of
3058 copy_relocs_.
3059 * Makefile.am (CCFILES): Add copy-relocs.cc.
3060 (HFILES): Add copy-relocs.h.
3061
3062 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
3063
3064 * testsuite/script_test_4.sh: Permit leading zeroes.
3065
3066 2008-04-15 Ian Lance Taylor <iant@google.com>
3067
3068 * script-sections.cc (Script_sections::create_segments): Use
3069 header_size_adjustment even when there is enough room for the
3070 headers.
3071 * testsuite/script_test_4.sh: New file.
3072 * testsuite/script_test_4.t: New file.
3073 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
3074 (check_DATA): Add script_test_4.stdout.
3075 (MOSTLYCLEANFILES): Likewise.
3076 (script_test_4): New target.
3077 (script_test_4.stdout): New target.
3078 * testsuite/Makefile.in: Rebuild.
3079
3080 * sparc.cc: Add definitions for Output_data_plt_sparc class
3081 constants.
3082
3083 2008-04-14 David S. Miller <davem@davemloft.net>
3084
3085 * sparc.cc: New file.
3086 * Makefile.am (TARGETSOURCES): Add sparc.cc
3087 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
3088 * configure.tgt: Document targ_extra_size and
3089 targ_extra_big_endian. Add entries for sparc-* and
3090 sparc64-*.
3091 * configure.ac: Handle targ_extra_size and
3092 targ_extra_big_endian.
3093 * Makefile.in: Rebuild.
3094 * configure: Likewise.
3095 * po/POTFILES.in: Likewise.
3096 * po/gold.pot: Likewise.
3097
3098 2008-04-14 Ian Lance Taylor <iant@google.com>
3099
3100 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
3101 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
3102 in the name/type/flags to section mapping. Don't call
3103 allocate_output_section.
3104 (Layout::choose_output_section): Change parameter from adjust_name
3105 to is_input_section. Don't permit input sections after sections
3106 are attached to segments. Don't call allocate_output_section.
3107 (Layout::layout_eh_frame): Call update_flags_for_input_section,
3108 not write_enable_output_section.
3109 (Layout::make_output_section): Don't push to
3110 unattached_section_list_ nor call attach_to_segment. Call
3111 attach_section_to_segment if sections are attached.
3112 (Layout::attach_sections_to_segments): New function.
3113 (Layout::attach_section_to_segment): New function.
3114 (Layout::attach_allocated_section_to_segment): Rename from
3115 attach_to_segment. Remove flags parameter.
3116 (Layout::allocate_output_section): Remove function.
3117 (Layout::write_enable_output_section): Remove function.
3118 * layout.h (class Layout): Update for above changes. Add new
3119 field sections_are_attached_.
3120 * output.h (Output_section::update_flags_for_input_section): New
3121 function.
3122 * output.cc (Output_section::add_input_section): Call
3123 update_flags_for_input_section.
3124 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
3125
3126 2008-04-11 Cary Coutant <ccoutant@google.com>
3127
3128 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
3129 thought unnecessary.
3130 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
3131
3132 2008-04-11 Ian Lance Taylor <iant@google.com>
3133
3134 * output.h (class Output_section_data): Remove inline definition
3135 of set_addralign.
3136 * output.cc (Output_section_data::set_addralign): New function.
3137
3138 2008-04-11 Cary Coutant <ccoutant@google.com>
3139
3140 Add support for TLS descriptors for i386 and x86_64.
3141 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
3142 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
3143 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
3144 GOT_TYPE_TLS_DESC.
3145 (Target_i386::got_mod_index_entry): Remove unnecessary code.
3146 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
3147 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
3148 relocations.
3149 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
3150 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
3151 Fix problem with initial-exec relocations.
3152 (Target_i386::Relocate::relocate_tls): Likewise.
3153 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
3154 relaxation.
3155 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
3156 support for section-plus-offset dynamic table entries.
3157 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
3158 (Output_data_dynamic::Dynamic_entry): Add support for
3159 section-plus-offset dynamic table entries.
3160 (Output_data_dynamic::Classification): Likewise.
3161 (Output_data_dynamic::classification_): Renamed offset_.
3162 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
3163 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
3164 (Target_x86_64::make_plt_section): New function.
3165 (Target_x86_64::reserve_tlsdesc_entries): New function.
3166 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
3167 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
3168 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
3169 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
3170 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
3171 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
3172 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
3173 add extra PLT entry for TLS descriptors.
3174 (Output_data_plt_x86_64::got_): New field.
3175 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
3176 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
3177 fields.
3178 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
3179 descriptors.
3180 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
3181 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
3182 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
3183 R_386_TLS_DESC_CALL relocations.
3184 (Target_x86_64::Scan::global): Likewise.
3185 (Target_x86_64::do_finalize_sections): Add dynamic table entries
3186 for TLS descriptors.
3187 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
3188 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
3189 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
3190 GD-to-IE relaxation.
3191 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
3192 and TLS_DESCRIPTORS.
3193 * Makefile.in: Rebuild.
3194 * configure: Rebuild.
3195 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
3196 (tls_test_shared2.so): New target.
3197 (tls_shared_gd_to_ie_test_SOURCES): New variable.
3198 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
3199 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
3200 (tls_shared_gd_to_ie_test_LDADD): New variable.
3201 (tls_shared_gnu2_gd_to_ie_test): New target.
3202 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
3203 New targets.
3204 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
3205 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
3206 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
3207 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
3208 (tls_shared_gnu2_test): New target.
3209 (tls_test_gnu2_shared.so): New target.
3210 (tls_shared_gnu2_test_SOURCES): New variable.
3211 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
3212 (tls_shared_gnu2_test_LDFLAGS): New variable.
3213 (tls_shared_gnu2_test_LDADD): New variable.
3214 * testsuite/Makefile.in: Rebuild.
3215 * testsuite/Makefile.
3216
3217 2008-04-11 Ian Lance Taylor <iant@google.com>
3218
3219 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
3220 justsyms.t.
3221 * testsuite/Makefile.in: Rebuild.
3222
3223 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
3224 long.
3225 * testsuite/script_test_2.cc (main): Adjust test.
3226
3227 2008-04-11 David S. Miller <davem@davemloft.net>
3228 Ian Lance Taylor <iant@google.com>
3229
3230 * options.h (General_options): Add entries for '-Y' and
3231 '-relax'.
3232 * options.cc (General_options:finalize): If -Y was used, add those
3233 entries to the library path instead of the default "/lib" and
3234 "/usr/lib".
3235
3236 2008-04-11 David S. Miller <davem@davemloft.net>
3237
3238 * testsuite/justsyms.t: Start at 0x100.
3239 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
3240 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
3241 long.
3242 * testsuite/script_test_2.cc: Adjust string and section length
3243 checks.
3244
3245 2008-04-09 Ian Lance Taylor <iant@google.com>
3246
3247 PR gold/5996
3248 * script-sections.cc (Sections_element::allocate_to_segment): Add
3249 orphan parameter.
3250 (Output_section_definition::allocate_to_segment): Likewise.
3251 (Orphan_output_section::allocate_to_segment): Likewise.
3252 (Script_sections::attach_sections_using_phdrs_clause): Don't
3253 propagate non-PT_LOAD segments to orphan sections.
3254 * testsuite/Makefile.am (script_test_3.stdout): Generate using
3255 readelf rather than objdump.
3256 * testsuite/script_test_3.sh: Adjust accordingly. Test that
3257 .interp section and PT_INTERP segment are the same size.
3258 * testsuite/Makefile.in: Rebuild.
3259
3260 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
3261 aliases for symbols defined in the same object.
3262 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
3263 (weak_alias_test_SOURCES): New variable.
3264 (weak_alias_test_DEPENDENCIES): New variable.
3265 (weak_alias_test_LDFLAGS): New variable.
3266 (weak_alias_test_LDADD): New variable.
3267 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
3268 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
3269 (weak_alias_test_3.o): New target.
3270 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
3271 * testsuite/weak_alias_test_main.cc: New file.
3272 * testsuite/weak_alias_test_1.cc: New file.
3273 * testsuite/weak_alias_test_2.cc: New file.
3274 * testsuite/weak_alias_test_3.cc: New file.
3275
3276 2008-04-08 Ian Lance Taylor <iant@google.com>
3277
3278 * options.h (class General_options): Add --noinhibit-exec option.
3279 * main.cc (main): Check --noinhibit-exec.
3280
3281 * options.h (class General_options): Define --wrap as a special
3282 option. Add wrap_symbols_ field.
3283 (General_options::any_wrap_symbols): New function.
3284 (General_options::is_wrap_symbol): New function.
3285 * options.cc (General_options::parse_wrap): New function.
3286 (General_options::General_options): Initialize wrap_symbols_.
3287 * symtab.cc (Symbol_table::wrap_symbol): New function.
3288 (Symbol_table::add_from_object): Handle --wrap.
3289 * symtab.h (class Symbol_table): Declare wrap_symbol.
3290 * target.h (Target::wrap_char): New function.
3291 (Target::Target_info): Add wrap_char field.
3292 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
3293 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
3294 * testsuite/testfile.cc (Target_test::test_target_info):
3295 Likewise.
3296
3297 * errors.cc (Errors::undefined_symbol): Mention symbol version if
3298 there is one.
3299
3300 * layout.h (class Layout): Add added_eh_frame_data_ field.
3301 * layout.cc (Layout::Layout): Initialize new field.
3302 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
3303 output section until we find a section we merged successfully.
3304 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
3305 that the size be non-zero.
3306
3307 * merge.cc (Object_merge_map::get_output_offset): Remove inline
3308 qualifier.
3309
3310 2008-04-08 Craig Silverstein <csilvers@google.com>
3311
3312 * configure.ac: Export new conditional variable HAVE_ZLIB.
3313 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
3314 on HAVE_ZLIB.
3315 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
3316 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
3317
3318 2008-04-07 Ian Lance Taylor <iant@google.com>
3319
3320 * version.cc (version_string): Set to "1.5".
3321
3322 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
3323 Add issued_non_pic_error_ field. Declare check_non_pic.
3324 (Target_x86_64::Scan::check_non_pic): New function.
3325 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
3326 (Target_x86_64::Scan::global): Likewise.
3327
3328 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
3329 addend parameter. Change caller. Handle merge sections.
3330 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
3331 Address to Addend. Don't add in the result of
3332 local_section_offset, pass down the addend and use the returned
3333 value.
3334 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
3335 Update declarations of local_section_offset and symbol_value.
3336 * testsuite/two_file_test_1.cc (t18): New function.
3337 * testsuite/two_file_test_2.cc (f18): New function.
3338 * testsuite/two_file_test_main.cc (main): Call t18.
3339 * testsuite/two_file_test.h (t18, f18): Declare.
3340
3341 * configure.ac: Don't test for objdump, c++filt, or readelf.
3342 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
3343 conditionals.
3344 (TEST_READELF): New variable.
3345 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
3346 (check_PROGRAMS): Add two_file_strip_test.
3347 (two_file_strip_test): New target.
3348 (check_PROGRAMS): Add two_file_same_shared_strip_test.
3349 (two_file_same_shared_strip_test_SOURCES): New variable.
3350 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
3351 (two_file_same_shared_strip_test_LDFLAGS): New variable.
3352 (two_file_same_shared_strip_test_LDADD): New variable.
3353 (two_file_shared_strip.so): New target.
3354 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
3355 (ver_test_5.syms, ver_test_7.syms): Likewise.
3356 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
3357 (strip_test_3.stdout): Use TEST_OBJDUMP.
3358 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
3359
3360 2008-04-04 Cary Coutant <ccoutant@google.com>
3361
3362 * symtab.h (Symbol::is_weak_undefined): New function.
3363 (Symbol::is_strong_undefined): New function.
3364 (Symbol::is_absolute): New function.
3365 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
3366 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
3367 absolute symbols.
3368 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
3369 (weak_undef_test): New target.
3370 * testsuite/Makefile.in: Rebuild.
3371 * testsuite/weak_undef_file1.cc: New file.
3372 * testsuite/weak_undef_file2.cc: New file.
3373 * testsuite/weak_undef_test.cc: New file.
3374
3375 2008-04-03 Craig Silverstein <csilvers@google.com>
3376
3377 * compressed_output.h (class Output_compressed_section): Use
3378 unsigned buffer.
3379 * compressed_output.cc (zlib_compress): Use unsigned buffers,
3380 add zlib header.
3381 (zlib_compressed_suffix): Removed.
3382 (Output_compressed_section::set_final_data_size): Use unsigned
3383 buffers.
3384 * testsuite/Makefile.am (flagstest_compress_debug_sections):
3385 Fix linker invocation.
3386 (flagstest_o_specialfile_and_compress_debug_sections):
3387 Likewise.
3388 * testsuite/Makefile.in: Regenerated.
3389
3390 2008-04-02 David S. Miller <davem@davemloft.net>
3391
3392 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
3393 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
3394
3395 2008-04-02 Craig Silverstein <csilvers@google.com>
3396
3397 * TODO: New file.
3398
3399 2008-04-02 Ian Lance Taylor <iant@google.com>
3400
3401 * fileread.cc (File_read::find_view): Add byteshift and vshifted
3402 parameters. Update for new key type to views_. Change all
3403 callers.
3404 (File_read::read): Adjust for byteshift in returned view.
3405 (File_read::add_view): New function, broken out of
3406 find_and_make_view.
3407 (File_read::make_view): New function, broken out of
3408 find_and_make_view.
3409 (File_read::find_or_make_view): Add offset and aligned
3410 parameters. Rewrite accordingly. Change all callers.
3411 (File_read::get_view): Add offset and aligned parameters. Adjust
3412 for byteshift in return value.
3413 (File_read::get_lasting_view): Likewise.
3414 * fileread.h (class File_read): Update declarations.
3415 (class File_read::View): Add byteshift_ field. Add byteshift to
3416 constructor. Add byteshift method.
3417 * archive.h (Archive::clear_uncached_views): New function.
3418 (Archive::get_view): Add aligned parameter. Change all callers.
3419 * object.h (Object::get_view): Add aligned parameter. Change all
3420 callers.
3421 (Object::get_lasting_view): Likewise.
3422
3423 * fileread.cc (File_read::release): Don't call clear_views if
3424 there are multiple objects.
3425 * fileread.h (File_read::clear_uncached_views): New function.
3426 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
3427 on the archive.
3428
3429 2008-03-31 Cary Coutant <ccoutant@google.com>
3430
3431 Add thin archive support.
3432 * archive.cc (Archive::armagt): New const.
3433 (Archive::setup): Remove task parameter and calls to unlock.
3434 (Archive::unlock_nested_archives): New function.
3435 (Archive::read_header): Add nested_off parameter. Change
3436 all callers.
3437 (Archive::interpret_header): Likewise.
3438 (Archive::include_all_members): Change to handle thin
3439 archives.
3440 (Archive::include_member): Likewise.
3441 * archive.h (Archive::Archive): Add new parameters and
3442 initializers.
3443 (Archive::armagt): New const.
3444 (Archive::setup): Remove task parameter.
3445 (Archive::unlock_nested_archives): New function.
3446 (Archive::read_header): Add nested_off parameter.
3447 (Archive::interpret_header): Likewise.
3448 (Archive::Nested_archive_table): New typedef.
3449 (Archive::is_thin_archive_): New field.
3450 (Archive::nested_archives_): New field.
3451 (Archive::options_): New field.
3452 (Archive::dirpath_): New field.
3453 (Archive::task_): New field.
3454 * readsyms.cc (Read_symbols::do_read_symbols): Add check
3455 for thin archives. Pass additional parameters to
3456 Archive::Archive. Unlock the archive file after calling
3457 Archive::setup.
3458
3459 2008-03-29 Ian Lance Taylor <iant@google.com>
3460
3461 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
3462 version symbol to be local.
3463 * testsuite/ver_test_4.sh: New file.
3464 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
3465 (check_DATA): Add ver_test_4.syms.
3466 (ver_test_4.syms): New target.
3467 * testsuite/Makefile.in: Rebuild.
3468
3469 * output.cc
3470 (Output_section::Input_section_sort_entry::has_priority): New
3471 function.
3472 (Output_section::Input_section_sort_entry::match_file_name): New
3473 function.
3474 (Output_section::Input_section_sort_entry::match_section_name):
3475 Remove.
3476 (Output_section::Input_section_sort_entry::match_section_name_prefix):
3477 Remove.
3478 (Output_section::Input_section_sort_entry::match_section_file):
3479 Remove.
3480 (Output_section::Input_section_sort_compare::operator()): Rewrite
3481 using new Input_section_sort_entry functions. Sort crtbegin and
3482 crtend first. Sort sections with no priority before sections with
3483 a priority.
3484 * testsuite/initpri1.c (d3): Check j != 4.
3485 (cd5): New constructor/destructor function.
3486 (main): Check j != 2.
3487
3488 * symtab.cc (Symbol_table::add_from_object): If we don't use the
3489 new symbol when resolving, don't call set_is_default.
3490 * testsuite/ver_test_7.cc: New file.
3491 * testsuite/ver_test_7.sh: New file.
3492 * testsuite/Makefile.am (ver_test_7.so): New target.
3493 (ver_test_7.o): New target.
3494 (check_SCRIPTS): Add ver_test_7.sh.
3495 (check_DATA): Add ver_test_7.syms.
3496 (ver_test_7.syms): New target.
3497
3498 2008-03-28 Ian Lance Taylor <iant@google.com>
3499
3500 * layout.cc (Layout::layout): If we see an input section with a
3501 name that needs sorting, set the must_sort flag for the output
3502 section.
3503 (Layout::make_output_section): If the name of the output section
3504 indicates that it might require sorting, set the may_sort flag.
3505 * output.h (Output_section::may_sort_attached_input_sections): New
3506 function.
3507 (Output_section::set_may_sort_attached_input_sections): New
3508 function.
3509 (Output_section::must_sort_attached_input_sections): New
3510 function.
3511 (Output_section::set_must_sort_attached_input_sections): New
3512 function.
3513 (class Output_section): Declare Input_section_sort_entry. Define
3514 Input_section_sort_compare. Declare
3515 sort_attached_input_sections. Add new fields:
3516 may_sort_attached_input_sections_,
3517 must_sort_attached_input_sections_,
3518 attached_input_sections_are_sorted_.
3519 * output.cc (Output_section::Output_section): Initialize new
3520 fields.
3521 (Output_section::add_input_section): Add an entry to
3522 input_sections_ if may_sort or must_sort are true.
3523 (Output_section::set_final_data_size): Call
3524 sort_attached_input_sections if necessary.
3525 (Output_section::Input_section_sort_entry): Define new class.
3526 (Output_section::Input_section_sort_compare::operator()): New
3527 function.
3528 (Output_section::sort_attached_input_sections): New function.
3529 * configure.ac: Check whether the compiler supports constructor
3530 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
3531 * testsuite/initpri1.c: New file.
3532 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
3533 CONSTRUCTOR_PRIORITY.
3534 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
3535 (initpri1_LDFLAGS): New variable.
3536 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
3537
3538 2008-03-27 Ian Lance Taylor <iant@google.com>
3539
3540 * common.cc (Sort_commons::operator): Correct sorting algorithm.
3541 * testsuite/common_test_1.c: New file.
3542 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
3543 (common_test_1_SOURCES): New variable.
3544 (common_test_1_DEPENDENCIES): New variable.
3545 (common_test_1_LDFLAGS): New variable.
3546
3547 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
3548 and commons_ correctly when NAME/VERSION does not override
3549 NAME/NULL.
3550 * testsuite/ver_test_6.c: New file.
3551 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
3552 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
3553 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
3554
3555 2008-03-26 Ian Lance Taylor <iant@google.com>
3556
3557 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
3558 of an undefined symbol from a version script.
3559 * testsuite/Makefile.am (ver_test_5.so): New target.
3560 (ver_test_5.o): New target.
3561 (check_SCRIPTS): Add ver_test_5.sh.
3562 (check_DATA): Add ver_test_5.syms.
3563 (ver_test_5.syms): New target.
3564 * testsuite/ver_test_5.cc: New file.
3565 * testsuite/ver_test_5.script: New file.
3566 * testsuite/ver_test_5.sh: New file.
3567 * Makefile.in, testsuite/Makefile.in: Rebuild.
3568
3569 PR gold/5986
3570 Fix problems building gold with gcc 4.3.0.
3571 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
3572 (gold_error_at_location, gold_warning_at_location): Use it.
3573 * configure.ac: Check whether we can compile and use a template
3574 function with a printf attribute.
3575 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
3576 when jumping over bytes.
3577 * object.cc: Instantiate Object::read_section_data.
3578 * debug.h: Include <cstring>
3579 * dwarf_reader.cc: Include <algorithm>
3580 * main.cc: Include <cstring>.
3581 * options.cc: Include <cstring>.
3582 * output.cc: Include <cstring>.
3583 * script.cc: Include <cstring>.
3584 * script.h: Include <string>.
3585 * symtab.cc: Include <cstring> and <algorithm>.
3586 * target-select.cc: Include <cstring>.
3587 * version.cc: Include <string>.
3588 * testsuite/testmain.cc: Include <cstdlib>.
3589 * configure, config.in: Rebuild.
3590
3591 2008-03-25 Ian Lance Taylor <iant@google.com>
3592
3593 * options.cc: Include "../bfd/bfdver.h".
3594 (options::help): Print bug reporting address.
3595
3596 * version.cc (print_version): Adjust output for current value of
3597 BFD_VERSION_STRING.
3598
3599 * NEWS: New file.
3600
3601 * options.cc (options::help): Print list of supported targets.
3602 * target-select.h: Include <vector>.
3603 (class Target_selector): Make machine_, size_, and is_big_endian_
3604 fields const. Add bfd_name_ and instantiated_target_ fields.
3605 (Target_selector::Target_selector): Add bfd_name parameter.
3606 (Target_selector::recognize): Make non-virtual, call
3607 do_recognize.
3608 (Target_selector::recognize_by_name): Make non-virtual, call
3609 do_recognize_by_name.
3610 (Target_selector::supported_names): New function.
3611 (Target_selector::bfd_name): New function.
3612 (Target_selector::do_instantiate_target): New pure virtual
3613 function.
3614 (Target_selector::do_recognize): New virtual function.
3615 (Target_selector::do_recognize_by_name): New virtual function.
3616 (Target_selector::instantiate_target): New private function.
3617 (supported_target_names): Declare.
3618 * target-select.cc (Target_selector::Target_selector): Update for
3619 new parameter and fields.
3620 (select_target_by_name): Check that the name matches before
3621 calling recognize_by_name.
3622 (supported_target_names): New function.
3623 * i386.cc (class Target_selector_i386): Update Target_selector
3624 constructor call. Remove recognize and recognize_by_name. Add
3625 do_instantiate_target.
3626 * x86_64.cc (class Target_selector_x86_64): Likewise.
3627 * testsuite/testfile.cc (class Target_selector_test): Update for
3628 changes to Target_selector.
3629
3630 * README: Rewrite, with some notes on unsupported features.
3631
3632 2008-03-24 Cary Coutant <ccoutant@google.com>
3633
3634 * i386.cc (Target_i386::Got_type): New enum declaration.
3635 (Target_i386::Scan::local): Updated callers of Output_data_got
3636 member functions.
3637 (Target_i386::Scan::global): Likewise.
3638 (Target_i386::Relocate::relocate): Likewise.
3639 (Target_i386::Relocate::relocate_tls): Likewise.
3640 * object.h (Got_offset_list): New class.
3641 (Sized_relobj::local_has_got_offset): Added got_type parameter.
3642 (Sized_relobj::local_got_offset): Likewise.
3643 (Sized_relobj::set_local_got_offset): Likewise.
3644 (Sized_relobj::local_has_tls_got_offset): Removed.
3645 (Sized_relobj::local_tls_got_offset): Removed.
3646 (Sized_relobj::set_local_tls_got_offset): Removed.
3647 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
3648 * output.cc (Output_data_got::add_global): Added got_type parameter.
3649 (Output_data_got::add_global_with_rel): Likewise.
3650 (Output_data_got::add_global_with_rela): Likewise.
3651 (Output_data_got::add_global_pair_with_rel): New function.
3652 (Output_data_got::add_global_pair_with_rela): New function.
3653 (Output_data_got::add_local): Added got_type parameter.
3654 (Output_data_got::add_local_with_rel): Likewise.
3655 (Output_data_got::add_local_with_rela): Likewise.
3656 (Output_data_got::add_local_pair_with_rel): New function.
3657 (Output_data_got::add_local_pair_with_rela): New function.
3658 (Output_data_got::add_global_tls): Removed.
3659 (Output_data_got::add_global_tls_with_rel): Removed.
3660 (Output_data_got::add_global_tls_with_rela): Removed.
3661 (Output_data_got::add_local_tls): Removed.
3662 (Output_data_got::add_local_tls_with_rel): Removed.
3663 (Output_data_got::add_local_tls_with_rela): Removed.
3664 * output.h (Output_data_got::add_global): Added got_type parameter.
3665 (Output_data_got::add_global_with_rel): Likewise.
3666 (Output_data_got::add_global_with_rela): Likewise.
3667 (Output_data_got::add_global_pair_with_rel): New function.
3668 (Output_data_got::add_global_pair_with_rela): New function.
3669 (Output_data_got::add_local): Added got_type parameter.
3670 (Output_data_got::add_local_with_rel): Likewise.
3671 (Output_data_got::add_local_with_rela): Likewise.
3672 (Output_data_got::add_local_pair_with_rel): New function.
3673 (Output_data_got::add_local_pair_with_rela): New function.
3674 (Output_data_got::add_global_tls): Removed.
3675 (Output_data_got::add_global_tls_with_rel): Removed.
3676 (Output_data_got::add_global_tls_with_rela): Removed.
3677 (Output_data_got::add_local_tls): Removed.
3678 (Output_data_got::add_local_tls_with_rel): Removed.
3679 (Output_data_got::add_local_tls_with_rela): Removed.
3680 * resolve.cc (Symbol::override_base_with_special): Removed
3681 reference to has_got_offset_ field.
3682 * symtab.cc (Symbol::init_fields): Replaced initialization
3683 of got_offset_ with got_offsets_. Removed initialization
3684 of has_got_offset_
3685 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
3686 (Symbol::got_offset): Likewise.
3687 (Symbol::set_got_offset): Likewise.
3688 (Symbol::has_tls_got_offset): Removed.
3689 (Symbol::tls_got_offset): Removed.
3690 (Symbol::set_tls_got_offset): Removed.
3691 (Symbol::got_offset_): Removed.
3692 (Symbol::tls_mod_got_offset_): Removed.
3693 (Symbol::tls_pair_got_offset_): Removed.
3694 (Symbol::got_offsets_): New field.
3695 (Symbol::has_got_offset): Removed.
3696 (Symbol::has_tls_mod_got_offset): Removed.
3697 (Symbol::has_tls_pair_got_offset): Removed.
3698 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
3699 (Target_x86_64::Scan::local): Updated callers of Output_data_got
3700 member functions.
3701 (Target_x86_64::Scan::global): Likewise.
3702 (Target_x86_64::Relocate::relocate): Likewise.
3703 (Target_x86_64::Relocate::relocate_tls): Likewise.
3704
3705 2008-03-25 Ben Elliston <bje@au.ibm.com>
3706
3707 * yyscript.y: Fix spelling error in comment.
3708
3709 2008-03-24 Ian Lance Taylor <iant@google.com>
3710
3711 * options.h (class General_options): Define build_id option.
3712 * layout.h (class Layout): Declare write_build_id, create_note,
3713 create_build_id. Add build_id_note_ member.
3714 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
3715 "libiberty.h", "md5.h", "sha1.h".
3716 (Layout::Layout): Initialize eh_frame_data_,
3717 eh_frame_hdr_section_, and build_id_note_.
3718 (Layout::finalize): Call create_build_id.
3719 (Layout::create_note): New function, broken out of
3720 Layout::create_gold_note.
3721 (Layout::create_gold_note): Call create_note.
3722 (Layout::create_build_id): New function.
3723 (Layout::write_build_id): New function.
3724 (Close_task_runner::run): Call write_build_id.
3725
3726 * x86_64.cc: Correct license to GPLv3.
3727
3728 2008-03-23 Ian Lance Taylor <iant@google.com>
3729
3730 * options.cc: Include "demangle.h".
3731 (parse_optional_string): New function.
3732 (parse_long_option): Handle takes_optional_argument.
3733 (parse_short_option): Update dash_z initializer. Handle
3734 takes_optional_argument.
3735 (General_options::General_options): Initialize do_demangle_.
3736 (General_options::finalize): Set do_demangle_. Handle demangling
3737 style.
3738 * options.h (parse_optional_string): Declare.
3739 (struct One_option): Add optional_arg field. Update constructor.
3740 Update call constructor calls. Add takes_optional_argument
3741 function.
3742 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
3743 (DEFINE_optional_string): Define.
3744 (General_options::demangle): Change from DEFINE_bool to
3745 DEFINE_optional_string.
3746 (General_options::no_demangle): New function.
3747 (General_options::do_demangle): New function.
3748 (General_options::set_do_demangle): New function.
3749 (General_options::execstack_status_): Move definition to end of
3750 class definition.
3751 (General_options::static_): Likewise.
3752 (General_options::do_demangle_): New field.
3753 * object.cc (big_endian>::get_symbol_location_info): Call
3754 Options::do_demangle, not Options::demangle.
3755 * symtab.cc (demangle): Likewise.
3756
3757 2008-03-22 Ian Lance Taylor <iant@google.com>
3758
3759 * gold.h: Include <cstddef> and <sys/types.h>
3760 * options.h: Include <cstring>.
3761
3762 2008-03-21 Ian Lance Taylor <iant@google.com>
3763
3764 * Added source code to GNU binutils.