1 2010-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
3 * plugin.cc (is_visible_from_outside): Return true for symbols
6 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
8 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
11 2011-02-02 Sriraman Tallam <tmsriram@google.com>
13 * icf.h (is_section_foldable_candidate): Change type of parameter
15 * icf.cc (Icf::find_identical_sections): Change type of local variable
16 section_name to be std::string.
17 (is_function_ctor_or_dtor): Change type of parameter to std::string.
19 2011-01-25 Ian Lance Taylor <iant@google.com>
21 * script.cc (script_add_extern): Rewrite to use
24 2011-01-25 Doug Kwan <dougkwan@google.com>
26 * icf.cc (get_section_contents): Always lock section's object.
28 2011-01-24 Ian Lance Taylor <iant@google.com>
30 * options.h (class General_options): Accept
31 --no-detect-odr-violations.
33 2011-01-24 Ian Lance Taylor <iant@google.com>
35 * version.cc (version_string): Bump to 1.11.
37 2011-01-24 Ian Lance Taylor <iant@google.com>
39 * plugin.cc (class Plugin_rescan): Define new class.
40 (Plugin_manager::claim_file): Set any_claimed_.
41 (Plugin_manager::save_archive): New function.
42 (Plugin_manager::save_input_group): New function.
43 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
45 (Plugin_manager::new_undefined_symbol): New function.
46 (Plugin_manager::rescan): New function.
47 (Plugin_manager::rescannable_defines): New function.
48 (Plugin_manager::add_input_file): Set any_added_.
49 * plugin.h (class Plugin_manager): define new fields rescannable_,
50 undefined_symbols_, any_claimed_, and any_added_. Declare
51 Plugin_rescan as friend. Declare new functions.
52 (Plugin_manager::Rescannable): Define type.
53 (Plugin_manager::Rescannable_list): Define type.
54 (Plugin_manager::Undefined_symbol_list): Define type.
55 (Plugin_manager::Plugin_manager): Initialize new fields.
56 * archive.cc (Archive::defines_symbol): New function.
57 (Add_archive_symbols::run): Pass archive to plugins if any.
58 * archive.h (class Archive): Declare defines_symbol.
59 * readsyms.cc (Input_group::~Input_group): New function.
60 (Finish_group::run): Pass input_group to plugins if any.
61 * readsyms.h (class Input_group): Declare destructor.
62 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
65 2011-01-10 Ian Lance Taylor <iant@google.com>
67 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
69 (Layout::set_segment_offsets): Reset increase_relro before calling
70 set_section_addresses a second time.
72 2011-01-04 Cary Coutant <ccoutant@google.com>
74 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
75 sections before NOBITS sections.
77 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
79 * version.cc (print_version): Update copyright to 2011.
81 2010-12-23 Cary Coutant <ccoutant@google.com>
83 * output.h (Output_data_reloc::add_output_section): Pass OD instead
84 of OS to this->add. Add OD parameter to second form of the function.
86 2010-12-20 Ian Lance Taylor <iant@google.com>
88 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
89 second of two consecutive entries with same offset.
91 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
93 * testsuite/Makefile.am (ifuncmain2static_LDADD)
94 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
95 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
96 to avoid unneeded links against $(LDADD).
97 * testsuite/Makefile.in: Regenerate.
99 2010-12-15 Ian Lance Taylor <iant@google.com>
102 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
103 for R_X86_64_32 and R_X86_64_PC32.
104 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
105 ver_matching_def_pic.o.
106 (ver_matching_def_pic.o): New target.
108 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
110 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
111 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
112 Move definition before File_read::View member definitions.
113 (File_read::View::~View): Initialize and hold lock before
114 updating current_mapped_bytes.
116 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
118 * dwarf_reader.cc: Remove outdated comment.
119 * gold-threads.cc: Fix typo in error message.
120 * archive.cc: Fix typos in comments.
121 * archive.h: Likewise.
122 * arm-reloc-property.cc: Likewise.
123 * arm-reloc-property.h: Likewise.
124 * arm-reloc.def: Likewise.
126 * attributes.h: Likewise.
128 * ehframe.cc: Likewise.
129 * fileread.h: Likewise.
133 * incremental.h: Likewise.
134 * int_encoding.cc: Likewise.
135 * layout.h: Likewise.
138 * object.cc: Likewise.
139 * object.h: Likewise.
140 * options.cc: Likewise.
141 * readsyms.cc: Likewise.
142 * reduced_debug_output.cc: Likewise.
143 * reloc.cc: Likewise.
144 * script-sections.cc: Likewise.
145 * sparc.cc: Likewise.
146 * symtab.h: Likewise.
147 * target-reloc.h: Likewise.
148 * target.cc: Likewise.
149 * target.h: Likewise.
150 * timer.cc: Likewise.
152 * x86_64.cc: Likewise.
154 2010-12-09 Cary Coutant <ccoutant@google.com>
156 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
158 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
159 parameter; change all callers.
160 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
161 * options.h (warn_execstack): New option.
163 2010-12-07 Doug Kwan <dougkwan@google.com>
165 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
166 like function call relocations.
168 2010-12-07 Ian Lance Taylor <iant@google.com>
170 * archive.cc (Archive::get_elf_object_for_member): Permit
171 punconfigured to be NULL.
172 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
173 (Archive::include_member): Pass NULL to get_elf_object_for_member
174 if we searched for the archive and this is the first included
177 2010-12-01 Ian Lance Taylor <iant@google.com>
179 * dwarf_reader.h (class Sized_dwarf_line_info): Add
180 track_relocs_type_ field.
181 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
182 Set track_relocs_type_.
183 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
184 contents when using RELA relocs.
185 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
187 * reloc.cc (Track_relocs::next_addend): New function.
188 * reloc.h (class Track_relocs): Declare next_addend.
190 2010-12-01 Ian Lance Taylor <iant@google.com>
192 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
195 2010-12-01 Ian Lance Taylor <iant@google.com>
197 * README: Update compilers known to work and fail.
199 2010-11-23 Matthias Klose <doko@ubuntu.com>
201 * configure.in: For --enable-gold, handle value `default' instead of
202 `both*'. Always install ld as ld.bfd, install as ld if gold is
204 * configure: Regenerate.
206 2010-11-18 Doug Kwan <dougkwan@google.com>
208 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
209 and right_alignment to be zero. Store result alignment only if it is
210 greater than existing alignment.
212 2010-11-16 Cary Coutant <ccoutant@google.com>
215 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
216 Check for ".zdebug_line".
218 2010-11-16 Doug Kwan <dougkwan@google.com>
219 Cary Coutant <ccoutant@google.com>
221 * output.h (Output_segment::set_section_addresses): Pass increase_relro
222 by reference; adjust all callers.
223 * output.cc (Output_segment::set_section_addresses): Adjust references
224 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
226 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
227 end at page boundary.
229 2010-11-16 Cary Coutant <ccoutant@google.com>
232 * layout.cc (Layout::choose_output_section): Transform names of
233 compressed sections even when using a script with a SECTIONS clause.
234 (Layout::output_section_name): Remove code to transform
235 compressed debug section names.
236 * output.cc (Output_section::add_input_section): Use uncompressed
237 section size when tracking input sections.
239 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
241 * symtab.h (Symbol::NON_PIC_REF): Remove.
242 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
243 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
244 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
245 (Symbol::use_plt_offset): Take a flags argument and pass it
246 directly to needs_dynamic_reloc. Restrict check for undefined
247 weak symbols to function calls.
248 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
249 (Target_arm::Scan::global): Use it.
250 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
251 (Target_arm::Relocate::relocate): Likewise.
252 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
253 parameter with an r_type parameter. Use get_reference_flags
255 (Target_arm::Relocate::relocate): Update accordingly.
256 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
257 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
258 (Target_i386::Scan::global): Likewise.
259 (Target_i386::Relocate::relocate): Likewise.
260 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
261 parameter with an r_type parameter. Use get_reference_flags
263 (Target_i386::Relocate::relocate): Update accordingly.
264 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
265 (Target_powerpc::Scan::global): Use it.
266 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
267 (Target_powerpc::Relocate::relocate): Likewise.
268 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
269 (Target_sparc::Scan::global): Use it.
270 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
271 (Target_sparc::Relocate::relocate): Likewise.
272 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
273 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
274 (Target_x86_64::Scan::global): Likewise.
275 (Target_x86_64::Relocate::relocate): Likewise.
277 2010-11-08 Doug Kwan <dougkwan@google.com>
278 Cary Coutant <ccoutant@google.com>
280 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
281 (Arm_exidx_merge_section::section_contents_): New data member.
282 (Arm_input_section::Arm_input_section): Initialize original_contents_.
283 (Arm_input_section::~Arm_input_section): De-allocate memory.
284 (Arm_input_section::original_contents_): New data member.
285 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
286 in parameters instead of calling Object::section_contents without
288 (Arm_output_section::group_section): New parameter TASK. Pass it
289 to callees that need locking objects.
290 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
291 to lock EXIDX input sections. Fix a formatting issue. Call
292 Arm_exidx_merged_section::build_contents to create merged section
294 (Arm_output_section::create_stub_group): New parameter TASK. Use it
295 to lock object of stub table owner.
296 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
297 TEXT_SIZE to initialize data member TEXT_SIZE_.
298 (Arm_exidx_input_section::addralign): Fix typo in comment.
299 (Arm_exidx_input_section::text_size): New method.
300 (Target_arm::do_relax): New parameter TASK. Pass it to callees
301 that require locking objects. Lock objects before scanning for stubs
302 and updating local symbols.
303 (Arm_input_section<big_endian>::init): Copy contents of original
305 (Arm_input_section<big_endian>::do_write): Use saved contents of
306 original input section instead of calling Object::section_contents
308 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
309 size without calling Object::section_size().
310 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
311 for size. Allocate a buffer for merged EXIDX entries.
312 (Arm_exidx_merged_section::build_contents): New method.
313 (Arm_exidx_merged_section::do_write): Move merge section contents
314 building code to Arm_exidx_merged_section::build_contetns. Write
315 out contetns in buffer instead of building it on the fly.
316 (Arm_relobj::make_exidx_input_section): Also pass text section size
317 to Arm_exidx_input_section constructor.
318 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
319 (Arm_dynobj::do_read_symbols): Fix memory leak.
320 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
321 * target.h: (class Task): Add forward declaration.
322 (Target::relax): Add new parameter TASK and pass it to
324 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
326 2010-11-05 Cary Coutant <ccoutant@google.com>
329 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
330 object when reading from the file.
331 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
333 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
334 when reading section contents.
335 (get_section_contents): Likewise.
336 (icf::find_identical_sections): Likewise.
337 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
338 object when reading from the file.
339 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
340 the object when doing deferred section layout.
342 2010-11-03 Nick Clifton <nickc@redhat.com>
345 * script.h (class Symbol_assignment: name): New member. Returns
346 the name of the symbol.
347 * scrfipt.cc (Script_options::is_pending_assignment): New member.
348 Returns true if the given symbol name is on the list of
349 assignments wating to be processed.
350 * archive.cc (should_incldue_member): If the symbol is undefined,
351 check to see if it is on the list of symbols pending assignment.
353 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
355 * script-sections.cc (Script_sections::find_memory_region): Check
356 for a NULL output section pointer.
358 2010-10-29 Doug Kwan <dougkwan@google.com>
360 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
361 Output_section::add_relaxed_input_section.
362 * output.cc (Output_section::add_relaxed_input_section): Add new
363 arguments LAYOUT and NAME. Set section order index.
364 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
365 Copy section order index.
366 * output.h (Output_section::add_relaxed_input_section): Add new
367 arguments LAYOUT and NAME.
369 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
371 * testsuite/Makefile.am: Move gcctestdir/ld rule to
372 NATIVE_OR_CROSS_LINKER.
373 * testsuite/Makefile.in: Regenerate.
375 2010-10-20 Doug Kwan <dougkwan@google.com>
377 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
378 without SHF_LINK_ORDER flags.
379 * layout.cc (Layout::choose_output_section): Do not filter
380 SHF_LINK_ORDER flag in a relocatable link.
382 2010-10-17 Cary Coutant <ccoutant@google.com>
384 * output.h (Output_segment::set_section_addresses): Change function
385 signature. Update all callers.
386 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
388 (Output_segment::set_section_addresses): Align after last TLS
389 section. Add padding before last relro section instead of after.
391 2010-10-17 Doug Kwan <dougkwan@google.com>
393 * gold/arm.cc (Target_arm::got_section): Use correct order and set
394 GOT output section to be writable.
396 2010-10-14 Cary Coutant <ccoutant@google.com>
398 * debug.h (DEBUG_INCREMENTAL): New flag.
399 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
400 * gold.cc (queue_initial_tasks): Check parameters for incremental link
402 * incremental.cc (report_command_line): Ignore all forms of
404 * layout.cc (Layout::Layout): Check parameters for incremental link
406 * options.cc (General_options::parse_incremental): New function.
407 (General_options::parse_no_incremental): New function.
408 (General_options::parse_incremental_full): New function.
409 (General_options::parse_incremental_update): New function.
410 (General_options::incremental_mode_): New data member.
411 (General_options::finalize): Check incremental_mode_.
412 * options.h (General_options): Update help text for --incremental.
413 Add --no-incremental, --incremental-full, --incremental-update.
414 (General_options::Incremental_mode): New enum type.
415 (General_options::incremental_mode): New function.
416 (General_options::incremental_mode_): New data member.
417 * parameters.cc (Parameters::incremental_mode_): New data member.
418 (Parameters::set_options): Set incremental_mode_.
419 (Parameters::set_incremental_full): New function.
420 (Parameters::incremental): New function.
421 (Parameters::incremental_update): New function.
422 (set_parameters_incremental_full): New function.
423 * parameters.h (Parameters::set_incremental_full): New function.
424 (Parameters::incremental): New function.
425 (Parameters::incremental_update): New function.
426 (Parameters::incremental_mode_): New data member.
427 (set_parameters_incremental_full): New function.
428 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
429 incremental link mode.
430 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
431 (Sized_relobj::do_relocate_sections): Likewise.
432 * testsuite/Makefile.am (incremental_test): Use --incremental-full
434 * testsuite/Makefile.in: Regenerate.
435 * testsuite/incremental_test.sh: Filter all forms of --incremental.
437 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
439 * script-sections.h (class Script_sections): Make
440 Sections_elements typedef public.
441 * script-sections.cc (class Sort_output_sections): Add elements_
442 field. Add constructor which sets it; change all callers.
443 (Sort_output_sections::is_before): New function.
444 (Sort_output_sections::operator()): Call is_before.
445 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
447 * testsuite/script_test_10.sh: New test. Test script section
449 * testsuite/script_test_10.t: Likewise.
450 * testsuite/script_test_10.s: Likewise.
451 * testsuite/Makefile.am: Wrap the cross linker tests and the
452 common tests into NATIVE_OR_CROSS_LINKER.
453 (check_SCRIPTS): Add script_test_10.sh.
454 (check_DATA): Add script_test_10.stdout.
455 (script_test_10.o, script_test_10): New targets.
456 (script_test_10.stdout): New target.
457 * configure, testsuite/Makefile.in: Regenerate.
459 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
461 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
462 error for the deprecated relocations.
463 (Target_arm::Scan::global): Likewise.
464 (Target_arm::Relocate::relocate): Likewise.
466 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
468 * fileread.cc (Input_file::find_file): Initialize *found_name
469 and *namep when using the fallback search for case 4.
471 2010-10-11 Cary Coutant <ccoutant@google.com>
473 * options.h (class General_options): Redefine -z lazy as an alias for
474 the negation of -z now.
476 2010-10-11 Ian Lance Taylor <iant@google.com>
478 * resolve.cc (symbol_to_bits): Report the value of the unsupported
481 2010-10-06 Nick Clifton <nickc@redhat.com>
483 * script-sections.cc(class Memory_region): Remove
484 current_lma_offset_ field. Rename current_vma_offset_ to
485 current_offset_. Add last_section_ field.
486 (Memory_region::get_current_vma_address): Rename to
488 (Memory_region::get_current_lma_address): Delete.
489 (Memory_region::increment_vma_offset): Rename to
491 (Memory_region::increment_lma_offset): Delete.
492 (Memory_region::attributes_compatible): New method. Returns
493 true if the provided section is compatible with the region.
494 (Memory_region::get_last_section): New method. Returns the last
495 section to use the region.
496 (Memory_region::set_last_section): New method. Stores the last
497 section to use the region.
498 (Script_sections::block_in_region): New method. Returns true if
499 a block of memory is contained within a region.
500 (Script_sections::find_memory_region): New method. Locates a
501 memory region to be used to set a VMA or LMA address.
502 (Output_section_definition::set_section_addresses): Add code to
503 check for addresses set by memory regions.
504 (Output_segment::set_section_addresses): Remove memory region
506 (Script_sections::create_segment): Add a warning if a header
507 segment is created outside of any region.
508 * script-sections.h (class Script_sections): Add prototypes for
509 find_memory_region and block_in_region methods.
510 * testsuite/memory_test.s: Use .long instead of .word.
511 * testsuite/memory_test.t: Add some more output sections.
512 * testsuite/memory_test.sh: Update expected output.
514 2010-10-02 Doug Kwan <dougkwan@google.com>
516 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
517 defintion to symtab.h
518 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
519 declaration to defintion.
521 2010-10-01 Nick Clifton <nickc@redhat.com>
523 * expression.cc (eval): Replace dummy argument with NULL.
524 (eval_maybe_dot): Check for a NULL result section pointer.
525 (Symbol_expression::value): Likewise.
526 (Dot_expression::value): Likewise.
527 (BINARY_EXPRESSION): Likewise.
528 (Max_expression::value): Likewise.
529 (Min_expression::value): Likewise.
530 (Absolute_expression::value): Likewise.
531 (Addr_expression::value_from_output_section): Likewise.
532 (Loaddddr_expression::value_from_output_section): Likewise.
533 (Segment_start_expression::value): Likewise.
535 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
537 (Sections_elememt_dot_assignment::set_section_addresses):
539 (Output_data_expression::do_write_to_buffer): Likewise.
540 (Output_section_definition::finalize_symbols): Likewise.
541 (Output_section_definition::set_section_addresses): Likewise.
543 2010-09-30 Doug Kwan <dougkwan@google.com>
545 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
547 2010-09-28 Sriraman Tallam <tmsriram@google.com>
549 * target.h (Target::can_icf_inline_merge_sections): New virtual
551 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
553 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
555 * icf.cc (get_section_contents): Inline merge sections only when
558 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
560 * configure: Regenerate.
562 2010-09-17 Ian Lance Taylor <iant@google.com>
564 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
565 * testsuite/Makefile.am (memory_test.o): New target.
566 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
568 * testsuite/Makefile.in: Rebuild.
570 2010-09-17 Doug Kwan <dougkwan@google.com>
572 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
573 defintion if relocation uses GOT entries of the symbol.
574 * testsuite/icf_safe_test.sh: Fix test.
575 * testsuite/icf_safe_so_test.sh: Fix test.
577 2010-09-16 Cary Coutant <ccoutant@google.com>
579 * script_sections.cc (class Memory_region): Remove "NULL" from
580 vector initializations.
582 2010-09-15 Cary Coutant <ccoutant@google.com>
584 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
585 Resolve forwarding symbols.
587 2010-09-15 Doug Kwan <dougkwan@google.com>
589 * gold/testsuite/script_test_3.t: Add ARM special sections.
590 * gold/testsuite/script_test_4.t: Same.
591 * gold/testsuite/script_test_5.t: Same.
592 * gold/testsuite/script_test_6.t: Same.
593 * gold/testsuite/script_test_7.t: Same.
594 * gold/testsuite/script_test_7.t: Same.
595 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
597 2010-09-14 Cary Coutant <ccoutant@google.com>
599 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
600 (Target_x86_64::Relocate::relocate_tls): Replace check for
601 saw_tls_block_reloc_ with test for executable section.
603 2010-09-12 Cary Coutant <ccoutant@google.com>
605 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
606 position-independent executables to shared libraries need dynamic
608 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
609 position-independent executables.
610 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
611 * testsuite/Makefile.in: Regenerate.
613 2010-09-10 Nick Clifton <nickc@redhat.com>
616 * testsuite/memory_test.t: Discard any sections that are not
619 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
622 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
623 "This::" to work around a bug in gcc 4.2.
625 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
627 2010-09-09 Rafael Espindola <espindola@google.com>
629 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
630 sections with different PF_X flags in the same segment.
631 (Layout::find_first_load_seg): Search all segments to find the first
633 * options.h (rosegment): New.
635 2010-09-08 Rafael Espindola <espindola@google.com>
637 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
639 2010-09-08 Doug Kwan <dougkwan@google.com>
641 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
642 (Arm_relobj::do_relocate_sections): Add new parameter for output
643 file to match the parent.
644 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
645 of local symbols instead of input values. Update code to track
646 changes in gold::relocate_section.
647 * object.cc (Sized_relobj::compute_final_local_value): New methods.
648 (Sized_relobj::compute_final_local_value_internal): New methods.
649 (Sized_relobj::do_finalize_local_symbols): Move code from loop
650 body into private version of Sized_relobj::compute_final_local_value.
651 Call the inline method.
652 * object.h (Symbol_value::Symbol_value): Define destructor. Free
653 merged symbol value if there is one.
654 (Symbol_value::has_output_value): New method defintiion.
655 (Sized_relobj::Compute_final_local_value_status): New enum type.
656 (Sized_relobj::compute_final_local_value): New methods.
657 (Sized_relobj::compute_final_local_value_internal): New methods.
658 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
659 and arm_cortex_a8.sh.
660 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
661 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
663 * Makefile.in: Regenerate.
664 * testsuite/arm_bl_out_of_range.s: Update test.
665 * testsuite/thumb_bl_out_of_range.s: Ditto.
666 * testsuite/thumb_blx_out_of_range.s: Ditto.
667 * testsuite/arm_branch_out_of_range.sh: New file.
668 * testsuite/arm_cortex_a8.sh: Ditto.
669 * testsuite/arm_cortex_a8_b.s: Ditto.
670 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
671 * testsuite/arm_cortex_a8_b_local.s: Ditto.
672 * testsuite/arm_cortex_a8_bl.s: Ditto.
673 * testsuite/arm_cortex_a8_blx.s: Ditto.
674 * testsuite/arm_cortex_a8_local.s: Ditto.
675 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
676 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
678 2010-09-08 Rafael Espindola <espindola@google.com>
680 * Makefile.am (memory_test.stdout): Run readelf with -W.
681 * Makefile.in: Regenerate.
682 * testsuite/memory_test.sh: Make the regexps accept both 32 and
685 2010-09-08 Rafael Espindola <espindola@google.com>
687 * script-sections.cc (Script_sections::add_memory_region): Convert
688 field precision to int.
689 * script.cc (script_set_section_region, script_set_section_region):
690 Convert field precision to int.
692 2010-09-08 Rafael Espindola <espindola@google.com>
694 * arm.cc (do_finalize_sections): Create the __exidx_start and
695 __exdix_end symbols even when the section is missing.
697 2010-09-08 Nick Clifton <nickc@redhat.com>
699 * README: Remove claim that MEMORY is not supported.
700 * expression.cc (script_exp_function_origin)
701 (script_exp_function_length): Move from here to ...
702 * script.cc: ... here.
703 (script_set_section_region, script_add_memory)
704 (script_parse_memory_attr, script_include_directive): New
707 (class Memory_region): New class.
708 (class Output_section_definition): Add set_memory_region,
709 set_section_vma, set_section_lma and get_section_name methods.
710 (class Script_Sections): Add add_memory_region,
711 find_memory_region, find_memory_region_origin,
712 find_memory_region_length and set_memory_region methods.
713 Have set_section_addresses method walk the list of set memory
715 Extend the print methos to display memory regions.
716 * script-sections.h: Add prototypes for new methods.
717 Add enum for MEMORY region attributes.
718 * yyscript.y: Add support for parsing MEMORY regions.
719 * script-c.h: Add prototypes for new functions.
720 * testsuite/Makefile.am: Add test of MEMORY region functionality.
721 * testsuite/Makefile.in: Regenerate.
722 * testsuite/memory_test.sh: New script.
723 * testsuite/memory_test.s: New assembler source file.
724 * testsuite/memory_test.t: New linker script.
726 2010-08-27 Doug Kwan <dougkwan@google.com>
728 * gold/resolve.cc (Symbol_table::should_override): Let a weak
729 reference override an existing dynamic weak reference.
730 * testsuite/Makefile.am: Add new test dyn_weak_ref.
731 * testsuite/Makefile.in: Regenerate.
732 * testsuite/dyn_weak_ref.sh: New file.
733 * testsuite/dyn_weak_ref_1.c: Ditto.
734 * testsuite/dyn_weak_ref_2.c: Ditto.
736 2010-08-27 Ian Lance Taylor <iant@google.com>
738 * incremental.h (class Incremental_input_entry): Add virtual
741 2010-08-27 Ian Lance Taylor <iant@google.com>
743 * testsuite/start_lib_test_3.c: Mark t3 as used.
745 2010-08-27 Nick Clifton <nickc@redhat.com>
747 * options.cc (version_script): Fix small typo in previous
750 2010-08-25 Nick Clifton <nickc@redhat.com>
752 * archive.cc: Formatting fixes: Remove whitespace between
753 typename and following asterisk. Remove whitespace between
754 function name and opening parenthesis.
755 * archive.h: Likewise.
757 * attributes.cc: Likewise.
758 * attributes.h: Likewise.
759 * common.cc: Likewise.
760 * copy-relocs.cc: Likewise.
761 * dirsearch.h: Likewise.
762 * dynobj.cc: Likewise.
763 * ehframe.cc: Likewise.
764 * ehframe.h: Likewise.
765 * expression.cc: Likewise.
766 * fileread.cc: Likewise.
767 * fileread.h: Likewise.
769 * gold-threads.cc: Likewise.
773 * incremental-dump.cc: Likewise.
774 * incremental.cc: Likewise.
775 * layout.cc: Likewise.
776 * layout.h: Likewise.
778 * merge.cc: Likewise.
780 * object.cc: Likewise.
781 * object.h: Likewise.
782 * options.cc: Likewise.
783 * options.h: Likewise.
784 * output.cc: Likewise.
785 * output.h: Likewise.
786 * plugin.cc: Likewise.
787 * plugin.h: Likewise.
788 * powerpc.cc: Likewise.
789 * reloc.cc: Likewise.
790 * script-c.h: Likewise.
791 * script-sections.cc: Likewise.
792 * script.cc: Likewise.
793 * stringpool.cc: Likewise.
794 * symtab.cc: Likewise.
795 * symtab.h: Likewise.
796 * target.cc: Likewise.
797 * timer.cc: Likewise.
799 * version.cc: Likewise.
800 * x86_64.cc: Likewise.
802 2010-08-24 Nick Clifton <nickc@redhat.com>
805 * layout.cc (segment_precedes): Sort segments by their physical
806 addresses, if they have been set.
808 2010-08-23 Cary Coutant <ccoutant@google.com>
810 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
812 (Lib_group::include_member): Unlock object after deleting its
814 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
817 2010-08-19 Neil Vachharajani <nvachhar@google.com>
818 Cary Coutant <ccoutant@google.com>
820 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
821 constructor, and set_blocker.
822 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
824 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
825 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
826 * testsuite/Makefile.am (start_lib_test): New test case.
827 * testsuite/Makefile.in: Regenerate.
828 * testsuite/start_lib_test_main.c: New file.
829 * testsuite/start_lib_test_1.c: New file.
830 * testsuite/start_lib_test_2.c: New file.
831 * testsuite/start_lib_test_3.c: New file.
833 2010-08-19 Ian Lance Taylor <iant@google.com>
835 * Makefile.in: Rebuild with automake 1.11.1.
836 * aclocal.m4: Likewise.
837 * testsuite/Makefile.in: Likewise.
839 2010-08-19 Ian Lance Taylor <iant@google.com>
842 * i386.cc (class Output_data_plt_i386): Update declarations.
843 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
844 local_ifuncs_ fields.
845 (Target_i386::do_plt_section_for_global): New function.
846 (Target_i386::do_plt_section_for_local): New function.
847 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
848 parameter; change all callers. Initialize global_ifuncs_ and
849 local_ifuncs_. If doing a static link define __rel_iplt_start and
851 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
852 (Output_data_plt_i386::add_local_ifunc_entry): New function.
853 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
855 (Target_i386::make_plt_section): New function, broken out of
856 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
857 (Target_i386::make_plt_entry): Call make_plt_section.
858 (Target_i386::make_local_ifunc_plt_entry): New function.
859 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
860 (Target_i386::Scan::local): Handle IFUNC symbols. Add
861 R_386_IRELATIVE to switch.
862 (Target_i386::Scan::global): Likewise.
863 (Target_i386::Relocate::relocate): Likewise.
864 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
866 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
867 (Target_x86_64::do_plt_section_for_global): New function.
868 (Target_x86_64::do_plt_section_for_local): New function.
869 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
870 parameter; change all callers. If doing a static link define
871 __rela_iplt_start and __rela_iplt_end.
872 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
873 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
874 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
876 (Target_x86_64::make_local_ifunc_plt_entry): New function.
877 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
879 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
880 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
881 R_X86_64_IRELATIVE to switch.
882 (Target_x86_64::Scan::global): Likewise.
883 (Target_x86_64::Relocate::relocate): Likewise.
884 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
886 * target.h (class Target): Add plt_section_for_global and
887 plt_section_for_local functions. Add do_plt_section_for_global
888 and do_plt_section_for_local virtual functions.
889 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
891 (Symbol::use_plt_offset): Handle IFUNC symbol.
892 * object.cc (Sized_relobj::Sized_relobj): Initialize
894 (Sized_relobj::local_has_plt_offset): New function.
895 (Sized_relobj::local_plt_offset): New function.
896 (Sized_relobj::set_local_plt_offset): New function.
897 (Sized_relobj::do_count): Handle IFUNC symbol.
898 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
899 a bit away from input_shndx_ field. Add set_is_func_symbol and
900 is_ifunc_symbol functions.
901 (class Sized_relobj): Update declarations. Remove Tls_got_entry
902 and Local_tls_got_offsets. Define Local_plt_offsets. Add
903 local_plt_offsets_ field.
904 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
905 * output.h (class Output_section_data): Add non-const
906 output_section function.
907 (class Output_data_got): Update declarations.
908 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
909 Add use_plt_offset parameter to global and local constructors.
910 Change all callers. Change local_sym_index_ field to 31 bits.
911 Change GSYM_CODE and CONSTANT_CODE accordingly.
912 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
913 doing a static link don't set sh_link field.
914 (Output_data_got::Got_entry::write): Use PLT offset if
916 (Output_data_got::add_global_plt): New function.
917 (Output_data_got::add_local_plt): New function.
918 * target-reloc.h (relocate_section): Handle IFUNC symbol.
919 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
920 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
921 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
922 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
924 * testsuite/ifunc-sel.h: New file.
925 * testsuite/ifuncmain1.c: New file.
926 * testsuite/ifuncmain1vis.c: New file.
927 * testsuite/ifuncmod1.c: New file.
928 * testsuite/ifuncdep2.c: New file.
929 * testsuite/ifuncmain2.c: New file.
930 * testsuite/ifuncmain3.c: New file.
931 * testsuite/ifuncmod3.c: New file.
932 * testsuite/ifuncmain4.c: New file.
933 * testsuite/ifuncmain5.c: New file.
934 * testsuite/ifuncmod5.c: New file.
935 * testsuite/ifuncmain6pie.c: New file.
936 * testsuite/ifuncmod6.c: New file.
937 * testsuite/ifuncmain7.c: New file.
938 * configure, testsuite/Makefile.in: Rebuild.
940 2010-08-18 Ian Lance Taylor <iant@google.com>
943 (Output_section_incremental_inputs::write_input_files): Add cast
944 to avoid signed/unsigned comparison warning.
945 (Output_section_incremental_inputs::write_info_blocks): Likewise.
947 2010-08-12 Cary Coutant <ccoutant@google.com>
949 * common.cc (Sort_commons::operator()): Remove unnecessary code.
951 2010-08-13 Ian Lance Taylor <iant@google.com>
953 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
955 2010-08-12 Cary Coutant <ccoutant@google.com>
956 Doug Kwan <dougkwan@google.com>
958 * resolve.cc (Symbol_table::should_override): When a weak dynamic
959 defintion overrides non-weak undef, remember that the original undef
961 * symtab.cc (Symbol_table::sized_write_global): For undef without
962 an original weak binding, set binding to global in output.
963 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
964 * testsuite/Makefile.in: Regenerate.
965 * testsuite/strong_ref_weak_def.sh: New file.
966 * testsuite/strong_ref_weak_def_1.c: Ditto.
967 * testsuite/strong_ref_weak_def_2.c: Ditto.
969 2010-08-12 Cary Coutant <ccoutant@google.com>
971 * testsuite/incremental_test.sh: Rewrite.
972 * testsuite/incremental_test_1.c: Rewrite.
973 * testsuite/incremental_test_2.c: Rewrite.
975 2010-08-12 Cary Coutant <ccoutant@google.com>
977 * arm.cc (Target_arm::got_size): Add const.
978 (Target_arm::got_entry_count): New function.
979 (Target_arm::plt_entry_count): New function.
980 (Target_arm::first_plt_entry_offset): New function.
981 (Target_arm::plt_entry_size): New function.
982 (Output_data_plt_arm::entry_count): New function.
983 (Output_data_plt_arm::first_plt_entry_offset): New function.
984 (Output_data_plt_arm::get_plt_entry_size): New function.
985 * i386.cc (Target_i386::got_size): Add const.
986 (Target_i386::got_entry_count): New function.
987 (Target_i386::plt_entry_count): New function.
988 (Target_i386::first_plt_entry_offset): New function.
989 (Target_i386::plt_entry_size): New function.
990 (Output_data_plt_i386::entry_count): New function.
991 (Output_data_plt_i386::first_plt_entry_offset): New function.
992 (Output_data_plt_i386::get_plt_entry_size): New function.
993 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
994 find_incremental_inputs_sections. Dump incremental_got_plt section.
995 * incremental.cc: Include target.h.
996 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
997 parameter. Adjust all callers. Find incremental_got_plt section.
998 (Incremental_inputs::create_data_sections): Create incremental_got_plt
1000 (Output_section_incremental_inputs::set_final_data_size): Calculate
1001 size of incremental_got_plt section.
1002 (Output_section_incremental_inputs::do_write): Write the
1003 incremental_got_plt section.
1004 (Got_plt_view_info): New struct.
1005 (Local_got_offset_visitor): New class.
1006 (Global_got_offset_visitor): New class.
1007 (Global_symbol_visitor_got_plt): New class.
1008 (Output_section_incremental_inputs::write_got_plt): New function.
1009 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
1010 Add parameter. Adjust all callers.
1011 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
1012 (Incremental_inputs::got_plt_section): New function.
1013 (Incremental_inputs::got_plt_section_): New data member.
1014 (Incremental_got_plt_reader): New class.
1015 * layout.cc (Layout::create_incremental_info_sections): Add the
1016 incremental_got_plt section.
1017 * object.h (Got_offset_list::get_list): New function.
1018 (Got offset_list::for_all_got_offsets): New function.
1019 (Sized_relobj::local_got_offset_list): New function.
1020 * powerpc.cc (Target_powerpc::got_size): Add const.
1021 (Target_powerpc::got_entry_count): New function.
1022 (Target_powerpc::plt_entry_count): New function.
1023 (Target_powerpc::first_plt_entry_offset): New function.
1024 (Target_powerpc::plt_entry_size): New function.
1025 (Output_data_plt_powerpc::entry_count): New function.
1026 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
1027 (Output_data_plt_powerpc::get_plt_entry_size): New function.
1028 * sparc.cc (Target_sparc::got_size): Add const.
1029 (Target_sparc::got_entry_count): New function.
1030 (Target_sparc::plt_entry_count): New function.
1031 (Target_sparc::first_plt_entry_offset): New function.
1032 (Target_sparc::plt_entry_size): New function.
1033 (Output_data_plt_sparc::entry_count): New function.
1034 (Output_data_plt_sparc::first_plt_entry_offset): New function.
1035 (Output_data_plt_sparc::get_plt_entry_size): New function.
1036 * symtab.h (Symbol::got_offset_list): New function.
1037 (Symbol_table::for_all_symbols): New function.
1038 * target.h (Sized_target::got_entry_count): New function.
1039 (Sized_target::plt_entry_count): New function.
1040 (Sized_target::plt_entry_size): New function.
1041 * x86_64.cc (Target_x86_64::got_size): Add const.
1042 (Target_x86_64::got_entry_count): New function.
1043 (Target_x86_64::plt_entry_count): New function.
1044 (Target_x86_64::first_plt_entry_offset): New function.
1045 (Target_x86_64::plt_entry_size): New function.
1046 (Output_data_plt_x86_64::entry_count): New function.
1047 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
1048 (Output_data_plt_x86_64::get_plt_entry_size): New function.
1050 2010-08-12 Cary Coutant <ccoutant@google.com>
1052 * archive.cc: Include incremental.h.
1053 (Archive::Archive): Initialize incremental_info_.
1054 (Archive::include_member): Record archive members in incremental info.
1055 (Add_archive_symbols::run): Record begin and end of an archive in
1057 (Lib_group::include_member): Record objects in incremental info.
1058 * archive.h (Incremental_archive_entry): Forward declaration.
1059 (Archive::set_incremental_info): New member function.
1060 (Archive::incremental_info): New member function.
1061 (Archive::Unused_symbol_iterator): New class.
1062 (Archive::unused_symbols_begin): New member function.
1063 (Archive::unused_symbols_end): New member function.
1064 (Archive::incremental_info_): New data member.
1065 * incremental-dump.cc (find_input_containing_global): New function.
1066 (dump_incremental_inputs): Dump new incremental info sections.
1067 * incremental.cc: Include symtab.h.
1068 (Output_section_incremental_inputs): New class.
1069 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
1070 new incremental info sections.
1071 (Sized_incremental_binary::do_check_inputs): Likewise.
1072 (Incremental_inputs::report_archive): Remove.
1073 (Incremental_inputs::report_archive_begin): New function.
1074 (Incremental_inputs::report_archive_end): New function.
1075 (Incremental_inputs::report_object): New function.
1076 (Incremental_inputs::finalize_inputs): Remove.
1077 (Incremental_inputs::report_input_section): New function.
1078 (Incremental_inputs::report_script): Rewrite.
1079 (Incremental_inputs::finalize): Do nothing but finalize string table.
1080 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
1081 (Incremental_inputs::sized_create_inputs_section_data): Remove.
1082 (Incremental_inputs::create_data_sections): New function.
1083 (Incremental_inputs::relocs_entsize): New function.
1084 (Output_section_incremental_inputs::set_final_data_size): New function.
1085 (Output_section_incremental_inputs::do_write): New function.
1086 (Output_section_incremental_inputs::write_header): New function.
1087 (Output_section_incremental_inputs::write_input_files): New function.
1088 (Output_section_incremental_inputs::write_info_blocks): New function.
1089 (Output_section_incremental_inputs::write_symtab): New function.
1090 * incremental.h (Incremental_script_entry): Forward declaration.
1091 (Incremental_object_entry): Forward declaration.
1092 (Incremental_archive_entry): Forward declaration.
1093 (Incremental_inputs): Forward declaration.
1094 (Incremental_inputs_header_data): Remove.
1095 (Incremental_inputs_header): Remove.
1096 (Incremental_inputs_header_write): Remove.
1097 (Incremental_inputs_entry_data): Remove.
1098 (Incremental_inputs_entry): Remove.
1099 (Incremental_inputs_entry_write): Remove.
1100 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
1101 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
1102 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
1103 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
1105 (Incremental_input_entry): New class.
1106 (Incremental_script_entry): New class.
1107 (Incremental_object_entry): New class.
1108 (Incremental_archive_entry): New class.
1109 (Incremental_inputs::Incremental_inputs): Initialize new data members.
1110 (Incremental_inputs::report_inputs): Remove.
1111 (Incremental_inputs::report_archive): Remove.
1112 (Incremental_inputs::report_archive_begin): New function.
1113 (Incremental_inputs::report_archive_end): New function.
1114 (Incremental_inputs::report_object): Change prototype.
1115 (Incremental_inputs::report_input_section): New function.
1116 (Incremental_inputs::report_script): Change prototype.
1117 (Incremental_inputs::get_reloc_count): New function.
1118 (Incremental_inputs::set_reloc_count): New function.
1119 (Incremental_inputs::create_data_sections): New function.
1120 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
1121 (Incremental_inputs::inputs_section): New function.
1122 (Incremental_inputs::symtab_section): New function.
1123 (Incremental_inputs::relocs_section): New function.
1124 (Incremental_inputs::get_stringpool): Add const.
1125 (Incremental_inputs::command_line): Add const.
1126 (Incremental_inputs::inputs): Remove.
1127 (Incremental_inputs::command_line_key): New function.
1128 (Incremental_inputs::input_file_count): New function.
1129 (Incremental_inputs::input_files): New function.
1130 (Incremental_inputs::relocs_entsize): New function.
1131 (Incremental_inputs::sized_create_inputs_section_data): Remove.
1132 (Incremental_inputs::finalize_inputs): Remove.
1133 (Incremental_inputs::Input_info): Remove.
1134 (Incremental_inputs::lock_): Remove.
1135 (Incremental_inputs::inputs_): Change type.
1136 (Incremental_inputs::inputs_map_): Remove.
1137 (Incremental_inputs::current_object_entry_): New data member.
1138 (Incremental_inputs::inputs_section_): New data member.
1139 (Incremental_inputs::symtab_section_): New data member.
1140 (Incremental_inputs::relocs_section_): New data member.
1141 (Incremental_inputs::reloc_count_): New data member.
1142 (Incremental_inputs_reader): New class.
1143 (Incremental_symtab_reader): New class.
1144 (Incremental_relocs_reader): New class.
1145 * layout.cc (Layout::finalize): Move finalization of incremental info
1146 and creation of incremental info sections to follow finalization of
1147 symbol table. Set offsets for postprocessing sections.
1148 (Layout::create_incremental_info_sections): Call
1149 Incremental_inputs::create_data_sections. Add incremental symtab
1150 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
1151 sections to layout after input sections.
1152 * layout.h (struct Timespec): Forward declaration.
1153 (Layout::incremental_inputs): Add const.
1154 (Layout::create_incremental_info_sections): Add parameter.
1155 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
1156 * object.cc: Include incremental.h.
1157 (Relobj::finalize_incremental_relocs): New function.
1158 (Sized_relobj::do_layout): Record input sections in incremental info.
1159 * object.h (Object::output_section): New function.
1160 (Object::output_section_offset): Moved from Relobj.
1161 (Object::get_incremental_reloc_base): New function.
1162 (Object::get_incremental_reloc_count): New function.
1163 (Object::do_output_section): New function.
1164 (Object::do_output_section_offset): Moved from Relobj.
1165 (Object::do_get_incremental_reloc_base): New function.
1166 (Object::do_get_incremental_reloc_count): New function.
1167 (Object::Object): Initialize new data members.
1168 (Relobj::output_section): Renamed do_output_section and moved to
1170 (Relobj::output_section_offset): Moved to Object.
1171 (Relobj::do_get_incremental_reloc_base): New function.
1172 (Relobj::do_get_incremental_reloc_count): New function.
1173 (Relobj::allocate_incremental_reloc_counts): New function.
1174 (Relobj::count_incremental_reloc): New function.
1175 (Relobj::finalize_incremental_relocs): New function.
1176 (Relobj::next_incremental_reloc_index): New function.
1177 (Relobj::reloc_counts_): New data member.
1178 (Relobj::reloc_bases_): New data member.
1179 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
1180 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
1181 (Sized_relobj::incremental_relocs_scan): New function.
1182 (Sized_relobj::incremental_relocs_scan_reltype): New function.
1183 (Sized_relobj::incremental_relocs_write): New function.
1184 (Sized_relobj::incremental_relocs_write_reltype): New function.
1185 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
1187 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
1188 archives and object files elsewhere.
1189 (Add_symbols::run): Report object files here.
1190 (Finish_group::run): Report end of archive at end of group.
1191 * reloc.cc: Include layout.h, incremental.h.
1192 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
1193 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
1194 (Sized_relobj::incremental_relocs_scan): New function.
1195 (Sized_relobj::incremental_relocs_scan_reltype): New function.
1196 (Sized_relobj::do_relocate_sections): Write incremental relocations.
1197 (Sized_relobj::incremental_relocs_write): New function.
1198 (Sized_relobj::incremental_relocs_write_reltype): New function.
1199 * script.cc (read_input_script): Rewrite test for incremental link.
1200 Change call to Incremental_inputs::report_script.
1201 * symtab.h (Symbol_table::first_global_index): New function.
1202 (Symbol_table::output_count): New function.
1204 2010-08-12 Doug Kwan <dougkwan@google.com>
1206 * arm.cc (Target_arm::merge_object_attributes): Check command line
1207 options --no-wchar-size-warning and --no-enum-size-warning.
1208 * options.h (General_options): Add ld-compatible options
1209 --no-enum-size-warning and --no-wchar-size-warning.
1211 2010-08-04 Ian Lance Taylor <iant@google.com>
1213 * x86_64.cc (Target_x86_64::Scan::local): Use
1214 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
1215 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
1216 (Target_x86_64::Scan::global): Likewise.
1217 (Target_x86_64::Relocate::relocate): Likewise.
1218 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
1221 2010-08-03 Cary Coutant <ccoutant@google.com>
1223 * merge.cc (Output_merge_string::do_add_input_section): Count strings
1224 to reserve space in merged_strings vector. Keep total input size
1226 (Output_merge_string::do_print_merge_stats): Print total input size.
1227 * merge.h (Output_merge_string): Add input_size_ field.
1228 * stringpool.cc (Stringpool_template::string_length): Move
1229 implementations out of Stringpool_template class and place in
1231 * stringpool.h (string_length): Move out of Stringpool_template.
1233 2010-08-03 Ian Lance Taylor <iant@google.com>
1236 * layout.cc (relaxation_loop_body): If address of load segment is
1237 set, adjust address to include headers if possible.
1239 2010-08-03 Ian Lance Taylor <iant@google.com>
1241 * version.cc (version_string): Bump to 1.10.
1243 2010-08-03 Ian Lance Taylor <iant@google.com>
1246 * layout.h (enum Output_section_order): Define.
1247 (class Layout): Update declarations.
1248 * layout.cc (Layout::get_output_section): Add order parameter.
1249 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
1250 is_first_non_relro parameters. Change all callers.
1251 (Layout::choose_output_section): Likewise.
1252 (Layout::add_output_section_data): Likewise.
1253 (Layout::make_output_section): Likewise. Set order.
1254 (Layout::default_section_order): New function.
1255 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
1256 * output.cc (Output_section::Output_section): Initialize order_.
1257 Don't initialize deleted fields.
1258 (Output_segment::Output_segment): Don't initialize deleted
1260 (Output_segment::add_output_section_to_load): New function
1261 replacing add_output_section. Change all callers to call this or
1262 add_output_section_to_nonload.
1263 (Output_segment::add_output_section_to_nonload): New function.
1264 (Output_segment::remove_output_section): Rewrite.
1265 (Output_segment::add_initial_output_data): Likewise.
1266 (Output_segment::has_any_data_sections): Likewise.
1267 (Output_segment::is_first_section_relro): Likewise.
1268 (Output_segment::maximum_alignment): Likewise.
1269 (Output_segment::has_dynamic_reloc): New function replacing
1270 dynamic_reloc_count. Change all callers.
1271 (Output_segment::has_dynamic_reloc_list): New function replacing
1272 dynamic_reloc_count_list. Change all callers.
1273 (Output_segment::set_section_addresses): Rewrite.
1274 (Output_segment::set_offset): Rewrite.
1275 (Output_segment::find_first_and_last_list): Remove.
1276 (Output_segment::set_tls_offsets): Rewrite.
1277 (Output_segment::first_section_load_address): Likewise.
1278 (Output_segment::output_section_count): Likewise.
1279 (Output_segment::section_with_lowest_load_address): Likewise.
1280 (Output_segment::write_section_headers): Likewise.
1281 (Output_segment::print_sections_to_map): Likewise.
1282 * output.h (class Output_data): Remove dynamic_reloc_count_
1283 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
1284 (Output_data::add_dynamic_reloc): Rewrite.
1285 (Output_data::has_dynamic_reloc): New function.
1286 (Output_data::dynamic_reloc_count): Remove.
1287 (class Output_section): Add order_ field. Remvoe is_relro_local_,
1288 is_last_relro_, is_first_non_relro_, is_interp_,
1289 is_dynamic_linker_section_ fields. Add order and set_order
1290 functions. Remove is_relro_local, set_is_relro_local,
1291 is_last_relro, set_is_last_relro, is_first_non_relro,
1292 set_is_first_non_relro functions, is_interp, set_is_interp,
1293 is_dynamic_linker_section, and set_is_dynamic_linker_section
1295 (class Output_segment): Change Output_data_list from std::list to
1296 std:;vector. Add output_lists_ field. Remove output_data_ and
1297 output_bss_ fields. Update declarations.
1299 2010-08-02 Ian Lance Taylor <iant@google.com>
1301 * arm.cc (Target_arm::gc_process_relocs): Use typename.
1302 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
1303 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
1305 2010-08-02 Ian Lance Taylor <iant@google.com>
1308 * script.cc (Script_options::Script_options): Initialize
1309 symbol_definitions_ and symbol_references_.
1310 (Script_options::add_symbol_assignment): Update
1311 symbol_definitions_ and symbol_references_.
1312 (Script_options::add_symbol_reference): New function.
1313 (script_symbol): New function.
1314 * script.h (class Script_options): Add symbol_definitions_ and
1315 symbol_references_ fields.
1316 (Script_options::referenced_const_iterator): New type.
1317 (Script_options::referenced_begin): New function.
1318 (Script_options::referenced_end): New function.
1319 (Script_options::is_referenced): New function.
1320 (Script_options::any_unreferenced): New function.
1321 * script-c.h (script_symbol): Declare.
1322 * yyscript.y (exp): Call script_symbol.
1323 * symtab.cc: Include "script.h".
1324 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
1325 Change all callers. Check symbols referenced by scripts.
1326 (Symbol_table::add_undefined_symbols_from_command_line): Add
1327 layout parameter. Change all callers.
1328 (Symbol_table::do_add_undefined_symbols_from_command_line):
1329 Likewise. Break out loop body. Check symbols referenced by
1331 (Symbol_table::add_undefined_symbol_from_command_line): New
1332 function broken out of
1333 do_add_undefined_symbols_from_command_line.
1334 * symtab.h (class Symbol_table): Update declarations.
1335 * archive.cc: Include "layout.h".
1336 (Archive::should_include_member): Add layout parameter. Change
1337 all callers. Check for symbol mentioned in expression.
1338 * archive.h (class Archive): Update declaration.
1339 * object.cc (Sized_relobj::do_should_include_member): Add layout
1341 * object.h (Object::should_include_member): Add layout parameter.
1343 (Object::do_should_include_member): Add layout parameter.
1344 (class Sized_relobj): Update declaration.
1345 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
1347 * dynobj.h (class Sized_dynobj): Update declaration.
1348 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
1350 * plugin.h (class Sized_pluginobj): Update declaration.
1352 2010-08-02 Ian Lance Taylor <iant@google.com>
1355 * output.cc (Output_segment::set_offset): Search for the first and
1356 last sections rather than assuming that the list is in order.
1357 (Output_segment::find_first_and_last_list): New function.
1358 * output.h (class Output_segment): Update declarations.
1359 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
1360 (relro_strip_test_SOURCES): New variable.
1361 (relro_strip_test_DEPENDENCIES): New variable.
1362 (relro_strip_test_LDFLAGS): New variable.
1363 (relro_strip_test_LDADD): New variable.
1364 (relro_strip_test.so): New target.
1366 2010-08-02 Ian Lance Taylor <iant@google.com>
1368 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
1369 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
1370 (Target_i386::got_tlsdesc_section): New function.
1371 (Target_i386::got_section): Create space for GOT entries for
1372 TLSDESC relocations.
1373 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
1375 (Target_i386::Scan::global): Likewise.
1376 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
1378 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
1379 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
1380 (Target_x86_64::got_tlsdesc_section): New function.
1381 (Target_x86_64::got_section): Create space for GOT entries for
1382 TLSDESC relocations.
1383 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
1385 (Target_x86_64::Scan::global): Likewise.
1386 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
1389 2010-08-02 Ian Lance Taylor <iant@google.com>
1391 * testsuite/final_layout.sh: Use dc to convert from hex to
1394 2010-07-29 Sriraman Tallam <tmsriram@google.com>
1396 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
1397 paramter to the call to gold::gc_process_relocs.
1398 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
1399 paramter to the call to gold::gc_process_relocs.
1400 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
1401 parameter to the call to gold::gc_process_relocs.
1402 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
1403 template parameter to the call to gold::gc_process_relocs.
1404 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
1405 paramter to the call to gold::gc_process_relocs.
1406 * gc.h (get_embedded_addend_size): New function.
1407 (gc_process_relocs): Save the size of the reloc for use by ICF.
1408 * icf.cc (get_section_contents): Get the addend from the text section
1409 for SHT_REL relocation sections.
1410 * icf.h (Icf::Reloc_addend_size_info): New typedef.
1411 (Icf::Reloc_info): Add new member reloc_addend_size_info.
1412 * int_encoding.h (read_from_pointer): New overloaded function.
1413 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
1414 * testsuite/icf_sht_rel_addend_test.sh: New file.
1415 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
1416 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
1418 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1420 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
1421 * Makefile.in: Regenerate.
1422 * testsuite/Makefile.in: Regenerate.
1424 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
1426 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
1427 * gold/testsuite/debug_msg.cc: Likewise.
1428 * gold/testsuite/odr_violation1.cc
1429 * gold/testsuite/odr_violation2.cc
1431 2010-07-21 Cary Coutant <ccoutant@google.com>
1433 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
1434 string, and length fields.
1435 (Output_merge_string::Merged_strings_list): New type.
1436 (Output_merge_string::Merged_strings_lists): New typedef.
1437 (Output_merge_string): Replace merged_strings_ with
1438 merged_strings_lists_.
1439 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
1440 Merged_strings_list per input object and section. Don't store pointer
1441 to the string. Don't store length with each merged string entry.
1442 (Output_merge_string::finalize_merged_data): Loop over list of merged
1443 strings lists. Recompute length of each merged string.
1445 2010-07-15 Cary Coutant <ccoutant@google.com>
1447 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
1450 2010-07-14 Ian Lance Taylor <iant@google.com>
1452 * descriptors.cc (Descriptors::open): Report correct name in error
1455 2010-07-13 Doug Kwan <dougkwan@google.com>
1457 * arm.cc (Arm_input_section::Arm_input_section): For a
1458 SHT_ARM_EXIDX section, always keeps the input sections.
1459 (Arm_input_section::set_exidx_section_link): New method.
1460 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
1461 has_errors_ to false.
1462 (Arm_exidx_input_section::has_errors,
1463 Arm_exidx_input_section::set_has_errors): New methods.
1464 (Arm_exidx_input_section::has_errors_): New data member.
1465 (Arm_relobj::get_exidx_shndx_list): New method.
1466 (Arm_output_section::append_text_sections_to_list): Do not skip
1467 section without SHF_EXECINSTR.
1468 (Arm_output_section::fix_exidx_coverage): Skip input sections with
1470 (Arm_relobj::make_exidx_input_section): Add new parameter for text
1471 section header. Make error messages more verbose. Check for
1472 a non-executable section linked to an EXIDX section.
1473 (Arm_relobj::do_read_symbols): Remove error checking, which has been
1474 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
1475 check that there is no deferred EXIDX section if we exit early.
1476 Instead of not making an EXIDX section in case of an error, make one
1477 and set the has_errors flag of it.
1478 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
1479 in a relocatable link.
1480 (Target_arm::do_relax): Look for the EXIDX output section instead of
1481 assuming that it is called .ARM.exidx.
1482 (Target_arm::fix_exidx_coverage): Add a new parameter for input
1483 section list. Do not check for SHF_EXECINSTR section flags but
1484 skip any input section with errors.
1485 * output.cc (Output_section::Output_section): Initialize
1486 always_keeps_input_sections_ to false.
1487 (Output_section::add_input_section): Check for
1488 always_keeps_input_sections_.
1489 * output.h (Output_section::always_keeps_input_sections,
1490 Output_section::set_always_keeps_input_sections): New methods.
1491 (Output_section::always_keeps_input_sections): New data member.
1493 2010-07-13 Rafael Espindola <espindola@google.com>
1495 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
1496 * fileread.h (Input_file): Add try_extra_search_path and find_file.
1498 2010-07-13 Philip Herron <herron.philip@googlemail.com>
1499 Ian Lance Taylor <iant@google.com>
1501 * output.h (Output_section_lookup_maps::add_merge_section):
1502 Correct check of whether value was inserted.
1503 (Output_section_lookup_maps::add_merge_input_section): Likewise.
1504 (Output_section_lookup_maps::add_relaxed_input_section):
1506 * arm.cc (Target_arm::got_section): Remove used local os.
1507 * i386.cc (Target_i386::got_section): Likewise.
1508 * x86_64.cc (Target_x86_64::got_section): Likewise.
1509 * sparc.cc (Target_sparc::got_section): Likewise.
1510 (Target_sparc::relocate): Remove unused local have_got_offset.
1511 * powerpc.cc (Target_powerpc::relocate): Likewise.
1513 2010-07-13 Ian Lance Taylor <iant@google.com>
1515 * compressed_output.cc (zlib_decompress): Fix signature in
1518 * archive.cc (Archive::include_member): Unlock an external member
1519 of a thin archive. Don't bother to delete an object we know is
1522 2010-07-12 Cary Coutant <ccoutant@google.com>
1524 * compressed_output.cc (zlib_decompress): New function.
1525 (get_uncompressed_size): New function.
1526 (decompress_input_section): New function.
1527 * compressed_output.h (get_uncompressed_size): New function.
1528 (decompress_input_section): New function.
1529 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
1530 Handle compressed debug sections.
1531 * layout.cc (is_compressed_debug_section): New function.
1532 (Layout::output_section_name): Map compressed section names to
1534 * layout.h (is_compressed_debug_section): New function.
1535 (is_debug_info_section): Recognize compressed debug sections.
1536 * merge.cc: Include compressed_output.h.
1537 (Output_merge_data::do_add_input_section): Handle compressed
1539 (Output_merge_string::do_add_input_section): Handle compressed
1541 * object.cc: Include compressed_output.h.
1542 (Sized_relobj::Sized_relobj): Initialize new data members.
1543 (build_compressed_section_map): New function.
1544 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
1545 * object.h (Object::section_is_compressed): New method.
1546 (Object::do_section_is_compressed): New method.
1547 (Sized_relobj::Compressed_section_map): New type.
1548 (Sized_relobj::do_section_is_compressed): New method.
1549 (Sized_relobj::compressed_sections_): New data member.
1550 * output.cc (Output_section::add_input_section): Handle compressed
1552 * reloc.cc: Include compressed_output.h.
1553 (Sized_relobj::write_sections): Handle compressed debug sections.
1555 2010-07-08 Cary Coutant <ccoutant@google.com>
1557 * resolve.cc (Symbol_table::resolve): Remember whether undef was
1558 weak when resolving to a dynamic def.
1559 (Symbol_table::should_override): Add adjust_dyndef flag; set it
1560 for weak undef/dynamic def cases. Adjust callers.
1561 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
1562 undef_binding_weak_.
1563 (Symbol_table::sized_write_globals): Adjust symbol binding.
1564 (Symbol_table::sized_write_symbol): Add binding parameter.
1565 * symtab.h (Symbol::set_undef_binding): New method.
1566 (Symbol::is_undef_binding_weak): New method.
1567 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
1568 (Symbol_table::should_override): Add new parameter.
1569 (Symbol_table::sized_write_symbol): Add new parameter.
1571 * testsuite/weak_undef_file1.cc: Add new test case.
1572 * testsuite/weak_undef_file2.cc: Fix header comment.
1573 * testsuite/weak_undef_test.cc: Add new test case.
1575 2010-06-29 Doug Kwan <dougkwan@google.com>
1577 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
1578 Initialize USE_SYMBOL_.
1579 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
1581 (Arm_reloc_property::uses_symbol_): New data member declaration.
1582 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
1583 uses symbol value and symbol is undefined but not weakly undefined.
1585 2010-06-28 Rafael Espindola <espindola@google.com>
1587 * plugin.cc (Plugin::load): Use dlerror.
1589 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
1591 * symtab.cc (detect_odr_violations): When reporting an ODR
1592 violation, report an object where the symbol is defined.
1594 2010-06-25 Doug Kwan <dougkwan@google.com>
1596 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
1597 (Target_arm::section_may_have_icf_unsafe_pointers): New method
1599 (Target_arm::Scan::local_reloc_may_be_function_pointer,
1600 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
1601 target hook to detect function points.
1602 (Target_arm::Scan::possible_function_pointer_reloc): New method.
1603 * icf.h (Icf::check_section_for_function_pointers): Change type of
1604 parameter SECTION_NAME to const reference to std::string. Use
1605 target hook to determine if section may have unsafe pointers.
1606 * target.h (Target::section_may_have_icf_unsafe_pointers): New
1609 2010-06-21 Rafael Espindola <espindola@google.com>
1611 * fileread.cc (Input_file::find_fie): New
1612 (Input_file::open): Use Input_file::find_fie.
1613 * fileread.h (Input_file::find_fie): New
1614 * plugin.cc (set_extra_library_path): New.
1615 (Plugin::load): Add set_extra_library_path to the transfer vector.
1616 (Plugin_manager::set_extra_library_path): New.
1617 (Plugin_manager::add_input_file): Use the extra search path if set.
1618 (set_extra_library_path(): New.
1619 * plugin.h (Plugin_manager): Add set_extra_library_path and
1622 2010-06-19 Cary Coutant <ccoutant@google.com>
1624 * layout.cc (gdb_sections): Add .debug_types.
1625 (lines_only_debug_sections): Likewise.
1627 2010-06-18 Rafael Espindola <espindola@google.com>
1629 * plugin.cc (add_input_file,add_input_library)
1630 (Plugin_manager::add_input_file): Make filename arguments const.
1631 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
1634 2010-06-16 Doug Kwan <dougkwan@google.com>
1636 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
1637 .ARM.attributes section if we have not merged any input
1638 attributes sections.
1640 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1642 * arm.cc: Allow combining objects with no EABI version
1645 2010-06-15 Rafael Espindola <espindola@google.com>
1647 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
1649 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1651 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
1652 (struct iovec): Correct !HAVE_READV definition.
1654 2010-06-10 Cary Coutant <ccoutant@google.com>
1656 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
1657 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
1659 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
1662 * symtab.h (Symbol::is_placeholder): New member function.
1663 * target-reloc.h (relocate_section): Check for placeholder symbols.
1665 * testsuite/Makefile.am (plugin_test_8): New test.
1666 (plugin_test_9): New test.
1667 * testsuite/Makefile.in: Regenerate.
1669 2010-06-09 Nick Clifton <nickc@redhat.com>
1671 * yyscript.y (input_list_element): Allow strings prefixed with
1672 the '-' character. Treat these as libraries.
1673 * script.cc (script_add_library): New function. Adds a library
1674 specified by "-l<name>" found in an input script.
1675 * script-c.h: Add prototype for script_add_library.
1677 2010-06-07 Doug Kwan <dougkwan@google.com>
1679 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
1680 Restrict stub-group size to be within long conditional branch
1681 range when working around cortex-A8 erratum.
1683 2010-06-07 Damien Diederen <dd@crosstwine.com>
1685 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
1688 2010-06-03 Sriraman Tallam <tmsriram@google.com>
1692 (Output_section::Input_section_sort_entry::compare_section_ordering):
1693 Change to return non-zero correctly.
1694 (Output_section::Input_section_sort_section_order_index_compare
1695 ::operator()): Change to fix ambiguity in comparisons.
1697 2010-06-01 Sriraman Tallam <tmsriram@google.com>
1699 * gold.h (is_wildcard_string): New function.
1700 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
1701 (Layout::layout_eh_frame): Ditto.
1702 (Layout::find_section_order_index): New method.
1703 (Layout::read_layout_from_file): New method.
1704 * layout.h (Layout::find_section_order_index): New method.
1705 (Layout::read_layout_from_file): New method.
1706 (Layout::input_section_position_): New private member.
1707 (Layout::input_section_glob_): New private member.
1708 * main.cc (main): Call read_layout_from_file here.
1709 * options.h (--section-ordering-file): New option.
1710 * output.cc (Output_section::input_section_order_specified_): New
1712 (Output_section::Output_section): Initialize new member.
1713 (Output_section::add_input_section): Add new parameter.
1714 Keep input sections when --section-ordering-file is used.
1715 (Output_section::set_final_data_size): Sort input sections when
1716 section ordering file is specified.
1717 (Output_section::Input_section_sort_entry): Add new parameter.
1719 (Output_section::Input_section_sort_entry::compare_section_ordering):
1721 (Output_section::Input_section_sort_compare::operator()): Change to
1722 consider section_order_index.
1723 (Output_section::Input_section_sort_init_fini_compare::operator()):
1724 Change to consider section_order_index.
1725 (Output_section::Input_section_sort_section_order_index_compare
1726 ::operator()): New method.
1727 (Output_section::sort_attached_input_sections): Change to sort
1728 according to section order when specified.
1729 (Output_section::add_input_section<32, true>): Add new parameter.
1730 (Output_section::add_input_section<64, true>): Add new parameter.
1731 (Output_section::add_input_section<32, false>): Add new parameter.
1732 (Output_section::add_input_section<64, false>): Add new parameter.
1733 * output.h (Output_section::add_input_section): Add new parameter.
1734 (Output_section::input_section_order_specified): New
1736 (Output_section::set_input_section_order_specified): New method.
1737 (Input_section::Input_section): Initialize section_order_index_.
1738 (Input_section::section_order_index): New method.
1739 (Input_section::set_section_order_index): New method.
1740 (Input_section::section_order_index_): New member.
1741 (Input_section::Input_section_sort_section_order_index_compare): New
1743 (Output_section::input_section_order_specified_): New member.
1744 * script-sections.cc (is_wildcard_string): Delete and move modified
1746 (Output_section_element_input::Output_section_element_input): Modify
1747 call to is_wildcard_string.
1748 (Output_section_element_input::Input_section_pattern
1749 ::Input_section_pattern): Ditto.
1750 (Output_section_element_input::Output_section_element_input): Ditto.
1751 * testsuite/Makefile.am (final_layout): New test case.
1752 * testsuite/Makefile.in: Regenerate.
1753 * testsuite/final_layout.cc: New file.
1754 * testsuite/final_layout.sh: New file.
1756 2010-06-01 Rafael Espindola <espindola@google.com>
1758 * plugin.cc (Plugin::load): Pass the output name to the plugin.
1760 2010-06-01 Rafael Espindola <espindola@google.com>
1762 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
1763 visibility of symbols.
1765 2010-05-27 Doug Kwan <dougkwan@google.com>
1767 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
1768 from start of output section instead of address for a local symbol
1769 in a merged or relaxed section when doing a relocatable link.
1771 2010-05-26 Rafael Espindola <espindola@google.com>
1774 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
1775 adding sections the garbage collector removed.
1776 * gold/testsuite/Makefile.am: Add test.
1777 * gold/testsuite/Makefile.in: Regenerate.
1778 * gold/testsuite/plugin_test_7.sh: New.
1779 * gold/testsuite/plugin_test_7_1.c: New.
1780 * gold/testsuite/plugin_test_7_2.c: New.
1782 2010-05-26 Rafael Espindola <espindola@google.com>
1784 * script-sections.cc (Output_section_definition::set_section_addresses):
1785 Check for --section-start.
1787 2010-05-26 Doug Kwan <dougkwan@google.com>
1789 * arm.cc (Arm_scan_relocatable_relocs): New class.
1790 (Target_arm::relocate_special_relocatable): New method.
1791 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
1792 (Arm_relocate_functions::thumb_branch_common): Same.
1793 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
1794 instead of Default_scan_relocatable_relocs.
1795 * target-reloc.h (relocate_for_relocatable): Let target handle
1796 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
1797 * target.h (Sized_target::relocate_special_relocatable): New method.
1799 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1801 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
1803 2010-05-23 Doug Kwan <dougkwan@google.com>
1805 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
1807 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
1808 with a direct branch, not a conditional branch, to a stub.
1809 * merge.cc (Output_merge_base::record_input_section): New method
1811 (Output_merge_data::do_add_input_section): Record input section if
1812 keeps-input-sections flag is set.
1813 (Output_merge_string::do_add_input_section): Ditto.
1814 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
1815 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
1817 (Output_merge_base::keeps_input_sections,
1818 Output_merge_base::set_keeps_input_sections,
1819 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
1821 (Output_merge_base::Input_sections): New type declaration.
1822 (Output_merge_base::input_sections_begin,
1823 Output_merge_base::input_sections_end,
1824 Output_merge_base::do_set_keeps_input_sections): New method definitions.
1825 (Output_merge_base::bool keeps_input_sections_,
1826 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
1827 Output_merge_base::input_sections_): New data members.
1828 (Output_merge_data::do_set_keeps_input_sections): New method
1830 (Output_merge_string::do_set_keeps_input_sections): Ditto.
1831 * output.cc (Output_section::Input_section::relobj): Move method
1832 defintion from class declaration to here and handle merge sections.
1833 (Output_section::Input_section::shndx): Ditto.
1834 (Output_section::Output_section): Remove initializations of removed
1835 data members and initialize new data member LOOKUP_MAPS_.
1836 (Output_section::add_input_section): Set keeps-input-sections flag
1837 for a newly created merge output section as appropriate. Adjust code
1838 to use Output_section_lookup_maps class.
1839 (Output_section::add_relaxed_input_section): Adjst code for lookup
1840 maps code refactoring.
1841 (Output_section::add_merge_input_section): Add a new parameter
1842 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
1843 class. If adding input section to a newly created merge output
1844 section fails, remove the new merge section.
1845 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
1846 Adjust code for use of the Output_section_lookup_maps class.
1847 (Output_section::find_merge_section): Ditto.
1848 (Output_section::build_lookup_maps): New method defintion.
1849 (Output_section::find_relaxed_input_section): Adjust code to use
1850 Output_section_lookup_maps class.
1851 (Output_section::get_input_sections): Export merge sections. Adjust
1852 code to use Output_section_lookup_maps class.
1853 (Output_section:::add_script_input_section): Adjust code to use
1854 Output_section_lookup_maps class. Update lookup maps for merge
1856 (Output_section::discard_states): Use Output_section_lookup_maps.
1857 (Output_section::restore_states): Same.
1858 * output.h (Merge_section_properties): Move class defintion out of
1860 (Output_section_lookup_maps): New class.
1861 (Output_section::Input_section::is_merge_section): New method
1863 (Output_section::Input_section::relobj): Move defintion out of class
1864 defintion. Declare method only.
1865 (Output_section::Input_section::shndx): Ditto.
1866 (Output_section::Input_section::output_merge_base): New method defintion.
1867 (Output_section::Input_section::u2_.pomb): New union field.
1868 (Output_section::Merge_section_by_properties_map,
1869 Output_section::Output_section_data_by_input_section_map,
1870 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
1872 (Output_section::add_merge_input_section): Add new parameter
1873 KEEPS_INPUT_SECTIONS.
1874 (Output_section::build_lookup_maps): New method declaration.
1875 (Output_section::merge_section_map_,
1876 Output_section::merge_section_by_properties_map_,
1877 Output_section::relaxed_input_section_map_,
1878 Output_section::is_relaxed_input_section_map_valid_): Remove data
1880 (Output_section::lookup_maps_): New data member.
1882 2010-05-21 Doug Kwan <dougkwan@google.com>
1885 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
1886 avoid a compilation error.
1888 2010-05-19 Rafael Espindola <espindola@google.com>
1890 * script-sections.cc (Output_section_definition::allocate_to_segment):
1891 Update the phdrs_list even when the output section is NULL.
1892 * testsuite/Makefile.am: Add test.
1893 * testsuite/Makefile.in: Regenerate.
1894 * testsuite/script_test_9.cc: New.
1895 * testsuite/script_test_9.sh: New.
1896 * testsuite/script_test_9.t: New.
1898 2010-05-19 Doug Kwan <dougkwan@google.com>
1900 * arm.cc (Arm_input_section::original_size): New method.
1901 (Arm_input_section::do_addralign): Add a cast.
1902 (Arm_input_section::do_output_offset): Remove static cast.
1903 (Arm_input_section::original_addralign,
1904 Arm_input_section::original_size_): Change type to uint32_t.
1905 (Arm_input_section::init): Add safe casts for section alignment
1907 (Arm_input_section::set_final_data_size): Do not set address and
1908 offset of stub table.
1909 (Arm_output_section::fix_exidx_coverage): Change use of of
1910 Output_section::Simple_input_section to that of
1911 Output_section::Input_section.
1912 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
1913 except for the first pass.
1914 * output.cc (Output_section::get_input_sections): Change type of
1915 input_sections to std::list<Input_section>.
1916 (Output_section::add_script_input_section): Rename from
1917 Output_section::add_simple_input_section. Change type of SIS
1918 parameter from Simple_input_section to Input_section.
1919 * output.h (Output_section::Simple_input_section): Remove class.
1920 (Output_section::Input_section): Change class visibility to public.
1921 (Output_section::Input_section::addralign): Use stored alignments
1922 for special input sections if set.
1923 (Output_section::Input_section::set_addralign): New method.
1924 (Output_section::get_input_sections): Change parameter type from
1925 list of Simple_input_section to list of Input_section.
1926 (Output_section::add_script_input_section): Rename from
1927 Output_section::add_simple_input_section. Change first parameter's
1928 type from Simple_input_section to Input_section and remove the
1929 second and third parameters.
1930 * script-sections.cc (Input_section::Input_section_list): Change
1931 type to list of Output_section::Input_section/
1932 (Input_section_info::Input_section_info): Change parameter type of
1933 INPUT_SECTION to Output_section::Input_section.
1934 (Input_section_info::input_section): Change return type.
1935 (Input_section_info::input_section_): Change type to
1936 Output_section::Input_section.
1937 (Output_section_element_input::set_section_addresses): Adjust code
1938 to use Output_section::Input_section instead of
1939 Output_section::Simple_input_section. Adjust code for renaming
1940 of Output_section::add_simple_input_section.
1941 (Orphan_output_section::set_section_addresses): Ditto.
1943 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1945 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
1946 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
1948 2010-05-18 Rafael Espindola <espindola@google.com>
1950 * options.cc (General_options::finalize): Handle -nostdlib.
1951 * options.h (nostdlib): New option.
1952 * script.cc (script_add_search_dir): Handle -nostdlib.
1954 2010-05-12 Doug Kwan <dougkwan@google.com>
1956 * arm.cc (Target_arm::do_finalize_sections): Create an empty
1957 attributes section only if there no attributes section after merging.
1958 (Target_arm::merge_object_attributes): Move value of
1959 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
1960 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
1961 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
1962 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
1963 and arm_attr_merge_7.stdout.
1964 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
1965 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
1966 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
1967 arm_attr_merge_7b.o): New rules.
1968 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
1970 * testsuite/Makefile.in: Regenerate.
1971 * testsuite/arm_attr_merge.sh: New file.
1972 * testsuite/arm_attr_merge_[67][ab].s: Same.
1974 2010-05-05 Nick Clifton <nickc@redhat.com>
1976 * po/es.po: Updated Spanish translation.
1978 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
1980 * Makefile.am (install-exec-local): Properly install gold as
1981 default cross linker.
1982 * Makefile.in: Regenerated.
1984 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
1985 Nick Clifton <nickc@redhat.com>
1987 * configure.ac (install_as_default): Define and set to false
1988 unless --enable-gold or --enable-gold=both/gold has been
1990 * configure: Regenerate.
1992 * Makefile.am (install-exec-local): Install the executable as
1993 'ld.gold'. If install_as_default is true then also install it as
1995 * Makefile.in: Regenerated.
1997 2010-04-24 Ian Lance Taylor <iant@google.com>
1999 * layout.cc (Layout::layout_reloc): In relocatable link don't
2000 combine reloc sections for grouped sections.
2002 2010-04-23 Sriraman Tallam <tmsriram@google.com>
2004 * gc.h (gc_process_relocs): Pass information on relocs pointing to
2005 sections that are not ordinary to icf.
2006 * icf.cc (get_section_contents): Handle relocation pointing to section
2007 with no object or shndx information.
2008 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
2009 * testsuite/Makefile.in: Regenerate.
2010 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
2011 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
2013 2010-04-22 Ian Lance Taylor <iant@google.com>
2015 * expression.cc (Expression::Expression_eval_info): Add
2016 result_alignment_pointer field.
2017 (Expression::eval_with_dot): Add result_alignment_pointer
2018 parameter. Change all callers.
2019 (Expression::eval_maybe_dot): Likewise.
2020 (class Binary_expression): Add alignment_pointer parameter to
2021 left_value and right_value. Change all callers.
2022 (BINARY_EXPRESSION): Set result alignment.
2023 (class Trinary_expression): Add alignment_pointer parameter to
2024 arg2_value and arg3_value. Change all callers.
2025 (Trinary_cond::value): Set result alignment.
2026 (Max_expression::value, Min_expression::value): Likewise.
2027 (Align_expression::value): Likewise.
2028 * script-sections.cc (class Sections_element): Add dot_alignment
2029 parameter to set_section_addresses virtual function. Update
2031 (class Output_section_element): Likewise.
2032 (Script_sections::create_segments): Add dot_alignment parameter.
2034 (Script_sections::create_segments_from_phdrs_clause): Likewise.
2035 (Script_sections::set_phdrs_clause_addresses): Likewise.
2036 * script-sections.h: Update declarations.
2037 * script.h: Update declarations.
2038 * output.h (Output_segment::set_minimum_p_align): Don't decrease
2040 * testsuite/script_test_3.t: Set large alignment.
2041 * testsuite/script_test_3.sh: Make sure that at least one LOAD
2042 segment has expected alignment.
2044 2010-04-22 Nick Clifton <nickc@redhat.com>
2046 * po/gold.pot: Updated by the Translation project.
2047 * po/vi.po: Updated Vietnamese translation.
2049 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
2051 * testsuite/Makefile.am (check_PROGRAMS): Add
2052 icf_virtual_function_folding_test.
2053 * testsuite/Makefile.in: Regenerated.
2055 2010-04-15 Andrew Haley <aph@redhat.com>
2057 * options.h (merge_exidx_entries): New option.
2058 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
2059 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
2060 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
2061 (Target_arm::merge_exidx_entries): New function.
2062 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
2063 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
2064 to Arm_exidx_fixup constructor.
2065 Add new arg, merge_exidx_entries.
2066 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
2067 Arm_output_section::fix_exidx_coverage.
2069 2010-04-18 Sriraman Tallam <tmsriram@google.com>
2071 * icf.cc (get_section_contents): Check for preemptible functions.
2072 Ignore addend when appropriate.
2073 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
2075 (add_from_relobj): Check for section folded.
2076 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
2077 * symtab.h (should_add_dynsym_entry): Add new parameter.
2078 * target-reloc.h (scan_relocs): Check for section folded.
2079 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
2080 Check reloc types for function pointers in shared objects.
2081 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
2083 (icf_preemptible_functions_test): New test case.
2084 (icf_string_merge_test): New test case.
2085 * testsuite.Makefile.in: Regenerate.
2086 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
2087 bar_glob. Refactor code.
2088 * testsuite/icf_preemptible_functions_test.cc: New file.
2089 * testsuite/icf_preemptible_functions_test.sh: New file.
2090 * testsuite/icf_string_merge_test.cc: New file.
2091 * testsuite/icf_string_merge_test.sh: New file.
2092 * testsuite/icf_virtual_function_folding_test.cc: New file.
2093 * testsuite/icf_virtual_function_folding_test.sh: New file.
2095 2010-04-14 Doug Kwan <dougkwan@google.com>
2097 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
2098 for local symbol recounting if we remove a section due to ICF.
2099 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
2100 there are no regular objects in input.
2102 2010-04-13 Doug Kwan <dougkwan@google.com>
2104 * arm.cc (Arm_input_section::set_final_data_size): Compute
2105 accurate final data size instead of using current data size.
2107 2010-04-09 Doug Kwan <dougkwan@google.com>
2109 * layout.cc (Layout::choose_output_section): Handle script section
2111 (Layout::make_output_section_for_script): Add section type parameter.
2112 Handle script section types.
2113 * layout.h (Layout::make_output_section_for_script): Add section
2115 * output.cc (Output_section::Output_section): Initialize data member
2117 (Output_section::do_reset_address_and_file_offset): Do not set address
2118 to 0 if section is a NOLOAD section.
2119 * output.h (Output_section::is_noload): New method.
2120 (Output_section::set_is_noload): Ditto.
2121 (Output_section::is_noload_): New data member.
2122 * script-c.h (Script_section_type): New enum type.
2123 (struct Parser_output_section_header): Add new file section_type.
2124 * script-sections.cc (Sections_element::output_section_name): Add
2125 parameter for returning script section type.
2126 (Output_section_definition::output_section_name): Ditto.
2127 (Output_section_definition::section_type)P; New method.
2128 (Output_section_definiton::script_section_type_name): Ditto.
2129 (Output_section_definition::script_section_type_): New data member.
2130 (Output_section_definition::Output_section_definition): Initialize
2131 data member Output_section_definition::script_section_type_.
2132 (Output_section_definition::create_sections): Pass script section type
2133 to Layout::make_output_section_for_script.
2134 (Output_section_definition::output_section_name): Return script
2135 section type to caller.
2136 (Output_section_definition::set_section_address): Do not advance
2137 dot value and load address if section type is NOLOAD. Set address
2138 of NOLOAD sections regardless of section flags.
2139 (Output_section_definition::print): Print section type if it is
2140 not SCRIPT_SECTION_TYPE_NONE.
2141 (Output_section_definition::section_type): New method.
2142 (Output_section_definition::script_section_type_name): Ditto.
2143 (Script_sections::output_section_name): Add new parameter
2144 PSECTION_TYPE for returning script section type. Pass it to
2145 section elements. Handle discard sections.
2146 (Sort_output_sections::operator()): Handle NOLOAD sections.
2147 * script-sections.h (Script_sections::Section_type): New enum type.
2148 (Script_sections::output_section_name): Add a new parameter for
2149 returning script section type.
2150 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
2152 * yyscript.y (union): Add new field SECTION_TYPE.
2153 (COPY, DSECT, INFO, NOLOAD): New tokens.
2154 (opt_address_and_section_type): Change type to output_section_header.
2155 (section_type): New non-terminal
2156 (section_header): Handle section type.
2157 (opt_address_and_section_type): Return section type value.
2159 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
2161 * testsuite/plugin_common_test_1.c (foo): Add prototype.
2162 * testsuite/plugin_common_test_2.c (foo): Likewise.
2164 2010-04-08 Doug Kwan <dougkwan@google.com>
2166 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
2168 * output.cc (Output_section::add_merge_input_section): Simplify
2169 code and return status of Output_merge_base::add_input_section.
2170 Update merge section map only if Output_merge_base::add_input_section
2173 2010-04-07 Doug Kwan <dougkwan@google.com>
2175 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
2176 if section is marked as containing instructions but has no mapping
2178 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
2179 correct section index.
2180 (Arm_relobj::find_linked_text_section): Ditto.
2182 2010-04-07 Cary Coutant <ccoutant@google.com>
2184 * archive.cc (include_member): Destroy Read_symbols_data object before
2186 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
2187 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
2188 (Read_symbols_data::~Read_symbols_data) New destructor.
2189 (Section_relocs::Section_relocs) New constructor.
2190 (Section_relocs::~Section_relocs) New destructor.
2191 (Read_relocs_data::Read_relocs_data) New constructor.
2192 (Read_relocs_data::~Read_relocs_data) New destructor.
2193 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
2194 pointers to NULL after deleting.
2196 2010-04-07 Doug Kwan <dougkwan@google.com>
2198 * arm.cc: Replace "endianity" with "endianness" in comments.
2199 (Arm_exidx_cantunwind): Ditto.
2200 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
2201 (Arm_relobj::merge_flags_and_attributes): New method.
2202 (Arm_relobj::merge_flags_and_attributes_): New data member.
2203 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
2204 (Arm_relobj::scan_sections_for_stubs): Ditto.
2205 (Arm_relobj::do_read_symbols): Check to see if we really want to
2206 merge processor-specific flags and attributes. Exit early if
2207 an object is empty except for section names and the undefined symbol.
2208 (Target_arm::do_finalize_sections): Move check for ELF format to
2209 Arm_relobj::do_read_symbols. Merge processor specific flags and
2210 attributes from a regular object only when we have determined that
2211 it is aapropriate. Do not create an .ARM.attributes section in
2212 output if there is no regular input object.
2213 (Target_arm::merge_processor_specific_flags): Check
2214 --warn-mismatch before printing any error.
2215 (Target_arm::merge_object_attributes): Ditto.
2216 * gold.cc (queue_middle_tasks): Handle the case in which there is
2217 no regular object in input.
2218 * options.cc (General_options::parse_EB): New method.
2219 (General_options::parse_EL): Same.
2220 (General_options::General_options): Initialize endianness_.
2221 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
2223 (General_options::Endianness): New enum.
2224 (General_options::endianness): New method.
2225 (General_options::endianness_): New data member.
2226 * parameters.cc (Parameters::set_options): Check target endianness.
2227 (Parameters::set_target_once): Ditto.
2228 (Parameters::check_target_endianness): New method.
2229 (parameters_force_valid_target): If either -EL or -EB is specified,
2230 use it to define endianness of default target.
2231 * parameters.h (Parameters::check_target_endianness): New method
2233 * target.h (class Target): Change "endianity" to "endianness"
2236 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2238 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
2239 * configure: Regenerate.
2240 * Makefile.in: Regenerate.
2241 * testsuite/Makefile.in: Regenerate.
2243 2010-04-06 Cary Coutant <ccoutant@google.com>
2246 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
2247 prevailing definitions of common symbols.
2248 * testsuite/plugin_test_6.sh: New test case.
2249 * testsuite/plugin_common_test_1.c: New test case.
2250 * testsuite/plugin_common_test_2.c: New test case.
2251 * testsuite/Makefile.am (plugin_test_6): New test case.
2252 * testsuite/Makefile.in: Regenerate.
2254 2010-04-06 Nick Clifton <nickc@redhat.com>
2256 * po/vi.po: New Vietnamese translation.
2258 2010-03-30 Doug Kwan <dougkwan@google.com>
2260 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
2262 2010-03-25 Doug Kwan <dougkwan@google.com>
2264 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
2265 to avoid a conversion warning on a 32-bit host.
2267 2010-03-24 Ian Lance Taylor <iant@google.com>
2269 * testsuite/script_test_3.t: Add a TLS segment.
2270 * testsuite/Makefile.am (check_PROGRAMS): Add
2271 tls_phdrs_script_test.
2272 (tls_phdrs_script_test_SOURCES): Define.
2273 (tls_phdrs_script_test_DEPENDENCIES): Define.
2274 (tls_phdrs_script_test_LDFLAGS): Define.
2275 (tls_phdrs_script_test_LDADD): Define.
2276 * testsuite/Makefile.in: Rebuild.
2278 2010-03-23 Cary Coutant <ccoutant@google.com>
2280 * fileread.cc (find_or_make_view): Fix comment.
2282 2010-03-23 Ian Lance Taylor <iant@google.com>
2284 * script-sections.cc (class Orphan_section_placement): Define
2285 PLACE_TLS and PLACE_TLS_BSS.
2286 (Orphan_section_placement::Orphan_section_placement): Initialize
2288 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
2289 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
2290 (tls_script_test_SOURCES): Define.
2291 (tls_script_test_DEPENDENCIES): Define.
2292 (tls_script_test_LDFLAGS): Define.
2293 (tls_script_test_LDADD): Define.
2294 * testsuite/Makefile.in: Rebuild.
2296 2010-03-22 Doug Kwan <dougkwan@google.com>
2298 * arm.cc (Arm_relocate_functions::abs8,
2299 Arm_relocate_functions::abs16): Use correct check for overflow
2300 specified in the ARM ELF specs.
2301 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
2302 target of a BLX instruction specially.
2303 (Reloc_stub::stub_type_for_reloc): Ditto.
2304 (Relocate::relocate): Use symbolic names instead of numeric relocation
2305 codes to report error.
2306 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
2308 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
2309 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
2310 thumb2_blx_out_of_range.stdout
2311 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
2312 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
2313 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
2314 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
2315 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
2316 thumb2_blx_in_range, thumb2_blx_in_range.o,
2317 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
2318 thumb2_blx_out_of_range.o): New rules.
2319 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
2320 thumb2_blx_in_range and thumb2_blx_out_of_range.
2321 * testsuite/Makefile.in: Regenerate.
2322 * arm_branch_in_range.sh: Add tests for THUMB BLX.
2323 * testsuite/thumb_blx_in_range.s: New file.
2324 * testsuite/thumb_blx_out_of_range.s: New file.
2326 2010-03-22 Rafael Espindola <espindola@google.com>
2328 * archive.cc (Should_include): Move to archive.h.
2329 (should_include_member): Make it a member of Archive.
2331 (Add_lib_group_symbols): New.
2332 * archive.h: Include options.h.
2333 (Archive_member): Moved from Archive.
2334 (Should_include): Moved from archive.cc.
2336 (Add_lib_group_symbols): New.
2337 * dynobj.cc (do_should_include_member): New.
2338 * dynobj.h (do_should_include_member): New.
2339 * gold.cc (queue_initial_tasks): Update call to queue.
2340 * main.cc (main): Print lib group stats.
2341 * object.cc (do_should_include_member): New.
2342 * object.h: Include archive.h.
2343 (Object::should_include_member): New.
2344 (Object::do_should_include_member): New.
2345 (Sized_relobj::do_should_include_member): New.
2346 * options.cc (General_options::parse_start_lib): New.
2347 (General_options::parse_end_lib): New.
2348 (Input_arguments::add_file): Handle lib groups.
2349 (Input_arguments::start_group): Check we are not in a lib.
2350 (Input_arguments::start_lib): New.
2351 (Input_arguments::end_lib): New.
2352 * options.h (General_options): Add start_lib and end_lib.
2353 (Input_argument::lib_): New.
2354 (Input_argument::lib): New.
2355 (Input_argument::is_lib): New.
2356 (Input_file_lib): New.
2357 (Input_arguments::in_lib_): New.
2358 (Input_arguments::in_lib): New.
2359 (Input_arguments::start_lib): New.
2360 (Input_arguments::end_lib_): New.
2361 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
2362 in unused members as preempted.
2363 (Sized_pluginobj::do_should_include_member): New.
2364 * plugin.h (Sized_pluginobj::do_should_include_member): New.
2365 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
2367 (Read_symbols::do_whole_lib_group): New.
2368 (Read_symbols::do_lib_group): New.
2369 (Read_symbols::do_read_symbols): Handle lib groups.
2370 (Read_symbols::get_name): Handle lib groups.
2371 * readsyms.h (Read_symbols): Add an archive member pointer.
2372 (Read_symbols::do_whole_lib_group): New.
2373 (Read_symbols::do_lib_group): New.
2374 (Read_symbols::member_): New.
2375 * script.cc (read_input_script): Update call to queue_soon.
2377 2010-03-19 Doug Kwan <dougkwan@google.com>
2379 * arm.cc (Stub_table::Stub_table): Initialize new data members
2380 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
2381 (Stub_table::add_reloc_stub): Assign stub offset and update
2382 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
2383 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
2385 (Stub_table::update_data_size_and_addralign): Use
2386 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
2387 instead of going over all reloc stubs.
2388 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
2389 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
2390 Stringpool_template::offset_ to size of Stringpool_char.
2391 (Stringpool_template::new_key_offset): Remove code to initialize
2392 Stringpool_template::offset_.
2393 * stringpool.h (Stringpool_template::set_no_zero_null): Set
2394 Stringpool_template::offset_ to zero.
2396 2010-03-15 Doug Kwan <dougkwan@google.com>
2398 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
2400 (Stringpool_template::new_key_offset): New method.
2401 (Stringpool_template::add_string): Assign offsets when adding new
2403 (Stringpool_template::set_string_offsets): Do not set string offsets
2404 when not optimizing.
2405 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
2407 (Chunked_vector::clear): Clear size_.
2408 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
2409 (Chunked_vector::size): Return size_.
2410 (Chunked_vector::push_back): Use size_ to find insert position.
2411 (Chunked_vector::size_): New data member.
2412 (Stringpool_template::set_no_zero_null): Assert string set is empty.
2413 (Stringpool_template::new_key_offset): New method declaration.
2414 (Stringpool_template::offset_): New data member.
2416 2010-03-15 Rafael Espindola <espindola@google.com>
2418 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
2419 Add_symbols' constructor.
2420 * readsyms.h (Add_symbols): Remove the input_group member.
2422 2010-03-10 Ian Lance Taylor <iant@google.com>
2424 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
2425 target to ask whether a reference to a symbol requires a stack
2427 * target.h (Target::is_call_to_non_split): New function.
2428 (Target::do_is_call_to_non_split): Declare virtual function.
2429 * target.cc: Include "symtab.h".
2430 (Target::do_is_call_to_non_split): New function.
2431 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
2433 2010-03-10 Cary Coutant <ccoutant@google.com>
2435 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
2436 (File_read::open[1]): Remove initial mapping of whole_file_view_.
2437 (File_read::open[2]): Add whole_file_view_ to list of views.
2438 (File_read::make_view): Remove test of whole_file_view_.
2439 (File_read::find_or_make_view): Create whole_file_view_ if
2441 (File_read::clear_views): Replace bool parameter with enum;
2442 adjust all callers. Don't delete views with permanent data;
2443 do delete cached views and views from archives if
2444 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
2445 if clearing the corresponding view.
2446 * fileread.h (File_read::Clear_views_mode): New enum.
2447 (File_read::View::is_permanent_view): New method.
2448 (File_read::clear_views): Replace bool parameter
2449 with enum; adjust all callers.
2450 * options.h (General_options): Change keep_files_mapped option;
2451 add map_whole_files.
2452 * readsyms.cc (Add_symbols::run): Delete sd_ object before
2454 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
2457 2010-03-10 David S. Miller <davem@davemloft.net>
2459 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
2461 2010-03-09 Sriraman Tallam <tmsriram@google.com>
2463 * icf.cc (get_section_contents): Add '@' marker after processing the
2466 2010-03-08 Doug Kwan <dougkwan@google.com>
2468 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
2469 due to a conversion warning.
2470 (Arm_relobj::update_output_local_symbol_count): Check for local
2471 symbol with unset output index.
2473 2010-03-05 Ian Lance Taylor <iant@google.com>
2475 * options.h (class General_options): Add --spare-dynamic-tags.
2476 * output.cc (Output_data_dynamic::set_final_data_size): Implement
2477 --spare-dynamic-tags.
2479 2010-03-05 Ian Lance Taylor <iant@google.com>
2481 * incremental.cc: Include "libiberty.h".
2483 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
2485 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
2486 function, is_info_ member.
2487 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
2488 (Versions::Versions): Update caller.
2489 (Versions::define_base_version): Likewise.
2490 (Versions::add_def): Likewise.
2492 2010-03-03 Sriraman Tallam <tmsriram@google.com>
2494 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
2495 (Scan::possible_function_pointer_reloc): New function.
2496 (Scan::local_reloc_may_be_function_pointer): Change to call
2497 possible_function_pointer_reloc.
2498 (Scan::global_reloc_may_be_function_pointer): Ditto.
2499 * icf.h (Icf::check_section_for_function_pointers): Change to reject
2500 relocations in ".data.rel.ro._ZTV" section.
2501 * testsuite/icf_safe_so_test.sh: Change to pass i386.
2502 * testsuite/icf_safe_so_test.cc: Ditto.
2503 * testsuite/icf_safe_test.cc: Ditto.
2504 * testsuite/icf_safe_test.sh: Ditto.
2506 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2507 Ian Lance Taylor <iant@google.com>
2509 * target-reloc.h (relocate_section): Check the symbol table index
2510 for -1U before setting the local symbol index.
2511 (scan_relocatable_relocs): If copying the relocation, record that
2512 the local symbol is required.
2513 * object.h (Symbol_value::is_output_symtab_index_set): New
2515 (Symbol_value::may_be_discarded_from_output_symtab): New
2517 (Symbol_value::has_output_symtab_entry): New function.
2518 (Symbol_value::needs_output_symtab_entry): Remove.
2519 (Symbol_value::output_symtab_index): Make sure the symbol index is
2521 (Symbol_value::set_output_symtab_index): Make sure the symbol
2522 index is not set. Make sure the new index is valid.
2523 (Symbol_value::set_must_have_output_symtab_entry): New function.
2524 (Symbol_value::has_output_dynsym_entry): New function.
2525 (Symbol_value::set_output_dynsym_index): Make sure the new index
2527 (Sized_relobj::set_must_have_output_symtab_entry): New function.
2528 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
2529 local symbol if permitted.
2530 (Sized_relobj::do_finalize_local_symbols): Call
2531 is_output_symtab_index_set rather than needs_output_symtab_entry.
2532 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
2533 rather than needs_output_symtab_entry. Call
2534 has_output_dynsym_entry rather than needs_output_dynsym_entry.
2535 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
2536 is_output_symtab_index_set rather than needs_output_symtab_entry.
2537 * testsuite/discard_locals_relocatable_test.c: New file.
2538 * testsuite/discard_locals_test.sh: Test -r.
2539 * testsuite/Makefile.am (check_DATA): Add
2540 discard_locals_relocatable_test1.syms,
2541 discard_local_relocatable_test2.syms.
2542 (MOSTLYCLEANFILES): Likewise. Also add
2543 discard_locals_relocatable_test1.lout and
2544 discard_locals_relocatable_test2.out.
2545 (discard_locals_relocatable_test1.syms): New target.
2546 (discard_locals_relocatable_test.o): New target.
2547 (discard_locals_relocatable_test1.out): New target.
2548 (discard_locals_relocatable_test2.syms): New target.
2549 (discard_locals_relocatable_test2.out): New target.
2550 (various): Add missing ../ld-new dependencies.
2551 * testsuite/Makefile.in: Rebuild.
2553 2010-03-03 Nick Clifton <nickc@redhat.com>
2555 * po/fi.po: New Finnish translation.
2557 2010-03-01 Doug Kwan <dougkwan@google.com>
2559 * layout.cc (Layout::Layout): Force section types of .init_array*,
2560 .preinit_array* and .fini_array* sections.
2561 * output.cc (Output_section::Input_section_sort_entry::has_priority):
2562 Fix check of return value of std::string::find.().
2563 (Output_section::Input_section_sort_compare::operator()): Remove
2564 comment about .init_array.
2565 (Output_section::Input_section_sort_init_fini_compare::operator()):
2567 (Output_section::sort_attached_input_sections): Handle .init_array
2568 and .fini_array specially.
2569 * output.h (Output_section::Inut_section_sort_compare): Update
2571 (Output_section::Input_section_sort_init_fini_compare): New struct.
2573 2010-02-26 Doug Kwan <dougkwan@google.com>
2575 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
2576 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
2577 * testsuite/debug_msg.sh: Avoid matching source line number for
2578 use of global variable undef_int.
2580 2010-02-26 Doug Kwan <dougkwan@google.com>
2582 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
2583 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
2584 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
2585 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
2586 * options.cc (General_options::General_options): Initialize member
2588 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
2589 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
2590 and rm_no_fix_v4bx.stdout
2591 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
2592 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
2593 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
2594 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
2595 and arm_no_fix_v4bx.
2596 * Makefile.in: Regenerate.
2597 * testsuite/arm_fix_v4bx.s: New file.
2598 * testsuite/arm_fix_v4bx.sh: Ditto.
2600 2010-02-24 Doug Kwan <dougkwan@google.com>
2602 * arm.cc (Target_arm::got_section): Make the .got section the first
2603 non RELRO section in the data segment.
2604 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
2605 suffixes of section names.
2607 2010-02-24 Doug Kwan <dougkwan@google.com>
2609 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
2610 flags and attributes merging if an input file is a binary file.
2611 * fileread.cc (Input_file::open): Record format of original file.
2612 * fileread.h (Input_file::Format): New enum type.
2613 (Input_file::Input_file): Initialize data member format_.
2614 (Input_file::format): New method definition.
2615 (Input_file::format_):: New data member.
2617 2010-02-24 Doug Kwan <dougkwan@google.com>
2619 * arm.cc (Arm_output_data_got): New class.
2620 (ARM_TCB_SIZE): New constant
2621 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
2622 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
2623 If user uses a script with a SECTIONS clause, issue only a warning
2624 for a misplaced EXIDX input section. Otherwise, issue an error.
2625 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
2627 (Target_arm::got_mode_index_entry): Handle static linking.
2628 (Target_arm::Scan::local): Ditto.
2629 (Target_arm::Scan::global): Ditto.
2630 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
2631 all incorrectly implemented relocations.
2632 (Target_arm::fix_exidx_coverage): Pass layout to
2633 Arm_output_section::fix_exidx_coverage.
2634 * layout.cc (Layout::section_name_mapping): Remove trailing dots
2635 from ".ARM.exidx." and ".ARM.extab.".
2637 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2639 * arm.cc (Target_arm::do_finalize_sections): Create attribute
2640 section if it does not already exist.
2641 * attributes.cc (Attributes_section_data::Attributes_section_data):
2642 Don't crash if size is zero.
2644 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2645 Ian Lance Taylor <iant@google.com>
2647 * gold.cc (queue_middle_tasks): If no input files were opened,
2649 * workqueue.h (Task_function::Task_function): Assert that there is
2652 2010-02-22 Doug Kwan <dougkwan@google.com>
2654 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
2655 * icf.cc (get_section_contents): Cast snprintf arguments to long long
2656 types to avoid warnings due to different uint64_t implementations
2659 2010-02-21 Doug Kwan <dougkwan@google.com>
2661 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
2662 handling of the maximum backward branch offset.
2663 (Arm_relocate_functions::thumb_branch_common): Ditto.
2664 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
2665 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
2666 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
2667 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
2668 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
2669 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
2670 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
2671 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
2672 thumb_bl_out_of_range thumb_bl_out_of_range.o,
2673 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
2674 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
2675 thumb2_bl_out_of_range.o): New rules.
2676 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
2677 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
2678 thumb2_bl_out_of_range
2679 * testsuite/Makefile.in: Regenerate.
2680 * testsuite/arm_bl_in_range.s: New file.
2681 * testsuite/arm_bl_out_of_range.s: Ditto.
2682 * testsuite/arm_branch_in_range.sh: Ditto.
2683 * testsuite/arm_branch_range.t: Ditto.
2684 * testsuite/thumb2_branch_range.t: Ditto.
2685 * testsuite/thumb_bl_in_range.s: Ditto.
2686 * testsuite/thumb_bl_out_of_range.s: Ditto.
2687 * testsuite/thumb_branch_range.t: Ditto.
2689 2010-02-20 Sriraman Tallam <tmsriram@google.com>
2691 * gc.h (gc_process_relocs): Change vectors to point to the new list.
2692 Add reloc offset information.
2693 * icf.cc (get_section_contents): Change iterators to point to the new
2694 vectors. Add reloc offset information to the contents.
2695 * icf.h (Icf::Sections_reachable_info): New typedef.
2696 (Icf::Sections_reachable_list): New typedef.
2697 (Icf::Offset_info): New typedef.
2698 (Icf::Reloc_info): New struct typedef.
2699 (Icf::Reloc_info_list): New typedef.
2700 (Icf::symbol_reloc_list): Delete method.
2701 (Icf::addend_reloc_list): Delete method.
2702 (Icf::section_reloc_list): Delete method.
2703 (Icf::reloc_info_list): New method.
2704 (Icf::reloc_info_list_): New member.
2706 2010-02-19 Doug Kwan <dougkwan@google.com>
2708 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
2709 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
2710 * arm.cc (Arm_relocation_functions): New forward declaration.
2711 (Target_arm::Target_arm): Initialize new data members
2712 got_mod_index_offset_ and tls_base_symbol_defined_.
2713 (Target_arm::Relocate::relocate_tls): New method.
2714 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
2715 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
2717 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
2718 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
2719 (Target_arm::got_mod_index_offset_,
2720 Target_arm::tls_base_symbol_defined_): New data members.
2721 (Target_arm::Scan::local, Target::Scan::global,
2722 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
2725 2010-02-18 Doug Kwan <dougkwan@google.com>
2727 * arm.cc (Arm_relobj::find_linked_text_section): New method.
2728 (Arm_relobj::make_exidx_input_section): Pass section index of linked
2729 text section as a parameter becuase some broken tools may not set
2730 the link in section header.
2731 (Target_arm::has_got_section): New method.
2732 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
2733 without any mapping symbol as data only. Remove warning.
2734 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
2735 link in its section header, try to discover the link by inspecting the
2736 REL31 relocation at the beginning of the section.
2737 (Target_arm::Scan::check_non_pic): Report name of offending relocation
2739 (Target_arm::Scan::global): Treat any reference to the symbol
2740 _GLOBAL_OFFSET_TABLE_ as a GOT access.
2742 2010-02-12 Sriraman Tallam <tmsriram@google.com>
2744 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
2745 (Scan::global_reloc_may_be_function_pointer): New function.
2746 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
2747 (Scan::global_reloc_may_be_function_pointer): New function.
2748 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
2749 (Scan::global_reloc_may_be_function_pointer): New function.
2750 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
2751 (Scan::global_reloc_may_be_function_pointer): New function.
2752 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
2753 (Scan::global_reloc_may_be_function_pointer): New function.
2754 (Scan::possible_function_pointer_reloc): New function.
2755 (Target_x86_64::can_check_for_function_pointers): New function.
2756 * gc.h (gc_process_relocs): Scan relocation types to determine if
2757 function pointers were taken for targets that support it.
2758 * icf.cc (Icf::find_identical_sections): Include functions for
2759 folding in safe ICF whose pointer is not taken.
2760 * icf.h (Secn_fptr_taken_set): New typedef.
2761 (fptr_section_id_): New member.
2762 (section_has_function_pointers): New function.
2763 (set_section_has_function_pointers): New function.
2764 (check_section_for_function_pointers): New function.
2765 * options.h: Fix comment for safe ICF option.
2766 * target.h (can_check_for_function_pointers): New function.
2767 * testsuite/Makefile.am: Add icf_safe_so_test test case.
2768 Modify icf_safe_test for X86-64.
2769 * testsuite/Makefile.in: Regenerate.
2770 * testsuite/icf_safe_so_test.cc: New file.
2771 * testsuite/icf_safe_so_test.sh: New file.
2772 * testsuite/icf_safe_test.cc (kept_func_3): New function.
2773 (main): Change to take pointer to function kept_func_3.
2774 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
2775 folding is done correctly for X86-64.
2777 2010-02-12 David S. Miller <davem@davemloft.net>
2779 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
2780 is_symbolless parameter.
2781 (Output_reloc<SHT_REL>::is_symbolless): New.
2782 (Output_reloc<SHT_REL>::is_symbolless_): New.
2783 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
2784 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
2785 (Output_reloc<SHT_RELA>::is_symbolless): New.
2786 (Output_data_reloc::add_global): Handle is_symbolless.
2787 (Output_data_reloc::add_global_relative): Likewise.
2788 (Output_data_reloc::add_local): Likewise.
2789 (Output_data_reloc::add_local_relative): Likewise.
2790 (Output_data_reloc::add_symbolless_global_addend): New.
2791 (Output_data_reloc::add_symbolless_local_addend): New.
2792 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
2794 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
2795 instead of ->is_relative_
2796 (Output_reloc::write): Likewise.
2797 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
2798 (Output_reloc::write_rel): Simplify.
2800 * sparc.cc (Target_sparc::Scan::local): Use
2801 ->add_symbolless_local_addend as needed.
2802 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
2803 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
2804 based upon relocation offset.
2806 2010-02-11 Doug Kwan <dougkwan@google.com>
2808 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
2809 (Target_arm::Scan::global): Ditto. Also remove a comment before the
2810 beginning of function.
2811 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
2812 and MOVT_ABS relocations. Those are non issued in scanning. Fix
2813 parameter is_32bit in calls to should_apply_static_reloc.
2814 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
2815 (check_DATA): Add arm_abs_global.stdout.
2816 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
2817 arm_abs_global.stdout): New rules.
2818 (MOSTLLYCLEANFILES): Add arm_abs_global
2819 * Makefile.in: Regenerate.
2820 * testsuite/arm_abs_global.s: New file.
2821 * testsuite/arm_abs_global.sh: Ditto.
2822 * testsuite/arm_abs_lib.s: Ditto.
2824 2010-02-11 Ian Lance Taylor <iant@google.com>
2826 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
2828 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
2829 Allocate_commons_task first.
2830 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
2831 task, rather than symtab_lock_.
2832 (Gc_process_relocs::~Gc_process_relocs): New function.
2833 (Gc_process_relocs::is_runnable): Check this_blocker_.
2834 (Gc_process_relocs::locks): Use next_blocker_ rather than
2836 (Scan_relocs::~Scan_relocs): New function.
2837 (Scan_relocs::is_runnable): Check this_blocker_ rather than
2839 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
2841 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
2842 fields. Add this_blocker_ and next_blocker_ fields. Adjust
2843 constructor accordingly.
2844 (class Gc_process_relocs): Likewise.
2845 (class Scan_relocs): Likewise.
2846 * common.h (class Allocate_commons_task): Remove symtab_lock_
2847 field, and corresponding constructor parameter.
2848 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
2850 (Allocate_commons_task::locks): Likewise.
2852 2010-02-11 Ian Lance Taylor <iant@google.com>
2854 * gold-threads.h (class Once): Define.
2855 (class Initialize_lock): Rewrite as child of Once.
2856 * gold-threads.cc (class Once_initialize): Define.
2857 (once_pointer_control): New static variable.
2858 (once_pointer, once_arg): New static variables.
2859 (c_run_once): New static function.
2860 (Once::Once, Once::run_once, Once::internal_run): New functions.
2861 (class Initialize_lock_once): Remove.
2862 (initialize_lock_control): Remove.
2863 (initialize_lock_pointer): Remove.
2864 (initialize_lock_once): Remove.
2865 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
2866 (Initialize_lock::initialize): Rewrite.
2867 (Initialize_lock::do_run_once): New function.
2868 * archive.cc (Archive::interpret_header): Only clear name if it is
2870 * fileread.cc: Include "gold-threads.h"
2871 (file_counts_lock): New static variable.
2872 (file_counts_initialize_lock): Likewise.
2873 (File_read::release): Only increment counts when using --stats.
2874 Use a lock around the increment.
2875 * parameters.cc (class Set_parameters_target_once): Define.
2876 (set_parameters_target_once): New static variable.
2877 (Parameters::Parameters): Move here from parameters.h.
2878 (Parameters::set_target): Rewrite.
2879 (Parameters::set_target_once): New function.
2880 (Parameters::clear_target): Move here and rewrite.
2881 * parameters.h (class Parameters): Update declarations. Add
2882 set_parameters_target_once_ field.
2883 (Parameters::Parameters): Move to parameters.cc.
2884 (Parameters::clear_target): Likewise.
2885 * readsyms.cc (Read_symbols::do_group): Create a Start_group
2887 (Start_group::~Start_group): New function.
2888 (Start_group::is_runnable): New function.
2889 (Start_group::locks, Start_group::run): New functions.
2890 (Finish_group::run): Change saw_undefined to size_t.
2891 * readsyms.h (class Start_group): Define.
2892 (class Finish_group): Change saw_undefined_ field to size_t.
2893 (Finish_group::Finish_group): Remove saw_undefined and
2894 this_blocker parameters. Change all callers.
2895 (Finish_group::set_saw_undefined): New function.
2896 (Finish_group::set_blocker): New function.
2897 * symtab.h (class Symbol_table): Change saw_undefined to return
2898 size_t. Change saw_undefined_ field to size_t.
2899 * target-select.cc (Set_target_once::do_run_once): New function.
2900 (Target_selector::Target_selector): Initialize set_target_once_
2901 field. Don't initialize lock_ and initialize_lock_ fields.
2902 (Target_selector::instantiate_target): Rewrite.
2903 (Target_selector::set_target): New function.
2904 * target-select.h (class Set_target_once): Define.
2905 (class Target_selector): Update declarations. Make
2906 Set_target_once a friend. Remove lock_ and initialize_lock_
2907 fields. Add set_target_once_ field.
2909 2010-02-10 Ian Lance Taylor <iant@google.com>
2911 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
2913 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
2914 (queue_middle_tasks): Add all blockers before queueing any tasks.
2915 (queue_final_tasks): Likewise.
2916 * token.h (Task_token::add_blockers): New function.
2917 * object.h (Input_objects::number_of_relobjs): New function.
2919 2010-02-10 Ian Lance Taylor <iant@google.com>
2921 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
2922 shared, not if not position independent.
2923 * x86_64.cc (Relocate::relocate_tls): Likewise.
2924 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
2925 (tls_pie_pic_test): New target.
2926 * testsuite/Makefile.in: Rebuild.
2928 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
2929 (tls_test_main_pie.o, tls_test_pie.o): New targets.
2930 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
2931 * testsuite/Makefile.in: Rebuild.
2933 2010-02-09 David S. Miller <davem@davemloft.net>
2935 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
2936 R_SPARC_RELATIVE using ->add_local_relative().
2937 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
2939 * output.h (Output_data_dynamic::add_section_size): New method
2940 that takes two Output_data objects.
2941 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
2942 entry param. Handle it in initializers.
2943 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
2944 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
2945 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
2947 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
2948 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
2949 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
2950 for dynrel_includes_plt.
2951 * i386.cc (Target_i386::do_finalize_sections): Likewise.
2952 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2953 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
2955 (Target_sparc::do_finalize_sections): Update to pass true for
2956 dynrel_includes_plt.
2957 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
2958 output before .rela.plt
2959 (Target_powerpc::do_finalize_sections): Update to pass true for
2960 dynrel_includes_plt when 32-bit.
2962 2010-02-08 Doug Kwan <dougkwan@google.com>
2964 * arm.cc (Arm_relobj::simple_input_section_output_address): New
2966 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
2967 Arm_relobj::scan_section_for_cortex_a8_stubs,
2968 Arm_relobj::do_relocation_section): Instead of calling
2969 Output_section::output_address, use faster
2970 Arm_relobj::simple_input_section_output_address.
2972 2010-02-08 David S. Miller <davem@davemloft.net>
2974 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
2975 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
2976 relocation helper function.
2978 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
2979 just like R_SPARC_GOT{10,13,22}.
2980 (Target_sparc::Scan::local): Likewise.
2981 (Target_sparc::Relocate:relocate): Likewise.
2983 2010-02-06 Ian Lance Taylor <iant@google.com>
2985 * configure.ac: Rewrite targetobjs duplicate removal code to use
2986 only shell constructs.
2987 * configure: Rebuild.
2989 2010-02-05 Doug Kwan <dougkwan@google.com>
2992 * arm.cc (Arm_relobj::section_is_scannable): New method.
2993 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
2994 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
2996 2010-02-04 Doug Kwan <dougkwan@google.com>
2999 * arm-reloc-property.cc (cstdio): Include.
3000 * configure.ac (targetobjs): Remove duplicates.
3001 * configure: Regenerate.
3002 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
3003 big and little endian version for a given address size.
3005 2010-02-03 Doug Kwan <dougkwan@google.com>
3007 * arm-reloc-property.cc
3008 (Arm_reloc_property_table::reloc_name_in_error_message): New method
3010 * arm-reloc-property.h
3011 (Arm_reloc_property_table::get_implemented_static_reloc_property):
3012 New method definition.
3013 (Arm_reloc_property_table::reloc_name_in_error_message): New method
3015 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
3017 (GOT_PREL): Change implemented to Y.
3018 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
3019 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
3020 (Arm_relocate_functions::movw_abs_nc): Remove method.
3021 (Arm_relocate_functions::movt_abs): Ditto.
3022 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
3023 (Arm_relocate_functions::thm_movt_abs): Ditto.
3024 (Arm_relocate_functions::movw_rel_nc): Ditto.
3025 (Arm_relocate_functions::movw_rel): Ditto.
3026 (Arm_relocate_functions::movt_rel): Ditto.
3027 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
3028 (Arm_relocate_functions:thm_movw_rel): Ditto.
3029 (Arm_relocate_functions:thm_movt_rel): Ditto.
3030 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
3031 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
3032 New method definitions.
3033 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
3034 (Arm_relocation_functions::arm_grp_ldr): Ditto.
3035 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
3036 (Arm_relocation_functions::arm_grp_ldc): Ditto.
3037 (Target_arm::Relocate::relocate): Check for non-static or
3038 unimplemented relocation code and exit early. Change calls to
3039 Target_arm::reloc_uses_thumb_bit and
3040 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
3041 instead. Refactor code to handle similar relocations to increase
3042 code sharing. Remove check for unsupported relocation code in switch
3044 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
3045 relocation property table to find out size. Change error message to
3046 print out the name of a relocation code instead of the numeric value.
3047 (Target_arm::scan_reloc_for_stub): Use relocation property table
3048 instead of calling Target_arm::reloc_uses_thumb_bit().
3050 2010-02-02 Doug Kwan <dougkwan@google.com>
3052 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
3053 types of relaxed input section.
3055 2010-02-02 Doug Kwan <dougkwan@google.com>
3057 * Makefile.am (HFILES): Add arm-reloc-property.h.
3059 (TARGETSOURCES): Add arm-reloc-property.cc
3060 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
3061 (libgold_a_SOURCES): $(DEFFILES)
3062 * Makefile.in: Regenerate.
3063 * arm-reloc-property.cc: New file.
3064 * arm-reloc-property.h: New file.
3065 * arm-reloc.def: New file.
3066 * arm.cc: Update comments.
3067 (arm-reloc-property.h): New included header.
3068 (arm_reloc_property_table): New global variable.
3069 (Target_arm::do_select_as_default_target): New method definition.
3070 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
3071 arm-reloc-property to targ_extra_obj.
3072 * parameters.cc (set_parameters_target): Call
3073 Target::select_as_default_target().
3074 * target.h (Target::select_as_default_target): New method definition.
3075 (Target::do_select_as_default_target): Same.
3077 2010-02-01 Doug Kwan <dougkwan@google.com>
3079 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
3080 first_output_text_section_.
3081 (Arm_exidx_fixup::first_output_text_section): New method definition.
3082 (Arm_exidx_fixup::first_output_text_section_): New data member.
3083 (Arm_exidx_fixup::process_exidx_section): Record the first text
3084 output section seen.
3085 (Arm_output_section::fix_exidx_coverage): Set correct linked section
3086 and entsize in output section header.
3088 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3090 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
3091 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
3092 (Arm_relocate_functions::thm_alu11): New Method.
3093 (Arm_relocate_functions::thm_pc8): New Method.
3094 (Arm_relocate_functions::thm_pc12): New Method.
3095 (Target_arm::Scan::local): Handle the relocations.
3096 (Target_arm::Scan::global): Likewise.
3097 (Target_arm::Relocate::relocate): Likewise.
3098 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
3100 2010-01-29 Doug Kwan <dougkwan@google.com>
3102 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
3103 of relocation types as ld.
3105 2010-01-29 Doug Kwan <dougkwan@google.com>
3107 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
3109 (Arm_relocate_functions::thumb_branch_common): Ditto.
3110 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
3111 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
3112 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
3113 Arm_relocate_functions::jump24): Remove.
3114 (Target_arm::Relocate::relocate): Adjust code to call
3115 Arm_relocation_functions::arm_branch_common and
3116 Arm_relocation_functions::thumb_branch_common instead of their removed
3117 wrappers. Merge switch-cases together to reduce source code size.
3119 2010-01-29 Doug Kwan <dougkwan@google.com>
3121 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
3122 output_local_symbol_count_needs_update_.
3123 (Arm_relobj::output_local_symbol_count_needs_update,
3124 Arm_relobj::set_output_local_symbol_count_needs_update,
3125 Arm_relobj::update_output_local_symbol_count): New methods.
3126 (Arm_relobj::output_local_symbol_count_needs_update_): New data
3128 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
3129 of pointed function as in a R_ARM_PREL31 relocation.
3130 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
3131 for output local symbol count updating.
3132 (Target_arm::do_relax): Update output local symbol counts in objects
3134 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
3136 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3138 * arm.cc: Added support for the ARM relocations:
3139 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
3140 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
3141 (Arm_relocate_functions::movw_rel_nc): Renamed (was
3143 (Arm_relocate_functions::movw_rel): New method.
3144 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
3145 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
3147 (Arm_relocate_functions::thm_movw_rel): New method.
3148 (Arm_relocate_functions::thm_movt_rel): Renamed (was
3150 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
3152 (Target_arm::Scan::global): Likewise.
3153 (Target_arm::Relocate::relocate): Likewise.
3154 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
3157 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3159 * arm.cc: Added support for ARM group relocations.
3160 (Target_arm::reloc_needs_sym_origin): New method.
3161 (Arm_relocate_functions::calc_grp_kn): New method.
3162 (Arm_relocate_functions::calc_grp_residual): New method.
3163 (Arm_relocate_functions::calc_grp_gn): New method.
3164 (Arm_relocate_functions::arm_grp_alu): New Method.
3165 (Arm_relocate_functions::arm_grp_ldr): New Method.
3166 (Arm_relocate_functions::arm_grp_ldrs): New Method.
3167 (Arm_relocate_functions::arm_grp_ldc): New Method.
3168 (Target_arm::Scan::local): Handle the ARM group relocations.
3169 (Target_arm::Scan::global): Likewise.
3170 (Target_arm::Relocate::relocate): Likewise.
3171 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
3174 2010-01-26 Doug Kwan <dougkwan@google.com>
3176 * arm.cc (set): Include.
3177 (class Arm_exidx_fixup): Change type of last_input_section_ to const
3179 (Arm_output_section::Text_section_list): New type.
3180 (Arm_output_section::append_text_sections_to_list): New method.
3181 (Arm_output_section::fix_exidx_coverage): Ditto.
3182 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
3183 (Arm_relobj::convert_input_section_to_relaxed_section): Use
3184 Relobj::set_section_offset() instead of
3185 Sized_relobj::invalidate_section_offset().
3186 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
3187 parameter for section headers. Ignore relocation sections for
3188 unallocated sections and EXIDX sections.
3189 (Target_arm::fix_exidx_coverage): New method.
3190 (Target_arm::output_section_address_less_than): New type.
3191 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
3192 linked text section instead of the EXIDX section.
3193 (Arm_output_section::create_stub_group): Add an assertion to check
3194 that this is not an EXIDX output section.
3195 (Arm_output_section::append_text_sections_to_list): New method.
3196 (Arm_output_section::fix_exidx_coverage): Ditto.
3197 (Arm_relobj::scan_sections_for_stubs): Adjust call to
3198 Arm_relobj::section_needs_reloc_stub_scanning.
3199 (Target_arm::do_relax): Fix EXIDX output section coverage in the
3201 (Target_arm::fix_exidx_coverage): New method.
3202 * object.h (Relobj::set_output_section): New method.
3203 (Sized_relobj::invalidate_section_offset): Remove method.
3204 (Sized_relobj::do_invalidate_section_offset): Remove method.
3205 (Sized_relobj::do_set_section_offset): Handle offset value -1.
3207 2010-01-25 Doug Kwan <dougkwan@google.com>
3209 * arm.cc (Arm_exidx_merged_section::do_output_offset):
3210 Fix warning due to signed and unsigned comparison on a 32-bit host.
3212 2010-01-22 Doug Kwan <dougkwan@google.com>
3214 * arm.cc (Target_arm::do_relax): Record an output section for section
3215 offset adjustment it contains any stub table that has changed.
3216 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
3217 offsets in an output section if necessary.
3218 * output.cc (Output_section::Output_section): Initialize
3219 section_offsets_need_adjustments_.
3220 (Output_section::add_input_section_for_script): Renamed to
3221 Output_section::add_simple_input_section.
3222 (Output_section::save_states): Add a comment.
3223 (Output_section::discard_states): New method defintion.
3224 (Output_section::adjust_section_offsets): Same.
3225 * output.h (Output_section::add_input_section_for_script): Renamed to
3226 Output_section::add_simple_input_section.
3227 (Output_section::discard_states): New method declaration.
3228 (Output_section::adjust_section_offsets): Same.
3229 (Output_section::section_offsets_need_adjustment,
3230 Output_section::set_section_offsets_need_adjustment): New method
3232 (Output_section::section_offsets_need_adjustment_): New data member.
3233 * script-sections.cc
3234 (Output_section_element_input::set_section_address): Adjust code for
3235 renaming of Output_section::add_input_section_for_script.
3236 (Orphan_output_section::set_section_address): Same.
3238 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3240 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
3241 Fix_v4bx enum values .
3242 * gold/options.h (General_options): New option definitions.
3243 (General_options::fix_v4bx): New method.
3244 (General_options::Fix_v4bx): New enum.
3245 * gold/options.cc (General_options::parse_fix_v4bx): New method.
3246 (General_options::parse_fix_v4bx_interworking): New method.
3248 2010-01-22 Doug Kwan <dougkwan@google.com>
3250 * arm.cc (Arm_exidx_fixup): New class.
3252 2010-01-21 Doug Kwan <dougkwan@google.com>
3254 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
3256 (Arm_exidx_section_offset_map): New type.
3258 2010-01-21 Doug Kwan <dougkwan@google.com>
3260 * arm.cc (Arm_exidx_input_section): New class.
3261 (Arm_relobj::exidx_input_section_by_link,
3262 Arm_relobj::exidx_input_section_by_shndx,
3263 Arm_relobj::make_exidx_input_section): New methods.
3264 (read_arm_attributes_section): Remove.
3265 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
3266 information about them.
3267 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
3270 2010-01-20 Doug Kwan <dougkwan@google.com>
3272 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
3273 Input_section_specifier to Section_id.
3274 (Target_arm::new_arm_input_section: Adjust code for change of key
3276 (Target_arm::find_arm_input_section): Ditto.
3277 * gc.h (object.h): Include for Section_id nand Section_id_hash.
3278 (Section_id): Remove.
3279 (Garbage_collection::Section_id_hash): Remove.
3280 * icf.h (object.h): Include for Section_id nand Section_id_hash.
3281 (Section_id): Remove.
3282 (Icf::Section_id_hash): Remove.
3283 * object.h (Section_id, Const_section_id, Section_id_hash,
3284 Const_section_id_hash): New type definitions.
3285 * output.cc (Output_section::add_relaxed_input_section): Change to
3286 use Const_section_id instead of Input_section_specifier as key type.
3287 (Output_section::add_merge_input_section): Ditto.
3288 (Output_section::build_relaxation_map): Change to use Section_id
3289 instead of Input_section_specifier as key type.
3290 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3292 (Output_section::convert_input_sections_to_relaxed_sections): Change
3293 to use Const_section_id instead of Input_section_specifier as key type.
3294 (Output_section::find_merge_section): Ditto.
3295 (Output_section::find_relaxed_input_section): Ditto.
3296 * output.h (Input_section_specifier): Remove class.
3297 (Output_section::Output_section_data_by_input_section_map): Change
3298 key type to Const_section_id.
3299 (Output_section::Output_relaxed_input_section_by_input_section_map):
3301 (Output_section::Relaxation_map): Change key type to Section_id.
3303 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3305 * gold/arm.cc: Added support for R_ARM_V4BX relocation
3306 (class Arm_v4bx_stub): New class.
3307 (DEF_STUBS): Updated definition to support v4_veneer_bx.
3308 (Stub_factory::make_arm_v4bx_stub): New method.
3309 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
3310 (Stub_table::empty): Handle v4bx stubs.
3311 (Stub_table::add_arm_v4bx_stub): New method.
3312 (Stub_table::find_arm_v4bx_stub): New method.
3313 (Arm_relocate_functions::v4bx): New method.
3314 (Target_arm::fix_v4bx): New method.
3315 (Target_arm::Target_arm): Handle R_ARM_V4BX.
3316 (Stub_table::relocate_stubs): Likewise.
3317 (Stub_table::do_write): Likewise.
3318 (Stub_table::update_data_size_and_addralign): Likewise.
3319 (Stub_table::finalize_stubs): Likewise.
3320 (Target_arm::Scan::local): Likewise.
3321 (Target_arm::Scan::global): Likewise.
3322 (Target_arm::do_finalize_sections): Likewise.
3323 (Target_arm::Relocate::relocate): Likewise.
3324 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
3326 (Target_arm::scan_reloc_for_stub): Likewise.
3327 (Target_arm::scan_reloc_section_for_stubs): Likewise.
3329 2010-01-19 Ian Lance Taylor <iant@google.com>
3331 * output.cc (Output_section_headers::do_sized_write): Write large
3332 segment count to sh_info field.
3333 (Output_file_header::do_sized_write): For large segment count,
3334 write PN_XNUM to e_phnum field.
3336 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3338 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
3339 (Arm_relocate_functions::thm_jump8): New function.
3340 (Arm_relocate_functions::thm_jump11): New function.
3341 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
3343 (Target_arm::Scan::global): Likewise.
3344 (Target_arm::Relocate::relocate): Likewise.
3345 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
3348 2010-01-14 Doug Kwan <dougkwan@google.com>
3350 * arm.cc (map, utility): Include headers.
3351 (Target_arm::apply_cortex_a8_workaround): New method.
3352 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
3353 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
3354 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
3355 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
3356 the --[no-]fix-cortex-a8 command line options.
3357 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
3358 (Target_arm::relocate_stub): Use addend in instruction template.
3359 * options.h (DEFINE_bool): Set the user-set flag.
3360 (General_options): Add --[no-]-fix-cortex options.
3361 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
3362 : Update fast look-up map after conversion.
3364 2010-01-14 Sriraman Tallam <tmsriram@google.com>
3366 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
3367 in the first pass of do_layout.
3369 2010-01-13 Doug Kwan <dougkwan@google.com>
3371 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
3372 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
3373 apparent compiler problem of not folding static constant integral
3374 data members of elfcpp::Elf_sizes<32>.
3376 2010-01-13 Doug Kwan <dougkwan@google.com>
3378 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
3379 Arm_relobj::section_needs_cortex_a8_stub_scanning,
3380 Arm_relobj::scan_section_for_cortex_a8_erratum,
3381 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
3382 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
3383 sections to scan for relocation stubs into a new method
3384 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
3385 relocation and Cortex-A8 stub scanning.
3386 (Target_arm::do_relax): Force stubs to be after stubbed sections
3387 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
3388 the beginning of a new relaxation pass. Update a comment.
3389 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
3391 2010-01-12 Ian Lance Taylor <iant@google.com>
3393 * target-reloc.h (visibility_error): New inline function.
3394 (relocate_section): Call visibility_error.
3395 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
3396 (MOSTLYCLEANFILES): Likewise.
3397 (protected_4_pic.o, protected_3.err): New targets.
3398 * testsuite/protected_4.cc: New file.
3400 2010-01-12 Doug Kwan <dougkwan@google.com>
3402 * arm.cc (Cortex_a8_reloc): New class.
3403 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
3404 and cortex_a8_relocs_info_.
3405 (Target_arm::fix_cortex_a8): New method definition.
3406 (Target_arm::Cortex_a8_relocs_info): New type.
3407 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
3408 New data member declarations.
3409 (Target_arm::scan_reloc_for_stub): Record information about
3410 relocations for THUMB branches that might be exempted from the
3411 Cortex-A8 workaround.
3412 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
3413 at the beginning of a relaxation pass.
3415 2010-01-12 Doug Kwan <dougkwan@google.com>
3417 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
3418 (Arm_relobj::Mapping_symbol_position,
3419 Arm_reloj::Mapping_symbol_position_less,
3420 Arm_relobj::Mapping_symbols_info): New types.
3421 (Target_arm::is_mapping_symbol_name): New method definition.
3422 (Arm_relobj::do_count_local_symbols): Save information about mapping
3425 2010-01-11 Doug Kwan <dougkwan@google.com>
3427 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
3428 Arm_relocate_functions::thumb32_branch_upper,
3429 Arm_relocate_functions::thumb32_branch_lower,
3430 Arm_relocate_functions::thumb32_cond_branch_offset,
3431 Arm_relocate_functions::thumb32_cond_branch_upper,
3432 Arm_relocate_functions::thumb32_cond_branch_lower,
3433 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
3434 branch offset encoding.
3435 (Arm_relocate_functions::thumb_branch_common): Use new branch
3436 offset encoding methods to avoid code duplication.
3437 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
3438 (Stub_addend_reader::operator()): Use new branch encoding method
3439 to avoid code duplication.
3441 2010-01-11 Doug Kwan <dougkwan@google.com>
3443 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
3444 (Target_arm::do_finalize_sections): Define special EXIDX section
3445 symbols only if referenced.
3446 * gc.h (Garbage_collection::add_reference): New method.
3447 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
3450 2010-01-11 Ian Lance Taylor <iant@google.com>
3452 * script.cc (Version_script_info::build_expression_list_lookup):
3453 Change complaing about duplicate wildcard match from error to
3456 * script.cc (class Lazy_demangler): Recreate--revert part of patch
3458 (Version_script_info::Version_script_info): Initialize globs_,
3459 default_version_, default_is_global_, and exact_. Don't
3460 initialize globals_ or locals_.
3461 (Version_script_info::build_lookup_tables): Build local symbols
3463 (Version_script_info::unquote): New function.
3464 (Version_script_info::add_exact_match): New function.
3465 (Version_script_info::build_expression_list_lookup): Remove lookup
3466 parameter. Add is_global parameter. Change all callers. Handle
3467 wildcard pattern specially. Unquote pattern. Call
3469 (Version_script_info::get_name_to_match): New function.
3470 (Version_script_info::get_symbol_version): New function.
3471 (Version_script_info::get_symbol_version_helper): Remove.
3472 (Version_script_info::check_unmatched_names): Call unquote.
3473 * script.h (class Version_script_info): Change get_symbol_version
3474 to be non-inline and add is_global parameter; change all callers.
3475 Rewrite symbol_is_local. Update declarations. Define struct
3476 Version_tree_match, Exact, Globs. Don't define struct Lookup.
3477 Remove globals_ and locals_ members. Add exact_, globs_,
3478 default_version_, is_global_.
3479 (Version_script_info::Glob): Remove pattern, add expression and
3480 is_global. Update constructor. Change all callers.
3481 * dynobj.cc (Versions::finalize): Mark the version symbol as the
3483 (Versions::symbol_section_contents): If a symbol is undefined, or
3484 defined in a dynamic object, set the version index to
3486 * symtab.cc (Symbol_table::add_from_relobj): Don't call
3488 (Symbol_table::add_from_pluginobj): Likewise.
3489 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
3491 2010-01-11 Doug Kwan <dougkwan@google.com>
3493 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
3494 (incremental_dump_LDADD): Add linking option for libintl.
3495 * Makefile.in: Regenerate.
3497 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
3500 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
3502 * testsuite/Makefile.in: Regenerated.
3504 2010-01-10 Doug Kwan <dougkwan@google.com>
3506 * options.h (DEFINE_var): Use parentheses around argument varname__
3507 in macro body to avoid any unintended subsequent substitutions.
3509 2010-01-10 Ian Lance Taylor <iant@google.com>
3511 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
3512 candidates before doing symbol resolution.
3514 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
3515 ODR candidates if only one is weak.
3517 2010-01-08 Ian Lance Taylor <iant@google.com>
3519 * script.cc (Version_script_info::build_expression_list_lookup):
3520 Don't warn about ambiguous version, just record the ambiguity.
3521 (Version_script_info::get_symbol_version_helper): Give error if
3522 version is ambiguous.
3524 2010-01-08 Doug Kwan <dougkwan@google.com>
3526 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
3527 prev_data_size_ and prev_addralign_. Remove initializer for
3528 deleted data member has_been_changed_.
3529 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
3530 to determine if the table is empty.
3531 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
3533 (Stub_table::add_reloc_stub): Define method in class definition
3534 instead of just declaring it there.
3535 (Stub_table::add_cortex_a8_stub): New method definition.
3536 (Stub_table::update_data_size_and_addralign): Ditto.
3537 (Stub_table::finalize_stubs): Ditto.
3538 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
3539 (Stub_table::do_addralign_): Return address alignment in the
3540 (Stub_table::do_reset_address_and_file_offset): Define method in
3541 class definition instead of declaring it there. Set current data
3542 size to be the data size of the previous pass.
3543 (Stub_table::set_final_data_size): Use current data size as the
3545 (Stub_table::relocate_stub): Change parameter type of stub from
3546 Reloc_stub pointer to Stub pointer.
3547 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
3548 (Stub_table::Cortex_a8_stub_list): New typedef.
3549 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
3550 Stub_table::prev_addralign_): New data member.
3551 (Arm_relobj::Arm_relobj): Initialize data member
3552 section_has_cortex_a8_workaround_.
3553 (Arm_relobj::section_has_cortex_a8_workaround,
3554 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
3556 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
3558 (Target_arm::relocate_stub): Change parameter type of stub from
3559 Reloc_stub pointer to Stub pointer.
3560 (Insn_template::size, Insn_template::alignment): Handle
3561 THUMB16_SPECIAL_TYPE.
3562 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
3563 Stub_table::update_data_size_and_addralign,
3564 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
3566 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
3567 (Stub_table::do_write): Ditto.
3568 (Target_arm::do_relax): Adjust code for changes in Stub_table.
3570 2010-01-08 Ian Lance Taylor <iant@google.com>
3573 * symtab.h (class Symbol): Remove fields is_target_special_ and
3574 has_plt_offset_. Add field is_defined_in_discarded_section_.
3575 (Symbol::is_defined_in_discarded_section): New function.
3576 (Symbol::set_is_defined_in_discarded_section): New function.
3577 (Symbol::has_plt_offset): Rewrite.
3578 (Symbol::set_plt_offset): Verify that new offset is not -1U.
3579 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
3580 Don't initialize is_target_special_ or has_plt_offset_.
3581 Initialize is_defined_in_discarded_section_.
3582 (Symbol_table::add_from_relobj): If appropriate, set
3583 is_defined_in_discarded_section.
3584 * resolve.cc (Symbol::override_base_with_special): Don't test
3585 is_target_special_. Change has_plt_offset_ to has_plt_offset().
3586 * target-reloc.h (relocate_section): Do special handling for
3587 symbols defined in discarded sections for global symbols as well
3590 2010-01-08 Ian Lance Taylor <iant@google.com>
3592 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
3593 the SHT_SYMTAB case.
3595 2010-01-08 Ian Lance Taylor <iant@google.com>
3597 * object.cc (Sized_relobj::do_layout): Don't get confused if
3598 layout_eh_frame returns NULL.
3600 2010-01-08 Ian Lance Taylor <iant@google.com>
3603 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
3604 dynamic symbol table, use the normal symbol table.
3605 (Sized_dynobj::do_read_symbols): Remove assertion about type of
3608 2010-01-08 Ian Lance Taylor <iant@google.com>
3611 * layout.cc (Layout::include_section): Remove .gnu_debuglink
3614 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
3616 * version.cc (print_version): Change to "Copyright 2010".
3618 2010-01-08 Ian Lance Taylor <iant@google.com>
3622 * i386.cc (class Target_i386): Change return type of plt_section
3624 (class Output_data_plt_i386): Add tls_desc_rel_ field.
3625 (Output_data_plt_i386::Output_data_plt_i386): Initialize
3626 tls_desc_rel_ field.
3627 (Output_data_plt_i386::rel_tls_desc): New function.
3628 (Target_i386::rel_tls_desc_section): New function.
3629 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
3630 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
3631 R_386_TLS_DESC reloc in rel_tls_desc_section.
3632 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
3633 Define struct Tlsdesc_info.
3634 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
3635 (Target_x86_64::do_reloc_symbol_index): New function.
3636 (Target_x86_64::add_tlsdesc_info): New function.
3637 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
3638 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
3640 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
3642 (Output_data_plt_x86_64::rela_tlsdesc): New function.
3643 (Target_x86_64::rela_tlsdesc_section): New function.
3644 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
3646 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
3647 (Target_x86_64::do_reloc_addend): New function.
3648 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
3649 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
3650 declarations. Define TARGET_CODE. Add arg field to u1_ union.
3651 (Output_reloc::type): New function.
3652 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
3653 (Output_reloc::is_target_specific): New function.
3654 (Output_reloc::target_arg): New function.
3655 (class Output_reloc) [SHT_RELA]: Add four new constructors for
3656 absolute relocs and target specific relocs.
3657 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
3658 add_target_specific.
3659 (class Output_data_reloc) [SHT_RELA]: Likewise.
3660 * output.cc (Output_reloc::Output_reloc): Add four new versions
3661 for absolute relocs and target specific relocs.
3662 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
3663 (Output_reloc::get_symbol_index): Likewise.
3664 (Output_reloc::local_section_offset): Check that local_sym_index_
3665 is not TARGET_CODE or 0.
3666 (Output_reloc::symbol_value): Likewise.
3667 (Output_reloc::write) [SHT_RELA]: Call target for target specific
3669 * target.h (class Target): Add reloc_symbol_index and reloc_addend
3670 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
3672 * layout.cc (add_target_dynamic_tags): Use output section for
3673 DT_PLTRELSZ and DT_JMPREL.
3675 2010-01-07 Ian Lance Taylor <iant@google.com>
3678 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
3680 (class Output_data_reloc_generic): Define.
3681 (class Output_data_reloc_base): Change base class to
3682 Output_data_reloc_generic. Change add() method to call
3683 bump_relative_reloc_count for a relative reloc. Remove
3685 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
3687 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
3688 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
3690 * layout.h (class Layout): Update declaration.
3692 2010-01-07 Ian Lance Taylor <iant@google.com>
3694 * output.h (class Output_data): Add const version of
3695 output_section and do_output_section.
3696 (class Output_section_data): Add const version of
3698 (class Output_section): Likewise.
3699 * layout.cc (Layout::add_target_dynamic_tags): New function.
3700 * layout.h (class Layout): Update declarations.
3701 * arm.cc (Target_arm::do_finalize_sections): Use
3702 add_target_dynamic_tags.
3703 * i386.cc (Target_i386::do_finalize_sections): Likewise.
3704 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
3705 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
3706 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3708 2010-01-07 Ian Lance Taylor <iant@google.com>
3711 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
3714 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
3715 Ian Lance Taylor <iant@google.com>
3718 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
3719 Xindex::read_symtab_xindex.
3721 2010-01-07 Doug Kwan <dougkwan@google.com>
3723 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
3724 (Insn_template::thumb16_bcond_insn): New method declaration.
3725 (Insn_template): Fix spelling.
3726 (Stub::thumb16_special): New method declaration.
3727 (Stub::do_write): Define virtual method which was previously pure
3729 (Stub::do_thumb16_special): New method declaration.
3730 (Stub::do_fixed_endian_write): New template member.
3731 (Reloc_stub::do_write): Remove.
3732 (Reloc_stub::do_fixed_endian_write): Remove.
3733 (Cortex_a8_stub): New class definition.
3734 (Stub_factory::make_cortex_a8_stub): New method definition.
3735 (Stub_factory::Stub_factory): Add missing static storage class
3736 qualifier for elf32_arm_stub_a8_veneer_blx.
3738 2010-01-07 Ian Lance Taylor <iant@google.com>
3741 * options.h (class General_options): Add --warn-unresolved-symbols
3742 and --error-unresolved-symbols.
3743 * errors.cc (Errors::undefined_symbol): Implement
3744 --warn-unresolved-symbols.
3746 * options.h (class General_options): Add -z text and -z textoff.
3747 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
3749 2010-01-06 Sriraman Tallam <tmsriram@google.com>
3751 * gc.h (Garbage_collection::Cident_section_map): New typedef.
3752 (Garbage_collection::cident_sections): New function.
3753 (Garbage_collection::add_cident_section): New function.
3754 (Garbage_collection::cident_sections_): New member.
3755 (gc_process_relocs): Add references to sections whose names are C
3757 * gold.h (cident_section_start_prefix): New constant.
3758 (cident_section_stop_prefix): New constant.
3759 (is_cident): New function.
3760 * layout.cc (Layout::define_section_symbols): Replace string constants
3761 with the newly defined constants.
3762 * object.cc (Sized_relobj::do_layout): Track sections whose names are
3764 * testsuite/Makefile.am: Add gc_orphan_section_test.
3765 * testsuite/Makefile.in: Regenerate.
3766 * testsuite/gc_orphan_section_test.cc: New file.
3767 * testsuite/gc_orphan_section_test.sh: New file.
3769 2010-01-06 Ian Lance Taylor <iant@google.com>
3772 * options.h (class General_options): Add --warn-shared-textrel.
3773 * layout.cc (Layout::finish_dynamic_section): Implement
3774 --warn-shared-textrel.
3777 * options.h (class General_options): Add --warn-multiple-gp.
3779 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3781 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
3782 $(THREADSLIB) and $(LIBDL).
3783 * Makefile.in: Rebuild.
3785 2010-01-06 Ian Lance Taylor <iant@google.com>
3788 * options.cc (General_options::parse_section_start): New function.
3789 (General_options::section_start): New function.
3790 (General_options::General_options): Initialize all members.
3791 * options.h: Include <map>
3792 (class General_options): Add --section-start. Add section_starts_
3794 * layout.cc (Layout::attach_allocated_section_to_segment): If
3795 --section-start was used, set the address of the segment. Remove
3796 local sort_sections.
3797 (Layout::relaxation_loop_body): If the address of the load segment
3798 has been set by --section-start, don't use it.
3799 * output.h (Output_segment::update_flags_for_output_section): New
3801 * output.cc (Output_segment::add_output_section): Call
3802 update_flags_for_output_section.
3804 2010-01-05 Ian Lance Taylor <iant@google.com>
3807 * options.h (class General_options): Add --undefined-version.
3808 * script.cc (struct Version_expression): Add was_matched_by_symbol
3810 (Version_script_info::matched_symbol): New function.
3811 (Version_script_info::get_symbol_version_helper): Call
3813 (Version_script_info::check_unmatched_names): New function.
3814 * script.h (class Version_script_info): Update declarations.
3815 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
3817 * options.h (class General_options): Use DEFINE_bool_alias for
3818 allow_multiple_definition.
3819 * resolve.cc (Symbol_table::should_override): Don't test
3820 allow_multiple_definition.
3823 * options.h (class General_options): Add --cref.
3824 * main.cc (main): Print cref table if --cref. Don't close mapfile
3825 until after printing cref table.
3826 * cref.cc: Include "symtab.h".
3827 (class Cref_inputs): Define Cref_table_compare and Cref_table.
3828 (Cref_table_compare::operator()): New function.
3829 (Cref_inputs::gather_cref): New function.
3830 (filecol): New static const.
3831 (Cref_inputs::print_cref): New function.
3832 (Cref::print_cref): New function.
3833 * cref.h: Include <cstdio>.
3834 (class Cref): Update declarations.
3835 * mapfile.h (Mapfile::file): New function.
3836 * object.h (class Object): Define Symbols. Declare virtual
3837 do_get_global_symbols.
3838 (Object::get_global_symbols): New function.
3839 * object.cc (Input_objects::add_object): Pass object to cref_ if
3841 (Input_objects::archive_start): Likewise.
3842 (Input_objects::archive_stop): Likewise.
3843 (Input_objects::print_cref): New function.
3844 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
3845 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
3847 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
3849 * plugin.h (class Sized_pluginobj): Update declarations.
3851 2010-01-05 Ian Lance Taylor <iant@google.com>
3853 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
3854 to is_default_version. Rename insdef to insdefault.
3855 (Symbol_table::add_from_relobj): Rename def to is_default_version
3856 and local to is_forced_local.
3857 (Symbol_table::add_from_pluginobj): Likewise.
3858 (Symbol_table::add_from_dynobj): Likewise.
3859 (Symbol_table::define_special_symbol): Rename insdef to
3862 2010-01-04 Ian Lance Taylor <iant@google.com>
3865 * options.h (class General_options): Add
3866 --allow-multiple-definition and -z muldefs.
3867 * resolve.cc (Symbol_table::should_override): Don't warn about a
3868 multiple symbol definition if --allow-multiple-definition or -z
3872 * options.h (class General_options): Add --add-needed and
3873 --copy-dt-needed-entries. Tweak --as-needed help entry.
3874 * object.cc (Input_objects::check_dynamic_dependencies): Give an
3875 error if --copy-dt-needed-entries aka --add-needed is used and
3876 would cause a change in behaviour.
3879 * options.h (class General_options): Add -G as a short version of
3880 --shared. Add no-op options -assert, -g, and -i.
3882 2010-01-04 Sriraman Tallam <tmsriram@google.com>
3884 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
3885 check for .text or .gnu.linkonce.t sections.
3886 * icf.cc (Icf::find_identical_sections): Ditto.
3887 Change the detection for mangled function name within the section
3889 * icf.h (is_section_foldable_candidate): New function.
3891 2009-12-30 Ian Lance Taylor <iant@google.com>
3894 * options.h (class General_options): Permit two dashes with
3895 --retain-symbols-file.
3897 2009-12-30 Ian Lance Taylor <iant@google.com>
3900 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
3901 don't put the file header and segment headers in the text
3905 * common.cc (Sort_commons::operator()): Stabilize sort when both
3907 (Symbol_table::do_allocate_commons_list): When allocating common
3908 symbols, skip a symbol which is no longer common.
3909 * symtab.h (Symbol::is_common): Test whether the symbol comes from
3910 an object before checking its type.
3911 * testsuite/common_test_2.c: New file.
3912 * testsuite/common_test_3.c: New file.
3913 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
3914 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
3915 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
3916 (common_test_2_pic.o, common_test_2.so): New targets.
3917 (common_test_3_pic.o, common_test_3.so): New targets.
3918 * testsuite/Makefile.in: Rebuild.
3921 * script.cc (read_input_script): If we see a new SECTIONS clause,
3922 and we have added an input section, give an error.
3923 * layout.h (class Layout): Add have_added_input_section function.
3924 Add have_added_input_section_ field.
3925 * layout.cc (Layout::Layout): Initialize
3926 have_added_input_section_.
3927 (Layout::layout): Set have_added_input_section_.
3928 (Layout::layout_eh_frame): Likewise.
3930 2009-12-30 Ian Lance Taylor <iant@google.com>
3933 * options.h (class General_options): Add --sort-common option.
3934 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
3935 * common.cc (Sort_common): Add sort_order parameter to
3936 constructor. Add sort_order_ field.
3937 (Sort_commons::operator): Check sort_order_.
3938 (Symbol_table::allocate_commons): Determine the sort order.
3939 (Symbol_table::do_allocate_commons): Add sort_order parameter.
3941 (Symbol_table::do_allocate_commons_list): Likewise.
3943 2009-12-30 Ian Lance Taylor <iant@google.com>
3946 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
3947 symbols from this object, don't change the visibility of an
3949 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
3951 2009-12-30 Ian Lance Taylor <iant@google.com>
3954 * script.h (class Version_script_info): Define Language enum.
3955 Update declarations. Define Glob, Exact, and Lookup types. Add
3956 new fields globals_, locals_, and is_finalized_.
3957 * script.cc: Various formatting fixes.
3958 (class Parser_closure): Change language_stack_ from a vector of
3959 std::string to one of Version_script_info::Language. Adjust all
3961 (class Lazy_demangler): Remove.
3962 (struct Version_expression): Change language from std::string to
3963 Version_script_info::Language.
3964 (Version_script_info::Version_script_info): New function.
3965 (Version_script_info::~Version_script_info): Don't call clear.
3966 (Version_script_info::finalize): New function.
3967 (Version_script_info::build_lookup_tables): New function.
3968 (Version_script_info::build_expression_list_lookup): New
3970 (Version_script_info::get_symbol_version_helper): Rewrite to use
3972 (Version_script_info::print_expression_list): Adjust to use
3973 Version_script_info::Language.
3974 (script_push_lex_into_version_mode): Check that the version script
3975 has not been finalized.
3976 (version_script_push_lang): Change language string to
3977 Version_script_info::Language.
3978 * options.cc (Command_line::version_script): New function.
3979 * options.h (class General_options): Add finalize_dynamic_list
3980 function. Change version_script from declaration to definition.
3981 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
3982 * testsuite/version_script.map: Remove duplicate def of foo.
3983 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
3985 * testsuite/Makefile.in: Rebuild.
3987 2009-12-30 Ian Lance Taylor <iant@google.com>
3990 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
3991 if the input symbol index is 0, make the output symbol index 0.
3993 2009-12-30 Ian Lance Taylor <iant@google.com>
3996 * options.h (class General_options): Add -x/--discard-all.
3997 * object.cc (Sized_relobj::do_count_local_symbols): Handle
3998 --discard-all. If the local symbol needs a dynamic entry, check
3999 that before handling --discard-locals.
4001 2009-12-30 Ian Lance Taylor <iant@google.com>
4004 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
4006 (Output_segment::add_output_section): Don't change the flags if
4010 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
4011 GNU hash table if they need a dynamic value. Otherwise, don't add
4012 them if they are defined in a dynamic object or are forced local.
4014 2009-12-29 Ian Lance Taylor <iant@google.com>
4017 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
4018 .gnu.hash table for a 32-bit target.
4021 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
4022 regular and a dynamic object only needs a dynamic symbol table
4023 entry if it is externally visible.
4026 * i386.cc (class Target_i386): Initialize global_offset_table_ in
4027 constructor. Add global_offset_table_ field.
4028 (Target_i386::got_section): Set global_offset_table_.
4029 (Target_i386::do_finalize_sections): Set global_offset_table_
4031 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
4032 in constructor. Add global_offset_table_ field.
4033 (Target_x86_64::got_section): Set global_offset_table_.
4034 (Target_x86_64::do_finalize_sections): Set global_offset_table_
4037 * layout.cc (Layout::Layout): Initialize increase_relro_.
4038 (Layout::get_output_section): Add is_relro, is_last_relro, and
4039 is_first_non_relro parameters. Change all callers.
4040 (Layout::choose_output_section): Likewise.
4041 (Layout::add_output_section_data): Likewise.
4042 (Layout::make_output_section): Likewise.
4043 (Layout::set_segment_offsets): Clear increase_relro when using a
4045 * layout.h (class Layout): Add increase_relro method. Add
4046 increase_relro_ field. Update declarations.
4047 * output.cc (Output_section::Output_section): Initialize
4048 is_last_relro_ and is_first_non_relro_.
4049 (Output_segment::add_output_section): Group relro sections is
4050 do_sort is true. Handle is_last_relro and is_first_non_relro.
4051 (Output_segment::maximum_alignment): Remove relro handling.
4052 (Output_segment::set_section_addresses): Add increase_relro
4053 parameter. Change all callers. Add initial alignment to align
4054 relro sections on separate page. Remove old relro handling.
4055 (Output_segment::set_section_list_addresses): Remove in_relro
4056 parameter. Change all callers.
4057 (Output_segment::set_offset): Add increase parameter. Change all
4058 callers. Remove old relro handling.
4059 * output.h (class Output_section): Add new methods: is_last_relro,
4060 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
4061 Add is_last_relro_ and is_first_non_relro_ fields.
4062 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
4063 Create separate .got.plt section. Call increase_relro.
4064 * x86_64.cc (Target_x86_64::got_section): Likewise.
4065 * testsuite/relro_script_test.t: Add .got.plt.
4068 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
4069 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
4070 (Layout::finalize): Call set_dynamic_symbol_size.
4071 (Layout::set_dynamic_symbol_size): New function.
4072 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
4073 set_dynamic_symbol_size.
4076 * output.h (class Output_section): Add is_entsize_zero_ field.
4077 * output.cc (Output_section::Output_section): Initialize
4079 (Output_section::set_entsize): If two different entsizes are
4080 requested, force it to zero.
4081 (Output_section::add_input_section): Set flags for .debug_str
4082 before updating section flags. Set entsize.
4083 (Output_section::update_flags_for_input_section): Set SHF_MERGE
4084 and SHF_STRING if all input sections have those flags.
4086 2009-12-29 Rafael Espindola <espindola@google.com>
4088 * main.cc (main): Fix the sys time reporting.
4089 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
4092 2009-12-29 Sriraman Tallam <tmsriram@google.com>
4094 * options.cc (General_options::parse_version): Allow -v to exit
4095 without an error if there is nothing to link.
4097 2009-12-29 Ian Lance Taylor <iant@google.com>
4099 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
4100 using a version of gcc before 4.1.
4101 * configure: Rebuild.
4103 2009-12-28 Chris Demetriou <cgd@google.com>
4105 * attributes.cc (Output_attributes_section_data::do_write): Use
4106 std::vector::front rather than std::vector::data.
4108 2009-12-28 Ian Lance Taylor <iant@google.com>
4110 * symtab.h (class Symbol_table): Add enum Defined.
4111 * resolve.cc (Symbol_table::should_override): Add defined
4112 parameter. Change all callers. Test whether object is NULL
4113 before calling a method on it.
4114 (Symbol_table::report_resolve_problem): Add defined parameter.
4116 (Symbol_table::should_override_with_special): Likewise.
4117 * symtab.cc (Symbol_table::define_in_output_data): Add defined
4118 parameter. Change all callers.
4119 (Symbol_table::do_define_in_output_data): Likewise.
4120 (Symbol_table::define_in_output_segment): Likewise.
4121 (Symbol_table::do_define_in_output_segment): Likewise.
4122 (Symbol_table::define_as_constant): Likewise.
4123 (Symbol_table::do_define_as_constant): Likewise.
4124 * script.h (class Symbol_assignment): Add is_defsym parameter to
4125 constructor; change all callers.
4126 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
4127 parameter. Change all callers. Add is_defsym_ field.
4128 (class Parser_closure): Add parsing_defsym parameter to
4129 constructor; change all callers. Add parsing_defsym accessor
4130 function. Add parsing_defsym_ field.
4132 2009-12-28 Ian Lance Taylor <iant@google.com>
4134 * gold.cc (queue_middle_tasks): Fix formatting.
4135 * object.cc (Relobj::is_section_name_included): Likewise.
4137 2009-12-23 Ian Lance Taylor <iant@google.com>
4139 * i386.cc (Target_i386::do_calls_non_split): Recognize
4140 -fsplit-stack prologue for a function with a static chain.
4141 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
4142 -fsplit-stack prologue when using %r11.
4144 2009-12-21 Sriraman Tallam <tmsriram@google.com>
4146 * options.cc (General_options::parse_version): Make -v continue and do
4147 the link like GNU ld does.
4149 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
4151 * Makefile.am (CCFILES): Add timer.cc.
4152 (HFILES): Add timer.h.
4153 * configure.ac: Check for sysconf and times.
4154 * main.cc: include timer.h.
4155 (main): Use Timer instead of get_run_time.
4158 * workqueue.cc: include timer.h.
4159 (Workqueue::find_and_run_task):
4160 Report user, sys and wall time.
4161 * Makefile.in: Regenerate.
4162 * config.in: Regenerate.
4163 * configure: Regenerate.
4165 2009-12-16 Doug Kwan <dougkwan@google.com>
4167 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
4169 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
4170 relaxed input sections.
4171 * output.cc (Output_section::find_relaxed_input_section): Change
4172 return type to Output_relaxed_input_section pointer. Adjust code
4173 for new type of relaxed_input_section_map_.
4174 * output.h (Output_section::find_relaxed_input_section): Change
4175 return type to Output_relaxed_input_section pointer.
4176 (Output_section::Output_relaxed_input_section_by_input_section_map):
4178 (Output_section::relaxed_input_section_map_): Change type to
4179 Output_section::Output_relaxed_input_section_by_input_section_map.
4180 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
4183 2009-12-15 Ian Lance Taylor <iant@google.com>
4185 * layout.cc (Layout::create_shstrtab): Only write out after input
4186 sections if we are compressing debug sections.
4188 2009-12-15 Ian Lance Taylor <iant@google.com>
4190 * archive.cc (Archive::add_symbols): Only look up a symbol without
4191 a version if there is, in fact, a version.
4193 2009-12-14 Ian Lance Taylor <iant@google.com>
4195 Revert -Wshadow changes, all changes from:
4196 2009-12-11 Doug Kwan <dougkwan@google.com>
4197 2009-12-11 Nick Clifton <nickc@redhat.com>
4198 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
4200 2009-12-11 Doug Kwan <dougkwan@google.com>
4202 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
4204 * attributes.cc (Object_attribute::size): Ditto.
4205 (Attributes_section_data::size): Ditto.
4206 (Attributes_section_data::Attributes_section_data): Ditto.
4207 (Output_attributes_section_data::do_write): Ditto.
4208 * attributes.h (Object_attribute::set_type): Ditto.
4209 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
4211 2009-12-11 Nick Clifton <nickc@redhat.com>
4213 * archive.cc: Fix shadowed variable warnings.
4215 * compressed_output.cc: Likewise.
4216 * compressed_output.h: Likewise.
4217 * configure: Likewise.
4218 * dwarf_reader.cc: Likewise.
4219 * dynobj.cc: Likewise.
4220 * dynobj.h: Likewise.
4221 * ehframe.cc: Likewise.
4222 * ehframe.h: Likewise.
4223 * errors.cc: Likewise.
4224 * expression.cc: Likewise.
4225 * fileread.cc: Likewise.
4226 * fileread.h: Likewise.
4227 * freebsd.h: Likewise.
4228 * i386.cc: Likewise.
4230 * incremental.h: Likewise.
4231 * layout.cc: Likewise.
4232 * layout.h: Likewise.
4233 * mapfile.cc: Likewise.
4234 * merge.cc: Likewise.
4235 * merge.h: Likewise.
4236 * object.cc: Likewise.
4237 * object.h: Likewise.
4238 * options.h: Likewise.
4239 * output.cc: Likewise.
4240 * output.h: Likewise.
4241 * parameters.cc: Likewise.
4242 * plugin.cc: Likewise.
4243 * powerpc.cc: Likewise.
4244 * reduced_debug_output.cc: Likewise.
4245 * reduced_debug_output.h: Likewise.
4246 * reloc.cc: Likewise.
4247 * reloc.h: Likewise.
4248 * resolve.cc: Likewise.
4249 * script-sections.cc: Likewise.
4250 * script.cc: Likewise.
4251 * script.h: Likewise.
4252 * sparc.cc: Likewise.
4253 * symtab.cc: Likewise.
4254 * symtab.h: Likewise.
4255 * target-select.cc: Likewise.
4256 * target-select.h: Likewise.
4257 * token.h: Likewise.
4258 * workqueue.cc: Likewise.
4259 * workqueue.h: Likewise.
4260 * x86_64.cc: Likewise.
4262 2009-12-10 Doug Kwan <dougkwan@google.com>
4264 * arm.cc (attributes.h): New include.
4265 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
4266 (Arm_relobj::~Arm_relobj): Delete object pointed by
4267 attributes_section_data_.
4268 (Arm_relobj::attributes_section_data): New method definition.
4269 (Arm_relobj::attributes_section_data_): New data member declaration.
4270 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
4271 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
4272 attributes_section_data_.
4273 (Arm_dynobj::attributes_section_data): New method definition.
4274 (Arm_dynobj::attributes_section_data_): New data member declaration.
4275 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
4276 initialization value of may_use_blx_ to false.
4277 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
4278 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
4279 object attributes to compute results instead of hard-coding.
4280 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
4281 Target_arm::get_secondary_compatible_arch,
4282 Target_arm::set_secondary_compatible_arch
4283 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
4284 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
4285 New method declarations.
4286 (Target_arm::get_aeabi_object_attribute): New method definition.
4287 (Target_arm::attributes_section_data_): New data member declaration.
4288 (read_arm_attributes_section): New template definition.
4289 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
4290 (Arm_dynobj::do_read_symbols): Ditto.
4291 (Target_arm::do_finalize_sections): Merge attributes sections from
4292 input. Check for BLX use after attributes section merging.
4293 Fix __exidx_start and __exidx_end visibility. Create an
4294 .ARM.attributes section if necessary.
4295 (Target_arm::get_secondary_compatible_arch,
4296 Target_arm::set_secondary_compatible_arch,
4297 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
4298 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
4299 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
4300 New method definitions.
4302 2009-12-09 Ian Lance Taylor <iant@google.com>
4304 * plugin.cc (Plugin::load): Don't cast from void* to a function
4307 2009-12-09 Ian Lance Taylor <iant@google.com>
4309 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
4312 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
4314 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
4315 Replace two_file_shared_1.so with two_file_shared_2.so.
4316 * testsuite/Makefile.in: Regenerated.
4318 2009-12-08 Doug Kwan <dougkwan@google.com>
4320 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
4321 (HFILES): Add attributes.h and int_encoding.h.
4322 * Makefile.in: Regenerate.
4323 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
4324 function definitions to int_encoding.cc
4325 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
4326 prototypes to int_encoding.h
4327 * reduced_debug_output.cc (int_encoding.h): New include.
4328 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
4329 function definitions to int_encoding.cc
4330 (insert_into_vector, read_from_pointer): Move template definitions to
4332 * attributes.cc: New file.
4333 * attributes.h: New file.
4334 * int_encoding.cc: New file.
4335 * int_encoding.h: New file.
4337 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
4340 * incremental-dump.cc (dump_incremental_inputs): New.
4341 (main): Use dump_incremental_inputs.
4343 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
4346 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
4347 checking elfcpp::STT_FUNC.
4348 (Target_i386::Relocate::relocate): Likewise.
4349 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4351 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
4352 symbols from shared libraries into normal FUNC symbols.
4354 * symtab.h (Symbol): Add is_func and use it.
4356 2009-12-05 Doug Kwan <dougkwan@google.com>
4358 * arm.cc (Target_arm::arm_info): Initialize new fields
4359 attributes_section and attributes_vendor.
4360 * i386.cc (Target_i386::i386_info): Same.
4361 * object.cc (Sized_relobj::do_layout): Skip attribute section.
4362 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
4363 fields attributes_section and attributes_vendor.
4364 * sparc.cc (Target_sparc::sparc_info): Same.
4365 * target.h (Target::attributes_section, Target::attributes_vendor,
4366 Target::is_attributes_section, Target::attribute_arg_type,
4367 Target::attributes_order): New method definitions.
4368 (Target::Target_info::attributes_section,
4369 Target::Target_info::attributes_vendor): New fields.
4370 (Target::do_attribute_arg_type, Target::do_attributes_order): New
4371 virtual method definitions.
4372 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
4373 attributes_section and attributes_vendor.
4374 * testsuite/testfile.cc (Target_test::test_target_info): Same.
4376 2009-12-05 Doug Kwan <dougkwan@google.com>
4378 * arm.cc: Update comments about interworking and stub generation.
4379 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
4380 considered as non-PIC.
4381 (Arm_relocate_functions::base_abs): Fix formatting.
4382 (Arm_relocate_functions::got_prel): Fix comment. Change interface
4383 of function to use GOT entry address instead of offset.
4384 (Target_arm::Scan::global): Issue an error if a symbol would need a
4385 PLT does not get one because it is untyped. Remove code to create
4386 dynamic symbols for relative branches.
4387 (Target_arm::Relocate::relocate: Use 0 instead of false since function
4388 takes unsigned integer instead of boolean.
4390 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
4392 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
4393 (two_file_test_LDADD): Likewise.
4394 (common_test_1_LDADD): Likewise.
4395 (exception_test_LDADD) Likewise.
4396 (weak_test_LDADD): Likewise.
4397 (many_sections_test_LDADD): Likewise.
4398 (initpri1_LDADD): Likewise.
4399 (script_test_1_LDADD): Likewise.
4400 (script_test_2_LDADD): Likewise.
4401 (justsyms_LDADD): Likewise.
4402 (binary_test_LDADD): Likewise.
4403 (large_LDADD): Likewise.
4404 * testsuite/Makefile.in: Regenerated.
4406 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
4408 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
4409 (Symbol_table::override_with_special): Likewise.
4410 (Symbol_table::add_from_object): Likewise.
4412 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
4414 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
4415 Don't set the data_offset twice.
4417 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
4419 * testsuite/Makefile.in: Regenerate.
4421 2009-12-03 Doug Kwan <dougkwan@google.com>
4423 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
4424 (Target_arm::do_finalize_sections): Add parameter for symbol table
4425 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
4426 * i386.cc (Target_i386::do_finalize_sections): Add an additional
4427 parameter for symbol table pointer.
4428 * layout.cc (Layout::finalize): Call Target::finalize_sections with
4429 an additional parameter for a pointer to symbol table.
4430 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
4431 parameter for a symbol table pointer.
4432 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
4433 * target.h (Target::finalize_sections, Target::do_finalize_sections):
4435 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
4436 parameter for a symbol table pointer.
4438 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
4440 * incremental.cc (Incremental_inputs_header)
4441 (Incremental_inputs_header_write, Incremental_inputs_entry)
4442 (Incremental_inputs_entry_write): Move ...
4443 * incremental.h (Incremental_inputs_header)
4444 (Incremental_inputs_header_write, Incremental_inputs_entry)
4445 (Incremental_inputs_entry_write): here.
4447 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
4449 * incremental.cc (make_sized_incremental_binary): Set the target.
4450 Error if it is incompatible.
4451 * output.h (Output_file): Add filename method.
4453 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
4455 * incremental.cc (Incremental_inputs_entry): Remove unused argument
4456 from the get_* methods.
4458 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
4460 * incremental-dump.cc (main): Check that the offeset of a script is 0.
4461 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
4462 Write 0 for the data_offset of scripts.
4464 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
4466 * testsuite/Makefile.am: Add the incremental_test.sh test.
4467 * testsuite/incremental_test.sh: New.
4468 * testsuite/incremental_test_1.c: New.
4469 * testsuite/incremental_test_2.c: New.
4471 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
4473 * incremental-dump.cc (main): Fix typos.
4475 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
4478 * incremental-dump.cc (main): Use llu to print 64 bit values.
4480 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
4481 H.J. Lu <hongjiu.lu@intel.com>
4483 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
4485 (incremental_dump_LDADD): Likewise.
4486 * Makefile.in: Regenerated.
4488 2009-11-25 Doug Kwan <dougkwan@google.com>
4492 2009-11-25 Doug Kwan <dougkwan@google.com>
4494 * arm.cc (Target_arm::Target_arm): Move method definition
4495 outside of class definition. Add code to handle
4496 --target1-rel, --target1-abs and --target2= options.
4497 (Target_arm::get_reloc_reloc_type): Change method to be
4498 non-static and const.
4499 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
4500 New data member declaration.
4501 (Target_arm::Scan::local, Target_arm::Scan::global,
4502 Target_arm::Relocate::relocate,
4503 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4504 Adjust call to Target_arm::get_real_reloc_type.
4505 (Target_arm::get_real_reloc_type): Use command line options
4506 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
4507 * options.h (--target1-rel, --target1-abs, --target2): New
4510 2009-11-25 Doug Kwan <dougkwan@google.com>
4512 * arm.cc (Target_arm::Target_arm): Move method definition outside of
4513 class definition. Add code to handle --target1-rel, --target1-abs
4514 and --target2= options.
4515 (Target_arm::get_reloc_reloc_type): Change method to be non-static
4517 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
4519 (Target_arm::Scan::local, Target_arm::Scan::global,
4520 Target_arm::Relocate::relocate,
4521 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
4522 call to Target_arm::get_real_reloc_type.
4523 (Target_arm::get_real_reloc_type): Use command line options to
4524 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
4525 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
4528 2009-11-25 Doug Kwan <dougkwan@google.com>
4530 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
4531 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
4532 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
4534 (Arm_relocate_functions::thm_call): Replace body with a call to
4535 Arm_relocate_functions::thumb_branch_common.
4536 (Arm_relocate_functions::thm_jump24,
4537 Arm_relocate_functions::thm_xpc22): New method definitions.
4538 (Arm_relocate_functions::thumb_branch_common): New method definition.
4539 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
4541 (Target_arm::Relocate::relocate): Adjust call to thm_call.
4542 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
4544 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
4546 * Makefile.am: Build incremental-dump
4547 * Makefile.in: Regenerate.
4548 * incremental-dump.cc: New.
4549 * incremental.cc (Incremental_inputs_header_data,
4550 Incremental_inputs_entry_data): Move to incremental.h
4551 * incremental.h: (Incremental_inputs_header_data,
4552 Incremental_inputs_entry_data): Move from incremental.cc
4554 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
4556 * incremental.cc (Incremental_inputs_header,
4557 Incremental_inputs_header_write, Incremental_inputs_entry,
4558 Incremental_inputs_entry_write): Add a typedef with the data type.
4560 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
4562 * incremental.cc (Incremental_inputs_header,
4563 Incremental_inputs_header_write, Incremental_inputs_entry,
4564 Incremental_inputs_entry_write): Update comment about which
4565 type has the filed descriptions.
4567 2009-11-15 Doug Kwan <dougkwan@google.com>
4569 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
4570 (Arm_relocate_functions::arm_branch_common): Change method defintion
4571 in class definition to a method declaration and update list of formal
4573 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
4574 Arm_relocation_functions::jump24): Adjust call to
4575 Arm_relocate_functions::arm_branch_common. Update list of formal
4577 (Arm_relocate_functions::xpc25): New method definition.
4578 (Arm_relocate_functions::arm_branch_common): Move method defintion
4579 out from class definition. Use stubs for mode-switching and extending
4581 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
4582 specially. Change code to enable use of stubs in ARM branches.
4584 2009-11-10 Doug Kwan <dougkwan@google.com>
4586 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
4587 in method declaration.
4588 (Target_arm::relocate_stub): New method declaration.
4589 (Target_arm::default_target): Change to return a pointer instead of
4591 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
4592 Target_arm::default_target.
4593 (Arm_Relobj::do_relocate_sections): Remove options paramater in
4595 (Target_arm::relocate_section): Adjust view.
4596 (Target_arm::relocate_stub): New method definition.
4598 2009-11-10 Doug Kwan <dougkwan@google.com>
4600 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
4602 * incremental.cc (open_incremental_binary): Initialized local
4603 variables to avoid warnings.
4604 * object.cc (make_elf_object): Ditto.
4605 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
4608 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
4611 * testsuite/plugin_test.c: Include "config.h".
4613 2009-11-09 Doug Kwan <dougkwan@google.com>
4615 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
4616 (arm_symbol_value): Remove.
4617 (Arm_relocate_functions::arm_branch_common,
4618 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
4619 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
4620 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
4621 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
4622 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
4623 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
4624 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
4625 Arm_relocate_functions::thm_mobw_abs_nc,
4626 Arm_relocate_functions::thm_mov_abs,
4627 Arm_relocate_functions::movw_prel_nc,
4628 Arm_relocate_functions::thm_movt_abs,
4629 Arm_relocate_functions::movt_prel,
4630 Arm_relocate_functions::thm_movw_prel_nc,
4631 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
4632 (Target_arm::Relocate::relocate): Only decompose address into two
4633 parts if relocation type uses the thumb-bit and pass the actual
4634 bit instead of a flag indicating that the thumb-bit is used. Adjust
4635 calls to methods in Arm_relocate_functions for this change.
4637 2009-11-08 Ian Lance Taylor <iant@google.com>
4640 * reloc.cc: Instantiate
4641 Sized_relobj::initialize_input_to_output_maps and
4642 Sized_relobj:free_input_to_output_maps.
4644 2009-11-06 Ian Lance Taylor <iant@google.com>
4647 * defstd.cc (in_segment): Set only_if_ref true for "end".
4649 2009-11-06 Doug Kwan <dougkwan@google.com>
4651 * arm.cc (class Reloc_stub): Correct a comment.
4652 (Target_arm::Target_arm): Initialize arm_input_section_map_.
4653 (Target_arm::scan_section_for_stubs): New method declaration.
4654 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
4655 Change methods from private to protected.
4656 (Target_arm::do_may_relax): New method definition.
4657 (Target_arm::do_relax, Target_arm::group_sections,
4658 Target_arm::scan_reloc_for_stub,
4659 Target_arm::scan_reloc_section_for_stubs): New method declarations.
4660 (Target_arm::arm_input_section_map_): New data member declaration.
4661 (Target_arm::scan_reloc_for_stub,
4662 Target_arm::scan_reloc_section_for_stubs,
4663 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
4664 Target_arm::do_relax): New method definitions.
4666 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
4668 * configure.ac: Check for (struct stat)::st_mtim
4669 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
4670 * config.in: Regenerate.
4671 * configure: Regenerate.
4673 2009-11-05 Ian Lance Taylor <iant@google.com>
4676 * output.cc (Output_segment::add_output_section): Add missing
4679 2009-11-04 Ian Lance Taylor <iant@google.com>
4682 * object.h (class Object): Add is_needed and set_is_needed
4683 methods. Add is_needed_ field. Make bool fields into bitfields.
4684 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
4685 defined in a dynamic object and referenced by a regular object,
4686 set is_needed for the dynamic object.
4687 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
4688 if the file is marked with as_needed and it is not needed.
4690 2009-11-04 Ian Lance Taylor <iant@google.com>
4693 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
4694 tags if data is discarded by linker script.
4695 * i386.cc (Target_i386::do_finalize_sections): Likewise.
4696 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
4697 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
4698 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4700 2009-11-04 Ian Lance Taylor <iant@google.com>
4702 * layout.cc (Layout::get_output_section): Add is_interp and
4703 is_dynamic_linker_section parameters. Change all callers.
4704 (Layout::choose_output_section): Likewise.
4705 (Layout::make_output_section): Likewise.
4706 (Layout::add_output_section_data): Add is_dynamic_linker_section
4707 parameter. Change all callers.
4708 * layout.h (class Layout): Update declarations.
4709 * output.h (class Output_section): Add is_interp, set_is_interp,
4710 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
4711 Add is_interp_, is_dynamic_linker_section_ fields. Change
4712 generate_code_fills_at_write_ to a bitfield.
4713 * output.cc (Output_section::Output_sections): Initialize new
4715 (Output_segment::add_output_section): Add do_sort parameter.
4718 2009-11-03 Ian Lance Taylor <iant@google.com>
4721 * options.h (class General_options): Add --warn-common.
4722 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
4723 merging two common symbols.
4724 (Symbol_table::should_override): Handle --warn-common when merging
4725 a common symbol with a defined symbol. Use report_resolve_problem
4726 for multiple definitions.
4727 (Symbol_table::report_resolve_problem): New function.
4728 * symtab.h (class Symbol_table): Declare report_resolve_problem.
4730 2009-11-03 Doug Kwan <dougkwan@google.com>
4732 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
4734 (Target_arm::stub_factory): New method definition.
4735 (Target_arm::new_arm_input_section,
4736 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
4737 Target_arm::reloc_uses_thumb_bit): New method declarations.
4738 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
4739 New type definitions.
4740 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
4741 member declarations.
4742 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
4743 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
4744 New method definitions.
4746 2009-11-03 Ian Lance Taylor <iant@google.com>
4748 * options.h (class General_options): Add --warn_constructors.
4750 2009-11-03 Ian Lance Taylor <iant@google.com>
4753 * defstd.cc (in_section): Add entries for __rel_iplt_start,
4754 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
4756 2009-11-03 Ian Lance Taylor <iant@google.com>
4759 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
4760 --msgid-bugs-address.
4761 (install-pdf): New target.
4762 (install-data_yes): Look up one directory to find mkinstalldirs.
4764 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
4766 * po/Make-in (.po.gmo): Don't generate .gmo files in source
4769 2009-10-30 Doug Kwan <dougkwan@google.com>
4771 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
4773 2009-10-30 Doug Kwan <dougkwan@google.com>
4775 * arm.cc (Stub_addend_reader): New struct template definition
4776 and partial specializations.
4777 (Stub_addend_reader::operator()): New method definition for a
4778 partially specialized template.
4780 2009-10-30 Doug Kwan <dougkwan@google.com>
4782 * arm.cc (Arm_relobj::processor_specific_flags): New method
4784 (Arm_relobj::do_read_symbols): New method declaration.
4785 (Arm_relobj::processor_specific_flags_): New data member declaration.
4786 (Arm_dynobj): New class definition.
4787 (Target_arm::do_finalize_sections): Add input_objects parameter.
4788 (Target_arm::do_adjust_elf_header): New method declaration.
4789 (Target_arm::are_eabi_versions_compatible,
4790 (Target_arm::merge_processor_specific_flags): New method declaration.
4791 (Target_arm::do_make_elf_object): New overloaded method definitions
4793 (Arm_relobj::do_read_symbols): New method definition.
4794 (Arm_dynobj::do_read_symbols): Ditto.
4795 (Target_arm::do_finalize_sections): Add input_objects parameters.
4796 Merge processor-specific flags from all input objects.
4797 (Target_arm::are_eabi_versions_compatible,
4798 Target_arm::merge_processor_specific_flags,
4799 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
4800 New method definitions.
4801 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
4802 Input_objects pointer type parameter.
4803 * layout.cc (Layout::finalize): Pass input objects to target's.
4804 finalize_sections function.
4805 * output.cc (Output_file_header::do_sized_write): Set ELF file
4806 header's processor-specific flags.
4807 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
4808 Input_objects pointer type parameter.
4809 * sparc.cc (Target_sparc::do_finalize_sections): Same.
4810 * target.h (Input_objects): New forward class declaration.
4811 (Target::processor_specific_flags,
4812 Target::are_processor_specific_flags_sect): New method definitions.
4813 (Target::finalize_sections): Add input_objects parameter.
4814 (Target::Target): Initialize processor_specific_flags_ and
4815 are_processor_specific_flags_set_.
4816 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
4818 (Target::set_processor_specific_flags): New method definition.
4819 (Target::processor_specific_flags_,
4820 Target::are_processor_specific_flags_set_): New data member
4822 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
4823 Input_objects pointer type parameter.
4825 2009-10-30 Doug Kwan <dougkwan@google.com>
4827 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
4829 2009-10-28 Ian Lance Taylor <iant@google.com>
4831 * object.h (class Relobj): Drop options parameter from
4832 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
4833 do_scan_relocs, do_relocate. Change all callers.
4834 (class Sized_relobj): Drop options parameters from
4835 do_gc_process_relocs, do_scan_relocs, do_relocate,
4836 do_relocate_sections, relocate_sections, emit_relocs_scan,
4837 emit_relocs_scan_reltype. Change all callers.
4838 (struct Relocate_info): Remove options field and all references to
4840 * reloc.h (class Read_relocs): Remove options constructor
4841 parameter and options_ field. Change all callers.
4842 (class Gc_process_relocs, class Scan_relocs): Likewise.
4843 (class Relocate_task): Likewise.
4844 * target-reloc.h (scan_relocs): Remove options parameter. Change
4846 (scan_relocatable_relocs): Likewise.
4847 * target.h (class Sized_target): Remove options parameter from
4848 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
4850 * gc.h (gc_process_relocs): Remove options parameter. Change all
4852 * arm.cc: Update functions to remove options parameters.
4853 * i386.cc: Likewise.
4854 * powerpc.cc: Likewise.
4855 * sparc.cc: Likewise.
4856 * x86_64.cc: Likewise.
4857 * testsuite/testfile.cc: Likewise.
4859 2009-10-28 Doug Kwan <dougkwan@google.com>
4861 * arm.cc (Arm_relobj): New class definition.
4862 (Arm_relobj::scan_sections_for_stubs,
4863 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
4864 New method definitions.
4866 2009-10-28 Cary Coutant <ccoutant@google.com>
4868 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
4869 (Plugin::cleanup_done_): New member.
4870 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
4871 (Plugin_manager::cleanup_done_): Remove.
4872 (Plugin_manager::add_input_file): Edit error message.
4873 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
4874 (Plugin_manager::cleanup): Remove use of cleanup_done_.
4876 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
4878 * fileread.cc: (File_read::View::~View): Use the new
4879 data_ownership_ filed.
4880 (File_read::~File_read): Dispose the new whole_file_view_.
4881 (File_read::open): Mmap the whole file if needed.
4882 (File_read::open): Use whole_file_view_ instead of contents_.
4883 (File_read::find_view): Use whole_file_view_ if applicable.
4884 (File_read::do_read): Use whole_file_view_ instead of contents_.
4885 (File_read::make_view): Use whole_file_view_ instead of contents_,
4886 update File_read::View::View call.
4887 (File_read::find_or_make_view): Update File_read::View::View
4889 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
4891 (File_read::View::Data_ownership): New enum.
4892 (File_read::View::View): Replace bool mapped_ with Data_ownership
4894 (File_read::View::mapped_): Remove (replaced by data_ownership_).
4895 (File_read::View::data_ownership_): New field.
4896 (File_read::contents_): Remove (replaced by whole_file_view_).
4897 (File_read::whole_file_view_): New field.
4898 * options.h (class General_options): Add --keep-files-mapped.
4900 2009-10-27 Cary Coutant <ccoutant@google.com>
4902 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
4903 * testsuite/Makefile.am (plugin_test_5): New test case.
4904 * testsuite/Makefile.in: Regenerate.
4906 2009-10-25 Doug Kwan <dougkwan@google.com>
4908 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
4909 from private to protected to allow access by child class.
4910 (Sized_relobj::do_relocate_sections): New method declaration.
4911 (Sized_relobj::relocate_sections): Virtualize.
4912 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
4913 Sized_relobj::relocate_sections. Instantiate template explicitly
4914 for different target sizes and endianity.
4916 2009-10-24 Doug Kwan <dougkwan@google.com>
4918 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
4919 (Arm_input_section::as_arm_input_section): New method.
4920 (Arm_output_section): New class definition.
4921 (Arm_output_section::create_stub_group,
4922 Arm_output_section::group_sections): New method definitions.
4924 2009-10-22 Doug Kwan <dougkwan@google.com>
4926 * arm.cc (Arm_input_section): New class definition.
4927 (Arm_input_section::init, Arm_input_section:do_write,
4928 Arm_input_section::set_final_data_size,
4929 Arm_input_section::do_reset_address_and_file_offset): New method
4932 2009-10-21 Doug Kwan <dougkwan@google.com>
4934 * arm.cc (Stub_table, Arm_input_section): New forward class
4936 (Stub_table): New class defintion.
4937 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
4938 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
4939 New method definition.
4941 2009-10-21 Doug Kwan <dougkwan@google.com>
4943 * arm.cc: Update copyright comments.
4944 (Target_arm): New forward class template declaration.
4945 (Arm_address): New type.
4946 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
4947 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
4948 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
4950 (Insn_template): Same.
4951 (DEF_STUBS): New macro.
4952 (Stub_type): New enum type.
4953 (Stub_template): New class definition.
4956 (Stub_factory): Same.
4957 (Target_arm::Target_arm): Initialize may_use_blx_ and
4958 should_force_pic_veneer_.
4959 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
4960 Target_arm::should_force_pic_veneer,
4961 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
4962 Target_arm::using_thumb_only, Target_arm:;default_target): New
4964 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
4965 New data member declarations.
4966 (Insn_template::size, Insn_template::alignment): New method defintions.
4967 (Stub_template::Stub_template): New method definition.
4968 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
4969 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
4970 (Stub_factory::Stub_factory): New method definition.
4971 * gold.h (string_hash): New template.
4972 * output.h (Input_section_specifier::hash_value): Use
4974 (Input_section_specifier::string_hash): Remove.
4975 * stringpool.cc (Stringpool_template::string_hash): Use
4978 2009-10-20 Doug Kwan <dougkwan@google.com>
4980 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
4981 symbols of relaxed input sections.
4982 * output.h (Output_section::find_relaxed_input_section): Make
4985 2009-10-16 Doug Kwan <dougkwan@google.com>
4987 * dynobj.cc (Versions::Versions): Initialize version_script_.
4988 Only insert base version symbol definition for a shared object
4989 if version script defines any version versions.
4990 (Versions::define_base_version): New method definition.
4991 (Versions::add_def): Check that base version is not needed.
4992 (Versions::add_need): Define base version lazily.
4993 * dynobj.h (Versions::define_base_version): New method declaration.
4994 (Versions::needs_base_version_): New data member declaration.
4995 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
4996 (check_DATA): Add no_version_test.stdout.
4997 (libno_version_test.so, no_version_test.o no_version_test.stdout):
4999 * testsuite/Makefile.in: Regenerate.
5000 * testsuite/no_version_test.c: New file.
5001 * testsuite/no_version_test.sh: Ditto.
5003 2009-10-16 Doug Kwan <dougkwan@google.com>
5005 * expression.cc (class Segment_start_expression): New class definition.
5006 (Segment_start_expression::value): New method definition.
5007 (script_exp_function_segment_start): Return a new
5008 Segment_start_expression.
5009 * gold/script-c.h (script_saw_segment_start_expression): New function
5011 * script-sections.cc (Script_sections::Script_sections): Initialize
5012 SAW_SEGMENT_START_EXPRESSION_ to false.
5013 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
5014 and -Tbbs options to specify section addresses if given in
5015 command line and no SEGMENT_START expression is seen in a script.
5016 * script-sections.h (Script_sections::saw_segment_start_expression,
5017 Script_sections::set_saw_segment_start_expression): New method
5019 (Script_sections::saw_segment_start_expression_): New data member
5021 * script.cc (script_saw_segment_start_expression): New function.
5022 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
5023 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
5024 script_test_7.sh and script_test_8.sh.
5025 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
5026 script_test_8.stdout.
5027 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
5028 (script_test_6, script_test_6.stdout, script_test_7,
5029 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
5030 * Makefile.in: Regenerate.
5031 * testsuite/script_test_6.sh: New file.
5032 * testsuite/script_test_6.t: Same.
5033 * testsuite/script_test_7.sh: Same.
5034 * testsuite/script_test_7.t: Same.
5035 * testsuite/script_test_8.sh: Same.
5037 2009-10-16 Doug Kwan <dougkwan@google.com>
5039 * output.cc (Output_segment::set_section_list_address): Cast
5040 expressions to unsigned long long type to avoid format warnings.
5042 2009-10-15 Ian Lance Taylor <iant@google.com>
5044 * script.cc (Script_options::add_symbol_assignment): Always add a
5045 dot assignment to script_sections_.
5046 * script-sections.cc (Script_sections::add_dot_assignment):
5047 Initialize if necessary.
5049 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
5050 program headers with no load segment if there is a linker script.
5052 * layout.cc (Layout::set_segment_offsets): Align the file offset
5053 to the segment aligment for -N or -n with no load segment.
5054 * output.cc (Output_segment::add_output_section): Don't crash if
5055 the first section is a TLS section.
5056 (Output_segment::set_section_list_addresses): Print an error
5057 message if the address moves backward in a linker script.
5058 * script-sections.cc
5059 (Output_section_element_input::set_section_addresses): Don't
5060 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
5061 (Orphan_output_section::set_section_addresses): Likewise.
5063 2009-10-15 Doug Kwan <dougkwan@google.com>
5065 * layout.cc (Layout::finish_dynamic_section): Generate tags
5066 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
5067 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
5068 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
5070 2009-10-14 Ian Lance Taylor <iant@google.com>
5072 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
5074 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
5075 data_shdr fields of relinfo.
5076 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
5077 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
5078 R_386_TLS_LDO_32, adjust based on section flags.
5079 (Target_i386::Relocate::fix_up_ldo): Remove.
5081 2009-10-13 Ian Lance Taylor <iant@google.com>
5083 Add support for -pie.
5084 * options.h (class General_options): Add -pie and
5086 (General_options::output_is_position_independent): Test -pie.
5087 (General_options::output_is_executable): Return true if not shared
5088 and not relocatable.
5089 (General_options::output_is_pie): Remove.
5090 * options.cc (General_options::finalize): Reject incompatible uses
5092 * gold.cc (queue_middle_tasks): A -pie link is not static.
5093 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
5094 * symtab.cc (Symbol::final_value_is_known): Return false if
5095 output_is_position_independent.
5096 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
5097 output_is_position_independent.
5098 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
5099 output_is_position_independent.
5100 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
5101 output_is_position_independent.
5102 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
5104 (basic_pie_test.o, basic_pie_test): New targets.
5105 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
5106 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
5107 (two_file_pie_test): New target.
5108 * testsuite/Makefile.in: Rebuild.
5109 * README: Remove note saying that -pie is not supported.
5111 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
5113 * options.h (class General_options): Add -init and -fini.
5114 * layout.cc (Layout::finish_dynamic_section): Emit
5115 given init and fini functions.
5117 2009-10-13 Sriraman Tallam <tmsriram@google.com>
5119 * gc.h (gc_process_relocs): Check if icf is enabled using new
5121 * gold.cc (queue_initial_tasks): Likewise.
5122 (queue_middle_tasks): Likewise.
5123 * object.cc (do_layout): Likewise.
5124 * symtab.cc (is_section_folded): Likewise.
5125 * main.cc (main): Likewise.
5126 * reloc.cc (Read_relocs::run): Likewise.
5127 (Sized_relobj::do_scan_relocs): Likewise.
5128 * icf.cc (is_function_ctor_or_dtor): New function.
5129 (Icf::find_identical_sections): Check if function is ctor or dtor when
5131 * options.h (General_options::icf): Change option to be an enum.
5132 (Icf_status): New enum.
5133 (icf_enabled): New method.
5134 (icf_safe_folding): New method.
5135 (set_icf_status): New method.
5136 (icf_status_): New variable.
5137 * (options.cc) (General_options::finalize): Set icf_status_.
5138 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
5139 icf_test and icf_keep_unique_test to use the --icf enum flag.
5140 * testsuite/icf_safe_test.sh: New file.
5141 * testsuite/icf_safe_test.cc: New file.
5143 2009-10-12 Sriraman Tallam <tmsriram@google.com>
5145 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
5146 includes to gc.h and icf.h.
5147 * arm.cc: Include gc.h.
5148 * gold.cc: Likewise.
5149 * i386.cc: Likewise.
5150 * powerpc.cc: Likewise.
5151 * sparc.cc: Likewise.
5152 * x86_64.cc: Likewise.
5153 * gc.h: Include icf.h.
5155 2009-10-11 Ian Lance Taylor <iant@google.com>
5157 * plugin.cc: Include "gold.h" before other header files.
5159 2009-10-10 Chris Demetriou <cgd@google.com>
5161 * options.h (Input_file_argument::Input_file_type): New enum.
5162 (Input_file_argument::is_lib_): Replace with...
5163 (Input_file_argument::type_): New member.
5164 (Input_file_argument::Input_file_argument): Take Input_file_type
5165 'type' rather than boolean 'is_lib' as second argument.
5166 (Input_file_argument::is_lib): Use type_.
5167 (Input_file_argument::is_searched_file): New function.
5168 (Input_file_argument::may_need_search): Handle is_searched_file.
5169 * options.cc (General_options::parse_library): Support -l:filename.
5170 (General_options::parse_just_symbols): Update for Input_file_argument
5172 (Command_line::process): Likewise.
5173 * archive.cc (Archive::get_file_and_offset): Likewise.
5174 * plugin.cc (Plugin_manager::release_input_file): Likewise.
5175 * script.cc (read_script_file, script_add_file): Likewise.
5176 * fileread.cc (Input_file::Input_file): Likewise.
5177 (Input_file::will_search_for): Handle is_searched_file.
5178 (Input_file::open): Likewise.
5179 * readsyms.cc (Read_symbols::get_name): Likewise.
5180 * testsuite/Makefile.am (searched_file_test): New test.
5181 * testsuite/Makefile.in: Regenerate.
5182 * testsuite/searched_file_test.cc: New file.
5183 * testsuite/searched_file_test_lib.cc: New file.
5185 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
5186 Ian Lance Taylor <iant@google.com>
5188 * descriptor.cc: Include <cstdio> and "binary-io.h".
5189 (Descriptors::open): Open the files in binary mode always.
5190 * script.cc (Lex::get_token): Treat \r as whitespace.
5192 2009-10-09 Ian Lance Taylor <iant@google.com>
5194 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
5196 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
5197 Ian Lance Taylor <iant@google.com>
5199 * configure.ac: Check for readv function also.
5200 * fileread.cc (readv): Define if not HAVE_READV.
5201 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
5203 * config.in: Regenerate.
5204 * configure: Regenerate.
5206 2009-10-09 Doug Kwan <dougkwan@google.com>
5208 * layout.cc (Layout::make_output_section): Call target hook to make
5209 ordinary output section.
5210 (Layout::finalize): Adjust parameter list of call the
5211 Target::may_relax().
5212 * layout.h (class Layout::section_list): New method.
5213 * merge.h (Output_merge_base::entsize): Change visibility to public.
5214 (Output_merge_base::is_string, Output_merge_base::do_is_string):
5216 (Output_merge_string::do_is_string): New method.
5217 * object.cc (Sized_relobj::do_setup): renamed from
5218 Sized_relobj::set_up.
5219 * object.h (Sized_relobj::adjust_shndx,
5220 Sized_relobj::initializ_input_to_output_maps,
5221 Sized_relobj::free_input_to_output_maps): Change visibilities to
5223 (Sized_relobj::setup): Virtualize.
5224 (Sized_relobj::do_setup): New method declaration.
5225 (Sized_relobj::invalidate_section_offset,
5226 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
5227 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
5228 * options.cc (parse_int): New function.
5229 * options.h (parse_int): New declaration.
5230 (DEFINE_int): New macro.
5231 (stub_group_size): New option.
5232 * output.cc (Output_section::Output_section): Initialize memebers
5233 merge_section_map_, merge_section_by_properties_map_,
5234 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
5235 (Output_section::add_input_section): Handled deferred code-fill
5236 generation and remove an old comment.
5237 (Output_section::add_relaxed_input_section): New method definition.
5238 (Output_section::add_merge_input_section): Use merge section by
5239 properties map to speed to search. Update merge section maps
5241 (Output_section::build_relaxation_map): New method definition.
5242 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5244 (Output_section::relax_input_section): Renamed to
5245 Output_section::convert_input_sections_to_relaxed_sections and change
5246 interface to take a vector of pointers to relaxed sections.
5247 (Output_section::find_merge_section,
5248 Output_section::find_relaxed_input_section): New method definitions.
5249 (Output_section::is_input_address_mapped,
5250 Output_section::output_offset, Output_section::output_address):
5251 Use output section data maps to speed up searching.
5252 (Output_section::find_starting_output_address): Add comments.
5253 (Output_section::do_write,
5254 Output_section::write_to_postprocessing_buffer): Do code-fill
5255 generation as appropriate.
5256 (Output_section::get_input_sections): Invalidate relaxed input section
5258 (Output_section::restore_states): Adjust type of checkpoint .
5259 Invalidate relaxed input section map.
5260 * output.h (Output_merge_base): New class declaration.
5261 (Input_section_specifier): New class defintion.
5262 (class Output_relaxed_input_section) Change base class to
5263 Output_section_data_build.
5264 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
5265 base class initializer.
5266 (Output_section::add_relaxed_input_section): New method declaration.
5267 (Output_section::Input_section): Change visibility to protected.
5268 (Output_section::Input_section::relobj,
5269 Output_section::Input_section::shndx): Handle relaxed input sections.
5270 Output_section::input_sections) Change visibility to protected. Also
5271 define overload to return a non-const pointer.
5272 (Output_section::Merge_section_properties): New class defintion.
5273 (Output_section::Merge_section_by_properties_map,
5274 Output_section::Output_section_data_by_input_section_map,
5275 Output_section::Relaxation_map): New types.
5276 (Output_section::relax_input_section): Rename method to
5277 Output_section::convert_input_sections_to_relaxed_sections and change
5278 interface to take a vector of relaxed section pointers.
5279 (Output_section::find_merge_section,
5280 Output_section::find_relaxed_input_section,
5281 Output_section::build_relaxation_map,
5282 Output_section::convert_input_sections_in_list_to_relaxed_sections):
5283 New method declarations.
5284 (Output_section::merge_section_map_
5285 Output_section::merge_section_by_properties_map_,
5286 Output_section::relaxed_input_section_map_,
5287 Output_section::is_relaxed_input_section_map_valid_,
5288 Output_section::generate_code_fills_at_write_): New data members.
5289 * script-sections.cc
5290 (Output_section_element_input::set_section_addresses): Call
5291 current_data_size and addralign methods of relaxed input sections.
5292 (Orphan_output_section::set_section_addresses): Call current_data_size
5293 and addralign methods of relaxed input sections.
5294 * symtab.cc (Symbol_table::compute_final_value): Extract template
5295 from the body of Symbol_table::sized_finalize_symbol.
5296 (Symbol_table::sized_finalized_symbol): Call
5297 Symbol_table::compute_final_value.
5298 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
5299 (Symbol_table::compute_final_value): New templated method declaration.
5300 * target.cc (Target::do_make_output_section): New method defintion.
5301 * target.h (Target::make_output_section): New method declaration.
5302 (Target::relax): Add more parameters for input objects, symbol table
5303 and layout. Adjust call to do_relax.
5304 (Target::do_make_output_section): New method declaration.
5305 (Target::do_relax): Add parameters for input objects, symbol table
5308 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
5310 * pread.c: Include stdio.h.
5312 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
5314 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
5317 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
5319 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5320 Change read_shndx type to unsigned int.
5321 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
5323 (Sized_dwarf_line_info::read_line_mappings): Likewise.
5324 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
5325 Change read_shndx type to unsigned int.
5326 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
5328 (Sized_dwarf_line_info::read_line_mappings): Likewise.
5329 * layout.cc (Layout::create_symtab_sections): Cast the result of
5330 local_symcount * symsize to off_t in the gold_assert.
5332 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5334 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
5335 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
5337 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
5338 (Arm_relocate_functions::thm_abs5): New function.
5339 (Arm_relocate_functions::abs12): New function.
5340 (Arm_relocate_functions::abs16): New function.
5341 (Arm_relocate_functions::base_abs): New function.
5342 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
5343 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
5344 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
5346 (Scan::global): Likewise.
5347 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
5348 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
5349 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
5350 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
5353 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5355 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
5356 (Arm_relocate_functions::movt_prel): New function.
5357 (Arm_relocate_functions::thm_movw_prel_nc): New function.
5358 (Arm_relocate_functions::thm_movt_prel): New function.
5359 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
5360 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
5361 (Scan::global, Relocate::relocate): Likewise.
5362 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
5364 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
5366 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
5367 Incremental_checker.
5368 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
5370 (class Incremental_inputs_header): New class.
5371 (Incremental_inputs_header_writer): Edit comment.
5372 (Incremental_inputs_entry): New class.
5373 (Incremental_inputs_entry_writer): Edit comment.
5374 (Sized_incremental_binary::do_find_incremental_inputs_section):
5375 Add *strtab_shndx parameter, fill it.
5376 (Sized_incremental_binary::do_check_inputs): New method.
5377 (Incremental_checker::can_incrementally_link_output_file): Use
5378 Sized_incremental_binary::check_inputs.
5379 (Incremental_inputs::report_command_line): Save command line in
5382 (Incremental_binary::find_incremental_inputs_section): New
5384 (Incremental_binary::do_find_incremental_inputs_section): Add
5385 strtab_shndx parameter.
5386 (Incremental_binary::do_check_inputs): New pure virtual method.
5387 (Sized_incremental_binary::do_check_inputs): Declare.
5388 (Incremental_checker::Incremental_checker): Add incremental_inputs
5389 parameter, use it to initialize incremental_inputs_.
5390 (Incremental_checker::incremental_inputs_): New field.
5391 (Incremental_checker::command_line): New method.
5392 (Incremental_checker::inputs): New method.
5393 (Incremental_checker::command_line_): New field.
5395 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
5397 * incremental.cc: Include <cstdarg> and "target-select.h".
5398 (vexplain_no_incremental): New function.
5399 (explain_no_incremental): New function.
5400 (Incremental_binary::error): New method.
5401 (Sized_incremental_binary::do_find_incremental_inputs_section): New
5403 (make_sized_incremental_binary): New function.
5404 (open_incremental_binary): New function.
5405 (can_incrementally_link_file): Add checks if output is ELF and has
5407 * incremental.h: Include "elfcpp_file.h" and "output.h".
5408 (Incremental_binary): New class.
5409 (Sized_incremental_binary): New class.
5410 (open_incremental_binary): Declare.
5411 * object.cc (is_elf_object): Use
5412 elfcpp::Elf_recognizer::is_elf_file.
5413 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
5414 * output.h (Output_file::filesize): New method.
5416 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5418 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
5420 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
5421 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
5423 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
5425 (Arm_relocate_functions::movw_abs_nc): New function.
5426 (Arm_relocate_functions::movt_abs): New function.
5427 (Arm_relocate_functions::thm_movw_abs_nc): New function.
5428 (Arm_relocate_functions::thm_movt_abs): New function.
5429 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
5430 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
5431 (Scan::global): Likewise.
5432 (Relocate::relocate): Likewise.
5433 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
5435 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5437 * arm.cc (Arm_relocate_functions::got_prel) New function.
5438 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
5439 (Relocate::relocate): Likewise.
5440 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
5442 2009-10-06 Ian Lance Taylor <iant@google.com>
5444 * options.h (class General_options): Define
5445 split_stack_adjust_size parameter.
5446 * object.h (class Object): Add uses_split_stack_ and
5447 has_no_split_stack_ fields. Add uses_split_stack and
5448 has_no_split_stack accessor functions. Declare
5449 handle_split_stack_section.
5450 (class Reloc_symbol_changes): Define.
5451 (class Sized_relobj): Define Function_offsets. Declare
5452 split_stack_adjust, split_stack_adjust_reltype, and
5454 * object.cc (Object::handle_split_stack_section): New function.
5455 (Sized_relobj::do_layout): Call handle_split_stack_section.
5456 * dynobj.cc (Sized_dynobj::do_layout): Call
5457 handle_split_stack_section.
5458 * reloc.cc (Sized_relobj::relocate_sections): Call
5459 split_stack_adjust for executable sections in split_stack
5460 objects. Pass reloc_map to relocate_section.
5461 (Sized_relobj::split_stack_adjust): New function.
5462 (Sized_relobj::split_stack_adjust_reltype): New function.
5463 (Sized_relobj::find_functions): New function.
5464 * target-reloc.h: Include "object.h".
5465 (relocate_section): Add reloc_symbol_changes parameter. Change
5467 * target.h (class Target): Add calls_non_split method. Declare
5468 do_calls_non_split virtual method. Declare match_view and
5470 * target.cc: Include "elfcpp.h".
5471 (Target::do_calls_non_split): New function.
5472 (Target::match_view): New function.
5473 (Target::set_view_to_nop): New function.
5474 * gold.cc (queue_middle_tasks): Give an error if mixing
5475 split-stack and non-split-stack objects with -r.
5476 * i386.cc (Target_i386::relocate_section): Add
5477 reloc_symbol_changes parameter.
5478 (Target_i386::do_calls_non_split): New function.
5479 * x86_64.cc (Target_x86_64::relocate_section): Add
5480 reloc_symbol_changes parameter.
5481 (Target_x86_64::do_calls_non_split): New function.
5482 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
5484 * powerpc.cc (Target_powerpc::relocate_section): Add
5485 reloc_symbol_changes parameter.
5486 * sparc.cc (Target_sparc::relocate_section): Add
5487 reloc_symbol_changes parameter.
5488 * configure.ac: Call AM_CONDITIONAL for the default target.
5489 * configure: Rebuild.
5490 * testsuite/Makefile.am (TEST_AS): New variable.
5491 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
5492 (check_DATA): Add split_i386 and split_x86_64 files.
5493 (SPLIT_DEFSYMS): Define.
5494 (split_i386_[1234n].o): New targets.
5495 (split_i386_[124]): New targets.
5496 (split_i386_[1234r].stdout): New targets.
5497 (split_x86_64_[1234n].o): New targets.
5498 (split_x86_64_[124]): New targets.
5499 (split_x86_64_[1234r].stdout): New targets.
5500 (MOSTLYCLEANFILES): Add new executables.
5501 * testsuite/split_i386.sh: New file.
5502 * testsuite/split_x86_64.sh: New file.
5503 * testsuite/split_i386_1.s: New file.
5504 * testsuite/split_i386_2.s: New file.
5505 * testsuite/split_i386_3.s: New file.
5506 * testsuite/split_i386_4.s: New file.
5507 * testsuite/split_i386_n.s: New file.
5508 * testsuite/split_x86_64_1.s: New file.
5509 * testsuite/split_x86_64_2.s: New file.
5510 * testsuite/split_x86_64_3.s: New file.
5511 * testsuite/split_x86_64_4.s: New file.
5512 * testsuite/split_x86_64_n.s: New file.
5513 * testsuite/testfile.cc (Target_test): Update relocation_section
5515 * testsuite/Makefile.in: Rebuild.
5517 2009-10-06 Ian Lance Taylor <iant@google.com>
5519 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
5520 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
5521 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
5522 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
5523 the address on ldo_addrs_.
5524 (Target_i386::Relocate::fix_up_ldo): New function.
5526 2009-10-06 Rafael Espindola <espindola@google.com>
5528 * plugin.cc (add_input_library): New.
5529 (Plugin::load): Add add_input_library to tv.
5530 (Plugin_manager::add_input_file): Add the is_lib argument.
5531 (add_input_file): Update call to Plugin_manager::add_input_file.
5532 (add_input_library): New.
5533 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
5535 2009-09-30 Doug Kwan <dougkwan@google.com>
5537 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
5538 symbol and call Symbol::may_need_copy_reloc to determine if
5539 a copy reloc is needed.
5540 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
5541 nocopyreloc is given in command line.
5542 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
5543 given in command line.
5544 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
5545 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
5546 of the removed Target_i386::may_need_copy_reloc.
5547 * options.h (copyreloc): New option with default value false.
5548 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
5549 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
5550 instead of the removed Target_powerpc::may_need_copy_reloc.
5551 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
5552 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
5553 instead of the removed Target_sparc::may_need_copy_reloc.
5554 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
5555 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
5556 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
5557 instead of the removed Target_x86_64::may_need_copy_reloc.
5559 2009-09-30 Ian Lance Taylor <iant@google.com>
5561 * object.h (class Object): Remove target_ field, and target,
5562 sized_target, and set_target methods.
5563 (Object::sized_target): Remove.
5564 (class Sized_relobj): Update declarations. Remove sized_target.
5565 * object.cc (Sized_relobj::setup): Remove target parameter.
5567 (Input_objects::add_object): Don't do anything with the target.
5568 (make_elf_sized_object): Add punconfigured parameter. Change all
5569 callers. Set or test parameter target.
5570 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
5572 * parameters.cc (Parameters::set_target): Change parameter type to
5574 (Parameters::default_target): Remove.
5575 (set_parameters_target): Change parameter type to be non-const.
5576 (parameters_force_valid_target): New function.
5577 (parameters_clear_target): New function.
5578 * parameters.h (class Parameters): Update declarations. Remove
5579 default_target method. Add sized_target and clear_target
5580 methods. Change target_ to be non-const.
5581 (set_parameters_target): Update declaration.
5582 (parameters_force_valid_target): Declare.
5583 (parameters_clear_target): Declare.
5584 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
5585 as NULL if we aren't searching.
5586 (Add_symbols::run): Don't check for compatible target.
5587 * fileread.cc (Input_file::open_binary): Call
5588 parameters_force_valid_target.
5589 * gold.cc (queue_middle_tasks): Likewise.
5590 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
5591 set_target on object.
5592 * dynobj.h (class Sized_dynobj): Update declarations.
5593 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
5594 make_elf_object returns NULL.
5595 (Archive::include_member): Don't check whether object target is
5597 * output.cc (Output_section::add_input_section): Get target from
5599 (Output_section::relax_input_section): Likewise.
5600 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
5602 (Sized_relobj::do_scan_relocs): Likewise.
5603 (Sized_relobj::relocate_sections): Likewise.
5604 * resolve.cc (Symbol_table::resolve): Likewise.
5605 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
5606 parameter. Change all callers.
5607 (Symbol_table::add_from_object): Get target from parameters.
5608 (Symbol_table::add_from_relobj): Don't check object target.
5609 (Symbol_table::add_from_dynobj): Likewise.
5610 (Symbol_table::define_special_symbol): Get target from
5612 * symtab.h (class Symbol_table): Update declaration.
5613 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
5614 parameter. Change all callers. Clear parameter target.
5615 (Binary_test): Test target here.
5616 * testsuite/object_unittest.cc (gold_testsuite): Remove
5617 target_test_pointer parameter. Change all callers.
5618 (Object_test): Test target here.
5620 2009-09-26 Ian Lance Taylor <iant@google.com>
5622 * testsuite/initpri1.c: Don't try to use constructor priorities if
5623 compiling with gcc before 4.3.
5625 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
5627 * testsuite/retain_symbols_file_test.sh (check_present): Change
5628 output file name to retain_symbols_file_test.stdout.
5629 (check_absent): Likewise.
5631 2009-09-18 Craig Silverstein <csilvers@google.com>
5633 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
5634 * options.cc: Include <cerrno> and <fstream>.
5635 (General_options::finalize): Parse -retain-symbols-file tag.
5636 * options.h: New flag.
5637 (General_options): New method should_retain_symbol, new
5638 variable symbols_to_retain.
5639 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
5640 should_retain_symbol map.
5641 * testsuite/Makefile.am (retain_symbols_file_test): New test.
5642 * testsuite/Makefile.in: Regenerate.
5643 * testsuite/retain_symbols_file_test.sh: New file.
5645 2009-09-18 Nick Clifton <nickc@redhat.com>
5647 * po/es.po: Updated Spanish translation.
5649 2009-09-17 Doug Kwan <dougkwan@google.com>
5651 * debug.h (DEBUG_RELAXATION): New constant.
5652 (DEBUG_ALL): Add DEBUG_RELAXATION.
5653 (debug_string_to_enum): Add relaxation debug option.
5655 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
5656 Layout::Relaxation_debug_check::read_sections,
5657 Layout::Relaxation_debug_check::read_sections): New method definitions.
5658 (Layout::Layout): Initialize data members
5659 record_output_section_data_from_scrips_,
5660 script_output_section_data_list_ and relaxation_debug_check_.
5661 (Layout::save_segments, Layout::restore_segments,
5662 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
5663 Layout::relaxation_loop_body): New method definitions.
5664 (Layout::finalize): Support relaxation. Move section layout code to
5665 Layout::relaxation_loop_body.
5666 (Layout::set_asection_address_from_script): Move code for orphan
5667 section placement out.
5668 (Layout::place_orphan_sections_in_script): New method definition.
5669 * layout.h (Output_segment_headers, Output_file_header):
5670 New forward class declarations.
5671 (Layout::~Layout): Define.
5672 (Layout::new_output_section_data_from_script): New method definition.
5673 (Layout::place_orphan_sections_in_script): New method declaration.
5674 (Layout::Segment_states): New type declaration.
5675 (Layout::save_segments, Layout::restore_segments,
5676 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
5677 Layout::relaxation_loop_body): New method declarations.
5678 (Layout::Output_section_data_list): New type declaration.
5679 (Layout::Relaxation_debug_check): New class definition.
5680 (Layout::record_output_section_data_from_script_,
5681 Layout::script_output_section_data_list_, Layout::segment_states_,
5682 Layout::relaxation_debug_check_): New data members.
5683 * output.cc: (Output_section_headers::do_size): New method definition.
5684 (Output_section_headers::Output_section_headers): Move size
5685 computation to Output_section_headers::do_size.
5686 (Output_segment_headers::do_size): New method definition.
5687 (Output_file_header::Output_file_header): Move size computation to
5688 Output_file_header::do_size and call it.
5689 (Output_file_header::do_size): New method definition.
5690 (Output_data_group::Output_data_group): Adjust call to
5691 Output_section_data.
5692 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
5693 (Output_symtab_xindex::do_write): Add array bound check.
5694 (Output_section::Input_section::print_to_mapfile): Handle
5695 RELAXED_INPUT_SECTION_CODE.
5696 (Output_section::Output_section): Initialize data member checkpoint_.
5697 (Output_section::~Output_section): Delete checkpoint object pointed
5699 (Output_section::add_input_section): Always add an Input_section if
5701 (Output_section::add_merge_input_section): Add assert.
5702 (Output_section::relax_input_section): New method definition.
5703 (Output_section::set_final_data_size): Set load address to zero for
5704 an unallocated section.
5705 (Output_section::do_address_and_file_offset_have_reset_values):
5706 New method definition.
5707 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
5708 Handle relaxed input section.
5709 (Output_section::sort_attached_input_sections): Checkpoint input
5710 section list lazily.
5711 (Output_section::get_input_sections): Change type of input_sections to
5712 list of Simple_input_section pointers. Checkpoint input section list
5713 lazily. Also handle relaxed input sections.
5714 (Output_section::add_input_section_for_script): Take a reference to
5715 a Simple_input_section object instead of Relobj pointer and section
5716 index as parameter. Handle relaxed input sections.
5717 (Output_section::save_states, Output_section::restore_states): New
5719 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
5720 (Output_data::is_data_size_fixed): New method definition.
5721 (Output_data::reset_addresss_and_file_offset): Do not reset data size
5723 (Output_data::address_and_file_offset_have_reset_values): New method
5725 (Output_data::do_address_and_file_offset_have_reset_values): New method
5727 (Output_data::set_data_size): Check that data size is not fixed.
5728 (Output_data::fix_data_size): New method definition.
5729 (Output_data::is_data_size_fixed_): New data member.
5730 (Output_section_headers::set_final_data_size): New method definition.
5731 (Output_section_headers::do_size): New method declaration.
5732 (Output_segment_headers::set_final_data_size): New method definition.
5733 (Output_segment_headers::do_size): New method declaration.
5734 (Output_file_header::set_final_data_size)::New method definition.
5735 (Output_file_header::do_size)::New method declaration.
5736 (Output_section_data::Output_section_data): Add new parameter
5737 is_data_size_fixed and use it to fix data size.
5738 (Output_data_const::Output_data_const): Adjust call to base class
5739 constructor and fix data size.
5740 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
5741 base class constructor and fix data size.
5742 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
5743 base class constructor and fix data size.
5744 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
5745 class constructor and fix data size.
5746 (Output_data_group::set_final_data_size): New method definition.
5747 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
5748 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
5749 class constructor and fix data size.
5750 (Output_relaxed_input_section): New class definition.
5751 (Output_section::Simple_input_section): New class definition.
5752 (Output_section::get_input_sections): Adjust parameter list.
5753 (Output_section::add_input_section_for_script): Same.
5754 (Output_section::save_states, Output_section::restore_states,
5755 Output_section::do_address_and_file_offset_have_reset_values,
5756 (Output_section::Input_section::Input_section): Handle
5757 RELAXED_INPUT_SECTION_CODE. Add new overload for
5758 Output_relaxed_input_section.
5759 (Output_section::Input_section::is_input_section,
5760 Output_section::Input_section::set_output_section): Handle relaxed
5762 (Output_section::Input_section::is_relaxed_input_section,
5763 Output_section::Input_section::output_section_data,
5764 Output_section::Input_section::relaxed_input_section): New method
5766 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
5768 (Output_section::Input_section::u1_): Update comments.
5769 (Output_section::Input_section::u2_): Add new union member poris.
5770 (Output_section::Checkpoint_output_section): New classs definition.
5771 (Output_section::relax_input_section): New method declaration.
5772 (Output_section::checkpoint_): New data member.
5773 (Output_segment): Update comments.
5774 (Output_segment::Output_segment): Un-privatize copy constructor.
5775 (Output_segment::operator=): Un-privatize.
5776 * script-sections.cc (Output_section_element::Input_section_list):
5777 Change element type to Output_section::Simple_input_section.
5778 (Output_section_element_dot_assignment::set_section_addresses):
5779 Register output section data for relaxation clean up.
5780 (Output_data_exression::Output_data_expression): Adjust call to base
5781 constructor to fix data size.
5782 (Output_section_element_data::set_section_addresses): Register
5783 Output_data_expression object for relaxation clean up.
5784 (struct Input_section_info): Replace Relobj pointer and section index
5785 pair with Output_section::Simple_input_section and Convert struct to a
5787 (Input_section_sorter::operator()): Adjust access to
5788 Input_section_info data member to use accessors.
5789 (Output_section_element_input::set_section_addresses): Use layout
5790 parameter. Adjust code to use Output_section::Simple_input_section
5791 and Input_secction_info classes. Register filler for relaxation
5793 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
5794 and section index pair with Output_section::Simple_input_section
5795 class. Adjust code accordingly.
5796 (Phdrs_element::release_segment): New method definition.
5797 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
5799 (Script_sections::release_segments): New method definition.
5800 * gold/script-sections.h (Script_sections::release_segments): New
5802 * gold/target.h (Target::may_relax, Target::relax,
5803 Target::do_may_relax, Target::do_relax): New method definitions.
5805 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5807 * arm.cc (has_signed_unsigned_overflow): New function.
5808 (Arm_relocate_functions::abs8): New function.
5809 (Target_arm::Scan::local): Handle R_ARM_ABS8.
5810 (Target_arm::Scan::global): Likewise.
5811 (Target_arm::relocate::relocate): Likewise.
5812 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5815 2009-09-16 Cary Coutant <ccoutant@google.com>
5817 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
5818 * testsuite/Makefile.in: Regenerate.
5820 2009-09-11 Nick Clifton <nickc@redhat.com>
5822 * po/gold.pot: Updated by the Translation project.
5824 2009-09-08 Cary Coutant <ccoutant@google.com>
5826 * output.cc (Output_file::open): Add execute permission to empty file.
5827 * testsuite/Makefile.am (permission_test): New test.
5828 * testsuite/Makefile.in: Regenerate.
5830 2009-09-02 Ian Lance Taylor <iant@google.com>
5832 * output.cc (Output_file::resize): Call map_no_anonymous rather
5835 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
5837 * gold.cc: Include "incremental.h".
5838 (queue_initial_tasks): Call Incremental_checker methods.
5839 * incremental.cc: Include "output.h".
5840 (Incremental_checker::can_incrementally_link_output_file): New
5842 * incremental.h (Incremental_checker): New class.
5844 * output.cc (Output_file::open_for_modification): New method.
5845 (Output_file::map_anonymous): Changed return type to bool. Record
5847 (Output_file::map_no_anonymous): New method, broken out of map.
5848 (Output_file::map): Use map_no_anonymous and map_anonymous.
5849 * output.h (class Output_file): Update declarations.
5851 2009-08-24 Cary Coutant <ccoutant@google.com>
5853 * options.h (Command_line::Pre_options): New class.
5854 (Command_line::pre_options): New member.
5855 * options.cc (gold::options::ready_to_register): New variable.
5856 (One_option::register_option): Do nothing if not registering options.
5857 Assert if same short option registered twice.
5858 (General_options::General_options): Turn off option registration when
5860 (Command_line::Pre_options::Pre_options): New constructor.
5862 2009-08-24 Cary Coutant <ccoutant@google.com>
5864 * options.h (General_options::no_keep_memory): Remove incorrect
5867 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5869 * Makefile.am (am__skiplex, am__skipyacc): New.
5870 * Makefile.in: Regenerate.
5872 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5874 * Makefile.am (AM_CPPFLAGS): Renamed from ...
5875 (INCLUDES): ... this.
5876 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
5877 (AM_CPPFLAGS): Renamed from ...
5878 (INCLUDE): ... this.
5879 * Makefile.in, testsuite/Makefile.in: Regenerate.
5881 * Makefile.in: Regenerate.
5882 * aclocal.m4: Likewise.
5883 * config.in: Likewise.
5884 * configure: Likewise.
5885 * testsuite/Makefile.in: Likewise.
5887 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
5888 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
5889 * Makefile.in: Regenerate.
5890 * testsuite/Makefile.in: Regenerate.
5892 2009-08-19 Cary Coutant <ccoutant@google.com>
5894 * resolve.cc (Symbol_table::resolve): Don't complain about defined
5895 symbols in shared libraries overridden by hidden or internal symbols
5896 in the main program.
5898 2009-08-19 Chris Demetriou <cgd@google.com>
5900 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
5901 checking source file names in error messages.
5903 2009-08-18 Doug Kwan <dougkwan@google.com>
5905 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
5906 an elcpp::Ehdr as parameter. Adjust call to set_target.
5907 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
5908 an elfcpp::Ehdr as parameter.
5909 * object.cc (Object::set_target): Remove the version that looks up
5910 a target and sets it.
5911 (Sized_relobj::setup): Take a Target object instead of
5912 an elfcpp::Ehdr as parameter. Adjust call to set_target.
5913 (make_elf_sized_object): Find target and ask target to
5915 * object.h: (Object::set_target): Remove the version that looks up
5916 a target and sets it.
5917 (Sized_relobj::setup): Take a Target object instead of
5918 an elfcpp:Ehdr as parameter.
5919 * target.cc: Include dynobj.h.
5920 (Target::do_make_elf_object_implementation): New.
5921 (Target::do_make_elf_object): New.
5922 * target.h (Target::make_elf_object): New template declaration.
5923 (Target::do_make_elf_object): New method declarations.
5924 (Target::do_make_elf_object_implementation): New template declaration.
5926 2009-08-14 Ian Lance Taylor <iant@google.com>
5928 * gold.h (FUNCTION_NAME): Define.
5929 (gold_unreachable): Use FUNCTION_NAME.
5931 2009-08-12 Sriraman Tallam <tmsriram@google.com>
5933 * icf.cc (Icf::find_identical_sections): Issue a warning when a
5934 symbol in the --keep-unique list is not found.
5936 2009-08-12 Sriraman Tallam <tmsriram@google.com>
5938 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
5939 been maked as --keep-unique.
5940 (Icf::unfold_section): New function.
5941 * icf.h (Icf::unfold_section): New function.
5942 * options.h (General_options::keep_unique): New option.
5943 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
5944 * testsuite/Makefile.in: Regenerate.
5945 * testsuite/icf_keep_unique_test.sh: New file.
5946 * testsuite/icf_keep_unique_test.cc: New file.
5948 2009-08-12 Cary Coutant <ccoutant@google.com>
5951 * resolve.cc (Symbol_table::resolve): Check for references from
5952 dynamic objects to hidden and internal symbols.
5953 * testsuite/Makefile.am (hidden_test.sh): New test.
5954 * testsuite/Makefile.in: Regenerate.
5955 * testsuite/hidden_test.sh: New script.
5956 * testsuite/hidden_test_1.c: New test source.
5957 * testsuite/hidden_test_main.c: New test source.
5959 2009-08-11 Doug Kwan <dougkwan@google.com>
5961 * arm.cc: Update comments.
5962 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
5963 segment to locate the .ARM.exidx section if present.
5965 2009-08-09 Doug Kwan <dougkwan@google.com>
5967 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
5970 2009-08-07 Sriraman Tallam <tmsriram@google.com>
5971 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
5974 2009-08-06 Sriraman Tallam <tmsriram@google.com>
5976 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
5977 valid tls_segment only for non-debug-section relocations.
5978 * testsuite/Makefile.am: Add gc_tls_test.
5979 * testsuite/Makefile.in: Regenerate.
5980 * testsuite/gc_tls_test.cc: New file.
5981 * testsuite/gc_tls_test.sh: New file.
5983 2009-08-05 Sriraman Tallam <tmsriram@google.com>
5987 * Makefile.am (CCFILES): Add icf.cc.
5989 * Makefile.in: Regenerate.
5990 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
5991 * gc.h (gc_process_relocs): Populate lists used by icf to contain
5992 section, symbol and addend information for the relocs.
5993 * gold.cc (queue_middle_tasks): Call identical code folding.
5994 * gold.h: Add defines for multimap.
5995 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
5996 to the call of finalize_local_symbols.
5997 * main.cc (main): Create object of class Icf.
5998 * object.cc (Sized_relobj::do_layout): Allow this function to be
5999 called twice during icf.
6000 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
6001 to sections marked as identical by icf.
6002 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
6004 (Sized_relobj::do_section_entsize): New function.
6005 * object.h (Object::section_entsize): New function.
6006 (Object::do_section_entsize): New pure virtual function.
6007 (Relobj::finalize_local_symbols): Add new parameter.
6008 (Relobj::do_section_entsize): New function.
6009 * options.h (General_options::icf): New option.
6010 (General_options::icf_iterations): New option.
6011 (General_options::print_icf_sections): New option.
6012 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
6013 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
6014 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
6016 * symtab.cc (Symbol_table::is_section_folded): New function.
6017 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
6018 to sections marked as identical by icf.
6019 * symtab.h (Symbol_table::set_icf): New function.
6020 (Symbol_table::icf): New function.
6021 (Symbol_table::is_section_folded): New function.
6022 (Symbol_table::icf_): New data member.
6023 * target-reloc.h (relocate_section): Ignore sections folded by icf.
6024 * testsuite/Makefile.am: Add commands to build icf_test.
6025 * testsuite/Makefile.in: Regenerate.
6026 * testsuite/icf_test.sh: New file.
6027 * testsuite/icf_test.cc: New file.
6029 2009-07-24 Chris Demetriou <cgd@google.com>
6031 * layout.cc (is_compressible_debug_section): Fix incorrect
6032 comment about compressed section names.
6034 2009-07-20 Ian Lance Taylor <ian@airs.com>
6037 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
6039 2009-07-16 Ian Lance Taylor <iant@google.com>
6042 * layout.h: #include <map>.
6043 (class Kept_section): Change from struct to class. Add accessors
6044 and setters. Add section size to Comdat_group mapping. Change
6045 Comdat_group to std::map. Add is_comdat_ field. Add
6046 linkonce_size field in union.
6047 (class Layout): Update declaration of find_or_add_kept_section.
6048 Don't declare find_kept_object.
6049 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
6050 parameter. Add object, shndx, is_comdat, and is_group_name
6051 parameters. Change all callers. Adjust for new Kept_section.
6052 (Layout::find_kept_object): Remove.
6053 * object.cc (Sized_relobj::include_section_group): Update use of
6054 Kept_section. Rename secnum to shndx. Only record
6055 Kept_comdat_section if sections are the same size.
6056 (Sized_relobj::include_linkonce_section): Update use of
6057 Kept_section. Only record Kept_comdat_section if sections are the
6058 same size. Set size of linkonce section.
6059 (Sized_relobj::map_to_kept_section): Update call to
6060 get_kept_comdat_section.
6061 * object.h (class Sized_relobj): Rename fields in
6062 Kept_comdat_section to drop trailing underscores; change object
6063 field to Relobj*. Change Kept_comdat_section_table to store
6064 struct rather than pointer.
6065 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
6066 Add kept_object and kept_shndx parameters. Change all callers.
6067 (Sized_relobj::get_kept_comdat_section): Change return type to
6068 bool. Add kept_object and kept_shndx parameters. Change all
6070 * plugin.cc (Pluginobj::include_comdat_group): Update call to
6071 Layout::find_or_add_kept_section.
6073 2009-07-09 Ian Lance Taylor <iant@google.com>
6075 * merge.cc (Object_merge_map::initialize_input_to_output_map):
6076 Reserve space in the hash table.
6078 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
6080 * fileread.cc (File_read::get_mtime): New method.
6081 * fileread.h (Timespec): New structure.
6082 (File_read::get_mtime): New method.
6083 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
6084 Renamed from timestamp_nsec.
6085 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
6087 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
6089 (Incremental_inputs::report_archive): Save mtime; style fix.
6090 (Incremental_inputs::report_obejct): Save mtime; style fix.
6091 (Incremental_inputs::report_script): Save mtime; style fix.
6092 (Incremental_inputs::finalize_inputs): Style fix.
6093 (Incremental_inputs::finalize): Style fix.
6094 (Incremental_inputs::create_input_section_data): Store inputs
6096 * incremental.h (Incremental_inputs::report_script): Add mtime
6098 (Incremental_inputs::Input_info::Input_info): Intialize only one
6100 (Incremental_inputs::Input_info::archive): Move to nameless
6102 (Incremental_inputs::Input_info::obejct): Move to nameless union.
6103 (Incremental_inputs::Input_info::script): Move to nameless union.
6104 (Incremental_inputs::mtime): New field.
6105 * script.cc (read_input_script): Pass file mtime to
6107 * script.h (Script_info::inputs): Style fix.
6109 2009-07-01 Ian Lance Taylor <ian@airs.com>
6111 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
6114 2009-06-24 Ian Lance Taylor <iant@google.com>
6117 * layout.cc (Layout::choose_output_section): If we find an
6118 existing section, update the flags.
6119 (Layout::create_notes): New function, broken out of
6121 (Layout::finalize): Don't create note sections.
6122 (Layout::create_note): Don't crash if linker script discards
6124 (Layout::create_gold_note): Likewise.
6125 (Layout::create_build_id): Likewise. Don't set
6126 after_input_sections on the section.
6127 (Layout::create_executable_stack_info): Remove target parameter.
6129 * layout.h (class Layout): Declare create_notes. Update
6130 declaration of create_executable_stack_info.
6131 * gold.cc (queue_middle_tasks): Call create_notes.
6132 * output.cc (Output_section::update_flags_for_input_section): Move
6133 here from output.h. If SHF_ALLOC flag is newly set, mark address
6135 * output.h (Output_data::mark_address_invalid): New function.
6136 (class Output_section): Only declare, not define,
6137 update_flags_for_input_section. Remove set_flags.
6139 2009-06-24 Ian Lance Taylor <iant@google.com>
6141 * script-sections.cc (Output_section_definition::
6142 set_section_addresses): Rename shadowing local load_address to
6145 2009-06-24 Ian Lance Taylor <iant@google.com>
6148 * reloc.cc (relocate_sections): Skip empty relocation sections.
6150 2009-06-23 Ian Lance Taylor <iant@google.com>
6153 * layout.cc (Layout::create_note): Use choose_output_section
6154 rather than make_output_section.
6156 2009-06-23 Ian Lance Taylor <iant@google.com>
6159 * options.cc (General_options::parse_V): Set printed_version_.
6160 (General_options::General_options): Initialize printed_version_.
6161 * options.h (class General_options): Add printed_version_ field.
6162 * gold.cc (queue_initial_tasks): If there are no input files,
6163 don't give a fatal error if we printed the version information.
6164 (queue_middle_tasks): If using -r with a shared object, give a
6165 fatal error rather than an ordinary error.
6167 2009-06-23 Ian Lance Taylor <iant@google.com>
6170 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
6171 (Layout::make_output_section): Set have_stabstr_section_ if we see
6172 a .stab*str section.
6173 (Layout::finalize): Call link_stabs_sections.
6174 (Layout::link_stabs_sections): New file.
6175 * layout.h (class Layout): Add have_stabstr_section_ field.
6176 Declare link_stabs_sections.
6178 2009-06-23 Doug Kwan <dougkwan@google.com>
6180 * Makefile.am (libgold_a_LIBADD): New.
6181 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
6182 * Makefile.in: Regenerate.
6183 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
6184 * configure: Regenerate.
6185 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
6186 * fileread.cc: Include sys/state.h
6187 * gold.h: Declare memmem and strndup if found missing.
6188 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
6190 2009-06-23 Ian Lance Taylor <iant@google.com>
6192 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
6193 * configure: Rebuild.
6195 2009-06-23 Ian Lance Taylor <iant@google.com>
6198 * object.cc (Object::section_contents): Don't try to get a view if
6199 the section has length zero.
6200 (Object::handle_gnu_warning_section): If the section is empty, use
6201 the name of the section as the warning.
6203 2009-06-23 Ian Lance Taylor <iant@google.com>
6206 * stringpool.h (class Stringpool_template): Add optimize_ field.
6207 (Stringpool_template::set_optimize): New function.
6208 * stringpool.cc (Stringpool_template::Stringpool_template):
6209 Initialize optimize_ field.
6210 (Stringpool_template::set_string_offsets): Test local optimize
6211 fild rather than parameter.
6212 * layout.cc (Layout::Layout): Call set_optimize on the section
6215 2009-06-22 Ian Lance Taylor <iant@google.com>
6218 * yyscript.y: Parse TARGET.
6219 * script.cc (script_set_target): New function.
6220 * script-c.h (script_set_target): Declare.
6221 * options.cc (General_options::string_to_object_format): Rename
6222 from string_to_object_format in anonymous namespace. Change
6224 * options.h (class General_options): Declare
6225 string_to_object_format.
6227 2009-06-22 Ian Lance Taylor <iant@google.com>
6229 * script-sections.cc (Script_sections::create_segments): Don't put
6230 program headers in a PT_LOAD segment if -n or -N.
6232 2009-06-22 Ian Lance Taylor <iant@google.com>
6235 * options.h (class General_options): Add -z lazy and -z now. Sort
6236 -z options into alphabetical order.
6237 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
6239 2009-06-21 Ian Lance Taylor <iant@google.com>
6241 * layout.cc (Layout::make_output_section): Call
6242 Target::new_output_section.
6243 (Layout::attach_allocated_section_to_segment): Put large section
6244 sections in a separate load segment with the large segment flag
6246 (Layout::segment_precedes): Sort large data segments after other
6248 (align_file_offset): New static function.
6249 (Layout::set_segment_offsets): Use align_file_offset.
6250 * output.h (class Output_section): Add is_small_section_ and
6251 is_large_section_ fields.
6252 (Output_section::is_small_section): New function.
6253 (Output_section::set_is_small_section): New function.
6254 (Output_section::is_large_section): New function.
6255 (Output_section::set_is_large_section): New function.
6256 (Output_section::is_large_data_section): New function.
6257 (class Output_segment): Add is_large_data_segment_ field.
6258 (Output_segment::is_large_data_segment): New function.
6259 (Output_segment::set_is_large_data_segment): New function.
6260 * output.cc (Output_section::Output_section): Initialize new
6262 (Output_segment::Output_segment): Likewise.
6263 (Output_segment::add_output_section): Add assertion that large
6264 data sections always go in large data segments. Force small data
6265 sections to the end of the list of data sections. Force small BSS
6266 sections to the start of the list of BSS sections. For large BSS
6267 sections to the end of the list of BSS sections.
6268 * symtab.h (class Symbol): Declare is_common_shndx.
6269 (Symbol::is_defined): Check Symbol::is_common_shndx.
6270 (Symbol::is_common): Likewise.
6271 (class Symbol_table): Define enum Commons_section_type. Update
6272 declarations. Add small_commons_ and large_commons_ fields.
6273 * symtab.cc (Symbol::is_common_shndx): New function.
6274 (Symbol_table::Symbol_table): Initialize new fields.
6275 (Symbol_table::add_from_object): Put small and large common
6276 symbols in the right list.
6277 (Symbol_table::sized_finalized_symbol): Check
6278 Symbol::is_common_shndx.
6279 (Symbol_table::sized_write_globals): Likewise.
6280 * common.cc (Symbol_table::do_allocate_commons): Allocate new
6281 common symbol lists. Don't call do_allocate_commons_list if the
6283 (Symbol_table::do_allocate_commons_list): Remove is_tls
6284 parameter. Add comons_section_type parameter. Change all
6285 callers. Handle small and large common symbols.
6286 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
6287 Symbol::is_common_shndx.
6288 * resolve.cc (symbol_to_bits): Likewise.
6289 * target.h (Target::small_common_shndx): New function.
6290 (Target::small_common_section_flags): New function.
6291 (Target::large_common_shndx): New function.
6292 (Target::large_common_section_flags): New function.
6293 (Target::new_output_section): New function.
6294 (Target::Target_info): Add small_common_shndx, large_common_shndx,
6295 small_common_section_flags, and large_common_section_flags
6297 (Target::do_new_output_section): New virtual function.
6298 * arm.cc (Target_arm::arm_info): Initialize new fields.
6299 * i386.cc (Target_i386::i386_info): Likewise.
6300 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
6302 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
6303 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
6304 (Target_x86_64::do_new_output_section): New function.
6305 * configure.ac: Define conditional MCMODEL_MEDIUM.
6306 * testsuite/Makefile.am (check_PROGRAMS): Add large.
6307 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
6308 (large_LDFLAGS): Define.
6309 * testsuite/large.c: New file.
6310 * testsuite/testfile.cc (Target_test::test_target_info):
6311 Initialize new fields.
6312 * configure, testsuite/Makefile.in: Rebuild.
6314 2009-06-05 Doug Kwan <dougkwan@google.com>
6316 * Makefile.am (CCFILES): Add target.cc.
6317 * Makefile.in: Regenerate.
6318 * i386.cc (class Target_i386): Define new virtual method to
6319 override do_is_local_label_name in parent.
6320 * object.cc (Sized_relobj::do_count_local_symbols): Discard
6321 local symbols if --discard-locals or -X is given.
6322 * options.h (class General_options): Declare new options
6323 '--discard-locals' and '-X' for discarding locals.
6324 * target.h (class Target): Define new methods is_local_label_name.
6325 Declare new virtual method do_is_local_label_name.
6326 * target.cc: New file.
6327 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
6328 (check_SCRIPTS): Add discard_locals_test.sh.
6329 (check_DATA): Add discard_local_tests.syms.
6330 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
6331 (discard_local_tests.syms, discard_locals_test.o): New make rules.
6332 * testsuite/Makefile.in: Regenerate.
6333 * testsuite/discard_locals_test.c: New file.
6334 * testsuite/discard_locals_test.sh: Same.
6336 2009-06-05 Doug Kwan <dougkwan@google.com>
6338 * object.cc (Sized_relobj::Sized_relobj): Initialize
6339 discarded_eh_frame_shndx_ to -1U.
6340 (Sized_relobj::do_layout): Record index of a discard .eh_frame
6342 (Sized_relobj::do_count_local_symbols): Skip local symbols in
6343 a discarded .eh_frame section.
6344 (Sized_relobj::do_finalize_local_symbols): Ditto.
6345 * object.h (class Sized_relobj): Declare new member
6346 discarded_eh_frame_shndx_.
6347 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
6348 (local_labels_test.o, local_labels_test): New rules.
6349 * testsuite/Makefile.in: Regenerate.
6351 2009-06-04 Doug Kwan <dougkwan@google.com>
6353 * layout.cc (Layout::section_name_mapping): Add mapping for
6354 special ARM sections.
6356 2009-06-03 Doug Kwan <dougkwan@google.com>
6358 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
6359 (utils::has_overflow): Same.
6361 2009-06-03 Ian Lance Taylor <iant@google.com>
6363 * layout.cc (Layout::section_name_mapping): New array, replacing
6364 Layout::linkonce_mapping.
6365 (Layout::section_name_mapping_count): New variable, replacing
6366 Layout::linkonce_mapping_count.
6367 (Layout::linkonce_output_name): Remove.
6368 (Layout::output_section_name): Rewrite.
6369 * layout.h (class Layout): Rename Linkonce_mapping to
6370 Section_name_mapping, linkonce_mapping to section_name_mapping,
6371 linkonce_mapping_count to section_name_mapping_count. Don't
6372 declare linkonce_output_name.
6374 2009-06-03 Doug Kwan <dougkwan@google.com>
6376 * gold/arm.cc (namespace utils): New.
6377 (Target_arm::reloc_is_non_pic): Define new method.
6378 (class Arm_relocate_functions): New.
6379 (Target_arm::Relocate::relocate): Handle relocation types used by
6382 2009-06-03 Ian Lance Taylor <iant@google.com>
6384 * arm.cc (Target_arm::scan::global): Use || instead of |.
6386 2009-06-02 Doug Kwan <dougkwan@google.com>
6388 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
6389 issued_non_pic_error_.
6390 (class Target_arm::Scan): Declare new method check_non_pic.
6391 Define new method symbol_needs_plt_entry.
6392 Declare new data member issued_non_pic_error_.
6393 (class Target_arm::Relocate): Declare new method
6394 should_apply_static_reloc.
6395 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
6396 (Target_arm::Scan::check_non_pic): Define new method.
6397 (Target_arm::Scan::local): Handle a small subset of reloc types used
6399 (Target_arm::Scan::local): Same.
6400 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
6402 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
6404 * incremental.cc (Incremental_inputs::report_command_line): Filter
6405 out --incremental-* options.
6407 2009-05-29 Doug Kwan <dougkwan@google.com>
6409 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
6411 (class Target_arm): Update comment.
6412 (Target_arm::Target_arm): Initialize new data members GOT_,
6413 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
6414 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
6415 and Target_arm::rel_dyn_section.
6416 Declare new_enum Target_arm::Got_type.
6417 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
6419 Update commments for member do_dynsym_value.
6420 (Target_arm::got_size, Target_arm::plt_section,
6421 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
6422 new methods inside class defintion.
6423 (Target_arm::got_section): Define new method.
6424 (Target_arm::rel_dyn_section): Same.
6425 (Output_data_plt_arm): New template class.
6426 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
6427 (Output_data_plt_arm:do_adjust_output_section): Define new method.
6428 (Output_data_plt_arm::add_entry): Same.
6429 (Output_data_plt_arm::first_plt_entry): Define new
6430 static data member for PLT instruction template.
6431 (Output_data_plt_arm::plt_entry): Same.
6432 (Output_data_plt_arm::do_write): Define new method.
6433 (Target_arm::make_plt_entry): Same.
6434 (Target_arm::do_finalize_sections): Same.
6435 (Target_arm::do_dynsym_value): Same.
6437 2009-05-28 Doug Kwan <dougkwan@google.com>
6439 * Makefile.am (TARGETSOURCES): Add arm.cc.
6440 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
6441 * Makefile.in: Regenerate.
6443 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
6445 2009-05-26 Doug Kwan <dougkwan@google.com>
6447 * options.cc (General_options::parse_exclude_libs). Fix a comment.
6448 (General_options::check_excluded_libs): Strip off directories in
6449 archive name before matching like GNU ld does.
6450 * testsuite/Makefile.am (MOSTLYCLEANFILES,
6451 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
6452 (exclude_libs_test_LDFLAGS): Add linker option
6453 -Wl,--exclude-libs,libexclude_libs_test_3
6454 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
6455 an explicit archive without using -l.
6456 (alt/libexclude_libs_test_3.a): New make rule.
6457 * testsuite/Makefile.in: Regenerate.
6458 * testsuite/exclude_libs_test.c : Declare lib3_default().
6460 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
6461 * exclude_libs_test_3.c: New file.
6463 2009-05-26 Nick Clifton <nickc@redhat.com>
6465 * po/id.po: New Indonesian translation.
6466 * po/gold.pot: Updated template file.
6468 2009-05-22 Sriraman Tallam <tmsriram@google.com>
6470 * testsuite/Makefile.am: Add -ffunction-sections to compile
6471 gc_comdat_test files. Add -Wl,--gc-sections to build
6473 * testsuite/Makefile.in: Regenerate.
6474 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
6476 2009-05-21 Sriraman Tallam <tmsriram@google.com>
6478 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
6479 kept comdat section was garbage collected.
6480 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
6481 * testsuite/Makefile.in: Regenerate.
6482 * testsuite/gc_comdat_test.sh: New file.
6483 * testsuite/gc_comdat_test_1.cc: New file.
6484 * testsuite/gc_comdat_test_2.cc: New file.
6486 2009-05-19 Doug Kwan <dougkwan@google.com>
6488 * archive.cc (Archive::Archive): Move constructor from archive.h
6489 to here. Initialize no_export_.
6490 (Archive::get_elf_object_for_member): Set no_export flag of object.
6491 * archive.h (Archive::Archive): Move constructor body to
6493 (Archive::no_export): New method.
6494 (Archive::no_export_): New field.
6495 * object.h (Object::Object): Initialize no_export_ to false.
6496 (Object::no_export, Object::set_no_export): New methods.
6497 (Object::no_export_): New field.
6498 * options.cc (General_options::parse_exclude_libs): New method.
6499 (General_options::check_excluded_libs) Same.
6500 * options.h (exclude_libs): New option.
6501 (General_options::check_excluded_libs): New method declaration.
6502 (General_options::excluded_libs_): New field.
6503 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
6504 default or protected visibility if an object has no-export flag set.
6505 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
6506 (check_SCRIPTS): Add exclude_libs_test.sh.
6507 (check_DATA): Add exclude_libs_test.syms.
6508 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
6509 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
6510 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
6511 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
6512 (exclude_libs_test.syms, libexclude_libs_test_1.a,
6513 libexclude_libs_test_2.a): New rules.
6514 * testsuite/Makefile.in: Regenerate.
6515 * testsuite/exclude_libs_test.c: New file.
6516 * testsuite/exclude_libs_test.sh: Ditto.
6517 * testsuite/exclude_libs_test_1.c: Ditto.
6518 * testsuite/exclude_libs_test_2.c: Ditto.
6520 2009-05-15 Ian Lance Taylor <iant@google.com>
6522 * configure.ac: Check for declarations for cases where libiberty.h
6523 checks HAVE_DECL_xxx.
6524 * configure, config.in: Rebuild.
6526 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
6528 * gold.h (Incremental_argument_list): Remove (invalid) forward
6530 * incremental.cc (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::finalize): Call finalize_inputs().
6535 (Incremental_inputs::sized_create_incremental_inputs_section_data):
6536 Create inputs entries.
6537 * incremental.h (Incremental_input_type): New enum.
6538 (Incremental_inputs::Incremental_input): Initialize new fields.
6539 (Incremental_inputs::report_inputs): New method.
6540 (Incremental_inputs::report_achive): New method.
6541 (Incremental_inputs::report_object): New method.
6542 (Incremental_inputs::report_script): New method.
6543 (Incremental_inputs::finalize_inputs): New method.
6544 (Incremental_inputs::Input_info): New struct.
6545 (Incremental_inputs::Input_info_map): New typedef.
6546 (Incremental_inputs::lock_): New field.
6547 (Incremental_inputs::Inputs_): New field.
6548 (Incremental_inputs::Inputs_map): New field.
6549 * main.cc (main): Call Incremental_input::report_inputs.
6550 * options.h (Input_argument_list): Typedef moved from
6552 (Input_file_group::Files): Remove, use ::Input_argument_list.
6553 (Input_file_group::Input_argument_list): Remove, use
6554 ::Input_argument_list.
6555 * plugin.cc (Plugin_manager::add_input_file): Add error in
6557 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
6559 * script.cc (read_input_script): Call
6560 Incremental_input::report_script.
6561 * script.h (Script_info): New class.
6563 2009-04-27 Ian Lance Taylor <iant@google.com>
6565 * x86_64.cc (do_adjust_output_section): Set entsize to
6568 2009-04-23 Elliott Hughes <enh@google.com>
6570 * output.cc (Output_file::close): After short writes, continue
6571 writing from the correct offset in the buffer being written.
6573 2009-04-23 Chris Demetriou <cgd@google.com>
6575 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
6576 * configure: Regenerate.
6577 * config.in: Regenerate.
6578 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
6579 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
6581 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
6583 * incremental.cc (Incremental_inputs_header_data): Renamed from
6584 Incremental_input_header_data.
6585 (Incremental_inputs_header_data::data_size): New field.
6586 (Incremental_inputs_header_data::put_input_file_count): Renamed
6587 from input_file_count.
6588 (Incremental_inputs_header_data::put_command_line_offset): Renamed
6589 from command_line_offset.
6590 (Incremental_inputs_header_data::put_reserved): Renamed from
6592 (Incremental_inputs_entry_data): Renamed from
6593 Incremental_input_entry_data.
6594 (Incremental_inputs_entry_data::data_size): New field.
6595 (Incremental_inputs::report_command_line): New method.
6596 (Incremental_inputs::finalize): New method.
6597 (Incremental_inputs::create_incremental_inputs_data): New method.
6598 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
6599 * incremental.h: New file.
6600 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
6601 (Layout::finalize): Create incremental inputs section in
6603 (Layout::create_incremental_info_sections): New method.
6604 * layout.h (Layout::incremental_inputs): New method.
6605 (Layout::create_incremental_info_sections): New method.
6606 (Layout::incremental_inputs_): New field.
6607 * main.cc (main): Notify Incremental_input of the command line.
6609 2009-04-01 Ian Lance Taylor <iant@google.com>
6610 Mikolaj Zalewski <mikolajz@google.com>
6612 * gold.h (reserve_unordered_map): Define, three versions, one for
6613 each version of Unordered_map.
6614 * layout.cc (Layout::Layout): Remove options parameter. Add
6615 number_of_input_files parameter. Don't initialize options_.
6616 Initialize number_of_input_files_ and resized_signatures_. Move
6617 sections_are_attached_.
6618 (Layout::layout_group): Reserve space for group_signatures_.
6619 (Layout::find_or_add_kept_section): Change name parameter to be a
6620 reference. Resize signatures_ map when it gets large enough.
6621 (Layout::layout_eh_frame): Use parameters->options() instead of
6623 (Layout::make_output_section): Likewise.
6624 (Layout::attach_allocated_section_to_segment): Likewise.
6625 (Layout::finalize, Layout::create_executable_stack): Likewise.
6626 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
6627 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
6628 * layout.h (class Layout): Update declarations. Remove options_
6629 field. Add number_of_input_files_ and resized_signatures_
6630 fields. Move sections_are_attached_ field.
6631 * main.cc (main): Pass number of input files to Layout
6632 constructor. Don't pass options.
6634 2009-03-30 Ian Lance Taylor <iant@google.com>
6636 * ffsll.c (ffsll): Correct implementation.
6638 2009-03-27 Ian Lance Taylor <iant@google.com>
6640 * ffsll.c: New file.
6641 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
6642 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
6643 * ftruncate.c (ftruncate): Declare before definition.
6644 * mremap.c (mremap): Likewise.
6645 * pread.c (pread): Likewise.
6646 * configure, Makefile.in, config.in: Rebuild.
6648 * mremap.c: New file.
6649 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
6650 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
6651 (mremap): Declare if HAVE_MREMAP is not defined.
6652 * configure, Makefile.in, config.in: Rebuild.
6654 2009-03-27 Cary Coutant <ccoutant@google.com>
6656 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
6657 position independent.
6658 * sparc.cc (Target_sparc::check_non_pic): Likewise.
6659 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
6661 2009-03-24 Cary Coutant <ccoutant@google.com>
6663 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
6665 (needs_dynamic_reloc): Likewise.
6667 2009-03-24 Ian Lance Taylor <iant@google.com>
6669 * yyscript.y (file_cmd): Recognize EXTERN.
6670 (extern_name_list, extern_name_list_body): New nonterminals.
6671 * script.cc (script_add_extern): Define.
6672 * script-c.h (script_add_extern): Declare.
6674 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
6676 * object.cc (is_elf_object): Define.
6677 * object.h (is_elf_object): Declare.
6678 * archive.cc (Archive::get_elf_object_for_member): Call
6680 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
6682 2009-03-24 Elliott Hughes <enh@google.com>
6684 * output.cc (Output_file::map_anonymous): Define.
6685 (Output_file::map): Use map_anonymous. If the regular mmap fails,
6686 try an anonymous one. Report the size if the mmap fails.
6687 * output.h (class Output_file): Declare map_anonymous.
6689 2009-03-24 Ian Lance Taylor <iant@google.com>
6691 * target-select.cc (instantiate_target): Don't acquire the lock if
6692 the instantiated_target_ field has already been set.
6694 2009-03-23 Ian Lance Taylor <iant@google.com>
6696 * gold-threads.h (class Initialize_lock): Define.
6697 * gold-threads.cc (class Initialize_lock_once): Define.
6698 (initialize_lock_control): New static variable.
6699 (initialize_lock_pointer): New static variable.
6700 (initialize_lock_once): New static function.
6701 (Initialize_lock::Initialize_lock): Define.
6702 (Initialize_lock::initialize): Define.
6703 * target-select.h: Include "gold-threads.h".
6704 (class Target_selector): Add lock_ and initialize_lock_ fields.
6705 Don't define instantiate_target, just declare it.
6706 * target-select.cc (Target_selector::Target_selector): Initialize
6708 (Target_selector::instantiate_target): Define.
6709 * descriptors.h: Include "gold-threads.h".
6710 (class Descriptors): Add initialize_lock_ field.
6711 * descriptors.cc (Descriptors::Descriptors): Initialize new
6713 (Descriptors::open): Use initialize_lock_ field
6714 * errors.h (class Errors): Add initialize_lock_ field.
6715 * errors.cc (Errors::Errors): Initialize new field.
6716 (Errors::initialize_lock): Use initialize_lock_ field.
6717 * powerpc.cc (class Target_selector_powerpc): Remove
6718 instantiated_target_ field. In do_recognize call
6719 instantiate_target rather than do_instantiate_target. In
6720 do_instantiate_target just allocate a new target.
6721 * sparc.cc (class Target_selector_sparc): Likewise.
6723 * freebsd.h: New file.
6724 * i386.cc: Include "freebsd.h".
6725 (Target_i386): Derive from Target_freebsd rather than
6727 (Target_selector_i386): Derive from Target_selector_freebsd rather
6728 than Target_selector.
6729 * x86_64.cc: Include "freebsd.h".
6730 (Target_x86_64): Derive from Target_freebsd rather than
6732 (Target_selector_x86_64): Derive from Target_selector_freebsd
6733 rather than Target_selector.
6734 * target.h (class Target): Add adjust_elf_header and
6735 do_adjust_elf_header.
6736 * output.cc (Output_file_header:: do_sized_write): Call target
6737 adjust_elf_header routine.
6738 * configure.tgt: Set targ_osabi.
6739 * configure.ac: Define GOLD_DEFAULT_OSABI.
6740 * parameters.cc (Parameters::default_target): Pass
6741 GOLD_DEFAULT_OSABI to select_target.
6742 * target-select.h (class Target_selector): Make instantiate_target
6743 protected rather than private.
6744 * Makefile.am (HFILES): Add freebsd.h.
6745 * configure, Makefile.in, config.in: Rebuild.
6747 * merge.cc (do_add_input_section): Correct pend value. Change
6748 message about last entry not being null terminated from error to
6751 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
6753 * incremental.cc: New file.
6754 * Makefile.am (CCFILES): Add incremental.cc.
6755 * Makefile.in: Rebuild.
6757 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
6759 * layout.cc (Layout::output_section_name): Preserve names
6760 of '.note.' sections.
6762 2009-03-19 Ian Lance Taylor <iant@google.com>
6764 * descriptors.cc (Descriptors::open): Check that the options are
6765 valid before using them.
6767 2009-03-18 Ian Lance Taylor <iant@google.com>
6769 * script-sections.h: Include <list>.
6770 (class Script_sections): Change Sections_elements from std::vector
6771 to std::list. Typedef public Elements_iterator. Add
6772 orphan_section_placement_, data_segment_align_start_, and
6773 saw_data_segment_align_ fields. Remove data_segment_align_index_
6775 * script-sections.cc (class Orphan_section_placement): New class.
6776 (class Sections_element): Add virtual functions is_relro and
6777 orphan_section_init. Remove virtual function place_orphan_here.
6778 (class Output_section_definition): Add is_relro and
6779 orphan_section_init. Remove place_orphan_here.
6780 (class Orphan_output_section): Likewise.
6781 (Script_sections::Script_sections): Update for field changes.
6782 (Script_sections::data_segment_align): Set saw_data_segment_align_
6783 and data_segment_align_start_, not data_segment_align_index.
6784 (Script_sections::data_segment_relro_end): Check
6785 saw_data_segment_align_. Use data_segment_align_start_ rather
6786 than data_segment_align_index_.
6787 (Script_sections::place_orphan): Rewrite to use
6788 Orphan_section_placement.
6790 2009-03-17 Ian Lance Taylor <iant@google.com>
6792 * archive.cc (Archive::add_symbols): Check for a version attached
6793 to the symbol name in the archive map.
6794 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
6795 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
6796 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
6797 (ver_test_11.a): New target.
6798 * testsuite/Makefile.in: Rebuild.
6800 * configure.ac: Check for chsize and posix_fallocate. Replace
6802 * ftruncate.c: New file, from gnulib.
6803 * output.cc (posix_fallocate): Define dummy version if not
6804 HAVE_POSIX_FALLOCATE.
6805 (Output_file::map): Call posix_fallocate rather than lseek and
6807 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
6808 * configure, Makefile.in, config.in: Rebuild.
6810 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
6812 * layout.h (Layout::create_note): Add section_name parameter.
6813 * layout.cc (Layout::create_note): Likewise.
6814 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
6816 2009-03-17 Ian Lance Taylor <iant@google.com>
6818 * descriptors.cc: Include "options.h".
6819 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
6820 (Descriptors::open): Always use O_CLOEXEC when opening a new
6821 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
6822 then set FD_CLOEXEC.
6824 * sparc.cc (class Target_sparc): Add has_got_section.
6825 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
6826 make sure we have a GOT section.
6828 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
6829 (Target_sparc::Scan::local): Likewise.
6830 (Target_sparc::Scan::global): Likewise.
6831 (Target_sparc::Relocate::relocate): Likewise.
6832 (Target_sparc::Relocate::relocate_tls): Likewise.
6834 * symtab.cc (Symbol_table::define_default_version): New function,
6835 broken out of add_from_object.
6836 (Symbol_table::add_from_object): Call define_default_version.
6837 (Symbol_table::define_special_symbol): Add resolve_oldsym
6838 parameter. Change all callers. If the version for a symbol comes
6839 from a version script, resolve it with the symbol with the same
6840 name with no version. Also add the symbol without a version if
6842 (do_define_in_output_data): If resolving with oldsym, don't delete
6844 (do_define_in_output_segment): Likewise.
6845 (do_define_as_constant): Likewise.
6846 * symtab.h (class Symbol_table): Update declarations.
6848 2009-03-13 Ian Lance Taylor <iant@google.com>
6850 * readsyms.cc (Read_symbols::incompatible_warning): New function.
6851 (Read_symbols::requeue): New function.
6852 (Read_symbols::do_read_symbols): If make_elf_object fails because
6853 the target type is not configured, and the file was searched for,
6854 issue a warning and retry with the next directory.
6855 (Add_symbols::run): If the file has an incompatible format, and
6856 it was searched for, requeue the Read_symbols task. On error,
6858 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
6859 dirindex parameter to constructor. Change all callers. Declare
6860 incompatible_warning and requeue.
6861 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
6862 input_argument_ and input_group_ fields. Add them to
6863 constructor. Change all callers.
6864 (class Read_script): Add dirindex_ field. Add it to constructor.
6866 * archive.cc (Archive::setup): Remove input_objects parameter.
6868 (Archive::get_file_and_offset): Likewise.
6869 (Archive::read_all_symbols): Likewise.
6870 (Archive::read_symbols): Likewise.
6871 (Archive::get_elf_object_for_member): Remove input_objects
6872 parameter. Add punconfigured parameter. Change all callers.
6873 (Archive::add_symbols): Change return type to bool. Check return
6874 value of include_member.
6875 (Archive::include_all_members): Likewise.
6876 (Archive::include_member): Change return type to bool. Return
6877 false if first included object has incompatible target. Set
6878 included_member_ field.
6879 (Add_archive_symbols::run): If add_symbols returns false, requeue
6881 * archive.h (class Archive): Add included_member_ field.
6882 Initialize it in constructor. Add input_file and searched_for
6883 methods. Update declarations.
6884 (class Add_archive_symbols): Add dirpath_, dirindex_, and
6885 input_argument_ fields. Add them to constructor. Change all
6887 * script.cc: Include "target-select.h".
6888 (class Parser_closure): Add skip_on_incompatible_target_ and
6889 found_incompatible_target_ fields. Add
6890 skip_on_incompatible_target parameter to constructor. Change all
6891 callers. Add methods skip_on_incompatible_target,
6892 clear_skip_on_incompatible_target, found_incompatible_target, and
6893 set_found_incompatible_target.
6894 (read_input_script): Add dirindex parameter. Change all callers.
6895 If parser finds an incompatible target, requeue Read_symbols
6897 (script_set_symbol): Clear skip_on_incompatible_target in
6899 (script_add_assertion, script_parse_option): Likewise.
6900 (script_start_sections, script_add_phdr): Likewise.
6901 (script_check_output_format): New function.
6902 * script.h (read_input_script): Update declaration.
6903 * script-c.h (script_check_output_format): Declare.
6904 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
6905 (ignore_cmd): Remove OUTPUT_FORMAT.
6906 * fileread.cc (Input_file::Input_file): Add explicit this.
6907 (Input_file::will_search_for): New function.
6908 (Input_file::open): Add pindex parameter. Change all callers.
6909 * fileread.h (class Input_file): Add input_file_argument method.
6910 Declare will_search_for. Update declarations.
6911 * object.cc (make_elf_object): Add punconfigured parameter.
6913 * object.h (class Object): Make input_file public. Add
6914 searched_for method.
6915 (make_elf_object): Update declaration.
6916 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
6918 * dirsearch.h (class Dirsearch): Update declaration.
6919 * options.h (class General_options): Add --warn-search-mismatch.
6920 * parameters.cc (Parameters::is_compatible_target): New function.
6921 * parameters.h (class Parameters): Declare is_compatible_target.
6922 * workqueue.cc (Workqueue::add_blocker): New function.
6923 * workqueue.h (class Workqueue): Declare add_blocker.
6925 * fileread.cc (Input_file::open): Remove options parameter.
6927 (Input_file::open_binary): Likewise.
6928 * script.cc (read_input_script): Likewise.
6929 * readsyms.h (class Read_symbols): Remove options_ field. Remove
6930 options parameter from constructor. Change all callers.
6931 (class Read_script): Likewise.
6932 * fileread.h (class Input_file): Update declarations.
6933 * script.h (read_input_script): Update declaration.
6935 2009-03-10 Nick Clifton <nickc@redhat.com>
6937 * po/es.po: New Spanish translation.
6939 2009-03-06 Cary Coutant <ccoutant@google.com>
6941 * options.cc (parse_short_option): Keep dash_z from registering itself.
6943 2009-03-03 Ian Lance Taylor <iant@google.com>
6946 * target-reloc.h (relocate_section): Pass output_section to
6948 * i386.cc (Target_i386::should_apply_static_reloc): Add
6949 output_section parameter. Change all callers.
6950 (Target_i386::Relocate::relocate): Add output_section parameter.
6951 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
6952 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
6953 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
6954 * testsuite/two_file_shared.sh: New script.
6955 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
6956 (check_DATA): Add two_file_shared.dbg.
6957 (two_file_shared.dbg): New target.
6958 * testsuite/Makefile.in: Rebuild.
6960 2009-03-01 Ian Lance Taylor <iant@google.com>
6962 * configure.ac: Check for byteswap.h.
6963 * configure: Rebuild.
6964 * config.in: Rebuild.
6966 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
6968 * layout.cc (Layout::find_or_add_kept_section): New function.
6969 (Layout::add_comdat): Removed.
6970 * layout.h (struct Kept_section): Move out of class Layout.
6971 Remove trailing underscores from field names. Add group_sections
6972 field. Rename group_ field to is_group. Change all uses.
6973 (class Layout): Declare find_or_add_kept_section, not add_comdat.
6974 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
6975 comdat_groups_ field.
6976 (Sized_relobj::include_section_group): Use
6977 find_or_add_kept_section and Kept_section::group_sections.
6978 (Sized_relobj::include_linkonce_section): Likewise.
6979 * object.cc (class Sized_relobj): Don't define Comdat_group or
6980 Comdat_group_table. Remove find_comdat_group and
6981 add_comdat_group. Remove comdat_groups_ field.
6982 * plugin.cc (include_comdat_group): Use
6983 Layout::find_or_add_kept_section.
6985 2009-02-28 Ian Lance Taylor <iant@google.com>
6987 * README: --gc-sections and map files are now supported. Document
6988 some build requirements.
6991 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
6992 relocatable link set the value of the section symbol to zero.
6993 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
6994 relocatable link don't include the section address in the local
6997 2009-02-27 Ian Lance Taylor <iant@google.com>
7000 * options.h (class Search_directory): Add is_system_directory.
7001 (class General_options): Declare is_in_system_directory.
7002 * options.cc (get_relative_sysroot): Make static.
7003 (get_default_sysroot): Make static.
7004 (General_optoins::is_in_system_directory): New function.
7005 * fileread.cc (Input_file::is_in_system_directory): New function.
7006 * fileread.h (class Input_file): Declare is_in_system_directory.
7007 * object.h (class Object): Add is_in_system_directory.
7008 (class Input_objects): Remove system_library_directory_ field.
7009 * object.cc (Input_objects::add_object): Don't set
7010 system_library_directory_.
7011 (input_objects::found_in_system_library_directory): Remove.
7012 * symtab.cc (Symbol_table::write_globals): Remove input_objects
7013 parameter. Change all callers.
7014 (Symbol_table::sized_write_globals): Likewise.
7015 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
7016 Call Object::is_in_system_directory.
7017 * symtab.h (class Symbol_table): Update declarations.
7020 * descriptors.h (Open_descriptor): Add is_on_stack field.
7021 * descriptors.cc (Descriptors::open): If the descriptor is on the
7022 top of the stack, remove it. Initialize is_on_stack field.
7023 (Descriptors::release): Only add pod to stack if it is not on the
7025 (Descriptors::close_some_descriptor): Clear stack_next and
7029 * output.cc (Output_section::find_starting_output_address): Rename
7030 from starting_output_address; add PADDR parameter; change return
7032 * output.h (class Output_section): Declare
7033 find_starting_output_address instead of starting_output_address.
7034 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
7035 section symbol for which we can't find a merge section.
7038 * symtab.cc (Symbol_table::add_from_object): If the visibility is
7039 hidden or internal, force the symbol to be local.
7040 * resolve.cc (Symbol::override_visibility): Define.
7041 (Symbol::override_base): Use override_visibility.
7042 (Symbol_table::resolve): Likewise.
7043 (Symbol::override_base_with_special): Likewise.
7044 (Symbol_table::override_with_special): If the visibility is hidden
7045 or internal, force the symbol to be local.
7046 * symtab.h (class Symbol): Add set_visibility and
7047 override_visibility.
7048 * testsuite/ver_test_1.sh: New file.
7049 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
7050 (check_DATA): Add ver_test_1.syms.
7051 (ver_test_1.syms): New target.
7052 * testsuite/Makefile.in: Rebuild.
7054 2009-02-25 Cary Coutant <ccoutant@google.com>
7056 * layout.cc (Layout::choose_output_section): Don't rename sections
7057 when using a linker script that has a SECTIONS clause.
7058 * Makefile.in: Regenerate.
7060 * testsuite/Makefile.am (script_test_5.sh): New test case.
7061 * testsuite/Makefile.in: Regenerate.
7062 * testsuite/script_test_5.cc: New file.
7063 * testsuite/script_test_5.sh: New file.
7064 * testsuite/script_test_5.t: New file.
7066 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
7068 * archive.cc (Archive::include_member): Update calls to add_symbols.
7069 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
7070 the Layout argument.
7071 * dynobj.h (do_add_symbols): Add the Layout argument.
7072 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
7074 * object.h (Object::add_symbols): Add the Layout argument.
7075 (Object::do_add_symbols): Add the Layout argument.
7076 (Sized_relobj::do_add_symbols): Add the Layout argument.
7077 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
7078 Unify the two versions.
7079 (Add_plugin_symbols): Remove.
7080 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
7081 (Sized_pluginobj::do_add_symbols): Unify the two versions.
7082 (Add_plugin_symbols): Remove.
7083 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
7084 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
7085 (Add_symbols::run): Make it work with Pulginobj.
7087 2009-02-06 Ian Lance Taylor <iant@google.com>
7089 * object.cc (Sized_relobj::do_layout): Make info message start
7090 with lower case letter.
7092 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
7094 * binary.cc: Fix file comment.
7096 * options.h (enum Incremental_disposition): Define.
7097 (class General_options): Add new options: --incremental,
7098 --incremental_changed, --incremental_unchanged,
7099 --incremental_unknown. Add incremental_disposition_ and
7100 implicit_incremental_ fields.
7101 (General_options::incremental_disposition): New function.
7102 (class Position_dependent_options): Add incremental_disposition
7104 (Position_dependent_options::copy_from_options): Set incremental
7106 * options.cc (General_options::parse_incremental_changed): New
7108 (General_options::parse_incremental_unchanged): New function.
7109 (General_options::parse_incremental_unknown): New function.
7110 (General_options::General_options): Initialize new fields
7111 incremental_disposition_ and implicit_incremental_.
7112 (General_options::finalize): Check for uasge of --incremental-*
7113 without --incremental.
7115 2009-02-06 Chris Demetriou <cgd@google.com>
7117 * gold.h (gold_undefined_symbol): Change to take only a Symbol
7118 pointer and to report location as the file name associated with
7120 (gold_undefined_symbol_at_location): New function to replace the
7121 old gold_undefined_symbol functionality.
7122 * target-reloc.h (relocate_section): Update to use
7123 gold_undefined_symbol_at_location.
7124 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
7125 Call gold_undefined_symbol function rather than gold_error.
7126 * errors.h (Errors::undefined_symbol): Take location as a
7127 string, rather than calculating it from a relocation.
7128 * errors.cc (Errors::fatal): Print "fatal error:" before the
7130 (Errors::error, Errors::error_at_location): Print "error: "
7131 before the formatted message.
7132 (Errors::undefined_symbol): Take location as a string, rather
7133 than calculating it from a relocation.
7134 (gold_undefined_symbol_at_location): New function akin to
7135 old gold_undefined_symbol, calculates location from relocation.
7136 (gold_undefined_symbol): Change to take only a Symbol pointer
7137 and to report location as the file name associated with the symbol.
7138 * testsuite/debug_msg.sh: Update for changed error messages.
7139 * testsuite/undef_symbol.sh: Likewise.
7141 2009-02-04 Duncan Sands <baldrick@free.fr>
7144 * reduced_debug_output.h
7145 (Output_reduced_debug_abbrev_section::failed): Use format for
7147 (Output_reduced_debug_info_section::faild): Likewise.
7149 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
7151 * script.cc (Lazy_demangler): New class.
7152 (Version_script_info::get_symbol_version_helper): Demangle a
7155 2009-01-29 Cary Coutant <ccoutant@google.com>
7157 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
7159 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
7161 2009-01-28 Ian Lance Taylor <iant@google.com>
7163 * version.cc (version_string): Bump to 1.9.
7165 * gold.h: Include <cstring> and <stdint.h>.
7166 * version.cc: Include <cstdio>.
7167 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
7169 * reduced_debug_output.cc (insert_into_vector): Rename from
7170 Insert_into_vector; change all callers. Use Swap_unaligned to
7171 avoid aliasing issue; remove union since it is unnecessary.
7173 2009-01-27 Sriraman Tallam <tmsriram@google.com>
7175 * Makefile.am (CCFILES): Add gc.cc.
7177 * Makefile.in: Regenerate.
7178 * gold.cc (Gc_runner): New class.
7179 (queue_initial_tasks): Call garbage collection related tasks
7180 when corresponding options are invoked.
7181 (queue_middle_gc_tasks): New function.
7182 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
7183 processed early before laying out sections during garbage collection.
7184 * gold.h (queue_middle_gc_tasks): New function.
7185 (is_prefix_of): Move from "layout.cc".
7186 * i386.cc (Target_i386::gc_process_relocs): New function.
7187 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
7188 * main.cc (main): Create object of class "Garbage_collection".
7189 * object.cc (Relobj::copy_symbols_data): New function.
7190 (Relobj::is_section_name_included): New function.
7191 (Sized_relobj::do_layout): Allow this function to be called twice
7192 during garbage collection and defer layout of section during the
7194 * object.h (Relobj::get_symbols_data): New function.
7195 (Relobj::is_section_name_included): New function.
7196 (Relobj::copy_symbols_data): New function.
7197 (Relobj::set_symbols_data): New function.
7198 (Relobj::get_relocs_data): New function.
7199 (Relobj::set_relocs_data): New function.
7200 (Relobj::is_output_section_offset_invalid): New pure virtual function.
7201 (Relobj::gc_process_relocs): New function.
7202 (Relobj::do_gc_process_relocs): New pure virtual function.
7203 (Relobj::sd_): New data member.
7204 (Sized_relobj::is_output_section_offset_invalid): New function.
7205 (Sized_relobj::do_gc_process_relocs): New function.
7206 * options.h (General_options::gc_sections): Modify to not be a no-op.
7207 (General_options::print_gc_sections): New option.
7208 * plugin.cc (Plugin_finish::run): Remove function call to
7209 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
7210 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
7211 * reloc.cc (Read_relocs::run): Add task to process relocs and
7212 determine unreferenced sections when doing garbage collection.
7213 (Gc_process_relocs): New class.
7214 (Sized_relobj::do_gc_process_relocs): New function.
7215 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
7216 sections that are garbage collected.
7217 * reloc.h (Gc_process_relocs): New class.
7218 * sparc.cc (Target_sparc::gc_process_relocs): New function.
7219 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
7220 symbols whose corresponding sections are garbage collected.
7221 (Symbol_table::Symbol_table): Add new parameter for the garbage
7223 (Symbol_table::gc_mark_undef_symbols): New function.
7224 (Symbol_table::gc_mark_symbol_for_shlib): New function.
7225 (Symbol_table::gc_mark_dyn_syms): New function.
7226 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
7228 (Symbol_table::add_from_object): Likewise.
7229 (Symbol_table::add_from_relobj): When building shared objects, do not
7230 treat externally visible symbols as garbage.
7231 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
7232 table information for static and relocatable links.
7233 * symtab.h (Symbol_table::set_gc): New function.
7234 (Symbol_table::gc): New function.
7235 (Symbol_table::gc_mark_undef_symbols): New function.
7236 (Symbol_table::gc_mark_symbol_for_shlib): New function.
7237 (Symbol_table::gc_mark_dyn_syms): New function.
7238 (Symbol_table::gc_): New data member.
7239 * target.h (Sized_target::gc_process_relocs): New pure virtual
7241 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
7242 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
7244 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
7246 * options.h (General_options::gc_sections): Define as a no-op for now.
7247 (General_options::no_keep_memory): Ditto.
7248 (General_options::Bshareable): Define.
7249 * options.cc (General_options::finalize): Honor -Bshareable.
7251 2009-01-20 Andreas Schwab <schwab@suse.de>
7253 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
7254 read the value in the contents, since we don't use it. Use the
7255 template endianness when writing.
7256 (Relocate::relocate): Use it for R_PPC_REL16_HA.
7258 2009-01-19 Andreas Schwab <schwab@suse.de>
7260 * configure.tgt (powerpc64-*): Fix targ_obj.
7262 2009-01-15 Ian Lance Taylor <iant@google.com>
7264 * object.cc (Sized_relobj::write_local_symbols): Don't write out
7265 local symbols when stripping all symbols.
7267 2009-01-14 Cary Coutant <ccoutant@google.com>
7269 * output.cc (Output_reloc): Add explicit instantiations.
7271 2009-01-14 Cary Coutant <ccoutant@google.com>
7273 * archive.cc (Archive::get_elf_object_for_member): Remove call
7274 to File_read::claim_for_plugin.
7275 * descriptors.cc (Descriptors::open): Remove reference to
7277 (Descriptors::claim_for_plugin): Remove.
7278 * descriptors.h (Descriptors::claim_for_plugin): Remove.
7279 (Descriptors::is_claimed): Remove.
7280 (claim_descriptor_for_plugin): Remove.
7281 * fileread.cc (File_read::claim_for_plugin): Remove.
7282 * fileread.h (File_read::claim_for_plugin): Remove.
7283 (File_read::descriptor): Reopen descriptor if necessary.
7284 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
7285 (Plugin_manager::all_symbols_read): Add task parameter. Change
7287 (Plugin_manager::get_input_file): New function.
7288 (Plugin_manager::release_input_file): New function.
7289 (Pluginobj::Pluginobj): Add filesize parameter and initialize
7290 corresponding data member.
7291 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
7292 and pass to base constructor. Change all callers.
7293 (get_input_file, release_input_file): New functions.
7294 (make_sized_plugin_object): Add filesize parameter. Change all callers.
7295 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
7296 (Plugin_manager::all_symbols_read): Add task parameter.
7297 (Plugin_manager::get_input_file): New function.
7298 (Plugin_manager::release_input_file): New function.
7299 (Plugin_manager::task_): New data member.
7300 (Pluginobj::Pluginobj): Add filesize parameter.
7301 (Pluginobj::filename): New function.
7302 (Pluginobj::descriptor): New function.
7303 (Pluginobj::filesize): New function.
7304 (Pluginobj::filesize_): New data member.
7305 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
7306 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
7307 File_read::claim_for_plugin; use Object::unlock to unlock the file.
7309 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
7310 with archive libraries.
7311 * testsuite/Makefile.in: Regenerate.
7312 * testsuite/plugin_test.c (struct sym_info): New type.
7313 (get_input_file, release_input_file): New static variables.
7314 (onload): Capture new transfer vector entries.
7315 (claim_file_hook): Stop reading at end of file according to filesize.
7316 Factor out parsing of readelf output into separate function.
7317 (all_symbols_read_hook): Exercise get_input_file and release_input_file
7318 APIs and get the source file name from the symbol table. Convert
7319 source file name to corresponding object file name. Print info
7320 message when adding new input files.
7321 (parse_readelf_line): New function.
7322 * testsuite/plugin_test_1.sh: Add checks for new info messages.
7323 * testsuite/plugin_test_2.sh: Likewise.
7324 * testsuite/plugin_test_3.sh: Likewise.
7325 * testsuite/plugin_test_4.sh: New test case.
7327 2009-01-07 Ian Lance Taylor <iant@google.com>
7329 * version.cc (version_string): Bump to 1.8.
7331 2008-12-23 Cary Coutant <ccoutant@google.com>
7333 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
7334 * plugin.cc (Plugin_manager::finish): Rename as
7335 layout_deferred_objects. Move cleanup to separate function.
7336 (Plugin_manager::cleanup): New function.
7337 (Plugin_finish::run): Call layout_deferred_objects and cleanup
7339 * plugin.h (Plugin_manager::finish): Rename as
7340 layout_deferred_objects.
7341 (Plugin_manager::cleanup): New function.
7342 (Plugin_manager::cleanup_done): New field.
7344 2008-12-23 Cary Coutant <ccoutant@google.com>
7346 * plugin.cc (is_visible_from_outside): New function.
7347 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
7348 so we don't return "IR only" status for exported symbols or -r links.
7350 * testsuite/Makefile.am (plugin_test_3): New test case.
7351 * testsuite/Makefile.in: Regenerate.
7352 * testsuite/plugin_test_3.sh: New file.
7354 2008-12-22 Cary Coutant <ccoutant@google.com>
7356 * object.cc (Sized_relobj::layout_section): New function.
7357 (Sized_relobj::do_layout): Defer layout of input sections until after
7358 plugin has provided replacement files.
7359 (Sized_relobj::do_layout_deferred_sections): New function.
7360 * object.h (Relobj::set_section_offset): Remove virtual keyword.
7361 (Relobj::layout_deferred_sections): New function.
7362 (Relobj::do_layout_deferred_sections): New function.
7363 (Sized_relobj::do_layout_deferred_sections): New function.
7364 (Sized_relobj::layout_section): New function.
7365 (Sized_relobj::Deferred_layout): New structure.
7366 (Sized_relobj::deferred_layout_): New field.
7367 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
7368 Change all callers. Layout deferred sections.
7369 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
7371 (Plugin_hook::run): Move code from do_plugin_hook inline.
7372 (Plugin_hook::do_plugin_hook): Remove.
7373 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
7374 (Plugin_manager::finish): Renamed, was cleanup.
7375 (Plugin_manager::should_defer_layout): New function.
7376 (Plugin_manager::add_deferred_layout_object): New function.
7377 (Plugin_manager::Deferred_layout_list): New type.
7378 (Plugin_manager::deferred_layout_objects_): New field.
7379 (Plugin_hook::do_plugin_hook): Remove.
7381 2008-12-17 Ian Lance Taylor <iant@google.com>
7383 * options.h (class General_options): Add --no case for
7386 2008-12-16 Cary Coutant <ccoutant@google.com>
7388 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
7390 (Plugin_manager::claim_file): Create plugin object even if
7391 plugin did not call the add_symbols callback.
7392 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
7393 asking for more symbols than were added.
7394 * testsuite/Makefile.am (plugin_test_1): Add test case with
7396 (empty.syms): New target.
7397 * testsuite/Makefile.in: Regenerate.
7398 * testsuite/plugin_test.c (claim_file_hook): Add new debug
7399 message. Don't call add_symbols if no globals.
7400 (all_symbols_read_hook): Don't provide replacement for empty
7403 2008-12-12 Ian Lance Taylor <iant@google.com>
7405 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
7406 r_type == 0 for a local symbol with r_sym == 0.
7407 (scan_relocatable_relocs): Pass r_sym to
7408 local_non_section_strategy.
7409 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
7412 * configure.ac: Update test for TLS descriptors: they are
7413 supported as of glibc 2.9.
7414 * configure: Rebuild.
7416 2008-12-11 Ian Lance Taylor <iant@google.com>
7419 * target-reloc.h (Default_scan_relocatable_relocs): For each
7420 function, map r_type == 0 to RELOC_DISCARD.
7422 2008-12-10 Cary Coutant <ccoutant@google.com>
7424 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
7425 object to override a kept COMDAT group from a plugin object.
7427 2008-12-09 Ian Lance Taylor <iant@google.com>
7430 * yyscript.y (file_cmd): Handle INPUT.
7432 * testsuite/initpri1.c: Change all declarations to be full
7433 prototypes by adding void, to avoid compiler warnings.
7435 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
7437 * options.cc (General_options::parse_plugin_opt): New.
7438 (General_options::add_plugin): The argument now is just the filename.
7439 (General_options::add_plugin_option): New.
7440 * options.h (plugin_opt): New.
7441 (add_plugin): Change argument name.
7442 (add_plugin_option): New.
7443 * plugin.cc (Plugin::load): Don't parse the plugin option.
7444 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
7445 (Plugin::add_option): New.
7446 (Plugin::args_): Change type.
7447 (Plugin::filename_): New.
7448 (Plugin_manager::add_plugin_option): New.
7449 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
7450 * testsuite/Makefile.in: Regenerate.
7452 2008-12-05 Cary Coutant <ccoutant@google.com>
7454 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
7455 Handle --strip-lto-sections option.
7456 * options.h (strip_lto_sections): New option.
7458 2008-12-01 Cary Coutant <ccoutant@google.com>
7460 * plugin.cc (ld_plugin_message): Change format parameter to const.
7461 Fix mismatch between new[] and delete.
7463 2008-11-14 Cary Coutant <ccoutant@google.com>
7465 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
7468 2008-11-05 Craig Silverstein <csilvers@google.com>
7470 * options.cc (General_options::parse_dynamic_list): New function.
7471 * options.h (General_options): New flags dynamic_list,
7472 dynamic_list_data, dynamic_list_cpp_new, and
7473 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
7474 (General_options::in_dynamic_list): New function.
7475 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
7476 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
7477 (Lex::can_continue_name): Likewise.
7479 (read_script_file): New parameter script_options.
7480 (read_dynamic_list): New function.
7481 (Script_options::define_dynamic_list): New function.
7482 (dynamic_list_keyword_parsecodes): New variable.
7483 (dynamic_list_keywords): New variable.
7484 * script.h (Script_options::define_dynamic_list): New function
7486 (read_dynamic_list): New function prototype.
7487 * symtab.cc (strprefix): New macro.
7488 (Symbol::should_add_dynsym_entry): Support dynamic_list,
7489 dynamic_list_data, dynamic_list_cpp_new, and
7490 dynamic_list_cpp_typeinfo.
7491 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
7492 (dynamic_list_expr): New rule.
7493 (dynamic_list_nodes): Likewise.
7494 (dynamic_list_node): Likewise.
7495 * testsuite/Makefile.am (dynamic_list): New test.
7496 * testsuite/Makefile.in: Regenerated.
7497 * testsuite/dynamic_list.t: New file.
7498 * testsuite/dynamic_list.sh: New file.
7500 2008-11-05 Craig Silverstein <csilvers@google.com>
7502 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
7503 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
7504 (t11_last): Likewise.
7505 * testsuite/ver_test_6.c (main): Likewise.
7507 2008-10-07 Cary Coutant <ccoutant@google.com>
7509 * options.c (General_options::finalize): Add check for -static and
7511 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
7514 2008-10-02 Cary Coutant <ccoutant@google.com>
7516 * plugin.cc (make_sized_plugin_object): Fix conditional
7517 compilation to work when not all targets are enabled.
7519 2008-09-29 Cary Coutant <ccoutant@google.com>
7521 * archive.cc (Archive::get_file_and_offset): Use filename instead
7522 of name to get library path.
7523 (Archive::include_member): Unlock external member of a thin archive.
7525 * testsuite/Makefile.am (TEST_AR): New variable.
7526 (thin_archive_test_1): New test.
7527 (thin_archive_test_2): New test.
7528 * testsuite/Makefile.in: Regenerate.
7529 * testsuite/thin_archive_main.cc: New file.
7530 * testsuite/thin_archive_test_1.cc: New file.
7531 * testsuite/thin_archive_test_2.cc: New file.
7532 * testsuite/thin_archive_test_3.cc: New file.
7533 * testsuite/thin_archive_test_4.cc: New file.
7535 2008-09-29 Cary Coutant <ccoutant@google.com>
7537 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
7538 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
7540 (Sized_relobj::do_finalize_local_symbols): Likewise.
7541 (Sized_relobj::map_to_kept_section): Likewise.
7542 * object.h (Sized_relobj::invalid_address): New constant.
7543 (Sized_relobj::do_output_section_offset): Check for invalid_address
7545 * output.cc (Output_reloc::local_section_offset): Use constant
7546 invalid_address instead of -1U.
7547 (Output_reloc::get_address): Likewise.
7548 (Output_section::output_address): Change -1U to -1ULL.
7549 * output.h (Output_reloc::invalid_address): New constant.
7550 * reloc.cc (Sized_relobj::write_sections): Use constant
7551 invalid_address instead of -1U.
7552 (Sized_relobj::relocate_sections): Likewise.
7553 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
7554 values for merge sections.
7555 * target-reloc.h (relocate_for_relocatable): Use constant
7556 invalid_address instead of -1U.
7558 2008-09-19 Cary Coutant <ccoutant@google.com>
7560 Add plugin functionality for link-time optimization (LTO).
7561 * configure.ac (plugins): Add --enable-plugins option.
7562 * configure: Regenerate.
7563 * config.in: Regenerate.
7564 * Makefile.am (LIBDL): New variable.
7565 (CCFILES): Add plugin.cc.
7566 (HFILES): Add plugin.h.
7567 (ldadd_var): Add LIBDL.
7568 * Makefile.in: Regenerate.
7570 * archive.cc: Include "plugin.h".
7571 (Archive::setup): Don't preread archive symbols when using a plugin.
7572 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
7573 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
7575 (Archive::include_member): Add symbols from plugin objects.
7576 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
7577 * descriptors.cc (Descriptors::open): Check for file descriptors
7578 abandoned by plugins.
7579 (Descriptors::claim_for_plugin): New function.
7580 * descriptors.h (Descriptors::claim_for_plugin): New function.
7581 (Open_descriptor::is_claimed): New field.
7582 (claim_descriptor_for_plugin): New function.
7583 * fileread.cc (File_read::claim_for_plugin): New function.
7584 * fileread.h (File_read::claim_for_plugin): New function.
7585 (File_read::descriptor): New function.
7586 * gold.cc: Include "plugin.h".
7587 (queue_initial_tasks): Add task to call plugin hooks for generating
7589 * main.cc: Include "plugin.h".
7590 (main): Load plugin libraries.
7591 * object.h (Pluginobj): Declare.
7592 (Object::pluginobj): New function.
7593 (Object::do_pluginobj): New function.
7594 (Object::set_target): New function.
7595 * options.cc: Include "plugin.h".
7596 (General_options::parse_plugin): New function.
7597 (General_options::General_options): Initialize plugins_ field.
7598 (General_options::add_plugin): New function.
7599 * options.h (Plugin_manager): Declare.
7600 (General_options): Add --plugin option.
7601 (General_options::has_plugins): New function.
7602 (General_options::plugins): New function.
7603 (General_options::add_plugin): New function.
7604 (General_options::plugins_): New field.
7605 * plugin.cc: New file.
7606 * plugin.h: New file.
7607 * readsyms.cc: Include "plugin.h".
7608 (Read_symbols::do_read_symbols): Check for archive before checking
7609 for ELF file. Call plugin hooks to claim files.
7610 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
7611 from a real object file; force override when processing replacement
7613 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
7614 (Symbol::init_base_object): Likewise.
7615 (Symbol::init_base_output_data): Likewise.
7616 (Symbol::init_base_output_segment): Likewise.
7617 (Symbol::init_base_constant): Likewise.
7618 (Symbol::init_base_undefined): Likewise.
7619 (Symbol::output_section): Assert that object is not a plugin.
7620 (Symbol_table::add_from_pluginobj): New function.
7621 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
7623 (Symbol_table::sized_write_globals): Likewise.
7624 (Symbol_table::add_from_pluginobj): Instantiate template.
7625 * symtab.h (Sized_pluginobj): Declare.
7626 (Symbol::in_real_elf): New function.
7627 (Symbol::set_in_real_elf): New function.
7628 (Symbol::in_real_elf_): New field.
7629 (Symbol_table::add_from_pluginobj): New function.
7631 * testsuite/Makefile.am (AM_CFLAGS): New variable.
7632 (LIBDL): New variable.
7634 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
7635 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
7636 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
7637 (MOSTLYCLEANFILES): Likewise.
7638 * testsuite/Makefile.in: Regenerate.
7639 * testsuite/plugin_test.c: New file.
7640 * testsuite/plugin_test_1.sh: New file.
7641 * testsuite/plugin_test_2.sh: New file.
7643 2008-09-16 Ian Lance Taylor <iant@google.com>
7645 * target-reloc.h (relocate_section): Check whether a symbol is
7646 defined by the ABI before reporting an undefined symbol error.
7647 * target.h (Target::is_defined_by_abi): Make parameter const.
7648 (Target::do_is_defined_by_abi): Likewise.
7649 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
7650 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
7651 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
7652 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
7653 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
7654 * testsuite/Makefile.in: Rebuild.
7656 * fileread.cc (make_view): Add casts to avoid warning.
7658 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
7660 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
7661 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
7663 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
7665 * options.h (General_options::output_is_executable): New.
7666 (General_options::output_is_pie): New.
7667 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
7668 for shared libraries.
7669 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
7671 2008-09-11 Chris Demetriou <cgd@google.com>
7673 * options.h (origin): New -z option.
7674 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
7675 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
7678 2008-09-05 Cary Coutant <ccoutant@google.com>
7680 * fileread.cc (File_read::make_view): Add check for attempt to map
7683 2008-09-05 Cary Coutant <ccoutant@google.com>
7685 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
7686 explicit instantiations.
7688 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
7691 * options.cc (General_options::finalize): Allow undefined symbols
7692 in shlibs if linking -shared.
7695 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
7696 symbols as not needing a dynsym entry.
7698 2008-08-20 Craig Silverstein <csilvers@google.com>
7700 * fileread.cc (File_read::open): Do not lock the file unless it
7701 was successfully opened.
7703 2008-08-14 Cary Coutant <ccoutant@google.com>
7705 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
7706 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
7707 * testsuite/tls_test.cc (struct int128): 128-bit struct
7708 for testing TLS relocs with non-zero addend.
7709 (v12): New TLS variable.
7711 (t_last): Add check for v12.
7712 * testsuite/tls_test.h (t12): New function.
7713 * testsuite/tls_test_main.cc (thread_routine): Call new test.
7715 2008-08-13 Ian Lance Taylor <iant@google.com>
7717 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
7718 set tls_segment_ or relro_segment_.
7719 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
7721 * output.h (Output_section::clear_is_relro): New function.
7722 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
7723 sections specially even when output_data_ is empty.
7724 (Output_segment::maximum_alignment): When first section is relro,
7725 only force alignment for PT_LOAD segments.
7726 * script.cc (script_data_segment_align): New function.
7727 (script_data_segment_relro_end): New function.
7728 * script-c.h (script_data_segment_align): Declare.
7729 (script_data_segment_relro_end): Declare.
7730 * script-sections.h (class Script_sections): Declare
7731 data_segment_align and data_segment_relro_end. Add fields
7732 segment_align_index_ and saw_relro_end_.
7733 * script-sections.cc (class Sections_element): Add set_is_relro
7734 virtual function. Add new bool* parameter to place_orphan_here.
7735 Add get_output_section virtual function.
7736 (class Output_section_definition): Add set_is_relro. Add new
7737 bool* parameter to place_orphan_here. Add get_output_section.
7738 Add is_relro_ field.
7739 (Output_section_definition::Output_section_definition): Initialize
7740 evaluated_address_, evaluated_load_address, evaluated_addralign_,
7741 and is_relro_ fields.
7742 (Output_section_definition::place_orphan_here): Add is_relro
7744 (Output_section_definition::set_section_addresses): Set relro for
7746 (Output_section_definition::alternate_constraint): Likewise.
7747 (class Orphan_output_section): Add new bool* parameter to
7748 place_orphan_here. Add get_output_section.
7749 (Orphan_output_section::place_orphan_here): Add is_relro
7751 (Script_sections::Script_sections): Initialize
7752 data_segment_align_index_ and saw_relro_end_.
7753 (Script_sections::data_segment_align): New function.
7754 (Script_sections::data_segment_relro_end): New function.
7755 (Script_sections::place_orphan): Set or clear is_relro.
7756 (Script_sections::set_section_addresses): Force alignment of first
7758 * yyscript.y (exp): Call script_data_segment_align and
7759 script_data_segment_relro_end.
7760 * testsuite/relro_script_test.t: New file.
7761 * testsuite/relro_test.cc (using_script): Declare.
7762 (t1, t2): Test using_script.
7763 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
7764 (relro_script_test_SOURCES): Define.
7765 (relro_script_test_DEPENDENCIES): Define.
7766 (relro_script_test_LDFLAGS): Define.
7767 (relro_script_test_LDADD): Define.
7768 (relro_script_test.so): New target.
7769 * testsuite/Makefile.in: Rebuild.
7771 2008-08-06 Cary Coutant <ccoutant@google.com>
7773 * archive.cc (Archive::total_archives, Archive::total_members)
7774 (Archive::total_members_loaded): New variables.
7775 (Archive::setup): Add parameter. Add option to preread
7777 (Archive::read_armap): Add counter.
7778 (Archive::get_file_and_offset): New function.
7779 (Archive::get_elf_object_for_member): New function.
7780 (Archive::read_all_symbols): New function.
7781 (Archive::read_symbols): New function.
7782 (Archive::add_symbols): Add counters.
7783 (Archive::include_all_members): Use armap to find members if it's
7785 (Archive::include_member): Skip reading symbols if already read.
7786 Factored code into Archive::get_file_and_offset and
7787 Archive::get_elf_object_for_member. Changed call to
7788 Mapfile::report_include_archive_member.
7789 (Archive::print_stats): New function.
7790 * archive.h: Declare Object and Read_symbols_data classes.
7791 (Archive::Archive): Add initializers for new members.
7792 (Archive::setup): Add parameter.
7793 (Archive::print_stats): New function.
7794 (Archive::total_archives, Archive::total_members)
7795 (Archive::total_members_loaded): New variables.
7796 (Archive::get_file_and_offset): New function.
7797 (Archive::get_elf_object_for_member): New function.
7798 (Archive::read_all_symbols): New function.
7799 (Archive::read_symbols): New function.
7800 (Archive::Archive_member): New class.
7801 (Archive::members_): New member.
7802 (Archive::num_members_): New member.
7803 * main.cc: Include archive.h.
7804 (main): Call Archive::print_stats.
7805 * mapfile.cc (Mapfile::report_include_archive_member): Delete
7806 archive parameter; member_name is now the fully-decorated name.
7807 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
7808 * options.h: (General_options): Add --preread-archive-symbols option.
7809 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
7812 2008-08-04 Ian Lance Taylor <iant@google.com>
7814 * symtab.h (Symbol::use_plt_offset): New function.
7815 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
7816 * powerpc.cc (Relocate::relocate): Likewise.
7817 * sparc.cc (Relocate::relocate): Likewise.
7818 * x86_64.cc (Relocate::relocate): Likewise.
7819 * testsuite/weak_plt.sh: New test.
7820 * testsuite/weak_plt_main.cc: New test.
7821 * testsuite/weak_plt_shared.cc: New test.
7822 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
7823 (check_PROGRAMS): Add weak_plt.
7824 (check_DATA): Add weak_plt_shared.so.
7825 (weak_plt_main_pic.o, weak_plt): New targets.
7826 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
7827 * testsuite/Makefile.in: Rebuild.
7829 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
7831 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
7832 * testsuite/Makefile.in: Rebuild.
7834 2008-08-04 Alan Modra <amodra@bigpond.net.au>
7836 * Makefile.am (POTFILES.in): Set LC_ALL=C.
7837 * Makefile.in: Regenerate.
7838 * po/POTFILES.in: Regenerate.
7840 2008-07-29 Ian Lance Taylor <iant@google.com>
7842 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
7843 symbols before other symbols.
7844 * testsuite/script_test_2.cc (test_addr): Declare.
7845 (test_addr_alias): Declare.
7846 (main): Check that test_addr and test_addr_alias have the right
7848 * testsuite/script_test_2.t: Define test_addr_alias and
7851 2008-07-24 Ian Lance Taylor <iant@google.com>
7854 * descriptors.cc: New file.
7855 * descriptors.h: New file.
7856 * gold-threads.h (class Hold_optional_lock): New class.
7857 * fileread.cc: Include "descriptors.h".
7858 (File_read::~File_read): Release descriptor rather than closing
7860 (File_read::open) [file]: Call open_descriptor rather than open.
7861 Set is_descriptor_opened_.
7862 (File_read::open) [memory]: Assert that descriptor is not open.
7863 (File_read::reopen_descriptor): New function.
7864 (File_read::release): Release descriptor.
7865 (File_read::do_read): Make non-const. Reopen descriptor.
7866 (File_read::read): Make non-const.
7867 (File_read::make_view): Reopen descriptor.
7868 (File_read::do_readv): Likewise.
7869 * fileread.h (class File_read): Add is_descriptor_opened_ field.
7870 Update declarations.
7871 * layout.cc: Include "descriptors.h".
7872 (Layout::create_build_id): Use open_descriptor rather than open.
7873 * output.cc: Include "descriptors.h".
7874 (Output_file::open): Use open_descriptor rather than open.
7875 * archive.cc (Archive::const_iterator): Change Archive to be
7877 (Archive::begin, Archive::end): Make non-const.
7878 (Archive::count_members): Likewise.
7879 * archive.h (class Archive): Update declarations.
7880 * object.h (Object::read): Make non-const.
7881 * Makefile.am (CCFILES): Add descriptors.cc.
7882 (HFILES): Add descriptors.h.
7883 * Makefile.in: Rebuild.
7886 * gold.h: Always include <clocale>. Add Solaris workarounds
7887 following code in binutils/sysdep.h.
7890 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
7891 this->eh_frame_hdr_ is NULL before using it.
7893 * dynobj.cc (Versions::Versions): Update comment.
7895 * dynobj.cc (Versions::Versions): If there is an soname, use it as
7896 the base version name.
7898 * stringpool.cc (Stringpool_template::add_with_length): Set key to
7899 array size plus one.
7900 (Stringpool_template::set_string_offsets): Subtract one from key
7901 before using it as an array index.
7902 (Stringpool_template::get_offset_with_length): Likewise.
7903 (Stringpool_template::write_to_buffer): Likewise.
7904 * stringpool.h (Stringpool_template::get_offset_from_key):
7907 2008-07-23 Ian Lance Taylor <iant@google.com>
7910 * object.h (Merged_symbol_value::value): Do our best to handle a
7914 * script.cc (Version_script_info::get_versions): Don't add empty
7915 version tag to return value.
7916 (Version_script_info::get_symbol_version_helper): Change return
7917 type to bool. Add pversion parameter. Change all callers.
7918 (script_register_vers_node): Don't require a non-NULL tag.
7919 * script.h (class Version_script_info): Update declarations.
7920 (Version_script_info::get_symbol_version): Change return type to
7921 bool. Add version parameter. Change all callers.
7922 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
7923 handling. Handle an empty version from a version script.
7924 (Symbol_table::define_special_symbol): Likewise.
7925 * testsuite/ver_test_10.script: New file.
7926 * testsuite/ver_test_10.sh: New file.
7927 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
7928 (check_DATA): Add ver_test_10.syms.
7929 (ver_test_10.syms, ver_test_10.so): New target.
7930 * testsuite/Makefile.in: Rebuild.
7932 2008-07-23 Simon Baldwin <simonb@google.com>
7934 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
7935 to zero for undefined symbols from dynamic libraries.
7937 2008-07-23 Ian Lance Taylor <iant@google.com>
7939 * symtab.cc (Symbol_table::resolve): Remove version parameter.
7941 * symtab.h (class Symbol_table): Update declaration.
7942 * testsuite/ver_test_9.cc: New file.
7943 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
7944 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
7945 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
7946 (ver_test_9.so, ver_test_9.o): New targets.
7947 * testsuite/Makefile.in: Rebuild.
7949 2008-07-22 Ian Lance Taylor <iant@google.com>
7951 * options.h (class General_options): Define --check-sections.
7952 * layout.cc (Layout::set_segment_offsets): Handle
7955 * options.h (class General_options): Define -n/--nmagic and
7957 * options.cc (General_options::finalize): For -n/--nmagic or
7958 -N/--omagic, set -static.
7959 * layout.cc (Layout::attach_allocated_section_to_segment): If
7960 -N/--omagic, don't put read-only and read-write sections in
7962 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
7963 finding a read-only segment.
7964 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
7965 don't set the minimum segment alignment to the common page size,
7966 and don't set the file offset to the address modulo the page size.
7967 * script-sections.cc (Script_sections::create_segments): If
7968 -n/--omagic, don't put read-only and read-write sections in
7971 * cref.cc: New file.
7973 * options.h (class General_options): Add --print-symbol-counts.
7974 * main.cc (main): Issue defined symbol report if requested.
7975 * archive.cc (Archive::interpret_header): Make into a const member
7977 (Archive::add_symbols): Call Input_objects::archive_start and
7979 (Archive::const_iterator): Define new class.
7980 (Archive::begin, Archive::end): New functions.
7981 (Archive::include_all_members): Rewrite to use iterator.
7982 (Archive::count_members): New function.
7983 * archive.h (class Archive): Update declarations.
7984 (Archive::filename): New function.
7985 * object.cc: Include "cref.h".
7986 (Sized_relobj::Sized_relobj): Initialize defined_count_.
7987 (Sized_relobj::do_get_global_symbol_counts): New function.
7988 (Input_objects::add_object): Add object to cross-referencer.
7989 (Input_objects::archive_start): New function.
7990 (Input_objects::archive_stop): New function.
7991 (Input_objects::print_symbol_counts): New function.
7992 * object.h: Declare Cref and Archive.
7993 (Object::get_global_symbol_counts): New function.
7994 (Object::do_get_global_symbol_counts): New pure virtual function.
7995 (class Sized_relobj): Add defined_count_ field. Update
7997 (class Input_objects): Add cref_ field. Update constructor.
7998 Update declarations.
7999 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
8001 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
8003 (Sized_dynobj::do_get_global_symbol_counts): New function.
8004 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
8005 defined_count_. Update declarations. Define Symbols typedef.
8006 * symtab.cc (Symbol_table::add_from_relobj): Add defined
8007 parameter. Change all callers.
8008 (Symbol_table::add_from_dynobj): Add sympointers and defined
8009 parameters. Change all callers.
8010 * symtab.h (class Symbol_table): Update declarations.
8011 * Makefile.am (CCFILES): Add cref.cc.
8012 (HFILES): Add cref.h.
8013 * Makefile.in: Rebuild.
8015 2008-07-22 Simon Baldwin <simonb@google.com>
8017 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
8018 to zero when writing undefined symbols.
8020 2008-07-22 Ian Lance Taylor <iant@google.com>
8022 * output.cc (Output_section::add_input_section): Don't try to
8023 merge empty merge sections.
8025 2008-07-21 Craig Silverstein <csilvers@google.com>
8027 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
8028 Include symbol version in error message.
8030 2008-07-20 Chris Demetriou <cgd@google.com>
8032 * configure.ac (gold_cv_c_random_seed): New configured variable.
8033 (RANDOM_SEED_CFLAGS): New substituted variable.
8034 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
8035 * configure: Rebuild.
8036 * Makefile.in: Likewise.
8037 * testsuite/Makefile.in: Likewise.
8039 2008-07-18 Ian Lance Taylor <iant@google.com>
8041 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
8042 where we see NAME/NULL and NAME/VERSION as separate symbols.
8043 * testsuite/ver_test_main.cc (main): Call t4.
8044 (t4, t4_2a): Define.
8045 * testsuite/ver_test_2.cc (t4_2): Define.
8046 * testsuite/ver_test_2.script: Put t4_2a in VER2.
8047 * testsuite/ver_test_4.cc (t4_2a): Define.
8048 * testsuite/ver_test_4.script: Put t4_2a in VER2.
8049 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
8051 2008-07-17 Ian Lance Taylor <iant@google.com>
8053 * dynobj.cc (Versions::add_def): If we give an error about a
8054 missing version, go ahead and create the version anyhow.
8056 2008-07-10 Ian Lance Taylor <iant@google.com>
8058 Handle output sections with more than 0x7fffffff bytes.
8059 * object.h (class Relobj): Change map_to_output_ to
8060 output_sections_, and just keep a section pointer. Change all
8061 uses. Move comdat group support to Sized_relobj.
8062 (Relobj::is_section_specially_mapped): Remove.
8063 (Relobj::output_section): Remove poff parameter. Change all
8065 (Relobj::output_section_offset): New function.
8066 (Relobj::set_section_offset): Rewrite.
8067 (Relobj::map_to_output): Remove.
8068 (Relobj::output_sections): New function.
8069 (Relobj::do_output_section_offset): New pure virtual function.
8070 (Relobj::do_set_section_offset): Likewise.
8071 (class Sized_relobj): Add section_offsets_ field. Add comdat
8072 group support from Relobj. Update declarations.
8073 (Sized_relobj::get_output_section_offset): New function.
8074 (Sized_relobj::do_output_section_offset): New function.
8075 (Sized_relobj::do_set_section_offset): New function.
8076 * object.cc (Relobj::output_section_address): Remove.
8077 (Sized_relobj::Sized_relobj): Initialize new fields.
8078 (Sized_relobj::include_section_group): Cast find_kept_object to
8080 (Sized_relobj::include_linkonce_section): Likewise.
8081 (Sized_relobj::do_layout): Use separate arrays for output section
8083 (Sized_relobj::do_count_local_symbols): Change map_to_output to
8085 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
8086 output_sections and section_offsets.
8087 (Sized_relobj::write_local_symbols): Likewise.
8088 (map_to_kept_section): Compute output address directly.
8089 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
8090 output_sections and section_offsets.
8091 (Sized_relobj::write_sections): Likewise.
8092 (Sized_relobj::relocate_sections): Likewise.
8093 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
8094 * output.h (class Output_reloc): Update declarations. Change
8095 u2_.relobj to Sized_relobj*.
8096 (class Output_data_reloc): Change add functions to use
8098 * output.cc (Output_reloc::Output_reloc): Change relobj to
8100 (Output_reloc::local_section_offset): Change return type to
8101 Elf_Addr. Use get_output_section_offset.
8102 (Output_reloc::get_address): Likewise.
8103 (Output_section::is_input_address_mapped): Don't call
8104 is_section_specially_mapped.
8105 (Output_section::output_offset): Likewise.
8106 (Output_section::output_address): Likewise.
8107 (Output_section::starting_output_address): Likewise.
8108 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
8109 parameter to Sized_relobj*.
8110 (Copy_relocs::need_copy_reloc): Likewise.
8111 (Copy_relocs::save): Likewise.
8112 * copy-relocs.h (class Copy_relocs): Update declarations.
8113 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
8114 Sized_relobj*. Change relobj_ field to Sized_relobj*.
8115 * target-reloc.h (relocate_for_relocatable): Change
8116 offset_in_output_section type to Elf_Addr. Change code that uses
8118 * layout.cc (Layout::layout): Always set *off.
8119 * mapfile.cc (Mapfile::print_input_section): Use
8120 output_section_offset.
8121 * i386.cc (Target_i386::copy_reloc): Change object parameter to
8123 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
8124 * sparc.cc (Target_sparc::copy_reloc): Likewise.
8125 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
8127 2008-07-03 Ian Lance Taylor <iant@google.com>
8129 * layout.cc (Layout::include_section): Do not discard unrecognized
8130 SHT_STRTAB sections.
8132 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
8134 * script.cc (Lex::can_continue_name): Make '?' allowable in
8135 version-script names.
8136 * testsuite/version_script.map: Change glob pattern to use '?'
8138 2008-06-30 Manish Singh <yosh@gimp.org>
8141 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
8144 2008-06-30 Ian Lance Taylor <iant@google.com>
8148 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
8149 versions]: Don't try to read the value in the contents, since we
8150 don't use it. Use the template endianness when writing.
8152 2008-06-25 Cary Coutant <ccoutant@google.com>
8154 * fileread.cc (File_read::make_view): Assert on zero-length view.
8155 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
8156 symbol table when there are no symbols to read.
8158 2008-06-23 Craig Silverstein <csilvers@google.com>
8160 * version.cc (version_string): Bump to 1.7
8162 2008-06-18 Craig Silverstein <csilvers@google.com>
8164 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
8165 constant 0xFFFF to type Valtype.
8166 (Powerpc_relocate_functions::rel16_ha): Likewise.
8168 2008-06-17 Ian Lance Taylor <iant@google.com>
8170 * output.h (Output_section::Input_section): Initialize p2align_ to
8171 zero for Output_section_data constructors.
8172 (Output_section::Input_section::addralign): If not an input
8173 section, return the alignment of the Output_section_data.
8174 * testsuite/copy_test.cc: New file.
8175 * testsuite/copy_test_1.cc: New file.
8176 * testsuite/copy_test_2.cc: New file.
8177 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
8178 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
8179 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
8180 (copy_test_1_pic.o, copy_test_1.so): New targets.
8181 (copy_test_2_pic.o, copy_test_2.so): New targets.
8182 * testsuite/Makefile.in: Rebuild.
8184 * script-sections.cc (Script_sections::place_orphan): Initialize
8185 local variable exact.
8187 2008-06-13 David Edelsohn <edelsohn@gnu.org>
8189 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
8191 2008-06-12 David Edelsohn <edelsohn@gnu.org>
8192 David S. Miller <davem@davemloft.net>
8194 * powerpc.cc: New file.
8195 * Makefile.am (TARGETSOURCES): Add powerpc.cc
8196 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
8197 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
8198 * Makefile.in: Rebuild.
8200 2008-06-09 Ian Lance Taylor <iant@google.com>
8202 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
8204 (throwing, orig_terminate): New static variables.
8205 (terminate_handler): New static function.
8206 (t2): Set terminate handler.
8208 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
8211 * binary.cc (Binary_to_elf::sized_convert): Fix .data
8214 2008-05-30 Cary Coutant <ccoutant@google.com>
8216 * archive.cc (Archive::include_all_members) Correct to step
8217 over symbol table and extended name table in thin archives.
8219 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
8222 * target-reloc.h (relocate_for_relocatable): Fix new_offset
8225 2008-05-28 Caleb Howe <cshowe@google.com>
8227 * reduced_debug_output.cc: New file.
8228 * reduced_debug_output.h: New file.
8229 * options.h (class General_options): Add --strip-debug-non-line.
8230 * options.cc (General_options::finalize): Add strip_debug_non_line
8231 to the strip heirarchy.
8232 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
8234 * layout.cc: Include "reduced_debug_output.h".
8235 (Layout::Layout): Initialize new fields.
8236 (line_only_debug_sections): New static array.
8237 (is_lines_only_debug_sections): New static inline function.
8238 (Layout::include_section): Handle --strip-debug-non-line.
8239 (Layout::make_output_section): If --strip-debug-non-line, build
8240 new output sections for .debug_abbrev and .debug_info.
8241 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
8242 gold. Warn about possible overflow.
8243 (read_signed_LEB_128): Likewise.
8244 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
8245 (read_signed_LEB_128): Declare.
8246 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
8247 (HFILES): Add reduced_debug_output.h.
8248 * Makefile.in: Rebuild.
8250 2008-05-21 Ian Lance Taylor <iant@google.com>
8252 * mapfile.cc: New file.
8253 * mapfile.h: New file.
8254 * options.h (class General_options): Add -M/--print-map and -Map.
8255 * options.cc (General_options::finalize): Make -M equivalent to
8257 * main.cc: Include <cstdio> and "mapfile.h".
8258 (main): Open mapfile if requested.
8259 * gold.cc (class Middle_runner): Add mapfile_ field. Update
8260 constructor. Change caller.
8261 (queue_initial_tasks): Add mapfile parameter. Change caller.
8262 (queue_middle_tasks): Likewise.
8263 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
8265 * archive.cc: Include "mapfile.h".
8266 (Archive::add_symbols): Add mapfile parameter. Change all
8267 callers. Pass mapfile, symbol, and reason to include_member.
8268 (Archive::include_all_members): Add mapfile parameter. Change all
8270 (Archive::include_member): Add mapfile, sym, and why parameters.
8271 Change all callers. Report inclusion to map file.
8272 * archive.h: Include "fileread.h".
8273 (class Archive): Update declarations.
8274 (Archive::file): New const method.
8275 (class Add_archive_symbols): Add mapfile_ field. Update
8276 constructor. Change all callers.
8277 * readsyms.h (class Read_symbols): Likewise.
8278 (class Finish_group): Likewise.
8279 (class Read_script): Likewise.
8280 * common.cc: Include "mapfile.h".
8281 (Symbol_table::allocate_commons): Add mapfile parameter. Change
8283 (Symbol_table::do_allocate_commons): Likewise.
8284 (Symbol_table::do_allocate_commons_list): Likewise. Report common
8285 symbol allocation to mapfile.
8286 * common.h (class Allocate_commons_task): Add mapfile_ field.
8287 Update constructor. Change all callers.
8288 * symtab.h (class Symbol_table): Update declarations.
8289 * layout.cc: Include "mapfile.h".
8290 (Layout_task_runner::run): Print information to mapfile.
8291 (Layout::create_gold_note): Change Output_data_fixed_space to
8292 Output_data_zero_fill.
8293 (Layout::create_build_id): Likewise.
8294 (Layout::print_to_mapfile): New function.
8295 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
8296 constructor. Change caller.
8297 (class Layout): Declare print_to_mapfile.
8298 * output.cc (Output_section::Input_section::print_to_mapfile): New
8300 (Output_section::add_input_section): If producing a map, always
8301 add to input_sections_ list.
8302 (Output_section::do_print_to_mapfile): New function.
8303 (Output_segment::print_sections_to_mapfile): New function.
8304 (Output_segment::print_section_list_to_mapfile): New function.
8305 * output.h: Include "mapfile.h".
8306 (Output_data::print_to_mapfile): New function.
8307 (Output_data::do_print_to_mapfile): New virtual function.
8308 (Output_segment_headers::do_print_to_mapfile): New function.
8309 (Output_file_header::do_print_to_mapfile): New function.
8310 (Output_data_const::do_print_to_mapfile): New function.
8311 (class Output_data_const_buffer): Add map_name_ field. Update
8312 constructor. Change all callers. Add do_print_to_mapfile
8314 (class Output_data_fixed_space): Likewise.
8315 (class Output_data_space): Likewise.
8316 (class Output_data_zero_fill): New class.
8317 (Output_data_strtab::do_print_to_mapfile): New function.
8318 (Output_data_reloc_base::do_print_to_mapfile): New function.
8319 (Output_relocatable_relocs::do_print_to_mapfile): New function.
8320 (Output_data_group::do_print_to_mapfile): New function.
8321 (Output_data_got::do_print_to_mapfile): New function.
8322 (Output_data_dynamic::do_print_to_mapfile): New function.
8323 (Output_symtab_xindex::do_print_to_mapfile): New function.
8324 (class Output_section): Declare do_print_to_mapflie. Declare
8325 print_to_mapfile in Input_section.
8326 (class Output_segment): Declare new functions.
8327 * object.h (Sized_relobj::symbol_count): New function.
8328 * script-sections.cc
8329 (Output_section_element_dot_assignment::set_section_addresses):
8330 Change Output_data_fixed_space to Output_data_zero_fill.
8331 (Output_data_expression::do_print_to_mapfile): New function.
8332 * script.cc (read_input_script): Add mapfile parameter. Change
8334 * script.h (read_input_script): Update declaration.
8335 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
8336 (Eh_frame::do_print_to_mapfile): New function.
8337 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
8338 (Output_merge_string::do_print_to_mapfile): New function.
8339 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
8341 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
8343 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
8345 * Makefile.am (CCFILES): Add mapfile.cc.
8346 (HFILES): Add mapfile.h.
8347 * Makefile.in: Rebuild.
8349 2008-05-19 Ian Lance Taylor <iant@google.com>
8351 * options.h (class General_options): Add -z relro.
8352 * layout.cc (Layout::Layout): Initialize relro_segment_.
8353 (Layout::add_output_section_data): Return the output section.
8354 (Layout::make_output_section): Rcognize relro sections and mark
8356 (Layout::attach_allocated_section_to_segment): Put relro sections
8357 in a PT_GNU_RELRO segment.
8358 (Layout::create_initial_dynamic_sections): Mark the .dynamic
8360 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
8362 (Layout::linkonce_mapping): Map d.rel.ro.local to
8364 (Layout::output_section_name): Us .data.rel.ro.local for any
8365 section which begins with that.
8366 * layout.h (class Layout): Update add_output_section_data
8367 declaration. Add relro_segment_ field.
8368 * output.cc (Output_section::Output_section): Initialize is_relro_
8369 and is_relro_local_ fields.
8370 (Output_segment::add_output_section): Group relro sections.
8371 (Output_segment::is_first_section_relro): New function.
8372 (Output_segment::maximum_alignment): If there is a relro section,
8373 align the segment to the common page size.
8374 (Output_segment::set_section_addresses): Track whether we are
8375 looking at relro sections. If the last section is a relro
8376 section, align to the common page size.
8377 (Output_segment::set_section_list_addresses): Add in_relro
8378 parameter. Change all callers. Align to the page size when
8379 moving from relro to non-relro section.
8380 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
8382 * output.h (class Output_section): Add is_relro_ and
8383 is_relro_local_ fields.
8384 (Output_section::is_relro): New function.
8385 (Output_section::set_is_relro): New function.
8386 (Output_section::is_relro_local): New function.
8387 (Output_section::set_is_relro_local): New function.
8388 (class Output_segment): Update declarations.
8389 * i386.cc (Target_i386::got_section): Mark .got section as relro.
8390 * sparc.cc (Target_sparc::got_section): Likewise.
8391 * x86_64.cc (Target_x86_64::got_section): Likewise.
8392 * testsuite/relro_test_main.cc: New file.
8393 * testsuite/relro_test.cc: New file.
8394 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
8395 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
8396 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
8397 (relro_test.so, relro_test_pic.o): New targets.
8398 * testsuite/Makefile.in: Rebuild.
8400 2008-05-16 Ian Lance Taylor <iant@google.com>
8402 * output.cc (Output_segment::add_output_section): Remove front
8404 * output.h (class Output_segment): Remove
8405 add_initial_output_section and overloaded add_output_section.
8406 Update declaration of remaining add_output_section.
8407 * layout.cc (Layout::create_interp): Call add_output_section
8408 rather than add_initial_output_section.
8409 (Layout::finish_dynamic_section): Likewise.
8411 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
8412 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
8413 know the dynamic type.
8414 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
8415 field. Initialize it in constructor.
8416 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
8417 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
8418 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
8421 * output.cc (Output_reloc::get_address): Change return type to
8423 * output.h (class Output_reloc): Update get_address declaration.
8424 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
8425 for section addresses.
8427 2008-05-09 Ian Lance Taylor <iant@google.com>
8430 * gold.cc (gold_nomem): Use return value of write.
8432 2008-05-08 Ian Lance Taylor <iant@google.com>
8434 * symtab.c (Symbol::init_base_output_data): Add version
8435 parameter. Change all callers.
8436 (Symbol::init_base_output_segment): Likewise.
8437 (Symbol::init_base_constant): Likewise.
8438 (Symbol::init_base_undefined): Likewise.
8439 (Sized_symbol::init_output_data): Likewise.
8440 (Sized_symbol::init_output_segment): Likewise.
8441 (Sized_symbol::init_constant): Likewise.
8442 (Sized_symbol::init_undefined): Likewise.
8443 (Symbol_table::do_define_in_output_data): If the new symbol has a
8444 version, mark it as the default.
8445 (Symbol_table::do_define_in_output_segment): Likewise.
8446 (Symbol_table::do_define_as_constant): Likewise.
8447 * symtab.h (class Symbol): Update declarations.
8448 (class Sized_symbol): Likewise.
8449 * resolve.cc (Symbol::override_version): New function.
8450 (Symbol::override_base): Call override_version.
8451 (Symbol::override_base_with_special): Likewise.
8452 * testsuite/ver_script_8.script: New file.
8453 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
8454 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
8455 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
8456 (ver_test_8_1.so, ver_test_8_2.so): New targets.
8458 2008-05-06 Ian Lance Taylor <iant@google.com>
8461 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
8463 (class General_options): Remove existing --undefined, and add
8464 --no-undefined instead. Add new --undefined as synonym for -u.
8465 * archive.cc (Archive::add_symbols): Check whether symbol was
8467 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
8468 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
8469 all uses. Add IS_UNDEFINED. Update declarations to split
8470 different versions of init_base. Declare init_base_undefined.
8471 (Symbol::is_defined): Handle IS_UNDEFINED.
8472 (Symbol::is_undefined): Likewise.
8473 (Symbol::is_weak_undefined): Call is_undefined.
8474 (Symbol::is_absolute): Handle IS_CONSTANT.
8475 (class Sized_symbol): Update declarations to split different
8476 versions of init. Declare init_undefined.
8477 (class Symbol_table): Declare new functions.
8478 * symtab.cc (Symbol::init_base_object): Rename from init_base.
8480 (Symbol::init_base_output_data): Likewise.
8481 (Symbol::init_base_output_segment): Likewise.
8482 (Symbol::init_base_constant): Likewise.
8483 (Symbol::init_base_undefined): New function.
8484 (Sized_symbol::init_object): Rename from init. Change all
8486 (Sized_symbol::init_output_data): Likewise.
8487 (Sized_symbol::init_output_segment): Likewise.
8488 (Sized_symbol::init_constant): Likewise.
8489 (Sized_symbol::init_undefined): New function.
8490 (Symbol_table::add_undefined_symbols_from_command_line): New
8492 (Symbol_table::do_add_undefined_symbols_from_command_line): New
8494 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
8495 (Symbol::output_section): Likewise.
8496 (Symbol::set_output_section): Likewise.
8497 (Symbol_table::sized_finalize_symbol): Likewise.
8498 (Symbol_table::sized_write_globals): Likewise.
8499 * resolve.cc (Symbol_table::should_override): Likewise.
8500 (Symbol::override_base_with_special): Likewise.
8502 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
8503 symbol, change it to have default visibility.
8504 * testsuite/protected_1.cc: New file.
8505 * testsuite/protected_2.cc: New file.
8506 * testsuite/protected_3.cc: New file.
8507 * testsuite/protected_main_1.cc: New file.
8508 * testsuite/protected_main_2.cc: New file.
8509 * testsuite/protected_main_3.cc: New file.
8510 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
8511 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
8512 (protected_1_LDFLAGS, protected_1_LDADD): Define.
8513 (protected_1.so): New target.
8514 (protected_1_pic.o, protected_2_pic.o): New targets.
8515 (protected_3_pic.o): New target.
8516 (check_PROGRAMS): Add protected_2.
8517 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
8518 (protected_2_LDFLAGS, protected_2_LDADD): Define.
8519 * testsuite/Makefile.in: Rebuild.
8521 * options.h (DEFINE_var): Add set_user_set_##varname__.
8522 (DEFINE_bool_alias): New macro.
8523 (class General_options): Define -Bstatic using DEFINE_bool_alias
8524 rather than DEFINE_special. Add --undefined as an alias for -z
8526 * options.cc (General_options::parse_Bstatic): Remove.
8528 * options.h (class General_options): Add --fatal-warnings.
8529 * main.cc (main): Implement --fatal-warnings.
8530 * errors.h (Errors::warning_count): New function.
8532 * options.h (class General_options): Add -Bsymbolic-functions.
8533 * symtab.h (Symbol::is_preemptible): Check for
8534 -Bsymbolic-functions.
8536 2008-05-05 Ian Lance Taylor <iant@google.com>
8538 * options.h (DEFINE_bool): For DASH_Z, create the negative option
8539 as noVARNAME rather than no-VARNAME.
8540 (class General_options): Add option -z combreloc.
8541 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
8543 (Output_reloc::sort_before) [SHT_REL]: New function.
8544 (Output_reloc::sort_before) [SHT_RELA]: New function.
8545 (class Output_data_reloc_base): Add sort_relocs_ field. Define
8546 Sort_relocs_comparison.
8547 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
8548 parameter. Change all callers.
8549 (Output_data_reloc::Output_data_reloc) [both versions]: Add
8550 sort_relocs parameter. Change all callers.
8551 * output.cc (Output_reloc::get_address): New function, broken out
8553 (Output_reloc::write_rel): Call it.
8554 (Output_reloc::compare): New function.
8555 (Output_data_reloc_base::do_write): Optionally sort relocs.
8557 * configure.ac: If targ_extra_obj is set, link it in.
8558 * configure.tgt: Initialize all variables.
8559 (x86_64*): Set targ_extra_obj and targ_extra_size.
8560 * configure: Rebuild.
8562 * object.cc (Sized_relobj::include_section_group): Adjust section
8563 indexes read from group data. Build vector to pass to
8565 * layout.cc (Layout::layout_group): Add flags and shndxes
8566 parameters. Remove contents parameter. Change caller. Update
8567 explicit instantiations.
8568 * layout.h (class Layout): Update layout_group declaration.
8569 * output.cc (Output_data_group::Output_data_group): Add flags and
8570 input_shndxes parameters. Remove contents parameter. Change
8572 (Output_data_group::do_write): Change input_sections_ to
8574 * output.h (class Output_data_group): Update constructor
8575 declaration. Rename input_sections_ to input_shndxes_.
8576 * testsuite/many_sections_test.cc: Add template.
8578 2008-04-30 Cary Coutant <ccoutant@google.com>
8580 * target-reloc.h (relocate_section): Fix dead-pointer bug.
8582 * layout.cc (Layout::include_section): Refactored check for debug
8584 (Layout::add_comdat): Add new parameters. Change type
8585 of signature parameter. Add object and shndx to signatures table.
8586 (Layout::find_kept_object): New function.
8587 * layout.h: Include <cstring>.
8588 (Layout::is_debug_info_section): New function.
8589 (Layout::add_comdat): Add new parameters.
8590 (Layout::find_kept_object): New function.
8591 (Layout::Kept_section): New struct.
8592 (Layout::Signatures): Change type of map range.
8593 * object.cc (Relobj::output_section_address): New function.
8594 (Sized_relobj::include_section_group): Add new parameters. Change
8595 calls to Layout::add_comdat. Change to build table of kept comdat
8596 groups and table mapping discarded sections to kept sections.
8597 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
8598 (Sized_relobj::do_layout): Change calls to include_section_group and
8599 include_linkonce_section.
8600 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
8601 value to zero when section is discarded.
8602 (Sized_relobj::map_to_kept_section): New function.
8603 * object.h (Relobj::output_section_address): New function.
8604 (Relobj::Comdat_group): New type.
8605 (Relobj::find_comdat_group): New function.
8606 (Relobj::Comdat_group_table): New type.
8607 (Relobj::Kept_comdat_section): New type.
8608 (Relobj::Kept_comdat_section_table): New type.
8609 (Relobj::add_comdat_group): New function.
8610 (Relobj::set_kept_comdat_section): New function.
8611 (Relobj::get_kept_comdat_section): New function.
8612 (Relobj::comdat_groups_): New field.
8613 (Relobj::kept_comdat_sections_): New field.
8614 (Symbol_value::input_value): Update comment.
8615 (Sized_relobj::map_to_kept_section) New function.
8616 (Sized_relobj::include_linkonce_section): Add new parameter.
8617 * target-reloc.h (Comdat_behavior): New type.
8618 (get_comdat_behavior): New function.
8619 (relocate_section): Add code to map a discarded section to the
8620 corresponding kept section when applying a relocation.
8622 2008-04-30 Craig Silverstein <csilvers@google.com>
8624 * dwarf_reader.cc (next_generation_count): New static var.
8625 (Addr2line_cache_entry): New struct.
8626 (addr2line_cache): New static var.
8627 (Dwarf_line_info::one_addr2line): Added caching.
8628 (Dwarf_line_info::clear_addr2line_cache): New function.
8629 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
8630 cache-size parameter.
8631 (Dwarf_line_info::one_addr2line_cache): New function.
8632 * symtab.cc (Symbol_table::detect_odr_violations): Pass
8633 new cache-size argument to one_addr2line(), and clear cache.
8635 2008-04-28 Cary Coutant <ccoutant@google.com>
8637 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
8638 R_386_PC8 relocations.
8640 2008-04-23 Ian Lance Taylor <iant@google.com>
8642 * object.cc (Sized_relobj::include_section_group): Check for
8643 invalid section group.
8645 * object.cc (make_elf_object): Correct test for 64-bit ELF file
8648 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
8649 than read for file header.
8650 * archive.cc (Archive::include_member): Likewise.
8652 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
8654 * aclocal.m4: Regenerate.
8655 * configure: Regenerate.
8657 2008-04-19 Ian Lance Taylor <iant@google.com>
8659 * version.cc (version_string): Bump to 1.6.
8661 * testsuite/Makefile.am (many_sections_r_test): New target.
8662 (many_sections_r_test_SOURCES): Remove.
8663 (many_sections_r_test_DEPENDENCIES): Remove.
8664 (many_sections_r_test_LDFLAGS): Remove.
8665 (many_sections_r_test_LDADD): Remove.
8667 * object.cc (Sized_relobj::do_add_symbols): Always pass
8668 local_symbol_count_ to add_from_relobj.
8670 * testsuite/Makefile.am (many_sections_check.h): Only check one in
8671 every thousand variables.
8672 * testsuite/Makefile.in: Rebuild.
8674 * object.cc (Xindex::initialize_symtab_xindex): New function.
8675 (Xindex::read_symtab_xindex): New function.
8676 (Xindex::sym_xindex_to_shndx): New function.
8677 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
8679 (Sized_relobj::do_initialize_xindex): New function.
8680 (Sized_relobj::do_read_symbols): Adjust section links.
8681 (Sized_relobj::symbol_section_and_value): Add is_ordinary
8682 parameter. Change all callers.
8683 (Sized_relobj::include_section_group): Adjust section links and
8684 symbol section indexes.
8685 (Sized_relobj::do_layout): Adjust section links.
8686 (Sized_relobj::do_count_local_symbols): Adjust section links and
8687 symbol section indexes.
8688 (Sized_relobj::do_finalize_local_symbols): Distinguish between
8689 ordinary and special symbols.
8690 (Sized_relobj::write_local_symbols): Add symtab_xindex and
8691 dynsym_xindex parameters. Change all callers. Adjust section
8692 links. Use SHN_XINDEX when needed.
8693 (Sized_relobj::get_symbol_location_info): Adjust section links.
8694 Don't get fooled by special symbols.
8695 * object.h (class Xindex): Define.
8696 (class Object): Add xindex_ parameter. Declare virtual functoin
8697 do_initialize_xindex.
8698 (Object::adjust_sym_shndx): New function.
8699 (Object::set_xindex): New protected function.
8700 (class Symbol_value): Add is_ordinary_shndx_ field.
8701 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
8702 (Symbol_value::value): Assert ordinary section.
8703 (Symbol_value::initialize_input_to_output_map): Likewise.
8704 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
8706 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
8708 (class Sized_relobj): Update declarations.
8709 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
8710 parameter. Change all callers.
8711 (Sized_relobj::adjust_shndx): New function.
8712 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
8714 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
8715 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
8716 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
8717 (Sized_dynobj::read_dynsym_section): Adjust section links.
8718 (Sized_dynobj::read_dynamic): Likewise.
8719 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
8721 (Sized_dynobj::do_initialize_xindex): New function.
8722 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
8723 do_initialize_xindex.
8724 (Sized_dynobj::adjust_shndx): New function.
8725 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
8726 dynsym_xindex_ fields.
8727 (Layout::finalize): Add a call to set_section_indexes before
8728 creating the symtab sections.
8729 (Layout::set_section_indexes): Don't do anything if the section
8730 already has a section index.
8731 (Layout::create_symtab_sections): Add shnum parameter. Change
8732 caller. Create .symtab_shndx section if needed.
8733 (Layout::create_shdrs): Add shstrtab_section parameter. Change
8735 (Layout::allocated_output_section_count): New function.
8736 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
8738 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
8739 fields. Update declarations.
8740 (Layout::symtab_xindex): New function.
8741 (Layout::dynsym_xindex): New function.
8742 (class Write_symbols_task): Add layout_ field.
8743 (Write_symbols_task::Write_symbols_task): Add layout parameter.
8745 * output.cc (Output_section_headers::Output_section_headers): Add
8746 shstrtab_section parameter. Change all callers.
8747 (Output_section_headers::do_sized_write): Store overflow values
8748 for section count and section string table section index in
8749 section header zero.
8750 (Output_file_header::do_sized_write): Check for overflow of
8751 section count and section string table section index.
8752 (Output_symtab_xindex::do_write): New function.
8753 (Output_symtab_xindex::endian_do_write): New function.
8754 * output.h (class Output_section_headers): Add shstrtab_section_.
8755 Update declarations.
8756 (class Output_symtab_xindex): Define.
8757 (Output_section::has_out_shndx): New function.
8758 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
8760 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
8762 (Sized_symbol::init): Likewise.
8763 (Symbol::output_section): Check for ordinary symbol.
8764 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
8765 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
8767 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
8768 Change all callers. Simplify handling of symbols from sections
8769 not included in the link.
8770 (Symbol_table::add_from_dynobj): Handle ordinary symbol
8772 (Weak_alias_sorter::operator()): Assert that symbols are
8774 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
8776 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
8777 parameters. Change all callers.
8778 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
8779 symbol distinction. Use SHN_XINDEX when needed.
8780 (Symbol_table::write_section_symbol): Add symtab_xindex
8781 parameter. Change all callers.
8782 (Symbol_table::sized_write_section_symbol): Likewise. Use
8783 SHN_XINDEX when needed.
8784 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
8786 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
8787 (Symbol::is_defined): Check is_ordinary.
8788 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
8789 (Symbol::is_absolute, Symbol::is_common): Likewise.
8790 (class Sized_symbol): Update declarations.
8791 (class Symbol_table): Update declarations.
8792 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
8793 parameters. Change all callers.
8794 (Sized_symbol::override): Likewise.
8795 (Symbol_table::override): Likewise.
8796 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
8797 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
8798 is_ordinary, and orig_st_shndx parameters. Change all callers.
8799 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
8800 to be in an ordinary section.
8801 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
8802 object and is_ordinary parameters. Change all callers.
8803 (Sized_dwarf_line_info::read_relocs): Add object parameter.
8804 Change all callers. Don't add undefined or non-ordinary symbols
8806 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
8808 * dwarf_reader.h (class Sized_dwarf_line_info): Update
8810 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
8811 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
8812 (Sized_relobj::relocate_sections): Likewise.
8813 * target-reloc.h (scan_relocs): Adjust section symbol index.
8814 (scan_relocatable_relocs): Likewise.
8815 * i386.cc (Scan::local): Check for ordinary symbols.
8816 * sparc.cc (Scan::local): Likewise.
8817 * x86_64.cc (Scan::local): Likewise.
8818 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
8819 to symbol_section_and_value.
8820 * testsuite/many_sections_test.cc: New file.
8821 * testsuite/Makefile.am (BUILT_SOURCES): Define.
8822 (check_PROGRAMS): Add many_sections_test.
8823 (many_sections_test_SOURCES): Define.
8824 (many_sections_test_DEPENDENCIES): Define.
8825 (many_sections_test_LDFLAGS): Define.
8826 (BUILT_SOURCES): Add many_sections_define.h.
8827 (many_sections_define.h): New target.
8828 (BUILT_SOURCES): Add many_sections_check.h.
8829 (many_sections_check.h): New target.
8830 (check_PROGRAMS): Add many_sections_r_test.
8831 (many_sections_r_test_SOURCES): Define.
8832 (many_sections_r_test_DEPENDENCIES): Define.
8833 (many_sections_r_test_LDFLAGS): Define.
8834 (many_sections_r_test_LDADD): Define.
8835 (many_sections_r_test.o): New target.
8836 * testsuite/Makefile.in: Rebuild.
8838 2008-04-17 Cary Coutant <ccoutant@google.com>
8840 * errors.cc (Errors::info): New function.
8841 (gold_info): New function.
8842 * errors.h (Errors::info): New function.
8843 * gold.h (gold_info): New function.
8844 * object.cc (Input_objects::add_object): Print trace output.
8845 * options.cc (options::parse_set): New function.
8846 (General_options::parse_wrap): Deleted.
8847 (General_options::General_options): Deleted initializer.
8848 * options.h (options::String_set): New typedef.
8849 (options::parse_set): New function.
8850 (DEFINE_set): New macro.
8851 (General_options::wrap): Changed to use DEFINE_set. Changed
8852 callers of any_wrap_symbols and is_wrap_symbol.
8853 (General_options::trace, General_options::trace_symbol):
8855 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
8856 (General_options::wrap_symbols_): Deleted.
8857 * symtab.cc (Symbol_table::add_from_object): Print trace output.
8859 2008-04-17 David S. Miller <davem@davemloft.net>
8861 * options.cc (General_options::parse_V): New function.
8862 * options.h: Add entries for -V and -Qy.
8864 2008-04-17 Ian Lance Taylor <iant@google.com>
8866 * common.cc (Symbol_table::allocate_commons): Remove options
8867 parameter. Change caller.
8868 (Symbol_table::do_allocate_commons): Remove options parameter.
8869 Change caller. Just call do_allocate_commons_list twice.
8870 (Symbol_table::do_allocate_commons_list): New function, broken out
8871 of do_allocate_commons.
8872 * common.h (class Allocate_commons_task): Remove options_ field.
8874 * symtab.cc (Symbol_table::Symbol_table): Initialize
8876 (Symbol_table::add_from_object): Put TLS common symbols on
8878 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
8879 which are IN_OUTPUT_DATA.
8880 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
8881 allocate_commons and do_allocate_commons declarations. Declare
8882 do_allocate_commons_list.
8883 * gold.cc (queue_middle_tasks): Update creation of
8884 Allocate_commons_task to not pass options.
8885 * testsuite/Makefile.am (INCLUDES): Add -I.. .
8886 (TLS_TEST_C_FLAGS): New variable.
8887 (tls_test_c_pic.o): New target.
8888 (tls_test_shared.so): Link in tls_test_c_pic.o.
8889 (tls_test_c_pic_ie.o): New target.
8890 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
8891 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
8892 (tls_test_c.o): New target.
8893 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
8894 (tls_pic_test_LDADD): Likewise.
8895 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
8896 (tls_shared_gd_to_ie_test_LDADD): Likewise.
8897 (tls_test_c_gnu2.o): New target.
8898 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
8900 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
8901 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
8902 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
8903 * testsuite/tls_test.cc: Include "config.h".
8904 (t_last): Call t11_last.
8905 * testsuite/tls_test.h (t11, t11_last): Declare.
8906 * testsuite/tls_test_c.c: New file.
8907 * testsuite/tls_test_main.cc (thread_routine): Call t11.
8908 * configure.ac: Check for OpenMP support.
8909 * configure, config.in, Makefile.in: Rebuild.
8910 * testsuite/Makefile.in: Rebuild.
8912 2008-04-16 Cary Coutant <ccoutant@google.com>
8914 * i386.cc (Target_i386::define_tls_base_symbol): New function.
8915 (Target_i386::tls_base_symbol_defined_): New field.
8916 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
8917 (Target_i386::Scan::global): Likewise.
8918 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
8919 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
8920 (Target_x86_64::tls_base_symbol_defined_): New field.
8921 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
8922 (Target_x86_64::Scan::global): Likewise.
8924 2008-04-16 Cary Coutant <ccoutant@google.com>
8926 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
8927 (Symbol::needs_plt_entry): Allow weak undefined symbols.
8928 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
8929 building shared libraries.
8930 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
8931 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
8932 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
8933 * testsuite/Makefile.in: Rebuild.
8934 * testsuite/weak_undef.h: New file.
8935 * testsuite/weak_undef_file1.cc: Add extra test cases.
8936 * testsuite/weak_undef_file2.cc: Likewise.
8937 * testsuite/weak_undef_test.cc: Likewise.
8939 2008-04-16 David S. Miller <davem@davemloft.net>
8941 * sparc.cc (Target_sparc::Scan): Change from struct to class.
8942 Add issued_non_pic_error_ field. Declare check_non_pic.
8943 (Target_sparc::Scan::check_non_pic): New function.
8944 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
8945 (Target_sparc::Scan::global): Likewise.
8947 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
8948 * configure: Rebuild.
8950 * options.h (DEFINE_enable): New macro.
8951 (new_dtags): New enable option.
8952 (initfirst, interpose, loadfltr, nodefaultlib,
8953 nodelete, nodlopen, nodump): New -z options.
8954 * layout.cc (Layout:finish_dynamic_section): If new
8955 dtags enabled, emit DT_RUNPATH. Also, emit a
8956 DT_FLAGS_1 containing any specified -z flags.
8958 2008-04-16 Ian Lance Taylor <iant@google.com>
8960 * copy-relocs.cc: New file.
8961 * copy-relocs.h: New file.
8962 * reloc.cc: Remove Copy_relocs code.
8963 * reloc.h: Likewise.
8964 * reloc-types.h (struct Reloc_types) [both versions]: Add
8965 get_reloc_addend_noerror.
8966 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
8967 variants of add_global which take an addend which must be zero.
8968 * i386.cc: Include "copy-relocs.h".
8969 (class Target_i386): Change type of copy_relocs_ to variable,
8971 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
8973 (Target_i386::do_finalize_sections): Change handling of
8975 * sparc.cc: Include "copy-relocs.h".
8976 (class Target_sparc): Change type of copy_relocs_ to variable,
8978 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
8980 (Target_sparc::do_finalize_sections): Change handling of
8982 * x86_64.cc: Include "copy-relocs.h".
8983 (class Target_x86_64): Change type of copy_relocs_ to variable,
8985 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
8986 class. Change all callers.
8987 (Target_x86_64::do_finalize_sections): Change handling of
8989 * Makefile.am (CCFILES): Add copy-relocs.cc.
8990 (HFILES): Add copy-relocs.h.
8992 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
8994 * testsuite/script_test_4.sh: Permit leading zeroes.
8996 2008-04-15 Ian Lance Taylor <iant@google.com>
8998 * script-sections.cc (Script_sections::create_segments): Use
8999 header_size_adjustment even when there is enough room for the
9001 * testsuite/script_test_4.sh: New file.
9002 * testsuite/script_test_4.t: New file.
9003 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
9004 (check_DATA): Add script_test_4.stdout.
9005 (MOSTLYCLEANFILES): Likewise.
9006 (script_test_4): New target.
9007 (script_test_4.stdout): New target.
9008 * testsuite/Makefile.in: Rebuild.
9010 * sparc.cc: Add definitions for Output_data_plt_sparc class
9013 2008-04-14 David S. Miller <davem@davemloft.net>
9015 * sparc.cc: New file.
9016 * Makefile.am (TARGETSOURCES): Add sparc.cc
9017 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
9018 * configure.tgt: Document targ_extra_size and
9019 targ_extra_big_endian. Add entries for sparc-* and
9021 * configure.ac: Handle targ_extra_size and
9022 targ_extra_big_endian.
9023 * Makefile.in: Rebuild.
9024 * configure: Likewise.
9025 * po/POTFILES.in: Likewise.
9026 * po/gold.pot: Likewise.
9028 2008-04-14 Ian Lance Taylor <iant@google.com>
9030 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
9031 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
9032 in the name/type/flags to section mapping. Don't call
9033 allocate_output_section.
9034 (Layout::choose_output_section): Change parameter from adjust_name
9035 to is_input_section. Don't permit input sections after sections
9036 are attached to segments. Don't call allocate_output_section.
9037 (Layout::layout_eh_frame): Call update_flags_for_input_section,
9038 not write_enable_output_section.
9039 (Layout::make_output_section): Don't push to
9040 unattached_section_list_ nor call attach_to_segment. Call
9041 attach_section_to_segment if sections are attached.
9042 (Layout::attach_sections_to_segments): New function.
9043 (Layout::attach_section_to_segment): New function.
9044 (Layout::attach_allocated_section_to_segment): Rename from
9045 attach_to_segment. Remove flags parameter.
9046 (Layout::allocate_output_section): Remove function.
9047 (Layout::write_enable_output_section): Remove function.
9048 * layout.h (class Layout): Update for above changes. Add new
9049 field sections_are_attached_.
9050 * output.h (Output_section::update_flags_for_input_section): New
9052 * output.cc (Output_section::add_input_section): Call
9053 update_flags_for_input_section.
9054 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
9056 2008-04-11 Cary Coutant <ccoutant@google.com>
9058 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
9059 thought unnecessary.
9060 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
9062 2008-04-11 Ian Lance Taylor <iant@google.com>
9064 * output.h (class Output_section_data): Remove inline definition
9066 * output.cc (Output_section_data::set_addralign): New function.
9068 2008-04-11 Cary Coutant <ccoutant@google.com>
9070 Add support for TLS descriptors for i386 and x86_64.
9071 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
9072 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
9073 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
9075 (Target_i386::got_mod_index_entry): Remove unnecessary code.
9076 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
9077 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
9079 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
9080 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
9081 Fix problem with initial-exec relocations.
9082 (Target_i386::Relocate::relocate_tls): Likewise.
9083 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
9085 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
9086 support for section-plus-offset dynamic table entries.
9087 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
9088 (Output_data_dynamic::Dynamic_entry): Add support for
9089 section-plus-offset dynamic table entries.
9090 (Output_data_dynamic::Classification): Likewise.
9091 (Output_data_dynamic::classification_): Renamed offset_.
9092 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
9093 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
9094 (Target_x86_64::make_plt_section): New function.
9095 (Target_x86_64::reserve_tlsdesc_entries): New function.
9096 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
9097 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
9098 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
9099 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
9100 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
9101 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
9102 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
9103 add extra PLT entry for TLS descriptors.
9104 (Output_data_plt_x86_64::got_): New field.
9105 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
9106 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
9108 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
9110 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
9111 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
9112 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
9113 R_386_TLS_DESC_CALL relocations.
9114 (Target_x86_64::Scan::global): Likewise.
9115 (Target_x86_64::do_finalize_sections): Add dynamic table entries
9116 for TLS descriptors.
9117 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
9118 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
9119 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
9120 GD-to-IE relaxation.
9121 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
9122 and TLS_DESCRIPTORS.
9123 * Makefile.in: Rebuild.
9124 * configure: Rebuild.
9125 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
9126 (tls_test_shared2.so): New target.
9127 (tls_shared_gd_to_ie_test_SOURCES): New variable.
9128 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
9129 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
9130 (tls_shared_gd_to_ie_test_LDADD): New variable.
9131 (tls_shared_gnu2_gd_to_ie_test): New target.
9132 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
9134 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
9135 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
9136 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
9137 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
9138 (tls_shared_gnu2_test): New target.
9139 (tls_test_gnu2_shared.so): New target.
9140 (tls_shared_gnu2_test_SOURCES): New variable.
9141 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
9142 (tls_shared_gnu2_test_LDFLAGS): New variable.
9143 (tls_shared_gnu2_test_LDADD): New variable.
9144 * testsuite/Makefile.in: Rebuild.
9145 * testsuite/Makefile.
9147 2008-04-11 Ian Lance Taylor <iant@google.com>
9149 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
9151 * testsuite/Makefile.in: Rebuild.
9153 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
9155 * testsuite/script_test_2.cc (main): Adjust test.
9157 2008-04-11 David S. Miller <davem@davemloft.net>
9158 Ian Lance Taylor <iant@google.com>
9160 * options.h (General_options): Add entries for '-Y' and
9162 * options.cc (General_options:finalize): If -Y was used, add those
9163 entries to the library path instead of the default "/lib" and
9166 2008-04-11 David S. Miller <davem@davemloft.net>
9168 * testsuite/justsyms.t: Start at 0x100.
9169 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
9170 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
9172 * testsuite/script_test_2.cc: Adjust string and section length
9175 2008-04-09 Ian Lance Taylor <iant@google.com>
9178 * script-sections.cc (Sections_element::allocate_to_segment): Add
9180 (Output_section_definition::allocate_to_segment): Likewise.
9181 (Orphan_output_section::allocate_to_segment): Likewise.
9182 (Script_sections::attach_sections_using_phdrs_clause): Don't
9183 propagate non-PT_LOAD segments to orphan sections.
9184 * testsuite/Makefile.am (script_test_3.stdout): Generate using
9185 readelf rather than objdump.
9186 * testsuite/script_test_3.sh: Adjust accordingly. Test that
9187 .interp section and PT_INTERP segment are the same size.
9188 * testsuite/Makefile.in: Rebuild.
9190 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
9191 aliases for symbols defined in the same object.
9192 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
9193 (weak_alias_test_SOURCES): New variable.
9194 (weak_alias_test_DEPENDENCIES): New variable.
9195 (weak_alias_test_LDFLAGS): New variable.
9196 (weak_alias_test_LDADD): New variable.
9197 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
9198 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
9199 (weak_alias_test_3.o): New target.
9200 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
9201 * testsuite/weak_alias_test_main.cc: New file.
9202 * testsuite/weak_alias_test_1.cc: New file.
9203 * testsuite/weak_alias_test_2.cc: New file.
9204 * testsuite/weak_alias_test_3.cc: New file.
9206 2008-04-08 Ian Lance Taylor <iant@google.com>
9208 * options.h (class General_options): Add --noinhibit-exec option.
9209 * main.cc (main): Check --noinhibit-exec.
9211 * options.h (class General_options): Define --wrap as a special
9212 option. Add wrap_symbols_ field.
9213 (General_options::any_wrap_symbols): New function.
9214 (General_options::is_wrap_symbol): New function.
9215 * options.cc (General_options::parse_wrap): New function.
9216 (General_options::General_options): Initialize wrap_symbols_.
9217 * symtab.cc (Symbol_table::wrap_symbol): New function.
9218 (Symbol_table::add_from_object): Handle --wrap.
9219 * symtab.h (class Symbol_table): Declare wrap_symbol.
9220 * target.h (Target::wrap_char): New function.
9221 (Target::Target_info): Add wrap_char field.
9222 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
9223 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9224 * testsuite/testfile.cc (Target_test::test_target_info):
9227 * errors.cc (Errors::undefined_symbol): Mention symbol version if
9230 * layout.h (class Layout): Add added_eh_frame_data_ field.
9231 * layout.cc (Layout::Layout): Initialize new field.
9232 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
9233 output section until we find a section we merged successfully.
9234 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
9235 that the size be non-zero.
9237 * merge.cc (Object_merge_map::get_output_offset): Remove inline
9240 2008-04-08 Craig Silverstein <csilvers@google.com>
9242 * configure.ac: Export new conditional variable HAVE_ZLIB.
9243 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
9245 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
9246 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
9248 2008-04-07 Ian Lance Taylor <iant@google.com>
9250 * version.cc (version_string): Set to "1.5".
9252 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
9253 Add issued_non_pic_error_ field. Declare check_non_pic.
9254 (Target_x86_64::Scan::check_non_pic): New function.
9255 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
9256 (Target_x86_64::Scan::global): Likewise.
9258 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
9259 addend parameter. Change caller. Handle merge sections.
9260 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
9261 Address to Addend. Don't add in the result of
9262 local_section_offset, pass down the addend and use the returned
9264 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
9265 Update declarations of local_section_offset and symbol_value.
9266 * testsuite/two_file_test_1.cc (t18): New function.
9267 * testsuite/two_file_test_2.cc (f18): New function.
9268 * testsuite/two_file_test_main.cc (main): Call t18.
9269 * testsuite/two_file_test.h (t18, f18): Declare.
9271 * configure.ac: Don't test for objdump, c++filt, or readelf.
9272 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
9274 (TEST_READELF): New variable.
9275 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
9276 (check_PROGRAMS): Add two_file_strip_test.
9277 (two_file_strip_test): New target.
9278 (check_PROGRAMS): Add two_file_same_shared_strip_test.
9279 (two_file_same_shared_strip_test_SOURCES): New variable.
9280 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
9281 (two_file_same_shared_strip_test_LDFLAGS): New variable.
9282 (two_file_same_shared_strip_test_LDADD): New variable.
9283 (two_file_shared_strip.so): New target.
9284 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
9285 (ver_test_5.syms, ver_test_7.syms): Likewise.
9286 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
9287 (strip_test_3.stdout): Use TEST_OBJDUMP.
9288 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
9290 2008-04-04 Cary Coutant <ccoutant@google.com>
9292 * symtab.h (Symbol::is_weak_undefined): New function.
9293 (Symbol::is_strong_undefined): New function.
9294 (Symbol::is_absolute): New function.
9295 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
9296 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
9298 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
9299 (weak_undef_test): New target.
9300 * testsuite/Makefile.in: Rebuild.
9301 * testsuite/weak_undef_file1.cc: New file.
9302 * testsuite/weak_undef_file2.cc: New file.
9303 * testsuite/weak_undef_test.cc: New file.
9305 2008-04-03 Craig Silverstein <csilvers@google.com>
9307 * compressed_output.h (class Output_compressed_section): Use
9309 * compressed_output.cc (zlib_compress): Use unsigned buffers,
9311 (zlib_compressed_suffix): Removed.
9312 (Output_compressed_section::set_final_data_size): Use unsigned
9314 * testsuite/Makefile.am (flagstest_compress_debug_sections):
9315 Fix linker invocation.
9316 (flagstest_o_specialfile_and_compress_debug_sections):
9318 * testsuite/Makefile.in: Regenerated.
9320 2008-04-02 David S. Miller <davem@davemloft.net>
9322 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
9323 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
9325 2008-04-02 Craig Silverstein <csilvers@google.com>
9329 2008-04-02 Ian Lance Taylor <iant@google.com>
9331 * fileread.cc (File_read::find_view): Add byteshift and vshifted
9332 parameters. Update for new key type to views_. Change all
9334 (File_read::read): Adjust for byteshift in returned view.
9335 (File_read::add_view): New function, broken out of
9337 (File_read::make_view): New function, broken out of
9339 (File_read::find_or_make_view): Add offset and aligned
9340 parameters. Rewrite accordingly. Change all callers.
9341 (File_read::get_view): Add offset and aligned parameters. Adjust
9342 for byteshift in return value.
9343 (File_read::get_lasting_view): Likewise.
9344 * fileread.h (class File_read): Update declarations.
9345 (class File_read::View): Add byteshift_ field. Add byteshift to
9346 constructor. Add byteshift method.
9347 * archive.h (Archive::clear_uncached_views): New function.
9348 (Archive::get_view): Add aligned parameter. Change all callers.
9349 * object.h (Object::get_view): Add aligned parameter. Change all
9351 (Object::get_lasting_view): Likewise.
9353 * fileread.cc (File_read::release): Don't call clear_views if
9354 there are multiple objects.
9355 * fileread.h (File_read::clear_uncached_views): New function.
9356 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
9359 2008-03-31 Cary Coutant <ccoutant@google.com>
9361 Add thin archive support.
9362 * archive.cc (Archive::armagt): New const.
9363 (Archive::setup): Remove task parameter and calls to unlock.
9364 (Archive::unlock_nested_archives): New function.
9365 (Archive::read_header): Add nested_off parameter. Change
9367 (Archive::interpret_header): Likewise.
9368 (Archive::include_all_members): Change to handle thin
9370 (Archive::include_member): Likewise.
9371 * archive.h (Archive::Archive): Add new parameters and
9373 (Archive::armagt): New const.
9374 (Archive::setup): Remove task parameter.
9375 (Archive::unlock_nested_archives): New function.
9376 (Archive::read_header): Add nested_off parameter.
9377 (Archive::interpret_header): Likewise.
9378 (Archive::Nested_archive_table): New typedef.
9379 (Archive::is_thin_archive_): New field.
9380 (Archive::nested_archives_): New field.
9381 (Archive::options_): New field.
9382 (Archive::dirpath_): New field.
9383 (Archive::task_): New field.
9384 * readsyms.cc (Read_symbols::do_read_symbols): Add check
9385 for thin archives. Pass additional parameters to
9386 Archive::Archive. Unlock the archive file after calling
9389 2008-03-29 Ian Lance Taylor <iant@google.com>
9391 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
9392 version symbol to be local.
9393 * testsuite/ver_test_4.sh: New file.
9394 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
9395 (check_DATA): Add ver_test_4.syms.
9396 (ver_test_4.syms): New target.
9397 * testsuite/Makefile.in: Rebuild.
9400 (Output_section::Input_section_sort_entry::has_priority): New
9402 (Output_section::Input_section_sort_entry::match_file_name): New
9404 (Output_section::Input_section_sort_entry::match_section_name):
9406 (Output_section::Input_section_sort_entry::match_section_name_prefix):
9408 (Output_section::Input_section_sort_entry::match_section_file):
9410 (Output_section::Input_section_sort_compare::operator()): Rewrite
9411 using new Input_section_sort_entry functions. Sort crtbegin and
9412 crtend first. Sort sections with no priority before sections with
9414 * testsuite/initpri1.c (d3): Check j != 4.
9415 (cd5): New constructor/destructor function.
9416 (main): Check j != 2.
9418 * symtab.cc (Symbol_table::add_from_object): If we don't use the
9419 new symbol when resolving, don't call set_is_default.
9420 * testsuite/ver_test_7.cc: New file.
9421 * testsuite/ver_test_7.sh: New file.
9422 * testsuite/Makefile.am (ver_test_7.so): New target.
9423 (ver_test_7.o): New target.
9424 (check_SCRIPTS): Add ver_test_7.sh.
9425 (check_DATA): Add ver_test_7.syms.
9426 (ver_test_7.syms): New target.
9428 2008-03-28 Ian Lance Taylor <iant@google.com>
9430 * layout.cc (Layout::layout): If we see an input section with a
9431 name that needs sorting, set the must_sort flag for the output
9433 (Layout::make_output_section): If the name of the output section
9434 indicates that it might require sorting, set the may_sort flag.
9435 * output.h (Output_section::may_sort_attached_input_sections): New
9437 (Output_section::set_may_sort_attached_input_sections): New
9439 (Output_section::must_sort_attached_input_sections): New
9441 (Output_section::set_must_sort_attached_input_sections): New
9443 (class Output_section): Declare Input_section_sort_entry. Define
9444 Input_section_sort_compare. Declare
9445 sort_attached_input_sections. Add new fields:
9446 may_sort_attached_input_sections_,
9447 must_sort_attached_input_sections_,
9448 attached_input_sections_are_sorted_.
9449 * output.cc (Output_section::Output_section): Initialize new
9451 (Output_section::add_input_section): Add an entry to
9452 input_sections_ if may_sort or must_sort are true.
9453 (Output_section::set_final_data_size): Call
9454 sort_attached_input_sections if necessary.
9455 (Output_section::Input_section_sort_entry): Define new class.
9456 (Output_section::Input_section_sort_compare::operator()): New
9458 (Output_section::sort_attached_input_sections): New function.
9459 * configure.ac: Check whether the compiler supports constructor
9460 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
9461 * testsuite/initpri1.c: New file.
9462 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
9463 CONSTRUCTOR_PRIORITY.
9464 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
9465 (initpri1_LDFLAGS): New variable.
9466 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
9468 2008-03-27 Ian Lance Taylor <iant@google.com>
9470 * common.cc (Sort_commons::operator): Correct sorting algorithm.
9471 * testsuite/common_test_1.c: New file.
9472 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
9473 (common_test_1_SOURCES): New variable.
9474 (common_test_1_DEPENDENCIES): New variable.
9475 (common_test_1_LDFLAGS): New variable.
9477 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
9478 and commons_ correctly when NAME/VERSION does not override
9480 * testsuite/ver_test_6.c: New file.
9481 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
9482 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
9483 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
9485 2008-03-26 Ian Lance Taylor <iant@google.com>
9487 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
9488 of an undefined symbol from a version script.
9489 * testsuite/Makefile.am (ver_test_5.so): New target.
9490 (ver_test_5.o): New target.
9491 (check_SCRIPTS): Add ver_test_5.sh.
9492 (check_DATA): Add ver_test_5.syms.
9493 (ver_test_5.syms): New target.
9494 * testsuite/ver_test_5.cc: New file.
9495 * testsuite/ver_test_5.script: New file.
9496 * testsuite/ver_test_5.sh: New file.
9497 * Makefile.in, testsuite/Makefile.in: Rebuild.
9500 Fix problems building gold with gcc 4.3.0.
9501 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
9502 (gold_error_at_location, gold_warning_at_location): Use it.
9503 * configure.ac: Check whether we can compile and use a template
9504 function with a printf attribute.
9505 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
9506 when jumping over bytes.
9507 * object.cc: Instantiate Object::read_section_data.
9508 * debug.h: Include <cstring>
9509 * dwarf_reader.cc: Include <algorithm>
9510 * main.cc: Include <cstring>.
9511 * options.cc: Include <cstring>.
9512 * output.cc: Include <cstring>.
9513 * script.cc: Include <cstring>.
9514 * script.h: Include <string>.
9515 * symtab.cc: Include <cstring> and <algorithm>.
9516 * target-select.cc: Include <cstring>.
9517 * version.cc: Include <string>.
9518 * testsuite/testmain.cc: Include <cstdlib>.
9519 * configure, config.in: Rebuild.
9521 2008-03-25 Ian Lance Taylor <iant@google.com>
9523 * options.cc: Include "../bfd/bfdver.h".
9524 (options::help): Print bug reporting address.
9526 * version.cc (print_version): Adjust output for current value of
9531 * options.cc (options::help): Print list of supported targets.
9532 * target-select.h: Include <vector>.
9533 (class Target_selector): Make machine_, size_, and is_big_endian_
9534 fields const. Add bfd_name_ and instantiated_target_ fields.
9535 (Target_selector::Target_selector): Add bfd_name parameter.
9536 (Target_selector::recognize): Make non-virtual, call
9538 (Target_selector::recognize_by_name): Make non-virtual, call
9539 do_recognize_by_name.
9540 (Target_selector::supported_names): New function.
9541 (Target_selector::bfd_name): New function.
9542 (Target_selector::do_instantiate_target): New pure virtual
9544 (Target_selector::do_recognize): New virtual function.
9545 (Target_selector::do_recognize_by_name): New virtual function.
9546 (Target_selector::instantiate_target): New private function.
9547 (supported_target_names): Declare.
9548 * target-select.cc (Target_selector::Target_selector): Update for
9549 new parameter and fields.
9550 (select_target_by_name): Check that the name matches before
9551 calling recognize_by_name.
9552 (supported_target_names): New function.
9553 * i386.cc (class Target_selector_i386): Update Target_selector
9554 constructor call. Remove recognize and recognize_by_name. Add
9555 do_instantiate_target.
9556 * x86_64.cc (class Target_selector_x86_64): Likewise.
9557 * testsuite/testfile.cc (class Target_selector_test): Update for
9558 changes to Target_selector.
9560 * README: Rewrite, with some notes on unsupported features.
9562 2008-03-24 Cary Coutant <ccoutant@google.com>
9564 * i386.cc (Target_i386::Got_type): New enum declaration.
9565 (Target_i386::Scan::local): Updated callers of Output_data_got
9567 (Target_i386::Scan::global): Likewise.
9568 (Target_i386::Relocate::relocate): Likewise.
9569 (Target_i386::Relocate::relocate_tls): Likewise.
9570 * object.h (Got_offset_list): New class.
9571 (Sized_relobj::local_has_got_offset): Added got_type parameter.
9572 (Sized_relobj::local_got_offset): Likewise.
9573 (Sized_relobj::set_local_got_offset): Likewise.
9574 (Sized_relobj::local_has_tls_got_offset): Removed.
9575 (Sized_relobj::local_tls_got_offset): Removed.
9576 (Sized_relobj::set_local_tls_got_offset): Removed.
9577 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
9578 * output.cc (Output_data_got::add_global): Added got_type parameter.
9579 (Output_data_got::add_global_with_rel): Likewise.
9580 (Output_data_got::add_global_with_rela): Likewise.
9581 (Output_data_got::add_global_pair_with_rel): New function.
9582 (Output_data_got::add_global_pair_with_rela): New function.
9583 (Output_data_got::add_local): Added got_type parameter.
9584 (Output_data_got::add_local_with_rel): Likewise.
9585 (Output_data_got::add_local_with_rela): Likewise.
9586 (Output_data_got::add_local_pair_with_rel): New function.
9587 (Output_data_got::add_local_pair_with_rela): New function.
9588 (Output_data_got::add_global_tls): Removed.
9589 (Output_data_got::add_global_tls_with_rel): Removed.
9590 (Output_data_got::add_global_tls_with_rela): Removed.
9591 (Output_data_got::add_local_tls): Removed.
9592 (Output_data_got::add_local_tls_with_rel): Removed.
9593 (Output_data_got::add_local_tls_with_rela): Removed.
9594 * output.h (Output_data_got::add_global): Added got_type parameter.
9595 (Output_data_got::add_global_with_rel): Likewise.
9596 (Output_data_got::add_global_with_rela): Likewise.
9597 (Output_data_got::add_global_pair_with_rel): New function.
9598 (Output_data_got::add_global_pair_with_rela): New function.
9599 (Output_data_got::add_local): Added got_type parameter.
9600 (Output_data_got::add_local_with_rel): Likewise.
9601 (Output_data_got::add_local_with_rela): Likewise.
9602 (Output_data_got::add_local_pair_with_rel): New function.
9603 (Output_data_got::add_local_pair_with_rela): New function.
9604 (Output_data_got::add_global_tls): Removed.
9605 (Output_data_got::add_global_tls_with_rel): Removed.
9606 (Output_data_got::add_global_tls_with_rela): Removed.
9607 (Output_data_got::add_local_tls): Removed.
9608 (Output_data_got::add_local_tls_with_rel): Removed.
9609 (Output_data_got::add_local_tls_with_rela): Removed.
9610 * resolve.cc (Symbol::override_base_with_special): Removed
9611 reference to has_got_offset_ field.
9612 * symtab.cc (Symbol::init_fields): Replaced initialization
9613 of got_offset_ with got_offsets_. Removed initialization
9615 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
9616 (Symbol::got_offset): Likewise.
9617 (Symbol::set_got_offset): Likewise.
9618 (Symbol::has_tls_got_offset): Removed.
9619 (Symbol::tls_got_offset): Removed.
9620 (Symbol::set_tls_got_offset): Removed.
9621 (Symbol::got_offset_): Removed.
9622 (Symbol::tls_mod_got_offset_): Removed.
9623 (Symbol::tls_pair_got_offset_): Removed.
9624 (Symbol::got_offsets_): New field.
9625 (Symbol::has_got_offset): Removed.
9626 (Symbol::has_tls_mod_got_offset): Removed.
9627 (Symbol::has_tls_pair_got_offset): Removed.
9628 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
9629 (Target_x86_64::Scan::local): Updated callers of Output_data_got
9631 (Target_x86_64::Scan::global): Likewise.
9632 (Target_x86_64::Relocate::relocate): Likewise.
9633 (Target_x86_64::Relocate::relocate_tls): Likewise.
9635 2008-03-25 Ben Elliston <bje@au.ibm.com>
9637 * yyscript.y: Fix spelling error in comment.
9639 2008-03-24 Ian Lance Taylor <iant@google.com>
9641 * options.h (class General_options): Define build_id option.
9642 * layout.h (class Layout): Declare write_build_id, create_note,
9643 create_build_id. Add build_id_note_ member.
9644 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
9645 "libiberty.h", "md5.h", "sha1.h".
9646 (Layout::Layout): Initialize eh_frame_data_,
9647 eh_frame_hdr_section_, and build_id_note_.
9648 (Layout::finalize): Call create_build_id.
9649 (Layout::create_note): New function, broken out of
9650 Layout::create_gold_note.
9651 (Layout::create_gold_note): Call create_note.
9652 (Layout::create_build_id): New function.
9653 (Layout::write_build_id): New function.
9654 (Close_task_runner::run): Call write_build_id.
9656 * x86_64.cc: Correct license to GPLv3.
9658 2008-03-23 Ian Lance Taylor <iant@google.com>
9660 * options.cc: Include "demangle.h".
9661 (parse_optional_string): New function.
9662 (parse_long_option): Handle takes_optional_argument.
9663 (parse_short_option): Update dash_z initializer. Handle
9664 takes_optional_argument.
9665 (General_options::General_options): Initialize do_demangle_.
9666 (General_options::finalize): Set do_demangle_. Handle demangling
9668 * options.h (parse_optional_string): Declare.
9669 (struct One_option): Add optional_arg field. Update constructor.
9670 Update call constructor calls. Add takes_optional_argument
9672 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
9673 (DEFINE_optional_string): Define.
9674 (General_options::demangle): Change from DEFINE_bool to
9675 DEFINE_optional_string.
9676 (General_options::no_demangle): New function.
9677 (General_options::do_demangle): New function.
9678 (General_options::set_do_demangle): New function.
9679 (General_options::execstack_status_): Move definition to end of
9681 (General_options::static_): Likewise.
9682 (General_options::do_demangle_): New field.
9683 * object.cc (big_endian>::get_symbol_location_info): Call
9684 Options::do_demangle, not Options::demangle.
9685 * symtab.cc (demangle): Likewise.
9687 2008-03-22 Ian Lance Taylor <iant@google.com>
9689 * gold.h: Include <cstddef> and <sys/types.h>
9690 * options.h: Include <cstring>.
9692 2008-03-21 Ian Lance Taylor <iant@google.com>
9694 * Added source code to GNU binutils.