1 2010-11-08 Doug Kwan <dougkwan@google.com>
2 Cary Coutant <ccoutant@google.com>
4 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5 (Arm_exidx_merge_section::section_contents_): New data member.
6 (Arm_input_section::Arm_input_section): Initialize original_contents_.
7 (Arm_input_section::~Arm_input_section): De-allocate memory.
8 (Arm_input_section::original_contents_): New data member.
9 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
10 in parameters instead of calling Object::section_contents without
12 (Arm_output_section::group_section): New parameter TASK. Pass it
13 to callees that need locking objects.
14 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
15 to lock EXIDX input sections. Fix a formatting issue. Call
16 Arm_exidx_merged_section::build_contents to create merged section
18 (Arm_output_section::create_stub_group): New parameter TASK. Use it
19 to lock object of stub table owner.
20 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
21 TEXT_SIZE to initialize data member TEXT_SIZE_.
22 (Arm_exidx_input_section::addralign): Fix typo in comment.
23 (Arm_exidx_input_section::text_size): New method.
24 (Target_arm::do_relax): New parameter TASK. Pass it to callees
25 that require locking objects. Lock objects before scanning for stubs
26 and updating local symbols.
27 (Arm_input_section<big_endian>::init): Copy contents of original
29 (Arm_input_section<big_endian>::do_write): Use saved contents of
30 original input section instead of calling Object::section_contents
32 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
33 size without calling Object::section_size().
34 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
35 for size. Allocate a buffer for merged EXIDX entries.
36 (Arm_exidx_merged_section::build_contents): New method.
37 (Arm_exidx_merged_section::do_write): Move merge section contents
38 building code to Arm_exidx_merged_section::build_contetns. Write
39 out contetns in buffer instead of building it on the fly.
40 (Arm_relobj::make_exidx_input_section): Also pass text section size
41 to Arm_exidx_input_section constructor.
42 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
43 (Arm_dynobj::do_read_symbols): Fix memory leak.
44 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
45 * target.h: (class Task): Add forward declaration.
46 (Target::relax): Add new parameter TASK and pass it to
48 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
50 2010-11-05 Cary Coutant <ccoutant@google.com>
53 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
54 object when reading from the file.
55 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
57 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
58 when reading section contents.
59 (get_section_contents): Likewise.
60 (icf::find_identical_sections): Likewise.
61 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
62 object when reading from the file.
63 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
64 the object when doing deferred section layout.
66 2010-11-03 Nick Clifton <nickc@redhat.com>
69 * script.h (class Symbol_assignment: name): New member. Returns
70 the name of the symbol.
71 * scrfipt.cc (Script_options::is_pending_assignment): New member.
72 Returns true if the given symbol name is on the list of
73 assignments wating to be processed.
74 * archive.cc (should_incldue_member): If the symbol is undefined,
75 check to see if it is on the list of symbols pending assignment.
77 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
79 * script-sections.cc (Script_sections::find_memory_region): Check
80 for a NULL output section pointer.
82 2010-10-29 Doug Kwan <dougkwan@google.com>
84 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
85 Output_section::add_relaxed_input_section.
86 * output.cc (Output_section::add_relaxed_input_section): Add new
87 arguments LAYOUT and NAME. Set section order index.
88 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
89 Copy section order index.
90 * output.h (Output_section::add_relaxed_input_section): Add new
91 arguments LAYOUT and NAME.
93 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
95 * testsuite/Makefile.am: Move gcctestdir/ld rule to
96 NATIVE_OR_CROSS_LINKER.
97 * testsuite/Makefile.in: Regenerate.
99 2010-10-20 Doug Kwan <dougkwan@google.com>
101 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
102 without SHF_LINK_ORDER flags.
103 * layout.cc (Layout::choose_output_section): Do not filter
104 SHF_LINK_ORDER flag in a relocatable link.
106 2010-10-17 Cary Coutant <ccoutant@google.com>
108 * output.h (Output_segment::set_section_addresses): Change function
109 signature. Update all callers.
110 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
112 (Output_segment::set_section_addresses): Align after last TLS
113 section. Add padding before last relro section instead of after.
115 2010-10-17 Doug Kwan <dougkwan@google.com>
117 * gold/arm.cc (Target_arm::got_section): Use correct order and set
118 GOT output section to be writable.
120 2010-10-14 Cary Coutant <ccoutant@google.com>
122 * debug.h (DEBUG_INCREMENTAL): New flag.
123 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
124 * gold.cc (queue_initial_tasks): Check parameters for incremental link
126 * incremental.cc (report_command_line): Ignore all forms of
128 * layout.cc (Layout::Layout): Check parameters for incremental link
130 * options.cc (General_options::parse_incremental): New function.
131 (General_options::parse_no_incremental): New function.
132 (General_options::parse_incremental_full): New function.
133 (General_options::parse_incremental_update): New function.
134 (General_options::incremental_mode_): New data member.
135 (General_options::finalize): Check incremental_mode_.
136 * options.h (General_options): Update help text for --incremental.
137 Add --no-incremental, --incremental-full, --incremental-update.
138 (General_options::Incremental_mode): New enum type.
139 (General_options::incremental_mode): New function.
140 (General_options::incremental_mode_): New data member.
141 * parameters.cc (Parameters::incremental_mode_): New data member.
142 (Parameters::set_options): Set incremental_mode_.
143 (Parameters::set_incremental_full): New function.
144 (Parameters::incremental): New function.
145 (Parameters::incremental_update): New function.
146 (set_parameters_incremental_full): New function.
147 * parameters.h (Parameters::set_incremental_full): New function.
148 (Parameters::incremental): New function.
149 (Parameters::incremental_update): New function.
150 (Parameters::incremental_mode_): New data member.
151 (set_parameters_incremental_full): New function.
152 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
153 incremental link mode.
154 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
155 (Sized_relobj::do_relocate_sections): Likewise.
156 * testsuite/Makefile.am (incremental_test): Use --incremental-full
158 * testsuite/Makefile.in: Regenerate.
159 * testsuite/incremental_test.sh: Filter all forms of --incremental.
161 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
163 * script-sections.h (class Script_sections): Make
164 Sections_elements typedef public.
165 * script-sections.cc (class Sort_output_sections): Add elements_
166 field. Add constructor which sets it; change all callers.
167 (Sort_output_sections::is_before): New function.
168 (Sort_output_sections::operator()): Call is_before.
169 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
171 * testsuite/script_test_10.sh: New test. Test script section
173 * testsuite/script_test_10.t: Likewise.
174 * testsuite/script_test_10.s: Likewise.
175 * testsuite/Makefile.am: Wrap the cross linker tests and the
176 common tests into NATIVE_OR_CROSS_LINKER.
177 (check_SCRIPTS): Add script_test_10.sh.
178 (check_DATA): Add script_test_10.stdout.
179 (script_test_10.o, script_test_10): New targets.
180 (script_test_10.stdout): New target.
181 * configure, testsuite/Makefile.in: Regenerate.
183 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
185 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
186 error for the deprecated relocations.
187 (Target_arm::Scan::global): Likewise.
188 (Target_arm::Relocate::relocate): Likewise.
190 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
192 * fileread.cc (Input_file::find_file): Initialize *found_name
193 and *namep when using the fallback search for case 4.
195 2010-10-11 Cary Coutant <ccoutant@google.com>
197 * options.h (class General_options): Redefine -z lazy as an alias for
198 the negation of -z now.
200 2010-10-11 Ian Lance Taylor <iant@google.com>
202 * resolve.cc (symbol_to_bits): Report the value of the unsupported
205 2010-10-06 Nick Clifton <nickc@redhat.com>
207 * script-sections.cc(class Memory_region): Remove
208 current_lma_offset_ field. Rename current_vma_offset_ to
209 current_offset_. Add last_section_ field.
210 (Memory_region::get_current_vma_address): Rename to
212 (Memory_region::get_current_lma_address): Delete.
213 (Memory_region::increment_vma_offset): Rename to
215 (Memory_region::increment_lma_offset): Delete.
216 (Memory_region::attributes_compatible): New method. Returns
217 true if the provided section is compatible with the region.
218 (Memory_region::get_last_section): New method. Returns the last
219 section to use the region.
220 (Memory_region::set_last_section): New method. Stores the last
221 section to use the region.
222 (Script_sections::block_in_region): New method. Returns true if
223 a block of memory is contained within a region.
224 (Script_sections::find_memory_region): New method. Locates a
225 memory region to be used to set a VMA or LMA address.
226 (Output_section_definition::set_section_addresses): Add code to
227 check for addresses set by memory regions.
228 (Output_segment::set_section_addresses): Remove memory region
230 (Script_sections::create_segment): Add a warning if a header
231 segment is created outside of any region.
232 * script-sections.h (class Script_sections): Add prototypes for
233 find_memory_region and block_in_region methods.
234 * testsuite/memory_test.s: Use .long instead of .word.
235 * testsuite/memory_test.t: Add some more output sections.
236 * testsuite/memory_test.sh: Update expected output.
238 2010-10-02 Doug Kwan <dougkwan@google.com>
240 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
241 defintion to symtab.h
242 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
243 declaration to defintion.
245 2010-10-01 Nick Clifton <nickc@redhat.com>
247 * expression.cc (eval): Replace dummy argument with NULL.
248 (eval_maybe_dot): Check for a NULL result section pointer.
249 (Symbol_expression::value): Likewise.
250 (Dot_expression::value): Likewise.
251 (BINARY_EXPRESSION): Likewise.
252 (Max_expression::value): Likewise.
253 (Min_expression::value): Likewise.
254 (Absolute_expression::value): Likewise.
255 (Addr_expression::value_from_output_section): Likewise.
256 (Loaddddr_expression::value_from_output_section): Likewise.
257 (Segment_start_expression::value): Likewise.
259 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
261 (Sections_elememt_dot_assignment::set_section_addresses):
263 (Output_data_expression::do_write_to_buffer): Likewise.
264 (Output_section_definition::finalize_symbols): Likewise.
265 (Output_section_definition::set_section_addresses): Likewise.
267 2010-09-30 Doug Kwan <dougkwan@google.com>
269 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
271 2010-09-28 Sriraman Tallam <tmsriram@google.com>
273 * target.h (Target::can_icf_inline_merge_sections): New virtual
275 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
277 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
279 * icf.cc (get_section_contents): Inline merge sections only when
282 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
284 * configure: Regenerate.
286 2010-09-17 Ian Lance Taylor <iant@google.com>
288 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
289 * testsuite/Makefile.am (memory_test.o): New target.
290 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
292 * testsuite/Makefile.in: Rebuild.
294 2010-09-17 Doug Kwan <dougkwan@google.com>
296 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
297 defintion if relocation uses GOT entries of the symbol.
298 * testsuite/icf_safe_test.sh: Fix test.
299 * testsuite/icf_safe_so_test.sh: Fix test.
301 2010-09-16 Cary Coutant <ccoutant@google.com>
303 * script_sections.cc (class Memory_region): Remove "NULL" from
304 vector initializations.
306 2010-09-15 Cary Coutant <ccoutant@google.com>
308 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
309 Resolve forwarding symbols.
311 2010-09-15 Doug Kwan <dougkwan@google.com>
313 * gold/testsuite/script_test_3.t: Add ARM special sections.
314 * gold/testsuite/script_test_4.t: Same.
315 * gold/testsuite/script_test_5.t: Same.
316 * gold/testsuite/script_test_6.t: Same.
317 * gold/testsuite/script_test_7.t: Same.
318 * gold/testsuite/script_test_7.t: Same.
319 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
321 2010-09-14 Cary Coutant <ccoutant@google.com>
323 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
324 (Target_x86_64::Relocate::relocate_tls): Replace check for
325 saw_tls_block_reloc_ with test for executable section.
327 2010-09-12 Cary Coutant <ccoutant@google.com>
329 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
330 position-independent executables to shared libraries need dynamic
332 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
333 position-independent executables.
334 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
335 * testsuite/Makefile.in: Regenerate.
337 2010-09-10 Nick Clifton <nickc@redhat.com>
340 * testsuite/memory_test.t: Discard any sections that are not
343 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
346 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
347 "This::" to work around a bug in gcc 4.2.
349 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
351 2010-09-09 Rafael Espindola <espindola@google.com>
353 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
354 sections with different PF_X flags in the same segment.
355 (Layout::find_first_load_seg): Search all segments to find the first
357 * options.h (rosegment): New.
359 2010-09-08 Rafael Espindola <espindola@google.com>
361 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
363 2010-09-08 Doug Kwan <dougkwan@google.com>
365 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
366 (Arm_relobj::do_relocate_sections): Add new parameter for output
367 file to match the parent.
368 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
369 of local symbols instead of input values. Update code to track
370 changes in gold::relocate_section.
371 * object.cc (Sized_relobj::compute_final_local_value): New methods.
372 (Sized_relobj::compute_final_local_value_internal): New methods.
373 (Sized_relobj::do_finalize_local_symbols): Move code from loop
374 body into private version of Sized_relobj::compute_final_local_value.
375 Call the inline method.
376 * object.h (Symbol_value::Symbol_value): Define destructor. Free
377 merged symbol value if there is one.
378 (Symbol_value::has_output_value): New method defintiion.
379 (Sized_relobj::Compute_final_local_value_status): New enum type.
380 (Sized_relobj::compute_final_local_value): New methods.
381 (Sized_relobj::compute_final_local_value_internal): New methods.
382 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
383 and arm_cortex_a8.sh.
384 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
385 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
387 * Makefile.in: Regenerate.
388 * testsuite/arm_bl_out_of_range.s: Update test.
389 * testsuite/thumb_bl_out_of_range.s: Ditto.
390 * testsuite/thumb_blx_out_of_range.s: Ditto.
391 * testsuite/arm_branch_out_of_range.sh: New file.
392 * testsuite/arm_cortex_a8.sh: Ditto.
393 * testsuite/arm_cortex_a8_b.s: Ditto.
394 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
395 * testsuite/arm_cortex_a8_b_local.s: Ditto.
396 * testsuite/arm_cortex_a8_bl.s: Ditto.
397 * testsuite/arm_cortex_a8_blx.s: Ditto.
398 * testsuite/arm_cortex_a8_local.s: Ditto.
399 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
400 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
402 2010-09-08 Rafael Espindola <espindola@google.com>
404 * Makefile.am (memory_test.stdout): Run readelf with -W.
405 * Makefile.in: Regenerate.
406 * testsuite/memory_test.sh: Make the regexps accept both 32 and
409 2010-09-08 Rafael Espindola <espindola@google.com>
411 * script-sections.cc (Script_sections::add_memory_region): Convert
412 field precision to int.
413 * script.cc (script_set_section_region, script_set_section_region):
414 Convert field precision to int.
416 2010-09-08 Rafael Espindola <espindola@google.com>
418 * arm.cc (do_finalize_sections): Create the __exidx_start and
419 __exdix_end symbols even when the section is missing.
421 2010-09-08 Nick Clifton <nickc@redhat.com>
423 * README: Remove claim that MEMORY is not supported.
424 * expression.cc (script_exp_function_origin)
425 (script_exp_function_length): Move from here to ...
426 * script.cc: ... here.
427 (script_set_section_region, script_add_memory)
428 (script_parse_memory_attr, script_include_directive): New
431 (class Memory_region): New class.
432 (class Output_section_definition): Add set_memory_region,
433 set_section_vma, set_section_lma and get_section_name methods.
434 (class Script_Sections): Add add_memory_region,
435 find_memory_region, find_memory_region_origin,
436 find_memory_region_length and set_memory_region methods.
437 Have set_section_addresses method walk the list of set memory
439 Extend the print methos to display memory regions.
440 * script-sections.h: Add prototypes for new methods.
441 Add enum for MEMORY region attributes.
442 * yyscript.y: Add support for parsing MEMORY regions.
443 * script-c.h: Add prototypes for new functions.
444 * testsuite/Makefile.am: Add test of MEMORY region functionality.
445 * testsuite/Makefile.in: Regenerate.
446 * testsuite/memory_test.sh: New script.
447 * testsuite/memory_test.s: New assembler source file.
448 * testsuite/memory_test.t: New linker script.
450 2010-08-27 Doug Kwan <dougkwan@google.com>
452 * gold/resolve.cc (Symbol_table::should_override): Let a weak
453 reference override an existing dynamic weak reference.
454 * testsuite/Makefile.am: Add new test dyn_weak_ref.
455 * testsuite/Makefile.in: Regenerate.
456 * testsuite/dyn_weak_ref.sh: New file.
457 * testsuite/dyn_weak_ref_1.c: Ditto.
458 * testsuite/dyn_weak_ref_2.c: Ditto.
460 2010-08-27 Ian Lance Taylor <iant@google.com>
462 * incremental.h (class Incremental_input_entry): Add virtual
465 2010-08-27 Ian Lance Taylor <iant@google.com>
467 * testsuite/start_lib_test_3.c: Mark t3 as used.
469 2010-08-27 Nick Clifton <nickc@redhat.com>
471 * options.cc (version_script): Fix small typo in previous
474 2010-08-25 Nick Clifton <nickc@redhat.com>
476 * archive.cc: Formatting fixes: Remove whitespace between
477 typename and following asterisk. Remove whitespace between
478 function name and opening parenthesis.
479 * archive.h: Likewise.
481 * attributes.cc: Likewise.
482 * attributes.h: Likewise.
483 * common.cc: Likewise.
484 * copy-relocs.cc: Likewise.
485 * dirsearch.h: Likewise.
486 * dynobj.cc: Likewise.
487 * ehframe.cc: Likewise.
488 * ehframe.h: Likewise.
489 * expression.cc: Likewise.
490 * fileread.cc: Likewise.
491 * fileread.h: Likewise.
493 * gold-threads.cc: Likewise.
497 * incremental-dump.cc: Likewise.
498 * incremental.cc: Likewise.
499 * layout.cc: Likewise.
500 * layout.h: Likewise.
502 * merge.cc: Likewise.
504 * object.cc: Likewise.
505 * object.h: Likewise.
506 * options.cc: Likewise.
507 * options.h: Likewise.
508 * output.cc: Likewise.
509 * output.h: Likewise.
510 * plugin.cc: Likewise.
511 * plugin.h: Likewise.
512 * powerpc.cc: Likewise.
513 * reloc.cc: Likewise.
514 * script-c.h: Likewise.
515 * script-sections.cc: Likewise.
516 * script.cc: Likewise.
517 * stringpool.cc: Likewise.
518 * symtab.cc: Likewise.
519 * symtab.h: Likewise.
520 * target.cc: Likewise.
521 * timer.cc: Likewise.
523 * version.cc: Likewise.
524 * x86_64.cc: Likewise.
526 2010-08-24 Nick Clifton <nickc@redhat.com>
529 * layout.cc (segment_precedes): Sort segments by their physical
530 addresses, if they have been set.
532 2010-08-23 Cary Coutant <ccoutant@google.com>
534 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
536 (Lib_group::include_member): Unlock object after deleting its
538 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
541 2010-08-19 Neil Vachharajani <nvachhar@google.com>
542 Cary Coutant <ccoutant@google.com>
544 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
545 constructor, and set_blocker.
546 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
548 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
549 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
550 * testsuite/Makefile.am (start_lib_test): New test case.
551 * testsuite/Makefile.in: Regenerate.
552 * testsuite/start_lib_test_main.c: New file.
553 * testsuite/start_lib_test_1.c: New file.
554 * testsuite/start_lib_test_2.c: New file.
555 * testsuite/start_lib_test_3.c: New file.
557 2010-08-19 Ian Lance Taylor <iant@google.com>
559 * Makefile.in: Rebuild with automake 1.11.1.
560 * aclocal.m4: Likewise.
561 * testsuite/Makefile.in: Likewise.
563 2010-08-19 Ian Lance Taylor <iant@google.com>
566 * i386.cc (class Output_data_plt_i386): Update declarations.
567 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
568 local_ifuncs_ fields.
569 (Target_i386::do_plt_section_for_global): New function.
570 (Target_i386::do_plt_section_for_local): New function.
571 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
572 parameter; change all callers. Initialize global_ifuncs_ and
573 local_ifuncs_. If doing a static link define __rel_iplt_start and
575 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
576 (Output_data_plt_i386::add_local_ifunc_entry): New function.
577 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
579 (Target_i386::make_plt_section): New function, broken out of
580 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
581 (Target_i386::make_plt_entry): Call make_plt_section.
582 (Target_i386::make_local_ifunc_plt_entry): New function.
583 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
584 (Target_i386::Scan::local): Handle IFUNC symbols. Add
585 R_386_IRELATIVE to switch.
586 (Target_i386::Scan::global): Likewise.
587 (Target_i386::Relocate::relocate): Likewise.
588 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
590 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
591 (Target_x86_64::do_plt_section_for_global): New function.
592 (Target_x86_64::do_plt_section_for_local): New function.
593 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
594 parameter; change all callers. If doing a static link define
595 __rela_iplt_start and __rela_iplt_end.
596 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
597 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
598 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
600 (Target_x86_64::make_local_ifunc_plt_entry): New function.
601 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
603 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
604 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
605 R_X86_64_IRELATIVE to switch.
606 (Target_x86_64::Scan::global): Likewise.
607 (Target_x86_64::Relocate::relocate): Likewise.
608 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
610 * target.h (class Target): Add plt_section_for_global and
611 plt_section_for_local functions. Add do_plt_section_for_global
612 and do_plt_section_for_local virtual functions.
613 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
615 (Symbol::use_plt_offset): Handle IFUNC symbol.
616 * object.cc (Sized_relobj::Sized_relobj): Initialize
618 (Sized_relobj::local_has_plt_offset): New function.
619 (Sized_relobj::local_plt_offset): New function.
620 (Sized_relobj::set_local_plt_offset): New function.
621 (Sized_relobj::do_count): Handle IFUNC symbol.
622 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
623 a bit away from input_shndx_ field. Add set_is_func_symbol and
624 is_ifunc_symbol functions.
625 (class Sized_relobj): Update declarations. Remove Tls_got_entry
626 and Local_tls_got_offsets. Define Local_plt_offsets. Add
627 local_plt_offsets_ field.
628 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
629 * output.h (class Output_section_data): Add non-const
630 output_section function.
631 (class Output_data_got): Update declarations.
632 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
633 Add use_plt_offset parameter to global and local constructors.
634 Change all callers. Change local_sym_index_ field to 31 bits.
635 Change GSYM_CODE and CONSTANT_CODE accordingly.
636 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
637 doing a static link don't set sh_link field.
638 (Output_data_got::Got_entry::write): Use PLT offset if
640 (Output_data_got::add_global_plt): New function.
641 (Output_data_got::add_local_plt): New function.
642 * target-reloc.h (relocate_section): Handle IFUNC symbol.
643 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
644 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
645 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
646 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
648 * testsuite/ifunc-sel.h: New file.
649 * testsuite/ifuncmain1.c: New file.
650 * testsuite/ifuncmain1vis.c: New file.
651 * testsuite/ifuncmod1.c: New file.
652 * testsuite/ifuncdep2.c: New file.
653 * testsuite/ifuncmain2.c: New file.
654 * testsuite/ifuncmain3.c: New file.
655 * testsuite/ifuncmod3.c: New file.
656 * testsuite/ifuncmain4.c: New file.
657 * testsuite/ifuncmain5.c: New file.
658 * testsuite/ifuncmod5.c: New file.
659 * testsuite/ifuncmain6pie.c: New file.
660 * testsuite/ifuncmod6.c: New file.
661 * testsuite/ifuncmain7.c: New file.
662 * configure, testsuite/Makefile.in: Rebuild.
664 2010-08-18 Ian Lance Taylor <iant@google.com>
667 (Output_section_incremental_inputs::write_input_files): Add cast
668 to avoid signed/unsigned comparison warning.
669 (Output_section_incremental_inputs::write_info_blocks): Likewise.
671 2010-08-12 Cary Coutant <ccoutant@google.com>
673 * common.cc (Sort_commons::operator()): Remove unnecessary code.
675 2010-08-13 Ian Lance Taylor <iant@google.com>
677 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
679 2010-08-12 Cary Coutant <ccoutant@google.com>
680 Doug Kwan <dougkwan@google.com>
682 * resolve.cc (Symbol_table::should_override): When a weak dynamic
683 defintion overrides non-weak undef, remember that the original undef
685 * symtab.cc (Symbol_table::sized_write_global): For undef without
686 an original weak binding, set binding to global in output.
687 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
688 * testsuite/Makefile.in: Regenerate.
689 * testsuite/strong_ref_weak_def.sh: New file.
690 * testsuite/strong_ref_weak_def_1.c: Ditto.
691 * testsuite/strong_ref_weak_def_2.c: Ditto.
693 2010-08-12 Cary Coutant <ccoutant@google.com>
695 * testsuite/incremental_test.sh: Rewrite.
696 * testsuite/incremental_test_1.c: Rewrite.
697 * testsuite/incremental_test_2.c: Rewrite.
699 2010-08-12 Cary Coutant <ccoutant@google.com>
701 * arm.cc (Target_arm::got_size): Add const.
702 (Target_arm::got_entry_count): New function.
703 (Target_arm::plt_entry_count): New function.
704 (Target_arm::first_plt_entry_offset): New function.
705 (Target_arm::plt_entry_size): New function.
706 (Output_data_plt_arm::entry_count): New function.
707 (Output_data_plt_arm::first_plt_entry_offset): New function.
708 (Output_data_plt_arm::get_plt_entry_size): New function.
709 * i386.cc (Target_i386::got_size): Add const.
710 (Target_i386::got_entry_count): New function.
711 (Target_i386::plt_entry_count): New function.
712 (Target_i386::first_plt_entry_offset): New function.
713 (Target_i386::plt_entry_size): New function.
714 (Output_data_plt_i386::entry_count): New function.
715 (Output_data_plt_i386::first_plt_entry_offset): New function.
716 (Output_data_plt_i386::get_plt_entry_size): New function.
717 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
718 find_incremental_inputs_sections. Dump incremental_got_plt section.
719 * incremental.cc: Include target.h.
720 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
721 parameter. Adjust all callers. Find incremental_got_plt section.
722 (Incremental_inputs::create_data_sections): Create incremental_got_plt
724 (Output_section_incremental_inputs::set_final_data_size): Calculate
725 size of incremental_got_plt section.
726 (Output_section_incremental_inputs::do_write): Write the
727 incremental_got_plt section.
728 (Got_plt_view_info): New struct.
729 (Local_got_offset_visitor): New class.
730 (Global_got_offset_visitor): New class.
731 (Global_symbol_visitor_got_plt): New class.
732 (Output_section_incremental_inputs::write_got_plt): New function.
733 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
734 Add parameter. Adjust all callers.
735 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
736 (Incremental_inputs::got_plt_section): New function.
737 (Incremental_inputs::got_plt_section_): New data member.
738 (Incremental_got_plt_reader): New class.
739 * layout.cc (Layout::create_incremental_info_sections): Add the
740 incremental_got_plt section.
741 * object.h (Got_offset_list::get_list): New function.
742 (Got offset_list::for_all_got_offsets): New function.
743 (Sized_relobj::local_got_offset_list): New function.
744 * powerpc.cc (Target_powerpc::got_size): Add const.
745 (Target_powerpc::got_entry_count): New function.
746 (Target_powerpc::plt_entry_count): New function.
747 (Target_powerpc::first_plt_entry_offset): New function.
748 (Target_powerpc::plt_entry_size): New function.
749 (Output_data_plt_powerpc::entry_count): New function.
750 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
751 (Output_data_plt_powerpc::get_plt_entry_size): New function.
752 * sparc.cc (Target_sparc::got_size): Add const.
753 (Target_sparc::got_entry_count): New function.
754 (Target_sparc::plt_entry_count): New function.
755 (Target_sparc::first_plt_entry_offset): New function.
756 (Target_sparc::plt_entry_size): New function.
757 (Output_data_plt_sparc::entry_count): New function.
758 (Output_data_plt_sparc::first_plt_entry_offset): New function.
759 (Output_data_plt_sparc::get_plt_entry_size): New function.
760 * symtab.h (Symbol::got_offset_list): New function.
761 (Symbol_table::for_all_symbols): New function.
762 * target.h (Sized_target::got_entry_count): New function.
763 (Sized_target::plt_entry_count): New function.
764 (Sized_target::plt_entry_size): New function.
765 * x86_64.cc (Target_x86_64::got_size): Add const.
766 (Target_x86_64::got_entry_count): New function.
767 (Target_x86_64::plt_entry_count): New function.
768 (Target_x86_64::first_plt_entry_offset): New function.
769 (Target_x86_64::plt_entry_size): New function.
770 (Output_data_plt_x86_64::entry_count): New function.
771 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
772 (Output_data_plt_x86_64::get_plt_entry_size): New function.
774 2010-08-12 Cary Coutant <ccoutant@google.com>
776 * archive.cc: Include incremental.h.
777 (Archive::Archive): Initialize incremental_info_.
778 (Archive::include_member): Record archive members in incremental info.
779 (Add_archive_symbols::run): Record begin and end of an archive in
781 (Lib_group::include_member): Record objects in incremental info.
782 * archive.h (Incremental_archive_entry): Forward declaration.
783 (Archive::set_incremental_info): New member function.
784 (Archive::incremental_info): New member function.
785 (Archive::Unused_symbol_iterator): New class.
786 (Archive::unused_symbols_begin): New member function.
787 (Archive::unused_symbols_end): New member function.
788 (Archive::incremental_info_): New data member.
789 * incremental-dump.cc (find_input_containing_global): New function.
790 (dump_incremental_inputs): Dump new incremental info sections.
791 * incremental.cc: Include symtab.h.
792 (Output_section_incremental_inputs): New class.
793 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
794 new incremental info sections.
795 (Sized_incremental_binary::do_check_inputs): Likewise.
796 (Incremental_inputs::report_archive): Remove.
797 (Incremental_inputs::report_archive_begin): New function.
798 (Incremental_inputs::report_archive_end): New function.
799 (Incremental_inputs::report_object): New function.
800 (Incremental_inputs::finalize_inputs): Remove.
801 (Incremental_inputs::report_input_section): New function.
802 (Incremental_inputs::report_script): Rewrite.
803 (Incremental_inputs::finalize): Do nothing but finalize string table.
804 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
805 (Incremental_inputs::sized_create_inputs_section_data): Remove.
806 (Incremental_inputs::create_data_sections): New function.
807 (Incremental_inputs::relocs_entsize): New function.
808 (Output_section_incremental_inputs::set_final_data_size): New function.
809 (Output_section_incremental_inputs::do_write): New function.
810 (Output_section_incremental_inputs::write_header): New function.
811 (Output_section_incremental_inputs::write_input_files): New function.
812 (Output_section_incremental_inputs::write_info_blocks): New function.
813 (Output_section_incremental_inputs::write_symtab): New function.
814 * incremental.h (Incremental_script_entry): Forward declaration.
815 (Incremental_object_entry): Forward declaration.
816 (Incremental_archive_entry): Forward declaration.
817 (Incremental_inputs): Forward declaration.
818 (Incremental_inputs_header_data): Remove.
819 (Incremental_inputs_header): Remove.
820 (Incremental_inputs_header_write): Remove.
821 (Incremental_inputs_entry_data): Remove.
822 (Incremental_inputs_entry): Remove.
823 (Incremental_inputs_entry_write): Remove.
824 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
825 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
826 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
827 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
829 (Incremental_input_entry): New class.
830 (Incremental_script_entry): New class.
831 (Incremental_object_entry): New class.
832 (Incremental_archive_entry): New class.
833 (Incremental_inputs::Incremental_inputs): Initialize new data members.
834 (Incremental_inputs::report_inputs): Remove.
835 (Incremental_inputs::report_archive): Remove.
836 (Incremental_inputs::report_archive_begin): New function.
837 (Incremental_inputs::report_archive_end): New function.
838 (Incremental_inputs::report_object): Change prototype.
839 (Incremental_inputs::report_input_section): New function.
840 (Incremental_inputs::report_script): Change prototype.
841 (Incremental_inputs::get_reloc_count): New function.
842 (Incremental_inputs::set_reloc_count): New function.
843 (Incremental_inputs::create_data_sections): New function.
844 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
845 (Incremental_inputs::inputs_section): New function.
846 (Incremental_inputs::symtab_section): New function.
847 (Incremental_inputs::relocs_section): New function.
848 (Incremental_inputs::get_stringpool): Add const.
849 (Incremental_inputs::command_line): Add const.
850 (Incremental_inputs::inputs): Remove.
851 (Incremental_inputs::command_line_key): New function.
852 (Incremental_inputs::input_file_count): New function.
853 (Incremental_inputs::input_files): New function.
854 (Incremental_inputs::relocs_entsize): New function.
855 (Incremental_inputs::sized_create_inputs_section_data): Remove.
856 (Incremental_inputs::finalize_inputs): Remove.
857 (Incremental_inputs::Input_info): Remove.
858 (Incremental_inputs::lock_): Remove.
859 (Incremental_inputs::inputs_): Change type.
860 (Incremental_inputs::inputs_map_): Remove.
861 (Incremental_inputs::current_object_entry_): New data member.
862 (Incremental_inputs::inputs_section_): New data member.
863 (Incremental_inputs::symtab_section_): New data member.
864 (Incremental_inputs::relocs_section_): New data member.
865 (Incremental_inputs::reloc_count_): New data member.
866 (Incremental_inputs_reader): New class.
867 (Incremental_symtab_reader): New class.
868 (Incremental_relocs_reader): New class.
869 * layout.cc (Layout::finalize): Move finalization of incremental info
870 and creation of incremental info sections to follow finalization of
871 symbol table. Set offsets for postprocessing sections.
872 (Layout::create_incremental_info_sections): Call
873 Incremental_inputs::create_data_sections. Add incremental symtab
874 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
875 sections to layout after input sections.
876 * layout.h (struct Timespec): Forward declaration.
877 (Layout::incremental_inputs): Add const.
878 (Layout::create_incremental_info_sections): Add parameter.
879 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
880 * object.cc: Include incremental.h.
881 (Relobj::finalize_incremental_relocs): New function.
882 (Sized_relobj::do_layout): Record input sections in incremental info.
883 * object.h (Object::output_section): New function.
884 (Object::output_section_offset): Moved from Relobj.
885 (Object::get_incremental_reloc_base): New function.
886 (Object::get_incremental_reloc_count): New function.
887 (Object::do_output_section): New function.
888 (Object::do_output_section_offset): Moved from Relobj.
889 (Object::do_get_incremental_reloc_base): New function.
890 (Object::do_get_incremental_reloc_count): New function.
891 (Object::Object): Initialize new data members.
892 (Relobj::output_section): Renamed do_output_section and moved to
894 (Relobj::output_section_offset): Moved to Object.
895 (Relobj::do_get_incremental_reloc_base): New function.
896 (Relobj::do_get_incremental_reloc_count): New function.
897 (Relobj::allocate_incremental_reloc_counts): New function.
898 (Relobj::count_incremental_reloc): New function.
899 (Relobj::finalize_incremental_relocs): New function.
900 (Relobj::next_incremental_reloc_index): New function.
901 (Relobj::reloc_counts_): New data member.
902 (Relobj::reloc_bases_): New data member.
903 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
904 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
905 (Sized_relobj::incremental_relocs_scan): New function.
906 (Sized_relobj::incremental_relocs_scan_reltype): New function.
907 (Sized_relobj::incremental_relocs_write): New function.
908 (Sized_relobj::incremental_relocs_write_reltype): New function.
909 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
911 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
912 archives and object files elsewhere.
913 (Add_symbols::run): Report object files here.
914 (Finish_group::run): Report end of archive at end of group.
915 * reloc.cc: Include layout.h, incremental.h.
916 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
917 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
918 (Sized_relobj::incremental_relocs_scan): New function.
919 (Sized_relobj::incremental_relocs_scan_reltype): New function.
920 (Sized_relobj::do_relocate_sections): Write incremental relocations.
921 (Sized_relobj::incremental_relocs_write): New function.
922 (Sized_relobj::incremental_relocs_write_reltype): New function.
923 * script.cc (read_input_script): Rewrite test for incremental link.
924 Change call to Incremental_inputs::report_script.
925 * symtab.h (Symbol_table::first_global_index): New function.
926 (Symbol_table::output_count): New function.
928 2010-08-12 Doug Kwan <dougkwan@google.com>
930 * arm.cc (Target_arm::merge_object_attributes): Check command line
931 options --no-wchar-size-warning and --no-enum-size-warning.
932 * options.h (General_options): Add ld-compatible options
933 --no-enum-size-warning and --no-wchar-size-warning.
935 2010-08-04 Ian Lance Taylor <iant@google.com>
937 * x86_64.cc (Target_x86_64::Scan::local): Use
938 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
939 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
940 (Target_x86_64::Scan::global): Likewise.
941 (Target_x86_64::Relocate::relocate): Likewise.
942 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
945 2010-08-03 Cary Coutant <ccoutant@google.com>
947 * merge.cc (Output_merge_string::do_add_input_section): Count strings
948 to reserve space in merged_strings vector. Keep total input size
950 (Output_merge_string::do_print_merge_stats): Print total input size.
951 * merge.h (Output_merge_string): Add input_size_ field.
952 * stringpool.cc (Stringpool_template::string_length): Move
953 implementations out of Stringpool_template class and place in
955 * stringpool.h (string_length): Move out of Stringpool_template.
957 2010-08-03 Ian Lance Taylor <iant@google.com>
960 * layout.cc (relaxation_loop_body): If address of load segment is
961 set, adjust address to include headers if possible.
963 2010-08-03 Ian Lance Taylor <iant@google.com>
965 * version.cc (version_string): Bump to 1.10.
967 2010-08-03 Ian Lance Taylor <iant@google.com>
970 * layout.h (enum Output_section_order): Define.
971 (class Layout): Update declarations.
972 * layout.cc (Layout::get_output_section): Add order parameter.
973 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
974 is_first_non_relro parameters. Change all callers.
975 (Layout::choose_output_section): Likewise.
976 (Layout::add_output_section_data): Likewise.
977 (Layout::make_output_section): Likewise. Set order.
978 (Layout::default_section_order): New function.
979 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
980 * output.cc (Output_section::Output_section): Initialize order_.
981 Don't initialize deleted fields.
982 (Output_segment::Output_segment): Don't initialize deleted
984 (Output_segment::add_output_section_to_load): New function
985 replacing add_output_section. Change all callers to call this or
986 add_output_section_to_nonload.
987 (Output_segment::add_output_section_to_nonload): New function.
988 (Output_segment::remove_output_section): Rewrite.
989 (Output_segment::add_initial_output_data): Likewise.
990 (Output_segment::has_any_data_sections): Likewise.
991 (Output_segment::is_first_section_relro): Likewise.
992 (Output_segment::maximum_alignment): Likewise.
993 (Output_segment::has_dynamic_reloc): New function replacing
994 dynamic_reloc_count. Change all callers.
995 (Output_segment::has_dynamic_reloc_list): New function replacing
996 dynamic_reloc_count_list. Change all callers.
997 (Output_segment::set_section_addresses): Rewrite.
998 (Output_segment::set_offset): Rewrite.
999 (Output_segment::find_first_and_last_list): Remove.
1000 (Output_segment::set_tls_offsets): Rewrite.
1001 (Output_segment::first_section_load_address): Likewise.
1002 (Output_segment::output_section_count): Likewise.
1003 (Output_segment::section_with_lowest_load_address): Likewise.
1004 (Output_segment::write_section_headers): Likewise.
1005 (Output_segment::print_sections_to_map): Likewise.
1006 * output.h (class Output_data): Remove dynamic_reloc_count_
1007 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
1008 (Output_data::add_dynamic_reloc): Rewrite.
1009 (Output_data::has_dynamic_reloc): New function.
1010 (Output_data::dynamic_reloc_count): Remove.
1011 (class Output_section): Add order_ field. Remvoe is_relro_local_,
1012 is_last_relro_, is_first_non_relro_, is_interp_,
1013 is_dynamic_linker_section_ fields. Add order and set_order
1014 functions. Remove is_relro_local, set_is_relro_local,
1015 is_last_relro, set_is_last_relro, is_first_non_relro,
1016 set_is_first_non_relro functions, is_interp, set_is_interp,
1017 is_dynamic_linker_section, and set_is_dynamic_linker_section
1019 (class Output_segment): Change Output_data_list from std::list to
1020 std:;vector. Add output_lists_ field. Remove output_data_ and
1021 output_bss_ fields. Update declarations.
1023 2010-08-02 Ian Lance Taylor <iant@google.com>
1025 * arm.cc (Target_arm::gc_process_relocs): Use typename.
1026 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
1027 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
1029 2010-08-02 Ian Lance Taylor <iant@google.com>
1032 * script.cc (Script_options::Script_options): Initialize
1033 symbol_definitions_ and symbol_references_.
1034 (Script_options::add_symbol_assignment): Update
1035 symbol_definitions_ and symbol_references_.
1036 (Script_options::add_symbol_reference): New function.
1037 (script_symbol): New function.
1038 * script.h (class Script_options): Add symbol_definitions_ and
1039 symbol_references_ fields.
1040 (Script_options::referenced_const_iterator): New type.
1041 (Script_options::referenced_begin): New function.
1042 (Script_options::referenced_end): New function.
1043 (Script_options::is_referenced): New function.
1044 (Script_options::any_unreferenced): New function.
1045 * script-c.h (script_symbol): Declare.
1046 * yyscript.y (exp): Call script_symbol.
1047 * symtab.cc: Include "script.h".
1048 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
1049 Change all callers. Check symbols referenced by scripts.
1050 (Symbol_table::add_undefined_symbols_from_command_line): Add
1051 layout parameter. Change all callers.
1052 (Symbol_table::do_add_undefined_symbols_from_command_line):
1053 Likewise. Break out loop body. Check symbols referenced by
1055 (Symbol_table::add_undefined_symbol_from_command_line): New
1056 function broken out of
1057 do_add_undefined_symbols_from_command_line.
1058 * symtab.h (class Symbol_table): Update declarations.
1059 * archive.cc: Include "layout.h".
1060 (Archive::should_include_member): Add layout parameter. Change
1061 all callers. Check for symbol mentioned in expression.
1062 * archive.h (class Archive): Update declaration.
1063 * object.cc (Sized_relobj::do_should_include_member): Add layout
1065 * object.h (Object::should_include_member): Add layout parameter.
1067 (Object::do_should_include_member): Add layout parameter.
1068 (class Sized_relobj): Update declaration.
1069 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
1071 * dynobj.h (class Sized_dynobj): Update declaration.
1072 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
1074 * plugin.h (class Sized_pluginobj): Update declaration.
1076 2010-08-02 Ian Lance Taylor <iant@google.com>
1079 * output.cc (Output_segment::set_offset): Search for the first and
1080 last sections rather than assuming that the list is in order.
1081 (Output_segment::find_first_and_last_list): New function.
1082 * output.h (class Output_segment): Update declarations.
1083 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
1084 (relro_strip_test_SOURCES): New variable.
1085 (relro_strip_test_DEPENDENCIES): New variable.
1086 (relro_strip_test_LDFLAGS): New variable.
1087 (relro_strip_test_LDADD): New variable.
1088 (relro_strip_test.so): New target.
1090 2010-08-02 Ian Lance Taylor <iant@google.com>
1092 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
1093 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
1094 (Target_i386::got_tlsdesc_section): New function.
1095 (Target_i386::got_section): Create space for GOT entries for
1096 TLSDESC relocations.
1097 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
1099 (Target_i386::Scan::global): Likewise.
1100 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
1102 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
1103 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
1104 (Target_x86_64::got_tlsdesc_section): New function.
1105 (Target_x86_64::got_section): Create space for GOT entries for
1106 TLSDESC relocations.
1107 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
1109 (Target_x86_64::Scan::global): Likewise.
1110 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
1113 2010-08-02 Ian Lance Taylor <iant@google.com>
1115 * testsuite/final_layout.sh: Use dc to convert from hex to
1118 2010-07-29 Sriraman Tallam <tmsriram@google.com>
1120 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
1121 paramter to the call to gold::gc_process_relocs.
1122 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
1123 paramter to the call to gold::gc_process_relocs.
1124 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
1125 parameter to the call to gold::gc_process_relocs.
1126 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
1127 template parameter to the call to gold::gc_process_relocs.
1128 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
1129 paramter to the call to gold::gc_process_relocs.
1130 * gc.h (get_embedded_addend_size): New function.
1131 (gc_process_relocs): Save the size of the reloc for use by ICF.
1132 * icf.cc (get_section_contents): Get the addend from the text section
1133 for SHT_REL relocation sections.
1134 * icf.h (Icf::Reloc_addend_size_info): New typedef.
1135 (Icf::Reloc_info): Add new member reloc_addend_size_info.
1136 * int_encoding.h (read_from_pointer): New overloaded function.
1137 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
1138 * testsuite/icf_sht_rel_addend_test.sh: New file.
1139 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
1140 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
1142 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1144 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
1145 * Makefile.in: Regenerate.
1146 * testsuite/Makefile.in: Regenerate.
1148 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
1150 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
1151 * gold/testsuite/debug_msg.cc: Likewise.
1152 * gold/testsuite/odr_violation1.cc
1153 * gold/testsuite/odr_violation2.cc
1155 2010-07-21 Cary Coutant <ccoutant@google.com>
1157 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
1158 string, and length fields.
1159 (Output_merge_string::Merged_strings_list): New type.
1160 (Output_merge_string::Merged_strings_lists): New typedef.
1161 (Output_merge_string): Replace merged_strings_ with
1162 merged_strings_lists_.
1163 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
1164 Merged_strings_list per input object and section. Don't store pointer
1165 to the string. Don't store length with each merged string entry.
1166 (Output_merge_string::finalize_merged_data): Loop over list of merged
1167 strings lists. Recompute length of each merged string.
1169 2010-07-15 Cary Coutant <ccoutant@google.com>
1171 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
1174 2010-07-14 Ian Lance Taylor <iant@google.com>
1176 * descriptors.cc (Descriptors::open): Report correct name in error
1179 2010-07-13 Doug Kwan <dougkwan@google.com>
1181 * arm.cc (Arm_input_section::Arm_input_section): For a
1182 SHT_ARM_EXIDX section, always keeps the input sections.
1183 (Arm_input_section::set_exidx_section_link): New method.
1184 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
1185 has_errors_ to false.
1186 (Arm_exidx_input_section::has_errors,
1187 Arm_exidx_input_section::set_has_errors): New methods.
1188 (Arm_exidx_input_section::has_errors_): New data member.
1189 (Arm_relobj::get_exidx_shndx_list): New method.
1190 (Arm_output_section::append_text_sections_to_list): Do not skip
1191 section without SHF_EXECINSTR.
1192 (Arm_output_section::fix_exidx_coverage): Skip input sections with
1194 (Arm_relobj::make_exidx_input_section): Add new parameter for text
1195 section header. Make error messages more verbose. Check for
1196 a non-executable section linked to an EXIDX section.
1197 (Arm_relobj::do_read_symbols): Remove error checking, which has been
1198 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
1199 check that there is no deferred EXIDX section if we exit early.
1200 Instead of not making an EXIDX section in case of an error, make one
1201 and set the has_errors flag of it.
1202 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
1203 in a relocatable link.
1204 (Target_arm::do_relax): Look for the EXIDX output section instead of
1205 assuming that it is called .ARM.exidx.
1206 (Target_arm::fix_exidx_coverage): Add a new parameter for input
1207 section list. Do not check for SHF_EXECINSTR section flags but
1208 skip any input section with errors.
1209 * output.cc (Output_section::Output_section): Initialize
1210 always_keeps_input_sections_ to false.
1211 (Output_section::add_input_section): Check for
1212 always_keeps_input_sections_.
1213 * output.h (Output_section::always_keeps_input_sections,
1214 Output_section::set_always_keeps_input_sections): New methods.
1215 (Output_section::always_keeps_input_sections): New data member.
1217 2010-07-13 Rafael Espindola <espindola@google.com>
1219 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
1220 * fileread.h (Input_file): Add try_extra_search_path and find_file.
1222 2010-07-13 Philip Herron <herron.philip@googlemail.com>
1223 Ian Lance Taylor <iant@google.com>
1225 * output.h (Output_section_lookup_maps::add_merge_section):
1226 Correct check of whether value was inserted.
1227 (Output_section_lookup_maps::add_merge_input_section): Likewise.
1228 (Output_section_lookup_maps::add_relaxed_input_section):
1230 * arm.cc (Target_arm::got_section): Remove used local os.
1231 * i386.cc (Target_i386::got_section): Likewise.
1232 * x86_64.cc (Target_x86_64::got_section): Likewise.
1233 * sparc.cc (Target_sparc::got_section): Likewise.
1234 (Target_sparc::relocate): Remove unused local have_got_offset.
1235 * powerpc.cc (Target_powerpc::relocate): Likewise.
1237 2010-07-13 Ian Lance Taylor <iant@google.com>
1239 * compressed_output.cc (zlib_decompress): Fix signature in
1242 * archive.cc (Archive::include_member): Unlock an external member
1243 of a thin archive. Don't bother to delete an object we know is
1246 2010-07-12 Cary Coutant <ccoutant@google.com>
1248 * compressed_output.cc (zlib_decompress): New function.
1249 (get_uncompressed_size): New function.
1250 (decompress_input_section): New function.
1251 * compressed_output.h (get_uncompressed_size): New function.
1252 (decompress_input_section): New function.
1253 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
1254 Handle compressed debug sections.
1255 * layout.cc (is_compressed_debug_section): New function.
1256 (Layout::output_section_name): Map compressed section names to
1258 * layout.h (is_compressed_debug_section): New function.
1259 (is_debug_info_section): Recognize compressed debug sections.
1260 * merge.cc: Include compressed_output.h.
1261 (Output_merge_data::do_add_input_section): Handle compressed
1263 (Output_merge_string::do_add_input_section): Handle compressed
1265 * object.cc: Include compressed_output.h.
1266 (Sized_relobj::Sized_relobj): Initialize new data members.
1267 (build_compressed_section_map): New function.
1268 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
1269 * object.h (Object::section_is_compressed): New method.
1270 (Object::do_section_is_compressed): New method.
1271 (Sized_relobj::Compressed_section_map): New type.
1272 (Sized_relobj::do_section_is_compressed): New method.
1273 (Sized_relobj::compressed_sections_): New data member.
1274 * output.cc (Output_section::add_input_section): Handle compressed
1276 * reloc.cc: Include compressed_output.h.
1277 (Sized_relobj::write_sections): Handle compressed debug sections.
1279 2010-07-08 Cary Coutant <ccoutant@google.com>
1281 * resolve.cc (Symbol_table::resolve): Remember whether undef was
1282 weak when resolving to a dynamic def.
1283 (Symbol_table::should_override): Add adjust_dyndef flag; set it
1284 for weak undef/dynamic def cases. Adjust callers.
1285 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
1286 undef_binding_weak_.
1287 (Symbol_table::sized_write_globals): Adjust symbol binding.
1288 (Symbol_table::sized_write_symbol): Add binding parameter.
1289 * symtab.h (Symbol::set_undef_binding): New method.
1290 (Symbol::is_undef_binding_weak): New method.
1291 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
1292 (Symbol_table::should_override): Add new parameter.
1293 (Symbol_table::sized_write_symbol): Add new parameter.
1295 * testsuite/weak_undef_file1.cc: Add new test case.
1296 * testsuite/weak_undef_file2.cc: Fix header comment.
1297 * testsuite/weak_undef_test.cc: Add new test case.
1299 2010-06-29 Doug Kwan <dougkwan@google.com>
1301 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
1302 Initialize USE_SYMBOL_.
1303 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
1305 (Arm_reloc_property::uses_symbol_): New data member declaration.
1306 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
1307 uses symbol value and symbol is undefined but not weakly undefined.
1309 2010-06-28 Rafael Espindola <espindola@google.com>
1311 * plugin.cc (Plugin::load): Use dlerror.
1313 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
1315 * symtab.cc (detect_odr_violations): When reporting an ODR
1316 violation, report an object where the symbol is defined.
1318 2010-06-25 Doug Kwan <dougkwan@google.com>
1320 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
1321 (Target_arm::section_may_have_icf_unsafe_pointers): New method
1323 (Target_arm::Scan::local_reloc_may_be_function_pointer,
1324 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
1325 target hook to detect function points.
1326 (Target_arm::Scan::possible_function_pointer_reloc): New method.
1327 * icf.h (Icf::check_section_for_function_pointers): Change type of
1328 parameter SECTION_NAME to const reference to std::string. Use
1329 target hook to determine if section may have unsafe pointers.
1330 * target.h (Target::section_may_have_icf_unsafe_pointers): New
1333 2010-06-21 Rafael Espindola <espindola@google.com>
1335 * fileread.cc (Input_file::find_fie): New
1336 (Input_file::open): Use Input_file::find_fie.
1337 * fileread.h (Input_file::find_fie): New
1338 * plugin.cc (set_extra_library_path): New.
1339 (Plugin::load): Add set_extra_library_path to the transfer vector.
1340 (Plugin_manager::set_extra_library_path): New.
1341 (Plugin_manager::add_input_file): Use the extra search path if set.
1342 (set_extra_library_path(): New.
1343 * plugin.h (Plugin_manager): Add set_extra_library_path and
1346 2010-06-19 Cary Coutant <ccoutant@google.com>
1348 * layout.cc (gdb_sections): Add .debug_types.
1349 (lines_only_debug_sections): Likewise.
1351 2010-06-18 Rafael Espindola <espindola@google.com>
1353 * plugin.cc (add_input_file,add_input_library)
1354 (Plugin_manager::add_input_file): Make filename arguments const.
1355 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
1358 2010-06-16 Doug Kwan <dougkwan@google.com>
1360 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
1361 .ARM.attributes section if we have not merged any input
1362 attributes sections.
1364 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1366 * arm.cc: Allow combining objects with no EABI version
1369 2010-06-15 Rafael Espindola <espindola@google.com>
1371 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
1373 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1375 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
1376 (struct iovec): Correct !HAVE_READV definition.
1378 2010-06-10 Cary Coutant <ccoutant@google.com>
1380 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
1381 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
1383 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
1386 * symtab.h (Symbol::is_placeholder): New member function.
1387 * target-reloc.h (relocate_section): Check for placeholder symbols.
1389 * testsuite/Makefile.am (plugin_test_8): New test.
1390 (plugin_test_9): New test.
1391 * testsuite/Makefile.in: Regenerate.
1393 2010-06-09 Nick Clifton <nickc@redhat.com>
1395 * yyscript.y (input_list_element): Allow strings prefixed with
1396 the '-' character. Treat these as libraries.
1397 * script.cc (script_add_library): New function. Adds a library
1398 specified by "-l<name>" found in an input script.
1399 * script-c.h: Add prototype for script_add_library.
1401 2010-06-07 Doug Kwan <dougkwan@google.com>
1403 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
1404 Restrict stub-group size to be within long conditional branch
1405 range when working around cortex-A8 erratum.
1407 2010-06-07 Damien Diederen <dd@crosstwine.com>
1409 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
1412 2010-06-03 Sriraman Tallam <tmsriram@google.com>
1416 (Output_section::Input_section_sort_entry::compare_section_ordering):
1417 Change to return non-zero correctly.
1418 (Output_section::Input_section_sort_section_order_index_compare
1419 ::operator()): Change to fix ambiguity in comparisons.
1421 2010-06-01 Sriraman Tallam <tmsriram@google.com>
1423 * gold.h (is_wildcard_string): New function.
1424 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
1425 (Layout::layout_eh_frame): Ditto.
1426 (Layout::find_section_order_index): New method.
1427 (Layout::read_layout_from_file): New method.
1428 * layout.h (Layout::find_section_order_index): New method.
1429 (Layout::read_layout_from_file): New method.
1430 (Layout::input_section_position_): New private member.
1431 (Layout::input_section_glob_): New private member.
1432 * main.cc (main): Call read_layout_from_file here.
1433 * options.h (--section-ordering-file): New option.
1434 * output.cc (Output_section::input_section_order_specified_): New
1436 (Output_section::Output_section): Initialize new member.
1437 (Output_section::add_input_section): Add new parameter.
1438 Keep input sections when --section-ordering-file is used.
1439 (Output_section::set_final_data_size): Sort input sections when
1440 section ordering file is specified.
1441 (Output_section::Input_section_sort_entry): Add new parameter.
1443 (Output_section::Input_section_sort_entry::compare_section_ordering):
1445 (Output_section::Input_section_sort_compare::operator()): Change to
1446 consider section_order_index.
1447 (Output_section::Input_section_sort_init_fini_compare::operator()):
1448 Change to consider section_order_index.
1449 (Output_section::Input_section_sort_section_order_index_compare
1450 ::operator()): New method.
1451 (Output_section::sort_attached_input_sections): Change to sort
1452 according to section order when specified.
1453 (Output_section::add_input_section<32, true>): Add new parameter.
1454 (Output_section::add_input_section<64, true>): Add new parameter.
1455 (Output_section::add_input_section<32, false>): Add new parameter.
1456 (Output_section::add_input_section<64, false>): Add new parameter.
1457 * output.h (Output_section::add_input_section): Add new parameter.
1458 (Output_section::input_section_order_specified): New
1460 (Output_section::set_input_section_order_specified): New method.
1461 (Input_section::Input_section): Initialize section_order_index_.
1462 (Input_section::section_order_index): New method.
1463 (Input_section::set_section_order_index): New method.
1464 (Input_section::section_order_index_): New member.
1465 (Input_section::Input_section_sort_section_order_index_compare): New
1467 (Output_section::input_section_order_specified_): New member.
1468 * script-sections.cc (is_wildcard_string): Delete and move modified
1470 (Output_section_element_input::Output_section_element_input): Modify
1471 call to is_wildcard_string.
1472 (Output_section_element_input::Input_section_pattern
1473 ::Input_section_pattern): Ditto.
1474 (Output_section_element_input::Output_section_element_input): Ditto.
1475 * testsuite/Makefile.am (final_layout): New test case.
1476 * testsuite/Makefile.in: Regenerate.
1477 * testsuite/final_layout.cc: New file.
1478 * testsuite/final_layout.sh: New file.
1480 2010-06-01 Rafael Espindola <espindola@google.com>
1482 * plugin.cc (Plugin::load): Pass the output name to the plugin.
1484 2010-06-01 Rafael Espindola <espindola@google.com>
1486 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
1487 visibility of symbols.
1489 2010-05-27 Doug Kwan <dougkwan@google.com>
1491 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
1492 from start of output section instead of address for a local symbol
1493 in a merged or relaxed section when doing a relocatable link.
1495 2010-05-26 Rafael Espindola <espindola@google.com>
1498 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
1499 adding sections the garbage collector removed.
1500 * gold/testsuite/Makefile.am: Add test.
1501 * gold/testsuite/Makefile.in: Regenerate.
1502 * gold/testsuite/plugin_test_7.sh: New.
1503 * gold/testsuite/plugin_test_7_1.c: New.
1504 * gold/testsuite/plugin_test_7_2.c: New.
1506 2010-05-26 Rafael Espindola <espindola@google.com>
1508 * script-sections.cc (Output_section_definition::set_section_addresses):
1509 Check for --section-start.
1511 2010-05-26 Doug Kwan <dougkwan@google.com>
1513 * arm.cc (Arm_scan_relocatable_relocs): New class.
1514 (Target_arm::relocate_special_relocatable): New method.
1515 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
1516 (Arm_relocate_functions::thumb_branch_common): Same.
1517 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
1518 instead of Default_scan_relocatable_relocs.
1519 * target-reloc.h (relocate_for_relocatable): Let target handle
1520 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
1521 * target.h (Sized_target::relocate_special_relocatable): New method.
1523 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1525 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
1527 2010-05-23 Doug Kwan <dougkwan@google.com>
1529 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
1531 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
1532 with a direct branch, not a conditional branch, to a stub.
1533 * merge.cc (Output_merge_base::record_input_section): New method
1535 (Output_merge_data::do_add_input_section): Record input section if
1536 keeps-input-sections flag is set.
1537 (Output_merge_string::do_add_input_section): Ditto.
1538 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
1539 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
1541 (Output_merge_base::keeps_input_sections,
1542 Output_merge_base::set_keeps_input_sections,
1543 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
1545 (Output_merge_base::Input_sections): New type declaration.
1546 (Output_merge_base::input_sections_begin,
1547 Output_merge_base::input_sections_end,
1548 Output_merge_base::do_set_keeps_input_sections): New method definitions.
1549 (Output_merge_base::bool keeps_input_sections_,
1550 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
1551 Output_merge_base::input_sections_): New data members.
1552 (Output_merge_data::do_set_keeps_input_sections): New method
1554 (Output_merge_string::do_set_keeps_input_sections): Ditto.
1555 * output.cc (Output_section::Input_section::relobj): Move method
1556 defintion from class declaration to here and handle merge sections.
1557 (Output_section::Input_section::shndx): Ditto.
1558 (Output_section::Output_section): Remove initializations of removed
1559 data members and initialize new data member LOOKUP_MAPS_.
1560 (Output_section::add_input_section): Set keeps-input-sections flag
1561 for a newly created merge output section as appropriate. Adjust code
1562 to use Output_section_lookup_maps class.
1563 (Output_section::add_relaxed_input_section): Adjst code for lookup
1564 maps code refactoring.
1565 (Output_section::add_merge_input_section): Add a new parameter
1566 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
1567 class. If adding input section to a newly created merge output
1568 section fails, remove the new merge section.
1569 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
1570 Adjust code for use of the Output_section_lookup_maps class.
1571 (Output_section::find_merge_section): Ditto.
1572 (Output_section::build_lookup_maps): New method defintion.
1573 (Output_section::find_relaxed_input_section): Adjust code to use
1574 Output_section_lookup_maps class.
1575 (Output_section::get_input_sections): Export merge sections. Adjust
1576 code to use Output_section_lookup_maps class.
1577 (Output_section:::add_script_input_section): Adjust code to use
1578 Output_section_lookup_maps class. Update lookup maps for merge
1580 (Output_section::discard_states): Use Output_section_lookup_maps.
1581 (Output_section::restore_states): Same.
1582 * output.h (Merge_section_properties): Move class defintion out of
1584 (Output_section_lookup_maps): New class.
1585 (Output_section::Input_section::is_merge_section): New method
1587 (Output_section::Input_section::relobj): Move defintion out of class
1588 defintion. Declare method only.
1589 (Output_section::Input_section::shndx): Ditto.
1590 (Output_section::Input_section::output_merge_base): New method defintion.
1591 (Output_section::Input_section::u2_.pomb): New union field.
1592 (Output_section::Merge_section_by_properties_map,
1593 Output_section::Output_section_data_by_input_section_map,
1594 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
1596 (Output_section::add_merge_input_section): Add new parameter
1597 KEEPS_INPUT_SECTIONS.
1598 (Output_section::build_lookup_maps): New method declaration.
1599 (Output_section::merge_section_map_,
1600 Output_section::merge_section_by_properties_map_,
1601 Output_section::relaxed_input_section_map_,
1602 Output_section::is_relaxed_input_section_map_valid_): Remove data
1604 (Output_section::lookup_maps_): New data member.
1606 2010-05-21 Doug Kwan <dougkwan@google.com>
1609 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
1610 avoid a compilation error.
1612 2010-05-19 Rafael Espindola <espindola@google.com>
1614 * script-sections.cc (Output_section_definition::allocate_to_segment):
1615 Update the phdrs_list even when the output section is NULL.
1616 * testsuite/Makefile.am: Add test.
1617 * testsuite/Makefile.in: Regenerate.
1618 * testsuite/script_test_9.cc: New.
1619 * testsuite/script_test_9.sh: New.
1620 * testsuite/script_test_9.t: New.
1622 2010-05-19 Doug Kwan <dougkwan@google.com>
1624 * arm.cc (Arm_input_section::original_size): New method.
1625 (Arm_input_section::do_addralign): Add a cast.
1626 (Arm_input_section::do_output_offset): Remove static cast.
1627 (Arm_input_section::original_addralign,
1628 Arm_input_section::original_size_): Change type to uint32_t.
1629 (Arm_input_section::init): Add safe casts for section alignment
1631 (Arm_input_section::set_final_data_size): Do not set address and
1632 offset of stub table.
1633 (Arm_output_section::fix_exidx_coverage): Change use of of
1634 Output_section::Simple_input_section to that of
1635 Output_section::Input_section.
1636 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
1637 except for the first pass.
1638 * output.cc (Output_section::get_input_sections): Change type of
1639 input_sections to std::list<Input_section>.
1640 (Output_section::add_script_input_section): Rename from
1641 Output_section::add_simple_input_section. Change type of SIS
1642 parameter from Simple_input_section to Input_section.
1643 * output.h (Output_section::Simple_input_section): Remove class.
1644 (Output_section::Input_section): Change class visibility to public.
1645 (Output_section::Input_section::addralign): Use stored alignments
1646 for special input sections if set.
1647 (Output_section::Input_section::set_addralign): New method.
1648 (Output_section::get_input_sections): Change parameter type from
1649 list of Simple_input_section to list of Input_section.
1650 (Output_section::add_script_input_section): Rename from
1651 Output_section::add_simple_input_section. Change first parameter's
1652 type from Simple_input_section to Input_section and remove the
1653 second and third parameters.
1654 * script-sections.cc (Input_section::Input_section_list): Change
1655 type to list of Output_section::Input_section/
1656 (Input_section_info::Input_section_info): Change parameter type of
1657 INPUT_SECTION to Output_section::Input_section.
1658 (Input_section_info::input_section): Change return type.
1659 (Input_section_info::input_section_): Change type to
1660 Output_section::Input_section.
1661 (Output_section_element_input::set_section_addresses): Adjust code
1662 to use Output_section::Input_section instead of
1663 Output_section::Simple_input_section. Adjust code for renaming
1664 of Output_section::add_simple_input_section.
1665 (Orphan_output_section::set_section_addresses): Ditto.
1667 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1669 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
1670 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
1672 2010-05-18 Rafael Espindola <espindola@google.com>
1674 * options.cc (General_options::finalize): Handle -nostdlib.
1675 * options.h (nostdlib): New option.
1676 * script.cc (script_add_search_dir): Handle -nostdlib.
1678 2010-05-12 Doug Kwan <dougkwan@google.com>
1680 * arm.cc (Target_arm::do_finalize_sections): Create an empty
1681 attributes section only if there no attributes section after merging.
1682 (Target_arm::merge_object_attributes): Move value of
1683 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
1684 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
1685 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
1686 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
1687 and arm_attr_merge_7.stdout.
1688 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
1689 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
1690 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
1691 arm_attr_merge_7b.o): New rules.
1692 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
1694 * testsuite/Makefile.in: Regenerate.
1695 * testsuite/arm_attr_merge.sh: New file.
1696 * testsuite/arm_attr_merge_[67][ab].s: Same.
1698 2010-05-05 Nick Clifton <nickc@redhat.com>
1700 * po/es.po: Updated Spanish translation.
1702 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
1704 * Makefile.am (install-exec-local): Properly install gold as
1705 default cross linker.
1706 * Makefile.in: Regenerated.
1708 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
1709 Nick Clifton <nickc@redhat.com>
1711 * configure.ac (install_as_default): Define and set to false
1712 unless --enable-gold or --enable-gold=both/gold has been
1714 * configure: Regenerate.
1716 * Makefile.am (install-exec-local): Install the executable as
1717 'ld.gold'. If install_as_default is true then also install it as
1719 * Makefile.in: Regenerated.
1721 2010-04-24 Ian Lance Taylor <iant@google.com>
1723 * layout.cc (Layout::layout_reloc): In relocatable link don't
1724 combine reloc sections for grouped sections.
1726 2010-04-23 Sriraman Tallam <tmsriram@google.com>
1728 * gc.h (gc_process_relocs): Pass information on relocs pointing to
1729 sections that are not ordinary to icf.
1730 * icf.cc (get_section_contents): Handle relocation pointing to section
1731 with no object or shndx information.
1732 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
1733 * testsuite/Makefile.in: Regenerate.
1734 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
1735 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
1737 2010-04-22 Ian Lance Taylor <iant@google.com>
1739 * expression.cc (Expression::Expression_eval_info): Add
1740 result_alignment_pointer field.
1741 (Expression::eval_with_dot): Add result_alignment_pointer
1742 parameter. Change all callers.
1743 (Expression::eval_maybe_dot): Likewise.
1744 (class Binary_expression): Add alignment_pointer parameter to
1745 left_value and right_value. Change all callers.
1746 (BINARY_EXPRESSION): Set result alignment.
1747 (class Trinary_expression): Add alignment_pointer parameter to
1748 arg2_value and arg3_value. Change all callers.
1749 (Trinary_cond::value): Set result alignment.
1750 (Max_expression::value, Min_expression::value): Likewise.
1751 (Align_expression::value): Likewise.
1752 * script-sections.cc (class Sections_element): Add dot_alignment
1753 parameter to set_section_addresses virtual function. Update
1755 (class Output_section_element): Likewise.
1756 (Script_sections::create_segments): Add dot_alignment parameter.
1758 (Script_sections::create_segments_from_phdrs_clause): Likewise.
1759 (Script_sections::set_phdrs_clause_addresses): Likewise.
1760 * script-sections.h: Update declarations.
1761 * script.h: Update declarations.
1762 * output.h (Output_segment::set_minimum_p_align): Don't decrease
1764 * testsuite/script_test_3.t: Set large alignment.
1765 * testsuite/script_test_3.sh: Make sure that at least one LOAD
1766 segment has expected alignment.
1768 2010-04-22 Nick Clifton <nickc@redhat.com>
1770 * po/gold.pot: Updated by the Translation project.
1771 * po/vi.po: Updated Vietnamese translation.
1773 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
1775 * testsuite/Makefile.am (check_PROGRAMS): Add
1776 icf_virtual_function_folding_test.
1777 * testsuite/Makefile.in: Regenerated.
1779 2010-04-15 Andrew Haley <aph@redhat.com>
1781 * options.h (merge_exidx_entries): New option.
1782 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
1783 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
1784 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
1785 (Target_arm::merge_exidx_entries): New function.
1786 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
1787 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
1788 to Arm_exidx_fixup constructor.
1789 Add new arg, merge_exidx_entries.
1790 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
1791 Arm_output_section::fix_exidx_coverage.
1793 2010-04-18 Sriraman Tallam <tmsriram@google.com>
1795 * icf.cc (get_section_contents): Check for preemptible functions.
1796 Ignore addend when appropriate.
1797 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
1799 (add_from_relobj): Check for section folded.
1800 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
1801 * symtab.h (should_add_dynsym_entry): Add new parameter.
1802 * target-reloc.h (scan_relocs): Check for section folded.
1803 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
1804 Check reloc types for function pointers in shared objects.
1805 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
1807 (icf_preemptible_functions_test): New test case.
1808 (icf_string_merge_test): New test case.
1809 * testsuite.Makefile.in: Regenerate.
1810 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
1811 bar_glob. Refactor code.
1812 * testsuite/icf_preemptible_functions_test.cc: New file.
1813 * testsuite/icf_preemptible_functions_test.sh: New file.
1814 * testsuite/icf_string_merge_test.cc: New file.
1815 * testsuite/icf_string_merge_test.sh: New file.
1816 * testsuite/icf_virtual_function_folding_test.cc: New file.
1817 * testsuite/icf_virtual_function_folding_test.sh: New file.
1819 2010-04-14 Doug Kwan <dougkwan@google.com>
1821 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
1822 for local symbol recounting if we remove a section due to ICF.
1823 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
1824 there are no regular objects in input.
1826 2010-04-13 Doug Kwan <dougkwan@google.com>
1828 * arm.cc (Arm_input_section::set_final_data_size): Compute
1829 accurate final data size instead of using current data size.
1831 2010-04-09 Doug Kwan <dougkwan@google.com>
1833 * layout.cc (Layout::choose_output_section): Handle script section
1835 (Layout::make_output_section_for_script): Add section type parameter.
1836 Handle script section types.
1837 * layout.h (Layout::make_output_section_for_script): Add section
1839 * output.cc (Output_section::Output_section): Initialize data member
1841 (Output_section::do_reset_address_and_file_offset): Do not set address
1842 to 0 if section is a NOLOAD section.
1843 * output.h (Output_section::is_noload): New method.
1844 (Output_section::set_is_noload): Ditto.
1845 (Output_section::is_noload_): New data member.
1846 * script-c.h (Script_section_type): New enum type.
1847 (struct Parser_output_section_header): Add new file section_type.
1848 * script-sections.cc (Sections_element::output_section_name): Add
1849 parameter for returning script section type.
1850 (Output_section_definition::output_section_name): Ditto.
1851 (Output_section_definition::section_type)P; New method.
1852 (Output_section_definiton::script_section_type_name): Ditto.
1853 (Output_section_definition::script_section_type_): New data member.
1854 (Output_section_definition::Output_section_definition): Initialize
1855 data member Output_section_definition::script_section_type_.
1856 (Output_section_definition::create_sections): Pass script section type
1857 to Layout::make_output_section_for_script.
1858 (Output_section_definition::output_section_name): Return script
1859 section type to caller.
1860 (Output_section_definition::set_section_address): Do not advance
1861 dot value and load address if section type is NOLOAD. Set address
1862 of NOLOAD sections regardless of section flags.
1863 (Output_section_definition::print): Print section type if it is
1864 not SCRIPT_SECTION_TYPE_NONE.
1865 (Output_section_definition::section_type): New method.
1866 (Output_section_definition::script_section_type_name): Ditto.
1867 (Script_sections::output_section_name): Add new parameter
1868 PSECTION_TYPE for returning script section type. Pass it to
1869 section elements. Handle discard sections.
1870 (Sort_output_sections::operator()): Handle NOLOAD sections.
1871 * script-sections.h (Script_sections::Section_type): New enum type.
1872 (Script_sections::output_section_name): Add a new parameter for
1873 returning script section type.
1874 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
1876 * yyscript.y (union): Add new field SECTION_TYPE.
1877 (COPY, DSECT, INFO, NOLOAD): New tokens.
1878 (opt_address_and_section_type): Change type to output_section_header.
1879 (section_type): New non-terminal
1880 (section_header): Handle section type.
1881 (opt_address_and_section_type): Return section type value.
1883 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
1885 * testsuite/plugin_common_test_1.c (foo): Add prototype.
1886 * testsuite/plugin_common_test_2.c (foo): Likewise.
1888 2010-04-08 Doug Kwan <dougkwan@google.com>
1890 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
1892 * output.cc (Output_section::add_merge_input_section): Simplify
1893 code and return status of Output_merge_base::add_input_section.
1894 Update merge section map only if Output_merge_base::add_input_section
1897 2010-04-07 Doug Kwan <dougkwan@google.com>
1899 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
1900 if section is marked as containing instructions but has no mapping
1902 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
1903 correct section index.
1904 (Arm_relobj::find_linked_text_section): Ditto.
1906 2010-04-07 Cary Coutant <ccoutant@google.com>
1908 * archive.cc (include_member): Destroy Read_symbols_data object before
1910 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
1911 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
1912 (Read_symbols_data::~Read_symbols_data) New destructor.
1913 (Section_relocs::Section_relocs) New constructor.
1914 (Section_relocs::~Section_relocs) New destructor.
1915 (Read_relocs_data::Read_relocs_data) New constructor.
1916 (Read_relocs_data::~Read_relocs_data) New destructor.
1917 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
1918 pointers to NULL after deleting.
1920 2010-04-07 Doug Kwan <dougkwan@google.com>
1922 * arm.cc: Replace "endianity" with "endianness" in comments.
1923 (Arm_exidx_cantunwind): Ditto.
1924 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
1925 (Arm_relobj::merge_flags_and_attributes): New method.
1926 (Arm_relobj::merge_flags_and_attributes_): New data member.
1927 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
1928 (Arm_relobj::scan_sections_for_stubs): Ditto.
1929 (Arm_relobj::do_read_symbols): Check to see if we really want to
1930 merge processor-specific flags and attributes. Exit early if
1931 an object is empty except for section names and the undefined symbol.
1932 (Target_arm::do_finalize_sections): Move check for ELF format to
1933 Arm_relobj::do_read_symbols. Merge processor specific flags and
1934 attributes from a regular object only when we have determined that
1935 it is aapropriate. Do not create an .ARM.attributes section in
1936 output if there is no regular input object.
1937 (Target_arm::merge_processor_specific_flags): Check
1938 --warn-mismatch before printing any error.
1939 (Target_arm::merge_object_attributes): Ditto.
1940 * gold.cc (queue_middle_tasks): Handle the case in which there is
1941 no regular object in input.
1942 * options.cc (General_options::parse_EB): New method.
1943 (General_options::parse_EL): Same.
1944 (General_options::General_options): Initialize endianness_.
1945 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
1947 (General_options::Endianness): New enum.
1948 (General_options::endianness): New method.
1949 (General_options::endianness_): New data member.
1950 * parameters.cc (Parameters::set_options): Check target endianness.
1951 (Parameters::set_target_once): Ditto.
1952 (Parameters::check_target_endianness): New method.
1953 (parameters_force_valid_target): If either -EL or -EB is specified,
1954 use it to define endianness of default target.
1955 * parameters.h (Parameters::check_target_endianness): New method
1957 * target.h (class Target): Change "endianity" to "endianness"
1960 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1962 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
1963 * configure: Regenerate.
1964 * Makefile.in: Regenerate.
1965 * testsuite/Makefile.in: Regenerate.
1967 2010-04-06 Cary Coutant <ccoutant@google.com>
1970 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
1971 prevailing definitions of common symbols.
1972 * testsuite/plugin_test_6.sh: New test case.
1973 * testsuite/plugin_common_test_1.c: New test case.
1974 * testsuite/plugin_common_test_2.c: New test case.
1975 * testsuite/Makefile.am (plugin_test_6): New test case.
1976 * testsuite/Makefile.in: Regenerate.
1978 2010-04-06 Nick Clifton <nickc@redhat.com>
1980 * po/vi.po: New Vietnamese translation.
1982 2010-03-30 Doug Kwan <dougkwan@google.com>
1984 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
1986 2010-03-25 Doug Kwan <dougkwan@google.com>
1988 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
1989 to avoid a conversion warning on a 32-bit host.
1991 2010-03-24 Ian Lance Taylor <iant@google.com>
1993 * testsuite/script_test_3.t: Add a TLS segment.
1994 * testsuite/Makefile.am (check_PROGRAMS): Add
1995 tls_phdrs_script_test.
1996 (tls_phdrs_script_test_SOURCES): Define.
1997 (tls_phdrs_script_test_DEPENDENCIES): Define.
1998 (tls_phdrs_script_test_LDFLAGS): Define.
1999 (tls_phdrs_script_test_LDADD): Define.
2000 * testsuite/Makefile.in: Rebuild.
2002 2010-03-23 Cary Coutant <ccoutant@google.com>
2004 * fileread.cc (find_or_make_view): Fix comment.
2006 2010-03-23 Ian Lance Taylor <iant@google.com>
2008 * script-sections.cc (class Orphan_section_placement): Define
2009 PLACE_TLS and PLACE_TLS_BSS.
2010 (Orphan_section_placement::Orphan_section_placement): Initialize
2012 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
2013 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
2014 (tls_script_test_SOURCES): Define.
2015 (tls_script_test_DEPENDENCIES): Define.
2016 (tls_script_test_LDFLAGS): Define.
2017 (tls_script_test_LDADD): Define.
2018 * testsuite/Makefile.in: Rebuild.
2020 2010-03-22 Doug Kwan <dougkwan@google.com>
2022 * arm.cc (Arm_relocate_functions::abs8,
2023 Arm_relocate_functions::abs16): Use correct check for overflow
2024 specified in the ARM ELF specs.
2025 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
2026 target of a BLX instruction specially.
2027 (Reloc_stub::stub_type_for_reloc): Ditto.
2028 (Relocate::relocate): Use symbolic names instead of numeric relocation
2029 codes to report error.
2030 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
2032 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
2033 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
2034 thumb2_blx_out_of_range.stdout
2035 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
2036 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
2037 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
2038 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
2039 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
2040 thumb2_blx_in_range, thumb2_blx_in_range.o,
2041 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
2042 thumb2_blx_out_of_range.o): New rules.
2043 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
2044 thumb2_blx_in_range and thumb2_blx_out_of_range.
2045 * testsuite/Makefile.in: Regenerate.
2046 * arm_branch_in_range.sh: Add tests for THUMB BLX.
2047 * testsuite/thumb_blx_in_range.s: New file.
2048 * testsuite/thumb_blx_out_of_range.s: New file.
2050 2010-03-22 Rafael Espindola <espindola@google.com>
2052 * archive.cc (Should_include): Move to archive.h.
2053 (should_include_member): Make it a member of Archive.
2055 (Add_lib_group_symbols): New.
2056 * archive.h: Include options.h.
2057 (Archive_member): Moved from Archive.
2058 (Should_include): Moved from archive.cc.
2060 (Add_lib_group_symbols): New.
2061 * dynobj.cc (do_should_include_member): New.
2062 * dynobj.h (do_should_include_member): New.
2063 * gold.cc (queue_initial_tasks): Update call to queue.
2064 * main.cc (main): Print lib group stats.
2065 * object.cc (do_should_include_member): New.
2066 * object.h: Include archive.h.
2067 (Object::should_include_member): New.
2068 (Object::do_should_include_member): New.
2069 (Sized_relobj::do_should_include_member): New.
2070 * options.cc (General_options::parse_start_lib): New.
2071 (General_options::parse_end_lib): New.
2072 (Input_arguments::add_file): Handle lib groups.
2073 (Input_arguments::start_group): Check we are not in a lib.
2074 (Input_arguments::start_lib): New.
2075 (Input_arguments::end_lib): New.
2076 * options.h (General_options): Add start_lib and end_lib.
2077 (Input_argument::lib_): New.
2078 (Input_argument::lib): New.
2079 (Input_argument::is_lib): New.
2080 (Input_file_lib): New.
2081 (Input_arguments::in_lib_): New.
2082 (Input_arguments::in_lib): New.
2083 (Input_arguments::start_lib): New.
2084 (Input_arguments::end_lib_): New.
2085 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
2086 in unused members as preempted.
2087 (Sized_pluginobj::do_should_include_member): New.
2088 * plugin.h (Sized_pluginobj::do_should_include_member): New.
2089 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
2091 (Read_symbols::do_whole_lib_group): New.
2092 (Read_symbols::do_lib_group): New.
2093 (Read_symbols::do_read_symbols): Handle lib groups.
2094 (Read_symbols::get_name): Handle lib groups.
2095 * readsyms.h (Read_symbols): Add an archive member pointer.
2096 (Read_symbols::do_whole_lib_group): New.
2097 (Read_symbols::do_lib_group): New.
2098 (Read_symbols::member_): New.
2099 * script.cc (read_input_script): Update call to queue_soon.
2101 2010-03-19 Doug Kwan <dougkwan@google.com>
2103 * arm.cc (Stub_table::Stub_table): Initialize new data members
2104 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
2105 (Stub_table::add_reloc_stub): Assign stub offset and update
2106 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
2107 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
2109 (Stub_table::update_data_size_and_addralign): Use
2110 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
2111 instead of going over all reloc stubs.
2112 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
2113 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
2114 Stringpool_template::offset_ to size of Stringpool_char.
2115 (Stringpool_template::new_key_offset): Remove code to initialize
2116 Stringpool_template::offset_.
2117 * stringpool.h (Stringpool_template::set_no_zero_null): Set
2118 Stringpool_template::offset_ to zero.
2120 2010-03-15 Doug Kwan <dougkwan@google.com>
2122 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
2124 (Stringpool_template::new_key_offset): New method.
2125 (Stringpool_template::add_string): Assign offsets when adding new
2127 (Stringpool_template::set_string_offsets): Do not set string offsets
2128 when not optimizing.
2129 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
2131 (Chunked_vector::clear): Clear size_.
2132 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
2133 (Chunked_vector::size): Return size_.
2134 (Chunked_vector::push_back): Use size_ to find insert position.
2135 (Chunked_vector::size_): New data member.
2136 (Stringpool_template::set_no_zero_null): Assert string set is empty.
2137 (Stringpool_template::new_key_offset): New method declaration.
2138 (Stringpool_template::offset_): New data member.
2140 2010-03-15 Rafael Espindola <espindola@google.com>
2142 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
2143 Add_symbols' constructor.
2144 * readsyms.h (Add_symbols): Remove the input_group member.
2146 2010-03-10 Ian Lance Taylor <iant@google.com>
2148 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
2149 target to ask whether a reference to a symbol requires a stack
2151 * target.h (Target::is_call_to_non_split): New function.
2152 (Target::do_is_call_to_non_split): Declare virtual function.
2153 * target.cc: Include "symtab.h".
2154 (Target::do_is_call_to_non_split): New function.
2155 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
2157 2010-03-10 Cary Coutant <ccoutant@google.com>
2159 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
2160 (File_read::open[1]): Remove initial mapping of whole_file_view_.
2161 (File_read::open[2]): Add whole_file_view_ to list of views.
2162 (File_read::make_view): Remove test of whole_file_view_.
2163 (File_read::find_or_make_view): Create whole_file_view_ if
2165 (File_read::clear_views): Replace bool parameter with enum;
2166 adjust all callers. Don't delete views with permanent data;
2167 do delete cached views and views from archives if
2168 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
2169 if clearing the corresponding view.
2170 * fileread.h (File_read::Clear_views_mode): New enum.
2171 (File_read::View::is_permanent_view): New method.
2172 (File_read::clear_views): Replace bool parameter
2173 with enum; adjust all callers.
2174 * options.h (General_options): Change keep_files_mapped option;
2175 add map_whole_files.
2176 * readsyms.cc (Add_symbols::run): Delete sd_ object before
2178 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
2181 2010-03-10 David S. Miller <davem@davemloft.net>
2183 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
2185 2010-03-09 Sriraman Tallam <tmsriram@google.com>
2187 * icf.cc (get_section_contents): Add '@' marker after processing the
2190 2010-03-08 Doug Kwan <dougkwan@google.com>
2192 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
2193 due to a conversion warning.
2194 (Arm_relobj::update_output_local_symbol_count): Check for local
2195 symbol with unset output index.
2197 2010-03-05 Ian Lance Taylor <iant@google.com>
2199 * options.h (class General_options): Add --spare-dynamic-tags.
2200 * output.cc (Output_data_dynamic::set_final_data_size): Implement
2201 --spare-dynamic-tags.
2203 2010-03-05 Ian Lance Taylor <iant@google.com>
2205 * incremental.cc: Include "libiberty.h".
2207 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
2209 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
2210 function, is_info_ member.
2211 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
2212 (Versions::Versions): Update caller.
2213 (Versions::define_base_version): Likewise.
2214 (Versions::add_def): Likewise.
2216 2010-03-03 Sriraman Tallam <tmsriram@google.com>
2218 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
2219 (Scan::possible_function_pointer_reloc): New function.
2220 (Scan::local_reloc_may_be_function_pointer): Change to call
2221 possible_function_pointer_reloc.
2222 (Scan::global_reloc_may_be_function_pointer): Ditto.
2223 * icf.h (Icf::check_section_for_function_pointers): Change to reject
2224 relocations in ".data.rel.ro._ZTV" section.
2225 * testsuite/icf_safe_so_test.sh: Change to pass i386.
2226 * testsuite/icf_safe_so_test.cc: Ditto.
2227 * testsuite/icf_safe_test.cc: Ditto.
2228 * testsuite/icf_safe_test.sh: Ditto.
2230 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2231 Ian Lance Taylor <iant@google.com>
2233 * target-reloc.h (relocate_section): Check the symbol table index
2234 for -1U before setting the local symbol index.
2235 (scan_relocatable_relocs): If copying the relocation, record that
2236 the local symbol is required.
2237 * object.h (Symbol_value::is_output_symtab_index_set): New
2239 (Symbol_value::may_be_discarded_from_output_symtab): New
2241 (Symbol_value::has_output_symtab_entry): New function.
2242 (Symbol_value::needs_output_symtab_entry): Remove.
2243 (Symbol_value::output_symtab_index): Make sure the symbol index is
2245 (Symbol_value::set_output_symtab_index): Make sure the symbol
2246 index is not set. Make sure the new index is valid.
2247 (Symbol_value::set_must_have_output_symtab_entry): New function.
2248 (Symbol_value::has_output_dynsym_entry): New function.
2249 (Symbol_value::set_output_dynsym_index): Make sure the new index
2251 (Sized_relobj::set_must_have_output_symtab_entry): New function.
2252 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
2253 local symbol if permitted.
2254 (Sized_relobj::do_finalize_local_symbols): Call
2255 is_output_symtab_index_set rather than needs_output_symtab_entry.
2256 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
2257 rather than needs_output_symtab_entry. Call
2258 has_output_dynsym_entry rather than needs_output_dynsym_entry.
2259 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
2260 is_output_symtab_index_set rather than needs_output_symtab_entry.
2261 * testsuite/discard_locals_relocatable_test.c: New file.
2262 * testsuite/discard_locals_test.sh: Test -r.
2263 * testsuite/Makefile.am (check_DATA): Add
2264 discard_locals_relocatable_test1.syms,
2265 discard_local_relocatable_test2.syms.
2266 (MOSTLYCLEANFILES): Likewise. Also add
2267 discard_locals_relocatable_test1.lout and
2268 discard_locals_relocatable_test2.out.
2269 (discard_locals_relocatable_test1.syms): New target.
2270 (discard_locals_relocatable_test.o): New target.
2271 (discard_locals_relocatable_test1.out): New target.
2272 (discard_locals_relocatable_test2.syms): New target.
2273 (discard_locals_relocatable_test2.out): New target.
2274 (various): Add missing ../ld-new dependencies.
2275 * testsuite/Makefile.in: Rebuild.
2277 2010-03-03 Nick Clifton <nickc@redhat.com>
2279 * po/fi.po: New Finnish translation.
2281 2010-03-01 Doug Kwan <dougkwan@google.com>
2283 * layout.cc (Layout::Layout): Force section types of .init_array*,
2284 .preinit_array* and .fini_array* sections.
2285 * output.cc (Output_section::Input_section_sort_entry::has_priority):
2286 Fix check of return value of std::string::find.().
2287 (Output_section::Input_section_sort_compare::operator()): Remove
2288 comment about .init_array.
2289 (Output_section::Input_section_sort_init_fini_compare::operator()):
2291 (Output_section::sort_attached_input_sections): Handle .init_array
2292 and .fini_array specially.
2293 * output.h (Output_section::Inut_section_sort_compare): Update
2295 (Output_section::Input_section_sort_init_fini_compare): New struct.
2297 2010-02-26 Doug Kwan <dougkwan@google.com>
2299 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
2300 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
2301 * testsuite/debug_msg.sh: Avoid matching source line number for
2302 use of global variable undef_int.
2304 2010-02-26 Doug Kwan <dougkwan@google.com>
2306 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
2307 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
2308 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
2309 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
2310 * options.cc (General_options::General_options): Initialize member
2312 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
2313 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
2314 and rm_no_fix_v4bx.stdout
2315 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
2316 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
2317 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
2318 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
2319 and arm_no_fix_v4bx.
2320 * Makefile.in: Regenerate.
2321 * testsuite/arm_fix_v4bx.s: New file.
2322 * testsuite/arm_fix_v4bx.sh: Ditto.
2324 2010-02-24 Doug Kwan <dougkwan@google.com>
2326 * arm.cc (Target_arm::got_section): Make the .got section the first
2327 non RELRO section in the data segment.
2328 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
2329 suffixes of section names.
2331 2010-02-24 Doug Kwan <dougkwan@google.com>
2333 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
2334 flags and attributes merging if an input file is a binary file.
2335 * fileread.cc (Input_file::open): Record format of original file.
2336 * fileread.h (Input_file::Format): New enum type.
2337 (Input_file::Input_file): Initialize data member format_.
2338 (Input_file::format): New method definition.
2339 (Input_file::format_):: New data member.
2341 2010-02-24 Doug Kwan <dougkwan@google.com>
2343 * arm.cc (Arm_output_data_got): New class.
2344 (ARM_TCB_SIZE): New constant
2345 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
2346 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
2347 If user uses a script with a SECTIONS clause, issue only a warning
2348 for a misplaced EXIDX input section. Otherwise, issue an error.
2349 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
2351 (Target_arm::got_mode_index_entry): Handle static linking.
2352 (Target_arm::Scan::local): Ditto.
2353 (Target_arm::Scan::global): Ditto.
2354 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
2355 all incorrectly implemented relocations.
2356 (Target_arm::fix_exidx_coverage): Pass layout to
2357 Arm_output_section::fix_exidx_coverage.
2358 * layout.cc (Layout::section_name_mapping): Remove trailing dots
2359 from ".ARM.exidx." and ".ARM.extab.".
2361 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2363 * arm.cc (Target_arm::do_finalize_sections): Create attribute
2364 section if it does not already exist.
2365 * attributes.cc (Attributes_section_data::Attributes_section_data):
2366 Don't crash if size is zero.
2368 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2369 Ian Lance Taylor <iant@google.com>
2371 * gold.cc (queue_middle_tasks): If no input files were opened,
2373 * workqueue.h (Task_function::Task_function): Assert that there is
2376 2010-02-22 Doug Kwan <dougkwan@google.com>
2378 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
2379 * icf.cc (get_section_contents): Cast snprintf arguments to long long
2380 types to avoid warnings due to different uint64_t implementations
2383 2010-02-21 Doug Kwan <dougkwan@google.com>
2385 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
2386 handling of the maximum backward branch offset.
2387 (Arm_relocate_functions::thumb_branch_common): Ditto.
2388 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
2389 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
2390 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
2391 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
2392 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
2393 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
2394 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
2395 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
2396 thumb_bl_out_of_range thumb_bl_out_of_range.o,
2397 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
2398 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
2399 thumb2_bl_out_of_range.o): New rules.
2400 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
2401 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
2402 thumb2_bl_out_of_range
2403 * testsuite/Makefile.in: Regenerate.
2404 * testsuite/arm_bl_in_range.s: New file.
2405 * testsuite/arm_bl_out_of_range.s: Ditto.
2406 * testsuite/arm_branch_in_range.sh: Ditto.
2407 * testsuite/arm_branch_range.t: Ditto.
2408 * testsuite/thumb2_branch_range.t: Ditto.
2409 * testsuite/thumb_bl_in_range.s: Ditto.
2410 * testsuite/thumb_bl_out_of_range.s: Ditto.
2411 * testsuite/thumb_branch_range.t: Ditto.
2413 2010-02-20 Sriraman Tallam <tmsriram@google.com>
2415 * gc.h (gc_process_relocs): Change vectors to point to the new list.
2416 Add reloc offset information.
2417 * icf.cc (get_section_contents): Change iterators to point to the new
2418 vectors. Add reloc offset information to the contents.
2419 * icf.h (Icf::Sections_reachable_info): New typedef.
2420 (Icf::Sections_reachable_list): New typedef.
2421 (Icf::Offset_info): New typedef.
2422 (Icf::Reloc_info): New struct typedef.
2423 (Icf::Reloc_info_list): New typedef.
2424 (Icf::symbol_reloc_list): Delete method.
2425 (Icf::addend_reloc_list): Delete method.
2426 (Icf::section_reloc_list): Delete method.
2427 (Icf::reloc_info_list): New method.
2428 (Icf::reloc_info_list_): New member.
2430 2010-02-19 Doug Kwan <dougkwan@google.com>
2432 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
2433 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
2434 * arm.cc (Arm_relocation_functions): New forward declaration.
2435 (Target_arm::Target_arm): Initialize new data members
2436 got_mod_index_offset_ and tls_base_symbol_defined_.
2437 (Target_arm::Relocate::relocate_tls): New method.
2438 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
2439 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
2441 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
2442 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
2443 (Target_arm::got_mod_index_offset_,
2444 Target_arm::tls_base_symbol_defined_): New data members.
2445 (Target_arm::Scan::local, Target::Scan::global,
2446 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
2449 2010-02-18 Doug Kwan <dougkwan@google.com>
2451 * arm.cc (Arm_relobj::find_linked_text_section): New method.
2452 (Arm_relobj::make_exidx_input_section): Pass section index of linked
2453 text section as a parameter becuase some broken tools may not set
2454 the link in section header.
2455 (Target_arm::has_got_section): New method.
2456 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
2457 without any mapping symbol as data only. Remove warning.
2458 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
2459 link in its section header, try to discover the link by inspecting the
2460 REL31 relocation at the beginning of the section.
2461 (Target_arm::Scan::check_non_pic): Report name of offending relocation
2463 (Target_arm::Scan::global): Treat any reference to the symbol
2464 _GLOBAL_OFFSET_TABLE_ as a GOT access.
2466 2010-02-12 Sriraman Tallam <tmsriram@google.com>
2468 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
2469 (Scan::global_reloc_may_be_function_pointer): New function.
2470 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
2471 (Scan::global_reloc_may_be_function_pointer): New function.
2472 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
2473 (Scan::global_reloc_may_be_function_pointer): New function.
2474 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
2475 (Scan::global_reloc_may_be_function_pointer): New function.
2476 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
2477 (Scan::global_reloc_may_be_function_pointer): New function.
2478 (Scan::possible_function_pointer_reloc): New function.
2479 (Target_x86_64::can_check_for_function_pointers): New function.
2480 * gc.h (gc_process_relocs): Scan relocation types to determine if
2481 function pointers were taken for targets that support it.
2482 * icf.cc (Icf::find_identical_sections): Include functions for
2483 folding in safe ICF whose pointer is not taken.
2484 * icf.h (Secn_fptr_taken_set): New typedef.
2485 (fptr_section_id_): New member.
2486 (section_has_function_pointers): New function.
2487 (set_section_has_function_pointers): New function.
2488 (check_section_for_function_pointers): New function.
2489 * options.h: Fix comment for safe ICF option.
2490 * target.h (can_check_for_function_pointers): New function.
2491 * testsuite/Makefile.am: Add icf_safe_so_test test case.
2492 Modify icf_safe_test for X86-64.
2493 * testsuite/Makefile.in: Regenerate.
2494 * testsuite/icf_safe_so_test.cc: New file.
2495 * testsuite/icf_safe_so_test.sh: New file.
2496 * testsuite/icf_safe_test.cc (kept_func_3): New function.
2497 (main): Change to take pointer to function kept_func_3.
2498 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
2499 folding is done correctly for X86-64.
2501 2010-02-12 David S. Miller <davem@davemloft.net>
2503 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
2504 is_symbolless parameter.
2505 (Output_reloc<SHT_REL>::is_symbolless): New.
2506 (Output_reloc<SHT_REL>::is_symbolless_): New.
2507 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
2508 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
2509 (Output_reloc<SHT_RELA>::is_symbolless): New.
2510 (Output_data_reloc::add_global): Handle is_symbolless.
2511 (Output_data_reloc::add_global_relative): Likewise.
2512 (Output_data_reloc::add_local): Likewise.
2513 (Output_data_reloc::add_local_relative): Likewise.
2514 (Output_data_reloc::add_symbolless_global_addend): New.
2515 (Output_data_reloc::add_symbolless_local_addend): New.
2516 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
2518 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
2519 instead of ->is_relative_
2520 (Output_reloc::write): Likewise.
2521 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
2522 (Output_reloc::write_rel): Simplify.
2524 * sparc.cc (Target_sparc::Scan::local): Use
2525 ->add_symbolless_local_addend as needed.
2526 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
2527 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
2528 based upon relocation offset.
2530 2010-02-11 Doug Kwan <dougkwan@google.com>
2532 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
2533 (Target_arm::Scan::global): Ditto. Also remove a comment before the
2534 beginning of function.
2535 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
2536 and MOVT_ABS relocations. Those are non issued in scanning. Fix
2537 parameter is_32bit in calls to should_apply_static_reloc.
2538 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
2539 (check_DATA): Add arm_abs_global.stdout.
2540 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
2541 arm_abs_global.stdout): New rules.
2542 (MOSTLLYCLEANFILES): Add arm_abs_global
2543 * Makefile.in: Regenerate.
2544 * testsuite/arm_abs_global.s: New file.
2545 * testsuite/arm_abs_global.sh: Ditto.
2546 * testsuite/arm_abs_lib.s: Ditto.
2548 2010-02-11 Ian Lance Taylor <iant@google.com>
2550 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
2552 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
2553 Allocate_commons_task first.
2554 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
2555 task, rather than symtab_lock_.
2556 (Gc_process_relocs::~Gc_process_relocs): New function.
2557 (Gc_process_relocs::is_runnable): Check this_blocker_.
2558 (Gc_process_relocs::locks): Use next_blocker_ rather than
2560 (Scan_relocs::~Scan_relocs): New function.
2561 (Scan_relocs::is_runnable): Check this_blocker_ rather than
2563 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
2565 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
2566 fields. Add this_blocker_ and next_blocker_ fields. Adjust
2567 constructor accordingly.
2568 (class Gc_process_relocs): Likewise.
2569 (class Scan_relocs): Likewise.
2570 * common.h (class Allocate_commons_task): Remove symtab_lock_
2571 field, and corresponding constructor parameter.
2572 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
2574 (Allocate_commons_task::locks): Likewise.
2576 2010-02-11 Ian Lance Taylor <iant@google.com>
2578 * gold-threads.h (class Once): Define.
2579 (class Initialize_lock): Rewrite as child of Once.
2580 * gold-threads.cc (class Once_initialize): Define.
2581 (once_pointer_control): New static variable.
2582 (once_pointer, once_arg): New static variables.
2583 (c_run_once): New static function.
2584 (Once::Once, Once::run_once, Once::internal_run): New functions.
2585 (class Initialize_lock_once): Remove.
2586 (initialize_lock_control): Remove.
2587 (initialize_lock_pointer): Remove.
2588 (initialize_lock_once): Remove.
2589 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
2590 (Initialize_lock::initialize): Rewrite.
2591 (Initialize_lock::do_run_once): New function.
2592 * archive.cc (Archive::interpret_header): Only clear name if it is
2594 * fileread.cc: Include "gold-threads.h"
2595 (file_counts_lock): New static variable.
2596 (file_counts_initialize_lock): Likewise.
2597 (File_read::release): Only increment counts when using --stats.
2598 Use a lock around the increment.
2599 * parameters.cc (class Set_parameters_target_once): Define.
2600 (set_parameters_target_once): New static variable.
2601 (Parameters::Parameters): Move here from parameters.h.
2602 (Parameters::set_target): Rewrite.
2603 (Parameters::set_target_once): New function.
2604 (Parameters::clear_target): Move here and rewrite.
2605 * parameters.h (class Parameters): Update declarations. Add
2606 set_parameters_target_once_ field.
2607 (Parameters::Parameters): Move to parameters.cc.
2608 (Parameters::clear_target): Likewise.
2609 * readsyms.cc (Read_symbols::do_group): Create a Start_group
2611 (Start_group::~Start_group): New function.
2612 (Start_group::is_runnable): New function.
2613 (Start_group::locks, Start_group::run): New functions.
2614 (Finish_group::run): Change saw_undefined to size_t.
2615 * readsyms.h (class Start_group): Define.
2616 (class Finish_group): Change saw_undefined_ field to size_t.
2617 (Finish_group::Finish_group): Remove saw_undefined and
2618 this_blocker parameters. Change all callers.
2619 (Finish_group::set_saw_undefined): New function.
2620 (Finish_group::set_blocker): New function.
2621 * symtab.h (class Symbol_table): Change saw_undefined to return
2622 size_t. Change saw_undefined_ field to size_t.
2623 * target-select.cc (Set_target_once::do_run_once): New function.
2624 (Target_selector::Target_selector): Initialize set_target_once_
2625 field. Don't initialize lock_ and initialize_lock_ fields.
2626 (Target_selector::instantiate_target): Rewrite.
2627 (Target_selector::set_target): New function.
2628 * target-select.h (class Set_target_once): Define.
2629 (class Target_selector): Update declarations. Make
2630 Set_target_once a friend. Remove lock_ and initialize_lock_
2631 fields. Add set_target_once_ field.
2633 2010-02-10 Ian Lance Taylor <iant@google.com>
2635 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
2637 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
2638 (queue_middle_tasks): Add all blockers before queueing any tasks.
2639 (queue_final_tasks): Likewise.
2640 * token.h (Task_token::add_blockers): New function.
2641 * object.h (Input_objects::number_of_relobjs): New function.
2643 2010-02-10 Ian Lance Taylor <iant@google.com>
2645 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
2646 shared, not if not position independent.
2647 * x86_64.cc (Relocate::relocate_tls): Likewise.
2648 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
2649 (tls_pie_pic_test): New target.
2650 * testsuite/Makefile.in: Rebuild.
2652 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
2653 (tls_test_main_pie.o, tls_test_pie.o): New targets.
2654 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
2655 * testsuite/Makefile.in: Rebuild.
2657 2010-02-09 David S. Miller <davem@davemloft.net>
2659 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
2660 R_SPARC_RELATIVE using ->add_local_relative().
2661 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
2663 * output.h (Output_data_dynamic::add_section_size): New method
2664 that takes two Output_data objects.
2665 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
2666 entry param. Handle it in initializers.
2667 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
2668 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
2669 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
2671 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
2672 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
2673 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
2674 for dynrel_includes_plt.
2675 * i386.cc (Target_i386::do_finalize_sections): Likewise.
2676 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2677 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
2679 (Target_sparc::do_finalize_sections): Update to pass true for
2680 dynrel_includes_plt.
2681 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
2682 output before .rela.plt
2683 (Target_powerpc::do_finalize_sections): Update to pass true for
2684 dynrel_includes_plt when 32-bit.
2686 2010-02-08 Doug Kwan <dougkwan@google.com>
2688 * arm.cc (Arm_relobj::simple_input_section_output_address): New
2690 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
2691 Arm_relobj::scan_section_for_cortex_a8_stubs,
2692 Arm_relobj::do_relocation_section): Instead of calling
2693 Output_section::output_address, use faster
2694 Arm_relobj::simple_input_section_output_address.
2696 2010-02-08 David S. Miller <davem@davemloft.net>
2698 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
2699 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
2700 relocation helper function.
2702 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
2703 just like R_SPARC_GOT{10,13,22}.
2704 (Target_sparc::Scan::local): Likewise.
2705 (Target_sparc::Relocate:relocate): Likewise.
2707 2010-02-06 Ian Lance Taylor <iant@google.com>
2709 * configure.ac: Rewrite targetobjs duplicate removal code to use
2710 only shell constructs.
2711 * configure: Rebuild.
2713 2010-02-05 Doug Kwan <dougkwan@google.com>
2716 * arm.cc (Arm_relobj::section_is_scannable): New method.
2717 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
2718 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
2720 2010-02-04 Doug Kwan <dougkwan@google.com>
2723 * arm-reloc-property.cc (cstdio): Include.
2724 * configure.ac (targetobjs): Remove duplicates.
2725 * configure: Regenerate.
2726 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
2727 big and little endian version for a given address size.
2729 2010-02-03 Doug Kwan <dougkwan@google.com>
2731 * arm-reloc-property.cc
2732 (Arm_reloc_property_table::reloc_name_in_error_message): New method
2734 * arm-reloc-property.h
2735 (Arm_reloc_property_table::get_implemented_static_reloc_property):
2736 New method definition.
2737 (Arm_reloc_property_table::reloc_name_in_error_message): New method
2739 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
2741 (GOT_PREL): Change implemented to Y.
2742 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
2743 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
2744 (Arm_relocate_functions::movw_abs_nc): Remove method.
2745 (Arm_relocate_functions::movt_abs): Ditto.
2746 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
2747 (Arm_relocate_functions::thm_movt_abs): Ditto.
2748 (Arm_relocate_functions::movw_rel_nc): Ditto.
2749 (Arm_relocate_functions::movw_rel): Ditto.
2750 (Arm_relocate_functions::movt_rel): Ditto.
2751 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
2752 (Arm_relocate_functions:thm_movw_rel): Ditto.
2753 (Arm_relocate_functions:thm_movt_rel): Ditto.
2754 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
2755 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
2756 New method definitions.
2757 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
2758 (Arm_relocation_functions::arm_grp_ldr): Ditto.
2759 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
2760 (Arm_relocation_functions::arm_grp_ldc): Ditto.
2761 (Target_arm::Relocate::relocate): Check for non-static or
2762 unimplemented relocation code and exit early. Change calls to
2763 Target_arm::reloc_uses_thumb_bit and
2764 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
2765 instead. Refactor code to handle similar relocations to increase
2766 code sharing. Remove check for unsupported relocation code in switch
2768 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
2769 relocation property table to find out size. Change error message to
2770 print out the name of a relocation code instead of the numeric value.
2771 (Target_arm::scan_reloc_for_stub): Use relocation property table
2772 instead of calling Target_arm::reloc_uses_thumb_bit().
2774 2010-02-02 Doug Kwan <dougkwan@google.com>
2776 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
2777 types of relaxed input section.
2779 2010-02-02 Doug Kwan <dougkwan@google.com>
2781 * Makefile.am (HFILES): Add arm-reloc-property.h.
2783 (TARGETSOURCES): Add arm-reloc-property.cc
2784 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
2785 (libgold_a_SOURCES): $(DEFFILES)
2786 * Makefile.in: Regenerate.
2787 * arm-reloc-property.cc: New file.
2788 * arm-reloc-property.h: New file.
2789 * arm-reloc.def: New file.
2790 * arm.cc: Update comments.
2791 (arm-reloc-property.h): New included header.
2792 (arm_reloc_property_table): New global variable.
2793 (Target_arm::do_select_as_default_target): New method definition.
2794 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
2795 arm-reloc-property to targ_extra_obj.
2796 * parameters.cc (set_parameters_target): Call
2797 Target::select_as_default_target().
2798 * target.h (Target::select_as_default_target): New method definition.
2799 (Target::do_select_as_default_target): Same.
2801 2010-02-01 Doug Kwan <dougkwan@google.com>
2803 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
2804 first_output_text_section_.
2805 (Arm_exidx_fixup::first_output_text_section): New method definition.
2806 (Arm_exidx_fixup::first_output_text_section_): New data member.
2807 (Arm_exidx_fixup::process_exidx_section): Record the first text
2808 output section seen.
2809 (Arm_output_section::fix_exidx_coverage): Set correct linked section
2810 and entsize in output section header.
2812 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2814 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
2815 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
2816 (Arm_relocate_functions::thm_alu11): New Method.
2817 (Arm_relocate_functions::thm_pc8): New Method.
2818 (Arm_relocate_functions::thm_pc12): New Method.
2819 (Target_arm::Scan::local): Handle the relocations.
2820 (Target_arm::Scan::global): Likewise.
2821 (Target_arm::Relocate::relocate): Likewise.
2822 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
2824 2010-01-29 Doug Kwan <dougkwan@google.com>
2826 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
2827 of relocation types as ld.
2829 2010-01-29 Doug Kwan <dougkwan@google.com>
2831 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
2833 (Arm_relocate_functions::thumb_branch_common): Ditto.
2834 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
2835 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
2836 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
2837 Arm_relocate_functions::jump24): Remove.
2838 (Target_arm::Relocate::relocate): Adjust code to call
2839 Arm_relocation_functions::arm_branch_common and
2840 Arm_relocation_functions::thumb_branch_common instead of their removed
2841 wrappers. Merge switch-cases together to reduce source code size.
2843 2010-01-29 Doug Kwan <dougkwan@google.com>
2845 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
2846 output_local_symbol_count_needs_update_.
2847 (Arm_relobj::output_local_symbol_count_needs_update,
2848 Arm_relobj::set_output_local_symbol_count_needs_update,
2849 Arm_relobj::update_output_local_symbol_count): New methods.
2850 (Arm_relobj::output_local_symbol_count_needs_update_): New data
2852 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
2853 of pointed function as in a R_ARM_PREL31 relocation.
2854 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
2855 for output local symbol count updating.
2856 (Target_arm::do_relax): Update output local symbol counts in objects
2858 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
2860 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2862 * arm.cc: Added support for the ARM relocations:
2863 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
2864 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
2865 (Arm_relocate_functions::movw_rel_nc): Renamed (was
2867 (Arm_relocate_functions::movw_rel): New method.
2868 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
2869 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
2871 (Arm_relocate_functions::thm_movw_rel): New method.
2872 (Arm_relocate_functions::thm_movt_rel): Renamed (was
2874 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
2876 (Target_arm::Scan::global): Likewise.
2877 (Target_arm::Relocate::relocate): Likewise.
2878 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
2881 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2883 * arm.cc: Added support for ARM group relocations.
2884 (Target_arm::reloc_needs_sym_origin): New method.
2885 (Arm_relocate_functions::calc_grp_kn): New method.
2886 (Arm_relocate_functions::calc_grp_residual): New method.
2887 (Arm_relocate_functions::calc_grp_gn): New method.
2888 (Arm_relocate_functions::arm_grp_alu): New Method.
2889 (Arm_relocate_functions::arm_grp_ldr): New Method.
2890 (Arm_relocate_functions::arm_grp_ldrs): New Method.
2891 (Arm_relocate_functions::arm_grp_ldc): New Method.
2892 (Target_arm::Scan::local): Handle the ARM group relocations.
2893 (Target_arm::Scan::global): Likewise.
2894 (Target_arm::Relocate::relocate): Likewise.
2895 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
2898 2010-01-26 Doug Kwan <dougkwan@google.com>
2900 * arm.cc (set): Include.
2901 (class Arm_exidx_fixup): Change type of last_input_section_ to const
2903 (Arm_output_section::Text_section_list): New type.
2904 (Arm_output_section::append_text_sections_to_list): New method.
2905 (Arm_output_section::fix_exidx_coverage): Ditto.
2906 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
2907 (Arm_relobj::convert_input_section_to_relaxed_section): Use
2908 Relobj::set_section_offset() instead of
2909 Sized_relobj::invalidate_section_offset().
2910 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
2911 parameter for section headers. Ignore relocation sections for
2912 unallocated sections and EXIDX sections.
2913 (Target_arm::fix_exidx_coverage): New method.
2914 (Target_arm::output_section_address_less_than): New type.
2915 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
2916 linked text section instead of the EXIDX section.
2917 (Arm_output_section::create_stub_group): Add an assertion to check
2918 that this is not an EXIDX output section.
2919 (Arm_output_section::append_text_sections_to_list): New method.
2920 (Arm_output_section::fix_exidx_coverage): Ditto.
2921 (Arm_relobj::scan_sections_for_stubs): Adjust call to
2922 Arm_relobj::section_needs_reloc_stub_scanning.
2923 (Target_arm::do_relax): Fix EXIDX output section coverage in the
2925 (Target_arm::fix_exidx_coverage): New method.
2926 * object.h (Relobj::set_output_section): New method.
2927 (Sized_relobj::invalidate_section_offset): Remove method.
2928 (Sized_relobj::do_invalidate_section_offset): Remove method.
2929 (Sized_relobj::do_set_section_offset): Handle offset value -1.
2931 2010-01-25 Doug Kwan <dougkwan@google.com>
2933 * arm.cc (Arm_exidx_merged_section::do_output_offset):
2934 Fix warning due to signed and unsigned comparison on a 32-bit host.
2936 2010-01-22 Doug Kwan <dougkwan@google.com>
2938 * arm.cc (Target_arm::do_relax): Record an output section for section
2939 offset adjustment it contains any stub table that has changed.
2940 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
2941 offsets in an output section if necessary.
2942 * output.cc (Output_section::Output_section): Initialize
2943 section_offsets_need_adjustments_.
2944 (Output_section::add_input_section_for_script): Renamed to
2945 Output_section::add_simple_input_section.
2946 (Output_section::save_states): Add a comment.
2947 (Output_section::discard_states): New method defintion.
2948 (Output_section::adjust_section_offsets): Same.
2949 * output.h (Output_section::add_input_section_for_script): Renamed to
2950 Output_section::add_simple_input_section.
2951 (Output_section::discard_states): New method declaration.
2952 (Output_section::adjust_section_offsets): Same.
2953 (Output_section::section_offsets_need_adjustment,
2954 Output_section::set_section_offsets_need_adjustment): New method
2956 (Output_section::section_offsets_need_adjustment_): New data member.
2957 * script-sections.cc
2958 (Output_section_element_input::set_section_address): Adjust code for
2959 renaming of Output_section::add_input_section_for_script.
2960 (Orphan_output_section::set_section_address): Same.
2962 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2964 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
2965 Fix_v4bx enum values .
2966 * gold/options.h (General_options): New option definitions.
2967 (General_options::fix_v4bx): New method.
2968 (General_options::Fix_v4bx): New enum.
2969 * gold/options.cc (General_options::parse_fix_v4bx): New method.
2970 (General_options::parse_fix_v4bx_interworking): New method.
2972 2010-01-22 Doug Kwan <dougkwan@google.com>
2974 * arm.cc (Arm_exidx_fixup): New class.
2976 2010-01-21 Doug Kwan <dougkwan@google.com>
2978 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
2980 (Arm_exidx_section_offset_map): New type.
2982 2010-01-21 Doug Kwan <dougkwan@google.com>
2984 * arm.cc (Arm_exidx_input_section): New class.
2985 (Arm_relobj::exidx_input_section_by_link,
2986 Arm_relobj::exidx_input_section_by_shndx,
2987 Arm_relobj::make_exidx_input_section): New methods.
2988 (read_arm_attributes_section): Remove.
2989 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
2990 information about them.
2991 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
2994 2010-01-20 Doug Kwan <dougkwan@google.com>
2996 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
2997 Input_section_specifier to Section_id.
2998 (Target_arm::new_arm_input_section: Adjust code for change of key
3000 (Target_arm::find_arm_input_section): Ditto.
3001 * gc.h (object.h): Include for Section_id nand Section_id_hash.
3002 (Section_id): Remove.
3003 (Garbage_collection::Section_id_hash): Remove.
3004 * icf.h (object.h): Include for Section_id nand Section_id_hash.
3005 (Section_id): Remove.
3006 (Icf::Section_id_hash): Remove.
3007 * object.h (Section_id, Const_section_id, Section_id_hash,
3008 Const_section_id_hash): New type definitions.
3009 * output.cc (Output_section::add_relaxed_input_section): Change to
3010 use Const_section_id instead of Input_section_specifier as key type.
3011 (Output_section::add_merge_input_section): Ditto.
3012 (Output_section::build_relaxation_map): Change to use Section_id
3013 instead of Input_section_specifier as key type.
3014 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3016 (Output_section::convert_input_sections_to_relaxed_sections): Change
3017 to use Const_section_id instead of Input_section_specifier as key type.
3018 (Output_section::find_merge_section): Ditto.
3019 (Output_section::find_relaxed_input_section): Ditto.
3020 * output.h (Input_section_specifier): Remove class.
3021 (Output_section::Output_section_data_by_input_section_map): Change
3022 key type to Const_section_id.
3023 (Output_section::Output_relaxed_input_section_by_input_section_map):
3025 (Output_section::Relaxation_map): Change key type to Section_id.
3027 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3029 * gold/arm.cc: Added support for R_ARM_V4BX relocation
3030 (class Arm_v4bx_stub): New class.
3031 (DEF_STUBS): Updated definition to support v4_veneer_bx.
3032 (Stub_factory::make_arm_v4bx_stub): New method.
3033 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
3034 (Stub_table::empty): Handle v4bx stubs.
3035 (Stub_table::add_arm_v4bx_stub): New method.
3036 (Stub_table::find_arm_v4bx_stub): New method.
3037 (Arm_relocate_functions::v4bx): New method.
3038 (Target_arm::fix_v4bx): New method.
3039 (Target_arm::Target_arm): Handle R_ARM_V4BX.
3040 (Stub_table::relocate_stubs): Likewise.
3041 (Stub_table::do_write): Likewise.
3042 (Stub_table::update_data_size_and_addralign): Likewise.
3043 (Stub_table::finalize_stubs): Likewise.
3044 (Target_arm::Scan::local): Likewise.
3045 (Target_arm::Scan::global): Likewise.
3046 (Target_arm::do_finalize_sections): Likewise.
3047 (Target_arm::Relocate::relocate): Likewise.
3048 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
3050 (Target_arm::scan_reloc_for_stub): Likewise.
3051 (Target_arm::scan_reloc_section_for_stubs): Likewise.
3053 2010-01-19 Ian Lance Taylor <iant@google.com>
3055 * output.cc (Output_section_headers::do_sized_write): Write large
3056 segment count to sh_info field.
3057 (Output_file_header::do_sized_write): For large segment count,
3058 write PN_XNUM to e_phnum field.
3060 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3062 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
3063 (Arm_relocate_functions::thm_jump8): New function.
3064 (Arm_relocate_functions::thm_jump11): New function.
3065 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
3067 (Target_arm::Scan::global): Likewise.
3068 (Target_arm::Relocate::relocate): Likewise.
3069 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
3072 2010-01-14 Doug Kwan <dougkwan@google.com>
3074 * arm.cc (map, utility): Include headers.
3075 (Target_arm::apply_cortex_a8_workaround): New method.
3076 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
3077 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
3078 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
3079 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
3080 the --[no-]fix-cortex-a8 command line options.
3081 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
3082 (Target_arm::relocate_stub): Use addend in instruction template.
3083 * options.h (DEFINE_bool): Set the user-set flag.
3084 (General_options): Add --[no-]-fix-cortex options.
3085 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
3086 : Update fast look-up map after conversion.
3088 2010-01-14 Sriraman Tallam <tmsriram@google.com>
3090 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
3091 in the first pass of do_layout.
3093 2010-01-13 Doug Kwan <dougkwan@google.com>
3095 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
3096 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
3097 apparent compiler problem of not folding static constant integral
3098 data members of elfcpp::Elf_sizes<32>.
3100 2010-01-13 Doug Kwan <dougkwan@google.com>
3102 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
3103 Arm_relobj::section_needs_cortex_a8_stub_scanning,
3104 Arm_relobj::scan_section_for_cortex_a8_erratum,
3105 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
3106 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
3107 sections to scan for relocation stubs into a new method
3108 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
3109 relocation and Cortex-A8 stub scanning.
3110 (Target_arm::do_relax): Force stubs to be after stubbed sections
3111 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
3112 the beginning of a new relaxation pass. Update a comment.
3113 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
3115 2010-01-12 Ian Lance Taylor <iant@google.com>
3117 * target-reloc.h (visibility_error): New inline function.
3118 (relocate_section): Call visibility_error.
3119 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
3120 (MOSTLYCLEANFILES): Likewise.
3121 (protected_4_pic.o, protected_3.err): New targets.
3122 * testsuite/protected_4.cc: New file.
3124 2010-01-12 Doug Kwan <dougkwan@google.com>
3126 * arm.cc (Cortex_a8_reloc): New class.
3127 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
3128 and cortex_a8_relocs_info_.
3129 (Target_arm::fix_cortex_a8): New method definition.
3130 (Target_arm::Cortex_a8_relocs_info): New type.
3131 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
3132 New data member declarations.
3133 (Target_arm::scan_reloc_for_stub): Record information about
3134 relocations for THUMB branches that might be exempted from the
3135 Cortex-A8 workaround.
3136 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
3137 at the beginning of a relaxation pass.
3139 2010-01-12 Doug Kwan <dougkwan@google.com>
3141 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
3142 (Arm_relobj::Mapping_symbol_position,
3143 Arm_reloj::Mapping_symbol_position_less,
3144 Arm_relobj::Mapping_symbols_info): New types.
3145 (Target_arm::is_mapping_symbol_name): New method definition.
3146 (Arm_relobj::do_count_local_symbols): Save information about mapping
3149 2010-01-11 Doug Kwan <dougkwan@google.com>
3151 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
3152 Arm_relocate_functions::thumb32_branch_upper,
3153 Arm_relocate_functions::thumb32_branch_lower,
3154 Arm_relocate_functions::thumb32_cond_branch_offset,
3155 Arm_relocate_functions::thumb32_cond_branch_upper,
3156 Arm_relocate_functions::thumb32_cond_branch_lower,
3157 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
3158 branch offset encoding.
3159 (Arm_relocate_functions::thumb_branch_common): Use new branch
3160 offset encoding methods to avoid code duplication.
3161 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
3162 (Stub_addend_reader::operator()): Use new branch encoding method
3163 to avoid code duplication.
3165 2010-01-11 Doug Kwan <dougkwan@google.com>
3167 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
3168 (Target_arm::do_finalize_sections): Define special EXIDX section
3169 symbols only if referenced.
3170 * gc.h (Garbage_collection::add_reference): New method.
3171 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
3174 2010-01-11 Ian Lance Taylor <iant@google.com>
3176 * script.cc (Version_script_info::build_expression_list_lookup):
3177 Change complaing about duplicate wildcard match from error to
3180 * script.cc (class Lazy_demangler): Recreate--revert part of patch
3182 (Version_script_info::Version_script_info): Initialize globs_,
3183 default_version_, default_is_global_, and exact_. Don't
3184 initialize globals_ or locals_.
3185 (Version_script_info::build_lookup_tables): Build local symbols
3187 (Version_script_info::unquote): New function.
3188 (Version_script_info::add_exact_match): New function.
3189 (Version_script_info::build_expression_list_lookup): Remove lookup
3190 parameter. Add is_global parameter. Change all callers. Handle
3191 wildcard pattern specially. Unquote pattern. Call
3193 (Version_script_info::get_name_to_match): New function.
3194 (Version_script_info::get_symbol_version): New function.
3195 (Version_script_info::get_symbol_version_helper): Remove.
3196 (Version_script_info::check_unmatched_names): Call unquote.
3197 * script.h (class Version_script_info): Change get_symbol_version
3198 to be non-inline and add is_global parameter; change all callers.
3199 Rewrite symbol_is_local. Update declarations. Define struct
3200 Version_tree_match, Exact, Globs. Don't define struct Lookup.
3201 Remove globals_ and locals_ members. Add exact_, globs_,
3202 default_version_, is_global_.
3203 (Version_script_info::Glob): Remove pattern, add expression and
3204 is_global. Update constructor. Change all callers.
3205 * dynobj.cc (Versions::finalize): Mark the version symbol as the
3207 (Versions::symbol_section_contents): If a symbol is undefined, or
3208 defined in a dynamic object, set the version index to
3210 * symtab.cc (Symbol_table::add_from_relobj): Don't call
3212 (Symbol_table::add_from_pluginobj): Likewise.
3213 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
3215 2010-01-11 Doug Kwan <dougkwan@google.com>
3217 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
3218 (incremental_dump_LDADD): Add linking option for libintl.
3219 * Makefile.in: Regenerate.
3221 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
3224 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
3226 * testsuite/Makefile.in: Regenerated.
3228 2010-01-10 Doug Kwan <dougkwan@google.com>
3230 * options.h (DEFINE_var): Use parentheses around argument varname__
3231 in macro body to avoid any unintended subsequent substitutions.
3233 2010-01-10 Ian Lance Taylor <iant@google.com>
3235 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
3236 candidates before doing symbol resolution.
3238 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
3239 ODR candidates if only one is weak.
3241 2010-01-08 Ian Lance Taylor <iant@google.com>
3243 * script.cc (Version_script_info::build_expression_list_lookup):
3244 Don't warn about ambiguous version, just record the ambiguity.
3245 (Version_script_info::get_symbol_version_helper): Give error if
3246 version is ambiguous.
3248 2010-01-08 Doug Kwan <dougkwan@google.com>
3250 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
3251 prev_data_size_ and prev_addralign_. Remove initializer for
3252 deleted data member has_been_changed_.
3253 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
3254 to determine if the table is empty.
3255 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
3257 (Stub_table::add_reloc_stub): Define method in class definition
3258 instead of just declaring it there.
3259 (Stub_table::add_cortex_a8_stub): New method definition.
3260 (Stub_table::update_data_size_and_addralign): Ditto.
3261 (Stub_table::finalize_stubs): Ditto.
3262 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
3263 (Stub_table::do_addralign_): Return address alignment in the
3264 (Stub_table::do_reset_address_and_file_offset): Define method in
3265 class definition instead of declaring it there. Set current data
3266 size to be the data size of the previous pass.
3267 (Stub_table::set_final_data_size): Use current data size as the
3269 (Stub_table::relocate_stub): Change parameter type of stub from
3270 Reloc_stub pointer to Stub pointer.
3271 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
3272 (Stub_table::Cortex_a8_stub_list): New typedef.
3273 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
3274 Stub_table::prev_addralign_): New data member.
3275 (Arm_relobj::Arm_relobj): Initialize data member
3276 section_has_cortex_a8_workaround_.
3277 (Arm_relobj::section_has_cortex_a8_workaround,
3278 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
3280 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
3282 (Target_arm::relocate_stub): Change parameter type of stub from
3283 Reloc_stub pointer to Stub pointer.
3284 (Insn_template::size, Insn_template::alignment): Handle
3285 THUMB16_SPECIAL_TYPE.
3286 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
3287 Stub_table::update_data_size_and_addralign,
3288 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
3290 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
3291 (Stub_table::do_write): Ditto.
3292 (Target_arm::do_relax): Adjust code for changes in Stub_table.
3294 2010-01-08 Ian Lance Taylor <iant@google.com>
3297 * symtab.h (class Symbol): Remove fields is_target_special_ and
3298 has_plt_offset_. Add field is_defined_in_discarded_section_.
3299 (Symbol::is_defined_in_discarded_section): New function.
3300 (Symbol::set_is_defined_in_discarded_section): New function.
3301 (Symbol::has_plt_offset): Rewrite.
3302 (Symbol::set_plt_offset): Verify that new offset is not -1U.
3303 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
3304 Don't initialize is_target_special_ or has_plt_offset_.
3305 Initialize is_defined_in_discarded_section_.
3306 (Symbol_table::add_from_relobj): If appropriate, set
3307 is_defined_in_discarded_section.
3308 * resolve.cc (Symbol::override_base_with_special): Don't test
3309 is_target_special_. Change has_plt_offset_ to has_plt_offset().
3310 * target-reloc.h (relocate_section): Do special handling for
3311 symbols defined in discarded sections for global symbols as well
3314 2010-01-08 Ian Lance Taylor <iant@google.com>
3316 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
3317 the SHT_SYMTAB case.
3319 2010-01-08 Ian Lance Taylor <iant@google.com>
3321 * object.cc (Sized_relobj::do_layout): Don't get confused if
3322 layout_eh_frame returns NULL.
3324 2010-01-08 Ian Lance Taylor <iant@google.com>
3327 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
3328 dynamic symbol table, use the normal symbol table.
3329 (Sized_dynobj::do_read_symbols): Remove assertion about type of
3332 2010-01-08 Ian Lance Taylor <iant@google.com>
3335 * layout.cc (Layout::include_section): Remove .gnu_debuglink
3338 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
3340 * version.cc (print_version): Change to "Copyright 2010".
3342 2010-01-08 Ian Lance Taylor <iant@google.com>
3346 * i386.cc (class Target_i386): Change return type of plt_section
3348 (class Output_data_plt_i386): Add tls_desc_rel_ field.
3349 (Output_data_plt_i386::Output_data_plt_i386): Initialize
3350 tls_desc_rel_ field.
3351 (Output_data_plt_i386::rel_tls_desc): New function.
3352 (Target_i386::rel_tls_desc_section): New function.
3353 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
3354 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
3355 R_386_TLS_DESC reloc in rel_tls_desc_section.
3356 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
3357 Define struct Tlsdesc_info.
3358 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
3359 (Target_x86_64::do_reloc_symbol_index): New function.
3360 (Target_x86_64::add_tlsdesc_info): New function.
3361 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
3362 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
3364 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
3366 (Output_data_plt_x86_64::rela_tlsdesc): New function.
3367 (Target_x86_64::rela_tlsdesc_section): New function.
3368 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
3370 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
3371 (Target_x86_64::do_reloc_addend): New function.
3372 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
3373 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
3374 declarations. Define TARGET_CODE. Add arg field to u1_ union.
3375 (Output_reloc::type): New function.
3376 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
3377 (Output_reloc::is_target_specific): New function.
3378 (Output_reloc::target_arg): New function.
3379 (class Output_reloc) [SHT_RELA]: Add four new constructors for
3380 absolute relocs and target specific relocs.
3381 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
3382 add_target_specific.
3383 (class Output_data_reloc) [SHT_RELA]: Likewise.
3384 * output.cc (Output_reloc::Output_reloc): Add four new versions
3385 for absolute relocs and target specific relocs.
3386 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
3387 (Output_reloc::get_symbol_index): Likewise.
3388 (Output_reloc::local_section_offset): Check that local_sym_index_
3389 is not TARGET_CODE or 0.
3390 (Output_reloc::symbol_value): Likewise.
3391 (Output_reloc::write) [SHT_RELA]: Call target for target specific
3393 * target.h (class Target): Add reloc_symbol_index and reloc_addend
3394 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
3396 * layout.cc (add_target_dynamic_tags): Use output section for
3397 DT_PLTRELSZ and DT_JMPREL.
3399 2010-01-07 Ian Lance Taylor <iant@google.com>
3402 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
3404 (class Output_data_reloc_generic): Define.
3405 (class Output_data_reloc_base): Change base class to
3406 Output_data_reloc_generic. Change add() method to call
3407 bump_relative_reloc_count for a relative reloc. Remove
3409 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
3411 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
3412 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
3414 * layout.h (class Layout): Update declaration.
3416 2010-01-07 Ian Lance Taylor <iant@google.com>
3418 * output.h (class Output_data): Add const version of
3419 output_section and do_output_section.
3420 (class Output_section_data): Add const version of
3422 (class Output_section): Likewise.
3423 * layout.cc (Layout::add_target_dynamic_tags): New function.
3424 * layout.h (class Layout): Update declarations.
3425 * arm.cc (Target_arm::do_finalize_sections): Use
3426 add_target_dynamic_tags.
3427 * i386.cc (Target_i386::do_finalize_sections): Likewise.
3428 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
3429 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
3430 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3432 2010-01-07 Ian Lance Taylor <iant@google.com>
3435 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
3438 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
3439 Ian Lance Taylor <iant@google.com>
3442 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
3443 Xindex::read_symtab_xindex.
3445 2010-01-07 Doug Kwan <dougkwan@google.com>
3447 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
3448 (Insn_template::thumb16_bcond_insn): New method declaration.
3449 (Insn_template): Fix spelling.
3450 (Stub::thumb16_special): New method declaration.
3451 (Stub::do_write): Define virtual method which was previously pure
3453 (Stub::do_thumb16_special): New method declaration.
3454 (Stub::do_fixed_endian_write): New template member.
3455 (Reloc_stub::do_write): Remove.
3456 (Reloc_stub::do_fixed_endian_write): Remove.
3457 (Cortex_a8_stub): New class definition.
3458 (Stub_factory::make_cortex_a8_stub): New method definition.
3459 (Stub_factory::Stub_factory): Add missing static storage class
3460 qualifier for elf32_arm_stub_a8_veneer_blx.
3462 2010-01-07 Ian Lance Taylor <iant@google.com>
3465 * options.h (class General_options): Add --warn-unresolved-symbols
3466 and --error-unresolved-symbols.
3467 * errors.cc (Errors::undefined_symbol): Implement
3468 --warn-unresolved-symbols.
3470 * options.h (class General_options): Add -z text and -z textoff.
3471 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
3473 2010-01-06 Sriraman Tallam <tmsriram@google.com>
3475 * gc.h (Garbage_collection::Cident_section_map): New typedef.
3476 (Garbage_collection::cident_sections): New function.
3477 (Garbage_collection::add_cident_section): New function.
3478 (Garbage_collection::cident_sections_): New member.
3479 (gc_process_relocs): Add references to sections whose names are C
3481 * gold.h (cident_section_start_prefix): New constant.
3482 (cident_section_stop_prefix): New constant.
3483 (is_cident): New function.
3484 * layout.cc (Layout::define_section_symbols): Replace string constants
3485 with the newly defined constants.
3486 * object.cc (Sized_relobj::do_layout): Track sections whose names are
3488 * testsuite/Makefile.am: Add gc_orphan_section_test.
3489 * testsuite/Makefile.in: Regenerate.
3490 * testsuite/gc_orphan_section_test.cc: New file.
3491 * testsuite/gc_orphan_section_test.sh: New file.
3493 2010-01-06 Ian Lance Taylor <iant@google.com>
3496 * options.h (class General_options): Add --warn-shared-textrel.
3497 * layout.cc (Layout::finish_dynamic_section): Implement
3498 --warn-shared-textrel.
3501 * options.h (class General_options): Add --warn-multiple-gp.
3503 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3505 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
3506 $(THREADSLIB) and $(LIBDL).
3507 * Makefile.in: Rebuild.
3509 2010-01-06 Ian Lance Taylor <iant@google.com>
3512 * options.cc (General_options::parse_section_start): New function.
3513 (General_options::section_start): New function.
3514 (General_options::General_options): Initialize all members.
3515 * options.h: Include <map>
3516 (class General_options): Add --section-start. Add section_starts_
3518 * layout.cc (Layout::attach_allocated_section_to_segment): If
3519 --section-start was used, set the address of the segment. Remove
3520 local sort_sections.
3521 (Layout::relaxation_loop_body): If the address of the load segment
3522 has been set by --section-start, don't use it.
3523 * output.h (Output_segment::update_flags_for_output_section): New
3525 * output.cc (Output_segment::add_output_section): Call
3526 update_flags_for_output_section.
3528 2010-01-05 Ian Lance Taylor <iant@google.com>
3531 * options.h (class General_options): Add --undefined-version.
3532 * script.cc (struct Version_expression): Add was_matched_by_symbol
3534 (Version_script_info::matched_symbol): New function.
3535 (Version_script_info::get_symbol_version_helper): Call
3537 (Version_script_info::check_unmatched_names): New function.
3538 * script.h (class Version_script_info): Update declarations.
3539 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
3541 * options.h (class General_options): Use DEFINE_bool_alias for
3542 allow_multiple_definition.
3543 * resolve.cc (Symbol_table::should_override): Don't test
3544 allow_multiple_definition.
3547 * options.h (class General_options): Add --cref.
3548 * main.cc (main): Print cref table if --cref. Don't close mapfile
3549 until after printing cref table.
3550 * cref.cc: Include "symtab.h".
3551 (class Cref_inputs): Define Cref_table_compare and Cref_table.
3552 (Cref_table_compare::operator()): New function.
3553 (Cref_inputs::gather_cref): New function.
3554 (filecol): New static const.
3555 (Cref_inputs::print_cref): New function.
3556 (Cref::print_cref): New function.
3557 * cref.h: Include <cstdio>.
3558 (class Cref): Update declarations.
3559 * mapfile.h (Mapfile::file): New function.
3560 * object.h (class Object): Define Symbols. Declare virtual
3561 do_get_global_symbols.
3562 (Object::get_global_symbols): New function.
3563 * object.cc (Input_objects::add_object): Pass object to cref_ if
3565 (Input_objects::archive_start): Likewise.
3566 (Input_objects::archive_stop): Likewise.
3567 (Input_objects::print_cref): New function.
3568 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
3569 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
3571 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
3573 * plugin.h (class Sized_pluginobj): Update declarations.
3575 2010-01-05 Ian Lance Taylor <iant@google.com>
3577 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
3578 to is_default_version. Rename insdef to insdefault.
3579 (Symbol_table::add_from_relobj): Rename def to is_default_version
3580 and local to is_forced_local.
3581 (Symbol_table::add_from_pluginobj): Likewise.
3582 (Symbol_table::add_from_dynobj): Likewise.
3583 (Symbol_table::define_special_symbol): Rename insdef to
3586 2010-01-04 Ian Lance Taylor <iant@google.com>
3589 * options.h (class General_options): Add
3590 --allow-multiple-definition and -z muldefs.
3591 * resolve.cc (Symbol_table::should_override): Don't warn about a
3592 multiple symbol definition if --allow-multiple-definition or -z
3596 * options.h (class General_options): Add --add-needed and
3597 --copy-dt-needed-entries. Tweak --as-needed help entry.
3598 * object.cc (Input_objects::check_dynamic_dependencies): Give an
3599 error if --copy-dt-needed-entries aka --add-needed is used and
3600 would cause a change in behaviour.
3603 * options.h (class General_options): Add -G as a short version of
3604 --shared. Add no-op options -assert, -g, and -i.
3606 2010-01-04 Sriraman Tallam <tmsriram@google.com>
3608 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
3609 check for .text or .gnu.linkonce.t sections.
3610 * icf.cc (Icf::find_identical_sections): Ditto.
3611 Change the detection for mangled function name within the section
3613 * icf.h (is_section_foldable_candidate): New function.
3615 2009-12-30 Ian Lance Taylor <iant@google.com>
3618 * options.h (class General_options): Permit two dashes with
3619 --retain-symbols-file.
3621 2009-12-30 Ian Lance Taylor <iant@google.com>
3624 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
3625 don't put the file header and segment headers in the text
3629 * common.cc (Sort_commons::operator()): Stabilize sort when both
3631 (Symbol_table::do_allocate_commons_list): When allocating common
3632 symbols, skip a symbol which is no longer common.
3633 * symtab.h (Symbol::is_common): Test whether the symbol comes from
3634 an object before checking its type.
3635 * testsuite/common_test_2.c: New file.
3636 * testsuite/common_test_3.c: New file.
3637 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
3638 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
3639 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
3640 (common_test_2_pic.o, common_test_2.so): New targets.
3641 (common_test_3_pic.o, common_test_3.so): New targets.
3642 * testsuite/Makefile.in: Rebuild.
3645 * script.cc (read_input_script): If we see a new SECTIONS clause,
3646 and we have added an input section, give an error.
3647 * layout.h (class Layout): Add have_added_input_section function.
3648 Add have_added_input_section_ field.
3649 * layout.cc (Layout::Layout): Initialize
3650 have_added_input_section_.
3651 (Layout::layout): Set have_added_input_section_.
3652 (Layout::layout_eh_frame): Likewise.
3654 2009-12-30 Ian Lance Taylor <iant@google.com>
3657 * options.h (class General_options): Add --sort-common option.
3658 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
3659 * common.cc (Sort_common): Add sort_order parameter to
3660 constructor. Add sort_order_ field.
3661 (Sort_commons::operator): Check sort_order_.
3662 (Symbol_table::allocate_commons): Determine the sort order.
3663 (Symbol_table::do_allocate_commons): Add sort_order parameter.
3665 (Symbol_table::do_allocate_commons_list): Likewise.
3667 2009-12-30 Ian Lance Taylor <iant@google.com>
3670 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
3671 symbols from this object, don't change the visibility of an
3673 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
3675 2009-12-30 Ian Lance Taylor <iant@google.com>
3678 * script.h (class Version_script_info): Define Language enum.
3679 Update declarations. Define Glob, Exact, and Lookup types. Add
3680 new fields globals_, locals_, and is_finalized_.
3681 * script.cc: Various formatting fixes.
3682 (class Parser_closure): Change language_stack_ from a vector of
3683 std::string to one of Version_script_info::Language. Adjust all
3685 (class Lazy_demangler): Remove.
3686 (struct Version_expression): Change language from std::string to
3687 Version_script_info::Language.
3688 (Version_script_info::Version_script_info): New function.
3689 (Version_script_info::~Version_script_info): Don't call clear.
3690 (Version_script_info::finalize): New function.
3691 (Version_script_info::build_lookup_tables): New function.
3692 (Version_script_info::build_expression_list_lookup): New
3694 (Version_script_info::get_symbol_version_helper): Rewrite to use
3696 (Version_script_info::print_expression_list): Adjust to use
3697 Version_script_info::Language.
3698 (script_push_lex_into_version_mode): Check that the version script
3699 has not been finalized.
3700 (version_script_push_lang): Change language string to
3701 Version_script_info::Language.
3702 * options.cc (Command_line::version_script): New function.
3703 * options.h (class General_options): Add finalize_dynamic_list
3704 function. Change version_script from declaration to definition.
3705 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
3706 * testsuite/version_script.map: Remove duplicate def of foo.
3707 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
3709 * testsuite/Makefile.in: Rebuild.
3711 2009-12-30 Ian Lance Taylor <iant@google.com>
3714 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
3715 if the input symbol index is 0, make the output symbol index 0.
3717 2009-12-30 Ian Lance Taylor <iant@google.com>
3720 * options.h (class General_options): Add -x/--discard-all.
3721 * object.cc (Sized_relobj::do_count_local_symbols): Handle
3722 --discard-all. If the local symbol needs a dynamic entry, check
3723 that before handling --discard-locals.
3725 2009-12-30 Ian Lance Taylor <iant@google.com>
3728 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
3730 (Output_segment::add_output_section): Don't change the flags if
3734 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
3735 GNU hash table if they need a dynamic value. Otherwise, don't add
3736 them if they are defined in a dynamic object or are forced local.
3738 2009-12-29 Ian Lance Taylor <iant@google.com>
3741 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
3742 .gnu.hash table for a 32-bit target.
3745 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
3746 regular and a dynamic object only needs a dynamic symbol table
3747 entry if it is externally visible.
3750 * i386.cc (class Target_i386): Initialize global_offset_table_ in
3751 constructor. Add global_offset_table_ field.
3752 (Target_i386::got_section): Set global_offset_table_.
3753 (Target_i386::do_finalize_sections): Set global_offset_table_
3755 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
3756 in constructor. Add global_offset_table_ field.
3757 (Target_x86_64::got_section): Set global_offset_table_.
3758 (Target_x86_64::do_finalize_sections): Set global_offset_table_
3761 * layout.cc (Layout::Layout): Initialize increase_relro_.
3762 (Layout::get_output_section): Add is_relro, is_last_relro, and
3763 is_first_non_relro parameters. Change all callers.
3764 (Layout::choose_output_section): Likewise.
3765 (Layout::add_output_section_data): Likewise.
3766 (Layout::make_output_section): Likewise.
3767 (Layout::set_segment_offsets): Clear increase_relro when using a
3769 * layout.h (class Layout): Add increase_relro method. Add
3770 increase_relro_ field. Update declarations.
3771 * output.cc (Output_section::Output_section): Initialize
3772 is_last_relro_ and is_first_non_relro_.
3773 (Output_segment::add_output_section): Group relro sections is
3774 do_sort is true. Handle is_last_relro and is_first_non_relro.
3775 (Output_segment::maximum_alignment): Remove relro handling.
3776 (Output_segment::set_section_addresses): Add increase_relro
3777 parameter. Change all callers. Add initial alignment to align
3778 relro sections on separate page. Remove old relro handling.
3779 (Output_segment::set_section_list_addresses): Remove in_relro
3780 parameter. Change all callers.
3781 (Output_segment::set_offset): Add increase parameter. Change all
3782 callers. Remove old relro handling.
3783 * output.h (class Output_section): Add new methods: is_last_relro,
3784 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
3785 Add is_last_relro_ and is_first_non_relro_ fields.
3786 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
3787 Create separate .got.plt section. Call increase_relro.
3788 * x86_64.cc (Target_x86_64::got_section): Likewise.
3789 * testsuite/relro_script_test.t: Add .got.plt.
3792 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
3793 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
3794 (Layout::finalize): Call set_dynamic_symbol_size.
3795 (Layout::set_dynamic_symbol_size): New function.
3796 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
3797 set_dynamic_symbol_size.
3800 * output.h (class Output_section): Add is_entsize_zero_ field.
3801 * output.cc (Output_section::Output_section): Initialize
3803 (Output_section::set_entsize): If two different entsizes are
3804 requested, force it to zero.
3805 (Output_section::add_input_section): Set flags for .debug_str
3806 before updating section flags. Set entsize.
3807 (Output_section::update_flags_for_input_section): Set SHF_MERGE
3808 and SHF_STRING if all input sections have those flags.
3810 2009-12-29 Rafael Espindola <espindola@google.com>
3812 * main.cc (main): Fix the sys time reporting.
3813 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
3816 2009-12-29 Sriraman Tallam <tmsriram@google.com>
3818 * options.cc (General_options::parse_version): Allow -v to exit
3819 without an error if there is nothing to link.
3821 2009-12-29 Ian Lance Taylor <iant@google.com>
3823 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
3824 using a version of gcc before 4.1.
3825 * configure: Rebuild.
3827 2009-12-28 Chris Demetriou <cgd@google.com>
3829 * attributes.cc (Output_attributes_section_data::do_write): Use
3830 std::vector::front rather than std::vector::data.
3832 2009-12-28 Ian Lance Taylor <iant@google.com>
3834 * symtab.h (class Symbol_table): Add enum Defined.
3835 * resolve.cc (Symbol_table::should_override): Add defined
3836 parameter. Change all callers. Test whether object is NULL
3837 before calling a method on it.
3838 (Symbol_table::report_resolve_problem): Add defined parameter.
3840 (Symbol_table::should_override_with_special): Likewise.
3841 * symtab.cc (Symbol_table::define_in_output_data): Add defined
3842 parameter. Change all callers.
3843 (Symbol_table::do_define_in_output_data): Likewise.
3844 (Symbol_table::define_in_output_segment): Likewise.
3845 (Symbol_table::do_define_in_output_segment): Likewise.
3846 (Symbol_table::define_as_constant): Likewise.
3847 (Symbol_table::do_define_as_constant): Likewise.
3848 * script.h (class Symbol_assignment): Add is_defsym parameter to
3849 constructor; change all callers.
3850 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
3851 parameter. Change all callers. Add is_defsym_ field.
3852 (class Parser_closure): Add parsing_defsym parameter to
3853 constructor; change all callers. Add parsing_defsym accessor
3854 function. Add parsing_defsym_ field.
3856 2009-12-28 Ian Lance Taylor <iant@google.com>
3858 * gold.cc (queue_middle_tasks): Fix formatting.
3859 * object.cc (Relobj::is_section_name_included): Likewise.
3861 2009-12-23 Ian Lance Taylor <iant@google.com>
3863 * i386.cc (Target_i386::do_calls_non_split): Recognize
3864 -fsplit-stack prologue for a function with a static chain.
3865 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
3866 -fsplit-stack prologue when using %r11.
3868 2009-12-21 Sriraman Tallam <tmsriram@google.com>
3870 * options.cc (General_options::parse_version): Make -v continue and do
3871 the link like GNU ld does.
3873 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
3875 * Makefile.am (CCFILES): Add timer.cc.
3876 (HFILES): Add timer.h.
3877 * configure.ac: Check for sysconf and times.
3878 * main.cc: include timer.h.
3879 (main): Use Timer instead of get_run_time.
3882 * workqueue.cc: include timer.h.
3883 (Workqueue::find_and_run_task):
3884 Report user, sys and wall time.
3885 * Makefile.in: Regenerate.
3886 * config.in: Regenerate.
3887 * configure: Regenerate.
3889 2009-12-16 Doug Kwan <dougkwan@google.com>
3891 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
3893 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
3894 relaxed input sections.
3895 * output.cc (Output_section::find_relaxed_input_section): Change
3896 return type to Output_relaxed_input_section pointer. Adjust code
3897 for new type of relaxed_input_section_map_.
3898 * output.h (Output_section::find_relaxed_input_section): Change
3899 return type to Output_relaxed_input_section pointer.
3900 (Output_section::Output_relaxed_input_section_by_input_section_map):
3902 (Output_section::relaxed_input_section_map_): Change type to
3903 Output_section::Output_relaxed_input_section_by_input_section_map.
3904 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
3907 2009-12-15 Ian Lance Taylor <iant@google.com>
3909 * layout.cc (Layout::create_shstrtab): Only write out after input
3910 sections if we are compressing debug sections.
3912 2009-12-15 Ian Lance Taylor <iant@google.com>
3914 * archive.cc (Archive::add_symbols): Only look up a symbol without
3915 a version if there is, in fact, a version.
3917 2009-12-14 Ian Lance Taylor <iant@google.com>
3919 Revert -Wshadow changes, all changes from:
3920 2009-12-11 Doug Kwan <dougkwan@google.com>
3921 2009-12-11 Nick Clifton <nickc@redhat.com>
3922 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
3924 2009-12-11 Doug Kwan <dougkwan@google.com>
3926 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
3928 * attributes.cc (Object_attribute::size): Ditto.
3929 (Attributes_section_data::size): Ditto.
3930 (Attributes_section_data::Attributes_section_data): Ditto.
3931 (Output_attributes_section_data::do_write): Ditto.
3932 * attributes.h (Object_attribute::set_type): Ditto.
3933 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
3935 2009-12-11 Nick Clifton <nickc@redhat.com>
3937 * archive.cc: Fix shadowed variable warnings.
3939 * compressed_output.cc: Likewise.
3940 * compressed_output.h: Likewise.
3941 * configure: Likewise.
3942 * dwarf_reader.cc: Likewise.
3943 * dynobj.cc: Likewise.
3944 * dynobj.h: Likewise.
3945 * ehframe.cc: Likewise.
3946 * ehframe.h: Likewise.
3947 * errors.cc: Likewise.
3948 * expression.cc: Likewise.
3949 * fileread.cc: Likewise.
3950 * fileread.h: Likewise.
3951 * freebsd.h: Likewise.
3952 * i386.cc: Likewise.
3954 * incremental.h: Likewise.
3955 * layout.cc: Likewise.
3956 * layout.h: Likewise.
3957 * mapfile.cc: Likewise.
3958 * merge.cc: Likewise.
3959 * merge.h: Likewise.
3960 * object.cc: Likewise.
3961 * object.h: Likewise.
3962 * options.h: Likewise.
3963 * output.cc: Likewise.
3964 * output.h: Likewise.
3965 * parameters.cc: Likewise.
3966 * plugin.cc: Likewise.
3967 * powerpc.cc: Likewise.
3968 * reduced_debug_output.cc: Likewise.
3969 * reduced_debug_output.h: Likewise.
3970 * reloc.cc: Likewise.
3971 * reloc.h: Likewise.
3972 * resolve.cc: Likewise.
3973 * script-sections.cc: Likewise.
3974 * script.cc: Likewise.
3975 * script.h: Likewise.
3976 * sparc.cc: Likewise.
3977 * symtab.cc: Likewise.
3978 * symtab.h: Likewise.
3979 * target-select.cc: Likewise.
3980 * target-select.h: Likewise.
3981 * token.h: Likewise.
3982 * workqueue.cc: Likewise.
3983 * workqueue.h: Likewise.
3984 * x86_64.cc: Likewise.
3986 2009-12-10 Doug Kwan <dougkwan@google.com>
3988 * arm.cc (attributes.h): New include.
3989 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
3990 (Arm_relobj::~Arm_relobj): Delete object pointed by
3991 attributes_section_data_.
3992 (Arm_relobj::attributes_section_data): New method definition.
3993 (Arm_relobj::attributes_section_data_): New data member declaration.
3994 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
3995 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
3996 attributes_section_data_.
3997 (Arm_dynobj::attributes_section_data): New method definition.
3998 (Arm_dynobj::attributes_section_data_): New data member declaration.
3999 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
4000 initialization value of may_use_blx_ to false.
4001 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
4002 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
4003 object attributes to compute results instead of hard-coding.
4004 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
4005 Target_arm::get_secondary_compatible_arch,
4006 Target_arm::set_secondary_compatible_arch
4007 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
4008 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
4009 New method declarations.
4010 (Target_arm::get_aeabi_object_attribute): New method definition.
4011 (Target_arm::attributes_section_data_): New data member declaration.
4012 (read_arm_attributes_section): New template definition.
4013 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
4014 (Arm_dynobj::do_read_symbols): Ditto.
4015 (Target_arm::do_finalize_sections): Merge attributes sections from
4016 input. Check for BLX use after attributes section merging.
4017 Fix __exidx_start and __exidx_end visibility. Create an
4018 .ARM.attributes section if necessary.
4019 (Target_arm::get_secondary_compatible_arch,
4020 Target_arm::set_secondary_compatible_arch,
4021 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
4022 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
4023 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
4024 New method definitions.
4026 2009-12-09 Ian Lance Taylor <iant@google.com>
4028 * plugin.cc (Plugin::load): Don't cast from void* to a function
4031 2009-12-09 Ian Lance Taylor <iant@google.com>
4033 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
4036 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
4038 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
4039 Replace two_file_shared_1.so with two_file_shared_2.so.
4040 * testsuite/Makefile.in: Regenerated.
4042 2009-12-08 Doug Kwan <dougkwan@google.com>
4044 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
4045 (HFILES): Add attributes.h and int_encoding.h.
4046 * Makefile.in: Regenerate.
4047 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
4048 function definitions to int_encoding.cc
4049 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
4050 prototypes to int_encoding.h
4051 * reduced_debug_output.cc (int_encoding.h): New include.
4052 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
4053 function definitions to int_encoding.cc
4054 (insert_into_vector, read_from_pointer): Move template definitions to
4056 * attributes.cc: New file.
4057 * attributes.h: New file.
4058 * int_encoding.cc: New file.
4059 * int_encoding.h: New file.
4061 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
4064 * incremental-dump.cc (dump_incremental_inputs): New.
4065 (main): Use dump_incremental_inputs.
4067 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
4070 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
4071 checking elfcpp::STT_FUNC.
4072 (Target_i386::Relocate::relocate): Likewise.
4073 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4075 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
4076 symbols from shared libraries into normal FUNC symbols.
4078 * symtab.h (Symbol): Add is_func and use it.
4080 2009-12-05 Doug Kwan <dougkwan@google.com>
4082 * arm.cc (Target_arm::arm_info): Initialize new fields
4083 attributes_section and attributes_vendor.
4084 * i386.cc (Target_i386::i386_info): Same.
4085 * object.cc (Sized_relobj::do_layout): Skip attribute section.
4086 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
4087 fields attributes_section and attributes_vendor.
4088 * sparc.cc (Target_sparc::sparc_info): Same.
4089 * target.h (Target::attributes_section, Target::attributes_vendor,
4090 Target::is_attributes_section, Target::attribute_arg_type,
4091 Target::attributes_order): New method definitions.
4092 (Target::Target_info::attributes_section,
4093 Target::Target_info::attributes_vendor): New fields.
4094 (Target::do_attribute_arg_type, Target::do_attributes_order): New
4095 virtual method definitions.
4096 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
4097 attributes_section and attributes_vendor.
4098 * testsuite/testfile.cc (Target_test::test_target_info): Same.
4100 2009-12-05 Doug Kwan <dougkwan@google.com>
4102 * arm.cc: Update comments about interworking and stub generation.
4103 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
4104 considered as non-PIC.
4105 (Arm_relocate_functions::base_abs): Fix formatting.
4106 (Arm_relocate_functions::got_prel): Fix comment. Change interface
4107 of function to use GOT entry address instead of offset.
4108 (Target_arm::Scan::global): Issue an error if a symbol would need a
4109 PLT does not get one because it is untyped. Remove code to create
4110 dynamic symbols for relative branches.
4111 (Target_arm::Relocate::relocate: Use 0 instead of false since function
4112 takes unsigned integer instead of boolean.
4114 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
4116 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
4117 (two_file_test_LDADD): Likewise.
4118 (common_test_1_LDADD): Likewise.
4119 (exception_test_LDADD) Likewise.
4120 (weak_test_LDADD): Likewise.
4121 (many_sections_test_LDADD): Likewise.
4122 (initpri1_LDADD): Likewise.
4123 (script_test_1_LDADD): Likewise.
4124 (script_test_2_LDADD): Likewise.
4125 (justsyms_LDADD): Likewise.
4126 (binary_test_LDADD): Likewise.
4127 (large_LDADD): Likewise.
4128 * testsuite/Makefile.in: Regenerated.
4130 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
4132 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
4133 (Symbol_table::override_with_special): Likewise.
4134 (Symbol_table::add_from_object): Likewise.
4136 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
4138 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
4139 Don't set the data_offset twice.
4141 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
4143 * testsuite/Makefile.in: Regenerate.
4145 2009-12-03 Doug Kwan <dougkwan@google.com>
4147 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
4148 (Target_arm::do_finalize_sections): Add parameter for symbol table
4149 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
4150 * i386.cc (Target_i386::do_finalize_sections): Add an additional
4151 parameter for symbol table pointer.
4152 * layout.cc (Layout::finalize): Call Target::finalize_sections with
4153 an additional parameter for a pointer to symbol table.
4154 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
4155 parameter for a symbol table pointer.
4156 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
4157 * target.h (Target::finalize_sections, Target::do_finalize_sections):
4159 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
4160 parameter for a symbol table pointer.
4162 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
4164 * incremental.cc (Incremental_inputs_header)
4165 (Incremental_inputs_header_write, Incremental_inputs_entry)
4166 (Incremental_inputs_entry_write): Move ...
4167 * incremental.h (Incremental_inputs_header)
4168 (Incremental_inputs_header_write, Incremental_inputs_entry)
4169 (Incremental_inputs_entry_write): here.
4171 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
4173 * incremental.cc (make_sized_incremental_binary): Set the target.
4174 Error if it is incompatible.
4175 * output.h (Output_file): Add filename method.
4177 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
4179 * incremental.cc (Incremental_inputs_entry): Remove unused argument
4180 from the get_* methods.
4182 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
4184 * incremental-dump.cc (main): Check that the offeset of a script is 0.
4185 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
4186 Write 0 for the data_offset of scripts.
4188 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
4190 * testsuite/Makefile.am: Add the incremental_test.sh test.
4191 * testsuite/incremental_test.sh: New.
4192 * testsuite/incremental_test_1.c: New.
4193 * testsuite/incremental_test_2.c: New.
4195 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
4197 * incremental-dump.cc (main): Fix typos.
4199 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
4202 * incremental-dump.cc (main): Use llu to print 64 bit values.
4204 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
4205 H.J. Lu <hongjiu.lu@intel.com>
4207 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
4209 (incremental_dump_LDADD): Likewise.
4210 * Makefile.in: Regenerated.
4212 2009-11-25 Doug Kwan <dougkwan@google.com>
4216 2009-11-25 Doug Kwan <dougkwan@google.com>
4218 * arm.cc (Target_arm::Target_arm): Move method definition
4219 outside of class definition. Add code to handle
4220 --target1-rel, --target1-abs and --target2= options.
4221 (Target_arm::get_reloc_reloc_type): Change method to be
4222 non-static and const.
4223 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
4224 New data member declaration.
4225 (Target_arm::Scan::local, Target_arm::Scan::global,
4226 Target_arm::Relocate::relocate,
4227 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4228 Adjust call to Target_arm::get_real_reloc_type.
4229 (Target_arm::get_real_reloc_type): Use command line options
4230 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
4231 * options.h (--target1-rel, --target1-abs, --target2): New
4234 2009-11-25 Doug Kwan <dougkwan@google.com>
4236 * arm.cc (Target_arm::Target_arm): Move method definition outside of
4237 class definition. Add code to handle --target1-rel, --target1-abs
4238 and --target2= options.
4239 (Target_arm::get_reloc_reloc_type): Change method to be non-static
4241 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
4243 (Target_arm::Scan::local, Target_arm::Scan::global,
4244 Target_arm::Relocate::relocate,
4245 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
4246 call to Target_arm::get_real_reloc_type.
4247 (Target_arm::get_real_reloc_type): Use command line options to
4248 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
4249 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
4252 2009-11-25 Doug Kwan <dougkwan@google.com>
4254 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
4255 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
4256 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
4258 (Arm_relocate_functions::thm_call): Replace body with a call to
4259 Arm_relocate_functions::thumb_branch_common.
4260 (Arm_relocate_functions::thm_jump24,
4261 Arm_relocate_functions::thm_xpc22): New method definitions.
4262 (Arm_relocate_functions::thumb_branch_common): New method definition.
4263 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
4265 (Target_arm::Relocate::relocate): Adjust call to thm_call.
4266 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
4268 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
4270 * Makefile.am: Build incremental-dump
4271 * Makefile.in: Regenerate.
4272 * incremental-dump.cc: New.
4273 * incremental.cc (Incremental_inputs_header_data,
4274 Incremental_inputs_entry_data): Move to incremental.h
4275 * incremental.h: (Incremental_inputs_header_data,
4276 Incremental_inputs_entry_data): Move from incremental.cc
4278 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
4280 * incremental.cc (Incremental_inputs_header,
4281 Incremental_inputs_header_write, Incremental_inputs_entry,
4282 Incremental_inputs_entry_write): Add a typedef with the data type.
4284 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
4286 * incremental.cc (Incremental_inputs_header,
4287 Incremental_inputs_header_write, Incremental_inputs_entry,
4288 Incremental_inputs_entry_write): Update comment about which
4289 type has the filed descriptions.
4291 2009-11-15 Doug Kwan <dougkwan@google.com>
4293 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
4294 (Arm_relocate_functions::arm_branch_common): Change method defintion
4295 in class definition to a method declaration and update list of formal
4297 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
4298 Arm_relocation_functions::jump24): Adjust call to
4299 Arm_relocate_functions::arm_branch_common. Update list of formal
4301 (Arm_relocate_functions::xpc25): New method definition.
4302 (Arm_relocate_functions::arm_branch_common): Move method defintion
4303 out from class definition. Use stubs for mode-switching and extending
4305 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
4306 specially. Change code to enable use of stubs in ARM branches.
4308 2009-11-10 Doug Kwan <dougkwan@google.com>
4310 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
4311 in method declaration.
4312 (Target_arm::relocate_stub): New method declaration.
4313 (Target_arm::default_target): Change to return a pointer instead of
4315 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
4316 Target_arm::default_target.
4317 (Arm_Relobj::do_relocate_sections): Remove options paramater in
4319 (Target_arm::relocate_section): Adjust view.
4320 (Target_arm::relocate_stub): New method definition.
4322 2009-11-10 Doug Kwan <dougkwan@google.com>
4324 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
4326 * incremental.cc (open_incremental_binary): Initialized local
4327 variables to avoid warnings.
4328 * object.cc (make_elf_object): Ditto.
4329 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
4332 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
4335 * testsuite/plugin_test.c: Include "config.h".
4337 2009-11-09 Doug Kwan <dougkwan@google.com>
4339 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
4340 (arm_symbol_value): Remove.
4341 (Arm_relocate_functions::arm_branch_common,
4342 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
4343 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
4344 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
4345 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
4346 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
4347 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
4348 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
4349 Arm_relocate_functions::thm_mobw_abs_nc,
4350 Arm_relocate_functions::thm_mov_abs,
4351 Arm_relocate_functions::movw_prel_nc,
4352 Arm_relocate_functions::thm_movt_abs,
4353 Arm_relocate_functions::movt_prel,
4354 Arm_relocate_functions::thm_movw_prel_nc,
4355 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
4356 (Target_arm::Relocate::relocate): Only decompose address into two
4357 parts if relocation type uses the thumb-bit and pass the actual
4358 bit instead of a flag indicating that the thumb-bit is used. Adjust
4359 calls to methods in Arm_relocate_functions for this change.
4361 2009-11-08 Ian Lance Taylor <iant@google.com>
4364 * reloc.cc: Instantiate
4365 Sized_relobj::initialize_input_to_output_maps and
4366 Sized_relobj:free_input_to_output_maps.
4368 2009-11-06 Ian Lance Taylor <iant@google.com>
4371 * defstd.cc (in_segment): Set only_if_ref true for "end".
4373 2009-11-06 Doug Kwan <dougkwan@google.com>
4375 * arm.cc (class Reloc_stub): Correct a comment.
4376 (Target_arm::Target_arm): Initialize arm_input_section_map_.
4377 (Target_arm::scan_section_for_stubs): New method declaration.
4378 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
4379 Change methods from private to protected.
4380 (Target_arm::do_may_relax): New method definition.
4381 (Target_arm::do_relax, Target_arm::group_sections,
4382 Target_arm::scan_reloc_for_stub,
4383 Target_arm::scan_reloc_section_for_stubs): New method declarations.
4384 (Target_arm::arm_input_section_map_): New data member declaration.
4385 (Target_arm::scan_reloc_for_stub,
4386 Target_arm::scan_reloc_section_for_stubs,
4387 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
4388 Target_arm::do_relax): New method definitions.
4390 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
4392 * configure.ac: Check for (struct stat)::st_mtim
4393 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
4394 * config.in: Regenerate.
4395 * configure: Regenerate.
4397 2009-11-05 Ian Lance Taylor <iant@google.com>
4400 * output.cc (Output_segment::add_output_section): Add missing
4403 2009-11-04 Ian Lance Taylor <iant@google.com>
4406 * object.h (class Object): Add is_needed and set_is_needed
4407 methods. Add is_needed_ field. Make bool fields into bitfields.
4408 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
4409 defined in a dynamic object and referenced by a regular object,
4410 set is_needed for the dynamic object.
4411 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
4412 if the file is marked with as_needed and it is not needed.
4414 2009-11-04 Ian Lance Taylor <iant@google.com>
4417 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
4418 tags if data is discarded by linker script.
4419 * i386.cc (Target_i386::do_finalize_sections): Likewise.
4420 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
4421 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
4422 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4424 2009-11-04 Ian Lance Taylor <iant@google.com>
4426 * layout.cc (Layout::get_output_section): Add is_interp and
4427 is_dynamic_linker_section parameters. Change all callers.
4428 (Layout::choose_output_section): Likewise.
4429 (Layout::make_output_section): Likewise.
4430 (Layout::add_output_section_data): Add is_dynamic_linker_section
4431 parameter. Change all callers.
4432 * layout.h (class Layout): Update declarations.
4433 * output.h (class Output_section): Add is_interp, set_is_interp,
4434 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
4435 Add is_interp_, is_dynamic_linker_section_ fields. Change
4436 generate_code_fills_at_write_ to a bitfield.
4437 * output.cc (Output_section::Output_sections): Initialize new
4439 (Output_segment::add_output_section): Add do_sort parameter.
4442 2009-11-03 Ian Lance Taylor <iant@google.com>
4445 * options.h (class General_options): Add --warn-common.
4446 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
4447 merging two common symbols.
4448 (Symbol_table::should_override): Handle --warn-common when merging
4449 a common symbol with a defined symbol. Use report_resolve_problem
4450 for multiple definitions.
4451 (Symbol_table::report_resolve_problem): New function.
4452 * symtab.h (class Symbol_table): Declare report_resolve_problem.
4454 2009-11-03 Doug Kwan <dougkwan@google.com>
4456 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
4458 (Target_arm::stub_factory): New method definition.
4459 (Target_arm::new_arm_input_section,
4460 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
4461 Target_arm::reloc_uses_thumb_bit): New method declarations.
4462 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
4463 New type definitions.
4464 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
4465 member declarations.
4466 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
4467 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
4468 New method definitions.
4470 2009-11-03 Ian Lance Taylor <iant@google.com>
4472 * options.h (class General_options): Add --warn_constructors.
4474 2009-11-03 Ian Lance Taylor <iant@google.com>
4477 * defstd.cc (in_section): Add entries for __rel_iplt_start,
4478 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
4480 2009-11-03 Ian Lance Taylor <iant@google.com>
4483 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
4484 --msgid-bugs-address.
4485 (install-pdf): New target.
4486 (install-data_yes): Look up one directory to find mkinstalldirs.
4488 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
4490 * po/Make-in (.po.gmo): Don't generate .gmo files in source
4493 2009-10-30 Doug Kwan <dougkwan@google.com>
4495 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
4497 2009-10-30 Doug Kwan <dougkwan@google.com>
4499 * arm.cc (Stub_addend_reader): New struct template definition
4500 and partial specializations.
4501 (Stub_addend_reader::operator()): New method definition for a
4502 partially specialized template.
4504 2009-10-30 Doug Kwan <dougkwan@google.com>
4506 * arm.cc (Arm_relobj::processor_specific_flags): New method
4508 (Arm_relobj::do_read_symbols): New method declaration.
4509 (Arm_relobj::processor_specific_flags_): New data member declaration.
4510 (Arm_dynobj): New class definition.
4511 (Target_arm::do_finalize_sections): Add input_objects parameter.
4512 (Target_arm::do_adjust_elf_header): New method declaration.
4513 (Target_arm::are_eabi_versions_compatible,
4514 (Target_arm::merge_processor_specific_flags): New method declaration.
4515 (Target_arm::do_make_elf_object): New overloaded method definitions
4517 (Arm_relobj::do_read_symbols): New method definition.
4518 (Arm_dynobj::do_read_symbols): Ditto.
4519 (Target_arm::do_finalize_sections): Add input_objects parameters.
4520 Merge processor-specific flags from all input objects.
4521 (Target_arm::are_eabi_versions_compatible,
4522 Target_arm::merge_processor_specific_flags,
4523 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
4524 New method definitions.
4525 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
4526 Input_objects pointer type parameter.
4527 * layout.cc (Layout::finalize): Pass input objects to target's.
4528 finalize_sections function.
4529 * output.cc (Output_file_header::do_sized_write): Set ELF file
4530 header's processor-specific flags.
4531 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
4532 Input_objects pointer type parameter.
4533 * sparc.cc (Target_sparc::do_finalize_sections): Same.
4534 * target.h (Input_objects): New forward class declaration.
4535 (Target::processor_specific_flags,
4536 Target::are_processor_specific_flags_sect): New method definitions.
4537 (Target::finalize_sections): Add input_objects parameter.
4538 (Target::Target): Initialize processor_specific_flags_ and
4539 are_processor_specific_flags_set_.
4540 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
4542 (Target::set_processor_specific_flags): New method definition.
4543 (Target::processor_specific_flags_,
4544 Target::are_processor_specific_flags_set_): New data member
4546 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
4547 Input_objects pointer type parameter.
4549 2009-10-30 Doug Kwan <dougkwan@google.com>
4551 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
4553 2009-10-28 Ian Lance Taylor <iant@google.com>
4555 * object.h (class Relobj): Drop options parameter from
4556 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
4557 do_scan_relocs, do_relocate. Change all callers.
4558 (class Sized_relobj): Drop options parameters from
4559 do_gc_process_relocs, do_scan_relocs, do_relocate,
4560 do_relocate_sections, relocate_sections, emit_relocs_scan,
4561 emit_relocs_scan_reltype. Change all callers.
4562 (struct Relocate_info): Remove options field and all references to
4564 * reloc.h (class Read_relocs): Remove options constructor
4565 parameter and options_ field. Change all callers.
4566 (class Gc_process_relocs, class Scan_relocs): Likewise.
4567 (class Relocate_task): Likewise.
4568 * target-reloc.h (scan_relocs): Remove options parameter. Change
4570 (scan_relocatable_relocs): Likewise.
4571 * target.h (class Sized_target): Remove options parameter from
4572 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
4574 * gc.h (gc_process_relocs): Remove options parameter. Change all
4576 * arm.cc: Update functions to remove options parameters.
4577 * i386.cc: Likewise.
4578 * powerpc.cc: Likewise.
4579 * sparc.cc: Likewise.
4580 * x86_64.cc: Likewise.
4581 * testsuite/testfile.cc: Likewise.
4583 2009-10-28 Doug Kwan <dougkwan@google.com>
4585 * arm.cc (Arm_relobj): New class definition.
4586 (Arm_relobj::scan_sections_for_stubs,
4587 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
4588 New method definitions.
4590 2009-10-28 Cary Coutant <ccoutant@google.com>
4592 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
4593 (Plugin::cleanup_done_): New member.
4594 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
4595 (Plugin_manager::cleanup_done_): Remove.
4596 (Plugin_manager::add_input_file): Edit error message.
4597 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
4598 (Plugin_manager::cleanup): Remove use of cleanup_done_.
4600 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
4602 * fileread.cc: (File_read::View::~View): Use the new
4603 data_ownership_ filed.
4604 (File_read::~File_read): Dispose the new whole_file_view_.
4605 (File_read::open): Mmap the whole file if needed.
4606 (File_read::open): Use whole_file_view_ instead of contents_.
4607 (File_read::find_view): Use whole_file_view_ if applicable.
4608 (File_read::do_read): Use whole_file_view_ instead of contents_.
4609 (File_read::make_view): Use whole_file_view_ instead of contents_,
4610 update File_read::View::View call.
4611 (File_read::find_or_make_view): Update File_read::View::View
4613 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
4615 (File_read::View::Data_ownership): New enum.
4616 (File_read::View::View): Replace bool mapped_ with Data_ownership
4618 (File_read::View::mapped_): Remove (replaced by data_ownership_).
4619 (File_read::View::data_ownership_): New field.
4620 (File_read::contents_): Remove (replaced by whole_file_view_).
4621 (File_read::whole_file_view_): New field.
4622 * options.h (class General_options): Add --keep-files-mapped.
4624 2009-10-27 Cary Coutant <ccoutant@google.com>
4626 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
4627 * testsuite/Makefile.am (plugin_test_5): New test case.
4628 * testsuite/Makefile.in: Regenerate.
4630 2009-10-25 Doug Kwan <dougkwan@google.com>
4632 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
4633 from private to protected to allow access by child class.
4634 (Sized_relobj::do_relocate_sections): New method declaration.
4635 (Sized_relobj::relocate_sections): Virtualize.
4636 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
4637 Sized_relobj::relocate_sections. Instantiate template explicitly
4638 for different target sizes and endianity.
4640 2009-10-24 Doug Kwan <dougkwan@google.com>
4642 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
4643 (Arm_input_section::as_arm_input_section): New method.
4644 (Arm_output_section): New class definition.
4645 (Arm_output_section::create_stub_group,
4646 Arm_output_section::group_sections): New method definitions.
4648 2009-10-22 Doug Kwan <dougkwan@google.com>
4650 * arm.cc (Arm_input_section): New class definition.
4651 (Arm_input_section::init, Arm_input_section:do_write,
4652 Arm_input_section::set_final_data_size,
4653 Arm_input_section::do_reset_address_and_file_offset): New method
4656 2009-10-21 Doug Kwan <dougkwan@google.com>
4658 * arm.cc (Stub_table, Arm_input_section): New forward class
4660 (Stub_table): New class defintion.
4661 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
4662 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
4663 New method definition.
4665 2009-10-21 Doug Kwan <dougkwan@google.com>
4667 * arm.cc: Update copyright comments.
4668 (Target_arm): New forward class template declaration.
4669 (Arm_address): New type.
4670 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
4671 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
4672 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
4674 (Insn_template): Same.
4675 (DEF_STUBS): New macro.
4676 (Stub_type): New enum type.
4677 (Stub_template): New class definition.
4680 (Stub_factory): Same.
4681 (Target_arm::Target_arm): Initialize may_use_blx_ and
4682 should_force_pic_veneer_.
4683 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
4684 Target_arm::should_force_pic_veneer,
4685 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
4686 Target_arm::using_thumb_only, Target_arm:;default_target): New
4688 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
4689 New data member declarations.
4690 (Insn_template::size, Insn_template::alignment): New method defintions.
4691 (Stub_template::Stub_template): New method definition.
4692 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
4693 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
4694 (Stub_factory::Stub_factory): New method definition.
4695 * gold.h (string_hash): New template.
4696 * output.h (Input_section_specifier::hash_value): Use
4698 (Input_section_specifier::string_hash): Remove.
4699 * stringpool.cc (Stringpool_template::string_hash): Use
4702 2009-10-20 Doug Kwan <dougkwan@google.com>
4704 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
4705 symbols of relaxed input sections.
4706 * output.h (Output_section::find_relaxed_input_section): Make
4709 2009-10-16 Doug Kwan <dougkwan@google.com>
4711 * dynobj.cc (Versions::Versions): Initialize version_script_.
4712 Only insert base version symbol definition for a shared object
4713 if version script defines any version versions.
4714 (Versions::define_base_version): New method definition.
4715 (Versions::add_def): Check that base version is not needed.
4716 (Versions::add_need): Define base version lazily.
4717 * dynobj.h (Versions::define_base_version): New method declaration.
4718 (Versions::needs_base_version_): New data member declaration.
4719 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
4720 (check_DATA): Add no_version_test.stdout.
4721 (libno_version_test.so, no_version_test.o no_version_test.stdout):
4723 * testsuite/Makefile.in: Regenerate.
4724 * testsuite/no_version_test.c: New file.
4725 * testsuite/no_version_test.sh: Ditto.
4727 2009-10-16 Doug Kwan <dougkwan@google.com>
4729 * expression.cc (class Segment_start_expression): New class definition.
4730 (Segment_start_expression::value): New method definition.
4731 (script_exp_function_segment_start): Return a new
4732 Segment_start_expression.
4733 * gold/script-c.h (script_saw_segment_start_expression): New function
4735 * script-sections.cc (Script_sections::Script_sections): Initialize
4736 SAW_SEGMENT_START_EXPRESSION_ to false.
4737 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
4738 and -Tbbs options to specify section addresses if given in
4739 command line and no SEGMENT_START expression is seen in a script.
4740 * script-sections.h (Script_sections::saw_segment_start_expression,
4741 Script_sections::set_saw_segment_start_expression): New method
4743 (Script_sections::saw_segment_start_expression_): New data member
4745 * script.cc (script_saw_segment_start_expression): New function.
4746 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
4747 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
4748 script_test_7.sh and script_test_8.sh.
4749 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
4750 script_test_8.stdout.
4751 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
4752 (script_test_6, script_test_6.stdout, script_test_7,
4753 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
4754 * Makefile.in: Regenerate.
4755 * testsuite/script_test_6.sh: New file.
4756 * testsuite/script_test_6.t: Same.
4757 * testsuite/script_test_7.sh: Same.
4758 * testsuite/script_test_7.t: Same.
4759 * testsuite/script_test_8.sh: Same.
4761 2009-10-16 Doug Kwan <dougkwan@google.com>
4763 * output.cc (Output_segment::set_section_list_address): Cast
4764 expressions to unsigned long long type to avoid format warnings.
4766 2009-10-15 Ian Lance Taylor <iant@google.com>
4768 * script.cc (Script_options::add_symbol_assignment): Always add a
4769 dot assignment to script_sections_.
4770 * script-sections.cc (Script_sections::add_dot_assignment):
4771 Initialize if necessary.
4773 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
4774 program headers with no load segment if there is a linker script.
4776 * layout.cc (Layout::set_segment_offsets): Align the file offset
4777 to the segment aligment for -N or -n with no load segment.
4778 * output.cc (Output_segment::add_output_section): Don't crash if
4779 the first section is a TLS section.
4780 (Output_segment::set_section_list_addresses): Print an error
4781 message if the address moves backward in a linker script.
4782 * script-sections.cc
4783 (Output_section_element_input::set_section_addresses): Don't
4784 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
4785 (Orphan_output_section::set_section_addresses): Likewise.
4787 2009-10-15 Doug Kwan <dougkwan@google.com>
4789 * layout.cc (Layout::finish_dynamic_section): Generate tags
4790 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
4791 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
4792 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
4794 2009-10-14 Ian Lance Taylor <iant@google.com>
4796 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
4798 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
4799 data_shdr fields of relinfo.
4800 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
4801 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
4802 R_386_TLS_LDO_32, adjust based on section flags.
4803 (Target_i386::Relocate::fix_up_ldo): Remove.
4805 2009-10-13 Ian Lance Taylor <iant@google.com>
4807 Add support for -pie.
4808 * options.h (class General_options): Add -pie and
4810 (General_options::output_is_position_independent): Test -pie.
4811 (General_options::output_is_executable): Return true if not shared
4812 and not relocatable.
4813 (General_options::output_is_pie): Remove.
4814 * options.cc (General_options::finalize): Reject incompatible uses
4816 * gold.cc (queue_middle_tasks): A -pie link is not static.
4817 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
4818 * symtab.cc (Symbol::final_value_is_known): Return false if
4819 output_is_position_independent.
4820 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
4821 output_is_position_independent.
4822 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
4823 output_is_position_independent.
4824 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
4825 output_is_position_independent.
4826 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
4828 (basic_pie_test.o, basic_pie_test): New targets.
4829 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
4830 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
4831 (two_file_pie_test): New target.
4832 * testsuite/Makefile.in: Rebuild.
4833 * README: Remove note saying that -pie is not supported.
4835 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
4837 * options.h (class General_options): Add -init and -fini.
4838 * layout.cc (Layout::finish_dynamic_section): Emit
4839 given init and fini functions.
4841 2009-10-13 Sriraman Tallam <tmsriram@google.com>
4843 * gc.h (gc_process_relocs): Check if icf is enabled using new
4845 * gold.cc (queue_initial_tasks): Likewise.
4846 (queue_middle_tasks): Likewise.
4847 * object.cc (do_layout): Likewise.
4848 * symtab.cc (is_section_folded): Likewise.
4849 * main.cc (main): Likewise.
4850 * reloc.cc (Read_relocs::run): Likewise.
4851 (Sized_relobj::do_scan_relocs): Likewise.
4852 * icf.cc (is_function_ctor_or_dtor): New function.
4853 (Icf::find_identical_sections): Check if function is ctor or dtor when
4855 * options.h (General_options::icf): Change option to be an enum.
4856 (Icf_status): New enum.
4857 (icf_enabled): New method.
4858 (icf_safe_folding): New method.
4859 (set_icf_status): New method.
4860 (icf_status_): New variable.
4861 * (options.cc) (General_options::finalize): Set icf_status_.
4862 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
4863 icf_test and icf_keep_unique_test to use the --icf enum flag.
4864 * testsuite/icf_safe_test.sh: New file.
4865 * testsuite/icf_safe_test.cc: New file.
4867 2009-10-12 Sriraman Tallam <tmsriram@google.com>
4869 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
4870 includes to gc.h and icf.h.
4871 * arm.cc: Include gc.h.
4872 * gold.cc: Likewise.
4873 * i386.cc: Likewise.
4874 * powerpc.cc: Likewise.
4875 * sparc.cc: Likewise.
4876 * x86_64.cc: Likewise.
4877 * gc.h: Include icf.h.
4879 2009-10-11 Ian Lance Taylor <iant@google.com>
4881 * plugin.cc: Include "gold.h" before other header files.
4883 2009-10-10 Chris Demetriou <cgd@google.com>
4885 * options.h (Input_file_argument::Input_file_type): New enum.
4886 (Input_file_argument::is_lib_): Replace with...
4887 (Input_file_argument::type_): New member.
4888 (Input_file_argument::Input_file_argument): Take Input_file_type
4889 'type' rather than boolean 'is_lib' as second argument.
4890 (Input_file_argument::is_lib): Use type_.
4891 (Input_file_argument::is_searched_file): New function.
4892 (Input_file_argument::may_need_search): Handle is_searched_file.
4893 * options.cc (General_options::parse_library): Support -l:filename.
4894 (General_options::parse_just_symbols): Update for Input_file_argument
4896 (Command_line::process): Likewise.
4897 * archive.cc (Archive::get_file_and_offset): Likewise.
4898 * plugin.cc (Plugin_manager::release_input_file): Likewise.
4899 * script.cc (read_script_file, script_add_file): Likewise.
4900 * fileread.cc (Input_file::Input_file): Likewise.
4901 (Input_file::will_search_for): Handle is_searched_file.
4902 (Input_file::open): Likewise.
4903 * readsyms.cc (Read_symbols::get_name): Likewise.
4904 * testsuite/Makefile.am (searched_file_test): New test.
4905 * testsuite/Makefile.in: Regenerate.
4906 * testsuite/searched_file_test.cc: New file.
4907 * testsuite/searched_file_test_lib.cc: New file.
4909 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
4910 Ian Lance Taylor <iant@google.com>
4912 * descriptor.cc: Include <cstdio> and "binary-io.h".
4913 (Descriptors::open): Open the files in binary mode always.
4914 * script.cc (Lex::get_token): Treat \r as whitespace.
4916 2009-10-09 Ian Lance Taylor <iant@google.com>
4918 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
4920 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
4921 Ian Lance Taylor <iant@google.com>
4923 * configure.ac: Check for readv function also.
4924 * fileread.cc (readv): Define if not HAVE_READV.
4925 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
4927 * config.in: Regenerate.
4928 * configure: Regenerate.
4930 2009-10-09 Doug Kwan <dougkwan@google.com>
4932 * layout.cc (Layout::make_output_section): Call target hook to make
4933 ordinary output section.
4934 (Layout::finalize): Adjust parameter list of call the
4935 Target::may_relax().
4936 * layout.h (class Layout::section_list): New method.
4937 * merge.h (Output_merge_base::entsize): Change visibility to public.
4938 (Output_merge_base::is_string, Output_merge_base::do_is_string):
4940 (Output_merge_string::do_is_string): New method.
4941 * object.cc (Sized_relobj::do_setup): renamed from
4942 Sized_relobj::set_up.
4943 * object.h (Sized_relobj::adjust_shndx,
4944 Sized_relobj::initializ_input_to_output_maps,
4945 Sized_relobj::free_input_to_output_maps): Change visibilities to
4947 (Sized_relobj::setup): Virtualize.
4948 (Sized_relobj::do_setup): New method declaration.
4949 (Sized_relobj::invalidate_section_offset,
4950 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
4951 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
4952 * options.cc (parse_int): New function.
4953 * options.h (parse_int): New declaration.
4954 (DEFINE_int): New macro.
4955 (stub_group_size): New option.
4956 * output.cc (Output_section::Output_section): Initialize memebers
4957 merge_section_map_, merge_section_by_properties_map_,
4958 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
4959 (Output_section::add_input_section): Handled deferred code-fill
4960 generation and remove an old comment.
4961 (Output_section::add_relaxed_input_section): New method definition.
4962 (Output_section::add_merge_input_section): Use merge section by
4963 properties map to speed to search. Update merge section maps
4965 (Output_section::build_relaxation_map): New method definition.
4966 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4968 (Output_section::relax_input_section): Renamed to
4969 Output_section::convert_input_sections_to_relaxed_sections and change
4970 interface to take a vector of pointers to relaxed sections.
4971 (Output_section::find_merge_section,
4972 Output_section::find_relaxed_input_section): New method definitions.
4973 (Output_section::is_input_address_mapped,
4974 Output_section::output_offset, Output_section::output_address):
4975 Use output section data maps to speed up searching.
4976 (Output_section::find_starting_output_address): Add comments.
4977 (Output_section::do_write,
4978 Output_section::write_to_postprocessing_buffer): Do code-fill
4979 generation as appropriate.
4980 (Output_section::get_input_sections): Invalidate relaxed input section
4982 (Output_section::restore_states): Adjust type of checkpoint .
4983 Invalidate relaxed input section map.
4984 * output.h (Output_merge_base): New class declaration.
4985 (Input_section_specifier): New class defintion.
4986 (class Output_relaxed_input_section) Change base class to
4987 Output_section_data_build.
4988 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
4989 base class initializer.
4990 (Output_section::add_relaxed_input_section): New method declaration.
4991 (Output_section::Input_section): Change visibility to protected.
4992 (Output_section::Input_section::relobj,
4993 Output_section::Input_section::shndx): Handle relaxed input sections.
4994 Output_section::input_sections) Change visibility to protected. Also
4995 define overload to return a non-const pointer.
4996 (Output_section::Merge_section_properties): New class defintion.
4997 (Output_section::Merge_section_by_properties_map,
4998 Output_section::Output_section_data_by_input_section_map,
4999 Output_section::Relaxation_map): New types.
5000 (Output_section::relax_input_section): Rename method to
5001 Output_section::convert_input_sections_to_relaxed_sections and change
5002 interface to take a vector of relaxed section pointers.
5003 (Output_section::find_merge_section,
5004 Output_section::find_relaxed_input_section,
5005 Output_section::build_relaxation_map,
5006 Output_section::convert_input_sections_in_list_to_relaxed_sections):
5007 New method declarations.
5008 (Output_section::merge_section_map_
5009 Output_section::merge_section_by_properties_map_,
5010 Output_section::relaxed_input_section_map_,
5011 Output_section::is_relaxed_input_section_map_valid_,
5012 Output_section::generate_code_fills_at_write_): New data members.
5013 * script-sections.cc
5014 (Output_section_element_input::set_section_addresses): Call
5015 current_data_size and addralign methods of relaxed input sections.
5016 (Orphan_output_section::set_section_addresses): Call current_data_size
5017 and addralign methods of relaxed input sections.
5018 * symtab.cc (Symbol_table::compute_final_value): Extract template
5019 from the body of Symbol_table::sized_finalize_symbol.
5020 (Symbol_table::sized_finalized_symbol): Call
5021 Symbol_table::compute_final_value.
5022 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
5023 (Symbol_table::compute_final_value): New templated method declaration.
5024 * target.cc (Target::do_make_output_section): New method defintion.
5025 * target.h (Target::make_output_section): New method declaration.
5026 (Target::relax): Add more parameters for input objects, symbol table
5027 and layout. Adjust call to do_relax.
5028 (Target::do_make_output_section): New method declaration.
5029 (Target::do_relax): Add parameters for input objects, symbol table
5032 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
5034 * pread.c: Include stdio.h.
5036 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
5038 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
5041 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
5043 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5044 Change read_shndx type to unsigned int.
5045 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
5047 (Sized_dwarf_line_info::read_line_mappings): Likewise.
5048 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
5049 Change read_shndx type to unsigned int.
5050 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
5052 (Sized_dwarf_line_info::read_line_mappings): Likewise.
5053 * layout.cc (Layout::create_symtab_sections): Cast the result of
5054 local_symcount * symsize to off_t in the gold_assert.
5056 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5058 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
5059 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
5061 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
5062 (Arm_relocate_functions::thm_abs5): New function.
5063 (Arm_relocate_functions::abs12): New function.
5064 (Arm_relocate_functions::abs16): New function.
5065 (Arm_relocate_functions::base_abs): New function.
5066 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
5067 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
5068 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
5070 (Scan::global): Likewise.
5071 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
5072 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
5073 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
5074 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
5077 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5079 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
5080 (Arm_relocate_functions::movt_prel): New function.
5081 (Arm_relocate_functions::thm_movw_prel_nc): New function.
5082 (Arm_relocate_functions::thm_movt_prel): New function.
5083 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
5084 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
5085 (Scan::global, Relocate::relocate): Likewise.
5086 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
5088 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
5090 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
5091 Incremental_checker.
5092 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
5094 (class Incremental_inputs_header): New class.
5095 (Incremental_inputs_header_writer): Edit comment.
5096 (Incremental_inputs_entry): New class.
5097 (Incremental_inputs_entry_writer): Edit comment.
5098 (Sized_incremental_binary::do_find_incremental_inputs_section):
5099 Add *strtab_shndx parameter, fill it.
5100 (Sized_incremental_binary::do_check_inputs): New method.
5101 (Incremental_checker::can_incrementally_link_output_file): Use
5102 Sized_incremental_binary::check_inputs.
5103 (Incremental_inputs::report_command_line): Save command line in
5106 (Incremental_binary::find_incremental_inputs_section): New
5108 (Incremental_binary::do_find_incremental_inputs_section): Add
5109 strtab_shndx parameter.
5110 (Incremental_binary::do_check_inputs): New pure virtual method.
5111 (Sized_incremental_binary::do_check_inputs): Declare.
5112 (Incremental_checker::Incremental_checker): Add incremental_inputs
5113 parameter, use it to initialize incremental_inputs_.
5114 (Incremental_checker::incremental_inputs_): New field.
5115 (Incremental_checker::command_line): New method.
5116 (Incremental_checker::inputs): New method.
5117 (Incremental_checker::command_line_): New field.
5119 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
5121 * incremental.cc: Include <cstdarg> and "target-select.h".
5122 (vexplain_no_incremental): New function.
5123 (explain_no_incremental): New function.
5124 (Incremental_binary::error): New method.
5125 (Sized_incremental_binary::do_find_incremental_inputs_section): New
5127 (make_sized_incremental_binary): New function.
5128 (open_incremental_binary): New function.
5129 (can_incrementally_link_file): Add checks if output is ELF and has
5131 * incremental.h: Include "elfcpp_file.h" and "output.h".
5132 (Incremental_binary): New class.
5133 (Sized_incremental_binary): New class.
5134 (open_incremental_binary): Declare.
5135 * object.cc (is_elf_object): Use
5136 elfcpp::Elf_recognizer::is_elf_file.
5137 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
5138 * output.h (Output_file::filesize): New method.
5140 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5142 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
5144 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
5145 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
5147 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
5149 (Arm_relocate_functions::movw_abs_nc): New function.
5150 (Arm_relocate_functions::movt_abs): New function.
5151 (Arm_relocate_functions::thm_movw_abs_nc): New function.
5152 (Arm_relocate_functions::thm_movt_abs): New function.
5153 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
5154 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
5155 (Scan::global): Likewise.
5156 (Relocate::relocate): Likewise.
5157 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
5159 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5161 * arm.cc (Arm_relocate_functions::got_prel) New function.
5162 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
5163 (Relocate::relocate): Likewise.
5164 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
5166 2009-10-06 Ian Lance Taylor <iant@google.com>
5168 * options.h (class General_options): Define
5169 split_stack_adjust_size parameter.
5170 * object.h (class Object): Add uses_split_stack_ and
5171 has_no_split_stack_ fields. Add uses_split_stack and
5172 has_no_split_stack accessor functions. Declare
5173 handle_split_stack_section.
5174 (class Reloc_symbol_changes): Define.
5175 (class Sized_relobj): Define Function_offsets. Declare
5176 split_stack_adjust, split_stack_adjust_reltype, and
5178 * object.cc (Object::handle_split_stack_section): New function.
5179 (Sized_relobj::do_layout): Call handle_split_stack_section.
5180 * dynobj.cc (Sized_dynobj::do_layout): Call
5181 handle_split_stack_section.
5182 * reloc.cc (Sized_relobj::relocate_sections): Call
5183 split_stack_adjust for executable sections in split_stack
5184 objects. Pass reloc_map to relocate_section.
5185 (Sized_relobj::split_stack_adjust): New function.
5186 (Sized_relobj::split_stack_adjust_reltype): New function.
5187 (Sized_relobj::find_functions): New function.
5188 * target-reloc.h: Include "object.h".
5189 (relocate_section): Add reloc_symbol_changes parameter. Change
5191 * target.h (class Target): Add calls_non_split method. Declare
5192 do_calls_non_split virtual method. Declare match_view and
5194 * target.cc: Include "elfcpp.h".
5195 (Target::do_calls_non_split): New function.
5196 (Target::match_view): New function.
5197 (Target::set_view_to_nop): New function.
5198 * gold.cc (queue_middle_tasks): Give an error if mixing
5199 split-stack and non-split-stack objects with -r.
5200 * i386.cc (Target_i386::relocate_section): Add
5201 reloc_symbol_changes parameter.
5202 (Target_i386::do_calls_non_split): New function.
5203 * x86_64.cc (Target_x86_64::relocate_section): Add
5204 reloc_symbol_changes parameter.
5205 (Target_x86_64::do_calls_non_split): New function.
5206 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
5208 * powerpc.cc (Target_powerpc::relocate_section): Add
5209 reloc_symbol_changes parameter.
5210 * sparc.cc (Target_sparc::relocate_section): Add
5211 reloc_symbol_changes parameter.
5212 * configure.ac: Call AM_CONDITIONAL for the default target.
5213 * configure: Rebuild.
5214 * testsuite/Makefile.am (TEST_AS): New variable.
5215 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
5216 (check_DATA): Add split_i386 and split_x86_64 files.
5217 (SPLIT_DEFSYMS): Define.
5218 (split_i386_[1234n].o): New targets.
5219 (split_i386_[124]): New targets.
5220 (split_i386_[1234r].stdout): New targets.
5221 (split_x86_64_[1234n].o): New targets.
5222 (split_x86_64_[124]): New targets.
5223 (split_x86_64_[1234r].stdout): New targets.
5224 (MOSTLYCLEANFILES): Add new executables.
5225 * testsuite/split_i386.sh: New file.
5226 * testsuite/split_x86_64.sh: New file.
5227 * testsuite/split_i386_1.s: New file.
5228 * testsuite/split_i386_2.s: New file.
5229 * testsuite/split_i386_3.s: New file.
5230 * testsuite/split_i386_4.s: New file.
5231 * testsuite/split_i386_n.s: New file.
5232 * testsuite/split_x86_64_1.s: New file.
5233 * testsuite/split_x86_64_2.s: New file.
5234 * testsuite/split_x86_64_3.s: New file.
5235 * testsuite/split_x86_64_4.s: New file.
5236 * testsuite/split_x86_64_n.s: New file.
5237 * testsuite/testfile.cc (Target_test): Update relocation_section
5239 * testsuite/Makefile.in: Rebuild.
5241 2009-10-06 Ian Lance Taylor <iant@google.com>
5243 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
5244 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
5245 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
5246 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
5247 the address on ldo_addrs_.
5248 (Target_i386::Relocate::fix_up_ldo): New function.
5250 2009-10-06 Rafael Espindola <espindola@google.com>
5252 * plugin.cc (add_input_library): New.
5253 (Plugin::load): Add add_input_library to tv.
5254 (Plugin_manager::add_input_file): Add the is_lib argument.
5255 (add_input_file): Update call to Plugin_manager::add_input_file.
5256 (add_input_library): New.
5257 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
5259 2009-09-30 Doug Kwan <dougkwan@google.com>
5261 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
5262 symbol and call Symbol::may_need_copy_reloc to determine if
5263 a copy reloc is needed.
5264 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
5265 nocopyreloc is given in command line.
5266 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
5267 given in command line.
5268 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
5269 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
5270 of the removed Target_i386::may_need_copy_reloc.
5271 * options.h (copyreloc): New option with default value false.
5272 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
5273 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
5274 instead of the removed Target_powerpc::may_need_copy_reloc.
5275 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
5276 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
5277 instead of the removed Target_sparc::may_need_copy_reloc.
5278 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
5279 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
5280 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
5281 instead of the removed Target_x86_64::may_need_copy_reloc.
5283 2009-09-30 Ian Lance Taylor <iant@google.com>
5285 * object.h (class Object): Remove target_ field, and target,
5286 sized_target, and set_target methods.
5287 (Object::sized_target): Remove.
5288 (class Sized_relobj): Update declarations. Remove sized_target.
5289 * object.cc (Sized_relobj::setup): Remove target parameter.
5291 (Input_objects::add_object): Don't do anything with the target.
5292 (make_elf_sized_object): Add punconfigured parameter. Change all
5293 callers. Set or test parameter target.
5294 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
5296 * parameters.cc (Parameters::set_target): Change parameter type to
5298 (Parameters::default_target): Remove.
5299 (set_parameters_target): Change parameter type to be non-const.
5300 (parameters_force_valid_target): New function.
5301 (parameters_clear_target): New function.
5302 * parameters.h (class Parameters): Update declarations. Remove
5303 default_target method. Add sized_target and clear_target
5304 methods. Change target_ to be non-const.
5305 (set_parameters_target): Update declaration.
5306 (parameters_force_valid_target): Declare.
5307 (parameters_clear_target): Declare.
5308 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
5309 as NULL if we aren't searching.
5310 (Add_symbols::run): Don't check for compatible target.
5311 * fileread.cc (Input_file::open_binary): Call
5312 parameters_force_valid_target.
5313 * gold.cc (queue_middle_tasks): Likewise.
5314 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
5315 set_target on object.
5316 * dynobj.h (class Sized_dynobj): Update declarations.
5317 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
5318 make_elf_object returns NULL.
5319 (Archive::include_member): Don't check whether object target is
5321 * output.cc (Output_section::add_input_section): Get target from
5323 (Output_section::relax_input_section): Likewise.
5324 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
5326 (Sized_relobj::do_scan_relocs): Likewise.
5327 (Sized_relobj::relocate_sections): Likewise.
5328 * resolve.cc (Symbol_table::resolve): Likewise.
5329 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
5330 parameter. Change all callers.
5331 (Symbol_table::add_from_object): Get target from parameters.
5332 (Symbol_table::add_from_relobj): Don't check object target.
5333 (Symbol_table::add_from_dynobj): Likewise.
5334 (Symbol_table::define_special_symbol): Get target from
5336 * symtab.h (class Symbol_table): Update declaration.
5337 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
5338 parameter. Change all callers. Clear parameter target.
5339 (Binary_test): Test target here.
5340 * testsuite/object_unittest.cc (gold_testsuite): Remove
5341 target_test_pointer parameter. Change all callers.
5342 (Object_test): Test target here.
5344 2009-09-26 Ian Lance Taylor <iant@google.com>
5346 * testsuite/initpri1.c: Don't try to use constructor priorities if
5347 compiling with gcc before 4.3.
5349 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
5351 * testsuite/retain_symbols_file_test.sh (check_present): Change
5352 output file name to retain_symbols_file_test.stdout.
5353 (check_absent): Likewise.
5355 2009-09-18 Craig Silverstein <csilvers@google.com>
5357 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
5358 * options.cc: Include <cerrno> and <fstream>.
5359 (General_options::finalize): Parse -retain-symbols-file tag.
5360 * options.h: New flag.
5361 (General_options): New method should_retain_symbol, new
5362 variable symbols_to_retain.
5363 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
5364 should_retain_symbol map.
5365 * testsuite/Makefile.am (retain_symbols_file_test): New test.
5366 * testsuite/Makefile.in: Regenerate.
5367 * testsuite/retain_symbols_file_test.sh: New file.
5369 2009-09-18 Nick Clifton <nickc@redhat.com>
5371 * po/es.po: Updated Spanish translation.
5373 2009-09-17 Doug Kwan <dougkwan@google.com>
5375 * debug.h (DEBUG_RELAXATION): New constant.
5376 (DEBUG_ALL): Add DEBUG_RELAXATION.
5377 (debug_string_to_enum): Add relaxation debug option.
5379 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
5380 Layout::Relaxation_debug_check::read_sections,
5381 Layout::Relaxation_debug_check::read_sections): New method definitions.
5382 (Layout::Layout): Initialize data members
5383 record_output_section_data_from_scrips_,
5384 script_output_section_data_list_ and relaxation_debug_check_.
5385 (Layout::save_segments, Layout::restore_segments,
5386 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
5387 Layout::relaxation_loop_body): New method definitions.
5388 (Layout::finalize): Support relaxation. Move section layout code to
5389 Layout::relaxation_loop_body.
5390 (Layout::set_asection_address_from_script): Move code for orphan
5391 section placement out.
5392 (Layout::place_orphan_sections_in_script): New method definition.
5393 * layout.h (Output_segment_headers, Output_file_header):
5394 New forward class declarations.
5395 (Layout::~Layout): Define.
5396 (Layout::new_output_section_data_from_script): New method definition.
5397 (Layout::place_orphan_sections_in_script): New method declaration.
5398 (Layout::Segment_states): New type declaration.
5399 (Layout::save_segments, Layout::restore_segments,
5400 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
5401 Layout::relaxation_loop_body): New method declarations.
5402 (Layout::Output_section_data_list): New type declaration.
5403 (Layout::Relaxation_debug_check): New class definition.
5404 (Layout::record_output_section_data_from_script_,
5405 Layout::script_output_section_data_list_, Layout::segment_states_,
5406 Layout::relaxation_debug_check_): New data members.
5407 * output.cc: (Output_section_headers::do_size): New method definition.
5408 (Output_section_headers::Output_section_headers): Move size
5409 computation to Output_section_headers::do_size.
5410 (Output_segment_headers::do_size): New method definition.
5411 (Output_file_header::Output_file_header): Move size computation to
5412 Output_file_header::do_size and call it.
5413 (Output_file_header::do_size): New method definition.
5414 (Output_data_group::Output_data_group): Adjust call to
5415 Output_section_data.
5416 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
5417 (Output_symtab_xindex::do_write): Add array bound check.
5418 (Output_section::Input_section::print_to_mapfile): Handle
5419 RELAXED_INPUT_SECTION_CODE.
5420 (Output_section::Output_section): Initialize data member checkpoint_.
5421 (Output_section::~Output_section): Delete checkpoint object pointed
5423 (Output_section::add_input_section): Always add an Input_section if
5425 (Output_section::add_merge_input_section): Add assert.
5426 (Output_section::relax_input_section): New method definition.
5427 (Output_section::set_final_data_size): Set load address to zero for
5428 an unallocated section.
5429 (Output_section::do_address_and_file_offset_have_reset_values):
5430 New method definition.
5431 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
5432 Handle relaxed input section.
5433 (Output_section::sort_attached_input_sections): Checkpoint input
5434 section list lazily.
5435 (Output_section::get_input_sections): Change type of input_sections to
5436 list of Simple_input_section pointers. Checkpoint input section list
5437 lazily. Also handle relaxed input sections.
5438 (Output_section::add_input_section_for_script): Take a reference to
5439 a Simple_input_section object instead of Relobj pointer and section
5440 index as parameter. Handle relaxed input sections.
5441 (Output_section::save_states, Output_section::restore_states): New
5443 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
5444 (Output_data::is_data_size_fixed): New method definition.
5445 (Output_data::reset_addresss_and_file_offset): Do not reset data size
5447 (Output_data::address_and_file_offset_have_reset_values): New method
5449 (Output_data::do_address_and_file_offset_have_reset_values): New method
5451 (Output_data::set_data_size): Check that data size is not fixed.
5452 (Output_data::fix_data_size): New method definition.
5453 (Output_data::is_data_size_fixed_): New data member.
5454 (Output_section_headers::set_final_data_size): New method definition.
5455 (Output_section_headers::do_size): New method declaration.
5456 (Output_segment_headers::set_final_data_size): New method definition.
5457 (Output_segment_headers::do_size): New method declaration.
5458 (Output_file_header::set_final_data_size)::New method definition.
5459 (Output_file_header::do_size)::New method declaration.
5460 (Output_section_data::Output_section_data): Add new parameter
5461 is_data_size_fixed and use it to fix data size.
5462 (Output_data_const::Output_data_const): Adjust call to base class
5463 constructor and fix data size.
5464 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
5465 base class constructor and fix data size.
5466 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
5467 base class constructor and fix data size.
5468 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
5469 class constructor and fix data size.
5470 (Output_data_group::set_final_data_size): New method definition.
5471 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
5472 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
5473 class constructor and fix data size.
5474 (Output_relaxed_input_section): New class definition.
5475 (Output_section::Simple_input_section): New class definition.
5476 (Output_section::get_input_sections): Adjust parameter list.
5477 (Output_section::add_input_section_for_script): Same.
5478 (Output_section::save_states, Output_section::restore_states,
5479 Output_section::do_address_and_file_offset_have_reset_values,
5480 (Output_section::Input_section::Input_section): Handle
5481 RELAXED_INPUT_SECTION_CODE. Add new overload for
5482 Output_relaxed_input_section.
5483 (Output_section::Input_section::is_input_section,
5484 Output_section::Input_section::set_output_section): Handle relaxed
5486 (Output_section::Input_section::is_relaxed_input_section,
5487 Output_section::Input_section::output_section_data,
5488 Output_section::Input_section::relaxed_input_section): New method
5490 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
5492 (Output_section::Input_section::u1_): Update comments.
5493 (Output_section::Input_section::u2_): Add new union member poris.
5494 (Output_section::Checkpoint_output_section): New classs definition.
5495 (Output_section::relax_input_section): New method declaration.
5496 (Output_section::checkpoint_): New data member.
5497 (Output_segment): Update comments.
5498 (Output_segment::Output_segment): Un-privatize copy constructor.
5499 (Output_segment::operator=): Un-privatize.
5500 * script-sections.cc (Output_section_element::Input_section_list):
5501 Change element type to Output_section::Simple_input_section.
5502 (Output_section_element_dot_assignment::set_section_addresses):
5503 Register output section data for relaxation clean up.
5504 (Output_data_exression::Output_data_expression): Adjust call to base
5505 constructor to fix data size.
5506 (Output_section_element_data::set_section_addresses): Register
5507 Output_data_expression object for relaxation clean up.
5508 (struct Input_section_info): Replace Relobj pointer and section index
5509 pair with Output_section::Simple_input_section and Convert struct to a
5511 (Input_section_sorter::operator()): Adjust access to
5512 Input_section_info data member to use accessors.
5513 (Output_section_element_input::set_section_addresses): Use layout
5514 parameter. Adjust code to use Output_section::Simple_input_section
5515 and Input_secction_info classes. Register filler for relaxation
5517 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
5518 and section index pair with Output_section::Simple_input_section
5519 class. Adjust code accordingly.
5520 (Phdrs_element::release_segment): New method definition.
5521 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
5523 (Script_sections::release_segments): New method definition.
5524 * gold/script-sections.h (Script_sections::release_segments): New
5526 * gold/target.h (Target::may_relax, Target::relax,
5527 Target::do_may_relax, Target::do_relax): New method definitions.
5529 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5531 * arm.cc (has_signed_unsigned_overflow): New function.
5532 (Arm_relocate_functions::abs8): New function.
5533 (Target_arm::Scan::local): Handle R_ARM_ABS8.
5534 (Target_arm::Scan::global): Likewise.
5535 (Target_arm::relocate::relocate): Likewise.
5536 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5539 2009-09-16 Cary Coutant <ccoutant@google.com>
5541 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
5542 * testsuite/Makefile.in: Regenerate.
5544 2009-09-11 Nick Clifton <nickc@redhat.com>
5546 * po/gold.pot: Updated by the Translation project.
5548 2009-09-08 Cary Coutant <ccoutant@google.com>
5550 * output.cc (Output_file::open): Add execute permission to empty file.
5551 * testsuite/Makefile.am (permission_test): New test.
5552 * testsuite/Makefile.in: Regenerate.
5554 2009-09-02 Ian Lance Taylor <iant@google.com>
5556 * output.cc (Output_file::resize): Call map_no_anonymous rather
5559 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
5561 * gold.cc: Include "incremental.h".
5562 (queue_initial_tasks): Call Incremental_checker methods.
5563 * incremental.cc: Include "output.h".
5564 (Incremental_checker::can_incrementally_link_output_file): New
5566 * incremental.h (Incremental_checker): New class.
5568 * output.cc (Output_file::open_for_modification): New method.
5569 (Output_file::map_anonymous): Changed return type to bool. Record
5571 (Output_file::map_no_anonymous): New method, broken out of map.
5572 (Output_file::map): Use map_no_anonymous and map_anonymous.
5573 * output.h (class Output_file): Update declarations.
5575 2009-08-24 Cary Coutant <ccoutant@google.com>
5577 * options.h (Command_line::Pre_options): New class.
5578 (Command_line::pre_options): New member.
5579 * options.cc (gold::options::ready_to_register): New variable.
5580 (One_option::register_option): Do nothing if not registering options.
5581 Assert if same short option registered twice.
5582 (General_options::General_options): Turn off option registration when
5584 (Command_line::Pre_options::Pre_options): New constructor.
5586 2009-08-24 Cary Coutant <ccoutant@google.com>
5588 * options.h (General_options::no_keep_memory): Remove incorrect
5591 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5593 * Makefile.am (am__skiplex, am__skipyacc): New.
5594 * Makefile.in: Regenerate.
5596 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5598 * Makefile.am (AM_CPPFLAGS): Renamed from ...
5599 (INCLUDES): ... this.
5600 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
5601 (AM_CPPFLAGS): Renamed from ...
5602 (INCLUDE): ... this.
5603 * Makefile.in, testsuite/Makefile.in: Regenerate.
5605 * Makefile.in: Regenerate.
5606 * aclocal.m4: Likewise.
5607 * config.in: Likewise.
5608 * configure: Likewise.
5609 * testsuite/Makefile.in: Likewise.
5611 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
5612 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
5613 * Makefile.in: Regenerate.
5614 * testsuite/Makefile.in: Regenerate.
5616 2009-08-19 Cary Coutant <ccoutant@google.com>
5618 * resolve.cc (Symbol_table::resolve): Don't complain about defined
5619 symbols in shared libraries overridden by hidden or internal symbols
5620 in the main program.
5622 2009-08-19 Chris Demetriou <cgd@google.com>
5624 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
5625 checking source file names in error messages.
5627 2009-08-18 Doug Kwan <dougkwan@google.com>
5629 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
5630 an elcpp::Ehdr as parameter. Adjust call to set_target.
5631 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
5632 an elfcpp::Ehdr as parameter.
5633 * object.cc (Object::set_target): Remove the version that looks up
5634 a target and sets it.
5635 (Sized_relobj::setup): Take a Target object instead of
5636 an elfcpp::Ehdr as parameter. Adjust call to set_target.
5637 (make_elf_sized_object): Find target and ask target to
5639 * object.h: (Object::set_target): Remove the version that looks up
5640 a target and sets it.
5641 (Sized_relobj::setup): Take a Target object instead of
5642 an elfcpp:Ehdr as parameter.
5643 * target.cc: Include dynobj.h.
5644 (Target::do_make_elf_object_implementation): New.
5645 (Target::do_make_elf_object): New.
5646 * target.h (Target::make_elf_object): New template declaration.
5647 (Target::do_make_elf_object): New method declarations.
5648 (Target::do_make_elf_object_implementation): New template declaration.
5650 2009-08-14 Ian Lance Taylor <iant@google.com>
5652 * gold.h (FUNCTION_NAME): Define.
5653 (gold_unreachable): Use FUNCTION_NAME.
5655 2009-08-12 Sriraman Tallam <tmsriram@google.com>
5657 * icf.cc (Icf::find_identical_sections): Issue a warning when a
5658 symbol in the --keep-unique list is not found.
5660 2009-08-12 Sriraman Tallam <tmsriram@google.com>
5662 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
5663 been maked as --keep-unique.
5664 (Icf::unfold_section): New function.
5665 * icf.h (Icf::unfold_section): New function.
5666 * options.h (General_options::keep_unique): New option.
5667 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
5668 * testsuite/Makefile.in: Regenerate.
5669 * testsuite/icf_keep_unique_test.sh: New file.
5670 * testsuite/icf_keep_unique_test.cc: New file.
5672 2009-08-12 Cary Coutant <ccoutant@google.com>
5675 * resolve.cc (Symbol_table::resolve): Check for references from
5676 dynamic objects to hidden and internal symbols.
5677 * testsuite/Makefile.am (hidden_test.sh): New test.
5678 * testsuite/Makefile.in: Regenerate.
5679 * testsuite/hidden_test.sh: New script.
5680 * testsuite/hidden_test_1.c: New test source.
5681 * testsuite/hidden_test_main.c: New test source.
5683 2009-08-11 Doug Kwan <dougkwan@google.com>
5685 * arm.cc: Update comments.
5686 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
5687 segment to locate the .ARM.exidx section if present.
5689 2009-08-09 Doug Kwan <dougkwan@google.com>
5691 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
5694 2009-08-07 Sriraman Tallam <tmsriram@google.com>
5695 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
5698 2009-08-06 Sriraman Tallam <tmsriram@google.com>
5700 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
5701 valid tls_segment only for non-debug-section relocations.
5702 * testsuite/Makefile.am: Add gc_tls_test.
5703 * testsuite/Makefile.in: Regenerate.
5704 * testsuite/gc_tls_test.cc: New file.
5705 * testsuite/gc_tls_test.sh: New file.
5707 2009-08-05 Sriraman Tallam <tmsriram@google.com>
5711 * Makefile.am (CCFILES): Add icf.cc.
5713 * Makefile.in: Regenerate.
5714 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
5715 * gc.h (gc_process_relocs): Populate lists used by icf to contain
5716 section, symbol and addend information for the relocs.
5717 * gold.cc (queue_middle_tasks): Call identical code folding.
5718 * gold.h: Add defines for multimap.
5719 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
5720 to the call of finalize_local_symbols.
5721 * main.cc (main): Create object of class Icf.
5722 * object.cc (Sized_relobj::do_layout): Allow this function to be
5723 called twice during icf.
5724 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
5725 to sections marked as identical by icf.
5726 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
5728 (Sized_relobj::do_section_entsize): New function.
5729 * object.h (Object::section_entsize): New function.
5730 (Object::do_section_entsize): New pure virtual function.
5731 (Relobj::finalize_local_symbols): Add new parameter.
5732 (Relobj::do_section_entsize): New function.
5733 * options.h (General_options::icf): New option.
5734 (General_options::icf_iterations): New option.
5735 (General_options::print_icf_sections): New option.
5736 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
5737 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
5738 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
5740 * symtab.cc (Symbol_table::is_section_folded): New function.
5741 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
5742 to sections marked as identical by icf.
5743 * symtab.h (Symbol_table::set_icf): New function.
5744 (Symbol_table::icf): New function.
5745 (Symbol_table::is_section_folded): New function.
5746 (Symbol_table::icf_): New data member.
5747 * target-reloc.h (relocate_section): Ignore sections folded by icf.
5748 * testsuite/Makefile.am: Add commands to build icf_test.
5749 * testsuite/Makefile.in: Regenerate.
5750 * testsuite/icf_test.sh: New file.
5751 * testsuite/icf_test.cc: New file.
5753 2009-07-24 Chris Demetriou <cgd@google.com>
5755 * layout.cc (is_compressible_debug_section): Fix incorrect
5756 comment about compressed section names.
5758 2009-07-20 Ian Lance Taylor <ian@airs.com>
5761 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
5763 2009-07-16 Ian Lance Taylor <iant@google.com>
5766 * layout.h: #include <map>.
5767 (class Kept_section): Change from struct to class. Add accessors
5768 and setters. Add section size to Comdat_group mapping. Change
5769 Comdat_group to std::map. Add is_comdat_ field. Add
5770 linkonce_size field in union.
5771 (class Layout): Update declaration of find_or_add_kept_section.
5772 Don't declare find_kept_object.
5773 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
5774 parameter. Add object, shndx, is_comdat, and is_group_name
5775 parameters. Change all callers. Adjust for new Kept_section.
5776 (Layout::find_kept_object): Remove.
5777 * object.cc (Sized_relobj::include_section_group): Update use of
5778 Kept_section. Rename secnum to shndx. Only record
5779 Kept_comdat_section if sections are the same size.
5780 (Sized_relobj::include_linkonce_section): Update use of
5781 Kept_section. Only record Kept_comdat_section if sections are the
5782 same size. Set size of linkonce section.
5783 (Sized_relobj::map_to_kept_section): Update call to
5784 get_kept_comdat_section.
5785 * object.h (class Sized_relobj): Rename fields in
5786 Kept_comdat_section to drop trailing underscores; change object
5787 field to Relobj*. Change Kept_comdat_section_table to store
5788 struct rather than pointer.
5789 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
5790 Add kept_object and kept_shndx parameters. Change all callers.
5791 (Sized_relobj::get_kept_comdat_section): Change return type to
5792 bool. Add kept_object and kept_shndx parameters. Change all
5794 * plugin.cc (Pluginobj::include_comdat_group): Update call to
5795 Layout::find_or_add_kept_section.
5797 2009-07-09 Ian Lance Taylor <iant@google.com>
5799 * merge.cc (Object_merge_map::initialize_input_to_output_map):
5800 Reserve space in the hash table.
5802 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
5804 * fileread.cc (File_read::get_mtime): New method.
5805 * fileread.h (Timespec): New structure.
5806 (File_read::get_mtime): New method.
5807 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
5808 Renamed from timestamp_nsec.
5809 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
5811 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
5813 (Incremental_inputs::report_archive): Save mtime; style fix.
5814 (Incremental_inputs::report_obejct): Save mtime; style fix.
5815 (Incremental_inputs::report_script): Save mtime; style fix.
5816 (Incremental_inputs::finalize_inputs): Style fix.
5817 (Incremental_inputs::finalize): Style fix.
5818 (Incremental_inputs::create_input_section_data): Store inputs
5820 * incremental.h (Incremental_inputs::report_script): Add mtime
5822 (Incremental_inputs::Input_info::Input_info): Intialize only one
5824 (Incremental_inputs::Input_info::archive): Move to nameless
5826 (Incremental_inputs::Input_info::obejct): Move to nameless union.
5827 (Incremental_inputs::Input_info::script): Move to nameless union.
5828 (Incremental_inputs::mtime): New field.
5829 * script.cc (read_input_script): Pass file mtime to
5831 * script.h (Script_info::inputs): Style fix.
5833 2009-07-01 Ian Lance Taylor <ian@airs.com>
5835 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
5838 2009-06-24 Ian Lance Taylor <iant@google.com>
5841 * layout.cc (Layout::choose_output_section): If we find an
5842 existing section, update the flags.
5843 (Layout::create_notes): New function, broken out of
5845 (Layout::finalize): Don't create note sections.
5846 (Layout::create_note): Don't crash if linker script discards
5848 (Layout::create_gold_note): Likewise.
5849 (Layout::create_build_id): Likewise. Don't set
5850 after_input_sections on the section.
5851 (Layout::create_executable_stack_info): Remove target parameter.
5853 * layout.h (class Layout): Declare create_notes. Update
5854 declaration of create_executable_stack_info.
5855 * gold.cc (queue_middle_tasks): Call create_notes.
5856 * output.cc (Output_section::update_flags_for_input_section): Move
5857 here from output.h. If SHF_ALLOC flag is newly set, mark address
5859 * output.h (Output_data::mark_address_invalid): New function.
5860 (class Output_section): Only declare, not define,
5861 update_flags_for_input_section. Remove set_flags.
5863 2009-06-24 Ian Lance Taylor <iant@google.com>
5865 * script-sections.cc (Output_section_definition::
5866 set_section_addresses): Rename shadowing local load_address to
5869 2009-06-24 Ian Lance Taylor <iant@google.com>
5872 * reloc.cc (relocate_sections): Skip empty relocation sections.
5874 2009-06-23 Ian Lance Taylor <iant@google.com>
5877 * layout.cc (Layout::create_note): Use choose_output_section
5878 rather than make_output_section.
5880 2009-06-23 Ian Lance Taylor <iant@google.com>
5883 * options.cc (General_options::parse_V): Set printed_version_.
5884 (General_options::General_options): Initialize printed_version_.
5885 * options.h (class General_options): Add printed_version_ field.
5886 * gold.cc (queue_initial_tasks): If there are no input files,
5887 don't give a fatal error if we printed the version information.
5888 (queue_middle_tasks): If using -r with a shared object, give a
5889 fatal error rather than an ordinary error.
5891 2009-06-23 Ian Lance Taylor <iant@google.com>
5894 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
5895 (Layout::make_output_section): Set have_stabstr_section_ if we see
5896 a .stab*str section.
5897 (Layout::finalize): Call link_stabs_sections.
5898 (Layout::link_stabs_sections): New file.
5899 * layout.h (class Layout): Add have_stabstr_section_ field.
5900 Declare link_stabs_sections.
5902 2009-06-23 Doug Kwan <dougkwan@google.com>
5904 * Makefile.am (libgold_a_LIBADD): New.
5905 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
5906 * Makefile.in: Regenerate.
5907 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
5908 * configure: Regenerate.
5909 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
5910 * fileread.cc: Include sys/state.h
5911 * gold.h: Declare memmem and strndup if found missing.
5912 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
5914 2009-06-23 Ian Lance Taylor <iant@google.com>
5916 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
5917 * configure: Rebuild.
5919 2009-06-23 Ian Lance Taylor <iant@google.com>
5922 * object.cc (Object::section_contents): Don't try to get a view if
5923 the section has length zero.
5924 (Object::handle_gnu_warning_section): If the section is empty, use
5925 the name of the section as the warning.
5927 2009-06-23 Ian Lance Taylor <iant@google.com>
5930 * stringpool.h (class Stringpool_template): Add optimize_ field.
5931 (Stringpool_template::set_optimize): New function.
5932 * stringpool.cc (Stringpool_template::Stringpool_template):
5933 Initialize optimize_ field.
5934 (Stringpool_template::set_string_offsets): Test local optimize
5935 fild rather than parameter.
5936 * layout.cc (Layout::Layout): Call set_optimize on the section
5939 2009-06-22 Ian Lance Taylor <iant@google.com>
5942 * yyscript.y: Parse TARGET.
5943 * script.cc (script_set_target): New function.
5944 * script-c.h (script_set_target): Declare.
5945 * options.cc (General_options::string_to_object_format): Rename
5946 from string_to_object_format in anonymous namespace. Change
5948 * options.h (class General_options): Declare
5949 string_to_object_format.
5951 2009-06-22 Ian Lance Taylor <iant@google.com>
5953 * script-sections.cc (Script_sections::create_segments): Don't put
5954 program headers in a PT_LOAD segment if -n or -N.
5956 2009-06-22 Ian Lance Taylor <iant@google.com>
5959 * options.h (class General_options): Add -z lazy and -z now. Sort
5960 -z options into alphabetical order.
5961 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
5963 2009-06-21 Ian Lance Taylor <iant@google.com>
5965 * layout.cc (Layout::make_output_section): Call
5966 Target::new_output_section.
5967 (Layout::attach_allocated_section_to_segment): Put large section
5968 sections in a separate load segment with the large segment flag
5970 (Layout::segment_precedes): Sort large data segments after other
5972 (align_file_offset): New static function.
5973 (Layout::set_segment_offsets): Use align_file_offset.
5974 * output.h (class Output_section): Add is_small_section_ and
5975 is_large_section_ fields.
5976 (Output_section::is_small_section): New function.
5977 (Output_section::set_is_small_section): New function.
5978 (Output_section::is_large_section): New function.
5979 (Output_section::set_is_large_section): New function.
5980 (Output_section::is_large_data_section): New function.
5981 (class Output_segment): Add is_large_data_segment_ field.
5982 (Output_segment::is_large_data_segment): New function.
5983 (Output_segment::set_is_large_data_segment): New function.
5984 * output.cc (Output_section::Output_section): Initialize new
5986 (Output_segment::Output_segment): Likewise.
5987 (Output_segment::add_output_section): Add assertion that large
5988 data sections always go in large data segments. Force small data
5989 sections to the end of the list of data sections. Force small BSS
5990 sections to the start of the list of BSS sections. For large BSS
5991 sections to the end of the list of BSS sections.
5992 * symtab.h (class Symbol): Declare is_common_shndx.
5993 (Symbol::is_defined): Check Symbol::is_common_shndx.
5994 (Symbol::is_common): Likewise.
5995 (class Symbol_table): Define enum Commons_section_type. Update
5996 declarations. Add small_commons_ and large_commons_ fields.
5997 * symtab.cc (Symbol::is_common_shndx): New function.
5998 (Symbol_table::Symbol_table): Initialize new fields.
5999 (Symbol_table::add_from_object): Put small and large common
6000 symbols in the right list.
6001 (Symbol_table::sized_finalized_symbol): Check
6002 Symbol::is_common_shndx.
6003 (Symbol_table::sized_write_globals): Likewise.
6004 * common.cc (Symbol_table::do_allocate_commons): Allocate new
6005 common symbol lists. Don't call do_allocate_commons_list if the
6007 (Symbol_table::do_allocate_commons_list): Remove is_tls
6008 parameter. Add comons_section_type parameter. Change all
6009 callers. Handle small and large common symbols.
6010 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
6011 Symbol::is_common_shndx.
6012 * resolve.cc (symbol_to_bits): Likewise.
6013 * target.h (Target::small_common_shndx): New function.
6014 (Target::small_common_section_flags): New function.
6015 (Target::large_common_shndx): New function.
6016 (Target::large_common_section_flags): New function.
6017 (Target::new_output_section): New function.
6018 (Target::Target_info): Add small_common_shndx, large_common_shndx,
6019 small_common_section_flags, and large_common_section_flags
6021 (Target::do_new_output_section): New virtual function.
6022 * arm.cc (Target_arm::arm_info): Initialize new fields.
6023 * i386.cc (Target_i386::i386_info): Likewise.
6024 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
6026 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
6027 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
6028 (Target_x86_64::do_new_output_section): New function.
6029 * configure.ac: Define conditional MCMODEL_MEDIUM.
6030 * testsuite/Makefile.am (check_PROGRAMS): Add large.
6031 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
6032 (large_LDFLAGS): Define.
6033 * testsuite/large.c: New file.
6034 * testsuite/testfile.cc (Target_test::test_target_info):
6035 Initialize new fields.
6036 * configure, testsuite/Makefile.in: Rebuild.
6038 2009-06-05 Doug Kwan <dougkwan@google.com>
6040 * Makefile.am (CCFILES): Add target.cc.
6041 * Makefile.in: Regenerate.
6042 * i386.cc (class Target_i386): Define new virtual method to
6043 override do_is_local_label_name in parent.
6044 * object.cc (Sized_relobj::do_count_local_symbols): Discard
6045 local symbols if --discard-locals or -X is given.
6046 * options.h (class General_options): Declare new options
6047 '--discard-locals' and '-X' for discarding locals.
6048 * target.h (class Target): Define new methods is_local_label_name.
6049 Declare new virtual method do_is_local_label_name.
6050 * target.cc: New file.
6051 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
6052 (check_SCRIPTS): Add discard_locals_test.sh.
6053 (check_DATA): Add discard_local_tests.syms.
6054 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
6055 (discard_local_tests.syms, discard_locals_test.o): New make rules.
6056 * testsuite/Makefile.in: Regenerate.
6057 * testsuite/discard_locals_test.c: New file.
6058 * testsuite/discard_locals_test.sh: Same.
6060 2009-06-05 Doug Kwan <dougkwan@google.com>
6062 * object.cc (Sized_relobj::Sized_relobj): Initialize
6063 discarded_eh_frame_shndx_ to -1U.
6064 (Sized_relobj::do_layout): Record index of a discard .eh_frame
6066 (Sized_relobj::do_count_local_symbols): Skip local symbols in
6067 a discarded .eh_frame section.
6068 (Sized_relobj::do_finalize_local_symbols): Ditto.
6069 * object.h (class Sized_relobj): Declare new member
6070 discarded_eh_frame_shndx_.
6071 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
6072 (local_labels_test.o, local_labels_test): New rules.
6073 * testsuite/Makefile.in: Regenerate.
6075 2009-06-04 Doug Kwan <dougkwan@google.com>
6077 * layout.cc (Layout::section_name_mapping): Add mapping for
6078 special ARM sections.
6080 2009-06-03 Doug Kwan <dougkwan@google.com>
6082 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
6083 (utils::has_overflow): Same.
6085 2009-06-03 Ian Lance Taylor <iant@google.com>
6087 * layout.cc (Layout::section_name_mapping): New array, replacing
6088 Layout::linkonce_mapping.
6089 (Layout::section_name_mapping_count): New variable, replacing
6090 Layout::linkonce_mapping_count.
6091 (Layout::linkonce_output_name): Remove.
6092 (Layout::output_section_name): Rewrite.
6093 * layout.h (class Layout): Rename Linkonce_mapping to
6094 Section_name_mapping, linkonce_mapping to section_name_mapping,
6095 linkonce_mapping_count to section_name_mapping_count. Don't
6096 declare linkonce_output_name.
6098 2009-06-03 Doug Kwan <dougkwan@google.com>
6100 * gold/arm.cc (namespace utils): New.
6101 (Target_arm::reloc_is_non_pic): Define new method.
6102 (class Arm_relocate_functions): New.
6103 (Target_arm::Relocate::relocate): Handle relocation types used by
6106 2009-06-03 Ian Lance Taylor <iant@google.com>
6108 * arm.cc (Target_arm::scan::global): Use || instead of |.
6110 2009-06-02 Doug Kwan <dougkwan@google.com>
6112 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
6113 issued_non_pic_error_.
6114 (class Target_arm::Scan): Declare new method check_non_pic.
6115 Define new method symbol_needs_plt_entry.
6116 Declare new data member issued_non_pic_error_.
6117 (class Target_arm::Relocate): Declare new method
6118 should_apply_static_reloc.
6119 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
6120 (Target_arm::Scan::check_non_pic): Define new method.
6121 (Target_arm::Scan::local): Handle a small subset of reloc types used
6123 (Target_arm::Scan::local): Same.
6124 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
6126 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
6128 * incremental.cc (Incremental_inputs::report_command_line): Filter
6129 out --incremental-* options.
6131 2009-05-29 Doug Kwan <dougkwan@google.com>
6133 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
6135 (class Target_arm): Update comment.
6136 (Target_arm::Target_arm): Initialize new data members GOT_,
6137 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
6138 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
6139 and Target_arm::rel_dyn_section.
6140 Declare new_enum Target_arm::Got_type.
6141 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
6143 Update commments for member do_dynsym_value.
6144 (Target_arm::got_size, Target_arm::plt_section,
6145 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
6146 new methods inside class defintion.
6147 (Target_arm::got_section): Define new method.
6148 (Target_arm::rel_dyn_section): Same.
6149 (Output_data_plt_arm): New template class.
6150 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
6151 (Output_data_plt_arm:do_adjust_output_section): Define new method.
6152 (Output_data_plt_arm::add_entry): Same.
6153 (Output_data_plt_arm::first_plt_entry): Define new
6154 static data member for PLT instruction template.
6155 (Output_data_plt_arm::plt_entry): Same.
6156 (Output_data_plt_arm::do_write): Define new method.
6157 (Target_arm::make_plt_entry): Same.
6158 (Target_arm::do_finalize_sections): Same.
6159 (Target_arm::do_dynsym_value): Same.
6161 2009-05-28 Doug Kwan <dougkwan@google.com>
6163 * Makefile.am (TARGETSOURCES): Add arm.cc.
6164 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
6165 * Makefile.in: Regenerate.
6167 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
6169 2009-05-26 Doug Kwan <dougkwan@google.com>
6171 * options.cc (General_options::parse_exclude_libs). Fix a comment.
6172 (General_options::check_excluded_libs): Strip off directories in
6173 archive name before matching like GNU ld does.
6174 * testsuite/Makefile.am (MOSTLYCLEANFILES,
6175 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
6176 (exclude_libs_test_LDFLAGS): Add linker option
6177 -Wl,--exclude-libs,libexclude_libs_test_3
6178 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
6179 an explicit archive without using -l.
6180 (alt/libexclude_libs_test_3.a): New make rule.
6181 * testsuite/Makefile.in: Regenerate.
6182 * testsuite/exclude_libs_test.c : Declare lib3_default().
6184 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
6185 * exclude_libs_test_3.c: New file.
6187 2009-05-26 Nick Clifton <nickc@redhat.com>
6189 * po/id.po: New Indonesian translation.
6190 * po/gold.pot: Updated template file.
6192 2009-05-22 Sriraman Tallam <tmsriram@google.com>
6194 * testsuite/Makefile.am: Add -ffunction-sections to compile
6195 gc_comdat_test files. Add -Wl,--gc-sections to build
6197 * testsuite/Makefile.in: Regenerate.
6198 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
6200 2009-05-21 Sriraman Tallam <tmsriram@google.com>
6202 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
6203 kept comdat section was garbage collected.
6204 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
6205 * testsuite/Makefile.in: Regenerate.
6206 * testsuite/gc_comdat_test.sh: New file.
6207 * testsuite/gc_comdat_test_1.cc: New file.
6208 * testsuite/gc_comdat_test_2.cc: New file.
6210 2009-05-19 Doug Kwan <dougkwan@google.com>
6212 * archive.cc (Archive::Archive): Move constructor from archive.h
6213 to here. Initialize no_export_.
6214 (Archive::get_elf_object_for_member): Set no_export flag of object.
6215 * archive.h (Archive::Archive): Move constructor body to
6217 (Archive::no_export): New method.
6218 (Archive::no_export_): New field.
6219 * object.h (Object::Object): Initialize no_export_ to false.
6220 (Object::no_export, Object::set_no_export): New methods.
6221 (Object::no_export_): New field.
6222 * options.cc (General_options::parse_exclude_libs): New method.
6223 (General_options::check_excluded_libs) Same.
6224 * options.h (exclude_libs): New option.
6225 (General_options::check_excluded_libs): New method declaration.
6226 (General_options::excluded_libs_): New field.
6227 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
6228 default or protected visibility if an object has no-export flag set.
6229 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
6230 (check_SCRIPTS): Add exclude_libs_test.sh.
6231 (check_DATA): Add exclude_libs_test.syms.
6232 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
6233 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
6234 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
6235 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
6236 (exclude_libs_test.syms, libexclude_libs_test_1.a,
6237 libexclude_libs_test_2.a): New rules.
6238 * testsuite/Makefile.in: Regenerate.
6239 * testsuite/exclude_libs_test.c: New file.
6240 * testsuite/exclude_libs_test.sh: Ditto.
6241 * testsuite/exclude_libs_test_1.c: Ditto.
6242 * testsuite/exclude_libs_test_2.c: Ditto.
6244 2009-05-15 Ian Lance Taylor <iant@google.com>
6246 * configure.ac: Check for declarations for cases where libiberty.h
6247 checks HAVE_DECL_xxx.
6248 * configure, config.in: Rebuild.
6250 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
6252 * gold.h (Incremental_argument_list): Remove (invalid) forward
6254 * incremental.cc (Incremental_inputs::report_achive): New method.
6255 (Incremental_inputs::report_object): New method.
6256 (Incremental_inputs::report_script): New method.
6257 (Incremental_inputs::finalize_inputs): New method.
6258 (Incremental_inputs::finalize): Call finalize_inputs().
6259 (Incremental_inputs::sized_create_incremental_inputs_section_data):
6260 Create inputs entries.
6261 * incremental.h (Incremental_input_type): New enum.
6262 (Incremental_inputs::Incremental_input): Initialize new fields.
6263 (Incremental_inputs::report_inputs): New method.
6264 (Incremental_inputs::report_achive): New method.
6265 (Incremental_inputs::report_object): New method.
6266 (Incremental_inputs::report_script): New method.
6267 (Incremental_inputs::finalize_inputs): New method.
6268 (Incremental_inputs::Input_info): New struct.
6269 (Incremental_inputs::Input_info_map): New typedef.
6270 (Incremental_inputs::lock_): New field.
6271 (Incremental_inputs::Inputs_): New field.
6272 (Incremental_inputs::Inputs_map): New field.
6273 * main.cc (main): Call Incremental_input::report_inputs.
6274 * options.h (Input_argument_list): Typedef moved from
6276 (Input_file_group::Files): Remove, use ::Input_argument_list.
6277 (Input_file_group::Input_argument_list): Remove, use
6278 ::Input_argument_list.
6279 * plugin.cc (Plugin_manager::add_input_file): Add error in
6281 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
6283 * script.cc (read_input_script): Call
6284 Incremental_input::report_script.
6285 * script.h (Script_info): New class.
6287 2009-04-27 Ian Lance Taylor <iant@google.com>
6289 * x86_64.cc (do_adjust_output_section): Set entsize to
6292 2009-04-23 Elliott Hughes <enh@google.com>
6294 * output.cc (Output_file::close): After short writes, continue
6295 writing from the correct offset in the buffer being written.
6297 2009-04-23 Chris Demetriou <cgd@google.com>
6299 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
6300 * configure: Regenerate.
6301 * config.in: Regenerate.
6302 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
6303 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
6305 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
6307 * incremental.cc (Incremental_inputs_header_data): Renamed from
6308 Incremental_input_header_data.
6309 (Incremental_inputs_header_data::data_size): New field.
6310 (Incremental_inputs_header_data::put_input_file_count): Renamed
6311 from input_file_count.
6312 (Incremental_inputs_header_data::put_command_line_offset): Renamed
6313 from command_line_offset.
6314 (Incremental_inputs_header_data::put_reserved): Renamed from
6316 (Incremental_inputs_entry_data): Renamed from
6317 Incremental_input_entry_data.
6318 (Incremental_inputs_entry_data::data_size): New field.
6319 (Incremental_inputs::report_command_line): New method.
6320 (Incremental_inputs::finalize): New method.
6321 (Incremental_inputs::create_incremental_inputs_data): New method.
6322 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
6323 * incremental.h: New file.
6324 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
6325 (Layout::finalize): Create incremental inputs section in
6327 (Layout::create_incremental_info_sections): New method.
6328 * layout.h (Layout::incremental_inputs): New method.
6329 (Layout::create_incremental_info_sections): New method.
6330 (Layout::incremental_inputs_): New field.
6331 * main.cc (main): Notify Incremental_input of the command line.
6333 2009-04-01 Ian Lance Taylor <iant@google.com>
6334 Mikolaj Zalewski <mikolajz@google.com>
6336 * gold.h (reserve_unordered_map): Define, three versions, one for
6337 each version of Unordered_map.
6338 * layout.cc (Layout::Layout): Remove options parameter. Add
6339 number_of_input_files parameter. Don't initialize options_.
6340 Initialize number_of_input_files_ and resized_signatures_. Move
6341 sections_are_attached_.
6342 (Layout::layout_group): Reserve space for group_signatures_.
6343 (Layout::find_or_add_kept_section): Change name parameter to be a
6344 reference. Resize signatures_ map when it gets large enough.
6345 (Layout::layout_eh_frame): Use parameters->options() instead of
6347 (Layout::make_output_section): Likewise.
6348 (Layout::attach_allocated_section_to_segment): Likewise.
6349 (Layout::finalize, Layout::create_executable_stack): Likewise.
6350 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
6351 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
6352 * layout.h (class Layout): Update declarations. Remove options_
6353 field. Add number_of_input_files_ and resized_signatures_
6354 fields. Move sections_are_attached_ field.
6355 * main.cc (main): Pass number of input files to Layout
6356 constructor. Don't pass options.
6358 2009-03-30 Ian Lance Taylor <iant@google.com>
6360 * ffsll.c (ffsll): Correct implementation.
6362 2009-03-27 Ian Lance Taylor <iant@google.com>
6364 * ffsll.c: New file.
6365 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
6366 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
6367 * ftruncate.c (ftruncate): Declare before definition.
6368 * mremap.c (mremap): Likewise.
6369 * pread.c (pread): Likewise.
6370 * configure, Makefile.in, config.in: Rebuild.
6372 * mremap.c: New file.
6373 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
6374 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
6375 (mremap): Declare if HAVE_MREMAP is not defined.
6376 * configure, Makefile.in, config.in: Rebuild.
6378 2009-03-27 Cary Coutant <ccoutant@google.com>
6380 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
6381 position independent.
6382 * sparc.cc (Target_sparc::check_non_pic): Likewise.
6383 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
6385 2009-03-24 Cary Coutant <ccoutant@google.com>
6387 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
6389 (needs_dynamic_reloc): Likewise.
6391 2009-03-24 Ian Lance Taylor <iant@google.com>
6393 * yyscript.y (file_cmd): Recognize EXTERN.
6394 (extern_name_list, extern_name_list_body): New nonterminals.
6395 * script.cc (script_add_extern): Define.
6396 * script-c.h (script_add_extern): Declare.
6398 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
6400 * object.cc (is_elf_object): Define.
6401 * object.h (is_elf_object): Declare.
6402 * archive.cc (Archive::get_elf_object_for_member): Call
6404 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
6406 2009-03-24 Elliott Hughes <enh@google.com>
6408 * output.cc (Output_file::map_anonymous): Define.
6409 (Output_file::map): Use map_anonymous. If the regular mmap fails,
6410 try an anonymous one. Report the size if the mmap fails.
6411 * output.h (class Output_file): Declare map_anonymous.
6413 2009-03-24 Ian Lance Taylor <iant@google.com>
6415 * target-select.cc (instantiate_target): Don't acquire the lock if
6416 the instantiated_target_ field has already been set.
6418 2009-03-23 Ian Lance Taylor <iant@google.com>
6420 * gold-threads.h (class Initialize_lock): Define.
6421 * gold-threads.cc (class Initialize_lock_once): Define.
6422 (initialize_lock_control): New static variable.
6423 (initialize_lock_pointer): New static variable.
6424 (initialize_lock_once): New static function.
6425 (Initialize_lock::Initialize_lock): Define.
6426 (Initialize_lock::initialize): Define.
6427 * target-select.h: Include "gold-threads.h".
6428 (class Target_selector): Add lock_ and initialize_lock_ fields.
6429 Don't define instantiate_target, just declare it.
6430 * target-select.cc (Target_selector::Target_selector): Initialize
6432 (Target_selector::instantiate_target): Define.
6433 * descriptors.h: Include "gold-threads.h".
6434 (class Descriptors): Add initialize_lock_ field.
6435 * descriptors.cc (Descriptors::Descriptors): Initialize new
6437 (Descriptors::open): Use initialize_lock_ field
6438 * errors.h (class Errors): Add initialize_lock_ field.
6439 * errors.cc (Errors::Errors): Initialize new field.
6440 (Errors::initialize_lock): Use initialize_lock_ field.
6441 * powerpc.cc (class Target_selector_powerpc): Remove
6442 instantiated_target_ field. In do_recognize call
6443 instantiate_target rather than do_instantiate_target. In
6444 do_instantiate_target just allocate a new target.
6445 * sparc.cc (class Target_selector_sparc): Likewise.
6447 * freebsd.h: New file.
6448 * i386.cc: Include "freebsd.h".
6449 (Target_i386): Derive from Target_freebsd rather than
6451 (Target_selector_i386): Derive from Target_selector_freebsd rather
6452 than Target_selector.
6453 * x86_64.cc: Include "freebsd.h".
6454 (Target_x86_64): Derive from Target_freebsd rather than
6456 (Target_selector_x86_64): Derive from Target_selector_freebsd
6457 rather than Target_selector.
6458 * target.h (class Target): Add adjust_elf_header and
6459 do_adjust_elf_header.
6460 * output.cc (Output_file_header:: do_sized_write): Call target
6461 adjust_elf_header routine.
6462 * configure.tgt: Set targ_osabi.
6463 * configure.ac: Define GOLD_DEFAULT_OSABI.
6464 * parameters.cc (Parameters::default_target): Pass
6465 GOLD_DEFAULT_OSABI to select_target.
6466 * target-select.h (class Target_selector): Make instantiate_target
6467 protected rather than private.
6468 * Makefile.am (HFILES): Add freebsd.h.
6469 * configure, Makefile.in, config.in: Rebuild.
6471 * merge.cc (do_add_input_section): Correct pend value. Change
6472 message about last entry not being null terminated from error to
6475 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
6477 * incremental.cc: New file.
6478 * Makefile.am (CCFILES): Add incremental.cc.
6479 * Makefile.in: Rebuild.
6481 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
6483 * layout.cc (Layout::output_section_name): Preserve names
6484 of '.note.' sections.
6486 2009-03-19 Ian Lance Taylor <iant@google.com>
6488 * descriptors.cc (Descriptors::open): Check that the options are
6489 valid before using them.
6491 2009-03-18 Ian Lance Taylor <iant@google.com>
6493 * script-sections.h: Include <list>.
6494 (class Script_sections): Change Sections_elements from std::vector
6495 to std::list. Typedef public Elements_iterator. Add
6496 orphan_section_placement_, data_segment_align_start_, and
6497 saw_data_segment_align_ fields. Remove data_segment_align_index_
6499 * script-sections.cc (class Orphan_section_placement): New class.
6500 (class Sections_element): Add virtual functions is_relro and
6501 orphan_section_init. Remove virtual function place_orphan_here.
6502 (class Output_section_definition): Add is_relro and
6503 orphan_section_init. Remove place_orphan_here.
6504 (class Orphan_output_section): Likewise.
6505 (Script_sections::Script_sections): Update for field changes.
6506 (Script_sections::data_segment_align): Set saw_data_segment_align_
6507 and data_segment_align_start_, not data_segment_align_index.
6508 (Script_sections::data_segment_relro_end): Check
6509 saw_data_segment_align_. Use data_segment_align_start_ rather
6510 than data_segment_align_index_.
6511 (Script_sections::place_orphan): Rewrite to use
6512 Orphan_section_placement.
6514 2009-03-17 Ian Lance Taylor <iant@google.com>
6516 * archive.cc (Archive::add_symbols): Check for a version attached
6517 to the symbol name in the archive map.
6518 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
6519 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
6520 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
6521 (ver_test_11.a): New target.
6522 * testsuite/Makefile.in: Rebuild.
6524 * configure.ac: Check for chsize and posix_fallocate. Replace
6526 * ftruncate.c: New file, from gnulib.
6527 * output.cc (posix_fallocate): Define dummy version if not
6528 HAVE_POSIX_FALLOCATE.
6529 (Output_file::map): Call posix_fallocate rather than lseek and
6531 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
6532 * configure, Makefile.in, config.in: Rebuild.
6534 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
6536 * layout.h (Layout::create_note): Add section_name parameter.
6537 * layout.cc (Layout::create_note): Likewise.
6538 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
6540 2009-03-17 Ian Lance Taylor <iant@google.com>
6542 * descriptors.cc: Include "options.h".
6543 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
6544 (Descriptors::open): Always use O_CLOEXEC when opening a new
6545 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
6546 then set FD_CLOEXEC.
6548 * sparc.cc (class Target_sparc): Add has_got_section.
6549 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
6550 make sure we have a GOT section.
6552 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
6553 (Target_sparc::Scan::local): Likewise.
6554 (Target_sparc::Scan::global): Likewise.
6555 (Target_sparc::Relocate::relocate): Likewise.
6556 (Target_sparc::Relocate::relocate_tls): Likewise.
6558 * symtab.cc (Symbol_table::define_default_version): New function,
6559 broken out of add_from_object.
6560 (Symbol_table::add_from_object): Call define_default_version.
6561 (Symbol_table::define_special_symbol): Add resolve_oldsym
6562 parameter. Change all callers. If the version for a symbol comes
6563 from a version script, resolve it with the symbol with the same
6564 name with no version. Also add the symbol without a version if
6566 (do_define_in_output_data): If resolving with oldsym, don't delete
6568 (do_define_in_output_segment): Likewise.
6569 (do_define_as_constant): Likewise.
6570 * symtab.h (class Symbol_table): Update declarations.
6572 2009-03-13 Ian Lance Taylor <iant@google.com>
6574 * readsyms.cc (Read_symbols::incompatible_warning): New function.
6575 (Read_symbols::requeue): New function.
6576 (Read_symbols::do_read_symbols): If make_elf_object fails because
6577 the target type is not configured, and the file was searched for,
6578 issue a warning and retry with the next directory.
6579 (Add_symbols::run): If the file has an incompatible format, and
6580 it was searched for, requeue the Read_symbols task. On error,
6582 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
6583 dirindex parameter to constructor. Change all callers. Declare
6584 incompatible_warning and requeue.
6585 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
6586 input_argument_ and input_group_ fields. Add them to
6587 constructor. Change all callers.
6588 (class Read_script): Add dirindex_ field. Add it to constructor.
6590 * archive.cc (Archive::setup): Remove input_objects parameter.
6592 (Archive::get_file_and_offset): Likewise.
6593 (Archive::read_all_symbols): Likewise.
6594 (Archive::read_symbols): Likewise.
6595 (Archive::get_elf_object_for_member): Remove input_objects
6596 parameter. Add punconfigured parameter. Change all callers.
6597 (Archive::add_symbols): Change return type to bool. Check return
6598 value of include_member.
6599 (Archive::include_all_members): Likewise.
6600 (Archive::include_member): Change return type to bool. Return
6601 false if first included object has incompatible target. Set
6602 included_member_ field.
6603 (Add_archive_symbols::run): If add_symbols returns false, requeue
6605 * archive.h (class Archive): Add included_member_ field.
6606 Initialize it in constructor. Add input_file and searched_for
6607 methods. Update declarations.
6608 (class Add_archive_symbols): Add dirpath_, dirindex_, and
6609 input_argument_ fields. Add them to constructor. Change all
6611 * script.cc: Include "target-select.h".
6612 (class Parser_closure): Add skip_on_incompatible_target_ and
6613 found_incompatible_target_ fields. Add
6614 skip_on_incompatible_target parameter to constructor. Change all
6615 callers. Add methods skip_on_incompatible_target,
6616 clear_skip_on_incompatible_target, found_incompatible_target, and
6617 set_found_incompatible_target.
6618 (read_input_script): Add dirindex parameter. Change all callers.
6619 If parser finds an incompatible target, requeue Read_symbols
6621 (script_set_symbol): Clear skip_on_incompatible_target in
6623 (script_add_assertion, script_parse_option): Likewise.
6624 (script_start_sections, script_add_phdr): Likewise.
6625 (script_check_output_format): New function.
6626 * script.h (read_input_script): Update declaration.
6627 * script-c.h (script_check_output_format): Declare.
6628 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
6629 (ignore_cmd): Remove OUTPUT_FORMAT.
6630 * fileread.cc (Input_file::Input_file): Add explicit this.
6631 (Input_file::will_search_for): New function.
6632 (Input_file::open): Add pindex parameter. Change all callers.
6633 * fileread.h (class Input_file): Add input_file_argument method.
6634 Declare will_search_for. Update declarations.
6635 * object.cc (make_elf_object): Add punconfigured parameter.
6637 * object.h (class Object): Make input_file public. Add
6638 searched_for method.
6639 (make_elf_object): Update declaration.
6640 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
6642 * dirsearch.h (class Dirsearch): Update declaration.
6643 * options.h (class General_options): Add --warn-search-mismatch.
6644 * parameters.cc (Parameters::is_compatible_target): New function.
6645 * parameters.h (class Parameters): Declare is_compatible_target.
6646 * workqueue.cc (Workqueue::add_blocker): New function.
6647 * workqueue.h (class Workqueue): Declare add_blocker.
6649 * fileread.cc (Input_file::open): Remove options parameter.
6651 (Input_file::open_binary): Likewise.
6652 * script.cc (read_input_script): Likewise.
6653 * readsyms.h (class Read_symbols): Remove options_ field. Remove
6654 options parameter from constructor. Change all callers.
6655 (class Read_script): Likewise.
6656 * fileread.h (class Input_file): Update declarations.
6657 * script.h (read_input_script): Update declaration.
6659 2009-03-10 Nick Clifton <nickc@redhat.com>
6661 * po/es.po: New Spanish translation.
6663 2009-03-06 Cary Coutant <ccoutant@google.com>
6665 * options.cc (parse_short_option): Keep dash_z from registering itself.
6667 2009-03-03 Ian Lance Taylor <iant@google.com>
6670 * target-reloc.h (relocate_section): Pass output_section to
6672 * i386.cc (Target_i386::should_apply_static_reloc): Add
6673 output_section parameter. Change all callers.
6674 (Target_i386::Relocate::relocate): Add output_section parameter.
6675 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
6676 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
6677 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
6678 * testsuite/two_file_shared.sh: New script.
6679 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
6680 (check_DATA): Add two_file_shared.dbg.
6681 (two_file_shared.dbg): New target.
6682 * testsuite/Makefile.in: Rebuild.
6684 2009-03-01 Ian Lance Taylor <iant@google.com>
6686 * configure.ac: Check for byteswap.h.
6687 * configure: Rebuild.
6688 * config.in: Rebuild.
6690 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
6692 * layout.cc (Layout::find_or_add_kept_section): New function.
6693 (Layout::add_comdat): Removed.
6694 * layout.h (struct Kept_section): Move out of class Layout.
6695 Remove trailing underscores from field names. Add group_sections
6696 field. Rename group_ field to is_group. Change all uses.
6697 (class Layout): Declare find_or_add_kept_section, not add_comdat.
6698 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
6699 comdat_groups_ field.
6700 (Sized_relobj::include_section_group): Use
6701 find_or_add_kept_section and Kept_section::group_sections.
6702 (Sized_relobj::include_linkonce_section): Likewise.
6703 * object.cc (class Sized_relobj): Don't define Comdat_group or
6704 Comdat_group_table. Remove find_comdat_group and
6705 add_comdat_group. Remove comdat_groups_ field.
6706 * plugin.cc (include_comdat_group): Use
6707 Layout::find_or_add_kept_section.
6709 2009-02-28 Ian Lance Taylor <iant@google.com>
6711 * README: --gc-sections and map files are now supported. Document
6712 some build requirements.
6715 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
6716 relocatable link set the value of the section symbol to zero.
6717 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
6718 relocatable link don't include the section address in the local
6721 2009-02-27 Ian Lance Taylor <iant@google.com>
6724 * options.h (class Search_directory): Add is_system_directory.
6725 (class General_options): Declare is_in_system_directory.
6726 * options.cc (get_relative_sysroot): Make static.
6727 (get_default_sysroot): Make static.
6728 (General_optoins::is_in_system_directory): New function.
6729 * fileread.cc (Input_file::is_in_system_directory): New function.
6730 * fileread.h (class Input_file): Declare is_in_system_directory.
6731 * object.h (class Object): Add is_in_system_directory.
6732 (class Input_objects): Remove system_library_directory_ field.
6733 * object.cc (Input_objects::add_object): Don't set
6734 system_library_directory_.
6735 (input_objects::found_in_system_library_directory): Remove.
6736 * symtab.cc (Symbol_table::write_globals): Remove input_objects
6737 parameter. Change all callers.
6738 (Symbol_table::sized_write_globals): Likewise.
6739 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
6740 Call Object::is_in_system_directory.
6741 * symtab.h (class Symbol_table): Update declarations.
6744 * descriptors.h (Open_descriptor): Add is_on_stack field.
6745 * descriptors.cc (Descriptors::open): If the descriptor is on the
6746 top of the stack, remove it. Initialize is_on_stack field.
6747 (Descriptors::release): Only add pod to stack if it is not on the
6749 (Descriptors::close_some_descriptor): Clear stack_next and
6753 * output.cc (Output_section::find_starting_output_address): Rename
6754 from starting_output_address; add PADDR parameter; change return
6756 * output.h (class Output_section): Declare
6757 find_starting_output_address instead of starting_output_address.
6758 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
6759 section symbol for which we can't find a merge section.
6762 * symtab.cc (Symbol_table::add_from_object): If the visibility is
6763 hidden or internal, force the symbol to be local.
6764 * resolve.cc (Symbol::override_visibility): Define.
6765 (Symbol::override_base): Use override_visibility.
6766 (Symbol_table::resolve): Likewise.
6767 (Symbol::override_base_with_special): Likewise.
6768 (Symbol_table::override_with_special): If the visibility is hidden
6769 or internal, force the symbol to be local.
6770 * symtab.h (class Symbol): Add set_visibility and
6771 override_visibility.
6772 * testsuite/ver_test_1.sh: New file.
6773 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
6774 (check_DATA): Add ver_test_1.syms.
6775 (ver_test_1.syms): New target.
6776 * testsuite/Makefile.in: Rebuild.
6778 2009-02-25 Cary Coutant <ccoutant@google.com>
6780 * layout.cc (Layout::choose_output_section): Don't rename sections
6781 when using a linker script that has a SECTIONS clause.
6782 * Makefile.in: Regenerate.
6784 * testsuite/Makefile.am (script_test_5.sh): New test case.
6785 * testsuite/Makefile.in: Regenerate.
6786 * testsuite/script_test_5.cc: New file.
6787 * testsuite/script_test_5.sh: New file.
6788 * testsuite/script_test_5.t: New file.
6790 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
6792 * archive.cc (Archive::include_member): Update calls to add_symbols.
6793 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
6794 the Layout argument.
6795 * dynobj.h (do_add_symbols): Add the Layout argument.
6796 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
6798 * object.h (Object::add_symbols): Add the Layout argument.
6799 (Object::do_add_symbols): Add the Layout argument.
6800 (Sized_relobj::do_add_symbols): Add the Layout argument.
6801 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
6802 Unify the two versions.
6803 (Add_plugin_symbols): Remove.
6804 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
6805 (Sized_pluginobj::do_add_symbols): Unify the two versions.
6806 (Add_plugin_symbols): Remove.
6807 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
6808 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
6809 (Add_symbols::run): Make it work with Pulginobj.
6811 2009-02-06 Ian Lance Taylor <iant@google.com>
6813 * object.cc (Sized_relobj::do_layout): Make info message start
6814 with lower case letter.
6816 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
6818 * binary.cc: Fix file comment.
6820 * options.h (enum Incremental_disposition): Define.
6821 (class General_options): Add new options: --incremental,
6822 --incremental_changed, --incremental_unchanged,
6823 --incremental_unknown. Add incremental_disposition_ and
6824 implicit_incremental_ fields.
6825 (General_options::incremental_disposition): New function.
6826 (class Position_dependent_options): Add incremental_disposition
6828 (Position_dependent_options::copy_from_options): Set incremental
6830 * options.cc (General_options::parse_incremental_changed): New
6832 (General_options::parse_incremental_unchanged): New function.
6833 (General_options::parse_incremental_unknown): New function.
6834 (General_options::General_options): Initialize new fields
6835 incremental_disposition_ and implicit_incremental_.
6836 (General_options::finalize): Check for uasge of --incremental-*
6837 without --incremental.
6839 2009-02-06 Chris Demetriou <cgd@google.com>
6841 * gold.h (gold_undefined_symbol): Change to take only a Symbol
6842 pointer and to report location as the file name associated with
6844 (gold_undefined_symbol_at_location): New function to replace the
6845 old gold_undefined_symbol functionality.
6846 * target-reloc.h (relocate_section): Update to use
6847 gold_undefined_symbol_at_location.
6848 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
6849 Call gold_undefined_symbol function rather than gold_error.
6850 * errors.h (Errors::undefined_symbol): Take location as a
6851 string, rather than calculating it from a relocation.
6852 * errors.cc (Errors::fatal): Print "fatal error:" before the
6854 (Errors::error, Errors::error_at_location): Print "error: "
6855 before the formatted message.
6856 (Errors::undefined_symbol): Take location as a string, rather
6857 than calculating it from a relocation.
6858 (gold_undefined_symbol_at_location): New function akin to
6859 old gold_undefined_symbol, calculates location from relocation.
6860 (gold_undefined_symbol): Change to take only a Symbol pointer
6861 and to report location as the file name associated with the symbol.
6862 * testsuite/debug_msg.sh: Update for changed error messages.
6863 * testsuite/undef_symbol.sh: Likewise.
6865 2009-02-04 Duncan Sands <baldrick@free.fr>
6868 * reduced_debug_output.h
6869 (Output_reduced_debug_abbrev_section::failed): Use format for
6871 (Output_reduced_debug_info_section::faild): Likewise.
6873 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
6875 * script.cc (Lazy_demangler): New class.
6876 (Version_script_info::get_symbol_version_helper): Demangle a
6879 2009-01-29 Cary Coutant <ccoutant@google.com>
6881 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
6883 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
6885 2009-01-28 Ian Lance Taylor <iant@google.com>
6887 * version.cc (version_string): Bump to 1.9.
6889 * gold.h: Include <cstring> and <stdint.h>.
6890 * version.cc: Include <cstdio>.
6891 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
6893 * reduced_debug_output.cc (insert_into_vector): Rename from
6894 Insert_into_vector; change all callers. Use Swap_unaligned to
6895 avoid aliasing issue; remove union since it is unnecessary.
6897 2009-01-27 Sriraman Tallam <tmsriram@google.com>
6899 * Makefile.am (CCFILES): Add gc.cc.
6901 * Makefile.in: Regenerate.
6902 * gold.cc (Gc_runner): New class.
6903 (queue_initial_tasks): Call garbage collection related tasks
6904 when corresponding options are invoked.
6905 (queue_middle_gc_tasks): New function.
6906 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
6907 processed early before laying out sections during garbage collection.
6908 * gold.h (queue_middle_gc_tasks): New function.
6909 (is_prefix_of): Move from "layout.cc".
6910 * i386.cc (Target_i386::gc_process_relocs): New function.
6911 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
6912 * main.cc (main): Create object of class "Garbage_collection".
6913 * object.cc (Relobj::copy_symbols_data): New function.
6914 (Relobj::is_section_name_included): New function.
6915 (Sized_relobj::do_layout): Allow this function to be called twice
6916 during garbage collection and defer layout of section during the
6918 * object.h (Relobj::get_symbols_data): New function.
6919 (Relobj::is_section_name_included): New function.
6920 (Relobj::copy_symbols_data): New function.
6921 (Relobj::set_symbols_data): New function.
6922 (Relobj::get_relocs_data): New function.
6923 (Relobj::set_relocs_data): New function.
6924 (Relobj::is_output_section_offset_invalid): New pure virtual function.
6925 (Relobj::gc_process_relocs): New function.
6926 (Relobj::do_gc_process_relocs): New pure virtual function.
6927 (Relobj::sd_): New data member.
6928 (Sized_relobj::is_output_section_offset_invalid): New function.
6929 (Sized_relobj::do_gc_process_relocs): New function.
6930 * options.h (General_options::gc_sections): Modify to not be a no-op.
6931 (General_options::print_gc_sections): New option.
6932 * plugin.cc (Plugin_finish::run): Remove function call to
6933 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
6934 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
6935 * reloc.cc (Read_relocs::run): Add task to process relocs and
6936 determine unreferenced sections when doing garbage collection.
6937 (Gc_process_relocs): New class.
6938 (Sized_relobj::do_gc_process_relocs): New function.
6939 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
6940 sections that are garbage collected.
6941 * reloc.h (Gc_process_relocs): New class.
6942 * sparc.cc (Target_sparc::gc_process_relocs): New function.
6943 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
6944 symbols whose corresponding sections are garbage collected.
6945 (Symbol_table::Symbol_table): Add new parameter for the garbage
6947 (Symbol_table::gc_mark_undef_symbols): New function.
6948 (Symbol_table::gc_mark_symbol_for_shlib): New function.
6949 (Symbol_table::gc_mark_dyn_syms): New function.
6950 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
6952 (Symbol_table::add_from_object): Likewise.
6953 (Symbol_table::add_from_relobj): When building shared objects, do not
6954 treat externally visible symbols as garbage.
6955 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
6956 table information for static and relocatable links.
6957 * symtab.h (Symbol_table::set_gc): New function.
6958 (Symbol_table::gc): New function.
6959 (Symbol_table::gc_mark_undef_symbols): New function.
6960 (Symbol_table::gc_mark_symbol_for_shlib): New function.
6961 (Symbol_table::gc_mark_dyn_syms): New function.
6962 (Symbol_table::gc_): New data member.
6963 * target.h (Sized_target::gc_process_relocs): New pure virtual
6965 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
6966 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
6968 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
6970 * options.h (General_options::gc_sections): Define as a no-op for now.
6971 (General_options::no_keep_memory): Ditto.
6972 (General_options::Bshareable): Define.
6973 * options.cc (General_options::finalize): Honor -Bshareable.
6975 2009-01-20 Andreas Schwab <schwab@suse.de>
6977 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
6978 read the value in the contents, since we don't use it. Use the
6979 template endianness when writing.
6980 (Relocate::relocate): Use it for R_PPC_REL16_HA.
6982 2009-01-19 Andreas Schwab <schwab@suse.de>
6984 * configure.tgt (powerpc64-*): Fix targ_obj.
6986 2009-01-15 Ian Lance Taylor <iant@google.com>
6988 * object.cc (Sized_relobj::write_local_symbols): Don't write out
6989 local symbols when stripping all symbols.
6991 2009-01-14 Cary Coutant <ccoutant@google.com>
6993 * output.cc (Output_reloc): Add explicit instantiations.
6995 2009-01-14 Cary Coutant <ccoutant@google.com>
6997 * archive.cc (Archive::get_elf_object_for_member): Remove call
6998 to File_read::claim_for_plugin.
6999 * descriptors.cc (Descriptors::open): Remove reference to
7001 (Descriptors::claim_for_plugin): Remove.
7002 * descriptors.h (Descriptors::claim_for_plugin): Remove.
7003 (Descriptors::is_claimed): Remove.
7004 (claim_descriptor_for_plugin): Remove.
7005 * fileread.cc (File_read::claim_for_plugin): Remove.
7006 * fileread.h (File_read::claim_for_plugin): Remove.
7007 (File_read::descriptor): Reopen descriptor if necessary.
7008 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
7009 (Plugin_manager::all_symbols_read): Add task parameter. Change
7011 (Plugin_manager::get_input_file): New function.
7012 (Plugin_manager::release_input_file): New function.
7013 (Pluginobj::Pluginobj): Add filesize parameter and initialize
7014 corresponding data member.
7015 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
7016 and pass to base constructor. Change all callers.
7017 (get_input_file, release_input_file): New functions.
7018 (make_sized_plugin_object): Add filesize parameter. Change all callers.
7019 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
7020 (Plugin_manager::all_symbols_read): Add task parameter.
7021 (Plugin_manager::get_input_file): New function.
7022 (Plugin_manager::release_input_file): New function.
7023 (Plugin_manager::task_): New data member.
7024 (Pluginobj::Pluginobj): Add filesize parameter.
7025 (Pluginobj::filename): New function.
7026 (Pluginobj::descriptor): New function.
7027 (Pluginobj::filesize): New function.
7028 (Pluginobj::filesize_): New data member.
7029 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
7030 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
7031 File_read::claim_for_plugin; use Object::unlock to unlock the file.
7033 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
7034 with archive libraries.
7035 * testsuite/Makefile.in: Regenerate.
7036 * testsuite/plugin_test.c (struct sym_info): New type.
7037 (get_input_file, release_input_file): New static variables.
7038 (onload): Capture new transfer vector entries.
7039 (claim_file_hook): Stop reading at end of file according to filesize.
7040 Factor out parsing of readelf output into separate function.
7041 (all_symbols_read_hook): Exercise get_input_file and release_input_file
7042 APIs and get the source file name from the symbol table. Convert
7043 source file name to corresponding object file name. Print info
7044 message when adding new input files.
7045 (parse_readelf_line): New function.
7046 * testsuite/plugin_test_1.sh: Add checks for new info messages.
7047 * testsuite/plugin_test_2.sh: Likewise.
7048 * testsuite/plugin_test_3.sh: Likewise.
7049 * testsuite/plugin_test_4.sh: New test case.
7051 2009-01-07 Ian Lance Taylor <iant@google.com>
7053 * version.cc (version_string): Bump to 1.8.
7055 2008-12-23 Cary Coutant <ccoutant@google.com>
7057 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
7058 * plugin.cc (Plugin_manager::finish): Rename as
7059 layout_deferred_objects. Move cleanup to separate function.
7060 (Plugin_manager::cleanup): New function.
7061 (Plugin_finish::run): Call layout_deferred_objects and cleanup
7063 * plugin.h (Plugin_manager::finish): Rename as
7064 layout_deferred_objects.
7065 (Plugin_manager::cleanup): New function.
7066 (Plugin_manager::cleanup_done): New field.
7068 2008-12-23 Cary Coutant <ccoutant@google.com>
7070 * plugin.cc (is_visible_from_outside): New function.
7071 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
7072 so we don't return "IR only" status for exported symbols or -r links.
7074 * testsuite/Makefile.am (plugin_test_3): New test case.
7075 * testsuite/Makefile.in: Regenerate.
7076 * testsuite/plugin_test_3.sh: New file.
7078 2008-12-22 Cary Coutant <ccoutant@google.com>
7080 * object.cc (Sized_relobj::layout_section): New function.
7081 (Sized_relobj::do_layout): Defer layout of input sections until after
7082 plugin has provided replacement files.
7083 (Sized_relobj::do_layout_deferred_sections): New function.
7084 * object.h (Relobj::set_section_offset): Remove virtual keyword.
7085 (Relobj::layout_deferred_sections): New function.
7086 (Relobj::do_layout_deferred_sections): New function.
7087 (Sized_relobj::do_layout_deferred_sections): New function.
7088 (Sized_relobj::layout_section): New function.
7089 (Sized_relobj::Deferred_layout): New structure.
7090 (Sized_relobj::deferred_layout_): New field.
7091 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
7092 Change all callers. Layout deferred sections.
7093 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
7095 (Plugin_hook::run): Move code from do_plugin_hook inline.
7096 (Plugin_hook::do_plugin_hook): Remove.
7097 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
7098 (Plugin_manager::finish): Renamed, was cleanup.
7099 (Plugin_manager::should_defer_layout): New function.
7100 (Plugin_manager::add_deferred_layout_object): New function.
7101 (Plugin_manager::Deferred_layout_list): New type.
7102 (Plugin_manager::deferred_layout_objects_): New field.
7103 (Plugin_hook::do_plugin_hook): Remove.
7105 2008-12-17 Ian Lance Taylor <iant@google.com>
7107 * options.h (class General_options): Add --no case for
7110 2008-12-16 Cary Coutant <ccoutant@google.com>
7112 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
7114 (Plugin_manager::claim_file): Create plugin object even if
7115 plugin did not call the add_symbols callback.
7116 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
7117 asking for more symbols than were added.
7118 * testsuite/Makefile.am (plugin_test_1): Add test case with
7120 (empty.syms): New target.
7121 * testsuite/Makefile.in: Regenerate.
7122 * testsuite/plugin_test.c (claim_file_hook): Add new debug
7123 message. Don't call add_symbols if no globals.
7124 (all_symbols_read_hook): Don't provide replacement for empty
7127 2008-12-12 Ian Lance Taylor <iant@google.com>
7129 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
7130 r_type == 0 for a local symbol with r_sym == 0.
7131 (scan_relocatable_relocs): Pass r_sym to
7132 local_non_section_strategy.
7133 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
7136 * configure.ac: Update test for TLS descriptors: they are
7137 supported as of glibc 2.9.
7138 * configure: Rebuild.
7140 2008-12-11 Ian Lance Taylor <iant@google.com>
7143 * target-reloc.h (Default_scan_relocatable_relocs): For each
7144 function, map r_type == 0 to RELOC_DISCARD.
7146 2008-12-10 Cary Coutant <ccoutant@google.com>
7148 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
7149 object to override a kept COMDAT group from a plugin object.
7151 2008-12-09 Ian Lance Taylor <iant@google.com>
7154 * yyscript.y (file_cmd): Handle INPUT.
7156 * testsuite/initpri1.c: Change all declarations to be full
7157 prototypes by adding void, to avoid compiler warnings.
7159 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
7161 * options.cc (General_options::parse_plugin_opt): New.
7162 (General_options::add_plugin): The argument now is just the filename.
7163 (General_options::add_plugin_option): New.
7164 * options.h (plugin_opt): New.
7165 (add_plugin): Change argument name.
7166 (add_plugin_option): New.
7167 * plugin.cc (Plugin::load): Don't parse the plugin option.
7168 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
7169 (Plugin::add_option): New.
7170 (Plugin::args_): Change type.
7171 (Plugin::filename_): New.
7172 (Plugin_manager::add_plugin_option): New.
7173 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
7174 * testsuite/Makefile.in: Regenerate.
7176 2008-12-05 Cary Coutant <ccoutant@google.com>
7178 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
7179 Handle --strip-lto-sections option.
7180 * options.h (strip_lto_sections): New option.
7182 2008-12-01 Cary Coutant <ccoutant@google.com>
7184 * plugin.cc (ld_plugin_message): Change format parameter to const.
7185 Fix mismatch between new[] and delete.
7187 2008-11-14 Cary Coutant <ccoutant@google.com>
7189 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
7192 2008-11-05 Craig Silverstein <csilvers@google.com>
7194 * options.cc (General_options::parse_dynamic_list): New function.
7195 * options.h (General_options): New flags dynamic_list,
7196 dynamic_list_data, dynamic_list_cpp_new, and
7197 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
7198 (General_options::in_dynamic_list): New function.
7199 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
7200 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
7201 (Lex::can_continue_name): Likewise.
7203 (read_script_file): New parameter script_options.
7204 (read_dynamic_list): New function.
7205 (Script_options::define_dynamic_list): New function.
7206 (dynamic_list_keyword_parsecodes): New variable.
7207 (dynamic_list_keywords): New variable.
7208 * script.h (Script_options::define_dynamic_list): New function
7210 (read_dynamic_list): New function prototype.
7211 * symtab.cc (strprefix): New macro.
7212 (Symbol::should_add_dynsym_entry): Support dynamic_list,
7213 dynamic_list_data, dynamic_list_cpp_new, and
7214 dynamic_list_cpp_typeinfo.
7215 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
7216 (dynamic_list_expr): New rule.
7217 (dynamic_list_nodes): Likewise.
7218 (dynamic_list_node): Likewise.
7219 * testsuite/Makefile.am (dynamic_list): New test.
7220 * testsuite/Makefile.in: Regenerated.
7221 * testsuite/dynamic_list.t: New file.
7222 * testsuite/dynamic_list.sh: New file.
7224 2008-11-05 Craig Silverstein <csilvers@google.com>
7226 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
7227 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
7228 (t11_last): Likewise.
7229 * testsuite/ver_test_6.c (main): Likewise.
7231 2008-10-07 Cary Coutant <ccoutant@google.com>
7233 * options.c (General_options::finalize): Add check for -static and
7235 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
7238 2008-10-02 Cary Coutant <ccoutant@google.com>
7240 * plugin.cc (make_sized_plugin_object): Fix conditional
7241 compilation to work when not all targets are enabled.
7243 2008-09-29 Cary Coutant <ccoutant@google.com>
7245 * archive.cc (Archive::get_file_and_offset): Use filename instead
7246 of name to get library path.
7247 (Archive::include_member): Unlock external member of a thin archive.
7249 * testsuite/Makefile.am (TEST_AR): New variable.
7250 (thin_archive_test_1): New test.
7251 (thin_archive_test_2): New test.
7252 * testsuite/Makefile.in: Regenerate.
7253 * testsuite/thin_archive_main.cc: New file.
7254 * testsuite/thin_archive_test_1.cc: New file.
7255 * testsuite/thin_archive_test_2.cc: New file.
7256 * testsuite/thin_archive_test_3.cc: New file.
7257 * testsuite/thin_archive_test_4.cc: New file.
7259 2008-09-29 Cary Coutant <ccoutant@google.com>
7261 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
7262 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
7264 (Sized_relobj::do_finalize_local_symbols): Likewise.
7265 (Sized_relobj::map_to_kept_section): Likewise.
7266 * object.h (Sized_relobj::invalid_address): New constant.
7267 (Sized_relobj::do_output_section_offset): Check for invalid_address
7269 * output.cc (Output_reloc::local_section_offset): Use constant
7270 invalid_address instead of -1U.
7271 (Output_reloc::get_address): Likewise.
7272 (Output_section::output_address): Change -1U to -1ULL.
7273 * output.h (Output_reloc::invalid_address): New constant.
7274 * reloc.cc (Sized_relobj::write_sections): Use constant
7275 invalid_address instead of -1U.
7276 (Sized_relobj::relocate_sections): Likewise.
7277 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
7278 values for merge sections.
7279 * target-reloc.h (relocate_for_relocatable): Use constant
7280 invalid_address instead of -1U.
7282 2008-09-19 Cary Coutant <ccoutant@google.com>
7284 Add plugin functionality for link-time optimization (LTO).
7285 * configure.ac (plugins): Add --enable-plugins option.
7286 * configure: Regenerate.
7287 * config.in: Regenerate.
7288 * Makefile.am (LIBDL): New variable.
7289 (CCFILES): Add plugin.cc.
7290 (HFILES): Add plugin.h.
7291 (ldadd_var): Add LIBDL.
7292 * Makefile.in: Regenerate.
7294 * archive.cc: Include "plugin.h".
7295 (Archive::setup): Don't preread archive symbols when using a plugin.
7296 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
7297 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
7299 (Archive::include_member): Add symbols from plugin objects.
7300 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
7301 * descriptors.cc (Descriptors::open): Check for file descriptors
7302 abandoned by plugins.
7303 (Descriptors::claim_for_plugin): New function.
7304 * descriptors.h (Descriptors::claim_for_plugin): New function.
7305 (Open_descriptor::is_claimed): New field.
7306 (claim_descriptor_for_plugin): New function.
7307 * fileread.cc (File_read::claim_for_plugin): New function.
7308 * fileread.h (File_read::claim_for_plugin): New function.
7309 (File_read::descriptor): New function.
7310 * gold.cc: Include "plugin.h".
7311 (queue_initial_tasks): Add task to call plugin hooks for generating
7313 * main.cc: Include "plugin.h".
7314 (main): Load plugin libraries.
7315 * object.h (Pluginobj): Declare.
7316 (Object::pluginobj): New function.
7317 (Object::do_pluginobj): New function.
7318 (Object::set_target): New function.
7319 * options.cc: Include "plugin.h".
7320 (General_options::parse_plugin): New function.
7321 (General_options::General_options): Initialize plugins_ field.
7322 (General_options::add_plugin): New function.
7323 * options.h (Plugin_manager): Declare.
7324 (General_options): Add --plugin option.
7325 (General_options::has_plugins): New function.
7326 (General_options::plugins): New function.
7327 (General_options::add_plugin): New function.
7328 (General_options::plugins_): New field.
7329 * plugin.cc: New file.
7330 * plugin.h: New file.
7331 * readsyms.cc: Include "plugin.h".
7332 (Read_symbols::do_read_symbols): Check for archive before checking
7333 for ELF file. Call plugin hooks to claim files.
7334 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
7335 from a real object file; force override when processing replacement
7337 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
7338 (Symbol::init_base_object): Likewise.
7339 (Symbol::init_base_output_data): Likewise.
7340 (Symbol::init_base_output_segment): Likewise.
7341 (Symbol::init_base_constant): Likewise.
7342 (Symbol::init_base_undefined): Likewise.
7343 (Symbol::output_section): Assert that object is not a plugin.
7344 (Symbol_table::add_from_pluginobj): New function.
7345 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
7347 (Symbol_table::sized_write_globals): Likewise.
7348 (Symbol_table::add_from_pluginobj): Instantiate template.
7349 * symtab.h (Sized_pluginobj): Declare.
7350 (Symbol::in_real_elf): New function.
7351 (Symbol::set_in_real_elf): New function.
7352 (Symbol::in_real_elf_): New field.
7353 (Symbol_table::add_from_pluginobj): New function.
7355 * testsuite/Makefile.am (AM_CFLAGS): New variable.
7356 (LIBDL): New variable.
7358 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
7359 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
7360 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
7361 (MOSTLYCLEANFILES): Likewise.
7362 * testsuite/Makefile.in: Regenerate.
7363 * testsuite/plugin_test.c: New file.
7364 * testsuite/plugin_test_1.sh: New file.
7365 * testsuite/plugin_test_2.sh: New file.
7367 2008-09-16 Ian Lance Taylor <iant@google.com>
7369 * target-reloc.h (relocate_section): Check whether a symbol is
7370 defined by the ABI before reporting an undefined symbol error.
7371 * target.h (Target::is_defined_by_abi): Make parameter const.
7372 (Target::do_is_defined_by_abi): Likewise.
7373 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
7374 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
7375 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
7376 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
7377 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
7378 * testsuite/Makefile.in: Rebuild.
7380 * fileread.cc (make_view): Add casts to avoid warning.
7382 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
7384 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
7385 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
7387 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
7389 * options.h (General_options::output_is_executable): New.
7390 (General_options::output_is_pie): New.
7391 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
7392 for shared libraries.
7393 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
7395 2008-09-11 Chris Demetriou <cgd@google.com>
7397 * options.h (origin): New -z option.
7398 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
7399 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
7402 2008-09-05 Cary Coutant <ccoutant@google.com>
7404 * fileread.cc (File_read::make_view): Add check for attempt to map
7407 2008-09-05 Cary Coutant <ccoutant@google.com>
7409 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
7410 explicit instantiations.
7412 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
7415 * options.cc (General_options::finalize): Allow undefined symbols
7416 in shlibs if linking -shared.
7419 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
7420 symbols as not needing a dynsym entry.
7422 2008-08-20 Craig Silverstein <csilvers@google.com>
7424 * fileread.cc (File_read::open): Do not lock the file unless it
7425 was successfully opened.
7427 2008-08-14 Cary Coutant <ccoutant@google.com>
7429 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
7430 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
7431 * testsuite/tls_test.cc (struct int128): 128-bit struct
7432 for testing TLS relocs with non-zero addend.
7433 (v12): New TLS variable.
7435 (t_last): Add check for v12.
7436 * testsuite/tls_test.h (t12): New function.
7437 * testsuite/tls_test_main.cc (thread_routine): Call new test.
7439 2008-08-13 Ian Lance Taylor <iant@google.com>
7441 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
7442 set tls_segment_ or relro_segment_.
7443 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
7445 * output.h (Output_section::clear_is_relro): New function.
7446 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
7447 sections specially even when output_data_ is empty.
7448 (Output_segment::maximum_alignment): When first section is relro,
7449 only force alignment for PT_LOAD segments.
7450 * script.cc (script_data_segment_align): New function.
7451 (script_data_segment_relro_end): New function.
7452 * script-c.h (script_data_segment_align): Declare.
7453 (script_data_segment_relro_end): Declare.
7454 * script-sections.h (class Script_sections): Declare
7455 data_segment_align and data_segment_relro_end. Add fields
7456 segment_align_index_ and saw_relro_end_.
7457 * script-sections.cc (class Sections_element): Add set_is_relro
7458 virtual function. Add new bool* parameter to place_orphan_here.
7459 Add get_output_section virtual function.
7460 (class Output_section_definition): Add set_is_relro. Add new
7461 bool* parameter to place_orphan_here. Add get_output_section.
7462 Add is_relro_ field.
7463 (Output_section_definition::Output_section_definition): Initialize
7464 evaluated_address_, evaluated_load_address, evaluated_addralign_,
7465 and is_relro_ fields.
7466 (Output_section_definition::place_orphan_here): Add is_relro
7468 (Output_section_definition::set_section_addresses): Set relro for
7470 (Output_section_definition::alternate_constraint): Likewise.
7471 (class Orphan_output_section): Add new bool* parameter to
7472 place_orphan_here. Add get_output_section.
7473 (Orphan_output_section::place_orphan_here): Add is_relro
7475 (Script_sections::Script_sections): Initialize
7476 data_segment_align_index_ and saw_relro_end_.
7477 (Script_sections::data_segment_align): New function.
7478 (Script_sections::data_segment_relro_end): New function.
7479 (Script_sections::place_orphan): Set or clear is_relro.
7480 (Script_sections::set_section_addresses): Force alignment of first
7482 * yyscript.y (exp): Call script_data_segment_align and
7483 script_data_segment_relro_end.
7484 * testsuite/relro_script_test.t: New file.
7485 * testsuite/relro_test.cc (using_script): Declare.
7486 (t1, t2): Test using_script.
7487 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
7488 (relro_script_test_SOURCES): Define.
7489 (relro_script_test_DEPENDENCIES): Define.
7490 (relro_script_test_LDFLAGS): Define.
7491 (relro_script_test_LDADD): Define.
7492 (relro_script_test.so): New target.
7493 * testsuite/Makefile.in: Rebuild.
7495 2008-08-06 Cary Coutant <ccoutant@google.com>
7497 * archive.cc (Archive::total_archives, Archive::total_members)
7498 (Archive::total_members_loaded): New variables.
7499 (Archive::setup): Add parameter. Add option to preread
7501 (Archive::read_armap): Add counter.
7502 (Archive::get_file_and_offset): New function.
7503 (Archive::get_elf_object_for_member): New function.
7504 (Archive::read_all_symbols): New function.
7505 (Archive::read_symbols): New function.
7506 (Archive::add_symbols): Add counters.
7507 (Archive::include_all_members): Use armap to find members if it's
7509 (Archive::include_member): Skip reading symbols if already read.
7510 Factored code into Archive::get_file_and_offset and
7511 Archive::get_elf_object_for_member. Changed call to
7512 Mapfile::report_include_archive_member.
7513 (Archive::print_stats): New function.
7514 * archive.h: Declare Object and Read_symbols_data classes.
7515 (Archive::Archive): Add initializers for new members.
7516 (Archive::setup): Add parameter.
7517 (Archive::print_stats): New function.
7518 (Archive::total_archives, Archive::total_members)
7519 (Archive::total_members_loaded): New variables.
7520 (Archive::get_file_and_offset): New function.
7521 (Archive::get_elf_object_for_member): New function.
7522 (Archive::read_all_symbols): New function.
7523 (Archive::read_symbols): New function.
7524 (Archive::Archive_member): New class.
7525 (Archive::members_): New member.
7526 (Archive::num_members_): New member.
7527 * main.cc: Include archive.h.
7528 (main): Call Archive::print_stats.
7529 * mapfile.cc (Mapfile::report_include_archive_member): Delete
7530 archive parameter; member_name is now the fully-decorated name.
7531 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
7532 * options.h: (General_options): Add --preread-archive-symbols option.
7533 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
7536 2008-08-04 Ian Lance Taylor <iant@google.com>
7538 * symtab.h (Symbol::use_plt_offset): New function.
7539 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
7540 * powerpc.cc (Relocate::relocate): Likewise.
7541 * sparc.cc (Relocate::relocate): Likewise.
7542 * x86_64.cc (Relocate::relocate): Likewise.
7543 * testsuite/weak_plt.sh: New test.
7544 * testsuite/weak_plt_main.cc: New test.
7545 * testsuite/weak_plt_shared.cc: New test.
7546 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
7547 (check_PROGRAMS): Add weak_plt.
7548 (check_DATA): Add weak_plt_shared.so.
7549 (weak_plt_main_pic.o, weak_plt): New targets.
7550 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
7551 * testsuite/Makefile.in: Rebuild.
7553 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
7555 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
7556 * testsuite/Makefile.in: Rebuild.
7558 2008-08-04 Alan Modra <amodra@bigpond.net.au>
7560 * Makefile.am (POTFILES.in): Set LC_ALL=C.
7561 * Makefile.in: Regenerate.
7562 * po/POTFILES.in: Regenerate.
7564 2008-07-29 Ian Lance Taylor <iant@google.com>
7566 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
7567 symbols before other symbols.
7568 * testsuite/script_test_2.cc (test_addr): Declare.
7569 (test_addr_alias): Declare.
7570 (main): Check that test_addr and test_addr_alias have the right
7572 * testsuite/script_test_2.t: Define test_addr_alias and
7575 2008-07-24 Ian Lance Taylor <iant@google.com>
7578 * descriptors.cc: New file.
7579 * descriptors.h: New file.
7580 * gold-threads.h (class Hold_optional_lock): New class.
7581 * fileread.cc: Include "descriptors.h".
7582 (File_read::~File_read): Release descriptor rather than closing
7584 (File_read::open) [file]: Call open_descriptor rather than open.
7585 Set is_descriptor_opened_.
7586 (File_read::open) [memory]: Assert that descriptor is not open.
7587 (File_read::reopen_descriptor): New function.
7588 (File_read::release): Release descriptor.
7589 (File_read::do_read): Make non-const. Reopen descriptor.
7590 (File_read::read): Make non-const.
7591 (File_read::make_view): Reopen descriptor.
7592 (File_read::do_readv): Likewise.
7593 * fileread.h (class File_read): Add is_descriptor_opened_ field.
7594 Update declarations.
7595 * layout.cc: Include "descriptors.h".
7596 (Layout::create_build_id): Use open_descriptor rather than open.
7597 * output.cc: Include "descriptors.h".
7598 (Output_file::open): Use open_descriptor rather than open.
7599 * archive.cc (Archive::const_iterator): Change Archive to be
7601 (Archive::begin, Archive::end): Make non-const.
7602 (Archive::count_members): Likewise.
7603 * archive.h (class Archive): Update declarations.
7604 * object.h (Object::read): Make non-const.
7605 * Makefile.am (CCFILES): Add descriptors.cc.
7606 (HFILES): Add descriptors.h.
7607 * Makefile.in: Rebuild.
7610 * gold.h: Always include <clocale>. Add Solaris workarounds
7611 following code in binutils/sysdep.h.
7614 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
7615 this->eh_frame_hdr_ is NULL before using it.
7617 * dynobj.cc (Versions::Versions): Update comment.
7619 * dynobj.cc (Versions::Versions): If there is an soname, use it as
7620 the base version name.
7622 * stringpool.cc (Stringpool_template::add_with_length): Set key to
7623 array size plus one.
7624 (Stringpool_template::set_string_offsets): Subtract one from key
7625 before using it as an array index.
7626 (Stringpool_template::get_offset_with_length): Likewise.
7627 (Stringpool_template::write_to_buffer): Likewise.
7628 * stringpool.h (Stringpool_template::get_offset_from_key):
7631 2008-07-23 Ian Lance Taylor <iant@google.com>
7634 * object.h (Merged_symbol_value::value): Do our best to handle a
7638 * script.cc (Version_script_info::get_versions): Don't add empty
7639 version tag to return value.
7640 (Version_script_info::get_symbol_version_helper): Change return
7641 type to bool. Add pversion parameter. Change all callers.
7642 (script_register_vers_node): Don't require a non-NULL tag.
7643 * script.h (class Version_script_info): Update declarations.
7644 (Version_script_info::get_symbol_version): Change return type to
7645 bool. Add version parameter. Change all callers.
7646 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
7647 handling. Handle an empty version from a version script.
7648 (Symbol_table::define_special_symbol): Likewise.
7649 * testsuite/ver_test_10.script: New file.
7650 * testsuite/ver_test_10.sh: New file.
7651 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
7652 (check_DATA): Add ver_test_10.syms.
7653 (ver_test_10.syms, ver_test_10.so): New target.
7654 * testsuite/Makefile.in: Rebuild.
7656 2008-07-23 Simon Baldwin <simonb@google.com>
7658 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
7659 to zero for undefined symbols from dynamic libraries.
7661 2008-07-23 Ian Lance Taylor <iant@google.com>
7663 * symtab.cc (Symbol_table::resolve): Remove version parameter.
7665 * symtab.h (class Symbol_table): Update declaration.
7666 * testsuite/ver_test_9.cc: New file.
7667 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
7668 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
7669 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
7670 (ver_test_9.so, ver_test_9.o): New targets.
7671 * testsuite/Makefile.in: Rebuild.
7673 2008-07-22 Ian Lance Taylor <iant@google.com>
7675 * options.h (class General_options): Define --check-sections.
7676 * layout.cc (Layout::set_segment_offsets): Handle
7679 * options.h (class General_options): Define -n/--nmagic and
7681 * options.cc (General_options::finalize): For -n/--nmagic or
7682 -N/--omagic, set -static.
7683 * layout.cc (Layout::attach_allocated_section_to_segment): If
7684 -N/--omagic, don't put read-only and read-write sections in
7686 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
7687 finding a read-only segment.
7688 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
7689 don't set the minimum segment alignment to the common page size,
7690 and don't set the file offset to the address modulo the page size.
7691 * script-sections.cc (Script_sections::create_segments): If
7692 -n/--omagic, don't put read-only and read-write sections in
7695 * cref.cc: New file.
7697 * options.h (class General_options): Add --print-symbol-counts.
7698 * main.cc (main): Issue defined symbol report if requested.
7699 * archive.cc (Archive::interpret_header): Make into a const member
7701 (Archive::add_symbols): Call Input_objects::archive_start and
7703 (Archive::const_iterator): Define new class.
7704 (Archive::begin, Archive::end): New functions.
7705 (Archive::include_all_members): Rewrite to use iterator.
7706 (Archive::count_members): New function.
7707 * archive.h (class Archive): Update declarations.
7708 (Archive::filename): New function.
7709 * object.cc: Include "cref.h".
7710 (Sized_relobj::Sized_relobj): Initialize defined_count_.
7711 (Sized_relobj::do_get_global_symbol_counts): New function.
7712 (Input_objects::add_object): Add object to cross-referencer.
7713 (Input_objects::archive_start): New function.
7714 (Input_objects::archive_stop): New function.
7715 (Input_objects::print_symbol_counts): New function.
7716 * object.h: Declare Cref and Archive.
7717 (Object::get_global_symbol_counts): New function.
7718 (Object::do_get_global_symbol_counts): New pure virtual function.
7719 (class Sized_relobj): Add defined_count_ field. Update
7721 (class Input_objects): Add cref_ field. Update constructor.
7722 Update declarations.
7723 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
7725 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
7727 (Sized_dynobj::do_get_global_symbol_counts): New function.
7728 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
7729 defined_count_. Update declarations. Define Symbols typedef.
7730 * symtab.cc (Symbol_table::add_from_relobj): Add defined
7731 parameter. Change all callers.
7732 (Symbol_table::add_from_dynobj): Add sympointers and defined
7733 parameters. Change all callers.
7734 * symtab.h (class Symbol_table): Update declarations.
7735 * Makefile.am (CCFILES): Add cref.cc.
7736 (HFILES): Add cref.h.
7737 * Makefile.in: Rebuild.
7739 2008-07-22 Simon Baldwin <simonb@google.com>
7741 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
7742 to zero when writing undefined symbols.
7744 2008-07-22 Ian Lance Taylor <iant@google.com>
7746 * output.cc (Output_section::add_input_section): Don't try to
7747 merge empty merge sections.
7749 2008-07-21 Craig Silverstein <csilvers@google.com>
7751 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
7752 Include symbol version in error message.
7754 2008-07-20 Chris Demetriou <cgd@google.com>
7756 * configure.ac (gold_cv_c_random_seed): New configured variable.
7757 (RANDOM_SEED_CFLAGS): New substituted variable.
7758 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
7759 * configure: Rebuild.
7760 * Makefile.in: Likewise.
7761 * testsuite/Makefile.in: Likewise.
7763 2008-07-18 Ian Lance Taylor <iant@google.com>
7765 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
7766 where we see NAME/NULL and NAME/VERSION as separate symbols.
7767 * testsuite/ver_test_main.cc (main): Call t4.
7768 (t4, t4_2a): Define.
7769 * testsuite/ver_test_2.cc (t4_2): Define.
7770 * testsuite/ver_test_2.script: Put t4_2a in VER2.
7771 * testsuite/ver_test_4.cc (t4_2a): Define.
7772 * testsuite/ver_test_4.script: Put t4_2a in VER2.
7773 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
7775 2008-07-17 Ian Lance Taylor <iant@google.com>
7777 * dynobj.cc (Versions::add_def): If we give an error about a
7778 missing version, go ahead and create the version anyhow.
7780 2008-07-10 Ian Lance Taylor <iant@google.com>
7782 Handle output sections with more than 0x7fffffff bytes.
7783 * object.h (class Relobj): Change map_to_output_ to
7784 output_sections_, and just keep a section pointer. Change all
7785 uses. Move comdat group support to Sized_relobj.
7786 (Relobj::is_section_specially_mapped): Remove.
7787 (Relobj::output_section): Remove poff parameter. Change all
7789 (Relobj::output_section_offset): New function.
7790 (Relobj::set_section_offset): Rewrite.
7791 (Relobj::map_to_output): Remove.
7792 (Relobj::output_sections): New function.
7793 (Relobj::do_output_section_offset): New pure virtual function.
7794 (Relobj::do_set_section_offset): Likewise.
7795 (class Sized_relobj): Add section_offsets_ field. Add comdat
7796 group support from Relobj. Update declarations.
7797 (Sized_relobj::get_output_section_offset): New function.
7798 (Sized_relobj::do_output_section_offset): New function.
7799 (Sized_relobj::do_set_section_offset): New function.
7800 * object.cc (Relobj::output_section_address): Remove.
7801 (Sized_relobj::Sized_relobj): Initialize new fields.
7802 (Sized_relobj::include_section_group): Cast find_kept_object to
7804 (Sized_relobj::include_linkonce_section): Likewise.
7805 (Sized_relobj::do_layout): Use separate arrays for output section
7807 (Sized_relobj::do_count_local_symbols): Change map_to_output to
7809 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
7810 output_sections and section_offsets.
7811 (Sized_relobj::write_local_symbols): Likewise.
7812 (map_to_kept_section): Compute output address directly.
7813 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
7814 output_sections and section_offsets.
7815 (Sized_relobj::write_sections): Likewise.
7816 (Sized_relobj::relocate_sections): Likewise.
7817 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
7818 * output.h (class Output_reloc): Update declarations. Change
7819 u2_.relobj to Sized_relobj*.
7820 (class Output_data_reloc): Change add functions to use
7822 * output.cc (Output_reloc::Output_reloc): Change relobj to
7824 (Output_reloc::local_section_offset): Change return type to
7825 Elf_Addr. Use get_output_section_offset.
7826 (Output_reloc::get_address): Likewise.
7827 (Output_section::is_input_address_mapped): Don't call
7828 is_section_specially_mapped.
7829 (Output_section::output_offset): Likewise.
7830 (Output_section::output_address): Likewise.
7831 (Output_section::starting_output_address): Likewise.
7832 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
7833 parameter to Sized_relobj*.
7834 (Copy_relocs::need_copy_reloc): Likewise.
7835 (Copy_relocs::save): Likewise.
7836 * copy-relocs.h (class Copy_relocs): Update declarations.
7837 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
7838 Sized_relobj*. Change relobj_ field to Sized_relobj*.
7839 * target-reloc.h (relocate_for_relocatable): Change
7840 offset_in_output_section type to Elf_Addr. Change code that uses
7842 * layout.cc (Layout::layout): Always set *off.
7843 * mapfile.cc (Mapfile::print_input_section): Use
7844 output_section_offset.
7845 * i386.cc (Target_i386::copy_reloc): Change object parameter to
7847 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
7848 * sparc.cc (Target_sparc::copy_reloc): Likewise.
7849 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
7851 2008-07-03 Ian Lance Taylor <iant@google.com>
7853 * layout.cc (Layout::include_section): Do not discard unrecognized
7854 SHT_STRTAB sections.
7856 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
7858 * script.cc (Lex::can_continue_name): Make '?' allowable in
7859 version-script names.
7860 * testsuite/version_script.map: Change glob pattern to use '?'
7862 2008-06-30 Manish Singh <yosh@gimp.org>
7865 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
7868 2008-06-30 Ian Lance Taylor <iant@google.com>
7872 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
7873 versions]: Don't try to read the value in the contents, since we
7874 don't use it. Use the template endianness when writing.
7876 2008-06-25 Cary Coutant <ccoutant@google.com>
7878 * fileread.cc (File_read::make_view): Assert on zero-length view.
7879 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
7880 symbol table when there are no symbols to read.
7882 2008-06-23 Craig Silverstein <csilvers@google.com>
7884 * version.cc (version_string): Bump to 1.7
7886 2008-06-18 Craig Silverstein <csilvers@google.com>
7888 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
7889 constant 0xFFFF to type Valtype.
7890 (Powerpc_relocate_functions::rel16_ha): Likewise.
7892 2008-06-17 Ian Lance Taylor <iant@google.com>
7894 * output.h (Output_section::Input_section): Initialize p2align_ to
7895 zero for Output_section_data constructors.
7896 (Output_section::Input_section::addralign): If not an input
7897 section, return the alignment of the Output_section_data.
7898 * testsuite/copy_test.cc: New file.
7899 * testsuite/copy_test_1.cc: New file.
7900 * testsuite/copy_test_2.cc: New file.
7901 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
7902 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
7903 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
7904 (copy_test_1_pic.o, copy_test_1.so): New targets.
7905 (copy_test_2_pic.o, copy_test_2.so): New targets.
7906 * testsuite/Makefile.in: Rebuild.
7908 * script-sections.cc (Script_sections::place_orphan): Initialize
7909 local variable exact.
7911 2008-06-13 David Edelsohn <edelsohn@gnu.org>
7913 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
7915 2008-06-12 David Edelsohn <edelsohn@gnu.org>
7916 David S. Miller <davem@davemloft.net>
7918 * powerpc.cc: New file.
7919 * Makefile.am (TARGETSOURCES): Add powerpc.cc
7920 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
7921 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
7922 * Makefile.in: Rebuild.
7924 2008-06-09 Ian Lance Taylor <iant@google.com>
7926 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
7928 (throwing, orig_terminate): New static variables.
7929 (terminate_handler): New static function.
7930 (t2): Set terminate handler.
7932 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
7935 * binary.cc (Binary_to_elf::sized_convert): Fix .data
7938 2008-05-30 Cary Coutant <ccoutant@google.com>
7940 * archive.cc (Archive::include_all_members) Correct to step
7941 over symbol table and extended name table in thin archives.
7943 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
7946 * target-reloc.h (relocate_for_relocatable): Fix new_offset
7949 2008-05-28 Caleb Howe <cshowe@google.com>
7951 * reduced_debug_output.cc: New file.
7952 * reduced_debug_output.h: New file.
7953 * options.h (class General_options): Add --strip-debug-non-line.
7954 * options.cc (General_options::finalize): Add strip_debug_non_line
7955 to the strip heirarchy.
7956 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
7958 * layout.cc: Include "reduced_debug_output.h".
7959 (Layout::Layout): Initialize new fields.
7960 (line_only_debug_sections): New static array.
7961 (is_lines_only_debug_sections): New static inline function.
7962 (Layout::include_section): Handle --strip-debug-non-line.
7963 (Layout::make_output_section): If --strip-debug-non-line, build
7964 new output sections for .debug_abbrev and .debug_info.
7965 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
7966 gold. Warn about possible overflow.
7967 (read_signed_LEB_128): Likewise.
7968 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
7969 (read_signed_LEB_128): Declare.
7970 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
7971 (HFILES): Add reduced_debug_output.h.
7972 * Makefile.in: Rebuild.
7974 2008-05-21 Ian Lance Taylor <iant@google.com>
7976 * mapfile.cc: New file.
7977 * mapfile.h: New file.
7978 * options.h (class General_options): Add -M/--print-map and -Map.
7979 * options.cc (General_options::finalize): Make -M equivalent to
7981 * main.cc: Include <cstdio> and "mapfile.h".
7982 (main): Open mapfile if requested.
7983 * gold.cc (class Middle_runner): Add mapfile_ field. Update
7984 constructor. Change caller.
7985 (queue_initial_tasks): Add mapfile parameter. Change caller.
7986 (queue_middle_tasks): Likewise.
7987 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
7989 * archive.cc: Include "mapfile.h".
7990 (Archive::add_symbols): Add mapfile parameter. Change all
7991 callers. Pass mapfile, symbol, and reason to include_member.
7992 (Archive::include_all_members): Add mapfile parameter. Change all
7994 (Archive::include_member): Add mapfile, sym, and why parameters.
7995 Change all callers. Report inclusion to map file.
7996 * archive.h: Include "fileread.h".
7997 (class Archive): Update declarations.
7998 (Archive::file): New const method.
7999 (class Add_archive_symbols): Add mapfile_ field. Update
8000 constructor. Change all callers.
8001 * readsyms.h (class Read_symbols): Likewise.
8002 (class Finish_group): Likewise.
8003 (class Read_script): Likewise.
8004 * common.cc: Include "mapfile.h".
8005 (Symbol_table::allocate_commons): Add mapfile parameter. Change
8007 (Symbol_table::do_allocate_commons): Likewise.
8008 (Symbol_table::do_allocate_commons_list): Likewise. Report common
8009 symbol allocation to mapfile.
8010 * common.h (class Allocate_commons_task): Add mapfile_ field.
8011 Update constructor. Change all callers.
8012 * symtab.h (class Symbol_table): Update declarations.
8013 * layout.cc: Include "mapfile.h".
8014 (Layout_task_runner::run): Print information to mapfile.
8015 (Layout::create_gold_note): Change Output_data_fixed_space to
8016 Output_data_zero_fill.
8017 (Layout::create_build_id): Likewise.
8018 (Layout::print_to_mapfile): New function.
8019 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
8020 constructor. Change caller.
8021 (class Layout): Declare print_to_mapfile.
8022 * output.cc (Output_section::Input_section::print_to_mapfile): New
8024 (Output_section::add_input_section): If producing a map, always
8025 add to input_sections_ list.
8026 (Output_section::do_print_to_mapfile): New function.
8027 (Output_segment::print_sections_to_mapfile): New function.
8028 (Output_segment::print_section_list_to_mapfile): New function.
8029 * output.h: Include "mapfile.h".
8030 (Output_data::print_to_mapfile): New function.
8031 (Output_data::do_print_to_mapfile): New virtual function.
8032 (Output_segment_headers::do_print_to_mapfile): New function.
8033 (Output_file_header::do_print_to_mapfile): New function.
8034 (Output_data_const::do_print_to_mapfile): New function.
8035 (class Output_data_const_buffer): Add map_name_ field. Update
8036 constructor. Change all callers. Add do_print_to_mapfile
8038 (class Output_data_fixed_space): Likewise.
8039 (class Output_data_space): Likewise.
8040 (class Output_data_zero_fill): New class.
8041 (Output_data_strtab::do_print_to_mapfile): New function.
8042 (Output_data_reloc_base::do_print_to_mapfile): New function.
8043 (Output_relocatable_relocs::do_print_to_mapfile): New function.
8044 (Output_data_group::do_print_to_mapfile): New function.
8045 (Output_data_got::do_print_to_mapfile): New function.
8046 (Output_data_dynamic::do_print_to_mapfile): New function.
8047 (Output_symtab_xindex::do_print_to_mapfile): New function.
8048 (class Output_section): Declare do_print_to_mapflie. Declare
8049 print_to_mapfile in Input_section.
8050 (class Output_segment): Declare new functions.
8051 * object.h (Sized_relobj::symbol_count): New function.
8052 * script-sections.cc
8053 (Output_section_element_dot_assignment::set_section_addresses):
8054 Change Output_data_fixed_space to Output_data_zero_fill.
8055 (Output_data_expression::do_print_to_mapfile): New function.
8056 * script.cc (read_input_script): Add mapfile parameter. Change
8058 * script.h (read_input_script): Update declaration.
8059 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
8060 (Eh_frame::do_print_to_mapfile): New function.
8061 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
8062 (Output_merge_string::do_print_to_mapfile): New function.
8063 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
8065 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
8067 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
8069 * Makefile.am (CCFILES): Add mapfile.cc.
8070 (HFILES): Add mapfile.h.
8071 * Makefile.in: Rebuild.
8073 2008-05-19 Ian Lance Taylor <iant@google.com>
8075 * options.h (class General_options): Add -z relro.
8076 * layout.cc (Layout::Layout): Initialize relro_segment_.
8077 (Layout::add_output_section_data): Return the output section.
8078 (Layout::make_output_section): Rcognize relro sections and mark
8080 (Layout::attach_allocated_section_to_segment): Put relro sections
8081 in a PT_GNU_RELRO segment.
8082 (Layout::create_initial_dynamic_sections): Mark the .dynamic
8084 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
8086 (Layout::linkonce_mapping): Map d.rel.ro.local to
8088 (Layout::output_section_name): Us .data.rel.ro.local for any
8089 section which begins with that.
8090 * layout.h (class Layout): Update add_output_section_data
8091 declaration. Add relro_segment_ field.
8092 * output.cc (Output_section::Output_section): Initialize is_relro_
8093 and is_relro_local_ fields.
8094 (Output_segment::add_output_section): Group relro sections.
8095 (Output_segment::is_first_section_relro): New function.
8096 (Output_segment::maximum_alignment): If there is a relro section,
8097 align the segment to the common page size.
8098 (Output_segment::set_section_addresses): Track whether we are
8099 looking at relro sections. If the last section is a relro
8100 section, align to the common page size.
8101 (Output_segment::set_section_list_addresses): Add in_relro
8102 parameter. Change all callers. Align to the page size when
8103 moving from relro to non-relro section.
8104 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
8106 * output.h (class Output_section): Add is_relro_ and
8107 is_relro_local_ fields.
8108 (Output_section::is_relro): New function.
8109 (Output_section::set_is_relro): New function.
8110 (Output_section::is_relro_local): New function.
8111 (Output_section::set_is_relro_local): New function.
8112 (class Output_segment): Update declarations.
8113 * i386.cc (Target_i386::got_section): Mark .got section as relro.
8114 * sparc.cc (Target_sparc::got_section): Likewise.
8115 * x86_64.cc (Target_x86_64::got_section): Likewise.
8116 * testsuite/relro_test_main.cc: New file.
8117 * testsuite/relro_test.cc: New file.
8118 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
8119 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
8120 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
8121 (relro_test.so, relro_test_pic.o): New targets.
8122 * testsuite/Makefile.in: Rebuild.
8124 2008-05-16 Ian Lance Taylor <iant@google.com>
8126 * output.cc (Output_segment::add_output_section): Remove front
8128 * output.h (class Output_segment): Remove
8129 add_initial_output_section and overloaded add_output_section.
8130 Update declaration of remaining add_output_section.
8131 * layout.cc (Layout::create_interp): Call add_output_section
8132 rather than add_initial_output_section.
8133 (Layout::finish_dynamic_section): Likewise.
8135 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
8136 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
8137 know the dynamic type.
8138 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
8139 field. Initialize it in constructor.
8140 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
8141 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
8142 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
8145 * output.cc (Output_reloc::get_address): Change return type to
8147 * output.h (class Output_reloc): Update get_address declaration.
8148 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
8149 for section addresses.
8151 2008-05-09 Ian Lance Taylor <iant@google.com>
8154 * gold.cc (gold_nomem): Use return value of write.
8156 2008-05-08 Ian Lance Taylor <iant@google.com>
8158 * symtab.c (Symbol::init_base_output_data): Add version
8159 parameter. Change all callers.
8160 (Symbol::init_base_output_segment): Likewise.
8161 (Symbol::init_base_constant): Likewise.
8162 (Symbol::init_base_undefined): Likewise.
8163 (Sized_symbol::init_output_data): Likewise.
8164 (Sized_symbol::init_output_segment): Likewise.
8165 (Sized_symbol::init_constant): Likewise.
8166 (Sized_symbol::init_undefined): Likewise.
8167 (Symbol_table::do_define_in_output_data): If the new symbol has a
8168 version, mark it as the default.
8169 (Symbol_table::do_define_in_output_segment): Likewise.
8170 (Symbol_table::do_define_as_constant): Likewise.
8171 * symtab.h (class Symbol): Update declarations.
8172 (class Sized_symbol): Likewise.
8173 * resolve.cc (Symbol::override_version): New function.
8174 (Symbol::override_base): Call override_version.
8175 (Symbol::override_base_with_special): Likewise.
8176 * testsuite/ver_script_8.script: New file.
8177 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
8178 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
8179 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
8180 (ver_test_8_1.so, ver_test_8_2.so): New targets.
8182 2008-05-06 Ian Lance Taylor <iant@google.com>
8185 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
8187 (class General_options): Remove existing --undefined, and add
8188 --no-undefined instead. Add new --undefined as synonym for -u.
8189 * archive.cc (Archive::add_symbols): Check whether symbol was
8191 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
8192 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
8193 all uses. Add IS_UNDEFINED. Update declarations to split
8194 different versions of init_base. Declare init_base_undefined.
8195 (Symbol::is_defined): Handle IS_UNDEFINED.
8196 (Symbol::is_undefined): Likewise.
8197 (Symbol::is_weak_undefined): Call is_undefined.
8198 (Symbol::is_absolute): Handle IS_CONSTANT.
8199 (class Sized_symbol): Update declarations to split different
8200 versions of init. Declare init_undefined.
8201 (class Symbol_table): Declare new functions.
8202 * symtab.cc (Symbol::init_base_object): Rename from init_base.
8204 (Symbol::init_base_output_data): Likewise.
8205 (Symbol::init_base_output_segment): Likewise.
8206 (Symbol::init_base_constant): Likewise.
8207 (Symbol::init_base_undefined): New function.
8208 (Sized_symbol::init_object): Rename from init. Change all
8210 (Sized_symbol::init_output_data): Likewise.
8211 (Sized_symbol::init_output_segment): Likewise.
8212 (Sized_symbol::init_constant): Likewise.
8213 (Sized_symbol::init_undefined): New function.
8214 (Symbol_table::add_undefined_symbols_from_command_line): New
8216 (Symbol_table::do_add_undefined_symbols_from_command_line): New
8218 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
8219 (Symbol::output_section): Likewise.
8220 (Symbol::set_output_section): Likewise.
8221 (Symbol_table::sized_finalize_symbol): Likewise.
8222 (Symbol_table::sized_write_globals): Likewise.
8223 * resolve.cc (Symbol_table::should_override): Likewise.
8224 (Symbol::override_base_with_special): Likewise.
8226 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
8227 symbol, change it to have default visibility.
8228 * testsuite/protected_1.cc: New file.
8229 * testsuite/protected_2.cc: New file.
8230 * testsuite/protected_3.cc: New file.
8231 * testsuite/protected_main_1.cc: New file.
8232 * testsuite/protected_main_2.cc: New file.
8233 * testsuite/protected_main_3.cc: New file.
8234 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
8235 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
8236 (protected_1_LDFLAGS, protected_1_LDADD): Define.
8237 (protected_1.so): New target.
8238 (protected_1_pic.o, protected_2_pic.o): New targets.
8239 (protected_3_pic.o): New target.
8240 (check_PROGRAMS): Add protected_2.
8241 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
8242 (protected_2_LDFLAGS, protected_2_LDADD): Define.
8243 * testsuite/Makefile.in: Rebuild.
8245 * options.h (DEFINE_var): Add set_user_set_##varname__.
8246 (DEFINE_bool_alias): New macro.
8247 (class General_options): Define -Bstatic using DEFINE_bool_alias
8248 rather than DEFINE_special. Add --undefined as an alias for -z
8250 * options.cc (General_options::parse_Bstatic): Remove.
8252 * options.h (class General_options): Add --fatal-warnings.
8253 * main.cc (main): Implement --fatal-warnings.
8254 * errors.h (Errors::warning_count): New function.
8256 * options.h (class General_options): Add -Bsymbolic-functions.
8257 * symtab.h (Symbol::is_preemptible): Check for
8258 -Bsymbolic-functions.
8260 2008-05-05 Ian Lance Taylor <iant@google.com>
8262 * options.h (DEFINE_bool): For DASH_Z, create the negative option
8263 as noVARNAME rather than no-VARNAME.
8264 (class General_options): Add option -z combreloc.
8265 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
8267 (Output_reloc::sort_before) [SHT_REL]: New function.
8268 (Output_reloc::sort_before) [SHT_RELA]: New function.
8269 (class Output_data_reloc_base): Add sort_relocs_ field. Define
8270 Sort_relocs_comparison.
8271 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
8272 parameter. Change all callers.
8273 (Output_data_reloc::Output_data_reloc) [both versions]: Add
8274 sort_relocs parameter. Change all callers.
8275 * output.cc (Output_reloc::get_address): New function, broken out
8277 (Output_reloc::write_rel): Call it.
8278 (Output_reloc::compare): New function.
8279 (Output_data_reloc_base::do_write): Optionally sort relocs.
8281 * configure.ac: If targ_extra_obj is set, link it in.
8282 * configure.tgt: Initialize all variables.
8283 (x86_64*): Set targ_extra_obj and targ_extra_size.
8284 * configure: Rebuild.
8286 * object.cc (Sized_relobj::include_section_group): Adjust section
8287 indexes read from group data. Build vector to pass to
8289 * layout.cc (Layout::layout_group): Add flags and shndxes
8290 parameters. Remove contents parameter. Change caller. Update
8291 explicit instantiations.
8292 * layout.h (class Layout): Update layout_group declaration.
8293 * output.cc (Output_data_group::Output_data_group): Add flags and
8294 input_shndxes parameters. Remove contents parameter. Change
8296 (Output_data_group::do_write): Change input_sections_ to
8298 * output.h (class Output_data_group): Update constructor
8299 declaration. Rename input_sections_ to input_shndxes_.
8300 * testsuite/many_sections_test.cc: Add template.
8302 2008-04-30 Cary Coutant <ccoutant@google.com>
8304 * target-reloc.h (relocate_section): Fix dead-pointer bug.
8306 * layout.cc (Layout::include_section): Refactored check for debug
8308 (Layout::add_comdat): Add new parameters. Change type
8309 of signature parameter. Add object and shndx to signatures table.
8310 (Layout::find_kept_object): New function.
8311 * layout.h: Include <cstring>.
8312 (Layout::is_debug_info_section): New function.
8313 (Layout::add_comdat): Add new parameters.
8314 (Layout::find_kept_object): New function.
8315 (Layout::Kept_section): New struct.
8316 (Layout::Signatures): Change type of map range.
8317 * object.cc (Relobj::output_section_address): New function.
8318 (Sized_relobj::include_section_group): Add new parameters. Change
8319 calls to Layout::add_comdat. Change to build table of kept comdat
8320 groups and table mapping discarded sections to kept sections.
8321 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
8322 (Sized_relobj::do_layout): Change calls to include_section_group and
8323 include_linkonce_section.
8324 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
8325 value to zero when section is discarded.
8326 (Sized_relobj::map_to_kept_section): New function.
8327 * object.h (Relobj::output_section_address): New function.
8328 (Relobj::Comdat_group): New type.
8329 (Relobj::find_comdat_group): New function.
8330 (Relobj::Comdat_group_table): New type.
8331 (Relobj::Kept_comdat_section): New type.
8332 (Relobj::Kept_comdat_section_table): New type.
8333 (Relobj::add_comdat_group): New function.
8334 (Relobj::set_kept_comdat_section): New function.
8335 (Relobj::get_kept_comdat_section): New function.
8336 (Relobj::comdat_groups_): New field.
8337 (Relobj::kept_comdat_sections_): New field.
8338 (Symbol_value::input_value): Update comment.
8339 (Sized_relobj::map_to_kept_section) New function.
8340 (Sized_relobj::include_linkonce_section): Add new parameter.
8341 * target-reloc.h (Comdat_behavior): New type.
8342 (get_comdat_behavior): New function.
8343 (relocate_section): Add code to map a discarded section to the
8344 corresponding kept section when applying a relocation.
8346 2008-04-30 Craig Silverstein <csilvers@google.com>
8348 * dwarf_reader.cc (next_generation_count): New static var.
8349 (Addr2line_cache_entry): New struct.
8350 (addr2line_cache): New static var.
8351 (Dwarf_line_info::one_addr2line): Added caching.
8352 (Dwarf_line_info::clear_addr2line_cache): New function.
8353 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
8354 cache-size parameter.
8355 (Dwarf_line_info::one_addr2line_cache): New function.
8356 * symtab.cc (Symbol_table::detect_odr_violations): Pass
8357 new cache-size argument to one_addr2line(), and clear cache.
8359 2008-04-28 Cary Coutant <ccoutant@google.com>
8361 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
8362 R_386_PC8 relocations.
8364 2008-04-23 Ian Lance Taylor <iant@google.com>
8366 * object.cc (Sized_relobj::include_section_group): Check for
8367 invalid section group.
8369 * object.cc (make_elf_object): Correct test for 64-bit ELF file
8372 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
8373 than read for file header.
8374 * archive.cc (Archive::include_member): Likewise.
8376 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
8378 * aclocal.m4: Regenerate.
8379 * configure: Regenerate.
8381 2008-04-19 Ian Lance Taylor <iant@google.com>
8383 * version.cc (version_string): Bump to 1.6.
8385 * testsuite/Makefile.am (many_sections_r_test): New target.
8386 (many_sections_r_test_SOURCES): Remove.
8387 (many_sections_r_test_DEPENDENCIES): Remove.
8388 (many_sections_r_test_LDFLAGS): Remove.
8389 (many_sections_r_test_LDADD): Remove.
8391 * object.cc (Sized_relobj::do_add_symbols): Always pass
8392 local_symbol_count_ to add_from_relobj.
8394 * testsuite/Makefile.am (many_sections_check.h): Only check one in
8395 every thousand variables.
8396 * testsuite/Makefile.in: Rebuild.
8398 * object.cc (Xindex::initialize_symtab_xindex): New function.
8399 (Xindex::read_symtab_xindex): New function.
8400 (Xindex::sym_xindex_to_shndx): New function.
8401 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
8403 (Sized_relobj::do_initialize_xindex): New function.
8404 (Sized_relobj::do_read_symbols): Adjust section links.
8405 (Sized_relobj::symbol_section_and_value): Add is_ordinary
8406 parameter. Change all callers.
8407 (Sized_relobj::include_section_group): Adjust section links and
8408 symbol section indexes.
8409 (Sized_relobj::do_layout): Adjust section links.
8410 (Sized_relobj::do_count_local_symbols): Adjust section links and
8411 symbol section indexes.
8412 (Sized_relobj::do_finalize_local_symbols): Distinguish between
8413 ordinary and special symbols.
8414 (Sized_relobj::write_local_symbols): Add symtab_xindex and
8415 dynsym_xindex parameters. Change all callers. Adjust section
8416 links. Use SHN_XINDEX when needed.
8417 (Sized_relobj::get_symbol_location_info): Adjust section links.
8418 Don't get fooled by special symbols.
8419 * object.h (class Xindex): Define.
8420 (class Object): Add xindex_ parameter. Declare virtual functoin
8421 do_initialize_xindex.
8422 (Object::adjust_sym_shndx): New function.
8423 (Object::set_xindex): New protected function.
8424 (class Symbol_value): Add is_ordinary_shndx_ field.
8425 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
8426 (Symbol_value::value): Assert ordinary section.
8427 (Symbol_value::initialize_input_to_output_map): Likewise.
8428 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
8430 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
8432 (class Sized_relobj): Update declarations.
8433 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
8434 parameter. Change all callers.
8435 (Sized_relobj::adjust_shndx): New function.
8436 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
8438 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
8439 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
8440 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
8441 (Sized_dynobj::read_dynsym_section): Adjust section links.
8442 (Sized_dynobj::read_dynamic): Likewise.
8443 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
8445 (Sized_dynobj::do_initialize_xindex): New function.
8446 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
8447 do_initialize_xindex.
8448 (Sized_dynobj::adjust_shndx): New function.
8449 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
8450 dynsym_xindex_ fields.
8451 (Layout::finalize): Add a call to set_section_indexes before
8452 creating the symtab sections.
8453 (Layout::set_section_indexes): Don't do anything if the section
8454 already has a section index.
8455 (Layout::create_symtab_sections): Add shnum parameter. Change
8456 caller. Create .symtab_shndx section if needed.
8457 (Layout::create_shdrs): Add shstrtab_section parameter. Change
8459 (Layout::allocated_output_section_count): New function.
8460 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
8462 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
8463 fields. Update declarations.
8464 (Layout::symtab_xindex): New function.
8465 (Layout::dynsym_xindex): New function.
8466 (class Write_symbols_task): Add layout_ field.
8467 (Write_symbols_task::Write_symbols_task): Add layout parameter.
8469 * output.cc (Output_section_headers::Output_section_headers): Add
8470 shstrtab_section parameter. Change all callers.
8471 (Output_section_headers::do_sized_write): Store overflow values
8472 for section count and section string table section index in
8473 section header zero.
8474 (Output_file_header::do_sized_write): Check for overflow of
8475 section count and section string table section index.
8476 (Output_symtab_xindex::do_write): New function.
8477 (Output_symtab_xindex::endian_do_write): New function.
8478 * output.h (class Output_section_headers): Add shstrtab_section_.
8479 Update declarations.
8480 (class Output_symtab_xindex): Define.
8481 (Output_section::has_out_shndx): New function.
8482 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
8484 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
8486 (Sized_symbol::init): Likewise.
8487 (Symbol::output_section): Check for ordinary symbol.
8488 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
8489 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
8491 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
8492 Change all callers. Simplify handling of symbols from sections
8493 not included in the link.
8494 (Symbol_table::add_from_dynobj): Handle ordinary symbol
8496 (Weak_alias_sorter::operator()): Assert that symbols are
8498 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
8500 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
8501 parameters. Change all callers.
8502 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
8503 symbol distinction. Use SHN_XINDEX when needed.
8504 (Symbol_table::write_section_symbol): Add symtab_xindex
8505 parameter. Change all callers.
8506 (Symbol_table::sized_write_section_symbol): Likewise. Use
8507 SHN_XINDEX when needed.
8508 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
8510 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
8511 (Symbol::is_defined): Check is_ordinary.
8512 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
8513 (Symbol::is_absolute, Symbol::is_common): Likewise.
8514 (class Sized_symbol): Update declarations.
8515 (class Symbol_table): Update declarations.
8516 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
8517 parameters. Change all callers.
8518 (Sized_symbol::override): Likewise.
8519 (Symbol_table::override): Likewise.
8520 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
8521 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
8522 is_ordinary, and orig_st_shndx parameters. Change all callers.
8523 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
8524 to be in an ordinary section.
8525 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
8526 object and is_ordinary parameters. Change all callers.
8527 (Sized_dwarf_line_info::read_relocs): Add object parameter.
8528 Change all callers. Don't add undefined or non-ordinary symbols
8530 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
8532 * dwarf_reader.h (class Sized_dwarf_line_info): Update
8534 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
8535 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
8536 (Sized_relobj::relocate_sections): Likewise.
8537 * target-reloc.h (scan_relocs): Adjust section symbol index.
8538 (scan_relocatable_relocs): Likewise.
8539 * i386.cc (Scan::local): Check for ordinary symbols.
8540 * sparc.cc (Scan::local): Likewise.
8541 * x86_64.cc (Scan::local): Likewise.
8542 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
8543 to symbol_section_and_value.
8544 * testsuite/many_sections_test.cc: New file.
8545 * testsuite/Makefile.am (BUILT_SOURCES): Define.
8546 (check_PROGRAMS): Add many_sections_test.
8547 (many_sections_test_SOURCES): Define.
8548 (many_sections_test_DEPENDENCIES): Define.
8549 (many_sections_test_LDFLAGS): Define.
8550 (BUILT_SOURCES): Add many_sections_define.h.
8551 (many_sections_define.h): New target.
8552 (BUILT_SOURCES): Add many_sections_check.h.
8553 (many_sections_check.h): New target.
8554 (check_PROGRAMS): Add many_sections_r_test.
8555 (many_sections_r_test_SOURCES): Define.
8556 (many_sections_r_test_DEPENDENCIES): Define.
8557 (many_sections_r_test_LDFLAGS): Define.
8558 (many_sections_r_test_LDADD): Define.
8559 (many_sections_r_test.o): New target.
8560 * testsuite/Makefile.in: Rebuild.
8562 2008-04-17 Cary Coutant <ccoutant@google.com>
8564 * errors.cc (Errors::info): New function.
8565 (gold_info): New function.
8566 * errors.h (Errors::info): New function.
8567 * gold.h (gold_info): New function.
8568 * object.cc (Input_objects::add_object): Print trace output.
8569 * options.cc (options::parse_set): New function.
8570 (General_options::parse_wrap): Deleted.
8571 (General_options::General_options): Deleted initializer.
8572 * options.h (options::String_set): New typedef.
8573 (options::parse_set): New function.
8574 (DEFINE_set): New macro.
8575 (General_options::wrap): Changed to use DEFINE_set. Changed
8576 callers of any_wrap_symbols and is_wrap_symbol.
8577 (General_options::trace, General_options::trace_symbol):
8579 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
8580 (General_options::wrap_symbols_): Deleted.
8581 * symtab.cc (Symbol_table::add_from_object): Print trace output.
8583 2008-04-17 David S. Miller <davem@davemloft.net>
8585 * options.cc (General_options::parse_V): New function.
8586 * options.h: Add entries for -V and -Qy.
8588 2008-04-17 Ian Lance Taylor <iant@google.com>
8590 * common.cc (Symbol_table::allocate_commons): Remove options
8591 parameter. Change caller.
8592 (Symbol_table::do_allocate_commons): Remove options parameter.
8593 Change caller. Just call do_allocate_commons_list twice.
8594 (Symbol_table::do_allocate_commons_list): New function, broken out
8595 of do_allocate_commons.
8596 * common.h (class Allocate_commons_task): Remove options_ field.
8598 * symtab.cc (Symbol_table::Symbol_table): Initialize
8600 (Symbol_table::add_from_object): Put TLS common symbols on
8602 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
8603 which are IN_OUTPUT_DATA.
8604 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
8605 allocate_commons and do_allocate_commons declarations. Declare
8606 do_allocate_commons_list.
8607 * gold.cc (queue_middle_tasks): Update creation of
8608 Allocate_commons_task to not pass options.
8609 * testsuite/Makefile.am (INCLUDES): Add -I.. .
8610 (TLS_TEST_C_FLAGS): New variable.
8611 (tls_test_c_pic.o): New target.
8612 (tls_test_shared.so): Link in tls_test_c_pic.o.
8613 (tls_test_c_pic_ie.o): New target.
8614 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
8615 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
8616 (tls_test_c.o): New target.
8617 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
8618 (tls_pic_test_LDADD): Likewise.
8619 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
8620 (tls_shared_gd_to_ie_test_LDADD): Likewise.
8621 (tls_test_c_gnu2.o): New target.
8622 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
8624 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
8625 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
8626 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
8627 * testsuite/tls_test.cc: Include "config.h".
8628 (t_last): Call t11_last.
8629 * testsuite/tls_test.h (t11, t11_last): Declare.
8630 * testsuite/tls_test_c.c: New file.
8631 * testsuite/tls_test_main.cc (thread_routine): Call t11.
8632 * configure.ac: Check for OpenMP support.
8633 * configure, config.in, Makefile.in: Rebuild.
8634 * testsuite/Makefile.in: Rebuild.
8636 2008-04-16 Cary Coutant <ccoutant@google.com>
8638 * i386.cc (Target_i386::define_tls_base_symbol): New function.
8639 (Target_i386::tls_base_symbol_defined_): New field.
8640 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
8641 (Target_i386::Scan::global): Likewise.
8642 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
8643 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
8644 (Target_x86_64::tls_base_symbol_defined_): New field.
8645 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
8646 (Target_x86_64::Scan::global): Likewise.
8648 2008-04-16 Cary Coutant <ccoutant@google.com>
8650 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
8651 (Symbol::needs_plt_entry): Allow weak undefined symbols.
8652 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
8653 building shared libraries.
8654 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
8655 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
8656 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
8657 * testsuite/Makefile.in: Rebuild.
8658 * testsuite/weak_undef.h: New file.
8659 * testsuite/weak_undef_file1.cc: Add extra test cases.
8660 * testsuite/weak_undef_file2.cc: Likewise.
8661 * testsuite/weak_undef_test.cc: Likewise.
8663 2008-04-16 David S. Miller <davem@davemloft.net>
8665 * sparc.cc (Target_sparc::Scan): Change from struct to class.
8666 Add issued_non_pic_error_ field. Declare check_non_pic.
8667 (Target_sparc::Scan::check_non_pic): New function.
8668 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
8669 (Target_sparc::Scan::global): Likewise.
8671 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
8672 * configure: Rebuild.
8674 * options.h (DEFINE_enable): New macro.
8675 (new_dtags): New enable option.
8676 (initfirst, interpose, loadfltr, nodefaultlib,
8677 nodelete, nodlopen, nodump): New -z options.
8678 * layout.cc (Layout:finish_dynamic_section): If new
8679 dtags enabled, emit DT_RUNPATH. Also, emit a
8680 DT_FLAGS_1 containing any specified -z flags.
8682 2008-04-16 Ian Lance Taylor <iant@google.com>
8684 * copy-relocs.cc: New file.
8685 * copy-relocs.h: New file.
8686 * reloc.cc: Remove Copy_relocs code.
8687 * reloc.h: Likewise.
8688 * reloc-types.h (struct Reloc_types) [both versions]: Add
8689 get_reloc_addend_noerror.
8690 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
8691 variants of add_global which take an addend which must be zero.
8692 * i386.cc: Include "copy-relocs.h".
8693 (class Target_i386): Change type of copy_relocs_ to variable,
8695 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
8697 (Target_i386::do_finalize_sections): Change handling of
8699 * sparc.cc: Include "copy-relocs.h".
8700 (class Target_sparc): Change type of copy_relocs_ to variable,
8702 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
8704 (Target_sparc::do_finalize_sections): Change handling of
8706 * x86_64.cc: Include "copy-relocs.h".
8707 (class Target_x86_64): Change type of copy_relocs_ to variable,
8709 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
8710 class. Change all callers.
8711 (Target_x86_64::do_finalize_sections): Change handling of
8713 * Makefile.am (CCFILES): Add copy-relocs.cc.
8714 (HFILES): Add copy-relocs.h.
8716 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
8718 * testsuite/script_test_4.sh: Permit leading zeroes.
8720 2008-04-15 Ian Lance Taylor <iant@google.com>
8722 * script-sections.cc (Script_sections::create_segments): Use
8723 header_size_adjustment even when there is enough room for the
8725 * testsuite/script_test_4.sh: New file.
8726 * testsuite/script_test_4.t: New file.
8727 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
8728 (check_DATA): Add script_test_4.stdout.
8729 (MOSTLYCLEANFILES): Likewise.
8730 (script_test_4): New target.
8731 (script_test_4.stdout): New target.
8732 * testsuite/Makefile.in: Rebuild.
8734 * sparc.cc: Add definitions for Output_data_plt_sparc class
8737 2008-04-14 David S. Miller <davem@davemloft.net>
8739 * sparc.cc: New file.
8740 * Makefile.am (TARGETSOURCES): Add sparc.cc
8741 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
8742 * configure.tgt: Document targ_extra_size and
8743 targ_extra_big_endian. Add entries for sparc-* and
8745 * configure.ac: Handle targ_extra_size and
8746 targ_extra_big_endian.
8747 * Makefile.in: Rebuild.
8748 * configure: Likewise.
8749 * po/POTFILES.in: Likewise.
8750 * po/gold.pot: Likewise.
8752 2008-04-14 Ian Lance Taylor <iant@google.com>
8754 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
8755 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
8756 in the name/type/flags to section mapping. Don't call
8757 allocate_output_section.
8758 (Layout::choose_output_section): Change parameter from adjust_name
8759 to is_input_section. Don't permit input sections after sections
8760 are attached to segments. Don't call allocate_output_section.
8761 (Layout::layout_eh_frame): Call update_flags_for_input_section,
8762 not write_enable_output_section.
8763 (Layout::make_output_section): Don't push to
8764 unattached_section_list_ nor call attach_to_segment. Call
8765 attach_section_to_segment if sections are attached.
8766 (Layout::attach_sections_to_segments): New function.
8767 (Layout::attach_section_to_segment): New function.
8768 (Layout::attach_allocated_section_to_segment): Rename from
8769 attach_to_segment. Remove flags parameter.
8770 (Layout::allocate_output_section): Remove function.
8771 (Layout::write_enable_output_section): Remove function.
8772 * layout.h (class Layout): Update for above changes. Add new
8773 field sections_are_attached_.
8774 * output.h (Output_section::update_flags_for_input_section): New
8776 * output.cc (Output_section::add_input_section): Call
8777 update_flags_for_input_section.
8778 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
8780 2008-04-11 Cary Coutant <ccoutant@google.com>
8782 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
8783 thought unnecessary.
8784 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
8786 2008-04-11 Ian Lance Taylor <iant@google.com>
8788 * output.h (class Output_section_data): Remove inline definition
8790 * output.cc (Output_section_data::set_addralign): New function.
8792 2008-04-11 Cary Coutant <ccoutant@google.com>
8794 Add support for TLS descriptors for i386 and x86_64.
8795 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
8796 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
8797 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
8799 (Target_i386::got_mod_index_entry): Remove unnecessary code.
8800 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
8801 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
8803 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
8804 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
8805 Fix problem with initial-exec relocations.
8806 (Target_i386::Relocate::relocate_tls): Likewise.
8807 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
8809 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
8810 support for section-plus-offset dynamic table entries.
8811 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
8812 (Output_data_dynamic::Dynamic_entry): Add support for
8813 section-plus-offset dynamic table entries.
8814 (Output_data_dynamic::Classification): Likewise.
8815 (Output_data_dynamic::classification_): Renamed offset_.
8816 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
8817 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
8818 (Target_x86_64::make_plt_section): New function.
8819 (Target_x86_64::reserve_tlsdesc_entries): New function.
8820 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
8821 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
8822 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
8823 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
8824 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
8825 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
8826 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
8827 add extra PLT entry for TLS descriptors.
8828 (Output_data_plt_x86_64::got_): New field.
8829 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
8830 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
8832 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
8834 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
8835 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
8836 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
8837 R_386_TLS_DESC_CALL relocations.
8838 (Target_x86_64::Scan::global): Likewise.
8839 (Target_x86_64::do_finalize_sections): Add dynamic table entries
8840 for TLS descriptors.
8841 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
8842 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
8843 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
8844 GD-to-IE relaxation.
8845 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
8846 and TLS_DESCRIPTORS.
8847 * Makefile.in: Rebuild.
8848 * configure: Rebuild.
8849 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
8850 (tls_test_shared2.so): New target.
8851 (tls_shared_gd_to_ie_test_SOURCES): New variable.
8852 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
8853 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
8854 (tls_shared_gd_to_ie_test_LDADD): New variable.
8855 (tls_shared_gnu2_gd_to_ie_test): New target.
8856 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
8858 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
8859 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
8860 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
8861 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
8862 (tls_shared_gnu2_test): New target.
8863 (tls_test_gnu2_shared.so): New target.
8864 (tls_shared_gnu2_test_SOURCES): New variable.
8865 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
8866 (tls_shared_gnu2_test_LDFLAGS): New variable.
8867 (tls_shared_gnu2_test_LDADD): New variable.
8868 * testsuite/Makefile.in: Rebuild.
8869 * testsuite/Makefile.
8871 2008-04-11 Ian Lance Taylor <iant@google.com>
8873 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
8875 * testsuite/Makefile.in: Rebuild.
8877 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
8879 * testsuite/script_test_2.cc (main): Adjust test.
8881 2008-04-11 David S. Miller <davem@davemloft.net>
8882 Ian Lance Taylor <iant@google.com>
8884 * options.h (General_options): Add entries for '-Y' and
8886 * options.cc (General_options:finalize): If -Y was used, add those
8887 entries to the library path instead of the default "/lib" and
8890 2008-04-11 David S. Miller <davem@davemloft.net>
8892 * testsuite/justsyms.t: Start at 0x100.
8893 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
8894 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
8896 * testsuite/script_test_2.cc: Adjust string and section length
8899 2008-04-09 Ian Lance Taylor <iant@google.com>
8902 * script-sections.cc (Sections_element::allocate_to_segment): Add
8904 (Output_section_definition::allocate_to_segment): Likewise.
8905 (Orphan_output_section::allocate_to_segment): Likewise.
8906 (Script_sections::attach_sections_using_phdrs_clause): Don't
8907 propagate non-PT_LOAD segments to orphan sections.
8908 * testsuite/Makefile.am (script_test_3.stdout): Generate using
8909 readelf rather than objdump.
8910 * testsuite/script_test_3.sh: Adjust accordingly. Test that
8911 .interp section and PT_INTERP segment are the same size.
8912 * testsuite/Makefile.in: Rebuild.
8914 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
8915 aliases for symbols defined in the same object.
8916 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
8917 (weak_alias_test_SOURCES): New variable.
8918 (weak_alias_test_DEPENDENCIES): New variable.
8919 (weak_alias_test_LDFLAGS): New variable.
8920 (weak_alias_test_LDADD): New variable.
8921 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
8922 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
8923 (weak_alias_test_3.o): New target.
8924 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
8925 * testsuite/weak_alias_test_main.cc: New file.
8926 * testsuite/weak_alias_test_1.cc: New file.
8927 * testsuite/weak_alias_test_2.cc: New file.
8928 * testsuite/weak_alias_test_3.cc: New file.
8930 2008-04-08 Ian Lance Taylor <iant@google.com>
8932 * options.h (class General_options): Add --noinhibit-exec option.
8933 * main.cc (main): Check --noinhibit-exec.
8935 * options.h (class General_options): Define --wrap as a special
8936 option. Add wrap_symbols_ field.
8937 (General_options::any_wrap_symbols): New function.
8938 (General_options::is_wrap_symbol): New function.
8939 * options.cc (General_options::parse_wrap): New function.
8940 (General_options::General_options): Initialize wrap_symbols_.
8941 * symtab.cc (Symbol_table::wrap_symbol): New function.
8942 (Symbol_table::add_from_object): Handle --wrap.
8943 * symtab.h (class Symbol_table): Declare wrap_symbol.
8944 * target.h (Target::wrap_char): New function.
8945 (Target::Target_info): Add wrap_char field.
8946 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
8947 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
8948 * testsuite/testfile.cc (Target_test::test_target_info):
8951 * errors.cc (Errors::undefined_symbol): Mention symbol version if
8954 * layout.h (class Layout): Add added_eh_frame_data_ field.
8955 * layout.cc (Layout::Layout): Initialize new field.
8956 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
8957 output section until we find a section we merged successfully.
8958 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
8959 that the size be non-zero.
8961 * merge.cc (Object_merge_map::get_output_offset): Remove inline
8964 2008-04-08 Craig Silverstein <csilvers@google.com>
8966 * configure.ac: Export new conditional variable HAVE_ZLIB.
8967 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
8969 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
8970 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
8972 2008-04-07 Ian Lance Taylor <iant@google.com>
8974 * version.cc (version_string): Set to "1.5".
8976 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
8977 Add issued_non_pic_error_ field. Declare check_non_pic.
8978 (Target_x86_64::Scan::check_non_pic): New function.
8979 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
8980 (Target_x86_64::Scan::global): Likewise.
8982 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
8983 addend parameter. Change caller. Handle merge sections.
8984 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
8985 Address to Addend. Don't add in the result of
8986 local_section_offset, pass down the addend and use the returned
8988 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
8989 Update declarations of local_section_offset and symbol_value.
8990 * testsuite/two_file_test_1.cc (t18): New function.
8991 * testsuite/two_file_test_2.cc (f18): New function.
8992 * testsuite/two_file_test_main.cc (main): Call t18.
8993 * testsuite/two_file_test.h (t18, f18): Declare.
8995 * configure.ac: Don't test for objdump, c++filt, or readelf.
8996 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
8998 (TEST_READELF): New variable.
8999 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
9000 (check_PROGRAMS): Add two_file_strip_test.
9001 (two_file_strip_test): New target.
9002 (check_PROGRAMS): Add two_file_same_shared_strip_test.
9003 (two_file_same_shared_strip_test_SOURCES): New variable.
9004 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
9005 (two_file_same_shared_strip_test_LDFLAGS): New variable.
9006 (two_file_same_shared_strip_test_LDADD): New variable.
9007 (two_file_shared_strip.so): New target.
9008 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
9009 (ver_test_5.syms, ver_test_7.syms): Likewise.
9010 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
9011 (strip_test_3.stdout): Use TEST_OBJDUMP.
9012 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
9014 2008-04-04 Cary Coutant <ccoutant@google.com>
9016 * symtab.h (Symbol::is_weak_undefined): New function.
9017 (Symbol::is_strong_undefined): New function.
9018 (Symbol::is_absolute): New function.
9019 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
9020 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
9022 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
9023 (weak_undef_test): New target.
9024 * testsuite/Makefile.in: Rebuild.
9025 * testsuite/weak_undef_file1.cc: New file.
9026 * testsuite/weak_undef_file2.cc: New file.
9027 * testsuite/weak_undef_test.cc: New file.
9029 2008-04-03 Craig Silverstein <csilvers@google.com>
9031 * compressed_output.h (class Output_compressed_section): Use
9033 * compressed_output.cc (zlib_compress): Use unsigned buffers,
9035 (zlib_compressed_suffix): Removed.
9036 (Output_compressed_section::set_final_data_size): Use unsigned
9038 * testsuite/Makefile.am (flagstest_compress_debug_sections):
9039 Fix linker invocation.
9040 (flagstest_o_specialfile_and_compress_debug_sections):
9042 * testsuite/Makefile.in: Regenerated.
9044 2008-04-02 David S. Miller <davem@davemloft.net>
9046 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
9047 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
9049 2008-04-02 Craig Silverstein <csilvers@google.com>
9053 2008-04-02 Ian Lance Taylor <iant@google.com>
9055 * fileread.cc (File_read::find_view): Add byteshift and vshifted
9056 parameters. Update for new key type to views_. Change all
9058 (File_read::read): Adjust for byteshift in returned view.
9059 (File_read::add_view): New function, broken out of
9061 (File_read::make_view): New function, broken out of
9063 (File_read::find_or_make_view): Add offset and aligned
9064 parameters. Rewrite accordingly. Change all callers.
9065 (File_read::get_view): Add offset and aligned parameters. Adjust
9066 for byteshift in return value.
9067 (File_read::get_lasting_view): Likewise.
9068 * fileread.h (class File_read): Update declarations.
9069 (class File_read::View): Add byteshift_ field. Add byteshift to
9070 constructor. Add byteshift method.
9071 * archive.h (Archive::clear_uncached_views): New function.
9072 (Archive::get_view): Add aligned parameter. Change all callers.
9073 * object.h (Object::get_view): Add aligned parameter. Change all
9075 (Object::get_lasting_view): Likewise.
9077 * fileread.cc (File_read::release): Don't call clear_views if
9078 there are multiple objects.
9079 * fileread.h (File_read::clear_uncached_views): New function.
9080 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
9083 2008-03-31 Cary Coutant <ccoutant@google.com>
9085 Add thin archive support.
9086 * archive.cc (Archive::armagt): New const.
9087 (Archive::setup): Remove task parameter and calls to unlock.
9088 (Archive::unlock_nested_archives): New function.
9089 (Archive::read_header): Add nested_off parameter. Change
9091 (Archive::interpret_header): Likewise.
9092 (Archive::include_all_members): Change to handle thin
9094 (Archive::include_member): Likewise.
9095 * archive.h (Archive::Archive): Add new parameters and
9097 (Archive::armagt): New const.
9098 (Archive::setup): Remove task parameter.
9099 (Archive::unlock_nested_archives): New function.
9100 (Archive::read_header): Add nested_off parameter.
9101 (Archive::interpret_header): Likewise.
9102 (Archive::Nested_archive_table): New typedef.
9103 (Archive::is_thin_archive_): New field.
9104 (Archive::nested_archives_): New field.
9105 (Archive::options_): New field.
9106 (Archive::dirpath_): New field.
9107 (Archive::task_): New field.
9108 * readsyms.cc (Read_symbols::do_read_symbols): Add check
9109 for thin archives. Pass additional parameters to
9110 Archive::Archive. Unlock the archive file after calling
9113 2008-03-29 Ian Lance Taylor <iant@google.com>
9115 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
9116 version symbol to be local.
9117 * testsuite/ver_test_4.sh: New file.
9118 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
9119 (check_DATA): Add ver_test_4.syms.
9120 (ver_test_4.syms): New target.
9121 * testsuite/Makefile.in: Rebuild.
9124 (Output_section::Input_section_sort_entry::has_priority): New
9126 (Output_section::Input_section_sort_entry::match_file_name): New
9128 (Output_section::Input_section_sort_entry::match_section_name):
9130 (Output_section::Input_section_sort_entry::match_section_name_prefix):
9132 (Output_section::Input_section_sort_entry::match_section_file):
9134 (Output_section::Input_section_sort_compare::operator()): Rewrite
9135 using new Input_section_sort_entry functions. Sort crtbegin and
9136 crtend first. Sort sections with no priority before sections with
9138 * testsuite/initpri1.c (d3): Check j != 4.
9139 (cd5): New constructor/destructor function.
9140 (main): Check j != 2.
9142 * symtab.cc (Symbol_table::add_from_object): If we don't use the
9143 new symbol when resolving, don't call set_is_default.
9144 * testsuite/ver_test_7.cc: New file.
9145 * testsuite/ver_test_7.sh: New file.
9146 * testsuite/Makefile.am (ver_test_7.so): New target.
9147 (ver_test_7.o): New target.
9148 (check_SCRIPTS): Add ver_test_7.sh.
9149 (check_DATA): Add ver_test_7.syms.
9150 (ver_test_7.syms): New target.
9152 2008-03-28 Ian Lance Taylor <iant@google.com>
9154 * layout.cc (Layout::layout): If we see an input section with a
9155 name that needs sorting, set the must_sort flag for the output
9157 (Layout::make_output_section): If the name of the output section
9158 indicates that it might require sorting, set the may_sort flag.
9159 * output.h (Output_section::may_sort_attached_input_sections): New
9161 (Output_section::set_may_sort_attached_input_sections): New
9163 (Output_section::must_sort_attached_input_sections): New
9165 (Output_section::set_must_sort_attached_input_sections): New
9167 (class Output_section): Declare Input_section_sort_entry. Define
9168 Input_section_sort_compare. Declare
9169 sort_attached_input_sections. Add new fields:
9170 may_sort_attached_input_sections_,
9171 must_sort_attached_input_sections_,
9172 attached_input_sections_are_sorted_.
9173 * output.cc (Output_section::Output_section): Initialize new
9175 (Output_section::add_input_section): Add an entry to
9176 input_sections_ if may_sort or must_sort are true.
9177 (Output_section::set_final_data_size): Call
9178 sort_attached_input_sections if necessary.
9179 (Output_section::Input_section_sort_entry): Define new class.
9180 (Output_section::Input_section_sort_compare::operator()): New
9182 (Output_section::sort_attached_input_sections): New function.
9183 * configure.ac: Check whether the compiler supports constructor
9184 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
9185 * testsuite/initpri1.c: New file.
9186 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
9187 CONSTRUCTOR_PRIORITY.
9188 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
9189 (initpri1_LDFLAGS): New variable.
9190 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
9192 2008-03-27 Ian Lance Taylor <iant@google.com>
9194 * common.cc (Sort_commons::operator): Correct sorting algorithm.
9195 * testsuite/common_test_1.c: New file.
9196 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
9197 (common_test_1_SOURCES): New variable.
9198 (common_test_1_DEPENDENCIES): New variable.
9199 (common_test_1_LDFLAGS): New variable.
9201 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
9202 and commons_ correctly when NAME/VERSION does not override
9204 * testsuite/ver_test_6.c: New file.
9205 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
9206 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
9207 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
9209 2008-03-26 Ian Lance Taylor <iant@google.com>
9211 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
9212 of an undefined symbol from a version script.
9213 * testsuite/Makefile.am (ver_test_5.so): New target.
9214 (ver_test_5.o): New target.
9215 (check_SCRIPTS): Add ver_test_5.sh.
9216 (check_DATA): Add ver_test_5.syms.
9217 (ver_test_5.syms): New target.
9218 * testsuite/ver_test_5.cc: New file.
9219 * testsuite/ver_test_5.script: New file.
9220 * testsuite/ver_test_5.sh: New file.
9221 * Makefile.in, testsuite/Makefile.in: Rebuild.
9224 Fix problems building gold with gcc 4.3.0.
9225 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
9226 (gold_error_at_location, gold_warning_at_location): Use it.
9227 * configure.ac: Check whether we can compile and use a template
9228 function with a printf attribute.
9229 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
9230 when jumping over bytes.
9231 * object.cc: Instantiate Object::read_section_data.
9232 * debug.h: Include <cstring>
9233 * dwarf_reader.cc: Include <algorithm>
9234 * main.cc: Include <cstring>.
9235 * options.cc: Include <cstring>.
9236 * output.cc: Include <cstring>.
9237 * script.cc: Include <cstring>.
9238 * script.h: Include <string>.
9239 * symtab.cc: Include <cstring> and <algorithm>.
9240 * target-select.cc: Include <cstring>.
9241 * version.cc: Include <string>.
9242 * testsuite/testmain.cc: Include <cstdlib>.
9243 * configure, config.in: Rebuild.
9245 2008-03-25 Ian Lance Taylor <iant@google.com>
9247 * options.cc: Include "../bfd/bfdver.h".
9248 (options::help): Print bug reporting address.
9250 * version.cc (print_version): Adjust output for current value of
9255 * options.cc (options::help): Print list of supported targets.
9256 * target-select.h: Include <vector>.
9257 (class Target_selector): Make machine_, size_, and is_big_endian_
9258 fields const. Add bfd_name_ and instantiated_target_ fields.
9259 (Target_selector::Target_selector): Add bfd_name parameter.
9260 (Target_selector::recognize): Make non-virtual, call
9262 (Target_selector::recognize_by_name): Make non-virtual, call
9263 do_recognize_by_name.
9264 (Target_selector::supported_names): New function.
9265 (Target_selector::bfd_name): New function.
9266 (Target_selector::do_instantiate_target): New pure virtual
9268 (Target_selector::do_recognize): New virtual function.
9269 (Target_selector::do_recognize_by_name): New virtual function.
9270 (Target_selector::instantiate_target): New private function.
9271 (supported_target_names): Declare.
9272 * target-select.cc (Target_selector::Target_selector): Update for
9273 new parameter and fields.
9274 (select_target_by_name): Check that the name matches before
9275 calling recognize_by_name.
9276 (supported_target_names): New function.
9277 * i386.cc (class Target_selector_i386): Update Target_selector
9278 constructor call. Remove recognize and recognize_by_name. Add
9279 do_instantiate_target.
9280 * x86_64.cc (class Target_selector_x86_64): Likewise.
9281 * testsuite/testfile.cc (class Target_selector_test): Update for
9282 changes to Target_selector.
9284 * README: Rewrite, with some notes on unsupported features.
9286 2008-03-24 Cary Coutant <ccoutant@google.com>
9288 * i386.cc (Target_i386::Got_type): New enum declaration.
9289 (Target_i386::Scan::local): Updated callers of Output_data_got
9291 (Target_i386::Scan::global): Likewise.
9292 (Target_i386::Relocate::relocate): Likewise.
9293 (Target_i386::Relocate::relocate_tls): Likewise.
9294 * object.h (Got_offset_list): New class.
9295 (Sized_relobj::local_has_got_offset): Added got_type parameter.
9296 (Sized_relobj::local_got_offset): Likewise.
9297 (Sized_relobj::set_local_got_offset): Likewise.
9298 (Sized_relobj::local_has_tls_got_offset): Removed.
9299 (Sized_relobj::local_tls_got_offset): Removed.
9300 (Sized_relobj::set_local_tls_got_offset): Removed.
9301 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
9302 * output.cc (Output_data_got::add_global): Added got_type parameter.
9303 (Output_data_got::add_global_with_rel): Likewise.
9304 (Output_data_got::add_global_with_rela): Likewise.
9305 (Output_data_got::add_global_pair_with_rel): New function.
9306 (Output_data_got::add_global_pair_with_rela): New function.
9307 (Output_data_got::add_local): Added got_type parameter.
9308 (Output_data_got::add_local_with_rel): Likewise.
9309 (Output_data_got::add_local_with_rela): Likewise.
9310 (Output_data_got::add_local_pair_with_rel): New function.
9311 (Output_data_got::add_local_pair_with_rela): New function.
9312 (Output_data_got::add_global_tls): Removed.
9313 (Output_data_got::add_global_tls_with_rel): Removed.
9314 (Output_data_got::add_global_tls_with_rela): Removed.
9315 (Output_data_got::add_local_tls): Removed.
9316 (Output_data_got::add_local_tls_with_rel): Removed.
9317 (Output_data_got::add_local_tls_with_rela): Removed.
9318 * output.h (Output_data_got::add_global): Added got_type parameter.
9319 (Output_data_got::add_global_with_rel): Likewise.
9320 (Output_data_got::add_global_with_rela): Likewise.
9321 (Output_data_got::add_global_pair_with_rel): New function.
9322 (Output_data_got::add_global_pair_with_rela): New function.
9323 (Output_data_got::add_local): Added got_type parameter.
9324 (Output_data_got::add_local_with_rel): Likewise.
9325 (Output_data_got::add_local_with_rela): Likewise.
9326 (Output_data_got::add_local_pair_with_rel): New function.
9327 (Output_data_got::add_local_pair_with_rela): New function.
9328 (Output_data_got::add_global_tls): Removed.
9329 (Output_data_got::add_global_tls_with_rel): Removed.
9330 (Output_data_got::add_global_tls_with_rela): Removed.
9331 (Output_data_got::add_local_tls): Removed.
9332 (Output_data_got::add_local_tls_with_rel): Removed.
9333 (Output_data_got::add_local_tls_with_rela): Removed.
9334 * resolve.cc (Symbol::override_base_with_special): Removed
9335 reference to has_got_offset_ field.
9336 * symtab.cc (Symbol::init_fields): Replaced initialization
9337 of got_offset_ with got_offsets_. Removed initialization
9339 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
9340 (Symbol::got_offset): Likewise.
9341 (Symbol::set_got_offset): Likewise.
9342 (Symbol::has_tls_got_offset): Removed.
9343 (Symbol::tls_got_offset): Removed.
9344 (Symbol::set_tls_got_offset): Removed.
9345 (Symbol::got_offset_): Removed.
9346 (Symbol::tls_mod_got_offset_): Removed.
9347 (Symbol::tls_pair_got_offset_): Removed.
9348 (Symbol::got_offsets_): New field.
9349 (Symbol::has_got_offset): Removed.
9350 (Symbol::has_tls_mod_got_offset): Removed.
9351 (Symbol::has_tls_pair_got_offset): Removed.
9352 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
9353 (Target_x86_64::Scan::local): Updated callers of Output_data_got
9355 (Target_x86_64::Scan::global): Likewise.
9356 (Target_x86_64::Relocate::relocate): Likewise.
9357 (Target_x86_64::Relocate::relocate_tls): Likewise.
9359 2008-03-25 Ben Elliston <bje@au.ibm.com>
9361 * yyscript.y: Fix spelling error in comment.
9363 2008-03-24 Ian Lance Taylor <iant@google.com>
9365 * options.h (class General_options): Define build_id option.
9366 * layout.h (class Layout): Declare write_build_id, create_note,
9367 create_build_id. Add build_id_note_ member.
9368 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
9369 "libiberty.h", "md5.h", "sha1.h".
9370 (Layout::Layout): Initialize eh_frame_data_,
9371 eh_frame_hdr_section_, and build_id_note_.
9372 (Layout::finalize): Call create_build_id.
9373 (Layout::create_note): New function, broken out of
9374 Layout::create_gold_note.
9375 (Layout::create_gold_note): Call create_note.
9376 (Layout::create_build_id): New function.
9377 (Layout::write_build_id): New function.
9378 (Close_task_runner::run): Call write_build_id.
9380 * x86_64.cc: Correct license to GPLv3.
9382 2008-03-23 Ian Lance Taylor <iant@google.com>
9384 * options.cc: Include "demangle.h".
9385 (parse_optional_string): New function.
9386 (parse_long_option): Handle takes_optional_argument.
9387 (parse_short_option): Update dash_z initializer. Handle
9388 takes_optional_argument.
9389 (General_options::General_options): Initialize do_demangle_.
9390 (General_options::finalize): Set do_demangle_. Handle demangling
9392 * options.h (parse_optional_string): Declare.
9393 (struct One_option): Add optional_arg field. Update constructor.
9394 Update call constructor calls. Add takes_optional_argument
9396 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
9397 (DEFINE_optional_string): Define.
9398 (General_options::demangle): Change from DEFINE_bool to
9399 DEFINE_optional_string.
9400 (General_options::no_demangle): New function.
9401 (General_options::do_demangle): New function.
9402 (General_options::set_do_demangle): New function.
9403 (General_options::execstack_status_): Move definition to end of
9405 (General_options::static_): Likewise.
9406 (General_options::do_demangle_): New field.
9407 * object.cc (big_endian>::get_symbol_location_info): Call
9408 Options::do_demangle, not Options::demangle.
9409 * symtab.cc (demangle): Likewise.
9411 2008-03-22 Ian Lance Taylor <iant@google.com>
9413 * gold.h: Include <cstddef> and <sys/types.h>
9414 * options.h: Include <cstring>.
9416 2008-03-21 Ian Lance Taylor <iant@google.com>
9418 * Added source code to GNU binutils.