2010-01-11 Doug Kwan <dougkwan@google.com>
[binutils-gdb.git] / gold / ChangeLog
1 2010-01-11 Doug Kwan <dougkwan@google.com>
2
3 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
4 (incremental_dump_LDADD): Add linking option for libintl.
5 * Makefile.in: Regenerate.
6
7 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
8
9 PR gold/11144
10 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
11 instead of -Ds.
12 * testsuite/Makefile.in: Regenerated.
13
14 2010-01-10 Doug Kwan <dougkwan@google.com>
15
16 * options.h (DEFINE_var): Use parentheses around argument varname__
17 in macro body to avoid any unintended subsequent substitutions.
18
19 2010-01-10 Ian Lance Taylor <iant@google.com>
20
21 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
22 candidates before doing symbol resolution.
23
24 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
25 ODR candidates if only one is weak.
26
27 2010-01-08 Ian Lance Taylor <iant@google.com>
28
29 * script.cc (Version_script_info::build_expression_list_lookup):
30 Don't warn about ambiguous version, just record the ambiguity.
31 (Version_script_info::get_symbol_version_helper): Give error if
32 version is ambiguous.
33
34 2010-01-08 Doug Kwan <dougkwan@google.com>
35
36 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
37 prev_data_size_ and prev_addralign_. Remove initializer for
38 deleted data member has_been_changed_.
39 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
40 to determine if the table is empty.
41 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
42 Remove.
43 (Stub_table::add_reloc_stub): Define method in class definition
44 instead of just declaring it there.
45 (Stub_table::add_cortex_a8_stub): New method definition.
46 (Stub_table::update_data_size_and_addralign): Ditto.
47 (Stub_table::finalize_stubs): Ditto.
48 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
49 (Stub_table::do_addralign_): Return address alignment in the
50 (Stub_table::do_reset_address_and_file_offset): Define method in
51 class definition instead of declaring it there. Set current data
52 size to be the data size of the previous pass.
53 (Stub_table::set_final_data_size): Use current data size as the
54 final data size.
55 (Stub_table::relocate_stub): Change parameter type of stub from
56 Reloc_stub pointer to Stub pointer.
57 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
58 (Stub_table::Cortex_a8_stub_list): New typedef.
59 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
60 Stub_table::prev_addralign_): New data member.
61 (Arm_relobj::Arm_relobj): Initialize data member
62 section_has_cortex_a8_workaround_.
63 (Arm_relobj::section_has_cortex_a8_workaround,
64 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
65 definitions.
66 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
67 declarations.
68 (Target_arm::relocate_stub): Change parameter type of stub from
69 Reloc_stub pointer to Stub pointer.
70 (Insn_template::size, Insn_template::alignment): Handle
71 THUMB16_SPECIAL_TYPE.
72 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
73 Stub_table::update_data_size_and_addralign,
74 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
75 definitions.
76 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
77 (Stub_table::do_write): Ditto.
78 (Target_arm::do_relax): Adjust code for changes in Stub_table.
79
80 2010-01-08 Ian Lance Taylor <iant@google.com>
81
82 PR 11108
83 * symtab.h (class Symbol): Remove fields is_target_special_ and
84 has_plt_offset_. Add field is_defined_in_discarded_section_.
85 (Symbol::is_defined_in_discarded_section): New function.
86 (Symbol::set_is_defined_in_discarded_section): New function.
87 (Symbol::has_plt_offset): Rewrite.
88 (Symbol::set_plt_offset): Verify that new offset is not -1U.
89 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
90 Don't initialize is_target_special_ or has_plt_offset_.
91 Initialize is_defined_in_discarded_section_.
92 (Symbol_table::add_from_relobj): If appropriate, set
93 is_defined_in_discarded_section.
94 * resolve.cc (Symbol::override_base_with_special): Don't test
95 is_target_special_. Change has_plt_offset_ to has_plt_offset().
96 * target-reloc.h (relocate_section): Do special handling for
97 symbols defined in discarded sections for global symbols as well
98 as local symbols.
99
100 2010-01-08 Ian Lance Taylor <iant@google.com>
101
102 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
103 the SHT_SYMTAB case.
104
105 2010-01-08 Ian Lance Taylor <iant@google.com>
106
107 * object.cc (Sized_relobj::do_layout): Don't get confused if
108 layout_eh_frame returns NULL.
109
110 2010-01-08 Ian Lance Taylor <iant@google.com>
111
112 PR 11084
113 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
114 dynamic symbol table, use the normal symbol table.
115 (Sized_dynobj::do_read_symbols): Remove assertion about type of
116 symbol table.
117
118 2010-01-08 Ian Lance Taylor <iant@google.com>
119
120 PR 11072
121 * layout.cc (Layout::include_section): Remove .gnu_debuglink
122 sections.
123
124 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
125
126 * version.cc (print_version): Change to "Copyright 2010".
127
128 2010-01-08 Ian Lance Taylor <iant@google.com>
129
130 PR 10287
131 PR 11063
132 * i386.cc (class Target_i386): Change return type of plt_section
133 to be non-const.
134 (class Output_data_plt_i386): Add tls_desc_rel_ field.
135 (Output_data_plt_i386::Output_data_plt_i386): Initialize
136 tls_desc_rel_ field.
137 (Output_data_plt_i386::rel_tls_desc): New function.
138 (Target_i386::rel_tls_desc_section): New function.
139 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
140 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
141 R_386_TLS_DESC reloc in rel_tls_desc_section.
142 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
143 Define struct Tlsdesc_info.
144 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
145 (Target_x86_64::do_reloc_symbol_index): New function.
146 (Target_x86_64::add_tlsdesc_info): New function.
147 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
148 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
149 tlsdesc_rel_ field.
150 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
151 all callers.
152 (Output_data_plt_x86_64::rela_tlsdesc): New function.
153 (Target_x86_64::rela_tlsdesc_section): New function.
154 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
155 handling.
156 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
157 (Target_x86_64::do_reloc_addend): New function.
158 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
159 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
160 declarations. Define TARGET_CODE. Add arg field to u1_ union.
161 (Output_reloc::type): New function.
162 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
163 (Output_reloc::is_target_specific): New function.
164 (Output_reloc::target_arg): New function.
165 (class Output_reloc) [SHT_RELA]: Add four new constructors for
166 absolute relocs and target specific relocs.
167 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
168 add_target_specific.
169 (class Output_data_reloc) [SHT_RELA]: Likewise.
170 * output.cc (Output_reloc::Output_reloc): Add four new versions
171 for absolute relocs and target specific relocs.
172 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
173 (Output_reloc::get_symbol_index): Likewise.
174 (Output_reloc::local_section_offset): Check that local_sym_index_
175 is not TARGET_CODE or 0.
176 (Output_reloc::symbol_value): Likewise.
177 (Output_reloc::write) [SHT_RELA]: Call target for target specific
178 reloc.
179 * target.h (class Target): Add reloc_symbol_index and reloc_addend
180 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
181 functions.
182 * layout.cc (add_target_dynamic_tags): Use output section for
183 DT_PLTRELSZ and DT_JMPREL.
184
185 2010-01-07 Ian Lance Taylor <iant@google.com>
186
187 PR 11061
188 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
189 function.
190 (class Output_data_reloc_generic): Define.
191 (class Output_data_reloc_base): Change base class to
192 Output_data_reloc_generic. Change add() method to call
193 bump_relative_reloc_count for a relative reloc. Remove
194 sort_relocs_ field.
195 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
196 to sort_relocs().
197 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
198 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
199 appropriate.
200 * layout.h (class Layout): Update declaration.
201
202 2010-01-07 Ian Lance Taylor <iant@google.com>
203
204 * output.h (class Output_data): Add const version of
205 output_section and do_output_section.
206 (class Output_section_data): Add const version of
207 do_output_section.
208 (class Output_section): Likewise.
209 * layout.cc (Layout::add_target_dynamic_tags): New function.
210 * layout.h (class Layout): Update declarations.
211 * arm.cc (Target_arm::do_finalize_sections): Use
212 add_target_dynamic_tags.
213 * i386.cc (Target_i386::do_finalize_sections): Likewise.
214 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
215 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
216 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
217
218 2010-01-07 Ian Lance Taylor <iant@google.com>
219
220 PR 11042
221 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
222 object as needed.
223
224 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
225 Ian Lance Taylor <iant@google.com>
226
227 PR 11019
228 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
229 Xindex::read_symtab_xindex.
230
231 2010-01-07 Doug Kwan <dougkwan@google.com>
232
233 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
234 (Insn_template::thumb16_bcond_insn): New method declaration.
235 (Insn_template): Fix spelling.
236 (Stub::thumb16_special): New method declaration.
237 (Stub::do_write): Define virtual method which was previously pure
238 virtual.
239 (Stub::do_thumb16_special): New method declaration.
240 (Stub::do_fixed_endian_write): New template member.
241 (Reloc_stub::do_write): Remove.
242 (Reloc_stub::do_fixed_endian_write): Remove.
243 (Cortex_a8_stub): New class definition.
244 (Stub_factory::make_cortex_a8_stub): New method definition.
245 (Stub_factory::Stub_factory): Add missing static storage class
246 qualifier for elf32_arm_stub_a8_veneer_blx.
247
248 2010-01-07 Ian Lance Taylor <iant@google.com>
249
250 PR 10980
251 * options.h (class General_options): Add --warn-unresolved-symbols
252 and --error-unresolved-symbols.
253 * errors.cc (Errors::undefined_symbol): Implement
254 --warn-unresolved-symbols.
255
256 * options.h (class General_options): Add -z text and -z textoff.
257 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
258
259 2010-01-06 Sriraman Tallam <tmsriram@google.com>
260
261 * gc.h (Garbage_collection::Cident_section_map): New typedef.
262 (Garbage_collection::cident_sections): New function.
263 (Garbage_collection::add_cident_section): New function.
264 (Garbage_collection::cident_sections_): New member.
265 (gc_process_relocs): Add references to sections whose names are C
266 identifiers.
267 * gold.h (cident_section_start_prefix): New constant.
268 (cident_section_stop_prefix): New constant.
269 (is_cident): New function.
270 * layout.cc (Layout::define_section_symbols): Replace string constants
271 with the newly defined constants.
272 * object.cc (Sized_relobj::do_layout): Track sections whose names are
273 C identifiers.
274 * testsuite/Makefile.am: Add gc_orphan_section_test.
275 * testsuite/Makefile.in: Regenerate.
276 * testsuite/gc_orphan_section_test.cc: New file.
277 * testsuite/gc_orphan_section_test.sh: New file.
278
279 2010-01-06 Ian Lance Taylor <iant@google.com>
280
281 PR 10980
282 * options.h (class General_options): Add --warn-shared-textrel.
283 * layout.cc (Layout::finish_dynamic_section): Implement
284 --warn-shared-textrel.
285
286 PR 10980
287 * options.h (class General_options): Add --warn-multiple-gp.
288
289 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
290
291 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
292 $(THREADSLIB) and $(LIBDL).
293 * Makefile.in: Rebuild.
294
295 2010-01-06 Ian Lance Taylor <iant@google.com>
296
297 PR 10980
298 * options.cc (General_options::parse_section_start): New function.
299 (General_options::section_start): New function.
300 (General_options::General_options): Initialize all members.
301 * options.h: Include <map>
302 (class General_options): Add --section-start. Add section_starts_
303 member.
304 * layout.cc (Layout::attach_allocated_section_to_segment): If
305 --section-start was used, set the address of the segment. Remove
306 local sort_sections.
307 (Layout::relaxation_loop_body): If the address of the load segment
308 has been set by --section-start, don't use it.
309 * output.h (Output_segment::update_flags_for_output_section): New
310 function.
311 * output.cc (Output_segment::add_output_section): Call
312 update_flags_for_output_section.
313
314 2010-01-05 Ian Lance Taylor <iant@google.com>
315
316 PR 10980
317 * options.h (class General_options): Add --undefined-version.
318 * script.cc (struct Version_expression): Add was_matched_by_symbol
319 field.
320 (Version_script_info::matched_symbol): New function.
321 (Version_script_info::get_symbol_version_helper): Call
322 matched_symbol.
323 (Version_script_info::check_unmatched_names): New function.
324 * script.h (class Version_script_info): Update declarations.
325 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
326
327 * options.h (class General_options): Use DEFINE_bool_alias for
328 allow_multiple_definition.
329 * resolve.cc (Symbol_table::should_override): Don't test
330 allow_multiple_definition.
331
332 PR 10980
333 * options.h (class General_options): Add --cref.
334 * main.cc (main): Print cref table if --cref. Don't close mapfile
335 until after printing cref table.
336 * cref.cc: Include "symtab.h".
337 (class Cref_inputs): Define Cref_table_compare and Cref_table.
338 (Cref_table_compare::operator()): New function.
339 (Cref_inputs::gather_cref): New function.
340 (filecol): New static const.
341 (Cref_inputs::print_cref): New function.
342 (Cref::print_cref): New function.
343 * cref.h: Include <cstdio>.
344 (class Cref): Update declarations.
345 * mapfile.h (Mapfile::file): New function.
346 * object.h (class Object): Define Symbols. Declare virtual
347 do_get_global_symbols.
348 (Object::get_global_symbols): New function.
349 * object.cc (Input_objects::add_object): Pass object to cref_ if
350 --cref.
351 (Input_objects::archive_start): Likewise.
352 (Input_objects::archive_stop): Likewise.
353 (Input_objects::print_cref): New function.
354 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
355 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
356 --cref.
357 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
358 function.
359 * plugin.h (class Sized_pluginobj): Update declarations.
360
361 2010-01-05 Ian Lance Taylor <iant@google.com>
362
363 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
364 to is_default_version. Rename insdef to insdefault.
365 (Symbol_table::add_from_relobj): Rename def to is_default_version
366 and local to is_forced_local.
367 (Symbol_table::add_from_pluginobj): Likewise.
368 (Symbol_table::add_from_dynobj): Likewise.
369 (Symbol_table::define_special_symbol): Rename insdef to
370 insdefault.
371
372 2010-01-04 Ian Lance Taylor <iant@google.com>
373
374 PR 10980
375 * options.h (class General_options): Add
376 --allow-multiple-definition and -z muldefs.
377 * resolve.cc (Symbol_table::should_override): Don't warn about a
378 multiple symbol definition if --allow-multiple-definition or -z
379 muldefs.
380
381 PR 10980
382 * options.h (class General_options): Add --add-needed and
383 --copy-dt-needed-entries. Tweak --as-needed help entry.
384 * object.cc (Input_objects::check_dynamic_dependencies): Give an
385 error if --copy-dt-needed-entries aka --add-needed is used and
386 would cause a change in behaviour.
387
388 PR 10980
389 * options.h (class General_options): Add -G as a short version of
390 --shared. Add no-op options -assert, -g, and -i.
391
392 2010-01-04 Sriraman Tallam <tmsriram@google.com>
393
394 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
395 check for .text or .gnu.linkonce.t sections.
396 * icf.cc (Icf::find_identical_sections): Ditto.
397 Change the detection for mangled function name within the section
398 name.
399 * icf.h (is_section_foldable_candidate): New function.
400
401 2009-12-30 Ian Lance Taylor <iant@google.com>
402
403 PR 10980
404 * options.h (class General_options): Permit two dashes with
405 --retain-symbols-file.
406
407 2009-12-30 Ian Lance Taylor <iant@google.com>
408
409 PR 10979
410 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
411 don't put the file header and segment headers in the text
412 segment.
413
414 PR 10979
415 * common.cc (Sort_commons::operator()): Stabilize sort when both
416 entries are NULL.
417 (Symbol_table::do_allocate_commons_list): When allocating common
418 symbols, skip a symbol which is no longer common.
419 * symtab.h (Symbol::is_common): Test whether the symbol comes from
420 an object before checking its type.
421 * testsuite/common_test_2.c: New file.
422 * testsuite/common_test_3.c: New file.
423 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
424 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
425 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
426 (common_test_2_pic.o, common_test_2.so): New targets.
427 (common_test_3_pic.o, common_test_3.so): New targets.
428 * testsuite/Makefile.in: Rebuild.
429
430 PR 10979
431 * script.cc (read_input_script): If we see a new SECTIONS clause,
432 and we have added an input section, give an error.
433 * layout.h (class Layout): Add have_added_input_section function.
434 Add have_added_input_section_ field.
435 * layout.cc (Layout::Layout): Initialize
436 have_added_input_section_.
437 (Layout::layout): Set have_added_input_section_.
438 (Layout::layout_eh_frame): Likewise.
439
440 2009-12-30 Ian Lance Taylor <iant@google.com>
441
442 PR 10931
443 * options.h (class General_options): Add --sort-common option.
444 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
445 * common.cc (Sort_common): Add sort_order parameter to
446 constructor. Add sort_order_ field.
447 (Sort_commons::operator): Check sort_order_.
448 (Symbol_table::allocate_commons): Determine the sort order.
449 (Symbol_table::do_allocate_commons): Add sort_order parameter.
450 Change all callers.
451 (Symbol_table::do_allocate_commons_list): Likewise.
452
453 2009-12-30 Ian Lance Taylor <iant@google.com>
454
455 PR 10916
456 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
457 symbols from this object, don't change the visibility of an
458 undefined symbol.
459 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
460
461 2009-12-30 Ian Lance Taylor <iant@google.com>
462
463 PR 10861
464 * script.h (class Version_script_info): Define Language enum.
465 Update declarations. Define Glob, Exact, and Lookup types. Add
466 new fields globals_, locals_, and is_finalized_.
467 * script.cc: Various formatting fixes.
468 (class Parser_closure): Change language_stack_ from a vector of
469 std::string to one of Version_script_info::Language. Adjust all
470 uses accordingly.
471 (class Lazy_demangler): Remove.
472 (struct Version_expression): Change language from std::string to
473 Version_script_info::Language.
474 (Version_script_info::Version_script_info): New function.
475 (Version_script_info::~Version_script_info): Don't call clear.
476 (Version_script_info::finalize): New function.
477 (Version_script_info::build_lookup_tables): New function.
478 (Version_script_info::build_expression_list_lookup): New
479 function.
480 (Version_script_info::get_symbol_version_helper): Rewrite to use
481 lookup tables.
482 (Version_script_info::print_expression_list): Adjust to use
483 Version_script_info::Language.
484 (script_push_lex_into_version_mode): Check that the version script
485 has not been finalized.
486 (version_script_push_lang): Change language string to
487 Version_script_info::Language.
488 * options.cc (Command_line::version_script): New function.
489 * options.h (class General_options): Add finalize_dynamic_list
490 function. Change version_script from declaration to definition.
491 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
492 * testsuite/version_script.map: Remove duplicate def of foo.
493 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
494 version_script.map.
495 * testsuite/Makefile.in: Rebuild.
496
497 2009-12-30 Ian Lance Taylor <iant@google.com>
498
499 PR 10843
500 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
501 if the input symbol index is 0, make the output symbol index 0.
502
503 2009-12-30 Ian Lance Taylor <iant@google.com>
504
505 PR 10670
506 * options.h (class General_options): Add -x/--discard-all.
507 * object.cc (Sized_relobj::do_count_local_symbols): Handle
508 --discard-all. If the local symbol needs a dynamic entry, check
509 that before handling --discard-locals.
510
511 2009-12-30 Ian Lance Taylor <iant@google.com>
512
513 PR 10450
514 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
515 flags to PF_R.
516 (Output_segment::add_output_section): Don't change the flags if
517 the type is PT_TLS.
518
519 PR 10450
520 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
521 GNU hash table if they need a dynamic value. Otherwise, don't add
522 them if they are defined in a dynamic object or are forced local.
523
524 2009-12-29 Ian Lance Taylor <iant@google.com>
525
526 PR 10450
527 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
528 .gnu.hash table for a 32-bit target.
529
530 PR 10450
531 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
532 regular and a dynamic object only needs a dynamic symbol table
533 entry if it is externally visible.
534
535 PR 10450
536 * i386.cc (class Target_i386): Initialize global_offset_table_ in
537 constructor. Add global_offset_table_ field.
538 (Target_i386::got_section): Set global_offset_table_.
539 (Target_i386::do_finalize_sections): Set global_offset_table_
540 size.
541 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
542 in constructor. Add global_offset_table_ field.
543 (Target_x86_64::got_section): Set global_offset_table_.
544 (Target_x86_64::do_finalize_sections): Set global_offset_table_
545 size.
546
547 * layout.cc (Layout::Layout): Initialize increase_relro_.
548 (Layout::get_output_section): Add is_relro, is_last_relro, and
549 is_first_non_relro parameters. Change all callers.
550 (Layout::choose_output_section): Likewise.
551 (Layout::add_output_section_data): Likewise.
552 (Layout::make_output_section): Likewise.
553 (Layout::set_segment_offsets): Clear increase_relro when using a
554 linker script.
555 * layout.h (class Layout): Add increase_relro method. Add
556 increase_relro_ field. Update declarations.
557 * output.cc (Output_section::Output_section): Initialize
558 is_last_relro_ and is_first_non_relro_.
559 (Output_segment::add_output_section): Group relro sections is
560 do_sort is true. Handle is_last_relro and is_first_non_relro.
561 (Output_segment::maximum_alignment): Remove relro handling.
562 (Output_segment::set_section_addresses): Add increase_relro
563 parameter. Change all callers. Add initial alignment to align
564 relro sections on separate page. Remove old relro handling.
565 (Output_segment::set_section_list_addresses): Remove in_relro
566 parameter. Change all callers.
567 (Output_segment::set_offset): Add increase parameter. Change all
568 callers. Remove old relro handling.
569 * output.h (class Output_section): Add new methods: is_last_relro,
570 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
571 Add is_last_relro_ and is_first_non_relro_ fields.
572 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
573 Create separate .got.plt section. Call increase_relro.
574 * x86_64.cc (Target_x86_64::got_section): Likewise.
575 * testsuite/relro_script_test.t: Add .got.plt.
576
577 PR 10450
578 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
579 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
580 (Layout::finalize): Call set_dynamic_symbol_size.
581 (Layout::set_dynamic_symbol_size): New function.
582 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
583 set_dynamic_symbol_size.
584
585 PR 10450
586 * output.h (class Output_section): Add is_entsize_zero_ field.
587 * output.cc (Output_section::Output_section): Initialize
588 is_entsize_zero_.
589 (Output_section::set_entsize): If two different entsizes are
590 requested, force it to zero.
591 (Output_section::add_input_section): Set flags for .debug_str
592 before updating section flags. Set entsize.
593 (Output_section::update_flags_for_input_section): Set SHF_MERGE
594 and SHF_STRING if all input sections have those flags.
595
596 2009-12-29 Rafael Espindola <espindola@google.com>
597
598 * main.cc (main): Fix the sys time reporting.
599 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
600 reporting.
601
602 2009-12-29 Sriraman Tallam <tmsriram@google.com>
603
604 * options.cc (General_options::parse_version): Allow -v to exit
605 without an error if there is nothing to link.
606
607 2009-12-29 Ian Lance Taylor <iant@google.com>
608
609 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
610 using a version of gcc before 4.1.
611 * configure: Rebuild.
612
613 2009-12-28 Chris Demetriou <cgd@google.com>
614
615 * attributes.cc (Output_attributes_section_data::do_write): Use
616 std::vector::front rather than std::vector::data.
617
618 2009-12-28 Ian Lance Taylor <iant@google.com>
619
620 * symtab.h (class Symbol_table): Add enum Defined.
621 * resolve.cc (Symbol_table::should_override): Add defined
622 parameter. Change all callers. Test whether object is NULL
623 before calling a method on it.
624 (Symbol_table::report_resolve_problem): Add defined parameter.
625 Change all callers.
626 (Symbol_table::should_override_with_special): Likewise.
627 * symtab.cc (Symbol_table::define_in_output_data): Add defined
628 parameter. Change all callers.
629 (Symbol_table::do_define_in_output_data): Likewise.
630 (Symbol_table::define_in_output_segment): Likewise.
631 (Symbol_table::do_define_in_output_segment): Likewise.
632 (Symbol_table::define_as_constant): Likewise.
633 (Symbol_table::do_define_as_constant): Likewise.
634 * script.h (class Symbol_assignment): Add is_defsym parameter to
635 constructor; change all callers.
636 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
637 parameter. Change all callers. Add is_defsym_ field.
638 (class Parser_closure): Add parsing_defsym parameter to
639 constructor; change all callers. Add parsing_defsym accessor
640 function. Add parsing_defsym_ field.
641
642 2009-12-28 Ian Lance Taylor <iant@google.com>
643
644 * gold.cc (queue_middle_tasks): Fix formatting.
645 * object.cc (Relobj::is_section_name_included): Likewise.
646
647 2009-12-23 Ian Lance Taylor <iant@google.com>
648
649 * i386.cc (Target_i386::do_calls_non_split): Recognize
650 -fsplit-stack prologue for a function with a static chain.
651 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
652 -fsplit-stack prologue when using %r11.
653
654 2009-12-21 Sriraman Tallam <tmsriram@google.com>
655
656 * options.cc (General_options::parse_version): Make -v continue and do
657 the link like GNU ld does.
658
659 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
660
661 * Makefile.am (CCFILES): Add timer.cc.
662 (HFILES): Add timer.h.
663 * configure.ac: Check for sysconf and times.
664 * main.cc: include timer.h.
665 (main): Use Timer instead of get_run_time.
666 * timer.cc: New.
667 * timer.h: New.
668 * workqueue.cc: include timer.h.
669 (Workqueue::find_and_run_task):
670 Report user, sys and wall time.
671 * Makefile.in: Regenerate.
672 * config.in: Regenerate.
673 * configure: Regenerate.
674
675 2009-12-16 Doug Kwan <dougkwan@google.com>
676
677 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
678 sections.
679 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
680 relaxed input sections.
681 * output.cc (Output_section::find_relaxed_input_section): Change
682 return type to Output_relaxed_input_section pointer. Adjust code
683 for new type of relaxed_input_section_map_.
684 * output.h (Output_section::find_relaxed_input_section): Change
685 return type to Output_relaxed_input_section pointer.
686 (Output_section::Output_relaxed_input_section_by_input_section_map):
687 New type.
688 (Output_section::relaxed_input_section_map_): Change type to
689 Output_section::Output_relaxed_input_section_by_input_section_map.
690 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
691 input section.
692
693 2009-12-15 Ian Lance Taylor <iant@google.com>
694
695 * layout.cc (Layout::create_shstrtab): Only write out after input
696 sections if we are compressing debug sections.
697
698 2009-12-15 Ian Lance Taylor <iant@google.com>
699
700 * archive.cc (Archive::add_symbols): Only look up a symbol without
701 a version if there is, in fact, a version.
702
703 2009-12-14 Ian Lance Taylor <iant@google.com>
704
705 Revert -Wshadow changes, all changes from:
706 2009-12-11 Doug Kwan <dougkwan@google.com>
707 2009-12-11 Nick Clifton <nickc@redhat.com>
708 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
709
710 2009-12-11 Doug Kwan <dougkwan@google.com>
711
712 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
713 due to -Wshadow.
714 * attributes.cc (Object_attribute::size): Ditto.
715 (Attributes_section_data::size): Ditto.
716 (Attributes_section_data::Attributes_section_data): Ditto.
717 (Output_attributes_section_data::do_write): Ditto.
718 * attributes.h (Object_attribute::set_type): Ditto.
719 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
720
721 2009-12-11 Nick Clifton <nickc@redhat.com>
722
723 * archive.cc: Fix shadowed variable warnings.
724 * arm.cc: Likewise.
725 * compressed_output.cc: Likewise.
726 * compressed_output.h: Likewise.
727 * configure: Likewise.
728 * dwarf_reader.cc: Likewise.
729 * dynobj.cc: Likewise.
730 * dynobj.h: Likewise.
731 * ehframe.cc: Likewise.
732 * ehframe.h: Likewise.
733 * errors.cc: Likewise.
734 * expression.cc: Likewise.
735 * fileread.cc: Likewise.
736 * fileread.h: Likewise.
737 * freebsd.h: Likewise.
738 * i386.cc: Likewise.
739 * icf.cc: Likewise.
740 * incremental.h: Likewise.
741 * layout.cc: Likewise.
742 * layout.h: Likewise.
743 * mapfile.cc: Likewise.
744 * merge.cc: Likewise.
745 * merge.h: Likewise.
746 * object.cc: Likewise.
747 * object.h: Likewise.
748 * options.h: Likewise.
749 * output.cc: Likewise.
750 * output.h: Likewise.
751 * parameters.cc: Likewise.
752 * plugin.cc: Likewise.
753 * powerpc.cc: Likewise.
754 * reduced_debug_output.cc: Likewise.
755 * reduced_debug_output.h: Likewise.
756 * reloc.cc: Likewise.
757 * reloc.h: Likewise.
758 * resolve.cc: Likewise.
759 * script-sections.cc: Likewise.
760 * script.cc: Likewise.
761 * script.h: Likewise.
762 * sparc.cc: Likewise.
763 * symtab.cc: Likewise.
764 * symtab.h: Likewise.
765 * target-select.cc: Likewise.
766 * target-select.h: Likewise.
767 * token.h: Likewise.
768 * workqueue.cc: Likewise.
769 * workqueue.h: Likewise.
770 * x86_64.cc: Likewise.
771
772 2009-12-10 Doug Kwan <dougkwan@google.com>
773
774 * arm.cc (attributes.h): New include.
775 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
776 (Arm_relobj::~Arm_relobj): Delete object pointed by
777 attributes_section_data_.
778 (Arm_relobj::attributes_section_data): New method definition.
779 (Arm_relobj::attributes_section_data_): New data member declaration.
780 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
781 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
782 attributes_section_data_.
783 (Arm_dynobj::attributes_section_data): New method definition.
784 (Arm_dynobj::attributes_section_data_): New data member declaration.
785 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
786 initialization value of may_use_blx_ to false.
787 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
788 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
789 object attributes to compute results instead of hard-coding.
790 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
791 Target_arm::get_secondary_compatible_arch,
792 Target_arm::set_secondary_compatible_arch
793 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
794 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
795 New method declarations.
796 (Target_arm::get_aeabi_object_attribute): New method definition.
797 (Target_arm::attributes_section_data_): New data member declaration.
798 (read_arm_attributes_section): New template definition.
799 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
800 (Arm_dynobj::do_read_symbols): Ditto.
801 (Target_arm::do_finalize_sections): Merge attributes sections from
802 input. Check for BLX use after attributes section merging.
803 Fix __exidx_start and __exidx_end visibility. Create an
804 .ARM.attributes section if necessary.
805 (Target_arm::get_secondary_compatible_arch,
806 Target_arm::set_secondary_compatible_arch,
807 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
808 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
809 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
810 New method definitions.
811
812 2009-12-09 Ian Lance Taylor <iant@google.com>
813
814 * plugin.cc (Plugin::load): Don't cast from void* to a function
815 pointer.
816
817 2009-12-09 Ian Lance Taylor <iant@google.com>
818
819 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
820 information fields.
821
822 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
823
824 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
825 Replace two_file_shared_1.so with two_file_shared_2.so.
826 * testsuite/Makefile.in: Regenerated.
827
828 2009-12-08 Doug Kwan <dougkwan@google.com>
829
830 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
831 (HFILES): Add attributes.h and int_encoding.h.
832 * Makefile.in: Regenerate.
833 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
834 function definitions to int_encoding.cc
835 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
836 prototypes to int_encoding.h
837 * reduced_debug_output.cc (int_encoding.h): New include.
838 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
839 function definitions to int_encoding.cc
840 (insert_into_vector, read_from_pointer): Move template definitions to
841 int_encoding.h
842 * attributes.cc: New file.
843 * attributes.h: New file.
844 * int_encoding.cc: New file.
845 * int_encoding.h: New file.
846
847 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
848
849 PR gold/11055
850 * incremental-dump.cc (dump_incremental_inputs): New.
851 (main): Use dump_incremental_inputs.
852
853 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
854
855 PR gold/10893
856 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
857 checking elfcpp::STT_FUNC.
858 (Target_i386::Relocate::relocate): Likewise.
859 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
860
861 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
862 symbols from shared libraries into normal FUNC symbols.
863
864 * symtab.h (Symbol): Add is_func and use it.
865
866 2009-12-05 Doug Kwan <dougkwan@google.com>
867
868 * arm.cc (Target_arm::arm_info): Initialize new fields
869 attributes_section and attributes_vendor.
870 * i386.cc (Target_i386::i386_info): Same.
871 * object.cc (Sized_relobj::do_layout): Skip attribute section.
872 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
873 fields attributes_section and attributes_vendor.
874 * sparc.cc (Target_sparc::sparc_info): Same.
875 * target.h (Target::attributes_section, Target::attributes_vendor,
876 Target::is_attributes_section, Target::attribute_arg_type,
877 Target::attributes_order): New method definitions.
878 (Target::Target_info::attributes_section,
879 Target::Target_info::attributes_vendor): New fields.
880 (Target::do_attribute_arg_type, Target::do_attributes_order): New
881 virtual method definitions.
882 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
883 attributes_section and attributes_vendor.
884 * testsuite/testfile.cc (Target_test::test_target_info): Same.
885
886 2009-12-05 Doug Kwan <dougkwan@google.com>
887
888 * arm.cc: Update comments about interworking and stub generation.
889 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
890 considered as non-PIC.
891 (Arm_relocate_functions::base_abs): Fix formatting.
892 (Arm_relocate_functions::got_prel): Fix comment. Change interface
893 of function to use GOT entry address instead of offset.
894 (Target_arm::Scan::global): Issue an error if a symbol would need a
895 PLT does not get one because it is untyped. Remove code to create
896 dynamic symbols for relative branches.
897 (Target_arm::Relocate::relocate: Use 0 instead of false since function
898 takes unsigned integer instead of boolean.
899
900 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
901
902 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
903 (two_file_test_LDADD): Likewise.
904 (common_test_1_LDADD): Likewise.
905 (exception_test_LDADD) Likewise.
906 (weak_test_LDADD): Likewise.
907 (many_sections_test_LDADD): Likewise.
908 (initpri1_LDADD): Likewise.
909 (script_test_1_LDADD): Likewise.
910 (script_test_2_LDADD): Likewise.
911 (justsyms_LDADD): Likewise.
912 (binary_test_LDADD): Likewise.
913 (large_LDADD): Likewise.
914 * testsuite/Makefile.in: Regenerated.
915
916 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
917
918 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
919 (Symbol_table::override_with_special): Likewise.
920 (Symbol_table::add_from_object): Likewise.
921
922 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
923
924 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
925 Don't set the data_offset twice.
926
927 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
928
929 * testsuite/Makefile.in: Regenerate.
930
931 2009-12-03 Doug Kwan <dougkwan@google.com>
932
933 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
934 (Target_arm::do_finalize_sections): Add parameter for symbol table
935 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
936 * i386.cc (Target_i386::do_finalize_sections): Add an additional
937 parameter for symbol table pointer.
938 * layout.cc (Layout::finalize): Call Target::finalize_sections with
939 an additional parameter for a pointer to symbol table.
940 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
941 parameter for a symbol table pointer.
942 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
943 * target.h (Target::finalize_sections, Target::do_finalize_sections):
944 Ditto.
945 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
946 parameter for a symbol table pointer.
947
948 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
949
950 * incremental.cc (Incremental_inputs_header)
951 (Incremental_inputs_header_write, Incremental_inputs_entry)
952 (Incremental_inputs_entry_write): Move ...
953 * incremental.h (Incremental_inputs_header)
954 (Incremental_inputs_header_write, Incremental_inputs_entry)
955 (Incremental_inputs_entry_write): here.
956
957 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
958
959 * incremental.cc (make_sized_incremental_binary): Set the target.
960 Error if it is incompatible.
961 * output.h (Output_file): Add filename method.
962
963 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
964
965 * incremental.cc (Incremental_inputs_entry): Remove unused argument
966 from the get_* methods.
967
968 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
969
970 * incremental-dump.cc (main): Check that the offeset of a script is 0.
971 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
972 Write 0 for the data_offset of scripts.
973
974 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
975
976 * testsuite/Makefile.am: Add the incremental_test.sh test.
977 * testsuite/incremental_test.sh: New.
978 * testsuite/incremental_test_1.c: New.
979 * testsuite/incremental_test_2.c: New.
980
981 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
982
983 * incremental-dump.cc (main): Fix typos.
984
985 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
986
987 PR gold/11025
988 * incremental-dump.cc (main): Use llu to print 64 bit values.
989
990 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
991 H.J. Lu <hongjiu.lu@intel.com>
992
993 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
994 $(LIBDL).
995 (incremental_dump_LDADD): Likewise.
996 * Makefile.in: Regenerated.
997
998 2009-11-25 Doug Kwan <dougkwan@google.com>
999
1000 Revert:
1001
1002 2009-11-25 Doug Kwan <dougkwan@google.com>
1003
1004 * arm.cc (Target_arm::Target_arm): Move method definition
1005 outside of class definition. Add code to handle
1006 --target1-rel, --target1-abs and --target2= options.
1007 (Target_arm::get_reloc_reloc_type): Change method to be
1008 non-static and const.
1009 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
1010 New data member declaration.
1011 (Target_arm::Scan::local, Target_arm::Scan::global,
1012 Target_arm::Relocate::relocate,
1013 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
1014 Adjust call to Target_arm::get_real_reloc_type.
1015 (Target_arm::get_real_reloc_type): Use command line options
1016 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
1017 * options.h (--target1-rel, --target1-abs, --target2): New
1018 ARM-only options.
1019
1020 2009-11-25 Doug Kwan <dougkwan@google.com>
1021
1022 * arm.cc (Target_arm::Target_arm): Move method definition outside of
1023 class definition. Add code to handle --target1-rel, --target1-abs
1024 and --target2= options.
1025 (Target_arm::get_reloc_reloc_type): Change method to be non-static
1026 and const.
1027 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
1028 member declaration.
1029 (Target_arm::Scan::local, Target_arm::Scan::global,
1030 Target_arm::Relocate::relocate,
1031 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
1032 call to Target_arm::get_real_reloc_type.
1033 (Target_arm::get_real_reloc_type): Use command line options to
1034 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
1035 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
1036 options.
1037
1038 2009-11-25 Doug Kwan <dougkwan@google.com>
1039
1040 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
1041 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
1042 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
1043 formatting.
1044 (Arm_relocate_functions::thm_call): Replace body with a call to
1045 Arm_relocate_functions::thumb_branch_common.
1046 (Arm_relocate_functions::thm_jump24,
1047 Arm_relocate_functions::thm_xpc22): New method definitions.
1048 (Arm_relocate_functions::thumb_branch_common): New method definition.
1049 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
1050 operator.
1051 (Target_arm::Relocate::relocate): Adjust call to thm_call.
1052 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
1053
1054 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
1055
1056 * Makefile.am: Build incremental-dump
1057 * Makefile.in: Regenerate.
1058 * incremental-dump.cc: New.
1059 * incremental.cc (Incremental_inputs_header_data,
1060 Incremental_inputs_entry_data): Move to incremental.h
1061 * incremental.h: (Incremental_inputs_header_data,
1062 Incremental_inputs_entry_data): Move from incremental.cc
1063
1064 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
1065
1066 * incremental.cc (Incremental_inputs_header,
1067 Incremental_inputs_header_write, Incremental_inputs_entry,
1068 Incremental_inputs_entry_write): Add a typedef with the data type.
1069
1070 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
1071
1072 * incremental.cc (Incremental_inputs_header,
1073 Incremental_inputs_header_write, Incremental_inputs_entry,
1074 Incremental_inputs_entry_write): Update comment about which
1075 type has the filed descriptions.
1076
1077 2009-11-15 Doug Kwan <dougkwan@google.com>
1078
1079 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
1080 (Arm_relocate_functions::arm_branch_common): Change method defintion
1081 in class definition to a method declaration and update list of formal
1082 parameters.
1083 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
1084 Arm_relocation_functions::jump24): Adjust call to
1085 Arm_relocate_functions::arm_branch_common. Update list of formal
1086 parameters.
1087 (Arm_relocate_functions::xpc25): New method definition.
1088 (Arm_relocate_functions::arm_branch_common): Move method defintion
1089 out from class definition. Use stubs for mode-switching and extending
1090 branch ranges.
1091 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
1092 specially. Change code to enable use of stubs in ARM branches.
1093
1094 2009-11-10 Doug Kwan <dougkwan@google.com>
1095
1096 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
1097 in method declaration.
1098 (Target_arm::relocate_stub): New method declaration.
1099 (Target_arm::default_target): Change to return a pointer instead of
1100 a const reference.
1101 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
1102 Target_arm::default_target.
1103 (Arm_Relobj::do_relocate_sections): Remove options paramater in
1104 method definition.
1105 (Target_arm::relocate_section): Adjust view.
1106 (Target_arm::relocate_stub): New method definition.
1107
1108 2009-11-10 Doug Kwan <dougkwan@google.com>
1109
1110 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
1111 a format warning.
1112 * incremental.cc (open_incremental_binary): Initialized local
1113 variables to avoid warnings.
1114 * object.cc (make_elf_object): Ditto.
1115 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
1116 a format warning.
1117
1118 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
1119
1120 PR gold/10930
1121 * testsuite/plugin_test.c: Include "config.h".
1122
1123 2009-11-09 Doug Kwan <dougkwan@google.com>
1124
1125 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
1126 (arm_symbol_value): Remove.
1127 (Arm_relocate_functions::arm_branch_common,
1128 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
1129 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
1130 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
1131 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
1132 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
1133 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
1134 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
1135 Arm_relocate_functions::thm_mobw_abs_nc,
1136 Arm_relocate_functions::thm_mov_abs,
1137 Arm_relocate_functions::movw_prel_nc,
1138 Arm_relocate_functions::thm_movt_abs,
1139 Arm_relocate_functions::movt_prel,
1140 Arm_relocate_functions::thm_movw_prel_nc,
1141 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
1142 (Target_arm::Relocate::relocate): Only decompose address into two
1143 parts if relocation type uses the thumb-bit and pass the actual
1144 bit instead of a flag indicating that the thumb-bit is used. Adjust
1145 calls to methods in Arm_relocate_functions for this change.
1146
1147 2009-11-08 Ian Lance Taylor <iant@google.com>
1148
1149 PR 10925
1150 * reloc.cc: Instantiate
1151 Sized_relobj::initialize_input_to_output_maps and
1152 Sized_relobj:free_input_to_output_maps.
1153
1154 2009-11-06 Ian Lance Taylor <iant@google.com>
1155
1156 PR 10876
1157 * defstd.cc (in_segment): Set only_if_ref true for "end".
1158
1159 2009-11-06 Doug Kwan <dougkwan@google.com>
1160
1161 * arm.cc (class Reloc_stub): Correct a comment.
1162 (Target_arm::Target_arm): Initialize arm_input_section_map_.
1163 (Target_arm::scan_section_for_stubs): New method declaration.
1164 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
1165 Change methods from private to protected.
1166 (Target_arm::do_may_relax): New method definition.
1167 (Target_arm::do_relax, Target_arm::group_sections,
1168 Target_arm::scan_reloc_for_stub,
1169 Target_arm::scan_reloc_section_for_stubs): New method declarations.
1170 (Target_arm::arm_input_section_map_): New data member declaration.
1171 (Target_arm::scan_reloc_for_stub,
1172 Target_arm::scan_reloc_section_for_stubs,
1173 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
1174 Target_arm::do_relax): New method definitions.
1175
1176 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
1177
1178 * configure.ac: Check for (struct stat)::st_mtim
1179 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
1180 * config.in: Regenerate.
1181 * configure: Regenerate.
1182
1183 2009-11-05 Ian Lance Taylor <iant@google.com>
1184
1185 PR 10910
1186 * output.cc (Output_segment::add_output_section): Add missing
1187 return statement.
1188
1189 2009-11-04 Ian Lance Taylor <iant@google.com>
1190
1191 PR 10880
1192 * object.h (class Object): Add is_needed and set_is_needed
1193 methods. Add is_needed_ field. Make bool fields into bitfields.
1194 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
1195 defined in a dynamic object and referenced by a regular object,
1196 set is_needed for the dynamic object.
1197 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
1198 if the file is marked with as_needed and it is not needed.
1199
1200 2009-11-04 Ian Lance Taylor <iant@google.com>
1201
1202 PR 10887
1203 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
1204 tags if data is discarded by linker script.
1205 * i386.cc (Target_i386::do_finalize_sections): Likewise.
1206 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
1207 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
1208 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1209
1210 2009-11-04 Ian Lance Taylor <iant@google.com>
1211
1212 * layout.cc (Layout::get_output_section): Add is_interp and
1213 is_dynamic_linker_section parameters. Change all callers.
1214 (Layout::choose_output_section): Likewise.
1215 (Layout::make_output_section): Likewise.
1216 (Layout::add_output_section_data): Add is_dynamic_linker_section
1217 parameter. Change all callers.
1218 * layout.h (class Layout): Update declarations.
1219 * output.h (class Output_section): Add is_interp, set_is_interp,
1220 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
1221 Add is_interp_, is_dynamic_linker_section_ fields. Change
1222 generate_code_fills_at_write_ to a bitfield.
1223 * output.cc (Output_section::Output_sections): Initialize new
1224 fields.
1225 (Output_segment::add_output_section): Add do_sort parameter.
1226 Change all callers.
1227
1228 2009-11-03 Ian Lance Taylor <iant@google.com>
1229
1230 PR 10860
1231 * options.h (class General_options): Add --warn-common.
1232 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
1233 merging two common symbols.
1234 (Symbol_table::should_override): Handle --warn-common when merging
1235 a common symbol with a defined symbol. Use report_resolve_problem
1236 for multiple definitions.
1237 (Symbol_table::report_resolve_problem): New function.
1238 * symtab.h (class Symbol_table): Declare report_resolve_problem.
1239
1240 2009-11-03 Doug Kwan <dougkwan@google.com>
1241
1242 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
1243 stub_factory_.
1244 (Target_arm::stub_factory): New method definition.
1245 (Target_arm::new_arm_input_section,
1246 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
1247 Target_arm::reloc_uses_thumb_bit): New method declarations.
1248 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
1249 New type definitions.
1250 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
1251 member declarations.
1252 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
1253 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
1254 New method definitions.
1255
1256 2009-11-03 Ian Lance Taylor <iant@google.com>
1257
1258 * options.h (class General_options): Add --warn_constructors.
1259
1260 2009-11-03 Ian Lance Taylor <iant@google.com>
1261
1262 PR 10893
1263 * defstd.cc (in_section): Add entries for __rel_iplt_start,
1264 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
1265
1266 2009-11-03 Ian Lance Taylor <iant@google.com>
1267
1268 PR 10895
1269 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
1270 --msgid-bugs-address.
1271 (install-pdf): New target.
1272 (install-data_yes): Look up one directory to find mkinstalldirs.
1273
1274 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
1275
1276 * po/Make-in (.po.gmo): Don't generate .gmo files in source
1277 tree.
1278
1279 2009-10-30 Doug Kwan <dougkwan@google.com>
1280
1281 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
1282
1283 2009-10-30 Doug Kwan <dougkwan@google.com>
1284
1285 * arm.cc (Stub_addend_reader): New struct template definition
1286 and partial specializations.
1287 (Stub_addend_reader::operator()): New method definition for a
1288 partially specialized template.
1289
1290 2009-10-30 Doug Kwan <dougkwan@google.com>
1291
1292 * arm.cc (Arm_relobj::processor_specific_flags): New method
1293 definition.
1294 (Arm_relobj::do_read_symbols): New method declaration.
1295 (Arm_relobj::processor_specific_flags_): New data member declaration.
1296 (Arm_dynobj): New class definition.
1297 (Target_arm::do_finalize_sections): Add input_objects parameter.
1298 (Target_arm::do_adjust_elf_header): New method declaration.
1299 (Target_arm::are_eabi_versions_compatible,
1300 (Target_arm::merge_processor_specific_flags): New method declaration.
1301 (Target_arm::do_make_elf_object): New overloaded method definitions
1302 and declaration.
1303 (Arm_relobj::do_read_symbols): New method definition.
1304 (Arm_dynobj::do_read_symbols): Ditto.
1305 (Target_arm::do_finalize_sections): Add input_objects parameters.
1306 Merge processor-specific flags from all input objects.
1307 (Target_arm::are_eabi_versions_compatible,
1308 Target_arm::merge_processor_specific_flags,
1309 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
1310 New method definitions.
1311 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
1312 Input_objects pointer type parameter.
1313 * layout.cc (Layout::finalize): Pass input objects to target's.
1314 finalize_sections function.
1315 * output.cc (Output_file_header::do_sized_write): Set ELF file
1316 header's processor-specific flags.
1317 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
1318 Input_objects pointer type parameter.
1319 * sparc.cc (Target_sparc::do_finalize_sections): Same.
1320 * target.h (Input_objects): New forward class declaration.
1321 (Target::processor_specific_flags,
1322 Target::are_processor_specific_flags_sect): New method definitions.
1323 (Target::finalize_sections): Add input_objects parameter.
1324 (Target::Target): Initialize processor_specific_flags_ and
1325 are_processor_specific_flags_set_.
1326 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
1327 parameter.
1328 (Target::set_processor_specific_flags): New method definition.
1329 (Target::processor_specific_flags_,
1330 Target::are_processor_specific_flags_set_): New data member
1331 declarations.
1332 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
1333 Input_objects pointer type parameter.
1334
1335 2009-10-30 Doug Kwan <dougkwan@google.com>
1336
1337 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
1338
1339 2009-10-28 Ian Lance Taylor <iant@google.com>
1340
1341 * object.h (class Relobj): Drop options parameter from
1342 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
1343 do_scan_relocs, do_relocate. Change all callers.
1344 (class Sized_relobj): Drop options parameters from
1345 do_gc_process_relocs, do_scan_relocs, do_relocate,
1346 do_relocate_sections, relocate_sections, emit_relocs_scan,
1347 emit_relocs_scan_reltype. Change all callers.
1348 (struct Relocate_info): Remove options field and all references to
1349 it.
1350 * reloc.h (class Read_relocs): Remove options constructor
1351 parameter and options_ field. Change all callers.
1352 (class Gc_process_relocs, class Scan_relocs): Likewise.
1353 (class Relocate_task): Likewise.
1354 * target-reloc.h (scan_relocs): Remove options parameter. Change
1355 all callers.
1356 (scan_relocatable_relocs): Likewise.
1357 * target.h (class Sized_target): Remove options parameter from
1358 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
1359 all callers.
1360 * gc.h (gc_process_relocs): Remove options parameter. Change all
1361 callers.
1362 * arm.cc: Update functions to remove options parameters.
1363 * i386.cc: Likewise.
1364 * powerpc.cc: Likewise.
1365 * sparc.cc: Likewise.
1366 * x86_64.cc: Likewise.
1367 * testsuite/testfile.cc: Likewise.
1368
1369 2009-10-28 Doug Kwan <dougkwan@google.com>
1370
1371 * arm.cc (Arm_relobj): New class definition.
1372 (Arm_relobj::scan_sections_for_stubs,
1373 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
1374 New method definitions.
1375
1376 2009-10-28 Cary Coutant <ccoutant@google.com>
1377
1378 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
1379 (Plugin::cleanup_done_): New member.
1380 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
1381 (Plugin_manager::cleanup_done_): Remove.
1382 (Plugin_manager::add_input_file): Edit error message.
1383 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
1384 (Plugin_manager::cleanup): Remove use of cleanup_done_.
1385
1386 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
1387
1388 * fileread.cc: (File_read::View::~View): Use the new
1389 data_ownership_ filed.
1390 (File_read::~File_read): Dispose the new whole_file_view_.
1391 (File_read::open): Mmap the whole file if needed.
1392 (File_read::open): Use whole_file_view_ instead of contents_.
1393 (File_read::find_view): Use whole_file_view_ if applicable.
1394 (File_read::do_read): Use whole_file_view_ instead of contents_.
1395 (File_read::make_view): Use whole_file_view_ instead of contents_,
1396 update File_read::View::View call.
1397 (File_read::find_or_make_view): Update File_read::View::View
1398 call.
1399 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
1400 remove contents_
1401 (File_read::View::Data_ownership): New enum.
1402 (File_read::View::View): Replace bool mapped_ with Data_ownership
1403 argument.
1404 (File_read::View::mapped_): Remove (replaced by data_ownership_).
1405 (File_read::View::data_ownership_): New field.
1406 (File_read::contents_): Remove (replaced by whole_file_view_).
1407 (File_read::whole_file_view_): New field.
1408 * options.h (class General_options): Add --keep-files-mapped.
1409
1410 2009-10-27 Cary Coutant <ccoutant@google.com>
1411
1412 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
1413 * testsuite/Makefile.am (plugin_test_5): New test case.
1414 * testsuite/Makefile.in: Regenerate.
1415
1416 2009-10-25 Doug Kwan <dougkwan@google.com>
1417
1418 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
1419 from private to protected to allow access by child class.
1420 (Sized_relobj::do_relocate_sections): New method declaration.
1421 (Sized_relobj::relocate_sections): Virtualize.
1422 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
1423 Sized_relobj::relocate_sections. Instantiate template explicitly
1424 for different target sizes and endianity.
1425
1426 2009-10-24 Doug Kwan <dougkwan@google.com>
1427
1428 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
1429 (Arm_input_section::as_arm_input_section): New method.
1430 (Arm_output_section): New class definition.
1431 (Arm_output_section::create_stub_group,
1432 Arm_output_section::group_sections): New method definitions.
1433
1434 2009-10-22 Doug Kwan <dougkwan@google.com>
1435
1436 * arm.cc (Arm_input_section): New class definition.
1437 (Arm_input_section::init, Arm_input_section:do_write,
1438 Arm_input_section::set_final_data_size,
1439 Arm_input_section::do_reset_address_and_file_offset): New method
1440 definitions.
1441
1442 2009-10-21 Doug Kwan <dougkwan@google.com>
1443
1444 * arm.cc (Stub_table, Arm_input_section): New forward class
1445 declarations.
1446 (Stub_table): New class defintion.
1447 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
1448 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
1449 New method definition.
1450
1451 2009-10-21 Doug Kwan <dougkwan@google.com>
1452
1453 * arm.cc: Update copyright comments.
1454 (Target_arm): New forward class template declaration.
1455 (Arm_address): New type.
1456 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
1457 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
1458 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
1459 constants.
1460 (Insn_template): Same.
1461 (DEF_STUBS): New macro.
1462 (Stub_type): New enum type.
1463 (Stub_template): New class definition.
1464 (Stub): Same.
1465 (Reloc_stub): Same.
1466 (Stub_factory): Same.
1467 (Target_arm::Target_arm): Initialize may_use_blx_ and
1468 should_force_pic_veneer_.
1469 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
1470 Target_arm::should_force_pic_veneer,
1471 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
1472 Target_arm::using_thumb_only, Target_arm:;default_target): New
1473 method defintions.
1474 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
1475 New data member declarations.
1476 (Insn_template::size, Insn_template::alignment): New method defintions.
1477 (Stub_template::Stub_template): New method definition.
1478 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
1479 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
1480 (Stub_factory::Stub_factory): New method definition.
1481 * gold.h (string_hash): New template.
1482 * output.h (Input_section_specifier::hash_value): Use
1483 gold::string_hash.
1484 (Input_section_specifier::string_hash): Remove.
1485 * stringpool.cc (Stringpool_template::string_hash): Use
1486 gold::string_hash.
1487
1488 2009-10-20 Doug Kwan <dougkwan@google.com>
1489
1490 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
1491 symbols of relaxed input sections.
1492 * output.h (Output_section::find_relaxed_input_section): Make
1493 method public.
1494
1495 2009-10-16 Doug Kwan <dougkwan@google.com>
1496
1497 * dynobj.cc (Versions::Versions): Initialize version_script_.
1498 Only insert base version symbol definition for a shared object
1499 if version script defines any version versions.
1500 (Versions::define_base_version): New method definition.
1501 (Versions::add_def): Check that base version is not needed.
1502 (Versions::add_need): Define base version lazily.
1503 * dynobj.h (Versions::define_base_version): New method declaration.
1504 (Versions::needs_base_version_): New data member declaration.
1505 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
1506 (check_DATA): Add no_version_test.stdout.
1507 (libno_version_test.so, no_version_test.o no_version_test.stdout):
1508 New make rules.
1509 * testsuite/Makefile.in: Regenerate.
1510 * testsuite/no_version_test.c: New file.
1511 * testsuite/no_version_test.sh: Ditto.
1512
1513 2009-10-16 Doug Kwan <dougkwan@google.com>
1514
1515 * expression.cc (class Segment_start_expression): New class definition.
1516 (Segment_start_expression::value): New method definition.
1517 (script_exp_function_segment_start): Return a new
1518 Segment_start_expression.
1519 * gold/script-c.h (script_saw_segment_start_expression): New function
1520 prototype.
1521 * script-sections.cc (Script_sections::Script_sections): Initialize
1522 SAW_SEGMENT_START_EXPRESSION_ to false.
1523 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
1524 and -Tbbs options to specify section addresses if given in
1525 command line and no SEGMENT_START expression is seen in a script.
1526 * script-sections.h (Script_sections::saw_segment_start_expression,
1527 Script_sections::set_saw_segment_start_expression): New method
1528 definition.
1529 (Script_sections::saw_segment_start_expression_): New data member
1530 declaration.
1531 * script.cc (script_saw_segment_start_expression): New function.
1532 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
1533 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
1534 script_test_7.sh and script_test_8.sh.
1535 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
1536 script_test_8.stdout.
1537 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
1538 (script_test_6, script_test_6.stdout, script_test_7,
1539 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
1540 * Makefile.in: Regenerate.
1541 * testsuite/script_test_6.sh: New file.
1542 * testsuite/script_test_6.t: Same.
1543 * testsuite/script_test_7.sh: Same.
1544 * testsuite/script_test_7.t: Same.
1545 * testsuite/script_test_8.sh: Same.
1546
1547 2009-10-16 Doug Kwan <dougkwan@google.com>
1548
1549 * output.cc (Output_segment::set_section_list_address): Cast
1550 expressions to unsigned long long type to avoid format warnings.
1551
1552 2009-10-15 Ian Lance Taylor <iant@google.com>
1553
1554 * script.cc (Script_options::add_symbol_assignment): Always add a
1555 dot assignment to script_sections_.
1556 * script-sections.cc (Script_sections::add_dot_assignment):
1557 Initialize if necessary.
1558
1559 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
1560 program headers with no load segment if there is a linker script.
1561
1562 * layout.cc (Layout::set_segment_offsets): Align the file offset
1563 to the segment aligment for -N or -n with no load segment.
1564 * output.cc (Output_segment::add_output_section): Don't crash if
1565 the first section is a TLS section.
1566 (Output_segment::set_section_list_addresses): Print an error
1567 message if the address moves backward in a linker script.
1568 * script-sections.cc
1569 (Output_section_element_input::set_section_addresses): Don't
1570 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
1571 (Orphan_output_section::set_section_addresses): Likewise.
1572
1573 2009-10-15 Doug Kwan <dougkwan@google.com>
1574
1575 * layout.cc (Layout::finish_dynamic_section): Generate tags
1576 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
1577 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
1578 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
1579
1580 2009-10-14 Ian Lance Taylor <iant@google.com>
1581
1582 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
1583 fields.
1584 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
1585 data_shdr fields of relinfo.
1586 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
1587 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
1588 R_386_TLS_LDO_32, adjust based on section flags.
1589 (Target_i386::Relocate::fix_up_ldo): Remove.
1590
1591 2009-10-13 Ian Lance Taylor <iant@google.com>
1592
1593 Add support for -pie.
1594 * options.h (class General_options): Add -pie and
1595 --pic-executable.
1596 (General_options::output_is_position_independent): Test -pie.
1597 (General_options::output_is_executable): Return true if not shared
1598 and not relocatable.
1599 (General_options::output_is_pie): Remove.
1600 * options.cc (General_options::finalize): Reject incompatible uses
1601 of -pie.
1602 * gold.cc (queue_middle_tasks): A -pie link is not static.
1603 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
1604 * symtab.cc (Symbol::final_value_is_known): Return false if
1605 output_is_position_independent.
1606 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
1607 output_is_position_independent.
1608 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
1609 output_is_position_independent.
1610 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
1611 output_is_position_independent.
1612 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
1613 two_file_pie_test.
1614 (basic_pie_test.o, basic_pie_test): New targets.
1615 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
1616 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
1617 (two_file_pie_test): New target.
1618 * testsuite/Makefile.in: Rebuild.
1619 * README: Remove note saying that -pie is not supported.
1620
1621 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
1622
1623 * options.h (class General_options): Add -init and -fini.
1624 * layout.cc (Layout::finish_dynamic_section): Emit
1625 given init and fini functions.
1626
1627 2009-10-13 Sriraman Tallam <tmsriram@google.com>
1628
1629 * gc.h (gc_process_relocs): Check if icf is enabled using new
1630 function.
1631 * gold.cc (queue_initial_tasks): Likewise.
1632 (queue_middle_tasks): Likewise.
1633 * object.cc (do_layout): Likewise.
1634 * symtab.cc (is_section_folded): Likewise.
1635 * main.cc (main): Likewise.
1636 * reloc.cc (Read_relocs::run): Likewise.
1637 (Sized_relobj::do_scan_relocs): Likewise.
1638 * icf.cc (is_function_ctor_or_dtor): New function.
1639 (Icf::find_identical_sections): Check if function is ctor or dtor when
1640 safe icf is chosen.
1641 * options.h (General_options::icf): Change option to be an enum.
1642 (Icf_status): New enum.
1643 (icf_enabled): New method.
1644 (icf_safe_folding): New method.
1645 (set_icf_status): New method.
1646 (icf_status_): New variable.
1647 * (options.cc) (General_options::finalize): Set icf_status_.
1648 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
1649 icf_test and icf_keep_unique_test to use the --icf enum flag.
1650 * testsuite/icf_safe_test.sh: New file.
1651 * testsuite/icf_safe_test.cc: New file.
1652
1653 2009-10-12 Sriraman Tallam <tmsriram@google.com>
1654
1655 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
1656 includes to gc.h and icf.h.
1657 * arm.cc: Include gc.h.
1658 * gold.cc: Likewise.
1659 * i386.cc: Likewise.
1660 * powerpc.cc: Likewise.
1661 * sparc.cc: Likewise.
1662 * x86_64.cc: Likewise.
1663 * gc.h: Include icf.h.
1664
1665 2009-10-11 Ian Lance Taylor <iant@google.com>
1666
1667 * plugin.cc: Include "gold.h" before other header files.
1668
1669 2009-10-10 Chris Demetriou <cgd@google.com>
1670
1671 * options.h (Input_file_argument::Input_file_type): New enum.
1672 (Input_file_argument::is_lib_): Replace with...
1673 (Input_file_argument::type_): New member.
1674 (Input_file_argument::Input_file_argument): Take Input_file_type
1675 'type' rather than boolean 'is_lib' as second argument.
1676 (Input_file_argument::is_lib): Use type_.
1677 (Input_file_argument::is_searched_file): New function.
1678 (Input_file_argument::may_need_search): Handle is_searched_file.
1679 * options.cc (General_options::parse_library): Support -l:filename.
1680 (General_options::parse_just_symbols): Update for Input_file_argument
1681 changes.
1682 (Command_line::process): Likewise.
1683 * archive.cc (Archive::get_file_and_offset): Likewise.
1684 * plugin.cc (Plugin_manager::release_input_file): Likewise.
1685 * script.cc (read_script_file, script_add_file): Likewise.
1686 * fileread.cc (Input_file::Input_file): Likewise.
1687 (Input_file::will_search_for): Handle is_searched_file.
1688 (Input_file::open): Likewise.
1689 * readsyms.cc (Read_symbols::get_name): Likewise.
1690 * testsuite/Makefile.am (searched_file_test): New test.
1691 * testsuite/Makefile.in: Regenerate.
1692 * testsuite/searched_file_test.cc: New file.
1693 * testsuite/searched_file_test_lib.cc: New file.
1694
1695 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
1696 Ian Lance Taylor <iant@google.com>
1697
1698 * descriptor.cc: Include <cstdio> and "binary-io.h".
1699 (Descriptors::open): Open the files in binary mode always.
1700 * script.cc (Lex::get_token): Treat \r as whitespace.
1701
1702 2009-10-09 Ian Lance Taylor <iant@google.com>
1703
1704 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
1705
1706 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
1707 Ian Lance Taylor <iant@google.com>
1708
1709 * configure.ac: Check for readv function also.
1710 * fileread.cc (readv): Define if not HAVE_READV.
1711 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
1712 does not exist.
1713 * config.in: Regenerate.
1714 * configure: Regenerate.
1715
1716 2009-10-09 Doug Kwan <dougkwan@google.com>
1717
1718 * layout.cc (Layout::make_output_section): Call target hook to make
1719 ordinary output section.
1720 (Layout::finalize): Adjust parameter list of call the
1721 Target::may_relax().
1722 * layout.h (class Layout::section_list): New method.
1723 * merge.h (Output_merge_base::entsize): Change visibility to public.
1724 (Output_merge_base::is_string, Output_merge_base::do_is_string):
1725 New methods.
1726 (Output_merge_string::do_is_string): New method.
1727 * object.cc (Sized_relobj::do_setup): renamed from
1728 Sized_relobj::set_up.
1729 * object.h (Sized_relobj::adjust_shndx,
1730 Sized_relobj::initializ_input_to_output_maps,
1731 Sized_relobj::free_input_to_output_maps): Change visibilities to
1732 protected.
1733 (Sized_relobj::setup): Virtualize.
1734 (Sized_relobj::do_setup): New method declaration.
1735 (Sized_relobj::invalidate_section_offset,
1736 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
1737 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
1738 * options.cc (parse_int): New function.
1739 * options.h (parse_int): New declaration.
1740 (DEFINE_int): New macro.
1741 (stub_group_size): New option.
1742 * output.cc (Output_section::Output_section): Initialize memebers
1743 merge_section_map_, merge_section_by_properties_map_,
1744 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
1745 (Output_section::add_input_section): Handled deferred code-fill
1746 generation and remove an old comment.
1747 (Output_section::add_relaxed_input_section): New method definition.
1748 (Output_section::add_merge_input_section): Use merge section by
1749 properties map to speed to search. Update merge section maps
1750 as appropriate.
1751 (Output_section::build_relaxation_map): New method definition.
1752 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
1753 Same.
1754 (Output_section::relax_input_section): Renamed to
1755 Output_section::convert_input_sections_to_relaxed_sections and change
1756 interface to take a vector of pointers to relaxed sections.
1757 (Output_section::find_merge_section,
1758 Output_section::find_relaxed_input_section): New method definitions.
1759 (Output_section::is_input_address_mapped,
1760 Output_section::output_offset, Output_section::output_address):
1761 Use output section data maps to speed up searching.
1762 (Output_section::find_starting_output_address): Add comments.
1763 (Output_section::do_write,
1764 Output_section::write_to_postprocessing_buffer): Do code-fill
1765 generation as appropriate.
1766 (Output_section::get_input_sections): Invalidate relaxed input section
1767 map.
1768 (Output_section::restore_states): Adjust type of checkpoint .
1769 Invalidate relaxed input section map.
1770 * output.h (Output_merge_base): New class declaration.
1771 (Input_section_specifier): New class defintion.
1772 (class Output_relaxed_input_section) Change base class to
1773 Output_section_data_build.
1774 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
1775 base class initializer.
1776 (Output_section::add_relaxed_input_section): New method declaration.
1777 (Output_section::Input_section): Change visibility to protected.
1778 (Output_section::Input_section::relobj,
1779 Output_section::Input_section::shndx): Handle relaxed input sections.
1780 Output_section::input_sections) Change visibility to protected. Also
1781 define overload to return a non-const pointer.
1782 (Output_section::Merge_section_properties): New class defintion.
1783 (Output_section::Merge_section_by_properties_map,
1784 Output_section::Output_section_data_by_input_section_map,
1785 Output_section::Relaxation_map): New types.
1786 (Output_section::relax_input_section): Rename method to
1787 Output_section::convert_input_sections_to_relaxed_sections and change
1788 interface to take a vector of relaxed section pointers.
1789 (Output_section::find_merge_section,
1790 Output_section::find_relaxed_input_section,
1791 Output_section::build_relaxation_map,
1792 Output_section::convert_input_sections_in_list_to_relaxed_sections):
1793 New method declarations.
1794 (Output_section::merge_section_map_
1795 Output_section::merge_section_by_properties_map_,
1796 Output_section::relaxed_input_section_map_,
1797 Output_section::is_relaxed_input_section_map_valid_,
1798 Output_section::generate_code_fills_at_write_): New data members.
1799 * script-sections.cc
1800 (Output_section_element_input::set_section_addresses): Call
1801 current_data_size and addralign methods of relaxed input sections.
1802 (Orphan_output_section::set_section_addresses): Call current_data_size
1803 and addralign methods of relaxed input sections.
1804 * symtab.cc (Symbol_table::compute_final_value): Extract template
1805 from the body of Symbol_table::sized_finalize_symbol.
1806 (Symbol_table::sized_finalized_symbol): Call
1807 Symbol_table::compute_final_value.
1808 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
1809 (Symbol_table::compute_final_value): New templated method declaration.
1810 * target.cc (Target::do_make_output_section): New method defintion.
1811 * target.h (Target::make_output_section): New method declaration.
1812 (Target::relax): Add more parameters for input objects, symbol table
1813 and layout. Adjust call to do_relax.
1814 (Target::do_make_output_section): New method declaration.
1815 (Target::do_relax): Add parameters for input objects, symbol table
1816 and layout.
1817
1818 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
1819
1820 * pread.c: Include stdio.h.
1821
1822 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
1823
1824 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
1825 defined.
1826
1827 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
1828
1829 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1830 Change read_shndx type to unsigned int.
1831 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
1832 int.
1833 (Sized_dwarf_line_info::read_line_mappings): Likewise.
1834 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
1835 Change read_shndx type to unsigned int.
1836 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
1837 int.
1838 (Sized_dwarf_line_info::read_line_mappings): Likewise.
1839 * layout.cc (Layout::create_symtab_sections): Cast the result of
1840 local_symcount * symsize to off_t in the gold_assert.
1841
1842 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1843
1844 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
1845 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
1846 R_ARM_BASE_ABS.
1847 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
1848 (Arm_relocate_functions::thm_abs5): New function.
1849 (Arm_relocate_functions::abs12): New function.
1850 (Arm_relocate_functions::abs16): New function.
1851 (Arm_relocate_functions::base_abs): New function.
1852 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
1853 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
1854 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
1855 R_ARM_BASE_ABS.
1856 (Scan::global): Likewise.
1857 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
1858 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
1859 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
1860 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
1861 R_ARM_BASE_ABS.
1862
1863 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1864
1865 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
1866 (Arm_relocate_functions::movt_prel): New function.
1867 (Arm_relocate_functions::thm_movw_prel_nc): New function.
1868 (Arm_relocate_functions::thm_movt_prel): New function.
1869 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
1870 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
1871 (Scan::global, Relocate::relocate): Likewise.
1872 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
1873
1874 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
1875
1876 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
1877 Incremental_checker.
1878 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
1879 unsigned int.
1880 (class Incremental_inputs_header): New class.
1881 (Incremental_inputs_header_writer): Edit comment.
1882 (Incremental_inputs_entry): New class.
1883 (Incremental_inputs_entry_writer): Edit comment.
1884 (Sized_incremental_binary::do_find_incremental_inputs_section):
1885 Add *strtab_shndx parameter, fill it.
1886 (Sized_incremental_binary::do_check_inputs): New method.
1887 (Incremental_checker::can_incrementally_link_output_file): Use
1888 Sized_incremental_binary::check_inputs.
1889 (Incremental_inputs::report_command_line): Save command line in
1890 command_line_.
1891 * incremental.h:
1892 (Incremental_binary::find_incremental_inputs_section): New
1893 method.
1894 (Incremental_binary::do_find_incremental_inputs_section): Add
1895 strtab_shndx parameter.
1896 (Incremental_binary::do_check_inputs): New pure virtual method.
1897 (Sized_incremental_binary::do_check_inputs): Declare.
1898 (Incremental_checker::Incremental_checker): Add incremental_inputs
1899 parameter, use it to initialize incremental_inputs_.
1900 (Incremental_checker::incremental_inputs_): New field.
1901 (Incremental_checker::command_line): New method.
1902 (Incremental_checker::inputs): New method.
1903 (Incremental_checker::command_line_): New field.
1904
1905 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
1906
1907 * incremental.cc: Include <cstdarg> and "target-select.h".
1908 (vexplain_no_incremental): New function.
1909 (explain_no_incremental): New function.
1910 (Incremental_binary::error): New method.
1911 (Sized_incremental_binary::do_find_incremental_inputs_section): New
1912 method.
1913 (make_sized_incremental_binary): New function.
1914 (open_incremental_binary): New function.
1915 (can_incrementally_link_file): Add checks if output is ELF and has
1916 inputs section.
1917 * incremental.h: Include "elfcpp_file.h" and "output.h".
1918 (Incremental_binary): New class.
1919 (Sized_incremental_binary): New class.
1920 (open_incremental_binary): Declare.
1921 * object.cc (is_elf_object): Use
1922 elfcpp::Elf_recognizer::is_elf_file.
1923 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
1924 * output.h (Output_file::filesize): New method.
1925
1926 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1927
1928 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
1929 New function.
1930 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
1931 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
1932 function.
1933 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
1934 function.
1935 (Arm_relocate_functions::movw_abs_nc): New function.
1936 (Arm_relocate_functions::movt_abs): New function.
1937 (Arm_relocate_functions::thm_movw_abs_nc): New function.
1938 (Arm_relocate_functions::thm_movt_abs): New function.
1939 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
1940 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
1941 (Scan::global): Likewise.
1942 (Relocate::relocate): Likewise.
1943 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
1944
1945 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1946
1947 * arm.cc (Arm_relocate_functions::got_prel) New function.
1948 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
1949 (Relocate::relocate): Likewise.
1950 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
1951
1952 2009-10-06 Ian Lance Taylor <iant@google.com>
1953
1954 * options.h (class General_options): Define
1955 split_stack_adjust_size parameter.
1956 * object.h (class Object): Add uses_split_stack_ and
1957 has_no_split_stack_ fields. Add uses_split_stack and
1958 has_no_split_stack accessor functions. Declare
1959 handle_split_stack_section.
1960 (class Reloc_symbol_changes): Define.
1961 (class Sized_relobj): Define Function_offsets. Declare
1962 split_stack_adjust, split_stack_adjust_reltype, and
1963 find_functions.
1964 * object.cc (Object::handle_split_stack_section): New function.
1965 (Sized_relobj::do_layout): Call handle_split_stack_section.
1966 * dynobj.cc (Sized_dynobj::do_layout): Call
1967 handle_split_stack_section.
1968 * reloc.cc (Sized_relobj::relocate_sections): Call
1969 split_stack_adjust for executable sections in split_stack
1970 objects. Pass reloc_map to relocate_section.
1971 (Sized_relobj::split_stack_adjust): New function.
1972 (Sized_relobj::split_stack_adjust_reltype): New function.
1973 (Sized_relobj::find_functions): New function.
1974 * target-reloc.h: Include "object.h".
1975 (relocate_section): Add reloc_symbol_changes parameter. Change
1976 all callers.
1977 * target.h (class Target): Add calls_non_split method. Declare
1978 do_calls_non_split virtual method. Declare match_view and
1979 set_view_to_nop.
1980 * target.cc: Include "elfcpp.h".
1981 (Target::do_calls_non_split): New function.
1982 (Target::match_view): New function.
1983 (Target::set_view_to_nop): New function.
1984 * gold.cc (queue_middle_tasks): Give an error if mixing
1985 split-stack and non-split-stack objects with -r.
1986 * i386.cc (Target_i386::relocate_section): Add
1987 reloc_symbol_changes parameter.
1988 (Target_i386::do_calls_non_split): New function.
1989 * x86_64.cc (Target_x86_64::relocate_section): Add
1990 reloc_symbol_changes parameter.
1991 (Target_x86_64::do_calls_non_split): New function.
1992 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
1993 parameter.
1994 * powerpc.cc (Target_powerpc::relocate_section): Add
1995 reloc_symbol_changes parameter.
1996 * sparc.cc (Target_sparc::relocate_section): Add
1997 reloc_symbol_changes parameter.
1998 * configure.ac: Call AM_CONDITIONAL for the default target.
1999 * configure: Rebuild.
2000 * testsuite/Makefile.am (TEST_AS): New variable.
2001 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
2002 (check_DATA): Add split_i386 and split_x86_64 files.
2003 (SPLIT_DEFSYMS): Define.
2004 (split_i386_[1234n].o): New targets.
2005 (split_i386_[124]): New targets.
2006 (split_i386_[1234r].stdout): New targets.
2007 (split_x86_64_[1234n].o): New targets.
2008 (split_x86_64_[124]): New targets.
2009 (split_x86_64_[1234r].stdout): New targets.
2010 (MOSTLYCLEANFILES): Add new executables.
2011 * testsuite/split_i386.sh: New file.
2012 * testsuite/split_x86_64.sh: New file.
2013 * testsuite/split_i386_1.s: New file.
2014 * testsuite/split_i386_2.s: New file.
2015 * testsuite/split_i386_3.s: New file.
2016 * testsuite/split_i386_4.s: New file.
2017 * testsuite/split_i386_n.s: New file.
2018 * testsuite/split_x86_64_1.s: New file.
2019 * testsuite/split_x86_64_2.s: New file.
2020 * testsuite/split_x86_64_3.s: New file.
2021 * testsuite/split_x86_64_4.s: New file.
2022 * testsuite/split_x86_64_n.s: New file.
2023 * testsuite/testfile.cc (Target_test): Update relocation_section
2024 function.
2025 * testsuite/Makefile.in: Rebuild.
2026
2027 2009-10-06 Ian Lance Taylor <iant@google.com>
2028
2029 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
2030 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
2031 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
2032 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
2033 the address on ldo_addrs_.
2034 (Target_i386::Relocate::fix_up_ldo): New function.
2035
2036 2009-10-06 Rafael Espindola <espindola@google.com>
2037
2038 * plugin.cc (add_input_library): New.
2039 (Plugin::load): Add add_input_library to tv.
2040 (Plugin_manager::add_input_file): Add the is_lib argument.
2041 (add_input_file): Update call to Plugin_manager::add_input_file.
2042 (add_input_library): New.
2043 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
2044
2045 2009-09-30 Doug Kwan <dougkwan@google.com>
2046
2047 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
2048 symbol and call Symbol::may_need_copy_reloc to determine if
2049 a copy reloc is needed.
2050 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
2051 nocopyreloc is given in command line.
2052 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
2053 given in command line.
2054 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
2055 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
2056 of the removed Target_i386::may_need_copy_reloc.
2057 * options.h (copyreloc): New option with default value false.
2058 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
2059 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
2060 instead of the removed Target_powerpc::may_need_copy_reloc.
2061 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
2062 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
2063 instead of the removed Target_sparc::may_need_copy_reloc.
2064 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
2065 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
2066 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
2067 instead of the removed Target_x86_64::may_need_copy_reloc.
2068
2069 2009-09-30 Ian Lance Taylor <iant@google.com>
2070
2071 * object.h (class Object): Remove target_ field, and target,
2072 sized_target, and set_target methods.
2073 (Object::sized_target): Remove.
2074 (class Sized_relobj): Update declarations. Remove sized_target.
2075 * object.cc (Sized_relobj::setup): Remove target parameter.
2076 Change all callers.
2077 (Input_objects::add_object): Don't do anything with the target.
2078 (make_elf_sized_object): Add punconfigured parameter. Change all
2079 callers. Set or test parameter target.
2080 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
2081 Change all callers.
2082 * parameters.cc (Parameters::set_target): Change parameter type to
2083 be non-const.
2084 (Parameters::default_target): Remove.
2085 (set_parameters_target): Change parameter type to be non-const.
2086 (parameters_force_valid_target): New function.
2087 (parameters_clear_target): New function.
2088 * parameters.h (class Parameters): Update declarations. Remove
2089 default_target method. Add sized_target and clear_target
2090 methods. Change target_ to be non-const.
2091 (set_parameters_target): Update declaration.
2092 (parameters_force_valid_target): Declare.
2093 (parameters_clear_target): Declare.
2094 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
2095 as NULL if we aren't searching.
2096 (Add_symbols::run): Don't check for compatible target.
2097 * fileread.cc (Input_file::open_binary): Call
2098 parameters_force_valid_target.
2099 * gold.cc (queue_middle_tasks): Likewise.
2100 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
2101 set_target on object.
2102 * dynobj.h (class Sized_dynobj): Update declarations.
2103 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
2104 make_elf_object returns NULL.
2105 (Archive::include_member): Don't check whether object target is
2106 compatible.
2107 * output.cc (Output_section::add_input_section): Get target from
2108 parameters.
2109 (Output_section::relax_input_section): Likewise.
2110 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
2111 parameters.
2112 (Sized_relobj::do_scan_relocs): Likewise.
2113 (Sized_relobj::relocate_sections): Likewise.
2114 * resolve.cc (Symbol_table::resolve): Likewise.
2115 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
2116 parameter. Change all callers.
2117 (Symbol_table::add_from_object): Get target from parameters.
2118 (Symbol_table::add_from_relobj): Don't check object target.
2119 (Symbol_table::add_from_dynobj): Likewise.
2120 (Symbol_table::define_special_symbol): Get target from
2121 parameters.
2122 * symtab.h (class Symbol_table): Update declaration.
2123 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
2124 parameter. Change all callers. Clear parameter target.
2125 (Binary_test): Test target here.
2126 * testsuite/object_unittest.cc (gold_testsuite): Remove
2127 target_test_pointer parameter. Change all callers.
2128 (Object_test): Test target here.
2129
2130 2009-09-26 Ian Lance Taylor <iant@google.com>
2131
2132 * testsuite/initpri1.c: Don't try to use constructor priorities if
2133 compiling with gcc before 4.3.
2134
2135 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
2136
2137 * testsuite/retain_symbols_file_test.sh (check_present): Change
2138 output file name to retain_symbols_file_test.stdout.
2139 (check_absent): Likewise.
2140
2141 2009-09-18 Craig Silverstein <csilvers@google.com>
2142
2143 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
2144 * options.cc: Include <cerrno> and <fstream>.
2145 (General_options::finalize): Parse -retain-symbols-file tag.
2146 * options.h: New flag.
2147 (General_options): New method should_retain_symbol, new
2148 variable symbols_to_retain.
2149 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
2150 should_retain_symbol map.
2151 * testsuite/Makefile.am (retain_symbols_file_test): New test.
2152 * testsuite/Makefile.in: Regenerate.
2153 * testsuite/retain_symbols_file_test.sh: New file.
2154
2155 2009-09-18 Nick Clifton <nickc@redhat.com>
2156
2157 * po/es.po: Updated Spanish translation.
2158
2159 2009-09-17 Doug Kwan <dougkwan@google.com>
2160
2161 * debug.h (DEBUG_RELAXATION): New constant.
2162 (DEBUG_ALL): Add DEBUG_RELAXATION.
2163 (debug_string_to_enum): Add relaxation debug option.
2164 * layout.cc
2165 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
2166 Layout::Relaxation_debug_check::read_sections,
2167 Layout::Relaxation_debug_check::read_sections): New method definitions.
2168 (Layout::Layout): Initialize data members
2169 record_output_section_data_from_scrips_,
2170 script_output_section_data_list_ and relaxation_debug_check_.
2171 (Layout::save_segments, Layout::restore_segments,
2172 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
2173 Layout::relaxation_loop_body): New method definitions.
2174 (Layout::finalize): Support relaxation. Move section layout code to
2175 Layout::relaxation_loop_body.
2176 (Layout::set_asection_address_from_script): Move code for orphan
2177 section placement out.
2178 (Layout::place_orphan_sections_in_script): New method definition.
2179 * layout.h (Output_segment_headers, Output_file_header):
2180 New forward class declarations.
2181 (Layout::~Layout): Define.
2182 (Layout::new_output_section_data_from_script): New method definition.
2183 (Layout::place_orphan_sections_in_script): New method declaration.
2184 (Layout::Segment_states): New type declaration.
2185 (Layout::save_segments, Layout::restore_segments,
2186 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
2187 Layout::relaxation_loop_body): New method declarations.
2188 (Layout::Output_section_data_list): New type declaration.
2189 (Layout::Relaxation_debug_check): New class definition.
2190 (Layout::record_output_section_data_from_script_,
2191 Layout::script_output_section_data_list_, Layout::segment_states_,
2192 Layout::relaxation_debug_check_): New data members.
2193 * output.cc: (Output_section_headers::do_size): New method definition.
2194 (Output_section_headers::Output_section_headers): Move size
2195 computation to Output_section_headers::do_size.
2196 (Output_segment_headers::do_size): New method definition.
2197 (Output_file_header::Output_file_header): Move size computation to
2198 Output_file_header::do_size and call it.
2199 (Output_file_header::do_size): New method definition.
2200 (Output_data_group::Output_data_group): Adjust call to
2201 Output_section_data.
2202 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
2203 (Output_symtab_xindex::do_write): Add array bound check.
2204 (Output_section::Input_section::print_to_mapfile): Handle
2205 RELAXED_INPUT_SECTION_CODE.
2206 (Output_section::Output_section): Initialize data member checkpoint_.
2207 (Output_section::~Output_section): Delete checkpoint object pointed
2208 by checkpoint_.
2209 (Output_section::add_input_section): Always add an Input_section if
2210 relaxing.
2211 (Output_section::add_merge_input_section): Add assert.
2212 (Output_section::relax_input_section): New method definition.
2213 (Output_section::set_final_data_size): Set load address to zero for
2214 an unallocated section.
2215 (Output_section::do_address_and_file_offset_have_reset_values):
2216 New method definition.
2217 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
2218 Handle relaxed input section.
2219 (Output_section::sort_attached_input_sections): Checkpoint input
2220 section list lazily.
2221 (Output_section::get_input_sections): Change type of input_sections to
2222 list of Simple_input_section pointers. Checkpoint input section list
2223 lazily. Also handle relaxed input sections.
2224 (Output_section::add_input_section_for_script): Take a reference to
2225 a Simple_input_section object instead of Relobj pointer and section
2226 index as parameter. Handle relaxed input sections.
2227 (Output_section::save_states, Output_section::restore_states): New
2228 method definitions.
2229 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
2230 (Output_data::is_data_size_fixed): New method definition.
2231 (Output_data::reset_addresss_and_file_offset): Do not reset data size
2232 if it is fixed.
2233 (Output_data::address_and_file_offset_have_reset_values): New method
2234 definition.
2235 (Output_data::do_address_and_file_offset_have_reset_values): New method
2236 definition.
2237 (Output_data::set_data_size): Check that data size is not fixed.
2238 (Output_data::fix_data_size): New method definition.
2239 (Output_data::is_data_size_fixed_): New data member.
2240 (Output_section_headers::set_final_data_size): New method definition.
2241 (Output_section_headers::do_size): New method declaration.
2242 (Output_segment_headers::set_final_data_size): New method definition.
2243 (Output_segment_headers::do_size): New method declaration.
2244 (Output_file_header::set_final_data_size)::New method definition.
2245 (Output_file_header::do_size)::New method declaration.
2246 (Output_section_data::Output_section_data): Add new parameter
2247 is_data_size_fixed and use it to fix data size.
2248 (Output_data_const::Output_data_const): Adjust call to base class
2249 constructor and fix data size.
2250 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
2251 base class constructor and fix data size.
2252 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
2253 base class constructor and fix data size.
2254 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
2255 class constructor and fix data size.
2256 (Output_data_group::set_final_data_size): New method definition.
2257 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
2258 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
2259 class constructor and fix data size.
2260 (Output_relaxed_input_section): New class definition.
2261 (Output_section::Simple_input_section): New class definition.
2262 (Output_section::get_input_sections): Adjust parameter list.
2263 (Output_section::add_input_section_for_script): Same.
2264 (Output_section::save_states, Output_section::restore_states,
2265 Output_section::do_address_and_file_offset_have_reset_values,
2266 (Output_section::Input_section::Input_section): Handle
2267 RELAXED_INPUT_SECTION_CODE. Add new overload for
2268 Output_relaxed_input_section.
2269 (Output_section::Input_section::is_input_section,
2270 Output_section::Input_section::set_output_section): Handle relaxed
2271 input section.
2272 (Output_section::Input_section::is_relaxed_input_section,
2273 Output_section::Input_section::output_section_data,
2274 Output_section::Input_section::relaxed_input_section): New method
2275 definitions.
2276 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
2277 value.
2278 (Output_section::Input_section::u1_): Update comments.
2279 (Output_section::Input_section::u2_): Add new union member poris.
2280 (Output_section::Checkpoint_output_section): New classs definition.
2281 (Output_section::relax_input_section): New method declaration.
2282 (Output_section::checkpoint_): New data member.
2283 (Output_segment): Update comments.
2284 (Output_segment::Output_segment): Un-privatize copy constructor.
2285 (Output_segment::operator=): Un-privatize.
2286 * script-sections.cc (Output_section_element::Input_section_list):
2287 Change element type to Output_section::Simple_input_section.
2288 (Output_section_element_dot_assignment::set_section_addresses):
2289 Register output section data for relaxation clean up.
2290 (Output_data_exression::Output_data_expression): Adjust call to base
2291 constructor to fix data size.
2292 (Output_section_element_data::set_section_addresses): Register
2293 Output_data_expression object for relaxation clean up.
2294 (struct Input_section_info): Replace Relobj pointer and section index
2295 pair with Output_section::Simple_input_section and Convert struct to a
2296 class.
2297 (Input_section_sorter::operator()): Adjust access to
2298 Input_section_info data member to use accessors.
2299 (Output_section_element_input::set_section_addresses): Use layout
2300 parameter. Adjust code to use Output_section::Simple_input_section
2301 and Input_secction_info classes. Register filler for relaxation
2302 clean up.
2303 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
2304 and section index pair with Output_section::Simple_input_section
2305 class. Adjust code accordingly.
2306 (Phdrs_element::release_segment): New method definition.
2307 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
2308 segment list.
2309 (Script_sections::release_segments): New method definition.
2310 * gold/script-sections.h (Script_sections::release_segments): New
2311 method declaration.
2312 * gold/target.h (Target::may_relax, Target::relax,
2313 Target::do_may_relax, Target::do_relax): New method definitions.
2314
2315 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2316
2317 * arm.cc (has_signed_unsigned_overflow): New function.
2318 (Arm_relocate_functions::abs8): New function.
2319 (Target_arm::Scan::local): Handle R_ARM_ABS8.
2320 (Target_arm::Scan::global): Likewise.
2321 (Target_arm::relocate::relocate): Likewise.
2322 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
2323 Likewise.
2324
2325 2009-09-16 Cary Coutant <ccoutant@google.com>
2326
2327 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
2328 * testsuite/Makefile.in: Regenerate.
2329
2330 2009-09-11 Nick Clifton <nickc@redhat.com>
2331
2332 * po/gold.pot: Updated by the Translation project.
2333
2334 2009-09-08 Cary Coutant <ccoutant@google.com>
2335
2336 * output.cc (Output_file::open): Add execute permission to empty file.
2337 * testsuite/Makefile.am (permission_test): New test.
2338 * testsuite/Makefile.in: Regenerate.
2339
2340 2009-09-02 Ian Lance Taylor <iant@google.com>
2341
2342 * output.cc (Output_file::resize): Call map_no_anonymous rather
2343 than map.
2344
2345 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
2346
2347 * gold.cc: Include "incremental.h".
2348 (queue_initial_tasks): Call Incremental_checker methods.
2349 * incremental.cc: Include "output.h".
2350 (Incremental_checker::can_incrementally_link_output_file): New
2351 method.
2352 * incremental.h (Incremental_checker): New class.
2353
2354 * output.cc (Output_file::open_for_modification): New method.
2355 (Output_file::map_anonymous): Changed return type to bool. Record
2356 map in base_ field.
2357 (Output_file::map_no_anonymous): New method, broken out of map.
2358 (Output_file::map): Use map_no_anonymous and map_anonymous.
2359 * output.h (class Output_file): Update declarations.
2360
2361 2009-08-24 Cary Coutant <ccoutant@google.com>
2362
2363 * options.h (Command_line::Pre_options): New class.
2364 (Command_line::pre_options): New member.
2365 * options.cc (gold::options::ready_to_register): New variable.
2366 (One_option::register_option): Do nothing if not registering options.
2367 Assert if same short option registered twice.
2368 (General_options::General_options): Turn off option registration when
2369 done constructing.
2370 (Command_line::Pre_options::Pre_options): New constructor.
2371
2372 2009-08-24 Cary Coutant <ccoutant@google.com>
2373
2374 * options.h (General_options::no_keep_memory): Remove incorrect
2375 short option.
2376
2377 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2378
2379 * Makefile.am (am__skiplex, am__skipyacc): New.
2380 * Makefile.in: Regenerate.
2381
2382 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2383
2384 * Makefile.am (AM_CPPFLAGS): Renamed from ...
2385 (INCLUDES): ... this.
2386 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
2387 (AM_CPPFLAGS): Renamed from ...
2388 (INCLUDE): ... this.
2389 * Makefile.in, testsuite/Makefile.in: Regenerate.
2390
2391 * Makefile.in: Regenerate.
2392 * aclocal.m4: Likewise.
2393 * config.in: Likewise.
2394 * configure: Likewise.
2395 * testsuite/Makefile.in: Likewise.
2396
2397 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
2398 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
2399 * Makefile.in: Regenerate.
2400 * testsuite/Makefile.in: Regenerate.
2401
2402 2009-08-19 Cary Coutant <ccoutant@google.com>
2403
2404 * resolve.cc (Symbol_table::resolve): Don't complain about defined
2405 symbols in shared libraries overridden by hidden or internal symbols
2406 in the main program.
2407
2408 2009-08-19 Chris Demetriou <cgd@google.com>
2409
2410 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
2411 checking source file names in error messages.
2412
2413 2009-08-18 Doug Kwan <dougkwan@google.com>
2414
2415 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
2416 an elcpp::Ehdr as parameter. Adjust call to set_target.
2417 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
2418 an elfcpp::Ehdr as parameter.
2419 * object.cc (Object::set_target): Remove the version that looks up
2420 a target and sets it.
2421 (Sized_relobj::setup): Take a Target object instead of
2422 an elfcpp::Ehdr as parameter. Adjust call to set_target.
2423 (make_elf_sized_object): Find target and ask target to
2424 make an ELF object.
2425 * object.h: (Object::set_target): Remove the version that looks up
2426 a target and sets it.
2427 (Sized_relobj::setup): Take a Target object instead of
2428 an elfcpp:Ehdr as parameter.
2429 * target.cc: Include dynobj.h.
2430 (Target::do_make_elf_object_implementation): New.
2431 (Target::do_make_elf_object): New.
2432 * target.h (Target::make_elf_object): New template declaration.
2433 (Target::do_make_elf_object): New method declarations.
2434 (Target::do_make_elf_object_implementation): New template declaration.
2435
2436 2009-08-14 Ian Lance Taylor <iant@google.com>
2437
2438 * gold.h (FUNCTION_NAME): Define.
2439 (gold_unreachable): Use FUNCTION_NAME.
2440
2441 2009-08-12 Sriraman Tallam <tmsriram@google.com>
2442
2443 * icf.cc (Icf::find_identical_sections): Issue a warning when a
2444 symbol in the --keep-unique list is not found.
2445
2446 2009-08-12 Sriraman Tallam <tmsriram@google.com>
2447
2448 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
2449 been maked as --keep-unique.
2450 (Icf::unfold_section): New function.
2451 * icf.h (Icf::unfold_section): New function.
2452 * options.h (General_options::keep_unique): New option.
2453 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
2454 * testsuite/Makefile.in: Regenerate.
2455 * testsuite/icf_keep_unique_test.sh: New file.
2456 * testsuite/icf_keep_unique_test.cc: New file.
2457
2458 2009-08-12 Cary Coutant <ccoutant@google.com>
2459
2460 PR 10471
2461 * resolve.cc (Symbol_table::resolve): Check for references from
2462 dynamic objects to hidden and internal symbols.
2463 * testsuite/Makefile.am (hidden_test.sh): New test.
2464 * testsuite/Makefile.in: Regenerate.
2465 * testsuite/hidden_test.sh: New script.
2466 * testsuite/hidden_test_1.c: New test source.
2467 * testsuite/hidden_test_main.c: New test source.
2468
2469 2009-08-11 Doug Kwan <dougkwan@google.com>
2470
2471 * arm.cc: Update comments.
2472 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
2473 segment to locate the .ARM.exidx section if present.
2474
2475 2009-08-09 Doug Kwan <dougkwan@google.com>
2476
2477 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
2478 patch.
2479
2480 2009-08-07 Sriraman Tallam <tmsriram@google.com>
2481 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
2482 compiler warnings.
2483
2484 2009-08-06 Sriraman Tallam <tmsriram@google.com>
2485
2486 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
2487 valid tls_segment only for non-debug-section relocations.
2488 * testsuite/Makefile.am: Add gc_tls_test.
2489 * testsuite/Makefile.in: Regenerate.
2490 * testsuite/gc_tls_test.cc: New file.
2491 * testsuite/gc_tls_test.sh: New file.
2492
2493 2009-08-05 Sriraman Tallam <tmsriram@google.com>
2494
2495 * icf.cc: New file.
2496 * icf.h: New file.
2497 * Makefile.am (CCFILES): Add icf.cc.
2498 (HFILES): Add icf.h
2499 * Makefile.in: Regenerate.
2500 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
2501 * gc.h (gc_process_relocs): Populate lists used by icf to contain
2502 section, symbol and addend information for the relocs.
2503 * gold.cc (queue_middle_tasks): Call identical code folding.
2504 * gold.h: Add defines for multimap.
2505 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
2506 to the call of finalize_local_symbols.
2507 * main.cc (main): Create object of class Icf.
2508 * object.cc (Sized_relobj::do_layout): Allow this function to be
2509 called twice during icf.
2510 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
2511 to sections marked as identical by icf.
2512 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
2513 when available.
2514 (Sized_relobj::do_section_entsize): New function.
2515 * object.h (Object::section_entsize): New function.
2516 (Object::do_section_entsize): New pure virtual function.
2517 (Relobj::finalize_local_symbols): Add new parameter.
2518 (Relobj::do_section_entsize): New function.
2519 * options.h (General_options::icf): New option.
2520 (General_options::icf_iterations): New option.
2521 (General_options::print_icf_sections): New option.
2522 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
2523 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
2524 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
2525 icf.
2526 * symtab.cc (Symbol_table::is_section_folded): New function.
2527 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
2528 to sections marked as identical by icf.
2529 * symtab.h (Symbol_table::set_icf): New function.
2530 (Symbol_table::icf): New function.
2531 (Symbol_table::is_section_folded): New function.
2532 (Symbol_table::icf_): New data member.
2533 * target-reloc.h (relocate_section): Ignore sections folded by icf.
2534 * testsuite/Makefile.am: Add commands to build icf_test.
2535 * testsuite/Makefile.in: Regenerate.
2536 * testsuite/icf_test.sh: New file.
2537 * testsuite/icf_test.cc: New file.
2538
2539 2009-07-24 Chris Demetriou <cgd@google.com>
2540
2541 * layout.cc (is_compressible_debug_section): Fix incorrect
2542 comment about compressed section names.
2543
2544 2009-07-20 Ian Lance Taylor <ian@airs.com>
2545
2546 PR 10419
2547 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
2548
2549 2009-07-16 Ian Lance Taylor <iant@google.com>
2550
2551 PR 10400
2552 * layout.h: #include <map>.
2553 (class Kept_section): Change from struct to class. Add accessors
2554 and setters. Add section size to Comdat_group mapping. Change
2555 Comdat_group to std::map. Add is_comdat_ field. Add
2556 linkonce_size field in union.
2557 (class Layout): Update declaration of find_or_add_kept_section.
2558 Don't declare find_kept_object.
2559 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
2560 parameter. Add object, shndx, is_comdat, and is_group_name
2561 parameters. Change all callers. Adjust for new Kept_section.
2562 (Layout::find_kept_object): Remove.
2563 * object.cc (Sized_relobj::include_section_group): Update use of
2564 Kept_section. Rename secnum to shndx. Only record
2565 Kept_comdat_section if sections are the same size.
2566 (Sized_relobj::include_linkonce_section): Update use of
2567 Kept_section. Only record Kept_comdat_section if sections are the
2568 same size. Set size of linkonce section.
2569 (Sized_relobj::map_to_kept_section): Update call to
2570 get_kept_comdat_section.
2571 * object.h (class Sized_relobj): Rename fields in
2572 Kept_comdat_section to drop trailing underscores; change object
2573 field to Relobj*. Change Kept_comdat_section_table to store
2574 struct rather than pointer.
2575 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
2576 Add kept_object and kept_shndx parameters. Change all callers.
2577 (Sized_relobj::get_kept_comdat_section): Change return type to
2578 bool. Add kept_object and kept_shndx parameters. Change all
2579 callers.
2580 * plugin.cc (Pluginobj::include_comdat_group): Update call to
2581 Layout::find_or_add_kept_section.
2582
2583 2009-07-09 Ian Lance Taylor <iant@google.com>
2584
2585 * merge.cc (Object_merge_map::initialize_input_to_output_map):
2586 Reserve space in the hash table.
2587
2588 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
2589
2590 * fileread.cc (File_read::get_mtime): New method.
2591 * fileread.h (Timespec): New structure.
2592 (File_read::get_mtime): New method.
2593 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
2594 Renamed from timestamp_nsec.
2595 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
2596 Elf_Xword.
2597 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
2598 timestamp_nsec.
2599 (Incremental_inputs::report_archive): Save mtime; style fix.
2600 (Incremental_inputs::report_obejct): Save mtime; style fix.
2601 (Incremental_inputs::report_script): Save mtime; style fix.
2602 (Incremental_inputs::finalize_inputs): Style fix.
2603 (Incremental_inputs::finalize): Style fix.
2604 (Incremental_inputs::create_input_section_data): Store inputs
2605 mtime.
2606 * incremental.h (Incremental_inputs::report_script): Add mtime
2607 argument.
2608 (Incremental_inputs::Input_info::Input_info): Intialize only one
2609 union member.
2610 (Incremental_inputs::Input_info::archive): Move to nameless
2611 union.
2612 (Incremental_inputs::Input_info::obejct): Move to nameless union.
2613 (Incremental_inputs::Input_info::script): Move to nameless union.
2614 (Incremental_inputs::mtime): New field.
2615 * script.cc (read_input_script): Pass file mtime to
2616 Incremental_input.
2617 * script.h (Script_info::inputs): Style fix.
2618
2619 2009-07-01 Ian Lance Taylor <ian@airs.com>
2620
2621 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
2622 instead of 32.
2623
2624 2009-06-24 Ian Lance Taylor <iant@google.com>
2625
2626 PR 10156
2627 * layout.cc (Layout::choose_output_section): If we find an
2628 existing section, update the flags.
2629 (Layout::create_notes): New function, broken out of
2630 Layout::finalize.
2631 (Layout::finalize): Don't create note sections.
2632 (Layout::create_note): Don't crash if linker script discards
2633 section.
2634 (Layout::create_gold_note): Likewise.
2635 (Layout::create_build_id): Likewise. Don't set
2636 after_input_sections on the section.
2637 (Layout::create_executable_stack_info): Remove target parameter.
2638 Change caller.
2639 * layout.h (class Layout): Declare create_notes. Update
2640 declaration of create_executable_stack_info.
2641 * gold.cc (queue_middle_tasks): Call create_notes.
2642 * output.cc (Output_section::update_flags_for_input_section): Move
2643 here from output.h. If SHF_ALLOC flag is newly set, mark address
2644 invalid.
2645 * output.h (Output_data::mark_address_invalid): New function.
2646 (class Output_section): Only declare, not define,
2647 update_flags_for_input_section. Remove set_flags.
2648
2649 2009-06-24 Ian Lance Taylor <iant@google.com>
2650
2651 * script-sections.cc (Output_section_definition::
2652 set_section_addresses): Rename shadowing local load_address to
2653 laddr.
2654
2655 2009-06-24 Ian Lance Taylor <iant@google.com>
2656
2657 PR 10244
2658 * reloc.cc (relocate_sections): Skip empty relocation sections.
2659
2660 2009-06-23 Ian Lance Taylor <iant@google.com>
2661
2662 PR 10156
2663 * layout.cc (Layout::create_note): Use choose_output_section
2664 rather than make_output_section.
2665
2666 2009-06-23 Ian Lance Taylor <iant@google.com>
2667
2668 PR 10237
2669 * options.cc (General_options::parse_V): Set printed_version_.
2670 (General_options::General_options): Initialize printed_version_.
2671 * options.h (class General_options): Add printed_version_ field.
2672 * gold.cc (queue_initial_tasks): If there are no input files,
2673 don't give a fatal error if we printed the version information.
2674 (queue_middle_tasks): If using -r with a shared object, give a
2675 fatal error rather than an ordinary error.
2676
2677 2009-06-23 Ian Lance Taylor <iant@google.com>
2678
2679 PR 10219
2680 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
2681 (Layout::make_output_section): Set have_stabstr_section_ if we see
2682 a .stab*str section.
2683 (Layout::finalize): Call link_stabs_sections.
2684 (Layout::link_stabs_sections): New file.
2685 * layout.h (class Layout): Add have_stabstr_section_ field.
2686 Declare link_stabs_sections.
2687
2688 2009-06-23 Doug Kwan <dougkwan@google.com>
2689
2690 * Makefile.am (libgold_a_LIBADD): New.
2691 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
2692 * Makefile.in: Regenerate.
2693 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
2694 * configure: Regenerate.
2695 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
2696 * fileread.cc: Include sys/state.h
2697 * gold.h: Declare memmem and strndup if found missing.
2698 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
2699
2700 2009-06-23 Ian Lance Taylor <iant@google.com>
2701
2702 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
2703 * configure: Rebuild.
2704
2705 2009-06-23 Ian Lance Taylor <iant@google.com>
2706
2707 PR 10147
2708 * object.cc (Object::section_contents): Don't try to get a view if
2709 the section has length zero.
2710 (Object::handle_gnu_warning_section): If the section is empty, use
2711 the name of the section as the warning.
2712
2713 2009-06-23 Ian Lance Taylor <iant@google.com>
2714
2715 PR 10133
2716 * stringpool.h (class Stringpool_template): Add optimize_ field.
2717 (Stringpool_template::set_optimize): New function.
2718 * stringpool.cc (Stringpool_template::Stringpool_template):
2719 Initialize optimize_ field.
2720 (Stringpool_template::set_string_offsets): Test local optimize
2721 fild rather than parameter.
2722 * layout.cc (Layout::Layout): Call set_optimize on the section
2723 name stringpool.
2724
2725 2009-06-22 Ian Lance Taylor <iant@google.com>
2726
2727 PR 10030
2728 * yyscript.y: Parse TARGET.
2729 * script.cc (script_set_target): New function.
2730 * script-c.h (script_set_target): Declare.
2731 * options.cc (General_options::string_to_object_format): Rename
2732 from string_to_object_format in anonymous namespace. Change
2733 callers.
2734 * options.h (class General_options): Declare
2735 string_to_object_format.
2736
2737 2009-06-22 Ian Lance Taylor <iant@google.com>
2738
2739 * script-sections.cc (Script_sections::create_segments): Don't put
2740 program headers in a PT_LOAD segment if -n or -N.
2741
2742 2009-06-22 Ian Lance Taylor <iant@google.com>
2743
2744 PR 10141
2745 * options.h (class General_options): Add -z lazy and -z now. Sort
2746 -z options into alphabetical order.
2747 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
2748
2749 2009-06-21 Ian Lance Taylor <iant@google.com>
2750
2751 * layout.cc (Layout::make_output_section): Call
2752 Target::new_output_section.
2753 (Layout::attach_allocated_section_to_segment): Put large section
2754 sections in a separate load segment with the large segment flag
2755 set.
2756 (Layout::segment_precedes): Sort large data segments after other
2757 load segments.
2758 (align_file_offset): New static function.
2759 (Layout::set_segment_offsets): Use align_file_offset.
2760 * output.h (class Output_section): Add is_small_section_ and
2761 is_large_section_ fields.
2762 (Output_section::is_small_section): New function.
2763 (Output_section::set_is_small_section): New function.
2764 (Output_section::is_large_section): New function.
2765 (Output_section::set_is_large_section): New function.
2766 (Output_section::is_large_data_section): New function.
2767 (class Output_segment): Add is_large_data_segment_ field.
2768 (Output_segment::is_large_data_segment): New function.
2769 (Output_segment::set_is_large_data_segment): New function.
2770 * output.cc (Output_section::Output_section): Initialize new
2771 fields.
2772 (Output_segment::Output_segment): Likewise.
2773 (Output_segment::add_output_section): Add assertion that large
2774 data sections always go in large data segments. Force small data
2775 sections to the end of the list of data sections. Force small BSS
2776 sections to the start of the list of BSS sections. For large BSS
2777 sections to the end of the list of BSS sections.
2778 * symtab.h (class Symbol): Declare is_common_shndx.
2779 (Symbol::is_defined): Check Symbol::is_common_shndx.
2780 (Symbol::is_common): Likewise.
2781 (class Symbol_table): Define enum Commons_section_type. Update
2782 declarations. Add small_commons_ and large_commons_ fields.
2783 * symtab.cc (Symbol::is_common_shndx): New function.
2784 (Symbol_table::Symbol_table): Initialize new fields.
2785 (Symbol_table::add_from_object): Put small and large common
2786 symbols in the right list.
2787 (Symbol_table::sized_finalized_symbol): Check
2788 Symbol::is_common_shndx.
2789 (Symbol_table::sized_write_globals): Likewise.
2790 * common.cc (Symbol_table::do_allocate_commons): Allocate new
2791 common symbol lists. Don't call do_allocate_commons_list if the
2792 list is empty.
2793 (Symbol_table::do_allocate_commons_list): Remove is_tls
2794 parameter. Add comons_section_type parameter. Change all
2795 callers. Handle small and large common symbols.
2796 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
2797 Symbol::is_common_shndx.
2798 * resolve.cc (symbol_to_bits): Likewise.
2799 * target.h (Target::small_common_shndx): New function.
2800 (Target::small_common_section_flags): New function.
2801 (Target::large_common_shndx): New function.
2802 (Target::large_common_section_flags): New function.
2803 (Target::new_output_section): New function.
2804 (Target::Target_info): Add small_common_shndx, large_common_shndx,
2805 small_common_section_flags, and large_common_section_flags
2806 fields.
2807 (Target::do_new_output_section): New virtual function.
2808 * arm.cc (Target_arm::arm_info): Initialize new fields.
2809 * i386.cc (Target_i386::i386_info): Likewise.
2810 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2811 Likewise.
2812 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
2813 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2814 (Target_x86_64::do_new_output_section): New function.
2815 * configure.ac: Define conditional MCMODEL_MEDIUM.
2816 * testsuite/Makefile.am (check_PROGRAMS): Add large.
2817 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
2818 (large_LDFLAGS): Define.
2819 * testsuite/large.c: New file.
2820 * testsuite/testfile.cc (Target_test::test_target_info):
2821 Initialize new fields.
2822 * configure, testsuite/Makefile.in: Rebuild.
2823
2824 2009-06-05 Doug Kwan <dougkwan@google.com>
2825
2826 * Makefile.am (CCFILES): Add target.cc.
2827 * Makefile.in: Regenerate.
2828 * i386.cc (class Target_i386): Define new virtual method to
2829 override do_is_local_label_name in parent.
2830 * object.cc (Sized_relobj::do_count_local_symbols): Discard
2831 local symbols if --discard-locals or -X is given.
2832 * options.h (class General_options): Declare new options
2833 '--discard-locals' and '-X' for discarding locals.
2834 * target.h (class Target): Define new methods is_local_label_name.
2835 Declare new virtual method do_is_local_label_name.
2836 * target.cc: New file.
2837 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
2838 (check_SCRIPTS): Add discard_locals_test.sh.
2839 (check_DATA): Add discard_local_tests.syms.
2840 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
2841 (discard_local_tests.syms, discard_locals_test.o): New make rules.
2842 * testsuite/Makefile.in: Regenerate.
2843 * testsuite/discard_locals_test.c: New file.
2844 * testsuite/discard_locals_test.sh: Same.
2845
2846 2009-06-05 Doug Kwan <dougkwan@google.com>
2847
2848 * object.cc (Sized_relobj::Sized_relobj): Initialize
2849 discarded_eh_frame_shndx_ to -1U.
2850 (Sized_relobj::do_layout): Record index of a discard .eh_frame
2851 section.
2852 (Sized_relobj::do_count_local_symbols): Skip local symbols in
2853 a discarded .eh_frame section.
2854 (Sized_relobj::do_finalize_local_symbols): Ditto.
2855 * object.h (class Sized_relobj): Declare new member
2856 discarded_eh_frame_shndx_.
2857 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
2858 (local_labels_test.o, local_labels_test): New rules.
2859 * testsuite/Makefile.in: Regenerate.
2860
2861 2009-06-04 Doug Kwan <dougkwan@google.com>
2862
2863 * layout.cc (Layout::section_name_mapping): Add mapping for
2864 special ARM sections.
2865
2866 2009-06-03 Doug Kwan <dougkwan@google.com>
2867
2868 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
2869 (utils::has_overflow): Same.
2870
2871 2009-06-03 Ian Lance Taylor <iant@google.com>
2872
2873 * layout.cc (Layout::section_name_mapping): New array, replacing
2874 Layout::linkonce_mapping.
2875 (Layout::section_name_mapping_count): New variable, replacing
2876 Layout::linkonce_mapping_count.
2877 (Layout::linkonce_output_name): Remove.
2878 (Layout::output_section_name): Rewrite.
2879 * layout.h (class Layout): Rename Linkonce_mapping to
2880 Section_name_mapping, linkonce_mapping to section_name_mapping,
2881 linkonce_mapping_count to section_name_mapping_count. Don't
2882 declare linkonce_output_name.
2883
2884 2009-06-03 Doug Kwan <dougkwan@google.com>
2885
2886 * gold/arm.cc (namespace utils): New.
2887 (Target_arm::reloc_is_non_pic): Define new method.
2888 (class Arm_relocate_functions): New.
2889 (Target_arm::Relocate::relocate): Handle relocation types used by
2890 Android.
2891
2892 2009-06-03 Ian Lance Taylor <iant@google.com>
2893
2894 * arm.cc (Target_arm::scan::global): Use || instead of |.
2895
2896 2009-06-02 Doug Kwan <dougkwan@google.com>
2897
2898 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
2899 issued_non_pic_error_.
2900 (class Target_arm::Scan): Declare new method check_non_pic.
2901 Define new method symbol_needs_plt_entry.
2902 Declare new data member issued_non_pic_error_.
2903 (class Target_arm::Relocate): Declare new method
2904 should_apply_static_reloc.
2905 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
2906 (Target_arm::Scan::check_non_pic): Define new method.
2907 (Target_arm::Scan::local): Handle a small subset of reloc types used
2908 by Android.
2909 (Target_arm::Scan::local): Same.
2910 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
2911
2912 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
2913
2914 * incremental.cc (Incremental_inputs::report_command_line): Filter
2915 out --incremental-* options.
2916
2917 2009-05-29 Doug Kwan <dougkwan@google.com>
2918
2919 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
2920 template class.
2921 (class Target_arm): Update comment.
2922 (Target_arm::Target_arm): Initialize new data members GOT_,
2923 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
2924 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
2925 and Target_arm::rel_dyn_section.
2926 Declare new_enum Target_arm::Got_type.
2927 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
2928 and DYNBSS_.
2929 Update commments for member do_dynsym_value.
2930 (Target_arm::got_size, Target_arm::plt_section,
2931 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
2932 new methods inside class defintion.
2933 (Target_arm::got_section): Define new method.
2934 (Target_arm::rel_dyn_section): Same.
2935 (Output_data_plt_arm): New template class.
2936 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
2937 (Output_data_plt_arm:do_adjust_output_section): Define new method.
2938 (Output_data_plt_arm::add_entry): Same.
2939 (Output_data_plt_arm::first_plt_entry): Define new
2940 static data member for PLT instruction template.
2941 (Output_data_plt_arm::plt_entry): Same.
2942 (Output_data_plt_arm::do_write): Define new method.
2943 (Target_arm::make_plt_entry): Same.
2944 (Target_arm::do_finalize_sections): Same.
2945 (Target_arm::do_dynsym_value): Same.
2946
2947 2009-05-28 Doug Kwan <dougkwan@google.com>
2948
2949 * Makefile.am (TARGETSOURCES): Add arm.cc.
2950 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
2951 * Makefile.in: Regenerate.
2952 * arm.cc: New file.
2953 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
2954
2955 2009-05-26 Doug Kwan <dougkwan@google.com>
2956
2957 * options.cc (General_options::parse_exclude_libs). Fix a comment.
2958 (General_options::check_excluded_libs): Strip off directories in
2959 archive name before matching like GNU ld does.
2960 * testsuite/Makefile.am (MOSTLYCLEANFILES,
2961 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
2962 (exclude_libs_test_LDFLAGS): Add linker option
2963 -Wl,--exclude-libs,libexclude_libs_test_3
2964 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
2965 an explicit archive without using -l.
2966 (alt/libexclude_libs_test_3.a): New make rule.
2967 * testsuite/Makefile.in: Regenerate.
2968 * testsuite/exclude_libs_test.c : Declare lib3_default().
2969 (main): Call it.
2970 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
2971 * exclude_libs_test_3.c: New file.
2972
2973 2009-05-26 Nick Clifton <nickc@redhat.com>
2974
2975 * po/id.po: New Indonesian translation.
2976 * po/gold.pot: Updated template file.
2977
2978 2009-05-22 Sriraman Tallam <tmsriram@google.com>
2979
2980 * testsuite/Makefile.am: Add -ffunction-sections to compile
2981 gc_comdat_test files. Add -Wl,--gc-sections to build
2982 gc_comdat_test.
2983 * testsuite/Makefile.in: Regenerate.
2984 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
2985
2986 2009-05-21 Sriraman Tallam <tmsriram@google.com>
2987
2988 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
2989 kept comdat section was garbage collected.
2990 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
2991 * testsuite/Makefile.in: Regenerate.
2992 * testsuite/gc_comdat_test.sh: New file.
2993 * testsuite/gc_comdat_test_1.cc: New file.
2994 * testsuite/gc_comdat_test_2.cc: New file.
2995
2996 2009-05-19 Doug Kwan <dougkwan@google.com>
2997
2998 * archive.cc (Archive::Archive): Move constructor from archive.h
2999 to here. Initialize no_export_.
3000 (Archive::get_elf_object_for_member): Set no_export flag of object.
3001 * archive.h (Archive::Archive): Move constructor body to
3002 archive.cc.
3003 (Archive::no_export): New method.
3004 (Archive::no_export_): New field.
3005 * object.h (Object::Object): Initialize no_export_ to false.
3006 (Object::no_export, Object::set_no_export): New methods.
3007 (Object::no_export_): New field.
3008 * options.cc (General_options::parse_exclude_libs): New method.
3009 (General_options::check_excluded_libs) Same.
3010 * options.h (exclude_libs): New option.
3011 (General_options::check_excluded_libs): New method declaration.
3012 (General_options::excluded_libs_): New field.
3013 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
3014 default or protected visibility if an object has no-export flag set.
3015 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
3016 (check_SCRIPTS): Add exclude_libs_test.sh.
3017 (check_DATA): Add exclude_libs_test.syms.
3018 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
3019 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
3020 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
3021 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
3022 (exclude_libs_test.syms, libexclude_libs_test_1.a,
3023 libexclude_libs_test_2.a): New rules.
3024 * testsuite/Makefile.in: Regenerate.
3025 * testsuite/exclude_libs_test.c: New file.
3026 * testsuite/exclude_libs_test.sh: Ditto.
3027 * testsuite/exclude_libs_test_1.c: Ditto.
3028 * testsuite/exclude_libs_test_2.c: Ditto.
3029
3030 2009-05-15 Ian Lance Taylor <iant@google.com>
3031
3032 * configure.ac: Check for declarations for cases where libiberty.h
3033 checks HAVE_DECL_xxx.
3034 * configure, config.in: Rebuild.
3035
3036 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
3037
3038 * gold.h (Incremental_argument_list): Remove (invalid) forward
3039 declaration.
3040 * incremental.cc (Incremental_inputs::report_achive): New method.
3041 (Incremental_inputs::report_object): New method.
3042 (Incremental_inputs::report_script): New method.
3043 (Incremental_inputs::finalize_inputs): New method.
3044 (Incremental_inputs::finalize): Call finalize_inputs().
3045 (Incremental_inputs::sized_create_incremental_inputs_section_data):
3046 Create inputs entries.
3047 * incremental.h (Incremental_input_type): New enum.
3048 (Incremental_inputs::Incremental_input): Initialize new fields.
3049 (Incremental_inputs::report_inputs): New method.
3050 (Incremental_inputs::report_achive): New method.
3051 (Incremental_inputs::report_object): New method.
3052 (Incremental_inputs::report_script): New method.
3053 (Incremental_inputs::finalize_inputs): New method.
3054 (Incremental_inputs::Input_info): New struct.
3055 (Incremental_inputs::Input_info_map): New typedef.
3056 (Incremental_inputs::lock_): New field.
3057 (Incremental_inputs::Inputs_): New field.
3058 (Incremental_inputs::Inputs_map): New field.
3059 * main.cc (main): Call Incremental_input::report_inputs.
3060 * options.h (Input_argument_list): Typedef moved from
3061 Input_arguments.
3062 (Input_file_group::Files): Remove, use ::Input_argument_list.
3063 (Input_file_group::Input_argument_list): Remove, use
3064 ::Input_argument_list.
3065 * plugin.cc (Plugin_manager::add_input_file): Add error in
3066 incremental build.
3067 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
3068 functions.
3069 * script.cc (read_input_script): Call
3070 Incremental_input::report_script.
3071 * script.h (Script_info): New class.
3072
3073 2009-04-27 Ian Lance Taylor <iant@google.com>
3074
3075 * x86_64.cc (do_adjust_output_section): Set entsize to
3076 plt_entry_size.
3077
3078 2009-04-23 Elliott Hughes <enh@google.com>
3079
3080 * output.cc (Output_file::close): After short writes, continue
3081 writing from the correct offset in the buffer being written.
3082
3083 2009-04-23 Chris Demetriou <cgd@google.com>
3084
3085 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
3086 * configure: Regenerate.
3087 * config.in: Regenerate.
3088 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
3089 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
3090
3091 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
3092
3093 * incremental.cc (Incremental_inputs_header_data): Renamed from
3094 Incremental_input_header_data.
3095 (Incremental_inputs_header_data::data_size): New field.
3096 (Incremental_inputs_header_data::put_input_file_count): Renamed
3097 from input_file_count.
3098 (Incremental_inputs_header_data::put_command_line_offset): Renamed
3099 from command_line_offset.
3100 (Incremental_inputs_header_data::put_reserved): Renamed from
3101 put_reserved.
3102 (Incremental_inputs_entry_data): Renamed from
3103 Incremental_input_entry_data.
3104 (Incremental_inputs_entry_data::data_size): New field.
3105 (Incremental_inputs::report_command_line): New method.
3106 (Incremental_inputs::finalize): New method.
3107 (Incremental_inputs::create_incremental_inputs_data): New method.
3108 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
3109 * incremental.h: New file.
3110 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
3111 (Layout::finalize): Create incremental inputs section in
3112 incremental builds.
3113 (Layout::create_incremental_info_sections): New method.
3114 * layout.h (Layout::incremental_inputs): New method.
3115 (Layout::create_incremental_info_sections): New method.
3116 (Layout::incremental_inputs_): New field.
3117 * main.cc (main): Notify Incremental_input of the command line.
3118
3119 2009-04-01 Ian Lance Taylor <iant@google.com>
3120 Mikolaj Zalewski <mikolajz@google.com>
3121
3122 * gold.h (reserve_unordered_map): Define, three versions, one for
3123 each version of Unordered_map.
3124 * layout.cc (Layout::Layout): Remove options parameter. Add
3125 number_of_input_files parameter. Don't initialize options_.
3126 Initialize number_of_input_files_ and resized_signatures_. Move
3127 sections_are_attached_.
3128 (Layout::layout_group): Reserve space for group_signatures_.
3129 (Layout::find_or_add_kept_section): Change name parameter to be a
3130 reference. Resize signatures_ map when it gets large enough.
3131 (Layout::layout_eh_frame): Use parameters->options() instead of
3132 this->options_.
3133 (Layout::make_output_section): Likewise.
3134 (Layout::attach_allocated_section_to_segment): Likewise.
3135 (Layout::finalize, Layout::create_executable_stack): Likewise.
3136 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
3137 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
3138 * layout.h (class Layout): Update declarations. Remove options_
3139 field. Add number_of_input_files_ and resized_signatures_
3140 fields. Move sections_are_attached_ field.
3141 * main.cc (main): Pass number of input files to Layout
3142 constructor. Don't pass options.
3143
3144 2009-03-30 Ian Lance Taylor <iant@google.com>
3145
3146 * ffsll.c (ffsll): Correct implementation.
3147
3148 2009-03-27 Ian Lance Taylor <iant@google.com>
3149
3150 * ffsll.c: New file.
3151 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
3152 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
3153 * ftruncate.c (ftruncate): Declare before definition.
3154 * mremap.c (mremap): Likewise.
3155 * pread.c (pread): Likewise.
3156 * configure, Makefile.in, config.in: Rebuild.
3157
3158 * mremap.c: New file.
3159 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
3160 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
3161 (mremap): Declare if HAVE_MREMAP is not defined.
3162 * configure, Makefile.in, config.in: Rebuild.
3163
3164 2009-03-27 Cary Coutant <ccoutant@google.com>
3165
3166 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
3167 position independent.
3168 * sparc.cc (Target_sparc::check_non_pic): Likewise.
3169 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
3170
3171 2009-03-24 Cary Coutant <ccoutant@google.com>
3172
3173 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
3174 an executable.
3175 (needs_dynamic_reloc): Likewise.
3176
3177 2009-03-24 Ian Lance Taylor <iant@google.com>
3178
3179 * yyscript.y (file_cmd): Recognize EXTERN.
3180 (extern_name_list, extern_name_list_body): New nonterminals.
3181 * script.cc (script_add_extern): Define.
3182 * script-c.h (script_add_extern): Declare.
3183
3184 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
3185
3186 * object.cc (is_elf_object): Define.
3187 * object.h (is_elf_object): Declare.
3188 * archive.cc (Archive::get_elf_object_for_member): Call
3189 is_elf_object.
3190 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
3191
3192 2009-03-24 Elliott Hughes <enh@google.com>
3193
3194 * output.cc (Output_file::map_anonymous): Define.
3195 (Output_file::map): Use map_anonymous. If the regular mmap fails,
3196 try an anonymous one. Report the size if the mmap fails.
3197 * output.h (class Output_file): Declare map_anonymous.
3198
3199 2009-03-24 Ian Lance Taylor <iant@google.com>
3200
3201 * target-select.cc (instantiate_target): Don't acquire the lock if
3202 the instantiated_target_ field has already been set.
3203
3204 2009-03-23 Ian Lance Taylor <iant@google.com>
3205
3206 * gold-threads.h (class Initialize_lock): Define.
3207 * gold-threads.cc (class Initialize_lock_once): Define.
3208 (initialize_lock_control): New static variable.
3209 (initialize_lock_pointer): New static variable.
3210 (initialize_lock_once): New static function.
3211 (Initialize_lock::Initialize_lock): Define.
3212 (Initialize_lock::initialize): Define.
3213 * target-select.h: Include "gold-threads.h".
3214 (class Target_selector): Add lock_ and initialize_lock_ fields.
3215 Don't define instantiate_target, just declare it.
3216 * target-select.cc (Target_selector::Target_selector): Initialize
3217 new fields.
3218 (Target_selector::instantiate_target): Define.
3219 * descriptors.h: Include "gold-threads.h".
3220 (class Descriptors): Add initialize_lock_ field.
3221 * descriptors.cc (Descriptors::Descriptors): Initialize new
3222 field.
3223 (Descriptors::open): Use initialize_lock_ field
3224 * errors.h (class Errors): Add initialize_lock_ field.
3225 * errors.cc (Errors::Errors): Initialize new field.
3226 (Errors::initialize_lock): Use initialize_lock_ field.
3227 * powerpc.cc (class Target_selector_powerpc): Remove
3228 instantiated_target_ field. In do_recognize call
3229 instantiate_target rather than do_instantiate_target. In
3230 do_instantiate_target just allocate a new target.
3231 * sparc.cc (class Target_selector_sparc): Likewise.
3232
3233 * freebsd.h: New file.
3234 * i386.cc: Include "freebsd.h".
3235 (Target_i386): Derive from Target_freebsd rather than
3236 Sized_target.
3237 (Target_selector_i386): Derive from Target_selector_freebsd rather
3238 than Target_selector.
3239 * x86_64.cc: Include "freebsd.h".
3240 (Target_x86_64): Derive from Target_freebsd rather than
3241 Sized_target.
3242 (Target_selector_x86_64): Derive from Target_selector_freebsd
3243 rather than Target_selector.
3244 * target.h (class Target): Add adjust_elf_header and
3245 do_adjust_elf_header.
3246 * output.cc (Output_file_header:: do_sized_write): Call target
3247 adjust_elf_header routine.
3248 * configure.tgt: Set targ_osabi.
3249 * configure.ac: Define GOLD_DEFAULT_OSABI.
3250 * parameters.cc (Parameters::default_target): Pass
3251 GOLD_DEFAULT_OSABI to select_target.
3252 * target-select.h (class Target_selector): Make instantiate_target
3253 protected rather than private.
3254 * Makefile.am (HFILES): Add freebsd.h.
3255 * configure, Makefile.in, config.in: Rebuild.
3256
3257 * merge.cc (do_add_input_section): Correct pend value. Change
3258 message about last entry not being null terminated from error to
3259 warning.
3260
3261 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
3262
3263 * incremental.cc: New file.
3264 * Makefile.am (CCFILES): Add incremental.cc.
3265 * Makefile.in: Rebuild.
3266
3267 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
3268
3269 * layout.cc (Layout::output_section_name): Preserve names
3270 of '.note.' sections.
3271
3272 2009-03-19 Ian Lance Taylor <iant@google.com>
3273
3274 * descriptors.cc (Descriptors::open): Check that the options are
3275 valid before using them.
3276
3277 2009-03-18 Ian Lance Taylor <iant@google.com>
3278
3279 * script-sections.h: Include <list>.
3280 (class Script_sections): Change Sections_elements from std::vector
3281 to std::list. Typedef public Elements_iterator. Add
3282 orphan_section_placement_, data_segment_align_start_, and
3283 saw_data_segment_align_ fields. Remove data_segment_align_index_
3284 field.
3285 * script-sections.cc (class Orphan_section_placement): New class.
3286 (class Sections_element): Add virtual functions is_relro and
3287 orphan_section_init. Remove virtual function place_orphan_here.
3288 (class Output_section_definition): Add is_relro and
3289 orphan_section_init. Remove place_orphan_here.
3290 (class Orphan_output_section): Likewise.
3291 (Script_sections::Script_sections): Update for field changes.
3292 (Script_sections::data_segment_align): Set saw_data_segment_align_
3293 and data_segment_align_start_, not data_segment_align_index.
3294 (Script_sections::data_segment_relro_end): Check
3295 saw_data_segment_align_. Use data_segment_align_start_ rather
3296 than data_segment_align_index_.
3297 (Script_sections::place_orphan): Rewrite to use
3298 Orphan_section_placement.
3299
3300 2009-03-17 Ian Lance Taylor <iant@google.com>
3301
3302 * archive.cc (Archive::add_symbols): Check for a version attached
3303 to the symbol name in the archive map.
3304 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
3305 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
3306 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
3307 (ver_test_11.a): New target.
3308 * testsuite/Makefile.in: Rebuild.
3309
3310 * configure.ac: Check for chsize and posix_fallocate. Replace
3311 ftruncate.
3312 * ftruncate.c: New file, from gnulib.
3313 * output.cc (posix_fallocate): Define dummy version if not
3314 HAVE_POSIX_FALLOCATE.
3315 (Output_file::map): Call posix_fallocate rather than lseek and
3316 write.
3317 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
3318 * configure, Makefile.in, config.in: Rebuild.
3319
3320 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
3321
3322 * layout.h (Layout::create_note): Add section_name parameter.
3323 * layout.cc (Layout::create_note): Likewise.
3324 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
3325
3326 2009-03-17 Ian Lance Taylor <iant@google.com>
3327
3328 * descriptors.cc: Include "options.h".
3329 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
3330 (Descriptors::open): Always use O_CLOEXEC when opening a new
3331 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
3332 then set FD_CLOEXEC.
3333
3334 * sparc.cc (class Target_sparc): Add has_got_section.
3335 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
3336 make sure we have a GOT section.
3337
3338 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
3339 (Target_sparc::Scan::local): Likewise.
3340 (Target_sparc::Scan::global): Likewise.
3341 (Target_sparc::Relocate::relocate): Likewise.
3342 (Target_sparc::Relocate::relocate_tls): Likewise.
3343
3344 * symtab.cc (Symbol_table::define_default_version): New function,
3345 broken out of add_from_object.
3346 (Symbol_table::add_from_object): Call define_default_version.
3347 (Symbol_table::define_special_symbol): Add resolve_oldsym
3348 parameter. Change all callers. If the version for a symbol comes
3349 from a version script, resolve it with the symbol with the same
3350 name with no version. Also add the symbol without a version if
3351 appropriate.
3352 (do_define_in_output_data): If resolving with oldsym, don't delete
3353 sym.
3354 (do_define_in_output_segment): Likewise.
3355 (do_define_as_constant): Likewise.
3356 * symtab.h (class Symbol_table): Update declarations.
3357
3358 2009-03-13 Ian Lance Taylor <iant@google.com>
3359
3360 * readsyms.cc (Read_symbols::incompatible_warning): New function.
3361 (Read_symbols::requeue): New function.
3362 (Read_symbols::do_read_symbols): If make_elf_object fails because
3363 the target type is not configured, and the file was searched for,
3364 issue a warning and retry with the next directory.
3365 (Add_symbols::run): If the file has an incompatible format, and
3366 it was searched for, requeue the Read_symbols task. On error,
3367 release the object.
3368 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
3369 dirindex parameter to constructor. Change all callers. Declare
3370 incompatible_warning and requeue.
3371 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
3372 input_argument_ and input_group_ fields. Add them to
3373 constructor. Change all callers.
3374 (class Read_script): Add dirindex_ field. Add it to constructor.
3375 Change all callers.
3376 * archive.cc (Archive::setup): Remove input_objects parameter.
3377 Change all callers.
3378 (Archive::get_file_and_offset): Likewise.
3379 (Archive::read_all_symbols): Likewise.
3380 (Archive::read_symbols): Likewise.
3381 (Archive::get_elf_object_for_member): Remove input_objects
3382 parameter. Add punconfigured parameter. Change all callers.
3383 (Archive::add_symbols): Change return type to bool. Check return
3384 value of include_member.
3385 (Archive::include_all_members): Likewise.
3386 (Archive::include_member): Change return type to bool. Return
3387 false if first included object has incompatible target. Set
3388 included_member_ field.
3389 (Add_archive_symbols::run): If add_symbols returns false, requeue
3390 Read_symbols task.
3391 * archive.h (class Archive): Add included_member_ field.
3392 Initialize it in constructor. Add input_file and searched_for
3393 methods. Update declarations.
3394 (class Add_archive_symbols): Add dirpath_, dirindex_, and
3395 input_argument_ fields. Add them to constructor. Change all
3396 callers.
3397 * script.cc: Include "target-select.h".
3398 (class Parser_closure): Add skip_on_incompatible_target_ and
3399 found_incompatible_target_ fields. Add
3400 skip_on_incompatible_target parameter to constructor. Change all
3401 callers. Add methods skip_on_incompatible_target,
3402 clear_skip_on_incompatible_target, found_incompatible_target, and
3403 set_found_incompatible_target.
3404 (read_input_script): Add dirindex parameter. Change all callers.
3405 If parser finds an incompatible target, requeue Read_symbols
3406 task.
3407 (script_set_symbol): Clear skip_on_incompatible_target in
3408 closure.
3409 (script_add_assertion, script_parse_option): Likewise.
3410 (script_start_sections, script_add_phdr): Likewise.
3411 (script_check_output_format): New function.
3412 * script.h (read_input_script): Update declaration.
3413 * script-c.h (script_check_output_format): Declare.
3414 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
3415 (ignore_cmd): Remove OUTPUT_FORMAT.
3416 * fileread.cc (Input_file::Input_file): Add explicit this.
3417 (Input_file::will_search_for): New function.
3418 (Input_file::open): Add pindex parameter. Change all callers.
3419 * fileread.h (class Input_file): Add input_file_argument method.
3420 Declare will_search_for. Update declarations.
3421 * object.cc (make_elf_object): Add punconfigured parameter.
3422 Change all callers.
3423 * object.h (class Object): Make input_file public. Add
3424 searched_for method.
3425 (make_elf_object): Update declaration.
3426 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
3427 restart search.
3428 * dirsearch.h (class Dirsearch): Update declaration.
3429 * options.h (class General_options): Add --warn-search-mismatch.
3430 * parameters.cc (Parameters::is_compatible_target): New function.
3431 * parameters.h (class Parameters): Declare is_compatible_target.
3432 * workqueue.cc (Workqueue::add_blocker): New function.
3433 * workqueue.h (class Workqueue): Declare add_blocker.
3434
3435 * fileread.cc (Input_file::open): Remove options parameter.
3436 Change all callers.
3437 (Input_file::open_binary): Likewise.
3438 * script.cc (read_input_script): Likewise.
3439 * readsyms.h (class Read_symbols): Remove options_ field. Remove
3440 options parameter from constructor. Change all callers.
3441 (class Read_script): Likewise.
3442 * fileread.h (class Input_file): Update declarations.
3443 * script.h (read_input_script): Update declaration.
3444
3445 2009-03-10 Nick Clifton <nickc@redhat.com>
3446
3447 * po/es.po: New Spanish translation.
3448
3449 2009-03-06 Cary Coutant <ccoutant@google.com>
3450
3451 * options.cc (parse_short_option): Keep dash_z from registering itself.
3452
3453 2009-03-03 Ian Lance Taylor <iant@google.com>
3454
3455 PR 9918
3456 * target-reloc.h (relocate_section): Pass output_section to
3457 relocate.
3458 * i386.cc (Target_i386::should_apply_static_reloc): Add
3459 output_section parameter. Change all callers.
3460 (Target_i386::Relocate::relocate): Add output_section parameter.
3461 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
3462 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
3463 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
3464 * testsuite/two_file_shared.sh: New script.
3465 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
3466 (check_DATA): Add two_file_shared.dbg.
3467 (two_file_shared.dbg): New target.
3468 * testsuite/Makefile.in: Rebuild.
3469
3470 2009-03-01 Ian Lance Taylor <iant@google.com>
3471
3472 * configure.ac: Check for byteswap.h.
3473 * configure: Rebuild.
3474 * config.in: Rebuild.
3475
3476 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
3477
3478 * layout.cc (Layout::find_or_add_kept_section): New function.
3479 (Layout::add_comdat): Removed.
3480 * layout.h (struct Kept_section): Move out of class Layout.
3481 Remove trailing underscores from field names. Add group_sections
3482 field. Rename group_ field to is_group. Change all uses.
3483 (class Layout): Declare find_or_add_kept_section, not add_comdat.
3484 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
3485 comdat_groups_ field.
3486 (Sized_relobj::include_section_group): Use
3487 find_or_add_kept_section and Kept_section::group_sections.
3488 (Sized_relobj::include_linkonce_section): Likewise.
3489 * object.cc (class Sized_relobj): Don't define Comdat_group or
3490 Comdat_group_table. Remove find_comdat_group and
3491 add_comdat_group. Remove comdat_groups_ field.
3492 * plugin.cc (include_comdat_group): Use
3493 Layout::find_or_add_kept_section.
3494
3495 2009-02-28 Ian Lance Taylor <iant@google.com>
3496
3497 * README: --gc-sections and map files are now supported. Document
3498 some build requirements.
3499
3500 PR 6992
3501 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
3502 relocatable link set the value of the section symbol to zero.
3503 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
3504 relocatable link don't include the section address in the local
3505 symbol value.
3506
3507 2009-02-27 Ian Lance Taylor <iant@google.com>
3508
3509 PR 6811
3510 * options.h (class Search_directory): Add is_system_directory.
3511 (class General_options): Declare is_in_system_directory.
3512 * options.cc (get_relative_sysroot): Make static.
3513 (get_default_sysroot): Make static.
3514 (General_optoins::is_in_system_directory): New function.
3515 * fileread.cc (Input_file::is_in_system_directory): New function.
3516 * fileread.h (class Input_file): Declare is_in_system_directory.
3517 * object.h (class Object): Add is_in_system_directory.
3518 (class Input_objects): Remove system_library_directory_ field.
3519 * object.cc (Input_objects::add_object): Don't set
3520 system_library_directory_.
3521 (input_objects::found_in_system_library_directory): Remove.
3522 * symtab.cc (Symbol_table::write_globals): Remove input_objects
3523 parameter. Change all callers.
3524 (Symbol_table::sized_write_globals): Likewise.
3525 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
3526 Call Object::is_in_system_directory.
3527 * symtab.h (class Symbol_table): Update declarations.
3528
3529 PR 5990
3530 * descriptors.h (Open_descriptor): Add is_on_stack field.
3531 * descriptors.cc (Descriptors::open): If the descriptor is on the
3532 top of the stack, remove it. Initialize is_on_stack field.
3533 (Descriptors::release): Only add pod to stack if it is not on the
3534 stack already.
3535 (Descriptors::close_some_descriptor): Clear stack_next and
3536 is_on_stack fields.
3537
3538 PR 7091
3539 * output.cc (Output_section::find_starting_output_address): Rename
3540 from starting_output_address; add PADDR parameter; change return
3541 type.
3542 * output.h (class Output_section): Declare
3543 find_starting_output_address instead of starting_output_address.
3544 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
3545 section symbol for which we can't find a merge section.
3546
3547 PR 9836
3548 * symtab.cc (Symbol_table::add_from_object): If the visibility is
3549 hidden or internal, force the symbol to be local.
3550 * resolve.cc (Symbol::override_visibility): Define.
3551 (Symbol::override_base): Use override_visibility.
3552 (Symbol_table::resolve): Likewise.
3553 (Symbol::override_base_with_special): Likewise.
3554 (Symbol_table::override_with_special): If the visibility is hidden
3555 or internal, force the symbol to be local.
3556 * symtab.h (class Symbol): Add set_visibility and
3557 override_visibility.
3558 * testsuite/ver_test_1.sh: New file.
3559 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
3560 (check_DATA): Add ver_test_1.syms.
3561 (ver_test_1.syms): New target.
3562 * testsuite/Makefile.in: Rebuild.
3563
3564 2009-02-25 Cary Coutant <ccoutant@google.com>
3565
3566 * layout.cc (Layout::choose_output_section): Don't rename sections
3567 when using a linker script that has a SECTIONS clause.
3568 * Makefile.in: Regenerate.
3569
3570 * testsuite/Makefile.am (script_test_5.sh): New test case.
3571 * testsuite/Makefile.in: Regenerate.
3572 * testsuite/script_test_5.cc: New file.
3573 * testsuite/script_test_5.sh: New file.
3574 * testsuite/script_test_5.t: New file.
3575
3576 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
3577
3578 * archive.cc (Archive::include_member): Update calls to add_symbols.
3579 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
3580 the Layout argument.
3581 * dynobj.h (do_add_symbols): Add the Layout argument.
3582 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
3583 Layout argument.
3584 * object.h (Object::add_symbols): Add the Layout argument.
3585 (Object::do_add_symbols): Add the Layout argument.
3586 (Sized_relobj::do_add_symbols): Add the Layout argument.
3587 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
3588 Unify the two versions.
3589 (Add_plugin_symbols): Remove.
3590 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
3591 (Sized_pluginobj::do_add_symbols): Unify the two versions.
3592 (Add_plugin_symbols): Remove.
3593 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
3594 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
3595 (Add_symbols::run): Make it work with Pulginobj.
3596
3597 2009-02-06 Ian Lance Taylor <iant@google.com>
3598
3599 * object.cc (Sized_relobj::do_layout): Make info message start
3600 with lower case letter.
3601
3602 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
3603
3604 * binary.cc: Fix file comment.
3605
3606 * options.h (enum Incremental_disposition): Define.
3607 (class General_options): Add new options: --incremental,
3608 --incremental_changed, --incremental_unchanged,
3609 --incremental_unknown. Add incremental_disposition_ and
3610 implicit_incremental_ fields.
3611 (General_options::incremental_disposition): New function.
3612 (class Position_dependent_options): Add incremental_disposition
3613 option.
3614 (Position_dependent_options::copy_from_options): Set incremental
3615 dispositions.
3616 * options.cc (General_options::parse_incremental_changed): New
3617 function.
3618 (General_options::parse_incremental_unchanged): New function.
3619 (General_options::parse_incremental_unknown): New function.
3620 (General_options::General_options): Initialize new fields
3621 incremental_disposition_ and implicit_incremental_.
3622 (General_options::finalize): Check for uasge of --incremental-*
3623 without --incremental.
3624
3625 2009-02-06 Chris Demetriou <cgd@google.com>
3626
3627 * gold.h (gold_undefined_symbol): Change to take only a Symbol
3628 pointer and to report location as the file name associated with
3629 the symbol.
3630 (gold_undefined_symbol_at_location): New function to replace the
3631 old gold_undefined_symbol functionality.
3632 * target-reloc.h (relocate_section): Update to use
3633 gold_undefined_symbol_at_location.
3634 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
3635 Call gold_undefined_symbol function rather than gold_error.
3636 * errors.h (Errors::undefined_symbol): Take location as a
3637 string, rather than calculating it from a relocation.
3638 * errors.cc (Errors::fatal): Print "fatal error:" before the
3639 formatted message.
3640 (Errors::error, Errors::error_at_location): Print "error: "
3641 before the formatted message.
3642 (Errors::undefined_symbol): Take location as a string, rather
3643 than calculating it from a relocation.
3644 (gold_undefined_symbol_at_location): New function akin to
3645 old gold_undefined_symbol, calculates location from relocation.
3646 (gold_undefined_symbol): Change to take only a Symbol pointer
3647 and to report location as the file name associated with the symbol.
3648 * testsuite/debug_msg.sh: Update for changed error messages.
3649 * testsuite/undef_symbol.sh: Likewise.
3650
3651 2009-02-04 Duncan Sands <baldrick@free.fr>
3652
3653 PR 9812
3654 * reduced_debug_output.h
3655 (Output_reduced_debug_abbrev_section::failed): Use format for
3656 gold_warning.
3657 (Output_reduced_debug_info_section::faild): Likewise.
3658
3659 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
3660
3661 * script.cc (Lazy_demangler): New class.
3662 (Version_script_info::get_symbol_version_helper): Demangle a
3663 symbol only once.
3664
3665 2009-01-29 Cary Coutant <ccoutant@google.com>
3666
3667 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
3668 to __tls_get_addr.
3669 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
3670
3671 2009-01-28 Ian Lance Taylor <iant@google.com>
3672
3673 * version.cc (version_string): Bump to 1.9.
3674
3675 * gold.h: Include <cstring> and <stdint.h>.
3676 * version.cc: Include <cstdio>.
3677 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
3678 warning.
3679 * reduced_debug_output.cc (insert_into_vector): Rename from
3680 Insert_into_vector; change all callers. Use Swap_unaligned to
3681 avoid aliasing issue; remove union since it is unnecessary.
3682
3683 2009-01-27 Sriraman Tallam <tmsriram@google.com>
3684
3685 * Makefile.am (CCFILES): Add gc.cc.
3686 (HFILES): Add gc.h.
3687 * Makefile.in: Regenerate.
3688 * gold.cc (Gc_runner): New class.
3689 (queue_initial_tasks): Call garbage collection related tasks
3690 when corresponding options are invoked.
3691 (queue_middle_gc_tasks): New function.
3692 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
3693 processed early before laying out sections during garbage collection.
3694 * gold.h (queue_middle_gc_tasks): New function.
3695 (is_prefix_of): Move from "layout.cc".
3696 * i386.cc (Target_i386::gc_process_relocs): New function.
3697 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
3698 * main.cc (main): Create object of class "Garbage_collection".
3699 * object.cc (Relobj::copy_symbols_data): New function.
3700 (Relobj::is_section_name_included): New function.
3701 (Sized_relobj::do_layout): Allow this function to be called twice
3702 during garbage collection and defer layout of section during the
3703 first call.
3704 * object.h (Relobj::get_symbols_data): New function.
3705 (Relobj::is_section_name_included): New function.
3706 (Relobj::copy_symbols_data): New function.
3707 (Relobj::set_symbols_data): New function.
3708 (Relobj::get_relocs_data): New function.
3709 (Relobj::set_relocs_data): New function.
3710 (Relobj::is_output_section_offset_invalid): New pure virtual function.
3711 (Relobj::gc_process_relocs): New function.
3712 (Relobj::do_gc_process_relocs): New pure virtual function.
3713 (Relobj::sd_): New data member.
3714 (Sized_relobj::is_output_section_offset_invalid): New function.
3715 (Sized_relobj::do_gc_process_relocs): New function.
3716 * options.h (General_options::gc_sections): Modify to not be a no-op.
3717 (General_options::print_gc_sections): New option.
3718 * plugin.cc (Plugin_finish::run): Remove function call to
3719 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
3720 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
3721 * reloc.cc (Read_relocs::run): Add task to process relocs and
3722 determine unreferenced sections when doing garbage collection.
3723 (Gc_process_relocs): New class.
3724 (Sized_relobj::do_gc_process_relocs): New function.
3725 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
3726 sections that are garbage collected.
3727 * reloc.h (Gc_process_relocs): New class.
3728 * sparc.cc (Target_sparc::gc_process_relocs): New function.
3729 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
3730 symbols whose corresponding sections are garbage collected.
3731 (Symbol_table::Symbol_table): Add new parameter for the garbage
3732 collection object.
3733 (Symbol_table::gc_mark_undef_symbols): New function.
3734 (Symbol_table::gc_mark_symbol_for_shlib): New function.
3735 (Symbol_table::gc_mark_dyn_syms): New function.
3736 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
3737 as garbage.
3738 (Symbol_table::add_from_object): Likewise.
3739 (Symbol_table::add_from_relobj): When building shared objects, do not
3740 treat externally visible symbols as garbage.
3741 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
3742 table information for static and relocatable links.
3743 * symtab.h (Symbol_table::set_gc): New function.
3744 (Symbol_table::gc): New function.
3745 (Symbol_table::gc_mark_undef_symbols): New function.
3746 (Symbol_table::gc_mark_symbol_for_shlib): New function.
3747 (Symbol_table::gc_mark_dyn_syms): New function.
3748 (Symbol_table::gc_): New data member.
3749 * target.h (Sized_target::gc_process_relocs): New pure virtual
3750 function.
3751 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
3752 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
3753
3754 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
3755
3756 * options.h (General_options::gc_sections): Define as a no-op for now.
3757 (General_options::no_keep_memory): Ditto.
3758 (General_options::Bshareable): Define.
3759 * options.cc (General_options::finalize): Honor -Bshareable.
3760
3761 2009-01-20 Andreas Schwab <schwab@suse.de>
3762
3763 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
3764 read the value in the contents, since we don't use it. Use the
3765 template endianness when writing.
3766 (Relocate::relocate): Use it for R_PPC_REL16_HA.
3767
3768 2009-01-19 Andreas Schwab <schwab@suse.de>
3769
3770 * configure.tgt (powerpc64-*): Fix targ_obj.
3771
3772 2009-01-15 Ian Lance Taylor <iant@google.com>
3773
3774 * object.cc (Sized_relobj::write_local_symbols): Don't write out
3775 local symbols when stripping all symbols.
3776
3777 2009-01-14 Cary Coutant <ccoutant@google.com>
3778
3779 * output.cc (Output_reloc): Add explicit instantiations.
3780
3781 2009-01-14 Cary Coutant <ccoutant@google.com>
3782
3783 * archive.cc (Archive::get_elf_object_for_member): Remove call
3784 to File_read::claim_for_plugin.
3785 * descriptors.cc (Descriptors::open): Remove reference to
3786 is_claimed.
3787 (Descriptors::claim_for_plugin): Remove.
3788 * descriptors.h (Descriptors::claim_for_plugin): Remove.
3789 (Descriptors::is_claimed): Remove.
3790 (claim_descriptor_for_plugin): Remove.
3791 * fileread.cc (File_read::claim_for_plugin): Remove.
3792 * fileread.h (File_read::claim_for_plugin): Remove.
3793 (File_read::descriptor): Reopen descriptor if necessary.
3794 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
3795 (Plugin_manager::all_symbols_read): Add task parameter. Change
3796 all callers.
3797 (Plugin_manager::get_input_file): New function.
3798 (Plugin_manager::release_input_file): New function.
3799 (Pluginobj::Pluginobj): Add filesize parameter and initialize
3800 corresponding data member.
3801 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
3802 and pass to base constructor. Change all callers.
3803 (get_input_file, release_input_file): New functions.
3804 (make_sized_plugin_object): Add filesize parameter. Change all callers.
3805 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
3806 (Plugin_manager::all_symbols_read): Add task parameter.
3807 (Plugin_manager::get_input_file): New function.
3808 (Plugin_manager::release_input_file): New function.
3809 (Plugin_manager::task_): New data member.
3810 (Pluginobj::Pluginobj): Add filesize parameter.
3811 (Pluginobj::filename): New function.
3812 (Pluginobj::descriptor): New function.
3813 (Pluginobj::filesize): New function.
3814 (Pluginobj::filesize_): New data member.
3815 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
3816 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
3817 File_read::claim_for_plugin; use Object::unlock to unlock the file.
3818
3819 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
3820 with archive libraries.
3821 * testsuite/Makefile.in: Regenerate.
3822 * testsuite/plugin_test.c (struct sym_info): New type.
3823 (get_input_file, release_input_file): New static variables.
3824 (onload): Capture new transfer vector entries.
3825 (claim_file_hook): Stop reading at end of file according to filesize.
3826 Factor out parsing of readelf output into separate function.
3827 (all_symbols_read_hook): Exercise get_input_file and release_input_file
3828 APIs and get the source file name from the symbol table. Convert
3829 source file name to corresponding object file name. Print info
3830 message when adding new input files.
3831 (parse_readelf_line): New function.
3832 * testsuite/plugin_test_1.sh: Add checks for new info messages.
3833 * testsuite/plugin_test_2.sh: Likewise.
3834 * testsuite/plugin_test_3.sh: Likewise.
3835 * testsuite/plugin_test_4.sh: New test case.
3836
3837 2009-01-07 Ian Lance Taylor <iant@google.com>
3838
3839 * version.cc (version_string): Bump to 1.8.
3840
3841 2008-12-23 Cary Coutant <ccoutant@google.com>
3842
3843 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
3844 * plugin.cc (Plugin_manager::finish): Rename as
3845 layout_deferred_objects. Move cleanup to separate function.
3846 (Plugin_manager::cleanup): New function.
3847 (Plugin_finish::run): Call layout_deferred_objects and cleanup
3848 separately.
3849 * plugin.h (Plugin_manager::finish): Rename as
3850 layout_deferred_objects.
3851 (Plugin_manager::cleanup): New function.
3852 (Plugin_manager::cleanup_done): New field.
3853
3854 2008-12-23 Cary Coutant <ccoutant@google.com>
3855
3856 * plugin.cc (is_visible_from_outside): New function.
3857 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
3858 so we don't return "IR only" status for exported symbols or -r links.
3859
3860 * testsuite/Makefile.am (plugin_test_3): New test case.
3861 * testsuite/Makefile.in: Regenerate.
3862 * testsuite/plugin_test_3.sh: New file.
3863
3864 2008-12-22 Cary Coutant <ccoutant@google.com>
3865
3866 * object.cc (Sized_relobj::layout_section): New function.
3867 (Sized_relobj::do_layout): Defer layout of input sections until after
3868 plugin has provided replacement files.
3869 (Sized_relobj::do_layout_deferred_sections): New function.
3870 * object.h (Relobj::set_section_offset): Remove virtual keyword.
3871 (Relobj::layout_deferred_sections): New function.
3872 (Relobj::do_layout_deferred_sections): New function.
3873 (Sized_relobj::do_layout_deferred_sections): New function.
3874 (Sized_relobj::layout_section): New function.
3875 (Sized_relobj::Deferred_layout): New structure.
3876 (Sized_relobj::deferred_layout_): New field.
3877 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
3878 Change all callers. Layout deferred sections.
3879 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
3880 references.
3881 (Plugin_hook::run): Move code from do_plugin_hook inline.
3882 (Plugin_hook::do_plugin_hook): Remove.
3883 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
3884 (Plugin_manager::finish): Renamed, was cleanup.
3885 (Plugin_manager::should_defer_layout): New function.
3886 (Plugin_manager::add_deferred_layout_object): New function.
3887 (Plugin_manager::Deferred_layout_list): New type.
3888 (Plugin_manager::deferred_layout_objects_): New field.
3889 (Plugin_hook::do_plugin_hook): Remove.
3890
3891 2008-12-17 Ian Lance Taylor <iant@google.com>
3892
3893 * options.h (class General_options): Add --no case for
3894 --export-dynamic.
3895
3896 2008-12-16 Cary Coutant <ccoutant@google.com>
3897
3898 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
3899 vector.
3900 (Plugin_manager::claim_file): Create plugin object even if
3901 plugin did not call the add_symbols callback.
3902 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
3903 asking for more symbols than were added.
3904 * testsuite/Makefile.am (plugin_test_1): Add test case with
3905 no global symbols.
3906 (empty.syms): New target.
3907 * testsuite/Makefile.in: Regenerate.
3908 * testsuite/plugin_test.c (claim_file_hook): Add new debug
3909 message. Don't call add_symbols if no globals.
3910 (all_symbols_read_hook): Don't provide replacement for empty
3911 claimed file.
3912
3913 2008-12-12 Ian Lance Taylor <iant@google.com>
3914
3915 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
3916 r_type == 0 for a local symbol with r_sym == 0.
3917 (scan_relocatable_relocs): Pass r_sym to
3918 local_non_section_strategy.
3919 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
3920 r_sym parameter.
3921
3922 * configure.ac: Update test for TLS descriptors: they are
3923 supported as of glibc 2.9.
3924 * configure: Rebuild.
3925
3926 2008-12-11 Ian Lance Taylor <iant@google.com>
3927
3928 PR 7091
3929 * target-reloc.h (Default_scan_relocatable_relocs): For each
3930 function, map r_type == 0 to RELOC_DISCARD.
3931
3932 2008-12-10 Cary Coutant <ccoutant@google.com>
3933
3934 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
3935 object to override a kept COMDAT group from a plugin object.
3936
3937 2008-12-09 Ian Lance Taylor <iant@google.com>
3938
3939 PR 7088
3940 * yyscript.y (file_cmd): Handle INPUT.
3941
3942 * testsuite/initpri1.c: Change all declarations to be full
3943 prototypes by adding void, to avoid compiler warnings.
3944
3945 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
3946
3947 * options.cc (General_options::parse_plugin_opt): New.
3948 (General_options::add_plugin): The argument now is just the filename.
3949 (General_options::add_plugin_option): New.
3950 * options.h (plugin_opt): New.
3951 (add_plugin): Change argument name.
3952 (add_plugin_option): New.
3953 * plugin.cc (Plugin::load): Don't parse the plugin option.
3954 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
3955 (Plugin::add_option): New.
3956 (Plugin::args_): Change type.
3957 (Plugin::filename_): New.
3958 (Plugin_manager::add_plugin_option): New.
3959 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
3960 * testsuite/Makefile.in: Regenerate.
3961
3962 2008-12-05 Cary Coutant <ccoutant@google.com>
3963
3964 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
3965 Handle --strip-lto-sections option.
3966 * options.h (strip_lto_sections): New option.
3967
3968 2008-12-01 Cary Coutant <ccoutant@google.com>
3969
3970 * plugin.cc (ld_plugin_message): Change format parameter to const.
3971 Fix mismatch between new[] and delete.
3972
3973 2008-11-14 Cary Coutant <ccoutant@google.com>
3974
3975 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
3976 instead of -1U.
3977
3978 2008-11-05 Craig Silverstein <csilvers@google.com>
3979
3980 * options.cc (General_options::parse_dynamic_list): New function.
3981 * options.h (General_options): New flags dynamic_list,
3982 dynamic_list_data, dynamic_list_cpp_new, and
3983 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
3984 (General_options::in_dynamic_list): New function.
3985 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
3986 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
3987 (Lex::can_continue_name): Likewise.
3988 (yylex): Likewise.
3989 (read_script_file): New parameter script_options.
3990 (read_dynamic_list): New function.
3991 (Script_options::define_dynamic_list): New function.
3992 (dynamic_list_keyword_parsecodes): New variable.
3993 (dynamic_list_keywords): New variable.
3994 * script.h (Script_options::define_dynamic_list): New function
3995 prototype.
3996 (read_dynamic_list): New function prototype.
3997 * symtab.cc (strprefix): New macro.
3998 (Symbol::should_add_dynsym_entry): Support dynamic_list,
3999 dynamic_list_data, dynamic_list_cpp_new, and
4000 dynamic_list_cpp_typeinfo.
4001 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
4002 (dynamic_list_expr): New rule.
4003 (dynamic_list_nodes): Likewise.
4004 (dynamic_list_node): Likewise.
4005 * testsuite/Makefile.am (dynamic_list): New test.
4006 * testsuite/Makefile.in: Regenerated.
4007 * testsuite/dynamic_list.t: New file.
4008 * testsuite/dynamic_list.sh: New file.
4009
4010 2008-11-05 Craig Silverstein <csilvers@google.com>
4011
4012 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
4013 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
4014 (t11_last): Likewise.
4015 * testsuite/ver_test_6.c (main): Likewise.
4016
4017 2008-10-07 Cary Coutant <ccoutant@google.com>
4018
4019 * options.c (General_options::finalize): Add check for -static and
4020 -shared.
4021 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
4022 is not empty.
4023
4024 2008-10-02 Cary Coutant <ccoutant@google.com>
4025
4026 * plugin.cc (make_sized_plugin_object): Fix conditional
4027 compilation to work when not all targets are enabled.
4028
4029 2008-09-29 Cary Coutant <ccoutant@google.com>
4030
4031 * archive.cc (Archive::get_file_and_offset): Use filename instead
4032 of name to get library path.
4033 (Archive::include_member): Unlock external member of a thin archive.
4034
4035 * testsuite/Makefile.am (TEST_AR): New variable.
4036 (thin_archive_test_1): New test.
4037 (thin_archive_test_2): New test.
4038 * testsuite/Makefile.in: Regenerate.
4039 * testsuite/thin_archive_main.cc: New file.
4040 * testsuite/thin_archive_test_1.cc: New file.
4041 * testsuite/thin_archive_test_2.cc: New file.
4042 * testsuite/thin_archive_test_3.cc: New file.
4043 * testsuite/thin_archive_test_4.cc: New file.
4044
4045 2008-09-29 Cary Coutant <ccoutant@google.com>
4046
4047 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
4048 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
4049 instead of -1U.
4050 (Sized_relobj::do_finalize_local_symbols): Likewise.
4051 (Sized_relobj::map_to_kept_section): Likewise.
4052 * object.h (Sized_relobj::invalid_address): New constant.
4053 (Sized_relobj::do_output_section_offset): Check for invalid_address
4054 and return -1ULL.
4055 * output.cc (Output_reloc::local_section_offset): Use constant
4056 invalid_address instead of -1U.
4057 (Output_reloc::get_address): Likewise.
4058 (Output_section::output_address): Change -1U to -1ULL.
4059 * output.h (Output_reloc::invalid_address): New constant.
4060 * reloc.cc (Sized_relobj::write_sections): Use constant
4061 invalid_address instead of -1U.
4062 (Sized_relobj::relocate_sections): Likewise.
4063 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
4064 values for merge sections.
4065 * target-reloc.h (relocate_for_relocatable): Use constant
4066 invalid_address instead of -1U.
4067
4068 2008-09-19 Cary Coutant <ccoutant@google.com>
4069
4070 Add plugin functionality for link-time optimization (LTO).
4071 * configure.ac (plugins): Add --enable-plugins option.
4072 * configure: Regenerate.
4073 * config.in: Regenerate.
4074 * Makefile.am (LIBDL): New variable.
4075 (CCFILES): Add plugin.cc.
4076 (HFILES): Add plugin.h.
4077 (ldadd_var): Add LIBDL.
4078 * Makefile.in: Regenerate.
4079
4080 * archive.cc: Include "plugin.h".
4081 (Archive::setup): Don't preread archive symbols when using a plugin.
4082 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
4083 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
4084 files.
4085 (Archive::include_member): Add symbols from plugin objects.
4086 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
4087 * descriptors.cc (Descriptors::open): Check for file descriptors
4088 abandoned by plugins.
4089 (Descriptors::claim_for_plugin): New function.
4090 * descriptors.h (Descriptors::claim_for_plugin): New function.
4091 (Open_descriptor::is_claimed): New field.
4092 (claim_descriptor_for_plugin): New function.
4093 * fileread.cc (File_read::claim_for_plugin): New function.
4094 * fileread.h (File_read::claim_for_plugin): New function.
4095 (File_read::descriptor): New function.
4096 * gold.cc: Include "plugin.h".
4097 (queue_initial_tasks): Add task to call plugin hooks for generating
4098 new object files.
4099 * main.cc: Include "plugin.h".
4100 (main): Load plugin libraries.
4101 * object.h (Pluginobj): Declare.
4102 (Object::pluginobj): New function.
4103 (Object::do_pluginobj): New function.
4104 (Object::set_target): New function.
4105 * options.cc: Include "plugin.h".
4106 (General_options::parse_plugin): New function.
4107 (General_options::General_options): Initialize plugins_ field.
4108 (General_options::add_plugin): New function.
4109 * options.h (Plugin_manager): Declare.
4110 (General_options): Add --plugin option.
4111 (General_options::has_plugins): New function.
4112 (General_options::plugins): New function.
4113 (General_options::add_plugin): New function.
4114 (General_options::plugins_): New field.
4115 * plugin.cc: New file.
4116 * plugin.h: New file.
4117 * readsyms.cc: Include "plugin.h".
4118 (Read_symbols::do_read_symbols): Check for archive before checking
4119 for ELF file. Call plugin hooks to claim files.
4120 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
4121 from a real object file; force override when processing replacement
4122 files.
4123 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
4124 (Symbol::init_base_object): Likewise.
4125 (Symbol::init_base_output_data): Likewise.
4126 (Symbol::init_base_output_segment): Likewise.
4127 (Symbol::init_base_constant): Likewise.
4128 (Symbol::init_base_undefined): Likewise.
4129 (Symbol::output_section): Assert that object is not a plugin.
4130 (Symbol_table::add_from_pluginobj): New function.
4131 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
4132 undefined.
4133 (Symbol_table::sized_write_globals): Likewise.
4134 (Symbol_table::add_from_pluginobj): Instantiate template.
4135 * symtab.h (Sized_pluginobj): Declare.
4136 (Symbol::in_real_elf): New function.
4137 (Symbol::set_in_real_elf): New function.
4138 (Symbol::in_real_elf_): New field.
4139 (Symbol_table::add_from_pluginobj): New function.
4140
4141 * testsuite/Makefile.am (AM_CFLAGS): New variable.
4142 (LIBDL): New variable.
4143 (LDADD): Add LIBDL.
4144 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
4145 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
4146 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
4147 (MOSTLYCLEANFILES): Likewise.
4148 * testsuite/Makefile.in: Regenerate.
4149 * testsuite/plugin_test.c: New file.
4150 * testsuite/plugin_test_1.sh: New file.
4151 * testsuite/plugin_test_2.sh: New file.
4152
4153 2008-09-16 Ian Lance Taylor <iant@google.com>
4154
4155 * target-reloc.h (relocate_section): Check whether a symbol is
4156 defined by the ABI before reporting an undefined symbol error.
4157 * target.h (Target::is_defined_by_abi): Make parameter const.
4158 (Target::do_is_defined_by_abi): Likewise.
4159 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
4160 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
4161 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
4162 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
4163 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
4164 * testsuite/Makefile.in: Rebuild.
4165
4166 * fileread.cc (make_view): Add casts to avoid warning.
4167
4168 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
4169
4170 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
4171 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
4172
4173 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
4174
4175 * options.h (General_options::output_is_executable): New.
4176 (General_options::output_is_pie): New.
4177 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
4178 for shared libraries.
4179 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
4180
4181 2008-09-11 Chris Demetriou <cgd@google.com>
4182
4183 * options.h (origin): New -z option.
4184 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
4185 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
4186 in DT_FLAGS_1.
4187
4188 2008-09-05 Cary Coutant <ccoutant@google.com>
4189
4190 * fileread.cc (File_read::make_view): Add check for attempt to map
4191 beyond end of file.
4192
4193 2008-09-05 Cary Coutant <ccoutant@google.com>
4194
4195 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
4196 explicit instantiations.
4197
4198 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
4199
4200 PR gold/6858
4201 * options.cc (General_options::finalize): Allow undefined symbols
4202 in shlibs if linking -shared.
4203
4204 PR gold/6859
4205 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
4206 symbols as not needing a dynsym entry.
4207
4208 2008-08-20 Craig Silverstein <csilvers@google.com>
4209
4210 * fileread.cc (File_read::open): Do not lock the file unless it
4211 was successfully opened.
4212
4213 2008-08-14 Cary Coutant <ccoutant@google.com>
4214
4215 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
4216 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
4217 * testsuite/tls_test.cc (struct int128): 128-bit struct
4218 for testing TLS relocs with non-zero addend.
4219 (v12): New TLS variable.
4220 (t12): New test.
4221 (t_last): Add check for v12.
4222 * testsuite/tls_test.h (t12): New function.
4223 * testsuite/tls_test_main.cc (thread_routine): Call new test.
4224
4225 2008-08-13 Ian Lance Taylor <iant@google.com>
4226
4227 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
4228 set tls_segment_ or relro_segment_.
4229 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
4230 when appropriate.
4231 * output.h (Output_section::clear_is_relro): New function.
4232 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
4233 sections specially even when output_data_ is empty.
4234 (Output_segment::maximum_alignment): When first section is relro,
4235 only force alignment for PT_LOAD segments.
4236 * script.cc (script_data_segment_align): New function.
4237 (script_data_segment_relro_end): New function.
4238 * script-c.h (script_data_segment_align): Declare.
4239 (script_data_segment_relro_end): Declare.
4240 * script-sections.h (class Script_sections): Declare
4241 data_segment_align and data_segment_relro_end. Add fields
4242 segment_align_index_ and saw_relro_end_.
4243 * script-sections.cc (class Sections_element): Add set_is_relro
4244 virtual function. Add new bool* parameter to place_orphan_here.
4245 Add get_output_section virtual function.
4246 (class Output_section_definition): Add set_is_relro. Add new
4247 bool* parameter to place_orphan_here. Add get_output_section.
4248 Add is_relro_ field.
4249 (Output_section_definition::Output_section_definition): Initialize
4250 evaluated_address_, evaluated_load_address, evaluated_addralign_,
4251 and is_relro_ fields.
4252 (Output_section_definition::place_orphan_here): Add is_relro
4253 parameter.
4254 (Output_section_definition::set_section_addresses): Set relro for
4255 output section.
4256 (Output_section_definition::alternate_constraint): Likewise.
4257 (class Orphan_output_section): Add new bool* parameter to
4258 place_orphan_here. Add get_output_section.
4259 (Orphan_output_section::place_orphan_here): Add is_relro
4260 parameter.
4261 (Script_sections::Script_sections): Initialize
4262 data_segment_align_index_ and saw_relro_end_.
4263 (Script_sections::data_segment_align): New function.
4264 (Script_sections::data_segment_relro_end): New function.
4265 (Script_sections::place_orphan): Set or clear is_relro.
4266 (Script_sections::set_section_addresses): Force alignment of first
4267 TLS section.
4268 * yyscript.y (exp): Call script_data_segment_align and
4269 script_data_segment_relro_end.
4270 * testsuite/relro_script_test.t: New file.
4271 * testsuite/relro_test.cc (using_script): Declare.
4272 (t1, t2): Test using_script.
4273 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
4274 (relro_script_test_SOURCES): Define.
4275 (relro_script_test_DEPENDENCIES): Define.
4276 (relro_script_test_LDFLAGS): Define.
4277 (relro_script_test_LDADD): Define.
4278 (relro_script_test.so): New target.
4279 * testsuite/Makefile.in: Rebuild.
4280
4281 2008-08-06 Cary Coutant <ccoutant@google.com>
4282
4283 * archive.cc (Archive::total_archives, Archive::total_members)
4284 (Archive::total_members_loaded): New variables.
4285 (Archive::setup): Add parameter. Add option to preread
4286 archive symbols.
4287 (Archive::read_armap): Add counter.
4288 (Archive::get_file_and_offset): New function.
4289 (Archive::get_elf_object_for_member): New function.
4290 (Archive::read_all_symbols): New function.
4291 (Archive::read_symbols): New function.
4292 (Archive::add_symbols): Add counters.
4293 (Archive::include_all_members): Use armap to find members if it's
4294 already built.
4295 (Archive::include_member): Skip reading symbols if already read.
4296 Factored code into Archive::get_file_and_offset and
4297 Archive::get_elf_object_for_member. Changed call to
4298 Mapfile::report_include_archive_member.
4299 (Archive::print_stats): New function.
4300 * archive.h: Declare Object and Read_symbols_data classes.
4301 (Archive::Archive): Add initializers for new members.
4302 (Archive::setup): Add parameter.
4303 (Archive::print_stats): New function.
4304 (Archive::total_archives, Archive::total_members)
4305 (Archive::total_members_loaded): New variables.
4306 (Archive::get_file_and_offset): New function.
4307 (Archive::get_elf_object_for_member): New function.
4308 (Archive::read_all_symbols): New function.
4309 (Archive::read_symbols): New function.
4310 (Archive::Archive_member): New class.
4311 (Archive::members_): New member.
4312 (Archive::num_members_): New member.
4313 * main.cc: Include archive.h.
4314 (main): Call Archive::print_stats.
4315 * mapfile.cc (Mapfile::report_include_archive_member): Delete
4316 archive parameter; member_name is now the fully-decorated name.
4317 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
4318 * options.h: (General_options): Add --preread-archive-symbols option.
4319 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
4320 Archive::setup.
4321
4322 2008-08-04 Ian Lance Taylor <iant@google.com>
4323
4324 * symtab.h (Symbol::use_plt_offset): New function.
4325 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
4326 * powerpc.cc (Relocate::relocate): Likewise.
4327 * sparc.cc (Relocate::relocate): Likewise.
4328 * x86_64.cc (Relocate::relocate): Likewise.
4329 * testsuite/weak_plt.sh: New test.
4330 * testsuite/weak_plt_main.cc: New test.
4331 * testsuite/weak_plt_shared.cc: New test.
4332 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
4333 (check_PROGRAMS): Add weak_plt.
4334 (check_DATA): Add weak_plt_shared.so.
4335 (weak_plt_main_pic.o, weak_plt): New targets.
4336 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
4337 * testsuite/Makefile.in: Rebuild.
4338
4339 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
4340 gcctestdir/ld.
4341 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
4342 * testsuite/Makefile.in: Rebuild.
4343
4344 2008-08-04 Alan Modra <amodra@bigpond.net.au>
4345
4346 * Makefile.am (POTFILES.in): Set LC_ALL=C.
4347 * Makefile.in: Regenerate.
4348 * po/POTFILES.in: Regenerate.
4349
4350 2008-07-29 Ian Lance Taylor <iant@google.com>
4351
4352 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
4353 symbols before other symbols.
4354 * testsuite/script_test_2.cc (test_addr): Declare.
4355 (test_addr_alias): Declare.
4356 (main): Check that test_addr and test_addr_alias have the right
4357 values.
4358 * testsuite/script_test_2.t: Define test_addr_alias and
4359 test_addr.
4360
4361 2008-07-24 Ian Lance Taylor <iant@google.com>
4362
4363 PR 5990
4364 * descriptors.cc: New file.
4365 * descriptors.h: New file.
4366 * gold-threads.h (class Hold_optional_lock): New class.
4367 * fileread.cc: Include "descriptors.h".
4368 (File_read::~File_read): Release descriptor rather than closing
4369 it.
4370 (File_read::open) [file]: Call open_descriptor rather than open.
4371 Set is_descriptor_opened_.
4372 (File_read::open) [memory]: Assert that descriptor is not open.
4373 (File_read::reopen_descriptor): New function.
4374 (File_read::release): Release descriptor.
4375 (File_read::do_read): Make non-const. Reopen descriptor.
4376 (File_read::read): Make non-const.
4377 (File_read::make_view): Reopen descriptor.
4378 (File_read::do_readv): Likewise.
4379 * fileread.h (class File_read): Add is_descriptor_opened_ field.
4380 Update declarations.
4381 * layout.cc: Include "descriptors.h".
4382 (Layout::create_build_id): Use open_descriptor rather than open.
4383 * output.cc: Include "descriptors.h".
4384 (Output_file::open): Use open_descriptor rather than open.
4385 * archive.cc (Archive::const_iterator): Change Archive to be
4386 non-const.
4387 (Archive::begin, Archive::end): Make non-const.
4388 (Archive::count_members): Likewise.
4389 * archive.h (class Archive): Update declarations.
4390 * object.h (Object::read): Make non-const.
4391 * Makefile.am (CCFILES): Add descriptors.cc.
4392 (HFILES): Add descriptors.h.
4393 * Makefile.in: Rebuild.
4394
4395 PR 6716
4396 * gold.h: Always include <clocale>. Add Solaris workarounds
4397 following code in binutils/sysdep.h.
4398
4399 PR 6048
4400 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
4401 this->eh_frame_hdr_ is NULL before using it.
4402
4403 * dynobj.cc (Versions::Versions): Update comment.
4404
4405 * dynobj.cc (Versions::Versions): If there is an soname, use it as
4406 the base version name.
4407
4408 * stringpool.cc (Stringpool_template::add_with_length): Set key to
4409 array size plus one.
4410 (Stringpool_template::set_string_offsets): Subtract one from key
4411 before using it as an array index.
4412 (Stringpool_template::get_offset_with_length): Likewise.
4413 (Stringpool_template::write_to_buffer): Likewise.
4414 * stringpool.h (Stringpool_template::get_offset_from_key):
4415 Likewise.
4416
4417 2008-07-23 Ian Lance Taylor <iant@google.com>
4418
4419 PR 6658
4420 * object.h (Merged_symbol_value::value): Do our best to handle a
4421 negative addend.
4422
4423 PR 6647
4424 * script.cc (Version_script_info::get_versions): Don't add empty
4425 version tag to return value.
4426 (Version_script_info::get_symbol_version_helper): Change return
4427 type to bool. Add pversion parameter. Change all callers.
4428 (script_register_vers_node): Don't require a non-NULL tag.
4429 * script.h (class Version_script_info): Update declarations.
4430 (Version_script_info::get_symbol_version): Change return type to
4431 bool. Add version parameter. Change all callers.
4432 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
4433 handling. Handle an empty version from a version script.
4434 (Symbol_table::define_special_symbol): Likewise.
4435 * testsuite/ver_test_10.script: New file.
4436 * testsuite/ver_test_10.sh: New file.
4437 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
4438 (check_DATA): Add ver_test_10.syms.
4439 (ver_test_10.syms, ver_test_10.so): New target.
4440 * testsuite/Makefile.in: Rebuild.
4441
4442 2008-07-23 Simon Baldwin <simonb@google.com>
4443
4444 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
4445 to zero for undefined symbols from dynamic libraries.
4446
4447 2008-07-23 Ian Lance Taylor <iant@google.com>
4448
4449 * symtab.cc (Symbol_table::resolve): Remove version parameter.
4450 Change all callers.
4451 * symtab.h (class Symbol_table): Update declaration.
4452 * testsuite/ver_test_9.cc: New file.
4453 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
4454 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
4455 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
4456 (ver_test_9.so, ver_test_9.o): New targets.
4457 * testsuite/Makefile.in: Rebuild.
4458
4459 2008-07-22 Ian Lance Taylor <iant@google.com>
4460
4461 * options.h (class General_options): Define --check-sections.
4462 * layout.cc (Layout::set_segment_offsets): Handle
4463 --check-sections.
4464
4465 * options.h (class General_options): Define -n/--nmagic and
4466 -N/--omagic.
4467 * options.cc (General_options::finalize): For -n/--nmagic or
4468 -N/--omagic, set -static.
4469 * layout.cc (Layout::attach_allocated_section_to_segment): If
4470 -N/--omagic, don't put read-only and read-write sections in
4471 different segments.
4472 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
4473 finding a read-only segment.
4474 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
4475 don't set the minimum segment alignment to the common page size,
4476 and don't set the file offset to the address modulo the page size.
4477 * script-sections.cc (Script_sections::create_segments): If
4478 -n/--omagic, don't put read-only and read-write sections in
4479 different segments.
4480
4481 * cref.cc: New file.
4482 * cref.h: New file.
4483 * options.h (class General_options): Add --print-symbol-counts.
4484 * main.cc (main): Issue defined symbol report if requested.
4485 * archive.cc (Archive::interpret_header): Make into a const member
4486 function.
4487 (Archive::add_symbols): Call Input_objects::archive_start and
4488 archive_stop.
4489 (Archive::const_iterator): Define new class.
4490 (Archive::begin, Archive::end): New functions.
4491 (Archive::include_all_members): Rewrite to use iterator.
4492 (Archive::count_members): New function.
4493 * archive.h (class Archive): Update declarations.
4494 (Archive::filename): New function.
4495 * object.cc: Include "cref.h".
4496 (Sized_relobj::Sized_relobj): Initialize defined_count_.
4497 (Sized_relobj::do_get_global_symbol_counts): New function.
4498 (Input_objects::add_object): Add object to cross-referencer.
4499 (Input_objects::archive_start): New function.
4500 (Input_objects::archive_stop): New function.
4501 (Input_objects::print_symbol_counts): New function.
4502 * object.h: Declare Cref and Archive.
4503 (Object::get_global_symbol_counts): New function.
4504 (Object::do_get_global_symbol_counts): New pure virtual function.
4505 (class Sized_relobj): Add defined_count_ field. Update
4506 declarations.
4507 (class Input_objects): Add cref_ field. Update constructor.
4508 Update declarations.
4509 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
4510 defined_count_.
4511 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
4512 symbol counts.
4513 (Sized_dynobj::do_get_global_symbol_counts): New function.
4514 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
4515 defined_count_. Update declarations. Define Symbols typedef.
4516 * symtab.cc (Symbol_table::add_from_relobj): Add defined
4517 parameter. Change all callers.
4518 (Symbol_table::add_from_dynobj): Add sympointers and defined
4519 parameters. Change all callers.
4520 * symtab.h (class Symbol_table): Update declarations.
4521 * Makefile.am (CCFILES): Add cref.cc.
4522 (HFILES): Add cref.h.
4523 * Makefile.in: Rebuild.
4524
4525 2008-07-22 Simon Baldwin <simonb@google.com>
4526
4527 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
4528 to zero when writing undefined symbols.
4529
4530 2008-07-22 Ian Lance Taylor <iant@google.com>
4531
4532 * output.cc (Output_section::add_input_section): Don't try to
4533 merge empty merge sections.
4534
4535 2008-07-21 Craig Silverstein <csilvers@google.com>
4536
4537 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
4538 Include symbol version in error message.
4539
4540 2008-07-20 Chris Demetriou <cgd@google.com>
4541
4542 * configure.ac (gold_cv_c_random_seed): New configured variable.
4543 (RANDOM_SEED_CFLAGS): New substituted variable.
4544 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
4545 * configure: Rebuild.
4546 * Makefile.in: Likewise.
4547 * testsuite/Makefile.in: Likewise.
4548
4549 2008-07-18 Ian Lance Taylor <iant@google.com>
4550
4551 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
4552 where we see NAME/NULL and NAME/VERSION as separate symbols.
4553 * testsuite/ver_test_main.cc (main): Call t4.
4554 (t4, t4_2a): Define.
4555 * testsuite/ver_test_2.cc (t4_2): Define.
4556 * testsuite/ver_test_2.script: Put t4_2a in VER2.
4557 * testsuite/ver_test_4.cc (t4_2a): Define.
4558 * testsuite/ver_test_4.script: Put t4_2a in VER2.
4559 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
4560
4561 2008-07-17 Ian Lance Taylor <iant@google.com>
4562
4563 * dynobj.cc (Versions::add_def): If we give an error about a
4564 missing version, go ahead and create the version anyhow.
4565
4566 2008-07-10 Ian Lance Taylor <iant@google.com>
4567
4568 Handle output sections with more than 0x7fffffff bytes.
4569 * object.h (class Relobj): Change map_to_output_ to
4570 output_sections_, and just keep a section pointer. Change all
4571 uses. Move comdat group support to Sized_relobj.
4572 (Relobj::is_section_specially_mapped): Remove.
4573 (Relobj::output_section): Remove poff parameter. Change all
4574 callers.
4575 (Relobj::output_section_offset): New function.
4576 (Relobj::set_section_offset): Rewrite.
4577 (Relobj::map_to_output): Remove.
4578 (Relobj::output_sections): New function.
4579 (Relobj::do_output_section_offset): New pure virtual function.
4580 (Relobj::do_set_section_offset): Likewise.
4581 (class Sized_relobj): Add section_offsets_ field. Add comdat
4582 group support from Relobj. Update declarations.
4583 (Sized_relobj::get_output_section_offset): New function.
4584 (Sized_relobj::do_output_section_offset): New function.
4585 (Sized_relobj::do_set_section_offset): New function.
4586 * object.cc (Relobj::output_section_address): Remove.
4587 (Sized_relobj::Sized_relobj): Initialize new fields.
4588 (Sized_relobj::include_section_group): Cast find_kept_object to
4589 Sized_relobj.
4590 (Sized_relobj::include_linkonce_section): Likewise.
4591 (Sized_relobj::do_layout): Use separate arrays for output section
4592 and output offset.
4593 (Sized_relobj::do_count_local_symbols): Change map_to_output to
4594 output_sections.
4595 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
4596 output_sections and section_offsets.
4597 (Sized_relobj::write_local_symbols): Likewise.
4598 (map_to_kept_section): Compute output address directly.
4599 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
4600 output_sections and section_offsets.
4601 (Sized_relobj::write_sections): Likewise.
4602 (Sized_relobj::relocate_sections): Likewise.
4603 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
4604 * output.h (class Output_reloc): Update declarations. Change
4605 u2_.relobj to Sized_relobj*.
4606 (class Output_data_reloc): Change add functions to use
4607 Sized_relobj*.
4608 * output.cc (Output_reloc::Output_reloc): Change relobj to
4609 Sized_relobj*.
4610 (Output_reloc::local_section_offset): Change return type to
4611 Elf_Addr. Use get_output_section_offset.
4612 (Output_reloc::get_address): Likewise.
4613 (Output_section::is_input_address_mapped): Don't call
4614 is_section_specially_mapped.
4615 (Output_section::output_offset): Likewise.
4616 (Output_section::output_address): Likewise.
4617 (Output_section::starting_output_address): Likewise.
4618 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
4619 parameter to Sized_relobj*.
4620 (Copy_relocs::need_copy_reloc): Likewise.
4621 (Copy_relocs::save): Likewise.
4622 * copy-relocs.h (class Copy_relocs): Update declarations.
4623 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
4624 Sized_relobj*. Change relobj_ field to Sized_relobj*.
4625 * target-reloc.h (relocate_for_relocatable): Change
4626 offset_in_output_section type to Elf_Addr. Change code that uses
4627 it as well.
4628 * layout.cc (Layout::layout): Always set *off.
4629 * mapfile.cc (Mapfile::print_input_section): Use
4630 output_section_offset.
4631 * i386.cc (Target_i386::copy_reloc): Change object parameter to
4632 Sized_relobj*.
4633 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
4634 * sparc.cc (Target_sparc::copy_reloc): Likewise.
4635 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
4636
4637 2008-07-03 Ian Lance Taylor <iant@google.com>
4638
4639 * layout.cc (Layout::include_section): Do not discard unrecognized
4640 SHT_STRTAB sections.
4641
4642 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
4643
4644 * script.cc (Lex::can_continue_name): Make '?' allowable in
4645 version-script names.
4646 * testsuite/version_script.map: Change glob pattern to use '?'
4647
4648 2008-06-30 Manish Singh <yosh@gimp.org>
4649
4650 PR 6585
4651 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
4652 Correct typo.
4653
4654 2008-06-30 Ian Lance Taylor <iant@google.com>
4655
4656 PR 6660
4657 PR 6682
4658 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
4659 versions]: Don't try to read the value in the contents, since we
4660 don't use it. Use the template endianness when writing.
4661
4662 2008-06-25 Cary Coutant <ccoutant@google.com>
4663
4664 * fileread.cc (File_read::make_view): Assert on zero-length view.
4665 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
4666 symbol table when there are no symbols to read.
4667
4668 2008-06-23 Craig Silverstein <csilvers@google.com>
4669
4670 * version.cc (version_string): Bump to 1.7
4671
4672 2008-06-18 Craig Silverstein <csilvers@google.com>
4673
4674 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
4675 constant 0xFFFF to type Valtype.
4676 (Powerpc_relocate_functions::rel16_ha): Likewise.
4677
4678 2008-06-17 Ian Lance Taylor <iant@google.com>
4679
4680 * output.h (Output_section::Input_section): Initialize p2align_ to
4681 zero for Output_section_data constructors.
4682 (Output_section::Input_section::addralign): If not an input
4683 section, return the alignment of the Output_section_data.
4684 * testsuite/copy_test.cc: New file.
4685 * testsuite/copy_test_1.cc: New file.
4686 * testsuite/copy_test_2.cc: New file.
4687 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
4688 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
4689 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
4690 (copy_test_1_pic.o, copy_test_1.so): New targets.
4691 (copy_test_2_pic.o, copy_test_2.so): New targets.
4692 * testsuite/Makefile.in: Rebuild.
4693
4694 * script-sections.cc (Script_sections::place_orphan): Initialize
4695 local variable exact.
4696
4697 2008-06-13 David Edelsohn <edelsohn@gnu.org>
4698
4699 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
4700
4701 2008-06-12 David Edelsohn <edelsohn@gnu.org>
4702 David S. Miller <davem@davemloft.net>
4703
4704 * powerpc.cc: New file.
4705 * Makefile.am (TARGETSOURCES): Add powerpc.cc
4706 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
4707 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
4708 * Makefile.in: Rebuild.
4709
4710 2008-06-09 Ian Lance Taylor <iant@google.com>
4711
4712 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
4713 <exception>.
4714 (throwing, orig_terminate): New static variables.
4715 (terminate_handler): New static function.
4716 (t2): Set terminate handler.
4717
4718 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
4719
4720 PR 6584
4721 * binary.cc (Binary_to_elf::sized_convert): Fix .data
4722 alignment.
4723
4724 2008-05-30 Cary Coutant <ccoutant@google.com>
4725
4726 * archive.cc (Archive::include_all_members) Correct to step
4727 over symbol table and extended name table in thin archives.
4728
4729 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
4730
4731 PR 6407
4732 * target-reloc.h (relocate_for_relocatable): Fix new_offset
4733 calculation.
4734
4735 2008-05-28 Caleb Howe <cshowe@google.com>
4736
4737 * reduced_debug_output.cc: New file.
4738 * reduced_debug_output.h: New file.
4739 * options.h (class General_options): Add --strip-debug-non-line.
4740 * options.cc (General_options::finalize): Add strip_debug_non_line
4741 to the strip heirarchy.
4742 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
4743 fields.
4744 * layout.cc: Include "reduced_debug_output.h".
4745 (Layout::Layout): Initialize new fields.
4746 (line_only_debug_sections): New static array.
4747 (is_lines_only_debug_sections): New static inline function.
4748 (Layout::include_section): Handle --strip-debug-non-line.
4749 (Layout::make_output_section): If --strip-debug-non-line, build
4750 new output sections for .debug_abbrev and .debug_info.
4751 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
4752 gold. Warn about possible overflow.
4753 (read_signed_LEB_128): Likewise.
4754 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
4755 (read_signed_LEB_128): Declare.
4756 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
4757 (HFILES): Add reduced_debug_output.h.
4758 * Makefile.in: Rebuild.
4759
4760 2008-05-21 Ian Lance Taylor <iant@google.com>
4761
4762 * mapfile.cc: New file.
4763 * mapfile.h: New file.
4764 * options.h (class General_options): Add -M/--print-map and -Map.
4765 * options.cc (General_options::finalize): Make -M equivalent to
4766 -Map -.
4767 * main.cc: Include <cstdio> and "mapfile.h".
4768 (main): Open mapfile if requested.
4769 * gold.cc (class Middle_runner): Add mapfile_ field. Update
4770 constructor. Change caller.
4771 (queue_initial_tasks): Add mapfile parameter. Change caller.
4772 (queue_middle_tasks): Likewise.
4773 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
4774 declarations.
4775 * archive.cc: Include "mapfile.h".
4776 (Archive::add_symbols): Add mapfile parameter. Change all
4777 callers. Pass mapfile, symbol, and reason to include_member.
4778 (Archive::include_all_members): Add mapfile parameter. Change all
4779 callers.
4780 (Archive::include_member): Add mapfile, sym, and why parameters.
4781 Change all callers. Report inclusion to map file.
4782 * archive.h: Include "fileread.h".
4783 (class Archive): Update declarations.
4784 (Archive::file): New const method.
4785 (class Add_archive_symbols): Add mapfile_ field. Update
4786 constructor. Change all callers.
4787 * readsyms.h (class Read_symbols): Likewise.
4788 (class Finish_group): Likewise.
4789 (class Read_script): Likewise.
4790 * common.cc: Include "mapfile.h".
4791 (Symbol_table::allocate_commons): Add mapfile parameter. Change
4792 all callers.
4793 (Symbol_table::do_allocate_commons): Likewise.
4794 (Symbol_table::do_allocate_commons_list): Likewise. Report common
4795 symbol allocation to mapfile.
4796 * common.h (class Allocate_commons_task): Add mapfile_ field.
4797 Update constructor. Change all callers.
4798 * symtab.h (class Symbol_table): Update declarations.
4799 * layout.cc: Include "mapfile.h".
4800 (Layout_task_runner::run): Print information to mapfile.
4801 (Layout::create_gold_note): Change Output_data_fixed_space to
4802 Output_data_zero_fill.
4803 (Layout::create_build_id): Likewise.
4804 (Layout::print_to_mapfile): New function.
4805 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
4806 constructor. Change caller.
4807 (class Layout): Declare print_to_mapfile.
4808 * output.cc (Output_section::Input_section::print_to_mapfile): New
4809 function.
4810 (Output_section::add_input_section): If producing a map, always
4811 add to input_sections_ list.
4812 (Output_section::do_print_to_mapfile): New function.
4813 (Output_segment::print_sections_to_mapfile): New function.
4814 (Output_segment::print_section_list_to_mapfile): New function.
4815 * output.h: Include "mapfile.h".
4816 (Output_data::print_to_mapfile): New function.
4817 (Output_data::do_print_to_mapfile): New virtual function.
4818 (Output_segment_headers::do_print_to_mapfile): New function.
4819 (Output_file_header::do_print_to_mapfile): New function.
4820 (Output_data_const::do_print_to_mapfile): New function.
4821 (class Output_data_const_buffer): Add map_name_ field. Update
4822 constructor. Change all callers. Add do_print_to_mapfile
4823 function.
4824 (class Output_data_fixed_space): Likewise.
4825 (class Output_data_space): Likewise.
4826 (class Output_data_zero_fill): New class.
4827 (Output_data_strtab::do_print_to_mapfile): New function.
4828 (Output_data_reloc_base::do_print_to_mapfile): New function.
4829 (Output_relocatable_relocs::do_print_to_mapfile): New function.
4830 (Output_data_group::do_print_to_mapfile): New function.
4831 (Output_data_got::do_print_to_mapfile): New function.
4832 (Output_data_dynamic::do_print_to_mapfile): New function.
4833 (Output_symtab_xindex::do_print_to_mapfile): New function.
4834 (class Output_section): Declare do_print_to_mapflie. Declare
4835 print_to_mapfile in Input_section.
4836 (class Output_segment): Declare new functions.
4837 * object.h (Sized_relobj::symbol_count): New function.
4838 * script-sections.cc
4839 (Output_section_element_dot_assignment::set_section_addresses):
4840 Change Output_data_fixed_space to Output_data_zero_fill.
4841 (Output_data_expression::do_print_to_mapfile): New function.
4842 * script.cc (read_input_script): Add mapfile parameter. Change
4843 all callers.
4844 * script.h (read_input_script): Update declaration.
4845 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
4846 (Eh_frame::do_print_to_mapfile): New function.
4847 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
4848 (Output_merge_string::do_print_to_mapfile): New function.
4849 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
4850 function.
4851 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
4852 function.
4853 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
4854 function.
4855 * Makefile.am (CCFILES): Add mapfile.cc.
4856 (HFILES): Add mapfile.h.
4857 * Makefile.in: Rebuild.
4858
4859 2008-05-19 Ian Lance Taylor <iant@google.com>
4860
4861 * options.h (class General_options): Add -z relro.
4862 * layout.cc (Layout::Layout): Initialize relro_segment_.
4863 (Layout::add_output_section_data): Return the output section.
4864 (Layout::make_output_section): Rcognize relro sections and mark
4865 them appropriately.
4866 (Layout::attach_allocated_section_to_segment): Put relro sections
4867 in a PT_GNU_RELRO segment.
4868 (Layout::create_initial_dynamic_sections): Mark the .dynamic
4869 section as relro.
4870 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
4871 PT_TLS segments.
4872 (Layout::linkonce_mapping): Map d.rel.ro.local to
4873 .data.rel.ro.local.
4874 (Layout::output_section_name): Us .data.rel.ro.local for any
4875 section which begins with that.
4876 * layout.h (class Layout): Update add_output_section_data
4877 declaration. Add relro_segment_ field.
4878 * output.cc (Output_section::Output_section): Initialize is_relro_
4879 and is_relro_local_ fields.
4880 (Output_segment::add_output_section): Group relro sections.
4881 (Output_segment::is_first_section_relro): New function.
4882 (Output_segment::maximum_alignment): If there is a relro section,
4883 align the segment to the common page size.
4884 (Output_segment::set_section_addresses): Track whether we are
4885 looking at relro sections. If the last section is a relro
4886 section, align to the common page size.
4887 (Output_segment::set_section_list_addresses): Add in_relro
4888 parameter. Change all callers. Align to the page size when
4889 moving from relro to non-relro section.
4890 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
4891 segment.
4892 * output.h (class Output_section): Add is_relro_ and
4893 is_relro_local_ fields.
4894 (Output_section::is_relro): New function.
4895 (Output_section::set_is_relro): New function.
4896 (Output_section::is_relro_local): New function.
4897 (Output_section::set_is_relro_local): New function.
4898 (class Output_segment): Update declarations.
4899 * i386.cc (Target_i386::got_section): Mark .got section as relro.
4900 * sparc.cc (Target_sparc::got_section): Likewise.
4901 * x86_64.cc (Target_x86_64::got_section): Likewise.
4902 * testsuite/relro_test_main.cc: New file.
4903 * testsuite/relro_test.cc: New file.
4904 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
4905 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
4906 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
4907 (relro_test.so, relro_test_pic.o): New targets.
4908 * testsuite/Makefile.in: Rebuild.
4909
4910 2008-05-16 Ian Lance Taylor <iant@google.com>
4911
4912 * output.cc (Output_segment::add_output_section): Remove front
4913 parameter.
4914 * output.h (class Output_segment): Remove
4915 add_initial_output_section and overloaded add_output_section.
4916 Update declaration of remaining add_output_section.
4917 * layout.cc (Layout::create_interp): Call add_output_section
4918 rather than add_initial_output_section.
4919 (Layout::finish_dynamic_section): Likewise.
4920
4921 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
4922 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
4923 know the dynamic type.
4924 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
4925 field. Initialize it in constructor.
4926 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
4927 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
4928 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
4929 reloc.
4930
4931 * output.cc (Output_reloc::get_address): Change return type to
4932 Elf_Addr.
4933 * output.h (class Output_reloc): Update get_address declaration.
4934 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
4935 for section addresses.
4936
4937 2008-05-09 Ian Lance Taylor <iant@google.com>
4938
4939 PR 6493
4940 * gold.cc (gold_nomem): Use return value of write.
4941
4942 2008-05-08 Ian Lance Taylor <iant@google.com>
4943
4944 * symtab.c (Symbol::init_base_output_data): Add version
4945 parameter. Change all callers.
4946 (Symbol::init_base_output_segment): Likewise.
4947 (Symbol::init_base_constant): Likewise.
4948 (Symbol::init_base_undefined): Likewise.
4949 (Sized_symbol::init_output_data): Likewise.
4950 (Sized_symbol::init_output_segment): Likewise.
4951 (Sized_symbol::init_constant): Likewise.
4952 (Sized_symbol::init_undefined): Likewise.
4953 (Symbol_table::do_define_in_output_data): If the new symbol has a
4954 version, mark it as the default.
4955 (Symbol_table::do_define_in_output_segment): Likewise.
4956 (Symbol_table::do_define_as_constant): Likewise.
4957 * symtab.h (class Symbol): Update declarations.
4958 (class Sized_symbol): Likewise.
4959 * resolve.cc (Symbol::override_version): New function.
4960 (Symbol::override_base): Call override_version.
4961 (Symbol::override_base_with_special): Likewise.
4962 * testsuite/ver_script_8.script: New file.
4963 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
4964 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
4965 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
4966 (ver_test_8_1.so, ver_test_8_2.so): New targets.
4967
4968 2008-05-06 Ian Lance Taylor <iant@google.com>
4969
4970 PR 6049
4971 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
4972 functions.
4973 (class General_options): Remove existing --undefined, and add
4974 --no-undefined instead. Add new --undefined as synonym for -u.
4975 * archive.cc (Archive::add_symbols): Check whether symbol was
4976 named with -u.
4977 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
4978 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
4979 all uses. Add IS_UNDEFINED. Update declarations to split
4980 different versions of init_base. Declare init_base_undefined.
4981 (Symbol::is_defined): Handle IS_UNDEFINED.
4982 (Symbol::is_undefined): Likewise.
4983 (Symbol::is_weak_undefined): Call is_undefined.
4984 (Symbol::is_absolute): Handle IS_CONSTANT.
4985 (class Sized_symbol): Update declarations to split different
4986 versions of init. Declare init_undefined.
4987 (class Symbol_table): Declare new functions.
4988 * symtab.cc (Symbol::init_base_object): Rename from init_base.
4989 Change all callers.
4990 (Symbol::init_base_output_data): Likewise.
4991 (Symbol::init_base_output_segment): Likewise.
4992 (Symbol::init_base_constant): Likewise.
4993 (Symbol::init_base_undefined): New function.
4994 (Sized_symbol::init_object): Rename from init. Change all
4995 callers.
4996 (Sized_symbol::init_output_data): Likewise.
4997 (Sized_symbol::init_output_segment): Likewise.
4998 (Sized_symbol::init_constant): Likewise.
4999 (Sized_symbol::init_undefined): New function.
5000 (Symbol_table::add_undefined_symbols_from_command_line): New
5001 function.
5002 (Symbol_table::do_add_undefined_symbols_from_command_line): New
5003 function.
5004 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
5005 (Symbol::output_section): Likewise.
5006 (Symbol::set_output_section): Likewise.
5007 (Symbol_table::sized_finalize_symbol): Likewise.
5008 (Symbol_table::sized_write_globals): Likewise.
5009 * resolve.cc (Symbol_table::should_override): Likewise.
5010 (Symbol::override_base_with_special): Likewise.
5011
5012 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
5013 symbol, change it to have default visibility.
5014 * testsuite/protected_1.cc: New file.
5015 * testsuite/protected_2.cc: New file.
5016 * testsuite/protected_3.cc: New file.
5017 * testsuite/protected_main_1.cc: New file.
5018 * testsuite/protected_main_2.cc: New file.
5019 * testsuite/protected_main_3.cc: New file.
5020 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
5021 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
5022 (protected_1_LDFLAGS, protected_1_LDADD): Define.
5023 (protected_1.so): New target.
5024 (protected_1_pic.o, protected_2_pic.o): New targets.
5025 (protected_3_pic.o): New target.
5026 (check_PROGRAMS): Add protected_2.
5027 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
5028 (protected_2_LDFLAGS, protected_2_LDADD): Define.
5029 * testsuite/Makefile.in: Rebuild.
5030
5031 * options.h (DEFINE_var): Add set_user_set_##varname__.
5032 (DEFINE_bool_alias): New macro.
5033 (class General_options): Define -Bstatic using DEFINE_bool_alias
5034 rather than DEFINE_special. Add --undefined as an alias for -z
5035 defs.
5036 * options.cc (General_options::parse_Bstatic): Remove.
5037
5038 * options.h (class General_options): Add --fatal-warnings.
5039 * main.cc (main): Implement --fatal-warnings.
5040 * errors.h (Errors::warning_count): New function.
5041
5042 * options.h (class General_options): Add -Bsymbolic-functions.
5043 * symtab.h (Symbol::is_preemptible): Check for
5044 -Bsymbolic-functions.
5045
5046 2008-05-05 Ian Lance Taylor <iant@google.com>
5047
5048 * options.h (DEFINE_bool): For DASH_Z, create the negative option
5049 as noVARNAME rather than no-VARNAME.
5050 (class General_options): Add option -z combreloc.
5051 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
5052 get_address.
5053 (Output_reloc::sort_before) [SHT_REL]: New function.
5054 (Output_reloc::sort_before) [SHT_RELA]: New function.
5055 (class Output_data_reloc_base): Add sort_relocs_ field. Define
5056 Sort_relocs_comparison.
5057 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
5058 parameter. Change all callers.
5059 (Output_data_reloc::Output_data_reloc) [both versions]: Add
5060 sort_relocs parameter. Change all callers.
5061 * output.cc (Output_reloc::get_address): New function, broken out
5062 of write_rel.
5063 (Output_reloc::write_rel): Call it.
5064 (Output_reloc::compare): New function.
5065 (Output_data_reloc_base::do_write): Optionally sort relocs.
5066
5067 * configure.ac: If targ_extra_obj is set, link it in.
5068 * configure.tgt: Initialize all variables.
5069 (x86_64*): Set targ_extra_obj and targ_extra_size.
5070 * configure: Rebuild.
5071
5072 * object.cc (Sized_relobj::include_section_group): Adjust section
5073 indexes read from group data. Build vector to pass to
5074 layout_group.
5075 * layout.cc (Layout::layout_group): Add flags and shndxes
5076 parameters. Remove contents parameter. Change caller. Update
5077 explicit instantiations.
5078 * layout.h (class Layout): Update layout_group declaration.
5079 * output.cc (Output_data_group::Output_data_group): Add flags and
5080 input_shndxes parameters. Remove contents parameter. Change
5081 caller.
5082 (Output_data_group::do_write): Change input_sections_ to
5083 input_shndxes_.
5084 * output.h (class Output_data_group): Update constructor
5085 declaration. Rename input_sections_ to input_shndxes_.
5086 * testsuite/many_sections_test.cc: Add template.
5087
5088 2008-04-30 Cary Coutant <ccoutant@google.com>
5089
5090 * target-reloc.h (relocate_section): Fix dead-pointer bug.
5091
5092 * layout.cc (Layout::include_section): Refactored check for debug
5093 info section.
5094 (Layout::add_comdat): Add new parameters. Change type
5095 of signature parameter. Add object and shndx to signatures table.
5096 (Layout::find_kept_object): New function.
5097 * layout.h: Include <cstring>.
5098 (Layout::is_debug_info_section): New function.
5099 (Layout::add_comdat): Add new parameters.
5100 (Layout::find_kept_object): New function.
5101 (Layout::Kept_section): New struct.
5102 (Layout::Signatures): Change type of map range.
5103 * object.cc (Relobj::output_section_address): New function.
5104 (Sized_relobj::include_section_group): Add new parameters. Change
5105 calls to Layout::add_comdat. Change to build table of kept comdat
5106 groups and table mapping discarded sections to kept sections.
5107 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
5108 (Sized_relobj::do_layout): Change calls to include_section_group and
5109 include_linkonce_section.
5110 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
5111 value to zero when section is discarded.
5112 (Sized_relobj::map_to_kept_section): New function.
5113 * object.h (Relobj::output_section_address): New function.
5114 (Relobj::Comdat_group): New type.
5115 (Relobj::find_comdat_group): New function.
5116 (Relobj::Comdat_group_table): New type.
5117 (Relobj::Kept_comdat_section): New type.
5118 (Relobj::Kept_comdat_section_table): New type.
5119 (Relobj::add_comdat_group): New function.
5120 (Relobj::set_kept_comdat_section): New function.
5121 (Relobj::get_kept_comdat_section): New function.
5122 (Relobj::comdat_groups_): New field.
5123 (Relobj::kept_comdat_sections_): New field.
5124 (Symbol_value::input_value): Update comment.
5125 (Sized_relobj::map_to_kept_section) New function.
5126 (Sized_relobj::include_linkonce_section): Add new parameter.
5127 * target-reloc.h (Comdat_behavior): New type.
5128 (get_comdat_behavior): New function.
5129 (relocate_section): Add code to map a discarded section to the
5130 corresponding kept section when applying a relocation.
5131
5132 2008-04-30 Craig Silverstein <csilvers@google.com>
5133
5134 * dwarf_reader.cc (next_generation_count): New static var.
5135 (Addr2line_cache_entry): New struct.
5136 (addr2line_cache): New static var.
5137 (Dwarf_line_info::one_addr2line): Added caching.
5138 (Dwarf_line_info::clear_addr2line_cache): New function.
5139 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
5140 cache-size parameter.
5141 (Dwarf_line_info::one_addr2line_cache): New function.
5142 * symtab.cc (Symbol_table::detect_odr_violations): Pass
5143 new cache-size argument to one_addr2line(), and clear cache.
5144
5145 2008-04-28 Cary Coutant <ccoutant@google.com>
5146
5147 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
5148 R_386_PC8 relocations.
5149
5150 2008-04-23 Ian Lance Taylor <iant@google.com>
5151
5152 * object.cc (Sized_relobj::include_section_group): Check for
5153 invalid section group.
5154
5155 * object.cc (make_elf_object): Correct test for 64-bit ELF file
5156 header size.
5157
5158 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
5159 than read for file header.
5160 * archive.cc (Archive::include_member): Likewise.
5161
5162 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
5163
5164 * aclocal.m4: Regenerate.
5165 * configure: Regenerate.
5166
5167 2008-04-19 Ian Lance Taylor <iant@google.com>
5168
5169 * version.cc (version_string): Bump to 1.6.
5170
5171 * testsuite/Makefile.am (many_sections_r_test): New target.
5172 (many_sections_r_test_SOURCES): Remove.
5173 (many_sections_r_test_DEPENDENCIES): Remove.
5174 (many_sections_r_test_LDFLAGS): Remove.
5175 (many_sections_r_test_LDADD): Remove.
5176
5177 * object.cc (Sized_relobj::do_add_symbols): Always pass
5178 local_symbol_count_ to add_from_relobj.
5179
5180 * testsuite/Makefile.am (many_sections_check.h): Only check one in
5181 every thousand variables.
5182 * testsuite/Makefile.in: Rebuild.
5183
5184 * object.cc (Xindex::initialize_symtab_xindex): New function.
5185 (Xindex::read_symtab_xindex): New function.
5186 (Xindex::sym_xindex_to_shndx): New function.
5187 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
5188 available.
5189 (Sized_relobj::do_initialize_xindex): New function.
5190 (Sized_relobj::do_read_symbols): Adjust section links.
5191 (Sized_relobj::symbol_section_and_value): Add is_ordinary
5192 parameter. Change all callers.
5193 (Sized_relobj::include_section_group): Adjust section links and
5194 symbol section indexes.
5195 (Sized_relobj::do_layout): Adjust section links.
5196 (Sized_relobj::do_count_local_symbols): Adjust section links and
5197 symbol section indexes.
5198 (Sized_relobj::do_finalize_local_symbols): Distinguish between
5199 ordinary and special symbols.
5200 (Sized_relobj::write_local_symbols): Add symtab_xindex and
5201 dynsym_xindex parameters. Change all callers. Adjust section
5202 links. Use SHN_XINDEX when needed.
5203 (Sized_relobj::get_symbol_location_info): Adjust section links.
5204 Don't get fooled by special symbols.
5205 * object.h (class Xindex): Define.
5206 (class Object): Add xindex_ parameter. Declare virtual functoin
5207 do_initialize_xindex.
5208 (Object::adjust_sym_shndx): New function.
5209 (Object::set_xindex): New protected function.
5210 (class Symbol_value): Add is_ordinary_shndx_ field.
5211 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
5212 (Symbol_value::value): Assert ordinary section.
5213 (Symbol_value::initialize_input_to_output_map): Likewise.
5214 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
5215 Change all callers.
5216 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
5217 all callers.
5218 (class Sized_relobj): Update declarations.
5219 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
5220 parameter. Change all callers.
5221 (Sized_relobj::adjust_shndx): New function.
5222 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
5223 field.
5224 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
5225 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
5226 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
5227 (Sized_dynobj::read_dynsym_section): Adjust section links.
5228 (Sized_dynobj::read_dynamic): Likewise.
5229 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
5230 section links.
5231 (Sized_dynobj::do_initialize_xindex): New function.
5232 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
5233 do_initialize_xindex.
5234 (Sized_dynobj::adjust_shndx): New function.
5235 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
5236 dynsym_xindex_ fields.
5237 (Layout::finalize): Add a call to set_section_indexes before
5238 creating the symtab sections.
5239 (Layout::set_section_indexes): Don't do anything if the section
5240 already has a section index.
5241 (Layout::create_symtab_sections): Add shnum parameter. Change
5242 caller. Create .symtab_shndx section if needed.
5243 (Layout::create_shdrs): Add shstrtab_section parameter. Change
5244 caller.
5245 (Layout::allocated_output_section_count): New function.
5246 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
5247 needed.
5248 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
5249 fields. Update declarations.
5250 (Layout::symtab_xindex): New function.
5251 (Layout::dynsym_xindex): New function.
5252 (class Write_symbols_task): Add layout_ field.
5253 (Write_symbols_task::Write_symbols_task): Add layout parameter.
5254 Change caller.
5255 * output.cc (Output_section_headers::Output_section_headers): Add
5256 shstrtab_section parameter. Change all callers.
5257 (Output_section_headers::do_sized_write): Store overflow values
5258 for section count and section string table section index in
5259 section header zero.
5260 (Output_file_header::do_sized_write): Check for overflow of
5261 section count and section string table section index.
5262 (Output_symtab_xindex::do_write): New function.
5263 (Output_symtab_xindex::endian_do_write): New function.
5264 * output.h (class Output_section_headers): Add shstrtab_section_.
5265 Update declarations.
5266 (class Output_symtab_xindex): Define.
5267 (Output_section::has_out_shndx): New function.
5268 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
5269 field.
5270 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
5271 Change all callers.
5272 (Sized_symbol::init): Likewise.
5273 (Symbol::output_section): Check for ordinary symbol.
5274 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
5275 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
5276 callers.
5277 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
5278 Change all callers. Simplify handling of symbols from sections
5279 not included in the link.
5280 (Symbol_table::add_from_dynobj): Handle ordinary symbol
5281 distinction.
5282 (Weak_alias_sorter::operator()): Assert that symbols are
5283 ordinary.
5284 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
5285 distinction.
5286 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
5287 parameters. Change all callers.
5288 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
5289 symbol distinction. Use SHN_XINDEX when needed.
5290 (Symbol_table::write_section_symbol): Add symtab_xindex
5291 parameter. Change all callers.
5292 (Symbol_table::sized_write_section_symbol): Likewise. Use
5293 SHN_XINDEX when needed.
5294 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
5295 declarations.
5296 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
5297 (Symbol::is_defined): Check is_ordinary.
5298 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
5299 (Symbol::is_absolute, Symbol::is_common): Likewise.
5300 (class Sized_symbol): Update declarations.
5301 (class Symbol_table): Update declarations.
5302 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
5303 parameters. Change all callers.
5304 (Sized_symbol::override): Likewise.
5305 (Symbol_table::override): Likewise.
5306 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
5307 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
5308 is_ordinary, and orig_st_shndx parameters. Change all callers.
5309 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
5310 to be in an ordinary section.
5311 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
5312 object and is_ordinary parameters. Change all callers.
5313 (Sized_dwarf_line_info::read_relocs): Add object parameter.
5314 Change all callers. Don't add undefined or non-ordinary symbols
5315 to reloc_map_.
5316 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
5317 Change all callers.
5318 * dwarf_reader.h (class Sized_dwarf_line_info): Update
5319 declarations.
5320 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
5321 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
5322 (Sized_relobj::relocate_sections): Likewise.
5323 * target-reloc.h (scan_relocs): Adjust section symbol index.
5324 (scan_relocatable_relocs): Likewise.
5325 * i386.cc (Scan::local): Check for ordinary symbols.
5326 * sparc.cc (Scan::local): Likewise.
5327 * x86_64.cc (Scan::local): Likewise.
5328 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
5329 to symbol_section_and_value.
5330 * testsuite/many_sections_test.cc: New file.
5331 * testsuite/Makefile.am (BUILT_SOURCES): Define.
5332 (check_PROGRAMS): Add many_sections_test.
5333 (many_sections_test_SOURCES): Define.
5334 (many_sections_test_DEPENDENCIES): Define.
5335 (many_sections_test_LDFLAGS): Define.
5336 (BUILT_SOURCES): Add many_sections_define.h.
5337 (many_sections_define.h): New target.
5338 (BUILT_SOURCES): Add many_sections_check.h.
5339 (many_sections_check.h): New target.
5340 (check_PROGRAMS): Add many_sections_r_test.
5341 (many_sections_r_test_SOURCES): Define.
5342 (many_sections_r_test_DEPENDENCIES): Define.
5343 (many_sections_r_test_LDFLAGS): Define.
5344 (many_sections_r_test_LDADD): Define.
5345 (many_sections_r_test.o): New target.
5346 * testsuite/Makefile.in: Rebuild.
5347
5348 2008-04-17 Cary Coutant <ccoutant@google.com>
5349
5350 * errors.cc (Errors::info): New function.
5351 (gold_info): New function.
5352 * errors.h (Errors::info): New function.
5353 * gold.h (gold_info): New function.
5354 * object.cc (Input_objects::add_object): Print trace output.
5355 * options.cc (options::parse_set): New function.
5356 (General_options::parse_wrap): Deleted.
5357 (General_options::General_options): Deleted initializer.
5358 * options.h (options::String_set): New typedef.
5359 (options::parse_set): New function.
5360 (DEFINE_set): New macro.
5361 (General_options::wrap): Changed to use DEFINE_set. Changed
5362 callers of any_wrap_symbols and is_wrap_symbol.
5363 (General_options::trace, General_options::trace_symbol):
5364 New options.
5365 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
5366 (General_options::wrap_symbols_): Deleted.
5367 * symtab.cc (Symbol_table::add_from_object): Print trace output.
5368
5369 2008-04-17 David S. Miller <davem@davemloft.net>
5370
5371 * options.cc (General_options::parse_V): New function.
5372 * options.h: Add entries for -V and -Qy.
5373
5374 2008-04-17 Ian Lance Taylor <iant@google.com>
5375
5376 * common.cc (Symbol_table::allocate_commons): Remove options
5377 parameter. Change caller.
5378 (Symbol_table::do_allocate_commons): Remove options parameter.
5379 Change caller. Just call do_allocate_commons_list twice.
5380 (Symbol_table::do_allocate_commons_list): New function, broken out
5381 of do_allocate_commons.
5382 * common.h (class Allocate_commons_task): Remove options_ field.
5383 Update constructor.
5384 * symtab.cc (Symbol_table::Symbol_table): Initialize
5385 tls_commons_.
5386 (Symbol_table::add_from_object): Put TLS common symbols on
5387 tls_commons_ list.
5388 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
5389 which are IN_OUTPUT_DATA.
5390 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
5391 allocate_commons and do_allocate_commons declarations. Declare
5392 do_allocate_commons_list.
5393 * gold.cc (queue_middle_tasks): Update creation of
5394 Allocate_commons_task to not pass options.
5395 * testsuite/Makefile.am (INCLUDES): Add -I.. .
5396 (TLS_TEST_C_FLAGS): New variable.
5397 (tls_test_c_pic.o): New target.
5398 (tls_test_shared.so): Link in tls_test_c_pic.o.
5399 (tls_test_c_pic_ie.o): New target.
5400 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
5401 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
5402 (tls_test_c.o): New target.
5403 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
5404 (tls_pic_test_LDADD): Likewise.
5405 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
5406 (tls_shared_gd_to_ie_test_LDADD): Likewise.
5407 (tls_test_c_gnu2.o): New target.
5408 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
5409 tls_test_c_gnu2.o.
5410 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
5411 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
5412 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
5413 * testsuite/tls_test.cc: Include "config.h".
5414 (t_last): Call t11_last.
5415 * testsuite/tls_test.h (t11, t11_last): Declare.
5416 * testsuite/tls_test_c.c: New file.
5417 * testsuite/tls_test_main.cc (thread_routine): Call t11.
5418 * configure.ac: Check for OpenMP support.
5419 * configure, config.in, Makefile.in: Rebuild.
5420 * testsuite/Makefile.in: Rebuild.
5421
5422 2008-04-16 Cary Coutant <ccoutant@google.com>
5423
5424 * i386.cc (Target_i386::define_tls_base_symbol): New function.
5425 (Target_i386::tls_base_symbol_defined_): New field.
5426 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
5427 (Target_i386::Scan::global): Likewise.
5428 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
5429 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
5430 (Target_x86_64::tls_base_symbol_defined_): New field.
5431 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
5432 (Target_x86_64::Scan::global): Likewise.
5433
5434 2008-04-16 Cary Coutant <ccoutant@google.com>
5435
5436 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
5437 (Symbol::needs_plt_entry): Allow weak undefined symbols.
5438 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
5439 building shared libraries.
5440 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
5441 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
5442 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
5443 * testsuite/Makefile.in: Rebuild.
5444 * testsuite/weak_undef.h: New file.
5445 * testsuite/weak_undef_file1.cc: Add extra test cases.
5446 * testsuite/weak_undef_file2.cc: Likewise.
5447 * testsuite/weak_undef_test.cc: Likewise.
5448
5449 2008-04-16 David S. Miller <davem@davemloft.net>
5450
5451 * sparc.cc (Target_sparc::Scan): Change from struct to class.
5452 Add issued_non_pic_error_ field. Declare check_non_pic.
5453 (Target_sparc::Scan::check_non_pic): New function.
5454 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
5455 (Target_sparc::Scan::global): Likewise.
5456
5457 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
5458 * configure: Rebuild.
5459
5460 * options.h (DEFINE_enable): New macro.
5461 (new_dtags): New enable option.
5462 (initfirst, interpose, loadfltr, nodefaultlib,
5463 nodelete, nodlopen, nodump): New -z options.
5464 * layout.cc (Layout:finish_dynamic_section): If new
5465 dtags enabled, emit DT_RUNPATH. Also, emit a
5466 DT_FLAGS_1 containing any specified -z flags.
5467
5468 2008-04-16 Ian Lance Taylor <iant@google.com>
5469
5470 * copy-relocs.cc: New file.
5471 * copy-relocs.h: New file.
5472 * reloc.cc: Remove Copy_relocs code.
5473 * reloc.h: Likewise.
5474 * reloc-types.h (struct Reloc_types) [both versions]: Add
5475 get_reloc_addend_noerror.
5476 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
5477 variants of add_global which take an addend which must be zero.
5478 * i386.cc: Include "copy-relocs.h".
5479 (class Target_i386): Change type of copy_relocs_ to variable,
5480 update initializer.
5481 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
5482 Change all callers.
5483 (Target_i386::do_finalize_sections): Change handling of
5484 copy_relocs_.
5485 * sparc.cc: Include "copy-relocs.h".
5486 (class Target_sparc): Change type of copy_relocs_ to variable,
5487 update initializer.
5488 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
5489 Change all callers.
5490 (Target_sparc::do_finalize_sections): Change handling of
5491 copy_relocs_.
5492 * x86_64.cc: Include "copy-relocs.h".
5493 (class Target_x86_64): Change type of copy_relocs_ to variable,
5494 update initializer.
5495 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
5496 class. Change all callers.
5497 (Target_x86_64::do_finalize_sections): Change handling of
5498 copy_relocs_.
5499 * Makefile.am (CCFILES): Add copy-relocs.cc.
5500 (HFILES): Add copy-relocs.h.
5501
5502 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
5503
5504 * testsuite/script_test_4.sh: Permit leading zeroes.
5505
5506 2008-04-15 Ian Lance Taylor <iant@google.com>
5507
5508 * script-sections.cc (Script_sections::create_segments): Use
5509 header_size_adjustment even when there is enough room for the
5510 headers.
5511 * testsuite/script_test_4.sh: New file.
5512 * testsuite/script_test_4.t: New file.
5513 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
5514 (check_DATA): Add script_test_4.stdout.
5515 (MOSTLYCLEANFILES): Likewise.
5516 (script_test_4): New target.
5517 (script_test_4.stdout): New target.
5518 * testsuite/Makefile.in: Rebuild.
5519
5520 * sparc.cc: Add definitions for Output_data_plt_sparc class
5521 constants.
5522
5523 2008-04-14 David S. Miller <davem@davemloft.net>
5524
5525 * sparc.cc: New file.
5526 * Makefile.am (TARGETSOURCES): Add sparc.cc
5527 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
5528 * configure.tgt: Document targ_extra_size and
5529 targ_extra_big_endian. Add entries for sparc-* and
5530 sparc64-*.
5531 * configure.ac: Handle targ_extra_size and
5532 targ_extra_big_endian.
5533 * Makefile.in: Rebuild.
5534 * configure: Likewise.
5535 * po/POTFILES.in: Likewise.
5536 * po/gold.pot: Likewise.
5537
5538 2008-04-14 Ian Lance Taylor <iant@google.com>
5539
5540 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
5541 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
5542 in the name/type/flags to section mapping. Don't call
5543 allocate_output_section.
5544 (Layout::choose_output_section): Change parameter from adjust_name
5545 to is_input_section. Don't permit input sections after sections
5546 are attached to segments. Don't call allocate_output_section.
5547 (Layout::layout_eh_frame): Call update_flags_for_input_section,
5548 not write_enable_output_section.
5549 (Layout::make_output_section): Don't push to
5550 unattached_section_list_ nor call attach_to_segment. Call
5551 attach_section_to_segment if sections are attached.
5552 (Layout::attach_sections_to_segments): New function.
5553 (Layout::attach_section_to_segment): New function.
5554 (Layout::attach_allocated_section_to_segment): Rename from
5555 attach_to_segment. Remove flags parameter.
5556 (Layout::allocate_output_section): Remove function.
5557 (Layout::write_enable_output_section): Remove function.
5558 * layout.h (class Layout): Update for above changes. Add new
5559 field sections_are_attached_.
5560 * output.h (Output_section::update_flags_for_input_section): New
5561 function.
5562 * output.cc (Output_section::add_input_section): Call
5563 update_flags_for_input_section.
5564 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
5565
5566 2008-04-11 Cary Coutant <ccoutant@google.com>
5567
5568 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
5569 thought unnecessary.
5570 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
5571
5572 2008-04-11 Ian Lance Taylor <iant@google.com>
5573
5574 * output.h (class Output_section_data): Remove inline definition
5575 of set_addralign.
5576 * output.cc (Output_section_data::set_addralign): New function.
5577
5578 2008-04-11 Cary Coutant <ccoutant@google.com>
5579
5580 Add support for TLS descriptors for i386 and x86_64.
5581 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
5582 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
5583 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
5584 GOT_TYPE_TLS_DESC.
5585 (Target_i386::got_mod_index_entry): Remove unnecessary code.
5586 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
5587 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
5588 relocations.
5589 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
5590 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
5591 Fix problem with initial-exec relocations.
5592 (Target_i386::Relocate::relocate_tls): Likewise.
5593 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
5594 relaxation.
5595 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
5596 support for section-plus-offset dynamic table entries.
5597 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
5598 (Output_data_dynamic::Dynamic_entry): Add support for
5599 section-plus-offset dynamic table entries.
5600 (Output_data_dynamic::Classification): Likewise.
5601 (Output_data_dynamic::classification_): Renamed offset_.
5602 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
5603 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
5604 (Target_x86_64::make_plt_section): New function.
5605 (Target_x86_64::reserve_tlsdesc_entries): New function.
5606 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
5607 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
5608 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
5609 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
5610 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
5611 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
5612 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
5613 add extra PLT entry for TLS descriptors.
5614 (Output_data_plt_x86_64::got_): New field.
5615 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
5616 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
5617 fields.
5618 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
5619 descriptors.
5620 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
5621 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
5622 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
5623 R_386_TLS_DESC_CALL relocations.
5624 (Target_x86_64::Scan::global): Likewise.
5625 (Target_x86_64::do_finalize_sections): Add dynamic table entries
5626 for TLS descriptors.
5627 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
5628 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
5629 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
5630 GD-to-IE relaxation.
5631 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
5632 and TLS_DESCRIPTORS.
5633 * Makefile.in: Rebuild.
5634 * configure: Rebuild.
5635 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
5636 (tls_test_shared2.so): New target.
5637 (tls_shared_gd_to_ie_test_SOURCES): New variable.
5638 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
5639 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
5640 (tls_shared_gd_to_ie_test_LDADD): New variable.
5641 (tls_shared_gnu2_gd_to_ie_test): New target.
5642 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
5643 New targets.
5644 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
5645 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
5646 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
5647 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
5648 (tls_shared_gnu2_test): New target.
5649 (tls_test_gnu2_shared.so): New target.
5650 (tls_shared_gnu2_test_SOURCES): New variable.
5651 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
5652 (tls_shared_gnu2_test_LDFLAGS): New variable.
5653 (tls_shared_gnu2_test_LDADD): New variable.
5654 * testsuite/Makefile.in: Rebuild.
5655 * testsuite/Makefile.
5656
5657 2008-04-11 Ian Lance Taylor <iant@google.com>
5658
5659 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
5660 justsyms.t.
5661 * testsuite/Makefile.in: Rebuild.
5662
5663 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
5664 long.
5665 * testsuite/script_test_2.cc (main): Adjust test.
5666
5667 2008-04-11 David S. Miller <davem@davemloft.net>
5668 Ian Lance Taylor <iant@google.com>
5669
5670 * options.h (General_options): Add entries for '-Y' and
5671 '-relax'.
5672 * options.cc (General_options:finalize): If -Y was used, add those
5673 entries to the library path instead of the default "/lib" and
5674 "/usr/lib".
5675
5676 2008-04-11 David S. Miller <davem@davemloft.net>
5677
5678 * testsuite/justsyms.t: Start at 0x100.
5679 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
5680 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
5681 long.
5682 * testsuite/script_test_2.cc: Adjust string and section length
5683 checks.
5684
5685 2008-04-09 Ian Lance Taylor <iant@google.com>
5686
5687 PR gold/5996
5688 * script-sections.cc (Sections_element::allocate_to_segment): Add
5689 orphan parameter.
5690 (Output_section_definition::allocate_to_segment): Likewise.
5691 (Orphan_output_section::allocate_to_segment): Likewise.
5692 (Script_sections::attach_sections_using_phdrs_clause): Don't
5693 propagate non-PT_LOAD segments to orphan sections.
5694 * testsuite/Makefile.am (script_test_3.stdout): Generate using
5695 readelf rather than objdump.
5696 * testsuite/script_test_3.sh: Adjust accordingly. Test that
5697 .interp section and PT_INTERP segment are the same size.
5698 * testsuite/Makefile.in: Rebuild.
5699
5700 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
5701 aliases for symbols defined in the same object.
5702 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
5703 (weak_alias_test_SOURCES): New variable.
5704 (weak_alias_test_DEPENDENCIES): New variable.
5705 (weak_alias_test_LDFLAGS): New variable.
5706 (weak_alias_test_LDADD): New variable.
5707 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
5708 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
5709 (weak_alias_test_3.o): New target.
5710 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
5711 * testsuite/weak_alias_test_main.cc: New file.
5712 * testsuite/weak_alias_test_1.cc: New file.
5713 * testsuite/weak_alias_test_2.cc: New file.
5714 * testsuite/weak_alias_test_3.cc: New file.
5715
5716 2008-04-08 Ian Lance Taylor <iant@google.com>
5717
5718 * options.h (class General_options): Add --noinhibit-exec option.
5719 * main.cc (main): Check --noinhibit-exec.
5720
5721 * options.h (class General_options): Define --wrap as a special
5722 option. Add wrap_symbols_ field.
5723 (General_options::any_wrap_symbols): New function.
5724 (General_options::is_wrap_symbol): New function.
5725 * options.cc (General_options::parse_wrap): New function.
5726 (General_options::General_options): Initialize wrap_symbols_.
5727 * symtab.cc (Symbol_table::wrap_symbol): New function.
5728 (Symbol_table::add_from_object): Handle --wrap.
5729 * symtab.h (class Symbol_table): Declare wrap_symbol.
5730 * target.h (Target::wrap_char): New function.
5731 (Target::Target_info): Add wrap_char field.
5732 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
5733 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
5734 * testsuite/testfile.cc (Target_test::test_target_info):
5735 Likewise.
5736
5737 * errors.cc (Errors::undefined_symbol): Mention symbol version if
5738 there is one.
5739
5740 * layout.h (class Layout): Add added_eh_frame_data_ field.
5741 * layout.cc (Layout::Layout): Initialize new field.
5742 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
5743 output section until we find a section we merged successfully.
5744 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
5745 that the size be non-zero.
5746
5747 * merge.cc (Object_merge_map::get_output_offset): Remove inline
5748 qualifier.
5749
5750 2008-04-08 Craig Silverstein <csilvers@google.com>
5751
5752 * configure.ac: Export new conditional variable HAVE_ZLIB.
5753 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
5754 on HAVE_ZLIB.
5755 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
5756 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
5757
5758 2008-04-07 Ian Lance Taylor <iant@google.com>
5759
5760 * version.cc (version_string): Set to "1.5".
5761
5762 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
5763 Add issued_non_pic_error_ field. Declare check_non_pic.
5764 (Target_x86_64::Scan::check_non_pic): New function.
5765 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
5766 (Target_x86_64::Scan::global): Likewise.
5767
5768 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
5769 addend parameter. Change caller. Handle merge sections.
5770 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
5771 Address to Addend. Don't add in the result of
5772 local_section_offset, pass down the addend and use the returned
5773 value.
5774 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
5775 Update declarations of local_section_offset and symbol_value.
5776 * testsuite/two_file_test_1.cc (t18): New function.
5777 * testsuite/two_file_test_2.cc (f18): New function.
5778 * testsuite/two_file_test_main.cc (main): Call t18.
5779 * testsuite/two_file_test.h (t18, f18): Declare.
5780
5781 * configure.ac: Don't test for objdump, c++filt, or readelf.
5782 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
5783 conditionals.
5784 (TEST_READELF): New variable.
5785 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
5786 (check_PROGRAMS): Add two_file_strip_test.
5787 (two_file_strip_test): New target.
5788 (check_PROGRAMS): Add two_file_same_shared_strip_test.
5789 (two_file_same_shared_strip_test_SOURCES): New variable.
5790 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
5791 (two_file_same_shared_strip_test_LDFLAGS): New variable.
5792 (two_file_same_shared_strip_test_LDADD): New variable.
5793 (two_file_shared_strip.so): New target.
5794 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
5795 (ver_test_5.syms, ver_test_7.syms): Likewise.
5796 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
5797 (strip_test_3.stdout): Use TEST_OBJDUMP.
5798 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
5799
5800 2008-04-04 Cary Coutant <ccoutant@google.com>
5801
5802 * symtab.h (Symbol::is_weak_undefined): New function.
5803 (Symbol::is_strong_undefined): New function.
5804 (Symbol::is_absolute): New function.
5805 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
5806 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
5807 absolute symbols.
5808 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
5809 (weak_undef_test): New target.
5810 * testsuite/Makefile.in: Rebuild.
5811 * testsuite/weak_undef_file1.cc: New file.
5812 * testsuite/weak_undef_file2.cc: New file.
5813 * testsuite/weak_undef_test.cc: New file.
5814
5815 2008-04-03 Craig Silverstein <csilvers@google.com>
5816
5817 * compressed_output.h (class Output_compressed_section): Use
5818 unsigned buffer.
5819 * compressed_output.cc (zlib_compress): Use unsigned buffers,
5820 add zlib header.
5821 (zlib_compressed_suffix): Removed.
5822 (Output_compressed_section::set_final_data_size): Use unsigned
5823 buffers.
5824 * testsuite/Makefile.am (flagstest_compress_debug_sections):
5825 Fix linker invocation.
5826 (flagstest_o_specialfile_and_compress_debug_sections):
5827 Likewise.
5828 * testsuite/Makefile.in: Regenerated.
5829
5830 2008-04-02 David S. Miller <davem@davemloft.net>
5831
5832 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
5833 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
5834
5835 2008-04-02 Craig Silverstein <csilvers@google.com>
5836
5837 * TODO: New file.
5838
5839 2008-04-02 Ian Lance Taylor <iant@google.com>
5840
5841 * fileread.cc (File_read::find_view): Add byteshift and vshifted
5842 parameters. Update for new key type to views_. Change all
5843 callers.
5844 (File_read::read): Adjust for byteshift in returned view.
5845 (File_read::add_view): New function, broken out of
5846 find_and_make_view.
5847 (File_read::make_view): New function, broken out of
5848 find_and_make_view.
5849 (File_read::find_or_make_view): Add offset and aligned
5850 parameters. Rewrite accordingly. Change all callers.
5851 (File_read::get_view): Add offset and aligned parameters. Adjust
5852 for byteshift in return value.
5853 (File_read::get_lasting_view): Likewise.
5854 * fileread.h (class File_read): Update declarations.
5855 (class File_read::View): Add byteshift_ field. Add byteshift to
5856 constructor. Add byteshift method.
5857 * archive.h (Archive::clear_uncached_views): New function.
5858 (Archive::get_view): Add aligned parameter. Change all callers.
5859 * object.h (Object::get_view): Add aligned parameter. Change all
5860 callers.
5861 (Object::get_lasting_view): Likewise.
5862
5863 * fileread.cc (File_read::release): Don't call clear_views if
5864 there are multiple objects.
5865 * fileread.h (File_read::clear_uncached_views): New function.
5866 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
5867 on the archive.
5868
5869 2008-03-31 Cary Coutant <ccoutant@google.com>
5870
5871 Add thin archive support.
5872 * archive.cc (Archive::armagt): New const.
5873 (Archive::setup): Remove task parameter and calls to unlock.
5874 (Archive::unlock_nested_archives): New function.
5875 (Archive::read_header): Add nested_off parameter. Change
5876 all callers.
5877 (Archive::interpret_header): Likewise.
5878 (Archive::include_all_members): Change to handle thin
5879 archives.
5880 (Archive::include_member): Likewise.
5881 * archive.h (Archive::Archive): Add new parameters and
5882 initializers.
5883 (Archive::armagt): New const.
5884 (Archive::setup): Remove task parameter.
5885 (Archive::unlock_nested_archives): New function.
5886 (Archive::read_header): Add nested_off parameter.
5887 (Archive::interpret_header): Likewise.
5888 (Archive::Nested_archive_table): New typedef.
5889 (Archive::is_thin_archive_): New field.
5890 (Archive::nested_archives_): New field.
5891 (Archive::options_): New field.
5892 (Archive::dirpath_): New field.
5893 (Archive::task_): New field.
5894 * readsyms.cc (Read_symbols::do_read_symbols): Add check
5895 for thin archives. Pass additional parameters to
5896 Archive::Archive. Unlock the archive file after calling
5897 Archive::setup.
5898
5899 2008-03-29 Ian Lance Taylor <iant@google.com>
5900
5901 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
5902 version symbol to be local.
5903 * testsuite/ver_test_4.sh: New file.
5904 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
5905 (check_DATA): Add ver_test_4.syms.
5906 (ver_test_4.syms): New target.
5907 * testsuite/Makefile.in: Rebuild.
5908
5909 * output.cc
5910 (Output_section::Input_section_sort_entry::has_priority): New
5911 function.
5912 (Output_section::Input_section_sort_entry::match_file_name): New
5913 function.
5914 (Output_section::Input_section_sort_entry::match_section_name):
5915 Remove.
5916 (Output_section::Input_section_sort_entry::match_section_name_prefix):
5917 Remove.
5918 (Output_section::Input_section_sort_entry::match_section_file):
5919 Remove.
5920 (Output_section::Input_section_sort_compare::operator()): Rewrite
5921 using new Input_section_sort_entry functions. Sort crtbegin and
5922 crtend first. Sort sections with no priority before sections with
5923 a priority.
5924 * testsuite/initpri1.c (d3): Check j != 4.
5925 (cd5): New constructor/destructor function.
5926 (main): Check j != 2.
5927
5928 * symtab.cc (Symbol_table::add_from_object): If we don't use the
5929 new symbol when resolving, don't call set_is_default.
5930 * testsuite/ver_test_7.cc: New file.
5931 * testsuite/ver_test_7.sh: New file.
5932 * testsuite/Makefile.am (ver_test_7.so): New target.
5933 (ver_test_7.o): New target.
5934 (check_SCRIPTS): Add ver_test_7.sh.
5935 (check_DATA): Add ver_test_7.syms.
5936 (ver_test_7.syms): New target.
5937
5938 2008-03-28 Ian Lance Taylor <iant@google.com>
5939
5940 * layout.cc (Layout::layout): If we see an input section with a
5941 name that needs sorting, set the must_sort flag for the output
5942 section.
5943 (Layout::make_output_section): If the name of the output section
5944 indicates that it might require sorting, set the may_sort flag.
5945 * output.h (Output_section::may_sort_attached_input_sections): New
5946 function.
5947 (Output_section::set_may_sort_attached_input_sections): New
5948 function.
5949 (Output_section::must_sort_attached_input_sections): New
5950 function.
5951 (Output_section::set_must_sort_attached_input_sections): New
5952 function.
5953 (class Output_section): Declare Input_section_sort_entry. Define
5954 Input_section_sort_compare. Declare
5955 sort_attached_input_sections. Add new fields:
5956 may_sort_attached_input_sections_,
5957 must_sort_attached_input_sections_,
5958 attached_input_sections_are_sorted_.
5959 * output.cc (Output_section::Output_section): Initialize new
5960 fields.
5961 (Output_section::add_input_section): Add an entry to
5962 input_sections_ if may_sort or must_sort are true.
5963 (Output_section::set_final_data_size): Call
5964 sort_attached_input_sections if necessary.
5965 (Output_section::Input_section_sort_entry): Define new class.
5966 (Output_section::Input_section_sort_compare::operator()): New
5967 function.
5968 (Output_section::sort_attached_input_sections): New function.
5969 * configure.ac: Check whether the compiler supports constructor
5970 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
5971 * testsuite/initpri1.c: New file.
5972 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
5973 CONSTRUCTOR_PRIORITY.
5974 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
5975 (initpri1_LDFLAGS): New variable.
5976 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
5977
5978 2008-03-27 Ian Lance Taylor <iant@google.com>
5979
5980 * common.cc (Sort_commons::operator): Correct sorting algorithm.
5981 * testsuite/common_test_1.c: New file.
5982 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
5983 (common_test_1_SOURCES): New variable.
5984 (common_test_1_DEPENDENCIES): New variable.
5985 (common_test_1_LDFLAGS): New variable.
5986
5987 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
5988 and commons_ correctly when NAME/VERSION does not override
5989 NAME/NULL.
5990 * testsuite/ver_test_6.c: New file.
5991 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
5992 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
5993 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
5994
5995 2008-03-26 Ian Lance Taylor <iant@google.com>
5996
5997 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
5998 of an undefined symbol from a version script.
5999 * testsuite/Makefile.am (ver_test_5.so): New target.
6000 (ver_test_5.o): New target.
6001 (check_SCRIPTS): Add ver_test_5.sh.
6002 (check_DATA): Add ver_test_5.syms.
6003 (ver_test_5.syms): New target.
6004 * testsuite/ver_test_5.cc: New file.
6005 * testsuite/ver_test_5.script: New file.
6006 * testsuite/ver_test_5.sh: New file.
6007 * Makefile.in, testsuite/Makefile.in: Rebuild.
6008
6009 PR gold/5986
6010 Fix problems building gold with gcc 4.3.0.
6011 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
6012 (gold_error_at_location, gold_warning_at_location): Use it.
6013 * configure.ac: Check whether we can compile and use a template
6014 function with a printf attribute.
6015 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
6016 when jumping over bytes.
6017 * object.cc: Instantiate Object::read_section_data.
6018 * debug.h: Include <cstring>
6019 * dwarf_reader.cc: Include <algorithm>
6020 * main.cc: Include <cstring>.
6021 * options.cc: Include <cstring>.
6022 * output.cc: Include <cstring>.
6023 * script.cc: Include <cstring>.
6024 * script.h: Include <string>.
6025 * symtab.cc: Include <cstring> and <algorithm>.
6026 * target-select.cc: Include <cstring>.
6027 * version.cc: Include <string>.
6028 * testsuite/testmain.cc: Include <cstdlib>.
6029 * configure, config.in: Rebuild.
6030
6031 2008-03-25 Ian Lance Taylor <iant@google.com>
6032
6033 * options.cc: Include "../bfd/bfdver.h".
6034 (options::help): Print bug reporting address.
6035
6036 * version.cc (print_version): Adjust output for current value of
6037 BFD_VERSION_STRING.
6038
6039 * NEWS: New file.
6040
6041 * options.cc (options::help): Print list of supported targets.
6042 * target-select.h: Include <vector>.
6043 (class Target_selector): Make machine_, size_, and is_big_endian_
6044 fields const. Add bfd_name_ and instantiated_target_ fields.
6045 (Target_selector::Target_selector): Add bfd_name parameter.
6046 (Target_selector::recognize): Make non-virtual, call
6047 do_recognize.
6048 (Target_selector::recognize_by_name): Make non-virtual, call
6049 do_recognize_by_name.
6050 (Target_selector::supported_names): New function.
6051 (Target_selector::bfd_name): New function.
6052 (Target_selector::do_instantiate_target): New pure virtual
6053 function.
6054 (Target_selector::do_recognize): New virtual function.
6055 (Target_selector::do_recognize_by_name): New virtual function.
6056 (Target_selector::instantiate_target): New private function.
6057 (supported_target_names): Declare.
6058 * target-select.cc (Target_selector::Target_selector): Update for
6059 new parameter and fields.
6060 (select_target_by_name): Check that the name matches before
6061 calling recognize_by_name.
6062 (supported_target_names): New function.
6063 * i386.cc (class Target_selector_i386): Update Target_selector
6064 constructor call. Remove recognize and recognize_by_name. Add
6065 do_instantiate_target.
6066 * x86_64.cc (class Target_selector_x86_64): Likewise.
6067 * testsuite/testfile.cc (class Target_selector_test): Update for
6068 changes to Target_selector.
6069
6070 * README: Rewrite, with some notes on unsupported features.
6071
6072 2008-03-24 Cary Coutant <ccoutant@google.com>
6073
6074 * i386.cc (Target_i386::Got_type): New enum declaration.
6075 (Target_i386::Scan::local): Updated callers of Output_data_got
6076 member functions.
6077 (Target_i386::Scan::global): Likewise.
6078 (Target_i386::Relocate::relocate): Likewise.
6079 (Target_i386::Relocate::relocate_tls): Likewise.
6080 * object.h (Got_offset_list): New class.
6081 (Sized_relobj::local_has_got_offset): Added got_type parameter.
6082 (Sized_relobj::local_got_offset): Likewise.
6083 (Sized_relobj::set_local_got_offset): Likewise.
6084 (Sized_relobj::local_has_tls_got_offset): Removed.
6085 (Sized_relobj::local_tls_got_offset): Removed.
6086 (Sized_relobj::set_local_tls_got_offset): Removed.
6087 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
6088 * output.cc (Output_data_got::add_global): Added got_type parameter.
6089 (Output_data_got::add_global_with_rel): Likewise.
6090 (Output_data_got::add_global_with_rela): Likewise.
6091 (Output_data_got::add_global_pair_with_rel): New function.
6092 (Output_data_got::add_global_pair_with_rela): New function.
6093 (Output_data_got::add_local): Added got_type parameter.
6094 (Output_data_got::add_local_with_rel): Likewise.
6095 (Output_data_got::add_local_with_rela): Likewise.
6096 (Output_data_got::add_local_pair_with_rel): New function.
6097 (Output_data_got::add_local_pair_with_rela): New function.
6098 (Output_data_got::add_global_tls): Removed.
6099 (Output_data_got::add_global_tls_with_rel): Removed.
6100 (Output_data_got::add_global_tls_with_rela): Removed.
6101 (Output_data_got::add_local_tls): Removed.
6102 (Output_data_got::add_local_tls_with_rel): Removed.
6103 (Output_data_got::add_local_tls_with_rela): Removed.
6104 * output.h (Output_data_got::add_global): Added got_type parameter.
6105 (Output_data_got::add_global_with_rel): Likewise.
6106 (Output_data_got::add_global_with_rela): Likewise.
6107 (Output_data_got::add_global_pair_with_rel): New function.
6108 (Output_data_got::add_global_pair_with_rela): New function.
6109 (Output_data_got::add_local): Added got_type parameter.
6110 (Output_data_got::add_local_with_rel): Likewise.
6111 (Output_data_got::add_local_with_rela): Likewise.
6112 (Output_data_got::add_local_pair_with_rel): New function.
6113 (Output_data_got::add_local_pair_with_rela): New function.
6114 (Output_data_got::add_global_tls): Removed.
6115 (Output_data_got::add_global_tls_with_rel): Removed.
6116 (Output_data_got::add_global_tls_with_rela): Removed.
6117 (Output_data_got::add_local_tls): Removed.
6118 (Output_data_got::add_local_tls_with_rel): Removed.
6119 (Output_data_got::add_local_tls_with_rela): Removed.
6120 * resolve.cc (Symbol::override_base_with_special): Removed
6121 reference to has_got_offset_ field.
6122 * symtab.cc (Symbol::init_fields): Replaced initialization
6123 of got_offset_ with got_offsets_. Removed initialization
6124 of has_got_offset_
6125 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
6126 (Symbol::got_offset): Likewise.
6127 (Symbol::set_got_offset): Likewise.
6128 (Symbol::has_tls_got_offset): Removed.
6129 (Symbol::tls_got_offset): Removed.
6130 (Symbol::set_tls_got_offset): Removed.
6131 (Symbol::got_offset_): Removed.
6132 (Symbol::tls_mod_got_offset_): Removed.
6133 (Symbol::tls_pair_got_offset_): Removed.
6134 (Symbol::got_offsets_): New field.
6135 (Symbol::has_got_offset): Removed.
6136 (Symbol::has_tls_mod_got_offset): Removed.
6137 (Symbol::has_tls_pair_got_offset): Removed.
6138 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
6139 (Target_x86_64::Scan::local): Updated callers of Output_data_got
6140 member functions.
6141 (Target_x86_64::Scan::global): Likewise.
6142 (Target_x86_64::Relocate::relocate): Likewise.
6143 (Target_x86_64::Relocate::relocate_tls): Likewise.
6144
6145 2008-03-25 Ben Elliston <bje@au.ibm.com>
6146
6147 * yyscript.y: Fix spelling error in comment.
6148
6149 2008-03-24 Ian Lance Taylor <iant@google.com>
6150
6151 * options.h (class General_options): Define build_id option.
6152 * layout.h (class Layout): Declare write_build_id, create_note,
6153 create_build_id. Add build_id_note_ member.
6154 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
6155 "libiberty.h", "md5.h", "sha1.h".
6156 (Layout::Layout): Initialize eh_frame_data_,
6157 eh_frame_hdr_section_, and build_id_note_.
6158 (Layout::finalize): Call create_build_id.
6159 (Layout::create_note): New function, broken out of
6160 Layout::create_gold_note.
6161 (Layout::create_gold_note): Call create_note.
6162 (Layout::create_build_id): New function.
6163 (Layout::write_build_id): New function.
6164 (Close_task_runner::run): Call write_build_id.
6165
6166 * x86_64.cc: Correct license to GPLv3.
6167
6168 2008-03-23 Ian Lance Taylor <iant@google.com>
6169
6170 * options.cc: Include "demangle.h".
6171 (parse_optional_string): New function.
6172 (parse_long_option): Handle takes_optional_argument.
6173 (parse_short_option): Update dash_z initializer. Handle
6174 takes_optional_argument.
6175 (General_options::General_options): Initialize do_demangle_.
6176 (General_options::finalize): Set do_demangle_. Handle demangling
6177 style.
6178 * options.h (parse_optional_string): Declare.
6179 (struct One_option): Add optional_arg field. Update constructor.
6180 Update call constructor calls. Add takes_optional_argument
6181 function.
6182 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
6183 (DEFINE_optional_string): Define.
6184 (General_options::demangle): Change from DEFINE_bool to
6185 DEFINE_optional_string.
6186 (General_options::no_demangle): New function.
6187 (General_options::do_demangle): New function.
6188 (General_options::set_do_demangle): New function.
6189 (General_options::execstack_status_): Move definition to end of
6190 class definition.
6191 (General_options::static_): Likewise.
6192 (General_options::do_demangle_): New field.
6193 * object.cc (big_endian>::get_symbol_location_info): Call
6194 Options::do_demangle, not Options::demangle.
6195 * symtab.cc (demangle): Likewise.
6196
6197 2008-03-22 Ian Lance Taylor <iant@google.com>
6198
6199 * gold.h: Include <cstddef> and <sys/types.h>
6200 * options.h: Include <cstring>.
6201
6202 2008-03-21 Ian Lance Taylor <iant@google.com>
6203
6204 * Added source code to GNU binutils.