1 2011-02-02 Sriraman Tallam <tmsriram@google.com>
3 * icf.h (is_section_foldable_candidate): Change type of parameter
5 * icf.cc (Icf::find_identical_sections): Change type of local variable
6 section_name to be std::string.
7 (is_function_ctor_or_dtor): Change type of parameter to std::string.
9 2011-01-25 Ian Lance Taylor <iant@google.com>
11 * script.cc (script_add_extern): Rewrite to use
14 2011-01-25 Doug Kwan <dougkwan@google.com>
16 * icf.cc (get_section_contents): Always lock section's object.
18 2011-01-24 Ian Lance Taylor <iant@google.com>
20 * options.h (class General_options): Accept
21 --no-detect-odr-violations.
23 2011-01-24 Ian Lance Taylor <iant@google.com>
25 * version.cc (version_string): Bump to 1.11.
27 2011-01-24 Ian Lance Taylor <iant@google.com>
29 * plugin.cc (class Plugin_rescan): Define new class.
30 (Plugin_manager::claim_file): Set any_claimed_.
31 (Plugin_manager::save_archive): New function.
32 (Plugin_manager::save_input_group): New function.
33 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
35 (Plugin_manager::new_undefined_symbol): New function.
36 (Plugin_manager::rescan): New function.
37 (Plugin_manager::rescannable_defines): New function.
38 (Plugin_manager::add_input_file): Set any_added_.
39 * plugin.h (class Plugin_manager): define new fields rescannable_,
40 undefined_symbols_, any_claimed_, and any_added_. Declare
41 Plugin_rescan as friend. Declare new functions.
42 (Plugin_manager::Rescannable): Define type.
43 (Plugin_manager::Rescannable_list): Define type.
44 (Plugin_manager::Undefined_symbol_list): Define type.
45 (Plugin_manager::Plugin_manager): Initialize new fields.
46 * archive.cc (Archive::defines_symbol): New function.
47 (Add_archive_symbols::run): Pass archive to plugins if any.
48 * archive.h (class Archive): Declare defines_symbol.
49 * readsyms.cc (Input_group::~Input_group): New function.
50 (Finish_group::run): Pass input_group to plugins if any.
51 * readsyms.h (class Input_group): Declare destructor.
52 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
55 2011-01-10 Ian Lance Taylor <iant@google.com>
57 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
59 (Layout::set_segment_offsets): Reset increase_relro before calling
60 set_section_addresses a second time.
62 2011-01-04 Cary Coutant <ccoutant@google.com>
64 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
65 sections before NOBITS sections.
67 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
69 * version.cc (print_version): Update copyright to 2011.
71 2010-12-23 Cary Coutant <ccoutant@google.com>
73 * output.h (Output_data_reloc::add_output_section): Pass OD instead
74 of OS to this->add. Add OD parameter to second form of the function.
76 2010-12-20 Ian Lance Taylor <iant@google.com>
78 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
79 second of two consecutive entries with same offset.
81 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
83 * testsuite/Makefile.am (ifuncmain2static_LDADD)
84 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
85 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
86 to avoid unneeded links against $(LDADD).
87 * testsuite/Makefile.in: Regenerate.
89 2010-12-15 Ian Lance Taylor <iant@google.com>
92 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
93 for R_X86_64_32 and R_X86_64_PC32.
94 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
95 ver_matching_def_pic.o.
96 (ver_matching_def_pic.o): New target.
98 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
100 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
101 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
102 Move definition before File_read::View member definitions.
103 (File_read::View::~View): Initialize and hold lock before
104 updating current_mapped_bytes.
106 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
108 * dwarf_reader.cc: Remove outdated comment.
109 * gold-threads.cc: Fix typo in error message.
110 * archive.cc: Fix typos in comments.
111 * archive.h: Likewise.
112 * arm-reloc-property.cc: Likewise.
113 * arm-reloc-property.h: Likewise.
114 * arm-reloc.def: Likewise.
116 * attributes.h: Likewise.
118 * ehframe.cc: Likewise.
119 * fileread.h: Likewise.
123 * incremental.h: Likewise.
124 * int_encoding.cc: Likewise.
125 * layout.h: Likewise.
128 * object.cc: Likewise.
129 * object.h: Likewise.
130 * options.cc: Likewise.
131 * readsyms.cc: Likewise.
132 * reduced_debug_output.cc: Likewise.
133 * reloc.cc: Likewise.
134 * script-sections.cc: Likewise.
135 * sparc.cc: Likewise.
136 * symtab.h: Likewise.
137 * target-reloc.h: Likewise.
138 * target.cc: Likewise.
139 * target.h: Likewise.
140 * timer.cc: Likewise.
142 * x86_64.cc: Likewise.
144 2010-12-09 Cary Coutant <ccoutant@google.com>
146 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
148 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
149 parameter; change all callers.
150 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
151 * options.h (warn_execstack): New option.
153 2010-12-07 Doug Kwan <dougkwan@google.com>
155 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
156 like function call relocations.
158 2010-12-07 Ian Lance Taylor <iant@google.com>
160 * archive.cc (Archive::get_elf_object_for_member): Permit
161 punconfigured to be NULL.
162 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
163 (Archive::include_member): Pass NULL to get_elf_object_for_member
164 if we searched for the archive and this is the first included
167 2010-12-01 Ian Lance Taylor <iant@google.com>
169 * dwarf_reader.h (class Sized_dwarf_line_info): Add
170 track_relocs_type_ field.
171 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
172 Set track_relocs_type_.
173 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
174 contents when using RELA relocs.
175 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
177 * reloc.cc (Track_relocs::next_addend): New function.
178 * reloc.h (class Track_relocs): Declare next_addend.
180 2010-12-01 Ian Lance Taylor <iant@google.com>
182 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
185 2010-12-01 Ian Lance Taylor <iant@google.com>
187 * README: Update compilers known to work and fail.
189 2010-11-23 Matthias Klose <doko@ubuntu.com>
191 * configure.in: For --enable-gold, handle value `default' instead of
192 `both*'. Always install ld as ld.bfd, install as ld if gold is
194 * configure: Regenerate.
196 2010-11-18 Doug Kwan <dougkwan@google.com>
198 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
199 and right_alignment to be zero. Store result alignment only if it is
200 greater than existing alignment.
202 2010-11-16 Cary Coutant <ccoutant@google.com>
205 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
206 Check for ".zdebug_line".
208 2010-11-16 Doug Kwan <dougkwan@google.com>
209 Cary Coutant <ccoutant@google.com>
211 * output.h (Output_segment::set_section_addresses): Pass increase_relro
212 by reference; adjust all callers.
213 * output.cc (Output_segment::set_section_addresses): Adjust references
214 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
216 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
217 end at page boundary.
219 2010-11-16 Cary Coutant <ccoutant@google.com>
222 * layout.cc (Layout::choose_output_section): Transform names of
223 compressed sections even when using a script with a SECTIONS clause.
224 (Layout::output_section_name): Remove code to transform
225 compressed debug section names.
226 * output.cc (Output_section::add_input_section): Use uncompressed
227 section size when tracking input sections.
229 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
231 * symtab.h (Symbol::NON_PIC_REF): Remove.
232 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
233 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
234 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
235 (Symbol::use_plt_offset): Take a flags argument and pass it
236 directly to needs_dynamic_reloc. Restrict check for undefined
237 weak symbols to function calls.
238 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
239 (Target_arm::Scan::global): Use it.
240 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
241 (Target_arm::Relocate::relocate): Likewise.
242 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
243 parameter with an r_type parameter. Use get_reference_flags
245 (Target_arm::Relocate::relocate): Update accordingly.
246 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
247 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
248 (Target_i386::Scan::global): Likewise.
249 (Target_i386::Relocate::relocate): Likewise.
250 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
251 parameter with an r_type parameter. Use get_reference_flags
253 (Target_i386::Relocate::relocate): Update accordingly.
254 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
255 (Target_powerpc::Scan::global): Use it.
256 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
257 (Target_powerpc::Relocate::relocate): Likewise.
258 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
259 (Target_sparc::Scan::global): Use it.
260 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
261 (Target_sparc::Relocate::relocate): Likewise.
262 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
263 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
264 (Target_x86_64::Scan::global): Likewise.
265 (Target_x86_64::Relocate::relocate): Likewise.
267 2010-11-08 Doug Kwan <dougkwan@google.com>
268 Cary Coutant <ccoutant@google.com>
270 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
271 (Arm_exidx_merge_section::section_contents_): New data member.
272 (Arm_input_section::Arm_input_section): Initialize original_contents_.
273 (Arm_input_section::~Arm_input_section): De-allocate memory.
274 (Arm_input_section::original_contents_): New data member.
275 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
276 in parameters instead of calling Object::section_contents without
278 (Arm_output_section::group_section): New parameter TASK. Pass it
279 to callees that need locking objects.
280 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
281 to lock EXIDX input sections. Fix a formatting issue. Call
282 Arm_exidx_merged_section::build_contents to create merged section
284 (Arm_output_section::create_stub_group): New parameter TASK. Use it
285 to lock object of stub table owner.
286 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
287 TEXT_SIZE to initialize data member TEXT_SIZE_.
288 (Arm_exidx_input_section::addralign): Fix typo in comment.
289 (Arm_exidx_input_section::text_size): New method.
290 (Target_arm::do_relax): New parameter TASK. Pass it to callees
291 that require locking objects. Lock objects before scanning for stubs
292 and updating local symbols.
293 (Arm_input_section<big_endian>::init): Copy contents of original
295 (Arm_input_section<big_endian>::do_write): Use saved contents of
296 original input section instead of calling Object::section_contents
298 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
299 size without calling Object::section_size().
300 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
301 for size. Allocate a buffer for merged EXIDX entries.
302 (Arm_exidx_merged_section::build_contents): New method.
303 (Arm_exidx_merged_section::do_write): Move merge section contents
304 building code to Arm_exidx_merged_section::build_contetns. Write
305 out contetns in buffer instead of building it on the fly.
306 (Arm_relobj::make_exidx_input_section): Also pass text section size
307 to Arm_exidx_input_section constructor.
308 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
309 (Arm_dynobj::do_read_symbols): Fix memory leak.
310 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
311 * target.h: (class Task): Add forward declaration.
312 (Target::relax): Add new parameter TASK and pass it to
314 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
316 2010-11-05 Cary Coutant <ccoutant@google.com>
319 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
320 object when reading from the file.
321 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
323 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
324 when reading section contents.
325 (get_section_contents): Likewise.
326 (icf::find_identical_sections): Likewise.
327 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
328 object when reading from the file.
329 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
330 the object when doing deferred section layout.
332 2010-11-03 Nick Clifton <nickc@redhat.com>
335 * script.h (class Symbol_assignment: name): New member. Returns
336 the name of the symbol.
337 * scrfipt.cc (Script_options::is_pending_assignment): New member.
338 Returns true if the given symbol name is on the list of
339 assignments wating to be processed.
340 * archive.cc (should_incldue_member): If the symbol is undefined,
341 check to see if it is on the list of symbols pending assignment.
343 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
345 * script-sections.cc (Script_sections::find_memory_region): Check
346 for a NULL output section pointer.
348 2010-10-29 Doug Kwan <dougkwan@google.com>
350 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
351 Output_section::add_relaxed_input_section.
352 * output.cc (Output_section::add_relaxed_input_section): Add new
353 arguments LAYOUT and NAME. Set section order index.
354 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
355 Copy section order index.
356 * output.h (Output_section::add_relaxed_input_section): Add new
357 arguments LAYOUT and NAME.
359 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
361 * testsuite/Makefile.am: Move gcctestdir/ld rule to
362 NATIVE_OR_CROSS_LINKER.
363 * testsuite/Makefile.in: Regenerate.
365 2010-10-20 Doug Kwan <dougkwan@google.com>
367 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
368 without SHF_LINK_ORDER flags.
369 * layout.cc (Layout::choose_output_section): Do not filter
370 SHF_LINK_ORDER flag in a relocatable link.
372 2010-10-17 Cary Coutant <ccoutant@google.com>
374 * output.h (Output_segment::set_section_addresses): Change function
375 signature. Update all callers.
376 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
378 (Output_segment::set_section_addresses): Align after last TLS
379 section. Add padding before last relro section instead of after.
381 2010-10-17 Doug Kwan <dougkwan@google.com>
383 * gold/arm.cc (Target_arm::got_section): Use correct order and set
384 GOT output section to be writable.
386 2010-10-14 Cary Coutant <ccoutant@google.com>
388 * debug.h (DEBUG_INCREMENTAL): New flag.
389 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
390 * gold.cc (queue_initial_tasks): Check parameters for incremental link
392 * incremental.cc (report_command_line): Ignore all forms of
394 * layout.cc (Layout::Layout): Check parameters for incremental link
396 * options.cc (General_options::parse_incremental): New function.
397 (General_options::parse_no_incremental): New function.
398 (General_options::parse_incremental_full): New function.
399 (General_options::parse_incremental_update): New function.
400 (General_options::incremental_mode_): New data member.
401 (General_options::finalize): Check incremental_mode_.
402 * options.h (General_options): Update help text for --incremental.
403 Add --no-incremental, --incremental-full, --incremental-update.
404 (General_options::Incremental_mode): New enum type.
405 (General_options::incremental_mode): New function.
406 (General_options::incremental_mode_): New data member.
407 * parameters.cc (Parameters::incremental_mode_): New data member.
408 (Parameters::set_options): Set incremental_mode_.
409 (Parameters::set_incremental_full): New function.
410 (Parameters::incremental): New function.
411 (Parameters::incremental_update): New function.
412 (set_parameters_incremental_full): New function.
413 * parameters.h (Parameters::set_incremental_full): New function.
414 (Parameters::incremental): New function.
415 (Parameters::incremental_update): New function.
416 (Parameters::incremental_mode_): New data member.
417 (set_parameters_incremental_full): New function.
418 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
419 incremental link mode.
420 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
421 (Sized_relobj::do_relocate_sections): Likewise.
422 * testsuite/Makefile.am (incremental_test): Use --incremental-full
424 * testsuite/Makefile.in: Regenerate.
425 * testsuite/incremental_test.sh: Filter all forms of --incremental.
427 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
429 * script-sections.h (class Script_sections): Make
430 Sections_elements typedef public.
431 * script-sections.cc (class Sort_output_sections): Add elements_
432 field. Add constructor which sets it; change all callers.
433 (Sort_output_sections::is_before): New function.
434 (Sort_output_sections::operator()): Call is_before.
435 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
437 * testsuite/script_test_10.sh: New test. Test script section
439 * testsuite/script_test_10.t: Likewise.
440 * testsuite/script_test_10.s: Likewise.
441 * testsuite/Makefile.am: Wrap the cross linker tests and the
442 common tests into NATIVE_OR_CROSS_LINKER.
443 (check_SCRIPTS): Add script_test_10.sh.
444 (check_DATA): Add script_test_10.stdout.
445 (script_test_10.o, script_test_10): New targets.
446 (script_test_10.stdout): New target.
447 * configure, testsuite/Makefile.in: Regenerate.
449 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
451 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
452 error for the deprecated relocations.
453 (Target_arm::Scan::global): Likewise.
454 (Target_arm::Relocate::relocate): Likewise.
456 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
458 * fileread.cc (Input_file::find_file): Initialize *found_name
459 and *namep when using the fallback search for case 4.
461 2010-10-11 Cary Coutant <ccoutant@google.com>
463 * options.h (class General_options): Redefine -z lazy as an alias for
464 the negation of -z now.
466 2010-10-11 Ian Lance Taylor <iant@google.com>
468 * resolve.cc (symbol_to_bits): Report the value of the unsupported
471 2010-10-06 Nick Clifton <nickc@redhat.com>
473 * script-sections.cc(class Memory_region): Remove
474 current_lma_offset_ field. Rename current_vma_offset_ to
475 current_offset_. Add last_section_ field.
476 (Memory_region::get_current_vma_address): Rename to
478 (Memory_region::get_current_lma_address): Delete.
479 (Memory_region::increment_vma_offset): Rename to
481 (Memory_region::increment_lma_offset): Delete.
482 (Memory_region::attributes_compatible): New method. Returns
483 true if the provided section is compatible with the region.
484 (Memory_region::get_last_section): New method. Returns the last
485 section to use the region.
486 (Memory_region::set_last_section): New method. Stores the last
487 section to use the region.
488 (Script_sections::block_in_region): New method. Returns true if
489 a block of memory is contained within a region.
490 (Script_sections::find_memory_region): New method. Locates a
491 memory region to be used to set a VMA or LMA address.
492 (Output_section_definition::set_section_addresses): Add code to
493 check for addresses set by memory regions.
494 (Output_segment::set_section_addresses): Remove memory region
496 (Script_sections::create_segment): Add a warning if a header
497 segment is created outside of any region.
498 * script-sections.h (class Script_sections): Add prototypes for
499 find_memory_region and block_in_region methods.
500 * testsuite/memory_test.s: Use .long instead of .word.
501 * testsuite/memory_test.t: Add some more output sections.
502 * testsuite/memory_test.sh: Update expected output.
504 2010-10-02 Doug Kwan <dougkwan@google.com>
506 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
507 defintion to symtab.h
508 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
509 declaration to defintion.
511 2010-10-01 Nick Clifton <nickc@redhat.com>
513 * expression.cc (eval): Replace dummy argument with NULL.
514 (eval_maybe_dot): Check for a NULL result section pointer.
515 (Symbol_expression::value): Likewise.
516 (Dot_expression::value): Likewise.
517 (BINARY_EXPRESSION): Likewise.
518 (Max_expression::value): Likewise.
519 (Min_expression::value): Likewise.
520 (Absolute_expression::value): Likewise.
521 (Addr_expression::value_from_output_section): Likewise.
522 (Loaddddr_expression::value_from_output_section): Likewise.
523 (Segment_start_expression::value): Likewise.
525 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
527 (Sections_elememt_dot_assignment::set_section_addresses):
529 (Output_data_expression::do_write_to_buffer): Likewise.
530 (Output_section_definition::finalize_symbols): Likewise.
531 (Output_section_definition::set_section_addresses): Likewise.
533 2010-09-30 Doug Kwan <dougkwan@google.com>
535 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
537 2010-09-28 Sriraman Tallam <tmsriram@google.com>
539 * target.h (Target::can_icf_inline_merge_sections): New virtual
541 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
543 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
545 * icf.cc (get_section_contents): Inline merge sections only when
548 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
550 * configure: Regenerate.
552 2010-09-17 Ian Lance Taylor <iant@google.com>
554 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
555 * testsuite/Makefile.am (memory_test.o): New target.
556 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
558 * testsuite/Makefile.in: Rebuild.
560 2010-09-17 Doug Kwan <dougkwan@google.com>
562 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
563 defintion if relocation uses GOT entries of the symbol.
564 * testsuite/icf_safe_test.sh: Fix test.
565 * testsuite/icf_safe_so_test.sh: Fix test.
567 2010-09-16 Cary Coutant <ccoutant@google.com>
569 * script_sections.cc (class Memory_region): Remove "NULL" from
570 vector initializations.
572 2010-09-15 Cary Coutant <ccoutant@google.com>
574 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
575 Resolve forwarding symbols.
577 2010-09-15 Doug Kwan <dougkwan@google.com>
579 * gold/testsuite/script_test_3.t: Add ARM special sections.
580 * gold/testsuite/script_test_4.t: Same.
581 * gold/testsuite/script_test_5.t: Same.
582 * gold/testsuite/script_test_6.t: Same.
583 * gold/testsuite/script_test_7.t: Same.
584 * gold/testsuite/script_test_7.t: Same.
585 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
587 2010-09-14 Cary Coutant <ccoutant@google.com>
589 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
590 (Target_x86_64::Relocate::relocate_tls): Replace check for
591 saw_tls_block_reloc_ with test for executable section.
593 2010-09-12 Cary Coutant <ccoutant@google.com>
595 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
596 position-independent executables to shared libraries need dynamic
598 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
599 position-independent executables.
600 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
601 * testsuite/Makefile.in: Regenerate.
603 2010-09-10 Nick Clifton <nickc@redhat.com>
606 * testsuite/memory_test.t: Discard any sections that are not
609 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
612 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
613 "This::" to work around a bug in gcc 4.2.
615 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
617 2010-09-09 Rafael Espindola <espindola@google.com>
619 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
620 sections with different PF_X flags in the same segment.
621 (Layout::find_first_load_seg): Search all segments to find the first
623 * options.h (rosegment): New.
625 2010-09-08 Rafael Espindola <espindola@google.com>
627 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
629 2010-09-08 Doug Kwan <dougkwan@google.com>
631 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
632 (Arm_relobj::do_relocate_sections): Add new parameter for output
633 file to match the parent.
634 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
635 of local symbols instead of input values. Update code to track
636 changes in gold::relocate_section.
637 * object.cc (Sized_relobj::compute_final_local_value): New methods.
638 (Sized_relobj::compute_final_local_value_internal): New methods.
639 (Sized_relobj::do_finalize_local_symbols): Move code from loop
640 body into private version of Sized_relobj::compute_final_local_value.
641 Call the inline method.
642 * object.h (Symbol_value::Symbol_value): Define destructor. Free
643 merged symbol value if there is one.
644 (Symbol_value::has_output_value): New method defintiion.
645 (Sized_relobj::Compute_final_local_value_status): New enum type.
646 (Sized_relobj::compute_final_local_value): New methods.
647 (Sized_relobj::compute_final_local_value_internal): New methods.
648 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
649 and arm_cortex_a8.sh.
650 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
651 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
653 * Makefile.in: Regenerate.
654 * testsuite/arm_bl_out_of_range.s: Update test.
655 * testsuite/thumb_bl_out_of_range.s: Ditto.
656 * testsuite/thumb_blx_out_of_range.s: Ditto.
657 * testsuite/arm_branch_out_of_range.sh: New file.
658 * testsuite/arm_cortex_a8.sh: Ditto.
659 * testsuite/arm_cortex_a8_b.s: Ditto.
660 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
661 * testsuite/arm_cortex_a8_b_local.s: Ditto.
662 * testsuite/arm_cortex_a8_bl.s: Ditto.
663 * testsuite/arm_cortex_a8_blx.s: Ditto.
664 * testsuite/arm_cortex_a8_local.s: Ditto.
665 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
666 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
668 2010-09-08 Rafael Espindola <espindola@google.com>
670 * Makefile.am (memory_test.stdout): Run readelf with -W.
671 * Makefile.in: Regenerate.
672 * testsuite/memory_test.sh: Make the regexps accept both 32 and
675 2010-09-08 Rafael Espindola <espindola@google.com>
677 * script-sections.cc (Script_sections::add_memory_region): Convert
678 field precision to int.
679 * script.cc (script_set_section_region, script_set_section_region):
680 Convert field precision to int.
682 2010-09-08 Rafael Espindola <espindola@google.com>
684 * arm.cc (do_finalize_sections): Create the __exidx_start and
685 __exdix_end symbols even when the section is missing.
687 2010-09-08 Nick Clifton <nickc@redhat.com>
689 * README: Remove claim that MEMORY is not supported.
690 * expression.cc (script_exp_function_origin)
691 (script_exp_function_length): Move from here to ...
692 * script.cc: ... here.
693 (script_set_section_region, script_add_memory)
694 (script_parse_memory_attr, script_include_directive): New
697 (class Memory_region): New class.
698 (class Output_section_definition): Add set_memory_region,
699 set_section_vma, set_section_lma and get_section_name methods.
700 (class Script_Sections): Add add_memory_region,
701 find_memory_region, find_memory_region_origin,
702 find_memory_region_length and set_memory_region methods.
703 Have set_section_addresses method walk the list of set memory
705 Extend the print methos to display memory regions.
706 * script-sections.h: Add prototypes for new methods.
707 Add enum for MEMORY region attributes.
708 * yyscript.y: Add support for parsing MEMORY regions.
709 * script-c.h: Add prototypes for new functions.
710 * testsuite/Makefile.am: Add test of MEMORY region functionality.
711 * testsuite/Makefile.in: Regenerate.
712 * testsuite/memory_test.sh: New script.
713 * testsuite/memory_test.s: New assembler source file.
714 * testsuite/memory_test.t: New linker script.
716 2010-08-27 Doug Kwan <dougkwan@google.com>
718 * gold/resolve.cc (Symbol_table::should_override): Let a weak
719 reference override an existing dynamic weak reference.
720 * testsuite/Makefile.am: Add new test dyn_weak_ref.
721 * testsuite/Makefile.in: Regenerate.
722 * testsuite/dyn_weak_ref.sh: New file.
723 * testsuite/dyn_weak_ref_1.c: Ditto.
724 * testsuite/dyn_weak_ref_2.c: Ditto.
726 2010-08-27 Ian Lance Taylor <iant@google.com>
728 * incremental.h (class Incremental_input_entry): Add virtual
731 2010-08-27 Ian Lance Taylor <iant@google.com>
733 * testsuite/start_lib_test_3.c: Mark t3 as used.
735 2010-08-27 Nick Clifton <nickc@redhat.com>
737 * options.cc (version_script): Fix small typo in previous
740 2010-08-25 Nick Clifton <nickc@redhat.com>
742 * archive.cc: Formatting fixes: Remove whitespace between
743 typename and following asterisk. Remove whitespace between
744 function name and opening parenthesis.
745 * archive.h: Likewise.
747 * attributes.cc: Likewise.
748 * attributes.h: Likewise.
749 * common.cc: Likewise.
750 * copy-relocs.cc: Likewise.
751 * dirsearch.h: Likewise.
752 * dynobj.cc: Likewise.
753 * ehframe.cc: Likewise.
754 * ehframe.h: Likewise.
755 * expression.cc: Likewise.
756 * fileread.cc: Likewise.
757 * fileread.h: Likewise.
759 * gold-threads.cc: Likewise.
763 * incremental-dump.cc: Likewise.
764 * incremental.cc: Likewise.
765 * layout.cc: Likewise.
766 * layout.h: Likewise.
768 * merge.cc: Likewise.
770 * object.cc: Likewise.
771 * object.h: Likewise.
772 * options.cc: Likewise.
773 * options.h: Likewise.
774 * output.cc: Likewise.
775 * output.h: Likewise.
776 * plugin.cc: Likewise.
777 * plugin.h: Likewise.
778 * powerpc.cc: Likewise.
779 * reloc.cc: Likewise.
780 * script-c.h: Likewise.
781 * script-sections.cc: Likewise.
782 * script.cc: Likewise.
783 * stringpool.cc: Likewise.
784 * symtab.cc: Likewise.
785 * symtab.h: Likewise.
786 * target.cc: Likewise.
787 * timer.cc: Likewise.
789 * version.cc: Likewise.
790 * x86_64.cc: Likewise.
792 2010-08-24 Nick Clifton <nickc@redhat.com>
795 * layout.cc (segment_precedes): Sort segments by their physical
796 addresses, if they have been set.
798 2010-08-23 Cary Coutant <ccoutant@google.com>
800 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
802 (Lib_group::include_member): Unlock object after deleting its
804 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
807 2010-08-19 Neil Vachharajani <nvachhar@google.com>
808 Cary Coutant <ccoutant@google.com>
810 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
811 constructor, and set_blocker.
812 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
814 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
815 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
816 * testsuite/Makefile.am (start_lib_test): New test case.
817 * testsuite/Makefile.in: Regenerate.
818 * testsuite/start_lib_test_main.c: New file.
819 * testsuite/start_lib_test_1.c: New file.
820 * testsuite/start_lib_test_2.c: New file.
821 * testsuite/start_lib_test_3.c: New file.
823 2010-08-19 Ian Lance Taylor <iant@google.com>
825 * Makefile.in: Rebuild with automake 1.11.1.
826 * aclocal.m4: Likewise.
827 * testsuite/Makefile.in: Likewise.
829 2010-08-19 Ian Lance Taylor <iant@google.com>
832 * i386.cc (class Output_data_plt_i386): Update declarations.
833 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
834 local_ifuncs_ fields.
835 (Target_i386::do_plt_section_for_global): New function.
836 (Target_i386::do_plt_section_for_local): New function.
837 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
838 parameter; change all callers. Initialize global_ifuncs_ and
839 local_ifuncs_. If doing a static link define __rel_iplt_start and
841 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
842 (Output_data_plt_i386::add_local_ifunc_entry): New function.
843 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
845 (Target_i386::make_plt_section): New function, broken out of
846 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
847 (Target_i386::make_plt_entry): Call make_plt_section.
848 (Target_i386::make_local_ifunc_plt_entry): New function.
849 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
850 (Target_i386::Scan::local): Handle IFUNC symbols. Add
851 R_386_IRELATIVE to switch.
852 (Target_i386::Scan::global): Likewise.
853 (Target_i386::Relocate::relocate): Likewise.
854 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
856 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
857 (Target_x86_64::do_plt_section_for_global): New function.
858 (Target_x86_64::do_plt_section_for_local): New function.
859 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
860 parameter; change all callers. If doing a static link define
861 __rela_iplt_start and __rela_iplt_end.
862 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
863 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
864 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
866 (Target_x86_64::make_local_ifunc_plt_entry): New function.
867 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
869 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
870 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
871 R_X86_64_IRELATIVE to switch.
872 (Target_x86_64::Scan::global): Likewise.
873 (Target_x86_64::Relocate::relocate): Likewise.
874 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
876 * target.h (class Target): Add plt_section_for_global and
877 plt_section_for_local functions. Add do_plt_section_for_global
878 and do_plt_section_for_local virtual functions.
879 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
881 (Symbol::use_plt_offset): Handle IFUNC symbol.
882 * object.cc (Sized_relobj::Sized_relobj): Initialize
884 (Sized_relobj::local_has_plt_offset): New function.
885 (Sized_relobj::local_plt_offset): New function.
886 (Sized_relobj::set_local_plt_offset): New function.
887 (Sized_relobj::do_count): Handle IFUNC symbol.
888 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
889 a bit away from input_shndx_ field. Add set_is_func_symbol and
890 is_ifunc_symbol functions.
891 (class Sized_relobj): Update declarations. Remove Tls_got_entry
892 and Local_tls_got_offsets. Define Local_plt_offsets. Add
893 local_plt_offsets_ field.
894 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
895 * output.h (class Output_section_data): Add non-const
896 output_section function.
897 (class Output_data_got): Update declarations.
898 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
899 Add use_plt_offset parameter to global and local constructors.
900 Change all callers. Change local_sym_index_ field to 31 bits.
901 Change GSYM_CODE and CONSTANT_CODE accordingly.
902 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
903 doing a static link don't set sh_link field.
904 (Output_data_got::Got_entry::write): Use PLT offset if
906 (Output_data_got::add_global_plt): New function.
907 (Output_data_got::add_local_plt): New function.
908 * target-reloc.h (relocate_section): Handle IFUNC symbol.
909 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
910 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
911 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
912 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
914 * testsuite/ifunc-sel.h: New file.
915 * testsuite/ifuncmain1.c: New file.
916 * testsuite/ifuncmain1vis.c: New file.
917 * testsuite/ifuncmod1.c: New file.
918 * testsuite/ifuncdep2.c: New file.
919 * testsuite/ifuncmain2.c: New file.
920 * testsuite/ifuncmain3.c: New file.
921 * testsuite/ifuncmod3.c: New file.
922 * testsuite/ifuncmain4.c: New file.
923 * testsuite/ifuncmain5.c: New file.
924 * testsuite/ifuncmod5.c: New file.
925 * testsuite/ifuncmain6pie.c: New file.
926 * testsuite/ifuncmod6.c: New file.
927 * testsuite/ifuncmain7.c: New file.
928 * configure, testsuite/Makefile.in: Rebuild.
930 2010-08-18 Ian Lance Taylor <iant@google.com>
933 (Output_section_incremental_inputs::write_input_files): Add cast
934 to avoid signed/unsigned comparison warning.
935 (Output_section_incremental_inputs::write_info_blocks): Likewise.
937 2010-08-12 Cary Coutant <ccoutant@google.com>
939 * common.cc (Sort_commons::operator()): Remove unnecessary code.
941 2010-08-13 Ian Lance Taylor <iant@google.com>
943 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
945 2010-08-12 Cary Coutant <ccoutant@google.com>
946 Doug Kwan <dougkwan@google.com>
948 * resolve.cc (Symbol_table::should_override): When a weak dynamic
949 defintion overrides non-weak undef, remember that the original undef
951 * symtab.cc (Symbol_table::sized_write_global): For undef without
952 an original weak binding, set binding to global in output.
953 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
954 * testsuite/Makefile.in: Regenerate.
955 * testsuite/strong_ref_weak_def.sh: New file.
956 * testsuite/strong_ref_weak_def_1.c: Ditto.
957 * testsuite/strong_ref_weak_def_2.c: Ditto.
959 2010-08-12 Cary Coutant <ccoutant@google.com>
961 * testsuite/incremental_test.sh: Rewrite.
962 * testsuite/incremental_test_1.c: Rewrite.
963 * testsuite/incremental_test_2.c: Rewrite.
965 2010-08-12 Cary Coutant <ccoutant@google.com>
967 * arm.cc (Target_arm::got_size): Add const.
968 (Target_arm::got_entry_count): New function.
969 (Target_arm::plt_entry_count): New function.
970 (Target_arm::first_plt_entry_offset): New function.
971 (Target_arm::plt_entry_size): New function.
972 (Output_data_plt_arm::entry_count): New function.
973 (Output_data_plt_arm::first_plt_entry_offset): New function.
974 (Output_data_plt_arm::get_plt_entry_size): New function.
975 * i386.cc (Target_i386::got_size): Add const.
976 (Target_i386::got_entry_count): New function.
977 (Target_i386::plt_entry_count): New function.
978 (Target_i386::first_plt_entry_offset): New function.
979 (Target_i386::plt_entry_size): New function.
980 (Output_data_plt_i386::entry_count): New function.
981 (Output_data_plt_i386::first_plt_entry_offset): New function.
982 (Output_data_plt_i386::get_plt_entry_size): New function.
983 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
984 find_incremental_inputs_sections. Dump incremental_got_plt section.
985 * incremental.cc: Include target.h.
986 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
987 parameter. Adjust all callers. Find incremental_got_plt section.
988 (Incremental_inputs::create_data_sections): Create incremental_got_plt
990 (Output_section_incremental_inputs::set_final_data_size): Calculate
991 size of incremental_got_plt section.
992 (Output_section_incremental_inputs::do_write): Write the
993 incremental_got_plt section.
994 (Got_plt_view_info): New struct.
995 (Local_got_offset_visitor): New class.
996 (Global_got_offset_visitor): New class.
997 (Global_symbol_visitor_got_plt): New class.
998 (Output_section_incremental_inputs::write_got_plt): New function.
999 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
1000 Add parameter. Adjust all callers.
1001 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
1002 (Incremental_inputs::got_plt_section): New function.
1003 (Incremental_inputs::got_plt_section_): New data member.
1004 (Incremental_got_plt_reader): New class.
1005 * layout.cc (Layout::create_incremental_info_sections): Add the
1006 incremental_got_plt section.
1007 * object.h (Got_offset_list::get_list): New function.
1008 (Got offset_list::for_all_got_offsets): New function.
1009 (Sized_relobj::local_got_offset_list): New function.
1010 * powerpc.cc (Target_powerpc::got_size): Add const.
1011 (Target_powerpc::got_entry_count): New function.
1012 (Target_powerpc::plt_entry_count): New function.
1013 (Target_powerpc::first_plt_entry_offset): New function.
1014 (Target_powerpc::plt_entry_size): New function.
1015 (Output_data_plt_powerpc::entry_count): New function.
1016 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
1017 (Output_data_plt_powerpc::get_plt_entry_size): New function.
1018 * sparc.cc (Target_sparc::got_size): Add const.
1019 (Target_sparc::got_entry_count): New function.
1020 (Target_sparc::plt_entry_count): New function.
1021 (Target_sparc::first_plt_entry_offset): New function.
1022 (Target_sparc::plt_entry_size): New function.
1023 (Output_data_plt_sparc::entry_count): New function.
1024 (Output_data_plt_sparc::first_plt_entry_offset): New function.
1025 (Output_data_plt_sparc::get_plt_entry_size): New function.
1026 * symtab.h (Symbol::got_offset_list): New function.
1027 (Symbol_table::for_all_symbols): New function.
1028 * target.h (Sized_target::got_entry_count): New function.
1029 (Sized_target::plt_entry_count): New function.
1030 (Sized_target::plt_entry_size): New function.
1031 * x86_64.cc (Target_x86_64::got_size): Add const.
1032 (Target_x86_64::got_entry_count): New function.
1033 (Target_x86_64::plt_entry_count): New function.
1034 (Target_x86_64::first_plt_entry_offset): New function.
1035 (Target_x86_64::plt_entry_size): New function.
1036 (Output_data_plt_x86_64::entry_count): New function.
1037 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
1038 (Output_data_plt_x86_64::get_plt_entry_size): New function.
1040 2010-08-12 Cary Coutant <ccoutant@google.com>
1042 * archive.cc: Include incremental.h.
1043 (Archive::Archive): Initialize incremental_info_.
1044 (Archive::include_member): Record archive members in incremental info.
1045 (Add_archive_symbols::run): Record begin and end of an archive in
1047 (Lib_group::include_member): Record objects in incremental info.
1048 * archive.h (Incremental_archive_entry): Forward declaration.
1049 (Archive::set_incremental_info): New member function.
1050 (Archive::incremental_info): New member function.
1051 (Archive::Unused_symbol_iterator): New class.
1052 (Archive::unused_symbols_begin): New member function.
1053 (Archive::unused_symbols_end): New member function.
1054 (Archive::incremental_info_): New data member.
1055 * incremental-dump.cc (find_input_containing_global): New function.
1056 (dump_incremental_inputs): Dump new incremental info sections.
1057 * incremental.cc: Include symtab.h.
1058 (Output_section_incremental_inputs): New class.
1059 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
1060 new incremental info sections.
1061 (Sized_incremental_binary::do_check_inputs): Likewise.
1062 (Incremental_inputs::report_archive): Remove.
1063 (Incremental_inputs::report_archive_begin): New function.
1064 (Incremental_inputs::report_archive_end): New function.
1065 (Incremental_inputs::report_object): New function.
1066 (Incremental_inputs::finalize_inputs): Remove.
1067 (Incremental_inputs::report_input_section): New function.
1068 (Incremental_inputs::report_script): Rewrite.
1069 (Incremental_inputs::finalize): Do nothing but finalize string table.
1070 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
1071 (Incremental_inputs::sized_create_inputs_section_data): Remove.
1072 (Incremental_inputs::create_data_sections): New function.
1073 (Incremental_inputs::relocs_entsize): New function.
1074 (Output_section_incremental_inputs::set_final_data_size): New function.
1075 (Output_section_incremental_inputs::do_write): New function.
1076 (Output_section_incremental_inputs::write_header): New function.
1077 (Output_section_incremental_inputs::write_input_files): New function.
1078 (Output_section_incremental_inputs::write_info_blocks): New function.
1079 (Output_section_incremental_inputs::write_symtab): New function.
1080 * incremental.h (Incremental_script_entry): Forward declaration.
1081 (Incremental_object_entry): Forward declaration.
1082 (Incremental_archive_entry): Forward declaration.
1083 (Incremental_inputs): Forward declaration.
1084 (Incremental_inputs_header_data): Remove.
1085 (Incremental_inputs_header): Remove.
1086 (Incremental_inputs_header_write): Remove.
1087 (Incremental_inputs_entry_data): Remove.
1088 (Incremental_inputs_entry): Remove.
1089 (Incremental_inputs_entry_write): Remove.
1090 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
1091 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
1092 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
1093 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
1095 (Incremental_input_entry): New class.
1096 (Incremental_script_entry): New class.
1097 (Incremental_object_entry): New class.
1098 (Incremental_archive_entry): New class.
1099 (Incremental_inputs::Incremental_inputs): Initialize new data members.
1100 (Incremental_inputs::report_inputs): Remove.
1101 (Incremental_inputs::report_archive): Remove.
1102 (Incremental_inputs::report_archive_begin): New function.
1103 (Incremental_inputs::report_archive_end): New function.
1104 (Incremental_inputs::report_object): Change prototype.
1105 (Incremental_inputs::report_input_section): New function.
1106 (Incremental_inputs::report_script): Change prototype.
1107 (Incremental_inputs::get_reloc_count): New function.
1108 (Incremental_inputs::set_reloc_count): New function.
1109 (Incremental_inputs::create_data_sections): New function.
1110 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
1111 (Incremental_inputs::inputs_section): New function.
1112 (Incremental_inputs::symtab_section): New function.
1113 (Incremental_inputs::relocs_section): New function.
1114 (Incremental_inputs::get_stringpool): Add const.
1115 (Incremental_inputs::command_line): Add const.
1116 (Incremental_inputs::inputs): Remove.
1117 (Incremental_inputs::command_line_key): New function.
1118 (Incremental_inputs::input_file_count): New function.
1119 (Incremental_inputs::input_files): New function.
1120 (Incremental_inputs::relocs_entsize): New function.
1121 (Incremental_inputs::sized_create_inputs_section_data): Remove.
1122 (Incremental_inputs::finalize_inputs): Remove.
1123 (Incremental_inputs::Input_info): Remove.
1124 (Incremental_inputs::lock_): Remove.
1125 (Incremental_inputs::inputs_): Change type.
1126 (Incremental_inputs::inputs_map_): Remove.
1127 (Incremental_inputs::current_object_entry_): New data member.
1128 (Incremental_inputs::inputs_section_): New data member.
1129 (Incremental_inputs::symtab_section_): New data member.
1130 (Incremental_inputs::relocs_section_): New data member.
1131 (Incremental_inputs::reloc_count_): New data member.
1132 (Incremental_inputs_reader): New class.
1133 (Incremental_symtab_reader): New class.
1134 (Incremental_relocs_reader): New class.
1135 * layout.cc (Layout::finalize): Move finalization of incremental info
1136 and creation of incremental info sections to follow finalization of
1137 symbol table. Set offsets for postprocessing sections.
1138 (Layout::create_incremental_info_sections): Call
1139 Incremental_inputs::create_data_sections. Add incremental symtab
1140 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
1141 sections to layout after input sections.
1142 * layout.h (struct Timespec): Forward declaration.
1143 (Layout::incremental_inputs): Add const.
1144 (Layout::create_incremental_info_sections): Add parameter.
1145 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
1146 * object.cc: Include incremental.h.
1147 (Relobj::finalize_incremental_relocs): New function.
1148 (Sized_relobj::do_layout): Record input sections in incremental info.
1149 * object.h (Object::output_section): New function.
1150 (Object::output_section_offset): Moved from Relobj.
1151 (Object::get_incremental_reloc_base): New function.
1152 (Object::get_incremental_reloc_count): New function.
1153 (Object::do_output_section): New function.
1154 (Object::do_output_section_offset): Moved from Relobj.
1155 (Object::do_get_incremental_reloc_base): New function.
1156 (Object::do_get_incremental_reloc_count): New function.
1157 (Object::Object): Initialize new data members.
1158 (Relobj::output_section): Renamed do_output_section and moved to
1160 (Relobj::output_section_offset): Moved to Object.
1161 (Relobj::do_get_incremental_reloc_base): New function.
1162 (Relobj::do_get_incremental_reloc_count): New function.
1163 (Relobj::allocate_incremental_reloc_counts): New function.
1164 (Relobj::count_incremental_reloc): New function.
1165 (Relobj::finalize_incremental_relocs): New function.
1166 (Relobj::next_incremental_reloc_index): New function.
1167 (Relobj::reloc_counts_): New data member.
1168 (Relobj::reloc_bases_): New data member.
1169 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
1170 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
1171 (Sized_relobj::incremental_relocs_scan): New function.
1172 (Sized_relobj::incremental_relocs_scan_reltype): New function.
1173 (Sized_relobj::incremental_relocs_write): New function.
1174 (Sized_relobj::incremental_relocs_write_reltype): New function.
1175 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
1177 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
1178 archives and object files elsewhere.
1179 (Add_symbols::run): Report object files here.
1180 (Finish_group::run): Report end of archive at end of group.
1181 * reloc.cc: Include layout.h, incremental.h.
1182 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
1183 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
1184 (Sized_relobj::incremental_relocs_scan): New function.
1185 (Sized_relobj::incremental_relocs_scan_reltype): New function.
1186 (Sized_relobj::do_relocate_sections): Write incremental relocations.
1187 (Sized_relobj::incremental_relocs_write): New function.
1188 (Sized_relobj::incremental_relocs_write_reltype): New function.
1189 * script.cc (read_input_script): Rewrite test for incremental link.
1190 Change call to Incremental_inputs::report_script.
1191 * symtab.h (Symbol_table::first_global_index): New function.
1192 (Symbol_table::output_count): New function.
1194 2010-08-12 Doug Kwan <dougkwan@google.com>
1196 * arm.cc (Target_arm::merge_object_attributes): Check command line
1197 options --no-wchar-size-warning and --no-enum-size-warning.
1198 * options.h (General_options): Add ld-compatible options
1199 --no-enum-size-warning and --no-wchar-size-warning.
1201 2010-08-04 Ian Lance Taylor <iant@google.com>
1203 * x86_64.cc (Target_x86_64::Scan::local): Use
1204 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
1205 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
1206 (Target_x86_64::Scan::global): Likewise.
1207 (Target_x86_64::Relocate::relocate): Likewise.
1208 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
1211 2010-08-03 Cary Coutant <ccoutant@google.com>
1213 * merge.cc (Output_merge_string::do_add_input_section): Count strings
1214 to reserve space in merged_strings vector. Keep total input size
1216 (Output_merge_string::do_print_merge_stats): Print total input size.
1217 * merge.h (Output_merge_string): Add input_size_ field.
1218 * stringpool.cc (Stringpool_template::string_length): Move
1219 implementations out of Stringpool_template class and place in
1221 * stringpool.h (string_length): Move out of Stringpool_template.
1223 2010-08-03 Ian Lance Taylor <iant@google.com>
1226 * layout.cc (relaxation_loop_body): If address of load segment is
1227 set, adjust address to include headers if possible.
1229 2010-08-03 Ian Lance Taylor <iant@google.com>
1231 * version.cc (version_string): Bump to 1.10.
1233 2010-08-03 Ian Lance Taylor <iant@google.com>
1236 * layout.h (enum Output_section_order): Define.
1237 (class Layout): Update declarations.
1238 * layout.cc (Layout::get_output_section): Add order parameter.
1239 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
1240 is_first_non_relro parameters. Change all callers.
1241 (Layout::choose_output_section): Likewise.
1242 (Layout::add_output_section_data): Likewise.
1243 (Layout::make_output_section): Likewise. Set order.
1244 (Layout::default_section_order): New function.
1245 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
1246 * output.cc (Output_section::Output_section): Initialize order_.
1247 Don't initialize deleted fields.
1248 (Output_segment::Output_segment): Don't initialize deleted
1250 (Output_segment::add_output_section_to_load): New function
1251 replacing add_output_section. Change all callers to call this or
1252 add_output_section_to_nonload.
1253 (Output_segment::add_output_section_to_nonload): New function.
1254 (Output_segment::remove_output_section): Rewrite.
1255 (Output_segment::add_initial_output_data): Likewise.
1256 (Output_segment::has_any_data_sections): Likewise.
1257 (Output_segment::is_first_section_relro): Likewise.
1258 (Output_segment::maximum_alignment): Likewise.
1259 (Output_segment::has_dynamic_reloc): New function replacing
1260 dynamic_reloc_count. Change all callers.
1261 (Output_segment::has_dynamic_reloc_list): New function replacing
1262 dynamic_reloc_count_list. Change all callers.
1263 (Output_segment::set_section_addresses): Rewrite.
1264 (Output_segment::set_offset): Rewrite.
1265 (Output_segment::find_first_and_last_list): Remove.
1266 (Output_segment::set_tls_offsets): Rewrite.
1267 (Output_segment::first_section_load_address): Likewise.
1268 (Output_segment::output_section_count): Likewise.
1269 (Output_segment::section_with_lowest_load_address): Likewise.
1270 (Output_segment::write_section_headers): Likewise.
1271 (Output_segment::print_sections_to_map): Likewise.
1272 * output.h (class Output_data): Remove dynamic_reloc_count_
1273 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
1274 (Output_data::add_dynamic_reloc): Rewrite.
1275 (Output_data::has_dynamic_reloc): New function.
1276 (Output_data::dynamic_reloc_count): Remove.
1277 (class Output_section): Add order_ field. Remvoe is_relro_local_,
1278 is_last_relro_, is_first_non_relro_, is_interp_,
1279 is_dynamic_linker_section_ fields. Add order and set_order
1280 functions. Remove is_relro_local, set_is_relro_local,
1281 is_last_relro, set_is_last_relro, is_first_non_relro,
1282 set_is_first_non_relro functions, is_interp, set_is_interp,
1283 is_dynamic_linker_section, and set_is_dynamic_linker_section
1285 (class Output_segment): Change Output_data_list from std::list to
1286 std:;vector. Add output_lists_ field. Remove output_data_ and
1287 output_bss_ fields. Update declarations.
1289 2010-08-02 Ian Lance Taylor <iant@google.com>
1291 * arm.cc (Target_arm::gc_process_relocs): Use typename.
1292 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
1293 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
1295 2010-08-02 Ian Lance Taylor <iant@google.com>
1298 * script.cc (Script_options::Script_options): Initialize
1299 symbol_definitions_ and symbol_references_.
1300 (Script_options::add_symbol_assignment): Update
1301 symbol_definitions_ and symbol_references_.
1302 (Script_options::add_symbol_reference): New function.
1303 (script_symbol): New function.
1304 * script.h (class Script_options): Add symbol_definitions_ and
1305 symbol_references_ fields.
1306 (Script_options::referenced_const_iterator): New type.
1307 (Script_options::referenced_begin): New function.
1308 (Script_options::referenced_end): New function.
1309 (Script_options::is_referenced): New function.
1310 (Script_options::any_unreferenced): New function.
1311 * script-c.h (script_symbol): Declare.
1312 * yyscript.y (exp): Call script_symbol.
1313 * symtab.cc: Include "script.h".
1314 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
1315 Change all callers. Check symbols referenced by scripts.
1316 (Symbol_table::add_undefined_symbols_from_command_line): Add
1317 layout parameter. Change all callers.
1318 (Symbol_table::do_add_undefined_symbols_from_command_line):
1319 Likewise. Break out loop body. Check symbols referenced by
1321 (Symbol_table::add_undefined_symbol_from_command_line): New
1322 function broken out of
1323 do_add_undefined_symbols_from_command_line.
1324 * symtab.h (class Symbol_table): Update declarations.
1325 * archive.cc: Include "layout.h".
1326 (Archive::should_include_member): Add layout parameter. Change
1327 all callers. Check for symbol mentioned in expression.
1328 * archive.h (class Archive): Update declaration.
1329 * object.cc (Sized_relobj::do_should_include_member): Add layout
1331 * object.h (Object::should_include_member): Add layout parameter.
1333 (Object::do_should_include_member): Add layout parameter.
1334 (class Sized_relobj): Update declaration.
1335 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
1337 * dynobj.h (class Sized_dynobj): Update declaration.
1338 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
1340 * plugin.h (class Sized_pluginobj): Update declaration.
1342 2010-08-02 Ian Lance Taylor <iant@google.com>
1345 * output.cc (Output_segment::set_offset): Search for the first and
1346 last sections rather than assuming that the list is in order.
1347 (Output_segment::find_first_and_last_list): New function.
1348 * output.h (class Output_segment): Update declarations.
1349 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
1350 (relro_strip_test_SOURCES): New variable.
1351 (relro_strip_test_DEPENDENCIES): New variable.
1352 (relro_strip_test_LDFLAGS): New variable.
1353 (relro_strip_test_LDADD): New variable.
1354 (relro_strip_test.so): New target.
1356 2010-08-02 Ian Lance Taylor <iant@google.com>
1358 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
1359 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
1360 (Target_i386::got_tlsdesc_section): New function.
1361 (Target_i386::got_section): Create space for GOT entries for
1362 TLSDESC relocations.
1363 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
1365 (Target_i386::Scan::global): Likewise.
1366 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
1368 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
1369 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
1370 (Target_x86_64::got_tlsdesc_section): New function.
1371 (Target_x86_64::got_section): Create space for GOT entries for
1372 TLSDESC relocations.
1373 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
1375 (Target_x86_64::Scan::global): Likewise.
1376 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
1379 2010-08-02 Ian Lance Taylor <iant@google.com>
1381 * testsuite/final_layout.sh: Use dc to convert from hex to
1384 2010-07-29 Sriraman Tallam <tmsriram@google.com>
1386 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
1387 paramter to the call to gold::gc_process_relocs.
1388 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
1389 paramter to the call to gold::gc_process_relocs.
1390 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
1391 parameter to the call to gold::gc_process_relocs.
1392 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
1393 template parameter to the call to gold::gc_process_relocs.
1394 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
1395 paramter to the call to gold::gc_process_relocs.
1396 * gc.h (get_embedded_addend_size): New function.
1397 (gc_process_relocs): Save the size of the reloc for use by ICF.
1398 * icf.cc (get_section_contents): Get the addend from the text section
1399 for SHT_REL relocation sections.
1400 * icf.h (Icf::Reloc_addend_size_info): New typedef.
1401 (Icf::Reloc_info): Add new member reloc_addend_size_info.
1402 * int_encoding.h (read_from_pointer): New overloaded function.
1403 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
1404 * testsuite/icf_sht_rel_addend_test.sh: New file.
1405 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
1406 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
1408 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1410 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
1411 * Makefile.in: Regenerate.
1412 * testsuite/Makefile.in: Regenerate.
1414 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
1416 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
1417 * gold/testsuite/debug_msg.cc: Likewise.
1418 * gold/testsuite/odr_violation1.cc
1419 * gold/testsuite/odr_violation2.cc
1421 2010-07-21 Cary Coutant <ccoutant@google.com>
1423 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
1424 string, and length fields.
1425 (Output_merge_string::Merged_strings_list): New type.
1426 (Output_merge_string::Merged_strings_lists): New typedef.
1427 (Output_merge_string): Replace merged_strings_ with
1428 merged_strings_lists_.
1429 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
1430 Merged_strings_list per input object and section. Don't store pointer
1431 to the string. Don't store length with each merged string entry.
1432 (Output_merge_string::finalize_merged_data): Loop over list of merged
1433 strings lists. Recompute length of each merged string.
1435 2010-07-15 Cary Coutant <ccoutant@google.com>
1437 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
1440 2010-07-14 Ian Lance Taylor <iant@google.com>
1442 * descriptors.cc (Descriptors::open): Report correct name in error
1445 2010-07-13 Doug Kwan <dougkwan@google.com>
1447 * arm.cc (Arm_input_section::Arm_input_section): For a
1448 SHT_ARM_EXIDX section, always keeps the input sections.
1449 (Arm_input_section::set_exidx_section_link): New method.
1450 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
1451 has_errors_ to false.
1452 (Arm_exidx_input_section::has_errors,
1453 Arm_exidx_input_section::set_has_errors): New methods.
1454 (Arm_exidx_input_section::has_errors_): New data member.
1455 (Arm_relobj::get_exidx_shndx_list): New method.
1456 (Arm_output_section::append_text_sections_to_list): Do not skip
1457 section without SHF_EXECINSTR.
1458 (Arm_output_section::fix_exidx_coverage): Skip input sections with
1460 (Arm_relobj::make_exidx_input_section): Add new parameter for text
1461 section header. Make error messages more verbose. Check for
1462 a non-executable section linked to an EXIDX section.
1463 (Arm_relobj::do_read_symbols): Remove error checking, which has been
1464 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
1465 check that there is no deferred EXIDX section if we exit early.
1466 Instead of not making an EXIDX section in case of an error, make one
1467 and set the has_errors flag of it.
1468 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
1469 in a relocatable link.
1470 (Target_arm::do_relax): Look for the EXIDX output section instead of
1471 assuming that it is called .ARM.exidx.
1472 (Target_arm::fix_exidx_coverage): Add a new parameter for input
1473 section list. Do not check for SHF_EXECINSTR section flags but
1474 skip any input section with errors.
1475 * output.cc (Output_section::Output_section): Initialize
1476 always_keeps_input_sections_ to false.
1477 (Output_section::add_input_section): Check for
1478 always_keeps_input_sections_.
1479 * output.h (Output_section::always_keeps_input_sections,
1480 Output_section::set_always_keeps_input_sections): New methods.
1481 (Output_section::always_keeps_input_sections): New data member.
1483 2010-07-13 Rafael Espindola <espindola@google.com>
1485 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
1486 * fileread.h (Input_file): Add try_extra_search_path and find_file.
1488 2010-07-13 Philip Herron <herron.philip@googlemail.com>
1489 Ian Lance Taylor <iant@google.com>
1491 * output.h (Output_section_lookup_maps::add_merge_section):
1492 Correct check of whether value was inserted.
1493 (Output_section_lookup_maps::add_merge_input_section): Likewise.
1494 (Output_section_lookup_maps::add_relaxed_input_section):
1496 * arm.cc (Target_arm::got_section): Remove used local os.
1497 * i386.cc (Target_i386::got_section): Likewise.
1498 * x86_64.cc (Target_x86_64::got_section): Likewise.
1499 * sparc.cc (Target_sparc::got_section): Likewise.
1500 (Target_sparc::relocate): Remove unused local have_got_offset.
1501 * powerpc.cc (Target_powerpc::relocate): Likewise.
1503 2010-07-13 Ian Lance Taylor <iant@google.com>
1505 * compressed_output.cc (zlib_decompress): Fix signature in
1508 * archive.cc (Archive::include_member): Unlock an external member
1509 of a thin archive. Don't bother to delete an object we know is
1512 2010-07-12 Cary Coutant <ccoutant@google.com>
1514 * compressed_output.cc (zlib_decompress): New function.
1515 (get_uncompressed_size): New function.
1516 (decompress_input_section): New function.
1517 * compressed_output.h (get_uncompressed_size): New function.
1518 (decompress_input_section): New function.
1519 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
1520 Handle compressed debug sections.
1521 * layout.cc (is_compressed_debug_section): New function.
1522 (Layout::output_section_name): Map compressed section names to
1524 * layout.h (is_compressed_debug_section): New function.
1525 (is_debug_info_section): Recognize compressed debug sections.
1526 * merge.cc: Include compressed_output.h.
1527 (Output_merge_data::do_add_input_section): Handle compressed
1529 (Output_merge_string::do_add_input_section): Handle compressed
1531 * object.cc: Include compressed_output.h.
1532 (Sized_relobj::Sized_relobj): Initialize new data members.
1533 (build_compressed_section_map): New function.
1534 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
1535 * object.h (Object::section_is_compressed): New method.
1536 (Object::do_section_is_compressed): New method.
1537 (Sized_relobj::Compressed_section_map): New type.
1538 (Sized_relobj::do_section_is_compressed): New method.
1539 (Sized_relobj::compressed_sections_): New data member.
1540 * output.cc (Output_section::add_input_section): Handle compressed
1542 * reloc.cc: Include compressed_output.h.
1543 (Sized_relobj::write_sections): Handle compressed debug sections.
1545 2010-07-08 Cary Coutant <ccoutant@google.com>
1547 * resolve.cc (Symbol_table::resolve): Remember whether undef was
1548 weak when resolving to a dynamic def.
1549 (Symbol_table::should_override): Add adjust_dyndef flag; set it
1550 for weak undef/dynamic def cases. Adjust callers.
1551 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
1552 undef_binding_weak_.
1553 (Symbol_table::sized_write_globals): Adjust symbol binding.
1554 (Symbol_table::sized_write_symbol): Add binding parameter.
1555 * symtab.h (Symbol::set_undef_binding): New method.
1556 (Symbol::is_undef_binding_weak): New method.
1557 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
1558 (Symbol_table::should_override): Add new parameter.
1559 (Symbol_table::sized_write_symbol): Add new parameter.
1561 * testsuite/weak_undef_file1.cc: Add new test case.
1562 * testsuite/weak_undef_file2.cc: Fix header comment.
1563 * testsuite/weak_undef_test.cc: Add new test case.
1565 2010-06-29 Doug Kwan <dougkwan@google.com>
1567 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
1568 Initialize USE_SYMBOL_.
1569 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
1571 (Arm_reloc_property::uses_symbol_): New data member declaration.
1572 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
1573 uses symbol value and symbol is undefined but not weakly undefined.
1575 2010-06-28 Rafael Espindola <espindola@google.com>
1577 * plugin.cc (Plugin::load): Use dlerror.
1579 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
1581 * symtab.cc (detect_odr_violations): When reporting an ODR
1582 violation, report an object where the symbol is defined.
1584 2010-06-25 Doug Kwan <dougkwan@google.com>
1586 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
1587 (Target_arm::section_may_have_icf_unsafe_pointers): New method
1589 (Target_arm::Scan::local_reloc_may_be_function_pointer,
1590 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
1591 target hook to detect function points.
1592 (Target_arm::Scan::possible_function_pointer_reloc): New method.
1593 * icf.h (Icf::check_section_for_function_pointers): Change type of
1594 parameter SECTION_NAME to const reference to std::string. Use
1595 target hook to determine if section may have unsafe pointers.
1596 * target.h (Target::section_may_have_icf_unsafe_pointers): New
1599 2010-06-21 Rafael Espindola <espindola@google.com>
1601 * fileread.cc (Input_file::find_fie): New
1602 (Input_file::open): Use Input_file::find_fie.
1603 * fileread.h (Input_file::find_fie): New
1604 * plugin.cc (set_extra_library_path): New.
1605 (Plugin::load): Add set_extra_library_path to the transfer vector.
1606 (Plugin_manager::set_extra_library_path): New.
1607 (Plugin_manager::add_input_file): Use the extra search path if set.
1608 (set_extra_library_path(): New.
1609 * plugin.h (Plugin_manager): Add set_extra_library_path and
1612 2010-06-19 Cary Coutant <ccoutant@google.com>
1614 * layout.cc (gdb_sections): Add .debug_types.
1615 (lines_only_debug_sections): Likewise.
1617 2010-06-18 Rafael Espindola <espindola@google.com>
1619 * plugin.cc (add_input_file,add_input_library)
1620 (Plugin_manager::add_input_file): Make filename arguments const.
1621 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
1624 2010-06-16 Doug Kwan <dougkwan@google.com>
1626 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
1627 .ARM.attributes section if we have not merged any input
1628 attributes sections.
1630 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1632 * arm.cc: Allow combining objects with no EABI version
1635 2010-06-15 Rafael Espindola <espindola@google.com>
1637 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
1639 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1641 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
1642 (struct iovec): Correct !HAVE_READV definition.
1644 2010-06-10 Cary Coutant <ccoutant@google.com>
1646 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
1647 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
1649 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
1652 * symtab.h (Symbol::is_placeholder): New member function.
1653 * target-reloc.h (relocate_section): Check for placeholder symbols.
1655 * testsuite/Makefile.am (plugin_test_8): New test.
1656 (plugin_test_9): New test.
1657 * testsuite/Makefile.in: Regenerate.
1659 2010-06-09 Nick Clifton <nickc@redhat.com>
1661 * yyscript.y (input_list_element): Allow strings prefixed with
1662 the '-' character. Treat these as libraries.
1663 * script.cc (script_add_library): New function. Adds a library
1664 specified by "-l<name>" found in an input script.
1665 * script-c.h: Add prototype for script_add_library.
1667 2010-06-07 Doug Kwan <dougkwan@google.com>
1669 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
1670 Restrict stub-group size to be within long conditional branch
1671 range when working around cortex-A8 erratum.
1673 2010-06-07 Damien Diederen <dd@crosstwine.com>
1675 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
1678 2010-06-03 Sriraman Tallam <tmsriram@google.com>
1682 (Output_section::Input_section_sort_entry::compare_section_ordering):
1683 Change to return non-zero correctly.
1684 (Output_section::Input_section_sort_section_order_index_compare
1685 ::operator()): Change to fix ambiguity in comparisons.
1687 2010-06-01 Sriraman Tallam <tmsriram@google.com>
1689 * gold.h (is_wildcard_string): New function.
1690 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
1691 (Layout::layout_eh_frame): Ditto.
1692 (Layout::find_section_order_index): New method.
1693 (Layout::read_layout_from_file): New method.
1694 * layout.h (Layout::find_section_order_index): New method.
1695 (Layout::read_layout_from_file): New method.
1696 (Layout::input_section_position_): New private member.
1697 (Layout::input_section_glob_): New private member.
1698 * main.cc (main): Call read_layout_from_file here.
1699 * options.h (--section-ordering-file): New option.
1700 * output.cc (Output_section::input_section_order_specified_): New
1702 (Output_section::Output_section): Initialize new member.
1703 (Output_section::add_input_section): Add new parameter.
1704 Keep input sections when --section-ordering-file is used.
1705 (Output_section::set_final_data_size): Sort input sections when
1706 section ordering file is specified.
1707 (Output_section::Input_section_sort_entry): Add new parameter.
1709 (Output_section::Input_section_sort_entry::compare_section_ordering):
1711 (Output_section::Input_section_sort_compare::operator()): Change to
1712 consider section_order_index.
1713 (Output_section::Input_section_sort_init_fini_compare::operator()):
1714 Change to consider section_order_index.
1715 (Output_section::Input_section_sort_section_order_index_compare
1716 ::operator()): New method.
1717 (Output_section::sort_attached_input_sections): Change to sort
1718 according to section order when specified.
1719 (Output_section::add_input_section<32, true>): Add new parameter.
1720 (Output_section::add_input_section<64, true>): Add new parameter.
1721 (Output_section::add_input_section<32, false>): Add new parameter.
1722 (Output_section::add_input_section<64, false>): Add new parameter.
1723 * output.h (Output_section::add_input_section): Add new parameter.
1724 (Output_section::input_section_order_specified): New
1726 (Output_section::set_input_section_order_specified): New method.
1727 (Input_section::Input_section): Initialize section_order_index_.
1728 (Input_section::section_order_index): New method.
1729 (Input_section::set_section_order_index): New method.
1730 (Input_section::section_order_index_): New member.
1731 (Input_section::Input_section_sort_section_order_index_compare): New
1733 (Output_section::input_section_order_specified_): New member.
1734 * script-sections.cc (is_wildcard_string): Delete and move modified
1736 (Output_section_element_input::Output_section_element_input): Modify
1737 call to is_wildcard_string.
1738 (Output_section_element_input::Input_section_pattern
1739 ::Input_section_pattern): Ditto.
1740 (Output_section_element_input::Output_section_element_input): Ditto.
1741 * testsuite/Makefile.am (final_layout): New test case.
1742 * testsuite/Makefile.in: Regenerate.
1743 * testsuite/final_layout.cc: New file.
1744 * testsuite/final_layout.sh: New file.
1746 2010-06-01 Rafael Espindola <espindola@google.com>
1748 * plugin.cc (Plugin::load): Pass the output name to the plugin.
1750 2010-06-01 Rafael Espindola <espindola@google.com>
1752 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
1753 visibility of symbols.
1755 2010-05-27 Doug Kwan <dougkwan@google.com>
1757 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
1758 from start of output section instead of address for a local symbol
1759 in a merged or relaxed section when doing a relocatable link.
1761 2010-05-26 Rafael Espindola <espindola@google.com>
1764 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
1765 adding sections the garbage collector removed.
1766 * gold/testsuite/Makefile.am: Add test.
1767 * gold/testsuite/Makefile.in: Regenerate.
1768 * gold/testsuite/plugin_test_7.sh: New.
1769 * gold/testsuite/plugin_test_7_1.c: New.
1770 * gold/testsuite/plugin_test_7_2.c: New.
1772 2010-05-26 Rafael Espindola <espindola@google.com>
1774 * script-sections.cc (Output_section_definition::set_section_addresses):
1775 Check for --section-start.
1777 2010-05-26 Doug Kwan <dougkwan@google.com>
1779 * arm.cc (Arm_scan_relocatable_relocs): New class.
1780 (Target_arm::relocate_special_relocatable): New method.
1781 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
1782 (Arm_relocate_functions::thumb_branch_common): Same.
1783 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
1784 instead of Default_scan_relocatable_relocs.
1785 * target-reloc.h (relocate_for_relocatable): Let target handle
1786 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
1787 * target.h (Sized_target::relocate_special_relocatable): New method.
1789 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1791 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
1793 2010-05-23 Doug Kwan <dougkwan@google.com>
1795 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
1797 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
1798 with a direct branch, not a conditional branch, to a stub.
1799 * merge.cc (Output_merge_base::record_input_section): New method
1801 (Output_merge_data::do_add_input_section): Record input section if
1802 keeps-input-sections flag is set.
1803 (Output_merge_string::do_add_input_section): Ditto.
1804 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
1805 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
1807 (Output_merge_base::keeps_input_sections,
1808 Output_merge_base::set_keeps_input_sections,
1809 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
1811 (Output_merge_base::Input_sections): New type declaration.
1812 (Output_merge_base::input_sections_begin,
1813 Output_merge_base::input_sections_end,
1814 Output_merge_base::do_set_keeps_input_sections): New method definitions.
1815 (Output_merge_base::bool keeps_input_sections_,
1816 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
1817 Output_merge_base::input_sections_): New data members.
1818 (Output_merge_data::do_set_keeps_input_sections): New method
1820 (Output_merge_string::do_set_keeps_input_sections): Ditto.
1821 * output.cc (Output_section::Input_section::relobj): Move method
1822 defintion from class declaration to here and handle merge sections.
1823 (Output_section::Input_section::shndx): Ditto.
1824 (Output_section::Output_section): Remove initializations of removed
1825 data members and initialize new data member LOOKUP_MAPS_.
1826 (Output_section::add_input_section): Set keeps-input-sections flag
1827 for a newly created merge output section as appropriate. Adjust code
1828 to use Output_section_lookup_maps class.
1829 (Output_section::add_relaxed_input_section): Adjst code for lookup
1830 maps code refactoring.
1831 (Output_section::add_merge_input_section): Add a new parameter
1832 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
1833 class. If adding input section to a newly created merge output
1834 section fails, remove the new merge section.
1835 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
1836 Adjust code for use of the Output_section_lookup_maps class.
1837 (Output_section::find_merge_section): Ditto.
1838 (Output_section::build_lookup_maps): New method defintion.
1839 (Output_section::find_relaxed_input_section): Adjust code to use
1840 Output_section_lookup_maps class.
1841 (Output_section::get_input_sections): Export merge sections. Adjust
1842 code to use Output_section_lookup_maps class.
1843 (Output_section:::add_script_input_section): Adjust code to use
1844 Output_section_lookup_maps class. Update lookup maps for merge
1846 (Output_section::discard_states): Use Output_section_lookup_maps.
1847 (Output_section::restore_states): Same.
1848 * output.h (Merge_section_properties): Move class defintion out of
1850 (Output_section_lookup_maps): New class.
1851 (Output_section::Input_section::is_merge_section): New method
1853 (Output_section::Input_section::relobj): Move defintion out of class
1854 defintion. Declare method only.
1855 (Output_section::Input_section::shndx): Ditto.
1856 (Output_section::Input_section::output_merge_base): New method defintion.
1857 (Output_section::Input_section::u2_.pomb): New union field.
1858 (Output_section::Merge_section_by_properties_map,
1859 Output_section::Output_section_data_by_input_section_map,
1860 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
1862 (Output_section::add_merge_input_section): Add new parameter
1863 KEEPS_INPUT_SECTIONS.
1864 (Output_section::build_lookup_maps): New method declaration.
1865 (Output_section::merge_section_map_,
1866 Output_section::merge_section_by_properties_map_,
1867 Output_section::relaxed_input_section_map_,
1868 Output_section::is_relaxed_input_section_map_valid_): Remove data
1870 (Output_section::lookup_maps_): New data member.
1872 2010-05-21 Doug Kwan <dougkwan@google.com>
1875 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
1876 avoid a compilation error.
1878 2010-05-19 Rafael Espindola <espindola@google.com>
1880 * script-sections.cc (Output_section_definition::allocate_to_segment):
1881 Update the phdrs_list even when the output section is NULL.
1882 * testsuite/Makefile.am: Add test.
1883 * testsuite/Makefile.in: Regenerate.
1884 * testsuite/script_test_9.cc: New.
1885 * testsuite/script_test_9.sh: New.
1886 * testsuite/script_test_9.t: New.
1888 2010-05-19 Doug Kwan <dougkwan@google.com>
1890 * arm.cc (Arm_input_section::original_size): New method.
1891 (Arm_input_section::do_addralign): Add a cast.
1892 (Arm_input_section::do_output_offset): Remove static cast.
1893 (Arm_input_section::original_addralign,
1894 Arm_input_section::original_size_): Change type to uint32_t.
1895 (Arm_input_section::init): Add safe casts for section alignment
1897 (Arm_input_section::set_final_data_size): Do not set address and
1898 offset of stub table.
1899 (Arm_output_section::fix_exidx_coverage): Change use of of
1900 Output_section::Simple_input_section to that of
1901 Output_section::Input_section.
1902 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
1903 except for the first pass.
1904 * output.cc (Output_section::get_input_sections): Change type of
1905 input_sections to std::list<Input_section>.
1906 (Output_section::add_script_input_section): Rename from
1907 Output_section::add_simple_input_section. Change type of SIS
1908 parameter from Simple_input_section to Input_section.
1909 * output.h (Output_section::Simple_input_section): Remove class.
1910 (Output_section::Input_section): Change class visibility to public.
1911 (Output_section::Input_section::addralign): Use stored alignments
1912 for special input sections if set.
1913 (Output_section::Input_section::set_addralign): New method.
1914 (Output_section::get_input_sections): Change parameter type from
1915 list of Simple_input_section to list of Input_section.
1916 (Output_section::add_script_input_section): Rename from
1917 Output_section::add_simple_input_section. Change first parameter's
1918 type from Simple_input_section to Input_section and remove the
1919 second and third parameters.
1920 * script-sections.cc (Input_section::Input_section_list): Change
1921 type to list of Output_section::Input_section/
1922 (Input_section_info::Input_section_info): Change parameter type of
1923 INPUT_SECTION to Output_section::Input_section.
1924 (Input_section_info::input_section): Change return type.
1925 (Input_section_info::input_section_): Change type to
1926 Output_section::Input_section.
1927 (Output_section_element_input::set_section_addresses): Adjust code
1928 to use Output_section::Input_section instead of
1929 Output_section::Simple_input_section. Adjust code for renaming
1930 of Output_section::add_simple_input_section.
1931 (Orphan_output_section::set_section_addresses): Ditto.
1933 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1935 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
1936 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
1938 2010-05-18 Rafael Espindola <espindola@google.com>
1940 * options.cc (General_options::finalize): Handle -nostdlib.
1941 * options.h (nostdlib): New option.
1942 * script.cc (script_add_search_dir): Handle -nostdlib.
1944 2010-05-12 Doug Kwan <dougkwan@google.com>
1946 * arm.cc (Target_arm::do_finalize_sections): Create an empty
1947 attributes section only if there no attributes section after merging.
1948 (Target_arm::merge_object_attributes): Move value of
1949 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
1950 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
1951 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
1952 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
1953 and arm_attr_merge_7.stdout.
1954 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
1955 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
1956 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
1957 arm_attr_merge_7b.o): New rules.
1958 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
1960 * testsuite/Makefile.in: Regenerate.
1961 * testsuite/arm_attr_merge.sh: New file.
1962 * testsuite/arm_attr_merge_[67][ab].s: Same.
1964 2010-05-05 Nick Clifton <nickc@redhat.com>
1966 * po/es.po: Updated Spanish translation.
1968 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
1970 * Makefile.am (install-exec-local): Properly install gold as
1971 default cross linker.
1972 * Makefile.in: Regenerated.
1974 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
1975 Nick Clifton <nickc@redhat.com>
1977 * configure.ac (install_as_default): Define and set to false
1978 unless --enable-gold or --enable-gold=both/gold has been
1980 * configure: Regenerate.
1982 * Makefile.am (install-exec-local): Install the executable as
1983 'ld.gold'. If install_as_default is true then also install it as
1985 * Makefile.in: Regenerated.
1987 2010-04-24 Ian Lance Taylor <iant@google.com>
1989 * layout.cc (Layout::layout_reloc): In relocatable link don't
1990 combine reloc sections for grouped sections.
1992 2010-04-23 Sriraman Tallam <tmsriram@google.com>
1994 * gc.h (gc_process_relocs): Pass information on relocs pointing to
1995 sections that are not ordinary to icf.
1996 * icf.cc (get_section_contents): Handle relocation pointing to section
1997 with no object or shndx information.
1998 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
1999 * testsuite/Makefile.in: Regenerate.
2000 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
2001 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
2003 2010-04-22 Ian Lance Taylor <iant@google.com>
2005 * expression.cc (Expression::Expression_eval_info): Add
2006 result_alignment_pointer field.
2007 (Expression::eval_with_dot): Add result_alignment_pointer
2008 parameter. Change all callers.
2009 (Expression::eval_maybe_dot): Likewise.
2010 (class Binary_expression): Add alignment_pointer parameter to
2011 left_value and right_value. Change all callers.
2012 (BINARY_EXPRESSION): Set result alignment.
2013 (class Trinary_expression): Add alignment_pointer parameter to
2014 arg2_value and arg3_value. Change all callers.
2015 (Trinary_cond::value): Set result alignment.
2016 (Max_expression::value, Min_expression::value): Likewise.
2017 (Align_expression::value): Likewise.
2018 * script-sections.cc (class Sections_element): Add dot_alignment
2019 parameter to set_section_addresses virtual function. Update
2021 (class Output_section_element): Likewise.
2022 (Script_sections::create_segments): Add dot_alignment parameter.
2024 (Script_sections::create_segments_from_phdrs_clause): Likewise.
2025 (Script_sections::set_phdrs_clause_addresses): Likewise.
2026 * script-sections.h: Update declarations.
2027 * script.h: Update declarations.
2028 * output.h (Output_segment::set_minimum_p_align): Don't decrease
2030 * testsuite/script_test_3.t: Set large alignment.
2031 * testsuite/script_test_3.sh: Make sure that at least one LOAD
2032 segment has expected alignment.
2034 2010-04-22 Nick Clifton <nickc@redhat.com>
2036 * po/gold.pot: Updated by the Translation project.
2037 * po/vi.po: Updated Vietnamese translation.
2039 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
2041 * testsuite/Makefile.am (check_PROGRAMS): Add
2042 icf_virtual_function_folding_test.
2043 * testsuite/Makefile.in: Regenerated.
2045 2010-04-15 Andrew Haley <aph@redhat.com>
2047 * options.h (merge_exidx_entries): New option.
2048 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
2049 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
2050 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
2051 (Target_arm::merge_exidx_entries): New function.
2052 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
2053 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
2054 to Arm_exidx_fixup constructor.
2055 Add new arg, merge_exidx_entries.
2056 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
2057 Arm_output_section::fix_exidx_coverage.
2059 2010-04-18 Sriraman Tallam <tmsriram@google.com>
2061 * icf.cc (get_section_contents): Check for preemptible functions.
2062 Ignore addend when appropriate.
2063 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
2065 (add_from_relobj): Check for section folded.
2066 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
2067 * symtab.h (should_add_dynsym_entry): Add new parameter.
2068 * target-reloc.h (scan_relocs): Check for section folded.
2069 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
2070 Check reloc types for function pointers in shared objects.
2071 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
2073 (icf_preemptible_functions_test): New test case.
2074 (icf_string_merge_test): New test case.
2075 * testsuite.Makefile.in: Regenerate.
2076 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
2077 bar_glob. Refactor code.
2078 * testsuite/icf_preemptible_functions_test.cc: New file.
2079 * testsuite/icf_preemptible_functions_test.sh: New file.
2080 * testsuite/icf_string_merge_test.cc: New file.
2081 * testsuite/icf_string_merge_test.sh: New file.
2082 * testsuite/icf_virtual_function_folding_test.cc: New file.
2083 * testsuite/icf_virtual_function_folding_test.sh: New file.
2085 2010-04-14 Doug Kwan <dougkwan@google.com>
2087 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
2088 for local symbol recounting if we remove a section due to ICF.
2089 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
2090 there are no regular objects in input.
2092 2010-04-13 Doug Kwan <dougkwan@google.com>
2094 * arm.cc (Arm_input_section::set_final_data_size): Compute
2095 accurate final data size instead of using current data size.
2097 2010-04-09 Doug Kwan <dougkwan@google.com>
2099 * layout.cc (Layout::choose_output_section): Handle script section
2101 (Layout::make_output_section_for_script): Add section type parameter.
2102 Handle script section types.
2103 * layout.h (Layout::make_output_section_for_script): Add section
2105 * output.cc (Output_section::Output_section): Initialize data member
2107 (Output_section::do_reset_address_and_file_offset): Do not set address
2108 to 0 if section is a NOLOAD section.
2109 * output.h (Output_section::is_noload): New method.
2110 (Output_section::set_is_noload): Ditto.
2111 (Output_section::is_noload_): New data member.
2112 * script-c.h (Script_section_type): New enum type.
2113 (struct Parser_output_section_header): Add new file section_type.
2114 * script-sections.cc (Sections_element::output_section_name): Add
2115 parameter for returning script section type.
2116 (Output_section_definition::output_section_name): Ditto.
2117 (Output_section_definition::section_type)P; New method.
2118 (Output_section_definiton::script_section_type_name): Ditto.
2119 (Output_section_definition::script_section_type_): New data member.
2120 (Output_section_definition::Output_section_definition): Initialize
2121 data member Output_section_definition::script_section_type_.
2122 (Output_section_definition::create_sections): Pass script section type
2123 to Layout::make_output_section_for_script.
2124 (Output_section_definition::output_section_name): Return script
2125 section type to caller.
2126 (Output_section_definition::set_section_address): Do not advance
2127 dot value and load address if section type is NOLOAD. Set address
2128 of NOLOAD sections regardless of section flags.
2129 (Output_section_definition::print): Print section type if it is
2130 not SCRIPT_SECTION_TYPE_NONE.
2131 (Output_section_definition::section_type): New method.
2132 (Output_section_definition::script_section_type_name): Ditto.
2133 (Script_sections::output_section_name): Add new parameter
2134 PSECTION_TYPE for returning script section type. Pass it to
2135 section elements. Handle discard sections.
2136 (Sort_output_sections::operator()): Handle NOLOAD sections.
2137 * script-sections.h (Script_sections::Section_type): New enum type.
2138 (Script_sections::output_section_name): Add a new parameter for
2139 returning script section type.
2140 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
2142 * yyscript.y (union): Add new field SECTION_TYPE.
2143 (COPY, DSECT, INFO, NOLOAD): New tokens.
2144 (opt_address_and_section_type): Change type to output_section_header.
2145 (section_type): New non-terminal
2146 (section_header): Handle section type.
2147 (opt_address_and_section_type): Return section type value.
2149 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
2151 * testsuite/plugin_common_test_1.c (foo): Add prototype.
2152 * testsuite/plugin_common_test_2.c (foo): Likewise.
2154 2010-04-08 Doug Kwan <dougkwan@google.com>
2156 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
2158 * output.cc (Output_section::add_merge_input_section): Simplify
2159 code and return status of Output_merge_base::add_input_section.
2160 Update merge section map only if Output_merge_base::add_input_section
2163 2010-04-07 Doug Kwan <dougkwan@google.com>
2165 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
2166 if section is marked as containing instructions but has no mapping
2168 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
2169 correct section index.
2170 (Arm_relobj::find_linked_text_section): Ditto.
2172 2010-04-07 Cary Coutant <ccoutant@google.com>
2174 * archive.cc (include_member): Destroy Read_symbols_data object before
2176 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
2177 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
2178 (Read_symbols_data::~Read_symbols_data) New destructor.
2179 (Section_relocs::Section_relocs) New constructor.
2180 (Section_relocs::~Section_relocs) New destructor.
2181 (Read_relocs_data::Read_relocs_data) New constructor.
2182 (Read_relocs_data::~Read_relocs_data) New destructor.
2183 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
2184 pointers to NULL after deleting.
2186 2010-04-07 Doug Kwan <dougkwan@google.com>
2188 * arm.cc: Replace "endianity" with "endianness" in comments.
2189 (Arm_exidx_cantunwind): Ditto.
2190 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
2191 (Arm_relobj::merge_flags_and_attributes): New method.
2192 (Arm_relobj::merge_flags_and_attributes_): New data member.
2193 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
2194 (Arm_relobj::scan_sections_for_stubs): Ditto.
2195 (Arm_relobj::do_read_symbols): Check to see if we really want to
2196 merge processor-specific flags and attributes. Exit early if
2197 an object is empty except for section names and the undefined symbol.
2198 (Target_arm::do_finalize_sections): Move check for ELF format to
2199 Arm_relobj::do_read_symbols. Merge processor specific flags and
2200 attributes from a regular object only when we have determined that
2201 it is aapropriate. Do not create an .ARM.attributes section in
2202 output if there is no regular input object.
2203 (Target_arm::merge_processor_specific_flags): Check
2204 --warn-mismatch before printing any error.
2205 (Target_arm::merge_object_attributes): Ditto.
2206 * gold.cc (queue_middle_tasks): Handle the case in which there is
2207 no regular object in input.
2208 * options.cc (General_options::parse_EB): New method.
2209 (General_options::parse_EL): Same.
2210 (General_options::General_options): Initialize endianness_.
2211 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
2213 (General_options::Endianness): New enum.
2214 (General_options::endianness): New method.
2215 (General_options::endianness_): New data member.
2216 * parameters.cc (Parameters::set_options): Check target endianness.
2217 (Parameters::set_target_once): Ditto.
2218 (Parameters::check_target_endianness): New method.
2219 (parameters_force_valid_target): If either -EL or -EB is specified,
2220 use it to define endianness of default target.
2221 * parameters.h (Parameters::check_target_endianness): New method
2223 * target.h (class Target): Change "endianity" to "endianness"
2226 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2228 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
2229 * configure: Regenerate.
2230 * Makefile.in: Regenerate.
2231 * testsuite/Makefile.in: Regenerate.
2233 2010-04-06 Cary Coutant <ccoutant@google.com>
2236 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
2237 prevailing definitions of common symbols.
2238 * testsuite/plugin_test_6.sh: New test case.
2239 * testsuite/plugin_common_test_1.c: New test case.
2240 * testsuite/plugin_common_test_2.c: New test case.
2241 * testsuite/Makefile.am (plugin_test_6): New test case.
2242 * testsuite/Makefile.in: Regenerate.
2244 2010-04-06 Nick Clifton <nickc@redhat.com>
2246 * po/vi.po: New Vietnamese translation.
2248 2010-03-30 Doug Kwan <dougkwan@google.com>
2250 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
2252 2010-03-25 Doug Kwan <dougkwan@google.com>
2254 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
2255 to avoid a conversion warning on a 32-bit host.
2257 2010-03-24 Ian Lance Taylor <iant@google.com>
2259 * testsuite/script_test_3.t: Add a TLS segment.
2260 * testsuite/Makefile.am (check_PROGRAMS): Add
2261 tls_phdrs_script_test.
2262 (tls_phdrs_script_test_SOURCES): Define.
2263 (tls_phdrs_script_test_DEPENDENCIES): Define.
2264 (tls_phdrs_script_test_LDFLAGS): Define.
2265 (tls_phdrs_script_test_LDADD): Define.
2266 * testsuite/Makefile.in: Rebuild.
2268 2010-03-23 Cary Coutant <ccoutant@google.com>
2270 * fileread.cc (find_or_make_view): Fix comment.
2272 2010-03-23 Ian Lance Taylor <iant@google.com>
2274 * script-sections.cc (class Orphan_section_placement): Define
2275 PLACE_TLS and PLACE_TLS_BSS.
2276 (Orphan_section_placement::Orphan_section_placement): Initialize
2278 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
2279 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
2280 (tls_script_test_SOURCES): Define.
2281 (tls_script_test_DEPENDENCIES): Define.
2282 (tls_script_test_LDFLAGS): Define.
2283 (tls_script_test_LDADD): Define.
2284 * testsuite/Makefile.in: Rebuild.
2286 2010-03-22 Doug Kwan <dougkwan@google.com>
2288 * arm.cc (Arm_relocate_functions::abs8,
2289 Arm_relocate_functions::abs16): Use correct check for overflow
2290 specified in the ARM ELF specs.
2291 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
2292 target of a BLX instruction specially.
2293 (Reloc_stub::stub_type_for_reloc): Ditto.
2294 (Relocate::relocate): Use symbolic names instead of numeric relocation
2295 codes to report error.
2296 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
2298 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
2299 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
2300 thumb2_blx_out_of_range.stdout
2301 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
2302 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
2303 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
2304 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
2305 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
2306 thumb2_blx_in_range, thumb2_blx_in_range.o,
2307 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
2308 thumb2_blx_out_of_range.o): New rules.
2309 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
2310 thumb2_blx_in_range and thumb2_blx_out_of_range.
2311 * testsuite/Makefile.in: Regenerate.
2312 * arm_branch_in_range.sh: Add tests for THUMB BLX.
2313 * testsuite/thumb_blx_in_range.s: New file.
2314 * testsuite/thumb_blx_out_of_range.s: New file.
2316 2010-03-22 Rafael Espindola <espindola@google.com>
2318 * archive.cc (Should_include): Move to archive.h.
2319 (should_include_member): Make it a member of Archive.
2321 (Add_lib_group_symbols): New.
2322 * archive.h: Include options.h.
2323 (Archive_member): Moved from Archive.
2324 (Should_include): Moved from archive.cc.
2326 (Add_lib_group_symbols): New.
2327 * dynobj.cc (do_should_include_member): New.
2328 * dynobj.h (do_should_include_member): New.
2329 * gold.cc (queue_initial_tasks): Update call to queue.
2330 * main.cc (main): Print lib group stats.
2331 * object.cc (do_should_include_member): New.
2332 * object.h: Include archive.h.
2333 (Object::should_include_member): New.
2334 (Object::do_should_include_member): New.
2335 (Sized_relobj::do_should_include_member): New.
2336 * options.cc (General_options::parse_start_lib): New.
2337 (General_options::parse_end_lib): New.
2338 (Input_arguments::add_file): Handle lib groups.
2339 (Input_arguments::start_group): Check we are not in a lib.
2340 (Input_arguments::start_lib): New.
2341 (Input_arguments::end_lib): New.
2342 * options.h (General_options): Add start_lib and end_lib.
2343 (Input_argument::lib_): New.
2344 (Input_argument::lib): New.
2345 (Input_argument::is_lib): New.
2346 (Input_file_lib): New.
2347 (Input_arguments::in_lib_): New.
2348 (Input_arguments::in_lib): New.
2349 (Input_arguments::start_lib): New.
2350 (Input_arguments::end_lib_): New.
2351 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
2352 in unused members as preempted.
2353 (Sized_pluginobj::do_should_include_member): New.
2354 * plugin.h (Sized_pluginobj::do_should_include_member): New.
2355 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
2357 (Read_symbols::do_whole_lib_group): New.
2358 (Read_symbols::do_lib_group): New.
2359 (Read_symbols::do_read_symbols): Handle lib groups.
2360 (Read_symbols::get_name): Handle lib groups.
2361 * readsyms.h (Read_symbols): Add an archive member pointer.
2362 (Read_symbols::do_whole_lib_group): New.
2363 (Read_symbols::do_lib_group): New.
2364 (Read_symbols::member_): New.
2365 * script.cc (read_input_script): Update call to queue_soon.
2367 2010-03-19 Doug Kwan <dougkwan@google.com>
2369 * arm.cc (Stub_table::Stub_table): Initialize new data members
2370 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
2371 (Stub_table::add_reloc_stub): Assign stub offset and update
2372 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
2373 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
2375 (Stub_table::update_data_size_and_addralign): Use
2376 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
2377 instead of going over all reloc stubs.
2378 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
2379 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
2380 Stringpool_template::offset_ to size of Stringpool_char.
2381 (Stringpool_template::new_key_offset): Remove code to initialize
2382 Stringpool_template::offset_.
2383 * stringpool.h (Stringpool_template::set_no_zero_null): Set
2384 Stringpool_template::offset_ to zero.
2386 2010-03-15 Doug Kwan <dougkwan@google.com>
2388 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
2390 (Stringpool_template::new_key_offset): New method.
2391 (Stringpool_template::add_string): Assign offsets when adding new
2393 (Stringpool_template::set_string_offsets): Do not set string offsets
2394 when not optimizing.
2395 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
2397 (Chunked_vector::clear): Clear size_.
2398 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
2399 (Chunked_vector::size): Return size_.
2400 (Chunked_vector::push_back): Use size_ to find insert position.
2401 (Chunked_vector::size_): New data member.
2402 (Stringpool_template::set_no_zero_null): Assert string set is empty.
2403 (Stringpool_template::new_key_offset): New method declaration.
2404 (Stringpool_template::offset_): New data member.
2406 2010-03-15 Rafael Espindola <espindola@google.com>
2408 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
2409 Add_symbols' constructor.
2410 * readsyms.h (Add_symbols): Remove the input_group member.
2412 2010-03-10 Ian Lance Taylor <iant@google.com>
2414 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
2415 target to ask whether a reference to a symbol requires a stack
2417 * target.h (Target::is_call_to_non_split): New function.
2418 (Target::do_is_call_to_non_split): Declare virtual function.
2419 * target.cc: Include "symtab.h".
2420 (Target::do_is_call_to_non_split): New function.
2421 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
2423 2010-03-10 Cary Coutant <ccoutant@google.com>
2425 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
2426 (File_read::open[1]): Remove initial mapping of whole_file_view_.
2427 (File_read::open[2]): Add whole_file_view_ to list of views.
2428 (File_read::make_view): Remove test of whole_file_view_.
2429 (File_read::find_or_make_view): Create whole_file_view_ if
2431 (File_read::clear_views): Replace bool parameter with enum;
2432 adjust all callers. Don't delete views with permanent data;
2433 do delete cached views and views from archives if
2434 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
2435 if clearing the corresponding view.
2436 * fileread.h (File_read::Clear_views_mode): New enum.
2437 (File_read::View::is_permanent_view): New method.
2438 (File_read::clear_views): Replace bool parameter
2439 with enum; adjust all callers.
2440 * options.h (General_options): Change keep_files_mapped option;
2441 add map_whole_files.
2442 * readsyms.cc (Add_symbols::run): Delete sd_ object before
2444 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
2447 2010-03-10 David S. Miller <davem@davemloft.net>
2449 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
2451 2010-03-09 Sriraman Tallam <tmsriram@google.com>
2453 * icf.cc (get_section_contents): Add '@' marker after processing the
2456 2010-03-08 Doug Kwan <dougkwan@google.com>
2458 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
2459 due to a conversion warning.
2460 (Arm_relobj::update_output_local_symbol_count): Check for local
2461 symbol with unset output index.
2463 2010-03-05 Ian Lance Taylor <iant@google.com>
2465 * options.h (class General_options): Add --spare-dynamic-tags.
2466 * output.cc (Output_data_dynamic::set_final_data_size): Implement
2467 --spare-dynamic-tags.
2469 2010-03-05 Ian Lance Taylor <iant@google.com>
2471 * incremental.cc: Include "libiberty.h".
2473 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
2475 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
2476 function, is_info_ member.
2477 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
2478 (Versions::Versions): Update caller.
2479 (Versions::define_base_version): Likewise.
2480 (Versions::add_def): Likewise.
2482 2010-03-03 Sriraman Tallam <tmsriram@google.com>
2484 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
2485 (Scan::possible_function_pointer_reloc): New function.
2486 (Scan::local_reloc_may_be_function_pointer): Change to call
2487 possible_function_pointer_reloc.
2488 (Scan::global_reloc_may_be_function_pointer): Ditto.
2489 * icf.h (Icf::check_section_for_function_pointers): Change to reject
2490 relocations in ".data.rel.ro._ZTV" section.
2491 * testsuite/icf_safe_so_test.sh: Change to pass i386.
2492 * testsuite/icf_safe_so_test.cc: Ditto.
2493 * testsuite/icf_safe_test.cc: Ditto.
2494 * testsuite/icf_safe_test.sh: Ditto.
2496 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2497 Ian Lance Taylor <iant@google.com>
2499 * target-reloc.h (relocate_section): Check the symbol table index
2500 for -1U before setting the local symbol index.
2501 (scan_relocatable_relocs): If copying the relocation, record that
2502 the local symbol is required.
2503 * object.h (Symbol_value::is_output_symtab_index_set): New
2505 (Symbol_value::may_be_discarded_from_output_symtab): New
2507 (Symbol_value::has_output_symtab_entry): New function.
2508 (Symbol_value::needs_output_symtab_entry): Remove.
2509 (Symbol_value::output_symtab_index): Make sure the symbol index is
2511 (Symbol_value::set_output_symtab_index): Make sure the symbol
2512 index is not set. Make sure the new index is valid.
2513 (Symbol_value::set_must_have_output_symtab_entry): New function.
2514 (Symbol_value::has_output_dynsym_entry): New function.
2515 (Symbol_value::set_output_dynsym_index): Make sure the new index
2517 (Sized_relobj::set_must_have_output_symtab_entry): New function.
2518 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
2519 local symbol if permitted.
2520 (Sized_relobj::do_finalize_local_symbols): Call
2521 is_output_symtab_index_set rather than needs_output_symtab_entry.
2522 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
2523 rather than needs_output_symtab_entry. Call
2524 has_output_dynsym_entry rather than needs_output_dynsym_entry.
2525 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
2526 is_output_symtab_index_set rather than needs_output_symtab_entry.
2527 * testsuite/discard_locals_relocatable_test.c: New file.
2528 * testsuite/discard_locals_test.sh: Test -r.
2529 * testsuite/Makefile.am (check_DATA): Add
2530 discard_locals_relocatable_test1.syms,
2531 discard_local_relocatable_test2.syms.
2532 (MOSTLYCLEANFILES): Likewise. Also add
2533 discard_locals_relocatable_test1.lout and
2534 discard_locals_relocatable_test2.out.
2535 (discard_locals_relocatable_test1.syms): New target.
2536 (discard_locals_relocatable_test.o): New target.
2537 (discard_locals_relocatable_test1.out): New target.
2538 (discard_locals_relocatable_test2.syms): New target.
2539 (discard_locals_relocatable_test2.out): New target.
2540 (various): Add missing ../ld-new dependencies.
2541 * testsuite/Makefile.in: Rebuild.
2543 2010-03-03 Nick Clifton <nickc@redhat.com>
2545 * po/fi.po: New Finnish translation.
2547 2010-03-01 Doug Kwan <dougkwan@google.com>
2549 * layout.cc (Layout::Layout): Force section types of .init_array*,
2550 .preinit_array* and .fini_array* sections.
2551 * output.cc (Output_section::Input_section_sort_entry::has_priority):
2552 Fix check of return value of std::string::find.().
2553 (Output_section::Input_section_sort_compare::operator()): Remove
2554 comment about .init_array.
2555 (Output_section::Input_section_sort_init_fini_compare::operator()):
2557 (Output_section::sort_attached_input_sections): Handle .init_array
2558 and .fini_array specially.
2559 * output.h (Output_section::Inut_section_sort_compare): Update
2561 (Output_section::Input_section_sort_init_fini_compare): New struct.
2563 2010-02-26 Doug Kwan <dougkwan@google.com>
2565 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
2566 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
2567 * testsuite/debug_msg.sh: Avoid matching source line number for
2568 use of global variable undef_int.
2570 2010-02-26 Doug Kwan <dougkwan@google.com>
2572 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
2573 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
2574 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
2575 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
2576 * options.cc (General_options::General_options): Initialize member
2578 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
2579 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
2580 and rm_no_fix_v4bx.stdout
2581 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
2582 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
2583 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
2584 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
2585 and arm_no_fix_v4bx.
2586 * Makefile.in: Regenerate.
2587 * testsuite/arm_fix_v4bx.s: New file.
2588 * testsuite/arm_fix_v4bx.sh: Ditto.
2590 2010-02-24 Doug Kwan <dougkwan@google.com>
2592 * arm.cc (Target_arm::got_section): Make the .got section the first
2593 non RELRO section in the data segment.
2594 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
2595 suffixes of section names.
2597 2010-02-24 Doug Kwan <dougkwan@google.com>
2599 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
2600 flags and attributes merging if an input file is a binary file.
2601 * fileread.cc (Input_file::open): Record format of original file.
2602 * fileread.h (Input_file::Format): New enum type.
2603 (Input_file::Input_file): Initialize data member format_.
2604 (Input_file::format): New method definition.
2605 (Input_file::format_):: New data member.
2607 2010-02-24 Doug Kwan <dougkwan@google.com>
2609 * arm.cc (Arm_output_data_got): New class.
2610 (ARM_TCB_SIZE): New constant
2611 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
2612 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
2613 If user uses a script with a SECTIONS clause, issue only a warning
2614 for a misplaced EXIDX input section. Otherwise, issue an error.
2615 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
2617 (Target_arm::got_mode_index_entry): Handle static linking.
2618 (Target_arm::Scan::local): Ditto.
2619 (Target_arm::Scan::global): Ditto.
2620 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
2621 all incorrectly implemented relocations.
2622 (Target_arm::fix_exidx_coverage): Pass layout to
2623 Arm_output_section::fix_exidx_coverage.
2624 * layout.cc (Layout::section_name_mapping): Remove trailing dots
2625 from ".ARM.exidx." and ".ARM.extab.".
2627 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2629 * arm.cc (Target_arm::do_finalize_sections): Create attribute
2630 section if it does not already exist.
2631 * attributes.cc (Attributes_section_data::Attributes_section_data):
2632 Don't crash if size is zero.
2634 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2635 Ian Lance Taylor <iant@google.com>
2637 * gold.cc (queue_middle_tasks): If no input files were opened,
2639 * workqueue.h (Task_function::Task_function): Assert that there is
2642 2010-02-22 Doug Kwan <dougkwan@google.com>
2644 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
2645 * icf.cc (get_section_contents): Cast snprintf arguments to long long
2646 types to avoid warnings due to different uint64_t implementations
2649 2010-02-21 Doug Kwan <dougkwan@google.com>
2651 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
2652 handling of the maximum backward branch offset.
2653 (Arm_relocate_functions::thumb_branch_common): Ditto.
2654 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
2655 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
2656 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
2657 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
2658 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
2659 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
2660 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
2661 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
2662 thumb_bl_out_of_range thumb_bl_out_of_range.o,
2663 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
2664 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
2665 thumb2_bl_out_of_range.o): New rules.
2666 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
2667 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
2668 thumb2_bl_out_of_range
2669 * testsuite/Makefile.in: Regenerate.
2670 * testsuite/arm_bl_in_range.s: New file.
2671 * testsuite/arm_bl_out_of_range.s: Ditto.
2672 * testsuite/arm_branch_in_range.sh: Ditto.
2673 * testsuite/arm_branch_range.t: Ditto.
2674 * testsuite/thumb2_branch_range.t: Ditto.
2675 * testsuite/thumb_bl_in_range.s: Ditto.
2676 * testsuite/thumb_bl_out_of_range.s: Ditto.
2677 * testsuite/thumb_branch_range.t: Ditto.
2679 2010-02-20 Sriraman Tallam <tmsriram@google.com>
2681 * gc.h (gc_process_relocs): Change vectors to point to the new list.
2682 Add reloc offset information.
2683 * icf.cc (get_section_contents): Change iterators to point to the new
2684 vectors. Add reloc offset information to the contents.
2685 * icf.h (Icf::Sections_reachable_info): New typedef.
2686 (Icf::Sections_reachable_list): New typedef.
2687 (Icf::Offset_info): New typedef.
2688 (Icf::Reloc_info): New struct typedef.
2689 (Icf::Reloc_info_list): New typedef.
2690 (Icf::symbol_reloc_list): Delete method.
2691 (Icf::addend_reloc_list): Delete method.
2692 (Icf::section_reloc_list): Delete method.
2693 (Icf::reloc_info_list): New method.
2694 (Icf::reloc_info_list_): New member.
2696 2010-02-19 Doug Kwan <dougkwan@google.com>
2698 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
2699 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
2700 * arm.cc (Arm_relocation_functions): New forward declaration.
2701 (Target_arm::Target_arm): Initialize new data members
2702 got_mod_index_offset_ and tls_base_symbol_defined_.
2703 (Target_arm::Relocate::relocate_tls): New method.
2704 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
2705 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
2707 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
2708 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
2709 (Target_arm::got_mod_index_offset_,
2710 Target_arm::tls_base_symbol_defined_): New data members.
2711 (Target_arm::Scan::local, Target::Scan::global,
2712 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
2715 2010-02-18 Doug Kwan <dougkwan@google.com>
2717 * arm.cc (Arm_relobj::find_linked_text_section): New method.
2718 (Arm_relobj::make_exidx_input_section): Pass section index of linked
2719 text section as a parameter becuase some broken tools may not set
2720 the link in section header.
2721 (Target_arm::has_got_section): New method.
2722 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
2723 without any mapping symbol as data only. Remove warning.
2724 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
2725 link in its section header, try to discover the link by inspecting the
2726 REL31 relocation at the beginning of the section.
2727 (Target_arm::Scan::check_non_pic): Report name of offending relocation
2729 (Target_arm::Scan::global): Treat any reference to the symbol
2730 _GLOBAL_OFFSET_TABLE_ as a GOT access.
2732 2010-02-12 Sriraman Tallam <tmsriram@google.com>
2734 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
2735 (Scan::global_reloc_may_be_function_pointer): New function.
2736 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
2737 (Scan::global_reloc_may_be_function_pointer): New function.
2738 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
2739 (Scan::global_reloc_may_be_function_pointer): New function.
2740 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
2741 (Scan::global_reloc_may_be_function_pointer): New function.
2742 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
2743 (Scan::global_reloc_may_be_function_pointer): New function.
2744 (Scan::possible_function_pointer_reloc): New function.
2745 (Target_x86_64::can_check_for_function_pointers): New function.
2746 * gc.h (gc_process_relocs): Scan relocation types to determine if
2747 function pointers were taken for targets that support it.
2748 * icf.cc (Icf::find_identical_sections): Include functions for
2749 folding in safe ICF whose pointer is not taken.
2750 * icf.h (Secn_fptr_taken_set): New typedef.
2751 (fptr_section_id_): New member.
2752 (section_has_function_pointers): New function.
2753 (set_section_has_function_pointers): New function.
2754 (check_section_for_function_pointers): New function.
2755 * options.h: Fix comment for safe ICF option.
2756 * target.h (can_check_for_function_pointers): New function.
2757 * testsuite/Makefile.am: Add icf_safe_so_test test case.
2758 Modify icf_safe_test for X86-64.
2759 * testsuite/Makefile.in: Regenerate.
2760 * testsuite/icf_safe_so_test.cc: New file.
2761 * testsuite/icf_safe_so_test.sh: New file.
2762 * testsuite/icf_safe_test.cc (kept_func_3): New function.
2763 (main): Change to take pointer to function kept_func_3.
2764 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
2765 folding is done correctly for X86-64.
2767 2010-02-12 David S. Miller <davem@davemloft.net>
2769 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
2770 is_symbolless parameter.
2771 (Output_reloc<SHT_REL>::is_symbolless): New.
2772 (Output_reloc<SHT_REL>::is_symbolless_): New.
2773 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
2774 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
2775 (Output_reloc<SHT_RELA>::is_symbolless): New.
2776 (Output_data_reloc::add_global): Handle is_symbolless.
2777 (Output_data_reloc::add_global_relative): Likewise.
2778 (Output_data_reloc::add_local): Likewise.
2779 (Output_data_reloc::add_local_relative): Likewise.
2780 (Output_data_reloc::add_symbolless_global_addend): New.
2781 (Output_data_reloc::add_symbolless_local_addend): New.
2782 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
2784 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
2785 instead of ->is_relative_
2786 (Output_reloc::write): Likewise.
2787 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
2788 (Output_reloc::write_rel): Simplify.
2790 * sparc.cc (Target_sparc::Scan::local): Use
2791 ->add_symbolless_local_addend as needed.
2792 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
2793 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
2794 based upon relocation offset.
2796 2010-02-11 Doug Kwan <dougkwan@google.com>
2798 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
2799 (Target_arm::Scan::global): Ditto. Also remove a comment before the
2800 beginning of function.
2801 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
2802 and MOVT_ABS relocations. Those are non issued in scanning. Fix
2803 parameter is_32bit in calls to should_apply_static_reloc.
2804 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
2805 (check_DATA): Add arm_abs_global.stdout.
2806 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
2807 arm_abs_global.stdout): New rules.
2808 (MOSTLLYCLEANFILES): Add arm_abs_global
2809 * Makefile.in: Regenerate.
2810 * testsuite/arm_abs_global.s: New file.
2811 * testsuite/arm_abs_global.sh: Ditto.
2812 * testsuite/arm_abs_lib.s: Ditto.
2814 2010-02-11 Ian Lance Taylor <iant@google.com>
2816 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
2818 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
2819 Allocate_commons_task first.
2820 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
2821 task, rather than symtab_lock_.
2822 (Gc_process_relocs::~Gc_process_relocs): New function.
2823 (Gc_process_relocs::is_runnable): Check this_blocker_.
2824 (Gc_process_relocs::locks): Use next_blocker_ rather than
2826 (Scan_relocs::~Scan_relocs): New function.
2827 (Scan_relocs::is_runnable): Check this_blocker_ rather than
2829 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
2831 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
2832 fields. Add this_blocker_ and next_blocker_ fields. Adjust
2833 constructor accordingly.
2834 (class Gc_process_relocs): Likewise.
2835 (class Scan_relocs): Likewise.
2836 * common.h (class Allocate_commons_task): Remove symtab_lock_
2837 field, and corresponding constructor parameter.
2838 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
2840 (Allocate_commons_task::locks): Likewise.
2842 2010-02-11 Ian Lance Taylor <iant@google.com>
2844 * gold-threads.h (class Once): Define.
2845 (class Initialize_lock): Rewrite as child of Once.
2846 * gold-threads.cc (class Once_initialize): Define.
2847 (once_pointer_control): New static variable.
2848 (once_pointer, once_arg): New static variables.
2849 (c_run_once): New static function.
2850 (Once::Once, Once::run_once, Once::internal_run): New functions.
2851 (class Initialize_lock_once): Remove.
2852 (initialize_lock_control): Remove.
2853 (initialize_lock_pointer): Remove.
2854 (initialize_lock_once): Remove.
2855 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
2856 (Initialize_lock::initialize): Rewrite.
2857 (Initialize_lock::do_run_once): New function.
2858 * archive.cc (Archive::interpret_header): Only clear name if it is
2860 * fileread.cc: Include "gold-threads.h"
2861 (file_counts_lock): New static variable.
2862 (file_counts_initialize_lock): Likewise.
2863 (File_read::release): Only increment counts when using --stats.
2864 Use a lock around the increment.
2865 * parameters.cc (class Set_parameters_target_once): Define.
2866 (set_parameters_target_once): New static variable.
2867 (Parameters::Parameters): Move here from parameters.h.
2868 (Parameters::set_target): Rewrite.
2869 (Parameters::set_target_once): New function.
2870 (Parameters::clear_target): Move here and rewrite.
2871 * parameters.h (class Parameters): Update declarations. Add
2872 set_parameters_target_once_ field.
2873 (Parameters::Parameters): Move to parameters.cc.
2874 (Parameters::clear_target): Likewise.
2875 * readsyms.cc (Read_symbols::do_group): Create a Start_group
2877 (Start_group::~Start_group): New function.
2878 (Start_group::is_runnable): New function.
2879 (Start_group::locks, Start_group::run): New functions.
2880 (Finish_group::run): Change saw_undefined to size_t.
2881 * readsyms.h (class Start_group): Define.
2882 (class Finish_group): Change saw_undefined_ field to size_t.
2883 (Finish_group::Finish_group): Remove saw_undefined and
2884 this_blocker parameters. Change all callers.
2885 (Finish_group::set_saw_undefined): New function.
2886 (Finish_group::set_blocker): New function.
2887 * symtab.h (class Symbol_table): Change saw_undefined to return
2888 size_t. Change saw_undefined_ field to size_t.
2889 * target-select.cc (Set_target_once::do_run_once): New function.
2890 (Target_selector::Target_selector): Initialize set_target_once_
2891 field. Don't initialize lock_ and initialize_lock_ fields.
2892 (Target_selector::instantiate_target): Rewrite.
2893 (Target_selector::set_target): New function.
2894 * target-select.h (class Set_target_once): Define.
2895 (class Target_selector): Update declarations. Make
2896 Set_target_once a friend. Remove lock_ and initialize_lock_
2897 fields. Add set_target_once_ field.
2899 2010-02-10 Ian Lance Taylor <iant@google.com>
2901 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
2903 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
2904 (queue_middle_tasks): Add all blockers before queueing any tasks.
2905 (queue_final_tasks): Likewise.
2906 * token.h (Task_token::add_blockers): New function.
2907 * object.h (Input_objects::number_of_relobjs): New function.
2909 2010-02-10 Ian Lance Taylor <iant@google.com>
2911 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
2912 shared, not if not position independent.
2913 * x86_64.cc (Relocate::relocate_tls): Likewise.
2914 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
2915 (tls_pie_pic_test): New target.
2916 * testsuite/Makefile.in: Rebuild.
2918 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
2919 (tls_test_main_pie.o, tls_test_pie.o): New targets.
2920 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
2921 * testsuite/Makefile.in: Rebuild.
2923 2010-02-09 David S. Miller <davem@davemloft.net>
2925 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
2926 R_SPARC_RELATIVE using ->add_local_relative().
2927 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
2929 * output.h (Output_data_dynamic::add_section_size): New method
2930 that takes two Output_data objects.
2931 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
2932 entry param. Handle it in initializers.
2933 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
2934 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
2935 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
2937 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
2938 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
2939 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
2940 for dynrel_includes_plt.
2941 * i386.cc (Target_i386::do_finalize_sections): Likewise.
2942 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2943 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
2945 (Target_sparc::do_finalize_sections): Update to pass true for
2946 dynrel_includes_plt.
2947 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
2948 output before .rela.plt
2949 (Target_powerpc::do_finalize_sections): Update to pass true for
2950 dynrel_includes_plt when 32-bit.
2952 2010-02-08 Doug Kwan <dougkwan@google.com>
2954 * arm.cc (Arm_relobj::simple_input_section_output_address): New
2956 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
2957 Arm_relobj::scan_section_for_cortex_a8_stubs,
2958 Arm_relobj::do_relocation_section): Instead of calling
2959 Output_section::output_address, use faster
2960 Arm_relobj::simple_input_section_output_address.
2962 2010-02-08 David S. Miller <davem@davemloft.net>
2964 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
2965 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
2966 relocation helper function.
2968 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
2969 just like R_SPARC_GOT{10,13,22}.
2970 (Target_sparc::Scan::local): Likewise.
2971 (Target_sparc::Relocate:relocate): Likewise.
2973 2010-02-06 Ian Lance Taylor <iant@google.com>
2975 * configure.ac: Rewrite targetobjs duplicate removal code to use
2976 only shell constructs.
2977 * configure: Rebuild.
2979 2010-02-05 Doug Kwan <dougkwan@google.com>
2982 * arm.cc (Arm_relobj::section_is_scannable): New method.
2983 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
2984 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
2986 2010-02-04 Doug Kwan <dougkwan@google.com>
2989 * arm-reloc-property.cc (cstdio): Include.
2990 * configure.ac (targetobjs): Remove duplicates.
2991 * configure: Regenerate.
2992 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
2993 big and little endian version for a given address size.
2995 2010-02-03 Doug Kwan <dougkwan@google.com>
2997 * arm-reloc-property.cc
2998 (Arm_reloc_property_table::reloc_name_in_error_message): New method
3000 * arm-reloc-property.h
3001 (Arm_reloc_property_table::get_implemented_static_reloc_property):
3002 New method definition.
3003 (Arm_reloc_property_table::reloc_name_in_error_message): New method
3005 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
3007 (GOT_PREL): Change implemented to Y.
3008 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
3009 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
3010 (Arm_relocate_functions::movw_abs_nc): Remove method.
3011 (Arm_relocate_functions::movt_abs): Ditto.
3012 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
3013 (Arm_relocate_functions::thm_movt_abs): Ditto.
3014 (Arm_relocate_functions::movw_rel_nc): Ditto.
3015 (Arm_relocate_functions::movw_rel): Ditto.
3016 (Arm_relocate_functions::movt_rel): Ditto.
3017 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
3018 (Arm_relocate_functions:thm_movw_rel): Ditto.
3019 (Arm_relocate_functions:thm_movt_rel): Ditto.
3020 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
3021 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
3022 New method definitions.
3023 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
3024 (Arm_relocation_functions::arm_grp_ldr): Ditto.
3025 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
3026 (Arm_relocation_functions::arm_grp_ldc): Ditto.
3027 (Target_arm::Relocate::relocate): Check for non-static or
3028 unimplemented relocation code and exit early. Change calls to
3029 Target_arm::reloc_uses_thumb_bit and
3030 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
3031 instead. Refactor code to handle similar relocations to increase
3032 code sharing. Remove check for unsupported relocation code in switch
3034 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
3035 relocation property table to find out size. Change error message to
3036 print out the name of a relocation code instead of the numeric value.
3037 (Target_arm::scan_reloc_for_stub): Use relocation property table
3038 instead of calling Target_arm::reloc_uses_thumb_bit().
3040 2010-02-02 Doug Kwan <dougkwan@google.com>
3042 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
3043 types of relaxed input section.
3045 2010-02-02 Doug Kwan <dougkwan@google.com>
3047 * Makefile.am (HFILES): Add arm-reloc-property.h.
3049 (TARGETSOURCES): Add arm-reloc-property.cc
3050 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
3051 (libgold_a_SOURCES): $(DEFFILES)
3052 * Makefile.in: Regenerate.
3053 * arm-reloc-property.cc: New file.
3054 * arm-reloc-property.h: New file.
3055 * arm-reloc.def: New file.
3056 * arm.cc: Update comments.
3057 (arm-reloc-property.h): New included header.
3058 (arm_reloc_property_table): New global variable.
3059 (Target_arm::do_select_as_default_target): New method definition.
3060 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
3061 arm-reloc-property to targ_extra_obj.
3062 * parameters.cc (set_parameters_target): Call
3063 Target::select_as_default_target().
3064 * target.h (Target::select_as_default_target): New method definition.
3065 (Target::do_select_as_default_target): Same.
3067 2010-02-01 Doug Kwan <dougkwan@google.com>
3069 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
3070 first_output_text_section_.
3071 (Arm_exidx_fixup::first_output_text_section): New method definition.
3072 (Arm_exidx_fixup::first_output_text_section_): New data member.
3073 (Arm_exidx_fixup::process_exidx_section): Record the first text
3074 output section seen.
3075 (Arm_output_section::fix_exidx_coverage): Set correct linked section
3076 and entsize in output section header.
3078 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3080 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
3081 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
3082 (Arm_relocate_functions::thm_alu11): New Method.
3083 (Arm_relocate_functions::thm_pc8): New Method.
3084 (Arm_relocate_functions::thm_pc12): New Method.
3085 (Target_arm::Scan::local): Handle the relocations.
3086 (Target_arm::Scan::global): Likewise.
3087 (Target_arm::Relocate::relocate): Likewise.
3088 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
3090 2010-01-29 Doug Kwan <dougkwan@google.com>
3092 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
3093 of relocation types as ld.
3095 2010-01-29 Doug Kwan <dougkwan@google.com>
3097 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
3099 (Arm_relocate_functions::thumb_branch_common): Ditto.
3100 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
3101 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
3102 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
3103 Arm_relocate_functions::jump24): Remove.
3104 (Target_arm::Relocate::relocate): Adjust code to call
3105 Arm_relocation_functions::arm_branch_common and
3106 Arm_relocation_functions::thumb_branch_common instead of their removed
3107 wrappers. Merge switch-cases together to reduce source code size.
3109 2010-01-29 Doug Kwan <dougkwan@google.com>
3111 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
3112 output_local_symbol_count_needs_update_.
3113 (Arm_relobj::output_local_symbol_count_needs_update,
3114 Arm_relobj::set_output_local_symbol_count_needs_update,
3115 Arm_relobj::update_output_local_symbol_count): New methods.
3116 (Arm_relobj::output_local_symbol_count_needs_update_): New data
3118 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
3119 of pointed function as in a R_ARM_PREL31 relocation.
3120 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
3121 for output local symbol count updating.
3122 (Target_arm::do_relax): Update output local symbol counts in objects
3124 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
3126 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3128 * arm.cc: Added support for the ARM relocations:
3129 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
3130 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
3131 (Arm_relocate_functions::movw_rel_nc): Renamed (was
3133 (Arm_relocate_functions::movw_rel): New method.
3134 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
3135 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
3137 (Arm_relocate_functions::thm_movw_rel): New method.
3138 (Arm_relocate_functions::thm_movt_rel): Renamed (was
3140 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
3142 (Target_arm::Scan::global): Likewise.
3143 (Target_arm::Relocate::relocate): Likewise.
3144 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
3147 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3149 * arm.cc: Added support for ARM group relocations.
3150 (Target_arm::reloc_needs_sym_origin): New method.
3151 (Arm_relocate_functions::calc_grp_kn): New method.
3152 (Arm_relocate_functions::calc_grp_residual): New method.
3153 (Arm_relocate_functions::calc_grp_gn): New method.
3154 (Arm_relocate_functions::arm_grp_alu): New Method.
3155 (Arm_relocate_functions::arm_grp_ldr): New Method.
3156 (Arm_relocate_functions::arm_grp_ldrs): New Method.
3157 (Arm_relocate_functions::arm_grp_ldc): New Method.
3158 (Target_arm::Scan::local): Handle the ARM group relocations.
3159 (Target_arm::Scan::global): Likewise.
3160 (Target_arm::Relocate::relocate): Likewise.
3161 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
3164 2010-01-26 Doug Kwan <dougkwan@google.com>
3166 * arm.cc (set): Include.
3167 (class Arm_exidx_fixup): Change type of last_input_section_ to const
3169 (Arm_output_section::Text_section_list): New type.
3170 (Arm_output_section::append_text_sections_to_list): New method.
3171 (Arm_output_section::fix_exidx_coverage): Ditto.
3172 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
3173 (Arm_relobj::convert_input_section_to_relaxed_section): Use
3174 Relobj::set_section_offset() instead of
3175 Sized_relobj::invalidate_section_offset().
3176 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
3177 parameter for section headers. Ignore relocation sections for
3178 unallocated sections and EXIDX sections.
3179 (Target_arm::fix_exidx_coverage): New method.
3180 (Target_arm::output_section_address_less_than): New type.
3181 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
3182 linked text section instead of the EXIDX section.
3183 (Arm_output_section::create_stub_group): Add an assertion to check
3184 that this is not an EXIDX output section.
3185 (Arm_output_section::append_text_sections_to_list): New method.
3186 (Arm_output_section::fix_exidx_coverage): Ditto.
3187 (Arm_relobj::scan_sections_for_stubs): Adjust call to
3188 Arm_relobj::section_needs_reloc_stub_scanning.
3189 (Target_arm::do_relax): Fix EXIDX output section coverage in the
3191 (Target_arm::fix_exidx_coverage): New method.
3192 * object.h (Relobj::set_output_section): New method.
3193 (Sized_relobj::invalidate_section_offset): Remove method.
3194 (Sized_relobj::do_invalidate_section_offset): Remove method.
3195 (Sized_relobj::do_set_section_offset): Handle offset value -1.
3197 2010-01-25 Doug Kwan <dougkwan@google.com>
3199 * arm.cc (Arm_exidx_merged_section::do_output_offset):
3200 Fix warning due to signed and unsigned comparison on a 32-bit host.
3202 2010-01-22 Doug Kwan <dougkwan@google.com>
3204 * arm.cc (Target_arm::do_relax): Record an output section for section
3205 offset adjustment it contains any stub table that has changed.
3206 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
3207 offsets in an output section if necessary.
3208 * output.cc (Output_section::Output_section): Initialize
3209 section_offsets_need_adjustments_.
3210 (Output_section::add_input_section_for_script): Renamed to
3211 Output_section::add_simple_input_section.
3212 (Output_section::save_states): Add a comment.
3213 (Output_section::discard_states): New method defintion.
3214 (Output_section::adjust_section_offsets): Same.
3215 * output.h (Output_section::add_input_section_for_script): Renamed to
3216 Output_section::add_simple_input_section.
3217 (Output_section::discard_states): New method declaration.
3218 (Output_section::adjust_section_offsets): Same.
3219 (Output_section::section_offsets_need_adjustment,
3220 Output_section::set_section_offsets_need_adjustment): New method
3222 (Output_section::section_offsets_need_adjustment_): New data member.
3223 * script-sections.cc
3224 (Output_section_element_input::set_section_address): Adjust code for
3225 renaming of Output_section::add_input_section_for_script.
3226 (Orphan_output_section::set_section_address): Same.
3228 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3230 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
3231 Fix_v4bx enum values .
3232 * gold/options.h (General_options): New option definitions.
3233 (General_options::fix_v4bx): New method.
3234 (General_options::Fix_v4bx): New enum.
3235 * gold/options.cc (General_options::parse_fix_v4bx): New method.
3236 (General_options::parse_fix_v4bx_interworking): New method.
3238 2010-01-22 Doug Kwan <dougkwan@google.com>
3240 * arm.cc (Arm_exidx_fixup): New class.
3242 2010-01-21 Doug Kwan <dougkwan@google.com>
3244 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
3246 (Arm_exidx_section_offset_map): New type.
3248 2010-01-21 Doug Kwan <dougkwan@google.com>
3250 * arm.cc (Arm_exidx_input_section): New class.
3251 (Arm_relobj::exidx_input_section_by_link,
3252 Arm_relobj::exidx_input_section_by_shndx,
3253 Arm_relobj::make_exidx_input_section): New methods.
3254 (read_arm_attributes_section): Remove.
3255 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
3256 information about them.
3257 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
3260 2010-01-20 Doug Kwan <dougkwan@google.com>
3262 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
3263 Input_section_specifier to Section_id.
3264 (Target_arm::new_arm_input_section: Adjust code for change of key
3266 (Target_arm::find_arm_input_section): Ditto.
3267 * gc.h (object.h): Include for Section_id nand Section_id_hash.
3268 (Section_id): Remove.
3269 (Garbage_collection::Section_id_hash): Remove.
3270 * icf.h (object.h): Include for Section_id nand Section_id_hash.
3271 (Section_id): Remove.
3272 (Icf::Section_id_hash): Remove.
3273 * object.h (Section_id, Const_section_id, Section_id_hash,
3274 Const_section_id_hash): New type definitions.
3275 * output.cc (Output_section::add_relaxed_input_section): Change to
3276 use Const_section_id instead of Input_section_specifier as key type.
3277 (Output_section::add_merge_input_section): Ditto.
3278 (Output_section::build_relaxation_map): Change to use Section_id
3279 instead of Input_section_specifier as key type.
3280 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3282 (Output_section::convert_input_sections_to_relaxed_sections): Change
3283 to use Const_section_id instead of Input_section_specifier as key type.
3284 (Output_section::find_merge_section): Ditto.
3285 (Output_section::find_relaxed_input_section): Ditto.
3286 * output.h (Input_section_specifier): Remove class.
3287 (Output_section::Output_section_data_by_input_section_map): Change
3288 key type to Const_section_id.
3289 (Output_section::Output_relaxed_input_section_by_input_section_map):
3291 (Output_section::Relaxation_map): Change key type to Section_id.
3293 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3295 * gold/arm.cc: Added support for R_ARM_V4BX relocation
3296 (class Arm_v4bx_stub): New class.
3297 (DEF_STUBS): Updated definition to support v4_veneer_bx.
3298 (Stub_factory::make_arm_v4bx_stub): New method.
3299 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
3300 (Stub_table::empty): Handle v4bx stubs.
3301 (Stub_table::add_arm_v4bx_stub): New method.
3302 (Stub_table::find_arm_v4bx_stub): New method.
3303 (Arm_relocate_functions::v4bx): New method.
3304 (Target_arm::fix_v4bx): New method.
3305 (Target_arm::Target_arm): Handle R_ARM_V4BX.
3306 (Stub_table::relocate_stubs): Likewise.
3307 (Stub_table::do_write): Likewise.
3308 (Stub_table::update_data_size_and_addralign): Likewise.
3309 (Stub_table::finalize_stubs): Likewise.
3310 (Target_arm::Scan::local): Likewise.
3311 (Target_arm::Scan::global): Likewise.
3312 (Target_arm::do_finalize_sections): Likewise.
3313 (Target_arm::Relocate::relocate): Likewise.
3314 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
3316 (Target_arm::scan_reloc_for_stub): Likewise.
3317 (Target_arm::scan_reloc_section_for_stubs): Likewise.
3319 2010-01-19 Ian Lance Taylor <iant@google.com>
3321 * output.cc (Output_section_headers::do_sized_write): Write large
3322 segment count to sh_info field.
3323 (Output_file_header::do_sized_write): For large segment count,
3324 write PN_XNUM to e_phnum field.
3326 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3328 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
3329 (Arm_relocate_functions::thm_jump8): New function.
3330 (Arm_relocate_functions::thm_jump11): New function.
3331 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
3333 (Target_arm::Scan::global): Likewise.
3334 (Target_arm::Relocate::relocate): Likewise.
3335 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
3338 2010-01-14 Doug Kwan <dougkwan@google.com>
3340 * arm.cc (map, utility): Include headers.
3341 (Target_arm::apply_cortex_a8_workaround): New method.
3342 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
3343 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
3344 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
3345 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
3346 the --[no-]fix-cortex-a8 command line options.
3347 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
3348 (Target_arm::relocate_stub): Use addend in instruction template.
3349 * options.h (DEFINE_bool): Set the user-set flag.
3350 (General_options): Add --[no-]-fix-cortex options.
3351 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
3352 : Update fast look-up map after conversion.
3354 2010-01-14 Sriraman Tallam <tmsriram@google.com>
3356 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
3357 in the first pass of do_layout.
3359 2010-01-13 Doug Kwan <dougkwan@google.com>
3361 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
3362 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
3363 apparent compiler problem of not folding static constant integral
3364 data members of elfcpp::Elf_sizes<32>.
3366 2010-01-13 Doug Kwan <dougkwan@google.com>
3368 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
3369 Arm_relobj::section_needs_cortex_a8_stub_scanning,
3370 Arm_relobj::scan_section_for_cortex_a8_erratum,
3371 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
3372 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
3373 sections to scan for relocation stubs into a new method
3374 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
3375 relocation and Cortex-A8 stub scanning.
3376 (Target_arm::do_relax): Force stubs to be after stubbed sections
3377 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
3378 the beginning of a new relaxation pass. Update a comment.
3379 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
3381 2010-01-12 Ian Lance Taylor <iant@google.com>
3383 * target-reloc.h (visibility_error): New inline function.
3384 (relocate_section): Call visibility_error.
3385 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
3386 (MOSTLYCLEANFILES): Likewise.
3387 (protected_4_pic.o, protected_3.err): New targets.
3388 * testsuite/protected_4.cc: New file.
3390 2010-01-12 Doug Kwan <dougkwan@google.com>
3392 * arm.cc (Cortex_a8_reloc): New class.
3393 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
3394 and cortex_a8_relocs_info_.
3395 (Target_arm::fix_cortex_a8): New method definition.
3396 (Target_arm::Cortex_a8_relocs_info): New type.
3397 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
3398 New data member declarations.
3399 (Target_arm::scan_reloc_for_stub): Record information about
3400 relocations for THUMB branches that might be exempted from the
3401 Cortex-A8 workaround.
3402 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
3403 at the beginning of a relaxation pass.
3405 2010-01-12 Doug Kwan <dougkwan@google.com>
3407 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
3408 (Arm_relobj::Mapping_symbol_position,
3409 Arm_reloj::Mapping_symbol_position_less,
3410 Arm_relobj::Mapping_symbols_info): New types.
3411 (Target_arm::is_mapping_symbol_name): New method definition.
3412 (Arm_relobj::do_count_local_symbols): Save information about mapping
3415 2010-01-11 Doug Kwan <dougkwan@google.com>
3417 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
3418 Arm_relocate_functions::thumb32_branch_upper,
3419 Arm_relocate_functions::thumb32_branch_lower,
3420 Arm_relocate_functions::thumb32_cond_branch_offset,
3421 Arm_relocate_functions::thumb32_cond_branch_upper,
3422 Arm_relocate_functions::thumb32_cond_branch_lower,
3423 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
3424 branch offset encoding.
3425 (Arm_relocate_functions::thumb_branch_common): Use new branch
3426 offset encoding methods to avoid code duplication.
3427 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
3428 (Stub_addend_reader::operator()): Use new branch encoding method
3429 to avoid code duplication.
3431 2010-01-11 Doug Kwan <dougkwan@google.com>
3433 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
3434 (Target_arm::do_finalize_sections): Define special EXIDX section
3435 symbols only if referenced.
3436 * gc.h (Garbage_collection::add_reference): New method.
3437 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
3440 2010-01-11 Ian Lance Taylor <iant@google.com>
3442 * script.cc (Version_script_info::build_expression_list_lookup):
3443 Change complaing about duplicate wildcard match from error to
3446 * script.cc (class Lazy_demangler): Recreate--revert part of patch
3448 (Version_script_info::Version_script_info): Initialize globs_,
3449 default_version_, default_is_global_, and exact_. Don't
3450 initialize globals_ or locals_.
3451 (Version_script_info::build_lookup_tables): Build local symbols
3453 (Version_script_info::unquote): New function.
3454 (Version_script_info::add_exact_match): New function.
3455 (Version_script_info::build_expression_list_lookup): Remove lookup
3456 parameter. Add is_global parameter. Change all callers. Handle
3457 wildcard pattern specially. Unquote pattern. Call
3459 (Version_script_info::get_name_to_match): New function.
3460 (Version_script_info::get_symbol_version): New function.
3461 (Version_script_info::get_symbol_version_helper): Remove.
3462 (Version_script_info::check_unmatched_names): Call unquote.
3463 * script.h (class Version_script_info): Change get_symbol_version
3464 to be non-inline and add is_global parameter; change all callers.
3465 Rewrite symbol_is_local. Update declarations. Define struct
3466 Version_tree_match, Exact, Globs. Don't define struct Lookup.
3467 Remove globals_ and locals_ members. Add exact_, globs_,
3468 default_version_, is_global_.
3469 (Version_script_info::Glob): Remove pattern, add expression and
3470 is_global. Update constructor. Change all callers.
3471 * dynobj.cc (Versions::finalize): Mark the version symbol as the
3473 (Versions::symbol_section_contents): If a symbol is undefined, or
3474 defined in a dynamic object, set the version index to
3476 * symtab.cc (Symbol_table::add_from_relobj): Don't call
3478 (Symbol_table::add_from_pluginobj): Likewise.
3479 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
3481 2010-01-11 Doug Kwan <dougkwan@google.com>
3483 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
3484 (incremental_dump_LDADD): Add linking option for libintl.
3485 * Makefile.in: Regenerate.
3487 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
3490 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
3492 * testsuite/Makefile.in: Regenerated.
3494 2010-01-10 Doug Kwan <dougkwan@google.com>
3496 * options.h (DEFINE_var): Use parentheses around argument varname__
3497 in macro body to avoid any unintended subsequent substitutions.
3499 2010-01-10 Ian Lance Taylor <iant@google.com>
3501 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
3502 candidates before doing symbol resolution.
3504 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
3505 ODR candidates if only one is weak.
3507 2010-01-08 Ian Lance Taylor <iant@google.com>
3509 * script.cc (Version_script_info::build_expression_list_lookup):
3510 Don't warn about ambiguous version, just record the ambiguity.
3511 (Version_script_info::get_symbol_version_helper): Give error if
3512 version is ambiguous.
3514 2010-01-08 Doug Kwan <dougkwan@google.com>
3516 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
3517 prev_data_size_ and prev_addralign_. Remove initializer for
3518 deleted data member has_been_changed_.
3519 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
3520 to determine if the table is empty.
3521 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
3523 (Stub_table::add_reloc_stub): Define method in class definition
3524 instead of just declaring it there.
3525 (Stub_table::add_cortex_a8_stub): New method definition.
3526 (Stub_table::update_data_size_and_addralign): Ditto.
3527 (Stub_table::finalize_stubs): Ditto.
3528 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
3529 (Stub_table::do_addralign_): Return address alignment in the
3530 (Stub_table::do_reset_address_and_file_offset): Define method in
3531 class definition instead of declaring it there. Set current data
3532 size to be the data size of the previous pass.
3533 (Stub_table::set_final_data_size): Use current data size as the
3535 (Stub_table::relocate_stub): Change parameter type of stub from
3536 Reloc_stub pointer to Stub pointer.
3537 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
3538 (Stub_table::Cortex_a8_stub_list): New typedef.
3539 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
3540 Stub_table::prev_addralign_): New data member.
3541 (Arm_relobj::Arm_relobj): Initialize data member
3542 section_has_cortex_a8_workaround_.
3543 (Arm_relobj::section_has_cortex_a8_workaround,
3544 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
3546 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
3548 (Target_arm::relocate_stub): Change parameter type of stub from
3549 Reloc_stub pointer to Stub pointer.
3550 (Insn_template::size, Insn_template::alignment): Handle
3551 THUMB16_SPECIAL_TYPE.
3552 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
3553 Stub_table::update_data_size_and_addralign,
3554 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
3556 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
3557 (Stub_table::do_write): Ditto.
3558 (Target_arm::do_relax): Adjust code for changes in Stub_table.
3560 2010-01-08 Ian Lance Taylor <iant@google.com>
3563 * symtab.h (class Symbol): Remove fields is_target_special_ and
3564 has_plt_offset_. Add field is_defined_in_discarded_section_.
3565 (Symbol::is_defined_in_discarded_section): New function.
3566 (Symbol::set_is_defined_in_discarded_section): New function.
3567 (Symbol::has_plt_offset): Rewrite.
3568 (Symbol::set_plt_offset): Verify that new offset is not -1U.
3569 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
3570 Don't initialize is_target_special_ or has_plt_offset_.
3571 Initialize is_defined_in_discarded_section_.
3572 (Symbol_table::add_from_relobj): If appropriate, set
3573 is_defined_in_discarded_section.
3574 * resolve.cc (Symbol::override_base_with_special): Don't test
3575 is_target_special_. Change has_plt_offset_ to has_plt_offset().
3576 * target-reloc.h (relocate_section): Do special handling for
3577 symbols defined in discarded sections for global symbols as well
3580 2010-01-08 Ian Lance Taylor <iant@google.com>
3582 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
3583 the SHT_SYMTAB case.
3585 2010-01-08 Ian Lance Taylor <iant@google.com>
3587 * object.cc (Sized_relobj::do_layout): Don't get confused if
3588 layout_eh_frame returns NULL.
3590 2010-01-08 Ian Lance Taylor <iant@google.com>
3593 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
3594 dynamic symbol table, use the normal symbol table.
3595 (Sized_dynobj::do_read_symbols): Remove assertion about type of
3598 2010-01-08 Ian Lance Taylor <iant@google.com>
3601 * layout.cc (Layout::include_section): Remove .gnu_debuglink
3604 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
3606 * version.cc (print_version): Change to "Copyright 2010".
3608 2010-01-08 Ian Lance Taylor <iant@google.com>
3612 * i386.cc (class Target_i386): Change return type of plt_section
3614 (class Output_data_plt_i386): Add tls_desc_rel_ field.
3615 (Output_data_plt_i386::Output_data_plt_i386): Initialize
3616 tls_desc_rel_ field.
3617 (Output_data_plt_i386::rel_tls_desc): New function.
3618 (Target_i386::rel_tls_desc_section): New function.
3619 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
3620 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
3621 R_386_TLS_DESC reloc in rel_tls_desc_section.
3622 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
3623 Define struct Tlsdesc_info.
3624 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
3625 (Target_x86_64::do_reloc_symbol_index): New function.
3626 (Target_x86_64::add_tlsdesc_info): New function.
3627 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
3628 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
3630 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
3632 (Output_data_plt_x86_64::rela_tlsdesc): New function.
3633 (Target_x86_64::rela_tlsdesc_section): New function.
3634 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
3636 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
3637 (Target_x86_64::do_reloc_addend): New function.
3638 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
3639 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
3640 declarations. Define TARGET_CODE. Add arg field to u1_ union.
3641 (Output_reloc::type): New function.
3642 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
3643 (Output_reloc::is_target_specific): New function.
3644 (Output_reloc::target_arg): New function.
3645 (class Output_reloc) [SHT_RELA]: Add four new constructors for
3646 absolute relocs and target specific relocs.
3647 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
3648 add_target_specific.
3649 (class Output_data_reloc) [SHT_RELA]: Likewise.
3650 * output.cc (Output_reloc::Output_reloc): Add four new versions
3651 for absolute relocs and target specific relocs.
3652 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
3653 (Output_reloc::get_symbol_index): Likewise.
3654 (Output_reloc::local_section_offset): Check that local_sym_index_
3655 is not TARGET_CODE or 0.
3656 (Output_reloc::symbol_value): Likewise.
3657 (Output_reloc::write) [SHT_RELA]: Call target for target specific
3659 * target.h (class Target): Add reloc_symbol_index and reloc_addend
3660 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
3662 * layout.cc (add_target_dynamic_tags): Use output section for
3663 DT_PLTRELSZ and DT_JMPREL.
3665 2010-01-07 Ian Lance Taylor <iant@google.com>
3668 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
3670 (class Output_data_reloc_generic): Define.
3671 (class Output_data_reloc_base): Change base class to
3672 Output_data_reloc_generic. Change add() method to call
3673 bump_relative_reloc_count for a relative reloc. Remove
3675 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
3677 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
3678 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
3680 * layout.h (class Layout): Update declaration.
3682 2010-01-07 Ian Lance Taylor <iant@google.com>
3684 * output.h (class Output_data): Add const version of
3685 output_section and do_output_section.
3686 (class Output_section_data): Add const version of
3688 (class Output_section): Likewise.
3689 * layout.cc (Layout::add_target_dynamic_tags): New function.
3690 * layout.h (class Layout): Update declarations.
3691 * arm.cc (Target_arm::do_finalize_sections): Use
3692 add_target_dynamic_tags.
3693 * i386.cc (Target_i386::do_finalize_sections): Likewise.
3694 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
3695 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
3696 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3698 2010-01-07 Ian Lance Taylor <iant@google.com>
3701 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
3704 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
3705 Ian Lance Taylor <iant@google.com>
3708 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
3709 Xindex::read_symtab_xindex.
3711 2010-01-07 Doug Kwan <dougkwan@google.com>
3713 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
3714 (Insn_template::thumb16_bcond_insn): New method declaration.
3715 (Insn_template): Fix spelling.
3716 (Stub::thumb16_special): New method declaration.
3717 (Stub::do_write): Define virtual method which was previously pure
3719 (Stub::do_thumb16_special): New method declaration.
3720 (Stub::do_fixed_endian_write): New template member.
3721 (Reloc_stub::do_write): Remove.
3722 (Reloc_stub::do_fixed_endian_write): Remove.
3723 (Cortex_a8_stub): New class definition.
3724 (Stub_factory::make_cortex_a8_stub): New method definition.
3725 (Stub_factory::Stub_factory): Add missing static storage class
3726 qualifier for elf32_arm_stub_a8_veneer_blx.
3728 2010-01-07 Ian Lance Taylor <iant@google.com>
3731 * options.h (class General_options): Add --warn-unresolved-symbols
3732 and --error-unresolved-symbols.
3733 * errors.cc (Errors::undefined_symbol): Implement
3734 --warn-unresolved-symbols.
3736 * options.h (class General_options): Add -z text and -z textoff.
3737 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
3739 2010-01-06 Sriraman Tallam <tmsriram@google.com>
3741 * gc.h (Garbage_collection::Cident_section_map): New typedef.
3742 (Garbage_collection::cident_sections): New function.
3743 (Garbage_collection::add_cident_section): New function.
3744 (Garbage_collection::cident_sections_): New member.
3745 (gc_process_relocs): Add references to sections whose names are C
3747 * gold.h (cident_section_start_prefix): New constant.
3748 (cident_section_stop_prefix): New constant.
3749 (is_cident): New function.
3750 * layout.cc (Layout::define_section_symbols): Replace string constants
3751 with the newly defined constants.
3752 * object.cc (Sized_relobj::do_layout): Track sections whose names are
3754 * testsuite/Makefile.am: Add gc_orphan_section_test.
3755 * testsuite/Makefile.in: Regenerate.
3756 * testsuite/gc_orphan_section_test.cc: New file.
3757 * testsuite/gc_orphan_section_test.sh: New file.
3759 2010-01-06 Ian Lance Taylor <iant@google.com>
3762 * options.h (class General_options): Add --warn-shared-textrel.
3763 * layout.cc (Layout::finish_dynamic_section): Implement
3764 --warn-shared-textrel.
3767 * options.h (class General_options): Add --warn-multiple-gp.
3769 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3771 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
3772 $(THREADSLIB) and $(LIBDL).
3773 * Makefile.in: Rebuild.
3775 2010-01-06 Ian Lance Taylor <iant@google.com>
3778 * options.cc (General_options::parse_section_start): New function.
3779 (General_options::section_start): New function.
3780 (General_options::General_options): Initialize all members.
3781 * options.h: Include <map>
3782 (class General_options): Add --section-start. Add section_starts_
3784 * layout.cc (Layout::attach_allocated_section_to_segment): If
3785 --section-start was used, set the address of the segment. Remove
3786 local sort_sections.
3787 (Layout::relaxation_loop_body): If the address of the load segment
3788 has been set by --section-start, don't use it.
3789 * output.h (Output_segment::update_flags_for_output_section): New
3791 * output.cc (Output_segment::add_output_section): Call
3792 update_flags_for_output_section.
3794 2010-01-05 Ian Lance Taylor <iant@google.com>
3797 * options.h (class General_options): Add --undefined-version.
3798 * script.cc (struct Version_expression): Add was_matched_by_symbol
3800 (Version_script_info::matched_symbol): New function.
3801 (Version_script_info::get_symbol_version_helper): Call
3803 (Version_script_info::check_unmatched_names): New function.
3804 * script.h (class Version_script_info): Update declarations.
3805 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
3807 * options.h (class General_options): Use DEFINE_bool_alias for
3808 allow_multiple_definition.
3809 * resolve.cc (Symbol_table::should_override): Don't test
3810 allow_multiple_definition.
3813 * options.h (class General_options): Add --cref.
3814 * main.cc (main): Print cref table if --cref. Don't close mapfile
3815 until after printing cref table.
3816 * cref.cc: Include "symtab.h".
3817 (class Cref_inputs): Define Cref_table_compare and Cref_table.
3818 (Cref_table_compare::operator()): New function.
3819 (Cref_inputs::gather_cref): New function.
3820 (filecol): New static const.
3821 (Cref_inputs::print_cref): New function.
3822 (Cref::print_cref): New function.
3823 * cref.h: Include <cstdio>.
3824 (class Cref): Update declarations.
3825 * mapfile.h (Mapfile::file): New function.
3826 * object.h (class Object): Define Symbols. Declare virtual
3827 do_get_global_symbols.
3828 (Object::get_global_symbols): New function.
3829 * object.cc (Input_objects::add_object): Pass object to cref_ if
3831 (Input_objects::archive_start): Likewise.
3832 (Input_objects::archive_stop): Likewise.
3833 (Input_objects::print_cref): New function.
3834 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
3835 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
3837 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
3839 * plugin.h (class Sized_pluginobj): Update declarations.
3841 2010-01-05 Ian Lance Taylor <iant@google.com>
3843 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
3844 to is_default_version. Rename insdef to insdefault.
3845 (Symbol_table::add_from_relobj): Rename def to is_default_version
3846 and local to is_forced_local.
3847 (Symbol_table::add_from_pluginobj): Likewise.
3848 (Symbol_table::add_from_dynobj): Likewise.
3849 (Symbol_table::define_special_symbol): Rename insdef to
3852 2010-01-04 Ian Lance Taylor <iant@google.com>
3855 * options.h (class General_options): Add
3856 --allow-multiple-definition and -z muldefs.
3857 * resolve.cc (Symbol_table::should_override): Don't warn about a
3858 multiple symbol definition if --allow-multiple-definition or -z
3862 * options.h (class General_options): Add --add-needed and
3863 --copy-dt-needed-entries. Tweak --as-needed help entry.
3864 * object.cc (Input_objects::check_dynamic_dependencies): Give an
3865 error if --copy-dt-needed-entries aka --add-needed is used and
3866 would cause a change in behaviour.
3869 * options.h (class General_options): Add -G as a short version of
3870 --shared. Add no-op options -assert, -g, and -i.
3872 2010-01-04 Sriraman Tallam <tmsriram@google.com>
3874 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
3875 check for .text or .gnu.linkonce.t sections.
3876 * icf.cc (Icf::find_identical_sections): Ditto.
3877 Change the detection for mangled function name within the section
3879 * icf.h (is_section_foldable_candidate): New function.
3881 2009-12-30 Ian Lance Taylor <iant@google.com>
3884 * options.h (class General_options): Permit two dashes with
3885 --retain-symbols-file.
3887 2009-12-30 Ian Lance Taylor <iant@google.com>
3890 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
3891 don't put the file header and segment headers in the text
3895 * common.cc (Sort_commons::operator()): Stabilize sort when both
3897 (Symbol_table::do_allocate_commons_list): When allocating common
3898 symbols, skip a symbol which is no longer common.
3899 * symtab.h (Symbol::is_common): Test whether the symbol comes from
3900 an object before checking its type.
3901 * testsuite/common_test_2.c: New file.
3902 * testsuite/common_test_3.c: New file.
3903 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
3904 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
3905 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
3906 (common_test_2_pic.o, common_test_2.so): New targets.
3907 (common_test_3_pic.o, common_test_3.so): New targets.
3908 * testsuite/Makefile.in: Rebuild.
3911 * script.cc (read_input_script): If we see a new SECTIONS clause,
3912 and we have added an input section, give an error.
3913 * layout.h (class Layout): Add have_added_input_section function.
3914 Add have_added_input_section_ field.
3915 * layout.cc (Layout::Layout): Initialize
3916 have_added_input_section_.
3917 (Layout::layout): Set have_added_input_section_.
3918 (Layout::layout_eh_frame): Likewise.
3920 2009-12-30 Ian Lance Taylor <iant@google.com>
3923 * options.h (class General_options): Add --sort-common option.
3924 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
3925 * common.cc (Sort_common): Add sort_order parameter to
3926 constructor. Add sort_order_ field.
3927 (Sort_commons::operator): Check sort_order_.
3928 (Symbol_table::allocate_commons): Determine the sort order.
3929 (Symbol_table::do_allocate_commons): Add sort_order parameter.
3931 (Symbol_table::do_allocate_commons_list): Likewise.
3933 2009-12-30 Ian Lance Taylor <iant@google.com>
3936 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
3937 symbols from this object, don't change the visibility of an
3939 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
3941 2009-12-30 Ian Lance Taylor <iant@google.com>
3944 * script.h (class Version_script_info): Define Language enum.
3945 Update declarations. Define Glob, Exact, and Lookup types. Add
3946 new fields globals_, locals_, and is_finalized_.
3947 * script.cc: Various formatting fixes.
3948 (class Parser_closure): Change language_stack_ from a vector of
3949 std::string to one of Version_script_info::Language. Adjust all
3951 (class Lazy_demangler): Remove.
3952 (struct Version_expression): Change language from std::string to
3953 Version_script_info::Language.
3954 (Version_script_info::Version_script_info): New function.
3955 (Version_script_info::~Version_script_info): Don't call clear.
3956 (Version_script_info::finalize): New function.
3957 (Version_script_info::build_lookup_tables): New function.
3958 (Version_script_info::build_expression_list_lookup): New
3960 (Version_script_info::get_symbol_version_helper): Rewrite to use
3962 (Version_script_info::print_expression_list): Adjust to use
3963 Version_script_info::Language.
3964 (script_push_lex_into_version_mode): Check that the version script
3965 has not been finalized.
3966 (version_script_push_lang): Change language string to
3967 Version_script_info::Language.
3968 * options.cc (Command_line::version_script): New function.
3969 * options.h (class General_options): Add finalize_dynamic_list
3970 function. Change version_script from declaration to definition.
3971 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
3972 * testsuite/version_script.map: Remove duplicate def of foo.
3973 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
3975 * testsuite/Makefile.in: Rebuild.
3977 2009-12-30 Ian Lance Taylor <iant@google.com>
3980 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
3981 if the input symbol index is 0, make the output symbol index 0.
3983 2009-12-30 Ian Lance Taylor <iant@google.com>
3986 * options.h (class General_options): Add -x/--discard-all.
3987 * object.cc (Sized_relobj::do_count_local_symbols): Handle
3988 --discard-all. If the local symbol needs a dynamic entry, check
3989 that before handling --discard-locals.
3991 2009-12-30 Ian Lance Taylor <iant@google.com>
3994 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
3996 (Output_segment::add_output_section): Don't change the flags if
4000 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
4001 GNU hash table if they need a dynamic value. Otherwise, don't add
4002 them if they are defined in a dynamic object or are forced local.
4004 2009-12-29 Ian Lance Taylor <iant@google.com>
4007 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
4008 .gnu.hash table for a 32-bit target.
4011 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
4012 regular and a dynamic object only needs a dynamic symbol table
4013 entry if it is externally visible.
4016 * i386.cc (class Target_i386): Initialize global_offset_table_ in
4017 constructor. Add global_offset_table_ field.
4018 (Target_i386::got_section): Set global_offset_table_.
4019 (Target_i386::do_finalize_sections): Set global_offset_table_
4021 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
4022 in constructor. Add global_offset_table_ field.
4023 (Target_x86_64::got_section): Set global_offset_table_.
4024 (Target_x86_64::do_finalize_sections): Set global_offset_table_
4027 * layout.cc (Layout::Layout): Initialize increase_relro_.
4028 (Layout::get_output_section): Add is_relro, is_last_relro, and
4029 is_first_non_relro parameters. Change all callers.
4030 (Layout::choose_output_section): Likewise.
4031 (Layout::add_output_section_data): Likewise.
4032 (Layout::make_output_section): Likewise.
4033 (Layout::set_segment_offsets): Clear increase_relro when using a
4035 * layout.h (class Layout): Add increase_relro method. Add
4036 increase_relro_ field. Update declarations.
4037 * output.cc (Output_section::Output_section): Initialize
4038 is_last_relro_ and is_first_non_relro_.
4039 (Output_segment::add_output_section): Group relro sections is
4040 do_sort is true. Handle is_last_relro and is_first_non_relro.
4041 (Output_segment::maximum_alignment): Remove relro handling.
4042 (Output_segment::set_section_addresses): Add increase_relro
4043 parameter. Change all callers. Add initial alignment to align
4044 relro sections on separate page. Remove old relro handling.
4045 (Output_segment::set_section_list_addresses): Remove in_relro
4046 parameter. Change all callers.
4047 (Output_segment::set_offset): Add increase parameter. Change all
4048 callers. Remove old relro handling.
4049 * output.h (class Output_section): Add new methods: is_last_relro,
4050 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
4051 Add is_last_relro_ and is_first_non_relro_ fields.
4052 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
4053 Create separate .got.plt section. Call increase_relro.
4054 * x86_64.cc (Target_x86_64::got_section): Likewise.
4055 * testsuite/relro_script_test.t: Add .got.plt.
4058 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
4059 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
4060 (Layout::finalize): Call set_dynamic_symbol_size.
4061 (Layout::set_dynamic_symbol_size): New function.
4062 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
4063 set_dynamic_symbol_size.
4066 * output.h (class Output_section): Add is_entsize_zero_ field.
4067 * output.cc (Output_section::Output_section): Initialize
4069 (Output_section::set_entsize): If two different entsizes are
4070 requested, force it to zero.
4071 (Output_section::add_input_section): Set flags for .debug_str
4072 before updating section flags. Set entsize.
4073 (Output_section::update_flags_for_input_section): Set SHF_MERGE
4074 and SHF_STRING if all input sections have those flags.
4076 2009-12-29 Rafael Espindola <espindola@google.com>
4078 * main.cc (main): Fix the sys time reporting.
4079 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
4082 2009-12-29 Sriraman Tallam <tmsriram@google.com>
4084 * options.cc (General_options::parse_version): Allow -v to exit
4085 without an error if there is nothing to link.
4087 2009-12-29 Ian Lance Taylor <iant@google.com>
4089 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
4090 using a version of gcc before 4.1.
4091 * configure: Rebuild.
4093 2009-12-28 Chris Demetriou <cgd@google.com>
4095 * attributes.cc (Output_attributes_section_data::do_write): Use
4096 std::vector::front rather than std::vector::data.
4098 2009-12-28 Ian Lance Taylor <iant@google.com>
4100 * symtab.h (class Symbol_table): Add enum Defined.
4101 * resolve.cc (Symbol_table::should_override): Add defined
4102 parameter. Change all callers. Test whether object is NULL
4103 before calling a method on it.
4104 (Symbol_table::report_resolve_problem): Add defined parameter.
4106 (Symbol_table::should_override_with_special): Likewise.
4107 * symtab.cc (Symbol_table::define_in_output_data): Add defined
4108 parameter. Change all callers.
4109 (Symbol_table::do_define_in_output_data): Likewise.
4110 (Symbol_table::define_in_output_segment): Likewise.
4111 (Symbol_table::do_define_in_output_segment): Likewise.
4112 (Symbol_table::define_as_constant): Likewise.
4113 (Symbol_table::do_define_as_constant): Likewise.
4114 * script.h (class Symbol_assignment): Add is_defsym parameter to
4115 constructor; change all callers.
4116 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
4117 parameter. Change all callers. Add is_defsym_ field.
4118 (class Parser_closure): Add parsing_defsym parameter to
4119 constructor; change all callers. Add parsing_defsym accessor
4120 function. Add parsing_defsym_ field.
4122 2009-12-28 Ian Lance Taylor <iant@google.com>
4124 * gold.cc (queue_middle_tasks): Fix formatting.
4125 * object.cc (Relobj::is_section_name_included): Likewise.
4127 2009-12-23 Ian Lance Taylor <iant@google.com>
4129 * i386.cc (Target_i386::do_calls_non_split): Recognize
4130 -fsplit-stack prologue for a function with a static chain.
4131 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
4132 -fsplit-stack prologue when using %r11.
4134 2009-12-21 Sriraman Tallam <tmsriram@google.com>
4136 * options.cc (General_options::parse_version): Make -v continue and do
4137 the link like GNU ld does.
4139 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
4141 * Makefile.am (CCFILES): Add timer.cc.
4142 (HFILES): Add timer.h.
4143 * configure.ac: Check for sysconf and times.
4144 * main.cc: include timer.h.
4145 (main): Use Timer instead of get_run_time.
4148 * workqueue.cc: include timer.h.
4149 (Workqueue::find_and_run_task):
4150 Report user, sys and wall time.
4151 * Makefile.in: Regenerate.
4152 * config.in: Regenerate.
4153 * configure: Regenerate.
4155 2009-12-16 Doug Kwan <dougkwan@google.com>
4157 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
4159 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
4160 relaxed input sections.
4161 * output.cc (Output_section::find_relaxed_input_section): Change
4162 return type to Output_relaxed_input_section pointer. Adjust code
4163 for new type of relaxed_input_section_map_.
4164 * output.h (Output_section::find_relaxed_input_section): Change
4165 return type to Output_relaxed_input_section pointer.
4166 (Output_section::Output_relaxed_input_section_by_input_section_map):
4168 (Output_section::relaxed_input_section_map_): Change type to
4169 Output_section::Output_relaxed_input_section_by_input_section_map.
4170 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
4173 2009-12-15 Ian Lance Taylor <iant@google.com>
4175 * layout.cc (Layout::create_shstrtab): Only write out after input
4176 sections if we are compressing debug sections.
4178 2009-12-15 Ian Lance Taylor <iant@google.com>
4180 * archive.cc (Archive::add_symbols): Only look up a symbol without
4181 a version if there is, in fact, a version.
4183 2009-12-14 Ian Lance Taylor <iant@google.com>
4185 Revert -Wshadow changes, all changes from:
4186 2009-12-11 Doug Kwan <dougkwan@google.com>
4187 2009-12-11 Nick Clifton <nickc@redhat.com>
4188 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
4190 2009-12-11 Doug Kwan <dougkwan@google.com>
4192 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
4194 * attributes.cc (Object_attribute::size): Ditto.
4195 (Attributes_section_data::size): Ditto.
4196 (Attributes_section_data::Attributes_section_data): Ditto.
4197 (Output_attributes_section_data::do_write): Ditto.
4198 * attributes.h (Object_attribute::set_type): Ditto.
4199 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
4201 2009-12-11 Nick Clifton <nickc@redhat.com>
4203 * archive.cc: Fix shadowed variable warnings.
4205 * compressed_output.cc: Likewise.
4206 * compressed_output.h: Likewise.
4207 * configure: Likewise.
4208 * dwarf_reader.cc: Likewise.
4209 * dynobj.cc: Likewise.
4210 * dynobj.h: Likewise.
4211 * ehframe.cc: Likewise.
4212 * ehframe.h: Likewise.
4213 * errors.cc: Likewise.
4214 * expression.cc: Likewise.
4215 * fileread.cc: Likewise.
4216 * fileread.h: Likewise.
4217 * freebsd.h: Likewise.
4218 * i386.cc: Likewise.
4220 * incremental.h: Likewise.
4221 * layout.cc: Likewise.
4222 * layout.h: Likewise.
4223 * mapfile.cc: Likewise.
4224 * merge.cc: Likewise.
4225 * merge.h: Likewise.
4226 * object.cc: Likewise.
4227 * object.h: Likewise.
4228 * options.h: Likewise.
4229 * output.cc: Likewise.
4230 * output.h: Likewise.
4231 * parameters.cc: Likewise.
4232 * plugin.cc: Likewise.
4233 * powerpc.cc: Likewise.
4234 * reduced_debug_output.cc: Likewise.
4235 * reduced_debug_output.h: Likewise.
4236 * reloc.cc: Likewise.
4237 * reloc.h: Likewise.
4238 * resolve.cc: Likewise.
4239 * script-sections.cc: Likewise.
4240 * script.cc: Likewise.
4241 * script.h: Likewise.
4242 * sparc.cc: Likewise.
4243 * symtab.cc: Likewise.
4244 * symtab.h: Likewise.
4245 * target-select.cc: Likewise.
4246 * target-select.h: Likewise.
4247 * token.h: Likewise.
4248 * workqueue.cc: Likewise.
4249 * workqueue.h: Likewise.
4250 * x86_64.cc: Likewise.
4252 2009-12-10 Doug Kwan <dougkwan@google.com>
4254 * arm.cc (attributes.h): New include.
4255 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
4256 (Arm_relobj::~Arm_relobj): Delete object pointed by
4257 attributes_section_data_.
4258 (Arm_relobj::attributes_section_data): New method definition.
4259 (Arm_relobj::attributes_section_data_): New data member declaration.
4260 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
4261 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
4262 attributes_section_data_.
4263 (Arm_dynobj::attributes_section_data): New method definition.
4264 (Arm_dynobj::attributes_section_data_): New data member declaration.
4265 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
4266 initialization value of may_use_blx_ to false.
4267 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
4268 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
4269 object attributes to compute results instead of hard-coding.
4270 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
4271 Target_arm::get_secondary_compatible_arch,
4272 Target_arm::set_secondary_compatible_arch
4273 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
4274 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
4275 New method declarations.
4276 (Target_arm::get_aeabi_object_attribute): New method definition.
4277 (Target_arm::attributes_section_data_): New data member declaration.
4278 (read_arm_attributes_section): New template definition.
4279 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
4280 (Arm_dynobj::do_read_symbols): Ditto.
4281 (Target_arm::do_finalize_sections): Merge attributes sections from
4282 input. Check for BLX use after attributes section merging.
4283 Fix __exidx_start and __exidx_end visibility. Create an
4284 .ARM.attributes section if necessary.
4285 (Target_arm::get_secondary_compatible_arch,
4286 Target_arm::set_secondary_compatible_arch,
4287 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
4288 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
4289 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
4290 New method definitions.
4292 2009-12-09 Ian Lance Taylor <iant@google.com>
4294 * plugin.cc (Plugin::load): Don't cast from void* to a function
4297 2009-12-09 Ian Lance Taylor <iant@google.com>
4299 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
4302 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
4304 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
4305 Replace two_file_shared_1.so with two_file_shared_2.so.
4306 * testsuite/Makefile.in: Regenerated.
4308 2009-12-08 Doug Kwan <dougkwan@google.com>
4310 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
4311 (HFILES): Add attributes.h and int_encoding.h.
4312 * Makefile.in: Regenerate.
4313 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
4314 function definitions to int_encoding.cc
4315 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
4316 prototypes to int_encoding.h
4317 * reduced_debug_output.cc (int_encoding.h): New include.
4318 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
4319 function definitions to int_encoding.cc
4320 (insert_into_vector, read_from_pointer): Move template definitions to
4322 * attributes.cc: New file.
4323 * attributes.h: New file.
4324 * int_encoding.cc: New file.
4325 * int_encoding.h: New file.
4327 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
4330 * incremental-dump.cc (dump_incremental_inputs): New.
4331 (main): Use dump_incremental_inputs.
4333 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
4336 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
4337 checking elfcpp::STT_FUNC.
4338 (Target_i386::Relocate::relocate): Likewise.
4339 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4341 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
4342 symbols from shared libraries into normal FUNC symbols.
4344 * symtab.h (Symbol): Add is_func and use it.
4346 2009-12-05 Doug Kwan <dougkwan@google.com>
4348 * arm.cc (Target_arm::arm_info): Initialize new fields
4349 attributes_section and attributes_vendor.
4350 * i386.cc (Target_i386::i386_info): Same.
4351 * object.cc (Sized_relobj::do_layout): Skip attribute section.
4352 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
4353 fields attributes_section and attributes_vendor.
4354 * sparc.cc (Target_sparc::sparc_info): Same.
4355 * target.h (Target::attributes_section, Target::attributes_vendor,
4356 Target::is_attributes_section, Target::attribute_arg_type,
4357 Target::attributes_order): New method definitions.
4358 (Target::Target_info::attributes_section,
4359 Target::Target_info::attributes_vendor): New fields.
4360 (Target::do_attribute_arg_type, Target::do_attributes_order): New
4361 virtual method definitions.
4362 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
4363 attributes_section and attributes_vendor.
4364 * testsuite/testfile.cc (Target_test::test_target_info): Same.
4366 2009-12-05 Doug Kwan <dougkwan@google.com>
4368 * arm.cc: Update comments about interworking and stub generation.
4369 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
4370 considered as non-PIC.
4371 (Arm_relocate_functions::base_abs): Fix formatting.
4372 (Arm_relocate_functions::got_prel): Fix comment. Change interface
4373 of function to use GOT entry address instead of offset.
4374 (Target_arm::Scan::global): Issue an error if a symbol would need a
4375 PLT does not get one because it is untyped. Remove code to create
4376 dynamic symbols for relative branches.
4377 (Target_arm::Relocate::relocate: Use 0 instead of false since function
4378 takes unsigned integer instead of boolean.
4380 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
4382 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
4383 (two_file_test_LDADD): Likewise.
4384 (common_test_1_LDADD): Likewise.
4385 (exception_test_LDADD) Likewise.
4386 (weak_test_LDADD): Likewise.
4387 (many_sections_test_LDADD): Likewise.
4388 (initpri1_LDADD): Likewise.
4389 (script_test_1_LDADD): Likewise.
4390 (script_test_2_LDADD): Likewise.
4391 (justsyms_LDADD): Likewise.
4392 (binary_test_LDADD): Likewise.
4393 (large_LDADD): Likewise.
4394 * testsuite/Makefile.in: Regenerated.
4396 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
4398 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
4399 (Symbol_table::override_with_special): Likewise.
4400 (Symbol_table::add_from_object): Likewise.
4402 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
4404 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
4405 Don't set the data_offset twice.
4407 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
4409 * testsuite/Makefile.in: Regenerate.
4411 2009-12-03 Doug Kwan <dougkwan@google.com>
4413 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
4414 (Target_arm::do_finalize_sections): Add parameter for symbol table
4415 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
4416 * i386.cc (Target_i386::do_finalize_sections): Add an additional
4417 parameter for symbol table pointer.
4418 * layout.cc (Layout::finalize): Call Target::finalize_sections with
4419 an additional parameter for a pointer to symbol table.
4420 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
4421 parameter for a symbol table pointer.
4422 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
4423 * target.h (Target::finalize_sections, Target::do_finalize_sections):
4425 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
4426 parameter for a symbol table pointer.
4428 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
4430 * incremental.cc (Incremental_inputs_header)
4431 (Incremental_inputs_header_write, Incremental_inputs_entry)
4432 (Incremental_inputs_entry_write): Move ...
4433 * incremental.h (Incremental_inputs_header)
4434 (Incremental_inputs_header_write, Incremental_inputs_entry)
4435 (Incremental_inputs_entry_write): here.
4437 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
4439 * incremental.cc (make_sized_incremental_binary): Set the target.
4440 Error if it is incompatible.
4441 * output.h (Output_file): Add filename method.
4443 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
4445 * incremental.cc (Incremental_inputs_entry): Remove unused argument
4446 from the get_* methods.
4448 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
4450 * incremental-dump.cc (main): Check that the offeset of a script is 0.
4451 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
4452 Write 0 for the data_offset of scripts.
4454 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
4456 * testsuite/Makefile.am: Add the incremental_test.sh test.
4457 * testsuite/incremental_test.sh: New.
4458 * testsuite/incremental_test_1.c: New.
4459 * testsuite/incremental_test_2.c: New.
4461 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
4463 * incremental-dump.cc (main): Fix typos.
4465 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
4468 * incremental-dump.cc (main): Use llu to print 64 bit values.
4470 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
4471 H.J. Lu <hongjiu.lu@intel.com>
4473 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
4475 (incremental_dump_LDADD): Likewise.
4476 * Makefile.in: Regenerated.
4478 2009-11-25 Doug Kwan <dougkwan@google.com>
4482 2009-11-25 Doug Kwan <dougkwan@google.com>
4484 * arm.cc (Target_arm::Target_arm): Move method definition
4485 outside of class definition. Add code to handle
4486 --target1-rel, --target1-abs and --target2= options.
4487 (Target_arm::get_reloc_reloc_type): Change method to be
4488 non-static and const.
4489 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
4490 New data member declaration.
4491 (Target_arm::Scan::local, Target_arm::Scan::global,
4492 Target_arm::Relocate::relocate,
4493 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4494 Adjust call to Target_arm::get_real_reloc_type.
4495 (Target_arm::get_real_reloc_type): Use command line options
4496 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
4497 * options.h (--target1-rel, --target1-abs, --target2): New
4500 2009-11-25 Doug Kwan <dougkwan@google.com>
4502 * arm.cc (Target_arm::Target_arm): Move method definition outside of
4503 class definition. Add code to handle --target1-rel, --target1-abs
4504 and --target2= options.
4505 (Target_arm::get_reloc_reloc_type): Change method to be non-static
4507 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
4509 (Target_arm::Scan::local, Target_arm::Scan::global,
4510 Target_arm::Relocate::relocate,
4511 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
4512 call to Target_arm::get_real_reloc_type.
4513 (Target_arm::get_real_reloc_type): Use command line options to
4514 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
4515 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
4518 2009-11-25 Doug Kwan <dougkwan@google.com>
4520 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
4521 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
4522 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
4524 (Arm_relocate_functions::thm_call): Replace body with a call to
4525 Arm_relocate_functions::thumb_branch_common.
4526 (Arm_relocate_functions::thm_jump24,
4527 Arm_relocate_functions::thm_xpc22): New method definitions.
4528 (Arm_relocate_functions::thumb_branch_common): New method definition.
4529 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
4531 (Target_arm::Relocate::relocate): Adjust call to thm_call.
4532 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
4534 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
4536 * Makefile.am: Build incremental-dump
4537 * Makefile.in: Regenerate.
4538 * incremental-dump.cc: New.
4539 * incremental.cc (Incremental_inputs_header_data,
4540 Incremental_inputs_entry_data): Move to incremental.h
4541 * incremental.h: (Incremental_inputs_header_data,
4542 Incremental_inputs_entry_data): Move from incremental.cc
4544 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
4546 * incremental.cc (Incremental_inputs_header,
4547 Incremental_inputs_header_write, Incremental_inputs_entry,
4548 Incremental_inputs_entry_write): Add a typedef with the data type.
4550 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
4552 * incremental.cc (Incremental_inputs_header,
4553 Incremental_inputs_header_write, Incremental_inputs_entry,
4554 Incremental_inputs_entry_write): Update comment about which
4555 type has the filed descriptions.
4557 2009-11-15 Doug Kwan <dougkwan@google.com>
4559 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
4560 (Arm_relocate_functions::arm_branch_common): Change method defintion
4561 in class definition to a method declaration and update list of formal
4563 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
4564 Arm_relocation_functions::jump24): Adjust call to
4565 Arm_relocate_functions::arm_branch_common. Update list of formal
4567 (Arm_relocate_functions::xpc25): New method definition.
4568 (Arm_relocate_functions::arm_branch_common): Move method defintion
4569 out from class definition. Use stubs for mode-switching and extending
4571 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
4572 specially. Change code to enable use of stubs in ARM branches.
4574 2009-11-10 Doug Kwan <dougkwan@google.com>
4576 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
4577 in method declaration.
4578 (Target_arm::relocate_stub): New method declaration.
4579 (Target_arm::default_target): Change to return a pointer instead of
4581 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
4582 Target_arm::default_target.
4583 (Arm_Relobj::do_relocate_sections): Remove options paramater in
4585 (Target_arm::relocate_section): Adjust view.
4586 (Target_arm::relocate_stub): New method definition.
4588 2009-11-10 Doug Kwan <dougkwan@google.com>
4590 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
4592 * incremental.cc (open_incremental_binary): Initialized local
4593 variables to avoid warnings.
4594 * object.cc (make_elf_object): Ditto.
4595 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
4598 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
4601 * testsuite/plugin_test.c: Include "config.h".
4603 2009-11-09 Doug Kwan <dougkwan@google.com>
4605 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
4606 (arm_symbol_value): Remove.
4607 (Arm_relocate_functions::arm_branch_common,
4608 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
4609 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
4610 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
4611 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
4612 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
4613 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
4614 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
4615 Arm_relocate_functions::thm_mobw_abs_nc,
4616 Arm_relocate_functions::thm_mov_abs,
4617 Arm_relocate_functions::movw_prel_nc,
4618 Arm_relocate_functions::thm_movt_abs,
4619 Arm_relocate_functions::movt_prel,
4620 Arm_relocate_functions::thm_movw_prel_nc,
4621 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
4622 (Target_arm::Relocate::relocate): Only decompose address into two
4623 parts if relocation type uses the thumb-bit and pass the actual
4624 bit instead of a flag indicating that the thumb-bit is used. Adjust
4625 calls to methods in Arm_relocate_functions for this change.
4627 2009-11-08 Ian Lance Taylor <iant@google.com>
4630 * reloc.cc: Instantiate
4631 Sized_relobj::initialize_input_to_output_maps and
4632 Sized_relobj:free_input_to_output_maps.
4634 2009-11-06 Ian Lance Taylor <iant@google.com>
4637 * defstd.cc (in_segment): Set only_if_ref true for "end".
4639 2009-11-06 Doug Kwan <dougkwan@google.com>
4641 * arm.cc (class Reloc_stub): Correct a comment.
4642 (Target_arm::Target_arm): Initialize arm_input_section_map_.
4643 (Target_arm::scan_section_for_stubs): New method declaration.
4644 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
4645 Change methods from private to protected.
4646 (Target_arm::do_may_relax): New method definition.
4647 (Target_arm::do_relax, Target_arm::group_sections,
4648 Target_arm::scan_reloc_for_stub,
4649 Target_arm::scan_reloc_section_for_stubs): New method declarations.
4650 (Target_arm::arm_input_section_map_): New data member declaration.
4651 (Target_arm::scan_reloc_for_stub,
4652 Target_arm::scan_reloc_section_for_stubs,
4653 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
4654 Target_arm::do_relax): New method definitions.
4656 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
4658 * configure.ac: Check for (struct stat)::st_mtim
4659 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
4660 * config.in: Regenerate.
4661 * configure: Regenerate.
4663 2009-11-05 Ian Lance Taylor <iant@google.com>
4666 * output.cc (Output_segment::add_output_section): Add missing
4669 2009-11-04 Ian Lance Taylor <iant@google.com>
4672 * object.h (class Object): Add is_needed and set_is_needed
4673 methods. Add is_needed_ field. Make bool fields into bitfields.
4674 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
4675 defined in a dynamic object and referenced by a regular object,
4676 set is_needed for the dynamic object.
4677 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
4678 if the file is marked with as_needed and it is not needed.
4680 2009-11-04 Ian Lance Taylor <iant@google.com>
4683 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
4684 tags if data is discarded by linker script.
4685 * i386.cc (Target_i386::do_finalize_sections): Likewise.
4686 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
4687 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
4688 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4690 2009-11-04 Ian Lance Taylor <iant@google.com>
4692 * layout.cc (Layout::get_output_section): Add is_interp and
4693 is_dynamic_linker_section parameters. Change all callers.
4694 (Layout::choose_output_section): Likewise.
4695 (Layout::make_output_section): Likewise.
4696 (Layout::add_output_section_data): Add is_dynamic_linker_section
4697 parameter. Change all callers.
4698 * layout.h (class Layout): Update declarations.
4699 * output.h (class Output_section): Add is_interp, set_is_interp,
4700 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
4701 Add is_interp_, is_dynamic_linker_section_ fields. Change
4702 generate_code_fills_at_write_ to a bitfield.
4703 * output.cc (Output_section::Output_sections): Initialize new
4705 (Output_segment::add_output_section): Add do_sort parameter.
4708 2009-11-03 Ian Lance Taylor <iant@google.com>
4711 * options.h (class General_options): Add --warn-common.
4712 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
4713 merging two common symbols.
4714 (Symbol_table::should_override): Handle --warn-common when merging
4715 a common symbol with a defined symbol. Use report_resolve_problem
4716 for multiple definitions.
4717 (Symbol_table::report_resolve_problem): New function.
4718 * symtab.h (class Symbol_table): Declare report_resolve_problem.
4720 2009-11-03 Doug Kwan <dougkwan@google.com>
4722 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
4724 (Target_arm::stub_factory): New method definition.
4725 (Target_arm::new_arm_input_section,
4726 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
4727 Target_arm::reloc_uses_thumb_bit): New method declarations.
4728 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
4729 New type definitions.
4730 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
4731 member declarations.
4732 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
4733 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
4734 New method definitions.
4736 2009-11-03 Ian Lance Taylor <iant@google.com>
4738 * options.h (class General_options): Add --warn_constructors.
4740 2009-11-03 Ian Lance Taylor <iant@google.com>
4743 * defstd.cc (in_section): Add entries for __rel_iplt_start,
4744 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
4746 2009-11-03 Ian Lance Taylor <iant@google.com>
4749 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
4750 --msgid-bugs-address.
4751 (install-pdf): New target.
4752 (install-data_yes): Look up one directory to find mkinstalldirs.
4754 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
4756 * po/Make-in (.po.gmo): Don't generate .gmo files in source
4759 2009-10-30 Doug Kwan <dougkwan@google.com>
4761 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
4763 2009-10-30 Doug Kwan <dougkwan@google.com>
4765 * arm.cc (Stub_addend_reader): New struct template definition
4766 and partial specializations.
4767 (Stub_addend_reader::operator()): New method definition for a
4768 partially specialized template.
4770 2009-10-30 Doug Kwan <dougkwan@google.com>
4772 * arm.cc (Arm_relobj::processor_specific_flags): New method
4774 (Arm_relobj::do_read_symbols): New method declaration.
4775 (Arm_relobj::processor_specific_flags_): New data member declaration.
4776 (Arm_dynobj): New class definition.
4777 (Target_arm::do_finalize_sections): Add input_objects parameter.
4778 (Target_arm::do_adjust_elf_header): New method declaration.
4779 (Target_arm::are_eabi_versions_compatible,
4780 (Target_arm::merge_processor_specific_flags): New method declaration.
4781 (Target_arm::do_make_elf_object): New overloaded method definitions
4783 (Arm_relobj::do_read_symbols): New method definition.
4784 (Arm_dynobj::do_read_symbols): Ditto.
4785 (Target_arm::do_finalize_sections): Add input_objects parameters.
4786 Merge processor-specific flags from all input objects.
4787 (Target_arm::are_eabi_versions_compatible,
4788 Target_arm::merge_processor_specific_flags,
4789 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
4790 New method definitions.
4791 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
4792 Input_objects pointer type parameter.
4793 * layout.cc (Layout::finalize): Pass input objects to target's.
4794 finalize_sections function.
4795 * output.cc (Output_file_header::do_sized_write): Set ELF file
4796 header's processor-specific flags.
4797 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
4798 Input_objects pointer type parameter.
4799 * sparc.cc (Target_sparc::do_finalize_sections): Same.
4800 * target.h (Input_objects): New forward class declaration.
4801 (Target::processor_specific_flags,
4802 Target::are_processor_specific_flags_sect): New method definitions.
4803 (Target::finalize_sections): Add input_objects parameter.
4804 (Target::Target): Initialize processor_specific_flags_ and
4805 are_processor_specific_flags_set_.
4806 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
4808 (Target::set_processor_specific_flags): New method definition.
4809 (Target::processor_specific_flags_,
4810 Target::are_processor_specific_flags_set_): New data member
4812 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
4813 Input_objects pointer type parameter.
4815 2009-10-30 Doug Kwan <dougkwan@google.com>
4817 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
4819 2009-10-28 Ian Lance Taylor <iant@google.com>
4821 * object.h (class Relobj): Drop options parameter from
4822 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
4823 do_scan_relocs, do_relocate. Change all callers.
4824 (class Sized_relobj): Drop options parameters from
4825 do_gc_process_relocs, do_scan_relocs, do_relocate,
4826 do_relocate_sections, relocate_sections, emit_relocs_scan,
4827 emit_relocs_scan_reltype. Change all callers.
4828 (struct Relocate_info): Remove options field and all references to
4830 * reloc.h (class Read_relocs): Remove options constructor
4831 parameter and options_ field. Change all callers.
4832 (class Gc_process_relocs, class Scan_relocs): Likewise.
4833 (class Relocate_task): Likewise.
4834 * target-reloc.h (scan_relocs): Remove options parameter. Change
4836 (scan_relocatable_relocs): Likewise.
4837 * target.h (class Sized_target): Remove options parameter from
4838 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
4840 * gc.h (gc_process_relocs): Remove options parameter. Change all
4842 * arm.cc: Update functions to remove options parameters.
4843 * i386.cc: Likewise.
4844 * powerpc.cc: Likewise.
4845 * sparc.cc: Likewise.
4846 * x86_64.cc: Likewise.
4847 * testsuite/testfile.cc: Likewise.
4849 2009-10-28 Doug Kwan <dougkwan@google.com>
4851 * arm.cc (Arm_relobj): New class definition.
4852 (Arm_relobj::scan_sections_for_stubs,
4853 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
4854 New method definitions.
4856 2009-10-28 Cary Coutant <ccoutant@google.com>
4858 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
4859 (Plugin::cleanup_done_): New member.
4860 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
4861 (Plugin_manager::cleanup_done_): Remove.
4862 (Plugin_manager::add_input_file): Edit error message.
4863 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
4864 (Plugin_manager::cleanup): Remove use of cleanup_done_.
4866 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
4868 * fileread.cc: (File_read::View::~View): Use the new
4869 data_ownership_ filed.
4870 (File_read::~File_read): Dispose the new whole_file_view_.
4871 (File_read::open): Mmap the whole file if needed.
4872 (File_read::open): Use whole_file_view_ instead of contents_.
4873 (File_read::find_view): Use whole_file_view_ if applicable.
4874 (File_read::do_read): Use whole_file_view_ instead of contents_.
4875 (File_read::make_view): Use whole_file_view_ instead of contents_,
4876 update File_read::View::View call.
4877 (File_read::find_or_make_view): Update File_read::View::View
4879 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
4881 (File_read::View::Data_ownership): New enum.
4882 (File_read::View::View): Replace bool mapped_ with Data_ownership
4884 (File_read::View::mapped_): Remove (replaced by data_ownership_).
4885 (File_read::View::data_ownership_): New field.
4886 (File_read::contents_): Remove (replaced by whole_file_view_).
4887 (File_read::whole_file_view_): New field.
4888 * options.h (class General_options): Add --keep-files-mapped.
4890 2009-10-27 Cary Coutant <ccoutant@google.com>
4892 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
4893 * testsuite/Makefile.am (plugin_test_5): New test case.
4894 * testsuite/Makefile.in: Regenerate.
4896 2009-10-25 Doug Kwan <dougkwan@google.com>
4898 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
4899 from private to protected to allow access by child class.
4900 (Sized_relobj::do_relocate_sections): New method declaration.
4901 (Sized_relobj::relocate_sections): Virtualize.
4902 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
4903 Sized_relobj::relocate_sections. Instantiate template explicitly
4904 for different target sizes and endianity.
4906 2009-10-24 Doug Kwan <dougkwan@google.com>
4908 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
4909 (Arm_input_section::as_arm_input_section): New method.
4910 (Arm_output_section): New class definition.
4911 (Arm_output_section::create_stub_group,
4912 Arm_output_section::group_sections): New method definitions.
4914 2009-10-22 Doug Kwan <dougkwan@google.com>
4916 * arm.cc (Arm_input_section): New class definition.
4917 (Arm_input_section::init, Arm_input_section:do_write,
4918 Arm_input_section::set_final_data_size,
4919 Arm_input_section::do_reset_address_and_file_offset): New method
4922 2009-10-21 Doug Kwan <dougkwan@google.com>
4924 * arm.cc (Stub_table, Arm_input_section): New forward class
4926 (Stub_table): New class defintion.
4927 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
4928 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
4929 New method definition.
4931 2009-10-21 Doug Kwan <dougkwan@google.com>
4933 * arm.cc: Update copyright comments.
4934 (Target_arm): New forward class template declaration.
4935 (Arm_address): New type.
4936 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
4937 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
4938 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
4940 (Insn_template): Same.
4941 (DEF_STUBS): New macro.
4942 (Stub_type): New enum type.
4943 (Stub_template): New class definition.
4946 (Stub_factory): Same.
4947 (Target_arm::Target_arm): Initialize may_use_blx_ and
4948 should_force_pic_veneer_.
4949 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
4950 Target_arm::should_force_pic_veneer,
4951 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
4952 Target_arm::using_thumb_only, Target_arm:;default_target): New
4954 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
4955 New data member declarations.
4956 (Insn_template::size, Insn_template::alignment): New method defintions.
4957 (Stub_template::Stub_template): New method definition.
4958 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
4959 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
4960 (Stub_factory::Stub_factory): New method definition.
4961 * gold.h (string_hash): New template.
4962 * output.h (Input_section_specifier::hash_value): Use
4964 (Input_section_specifier::string_hash): Remove.
4965 * stringpool.cc (Stringpool_template::string_hash): Use
4968 2009-10-20 Doug Kwan <dougkwan@google.com>
4970 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
4971 symbols of relaxed input sections.
4972 * output.h (Output_section::find_relaxed_input_section): Make
4975 2009-10-16 Doug Kwan <dougkwan@google.com>
4977 * dynobj.cc (Versions::Versions): Initialize version_script_.
4978 Only insert base version symbol definition for a shared object
4979 if version script defines any version versions.
4980 (Versions::define_base_version): New method definition.
4981 (Versions::add_def): Check that base version is not needed.
4982 (Versions::add_need): Define base version lazily.
4983 * dynobj.h (Versions::define_base_version): New method declaration.
4984 (Versions::needs_base_version_): New data member declaration.
4985 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
4986 (check_DATA): Add no_version_test.stdout.
4987 (libno_version_test.so, no_version_test.o no_version_test.stdout):
4989 * testsuite/Makefile.in: Regenerate.
4990 * testsuite/no_version_test.c: New file.
4991 * testsuite/no_version_test.sh: Ditto.
4993 2009-10-16 Doug Kwan <dougkwan@google.com>
4995 * expression.cc (class Segment_start_expression): New class definition.
4996 (Segment_start_expression::value): New method definition.
4997 (script_exp_function_segment_start): Return a new
4998 Segment_start_expression.
4999 * gold/script-c.h (script_saw_segment_start_expression): New function
5001 * script-sections.cc (Script_sections::Script_sections): Initialize
5002 SAW_SEGMENT_START_EXPRESSION_ to false.
5003 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
5004 and -Tbbs options to specify section addresses if given in
5005 command line and no SEGMENT_START expression is seen in a script.
5006 * script-sections.h (Script_sections::saw_segment_start_expression,
5007 Script_sections::set_saw_segment_start_expression): New method
5009 (Script_sections::saw_segment_start_expression_): New data member
5011 * script.cc (script_saw_segment_start_expression): New function.
5012 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
5013 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
5014 script_test_7.sh and script_test_8.sh.
5015 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
5016 script_test_8.stdout.
5017 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
5018 (script_test_6, script_test_6.stdout, script_test_7,
5019 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
5020 * Makefile.in: Regenerate.
5021 * testsuite/script_test_6.sh: New file.
5022 * testsuite/script_test_6.t: Same.
5023 * testsuite/script_test_7.sh: Same.
5024 * testsuite/script_test_7.t: Same.
5025 * testsuite/script_test_8.sh: Same.
5027 2009-10-16 Doug Kwan <dougkwan@google.com>
5029 * output.cc (Output_segment::set_section_list_address): Cast
5030 expressions to unsigned long long type to avoid format warnings.
5032 2009-10-15 Ian Lance Taylor <iant@google.com>
5034 * script.cc (Script_options::add_symbol_assignment): Always add a
5035 dot assignment to script_sections_.
5036 * script-sections.cc (Script_sections::add_dot_assignment):
5037 Initialize if necessary.
5039 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
5040 program headers with no load segment if there is a linker script.
5042 * layout.cc (Layout::set_segment_offsets): Align the file offset
5043 to the segment aligment for -N or -n with no load segment.
5044 * output.cc (Output_segment::add_output_section): Don't crash if
5045 the first section is a TLS section.
5046 (Output_segment::set_section_list_addresses): Print an error
5047 message if the address moves backward in a linker script.
5048 * script-sections.cc
5049 (Output_section_element_input::set_section_addresses): Don't
5050 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
5051 (Orphan_output_section::set_section_addresses): Likewise.
5053 2009-10-15 Doug Kwan <dougkwan@google.com>
5055 * layout.cc (Layout::finish_dynamic_section): Generate tags
5056 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
5057 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
5058 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
5060 2009-10-14 Ian Lance Taylor <iant@google.com>
5062 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
5064 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
5065 data_shdr fields of relinfo.
5066 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
5067 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
5068 R_386_TLS_LDO_32, adjust based on section flags.
5069 (Target_i386::Relocate::fix_up_ldo): Remove.
5071 2009-10-13 Ian Lance Taylor <iant@google.com>
5073 Add support for -pie.
5074 * options.h (class General_options): Add -pie and
5076 (General_options::output_is_position_independent): Test -pie.
5077 (General_options::output_is_executable): Return true if not shared
5078 and not relocatable.
5079 (General_options::output_is_pie): Remove.
5080 * options.cc (General_options::finalize): Reject incompatible uses
5082 * gold.cc (queue_middle_tasks): A -pie link is not static.
5083 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
5084 * symtab.cc (Symbol::final_value_is_known): Return false if
5085 output_is_position_independent.
5086 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
5087 output_is_position_independent.
5088 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
5089 output_is_position_independent.
5090 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
5091 output_is_position_independent.
5092 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
5094 (basic_pie_test.o, basic_pie_test): New targets.
5095 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
5096 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
5097 (two_file_pie_test): New target.
5098 * testsuite/Makefile.in: Rebuild.
5099 * README: Remove note saying that -pie is not supported.
5101 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
5103 * options.h (class General_options): Add -init and -fini.
5104 * layout.cc (Layout::finish_dynamic_section): Emit
5105 given init and fini functions.
5107 2009-10-13 Sriraman Tallam <tmsriram@google.com>
5109 * gc.h (gc_process_relocs): Check if icf is enabled using new
5111 * gold.cc (queue_initial_tasks): Likewise.
5112 (queue_middle_tasks): Likewise.
5113 * object.cc (do_layout): Likewise.
5114 * symtab.cc (is_section_folded): Likewise.
5115 * main.cc (main): Likewise.
5116 * reloc.cc (Read_relocs::run): Likewise.
5117 (Sized_relobj::do_scan_relocs): Likewise.
5118 * icf.cc (is_function_ctor_or_dtor): New function.
5119 (Icf::find_identical_sections): Check if function is ctor or dtor when
5121 * options.h (General_options::icf): Change option to be an enum.
5122 (Icf_status): New enum.
5123 (icf_enabled): New method.
5124 (icf_safe_folding): New method.
5125 (set_icf_status): New method.
5126 (icf_status_): New variable.
5127 * (options.cc) (General_options::finalize): Set icf_status_.
5128 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
5129 icf_test and icf_keep_unique_test to use the --icf enum flag.
5130 * testsuite/icf_safe_test.sh: New file.
5131 * testsuite/icf_safe_test.cc: New file.
5133 2009-10-12 Sriraman Tallam <tmsriram@google.com>
5135 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
5136 includes to gc.h and icf.h.
5137 * arm.cc: Include gc.h.
5138 * gold.cc: Likewise.
5139 * i386.cc: Likewise.
5140 * powerpc.cc: Likewise.
5141 * sparc.cc: Likewise.
5142 * x86_64.cc: Likewise.
5143 * gc.h: Include icf.h.
5145 2009-10-11 Ian Lance Taylor <iant@google.com>
5147 * plugin.cc: Include "gold.h" before other header files.
5149 2009-10-10 Chris Demetriou <cgd@google.com>
5151 * options.h (Input_file_argument::Input_file_type): New enum.
5152 (Input_file_argument::is_lib_): Replace with...
5153 (Input_file_argument::type_): New member.
5154 (Input_file_argument::Input_file_argument): Take Input_file_type
5155 'type' rather than boolean 'is_lib' as second argument.
5156 (Input_file_argument::is_lib): Use type_.
5157 (Input_file_argument::is_searched_file): New function.
5158 (Input_file_argument::may_need_search): Handle is_searched_file.
5159 * options.cc (General_options::parse_library): Support -l:filename.
5160 (General_options::parse_just_symbols): Update for Input_file_argument
5162 (Command_line::process): Likewise.
5163 * archive.cc (Archive::get_file_and_offset): Likewise.
5164 * plugin.cc (Plugin_manager::release_input_file): Likewise.
5165 * script.cc (read_script_file, script_add_file): Likewise.
5166 * fileread.cc (Input_file::Input_file): Likewise.
5167 (Input_file::will_search_for): Handle is_searched_file.
5168 (Input_file::open): Likewise.
5169 * readsyms.cc (Read_symbols::get_name): Likewise.
5170 * testsuite/Makefile.am (searched_file_test): New test.
5171 * testsuite/Makefile.in: Regenerate.
5172 * testsuite/searched_file_test.cc: New file.
5173 * testsuite/searched_file_test_lib.cc: New file.
5175 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
5176 Ian Lance Taylor <iant@google.com>
5178 * descriptor.cc: Include <cstdio> and "binary-io.h".
5179 (Descriptors::open): Open the files in binary mode always.
5180 * script.cc (Lex::get_token): Treat \r as whitespace.
5182 2009-10-09 Ian Lance Taylor <iant@google.com>
5184 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
5186 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
5187 Ian Lance Taylor <iant@google.com>
5189 * configure.ac: Check for readv function also.
5190 * fileread.cc (readv): Define if not HAVE_READV.
5191 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
5193 * config.in: Regenerate.
5194 * configure: Regenerate.
5196 2009-10-09 Doug Kwan <dougkwan@google.com>
5198 * layout.cc (Layout::make_output_section): Call target hook to make
5199 ordinary output section.
5200 (Layout::finalize): Adjust parameter list of call the
5201 Target::may_relax().
5202 * layout.h (class Layout::section_list): New method.
5203 * merge.h (Output_merge_base::entsize): Change visibility to public.
5204 (Output_merge_base::is_string, Output_merge_base::do_is_string):
5206 (Output_merge_string::do_is_string): New method.
5207 * object.cc (Sized_relobj::do_setup): renamed from
5208 Sized_relobj::set_up.
5209 * object.h (Sized_relobj::adjust_shndx,
5210 Sized_relobj::initializ_input_to_output_maps,
5211 Sized_relobj::free_input_to_output_maps): Change visibilities to
5213 (Sized_relobj::setup): Virtualize.
5214 (Sized_relobj::do_setup): New method declaration.
5215 (Sized_relobj::invalidate_section_offset,
5216 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
5217 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
5218 * options.cc (parse_int): New function.
5219 * options.h (parse_int): New declaration.
5220 (DEFINE_int): New macro.
5221 (stub_group_size): New option.
5222 * output.cc (Output_section::Output_section): Initialize memebers
5223 merge_section_map_, merge_section_by_properties_map_,
5224 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
5225 (Output_section::add_input_section): Handled deferred code-fill
5226 generation and remove an old comment.
5227 (Output_section::add_relaxed_input_section): New method definition.
5228 (Output_section::add_merge_input_section): Use merge section by
5229 properties map to speed to search. Update merge section maps
5231 (Output_section::build_relaxation_map): New method definition.
5232 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5234 (Output_section::relax_input_section): Renamed to
5235 Output_section::convert_input_sections_to_relaxed_sections and change
5236 interface to take a vector of pointers to relaxed sections.
5237 (Output_section::find_merge_section,
5238 Output_section::find_relaxed_input_section): New method definitions.
5239 (Output_section::is_input_address_mapped,
5240 Output_section::output_offset, Output_section::output_address):
5241 Use output section data maps to speed up searching.
5242 (Output_section::find_starting_output_address): Add comments.
5243 (Output_section::do_write,
5244 Output_section::write_to_postprocessing_buffer): Do code-fill
5245 generation as appropriate.
5246 (Output_section::get_input_sections): Invalidate relaxed input section
5248 (Output_section::restore_states): Adjust type of checkpoint .
5249 Invalidate relaxed input section map.
5250 * output.h (Output_merge_base): New class declaration.
5251 (Input_section_specifier): New class defintion.
5252 (class Output_relaxed_input_section) Change base class to
5253 Output_section_data_build.
5254 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
5255 base class initializer.
5256 (Output_section::add_relaxed_input_section): New method declaration.
5257 (Output_section::Input_section): Change visibility to protected.
5258 (Output_section::Input_section::relobj,
5259 Output_section::Input_section::shndx): Handle relaxed input sections.
5260 Output_section::input_sections) Change visibility to protected. Also
5261 define overload to return a non-const pointer.
5262 (Output_section::Merge_section_properties): New class defintion.
5263 (Output_section::Merge_section_by_properties_map,
5264 Output_section::Output_section_data_by_input_section_map,
5265 Output_section::Relaxation_map): New types.
5266 (Output_section::relax_input_section): Rename method to
5267 Output_section::convert_input_sections_to_relaxed_sections and change
5268 interface to take a vector of relaxed section pointers.
5269 (Output_section::find_merge_section,
5270 Output_section::find_relaxed_input_section,
5271 Output_section::build_relaxation_map,
5272 Output_section::convert_input_sections_in_list_to_relaxed_sections):
5273 New method declarations.
5274 (Output_section::merge_section_map_
5275 Output_section::merge_section_by_properties_map_,
5276 Output_section::relaxed_input_section_map_,
5277 Output_section::is_relaxed_input_section_map_valid_,
5278 Output_section::generate_code_fills_at_write_): New data members.
5279 * script-sections.cc
5280 (Output_section_element_input::set_section_addresses): Call
5281 current_data_size and addralign methods of relaxed input sections.
5282 (Orphan_output_section::set_section_addresses): Call current_data_size
5283 and addralign methods of relaxed input sections.
5284 * symtab.cc (Symbol_table::compute_final_value): Extract template
5285 from the body of Symbol_table::sized_finalize_symbol.
5286 (Symbol_table::sized_finalized_symbol): Call
5287 Symbol_table::compute_final_value.
5288 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
5289 (Symbol_table::compute_final_value): New templated method declaration.
5290 * target.cc (Target::do_make_output_section): New method defintion.
5291 * target.h (Target::make_output_section): New method declaration.
5292 (Target::relax): Add more parameters for input objects, symbol table
5293 and layout. Adjust call to do_relax.
5294 (Target::do_make_output_section): New method declaration.
5295 (Target::do_relax): Add parameters for input objects, symbol table
5298 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
5300 * pread.c: Include stdio.h.
5302 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
5304 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
5307 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
5309 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5310 Change read_shndx type to unsigned int.
5311 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
5313 (Sized_dwarf_line_info::read_line_mappings): Likewise.
5314 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
5315 Change read_shndx type to unsigned int.
5316 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
5318 (Sized_dwarf_line_info::read_line_mappings): Likewise.
5319 * layout.cc (Layout::create_symtab_sections): Cast the result of
5320 local_symcount * symsize to off_t in the gold_assert.
5322 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5324 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
5325 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
5327 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
5328 (Arm_relocate_functions::thm_abs5): New function.
5329 (Arm_relocate_functions::abs12): New function.
5330 (Arm_relocate_functions::abs16): New function.
5331 (Arm_relocate_functions::base_abs): New function.
5332 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
5333 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
5334 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
5336 (Scan::global): Likewise.
5337 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
5338 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
5339 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
5340 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
5343 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5345 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
5346 (Arm_relocate_functions::movt_prel): New function.
5347 (Arm_relocate_functions::thm_movw_prel_nc): New function.
5348 (Arm_relocate_functions::thm_movt_prel): New function.
5349 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
5350 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
5351 (Scan::global, Relocate::relocate): Likewise.
5352 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
5354 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
5356 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
5357 Incremental_checker.
5358 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
5360 (class Incremental_inputs_header): New class.
5361 (Incremental_inputs_header_writer): Edit comment.
5362 (Incremental_inputs_entry): New class.
5363 (Incremental_inputs_entry_writer): Edit comment.
5364 (Sized_incremental_binary::do_find_incremental_inputs_section):
5365 Add *strtab_shndx parameter, fill it.
5366 (Sized_incremental_binary::do_check_inputs): New method.
5367 (Incremental_checker::can_incrementally_link_output_file): Use
5368 Sized_incremental_binary::check_inputs.
5369 (Incremental_inputs::report_command_line): Save command line in
5372 (Incremental_binary::find_incremental_inputs_section): New
5374 (Incremental_binary::do_find_incremental_inputs_section): Add
5375 strtab_shndx parameter.
5376 (Incremental_binary::do_check_inputs): New pure virtual method.
5377 (Sized_incremental_binary::do_check_inputs): Declare.
5378 (Incremental_checker::Incremental_checker): Add incremental_inputs
5379 parameter, use it to initialize incremental_inputs_.
5380 (Incremental_checker::incremental_inputs_): New field.
5381 (Incremental_checker::command_line): New method.
5382 (Incremental_checker::inputs): New method.
5383 (Incremental_checker::command_line_): New field.
5385 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
5387 * incremental.cc: Include <cstdarg> and "target-select.h".
5388 (vexplain_no_incremental): New function.
5389 (explain_no_incremental): New function.
5390 (Incremental_binary::error): New method.
5391 (Sized_incremental_binary::do_find_incremental_inputs_section): New
5393 (make_sized_incremental_binary): New function.
5394 (open_incremental_binary): New function.
5395 (can_incrementally_link_file): Add checks if output is ELF and has
5397 * incremental.h: Include "elfcpp_file.h" and "output.h".
5398 (Incremental_binary): New class.
5399 (Sized_incremental_binary): New class.
5400 (open_incremental_binary): Declare.
5401 * object.cc (is_elf_object): Use
5402 elfcpp::Elf_recognizer::is_elf_file.
5403 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
5404 * output.h (Output_file::filesize): New method.
5406 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5408 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
5410 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
5411 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
5413 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
5415 (Arm_relocate_functions::movw_abs_nc): New function.
5416 (Arm_relocate_functions::movt_abs): New function.
5417 (Arm_relocate_functions::thm_movw_abs_nc): New function.
5418 (Arm_relocate_functions::thm_movt_abs): New function.
5419 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
5420 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
5421 (Scan::global): Likewise.
5422 (Relocate::relocate): Likewise.
5423 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
5425 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5427 * arm.cc (Arm_relocate_functions::got_prel) New function.
5428 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
5429 (Relocate::relocate): Likewise.
5430 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
5432 2009-10-06 Ian Lance Taylor <iant@google.com>
5434 * options.h (class General_options): Define
5435 split_stack_adjust_size parameter.
5436 * object.h (class Object): Add uses_split_stack_ and
5437 has_no_split_stack_ fields. Add uses_split_stack and
5438 has_no_split_stack accessor functions. Declare
5439 handle_split_stack_section.
5440 (class Reloc_symbol_changes): Define.
5441 (class Sized_relobj): Define Function_offsets. Declare
5442 split_stack_adjust, split_stack_adjust_reltype, and
5444 * object.cc (Object::handle_split_stack_section): New function.
5445 (Sized_relobj::do_layout): Call handle_split_stack_section.
5446 * dynobj.cc (Sized_dynobj::do_layout): Call
5447 handle_split_stack_section.
5448 * reloc.cc (Sized_relobj::relocate_sections): Call
5449 split_stack_adjust for executable sections in split_stack
5450 objects. Pass reloc_map to relocate_section.
5451 (Sized_relobj::split_stack_adjust): New function.
5452 (Sized_relobj::split_stack_adjust_reltype): New function.
5453 (Sized_relobj::find_functions): New function.
5454 * target-reloc.h: Include "object.h".
5455 (relocate_section): Add reloc_symbol_changes parameter. Change
5457 * target.h (class Target): Add calls_non_split method. Declare
5458 do_calls_non_split virtual method. Declare match_view and
5460 * target.cc: Include "elfcpp.h".
5461 (Target::do_calls_non_split): New function.
5462 (Target::match_view): New function.
5463 (Target::set_view_to_nop): New function.
5464 * gold.cc (queue_middle_tasks): Give an error if mixing
5465 split-stack and non-split-stack objects with -r.
5466 * i386.cc (Target_i386::relocate_section): Add
5467 reloc_symbol_changes parameter.
5468 (Target_i386::do_calls_non_split): New function.
5469 * x86_64.cc (Target_x86_64::relocate_section): Add
5470 reloc_symbol_changes parameter.
5471 (Target_x86_64::do_calls_non_split): New function.
5472 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
5474 * powerpc.cc (Target_powerpc::relocate_section): Add
5475 reloc_symbol_changes parameter.
5476 * sparc.cc (Target_sparc::relocate_section): Add
5477 reloc_symbol_changes parameter.
5478 * configure.ac: Call AM_CONDITIONAL for the default target.
5479 * configure: Rebuild.
5480 * testsuite/Makefile.am (TEST_AS): New variable.
5481 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
5482 (check_DATA): Add split_i386 and split_x86_64 files.
5483 (SPLIT_DEFSYMS): Define.
5484 (split_i386_[1234n].o): New targets.
5485 (split_i386_[124]): New targets.
5486 (split_i386_[1234r].stdout): New targets.
5487 (split_x86_64_[1234n].o): New targets.
5488 (split_x86_64_[124]): New targets.
5489 (split_x86_64_[1234r].stdout): New targets.
5490 (MOSTLYCLEANFILES): Add new executables.
5491 * testsuite/split_i386.sh: New file.
5492 * testsuite/split_x86_64.sh: New file.
5493 * testsuite/split_i386_1.s: New file.
5494 * testsuite/split_i386_2.s: New file.
5495 * testsuite/split_i386_3.s: New file.
5496 * testsuite/split_i386_4.s: New file.
5497 * testsuite/split_i386_n.s: New file.
5498 * testsuite/split_x86_64_1.s: New file.
5499 * testsuite/split_x86_64_2.s: New file.
5500 * testsuite/split_x86_64_3.s: New file.
5501 * testsuite/split_x86_64_4.s: New file.
5502 * testsuite/split_x86_64_n.s: New file.
5503 * testsuite/testfile.cc (Target_test): Update relocation_section
5505 * testsuite/Makefile.in: Rebuild.
5507 2009-10-06 Ian Lance Taylor <iant@google.com>
5509 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
5510 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
5511 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
5512 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
5513 the address on ldo_addrs_.
5514 (Target_i386::Relocate::fix_up_ldo): New function.
5516 2009-10-06 Rafael Espindola <espindola@google.com>
5518 * plugin.cc (add_input_library): New.
5519 (Plugin::load): Add add_input_library to tv.
5520 (Plugin_manager::add_input_file): Add the is_lib argument.
5521 (add_input_file): Update call to Plugin_manager::add_input_file.
5522 (add_input_library): New.
5523 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
5525 2009-09-30 Doug Kwan <dougkwan@google.com>
5527 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
5528 symbol and call Symbol::may_need_copy_reloc to determine if
5529 a copy reloc is needed.
5530 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
5531 nocopyreloc is given in command line.
5532 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
5533 given in command line.
5534 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
5535 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
5536 of the removed Target_i386::may_need_copy_reloc.
5537 * options.h (copyreloc): New option with default value false.
5538 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
5539 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
5540 instead of the removed Target_powerpc::may_need_copy_reloc.
5541 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
5542 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
5543 instead of the removed Target_sparc::may_need_copy_reloc.
5544 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
5545 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
5546 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
5547 instead of the removed Target_x86_64::may_need_copy_reloc.
5549 2009-09-30 Ian Lance Taylor <iant@google.com>
5551 * object.h (class Object): Remove target_ field, and target,
5552 sized_target, and set_target methods.
5553 (Object::sized_target): Remove.
5554 (class Sized_relobj): Update declarations. Remove sized_target.
5555 * object.cc (Sized_relobj::setup): Remove target parameter.
5557 (Input_objects::add_object): Don't do anything with the target.
5558 (make_elf_sized_object): Add punconfigured parameter. Change all
5559 callers. Set or test parameter target.
5560 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
5562 * parameters.cc (Parameters::set_target): Change parameter type to
5564 (Parameters::default_target): Remove.
5565 (set_parameters_target): Change parameter type to be non-const.
5566 (parameters_force_valid_target): New function.
5567 (parameters_clear_target): New function.
5568 * parameters.h (class Parameters): Update declarations. Remove
5569 default_target method. Add sized_target and clear_target
5570 methods. Change target_ to be non-const.
5571 (set_parameters_target): Update declaration.
5572 (parameters_force_valid_target): Declare.
5573 (parameters_clear_target): Declare.
5574 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
5575 as NULL if we aren't searching.
5576 (Add_symbols::run): Don't check for compatible target.
5577 * fileread.cc (Input_file::open_binary): Call
5578 parameters_force_valid_target.
5579 * gold.cc (queue_middle_tasks): Likewise.
5580 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
5581 set_target on object.
5582 * dynobj.h (class Sized_dynobj): Update declarations.
5583 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
5584 make_elf_object returns NULL.
5585 (Archive::include_member): Don't check whether object target is
5587 * output.cc (Output_section::add_input_section): Get target from
5589 (Output_section::relax_input_section): Likewise.
5590 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
5592 (Sized_relobj::do_scan_relocs): Likewise.
5593 (Sized_relobj::relocate_sections): Likewise.
5594 * resolve.cc (Symbol_table::resolve): Likewise.
5595 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
5596 parameter. Change all callers.
5597 (Symbol_table::add_from_object): Get target from parameters.
5598 (Symbol_table::add_from_relobj): Don't check object target.
5599 (Symbol_table::add_from_dynobj): Likewise.
5600 (Symbol_table::define_special_symbol): Get target from
5602 * symtab.h (class Symbol_table): Update declaration.
5603 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
5604 parameter. Change all callers. Clear parameter target.
5605 (Binary_test): Test target here.
5606 * testsuite/object_unittest.cc (gold_testsuite): Remove
5607 target_test_pointer parameter. Change all callers.
5608 (Object_test): Test target here.
5610 2009-09-26 Ian Lance Taylor <iant@google.com>
5612 * testsuite/initpri1.c: Don't try to use constructor priorities if
5613 compiling with gcc before 4.3.
5615 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
5617 * testsuite/retain_symbols_file_test.sh (check_present): Change
5618 output file name to retain_symbols_file_test.stdout.
5619 (check_absent): Likewise.
5621 2009-09-18 Craig Silverstein <csilvers@google.com>
5623 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
5624 * options.cc: Include <cerrno> and <fstream>.
5625 (General_options::finalize): Parse -retain-symbols-file tag.
5626 * options.h: New flag.
5627 (General_options): New method should_retain_symbol, new
5628 variable symbols_to_retain.
5629 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
5630 should_retain_symbol map.
5631 * testsuite/Makefile.am (retain_symbols_file_test): New test.
5632 * testsuite/Makefile.in: Regenerate.
5633 * testsuite/retain_symbols_file_test.sh: New file.
5635 2009-09-18 Nick Clifton <nickc@redhat.com>
5637 * po/es.po: Updated Spanish translation.
5639 2009-09-17 Doug Kwan <dougkwan@google.com>
5641 * debug.h (DEBUG_RELAXATION): New constant.
5642 (DEBUG_ALL): Add DEBUG_RELAXATION.
5643 (debug_string_to_enum): Add relaxation debug option.
5645 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
5646 Layout::Relaxation_debug_check::read_sections,
5647 Layout::Relaxation_debug_check::read_sections): New method definitions.
5648 (Layout::Layout): Initialize data members
5649 record_output_section_data_from_scrips_,
5650 script_output_section_data_list_ and relaxation_debug_check_.
5651 (Layout::save_segments, Layout::restore_segments,
5652 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
5653 Layout::relaxation_loop_body): New method definitions.
5654 (Layout::finalize): Support relaxation. Move section layout code to
5655 Layout::relaxation_loop_body.
5656 (Layout::set_asection_address_from_script): Move code for orphan
5657 section placement out.
5658 (Layout::place_orphan_sections_in_script): New method definition.
5659 * layout.h (Output_segment_headers, Output_file_header):
5660 New forward class declarations.
5661 (Layout::~Layout): Define.
5662 (Layout::new_output_section_data_from_script): New method definition.
5663 (Layout::place_orphan_sections_in_script): New method declaration.
5664 (Layout::Segment_states): New type declaration.
5665 (Layout::save_segments, Layout::restore_segments,
5666 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
5667 Layout::relaxation_loop_body): New method declarations.
5668 (Layout::Output_section_data_list): New type declaration.
5669 (Layout::Relaxation_debug_check): New class definition.
5670 (Layout::record_output_section_data_from_script_,
5671 Layout::script_output_section_data_list_, Layout::segment_states_,
5672 Layout::relaxation_debug_check_): New data members.
5673 * output.cc: (Output_section_headers::do_size): New method definition.
5674 (Output_section_headers::Output_section_headers): Move size
5675 computation to Output_section_headers::do_size.
5676 (Output_segment_headers::do_size): New method definition.
5677 (Output_file_header::Output_file_header): Move size computation to
5678 Output_file_header::do_size and call it.
5679 (Output_file_header::do_size): New method definition.
5680 (Output_data_group::Output_data_group): Adjust call to
5681 Output_section_data.
5682 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
5683 (Output_symtab_xindex::do_write): Add array bound check.
5684 (Output_section::Input_section::print_to_mapfile): Handle
5685 RELAXED_INPUT_SECTION_CODE.
5686 (Output_section::Output_section): Initialize data member checkpoint_.
5687 (Output_section::~Output_section): Delete checkpoint object pointed
5689 (Output_section::add_input_section): Always add an Input_section if
5691 (Output_section::add_merge_input_section): Add assert.
5692 (Output_section::relax_input_section): New method definition.
5693 (Output_section::set_final_data_size): Set load address to zero for
5694 an unallocated section.
5695 (Output_section::do_address_and_file_offset_have_reset_values):
5696 New method definition.
5697 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
5698 Handle relaxed input section.
5699 (Output_section::sort_attached_input_sections): Checkpoint input
5700 section list lazily.
5701 (Output_section::get_input_sections): Change type of input_sections to
5702 list of Simple_input_section pointers. Checkpoint input section list
5703 lazily. Also handle relaxed input sections.
5704 (Output_section::add_input_section_for_script): Take a reference to
5705 a Simple_input_section object instead of Relobj pointer and section
5706 index as parameter. Handle relaxed input sections.
5707 (Output_section::save_states, Output_section::restore_states): New
5709 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
5710 (Output_data::is_data_size_fixed): New method definition.
5711 (Output_data::reset_addresss_and_file_offset): Do not reset data size
5713 (Output_data::address_and_file_offset_have_reset_values): New method
5715 (Output_data::do_address_and_file_offset_have_reset_values): New method
5717 (Output_data::set_data_size): Check that data size is not fixed.
5718 (Output_data::fix_data_size): New method definition.
5719 (Output_data::is_data_size_fixed_): New data member.
5720 (Output_section_headers::set_final_data_size): New method definition.
5721 (Output_section_headers::do_size): New method declaration.
5722 (Output_segment_headers::set_final_data_size): New method definition.
5723 (Output_segment_headers::do_size): New method declaration.
5724 (Output_file_header::set_final_data_size)::New method definition.
5725 (Output_file_header::do_size)::New method declaration.
5726 (Output_section_data::Output_section_data): Add new parameter
5727 is_data_size_fixed and use it to fix data size.
5728 (Output_data_const::Output_data_const): Adjust call to base class
5729 constructor and fix data size.
5730 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
5731 base class constructor and fix data size.
5732 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
5733 base class constructor and fix data size.
5734 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
5735 class constructor and fix data size.
5736 (Output_data_group::set_final_data_size): New method definition.
5737 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
5738 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
5739 class constructor and fix data size.
5740 (Output_relaxed_input_section): New class definition.
5741 (Output_section::Simple_input_section): New class definition.
5742 (Output_section::get_input_sections): Adjust parameter list.
5743 (Output_section::add_input_section_for_script): Same.
5744 (Output_section::save_states, Output_section::restore_states,
5745 Output_section::do_address_and_file_offset_have_reset_values,
5746 (Output_section::Input_section::Input_section): Handle
5747 RELAXED_INPUT_SECTION_CODE. Add new overload for
5748 Output_relaxed_input_section.
5749 (Output_section::Input_section::is_input_section,
5750 Output_section::Input_section::set_output_section): Handle relaxed
5752 (Output_section::Input_section::is_relaxed_input_section,
5753 Output_section::Input_section::output_section_data,
5754 Output_section::Input_section::relaxed_input_section): New method
5756 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
5758 (Output_section::Input_section::u1_): Update comments.
5759 (Output_section::Input_section::u2_): Add new union member poris.
5760 (Output_section::Checkpoint_output_section): New classs definition.
5761 (Output_section::relax_input_section): New method declaration.
5762 (Output_section::checkpoint_): New data member.
5763 (Output_segment): Update comments.
5764 (Output_segment::Output_segment): Un-privatize copy constructor.
5765 (Output_segment::operator=): Un-privatize.
5766 * script-sections.cc (Output_section_element::Input_section_list):
5767 Change element type to Output_section::Simple_input_section.
5768 (Output_section_element_dot_assignment::set_section_addresses):
5769 Register output section data for relaxation clean up.
5770 (Output_data_exression::Output_data_expression): Adjust call to base
5771 constructor to fix data size.
5772 (Output_section_element_data::set_section_addresses): Register
5773 Output_data_expression object for relaxation clean up.
5774 (struct Input_section_info): Replace Relobj pointer and section index
5775 pair with Output_section::Simple_input_section and Convert struct to a
5777 (Input_section_sorter::operator()): Adjust access to
5778 Input_section_info data member to use accessors.
5779 (Output_section_element_input::set_section_addresses): Use layout
5780 parameter. Adjust code to use Output_section::Simple_input_section
5781 and Input_secction_info classes. Register filler for relaxation
5783 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
5784 and section index pair with Output_section::Simple_input_section
5785 class. Adjust code accordingly.
5786 (Phdrs_element::release_segment): New method definition.
5787 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
5789 (Script_sections::release_segments): New method definition.
5790 * gold/script-sections.h (Script_sections::release_segments): New
5792 * gold/target.h (Target::may_relax, Target::relax,
5793 Target::do_may_relax, Target::do_relax): New method definitions.
5795 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5797 * arm.cc (has_signed_unsigned_overflow): New function.
5798 (Arm_relocate_functions::abs8): New function.
5799 (Target_arm::Scan::local): Handle R_ARM_ABS8.
5800 (Target_arm::Scan::global): Likewise.
5801 (Target_arm::relocate::relocate): Likewise.
5802 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5805 2009-09-16 Cary Coutant <ccoutant@google.com>
5807 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
5808 * testsuite/Makefile.in: Regenerate.
5810 2009-09-11 Nick Clifton <nickc@redhat.com>
5812 * po/gold.pot: Updated by the Translation project.
5814 2009-09-08 Cary Coutant <ccoutant@google.com>
5816 * output.cc (Output_file::open): Add execute permission to empty file.
5817 * testsuite/Makefile.am (permission_test): New test.
5818 * testsuite/Makefile.in: Regenerate.
5820 2009-09-02 Ian Lance Taylor <iant@google.com>
5822 * output.cc (Output_file::resize): Call map_no_anonymous rather
5825 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
5827 * gold.cc: Include "incremental.h".
5828 (queue_initial_tasks): Call Incremental_checker methods.
5829 * incremental.cc: Include "output.h".
5830 (Incremental_checker::can_incrementally_link_output_file): New
5832 * incremental.h (Incremental_checker): New class.
5834 * output.cc (Output_file::open_for_modification): New method.
5835 (Output_file::map_anonymous): Changed return type to bool. Record
5837 (Output_file::map_no_anonymous): New method, broken out of map.
5838 (Output_file::map): Use map_no_anonymous and map_anonymous.
5839 * output.h (class Output_file): Update declarations.
5841 2009-08-24 Cary Coutant <ccoutant@google.com>
5843 * options.h (Command_line::Pre_options): New class.
5844 (Command_line::pre_options): New member.
5845 * options.cc (gold::options::ready_to_register): New variable.
5846 (One_option::register_option): Do nothing if not registering options.
5847 Assert if same short option registered twice.
5848 (General_options::General_options): Turn off option registration when
5850 (Command_line::Pre_options::Pre_options): New constructor.
5852 2009-08-24 Cary Coutant <ccoutant@google.com>
5854 * options.h (General_options::no_keep_memory): Remove incorrect
5857 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5859 * Makefile.am (am__skiplex, am__skipyacc): New.
5860 * Makefile.in: Regenerate.
5862 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5864 * Makefile.am (AM_CPPFLAGS): Renamed from ...
5865 (INCLUDES): ... this.
5866 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
5867 (AM_CPPFLAGS): Renamed from ...
5868 (INCLUDE): ... this.
5869 * Makefile.in, testsuite/Makefile.in: Regenerate.
5871 * Makefile.in: Regenerate.
5872 * aclocal.m4: Likewise.
5873 * config.in: Likewise.
5874 * configure: Likewise.
5875 * testsuite/Makefile.in: Likewise.
5877 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
5878 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
5879 * Makefile.in: Regenerate.
5880 * testsuite/Makefile.in: Regenerate.
5882 2009-08-19 Cary Coutant <ccoutant@google.com>
5884 * resolve.cc (Symbol_table::resolve): Don't complain about defined
5885 symbols in shared libraries overridden by hidden or internal symbols
5886 in the main program.
5888 2009-08-19 Chris Demetriou <cgd@google.com>
5890 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
5891 checking source file names in error messages.
5893 2009-08-18 Doug Kwan <dougkwan@google.com>
5895 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
5896 an elcpp::Ehdr as parameter. Adjust call to set_target.
5897 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
5898 an elfcpp::Ehdr as parameter.
5899 * object.cc (Object::set_target): Remove the version that looks up
5900 a target and sets it.
5901 (Sized_relobj::setup): Take a Target object instead of
5902 an elfcpp::Ehdr as parameter. Adjust call to set_target.
5903 (make_elf_sized_object): Find target and ask target to
5905 * object.h: (Object::set_target): Remove the version that looks up
5906 a target and sets it.
5907 (Sized_relobj::setup): Take a Target object instead of
5908 an elfcpp:Ehdr as parameter.
5909 * target.cc: Include dynobj.h.
5910 (Target::do_make_elf_object_implementation): New.
5911 (Target::do_make_elf_object): New.
5912 * target.h (Target::make_elf_object): New template declaration.
5913 (Target::do_make_elf_object): New method declarations.
5914 (Target::do_make_elf_object_implementation): New template declaration.
5916 2009-08-14 Ian Lance Taylor <iant@google.com>
5918 * gold.h (FUNCTION_NAME): Define.
5919 (gold_unreachable): Use FUNCTION_NAME.
5921 2009-08-12 Sriraman Tallam <tmsriram@google.com>
5923 * icf.cc (Icf::find_identical_sections): Issue a warning when a
5924 symbol in the --keep-unique list is not found.
5926 2009-08-12 Sriraman Tallam <tmsriram@google.com>
5928 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
5929 been maked as --keep-unique.
5930 (Icf::unfold_section): New function.
5931 * icf.h (Icf::unfold_section): New function.
5932 * options.h (General_options::keep_unique): New option.
5933 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
5934 * testsuite/Makefile.in: Regenerate.
5935 * testsuite/icf_keep_unique_test.sh: New file.
5936 * testsuite/icf_keep_unique_test.cc: New file.
5938 2009-08-12 Cary Coutant <ccoutant@google.com>
5941 * resolve.cc (Symbol_table::resolve): Check for references from
5942 dynamic objects to hidden and internal symbols.
5943 * testsuite/Makefile.am (hidden_test.sh): New test.
5944 * testsuite/Makefile.in: Regenerate.
5945 * testsuite/hidden_test.sh: New script.
5946 * testsuite/hidden_test_1.c: New test source.
5947 * testsuite/hidden_test_main.c: New test source.
5949 2009-08-11 Doug Kwan <dougkwan@google.com>
5951 * arm.cc: Update comments.
5952 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
5953 segment to locate the .ARM.exidx section if present.
5955 2009-08-09 Doug Kwan <dougkwan@google.com>
5957 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
5960 2009-08-07 Sriraman Tallam <tmsriram@google.com>
5961 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
5964 2009-08-06 Sriraman Tallam <tmsriram@google.com>
5966 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
5967 valid tls_segment only for non-debug-section relocations.
5968 * testsuite/Makefile.am: Add gc_tls_test.
5969 * testsuite/Makefile.in: Regenerate.
5970 * testsuite/gc_tls_test.cc: New file.
5971 * testsuite/gc_tls_test.sh: New file.
5973 2009-08-05 Sriraman Tallam <tmsriram@google.com>
5977 * Makefile.am (CCFILES): Add icf.cc.
5979 * Makefile.in: Regenerate.
5980 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
5981 * gc.h (gc_process_relocs): Populate lists used by icf to contain
5982 section, symbol and addend information for the relocs.
5983 * gold.cc (queue_middle_tasks): Call identical code folding.
5984 * gold.h: Add defines for multimap.
5985 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
5986 to the call of finalize_local_symbols.
5987 * main.cc (main): Create object of class Icf.
5988 * object.cc (Sized_relobj::do_layout): Allow this function to be
5989 called twice during icf.
5990 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
5991 to sections marked as identical by icf.
5992 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
5994 (Sized_relobj::do_section_entsize): New function.
5995 * object.h (Object::section_entsize): New function.
5996 (Object::do_section_entsize): New pure virtual function.
5997 (Relobj::finalize_local_symbols): Add new parameter.
5998 (Relobj::do_section_entsize): New function.
5999 * options.h (General_options::icf): New option.
6000 (General_options::icf_iterations): New option.
6001 (General_options::print_icf_sections): New option.
6002 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
6003 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
6004 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
6006 * symtab.cc (Symbol_table::is_section_folded): New function.
6007 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
6008 to sections marked as identical by icf.
6009 * symtab.h (Symbol_table::set_icf): New function.
6010 (Symbol_table::icf): New function.
6011 (Symbol_table::is_section_folded): New function.
6012 (Symbol_table::icf_): New data member.
6013 * target-reloc.h (relocate_section): Ignore sections folded by icf.
6014 * testsuite/Makefile.am: Add commands to build icf_test.
6015 * testsuite/Makefile.in: Regenerate.
6016 * testsuite/icf_test.sh: New file.
6017 * testsuite/icf_test.cc: New file.
6019 2009-07-24 Chris Demetriou <cgd@google.com>
6021 * layout.cc (is_compressible_debug_section): Fix incorrect
6022 comment about compressed section names.
6024 2009-07-20 Ian Lance Taylor <ian@airs.com>
6027 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
6029 2009-07-16 Ian Lance Taylor <iant@google.com>
6032 * layout.h: #include <map>.
6033 (class Kept_section): Change from struct to class. Add accessors
6034 and setters. Add section size to Comdat_group mapping. Change
6035 Comdat_group to std::map. Add is_comdat_ field. Add
6036 linkonce_size field in union.
6037 (class Layout): Update declaration of find_or_add_kept_section.
6038 Don't declare find_kept_object.
6039 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
6040 parameter. Add object, shndx, is_comdat, and is_group_name
6041 parameters. Change all callers. Adjust for new Kept_section.
6042 (Layout::find_kept_object): Remove.
6043 * object.cc (Sized_relobj::include_section_group): Update use of
6044 Kept_section. Rename secnum to shndx. Only record
6045 Kept_comdat_section if sections are the same size.
6046 (Sized_relobj::include_linkonce_section): Update use of
6047 Kept_section. Only record Kept_comdat_section if sections are the
6048 same size. Set size of linkonce section.
6049 (Sized_relobj::map_to_kept_section): Update call to
6050 get_kept_comdat_section.
6051 * object.h (class Sized_relobj): Rename fields in
6052 Kept_comdat_section to drop trailing underscores; change object
6053 field to Relobj*. Change Kept_comdat_section_table to store
6054 struct rather than pointer.
6055 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
6056 Add kept_object and kept_shndx parameters. Change all callers.
6057 (Sized_relobj::get_kept_comdat_section): Change return type to
6058 bool. Add kept_object and kept_shndx parameters. Change all
6060 * plugin.cc (Pluginobj::include_comdat_group): Update call to
6061 Layout::find_or_add_kept_section.
6063 2009-07-09 Ian Lance Taylor <iant@google.com>
6065 * merge.cc (Object_merge_map::initialize_input_to_output_map):
6066 Reserve space in the hash table.
6068 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
6070 * fileread.cc (File_read::get_mtime): New method.
6071 * fileread.h (Timespec): New structure.
6072 (File_read::get_mtime): New method.
6073 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
6074 Renamed from timestamp_nsec.
6075 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
6077 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
6079 (Incremental_inputs::report_archive): Save mtime; style fix.
6080 (Incremental_inputs::report_obejct): Save mtime; style fix.
6081 (Incremental_inputs::report_script): Save mtime; style fix.
6082 (Incremental_inputs::finalize_inputs): Style fix.
6083 (Incremental_inputs::finalize): Style fix.
6084 (Incremental_inputs::create_input_section_data): Store inputs
6086 * incremental.h (Incremental_inputs::report_script): Add mtime
6088 (Incremental_inputs::Input_info::Input_info): Intialize only one
6090 (Incremental_inputs::Input_info::archive): Move to nameless
6092 (Incremental_inputs::Input_info::obejct): Move to nameless union.
6093 (Incremental_inputs::Input_info::script): Move to nameless union.
6094 (Incremental_inputs::mtime): New field.
6095 * script.cc (read_input_script): Pass file mtime to
6097 * script.h (Script_info::inputs): Style fix.
6099 2009-07-01 Ian Lance Taylor <ian@airs.com>
6101 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
6104 2009-06-24 Ian Lance Taylor <iant@google.com>
6107 * layout.cc (Layout::choose_output_section): If we find an
6108 existing section, update the flags.
6109 (Layout::create_notes): New function, broken out of
6111 (Layout::finalize): Don't create note sections.
6112 (Layout::create_note): Don't crash if linker script discards
6114 (Layout::create_gold_note): Likewise.
6115 (Layout::create_build_id): Likewise. Don't set
6116 after_input_sections on the section.
6117 (Layout::create_executable_stack_info): Remove target parameter.
6119 * layout.h (class Layout): Declare create_notes. Update
6120 declaration of create_executable_stack_info.
6121 * gold.cc (queue_middle_tasks): Call create_notes.
6122 * output.cc (Output_section::update_flags_for_input_section): Move
6123 here from output.h. If SHF_ALLOC flag is newly set, mark address
6125 * output.h (Output_data::mark_address_invalid): New function.
6126 (class Output_section): Only declare, not define,
6127 update_flags_for_input_section. Remove set_flags.
6129 2009-06-24 Ian Lance Taylor <iant@google.com>
6131 * script-sections.cc (Output_section_definition::
6132 set_section_addresses): Rename shadowing local load_address to
6135 2009-06-24 Ian Lance Taylor <iant@google.com>
6138 * reloc.cc (relocate_sections): Skip empty relocation sections.
6140 2009-06-23 Ian Lance Taylor <iant@google.com>
6143 * layout.cc (Layout::create_note): Use choose_output_section
6144 rather than make_output_section.
6146 2009-06-23 Ian Lance Taylor <iant@google.com>
6149 * options.cc (General_options::parse_V): Set printed_version_.
6150 (General_options::General_options): Initialize printed_version_.
6151 * options.h (class General_options): Add printed_version_ field.
6152 * gold.cc (queue_initial_tasks): If there are no input files,
6153 don't give a fatal error if we printed the version information.
6154 (queue_middle_tasks): If using -r with a shared object, give a
6155 fatal error rather than an ordinary error.
6157 2009-06-23 Ian Lance Taylor <iant@google.com>
6160 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
6161 (Layout::make_output_section): Set have_stabstr_section_ if we see
6162 a .stab*str section.
6163 (Layout::finalize): Call link_stabs_sections.
6164 (Layout::link_stabs_sections): New file.
6165 * layout.h (class Layout): Add have_stabstr_section_ field.
6166 Declare link_stabs_sections.
6168 2009-06-23 Doug Kwan <dougkwan@google.com>
6170 * Makefile.am (libgold_a_LIBADD): New.
6171 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
6172 * Makefile.in: Regenerate.
6173 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
6174 * configure: Regenerate.
6175 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
6176 * fileread.cc: Include sys/state.h
6177 * gold.h: Declare memmem and strndup if found missing.
6178 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
6180 2009-06-23 Ian Lance Taylor <iant@google.com>
6182 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
6183 * configure: Rebuild.
6185 2009-06-23 Ian Lance Taylor <iant@google.com>
6188 * object.cc (Object::section_contents): Don't try to get a view if
6189 the section has length zero.
6190 (Object::handle_gnu_warning_section): If the section is empty, use
6191 the name of the section as the warning.
6193 2009-06-23 Ian Lance Taylor <iant@google.com>
6196 * stringpool.h (class Stringpool_template): Add optimize_ field.
6197 (Stringpool_template::set_optimize): New function.
6198 * stringpool.cc (Stringpool_template::Stringpool_template):
6199 Initialize optimize_ field.
6200 (Stringpool_template::set_string_offsets): Test local optimize
6201 fild rather than parameter.
6202 * layout.cc (Layout::Layout): Call set_optimize on the section
6205 2009-06-22 Ian Lance Taylor <iant@google.com>
6208 * yyscript.y: Parse TARGET.
6209 * script.cc (script_set_target): New function.
6210 * script-c.h (script_set_target): Declare.
6211 * options.cc (General_options::string_to_object_format): Rename
6212 from string_to_object_format in anonymous namespace. Change
6214 * options.h (class General_options): Declare
6215 string_to_object_format.
6217 2009-06-22 Ian Lance Taylor <iant@google.com>
6219 * script-sections.cc (Script_sections::create_segments): Don't put
6220 program headers in a PT_LOAD segment if -n or -N.
6222 2009-06-22 Ian Lance Taylor <iant@google.com>
6225 * options.h (class General_options): Add -z lazy and -z now. Sort
6226 -z options into alphabetical order.
6227 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
6229 2009-06-21 Ian Lance Taylor <iant@google.com>
6231 * layout.cc (Layout::make_output_section): Call
6232 Target::new_output_section.
6233 (Layout::attach_allocated_section_to_segment): Put large section
6234 sections in a separate load segment with the large segment flag
6236 (Layout::segment_precedes): Sort large data segments after other
6238 (align_file_offset): New static function.
6239 (Layout::set_segment_offsets): Use align_file_offset.
6240 * output.h (class Output_section): Add is_small_section_ and
6241 is_large_section_ fields.
6242 (Output_section::is_small_section): New function.
6243 (Output_section::set_is_small_section): New function.
6244 (Output_section::is_large_section): New function.
6245 (Output_section::set_is_large_section): New function.
6246 (Output_section::is_large_data_section): New function.
6247 (class Output_segment): Add is_large_data_segment_ field.
6248 (Output_segment::is_large_data_segment): New function.
6249 (Output_segment::set_is_large_data_segment): New function.
6250 * output.cc (Output_section::Output_section): Initialize new
6252 (Output_segment::Output_segment): Likewise.
6253 (Output_segment::add_output_section): Add assertion that large
6254 data sections always go in large data segments. Force small data
6255 sections to the end of the list of data sections. Force small BSS
6256 sections to the start of the list of BSS sections. For large BSS
6257 sections to the end of the list of BSS sections.
6258 * symtab.h (class Symbol): Declare is_common_shndx.
6259 (Symbol::is_defined): Check Symbol::is_common_shndx.
6260 (Symbol::is_common): Likewise.
6261 (class Symbol_table): Define enum Commons_section_type. Update
6262 declarations. Add small_commons_ and large_commons_ fields.
6263 * symtab.cc (Symbol::is_common_shndx): New function.
6264 (Symbol_table::Symbol_table): Initialize new fields.
6265 (Symbol_table::add_from_object): Put small and large common
6266 symbols in the right list.
6267 (Symbol_table::sized_finalized_symbol): Check
6268 Symbol::is_common_shndx.
6269 (Symbol_table::sized_write_globals): Likewise.
6270 * common.cc (Symbol_table::do_allocate_commons): Allocate new
6271 common symbol lists. Don't call do_allocate_commons_list if the
6273 (Symbol_table::do_allocate_commons_list): Remove is_tls
6274 parameter. Add comons_section_type parameter. Change all
6275 callers. Handle small and large common symbols.
6276 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
6277 Symbol::is_common_shndx.
6278 * resolve.cc (symbol_to_bits): Likewise.
6279 * target.h (Target::small_common_shndx): New function.
6280 (Target::small_common_section_flags): New function.
6281 (Target::large_common_shndx): New function.
6282 (Target::large_common_section_flags): New function.
6283 (Target::new_output_section): New function.
6284 (Target::Target_info): Add small_common_shndx, large_common_shndx,
6285 small_common_section_flags, and large_common_section_flags
6287 (Target::do_new_output_section): New virtual function.
6288 * arm.cc (Target_arm::arm_info): Initialize new fields.
6289 * i386.cc (Target_i386::i386_info): Likewise.
6290 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
6292 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
6293 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
6294 (Target_x86_64::do_new_output_section): New function.
6295 * configure.ac: Define conditional MCMODEL_MEDIUM.
6296 * testsuite/Makefile.am (check_PROGRAMS): Add large.
6297 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
6298 (large_LDFLAGS): Define.
6299 * testsuite/large.c: New file.
6300 * testsuite/testfile.cc (Target_test::test_target_info):
6301 Initialize new fields.
6302 * configure, testsuite/Makefile.in: Rebuild.
6304 2009-06-05 Doug Kwan <dougkwan@google.com>
6306 * Makefile.am (CCFILES): Add target.cc.
6307 * Makefile.in: Regenerate.
6308 * i386.cc (class Target_i386): Define new virtual method to
6309 override do_is_local_label_name in parent.
6310 * object.cc (Sized_relobj::do_count_local_symbols): Discard
6311 local symbols if --discard-locals or -X is given.
6312 * options.h (class General_options): Declare new options
6313 '--discard-locals' and '-X' for discarding locals.
6314 * target.h (class Target): Define new methods is_local_label_name.
6315 Declare new virtual method do_is_local_label_name.
6316 * target.cc: New file.
6317 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
6318 (check_SCRIPTS): Add discard_locals_test.sh.
6319 (check_DATA): Add discard_local_tests.syms.
6320 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
6321 (discard_local_tests.syms, discard_locals_test.o): New make rules.
6322 * testsuite/Makefile.in: Regenerate.
6323 * testsuite/discard_locals_test.c: New file.
6324 * testsuite/discard_locals_test.sh: Same.
6326 2009-06-05 Doug Kwan <dougkwan@google.com>
6328 * object.cc (Sized_relobj::Sized_relobj): Initialize
6329 discarded_eh_frame_shndx_ to -1U.
6330 (Sized_relobj::do_layout): Record index of a discard .eh_frame
6332 (Sized_relobj::do_count_local_symbols): Skip local symbols in
6333 a discarded .eh_frame section.
6334 (Sized_relobj::do_finalize_local_symbols): Ditto.
6335 * object.h (class Sized_relobj): Declare new member
6336 discarded_eh_frame_shndx_.
6337 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
6338 (local_labels_test.o, local_labels_test): New rules.
6339 * testsuite/Makefile.in: Regenerate.
6341 2009-06-04 Doug Kwan <dougkwan@google.com>
6343 * layout.cc (Layout::section_name_mapping): Add mapping for
6344 special ARM sections.
6346 2009-06-03 Doug Kwan <dougkwan@google.com>
6348 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
6349 (utils::has_overflow): Same.
6351 2009-06-03 Ian Lance Taylor <iant@google.com>
6353 * layout.cc (Layout::section_name_mapping): New array, replacing
6354 Layout::linkonce_mapping.
6355 (Layout::section_name_mapping_count): New variable, replacing
6356 Layout::linkonce_mapping_count.
6357 (Layout::linkonce_output_name): Remove.
6358 (Layout::output_section_name): Rewrite.
6359 * layout.h (class Layout): Rename Linkonce_mapping to
6360 Section_name_mapping, linkonce_mapping to section_name_mapping,
6361 linkonce_mapping_count to section_name_mapping_count. Don't
6362 declare linkonce_output_name.
6364 2009-06-03 Doug Kwan <dougkwan@google.com>
6366 * gold/arm.cc (namespace utils): New.
6367 (Target_arm::reloc_is_non_pic): Define new method.
6368 (class Arm_relocate_functions): New.
6369 (Target_arm::Relocate::relocate): Handle relocation types used by
6372 2009-06-03 Ian Lance Taylor <iant@google.com>
6374 * arm.cc (Target_arm::scan::global): Use || instead of |.
6376 2009-06-02 Doug Kwan <dougkwan@google.com>
6378 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
6379 issued_non_pic_error_.
6380 (class Target_arm::Scan): Declare new method check_non_pic.
6381 Define new method symbol_needs_plt_entry.
6382 Declare new data member issued_non_pic_error_.
6383 (class Target_arm::Relocate): Declare new method
6384 should_apply_static_reloc.
6385 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
6386 (Target_arm::Scan::check_non_pic): Define new method.
6387 (Target_arm::Scan::local): Handle a small subset of reloc types used
6389 (Target_arm::Scan::local): Same.
6390 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
6392 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
6394 * incremental.cc (Incremental_inputs::report_command_line): Filter
6395 out --incremental-* options.
6397 2009-05-29 Doug Kwan <dougkwan@google.com>
6399 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
6401 (class Target_arm): Update comment.
6402 (Target_arm::Target_arm): Initialize new data members GOT_,
6403 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
6404 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
6405 and Target_arm::rel_dyn_section.
6406 Declare new_enum Target_arm::Got_type.
6407 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
6409 Update commments for member do_dynsym_value.
6410 (Target_arm::got_size, Target_arm::plt_section,
6411 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
6412 new methods inside class defintion.
6413 (Target_arm::got_section): Define new method.
6414 (Target_arm::rel_dyn_section): Same.
6415 (Output_data_plt_arm): New template class.
6416 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
6417 (Output_data_plt_arm:do_adjust_output_section): Define new method.
6418 (Output_data_plt_arm::add_entry): Same.
6419 (Output_data_plt_arm::first_plt_entry): Define new
6420 static data member for PLT instruction template.
6421 (Output_data_plt_arm::plt_entry): Same.
6422 (Output_data_plt_arm::do_write): Define new method.
6423 (Target_arm::make_plt_entry): Same.
6424 (Target_arm::do_finalize_sections): Same.
6425 (Target_arm::do_dynsym_value): Same.
6427 2009-05-28 Doug Kwan <dougkwan@google.com>
6429 * Makefile.am (TARGETSOURCES): Add arm.cc.
6430 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
6431 * Makefile.in: Regenerate.
6433 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
6435 2009-05-26 Doug Kwan <dougkwan@google.com>
6437 * options.cc (General_options::parse_exclude_libs). Fix a comment.
6438 (General_options::check_excluded_libs): Strip off directories in
6439 archive name before matching like GNU ld does.
6440 * testsuite/Makefile.am (MOSTLYCLEANFILES,
6441 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
6442 (exclude_libs_test_LDFLAGS): Add linker option
6443 -Wl,--exclude-libs,libexclude_libs_test_3
6444 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
6445 an explicit archive without using -l.
6446 (alt/libexclude_libs_test_3.a): New make rule.
6447 * testsuite/Makefile.in: Regenerate.
6448 * testsuite/exclude_libs_test.c : Declare lib3_default().
6450 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
6451 * exclude_libs_test_3.c: New file.
6453 2009-05-26 Nick Clifton <nickc@redhat.com>
6455 * po/id.po: New Indonesian translation.
6456 * po/gold.pot: Updated template file.
6458 2009-05-22 Sriraman Tallam <tmsriram@google.com>
6460 * testsuite/Makefile.am: Add -ffunction-sections to compile
6461 gc_comdat_test files. Add -Wl,--gc-sections to build
6463 * testsuite/Makefile.in: Regenerate.
6464 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
6466 2009-05-21 Sriraman Tallam <tmsriram@google.com>
6468 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
6469 kept comdat section was garbage collected.
6470 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
6471 * testsuite/Makefile.in: Regenerate.
6472 * testsuite/gc_comdat_test.sh: New file.
6473 * testsuite/gc_comdat_test_1.cc: New file.
6474 * testsuite/gc_comdat_test_2.cc: New file.
6476 2009-05-19 Doug Kwan <dougkwan@google.com>
6478 * archive.cc (Archive::Archive): Move constructor from archive.h
6479 to here. Initialize no_export_.
6480 (Archive::get_elf_object_for_member): Set no_export flag of object.
6481 * archive.h (Archive::Archive): Move constructor body to
6483 (Archive::no_export): New method.
6484 (Archive::no_export_): New field.
6485 * object.h (Object::Object): Initialize no_export_ to false.
6486 (Object::no_export, Object::set_no_export): New methods.
6487 (Object::no_export_): New field.
6488 * options.cc (General_options::parse_exclude_libs): New method.
6489 (General_options::check_excluded_libs) Same.
6490 * options.h (exclude_libs): New option.
6491 (General_options::check_excluded_libs): New method declaration.
6492 (General_options::excluded_libs_): New field.
6493 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
6494 default or protected visibility if an object has no-export flag set.
6495 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
6496 (check_SCRIPTS): Add exclude_libs_test.sh.
6497 (check_DATA): Add exclude_libs_test.syms.
6498 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
6499 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
6500 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
6501 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
6502 (exclude_libs_test.syms, libexclude_libs_test_1.a,
6503 libexclude_libs_test_2.a): New rules.
6504 * testsuite/Makefile.in: Regenerate.
6505 * testsuite/exclude_libs_test.c: New file.
6506 * testsuite/exclude_libs_test.sh: Ditto.
6507 * testsuite/exclude_libs_test_1.c: Ditto.
6508 * testsuite/exclude_libs_test_2.c: Ditto.
6510 2009-05-15 Ian Lance Taylor <iant@google.com>
6512 * configure.ac: Check for declarations for cases where libiberty.h
6513 checks HAVE_DECL_xxx.
6514 * configure, config.in: Rebuild.
6516 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
6518 * gold.h (Incremental_argument_list): Remove (invalid) forward
6520 * incremental.cc (Incremental_inputs::report_achive): New method.
6521 (Incremental_inputs::report_object): New method.
6522 (Incremental_inputs::report_script): New method.
6523 (Incremental_inputs::finalize_inputs): New method.
6524 (Incremental_inputs::finalize): Call finalize_inputs().
6525 (Incremental_inputs::sized_create_incremental_inputs_section_data):
6526 Create inputs entries.
6527 * incremental.h (Incremental_input_type): New enum.
6528 (Incremental_inputs::Incremental_input): Initialize new fields.
6529 (Incremental_inputs::report_inputs): New method.
6530 (Incremental_inputs::report_achive): New method.
6531 (Incremental_inputs::report_object): New method.
6532 (Incremental_inputs::report_script): New method.
6533 (Incremental_inputs::finalize_inputs): New method.
6534 (Incremental_inputs::Input_info): New struct.
6535 (Incremental_inputs::Input_info_map): New typedef.
6536 (Incremental_inputs::lock_): New field.
6537 (Incremental_inputs::Inputs_): New field.
6538 (Incremental_inputs::Inputs_map): New field.
6539 * main.cc (main): Call Incremental_input::report_inputs.
6540 * options.h (Input_argument_list): Typedef moved from
6542 (Input_file_group::Files): Remove, use ::Input_argument_list.
6543 (Input_file_group::Input_argument_list): Remove, use
6544 ::Input_argument_list.
6545 * plugin.cc (Plugin_manager::add_input_file): Add error in
6547 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
6549 * script.cc (read_input_script): Call
6550 Incremental_input::report_script.
6551 * script.h (Script_info): New class.
6553 2009-04-27 Ian Lance Taylor <iant@google.com>
6555 * x86_64.cc (do_adjust_output_section): Set entsize to
6558 2009-04-23 Elliott Hughes <enh@google.com>
6560 * output.cc (Output_file::close): After short writes, continue
6561 writing from the correct offset in the buffer being written.
6563 2009-04-23 Chris Demetriou <cgd@google.com>
6565 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
6566 * configure: Regenerate.
6567 * config.in: Regenerate.
6568 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
6569 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
6571 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
6573 * incremental.cc (Incremental_inputs_header_data): Renamed from
6574 Incremental_input_header_data.
6575 (Incremental_inputs_header_data::data_size): New field.
6576 (Incremental_inputs_header_data::put_input_file_count): Renamed
6577 from input_file_count.
6578 (Incremental_inputs_header_data::put_command_line_offset): Renamed
6579 from command_line_offset.
6580 (Incremental_inputs_header_data::put_reserved): Renamed from
6582 (Incremental_inputs_entry_data): Renamed from
6583 Incremental_input_entry_data.
6584 (Incremental_inputs_entry_data::data_size): New field.
6585 (Incremental_inputs::report_command_line): New method.
6586 (Incremental_inputs::finalize): New method.
6587 (Incremental_inputs::create_incremental_inputs_data): New method.
6588 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
6589 * incremental.h: New file.
6590 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
6591 (Layout::finalize): Create incremental inputs section in
6593 (Layout::create_incremental_info_sections): New method.
6594 * layout.h (Layout::incremental_inputs): New method.
6595 (Layout::create_incremental_info_sections): New method.
6596 (Layout::incremental_inputs_): New field.
6597 * main.cc (main): Notify Incremental_input of the command line.
6599 2009-04-01 Ian Lance Taylor <iant@google.com>
6600 Mikolaj Zalewski <mikolajz@google.com>
6602 * gold.h (reserve_unordered_map): Define, three versions, one for
6603 each version of Unordered_map.
6604 * layout.cc (Layout::Layout): Remove options parameter. Add
6605 number_of_input_files parameter. Don't initialize options_.
6606 Initialize number_of_input_files_ and resized_signatures_. Move
6607 sections_are_attached_.
6608 (Layout::layout_group): Reserve space for group_signatures_.
6609 (Layout::find_or_add_kept_section): Change name parameter to be a
6610 reference. Resize signatures_ map when it gets large enough.
6611 (Layout::layout_eh_frame): Use parameters->options() instead of
6613 (Layout::make_output_section): Likewise.
6614 (Layout::attach_allocated_section_to_segment): Likewise.
6615 (Layout::finalize, Layout::create_executable_stack): Likewise.
6616 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
6617 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
6618 * layout.h (class Layout): Update declarations. Remove options_
6619 field. Add number_of_input_files_ and resized_signatures_
6620 fields. Move sections_are_attached_ field.
6621 * main.cc (main): Pass number of input files to Layout
6622 constructor. Don't pass options.
6624 2009-03-30 Ian Lance Taylor <iant@google.com>
6626 * ffsll.c (ffsll): Correct implementation.
6628 2009-03-27 Ian Lance Taylor <iant@google.com>
6630 * ffsll.c: New file.
6631 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
6632 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
6633 * ftruncate.c (ftruncate): Declare before definition.
6634 * mremap.c (mremap): Likewise.
6635 * pread.c (pread): Likewise.
6636 * configure, Makefile.in, config.in: Rebuild.
6638 * mremap.c: New file.
6639 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
6640 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
6641 (mremap): Declare if HAVE_MREMAP is not defined.
6642 * configure, Makefile.in, config.in: Rebuild.
6644 2009-03-27 Cary Coutant <ccoutant@google.com>
6646 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
6647 position independent.
6648 * sparc.cc (Target_sparc::check_non_pic): Likewise.
6649 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
6651 2009-03-24 Cary Coutant <ccoutant@google.com>
6653 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
6655 (needs_dynamic_reloc): Likewise.
6657 2009-03-24 Ian Lance Taylor <iant@google.com>
6659 * yyscript.y (file_cmd): Recognize EXTERN.
6660 (extern_name_list, extern_name_list_body): New nonterminals.
6661 * script.cc (script_add_extern): Define.
6662 * script-c.h (script_add_extern): Declare.
6664 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
6666 * object.cc (is_elf_object): Define.
6667 * object.h (is_elf_object): Declare.
6668 * archive.cc (Archive::get_elf_object_for_member): Call
6670 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
6672 2009-03-24 Elliott Hughes <enh@google.com>
6674 * output.cc (Output_file::map_anonymous): Define.
6675 (Output_file::map): Use map_anonymous. If the regular mmap fails,
6676 try an anonymous one. Report the size if the mmap fails.
6677 * output.h (class Output_file): Declare map_anonymous.
6679 2009-03-24 Ian Lance Taylor <iant@google.com>
6681 * target-select.cc (instantiate_target): Don't acquire the lock if
6682 the instantiated_target_ field has already been set.
6684 2009-03-23 Ian Lance Taylor <iant@google.com>
6686 * gold-threads.h (class Initialize_lock): Define.
6687 * gold-threads.cc (class Initialize_lock_once): Define.
6688 (initialize_lock_control): New static variable.
6689 (initialize_lock_pointer): New static variable.
6690 (initialize_lock_once): New static function.
6691 (Initialize_lock::Initialize_lock): Define.
6692 (Initialize_lock::initialize): Define.
6693 * target-select.h: Include "gold-threads.h".
6694 (class Target_selector): Add lock_ and initialize_lock_ fields.
6695 Don't define instantiate_target, just declare it.
6696 * target-select.cc (Target_selector::Target_selector): Initialize
6698 (Target_selector::instantiate_target): Define.
6699 * descriptors.h: Include "gold-threads.h".
6700 (class Descriptors): Add initialize_lock_ field.
6701 * descriptors.cc (Descriptors::Descriptors): Initialize new
6703 (Descriptors::open): Use initialize_lock_ field
6704 * errors.h (class Errors): Add initialize_lock_ field.
6705 * errors.cc (Errors::Errors): Initialize new field.
6706 (Errors::initialize_lock): Use initialize_lock_ field.
6707 * powerpc.cc (class Target_selector_powerpc): Remove
6708 instantiated_target_ field. In do_recognize call
6709 instantiate_target rather than do_instantiate_target. In
6710 do_instantiate_target just allocate a new target.
6711 * sparc.cc (class Target_selector_sparc): Likewise.
6713 * freebsd.h: New file.
6714 * i386.cc: Include "freebsd.h".
6715 (Target_i386): Derive from Target_freebsd rather than
6717 (Target_selector_i386): Derive from Target_selector_freebsd rather
6718 than Target_selector.
6719 * x86_64.cc: Include "freebsd.h".
6720 (Target_x86_64): Derive from Target_freebsd rather than
6722 (Target_selector_x86_64): Derive from Target_selector_freebsd
6723 rather than Target_selector.
6724 * target.h (class Target): Add adjust_elf_header and
6725 do_adjust_elf_header.
6726 * output.cc (Output_file_header:: do_sized_write): Call target
6727 adjust_elf_header routine.
6728 * configure.tgt: Set targ_osabi.
6729 * configure.ac: Define GOLD_DEFAULT_OSABI.
6730 * parameters.cc (Parameters::default_target): Pass
6731 GOLD_DEFAULT_OSABI to select_target.
6732 * target-select.h (class Target_selector): Make instantiate_target
6733 protected rather than private.
6734 * Makefile.am (HFILES): Add freebsd.h.
6735 * configure, Makefile.in, config.in: Rebuild.
6737 * merge.cc (do_add_input_section): Correct pend value. Change
6738 message about last entry not being null terminated from error to
6741 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
6743 * incremental.cc: New file.
6744 * Makefile.am (CCFILES): Add incremental.cc.
6745 * Makefile.in: Rebuild.
6747 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
6749 * layout.cc (Layout::output_section_name): Preserve names
6750 of '.note.' sections.
6752 2009-03-19 Ian Lance Taylor <iant@google.com>
6754 * descriptors.cc (Descriptors::open): Check that the options are
6755 valid before using them.
6757 2009-03-18 Ian Lance Taylor <iant@google.com>
6759 * script-sections.h: Include <list>.
6760 (class Script_sections): Change Sections_elements from std::vector
6761 to std::list. Typedef public Elements_iterator. Add
6762 orphan_section_placement_, data_segment_align_start_, and
6763 saw_data_segment_align_ fields. Remove data_segment_align_index_
6765 * script-sections.cc (class Orphan_section_placement): New class.
6766 (class Sections_element): Add virtual functions is_relro and
6767 orphan_section_init. Remove virtual function place_orphan_here.
6768 (class Output_section_definition): Add is_relro and
6769 orphan_section_init. Remove place_orphan_here.
6770 (class Orphan_output_section): Likewise.
6771 (Script_sections::Script_sections): Update for field changes.
6772 (Script_sections::data_segment_align): Set saw_data_segment_align_
6773 and data_segment_align_start_, not data_segment_align_index.
6774 (Script_sections::data_segment_relro_end): Check
6775 saw_data_segment_align_. Use data_segment_align_start_ rather
6776 than data_segment_align_index_.
6777 (Script_sections::place_orphan): Rewrite to use
6778 Orphan_section_placement.
6780 2009-03-17 Ian Lance Taylor <iant@google.com>
6782 * archive.cc (Archive::add_symbols): Check for a version attached
6783 to the symbol name in the archive map.
6784 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
6785 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
6786 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
6787 (ver_test_11.a): New target.
6788 * testsuite/Makefile.in: Rebuild.
6790 * configure.ac: Check for chsize and posix_fallocate. Replace
6792 * ftruncate.c: New file, from gnulib.
6793 * output.cc (posix_fallocate): Define dummy version if not
6794 HAVE_POSIX_FALLOCATE.
6795 (Output_file::map): Call posix_fallocate rather than lseek and
6797 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
6798 * configure, Makefile.in, config.in: Rebuild.
6800 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
6802 * layout.h (Layout::create_note): Add section_name parameter.
6803 * layout.cc (Layout::create_note): Likewise.
6804 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
6806 2009-03-17 Ian Lance Taylor <iant@google.com>
6808 * descriptors.cc: Include "options.h".
6809 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
6810 (Descriptors::open): Always use O_CLOEXEC when opening a new
6811 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
6812 then set FD_CLOEXEC.
6814 * sparc.cc (class Target_sparc): Add has_got_section.
6815 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
6816 make sure we have a GOT section.
6818 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
6819 (Target_sparc::Scan::local): Likewise.
6820 (Target_sparc::Scan::global): Likewise.
6821 (Target_sparc::Relocate::relocate): Likewise.
6822 (Target_sparc::Relocate::relocate_tls): Likewise.
6824 * symtab.cc (Symbol_table::define_default_version): New function,
6825 broken out of add_from_object.
6826 (Symbol_table::add_from_object): Call define_default_version.
6827 (Symbol_table::define_special_symbol): Add resolve_oldsym
6828 parameter. Change all callers. If the version for a symbol comes
6829 from a version script, resolve it with the symbol with the same
6830 name with no version. Also add the symbol without a version if
6832 (do_define_in_output_data): If resolving with oldsym, don't delete
6834 (do_define_in_output_segment): Likewise.
6835 (do_define_as_constant): Likewise.
6836 * symtab.h (class Symbol_table): Update declarations.
6838 2009-03-13 Ian Lance Taylor <iant@google.com>
6840 * readsyms.cc (Read_symbols::incompatible_warning): New function.
6841 (Read_symbols::requeue): New function.
6842 (Read_symbols::do_read_symbols): If make_elf_object fails because
6843 the target type is not configured, and the file was searched for,
6844 issue a warning and retry with the next directory.
6845 (Add_symbols::run): If the file has an incompatible format, and
6846 it was searched for, requeue the Read_symbols task. On error,
6848 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
6849 dirindex parameter to constructor. Change all callers. Declare
6850 incompatible_warning and requeue.
6851 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
6852 input_argument_ and input_group_ fields. Add them to
6853 constructor. Change all callers.
6854 (class Read_script): Add dirindex_ field. Add it to constructor.
6856 * archive.cc (Archive::setup): Remove input_objects parameter.
6858 (Archive::get_file_and_offset): Likewise.
6859 (Archive::read_all_symbols): Likewise.
6860 (Archive::read_symbols): Likewise.
6861 (Archive::get_elf_object_for_member): Remove input_objects
6862 parameter. Add punconfigured parameter. Change all callers.
6863 (Archive::add_symbols): Change return type to bool. Check return
6864 value of include_member.
6865 (Archive::include_all_members): Likewise.
6866 (Archive::include_member): Change return type to bool. Return
6867 false if first included object has incompatible target. Set
6868 included_member_ field.
6869 (Add_archive_symbols::run): If add_symbols returns false, requeue
6871 * archive.h (class Archive): Add included_member_ field.
6872 Initialize it in constructor. Add input_file and searched_for
6873 methods. Update declarations.
6874 (class Add_archive_symbols): Add dirpath_, dirindex_, and
6875 input_argument_ fields. Add them to constructor. Change all
6877 * script.cc: Include "target-select.h".
6878 (class Parser_closure): Add skip_on_incompatible_target_ and
6879 found_incompatible_target_ fields. Add
6880 skip_on_incompatible_target parameter to constructor. Change all
6881 callers. Add methods skip_on_incompatible_target,
6882 clear_skip_on_incompatible_target, found_incompatible_target, and
6883 set_found_incompatible_target.
6884 (read_input_script): Add dirindex parameter. Change all callers.
6885 If parser finds an incompatible target, requeue Read_symbols
6887 (script_set_symbol): Clear skip_on_incompatible_target in
6889 (script_add_assertion, script_parse_option): Likewise.
6890 (script_start_sections, script_add_phdr): Likewise.
6891 (script_check_output_format): New function.
6892 * script.h (read_input_script): Update declaration.
6893 * script-c.h (script_check_output_format): Declare.
6894 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
6895 (ignore_cmd): Remove OUTPUT_FORMAT.
6896 * fileread.cc (Input_file::Input_file): Add explicit this.
6897 (Input_file::will_search_for): New function.
6898 (Input_file::open): Add pindex parameter. Change all callers.
6899 * fileread.h (class Input_file): Add input_file_argument method.
6900 Declare will_search_for. Update declarations.
6901 * object.cc (make_elf_object): Add punconfigured parameter.
6903 * object.h (class Object): Make input_file public. Add
6904 searched_for method.
6905 (make_elf_object): Update declaration.
6906 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
6908 * dirsearch.h (class Dirsearch): Update declaration.
6909 * options.h (class General_options): Add --warn-search-mismatch.
6910 * parameters.cc (Parameters::is_compatible_target): New function.
6911 * parameters.h (class Parameters): Declare is_compatible_target.
6912 * workqueue.cc (Workqueue::add_blocker): New function.
6913 * workqueue.h (class Workqueue): Declare add_blocker.
6915 * fileread.cc (Input_file::open): Remove options parameter.
6917 (Input_file::open_binary): Likewise.
6918 * script.cc (read_input_script): Likewise.
6919 * readsyms.h (class Read_symbols): Remove options_ field. Remove
6920 options parameter from constructor. Change all callers.
6921 (class Read_script): Likewise.
6922 * fileread.h (class Input_file): Update declarations.
6923 * script.h (read_input_script): Update declaration.
6925 2009-03-10 Nick Clifton <nickc@redhat.com>
6927 * po/es.po: New Spanish translation.
6929 2009-03-06 Cary Coutant <ccoutant@google.com>
6931 * options.cc (parse_short_option): Keep dash_z from registering itself.
6933 2009-03-03 Ian Lance Taylor <iant@google.com>
6936 * target-reloc.h (relocate_section): Pass output_section to
6938 * i386.cc (Target_i386::should_apply_static_reloc): Add
6939 output_section parameter. Change all callers.
6940 (Target_i386::Relocate::relocate): Add output_section parameter.
6941 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
6942 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
6943 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
6944 * testsuite/two_file_shared.sh: New script.
6945 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
6946 (check_DATA): Add two_file_shared.dbg.
6947 (two_file_shared.dbg): New target.
6948 * testsuite/Makefile.in: Rebuild.
6950 2009-03-01 Ian Lance Taylor <iant@google.com>
6952 * configure.ac: Check for byteswap.h.
6953 * configure: Rebuild.
6954 * config.in: Rebuild.
6956 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
6958 * layout.cc (Layout::find_or_add_kept_section): New function.
6959 (Layout::add_comdat): Removed.
6960 * layout.h (struct Kept_section): Move out of class Layout.
6961 Remove trailing underscores from field names. Add group_sections
6962 field. Rename group_ field to is_group. Change all uses.
6963 (class Layout): Declare find_or_add_kept_section, not add_comdat.
6964 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
6965 comdat_groups_ field.
6966 (Sized_relobj::include_section_group): Use
6967 find_or_add_kept_section and Kept_section::group_sections.
6968 (Sized_relobj::include_linkonce_section): Likewise.
6969 * object.cc (class Sized_relobj): Don't define Comdat_group or
6970 Comdat_group_table. Remove find_comdat_group and
6971 add_comdat_group. Remove comdat_groups_ field.
6972 * plugin.cc (include_comdat_group): Use
6973 Layout::find_or_add_kept_section.
6975 2009-02-28 Ian Lance Taylor <iant@google.com>
6977 * README: --gc-sections and map files are now supported. Document
6978 some build requirements.
6981 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
6982 relocatable link set the value of the section symbol to zero.
6983 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
6984 relocatable link don't include the section address in the local
6987 2009-02-27 Ian Lance Taylor <iant@google.com>
6990 * options.h (class Search_directory): Add is_system_directory.
6991 (class General_options): Declare is_in_system_directory.
6992 * options.cc (get_relative_sysroot): Make static.
6993 (get_default_sysroot): Make static.
6994 (General_optoins::is_in_system_directory): New function.
6995 * fileread.cc (Input_file::is_in_system_directory): New function.
6996 * fileread.h (class Input_file): Declare is_in_system_directory.
6997 * object.h (class Object): Add is_in_system_directory.
6998 (class Input_objects): Remove system_library_directory_ field.
6999 * object.cc (Input_objects::add_object): Don't set
7000 system_library_directory_.
7001 (input_objects::found_in_system_library_directory): Remove.
7002 * symtab.cc (Symbol_table::write_globals): Remove input_objects
7003 parameter. Change all callers.
7004 (Symbol_table::sized_write_globals): Likewise.
7005 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
7006 Call Object::is_in_system_directory.
7007 * symtab.h (class Symbol_table): Update declarations.
7010 * descriptors.h (Open_descriptor): Add is_on_stack field.
7011 * descriptors.cc (Descriptors::open): If the descriptor is on the
7012 top of the stack, remove it. Initialize is_on_stack field.
7013 (Descriptors::release): Only add pod to stack if it is not on the
7015 (Descriptors::close_some_descriptor): Clear stack_next and
7019 * output.cc (Output_section::find_starting_output_address): Rename
7020 from starting_output_address; add PADDR parameter; change return
7022 * output.h (class Output_section): Declare
7023 find_starting_output_address instead of starting_output_address.
7024 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
7025 section symbol for which we can't find a merge section.
7028 * symtab.cc (Symbol_table::add_from_object): If the visibility is
7029 hidden or internal, force the symbol to be local.
7030 * resolve.cc (Symbol::override_visibility): Define.
7031 (Symbol::override_base): Use override_visibility.
7032 (Symbol_table::resolve): Likewise.
7033 (Symbol::override_base_with_special): Likewise.
7034 (Symbol_table::override_with_special): If the visibility is hidden
7035 or internal, force the symbol to be local.
7036 * symtab.h (class Symbol): Add set_visibility and
7037 override_visibility.
7038 * testsuite/ver_test_1.sh: New file.
7039 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
7040 (check_DATA): Add ver_test_1.syms.
7041 (ver_test_1.syms): New target.
7042 * testsuite/Makefile.in: Rebuild.
7044 2009-02-25 Cary Coutant <ccoutant@google.com>
7046 * layout.cc (Layout::choose_output_section): Don't rename sections
7047 when using a linker script that has a SECTIONS clause.
7048 * Makefile.in: Regenerate.
7050 * testsuite/Makefile.am (script_test_5.sh): New test case.
7051 * testsuite/Makefile.in: Regenerate.
7052 * testsuite/script_test_5.cc: New file.
7053 * testsuite/script_test_5.sh: New file.
7054 * testsuite/script_test_5.t: New file.
7056 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
7058 * archive.cc (Archive::include_member): Update calls to add_symbols.
7059 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
7060 the Layout argument.
7061 * dynobj.h (do_add_symbols): Add the Layout argument.
7062 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
7064 * object.h (Object::add_symbols): Add the Layout argument.
7065 (Object::do_add_symbols): Add the Layout argument.
7066 (Sized_relobj::do_add_symbols): Add the Layout argument.
7067 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
7068 Unify the two versions.
7069 (Add_plugin_symbols): Remove.
7070 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
7071 (Sized_pluginobj::do_add_symbols): Unify the two versions.
7072 (Add_plugin_symbols): Remove.
7073 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
7074 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
7075 (Add_symbols::run): Make it work with Pulginobj.
7077 2009-02-06 Ian Lance Taylor <iant@google.com>
7079 * object.cc (Sized_relobj::do_layout): Make info message start
7080 with lower case letter.
7082 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
7084 * binary.cc: Fix file comment.
7086 * options.h (enum Incremental_disposition): Define.
7087 (class General_options): Add new options: --incremental,
7088 --incremental_changed, --incremental_unchanged,
7089 --incremental_unknown. Add incremental_disposition_ and
7090 implicit_incremental_ fields.
7091 (General_options::incremental_disposition): New function.
7092 (class Position_dependent_options): Add incremental_disposition
7094 (Position_dependent_options::copy_from_options): Set incremental
7096 * options.cc (General_options::parse_incremental_changed): New
7098 (General_options::parse_incremental_unchanged): New function.
7099 (General_options::parse_incremental_unknown): New function.
7100 (General_options::General_options): Initialize new fields
7101 incremental_disposition_ and implicit_incremental_.
7102 (General_options::finalize): Check for uasge of --incremental-*
7103 without --incremental.
7105 2009-02-06 Chris Demetriou <cgd@google.com>
7107 * gold.h (gold_undefined_symbol): Change to take only a Symbol
7108 pointer and to report location as the file name associated with
7110 (gold_undefined_symbol_at_location): New function to replace the
7111 old gold_undefined_symbol functionality.
7112 * target-reloc.h (relocate_section): Update to use
7113 gold_undefined_symbol_at_location.
7114 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
7115 Call gold_undefined_symbol function rather than gold_error.
7116 * errors.h (Errors::undefined_symbol): Take location as a
7117 string, rather than calculating it from a relocation.
7118 * errors.cc (Errors::fatal): Print "fatal error:" before the
7120 (Errors::error, Errors::error_at_location): Print "error: "
7121 before the formatted message.
7122 (Errors::undefined_symbol): Take location as a string, rather
7123 than calculating it from a relocation.
7124 (gold_undefined_symbol_at_location): New function akin to
7125 old gold_undefined_symbol, calculates location from relocation.
7126 (gold_undefined_symbol): Change to take only a Symbol pointer
7127 and to report location as the file name associated with the symbol.
7128 * testsuite/debug_msg.sh: Update for changed error messages.
7129 * testsuite/undef_symbol.sh: Likewise.
7131 2009-02-04 Duncan Sands <baldrick@free.fr>
7134 * reduced_debug_output.h
7135 (Output_reduced_debug_abbrev_section::failed): Use format for
7137 (Output_reduced_debug_info_section::faild): Likewise.
7139 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
7141 * script.cc (Lazy_demangler): New class.
7142 (Version_script_info::get_symbol_version_helper): Demangle a
7145 2009-01-29 Cary Coutant <ccoutant@google.com>
7147 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
7149 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
7151 2009-01-28 Ian Lance Taylor <iant@google.com>
7153 * version.cc (version_string): Bump to 1.9.
7155 * gold.h: Include <cstring> and <stdint.h>.
7156 * version.cc: Include <cstdio>.
7157 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
7159 * reduced_debug_output.cc (insert_into_vector): Rename from
7160 Insert_into_vector; change all callers. Use Swap_unaligned to
7161 avoid aliasing issue; remove union since it is unnecessary.
7163 2009-01-27 Sriraman Tallam <tmsriram@google.com>
7165 * Makefile.am (CCFILES): Add gc.cc.
7167 * Makefile.in: Regenerate.
7168 * gold.cc (Gc_runner): New class.
7169 (queue_initial_tasks): Call garbage collection related tasks
7170 when corresponding options are invoked.
7171 (queue_middle_gc_tasks): New function.
7172 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
7173 processed early before laying out sections during garbage collection.
7174 * gold.h (queue_middle_gc_tasks): New function.
7175 (is_prefix_of): Move from "layout.cc".
7176 * i386.cc (Target_i386::gc_process_relocs): New function.
7177 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
7178 * main.cc (main): Create object of class "Garbage_collection".
7179 * object.cc (Relobj::copy_symbols_data): New function.
7180 (Relobj::is_section_name_included): New function.
7181 (Sized_relobj::do_layout): Allow this function to be called twice
7182 during garbage collection and defer layout of section during the
7184 * object.h (Relobj::get_symbols_data): New function.
7185 (Relobj::is_section_name_included): New function.
7186 (Relobj::copy_symbols_data): New function.
7187 (Relobj::set_symbols_data): New function.
7188 (Relobj::get_relocs_data): New function.
7189 (Relobj::set_relocs_data): New function.
7190 (Relobj::is_output_section_offset_invalid): New pure virtual function.
7191 (Relobj::gc_process_relocs): New function.
7192 (Relobj::do_gc_process_relocs): New pure virtual function.
7193 (Relobj::sd_): New data member.
7194 (Sized_relobj::is_output_section_offset_invalid): New function.
7195 (Sized_relobj::do_gc_process_relocs): New function.
7196 * options.h (General_options::gc_sections): Modify to not be a no-op.
7197 (General_options::print_gc_sections): New option.
7198 * plugin.cc (Plugin_finish::run): Remove function call to
7199 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
7200 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
7201 * reloc.cc (Read_relocs::run): Add task to process relocs and
7202 determine unreferenced sections when doing garbage collection.
7203 (Gc_process_relocs): New class.
7204 (Sized_relobj::do_gc_process_relocs): New function.
7205 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
7206 sections that are garbage collected.
7207 * reloc.h (Gc_process_relocs): New class.
7208 * sparc.cc (Target_sparc::gc_process_relocs): New function.
7209 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
7210 symbols whose corresponding sections are garbage collected.
7211 (Symbol_table::Symbol_table): Add new parameter for the garbage
7213 (Symbol_table::gc_mark_undef_symbols): New function.
7214 (Symbol_table::gc_mark_symbol_for_shlib): New function.
7215 (Symbol_table::gc_mark_dyn_syms): New function.
7216 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
7218 (Symbol_table::add_from_object): Likewise.
7219 (Symbol_table::add_from_relobj): When building shared objects, do not
7220 treat externally visible symbols as garbage.
7221 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
7222 table information for static and relocatable links.
7223 * symtab.h (Symbol_table::set_gc): New function.
7224 (Symbol_table::gc): New function.
7225 (Symbol_table::gc_mark_undef_symbols): New function.
7226 (Symbol_table::gc_mark_symbol_for_shlib): New function.
7227 (Symbol_table::gc_mark_dyn_syms): New function.
7228 (Symbol_table::gc_): New data member.
7229 * target.h (Sized_target::gc_process_relocs): New pure virtual
7231 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
7232 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
7234 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
7236 * options.h (General_options::gc_sections): Define as a no-op for now.
7237 (General_options::no_keep_memory): Ditto.
7238 (General_options::Bshareable): Define.
7239 * options.cc (General_options::finalize): Honor -Bshareable.
7241 2009-01-20 Andreas Schwab <schwab@suse.de>
7243 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
7244 read the value in the contents, since we don't use it. Use the
7245 template endianness when writing.
7246 (Relocate::relocate): Use it for R_PPC_REL16_HA.
7248 2009-01-19 Andreas Schwab <schwab@suse.de>
7250 * configure.tgt (powerpc64-*): Fix targ_obj.
7252 2009-01-15 Ian Lance Taylor <iant@google.com>
7254 * object.cc (Sized_relobj::write_local_symbols): Don't write out
7255 local symbols when stripping all symbols.
7257 2009-01-14 Cary Coutant <ccoutant@google.com>
7259 * output.cc (Output_reloc): Add explicit instantiations.
7261 2009-01-14 Cary Coutant <ccoutant@google.com>
7263 * archive.cc (Archive::get_elf_object_for_member): Remove call
7264 to File_read::claim_for_plugin.
7265 * descriptors.cc (Descriptors::open): Remove reference to
7267 (Descriptors::claim_for_plugin): Remove.
7268 * descriptors.h (Descriptors::claim_for_plugin): Remove.
7269 (Descriptors::is_claimed): Remove.
7270 (claim_descriptor_for_plugin): Remove.
7271 * fileread.cc (File_read::claim_for_plugin): Remove.
7272 * fileread.h (File_read::claim_for_plugin): Remove.
7273 (File_read::descriptor): Reopen descriptor if necessary.
7274 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
7275 (Plugin_manager::all_symbols_read): Add task parameter. Change
7277 (Plugin_manager::get_input_file): New function.
7278 (Plugin_manager::release_input_file): New function.
7279 (Pluginobj::Pluginobj): Add filesize parameter and initialize
7280 corresponding data member.
7281 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
7282 and pass to base constructor. Change all callers.
7283 (get_input_file, release_input_file): New functions.
7284 (make_sized_plugin_object): Add filesize parameter. Change all callers.
7285 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
7286 (Plugin_manager::all_symbols_read): Add task parameter.
7287 (Plugin_manager::get_input_file): New function.
7288 (Plugin_manager::release_input_file): New function.
7289 (Plugin_manager::task_): New data member.
7290 (Pluginobj::Pluginobj): Add filesize parameter.
7291 (Pluginobj::filename): New function.
7292 (Pluginobj::descriptor): New function.
7293 (Pluginobj::filesize): New function.
7294 (Pluginobj::filesize_): New data member.
7295 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
7296 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
7297 File_read::claim_for_plugin; use Object::unlock to unlock the file.
7299 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
7300 with archive libraries.
7301 * testsuite/Makefile.in: Regenerate.
7302 * testsuite/plugin_test.c (struct sym_info): New type.
7303 (get_input_file, release_input_file): New static variables.
7304 (onload): Capture new transfer vector entries.
7305 (claim_file_hook): Stop reading at end of file according to filesize.
7306 Factor out parsing of readelf output into separate function.
7307 (all_symbols_read_hook): Exercise get_input_file and release_input_file
7308 APIs and get the source file name from the symbol table. Convert
7309 source file name to corresponding object file name. Print info
7310 message when adding new input files.
7311 (parse_readelf_line): New function.
7312 * testsuite/plugin_test_1.sh: Add checks for new info messages.
7313 * testsuite/plugin_test_2.sh: Likewise.
7314 * testsuite/plugin_test_3.sh: Likewise.
7315 * testsuite/plugin_test_4.sh: New test case.
7317 2009-01-07 Ian Lance Taylor <iant@google.com>
7319 * version.cc (version_string): Bump to 1.8.
7321 2008-12-23 Cary Coutant <ccoutant@google.com>
7323 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
7324 * plugin.cc (Plugin_manager::finish): Rename as
7325 layout_deferred_objects. Move cleanup to separate function.
7326 (Plugin_manager::cleanup): New function.
7327 (Plugin_finish::run): Call layout_deferred_objects and cleanup
7329 * plugin.h (Plugin_manager::finish): Rename as
7330 layout_deferred_objects.
7331 (Plugin_manager::cleanup): New function.
7332 (Plugin_manager::cleanup_done): New field.
7334 2008-12-23 Cary Coutant <ccoutant@google.com>
7336 * plugin.cc (is_visible_from_outside): New function.
7337 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
7338 so we don't return "IR only" status for exported symbols or -r links.
7340 * testsuite/Makefile.am (plugin_test_3): New test case.
7341 * testsuite/Makefile.in: Regenerate.
7342 * testsuite/plugin_test_3.sh: New file.
7344 2008-12-22 Cary Coutant <ccoutant@google.com>
7346 * object.cc (Sized_relobj::layout_section): New function.
7347 (Sized_relobj::do_layout): Defer layout of input sections until after
7348 plugin has provided replacement files.
7349 (Sized_relobj::do_layout_deferred_sections): New function.
7350 * object.h (Relobj::set_section_offset): Remove virtual keyword.
7351 (Relobj::layout_deferred_sections): New function.
7352 (Relobj::do_layout_deferred_sections): New function.
7353 (Sized_relobj::do_layout_deferred_sections): New function.
7354 (Sized_relobj::layout_section): New function.
7355 (Sized_relobj::Deferred_layout): New structure.
7356 (Sized_relobj::deferred_layout_): New field.
7357 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
7358 Change all callers. Layout deferred sections.
7359 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
7361 (Plugin_hook::run): Move code from do_plugin_hook inline.
7362 (Plugin_hook::do_plugin_hook): Remove.
7363 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
7364 (Plugin_manager::finish): Renamed, was cleanup.
7365 (Plugin_manager::should_defer_layout): New function.
7366 (Plugin_manager::add_deferred_layout_object): New function.
7367 (Plugin_manager::Deferred_layout_list): New type.
7368 (Plugin_manager::deferred_layout_objects_): New field.
7369 (Plugin_hook::do_plugin_hook): Remove.
7371 2008-12-17 Ian Lance Taylor <iant@google.com>
7373 * options.h (class General_options): Add --no case for
7376 2008-12-16 Cary Coutant <ccoutant@google.com>
7378 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
7380 (Plugin_manager::claim_file): Create plugin object even if
7381 plugin did not call the add_symbols callback.
7382 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
7383 asking for more symbols than were added.
7384 * testsuite/Makefile.am (plugin_test_1): Add test case with
7386 (empty.syms): New target.
7387 * testsuite/Makefile.in: Regenerate.
7388 * testsuite/plugin_test.c (claim_file_hook): Add new debug
7389 message. Don't call add_symbols if no globals.
7390 (all_symbols_read_hook): Don't provide replacement for empty
7393 2008-12-12 Ian Lance Taylor <iant@google.com>
7395 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
7396 r_type == 0 for a local symbol with r_sym == 0.
7397 (scan_relocatable_relocs): Pass r_sym to
7398 local_non_section_strategy.
7399 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
7402 * configure.ac: Update test for TLS descriptors: they are
7403 supported as of glibc 2.9.
7404 * configure: Rebuild.
7406 2008-12-11 Ian Lance Taylor <iant@google.com>
7409 * target-reloc.h (Default_scan_relocatable_relocs): For each
7410 function, map r_type == 0 to RELOC_DISCARD.
7412 2008-12-10 Cary Coutant <ccoutant@google.com>
7414 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
7415 object to override a kept COMDAT group from a plugin object.
7417 2008-12-09 Ian Lance Taylor <iant@google.com>
7420 * yyscript.y (file_cmd): Handle INPUT.
7422 * testsuite/initpri1.c: Change all declarations to be full
7423 prototypes by adding void, to avoid compiler warnings.
7425 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
7427 * options.cc (General_options::parse_plugin_opt): New.
7428 (General_options::add_plugin): The argument now is just the filename.
7429 (General_options::add_plugin_option): New.
7430 * options.h (plugin_opt): New.
7431 (add_plugin): Change argument name.
7432 (add_plugin_option): New.
7433 * plugin.cc (Plugin::load): Don't parse the plugin option.
7434 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
7435 (Plugin::add_option): New.
7436 (Plugin::args_): Change type.
7437 (Plugin::filename_): New.
7438 (Plugin_manager::add_plugin_option): New.
7439 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
7440 * testsuite/Makefile.in: Regenerate.
7442 2008-12-05 Cary Coutant <ccoutant@google.com>
7444 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
7445 Handle --strip-lto-sections option.
7446 * options.h (strip_lto_sections): New option.
7448 2008-12-01 Cary Coutant <ccoutant@google.com>
7450 * plugin.cc (ld_plugin_message): Change format parameter to const.
7451 Fix mismatch between new[] and delete.
7453 2008-11-14 Cary Coutant <ccoutant@google.com>
7455 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
7458 2008-11-05 Craig Silverstein <csilvers@google.com>
7460 * options.cc (General_options::parse_dynamic_list): New function.
7461 * options.h (General_options): New flags dynamic_list,
7462 dynamic_list_data, dynamic_list_cpp_new, and
7463 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
7464 (General_options::in_dynamic_list): New function.
7465 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
7466 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
7467 (Lex::can_continue_name): Likewise.
7469 (read_script_file): New parameter script_options.
7470 (read_dynamic_list): New function.
7471 (Script_options::define_dynamic_list): New function.
7472 (dynamic_list_keyword_parsecodes): New variable.
7473 (dynamic_list_keywords): New variable.
7474 * script.h (Script_options::define_dynamic_list): New function
7476 (read_dynamic_list): New function prototype.
7477 * symtab.cc (strprefix): New macro.
7478 (Symbol::should_add_dynsym_entry): Support dynamic_list,
7479 dynamic_list_data, dynamic_list_cpp_new, and
7480 dynamic_list_cpp_typeinfo.
7481 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
7482 (dynamic_list_expr): New rule.
7483 (dynamic_list_nodes): Likewise.
7484 (dynamic_list_node): Likewise.
7485 * testsuite/Makefile.am (dynamic_list): New test.
7486 * testsuite/Makefile.in: Regenerated.
7487 * testsuite/dynamic_list.t: New file.
7488 * testsuite/dynamic_list.sh: New file.
7490 2008-11-05 Craig Silverstein <csilvers@google.com>
7492 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
7493 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
7494 (t11_last): Likewise.
7495 * testsuite/ver_test_6.c (main): Likewise.
7497 2008-10-07 Cary Coutant <ccoutant@google.com>
7499 * options.c (General_options::finalize): Add check for -static and
7501 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
7504 2008-10-02 Cary Coutant <ccoutant@google.com>
7506 * plugin.cc (make_sized_plugin_object): Fix conditional
7507 compilation to work when not all targets are enabled.
7509 2008-09-29 Cary Coutant <ccoutant@google.com>
7511 * archive.cc (Archive::get_file_and_offset): Use filename instead
7512 of name to get library path.
7513 (Archive::include_member): Unlock external member of a thin archive.
7515 * testsuite/Makefile.am (TEST_AR): New variable.
7516 (thin_archive_test_1): New test.
7517 (thin_archive_test_2): New test.
7518 * testsuite/Makefile.in: Regenerate.
7519 * testsuite/thin_archive_main.cc: New file.
7520 * testsuite/thin_archive_test_1.cc: New file.
7521 * testsuite/thin_archive_test_2.cc: New file.
7522 * testsuite/thin_archive_test_3.cc: New file.
7523 * testsuite/thin_archive_test_4.cc: New file.
7525 2008-09-29 Cary Coutant <ccoutant@google.com>
7527 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
7528 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
7530 (Sized_relobj::do_finalize_local_symbols): Likewise.
7531 (Sized_relobj::map_to_kept_section): Likewise.
7532 * object.h (Sized_relobj::invalid_address): New constant.
7533 (Sized_relobj::do_output_section_offset): Check for invalid_address
7535 * output.cc (Output_reloc::local_section_offset): Use constant
7536 invalid_address instead of -1U.
7537 (Output_reloc::get_address): Likewise.
7538 (Output_section::output_address): Change -1U to -1ULL.
7539 * output.h (Output_reloc::invalid_address): New constant.
7540 * reloc.cc (Sized_relobj::write_sections): Use constant
7541 invalid_address instead of -1U.
7542 (Sized_relobj::relocate_sections): Likewise.
7543 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
7544 values for merge sections.
7545 * target-reloc.h (relocate_for_relocatable): Use constant
7546 invalid_address instead of -1U.
7548 2008-09-19 Cary Coutant <ccoutant@google.com>
7550 Add plugin functionality for link-time optimization (LTO).
7551 * configure.ac (plugins): Add --enable-plugins option.
7552 * configure: Regenerate.
7553 * config.in: Regenerate.
7554 * Makefile.am (LIBDL): New variable.
7555 (CCFILES): Add plugin.cc.
7556 (HFILES): Add plugin.h.
7557 (ldadd_var): Add LIBDL.
7558 * Makefile.in: Regenerate.
7560 * archive.cc: Include "plugin.h".
7561 (Archive::setup): Don't preread archive symbols when using a plugin.
7562 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
7563 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
7565 (Archive::include_member): Add symbols from plugin objects.
7566 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
7567 * descriptors.cc (Descriptors::open): Check for file descriptors
7568 abandoned by plugins.
7569 (Descriptors::claim_for_plugin): New function.
7570 * descriptors.h (Descriptors::claim_for_plugin): New function.
7571 (Open_descriptor::is_claimed): New field.
7572 (claim_descriptor_for_plugin): New function.
7573 * fileread.cc (File_read::claim_for_plugin): New function.
7574 * fileread.h (File_read::claim_for_plugin): New function.
7575 (File_read::descriptor): New function.
7576 * gold.cc: Include "plugin.h".
7577 (queue_initial_tasks): Add task to call plugin hooks for generating
7579 * main.cc: Include "plugin.h".
7580 (main): Load plugin libraries.
7581 * object.h (Pluginobj): Declare.
7582 (Object::pluginobj): New function.
7583 (Object::do_pluginobj): New function.
7584 (Object::set_target): New function.
7585 * options.cc: Include "plugin.h".
7586 (General_options::parse_plugin): New function.
7587 (General_options::General_options): Initialize plugins_ field.
7588 (General_options::add_plugin): New function.
7589 * options.h (Plugin_manager): Declare.
7590 (General_options): Add --plugin option.
7591 (General_options::has_plugins): New function.
7592 (General_options::plugins): New function.
7593 (General_options::add_plugin): New function.
7594 (General_options::plugins_): New field.
7595 * plugin.cc: New file.
7596 * plugin.h: New file.
7597 * readsyms.cc: Include "plugin.h".
7598 (Read_symbols::do_read_symbols): Check for archive before checking
7599 for ELF file. Call plugin hooks to claim files.
7600 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
7601 from a real object file; force override when processing replacement
7603 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
7604 (Symbol::init_base_object): Likewise.
7605 (Symbol::init_base_output_data): Likewise.
7606 (Symbol::init_base_output_segment): Likewise.
7607 (Symbol::init_base_constant): Likewise.
7608 (Symbol::init_base_undefined): Likewise.
7609 (Symbol::output_section): Assert that object is not a plugin.
7610 (Symbol_table::add_from_pluginobj): New function.
7611 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
7613 (Symbol_table::sized_write_globals): Likewise.
7614 (Symbol_table::add_from_pluginobj): Instantiate template.
7615 * symtab.h (Sized_pluginobj): Declare.
7616 (Symbol::in_real_elf): New function.
7617 (Symbol::set_in_real_elf): New function.
7618 (Symbol::in_real_elf_): New field.
7619 (Symbol_table::add_from_pluginobj): New function.
7621 * testsuite/Makefile.am (AM_CFLAGS): New variable.
7622 (LIBDL): New variable.
7624 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
7625 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
7626 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
7627 (MOSTLYCLEANFILES): Likewise.
7628 * testsuite/Makefile.in: Regenerate.
7629 * testsuite/plugin_test.c: New file.
7630 * testsuite/plugin_test_1.sh: New file.
7631 * testsuite/plugin_test_2.sh: New file.
7633 2008-09-16 Ian Lance Taylor <iant@google.com>
7635 * target-reloc.h (relocate_section): Check whether a symbol is
7636 defined by the ABI before reporting an undefined symbol error.
7637 * target.h (Target::is_defined_by_abi): Make parameter const.
7638 (Target::do_is_defined_by_abi): Likewise.
7639 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
7640 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
7641 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
7642 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
7643 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
7644 * testsuite/Makefile.in: Rebuild.
7646 * fileread.cc (make_view): Add casts to avoid warning.
7648 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
7650 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
7651 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
7653 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
7655 * options.h (General_options::output_is_executable): New.
7656 (General_options::output_is_pie): New.
7657 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
7658 for shared libraries.
7659 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
7661 2008-09-11 Chris Demetriou <cgd@google.com>
7663 * options.h (origin): New -z option.
7664 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
7665 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
7668 2008-09-05 Cary Coutant <ccoutant@google.com>
7670 * fileread.cc (File_read::make_view): Add check for attempt to map
7673 2008-09-05 Cary Coutant <ccoutant@google.com>
7675 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
7676 explicit instantiations.
7678 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
7681 * options.cc (General_options::finalize): Allow undefined symbols
7682 in shlibs if linking -shared.
7685 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
7686 symbols as not needing a dynsym entry.
7688 2008-08-20 Craig Silverstein <csilvers@google.com>
7690 * fileread.cc (File_read::open): Do not lock the file unless it
7691 was successfully opened.
7693 2008-08-14 Cary Coutant <ccoutant@google.com>
7695 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
7696 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
7697 * testsuite/tls_test.cc (struct int128): 128-bit struct
7698 for testing TLS relocs with non-zero addend.
7699 (v12): New TLS variable.
7701 (t_last): Add check for v12.
7702 * testsuite/tls_test.h (t12): New function.
7703 * testsuite/tls_test_main.cc (thread_routine): Call new test.
7705 2008-08-13 Ian Lance Taylor <iant@google.com>
7707 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
7708 set tls_segment_ or relro_segment_.
7709 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
7711 * output.h (Output_section::clear_is_relro): New function.
7712 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
7713 sections specially even when output_data_ is empty.
7714 (Output_segment::maximum_alignment): When first section is relro,
7715 only force alignment for PT_LOAD segments.
7716 * script.cc (script_data_segment_align): New function.
7717 (script_data_segment_relro_end): New function.
7718 * script-c.h (script_data_segment_align): Declare.
7719 (script_data_segment_relro_end): Declare.
7720 * script-sections.h (class Script_sections): Declare
7721 data_segment_align and data_segment_relro_end. Add fields
7722 segment_align_index_ and saw_relro_end_.
7723 * script-sections.cc (class Sections_element): Add set_is_relro
7724 virtual function. Add new bool* parameter to place_orphan_here.
7725 Add get_output_section virtual function.
7726 (class Output_section_definition): Add set_is_relro. Add new
7727 bool* parameter to place_orphan_here. Add get_output_section.
7728 Add is_relro_ field.
7729 (Output_section_definition::Output_section_definition): Initialize
7730 evaluated_address_, evaluated_load_address, evaluated_addralign_,
7731 and is_relro_ fields.
7732 (Output_section_definition::place_orphan_here): Add is_relro
7734 (Output_section_definition::set_section_addresses): Set relro for
7736 (Output_section_definition::alternate_constraint): Likewise.
7737 (class Orphan_output_section): Add new bool* parameter to
7738 place_orphan_here. Add get_output_section.
7739 (Orphan_output_section::place_orphan_here): Add is_relro
7741 (Script_sections::Script_sections): Initialize
7742 data_segment_align_index_ and saw_relro_end_.
7743 (Script_sections::data_segment_align): New function.
7744 (Script_sections::data_segment_relro_end): New function.
7745 (Script_sections::place_orphan): Set or clear is_relro.
7746 (Script_sections::set_section_addresses): Force alignment of first
7748 * yyscript.y (exp): Call script_data_segment_align and
7749 script_data_segment_relro_end.
7750 * testsuite/relro_script_test.t: New file.
7751 * testsuite/relro_test.cc (using_script): Declare.
7752 (t1, t2): Test using_script.
7753 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
7754 (relro_script_test_SOURCES): Define.
7755 (relro_script_test_DEPENDENCIES): Define.
7756 (relro_script_test_LDFLAGS): Define.
7757 (relro_script_test_LDADD): Define.
7758 (relro_script_test.so): New target.
7759 * testsuite/Makefile.in: Rebuild.
7761 2008-08-06 Cary Coutant <ccoutant@google.com>
7763 * archive.cc (Archive::total_archives, Archive::total_members)
7764 (Archive::total_members_loaded): New variables.
7765 (Archive::setup): Add parameter. Add option to preread
7767 (Archive::read_armap): Add counter.
7768 (Archive::get_file_and_offset): New function.
7769 (Archive::get_elf_object_for_member): New function.
7770 (Archive::read_all_symbols): New function.
7771 (Archive::read_symbols): New function.
7772 (Archive::add_symbols): Add counters.
7773 (Archive::include_all_members): Use armap to find members if it's
7775 (Archive::include_member): Skip reading symbols if already read.
7776 Factored code into Archive::get_file_and_offset and
7777 Archive::get_elf_object_for_member. Changed call to
7778 Mapfile::report_include_archive_member.
7779 (Archive::print_stats): New function.
7780 * archive.h: Declare Object and Read_symbols_data classes.
7781 (Archive::Archive): Add initializers for new members.
7782 (Archive::setup): Add parameter.
7783 (Archive::print_stats): New function.
7784 (Archive::total_archives, Archive::total_members)
7785 (Archive::total_members_loaded): New variables.
7786 (Archive::get_file_and_offset): New function.
7787 (Archive::get_elf_object_for_member): New function.
7788 (Archive::read_all_symbols): New function.
7789 (Archive::read_symbols): New function.
7790 (Archive::Archive_member): New class.
7791 (Archive::members_): New member.
7792 (Archive::num_members_): New member.
7793 * main.cc: Include archive.h.
7794 (main): Call Archive::print_stats.
7795 * mapfile.cc (Mapfile::report_include_archive_member): Delete
7796 archive parameter; member_name is now the fully-decorated name.
7797 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
7798 * options.h: (General_options): Add --preread-archive-symbols option.
7799 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
7802 2008-08-04 Ian Lance Taylor <iant@google.com>
7804 * symtab.h (Symbol::use_plt_offset): New function.
7805 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
7806 * powerpc.cc (Relocate::relocate): Likewise.
7807 * sparc.cc (Relocate::relocate): Likewise.
7808 * x86_64.cc (Relocate::relocate): Likewise.
7809 * testsuite/weak_plt.sh: New test.
7810 * testsuite/weak_plt_main.cc: New test.
7811 * testsuite/weak_plt_shared.cc: New test.
7812 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
7813 (check_PROGRAMS): Add weak_plt.
7814 (check_DATA): Add weak_plt_shared.so.
7815 (weak_plt_main_pic.o, weak_plt): New targets.
7816 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
7817 * testsuite/Makefile.in: Rebuild.
7819 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
7821 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
7822 * testsuite/Makefile.in: Rebuild.
7824 2008-08-04 Alan Modra <amodra@bigpond.net.au>
7826 * Makefile.am (POTFILES.in): Set LC_ALL=C.
7827 * Makefile.in: Regenerate.
7828 * po/POTFILES.in: Regenerate.
7830 2008-07-29 Ian Lance Taylor <iant@google.com>
7832 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
7833 symbols before other symbols.
7834 * testsuite/script_test_2.cc (test_addr): Declare.
7835 (test_addr_alias): Declare.
7836 (main): Check that test_addr and test_addr_alias have the right
7838 * testsuite/script_test_2.t: Define test_addr_alias and
7841 2008-07-24 Ian Lance Taylor <iant@google.com>
7844 * descriptors.cc: New file.
7845 * descriptors.h: New file.
7846 * gold-threads.h (class Hold_optional_lock): New class.
7847 * fileread.cc: Include "descriptors.h".
7848 (File_read::~File_read): Release descriptor rather than closing
7850 (File_read::open) [file]: Call open_descriptor rather than open.
7851 Set is_descriptor_opened_.
7852 (File_read::open) [memory]: Assert that descriptor is not open.
7853 (File_read::reopen_descriptor): New function.
7854 (File_read::release): Release descriptor.
7855 (File_read::do_read): Make non-const. Reopen descriptor.
7856 (File_read::read): Make non-const.
7857 (File_read::make_view): Reopen descriptor.
7858 (File_read::do_readv): Likewise.
7859 * fileread.h (class File_read): Add is_descriptor_opened_ field.
7860 Update declarations.
7861 * layout.cc: Include "descriptors.h".
7862 (Layout::create_build_id): Use open_descriptor rather than open.
7863 * output.cc: Include "descriptors.h".
7864 (Output_file::open): Use open_descriptor rather than open.
7865 * archive.cc (Archive::const_iterator): Change Archive to be
7867 (Archive::begin, Archive::end): Make non-const.
7868 (Archive::count_members): Likewise.
7869 * archive.h (class Archive): Update declarations.
7870 * object.h (Object::read): Make non-const.
7871 * Makefile.am (CCFILES): Add descriptors.cc.
7872 (HFILES): Add descriptors.h.
7873 * Makefile.in: Rebuild.
7876 * gold.h: Always include <clocale>. Add Solaris workarounds
7877 following code in binutils/sysdep.h.
7880 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
7881 this->eh_frame_hdr_ is NULL before using it.
7883 * dynobj.cc (Versions::Versions): Update comment.
7885 * dynobj.cc (Versions::Versions): If there is an soname, use it as
7886 the base version name.
7888 * stringpool.cc (Stringpool_template::add_with_length): Set key to
7889 array size plus one.
7890 (Stringpool_template::set_string_offsets): Subtract one from key
7891 before using it as an array index.
7892 (Stringpool_template::get_offset_with_length): Likewise.
7893 (Stringpool_template::write_to_buffer): Likewise.
7894 * stringpool.h (Stringpool_template::get_offset_from_key):
7897 2008-07-23 Ian Lance Taylor <iant@google.com>
7900 * object.h (Merged_symbol_value::value): Do our best to handle a
7904 * script.cc (Version_script_info::get_versions): Don't add empty
7905 version tag to return value.
7906 (Version_script_info::get_symbol_version_helper): Change return
7907 type to bool. Add pversion parameter. Change all callers.
7908 (script_register_vers_node): Don't require a non-NULL tag.
7909 * script.h (class Version_script_info): Update declarations.
7910 (Version_script_info::get_symbol_version): Change return type to
7911 bool. Add version parameter. Change all callers.
7912 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
7913 handling. Handle an empty version from a version script.
7914 (Symbol_table::define_special_symbol): Likewise.
7915 * testsuite/ver_test_10.script: New file.
7916 * testsuite/ver_test_10.sh: New file.
7917 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
7918 (check_DATA): Add ver_test_10.syms.
7919 (ver_test_10.syms, ver_test_10.so): New target.
7920 * testsuite/Makefile.in: Rebuild.
7922 2008-07-23 Simon Baldwin <simonb@google.com>
7924 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
7925 to zero for undefined symbols from dynamic libraries.
7927 2008-07-23 Ian Lance Taylor <iant@google.com>
7929 * symtab.cc (Symbol_table::resolve): Remove version parameter.
7931 * symtab.h (class Symbol_table): Update declaration.
7932 * testsuite/ver_test_9.cc: New file.
7933 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
7934 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
7935 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
7936 (ver_test_9.so, ver_test_9.o): New targets.
7937 * testsuite/Makefile.in: Rebuild.
7939 2008-07-22 Ian Lance Taylor <iant@google.com>
7941 * options.h (class General_options): Define --check-sections.
7942 * layout.cc (Layout::set_segment_offsets): Handle
7945 * options.h (class General_options): Define -n/--nmagic and
7947 * options.cc (General_options::finalize): For -n/--nmagic or
7948 -N/--omagic, set -static.
7949 * layout.cc (Layout::attach_allocated_section_to_segment): If
7950 -N/--omagic, don't put read-only and read-write sections in
7952 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
7953 finding a read-only segment.
7954 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
7955 don't set the minimum segment alignment to the common page size,
7956 and don't set the file offset to the address modulo the page size.
7957 * script-sections.cc (Script_sections::create_segments): If
7958 -n/--omagic, don't put read-only and read-write sections in
7961 * cref.cc: New file.
7963 * options.h (class General_options): Add --print-symbol-counts.
7964 * main.cc (main): Issue defined symbol report if requested.
7965 * archive.cc (Archive::interpret_header): Make into a const member
7967 (Archive::add_symbols): Call Input_objects::archive_start and
7969 (Archive::const_iterator): Define new class.
7970 (Archive::begin, Archive::end): New functions.
7971 (Archive::include_all_members): Rewrite to use iterator.
7972 (Archive::count_members): New function.
7973 * archive.h (class Archive): Update declarations.
7974 (Archive::filename): New function.
7975 * object.cc: Include "cref.h".
7976 (Sized_relobj::Sized_relobj): Initialize defined_count_.
7977 (Sized_relobj::do_get_global_symbol_counts): New function.
7978 (Input_objects::add_object): Add object to cross-referencer.
7979 (Input_objects::archive_start): New function.
7980 (Input_objects::archive_stop): New function.
7981 (Input_objects::print_symbol_counts): New function.
7982 * object.h: Declare Cref and Archive.
7983 (Object::get_global_symbol_counts): New function.
7984 (Object::do_get_global_symbol_counts): New pure virtual function.
7985 (class Sized_relobj): Add defined_count_ field. Update
7987 (class Input_objects): Add cref_ field. Update constructor.
7988 Update declarations.
7989 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
7991 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
7993 (Sized_dynobj::do_get_global_symbol_counts): New function.
7994 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
7995 defined_count_. Update declarations. Define Symbols typedef.
7996 * symtab.cc (Symbol_table::add_from_relobj): Add defined
7997 parameter. Change all callers.
7998 (Symbol_table::add_from_dynobj): Add sympointers and defined
7999 parameters. Change all callers.
8000 * symtab.h (class Symbol_table): Update declarations.
8001 * Makefile.am (CCFILES): Add cref.cc.
8002 (HFILES): Add cref.h.
8003 * Makefile.in: Rebuild.
8005 2008-07-22 Simon Baldwin <simonb@google.com>
8007 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
8008 to zero when writing undefined symbols.
8010 2008-07-22 Ian Lance Taylor <iant@google.com>
8012 * output.cc (Output_section::add_input_section): Don't try to
8013 merge empty merge sections.
8015 2008-07-21 Craig Silverstein <csilvers@google.com>
8017 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
8018 Include symbol version in error message.
8020 2008-07-20 Chris Demetriou <cgd@google.com>
8022 * configure.ac (gold_cv_c_random_seed): New configured variable.
8023 (RANDOM_SEED_CFLAGS): New substituted variable.
8024 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
8025 * configure: Rebuild.
8026 * Makefile.in: Likewise.
8027 * testsuite/Makefile.in: Likewise.
8029 2008-07-18 Ian Lance Taylor <iant@google.com>
8031 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
8032 where we see NAME/NULL and NAME/VERSION as separate symbols.
8033 * testsuite/ver_test_main.cc (main): Call t4.
8034 (t4, t4_2a): Define.
8035 * testsuite/ver_test_2.cc (t4_2): Define.
8036 * testsuite/ver_test_2.script: Put t4_2a in VER2.
8037 * testsuite/ver_test_4.cc (t4_2a): Define.
8038 * testsuite/ver_test_4.script: Put t4_2a in VER2.
8039 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
8041 2008-07-17 Ian Lance Taylor <iant@google.com>
8043 * dynobj.cc (Versions::add_def): If we give an error about a
8044 missing version, go ahead and create the version anyhow.
8046 2008-07-10 Ian Lance Taylor <iant@google.com>
8048 Handle output sections with more than 0x7fffffff bytes.
8049 * object.h (class Relobj): Change map_to_output_ to
8050 output_sections_, and just keep a section pointer. Change all
8051 uses. Move comdat group support to Sized_relobj.
8052 (Relobj::is_section_specially_mapped): Remove.
8053 (Relobj::output_section): Remove poff parameter. Change all
8055 (Relobj::output_section_offset): New function.
8056 (Relobj::set_section_offset): Rewrite.
8057 (Relobj::map_to_output): Remove.
8058 (Relobj::output_sections): New function.
8059 (Relobj::do_output_section_offset): New pure virtual function.
8060 (Relobj::do_set_section_offset): Likewise.
8061 (class Sized_relobj): Add section_offsets_ field. Add comdat
8062 group support from Relobj. Update declarations.
8063 (Sized_relobj::get_output_section_offset): New function.
8064 (Sized_relobj::do_output_section_offset): New function.
8065 (Sized_relobj::do_set_section_offset): New function.
8066 * object.cc (Relobj::output_section_address): Remove.
8067 (Sized_relobj::Sized_relobj): Initialize new fields.
8068 (Sized_relobj::include_section_group): Cast find_kept_object to
8070 (Sized_relobj::include_linkonce_section): Likewise.
8071 (Sized_relobj::do_layout): Use separate arrays for output section
8073 (Sized_relobj::do_count_local_symbols): Change map_to_output to
8075 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
8076 output_sections and section_offsets.
8077 (Sized_relobj::write_local_symbols): Likewise.
8078 (map_to_kept_section): Compute output address directly.
8079 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
8080 output_sections and section_offsets.
8081 (Sized_relobj::write_sections): Likewise.
8082 (Sized_relobj::relocate_sections): Likewise.
8083 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
8084 * output.h (class Output_reloc): Update declarations. Change
8085 u2_.relobj to Sized_relobj*.
8086 (class Output_data_reloc): Change add functions to use
8088 * output.cc (Output_reloc::Output_reloc): Change relobj to
8090 (Output_reloc::local_section_offset): Change return type to
8091 Elf_Addr. Use get_output_section_offset.
8092 (Output_reloc::get_address): Likewise.
8093 (Output_section::is_input_address_mapped): Don't call
8094 is_section_specially_mapped.
8095 (Output_section::output_offset): Likewise.
8096 (Output_section::output_address): Likewise.
8097 (Output_section::starting_output_address): Likewise.
8098 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
8099 parameter to Sized_relobj*.
8100 (Copy_relocs::need_copy_reloc): Likewise.
8101 (Copy_relocs::save): Likewise.
8102 * copy-relocs.h (class Copy_relocs): Update declarations.
8103 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
8104 Sized_relobj*. Change relobj_ field to Sized_relobj*.
8105 * target-reloc.h (relocate_for_relocatable): Change
8106 offset_in_output_section type to Elf_Addr. Change code that uses
8108 * layout.cc (Layout::layout): Always set *off.
8109 * mapfile.cc (Mapfile::print_input_section): Use
8110 output_section_offset.
8111 * i386.cc (Target_i386::copy_reloc): Change object parameter to
8113 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
8114 * sparc.cc (Target_sparc::copy_reloc): Likewise.
8115 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
8117 2008-07-03 Ian Lance Taylor <iant@google.com>
8119 * layout.cc (Layout::include_section): Do not discard unrecognized
8120 SHT_STRTAB sections.
8122 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
8124 * script.cc (Lex::can_continue_name): Make '?' allowable in
8125 version-script names.
8126 * testsuite/version_script.map: Change glob pattern to use '?'
8128 2008-06-30 Manish Singh <yosh@gimp.org>
8131 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
8134 2008-06-30 Ian Lance Taylor <iant@google.com>
8138 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
8139 versions]: Don't try to read the value in the contents, since we
8140 don't use it. Use the template endianness when writing.
8142 2008-06-25 Cary Coutant <ccoutant@google.com>
8144 * fileread.cc (File_read::make_view): Assert on zero-length view.
8145 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
8146 symbol table when there are no symbols to read.
8148 2008-06-23 Craig Silverstein <csilvers@google.com>
8150 * version.cc (version_string): Bump to 1.7
8152 2008-06-18 Craig Silverstein <csilvers@google.com>
8154 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
8155 constant 0xFFFF to type Valtype.
8156 (Powerpc_relocate_functions::rel16_ha): Likewise.
8158 2008-06-17 Ian Lance Taylor <iant@google.com>
8160 * output.h (Output_section::Input_section): Initialize p2align_ to
8161 zero for Output_section_data constructors.
8162 (Output_section::Input_section::addralign): If not an input
8163 section, return the alignment of the Output_section_data.
8164 * testsuite/copy_test.cc: New file.
8165 * testsuite/copy_test_1.cc: New file.
8166 * testsuite/copy_test_2.cc: New file.
8167 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
8168 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
8169 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
8170 (copy_test_1_pic.o, copy_test_1.so): New targets.
8171 (copy_test_2_pic.o, copy_test_2.so): New targets.
8172 * testsuite/Makefile.in: Rebuild.
8174 * script-sections.cc (Script_sections::place_orphan): Initialize
8175 local variable exact.
8177 2008-06-13 David Edelsohn <edelsohn@gnu.org>
8179 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
8181 2008-06-12 David Edelsohn <edelsohn@gnu.org>
8182 David S. Miller <davem@davemloft.net>
8184 * powerpc.cc: New file.
8185 * Makefile.am (TARGETSOURCES): Add powerpc.cc
8186 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
8187 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
8188 * Makefile.in: Rebuild.
8190 2008-06-09 Ian Lance Taylor <iant@google.com>
8192 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
8194 (throwing, orig_terminate): New static variables.
8195 (terminate_handler): New static function.
8196 (t2): Set terminate handler.
8198 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
8201 * binary.cc (Binary_to_elf::sized_convert): Fix .data
8204 2008-05-30 Cary Coutant <ccoutant@google.com>
8206 * archive.cc (Archive::include_all_members) Correct to step
8207 over symbol table and extended name table in thin archives.
8209 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
8212 * target-reloc.h (relocate_for_relocatable): Fix new_offset
8215 2008-05-28 Caleb Howe <cshowe@google.com>
8217 * reduced_debug_output.cc: New file.
8218 * reduced_debug_output.h: New file.
8219 * options.h (class General_options): Add --strip-debug-non-line.
8220 * options.cc (General_options::finalize): Add strip_debug_non_line
8221 to the strip heirarchy.
8222 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
8224 * layout.cc: Include "reduced_debug_output.h".
8225 (Layout::Layout): Initialize new fields.
8226 (line_only_debug_sections): New static array.
8227 (is_lines_only_debug_sections): New static inline function.
8228 (Layout::include_section): Handle --strip-debug-non-line.
8229 (Layout::make_output_section): If --strip-debug-non-line, build
8230 new output sections for .debug_abbrev and .debug_info.
8231 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
8232 gold. Warn about possible overflow.
8233 (read_signed_LEB_128): Likewise.
8234 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
8235 (read_signed_LEB_128): Declare.
8236 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
8237 (HFILES): Add reduced_debug_output.h.
8238 * Makefile.in: Rebuild.
8240 2008-05-21 Ian Lance Taylor <iant@google.com>
8242 * mapfile.cc: New file.
8243 * mapfile.h: New file.
8244 * options.h (class General_options): Add -M/--print-map and -Map.
8245 * options.cc (General_options::finalize): Make -M equivalent to
8247 * main.cc: Include <cstdio> and "mapfile.h".
8248 (main): Open mapfile if requested.
8249 * gold.cc (class Middle_runner): Add mapfile_ field. Update
8250 constructor. Change caller.
8251 (queue_initial_tasks): Add mapfile parameter. Change caller.
8252 (queue_middle_tasks): Likewise.
8253 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
8255 * archive.cc: Include "mapfile.h".
8256 (Archive::add_symbols): Add mapfile parameter. Change all
8257 callers. Pass mapfile, symbol, and reason to include_member.
8258 (Archive::include_all_members): Add mapfile parameter. Change all
8260 (Archive::include_member): Add mapfile, sym, and why parameters.
8261 Change all callers. Report inclusion to map file.
8262 * archive.h: Include "fileread.h".
8263 (class Archive): Update declarations.
8264 (Archive::file): New const method.
8265 (class Add_archive_symbols): Add mapfile_ field. Update
8266 constructor. Change all callers.
8267 * readsyms.h (class Read_symbols): Likewise.
8268 (class Finish_group): Likewise.
8269 (class Read_script): Likewise.
8270 * common.cc: Include "mapfile.h".
8271 (Symbol_table::allocate_commons): Add mapfile parameter. Change
8273 (Symbol_table::do_allocate_commons): Likewise.
8274 (Symbol_table::do_allocate_commons_list): Likewise. Report common
8275 symbol allocation to mapfile.
8276 * common.h (class Allocate_commons_task): Add mapfile_ field.
8277 Update constructor. Change all callers.
8278 * symtab.h (class Symbol_table): Update declarations.
8279 * layout.cc: Include "mapfile.h".
8280 (Layout_task_runner::run): Print information to mapfile.
8281 (Layout::create_gold_note): Change Output_data_fixed_space to
8282 Output_data_zero_fill.
8283 (Layout::create_build_id): Likewise.
8284 (Layout::print_to_mapfile): New function.
8285 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
8286 constructor. Change caller.
8287 (class Layout): Declare print_to_mapfile.
8288 * output.cc (Output_section::Input_section::print_to_mapfile): New
8290 (Output_section::add_input_section): If producing a map, always
8291 add to input_sections_ list.
8292 (Output_section::do_print_to_mapfile): New function.
8293 (Output_segment::print_sections_to_mapfile): New function.
8294 (Output_segment::print_section_list_to_mapfile): New function.
8295 * output.h: Include "mapfile.h".
8296 (Output_data::print_to_mapfile): New function.
8297 (Output_data::do_print_to_mapfile): New virtual function.
8298 (Output_segment_headers::do_print_to_mapfile): New function.
8299 (Output_file_header::do_print_to_mapfile): New function.
8300 (Output_data_const::do_print_to_mapfile): New function.
8301 (class Output_data_const_buffer): Add map_name_ field. Update
8302 constructor. Change all callers. Add do_print_to_mapfile
8304 (class Output_data_fixed_space): Likewise.
8305 (class Output_data_space): Likewise.
8306 (class Output_data_zero_fill): New class.
8307 (Output_data_strtab::do_print_to_mapfile): New function.
8308 (Output_data_reloc_base::do_print_to_mapfile): New function.
8309 (Output_relocatable_relocs::do_print_to_mapfile): New function.
8310 (Output_data_group::do_print_to_mapfile): New function.
8311 (Output_data_got::do_print_to_mapfile): New function.
8312 (Output_data_dynamic::do_print_to_mapfile): New function.
8313 (Output_symtab_xindex::do_print_to_mapfile): New function.
8314 (class Output_section): Declare do_print_to_mapflie. Declare
8315 print_to_mapfile in Input_section.
8316 (class Output_segment): Declare new functions.
8317 * object.h (Sized_relobj::symbol_count): New function.
8318 * script-sections.cc
8319 (Output_section_element_dot_assignment::set_section_addresses):
8320 Change Output_data_fixed_space to Output_data_zero_fill.
8321 (Output_data_expression::do_print_to_mapfile): New function.
8322 * script.cc (read_input_script): Add mapfile parameter. Change
8324 * script.h (read_input_script): Update declaration.
8325 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
8326 (Eh_frame::do_print_to_mapfile): New function.
8327 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
8328 (Output_merge_string::do_print_to_mapfile): New function.
8329 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
8331 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
8333 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
8335 * Makefile.am (CCFILES): Add mapfile.cc.
8336 (HFILES): Add mapfile.h.
8337 * Makefile.in: Rebuild.
8339 2008-05-19 Ian Lance Taylor <iant@google.com>
8341 * options.h (class General_options): Add -z relro.
8342 * layout.cc (Layout::Layout): Initialize relro_segment_.
8343 (Layout::add_output_section_data): Return the output section.
8344 (Layout::make_output_section): Rcognize relro sections and mark
8346 (Layout::attach_allocated_section_to_segment): Put relro sections
8347 in a PT_GNU_RELRO segment.
8348 (Layout::create_initial_dynamic_sections): Mark the .dynamic
8350 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
8352 (Layout::linkonce_mapping): Map d.rel.ro.local to
8354 (Layout::output_section_name): Us .data.rel.ro.local for any
8355 section which begins with that.
8356 * layout.h (class Layout): Update add_output_section_data
8357 declaration. Add relro_segment_ field.
8358 * output.cc (Output_section::Output_section): Initialize is_relro_
8359 and is_relro_local_ fields.
8360 (Output_segment::add_output_section): Group relro sections.
8361 (Output_segment::is_first_section_relro): New function.
8362 (Output_segment::maximum_alignment): If there is a relro section,
8363 align the segment to the common page size.
8364 (Output_segment::set_section_addresses): Track whether we are
8365 looking at relro sections. If the last section is a relro
8366 section, align to the common page size.
8367 (Output_segment::set_section_list_addresses): Add in_relro
8368 parameter. Change all callers. Align to the page size when
8369 moving from relro to non-relro section.
8370 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
8372 * output.h (class Output_section): Add is_relro_ and
8373 is_relro_local_ fields.
8374 (Output_section::is_relro): New function.
8375 (Output_section::set_is_relro): New function.
8376 (Output_section::is_relro_local): New function.
8377 (Output_section::set_is_relro_local): New function.
8378 (class Output_segment): Update declarations.
8379 * i386.cc (Target_i386::got_section): Mark .got section as relro.
8380 * sparc.cc (Target_sparc::got_section): Likewise.
8381 * x86_64.cc (Target_x86_64::got_section): Likewise.
8382 * testsuite/relro_test_main.cc: New file.
8383 * testsuite/relro_test.cc: New file.
8384 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
8385 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
8386 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
8387 (relro_test.so, relro_test_pic.o): New targets.
8388 * testsuite/Makefile.in: Rebuild.
8390 2008-05-16 Ian Lance Taylor <iant@google.com>
8392 * output.cc (Output_segment::add_output_section): Remove front
8394 * output.h (class Output_segment): Remove
8395 add_initial_output_section and overloaded add_output_section.
8396 Update declaration of remaining add_output_section.
8397 * layout.cc (Layout::create_interp): Call add_output_section
8398 rather than add_initial_output_section.
8399 (Layout::finish_dynamic_section): Likewise.
8401 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
8402 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
8403 know the dynamic type.
8404 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
8405 field. Initialize it in constructor.
8406 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
8407 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
8408 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
8411 * output.cc (Output_reloc::get_address): Change return type to
8413 * output.h (class Output_reloc): Update get_address declaration.
8414 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
8415 for section addresses.
8417 2008-05-09 Ian Lance Taylor <iant@google.com>
8420 * gold.cc (gold_nomem): Use return value of write.
8422 2008-05-08 Ian Lance Taylor <iant@google.com>
8424 * symtab.c (Symbol::init_base_output_data): Add version
8425 parameter. Change all callers.
8426 (Symbol::init_base_output_segment): Likewise.
8427 (Symbol::init_base_constant): Likewise.
8428 (Symbol::init_base_undefined): Likewise.
8429 (Sized_symbol::init_output_data): Likewise.
8430 (Sized_symbol::init_output_segment): Likewise.
8431 (Sized_symbol::init_constant): Likewise.
8432 (Sized_symbol::init_undefined): Likewise.
8433 (Symbol_table::do_define_in_output_data): If the new symbol has a
8434 version, mark it as the default.
8435 (Symbol_table::do_define_in_output_segment): Likewise.
8436 (Symbol_table::do_define_as_constant): Likewise.
8437 * symtab.h (class Symbol): Update declarations.
8438 (class Sized_symbol): Likewise.
8439 * resolve.cc (Symbol::override_version): New function.
8440 (Symbol::override_base): Call override_version.
8441 (Symbol::override_base_with_special): Likewise.
8442 * testsuite/ver_script_8.script: New file.
8443 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
8444 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
8445 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
8446 (ver_test_8_1.so, ver_test_8_2.so): New targets.
8448 2008-05-06 Ian Lance Taylor <iant@google.com>
8451 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
8453 (class General_options): Remove existing --undefined, and add
8454 --no-undefined instead. Add new --undefined as synonym for -u.
8455 * archive.cc (Archive::add_symbols): Check whether symbol was
8457 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
8458 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
8459 all uses. Add IS_UNDEFINED. Update declarations to split
8460 different versions of init_base. Declare init_base_undefined.
8461 (Symbol::is_defined): Handle IS_UNDEFINED.
8462 (Symbol::is_undefined): Likewise.
8463 (Symbol::is_weak_undefined): Call is_undefined.
8464 (Symbol::is_absolute): Handle IS_CONSTANT.
8465 (class Sized_symbol): Update declarations to split different
8466 versions of init. Declare init_undefined.
8467 (class Symbol_table): Declare new functions.
8468 * symtab.cc (Symbol::init_base_object): Rename from init_base.
8470 (Symbol::init_base_output_data): Likewise.
8471 (Symbol::init_base_output_segment): Likewise.
8472 (Symbol::init_base_constant): Likewise.
8473 (Symbol::init_base_undefined): New function.
8474 (Sized_symbol::init_object): Rename from init. Change all
8476 (Sized_symbol::init_output_data): Likewise.
8477 (Sized_symbol::init_output_segment): Likewise.
8478 (Sized_symbol::init_constant): Likewise.
8479 (Sized_symbol::init_undefined): New function.
8480 (Symbol_table::add_undefined_symbols_from_command_line): New
8482 (Symbol_table::do_add_undefined_symbols_from_command_line): New
8484 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
8485 (Symbol::output_section): Likewise.
8486 (Symbol::set_output_section): Likewise.
8487 (Symbol_table::sized_finalize_symbol): Likewise.
8488 (Symbol_table::sized_write_globals): Likewise.
8489 * resolve.cc (Symbol_table::should_override): Likewise.
8490 (Symbol::override_base_with_special): Likewise.
8492 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
8493 symbol, change it to have default visibility.
8494 * testsuite/protected_1.cc: New file.
8495 * testsuite/protected_2.cc: New file.
8496 * testsuite/protected_3.cc: New file.
8497 * testsuite/protected_main_1.cc: New file.
8498 * testsuite/protected_main_2.cc: New file.
8499 * testsuite/protected_main_3.cc: New file.
8500 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
8501 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
8502 (protected_1_LDFLAGS, protected_1_LDADD): Define.
8503 (protected_1.so): New target.
8504 (protected_1_pic.o, protected_2_pic.o): New targets.
8505 (protected_3_pic.o): New target.
8506 (check_PROGRAMS): Add protected_2.
8507 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
8508 (protected_2_LDFLAGS, protected_2_LDADD): Define.
8509 * testsuite/Makefile.in: Rebuild.
8511 * options.h (DEFINE_var): Add set_user_set_##varname__.
8512 (DEFINE_bool_alias): New macro.
8513 (class General_options): Define -Bstatic using DEFINE_bool_alias
8514 rather than DEFINE_special. Add --undefined as an alias for -z
8516 * options.cc (General_options::parse_Bstatic): Remove.
8518 * options.h (class General_options): Add --fatal-warnings.
8519 * main.cc (main): Implement --fatal-warnings.
8520 * errors.h (Errors::warning_count): New function.
8522 * options.h (class General_options): Add -Bsymbolic-functions.
8523 * symtab.h (Symbol::is_preemptible): Check for
8524 -Bsymbolic-functions.
8526 2008-05-05 Ian Lance Taylor <iant@google.com>
8528 * options.h (DEFINE_bool): For DASH_Z, create the negative option
8529 as noVARNAME rather than no-VARNAME.
8530 (class General_options): Add option -z combreloc.
8531 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
8533 (Output_reloc::sort_before) [SHT_REL]: New function.
8534 (Output_reloc::sort_before) [SHT_RELA]: New function.
8535 (class Output_data_reloc_base): Add sort_relocs_ field. Define
8536 Sort_relocs_comparison.
8537 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
8538 parameter. Change all callers.
8539 (Output_data_reloc::Output_data_reloc) [both versions]: Add
8540 sort_relocs parameter. Change all callers.
8541 * output.cc (Output_reloc::get_address): New function, broken out
8543 (Output_reloc::write_rel): Call it.
8544 (Output_reloc::compare): New function.
8545 (Output_data_reloc_base::do_write): Optionally sort relocs.
8547 * configure.ac: If targ_extra_obj is set, link it in.
8548 * configure.tgt: Initialize all variables.
8549 (x86_64*): Set targ_extra_obj and targ_extra_size.
8550 * configure: Rebuild.
8552 * object.cc (Sized_relobj::include_section_group): Adjust section
8553 indexes read from group data. Build vector to pass to
8555 * layout.cc (Layout::layout_group): Add flags and shndxes
8556 parameters. Remove contents parameter. Change caller. Update
8557 explicit instantiations.
8558 * layout.h (class Layout): Update layout_group declaration.
8559 * output.cc (Output_data_group::Output_data_group): Add flags and
8560 input_shndxes parameters. Remove contents parameter. Change
8562 (Output_data_group::do_write): Change input_sections_ to
8564 * output.h (class Output_data_group): Update constructor
8565 declaration. Rename input_sections_ to input_shndxes_.
8566 * testsuite/many_sections_test.cc: Add template.
8568 2008-04-30 Cary Coutant <ccoutant@google.com>
8570 * target-reloc.h (relocate_section): Fix dead-pointer bug.
8572 * layout.cc (Layout::include_section): Refactored check for debug
8574 (Layout::add_comdat): Add new parameters. Change type
8575 of signature parameter. Add object and shndx to signatures table.
8576 (Layout::find_kept_object): New function.
8577 * layout.h: Include <cstring>.
8578 (Layout::is_debug_info_section): New function.
8579 (Layout::add_comdat): Add new parameters.
8580 (Layout::find_kept_object): New function.
8581 (Layout::Kept_section): New struct.
8582 (Layout::Signatures): Change type of map range.
8583 * object.cc (Relobj::output_section_address): New function.
8584 (Sized_relobj::include_section_group): Add new parameters. Change
8585 calls to Layout::add_comdat. Change to build table of kept comdat
8586 groups and table mapping discarded sections to kept sections.
8587 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
8588 (Sized_relobj::do_layout): Change calls to include_section_group and
8589 include_linkonce_section.
8590 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
8591 value to zero when section is discarded.
8592 (Sized_relobj::map_to_kept_section): New function.
8593 * object.h (Relobj::output_section_address): New function.
8594 (Relobj::Comdat_group): New type.
8595 (Relobj::find_comdat_group): New function.
8596 (Relobj::Comdat_group_table): New type.
8597 (Relobj::Kept_comdat_section): New type.
8598 (Relobj::Kept_comdat_section_table): New type.
8599 (Relobj::add_comdat_group): New function.
8600 (Relobj::set_kept_comdat_section): New function.
8601 (Relobj::get_kept_comdat_section): New function.
8602 (Relobj::comdat_groups_): New field.
8603 (Relobj::kept_comdat_sections_): New field.
8604 (Symbol_value::input_value): Update comment.
8605 (Sized_relobj::map_to_kept_section) New function.
8606 (Sized_relobj::include_linkonce_section): Add new parameter.
8607 * target-reloc.h (Comdat_behavior): New type.
8608 (get_comdat_behavior): New function.
8609 (relocate_section): Add code to map a discarded section to the
8610 corresponding kept section when applying a relocation.
8612 2008-04-30 Craig Silverstein <csilvers@google.com>
8614 * dwarf_reader.cc (next_generation_count): New static var.
8615 (Addr2line_cache_entry): New struct.
8616 (addr2line_cache): New static var.
8617 (Dwarf_line_info::one_addr2line): Added caching.
8618 (Dwarf_line_info::clear_addr2line_cache): New function.
8619 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
8620 cache-size parameter.
8621 (Dwarf_line_info::one_addr2line_cache): New function.
8622 * symtab.cc (Symbol_table::detect_odr_violations): Pass
8623 new cache-size argument to one_addr2line(), and clear cache.
8625 2008-04-28 Cary Coutant <ccoutant@google.com>
8627 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
8628 R_386_PC8 relocations.
8630 2008-04-23 Ian Lance Taylor <iant@google.com>
8632 * object.cc (Sized_relobj::include_section_group): Check for
8633 invalid section group.
8635 * object.cc (make_elf_object): Correct test for 64-bit ELF file
8638 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
8639 than read for file header.
8640 * archive.cc (Archive::include_member): Likewise.
8642 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
8644 * aclocal.m4: Regenerate.
8645 * configure: Regenerate.
8647 2008-04-19 Ian Lance Taylor <iant@google.com>
8649 * version.cc (version_string): Bump to 1.6.
8651 * testsuite/Makefile.am (many_sections_r_test): New target.
8652 (many_sections_r_test_SOURCES): Remove.
8653 (many_sections_r_test_DEPENDENCIES): Remove.
8654 (many_sections_r_test_LDFLAGS): Remove.
8655 (many_sections_r_test_LDADD): Remove.
8657 * object.cc (Sized_relobj::do_add_symbols): Always pass
8658 local_symbol_count_ to add_from_relobj.
8660 * testsuite/Makefile.am (many_sections_check.h): Only check one in
8661 every thousand variables.
8662 * testsuite/Makefile.in: Rebuild.
8664 * object.cc (Xindex::initialize_symtab_xindex): New function.
8665 (Xindex::read_symtab_xindex): New function.
8666 (Xindex::sym_xindex_to_shndx): New function.
8667 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
8669 (Sized_relobj::do_initialize_xindex): New function.
8670 (Sized_relobj::do_read_symbols): Adjust section links.
8671 (Sized_relobj::symbol_section_and_value): Add is_ordinary
8672 parameter. Change all callers.
8673 (Sized_relobj::include_section_group): Adjust section links and
8674 symbol section indexes.
8675 (Sized_relobj::do_layout): Adjust section links.
8676 (Sized_relobj::do_count_local_symbols): Adjust section links and
8677 symbol section indexes.
8678 (Sized_relobj::do_finalize_local_symbols): Distinguish between
8679 ordinary and special symbols.
8680 (Sized_relobj::write_local_symbols): Add symtab_xindex and
8681 dynsym_xindex parameters. Change all callers. Adjust section
8682 links. Use SHN_XINDEX when needed.
8683 (Sized_relobj::get_symbol_location_info): Adjust section links.
8684 Don't get fooled by special symbols.
8685 * object.h (class Xindex): Define.
8686 (class Object): Add xindex_ parameter. Declare virtual functoin
8687 do_initialize_xindex.
8688 (Object::adjust_sym_shndx): New function.
8689 (Object::set_xindex): New protected function.
8690 (class Symbol_value): Add is_ordinary_shndx_ field.
8691 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
8692 (Symbol_value::value): Assert ordinary section.
8693 (Symbol_value::initialize_input_to_output_map): Likewise.
8694 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
8696 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
8698 (class Sized_relobj): Update declarations.
8699 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
8700 parameter. Change all callers.
8701 (Sized_relobj::adjust_shndx): New function.
8702 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
8704 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
8705 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
8706 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
8707 (Sized_dynobj::read_dynsym_section): Adjust section links.
8708 (Sized_dynobj::read_dynamic): Likewise.
8709 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
8711 (Sized_dynobj::do_initialize_xindex): New function.
8712 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
8713 do_initialize_xindex.
8714 (Sized_dynobj::adjust_shndx): New function.
8715 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
8716 dynsym_xindex_ fields.
8717 (Layout::finalize): Add a call to set_section_indexes before
8718 creating the symtab sections.
8719 (Layout::set_section_indexes): Don't do anything if the section
8720 already has a section index.
8721 (Layout::create_symtab_sections): Add shnum parameter. Change
8722 caller. Create .symtab_shndx section if needed.
8723 (Layout::create_shdrs): Add shstrtab_section parameter. Change
8725 (Layout::allocated_output_section_count): New function.
8726 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
8728 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
8729 fields. Update declarations.
8730 (Layout::symtab_xindex): New function.
8731 (Layout::dynsym_xindex): New function.
8732 (class Write_symbols_task): Add layout_ field.
8733 (Write_symbols_task::Write_symbols_task): Add layout parameter.
8735 * output.cc (Output_section_headers::Output_section_headers): Add
8736 shstrtab_section parameter. Change all callers.
8737 (Output_section_headers::do_sized_write): Store overflow values
8738 for section count and section string table section index in
8739 section header zero.
8740 (Output_file_header::do_sized_write): Check for overflow of
8741 section count and section string table section index.
8742 (Output_symtab_xindex::do_write): New function.
8743 (Output_symtab_xindex::endian_do_write): New function.
8744 * output.h (class Output_section_headers): Add shstrtab_section_.
8745 Update declarations.
8746 (class Output_symtab_xindex): Define.
8747 (Output_section::has_out_shndx): New function.
8748 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
8750 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
8752 (Sized_symbol::init): Likewise.
8753 (Symbol::output_section): Check for ordinary symbol.
8754 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
8755 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
8757 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
8758 Change all callers. Simplify handling of symbols from sections
8759 not included in the link.
8760 (Symbol_table::add_from_dynobj): Handle ordinary symbol
8762 (Weak_alias_sorter::operator()): Assert that symbols are
8764 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
8766 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
8767 parameters. Change all callers.
8768 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
8769 symbol distinction. Use SHN_XINDEX when needed.
8770 (Symbol_table::write_section_symbol): Add symtab_xindex
8771 parameter. Change all callers.
8772 (Symbol_table::sized_write_section_symbol): Likewise. Use
8773 SHN_XINDEX when needed.
8774 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
8776 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
8777 (Symbol::is_defined): Check is_ordinary.
8778 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
8779 (Symbol::is_absolute, Symbol::is_common): Likewise.
8780 (class Sized_symbol): Update declarations.
8781 (class Symbol_table): Update declarations.
8782 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
8783 parameters. Change all callers.
8784 (Sized_symbol::override): Likewise.
8785 (Symbol_table::override): Likewise.
8786 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
8787 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
8788 is_ordinary, and orig_st_shndx parameters. Change all callers.
8789 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
8790 to be in an ordinary section.
8791 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
8792 object and is_ordinary parameters. Change all callers.
8793 (Sized_dwarf_line_info::read_relocs): Add object parameter.
8794 Change all callers. Don't add undefined or non-ordinary symbols
8796 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
8798 * dwarf_reader.h (class Sized_dwarf_line_info): Update
8800 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
8801 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
8802 (Sized_relobj::relocate_sections): Likewise.
8803 * target-reloc.h (scan_relocs): Adjust section symbol index.
8804 (scan_relocatable_relocs): Likewise.
8805 * i386.cc (Scan::local): Check for ordinary symbols.
8806 * sparc.cc (Scan::local): Likewise.
8807 * x86_64.cc (Scan::local): Likewise.
8808 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
8809 to symbol_section_and_value.
8810 * testsuite/many_sections_test.cc: New file.
8811 * testsuite/Makefile.am (BUILT_SOURCES): Define.
8812 (check_PROGRAMS): Add many_sections_test.
8813 (many_sections_test_SOURCES): Define.
8814 (many_sections_test_DEPENDENCIES): Define.
8815 (many_sections_test_LDFLAGS): Define.
8816 (BUILT_SOURCES): Add many_sections_define.h.
8817 (many_sections_define.h): New target.
8818 (BUILT_SOURCES): Add many_sections_check.h.
8819 (many_sections_check.h): New target.
8820 (check_PROGRAMS): Add many_sections_r_test.
8821 (many_sections_r_test_SOURCES): Define.
8822 (many_sections_r_test_DEPENDENCIES): Define.
8823 (many_sections_r_test_LDFLAGS): Define.
8824 (many_sections_r_test_LDADD): Define.
8825 (many_sections_r_test.o): New target.
8826 * testsuite/Makefile.in: Rebuild.
8828 2008-04-17 Cary Coutant <ccoutant@google.com>
8830 * errors.cc (Errors::info): New function.
8831 (gold_info): New function.
8832 * errors.h (Errors::info): New function.
8833 * gold.h (gold_info): New function.
8834 * object.cc (Input_objects::add_object): Print trace output.
8835 * options.cc (options::parse_set): New function.
8836 (General_options::parse_wrap): Deleted.
8837 (General_options::General_options): Deleted initializer.
8838 * options.h (options::String_set): New typedef.
8839 (options::parse_set): New function.
8840 (DEFINE_set): New macro.
8841 (General_options::wrap): Changed to use DEFINE_set. Changed
8842 callers of any_wrap_symbols and is_wrap_symbol.
8843 (General_options::trace, General_options::trace_symbol):
8845 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
8846 (General_options::wrap_symbols_): Deleted.
8847 * symtab.cc (Symbol_table::add_from_object): Print trace output.
8849 2008-04-17 David S. Miller <davem@davemloft.net>
8851 * options.cc (General_options::parse_V): New function.
8852 * options.h: Add entries for -V and -Qy.
8854 2008-04-17 Ian Lance Taylor <iant@google.com>
8856 * common.cc (Symbol_table::allocate_commons): Remove options
8857 parameter. Change caller.
8858 (Symbol_table::do_allocate_commons): Remove options parameter.
8859 Change caller. Just call do_allocate_commons_list twice.
8860 (Symbol_table::do_allocate_commons_list): New function, broken out
8861 of do_allocate_commons.
8862 * common.h (class Allocate_commons_task): Remove options_ field.
8864 * symtab.cc (Symbol_table::Symbol_table): Initialize
8866 (Symbol_table::add_from_object): Put TLS common symbols on
8868 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
8869 which are IN_OUTPUT_DATA.
8870 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
8871 allocate_commons and do_allocate_commons declarations. Declare
8872 do_allocate_commons_list.
8873 * gold.cc (queue_middle_tasks): Update creation of
8874 Allocate_commons_task to not pass options.
8875 * testsuite/Makefile.am (INCLUDES): Add -I.. .
8876 (TLS_TEST_C_FLAGS): New variable.
8877 (tls_test_c_pic.o): New target.
8878 (tls_test_shared.so): Link in tls_test_c_pic.o.
8879 (tls_test_c_pic_ie.o): New target.
8880 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
8881 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
8882 (tls_test_c.o): New target.
8883 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
8884 (tls_pic_test_LDADD): Likewise.
8885 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
8886 (tls_shared_gd_to_ie_test_LDADD): Likewise.
8887 (tls_test_c_gnu2.o): New target.
8888 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
8890 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
8891 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
8892 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
8893 * testsuite/tls_test.cc: Include "config.h".
8894 (t_last): Call t11_last.
8895 * testsuite/tls_test.h (t11, t11_last): Declare.
8896 * testsuite/tls_test_c.c: New file.
8897 * testsuite/tls_test_main.cc (thread_routine): Call t11.
8898 * configure.ac: Check for OpenMP support.
8899 * configure, config.in, Makefile.in: Rebuild.
8900 * testsuite/Makefile.in: Rebuild.
8902 2008-04-16 Cary Coutant <ccoutant@google.com>
8904 * i386.cc (Target_i386::define_tls_base_symbol): New function.
8905 (Target_i386::tls_base_symbol_defined_): New field.
8906 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
8907 (Target_i386::Scan::global): Likewise.
8908 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
8909 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
8910 (Target_x86_64::tls_base_symbol_defined_): New field.
8911 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
8912 (Target_x86_64::Scan::global): Likewise.
8914 2008-04-16 Cary Coutant <ccoutant@google.com>
8916 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
8917 (Symbol::needs_plt_entry): Allow weak undefined symbols.
8918 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
8919 building shared libraries.
8920 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
8921 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
8922 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
8923 * testsuite/Makefile.in: Rebuild.
8924 * testsuite/weak_undef.h: New file.
8925 * testsuite/weak_undef_file1.cc: Add extra test cases.
8926 * testsuite/weak_undef_file2.cc: Likewise.
8927 * testsuite/weak_undef_test.cc: Likewise.
8929 2008-04-16 David S. Miller <davem@davemloft.net>
8931 * sparc.cc (Target_sparc::Scan): Change from struct to class.
8932 Add issued_non_pic_error_ field. Declare check_non_pic.
8933 (Target_sparc::Scan::check_non_pic): New function.
8934 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
8935 (Target_sparc::Scan::global): Likewise.
8937 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
8938 * configure: Rebuild.
8940 * options.h (DEFINE_enable): New macro.
8941 (new_dtags): New enable option.
8942 (initfirst, interpose, loadfltr, nodefaultlib,
8943 nodelete, nodlopen, nodump): New -z options.
8944 * layout.cc (Layout:finish_dynamic_section): If new
8945 dtags enabled, emit DT_RUNPATH. Also, emit a
8946 DT_FLAGS_1 containing any specified -z flags.
8948 2008-04-16 Ian Lance Taylor <iant@google.com>
8950 * copy-relocs.cc: New file.
8951 * copy-relocs.h: New file.
8952 * reloc.cc: Remove Copy_relocs code.
8953 * reloc.h: Likewise.
8954 * reloc-types.h (struct Reloc_types) [both versions]: Add
8955 get_reloc_addend_noerror.
8956 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
8957 variants of add_global which take an addend which must be zero.
8958 * i386.cc: Include "copy-relocs.h".
8959 (class Target_i386): Change type of copy_relocs_ to variable,
8961 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
8963 (Target_i386::do_finalize_sections): Change handling of
8965 * sparc.cc: Include "copy-relocs.h".
8966 (class Target_sparc): Change type of copy_relocs_ to variable,
8968 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
8970 (Target_sparc::do_finalize_sections): Change handling of
8972 * x86_64.cc: Include "copy-relocs.h".
8973 (class Target_x86_64): Change type of copy_relocs_ to variable,
8975 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
8976 class. Change all callers.
8977 (Target_x86_64::do_finalize_sections): Change handling of
8979 * Makefile.am (CCFILES): Add copy-relocs.cc.
8980 (HFILES): Add copy-relocs.h.
8982 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
8984 * testsuite/script_test_4.sh: Permit leading zeroes.
8986 2008-04-15 Ian Lance Taylor <iant@google.com>
8988 * script-sections.cc (Script_sections::create_segments): Use
8989 header_size_adjustment even when there is enough room for the
8991 * testsuite/script_test_4.sh: New file.
8992 * testsuite/script_test_4.t: New file.
8993 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
8994 (check_DATA): Add script_test_4.stdout.
8995 (MOSTLYCLEANFILES): Likewise.
8996 (script_test_4): New target.
8997 (script_test_4.stdout): New target.
8998 * testsuite/Makefile.in: Rebuild.
9000 * sparc.cc: Add definitions for Output_data_plt_sparc class
9003 2008-04-14 David S. Miller <davem@davemloft.net>
9005 * sparc.cc: New file.
9006 * Makefile.am (TARGETSOURCES): Add sparc.cc
9007 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
9008 * configure.tgt: Document targ_extra_size and
9009 targ_extra_big_endian. Add entries for sparc-* and
9011 * configure.ac: Handle targ_extra_size and
9012 targ_extra_big_endian.
9013 * Makefile.in: Rebuild.
9014 * configure: Likewise.
9015 * po/POTFILES.in: Likewise.
9016 * po/gold.pot: Likewise.
9018 2008-04-14 Ian Lance Taylor <iant@google.com>
9020 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
9021 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
9022 in the name/type/flags to section mapping. Don't call
9023 allocate_output_section.
9024 (Layout::choose_output_section): Change parameter from adjust_name
9025 to is_input_section. Don't permit input sections after sections
9026 are attached to segments. Don't call allocate_output_section.
9027 (Layout::layout_eh_frame): Call update_flags_for_input_section,
9028 not write_enable_output_section.
9029 (Layout::make_output_section): Don't push to
9030 unattached_section_list_ nor call attach_to_segment. Call
9031 attach_section_to_segment if sections are attached.
9032 (Layout::attach_sections_to_segments): New function.
9033 (Layout::attach_section_to_segment): New function.
9034 (Layout::attach_allocated_section_to_segment): Rename from
9035 attach_to_segment. Remove flags parameter.
9036 (Layout::allocate_output_section): Remove function.
9037 (Layout::write_enable_output_section): Remove function.
9038 * layout.h (class Layout): Update for above changes. Add new
9039 field sections_are_attached_.
9040 * output.h (Output_section::update_flags_for_input_section): New
9042 * output.cc (Output_section::add_input_section): Call
9043 update_flags_for_input_section.
9044 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
9046 2008-04-11 Cary Coutant <ccoutant@google.com>
9048 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
9049 thought unnecessary.
9050 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
9052 2008-04-11 Ian Lance Taylor <iant@google.com>
9054 * output.h (class Output_section_data): Remove inline definition
9056 * output.cc (Output_section_data::set_addralign): New function.
9058 2008-04-11 Cary Coutant <ccoutant@google.com>
9060 Add support for TLS descriptors for i386 and x86_64.
9061 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
9062 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
9063 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
9065 (Target_i386::got_mod_index_entry): Remove unnecessary code.
9066 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
9067 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
9069 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
9070 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
9071 Fix problem with initial-exec relocations.
9072 (Target_i386::Relocate::relocate_tls): Likewise.
9073 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
9075 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
9076 support for section-plus-offset dynamic table entries.
9077 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
9078 (Output_data_dynamic::Dynamic_entry): Add support for
9079 section-plus-offset dynamic table entries.
9080 (Output_data_dynamic::Classification): Likewise.
9081 (Output_data_dynamic::classification_): Renamed offset_.
9082 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
9083 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
9084 (Target_x86_64::make_plt_section): New function.
9085 (Target_x86_64::reserve_tlsdesc_entries): New function.
9086 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
9087 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
9088 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
9089 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
9090 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
9091 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
9092 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
9093 add extra PLT entry for TLS descriptors.
9094 (Output_data_plt_x86_64::got_): New field.
9095 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
9096 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
9098 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
9100 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
9101 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
9102 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
9103 R_386_TLS_DESC_CALL relocations.
9104 (Target_x86_64::Scan::global): Likewise.
9105 (Target_x86_64::do_finalize_sections): Add dynamic table entries
9106 for TLS descriptors.
9107 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
9108 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
9109 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
9110 GD-to-IE relaxation.
9111 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
9112 and TLS_DESCRIPTORS.
9113 * Makefile.in: Rebuild.
9114 * configure: Rebuild.
9115 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
9116 (tls_test_shared2.so): New target.
9117 (tls_shared_gd_to_ie_test_SOURCES): New variable.
9118 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
9119 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
9120 (tls_shared_gd_to_ie_test_LDADD): New variable.
9121 (tls_shared_gnu2_gd_to_ie_test): New target.
9122 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
9124 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
9125 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
9126 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
9127 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
9128 (tls_shared_gnu2_test): New target.
9129 (tls_test_gnu2_shared.so): New target.
9130 (tls_shared_gnu2_test_SOURCES): New variable.
9131 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
9132 (tls_shared_gnu2_test_LDFLAGS): New variable.
9133 (tls_shared_gnu2_test_LDADD): New variable.
9134 * testsuite/Makefile.in: Rebuild.
9135 * testsuite/Makefile.
9137 2008-04-11 Ian Lance Taylor <iant@google.com>
9139 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
9141 * testsuite/Makefile.in: Rebuild.
9143 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
9145 * testsuite/script_test_2.cc (main): Adjust test.
9147 2008-04-11 David S. Miller <davem@davemloft.net>
9148 Ian Lance Taylor <iant@google.com>
9150 * options.h (General_options): Add entries for '-Y' and
9152 * options.cc (General_options:finalize): If -Y was used, add those
9153 entries to the library path instead of the default "/lib" and
9156 2008-04-11 David S. Miller <davem@davemloft.net>
9158 * testsuite/justsyms.t: Start at 0x100.
9159 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
9160 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
9162 * testsuite/script_test_2.cc: Adjust string and section length
9165 2008-04-09 Ian Lance Taylor <iant@google.com>
9168 * script-sections.cc (Sections_element::allocate_to_segment): Add
9170 (Output_section_definition::allocate_to_segment): Likewise.
9171 (Orphan_output_section::allocate_to_segment): Likewise.
9172 (Script_sections::attach_sections_using_phdrs_clause): Don't
9173 propagate non-PT_LOAD segments to orphan sections.
9174 * testsuite/Makefile.am (script_test_3.stdout): Generate using
9175 readelf rather than objdump.
9176 * testsuite/script_test_3.sh: Adjust accordingly. Test that
9177 .interp section and PT_INTERP segment are the same size.
9178 * testsuite/Makefile.in: Rebuild.
9180 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
9181 aliases for symbols defined in the same object.
9182 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
9183 (weak_alias_test_SOURCES): New variable.
9184 (weak_alias_test_DEPENDENCIES): New variable.
9185 (weak_alias_test_LDFLAGS): New variable.
9186 (weak_alias_test_LDADD): New variable.
9187 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
9188 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
9189 (weak_alias_test_3.o): New target.
9190 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
9191 * testsuite/weak_alias_test_main.cc: New file.
9192 * testsuite/weak_alias_test_1.cc: New file.
9193 * testsuite/weak_alias_test_2.cc: New file.
9194 * testsuite/weak_alias_test_3.cc: New file.
9196 2008-04-08 Ian Lance Taylor <iant@google.com>
9198 * options.h (class General_options): Add --noinhibit-exec option.
9199 * main.cc (main): Check --noinhibit-exec.
9201 * options.h (class General_options): Define --wrap as a special
9202 option. Add wrap_symbols_ field.
9203 (General_options::any_wrap_symbols): New function.
9204 (General_options::is_wrap_symbol): New function.
9205 * options.cc (General_options::parse_wrap): New function.
9206 (General_options::General_options): Initialize wrap_symbols_.
9207 * symtab.cc (Symbol_table::wrap_symbol): New function.
9208 (Symbol_table::add_from_object): Handle --wrap.
9209 * symtab.h (class Symbol_table): Declare wrap_symbol.
9210 * target.h (Target::wrap_char): New function.
9211 (Target::Target_info): Add wrap_char field.
9212 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
9213 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9214 * testsuite/testfile.cc (Target_test::test_target_info):
9217 * errors.cc (Errors::undefined_symbol): Mention symbol version if
9220 * layout.h (class Layout): Add added_eh_frame_data_ field.
9221 * layout.cc (Layout::Layout): Initialize new field.
9222 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
9223 output section until we find a section we merged successfully.
9224 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
9225 that the size be non-zero.
9227 * merge.cc (Object_merge_map::get_output_offset): Remove inline
9230 2008-04-08 Craig Silverstein <csilvers@google.com>
9232 * configure.ac: Export new conditional variable HAVE_ZLIB.
9233 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
9235 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
9236 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
9238 2008-04-07 Ian Lance Taylor <iant@google.com>
9240 * version.cc (version_string): Set to "1.5".
9242 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
9243 Add issued_non_pic_error_ field. Declare check_non_pic.
9244 (Target_x86_64::Scan::check_non_pic): New function.
9245 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
9246 (Target_x86_64::Scan::global): Likewise.
9248 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
9249 addend parameter. Change caller. Handle merge sections.
9250 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
9251 Address to Addend. Don't add in the result of
9252 local_section_offset, pass down the addend and use the returned
9254 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
9255 Update declarations of local_section_offset and symbol_value.
9256 * testsuite/two_file_test_1.cc (t18): New function.
9257 * testsuite/two_file_test_2.cc (f18): New function.
9258 * testsuite/two_file_test_main.cc (main): Call t18.
9259 * testsuite/two_file_test.h (t18, f18): Declare.
9261 * configure.ac: Don't test for objdump, c++filt, or readelf.
9262 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
9264 (TEST_READELF): New variable.
9265 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
9266 (check_PROGRAMS): Add two_file_strip_test.
9267 (two_file_strip_test): New target.
9268 (check_PROGRAMS): Add two_file_same_shared_strip_test.
9269 (two_file_same_shared_strip_test_SOURCES): New variable.
9270 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
9271 (two_file_same_shared_strip_test_LDFLAGS): New variable.
9272 (two_file_same_shared_strip_test_LDADD): New variable.
9273 (two_file_shared_strip.so): New target.
9274 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
9275 (ver_test_5.syms, ver_test_7.syms): Likewise.
9276 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
9277 (strip_test_3.stdout): Use TEST_OBJDUMP.
9278 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
9280 2008-04-04 Cary Coutant <ccoutant@google.com>
9282 * symtab.h (Symbol::is_weak_undefined): New function.
9283 (Symbol::is_strong_undefined): New function.
9284 (Symbol::is_absolute): New function.
9285 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
9286 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
9288 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
9289 (weak_undef_test): New target.
9290 * testsuite/Makefile.in: Rebuild.
9291 * testsuite/weak_undef_file1.cc: New file.
9292 * testsuite/weak_undef_file2.cc: New file.
9293 * testsuite/weak_undef_test.cc: New file.
9295 2008-04-03 Craig Silverstein <csilvers@google.com>
9297 * compressed_output.h (class Output_compressed_section): Use
9299 * compressed_output.cc (zlib_compress): Use unsigned buffers,
9301 (zlib_compressed_suffix): Removed.
9302 (Output_compressed_section::set_final_data_size): Use unsigned
9304 * testsuite/Makefile.am (flagstest_compress_debug_sections):
9305 Fix linker invocation.
9306 (flagstest_o_specialfile_and_compress_debug_sections):
9308 * testsuite/Makefile.in: Regenerated.
9310 2008-04-02 David S. Miller <davem@davemloft.net>
9312 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
9313 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
9315 2008-04-02 Craig Silverstein <csilvers@google.com>
9319 2008-04-02 Ian Lance Taylor <iant@google.com>
9321 * fileread.cc (File_read::find_view): Add byteshift and vshifted
9322 parameters. Update for new key type to views_. Change all
9324 (File_read::read): Adjust for byteshift in returned view.
9325 (File_read::add_view): New function, broken out of
9327 (File_read::make_view): New function, broken out of
9329 (File_read::find_or_make_view): Add offset and aligned
9330 parameters. Rewrite accordingly. Change all callers.
9331 (File_read::get_view): Add offset and aligned parameters. Adjust
9332 for byteshift in return value.
9333 (File_read::get_lasting_view): Likewise.
9334 * fileread.h (class File_read): Update declarations.
9335 (class File_read::View): Add byteshift_ field. Add byteshift to
9336 constructor. Add byteshift method.
9337 * archive.h (Archive::clear_uncached_views): New function.
9338 (Archive::get_view): Add aligned parameter. Change all callers.
9339 * object.h (Object::get_view): Add aligned parameter. Change all
9341 (Object::get_lasting_view): Likewise.
9343 * fileread.cc (File_read::release): Don't call clear_views if
9344 there are multiple objects.
9345 * fileread.h (File_read::clear_uncached_views): New function.
9346 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
9349 2008-03-31 Cary Coutant <ccoutant@google.com>
9351 Add thin archive support.
9352 * archive.cc (Archive::armagt): New const.
9353 (Archive::setup): Remove task parameter and calls to unlock.
9354 (Archive::unlock_nested_archives): New function.
9355 (Archive::read_header): Add nested_off parameter. Change
9357 (Archive::interpret_header): Likewise.
9358 (Archive::include_all_members): Change to handle thin
9360 (Archive::include_member): Likewise.
9361 * archive.h (Archive::Archive): Add new parameters and
9363 (Archive::armagt): New const.
9364 (Archive::setup): Remove task parameter.
9365 (Archive::unlock_nested_archives): New function.
9366 (Archive::read_header): Add nested_off parameter.
9367 (Archive::interpret_header): Likewise.
9368 (Archive::Nested_archive_table): New typedef.
9369 (Archive::is_thin_archive_): New field.
9370 (Archive::nested_archives_): New field.
9371 (Archive::options_): New field.
9372 (Archive::dirpath_): New field.
9373 (Archive::task_): New field.
9374 * readsyms.cc (Read_symbols::do_read_symbols): Add check
9375 for thin archives. Pass additional parameters to
9376 Archive::Archive. Unlock the archive file after calling
9379 2008-03-29 Ian Lance Taylor <iant@google.com>
9381 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
9382 version symbol to be local.
9383 * testsuite/ver_test_4.sh: New file.
9384 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
9385 (check_DATA): Add ver_test_4.syms.
9386 (ver_test_4.syms): New target.
9387 * testsuite/Makefile.in: Rebuild.
9390 (Output_section::Input_section_sort_entry::has_priority): New
9392 (Output_section::Input_section_sort_entry::match_file_name): New
9394 (Output_section::Input_section_sort_entry::match_section_name):
9396 (Output_section::Input_section_sort_entry::match_section_name_prefix):
9398 (Output_section::Input_section_sort_entry::match_section_file):
9400 (Output_section::Input_section_sort_compare::operator()): Rewrite
9401 using new Input_section_sort_entry functions. Sort crtbegin and
9402 crtend first. Sort sections with no priority before sections with
9404 * testsuite/initpri1.c (d3): Check j != 4.
9405 (cd5): New constructor/destructor function.
9406 (main): Check j != 2.
9408 * symtab.cc (Symbol_table::add_from_object): If we don't use the
9409 new symbol when resolving, don't call set_is_default.
9410 * testsuite/ver_test_7.cc: New file.
9411 * testsuite/ver_test_7.sh: New file.
9412 * testsuite/Makefile.am (ver_test_7.so): New target.
9413 (ver_test_7.o): New target.
9414 (check_SCRIPTS): Add ver_test_7.sh.
9415 (check_DATA): Add ver_test_7.syms.
9416 (ver_test_7.syms): New target.
9418 2008-03-28 Ian Lance Taylor <iant@google.com>
9420 * layout.cc (Layout::layout): If we see an input section with a
9421 name that needs sorting, set the must_sort flag for the output
9423 (Layout::make_output_section): If the name of the output section
9424 indicates that it might require sorting, set the may_sort flag.
9425 * output.h (Output_section::may_sort_attached_input_sections): New
9427 (Output_section::set_may_sort_attached_input_sections): New
9429 (Output_section::must_sort_attached_input_sections): New
9431 (Output_section::set_must_sort_attached_input_sections): New
9433 (class Output_section): Declare Input_section_sort_entry. Define
9434 Input_section_sort_compare. Declare
9435 sort_attached_input_sections. Add new fields:
9436 may_sort_attached_input_sections_,
9437 must_sort_attached_input_sections_,
9438 attached_input_sections_are_sorted_.
9439 * output.cc (Output_section::Output_section): Initialize new
9441 (Output_section::add_input_section): Add an entry to
9442 input_sections_ if may_sort or must_sort are true.
9443 (Output_section::set_final_data_size): Call
9444 sort_attached_input_sections if necessary.
9445 (Output_section::Input_section_sort_entry): Define new class.
9446 (Output_section::Input_section_sort_compare::operator()): New
9448 (Output_section::sort_attached_input_sections): New function.
9449 * configure.ac: Check whether the compiler supports constructor
9450 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
9451 * testsuite/initpri1.c: New file.
9452 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
9453 CONSTRUCTOR_PRIORITY.
9454 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
9455 (initpri1_LDFLAGS): New variable.
9456 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
9458 2008-03-27 Ian Lance Taylor <iant@google.com>
9460 * common.cc (Sort_commons::operator): Correct sorting algorithm.
9461 * testsuite/common_test_1.c: New file.
9462 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
9463 (common_test_1_SOURCES): New variable.
9464 (common_test_1_DEPENDENCIES): New variable.
9465 (common_test_1_LDFLAGS): New variable.
9467 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
9468 and commons_ correctly when NAME/VERSION does not override
9470 * testsuite/ver_test_6.c: New file.
9471 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
9472 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
9473 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
9475 2008-03-26 Ian Lance Taylor <iant@google.com>
9477 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
9478 of an undefined symbol from a version script.
9479 * testsuite/Makefile.am (ver_test_5.so): New target.
9480 (ver_test_5.o): New target.
9481 (check_SCRIPTS): Add ver_test_5.sh.
9482 (check_DATA): Add ver_test_5.syms.
9483 (ver_test_5.syms): New target.
9484 * testsuite/ver_test_5.cc: New file.
9485 * testsuite/ver_test_5.script: New file.
9486 * testsuite/ver_test_5.sh: New file.
9487 * Makefile.in, testsuite/Makefile.in: Rebuild.
9490 Fix problems building gold with gcc 4.3.0.
9491 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
9492 (gold_error_at_location, gold_warning_at_location): Use it.
9493 * configure.ac: Check whether we can compile and use a template
9494 function with a printf attribute.
9495 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
9496 when jumping over bytes.
9497 * object.cc: Instantiate Object::read_section_data.
9498 * debug.h: Include <cstring>
9499 * dwarf_reader.cc: Include <algorithm>
9500 * main.cc: Include <cstring>.
9501 * options.cc: Include <cstring>.
9502 * output.cc: Include <cstring>.
9503 * script.cc: Include <cstring>.
9504 * script.h: Include <string>.
9505 * symtab.cc: Include <cstring> and <algorithm>.
9506 * target-select.cc: Include <cstring>.
9507 * version.cc: Include <string>.
9508 * testsuite/testmain.cc: Include <cstdlib>.
9509 * configure, config.in: Rebuild.
9511 2008-03-25 Ian Lance Taylor <iant@google.com>
9513 * options.cc: Include "../bfd/bfdver.h".
9514 (options::help): Print bug reporting address.
9516 * version.cc (print_version): Adjust output for current value of
9521 * options.cc (options::help): Print list of supported targets.
9522 * target-select.h: Include <vector>.
9523 (class Target_selector): Make machine_, size_, and is_big_endian_
9524 fields const. Add bfd_name_ and instantiated_target_ fields.
9525 (Target_selector::Target_selector): Add bfd_name parameter.
9526 (Target_selector::recognize): Make non-virtual, call
9528 (Target_selector::recognize_by_name): Make non-virtual, call
9529 do_recognize_by_name.
9530 (Target_selector::supported_names): New function.
9531 (Target_selector::bfd_name): New function.
9532 (Target_selector::do_instantiate_target): New pure virtual
9534 (Target_selector::do_recognize): New virtual function.
9535 (Target_selector::do_recognize_by_name): New virtual function.
9536 (Target_selector::instantiate_target): New private function.
9537 (supported_target_names): Declare.
9538 * target-select.cc (Target_selector::Target_selector): Update for
9539 new parameter and fields.
9540 (select_target_by_name): Check that the name matches before
9541 calling recognize_by_name.
9542 (supported_target_names): New function.
9543 * i386.cc (class Target_selector_i386): Update Target_selector
9544 constructor call. Remove recognize and recognize_by_name. Add
9545 do_instantiate_target.
9546 * x86_64.cc (class Target_selector_x86_64): Likewise.
9547 * testsuite/testfile.cc (class Target_selector_test): Update for
9548 changes to Target_selector.
9550 * README: Rewrite, with some notes on unsupported features.
9552 2008-03-24 Cary Coutant <ccoutant@google.com>
9554 * i386.cc (Target_i386::Got_type): New enum declaration.
9555 (Target_i386::Scan::local): Updated callers of Output_data_got
9557 (Target_i386::Scan::global): Likewise.
9558 (Target_i386::Relocate::relocate): Likewise.
9559 (Target_i386::Relocate::relocate_tls): Likewise.
9560 * object.h (Got_offset_list): New class.
9561 (Sized_relobj::local_has_got_offset): Added got_type parameter.
9562 (Sized_relobj::local_got_offset): Likewise.
9563 (Sized_relobj::set_local_got_offset): Likewise.
9564 (Sized_relobj::local_has_tls_got_offset): Removed.
9565 (Sized_relobj::local_tls_got_offset): Removed.
9566 (Sized_relobj::set_local_tls_got_offset): Removed.
9567 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
9568 * output.cc (Output_data_got::add_global): Added got_type parameter.
9569 (Output_data_got::add_global_with_rel): Likewise.
9570 (Output_data_got::add_global_with_rela): Likewise.
9571 (Output_data_got::add_global_pair_with_rel): New function.
9572 (Output_data_got::add_global_pair_with_rela): New function.
9573 (Output_data_got::add_local): Added got_type parameter.
9574 (Output_data_got::add_local_with_rel): Likewise.
9575 (Output_data_got::add_local_with_rela): Likewise.
9576 (Output_data_got::add_local_pair_with_rel): New function.
9577 (Output_data_got::add_local_pair_with_rela): New function.
9578 (Output_data_got::add_global_tls): Removed.
9579 (Output_data_got::add_global_tls_with_rel): Removed.
9580 (Output_data_got::add_global_tls_with_rela): Removed.
9581 (Output_data_got::add_local_tls): Removed.
9582 (Output_data_got::add_local_tls_with_rel): Removed.
9583 (Output_data_got::add_local_tls_with_rela): Removed.
9584 * output.h (Output_data_got::add_global): Added got_type parameter.
9585 (Output_data_got::add_global_with_rel): Likewise.
9586 (Output_data_got::add_global_with_rela): Likewise.
9587 (Output_data_got::add_global_pair_with_rel): New function.
9588 (Output_data_got::add_global_pair_with_rela): New function.
9589 (Output_data_got::add_local): Added got_type parameter.
9590 (Output_data_got::add_local_with_rel): Likewise.
9591 (Output_data_got::add_local_with_rela): Likewise.
9592 (Output_data_got::add_local_pair_with_rel): New function.
9593 (Output_data_got::add_local_pair_with_rela): New function.
9594 (Output_data_got::add_global_tls): Removed.
9595 (Output_data_got::add_global_tls_with_rel): Removed.
9596 (Output_data_got::add_global_tls_with_rela): Removed.
9597 (Output_data_got::add_local_tls): Removed.
9598 (Output_data_got::add_local_tls_with_rel): Removed.
9599 (Output_data_got::add_local_tls_with_rela): Removed.
9600 * resolve.cc (Symbol::override_base_with_special): Removed
9601 reference to has_got_offset_ field.
9602 * symtab.cc (Symbol::init_fields): Replaced initialization
9603 of got_offset_ with got_offsets_. Removed initialization
9605 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
9606 (Symbol::got_offset): Likewise.
9607 (Symbol::set_got_offset): Likewise.
9608 (Symbol::has_tls_got_offset): Removed.
9609 (Symbol::tls_got_offset): Removed.
9610 (Symbol::set_tls_got_offset): Removed.
9611 (Symbol::got_offset_): Removed.
9612 (Symbol::tls_mod_got_offset_): Removed.
9613 (Symbol::tls_pair_got_offset_): Removed.
9614 (Symbol::got_offsets_): New field.
9615 (Symbol::has_got_offset): Removed.
9616 (Symbol::has_tls_mod_got_offset): Removed.
9617 (Symbol::has_tls_pair_got_offset): Removed.
9618 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
9619 (Target_x86_64::Scan::local): Updated callers of Output_data_got
9621 (Target_x86_64::Scan::global): Likewise.
9622 (Target_x86_64::Relocate::relocate): Likewise.
9623 (Target_x86_64::Relocate::relocate_tls): Likewise.
9625 2008-03-25 Ben Elliston <bje@au.ibm.com>
9627 * yyscript.y: Fix spelling error in comment.
9629 2008-03-24 Ian Lance Taylor <iant@google.com>
9631 * options.h (class General_options): Define build_id option.
9632 * layout.h (class Layout): Declare write_build_id, create_note,
9633 create_build_id. Add build_id_note_ member.
9634 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
9635 "libiberty.h", "md5.h", "sha1.h".
9636 (Layout::Layout): Initialize eh_frame_data_,
9637 eh_frame_hdr_section_, and build_id_note_.
9638 (Layout::finalize): Call create_build_id.
9639 (Layout::create_note): New function, broken out of
9640 Layout::create_gold_note.
9641 (Layout::create_gold_note): Call create_note.
9642 (Layout::create_build_id): New function.
9643 (Layout::write_build_id): New function.
9644 (Close_task_runner::run): Call write_build_id.
9646 * x86_64.cc: Correct license to GPLv3.
9648 2008-03-23 Ian Lance Taylor <iant@google.com>
9650 * options.cc: Include "demangle.h".
9651 (parse_optional_string): New function.
9652 (parse_long_option): Handle takes_optional_argument.
9653 (parse_short_option): Update dash_z initializer. Handle
9654 takes_optional_argument.
9655 (General_options::General_options): Initialize do_demangle_.
9656 (General_options::finalize): Set do_demangle_. Handle demangling
9658 * options.h (parse_optional_string): Declare.
9659 (struct One_option): Add optional_arg field. Update constructor.
9660 Update call constructor calls. Add takes_optional_argument
9662 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
9663 (DEFINE_optional_string): Define.
9664 (General_options::demangle): Change from DEFINE_bool to
9665 DEFINE_optional_string.
9666 (General_options::no_demangle): New function.
9667 (General_options::do_demangle): New function.
9668 (General_options::set_do_demangle): New function.
9669 (General_options::execstack_status_): Move definition to end of
9671 (General_options::static_): Likewise.
9672 (General_options::do_demangle_): New field.
9673 * object.cc (big_endian>::get_symbol_location_info): Call
9674 Options::do_demangle, not Options::demangle.
9675 * symtab.cc (demangle): Likewise.
9677 2008-03-22 Ian Lance Taylor <iant@google.com>
9679 * gold.h: Include <cstddef> and <sys/types.h>
9680 * options.h: Include <cstring>.
9682 2008-03-21 Ian Lance Taylor <iant@google.com>
9684 * Added source code to GNU binutils.