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