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