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