1 2010-11-16 Doug Kwan <dougkwan@google.com>
2 Cary Coutant <ccoutant@google.com>
4 * output.h (Output_segment::set_section_addresses): Pass increase_relro
5 by reference; adjust all callers.
6 * output.cc (Output_segment::set_section_addresses): Adjust references
7 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
9 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
12 2010-11-16 Cary Coutant <ccoutant@google.com>
15 * layout.cc (Layout::choose_output_section): Transform names of
16 compressed sections even when using a script with a SECTIONS clause.
17 (Layout::output_section_name): Remove code to transform
18 compressed debug section names.
19 * output.cc (Output_section::add_input_section): Use uncompressed
20 section size when tracking input sections.
22 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
24 * symtab.h (Symbol::NON_PIC_REF): Remove.
25 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
26 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
27 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
28 (Symbol::use_plt_offset): Take a flags argument and pass it
29 directly to needs_dynamic_reloc. Restrict check for undefined
30 weak symbols to function calls.
31 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
32 (Target_arm::Scan::global): Use it.
33 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
34 (Target_arm::Relocate::relocate): Likewise.
35 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
36 parameter with an r_type parameter. Use get_reference_flags
38 (Target_arm::Relocate::relocate): Update accordingly.
39 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
40 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
41 (Target_i386::Scan::global): Likewise.
42 (Target_i386::Relocate::relocate): Likewise.
43 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
44 parameter with an r_type parameter. Use get_reference_flags
46 (Target_i386::Relocate::relocate): Update accordingly.
47 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
48 (Target_powerpc::Scan::global): Use it.
49 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
50 (Target_powerpc::Relocate::relocate): Likewise.
51 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
52 (Target_sparc::Scan::global): Use it.
53 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
54 (Target_sparc::Relocate::relocate): Likewise.
55 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
56 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
57 (Target_x86_64::Scan::global): Likewise.
58 (Target_x86_64::Relocate::relocate): Likewise.
60 2010-11-08 Doug Kwan <dougkwan@google.com>
61 Cary Coutant <ccoutant@google.com>
63 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
64 (Arm_exidx_merge_section::section_contents_): New data member.
65 (Arm_input_section::Arm_input_section): Initialize original_contents_.
66 (Arm_input_section::~Arm_input_section): De-allocate memory.
67 (Arm_input_section::original_contents_): New data member.
68 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
69 in parameters instead of calling Object::section_contents without
71 (Arm_output_section::group_section): New parameter TASK. Pass it
72 to callees that need locking objects.
73 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
74 to lock EXIDX input sections. Fix a formatting issue. Call
75 Arm_exidx_merged_section::build_contents to create merged section
77 (Arm_output_section::create_stub_group): New parameter TASK. Use it
78 to lock object of stub table owner.
79 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
80 TEXT_SIZE to initialize data member TEXT_SIZE_.
81 (Arm_exidx_input_section::addralign): Fix typo in comment.
82 (Arm_exidx_input_section::text_size): New method.
83 (Target_arm::do_relax): New parameter TASK. Pass it to callees
84 that require locking objects. Lock objects before scanning for stubs
85 and updating local symbols.
86 (Arm_input_section<big_endian>::init): Copy contents of original
88 (Arm_input_section<big_endian>::do_write): Use saved contents of
89 original input section instead of calling Object::section_contents
91 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
92 size without calling Object::section_size().
93 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
94 for size. Allocate a buffer for merged EXIDX entries.
95 (Arm_exidx_merged_section::build_contents): New method.
96 (Arm_exidx_merged_section::do_write): Move merge section contents
97 building code to Arm_exidx_merged_section::build_contetns. Write
98 out contetns in buffer instead of building it on the fly.
99 (Arm_relobj::make_exidx_input_section): Also pass text section size
100 to Arm_exidx_input_section constructor.
101 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
102 (Arm_dynobj::do_read_symbols): Fix memory leak.
103 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
104 * target.h: (class Task): Add forward declaration.
105 (Target::relax): Add new parameter TASK and pass it to
107 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
109 2010-11-05 Cary Coutant <ccoutant@google.com>
112 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
113 object when reading from the file.
114 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
116 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
117 when reading section contents.
118 (get_section_contents): Likewise.
119 (icf::find_identical_sections): Likewise.
120 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
121 object when reading from the file.
122 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
123 the object when doing deferred section layout.
125 2010-11-03 Nick Clifton <nickc@redhat.com>
128 * script.h (class Symbol_assignment: name): New member. Returns
129 the name of the symbol.
130 * scrfipt.cc (Script_options::is_pending_assignment): New member.
131 Returns true if the given symbol name is on the list of
132 assignments wating to be processed.
133 * archive.cc (should_incldue_member): If the symbol is undefined,
134 check to see if it is on the list of symbols pending assignment.
136 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
138 * script-sections.cc (Script_sections::find_memory_region): Check
139 for a NULL output section pointer.
141 2010-10-29 Doug Kwan <dougkwan@google.com>
143 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
144 Output_section::add_relaxed_input_section.
145 * output.cc (Output_section::add_relaxed_input_section): Add new
146 arguments LAYOUT and NAME. Set section order index.
147 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
148 Copy section order index.
149 * output.h (Output_section::add_relaxed_input_section): Add new
150 arguments LAYOUT and NAME.
152 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
154 * testsuite/Makefile.am: Move gcctestdir/ld rule to
155 NATIVE_OR_CROSS_LINKER.
156 * testsuite/Makefile.in: Regenerate.
158 2010-10-20 Doug Kwan <dougkwan@google.com>
160 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
161 without SHF_LINK_ORDER flags.
162 * layout.cc (Layout::choose_output_section): Do not filter
163 SHF_LINK_ORDER flag in a relocatable link.
165 2010-10-17 Cary Coutant <ccoutant@google.com>
167 * output.h (Output_segment::set_section_addresses): Change function
168 signature. Update all callers.
169 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
171 (Output_segment::set_section_addresses): Align after last TLS
172 section. Add padding before last relro section instead of after.
174 2010-10-17 Doug Kwan <dougkwan@google.com>
176 * gold/arm.cc (Target_arm::got_section): Use correct order and set
177 GOT output section to be writable.
179 2010-10-14 Cary Coutant <ccoutant@google.com>
181 * debug.h (DEBUG_INCREMENTAL): New flag.
182 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
183 * gold.cc (queue_initial_tasks): Check parameters for incremental link
185 * incremental.cc (report_command_line): Ignore all forms of
187 * layout.cc (Layout::Layout): Check parameters for incremental link
189 * options.cc (General_options::parse_incremental): New function.
190 (General_options::parse_no_incremental): New function.
191 (General_options::parse_incremental_full): New function.
192 (General_options::parse_incremental_update): New function.
193 (General_options::incremental_mode_): New data member.
194 (General_options::finalize): Check incremental_mode_.
195 * options.h (General_options): Update help text for --incremental.
196 Add --no-incremental, --incremental-full, --incremental-update.
197 (General_options::Incremental_mode): New enum type.
198 (General_options::incremental_mode): New function.
199 (General_options::incremental_mode_): New data member.
200 * parameters.cc (Parameters::incremental_mode_): New data member.
201 (Parameters::set_options): Set incremental_mode_.
202 (Parameters::set_incremental_full): New function.
203 (Parameters::incremental): New function.
204 (Parameters::incremental_update): New function.
205 (set_parameters_incremental_full): New function.
206 * parameters.h (Parameters::set_incremental_full): New function.
207 (Parameters::incremental): New function.
208 (Parameters::incremental_update): New function.
209 (Parameters::incremental_mode_): New data member.
210 (set_parameters_incremental_full): New function.
211 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
212 incremental link mode.
213 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
214 (Sized_relobj::do_relocate_sections): Likewise.
215 * testsuite/Makefile.am (incremental_test): Use --incremental-full
217 * testsuite/Makefile.in: Regenerate.
218 * testsuite/incremental_test.sh: Filter all forms of --incremental.
220 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
222 * script-sections.h (class Script_sections): Make
223 Sections_elements typedef public.
224 * script-sections.cc (class Sort_output_sections): Add elements_
225 field. Add constructor which sets it; change all callers.
226 (Sort_output_sections::is_before): New function.
227 (Sort_output_sections::operator()): Call is_before.
228 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
230 * testsuite/script_test_10.sh: New test. Test script section
232 * testsuite/script_test_10.t: Likewise.
233 * testsuite/script_test_10.s: Likewise.
234 * testsuite/Makefile.am: Wrap the cross linker tests and the
235 common tests into NATIVE_OR_CROSS_LINKER.
236 (check_SCRIPTS): Add script_test_10.sh.
237 (check_DATA): Add script_test_10.stdout.
238 (script_test_10.o, script_test_10): New targets.
239 (script_test_10.stdout): New target.
240 * configure, testsuite/Makefile.in: Regenerate.
242 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
244 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
245 error for the deprecated relocations.
246 (Target_arm::Scan::global): Likewise.
247 (Target_arm::Relocate::relocate): Likewise.
249 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
251 * fileread.cc (Input_file::find_file): Initialize *found_name
252 and *namep when using the fallback search for case 4.
254 2010-10-11 Cary Coutant <ccoutant@google.com>
256 * options.h (class General_options): Redefine -z lazy as an alias for
257 the negation of -z now.
259 2010-10-11 Ian Lance Taylor <iant@google.com>
261 * resolve.cc (symbol_to_bits): Report the value of the unsupported
264 2010-10-06 Nick Clifton <nickc@redhat.com>
266 * script-sections.cc(class Memory_region): Remove
267 current_lma_offset_ field. Rename current_vma_offset_ to
268 current_offset_. Add last_section_ field.
269 (Memory_region::get_current_vma_address): Rename to
271 (Memory_region::get_current_lma_address): Delete.
272 (Memory_region::increment_vma_offset): Rename to
274 (Memory_region::increment_lma_offset): Delete.
275 (Memory_region::attributes_compatible): New method. Returns
276 true if the provided section is compatible with the region.
277 (Memory_region::get_last_section): New method. Returns the last
278 section to use the region.
279 (Memory_region::set_last_section): New method. Stores the last
280 section to use the region.
281 (Script_sections::block_in_region): New method. Returns true if
282 a block of memory is contained within a region.
283 (Script_sections::find_memory_region): New method. Locates a
284 memory region to be used to set a VMA or LMA address.
285 (Output_section_definition::set_section_addresses): Add code to
286 check for addresses set by memory regions.
287 (Output_segment::set_section_addresses): Remove memory region
289 (Script_sections::create_segment): Add a warning if a header
290 segment is created outside of any region.
291 * script-sections.h (class Script_sections): Add prototypes for
292 find_memory_region and block_in_region methods.
293 * testsuite/memory_test.s: Use .long instead of .word.
294 * testsuite/memory_test.t: Add some more output sections.
295 * testsuite/memory_test.sh: Update expected output.
297 2010-10-02 Doug Kwan <dougkwan@google.com>
299 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
300 defintion to symtab.h
301 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
302 declaration to defintion.
304 2010-10-01 Nick Clifton <nickc@redhat.com>
306 * expression.cc (eval): Replace dummy argument with NULL.
307 (eval_maybe_dot): Check for a NULL result section pointer.
308 (Symbol_expression::value): Likewise.
309 (Dot_expression::value): Likewise.
310 (BINARY_EXPRESSION): Likewise.
311 (Max_expression::value): Likewise.
312 (Min_expression::value): Likewise.
313 (Absolute_expression::value): Likewise.
314 (Addr_expression::value_from_output_section): Likewise.
315 (Loaddddr_expression::value_from_output_section): Likewise.
316 (Segment_start_expression::value): Likewise.
318 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
320 (Sections_elememt_dot_assignment::set_section_addresses):
322 (Output_data_expression::do_write_to_buffer): Likewise.
323 (Output_section_definition::finalize_symbols): Likewise.
324 (Output_section_definition::set_section_addresses): Likewise.
326 2010-09-30 Doug Kwan <dougkwan@google.com>
328 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
330 2010-09-28 Sriraman Tallam <tmsriram@google.com>
332 * target.h (Target::can_icf_inline_merge_sections): New virtual
334 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
336 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
338 * icf.cc (get_section_contents): Inline merge sections only when
341 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
343 * configure: Regenerate.
345 2010-09-17 Ian Lance Taylor <iant@google.com>
347 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
348 * testsuite/Makefile.am (memory_test.o): New target.
349 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
351 * testsuite/Makefile.in: Rebuild.
353 2010-09-17 Doug Kwan <dougkwan@google.com>
355 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
356 defintion if relocation uses GOT entries of the symbol.
357 * testsuite/icf_safe_test.sh: Fix test.
358 * testsuite/icf_safe_so_test.sh: Fix test.
360 2010-09-16 Cary Coutant <ccoutant@google.com>
362 * script_sections.cc (class Memory_region): Remove "NULL" from
363 vector initializations.
365 2010-09-15 Cary Coutant <ccoutant@google.com>
367 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
368 Resolve forwarding symbols.
370 2010-09-15 Doug Kwan <dougkwan@google.com>
372 * gold/testsuite/script_test_3.t: Add ARM special sections.
373 * gold/testsuite/script_test_4.t: Same.
374 * gold/testsuite/script_test_5.t: Same.
375 * gold/testsuite/script_test_6.t: Same.
376 * gold/testsuite/script_test_7.t: Same.
377 * gold/testsuite/script_test_7.t: Same.
378 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
380 2010-09-14 Cary Coutant <ccoutant@google.com>
382 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
383 (Target_x86_64::Relocate::relocate_tls): Replace check for
384 saw_tls_block_reloc_ with test for executable section.
386 2010-09-12 Cary Coutant <ccoutant@google.com>
388 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
389 position-independent executables to shared libraries need dynamic
391 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
392 position-independent executables.
393 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
394 * testsuite/Makefile.in: Regenerate.
396 2010-09-10 Nick Clifton <nickc@redhat.com>
399 * testsuite/memory_test.t: Discard any sections that are not
402 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
405 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
406 "This::" to work around a bug in gcc 4.2.
408 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
410 2010-09-09 Rafael Espindola <espindola@google.com>
412 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
413 sections with different PF_X flags in the same segment.
414 (Layout::find_first_load_seg): Search all segments to find the first
416 * options.h (rosegment): New.
418 2010-09-08 Rafael Espindola <espindola@google.com>
420 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
422 2010-09-08 Doug Kwan <dougkwan@google.com>
424 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
425 (Arm_relobj::do_relocate_sections): Add new parameter for output
426 file to match the parent.
427 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
428 of local symbols instead of input values. Update code to track
429 changes in gold::relocate_section.
430 * object.cc (Sized_relobj::compute_final_local_value): New methods.
431 (Sized_relobj::compute_final_local_value_internal): New methods.
432 (Sized_relobj::do_finalize_local_symbols): Move code from loop
433 body into private version of Sized_relobj::compute_final_local_value.
434 Call the inline method.
435 * object.h (Symbol_value::Symbol_value): Define destructor. Free
436 merged symbol value if there is one.
437 (Symbol_value::has_output_value): New method defintiion.
438 (Sized_relobj::Compute_final_local_value_status): New enum type.
439 (Sized_relobj::compute_final_local_value): New methods.
440 (Sized_relobj::compute_final_local_value_internal): New methods.
441 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
442 and arm_cortex_a8.sh.
443 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
444 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
446 * Makefile.in: Regenerate.
447 * testsuite/arm_bl_out_of_range.s: Update test.
448 * testsuite/thumb_bl_out_of_range.s: Ditto.
449 * testsuite/thumb_blx_out_of_range.s: Ditto.
450 * testsuite/arm_branch_out_of_range.sh: New file.
451 * testsuite/arm_cortex_a8.sh: Ditto.
452 * testsuite/arm_cortex_a8_b.s: Ditto.
453 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
454 * testsuite/arm_cortex_a8_b_local.s: Ditto.
455 * testsuite/arm_cortex_a8_bl.s: Ditto.
456 * testsuite/arm_cortex_a8_blx.s: Ditto.
457 * testsuite/arm_cortex_a8_local.s: Ditto.
458 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
459 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
461 2010-09-08 Rafael Espindola <espindola@google.com>
463 * Makefile.am (memory_test.stdout): Run readelf with -W.
464 * Makefile.in: Regenerate.
465 * testsuite/memory_test.sh: Make the regexps accept both 32 and
468 2010-09-08 Rafael Espindola <espindola@google.com>
470 * script-sections.cc (Script_sections::add_memory_region): Convert
471 field precision to int.
472 * script.cc (script_set_section_region, script_set_section_region):
473 Convert field precision to int.
475 2010-09-08 Rafael Espindola <espindola@google.com>
477 * arm.cc (do_finalize_sections): Create the __exidx_start and
478 __exdix_end symbols even when the section is missing.
480 2010-09-08 Nick Clifton <nickc@redhat.com>
482 * README: Remove claim that MEMORY is not supported.
483 * expression.cc (script_exp_function_origin)
484 (script_exp_function_length): Move from here to ...
485 * script.cc: ... here.
486 (script_set_section_region, script_add_memory)
487 (script_parse_memory_attr, script_include_directive): New
490 (class Memory_region): New class.
491 (class Output_section_definition): Add set_memory_region,
492 set_section_vma, set_section_lma and get_section_name methods.
493 (class Script_Sections): Add add_memory_region,
494 find_memory_region, find_memory_region_origin,
495 find_memory_region_length and set_memory_region methods.
496 Have set_section_addresses method walk the list of set memory
498 Extend the print methos to display memory regions.
499 * script-sections.h: Add prototypes for new methods.
500 Add enum for MEMORY region attributes.
501 * yyscript.y: Add support for parsing MEMORY regions.
502 * script-c.h: Add prototypes for new functions.
503 * testsuite/Makefile.am: Add test of MEMORY region functionality.
504 * testsuite/Makefile.in: Regenerate.
505 * testsuite/memory_test.sh: New script.
506 * testsuite/memory_test.s: New assembler source file.
507 * testsuite/memory_test.t: New linker script.
509 2010-08-27 Doug Kwan <dougkwan@google.com>
511 * gold/resolve.cc (Symbol_table::should_override): Let a weak
512 reference override an existing dynamic weak reference.
513 * testsuite/Makefile.am: Add new test dyn_weak_ref.
514 * testsuite/Makefile.in: Regenerate.
515 * testsuite/dyn_weak_ref.sh: New file.
516 * testsuite/dyn_weak_ref_1.c: Ditto.
517 * testsuite/dyn_weak_ref_2.c: Ditto.
519 2010-08-27 Ian Lance Taylor <iant@google.com>
521 * incremental.h (class Incremental_input_entry): Add virtual
524 2010-08-27 Ian Lance Taylor <iant@google.com>
526 * testsuite/start_lib_test_3.c: Mark t3 as used.
528 2010-08-27 Nick Clifton <nickc@redhat.com>
530 * options.cc (version_script): Fix small typo in previous
533 2010-08-25 Nick Clifton <nickc@redhat.com>
535 * archive.cc: Formatting fixes: Remove whitespace between
536 typename and following asterisk. Remove whitespace between
537 function name and opening parenthesis.
538 * archive.h: Likewise.
540 * attributes.cc: Likewise.
541 * attributes.h: Likewise.
542 * common.cc: Likewise.
543 * copy-relocs.cc: Likewise.
544 * dirsearch.h: Likewise.
545 * dynobj.cc: Likewise.
546 * ehframe.cc: Likewise.
547 * ehframe.h: Likewise.
548 * expression.cc: Likewise.
549 * fileread.cc: Likewise.
550 * fileread.h: Likewise.
552 * gold-threads.cc: Likewise.
556 * incremental-dump.cc: Likewise.
557 * incremental.cc: Likewise.
558 * layout.cc: Likewise.
559 * layout.h: Likewise.
561 * merge.cc: Likewise.
563 * object.cc: Likewise.
564 * object.h: Likewise.
565 * options.cc: Likewise.
566 * options.h: Likewise.
567 * output.cc: Likewise.
568 * output.h: Likewise.
569 * plugin.cc: Likewise.
570 * plugin.h: Likewise.
571 * powerpc.cc: Likewise.
572 * reloc.cc: Likewise.
573 * script-c.h: Likewise.
574 * script-sections.cc: Likewise.
575 * script.cc: Likewise.
576 * stringpool.cc: Likewise.
577 * symtab.cc: Likewise.
578 * symtab.h: Likewise.
579 * target.cc: Likewise.
580 * timer.cc: Likewise.
582 * version.cc: Likewise.
583 * x86_64.cc: Likewise.
585 2010-08-24 Nick Clifton <nickc@redhat.com>
588 * layout.cc (segment_precedes): Sort segments by their physical
589 addresses, if they have been set.
591 2010-08-23 Cary Coutant <ccoutant@google.com>
593 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
595 (Lib_group::include_member): Unlock object after deleting its
597 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
600 2010-08-19 Neil Vachharajani <nvachhar@google.com>
601 Cary Coutant <ccoutant@google.com>
603 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
604 constructor, and set_blocker.
605 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
607 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
608 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
609 * testsuite/Makefile.am (start_lib_test): New test case.
610 * testsuite/Makefile.in: Regenerate.
611 * testsuite/start_lib_test_main.c: New file.
612 * testsuite/start_lib_test_1.c: New file.
613 * testsuite/start_lib_test_2.c: New file.
614 * testsuite/start_lib_test_3.c: New file.
616 2010-08-19 Ian Lance Taylor <iant@google.com>
618 * Makefile.in: Rebuild with automake 1.11.1.
619 * aclocal.m4: Likewise.
620 * testsuite/Makefile.in: Likewise.
622 2010-08-19 Ian Lance Taylor <iant@google.com>
625 * i386.cc (class Output_data_plt_i386): Update declarations.
626 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
627 local_ifuncs_ fields.
628 (Target_i386::do_plt_section_for_global): New function.
629 (Target_i386::do_plt_section_for_local): New function.
630 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
631 parameter; change all callers. Initialize global_ifuncs_ and
632 local_ifuncs_. If doing a static link define __rel_iplt_start and
634 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
635 (Output_data_plt_i386::add_local_ifunc_entry): New function.
636 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
638 (Target_i386::make_plt_section): New function, broken out of
639 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
640 (Target_i386::make_plt_entry): Call make_plt_section.
641 (Target_i386::make_local_ifunc_plt_entry): New function.
642 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
643 (Target_i386::Scan::local): Handle IFUNC symbols. Add
644 R_386_IRELATIVE to switch.
645 (Target_i386::Scan::global): Likewise.
646 (Target_i386::Relocate::relocate): Likewise.
647 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
649 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
650 (Target_x86_64::do_plt_section_for_global): New function.
651 (Target_x86_64::do_plt_section_for_local): New function.
652 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
653 parameter; change all callers. If doing a static link define
654 __rela_iplt_start and __rela_iplt_end.
655 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
656 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
657 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
659 (Target_x86_64::make_local_ifunc_plt_entry): New function.
660 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
662 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
663 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
664 R_X86_64_IRELATIVE to switch.
665 (Target_x86_64::Scan::global): Likewise.
666 (Target_x86_64::Relocate::relocate): Likewise.
667 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
669 * target.h (class Target): Add plt_section_for_global and
670 plt_section_for_local functions. Add do_plt_section_for_global
671 and do_plt_section_for_local virtual functions.
672 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
674 (Symbol::use_plt_offset): Handle IFUNC symbol.
675 * object.cc (Sized_relobj::Sized_relobj): Initialize
677 (Sized_relobj::local_has_plt_offset): New function.
678 (Sized_relobj::local_plt_offset): New function.
679 (Sized_relobj::set_local_plt_offset): New function.
680 (Sized_relobj::do_count): Handle IFUNC symbol.
681 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
682 a bit away from input_shndx_ field. Add set_is_func_symbol and
683 is_ifunc_symbol functions.
684 (class Sized_relobj): Update declarations. Remove Tls_got_entry
685 and Local_tls_got_offsets. Define Local_plt_offsets. Add
686 local_plt_offsets_ field.
687 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
688 * output.h (class Output_section_data): Add non-const
689 output_section function.
690 (class Output_data_got): Update declarations.
691 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
692 Add use_plt_offset parameter to global and local constructors.
693 Change all callers. Change local_sym_index_ field to 31 bits.
694 Change GSYM_CODE and CONSTANT_CODE accordingly.
695 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
696 doing a static link don't set sh_link field.
697 (Output_data_got::Got_entry::write): Use PLT offset if
699 (Output_data_got::add_global_plt): New function.
700 (Output_data_got::add_local_plt): New function.
701 * target-reloc.h (relocate_section): Handle IFUNC symbol.
702 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
703 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
704 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
705 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
707 * testsuite/ifunc-sel.h: New file.
708 * testsuite/ifuncmain1.c: New file.
709 * testsuite/ifuncmain1vis.c: New file.
710 * testsuite/ifuncmod1.c: New file.
711 * testsuite/ifuncdep2.c: New file.
712 * testsuite/ifuncmain2.c: New file.
713 * testsuite/ifuncmain3.c: New file.
714 * testsuite/ifuncmod3.c: New file.
715 * testsuite/ifuncmain4.c: New file.
716 * testsuite/ifuncmain5.c: New file.
717 * testsuite/ifuncmod5.c: New file.
718 * testsuite/ifuncmain6pie.c: New file.
719 * testsuite/ifuncmod6.c: New file.
720 * testsuite/ifuncmain7.c: New file.
721 * configure, testsuite/Makefile.in: Rebuild.
723 2010-08-18 Ian Lance Taylor <iant@google.com>
726 (Output_section_incremental_inputs::write_input_files): Add cast
727 to avoid signed/unsigned comparison warning.
728 (Output_section_incremental_inputs::write_info_blocks): Likewise.
730 2010-08-12 Cary Coutant <ccoutant@google.com>
732 * common.cc (Sort_commons::operator()): Remove unnecessary code.
734 2010-08-13 Ian Lance Taylor <iant@google.com>
736 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
738 2010-08-12 Cary Coutant <ccoutant@google.com>
739 Doug Kwan <dougkwan@google.com>
741 * resolve.cc (Symbol_table::should_override): When a weak dynamic
742 defintion overrides non-weak undef, remember that the original undef
744 * symtab.cc (Symbol_table::sized_write_global): For undef without
745 an original weak binding, set binding to global in output.
746 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
747 * testsuite/Makefile.in: Regenerate.
748 * testsuite/strong_ref_weak_def.sh: New file.
749 * testsuite/strong_ref_weak_def_1.c: Ditto.
750 * testsuite/strong_ref_weak_def_2.c: Ditto.
752 2010-08-12 Cary Coutant <ccoutant@google.com>
754 * testsuite/incremental_test.sh: Rewrite.
755 * testsuite/incremental_test_1.c: Rewrite.
756 * testsuite/incremental_test_2.c: Rewrite.
758 2010-08-12 Cary Coutant <ccoutant@google.com>
760 * arm.cc (Target_arm::got_size): Add const.
761 (Target_arm::got_entry_count): New function.
762 (Target_arm::plt_entry_count): New function.
763 (Target_arm::first_plt_entry_offset): New function.
764 (Target_arm::plt_entry_size): New function.
765 (Output_data_plt_arm::entry_count): New function.
766 (Output_data_plt_arm::first_plt_entry_offset): New function.
767 (Output_data_plt_arm::get_plt_entry_size): New function.
768 * i386.cc (Target_i386::got_size): Add const.
769 (Target_i386::got_entry_count): New function.
770 (Target_i386::plt_entry_count): New function.
771 (Target_i386::first_plt_entry_offset): New function.
772 (Target_i386::plt_entry_size): New function.
773 (Output_data_plt_i386::entry_count): New function.
774 (Output_data_plt_i386::first_plt_entry_offset): New function.
775 (Output_data_plt_i386::get_plt_entry_size): New function.
776 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
777 find_incremental_inputs_sections. Dump incremental_got_plt section.
778 * incremental.cc: Include target.h.
779 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
780 parameter. Adjust all callers. Find incremental_got_plt section.
781 (Incremental_inputs::create_data_sections): Create incremental_got_plt
783 (Output_section_incremental_inputs::set_final_data_size): Calculate
784 size of incremental_got_plt section.
785 (Output_section_incremental_inputs::do_write): Write the
786 incremental_got_plt section.
787 (Got_plt_view_info): New struct.
788 (Local_got_offset_visitor): New class.
789 (Global_got_offset_visitor): New class.
790 (Global_symbol_visitor_got_plt): New class.
791 (Output_section_incremental_inputs::write_got_plt): New function.
792 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
793 Add parameter. Adjust all callers.
794 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
795 (Incremental_inputs::got_plt_section): New function.
796 (Incremental_inputs::got_plt_section_): New data member.
797 (Incremental_got_plt_reader): New class.
798 * layout.cc (Layout::create_incremental_info_sections): Add the
799 incremental_got_plt section.
800 * object.h (Got_offset_list::get_list): New function.
801 (Got offset_list::for_all_got_offsets): New function.
802 (Sized_relobj::local_got_offset_list): New function.
803 * powerpc.cc (Target_powerpc::got_size): Add const.
804 (Target_powerpc::got_entry_count): New function.
805 (Target_powerpc::plt_entry_count): New function.
806 (Target_powerpc::first_plt_entry_offset): New function.
807 (Target_powerpc::plt_entry_size): New function.
808 (Output_data_plt_powerpc::entry_count): New function.
809 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
810 (Output_data_plt_powerpc::get_plt_entry_size): New function.
811 * sparc.cc (Target_sparc::got_size): Add const.
812 (Target_sparc::got_entry_count): New function.
813 (Target_sparc::plt_entry_count): New function.
814 (Target_sparc::first_plt_entry_offset): New function.
815 (Target_sparc::plt_entry_size): New function.
816 (Output_data_plt_sparc::entry_count): New function.
817 (Output_data_plt_sparc::first_plt_entry_offset): New function.
818 (Output_data_plt_sparc::get_plt_entry_size): New function.
819 * symtab.h (Symbol::got_offset_list): New function.
820 (Symbol_table::for_all_symbols): New function.
821 * target.h (Sized_target::got_entry_count): New function.
822 (Sized_target::plt_entry_count): New function.
823 (Sized_target::plt_entry_size): New function.
824 * x86_64.cc (Target_x86_64::got_size): Add const.
825 (Target_x86_64::got_entry_count): New function.
826 (Target_x86_64::plt_entry_count): New function.
827 (Target_x86_64::first_plt_entry_offset): New function.
828 (Target_x86_64::plt_entry_size): New function.
829 (Output_data_plt_x86_64::entry_count): New function.
830 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
831 (Output_data_plt_x86_64::get_plt_entry_size): New function.
833 2010-08-12 Cary Coutant <ccoutant@google.com>
835 * archive.cc: Include incremental.h.
836 (Archive::Archive): Initialize incremental_info_.
837 (Archive::include_member): Record archive members in incremental info.
838 (Add_archive_symbols::run): Record begin and end of an archive in
840 (Lib_group::include_member): Record objects in incremental info.
841 * archive.h (Incremental_archive_entry): Forward declaration.
842 (Archive::set_incremental_info): New member function.
843 (Archive::incremental_info): New member function.
844 (Archive::Unused_symbol_iterator): New class.
845 (Archive::unused_symbols_begin): New member function.
846 (Archive::unused_symbols_end): New member function.
847 (Archive::incremental_info_): New data member.
848 * incremental-dump.cc (find_input_containing_global): New function.
849 (dump_incremental_inputs): Dump new incremental info sections.
850 * incremental.cc: Include symtab.h.
851 (Output_section_incremental_inputs): New class.
852 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
853 new incremental info sections.
854 (Sized_incremental_binary::do_check_inputs): Likewise.
855 (Incremental_inputs::report_archive): Remove.
856 (Incremental_inputs::report_archive_begin): New function.
857 (Incremental_inputs::report_archive_end): New function.
858 (Incremental_inputs::report_object): New function.
859 (Incremental_inputs::finalize_inputs): Remove.
860 (Incremental_inputs::report_input_section): New function.
861 (Incremental_inputs::report_script): Rewrite.
862 (Incremental_inputs::finalize): Do nothing but finalize string table.
863 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
864 (Incremental_inputs::sized_create_inputs_section_data): Remove.
865 (Incremental_inputs::create_data_sections): New function.
866 (Incremental_inputs::relocs_entsize): New function.
867 (Output_section_incremental_inputs::set_final_data_size): New function.
868 (Output_section_incremental_inputs::do_write): New function.
869 (Output_section_incremental_inputs::write_header): New function.
870 (Output_section_incremental_inputs::write_input_files): New function.
871 (Output_section_incremental_inputs::write_info_blocks): New function.
872 (Output_section_incremental_inputs::write_symtab): New function.
873 * incremental.h (Incremental_script_entry): Forward declaration.
874 (Incremental_object_entry): Forward declaration.
875 (Incremental_archive_entry): Forward declaration.
876 (Incremental_inputs): Forward declaration.
877 (Incremental_inputs_header_data): Remove.
878 (Incremental_inputs_header): Remove.
879 (Incremental_inputs_header_write): Remove.
880 (Incremental_inputs_entry_data): Remove.
881 (Incremental_inputs_entry): Remove.
882 (Incremental_inputs_entry_write): Remove.
883 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
884 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
885 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
886 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
888 (Incremental_input_entry): New class.
889 (Incremental_script_entry): New class.
890 (Incremental_object_entry): New class.
891 (Incremental_archive_entry): New class.
892 (Incremental_inputs::Incremental_inputs): Initialize new data members.
893 (Incremental_inputs::report_inputs): Remove.
894 (Incremental_inputs::report_archive): Remove.
895 (Incremental_inputs::report_archive_begin): New function.
896 (Incremental_inputs::report_archive_end): New function.
897 (Incremental_inputs::report_object): Change prototype.
898 (Incremental_inputs::report_input_section): New function.
899 (Incremental_inputs::report_script): Change prototype.
900 (Incremental_inputs::get_reloc_count): New function.
901 (Incremental_inputs::set_reloc_count): New function.
902 (Incremental_inputs::create_data_sections): New function.
903 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
904 (Incremental_inputs::inputs_section): New function.
905 (Incremental_inputs::symtab_section): New function.
906 (Incremental_inputs::relocs_section): New function.
907 (Incremental_inputs::get_stringpool): Add const.
908 (Incremental_inputs::command_line): Add const.
909 (Incremental_inputs::inputs): Remove.
910 (Incremental_inputs::command_line_key): New function.
911 (Incremental_inputs::input_file_count): New function.
912 (Incremental_inputs::input_files): New function.
913 (Incremental_inputs::relocs_entsize): New function.
914 (Incremental_inputs::sized_create_inputs_section_data): Remove.
915 (Incremental_inputs::finalize_inputs): Remove.
916 (Incremental_inputs::Input_info): Remove.
917 (Incremental_inputs::lock_): Remove.
918 (Incremental_inputs::inputs_): Change type.
919 (Incremental_inputs::inputs_map_): Remove.
920 (Incremental_inputs::current_object_entry_): New data member.
921 (Incremental_inputs::inputs_section_): New data member.
922 (Incremental_inputs::symtab_section_): New data member.
923 (Incremental_inputs::relocs_section_): New data member.
924 (Incremental_inputs::reloc_count_): New data member.
925 (Incremental_inputs_reader): New class.
926 (Incremental_symtab_reader): New class.
927 (Incremental_relocs_reader): New class.
928 * layout.cc (Layout::finalize): Move finalization of incremental info
929 and creation of incremental info sections to follow finalization of
930 symbol table. Set offsets for postprocessing sections.
931 (Layout::create_incremental_info_sections): Call
932 Incremental_inputs::create_data_sections. Add incremental symtab
933 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
934 sections to layout after input sections.
935 * layout.h (struct Timespec): Forward declaration.
936 (Layout::incremental_inputs): Add const.
937 (Layout::create_incremental_info_sections): Add parameter.
938 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
939 * object.cc: Include incremental.h.
940 (Relobj::finalize_incremental_relocs): New function.
941 (Sized_relobj::do_layout): Record input sections in incremental info.
942 * object.h (Object::output_section): New function.
943 (Object::output_section_offset): Moved from Relobj.
944 (Object::get_incremental_reloc_base): New function.
945 (Object::get_incremental_reloc_count): New function.
946 (Object::do_output_section): New function.
947 (Object::do_output_section_offset): Moved from Relobj.
948 (Object::do_get_incremental_reloc_base): New function.
949 (Object::do_get_incremental_reloc_count): New function.
950 (Object::Object): Initialize new data members.
951 (Relobj::output_section): Renamed do_output_section and moved to
953 (Relobj::output_section_offset): Moved to Object.
954 (Relobj::do_get_incremental_reloc_base): New function.
955 (Relobj::do_get_incremental_reloc_count): New function.
956 (Relobj::allocate_incremental_reloc_counts): New function.
957 (Relobj::count_incremental_reloc): New function.
958 (Relobj::finalize_incremental_relocs): New function.
959 (Relobj::next_incremental_reloc_index): New function.
960 (Relobj::reloc_counts_): New data member.
961 (Relobj::reloc_bases_): New data member.
962 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
963 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
964 (Sized_relobj::incremental_relocs_scan): New function.
965 (Sized_relobj::incremental_relocs_scan_reltype): New function.
966 (Sized_relobj::incremental_relocs_write): New function.
967 (Sized_relobj::incremental_relocs_write_reltype): New function.
968 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
970 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
971 archives and object files elsewhere.
972 (Add_symbols::run): Report object files here.
973 (Finish_group::run): Report end of archive at end of group.
974 * reloc.cc: Include layout.h, incremental.h.
975 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
976 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
977 (Sized_relobj::incremental_relocs_scan): New function.
978 (Sized_relobj::incremental_relocs_scan_reltype): New function.
979 (Sized_relobj::do_relocate_sections): Write incremental relocations.
980 (Sized_relobj::incremental_relocs_write): New function.
981 (Sized_relobj::incremental_relocs_write_reltype): New function.
982 * script.cc (read_input_script): Rewrite test for incremental link.
983 Change call to Incremental_inputs::report_script.
984 * symtab.h (Symbol_table::first_global_index): New function.
985 (Symbol_table::output_count): New function.
987 2010-08-12 Doug Kwan <dougkwan@google.com>
989 * arm.cc (Target_arm::merge_object_attributes): Check command line
990 options --no-wchar-size-warning and --no-enum-size-warning.
991 * options.h (General_options): Add ld-compatible options
992 --no-enum-size-warning and --no-wchar-size-warning.
994 2010-08-04 Ian Lance Taylor <iant@google.com>
996 * x86_64.cc (Target_x86_64::Scan::local): Use
997 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
998 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
999 (Target_x86_64::Scan::global): Likewise.
1000 (Target_x86_64::Relocate::relocate): Likewise.
1001 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
1004 2010-08-03 Cary Coutant <ccoutant@google.com>
1006 * merge.cc (Output_merge_string::do_add_input_section): Count strings
1007 to reserve space in merged_strings vector. Keep total input size
1009 (Output_merge_string::do_print_merge_stats): Print total input size.
1010 * merge.h (Output_merge_string): Add input_size_ field.
1011 * stringpool.cc (Stringpool_template::string_length): Move
1012 implementations out of Stringpool_template class and place in
1014 * stringpool.h (string_length): Move out of Stringpool_template.
1016 2010-08-03 Ian Lance Taylor <iant@google.com>
1019 * layout.cc (relaxation_loop_body): If address of load segment is
1020 set, adjust address to include headers if possible.
1022 2010-08-03 Ian Lance Taylor <iant@google.com>
1024 * version.cc (version_string): Bump to 1.10.
1026 2010-08-03 Ian Lance Taylor <iant@google.com>
1029 * layout.h (enum Output_section_order): Define.
1030 (class Layout): Update declarations.
1031 * layout.cc (Layout::get_output_section): Add order parameter.
1032 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
1033 is_first_non_relro parameters. Change all callers.
1034 (Layout::choose_output_section): Likewise.
1035 (Layout::add_output_section_data): Likewise.
1036 (Layout::make_output_section): Likewise. Set order.
1037 (Layout::default_section_order): New function.
1038 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
1039 * output.cc (Output_section::Output_section): Initialize order_.
1040 Don't initialize deleted fields.
1041 (Output_segment::Output_segment): Don't initialize deleted
1043 (Output_segment::add_output_section_to_load): New function
1044 replacing add_output_section. Change all callers to call this or
1045 add_output_section_to_nonload.
1046 (Output_segment::add_output_section_to_nonload): New function.
1047 (Output_segment::remove_output_section): Rewrite.
1048 (Output_segment::add_initial_output_data): Likewise.
1049 (Output_segment::has_any_data_sections): Likewise.
1050 (Output_segment::is_first_section_relro): Likewise.
1051 (Output_segment::maximum_alignment): Likewise.
1052 (Output_segment::has_dynamic_reloc): New function replacing
1053 dynamic_reloc_count. Change all callers.
1054 (Output_segment::has_dynamic_reloc_list): New function replacing
1055 dynamic_reloc_count_list. Change all callers.
1056 (Output_segment::set_section_addresses): Rewrite.
1057 (Output_segment::set_offset): Rewrite.
1058 (Output_segment::find_first_and_last_list): Remove.
1059 (Output_segment::set_tls_offsets): Rewrite.
1060 (Output_segment::first_section_load_address): Likewise.
1061 (Output_segment::output_section_count): Likewise.
1062 (Output_segment::section_with_lowest_load_address): Likewise.
1063 (Output_segment::write_section_headers): Likewise.
1064 (Output_segment::print_sections_to_map): Likewise.
1065 * output.h (class Output_data): Remove dynamic_reloc_count_
1066 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
1067 (Output_data::add_dynamic_reloc): Rewrite.
1068 (Output_data::has_dynamic_reloc): New function.
1069 (Output_data::dynamic_reloc_count): Remove.
1070 (class Output_section): Add order_ field. Remvoe is_relro_local_,
1071 is_last_relro_, is_first_non_relro_, is_interp_,
1072 is_dynamic_linker_section_ fields. Add order and set_order
1073 functions. Remove is_relro_local, set_is_relro_local,
1074 is_last_relro, set_is_last_relro, is_first_non_relro,
1075 set_is_first_non_relro functions, is_interp, set_is_interp,
1076 is_dynamic_linker_section, and set_is_dynamic_linker_section
1078 (class Output_segment): Change Output_data_list from std::list to
1079 std:;vector. Add output_lists_ field. Remove output_data_ and
1080 output_bss_ fields. Update declarations.
1082 2010-08-02 Ian Lance Taylor <iant@google.com>
1084 * arm.cc (Target_arm::gc_process_relocs): Use typename.
1085 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
1086 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
1088 2010-08-02 Ian Lance Taylor <iant@google.com>
1091 * script.cc (Script_options::Script_options): Initialize
1092 symbol_definitions_ and symbol_references_.
1093 (Script_options::add_symbol_assignment): Update
1094 symbol_definitions_ and symbol_references_.
1095 (Script_options::add_symbol_reference): New function.
1096 (script_symbol): New function.
1097 * script.h (class Script_options): Add symbol_definitions_ and
1098 symbol_references_ fields.
1099 (Script_options::referenced_const_iterator): New type.
1100 (Script_options::referenced_begin): New function.
1101 (Script_options::referenced_end): New function.
1102 (Script_options::is_referenced): New function.
1103 (Script_options::any_unreferenced): New function.
1104 * script-c.h (script_symbol): Declare.
1105 * yyscript.y (exp): Call script_symbol.
1106 * symtab.cc: Include "script.h".
1107 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
1108 Change all callers. Check symbols referenced by scripts.
1109 (Symbol_table::add_undefined_symbols_from_command_line): Add
1110 layout parameter. Change all callers.
1111 (Symbol_table::do_add_undefined_symbols_from_command_line):
1112 Likewise. Break out loop body. Check symbols referenced by
1114 (Symbol_table::add_undefined_symbol_from_command_line): New
1115 function broken out of
1116 do_add_undefined_symbols_from_command_line.
1117 * symtab.h (class Symbol_table): Update declarations.
1118 * archive.cc: Include "layout.h".
1119 (Archive::should_include_member): Add layout parameter. Change
1120 all callers. Check for symbol mentioned in expression.
1121 * archive.h (class Archive): Update declaration.
1122 * object.cc (Sized_relobj::do_should_include_member): Add layout
1124 * object.h (Object::should_include_member): Add layout parameter.
1126 (Object::do_should_include_member): Add layout parameter.
1127 (class Sized_relobj): Update declaration.
1128 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
1130 * dynobj.h (class Sized_dynobj): Update declaration.
1131 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
1133 * plugin.h (class Sized_pluginobj): Update declaration.
1135 2010-08-02 Ian Lance Taylor <iant@google.com>
1138 * output.cc (Output_segment::set_offset): Search for the first and
1139 last sections rather than assuming that the list is in order.
1140 (Output_segment::find_first_and_last_list): New function.
1141 * output.h (class Output_segment): Update declarations.
1142 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
1143 (relro_strip_test_SOURCES): New variable.
1144 (relro_strip_test_DEPENDENCIES): New variable.
1145 (relro_strip_test_LDFLAGS): New variable.
1146 (relro_strip_test_LDADD): New variable.
1147 (relro_strip_test.so): New target.
1149 2010-08-02 Ian Lance Taylor <iant@google.com>
1151 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
1152 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
1153 (Target_i386::got_tlsdesc_section): New function.
1154 (Target_i386::got_section): Create space for GOT entries for
1155 TLSDESC relocations.
1156 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
1158 (Target_i386::Scan::global): Likewise.
1159 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
1161 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
1162 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
1163 (Target_x86_64::got_tlsdesc_section): New function.
1164 (Target_x86_64::got_section): Create space for GOT entries for
1165 TLSDESC relocations.
1166 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
1168 (Target_x86_64::Scan::global): Likewise.
1169 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
1172 2010-08-02 Ian Lance Taylor <iant@google.com>
1174 * testsuite/final_layout.sh: Use dc to convert from hex to
1177 2010-07-29 Sriraman Tallam <tmsriram@google.com>
1179 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
1180 paramter to the call to gold::gc_process_relocs.
1181 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
1182 paramter to the call to gold::gc_process_relocs.
1183 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
1184 parameter to the call to gold::gc_process_relocs.
1185 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
1186 template parameter to the call to gold::gc_process_relocs.
1187 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
1188 paramter to the call to gold::gc_process_relocs.
1189 * gc.h (get_embedded_addend_size): New function.
1190 (gc_process_relocs): Save the size of the reloc for use by ICF.
1191 * icf.cc (get_section_contents): Get the addend from the text section
1192 for SHT_REL relocation sections.
1193 * icf.h (Icf::Reloc_addend_size_info): New typedef.
1194 (Icf::Reloc_info): Add new member reloc_addend_size_info.
1195 * int_encoding.h (read_from_pointer): New overloaded function.
1196 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
1197 * testsuite/icf_sht_rel_addend_test.sh: New file.
1198 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
1199 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
1201 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1203 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
1204 * Makefile.in: Regenerate.
1205 * testsuite/Makefile.in: Regenerate.
1207 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
1209 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
1210 * gold/testsuite/debug_msg.cc: Likewise.
1211 * gold/testsuite/odr_violation1.cc
1212 * gold/testsuite/odr_violation2.cc
1214 2010-07-21 Cary Coutant <ccoutant@google.com>
1216 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
1217 string, and length fields.
1218 (Output_merge_string::Merged_strings_list): New type.
1219 (Output_merge_string::Merged_strings_lists): New typedef.
1220 (Output_merge_string): Replace merged_strings_ with
1221 merged_strings_lists_.
1222 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
1223 Merged_strings_list per input object and section. Don't store pointer
1224 to the string. Don't store length with each merged string entry.
1225 (Output_merge_string::finalize_merged_data): Loop over list of merged
1226 strings lists. Recompute length of each merged string.
1228 2010-07-15 Cary Coutant <ccoutant@google.com>
1230 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
1233 2010-07-14 Ian Lance Taylor <iant@google.com>
1235 * descriptors.cc (Descriptors::open): Report correct name in error
1238 2010-07-13 Doug Kwan <dougkwan@google.com>
1240 * arm.cc (Arm_input_section::Arm_input_section): For a
1241 SHT_ARM_EXIDX section, always keeps the input sections.
1242 (Arm_input_section::set_exidx_section_link): New method.
1243 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
1244 has_errors_ to false.
1245 (Arm_exidx_input_section::has_errors,
1246 Arm_exidx_input_section::set_has_errors): New methods.
1247 (Arm_exidx_input_section::has_errors_): New data member.
1248 (Arm_relobj::get_exidx_shndx_list): New method.
1249 (Arm_output_section::append_text_sections_to_list): Do not skip
1250 section without SHF_EXECINSTR.
1251 (Arm_output_section::fix_exidx_coverage): Skip input sections with
1253 (Arm_relobj::make_exidx_input_section): Add new parameter for text
1254 section header. Make error messages more verbose. Check for
1255 a non-executable section linked to an EXIDX section.
1256 (Arm_relobj::do_read_symbols): Remove error checking, which has been
1257 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
1258 check that there is no deferred EXIDX section if we exit early.
1259 Instead of not making an EXIDX section in case of an error, make one
1260 and set the has_errors flag of it.
1261 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
1262 in a relocatable link.
1263 (Target_arm::do_relax): Look for the EXIDX output section instead of
1264 assuming that it is called .ARM.exidx.
1265 (Target_arm::fix_exidx_coverage): Add a new parameter for input
1266 section list. Do not check for SHF_EXECINSTR section flags but
1267 skip any input section with errors.
1268 * output.cc (Output_section::Output_section): Initialize
1269 always_keeps_input_sections_ to false.
1270 (Output_section::add_input_section): Check for
1271 always_keeps_input_sections_.
1272 * output.h (Output_section::always_keeps_input_sections,
1273 Output_section::set_always_keeps_input_sections): New methods.
1274 (Output_section::always_keeps_input_sections): New data member.
1276 2010-07-13 Rafael Espindola <espindola@google.com>
1278 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
1279 * fileread.h (Input_file): Add try_extra_search_path and find_file.
1281 2010-07-13 Philip Herron <herron.philip@googlemail.com>
1282 Ian Lance Taylor <iant@google.com>
1284 * output.h (Output_section_lookup_maps::add_merge_section):
1285 Correct check of whether value was inserted.
1286 (Output_section_lookup_maps::add_merge_input_section): Likewise.
1287 (Output_section_lookup_maps::add_relaxed_input_section):
1289 * arm.cc (Target_arm::got_section): Remove used local os.
1290 * i386.cc (Target_i386::got_section): Likewise.
1291 * x86_64.cc (Target_x86_64::got_section): Likewise.
1292 * sparc.cc (Target_sparc::got_section): Likewise.
1293 (Target_sparc::relocate): Remove unused local have_got_offset.
1294 * powerpc.cc (Target_powerpc::relocate): Likewise.
1296 2010-07-13 Ian Lance Taylor <iant@google.com>
1298 * compressed_output.cc (zlib_decompress): Fix signature in
1301 * archive.cc (Archive::include_member): Unlock an external member
1302 of a thin archive. Don't bother to delete an object we know is
1305 2010-07-12 Cary Coutant <ccoutant@google.com>
1307 * compressed_output.cc (zlib_decompress): New function.
1308 (get_uncompressed_size): New function.
1309 (decompress_input_section): New function.
1310 * compressed_output.h (get_uncompressed_size): New function.
1311 (decompress_input_section): New function.
1312 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
1313 Handle compressed debug sections.
1314 * layout.cc (is_compressed_debug_section): New function.
1315 (Layout::output_section_name): Map compressed section names to
1317 * layout.h (is_compressed_debug_section): New function.
1318 (is_debug_info_section): Recognize compressed debug sections.
1319 * merge.cc: Include compressed_output.h.
1320 (Output_merge_data::do_add_input_section): Handle compressed
1322 (Output_merge_string::do_add_input_section): Handle compressed
1324 * object.cc: Include compressed_output.h.
1325 (Sized_relobj::Sized_relobj): Initialize new data members.
1326 (build_compressed_section_map): New function.
1327 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
1328 * object.h (Object::section_is_compressed): New method.
1329 (Object::do_section_is_compressed): New method.
1330 (Sized_relobj::Compressed_section_map): New type.
1331 (Sized_relobj::do_section_is_compressed): New method.
1332 (Sized_relobj::compressed_sections_): New data member.
1333 * output.cc (Output_section::add_input_section): Handle compressed
1335 * reloc.cc: Include compressed_output.h.
1336 (Sized_relobj::write_sections): Handle compressed debug sections.
1338 2010-07-08 Cary Coutant <ccoutant@google.com>
1340 * resolve.cc (Symbol_table::resolve): Remember whether undef was
1341 weak when resolving to a dynamic def.
1342 (Symbol_table::should_override): Add adjust_dyndef flag; set it
1343 for weak undef/dynamic def cases. Adjust callers.
1344 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
1345 undef_binding_weak_.
1346 (Symbol_table::sized_write_globals): Adjust symbol binding.
1347 (Symbol_table::sized_write_symbol): Add binding parameter.
1348 * symtab.h (Symbol::set_undef_binding): New method.
1349 (Symbol::is_undef_binding_weak): New method.
1350 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
1351 (Symbol_table::should_override): Add new parameter.
1352 (Symbol_table::sized_write_symbol): Add new parameter.
1354 * testsuite/weak_undef_file1.cc: Add new test case.
1355 * testsuite/weak_undef_file2.cc: Fix header comment.
1356 * testsuite/weak_undef_test.cc: Add new test case.
1358 2010-06-29 Doug Kwan <dougkwan@google.com>
1360 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
1361 Initialize USE_SYMBOL_.
1362 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
1364 (Arm_reloc_property::uses_symbol_): New data member declaration.
1365 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
1366 uses symbol value and symbol is undefined but not weakly undefined.
1368 2010-06-28 Rafael Espindola <espindola@google.com>
1370 * plugin.cc (Plugin::load): Use dlerror.
1372 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
1374 * symtab.cc (detect_odr_violations): When reporting an ODR
1375 violation, report an object where the symbol is defined.
1377 2010-06-25 Doug Kwan <dougkwan@google.com>
1379 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
1380 (Target_arm::section_may_have_icf_unsafe_pointers): New method
1382 (Target_arm::Scan::local_reloc_may_be_function_pointer,
1383 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
1384 target hook to detect function points.
1385 (Target_arm::Scan::possible_function_pointer_reloc): New method.
1386 * icf.h (Icf::check_section_for_function_pointers): Change type of
1387 parameter SECTION_NAME to const reference to std::string. Use
1388 target hook to determine if section may have unsafe pointers.
1389 * target.h (Target::section_may_have_icf_unsafe_pointers): New
1392 2010-06-21 Rafael Espindola <espindola@google.com>
1394 * fileread.cc (Input_file::find_fie): New
1395 (Input_file::open): Use Input_file::find_fie.
1396 * fileread.h (Input_file::find_fie): New
1397 * plugin.cc (set_extra_library_path): New.
1398 (Plugin::load): Add set_extra_library_path to the transfer vector.
1399 (Plugin_manager::set_extra_library_path): New.
1400 (Plugin_manager::add_input_file): Use the extra search path if set.
1401 (set_extra_library_path(): New.
1402 * plugin.h (Plugin_manager): Add set_extra_library_path and
1405 2010-06-19 Cary Coutant <ccoutant@google.com>
1407 * layout.cc (gdb_sections): Add .debug_types.
1408 (lines_only_debug_sections): Likewise.
1410 2010-06-18 Rafael Espindola <espindola@google.com>
1412 * plugin.cc (add_input_file,add_input_library)
1413 (Plugin_manager::add_input_file): Make filename arguments const.
1414 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
1417 2010-06-16 Doug Kwan <dougkwan@google.com>
1419 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
1420 .ARM.attributes section if we have not merged any input
1421 attributes sections.
1423 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1425 * arm.cc: Allow combining objects with no EABI version
1428 2010-06-15 Rafael Espindola <espindola@google.com>
1430 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
1432 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1434 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
1435 (struct iovec): Correct !HAVE_READV definition.
1437 2010-06-10 Cary Coutant <ccoutant@google.com>
1439 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
1440 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
1442 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
1445 * symtab.h (Symbol::is_placeholder): New member function.
1446 * target-reloc.h (relocate_section): Check for placeholder symbols.
1448 * testsuite/Makefile.am (plugin_test_8): New test.
1449 (plugin_test_9): New test.
1450 * testsuite/Makefile.in: Regenerate.
1452 2010-06-09 Nick Clifton <nickc@redhat.com>
1454 * yyscript.y (input_list_element): Allow strings prefixed with
1455 the '-' character. Treat these as libraries.
1456 * script.cc (script_add_library): New function. Adds a library
1457 specified by "-l<name>" found in an input script.
1458 * script-c.h: Add prototype for script_add_library.
1460 2010-06-07 Doug Kwan <dougkwan@google.com>
1462 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
1463 Restrict stub-group size to be within long conditional branch
1464 range when working around cortex-A8 erratum.
1466 2010-06-07 Damien Diederen <dd@crosstwine.com>
1468 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
1471 2010-06-03 Sriraman Tallam <tmsriram@google.com>
1475 (Output_section::Input_section_sort_entry::compare_section_ordering):
1476 Change to return non-zero correctly.
1477 (Output_section::Input_section_sort_section_order_index_compare
1478 ::operator()): Change to fix ambiguity in comparisons.
1480 2010-06-01 Sriraman Tallam <tmsriram@google.com>
1482 * gold.h (is_wildcard_string): New function.
1483 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
1484 (Layout::layout_eh_frame): Ditto.
1485 (Layout::find_section_order_index): New method.
1486 (Layout::read_layout_from_file): New method.
1487 * layout.h (Layout::find_section_order_index): New method.
1488 (Layout::read_layout_from_file): New method.
1489 (Layout::input_section_position_): New private member.
1490 (Layout::input_section_glob_): New private member.
1491 * main.cc (main): Call read_layout_from_file here.
1492 * options.h (--section-ordering-file): New option.
1493 * output.cc (Output_section::input_section_order_specified_): New
1495 (Output_section::Output_section): Initialize new member.
1496 (Output_section::add_input_section): Add new parameter.
1497 Keep input sections when --section-ordering-file is used.
1498 (Output_section::set_final_data_size): Sort input sections when
1499 section ordering file is specified.
1500 (Output_section::Input_section_sort_entry): Add new parameter.
1502 (Output_section::Input_section_sort_entry::compare_section_ordering):
1504 (Output_section::Input_section_sort_compare::operator()): Change to
1505 consider section_order_index.
1506 (Output_section::Input_section_sort_init_fini_compare::operator()):
1507 Change to consider section_order_index.
1508 (Output_section::Input_section_sort_section_order_index_compare
1509 ::operator()): New method.
1510 (Output_section::sort_attached_input_sections): Change to sort
1511 according to section order when specified.
1512 (Output_section::add_input_section<32, true>): Add new parameter.
1513 (Output_section::add_input_section<64, true>): Add new parameter.
1514 (Output_section::add_input_section<32, false>): Add new parameter.
1515 (Output_section::add_input_section<64, false>): Add new parameter.
1516 * output.h (Output_section::add_input_section): Add new parameter.
1517 (Output_section::input_section_order_specified): New
1519 (Output_section::set_input_section_order_specified): New method.
1520 (Input_section::Input_section): Initialize section_order_index_.
1521 (Input_section::section_order_index): New method.
1522 (Input_section::set_section_order_index): New method.
1523 (Input_section::section_order_index_): New member.
1524 (Input_section::Input_section_sort_section_order_index_compare): New
1526 (Output_section::input_section_order_specified_): New member.
1527 * script-sections.cc (is_wildcard_string): Delete and move modified
1529 (Output_section_element_input::Output_section_element_input): Modify
1530 call to is_wildcard_string.
1531 (Output_section_element_input::Input_section_pattern
1532 ::Input_section_pattern): Ditto.
1533 (Output_section_element_input::Output_section_element_input): Ditto.
1534 * testsuite/Makefile.am (final_layout): New test case.
1535 * testsuite/Makefile.in: Regenerate.
1536 * testsuite/final_layout.cc: New file.
1537 * testsuite/final_layout.sh: New file.
1539 2010-06-01 Rafael Espindola <espindola@google.com>
1541 * plugin.cc (Plugin::load): Pass the output name to the plugin.
1543 2010-06-01 Rafael Espindola <espindola@google.com>
1545 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
1546 visibility of symbols.
1548 2010-05-27 Doug Kwan <dougkwan@google.com>
1550 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
1551 from start of output section instead of address for a local symbol
1552 in a merged or relaxed section when doing a relocatable link.
1554 2010-05-26 Rafael Espindola <espindola@google.com>
1557 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
1558 adding sections the garbage collector removed.
1559 * gold/testsuite/Makefile.am: Add test.
1560 * gold/testsuite/Makefile.in: Regenerate.
1561 * gold/testsuite/plugin_test_7.sh: New.
1562 * gold/testsuite/plugin_test_7_1.c: New.
1563 * gold/testsuite/plugin_test_7_2.c: New.
1565 2010-05-26 Rafael Espindola <espindola@google.com>
1567 * script-sections.cc (Output_section_definition::set_section_addresses):
1568 Check for --section-start.
1570 2010-05-26 Doug Kwan <dougkwan@google.com>
1572 * arm.cc (Arm_scan_relocatable_relocs): New class.
1573 (Target_arm::relocate_special_relocatable): New method.
1574 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
1575 (Arm_relocate_functions::thumb_branch_common): Same.
1576 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
1577 instead of Default_scan_relocatable_relocs.
1578 * target-reloc.h (relocate_for_relocatable): Let target handle
1579 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
1580 * target.h (Sized_target::relocate_special_relocatable): New method.
1582 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1584 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
1586 2010-05-23 Doug Kwan <dougkwan@google.com>
1588 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
1590 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
1591 with a direct branch, not a conditional branch, to a stub.
1592 * merge.cc (Output_merge_base::record_input_section): New method
1594 (Output_merge_data::do_add_input_section): Record input section if
1595 keeps-input-sections flag is set.
1596 (Output_merge_string::do_add_input_section): Ditto.
1597 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
1598 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
1600 (Output_merge_base::keeps_input_sections,
1601 Output_merge_base::set_keeps_input_sections,
1602 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
1604 (Output_merge_base::Input_sections): New type declaration.
1605 (Output_merge_base::input_sections_begin,
1606 Output_merge_base::input_sections_end,
1607 Output_merge_base::do_set_keeps_input_sections): New method definitions.
1608 (Output_merge_base::bool keeps_input_sections_,
1609 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
1610 Output_merge_base::input_sections_): New data members.
1611 (Output_merge_data::do_set_keeps_input_sections): New method
1613 (Output_merge_string::do_set_keeps_input_sections): Ditto.
1614 * output.cc (Output_section::Input_section::relobj): Move method
1615 defintion from class declaration to here and handle merge sections.
1616 (Output_section::Input_section::shndx): Ditto.
1617 (Output_section::Output_section): Remove initializations of removed
1618 data members and initialize new data member LOOKUP_MAPS_.
1619 (Output_section::add_input_section): Set keeps-input-sections flag
1620 for a newly created merge output section as appropriate. Adjust code
1621 to use Output_section_lookup_maps class.
1622 (Output_section::add_relaxed_input_section): Adjst code for lookup
1623 maps code refactoring.
1624 (Output_section::add_merge_input_section): Add a new parameter
1625 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
1626 class. If adding input section to a newly created merge output
1627 section fails, remove the new merge section.
1628 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
1629 Adjust code for use of the Output_section_lookup_maps class.
1630 (Output_section::find_merge_section): Ditto.
1631 (Output_section::build_lookup_maps): New method defintion.
1632 (Output_section::find_relaxed_input_section): Adjust code to use
1633 Output_section_lookup_maps class.
1634 (Output_section::get_input_sections): Export merge sections. Adjust
1635 code to use Output_section_lookup_maps class.
1636 (Output_section:::add_script_input_section): Adjust code to use
1637 Output_section_lookup_maps class. Update lookup maps for merge
1639 (Output_section::discard_states): Use Output_section_lookup_maps.
1640 (Output_section::restore_states): Same.
1641 * output.h (Merge_section_properties): Move class defintion out of
1643 (Output_section_lookup_maps): New class.
1644 (Output_section::Input_section::is_merge_section): New method
1646 (Output_section::Input_section::relobj): Move defintion out of class
1647 defintion. Declare method only.
1648 (Output_section::Input_section::shndx): Ditto.
1649 (Output_section::Input_section::output_merge_base): New method defintion.
1650 (Output_section::Input_section::u2_.pomb): New union field.
1651 (Output_section::Merge_section_by_properties_map,
1652 Output_section::Output_section_data_by_input_section_map,
1653 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
1655 (Output_section::add_merge_input_section): Add new parameter
1656 KEEPS_INPUT_SECTIONS.
1657 (Output_section::build_lookup_maps): New method declaration.
1658 (Output_section::merge_section_map_,
1659 Output_section::merge_section_by_properties_map_,
1660 Output_section::relaxed_input_section_map_,
1661 Output_section::is_relaxed_input_section_map_valid_): Remove data
1663 (Output_section::lookup_maps_): New data member.
1665 2010-05-21 Doug Kwan <dougkwan@google.com>
1668 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
1669 avoid a compilation error.
1671 2010-05-19 Rafael Espindola <espindola@google.com>
1673 * script-sections.cc (Output_section_definition::allocate_to_segment):
1674 Update the phdrs_list even when the output section is NULL.
1675 * testsuite/Makefile.am: Add test.
1676 * testsuite/Makefile.in: Regenerate.
1677 * testsuite/script_test_9.cc: New.
1678 * testsuite/script_test_9.sh: New.
1679 * testsuite/script_test_9.t: New.
1681 2010-05-19 Doug Kwan <dougkwan@google.com>
1683 * arm.cc (Arm_input_section::original_size): New method.
1684 (Arm_input_section::do_addralign): Add a cast.
1685 (Arm_input_section::do_output_offset): Remove static cast.
1686 (Arm_input_section::original_addralign,
1687 Arm_input_section::original_size_): Change type to uint32_t.
1688 (Arm_input_section::init): Add safe casts for section alignment
1690 (Arm_input_section::set_final_data_size): Do not set address and
1691 offset of stub table.
1692 (Arm_output_section::fix_exidx_coverage): Change use of of
1693 Output_section::Simple_input_section to that of
1694 Output_section::Input_section.
1695 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
1696 except for the first pass.
1697 * output.cc (Output_section::get_input_sections): Change type of
1698 input_sections to std::list<Input_section>.
1699 (Output_section::add_script_input_section): Rename from
1700 Output_section::add_simple_input_section. Change type of SIS
1701 parameter from Simple_input_section to Input_section.
1702 * output.h (Output_section::Simple_input_section): Remove class.
1703 (Output_section::Input_section): Change class visibility to public.
1704 (Output_section::Input_section::addralign): Use stored alignments
1705 for special input sections if set.
1706 (Output_section::Input_section::set_addralign): New method.
1707 (Output_section::get_input_sections): Change parameter type from
1708 list of Simple_input_section to list of Input_section.
1709 (Output_section::add_script_input_section): Rename from
1710 Output_section::add_simple_input_section. Change first parameter's
1711 type from Simple_input_section to Input_section and remove the
1712 second and third parameters.
1713 * script-sections.cc (Input_section::Input_section_list): Change
1714 type to list of Output_section::Input_section/
1715 (Input_section_info::Input_section_info): Change parameter type of
1716 INPUT_SECTION to Output_section::Input_section.
1717 (Input_section_info::input_section): Change return type.
1718 (Input_section_info::input_section_): Change type to
1719 Output_section::Input_section.
1720 (Output_section_element_input::set_section_addresses): Adjust code
1721 to use Output_section::Input_section instead of
1722 Output_section::Simple_input_section. Adjust code for renaming
1723 of Output_section::add_simple_input_section.
1724 (Orphan_output_section::set_section_addresses): Ditto.
1726 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1728 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
1729 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
1731 2010-05-18 Rafael Espindola <espindola@google.com>
1733 * options.cc (General_options::finalize): Handle -nostdlib.
1734 * options.h (nostdlib): New option.
1735 * script.cc (script_add_search_dir): Handle -nostdlib.
1737 2010-05-12 Doug Kwan <dougkwan@google.com>
1739 * arm.cc (Target_arm::do_finalize_sections): Create an empty
1740 attributes section only if there no attributes section after merging.
1741 (Target_arm::merge_object_attributes): Move value of
1742 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
1743 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
1744 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
1745 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
1746 and arm_attr_merge_7.stdout.
1747 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
1748 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
1749 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
1750 arm_attr_merge_7b.o): New rules.
1751 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
1753 * testsuite/Makefile.in: Regenerate.
1754 * testsuite/arm_attr_merge.sh: New file.
1755 * testsuite/arm_attr_merge_[67][ab].s: Same.
1757 2010-05-05 Nick Clifton <nickc@redhat.com>
1759 * po/es.po: Updated Spanish translation.
1761 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
1763 * Makefile.am (install-exec-local): Properly install gold as
1764 default cross linker.
1765 * Makefile.in: Regenerated.
1767 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
1768 Nick Clifton <nickc@redhat.com>
1770 * configure.ac (install_as_default): Define and set to false
1771 unless --enable-gold or --enable-gold=both/gold has been
1773 * configure: Regenerate.
1775 * Makefile.am (install-exec-local): Install the executable as
1776 'ld.gold'. If install_as_default is true then also install it as
1778 * Makefile.in: Regenerated.
1780 2010-04-24 Ian Lance Taylor <iant@google.com>
1782 * layout.cc (Layout::layout_reloc): In relocatable link don't
1783 combine reloc sections for grouped sections.
1785 2010-04-23 Sriraman Tallam <tmsriram@google.com>
1787 * gc.h (gc_process_relocs): Pass information on relocs pointing to
1788 sections that are not ordinary to icf.
1789 * icf.cc (get_section_contents): Handle relocation pointing to section
1790 with no object or shndx information.
1791 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
1792 * testsuite/Makefile.in: Regenerate.
1793 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
1794 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
1796 2010-04-22 Ian Lance Taylor <iant@google.com>
1798 * expression.cc (Expression::Expression_eval_info): Add
1799 result_alignment_pointer field.
1800 (Expression::eval_with_dot): Add result_alignment_pointer
1801 parameter. Change all callers.
1802 (Expression::eval_maybe_dot): Likewise.
1803 (class Binary_expression): Add alignment_pointer parameter to
1804 left_value and right_value. Change all callers.
1805 (BINARY_EXPRESSION): Set result alignment.
1806 (class Trinary_expression): Add alignment_pointer parameter to
1807 arg2_value and arg3_value. Change all callers.
1808 (Trinary_cond::value): Set result alignment.
1809 (Max_expression::value, Min_expression::value): Likewise.
1810 (Align_expression::value): Likewise.
1811 * script-sections.cc (class Sections_element): Add dot_alignment
1812 parameter to set_section_addresses virtual function. Update
1814 (class Output_section_element): Likewise.
1815 (Script_sections::create_segments): Add dot_alignment parameter.
1817 (Script_sections::create_segments_from_phdrs_clause): Likewise.
1818 (Script_sections::set_phdrs_clause_addresses): Likewise.
1819 * script-sections.h: Update declarations.
1820 * script.h: Update declarations.
1821 * output.h (Output_segment::set_minimum_p_align): Don't decrease
1823 * testsuite/script_test_3.t: Set large alignment.
1824 * testsuite/script_test_3.sh: Make sure that at least one LOAD
1825 segment has expected alignment.
1827 2010-04-22 Nick Clifton <nickc@redhat.com>
1829 * po/gold.pot: Updated by the Translation project.
1830 * po/vi.po: Updated Vietnamese translation.
1832 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
1834 * testsuite/Makefile.am (check_PROGRAMS): Add
1835 icf_virtual_function_folding_test.
1836 * testsuite/Makefile.in: Regenerated.
1838 2010-04-15 Andrew Haley <aph@redhat.com>
1840 * options.h (merge_exidx_entries): New option.
1841 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
1842 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
1843 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
1844 (Target_arm::merge_exidx_entries): New function.
1845 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
1846 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
1847 to Arm_exidx_fixup constructor.
1848 Add new arg, merge_exidx_entries.
1849 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
1850 Arm_output_section::fix_exidx_coverage.
1852 2010-04-18 Sriraman Tallam <tmsriram@google.com>
1854 * icf.cc (get_section_contents): Check for preemptible functions.
1855 Ignore addend when appropriate.
1856 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
1858 (add_from_relobj): Check for section folded.
1859 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
1860 * symtab.h (should_add_dynsym_entry): Add new parameter.
1861 * target-reloc.h (scan_relocs): Check for section folded.
1862 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
1863 Check reloc types for function pointers in shared objects.
1864 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
1866 (icf_preemptible_functions_test): New test case.
1867 (icf_string_merge_test): New test case.
1868 * testsuite.Makefile.in: Regenerate.
1869 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
1870 bar_glob. Refactor code.
1871 * testsuite/icf_preemptible_functions_test.cc: New file.
1872 * testsuite/icf_preemptible_functions_test.sh: New file.
1873 * testsuite/icf_string_merge_test.cc: New file.
1874 * testsuite/icf_string_merge_test.sh: New file.
1875 * testsuite/icf_virtual_function_folding_test.cc: New file.
1876 * testsuite/icf_virtual_function_folding_test.sh: New file.
1878 2010-04-14 Doug Kwan <dougkwan@google.com>
1880 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
1881 for local symbol recounting if we remove a section due to ICF.
1882 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
1883 there are no regular objects in input.
1885 2010-04-13 Doug Kwan <dougkwan@google.com>
1887 * arm.cc (Arm_input_section::set_final_data_size): Compute
1888 accurate final data size instead of using current data size.
1890 2010-04-09 Doug Kwan <dougkwan@google.com>
1892 * layout.cc (Layout::choose_output_section): Handle script section
1894 (Layout::make_output_section_for_script): Add section type parameter.
1895 Handle script section types.
1896 * layout.h (Layout::make_output_section_for_script): Add section
1898 * output.cc (Output_section::Output_section): Initialize data member
1900 (Output_section::do_reset_address_and_file_offset): Do not set address
1901 to 0 if section is a NOLOAD section.
1902 * output.h (Output_section::is_noload): New method.
1903 (Output_section::set_is_noload): Ditto.
1904 (Output_section::is_noload_): New data member.
1905 * script-c.h (Script_section_type): New enum type.
1906 (struct Parser_output_section_header): Add new file section_type.
1907 * script-sections.cc (Sections_element::output_section_name): Add
1908 parameter for returning script section type.
1909 (Output_section_definition::output_section_name): Ditto.
1910 (Output_section_definition::section_type)P; New method.
1911 (Output_section_definiton::script_section_type_name): Ditto.
1912 (Output_section_definition::script_section_type_): New data member.
1913 (Output_section_definition::Output_section_definition): Initialize
1914 data member Output_section_definition::script_section_type_.
1915 (Output_section_definition::create_sections): Pass script section type
1916 to Layout::make_output_section_for_script.
1917 (Output_section_definition::output_section_name): Return script
1918 section type to caller.
1919 (Output_section_definition::set_section_address): Do not advance
1920 dot value and load address if section type is NOLOAD. Set address
1921 of NOLOAD sections regardless of section flags.
1922 (Output_section_definition::print): Print section type if it is
1923 not SCRIPT_SECTION_TYPE_NONE.
1924 (Output_section_definition::section_type): New method.
1925 (Output_section_definition::script_section_type_name): Ditto.
1926 (Script_sections::output_section_name): Add new parameter
1927 PSECTION_TYPE for returning script section type. Pass it to
1928 section elements. Handle discard sections.
1929 (Sort_output_sections::operator()): Handle NOLOAD sections.
1930 * script-sections.h (Script_sections::Section_type): New enum type.
1931 (Script_sections::output_section_name): Add a new parameter for
1932 returning script section type.
1933 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
1935 * yyscript.y (union): Add new field SECTION_TYPE.
1936 (COPY, DSECT, INFO, NOLOAD): New tokens.
1937 (opt_address_and_section_type): Change type to output_section_header.
1938 (section_type): New non-terminal
1939 (section_header): Handle section type.
1940 (opt_address_and_section_type): Return section type value.
1942 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
1944 * testsuite/plugin_common_test_1.c (foo): Add prototype.
1945 * testsuite/plugin_common_test_2.c (foo): Likewise.
1947 2010-04-08 Doug Kwan <dougkwan@google.com>
1949 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
1951 * output.cc (Output_section::add_merge_input_section): Simplify
1952 code and return status of Output_merge_base::add_input_section.
1953 Update merge section map only if Output_merge_base::add_input_section
1956 2010-04-07 Doug Kwan <dougkwan@google.com>
1958 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
1959 if section is marked as containing instructions but has no mapping
1961 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
1962 correct section index.
1963 (Arm_relobj::find_linked_text_section): Ditto.
1965 2010-04-07 Cary Coutant <ccoutant@google.com>
1967 * archive.cc (include_member): Destroy Read_symbols_data object before
1969 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
1970 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
1971 (Read_symbols_data::~Read_symbols_data) New destructor.
1972 (Section_relocs::Section_relocs) New constructor.
1973 (Section_relocs::~Section_relocs) New destructor.
1974 (Read_relocs_data::Read_relocs_data) New constructor.
1975 (Read_relocs_data::~Read_relocs_data) New destructor.
1976 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
1977 pointers to NULL after deleting.
1979 2010-04-07 Doug Kwan <dougkwan@google.com>
1981 * arm.cc: Replace "endianity" with "endianness" in comments.
1982 (Arm_exidx_cantunwind): Ditto.
1983 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
1984 (Arm_relobj::merge_flags_and_attributes): New method.
1985 (Arm_relobj::merge_flags_and_attributes_): New data member.
1986 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
1987 (Arm_relobj::scan_sections_for_stubs): Ditto.
1988 (Arm_relobj::do_read_symbols): Check to see if we really want to
1989 merge processor-specific flags and attributes. Exit early if
1990 an object is empty except for section names and the undefined symbol.
1991 (Target_arm::do_finalize_sections): Move check for ELF format to
1992 Arm_relobj::do_read_symbols. Merge processor specific flags and
1993 attributes from a regular object only when we have determined that
1994 it is aapropriate. Do not create an .ARM.attributes section in
1995 output if there is no regular input object.
1996 (Target_arm::merge_processor_specific_flags): Check
1997 --warn-mismatch before printing any error.
1998 (Target_arm::merge_object_attributes): Ditto.
1999 * gold.cc (queue_middle_tasks): Handle the case in which there is
2000 no regular object in input.
2001 * options.cc (General_options::parse_EB): New method.
2002 (General_options::parse_EL): Same.
2003 (General_options::General_options): Initialize endianness_.
2004 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
2006 (General_options::Endianness): New enum.
2007 (General_options::endianness): New method.
2008 (General_options::endianness_): New data member.
2009 * parameters.cc (Parameters::set_options): Check target endianness.
2010 (Parameters::set_target_once): Ditto.
2011 (Parameters::check_target_endianness): New method.
2012 (parameters_force_valid_target): If either -EL or -EB is specified,
2013 use it to define endianness of default target.
2014 * parameters.h (Parameters::check_target_endianness): New method
2016 * target.h (class Target): Change "endianity" to "endianness"
2019 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2021 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
2022 * configure: Regenerate.
2023 * Makefile.in: Regenerate.
2024 * testsuite/Makefile.in: Regenerate.
2026 2010-04-06 Cary Coutant <ccoutant@google.com>
2029 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
2030 prevailing definitions of common symbols.
2031 * testsuite/plugin_test_6.sh: New test case.
2032 * testsuite/plugin_common_test_1.c: New test case.
2033 * testsuite/plugin_common_test_2.c: New test case.
2034 * testsuite/Makefile.am (plugin_test_6): New test case.
2035 * testsuite/Makefile.in: Regenerate.
2037 2010-04-06 Nick Clifton <nickc@redhat.com>
2039 * po/vi.po: New Vietnamese translation.
2041 2010-03-30 Doug Kwan <dougkwan@google.com>
2043 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
2045 2010-03-25 Doug Kwan <dougkwan@google.com>
2047 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
2048 to avoid a conversion warning on a 32-bit host.
2050 2010-03-24 Ian Lance Taylor <iant@google.com>
2052 * testsuite/script_test_3.t: Add a TLS segment.
2053 * testsuite/Makefile.am (check_PROGRAMS): Add
2054 tls_phdrs_script_test.
2055 (tls_phdrs_script_test_SOURCES): Define.
2056 (tls_phdrs_script_test_DEPENDENCIES): Define.
2057 (tls_phdrs_script_test_LDFLAGS): Define.
2058 (tls_phdrs_script_test_LDADD): Define.
2059 * testsuite/Makefile.in: Rebuild.
2061 2010-03-23 Cary Coutant <ccoutant@google.com>
2063 * fileread.cc (find_or_make_view): Fix comment.
2065 2010-03-23 Ian Lance Taylor <iant@google.com>
2067 * script-sections.cc (class Orphan_section_placement): Define
2068 PLACE_TLS and PLACE_TLS_BSS.
2069 (Orphan_section_placement::Orphan_section_placement): Initialize
2071 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
2072 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
2073 (tls_script_test_SOURCES): Define.
2074 (tls_script_test_DEPENDENCIES): Define.
2075 (tls_script_test_LDFLAGS): Define.
2076 (tls_script_test_LDADD): Define.
2077 * testsuite/Makefile.in: Rebuild.
2079 2010-03-22 Doug Kwan <dougkwan@google.com>
2081 * arm.cc (Arm_relocate_functions::abs8,
2082 Arm_relocate_functions::abs16): Use correct check for overflow
2083 specified in the ARM ELF specs.
2084 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
2085 target of a BLX instruction specially.
2086 (Reloc_stub::stub_type_for_reloc): Ditto.
2087 (Relocate::relocate): Use symbolic names instead of numeric relocation
2088 codes to report error.
2089 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
2091 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
2092 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
2093 thumb2_blx_out_of_range.stdout
2094 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
2095 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
2096 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
2097 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
2098 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
2099 thumb2_blx_in_range, thumb2_blx_in_range.o,
2100 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
2101 thumb2_blx_out_of_range.o): New rules.
2102 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
2103 thumb2_blx_in_range and thumb2_blx_out_of_range.
2104 * testsuite/Makefile.in: Regenerate.
2105 * arm_branch_in_range.sh: Add tests for THUMB BLX.
2106 * testsuite/thumb_blx_in_range.s: New file.
2107 * testsuite/thumb_blx_out_of_range.s: New file.
2109 2010-03-22 Rafael Espindola <espindola@google.com>
2111 * archive.cc (Should_include): Move to archive.h.
2112 (should_include_member): Make it a member of Archive.
2114 (Add_lib_group_symbols): New.
2115 * archive.h: Include options.h.
2116 (Archive_member): Moved from Archive.
2117 (Should_include): Moved from archive.cc.
2119 (Add_lib_group_symbols): New.
2120 * dynobj.cc (do_should_include_member): New.
2121 * dynobj.h (do_should_include_member): New.
2122 * gold.cc (queue_initial_tasks): Update call to queue.
2123 * main.cc (main): Print lib group stats.
2124 * object.cc (do_should_include_member): New.
2125 * object.h: Include archive.h.
2126 (Object::should_include_member): New.
2127 (Object::do_should_include_member): New.
2128 (Sized_relobj::do_should_include_member): New.
2129 * options.cc (General_options::parse_start_lib): New.
2130 (General_options::parse_end_lib): New.
2131 (Input_arguments::add_file): Handle lib groups.
2132 (Input_arguments::start_group): Check we are not in a lib.
2133 (Input_arguments::start_lib): New.
2134 (Input_arguments::end_lib): New.
2135 * options.h (General_options): Add start_lib and end_lib.
2136 (Input_argument::lib_): New.
2137 (Input_argument::lib): New.
2138 (Input_argument::is_lib): New.
2139 (Input_file_lib): New.
2140 (Input_arguments::in_lib_): New.
2141 (Input_arguments::in_lib): New.
2142 (Input_arguments::start_lib): New.
2143 (Input_arguments::end_lib_): New.
2144 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
2145 in unused members as preempted.
2146 (Sized_pluginobj::do_should_include_member): New.
2147 * plugin.h (Sized_pluginobj::do_should_include_member): New.
2148 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
2150 (Read_symbols::do_whole_lib_group): New.
2151 (Read_symbols::do_lib_group): New.
2152 (Read_symbols::do_read_symbols): Handle lib groups.
2153 (Read_symbols::get_name): Handle lib groups.
2154 * readsyms.h (Read_symbols): Add an archive member pointer.
2155 (Read_symbols::do_whole_lib_group): New.
2156 (Read_symbols::do_lib_group): New.
2157 (Read_symbols::member_): New.
2158 * script.cc (read_input_script): Update call to queue_soon.
2160 2010-03-19 Doug Kwan <dougkwan@google.com>
2162 * arm.cc (Stub_table::Stub_table): Initialize new data members
2163 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
2164 (Stub_table::add_reloc_stub): Assign stub offset and update
2165 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
2166 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
2168 (Stub_table::update_data_size_and_addralign): Use
2169 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
2170 instead of going over all reloc stubs.
2171 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
2172 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
2173 Stringpool_template::offset_ to size of Stringpool_char.
2174 (Stringpool_template::new_key_offset): Remove code to initialize
2175 Stringpool_template::offset_.
2176 * stringpool.h (Stringpool_template::set_no_zero_null): Set
2177 Stringpool_template::offset_ to zero.
2179 2010-03-15 Doug Kwan <dougkwan@google.com>
2181 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
2183 (Stringpool_template::new_key_offset): New method.
2184 (Stringpool_template::add_string): Assign offsets when adding new
2186 (Stringpool_template::set_string_offsets): Do not set string offsets
2187 when not optimizing.
2188 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
2190 (Chunked_vector::clear): Clear size_.
2191 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
2192 (Chunked_vector::size): Return size_.
2193 (Chunked_vector::push_back): Use size_ to find insert position.
2194 (Chunked_vector::size_): New data member.
2195 (Stringpool_template::set_no_zero_null): Assert string set is empty.
2196 (Stringpool_template::new_key_offset): New method declaration.
2197 (Stringpool_template::offset_): New data member.
2199 2010-03-15 Rafael Espindola <espindola@google.com>
2201 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
2202 Add_symbols' constructor.
2203 * readsyms.h (Add_symbols): Remove the input_group member.
2205 2010-03-10 Ian Lance Taylor <iant@google.com>
2207 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
2208 target to ask whether a reference to a symbol requires a stack
2210 * target.h (Target::is_call_to_non_split): New function.
2211 (Target::do_is_call_to_non_split): Declare virtual function.
2212 * target.cc: Include "symtab.h".
2213 (Target::do_is_call_to_non_split): New function.
2214 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
2216 2010-03-10 Cary Coutant <ccoutant@google.com>
2218 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
2219 (File_read::open[1]): Remove initial mapping of whole_file_view_.
2220 (File_read::open[2]): Add whole_file_view_ to list of views.
2221 (File_read::make_view): Remove test of whole_file_view_.
2222 (File_read::find_or_make_view): Create whole_file_view_ if
2224 (File_read::clear_views): Replace bool parameter with enum;
2225 adjust all callers. Don't delete views with permanent data;
2226 do delete cached views and views from archives if
2227 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
2228 if clearing the corresponding view.
2229 * fileread.h (File_read::Clear_views_mode): New enum.
2230 (File_read::View::is_permanent_view): New method.
2231 (File_read::clear_views): Replace bool parameter
2232 with enum; adjust all callers.
2233 * options.h (General_options): Change keep_files_mapped option;
2234 add map_whole_files.
2235 * readsyms.cc (Add_symbols::run): Delete sd_ object before
2237 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
2240 2010-03-10 David S. Miller <davem@davemloft.net>
2242 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
2244 2010-03-09 Sriraman Tallam <tmsriram@google.com>
2246 * icf.cc (get_section_contents): Add '@' marker after processing the
2249 2010-03-08 Doug Kwan <dougkwan@google.com>
2251 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
2252 due to a conversion warning.
2253 (Arm_relobj::update_output_local_symbol_count): Check for local
2254 symbol with unset output index.
2256 2010-03-05 Ian Lance Taylor <iant@google.com>
2258 * options.h (class General_options): Add --spare-dynamic-tags.
2259 * output.cc (Output_data_dynamic::set_final_data_size): Implement
2260 --spare-dynamic-tags.
2262 2010-03-05 Ian Lance Taylor <iant@google.com>
2264 * incremental.cc: Include "libiberty.h".
2266 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
2268 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
2269 function, is_info_ member.
2270 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
2271 (Versions::Versions): Update caller.
2272 (Versions::define_base_version): Likewise.
2273 (Versions::add_def): Likewise.
2275 2010-03-03 Sriraman Tallam <tmsriram@google.com>
2277 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
2278 (Scan::possible_function_pointer_reloc): New function.
2279 (Scan::local_reloc_may_be_function_pointer): Change to call
2280 possible_function_pointer_reloc.
2281 (Scan::global_reloc_may_be_function_pointer): Ditto.
2282 * icf.h (Icf::check_section_for_function_pointers): Change to reject
2283 relocations in ".data.rel.ro._ZTV" section.
2284 * testsuite/icf_safe_so_test.sh: Change to pass i386.
2285 * testsuite/icf_safe_so_test.cc: Ditto.
2286 * testsuite/icf_safe_test.cc: Ditto.
2287 * testsuite/icf_safe_test.sh: Ditto.
2289 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2290 Ian Lance Taylor <iant@google.com>
2292 * target-reloc.h (relocate_section): Check the symbol table index
2293 for -1U before setting the local symbol index.
2294 (scan_relocatable_relocs): If copying the relocation, record that
2295 the local symbol is required.
2296 * object.h (Symbol_value::is_output_symtab_index_set): New
2298 (Symbol_value::may_be_discarded_from_output_symtab): New
2300 (Symbol_value::has_output_symtab_entry): New function.
2301 (Symbol_value::needs_output_symtab_entry): Remove.
2302 (Symbol_value::output_symtab_index): Make sure the symbol index is
2304 (Symbol_value::set_output_symtab_index): Make sure the symbol
2305 index is not set. Make sure the new index is valid.
2306 (Symbol_value::set_must_have_output_symtab_entry): New function.
2307 (Symbol_value::has_output_dynsym_entry): New function.
2308 (Symbol_value::set_output_dynsym_index): Make sure the new index
2310 (Sized_relobj::set_must_have_output_symtab_entry): New function.
2311 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
2312 local symbol if permitted.
2313 (Sized_relobj::do_finalize_local_symbols): Call
2314 is_output_symtab_index_set rather than needs_output_symtab_entry.
2315 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
2316 rather than needs_output_symtab_entry. Call
2317 has_output_dynsym_entry rather than needs_output_dynsym_entry.
2318 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
2319 is_output_symtab_index_set rather than needs_output_symtab_entry.
2320 * testsuite/discard_locals_relocatable_test.c: New file.
2321 * testsuite/discard_locals_test.sh: Test -r.
2322 * testsuite/Makefile.am (check_DATA): Add
2323 discard_locals_relocatable_test1.syms,
2324 discard_local_relocatable_test2.syms.
2325 (MOSTLYCLEANFILES): Likewise. Also add
2326 discard_locals_relocatable_test1.lout and
2327 discard_locals_relocatable_test2.out.
2328 (discard_locals_relocatable_test1.syms): New target.
2329 (discard_locals_relocatable_test.o): New target.
2330 (discard_locals_relocatable_test1.out): New target.
2331 (discard_locals_relocatable_test2.syms): New target.
2332 (discard_locals_relocatable_test2.out): New target.
2333 (various): Add missing ../ld-new dependencies.
2334 * testsuite/Makefile.in: Rebuild.
2336 2010-03-03 Nick Clifton <nickc@redhat.com>
2338 * po/fi.po: New Finnish translation.
2340 2010-03-01 Doug Kwan <dougkwan@google.com>
2342 * layout.cc (Layout::Layout): Force section types of .init_array*,
2343 .preinit_array* and .fini_array* sections.
2344 * output.cc (Output_section::Input_section_sort_entry::has_priority):
2345 Fix check of return value of std::string::find.().
2346 (Output_section::Input_section_sort_compare::operator()): Remove
2347 comment about .init_array.
2348 (Output_section::Input_section_sort_init_fini_compare::operator()):
2350 (Output_section::sort_attached_input_sections): Handle .init_array
2351 and .fini_array specially.
2352 * output.h (Output_section::Inut_section_sort_compare): Update
2354 (Output_section::Input_section_sort_init_fini_compare): New struct.
2356 2010-02-26 Doug Kwan <dougkwan@google.com>
2358 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
2359 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
2360 * testsuite/debug_msg.sh: Avoid matching source line number for
2361 use of global variable undef_int.
2363 2010-02-26 Doug Kwan <dougkwan@google.com>
2365 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
2366 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
2367 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
2368 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
2369 * options.cc (General_options::General_options): Initialize member
2371 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
2372 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
2373 and rm_no_fix_v4bx.stdout
2374 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
2375 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
2376 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
2377 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
2378 and arm_no_fix_v4bx.
2379 * Makefile.in: Regenerate.
2380 * testsuite/arm_fix_v4bx.s: New file.
2381 * testsuite/arm_fix_v4bx.sh: Ditto.
2383 2010-02-24 Doug Kwan <dougkwan@google.com>
2385 * arm.cc (Target_arm::got_section): Make the .got section the first
2386 non RELRO section in the data segment.
2387 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
2388 suffixes of section names.
2390 2010-02-24 Doug Kwan <dougkwan@google.com>
2392 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
2393 flags and attributes merging if an input file is a binary file.
2394 * fileread.cc (Input_file::open): Record format of original file.
2395 * fileread.h (Input_file::Format): New enum type.
2396 (Input_file::Input_file): Initialize data member format_.
2397 (Input_file::format): New method definition.
2398 (Input_file::format_):: New data member.
2400 2010-02-24 Doug Kwan <dougkwan@google.com>
2402 * arm.cc (Arm_output_data_got): New class.
2403 (ARM_TCB_SIZE): New constant
2404 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
2405 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
2406 If user uses a script with a SECTIONS clause, issue only a warning
2407 for a misplaced EXIDX input section. Otherwise, issue an error.
2408 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
2410 (Target_arm::got_mode_index_entry): Handle static linking.
2411 (Target_arm::Scan::local): Ditto.
2412 (Target_arm::Scan::global): Ditto.
2413 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
2414 all incorrectly implemented relocations.
2415 (Target_arm::fix_exidx_coverage): Pass layout to
2416 Arm_output_section::fix_exidx_coverage.
2417 * layout.cc (Layout::section_name_mapping): Remove trailing dots
2418 from ".ARM.exidx." and ".ARM.extab.".
2420 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2422 * arm.cc (Target_arm::do_finalize_sections): Create attribute
2423 section if it does not already exist.
2424 * attributes.cc (Attributes_section_data::Attributes_section_data):
2425 Don't crash if size is zero.
2427 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2428 Ian Lance Taylor <iant@google.com>
2430 * gold.cc (queue_middle_tasks): If no input files were opened,
2432 * workqueue.h (Task_function::Task_function): Assert that there is
2435 2010-02-22 Doug Kwan <dougkwan@google.com>
2437 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
2438 * icf.cc (get_section_contents): Cast snprintf arguments to long long
2439 types to avoid warnings due to different uint64_t implementations
2442 2010-02-21 Doug Kwan <dougkwan@google.com>
2444 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
2445 handling of the maximum backward branch offset.
2446 (Arm_relocate_functions::thumb_branch_common): Ditto.
2447 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
2448 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
2449 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
2450 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
2451 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
2452 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
2453 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
2454 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
2455 thumb_bl_out_of_range thumb_bl_out_of_range.o,
2456 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
2457 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
2458 thumb2_bl_out_of_range.o): New rules.
2459 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
2460 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
2461 thumb2_bl_out_of_range
2462 * testsuite/Makefile.in: Regenerate.
2463 * testsuite/arm_bl_in_range.s: New file.
2464 * testsuite/arm_bl_out_of_range.s: Ditto.
2465 * testsuite/arm_branch_in_range.sh: Ditto.
2466 * testsuite/arm_branch_range.t: Ditto.
2467 * testsuite/thumb2_branch_range.t: Ditto.
2468 * testsuite/thumb_bl_in_range.s: Ditto.
2469 * testsuite/thumb_bl_out_of_range.s: Ditto.
2470 * testsuite/thumb_branch_range.t: Ditto.
2472 2010-02-20 Sriraman Tallam <tmsriram@google.com>
2474 * gc.h (gc_process_relocs): Change vectors to point to the new list.
2475 Add reloc offset information.
2476 * icf.cc (get_section_contents): Change iterators to point to the new
2477 vectors. Add reloc offset information to the contents.
2478 * icf.h (Icf::Sections_reachable_info): New typedef.
2479 (Icf::Sections_reachable_list): New typedef.
2480 (Icf::Offset_info): New typedef.
2481 (Icf::Reloc_info): New struct typedef.
2482 (Icf::Reloc_info_list): New typedef.
2483 (Icf::symbol_reloc_list): Delete method.
2484 (Icf::addend_reloc_list): Delete method.
2485 (Icf::section_reloc_list): Delete method.
2486 (Icf::reloc_info_list): New method.
2487 (Icf::reloc_info_list_): New member.
2489 2010-02-19 Doug Kwan <dougkwan@google.com>
2491 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
2492 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
2493 * arm.cc (Arm_relocation_functions): New forward declaration.
2494 (Target_arm::Target_arm): Initialize new data members
2495 got_mod_index_offset_ and tls_base_symbol_defined_.
2496 (Target_arm::Relocate::relocate_tls): New method.
2497 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
2498 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
2500 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
2501 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
2502 (Target_arm::got_mod_index_offset_,
2503 Target_arm::tls_base_symbol_defined_): New data members.
2504 (Target_arm::Scan::local, Target::Scan::global,
2505 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
2508 2010-02-18 Doug Kwan <dougkwan@google.com>
2510 * arm.cc (Arm_relobj::find_linked_text_section): New method.
2511 (Arm_relobj::make_exidx_input_section): Pass section index of linked
2512 text section as a parameter becuase some broken tools may not set
2513 the link in section header.
2514 (Target_arm::has_got_section): New method.
2515 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
2516 without any mapping symbol as data only. Remove warning.
2517 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
2518 link in its section header, try to discover the link by inspecting the
2519 REL31 relocation at the beginning of the section.
2520 (Target_arm::Scan::check_non_pic): Report name of offending relocation
2522 (Target_arm::Scan::global): Treat any reference to the symbol
2523 _GLOBAL_OFFSET_TABLE_ as a GOT access.
2525 2010-02-12 Sriraman Tallam <tmsriram@google.com>
2527 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
2528 (Scan::global_reloc_may_be_function_pointer): New function.
2529 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
2530 (Scan::global_reloc_may_be_function_pointer): New function.
2531 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
2532 (Scan::global_reloc_may_be_function_pointer): New function.
2533 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
2534 (Scan::global_reloc_may_be_function_pointer): New function.
2535 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
2536 (Scan::global_reloc_may_be_function_pointer): New function.
2537 (Scan::possible_function_pointer_reloc): New function.
2538 (Target_x86_64::can_check_for_function_pointers): New function.
2539 * gc.h (gc_process_relocs): Scan relocation types to determine if
2540 function pointers were taken for targets that support it.
2541 * icf.cc (Icf::find_identical_sections): Include functions for
2542 folding in safe ICF whose pointer is not taken.
2543 * icf.h (Secn_fptr_taken_set): New typedef.
2544 (fptr_section_id_): New member.
2545 (section_has_function_pointers): New function.
2546 (set_section_has_function_pointers): New function.
2547 (check_section_for_function_pointers): New function.
2548 * options.h: Fix comment for safe ICF option.
2549 * target.h (can_check_for_function_pointers): New function.
2550 * testsuite/Makefile.am: Add icf_safe_so_test test case.
2551 Modify icf_safe_test for X86-64.
2552 * testsuite/Makefile.in: Regenerate.
2553 * testsuite/icf_safe_so_test.cc: New file.
2554 * testsuite/icf_safe_so_test.sh: New file.
2555 * testsuite/icf_safe_test.cc (kept_func_3): New function.
2556 (main): Change to take pointer to function kept_func_3.
2557 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
2558 folding is done correctly for X86-64.
2560 2010-02-12 David S. Miller <davem@davemloft.net>
2562 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
2563 is_symbolless parameter.
2564 (Output_reloc<SHT_REL>::is_symbolless): New.
2565 (Output_reloc<SHT_REL>::is_symbolless_): New.
2566 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
2567 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
2568 (Output_reloc<SHT_RELA>::is_symbolless): New.
2569 (Output_data_reloc::add_global): Handle is_symbolless.
2570 (Output_data_reloc::add_global_relative): Likewise.
2571 (Output_data_reloc::add_local): Likewise.
2572 (Output_data_reloc::add_local_relative): Likewise.
2573 (Output_data_reloc::add_symbolless_global_addend): New.
2574 (Output_data_reloc::add_symbolless_local_addend): New.
2575 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
2577 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
2578 instead of ->is_relative_
2579 (Output_reloc::write): Likewise.
2580 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
2581 (Output_reloc::write_rel): Simplify.
2583 * sparc.cc (Target_sparc::Scan::local): Use
2584 ->add_symbolless_local_addend as needed.
2585 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
2586 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
2587 based upon relocation offset.
2589 2010-02-11 Doug Kwan <dougkwan@google.com>
2591 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
2592 (Target_arm::Scan::global): Ditto. Also remove a comment before the
2593 beginning of function.
2594 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
2595 and MOVT_ABS relocations. Those are non issued in scanning. Fix
2596 parameter is_32bit in calls to should_apply_static_reloc.
2597 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
2598 (check_DATA): Add arm_abs_global.stdout.
2599 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
2600 arm_abs_global.stdout): New rules.
2601 (MOSTLLYCLEANFILES): Add arm_abs_global
2602 * Makefile.in: Regenerate.
2603 * testsuite/arm_abs_global.s: New file.
2604 * testsuite/arm_abs_global.sh: Ditto.
2605 * testsuite/arm_abs_lib.s: Ditto.
2607 2010-02-11 Ian Lance Taylor <iant@google.com>
2609 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
2611 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
2612 Allocate_commons_task first.
2613 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
2614 task, rather than symtab_lock_.
2615 (Gc_process_relocs::~Gc_process_relocs): New function.
2616 (Gc_process_relocs::is_runnable): Check this_blocker_.
2617 (Gc_process_relocs::locks): Use next_blocker_ rather than
2619 (Scan_relocs::~Scan_relocs): New function.
2620 (Scan_relocs::is_runnable): Check this_blocker_ rather than
2622 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
2624 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
2625 fields. Add this_blocker_ and next_blocker_ fields. Adjust
2626 constructor accordingly.
2627 (class Gc_process_relocs): Likewise.
2628 (class Scan_relocs): Likewise.
2629 * common.h (class Allocate_commons_task): Remove symtab_lock_
2630 field, and corresponding constructor parameter.
2631 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
2633 (Allocate_commons_task::locks): Likewise.
2635 2010-02-11 Ian Lance Taylor <iant@google.com>
2637 * gold-threads.h (class Once): Define.
2638 (class Initialize_lock): Rewrite as child of Once.
2639 * gold-threads.cc (class Once_initialize): Define.
2640 (once_pointer_control): New static variable.
2641 (once_pointer, once_arg): New static variables.
2642 (c_run_once): New static function.
2643 (Once::Once, Once::run_once, Once::internal_run): New functions.
2644 (class Initialize_lock_once): Remove.
2645 (initialize_lock_control): Remove.
2646 (initialize_lock_pointer): Remove.
2647 (initialize_lock_once): Remove.
2648 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
2649 (Initialize_lock::initialize): Rewrite.
2650 (Initialize_lock::do_run_once): New function.
2651 * archive.cc (Archive::interpret_header): Only clear name if it is
2653 * fileread.cc: Include "gold-threads.h"
2654 (file_counts_lock): New static variable.
2655 (file_counts_initialize_lock): Likewise.
2656 (File_read::release): Only increment counts when using --stats.
2657 Use a lock around the increment.
2658 * parameters.cc (class Set_parameters_target_once): Define.
2659 (set_parameters_target_once): New static variable.
2660 (Parameters::Parameters): Move here from parameters.h.
2661 (Parameters::set_target): Rewrite.
2662 (Parameters::set_target_once): New function.
2663 (Parameters::clear_target): Move here and rewrite.
2664 * parameters.h (class Parameters): Update declarations. Add
2665 set_parameters_target_once_ field.
2666 (Parameters::Parameters): Move to parameters.cc.
2667 (Parameters::clear_target): Likewise.
2668 * readsyms.cc (Read_symbols::do_group): Create a Start_group
2670 (Start_group::~Start_group): New function.
2671 (Start_group::is_runnable): New function.
2672 (Start_group::locks, Start_group::run): New functions.
2673 (Finish_group::run): Change saw_undefined to size_t.
2674 * readsyms.h (class Start_group): Define.
2675 (class Finish_group): Change saw_undefined_ field to size_t.
2676 (Finish_group::Finish_group): Remove saw_undefined and
2677 this_blocker parameters. Change all callers.
2678 (Finish_group::set_saw_undefined): New function.
2679 (Finish_group::set_blocker): New function.
2680 * symtab.h (class Symbol_table): Change saw_undefined to return
2681 size_t. Change saw_undefined_ field to size_t.
2682 * target-select.cc (Set_target_once::do_run_once): New function.
2683 (Target_selector::Target_selector): Initialize set_target_once_
2684 field. Don't initialize lock_ and initialize_lock_ fields.
2685 (Target_selector::instantiate_target): Rewrite.
2686 (Target_selector::set_target): New function.
2687 * target-select.h (class Set_target_once): Define.
2688 (class Target_selector): Update declarations. Make
2689 Set_target_once a friend. Remove lock_ and initialize_lock_
2690 fields. Add set_target_once_ field.
2692 2010-02-10 Ian Lance Taylor <iant@google.com>
2694 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
2696 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
2697 (queue_middle_tasks): Add all blockers before queueing any tasks.
2698 (queue_final_tasks): Likewise.
2699 * token.h (Task_token::add_blockers): New function.
2700 * object.h (Input_objects::number_of_relobjs): New function.
2702 2010-02-10 Ian Lance Taylor <iant@google.com>
2704 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
2705 shared, not if not position independent.
2706 * x86_64.cc (Relocate::relocate_tls): Likewise.
2707 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
2708 (tls_pie_pic_test): New target.
2709 * testsuite/Makefile.in: Rebuild.
2711 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
2712 (tls_test_main_pie.o, tls_test_pie.o): New targets.
2713 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
2714 * testsuite/Makefile.in: Rebuild.
2716 2010-02-09 David S. Miller <davem@davemloft.net>
2718 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
2719 R_SPARC_RELATIVE using ->add_local_relative().
2720 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
2722 * output.h (Output_data_dynamic::add_section_size): New method
2723 that takes two Output_data objects.
2724 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
2725 entry param. Handle it in initializers.
2726 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
2727 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
2728 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
2730 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
2731 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
2732 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
2733 for dynrel_includes_plt.
2734 * i386.cc (Target_i386::do_finalize_sections): Likewise.
2735 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2736 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
2738 (Target_sparc::do_finalize_sections): Update to pass true for
2739 dynrel_includes_plt.
2740 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
2741 output before .rela.plt
2742 (Target_powerpc::do_finalize_sections): Update to pass true for
2743 dynrel_includes_plt when 32-bit.
2745 2010-02-08 Doug Kwan <dougkwan@google.com>
2747 * arm.cc (Arm_relobj::simple_input_section_output_address): New
2749 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
2750 Arm_relobj::scan_section_for_cortex_a8_stubs,
2751 Arm_relobj::do_relocation_section): Instead of calling
2752 Output_section::output_address, use faster
2753 Arm_relobj::simple_input_section_output_address.
2755 2010-02-08 David S. Miller <davem@davemloft.net>
2757 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
2758 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
2759 relocation helper function.
2761 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
2762 just like R_SPARC_GOT{10,13,22}.
2763 (Target_sparc::Scan::local): Likewise.
2764 (Target_sparc::Relocate:relocate): Likewise.
2766 2010-02-06 Ian Lance Taylor <iant@google.com>
2768 * configure.ac: Rewrite targetobjs duplicate removal code to use
2769 only shell constructs.
2770 * configure: Rebuild.
2772 2010-02-05 Doug Kwan <dougkwan@google.com>
2775 * arm.cc (Arm_relobj::section_is_scannable): New method.
2776 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
2777 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
2779 2010-02-04 Doug Kwan <dougkwan@google.com>
2782 * arm-reloc-property.cc (cstdio): Include.
2783 * configure.ac (targetobjs): Remove duplicates.
2784 * configure: Regenerate.
2785 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
2786 big and little endian version for a given address size.
2788 2010-02-03 Doug Kwan <dougkwan@google.com>
2790 * arm-reloc-property.cc
2791 (Arm_reloc_property_table::reloc_name_in_error_message): New method
2793 * arm-reloc-property.h
2794 (Arm_reloc_property_table::get_implemented_static_reloc_property):
2795 New method definition.
2796 (Arm_reloc_property_table::reloc_name_in_error_message): New method
2798 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
2800 (GOT_PREL): Change implemented to Y.
2801 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
2802 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
2803 (Arm_relocate_functions::movw_abs_nc): Remove method.
2804 (Arm_relocate_functions::movt_abs): Ditto.
2805 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
2806 (Arm_relocate_functions::thm_movt_abs): Ditto.
2807 (Arm_relocate_functions::movw_rel_nc): Ditto.
2808 (Arm_relocate_functions::movw_rel): Ditto.
2809 (Arm_relocate_functions::movt_rel): Ditto.
2810 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
2811 (Arm_relocate_functions:thm_movw_rel): Ditto.
2812 (Arm_relocate_functions:thm_movt_rel): Ditto.
2813 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
2814 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
2815 New method definitions.
2816 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
2817 (Arm_relocation_functions::arm_grp_ldr): Ditto.
2818 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
2819 (Arm_relocation_functions::arm_grp_ldc): Ditto.
2820 (Target_arm::Relocate::relocate): Check for non-static or
2821 unimplemented relocation code and exit early. Change calls to
2822 Target_arm::reloc_uses_thumb_bit and
2823 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
2824 instead. Refactor code to handle similar relocations to increase
2825 code sharing. Remove check for unsupported relocation code in switch
2827 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
2828 relocation property table to find out size. Change error message to
2829 print out the name of a relocation code instead of the numeric value.
2830 (Target_arm::scan_reloc_for_stub): Use relocation property table
2831 instead of calling Target_arm::reloc_uses_thumb_bit().
2833 2010-02-02 Doug Kwan <dougkwan@google.com>
2835 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
2836 types of relaxed input section.
2838 2010-02-02 Doug Kwan <dougkwan@google.com>
2840 * Makefile.am (HFILES): Add arm-reloc-property.h.
2842 (TARGETSOURCES): Add arm-reloc-property.cc
2843 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
2844 (libgold_a_SOURCES): $(DEFFILES)
2845 * Makefile.in: Regenerate.
2846 * arm-reloc-property.cc: New file.
2847 * arm-reloc-property.h: New file.
2848 * arm-reloc.def: New file.
2849 * arm.cc: Update comments.
2850 (arm-reloc-property.h): New included header.
2851 (arm_reloc_property_table): New global variable.
2852 (Target_arm::do_select_as_default_target): New method definition.
2853 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
2854 arm-reloc-property to targ_extra_obj.
2855 * parameters.cc (set_parameters_target): Call
2856 Target::select_as_default_target().
2857 * target.h (Target::select_as_default_target): New method definition.
2858 (Target::do_select_as_default_target): Same.
2860 2010-02-01 Doug Kwan <dougkwan@google.com>
2862 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
2863 first_output_text_section_.
2864 (Arm_exidx_fixup::first_output_text_section): New method definition.
2865 (Arm_exidx_fixup::first_output_text_section_): New data member.
2866 (Arm_exidx_fixup::process_exidx_section): Record the first text
2867 output section seen.
2868 (Arm_output_section::fix_exidx_coverage): Set correct linked section
2869 and entsize in output section header.
2871 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2873 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
2874 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
2875 (Arm_relocate_functions::thm_alu11): New Method.
2876 (Arm_relocate_functions::thm_pc8): New Method.
2877 (Arm_relocate_functions::thm_pc12): New Method.
2878 (Target_arm::Scan::local): Handle the relocations.
2879 (Target_arm::Scan::global): Likewise.
2880 (Target_arm::Relocate::relocate): Likewise.
2881 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
2883 2010-01-29 Doug Kwan <dougkwan@google.com>
2885 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
2886 of relocation types as ld.
2888 2010-01-29 Doug Kwan <dougkwan@google.com>
2890 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
2892 (Arm_relocate_functions::thumb_branch_common): Ditto.
2893 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
2894 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
2895 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
2896 Arm_relocate_functions::jump24): Remove.
2897 (Target_arm::Relocate::relocate): Adjust code to call
2898 Arm_relocation_functions::arm_branch_common and
2899 Arm_relocation_functions::thumb_branch_common instead of their removed
2900 wrappers. Merge switch-cases together to reduce source code size.
2902 2010-01-29 Doug Kwan <dougkwan@google.com>
2904 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
2905 output_local_symbol_count_needs_update_.
2906 (Arm_relobj::output_local_symbol_count_needs_update,
2907 Arm_relobj::set_output_local_symbol_count_needs_update,
2908 Arm_relobj::update_output_local_symbol_count): New methods.
2909 (Arm_relobj::output_local_symbol_count_needs_update_): New data
2911 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
2912 of pointed function as in a R_ARM_PREL31 relocation.
2913 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
2914 for output local symbol count updating.
2915 (Target_arm::do_relax): Update output local symbol counts in objects
2917 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
2919 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2921 * arm.cc: Added support for the ARM relocations:
2922 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
2923 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
2924 (Arm_relocate_functions::movw_rel_nc): Renamed (was
2926 (Arm_relocate_functions::movw_rel): New method.
2927 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
2928 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
2930 (Arm_relocate_functions::thm_movw_rel): New method.
2931 (Arm_relocate_functions::thm_movt_rel): Renamed (was
2933 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
2935 (Target_arm::Scan::global): Likewise.
2936 (Target_arm::Relocate::relocate): Likewise.
2937 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
2940 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2942 * arm.cc: Added support for ARM group relocations.
2943 (Target_arm::reloc_needs_sym_origin): New method.
2944 (Arm_relocate_functions::calc_grp_kn): New method.
2945 (Arm_relocate_functions::calc_grp_residual): New method.
2946 (Arm_relocate_functions::calc_grp_gn): New method.
2947 (Arm_relocate_functions::arm_grp_alu): New Method.
2948 (Arm_relocate_functions::arm_grp_ldr): New Method.
2949 (Arm_relocate_functions::arm_grp_ldrs): New Method.
2950 (Arm_relocate_functions::arm_grp_ldc): New Method.
2951 (Target_arm::Scan::local): Handle the ARM group relocations.
2952 (Target_arm::Scan::global): Likewise.
2953 (Target_arm::Relocate::relocate): Likewise.
2954 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
2957 2010-01-26 Doug Kwan <dougkwan@google.com>
2959 * arm.cc (set): Include.
2960 (class Arm_exidx_fixup): Change type of last_input_section_ to const
2962 (Arm_output_section::Text_section_list): New type.
2963 (Arm_output_section::append_text_sections_to_list): New method.
2964 (Arm_output_section::fix_exidx_coverage): Ditto.
2965 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
2966 (Arm_relobj::convert_input_section_to_relaxed_section): Use
2967 Relobj::set_section_offset() instead of
2968 Sized_relobj::invalidate_section_offset().
2969 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
2970 parameter for section headers. Ignore relocation sections for
2971 unallocated sections and EXIDX sections.
2972 (Target_arm::fix_exidx_coverage): New method.
2973 (Target_arm::output_section_address_less_than): New type.
2974 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
2975 linked text section instead of the EXIDX section.
2976 (Arm_output_section::create_stub_group): Add an assertion to check
2977 that this is not an EXIDX output section.
2978 (Arm_output_section::append_text_sections_to_list): New method.
2979 (Arm_output_section::fix_exidx_coverage): Ditto.
2980 (Arm_relobj::scan_sections_for_stubs): Adjust call to
2981 Arm_relobj::section_needs_reloc_stub_scanning.
2982 (Target_arm::do_relax): Fix EXIDX output section coverage in the
2984 (Target_arm::fix_exidx_coverage): New method.
2985 * object.h (Relobj::set_output_section): New method.
2986 (Sized_relobj::invalidate_section_offset): Remove method.
2987 (Sized_relobj::do_invalidate_section_offset): Remove method.
2988 (Sized_relobj::do_set_section_offset): Handle offset value -1.
2990 2010-01-25 Doug Kwan <dougkwan@google.com>
2992 * arm.cc (Arm_exidx_merged_section::do_output_offset):
2993 Fix warning due to signed and unsigned comparison on a 32-bit host.
2995 2010-01-22 Doug Kwan <dougkwan@google.com>
2997 * arm.cc (Target_arm::do_relax): Record an output section for section
2998 offset adjustment it contains any stub table that has changed.
2999 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
3000 offsets in an output section if necessary.
3001 * output.cc (Output_section::Output_section): Initialize
3002 section_offsets_need_adjustments_.
3003 (Output_section::add_input_section_for_script): Renamed to
3004 Output_section::add_simple_input_section.
3005 (Output_section::save_states): Add a comment.
3006 (Output_section::discard_states): New method defintion.
3007 (Output_section::adjust_section_offsets): Same.
3008 * output.h (Output_section::add_input_section_for_script): Renamed to
3009 Output_section::add_simple_input_section.
3010 (Output_section::discard_states): New method declaration.
3011 (Output_section::adjust_section_offsets): Same.
3012 (Output_section::section_offsets_need_adjustment,
3013 Output_section::set_section_offsets_need_adjustment): New method
3015 (Output_section::section_offsets_need_adjustment_): New data member.
3016 * script-sections.cc
3017 (Output_section_element_input::set_section_address): Adjust code for
3018 renaming of Output_section::add_input_section_for_script.
3019 (Orphan_output_section::set_section_address): Same.
3021 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3023 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
3024 Fix_v4bx enum values .
3025 * gold/options.h (General_options): New option definitions.
3026 (General_options::fix_v4bx): New method.
3027 (General_options::Fix_v4bx): New enum.
3028 * gold/options.cc (General_options::parse_fix_v4bx): New method.
3029 (General_options::parse_fix_v4bx_interworking): New method.
3031 2010-01-22 Doug Kwan <dougkwan@google.com>
3033 * arm.cc (Arm_exidx_fixup): New class.
3035 2010-01-21 Doug Kwan <dougkwan@google.com>
3037 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
3039 (Arm_exidx_section_offset_map): New type.
3041 2010-01-21 Doug Kwan <dougkwan@google.com>
3043 * arm.cc (Arm_exidx_input_section): New class.
3044 (Arm_relobj::exidx_input_section_by_link,
3045 Arm_relobj::exidx_input_section_by_shndx,
3046 Arm_relobj::make_exidx_input_section): New methods.
3047 (read_arm_attributes_section): Remove.
3048 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
3049 information about them.
3050 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
3053 2010-01-20 Doug Kwan <dougkwan@google.com>
3055 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
3056 Input_section_specifier to Section_id.
3057 (Target_arm::new_arm_input_section: Adjust code for change of key
3059 (Target_arm::find_arm_input_section): Ditto.
3060 * gc.h (object.h): Include for Section_id nand Section_id_hash.
3061 (Section_id): Remove.
3062 (Garbage_collection::Section_id_hash): Remove.
3063 * icf.h (object.h): Include for Section_id nand Section_id_hash.
3064 (Section_id): Remove.
3065 (Icf::Section_id_hash): Remove.
3066 * object.h (Section_id, Const_section_id, Section_id_hash,
3067 Const_section_id_hash): New type definitions.
3068 * output.cc (Output_section::add_relaxed_input_section): Change to
3069 use Const_section_id instead of Input_section_specifier as key type.
3070 (Output_section::add_merge_input_section): Ditto.
3071 (Output_section::build_relaxation_map): Change to use Section_id
3072 instead of Input_section_specifier as key type.
3073 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3075 (Output_section::convert_input_sections_to_relaxed_sections): Change
3076 to use Const_section_id instead of Input_section_specifier as key type.
3077 (Output_section::find_merge_section): Ditto.
3078 (Output_section::find_relaxed_input_section): Ditto.
3079 * output.h (Input_section_specifier): Remove class.
3080 (Output_section::Output_section_data_by_input_section_map): Change
3081 key type to Const_section_id.
3082 (Output_section::Output_relaxed_input_section_by_input_section_map):
3084 (Output_section::Relaxation_map): Change key type to Section_id.
3086 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3088 * gold/arm.cc: Added support for R_ARM_V4BX relocation
3089 (class Arm_v4bx_stub): New class.
3090 (DEF_STUBS): Updated definition to support v4_veneer_bx.
3091 (Stub_factory::make_arm_v4bx_stub): New method.
3092 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
3093 (Stub_table::empty): Handle v4bx stubs.
3094 (Stub_table::add_arm_v4bx_stub): New method.
3095 (Stub_table::find_arm_v4bx_stub): New method.
3096 (Arm_relocate_functions::v4bx): New method.
3097 (Target_arm::fix_v4bx): New method.
3098 (Target_arm::Target_arm): Handle R_ARM_V4BX.
3099 (Stub_table::relocate_stubs): Likewise.
3100 (Stub_table::do_write): Likewise.
3101 (Stub_table::update_data_size_and_addralign): Likewise.
3102 (Stub_table::finalize_stubs): Likewise.
3103 (Target_arm::Scan::local): Likewise.
3104 (Target_arm::Scan::global): Likewise.
3105 (Target_arm::do_finalize_sections): Likewise.
3106 (Target_arm::Relocate::relocate): Likewise.
3107 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
3109 (Target_arm::scan_reloc_for_stub): Likewise.
3110 (Target_arm::scan_reloc_section_for_stubs): Likewise.
3112 2010-01-19 Ian Lance Taylor <iant@google.com>
3114 * output.cc (Output_section_headers::do_sized_write): Write large
3115 segment count to sh_info field.
3116 (Output_file_header::do_sized_write): For large segment count,
3117 write PN_XNUM to e_phnum field.
3119 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3121 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
3122 (Arm_relocate_functions::thm_jump8): New function.
3123 (Arm_relocate_functions::thm_jump11): New function.
3124 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
3126 (Target_arm::Scan::global): Likewise.
3127 (Target_arm::Relocate::relocate): Likewise.
3128 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
3131 2010-01-14 Doug Kwan <dougkwan@google.com>
3133 * arm.cc (map, utility): Include headers.
3134 (Target_arm::apply_cortex_a8_workaround): New method.
3135 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
3136 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
3137 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
3138 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
3139 the --[no-]fix-cortex-a8 command line options.
3140 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
3141 (Target_arm::relocate_stub): Use addend in instruction template.
3142 * options.h (DEFINE_bool): Set the user-set flag.
3143 (General_options): Add --[no-]-fix-cortex options.
3144 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
3145 : Update fast look-up map after conversion.
3147 2010-01-14 Sriraman Tallam <tmsriram@google.com>
3149 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
3150 in the first pass of do_layout.
3152 2010-01-13 Doug Kwan <dougkwan@google.com>
3154 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
3155 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
3156 apparent compiler problem of not folding static constant integral
3157 data members of elfcpp::Elf_sizes<32>.
3159 2010-01-13 Doug Kwan <dougkwan@google.com>
3161 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
3162 Arm_relobj::section_needs_cortex_a8_stub_scanning,
3163 Arm_relobj::scan_section_for_cortex_a8_erratum,
3164 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
3165 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
3166 sections to scan for relocation stubs into a new method
3167 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
3168 relocation and Cortex-A8 stub scanning.
3169 (Target_arm::do_relax): Force stubs to be after stubbed sections
3170 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
3171 the beginning of a new relaxation pass. Update a comment.
3172 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
3174 2010-01-12 Ian Lance Taylor <iant@google.com>
3176 * target-reloc.h (visibility_error): New inline function.
3177 (relocate_section): Call visibility_error.
3178 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
3179 (MOSTLYCLEANFILES): Likewise.
3180 (protected_4_pic.o, protected_3.err): New targets.
3181 * testsuite/protected_4.cc: New file.
3183 2010-01-12 Doug Kwan <dougkwan@google.com>
3185 * arm.cc (Cortex_a8_reloc): New class.
3186 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
3187 and cortex_a8_relocs_info_.
3188 (Target_arm::fix_cortex_a8): New method definition.
3189 (Target_arm::Cortex_a8_relocs_info): New type.
3190 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
3191 New data member declarations.
3192 (Target_arm::scan_reloc_for_stub): Record information about
3193 relocations for THUMB branches that might be exempted from the
3194 Cortex-A8 workaround.
3195 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
3196 at the beginning of a relaxation pass.
3198 2010-01-12 Doug Kwan <dougkwan@google.com>
3200 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
3201 (Arm_relobj::Mapping_symbol_position,
3202 Arm_reloj::Mapping_symbol_position_less,
3203 Arm_relobj::Mapping_symbols_info): New types.
3204 (Target_arm::is_mapping_symbol_name): New method definition.
3205 (Arm_relobj::do_count_local_symbols): Save information about mapping
3208 2010-01-11 Doug Kwan <dougkwan@google.com>
3210 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
3211 Arm_relocate_functions::thumb32_branch_upper,
3212 Arm_relocate_functions::thumb32_branch_lower,
3213 Arm_relocate_functions::thumb32_cond_branch_offset,
3214 Arm_relocate_functions::thumb32_cond_branch_upper,
3215 Arm_relocate_functions::thumb32_cond_branch_lower,
3216 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
3217 branch offset encoding.
3218 (Arm_relocate_functions::thumb_branch_common): Use new branch
3219 offset encoding methods to avoid code duplication.
3220 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
3221 (Stub_addend_reader::operator()): Use new branch encoding method
3222 to avoid code duplication.
3224 2010-01-11 Doug Kwan <dougkwan@google.com>
3226 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
3227 (Target_arm::do_finalize_sections): Define special EXIDX section
3228 symbols only if referenced.
3229 * gc.h (Garbage_collection::add_reference): New method.
3230 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
3233 2010-01-11 Ian Lance Taylor <iant@google.com>
3235 * script.cc (Version_script_info::build_expression_list_lookup):
3236 Change complaing about duplicate wildcard match from error to
3239 * script.cc (class Lazy_demangler): Recreate--revert part of patch
3241 (Version_script_info::Version_script_info): Initialize globs_,
3242 default_version_, default_is_global_, and exact_. Don't
3243 initialize globals_ or locals_.
3244 (Version_script_info::build_lookup_tables): Build local symbols
3246 (Version_script_info::unquote): New function.
3247 (Version_script_info::add_exact_match): New function.
3248 (Version_script_info::build_expression_list_lookup): Remove lookup
3249 parameter. Add is_global parameter. Change all callers. Handle
3250 wildcard pattern specially. Unquote pattern. Call
3252 (Version_script_info::get_name_to_match): New function.
3253 (Version_script_info::get_symbol_version): New function.
3254 (Version_script_info::get_symbol_version_helper): Remove.
3255 (Version_script_info::check_unmatched_names): Call unquote.
3256 * script.h (class Version_script_info): Change get_symbol_version
3257 to be non-inline and add is_global parameter; change all callers.
3258 Rewrite symbol_is_local. Update declarations. Define struct
3259 Version_tree_match, Exact, Globs. Don't define struct Lookup.
3260 Remove globals_ and locals_ members. Add exact_, globs_,
3261 default_version_, is_global_.
3262 (Version_script_info::Glob): Remove pattern, add expression and
3263 is_global. Update constructor. Change all callers.
3264 * dynobj.cc (Versions::finalize): Mark the version symbol as the
3266 (Versions::symbol_section_contents): If a symbol is undefined, or
3267 defined in a dynamic object, set the version index to
3269 * symtab.cc (Symbol_table::add_from_relobj): Don't call
3271 (Symbol_table::add_from_pluginobj): Likewise.
3272 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
3274 2010-01-11 Doug Kwan <dougkwan@google.com>
3276 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
3277 (incremental_dump_LDADD): Add linking option for libintl.
3278 * Makefile.in: Regenerate.
3280 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
3283 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
3285 * testsuite/Makefile.in: Regenerated.
3287 2010-01-10 Doug Kwan <dougkwan@google.com>
3289 * options.h (DEFINE_var): Use parentheses around argument varname__
3290 in macro body to avoid any unintended subsequent substitutions.
3292 2010-01-10 Ian Lance Taylor <iant@google.com>
3294 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
3295 candidates before doing symbol resolution.
3297 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
3298 ODR candidates if only one is weak.
3300 2010-01-08 Ian Lance Taylor <iant@google.com>
3302 * script.cc (Version_script_info::build_expression_list_lookup):
3303 Don't warn about ambiguous version, just record the ambiguity.
3304 (Version_script_info::get_symbol_version_helper): Give error if
3305 version is ambiguous.
3307 2010-01-08 Doug Kwan <dougkwan@google.com>
3309 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
3310 prev_data_size_ and prev_addralign_. Remove initializer for
3311 deleted data member has_been_changed_.
3312 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
3313 to determine if the table is empty.
3314 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
3316 (Stub_table::add_reloc_stub): Define method in class definition
3317 instead of just declaring it there.
3318 (Stub_table::add_cortex_a8_stub): New method definition.
3319 (Stub_table::update_data_size_and_addralign): Ditto.
3320 (Stub_table::finalize_stubs): Ditto.
3321 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
3322 (Stub_table::do_addralign_): Return address alignment in the
3323 (Stub_table::do_reset_address_and_file_offset): Define method in
3324 class definition instead of declaring it there. Set current data
3325 size to be the data size of the previous pass.
3326 (Stub_table::set_final_data_size): Use current data size as the
3328 (Stub_table::relocate_stub): Change parameter type of stub from
3329 Reloc_stub pointer to Stub pointer.
3330 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
3331 (Stub_table::Cortex_a8_stub_list): New typedef.
3332 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
3333 Stub_table::prev_addralign_): New data member.
3334 (Arm_relobj::Arm_relobj): Initialize data member
3335 section_has_cortex_a8_workaround_.
3336 (Arm_relobj::section_has_cortex_a8_workaround,
3337 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
3339 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
3341 (Target_arm::relocate_stub): Change parameter type of stub from
3342 Reloc_stub pointer to Stub pointer.
3343 (Insn_template::size, Insn_template::alignment): Handle
3344 THUMB16_SPECIAL_TYPE.
3345 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
3346 Stub_table::update_data_size_and_addralign,
3347 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
3349 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
3350 (Stub_table::do_write): Ditto.
3351 (Target_arm::do_relax): Adjust code for changes in Stub_table.
3353 2010-01-08 Ian Lance Taylor <iant@google.com>
3356 * symtab.h (class Symbol): Remove fields is_target_special_ and
3357 has_plt_offset_. Add field is_defined_in_discarded_section_.
3358 (Symbol::is_defined_in_discarded_section): New function.
3359 (Symbol::set_is_defined_in_discarded_section): New function.
3360 (Symbol::has_plt_offset): Rewrite.
3361 (Symbol::set_plt_offset): Verify that new offset is not -1U.
3362 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
3363 Don't initialize is_target_special_ or has_plt_offset_.
3364 Initialize is_defined_in_discarded_section_.
3365 (Symbol_table::add_from_relobj): If appropriate, set
3366 is_defined_in_discarded_section.
3367 * resolve.cc (Symbol::override_base_with_special): Don't test
3368 is_target_special_. Change has_plt_offset_ to has_plt_offset().
3369 * target-reloc.h (relocate_section): Do special handling for
3370 symbols defined in discarded sections for global symbols as well
3373 2010-01-08 Ian Lance Taylor <iant@google.com>
3375 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
3376 the SHT_SYMTAB case.
3378 2010-01-08 Ian Lance Taylor <iant@google.com>
3380 * object.cc (Sized_relobj::do_layout): Don't get confused if
3381 layout_eh_frame returns NULL.
3383 2010-01-08 Ian Lance Taylor <iant@google.com>
3386 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
3387 dynamic symbol table, use the normal symbol table.
3388 (Sized_dynobj::do_read_symbols): Remove assertion about type of
3391 2010-01-08 Ian Lance Taylor <iant@google.com>
3394 * layout.cc (Layout::include_section): Remove .gnu_debuglink
3397 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
3399 * version.cc (print_version): Change to "Copyright 2010".
3401 2010-01-08 Ian Lance Taylor <iant@google.com>
3405 * i386.cc (class Target_i386): Change return type of plt_section
3407 (class Output_data_plt_i386): Add tls_desc_rel_ field.
3408 (Output_data_plt_i386::Output_data_plt_i386): Initialize
3409 tls_desc_rel_ field.
3410 (Output_data_plt_i386::rel_tls_desc): New function.
3411 (Target_i386::rel_tls_desc_section): New function.
3412 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
3413 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
3414 R_386_TLS_DESC reloc in rel_tls_desc_section.
3415 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
3416 Define struct Tlsdesc_info.
3417 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
3418 (Target_x86_64::do_reloc_symbol_index): New function.
3419 (Target_x86_64::add_tlsdesc_info): New function.
3420 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
3421 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
3423 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
3425 (Output_data_plt_x86_64::rela_tlsdesc): New function.
3426 (Target_x86_64::rela_tlsdesc_section): New function.
3427 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
3429 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
3430 (Target_x86_64::do_reloc_addend): New function.
3431 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
3432 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
3433 declarations. Define TARGET_CODE. Add arg field to u1_ union.
3434 (Output_reloc::type): New function.
3435 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
3436 (Output_reloc::is_target_specific): New function.
3437 (Output_reloc::target_arg): New function.
3438 (class Output_reloc) [SHT_RELA]: Add four new constructors for
3439 absolute relocs and target specific relocs.
3440 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
3441 add_target_specific.
3442 (class Output_data_reloc) [SHT_RELA]: Likewise.
3443 * output.cc (Output_reloc::Output_reloc): Add four new versions
3444 for absolute relocs and target specific relocs.
3445 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
3446 (Output_reloc::get_symbol_index): Likewise.
3447 (Output_reloc::local_section_offset): Check that local_sym_index_
3448 is not TARGET_CODE or 0.
3449 (Output_reloc::symbol_value): Likewise.
3450 (Output_reloc::write) [SHT_RELA]: Call target for target specific
3452 * target.h (class Target): Add reloc_symbol_index and reloc_addend
3453 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
3455 * layout.cc (add_target_dynamic_tags): Use output section for
3456 DT_PLTRELSZ and DT_JMPREL.
3458 2010-01-07 Ian Lance Taylor <iant@google.com>
3461 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
3463 (class Output_data_reloc_generic): Define.
3464 (class Output_data_reloc_base): Change base class to
3465 Output_data_reloc_generic. Change add() method to call
3466 bump_relative_reloc_count for a relative reloc. Remove
3468 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
3470 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
3471 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
3473 * layout.h (class Layout): Update declaration.
3475 2010-01-07 Ian Lance Taylor <iant@google.com>
3477 * output.h (class Output_data): Add const version of
3478 output_section and do_output_section.
3479 (class Output_section_data): Add const version of
3481 (class Output_section): Likewise.
3482 * layout.cc (Layout::add_target_dynamic_tags): New function.
3483 * layout.h (class Layout): Update declarations.
3484 * arm.cc (Target_arm::do_finalize_sections): Use
3485 add_target_dynamic_tags.
3486 * i386.cc (Target_i386::do_finalize_sections): Likewise.
3487 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
3488 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
3489 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3491 2010-01-07 Ian Lance Taylor <iant@google.com>
3494 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
3497 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
3498 Ian Lance Taylor <iant@google.com>
3501 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
3502 Xindex::read_symtab_xindex.
3504 2010-01-07 Doug Kwan <dougkwan@google.com>
3506 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
3507 (Insn_template::thumb16_bcond_insn): New method declaration.
3508 (Insn_template): Fix spelling.
3509 (Stub::thumb16_special): New method declaration.
3510 (Stub::do_write): Define virtual method which was previously pure
3512 (Stub::do_thumb16_special): New method declaration.
3513 (Stub::do_fixed_endian_write): New template member.
3514 (Reloc_stub::do_write): Remove.
3515 (Reloc_stub::do_fixed_endian_write): Remove.
3516 (Cortex_a8_stub): New class definition.
3517 (Stub_factory::make_cortex_a8_stub): New method definition.
3518 (Stub_factory::Stub_factory): Add missing static storage class
3519 qualifier for elf32_arm_stub_a8_veneer_blx.
3521 2010-01-07 Ian Lance Taylor <iant@google.com>
3524 * options.h (class General_options): Add --warn-unresolved-symbols
3525 and --error-unresolved-symbols.
3526 * errors.cc (Errors::undefined_symbol): Implement
3527 --warn-unresolved-symbols.
3529 * options.h (class General_options): Add -z text and -z textoff.
3530 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
3532 2010-01-06 Sriraman Tallam <tmsriram@google.com>
3534 * gc.h (Garbage_collection::Cident_section_map): New typedef.
3535 (Garbage_collection::cident_sections): New function.
3536 (Garbage_collection::add_cident_section): New function.
3537 (Garbage_collection::cident_sections_): New member.
3538 (gc_process_relocs): Add references to sections whose names are C
3540 * gold.h (cident_section_start_prefix): New constant.
3541 (cident_section_stop_prefix): New constant.
3542 (is_cident): New function.
3543 * layout.cc (Layout::define_section_symbols): Replace string constants
3544 with the newly defined constants.
3545 * object.cc (Sized_relobj::do_layout): Track sections whose names are
3547 * testsuite/Makefile.am: Add gc_orphan_section_test.
3548 * testsuite/Makefile.in: Regenerate.
3549 * testsuite/gc_orphan_section_test.cc: New file.
3550 * testsuite/gc_orphan_section_test.sh: New file.
3552 2010-01-06 Ian Lance Taylor <iant@google.com>
3555 * options.h (class General_options): Add --warn-shared-textrel.
3556 * layout.cc (Layout::finish_dynamic_section): Implement
3557 --warn-shared-textrel.
3560 * options.h (class General_options): Add --warn-multiple-gp.
3562 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3564 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
3565 $(THREADSLIB) and $(LIBDL).
3566 * Makefile.in: Rebuild.
3568 2010-01-06 Ian Lance Taylor <iant@google.com>
3571 * options.cc (General_options::parse_section_start): New function.
3572 (General_options::section_start): New function.
3573 (General_options::General_options): Initialize all members.
3574 * options.h: Include <map>
3575 (class General_options): Add --section-start. Add section_starts_
3577 * layout.cc (Layout::attach_allocated_section_to_segment): If
3578 --section-start was used, set the address of the segment. Remove
3579 local sort_sections.
3580 (Layout::relaxation_loop_body): If the address of the load segment
3581 has been set by --section-start, don't use it.
3582 * output.h (Output_segment::update_flags_for_output_section): New
3584 * output.cc (Output_segment::add_output_section): Call
3585 update_flags_for_output_section.
3587 2010-01-05 Ian Lance Taylor <iant@google.com>
3590 * options.h (class General_options): Add --undefined-version.
3591 * script.cc (struct Version_expression): Add was_matched_by_symbol
3593 (Version_script_info::matched_symbol): New function.
3594 (Version_script_info::get_symbol_version_helper): Call
3596 (Version_script_info::check_unmatched_names): New function.
3597 * script.h (class Version_script_info): Update declarations.
3598 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
3600 * options.h (class General_options): Use DEFINE_bool_alias for
3601 allow_multiple_definition.
3602 * resolve.cc (Symbol_table::should_override): Don't test
3603 allow_multiple_definition.
3606 * options.h (class General_options): Add --cref.
3607 * main.cc (main): Print cref table if --cref. Don't close mapfile
3608 until after printing cref table.
3609 * cref.cc: Include "symtab.h".
3610 (class Cref_inputs): Define Cref_table_compare and Cref_table.
3611 (Cref_table_compare::operator()): New function.
3612 (Cref_inputs::gather_cref): New function.
3613 (filecol): New static const.
3614 (Cref_inputs::print_cref): New function.
3615 (Cref::print_cref): New function.
3616 * cref.h: Include <cstdio>.
3617 (class Cref): Update declarations.
3618 * mapfile.h (Mapfile::file): New function.
3619 * object.h (class Object): Define Symbols. Declare virtual
3620 do_get_global_symbols.
3621 (Object::get_global_symbols): New function.
3622 * object.cc (Input_objects::add_object): Pass object to cref_ if
3624 (Input_objects::archive_start): Likewise.
3625 (Input_objects::archive_stop): Likewise.
3626 (Input_objects::print_cref): New function.
3627 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
3628 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
3630 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
3632 * plugin.h (class Sized_pluginobj): Update declarations.
3634 2010-01-05 Ian Lance Taylor <iant@google.com>
3636 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
3637 to is_default_version. Rename insdef to insdefault.
3638 (Symbol_table::add_from_relobj): Rename def to is_default_version
3639 and local to is_forced_local.
3640 (Symbol_table::add_from_pluginobj): Likewise.
3641 (Symbol_table::add_from_dynobj): Likewise.
3642 (Symbol_table::define_special_symbol): Rename insdef to
3645 2010-01-04 Ian Lance Taylor <iant@google.com>
3648 * options.h (class General_options): Add
3649 --allow-multiple-definition and -z muldefs.
3650 * resolve.cc (Symbol_table::should_override): Don't warn about a
3651 multiple symbol definition if --allow-multiple-definition or -z
3655 * options.h (class General_options): Add --add-needed and
3656 --copy-dt-needed-entries. Tweak --as-needed help entry.
3657 * object.cc (Input_objects::check_dynamic_dependencies): Give an
3658 error if --copy-dt-needed-entries aka --add-needed is used and
3659 would cause a change in behaviour.
3662 * options.h (class General_options): Add -G as a short version of
3663 --shared. Add no-op options -assert, -g, and -i.
3665 2010-01-04 Sriraman Tallam <tmsriram@google.com>
3667 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
3668 check for .text or .gnu.linkonce.t sections.
3669 * icf.cc (Icf::find_identical_sections): Ditto.
3670 Change the detection for mangled function name within the section
3672 * icf.h (is_section_foldable_candidate): New function.
3674 2009-12-30 Ian Lance Taylor <iant@google.com>
3677 * options.h (class General_options): Permit two dashes with
3678 --retain-symbols-file.
3680 2009-12-30 Ian Lance Taylor <iant@google.com>
3683 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
3684 don't put the file header and segment headers in the text
3688 * common.cc (Sort_commons::operator()): Stabilize sort when both
3690 (Symbol_table::do_allocate_commons_list): When allocating common
3691 symbols, skip a symbol which is no longer common.
3692 * symtab.h (Symbol::is_common): Test whether the symbol comes from
3693 an object before checking its type.
3694 * testsuite/common_test_2.c: New file.
3695 * testsuite/common_test_3.c: New file.
3696 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
3697 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
3698 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
3699 (common_test_2_pic.o, common_test_2.so): New targets.
3700 (common_test_3_pic.o, common_test_3.so): New targets.
3701 * testsuite/Makefile.in: Rebuild.
3704 * script.cc (read_input_script): If we see a new SECTIONS clause,
3705 and we have added an input section, give an error.
3706 * layout.h (class Layout): Add have_added_input_section function.
3707 Add have_added_input_section_ field.
3708 * layout.cc (Layout::Layout): Initialize
3709 have_added_input_section_.
3710 (Layout::layout): Set have_added_input_section_.
3711 (Layout::layout_eh_frame): Likewise.
3713 2009-12-30 Ian Lance Taylor <iant@google.com>
3716 * options.h (class General_options): Add --sort-common option.
3717 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
3718 * common.cc (Sort_common): Add sort_order parameter to
3719 constructor. Add sort_order_ field.
3720 (Sort_commons::operator): Check sort_order_.
3721 (Symbol_table::allocate_commons): Determine the sort order.
3722 (Symbol_table::do_allocate_commons): Add sort_order parameter.
3724 (Symbol_table::do_allocate_commons_list): Likewise.
3726 2009-12-30 Ian Lance Taylor <iant@google.com>
3729 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
3730 symbols from this object, don't change the visibility of an
3732 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
3734 2009-12-30 Ian Lance Taylor <iant@google.com>
3737 * script.h (class Version_script_info): Define Language enum.
3738 Update declarations. Define Glob, Exact, and Lookup types. Add
3739 new fields globals_, locals_, and is_finalized_.
3740 * script.cc: Various formatting fixes.
3741 (class Parser_closure): Change language_stack_ from a vector of
3742 std::string to one of Version_script_info::Language. Adjust all
3744 (class Lazy_demangler): Remove.
3745 (struct Version_expression): Change language from std::string to
3746 Version_script_info::Language.
3747 (Version_script_info::Version_script_info): New function.
3748 (Version_script_info::~Version_script_info): Don't call clear.
3749 (Version_script_info::finalize): New function.
3750 (Version_script_info::build_lookup_tables): New function.
3751 (Version_script_info::build_expression_list_lookup): New
3753 (Version_script_info::get_symbol_version_helper): Rewrite to use
3755 (Version_script_info::print_expression_list): Adjust to use
3756 Version_script_info::Language.
3757 (script_push_lex_into_version_mode): Check that the version script
3758 has not been finalized.
3759 (version_script_push_lang): Change language string to
3760 Version_script_info::Language.
3761 * options.cc (Command_line::version_script): New function.
3762 * options.h (class General_options): Add finalize_dynamic_list
3763 function. Change version_script from declaration to definition.
3764 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
3765 * testsuite/version_script.map: Remove duplicate def of foo.
3766 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
3768 * testsuite/Makefile.in: Rebuild.
3770 2009-12-30 Ian Lance Taylor <iant@google.com>
3773 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
3774 if the input symbol index is 0, make the output symbol index 0.
3776 2009-12-30 Ian Lance Taylor <iant@google.com>
3779 * options.h (class General_options): Add -x/--discard-all.
3780 * object.cc (Sized_relobj::do_count_local_symbols): Handle
3781 --discard-all. If the local symbol needs a dynamic entry, check
3782 that before handling --discard-locals.
3784 2009-12-30 Ian Lance Taylor <iant@google.com>
3787 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
3789 (Output_segment::add_output_section): Don't change the flags if
3793 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
3794 GNU hash table if they need a dynamic value. Otherwise, don't add
3795 them if they are defined in a dynamic object or are forced local.
3797 2009-12-29 Ian Lance Taylor <iant@google.com>
3800 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
3801 .gnu.hash table for a 32-bit target.
3804 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
3805 regular and a dynamic object only needs a dynamic symbol table
3806 entry if it is externally visible.
3809 * i386.cc (class Target_i386): Initialize global_offset_table_ in
3810 constructor. Add global_offset_table_ field.
3811 (Target_i386::got_section): Set global_offset_table_.
3812 (Target_i386::do_finalize_sections): Set global_offset_table_
3814 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
3815 in constructor. Add global_offset_table_ field.
3816 (Target_x86_64::got_section): Set global_offset_table_.
3817 (Target_x86_64::do_finalize_sections): Set global_offset_table_
3820 * layout.cc (Layout::Layout): Initialize increase_relro_.
3821 (Layout::get_output_section): Add is_relro, is_last_relro, and
3822 is_first_non_relro parameters. Change all callers.
3823 (Layout::choose_output_section): Likewise.
3824 (Layout::add_output_section_data): Likewise.
3825 (Layout::make_output_section): Likewise.
3826 (Layout::set_segment_offsets): Clear increase_relro when using a
3828 * layout.h (class Layout): Add increase_relro method. Add
3829 increase_relro_ field. Update declarations.
3830 * output.cc (Output_section::Output_section): Initialize
3831 is_last_relro_ and is_first_non_relro_.
3832 (Output_segment::add_output_section): Group relro sections is
3833 do_sort is true. Handle is_last_relro and is_first_non_relro.
3834 (Output_segment::maximum_alignment): Remove relro handling.
3835 (Output_segment::set_section_addresses): Add increase_relro
3836 parameter. Change all callers. Add initial alignment to align
3837 relro sections on separate page. Remove old relro handling.
3838 (Output_segment::set_section_list_addresses): Remove in_relro
3839 parameter. Change all callers.
3840 (Output_segment::set_offset): Add increase parameter. Change all
3841 callers. Remove old relro handling.
3842 * output.h (class Output_section): Add new methods: is_last_relro,
3843 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
3844 Add is_last_relro_ and is_first_non_relro_ fields.
3845 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
3846 Create separate .got.plt section. Call increase_relro.
3847 * x86_64.cc (Target_x86_64::got_section): Likewise.
3848 * testsuite/relro_script_test.t: Add .got.plt.
3851 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
3852 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
3853 (Layout::finalize): Call set_dynamic_symbol_size.
3854 (Layout::set_dynamic_symbol_size): New function.
3855 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
3856 set_dynamic_symbol_size.
3859 * output.h (class Output_section): Add is_entsize_zero_ field.
3860 * output.cc (Output_section::Output_section): Initialize
3862 (Output_section::set_entsize): If two different entsizes are
3863 requested, force it to zero.
3864 (Output_section::add_input_section): Set flags for .debug_str
3865 before updating section flags. Set entsize.
3866 (Output_section::update_flags_for_input_section): Set SHF_MERGE
3867 and SHF_STRING if all input sections have those flags.
3869 2009-12-29 Rafael Espindola <espindola@google.com>
3871 * main.cc (main): Fix the sys time reporting.
3872 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
3875 2009-12-29 Sriraman Tallam <tmsriram@google.com>
3877 * options.cc (General_options::parse_version): Allow -v to exit
3878 without an error if there is nothing to link.
3880 2009-12-29 Ian Lance Taylor <iant@google.com>
3882 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
3883 using a version of gcc before 4.1.
3884 * configure: Rebuild.
3886 2009-12-28 Chris Demetriou <cgd@google.com>
3888 * attributes.cc (Output_attributes_section_data::do_write): Use
3889 std::vector::front rather than std::vector::data.
3891 2009-12-28 Ian Lance Taylor <iant@google.com>
3893 * symtab.h (class Symbol_table): Add enum Defined.
3894 * resolve.cc (Symbol_table::should_override): Add defined
3895 parameter. Change all callers. Test whether object is NULL
3896 before calling a method on it.
3897 (Symbol_table::report_resolve_problem): Add defined parameter.
3899 (Symbol_table::should_override_with_special): Likewise.
3900 * symtab.cc (Symbol_table::define_in_output_data): Add defined
3901 parameter. Change all callers.
3902 (Symbol_table::do_define_in_output_data): Likewise.
3903 (Symbol_table::define_in_output_segment): Likewise.
3904 (Symbol_table::do_define_in_output_segment): Likewise.
3905 (Symbol_table::define_as_constant): Likewise.
3906 (Symbol_table::do_define_as_constant): Likewise.
3907 * script.h (class Symbol_assignment): Add is_defsym parameter to
3908 constructor; change all callers.
3909 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
3910 parameter. Change all callers. Add is_defsym_ field.
3911 (class Parser_closure): Add parsing_defsym parameter to
3912 constructor; change all callers. Add parsing_defsym accessor
3913 function. Add parsing_defsym_ field.
3915 2009-12-28 Ian Lance Taylor <iant@google.com>
3917 * gold.cc (queue_middle_tasks): Fix formatting.
3918 * object.cc (Relobj::is_section_name_included): Likewise.
3920 2009-12-23 Ian Lance Taylor <iant@google.com>
3922 * i386.cc (Target_i386::do_calls_non_split): Recognize
3923 -fsplit-stack prologue for a function with a static chain.
3924 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
3925 -fsplit-stack prologue when using %r11.
3927 2009-12-21 Sriraman Tallam <tmsriram@google.com>
3929 * options.cc (General_options::parse_version): Make -v continue and do
3930 the link like GNU ld does.
3932 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
3934 * Makefile.am (CCFILES): Add timer.cc.
3935 (HFILES): Add timer.h.
3936 * configure.ac: Check for sysconf and times.
3937 * main.cc: include timer.h.
3938 (main): Use Timer instead of get_run_time.
3941 * workqueue.cc: include timer.h.
3942 (Workqueue::find_and_run_task):
3943 Report user, sys and wall time.
3944 * Makefile.in: Regenerate.
3945 * config.in: Regenerate.
3946 * configure: Regenerate.
3948 2009-12-16 Doug Kwan <dougkwan@google.com>
3950 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
3952 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
3953 relaxed input sections.
3954 * output.cc (Output_section::find_relaxed_input_section): Change
3955 return type to Output_relaxed_input_section pointer. Adjust code
3956 for new type of relaxed_input_section_map_.
3957 * output.h (Output_section::find_relaxed_input_section): Change
3958 return type to Output_relaxed_input_section pointer.
3959 (Output_section::Output_relaxed_input_section_by_input_section_map):
3961 (Output_section::relaxed_input_section_map_): Change type to
3962 Output_section::Output_relaxed_input_section_by_input_section_map.
3963 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
3966 2009-12-15 Ian Lance Taylor <iant@google.com>
3968 * layout.cc (Layout::create_shstrtab): Only write out after input
3969 sections if we are compressing debug sections.
3971 2009-12-15 Ian Lance Taylor <iant@google.com>
3973 * archive.cc (Archive::add_symbols): Only look up a symbol without
3974 a version if there is, in fact, a version.
3976 2009-12-14 Ian Lance Taylor <iant@google.com>
3978 Revert -Wshadow changes, all changes from:
3979 2009-12-11 Doug Kwan <dougkwan@google.com>
3980 2009-12-11 Nick Clifton <nickc@redhat.com>
3981 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
3983 2009-12-11 Doug Kwan <dougkwan@google.com>
3985 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
3987 * attributes.cc (Object_attribute::size): Ditto.
3988 (Attributes_section_data::size): Ditto.
3989 (Attributes_section_data::Attributes_section_data): Ditto.
3990 (Output_attributes_section_data::do_write): Ditto.
3991 * attributes.h (Object_attribute::set_type): Ditto.
3992 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
3994 2009-12-11 Nick Clifton <nickc@redhat.com>
3996 * archive.cc: Fix shadowed variable warnings.
3998 * compressed_output.cc: Likewise.
3999 * compressed_output.h: Likewise.
4000 * configure: Likewise.
4001 * dwarf_reader.cc: Likewise.
4002 * dynobj.cc: Likewise.
4003 * dynobj.h: Likewise.
4004 * ehframe.cc: Likewise.
4005 * ehframe.h: Likewise.
4006 * errors.cc: Likewise.
4007 * expression.cc: Likewise.
4008 * fileread.cc: Likewise.
4009 * fileread.h: Likewise.
4010 * freebsd.h: Likewise.
4011 * i386.cc: Likewise.
4013 * incremental.h: Likewise.
4014 * layout.cc: Likewise.
4015 * layout.h: Likewise.
4016 * mapfile.cc: Likewise.
4017 * merge.cc: Likewise.
4018 * merge.h: Likewise.
4019 * object.cc: Likewise.
4020 * object.h: Likewise.
4021 * options.h: Likewise.
4022 * output.cc: Likewise.
4023 * output.h: Likewise.
4024 * parameters.cc: Likewise.
4025 * plugin.cc: Likewise.
4026 * powerpc.cc: Likewise.
4027 * reduced_debug_output.cc: Likewise.
4028 * reduced_debug_output.h: Likewise.
4029 * reloc.cc: Likewise.
4030 * reloc.h: Likewise.
4031 * resolve.cc: Likewise.
4032 * script-sections.cc: Likewise.
4033 * script.cc: Likewise.
4034 * script.h: Likewise.
4035 * sparc.cc: Likewise.
4036 * symtab.cc: Likewise.
4037 * symtab.h: Likewise.
4038 * target-select.cc: Likewise.
4039 * target-select.h: Likewise.
4040 * token.h: Likewise.
4041 * workqueue.cc: Likewise.
4042 * workqueue.h: Likewise.
4043 * x86_64.cc: Likewise.
4045 2009-12-10 Doug Kwan <dougkwan@google.com>
4047 * arm.cc (attributes.h): New include.
4048 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
4049 (Arm_relobj::~Arm_relobj): Delete object pointed by
4050 attributes_section_data_.
4051 (Arm_relobj::attributes_section_data): New method definition.
4052 (Arm_relobj::attributes_section_data_): New data member declaration.
4053 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
4054 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
4055 attributes_section_data_.
4056 (Arm_dynobj::attributes_section_data): New method definition.
4057 (Arm_dynobj::attributes_section_data_): New data member declaration.
4058 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
4059 initialization value of may_use_blx_ to false.
4060 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
4061 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
4062 object attributes to compute results instead of hard-coding.
4063 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
4064 Target_arm::get_secondary_compatible_arch,
4065 Target_arm::set_secondary_compatible_arch
4066 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
4067 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
4068 New method declarations.
4069 (Target_arm::get_aeabi_object_attribute): New method definition.
4070 (Target_arm::attributes_section_data_): New data member declaration.
4071 (read_arm_attributes_section): New template definition.
4072 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
4073 (Arm_dynobj::do_read_symbols): Ditto.
4074 (Target_arm::do_finalize_sections): Merge attributes sections from
4075 input. Check for BLX use after attributes section merging.
4076 Fix __exidx_start and __exidx_end visibility. Create an
4077 .ARM.attributes section if necessary.
4078 (Target_arm::get_secondary_compatible_arch,
4079 Target_arm::set_secondary_compatible_arch,
4080 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
4081 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
4082 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
4083 New method definitions.
4085 2009-12-09 Ian Lance Taylor <iant@google.com>
4087 * plugin.cc (Plugin::load): Don't cast from void* to a function
4090 2009-12-09 Ian Lance Taylor <iant@google.com>
4092 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
4095 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
4097 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
4098 Replace two_file_shared_1.so with two_file_shared_2.so.
4099 * testsuite/Makefile.in: Regenerated.
4101 2009-12-08 Doug Kwan <dougkwan@google.com>
4103 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
4104 (HFILES): Add attributes.h and int_encoding.h.
4105 * Makefile.in: Regenerate.
4106 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
4107 function definitions to int_encoding.cc
4108 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
4109 prototypes to int_encoding.h
4110 * reduced_debug_output.cc (int_encoding.h): New include.
4111 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
4112 function definitions to int_encoding.cc
4113 (insert_into_vector, read_from_pointer): Move template definitions to
4115 * attributes.cc: New file.
4116 * attributes.h: New file.
4117 * int_encoding.cc: New file.
4118 * int_encoding.h: New file.
4120 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
4123 * incremental-dump.cc (dump_incremental_inputs): New.
4124 (main): Use dump_incremental_inputs.
4126 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
4129 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
4130 checking elfcpp::STT_FUNC.
4131 (Target_i386::Relocate::relocate): Likewise.
4132 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4134 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
4135 symbols from shared libraries into normal FUNC symbols.
4137 * symtab.h (Symbol): Add is_func and use it.
4139 2009-12-05 Doug Kwan <dougkwan@google.com>
4141 * arm.cc (Target_arm::arm_info): Initialize new fields
4142 attributes_section and attributes_vendor.
4143 * i386.cc (Target_i386::i386_info): Same.
4144 * object.cc (Sized_relobj::do_layout): Skip attribute section.
4145 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
4146 fields attributes_section and attributes_vendor.
4147 * sparc.cc (Target_sparc::sparc_info): Same.
4148 * target.h (Target::attributes_section, Target::attributes_vendor,
4149 Target::is_attributes_section, Target::attribute_arg_type,
4150 Target::attributes_order): New method definitions.
4151 (Target::Target_info::attributes_section,
4152 Target::Target_info::attributes_vendor): New fields.
4153 (Target::do_attribute_arg_type, Target::do_attributes_order): New
4154 virtual method definitions.
4155 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
4156 attributes_section and attributes_vendor.
4157 * testsuite/testfile.cc (Target_test::test_target_info): Same.
4159 2009-12-05 Doug Kwan <dougkwan@google.com>
4161 * arm.cc: Update comments about interworking and stub generation.
4162 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
4163 considered as non-PIC.
4164 (Arm_relocate_functions::base_abs): Fix formatting.
4165 (Arm_relocate_functions::got_prel): Fix comment. Change interface
4166 of function to use GOT entry address instead of offset.
4167 (Target_arm::Scan::global): Issue an error if a symbol would need a
4168 PLT does not get one because it is untyped. Remove code to create
4169 dynamic symbols for relative branches.
4170 (Target_arm::Relocate::relocate: Use 0 instead of false since function
4171 takes unsigned integer instead of boolean.
4173 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
4175 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
4176 (two_file_test_LDADD): Likewise.
4177 (common_test_1_LDADD): Likewise.
4178 (exception_test_LDADD) Likewise.
4179 (weak_test_LDADD): Likewise.
4180 (many_sections_test_LDADD): Likewise.
4181 (initpri1_LDADD): Likewise.
4182 (script_test_1_LDADD): Likewise.
4183 (script_test_2_LDADD): Likewise.
4184 (justsyms_LDADD): Likewise.
4185 (binary_test_LDADD): Likewise.
4186 (large_LDADD): Likewise.
4187 * testsuite/Makefile.in: Regenerated.
4189 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
4191 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
4192 (Symbol_table::override_with_special): Likewise.
4193 (Symbol_table::add_from_object): Likewise.
4195 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
4197 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
4198 Don't set the data_offset twice.
4200 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
4202 * testsuite/Makefile.in: Regenerate.
4204 2009-12-03 Doug Kwan <dougkwan@google.com>
4206 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
4207 (Target_arm::do_finalize_sections): Add parameter for symbol table
4208 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
4209 * i386.cc (Target_i386::do_finalize_sections): Add an additional
4210 parameter for symbol table pointer.
4211 * layout.cc (Layout::finalize): Call Target::finalize_sections with
4212 an additional parameter for a pointer to symbol table.
4213 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
4214 parameter for a symbol table pointer.
4215 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
4216 * target.h (Target::finalize_sections, Target::do_finalize_sections):
4218 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
4219 parameter for a symbol table pointer.
4221 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
4223 * incremental.cc (Incremental_inputs_header)
4224 (Incremental_inputs_header_write, Incremental_inputs_entry)
4225 (Incremental_inputs_entry_write): Move ...
4226 * incremental.h (Incremental_inputs_header)
4227 (Incremental_inputs_header_write, Incremental_inputs_entry)
4228 (Incremental_inputs_entry_write): here.
4230 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
4232 * incremental.cc (make_sized_incremental_binary): Set the target.
4233 Error if it is incompatible.
4234 * output.h (Output_file): Add filename method.
4236 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
4238 * incremental.cc (Incremental_inputs_entry): Remove unused argument
4239 from the get_* methods.
4241 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
4243 * incremental-dump.cc (main): Check that the offeset of a script is 0.
4244 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
4245 Write 0 for the data_offset of scripts.
4247 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
4249 * testsuite/Makefile.am: Add the incremental_test.sh test.
4250 * testsuite/incremental_test.sh: New.
4251 * testsuite/incremental_test_1.c: New.
4252 * testsuite/incremental_test_2.c: New.
4254 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
4256 * incremental-dump.cc (main): Fix typos.
4258 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
4261 * incremental-dump.cc (main): Use llu to print 64 bit values.
4263 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
4264 H.J. Lu <hongjiu.lu@intel.com>
4266 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
4268 (incremental_dump_LDADD): Likewise.
4269 * Makefile.in: Regenerated.
4271 2009-11-25 Doug Kwan <dougkwan@google.com>
4275 2009-11-25 Doug Kwan <dougkwan@google.com>
4277 * arm.cc (Target_arm::Target_arm): Move method definition
4278 outside of class definition. Add code to handle
4279 --target1-rel, --target1-abs and --target2= options.
4280 (Target_arm::get_reloc_reloc_type): Change method to be
4281 non-static and const.
4282 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
4283 New data member declaration.
4284 (Target_arm::Scan::local, Target_arm::Scan::global,
4285 Target_arm::Relocate::relocate,
4286 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4287 Adjust call to Target_arm::get_real_reloc_type.
4288 (Target_arm::get_real_reloc_type): Use command line options
4289 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
4290 * options.h (--target1-rel, --target1-abs, --target2): New
4293 2009-11-25 Doug Kwan <dougkwan@google.com>
4295 * arm.cc (Target_arm::Target_arm): Move method definition outside of
4296 class definition. Add code to handle --target1-rel, --target1-abs
4297 and --target2= options.
4298 (Target_arm::get_reloc_reloc_type): Change method to be non-static
4300 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
4302 (Target_arm::Scan::local, Target_arm::Scan::global,
4303 Target_arm::Relocate::relocate,
4304 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
4305 call to Target_arm::get_real_reloc_type.
4306 (Target_arm::get_real_reloc_type): Use command line options to
4307 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
4308 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
4311 2009-11-25 Doug Kwan <dougkwan@google.com>
4313 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
4314 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
4315 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
4317 (Arm_relocate_functions::thm_call): Replace body with a call to
4318 Arm_relocate_functions::thumb_branch_common.
4319 (Arm_relocate_functions::thm_jump24,
4320 Arm_relocate_functions::thm_xpc22): New method definitions.
4321 (Arm_relocate_functions::thumb_branch_common): New method definition.
4322 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
4324 (Target_arm::Relocate::relocate): Adjust call to thm_call.
4325 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
4327 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
4329 * Makefile.am: Build incremental-dump
4330 * Makefile.in: Regenerate.
4331 * incremental-dump.cc: New.
4332 * incremental.cc (Incremental_inputs_header_data,
4333 Incremental_inputs_entry_data): Move to incremental.h
4334 * incremental.h: (Incremental_inputs_header_data,
4335 Incremental_inputs_entry_data): Move from incremental.cc
4337 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
4339 * incremental.cc (Incremental_inputs_header,
4340 Incremental_inputs_header_write, Incremental_inputs_entry,
4341 Incremental_inputs_entry_write): Add a typedef with the data type.
4343 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
4345 * incremental.cc (Incremental_inputs_header,
4346 Incremental_inputs_header_write, Incremental_inputs_entry,
4347 Incremental_inputs_entry_write): Update comment about which
4348 type has the filed descriptions.
4350 2009-11-15 Doug Kwan <dougkwan@google.com>
4352 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
4353 (Arm_relocate_functions::arm_branch_common): Change method defintion
4354 in class definition to a method declaration and update list of formal
4356 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
4357 Arm_relocation_functions::jump24): Adjust call to
4358 Arm_relocate_functions::arm_branch_common. Update list of formal
4360 (Arm_relocate_functions::xpc25): New method definition.
4361 (Arm_relocate_functions::arm_branch_common): Move method defintion
4362 out from class definition. Use stubs for mode-switching and extending
4364 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
4365 specially. Change code to enable use of stubs in ARM branches.
4367 2009-11-10 Doug Kwan <dougkwan@google.com>
4369 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
4370 in method declaration.
4371 (Target_arm::relocate_stub): New method declaration.
4372 (Target_arm::default_target): Change to return a pointer instead of
4374 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
4375 Target_arm::default_target.
4376 (Arm_Relobj::do_relocate_sections): Remove options paramater in
4378 (Target_arm::relocate_section): Adjust view.
4379 (Target_arm::relocate_stub): New method definition.
4381 2009-11-10 Doug Kwan <dougkwan@google.com>
4383 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
4385 * incremental.cc (open_incremental_binary): Initialized local
4386 variables to avoid warnings.
4387 * object.cc (make_elf_object): Ditto.
4388 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
4391 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
4394 * testsuite/plugin_test.c: Include "config.h".
4396 2009-11-09 Doug Kwan <dougkwan@google.com>
4398 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
4399 (arm_symbol_value): Remove.
4400 (Arm_relocate_functions::arm_branch_common,
4401 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
4402 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
4403 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
4404 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
4405 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
4406 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
4407 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
4408 Arm_relocate_functions::thm_mobw_abs_nc,
4409 Arm_relocate_functions::thm_mov_abs,
4410 Arm_relocate_functions::movw_prel_nc,
4411 Arm_relocate_functions::thm_movt_abs,
4412 Arm_relocate_functions::movt_prel,
4413 Arm_relocate_functions::thm_movw_prel_nc,
4414 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
4415 (Target_arm::Relocate::relocate): Only decompose address into two
4416 parts if relocation type uses the thumb-bit and pass the actual
4417 bit instead of a flag indicating that the thumb-bit is used. Adjust
4418 calls to methods in Arm_relocate_functions for this change.
4420 2009-11-08 Ian Lance Taylor <iant@google.com>
4423 * reloc.cc: Instantiate
4424 Sized_relobj::initialize_input_to_output_maps and
4425 Sized_relobj:free_input_to_output_maps.
4427 2009-11-06 Ian Lance Taylor <iant@google.com>
4430 * defstd.cc (in_segment): Set only_if_ref true for "end".
4432 2009-11-06 Doug Kwan <dougkwan@google.com>
4434 * arm.cc (class Reloc_stub): Correct a comment.
4435 (Target_arm::Target_arm): Initialize arm_input_section_map_.
4436 (Target_arm::scan_section_for_stubs): New method declaration.
4437 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
4438 Change methods from private to protected.
4439 (Target_arm::do_may_relax): New method definition.
4440 (Target_arm::do_relax, Target_arm::group_sections,
4441 Target_arm::scan_reloc_for_stub,
4442 Target_arm::scan_reloc_section_for_stubs): New method declarations.
4443 (Target_arm::arm_input_section_map_): New data member declaration.
4444 (Target_arm::scan_reloc_for_stub,
4445 Target_arm::scan_reloc_section_for_stubs,
4446 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
4447 Target_arm::do_relax): New method definitions.
4449 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
4451 * configure.ac: Check for (struct stat)::st_mtim
4452 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
4453 * config.in: Regenerate.
4454 * configure: Regenerate.
4456 2009-11-05 Ian Lance Taylor <iant@google.com>
4459 * output.cc (Output_segment::add_output_section): Add missing
4462 2009-11-04 Ian Lance Taylor <iant@google.com>
4465 * object.h (class Object): Add is_needed and set_is_needed
4466 methods. Add is_needed_ field. Make bool fields into bitfields.
4467 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
4468 defined in a dynamic object and referenced by a regular object,
4469 set is_needed for the dynamic object.
4470 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
4471 if the file is marked with as_needed and it is not needed.
4473 2009-11-04 Ian Lance Taylor <iant@google.com>
4476 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
4477 tags if data is discarded by linker script.
4478 * i386.cc (Target_i386::do_finalize_sections): Likewise.
4479 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
4480 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
4481 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4483 2009-11-04 Ian Lance Taylor <iant@google.com>
4485 * layout.cc (Layout::get_output_section): Add is_interp and
4486 is_dynamic_linker_section parameters. Change all callers.
4487 (Layout::choose_output_section): Likewise.
4488 (Layout::make_output_section): Likewise.
4489 (Layout::add_output_section_data): Add is_dynamic_linker_section
4490 parameter. Change all callers.
4491 * layout.h (class Layout): Update declarations.
4492 * output.h (class Output_section): Add is_interp, set_is_interp,
4493 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
4494 Add is_interp_, is_dynamic_linker_section_ fields. Change
4495 generate_code_fills_at_write_ to a bitfield.
4496 * output.cc (Output_section::Output_sections): Initialize new
4498 (Output_segment::add_output_section): Add do_sort parameter.
4501 2009-11-03 Ian Lance Taylor <iant@google.com>
4504 * options.h (class General_options): Add --warn-common.
4505 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
4506 merging two common symbols.
4507 (Symbol_table::should_override): Handle --warn-common when merging
4508 a common symbol with a defined symbol. Use report_resolve_problem
4509 for multiple definitions.
4510 (Symbol_table::report_resolve_problem): New function.
4511 * symtab.h (class Symbol_table): Declare report_resolve_problem.
4513 2009-11-03 Doug Kwan <dougkwan@google.com>
4515 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
4517 (Target_arm::stub_factory): New method definition.
4518 (Target_arm::new_arm_input_section,
4519 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
4520 Target_arm::reloc_uses_thumb_bit): New method declarations.
4521 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
4522 New type definitions.
4523 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
4524 member declarations.
4525 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
4526 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
4527 New method definitions.
4529 2009-11-03 Ian Lance Taylor <iant@google.com>
4531 * options.h (class General_options): Add --warn_constructors.
4533 2009-11-03 Ian Lance Taylor <iant@google.com>
4536 * defstd.cc (in_section): Add entries for __rel_iplt_start,
4537 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
4539 2009-11-03 Ian Lance Taylor <iant@google.com>
4542 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
4543 --msgid-bugs-address.
4544 (install-pdf): New target.
4545 (install-data_yes): Look up one directory to find mkinstalldirs.
4547 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
4549 * po/Make-in (.po.gmo): Don't generate .gmo files in source
4552 2009-10-30 Doug Kwan <dougkwan@google.com>
4554 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
4556 2009-10-30 Doug Kwan <dougkwan@google.com>
4558 * arm.cc (Stub_addend_reader): New struct template definition
4559 and partial specializations.
4560 (Stub_addend_reader::operator()): New method definition for a
4561 partially specialized template.
4563 2009-10-30 Doug Kwan <dougkwan@google.com>
4565 * arm.cc (Arm_relobj::processor_specific_flags): New method
4567 (Arm_relobj::do_read_symbols): New method declaration.
4568 (Arm_relobj::processor_specific_flags_): New data member declaration.
4569 (Arm_dynobj): New class definition.
4570 (Target_arm::do_finalize_sections): Add input_objects parameter.
4571 (Target_arm::do_adjust_elf_header): New method declaration.
4572 (Target_arm::are_eabi_versions_compatible,
4573 (Target_arm::merge_processor_specific_flags): New method declaration.
4574 (Target_arm::do_make_elf_object): New overloaded method definitions
4576 (Arm_relobj::do_read_symbols): New method definition.
4577 (Arm_dynobj::do_read_symbols): Ditto.
4578 (Target_arm::do_finalize_sections): Add input_objects parameters.
4579 Merge processor-specific flags from all input objects.
4580 (Target_arm::are_eabi_versions_compatible,
4581 Target_arm::merge_processor_specific_flags,
4582 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
4583 New method definitions.
4584 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
4585 Input_objects pointer type parameter.
4586 * layout.cc (Layout::finalize): Pass input objects to target's.
4587 finalize_sections function.
4588 * output.cc (Output_file_header::do_sized_write): Set ELF file
4589 header's processor-specific flags.
4590 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
4591 Input_objects pointer type parameter.
4592 * sparc.cc (Target_sparc::do_finalize_sections): Same.
4593 * target.h (Input_objects): New forward class declaration.
4594 (Target::processor_specific_flags,
4595 Target::are_processor_specific_flags_sect): New method definitions.
4596 (Target::finalize_sections): Add input_objects parameter.
4597 (Target::Target): Initialize processor_specific_flags_ and
4598 are_processor_specific_flags_set_.
4599 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
4601 (Target::set_processor_specific_flags): New method definition.
4602 (Target::processor_specific_flags_,
4603 Target::are_processor_specific_flags_set_): New data member
4605 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
4606 Input_objects pointer type parameter.
4608 2009-10-30 Doug Kwan <dougkwan@google.com>
4610 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
4612 2009-10-28 Ian Lance Taylor <iant@google.com>
4614 * object.h (class Relobj): Drop options parameter from
4615 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
4616 do_scan_relocs, do_relocate. Change all callers.
4617 (class Sized_relobj): Drop options parameters from
4618 do_gc_process_relocs, do_scan_relocs, do_relocate,
4619 do_relocate_sections, relocate_sections, emit_relocs_scan,
4620 emit_relocs_scan_reltype. Change all callers.
4621 (struct Relocate_info): Remove options field and all references to
4623 * reloc.h (class Read_relocs): Remove options constructor
4624 parameter and options_ field. Change all callers.
4625 (class Gc_process_relocs, class Scan_relocs): Likewise.
4626 (class Relocate_task): Likewise.
4627 * target-reloc.h (scan_relocs): Remove options parameter. Change
4629 (scan_relocatable_relocs): Likewise.
4630 * target.h (class Sized_target): Remove options parameter from
4631 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
4633 * gc.h (gc_process_relocs): Remove options parameter. Change all
4635 * arm.cc: Update functions to remove options parameters.
4636 * i386.cc: Likewise.
4637 * powerpc.cc: Likewise.
4638 * sparc.cc: Likewise.
4639 * x86_64.cc: Likewise.
4640 * testsuite/testfile.cc: Likewise.
4642 2009-10-28 Doug Kwan <dougkwan@google.com>
4644 * arm.cc (Arm_relobj): New class definition.
4645 (Arm_relobj::scan_sections_for_stubs,
4646 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
4647 New method definitions.
4649 2009-10-28 Cary Coutant <ccoutant@google.com>
4651 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
4652 (Plugin::cleanup_done_): New member.
4653 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
4654 (Plugin_manager::cleanup_done_): Remove.
4655 (Plugin_manager::add_input_file): Edit error message.
4656 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
4657 (Plugin_manager::cleanup): Remove use of cleanup_done_.
4659 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
4661 * fileread.cc: (File_read::View::~View): Use the new
4662 data_ownership_ filed.
4663 (File_read::~File_read): Dispose the new whole_file_view_.
4664 (File_read::open): Mmap the whole file if needed.
4665 (File_read::open): Use whole_file_view_ instead of contents_.
4666 (File_read::find_view): Use whole_file_view_ if applicable.
4667 (File_read::do_read): Use whole_file_view_ instead of contents_.
4668 (File_read::make_view): Use whole_file_view_ instead of contents_,
4669 update File_read::View::View call.
4670 (File_read::find_or_make_view): Update File_read::View::View
4672 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
4674 (File_read::View::Data_ownership): New enum.
4675 (File_read::View::View): Replace bool mapped_ with Data_ownership
4677 (File_read::View::mapped_): Remove (replaced by data_ownership_).
4678 (File_read::View::data_ownership_): New field.
4679 (File_read::contents_): Remove (replaced by whole_file_view_).
4680 (File_read::whole_file_view_): New field.
4681 * options.h (class General_options): Add --keep-files-mapped.
4683 2009-10-27 Cary Coutant <ccoutant@google.com>
4685 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
4686 * testsuite/Makefile.am (plugin_test_5): New test case.
4687 * testsuite/Makefile.in: Regenerate.
4689 2009-10-25 Doug Kwan <dougkwan@google.com>
4691 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
4692 from private to protected to allow access by child class.
4693 (Sized_relobj::do_relocate_sections): New method declaration.
4694 (Sized_relobj::relocate_sections): Virtualize.
4695 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
4696 Sized_relobj::relocate_sections. Instantiate template explicitly
4697 for different target sizes and endianity.
4699 2009-10-24 Doug Kwan <dougkwan@google.com>
4701 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
4702 (Arm_input_section::as_arm_input_section): New method.
4703 (Arm_output_section): New class definition.
4704 (Arm_output_section::create_stub_group,
4705 Arm_output_section::group_sections): New method definitions.
4707 2009-10-22 Doug Kwan <dougkwan@google.com>
4709 * arm.cc (Arm_input_section): New class definition.
4710 (Arm_input_section::init, Arm_input_section:do_write,
4711 Arm_input_section::set_final_data_size,
4712 Arm_input_section::do_reset_address_and_file_offset): New method
4715 2009-10-21 Doug Kwan <dougkwan@google.com>
4717 * arm.cc (Stub_table, Arm_input_section): New forward class
4719 (Stub_table): New class defintion.
4720 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
4721 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
4722 New method definition.
4724 2009-10-21 Doug Kwan <dougkwan@google.com>
4726 * arm.cc: Update copyright comments.
4727 (Target_arm): New forward class template declaration.
4728 (Arm_address): New type.
4729 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
4730 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
4731 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
4733 (Insn_template): Same.
4734 (DEF_STUBS): New macro.
4735 (Stub_type): New enum type.
4736 (Stub_template): New class definition.
4739 (Stub_factory): Same.
4740 (Target_arm::Target_arm): Initialize may_use_blx_ and
4741 should_force_pic_veneer_.
4742 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
4743 Target_arm::should_force_pic_veneer,
4744 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
4745 Target_arm::using_thumb_only, Target_arm:;default_target): New
4747 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
4748 New data member declarations.
4749 (Insn_template::size, Insn_template::alignment): New method defintions.
4750 (Stub_template::Stub_template): New method definition.
4751 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
4752 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
4753 (Stub_factory::Stub_factory): New method definition.
4754 * gold.h (string_hash): New template.
4755 * output.h (Input_section_specifier::hash_value): Use
4757 (Input_section_specifier::string_hash): Remove.
4758 * stringpool.cc (Stringpool_template::string_hash): Use
4761 2009-10-20 Doug Kwan <dougkwan@google.com>
4763 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
4764 symbols of relaxed input sections.
4765 * output.h (Output_section::find_relaxed_input_section): Make
4768 2009-10-16 Doug Kwan <dougkwan@google.com>
4770 * dynobj.cc (Versions::Versions): Initialize version_script_.
4771 Only insert base version symbol definition for a shared object
4772 if version script defines any version versions.
4773 (Versions::define_base_version): New method definition.
4774 (Versions::add_def): Check that base version is not needed.
4775 (Versions::add_need): Define base version lazily.
4776 * dynobj.h (Versions::define_base_version): New method declaration.
4777 (Versions::needs_base_version_): New data member declaration.
4778 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
4779 (check_DATA): Add no_version_test.stdout.
4780 (libno_version_test.so, no_version_test.o no_version_test.stdout):
4782 * testsuite/Makefile.in: Regenerate.
4783 * testsuite/no_version_test.c: New file.
4784 * testsuite/no_version_test.sh: Ditto.
4786 2009-10-16 Doug Kwan <dougkwan@google.com>
4788 * expression.cc (class Segment_start_expression): New class definition.
4789 (Segment_start_expression::value): New method definition.
4790 (script_exp_function_segment_start): Return a new
4791 Segment_start_expression.
4792 * gold/script-c.h (script_saw_segment_start_expression): New function
4794 * script-sections.cc (Script_sections::Script_sections): Initialize
4795 SAW_SEGMENT_START_EXPRESSION_ to false.
4796 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
4797 and -Tbbs options to specify section addresses if given in
4798 command line and no SEGMENT_START expression is seen in a script.
4799 * script-sections.h (Script_sections::saw_segment_start_expression,
4800 Script_sections::set_saw_segment_start_expression): New method
4802 (Script_sections::saw_segment_start_expression_): New data member
4804 * script.cc (script_saw_segment_start_expression): New function.
4805 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
4806 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
4807 script_test_7.sh and script_test_8.sh.
4808 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
4809 script_test_8.stdout.
4810 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
4811 (script_test_6, script_test_6.stdout, script_test_7,
4812 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
4813 * Makefile.in: Regenerate.
4814 * testsuite/script_test_6.sh: New file.
4815 * testsuite/script_test_6.t: Same.
4816 * testsuite/script_test_7.sh: Same.
4817 * testsuite/script_test_7.t: Same.
4818 * testsuite/script_test_8.sh: Same.
4820 2009-10-16 Doug Kwan <dougkwan@google.com>
4822 * output.cc (Output_segment::set_section_list_address): Cast
4823 expressions to unsigned long long type to avoid format warnings.
4825 2009-10-15 Ian Lance Taylor <iant@google.com>
4827 * script.cc (Script_options::add_symbol_assignment): Always add a
4828 dot assignment to script_sections_.
4829 * script-sections.cc (Script_sections::add_dot_assignment):
4830 Initialize if necessary.
4832 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
4833 program headers with no load segment if there is a linker script.
4835 * layout.cc (Layout::set_segment_offsets): Align the file offset
4836 to the segment aligment for -N or -n with no load segment.
4837 * output.cc (Output_segment::add_output_section): Don't crash if
4838 the first section is a TLS section.
4839 (Output_segment::set_section_list_addresses): Print an error
4840 message if the address moves backward in a linker script.
4841 * script-sections.cc
4842 (Output_section_element_input::set_section_addresses): Don't
4843 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
4844 (Orphan_output_section::set_section_addresses): Likewise.
4846 2009-10-15 Doug Kwan <dougkwan@google.com>
4848 * layout.cc (Layout::finish_dynamic_section): Generate tags
4849 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
4850 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
4851 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
4853 2009-10-14 Ian Lance Taylor <iant@google.com>
4855 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
4857 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
4858 data_shdr fields of relinfo.
4859 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
4860 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
4861 R_386_TLS_LDO_32, adjust based on section flags.
4862 (Target_i386::Relocate::fix_up_ldo): Remove.
4864 2009-10-13 Ian Lance Taylor <iant@google.com>
4866 Add support for -pie.
4867 * options.h (class General_options): Add -pie and
4869 (General_options::output_is_position_independent): Test -pie.
4870 (General_options::output_is_executable): Return true if not shared
4871 and not relocatable.
4872 (General_options::output_is_pie): Remove.
4873 * options.cc (General_options::finalize): Reject incompatible uses
4875 * gold.cc (queue_middle_tasks): A -pie link is not static.
4876 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
4877 * symtab.cc (Symbol::final_value_is_known): Return false if
4878 output_is_position_independent.
4879 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
4880 output_is_position_independent.
4881 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
4882 output_is_position_independent.
4883 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
4884 output_is_position_independent.
4885 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
4887 (basic_pie_test.o, basic_pie_test): New targets.
4888 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
4889 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
4890 (two_file_pie_test): New target.
4891 * testsuite/Makefile.in: Rebuild.
4892 * README: Remove note saying that -pie is not supported.
4894 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
4896 * options.h (class General_options): Add -init and -fini.
4897 * layout.cc (Layout::finish_dynamic_section): Emit
4898 given init and fini functions.
4900 2009-10-13 Sriraman Tallam <tmsriram@google.com>
4902 * gc.h (gc_process_relocs): Check if icf is enabled using new
4904 * gold.cc (queue_initial_tasks): Likewise.
4905 (queue_middle_tasks): Likewise.
4906 * object.cc (do_layout): Likewise.
4907 * symtab.cc (is_section_folded): Likewise.
4908 * main.cc (main): Likewise.
4909 * reloc.cc (Read_relocs::run): Likewise.
4910 (Sized_relobj::do_scan_relocs): Likewise.
4911 * icf.cc (is_function_ctor_or_dtor): New function.
4912 (Icf::find_identical_sections): Check if function is ctor or dtor when
4914 * options.h (General_options::icf): Change option to be an enum.
4915 (Icf_status): New enum.
4916 (icf_enabled): New method.
4917 (icf_safe_folding): New method.
4918 (set_icf_status): New method.
4919 (icf_status_): New variable.
4920 * (options.cc) (General_options::finalize): Set icf_status_.
4921 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
4922 icf_test and icf_keep_unique_test to use the --icf enum flag.
4923 * testsuite/icf_safe_test.sh: New file.
4924 * testsuite/icf_safe_test.cc: New file.
4926 2009-10-12 Sriraman Tallam <tmsriram@google.com>
4928 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
4929 includes to gc.h and icf.h.
4930 * arm.cc: Include gc.h.
4931 * gold.cc: Likewise.
4932 * i386.cc: Likewise.
4933 * powerpc.cc: Likewise.
4934 * sparc.cc: Likewise.
4935 * x86_64.cc: Likewise.
4936 * gc.h: Include icf.h.
4938 2009-10-11 Ian Lance Taylor <iant@google.com>
4940 * plugin.cc: Include "gold.h" before other header files.
4942 2009-10-10 Chris Demetriou <cgd@google.com>
4944 * options.h (Input_file_argument::Input_file_type): New enum.
4945 (Input_file_argument::is_lib_): Replace with...
4946 (Input_file_argument::type_): New member.
4947 (Input_file_argument::Input_file_argument): Take Input_file_type
4948 'type' rather than boolean 'is_lib' as second argument.
4949 (Input_file_argument::is_lib): Use type_.
4950 (Input_file_argument::is_searched_file): New function.
4951 (Input_file_argument::may_need_search): Handle is_searched_file.
4952 * options.cc (General_options::parse_library): Support -l:filename.
4953 (General_options::parse_just_symbols): Update for Input_file_argument
4955 (Command_line::process): Likewise.
4956 * archive.cc (Archive::get_file_and_offset): Likewise.
4957 * plugin.cc (Plugin_manager::release_input_file): Likewise.
4958 * script.cc (read_script_file, script_add_file): Likewise.
4959 * fileread.cc (Input_file::Input_file): Likewise.
4960 (Input_file::will_search_for): Handle is_searched_file.
4961 (Input_file::open): Likewise.
4962 * readsyms.cc (Read_symbols::get_name): Likewise.
4963 * testsuite/Makefile.am (searched_file_test): New test.
4964 * testsuite/Makefile.in: Regenerate.
4965 * testsuite/searched_file_test.cc: New file.
4966 * testsuite/searched_file_test_lib.cc: New file.
4968 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
4969 Ian Lance Taylor <iant@google.com>
4971 * descriptor.cc: Include <cstdio> and "binary-io.h".
4972 (Descriptors::open): Open the files in binary mode always.
4973 * script.cc (Lex::get_token): Treat \r as whitespace.
4975 2009-10-09 Ian Lance Taylor <iant@google.com>
4977 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
4979 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
4980 Ian Lance Taylor <iant@google.com>
4982 * configure.ac: Check for readv function also.
4983 * fileread.cc (readv): Define if not HAVE_READV.
4984 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
4986 * config.in: Regenerate.
4987 * configure: Regenerate.
4989 2009-10-09 Doug Kwan <dougkwan@google.com>
4991 * layout.cc (Layout::make_output_section): Call target hook to make
4992 ordinary output section.
4993 (Layout::finalize): Adjust parameter list of call the
4994 Target::may_relax().
4995 * layout.h (class Layout::section_list): New method.
4996 * merge.h (Output_merge_base::entsize): Change visibility to public.
4997 (Output_merge_base::is_string, Output_merge_base::do_is_string):
4999 (Output_merge_string::do_is_string): New method.
5000 * object.cc (Sized_relobj::do_setup): renamed from
5001 Sized_relobj::set_up.
5002 * object.h (Sized_relobj::adjust_shndx,
5003 Sized_relobj::initializ_input_to_output_maps,
5004 Sized_relobj::free_input_to_output_maps): Change visibilities to
5006 (Sized_relobj::setup): Virtualize.
5007 (Sized_relobj::do_setup): New method declaration.
5008 (Sized_relobj::invalidate_section_offset,
5009 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
5010 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
5011 * options.cc (parse_int): New function.
5012 * options.h (parse_int): New declaration.
5013 (DEFINE_int): New macro.
5014 (stub_group_size): New option.
5015 * output.cc (Output_section::Output_section): Initialize memebers
5016 merge_section_map_, merge_section_by_properties_map_,
5017 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
5018 (Output_section::add_input_section): Handled deferred code-fill
5019 generation and remove an old comment.
5020 (Output_section::add_relaxed_input_section): New method definition.
5021 (Output_section::add_merge_input_section): Use merge section by
5022 properties map to speed to search. Update merge section maps
5024 (Output_section::build_relaxation_map): New method definition.
5025 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5027 (Output_section::relax_input_section): Renamed to
5028 Output_section::convert_input_sections_to_relaxed_sections and change
5029 interface to take a vector of pointers to relaxed sections.
5030 (Output_section::find_merge_section,
5031 Output_section::find_relaxed_input_section): New method definitions.
5032 (Output_section::is_input_address_mapped,
5033 Output_section::output_offset, Output_section::output_address):
5034 Use output section data maps to speed up searching.
5035 (Output_section::find_starting_output_address): Add comments.
5036 (Output_section::do_write,
5037 Output_section::write_to_postprocessing_buffer): Do code-fill
5038 generation as appropriate.
5039 (Output_section::get_input_sections): Invalidate relaxed input section
5041 (Output_section::restore_states): Adjust type of checkpoint .
5042 Invalidate relaxed input section map.
5043 * output.h (Output_merge_base): New class declaration.
5044 (Input_section_specifier): New class defintion.
5045 (class Output_relaxed_input_section) Change base class to
5046 Output_section_data_build.
5047 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
5048 base class initializer.
5049 (Output_section::add_relaxed_input_section): New method declaration.
5050 (Output_section::Input_section): Change visibility to protected.
5051 (Output_section::Input_section::relobj,
5052 Output_section::Input_section::shndx): Handle relaxed input sections.
5053 Output_section::input_sections) Change visibility to protected. Also
5054 define overload to return a non-const pointer.
5055 (Output_section::Merge_section_properties): New class defintion.
5056 (Output_section::Merge_section_by_properties_map,
5057 Output_section::Output_section_data_by_input_section_map,
5058 Output_section::Relaxation_map): New types.
5059 (Output_section::relax_input_section): Rename method to
5060 Output_section::convert_input_sections_to_relaxed_sections and change
5061 interface to take a vector of relaxed section pointers.
5062 (Output_section::find_merge_section,
5063 Output_section::find_relaxed_input_section,
5064 Output_section::build_relaxation_map,
5065 Output_section::convert_input_sections_in_list_to_relaxed_sections):
5066 New method declarations.
5067 (Output_section::merge_section_map_
5068 Output_section::merge_section_by_properties_map_,
5069 Output_section::relaxed_input_section_map_,
5070 Output_section::is_relaxed_input_section_map_valid_,
5071 Output_section::generate_code_fills_at_write_): New data members.
5072 * script-sections.cc
5073 (Output_section_element_input::set_section_addresses): Call
5074 current_data_size and addralign methods of relaxed input sections.
5075 (Orphan_output_section::set_section_addresses): Call current_data_size
5076 and addralign methods of relaxed input sections.
5077 * symtab.cc (Symbol_table::compute_final_value): Extract template
5078 from the body of Symbol_table::sized_finalize_symbol.
5079 (Symbol_table::sized_finalized_symbol): Call
5080 Symbol_table::compute_final_value.
5081 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
5082 (Symbol_table::compute_final_value): New templated method declaration.
5083 * target.cc (Target::do_make_output_section): New method defintion.
5084 * target.h (Target::make_output_section): New method declaration.
5085 (Target::relax): Add more parameters for input objects, symbol table
5086 and layout. Adjust call to do_relax.
5087 (Target::do_make_output_section): New method declaration.
5088 (Target::do_relax): Add parameters for input objects, symbol table
5091 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
5093 * pread.c: Include stdio.h.
5095 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
5097 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
5100 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
5102 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5103 Change read_shndx type to unsigned int.
5104 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
5106 (Sized_dwarf_line_info::read_line_mappings): Likewise.
5107 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
5108 Change read_shndx type to unsigned int.
5109 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
5111 (Sized_dwarf_line_info::read_line_mappings): Likewise.
5112 * layout.cc (Layout::create_symtab_sections): Cast the result of
5113 local_symcount * symsize to off_t in the gold_assert.
5115 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5117 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
5118 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
5120 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
5121 (Arm_relocate_functions::thm_abs5): New function.
5122 (Arm_relocate_functions::abs12): New function.
5123 (Arm_relocate_functions::abs16): New function.
5124 (Arm_relocate_functions::base_abs): New function.
5125 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
5126 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
5127 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
5129 (Scan::global): Likewise.
5130 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
5131 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
5132 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
5133 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
5136 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5138 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
5139 (Arm_relocate_functions::movt_prel): New function.
5140 (Arm_relocate_functions::thm_movw_prel_nc): New function.
5141 (Arm_relocate_functions::thm_movt_prel): New function.
5142 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
5143 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
5144 (Scan::global, Relocate::relocate): Likewise.
5145 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
5147 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
5149 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
5150 Incremental_checker.
5151 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
5153 (class Incremental_inputs_header): New class.
5154 (Incremental_inputs_header_writer): Edit comment.
5155 (Incremental_inputs_entry): New class.
5156 (Incremental_inputs_entry_writer): Edit comment.
5157 (Sized_incremental_binary::do_find_incremental_inputs_section):
5158 Add *strtab_shndx parameter, fill it.
5159 (Sized_incremental_binary::do_check_inputs): New method.
5160 (Incremental_checker::can_incrementally_link_output_file): Use
5161 Sized_incremental_binary::check_inputs.
5162 (Incremental_inputs::report_command_line): Save command line in
5165 (Incremental_binary::find_incremental_inputs_section): New
5167 (Incremental_binary::do_find_incremental_inputs_section): Add
5168 strtab_shndx parameter.
5169 (Incremental_binary::do_check_inputs): New pure virtual method.
5170 (Sized_incremental_binary::do_check_inputs): Declare.
5171 (Incremental_checker::Incremental_checker): Add incremental_inputs
5172 parameter, use it to initialize incremental_inputs_.
5173 (Incremental_checker::incremental_inputs_): New field.
5174 (Incremental_checker::command_line): New method.
5175 (Incremental_checker::inputs): New method.
5176 (Incremental_checker::command_line_): New field.
5178 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
5180 * incremental.cc: Include <cstdarg> and "target-select.h".
5181 (vexplain_no_incremental): New function.
5182 (explain_no_incremental): New function.
5183 (Incremental_binary::error): New method.
5184 (Sized_incremental_binary::do_find_incremental_inputs_section): New
5186 (make_sized_incremental_binary): New function.
5187 (open_incremental_binary): New function.
5188 (can_incrementally_link_file): Add checks if output is ELF and has
5190 * incremental.h: Include "elfcpp_file.h" and "output.h".
5191 (Incremental_binary): New class.
5192 (Sized_incremental_binary): New class.
5193 (open_incremental_binary): Declare.
5194 * object.cc (is_elf_object): Use
5195 elfcpp::Elf_recognizer::is_elf_file.
5196 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
5197 * output.h (Output_file::filesize): New method.
5199 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5201 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
5203 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
5204 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
5206 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
5208 (Arm_relocate_functions::movw_abs_nc): New function.
5209 (Arm_relocate_functions::movt_abs): New function.
5210 (Arm_relocate_functions::thm_movw_abs_nc): New function.
5211 (Arm_relocate_functions::thm_movt_abs): New function.
5212 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
5213 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
5214 (Scan::global): Likewise.
5215 (Relocate::relocate): Likewise.
5216 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
5218 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5220 * arm.cc (Arm_relocate_functions::got_prel) New function.
5221 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
5222 (Relocate::relocate): Likewise.
5223 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
5225 2009-10-06 Ian Lance Taylor <iant@google.com>
5227 * options.h (class General_options): Define
5228 split_stack_adjust_size parameter.
5229 * object.h (class Object): Add uses_split_stack_ and
5230 has_no_split_stack_ fields. Add uses_split_stack and
5231 has_no_split_stack accessor functions. Declare
5232 handle_split_stack_section.
5233 (class Reloc_symbol_changes): Define.
5234 (class Sized_relobj): Define Function_offsets. Declare
5235 split_stack_adjust, split_stack_adjust_reltype, and
5237 * object.cc (Object::handle_split_stack_section): New function.
5238 (Sized_relobj::do_layout): Call handle_split_stack_section.
5239 * dynobj.cc (Sized_dynobj::do_layout): Call
5240 handle_split_stack_section.
5241 * reloc.cc (Sized_relobj::relocate_sections): Call
5242 split_stack_adjust for executable sections in split_stack
5243 objects. Pass reloc_map to relocate_section.
5244 (Sized_relobj::split_stack_adjust): New function.
5245 (Sized_relobj::split_stack_adjust_reltype): New function.
5246 (Sized_relobj::find_functions): New function.
5247 * target-reloc.h: Include "object.h".
5248 (relocate_section): Add reloc_symbol_changes parameter. Change
5250 * target.h (class Target): Add calls_non_split method. Declare
5251 do_calls_non_split virtual method. Declare match_view and
5253 * target.cc: Include "elfcpp.h".
5254 (Target::do_calls_non_split): New function.
5255 (Target::match_view): New function.
5256 (Target::set_view_to_nop): New function.
5257 * gold.cc (queue_middle_tasks): Give an error if mixing
5258 split-stack and non-split-stack objects with -r.
5259 * i386.cc (Target_i386::relocate_section): Add
5260 reloc_symbol_changes parameter.
5261 (Target_i386::do_calls_non_split): New function.
5262 * x86_64.cc (Target_x86_64::relocate_section): Add
5263 reloc_symbol_changes parameter.
5264 (Target_x86_64::do_calls_non_split): New function.
5265 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
5267 * powerpc.cc (Target_powerpc::relocate_section): Add
5268 reloc_symbol_changes parameter.
5269 * sparc.cc (Target_sparc::relocate_section): Add
5270 reloc_symbol_changes parameter.
5271 * configure.ac: Call AM_CONDITIONAL for the default target.
5272 * configure: Rebuild.
5273 * testsuite/Makefile.am (TEST_AS): New variable.
5274 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
5275 (check_DATA): Add split_i386 and split_x86_64 files.
5276 (SPLIT_DEFSYMS): Define.
5277 (split_i386_[1234n].o): New targets.
5278 (split_i386_[124]): New targets.
5279 (split_i386_[1234r].stdout): New targets.
5280 (split_x86_64_[1234n].o): New targets.
5281 (split_x86_64_[124]): New targets.
5282 (split_x86_64_[1234r].stdout): New targets.
5283 (MOSTLYCLEANFILES): Add new executables.
5284 * testsuite/split_i386.sh: New file.
5285 * testsuite/split_x86_64.sh: New file.
5286 * testsuite/split_i386_1.s: New file.
5287 * testsuite/split_i386_2.s: New file.
5288 * testsuite/split_i386_3.s: New file.
5289 * testsuite/split_i386_4.s: New file.
5290 * testsuite/split_i386_n.s: New file.
5291 * testsuite/split_x86_64_1.s: New file.
5292 * testsuite/split_x86_64_2.s: New file.
5293 * testsuite/split_x86_64_3.s: New file.
5294 * testsuite/split_x86_64_4.s: New file.
5295 * testsuite/split_x86_64_n.s: New file.
5296 * testsuite/testfile.cc (Target_test): Update relocation_section
5298 * testsuite/Makefile.in: Rebuild.
5300 2009-10-06 Ian Lance Taylor <iant@google.com>
5302 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
5303 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
5304 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
5305 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
5306 the address on ldo_addrs_.
5307 (Target_i386::Relocate::fix_up_ldo): New function.
5309 2009-10-06 Rafael Espindola <espindola@google.com>
5311 * plugin.cc (add_input_library): New.
5312 (Plugin::load): Add add_input_library to tv.
5313 (Plugin_manager::add_input_file): Add the is_lib argument.
5314 (add_input_file): Update call to Plugin_manager::add_input_file.
5315 (add_input_library): New.
5316 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
5318 2009-09-30 Doug Kwan <dougkwan@google.com>
5320 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
5321 symbol and call Symbol::may_need_copy_reloc to determine if
5322 a copy reloc is needed.
5323 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
5324 nocopyreloc is given in command line.
5325 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
5326 given in command line.
5327 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
5328 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
5329 of the removed Target_i386::may_need_copy_reloc.
5330 * options.h (copyreloc): New option with default value false.
5331 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
5332 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
5333 instead of the removed Target_powerpc::may_need_copy_reloc.
5334 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
5335 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
5336 instead of the removed Target_sparc::may_need_copy_reloc.
5337 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
5338 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
5339 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
5340 instead of the removed Target_x86_64::may_need_copy_reloc.
5342 2009-09-30 Ian Lance Taylor <iant@google.com>
5344 * object.h (class Object): Remove target_ field, and target,
5345 sized_target, and set_target methods.
5346 (Object::sized_target): Remove.
5347 (class Sized_relobj): Update declarations. Remove sized_target.
5348 * object.cc (Sized_relobj::setup): Remove target parameter.
5350 (Input_objects::add_object): Don't do anything with the target.
5351 (make_elf_sized_object): Add punconfigured parameter. Change all
5352 callers. Set or test parameter target.
5353 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
5355 * parameters.cc (Parameters::set_target): Change parameter type to
5357 (Parameters::default_target): Remove.
5358 (set_parameters_target): Change parameter type to be non-const.
5359 (parameters_force_valid_target): New function.
5360 (parameters_clear_target): New function.
5361 * parameters.h (class Parameters): Update declarations. Remove
5362 default_target method. Add sized_target and clear_target
5363 methods. Change target_ to be non-const.
5364 (set_parameters_target): Update declaration.
5365 (parameters_force_valid_target): Declare.
5366 (parameters_clear_target): Declare.
5367 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
5368 as NULL if we aren't searching.
5369 (Add_symbols::run): Don't check for compatible target.
5370 * fileread.cc (Input_file::open_binary): Call
5371 parameters_force_valid_target.
5372 * gold.cc (queue_middle_tasks): Likewise.
5373 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
5374 set_target on object.
5375 * dynobj.h (class Sized_dynobj): Update declarations.
5376 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
5377 make_elf_object returns NULL.
5378 (Archive::include_member): Don't check whether object target is
5380 * output.cc (Output_section::add_input_section): Get target from
5382 (Output_section::relax_input_section): Likewise.
5383 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
5385 (Sized_relobj::do_scan_relocs): Likewise.
5386 (Sized_relobj::relocate_sections): Likewise.
5387 * resolve.cc (Symbol_table::resolve): Likewise.
5388 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
5389 parameter. Change all callers.
5390 (Symbol_table::add_from_object): Get target from parameters.
5391 (Symbol_table::add_from_relobj): Don't check object target.
5392 (Symbol_table::add_from_dynobj): Likewise.
5393 (Symbol_table::define_special_symbol): Get target from
5395 * symtab.h (class Symbol_table): Update declaration.
5396 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
5397 parameter. Change all callers. Clear parameter target.
5398 (Binary_test): Test target here.
5399 * testsuite/object_unittest.cc (gold_testsuite): Remove
5400 target_test_pointer parameter. Change all callers.
5401 (Object_test): Test target here.
5403 2009-09-26 Ian Lance Taylor <iant@google.com>
5405 * testsuite/initpri1.c: Don't try to use constructor priorities if
5406 compiling with gcc before 4.3.
5408 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
5410 * testsuite/retain_symbols_file_test.sh (check_present): Change
5411 output file name to retain_symbols_file_test.stdout.
5412 (check_absent): Likewise.
5414 2009-09-18 Craig Silverstein <csilvers@google.com>
5416 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
5417 * options.cc: Include <cerrno> and <fstream>.
5418 (General_options::finalize): Parse -retain-symbols-file tag.
5419 * options.h: New flag.
5420 (General_options): New method should_retain_symbol, new
5421 variable symbols_to_retain.
5422 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
5423 should_retain_symbol map.
5424 * testsuite/Makefile.am (retain_symbols_file_test): New test.
5425 * testsuite/Makefile.in: Regenerate.
5426 * testsuite/retain_symbols_file_test.sh: New file.
5428 2009-09-18 Nick Clifton <nickc@redhat.com>
5430 * po/es.po: Updated Spanish translation.
5432 2009-09-17 Doug Kwan <dougkwan@google.com>
5434 * debug.h (DEBUG_RELAXATION): New constant.
5435 (DEBUG_ALL): Add DEBUG_RELAXATION.
5436 (debug_string_to_enum): Add relaxation debug option.
5438 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
5439 Layout::Relaxation_debug_check::read_sections,
5440 Layout::Relaxation_debug_check::read_sections): New method definitions.
5441 (Layout::Layout): Initialize data members
5442 record_output_section_data_from_scrips_,
5443 script_output_section_data_list_ and relaxation_debug_check_.
5444 (Layout::save_segments, Layout::restore_segments,
5445 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
5446 Layout::relaxation_loop_body): New method definitions.
5447 (Layout::finalize): Support relaxation. Move section layout code to
5448 Layout::relaxation_loop_body.
5449 (Layout::set_asection_address_from_script): Move code for orphan
5450 section placement out.
5451 (Layout::place_orphan_sections_in_script): New method definition.
5452 * layout.h (Output_segment_headers, Output_file_header):
5453 New forward class declarations.
5454 (Layout::~Layout): Define.
5455 (Layout::new_output_section_data_from_script): New method definition.
5456 (Layout::place_orphan_sections_in_script): New method declaration.
5457 (Layout::Segment_states): New type declaration.
5458 (Layout::save_segments, Layout::restore_segments,
5459 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
5460 Layout::relaxation_loop_body): New method declarations.
5461 (Layout::Output_section_data_list): New type declaration.
5462 (Layout::Relaxation_debug_check): New class definition.
5463 (Layout::record_output_section_data_from_script_,
5464 Layout::script_output_section_data_list_, Layout::segment_states_,
5465 Layout::relaxation_debug_check_): New data members.
5466 * output.cc: (Output_section_headers::do_size): New method definition.
5467 (Output_section_headers::Output_section_headers): Move size
5468 computation to Output_section_headers::do_size.
5469 (Output_segment_headers::do_size): New method definition.
5470 (Output_file_header::Output_file_header): Move size computation to
5471 Output_file_header::do_size and call it.
5472 (Output_file_header::do_size): New method definition.
5473 (Output_data_group::Output_data_group): Adjust call to
5474 Output_section_data.
5475 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
5476 (Output_symtab_xindex::do_write): Add array bound check.
5477 (Output_section::Input_section::print_to_mapfile): Handle
5478 RELAXED_INPUT_SECTION_CODE.
5479 (Output_section::Output_section): Initialize data member checkpoint_.
5480 (Output_section::~Output_section): Delete checkpoint object pointed
5482 (Output_section::add_input_section): Always add an Input_section if
5484 (Output_section::add_merge_input_section): Add assert.
5485 (Output_section::relax_input_section): New method definition.
5486 (Output_section::set_final_data_size): Set load address to zero for
5487 an unallocated section.
5488 (Output_section::do_address_and_file_offset_have_reset_values):
5489 New method definition.
5490 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
5491 Handle relaxed input section.
5492 (Output_section::sort_attached_input_sections): Checkpoint input
5493 section list lazily.
5494 (Output_section::get_input_sections): Change type of input_sections to
5495 list of Simple_input_section pointers. Checkpoint input section list
5496 lazily. Also handle relaxed input sections.
5497 (Output_section::add_input_section_for_script): Take a reference to
5498 a Simple_input_section object instead of Relobj pointer and section
5499 index as parameter. Handle relaxed input sections.
5500 (Output_section::save_states, Output_section::restore_states): New
5502 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
5503 (Output_data::is_data_size_fixed): New method definition.
5504 (Output_data::reset_addresss_and_file_offset): Do not reset data size
5506 (Output_data::address_and_file_offset_have_reset_values): New method
5508 (Output_data::do_address_and_file_offset_have_reset_values): New method
5510 (Output_data::set_data_size): Check that data size is not fixed.
5511 (Output_data::fix_data_size): New method definition.
5512 (Output_data::is_data_size_fixed_): New data member.
5513 (Output_section_headers::set_final_data_size): New method definition.
5514 (Output_section_headers::do_size): New method declaration.
5515 (Output_segment_headers::set_final_data_size): New method definition.
5516 (Output_segment_headers::do_size): New method declaration.
5517 (Output_file_header::set_final_data_size)::New method definition.
5518 (Output_file_header::do_size)::New method declaration.
5519 (Output_section_data::Output_section_data): Add new parameter
5520 is_data_size_fixed and use it to fix data size.
5521 (Output_data_const::Output_data_const): Adjust call to base class
5522 constructor and fix data size.
5523 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
5524 base class constructor and fix data size.
5525 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
5526 base class constructor and fix data size.
5527 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
5528 class constructor and fix data size.
5529 (Output_data_group::set_final_data_size): New method definition.
5530 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
5531 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
5532 class constructor and fix data size.
5533 (Output_relaxed_input_section): New class definition.
5534 (Output_section::Simple_input_section): New class definition.
5535 (Output_section::get_input_sections): Adjust parameter list.
5536 (Output_section::add_input_section_for_script): Same.
5537 (Output_section::save_states, Output_section::restore_states,
5538 Output_section::do_address_and_file_offset_have_reset_values,
5539 (Output_section::Input_section::Input_section): Handle
5540 RELAXED_INPUT_SECTION_CODE. Add new overload for
5541 Output_relaxed_input_section.
5542 (Output_section::Input_section::is_input_section,
5543 Output_section::Input_section::set_output_section): Handle relaxed
5545 (Output_section::Input_section::is_relaxed_input_section,
5546 Output_section::Input_section::output_section_data,
5547 Output_section::Input_section::relaxed_input_section): New method
5549 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
5551 (Output_section::Input_section::u1_): Update comments.
5552 (Output_section::Input_section::u2_): Add new union member poris.
5553 (Output_section::Checkpoint_output_section): New classs definition.
5554 (Output_section::relax_input_section): New method declaration.
5555 (Output_section::checkpoint_): New data member.
5556 (Output_segment): Update comments.
5557 (Output_segment::Output_segment): Un-privatize copy constructor.
5558 (Output_segment::operator=): Un-privatize.
5559 * script-sections.cc (Output_section_element::Input_section_list):
5560 Change element type to Output_section::Simple_input_section.
5561 (Output_section_element_dot_assignment::set_section_addresses):
5562 Register output section data for relaxation clean up.
5563 (Output_data_exression::Output_data_expression): Adjust call to base
5564 constructor to fix data size.
5565 (Output_section_element_data::set_section_addresses): Register
5566 Output_data_expression object for relaxation clean up.
5567 (struct Input_section_info): Replace Relobj pointer and section index
5568 pair with Output_section::Simple_input_section and Convert struct to a
5570 (Input_section_sorter::operator()): Adjust access to
5571 Input_section_info data member to use accessors.
5572 (Output_section_element_input::set_section_addresses): Use layout
5573 parameter. Adjust code to use Output_section::Simple_input_section
5574 and Input_secction_info classes. Register filler for relaxation
5576 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
5577 and section index pair with Output_section::Simple_input_section
5578 class. Adjust code accordingly.
5579 (Phdrs_element::release_segment): New method definition.
5580 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
5582 (Script_sections::release_segments): New method definition.
5583 * gold/script-sections.h (Script_sections::release_segments): New
5585 * gold/target.h (Target::may_relax, Target::relax,
5586 Target::do_may_relax, Target::do_relax): New method definitions.
5588 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5590 * arm.cc (has_signed_unsigned_overflow): New function.
5591 (Arm_relocate_functions::abs8): New function.
5592 (Target_arm::Scan::local): Handle R_ARM_ABS8.
5593 (Target_arm::Scan::global): Likewise.
5594 (Target_arm::relocate::relocate): Likewise.
5595 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5598 2009-09-16 Cary Coutant <ccoutant@google.com>
5600 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
5601 * testsuite/Makefile.in: Regenerate.
5603 2009-09-11 Nick Clifton <nickc@redhat.com>
5605 * po/gold.pot: Updated by the Translation project.
5607 2009-09-08 Cary Coutant <ccoutant@google.com>
5609 * output.cc (Output_file::open): Add execute permission to empty file.
5610 * testsuite/Makefile.am (permission_test): New test.
5611 * testsuite/Makefile.in: Regenerate.
5613 2009-09-02 Ian Lance Taylor <iant@google.com>
5615 * output.cc (Output_file::resize): Call map_no_anonymous rather
5618 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
5620 * gold.cc: Include "incremental.h".
5621 (queue_initial_tasks): Call Incremental_checker methods.
5622 * incremental.cc: Include "output.h".
5623 (Incremental_checker::can_incrementally_link_output_file): New
5625 * incremental.h (Incremental_checker): New class.
5627 * output.cc (Output_file::open_for_modification): New method.
5628 (Output_file::map_anonymous): Changed return type to bool. Record
5630 (Output_file::map_no_anonymous): New method, broken out of map.
5631 (Output_file::map): Use map_no_anonymous and map_anonymous.
5632 * output.h (class Output_file): Update declarations.
5634 2009-08-24 Cary Coutant <ccoutant@google.com>
5636 * options.h (Command_line::Pre_options): New class.
5637 (Command_line::pre_options): New member.
5638 * options.cc (gold::options::ready_to_register): New variable.
5639 (One_option::register_option): Do nothing if not registering options.
5640 Assert if same short option registered twice.
5641 (General_options::General_options): Turn off option registration when
5643 (Command_line::Pre_options::Pre_options): New constructor.
5645 2009-08-24 Cary Coutant <ccoutant@google.com>
5647 * options.h (General_options::no_keep_memory): Remove incorrect
5650 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5652 * Makefile.am (am__skiplex, am__skipyacc): New.
5653 * Makefile.in: Regenerate.
5655 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5657 * Makefile.am (AM_CPPFLAGS): Renamed from ...
5658 (INCLUDES): ... this.
5659 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
5660 (AM_CPPFLAGS): Renamed from ...
5661 (INCLUDE): ... this.
5662 * Makefile.in, testsuite/Makefile.in: Regenerate.
5664 * Makefile.in: Regenerate.
5665 * aclocal.m4: Likewise.
5666 * config.in: Likewise.
5667 * configure: Likewise.
5668 * testsuite/Makefile.in: Likewise.
5670 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
5671 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
5672 * Makefile.in: Regenerate.
5673 * testsuite/Makefile.in: Regenerate.
5675 2009-08-19 Cary Coutant <ccoutant@google.com>
5677 * resolve.cc (Symbol_table::resolve): Don't complain about defined
5678 symbols in shared libraries overridden by hidden or internal symbols
5679 in the main program.
5681 2009-08-19 Chris Demetriou <cgd@google.com>
5683 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
5684 checking source file names in error messages.
5686 2009-08-18 Doug Kwan <dougkwan@google.com>
5688 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
5689 an elcpp::Ehdr as parameter. Adjust call to set_target.
5690 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
5691 an elfcpp::Ehdr as parameter.
5692 * object.cc (Object::set_target): Remove the version that looks up
5693 a target and sets it.
5694 (Sized_relobj::setup): Take a Target object instead of
5695 an elfcpp::Ehdr as parameter. Adjust call to set_target.
5696 (make_elf_sized_object): Find target and ask target to
5698 * object.h: (Object::set_target): Remove the version that looks up
5699 a target and sets it.
5700 (Sized_relobj::setup): Take a Target object instead of
5701 an elfcpp:Ehdr as parameter.
5702 * target.cc: Include dynobj.h.
5703 (Target::do_make_elf_object_implementation): New.
5704 (Target::do_make_elf_object): New.
5705 * target.h (Target::make_elf_object): New template declaration.
5706 (Target::do_make_elf_object): New method declarations.
5707 (Target::do_make_elf_object_implementation): New template declaration.
5709 2009-08-14 Ian Lance Taylor <iant@google.com>
5711 * gold.h (FUNCTION_NAME): Define.
5712 (gold_unreachable): Use FUNCTION_NAME.
5714 2009-08-12 Sriraman Tallam <tmsriram@google.com>
5716 * icf.cc (Icf::find_identical_sections): Issue a warning when a
5717 symbol in the --keep-unique list is not found.
5719 2009-08-12 Sriraman Tallam <tmsriram@google.com>
5721 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
5722 been maked as --keep-unique.
5723 (Icf::unfold_section): New function.
5724 * icf.h (Icf::unfold_section): New function.
5725 * options.h (General_options::keep_unique): New option.
5726 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
5727 * testsuite/Makefile.in: Regenerate.
5728 * testsuite/icf_keep_unique_test.sh: New file.
5729 * testsuite/icf_keep_unique_test.cc: New file.
5731 2009-08-12 Cary Coutant <ccoutant@google.com>
5734 * resolve.cc (Symbol_table::resolve): Check for references from
5735 dynamic objects to hidden and internal symbols.
5736 * testsuite/Makefile.am (hidden_test.sh): New test.
5737 * testsuite/Makefile.in: Regenerate.
5738 * testsuite/hidden_test.sh: New script.
5739 * testsuite/hidden_test_1.c: New test source.
5740 * testsuite/hidden_test_main.c: New test source.
5742 2009-08-11 Doug Kwan <dougkwan@google.com>
5744 * arm.cc: Update comments.
5745 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
5746 segment to locate the .ARM.exidx section if present.
5748 2009-08-09 Doug Kwan <dougkwan@google.com>
5750 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
5753 2009-08-07 Sriraman Tallam <tmsriram@google.com>
5754 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
5757 2009-08-06 Sriraman Tallam <tmsriram@google.com>
5759 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
5760 valid tls_segment only for non-debug-section relocations.
5761 * testsuite/Makefile.am: Add gc_tls_test.
5762 * testsuite/Makefile.in: Regenerate.
5763 * testsuite/gc_tls_test.cc: New file.
5764 * testsuite/gc_tls_test.sh: New file.
5766 2009-08-05 Sriraman Tallam <tmsriram@google.com>
5770 * Makefile.am (CCFILES): Add icf.cc.
5772 * Makefile.in: Regenerate.
5773 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
5774 * gc.h (gc_process_relocs): Populate lists used by icf to contain
5775 section, symbol and addend information for the relocs.
5776 * gold.cc (queue_middle_tasks): Call identical code folding.
5777 * gold.h: Add defines for multimap.
5778 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
5779 to the call of finalize_local_symbols.
5780 * main.cc (main): Create object of class Icf.
5781 * object.cc (Sized_relobj::do_layout): Allow this function to be
5782 called twice during icf.
5783 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
5784 to sections marked as identical by icf.
5785 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
5787 (Sized_relobj::do_section_entsize): New function.
5788 * object.h (Object::section_entsize): New function.
5789 (Object::do_section_entsize): New pure virtual function.
5790 (Relobj::finalize_local_symbols): Add new parameter.
5791 (Relobj::do_section_entsize): New function.
5792 * options.h (General_options::icf): New option.
5793 (General_options::icf_iterations): New option.
5794 (General_options::print_icf_sections): New option.
5795 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
5796 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
5797 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
5799 * symtab.cc (Symbol_table::is_section_folded): New function.
5800 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
5801 to sections marked as identical by icf.
5802 * symtab.h (Symbol_table::set_icf): New function.
5803 (Symbol_table::icf): New function.
5804 (Symbol_table::is_section_folded): New function.
5805 (Symbol_table::icf_): New data member.
5806 * target-reloc.h (relocate_section): Ignore sections folded by icf.
5807 * testsuite/Makefile.am: Add commands to build icf_test.
5808 * testsuite/Makefile.in: Regenerate.
5809 * testsuite/icf_test.sh: New file.
5810 * testsuite/icf_test.cc: New file.
5812 2009-07-24 Chris Demetriou <cgd@google.com>
5814 * layout.cc (is_compressible_debug_section): Fix incorrect
5815 comment about compressed section names.
5817 2009-07-20 Ian Lance Taylor <ian@airs.com>
5820 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
5822 2009-07-16 Ian Lance Taylor <iant@google.com>
5825 * layout.h: #include <map>.
5826 (class Kept_section): Change from struct to class. Add accessors
5827 and setters. Add section size to Comdat_group mapping. Change
5828 Comdat_group to std::map. Add is_comdat_ field. Add
5829 linkonce_size field in union.
5830 (class Layout): Update declaration of find_or_add_kept_section.
5831 Don't declare find_kept_object.
5832 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
5833 parameter. Add object, shndx, is_comdat, and is_group_name
5834 parameters. Change all callers. Adjust for new Kept_section.
5835 (Layout::find_kept_object): Remove.
5836 * object.cc (Sized_relobj::include_section_group): Update use of
5837 Kept_section. Rename secnum to shndx. Only record
5838 Kept_comdat_section if sections are the same size.
5839 (Sized_relobj::include_linkonce_section): Update use of
5840 Kept_section. Only record Kept_comdat_section if sections are the
5841 same size. Set size of linkonce section.
5842 (Sized_relobj::map_to_kept_section): Update call to
5843 get_kept_comdat_section.
5844 * object.h (class Sized_relobj): Rename fields in
5845 Kept_comdat_section to drop trailing underscores; change object
5846 field to Relobj*. Change Kept_comdat_section_table to store
5847 struct rather than pointer.
5848 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
5849 Add kept_object and kept_shndx parameters. Change all callers.
5850 (Sized_relobj::get_kept_comdat_section): Change return type to
5851 bool. Add kept_object and kept_shndx parameters. Change all
5853 * plugin.cc (Pluginobj::include_comdat_group): Update call to
5854 Layout::find_or_add_kept_section.
5856 2009-07-09 Ian Lance Taylor <iant@google.com>
5858 * merge.cc (Object_merge_map::initialize_input_to_output_map):
5859 Reserve space in the hash table.
5861 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
5863 * fileread.cc (File_read::get_mtime): New method.
5864 * fileread.h (Timespec): New structure.
5865 (File_read::get_mtime): New method.
5866 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
5867 Renamed from timestamp_nsec.
5868 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
5870 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
5872 (Incremental_inputs::report_archive): Save mtime; style fix.
5873 (Incremental_inputs::report_obejct): Save mtime; style fix.
5874 (Incremental_inputs::report_script): Save mtime; style fix.
5875 (Incremental_inputs::finalize_inputs): Style fix.
5876 (Incremental_inputs::finalize): Style fix.
5877 (Incremental_inputs::create_input_section_data): Store inputs
5879 * incremental.h (Incremental_inputs::report_script): Add mtime
5881 (Incremental_inputs::Input_info::Input_info): Intialize only one
5883 (Incremental_inputs::Input_info::archive): Move to nameless
5885 (Incremental_inputs::Input_info::obejct): Move to nameless union.
5886 (Incremental_inputs::Input_info::script): Move to nameless union.
5887 (Incremental_inputs::mtime): New field.
5888 * script.cc (read_input_script): Pass file mtime to
5890 * script.h (Script_info::inputs): Style fix.
5892 2009-07-01 Ian Lance Taylor <ian@airs.com>
5894 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
5897 2009-06-24 Ian Lance Taylor <iant@google.com>
5900 * layout.cc (Layout::choose_output_section): If we find an
5901 existing section, update the flags.
5902 (Layout::create_notes): New function, broken out of
5904 (Layout::finalize): Don't create note sections.
5905 (Layout::create_note): Don't crash if linker script discards
5907 (Layout::create_gold_note): Likewise.
5908 (Layout::create_build_id): Likewise. Don't set
5909 after_input_sections on the section.
5910 (Layout::create_executable_stack_info): Remove target parameter.
5912 * layout.h (class Layout): Declare create_notes. Update
5913 declaration of create_executable_stack_info.
5914 * gold.cc (queue_middle_tasks): Call create_notes.
5915 * output.cc (Output_section::update_flags_for_input_section): Move
5916 here from output.h. If SHF_ALLOC flag is newly set, mark address
5918 * output.h (Output_data::mark_address_invalid): New function.
5919 (class Output_section): Only declare, not define,
5920 update_flags_for_input_section. Remove set_flags.
5922 2009-06-24 Ian Lance Taylor <iant@google.com>
5924 * script-sections.cc (Output_section_definition::
5925 set_section_addresses): Rename shadowing local load_address to
5928 2009-06-24 Ian Lance Taylor <iant@google.com>
5931 * reloc.cc (relocate_sections): Skip empty relocation sections.
5933 2009-06-23 Ian Lance Taylor <iant@google.com>
5936 * layout.cc (Layout::create_note): Use choose_output_section
5937 rather than make_output_section.
5939 2009-06-23 Ian Lance Taylor <iant@google.com>
5942 * options.cc (General_options::parse_V): Set printed_version_.
5943 (General_options::General_options): Initialize printed_version_.
5944 * options.h (class General_options): Add printed_version_ field.
5945 * gold.cc (queue_initial_tasks): If there are no input files,
5946 don't give a fatal error if we printed the version information.
5947 (queue_middle_tasks): If using -r with a shared object, give a
5948 fatal error rather than an ordinary error.
5950 2009-06-23 Ian Lance Taylor <iant@google.com>
5953 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
5954 (Layout::make_output_section): Set have_stabstr_section_ if we see
5955 a .stab*str section.
5956 (Layout::finalize): Call link_stabs_sections.
5957 (Layout::link_stabs_sections): New file.
5958 * layout.h (class Layout): Add have_stabstr_section_ field.
5959 Declare link_stabs_sections.
5961 2009-06-23 Doug Kwan <dougkwan@google.com>
5963 * Makefile.am (libgold_a_LIBADD): New.
5964 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
5965 * Makefile.in: Regenerate.
5966 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
5967 * configure: Regenerate.
5968 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
5969 * fileread.cc: Include sys/state.h
5970 * gold.h: Declare memmem and strndup if found missing.
5971 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
5973 2009-06-23 Ian Lance Taylor <iant@google.com>
5975 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
5976 * configure: Rebuild.
5978 2009-06-23 Ian Lance Taylor <iant@google.com>
5981 * object.cc (Object::section_contents): Don't try to get a view if
5982 the section has length zero.
5983 (Object::handle_gnu_warning_section): If the section is empty, use
5984 the name of the section as the warning.
5986 2009-06-23 Ian Lance Taylor <iant@google.com>
5989 * stringpool.h (class Stringpool_template): Add optimize_ field.
5990 (Stringpool_template::set_optimize): New function.
5991 * stringpool.cc (Stringpool_template::Stringpool_template):
5992 Initialize optimize_ field.
5993 (Stringpool_template::set_string_offsets): Test local optimize
5994 fild rather than parameter.
5995 * layout.cc (Layout::Layout): Call set_optimize on the section
5998 2009-06-22 Ian Lance Taylor <iant@google.com>
6001 * yyscript.y: Parse TARGET.
6002 * script.cc (script_set_target): New function.
6003 * script-c.h (script_set_target): Declare.
6004 * options.cc (General_options::string_to_object_format): Rename
6005 from string_to_object_format in anonymous namespace. Change
6007 * options.h (class General_options): Declare
6008 string_to_object_format.
6010 2009-06-22 Ian Lance Taylor <iant@google.com>
6012 * script-sections.cc (Script_sections::create_segments): Don't put
6013 program headers in a PT_LOAD segment if -n or -N.
6015 2009-06-22 Ian Lance Taylor <iant@google.com>
6018 * options.h (class General_options): Add -z lazy and -z now. Sort
6019 -z options into alphabetical order.
6020 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
6022 2009-06-21 Ian Lance Taylor <iant@google.com>
6024 * layout.cc (Layout::make_output_section): Call
6025 Target::new_output_section.
6026 (Layout::attach_allocated_section_to_segment): Put large section
6027 sections in a separate load segment with the large segment flag
6029 (Layout::segment_precedes): Sort large data segments after other
6031 (align_file_offset): New static function.
6032 (Layout::set_segment_offsets): Use align_file_offset.
6033 * output.h (class Output_section): Add is_small_section_ and
6034 is_large_section_ fields.
6035 (Output_section::is_small_section): New function.
6036 (Output_section::set_is_small_section): New function.
6037 (Output_section::is_large_section): New function.
6038 (Output_section::set_is_large_section): New function.
6039 (Output_section::is_large_data_section): New function.
6040 (class Output_segment): Add is_large_data_segment_ field.
6041 (Output_segment::is_large_data_segment): New function.
6042 (Output_segment::set_is_large_data_segment): New function.
6043 * output.cc (Output_section::Output_section): Initialize new
6045 (Output_segment::Output_segment): Likewise.
6046 (Output_segment::add_output_section): Add assertion that large
6047 data sections always go in large data segments. Force small data
6048 sections to the end of the list of data sections. Force small BSS
6049 sections to the start of the list of BSS sections. For large BSS
6050 sections to the end of the list of BSS sections.
6051 * symtab.h (class Symbol): Declare is_common_shndx.
6052 (Symbol::is_defined): Check Symbol::is_common_shndx.
6053 (Symbol::is_common): Likewise.
6054 (class Symbol_table): Define enum Commons_section_type. Update
6055 declarations. Add small_commons_ and large_commons_ fields.
6056 * symtab.cc (Symbol::is_common_shndx): New function.
6057 (Symbol_table::Symbol_table): Initialize new fields.
6058 (Symbol_table::add_from_object): Put small and large common
6059 symbols in the right list.
6060 (Symbol_table::sized_finalized_symbol): Check
6061 Symbol::is_common_shndx.
6062 (Symbol_table::sized_write_globals): Likewise.
6063 * common.cc (Symbol_table::do_allocate_commons): Allocate new
6064 common symbol lists. Don't call do_allocate_commons_list if the
6066 (Symbol_table::do_allocate_commons_list): Remove is_tls
6067 parameter. Add comons_section_type parameter. Change all
6068 callers. Handle small and large common symbols.
6069 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
6070 Symbol::is_common_shndx.
6071 * resolve.cc (symbol_to_bits): Likewise.
6072 * target.h (Target::small_common_shndx): New function.
6073 (Target::small_common_section_flags): New function.
6074 (Target::large_common_shndx): New function.
6075 (Target::large_common_section_flags): New function.
6076 (Target::new_output_section): New function.
6077 (Target::Target_info): Add small_common_shndx, large_common_shndx,
6078 small_common_section_flags, and large_common_section_flags
6080 (Target::do_new_output_section): New virtual function.
6081 * arm.cc (Target_arm::arm_info): Initialize new fields.
6082 * i386.cc (Target_i386::i386_info): Likewise.
6083 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
6085 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
6086 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
6087 (Target_x86_64::do_new_output_section): New function.
6088 * configure.ac: Define conditional MCMODEL_MEDIUM.
6089 * testsuite/Makefile.am (check_PROGRAMS): Add large.
6090 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
6091 (large_LDFLAGS): Define.
6092 * testsuite/large.c: New file.
6093 * testsuite/testfile.cc (Target_test::test_target_info):
6094 Initialize new fields.
6095 * configure, testsuite/Makefile.in: Rebuild.
6097 2009-06-05 Doug Kwan <dougkwan@google.com>
6099 * Makefile.am (CCFILES): Add target.cc.
6100 * Makefile.in: Regenerate.
6101 * i386.cc (class Target_i386): Define new virtual method to
6102 override do_is_local_label_name in parent.
6103 * object.cc (Sized_relobj::do_count_local_symbols): Discard
6104 local symbols if --discard-locals or -X is given.
6105 * options.h (class General_options): Declare new options
6106 '--discard-locals' and '-X' for discarding locals.
6107 * target.h (class Target): Define new methods is_local_label_name.
6108 Declare new virtual method do_is_local_label_name.
6109 * target.cc: New file.
6110 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
6111 (check_SCRIPTS): Add discard_locals_test.sh.
6112 (check_DATA): Add discard_local_tests.syms.
6113 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
6114 (discard_local_tests.syms, discard_locals_test.o): New make rules.
6115 * testsuite/Makefile.in: Regenerate.
6116 * testsuite/discard_locals_test.c: New file.
6117 * testsuite/discard_locals_test.sh: Same.
6119 2009-06-05 Doug Kwan <dougkwan@google.com>
6121 * object.cc (Sized_relobj::Sized_relobj): Initialize
6122 discarded_eh_frame_shndx_ to -1U.
6123 (Sized_relobj::do_layout): Record index of a discard .eh_frame
6125 (Sized_relobj::do_count_local_symbols): Skip local symbols in
6126 a discarded .eh_frame section.
6127 (Sized_relobj::do_finalize_local_symbols): Ditto.
6128 * object.h (class Sized_relobj): Declare new member
6129 discarded_eh_frame_shndx_.
6130 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
6131 (local_labels_test.o, local_labels_test): New rules.
6132 * testsuite/Makefile.in: Regenerate.
6134 2009-06-04 Doug Kwan <dougkwan@google.com>
6136 * layout.cc (Layout::section_name_mapping): Add mapping for
6137 special ARM sections.
6139 2009-06-03 Doug Kwan <dougkwan@google.com>
6141 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
6142 (utils::has_overflow): Same.
6144 2009-06-03 Ian Lance Taylor <iant@google.com>
6146 * layout.cc (Layout::section_name_mapping): New array, replacing
6147 Layout::linkonce_mapping.
6148 (Layout::section_name_mapping_count): New variable, replacing
6149 Layout::linkonce_mapping_count.
6150 (Layout::linkonce_output_name): Remove.
6151 (Layout::output_section_name): Rewrite.
6152 * layout.h (class Layout): Rename Linkonce_mapping to
6153 Section_name_mapping, linkonce_mapping to section_name_mapping,
6154 linkonce_mapping_count to section_name_mapping_count. Don't
6155 declare linkonce_output_name.
6157 2009-06-03 Doug Kwan <dougkwan@google.com>
6159 * gold/arm.cc (namespace utils): New.
6160 (Target_arm::reloc_is_non_pic): Define new method.
6161 (class Arm_relocate_functions): New.
6162 (Target_arm::Relocate::relocate): Handle relocation types used by
6165 2009-06-03 Ian Lance Taylor <iant@google.com>
6167 * arm.cc (Target_arm::scan::global): Use || instead of |.
6169 2009-06-02 Doug Kwan <dougkwan@google.com>
6171 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
6172 issued_non_pic_error_.
6173 (class Target_arm::Scan): Declare new method check_non_pic.
6174 Define new method symbol_needs_plt_entry.
6175 Declare new data member issued_non_pic_error_.
6176 (class Target_arm::Relocate): Declare new method
6177 should_apply_static_reloc.
6178 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
6179 (Target_arm::Scan::check_non_pic): Define new method.
6180 (Target_arm::Scan::local): Handle a small subset of reloc types used
6182 (Target_arm::Scan::local): Same.
6183 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
6185 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
6187 * incremental.cc (Incremental_inputs::report_command_line): Filter
6188 out --incremental-* options.
6190 2009-05-29 Doug Kwan <dougkwan@google.com>
6192 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
6194 (class Target_arm): Update comment.
6195 (Target_arm::Target_arm): Initialize new data members GOT_,
6196 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
6197 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
6198 and Target_arm::rel_dyn_section.
6199 Declare new_enum Target_arm::Got_type.
6200 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
6202 Update commments for member do_dynsym_value.
6203 (Target_arm::got_size, Target_arm::plt_section,
6204 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
6205 new methods inside class defintion.
6206 (Target_arm::got_section): Define new method.
6207 (Target_arm::rel_dyn_section): Same.
6208 (Output_data_plt_arm): New template class.
6209 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
6210 (Output_data_plt_arm:do_adjust_output_section): Define new method.
6211 (Output_data_plt_arm::add_entry): Same.
6212 (Output_data_plt_arm::first_plt_entry): Define new
6213 static data member for PLT instruction template.
6214 (Output_data_plt_arm::plt_entry): Same.
6215 (Output_data_plt_arm::do_write): Define new method.
6216 (Target_arm::make_plt_entry): Same.
6217 (Target_arm::do_finalize_sections): Same.
6218 (Target_arm::do_dynsym_value): Same.
6220 2009-05-28 Doug Kwan <dougkwan@google.com>
6222 * Makefile.am (TARGETSOURCES): Add arm.cc.
6223 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
6224 * Makefile.in: Regenerate.
6226 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
6228 2009-05-26 Doug Kwan <dougkwan@google.com>
6230 * options.cc (General_options::parse_exclude_libs). Fix a comment.
6231 (General_options::check_excluded_libs): Strip off directories in
6232 archive name before matching like GNU ld does.
6233 * testsuite/Makefile.am (MOSTLYCLEANFILES,
6234 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
6235 (exclude_libs_test_LDFLAGS): Add linker option
6236 -Wl,--exclude-libs,libexclude_libs_test_3
6237 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
6238 an explicit archive without using -l.
6239 (alt/libexclude_libs_test_3.a): New make rule.
6240 * testsuite/Makefile.in: Regenerate.
6241 * testsuite/exclude_libs_test.c : Declare lib3_default().
6243 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
6244 * exclude_libs_test_3.c: New file.
6246 2009-05-26 Nick Clifton <nickc@redhat.com>
6248 * po/id.po: New Indonesian translation.
6249 * po/gold.pot: Updated template file.
6251 2009-05-22 Sriraman Tallam <tmsriram@google.com>
6253 * testsuite/Makefile.am: Add -ffunction-sections to compile
6254 gc_comdat_test files. Add -Wl,--gc-sections to build
6256 * testsuite/Makefile.in: Regenerate.
6257 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
6259 2009-05-21 Sriraman Tallam <tmsriram@google.com>
6261 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
6262 kept comdat section was garbage collected.
6263 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
6264 * testsuite/Makefile.in: Regenerate.
6265 * testsuite/gc_comdat_test.sh: New file.
6266 * testsuite/gc_comdat_test_1.cc: New file.
6267 * testsuite/gc_comdat_test_2.cc: New file.
6269 2009-05-19 Doug Kwan <dougkwan@google.com>
6271 * archive.cc (Archive::Archive): Move constructor from archive.h
6272 to here. Initialize no_export_.
6273 (Archive::get_elf_object_for_member): Set no_export flag of object.
6274 * archive.h (Archive::Archive): Move constructor body to
6276 (Archive::no_export): New method.
6277 (Archive::no_export_): New field.
6278 * object.h (Object::Object): Initialize no_export_ to false.
6279 (Object::no_export, Object::set_no_export): New methods.
6280 (Object::no_export_): New field.
6281 * options.cc (General_options::parse_exclude_libs): New method.
6282 (General_options::check_excluded_libs) Same.
6283 * options.h (exclude_libs): New option.
6284 (General_options::check_excluded_libs): New method declaration.
6285 (General_options::excluded_libs_): New field.
6286 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
6287 default or protected visibility if an object has no-export flag set.
6288 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
6289 (check_SCRIPTS): Add exclude_libs_test.sh.
6290 (check_DATA): Add exclude_libs_test.syms.
6291 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
6292 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
6293 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
6294 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
6295 (exclude_libs_test.syms, libexclude_libs_test_1.a,
6296 libexclude_libs_test_2.a): New rules.
6297 * testsuite/Makefile.in: Regenerate.
6298 * testsuite/exclude_libs_test.c: New file.
6299 * testsuite/exclude_libs_test.sh: Ditto.
6300 * testsuite/exclude_libs_test_1.c: Ditto.
6301 * testsuite/exclude_libs_test_2.c: Ditto.
6303 2009-05-15 Ian Lance Taylor <iant@google.com>
6305 * configure.ac: Check for declarations for cases where libiberty.h
6306 checks HAVE_DECL_xxx.
6307 * configure, config.in: Rebuild.
6309 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
6311 * gold.h (Incremental_argument_list): Remove (invalid) forward
6313 * incremental.cc (Incremental_inputs::report_achive): New method.
6314 (Incremental_inputs::report_object): New method.
6315 (Incremental_inputs::report_script): New method.
6316 (Incremental_inputs::finalize_inputs): New method.
6317 (Incremental_inputs::finalize): Call finalize_inputs().
6318 (Incremental_inputs::sized_create_incremental_inputs_section_data):
6319 Create inputs entries.
6320 * incremental.h (Incremental_input_type): New enum.
6321 (Incremental_inputs::Incremental_input): Initialize new fields.
6322 (Incremental_inputs::report_inputs): New method.
6323 (Incremental_inputs::report_achive): New method.
6324 (Incremental_inputs::report_object): New method.
6325 (Incremental_inputs::report_script): New method.
6326 (Incremental_inputs::finalize_inputs): New method.
6327 (Incremental_inputs::Input_info): New struct.
6328 (Incremental_inputs::Input_info_map): New typedef.
6329 (Incremental_inputs::lock_): New field.
6330 (Incremental_inputs::Inputs_): New field.
6331 (Incremental_inputs::Inputs_map): New field.
6332 * main.cc (main): Call Incremental_input::report_inputs.
6333 * options.h (Input_argument_list): Typedef moved from
6335 (Input_file_group::Files): Remove, use ::Input_argument_list.
6336 (Input_file_group::Input_argument_list): Remove, use
6337 ::Input_argument_list.
6338 * plugin.cc (Plugin_manager::add_input_file): Add error in
6340 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
6342 * script.cc (read_input_script): Call
6343 Incremental_input::report_script.
6344 * script.h (Script_info): New class.
6346 2009-04-27 Ian Lance Taylor <iant@google.com>
6348 * x86_64.cc (do_adjust_output_section): Set entsize to
6351 2009-04-23 Elliott Hughes <enh@google.com>
6353 * output.cc (Output_file::close): After short writes, continue
6354 writing from the correct offset in the buffer being written.
6356 2009-04-23 Chris Demetriou <cgd@google.com>
6358 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
6359 * configure: Regenerate.
6360 * config.in: Regenerate.
6361 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
6362 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
6364 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
6366 * incremental.cc (Incremental_inputs_header_data): Renamed from
6367 Incremental_input_header_data.
6368 (Incremental_inputs_header_data::data_size): New field.
6369 (Incremental_inputs_header_data::put_input_file_count): Renamed
6370 from input_file_count.
6371 (Incremental_inputs_header_data::put_command_line_offset): Renamed
6372 from command_line_offset.
6373 (Incremental_inputs_header_data::put_reserved): Renamed from
6375 (Incremental_inputs_entry_data): Renamed from
6376 Incremental_input_entry_data.
6377 (Incremental_inputs_entry_data::data_size): New field.
6378 (Incremental_inputs::report_command_line): New method.
6379 (Incremental_inputs::finalize): New method.
6380 (Incremental_inputs::create_incremental_inputs_data): New method.
6381 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
6382 * incremental.h: New file.
6383 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
6384 (Layout::finalize): Create incremental inputs section in
6386 (Layout::create_incremental_info_sections): New method.
6387 * layout.h (Layout::incremental_inputs): New method.
6388 (Layout::create_incremental_info_sections): New method.
6389 (Layout::incremental_inputs_): New field.
6390 * main.cc (main): Notify Incremental_input of the command line.
6392 2009-04-01 Ian Lance Taylor <iant@google.com>
6393 Mikolaj Zalewski <mikolajz@google.com>
6395 * gold.h (reserve_unordered_map): Define, three versions, one for
6396 each version of Unordered_map.
6397 * layout.cc (Layout::Layout): Remove options parameter. Add
6398 number_of_input_files parameter. Don't initialize options_.
6399 Initialize number_of_input_files_ and resized_signatures_. Move
6400 sections_are_attached_.
6401 (Layout::layout_group): Reserve space for group_signatures_.
6402 (Layout::find_or_add_kept_section): Change name parameter to be a
6403 reference. Resize signatures_ map when it gets large enough.
6404 (Layout::layout_eh_frame): Use parameters->options() instead of
6406 (Layout::make_output_section): Likewise.
6407 (Layout::attach_allocated_section_to_segment): Likewise.
6408 (Layout::finalize, Layout::create_executable_stack): Likewise.
6409 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
6410 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
6411 * layout.h (class Layout): Update declarations. Remove options_
6412 field. Add number_of_input_files_ and resized_signatures_
6413 fields. Move sections_are_attached_ field.
6414 * main.cc (main): Pass number of input files to Layout
6415 constructor. Don't pass options.
6417 2009-03-30 Ian Lance Taylor <iant@google.com>
6419 * ffsll.c (ffsll): Correct implementation.
6421 2009-03-27 Ian Lance Taylor <iant@google.com>
6423 * ffsll.c: New file.
6424 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
6425 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
6426 * ftruncate.c (ftruncate): Declare before definition.
6427 * mremap.c (mremap): Likewise.
6428 * pread.c (pread): Likewise.
6429 * configure, Makefile.in, config.in: Rebuild.
6431 * mremap.c: New file.
6432 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
6433 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
6434 (mremap): Declare if HAVE_MREMAP is not defined.
6435 * configure, Makefile.in, config.in: Rebuild.
6437 2009-03-27 Cary Coutant <ccoutant@google.com>
6439 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
6440 position independent.
6441 * sparc.cc (Target_sparc::check_non_pic): Likewise.
6442 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
6444 2009-03-24 Cary Coutant <ccoutant@google.com>
6446 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
6448 (needs_dynamic_reloc): Likewise.
6450 2009-03-24 Ian Lance Taylor <iant@google.com>
6452 * yyscript.y (file_cmd): Recognize EXTERN.
6453 (extern_name_list, extern_name_list_body): New nonterminals.
6454 * script.cc (script_add_extern): Define.
6455 * script-c.h (script_add_extern): Declare.
6457 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
6459 * object.cc (is_elf_object): Define.
6460 * object.h (is_elf_object): Declare.
6461 * archive.cc (Archive::get_elf_object_for_member): Call
6463 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
6465 2009-03-24 Elliott Hughes <enh@google.com>
6467 * output.cc (Output_file::map_anonymous): Define.
6468 (Output_file::map): Use map_anonymous. If the regular mmap fails,
6469 try an anonymous one. Report the size if the mmap fails.
6470 * output.h (class Output_file): Declare map_anonymous.
6472 2009-03-24 Ian Lance Taylor <iant@google.com>
6474 * target-select.cc (instantiate_target): Don't acquire the lock if
6475 the instantiated_target_ field has already been set.
6477 2009-03-23 Ian Lance Taylor <iant@google.com>
6479 * gold-threads.h (class Initialize_lock): Define.
6480 * gold-threads.cc (class Initialize_lock_once): Define.
6481 (initialize_lock_control): New static variable.
6482 (initialize_lock_pointer): New static variable.
6483 (initialize_lock_once): New static function.
6484 (Initialize_lock::Initialize_lock): Define.
6485 (Initialize_lock::initialize): Define.
6486 * target-select.h: Include "gold-threads.h".
6487 (class Target_selector): Add lock_ and initialize_lock_ fields.
6488 Don't define instantiate_target, just declare it.
6489 * target-select.cc (Target_selector::Target_selector): Initialize
6491 (Target_selector::instantiate_target): Define.
6492 * descriptors.h: Include "gold-threads.h".
6493 (class Descriptors): Add initialize_lock_ field.
6494 * descriptors.cc (Descriptors::Descriptors): Initialize new
6496 (Descriptors::open): Use initialize_lock_ field
6497 * errors.h (class Errors): Add initialize_lock_ field.
6498 * errors.cc (Errors::Errors): Initialize new field.
6499 (Errors::initialize_lock): Use initialize_lock_ field.
6500 * powerpc.cc (class Target_selector_powerpc): Remove
6501 instantiated_target_ field. In do_recognize call
6502 instantiate_target rather than do_instantiate_target. In
6503 do_instantiate_target just allocate a new target.
6504 * sparc.cc (class Target_selector_sparc): Likewise.
6506 * freebsd.h: New file.
6507 * i386.cc: Include "freebsd.h".
6508 (Target_i386): Derive from Target_freebsd rather than
6510 (Target_selector_i386): Derive from Target_selector_freebsd rather
6511 than Target_selector.
6512 * x86_64.cc: Include "freebsd.h".
6513 (Target_x86_64): Derive from Target_freebsd rather than
6515 (Target_selector_x86_64): Derive from Target_selector_freebsd
6516 rather than Target_selector.
6517 * target.h (class Target): Add adjust_elf_header and
6518 do_adjust_elf_header.
6519 * output.cc (Output_file_header:: do_sized_write): Call target
6520 adjust_elf_header routine.
6521 * configure.tgt: Set targ_osabi.
6522 * configure.ac: Define GOLD_DEFAULT_OSABI.
6523 * parameters.cc (Parameters::default_target): Pass
6524 GOLD_DEFAULT_OSABI to select_target.
6525 * target-select.h (class Target_selector): Make instantiate_target
6526 protected rather than private.
6527 * Makefile.am (HFILES): Add freebsd.h.
6528 * configure, Makefile.in, config.in: Rebuild.
6530 * merge.cc (do_add_input_section): Correct pend value. Change
6531 message about last entry not being null terminated from error to
6534 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
6536 * incremental.cc: New file.
6537 * Makefile.am (CCFILES): Add incremental.cc.
6538 * Makefile.in: Rebuild.
6540 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
6542 * layout.cc (Layout::output_section_name): Preserve names
6543 of '.note.' sections.
6545 2009-03-19 Ian Lance Taylor <iant@google.com>
6547 * descriptors.cc (Descriptors::open): Check that the options are
6548 valid before using them.
6550 2009-03-18 Ian Lance Taylor <iant@google.com>
6552 * script-sections.h: Include <list>.
6553 (class Script_sections): Change Sections_elements from std::vector
6554 to std::list. Typedef public Elements_iterator. Add
6555 orphan_section_placement_, data_segment_align_start_, and
6556 saw_data_segment_align_ fields. Remove data_segment_align_index_
6558 * script-sections.cc (class Orphan_section_placement): New class.
6559 (class Sections_element): Add virtual functions is_relro and
6560 orphan_section_init. Remove virtual function place_orphan_here.
6561 (class Output_section_definition): Add is_relro and
6562 orphan_section_init. Remove place_orphan_here.
6563 (class Orphan_output_section): Likewise.
6564 (Script_sections::Script_sections): Update for field changes.
6565 (Script_sections::data_segment_align): Set saw_data_segment_align_
6566 and data_segment_align_start_, not data_segment_align_index.
6567 (Script_sections::data_segment_relro_end): Check
6568 saw_data_segment_align_. Use data_segment_align_start_ rather
6569 than data_segment_align_index_.
6570 (Script_sections::place_orphan): Rewrite to use
6571 Orphan_section_placement.
6573 2009-03-17 Ian Lance Taylor <iant@google.com>
6575 * archive.cc (Archive::add_symbols): Check for a version attached
6576 to the symbol name in the archive map.
6577 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
6578 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
6579 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
6580 (ver_test_11.a): New target.
6581 * testsuite/Makefile.in: Rebuild.
6583 * configure.ac: Check for chsize and posix_fallocate. Replace
6585 * ftruncate.c: New file, from gnulib.
6586 * output.cc (posix_fallocate): Define dummy version if not
6587 HAVE_POSIX_FALLOCATE.
6588 (Output_file::map): Call posix_fallocate rather than lseek and
6590 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
6591 * configure, Makefile.in, config.in: Rebuild.
6593 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
6595 * layout.h (Layout::create_note): Add section_name parameter.
6596 * layout.cc (Layout::create_note): Likewise.
6597 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
6599 2009-03-17 Ian Lance Taylor <iant@google.com>
6601 * descriptors.cc: Include "options.h".
6602 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
6603 (Descriptors::open): Always use O_CLOEXEC when opening a new
6604 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
6605 then set FD_CLOEXEC.
6607 * sparc.cc (class Target_sparc): Add has_got_section.
6608 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
6609 make sure we have a GOT section.
6611 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
6612 (Target_sparc::Scan::local): Likewise.
6613 (Target_sparc::Scan::global): Likewise.
6614 (Target_sparc::Relocate::relocate): Likewise.
6615 (Target_sparc::Relocate::relocate_tls): Likewise.
6617 * symtab.cc (Symbol_table::define_default_version): New function,
6618 broken out of add_from_object.
6619 (Symbol_table::add_from_object): Call define_default_version.
6620 (Symbol_table::define_special_symbol): Add resolve_oldsym
6621 parameter. Change all callers. If the version for a symbol comes
6622 from a version script, resolve it with the symbol with the same
6623 name with no version. Also add the symbol without a version if
6625 (do_define_in_output_data): If resolving with oldsym, don't delete
6627 (do_define_in_output_segment): Likewise.
6628 (do_define_as_constant): Likewise.
6629 * symtab.h (class Symbol_table): Update declarations.
6631 2009-03-13 Ian Lance Taylor <iant@google.com>
6633 * readsyms.cc (Read_symbols::incompatible_warning): New function.
6634 (Read_symbols::requeue): New function.
6635 (Read_symbols::do_read_symbols): If make_elf_object fails because
6636 the target type is not configured, and the file was searched for,
6637 issue a warning and retry with the next directory.
6638 (Add_symbols::run): If the file has an incompatible format, and
6639 it was searched for, requeue the Read_symbols task. On error,
6641 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
6642 dirindex parameter to constructor. Change all callers. Declare
6643 incompatible_warning and requeue.
6644 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
6645 input_argument_ and input_group_ fields. Add them to
6646 constructor. Change all callers.
6647 (class Read_script): Add dirindex_ field. Add it to constructor.
6649 * archive.cc (Archive::setup): Remove input_objects parameter.
6651 (Archive::get_file_and_offset): Likewise.
6652 (Archive::read_all_symbols): Likewise.
6653 (Archive::read_symbols): Likewise.
6654 (Archive::get_elf_object_for_member): Remove input_objects
6655 parameter. Add punconfigured parameter. Change all callers.
6656 (Archive::add_symbols): Change return type to bool. Check return
6657 value of include_member.
6658 (Archive::include_all_members): Likewise.
6659 (Archive::include_member): Change return type to bool. Return
6660 false if first included object has incompatible target. Set
6661 included_member_ field.
6662 (Add_archive_symbols::run): If add_symbols returns false, requeue
6664 * archive.h (class Archive): Add included_member_ field.
6665 Initialize it in constructor. Add input_file and searched_for
6666 methods. Update declarations.
6667 (class Add_archive_symbols): Add dirpath_, dirindex_, and
6668 input_argument_ fields. Add them to constructor. Change all
6670 * script.cc: Include "target-select.h".
6671 (class Parser_closure): Add skip_on_incompatible_target_ and
6672 found_incompatible_target_ fields. Add
6673 skip_on_incompatible_target parameter to constructor. Change all
6674 callers. Add methods skip_on_incompatible_target,
6675 clear_skip_on_incompatible_target, found_incompatible_target, and
6676 set_found_incompatible_target.
6677 (read_input_script): Add dirindex parameter. Change all callers.
6678 If parser finds an incompatible target, requeue Read_symbols
6680 (script_set_symbol): Clear skip_on_incompatible_target in
6682 (script_add_assertion, script_parse_option): Likewise.
6683 (script_start_sections, script_add_phdr): Likewise.
6684 (script_check_output_format): New function.
6685 * script.h (read_input_script): Update declaration.
6686 * script-c.h (script_check_output_format): Declare.
6687 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
6688 (ignore_cmd): Remove OUTPUT_FORMAT.
6689 * fileread.cc (Input_file::Input_file): Add explicit this.
6690 (Input_file::will_search_for): New function.
6691 (Input_file::open): Add pindex parameter. Change all callers.
6692 * fileread.h (class Input_file): Add input_file_argument method.
6693 Declare will_search_for. Update declarations.
6694 * object.cc (make_elf_object): Add punconfigured parameter.
6696 * object.h (class Object): Make input_file public. Add
6697 searched_for method.
6698 (make_elf_object): Update declaration.
6699 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
6701 * dirsearch.h (class Dirsearch): Update declaration.
6702 * options.h (class General_options): Add --warn-search-mismatch.
6703 * parameters.cc (Parameters::is_compatible_target): New function.
6704 * parameters.h (class Parameters): Declare is_compatible_target.
6705 * workqueue.cc (Workqueue::add_blocker): New function.
6706 * workqueue.h (class Workqueue): Declare add_blocker.
6708 * fileread.cc (Input_file::open): Remove options parameter.
6710 (Input_file::open_binary): Likewise.
6711 * script.cc (read_input_script): Likewise.
6712 * readsyms.h (class Read_symbols): Remove options_ field. Remove
6713 options parameter from constructor. Change all callers.
6714 (class Read_script): Likewise.
6715 * fileread.h (class Input_file): Update declarations.
6716 * script.h (read_input_script): Update declaration.
6718 2009-03-10 Nick Clifton <nickc@redhat.com>
6720 * po/es.po: New Spanish translation.
6722 2009-03-06 Cary Coutant <ccoutant@google.com>
6724 * options.cc (parse_short_option): Keep dash_z from registering itself.
6726 2009-03-03 Ian Lance Taylor <iant@google.com>
6729 * target-reloc.h (relocate_section): Pass output_section to
6731 * i386.cc (Target_i386::should_apply_static_reloc): Add
6732 output_section parameter. Change all callers.
6733 (Target_i386::Relocate::relocate): Add output_section parameter.
6734 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
6735 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
6736 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
6737 * testsuite/two_file_shared.sh: New script.
6738 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
6739 (check_DATA): Add two_file_shared.dbg.
6740 (two_file_shared.dbg): New target.
6741 * testsuite/Makefile.in: Rebuild.
6743 2009-03-01 Ian Lance Taylor <iant@google.com>
6745 * configure.ac: Check for byteswap.h.
6746 * configure: Rebuild.
6747 * config.in: Rebuild.
6749 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
6751 * layout.cc (Layout::find_or_add_kept_section): New function.
6752 (Layout::add_comdat): Removed.
6753 * layout.h (struct Kept_section): Move out of class Layout.
6754 Remove trailing underscores from field names. Add group_sections
6755 field. Rename group_ field to is_group. Change all uses.
6756 (class Layout): Declare find_or_add_kept_section, not add_comdat.
6757 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
6758 comdat_groups_ field.
6759 (Sized_relobj::include_section_group): Use
6760 find_or_add_kept_section and Kept_section::group_sections.
6761 (Sized_relobj::include_linkonce_section): Likewise.
6762 * object.cc (class Sized_relobj): Don't define Comdat_group or
6763 Comdat_group_table. Remove find_comdat_group and
6764 add_comdat_group. Remove comdat_groups_ field.
6765 * plugin.cc (include_comdat_group): Use
6766 Layout::find_or_add_kept_section.
6768 2009-02-28 Ian Lance Taylor <iant@google.com>
6770 * README: --gc-sections and map files are now supported. Document
6771 some build requirements.
6774 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
6775 relocatable link set the value of the section symbol to zero.
6776 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
6777 relocatable link don't include the section address in the local
6780 2009-02-27 Ian Lance Taylor <iant@google.com>
6783 * options.h (class Search_directory): Add is_system_directory.
6784 (class General_options): Declare is_in_system_directory.
6785 * options.cc (get_relative_sysroot): Make static.
6786 (get_default_sysroot): Make static.
6787 (General_optoins::is_in_system_directory): New function.
6788 * fileread.cc (Input_file::is_in_system_directory): New function.
6789 * fileread.h (class Input_file): Declare is_in_system_directory.
6790 * object.h (class Object): Add is_in_system_directory.
6791 (class Input_objects): Remove system_library_directory_ field.
6792 * object.cc (Input_objects::add_object): Don't set
6793 system_library_directory_.
6794 (input_objects::found_in_system_library_directory): Remove.
6795 * symtab.cc (Symbol_table::write_globals): Remove input_objects
6796 parameter. Change all callers.
6797 (Symbol_table::sized_write_globals): Likewise.
6798 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
6799 Call Object::is_in_system_directory.
6800 * symtab.h (class Symbol_table): Update declarations.
6803 * descriptors.h (Open_descriptor): Add is_on_stack field.
6804 * descriptors.cc (Descriptors::open): If the descriptor is on the
6805 top of the stack, remove it. Initialize is_on_stack field.
6806 (Descriptors::release): Only add pod to stack if it is not on the
6808 (Descriptors::close_some_descriptor): Clear stack_next and
6812 * output.cc (Output_section::find_starting_output_address): Rename
6813 from starting_output_address; add PADDR parameter; change return
6815 * output.h (class Output_section): Declare
6816 find_starting_output_address instead of starting_output_address.
6817 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
6818 section symbol for which we can't find a merge section.
6821 * symtab.cc (Symbol_table::add_from_object): If the visibility is
6822 hidden or internal, force the symbol to be local.
6823 * resolve.cc (Symbol::override_visibility): Define.
6824 (Symbol::override_base): Use override_visibility.
6825 (Symbol_table::resolve): Likewise.
6826 (Symbol::override_base_with_special): Likewise.
6827 (Symbol_table::override_with_special): If the visibility is hidden
6828 or internal, force the symbol to be local.
6829 * symtab.h (class Symbol): Add set_visibility and
6830 override_visibility.
6831 * testsuite/ver_test_1.sh: New file.
6832 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
6833 (check_DATA): Add ver_test_1.syms.
6834 (ver_test_1.syms): New target.
6835 * testsuite/Makefile.in: Rebuild.
6837 2009-02-25 Cary Coutant <ccoutant@google.com>
6839 * layout.cc (Layout::choose_output_section): Don't rename sections
6840 when using a linker script that has a SECTIONS clause.
6841 * Makefile.in: Regenerate.
6843 * testsuite/Makefile.am (script_test_5.sh): New test case.
6844 * testsuite/Makefile.in: Regenerate.
6845 * testsuite/script_test_5.cc: New file.
6846 * testsuite/script_test_5.sh: New file.
6847 * testsuite/script_test_5.t: New file.
6849 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
6851 * archive.cc (Archive::include_member): Update calls to add_symbols.
6852 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
6853 the Layout argument.
6854 * dynobj.h (do_add_symbols): Add the Layout argument.
6855 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
6857 * object.h (Object::add_symbols): Add the Layout argument.
6858 (Object::do_add_symbols): Add the Layout argument.
6859 (Sized_relobj::do_add_symbols): Add the Layout argument.
6860 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
6861 Unify the two versions.
6862 (Add_plugin_symbols): Remove.
6863 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
6864 (Sized_pluginobj::do_add_symbols): Unify the two versions.
6865 (Add_plugin_symbols): Remove.
6866 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
6867 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
6868 (Add_symbols::run): Make it work with Pulginobj.
6870 2009-02-06 Ian Lance Taylor <iant@google.com>
6872 * object.cc (Sized_relobj::do_layout): Make info message start
6873 with lower case letter.
6875 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
6877 * binary.cc: Fix file comment.
6879 * options.h (enum Incremental_disposition): Define.
6880 (class General_options): Add new options: --incremental,
6881 --incremental_changed, --incremental_unchanged,
6882 --incremental_unknown. Add incremental_disposition_ and
6883 implicit_incremental_ fields.
6884 (General_options::incremental_disposition): New function.
6885 (class Position_dependent_options): Add incremental_disposition
6887 (Position_dependent_options::copy_from_options): Set incremental
6889 * options.cc (General_options::parse_incremental_changed): New
6891 (General_options::parse_incremental_unchanged): New function.
6892 (General_options::parse_incremental_unknown): New function.
6893 (General_options::General_options): Initialize new fields
6894 incremental_disposition_ and implicit_incremental_.
6895 (General_options::finalize): Check for uasge of --incremental-*
6896 without --incremental.
6898 2009-02-06 Chris Demetriou <cgd@google.com>
6900 * gold.h (gold_undefined_symbol): Change to take only a Symbol
6901 pointer and to report location as the file name associated with
6903 (gold_undefined_symbol_at_location): New function to replace the
6904 old gold_undefined_symbol functionality.
6905 * target-reloc.h (relocate_section): Update to use
6906 gold_undefined_symbol_at_location.
6907 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
6908 Call gold_undefined_symbol function rather than gold_error.
6909 * errors.h (Errors::undefined_symbol): Take location as a
6910 string, rather than calculating it from a relocation.
6911 * errors.cc (Errors::fatal): Print "fatal error:" before the
6913 (Errors::error, Errors::error_at_location): Print "error: "
6914 before the formatted message.
6915 (Errors::undefined_symbol): Take location as a string, rather
6916 than calculating it from a relocation.
6917 (gold_undefined_symbol_at_location): New function akin to
6918 old gold_undefined_symbol, calculates location from relocation.
6919 (gold_undefined_symbol): Change to take only a Symbol pointer
6920 and to report location as the file name associated with the symbol.
6921 * testsuite/debug_msg.sh: Update for changed error messages.
6922 * testsuite/undef_symbol.sh: Likewise.
6924 2009-02-04 Duncan Sands <baldrick@free.fr>
6927 * reduced_debug_output.h
6928 (Output_reduced_debug_abbrev_section::failed): Use format for
6930 (Output_reduced_debug_info_section::faild): Likewise.
6932 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
6934 * script.cc (Lazy_demangler): New class.
6935 (Version_script_info::get_symbol_version_helper): Demangle a
6938 2009-01-29 Cary Coutant <ccoutant@google.com>
6940 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
6942 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
6944 2009-01-28 Ian Lance Taylor <iant@google.com>
6946 * version.cc (version_string): Bump to 1.9.
6948 * gold.h: Include <cstring> and <stdint.h>.
6949 * version.cc: Include <cstdio>.
6950 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
6952 * reduced_debug_output.cc (insert_into_vector): Rename from
6953 Insert_into_vector; change all callers. Use Swap_unaligned to
6954 avoid aliasing issue; remove union since it is unnecessary.
6956 2009-01-27 Sriraman Tallam <tmsriram@google.com>
6958 * Makefile.am (CCFILES): Add gc.cc.
6960 * Makefile.in: Regenerate.
6961 * gold.cc (Gc_runner): New class.
6962 (queue_initial_tasks): Call garbage collection related tasks
6963 when corresponding options are invoked.
6964 (queue_middle_gc_tasks): New function.
6965 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
6966 processed early before laying out sections during garbage collection.
6967 * gold.h (queue_middle_gc_tasks): New function.
6968 (is_prefix_of): Move from "layout.cc".
6969 * i386.cc (Target_i386::gc_process_relocs): New function.
6970 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
6971 * main.cc (main): Create object of class "Garbage_collection".
6972 * object.cc (Relobj::copy_symbols_data): New function.
6973 (Relobj::is_section_name_included): New function.
6974 (Sized_relobj::do_layout): Allow this function to be called twice
6975 during garbage collection and defer layout of section during the
6977 * object.h (Relobj::get_symbols_data): New function.
6978 (Relobj::is_section_name_included): New function.
6979 (Relobj::copy_symbols_data): New function.
6980 (Relobj::set_symbols_data): New function.
6981 (Relobj::get_relocs_data): New function.
6982 (Relobj::set_relocs_data): New function.
6983 (Relobj::is_output_section_offset_invalid): New pure virtual function.
6984 (Relobj::gc_process_relocs): New function.
6985 (Relobj::do_gc_process_relocs): New pure virtual function.
6986 (Relobj::sd_): New data member.
6987 (Sized_relobj::is_output_section_offset_invalid): New function.
6988 (Sized_relobj::do_gc_process_relocs): New function.
6989 * options.h (General_options::gc_sections): Modify to not be a no-op.
6990 (General_options::print_gc_sections): New option.
6991 * plugin.cc (Plugin_finish::run): Remove function call to
6992 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
6993 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
6994 * reloc.cc (Read_relocs::run): Add task to process relocs and
6995 determine unreferenced sections when doing garbage collection.
6996 (Gc_process_relocs): New class.
6997 (Sized_relobj::do_gc_process_relocs): New function.
6998 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
6999 sections that are garbage collected.
7000 * reloc.h (Gc_process_relocs): New class.
7001 * sparc.cc (Target_sparc::gc_process_relocs): New function.
7002 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
7003 symbols whose corresponding sections are garbage collected.
7004 (Symbol_table::Symbol_table): Add new parameter for the garbage
7006 (Symbol_table::gc_mark_undef_symbols): New function.
7007 (Symbol_table::gc_mark_symbol_for_shlib): New function.
7008 (Symbol_table::gc_mark_dyn_syms): New function.
7009 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
7011 (Symbol_table::add_from_object): Likewise.
7012 (Symbol_table::add_from_relobj): When building shared objects, do not
7013 treat externally visible symbols as garbage.
7014 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
7015 table information for static and relocatable links.
7016 * symtab.h (Symbol_table::set_gc): New function.
7017 (Symbol_table::gc): New function.
7018 (Symbol_table::gc_mark_undef_symbols): New function.
7019 (Symbol_table::gc_mark_symbol_for_shlib): New function.
7020 (Symbol_table::gc_mark_dyn_syms): New function.
7021 (Symbol_table::gc_): New data member.
7022 * target.h (Sized_target::gc_process_relocs): New pure virtual
7024 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
7025 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
7027 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
7029 * options.h (General_options::gc_sections): Define as a no-op for now.
7030 (General_options::no_keep_memory): Ditto.
7031 (General_options::Bshareable): Define.
7032 * options.cc (General_options::finalize): Honor -Bshareable.
7034 2009-01-20 Andreas Schwab <schwab@suse.de>
7036 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
7037 read the value in the contents, since we don't use it. Use the
7038 template endianness when writing.
7039 (Relocate::relocate): Use it for R_PPC_REL16_HA.
7041 2009-01-19 Andreas Schwab <schwab@suse.de>
7043 * configure.tgt (powerpc64-*): Fix targ_obj.
7045 2009-01-15 Ian Lance Taylor <iant@google.com>
7047 * object.cc (Sized_relobj::write_local_symbols): Don't write out
7048 local symbols when stripping all symbols.
7050 2009-01-14 Cary Coutant <ccoutant@google.com>
7052 * output.cc (Output_reloc): Add explicit instantiations.
7054 2009-01-14 Cary Coutant <ccoutant@google.com>
7056 * archive.cc (Archive::get_elf_object_for_member): Remove call
7057 to File_read::claim_for_plugin.
7058 * descriptors.cc (Descriptors::open): Remove reference to
7060 (Descriptors::claim_for_plugin): Remove.
7061 * descriptors.h (Descriptors::claim_for_plugin): Remove.
7062 (Descriptors::is_claimed): Remove.
7063 (claim_descriptor_for_plugin): Remove.
7064 * fileread.cc (File_read::claim_for_plugin): Remove.
7065 * fileread.h (File_read::claim_for_plugin): Remove.
7066 (File_read::descriptor): Reopen descriptor if necessary.
7067 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
7068 (Plugin_manager::all_symbols_read): Add task parameter. Change
7070 (Plugin_manager::get_input_file): New function.
7071 (Plugin_manager::release_input_file): New function.
7072 (Pluginobj::Pluginobj): Add filesize parameter and initialize
7073 corresponding data member.
7074 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
7075 and pass to base constructor. Change all callers.
7076 (get_input_file, release_input_file): New functions.
7077 (make_sized_plugin_object): Add filesize parameter. Change all callers.
7078 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
7079 (Plugin_manager::all_symbols_read): Add task parameter.
7080 (Plugin_manager::get_input_file): New function.
7081 (Plugin_manager::release_input_file): New function.
7082 (Plugin_manager::task_): New data member.
7083 (Pluginobj::Pluginobj): Add filesize parameter.
7084 (Pluginobj::filename): New function.
7085 (Pluginobj::descriptor): New function.
7086 (Pluginobj::filesize): New function.
7087 (Pluginobj::filesize_): New data member.
7088 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
7089 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
7090 File_read::claim_for_plugin; use Object::unlock to unlock the file.
7092 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
7093 with archive libraries.
7094 * testsuite/Makefile.in: Regenerate.
7095 * testsuite/plugin_test.c (struct sym_info): New type.
7096 (get_input_file, release_input_file): New static variables.
7097 (onload): Capture new transfer vector entries.
7098 (claim_file_hook): Stop reading at end of file according to filesize.
7099 Factor out parsing of readelf output into separate function.
7100 (all_symbols_read_hook): Exercise get_input_file and release_input_file
7101 APIs and get the source file name from the symbol table. Convert
7102 source file name to corresponding object file name. Print info
7103 message when adding new input files.
7104 (parse_readelf_line): New function.
7105 * testsuite/plugin_test_1.sh: Add checks for new info messages.
7106 * testsuite/plugin_test_2.sh: Likewise.
7107 * testsuite/plugin_test_3.sh: Likewise.
7108 * testsuite/plugin_test_4.sh: New test case.
7110 2009-01-07 Ian Lance Taylor <iant@google.com>
7112 * version.cc (version_string): Bump to 1.8.
7114 2008-12-23 Cary Coutant <ccoutant@google.com>
7116 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
7117 * plugin.cc (Plugin_manager::finish): Rename as
7118 layout_deferred_objects. Move cleanup to separate function.
7119 (Plugin_manager::cleanup): New function.
7120 (Plugin_finish::run): Call layout_deferred_objects and cleanup
7122 * plugin.h (Plugin_manager::finish): Rename as
7123 layout_deferred_objects.
7124 (Plugin_manager::cleanup): New function.
7125 (Plugin_manager::cleanup_done): New field.
7127 2008-12-23 Cary Coutant <ccoutant@google.com>
7129 * plugin.cc (is_visible_from_outside): New function.
7130 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
7131 so we don't return "IR only" status for exported symbols or -r links.
7133 * testsuite/Makefile.am (plugin_test_3): New test case.
7134 * testsuite/Makefile.in: Regenerate.
7135 * testsuite/plugin_test_3.sh: New file.
7137 2008-12-22 Cary Coutant <ccoutant@google.com>
7139 * object.cc (Sized_relobj::layout_section): New function.
7140 (Sized_relobj::do_layout): Defer layout of input sections until after
7141 plugin has provided replacement files.
7142 (Sized_relobj::do_layout_deferred_sections): New function.
7143 * object.h (Relobj::set_section_offset): Remove virtual keyword.
7144 (Relobj::layout_deferred_sections): New function.
7145 (Relobj::do_layout_deferred_sections): New function.
7146 (Sized_relobj::do_layout_deferred_sections): New function.
7147 (Sized_relobj::layout_section): New function.
7148 (Sized_relobj::Deferred_layout): New structure.
7149 (Sized_relobj::deferred_layout_): New field.
7150 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
7151 Change all callers. Layout deferred sections.
7152 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
7154 (Plugin_hook::run): Move code from do_plugin_hook inline.
7155 (Plugin_hook::do_plugin_hook): Remove.
7156 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
7157 (Plugin_manager::finish): Renamed, was cleanup.
7158 (Plugin_manager::should_defer_layout): New function.
7159 (Plugin_manager::add_deferred_layout_object): New function.
7160 (Plugin_manager::Deferred_layout_list): New type.
7161 (Plugin_manager::deferred_layout_objects_): New field.
7162 (Plugin_hook::do_plugin_hook): Remove.
7164 2008-12-17 Ian Lance Taylor <iant@google.com>
7166 * options.h (class General_options): Add --no case for
7169 2008-12-16 Cary Coutant <ccoutant@google.com>
7171 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
7173 (Plugin_manager::claim_file): Create plugin object even if
7174 plugin did not call the add_symbols callback.
7175 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
7176 asking for more symbols than were added.
7177 * testsuite/Makefile.am (plugin_test_1): Add test case with
7179 (empty.syms): New target.
7180 * testsuite/Makefile.in: Regenerate.
7181 * testsuite/plugin_test.c (claim_file_hook): Add new debug
7182 message. Don't call add_symbols if no globals.
7183 (all_symbols_read_hook): Don't provide replacement for empty
7186 2008-12-12 Ian Lance Taylor <iant@google.com>
7188 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
7189 r_type == 0 for a local symbol with r_sym == 0.
7190 (scan_relocatable_relocs): Pass r_sym to
7191 local_non_section_strategy.
7192 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
7195 * configure.ac: Update test for TLS descriptors: they are
7196 supported as of glibc 2.9.
7197 * configure: Rebuild.
7199 2008-12-11 Ian Lance Taylor <iant@google.com>
7202 * target-reloc.h (Default_scan_relocatable_relocs): For each
7203 function, map r_type == 0 to RELOC_DISCARD.
7205 2008-12-10 Cary Coutant <ccoutant@google.com>
7207 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
7208 object to override a kept COMDAT group from a plugin object.
7210 2008-12-09 Ian Lance Taylor <iant@google.com>
7213 * yyscript.y (file_cmd): Handle INPUT.
7215 * testsuite/initpri1.c: Change all declarations to be full
7216 prototypes by adding void, to avoid compiler warnings.
7218 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
7220 * options.cc (General_options::parse_plugin_opt): New.
7221 (General_options::add_plugin): The argument now is just the filename.
7222 (General_options::add_plugin_option): New.
7223 * options.h (plugin_opt): New.
7224 (add_plugin): Change argument name.
7225 (add_plugin_option): New.
7226 * plugin.cc (Plugin::load): Don't parse the plugin option.
7227 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
7228 (Plugin::add_option): New.
7229 (Plugin::args_): Change type.
7230 (Plugin::filename_): New.
7231 (Plugin_manager::add_plugin_option): New.
7232 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
7233 * testsuite/Makefile.in: Regenerate.
7235 2008-12-05 Cary Coutant <ccoutant@google.com>
7237 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
7238 Handle --strip-lto-sections option.
7239 * options.h (strip_lto_sections): New option.
7241 2008-12-01 Cary Coutant <ccoutant@google.com>
7243 * plugin.cc (ld_plugin_message): Change format parameter to const.
7244 Fix mismatch between new[] and delete.
7246 2008-11-14 Cary Coutant <ccoutant@google.com>
7248 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
7251 2008-11-05 Craig Silverstein <csilvers@google.com>
7253 * options.cc (General_options::parse_dynamic_list): New function.
7254 * options.h (General_options): New flags dynamic_list,
7255 dynamic_list_data, dynamic_list_cpp_new, and
7256 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
7257 (General_options::in_dynamic_list): New function.
7258 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
7259 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
7260 (Lex::can_continue_name): Likewise.
7262 (read_script_file): New parameter script_options.
7263 (read_dynamic_list): New function.
7264 (Script_options::define_dynamic_list): New function.
7265 (dynamic_list_keyword_parsecodes): New variable.
7266 (dynamic_list_keywords): New variable.
7267 * script.h (Script_options::define_dynamic_list): New function
7269 (read_dynamic_list): New function prototype.
7270 * symtab.cc (strprefix): New macro.
7271 (Symbol::should_add_dynsym_entry): Support dynamic_list,
7272 dynamic_list_data, dynamic_list_cpp_new, and
7273 dynamic_list_cpp_typeinfo.
7274 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
7275 (dynamic_list_expr): New rule.
7276 (dynamic_list_nodes): Likewise.
7277 (dynamic_list_node): Likewise.
7278 * testsuite/Makefile.am (dynamic_list): New test.
7279 * testsuite/Makefile.in: Regenerated.
7280 * testsuite/dynamic_list.t: New file.
7281 * testsuite/dynamic_list.sh: New file.
7283 2008-11-05 Craig Silverstein <csilvers@google.com>
7285 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
7286 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
7287 (t11_last): Likewise.
7288 * testsuite/ver_test_6.c (main): Likewise.
7290 2008-10-07 Cary Coutant <ccoutant@google.com>
7292 * options.c (General_options::finalize): Add check for -static and
7294 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
7297 2008-10-02 Cary Coutant <ccoutant@google.com>
7299 * plugin.cc (make_sized_plugin_object): Fix conditional
7300 compilation to work when not all targets are enabled.
7302 2008-09-29 Cary Coutant <ccoutant@google.com>
7304 * archive.cc (Archive::get_file_and_offset): Use filename instead
7305 of name to get library path.
7306 (Archive::include_member): Unlock external member of a thin archive.
7308 * testsuite/Makefile.am (TEST_AR): New variable.
7309 (thin_archive_test_1): New test.
7310 (thin_archive_test_2): New test.
7311 * testsuite/Makefile.in: Regenerate.
7312 * testsuite/thin_archive_main.cc: New file.
7313 * testsuite/thin_archive_test_1.cc: New file.
7314 * testsuite/thin_archive_test_2.cc: New file.
7315 * testsuite/thin_archive_test_3.cc: New file.
7316 * testsuite/thin_archive_test_4.cc: New file.
7318 2008-09-29 Cary Coutant <ccoutant@google.com>
7320 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
7321 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
7323 (Sized_relobj::do_finalize_local_symbols): Likewise.
7324 (Sized_relobj::map_to_kept_section): Likewise.
7325 * object.h (Sized_relobj::invalid_address): New constant.
7326 (Sized_relobj::do_output_section_offset): Check for invalid_address
7328 * output.cc (Output_reloc::local_section_offset): Use constant
7329 invalid_address instead of -1U.
7330 (Output_reloc::get_address): Likewise.
7331 (Output_section::output_address): Change -1U to -1ULL.
7332 * output.h (Output_reloc::invalid_address): New constant.
7333 * reloc.cc (Sized_relobj::write_sections): Use constant
7334 invalid_address instead of -1U.
7335 (Sized_relobj::relocate_sections): Likewise.
7336 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
7337 values for merge sections.
7338 * target-reloc.h (relocate_for_relocatable): Use constant
7339 invalid_address instead of -1U.
7341 2008-09-19 Cary Coutant <ccoutant@google.com>
7343 Add plugin functionality for link-time optimization (LTO).
7344 * configure.ac (plugins): Add --enable-plugins option.
7345 * configure: Regenerate.
7346 * config.in: Regenerate.
7347 * Makefile.am (LIBDL): New variable.
7348 (CCFILES): Add plugin.cc.
7349 (HFILES): Add plugin.h.
7350 (ldadd_var): Add LIBDL.
7351 * Makefile.in: Regenerate.
7353 * archive.cc: Include "plugin.h".
7354 (Archive::setup): Don't preread archive symbols when using a plugin.
7355 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
7356 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
7358 (Archive::include_member): Add symbols from plugin objects.
7359 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
7360 * descriptors.cc (Descriptors::open): Check for file descriptors
7361 abandoned by plugins.
7362 (Descriptors::claim_for_plugin): New function.
7363 * descriptors.h (Descriptors::claim_for_plugin): New function.
7364 (Open_descriptor::is_claimed): New field.
7365 (claim_descriptor_for_plugin): New function.
7366 * fileread.cc (File_read::claim_for_plugin): New function.
7367 * fileread.h (File_read::claim_for_plugin): New function.
7368 (File_read::descriptor): New function.
7369 * gold.cc: Include "plugin.h".
7370 (queue_initial_tasks): Add task to call plugin hooks for generating
7372 * main.cc: Include "plugin.h".
7373 (main): Load plugin libraries.
7374 * object.h (Pluginobj): Declare.
7375 (Object::pluginobj): New function.
7376 (Object::do_pluginobj): New function.
7377 (Object::set_target): New function.
7378 * options.cc: Include "plugin.h".
7379 (General_options::parse_plugin): New function.
7380 (General_options::General_options): Initialize plugins_ field.
7381 (General_options::add_plugin): New function.
7382 * options.h (Plugin_manager): Declare.
7383 (General_options): Add --plugin option.
7384 (General_options::has_plugins): New function.
7385 (General_options::plugins): New function.
7386 (General_options::add_plugin): New function.
7387 (General_options::plugins_): New field.
7388 * plugin.cc: New file.
7389 * plugin.h: New file.
7390 * readsyms.cc: Include "plugin.h".
7391 (Read_symbols::do_read_symbols): Check for archive before checking
7392 for ELF file. Call plugin hooks to claim files.
7393 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
7394 from a real object file; force override when processing replacement
7396 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
7397 (Symbol::init_base_object): Likewise.
7398 (Symbol::init_base_output_data): Likewise.
7399 (Symbol::init_base_output_segment): Likewise.
7400 (Symbol::init_base_constant): Likewise.
7401 (Symbol::init_base_undefined): Likewise.
7402 (Symbol::output_section): Assert that object is not a plugin.
7403 (Symbol_table::add_from_pluginobj): New function.
7404 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
7406 (Symbol_table::sized_write_globals): Likewise.
7407 (Symbol_table::add_from_pluginobj): Instantiate template.
7408 * symtab.h (Sized_pluginobj): Declare.
7409 (Symbol::in_real_elf): New function.
7410 (Symbol::set_in_real_elf): New function.
7411 (Symbol::in_real_elf_): New field.
7412 (Symbol_table::add_from_pluginobj): New function.
7414 * testsuite/Makefile.am (AM_CFLAGS): New variable.
7415 (LIBDL): New variable.
7417 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
7418 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
7419 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
7420 (MOSTLYCLEANFILES): Likewise.
7421 * testsuite/Makefile.in: Regenerate.
7422 * testsuite/plugin_test.c: New file.
7423 * testsuite/plugin_test_1.sh: New file.
7424 * testsuite/plugin_test_2.sh: New file.
7426 2008-09-16 Ian Lance Taylor <iant@google.com>
7428 * target-reloc.h (relocate_section): Check whether a symbol is
7429 defined by the ABI before reporting an undefined symbol error.
7430 * target.h (Target::is_defined_by_abi): Make parameter const.
7431 (Target::do_is_defined_by_abi): Likewise.
7432 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
7433 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
7434 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
7435 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
7436 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
7437 * testsuite/Makefile.in: Rebuild.
7439 * fileread.cc (make_view): Add casts to avoid warning.
7441 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
7443 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
7444 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
7446 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
7448 * options.h (General_options::output_is_executable): New.
7449 (General_options::output_is_pie): New.
7450 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
7451 for shared libraries.
7452 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
7454 2008-09-11 Chris Demetriou <cgd@google.com>
7456 * options.h (origin): New -z option.
7457 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
7458 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
7461 2008-09-05 Cary Coutant <ccoutant@google.com>
7463 * fileread.cc (File_read::make_view): Add check for attempt to map
7466 2008-09-05 Cary Coutant <ccoutant@google.com>
7468 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
7469 explicit instantiations.
7471 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
7474 * options.cc (General_options::finalize): Allow undefined symbols
7475 in shlibs if linking -shared.
7478 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
7479 symbols as not needing a dynsym entry.
7481 2008-08-20 Craig Silverstein <csilvers@google.com>
7483 * fileread.cc (File_read::open): Do not lock the file unless it
7484 was successfully opened.
7486 2008-08-14 Cary Coutant <ccoutant@google.com>
7488 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
7489 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
7490 * testsuite/tls_test.cc (struct int128): 128-bit struct
7491 for testing TLS relocs with non-zero addend.
7492 (v12): New TLS variable.
7494 (t_last): Add check for v12.
7495 * testsuite/tls_test.h (t12): New function.
7496 * testsuite/tls_test_main.cc (thread_routine): Call new test.
7498 2008-08-13 Ian Lance Taylor <iant@google.com>
7500 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
7501 set tls_segment_ or relro_segment_.
7502 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
7504 * output.h (Output_section::clear_is_relro): New function.
7505 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
7506 sections specially even when output_data_ is empty.
7507 (Output_segment::maximum_alignment): When first section is relro,
7508 only force alignment for PT_LOAD segments.
7509 * script.cc (script_data_segment_align): New function.
7510 (script_data_segment_relro_end): New function.
7511 * script-c.h (script_data_segment_align): Declare.
7512 (script_data_segment_relro_end): Declare.
7513 * script-sections.h (class Script_sections): Declare
7514 data_segment_align and data_segment_relro_end. Add fields
7515 segment_align_index_ and saw_relro_end_.
7516 * script-sections.cc (class Sections_element): Add set_is_relro
7517 virtual function. Add new bool* parameter to place_orphan_here.
7518 Add get_output_section virtual function.
7519 (class Output_section_definition): Add set_is_relro. Add new
7520 bool* parameter to place_orphan_here. Add get_output_section.
7521 Add is_relro_ field.
7522 (Output_section_definition::Output_section_definition): Initialize
7523 evaluated_address_, evaluated_load_address, evaluated_addralign_,
7524 and is_relro_ fields.
7525 (Output_section_definition::place_orphan_here): Add is_relro
7527 (Output_section_definition::set_section_addresses): Set relro for
7529 (Output_section_definition::alternate_constraint): Likewise.
7530 (class Orphan_output_section): Add new bool* parameter to
7531 place_orphan_here. Add get_output_section.
7532 (Orphan_output_section::place_orphan_here): Add is_relro
7534 (Script_sections::Script_sections): Initialize
7535 data_segment_align_index_ and saw_relro_end_.
7536 (Script_sections::data_segment_align): New function.
7537 (Script_sections::data_segment_relro_end): New function.
7538 (Script_sections::place_orphan): Set or clear is_relro.
7539 (Script_sections::set_section_addresses): Force alignment of first
7541 * yyscript.y (exp): Call script_data_segment_align and
7542 script_data_segment_relro_end.
7543 * testsuite/relro_script_test.t: New file.
7544 * testsuite/relro_test.cc (using_script): Declare.
7545 (t1, t2): Test using_script.
7546 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
7547 (relro_script_test_SOURCES): Define.
7548 (relro_script_test_DEPENDENCIES): Define.
7549 (relro_script_test_LDFLAGS): Define.
7550 (relro_script_test_LDADD): Define.
7551 (relro_script_test.so): New target.
7552 * testsuite/Makefile.in: Rebuild.
7554 2008-08-06 Cary Coutant <ccoutant@google.com>
7556 * archive.cc (Archive::total_archives, Archive::total_members)
7557 (Archive::total_members_loaded): New variables.
7558 (Archive::setup): Add parameter. Add option to preread
7560 (Archive::read_armap): Add counter.
7561 (Archive::get_file_and_offset): New function.
7562 (Archive::get_elf_object_for_member): New function.
7563 (Archive::read_all_symbols): New function.
7564 (Archive::read_symbols): New function.
7565 (Archive::add_symbols): Add counters.
7566 (Archive::include_all_members): Use armap to find members if it's
7568 (Archive::include_member): Skip reading symbols if already read.
7569 Factored code into Archive::get_file_and_offset and
7570 Archive::get_elf_object_for_member. Changed call to
7571 Mapfile::report_include_archive_member.
7572 (Archive::print_stats): New function.
7573 * archive.h: Declare Object and Read_symbols_data classes.
7574 (Archive::Archive): Add initializers for new members.
7575 (Archive::setup): Add parameter.
7576 (Archive::print_stats): New function.
7577 (Archive::total_archives, Archive::total_members)
7578 (Archive::total_members_loaded): New variables.
7579 (Archive::get_file_and_offset): New function.
7580 (Archive::get_elf_object_for_member): New function.
7581 (Archive::read_all_symbols): New function.
7582 (Archive::read_symbols): New function.
7583 (Archive::Archive_member): New class.
7584 (Archive::members_): New member.
7585 (Archive::num_members_): New member.
7586 * main.cc: Include archive.h.
7587 (main): Call Archive::print_stats.
7588 * mapfile.cc (Mapfile::report_include_archive_member): Delete
7589 archive parameter; member_name is now the fully-decorated name.
7590 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
7591 * options.h: (General_options): Add --preread-archive-symbols option.
7592 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
7595 2008-08-04 Ian Lance Taylor <iant@google.com>
7597 * symtab.h (Symbol::use_plt_offset): New function.
7598 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
7599 * powerpc.cc (Relocate::relocate): Likewise.
7600 * sparc.cc (Relocate::relocate): Likewise.
7601 * x86_64.cc (Relocate::relocate): Likewise.
7602 * testsuite/weak_plt.sh: New test.
7603 * testsuite/weak_plt_main.cc: New test.
7604 * testsuite/weak_plt_shared.cc: New test.
7605 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
7606 (check_PROGRAMS): Add weak_plt.
7607 (check_DATA): Add weak_plt_shared.so.
7608 (weak_plt_main_pic.o, weak_plt): New targets.
7609 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
7610 * testsuite/Makefile.in: Rebuild.
7612 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
7614 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
7615 * testsuite/Makefile.in: Rebuild.
7617 2008-08-04 Alan Modra <amodra@bigpond.net.au>
7619 * Makefile.am (POTFILES.in): Set LC_ALL=C.
7620 * Makefile.in: Regenerate.
7621 * po/POTFILES.in: Regenerate.
7623 2008-07-29 Ian Lance Taylor <iant@google.com>
7625 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
7626 symbols before other symbols.
7627 * testsuite/script_test_2.cc (test_addr): Declare.
7628 (test_addr_alias): Declare.
7629 (main): Check that test_addr and test_addr_alias have the right
7631 * testsuite/script_test_2.t: Define test_addr_alias and
7634 2008-07-24 Ian Lance Taylor <iant@google.com>
7637 * descriptors.cc: New file.
7638 * descriptors.h: New file.
7639 * gold-threads.h (class Hold_optional_lock): New class.
7640 * fileread.cc: Include "descriptors.h".
7641 (File_read::~File_read): Release descriptor rather than closing
7643 (File_read::open) [file]: Call open_descriptor rather than open.
7644 Set is_descriptor_opened_.
7645 (File_read::open) [memory]: Assert that descriptor is not open.
7646 (File_read::reopen_descriptor): New function.
7647 (File_read::release): Release descriptor.
7648 (File_read::do_read): Make non-const. Reopen descriptor.
7649 (File_read::read): Make non-const.
7650 (File_read::make_view): Reopen descriptor.
7651 (File_read::do_readv): Likewise.
7652 * fileread.h (class File_read): Add is_descriptor_opened_ field.
7653 Update declarations.
7654 * layout.cc: Include "descriptors.h".
7655 (Layout::create_build_id): Use open_descriptor rather than open.
7656 * output.cc: Include "descriptors.h".
7657 (Output_file::open): Use open_descriptor rather than open.
7658 * archive.cc (Archive::const_iterator): Change Archive to be
7660 (Archive::begin, Archive::end): Make non-const.
7661 (Archive::count_members): Likewise.
7662 * archive.h (class Archive): Update declarations.
7663 * object.h (Object::read): Make non-const.
7664 * Makefile.am (CCFILES): Add descriptors.cc.
7665 (HFILES): Add descriptors.h.
7666 * Makefile.in: Rebuild.
7669 * gold.h: Always include <clocale>. Add Solaris workarounds
7670 following code in binutils/sysdep.h.
7673 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
7674 this->eh_frame_hdr_ is NULL before using it.
7676 * dynobj.cc (Versions::Versions): Update comment.
7678 * dynobj.cc (Versions::Versions): If there is an soname, use it as
7679 the base version name.
7681 * stringpool.cc (Stringpool_template::add_with_length): Set key to
7682 array size plus one.
7683 (Stringpool_template::set_string_offsets): Subtract one from key
7684 before using it as an array index.
7685 (Stringpool_template::get_offset_with_length): Likewise.
7686 (Stringpool_template::write_to_buffer): Likewise.
7687 * stringpool.h (Stringpool_template::get_offset_from_key):
7690 2008-07-23 Ian Lance Taylor <iant@google.com>
7693 * object.h (Merged_symbol_value::value): Do our best to handle a
7697 * script.cc (Version_script_info::get_versions): Don't add empty
7698 version tag to return value.
7699 (Version_script_info::get_symbol_version_helper): Change return
7700 type to bool. Add pversion parameter. Change all callers.
7701 (script_register_vers_node): Don't require a non-NULL tag.
7702 * script.h (class Version_script_info): Update declarations.
7703 (Version_script_info::get_symbol_version): Change return type to
7704 bool. Add version parameter. Change all callers.
7705 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
7706 handling. Handle an empty version from a version script.
7707 (Symbol_table::define_special_symbol): Likewise.
7708 * testsuite/ver_test_10.script: New file.
7709 * testsuite/ver_test_10.sh: New file.
7710 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
7711 (check_DATA): Add ver_test_10.syms.
7712 (ver_test_10.syms, ver_test_10.so): New target.
7713 * testsuite/Makefile.in: Rebuild.
7715 2008-07-23 Simon Baldwin <simonb@google.com>
7717 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
7718 to zero for undefined symbols from dynamic libraries.
7720 2008-07-23 Ian Lance Taylor <iant@google.com>
7722 * symtab.cc (Symbol_table::resolve): Remove version parameter.
7724 * symtab.h (class Symbol_table): Update declaration.
7725 * testsuite/ver_test_9.cc: New file.
7726 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
7727 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
7728 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
7729 (ver_test_9.so, ver_test_9.o): New targets.
7730 * testsuite/Makefile.in: Rebuild.
7732 2008-07-22 Ian Lance Taylor <iant@google.com>
7734 * options.h (class General_options): Define --check-sections.
7735 * layout.cc (Layout::set_segment_offsets): Handle
7738 * options.h (class General_options): Define -n/--nmagic and
7740 * options.cc (General_options::finalize): For -n/--nmagic or
7741 -N/--omagic, set -static.
7742 * layout.cc (Layout::attach_allocated_section_to_segment): If
7743 -N/--omagic, don't put read-only and read-write sections in
7745 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
7746 finding a read-only segment.
7747 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
7748 don't set the minimum segment alignment to the common page size,
7749 and don't set the file offset to the address modulo the page size.
7750 * script-sections.cc (Script_sections::create_segments): If
7751 -n/--omagic, don't put read-only and read-write sections in
7754 * cref.cc: New file.
7756 * options.h (class General_options): Add --print-symbol-counts.
7757 * main.cc (main): Issue defined symbol report if requested.
7758 * archive.cc (Archive::interpret_header): Make into a const member
7760 (Archive::add_symbols): Call Input_objects::archive_start and
7762 (Archive::const_iterator): Define new class.
7763 (Archive::begin, Archive::end): New functions.
7764 (Archive::include_all_members): Rewrite to use iterator.
7765 (Archive::count_members): New function.
7766 * archive.h (class Archive): Update declarations.
7767 (Archive::filename): New function.
7768 * object.cc: Include "cref.h".
7769 (Sized_relobj::Sized_relobj): Initialize defined_count_.
7770 (Sized_relobj::do_get_global_symbol_counts): New function.
7771 (Input_objects::add_object): Add object to cross-referencer.
7772 (Input_objects::archive_start): New function.
7773 (Input_objects::archive_stop): New function.
7774 (Input_objects::print_symbol_counts): New function.
7775 * object.h: Declare Cref and Archive.
7776 (Object::get_global_symbol_counts): New function.
7777 (Object::do_get_global_symbol_counts): New pure virtual function.
7778 (class Sized_relobj): Add defined_count_ field. Update
7780 (class Input_objects): Add cref_ field. Update constructor.
7781 Update declarations.
7782 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
7784 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
7786 (Sized_dynobj::do_get_global_symbol_counts): New function.
7787 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
7788 defined_count_. Update declarations. Define Symbols typedef.
7789 * symtab.cc (Symbol_table::add_from_relobj): Add defined
7790 parameter. Change all callers.
7791 (Symbol_table::add_from_dynobj): Add sympointers and defined
7792 parameters. Change all callers.
7793 * symtab.h (class Symbol_table): Update declarations.
7794 * Makefile.am (CCFILES): Add cref.cc.
7795 (HFILES): Add cref.h.
7796 * Makefile.in: Rebuild.
7798 2008-07-22 Simon Baldwin <simonb@google.com>
7800 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
7801 to zero when writing undefined symbols.
7803 2008-07-22 Ian Lance Taylor <iant@google.com>
7805 * output.cc (Output_section::add_input_section): Don't try to
7806 merge empty merge sections.
7808 2008-07-21 Craig Silverstein <csilvers@google.com>
7810 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
7811 Include symbol version in error message.
7813 2008-07-20 Chris Demetriou <cgd@google.com>
7815 * configure.ac (gold_cv_c_random_seed): New configured variable.
7816 (RANDOM_SEED_CFLAGS): New substituted variable.
7817 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
7818 * configure: Rebuild.
7819 * Makefile.in: Likewise.
7820 * testsuite/Makefile.in: Likewise.
7822 2008-07-18 Ian Lance Taylor <iant@google.com>
7824 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
7825 where we see NAME/NULL and NAME/VERSION as separate symbols.
7826 * testsuite/ver_test_main.cc (main): Call t4.
7827 (t4, t4_2a): Define.
7828 * testsuite/ver_test_2.cc (t4_2): Define.
7829 * testsuite/ver_test_2.script: Put t4_2a in VER2.
7830 * testsuite/ver_test_4.cc (t4_2a): Define.
7831 * testsuite/ver_test_4.script: Put t4_2a in VER2.
7832 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
7834 2008-07-17 Ian Lance Taylor <iant@google.com>
7836 * dynobj.cc (Versions::add_def): If we give an error about a
7837 missing version, go ahead and create the version anyhow.
7839 2008-07-10 Ian Lance Taylor <iant@google.com>
7841 Handle output sections with more than 0x7fffffff bytes.
7842 * object.h (class Relobj): Change map_to_output_ to
7843 output_sections_, and just keep a section pointer. Change all
7844 uses. Move comdat group support to Sized_relobj.
7845 (Relobj::is_section_specially_mapped): Remove.
7846 (Relobj::output_section): Remove poff parameter. Change all
7848 (Relobj::output_section_offset): New function.
7849 (Relobj::set_section_offset): Rewrite.
7850 (Relobj::map_to_output): Remove.
7851 (Relobj::output_sections): New function.
7852 (Relobj::do_output_section_offset): New pure virtual function.
7853 (Relobj::do_set_section_offset): Likewise.
7854 (class Sized_relobj): Add section_offsets_ field. Add comdat
7855 group support from Relobj. Update declarations.
7856 (Sized_relobj::get_output_section_offset): New function.
7857 (Sized_relobj::do_output_section_offset): New function.
7858 (Sized_relobj::do_set_section_offset): New function.
7859 * object.cc (Relobj::output_section_address): Remove.
7860 (Sized_relobj::Sized_relobj): Initialize new fields.
7861 (Sized_relobj::include_section_group): Cast find_kept_object to
7863 (Sized_relobj::include_linkonce_section): Likewise.
7864 (Sized_relobj::do_layout): Use separate arrays for output section
7866 (Sized_relobj::do_count_local_symbols): Change map_to_output to
7868 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
7869 output_sections and section_offsets.
7870 (Sized_relobj::write_local_symbols): Likewise.
7871 (map_to_kept_section): Compute output address directly.
7872 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
7873 output_sections and section_offsets.
7874 (Sized_relobj::write_sections): Likewise.
7875 (Sized_relobj::relocate_sections): Likewise.
7876 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
7877 * output.h (class Output_reloc): Update declarations. Change
7878 u2_.relobj to Sized_relobj*.
7879 (class Output_data_reloc): Change add functions to use
7881 * output.cc (Output_reloc::Output_reloc): Change relobj to
7883 (Output_reloc::local_section_offset): Change return type to
7884 Elf_Addr. Use get_output_section_offset.
7885 (Output_reloc::get_address): Likewise.
7886 (Output_section::is_input_address_mapped): Don't call
7887 is_section_specially_mapped.
7888 (Output_section::output_offset): Likewise.
7889 (Output_section::output_address): Likewise.
7890 (Output_section::starting_output_address): Likewise.
7891 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
7892 parameter to Sized_relobj*.
7893 (Copy_relocs::need_copy_reloc): Likewise.
7894 (Copy_relocs::save): Likewise.
7895 * copy-relocs.h (class Copy_relocs): Update declarations.
7896 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
7897 Sized_relobj*. Change relobj_ field to Sized_relobj*.
7898 * target-reloc.h (relocate_for_relocatable): Change
7899 offset_in_output_section type to Elf_Addr. Change code that uses
7901 * layout.cc (Layout::layout): Always set *off.
7902 * mapfile.cc (Mapfile::print_input_section): Use
7903 output_section_offset.
7904 * i386.cc (Target_i386::copy_reloc): Change object parameter to
7906 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
7907 * sparc.cc (Target_sparc::copy_reloc): Likewise.
7908 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
7910 2008-07-03 Ian Lance Taylor <iant@google.com>
7912 * layout.cc (Layout::include_section): Do not discard unrecognized
7913 SHT_STRTAB sections.
7915 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
7917 * script.cc (Lex::can_continue_name): Make '?' allowable in
7918 version-script names.
7919 * testsuite/version_script.map: Change glob pattern to use '?'
7921 2008-06-30 Manish Singh <yosh@gimp.org>
7924 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
7927 2008-06-30 Ian Lance Taylor <iant@google.com>
7931 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
7932 versions]: Don't try to read the value in the contents, since we
7933 don't use it. Use the template endianness when writing.
7935 2008-06-25 Cary Coutant <ccoutant@google.com>
7937 * fileread.cc (File_read::make_view): Assert on zero-length view.
7938 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
7939 symbol table when there are no symbols to read.
7941 2008-06-23 Craig Silverstein <csilvers@google.com>
7943 * version.cc (version_string): Bump to 1.7
7945 2008-06-18 Craig Silverstein <csilvers@google.com>
7947 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
7948 constant 0xFFFF to type Valtype.
7949 (Powerpc_relocate_functions::rel16_ha): Likewise.
7951 2008-06-17 Ian Lance Taylor <iant@google.com>
7953 * output.h (Output_section::Input_section): Initialize p2align_ to
7954 zero for Output_section_data constructors.
7955 (Output_section::Input_section::addralign): If not an input
7956 section, return the alignment of the Output_section_data.
7957 * testsuite/copy_test.cc: New file.
7958 * testsuite/copy_test_1.cc: New file.
7959 * testsuite/copy_test_2.cc: New file.
7960 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
7961 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
7962 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
7963 (copy_test_1_pic.o, copy_test_1.so): New targets.
7964 (copy_test_2_pic.o, copy_test_2.so): New targets.
7965 * testsuite/Makefile.in: Rebuild.
7967 * script-sections.cc (Script_sections::place_orphan): Initialize
7968 local variable exact.
7970 2008-06-13 David Edelsohn <edelsohn@gnu.org>
7972 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
7974 2008-06-12 David Edelsohn <edelsohn@gnu.org>
7975 David S. Miller <davem@davemloft.net>
7977 * powerpc.cc: New file.
7978 * Makefile.am (TARGETSOURCES): Add powerpc.cc
7979 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
7980 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
7981 * Makefile.in: Rebuild.
7983 2008-06-09 Ian Lance Taylor <iant@google.com>
7985 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
7987 (throwing, orig_terminate): New static variables.
7988 (terminate_handler): New static function.
7989 (t2): Set terminate handler.
7991 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
7994 * binary.cc (Binary_to_elf::sized_convert): Fix .data
7997 2008-05-30 Cary Coutant <ccoutant@google.com>
7999 * archive.cc (Archive::include_all_members) Correct to step
8000 over symbol table and extended name table in thin archives.
8002 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
8005 * target-reloc.h (relocate_for_relocatable): Fix new_offset
8008 2008-05-28 Caleb Howe <cshowe@google.com>
8010 * reduced_debug_output.cc: New file.
8011 * reduced_debug_output.h: New file.
8012 * options.h (class General_options): Add --strip-debug-non-line.
8013 * options.cc (General_options::finalize): Add strip_debug_non_line
8014 to the strip heirarchy.
8015 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
8017 * layout.cc: Include "reduced_debug_output.h".
8018 (Layout::Layout): Initialize new fields.
8019 (line_only_debug_sections): New static array.
8020 (is_lines_only_debug_sections): New static inline function.
8021 (Layout::include_section): Handle --strip-debug-non-line.
8022 (Layout::make_output_section): If --strip-debug-non-line, build
8023 new output sections for .debug_abbrev and .debug_info.
8024 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
8025 gold. Warn about possible overflow.
8026 (read_signed_LEB_128): Likewise.
8027 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
8028 (read_signed_LEB_128): Declare.
8029 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
8030 (HFILES): Add reduced_debug_output.h.
8031 * Makefile.in: Rebuild.
8033 2008-05-21 Ian Lance Taylor <iant@google.com>
8035 * mapfile.cc: New file.
8036 * mapfile.h: New file.
8037 * options.h (class General_options): Add -M/--print-map and -Map.
8038 * options.cc (General_options::finalize): Make -M equivalent to
8040 * main.cc: Include <cstdio> and "mapfile.h".
8041 (main): Open mapfile if requested.
8042 * gold.cc (class Middle_runner): Add mapfile_ field. Update
8043 constructor. Change caller.
8044 (queue_initial_tasks): Add mapfile parameter. Change caller.
8045 (queue_middle_tasks): Likewise.
8046 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
8048 * archive.cc: Include "mapfile.h".
8049 (Archive::add_symbols): Add mapfile parameter. Change all
8050 callers. Pass mapfile, symbol, and reason to include_member.
8051 (Archive::include_all_members): Add mapfile parameter. Change all
8053 (Archive::include_member): Add mapfile, sym, and why parameters.
8054 Change all callers. Report inclusion to map file.
8055 * archive.h: Include "fileread.h".
8056 (class Archive): Update declarations.
8057 (Archive::file): New const method.
8058 (class Add_archive_symbols): Add mapfile_ field. Update
8059 constructor. Change all callers.
8060 * readsyms.h (class Read_symbols): Likewise.
8061 (class Finish_group): Likewise.
8062 (class Read_script): Likewise.
8063 * common.cc: Include "mapfile.h".
8064 (Symbol_table::allocate_commons): Add mapfile parameter. Change
8066 (Symbol_table::do_allocate_commons): Likewise.
8067 (Symbol_table::do_allocate_commons_list): Likewise. Report common
8068 symbol allocation to mapfile.
8069 * common.h (class Allocate_commons_task): Add mapfile_ field.
8070 Update constructor. Change all callers.
8071 * symtab.h (class Symbol_table): Update declarations.
8072 * layout.cc: Include "mapfile.h".
8073 (Layout_task_runner::run): Print information to mapfile.
8074 (Layout::create_gold_note): Change Output_data_fixed_space to
8075 Output_data_zero_fill.
8076 (Layout::create_build_id): Likewise.
8077 (Layout::print_to_mapfile): New function.
8078 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
8079 constructor. Change caller.
8080 (class Layout): Declare print_to_mapfile.
8081 * output.cc (Output_section::Input_section::print_to_mapfile): New
8083 (Output_section::add_input_section): If producing a map, always
8084 add to input_sections_ list.
8085 (Output_section::do_print_to_mapfile): New function.
8086 (Output_segment::print_sections_to_mapfile): New function.
8087 (Output_segment::print_section_list_to_mapfile): New function.
8088 * output.h: Include "mapfile.h".
8089 (Output_data::print_to_mapfile): New function.
8090 (Output_data::do_print_to_mapfile): New virtual function.
8091 (Output_segment_headers::do_print_to_mapfile): New function.
8092 (Output_file_header::do_print_to_mapfile): New function.
8093 (Output_data_const::do_print_to_mapfile): New function.
8094 (class Output_data_const_buffer): Add map_name_ field. Update
8095 constructor. Change all callers. Add do_print_to_mapfile
8097 (class Output_data_fixed_space): Likewise.
8098 (class Output_data_space): Likewise.
8099 (class Output_data_zero_fill): New class.
8100 (Output_data_strtab::do_print_to_mapfile): New function.
8101 (Output_data_reloc_base::do_print_to_mapfile): New function.
8102 (Output_relocatable_relocs::do_print_to_mapfile): New function.
8103 (Output_data_group::do_print_to_mapfile): New function.
8104 (Output_data_got::do_print_to_mapfile): New function.
8105 (Output_data_dynamic::do_print_to_mapfile): New function.
8106 (Output_symtab_xindex::do_print_to_mapfile): New function.
8107 (class Output_section): Declare do_print_to_mapflie. Declare
8108 print_to_mapfile in Input_section.
8109 (class Output_segment): Declare new functions.
8110 * object.h (Sized_relobj::symbol_count): New function.
8111 * script-sections.cc
8112 (Output_section_element_dot_assignment::set_section_addresses):
8113 Change Output_data_fixed_space to Output_data_zero_fill.
8114 (Output_data_expression::do_print_to_mapfile): New function.
8115 * script.cc (read_input_script): Add mapfile parameter. Change
8117 * script.h (read_input_script): Update declaration.
8118 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
8119 (Eh_frame::do_print_to_mapfile): New function.
8120 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
8121 (Output_merge_string::do_print_to_mapfile): New function.
8122 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
8124 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
8126 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
8128 * Makefile.am (CCFILES): Add mapfile.cc.
8129 (HFILES): Add mapfile.h.
8130 * Makefile.in: Rebuild.
8132 2008-05-19 Ian Lance Taylor <iant@google.com>
8134 * options.h (class General_options): Add -z relro.
8135 * layout.cc (Layout::Layout): Initialize relro_segment_.
8136 (Layout::add_output_section_data): Return the output section.
8137 (Layout::make_output_section): Rcognize relro sections and mark
8139 (Layout::attach_allocated_section_to_segment): Put relro sections
8140 in a PT_GNU_RELRO segment.
8141 (Layout::create_initial_dynamic_sections): Mark the .dynamic
8143 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
8145 (Layout::linkonce_mapping): Map d.rel.ro.local to
8147 (Layout::output_section_name): Us .data.rel.ro.local for any
8148 section which begins with that.
8149 * layout.h (class Layout): Update add_output_section_data
8150 declaration. Add relro_segment_ field.
8151 * output.cc (Output_section::Output_section): Initialize is_relro_
8152 and is_relro_local_ fields.
8153 (Output_segment::add_output_section): Group relro sections.
8154 (Output_segment::is_first_section_relro): New function.
8155 (Output_segment::maximum_alignment): If there is a relro section,
8156 align the segment to the common page size.
8157 (Output_segment::set_section_addresses): Track whether we are
8158 looking at relro sections. If the last section is a relro
8159 section, align to the common page size.
8160 (Output_segment::set_section_list_addresses): Add in_relro
8161 parameter. Change all callers. Align to the page size when
8162 moving from relro to non-relro section.
8163 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
8165 * output.h (class Output_section): Add is_relro_ and
8166 is_relro_local_ fields.
8167 (Output_section::is_relro): New function.
8168 (Output_section::set_is_relro): New function.
8169 (Output_section::is_relro_local): New function.
8170 (Output_section::set_is_relro_local): New function.
8171 (class Output_segment): Update declarations.
8172 * i386.cc (Target_i386::got_section): Mark .got section as relro.
8173 * sparc.cc (Target_sparc::got_section): Likewise.
8174 * x86_64.cc (Target_x86_64::got_section): Likewise.
8175 * testsuite/relro_test_main.cc: New file.
8176 * testsuite/relro_test.cc: New file.
8177 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
8178 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
8179 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
8180 (relro_test.so, relro_test_pic.o): New targets.
8181 * testsuite/Makefile.in: Rebuild.
8183 2008-05-16 Ian Lance Taylor <iant@google.com>
8185 * output.cc (Output_segment::add_output_section): Remove front
8187 * output.h (class Output_segment): Remove
8188 add_initial_output_section and overloaded add_output_section.
8189 Update declaration of remaining add_output_section.
8190 * layout.cc (Layout::create_interp): Call add_output_section
8191 rather than add_initial_output_section.
8192 (Layout::finish_dynamic_section): Likewise.
8194 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
8195 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
8196 know the dynamic type.
8197 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
8198 field. Initialize it in constructor.
8199 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
8200 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
8201 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
8204 * output.cc (Output_reloc::get_address): Change return type to
8206 * output.h (class Output_reloc): Update get_address declaration.
8207 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
8208 for section addresses.
8210 2008-05-09 Ian Lance Taylor <iant@google.com>
8213 * gold.cc (gold_nomem): Use return value of write.
8215 2008-05-08 Ian Lance Taylor <iant@google.com>
8217 * symtab.c (Symbol::init_base_output_data): Add version
8218 parameter. Change all callers.
8219 (Symbol::init_base_output_segment): Likewise.
8220 (Symbol::init_base_constant): Likewise.
8221 (Symbol::init_base_undefined): Likewise.
8222 (Sized_symbol::init_output_data): Likewise.
8223 (Sized_symbol::init_output_segment): Likewise.
8224 (Sized_symbol::init_constant): Likewise.
8225 (Sized_symbol::init_undefined): Likewise.
8226 (Symbol_table::do_define_in_output_data): If the new symbol has a
8227 version, mark it as the default.
8228 (Symbol_table::do_define_in_output_segment): Likewise.
8229 (Symbol_table::do_define_as_constant): Likewise.
8230 * symtab.h (class Symbol): Update declarations.
8231 (class Sized_symbol): Likewise.
8232 * resolve.cc (Symbol::override_version): New function.
8233 (Symbol::override_base): Call override_version.
8234 (Symbol::override_base_with_special): Likewise.
8235 * testsuite/ver_script_8.script: New file.
8236 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
8237 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
8238 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
8239 (ver_test_8_1.so, ver_test_8_2.so): New targets.
8241 2008-05-06 Ian Lance Taylor <iant@google.com>
8244 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
8246 (class General_options): Remove existing --undefined, and add
8247 --no-undefined instead. Add new --undefined as synonym for -u.
8248 * archive.cc (Archive::add_symbols): Check whether symbol was
8250 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
8251 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
8252 all uses. Add IS_UNDEFINED. Update declarations to split
8253 different versions of init_base. Declare init_base_undefined.
8254 (Symbol::is_defined): Handle IS_UNDEFINED.
8255 (Symbol::is_undefined): Likewise.
8256 (Symbol::is_weak_undefined): Call is_undefined.
8257 (Symbol::is_absolute): Handle IS_CONSTANT.
8258 (class Sized_symbol): Update declarations to split different
8259 versions of init. Declare init_undefined.
8260 (class Symbol_table): Declare new functions.
8261 * symtab.cc (Symbol::init_base_object): Rename from init_base.
8263 (Symbol::init_base_output_data): Likewise.
8264 (Symbol::init_base_output_segment): Likewise.
8265 (Symbol::init_base_constant): Likewise.
8266 (Symbol::init_base_undefined): New function.
8267 (Sized_symbol::init_object): Rename from init. Change all
8269 (Sized_symbol::init_output_data): Likewise.
8270 (Sized_symbol::init_output_segment): Likewise.
8271 (Sized_symbol::init_constant): Likewise.
8272 (Sized_symbol::init_undefined): New function.
8273 (Symbol_table::add_undefined_symbols_from_command_line): New
8275 (Symbol_table::do_add_undefined_symbols_from_command_line): New
8277 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
8278 (Symbol::output_section): Likewise.
8279 (Symbol::set_output_section): Likewise.
8280 (Symbol_table::sized_finalize_symbol): Likewise.
8281 (Symbol_table::sized_write_globals): Likewise.
8282 * resolve.cc (Symbol_table::should_override): Likewise.
8283 (Symbol::override_base_with_special): Likewise.
8285 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
8286 symbol, change it to have default visibility.
8287 * testsuite/protected_1.cc: New file.
8288 * testsuite/protected_2.cc: New file.
8289 * testsuite/protected_3.cc: New file.
8290 * testsuite/protected_main_1.cc: New file.
8291 * testsuite/protected_main_2.cc: New file.
8292 * testsuite/protected_main_3.cc: New file.
8293 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
8294 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
8295 (protected_1_LDFLAGS, protected_1_LDADD): Define.
8296 (protected_1.so): New target.
8297 (protected_1_pic.o, protected_2_pic.o): New targets.
8298 (protected_3_pic.o): New target.
8299 (check_PROGRAMS): Add protected_2.
8300 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
8301 (protected_2_LDFLAGS, protected_2_LDADD): Define.
8302 * testsuite/Makefile.in: Rebuild.
8304 * options.h (DEFINE_var): Add set_user_set_##varname__.
8305 (DEFINE_bool_alias): New macro.
8306 (class General_options): Define -Bstatic using DEFINE_bool_alias
8307 rather than DEFINE_special. Add --undefined as an alias for -z
8309 * options.cc (General_options::parse_Bstatic): Remove.
8311 * options.h (class General_options): Add --fatal-warnings.
8312 * main.cc (main): Implement --fatal-warnings.
8313 * errors.h (Errors::warning_count): New function.
8315 * options.h (class General_options): Add -Bsymbolic-functions.
8316 * symtab.h (Symbol::is_preemptible): Check for
8317 -Bsymbolic-functions.
8319 2008-05-05 Ian Lance Taylor <iant@google.com>
8321 * options.h (DEFINE_bool): For DASH_Z, create the negative option
8322 as noVARNAME rather than no-VARNAME.
8323 (class General_options): Add option -z combreloc.
8324 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
8326 (Output_reloc::sort_before) [SHT_REL]: New function.
8327 (Output_reloc::sort_before) [SHT_RELA]: New function.
8328 (class Output_data_reloc_base): Add sort_relocs_ field. Define
8329 Sort_relocs_comparison.
8330 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
8331 parameter. Change all callers.
8332 (Output_data_reloc::Output_data_reloc) [both versions]: Add
8333 sort_relocs parameter. Change all callers.
8334 * output.cc (Output_reloc::get_address): New function, broken out
8336 (Output_reloc::write_rel): Call it.
8337 (Output_reloc::compare): New function.
8338 (Output_data_reloc_base::do_write): Optionally sort relocs.
8340 * configure.ac: If targ_extra_obj is set, link it in.
8341 * configure.tgt: Initialize all variables.
8342 (x86_64*): Set targ_extra_obj and targ_extra_size.
8343 * configure: Rebuild.
8345 * object.cc (Sized_relobj::include_section_group): Adjust section
8346 indexes read from group data. Build vector to pass to
8348 * layout.cc (Layout::layout_group): Add flags and shndxes
8349 parameters. Remove contents parameter. Change caller. Update
8350 explicit instantiations.
8351 * layout.h (class Layout): Update layout_group declaration.
8352 * output.cc (Output_data_group::Output_data_group): Add flags and
8353 input_shndxes parameters. Remove contents parameter. Change
8355 (Output_data_group::do_write): Change input_sections_ to
8357 * output.h (class Output_data_group): Update constructor
8358 declaration. Rename input_sections_ to input_shndxes_.
8359 * testsuite/many_sections_test.cc: Add template.
8361 2008-04-30 Cary Coutant <ccoutant@google.com>
8363 * target-reloc.h (relocate_section): Fix dead-pointer bug.
8365 * layout.cc (Layout::include_section): Refactored check for debug
8367 (Layout::add_comdat): Add new parameters. Change type
8368 of signature parameter. Add object and shndx to signatures table.
8369 (Layout::find_kept_object): New function.
8370 * layout.h: Include <cstring>.
8371 (Layout::is_debug_info_section): New function.
8372 (Layout::add_comdat): Add new parameters.
8373 (Layout::find_kept_object): New function.
8374 (Layout::Kept_section): New struct.
8375 (Layout::Signatures): Change type of map range.
8376 * object.cc (Relobj::output_section_address): New function.
8377 (Sized_relobj::include_section_group): Add new parameters. Change
8378 calls to Layout::add_comdat. Change to build table of kept comdat
8379 groups and table mapping discarded sections to kept sections.
8380 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
8381 (Sized_relobj::do_layout): Change calls to include_section_group and
8382 include_linkonce_section.
8383 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
8384 value to zero when section is discarded.
8385 (Sized_relobj::map_to_kept_section): New function.
8386 * object.h (Relobj::output_section_address): New function.
8387 (Relobj::Comdat_group): New type.
8388 (Relobj::find_comdat_group): New function.
8389 (Relobj::Comdat_group_table): New type.
8390 (Relobj::Kept_comdat_section): New type.
8391 (Relobj::Kept_comdat_section_table): New type.
8392 (Relobj::add_comdat_group): New function.
8393 (Relobj::set_kept_comdat_section): New function.
8394 (Relobj::get_kept_comdat_section): New function.
8395 (Relobj::comdat_groups_): New field.
8396 (Relobj::kept_comdat_sections_): New field.
8397 (Symbol_value::input_value): Update comment.
8398 (Sized_relobj::map_to_kept_section) New function.
8399 (Sized_relobj::include_linkonce_section): Add new parameter.
8400 * target-reloc.h (Comdat_behavior): New type.
8401 (get_comdat_behavior): New function.
8402 (relocate_section): Add code to map a discarded section to the
8403 corresponding kept section when applying a relocation.
8405 2008-04-30 Craig Silverstein <csilvers@google.com>
8407 * dwarf_reader.cc (next_generation_count): New static var.
8408 (Addr2line_cache_entry): New struct.
8409 (addr2line_cache): New static var.
8410 (Dwarf_line_info::one_addr2line): Added caching.
8411 (Dwarf_line_info::clear_addr2line_cache): New function.
8412 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
8413 cache-size parameter.
8414 (Dwarf_line_info::one_addr2line_cache): New function.
8415 * symtab.cc (Symbol_table::detect_odr_violations): Pass
8416 new cache-size argument to one_addr2line(), and clear cache.
8418 2008-04-28 Cary Coutant <ccoutant@google.com>
8420 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
8421 R_386_PC8 relocations.
8423 2008-04-23 Ian Lance Taylor <iant@google.com>
8425 * object.cc (Sized_relobj::include_section_group): Check for
8426 invalid section group.
8428 * object.cc (make_elf_object): Correct test for 64-bit ELF file
8431 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
8432 than read for file header.
8433 * archive.cc (Archive::include_member): Likewise.
8435 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
8437 * aclocal.m4: Regenerate.
8438 * configure: Regenerate.
8440 2008-04-19 Ian Lance Taylor <iant@google.com>
8442 * version.cc (version_string): Bump to 1.6.
8444 * testsuite/Makefile.am (many_sections_r_test): New target.
8445 (many_sections_r_test_SOURCES): Remove.
8446 (many_sections_r_test_DEPENDENCIES): Remove.
8447 (many_sections_r_test_LDFLAGS): Remove.
8448 (many_sections_r_test_LDADD): Remove.
8450 * object.cc (Sized_relobj::do_add_symbols): Always pass
8451 local_symbol_count_ to add_from_relobj.
8453 * testsuite/Makefile.am (many_sections_check.h): Only check one in
8454 every thousand variables.
8455 * testsuite/Makefile.in: Rebuild.
8457 * object.cc (Xindex::initialize_symtab_xindex): New function.
8458 (Xindex::read_symtab_xindex): New function.
8459 (Xindex::sym_xindex_to_shndx): New function.
8460 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
8462 (Sized_relobj::do_initialize_xindex): New function.
8463 (Sized_relobj::do_read_symbols): Adjust section links.
8464 (Sized_relobj::symbol_section_and_value): Add is_ordinary
8465 parameter. Change all callers.
8466 (Sized_relobj::include_section_group): Adjust section links and
8467 symbol section indexes.
8468 (Sized_relobj::do_layout): Adjust section links.
8469 (Sized_relobj::do_count_local_symbols): Adjust section links and
8470 symbol section indexes.
8471 (Sized_relobj::do_finalize_local_symbols): Distinguish between
8472 ordinary and special symbols.
8473 (Sized_relobj::write_local_symbols): Add symtab_xindex and
8474 dynsym_xindex parameters. Change all callers. Adjust section
8475 links. Use SHN_XINDEX when needed.
8476 (Sized_relobj::get_symbol_location_info): Adjust section links.
8477 Don't get fooled by special symbols.
8478 * object.h (class Xindex): Define.
8479 (class Object): Add xindex_ parameter. Declare virtual functoin
8480 do_initialize_xindex.
8481 (Object::adjust_sym_shndx): New function.
8482 (Object::set_xindex): New protected function.
8483 (class Symbol_value): Add is_ordinary_shndx_ field.
8484 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
8485 (Symbol_value::value): Assert ordinary section.
8486 (Symbol_value::initialize_input_to_output_map): Likewise.
8487 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
8489 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
8491 (class Sized_relobj): Update declarations.
8492 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
8493 parameter. Change all callers.
8494 (Sized_relobj::adjust_shndx): New function.
8495 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
8497 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
8498 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
8499 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
8500 (Sized_dynobj::read_dynsym_section): Adjust section links.
8501 (Sized_dynobj::read_dynamic): Likewise.
8502 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
8504 (Sized_dynobj::do_initialize_xindex): New function.
8505 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
8506 do_initialize_xindex.
8507 (Sized_dynobj::adjust_shndx): New function.
8508 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
8509 dynsym_xindex_ fields.
8510 (Layout::finalize): Add a call to set_section_indexes before
8511 creating the symtab sections.
8512 (Layout::set_section_indexes): Don't do anything if the section
8513 already has a section index.
8514 (Layout::create_symtab_sections): Add shnum parameter. Change
8515 caller. Create .symtab_shndx section if needed.
8516 (Layout::create_shdrs): Add shstrtab_section parameter. Change
8518 (Layout::allocated_output_section_count): New function.
8519 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
8521 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
8522 fields. Update declarations.
8523 (Layout::symtab_xindex): New function.
8524 (Layout::dynsym_xindex): New function.
8525 (class Write_symbols_task): Add layout_ field.
8526 (Write_symbols_task::Write_symbols_task): Add layout parameter.
8528 * output.cc (Output_section_headers::Output_section_headers): Add
8529 shstrtab_section parameter. Change all callers.
8530 (Output_section_headers::do_sized_write): Store overflow values
8531 for section count and section string table section index in
8532 section header zero.
8533 (Output_file_header::do_sized_write): Check for overflow of
8534 section count and section string table section index.
8535 (Output_symtab_xindex::do_write): New function.
8536 (Output_symtab_xindex::endian_do_write): New function.
8537 * output.h (class Output_section_headers): Add shstrtab_section_.
8538 Update declarations.
8539 (class Output_symtab_xindex): Define.
8540 (Output_section::has_out_shndx): New function.
8541 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
8543 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
8545 (Sized_symbol::init): Likewise.
8546 (Symbol::output_section): Check for ordinary symbol.
8547 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
8548 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
8550 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
8551 Change all callers. Simplify handling of symbols from sections
8552 not included in the link.
8553 (Symbol_table::add_from_dynobj): Handle ordinary symbol
8555 (Weak_alias_sorter::operator()): Assert that symbols are
8557 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
8559 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
8560 parameters. Change all callers.
8561 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
8562 symbol distinction. Use SHN_XINDEX when needed.
8563 (Symbol_table::write_section_symbol): Add symtab_xindex
8564 parameter. Change all callers.
8565 (Symbol_table::sized_write_section_symbol): Likewise. Use
8566 SHN_XINDEX when needed.
8567 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
8569 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
8570 (Symbol::is_defined): Check is_ordinary.
8571 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
8572 (Symbol::is_absolute, Symbol::is_common): Likewise.
8573 (class Sized_symbol): Update declarations.
8574 (class Symbol_table): Update declarations.
8575 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
8576 parameters. Change all callers.
8577 (Sized_symbol::override): Likewise.
8578 (Symbol_table::override): Likewise.
8579 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
8580 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
8581 is_ordinary, and orig_st_shndx parameters. Change all callers.
8582 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
8583 to be in an ordinary section.
8584 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
8585 object and is_ordinary parameters. Change all callers.
8586 (Sized_dwarf_line_info::read_relocs): Add object parameter.
8587 Change all callers. Don't add undefined or non-ordinary symbols
8589 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
8591 * dwarf_reader.h (class Sized_dwarf_line_info): Update
8593 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
8594 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
8595 (Sized_relobj::relocate_sections): Likewise.
8596 * target-reloc.h (scan_relocs): Adjust section symbol index.
8597 (scan_relocatable_relocs): Likewise.
8598 * i386.cc (Scan::local): Check for ordinary symbols.
8599 * sparc.cc (Scan::local): Likewise.
8600 * x86_64.cc (Scan::local): Likewise.
8601 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
8602 to symbol_section_and_value.
8603 * testsuite/many_sections_test.cc: New file.
8604 * testsuite/Makefile.am (BUILT_SOURCES): Define.
8605 (check_PROGRAMS): Add many_sections_test.
8606 (many_sections_test_SOURCES): Define.
8607 (many_sections_test_DEPENDENCIES): Define.
8608 (many_sections_test_LDFLAGS): Define.
8609 (BUILT_SOURCES): Add many_sections_define.h.
8610 (many_sections_define.h): New target.
8611 (BUILT_SOURCES): Add many_sections_check.h.
8612 (many_sections_check.h): New target.
8613 (check_PROGRAMS): Add many_sections_r_test.
8614 (many_sections_r_test_SOURCES): Define.
8615 (many_sections_r_test_DEPENDENCIES): Define.
8616 (many_sections_r_test_LDFLAGS): Define.
8617 (many_sections_r_test_LDADD): Define.
8618 (many_sections_r_test.o): New target.
8619 * testsuite/Makefile.in: Rebuild.
8621 2008-04-17 Cary Coutant <ccoutant@google.com>
8623 * errors.cc (Errors::info): New function.
8624 (gold_info): New function.
8625 * errors.h (Errors::info): New function.
8626 * gold.h (gold_info): New function.
8627 * object.cc (Input_objects::add_object): Print trace output.
8628 * options.cc (options::parse_set): New function.
8629 (General_options::parse_wrap): Deleted.
8630 (General_options::General_options): Deleted initializer.
8631 * options.h (options::String_set): New typedef.
8632 (options::parse_set): New function.
8633 (DEFINE_set): New macro.
8634 (General_options::wrap): Changed to use DEFINE_set. Changed
8635 callers of any_wrap_symbols and is_wrap_symbol.
8636 (General_options::trace, General_options::trace_symbol):
8638 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
8639 (General_options::wrap_symbols_): Deleted.
8640 * symtab.cc (Symbol_table::add_from_object): Print trace output.
8642 2008-04-17 David S. Miller <davem@davemloft.net>
8644 * options.cc (General_options::parse_V): New function.
8645 * options.h: Add entries for -V and -Qy.
8647 2008-04-17 Ian Lance Taylor <iant@google.com>
8649 * common.cc (Symbol_table::allocate_commons): Remove options
8650 parameter. Change caller.
8651 (Symbol_table::do_allocate_commons): Remove options parameter.
8652 Change caller. Just call do_allocate_commons_list twice.
8653 (Symbol_table::do_allocate_commons_list): New function, broken out
8654 of do_allocate_commons.
8655 * common.h (class Allocate_commons_task): Remove options_ field.
8657 * symtab.cc (Symbol_table::Symbol_table): Initialize
8659 (Symbol_table::add_from_object): Put TLS common symbols on
8661 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
8662 which are IN_OUTPUT_DATA.
8663 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
8664 allocate_commons and do_allocate_commons declarations. Declare
8665 do_allocate_commons_list.
8666 * gold.cc (queue_middle_tasks): Update creation of
8667 Allocate_commons_task to not pass options.
8668 * testsuite/Makefile.am (INCLUDES): Add -I.. .
8669 (TLS_TEST_C_FLAGS): New variable.
8670 (tls_test_c_pic.o): New target.
8671 (tls_test_shared.so): Link in tls_test_c_pic.o.
8672 (tls_test_c_pic_ie.o): New target.
8673 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
8674 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
8675 (tls_test_c.o): New target.
8676 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
8677 (tls_pic_test_LDADD): Likewise.
8678 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
8679 (tls_shared_gd_to_ie_test_LDADD): Likewise.
8680 (tls_test_c_gnu2.o): New target.
8681 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
8683 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
8684 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
8685 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
8686 * testsuite/tls_test.cc: Include "config.h".
8687 (t_last): Call t11_last.
8688 * testsuite/tls_test.h (t11, t11_last): Declare.
8689 * testsuite/tls_test_c.c: New file.
8690 * testsuite/tls_test_main.cc (thread_routine): Call t11.
8691 * configure.ac: Check for OpenMP support.
8692 * configure, config.in, Makefile.in: Rebuild.
8693 * testsuite/Makefile.in: Rebuild.
8695 2008-04-16 Cary Coutant <ccoutant@google.com>
8697 * i386.cc (Target_i386::define_tls_base_symbol): New function.
8698 (Target_i386::tls_base_symbol_defined_): New field.
8699 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
8700 (Target_i386::Scan::global): Likewise.
8701 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
8702 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
8703 (Target_x86_64::tls_base_symbol_defined_): New field.
8704 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
8705 (Target_x86_64::Scan::global): Likewise.
8707 2008-04-16 Cary Coutant <ccoutant@google.com>
8709 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
8710 (Symbol::needs_plt_entry): Allow weak undefined symbols.
8711 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
8712 building shared libraries.
8713 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
8714 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
8715 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
8716 * testsuite/Makefile.in: Rebuild.
8717 * testsuite/weak_undef.h: New file.
8718 * testsuite/weak_undef_file1.cc: Add extra test cases.
8719 * testsuite/weak_undef_file2.cc: Likewise.
8720 * testsuite/weak_undef_test.cc: Likewise.
8722 2008-04-16 David S. Miller <davem@davemloft.net>
8724 * sparc.cc (Target_sparc::Scan): Change from struct to class.
8725 Add issued_non_pic_error_ field. Declare check_non_pic.
8726 (Target_sparc::Scan::check_non_pic): New function.
8727 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
8728 (Target_sparc::Scan::global): Likewise.
8730 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
8731 * configure: Rebuild.
8733 * options.h (DEFINE_enable): New macro.
8734 (new_dtags): New enable option.
8735 (initfirst, interpose, loadfltr, nodefaultlib,
8736 nodelete, nodlopen, nodump): New -z options.
8737 * layout.cc (Layout:finish_dynamic_section): If new
8738 dtags enabled, emit DT_RUNPATH. Also, emit a
8739 DT_FLAGS_1 containing any specified -z flags.
8741 2008-04-16 Ian Lance Taylor <iant@google.com>
8743 * copy-relocs.cc: New file.
8744 * copy-relocs.h: New file.
8745 * reloc.cc: Remove Copy_relocs code.
8746 * reloc.h: Likewise.
8747 * reloc-types.h (struct Reloc_types) [both versions]: Add
8748 get_reloc_addend_noerror.
8749 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
8750 variants of add_global which take an addend which must be zero.
8751 * i386.cc: Include "copy-relocs.h".
8752 (class Target_i386): Change type of copy_relocs_ to variable,
8754 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
8756 (Target_i386::do_finalize_sections): Change handling of
8758 * sparc.cc: Include "copy-relocs.h".
8759 (class Target_sparc): Change type of copy_relocs_ to variable,
8761 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
8763 (Target_sparc::do_finalize_sections): Change handling of
8765 * x86_64.cc: Include "copy-relocs.h".
8766 (class Target_x86_64): Change type of copy_relocs_ to variable,
8768 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
8769 class. Change all callers.
8770 (Target_x86_64::do_finalize_sections): Change handling of
8772 * Makefile.am (CCFILES): Add copy-relocs.cc.
8773 (HFILES): Add copy-relocs.h.
8775 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
8777 * testsuite/script_test_4.sh: Permit leading zeroes.
8779 2008-04-15 Ian Lance Taylor <iant@google.com>
8781 * script-sections.cc (Script_sections::create_segments): Use
8782 header_size_adjustment even when there is enough room for the
8784 * testsuite/script_test_4.sh: New file.
8785 * testsuite/script_test_4.t: New file.
8786 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
8787 (check_DATA): Add script_test_4.stdout.
8788 (MOSTLYCLEANFILES): Likewise.
8789 (script_test_4): New target.
8790 (script_test_4.stdout): New target.
8791 * testsuite/Makefile.in: Rebuild.
8793 * sparc.cc: Add definitions for Output_data_plt_sparc class
8796 2008-04-14 David S. Miller <davem@davemloft.net>
8798 * sparc.cc: New file.
8799 * Makefile.am (TARGETSOURCES): Add sparc.cc
8800 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
8801 * configure.tgt: Document targ_extra_size and
8802 targ_extra_big_endian. Add entries for sparc-* and
8804 * configure.ac: Handle targ_extra_size and
8805 targ_extra_big_endian.
8806 * Makefile.in: Rebuild.
8807 * configure: Likewise.
8808 * po/POTFILES.in: Likewise.
8809 * po/gold.pot: Likewise.
8811 2008-04-14 Ian Lance Taylor <iant@google.com>
8813 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
8814 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
8815 in the name/type/flags to section mapping. Don't call
8816 allocate_output_section.
8817 (Layout::choose_output_section): Change parameter from adjust_name
8818 to is_input_section. Don't permit input sections after sections
8819 are attached to segments. Don't call allocate_output_section.
8820 (Layout::layout_eh_frame): Call update_flags_for_input_section,
8821 not write_enable_output_section.
8822 (Layout::make_output_section): Don't push to
8823 unattached_section_list_ nor call attach_to_segment. Call
8824 attach_section_to_segment if sections are attached.
8825 (Layout::attach_sections_to_segments): New function.
8826 (Layout::attach_section_to_segment): New function.
8827 (Layout::attach_allocated_section_to_segment): Rename from
8828 attach_to_segment. Remove flags parameter.
8829 (Layout::allocate_output_section): Remove function.
8830 (Layout::write_enable_output_section): Remove function.
8831 * layout.h (class Layout): Update for above changes. Add new
8832 field sections_are_attached_.
8833 * output.h (Output_section::update_flags_for_input_section): New
8835 * output.cc (Output_section::add_input_section): Call
8836 update_flags_for_input_section.
8837 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
8839 2008-04-11 Cary Coutant <ccoutant@google.com>
8841 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
8842 thought unnecessary.
8843 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
8845 2008-04-11 Ian Lance Taylor <iant@google.com>
8847 * output.h (class Output_section_data): Remove inline definition
8849 * output.cc (Output_section_data::set_addralign): New function.
8851 2008-04-11 Cary Coutant <ccoutant@google.com>
8853 Add support for TLS descriptors for i386 and x86_64.
8854 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
8855 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
8856 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
8858 (Target_i386::got_mod_index_entry): Remove unnecessary code.
8859 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
8860 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
8862 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
8863 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
8864 Fix problem with initial-exec relocations.
8865 (Target_i386::Relocate::relocate_tls): Likewise.
8866 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
8868 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
8869 support for section-plus-offset dynamic table entries.
8870 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
8871 (Output_data_dynamic::Dynamic_entry): Add support for
8872 section-plus-offset dynamic table entries.
8873 (Output_data_dynamic::Classification): Likewise.
8874 (Output_data_dynamic::classification_): Renamed offset_.
8875 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
8876 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
8877 (Target_x86_64::make_plt_section): New function.
8878 (Target_x86_64::reserve_tlsdesc_entries): New function.
8879 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
8880 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
8881 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
8882 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
8883 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
8884 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
8885 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
8886 add extra PLT entry for TLS descriptors.
8887 (Output_data_plt_x86_64::got_): New field.
8888 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
8889 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
8891 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
8893 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
8894 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
8895 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
8896 R_386_TLS_DESC_CALL relocations.
8897 (Target_x86_64::Scan::global): Likewise.
8898 (Target_x86_64::do_finalize_sections): Add dynamic table entries
8899 for TLS descriptors.
8900 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
8901 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
8902 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
8903 GD-to-IE relaxation.
8904 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
8905 and TLS_DESCRIPTORS.
8906 * Makefile.in: Rebuild.
8907 * configure: Rebuild.
8908 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
8909 (tls_test_shared2.so): New target.
8910 (tls_shared_gd_to_ie_test_SOURCES): New variable.
8911 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
8912 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
8913 (tls_shared_gd_to_ie_test_LDADD): New variable.
8914 (tls_shared_gnu2_gd_to_ie_test): New target.
8915 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
8917 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
8918 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
8919 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
8920 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
8921 (tls_shared_gnu2_test): New target.
8922 (tls_test_gnu2_shared.so): New target.
8923 (tls_shared_gnu2_test_SOURCES): New variable.
8924 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
8925 (tls_shared_gnu2_test_LDFLAGS): New variable.
8926 (tls_shared_gnu2_test_LDADD): New variable.
8927 * testsuite/Makefile.in: Rebuild.
8928 * testsuite/Makefile.
8930 2008-04-11 Ian Lance Taylor <iant@google.com>
8932 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
8934 * testsuite/Makefile.in: Rebuild.
8936 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
8938 * testsuite/script_test_2.cc (main): Adjust test.
8940 2008-04-11 David S. Miller <davem@davemloft.net>
8941 Ian Lance Taylor <iant@google.com>
8943 * options.h (General_options): Add entries for '-Y' and
8945 * options.cc (General_options:finalize): If -Y was used, add those
8946 entries to the library path instead of the default "/lib" and
8949 2008-04-11 David S. Miller <davem@davemloft.net>
8951 * testsuite/justsyms.t: Start at 0x100.
8952 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
8953 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
8955 * testsuite/script_test_2.cc: Adjust string and section length
8958 2008-04-09 Ian Lance Taylor <iant@google.com>
8961 * script-sections.cc (Sections_element::allocate_to_segment): Add
8963 (Output_section_definition::allocate_to_segment): Likewise.
8964 (Orphan_output_section::allocate_to_segment): Likewise.
8965 (Script_sections::attach_sections_using_phdrs_clause): Don't
8966 propagate non-PT_LOAD segments to orphan sections.
8967 * testsuite/Makefile.am (script_test_3.stdout): Generate using
8968 readelf rather than objdump.
8969 * testsuite/script_test_3.sh: Adjust accordingly. Test that
8970 .interp section and PT_INTERP segment are the same size.
8971 * testsuite/Makefile.in: Rebuild.
8973 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
8974 aliases for symbols defined in the same object.
8975 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
8976 (weak_alias_test_SOURCES): New variable.
8977 (weak_alias_test_DEPENDENCIES): New variable.
8978 (weak_alias_test_LDFLAGS): New variable.
8979 (weak_alias_test_LDADD): New variable.
8980 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
8981 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
8982 (weak_alias_test_3.o): New target.
8983 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
8984 * testsuite/weak_alias_test_main.cc: New file.
8985 * testsuite/weak_alias_test_1.cc: New file.
8986 * testsuite/weak_alias_test_2.cc: New file.
8987 * testsuite/weak_alias_test_3.cc: New file.
8989 2008-04-08 Ian Lance Taylor <iant@google.com>
8991 * options.h (class General_options): Add --noinhibit-exec option.
8992 * main.cc (main): Check --noinhibit-exec.
8994 * options.h (class General_options): Define --wrap as a special
8995 option. Add wrap_symbols_ field.
8996 (General_options::any_wrap_symbols): New function.
8997 (General_options::is_wrap_symbol): New function.
8998 * options.cc (General_options::parse_wrap): New function.
8999 (General_options::General_options): Initialize wrap_symbols_.
9000 * symtab.cc (Symbol_table::wrap_symbol): New function.
9001 (Symbol_table::add_from_object): Handle --wrap.
9002 * symtab.h (class Symbol_table): Declare wrap_symbol.
9003 * target.h (Target::wrap_char): New function.
9004 (Target::Target_info): Add wrap_char field.
9005 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
9006 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9007 * testsuite/testfile.cc (Target_test::test_target_info):
9010 * errors.cc (Errors::undefined_symbol): Mention symbol version if
9013 * layout.h (class Layout): Add added_eh_frame_data_ field.
9014 * layout.cc (Layout::Layout): Initialize new field.
9015 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
9016 output section until we find a section we merged successfully.
9017 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
9018 that the size be non-zero.
9020 * merge.cc (Object_merge_map::get_output_offset): Remove inline
9023 2008-04-08 Craig Silverstein <csilvers@google.com>
9025 * configure.ac: Export new conditional variable HAVE_ZLIB.
9026 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
9028 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
9029 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
9031 2008-04-07 Ian Lance Taylor <iant@google.com>
9033 * version.cc (version_string): Set to "1.5".
9035 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
9036 Add issued_non_pic_error_ field. Declare check_non_pic.
9037 (Target_x86_64::Scan::check_non_pic): New function.
9038 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
9039 (Target_x86_64::Scan::global): Likewise.
9041 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
9042 addend parameter. Change caller. Handle merge sections.
9043 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
9044 Address to Addend. Don't add in the result of
9045 local_section_offset, pass down the addend and use the returned
9047 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
9048 Update declarations of local_section_offset and symbol_value.
9049 * testsuite/two_file_test_1.cc (t18): New function.
9050 * testsuite/two_file_test_2.cc (f18): New function.
9051 * testsuite/two_file_test_main.cc (main): Call t18.
9052 * testsuite/two_file_test.h (t18, f18): Declare.
9054 * configure.ac: Don't test for objdump, c++filt, or readelf.
9055 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
9057 (TEST_READELF): New variable.
9058 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
9059 (check_PROGRAMS): Add two_file_strip_test.
9060 (two_file_strip_test): New target.
9061 (check_PROGRAMS): Add two_file_same_shared_strip_test.
9062 (two_file_same_shared_strip_test_SOURCES): New variable.
9063 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
9064 (two_file_same_shared_strip_test_LDFLAGS): New variable.
9065 (two_file_same_shared_strip_test_LDADD): New variable.
9066 (two_file_shared_strip.so): New target.
9067 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
9068 (ver_test_5.syms, ver_test_7.syms): Likewise.
9069 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
9070 (strip_test_3.stdout): Use TEST_OBJDUMP.
9071 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
9073 2008-04-04 Cary Coutant <ccoutant@google.com>
9075 * symtab.h (Symbol::is_weak_undefined): New function.
9076 (Symbol::is_strong_undefined): New function.
9077 (Symbol::is_absolute): New function.
9078 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
9079 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
9081 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
9082 (weak_undef_test): New target.
9083 * testsuite/Makefile.in: Rebuild.
9084 * testsuite/weak_undef_file1.cc: New file.
9085 * testsuite/weak_undef_file2.cc: New file.
9086 * testsuite/weak_undef_test.cc: New file.
9088 2008-04-03 Craig Silverstein <csilvers@google.com>
9090 * compressed_output.h (class Output_compressed_section): Use
9092 * compressed_output.cc (zlib_compress): Use unsigned buffers,
9094 (zlib_compressed_suffix): Removed.
9095 (Output_compressed_section::set_final_data_size): Use unsigned
9097 * testsuite/Makefile.am (flagstest_compress_debug_sections):
9098 Fix linker invocation.
9099 (flagstest_o_specialfile_and_compress_debug_sections):
9101 * testsuite/Makefile.in: Regenerated.
9103 2008-04-02 David S. Miller <davem@davemloft.net>
9105 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
9106 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
9108 2008-04-02 Craig Silverstein <csilvers@google.com>
9112 2008-04-02 Ian Lance Taylor <iant@google.com>
9114 * fileread.cc (File_read::find_view): Add byteshift and vshifted
9115 parameters. Update for new key type to views_. Change all
9117 (File_read::read): Adjust for byteshift in returned view.
9118 (File_read::add_view): New function, broken out of
9120 (File_read::make_view): New function, broken out of
9122 (File_read::find_or_make_view): Add offset and aligned
9123 parameters. Rewrite accordingly. Change all callers.
9124 (File_read::get_view): Add offset and aligned parameters. Adjust
9125 for byteshift in return value.
9126 (File_read::get_lasting_view): Likewise.
9127 * fileread.h (class File_read): Update declarations.
9128 (class File_read::View): Add byteshift_ field. Add byteshift to
9129 constructor. Add byteshift method.
9130 * archive.h (Archive::clear_uncached_views): New function.
9131 (Archive::get_view): Add aligned parameter. Change all callers.
9132 * object.h (Object::get_view): Add aligned parameter. Change all
9134 (Object::get_lasting_view): Likewise.
9136 * fileread.cc (File_read::release): Don't call clear_views if
9137 there are multiple objects.
9138 * fileread.h (File_read::clear_uncached_views): New function.
9139 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
9142 2008-03-31 Cary Coutant <ccoutant@google.com>
9144 Add thin archive support.
9145 * archive.cc (Archive::armagt): New const.
9146 (Archive::setup): Remove task parameter and calls to unlock.
9147 (Archive::unlock_nested_archives): New function.
9148 (Archive::read_header): Add nested_off parameter. Change
9150 (Archive::interpret_header): Likewise.
9151 (Archive::include_all_members): Change to handle thin
9153 (Archive::include_member): Likewise.
9154 * archive.h (Archive::Archive): Add new parameters and
9156 (Archive::armagt): New const.
9157 (Archive::setup): Remove task parameter.
9158 (Archive::unlock_nested_archives): New function.
9159 (Archive::read_header): Add nested_off parameter.
9160 (Archive::interpret_header): Likewise.
9161 (Archive::Nested_archive_table): New typedef.
9162 (Archive::is_thin_archive_): New field.
9163 (Archive::nested_archives_): New field.
9164 (Archive::options_): New field.
9165 (Archive::dirpath_): New field.
9166 (Archive::task_): New field.
9167 * readsyms.cc (Read_symbols::do_read_symbols): Add check
9168 for thin archives. Pass additional parameters to
9169 Archive::Archive. Unlock the archive file after calling
9172 2008-03-29 Ian Lance Taylor <iant@google.com>
9174 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
9175 version symbol to be local.
9176 * testsuite/ver_test_4.sh: New file.
9177 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
9178 (check_DATA): Add ver_test_4.syms.
9179 (ver_test_4.syms): New target.
9180 * testsuite/Makefile.in: Rebuild.
9183 (Output_section::Input_section_sort_entry::has_priority): New
9185 (Output_section::Input_section_sort_entry::match_file_name): New
9187 (Output_section::Input_section_sort_entry::match_section_name):
9189 (Output_section::Input_section_sort_entry::match_section_name_prefix):
9191 (Output_section::Input_section_sort_entry::match_section_file):
9193 (Output_section::Input_section_sort_compare::operator()): Rewrite
9194 using new Input_section_sort_entry functions. Sort crtbegin and
9195 crtend first. Sort sections with no priority before sections with
9197 * testsuite/initpri1.c (d3): Check j != 4.
9198 (cd5): New constructor/destructor function.
9199 (main): Check j != 2.
9201 * symtab.cc (Symbol_table::add_from_object): If we don't use the
9202 new symbol when resolving, don't call set_is_default.
9203 * testsuite/ver_test_7.cc: New file.
9204 * testsuite/ver_test_7.sh: New file.
9205 * testsuite/Makefile.am (ver_test_7.so): New target.
9206 (ver_test_7.o): New target.
9207 (check_SCRIPTS): Add ver_test_7.sh.
9208 (check_DATA): Add ver_test_7.syms.
9209 (ver_test_7.syms): New target.
9211 2008-03-28 Ian Lance Taylor <iant@google.com>
9213 * layout.cc (Layout::layout): If we see an input section with a
9214 name that needs sorting, set the must_sort flag for the output
9216 (Layout::make_output_section): If the name of the output section
9217 indicates that it might require sorting, set the may_sort flag.
9218 * output.h (Output_section::may_sort_attached_input_sections): New
9220 (Output_section::set_may_sort_attached_input_sections): New
9222 (Output_section::must_sort_attached_input_sections): New
9224 (Output_section::set_must_sort_attached_input_sections): New
9226 (class Output_section): Declare Input_section_sort_entry. Define
9227 Input_section_sort_compare. Declare
9228 sort_attached_input_sections. Add new fields:
9229 may_sort_attached_input_sections_,
9230 must_sort_attached_input_sections_,
9231 attached_input_sections_are_sorted_.
9232 * output.cc (Output_section::Output_section): Initialize new
9234 (Output_section::add_input_section): Add an entry to
9235 input_sections_ if may_sort or must_sort are true.
9236 (Output_section::set_final_data_size): Call
9237 sort_attached_input_sections if necessary.
9238 (Output_section::Input_section_sort_entry): Define new class.
9239 (Output_section::Input_section_sort_compare::operator()): New
9241 (Output_section::sort_attached_input_sections): New function.
9242 * configure.ac: Check whether the compiler supports constructor
9243 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
9244 * testsuite/initpri1.c: New file.
9245 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
9246 CONSTRUCTOR_PRIORITY.
9247 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
9248 (initpri1_LDFLAGS): New variable.
9249 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
9251 2008-03-27 Ian Lance Taylor <iant@google.com>
9253 * common.cc (Sort_commons::operator): Correct sorting algorithm.
9254 * testsuite/common_test_1.c: New file.
9255 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
9256 (common_test_1_SOURCES): New variable.
9257 (common_test_1_DEPENDENCIES): New variable.
9258 (common_test_1_LDFLAGS): New variable.
9260 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
9261 and commons_ correctly when NAME/VERSION does not override
9263 * testsuite/ver_test_6.c: New file.
9264 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
9265 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
9266 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
9268 2008-03-26 Ian Lance Taylor <iant@google.com>
9270 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
9271 of an undefined symbol from a version script.
9272 * testsuite/Makefile.am (ver_test_5.so): New target.
9273 (ver_test_5.o): New target.
9274 (check_SCRIPTS): Add ver_test_5.sh.
9275 (check_DATA): Add ver_test_5.syms.
9276 (ver_test_5.syms): New target.
9277 * testsuite/ver_test_5.cc: New file.
9278 * testsuite/ver_test_5.script: New file.
9279 * testsuite/ver_test_5.sh: New file.
9280 * Makefile.in, testsuite/Makefile.in: Rebuild.
9283 Fix problems building gold with gcc 4.3.0.
9284 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
9285 (gold_error_at_location, gold_warning_at_location): Use it.
9286 * configure.ac: Check whether we can compile and use a template
9287 function with a printf attribute.
9288 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
9289 when jumping over bytes.
9290 * object.cc: Instantiate Object::read_section_data.
9291 * debug.h: Include <cstring>
9292 * dwarf_reader.cc: Include <algorithm>
9293 * main.cc: Include <cstring>.
9294 * options.cc: Include <cstring>.
9295 * output.cc: Include <cstring>.
9296 * script.cc: Include <cstring>.
9297 * script.h: Include <string>.
9298 * symtab.cc: Include <cstring> and <algorithm>.
9299 * target-select.cc: Include <cstring>.
9300 * version.cc: Include <string>.
9301 * testsuite/testmain.cc: Include <cstdlib>.
9302 * configure, config.in: Rebuild.
9304 2008-03-25 Ian Lance Taylor <iant@google.com>
9306 * options.cc: Include "../bfd/bfdver.h".
9307 (options::help): Print bug reporting address.
9309 * version.cc (print_version): Adjust output for current value of
9314 * options.cc (options::help): Print list of supported targets.
9315 * target-select.h: Include <vector>.
9316 (class Target_selector): Make machine_, size_, and is_big_endian_
9317 fields const. Add bfd_name_ and instantiated_target_ fields.
9318 (Target_selector::Target_selector): Add bfd_name parameter.
9319 (Target_selector::recognize): Make non-virtual, call
9321 (Target_selector::recognize_by_name): Make non-virtual, call
9322 do_recognize_by_name.
9323 (Target_selector::supported_names): New function.
9324 (Target_selector::bfd_name): New function.
9325 (Target_selector::do_instantiate_target): New pure virtual
9327 (Target_selector::do_recognize): New virtual function.
9328 (Target_selector::do_recognize_by_name): New virtual function.
9329 (Target_selector::instantiate_target): New private function.
9330 (supported_target_names): Declare.
9331 * target-select.cc (Target_selector::Target_selector): Update for
9332 new parameter and fields.
9333 (select_target_by_name): Check that the name matches before
9334 calling recognize_by_name.
9335 (supported_target_names): New function.
9336 * i386.cc (class Target_selector_i386): Update Target_selector
9337 constructor call. Remove recognize and recognize_by_name. Add
9338 do_instantiate_target.
9339 * x86_64.cc (class Target_selector_x86_64): Likewise.
9340 * testsuite/testfile.cc (class Target_selector_test): Update for
9341 changes to Target_selector.
9343 * README: Rewrite, with some notes on unsupported features.
9345 2008-03-24 Cary Coutant <ccoutant@google.com>
9347 * i386.cc (Target_i386::Got_type): New enum declaration.
9348 (Target_i386::Scan::local): Updated callers of Output_data_got
9350 (Target_i386::Scan::global): Likewise.
9351 (Target_i386::Relocate::relocate): Likewise.
9352 (Target_i386::Relocate::relocate_tls): Likewise.
9353 * object.h (Got_offset_list): New class.
9354 (Sized_relobj::local_has_got_offset): Added got_type parameter.
9355 (Sized_relobj::local_got_offset): Likewise.
9356 (Sized_relobj::set_local_got_offset): Likewise.
9357 (Sized_relobj::local_has_tls_got_offset): Removed.
9358 (Sized_relobj::local_tls_got_offset): Removed.
9359 (Sized_relobj::set_local_tls_got_offset): Removed.
9360 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
9361 * output.cc (Output_data_got::add_global): Added got_type parameter.
9362 (Output_data_got::add_global_with_rel): Likewise.
9363 (Output_data_got::add_global_with_rela): Likewise.
9364 (Output_data_got::add_global_pair_with_rel): New function.
9365 (Output_data_got::add_global_pair_with_rela): New function.
9366 (Output_data_got::add_local): Added got_type parameter.
9367 (Output_data_got::add_local_with_rel): Likewise.
9368 (Output_data_got::add_local_with_rela): Likewise.
9369 (Output_data_got::add_local_pair_with_rel): New function.
9370 (Output_data_got::add_local_pair_with_rela): New function.
9371 (Output_data_got::add_global_tls): Removed.
9372 (Output_data_got::add_global_tls_with_rel): Removed.
9373 (Output_data_got::add_global_tls_with_rela): Removed.
9374 (Output_data_got::add_local_tls): Removed.
9375 (Output_data_got::add_local_tls_with_rel): Removed.
9376 (Output_data_got::add_local_tls_with_rela): Removed.
9377 * output.h (Output_data_got::add_global): Added got_type parameter.
9378 (Output_data_got::add_global_with_rel): Likewise.
9379 (Output_data_got::add_global_with_rela): Likewise.
9380 (Output_data_got::add_global_pair_with_rel): New function.
9381 (Output_data_got::add_global_pair_with_rela): New function.
9382 (Output_data_got::add_local): Added got_type parameter.
9383 (Output_data_got::add_local_with_rel): Likewise.
9384 (Output_data_got::add_local_with_rela): Likewise.
9385 (Output_data_got::add_local_pair_with_rel): New function.
9386 (Output_data_got::add_local_pair_with_rela): New function.
9387 (Output_data_got::add_global_tls): Removed.
9388 (Output_data_got::add_global_tls_with_rel): Removed.
9389 (Output_data_got::add_global_tls_with_rela): Removed.
9390 (Output_data_got::add_local_tls): Removed.
9391 (Output_data_got::add_local_tls_with_rel): Removed.
9392 (Output_data_got::add_local_tls_with_rela): Removed.
9393 * resolve.cc (Symbol::override_base_with_special): Removed
9394 reference to has_got_offset_ field.
9395 * symtab.cc (Symbol::init_fields): Replaced initialization
9396 of got_offset_ with got_offsets_. Removed initialization
9398 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
9399 (Symbol::got_offset): Likewise.
9400 (Symbol::set_got_offset): Likewise.
9401 (Symbol::has_tls_got_offset): Removed.
9402 (Symbol::tls_got_offset): Removed.
9403 (Symbol::set_tls_got_offset): Removed.
9404 (Symbol::got_offset_): Removed.
9405 (Symbol::tls_mod_got_offset_): Removed.
9406 (Symbol::tls_pair_got_offset_): Removed.
9407 (Symbol::got_offsets_): New field.
9408 (Symbol::has_got_offset): Removed.
9409 (Symbol::has_tls_mod_got_offset): Removed.
9410 (Symbol::has_tls_pair_got_offset): Removed.
9411 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
9412 (Target_x86_64::Scan::local): Updated callers of Output_data_got
9414 (Target_x86_64::Scan::global): Likewise.
9415 (Target_x86_64::Relocate::relocate): Likewise.
9416 (Target_x86_64::Relocate::relocate_tls): Likewise.
9418 2008-03-25 Ben Elliston <bje@au.ibm.com>
9420 * yyscript.y: Fix spelling error in comment.
9422 2008-03-24 Ian Lance Taylor <iant@google.com>
9424 * options.h (class General_options): Define build_id option.
9425 * layout.h (class Layout): Declare write_build_id, create_note,
9426 create_build_id. Add build_id_note_ member.
9427 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
9428 "libiberty.h", "md5.h", "sha1.h".
9429 (Layout::Layout): Initialize eh_frame_data_,
9430 eh_frame_hdr_section_, and build_id_note_.
9431 (Layout::finalize): Call create_build_id.
9432 (Layout::create_note): New function, broken out of
9433 Layout::create_gold_note.
9434 (Layout::create_gold_note): Call create_note.
9435 (Layout::create_build_id): New function.
9436 (Layout::write_build_id): New function.
9437 (Close_task_runner::run): Call write_build_id.
9439 * x86_64.cc: Correct license to GPLv3.
9441 2008-03-23 Ian Lance Taylor <iant@google.com>
9443 * options.cc: Include "demangle.h".
9444 (parse_optional_string): New function.
9445 (parse_long_option): Handle takes_optional_argument.
9446 (parse_short_option): Update dash_z initializer. Handle
9447 takes_optional_argument.
9448 (General_options::General_options): Initialize do_demangle_.
9449 (General_options::finalize): Set do_demangle_. Handle demangling
9451 * options.h (parse_optional_string): Declare.
9452 (struct One_option): Add optional_arg field. Update constructor.
9453 Update call constructor calls. Add takes_optional_argument
9455 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
9456 (DEFINE_optional_string): Define.
9457 (General_options::demangle): Change from DEFINE_bool to
9458 DEFINE_optional_string.
9459 (General_options::no_demangle): New function.
9460 (General_options::do_demangle): New function.
9461 (General_options::set_do_demangle): New function.
9462 (General_options::execstack_status_): Move definition to end of
9464 (General_options::static_): Likewise.
9465 (General_options::do_demangle_): New field.
9466 * object.cc (big_endian>::get_symbol_location_info): Call
9467 Options::do_demangle, not Options::demangle.
9468 * symtab.cc (demangle): Likewise.
9470 2008-03-22 Ian Lance Taylor <iant@google.com>
9472 * gold.h: Include <cstddef> and <sys/types.h>
9473 * options.h: Include <cstring>.
9475 2008-03-21 Ian Lance Taylor <iant@google.com>
9477 * Added source code to GNU binutils.