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