1 2011-11-11 Sterling Augustine <saugustine@google.com>
3 * yyscript.y (section_cmd): Add support for INCLUDE directive.
4 (file_or_sections_cmd): Likewise.
6 2011-11-11 Doug Kwan <dougkwan@google.com>
8 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
9 if --just-symbols is given.
11 2011-11-10 Doug Kwan <dougkwan@google.com>
14 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
15 when processing data relocs.
16 * reloc.h (Relocate_functions::rel_unaligned): New method.
17 (Relocate_functions::pcrel_unaligned): Ditto.
18 (Relocate_functions::rel32_unaligned): Ditto.
19 (Relocate_functions::pcrel32_unaligned): Ditto.
21 2011-11-09 Doug Kwan <dougkwan@google.com>
24 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
25 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
26 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
27 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
28 (Relocate_functions::rel_unaligned): New.
29 (Relocate_functions::rel32_unaligned): New.
30 * target-reloc.h (relocate_for_relocatable): Add code to handle
31 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
32 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
33 arm_unaligned_reloc_r): New targets.
34 * testsuite/Makefile.in: Regenerate.
35 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
38 2011-11-02 Ian Lance Taylor <iant@google.com>
40 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
42 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
43 * options.cc (General_options::finalize): Use library search path
44 from configure script if specified. If not native and no sysroot,
45 only search TOOLLIBDIR.
46 * options.h (Search_directory::Search_directory): Change name to
48 (General_options::add_to_library_path_with_sysroot): Change arg to
50 * configure, Makefile.in, config.in: Rebuild.
52 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
54 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
55 we are working around the ARM1176 Erratum.
56 * options.h (General_options::fix_arm1176): Add option.
57 * testsuite/Makefile.am: Add testcases, and keep current ones
59 * testsuite/Makefile.in: Regenerate.
60 * testsuite/arm_fix_1176.s: New file.
61 * testsuite/arm_fix_1176.sh: Likewise.
63 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
65 * arm.cc (Target_arm::Target_arm): Remove initialisation of
67 (Target_arm::may_use_blx): Remove method.
68 (Target_arm::set_may_use_blx): Likewise.
69 (Target_arm::may_use_v4t_interworking): New method.
70 (Target_arm::may_use_v5t_interworking): Likewise.
71 (Target_arm::may_use_blx_): Remove member variable.
72 (Arm_relocate_functions::arm_branch_common): Check for v5T
74 (Arm_relocate_functions::thumb_branch_common): Likewise.
75 (Reloc_stub::stub_type_for_reloc): Likewise.
76 (Target_arm::do_finalize_sections): Correct interworking checks.
77 * testsuite/Makefile.am: Add new tests.
78 * testsuite/Makefile.in: Regenerate.
79 * testsuite/arm_farcall_arm_arm.s: New test.
80 * testsuite/arm_farcall_arm_arm.sh: Likewise.
81 * testsuite/arm_farcall_arm_thumb.s: Likewise.
82 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
83 * testsuite/arm_farcall_thumb_arm.s: Likewise.
84 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
85 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
86 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
88 2011-10-31 Cary Coutant <ccoutant@google.com>
91 * expression.cc (Expression::eval_with_dot): Add
92 is_section_dot_assignment parameter.
93 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
94 absolute and assigning to dot within a section.
96 (Output_section_element_assignment::set_section_addresses): Pass
97 dot_section to set_if_absolute.
98 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
99 as is_section_dot_assignment flag to eval_with_dot.
100 (Output_section_element_dot_assignment::set_section_addresses):
102 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
103 parameter. Also set value if relative to dot_section; set the
104 symbol's output_section.
105 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
106 parameter. Adjust all callers.
107 (Expression::eval_maybe_dot): Likewise.
108 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
110 * testsuite/script_test_2.t: Test assignment of an absolute value
111 to dot within an output section element.
113 2011-10-31 Cary Coutant <ccoutant@google.com>
115 * options.h (class General_options): Add --[no-]gnu-unique options.
116 * symtab.cc (Symbol_table::sized_write_globals): Convert
117 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
119 2011-10-31 Cary Coutant <ccoutant@google.com>
122 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
123 unnecessary assertion.
124 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
126 2011-10-31 Sriraman Tallam <tmsriram@google.com>
128 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
130 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
132 Change to just keep the section associated with symbol.
133 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
134 they are externally visible and --export-dynamic is turned on.
135 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
137 2011-10-19 Ian Lance Taylor <iant@google.com>
141 (Output_section_element_dot_assignment::needs_output_section): New
144 2011-10-19 Ian Lance Taylor <iant@google.com>
147 * layout.cc (Layout::segment_precedes): Don't assert failure if a
148 --section-start option was seen.
149 * options.h (General_options::any_section_start): New function.
151 2011-10-18 David S. Miller <davem@davemloft.net>
154 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
155 member to track relocation locations that have moved during TLS
157 (Target_sparc::Relocate::Relocate): Initialize to NULL.
158 (Target_sparc::Relocate::relocate): Adjust view down by 4
159 bytes if it matches reloc_adjust_addr_.
160 (Target_sparc::Relocate::relocate_tls): Always move the
161 __tls_get_addr call delay slot instruction forward 4 bytes when
162 performing relaxation.
164 2011-10-18 Cary Coutant <ccoutant@google.com>
166 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
167 (Output_file::map_no_anonymous): Check for non-zero
168 return code from posix_fallocate.
170 2011-10-17 Cary Coutant <ccoutant@google.com>
173 * plugin.cc (is_visible_from_outside): Check for symbols
174 referenced from dynamic objects.
175 * resolve.cc (Symbol_table::resolve): Don't count references
176 from dynamic objects as references from real ELF files.
177 * testsuite/plugin_test_2.sh: Adjust expected result.
179 2011-10-17 Cary Coutant <ccoutant@google.com>
181 * gold.cc: Include timer.h.
182 (queue_middle_tasks): Stamp time.
183 (queue_final_tasks): Likewise.
184 * main.cc (main): Store timer in parameters. Print timers
186 * parameters.cc (Parameters::Parameters): Initialize timer_.
187 (Parameters::set_timer): New function.
188 (set_parameters_timer): New function.
189 * parameters.h (Parameters::set_timer): New function.
190 (Parameters::timer): New function.
191 (Parameters::timer_): New data member.
192 (set_parameters_timer): New function.
193 * timer.cc (Timer::stamp): New function.
194 (Timer::get_pass_time): New function.
195 * timer.h (Timer::stamp): New function.
196 (Timer::get_pass_time): New function.
197 (Timer::pass_times_): New data member.
199 2011-10-17 Cary Coutant <ccoutant@google.com>
201 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
202 task for members of lib groups.
204 2011-10-17 Cary Coutant <ccoutant@google.com>
207 * fileread.cc (File_read::find_view): Add assert.
208 (File_read::make_view): Move bounds check (replace with assert)...
209 (File_read::find_or_make_view): ... to here.
211 2011-10-12 Cary Coutant <ccoutant@google.com>
213 * output.cc (Output_file::open_base_file): Handle case where
214 ::read returns less than requested size.
216 2011-10-10 Cary Coutant <ccoutant@google.com>
218 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
219 Initialize defined_count_.
220 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
221 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
222 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
223 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
224 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
225 * incremental.h (Sized_relobj_incr::defined_count_): New data
227 (Sized_incr_dynobj::defined_count_): New data member.
228 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
229 Return zeroes instead of internal error.
231 2011-10-10 Cary Coutant <ccoutant@google.com>
234 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
235 (Output_reloc::symbol_value): Return PLT offset if flag is set.
236 * output.h (class Output_reloc): Add use_plt_offset flag.
237 (Output_reloc::type_): Adjust size of bit field.
238 (Output_reloc::use_plt_offset_): New bit field.
239 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
240 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
241 flag. Adjust all callers.
242 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
243 creating RELATIVE relocations.
245 2011-10-10 Nick Clifton <nickc@redhat.com>
247 * po/es.po: Updated Spanish translation.
248 * po/fi.po: Updated Finnish translation.
250 2011-10-03 Diego Novillo <dnovillo@google.com>
252 * options.cc (parse_uint): Fix dereference of RETVAL.
254 2011-09-29 Sriraman Tallam <tmsriram@google.com>
256 * layout.h (section_order_map_): New member.
257 (get_section_order_map): New member function.
258 * output.cc (Output_section::add_input_section): Check for patterns
259 only when --section-ordering-file is specified.
260 * gold.cc (queue_middle_tasks): Delay updating order of sections till
261 output_sections have been formed.
262 * layout.cc (Layout_Layout): Initialize section_order_map_.
263 * plugin.cc (update_section_order): Store order in order_map. Do not
265 * testsuite/Makefile.am: Add test case for plugin_final_layout.
266 * testsuite/Makefile.in: Regenerate.
267 * testsuite/plugin_section_order.c: New file.
268 * testsuite/plugin_final_layout.cc: New file.
269 * testsuite/plugin_final_layout.sh: New file.
271 2011-09-29 Cary Coutant <ccoutant@google.com>
273 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
275 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
276 symbols during incremental update.
277 (Symbol_table::add_from_dynobj): Likewise.
279 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
280 Ian Lance Taylor <iant@google.com>
282 * symtab.cc (Symbol_table::define_special_symbol): Always
283 canonicalize version string.
285 2011-09-26 Cary Coutant <ccoutant@google.com>
287 * gold.cc (queue_initial_tasks): Move option checks ...
288 * options.cc (General_options::finalize): ... to here. Disable
289 some options; make others fatal.
291 2011-09-26 Cary Coutant <ccoutant@google.com>
294 * plugin.cc (get_symbols_v2): New function.
295 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
296 (is_referenced_from_outside): New function.
297 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
298 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
299 (get_symbols): Pass version parameter.
300 (get_symbols_v2): New function.
301 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
303 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
304 (onload): Add LDPT_GET_SYMBOLS_V2.
305 (all_symbols_read_hook): Use get_symbols_v2; check for
306 LDPR_PREVAILING_DEF_IRONLY_EXP.
307 * testsuite/plugin_test_3.sh: Update expected results.
309 2011-09-23 Simon Baldwin <simonb@google.com>
311 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
312 configuration options.
313 * configure: Regenerate.
314 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
315 * Makefile.in: Regenerate.
316 * testsuite/Makefile.in: Regenerate.
318 2011-09-19 Sriraman Tallam <tmsriram@google.com>
320 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
322 2011-09-19 Cary Coutant <ccoutant@google.com>
324 * incremental.cc (can_incremental_update): Fix typo in comment.
325 * incremental.h (can_incremental_update): Likewise.
327 2011-09-18 Cary Coutant <ccoutant@google.com>
329 * incremental.cc (can_incremental_update): New function.
330 * incremental.h (can_incremental_update): New function.
331 * layout.cc (Layout::init_fixed_output_section): Call it.
332 (Layout::make_output_section): Don't allow patch space in .eh_frame.
333 * object.cc (Sized_relobj_file::do_layout): Call
334 can_incremental_update.
336 2011-09-13 Cary Coutant <ccoutant@google.com>
338 * configure.ac: Check for glibc support for gnu_indirect_function
339 support with static linking, setting automake conditional
341 * Makefile.in: Regenerate.
342 * configure: Regenerate.
344 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
345 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
347 * testsuite/Makefile.in: Regenerate.
349 2011-09-13 Cary Coutant <ccoutant@google.com>
351 * incremental.cc (Sized_relobj_incr::do_layout): Call
352 report_comdat_group for kept comdat sections.
353 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
354 * testsuite/Makefile.in: Regenerate.
355 * testsuite/incr_comdat_test_1.cc: New source file.
356 * testsuite/incr_comdat_test_2_v1.cc: New source file.
357 * testsuite/incr_comdat_test_2_v2.cc: New source file.
358 * testsuite/incr_comdat_test_2_v3.cc: New source file.
360 2011-09-13 Ian Lance Taylor <iant@google.com>
362 * object.cc (Sized_relobj_file::do_layout): Remove unused local
363 variable external_symbols_offset.
365 2011-09-12 Ian Lance Taylor <iant@google.com>
367 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
368 triggered if object has no symbols.
370 2011-09-09 David S. Miller <davem@davemloft.net>
372 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
373 (Output_fill_debug_line::do_write): Likewise.
375 2011-08-29 Cary Coutant <ccoutant@google.com>
377 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
378 casts to match formatting specs.
379 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
381 2011-08-26 Cary Coutant <ccoutant@google.com>
383 * layout.cc (Free_list::allocate): Provide guarantee of minimum
384 remaining hole size when allocating.
385 (Layout::make_output_section): Set fill methods for debug sections.
386 * layout.h (Free_list::Free_list_node): Move from private to
388 (Free_list::set_min_hole_size): New function.
389 (Free_list::begin, Free_list::end): New functions.
390 (Free_list::min_hole_): New data member.
391 * output.cc: Include dwarf.h.
392 (Output_fill_debug_info::do_minimum_hole_size): New function.
393 (Output_fill_debug_info::do_write): New function.
394 (Output_fill_debug_line::do_minimum_hole_size): New function.
395 (Output_fill_debug_line::do_write): New function.
396 (Output_section::Output_section): Initialize new data member.
397 (Output_section::set_final_data_size): Ensure patch space is larger
398 than minimum hole size.
399 (Output_section::do_write): Fill holes in debug sections.
400 * output.h (Output_fill): New class.
401 (Output_fill_debug_info): New class.
402 (Output_fill_debug_line): New class.
403 (Output_section::set_free_space_fill): New function.
404 (Output_section::free_space_fill_): New data member.
405 * testsuite/Makefile.am (incremental_test_3): Add
406 --incremental-patch option.
407 (incremental_test_4): Likewise.
408 (incremental_test_5): Likewise.
409 (incremental_test_6): Likewise.
410 (incremental_copy_test): Likewise.
411 (incremental_common_test_1): Likewise.
412 * testsuite/Makefile.in: Regenerate.
414 2011-08-26 Nick Clifton <nickc@redhat.com>
416 * po/es.po: Updated Spanish translation.
418 2011-08-01 Cary Coutant <ccoutant@google.com>
420 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
421 * gold/testsuite/Makefile.in: Regenerate.
422 * gold/testsuite/justsyms_exec.c: New source file.
423 * gold/testsuite/justsyms_lib.c: New source file.
425 2011-08-01 Cary Coutant <ccoutant@google.com>
427 * layout.cc (Layout::set_segment_offsets): Don't realign text
428 segment if -Ttext was specified.
429 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
431 * object.h (Sized_relobj_file::e_type): New function.
432 (Sized_relobj_file::e_type_): New data member.
433 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
434 base address for ET_EXEC files.
435 * target.cc (Target::do_make_elf_object_implementation): Allow
436 ET_EXEC files with --just-symbols option.
438 2011-07-28 Cary Coutant <ccoutant@google.com>
440 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
441 Add thread_number parameter.
442 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
443 * workqueue-threads.cc
444 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
445 current thread if its thread number is greater than desired thread
447 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
448 Add thread_number parameter.
449 (Workqueue::should_cancel_thread): Likewise.
450 (Workqueue::find_runnable_or_wait): Pass thread_number to
451 should_cancel_thread.
452 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
455 2011-07-22 Sriraman Tallam <tmsriram@google.com>
457 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
458 only after checking if it cannot be forced local.
459 * symtab.h (is_externally_visible): Check if the symbol is not forced
462 2011-07-15 Ian Lance Taylor <iant@google.com>
464 * options.h (class General_options): Add --print-output-format.
465 Move -EL next to -EB, for better --help output.
466 * target-select.cc: Include <cstdio>, "options.h", and
468 (Target_selector::do_target_bfd_name): New function.
469 (print_output_format): New function.
470 * target-select.h (class Target_selector): Update declarations.
471 (Target_selector::target_bfd_name): New function.
472 (print_output_format): Declare.
473 * main.cc: Include "target-select.h".
474 (main): Handle --print-output-format.
475 * gold.cc: Include "target-select.h".
476 (queue_initial_tasks): Handle --print-output-format when there are
478 * parameters.cc (parameters_force_valid_target): Give a better
479 error message if -EB/-EL does not match target.
480 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
483 2011-07-15 Ian Lance Taylor <iant@google.com>
485 * i386.cc (class Output_data_plt_i386): Add layout_ field.
486 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
487 (Output_data_plt_i386::do_write): Write address of .dynamic
488 section to first entry in .got.plt section.
489 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
490 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
492 (Output_data_plt_x86_64::do_write): Write address of .dynamic
493 section to first entry in .got.plt section.
494 * layout.h (Layout::dynamic_section): New function.
496 2011-07-13 Sriraman Tallam <tmsriram@google.com>
498 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
500 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
501 input_section_position_, and input_section_glob_.
502 (read_layout_from_file): Call function section_ordering_specified.
503 * layout.h (is_section_ordering_specified): New function.
504 (section_ordering_specified): New function.
505 (section_ordering_specified_): New boolean member.
506 * main.cc(main): Call load_plugins after layout object is defined.
507 * output.cc (Output_section::add_input_section): Use
508 function section_ordering_specified to check if section ordering is
510 * output.cc (Output_section::add_relaxed_input_section): Use
511 function section_ordering_specified to check if section ordering is
513 (Output_section::update_section_layout): New function.
514 (Output_section::sort_attached_input_sections): Check if input section
516 * output.h (Output_section::update_section_layout): New function.
517 * plugin.cc (get_section_count): New function.
518 (get_section_type): New function.
519 (get_section_name): New function.
520 (get_section_contents): New function.
521 (update_section_order): New function.
522 (allow_section_ordering): New function.
523 (Plugin::load): Add the new interfaces to the transfer vector.
524 (Plugin_manager::load_plugins): New parameter.
525 (Plugin_manager::all_symbols_read): New parameter.
526 (Plugin_manager::claim_file): New parameter. Save the elf object for
528 (Plugin_manager::get_elf_object): New function.
529 (Plugin_manager::get_view): Change to directly use the bool to check
530 if get_view is called from claim_file_hook.
531 * plugin.h (input_objects): New function
532 (Plugin__manager::load_plugins): New parameter.
533 (Plugin_manager::claim_file): New parameter.
534 (Plugin_manager::get_elf_object): New function.
535 (Plugin_manager::in_claim_file_handler): New function.
536 (Plugin_manager::in_claim_file_handler_): New member.
537 (layout): New function.
538 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
539 handler with an extra parameter. Make the elf object before calling
541 * testsuite/plugin_test.c (get_section_count): New function pointer.
542 (get_section_type): New function pointer.
543 (get_section_name): New function pointer.
544 (get_section_contents): New function pointer.
545 (update_section_order): New function pointer.
546 (allow_section_ordering): New function pointer.
547 (onload): Check if the new interfaces exist.
549 2011-07-13 Ian Lance Taylor <iant@google.com>
551 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
553 * x86_64.cc (Target_x86_64::got_section): Likewise.
554 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
555 (relro_now_test_SOURCES): New variable.
556 (relro_now_test_DEPENDENCIES): New variable.
557 (relro_now_test_LDFLAGS): New variable.
558 (relro_now_test_LDADD): New variable.
559 (relro_now_test.so): New target.
560 * testsuite/Makefile.in: Rebuild.
562 2011-07-12 Ian Lance Taylor <iant@google.com>
565 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
566 GLOB_DAT relocation rather than a RELATIVE relocation for a
567 protected symbol when creating a shared library.
568 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
569 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
570 * testsuite/protected_main_1.cc (main): Test that protected
571 function has same address.
573 2011-07-11 Ian Lance Taylor <iant@google.com>
576 * options.h (class General_options): Add -Bgroup.
577 * options.cc (General_options::finalize): If -Bgroup is set,
578 default to --unresolved-symbols=report-all.
579 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
580 * target-reloc.h (issue_undefined_symbol_error): Handle
581 --unresolved-symbols=report-all.
583 2011-07-08 Ian Lance Taylor <iant@google.com>
586 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
587 if linker script discards key sections.
588 (Layout::create_dynamic_symtab): Likewise.
589 (Layout::assign_local_dynsym_offsets): Likewise.
590 (Layout::sized_create_version_sections): Likewise.
591 (Layout::create_interp): Likewise.
592 (Layout::finish_dynamic_section): Likewise.
593 (Layout::set_dynamic_symbol_size): Likewise.
595 2011-07-08 Ian Lance Taylor <iant@google.com>
598 * options.h (class General_options): Add --unresolved-symbols.
599 * target-reloc.h (issue_undefined_symbol_error): Check
600 --unresolved-symbols. Add comments.
602 2011-07-08 Ian Lance Taylor <iant@google.com>
604 * testsuite/odr_violation2.cc (Ordering::operator()): Make
605 expression more complex.
607 2011-07-08 Ian Lance Taylor <iant@google.com>
610 * target-reloc.h (issue_undefined_symbol_error): New inline
611 function, broken out of relocate_section.
612 (relocate_section): Call issue_undefined_symbol_error.
613 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
614 there is no TLS segment if we are about to issue an undefined
616 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
618 2011-07-08 Ian Lance Taylor <iant@google.com>
621 * resolve.cc (Symbol_table::should_override): Add fromtype
622 parameter. Change all callers. Give error when linking together
623 TLS and non-TLS symbol.
624 (Symbol_table::should_override_with_special): Add fromtype
625 parameter. Change all callers.
626 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
627 there is no TLS segment if we have reported some errors.
628 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
630 2011-07-08 Ian Lance Taylor <iant@google.com>
633 * target.h (Target::plt_address_for_global): New function.
634 (Target::plt_address_for_local): New function.
635 (Target::plt_section_for_global): Remove.
636 (Target::plt_section_for_local): Remove.
637 (Target::do_plt_address_for_global): New virtual function.
638 (Target::do_plt_address_for_local): New virtual function.
639 (Target::do_plt_section_for_global): Remove.
640 (Target::do_plt_section_for_local): Remove.
641 (Target::register_global_plt_entry): Add Symbol_table and Layout
643 * output.cc (Output_data_got::Got_entry::write): Use
644 plt_address_for_global and plt_address_for_local.
645 * layout.cc (Layout::add_target_dynamic_tags): Use size and
646 address of output section.
647 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
648 got_irelative_, and irelative_count_ fields. Update
650 (Output_data_plt_i386::has_irelative_section): New function.
651 (Output_data_plt_i386::entry_count): Add irelative_count_.
652 (Output_data_plt_i386::set_final_data_size): Likewise.
653 (class Target_i386): Add got_irelative_ and rel_irelative_
654 fields. Update declarations.
655 (Target_i386::Target_i386): Initialize new fields.
656 (Target_i386::do_plt_address_for_global): New function replacing
657 do_plt_section_for_global.
658 (Target_i386::do_plt_address_for_local): New function replacing
659 do_plt_section_for_local.
660 (Target_i386::got_section): Create got_irelative_.
661 (Target_i386::rel_irelative_section): New function.
662 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
663 fields. Don't define __rel_iplt_{start,end}.
664 (Output_data_plt_i386::add_entry): Add symtab and layout
665 parameters. Change all callers. Use different PLT and GOT for
667 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
668 layout parameters. Change all callers. Use different PLT and
670 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
671 (Output_data_plt_i386::rel_irelative): New function.
672 (Output_data_plt_i386::address_for_global): New function.
673 (Output_data_plt_i386::address_for_local): New function.
674 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
675 IRELATIVE GOT when changing IFUNC GOT entries.
676 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
678 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
679 if we didn't create an IRELATIVE GOT.
680 (Target_i386::Relocate::relocate): Use plt_address_for_global and
681 plt_address_for_local.
682 (Target_i386::do_dynsym_value): Use plt_address_for_global.
683 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
684 got_irelative_, and irelative_count_ fields. Update
686 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
687 Initialize new fields. Remove symtab parameter. Change all
689 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
691 (Output_data_plt_x86_64::has_irelative_section): New function.
692 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
693 (class Target_x86_64): Add got_irelative_ and rel_irelative_
694 fields. Update declarations.
695 (Target_x86_64::Target_x86_64): Initialize new fields.
696 (Target_x86_64::do_plt_address_for_global): New function replacing
697 do_plt_section_for_global.
698 (Target_x86_64::do_plt_address_for_local): New function replacing
699 do_plt_section_for_local.
700 (Target_x86_64::got_section): Create got_irelative_.
701 (Target_x86_64::rela_irelative_section): New function.
702 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
703 all callers. Don't create __rel_iplt_{start,end}.
704 (Output_data_plt_x86_64::add_entry): Add symtab and layout
705 parameters. Change all callers. Use different PLT and GOT for
707 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
708 layout parameters. Change all callers. Use different PLT and
710 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
711 parameters. Change all callers. Use different PLT and GOT for
713 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
714 (Output_data_plt_x86_64::rela_irelative): New function.
715 (Output_data_plt_x86_64::address_for_global): New function.
716 (Output_data_plt_x86_64::address_for_local): New function.
717 (Output_data_plt_x86_64::set_final_data_size): Likewise.
718 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
719 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
720 (Target_x86_64::register_global_plt_entry): Add symtab and layout
722 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
724 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
725 symbols if we didn't create an IRELATIVE GOT.
726 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
727 plt_address_for_local.
728 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
729 * testsuite/ifuncvar1.c: New test file.
730 * testsuite/ifuncvar2.c: New test file.
731 * testsuite/ifuncvar3.c: New test file.
732 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
733 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
734 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
735 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
736 * testsuite/Makefile.in: Rebuild.
738 2011-07-07 Cary Coutant <ccoutant@google.com>
740 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
741 (two_file_test_1_ndebug.o): Likewise.
742 (two_file_test_1b_ndebug.o): Likewise.
743 (two_file_test_2_ndebug.o): Likewise.
744 (two_file_test_main_ndebug.o): Likewise.
745 (incremental_test_2): Link with no-debug versions.
747 2011-07-06 Cary Coutant <ccoutant@google.com>
749 * gold/incremental.cc
750 (Output_section_incremental_inputs::write_info_blocks): Check for
751 hidden and internal symbols.
753 2011-07-06 Cary Coutant <ccoutant@google.com>
755 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
756 Check disposition for startup file.
757 (Incremental_inputs::report_command_line): Ignore
758 --incremental-startup-unchanged option.
759 * options.cc (General_options::parse_incremental_startup_unchanged):
761 (General_options::General_options): Initialize new data member.
762 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
763 (General_options): Add --incremental-startup-unchanged option.
764 (General_options::incremental_startup_disposition): New function.
765 (General_options::incremental_startup_disposition_): New data member.
767 2011-07-06 Cary Coutant <ccoutant@google.com>
769 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
770 input file index to Script_info ctor.
771 (Sized_incremental_binary::do_file_has_changed): Find the
772 command-line argument for files named in scripts.
773 * incremental.h (Script_info::Script_info): New ctor
774 with input file index.
775 (Script_info::input_file_index): New function.
776 (Script_info::input_file_index_): New data member.
777 (Incremental_binary::get_library): Add const.
778 (Incremental_binary::get_script_info): Add const.
779 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
780 * testsuite/Makefile.am (incremental_test_5): New test case.
781 (incremental_test_6): New test case.
782 * testsuite/Makefile.in: Regenerate.
784 2011-07-06 Cary Coutant <ccoutant@google.com>
786 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
787 debug output when command lines differ.
789 2011-07-06 Cary Coutant <ccoutant@google.com>
791 * incremental.cc (Incremental_inputs::report_command_line): Ignore
792 --incremental-patch option.
793 * layout.cc (Free_list::allocate): Extend allocation beyond original
795 (Layout::make_output_section): Mark sections that should get
797 * options.cc (parse_percent): New function.
798 * options.h (parse_percent): New function.
799 (DEFINE_percent): New macro.
800 (General_options): Add --incremental-patch option.
801 * output.cc (Output_section::Output_section): Initialize new data
803 (Output_section::add_input_section): Print section name when out
805 (Output_section::add_output_section_data): Likewise.
806 (Output_section::set_final_data_size): Add patch space when
807 doing --incremental-full.
808 (Output_section::do_reset_address_and_file_offset): Remove patch
810 (Output_segment::set_section_list_addresses): Print debug output
811 only if --incremental-update.
812 * output.h (Output_section::set_is_patch_space_allowed): New function.
813 (Output_section::is_patch_space_allowed_): New data member.
814 (Output_section::patch_space_): New data member.
815 * parameters.cc (Parameters::incremental_full): New function.
816 * parameters.h (Parameters::incremental_full): New function
817 * testsuite/Makefile.am (incremental_test_2): Add test for
818 --incremental-patch option.
819 * testsuite/Makefile.in: Regenerate.
820 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
821 (t18): Remove function body.
823 2011-07-05 Doug Kwan <dougkwan@google.com>
826 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
827 Arm_Address type for relocation result.
828 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
830 (Arm_relocate_functions::abs32): Use unaligned access.
831 (Arm_relocate_functions::rel32): Ditto.
832 (Arm_relocate_functions::prel31): Ditto.
833 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
834 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
835 static data relocations.
836 * testsuite/Makefile.in: Regnerate.
837 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
839 2011-07-05 Ian Lance Taylor <iant@google.com>
842 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
843 symbols if necessary.
844 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
846 2011-07-05 Ian Lance Taylor <iant@google.com>
849 * resolve.cc (Symbol::override_base_with_special): Simply override
850 version with special symbol version, ignoring previous version.
852 2011-07-05 Ian Lance Taylor <iant@google.com>
854 * object.cc (Sized_relobj_file::include_section_group): Add
855 information to comment about signature location.
857 2011-07-02 Ian Lance Taylor <iant@google.com>
860 * options.h (class General_options): Add -f and -F.
861 * options.cc (General_options::finalize): Fatal error if -f/-F
862 are used without -shared.
863 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
865 2011-07-02 Ian Lance Taylor <iant@google.com>
867 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
869 2011-07-01 Ian Lance Taylor <iant@google.com>
873 * resolve.cc (Symbol::override_base_with_special): Don't override
874 the version if the overriding symbol has a different name.
875 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
876 all callers. If we give an error about an undefined version,
877 define the base version if necessary.
878 * dynobj.h (class Versions): Update declaration.
879 * testsuite/weak_alias_test_5.cc: New file.
880 * testsuite/weak_alias_test.script: New file.
881 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
882 and versioned_alias have the right value, and call t2.
883 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
884 weak_alias_test_5.so.
885 (weak_alias_test_LDADD): Likewise.
886 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
887 * testsuite/Makefile.in: Rebuild.
889 2011-07-01 Ian Lance Taylor <iant@google.com>
892 * options.h (class General_options): Support -z notext.
893 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
895 (two_file_shared_nonpic.so): Likewise.
896 (two_file_shared_mixed.so): Likewise.
897 (two_file_shared_mixed_1.so): Likewise.
898 (weak_undef_lib_nonpic.so): Likewise.
899 (alt/weak_undef_lib_nonpic.so): Likewise.
900 (tls_test_shared_nonpic.so): Likewise.
901 * testsuite/Makefile.in: Rebuild.
903 2011-07-01 Ian Lance Taylor <iant@google.com>
906 * configure.ac: Test whether static linking works, setting
907 the automake conditional HAVE_STATIC.
908 * testsuite/Makefile.am: Disable tests using -static if
909 HAVE_STATIC is not true.
910 * configure, testsuite/Makefile.in: Rebuild.
912 2011-07-01 Ian Lance Taylor <iant@google.com>
915 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
916 Assert if we see DW_EH_PE_indirect.
917 * target.h (Target::ehframe_datarel_base): New function.
918 (Target::do_ehframe_datarel_base): New target function.
919 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
920 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
923 2011-07-01 Ian Lance Taylor <iant@google.com>
926 * options.h (class General_options): Add
927 --ld-generated-unwind-info.
928 * ehframe.cc (Fde::write): Add address parameter. Change all
929 callers. If associated with PLT, fill in address and size.
930 (Cie::set_output_offset): Only add merge mapping if there is an
932 (Cie::write): Add address parameter. Change all callers.
933 (Eh_frame::add_ehframe_for_plt): New function.
934 * ehframe.h (class Fde): Update declarations. Move shndx_ and
935 input_offset_ fields into union u_, with new plt field.
936 (Fde::Fde): Adjust for new union field.
937 (Fde::Fde) [Output_data version]: New constructor.
938 (Fde::add_mapping): Only add merge mapping if there is an object.
939 (class Cie): Update declarations.
940 (class Eh_frame): Declare add_ehframe_for_plt.
941 * layout.cc (Layout::layout_eh_frame): Break out code into
942 make_eh_frame_section, and call it.
943 (Layout::make_eh_frame_section): New function.
944 (Layout::add_eh_frame_for_plt): New function.
945 * layout.h (class Layout): Update declarations.
946 * merge.cc (Merge_map::add_mapping): Add assertion.
947 * i386.cc: Include "dwarf.h".
948 (class Output_data_plt_i386): Make first_plt_entry,
949 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
950 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
951 and plt_eh_frame_fde.
952 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
953 boundary. Call add_eh_frame_for_plt if appropriate.
954 * x86_64.cc: Include "dwarf.h".
955 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
956 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
957 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
958 and plt_eh_frame_fde.
959 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
962 2011-06-29 Ian Lance Taylor <iant@google.com>
965 * object.cc (Sized_relobj_file::layout_section): Change shdr
966 parameter to be const.
967 (Sized_relobj_file::layout_eh_frame_section): New function, broken
969 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
970 appropriate. Call layout_eh_frame_section.
971 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
973 * object.h (class Sized_relobj_file): Update declarations.
975 2011-06-29 Ian Lance Taylor <iant@google.com>
978 * script.cc (Token::integer_value): Accept trailing M/m/K/k
980 (Lex::gather_token): Accept trailing M/m/K/k for integers.
982 2011-06-29 Ian Lance Taylor <iant@google.com>
985 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
987 * layout.cc (Layout::layout_eh_frame): Likewise.
989 2011-06-29 Ian Lance Taylor <iant@google.com>
992 * layout.cc (Layout::symtab_section_shndx): New function.
993 * layout.h (class Layout): Declare symtab_section_shndx.
994 * output.cc (Output_section::write_header): Call it.
996 2011-06-29 Ian Lance Taylor <iant@google.com>
999 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
1000 symbols which are not used in a relocation.
1002 2011-06-28 Ian Lance Taylor <iant@google.com>
1005 * layout.cc (Layout::segment_precedes): Don't crash if a linker
1006 script create indistinguishable segments.
1007 (Layout::set_segment_offsets): Use stable_sort when sorting
1008 segments. Pass this to Compare_segments constructor.
1009 * layout.h (class Layout): Make segment_precedes non-static.
1010 (class Compare_segments): Change from struct to class. Add
1011 layout_ field. Add constructor.
1012 * script-sections.cc
1013 (Script_sections::attach_sections_using_phdrs_clause): Rename
1014 local orphan to is_orphan. Don't report failure to put empty
1015 section in segment. On attachment failure, report name of
1016 section, and attach to first PT_LOAD segment.
1018 2011-06-28 Ian Lance Taylor <iant@google.com>
1021 * target-select.cc (Target_selector::Target_selector): Add
1022 emulation parameter. Change all callers.
1023 (select_target_by_bfd_name): Rename from select_target_by_name.
1025 (select_target_by_emulation): New function.
1026 (supported_emulation_names): New function.
1027 * target-select.h (class Target_selector): Add emulation_ field.
1028 Update declarations.
1029 (Target_selector::recognize_by_bfd_name): Rename from
1030 recognize_by_name. Change all callers.
1031 (Target_selector::supported_bfd_names): Rename from
1032 supported_names. Change all callers.
1033 (Target_selector::recognize_by_emulation): New function.
1034 (Target_selector::supported_emulations): New function.
1035 (Target_selector::emulation): New function.
1036 (Target_selector::do_recognize_by_bfd_name): Rename from
1037 do_recognize_by_name. Change all callers.
1038 (Target_selector::do_supported_bfd_names): Rename from
1039 do_supported_names. Change all callers.
1040 (Target_selector::do_recognize_by_emulation): New function.
1041 (Target_selector::do_supported_emulations): New function.
1042 (select_target_by_bfd_name): Change name in declaration.
1043 (select_target_by_emulation): Declare.
1044 (supported_emulation_names): Declare.
1045 * parameters.cc (parameters_force_valid_target): Try to find
1046 target based on emulation from -m option.
1047 * options.h (class General_options): Change doc string for -m.
1048 * options.cc (help): Print emulations.
1049 (General_options::parse_V): Likewise.
1050 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1051 Add emulation parameter. Change all callers.
1053 2011-06-28 Ian Lance Taylor <iant@google.com>
1055 * target.h (class Target): Add osabi_ field.
1056 (Target::osabi): New function.
1057 (Target::set_osabi): New function.
1058 (Target::Target): Initialize osabi_.
1059 (Target::do_adjust_elf_header): Make pure virtual.
1060 (Sized_target::do_adjust_elf_header): Declare.
1061 * target.cc (Sized_target::do_adjust_elf_header): New function.
1062 (class Sized_target): Instantiate all versions.
1063 * freebsd.h (class Target_freebsd): Remove.
1064 (Target_selector_freebsd::do_recognize): Call set_osabi on
1066 (Target_selector_freebsd::do_recognize_by_name): Likewise.
1067 (Target_selector_freebsd::set_osabi): Remove.
1068 * i386.cc (class Target_i386): Inherit from Sized_target rather
1069 than Target_freebsd.
1070 * x86_64.cc (class Target_x86_64): Likewise.
1072 2011-06-28 Ian Lance Taylor <iant@google.com>
1074 * target.h (Target::can_check_for_function_pointers): Rewrite.
1076 (Target::can_icf_inline_merge_sections): Likewise.
1077 (Target::section_may_have_icf_unsafe_poineters): Likewise.
1078 (Target::Target_info): Add can_icf_inline_merge_sections field.
1079 (Target::do_can_check_for_function_pointers): New virtual
1081 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
1082 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
1083 from can_check_for_function_pointers, move in file.
1084 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
1085 section_may_have_icf_unsafe_poineters, move in file.
1086 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
1087 * i386.cc (Target_i386::do_can_check_for_function_pointers):
1088 Rename from can_check_for_function_pointers, move in file.
1089 (Target_i386::can_icf_inline_merge_sections): Remove.
1090 (Target_i386::i386_info): Initialize
1091 can_icf_inline_merge_sections.
1092 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1093 Initialize can_icf_inline_merge_sections.
1094 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
1095 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
1096 Rename from can_check_for_function_pointers, move in file.
1097 (Target_x86_64::can_icf_inline_merge_sections): Remove.
1098 (Target_x86_64::x86_64_info): Initialize
1099 can_icf_inline_merge_sections.
1100 * testsuite/testfile.cc (Target_test::test_target_info):
1102 * icf.cc (get_section_contents): Correct formatting.
1104 2011-06-27 Ian Lance Taylor <iant@google.com>
1106 * symtab.cc (Symbol::versioned_name): New function.
1107 (Symbol_table::add_to_final_symtab): Use versioned_name when
1109 (Symbol_table::sized_write_symbol): Likewise.
1110 * symtab.h (class Symbol): Declare versioned_name.
1111 * stringpool.h (class Stringpool_template): Add variant of add
1112 which takes a std::basic_string.
1113 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
1114 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
1115 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
1116 (ver_test_12.o): New target.
1117 * testsuite/Makefile.in: Rebuild.
1119 2011-06-27 Doug Kwan <dougkwan@google.com>
1121 * arm.cc (Arm_relocate_functions::thm_jump8,
1122 Arm_relocate_functions::thm_jump11): Use a wider signed
1123 type to compute offset.
1124 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
1126 * testsuite/Makefile.in: Regenerate.
1127 * testsuite/arm_branch_in_range.sh: Check test results of
1128 arm_thm_jump11 and arm_thm_jump8.
1129 * testsuite/arm_thm_jump11.s: New test source file.
1130 * testsuite/arm_thm_jump11.t: New linker script.
1131 * testsuite/arm_thm_jump8.s: New test source file.
1132 * testsuite/arm_thm_jump8.t: New linker script.
1134 2011-06-24 Ian Lance Taylor <iant@google.com>
1136 * layout.cc: Include "object.h".
1137 (ctors_sections_in_init_array): New static variable.
1138 (Layout::is_ctors_in_init_array): New function.
1139 (Layout::layout): Add entry to ctors_sections_in_init_array if
1141 * layout.h (class Layout): Declare is_ctors_in_init_array.
1142 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
1143 is_ctors_reverse_view is set.
1144 (Sized_relobj_file::write_sections): Add layout parameter. Change
1145 all callers. Set is_ctors_reverse_view field of View_size.
1146 (Sized_relobj_file::reverse_words): New function.
1147 * object.h (Sized_relobj_file::View_size): Add
1148 is_ctors_reverse_view field.
1149 (class Sized_relobj_file): Update declarations.
1150 * testsuite/initpri3.c: New test.
1151 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
1153 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
1154 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
1155 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
1156 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
1157 * testsuite/Makefile.in: Rebuild.
1159 2011-06-24 Cary Coutant <ccoutant@google.com>
1161 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
1162 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
1163 (debug_msg_cdebug.err): New targets.
1164 * testsuite/Makefile.in: Regenerate.
1165 * testsuite/debug_msg.sh: Check output of link with compressed debug.
1166 Fix checks for link with shared library.
1168 2011-06-24 Doug Kwan <dougkwan@google.com>
1170 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
1171 skip empty text sections.
1172 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
1174 2011-06-22 Ian Lance Taylor <iant@google.com>
1177 * options.h (class General_options): Add --ctors-in-init-array.
1178 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
1179 friends as SHT_PROGBITS for merging sections.
1180 (Layout::layout): Remove special handling of .init_array and
1181 friends. Don't sort if doing relocatable link. Sort for .ctors
1182 and .dtors if ctors_in_init_array.
1183 (Layout::make_output_section): Force correct section types for
1184 .init_array and friends. Don't sort if doing relocatable link,
1185 Don't sort .ctors and .dtors if ctors_in_init_array.
1186 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
1187 (Layout::output_section_name): Add relobj parameter. Change all
1188 callers. Handle .ctors. and .dtors. in code rather than table.
1189 Handle .ctors and .dtors if ctors_in_init_array.
1190 (Layout::match_file_name): New function, moved from output.cc.
1191 * layout.h (class Layout): Update declarations.
1192 * output.cc: Include "layout.h".
1193 (Input_section_sort_entry::get_priority): New function.
1194 (Input_section_sort_entry::match_file_name): Just call
1195 Layout::match_file_name.
1196 (Output_section::Input_section_sort_init_fini_compare::operator()):
1197 Handle .ctors and .dtors. Sort by explicit priority rather than
1199 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
1200 * testsuite/initpri2.c: New test.
1201 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
1202 (check_PROGRAMS): Add initpri2.
1203 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
1204 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
1205 * configure, testsuite/Makefile.in: Rebuild.
1207 2011-06-19 Ian Lance Taylor <iant@google.com>
1210 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
1211 .interp section to a PT_INTERP segment even if we have seen a
1212 --dynamic-linker option. Don't do it if we have seen a PHDRS
1213 clause in a linker script.
1214 (Layout::finalize): Don't create a .interp section if we've
1215 already create a PT_INTERP segment.
1216 (Layout::create_interp): Always call choose_output_section (revert
1217 patch of 2011-06-17). Don't create PT_INTERP segment.
1218 * script-sections.cc
1219 (Script_sections::create_note_and_tls_segments): Add a .interp
1220 section to a PT_INTERP segment even if we have seen a
1221 --dynamic-linker option.
1223 2011-06-18 Ian Lance Taylor <iant@google.com>
1225 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
1226 merely because a non-PT_LOAD segment has a dynamic reloc.
1228 2011-06-18 Ian Lance Taylor <iant@google.com>
1230 * layout.cc (Layout::finish_dynamic_section): Don't create
1231 DT_FLAGS entry if not needed.
1233 2011-06-18 Ian Lance Taylor <iant@google.com>
1236 * layout.cc (Layout::layout_eh_frame): Correct handling of
1237 writable .eh_frame section.
1239 2011-06-17 Ian Lance Taylor <iant@google.com>
1242 * resolve.cc (Symbol_table::resolve): Don't give an error if a
1243 symbol is redefined with the exact same object and value.
1245 2011-06-17 Ian Lance Taylor <iant@google.com>
1248 * layout.h (class Layout): Add interp_segment_ field.
1249 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
1250 (Layout::attach_allocated_section_to_segment): If making shared
1251 library, put .interp section in PT_INTERP segment.
1252 (Layout::finalize): Also call create_interp if -dynamic-linker
1254 (Layout::create_interp): Assert that there is no PT_INTERP
1255 segment. If not using a SECTIONS clause, use make_output_section.
1256 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
1257 * script-sections.cc
1258 (Script_sections::create_note_and_tls_segments): If making shared
1259 library, put .interp section in PT_INTERP segment.
1261 2011-06-17 Ian Lance Taylor <iant@google.com>
1263 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
1264 when making a shared library.
1266 2011-06-17 Ian Lance Taylor <iant@google.com>
1268 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
1269 parameter. Change all callers. Don't issue warning about PC32
1270 against locally defined symbol.
1272 2011-06-16 Ian Lance Taylor <iant@google.com>
1274 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
1275 occurs in same object.
1277 2011-06-14 Alan Modra <amodra@gmail.com>
1279 * po/POTFILES.in: Regenerate.
1281 2011-06-09 Ian Lance Taylor <iant@google.com>
1283 * script-sections.cc
1284 (Orphan_output_section::set_section_addresses): For a relocatable
1285 link set address to 0.
1287 2011-06-09 Cary Coutant <ccoutant@google.com>
1290 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
1291 used with --compress-debug-sections.
1292 * gold/object.cc (Sized_relobj_file::do_layout): Report
1293 uncompressed size of compressed input sections.
1295 2011-06-08 Cary Coutant <ccoutant@google.com>
1298 * testsuite/two_file_test_2_v1.cc: Change initialization of
1299 v2 to keep it in .data.
1301 2011-06-07 Cary Coutant <ccoutant@google.com>
1303 * common.cc (Symbol_table::do_allocate_commons_list): Call
1305 * errors.cc (Errors::fatal): Adjust call to gold_exit.
1306 (Errors::fallback): New function.
1307 (gold_fallback): New function.
1308 * errors.h (Errors::fallback): New function.
1309 * gold.cc (gold_exit): Change status parameter to enum; adjust
1311 (queue_initial_tasks): Call gold_fallback.
1312 * gold.h: Include cstdlib.
1313 (Exit_status): New enum type.
1314 (gold_exit): Change status parameter to enum.
1315 (gold_fallback): New function.
1316 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
1317 (Layout::create_symtab_sections): Likewise.
1318 (Layout::create_shdrs): Likewise.
1319 * main.cc (main): Adjust call to gold_exit.
1320 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
1321 (Output_data_got::add_got_entry_pair): Likewise.
1322 (Output_section::add_input_section): Likewise.
1323 (Output_section::add_output_section_data): Likewise.
1324 (Output_segment::set_section_list_addresses): Likewise.
1325 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
1327 2011-06-07 Cary Coutant <ccoutant@google.com>
1329 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
1330 for incremental links.
1331 * output.cc (Output_segment::set_section_list_addresses): Remove
1332 FIXME and test for TLS or BSS.
1334 2011-06-07 Cary Coutant <ccoutant@google.com>
1336 * testsuite/Makefile.am: Add incremental_copy_test,
1337 incremental_common_test_1.
1338 * testsuite/Makefile.in: Regenerate.
1339 * testsuite/common_test_1_v1.c: New source file.
1340 * testsuite/common_test_1_v2.c: New source file.
1341 * testsuite/copy_test_v1.cc: New source file.
1343 2011-06-07 Cary Coutant <ccoutant@google.com>
1345 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
1346 update, allocate common from bss section's free list.
1347 * incremental-dump.cc (dump_incremental_inputs): Print flag for
1348 linker-defined symbols.
1349 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1350 Skip GOT and PLT entries that are no longer referenced.
1351 (Output_section_incremental_inputs::write_info_blocks): Mark
1352 linker-defined symbols.
1353 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
1354 * output.cc (Output_section::allocate): New function.
1355 * output.h (Output_section::allocate): New function.
1356 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
1357 linker-defined symbols.
1358 (Symbol::override_base_with_special): Copy is_predefined_ flag.
1359 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
1360 (Symbol::init_base_output_data): Likewise.
1361 (Symbol::init_base_output_segment): Likewise.
1362 (Symbol::init_base_constant): Likewise.
1363 (Sized_symbol::init_output_data): Likewise.
1364 (Sized_symbol::init_output_segment): Likewise.
1365 (Sized_symbol::init_constant): Likewise.
1366 (Symbol_table::do_define_in_output_data): Likewise.
1367 (Symbol_table::do_define_in_output_segment): Likewise.
1368 (Symbol_table::do_define_as_constant): Likewise.
1369 * symtab.h (Symbol::is_predefined): New function.
1370 (Symbol::init_base_output_data): Add is_predefined parameter.
1371 (Symbol::init_base_output_segment): Likewise.
1372 (Symbol::init_base_constant): Likewise.
1373 (Symbol::is_predefined_): New data member.
1374 (Sized_symbol::init_output_data): Add is_predefined parameter.
1375 (Sized_symbol::init_output_segment): Likewise.
1376 (Sized_symbol::init_constant): Likewise.
1377 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
1379 2011-06-07 Cary Coutant <ccoutant@google.com>
1381 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
1382 instead of emit_copy_reloc.
1383 (Copy_relocs::emit_copy_reloc): Refactor.
1384 (Copy_relocs::make_copy_reloc): New function.
1385 (Copy_relocs::add_copy_reloc): Remove.
1386 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
1388 (Copy_relocs::make_copy_reloc): New function.
1389 (Copy_relocs::add_copy_reloc): Remove.
1390 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
1391 unchanged input files.
1392 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
1393 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
1394 Reserve BSS space for COPY relocations.
1395 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1396 (Output_section_incremental_inputs::write_info_blocks): Record
1397 whether a symbol is copied from a shared object.
1398 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
1399 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
1400 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
1401 (Incremental_input_entry_reader::get_output_symbol_index): Add
1403 (Incremental_binary::emit_copy_relocs): New function.
1404 (Incremental_binary::do_emit_copy_relocs): New function.
1405 (Sized_incremental_binary::Sized_incremental_binary): Initialize
1407 (Sized_incremental_binary::add_copy_reloc): New function.
1408 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1409 (Sized_incremental_binary::Copy_reloc): New struct.
1410 (Sized_incremental_binary::Copy_relocs): New typedef.
1411 (Sized_incremental_binary::copy_relocs_): New data member.
1412 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
1413 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
1414 * target.h (Sized_target::emit_copy_reloc): New function.
1415 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
1417 2011-06-02 Cary Coutant <ccoutant@google.com>
1420 * gold/archive.cc (Archive::Archive): Initialize new data member.
1421 (Archive::include_all_members): Return if archive has already been
1423 * gold/archive.h (Archive::include_all_members_): New data member.
1425 2011-06-02 Nick Clifton <nickc@redhat.com>
1427 * dynobj.h: Fix spelling mistake in comment.
1428 * output.cc: Likewise.
1430 2011-05-31 Doug Kwan <dougkwan@google.com>
1434 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
1435 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
1436 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
1437 redundant arm_exidx_test.so.
1438 * testsuite/Makefile.in: Regenerate.
1439 (check_SCRIPTS): Add pr12826.sh
1440 (check_DATA): Add pr12826.stdout
1441 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
1442 * testsuite/pr12826.sh: New file.
1443 * testsuite/pr12826_1.s: Ditto.
1444 * testsuite/pr12826_1.s: Ditto.
1446 2011-05-30 Ian Lance Taylor <iant@google.com>
1448 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
1451 2011-05-29 Ian Lance Taylor <iant@google.com>
1454 * testsuite/Makefile.am: Use different file name for two_file_test
1455 temporary file for each incremental test.
1456 * testsuite/Makefile.in: Rebuild.
1458 2011-05-29 Ian Lance Taylor <iant@google.com>
1460 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
1461 binary input file is empty.
1463 2011-05-27 Ian Lance Taylor <iant@google.com>
1465 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
1466 (ver_test_9.so): Likewise.
1467 * testsuite/Makefile.in: Rebuild.
1469 2011-05-26 Cary Coutant <ccoutant@google.com>
1471 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
1472 * incremental.cc (Incremental_inputs::report_input_section): Fix
1473 comment, indentation.
1474 (Incremental_inputs::report_comdat_group): New function.
1475 (Output_section_incremental_inputs::set_final_data_size): Adjust size
1476 of data for incremental input file entry.
1477 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
1478 group count, COMDAT group signatures.
1479 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
1480 an unchanged input file.
1481 * incremental.h (Incremental_object_entry::Incremental_object_entry):
1482 Initialize new data member.
1483 (Incremental_object_entry::add_comdat_group): New function.
1484 (Incremental_object_entry::get_comdat_group_count): New function.
1485 (Incremental_object_entry::get_comdat_signature_key): New function.
1486 (Incremental_object_entry::groups_): New data member.
1487 (Incremental_inputs::report_comdat_group): New function.
1488 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
1489 data for incremental input file entry.
1490 (Incremental_input_entry_reader::get_comdat_group_count): New function.
1491 (Incremental_input_entry_reader::get_input_section): Adjust size of
1492 data for incremental input file entry.
1493 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
1494 (Incremental_input_entry_reader::get_comdat_group_signature): New
1496 * object.cc (Sized_relobj::include_section_group): Report kept
1497 COMDAT groups for incremental links.
1499 2011-05-24 David Meyer <pdox@google.com>
1501 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
1502 with name parameter. Add found_name parameter.
1503 * fileread.cc (Input_file::find_file): Adjust code accordingly.
1504 * dirsearch.h (class Dirsearch): Update declaration.
1506 2011-05-24 Ian Lance Taylor <iant@google.com>
1508 * archive.cc (Library_base::should_include_member): Pull in object
1509 from archive if it defines the entry symbol.
1510 * parameters.cc (Parameters::entry): New function.
1511 * parameters.h (class Parameters): Declare entry.
1512 * output.h (class Output_file_header): Remove entry_ field.
1513 * output.cc (Output_file_header::Output_file_header): Remove entry
1514 parameter. Change all callers.
1515 (Output_file_header::entry): Use parameters->entry.
1516 * gold.cc (queue_middle_tasks): Likewise.
1517 * plugin.cc (Plugin_hook::run): Likewise.
1519 2011-05-24 Cary Coutant <ccoutant@google.com>
1521 * gold.cc (queue_initial_tasks): Pass incremental base filename
1522 to Output_file::open_base_file; don't print error message.
1523 * incremental-dump.cc (main): Adjust call to
1524 Output_file::open_for_modification.
1525 * incremental-dump.cc (main): Likewise.
1526 * incremental.cc (Incremental_inputs::report_command_line):
1527 Ignore --incremental-base option when comparing command lines.
1528 Ignore parameter when given as separate argument.
1529 * options.h (class General_options): Add --incremental-base.
1530 * output.cc (Output_file::Output_file):
1531 (Output_file::open_base_file): Add base_name and writable parameters;
1532 read base file into new file; print error message here.
1533 (Output_file::map_no_anonymous): Add writable parameter; adjust all
1535 * output.h (Output_file::open_for_modification): Rename to...
1536 (Output_file::open_base_file): ...this; add base_name and
1537 writable parameters; adjust all callers.
1538 (Output_file::map_no_anonymous): Add writable parameter; adjust all
1540 * testsuite/Makefile.am (incremental_test_4): Test
1542 * testsuite/Makefile.in: Regenerate.
1544 2011-05-24 Cary Coutant <ccoutant@google.com>
1546 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
1548 * testsuite/Makefile.in: Regenerate.
1549 * testsuite/two_file_test_1_v1.cc: New test source file.
1550 * testsuite/two_file_test_1b_v1.cc: New test source file.
1551 * testsuite/two_file_test_2_v1.cc: New test source file.
1553 2011-05-24 Cary Coutant <ccoutant@google.com>
1555 * dynobj.h (Dynobj::do_dynobj): New function.
1556 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
1557 flag and soname for shared objects.
1558 * incremental.cc (Incremental_inputs::report_object): Make
1559 either Incremental_object_entry or Incremental_dynobj_entry; add
1560 soname to string table.
1561 (Incremental_inputs::report_input_section): Add assertion.
1562 (Output_section_incremental_inputs::set_final_data_size): Adjust
1563 type of input file entry for shared libraries; adjust size of
1564 shared library info entry.
1565 (Output_section_incremental_inputs::write_input_files): Write
1566 as_needed flag for shared libraries.
1567 (Output_section_incremental_inputs::write_info_blocks): Adjust type
1568 of input file entry for shared libraries; write soname.
1569 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
1570 soname from incremental info.
1571 * incremental.h (enum Incremental_input_flags): Add
1572 INCREMENTAL_INPUT_AS_NEEDED.
1573 (Incremental_input_entry::Incremental_input_entry): Initialize new
1575 (Incremental_input_entry::set_as_needed): New function.
1576 (Incremental_input_entry::as_needed): New function.
1577 (Incremental_input_entry::do_dynobj_entry): New function.
1578 (Incremental_input_entry::as_needed_): New data member.
1579 (Incremental_object_entry::Incremental_object_entry): Don't check
1581 (Incremental_object_entry::do_type): Likewise.
1582 (class Incremental_dynobj_entry): New class.
1583 (Incremental_input_entry_reader::as_needed): New function.
1584 (Incremental_input_entry_reader::get_soname): New function.
1585 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
1586 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
1587 size of shared library info entry.
1588 * layout.cc (Layout::finish_dynamic_section): Don't test for
1589 incremental link when adding DT_NEEDED entries.
1590 * object.h (Object::Object): Initialize new data member.
1591 (Object::dynobj): New function.
1592 (Object::set_as_needed): New function.
1593 (Object::as_needed): New function.
1594 (Object::do_dynobj): New function.
1595 (Object::as_needed_): New data member.
1597 2011-05-24 Cary Coutant <ccoutant@google.com>
1599 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
1600 info; adjust display of GOT entries.
1601 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1602 vector of input objects; remove file_status_.
1603 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
1604 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
1605 got_plt reader; call target hooks to reserve GOT entries.
1606 (Output_section_incremental_inputs::set_final_data_size): Adjust size
1607 of input file info header and GOT info entry.
1608 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
1610 (Got_plt_view_info::got_descriptor): Remove.
1611 (Got_plt_view_info::sym_index): New data member.
1612 (Got_plt_view_info::input_index): New data member.
1613 (Local_got_offset_visitor::visit): Write input file index.
1614 (Global_got_offset_visitor::visit): Write 0 for input file index.
1615 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
1616 with sym_index and input_index.
1617 (Output_section_incremental_inputs::write_got_plt): Adjust size of
1618 incremental info GOT entry; replace got_descriptor with input_index.
1619 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
1620 map from input file index to object.
1621 (Sized_relobj_incr::do_layout): Replace direct data member reference
1622 with accessor function.
1623 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
1624 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
1625 Adjust size of input file info header.
1626 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
1627 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
1628 (Incremental_input_entry_reader::get_input_section): Adjust size of
1629 input file info header.
1630 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
1631 of incremental info GOT entry.
1632 (Incremental_got_plt_reader::get_got_desc): Remove.
1633 (Incremental_got_plt_reader::get_got_symndx): New function.
1634 (Incremental_got_plt_reader::get_got_input_index): New function.
1635 (Sized_incremental_binary::Sized_incremental_binary): Remove
1636 file_status_; add input_objects_.
1637 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
1638 (Sized_incremental_binary::set_file_is_unchanged): Remove.
1639 (Sized_incremental_binary::file_is_unchanged): Remove.
1640 (Sized_incremental_binary::set_input_object): New function.
1641 (Sized_incremental_binary::input_object): New function.
1642 (Sized_incremental_binary::file_status_): Remove.
1643 (Sized_incremental_binary::input_objects_): New data member.
1644 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
1646 (Sized_relobj_incr::invalid_address): Move to base class.
1647 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
1649 (Sized_relobj_incr::do_output_section_offset): Likewise.
1650 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
1651 (Sized_relobj_incr::section_offsets_): Likewise.
1652 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
1654 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
1655 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
1656 with accessor function.
1657 (Sized_relobj_file::do_layout): Likewise.
1658 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
1659 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
1660 (Sized_relobj_file::compute_final_local_value): Replace refs to
1661 section_offsets_ with accessor function.
1662 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
1663 * object.h (Relobj::Relobj): Initialize new data members.
1664 (Relobj::add_dyn_reloc): New function.
1665 (Relobj::first_dyn_reloc): New function.
1666 (Relobj::dyn_reloc_count): New function.
1667 (Relobj::first_dyn_reloc_): New data member.
1668 (Relobj::dyn_reloc_count_): New data member.
1669 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
1671 (Sized_relobj::Address): New typedef.
1672 (Sized_relobj::invalid_address): Move here from child class.
1673 (Sized_relobj::Sized_relobj): Initialize new data members.
1674 (Sized_relobj::sized_relobj): New function.
1675 (Sized_relobj::is_output_section_offset_invalid): Move here from
1677 (Sized_relobj::get_output_section_offset): Likewise.
1678 (Sized_relobj::local_has_got_offset): Likewise.
1679 (Sized_relobj::local_got_offset): Likewise.
1680 (Sized_relobj::set_local_got_offset): Likewise.
1681 (Sized_relobj::do_for_all_local_got_entries): Likewise.
1682 (Sized_relobj::clear_got_offsets): New function.
1683 (Sized_relobj::section_offsets): Move here from child class.
1684 (Sized_relobj::do_output_section_offset): Likewise.
1685 (Sized_relobj::do_set_section_offset): Likewise.
1686 (Sized_relobj::Local_got_offsets): Likewise.
1687 (Sized_relobj::local_got_offsets_): Likewise.
1688 (Sized_relobj::section_offsets_): Likewise.
1689 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
1691 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
1693 (Sized_relobj_file::sized_relobj): New function
1694 (Sized_relobj_file::local_has_got_offset): Move to base class.
1695 (Sized_relobj_file::local_got_offset): Likewise.
1696 (Sized_relobj_file::set_local_got_offset): Likewise.
1697 (Sized_relobj_file::get_output_section_offset): Likewise.
1698 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
1699 (Sized_relobj_file::do_output_section_offset): Likewise.
1700 (Sized_relobj_file::do_set_section_offset): Likewise.
1701 (Sized_relobj_file::Local_got_offsets): Likewise.
1702 (Sized_relobj_file::local_got_offsets_): Likewise.
1703 (Sized_relobj_file::section_offsets_): Likewise.
1704 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
1706 (set_needs_dynsym_index): Convert relobj to derived class pointer.
1707 (Output_reloc::get_symbol_index): Likewise.
1708 (Output_reloc::local_section_offset): Likewise.
1709 (Output_reloc::get_address): Likewise.
1710 (Output_reloc::symbol_value): Likewise.
1711 (Output_data_got::reserve_slot): Move to class definition.
1712 (Output_data_got::reserve_local): New function.
1713 (Output_data_got::reserve_slot_for_global): Remove.
1714 (Output_data_got::reserve_global): New function.
1715 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
1716 (all constructors, two instantiations).
1717 (Output_reloc::get_relobj): New function (two instantiations).
1718 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
1719 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
1720 (Output_data_reloc::add_global): Adjust type of relobj.
1721 (Output_data_reloc::add_global_relative): Likewise.
1722 (Output_data_reloc::add_symbolless_global_addend): Likewise.
1723 (Output_data_reloc::add_local): Likewise.
1724 (Output_data_reloc::add_local_relative): Likewise.
1725 (Output_data_reloc::add_symbolless_local_addend): Likewise.
1726 (Output_data_reloc::add_local_section): Likewise.
1727 (Output_data_reloc::add_output_section): Likewise.
1728 (Output_data_reloc::add_absolute): Likewise.
1729 (Output_data_reloc::add_target_specific): Likewise.
1730 (Output_data_got::reserve_slot): Move definition here.
1731 (Output_data_got::reserve_local): New function.
1732 (Output_data_got::reserve_global): New function.
1733 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
1734 section_offsets_ with accessor function.
1735 (Sized_relobj_file::write_sections): Likewise.
1736 (Sized_relobj_file::do_relocate_sections): Likewise.
1737 * target.h (Sized_target::reserve_local_got_entry): New function.
1738 (Sized_target::reserve_global_got_entry): New function.
1739 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
1740 (Target_x86_64::reserve_global_got_entry): New function.
1741 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
1743 2011-05-23 Cary Coutant <ccoutant@google.com>
1745 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
1746 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
1747 bit when checking got_type.
1748 * incremental.cc (Sized_incremental_binary::setup_readers):
1749 Store symbol table and string table locations; initialize bit vector
1750 of file status flags.
1751 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
1753 (Sized_incremental_binary::do_process_got_plt): New function.
1754 (Sized_incremental_binary::get_symtab_view): Use stored locations.
1755 (Output_section_incremental_inputs::set_final_data_size): Record
1756 file index for each input file.
1757 (Output_section_incremental_inputs::write_got_plt): Store file index
1758 instead of input entry offset for each GOT entry.
1760 (Incremental_input_entry::Incremental_input_entry): Initialize new
1762 (Incremental_input_entry::set_offset): Store file index.
1763 (Incremental_input_entry::get_file_index): New function.
1764 (Incremental_input_entry::file_index_): New data member.
1765 (Incremental_binary::process_got_plt): New function.
1766 (Incremental_binary::do_process_got_plt): New function.
1767 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1769 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
1770 (Sized_incremental_binary::set_file_is_unchanged): New function.
1771 (Sized_incremental_binary::file_is_unchanged): New function.
1772 (Sized_incremental_binary::do_process_got_plt): New function.
1773 (Sized_incremental_binary::file_status_): New data member.
1774 (Sized_incremental_binary::main_symtab_loc_): New data member.
1775 (Sized_incremental_binary::main_strtab_loc_): New data member.
1776 * output.cc (Output_data_got::Got_entry::write): Add case
1778 (Output_data_got::add_global): Call add_got_entry.
1779 (Output_data_got::add_global_plt): Likewise.
1780 (Output_data_got::add_global_with_rel): Likewise.
1781 (Output_data_got::add_global_with_rela): Likewise.
1782 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
1783 (Output_data_got::add_global_pair_with_rela): Likewise.
1784 (Output_data_got::add_local): Call add_got_entry.
1785 (Output_data_got::add_local_plt): Likewise.
1786 (Output_data_got::add_local_with_rel): Likewise.
1787 (Output_data_got::add_local_with_rela): Likewise.
1788 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
1789 (Output_data_got::add_local_pair_with_rela): Likewise.
1790 (Output_data_got::reserve_slot): New function.
1791 (Output_data_got::reserve_slot_for_global): New function.
1792 (Output_data_got::add_got_entry): New function.
1793 (Output_data_got::add_got_entry_pair): New function.
1794 (Output_section::add_output_section_data): Edit FIXME.
1796 (Output_section_data_build::Output_section_data_build): New
1797 constructor with size parameter.
1798 (Output_data_space::Output_data_space): Likewise.
1799 (Output_data_got::Output_data_got): Initialize new data member; new
1800 constructor with size parameter.
1801 (Output_data_got::add_constant): Call add_got_entry.
1802 (Output_data_got::reserve_slot): New function.
1803 (Output_data_got::reserve_slot_for_global): New function.
1804 (class Output_data_got::Got_entry): Add RESERVED_CODE.
1805 (Output_data_got::add_got_entry): New function.
1806 (Output_data_got::add_got_entry_pair): New function.
1807 (Output_data_got::free_list_): New data member.
1808 * target.h (Sized_target::init_got_plt_for_update): New function.
1809 (Sized_target::register_global_plt_entry): New function.
1810 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1811 Initialize new data member; call init; add constructor with PLT count.
1812 (Output_data_plt_x86_64::init): New function.
1813 (Output_data_plt_x86_64::add_relocation): New function.
1814 (Output_data_plt_x86_64::reserve_slot): New function.
1815 (Output_data_plt_x86_64::free_list_): New data member.
1816 (Target_x86_64::init_got_plt_for_update): New function.
1817 (Target_x86_64::register_global_plt_entry): New function.
1818 (Output_data_plt_x86_64::add_entry): Allocate from free list for
1819 incremental updates.
1820 (Output_data_plt_x86_64::add_relocation): New function.
1821 * testsuite/object_unittest.cc (Object_test): Set default options.
1823 2011-05-16 Ian Lance Taylor <iant@google.com>
1825 * options.h (class General_options): Make -i a synonym for -r.
1827 2011-05-16 Ian Lance Taylor <iant@google.com>
1829 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
1831 2011-05-10 Cary Coutant <ccoutant@google.com>
1833 * object.cc (Sized_relobj::do_count_local_symbols): Check for
1836 2011-05-06 Ian Lance Taylor <iant@google.com>
1838 * layout.cc (Layout::layout): If the output section flags change,
1839 update the ordering.
1841 2011-04-25 Cary Coutant <ccoutant@google.com>
1843 * incremental-dump.cc (dump_incremental_inputs): Print local
1844 symbol info for each input file.
1846 (Output_section_incremental_inputs::set_final_data_size): Add local
1847 symbol info to input file entries in incremental info.
1848 (Output_section_incremental_inputs::write_info_blocks): Likewise.
1849 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
1850 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
1851 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
1853 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
1854 (Sized_incr_relobj::do_relocate): Write the local symbols.
1855 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
1856 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
1857 Adjust size of input file header.
1858 (Incremental_inputs_reader::get_local_symbol_offset): New function.
1859 (Incremental_inputs_reader::get_local_symbol_count): New function.
1860 (Incremental_inputs_reader::get_input_section): Adjust size of input
1862 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
1863 (Sized_incr_relobj::This): New typedef.
1864 (Sized_incr_relobj::sym_size): New const data member.
1865 (Sized_incr_relobj::Local_symbol): New struct.
1866 (Sized_incr_relobj::do_output_local_symbol_count): New function.
1867 (Sized_incr_relobj::do_local_symbol_offset): New function.
1868 (Sized_incr_relobj::local_symbol_count_): New data member.
1869 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
1870 (Sized_incr_relobj::local_symbol_index_): New data member.
1871 (Sized_incr_relobj::local_symbol_offset_): New data member.
1872 (Sized_incr_relobj::local_dynsym_offset_): New data member.
1873 (Sized_incr_relobj::local_symbols_): New data member.
1874 * object.h (Relobj::output_local_symbol_count): New function.
1875 (Relobj::local_symbol_offset): New function.
1876 (Relobj::do_output_local_symbol_count): New function.
1877 (Relobj::do_local_symbol_offset): New function.
1878 (Sized_relobj::do_output_local_symbol_count): New function.
1879 (Sized_relobj::do_local_symbol_offset): New function.
1881 2011-04-22 Vladimir Simonov <sv@sw.ru>
1883 * descriptors.cc (set_close_on_exec): New function.
1884 (Descriptors::open): Use set_close_on_exec.
1885 * output.cc (S_ISLNK): Define if not defined.
1887 2011-04-22 Cary Coutant <ccoutant@google.com>
1889 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1891 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1892 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
1893 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
1895 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
1896 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
1897 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
1899 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
1901 (Incremental_binary::apply_incremental_relocs): New function.
1902 (Incremental_binary::do_apply_incremental_relocs): New function.
1903 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1905 (Sized_incremental_binary::add_global_symbol): New function.
1906 (Sized_incremental_binary::global_symbol): New function.
1907 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1908 (Sized_incremental_binary::symbol_map_): New data member.
1909 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
1910 * target.h (Sized_target::apply_relocation): New function.
1911 * target-reloc.h (apply_relocation): New function.
1912 * x86_64.cc (Target_x86_64::apply_relocation): New function.
1914 2011-04-22 Doug Kwan <dougkwan@google.com>
1916 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
1917 flag of a SHT_ARM_EXIDX section.
1918 * testsuite/Makefile.am (arm_exidx_test): New test rules.
1919 * testsuite/Makefile.in: Regenerate.
1920 * testsuite/arm_exidx_test.s: New file.
1921 * testsuite/arm_exidx_test.sh: Same.
1923 2011-04-20 Cary Coutant <ccoutant@google.com>
1926 * archive.h (Incremental_archive_entry::Archive_member):
1927 Initialize arg_serial_ (second constructor).
1929 2011-04-17 Ian Lance Taylor <iant@google.com>
1931 * object.cc (Relocate_info::location): Simplify location string.
1932 * errors.cc (Errors::error_at_location): Don't print program
1934 (Errors::warning_at_location): Likewise.
1935 (Errors::undefined_symbol): Likewise.
1936 * testsuite/debug_msg.sh: Update accordingly.
1938 2011-04-14 Cary Coutant <ccoutant@google.com>
1940 * gold/layout.cc (Layout::symtab_section_offset): New function.
1941 * gold/layout.h (Layout::symtab_section_offset): New function.
1942 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
1944 2011-04-12 Ian Lance Taylor <iant@google.com>
1946 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
1947 with MREMAP_MAYMOVE.
1948 * output.h (class Output_file): Add map_is_allocated_ field.
1949 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
1950 not available, provide stubs. If mremap is not available, #define
1952 (MREMAP_MAYMOVE): Define if not defined.
1953 (Output_file::Output_file): Initialize map_is_allocated_.
1954 (Output_file::resize): Check map_is_allocated_.
1955 (Output_file::map_anonymous): If mmap fails, use malloc.
1956 (Output_file::unmap): Don't do anything for an anonymous map.
1957 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
1958 is not available, provide stubs.
1959 (File_read::View::~View): Use free rather than delete[].
1960 (File_read::make_view): Use malloc rather than new[]. If mmap
1962 (File_read::find_or_make_view): Use malloc rather than new[].
1963 * gold.h: Remove HAVE_REMAP code.
1964 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
1965 exists. Rename mremap to gold_mremap. If mmap is not available
1967 * configure, config.in: Rebuild.
1969 2011-04-11 Ian Lance Taylor <iant@google.com>
1971 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
1972 initialize local variable v.
1974 2011-04-11 Cary Coutant <ccoutant@google.com>
1976 * archive.cc (Archive::include_member): Adjust call to
1978 (Add_archive_symbols::run): Track argument serial numbers.
1979 (Lib_group::include_member): Likewise.
1980 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
1981 * archive.h (Incremental_archive_entry::Archive_member):
1982 Initialize arg_serial_.
1983 (Archive_member::arg_serial_): New data member.
1984 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
1985 (Sized_dynobj::do_add_symbols): Track symbols when doing an
1987 (Sized_dynobj::do_for_all_local_got_entries): New function.
1988 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
1990 * fileread.cc (get_mtime): New function.
1991 * fileread.h (get_mtime): New function.
1992 * gold.cc (queue_initial_tasks): Check for incremental update.
1993 (process_incremental_input): New function.
1994 (queue_middle_tasks): Don't force valid target for incremental
1996 * incremental-dump.cc (find_input_containing_global): Adjust
1997 size of symbol info entry.
1998 (dump_incremental_inputs): Dump argument serial number and
1999 in_system_directory flag; bias shndx by 1; print symbol names
2000 when dumping per-file symbol lists; use new symbol info readers.
2002 (Output_section_incremental_inputs:update_data_size): New function.
2003 (Sized_incremental_binary::setup_readers): Setup input readers
2004 for each input file; build maps for files added from libraries
2006 (Sized_incremental_binary::check_input_args): New function.
2007 (Sized_incremental_binary::do_check_inputs): Build map of argument
2008 serial numbers to input arguments.
2009 (Sized_incremental_binary::do_file_has_changed): Rename
2010 do_file_is_unchanged to this; compare file modification times.
2011 (Sized_incremental_binary::do_init_layout): New function.
2012 (Sized_incremental_binary::do_reserve_layout): New function.
2013 (Sized_incremental_binary::do_get_input_reader): Remove.
2014 (Sized_incremental_binary::get_symtab_view): New function.
2015 (Incremental_checker::can_incrementally_link_output_file): Remove.
2016 (Incremental_inputs::report_command_line): Exclude --debug options.
2017 (Incremental_inputs::report_archive_begin): Add parameter; track
2018 argument serial numbers; don't put input file entry for archive
2019 before archive members.
2020 (Incremental_inputs::report_archive_end): Put input file entry
2021 for archive after archive members.
2022 (Incremental_inputs::report_object): Add parameter; track argument
2023 serial numbers and in_system_directory flag.
2024 (Incremental_inputs::report_script): Add parameter; track argument
2026 (Output_section_incremental_inputs::set_final_data_size): Adjust
2027 size of symbol info entry; check for forwarding symbols.
2028 (Output_section_incremental_inputs::write_input_files): Write
2029 in_system_directory flag and argument serial number.
2030 (Output_section_incremental_inputs::write_info_blocks): Map section
2031 indices between incremental info and original input file; store
2032 input section index for each symbol.
2033 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2034 change operator() to visit().
2035 (class Global_got_offset_visitor): Likewise.
2036 (class Global_symbol_visitor_got_plt):
2037 (Output_section_incremental_inputs::write_got_plt): Use new visitor
2039 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
2040 (Sized_incr_relobj::do_read_symbols): New function.
2041 (Sized_incr_relobj::do_layout): New function.
2042 (Sized_incr_relobj::do_layout_deferred_sections): New function.
2043 (Sized_incr_relobj::do_add_symbols): New function.
2044 (Sized_incr_relobj::do_should_include_member): New function.
2045 (Sized_incr_relobj::do_for_all_global_symbols): New function.
2046 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
2047 (Sized_incr_relobj::do_section_size): New function.
2048 (Sized_incr_relobj::do_section_name): New function.
2049 (Sized_incr_relobj::do_section_contents): New function.
2050 (Sized_incr_relobj::do_section_flags): New function.
2051 (Sized_incr_relobj::do_section_entsize): New function.
2052 (Sized_incr_relobj::do_section_address): New function.
2053 (Sized_incr_relobj::do_section_type): New function.
2054 (Sized_incr_relobj::do_section_link): New function.
2055 (Sized_incr_relobj::do_section_info): New function.
2056 (Sized_incr_relobj::do_section_addralign): New function.
2057 (Sized_incr_relobj::do_initialize_xindex): New function.
2058 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2059 (Sized_incr_relobj::do_read_relocs): New function.
2060 (Sized_incr_relobj::do_gc_process_relocs): New function.
2061 (Sized_incr_relobj::do_scan_relocs): New function.
2062 (Sized_incr_relobj::do_count_local_symbols): New function.
2063 (Sized_incr_relobj::do_finalize_local_symbols): New function.
2064 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2065 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2066 (Sized_incr_relobj::do_relocate): New function.
2067 (Sized_incr_relobj::do_set_section_offset): New function.
2068 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2069 (Sized_incr_dynobj::do_read_symbols): New function.
2070 (Sized_incr_dynobj::do_layout): New function.
2071 (Sized_incr_dynobj::do_add_symbols): New function.
2072 (Sized_incr_dynobj::do_should_include_member): New function.
2073 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
2074 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
2075 (Sized_incr_dynobj::do_section_size): New function.
2076 (Sized_incr_dynobj::do_section_name): New function.
2077 (Sized_incr_dynobj::do_section_contents): New function.
2078 (Sized_incr_dynobj::do_section_flags): New function.
2079 (Sized_incr_dynobj::do_section_entsize): New function.
2080 (Sized_incr_dynobj::do_section_address): New function.
2081 (Sized_incr_dynobj::do_section_type): New function.
2082 (Sized_incr_dynobj::do_section_link): New function.
2083 (Sized_incr_dynobj::do_section_info): New function.
2084 (Sized_incr_dynobj::do_section_addralign): New function.
2085 (Sized_incr_dynobj::do_initialize_xindex): New function.
2086 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
2087 (make_sized_incremental_object): New function.
2088 (Incremental_library::copy_unused_symbols): New function.
2089 (Incremental_library::do_for_all_unused_symbols): New function.
2090 * incremental.h (enum Incremental_input_flags): New type.
2091 (class Incremental_checker): Remove.
2092 (Incremental_input_entry::Incremental_input_entry): Add argument
2094 (Incremental_input_entry::arg_serial): New function.
2095 (Incremental_input_entry::set_is_in_system_directory): New function.
2096 (Incremental_input_entry::is_in_system_directory): New function.
2097 (Incremental_input_entry::arg_serial_): New data member.
2098 (Incremental_input_entry::is_in_system_directory_): New data member.
2099 (class Script_info): Move here from script.h.
2100 (Script_info::Script_info): Add filename parameter.
2101 (Script_info::filename): New function.
2102 (Script_info::filename_): New data member.
2103 (Incremental_script_entry::Incremental_script_entry): Add argument
2105 (Incremental_object_entry::Incremental_object_entry): Likewise.
2106 (Incremental_object_entry::add_input_section): Build list of input
2107 sections with map to original shndx.
2108 (Incremental_object_entry::get_input_section_index): New function.
2109 (Incremental_object_entry::shndx_): New data member.
2110 (Incremental_object_entry::name_key_): Rename; adjust all refs.
2111 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
2112 (Incremental_archive_entry::Incremental_archive_entry): Add argument
2114 (Incremental_inputs::report_archive_begin): Likewise.
2115 (Incremental_inputs::report_object): Likewise.
2116 (Incremental_inputs::report_script): Likewise.
2117 (class Incremental_global_symbol_reader): New class.
2118 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
2119 and store flags and input file type.
2120 (Incremental_input_entry_reader::arg_serial): New function.
2121 (Incremental_input_entry_reader::type): Extract type from flags.
2122 (Incremental_input_entry_reader::is_in_system_directory): New function.
2123 (Incremental_input_entry_reader::get_input_section_count): Call
2124 accessor function for type.
2125 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
2126 function for type; adjust size of global symbol entry.
2127 (Incremental_input_entry_reader::get_global_symbol_count): Call
2128 accessor function for type.
2129 (Incremental_input_entry_reader::get_object_count): Likewise.
2130 (Incremental_input_entry_reader::get_object_offset): Likewise.
2131 (Incremental_input_entry_reader::get_member_count): Likewise.
2132 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
2133 (Incremental_input_entry_reader::get_member_offset): Likewise.
2134 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
2135 (Incremental_input_entry_reader::Global_symbol_info): Remove.
2136 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
2137 (Incremental_input_entry_reader::get_global_symbol_reader): New
2139 (Incremental_input_entry_reader::get_output_symbol_index): New
2141 (Incremental_input_entry_reader::type_): Remove.
2142 (Incremental_input_entry_reader::flags_): New data member.
2143 (Incremental_inputs_reader::input_file_offset): New function.
2144 (Incremental_inputs_reader::input_file_index): New function.
2145 (Incremental_inputs_reader::input_file): Call input_file_offset.
2146 (Incremental_inputs_reader::input_file_at_offset): New function.
2147 (Incremental_relocs_reader::get_r_type): Reformat.
2148 (Incremental_relocs_reader::get_r_shndx): Reformat.
2149 (Incremental_relocs_reader::get_r_offset): Reformat.
2150 (Incremental_relocs_reader::data): New function.
2151 (Incremental_binary::Incremental_binary): Initialize new data members.
2152 (Incremental_binary::check_inputs): Add cmdline parameter.
2153 (Incremental_binary::file_is_unchanged): Remove.
2154 (Input_reader::arg_serial): New function.
2155 (Input_reader::get_unused_symbol_count): New function.
2156 (Input_reader::get_unused_symbol): New function.
2157 (Input_reader::do_arg_serial): New function.
2158 (Input_reader::do_get_unused_symbol_count): New function.
2159 (Input_reader::do_get_unused_symbol): New function.
2160 (Incremental_binary::input_file_count): New function.
2161 (Incremental_binary::get_input_reader): Change signature to use
2162 index instead of filename.
2163 (Incremental_binary::file_has_changed): New function.
2164 (Incremental_binary::get_input_argument): New function.
2165 (Incremental_binary::get_library): New function.
2166 (Incremental_binary::get_script_info): New function.
2167 (Incremental_binary::init_layout): New function.
2168 (Incremental_binary::reserve_layout): New function.
2169 (Incremental_binary::output_file): New function.
2170 (Incremental_binary::do_check_inputs): New function.
2171 (Incremental_binary::do_file_is_unchanged): Remove.
2172 (Incremental_binary::do_file_has_changed): New function.
2173 (Incremental_binary::do_init_layout): New function.
2174 (Incremental_binary::do_reserve_layout): New function.
2175 (Incremental_binary::do_input_file_count): New function.
2176 (Incremental_binary::do_get_input_reader): Change signature.
2177 (Incremental_binary::input_args_map_): New data member.
2178 (Incremental_binary::library_map_): New data member.
2179 (Incremental_binary::script_map_): New data member.
2180 (Sized_incremental_binary::Sized_incremental_binary): Initialize
2182 (Sized_incremental_binary::output_section): New function.
2183 (Sized_incremental_binary::inputs_reader): Add const.
2184 (Sized_incremental_binary::symtab_reader): Add const.
2185 (Sized_incremental_binary::relocs_reader): Add const.
2186 (Sized_incremental_binary::got_plt_reader): Add const.
2187 (Sized_incremental_binary::get_symtab_view): New function.
2188 (Sized_incremental_binary::Inputs_reader): New typedef.
2189 (Sized_incremental_binary::Input_entry_reader): New typedef.
2190 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
2191 (Sized_incremental_binary::do_file_is_unchanged): Remove.
2192 (Sized_incremental_binary::do_file_has_changed): New function.
2193 (Sized_incremental_binary::do_init_layout): New function.
2194 (Sized_incremental_binary::do_reserve_layout): New function.
2195 (Sized_input_reader::Inputs_reader): Remove.
2196 (Sized_input_reader::Input_entry_reader): Remove.
2197 (Sized_input_reader::do_arg_serial): New function.
2198 (Sized_input_reader::do_get_unused_symbol_count): New function.
2199 (Sized_input_reader::do_get_unused_symbol): New function.
2200 (Sized_incremental_binary::do_input_file_count): New function.
2201 (Sized_incremental_binary::do_get_input_reader): Change signature;
2202 use index instead of filename.
2203 (Sized_incremental_binary::section_map_): New data member.
2204 (Sized_incremental_binary::input_entry_readers_): New data member.
2205 (class Sized_incr_relobj): New class.
2206 (class Sized_incr_dynobj): New class.
2207 (make_sized_incremental_object): New function.
2208 (class Incremental_library): New class.
2209 * layout.cc (Free_list::num_lists): New static data member.
2210 (Free_list::num_nodes): New static data member.
2211 (Free_list::num_removes): New static data member.
2212 (Free_list::num_remove_visits): New static data member.
2213 (Free_list::num_allocates): New static data member.
2214 (Free_list::num_allocate_visits): New static data member.
2215 (Free_list::init): New function.
2216 (Free_list::remove): New function.
2217 (Free_list::allocate): New function.
2218 (Free_list::dump): New function.
2219 (Free_list::print_stats): New function.
2220 (Layout_task_runner::run): Resize output file for incremental updates.
2221 (Layout::Layout): Initialize new data members.
2222 (Layout::set_incremental_base): New function.
2223 (Layout::init_fixed_output_section): New function.
2224 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
2225 incremental updates.
2226 (Layout::create_gold_note): Do not create gold note section for
2227 incremental updates.
2228 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
2229 for incremental updates.
2230 (Layout::set_section_offsets): For incremental updates, allocate space
2232 (Layout::create_symtab_sections): Layout with offsets relative to
2233 start of section; for incremental updates, allocate space from free
2235 (Layout::create_shdrs): For incremental updates, allocate space from
2237 (Layout::finish_dynamic_section): For incremental updates, do not
2238 check --as-needed (fixed in subsequent patch).
2239 * layout.h (class Free_list): New class.
2240 (Layout::set_incremental_base): New function.
2241 (Layout::incremental_base): New function.
2242 (Layout::init_fixed_output_section): New function.
2243 (Layout::allocate): New function.
2244 (Layout::incremental_base_): New data member.
2245 (Layout::free_list_): New data member.
2246 * main.cc (main): Print Free_list statistics.
2247 * object.cc (Relobj::finalize_incremental_relocs): Add
2248 clear_counts parameter; clear counts only when clear_counts is set.
2249 (Sized_relobj::Sized_relobj): Initialize new base class.
2250 (Sized_relobj::do_layout): Don't report special sections.
2251 (Sized_relobj::do_for_all_local_got_entries): New function.
2252 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
2253 symtab_off to all symbol table offsets.
2254 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
2255 * object.h (class Got_offset_list): Move to top of file.
2256 (Object::Object): Allow case where input_file == NULL.
2257 (Object::~Object): Likewise.
2258 (Object::input_file): Assert that input_file != NULL.
2259 (Object::lock): Allow case where input_file == NULL.
2260 (Object::unlock): Likewise.
2261 (Object::is_locked): Likewise.
2262 (Object::token): Likewise.
2263 (Object::release): Likewise.
2264 (Object::is_incremental): New function.
2265 (Object::get_mtime): New function.
2266 (Object::for_all_local_got_entries): New function.
2267 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
2268 (Object::set_is_in_system_directory): New function.
2269 (Object::is_in_system_directory): New function.
2270 (Object::do_is_incremental): New function.
2271 (Object::do_get_mtime): New function.
2272 (Object::do_for_all_local_got_entries): New function.
2273 (Object::is_in_system_directory_): New data member.
2274 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
2275 (class Sized_relobj_base): New class.
2276 (class Sized_relobj): Derive from Sized_relobj_base.
2277 (class Sized_relobj::Symbols): Redeclare from base class.
2278 (class Sized_relobj::local_got_offset_list): Remove.
2279 (class Sized_relobj::Output_sections): Redeclare from base class.
2280 (class Sized_relobj::do_for_all_local_got_entries): New function.
2281 (class Sized_relobj::write_local_symbols): Add offset parameter.
2282 (class Sized_relobj::local_symbol_offset_): Update comment.
2283 (class Sized_relobj::local_dynsym_offset_): Update comment.
2284 * options.cc (Input_arguments::add_file): Remove const.
2285 * options.h (Input_file_argument::Input_file_argument):
2286 Initialize arg_serial_ (all constructors).
2287 (Input_file_argument::set_arg_serial): New function.
2288 (Input_file_argument::arg_serial): New function.
2289 (Input_file_argument::arg_serial_): New data member.
2290 (Input_arguments::Input_arguments): Initialize file_count_.
2291 (Input_arguments::add_file): Remove const.
2292 (Input_arguments::number_of_input_files): New function.
2293 (Input_arguments::file_count_): New data member.
2294 (Command_line::number_of_input_files): Call
2295 Input_arguments::number_of_input_files.
2296 * output.cc (Output_segment_headers::Output_segment_headers):
2298 (Output_section::Input_section::current_data_size): New function.
2299 (Output_section::Output_section): Initialize new data members.
2300 (Output_section::add_input_section): Don't do merge sections for
2301 an incremental link; allocate space from free list for an
2303 (Output_section::add_output_section_data): Allocate space from
2304 free list for an incremental update.
2305 (Output_section::update_data_size): New function.
2306 (Output_section::set_fixed_layout): New function.
2307 (Output_section::reserve): New function.
2308 (Output_segment::set_section_addresses): Remove const.
2309 (Output_segment::set_section_list_addresses): Remove const; allocate
2310 space from free list for an incremental update.
2311 (Output_segment::set_offset): Adjust size of RELRO segment for an
2313 * output.h (Output_data::current_data_size): Move here from
2315 (Output_data::pre_finalize_data_size): New function.
2316 (Output_data::update_data_size): New function.
2317 (Output_section_headers::update_data_size): new function.
2318 (Output_section_data_build::current_data_size): Move to Output_data.
2319 (Output_data_strtab::update_data_size): New function.
2320 (Output_section::current_data_size): Move to Output_data.
2321 (Output_section::set_fixed_layout): New function.
2322 (Output_section::has_fixed_layout): New function.
2323 (Output_section::reserve): New function.
2324 (Output_section::update_data_size): New function.
2325 (Output_section::has_fixed_layout_): New data member.
2326 (Output_section::free_list_): New data member.
2327 (Output_segment::set_section_addresses): Remove const.
2328 (Output_segment::set_section_list_addresses): Remove const.
2329 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
2331 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
2333 * readsyms.cc (Read_symbols::do_read_symbols): Add library
2334 parameter when calling Add_symbols constructor; store argument
2335 serial number for members of a lib group.
2336 (Add_symbols::locks): Allow case where token == NULL.
2337 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
2338 (Read_member::~Read_member): New function.
2339 (Read_member::is_runnable): New function.
2340 (Read_member::locks): New function.
2341 (Read_member::run): New function.
2342 (Check_script::~Check_script): New function.
2343 (Check_script::is_runnable): New function.
2344 (Check_script::locks): New function.
2345 (Check_script::run): New function.
2346 (Check_library::~Check_library): New function.
2347 (Check_library::is_runnable): New function.
2348 (Check_library::locks): New function.
2349 (Check_library::run): New function.
2350 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
2351 (Add_symbols::library_): New data member.
2352 (class Read_member): New class.
2353 (class Check_script): New class.
2354 (class Check_library): New class.
2355 * reloc.cc (Read_relocs::is_runnable): Allow case where
2357 (Read_relocs::locks): Likewise.
2358 (Scan_relocs::locks): Likewise.
2359 (Relocate_task::locks): Likewise.
2360 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
2362 (Sized_relobj::incremental_relocs_scan): Fix comment.
2363 (Sized_relobj::do_relocate): Pass output file offset to
2364 write_local_symbols.
2365 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
2366 from class declaration.
2367 * script.cc (read_input_script): Allocate Script_info; pass
2368 argument serial number to report_script.
2369 * script.h (class Script_info): Move to incremental.h.
2370 * symtab.cc (Symbol_table::add_from_incrobj): New function.
2371 * symtab.h (Symbol_table::add_from_incrobj): New function.
2372 (Symbol_table::set_file_offset): New function.
2374 2011-04-05 Cary Coutant <ccoutant@google.com>
2376 * incremental-dump.cc (dump_incremental_inputs): Change signature
2377 to take a Sized_incremental_binary; change caller. Use readers
2378 in Sized_incremental_binary.
2380 (Sized_incremental_binary::find_incremental_inputs_sections):
2381 Rename do_find_incremental_inputs_sections to this.
2382 (Sized_incremental_binary::setup_readers): New function.
2383 (Sized_incremental_binary::do_check_inputs): Check
2384 has_incremental_info_ flag; move setup code to setup_readers;
2386 (Sized_incremental_binary::do_file_is_unchanged): New function.
2387 (Sized_incremental_binary::do_get_input_reader): New function.
2388 * incremental.h (class Incremental_binary): Move to end of file.
2389 (Incremental_binary::file_is_unchanged): New function.
2390 (Incremental_binary::do_file_is_unchanged): New function.
2391 (Incremental_binary::Input_reader): New class.
2392 (Incremental_binary::get_input_reader): New function.
2393 (class Sized_incremental_binary): Move to end of file.
2394 (Sized_incremental_binary::Sized_incremental_binary): Setup the
2395 input section reader classes.
2396 (Sized_incremental_binary::has_incremental_info): New function.
2397 (Sized_incremental_binary::inputs_reader): New function.
2398 (Sized_incremental_binary::symtab_reader): New function.
2399 (Sized_incremental_binary::relocs_reader): New function.
2400 (Sized_incremental_binary::got_plt_reader): New function.
2401 (Sized_incremental_binary::do_file_is_unchanged): New function.
2402 (Sized_incremental_binary::Sized_input_reader): New class.
2403 (Sized_incremental_binary::get_input_reader): New function.
2404 (Sized_incremental_binary::find_incremental_inputs_sections):
2405 Rename do_find_incremental_inputs_sections to this.
2406 (Sized_incremental_binary::setup_readers): New function.
2407 (Sized_incremental_binary::has_incremental_info_): New data member.
2408 (Sized_incremental_binary::inputs_reader_): New data member.
2409 (Sized_incremental_binary::symtab_reader_): New data member.
2410 (Sized_incremental_binary::relocs_reader_): New data member.
2411 (Sized_incremental_binary::got_plt_reader_): New data member.
2412 (Sized_incremental_binary::current_input_file_): New data member.
2414 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
2417 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
2420 2011-03-30 Cary Coutant <ccoutant@google.com>
2422 * archive.cc (Archive::include_member): Adjust call to report_object.
2423 (Add_archive_symbols::run): Add script_info to call to
2424 report_archive_begin.
2425 (Lib_group::include_member): Adjust call to report_object.
2426 (Add_lib_group_symbols::run): Adjust call to report_object.
2427 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
2428 blocks. Add object count for script input files.
2429 * incremental.cc (Incremental_inputs::report_archive_begin): Add
2430 script_info parameter; change all callers.
2431 (Incremental_inputs::report_object): Add script_info parameter;
2433 (Incremental_inputs::report_script): Store backpointer to
2434 incremental info entry.
2435 (Output_section_incremental_inputs::set_final_data_size): Record
2436 additional information for scripts.
2437 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2438 * incremental.h (Incremental_script_entry::add_object): New function.
2439 (Incremental_script_entry::get_object_count): New function.
2440 (Incremental_script_entry::get_object): New function.
2441 (Incremental_script_entry::objects_): New data member; adjust
2443 (Incremental_inputs::report_archive_begin): Add script_info parameter.
2444 (Incremental_inputs::report_object): Add script_info parameter.
2445 (Incremental_inputs_reader::get_object_count): New function.
2446 (Incremental_inputs_reader::get_object_offset): New function.
2447 * options.cc (Input_arguments::add_file): Return reference to
2449 * options.h (Input_argument::set_script_info): New function.
2450 (Input_argument::script_info): New function.
2451 (Input_argument::script_info_): New data member; adjust all
2453 (Input_file_group::add_file): Return reference to new input argument.
2454 (Input_file_lib::add_file): Likewise.
2455 (Input_arguments::add_file): Likewise.
2456 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
2457 * script.cc (Parser_closure::Parser_closure): Add script_info
2458 parameter; adjust all callers.
2459 (Parser_closure::script_info): New function.
2460 (Parser_closure::script_info_): New data member.
2461 (read_input_script): Report scripts earlier to incremental info.
2462 (script_add_file): Set script_info in Input_argument.
2463 (script_add_library): Likewise.
2464 * script.h (Script_options::Script_info): Rewrite class.
2466 2011-03-29 Cary Coutant <ccoutant@google.com>
2468 * archive.cc (Library_base::should_include_member): Move
2469 method here from class Archive.
2470 (Archive::Archive): Initialize base class.
2471 (Archive::should_include_member): Move to base class.
2472 (Archive::do_for_all_unused_symbols): New function.
2473 (Add_archive_symbols::run): Remove redundant access to
2475 (Lib_group::Lib_group): Initialize base class.
2476 (Lib_group::do_filename): New function.
2477 (Lib_group::include_member): Pass pointer to Lib_group to
2479 (Lib_group::do_for_all_unused_symbols): New function.
2480 (Add_lib_group_symbols::run): Report archive information for
2482 * archive.h (class Library_base): New base class.
2483 (class Archive): Derive from Library_base.
2484 (Archive::filename): Move to base class.
2485 (Archive::set_incremental_info): Likewise.
2486 (Archive::incremental_info): Likewise.
2487 (Archive::Should_include): Likewise.
2488 (Archive::should_include_member): Likewise.
2489 (Archive::Armap_entry): Remove.
2490 (Archive::Unused_symbol_iterator): Remove.
2491 (Archive::unused_symbols_begin): Remove.
2492 (Archive::unused_symbols_end): Remove.
2493 (Archive::do_filename): New function.
2494 (Archive::do_get_mtime): New function.
2495 (Archive::do_for_all_unused_symbols): New function.
2496 (Archive::task_): Move to base class.
2497 (Archive::incremental_info_): Likewise.
2498 (class Lib_group): Derive from Library_base.
2499 (Lib_group::do_filename): New function.
2500 (Lib_group::do_get_mtime): New function.
2501 (Lib_group::do_for_all_unused_symbols): New function.
2502 (Lib_group::task_): Move to base class.
2503 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
2505 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
2507 * incremental.cc (Incremental_inputs::report_archive_begin):
2508 Use Library_base; call library's get_mtime; add incremental inputs
2509 entry before members.
2510 (class Unused_symbol_visitor): New class.
2511 (Incremental_inputs::report_archive_end): Use Library_base; use
2512 visitor class to record unused symbols; don't add incremental inputs
2513 entry after members.
2514 (Incremental_inputs::report_object): Use Library_base.
2516 (Incremental_archive_entry::Incremental_archive_entry): Remove
2517 unused Archive parameter.
2518 (Incremental_inputs::report_archive_begin): Use Library_base.
2519 (Incremental_inputs::report_archive_end): Likewise.
2520 (Incremental_inputs::report_object): Likewise.
2521 * object.cc (Sized_relobj::do_for_all_global_symbols): New
2523 * object.h (Object::for_all_global_symbols): New function.
2524 (Object::do_for_all_global_symbols): New function.
2525 (Sized_relobj::do_for_all_global_symbols): New function.
2526 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
2528 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
2531 2011-03-27 Ian Lance Taylor <iant@google.com>
2533 * archive.cc (Archive::interpret_header): Return -1 if something
2534 goes wrong. Change callers accordingly.
2536 2011-03-25 Cary Coutant <ccoutant@google.com>
2538 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
2539 * testsuite/Makefile.in: Regenerate.
2541 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
2543 * plugin.cc (get_view): New.
2544 (Plugin::load): Pass get_view to the plugin.
2545 (Plugin_manager::get_view): New.
2547 2011-03-21 Ian Lance Taylor <iant@google.com>
2549 * testsuite/final_layout.sh: Rewrite to not use dc.
2550 * testsuite/relro_test.sh: Fail if dc is not present.
2552 2011-03-21 Sriraman Tallam <tmsriram@google.com>
2554 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
2556 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
2557 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
2559 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
2560 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
2562 2011-03-14 Ian Lance Taylor <iant@google.com>
2564 * script-sections.cc (Sort_output_sections::script_compare):
2565 Rename from is_before, change return type.
2566 (Sort_output_sections::operator()): Adjust accordingly.
2568 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
2571 * testsuite/odr_violation2.cc: Add comment to make all error line
2572 numbers double digits.
2573 * testsuite/debug_msg.sh: Adjust expected errors.
2575 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
2577 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
2578 but mark earlier ones as non-canonical
2579 (offset_to_iterator): Update search target and example
2580 (do_addr2line): Return extra lines in a vector*
2581 (format_file_lineno): Extract from do_addr2line
2582 (one_addr2line): Add vector* out-param
2583 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
2584 when a lineno entry appeared last for its instruction
2585 (Dwarf_line_info): Add vector* out-param
2586 * object.cc (Relocate_info): Pass NULL for the vector* out-param
2587 * symtab.cc (Odr_violation_compare): Include the lineno in the
2589 (linenos_from_loc): New. Combine the canonical line for an
2590 address with its other lines.
2591 (True_if_intersect): New. Helper functor to make
2592 std::set_intersection a query.
2593 (detect_odr_violations): Compare sets of lines instead of just
2594 one line for each function. This became less deterministic, but
2595 has fewer false positives.
2596 * symtab.h: Declarations.
2597 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
2598 mix an optimized and non-optimized object in the same binary
2599 (odr_violation2.so): Same.
2600 * testsuite/Makefile.in: Regenerate from Makefile.am.
2601 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
2602 * testsuite/debug_msg.sh: Update line numbers and add
2604 * testsuite/odr_violation1.cc: Use OdrDerived, in a
2605 non-optimized context.
2606 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
2607 isn't inlined, and use OdrDerived in an optimized context.
2608 * testsuite/odr_header1.h: Defines OdrDerived, where
2609 optimization will change the
2610 first-instruction-in-the-destructor's file and line number.
2611 * testsuite/odr_header2.h: Defines OdrBase.
2613 2011-03-09 Ian Lance Taylor <iant@google.com>
2615 * fileread.cc (File_read::clear_views): Don't delete the whole
2618 2011-03-08 Ian Lance Taylor <iant@google.com>
2621 * fileread.cc: #include <climits>.
2622 (GOLD_IOV_MAX): Define.
2623 (File_read::read_multiple): Limit number of entries by iov_max.
2624 * fileread.h (class File_read): Always set max_readv_entries to
2627 2011-03-07 Ian Lance Taylor <iant@google.com>
2630 * options.h (class General_options): Add -dy and -dn.
2632 2011-03-02 Cary Coutant <ccoutant@google.com>
2634 * testsuite/script_test_9.t: Add TLS segment.
2636 2011-03-02 Simon Baldwin <simonb@google.com>
2638 * configure.ac: Add check for gnu_indirect_function support in
2639 the toolchain building binutils.
2640 * configure: Rebuild.
2642 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
2644 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
2645 plugin only symbols.
2646 (Symbol_table::sized_finalize_symbol) Mark symbol only present
2647 in plugin files as not needed in the symbol table.
2649 2011-02-11 Sriraman Tallam <tmsriram@google.com>
2651 * output.cc (Output_section::add_input_section): Delay fill
2652 generation for section ordering.
2654 2011-02-09 Ian Lance Taylor <iant@google.com>
2657 * object.h (class Sized_relobj): Remove clear_local_symbols.
2658 * reloc.cc (Sized_relobj::do_relocate): Don't call
2659 clear_local_symbols.
2661 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
2663 * plugin.cc (is_visible_from_outside): Return true for symbols
2666 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
2668 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
2671 2011-02-02 Sriraman Tallam <tmsriram@google.com>
2673 * icf.h (is_section_foldable_candidate): Change type of parameter
2675 * icf.cc (Icf::find_identical_sections): Change type of local variable
2676 section_name to be std::string.
2677 (is_function_ctor_or_dtor): Change type of parameter to std::string.
2679 2011-01-25 Ian Lance Taylor <iant@google.com>
2681 * script.cc (script_add_extern): Rewrite to use
2682 add_symbol_reference.
2684 2011-01-25 Doug Kwan <dougkwan@google.com>
2686 * icf.cc (get_section_contents): Always lock section's object.
2688 2011-01-24 Ian Lance Taylor <iant@google.com>
2690 * options.h (class General_options): Accept
2691 --no-detect-odr-violations.
2693 2011-01-24 Ian Lance Taylor <iant@google.com>
2695 * version.cc (version_string): Bump to 1.11.
2697 2011-01-24 Ian Lance Taylor <iant@google.com>
2699 * plugin.cc (class Plugin_rescan): Define new class.
2700 (Plugin_manager::claim_file): Set any_claimed_.
2701 (Plugin_manager::save_archive): New function.
2702 (Plugin_manager::save_input_group): New function.
2703 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
2705 (Plugin_manager::new_undefined_symbol): New function.
2706 (Plugin_manager::rescan): New function.
2707 (Plugin_manager::rescannable_defines): New function.
2708 (Plugin_manager::add_input_file): Set any_added_.
2709 * plugin.h (class Plugin_manager): define new fields rescannable_,
2710 undefined_symbols_, any_claimed_, and any_added_. Declare
2711 Plugin_rescan as friend. Declare new functions.
2712 (Plugin_manager::Rescannable): Define type.
2713 (Plugin_manager::Rescannable_list): Define type.
2714 (Plugin_manager::Undefined_symbol_list): Define type.
2715 (Plugin_manager::Plugin_manager): Initialize new fields.
2716 * archive.cc (Archive::defines_symbol): New function.
2717 (Add_archive_symbols::run): Pass archive to plugins if any.
2718 * archive.h (class Archive): Declare defines_symbol.
2719 * readsyms.cc (Input_group::~Input_group): New function.
2720 (Finish_group::run): Pass input_group to plugins if any.
2721 * readsyms.h (class Input_group): Declare destructor.
2722 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
2725 2011-01-10 Ian Lance Taylor <iant@google.com>
2727 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
2729 (Layout::set_segment_offsets): Reset increase_relro before calling
2730 set_section_addresses a second time.
2732 2011-01-04 Cary Coutant <ccoutant@google.com>
2734 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
2735 sections before NOBITS sections.
2737 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
2739 * version.cc (print_version): Update copyright to 2011.
2741 2010-12-23 Cary Coutant <ccoutant@google.com>
2743 * output.h (Output_data_reloc::add_output_section): Pass OD instead
2744 of OS to this->add. Add OD parameter to second form of the function.
2746 2010-12-20 Ian Lance Taylor <iant@google.com>
2748 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
2749 second of two consecutive entries with same offset.
2751 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2753 * testsuite/Makefile.am (ifuncmain2static_LDADD)
2754 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
2755 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
2756 to avoid unneeded links against $(LDADD).
2757 * testsuite/Makefile.in: Regenerate.
2759 2010-12-15 Ian Lance Taylor <iant@google.com>
2762 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
2763 for R_X86_64_32 and R_X86_64_PC32.
2764 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
2765 ver_matching_def_pic.o.
2766 (ver_matching_def_pic.o): New target.
2768 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2770 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
2771 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
2772 Move definition before File_read::View member definitions.
2773 (File_read::View::~View): Initialize and hold lock before
2774 updating current_mapped_bytes.
2776 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2778 * dwarf_reader.cc: Remove outdated comment.
2779 * gold-threads.cc: Fix typo in error message.
2780 * archive.cc: Fix typos in comments.
2781 * archive.h: Likewise.
2782 * arm-reloc-property.cc: Likewise.
2783 * arm-reloc-property.h: Likewise.
2784 * arm-reloc.def: Likewise.
2786 * attributes.h: Likewise.
2787 * cref.cc: Likewise.
2788 * ehframe.cc: Likewise.
2789 * fileread.h: Likewise.
2791 * i386.cc: Likewise.
2793 * incremental.h: Likewise.
2794 * int_encoding.cc: Likewise.
2795 * layout.h: Likewise.
2796 * main.cc: Likewise.
2797 * merge.h: Likewise.
2798 * object.cc: Likewise.
2799 * object.h: Likewise.
2800 * options.cc: Likewise.
2801 * readsyms.cc: Likewise.
2802 * reduced_debug_output.cc: Likewise.
2803 * reloc.cc: Likewise.
2804 * script-sections.cc: Likewise.
2805 * sparc.cc: Likewise.
2806 * symtab.h: Likewise.
2807 * target-reloc.h: Likewise.
2808 * target.cc: Likewise.
2809 * target.h: Likewise.
2810 * timer.cc: Likewise.
2811 * timer.h: Likewise.
2812 * x86_64.cc: Likewise.
2814 2010-12-09 Cary Coutant <ccoutant@google.com>
2816 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
2818 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
2819 parameter; change all callers.
2820 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
2821 * options.h (warn_execstack): New option.
2823 2010-12-07 Doug Kwan <dougkwan@google.com>
2825 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
2826 like function call relocations.
2828 2010-12-07 Ian Lance Taylor <iant@google.com>
2830 * archive.cc (Archive::get_elf_object_for_member): Permit
2831 punconfigured to be NULL.
2832 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
2833 (Archive::include_member): Pass NULL to get_elf_object_for_member
2834 if we searched for the archive and this is the first included
2837 2010-12-01 Ian Lance Taylor <iant@google.com>
2839 * dwarf_reader.h (class Sized_dwarf_line_info): Add
2840 track_relocs_type_ field.
2841 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2842 Set track_relocs_type_.
2843 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
2844 contents when using RELA relocs.
2845 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
2847 * reloc.cc (Track_relocs::next_addend): New function.
2848 * reloc.h (class Track_relocs): Declare next_addend.
2850 2010-12-01 Ian Lance Taylor <iant@google.com>
2852 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
2855 2010-12-01 Ian Lance Taylor <iant@google.com>
2857 * README: Update compilers known to work and fail.
2859 2010-11-23 Matthias Klose <doko@ubuntu.com>
2861 * configure.in: For --enable-gold, handle value `default' instead of
2862 `both*'. Always install ld as ld.bfd, install as ld if gold is
2864 * configure: Regenerate.
2866 2010-11-18 Doug Kwan <dougkwan@google.com>
2868 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
2869 and right_alignment to be zero. Store result alignment only if it is
2870 greater than existing alignment.
2872 2010-11-16 Cary Coutant <ccoutant@google.com>
2875 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2876 Check for ".zdebug_line".
2878 2010-11-16 Doug Kwan <dougkwan@google.com>
2879 Cary Coutant <ccoutant@google.com>
2881 * output.h (Output_segment::set_section_addresses): Pass increase_relro
2882 by reference; adjust all callers.
2883 * output.cc (Output_segment::set_section_addresses): Adjust references
2884 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
2886 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
2887 end at page boundary.
2889 2010-11-16 Cary Coutant <ccoutant@google.com>
2892 * layout.cc (Layout::choose_output_section): Transform names of
2893 compressed sections even when using a script with a SECTIONS clause.
2894 (Layout::output_section_name): Remove code to transform
2895 compressed debug section names.
2896 * output.cc (Output_section::add_input_section): Use uncompressed
2897 section size when tracking input sections.
2899 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
2901 * symtab.h (Symbol::NON_PIC_REF): Remove.
2902 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
2903 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
2904 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
2905 (Symbol::use_plt_offset): Take a flags argument and pass it
2906 directly to needs_dynamic_reloc. Restrict check for undefined
2907 weak symbols to function calls.
2908 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
2909 (Target_arm::Scan::global): Use it.
2910 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
2911 (Target_arm::Relocate::relocate): Likewise.
2912 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
2913 parameter with an r_type parameter. Use get_reference_flags
2915 (Target_arm::Relocate::relocate): Update accordingly.
2916 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
2917 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
2918 (Target_i386::Scan::global): Likewise.
2919 (Target_i386::Relocate::relocate): Likewise.
2920 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
2921 parameter with an r_type parameter. Use get_reference_flags
2923 (Target_i386::Relocate::relocate): Update accordingly.
2924 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
2925 (Target_powerpc::Scan::global): Use it.
2926 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
2927 (Target_powerpc::Relocate::relocate): Likewise.
2928 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
2929 (Target_sparc::Scan::global): Use it.
2930 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
2931 (Target_sparc::Relocate::relocate): Likewise.
2932 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
2933 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
2934 (Target_x86_64::Scan::global): Likewise.
2935 (Target_x86_64::Relocate::relocate): Likewise.
2937 2010-11-08 Doug Kwan <dougkwan@google.com>
2938 Cary Coutant <ccoutant@google.com>
2940 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
2941 (Arm_exidx_merge_section::section_contents_): New data member.
2942 (Arm_input_section::Arm_input_section): Initialize original_contents_.
2943 (Arm_input_section::~Arm_input_section): De-allocate memory.
2944 (Arm_input_section::original_contents_): New data member.
2945 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
2946 in parameters instead of calling Object::section_contents without
2948 (Arm_output_section::group_section): New parameter TASK. Pass it
2949 to callees that need locking objects.
2950 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
2951 to lock EXIDX input sections. Fix a formatting issue. Call
2952 Arm_exidx_merged_section::build_contents to create merged section
2954 (Arm_output_section::create_stub_group): New parameter TASK. Use it
2955 to lock object of stub table owner.
2956 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
2957 TEXT_SIZE to initialize data member TEXT_SIZE_.
2958 (Arm_exidx_input_section::addralign): Fix typo in comment.
2959 (Arm_exidx_input_section::text_size): New method.
2960 (Target_arm::do_relax): New parameter TASK. Pass it to callees
2961 that require locking objects. Lock objects before scanning for stubs
2962 and updating local symbols.
2963 (Arm_input_section<big_endian>::init): Copy contents of original
2965 (Arm_input_section<big_endian>::do_write): Use saved contents of
2966 original input section instead of calling Object::section_contents
2968 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
2969 size without calling Object::section_size().
2970 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
2971 for size. Allocate a buffer for merged EXIDX entries.
2972 (Arm_exidx_merged_section::build_contents): New method.
2973 (Arm_exidx_merged_section::do_write): Move merge section contents
2974 building code to Arm_exidx_merged_section::build_contetns. Write
2975 out contetns in buffer instead of building it on the fly.
2976 (Arm_relobj::make_exidx_input_section): Also pass text section size
2977 to Arm_exidx_input_section constructor.
2978 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
2979 (Arm_dynobj::do_read_symbols): Fix memory leak.
2980 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
2981 * target.h: (class Task): Add forward declaration.
2982 (Target::relax): Add new parameter TASK and pass it to
2984 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
2986 2010-11-05 Cary Coutant <ccoutant@google.com>
2989 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
2990 object when reading from the file.
2991 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
2993 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
2994 when reading section contents.
2995 (get_section_contents): Likewise.
2996 (icf::find_identical_sections): Likewise.
2997 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
2998 object when reading from the file.
2999 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
3000 the object when doing deferred section layout.
3002 2010-11-03 Nick Clifton <nickc@redhat.com>
3005 * script.h (class Symbol_assignment: name): New member. Returns
3006 the name of the symbol.
3007 * scrfipt.cc (Script_options::is_pending_assignment): New member.
3008 Returns true if the given symbol name is on the list of
3009 assignments wating to be processed.
3010 * archive.cc (should_incldue_member): If the symbol is undefined,
3011 check to see if it is on the list of symbols pending assignment.
3013 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
3015 * script-sections.cc (Script_sections::find_memory_region): Check
3016 for a NULL output section pointer.
3018 2010-10-29 Doug Kwan <dougkwan@google.com>
3020 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3021 Output_section::add_relaxed_input_section.
3022 * output.cc (Output_section::add_relaxed_input_section): Add new
3023 arguments LAYOUT and NAME. Set section order index.
3024 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3025 Copy section order index.
3026 * output.h (Output_section::add_relaxed_input_section): Add new
3027 arguments LAYOUT and NAME.
3029 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3031 * testsuite/Makefile.am: Move gcctestdir/ld rule to
3032 NATIVE_OR_CROSS_LINKER.
3033 * testsuite/Makefile.in: Regenerate.
3035 2010-10-20 Doug Kwan <dougkwan@google.com>
3037 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
3038 without SHF_LINK_ORDER flags.
3039 * layout.cc (Layout::choose_output_section): Do not filter
3040 SHF_LINK_ORDER flag in a relocatable link.
3042 2010-10-17 Cary Coutant <ccoutant@google.com>
3044 * output.h (Output_segment::set_section_addresses): Change function
3045 signature. Update all callers.
3046 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
3048 (Output_segment::set_section_addresses): Align after last TLS
3049 section. Add padding before last relro section instead of after.
3051 2010-10-17 Doug Kwan <dougkwan@google.com>
3053 * gold/arm.cc (Target_arm::got_section): Use correct order and set
3054 GOT output section to be writable.
3056 2010-10-14 Cary Coutant <ccoutant@google.com>
3058 * debug.h (DEBUG_INCREMENTAL): New flag.
3059 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3060 * gold.cc (queue_initial_tasks): Check parameters for incremental link
3062 * incremental.cc (report_command_line): Ignore all forms of
3064 * layout.cc (Layout::Layout): Check parameters for incremental link
3066 * options.cc (General_options::parse_incremental): New function.
3067 (General_options::parse_no_incremental): New function.
3068 (General_options::parse_incremental_full): New function.
3069 (General_options::parse_incremental_update): New function.
3070 (General_options::incremental_mode_): New data member.
3071 (General_options::finalize): Check incremental_mode_.
3072 * options.h (General_options): Update help text for --incremental.
3073 Add --no-incremental, --incremental-full, --incremental-update.
3074 (General_options::Incremental_mode): New enum type.
3075 (General_options::incremental_mode): New function.
3076 (General_options::incremental_mode_): New data member.
3077 * parameters.cc (Parameters::incremental_mode_): New data member.
3078 (Parameters::set_options): Set incremental_mode_.
3079 (Parameters::set_incremental_full): New function.
3080 (Parameters::incremental): New function.
3081 (Parameters::incremental_update): New function.
3082 (set_parameters_incremental_full): New function.
3083 * parameters.h (Parameters::set_incremental_full): New function.
3084 (Parameters::incremental): New function.
3085 (Parameters::incremental_update): New function.
3086 (Parameters::incremental_mode_): New data member.
3087 (set_parameters_incremental_full): New function.
3088 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
3089 incremental link mode.
3090 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
3091 (Sized_relobj::do_relocate_sections): Likewise.
3092 * testsuite/Makefile.am (incremental_test): Use --incremental-full
3094 * testsuite/Makefile.in: Regenerate.
3095 * testsuite/incremental_test.sh: Filter all forms of --incremental.
3097 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3099 * script-sections.h (class Script_sections): Make
3100 Sections_elements typedef public.
3101 * script-sections.cc (class Sort_output_sections): Add elements_
3102 field. Add constructor which sets it; change all callers.
3103 (Sort_output_sections::is_before): New function.
3104 (Sort_output_sections::operator()): Call is_before.
3105 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
3107 * testsuite/script_test_10.sh: New test. Test script section
3109 * testsuite/script_test_10.t: Likewise.
3110 * testsuite/script_test_10.s: Likewise.
3111 * testsuite/Makefile.am: Wrap the cross linker tests and the
3112 common tests into NATIVE_OR_CROSS_LINKER.
3113 (check_SCRIPTS): Add script_test_10.sh.
3114 (check_DATA): Add script_test_10.stdout.
3115 (script_test_10.o, script_test_10): New targets.
3116 (script_test_10.stdout): New target.
3117 * configure, testsuite/Makefile.in: Regenerate.
3119 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3121 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
3122 error for the deprecated relocations.
3123 (Target_arm::Scan::global): Likewise.
3124 (Target_arm::Relocate::relocate): Likewise.
3126 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
3128 * fileread.cc (Input_file::find_file): Initialize *found_name
3129 and *namep when using the fallback search for case 4.
3131 2010-10-11 Cary Coutant <ccoutant@google.com>
3133 * options.h (class General_options): Redefine -z lazy as an alias for
3134 the negation of -z now.
3136 2010-10-11 Ian Lance Taylor <iant@google.com>
3138 * resolve.cc (symbol_to_bits): Report the value of the unsupported
3141 2010-10-06 Nick Clifton <nickc@redhat.com>
3143 * script-sections.cc(class Memory_region): Remove
3144 current_lma_offset_ field. Rename current_vma_offset_ to
3145 current_offset_. Add last_section_ field.
3146 (Memory_region::get_current_vma_address): Rename to
3147 get_current_address.
3148 (Memory_region::get_current_lma_address): Delete.
3149 (Memory_region::increment_vma_offset): Rename to
3151 (Memory_region::increment_lma_offset): Delete.
3152 (Memory_region::attributes_compatible): New method. Returns
3153 true if the provided section is compatible with the region.
3154 (Memory_region::get_last_section): New method. Returns the last
3155 section to use the region.
3156 (Memory_region::set_last_section): New method. Stores the last
3157 section to use the region.
3158 (Script_sections::block_in_region): New method. Returns true if
3159 a block of memory is contained within a region.
3160 (Script_sections::find_memory_region): New method. Locates a
3161 memory region to be used to set a VMA or LMA address.
3162 (Output_section_definition::set_section_addresses): Add code to
3163 check for addresses set by memory regions.
3164 (Output_segment::set_section_addresses): Remove memory region
3166 (Script_sections::create_segment): Add a warning if a header
3167 segment is created outside of any region.
3168 * script-sections.h (class Script_sections): Add prototypes for
3169 find_memory_region and block_in_region methods.
3170 * testsuite/memory_test.s: Use .long instead of .word.
3171 * testsuite/memory_test.t: Add some more output sections.
3172 * testsuite/memory_test.sh: Update expected output.
3174 2010-10-02 Doug Kwan <dougkwan@google.com>
3176 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
3177 defintion to symtab.h
3178 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
3179 declaration to defintion.
3181 2010-10-01 Nick Clifton <nickc@redhat.com>
3183 * expression.cc (eval): Replace dummy argument with NULL.
3184 (eval_maybe_dot): Check for a NULL result section pointer.
3185 (Symbol_expression::value): Likewise.
3186 (Dot_expression::value): Likewise.
3187 (BINARY_EXPRESSION): Likewise.
3188 (Max_expression::value): Likewise.
3189 (Min_expression::value): Likewise.
3190 (Absolute_expression::value): Likewise.
3191 (Addr_expression::value_from_output_section): Likewise.
3192 (Loaddddr_expression::value_from_output_section): Likewise.
3193 (Segment_start_expression::value): Likewise.
3194 * script-sections.cc
3195 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
3197 (Sections_elememt_dot_assignment::set_section_addresses):
3199 (Output_data_expression::do_write_to_buffer): Likewise.
3200 (Output_section_definition::finalize_symbols): Likewise.
3201 (Output_section_definition::set_section_addresses): Likewise.
3203 2010-09-30 Doug Kwan <dougkwan@google.com>
3205 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
3207 2010-09-28 Sriraman Tallam <tmsriram@google.com>
3209 * target.h (Target::can_icf_inline_merge_sections): New virtual
3211 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
3213 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
3215 * icf.cc (get_section_contents): Inline merge sections only when
3218 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3220 * configure: Regenerate.
3222 2010-09-17 Ian Lance Taylor <iant@google.com>
3224 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
3225 * testsuite/Makefile.am (memory_test.o): New target.
3226 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
3228 * testsuite/Makefile.in: Rebuild.
3230 2010-09-17 Doug Kwan <dougkwan@google.com>
3232 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
3233 defintion if relocation uses GOT entries of the symbol.
3234 * testsuite/icf_safe_test.sh: Fix test.
3235 * testsuite/icf_safe_so_test.sh: Fix test.
3237 2010-09-16 Cary Coutant <ccoutant@google.com>
3239 * script_sections.cc (class Memory_region): Remove "NULL" from
3240 vector initializations.
3242 2010-09-15 Cary Coutant <ccoutant@google.com>
3244 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
3245 Resolve forwarding symbols.
3247 2010-09-15 Doug Kwan <dougkwan@google.com>
3249 * gold/testsuite/script_test_3.t: Add ARM special sections.
3250 * gold/testsuite/script_test_4.t: Same.
3251 * gold/testsuite/script_test_5.t: Same.
3252 * gold/testsuite/script_test_6.t: Same.
3253 * gold/testsuite/script_test_7.t: Same.
3254 * gold/testsuite/script_test_7.t: Same.
3255 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
3257 2010-09-14 Cary Coutant <ccoutant@google.com>
3259 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
3260 (Target_x86_64::Relocate::relocate_tls): Replace check for
3261 saw_tls_block_reloc_ with test for executable section.
3263 2010-09-12 Cary Coutant <ccoutant@google.com>
3265 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
3266 position-independent executables to shared libraries need dynamic
3268 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
3269 position-independent executables.
3270 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
3271 * testsuite/Makefile.in: Regenerate.
3273 2010-09-10 Nick Clifton <nickc@redhat.com>
3276 * testsuite/memory_test.t: Discard any sections that are not
3279 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
3282 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
3283 "This::" to work around a bug in gcc 4.2.
3285 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
3287 2010-09-09 Rafael Espindola <espindola@google.com>
3289 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
3290 sections with different PF_X flags in the same segment.
3291 (Layout::find_first_load_seg): Search all segments to find the first
3293 * options.h (rosegment): New.
3295 2010-09-08 Rafael Espindola <espindola@google.com>
3297 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
3299 2010-09-08 Doug Kwan <dougkwan@google.com>
3301 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
3302 (Arm_relobj::do_relocate_sections): Add new parameter for output
3303 file to match the parent.
3304 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
3305 of local symbols instead of input values. Update code to track
3306 changes in gold::relocate_section.
3307 * object.cc (Sized_relobj::compute_final_local_value): New methods.
3308 (Sized_relobj::compute_final_local_value_internal): New methods.
3309 (Sized_relobj::do_finalize_local_symbols): Move code from loop
3310 body into private version of Sized_relobj::compute_final_local_value.
3311 Call the inline method.
3312 * object.h (Symbol_value::Symbol_value): Define destructor. Free
3313 merged symbol value if there is one.
3314 (Symbol_value::has_output_value): New method defintiion.
3315 (Sized_relobj::Compute_final_local_value_status): New enum type.
3316 (Sized_relobj::compute_final_local_value): New methods.
3317 (Sized_relobj::compute_final_local_value_internal): New methods.
3318 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
3319 and arm_cortex_a8.sh.
3320 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
3321 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
3323 * Makefile.in: Regenerate.
3324 * testsuite/arm_bl_out_of_range.s: Update test.
3325 * testsuite/thumb_bl_out_of_range.s: Ditto.
3326 * testsuite/thumb_blx_out_of_range.s: Ditto.
3327 * testsuite/arm_branch_out_of_range.sh: New file.
3328 * testsuite/arm_cortex_a8.sh: Ditto.
3329 * testsuite/arm_cortex_a8_b.s: Ditto.
3330 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
3331 * testsuite/arm_cortex_a8_b_local.s: Ditto.
3332 * testsuite/arm_cortex_a8_bl.s: Ditto.
3333 * testsuite/arm_cortex_a8_blx.s: Ditto.
3334 * testsuite/arm_cortex_a8_local.s: Ditto.
3335 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
3336 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
3338 2010-09-08 Rafael Espindola <espindola@google.com>
3340 * Makefile.am (memory_test.stdout): Run readelf with -W.
3341 * Makefile.in: Regenerate.
3342 * testsuite/memory_test.sh: Make the regexps accept both 32 and
3345 2010-09-08 Rafael Espindola <espindola@google.com>
3347 * script-sections.cc (Script_sections::add_memory_region): Convert
3348 field precision to int.
3349 * script.cc (script_set_section_region, script_set_section_region):
3350 Convert field precision to int.
3352 2010-09-08 Rafael Espindola <espindola@google.com>
3354 * arm.cc (do_finalize_sections): Create the __exidx_start and
3355 __exdix_end symbols even when the section is missing.
3357 2010-09-08 Nick Clifton <nickc@redhat.com>
3359 * README: Remove claim that MEMORY is not supported.
3360 * expression.cc (script_exp_function_origin)
3361 (script_exp_function_length): Move from here to ...
3362 * script.cc: ... here.
3363 (script_set_section_region, script_add_memory)
3364 (script_parse_memory_attr, script_include_directive): New
3366 * script-sections.cc
3367 (class Memory_region): New class.
3368 (class Output_section_definition): Add set_memory_region,
3369 set_section_vma, set_section_lma and get_section_name methods.
3370 (class Script_Sections): Add add_memory_region,
3371 find_memory_region, find_memory_region_origin,
3372 find_memory_region_length and set_memory_region methods.
3373 Have set_section_addresses method walk the list of set memory
3375 Extend the print methos to display memory regions.
3376 * script-sections.h: Add prototypes for new methods.
3377 Add enum for MEMORY region attributes.
3378 * yyscript.y: Add support for parsing MEMORY regions.
3379 * script-c.h: Add prototypes for new functions.
3380 * testsuite/Makefile.am: Add test of MEMORY region functionality.
3381 * testsuite/Makefile.in: Regenerate.
3382 * testsuite/memory_test.sh: New script.
3383 * testsuite/memory_test.s: New assembler source file.
3384 * testsuite/memory_test.t: New linker script.
3386 2010-08-27 Doug Kwan <dougkwan@google.com>
3388 * gold/resolve.cc (Symbol_table::should_override): Let a weak
3389 reference override an existing dynamic weak reference.
3390 * testsuite/Makefile.am: Add new test dyn_weak_ref.
3391 * testsuite/Makefile.in: Regenerate.
3392 * testsuite/dyn_weak_ref.sh: New file.
3393 * testsuite/dyn_weak_ref_1.c: Ditto.
3394 * testsuite/dyn_weak_ref_2.c: Ditto.
3396 2010-08-27 Ian Lance Taylor <iant@google.com>
3398 * incremental.h (class Incremental_input_entry): Add virtual
3401 2010-08-27 Ian Lance Taylor <iant@google.com>
3403 * testsuite/start_lib_test_3.c: Mark t3 as used.
3405 2010-08-27 Nick Clifton <nickc@redhat.com>
3407 * options.cc (version_script): Fix small typo in previous
3410 2010-08-25 Nick Clifton <nickc@redhat.com>
3412 * archive.cc: Formatting fixes: Remove whitespace between
3413 typename and following asterisk. Remove whitespace between
3414 function name and opening parenthesis.
3415 * archive.h: Likewise.
3417 * attributes.cc: Likewise.
3418 * attributes.h: Likewise.
3419 * common.cc: Likewise.
3420 * copy-relocs.cc: Likewise.
3421 * dirsearch.h: Likewise.
3422 * dynobj.cc: Likewise.
3423 * ehframe.cc: Likewise.
3424 * ehframe.h: Likewise.
3425 * expression.cc: Likewise.
3426 * fileread.cc: Likewise.
3427 * fileread.h: Likewise.
3429 * gold-threads.cc: Likewise.
3430 * gold.cc: Likewise.
3431 * i386.cc: Likewise.
3433 * incremental-dump.cc: Likewise.
3434 * incremental.cc: Likewise.
3435 * layout.cc: Likewise.
3436 * layout.h: Likewise.
3437 * main.cc: Likewise.
3438 * merge.cc: Likewise.
3439 * merge.h: Likewise.
3440 * object.cc: Likewise.
3441 * object.h: Likewise.
3442 * options.cc: Likewise.
3443 * options.h: Likewise.
3444 * output.cc: Likewise.
3445 * output.h: Likewise.
3446 * plugin.cc: Likewise.
3447 * plugin.h: Likewise.
3448 * powerpc.cc: Likewise.
3449 * reloc.cc: Likewise.
3450 * script-c.h: Likewise.
3451 * script-sections.cc: Likewise.
3452 * script.cc: Likewise.
3453 * stringpool.cc: Likewise.
3454 * symtab.cc: Likewise.
3455 * symtab.h: Likewise.
3456 * target.cc: Likewise.
3457 * timer.cc: Likewise.
3458 * timer.h: Likewise.
3459 * version.cc: Likewise.
3460 * x86_64.cc: Likewise.
3462 2010-08-24 Nick Clifton <nickc@redhat.com>
3465 * layout.cc (segment_precedes): Sort segments by their physical
3466 addresses, if they have been set.
3468 2010-08-23 Cary Coutant <ccoutant@google.com>
3470 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
3472 (Lib_group::include_member): Unlock object after deleting its
3474 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
3477 2010-08-19 Neil Vachharajani <nvachhar@google.com>
3478 Cary Coutant <ccoutant@google.com>
3480 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
3481 constructor, and set_blocker.
3482 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
3484 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
3485 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
3486 * testsuite/Makefile.am (start_lib_test): New test case.
3487 * testsuite/Makefile.in: Regenerate.
3488 * testsuite/start_lib_test_main.c: New file.
3489 * testsuite/start_lib_test_1.c: New file.
3490 * testsuite/start_lib_test_2.c: New file.
3491 * testsuite/start_lib_test_3.c: New file.
3493 2010-08-19 Ian Lance Taylor <iant@google.com>
3495 * Makefile.in: Rebuild with automake 1.11.1.
3496 * aclocal.m4: Likewise.
3497 * testsuite/Makefile.in: Likewise.
3499 2010-08-19 Ian Lance Taylor <iant@google.com>
3502 * i386.cc (class Output_data_plt_i386): Update declarations.
3503 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
3504 local_ifuncs_ fields.
3505 (Target_i386::do_plt_section_for_global): New function.
3506 (Target_i386::do_plt_section_for_local): New function.
3507 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
3508 parameter; change all callers. Initialize global_ifuncs_ and
3509 local_ifuncs_. If doing a static link define __rel_iplt_start and
3511 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
3512 (Output_data_plt_i386::add_local_ifunc_entry): New function.
3513 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
3515 (Target_i386::make_plt_section): New function, broken out of
3516 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
3517 (Target_i386::make_plt_entry): Call make_plt_section.
3518 (Target_i386::make_local_ifunc_plt_entry): New function.
3519 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
3520 (Target_i386::Scan::local): Handle IFUNC symbols. Add
3521 R_386_IRELATIVE to switch.
3522 (Target_i386::Scan::global): Likewise.
3523 (Target_i386::Relocate::relocate): Likewise.
3524 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
3526 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
3527 (Target_x86_64::do_plt_section_for_global): New function.
3528 (Target_x86_64::do_plt_section_for_local): New function.
3529 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
3530 parameter; change all callers. If doing a static link define
3531 __rela_iplt_start and __rela_iplt_end.
3532 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
3533 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
3534 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
3536 (Target_x86_64::make_local_ifunc_plt_entry): New function.
3537 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
3539 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
3540 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
3541 R_X86_64_IRELATIVE to switch.
3542 (Target_x86_64::Scan::global): Likewise.
3543 (Target_x86_64::Relocate::relocate): Likewise.
3544 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
3546 * target.h (class Target): Add plt_section_for_global and
3547 plt_section_for_local functions. Add do_plt_section_for_global
3548 and do_plt_section_for_local virtual functions.
3549 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
3550 clarifying comments.
3551 (Symbol::use_plt_offset): Handle IFUNC symbol.
3552 * object.cc (Sized_relobj::Sized_relobj): Initialize
3554 (Sized_relobj::local_has_plt_offset): New function.
3555 (Sized_relobj::local_plt_offset): New function.
3556 (Sized_relobj::set_local_plt_offset): New function.
3557 (Sized_relobj::do_count): Handle IFUNC symbol.
3558 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
3559 a bit away from input_shndx_ field. Add set_is_func_symbol and
3560 is_ifunc_symbol functions.
3561 (class Sized_relobj): Update declarations. Remove Tls_got_entry
3562 and Local_tls_got_offsets. Define Local_plt_offsets. Add
3563 local_plt_offsets_ field.
3564 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
3565 * output.h (class Output_section_data): Add non-const
3566 output_section function.
3567 (class Output_data_got): Update declarations.
3568 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
3569 Add use_plt_offset parameter to global and local constructors.
3570 Change all callers. Change local_sym_index_ field to 31 bits.
3571 Change GSYM_CODE and CONSTANT_CODE accordingly.
3572 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
3573 doing a static link don't set sh_link field.
3574 (Output_data_got::Got_entry::write): Use PLT offset if
3576 (Output_data_got::add_global_plt): New function.
3577 (Output_data_got::add_local_plt): New function.
3578 * target-reloc.h (relocate_section): Handle IFUNC symbol.
3579 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
3580 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
3581 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
3582 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
3584 * testsuite/ifunc-sel.h: New file.
3585 * testsuite/ifuncmain1.c: New file.
3586 * testsuite/ifuncmain1vis.c: New file.
3587 * testsuite/ifuncmod1.c: New file.
3588 * testsuite/ifuncdep2.c: New file.
3589 * testsuite/ifuncmain2.c: New file.
3590 * testsuite/ifuncmain3.c: New file.
3591 * testsuite/ifuncmod3.c: New file.
3592 * testsuite/ifuncmain4.c: New file.
3593 * testsuite/ifuncmain5.c: New file.
3594 * testsuite/ifuncmod5.c: New file.
3595 * testsuite/ifuncmain6pie.c: New file.
3596 * testsuite/ifuncmod6.c: New file.
3597 * testsuite/ifuncmain7.c: New file.
3598 * configure, testsuite/Makefile.in: Rebuild.
3600 2010-08-18 Ian Lance Taylor <iant@google.com>
3603 (Output_section_incremental_inputs::write_input_files): Add cast
3604 to avoid signed/unsigned comparison warning.
3605 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3607 2010-08-12 Cary Coutant <ccoutant@google.com>
3609 * common.cc (Sort_commons::operator()): Remove unnecessary code.
3611 2010-08-13 Ian Lance Taylor <iant@google.com>
3613 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
3615 2010-08-12 Cary Coutant <ccoutant@google.com>
3616 Doug Kwan <dougkwan@google.com>
3618 * resolve.cc (Symbol_table::should_override): When a weak dynamic
3619 defintion overrides non-weak undef, remember that the original undef
3621 * symtab.cc (Symbol_table::sized_write_global): For undef without
3622 an original weak binding, set binding to global in output.
3623 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
3624 * testsuite/Makefile.in: Regenerate.
3625 * testsuite/strong_ref_weak_def.sh: New file.
3626 * testsuite/strong_ref_weak_def_1.c: Ditto.
3627 * testsuite/strong_ref_weak_def_2.c: Ditto.
3629 2010-08-12 Cary Coutant <ccoutant@google.com>
3631 * testsuite/incremental_test.sh: Rewrite.
3632 * testsuite/incremental_test_1.c: Rewrite.
3633 * testsuite/incremental_test_2.c: Rewrite.
3635 2010-08-12 Cary Coutant <ccoutant@google.com>
3637 * arm.cc (Target_arm::got_size): Add const.
3638 (Target_arm::got_entry_count): New function.
3639 (Target_arm::plt_entry_count): New function.
3640 (Target_arm::first_plt_entry_offset): New function.
3641 (Target_arm::plt_entry_size): New function.
3642 (Output_data_plt_arm::entry_count): New function.
3643 (Output_data_plt_arm::first_plt_entry_offset): New function.
3644 (Output_data_plt_arm::get_plt_entry_size): New function.
3645 * i386.cc (Target_i386::got_size): Add const.
3646 (Target_i386::got_entry_count): New function.
3647 (Target_i386::plt_entry_count): New function.
3648 (Target_i386::first_plt_entry_offset): New function.
3649 (Target_i386::plt_entry_size): New function.
3650 (Output_data_plt_i386::entry_count): New function.
3651 (Output_data_plt_i386::first_plt_entry_offset): New function.
3652 (Output_data_plt_i386::get_plt_entry_size): New function.
3653 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
3654 find_incremental_inputs_sections. Dump incremental_got_plt section.
3655 * incremental.cc: Include target.h.
3656 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
3657 parameter. Adjust all callers. Find incremental_got_plt section.
3658 (Incremental_inputs::create_data_sections): Create incremental_got_plt
3660 (Output_section_incremental_inputs::set_final_data_size): Calculate
3661 size of incremental_got_plt section.
3662 (Output_section_incremental_inputs::do_write): Write the
3663 incremental_got_plt section.
3664 (Got_plt_view_info): New struct.
3665 (Local_got_offset_visitor): New class.
3666 (Global_got_offset_visitor): New class.
3667 (Global_symbol_visitor_got_plt): New class.
3668 (Output_section_incremental_inputs::write_got_plt): New function.
3669 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
3670 Add parameter. Adjust all callers.
3671 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3672 (Incremental_inputs::got_plt_section): New function.
3673 (Incremental_inputs::got_plt_section_): New data member.
3674 (Incremental_got_plt_reader): New class.
3675 * layout.cc (Layout::create_incremental_info_sections): Add the
3676 incremental_got_plt section.
3677 * object.h (Got_offset_list::get_list): New function.
3678 (Got offset_list::for_all_got_offsets): New function.
3679 (Sized_relobj::local_got_offset_list): New function.
3680 * powerpc.cc (Target_powerpc::got_size): Add const.
3681 (Target_powerpc::got_entry_count): New function.
3682 (Target_powerpc::plt_entry_count): New function.
3683 (Target_powerpc::first_plt_entry_offset): New function.
3684 (Target_powerpc::plt_entry_size): New function.
3685 (Output_data_plt_powerpc::entry_count): New function.
3686 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
3687 (Output_data_plt_powerpc::get_plt_entry_size): New function.
3688 * sparc.cc (Target_sparc::got_size): Add const.
3689 (Target_sparc::got_entry_count): New function.
3690 (Target_sparc::plt_entry_count): New function.
3691 (Target_sparc::first_plt_entry_offset): New function.
3692 (Target_sparc::plt_entry_size): New function.
3693 (Output_data_plt_sparc::entry_count): New function.
3694 (Output_data_plt_sparc::first_plt_entry_offset): New function.
3695 (Output_data_plt_sparc::get_plt_entry_size): New function.
3696 * symtab.h (Symbol::got_offset_list): New function.
3697 (Symbol_table::for_all_symbols): New function.
3698 * target.h (Sized_target::got_entry_count): New function.
3699 (Sized_target::plt_entry_count): New function.
3700 (Sized_target::plt_entry_size): New function.
3701 * x86_64.cc (Target_x86_64::got_size): Add const.
3702 (Target_x86_64::got_entry_count): New function.
3703 (Target_x86_64::plt_entry_count): New function.
3704 (Target_x86_64::first_plt_entry_offset): New function.
3705 (Target_x86_64::plt_entry_size): New function.
3706 (Output_data_plt_x86_64::entry_count): New function.
3707 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
3708 (Output_data_plt_x86_64::get_plt_entry_size): New function.
3710 2010-08-12 Cary Coutant <ccoutant@google.com>
3712 * archive.cc: Include incremental.h.
3713 (Archive::Archive): Initialize incremental_info_.
3714 (Archive::include_member): Record archive members in incremental info.
3715 (Add_archive_symbols::run): Record begin and end of an archive in
3717 (Lib_group::include_member): Record objects in incremental info.
3718 * archive.h (Incremental_archive_entry): Forward declaration.
3719 (Archive::set_incremental_info): New member function.
3720 (Archive::incremental_info): New member function.
3721 (Archive::Unused_symbol_iterator): New class.
3722 (Archive::unused_symbols_begin): New member function.
3723 (Archive::unused_symbols_end): New member function.
3724 (Archive::incremental_info_): New data member.
3725 * incremental-dump.cc (find_input_containing_global): New function.
3726 (dump_incremental_inputs): Dump new incremental info sections.
3727 * incremental.cc: Include symtab.h.
3728 (Output_section_incremental_inputs): New class.
3729 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
3730 new incremental info sections.
3731 (Sized_incremental_binary::do_check_inputs): Likewise.
3732 (Incremental_inputs::report_archive): Remove.
3733 (Incremental_inputs::report_archive_begin): New function.
3734 (Incremental_inputs::report_archive_end): New function.
3735 (Incremental_inputs::report_object): New function.
3736 (Incremental_inputs::finalize_inputs): Remove.
3737 (Incremental_inputs::report_input_section): New function.
3738 (Incremental_inputs::report_script): Rewrite.
3739 (Incremental_inputs::finalize): Do nothing but finalize string table.
3740 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3741 (Incremental_inputs::sized_create_inputs_section_data): Remove.
3742 (Incremental_inputs::create_data_sections): New function.
3743 (Incremental_inputs::relocs_entsize): New function.
3744 (Output_section_incremental_inputs::set_final_data_size): New function.
3745 (Output_section_incremental_inputs::do_write): New function.
3746 (Output_section_incremental_inputs::write_header): New function.
3747 (Output_section_incremental_inputs::write_input_files): New function.
3748 (Output_section_incremental_inputs::write_info_blocks): New function.
3749 (Output_section_incremental_inputs::write_symtab): New function.
3750 * incremental.h (Incremental_script_entry): Forward declaration.
3751 (Incremental_object_entry): Forward declaration.
3752 (Incremental_archive_entry): Forward declaration.
3753 (Incremental_inputs): Forward declaration.
3754 (Incremental_inputs_header_data): Remove.
3755 (Incremental_inputs_header): Remove.
3756 (Incremental_inputs_header_write): Remove.
3757 (Incremental_inputs_entry_data): Remove.
3758 (Incremental_inputs_entry): Remove.
3759 (Incremental_inputs_entry_write): Remove.
3760 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
3761 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
3762 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3763 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
3765 (Incremental_input_entry): New class.
3766 (Incremental_script_entry): New class.
3767 (Incremental_object_entry): New class.
3768 (Incremental_archive_entry): New class.
3769 (Incremental_inputs::Incremental_inputs): Initialize new data members.
3770 (Incremental_inputs::report_inputs): Remove.
3771 (Incremental_inputs::report_archive): Remove.
3772 (Incremental_inputs::report_archive_begin): New function.
3773 (Incremental_inputs::report_archive_end): New function.
3774 (Incremental_inputs::report_object): Change prototype.
3775 (Incremental_inputs::report_input_section): New function.
3776 (Incremental_inputs::report_script): Change prototype.
3777 (Incremental_inputs::get_reloc_count): New function.
3778 (Incremental_inputs::set_reloc_count): New function.
3779 (Incremental_inputs::create_data_sections): New function.
3780 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3781 (Incremental_inputs::inputs_section): New function.
3782 (Incremental_inputs::symtab_section): New function.
3783 (Incremental_inputs::relocs_section): New function.
3784 (Incremental_inputs::get_stringpool): Add const.
3785 (Incremental_inputs::command_line): Add const.
3786 (Incremental_inputs::inputs): Remove.
3787 (Incremental_inputs::command_line_key): New function.
3788 (Incremental_inputs::input_file_count): New function.
3789 (Incremental_inputs::input_files): New function.
3790 (Incremental_inputs::relocs_entsize): New function.
3791 (Incremental_inputs::sized_create_inputs_section_data): Remove.
3792 (Incremental_inputs::finalize_inputs): Remove.
3793 (Incremental_inputs::Input_info): Remove.
3794 (Incremental_inputs::lock_): Remove.
3795 (Incremental_inputs::inputs_): Change type.
3796 (Incremental_inputs::inputs_map_): Remove.
3797 (Incremental_inputs::current_object_entry_): New data member.
3798 (Incremental_inputs::inputs_section_): New data member.
3799 (Incremental_inputs::symtab_section_): New data member.
3800 (Incremental_inputs::relocs_section_): New data member.
3801 (Incremental_inputs::reloc_count_): New data member.
3802 (Incremental_inputs_reader): New class.
3803 (Incremental_symtab_reader): New class.
3804 (Incremental_relocs_reader): New class.
3805 * layout.cc (Layout::finalize): Move finalization of incremental info
3806 and creation of incremental info sections to follow finalization of
3807 symbol table. Set offsets for postprocessing sections.
3808 (Layout::create_incremental_info_sections): Call
3809 Incremental_inputs::create_data_sections. Add incremental symtab
3810 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
3811 sections to layout after input sections.
3812 * layout.h (struct Timespec): Forward declaration.
3813 (Layout::incremental_inputs): Add const.
3814 (Layout::create_incremental_info_sections): Add parameter.
3815 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
3816 * object.cc: Include incremental.h.
3817 (Relobj::finalize_incremental_relocs): New function.
3818 (Sized_relobj::do_layout): Record input sections in incremental info.
3819 * object.h (Object::output_section): New function.
3820 (Object::output_section_offset): Moved from Relobj.
3821 (Object::get_incremental_reloc_base): New function.
3822 (Object::get_incremental_reloc_count): New function.
3823 (Object::do_output_section): New function.
3824 (Object::do_output_section_offset): Moved from Relobj.
3825 (Object::do_get_incremental_reloc_base): New function.
3826 (Object::do_get_incremental_reloc_count): New function.
3827 (Object::Object): Initialize new data members.
3828 (Relobj::output_section): Renamed do_output_section and moved to
3830 (Relobj::output_section_offset): Moved to Object.
3831 (Relobj::do_get_incremental_reloc_base): New function.
3832 (Relobj::do_get_incremental_reloc_count): New function.
3833 (Relobj::allocate_incremental_reloc_counts): New function.
3834 (Relobj::count_incremental_reloc): New function.
3835 (Relobj::finalize_incremental_relocs): New function.
3836 (Relobj::next_incremental_reloc_index): New function.
3837 (Relobj::reloc_counts_): New data member.
3838 (Relobj::reloc_bases_): New data member.
3839 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
3840 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
3841 (Sized_relobj::incremental_relocs_scan): New function.
3842 (Sized_relobj::incremental_relocs_scan_reltype): New function.
3843 (Sized_relobj::incremental_relocs_write): New function.
3844 (Sized_relobj::incremental_relocs_write_reltype): New function.
3845 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
3847 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
3848 archives and object files elsewhere.
3849 (Add_symbols::run): Report object files here.
3850 (Finish_group::run): Report end of archive at end of group.
3851 * reloc.cc: Include layout.h, incremental.h.
3852 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
3853 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
3854 (Sized_relobj::incremental_relocs_scan): New function.
3855 (Sized_relobj::incremental_relocs_scan_reltype): New function.
3856 (Sized_relobj::do_relocate_sections): Write incremental relocations.
3857 (Sized_relobj::incremental_relocs_write): New function.
3858 (Sized_relobj::incremental_relocs_write_reltype): New function.
3859 * script.cc (read_input_script): Rewrite test for incremental link.
3860 Change call to Incremental_inputs::report_script.
3861 * symtab.h (Symbol_table::first_global_index): New function.
3862 (Symbol_table::output_count): New function.
3864 2010-08-12 Doug Kwan <dougkwan@google.com>
3866 * arm.cc (Target_arm::merge_object_attributes): Check command line
3867 options --no-wchar-size-warning and --no-enum-size-warning.
3868 * options.h (General_options): Add ld-compatible options
3869 --no-enum-size-warning and --no-wchar-size-warning.
3871 2010-08-04 Ian Lance Taylor <iant@google.com>
3873 * x86_64.cc (Target_x86_64::Scan::local): Use
3874 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
3875 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
3876 (Target_x86_64::Scan::global): Likewise.
3877 (Target_x86_64::Relocate::relocate): Likewise.
3878 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
3881 2010-08-03 Cary Coutant <ccoutant@google.com>
3883 * merge.cc (Output_merge_string::do_add_input_section): Count strings
3884 to reserve space in merged_strings vector. Keep total input size
3886 (Output_merge_string::do_print_merge_stats): Print total input size.
3887 * merge.h (Output_merge_string): Add input_size_ field.
3888 * stringpool.cc (Stringpool_template::string_length): Move
3889 implementations out of Stringpool_template class and place in
3891 * stringpool.h (string_length): Move out of Stringpool_template.
3893 2010-08-03 Ian Lance Taylor <iant@google.com>
3896 * layout.cc (relaxation_loop_body): If address of load segment is
3897 set, adjust address to include headers if possible.
3899 2010-08-03 Ian Lance Taylor <iant@google.com>
3901 * version.cc (version_string): Bump to 1.10.
3903 2010-08-03 Ian Lance Taylor <iant@google.com>
3906 * layout.h (enum Output_section_order): Define.
3907 (class Layout): Update declarations.
3908 * layout.cc (Layout::get_output_section): Add order parameter.
3909 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
3910 is_first_non_relro parameters. Change all callers.
3911 (Layout::choose_output_section): Likewise.
3912 (Layout::add_output_section_data): Likewise.
3913 (Layout::make_output_section): Likewise. Set order.
3914 (Layout::default_section_order): New function.
3915 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
3916 * output.cc (Output_section::Output_section): Initialize order_.
3917 Don't initialize deleted fields.
3918 (Output_segment::Output_segment): Don't initialize deleted
3920 (Output_segment::add_output_section_to_load): New function
3921 replacing add_output_section. Change all callers to call this or
3922 add_output_section_to_nonload.
3923 (Output_segment::add_output_section_to_nonload): New function.
3924 (Output_segment::remove_output_section): Rewrite.
3925 (Output_segment::add_initial_output_data): Likewise.
3926 (Output_segment::has_any_data_sections): Likewise.
3927 (Output_segment::is_first_section_relro): Likewise.
3928 (Output_segment::maximum_alignment): Likewise.
3929 (Output_segment::has_dynamic_reloc): New function replacing
3930 dynamic_reloc_count. Change all callers.
3931 (Output_segment::has_dynamic_reloc_list): New function replacing
3932 dynamic_reloc_count_list. Change all callers.
3933 (Output_segment::set_section_addresses): Rewrite.
3934 (Output_segment::set_offset): Rewrite.
3935 (Output_segment::find_first_and_last_list): Remove.
3936 (Output_segment::set_tls_offsets): Rewrite.
3937 (Output_segment::first_section_load_address): Likewise.
3938 (Output_segment::output_section_count): Likewise.
3939 (Output_segment::section_with_lowest_load_address): Likewise.
3940 (Output_segment::write_section_headers): Likewise.
3941 (Output_segment::print_sections_to_map): Likewise.
3942 * output.h (class Output_data): Remove dynamic_reloc_count_
3943 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
3944 (Output_data::add_dynamic_reloc): Rewrite.
3945 (Output_data::has_dynamic_reloc): New function.
3946 (Output_data::dynamic_reloc_count): Remove.
3947 (class Output_section): Add order_ field. Remvoe is_relro_local_,
3948 is_last_relro_, is_first_non_relro_, is_interp_,
3949 is_dynamic_linker_section_ fields. Add order and set_order
3950 functions. Remove is_relro_local, set_is_relro_local,
3951 is_last_relro, set_is_last_relro, is_first_non_relro,
3952 set_is_first_non_relro functions, is_interp, set_is_interp,
3953 is_dynamic_linker_section, and set_is_dynamic_linker_section
3955 (class Output_segment): Change Output_data_list from std::list to
3956 std:;vector. Add output_lists_ field. Remove output_data_ and
3957 output_bss_ fields. Update declarations.
3959 2010-08-02 Ian Lance Taylor <iant@google.com>
3961 * arm.cc (Target_arm::gc_process_relocs): Use typename.
3962 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
3963 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
3965 2010-08-02 Ian Lance Taylor <iant@google.com>
3968 * script.cc (Script_options::Script_options): Initialize
3969 symbol_definitions_ and symbol_references_.
3970 (Script_options::add_symbol_assignment): Update
3971 symbol_definitions_ and symbol_references_.
3972 (Script_options::add_symbol_reference): New function.
3973 (script_symbol): New function.
3974 * script.h (class Script_options): Add symbol_definitions_ and
3975 symbol_references_ fields.
3976 (Script_options::referenced_const_iterator): New type.
3977 (Script_options::referenced_begin): New function.
3978 (Script_options::referenced_end): New function.
3979 (Script_options::is_referenced): New function.
3980 (Script_options::any_unreferenced): New function.
3981 * script-c.h (script_symbol): Declare.
3982 * yyscript.y (exp): Call script_symbol.
3983 * symtab.cc: Include "script.h".
3984 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
3985 Change all callers. Check symbols referenced by scripts.
3986 (Symbol_table::add_undefined_symbols_from_command_line): Add
3987 layout parameter. Change all callers.
3988 (Symbol_table::do_add_undefined_symbols_from_command_line):
3989 Likewise. Break out loop body. Check symbols referenced by
3991 (Symbol_table::add_undefined_symbol_from_command_line): New
3992 function broken out of
3993 do_add_undefined_symbols_from_command_line.
3994 * symtab.h (class Symbol_table): Update declarations.
3995 * archive.cc: Include "layout.h".
3996 (Archive::should_include_member): Add layout parameter. Change
3997 all callers. Check for symbol mentioned in expression.
3998 * archive.h (class Archive): Update declaration.
3999 * object.cc (Sized_relobj::do_should_include_member): Add layout
4001 * object.h (Object::should_include_member): Add layout parameter.
4003 (Object::do_should_include_member): Add layout parameter.
4004 (class Sized_relobj): Update declaration.
4005 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
4007 * dynobj.h (class Sized_dynobj): Update declaration.
4008 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
4010 * plugin.h (class Sized_pluginobj): Update declaration.
4012 2010-08-02 Ian Lance Taylor <iant@google.com>
4015 * output.cc (Output_segment::set_offset): Search for the first and
4016 last sections rather than assuming that the list is in order.
4017 (Output_segment::find_first_and_last_list): New function.
4018 * output.h (class Output_segment): Update declarations.
4019 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4020 (relro_strip_test_SOURCES): New variable.
4021 (relro_strip_test_DEPENDENCIES): New variable.
4022 (relro_strip_test_LDFLAGS): New variable.
4023 (relro_strip_test_LDADD): New variable.
4024 (relro_strip_test.so): New target.
4026 2010-08-02 Ian Lance Taylor <iant@google.com>
4028 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4029 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4030 (Target_i386::got_tlsdesc_section): New function.
4031 (Target_i386::got_section): Create space for GOT entries for
4032 TLSDESC relocations.
4033 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4035 (Target_i386::Scan::global): Likewise.
4036 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
4038 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
4039 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
4040 (Target_x86_64::got_tlsdesc_section): New function.
4041 (Target_x86_64::got_section): Create space for GOT entries for
4042 TLSDESC relocations.
4043 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
4045 (Target_x86_64::Scan::global): Likewise.
4046 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
4049 2010-08-02 Ian Lance Taylor <iant@google.com>
4051 * testsuite/final_layout.sh: Use dc to convert from hex to
4054 2010-07-29 Sriraman Tallam <tmsriram@google.com>
4056 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4057 paramter to the call to gold::gc_process_relocs.
4058 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4059 paramter to the call to gold::gc_process_relocs.
4060 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4061 parameter to the call to gold::gc_process_relocs.
4062 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4063 template parameter to the call to gold::gc_process_relocs.
4064 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4065 paramter to the call to gold::gc_process_relocs.
4066 * gc.h (get_embedded_addend_size): New function.
4067 (gc_process_relocs): Save the size of the reloc for use by ICF.
4068 * icf.cc (get_section_contents): Get the addend from the text section
4069 for SHT_REL relocation sections.
4070 * icf.h (Icf::Reloc_addend_size_info): New typedef.
4071 (Icf::Reloc_info): Add new member reloc_addend_size_info.
4072 * int_encoding.h (read_from_pointer): New overloaded function.
4073 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
4074 * testsuite/icf_sht_rel_addend_test.sh: New file.
4075 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
4076 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
4078 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4080 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
4081 * Makefile.in: Regenerate.
4082 * testsuite/Makefile.in: Regenerate.
4084 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
4086 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
4087 * gold/testsuite/debug_msg.cc: Likewise.
4088 * gold/testsuite/odr_violation1.cc
4089 * gold/testsuite/odr_violation2.cc
4091 2010-07-21 Cary Coutant <ccoutant@google.com>
4093 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
4094 string, and length fields.
4095 (Output_merge_string::Merged_strings_list): New type.
4096 (Output_merge_string::Merged_strings_lists): New typedef.
4097 (Output_merge_string): Replace merged_strings_ with
4098 merged_strings_lists_.
4099 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
4100 Merged_strings_list per input object and section. Don't store pointer
4101 to the string. Don't store length with each merged string entry.
4102 (Output_merge_string::finalize_merged_data): Loop over list of merged
4103 strings lists. Recompute length of each merged string.
4105 2010-07-15 Cary Coutant <ccoutant@google.com>
4107 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
4110 2010-07-14 Ian Lance Taylor <iant@google.com>
4112 * descriptors.cc (Descriptors::open): Report correct name in error
4115 2010-07-13 Doug Kwan <dougkwan@google.com>
4117 * arm.cc (Arm_input_section::Arm_input_section): For a
4118 SHT_ARM_EXIDX section, always keeps the input sections.
4119 (Arm_input_section::set_exidx_section_link): New method.
4120 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
4121 has_errors_ to false.
4122 (Arm_exidx_input_section::has_errors,
4123 Arm_exidx_input_section::set_has_errors): New methods.
4124 (Arm_exidx_input_section::has_errors_): New data member.
4125 (Arm_relobj::get_exidx_shndx_list): New method.
4126 (Arm_output_section::append_text_sections_to_list): Do not skip
4127 section without SHF_EXECINSTR.
4128 (Arm_output_section::fix_exidx_coverage): Skip input sections with
4130 (Arm_relobj::make_exidx_input_section): Add new parameter for text
4131 section header. Make error messages more verbose. Check for
4132 a non-executable section linked to an EXIDX section.
4133 (Arm_relobj::do_read_symbols): Remove error checking, which has been
4134 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
4135 check that there is no deferred EXIDX section if we exit early.
4136 Instead of not making an EXIDX section in case of an error, make one
4137 and set the has_errors flag of it.
4138 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
4139 in a relocatable link.
4140 (Target_arm::do_relax): Look for the EXIDX output section instead of
4141 assuming that it is called .ARM.exidx.
4142 (Target_arm::fix_exidx_coverage): Add a new parameter for input
4143 section list. Do not check for SHF_EXECINSTR section flags but
4144 skip any input section with errors.
4145 * output.cc (Output_section::Output_section): Initialize
4146 always_keeps_input_sections_ to false.
4147 (Output_section::add_input_section): Check for
4148 always_keeps_input_sections_.
4149 * output.h (Output_section::always_keeps_input_sections,
4150 Output_section::set_always_keeps_input_sections): New methods.
4151 (Output_section::always_keeps_input_sections): New data member.
4153 2010-07-13 Rafael Espindola <espindola@google.com>
4155 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
4156 * fileread.h (Input_file): Add try_extra_search_path and find_file.
4158 2010-07-13 Philip Herron <herron.philip@googlemail.com>
4159 Ian Lance Taylor <iant@google.com>
4161 * output.h (Output_section_lookup_maps::add_merge_section):
4162 Correct check of whether value was inserted.
4163 (Output_section_lookup_maps::add_merge_input_section): Likewise.
4164 (Output_section_lookup_maps::add_relaxed_input_section):
4166 * arm.cc (Target_arm::got_section): Remove used local os.
4167 * i386.cc (Target_i386::got_section): Likewise.
4168 * x86_64.cc (Target_x86_64::got_section): Likewise.
4169 * sparc.cc (Target_sparc::got_section): Likewise.
4170 (Target_sparc::relocate): Remove unused local have_got_offset.
4171 * powerpc.cc (Target_powerpc::relocate): Likewise.
4173 2010-07-13 Ian Lance Taylor <iant@google.com>
4175 * compressed_output.cc (zlib_decompress): Fix signature in
4178 * archive.cc (Archive::include_member): Unlock an external member
4179 of a thin archive. Don't bother to delete an object we know is
4182 2010-07-12 Cary Coutant <ccoutant@google.com>
4184 * compressed_output.cc (zlib_decompress): New function.
4185 (get_uncompressed_size): New function.
4186 (decompress_input_section): New function.
4187 * compressed_output.h (get_uncompressed_size): New function.
4188 (decompress_input_section): New function.
4189 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
4190 Handle compressed debug sections.
4191 * layout.cc (is_compressed_debug_section): New function.
4192 (Layout::output_section_name): Map compressed section names to
4194 * layout.h (is_compressed_debug_section): New function.
4195 (is_debug_info_section): Recognize compressed debug sections.
4196 * merge.cc: Include compressed_output.h.
4197 (Output_merge_data::do_add_input_section): Handle compressed
4199 (Output_merge_string::do_add_input_section): Handle compressed
4201 * object.cc: Include compressed_output.h.
4202 (Sized_relobj::Sized_relobj): Initialize new data members.
4203 (build_compressed_section_map): New function.
4204 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
4205 * object.h (Object::section_is_compressed): New method.
4206 (Object::do_section_is_compressed): New method.
4207 (Sized_relobj::Compressed_section_map): New type.
4208 (Sized_relobj::do_section_is_compressed): New method.
4209 (Sized_relobj::compressed_sections_): New data member.
4210 * output.cc (Output_section::add_input_section): Handle compressed
4212 * reloc.cc: Include compressed_output.h.
4213 (Sized_relobj::write_sections): Handle compressed debug sections.
4215 2010-07-08 Cary Coutant <ccoutant@google.com>
4217 * resolve.cc (Symbol_table::resolve): Remember whether undef was
4218 weak when resolving to a dynamic def.
4219 (Symbol_table::should_override): Add adjust_dyndef flag; set it
4220 for weak undef/dynamic def cases. Adjust callers.
4221 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
4222 undef_binding_weak_.
4223 (Symbol_table::sized_write_globals): Adjust symbol binding.
4224 (Symbol_table::sized_write_symbol): Add binding parameter.
4225 * symtab.h (Symbol::set_undef_binding): New method.
4226 (Symbol::is_undef_binding_weak): New method.
4227 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
4228 (Symbol_table::should_override): Add new parameter.
4229 (Symbol_table::sized_write_symbol): Add new parameter.
4231 * testsuite/weak_undef_file1.cc: Add new test case.
4232 * testsuite/weak_undef_file2.cc: Fix header comment.
4233 * testsuite/weak_undef_test.cc: Add new test case.
4235 2010-06-29 Doug Kwan <dougkwan@google.com>
4237 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
4238 Initialize USE_SYMBOL_.
4239 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
4241 (Arm_reloc_property::uses_symbol_): New data member declaration.
4242 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
4243 uses symbol value and symbol is undefined but not weakly undefined.
4245 2010-06-28 Rafael Espindola <espindola@google.com>
4247 * plugin.cc (Plugin::load): Use dlerror.
4249 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
4251 * symtab.cc (detect_odr_violations): When reporting an ODR
4252 violation, report an object where the symbol is defined.
4254 2010-06-25 Doug Kwan <dougkwan@google.com>
4256 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
4257 (Target_arm::section_may_have_icf_unsafe_pointers): New method
4259 (Target_arm::Scan::local_reloc_may_be_function_pointer,
4260 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
4261 target hook to detect function points.
4262 (Target_arm::Scan::possible_function_pointer_reloc): New method.
4263 * icf.h (Icf::check_section_for_function_pointers): Change type of
4264 parameter SECTION_NAME to const reference to std::string. Use
4265 target hook to determine if section may have unsafe pointers.
4266 * target.h (Target::section_may_have_icf_unsafe_pointers): New
4269 2010-06-21 Rafael Espindola <espindola@google.com>
4271 * fileread.cc (Input_file::find_fie): New
4272 (Input_file::open): Use Input_file::find_fie.
4273 * fileread.h (Input_file::find_fie): New
4274 * plugin.cc (set_extra_library_path): New.
4275 (Plugin::load): Add set_extra_library_path to the transfer vector.
4276 (Plugin_manager::set_extra_library_path): New.
4277 (Plugin_manager::add_input_file): Use the extra search path if set.
4278 (set_extra_library_path(): New.
4279 * plugin.h (Plugin_manager): Add set_extra_library_path and
4282 2010-06-19 Cary Coutant <ccoutant@google.com>
4284 * layout.cc (gdb_sections): Add .debug_types.
4285 (lines_only_debug_sections): Likewise.
4287 2010-06-18 Rafael Espindola <espindola@google.com>
4289 * plugin.cc (add_input_file,add_input_library)
4290 (Plugin_manager::add_input_file): Make filename arguments const.
4291 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
4294 2010-06-16 Doug Kwan <dougkwan@google.com>
4296 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
4297 .ARM.attributes section if we have not merged any input
4298 attributes sections.
4300 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4302 * arm.cc: Allow combining objects with no EABI version
4305 2010-06-15 Rafael Espindola <espindola@google.com>
4307 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
4309 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4311 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
4312 (struct iovec): Correct !HAVE_READV definition.
4314 2010-06-10 Cary Coutant <ccoutant@google.com>
4316 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
4317 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
4319 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
4322 * symtab.h (Symbol::is_placeholder): New member function.
4323 * target-reloc.h (relocate_section): Check for placeholder symbols.
4325 * testsuite/Makefile.am (plugin_test_8): New test.
4326 (plugin_test_9): New test.
4327 * testsuite/Makefile.in: Regenerate.
4329 2010-06-09 Nick Clifton <nickc@redhat.com>
4331 * yyscript.y (input_list_element): Allow strings prefixed with
4332 the '-' character. Treat these as libraries.
4333 * script.cc (script_add_library): New function. Adds a library
4334 specified by "-l<name>" found in an input script.
4335 * script-c.h: Add prototype for script_add_library.
4337 2010-06-07 Doug Kwan <dougkwan@google.com>
4339 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
4340 Restrict stub-group size to be within long conditional branch
4341 range when working around cortex-A8 erratum.
4343 2010-06-07 Damien Diederen <dd@crosstwine.com>
4345 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
4348 2010-06-03 Sriraman Tallam <tmsriram@google.com>
4352 (Output_section::Input_section_sort_entry::compare_section_ordering):
4353 Change to return non-zero correctly.
4354 (Output_section::Input_section_sort_section_order_index_compare
4355 ::operator()): Change to fix ambiguity in comparisons.
4357 2010-06-01 Sriraman Tallam <tmsriram@google.com>
4359 * gold.h (is_wildcard_string): New function.
4360 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
4361 (Layout::layout_eh_frame): Ditto.
4362 (Layout::find_section_order_index): New method.
4363 (Layout::read_layout_from_file): New method.
4364 * layout.h (Layout::find_section_order_index): New method.
4365 (Layout::read_layout_from_file): New method.
4366 (Layout::input_section_position_): New private member.
4367 (Layout::input_section_glob_): New private member.
4368 * main.cc (main): Call read_layout_from_file here.
4369 * options.h (--section-ordering-file): New option.
4370 * output.cc (Output_section::input_section_order_specified_): New
4372 (Output_section::Output_section): Initialize new member.
4373 (Output_section::add_input_section): Add new parameter.
4374 Keep input sections when --section-ordering-file is used.
4375 (Output_section::set_final_data_size): Sort input sections when
4376 section ordering file is specified.
4377 (Output_section::Input_section_sort_entry): Add new parameter.
4379 (Output_section::Input_section_sort_entry::compare_section_ordering):
4381 (Output_section::Input_section_sort_compare::operator()): Change to
4382 consider section_order_index.
4383 (Output_section::Input_section_sort_init_fini_compare::operator()):
4384 Change to consider section_order_index.
4385 (Output_section::Input_section_sort_section_order_index_compare
4386 ::operator()): New method.
4387 (Output_section::sort_attached_input_sections): Change to sort
4388 according to section order when specified.
4389 (Output_section::add_input_section<32, true>): Add new parameter.
4390 (Output_section::add_input_section<64, true>): Add new parameter.
4391 (Output_section::add_input_section<32, false>): Add new parameter.
4392 (Output_section::add_input_section<64, false>): Add new parameter.
4393 * output.h (Output_section::add_input_section): Add new parameter.
4394 (Output_section::input_section_order_specified): New
4396 (Output_section::set_input_section_order_specified): New method.
4397 (Input_section::Input_section): Initialize section_order_index_.
4398 (Input_section::section_order_index): New method.
4399 (Input_section::set_section_order_index): New method.
4400 (Input_section::section_order_index_): New member.
4401 (Input_section::Input_section_sort_section_order_index_compare): New
4403 (Output_section::input_section_order_specified_): New member.
4404 * script-sections.cc (is_wildcard_string): Delete and move modified
4406 (Output_section_element_input::Output_section_element_input): Modify
4407 call to is_wildcard_string.
4408 (Output_section_element_input::Input_section_pattern
4409 ::Input_section_pattern): Ditto.
4410 (Output_section_element_input::Output_section_element_input): Ditto.
4411 * testsuite/Makefile.am (final_layout): New test case.
4412 * testsuite/Makefile.in: Regenerate.
4413 * testsuite/final_layout.cc: New file.
4414 * testsuite/final_layout.sh: New file.
4416 2010-06-01 Rafael Espindola <espindola@google.com>
4418 * plugin.cc (Plugin::load): Pass the output name to the plugin.
4420 2010-06-01 Rafael Espindola <espindola@google.com>
4422 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
4423 visibility of symbols.
4425 2010-05-27 Doug Kwan <dougkwan@google.com>
4427 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
4428 from start of output section instead of address for a local symbol
4429 in a merged or relaxed section when doing a relocatable link.
4431 2010-05-26 Rafael Espindola <espindola@google.com>
4434 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
4435 adding sections the garbage collector removed.
4436 * gold/testsuite/Makefile.am: Add test.
4437 * gold/testsuite/Makefile.in: Regenerate.
4438 * gold/testsuite/plugin_test_7.sh: New.
4439 * gold/testsuite/plugin_test_7_1.c: New.
4440 * gold/testsuite/plugin_test_7_2.c: New.
4442 2010-05-26 Rafael Espindola <espindola@google.com>
4444 * script-sections.cc (Output_section_definition::set_section_addresses):
4445 Check for --section-start.
4447 2010-05-26 Doug Kwan <dougkwan@google.com>
4449 * arm.cc (Arm_scan_relocatable_relocs): New class.
4450 (Target_arm::relocate_special_relocatable): New method.
4451 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
4452 (Arm_relocate_functions::thumb_branch_common): Same.
4453 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
4454 instead of Default_scan_relocatable_relocs.
4455 * target-reloc.h (relocate_for_relocatable): Let target handle
4456 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
4457 * target.h (Sized_target::relocate_special_relocatable): New method.
4459 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4461 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
4463 2010-05-23 Doug Kwan <dougkwan@google.com>
4465 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
4467 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
4468 with a direct branch, not a conditional branch, to a stub.
4469 * merge.cc (Output_merge_base::record_input_section): New method
4471 (Output_merge_data::do_add_input_section): Record input section if
4472 keeps-input-sections flag is set.
4473 (Output_merge_string::do_add_input_section): Ditto.
4474 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
4475 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
4477 (Output_merge_base::keeps_input_sections,
4478 Output_merge_base::set_keeps_input_sections,
4479 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
4481 (Output_merge_base::Input_sections): New type declaration.
4482 (Output_merge_base::input_sections_begin,
4483 Output_merge_base::input_sections_end,
4484 Output_merge_base::do_set_keeps_input_sections): New method definitions.
4485 (Output_merge_base::bool keeps_input_sections_,
4486 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
4487 Output_merge_base::input_sections_): New data members.
4488 (Output_merge_data::do_set_keeps_input_sections): New method
4490 (Output_merge_string::do_set_keeps_input_sections): Ditto.
4491 * output.cc (Output_section::Input_section::relobj): Move method
4492 defintion from class declaration to here and handle merge sections.
4493 (Output_section::Input_section::shndx): Ditto.
4494 (Output_section::Output_section): Remove initializations of removed
4495 data members and initialize new data member LOOKUP_MAPS_.
4496 (Output_section::add_input_section): Set keeps-input-sections flag
4497 for a newly created merge output section as appropriate. Adjust code
4498 to use Output_section_lookup_maps class.
4499 (Output_section::add_relaxed_input_section): Adjst code for lookup
4500 maps code refactoring.
4501 (Output_section::add_merge_input_section): Add a new parameter
4502 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
4503 class. If adding input section to a newly created merge output
4504 section fails, remove the new merge section.
4505 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
4506 Adjust code for use of the Output_section_lookup_maps class.
4507 (Output_section::find_merge_section): Ditto.
4508 (Output_section::build_lookup_maps): New method defintion.
4509 (Output_section::find_relaxed_input_section): Adjust code to use
4510 Output_section_lookup_maps class.
4511 (Output_section::get_input_sections): Export merge sections. Adjust
4512 code to use Output_section_lookup_maps class.
4513 (Output_section:::add_script_input_section): Adjust code to use
4514 Output_section_lookup_maps class. Update lookup maps for merge
4516 (Output_section::discard_states): Use Output_section_lookup_maps.
4517 (Output_section::restore_states): Same.
4518 * output.h (Merge_section_properties): Move class defintion out of
4520 (Output_section_lookup_maps): New class.
4521 (Output_section::Input_section::is_merge_section): New method
4523 (Output_section::Input_section::relobj): Move defintion out of class
4524 defintion. Declare method only.
4525 (Output_section::Input_section::shndx): Ditto.
4526 (Output_section::Input_section::output_merge_base): New method defintion.
4527 (Output_section::Input_section::u2_.pomb): New union field.
4528 (Output_section::Merge_section_by_properties_map,
4529 Output_section::Output_section_data_by_input_section_map,
4530 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
4532 (Output_section::add_merge_input_section): Add new parameter
4533 KEEPS_INPUT_SECTIONS.
4534 (Output_section::build_lookup_maps): New method declaration.
4535 (Output_section::merge_section_map_,
4536 Output_section::merge_section_by_properties_map_,
4537 Output_section::relaxed_input_section_map_,
4538 Output_section::is_relaxed_input_section_map_valid_): Remove data
4540 (Output_section::lookup_maps_): New data member.
4542 2010-05-21 Doug Kwan <dougkwan@google.com>
4545 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
4546 avoid a compilation error.
4548 2010-05-19 Rafael Espindola <espindola@google.com>
4550 * script-sections.cc (Output_section_definition::allocate_to_segment):
4551 Update the phdrs_list even when the output section is NULL.
4552 * testsuite/Makefile.am: Add test.
4553 * testsuite/Makefile.in: Regenerate.
4554 * testsuite/script_test_9.cc: New.
4555 * testsuite/script_test_9.sh: New.
4556 * testsuite/script_test_9.t: New.
4558 2010-05-19 Doug Kwan <dougkwan@google.com>
4560 * arm.cc (Arm_input_section::original_size): New method.
4561 (Arm_input_section::do_addralign): Add a cast.
4562 (Arm_input_section::do_output_offset): Remove static cast.
4563 (Arm_input_section::original_addralign,
4564 Arm_input_section::original_size_): Change type to uint32_t.
4565 (Arm_input_section::init): Add safe casts for section alignment
4567 (Arm_input_section::set_final_data_size): Do not set address and
4568 offset of stub table.
4569 (Arm_output_section::fix_exidx_coverage): Change use of of
4570 Output_section::Simple_input_section to that of
4571 Output_section::Input_section.
4572 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
4573 except for the first pass.
4574 * output.cc (Output_section::get_input_sections): Change type of
4575 input_sections to std::list<Input_section>.
4576 (Output_section::add_script_input_section): Rename from
4577 Output_section::add_simple_input_section. Change type of SIS
4578 parameter from Simple_input_section to Input_section.
4579 * output.h (Output_section::Simple_input_section): Remove class.
4580 (Output_section::Input_section): Change class visibility to public.
4581 (Output_section::Input_section::addralign): Use stored alignments
4582 for special input sections if set.
4583 (Output_section::Input_section::set_addralign): New method.
4584 (Output_section::get_input_sections): Change parameter type from
4585 list of Simple_input_section to list of Input_section.
4586 (Output_section::add_script_input_section): Rename from
4587 Output_section::add_simple_input_section. Change first parameter's
4588 type from Simple_input_section to Input_section and remove the
4589 second and third parameters.
4590 * script-sections.cc (Input_section::Input_section_list): Change
4591 type to list of Output_section::Input_section/
4592 (Input_section_info::Input_section_info): Change parameter type of
4593 INPUT_SECTION to Output_section::Input_section.
4594 (Input_section_info::input_section): Change return type.
4595 (Input_section_info::input_section_): Change type to
4596 Output_section::Input_section.
4597 (Output_section_element_input::set_section_addresses): Adjust code
4598 to use Output_section::Input_section instead of
4599 Output_section::Simple_input_section. Adjust code for renaming
4600 of Output_section::add_simple_input_section.
4601 (Orphan_output_section::set_section_addresses): Ditto.
4603 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4605 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
4606 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
4608 2010-05-18 Rafael Espindola <espindola@google.com>
4610 * options.cc (General_options::finalize): Handle -nostdlib.
4611 * options.h (nostdlib): New option.
4612 * script.cc (script_add_search_dir): Handle -nostdlib.
4614 2010-05-12 Doug Kwan <dougkwan@google.com>
4616 * arm.cc (Target_arm::do_finalize_sections): Create an empty
4617 attributes section only if there no attributes section after merging.
4618 (Target_arm::merge_object_attributes): Move value of
4619 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
4620 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
4621 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
4622 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
4623 and arm_attr_merge_7.stdout.
4624 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
4625 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
4626 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
4627 arm_attr_merge_7b.o): New rules.
4628 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
4630 * testsuite/Makefile.in: Regenerate.
4631 * testsuite/arm_attr_merge.sh: New file.
4632 * testsuite/arm_attr_merge_[67][ab].s: Same.
4634 2010-05-05 Nick Clifton <nickc@redhat.com>
4636 * po/es.po: Updated Spanish translation.
4638 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
4640 * Makefile.am (install-exec-local): Properly install gold as
4641 default cross linker.
4642 * Makefile.in: Regenerated.
4644 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
4645 Nick Clifton <nickc@redhat.com>
4647 * configure.ac (install_as_default): Define and set to false
4648 unless --enable-gold or --enable-gold=both/gold has been
4650 * configure: Regenerate.
4652 * Makefile.am (install-exec-local): Install the executable as
4653 'ld.gold'. If install_as_default is true then also install it as
4655 * Makefile.in: Regenerated.
4657 2010-04-24 Ian Lance Taylor <iant@google.com>
4659 * layout.cc (Layout::layout_reloc): In relocatable link don't
4660 combine reloc sections for grouped sections.
4662 2010-04-23 Sriraman Tallam <tmsriram@google.com>
4664 * gc.h (gc_process_relocs): Pass information on relocs pointing to
4665 sections that are not ordinary to icf.
4666 * icf.cc (get_section_contents): Handle relocation pointing to section
4667 with no object or shndx information.
4668 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
4669 * testsuite/Makefile.in: Regenerate.
4670 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
4671 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
4673 2010-04-22 Ian Lance Taylor <iant@google.com>
4675 * expression.cc (Expression::Expression_eval_info): Add
4676 result_alignment_pointer field.
4677 (Expression::eval_with_dot): Add result_alignment_pointer
4678 parameter. Change all callers.
4679 (Expression::eval_maybe_dot): Likewise.
4680 (class Binary_expression): Add alignment_pointer parameter to
4681 left_value and right_value. Change all callers.
4682 (BINARY_EXPRESSION): Set result alignment.
4683 (class Trinary_expression): Add alignment_pointer parameter to
4684 arg2_value and arg3_value. Change all callers.
4685 (Trinary_cond::value): Set result alignment.
4686 (Max_expression::value, Min_expression::value): Likewise.
4687 (Align_expression::value): Likewise.
4688 * script-sections.cc (class Sections_element): Add dot_alignment
4689 parameter to set_section_addresses virtual function. Update
4691 (class Output_section_element): Likewise.
4692 (Script_sections::create_segments): Add dot_alignment parameter.
4694 (Script_sections::create_segments_from_phdrs_clause): Likewise.
4695 (Script_sections::set_phdrs_clause_addresses): Likewise.
4696 * script-sections.h: Update declarations.
4697 * script.h: Update declarations.
4698 * output.h (Output_segment::set_minimum_p_align): Don't decrease
4700 * testsuite/script_test_3.t: Set large alignment.
4701 * testsuite/script_test_3.sh: Make sure that at least one LOAD
4702 segment has expected alignment.
4704 2010-04-22 Nick Clifton <nickc@redhat.com>
4706 * po/gold.pot: Updated by the Translation project.
4707 * po/vi.po: Updated Vietnamese translation.
4709 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
4711 * testsuite/Makefile.am (check_PROGRAMS): Add
4712 icf_virtual_function_folding_test.
4713 * testsuite/Makefile.in: Regenerated.
4715 2010-04-15 Andrew Haley <aph@redhat.com>
4717 * options.h (merge_exidx_entries): New option.
4718 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
4719 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
4720 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
4721 (Target_arm::merge_exidx_entries): New function.
4722 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
4723 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
4724 to Arm_exidx_fixup constructor.
4725 Add new arg, merge_exidx_entries.
4726 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
4727 Arm_output_section::fix_exidx_coverage.
4729 2010-04-18 Sriraman Tallam <tmsriram@google.com>
4731 * icf.cc (get_section_contents): Check for preemptible functions.
4732 Ignore addend when appropriate.
4733 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
4735 (add_from_relobj): Check for section folded.
4736 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
4737 * symtab.h (should_add_dynsym_entry): Add new parameter.
4738 * target-reloc.h (scan_relocs): Check for section folded.
4739 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
4740 Check reloc types for function pointers in shared objects.
4741 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
4743 (icf_preemptible_functions_test): New test case.
4744 (icf_string_merge_test): New test case.
4745 * testsuite.Makefile.in: Regenerate.
4746 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
4747 bar_glob. Refactor code.
4748 * testsuite/icf_preemptible_functions_test.cc: New file.
4749 * testsuite/icf_preemptible_functions_test.sh: New file.
4750 * testsuite/icf_string_merge_test.cc: New file.
4751 * testsuite/icf_string_merge_test.sh: New file.
4752 * testsuite/icf_virtual_function_folding_test.cc: New file.
4753 * testsuite/icf_virtual_function_folding_test.sh: New file.
4755 2010-04-14 Doug Kwan <dougkwan@google.com>
4757 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
4758 for local symbol recounting if we remove a section due to ICF.
4759 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
4760 there are no regular objects in input.
4762 2010-04-13 Doug Kwan <dougkwan@google.com>
4764 * arm.cc (Arm_input_section::set_final_data_size): Compute
4765 accurate final data size instead of using current data size.
4767 2010-04-09 Doug Kwan <dougkwan@google.com>
4769 * layout.cc (Layout::choose_output_section): Handle script section
4771 (Layout::make_output_section_for_script): Add section type parameter.
4772 Handle script section types.
4773 * layout.h (Layout::make_output_section_for_script): Add section
4775 * output.cc (Output_section::Output_section): Initialize data member
4777 (Output_section::do_reset_address_and_file_offset): Do not set address
4778 to 0 if section is a NOLOAD section.
4779 * output.h (Output_section::is_noload): New method.
4780 (Output_section::set_is_noload): Ditto.
4781 (Output_section::is_noload_): New data member.
4782 * script-c.h (Script_section_type): New enum type.
4783 (struct Parser_output_section_header): Add new file section_type.
4784 * script-sections.cc (Sections_element::output_section_name): Add
4785 parameter for returning script section type.
4786 (Output_section_definition::output_section_name): Ditto.
4787 (Output_section_definition::section_type)P; New method.
4788 (Output_section_definiton::script_section_type_name): Ditto.
4789 (Output_section_definition::script_section_type_): New data member.
4790 (Output_section_definition::Output_section_definition): Initialize
4791 data member Output_section_definition::script_section_type_.
4792 (Output_section_definition::create_sections): Pass script section type
4793 to Layout::make_output_section_for_script.
4794 (Output_section_definition::output_section_name): Return script
4795 section type to caller.
4796 (Output_section_definition::set_section_address): Do not advance
4797 dot value and load address if section type is NOLOAD. Set address
4798 of NOLOAD sections regardless of section flags.
4799 (Output_section_definition::print): Print section type if it is
4800 not SCRIPT_SECTION_TYPE_NONE.
4801 (Output_section_definition::section_type): New method.
4802 (Output_section_definition::script_section_type_name): Ditto.
4803 (Script_sections::output_section_name): Add new parameter
4804 PSECTION_TYPE for returning script section type. Pass it to
4805 section elements. Handle discard sections.
4806 (Sort_output_sections::operator()): Handle NOLOAD sections.
4807 * script-sections.h (Script_sections::Section_type): New enum type.
4808 (Script_sections::output_section_name): Add a new parameter for
4809 returning script section type.
4810 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
4812 * yyscript.y (union): Add new field SECTION_TYPE.
4813 (COPY, DSECT, INFO, NOLOAD): New tokens.
4814 (opt_address_and_section_type): Change type to output_section_header.
4815 (section_type): New non-terminal
4816 (section_header): Handle section type.
4817 (opt_address_and_section_type): Return section type value.
4819 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
4821 * testsuite/plugin_common_test_1.c (foo): Add prototype.
4822 * testsuite/plugin_common_test_2.c (foo): Likewise.
4824 2010-04-08 Doug Kwan <dougkwan@google.com>
4826 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
4828 * output.cc (Output_section::add_merge_input_section): Simplify
4829 code and return status of Output_merge_base::add_input_section.
4830 Update merge section map only if Output_merge_base::add_input_section
4833 2010-04-07 Doug Kwan <dougkwan@google.com>
4835 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
4836 if section is marked as containing instructions but has no mapping
4838 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
4839 correct section index.
4840 (Arm_relobj::find_linked_text_section): Ditto.
4842 2010-04-07 Cary Coutant <ccoutant@google.com>
4844 * archive.cc (include_member): Destroy Read_symbols_data object before
4846 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
4847 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
4848 (Read_symbols_data::~Read_symbols_data) New destructor.
4849 (Section_relocs::Section_relocs) New constructor.
4850 (Section_relocs::~Section_relocs) New destructor.
4851 (Read_relocs_data::Read_relocs_data) New constructor.
4852 (Read_relocs_data::~Read_relocs_data) New destructor.
4853 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
4854 pointers to NULL after deleting.
4856 2010-04-07 Doug Kwan <dougkwan@google.com>
4858 * arm.cc: Replace "endianity" with "endianness" in comments.
4859 (Arm_exidx_cantunwind): Ditto.
4860 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
4861 (Arm_relobj::merge_flags_and_attributes): New method.
4862 (Arm_relobj::merge_flags_and_attributes_): New data member.
4863 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
4864 (Arm_relobj::scan_sections_for_stubs): Ditto.
4865 (Arm_relobj::do_read_symbols): Check to see if we really want to
4866 merge processor-specific flags and attributes. Exit early if
4867 an object is empty except for section names and the undefined symbol.
4868 (Target_arm::do_finalize_sections): Move check for ELF format to
4869 Arm_relobj::do_read_symbols. Merge processor specific flags and
4870 attributes from a regular object only when we have determined that
4871 it is aapropriate. Do not create an .ARM.attributes section in
4872 output if there is no regular input object.
4873 (Target_arm::merge_processor_specific_flags): Check
4874 --warn-mismatch before printing any error.
4875 (Target_arm::merge_object_attributes): Ditto.
4876 * gold.cc (queue_middle_tasks): Handle the case in which there is
4877 no regular object in input.
4878 * options.cc (General_options::parse_EB): New method.
4879 (General_options::parse_EL): Same.
4880 (General_options::General_options): Initialize endianness_.
4881 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
4883 (General_options::Endianness): New enum.
4884 (General_options::endianness): New method.
4885 (General_options::endianness_): New data member.
4886 * parameters.cc (Parameters::set_options): Check target endianness.
4887 (Parameters::set_target_once): Ditto.
4888 (Parameters::check_target_endianness): New method.
4889 (parameters_force_valid_target): If either -EL or -EB is specified,
4890 use it to define endianness of default target.
4891 * parameters.h (Parameters::check_target_endianness): New method
4893 * target.h (class Target): Change "endianity" to "endianness"
4896 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4898 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
4899 * configure: Regenerate.
4900 * Makefile.in: Regenerate.
4901 * testsuite/Makefile.in: Regenerate.
4903 2010-04-06 Cary Coutant <ccoutant@google.com>
4906 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
4907 prevailing definitions of common symbols.
4908 * testsuite/plugin_test_6.sh: New test case.
4909 * testsuite/plugin_common_test_1.c: New test case.
4910 * testsuite/plugin_common_test_2.c: New test case.
4911 * testsuite/Makefile.am (plugin_test_6): New test case.
4912 * testsuite/Makefile.in: Regenerate.
4914 2010-04-06 Nick Clifton <nickc@redhat.com>
4916 * po/vi.po: New Vietnamese translation.
4918 2010-03-30 Doug Kwan <dougkwan@google.com>
4920 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
4922 2010-03-25 Doug Kwan <dougkwan@google.com>
4924 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
4925 to avoid a conversion warning on a 32-bit host.
4927 2010-03-24 Ian Lance Taylor <iant@google.com>
4929 * testsuite/script_test_3.t: Add a TLS segment.
4930 * testsuite/Makefile.am (check_PROGRAMS): Add
4931 tls_phdrs_script_test.
4932 (tls_phdrs_script_test_SOURCES): Define.
4933 (tls_phdrs_script_test_DEPENDENCIES): Define.
4934 (tls_phdrs_script_test_LDFLAGS): Define.
4935 (tls_phdrs_script_test_LDADD): Define.
4936 * testsuite/Makefile.in: Rebuild.
4938 2010-03-23 Cary Coutant <ccoutant@google.com>
4940 * fileread.cc (find_or_make_view): Fix comment.
4942 2010-03-23 Ian Lance Taylor <iant@google.com>
4944 * script-sections.cc (class Orphan_section_placement): Define
4945 PLACE_TLS and PLACE_TLS_BSS.
4946 (Orphan_section_placement::Orphan_section_placement): Initialize
4948 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
4949 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
4950 (tls_script_test_SOURCES): Define.
4951 (tls_script_test_DEPENDENCIES): Define.
4952 (tls_script_test_LDFLAGS): Define.
4953 (tls_script_test_LDADD): Define.
4954 * testsuite/Makefile.in: Rebuild.
4956 2010-03-22 Doug Kwan <dougkwan@google.com>
4958 * arm.cc (Arm_relocate_functions::abs8,
4959 Arm_relocate_functions::abs16): Use correct check for overflow
4960 specified in the ARM ELF specs.
4961 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
4962 target of a BLX instruction specially.
4963 (Reloc_stub::stub_type_for_reloc): Ditto.
4964 (Relocate::relocate): Use symbolic names instead of numeric relocation
4965 codes to report error.
4966 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
4968 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
4969 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
4970 thumb2_blx_out_of_range.stdout
4971 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
4972 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
4973 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
4974 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
4975 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
4976 thumb2_blx_in_range, thumb2_blx_in_range.o,
4977 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
4978 thumb2_blx_out_of_range.o): New rules.
4979 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
4980 thumb2_blx_in_range and thumb2_blx_out_of_range.
4981 * testsuite/Makefile.in: Regenerate.
4982 * arm_branch_in_range.sh: Add tests for THUMB BLX.
4983 * testsuite/thumb_blx_in_range.s: New file.
4984 * testsuite/thumb_blx_out_of_range.s: New file.
4986 2010-03-22 Rafael Espindola <espindola@google.com>
4988 * archive.cc (Should_include): Move to archive.h.
4989 (should_include_member): Make it a member of Archive.
4991 (Add_lib_group_symbols): New.
4992 * archive.h: Include options.h.
4993 (Archive_member): Moved from Archive.
4994 (Should_include): Moved from archive.cc.
4996 (Add_lib_group_symbols): New.
4997 * dynobj.cc (do_should_include_member): New.
4998 * dynobj.h (do_should_include_member): New.
4999 * gold.cc (queue_initial_tasks): Update call to queue.
5000 * main.cc (main): Print lib group stats.
5001 * object.cc (do_should_include_member): New.
5002 * object.h: Include archive.h.
5003 (Object::should_include_member): New.
5004 (Object::do_should_include_member): New.
5005 (Sized_relobj::do_should_include_member): New.
5006 * options.cc (General_options::parse_start_lib): New.
5007 (General_options::parse_end_lib): New.
5008 (Input_arguments::add_file): Handle lib groups.
5009 (Input_arguments::start_group): Check we are not in a lib.
5010 (Input_arguments::start_lib): New.
5011 (Input_arguments::end_lib): New.
5012 * options.h (General_options): Add start_lib and end_lib.
5013 (Input_argument::lib_): New.
5014 (Input_argument::lib): New.
5015 (Input_argument::is_lib): New.
5016 (Input_file_lib): New.
5017 (Input_arguments::in_lib_): New.
5018 (Input_arguments::in_lib): New.
5019 (Input_arguments::start_lib): New.
5020 (Input_arguments::end_lib_): New.
5021 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5022 in unused members as preempted.
5023 (Sized_pluginobj::do_should_include_member): New.
5024 * plugin.h (Sized_pluginobj::do_should_include_member): New.
5025 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5027 (Read_symbols::do_whole_lib_group): New.
5028 (Read_symbols::do_lib_group): New.
5029 (Read_symbols::do_read_symbols): Handle lib groups.
5030 (Read_symbols::get_name): Handle lib groups.
5031 * readsyms.h (Read_symbols): Add an archive member pointer.
5032 (Read_symbols::do_whole_lib_group): New.
5033 (Read_symbols::do_lib_group): New.
5034 (Read_symbols::member_): New.
5035 * script.cc (read_input_script): Update call to queue_soon.
5037 2010-03-19 Doug Kwan <dougkwan@google.com>
5039 * arm.cc (Stub_table::Stub_table): Initialize new data members
5040 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5041 (Stub_table::add_reloc_stub): Assign stub offset and update
5042 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5043 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
5045 (Stub_table::update_data_size_and_addralign): Use
5046 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
5047 instead of going over all reloc stubs.
5048 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
5049 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5050 Stringpool_template::offset_ to size of Stringpool_char.
5051 (Stringpool_template::new_key_offset): Remove code to initialize
5052 Stringpool_template::offset_.
5053 * stringpool.h (Stringpool_template::set_no_zero_null): Set
5054 Stringpool_template::offset_ to zero.
5056 2010-03-15 Doug Kwan <dougkwan@google.com>
5058 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5060 (Stringpool_template::new_key_offset): New method.
5061 (Stringpool_template::add_string): Assign offsets when adding new
5063 (Stringpool_template::set_string_offsets): Do not set string offsets
5064 when not optimizing.
5065 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5067 (Chunked_vector::clear): Clear size_.
5068 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5069 (Chunked_vector::size): Return size_.
5070 (Chunked_vector::push_back): Use size_ to find insert position.
5071 (Chunked_vector::size_): New data member.
5072 (Stringpool_template::set_no_zero_null): Assert string set is empty.
5073 (Stringpool_template::new_key_offset): New method declaration.
5074 (Stringpool_template::offset_): New data member.
5076 2010-03-15 Rafael Espindola <espindola@google.com>
5078 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
5079 Add_symbols' constructor.
5080 * readsyms.h (Add_symbols): Remove the input_group member.
5082 2010-03-10 Ian Lance Taylor <iant@google.com>
5084 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
5085 target to ask whether a reference to a symbol requires a stack
5087 * target.h (Target::is_call_to_non_split): New function.
5088 (Target::do_is_call_to_non_split): Declare virtual function.
5089 * target.cc: Include "symtab.h".
5090 (Target::do_is_call_to_non_split): New function.
5091 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
5093 2010-03-10 Cary Coutant <ccoutant@google.com>
5095 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
5096 (File_read::open[1]): Remove initial mapping of whole_file_view_.
5097 (File_read::open[2]): Add whole_file_view_ to list of views.
5098 (File_read::make_view): Remove test of whole_file_view_.
5099 (File_read::find_or_make_view): Create whole_file_view_ if
5101 (File_read::clear_views): Replace bool parameter with enum;
5102 adjust all callers. Don't delete views with permanent data;
5103 do delete cached views and views from archives if
5104 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
5105 if clearing the corresponding view.
5106 * fileread.h (File_read::Clear_views_mode): New enum.
5107 (File_read::View::is_permanent_view): New method.
5108 (File_read::clear_views): Replace bool parameter
5109 with enum; adjust all callers.
5110 * options.h (General_options): Change keep_files_mapped option;
5111 add map_whole_files.
5112 * readsyms.cc (Add_symbols::run): Delete sd_ object before
5114 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
5117 2010-03-10 David S. Miller <davem@davemloft.net>
5119 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
5121 2010-03-09 Sriraman Tallam <tmsriram@google.com>
5123 * icf.cc (get_section_contents): Add '@' marker after processing the
5126 2010-03-08 Doug Kwan <dougkwan@google.com>
5128 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
5129 due to a conversion warning.
5130 (Arm_relobj::update_output_local_symbol_count): Check for local
5131 symbol with unset output index.
5133 2010-03-05 Ian Lance Taylor <iant@google.com>
5135 * options.h (class General_options): Add --spare-dynamic-tags.
5136 * output.cc (Output_data_dynamic::set_final_data_size): Implement
5137 --spare-dynamic-tags.
5139 2010-03-05 Ian Lance Taylor <iant@google.com>
5141 * incremental.cc: Include "libiberty.h".
5143 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
5145 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
5146 function, is_info_ member.
5147 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
5148 (Versions::Versions): Update caller.
5149 (Versions::define_base_version): Likewise.
5150 (Versions::add_def): Likewise.
5152 2010-03-03 Sriraman Tallam <tmsriram@google.com>
5154 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
5155 (Scan::possible_function_pointer_reloc): New function.
5156 (Scan::local_reloc_may_be_function_pointer): Change to call
5157 possible_function_pointer_reloc.
5158 (Scan::global_reloc_may_be_function_pointer): Ditto.
5159 * icf.h (Icf::check_section_for_function_pointers): Change to reject
5160 relocations in ".data.rel.ro._ZTV" section.
5161 * testsuite/icf_safe_so_test.sh: Change to pass i386.
5162 * testsuite/icf_safe_so_test.cc: Ditto.
5163 * testsuite/icf_safe_test.cc: Ditto.
5164 * testsuite/icf_safe_test.sh: Ditto.
5166 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5167 Ian Lance Taylor <iant@google.com>
5169 * target-reloc.h (relocate_section): Check the symbol table index
5170 for -1U before setting the local symbol index.
5171 (scan_relocatable_relocs): If copying the relocation, record that
5172 the local symbol is required.
5173 * object.h (Symbol_value::is_output_symtab_index_set): New
5175 (Symbol_value::may_be_discarded_from_output_symtab): New
5177 (Symbol_value::has_output_symtab_entry): New function.
5178 (Symbol_value::needs_output_symtab_entry): Remove.
5179 (Symbol_value::output_symtab_index): Make sure the symbol index is
5181 (Symbol_value::set_output_symtab_index): Make sure the symbol
5182 index is not set. Make sure the new index is valid.
5183 (Symbol_value::set_must_have_output_symtab_entry): New function.
5184 (Symbol_value::has_output_dynsym_entry): New function.
5185 (Symbol_value::set_output_dynsym_index): Make sure the new index
5187 (Sized_relobj::set_must_have_output_symtab_entry): New function.
5188 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
5189 local symbol if permitted.
5190 (Sized_relobj::do_finalize_local_symbols): Call
5191 is_output_symtab_index_set rather than needs_output_symtab_entry.
5192 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
5193 rather than needs_output_symtab_entry. Call
5194 has_output_dynsym_entry rather than needs_output_dynsym_entry.
5195 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
5196 is_output_symtab_index_set rather than needs_output_symtab_entry.
5197 * testsuite/discard_locals_relocatable_test.c: New file.
5198 * testsuite/discard_locals_test.sh: Test -r.
5199 * testsuite/Makefile.am (check_DATA): Add
5200 discard_locals_relocatable_test1.syms,
5201 discard_local_relocatable_test2.syms.
5202 (MOSTLYCLEANFILES): Likewise. Also add
5203 discard_locals_relocatable_test1.lout and
5204 discard_locals_relocatable_test2.out.
5205 (discard_locals_relocatable_test1.syms): New target.
5206 (discard_locals_relocatable_test.o): New target.
5207 (discard_locals_relocatable_test1.out): New target.
5208 (discard_locals_relocatable_test2.syms): New target.
5209 (discard_locals_relocatable_test2.out): New target.
5210 (various): Add missing ../ld-new dependencies.
5211 * testsuite/Makefile.in: Rebuild.
5213 2010-03-03 Nick Clifton <nickc@redhat.com>
5215 * po/fi.po: New Finnish translation.
5217 2010-03-01 Doug Kwan <dougkwan@google.com>
5219 * layout.cc (Layout::Layout): Force section types of .init_array*,
5220 .preinit_array* and .fini_array* sections.
5221 * output.cc (Output_section::Input_section_sort_entry::has_priority):
5222 Fix check of return value of std::string::find.().
5223 (Output_section::Input_section_sort_compare::operator()): Remove
5224 comment about .init_array.
5225 (Output_section::Input_section_sort_init_fini_compare::operator()):
5227 (Output_section::sort_attached_input_sections): Handle .init_array
5228 and .fini_array specially.
5229 * output.h (Output_section::Inut_section_sort_compare): Update
5231 (Output_section::Input_section_sort_init_fini_compare): New struct.
5233 2010-02-26 Doug Kwan <dougkwan@google.com>
5235 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
5236 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
5237 * testsuite/debug_msg.sh: Avoid matching source line number for
5238 use of global variable undef_int.
5240 2010-02-26 Doug Kwan <dougkwan@google.com>
5242 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
5243 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
5244 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
5245 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
5246 * options.cc (General_options::General_options): Initialize member
5248 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
5249 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
5250 and rm_no_fix_v4bx.stdout
5251 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
5252 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
5253 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
5254 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
5255 and arm_no_fix_v4bx.
5256 * Makefile.in: Regenerate.
5257 * testsuite/arm_fix_v4bx.s: New file.
5258 * testsuite/arm_fix_v4bx.sh: Ditto.
5260 2010-02-24 Doug Kwan <dougkwan@google.com>
5262 * arm.cc (Target_arm::got_section): Make the .got section the first
5263 non RELRO section in the data segment.
5264 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
5265 suffixes of section names.
5267 2010-02-24 Doug Kwan <dougkwan@google.com>
5269 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
5270 flags and attributes merging if an input file is a binary file.
5271 * fileread.cc (Input_file::open): Record format of original file.
5272 * fileread.h (Input_file::Format): New enum type.
5273 (Input_file::Input_file): Initialize data member format_.
5274 (Input_file::format): New method definition.
5275 (Input_file::format_):: New data member.
5277 2010-02-24 Doug Kwan <dougkwan@google.com>
5279 * arm.cc (Arm_output_data_got): New class.
5280 (ARM_TCB_SIZE): New constant
5281 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
5282 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
5283 If user uses a script with a SECTIONS clause, issue only a warning
5284 for a misplaced EXIDX input section. Otherwise, issue an error.
5285 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
5287 (Target_arm::got_mode_index_entry): Handle static linking.
5288 (Target_arm::Scan::local): Ditto.
5289 (Target_arm::Scan::global): Ditto.
5290 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
5291 all incorrectly implemented relocations.
5292 (Target_arm::fix_exidx_coverage): Pass layout to
5293 Arm_output_section::fix_exidx_coverage.
5294 * layout.cc (Layout::section_name_mapping): Remove trailing dots
5295 from ".ARM.exidx." and ".ARM.extab.".
5297 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5299 * arm.cc (Target_arm::do_finalize_sections): Create attribute
5300 section if it does not already exist.
5301 * attributes.cc (Attributes_section_data::Attributes_section_data):
5302 Don't crash if size is zero.
5304 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5305 Ian Lance Taylor <iant@google.com>
5307 * gold.cc (queue_middle_tasks): If no input files were opened,
5309 * workqueue.h (Task_function::Task_function): Assert that there is
5312 2010-02-22 Doug Kwan <dougkwan@google.com>
5314 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
5315 * icf.cc (get_section_contents): Cast snprintf arguments to long long
5316 types to avoid warnings due to different uint64_t implementations
5319 2010-02-21 Doug Kwan <dougkwan@google.com>
5321 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
5322 handling of the maximum backward branch offset.
5323 (Arm_relocate_functions::thumb_branch_common): Ditto.
5324 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
5325 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
5326 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
5327 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
5328 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
5329 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
5330 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
5331 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
5332 thumb_bl_out_of_range thumb_bl_out_of_range.o,
5333 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
5334 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
5335 thumb2_bl_out_of_range.o): New rules.
5336 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
5337 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
5338 thumb2_bl_out_of_range
5339 * testsuite/Makefile.in: Regenerate.
5340 * testsuite/arm_bl_in_range.s: New file.
5341 * testsuite/arm_bl_out_of_range.s: Ditto.
5342 * testsuite/arm_branch_in_range.sh: Ditto.
5343 * testsuite/arm_branch_range.t: Ditto.
5344 * testsuite/thumb2_branch_range.t: Ditto.
5345 * testsuite/thumb_bl_in_range.s: Ditto.
5346 * testsuite/thumb_bl_out_of_range.s: Ditto.
5347 * testsuite/thumb_branch_range.t: Ditto.
5349 2010-02-20 Sriraman Tallam <tmsriram@google.com>
5351 * gc.h (gc_process_relocs): Change vectors to point to the new list.
5352 Add reloc offset information.
5353 * icf.cc (get_section_contents): Change iterators to point to the new
5354 vectors. Add reloc offset information to the contents.
5355 * icf.h (Icf::Sections_reachable_info): New typedef.
5356 (Icf::Sections_reachable_list): New typedef.
5357 (Icf::Offset_info): New typedef.
5358 (Icf::Reloc_info): New struct typedef.
5359 (Icf::Reloc_info_list): New typedef.
5360 (Icf::symbol_reloc_list): Delete method.
5361 (Icf::addend_reloc_list): Delete method.
5362 (Icf::section_reloc_list): Delete method.
5363 (Icf::reloc_info_list): New method.
5364 (Icf::reloc_info_list_): New member.
5366 2010-02-19 Doug Kwan <dougkwan@google.com>
5368 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
5369 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
5370 * arm.cc (Arm_relocation_functions): New forward declaration.
5371 (Target_arm::Target_arm): Initialize new data members
5372 got_mod_index_offset_ and tls_base_symbol_defined_.
5373 (Target_arm::Relocate::relocate_tls): New method.
5374 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
5375 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
5377 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
5378 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
5379 (Target_arm::got_mod_index_offset_,
5380 Target_arm::tls_base_symbol_defined_): New data members.
5381 (Target_arm::Scan::local, Target::Scan::global,
5382 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
5385 2010-02-18 Doug Kwan <dougkwan@google.com>
5387 * arm.cc (Arm_relobj::find_linked_text_section): New method.
5388 (Arm_relobj::make_exidx_input_section): Pass section index of linked
5389 text section as a parameter becuase some broken tools may not set
5390 the link in section header.
5391 (Target_arm::has_got_section): New method.
5392 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
5393 without any mapping symbol as data only. Remove warning.
5394 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
5395 link in its section header, try to discover the link by inspecting the
5396 REL31 relocation at the beginning of the section.
5397 (Target_arm::Scan::check_non_pic): Report name of offending relocation
5399 (Target_arm::Scan::global): Treat any reference to the symbol
5400 _GLOBAL_OFFSET_TABLE_ as a GOT access.
5402 2010-02-12 Sriraman Tallam <tmsriram@google.com>
5404 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
5405 (Scan::global_reloc_may_be_function_pointer): New function.
5406 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5407 (Scan::global_reloc_may_be_function_pointer): New function.
5408 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5409 (Scan::global_reloc_may_be_function_pointer): New function.
5410 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
5411 (Scan::global_reloc_may_be_function_pointer): New function.
5412 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
5413 (Scan::global_reloc_may_be_function_pointer): New function.
5414 (Scan::possible_function_pointer_reloc): New function.
5415 (Target_x86_64::can_check_for_function_pointers): New function.
5416 * gc.h (gc_process_relocs): Scan relocation types to determine if
5417 function pointers were taken for targets that support it.
5418 * icf.cc (Icf::find_identical_sections): Include functions for
5419 folding in safe ICF whose pointer is not taken.
5420 * icf.h (Secn_fptr_taken_set): New typedef.
5421 (fptr_section_id_): New member.
5422 (section_has_function_pointers): New function.
5423 (set_section_has_function_pointers): New function.
5424 (check_section_for_function_pointers): New function.
5425 * options.h: Fix comment for safe ICF option.
5426 * target.h (can_check_for_function_pointers): New function.
5427 * testsuite/Makefile.am: Add icf_safe_so_test test case.
5428 Modify icf_safe_test for X86-64.
5429 * testsuite/Makefile.in: Regenerate.
5430 * testsuite/icf_safe_so_test.cc: New file.
5431 * testsuite/icf_safe_so_test.sh: New file.
5432 * testsuite/icf_safe_test.cc (kept_func_3): New function.
5433 (main): Change to take pointer to function kept_func_3.
5434 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
5435 folding is done correctly for X86-64.
5437 2010-02-12 David S. Miller <davem@davemloft.net>
5439 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
5440 is_symbolless parameter.
5441 (Output_reloc<SHT_REL>::is_symbolless): New.
5442 (Output_reloc<SHT_REL>::is_symbolless_): New.
5443 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
5444 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
5445 (Output_reloc<SHT_RELA>::is_symbolless): New.
5446 (Output_data_reloc::add_global): Handle is_symbolless.
5447 (Output_data_reloc::add_global_relative): Likewise.
5448 (Output_data_reloc::add_local): Likewise.
5449 (Output_data_reloc::add_local_relative): Likewise.
5450 (Output_data_reloc::add_symbolless_global_addend): New.
5451 (Output_data_reloc::add_symbolless_local_addend): New.
5452 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
5454 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
5455 instead of ->is_relative_
5456 (Output_reloc::write): Likewise.
5457 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
5458 (Output_reloc::write_rel): Simplify.
5460 * sparc.cc (Target_sparc::Scan::local): Use
5461 ->add_symbolless_local_addend as needed.
5462 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
5463 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
5464 based upon relocation offset.
5466 2010-02-11 Doug Kwan <dougkwan@google.com>
5468 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
5469 (Target_arm::Scan::global): Ditto. Also remove a comment before the
5470 beginning of function.
5471 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
5472 and MOVT_ABS relocations. Those are non issued in scanning. Fix
5473 parameter is_32bit in calls to should_apply_static_reloc.
5474 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
5475 (check_DATA): Add arm_abs_global.stdout.
5476 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
5477 arm_abs_global.stdout): New rules.
5478 (MOSTLLYCLEANFILES): Add arm_abs_global
5479 * Makefile.in: Regenerate.
5480 * testsuite/arm_abs_global.s: New file.
5481 * testsuite/arm_abs_global.sh: Ditto.
5482 * testsuite/arm_abs_lib.s: Ditto.
5484 2010-02-11 Ian Lance Taylor <iant@google.com>
5486 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
5488 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
5489 Allocate_commons_task first.
5490 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
5491 task, rather than symtab_lock_.
5492 (Gc_process_relocs::~Gc_process_relocs): New function.
5493 (Gc_process_relocs::is_runnable): Check this_blocker_.
5494 (Gc_process_relocs::locks): Use next_blocker_ rather than
5496 (Scan_relocs::~Scan_relocs): New function.
5497 (Scan_relocs::is_runnable): Check this_blocker_ rather than
5499 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
5501 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
5502 fields. Add this_blocker_ and next_blocker_ fields. Adjust
5503 constructor accordingly.
5504 (class Gc_process_relocs): Likewise.
5505 (class Scan_relocs): Likewise.
5506 * common.h (class Allocate_commons_task): Remove symtab_lock_
5507 field, and corresponding constructor parameter.
5508 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
5510 (Allocate_commons_task::locks): Likewise.
5512 2010-02-11 Ian Lance Taylor <iant@google.com>
5514 * gold-threads.h (class Once): Define.
5515 (class Initialize_lock): Rewrite as child of Once.
5516 * gold-threads.cc (class Once_initialize): Define.
5517 (once_pointer_control): New static variable.
5518 (once_pointer, once_arg): New static variables.
5519 (c_run_once): New static function.
5520 (Once::Once, Once::run_once, Once::internal_run): New functions.
5521 (class Initialize_lock_once): Remove.
5522 (initialize_lock_control): Remove.
5523 (initialize_lock_pointer): Remove.
5524 (initialize_lock_once): Remove.
5525 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
5526 (Initialize_lock::initialize): Rewrite.
5527 (Initialize_lock::do_run_once): New function.
5528 * archive.cc (Archive::interpret_header): Only clear name if it is
5530 * fileread.cc: Include "gold-threads.h"
5531 (file_counts_lock): New static variable.
5532 (file_counts_initialize_lock): Likewise.
5533 (File_read::release): Only increment counts when using --stats.
5534 Use a lock around the increment.
5535 * parameters.cc (class Set_parameters_target_once): Define.
5536 (set_parameters_target_once): New static variable.
5537 (Parameters::Parameters): Move here from parameters.h.
5538 (Parameters::set_target): Rewrite.
5539 (Parameters::set_target_once): New function.
5540 (Parameters::clear_target): Move here and rewrite.
5541 * parameters.h (class Parameters): Update declarations. Add
5542 set_parameters_target_once_ field.
5543 (Parameters::Parameters): Move to parameters.cc.
5544 (Parameters::clear_target): Likewise.
5545 * readsyms.cc (Read_symbols::do_group): Create a Start_group
5547 (Start_group::~Start_group): New function.
5548 (Start_group::is_runnable): New function.
5549 (Start_group::locks, Start_group::run): New functions.
5550 (Finish_group::run): Change saw_undefined to size_t.
5551 * readsyms.h (class Start_group): Define.
5552 (class Finish_group): Change saw_undefined_ field to size_t.
5553 (Finish_group::Finish_group): Remove saw_undefined and
5554 this_blocker parameters. Change all callers.
5555 (Finish_group::set_saw_undefined): New function.
5556 (Finish_group::set_blocker): New function.
5557 * symtab.h (class Symbol_table): Change saw_undefined to return
5558 size_t. Change saw_undefined_ field to size_t.
5559 * target-select.cc (Set_target_once::do_run_once): New function.
5560 (Target_selector::Target_selector): Initialize set_target_once_
5561 field. Don't initialize lock_ and initialize_lock_ fields.
5562 (Target_selector::instantiate_target): Rewrite.
5563 (Target_selector::set_target): New function.
5564 * target-select.h (class Set_target_once): Define.
5565 (class Target_selector): Update declarations. Make
5566 Set_target_once a friend. Remove lock_ and initialize_lock_
5567 fields. Add set_target_once_ field.
5569 2010-02-10 Ian Lance Taylor <iant@google.com>
5571 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
5573 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
5574 (queue_middle_tasks): Add all blockers before queueing any tasks.
5575 (queue_final_tasks): Likewise.
5576 * token.h (Task_token::add_blockers): New function.
5577 * object.h (Input_objects::number_of_relobjs): New function.
5579 2010-02-10 Ian Lance Taylor <iant@google.com>
5581 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
5582 shared, not if not position independent.
5583 * x86_64.cc (Relocate::relocate_tls): Likewise.
5584 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
5585 (tls_pie_pic_test): New target.
5586 * testsuite/Makefile.in: Rebuild.
5588 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
5589 (tls_test_main_pie.o, tls_test_pie.o): New targets.
5590 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
5591 * testsuite/Makefile.in: Rebuild.
5593 2010-02-09 David S. Miller <davem@davemloft.net>
5595 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
5596 R_SPARC_RELATIVE using ->add_local_relative().
5597 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
5599 * output.h (Output_data_dynamic::add_section_size): New method
5600 that takes two Output_data objects.
5601 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
5602 entry param. Handle it in initializers.
5603 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
5604 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
5605 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
5607 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
5608 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
5609 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
5610 for dynrel_includes_plt.
5611 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5612 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5613 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
5615 (Target_sparc::do_finalize_sections): Update to pass true for
5616 dynrel_includes_plt.
5617 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
5618 output before .rela.plt
5619 (Target_powerpc::do_finalize_sections): Update to pass true for
5620 dynrel_includes_plt when 32-bit.
5622 2010-02-08 Doug Kwan <dougkwan@google.com>
5624 * arm.cc (Arm_relobj::simple_input_section_output_address): New
5626 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
5627 Arm_relobj::scan_section_for_cortex_a8_stubs,
5628 Arm_relobj::do_relocation_section): Instead of calling
5629 Output_section::output_address, use faster
5630 Arm_relobj::simple_input_section_output_address.
5632 2010-02-08 David S. Miller <davem@davemloft.net>
5634 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
5635 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
5636 relocation helper function.
5638 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
5639 just like R_SPARC_GOT{10,13,22}.
5640 (Target_sparc::Scan::local): Likewise.
5641 (Target_sparc::Relocate:relocate): Likewise.
5643 2010-02-06 Ian Lance Taylor <iant@google.com>
5645 * configure.ac: Rewrite targetobjs duplicate removal code to use
5646 only shell constructs.
5647 * configure: Rebuild.
5649 2010-02-05 Doug Kwan <dougkwan@google.com>
5652 * arm.cc (Arm_relobj::section_is_scannable): New method.
5653 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
5654 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
5656 2010-02-04 Doug Kwan <dougkwan@google.com>
5659 * arm-reloc-property.cc (cstdio): Include.
5660 * configure.ac (targetobjs): Remove duplicates.
5661 * configure: Regenerate.
5662 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
5663 big and little endian version for a given address size.
5665 2010-02-03 Doug Kwan <dougkwan@google.com>
5667 * arm-reloc-property.cc
5668 (Arm_reloc_property_table::reloc_name_in_error_message): New method
5670 * arm-reloc-property.h
5671 (Arm_reloc_property_table::get_implemented_static_reloc_property):
5672 New method definition.
5673 (Arm_reloc_property_table::reloc_name_in_error_message): New method
5675 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
5677 (GOT_PREL): Change implemented to Y.
5678 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
5679 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
5680 (Arm_relocate_functions::movw_abs_nc): Remove method.
5681 (Arm_relocate_functions::movt_abs): Ditto.
5682 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
5683 (Arm_relocate_functions::thm_movt_abs): Ditto.
5684 (Arm_relocate_functions::movw_rel_nc): Ditto.
5685 (Arm_relocate_functions::movw_rel): Ditto.
5686 (Arm_relocate_functions::movt_rel): Ditto.
5687 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
5688 (Arm_relocate_functions:thm_movw_rel): Ditto.
5689 (Arm_relocate_functions:thm_movt_rel): Ditto.
5690 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
5691 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
5692 New method definitions.
5693 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
5694 (Arm_relocation_functions::arm_grp_ldr): Ditto.
5695 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
5696 (Arm_relocation_functions::arm_grp_ldc): Ditto.
5697 (Target_arm::Relocate::relocate): Check for non-static or
5698 unimplemented relocation code and exit early. Change calls to
5699 Target_arm::reloc_uses_thumb_bit and
5700 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
5701 instead. Refactor code to handle similar relocations to increase
5702 code sharing. Remove check for unsupported relocation code in switch
5704 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
5705 relocation property table to find out size. Change error message to
5706 print out the name of a relocation code instead of the numeric value.
5707 (Target_arm::scan_reloc_for_stub): Use relocation property table
5708 instead of calling Target_arm::reloc_uses_thumb_bit().
5710 2010-02-02 Doug Kwan <dougkwan@google.com>
5712 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
5713 types of relaxed input section.
5715 2010-02-02 Doug Kwan <dougkwan@google.com>
5717 * Makefile.am (HFILES): Add arm-reloc-property.h.
5719 (TARGETSOURCES): Add arm-reloc-property.cc
5720 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
5721 (libgold_a_SOURCES): $(DEFFILES)
5722 * Makefile.in: Regenerate.
5723 * arm-reloc-property.cc: New file.
5724 * arm-reloc-property.h: New file.
5725 * arm-reloc.def: New file.
5726 * arm.cc: Update comments.
5727 (arm-reloc-property.h): New included header.
5728 (arm_reloc_property_table): New global variable.
5729 (Target_arm::do_select_as_default_target): New method definition.
5730 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
5731 arm-reloc-property to targ_extra_obj.
5732 * parameters.cc (set_parameters_target): Call
5733 Target::select_as_default_target().
5734 * target.h (Target::select_as_default_target): New method definition.
5735 (Target::do_select_as_default_target): Same.
5737 2010-02-01 Doug Kwan <dougkwan@google.com>
5739 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
5740 first_output_text_section_.
5741 (Arm_exidx_fixup::first_output_text_section): New method definition.
5742 (Arm_exidx_fixup::first_output_text_section_): New data member.
5743 (Arm_exidx_fixup::process_exidx_section): Record the first text
5744 output section seen.
5745 (Arm_output_section::fix_exidx_coverage): Set correct linked section
5746 and entsize in output section header.
5748 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5750 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
5751 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
5752 (Arm_relocate_functions::thm_alu11): New Method.
5753 (Arm_relocate_functions::thm_pc8): New Method.
5754 (Arm_relocate_functions::thm_pc12): New Method.
5755 (Target_arm::Scan::local): Handle the relocations.
5756 (Target_arm::Scan::global): Likewise.
5757 (Target_arm::Relocate::relocate): Likewise.
5758 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
5760 2010-01-29 Doug Kwan <dougkwan@google.com>
5762 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
5763 of relocation types as ld.
5765 2010-01-29 Doug Kwan <dougkwan@google.com>
5767 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
5769 (Arm_relocate_functions::thumb_branch_common): Ditto.
5770 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
5771 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
5772 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
5773 Arm_relocate_functions::jump24): Remove.
5774 (Target_arm::Relocate::relocate): Adjust code to call
5775 Arm_relocation_functions::arm_branch_common and
5776 Arm_relocation_functions::thumb_branch_common instead of their removed
5777 wrappers. Merge switch-cases together to reduce source code size.
5779 2010-01-29 Doug Kwan <dougkwan@google.com>
5781 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
5782 output_local_symbol_count_needs_update_.
5783 (Arm_relobj::output_local_symbol_count_needs_update,
5784 Arm_relobj::set_output_local_symbol_count_needs_update,
5785 Arm_relobj::update_output_local_symbol_count): New methods.
5786 (Arm_relobj::output_local_symbol_count_needs_update_): New data
5788 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
5789 of pointed function as in a R_ARM_PREL31 relocation.
5790 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
5791 for output local symbol count updating.
5792 (Target_arm::do_relax): Update output local symbol counts in objects
5794 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
5796 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5798 * arm.cc: Added support for the ARM relocations:
5799 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
5800 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
5801 (Arm_relocate_functions::movw_rel_nc): Renamed (was
5803 (Arm_relocate_functions::movw_rel): New method.
5804 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
5805 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
5807 (Arm_relocate_functions::thm_movw_rel): New method.
5808 (Arm_relocate_functions::thm_movt_rel): Renamed (was
5810 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
5812 (Target_arm::Scan::global): Likewise.
5813 (Target_arm::Relocate::relocate): Likewise.
5814 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5817 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5819 * arm.cc: Added support for ARM group relocations.
5820 (Target_arm::reloc_needs_sym_origin): New method.
5821 (Arm_relocate_functions::calc_grp_kn): New method.
5822 (Arm_relocate_functions::calc_grp_residual): New method.
5823 (Arm_relocate_functions::calc_grp_gn): New method.
5824 (Arm_relocate_functions::arm_grp_alu): New Method.
5825 (Arm_relocate_functions::arm_grp_ldr): New Method.
5826 (Arm_relocate_functions::arm_grp_ldrs): New Method.
5827 (Arm_relocate_functions::arm_grp_ldc): New Method.
5828 (Target_arm::Scan::local): Handle the ARM group relocations.
5829 (Target_arm::Scan::global): Likewise.
5830 (Target_arm::Relocate::relocate): Likewise.
5831 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5834 2010-01-26 Doug Kwan <dougkwan@google.com>
5836 * arm.cc (set): Include.
5837 (class Arm_exidx_fixup): Change type of last_input_section_ to const
5839 (Arm_output_section::Text_section_list): New type.
5840 (Arm_output_section::append_text_sections_to_list): New method.
5841 (Arm_output_section::fix_exidx_coverage): Ditto.
5842 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
5843 (Arm_relobj::convert_input_section_to_relaxed_section): Use
5844 Relobj::set_section_offset() instead of
5845 Sized_relobj::invalidate_section_offset().
5846 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
5847 parameter for section headers. Ignore relocation sections for
5848 unallocated sections and EXIDX sections.
5849 (Target_arm::fix_exidx_coverage): New method.
5850 (Target_arm::output_section_address_less_than): New type.
5851 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
5852 linked text section instead of the EXIDX section.
5853 (Arm_output_section::create_stub_group): Add an assertion to check
5854 that this is not an EXIDX output section.
5855 (Arm_output_section::append_text_sections_to_list): New method.
5856 (Arm_output_section::fix_exidx_coverage): Ditto.
5857 (Arm_relobj::scan_sections_for_stubs): Adjust call to
5858 Arm_relobj::section_needs_reloc_stub_scanning.
5859 (Target_arm::do_relax): Fix EXIDX output section coverage in the
5861 (Target_arm::fix_exidx_coverage): New method.
5862 * object.h (Relobj::set_output_section): New method.
5863 (Sized_relobj::invalidate_section_offset): Remove method.
5864 (Sized_relobj::do_invalidate_section_offset): Remove method.
5865 (Sized_relobj::do_set_section_offset): Handle offset value -1.
5867 2010-01-25 Doug Kwan <dougkwan@google.com>
5869 * arm.cc (Arm_exidx_merged_section::do_output_offset):
5870 Fix warning due to signed and unsigned comparison on a 32-bit host.
5872 2010-01-22 Doug Kwan <dougkwan@google.com>
5874 * arm.cc (Target_arm::do_relax): Record an output section for section
5875 offset adjustment it contains any stub table that has changed.
5876 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
5877 offsets in an output section if necessary.
5878 * output.cc (Output_section::Output_section): Initialize
5879 section_offsets_need_adjustments_.
5880 (Output_section::add_input_section_for_script): Renamed to
5881 Output_section::add_simple_input_section.
5882 (Output_section::save_states): Add a comment.
5883 (Output_section::discard_states): New method defintion.
5884 (Output_section::adjust_section_offsets): Same.
5885 * output.h (Output_section::add_input_section_for_script): Renamed to
5886 Output_section::add_simple_input_section.
5887 (Output_section::discard_states): New method declaration.
5888 (Output_section::adjust_section_offsets): Same.
5889 (Output_section::section_offsets_need_adjustment,
5890 Output_section::set_section_offsets_need_adjustment): New method
5892 (Output_section::section_offsets_need_adjustment_): New data member.
5893 * script-sections.cc
5894 (Output_section_element_input::set_section_address): Adjust code for
5895 renaming of Output_section::add_input_section_for_script.
5896 (Orphan_output_section::set_section_address): Same.
5898 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5900 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
5901 Fix_v4bx enum values .
5902 * gold/options.h (General_options): New option definitions.
5903 (General_options::fix_v4bx): New method.
5904 (General_options::Fix_v4bx): New enum.
5905 * gold/options.cc (General_options::parse_fix_v4bx): New method.
5906 (General_options::parse_fix_v4bx_interworking): New method.
5908 2010-01-22 Doug Kwan <dougkwan@google.com>
5910 * arm.cc (Arm_exidx_fixup): New class.
5912 2010-01-21 Doug Kwan <dougkwan@google.com>
5914 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
5916 (Arm_exidx_section_offset_map): New type.
5918 2010-01-21 Doug Kwan <dougkwan@google.com>
5920 * arm.cc (Arm_exidx_input_section): New class.
5921 (Arm_relobj::exidx_input_section_by_link,
5922 Arm_relobj::exidx_input_section_by_shndx,
5923 Arm_relobj::make_exidx_input_section): New methods.
5924 (read_arm_attributes_section): Remove.
5925 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
5926 information about them.
5927 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
5930 2010-01-20 Doug Kwan <dougkwan@google.com>
5932 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
5933 Input_section_specifier to Section_id.
5934 (Target_arm::new_arm_input_section: Adjust code for change of key
5936 (Target_arm::find_arm_input_section): Ditto.
5937 * gc.h (object.h): Include for Section_id nand Section_id_hash.
5938 (Section_id): Remove.
5939 (Garbage_collection::Section_id_hash): Remove.
5940 * icf.h (object.h): Include for Section_id nand Section_id_hash.
5941 (Section_id): Remove.
5942 (Icf::Section_id_hash): Remove.
5943 * object.h (Section_id, Const_section_id, Section_id_hash,
5944 Const_section_id_hash): New type definitions.
5945 * output.cc (Output_section::add_relaxed_input_section): Change to
5946 use Const_section_id instead of Input_section_specifier as key type.
5947 (Output_section::add_merge_input_section): Ditto.
5948 (Output_section::build_relaxation_map): Change to use Section_id
5949 instead of Input_section_specifier as key type.
5950 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5952 (Output_section::convert_input_sections_to_relaxed_sections): Change
5953 to use Const_section_id instead of Input_section_specifier as key type.
5954 (Output_section::find_merge_section): Ditto.
5955 (Output_section::find_relaxed_input_section): Ditto.
5956 * output.h (Input_section_specifier): Remove class.
5957 (Output_section::Output_section_data_by_input_section_map): Change
5958 key type to Const_section_id.
5959 (Output_section::Output_relaxed_input_section_by_input_section_map):
5961 (Output_section::Relaxation_map): Change key type to Section_id.
5963 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5965 * gold/arm.cc: Added support for R_ARM_V4BX relocation
5966 (class Arm_v4bx_stub): New class.
5967 (DEF_STUBS): Updated definition to support v4_veneer_bx.
5968 (Stub_factory::make_arm_v4bx_stub): New method.
5969 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
5970 (Stub_table::empty): Handle v4bx stubs.
5971 (Stub_table::add_arm_v4bx_stub): New method.
5972 (Stub_table::find_arm_v4bx_stub): New method.
5973 (Arm_relocate_functions::v4bx): New method.
5974 (Target_arm::fix_v4bx): New method.
5975 (Target_arm::Target_arm): Handle R_ARM_V4BX.
5976 (Stub_table::relocate_stubs): Likewise.
5977 (Stub_table::do_write): Likewise.
5978 (Stub_table::update_data_size_and_addralign): Likewise.
5979 (Stub_table::finalize_stubs): Likewise.
5980 (Target_arm::Scan::local): Likewise.
5981 (Target_arm::Scan::global): Likewise.
5982 (Target_arm::do_finalize_sections): Likewise.
5983 (Target_arm::Relocate::relocate): Likewise.
5984 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5986 (Target_arm::scan_reloc_for_stub): Likewise.
5987 (Target_arm::scan_reloc_section_for_stubs): Likewise.
5989 2010-01-19 Ian Lance Taylor <iant@google.com>
5991 * output.cc (Output_section_headers::do_sized_write): Write large
5992 segment count to sh_info field.
5993 (Output_file_header::do_sized_write): For large segment count,
5994 write PN_XNUM to e_phnum field.
5996 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5998 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
5999 (Arm_relocate_functions::thm_jump8): New function.
6000 (Arm_relocate_functions::thm_jump11): New function.
6001 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
6003 (Target_arm::Scan::global): Likewise.
6004 (Target_arm::Relocate::relocate): Likewise.
6005 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6008 2010-01-14 Doug Kwan <dougkwan@google.com>
6010 * arm.cc (map, utility): Include headers.
6011 (Target_arm::apply_cortex_a8_workaround): New method.
6012 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
6013 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
6014 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
6015 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
6016 the --[no-]fix-cortex-a8 command line options.
6017 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
6018 (Target_arm::relocate_stub): Use addend in instruction template.
6019 * options.h (DEFINE_bool): Set the user-set flag.
6020 (General_options): Add --[no-]-fix-cortex options.
6021 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
6022 : Update fast look-up map after conversion.
6024 2010-01-14 Sriraman Tallam <tmsriram@google.com>
6026 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6027 in the first pass of do_layout.
6029 2010-01-13 Doug Kwan <dougkwan@google.com>
6031 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6032 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6033 apparent compiler problem of not folding static constant integral
6034 data members of elfcpp::Elf_sizes<32>.
6036 2010-01-13 Doug Kwan <dougkwan@google.com>
6038 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6039 Arm_relobj::section_needs_cortex_a8_stub_scanning,
6040 Arm_relobj::scan_section_for_cortex_a8_erratum,
6041 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
6042 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
6043 sections to scan for relocation stubs into a new method
6044 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
6045 relocation and Cortex-A8 stub scanning.
6046 (Target_arm::do_relax): Force stubs to be after stubbed sections
6047 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
6048 the beginning of a new relaxation pass. Update a comment.
6049 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
6051 2010-01-12 Ian Lance Taylor <iant@google.com>
6053 * target-reloc.h (visibility_error): New inline function.
6054 (relocate_section): Call visibility_error.
6055 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6056 (MOSTLYCLEANFILES): Likewise.
6057 (protected_4_pic.o, protected_3.err): New targets.
6058 * testsuite/protected_4.cc: New file.
6060 2010-01-12 Doug Kwan <dougkwan@google.com>
6062 * arm.cc (Cortex_a8_reloc): New class.
6063 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6064 and cortex_a8_relocs_info_.
6065 (Target_arm::fix_cortex_a8): New method definition.
6066 (Target_arm::Cortex_a8_relocs_info): New type.
6067 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6068 New data member declarations.
6069 (Target_arm::scan_reloc_for_stub): Record information about
6070 relocations for THUMB branches that might be exempted from the
6071 Cortex-A8 workaround.
6072 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
6073 at the beginning of a relaxation pass.
6075 2010-01-12 Doug Kwan <dougkwan@google.com>
6077 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
6078 (Arm_relobj::Mapping_symbol_position,
6079 Arm_reloj::Mapping_symbol_position_less,
6080 Arm_relobj::Mapping_symbols_info): New types.
6081 (Target_arm::is_mapping_symbol_name): New method definition.
6082 (Arm_relobj::do_count_local_symbols): Save information about mapping
6085 2010-01-11 Doug Kwan <dougkwan@google.com>
6087 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
6088 Arm_relocate_functions::thumb32_branch_upper,
6089 Arm_relocate_functions::thumb32_branch_lower,
6090 Arm_relocate_functions::thumb32_cond_branch_offset,
6091 Arm_relocate_functions::thumb32_cond_branch_upper,
6092 Arm_relocate_functions::thumb32_cond_branch_lower,
6093 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
6094 branch offset encoding.
6095 (Arm_relocate_functions::thumb_branch_common): Use new branch
6096 offset encoding methods to avoid code duplication.
6097 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
6098 (Stub_addend_reader::operator()): Use new branch encoding method
6099 to avoid code duplication.
6101 2010-01-11 Doug Kwan <dougkwan@google.com>
6103 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
6104 (Target_arm::do_finalize_sections): Define special EXIDX section
6105 symbols only if referenced.
6106 * gc.h (Garbage_collection::add_reference): New method.
6107 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
6110 2010-01-11 Ian Lance Taylor <iant@google.com>
6112 * script.cc (Version_script_info::build_expression_list_lookup):
6113 Change complaing about duplicate wildcard match from error to
6116 * script.cc (class Lazy_demangler): Recreate--revert part of patch
6118 (Version_script_info::Version_script_info): Initialize globs_,
6119 default_version_, default_is_global_, and exact_. Don't
6120 initialize globals_ or locals_.
6121 (Version_script_info::build_lookup_tables): Build local symbols
6123 (Version_script_info::unquote): New function.
6124 (Version_script_info::add_exact_match): New function.
6125 (Version_script_info::build_expression_list_lookup): Remove lookup
6126 parameter. Add is_global parameter. Change all callers. Handle
6127 wildcard pattern specially. Unquote pattern. Call
6129 (Version_script_info::get_name_to_match): New function.
6130 (Version_script_info::get_symbol_version): New function.
6131 (Version_script_info::get_symbol_version_helper): Remove.
6132 (Version_script_info::check_unmatched_names): Call unquote.
6133 * script.h (class Version_script_info): Change get_symbol_version
6134 to be non-inline and add is_global parameter; change all callers.
6135 Rewrite symbol_is_local. Update declarations. Define struct
6136 Version_tree_match, Exact, Globs. Don't define struct Lookup.
6137 Remove globals_ and locals_ members. Add exact_, globs_,
6138 default_version_, is_global_.
6139 (Version_script_info::Glob): Remove pattern, add expression and
6140 is_global. Update constructor. Change all callers.
6141 * dynobj.cc (Versions::finalize): Mark the version symbol as the
6143 (Versions::symbol_section_contents): If a symbol is undefined, or
6144 defined in a dynamic object, set the version index to
6146 * symtab.cc (Symbol_table::add_from_relobj): Don't call
6148 (Symbol_table::add_from_pluginobj): Likewise.
6149 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
6151 2010-01-11 Doug Kwan <dougkwan@google.com>
6153 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
6154 (incremental_dump_LDADD): Add linking option for libintl.
6155 * Makefile.in: Regenerate.
6157 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
6160 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
6162 * testsuite/Makefile.in: Regenerated.
6164 2010-01-10 Doug Kwan <dougkwan@google.com>
6166 * options.h (DEFINE_var): Use parentheses around argument varname__
6167 in macro body to avoid any unintended subsequent substitutions.
6169 2010-01-10 Ian Lance Taylor <iant@google.com>
6171 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
6172 candidates before doing symbol resolution.
6174 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
6175 ODR candidates if only one is weak.
6177 2010-01-08 Ian Lance Taylor <iant@google.com>
6179 * script.cc (Version_script_info::build_expression_list_lookup):
6180 Don't warn about ambiguous version, just record the ambiguity.
6181 (Version_script_info::get_symbol_version_helper): Give error if
6182 version is ambiguous.
6184 2010-01-08 Doug Kwan <dougkwan@google.com>
6186 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
6187 prev_data_size_ and prev_addralign_. Remove initializer for
6188 deleted data member has_been_changed_.
6189 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
6190 to determine if the table is empty.
6191 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
6193 (Stub_table::add_reloc_stub): Define method in class definition
6194 instead of just declaring it there.
6195 (Stub_table::add_cortex_a8_stub): New method definition.
6196 (Stub_table::update_data_size_and_addralign): Ditto.
6197 (Stub_table::finalize_stubs): Ditto.
6198 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
6199 (Stub_table::do_addralign_): Return address alignment in the
6200 (Stub_table::do_reset_address_and_file_offset): Define method in
6201 class definition instead of declaring it there. Set current data
6202 size to be the data size of the previous pass.
6203 (Stub_table::set_final_data_size): Use current data size as the
6205 (Stub_table::relocate_stub): Change parameter type of stub from
6206 Reloc_stub pointer to Stub pointer.
6207 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
6208 (Stub_table::Cortex_a8_stub_list): New typedef.
6209 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
6210 Stub_table::prev_addralign_): New data member.
6211 (Arm_relobj::Arm_relobj): Initialize data member
6212 section_has_cortex_a8_workaround_.
6213 (Arm_relobj::section_has_cortex_a8_workaround,
6214 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
6216 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
6218 (Target_arm::relocate_stub): Change parameter type of stub from
6219 Reloc_stub pointer to Stub pointer.
6220 (Insn_template::size, Insn_template::alignment): Handle
6221 THUMB16_SPECIAL_TYPE.
6222 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
6223 Stub_table::update_data_size_and_addralign,
6224 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
6226 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
6227 (Stub_table::do_write): Ditto.
6228 (Target_arm::do_relax): Adjust code for changes in Stub_table.
6230 2010-01-08 Ian Lance Taylor <iant@google.com>
6233 * symtab.h (class Symbol): Remove fields is_target_special_ and
6234 has_plt_offset_. Add field is_defined_in_discarded_section_.
6235 (Symbol::is_defined_in_discarded_section): New function.
6236 (Symbol::set_is_defined_in_discarded_section): New function.
6237 (Symbol::has_plt_offset): Rewrite.
6238 (Symbol::set_plt_offset): Verify that new offset is not -1U.
6239 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
6240 Don't initialize is_target_special_ or has_plt_offset_.
6241 Initialize is_defined_in_discarded_section_.
6242 (Symbol_table::add_from_relobj): If appropriate, set
6243 is_defined_in_discarded_section.
6244 * resolve.cc (Symbol::override_base_with_special): Don't test
6245 is_target_special_. Change has_plt_offset_ to has_plt_offset().
6246 * target-reloc.h (relocate_section): Do special handling for
6247 symbols defined in discarded sections for global symbols as well
6250 2010-01-08 Ian Lance Taylor <iant@google.com>
6252 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
6253 the SHT_SYMTAB case.
6255 2010-01-08 Ian Lance Taylor <iant@google.com>
6257 * object.cc (Sized_relobj::do_layout): Don't get confused if
6258 layout_eh_frame returns NULL.
6260 2010-01-08 Ian Lance Taylor <iant@google.com>
6263 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
6264 dynamic symbol table, use the normal symbol table.
6265 (Sized_dynobj::do_read_symbols): Remove assertion about type of
6268 2010-01-08 Ian Lance Taylor <iant@google.com>
6271 * layout.cc (Layout::include_section): Remove .gnu_debuglink
6274 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
6276 * version.cc (print_version): Change to "Copyright 2010".
6278 2010-01-08 Ian Lance Taylor <iant@google.com>
6282 * i386.cc (class Target_i386): Change return type of plt_section
6284 (class Output_data_plt_i386): Add tls_desc_rel_ field.
6285 (Output_data_plt_i386::Output_data_plt_i386): Initialize
6286 tls_desc_rel_ field.
6287 (Output_data_plt_i386::rel_tls_desc): New function.
6288 (Target_i386::rel_tls_desc_section): New function.
6289 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
6290 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
6291 R_386_TLS_DESC reloc in rel_tls_desc_section.
6292 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
6293 Define struct Tlsdesc_info.
6294 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
6295 (Target_x86_64::do_reloc_symbol_index): New function.
6296 (Target_x86_64::add_tlsdesc_info): New function.
6297 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
6298 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
6300 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
6302 (Output_data_plt_x86_64::rela_tlsdesc): New function.
6303 (Target_x86_64::rela_tlsdesc_section): New function.
6304 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
6306 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
6307 (Target_x86_64::do_reloc_addend): New function.
6308 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
6309 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
6310 declarations. Define TARGET_CODE. Add arg field to u1_ union.
6311 (Output_reloc::type): New function.
6312 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
6313 (Output_reloc::is_target_specific): New function.
6314 (Output_reloc::target_arg): New function.
6315 (class Output_reloc) [SHT_RELA]: Add four new constructors for
6316 absolute relocs and target specific relocs.
6317 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
6318 add_target_specific.
6319 (class Output_data_reloc) [SHT_RELA]: Likewise.
6320 * output.cc (Output_reloc::Output_reloc): Add four new versions
6321 for absolute relocs and target specific relocs.
6322 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
6323 (Output_reloc::get_symbol_index): Likewise.
6324 (Output_reloc::local_section_offset): Check that local_sym_index_
6325 is not TARGET_CODE or 0.
6326 (Output_reloc::symbol_value): Likewise.
6327 (Output_reloc::write) [SHT_RELA]: Call target for target specific
6329 * target.h (class Target): Add reloc_symbol_index and reloc_addend
6330 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
6332 * layout.cc (add_target_dynamic_tags): Use output section for
6333 DT_PLTRELSZ and DT_JMPREL.
6335 2010-01-07 Ian Lance Taylor <iant@google.com>
6338 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
6340 (class Output_data_reloc_generic): Define.
6341 (class Output_data_reloc_base): Change base class to
6342 Output_data_reloc_generic. Change add() method to call
6343 bump_relative_reloc_count for a relative reloc. Remove
6345 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
6347 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
6348 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
6350 * layout.h (class Layout): Update declaration.
6352 2010-01-07 Ian Lance Taylor <iant@google.com>
6354 * output.h (class Output_data): Add const version of
6355 output_section and do_output_section.
6356 (class Output_section_data): Add const version of
6358 (class Output_section): Likewise.
6359 * layout.cc (Layout::add_target_dynamic_tags): New function.
6360 * layout.h (class Layout): Update declarations.
6361 * arm.cc (Target_arm::do_finalize_sections): Use
6362 add_target_dynamic_tags.
6363 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6364 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6365 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6366 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6368 2010-01-07 Ian Lance Taylor <iant@google.com>
6371 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
6374 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
6375 Ian Lance Taylor <iant@google.com>
6378 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
6379 Xindex::read_symtab_xindex.
6381 2010-01-07 Doug Kwan <dougkwan@google.com>
6383 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
6384 (Insn_template::thumb16_bcond_insn): New method declaration.
6385 (Insn_template): Fix spelling.
6386 (Stub::thumb16_special): New method declaration.
6387 (Stub::do_write): Define virtual method which was previously pure
6389 (Stub::do_thumb16_special): New method declaration.
6390 (Stub::do_fixed_endian_write): New template member.
6391 (Reloc_stub::do_write): Remove.
6392 (Reloc_stub::do_fixed_endian_write): Remove.
6393 (Cortex_a8_stub): New class definition.
6394 (Stub_factory::make_cortex_a8_stub): New method definition.
6395 (Stub_factory::Stub_factory): Add missing static storage class
6396 qualifier for elf32_arm_stub_a8_veneer_blx.
6398 2010-01-07 Ian Lance Taylor <iant@google.com>
6401 * options.h (class General_options): Add --warn-unresolved-symbols
6402 and --error-unresolved-symbols.
6403 * errors.cc (Errors::undefined_symbol): Implement
6404 --warn-unresolved-symbols.
6406 * options.h (class General_options): Add -z text and -z textoff.
6407 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
6409 2010-01-06 Sriraman Tallam <tmsriram@google.com>
6411 * gc.h (Garbage_collection::Cident_section_map): New typedef.
6412 (Garbage_collection::cident_sections): New function.
6413 (Garbage_collection::add_cident_section): New function.
6414 (Garbage_collection::cident_sections_): New member.
6415 (gc_process_relocs): Add references to sections whose names are C
6417 * gold.h (cident_section_start_prefix): New constant.
6418 (cident_section_stop_prefix): New constant.
6419 (is_cident): New function.
6420 * layout.cc (Layout::define_section_symbols): Replace string constants
6421 with the newly defined constants.
6422 * object.cc (Sized_relobj::do_layout): Track sections whose names are
6424 * testsuite/Makefile.am: Add gc_orphan_section_test.
6425 * testsuite/Makefile.in: Regenerate.
6426 * testsuite/gc_orphan_section_test.cc: New file.
6427 * testsuite/gc_orphan_section_test.sh: New file.
6429 2010-01-06 Ian Lance Taylor <iant@google.com>
6432 * options.h (class General_options): Add --warn-shared-textrel.
6433 * layout.cc (Layout::finish_dynamic_section): Implement
6434 --warn-shared-textrel.
6437 * options.h (class General_options): Add --warn-multiple-gp.
6439 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6441 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
6442 $(THREADSLIB) and $(LIBDL).
6443 * Makefile.in: Rebuild.
6445 2010-01-06 Ian Lance Taylor <iant@google.com>
6448 * options.cc (General_options::parse_section_start): New function.
6449 (General_options::section_start): New function.
6450 (General_options::General_options): Initialize all members.
6451 * options.h: Include <map>
6452 (class General_options): Add --section-start. Add section_starts_
6454 * layout.cc (Layout::attach_allocated_section_to_segment): If
6455 --section-start was used, set the address of the segment. Remove
6456 local sort_sections.
6457 (Layout::relaxation_loop_body): If the address of the load segment
6458 has been set by --section-start, don't use it.
6459 * output.h (Output_segment::update_flags_for_output_section): New
6461 * output.cc (Output_segment::add_output_section): Call
6462 update_flags_for_output_section.
6464 2010-01-05 Ian Lance Taylor <iant@google.com>
6467 * options.h (class General_options): Add --undefined-version.
6468 * script.cc (struct Version_expression): Add was_matched_by_symbol
6470 (Version_script_info::matched_symbol): New function.
6471 (Version_script_info::get_symbol_version_helper): Call
6473 (Version_script_info::check_unmatched_names): New function.
6474 * script.h (class Version_script_info): Update declarations.
6475 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
6477 * options.h (class General_options): Use DEFINE_bool_alias for
6478 allow_multiple_definition.
6479 * resolve.cc (Symbol_table::should_override): Don't test
6480 allow_multiple_definition.
6483 * options.h (class General_options): Add --cref.
6484 * main.cc (main): Print cref table if --cref. Don't close mapfile
6485 until after printing cref table.
6486 * cref.cc: Include "symtab.h".
6487 (class Cref_inputs): Define Cref_table_compare and Cref_table.
6488 (Cref_table_compare::operator()): New function.
6489 (Cref_inputs::gather_cref): New function.
6490 (filecol): New static const.
6491 (Cref_inputs::print_cref): New function.
6492 (Cref::print_cref): New function.
6493 * cref.h: Include <cstdio>.
6494 (class Cref): Update declarations.
6495 * mapfile.h (Mapfile::file): New function.
6496 * object.h (class Object): Define Symbols. Declare virtual
6497 do_get_global_symbols.
6498 (Object::get_global_symbols): New function.
6499 * object.cc (Input_objects::add_object): Pass object to cref_ if
6501 (Input_objects::archive_start): Likewise.
6502 (Input_objects::archive_stop): Likewise.
6503 (Input_objects::print_cref): New function.
6504 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
6505 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
6507 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
6509 * plugin.h (class Sized_pluginobj): Update declarations.
6511 2010-01-05 Ian Lance Taylor <iant@google.com>
6513 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
6514 to is_default_version. Rename insdef to insdefault.
6515 (Symbol_table::add_from_relobj): Rename def to is_default_version
6516 and local to is_forced_local.
6517 (Symbol_table::add_from_pluginobj): Likewise.
6518 (Symbol_table::add_from_dynobj): Likewise.
6519 (Symbol_table::define_special_symbol): Rename insdef to
6522 2010-01-04 Ian Lance Taylor <iant@google.com>
6525 * options.h (class General_options): Add
6526 --allow-multiple-definition and -z muldefs.
6527 * resolve.cc (Symbol_table::should_override): Don't warn about a
6528 multiple symbol definition if --allow-multiple-definition or -z
6532 * options.h (class General_options): Add --add-needed and
6533 --copy-dt-needed-entries. Tweak --as-needed help entry.
6534 * object.cc (Input_objects::check_dynamic_dependencies): Give an
6535 error if --copy-dt-needed-entries aka --add-needed is used and
6536 would cause a change in behaviour.
6539 * options.h (class General_options): Add -G as a short version of
6540 --shared. Add no-op options -assert, -g, and -i.
6542 2010-01-04 Sriraman Tallam <tmsriram@google.com>
6544 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
6545 check for .text or .gnu.linkonce.t sections.
6546 * icf.cc (Icf::find_identical_sections): Ditto.
6547 Change the detection for mangled function name within the section
6549 * icf.h (is_section_foldable_candidate): New function.
6551 2009-12-30 Ian Lance Taylor <iant@google.com>
6554 * options.h (class General_options): Permit two dashes with
6555 --retain-symbols-file.
6557 2009-12-30 Ian Lance Taylor <iant@google.com>
6560 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
6561 don't put the file header and segment headers in the text
6565 * common.cc (Sort_commons::operator()): Stabilize sort when both
6567 (Symbol_table::do_allocate_commons_list): When allocating common
6568 symbols, skip a symbol which is no longer common.
6569 * symtab.h (Symbol::is_common): Test whether the symbol comes from
6570 an object before checking its type.
6571 * testsuite/common_test_2.c: New file.
6572 * testsuite/common_test_3.c: New file.
6573 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
6574 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
6575 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
6576 (common_test_2_pic.o, common_test_2.so): New targets.
6577 (common_test_3_pic.o, common_test_3.so): New targets.
6578 * testsuite/Makefile.in: Rebuild.
6581 * script.cc (read_input_script): If we see a new SECTIONS clause,
6582 and we have added an input section, give an error.
6583 * layout.h (class Layout): Add have_added_input_section function.
6584 Add have_added_input_section_ field.
6585 * layout.cc (Layout::Layout): Initialize
6586 have_added_input_section_.
6587 (Layout::layout): Set have_added_input_section_.
6588 (Layout::layout_eh_frame): Likewise.
6590 2009-12-30 Ian Lance Taylor <iant@google.com>
6593 * options.h (class General_options): Add --sort-common option.
6594 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
6595 * common.cc (Sort_common): Add sort_order parameter to
6596 constructor. Add sort_order_ field.
6597 (Sort_commons::operator): Check sort_order_.
6598 (Symbol_table::allocate_commons): Determine the sort order.
6599 (Symbol_table::do_allocate_commons): Add sort_order parameter.
6601 (Symbol_table::do_allocate_commons_list): Likewise.
6603 2009-12-30 Ian Lance Taylor <iant@google.com>
6606 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
6607 symbols from this object, don't change the visibility of an
6609 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
6611 2009-12-30 Ian Lance Taylor <iant@google.com>
6614 * script.h (class Version_script_info): Define Language enum.
6615 Update declarations. Define Glob, Exact, and Lookup types. Add
6616 new fields globals_, locals_, and is_finalized_.
6617 * script.cc: Various formatting fixes.
6618 (class Parser_closure): Change language_stack_ from a vector of
6619 std::string to one of Version_script_info::Language. Adjust all
6621 (class Lazy_demangler): Remove.
6622 (struct Version_expression): Change language from std::string to
6623 Version_script_info::Language.
6624 (Version_script_info::Version_script_info): New function.
6625 (Version_script_info::~Version_script_info): Don't call clear.
6626 (Version_script_info::finalize): New function.
6627 (Version_script_info::build_lookup_tables): New function.
6628 (Version_script_info::build_expression_list_lookup): New
6630 (Version_script_info::get_symbol_version_helper): Rewrite to use
6632 (Version_script_info::print_expression_list): Adjust to use
6633 Version_script_info::Language.
6634 (script_push_lex_into_version_mode): Check that the version script
6635 has not been finalized.
6636 (version_script_push_lang): Change language string to
6637 Version_script_info::Language.
6638 * options.cc (Command_line::version_script): New function.
6639 * options.h (class General_options): Add finalize_dynamic_list
6640 function. Change version_script from declaration to definition.
6641 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
6642 * testsuite/version_script.map: Remove duplicate def of foo.
6643 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
6645 * testsuite/Makefile.in: Rebuild.
6647 2009-12-30 Ian Lance Taylor <iant@google.com>
6650 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
6651 if the input symbol index is 0, make the output symbol index 0.
6653 2009-12-30 Ian Lance Taylor <iant@google.com>
6656 * options.h (class General_options): Add -x/--discard-all.
6657 * object.cc (Sized_relobj::do_count_local_symbols): Handle
6658 --discard-all. If the local symbol needs a dynamic entry, check
6659 that before handling --discard-locals.
6661 2009-12-30 Ian Lance Taylor <iant@google.com>
6664 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
6666 (Output_segment::add_output_section): Don't change the flags if
6670 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
6671 GNU hash table if they need a dynamic value. Otherwise, don't add
6672 them if they are defined in a dynamic object or are forced local.
6674 2009-12-29 Ian Lance Taylor <iant@google.com>
6677 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
6678 .gnu.hash table for a 32-bit target.
6681 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
6682 regular and a dynamic object only needs a dynamic symbol table
6683 entry if it is externally visible.
6686 * i386.cc (class Target_i386): Initialize global_offset_table_ in
6687 constructor. Add global_offset_table_ field.
6688 (Target_i386::got_section): Set global_offset_table_.
6689 (Target_i386::do_finalize_sections): Set global_offset_table_
6691 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
6692 in constructor. Add global_offset_table_ field.
6693 (Target_x86_64::got_section): Set global_offset_table_.
6694 (Target_x86_64::do_finalize_sections): Set global_offset_table_
6697 * layout.cc (Layout::Layout): Initialize increase_relro_.
6698 (Layout::get_output_section): Add is_relro, is_last_relro, and
6699 is_first_non_relro parameters. Change all callers.
6700 (Layout::choose_output_section): Likewise.
6701 (Layout::add_output_section_data): Likewise.
6702 (Layout::make_output_section): Likewise.
6703 (Layout::set_segment_offsets): Clear increase_relro when using a
6705 * layout.h (class Layout): Add increase_relro method. Add
6706 increase_relro_ field. Update declarations.
6707 * output.cc (Output_section::Output_section): Initialize
6708 is_last_relro_ and is_first_non_relro_.
6709 (Output_segment::add_output_section): Group relro sections is
6710 do_sort is true. Handle is_last_relro and is_first_non_relro.
6711 (Output_segment::maximum_alignment): Remove relro handling.
6712 (Output_segment::set_section_addresses): Add increase_relro
6713 parameter. Change all callers. Add initial alignment to align
6714 relro sections on separate page. Remove old relro handling.
6715 (Output_segment::set_section_list_addresses): Remove in_relro
6716 parameter. Change all callers.
6717 (Output_segment::set_offset): Add increase parameter. Change all
6718 callers. Remove old relro handling.
6719 * output.h (class Output_section): Add new methods: is_last_relro,
6720 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
6721 Add is_last_relro_ and is_first_non_relro_ fields.
6722 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
6723 Create separate .got.plt section. Call increase_relro.
6724 * x86_64.cc (Target_x86_64::got_section): Likewise.
6725 * testsuite/relro_script_test.t: Add .got.plt.
6728 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
6729 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
6730 (Layout::finalize): Call set_dynamic_symbol_size.
6731 (Layout::set_dynamic_symbol_size): New function.
6732 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
6733 set_dynamic_symbol_size.
6736 * output.h (class Output_section): Add is_entsize_zero_ field.
6737 * output.cc (Output_section::Output_section): Initialize
6739 (Output_section::set_entsize): If two different entsizes are
6740 requested, force it to zero.
6741 (Output_section::add_input_section): Set flags for .debug_str
6742 before updating section flags. Set entsize.
6743 (Output_section::update_flags_for_input_section): Set SHF_MERGE
6744 and SHF_STRING if all input sections have those flags.
6746 2009-12-29 Rafael Espindola <espindola@google.com>
6748 * main.cc (main): Fix the sys time reporting.
6749 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
6752 2009-12-29 Sriraman Tallam <tmsriram@google.com>
6754 * options.cc (General_options::parse_version): Allow -v to exit
6755 without an error if there is nothing to link.
6757 2009-12-29 Ian Lance Taylor <iant@google.com>
6759 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
6760 using a version of gcc before 4.1.
6761 * configure: Rebuild.
6763 2009-12-28 Chris Demetriou <cgd@google.com>
6765 * attributes.cc (Output_attributes_section_data::do_write): Use
6766 std::vector::front rather than std::vector::data.
6768 2009-12-28 Ian Lance Taylor <iant@google.com>
6770 * symtab.h (class Symbol_table): Add enum Defined.
6771 * resolve.cc (Symbol_table::should_override): Add defined
6772 parameter. Change all callers. Test whether object is NULL
6773 before calling a method on it.
6774 (Symbol_table::report_resolve_problem): Add defined parameter.
6776 (Symbol_table::should_override_with_special): Likewise.
6777 * symtab.cc (Symbol_table::define_in_output_data): Add defined
6778 parameter. Change all callers.
6779 (Symbol_table::do_define_in_output_data): Likewise.
6780 (Symbol_table::define_in_output_segment): Likewise.
6781 (Symbol_table::do_define_in_output_segment): Likewise.
6782 (Symbol_table::define_as_constant): Likewise.
6783 (Symbol_table::do_define_as_constant): Likewise.
6784 * script.h (class Symbol_assignment): Add is_defsym parameter to
6785 constructor; change all callers.
6786 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
6787 parameter. Change all callers. Add is_defsym_ field.
6788 (class Parser_closure): Add parsing_defsym parameter to
6789 constructor; change all callers. Add parsing_defsym accessor
6790 function. Add parsing_defsym_ field.
6792 2009-12-28 Ian Lance Taylor <iant@google.com>
6794 * gold.cc (queue_middle_tasks): Fix formatting.
6795 * object.cc (Relobj::is_section_name_included): Likewise.
6797 2009-12-23 Ian Lance Taylor <iant@google.com>
6799 * i386.cc (Target_i386::do_calls_non_split): Recognize
6800 -fsplit-stack prologue for a function with a static chain.
6801 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
6802 -fsplit-stack prologue when using %r11.
6804 2009-12-21 Sriraman Tallam <tmsriram@google.com>
6806 * options.cc (General_options::parse_version): Make -v continue and do
6807 the link like GNU ld does.
6809 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
6811 * Makefile.am (CCFILES): Add timer.cc.
6812 (HFILES): Add timer.h.
6813 * configure.ac: Check for sysconf and times.
6814 * main.cc: include timer.h.
6815 (main): Use Timer instead of get_run_time.
6818 * workqueue.cc: include timer.h.
6819 (Workqueue::find_and_run_task):
6820 Report user, sys and wall time.
6821 * Makefile.in: Regenerate.
6822 * config.in: Regenerate.
6823 * configure: Regenerate.
6825 2009-12-16 Doug Kwan <dougkwan@google.com>
6827 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
6829 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
6830 relaxed input sections.
6831 * output.cc (Output_section::find_relaxed_input_section): Change
6832 return type to Output_relaxed_input_section pointer. Adjust code
6833 for new type of relaxed_input_section_map_.
6834 * output.h (Output_section::find_relaxed_input_section): Change
6835 return type to Output_relaxed_input_section pointer.
6836 (Output_section::Output_relaxed_input_section_by_input_section_map):
6838 (Output_section::relaxed_input_section_map_): Change type to
6839 Output_section::Output_relaxed_input_section_by_input_section_map.
6840 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
6843 2009-12-15 Ian Lance Taylor <iant@google.com>
6845 * layout.cc (Layout::create_shstrtab): Only write out after input
6846 sections if we are compressing debug sections.
6848 2009-12-15 Ian Lance Taylor <iant@google.com>
6850 * archive.cc (Archive::add_symbols): Only look up a symbol without
6851 a version if there is, in fact, a version.
6853 2009-12-14 Ian Lance Taylor <iant@google.com>
6855 Revert -Wshadow changes, all changes from:
6856 2009-12-11 Doug Kwan <dougkwan@google.com>
6857 2009-12-11 Nick Clifton <nickc@redhat.com>
6858 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
6860 2009-12-11 Doug Kwan <dougkwan@google.com>
6862 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
6864 * attributes.cc (Object_attribute::size): Ditto.
6865 (Attributes_section_data::size): Ditto.
6866 (Attributes_section_data::Attributes_section_data): Ditto.
6867 (Output_attributes_section_data::do_write): Ditto.
6868 * attributes.h (Object_attribute::set_type): Ditto.
6869 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
6871 2009-12-11 Nick Clifton <nickc@redhat.com>
6873 * archive.cc: Fix shadowed variable warnings.
6875 * compressed_output.cc: Likewise.
6876 * compressed_output.h: Likewise.
6877 * configure: Likewise.
6878 * dwarf_reader.cc: Likewise.
6879 * dynobj.cc: Likewise.
6880 * dynobj.h: Likewise.
6881 * ehframe.cc: Likewise.
6882 * ehframe.h: Likewise.
6883 * errors.cc: Likewise.
6884 * expression.cc: Likewise.
6885 * fileread.cc: Likewise.
6886 * fileread.h: Likewise.
6887 * freebsd.h: Likewise.
6888 * i386.cc: Likewise.
6890 * incremental.h: Likewise.
6891 * layout.cc: Likewise.
6892 * layout.h: Likewise.
6893 * mapfile.cc: Likewise.
6894 * merge.cc: Likewise.
6895 * merge.h: Likewise.
6896 * object.cc: Likewise.
6897 * object.h: Likewise.
6898 * options.h: Likewise.
6899 * output.cc: Likewise.
6900 * output.h: Likewise.
6901 * parameters.cc: Likewise.
6902 * plugin.cc: Likewise.
6903 * powerpc.cc: Likewise.
6904 * reduced_debug_output.cc: Likewise.
6905 * reduced_debug_output.h: Likewise.
6906 * reloc.cc: Likewise.
6907 * reloc.h: Likewise.
6908 * resolve.cc: Likewise.
6909 * script-sections.cc: Likewise.
6910 * script.cc: Likewise.
6911 * script.h: Likewise.
6912 * sparc.cc: Likewise.
6913 * symtab.cc: Likewise.
6914 * symtab.h: Likewise.
6915 * target-select.cc: Likewise.
6916 * target-select.h: Likewise.
6917 * token.h: Likewise.
6918 * workqueue.cc: Likewise.
6919 * workqueue.h: Likewise.
6920 * x86_64.cc: Likewise.
6922 2009-12-10 Doug Kwan <dougkwan@google.com>
6924 * arm.cc (attributes.h): New include.
6925 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
6926 (Arm_relobj::~Arm_relobj): Delete object pointed by
6927 attributes_section_data_.
6928 (Arm_relobj::attributes_section_data): New method definition.
6929 (Arm_relobj::attributes_section_data_): New data member declaration.
6930 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
6931 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
6932 attributes_section_data_.
6933 (Arm_dynobj::attributes_section_data): New method definition.
6934 (Arm_dynobj::attributes_section_data_): New data member declaration.
6935 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
6936 initialization value of may_use_blx_ to false.
6937 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
6938 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
6939 object attributes to compute results instead of hard-coding.
6940 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
6941 Target_arm::get_secondary_compatible_arch,
6942 Target_arm::set_secondary_compatible_arch
6943 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6944 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
6945 New method declarations.
6946 (Target_arm::get_aeabi_object_attribute): New method definition.
6947 (Target_arm::attributes_section_data_): New data member declaration.
6948 (read_arm_attributes_section): New template definition.
6949 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
6950 (Arm_dynobj::do_read_symbols): Ditto.
6951 (Target_arm::do_finalize_sections): Merge attributes sections from
6952 input. Check for BLX use after attributes section merging.
6953 Fix __exidx_start and __exidx_end visibility. Create an
6954 .ARM.attributes section if necessary.
6955 (Target_arm::get_secondary_compatible_arch,
6956 Target_arm::set_secondary_compatible_arch,
6957 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6958 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
6959 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
6960 New method definitions.
6962 2009-12-09 Ian Lance Taylor <iant@google.com>
6964 * plugin.cc (Plugin::load): Don't cast from void* to a function
6967 2009-12-09 Ian Lance Taylor <iant@google.com>
6969 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
6972 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
6974 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
6975 Replace two_file_shared_1.so with two_file_shared_2.so.
6976 * testsuite/Makefile.in: Regenerated.
6978 2009-12-08 Doug Kwan <dougkwan@google.com>
6980 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
6981 (HFILES): Add attributes.h and int_encoding.h.
6982 * Makefile.in: Regenerate.
6983 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
6984 function definitions to int_encoding.cc
6985 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
6986 prototypes to int_encoding.h
6987 * reduced_debug_output.cc (int_encoding.h): New include.
6988 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
6989 function definitions to int_encoding.cc
6990 (insert_into_vector, read_from_pointer): Move template definitions to
6992 * attributes.cc: New file.
6993 * attributes.h: New file.
6994 * int_encoding.cc: New file.
6995 * int_encoding.h: New file.
6997 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
7000 * incremental-dump.cc (dump_incremental_inputs): New.
7001 (main): Use dump_incremental_inputs.
7003 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
7006 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
7007 checking elfcpp::STT_FUNC.
7008 (Target_i386::Relocate::relocate): Likewise.
7009 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
7011 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
7012 symbols from shared libraries into normal FUNC symbols.
7014 * symtab.h (Symbol): Add is_func and use it.
7016 2009-12-05 Doug Kwan <dougkwan@google.com>
7018 * arm.cc (Target_arm::arm_info): Initialize new fields
7019 attributes_section and attributes_vendor.
7020 * i386.cc (Target_i386::i386_info): Same.
7021 * object.cc (Sized_relobj::do_layout): Skip attribute section.
7022 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7023 fields attributes_section and attributes_vendor.
7024 * sparc.cc (Target_sparc::sparc_info): Same.
7025 * target.h (Target::attributes_section, Target::attributes_vendor,
7026 Target::is_attributes_section, Target::attribute_arg_type,
7027 Target::attributes_order): New method definitions.
7028 (Target::Target_info::attributes_section,
7029 Target::Target_info::attributes_vendor): New fields.
7030 (Target::do_attribute_arg_type, Target::do_attributes_order): New
7031 virtual method definitions.
7032 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7033 attributes_section and attributes_vendor.
7034 * testsuite/testfile.cc (Target_test::test_target_info): Same.
7036 2009-12-05 Doug Kwan <dougkwan@google.com>
7038 * arm.cc: Update comments about interworking and stub generation.
7039 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
7040 considered as non-PIC.
7041 (Arm_relocate_functions::base_abs): Fix formatting.
7042 (Arm_relocate_functions::got_prel): Fix comment. Change interface
7043 of function to use GOT entry address instead of offset.
7044 (Target_arm::Scan::global): Issue an error if a symbol would need a
7045 PLT does not get one because it is untyped. Remove code to create
7046 dynamic symbols for relative branches.
7047 (Target_arm::Relocate::relocate: Use 0 instead of false since function
7048 takes unsigned integer instead of boolean.
7050 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
7052 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7053 (two_file_test_LDADD): Likewise.
7054 (common_test_1_LDADD): Likewise.
7055 (exception_test_LDADD) Likewise.
7056 (weak_test_LDADD): Likewise.
7057 (many_sections_test_LDADD): Likewise.
7058 (initpri1_LDADD): Likewise.
7059 (script_test_1_LDADD): Likewise.
7060 (script_test_2_LDADD): Likewise.
7061 (justsyms_LDADD): Likewise.
7062 (binary_test_LDADD): Likewise.
7063 (large_LDADD): Likewise.
7064 * testsuite/Makefile.in: Regenerated.
7066 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
7068 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7069 (Symbol_table::override_with_special): Likewise.
7070 (Symbol_table::add_from_object): Likewise.
7072 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
7074 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7075 Don't set the data_offset twice.
7077 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
7079 * testsuite/Makefile.in: Regenerate.
7081 2009-12-03 Doug Kwan <dougkwan@google.com>
7083 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
7084 (Target_arm::do_finalize_sections): Add parameter for symbol table
7085 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
7086 * i386.cc (Target_i386::do_finalize_sections): Add an additional
7087 parameter for symbol table pointer.
7088 * layout.cc (Layout::finalize): Call Target::finalize_sections with
7089 an additional parameter for a pointer to symbol table.
7090 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
7091 parameter for a symbol table pointer.
7092 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
7093 * target.h (Target::finalize_sections, Target::do_finalize_sections):
7095 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
7096 parameter for a symbol table pointer.
7098 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
7100 * incremental.cc (Incremental_inputs_header)
7101 (Incremental_inputs_header_write, Incremental_inputs_entry)
7102 (Incremental_inputs_entry_write): Move ...
7103 * incremental.h (Incremental_inputs_header)
7104 (Incremental_inputs_header_write, Incremental_inputs_entry)
7105 (Incremental_inputs_entry_write): here.
7107 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7109 * incremental.cc (make_sized_incremental_binary): Set the target.
7110 Error if it is incompatible.
7111 * output.h (Output_file): Add filename method.
7113 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7115 * incremental.cc (Incremental_inputs_entry): Remove unused argument
7116 from the get_* methods.
7118 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7120 * incremental-dump.cc (main): Check that the offeset of a script is 0.
7121 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7122 Write 0 for the data_offset of scripts.
7124 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7126 * testsuite/Makefile.am: Add the incremental_test.sh test.
7127 * testsuite/incremental_test.sh: New.
7128 * testsuite/incremental_test_1.c: New.
7129 * testsuite/incremental_test_2.c: New.
7131 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
7133 * incremental-dump.cc (main): Fix typos.
7135 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
7138 * incremental-dump.cc (main): Use llu to print 64 bit values.
7140 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
7141 H.J. Lu <hongjiu.lu@intel.com>
7143 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
7145 (incremental_dump_LDADD): Likewise.
7146 * Makefile.in: Regenerated.
7148 2009-11-25 Doug Kwan <dougkwan@google.com>
7152 2009-11-25 Doug Kwan <dougkwan@google.com>
7154 * arm.cc (Target_arm::Target_arm): Move method definition
7155 outside of class definition. Add code to handle
7156 --target1-rel, --target1-abs and --target2= options.
7157 (Target_arm::get_reloc_reloc_type): Change method to be
7158 non-static and const.
7159 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
7160 New data member declaration.
7161 (Target_arm::Scan::local, Target_arm::Scan::global,
7162 Target_arm::Relocate::relocate,
7163 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7164 Adjust call to Target_arm::get_real_reloc_type.
7165 (Target_arm::get_real_reloc_type): Use command line options
7166 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7167 * options.h (--target1-rel, --target1-abs, --target2): New
7170 2009-11-25 Doug Kwan <dougkwan@google.com>
7172 * arm.cc (Target_arm::Target_arm): Move method definition outside of
7173 class definition. Add code to handle --target1-rel, --target1-abs
7174 and --target2= options.
7175 (Target_arm::get_reloc_reloc_type): Change method to be non-static
7177 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
7179 (Target_arm::Scan::local, Target_arm::Scan::global,
7180 Target_arm::Relocate::relocate,
7181 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
7182 call to Target_arm::get_real_reloc_type.
7183 (Target_arm::get_real_reloc_type): Use command line options to
7184 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7185 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
7188 2009-11-25 Doug Kwan <dougkwan@google.com>
7190 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
7191 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
7192 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
7194 (Arm_relocate_functions::thm_call): Replace body with a call to
7195 Arm_relocate_functions::thumb_branch_common.
7196 (Arm_relocate_functions::thm_jump24,
7197 Arm_relocate_functions::thm_xpc22): New method definitions.
7198 (Arm_relocate_functions::thumb_branch_common): New method definition.
7199 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
7201 (Target_arm::Relocate::relocate): Adjust call to thm_call.
7202 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
7204 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
7206 * Makefile.am: Build incremental-dump
7207 * Makefile.in: Regenerate.
7208 * incremental-dump.cc: New.
7209 * incremental.cc (Incremental_inputs_header_data,
7210 Incremental_inputs_entry_data): Move to incremental.h
7211 * incremental.h: (Incremental_inputs_header_data,
7212 Incremental_inputs_entry_data): Move from incremental.cc
7214 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
7216 * incremental.cc (Incremental_inputs_header,
7217 Incremental_inputs_header_write, Incremental_inputs_entry,
7218 Incremental_inputs_entry_write): Add a typedef with the data type.
7220 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
7222 * incremental.cc (Incremental_inputs_header,
7223 Incremental_inputs_header_write, Incremental_inputs_entry,
7224 Incremental_inputs_entry_write): Update comment about which
7225 type has the filed descriptions.
7227 2009-11-15 Doug Kwan <dougkwan@google.com>
7229 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
7230 (Arm_relocate_functions::arm_branch_common): Change method defintion
7231 in class definition to a method declaration and update list of formal
7233 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
7234 Arm_relocation_functions::jump24): Adjust call to
7235 Arm_relocate_functions::arm_branch_common. Update list of formal
7237 (Arm_relocate_functions::xpc25): New method definition.
7238 (Arm_relocate_functions::arm_branch_common): Move method defintion
7239 out from class definition. Use stubs for mode-switching and extending
7241 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
7242 specially. Change code to enable use of stubs in ARM branches.
7244 2009-11-10 Doug Kwan <dougkwan@google.com>
7246 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
7247 in method declaration.
7248 (Target_arm::relocate_stub): New method declaration.
7249 (Target_arm::default_target): Change to return a pointer instead of
7251 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
7252 Target_arm::default_target.
7253 (Arm_Relobj::do_relocate_sections): Remove options paramater in
7255 (Target_arm::relocate_section): Adjust view.
7256 (Target_arm::relocate_stub): New method definition.
7258 2009-11-10 Doug Kwan <dougkwan@google.com>
7260 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
7262 * incremental.cc (open_incremental_binary): Initialized local
7263 variables to avoid warnings.
7264 * object.cc (make_elf_object): Ditto.
7265 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
7268 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
7271 * testsuite/plugin_test.c: Include "config.h".
7273 2009-11-09 Doug Kwan <dougkwan@google.com>
7275 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
7276 (arm_symbol_value): Remove.
7277 (Arm_relocate_functions::arm_branch_common,
7278 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
7279 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
7280 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
7281 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
7282 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
7283 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
7284 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
7285 Arm_relocate_functions::thm_mobw_abs_nc,
7286 Arm_relocate_functions::thm_mov_abs,
7287 Arm_relocate_functions::movw_prel_nc,
7288 Arm_relocate_functions::thm_movt_abs,
7289 Arm_relocate_functions::movt_prel,
7290 Arm_relocate_functions::thm_movw_prel_nc,
7291 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
7292 (Target_arm::Relocate::relocate): Only decompose address into two
7293 parts if relocation type uses the thumb-bit and pass the actual
7294 bit instead of a flag indicating that the thumb-bit is used. Adjust
7295 calls to methods in Arm_relocate_functions for this change.
7297 2009-11-08 Ian Lance Taylor <iant@google.com>
7300 * reloc.cc: Instantiate
7301 Sized_relobj::initialize_input_to_output_maps and
7302 Sized_relobj:free_input_to_output_maps.
7304 2009-11-06 Ian Lance Taylor <iant@google.com>
7307 * defstd.cc (in_segment): Set only_if_ref true for "end".
7309 2009-11-06 Doug Kwan <dougkwan@google.com>
7311 * arm.cc (class Reloc_stub): Correct a comment.
7312 (Target_arm::Target_arm): Initialize arm_input_section_map_.
7313 (Target_arm::scan_section_for_stubs): New method declaration.
7314 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
7315 Change methods from private to protected.
7316 (Target_arm::do_may_relax): New method definition.
7317 (Target_arm::do_relax, Target_arm::group_sections,
7318 Target_arm::scan_reloc_for_stub,
7319 Target_arm::scan_reloc_section_for_stubs): New method declarations.
7320 (Target_arm::arm_input_section_map_): New data member declaration.
7321 (Target_arm::scan_reloc_for_stub,
7322 Target_arm::scan_reloc_section_for_stubs,
7323 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
7324 Target_arm::do_relax): New method definitions.
7326 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
7328 * configure.ac: Check for (struct stat)::st_mtim
7329 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
7330 * config.in: Regenerate.
7331 * configure: Regenerate.
7333 2009-11-05 Ian Lance Taylor <iant@google.com>
7336 * output.cc (Output_segment::add_output_section): Add missing
7339 2009-11-04 Ian Lance Taylor <iant@google.com>
7342 * object.h (class Object): Add is_needed and set_is_needed
7343 methods. Add is_needed_ field. Make bool fields into bitfields.
7344 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
7345 defined in a dynamic object and referenced by a regular object,
7346 set is_needed for the dynamic object.
7347 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
7348 if the file is marked with as_needed and it is not needed.
7350 2009-11-04 Ian Lance Taylor <iant@google.com>
7353 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
7354 tags if data is discarded by linker script.
7355 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7356 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7357 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7358 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7360 2009-11-04 Ian Lance Taylor <iant@google.com>
7362 * layout.cc (Layout::get_output_section): Add is_interp and
7363 is_dynamic_linker_section parameters. Change all callers.
7364 (Layout::choose_output_section): Likewise.
7365 (Layout::make_output_section): Likewise.
7366 (Layout::add_output_section_data): Add is_dynamic_linker_section
7367 parameter. Change all callers.
7368 * layout.h (class Layout): Update declarations.
7369 * output.h (class Output_section): Add is_interp, set_is_interp,
7370 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
7371 Add is_interp_, is_dynamic_linker_section_ fields. Change
7372 generate_code_fills_at_write_ to a bitfield.
7373 * output.cc (Output_section::Output_sections): Initialize new
7375 (Output_segment::add_output_section): Add do_sort parameter.
7378 2009-11-03 Ian Lance Taylor <iant@google.com>
7381 * options.h (class General_options): Add --warn-common.
7382 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
7383 merging two common symbols.
7384 (Symbol_table::should_override): Handle --warn-common when merging
7385 a common symbol with a defined symbol. Use report_resolve_problem
7386 for multiple definitions.
7387 (Symbol_table::report_resolve_problem): New function.
7388 * symtab.h (class Symbol_table): Declare report_resolve_problem.
7390 2009-11-03 Doug Kwan <dougkwan@google.com>
7392 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
7394 (Target_arm::stub_factory): New method definition.
7395 (Target_arm::new_arm_input_section,
7396 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
7397 Target_arm::reloc_uses_thumb_bit): New method declarations.
7398 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
7399 New type definitions.
7400 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
7401 member declarations.
7402 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
7403 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
7404 New method definitions.
7406 2009-11-03 Ian Lance Taylor <iant@google.com>
7408 * options.h (class General_options): Add --warn_constructors.
7410 2009-11-03 Ian Lance Taylor <iant@google.com>
7413 * defstd.cc (in_section): Add entries for __rel_iplt_start,
7414 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
7416 2009-11-03 Ian Lance Taylor <iant@google.com>
7419 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
7420 --msgid-bugs-address.
7421 (install-pdf): New target.
7422 (install-data_yes): Look up one directory to find mkinstalldirs.
7424 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
7426 * po/Make-in (.po.gmo): Don't generate .gmo files in source
7429 2009-10-30 Doug Kwan <dougkwan@google.com>
7431 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
7433 2009-10-30 Doug Kwan <dougkwan@google.com>
7435 * arm.cc (Stub_addend_reader): New struct template definition
7436 and partial specializations.
7437 (Stub_addend_reader::operator()): New method definition for a
7438 partially specialized template.
7440 2009-10-30 Doug Kwan <dougkwan@google.com>
7442 * arm.cc (Arm_relobj::processor_specific_flags): New method
7444 (Arm_relobj::do_read_symbols): New method declaration.
7445 (Arm_relobj::processor_specific_flags_): New data member declaration.
7446 (Arm_dynobj): New class definition.
7447 (Target_arm::do_finalize_sections): Add input_objects parameter.
7448 (Target_arm::do_adjust_elf_header): New method declaration.
7449 (Target_arm::are_eabi_versions_compatible,
7450 (Target_arm::merge_processor_specific_flags): New method declaration.
7451 (Target_arm::do_make_elf_object): New overloaded method definitions
7453 (Arm_relobj::do_read_symbols): New method definition.
7454 (Arm_dynobj::do_read_symbols): Ditto.
7455 (Target_arm::do_finalize_sections): Add input_objects parameters.
7456 Merge processor-specific flags from all input objects.
7457 (Target_arm::are_eabi_versions_compatible,
7458 Target_arm::merge_processor_specific_flags,
7459 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
7460 New method definitions.
7461 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
7462 Input_objects pointer type parameter.
7463 * layout.cc (Layout::finalize): Pass input objects to target's.
7464 finalize_sections function.
7465 * output.cc (Output_file_header::do_sized_write): Set ELF file
7466 header's processor-specific flags.
7467 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
7468 Input_objects pointer type parameter.
7469 * sparc.cc (Target_sparc::do_finalize_sections): Same.
7470 * target.h (Input_objects): New forward class declaration.
7471 (Target::processor_specific_flags,
7472 Target::are_processor_specific_flags_sect): New method definitions.
7473 (Target::finalize_sections): Add input_objects parameter.
7474 (Target::Target): Initialize processor_specific_flags_ and
7475 are_processor_specific_flags_set_.
7476 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
7478 (Target::set_processor_specific_flags): New method definition.
7479 (Target::processor_specific_flags_,
7480 Target::are_processor_specific_flags_set_): New data member
7482 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
7483 Input_objects pointer type parameter.
7485 2009-10-30 Doug Kwan <dougkwan@google.com>
7487 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
7489 2009-10-28 Ian Lance Taylor <iant@google.com>
7491 * object.h (class Relobj): Drop options parameter from
7492 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
7493 do_scan_relocs, do_relocate. Change all callers.
7494 (class Sized_relobj): Drop options parameters from
7495 do_gc_process_relocs, do_scan_relocs, do_relocate,
7496 do_relocate_sections, relocate_sections, emit_relocs_scan,
7497 emit_relocs_scan_reltype. Change all callers.
7498 (struct Relocate_info): Remove options field and all references to
7500 * reloc.h (class Read_relocs): Remove options constructor
7501 parameter and options_ field. Change all callers.
7502 (class Gc_process_relocs, class Scan_relocs): Likewise.
7503 (class Relocate_task): Likewise.
7504 * target-reloc.h (scan_relocs): Remove options parameter. Change
7506 (scan_relocatable_relocs): Likewise.
7507 * target.h (class Sized_target): Remove options parameter from
7508 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
7510 * gc.h (gc_process_relocs): Remove options parameter. Change all
7512 * arm.cc: Update functions to remove options parameters.
7513 * i386.cc: Likewise.
7514 * powerpc.cc: Likewise.
7515 * sparc.cc: Likewise.
7516 * x86_64.cc: Likewise.
7517 * testsuite/testfile.cc: Likewise.
7519 2009-10-28 Doug Kwan <dougkwan@google.com>
7521 * arm.cc (Arm_relobj): New class definition.
7522 (Arm_relobj::scan_sections_for_stubs,
7523 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
7524 New method definitions.
7526 2009-10-28 Cary Coutant <ccoutant@google.com>
7528 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
7529 (Plugin::cleanup_done_): New member.
7530 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
7531 (Plugin_manager::cleanup_done_): Remove.
7532 (Plugin_manager::add_input_file): Edit error message.
7533 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
7534 (Plugin_manager::cleanup): Remove use of cleanup_done_.
7536 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
7538 * fileread.cc: (File_read::View::~View): Use the new
7539 data_ownership_ filed.
7540 (File_read::~File_read): Dispose the new whole_file_view_.
7541 (File_read::open): Mmap the whole file if needed.
7542 (File_read::open): Use whole_file_view_ instead of contents_.
7543 (File_read::find_view): Use whole_file_view_ if applicable.
7544 (File_read::do_read): Use whole_file_view_ instead of contents_.
7545 (File_read::make_view): Use whole_file_view_ instead of contents_,
7546 update File_read::View::View call.
7547 (File_read::find_or_make_view): Update File_read::View::View
7549 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
7551 (File_read::View::Data_ownership): New enum.
7552 (File_read::View::View): Replace bool mapped_ with Data_ownership
7554 (File_read::View::mapped_): Remove (replaced by data_ownership_).
7555 (File_read::View::data_ownership_): New field.
7556 (File_read::contents_): Remove (replaced by whole_file_view_).
7557 (File_read::whole_file_view_): New field.
7558 * options.h (class General_options): Add --keep-files-mapped.
7560 2009-10-27 Cary Coutant <ccoutant@google.com>
7562 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
7563 * testsuite/Makefile.am (plugin_test_5): New test case.
7564 * testsuite/Makefile.in: Regenerate.
7566 2009-10-25 Doug Kwan <dougkwan@google.com>
7568 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
7569 from private to protected to allow access by child class.
7570 (Sized_relobj::do_relocate_sections): New method declaration.
7571 (Sized_relobj::relocate_sections): Virtualize.
7572 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
7573 Sized_relobj::relocate_sections. Instantiate template explicitly
7574 for different target sizes and endianity.
7576 2009-10-24 Doug Kwan <dougkwan@google.com>
7578 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
7579 (Arm_input_section::as_arm_input_section): New method.
7580 (Arm_output_section): New class definition.
7581 (Arm_output_section::create_stub_group,
7582 Arm_output_section::group_sections): New method definitions.
7584 2009-10-22 Doug Kwan <dougkwan@google.com>
7586 * arm.cc (Arm_input_section): New class definition.
7587 (Arm_input_section::init, Arm_input_section:do_write,
7588 Arm_input_section::set_final_data_size,
7589 Arm_input_section::do_reset_address_and_file_offset): New method
7592 2009-10-21 Doug Kwan <dougkwan@google.com>
7594 * arm.cc (Stub_table, Arm_input_section): New forward class
7596 (Stub_table): New class defintion.
7597 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
7598 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
7599 New method definition.
7601 2009-10-21 Doug Kwan <dougkwan@google.com>
7603 * arm.cc: Update copyright comments.
7604 (Target_arm): New forward class template declaration.
7605 (Arm_address): New type.
7606 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
7607 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
7608 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
7610 (Insn_template): Same.
7611 (DEF_STUBS): New macro.
7612 (Stub_type): New enum type.
7613 (Stub_template): New class definition.
7616 (Stub_factory): Same.
7617 (Target_arm::Target_arm): Initialize may_use_blx_ and
7618 should_force_pic_veneer_.
7619 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
7620 Target_arm::should_force_pic_veneer,
7621 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
7622 Target_arm::using_thumb_only, Target_arm:;default_target): New
7624 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
7625 New data member declarations.
7626 (Insn_template::size, Insn_template::alignment): New method defintions.
7627 (Stub_template::Stub_template): New method definition.
7628 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
7629 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
7630 (Stub_factory::Stub_factory): New method definition.
7631 * gold.h (string_hash): New template.
7632 * output.h (Input_section_specifier::hash_value): Use
7634 (Input_section_specifier::string_hash): Remove.
7635 * stringpool.cc (Stringpool_template::string_hash): Use
7638 2009-10-20 Doug Kwan <dougkwan@google.com>
7640 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
7641 symbols of relaxed input sections.
7642 * output.h (Output_section::find_relaxed_input_section): Make
7645 2009-10-16 Doug Kwan <dougkwan@google.com>
7647 * dynobj.cc (Versions::Versions): Initialize version_script_.
7648 Only insert base version symbol definition for a shared object
7649 if version script defines any version versions.
7650 (Versions::define_base_version): New method definition.
7651 (Versions::add_def): Check that base version is not needed.
7652 (Versions::add_need): Define base version lazily.
7653 * dynobj.h (Versions::define_base_version): New method declaration.
7654 (Versions::needs_base_version_): New data member declaration.
7655 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
7656 (check_DATA): Add no_version_test.stdout.
7657 (libno_version_test.so, no_version_test.o no_version_test.stdout):
7659 * testsuite/Makefile.in: Regenerate.
7660 * testsuite/no_version_test.c: New file.
7661 * testsuite/no_version_test.sh: Ditto.
7663 2009-10-16 Doug Kwan <dougkwan@google.com>
7665 * expression.cc (class Segment_start_expression): New class definition.
7666 (Segment_start_expression::value): New method definition.
7667 (script_exp_function_segment_start): Return a new
7668 Segment_start_expression.
7669 * gold/script-c.h (script_saw_segment_start_expression): New function
7671 * script-sections.cc (Script_sections::Script_sections): Initialize
7672 SAW_SEGMENT_START_EXPRESSION_ to false.
7673 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
7674 and -Tbbs options to specify section addresses if given in
7675 command line and no SEGMENT_START expression is seen in a script.
7676 * script-sections.h (Script_sections::saw_segment_start_expression,
7677 Script_sections::set_saw_segment_start_expression): New method
7679 (Script_sections::saw_segment_start_expression_): New data member
7681 * script.cc (script_saw_segment_start_expression): New function.
7682 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
7683 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
7684 script_test_7.sh and script_test_8.sh.
7685 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
7686 script_test_8.stdout.
7687 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
7688 (script_test_6, script_test_6.stdout, script_test_7,
7689 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
7690 * Makefile.in: Regenerate.
7691 * testsuite/script_test_6.sh: New file.
7692 * testsuite/script_test_6.t: Same.
7693 * testsuite/script_test_7.sh: Same.
7694 * testsuite/script_test_7.t: Same.
7695 * testsuite/script_test_8.sh: Same.
7697 2009-10-16 Doug Kwan <dougkwan@google.com>
7699 * output.cc (Output_segment::set_section_list_address): Cast
7700 expressions to unsigned long long type to avoid format warnings.
7702 2009-10-15 Ian Lance Taylor <iant@google.com>
7704 * script.cc (Script_options::add_symbol_assignment): Always add a
7705 dot assignment to script_sections_.
7706 * script-sections.cc (Script_sections::add_dot_assignment):
7707 Initialize if necessary.
7709 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
7710 program headers with no load segment if there is a linker script.
7712 * layout.cc (Layout::set_segment_offsets): Align the file offset
7713 to the segment aligment for -N or -n with no load segment.
7714 * output.cc (Output_segment::add_output_section): Don't crash if
7715 the first section is a TLS section.
7716 (Output_segment::set_section_list_addresses): Print an error
7717 message if the address moves backward in a linker script.
7718 * script-sections.cc
7719 (Output_section_element_input::set_section_addresses): Don't
7720 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
7721 (Orphan_output_section::set_section_addresses): Likewise.
7723 2009-10-15 Doug Kwan <dougkwan@google.com>
7725 * layout.cc (Layout::finish_dynamic_section): Generate tags
7726 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
7727 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
7728 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
7730 2009-10-14 Ian Lance Taylor <iant@google.com>
7732 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
7734 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
7735 data_shdr fields of relinfo.
7736 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
7737 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
7738 R_386_TLS_LDO_32, adjust based on section flags.
7739 (Target_i386::Relocate::fix_up_ldo): Remove.
7741 2009-10-13 Ian Lance Taylor <iant@google.com>
7743 Add support for -pie.
7744 * options.h (class General_options): Add -pie and
7746 (General_options::output_is_position_independent): Test -pie.
7747 (General_options::output_is_executable): Return true if not shared
7748 and not relocatable.
7749 (General_options::output_is_pie): Remove.
7750 * options.cc (General_options::finalize): Reject incompatible uses
7752 * gold.cc (queue_middle_tasks): A -pie link is not static.
7753 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
7754 * symtab.cc (Symbol::final_value_is_known): Return false if
7755 output_is_position_independent.
7756 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
7757 output_is_position_independent.
7758 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
7759 output_is_position_independent.
7760 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
7761 output_is_position_independent.
7762 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
7764 (basic_pie_test.o, basic_pie_test): New targets.
7765 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
7766 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
7767 (two_file_pie_test): New target.
7768 * testsuite/Makefile.in: Rebuild.
7769 * README: Remove note saying that -pie is not supported.
7771 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
7773 * options.h (class General_options): Add -init and -fini.
7774 * layout.cc (Layout::finish_dynamic_section): Emit
7775 given init and fini functions.
7777 2009-10-13 Sriraman Tallam <tmsriram@google.com>
7779 * gc.h (gc_process_relocs): Check if icf is enabled using new
7781 * gold.cc (queue_initial_tasks): Likewise.
7782 (queue_middle_tasks): Likewise.
7783 * object.cc (do_layout): Likewise.
7784 * symtab.cc (is_section_folded): Likewise.
7785 * main.cc (main): Likewise.
7786 * reloc.cc (Read_relocs::run): Likewise.
7787 (Sized_relobj::do_scan_relocs): Likewise.
7788 * icf.cc (is_function_ctor_or_dtor): New function.
7789 (Icf::find_identical_sections): Check if function is ctor or dtor when
7791 * options.h (General_options::icf): Change option to be an enum.
7792 (Icf_status): New enum.
7793 (icf_enabled): New method.
7794 (icf_safe_folding): New method.
7795 (set_icf_status): New method.
7796 (icf_status_): New variable.
7797 * (options.cc) (General_options::finalize): Set icf_status_.
7798 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
7799 icf_test and icf_keep_unique_test to use the --icf enum flag.
7800 * testsuite/icf_safe_test.sh: New file.
7801 * testsuite/icf_safe_test.cc: New file.
7803 2009-10-12 Sriraman Tallam <tmsriram@google.com>
7805 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
7806 includes to gc.h and icf.h.
7807 * arm.cc: Include gc.h.
7808 * gold.cc: Likewise.
7809 * i386.cc: Likewise.
7810 * powerpc.cc: Likewise.
7811 * sparc.cc: Likewise.
7812 * x86_64.cc: Likewise.
7813 * gc.h: Include icf.h.
7815 2009-10-11 Ian Lance Taylor <iant@google.com>
7817 * plugin.cc: Include "gold.h" before other header files.
7819 2009-10-10 Chris Demetriou <cgd@google.com>
7821 * options.h (Input_file_argument::Input_file_type): New enum.
7822 (Input_file_argument::is_lib_): Replace with...
7823 (Input_file_argument::type_): New member.
7824 (Input_file_argument::Input_file_argument): Take Input_file_type
7825 'type' rather than boolean 'is_lib' as second argument.
7826 (Input_file_argument::is_lib): Use type_.
7827 (Input_file_argument::is_searched_file): New function.
7828 (Input_file_argument::may_need_search): Handle is_searched_file.
7829 * options.cc (General_options::parse_library): Support -l:filename.
7830 (General_options::parse_just_symbols): Update for Input_file_argument
7832 (Command_line::process): Likewise.
7833 * archive.cc (Archive::get_file_and_offset): Likewise.
7834 * plugin.cc (Plugin_manager::release_input_file): Likewise.
7835 * script.cc (read_script_file, script_add_file): Likewise.
7836 * fileread.cc (Input_file::Input_file): Likewise.
7837 (Input_file::will_search_for): Handle is_searched_file.
7838 (Input_file::open): Likewise.
7839 * readsyms.cc (Read_symbols::get_name): Likewise.
7840 * testsuite/Makefile.am (searched_file_test): New test.
7841 * testsuite/Makefile.in: Regenerate.
7842 * testsuite/searched_file_test.cc: New file.
7843 * testsuite/searched_file_test_lib.cc: New file.
7845 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7846 Ian Lance Taylor <iant@google.com>
7848 * descriptor.cc: Include <cstdio> and "binary-io.h".
7849 (Descriptors::open): Open the files in binary mode always.
7850 * script.cc (Lex::get_token): Treat \r as whitespace.
7852 2009-10-09 Ian Lance Taylor <iant@google.com>
7854 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
7856 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7857 Ian Lance Taylor <iant@google.com>
7859 * configure.ac: Check for readv function also.
7860 * fileread.cc (readv): Define if not HAVE_READV.
7861 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
7863 * config.in: Regenerate.
7864 * configure: Regenerate.
7866 2009-10-09 Doug Kwan <dougkwan@google.com>
7868 * layout.cc (Layout::make_output_section): Call target hook to make
7869 ordinary output section.
7870 (Layout::finalize): Adjust parameter list of call the
7871 Target::may_relax().
7872 * layout.h (class Layout::section_list): New method.
7873 * merge.h (Output_merge_base::entsize): Change visibility to public.
7874 (Output_merge_base::is_string, Output_merge_base::do_is_string):
7876 (Output_merge_string::do_is_string): New method.
7877 * object.cc (Sized_relobj::do_setup): renamed from
7878 Sized_relobj::set_up.
7879 * object.h (Sized_relobj::adjust_shndx,
7880 Sized_relobj::initializ_input_to_output_maps,
7881 Sized_relobj::free_input_to_output_maps): Change visibilities to
7883 (Sized_relobj::setup): Virtualize.
7884 (Sized_relobj::do_setup): New method declaration.
7885 (Sized_relobj::invalidate_section_offset,
7886 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
7887 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
7888 * options.cc (parse_int): New function.
7889 * options.h (parse_int): New declaration.
7890 (DEFINE_int): New macro.
7891 (stub_group_size): New option.
7892 * output.cc (Output_section::Output_section): Initialize memebers
7893 merge_section_map_, merge_section_by_properties_map_,
7894 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
7895 (Output_section::add_input_section): Handled deferred code-fill
7896 generation and remove an old comment.
7897 (Output_section::add_relaxed_input_section): New method definition.
7898 (Output_section::add_merge_input_section): Use merge section by
7899 properties map to speed to search. Update merge section maps
7901 (Output_section::build_relaxation_map): New method definition.
7902 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7904 (Output_section::relax_input_section): Renamed to
7905 Output_section::convert_input_sections_to_relaxed_sections and change
7906 interface to take a vector of pointers to relaxed sections.
7907 (Output_section::find_merge_section,
7908 Output_section::find_relaxed_input_section): New method definitions.
7909 (Output_section::is_input_address_mapped,
7910 Output_section::output_offset, Output_section::output_address):
7911 Use output section data maps to speed up searching.
7912 (Output_section::find_starting_output_address): Add comments.
7913 (Output_section::do_write,
7914 Output_section::write_to_postprocessing_buffer): Do code-fill
7915 generation as appropriate.
7916 (Output_section::get_input_sections): Invalidate relaxed input section
7918 (Output_section::restore_states): Adjust type of checkpoint .
7919 Invalidate relaxed input section map.
7920 * output.h (Output_merge_base): New class declaration.
7921 (Input_section_specifier): New class defintion.
7922 (class Output_relaxed_input_section) Change base class to
7923 Output_section_data_build.
7924 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
7925 base class initializer.
7926 (Output_section::add_relaxed_input_section): New method declaration.
7927 (Output_section::Input_section): Change visibility to protected.
7928 (Output_section::Input_section::relobj,
7929 Output_section::Input_section::shndx): Handle relaxed input sections.
7930 Output_section::input_sections) Change visibility to protected. Also
7931 define overload to return a non-const pointer.
7932 (Output_section::Merge_section_properties): New class defintion.
7933 (Output_section::Merge_section_by_properties_map,
7934 Output_section::Output_section_data_by_input_section_map,
7935 Output_section::Relaxation_map): New types.
7936 (Output_section::relax_input_section): Rename method to
7937 Output_section::convert_input_sections_to_relaxed_sections and change
7938 interface to take a vector of relaxed section pointers.
7939 (Output_section::find_merge_section,
7940 Output_section::find_relaxed_input_section,
7941 Output_section::build_relaxation_map,
7942 Output_section::convert_input_sections_in_list_to_relaxed_sections):
7943 New method declarations.
7944 (Output_section::merge_section_map_
7945 Output_section::merge_section_by_properties_map_,
7946 Output_section::relaxed_input_section_map_,
7947 Output_section::is_relaxed_input_section_map_valid_,
7948 Output_section::generate_code_fills_at_write_): New data members.
7949 * script-sections.cc
7950 (Output_section_element_input::set_section_addresses): Call
7951 current_data_size and addralign methods of relaxed input sections.
7952 (Orphan_output_section::set_section_addresses): Call current_data_size
7953 and addralign methods of relaxed input sections.
7954 * symtab.cc (Symbol_table::compute_final_value): Extract template
7955 from the body of Symbol_table::sized_finalize_symbol.
7956 (Symbol_table::sized_finalized_symbol): Call
7957 Symbol_table::compute_final_value.
7958 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
7959 (Symbol_table::compute_final_value): New templated method declaration.
7960 * target.cc (Target::do_make_output_section): New method defintion.
7961 * target.h (Target::make_output_section): New method declaration.
7962 (Target::relax): Add more parameters for input objects, symbol table
7963 and layout. Adjust call to do_relax.
7964 (Target::do_make_output_section): New method declaration.
7965 (Target::do_relax): Add parameters for input objects, symbol table
7968 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7970 * pread.c: Include stdio.h.
7972 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7974 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
7977 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7979 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7980 Change read_shndx type to unsigned int.
7981 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7983 (Sized_dwarf_line_info::read_line_mappings): Likewise.
7984 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
7985 Change read_shndx type to unsigned int.
7986 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7988 (Sized_dwarf_line_info::read_line_mappings): Likewise.
7989 * layout.cc (Layout::create_symtab_sections): Cast the result of
7990 local_symcount * symsize to off_t in the gold_assert.
7992 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7994 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
7995 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
7997 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
7998 (Arm_relocate_functions::thm_abs5): New function.
7999 (Arm_relocate_functions::abs12): New function.
8000 (Arm_relocate_functions::abs16): New function.
8001 (Arm_relocate_functions::base_abs): New function.
8002 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
8003 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
8004 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
8006 (Scan::global): Likewise.
8007 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
8008 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
8009 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
8010 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
8013 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8015 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
8016 (Arm_relocate_functions::movt_prel): New function.
8017 (Arm_relocate_functions::thm_movw_prel_nc): New function.
8018 (Arm_relocate_functions::thm_movt_prel): New function.
8019 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8020 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8021 (Scan::global, Relocate::relocate): Likewise.
8022 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8024 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8026 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8027 Incremental_checker.
8028 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8030 (class Incremental_inputs_header): New class.
8031 (Incremental_inputs_header_writer): Edit comment.
8032 (Incremental_inputs_entry): New class.
8033 (Incremental_inputs_entry_writer): Edit comment.
8034 (Sized_incremental_binary::do_find_incremental_inputs_section):
8035 Add *strtab_shndx parameter, fill it.
8036 (Sized_incremental_binary::do_check_inputs): New method.
8037 (Incremental_checker::can_incrementally_link_output_file): Use
8038 Sized_incremental_binary::check_inputs.
8039 (Incremental_inputs::report_command_line): Save command line in
8042 (Incremental_binary::find_incremental_inputs_section): New
8044 (Incremental_binary::do_find_incremental_inputs_section): Add
8045 strtab_shndx parameter.
8046 (Incremental_binary::do_check_inputs): New pure virtual method.
8047 (Sized_incremental_binary::do_check_inputs): Declare.
8048 (Incremental_checker::Incremental_checker): Add incremental_inputs
8049 parameter, use it to initialize incremental_inputs_.
8050 (Incremental_checker::incremental_inputs_): New field.
8051 (Incremental_checker::command_line): New method.
8052 (Incremental_checker::inputs): New method.
8053 (Incremental_checker::command_line_): New field.
8055 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8057 * incremental.cc: Include <cstdarg> and "target-select.h".
8058 (vexplain_no_incremental): New function.
8059 (explain_no_incremental): New function.
8060 (Incremental_binary::error): New method.
8061 (Sized_incremental_binary::do_find_incremental_inputs_section): New
8063 (make_sized_incremental_binary): New function.
8064 (open_incremental_binary): New function.
8065 (can_incrementally_link_file): Add checks if output is ELF and has
8067 * incremental.h: Include "elfcpp_file.h" and "output.h".
8068 (Incremental_binary): New class.
8069 (Sized_incremental_binary): New class.
8070 (open_incremental_binary): Declare.
8071 * object.cc (is_elf_object): Use
8072 elfcpp::Elf_recognizer::is_elf_file.
8073 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
8074 * output.h (Output_file::filesize): New method.
8076 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8078 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
8080 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
8081 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
8083 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
8085 (Arm_relocate_functions::movw_abs_nc): New function.
8086 (Arm_relocate_functions::movt_abs): New function.
8087 (Arm_relocate_functions::thm_movw_abs_nc): New function.
8088 (Arm_relocate_functions::thm_movt_abs): New function.
8089 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
8090 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
8091 (Scan::global): Likewise.
8092 (Relocate::relocate): Likewise.
8093 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8095 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8097 * arm.cc (Arm_relocate_functions::got_prel) New function.
8098 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
8099 (Relocate::relocate): Likewise.
8100 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8102 2009-10-06 Ian Lance Taylor <iant@google.com>
8104 * options.h (class General_options): Define
8105 split_stack_adjust_size parameter.
8106 * object.h (class Object): Add uses_split_stack_ and
8107 has_no_split_stack_ fields. Add uses_split_stack and
8108 has_no_split_stack accessor functions. Declare
8109 handle_split_stack_section.
8110 (class Reloc_symbol_changes): Define.
8111 (class Sized_relobj): Define Function_offsets. Declare
8112 split_stack_adjust, split_stack_adjust_reltype, and
8114 * object.cc (Object::handle_split_stack_section): New function.
8115 (Sized_relobj::do_layout): Call handle_split_stack_section.
8116 * dynobj.cc (Sized_dynobj::do_layout): Call
8117 handle_split_stack_section.
8118 * reloc.cc (Sized_relobj::relocate_sections): Call
8119 split_stack_adjust for executable sections in split_stack
8120 objects. Pass reloc_map to relocate_section.
8121 (Sized_relobj::split_stack_adjust): New function.
8122 (Sized_relobj::split_stack_adjust_reltype): New function.
8123 (Sized_relobj::find_functions): New function.
8124 * target-reloc.h: Include "object.h".
8125 (relocate_section): Add reloc_symbol_changes parameter. Change
8127 * target.h (class Target): Add calls_non_split method. Declare
8128 do_calls_non_split virtual method. Declare match_view and
8130 * target.cc: Include "elfcpp.h".
8131 (Target::do_calls_non_split): New function.
8132 (Target::match_view): New function.
8133 (Target::set_view_to_nop): New function.
8134 * gold.cc (queue_middle_tasks): Give an error if mixing
8135 split-stack and non-split-stack objects with -r.
8136 * i386.cc (Target_i386::relocate_section): Add
8137 reloc_symbol_changes parameter.
8138 (Target_i386::do_calls_non_split): New function.
8139 * x86_64.cc (Target_x86_64::relocate_section): Add
8140 reloc_symbol_changes parameter.
8141 (Target_x86_64::do_calls_non_split): New function.
8142 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
8144 * powerpc.cc (Target_powerpc::relocate_section): Add
8145 reloc_symbol_changes parameter.
8146 * sparc.cc (Target_sparc::relocate_section): Add
8147 reloc_symbol_changes parameter.
8148 * configure.ac: Call AM_CONDITIONAL for the default target.
8149 * configure: Rebuild.
8150 * testsuite/Makefile.am (TEST_AS): New variable.
8151 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
8152 (check_DATA): Add split_i386 and split_x86_64 files.
8153 (SPLIT_DEFSYMS): Define.
8154 (split_i386_[1234n].o): New targets.
8155 (split_i386_[124]): New targets.
8156 (split_i386_[1234r].stdout): New targets.
8157 (split_x86_64_[1234n].o): New targets.
8158 (split_x86_64_[124]): New targets.
8159 (split_x86_64_[1234r].stdout): New targets.
8160 (MOSTLYCLEANFILES): Add new executables.
8161 * testsuite/split_i386.sh: New file.
8162 * testsuite/split_x86_64.sh: New file.
8163 * testsuite/split_i386_1.s: New file.
8164 * testsuite/split_i386_2.s: New file.
8165 * testsuite/split_i386_3.s: New file.
8166 * testsuite/split_i386_4.s: New file.
8167 * testsuite/split_i386_n.s: New file.
8168 * testsuite/split_x86_64_1.s: New file.
8169 * testsuite/split_x86_64_2.s: New file.
8170 * testsuite/split_x86_64_3.s: New file.
8171 * testsuite/split_x86_64_4.s: New file.
8172 * testsuite/split_x86_64_n.s: New file.
8173 * testsuite/testfile.cc (Target_test): Update relocation_section
8175 * testsuite/Makefile.in: Rebuild.
8177 2009-10-06 Ian Lance Taylor <iant@google.com>
8179 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
8180 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
8181 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
8182 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
8183 the address on ldo_addrs_.
8184 (Target_i386::Relocate::fix_up_ldo): New function.
8186 2009-10-06 Rafael Espindola <espindola@google.com>
8188 * plugin.cc (add_input_library): New.
8189 (Plugin::load): Add add_input_library to tv.
8190 (Plugin_manager::add_input_file): Add the is_lib argument.
8191 (add_input_file): Update call to Plugin_manager::add_input_file.
8192 (add_input_library): New.
8193 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
8195 2009-09-30 Doug Kwan <dougkwan@google.com>
8197 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
8198 symbol and call Symbol::may_need_copy_reloc to determine if
8199 a copy reloc is needed.
8200 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
8201 nocopyreloc is given in command line.
8202 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
8203 given in command line.
8204 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
8205 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
8206 of the removed Target_i386::may_need_copy_reloc.
8207 * options.h (copyreloc): New option with default value false.
8208 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8209 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
8210 instead of the removed Target_powerpc::may_need_copy_reloc.
8211 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8212 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
8213 instead of the removed Target_sparc::may_need_copy_reloc.
8214 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
8215 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
8216 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
8217 instead of the removed Target_x86_64::may_need_copy_reloc.
8219 2009-09-30 Ian Lance Taylor <iant@google.com>
8221 * object.h (class Object): Remove target_ field, and target,
8222 sized_target, and set_target methods.
8223 (Object::sized_target): Remove.
8224 (class Sized_relobj): Update declarations. Remove sized_target.
8225 * object.cc (Sized_relobj::setup): Remove target parameter.
8227 (Input_objects::add_object): Don't do anything with the target.
8228 (make_elf_sized_object): Add punconfigured parameter. Change all
8229 callers. Set or test parameter target.
8230 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
8232 * parameters.cc (Parameters::set_target): Change parameter type to
8234 (Parameters::default_target): Remove.
8235 (set_parameters_target): Change parameter type to be non-const.
8236 (parameters_force_valid_target): New function.
8237 (parameters_clear_target): New function.
8238 * parameters.h (class Parameters): Update declarations. Remove
8239 default_target method. Add sized_target and clear_target
8240 methods. Change target_ to be non-const.
8241 (set_parameters_target): Update declaration.
8242 (parameters_force_valid_target): Declare.
8243 (parameters_clear_target): Declare.
8244 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
8245 as NULL if we aren't searching.
8246 (Add_symbols::run): Don't check for compatible target.
8247 * fileread.cc (Input_file::open_binary): Call
8248 parameters_force_valid_target.
8249 * gold.cc (queue_middle_tasks): Likewise.
8250 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
8251 set_target on object.
8252 * dynobj.h (class Sized_dynobj): Update declarations.
8253 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
8254 make_elf_object returns NULL.
8255 (Archive::include_member): Don't check whether object target is
8257 * output.cc (Output_section::add_input_section): Get target from
8259 (Output_section::relax_input_section): Likewise.
8260 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
8262 (Sized_relobj::do_scan_relocs): Likewise.
8263 (Sized_relobj::relocate_sections): Likewise.
8264 * resolve.cc (Symbol_table::resolve): Likewise.
8265 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
8266 parameter. Change all callers.
8267 (Symbol_table::add_from_object): Get target from parameters.
8268 (Symbol_table::add_from_relobj): Don't check object target.
8269 (Symbol_table::add_from_dynobj): Likewise.
8270 (Symbol_table::define_special_symbol): Get target from
8272 * symtab.h (class Symbol_table): Update declaration.
8273 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
8274 parameter. Change all callers. Clear parameter target.
8275 (Binary_test): Test target here.
8276 * testsuite/object_unittest.cc (gold_testsuite): Remove
8277 target_test_pointer parameter. Change all callers.
8278 (Object_test): Test target here.
8280 2009-09-26 Ian Lance Taylor <iant@google.com>
8282 * testsuite/initpri1.c: Don't try to use constructor priorities if
8283 compiling with gcc before 4.3.
8285 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
8287 * testsuite/retain_symbols_file_test.sh (check_present): Change
8288 output file name to retain_symbols_file_test.stdout.
8289 (check_absent): Likewise.
8291 2009-09-18 Craig Silverstein <csilvers@google.com>
8293 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
8294 * options.cc: Include <cerrno> and <fstream>.
8295 (General_options::finalize): Parse -retain-symbols-file tag.
8296 * options.h: New flag.
8297 (General_options): New method should_retain_symbol, new
8298 variable symbols_to_retain.
8299 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
8300 should_retain_symbol map.
8301 * testsuite/Makefile.am (retain_symbols_file_test): New test.
8302 * testsuite/Makefile.in: Regenerate.
8303 * testsuite/retain_symbols_file_test.sh: New file.
8305 2009-09-18 Nick Clifton <nickc@redhat.com>
8307 * po/es.po: Updated Spanish translation.
8309 2009-09-17 Doug Kwan <dougkwan@google.com>
8311 * debug.h (DEBUG_RELAXATION): New constant.
8312 (DEBUG_ALL): Add DEBUG_RELAXATION.
8313 (debug_string_to_enum): Add relaxation debug option.
8315 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
8316 Layout::Relaxation_debug_check::read_sections,
8317 Layout::Relaxation_debug_check::read_sections): New method definitions.
8318 (Layout::Layout): Initialize data members
8319 record_output_section_data_from_scrips_,
8320 script_output_section_data_list_ and relaxation_debug_check_.
8321 (Layout::save_segments, Layout::restore_segments,
8322 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8323 Layout::relaxation_loop_body): New method definitions.
8324 (Layout::finalize): Support relaxation. Move section layout code to
8325 Layout::relaxation_loop_body.
8326 (Layout::set_asection_address_from_script): Move code for orphan
8327 section placement out.
8328 (Layout::place_orphan_sections_in_script): New method definition.
8329 * layout.h (Output_segment_headers, Output_file_header):
8330 New forward class declarations.
8331 (Layout::~Layout): Define.
8332 (Layout::new_output_section_data_from_script): New method definition.
8333 (Layout::place_orphan_sections_in_script): New method declaration.
8334 (Layout::Segment_states): New type declaration.
8335 (Layout::save_segments, Layout::restore_segments,
8336 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8337 Layout::relaxation_loop_body): New method declarations.
8338 (Layout::Output_section_data_list): New type declaration.
8339 (Layout::Relaxation_debug_check): New class definition.
8340 (Layout::record_output_section_data_from_script_,
8341 Layout::script_output_section_data_list_, Layout::segment_states_,
8342 Layout::relaxation_debug_check_): New data members.
8343 * output.cc: (Output_section_headers::do_size): New method definition.
8344 (Output_section_headers::Output_section_headers): Move size
8345 computation to Output_section_headers::do_size.
8346 (Output_segment_headers::do_size): New method definition.
8347 (Output_file_header::Output_file_header): Move size computation to
8348 Output_file_header::do_size and call it.
8349 (Output_file_header::do_size): New method definition.
8350 (Output_data_group::Output_data_group): Adjust call to
8351 Output_section_data.
8352 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
8353 (Output_symtab_xindex::do_write): Add array bound check.
8354 (Output_section::Input_section::print_to_mapfile): Handle
8355 RELAXED_INPUT_SECTION_CODE.
8356 (Output_section::Output_section): Initialize data member checkpoint_.
8357 (Output_section::~Output_section): Delete checkpoint object pointed
8359 (Output_section::add_input_section): Always add an Input_section if
8361 (Output_section::add_merge_input_section): Add assert.
8362 (Output_section::relax_input_section): New method definition.
8363 (Output_section::set_final_data_size): Set load address to zero for
8364 an unallocated section.
8365 (Output_section::do_address_and_file_offset_have_reset_values):
8366 New method definition.
8367 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
8368 Handle relaxed input section.
8369 (Output_section::sort_attached_input_sections): Checkpoint input
8370 section list lazily.
8371 (Output_section::get_input_sections): Change type of input_sections to
8372 list of Simple_input_section pointers. Checkpoint input section list
8373 lazily. Also handle relaxed input sections.
8374 (Output_section::add_input_section_for_script): Take a reference to
8375 a Simple_input_section object instead of Relobj pointer and section
8376 index as parameter. Handle relaxed input sections.
8377 (Output_section::save_states, Output_section::restore_states): New
8379 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
8380 (Output_data::is_data_size_fixed): New method definition.
8381 (Output_data::reset_addresss_and_file_offset): Do not reset data size
8383 (Output_data::address_and_file_offset_have_reset_values): New method
8385 (Output_data::do_address_and_file_offset_have_reset_values): New method
8387 (Output_data::set_data_size): Check that data size is not fixed.
8388 (Output_data::fix_data_size): New method definition.
8389 (Output_data::is_data_size_fixed_): New data member.
8390 (Output_section_headers::set_final_data_size): New method definition.
8391 (Output_section_headers::do_size): New method declaration.
8392 (Output_segment_headers::set_final_data_size): New method definition.
8393 (Output_segment_headers::do_size): New method declaration.
8394 (Output_file_header::set_final_data_size)::New method definition.
8395 (Output_file_header::do_size)::New method declaration.
8396 (Output_section_data::Output_section_data): Add new parameter
8397 is_data_size_fixed and use it to fix data size.
8398 (Output_data_const::Output_data_const): Adjust call to base class
8399 constructor and fix data size.
8400 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
8401 base class constructor and fix data size.
8402 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
8403 base class constructor and fix data size.
8404 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
8405 class constructor and fix data size.
8406 (Output_data_group::set_final_data_size): New method definition.
8407 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
8408 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
8409 class constructor and fix data size.
8410 (Output_relaxed_input_section): New class definition.
8411 (Output_section::Simple_input_section): New class definition.
8412 (Output_section::get_input_sections): Adjust parameter list.
8413 (Output_section::add_input_section_for_script): Same.
8414 (Output_section::save_states, Output_section::restore_states,
8415 Output_section::do_address_and_file_offset_have_reset_values,
8416 (Output_section::Input_section::Input_section): Handle
8417 RELAXED_INPUT_SECTION_CODE. Add new overload for
8418 Output_relaxed_input_section.
8419 (Output_section::Input_section::is_input_section,
8420 Output_section::Input_section::set_output_section): Handle relaxed
8422 (Output_section::Input_section::is_relaxed_input_section,
8423 Output_section::Input_section::output_section_data,
8424 Output_section::Input_section::relaxed_input_section): New method
8426 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
8428 (Output_section::Input_section::u1_): Update comments.
8429 (Output_section::Input_section::u2_): Add new union member poris.
8430 (Output_section::Checkpoint_output_section): New classs definition.
8431 (Output_section::relax_input_section): New method declaration.
8432 (Output_section::checkpoint_): New data member.
8433 (Output_segment): Update comments.
8434 (Output_segment::Output_segment): Un-privatize copy constructor.
8435 (Output_segment::operator=): Un-privatize.
8436 * script-sections.cc (Output_section_element::Input_section_list):
8437 Change element type to Output_section::Simple_input_section.
8438 (Output_section_element_dot_assignment::set_section_addresses):
8439 Register output section data for relaxation clean up.
8440 (Output_data_exression::Output_data_expression): Adjust call to base
8441 constructor to fix data size.
8442 (Output_section_element_data::set_section_addresses): Register
8443 Output_data_expression object for relaxation clean up.
8444 (struct Input_section_info): Replace Relobj pointer and section index
8445 pair with Output_section::Simple_input_section and Convert struct to a
8447 (Input_section_sorter::operator()): Adjust access to
8448 Input_section_info data member to use accessors.
8449 (Output_section_element_input::set_section_addresses): Use layout
8450 parameter. Adjust code to use Output_section::Simple_input_section
8451 and Input_secction_info classes. Register filler for relaxation
8453 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
8454 and section index pair with Output_section::Simple_input_section
8455 class. Adjust code accordingly.
8456 (Phdrs_element::release_segment): New method definition.
8457 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
8459 (Script_sections::release_segments): New method definition.
8460 * gold/script-sections.h (Script_sections::release_segments): New
8462 * gold/target.h (Target::may_relax, Target::relax,
8463 Target::do_may_relax, Target::do_relax): New method definitions.
8465 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8467 * arm.cc (has_signed_unsigned_overflow): New function.
8468 (Arm_relocate_functions::abs8): New function.
8469 (Target_arm::Scan::local): Handle R_ARM_ABS8.
8470 (Target_arm::Scan::global): Likewise.
8471 (Target_arm::relocate::relocate): Likewise.
8472 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8475 2009-09-16 Cary Coutant <ccoutant@google.com>
8477 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
8478 * testsuite/Makefile.in: Regenerate.
8480 2009-09-11 Nick Clifton <nickc@redhat.com>
8482 * po/gold.pot: Updated by the Translation project.
8484 2009-09-08 Cary Coutant <ccoutant@google.com>
8486 * output.cc (Output_file::open): Add execute permission to empty file.
8487 * testsuite/Makefile.am (permission_test): New test.
8488 * testsuite/Makefile.in: Regenerate.
8490 2009-09-02 Ian Lance Taylor <iant@google.com>
8492 * output.cc (Output_file::resize): Call map_no_anonymous rather
8495 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
8497 * gold.cc: Include "incremental.h".
8498 (queue_initial_tasks): Call Incremental_checker methods.
8499 * incremental.cc: Include "output.h".
8500 (Incremental_checker::can_incrementally_link_output_file): New
8502 * incremental.h (Incremental_checker): New class.
8504 * output.cc (Output_file::open_for_modification): New method.
8505 (Output_file::map_anonymous): Changed return type to bool. Record
8507 (Output_file::map_no_anonymous): New method, broken out of map.
8508 (Output_file::map): Use map_no_anonymous and map_anonymous.
8509 * output.h (class Output_file): Update declarations.
8511 2009-08-24 Cary Coutant <ccoutant@google.com>
8513 * options.h (Command_line::Pre_options): New class.
8514 (Command_line::pre_options): New member.
8515 * options.cc (gold::options::ready_to_register): New variable.
8516 (One_option::register_option): Do nothing if not registering options.
8517 Assert if same short option registered twice.
8518 (General_options::General_options): Turn off option registration when
8520 (Command_line::Pre_options::Pre_options): New constructor.
8522 2009-08-24 Cary Coutant <ccoutant@google.com>
8524 * options.h (General_options::no_keep_memory): Remove incorrect
8527 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8529 * Makefile.am (am__skiplex, am__skipyacc): New.
8530 * Makefile.in: Regenerate.
8532 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8534 * Makefile.am (AM_CPPFLAGS): Renamed from ...
8535 (INCLUDES): ... this.
8536 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
8537 (AM_CPPFLAGS): Renamed from ...
8538 (INCLUDE): ... this.
8539 * Makefile.in, testsuite/Makefile.in: Regenerate.
8541 * Makefile.in: Regenerate.
8542 * aclocal.m4: Likewise.
8543 * config.in: Likewise.
8544 * configure: Likewise.
8545 * testsuite/Makefile.in: Likewise.
8547 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8548 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8549 * Makefile.in: Regenerate.
8550 * testsuite/Makefile.in: Regenerate.
8552 2009-08-19 Cary Coutant <ccoutant@google.com>
8554 * resolve.cc (Symbol_table::resolve): Don't complain about defined
8555 symbols in shared libraries overridden by hidden or internal symbols
8556 in the main program.
8558 2009-08-19 Chris Demetriou <cgd@google.com>
8560 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
8561 checking source file names in error messages.
8563 2009-08-18 Doug Kwan <dougkwan@google.com>
8565 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
8566 an elcpp::Ehdr as parameter. Adjust call to set_target.
8567 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
8568 an elfcpp::Ehdr as parameter.
8569 * object.cc (Object::set_target): Remove the version that looks up
8570 a target and sets it.
8571 (Sized_relobj::setup): Take a Target object instead of
8572 an elfcpp::Ehdr as parameter. Adjust call to set_target.
8573 (make_elf_sized_object): Find target and ask target to
8575 * object.h: (Object::set_target): Remove the version that looks up
8576 a target and sets it.
8577 (Sized_relobj::setup): Take a Target object instead of
8578 an elfcpp:Ehdr as parameter.
8579 * target.cc: Include dynobj.h.
8580 (Target::do_make_elf_object_implementation): New.
8581 (Target::do_make_elf_object): New.
8582 * target.h (Target::make_elf_object): New template declaration.
8583 (Target::do_make_elf_object): New method declarations.
8584 (Target::do_make_elf_object_implementation): New template declaration.
8586 2009-08-14 Ian Lance Taylor <iant@google.com>
8588 * gold.h (FUNCTION_NAME): Define.
8589 (gold_unreachable): Use FUNCTION_NAME.
8591 2009-08-12 Sriraman Tallam <tmsriram@google.com>
8593 * icf.cc (Icf::find_identical_sections): Issue a warning when a
8594 symbol in the --keep-unique list is not found.
8596 2009-08-12 Sriraman Tallam <tmsriram@google.com>
8598 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
8599 been maked as --keep-unique.
8600 (Icf::unfold_section): New function.
8601 * icf.h (Icf::unfold_section): New function.
8602 * options.h (General_options::keep_unique): New option.
8603 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
8604 * testsuite/Makefile.in: Regenerate.
8605 * testsuite/icf_keep_unique_test.sh: New file.
8606 * testsuite/icf_keep_unique_test.cc: New file.
8608 2009-08-12 Cary Coutant <ccoutant@google.com>
8611 * resolve.cc (Symbol_table::resolve): Check for references from
8612 dynamic objects to hidden and internal symbols.
8613 * testsuite/Makefile.am (hidden_test.sh): New test.
8614 * testsuite/Makefile.in: Regenerate.
8615 * testsuite/hidden_test.sh: New script.
8616 * testsuite/hidden_test_1.c: New test source.
8617 * testsuite/hidden_test_main.c: New test source.
8619 2009-08-11 Doug Kwan <dougkwan@google.com>
8621 * arm.cc: Update comments.
8622 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
8623 segment to locate the .ARM.exidx section if present.
8625 2009-08-09 Doug Kwan <dougkwan@google.com>
8627 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
8630 2009-08-07 Sriraman Tallam <tmsriram@google.com>
8631 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
8634 2009-08-06 Sriraman Tallam <tmsriram@google.com>
8636 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
8637 valid tls_segment only for non-debug-section relocations.
8638 * testsuite/Makefile.am: Add gc_tls_test.
8639 * testsuite/Makefile.in: Regenerate.
8640 * testsuite/gc_tls_test.cc: New file.
8641 * testsuite/gc_tls_test.sh: New file.
8643 2009-08-05 Sriraman Tallam <tmsriram@google.com>
8647 * Makefile.am (CCFILES): Add icf.cc.
8649 * Makefile.in: Regenerate.
8650 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
8651 * gc.h (gc_process_relocs): Populate lists used by icf to contain
8652 section, symbol and addend information for the relocs.
8653 * gold.cc (queue_middle_tasks): Call identical code folding.
8654 * gold.h: Add defines for multimap.
8655 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
8656 to the call of finalize_local_symbols.
8657 * main.cc (main): Create object of class Icf.
8658 * object.cc (Sized_relobj::do_layout): Allow this function to be
8659 called twice during icf.
8660 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
8661 to sections marked as identical by icf.
8662 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
8664 (Sized_relobj::do_section_entsize): New function.
8665 * object.h (Object::section_entsize): New function.
8666 (Object::do_section_entsize): New pure virtual function.
8667 (Relobj::finalize_local_symbols): Add new parameter.
8668 (Relobj::do_section_entsize): New function.
8669 * options.h (General_options::icf): New option.
8670 (General_options::icf_iterations): New option.
8671 (General_options::print_icf_sections): New option.
8672 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
8673 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
8674 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
8676 * symtab.cc (Symbol_table::is_section_folded): New function.
8677 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
8678 to sections marked as identical by icf.
8679 * symtab.h (Symbol_table::set_icf): New function.
8680 (Symbol_table::icf): New function.
8681 (Symbol_table::is_section_folded): New function.
8682 (Symbol_table::icf_): New data member.
8683 * target-reloc.h (relocate_section): Ignore sections folded by icf.
8684 * testsuite/Makefile.am: Add commands to build icf_test.
8685 * testsuite/Makefile.in: Regenerate.
8686 * testsuite/icf_test.sh: New file.
8687 * testsuite/icf_test.cc: New file.
8689 2009-07-24 Chris Demetriou <cgd@google.com>
8691 * layout.cc (is_compressible_debug_section): Fix incorrect
8692 comment about compressed section names.
8694 2009-07-20 Ian Lance Taylor <ian@airs.com>
8697 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
8699 2009-07-16 Ian Lance Taylor <iant@google.com>
8702 * layout.h: #include <map>.
8703 (class Kept_section): Change from struct to class. Add accessors
8704 and setters. Add section size to Comdat_group mapping. Change
8705 Comdat_group to std::map. Add is_comdat_ field. Add
8706 linkonce_size field in union.
8707 (class Layout): Update declaration of find_or_add_kept_section.
8708 Don't declare find_kept_object.
8709 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
8710 parameter. Add object, shndx, is_comdat, and is_group_name
8711 parameters. Change all callers. Adjust for new Kept_section.
8712 (Layout::find_kept_object): Remove.
8713 * object.cc (Sized_relobj::include_section_group): Update use of
8714 Kept_section. Rename secnum to shndx. Only record
8715 Kept_comdat_section if sections are the same size.
8716 (Sized_relobj::include_linkonce_section): Update use of
8717 Kept_section. Only record Kept_comdat_section if sections are the
8718 same size. Set size of linkonce section.
8719 (Sized_relobj::map_to_kept_section): Update call to
8720 get_kept_comdat_section.
8721 * object.h (class Sized_relobj): Rename fields in
8722 Kept_comdat_section to drop trailing underscores; change object
8723 field to Relobj*. Change Kept_comdat_section_table to store
8724 struct rather than pointer.
8725 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
8726 Add kept_object and kept_shndx parameters. Change all callers.
8727 (Sized_relobj::get_kept_comdat_section): Change return type to
8728 bool. Add kept_object and kept_shndx parameters. Change all
8730 * plugin.cc (Pluginobj::include_comdat_group): Update call to
8731 Layout::find_or_add_kept_section.
8733 2009-07-09 Ian Lance Taylor <iant@google.com>
8735 * merge.cc (Object_merge_map::initialize_input_to_output_map):
8736 Reserve space in the hash table.
8738 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
8740 * fileread.cc (File_read::get_mtime): New method.
8741 * fileread.h (Timespec): New structure.
8742 (File_read::get_mtime): New method.
8743 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
8744 Renamed from timestamp_nsec.
8745 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
8747 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
8749 (Incremental_inputs::report_archive): Save mtime; style fix.
8750 (Incremental_inputs::report_obejct): Save mtime; style fix.
8751 (Incremental_inputs::report_script): Save mtime; style fix.
8752 (Incremental_inputs::finalize_inputs): Style fix.
8753 (Incremental_inputs::finalize): Style fix.
8754 (Incremental_inputs::create_input_section_data): Store inputs
8756 * incremental.h (Incremental_inputs::report_script): Add mtime
8758 (Incremental_inputs::Input_info::Input_info): Intialize only one
8760 (Incremental_inputs::Input_info::archive): Move to nameless
8762 (Incremental_inputs::Input_info::obejct): Move to nameless union.
8763 (Incremental_inputs::Input_info::script): Move to nameless union.
8764 (Incremental_inputs::mtime): New field.
8765 * script.cc (read_input_script): Pass file mtime to
8767 * script.h (Script_info::inputs): Style fix.
8769 2009-07-01 Ian Lance Taylor <ian@airs.com>
8771 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
8774 2009-06-24 Ian Lance Taylor <iant@google.com>
8777 * layout.cc (Layout::choose_output_section): If we find an
8778 existing section, update the flags.
8779 (Layout::create_notes): New function, broken out of
8781 (Layout::finalize): Don't create note sections.
8782 (Layout::create_note): Don't crash if linker script discards
8784 (Layout::create_gold_note): Likewise.
8785 (Layout::create_build_id): Likewise. Don't set
8786 after_input_sections on the section.
8787 (Layout::create_executable_stack_info): Remove target parameter.
8789 * layout.h (class Layout): Declare create_notes. Update
8790 declaration of create_executable_stack_info.
8791 * gold.cc (queue_middle_tasks): Call create_notes.
8792 * output.cc (Output_section::update_flags_for_input_section): Move
8793 here from output.h. If SHF_ALLOC flag is newly set, mark address
8795 * output.h (Output_data::mark_address_invalid): New function.
8796 (class Output_section): Only declare, not define,
8797 update_flags_for_input_section. Remove set_flags.
8799 2009-06-24 Ian Lance Taylor <iant@google.com>
8801 * script-sections.cc (Output_section_definition::
8802 set_section_addresses): Rename shadowing local load_address to
8805 2009-06-24 Ian Lance Taylor <iant@google.com>
8808 * reloc.cc (relocate_sections): Skip empty relocation sections.
8810 2009-06-23 Ian Lance Taylor <iant@google.com>
8813 * layout.cc (Layout::create_note): Use choose_output_section
8814 rather than make_output_section.
8816 2009-06-23 Ian Lance Taylor <iant@google.com>
8819 * options.cc (General_options::parse_V): Set printed_version_.
8820 (General_options::General_options): Initialize printed_version_.
8821 * options.h (class General_options): Add printed_version_ field.
8822 * gold.cc (queue_initial_tasks): If there are no input files,
8823 don't give a fatal error if we printed the version information.
8824 (queue_middle_tasks): If using -r with a shared object, give a
8825 fatal error rather than an ordinary error.
8827 2009-06-23 Ian Lance Taylor <iant@google.com>
8830 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
8831 (Layout::make_output_section): Set have_stabstr_section_ if we see
8832 a .stab*str section.
8833 (Layout::finalize): Call link_stabs_sections.
8834 (Layout::link_stabs_sections): New file.
8835 * layout.h (class Layout): Add have_stabstr_section_ field.
8836 Declare link_stabs_sections.
8838 2009-06-23 Doug Kwan <dougkwan@google.com>
8840 * Makefile.am (libgold_a_LIBADD): New.
8841 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
8842 * Makefile.in: Regenerate.
8843 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
8844 * configure: Regenerate.
8845 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
8846 * fileread.cc: Include sys/state.h
8847 * gold.h: Declare memmem and strndup if found missing.
8848 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
8850 2009-06-23 Ian Lance Taylor <iant@google.com>
8852 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
8853 * configure: Rebuild.
8855 2009-06-23 Ian Lance Taylor <iant@google.com>
8858 * object.cc (Object::section_contents): Don't try to get a view if
8859 the section has length zero.
8860 (Object::handle_gnu_warning_section): If the section is empty, use
8861 the name of the section as the warning.
8863 2009-06-23 Ian Lance Taylor <iant@google.com>
8866 * stringpool.h (class Stringpool_template): Add optimize_ field.
8867 (Stringpool_template::set_optimize): New function.
8868 * stringpool.cc (Stringpool_template::Stringpool_template):
8869 Initialize optimize_ field.
8870 (Stringpool_template::set_string_offsets): Test local optimize
8871 fild rather than parameter.
8872 * layout.cc (Layout::Layout): Call set_optimize on the section
8875 2009-06-22 Ian Lance Taylor <iant@google.com>
8878 * yyscript.y: Parse TARGET.
8879 * script.cc (script_set_target): New function.
8880 * script-c.h (script_set_target): Declare.
8881 * options.cc (General_options::string_to_object_format): Rename
8882 from string_to_object_format in anonymous namespace. Change
8884 * options.h (class General_options): Declare
8885 string_to_object_format.
8887 2009-06-22 Ian Lance Taylor <iant@google.com>
8889 * script-sections.cc (Script_sections::create_segments): Don't put
8890 program headers in a PT_LOAD segment if -n or -N.
8892 2009-06-22 Ian Lance Taylor <iant@google.com>
8895 * options.h (class General_options): Add -z lazy and -z now. Sort
8896 -z options into alphabetical order.
8897 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
8899 2009-06-21 Ian Lance Taylor <iant@google.com>
8901 * layout.cc (Layout::make_output_section): Call
8902 Target::new_output_section.
8903 (Layout::attach_allocated_section_to_segment): Put large section
8904 sections in a separate load segment with the large segment flag
8906 (Layout::segment_precedes): Sort large data segments after other
8908 (align_file_offset): New static function.
8909 (Layout::set_segment_offsets): Use align_file_offset.
8910 * output.h (class Output_section): Add is_small_section_ and
8911 is_large_section_ fields.
8912 (Output_section::is_small_section): New function.
8913 (Output_section::set_is_small_section): New function.
8914 (Output_section::is_large_section): New function.
8915 (Output_section::set_is_large_section): New function.
8916 (Output_section::is_large_data_section): New function.
8917 (class Output_segment): Add is_large_data_segment_ field.
8918 (Output_segment::is_large_data_segment): New function.
8919 (Output_segment::set_is_large_data_segment): New function.
8920 * output.cc (Output_section::Output_section): Initialize new
8922 (Output_segment::Output_segment): Likewise.
8923 (Output_segment::add_output_section): Add assertion that large
8924 data sections always go in large data segments. Force small data
8925 sections to the end of the list of data sections. Force small BSS
8926 sections to the start of the list of BSS sections. For large BSS
8927 sections to the end of the list of BSS sections.
8928 * symtab.h (class Symbol): Declare is_common_shndx.
8929 (Symbol::is_defined): Check Symbol::is_common_shndx.
8930 (Symbol::is_common): Likewise.
8931 (class Symbol_table): Define enum Commons_section_type. Update
8932 declarations. Add small_commons_ and large_commons_ fields.
8933 * symtab.cc (Symbol::is_common_shndx): New function.
8934 (Symbol_table::Symbol_table): Initialize new fields.
8935 (Symbol_table::add_from_object): Put small and large common
8936 symbols in the right list.
8937 (Symbol_table::sized_finalized_symbol): Check
8938 Symbol::is_common_shndx.
8939 (Symbol_table::sized_write_globals): Likewise.
8940 * common.cc (Symbol_table::do_allocate_commons): Allocate new
8941 common symbol lists. Don't call do_allocate_commons_list if the
8943 (Symbol_table::do_allocate_commons_list): Remove is_tls
8944 parameter. Add comons_section_type parameter. Change all
8945 callers. Handle small and large common symbols.
8946 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
8947 Symbol::is_common_shndx.
8948 * resolve.cc (symbol_to_bits): Likewise.
8949 * target.h (Target::small_common_shndx): New function.
8950 (Target::small_common_section_flags): New function.
8951 (Target::large_common_shndx): New function.
8952 (Target::large_common_section_flags): New function.
8953 (Target::new_output_section): New function.
8954 (Target::Target_info): Add small_common_shndx, large_common_shndx,
8955 small_common_section_flags, and large_common_section_flags
8957 (Target::do_new_output_section): New virtual function.
8958 * arm.cc (Target_arm::arm_info): Initialize new fields.
8959 * i386.cc (Target_i386::i386_info): Likewise.
8960 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
8962 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
8963 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
8964 (Target_x86_64::do_new_output_section): New function.
8965 * configure.ac: Define conditional MCMODEL_MEDIUM.
8966 * testsuite/Makefile.am (check_PROGRAMS): Add large.
8967 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
8968 (large_LDFLAGS): Define.
8969 * testsuite/large.c: New file.
8970 * testsuite/testfile.cc (Target_test::test_target_info):
8971 Initialize new fields.
8972 * configure, testsuite/Makefile.in: Rebuild.
8974 2009-06-05 Doug Kwan <dougkwan@google.com>
8976 * Makefile.am (CCFILES): Add target.cc.
8977 * Makefile.in: Regenerate.
8978 * i386.cc (class Target_i386): Define new virtual method to
8979 override do_is_local_label_name in parent.
8980 * object.cc (Sized_relobj::do_count_local_symbols): Discard
8981 local symbols if --discard-locals or -X is given.
8982 * options.h (class General_options): Declare new options
8983 '--discard-locals' and '-X' for discarding locals.
8984 * target.h (class Target): Define new methods is_local_label_name.
8985 Declare new virtual method do_is_local_label_name.
8986 * target.cc: New file.
8987 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
8988 (check_SCRIPTS): Add discard_locals_test.sh.
8989 (check_DATA): Add discard_local_tests.syms.
8990 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
8991 (discard_local_tests.syms, discard_locals_test.o): New make rules.
8992 * testsuite/Makefile.in: Regenerate.
8993 * testsuite/discard_locals_test.c: New file.
8994 * testsuite/discard_locals_test.sh: Same.
8996 2009-06-05 Doug Kwan <dougkwan@google.com>
8998 * object.cc (Sized_relobj::Sized_relobj): Initialize
8999 discarded_eh_frame_shndx_ to -1U.
9000 (Sized_relobj::do_layout): Record index of a discard .eh_frame
9002 (Sized_relobj::do_count_local_symbols): Skip local symbols in
9003 a discarded .eh_frame section.
9004 (Sized_relobj::do_finalize_local_symbols): Ditto.
9005 * object.h (class Sized_relobj): Declare new member
9006 discarded_eh_frame_shndx_.
9007 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
9008 (local_labels_test.o, local_labels_test): New rules.
9009 * testsuite/Makefile.in: Regenerate.
9011 2009-06-04 Doug Kwan <dougkwan@google.com>
9013 * layout.cc (Layout::section_name_mapping): Add mapping for
9014 special ARM sections.
9016 2009-06-03 Doug Kwan <dougkwan@google.com>
9018 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
9019 (utils::has_overflow): Same.
9021 2009-06-03 Ian Lance Taylor <iant@google.com>
9023 * layout.cc (Layout::section_name_mapping): New array, replacing
9024 Layout::linkonce_mapping.
9025 (Layout::section_name_mapping_count): New variable, replacing
9026 Layout::linkonce_mapping_count.
9027 (Layout::linkonce_output_name): Remove.
9028 (Layout::output_section_name): Rewrite.
9029 * layout.h (class Layout): Rename Linkonce_mapping to
9030 Section_name_mapping, linkonce_mapping to section_name_mapping,
9031 linkonce_mapping_count to section_name_mapping_count. Don't
9032 declare linkonce_output_name.
9034 2009-06-03 Doug Kwan <dougkwan@google.com>
9036 * gold/arm.cc (namespace utils): New.
9037 (Target_arm::reloc_is_non_pic): Define new method.
9038 (class Arm_relocate_functions): New.
9039 (Target_arm::Relocate::relocate): Handle relocation types used by
9042 2009-06-03 Ian Lance Taylor <iant@google.com>
9044 * arm.cc (Target_arm::scan::global): Use || instead of |.
9046 2009-06-02 Doug Kwan <dougkwan@google.com>
9048 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
9049 issued_non_pic_error_.
9050 (class Target_arm::Scan): Declare new method check_non_pic.
9051 Define new method symbol_needs_plt_entry.
9052 Declare new data member issued_non_pic_error_.
9053 (class Target_arm::Relocate): Declare new method
9054 should_apply_static_reloc.
9055 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9056 (Target_arm::Scan::check_non_pic): Define new method.
9057 (Target_arm::Scan::local): Handle a small subset of reloc types used
9059 (Target_arm::Scan::local): Same.
9060 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9062 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
9064 * incremental.cc (Incremental_inputs::report_command_line): Filter
9065 out --incremental-* options.
9067 2009-05-29 Doug Kwan <dougkwan@google.com>
9069 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9071 (class Target_arm): Update comment.
9072 (Target_arm::Target_arm): Initialize new data members GOT_,
9073 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
9074 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
9075 and Target_arm::rel_dyn_section.
9076 Declare new_enum Target_arm::Got_type.
9077 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
9079 Update commments for member do_dynsym_value.
9080 (Target_arm::got_size, Target_arm::plt_section,
9081 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
9082 new methods inside class defintion.
9083 (Target_arm::got_section): Define new method.
9084 (Target_arm::rel_dyn_section): Same.
9085 (Output_data_plt_arm): New template class.
9086 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
9087 (Output_data_plt_arm:do_adjust_output_section): Define new method.
9088 (Output_data_plt_arm::add_entry): Same.
9089 (Output_data_plt_arm::first_plt_entry): Define new
9090 static data member for PLT instruction template.
9091 (Output_data_plt_arm::plt_entry): Same.
9092 (Output_data_plt_arm::do_write): Define new method.
9093 (Target_arm::make_plt_entry): Same.
9094 (Target_arm::do_finalize_sections): Same.
9095 (Target_arm::do_dynsym_value): Same.
9097 2009-05-28 Doug Kwan <dougkwan@google.com>
9099 * Makefile.am (TARGETSOURCES): Add arm.cc.
9100 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
9101 * Makefile.in: Regenerate.
9103 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
9105 2009-05-26 Doug Kwan <dougkwan@google.com>
9107 * options.cc (General_options::parse_exclude_libs). Fix a comment.
9108 (General_options::check_excluded_libs): Strip off directories in
9109 archive name before matching like GNU ld does.
9110 * testsuite/Makefile.am (MOSTLYCLEANFILES,
9111 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
9112 (exclude_libs_test_LDFLAGS): Add linker option
9113 -Wl,--exclude-libs,libexclude_libs_test_3
9114 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
9115 an explicit archive without using -l.
9116 (alt/libexclude_libs_test_3.a): New make rule.
9117 * testsuite/Makefile.in: Regenerate.
9118 * testsuite/exclude_libs_test.c : Declare lib3_default().
9120 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
9121 * exclude_libs_test_3.c: New file.
9123 2009-05-26 Nick Clifton <nickc@redhat.com>
9125 * po/id.po: New Indonesian translation.
9126 * po/gold.pot: Updated template file.
9128 2009-05-22 Sriraman Tallam <tmsriram@google.com>
9130 * testsuite/Makefile.am: Add -ffunction-sections to compile
9131 gc_comdat_test files. Add -Wl,--gc-sections to build
9133 * testsuite/Makefile.in: Regenerate.
9134 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
9136 2009-05-21 Sriraman Tallam <tmsriram@google.com>
9138 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
9139 kept comdat section was garbage collected.
9140 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
9141 * testsuite/Makefile.in: Regenerate.
9142 * testsuite/gc_comdat_test.sh: New file.
9143 * testsuite/gc_comdat_test_1.cc: New file.
9144 * testsuite/gc_comdat_test_2.cc: New file.
9146 2009-05-19 Doug Kwan <dougkwan@google.com>
9148 * archive.cc (Archive::Archive): Move constructor from archive.h
9149 to here. Initialize no_export_.
9150 (Archive::get_elf_object_for_member): Set no_export flag of object.
9151 * archive.h (Archive::Archive): Move constructor body to
9153 (Archive::no_export): New method.
9154 (Archive::no_export_): New field.
9155 * object.h (Object::Object): Initialize no_export_ to false.
9156 (Object::no_export, Object::set_no_export): New methods.
9157 (Object::no_export_): New field.
9158 * options.cc (General_options::parse_exclude_libs): New method.
9159 (General_options::check_excluded_libs) Same.
9160 * options.h (exclude_libs): New option.
9161 (General_options::check_excluded_libs): New method declaration.
9162 (General_options::excluded_libs_): New field.
9163 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
9164 default or protected visibility if an object has no-export flag set.
9165 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
9166 (check_SCRIPTS): Add exclude_libs_test.sh.
9167 (check_DATA): Add exclude_libs_test.syms.
9168 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
9169 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
9170 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
9171 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
9172 (exclude_libs_test.syms, libexclude_libs_test_1.a,
9173 libexclude_libs_test_2.a): New rules.
9174 * testsuite/Makefile.in: Regenerate.
9175 * testsuite/exclude_libs_test.c: New file.
9176 * testsuite/exclude_libs_test.sh: Ditto.
9177 * testsuite/exclude_libs_test_1.c: Ditto.
9178 * testsuite/exclude_libs_test_2.c: Ditto.
9180 2009-05-15 Ian Lance Taylor <iant@google.com>
9182 * configure.ac: Check for declarations for cases where libiberty.h
9183 checks HAVE_DECL_xxx.
9184 * configure, config.in: Rebuild.
9186 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
9188 * gold.h (Incremental_argument_list): Remove (invalid) forward
9190 * incremental.cc (Incremental_inputs::report_achive): New method.
9191 (Incremental_inputs::report_object): New method.
9192 (Incremental_inputs::report_script): New method.
9193 (Incremental_inputs::finalize_inputs): New method.
9194 (Incremental_inputs::finalize): Call finalize_inputs().
9195 (Incremental_inputs::sized_create_incremental_inputs_section_data):
9196 Create inputs entries.
9197 * incremental.h (Incremental_input_type): New enum.
9198 (Incremental_inputs::Incremental_input): Initialize new fields.
9199 (Incremental_inputs::report_inputs): New method.
9200 (Incremental_inputs::report_achive): New method.
9201 (Incremental_inputs::report_object): New method.
9202 (Incremental_inputs::report_script): New method.
9203 (Incremental_inputs::finalize_inputs): New method.
9204 (Incremental_inputs::Input_info): New struct.
9205 (Incremental_inputs::Input_info_map): New typedef.
9206 (Incremental_inputs::lock_): New field.
9207 (Incremental_inputs::Inputs_): New field.
9208 (Incremental_inputs::Inputs_map): New field.
9209 * main.cc (main): Call Incremental_input::report_inputs.
9210 * options.h (Input_argument_list): Typedef moved from
9212 (Input_file_group::Files): Remove, use ::Input_argument_list.
9213 (Input_file_group::Input_argument_list): Remove, use
9214 ::Input_argument_list.
9215 * plugin.cc (Plugin_manager::add_input_file): Add error in
9217 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
9219 * script.cc (read_input_script): Call
9220 Incremental_input::report_script.
9221 * script.h (Script_info): New class.
9223 2009-04-27 Ian Lance Taylor <iant@google.com>
9225 * x86_64.cc (do_adjust_output_section): Set entsize to
9228 2009-04-23 Elliott Hughes <enh@google.com>
9230 * output.cc (Output_file::close): After short writes, continue
9231 writing from the correct offset in the buffer being written.
9233 2009-04-23 Chris Demetriou <cgd@google.com>
9235 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
9236 * configure: Regenerate.
9237 * config.in: Regenerate.
9238 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
9239 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
9241 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
9243 * incremental.cc (Incremental_inputs_header_data): Renamed from
9244 Incremental_input_header_data.
9245 (Incremental_inputs_header_data::data_size): New field.
9246 (Incremental_inputs_header_data::put_input_file_count): Renamed
9247 from input_file_count.
9248 (Incremental_inputs_header_data::put_command_line_offset): Renamed
9249 from command_line_offset.
9250 (Incremental_inputs_header_data::put_reserved): Renamed from
9252 (Incremental_inputs_entry_data): Renamed from
9253 Incremental_input_entry_data.
9254 (Incremental_inputs_entry_data::data_size): New field.
9255 (Incremental_inputs::report_command_line): New method.
9256 (Incremental_inputs::finalize): New method.
9257 (Incremental_inputs::create_incremental_inputs_data): New method.
9258 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
9259 * incremental.h: New file.
9260 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
9261 (Layout::finalize): Create incremental inputs section in
9263 (Layout::create_incremental_info_sections): New method.
9264 * layout.h (Layout::incremental_inputs): New method.
9265 (Layout::create_incremental_info_sections): New method.
9266 (Layout::incremental_inputs_): New field.
9267 * main.cc (main): Notify Incremental_input of the command line.
9269 2009-04-01 Ian Lance Taylor <iant@google.com>
9270 Mikolaj Zalewski <mikolajz@google.com>
9272 * gold.h (reserve_unordered_map): Define, three versions, one for
9273 each version of Unordered_map.
9274 * layout.cc (Layout::Layout): Remove options parameter. Add
9275 number_of_input_files parameter. Don't initialize options_.
9276 Initialize number_of_input_files_ and resized_signatures_. Move
9277 sections_are_attached_.
9278 (Layout::layout_group): Reserve space for group_signatures_.
9279 (Layout::find_or_add_kept_section): Change name parameter to be a
9280 reference. Resize signatures_ map when it gets large enough.
9281 (Layout::layout_eh_frame): Use parameters->options() instead of
9283 (Layout::make_output_section): Likewise.
9284 (Layout::attach_allocated_section_to_segment): Likewise.
9285 (Layout::finalize, Layout::create_executable_stack): Likewise.
9286 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
9287 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
9288 * layout.h (class Layout): Update declarations. Remove options_
9289 field. Add number_of_input_files_ and resized_signatures_
9290 fields. Move sections_are_attached_ field.
9291 * main.cc (main): Pass number of input files to Layout
9292 constructor. Don't pass options.
9294 2009-03-30 Ian Lance Taylor <iant@google.com>
9296 * ffsll.c (ffsll): Correct implementation.
9298 2009-03-27 Ian Lance Taylor <iant@google.com>
9300 * ffsll.c: New file.
9301 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
9302 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
9303 * ftruncate.c (ftruncate): Declare before definition.
9304 * mremap.c (mremap): Likewise.
9305 * pread.c (pread): Likewise.
9306 * configure, Makefile.in, config.in: Rebuild.
9308 * mremap.c: New file.
9309 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
9310 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
9311 (mremap): Declare if HAVE_MREMAP is not defined.
9312 * configure, Makefile.in, config.in: Rebuild.
9314 2009-03-27 Cary Coutant <ccoutant@google.com>
9316 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
9317 position independent.
9318 * sparc.cc (Target_sparc::check_non_pic): Likewise.
9319 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
9321 2009-03-24 Cary Coutant <ccoutant@google.com>
9323 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
9325 (needs_dynamic_reloc): Likewise.
9327 2009-03-24 Ian Lance Taylor <iant@google.com>
9329 * yyscript.y (file_cmd): Recognize EXTERN.
9330 (extern_name_list, extern_name_list_body): New nonterminals.
9331 * script.cc (script_add_extern): Define.
9332 * script-c.h (script_add_extern): Declare.
9334 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
9336 * object.cc (is_elf_object): Define.
9337 * object.h (is_elf_object): Declare.
9338 * archive.cc (Archive::get_elf_object_for_member): Call
9340 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
9342 2009-03-24 Elliott Hughes <enh@google.com>
9344 * output.cc (Output_file::map_anonymous): Define.
9345 (Output_file::map): Use map_anonymous. If the regular mmap fails,
9346 try an anonymous one. Report the size if the mmap fails.
9347 * output.h (class Output_file): Declare map_anonymous.
9349 2009-03-24 Ian Lance Taylor <iant@google.com>
9351 * target-select.cc (instantiate_target): Don't acquire the lock if
9352 the instantiated_target_ field has already been set.
9354 2009-03-23 Ian Lance Taylor <iant@google.com>
9356 * gold-threads.h (class Initialize_lock): Define.
9357 * gold-threads.cc (class Initialize_lock_once): Define.
9358 (initialize_lock_control): New static variable.
9359 (initialize_lock_pointer): New static variable.
9360 (initialize_lock_once): New static function.
9361 (Initialize_lock::Initialize_lock): Define.
9362 (Initialize_lock::initialize): Define.
9363 * target-select.h: Include "gold-threads.h".
9364 (class Target_selector): Add lock_ and initialize_lock_ fields.
9365 Don't define instantiate_target, just declare it.
9366 * target-select.cc (Target_selector::Target_selector): Initialize
9368 (Target_selector::instantiate_target): Define.
9369 * descriptors.h: Include "gold-threads.h".
9370 (class Descriptors): Add initialize_lock_ field.
9371 * descriptors.cc (Descriptors::Descriptors): Initialize new
9373 (Descriptors::open): Use initialize_lock_ field
9374 * errors.h (class Errors): Add initialize_lock_ field.
9375 * errors.cc (Errors::Errors): Initialize new field.
9376 (Errors::initialize_lock): Use initialize_lock_ field.
9377 * powerpc.cc (class Target_selector_powerpc): Remove
9378 instantiated_target_ field. In do_recognize call
9379 instantiate_target rather than do_instantiate_target. In
9380 do_instantiate_target just allocate a new target.
9381 * sparc.cc (class Target_selector_sparc): Likewise.
9383 * freebsd.h: New file.
9384 * i386.cc: Include "freebsd.h".
9385 (Target_i386): Derive from Target_freebsd rather than
9387 (Target_selector_i386): Derive from Target_selector_freebsd rather
9388 than Target_selector.
9389 * x86_64.cc: Include "freebsd.h".
9390 (Target_x86_64): Derive from Target_freebsd rather than
9392 (Target_selector_x86_64): Derive from Target_selector_freebsd
9393 rather than Target_selector.
9394 * target.h (class Target): Add adjust_elf_header and
9395 do_adjust_elf_header.
9396 * output.cc (Output_file_header:: do_sized_write): Call target
9397 adjust_elf_header routine.
9398 * configure.tgt: Set targ_osabi.
9399 * configure.ac: Define GOLD_DEFAULT_OSABI.
9400 * parameters.cc (Parameters::default_target): Pass
9401 GOLD_DEFAULT_OSABI to select_target.
9402 * target-select.h (class Target_selector): Make instantiate_target
9403 protected rather than private.
9404 * Makefile.am (HFILES): Add freebsd.h.
9405 * configure, Makefile.in, config.in: Rebuild.
9407 * merge.cc (do_add_input_section): Correct pend value. Change
9408 message about last entry not being null terminated from error to
9411 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
9413 * incremental.cc: New file.
9414 * Makefile.am (CCFILES): Add incremental.cc.
9415 * Makefile.in: Rebuild.
9417 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
9419 * layout.cc (Layout::output_section_name): Preserve names
9420 of '.note.' sections.
9422 2009-03-19 Ian Lance Taylor <iant@google.com>
9424 * descriptors.cc (Descriptors::open): Check that the options are
9425 valid before using them.
9427 2009-03-18 Ian Lance Taylor <iant@google.com>
9429 * script-sections.h: Include <list>.
9430 (class Script_sections): Change Sections_elements from std::vector
9431 to std::list. Typedef public Elements_iterator. Add
9432 orphan_section_placement_, data_segment_align_start_, and
9433 saw_data_segment_align_ fields. Remove data_segment_align_index_
9435 * script-sections.cc (class Orphan_section_placement): New class.
9436 (class Sections_element): Add virtual functions is_relro and
9437 orphan_section_init. Remove virtual function place_orphan_here.
9438 (class Output_section_definition): Add is_relro and
9439 orphan_section_init. Remove place_orphan_here.
9440 (class Orphan_output_section): Likewise.
9441 (Script_sections::Script_sections): Update for field changes.
9442 (Script_sections::data_segment_align): Set saw_data_segment_align_
9443 and data_segment_align_start_, not data_segment_align_index.
9444 (Script_sections::data_segment_relro_end): Check
9445 saw_data_segment_align_. Use data_segment_align_start_ rather
9446 than data_segment_align_index_.
9447 (Script_sections::place_orphan): Rewrite to use
9448 Orphan_section_placement.
9450 2009-03-17 Ian Lance Taylor <iant@google.com>
9452 * archive.cc (Archive::add_symbols): Check for a version attached
9453 to the symbol name in the archive map.
9454 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
9455 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
9456 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
9457 (ver_test_11.a): New target.
9458 * testsuite/Makefile.in: Rebuild.
9460 * configure.ac: Check for chsize and posix_fallocate. Replace
9462 * ftruncate.c: New file, from gnulib.
9463 * output.cc (posix_fallocate): Define dummy version if not
9464 HAVE_POSIX_FALLOCATE.
9465 (Output_file::map): Call posix_fallocate rather than lseek and
9467 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
9468 * configure, Makefile.in, config.in: Rebuild.
9470 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
9472 * layout.h (Layout::create_note): Add section_name parameter.
9473 * layout.cc (Layout::create_note): Likewise.
9474 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
9476 2009-03-17 Ian Lance Taylor <iant@google.com>
9478 * descriptors.cc: Include "options.h".
9479 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
9480 (Descriptors::open): Always use O_CLOEXEC when opening a new
9481 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
9482 then set FD_CLOEXEC.
9484 * sparc.cc (class Target_sparc): Add has_got_section.
9485 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
9486 make sure we have a GOT section.
9488 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
9489 (Target_sparc::Scan::local): Likewise.
9490 (Target_sparc::Scan::global): Likewise.
9491 (Target_sparc::Relocate::relocate): Likewise.
9492 (Target_sparc::Relocate::relocate_tls): Likewise.
9494 * symtab.cc (Symbol_table::define_default_version): New function,
9495 broken out of add_from_object.
9496 (Symbol_table::add_from_object): Call define_default_version.
9497 (Symbol_table::define_special_symbol): Add resolve_oldsym
9498 parameter. Change all callers. If the version for a symbol comes
9499 from a version script, resolve it with the symbol with the same
9500 name with no version. Also add the symbol without a version if
9502 (do_define_in_output_data): If resolving with oldsym, don't delete
9504 (do_define_in_output_segment): Likewise.
9505 (do_define_as_constant): Likewise.
9506 * symtab.h (class Symbol_table): Update declarations.
9508 2009-03-13 Ian Lance Taylor <iant@google.com>
9510 * readsyms.cc (Read_symbols::incompatible_warning): New function.
9511 (Read_symbols::requeue): New function.
9512 (Read_symbols::do_read_symbols): If make_elf_object fails because
9513 the target type is not configured, and the file was searched for,
9514 issue a warning and retry with the next directory.
9515 (Add_symbols::run): If the file has an incompatible format, and
9516 it was searched for, requeue the Read_symbols task. On error,
9518 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
9519 dirindex parameter to constructor. Change all callers. Declare
9520 incompatible_warning and requeue.
9521 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
9522 input_argument_ and input_group_ fields. Add them to
9523 constructor. Change all callers.
9524 (class Read_script): Add dirindex_ field. Add it to constructor.
9526 * archive.cc (Archive::setup): Remove input_objects parameter.
9528 (Archive::get_file_and_offset): Likewise.
9529 (Archive::read_all_symbols): Likewise.
9530 (Archive::read_symbols): Likewise.
9531 (Archive::get_elf_object_for_member): Remove input_objects
9532 parameter. Add punconfigured parameter. Change all callers.
9533 (Archive::add_symbols): Change return type to bool. Check return
9534 value of include_member.
9535 (Archive::include_all_members): Likewise.
9536 (Archive::include_member): Change return type to bool. Return
9537 false if first included object has incompatible target. Set
9538 included_member_ field.
9539 (Add_archive_symbols::run): If add_symbols returns false, requeue
9541 * archive.h (class Archive): Add included_member_ field.
9542 Initialize it in constructor. Add input_file and searched_for
9543 methods. Update declarations.
9544 (class Add_archive_symbols): Add dirpath_, dirindex_, and
9545 input_argument_ fields. Add them to constructor. Change all
9547 * script.cc: Include "target-select.h".
9548 (class Parser_closure): Add skip_on_incompatible_target_ and
9549 found_incompatible_target_ fields. Add
9550 skip_on_incompatible_target parameter to constructor. Change all
9551 callers. Add methods skip_on_incompatible_target,
9552 clear_skip_on_incompatible_target, found_incompatible_target, and
9553 set_found_incompatible_target.
9554 (read_input_script): Add dirindex parameter. Change all callers.
9555 If parser finds an incompatible target, requeue Read_symbols
9557 (script_set_symbol): Clear skip_on_incompatible_target in
9559 (script_add_assertion, script_parse_option): Likewise.
9560 (script_start_sections, script_add_phdr): Likewise.
9561 (script_check_output_format): New function.
9562 * script.h (read_input_script): Update declaration.
9563 * script-c.h (script_check_output_format): Declare.
9564 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
9565 (ignore_cmd): Remove OUTPUT_FORMAT.
9566 * fileread.cc (Input_file::Input_file): Add explicit this.
9567 (Input_file::will_search_for): New function.
9568 (Input_file::open): Add pindex parameter. Change all callers.
9569 * fileread.h (class Input_file): Add input_file_argument method.
9570 Declare will_search_for. Update declarations.
9571 * object.cc (make_elf_object): Add punconfigured parameter.
9573 * object.h (class Object): Make input_file public. Add
9574 searched_for method.
9575 (make_elf_object): Update declaration.
9576 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
9578 * dirsearch.h (class Dirsearch): Update declaration.
9579 * options.h (class General_options): Add --warn-search-mismatch.
9580 * parameters.cc (Parameters::is_compatible_target): New function.
9581 * parameters.h (class Parameters): Declare is_compatible_target.
9582 * workqueue.cc (Workqueue::add_blocker): New function.
9583 * workqueue.h (class Workqueue): Declare add_blocker.
9585 * fileread.cc (Input_file::open): Remove options parameter.
9587 (Input_file::open_binary): Likewise.
9588 * script.cc (read_input_script): Likewise.
9589 * readsyms.h (class Read_symbols): Remove options_ field. Remove
9590 options parameter from constructor. Change all callers.
9591 (class Read_script): Likewise.
9592 * fileread.h (class Input_file): Update declarations.
9593 * script.h (read_input_script): Update declaration.
9595 2009-03-10 Nick Clifton <nickc@redhat.com>
9597 * po/es.po: New Spanish translation.
9599 2009-03-06 Cary Coutant <ccoutant@google.com>
9601 * options.cc (parse_short_option): Keep dash_z from registering itself.
9603 2009-03-03 Ian Lance Taylor <iant@google.com>
9606 * target-reloc.h (relocate_section): Pass output_section to
9608 * i386.cc (Target_i386::should_apply_static_reloc): Add
9609 output_section parameter. Change all callers.
9610 (Target_i386::Relocate::relocate): Add output_section parameter.
9611 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9612 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
9613 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
9614 * testsuite/two_file_shared.sh: New script.
9615 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
9616 (check_DATA): Add two_file_shared.dbg.
9617 (two_file_shared.dbg): New target.
9618 * testsuite/Makefile.in: Rebuild.
9620 2009-03-01 Ian Lance Taylor <iant@google.com>
9622 * configure.ac: Check for byteswap.h.
9623 * configure: Rebuild.
9624 * config.in: Rebuild.
9626 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
9628 * layout.cc (Layout::find_or_add_kept_section): New function.
9629 (Layout::add_comdat): Removed.
9630 * layout.h (struct Kept_section): Move out of class Layout.
9631 Remove trailing underscores from field names. Add group_sections
9632 field. Rename group_ field to is_group. Change all uses.
9633 (class Layout): Declare find_or_add_kept_section, not add_comdat.
9634 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
9635 comdat_groups_ field.
9636 (Sized_relobj::include_section_group): Use
9637 find_or_add_kept_section and Kept_section::group_sections.
9638 (Sized_relobj::include_linkonce_section): Likewise.
9639 * object.cc (class Sized_relobj): Don't define Comdat_group or
9640 Comdat_group_table. Remove find_comdat_group and
9641 add_comdat_group. Remove comdat_groups_ field.
9642 * plugin.cc (include_comdat_group): Use
9643 Layout::find_or_add_kept_section.
9645 2009-02-28 Ian Lance Taylor <iant@google.com>
9647 * README: --gc-sections and map files are now supported. Document
9648 some build requirements.
9651 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
9652 relocatable link set the value of the section symbol to zero.
9653 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
9654 relocatable link don't include the section address in the local
9657 2009-02-27 Ian Lance Taylor <iant@google.com>
9660 * options.h (class Search_directory): Add is_system_directory.
9661 (class General_options): Declare is_in_system_directory.
9662 * options.cc (get_relative_sysroot): Make static.
9663 (get_default_sysroot): Make static.
9664 (General_optoins::is_in_system_directory): New function.
9665 * fileread.cc (Input_file::is_in_system_directory): New function.
9666 * fileread.h (class Input_file): Declare is_in_system_directory.
9667 * object.h (class Object): Add is_in_system_directory.
9668 (class Input_objects): Remove system_library_directory_ field.
9669 * object.cc (Input_objects::add_object): Don't set
9670 system_library_directory_.
9671 (input_objects::found_in_system_library_directory): Remove.
9672 * symtab.cc (Symbol_table::write_globals): Remove input_objects
9673 parameter. Change all callers.
9674 (Symbol_table::sized_write_globals): Likewise.
9675 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
9676 Call Object::is_in_system_directory.
9677 * symtab.h (class Symbol_table): Update declarations.
9680 * descriptors.h (Open_descriptor): Add is_on_stack field.
9681 * descriptors.cc (Descriptors::open): If the descriptor is on the
9682 top of the stack, remove it. Initialize is_on_stack field.
9683 (Descriptors::release): Only add pod to stack if it is not on the
9685 (Descriptors::close_some_descriptor): Clear stack_next and
9689 * output.cc (Output_section::find_starting_output_address): Rename
9690 from starting_output_address; add PADDR parameter; change return
9692 * output.h (class Output_section): Declare
9693 find_starting_output_address instead of starting_output_address.
9694 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
9695 section symbol for which we can't find a merge section.
9698 * symtab.cc (Symbol_table::add_from_object): If the visibility is
9699 hidden or internal, force the symbol to be local.
9700 * resolve.cc (Symbol::override_visibility): Define.
9701 (Symbol::override_base): Use override_visibility.
9702 (Symbol_table::resolve): Likewise.
9703 (Symbol::override_base_with_special): Likewise.
9704 (Symbol_table::override_with_special): If the visibility is hidden
9705 or internal, force the symbol to be local.
9706 * symtab.h (class Symbol): Add set_visibility and
9707 override_visibility.
9708 * testsuite/ver_test_1.sh: New file.
9709 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
9710 (check_DATA): Add ver_test_1.syms.
9711 (ver_test_1.syms): New target.
9712 * testsuite/Makefile.in: Rebuild.
9714 2009-02-25 Cary Coutant <ccoutant@google.com>
9716 * layout.cc (Layout::choose_output_section): Don't rename sections
9717 when using a linker script that has a SECTIONS clause.
9718 * Makefile.in: Regenerate.
9720 * testsuite/Makefile.am (script_test_5.sh): New test case.
9721 * testsuite/Makefile.in: Regenerate.
9722 * testsuite/script_test_5.cc: New file.
9723 * testsuite/script_test_5.sh: New file.
9724 * testsuite/script_test_5.t: New file.
9726 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
9728 * archive.cc (Archive::include_member): Update calls to add_symbols.
9729 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
9730 the Layout argument.
9731 * dynobj.h (do_add_symbols): Add the Layout argument.
9732 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
9734 * object.h (Object::add_symbols): Add the Layout argument.
9735 (Object::do_add_symbols): Add the Layout argument.
9736 (Sized_relobj::do_add_symbols): Add the Layout argument.
9737 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
9738 Unify the two versions.
9739 (Add_plugin_symbols): Remove.
9740 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
9741 (Sized_pluginobj::do_add_symbols): Unify the two versions.
9742 (Add_plugin_symbols): Remove.
9743 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
9744 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
9745 (Add_symbols::run): Make it work with Pulginobj.
9747 2009-02-06 Ian Lance Taylor <iant@google.com>
9749 * object.cc (Sized_relobj::do_layout): Make info message start
9750 with lower case letter.
9752 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
9754 * binary.cc: Fix file comment.
9756 * options.h (enum Incremental_disposition): Define.
9757 (class General_options): Add new options: --incremental,
9758 --incremental_changed, --incremental_unchanged,
9759 --incremental_unknown. Add incremental_disposition_ and
9760 implicit_incremental_ fields.
9761 (General_options::incremental_disposition): New function.
9762 (class Position_dependent_options): Add incremental_disposition
9764 (Position_dependent_options::copy_from_options): Set incremental
9766 * options.cc (General_options::parse_incremental_changed): New
9768 (General_options::parse_incremental_unchanged): New function.
9769 (General_options::parse_incremental_unknown): New function.
9770 (General_options::General_options): Initialize new fields
9771 incremental_disposition_ and implicit_incremental_.
9772 (General_options::finalize): Check for uasge of --incremental-*
9773 without --incremental.
9775 2009-02-06 Chris Demetriou <cgd@google.com>
9777 * gold.h (gold_undefined_symbol): Change to take only a Symbol
9778 pointer and to report location as the file name associated with
9780 (gold_undefined_symbol_at_location): New function to replace the
9781 old gold_undefined_symbol functionality.
9782 * target-reloc.h (relocate_section): Update to use
9783 gold_undefined_symbol_at_location.
9784 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9785 Call gold_undefined_symbol function rather than gold_error.
9786 * errors.h (Errors::undefined_symbol): Take location as a
9787 string, rather than calculating it from a relocation.
9788 * errors.cc (Errors::fatal): Print "fatal error:" before the
9790 (Errors::error, Errors::error_at_location): Print "error: "
9791 before the formatted message.
9792 (Errors::undefined_symbol): Take location as a string, rather
9793 than calculating it from a relocation.
9794 (gold_undefined_symbol_at_location): New function akin to
9795 old gold_undefined_symbol, calculates location from relocation.
9796 (gold_undefined_symbol): Change to take only a Symbol pointer
9797 and to report location as the file name associated with the symbol.
9798 * testsuite/debug_msg.sh: Update for changed error messages.
9799 * testsuite/undef_symbol.sh: Likewise.
9801 2009-02-04 Duncan Sands <baldrick@free.fr>
9804 * reduced_debug_output.h
9805 (Output_reduced_debug_abbrev_section::failed): Use format for
9807 (Output_reduced_debug_info_section::faild): Likewise.
9809 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
9811 * script.cc (Lazy_demangler): New class.
9812 (Version_script_info::get_symbol_version_helper): Demangle a
9815 2009-01-29 Cary Coutant <ccoutant@google.com>
9817 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
9819 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9821 2009-01-28 Ian Lance Taylor <iant@google.com>
9823 * version.cc (version_string): Bump to 1.9.
9825 * gold.h: Include <cstring> and <stdint.h>.
9826 * version.cc: Include <cstdio>.
9827 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
9829 * reduced_debug_output.cc (insert_into_vector): Rename from
9830 Insert_into_vector; change all callers. Use Swap_unaligned to
9831 avoid aliasing issue; remove union since it is unnecessary.
9833 2009-01-27 Sriraman Tallam <tmsriram@google.com>
9835 * Makefile.am (CCFILES): Add gc.cc.
9837 * Makefile.in: Regenerate.
9838 * gold.cc (Gc_runner): New class.
9839 (queue_initial_tasks): Call garbage collection related tasks
9840 when corresponding options are invoked.
9841 (queue_middle_gc_tasks): New function.
9842 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
9843 processed early before laying out sections during garbage collection.
9844 * gold.h (queue_middle_gc_tasks): New function.
9845 (is_prefix_of): Move from "layout.cc".
9846 * i386.cc (Target_i386::gc_process_relocs): New function.
9847 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
9848 * main.cc (main): Create object of class "Garbage_collection".
9849 * object.cc (Relobj::copy_symbols_data): New function.
9850 (Relobj::is_section_name_included): New function.
9851 (Sized_relobj::do_layout): Allow this function to be called twice
9852 during garbage collection and defer layout of section during the
9854 * object.h (Relobj::get_symbols_data): New function.
9855 (Relobj::is_section_name_included): New function.
9856 (Relobj::copy_symbols_data): New function.
9857 (Relobj::set_symbols_data): New function.
9858 (Relobj::get_relocs_data): New function.
9859 (Relobj::set_relocs_data): New function.
9860 (Relobj::is_output_section_offset_invalid): New pure virtual function.
9861 (Relobj::gc_process_relocs): New function.
9862 (Relobj::do_gc_process_relocs): New pure virtual function.
9863 (Relobj::sd_): New data member.
9864 (Sized_relobj::is_output_section_offset_invalid): New function.
9865 (Sized_relobj::do_gc_process_relocs): New function.
9866 * options.h (General_options::gc_sections): Modify to not be a no-op.
9867 (General_options::print_gc_sections): New option.
9868 * plugin.cc (Plugin_finish::run): Remove function call to
9869 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
9870 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
9871 * reloc.cc (Read_relocs::run): Add task to process relocs and
9872 determine unreferenced sections when doing garbage collection.
9873 (Gc_process_relocs): New class.
9874 (Sized_relobj::do_gc_process_relocs): New function.
9875 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
9876 sections that are garbage collected.
9877 * reloc.h (Gc_process_relocs): New class.
9878 * sparc.cc (Target_sparc::gc_process_relocs): New function.
9879 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
9880 symbols whose corresponding sections are garbage collected.
9881 (Symbol_table::Symbol_table): Add new parameter for the garbage
9883 (Symbol_table::gc_mark_undef_symbols): New function.
9884 (Symbol_table::gc_mark_symbol_for_shlib): New function.
9885 (Symbol_table::gc_mark_dyn_syms): New function.
9886 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
9888 (Symbol_table::add_from_object): Likewise.
9889 (Symbol_table::add_from_relobj): When building shared objects, do not
9890 treat externally visible symbols as garbage.
9891 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
9892 table information for static and relocatable links.
9893 * symtab.h (Symbol_table::set_gc): New function.
9894 (Symbol_table::gc): New function.
9895 (Symbol_table::gc_mark_undef_symbols): New function.
9896 (Symbol_table::gc_mark_symbol_for_shlib): New function.
9897 (Symbol_table::gc_mark_dyn_syms): New function.
9898 (Symbol_table::gc_): New data member.
9899 * target.h (Sized_target::gc_process_relocs): New pure virtual
9901 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
9902 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
9904 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
9906 * options.h (General_options::gc_sections): Define as a no-op for now.
9907 (General_options::no_keep_memory): Ditto.
9908 (General_options::Bshareable): Define.
9909 * options.cc (General_options::finalize): Honor -Bshareable.
9911 2009-01-20 Andreas Schwab <schwab@suse.de>
9913 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
9914 read the value in the contents, since we don't use it. Use the
9915 template endianness when writing.
9916 (Relocate::relocate): Use it for R_PPC_REL16_HA.
9918 2009-01-19 Andreas Schwab <schwab@suse.de>
9920 * configure.tgt (powerpc64-*): Fix targ_obj.
9922 2009-01-15 Ian Lance Taylor <iant@google.com>
9924 * object.cc (Sized_relobj::write_local_symbols): Don't write out
9925 local symbols when stripping all symbols.
9927 2009-01-14 Cary Coutant <ccoutant@google.com>
9929 * output.cc (Output_reloc): Add explicit instantiations.
9931 2009-01-14 Cary Coutant <ccoutant@google.com>
9933 * archive.cc (Archive::get_elf_object_for_member): Remove call
9934 to File_read::claim_for_plugin.
9935 * descriptors.cc (Descriptors::open): Remove reference to
9937 (Descriptors::claim_for_plugin): Remove.
9938 * descriptors.h (Descriptors::claim_for_plugin): Remove.
9939 (Descriptors::is_claimed): Remove.
9940 (claim_descriptor_for_plugin): Remove.
9941 * fileread.cc (File_read::claim_for_plugin): Remove.
9942 * fileread.h (File_read::claim_for_plugin): Remove.
9943 (File_read::descriptor): Reopen descriptor if necessary.
9944 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
9945 (Plugin_manager::all_symbols_read): Add task parameter. Change
9947 (Plugin_manager::get_input_file): New function.
9948 (Plugin_manager::release_input_file): New function.
9949 (Pluginobj::Pluginobj): Add filesize parameter and initialize
9950 corresponding data member.
9951 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
9952 and pass to base constructor. Change all callers.
9953 (get_input_file, release_input_file): New functions.
9954 (make_sized_plugin_object): Add filesize parameter. Change all callers.
9955 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
9956 (Plugin_manager::all_symbols_read): Add task parameter.
9957 (Plugin_manager::get_input_file): New function.
9958 (Plugin_manager::release_input_file): New function.
9959 (Plugin_manager::task_): New data member.
9960 (Pluginobj::Pluginobj): Add filesize parameter.
9961 (Pluginobj::filename): New function.
9962 (Pluginobj::descriptor): New function.
9963 (Pluginobj::filesize): New function.
9964 (Pluginobj::filesize_): New data member.
9965 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
9966 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
9967 File_read::claim_for_plugin; use Object::unlock to unlock the file.
9969 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
9970 with archive libraries.
9971 * testsuite/Makefile.in: Regenerate.
9972 * testsuite/plugin_test.c (struct sym_info): New type.
9973 (get_input_file, release_input_file): New static variables.
9974 (onload): Capture new transfer vector entries.
9975 (claim_file_hook): Stop reading at end of file according to filesize.
9976 Factor out parsing of readelf output into separate function.
9977 (all_symbols_read_hook): Exercise get_input_file and release_input_file
9978 APIs and get the source file name from the symbol table. Convert
9979 source file name to corresponding object file name. Print info
9980 message when adding new input files.
9981 (parse_readelf_line): New function.
9982 * testsuite/plugin_test_1.sh: Add checks for new info messages.
9983 * testsuite/plugin_test_2.sh: Likewise.
9984 * testsuite/plugin_test_3.sh: Likewise.
9985 * testsuite/plugin_test_4.sh: New test case.
9987 2009-01-07 Ian Lance Taylor <iant@google.com>
9989 * version.cc (version_string): Bump to 1.8.
9991 2008-12-23 Cary Coutant <ccoutant@google.com>
9993 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
9994 * plugin.cc (Plugin_manager::finish): Rename as
9995 layout_deferred_objects. Move cleanup to separate function.
9996 (Plugin_manager::cleanup): New function.
9997 (Plugin_finish::run): Call layout_deferred_objects and cleanup
9999 * plugin.h (Plugin_manager::finish): Rename as
10000 layout_deferred_objects.
10001 (Plugin_manager::cleanup): New function.
10002 (Plugin_manager::cleanup_done): New field.
10004 2008-12-23 Cary Coutant <ccoutant@google.com>
10006 * plugin.cc (is_visible_from_outside): New function.
10007 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
10008 so we don't return "IR only" status for exported symbols or -r links.
10010 * testsuite/Makefile.am (plugin_test_3): New test case.
10011 * testsuite/Makefile.in: Regenerate.
10012 * testsuite/plugin_test_3.sh: New file.
10014 2008-12-22 Cary Coutant <ccoutant@google.com>
10016 * object.cc (Sized_relobj::layout_section): New function.
10017 (Sized_relobj::do_layout): Defer layout of input sections until after
10018 plugin has provided replacement files.
10019 (Sized_relobj::do_layout_deferred_sections): New function.
10020 * object.h (Relobj::set_section_offset): Remove virtual keyword.
10021 (Relobj::layout_deferred_sections): New function.
10022 (Relobj::do_layout_deferred_sections): New function.
10023 (Sized_relobj::do_layout_deferred_sections): New function.
10024 (Sized_relobj::layout_section): New function.
10025 (Sized_relobj::Deferred_layout): New structure.
10026 (Sized_relobj::deferred_layout_): New field.
10027 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10028 Change all callers. Layout deferred sections.
10029 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
10031 (Plugin_hook::run): Move code from do_plugin_hook inline.
10032 (Plugin_hook::do_plugin_hook): Remove.
10033 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10034 (Plugin_manager::finish): Renamed, was cleanup.
10035 (Plugin_manager::should_defer_layout): New function.
10036 (Plugin_manager::add_deferred_layout_object): New function.
10037 (Plugin_manager::Deferred_layout_list): New type.
10038 (Plugin_manager::deferred_layout_objects_): New field.
10039 (Plugin_hook::do_plugin_hook): Remove.
10041 2008-12-17 Ian Lance Taylor <iant@google.com>
10043 * options.h (class General_options): Add --no case for
10046 2008-12-16 Cary Coutant <ccoutant@google.com>
10048 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
10050 (Plugin_manager::claim_file): Create plugin object even if
10051 plugin did not call the add_symbols callback.
10052 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10053 asking for more symbols than were added.
10054 * testsuite/Makefile.am (plugin_test_1): Add test case with
10056 (empty.syms): New target.
10057 * testsuite/Makefile.in: Regenerate.
10058 * testsuite/plugin_test.c (claim_file_hook): Add new debug
10059 message. Don't call add_symbols if no globals.
10060 (all_symbols_read_hook): Don't provide replacement for empty
10063 2008-12-12 Ian Lance Taylor <iant@google.com>
10065 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10066 r_type == 0 for a local symbol with r_sym == 0.
10067 (scan_relocatable_relocs): Pass r_sym to
10068 local_non_section_strategy.
10069 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10072 * configure.ac: Update test for TLS descriptors: they are
10073 supported as of glibc 2.9.
10074 * configure: Rebuild.
10076 2008-12-11 Ian Lance Taylor <iant@google.com>
10079 * target-reloc.h (Default_scan_relocatable_relocs): For each
10080 function, map r_type == 0 to RELOC_DISCARD.
10082 2008-12-10 Cary Coutant <ccoutant@google.com>
10084 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
10085 object to override a kept COMDAT group from a plugin object.
10087 2008-12-09 Ian Lance Taylor <iant@google.com>
10090 * yyscript.y (file_cmd): Handle INPUT.
10092 * testsuite/initpri1.c: Change all declarations to be full
10093 prototypes by adding void, to avoid compiler warnings.
10095 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
10097 * options.cc (General_options::parse_plugin_opt): New.
10098 (General_options::add_plugin): The argument now is just the filename.
10099 (General_options::add_plugin_option): New.
10100 * options.h (plugin_opt): New.
10101 (add_plugin): Change argument name.
10102 (add_plugin_option): New.
10103 * plugin.cc (Plugin::load): Don't parse the plugin option.
10104 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
10105 (Plugin::add_option): New.
10106 (Plugin::args_): Change type.
10107 (Plugin::filename_): New.
10108 (Plugin_manager::add_plugin_option): New.
10109 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
10110 * testsuite/Makefile.in: Regenerate.
10112 2008-12-05 Cary Coutant <ccoutant@google.com>
10114 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
10115 Handle --strip-lto-sections option.
10116 * options.h (strip_lto_sections): New option.
10118 2008-12-01 Cary Coutant <ccoutant@google.com>
10120 * plugin.cc (ld_plugin_message): Change format parameter to const.
10121 Fix mismatch between new[] and delete.
10123 2008-11-14 Cary Coutant <ccoutant@google.com>
10125 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
10128 2008-11-05 Craig Silverstein <csilvers@google.com>
10130 * options.cc (General_options::parse_dynamic_list): New function.
10131 * options.h (General_options): New flags dynamic_list,
10132 dynamic_list_data, dynamic_list_cpp_new, and
10133 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
10134 (General_options::in_dynamic_list): New function.
10135 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
10136 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
10137 (Lex::can_continue_name): Likewise.
10139 (read_script_file): New parameter script_options.
10140 (read_dynamic_list): New function.
10141 (Script_options::define_dynamic_list): New function.
10142 (dynamic_list_keyword_parsecodes): New variable.
10143 (dynamic_list_keywords): New variable.
10144 * script.h (Script_options::define_dynamic_list): New function
10146 (read_dynamic_list): New function prototype.
10147 * symtab.cc (strprefix): New macro.
10148 (Symbol::should_add_dynsym_entry): Support dynamic_list,
10149 dynamic_list_data, dynamic_list_cpp_new, and
10150 dynamic_list_cpp_typeinfo.
10151 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
10152 (dynamic_list_expr): New rule.
10153 (dynamic_list_nodes): Likewise.
10154 (dynamic_list_node): Likewise.
10155 * testsuite/Makefile.am (dynamic_list): New test.
10156 * testsuite/Makefile.in: Regenerated.
10157 * testsuite/dynamic_list.t: New file.
10158 * testsuite/dynamic_list.sh: New file.
10160 2008-11-05 Craig Silverstein <csilvers@google.com>
10162 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
10163 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
10164 (t11_last): Likewise.
10165 * testsuite/ver_test_6.c (main): Likewise.
10167 2008-10-07 Cary Coutant <ccoutant@google.com>
10169 * options.c (General_options::finalize): Add check for -static and
10171 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
10174 2008-10-02 Cary Coutant <ccoutant@google.com>
10176 * plugin.cc (make_sized_plugin_object): Fix conditional
10177 compilation to work when not all targets are enabled.
10179 2008-09-29 Cary Coutant <ccoutant@google.com>
10181 * archive.cc (Archive::get_file_and_offset): Use filename instead
10182 of name to get library path.
10183 (Archive::include_member): Unlock external member of a thin archive.
10185 * testsuite/Makefile.am (TEST_AR): New variable.
10186 (thin_archive_test_1): New test.
10187 (thin_archive_test_2): New test.
10188 * testsuite/Makefile.in: Regenerate.
10189 * testsuite/thin_archive_main.cc: New file.
10190 * testsuite/thin_archive_test_1.cc: New file.
10191 * testsuite/thin_archive_test_2.cc: New file.
10192 * testsuite/thin_archive_test_3.cc: New file.
10193 * testsuite/thin_archive_test_4.cc: New file.
10195 2008-09-29 Cary Coutant <ccoutant@google.com>
10197 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
10198 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
10200 (Sized_relobj::do_finalize_local_symbols): Likewise.
10201 (Sized_relobj::map_to_kept_section): Likewise.
10202 * object.h (Sized_relobj::invalid_address): New constant.
10203 (Sized_relobj::do_output_section_offset): Check for invalid_address
10205 * output.cc (Output_reloc::local_section_offset): Use constant
10206 invalid_address instead of -1U.
10207 (Output_reloc::get_address): Likewise.
10208 (Output_section::output_address): Change -1U to -1ULL.
10209 * output.h (Output_reloc::invalid_address): New constant.
10210 * reloc.cc (Sized_relobj::write_sections): Use constant
10211 invalid_address instead of -1U.
10212 (Sized_relobj::relocate_sections): Likewise.
10213 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
10214 values for merge sections.
10215 * target-reloc.h (relocate_for_relocatable): Use constant
10216 invalid_address instead of -1U.
10218 2008-09-19 Cary Coutant <ccoutant@google.com>
10220 Add plugin functionality for link-time optimization (LTO).
10221 * configure.ac (plugins): Add --enable-plugins option.
10222 * configure: Regenerate.
10223 * config.in: Regenerate.
10224 * Makefile.am (LIBDL): New variable.
10225 (CCFILES): Add plugin.cc.
10226 (HFILES): Add plugin.h.
10227 (ldadd_var): Add LIBDL.
10228 * Makefile.in: Regenerate.
10230 * archive.cc: Include "plugin.h".
10231 (Archive::setup): Don't preread archive symbols when using a plugin.
10232 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
10233 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
10235 (Archive::include_member): Add symbols from plugin objects.
10236 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
10237 * descriptors.cc (Descriptors::open): Check for file descriptors
10238 abandoned by plugins.
10239 (Descriptors::claim_for_plugin): New function.
10240 * descriptors.h (Descriptors::claim_for_plugin): New function.
10241 (Open_descriptor::is_claimed): New field.
10242 (claim_descriptor_for_plugin): New function.
10243 * fileread.cc (File_read::claim_for_plugin): New function.
10244 * fileread.h (File_read::claim_for_plugin): New function.
10245 (File_read::descriptor): New function.
10246 * gold.cc: Include "plugin.h".
10247 (queue_initial_tasks): Add task to call plugin hooks for generating
10249 * main.cc: Include "plugin.h".
10250 (main): Load plugin libraries.
10251 * object.h (Pluginobj): Declare.
10252 (Object::pluginobj): New function.
10253 (Object::do_pluginobj): New function.
10254 (Object::set_target): New function.
10255 * options.cc: Include "plugin.h".
10256 (General_options::parse_plugin): New function.
10257 (General_options::General_options): Initialize plugins_ field.
10258 (General_options::add_plugin): New function.
10259 * options.h (Plugin_manager): Declare.
10260 (General_options): Add --plugin option.
10261 (General_options::has_plugins): New function.
10262 (General_options::plugins): New function.
10263 (General_options::add_plugin): New function.
10264 (General_options::plugins_): New field.
10265 * plugin.cc: New file.
10266 * plugin.h: New file.
10267 * readsyms.cc: Include "plugin.h".
10268 (Read_symbols::do_read_symbols): Check for archive before checking
10269 for ELF file. Call plugin hooks to claim files.
10270 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
10271 from a real object file; force override when processing replacement
10273 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
10274 (Symbol::init_base_object): Likewise.
10275 (Symbol::init_base_output_data): Likewise.
10276 (Symbol::init_base_output_segment): Likewise.
10277 (Symbol::init_base_constant): Likewise.
10278 (Symbol::init_base_undefined): Likewise.
10279 (Symbol::output_section): Assert that object is not a plugin.
10280 (Symbol_table::add_from_pluginobj): New function.
10281 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
10283 (Symbol_table::sized_write_globals): Likewise.
10284 (Symbol_table::add_from_pluginobj): Instantiate template.
10285 * symtab.h (Sized_pluginobj): Declare.
10286 (Symbol::in_real_elf): New function.
10287 (Symbol::set_in_real_elf): New function.
10288 (Symbol::in_real_elf_): New field.
10289 (Symbol_table::add_from_pluginobj): New function.
10291 * testsuite/Makefile.am (AM_CFLAGS): New variable.
10292 (LIBDL): New variable.
10293 (LDADD): Add LIBDL.
10294 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
10295 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
10296 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
10297 (MOSTLYCLEANFILES): Likewise.
10298 * testsuite/Makefile.in: Regenerate.
10299 * testsuite/plugin_test.c: New file.
10300 * testsuite/plugin_test_1.sh: New file.
10301 * testsuite/plugin_test_2.sh: New file.
10303 2008-09-16 Ian Lance Taylor <iant@google.com>
10305 * target-reloc.h (relocate_section): Check whether a symbol is
10306 defined by the ABI before reporting an undefined symbol error.
10307 * target.h (Target::is_defined_by_abi): Make parameter const.
10308 (Target::do_is_defined_by_abi): Likewise.
10309 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
10310 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
10311 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
10312 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
10313 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
10314 * testsuite/Makefile.in: Rebuild.
10316 * fileread.cc (make_view): Add casts to avoid warning.
10318 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
10320 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
10321 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10323 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
10325 * options.h (General_options::output_is_executable): New.
10326 (General_options::output_is_pie): New.
10327 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
10328 for shared libraries.
10329 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10331 2008-09-11 Chris Demetriou <cgd@google.com>
10333 * options.h (origin): New -z option.
10334 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
10335 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
10338 2008-09-05 Cary Coutant <ccoutant@google.com>
10340 * fileread.cc (File_read::make_view): Add check for attempt to map
10341 beyond end of file.
10343 2008-09-05 Cary Coutant <ccoutant@google.com>
10345 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
10346 explicit instantiations.
10348 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
10351 * options.cc (General_options::finalize): Allow undefined symbols
10352 in shlibs if linking -shared.
10355 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
10356 symbols as not needing a dynsym entry.
10358 2008-08-20 Craig Silverstein <csilvers@google.com>
10360 * fileread.cc (File_read::open): Do not lock the file unless it
10361 was successfully opened.
10363 2008-08-14 Cary Coutant <ccoutant@google.com>
10365 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
10366 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
10367 * testsuite/tls_test.cc (struct int128): 128-bit struct
10368 for testing TLS relocs with non-zero addend.
10369 (v12): New TLS variable.
10371 (t_last): Add check for v12.
10372 * testsuite/tls_test.h (t12): New function.
10373 * testsuite/tls_test_main.cc (thread_routine): Call new test.
10375 2008-08-13 Ian Lance Taylor <iant@google.com>
10377 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
10378 set tls_segment_ or relro_segment_.
10379 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
10381 * output.h (Output_section::clear_is_relro): New function.
10382 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
10383 sections specially even when output_data_ is empty.
10384 (Output_segment::maximum_alignment): When first section is relro,
10385 only force alignment for PT_LOAD segments.
10386 * script.cc (script_data_segment_align): New function.
10387 (script_data_segment_relro_end): New function.
10388 * script-c.h (script_data_segment_align): Declare.
10389 (script_data_segment_relro_end): Declare.
10390 * script-sections.h (class Script_sections): Declare
10391 data_segment_align and data_segment_relro_end. Add fields
10392 segment_align_index_ and saw_relro_end_.
10393 * script-sections.cc (class Sections_element): Add set_is_relro
10394 virtual function. Add new bool* parameter to place_orphan_here.
10395 Add get_output_section virtual function.
10396 (class Output_section_definition): Add set_is_relro. Add new
10397 bool* parameter to place_orphan_here. Add get_output_section.
10398 Add is_relro_ field.
10399 (Output_section_definition::Output_section_definition): Initialize
10400 evaluated_address_, evaluated_load_address, evaluated_addralign_,
10401 and is_relro_ fields.
10402 (Output_section_definition::place_orphan_here): Add is_relro
10404 (Output_section_definition::set_section_addresses): Set relro for
10406 (Output_section_definition::alternate_constraint): Likewise.
10407 (class Orphan_output_section): Add new bool* parameter to
10408 place_orphan_here. Add get_output_section.
10409 (Orphan_output_section::place_orphan_here): Add is_relro
10411 (Script_sections::Script_sections): Initialize
10412 data_segment_align_index_ and saw_relro_end_.
10413 (Script_sections::data_segment_align): New function.
10414 (Script_sections::data_segment_relro_end): New function.
10415 (Script_sections::place_orphan): Set or clear is_relro.
10416 (Script_sections::set_section_addresses): Force alignment of first
10418 * yyscript.y (exp): Call script_data_segment_align and
10419 script_data_segment_relro_end.
10420 * testsuite/relro_script_test.t: New file.
10421 * testsuite/relro_test.cc (using_script): Declare.
10422 (t1, t2): Test using_script.
10423 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
10424 (relro_script_test_SOURCES): Define.
10425 (relro_script_test_DEPENDENCIES): Define.
10426 (relro_script_test_LDFLAGS): Define.
10427 (relro_script_test_LDADD): Define.
10428 (relro_script_test.so): New target.
10429 * testsuite/Makefile.in: Rebuild.
10431 2008-08-06 Cary Coutant <ccoutant@google.com>
10433 * archive.cc (Archive::total_archives, Archive::total_members)
10434 (Archive::total_members_loaded): New variables.
10435 (Archive::setup): Add parameter. Add option to preread
10437 (Archive::read_armap): Add counter.
10438 (Archive::get_file_and_offset): New function.
10439 (Archive::get_elf_object_for_member): New function.
10440 (Archive::read_all_symbols): New function.
10441 (Archive::read_symbols): New function.
10442 (Archive::add_symbols): Add counters.
10443 (Archive::include_all_members): Use armap to find members if it's
10445 (Archive::include_member): Skip reading symbols if already read.
10446 Factored code into Archive::get_file_and_offset and
10447 Archive::get_elf_object_for_member. Changed call to
10448 Mapfile::report_include_archive_member.
10449 (Archive::print_stats): New function.
10450 * archive.h: Declare Object and Read_symbols_data classes.
10451 (Archive::Archive): Add initializers for new members.
10452 (Archive::setup): Add parameter.
10453 (Archive::print_stats): New function.
10454 (Archive::total_archives, Archive::total_members)
10455 (Archive::total_members_loaded): New variables.
10456 (Archive::get_file_and_offset): New function.
10457 (Archive::get_elf_object_for_member): New function.
10458 (Archive::read_all_symbols): New function.
10459 (Archive::read_symbols): New function.
10460 (Archive::Archive_member): New class.
10461 (Archive::members_): New member.
10462 (Archive::num_members_): New member.
10463 * main.cc: Include archive.h.
10464 (main): Call Archive::print_stats.
10465 * mapfile.cc (Mapfile::report_include_archive_member): Delete
10466 archive parameter; member_name is now the fully-decorated name.
10467 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
10468 * options.h: (General_options): Add --preread-archive-symbols option.
10469 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
10472 2008-08-04 Ian Lance Taylor <iant@google.com>
10474 * symtab.h (Symbol::use_plt_offset): New function.
10475 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
10476 * powerpc.cc (Relocate::relocate): Likewise.
10477 * sparc.cc (Relocate::relocate): Likewise.
10478 * x86_64.cc (Relocate::relocate): Likewise.
10479 * testsuite/weak_plt.sh: New test.
10480 * testsuite/weak_plt_main.cc: New test.
10481 * testsuite/weak_plt_shared.cc: New test.
10482 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
10483 (check_PROGRAMS): Add weak_plt.
10484 (check_DATA): Add weak_plt_shared.so.
10485 (weak_plt_main_pic.o, weak_plt): New targets.
10486 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
10487 * testsuite/Makefile.in: Rebuild.
10489 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
10491 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
10492 * testsuite/Makefile.in: Rebuild.
10494 2008-08-04 Alan Modra <amodra@bigpond.net.au>
10496 * Makefile.am (POTFILES.in): Set LC_ALL=C.
10497 * Makefile.in: Regenerate.
10498 * po/POTFILES.in: Regenerate.
10500 2008-07-29 Ian Lance Taylor <iant@google.com>
10502 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
10503 symbols before other symbols.
10504 * testsuite/script_test_2.cc (test_addr): Declare.
10505 (test_addr_alias): Declare.
10506 (main): Check that test_addr and test_addr_alias have the right
10508 * testsuite/script_test_2.t: Define test_addr_alias and
10511 2008-07-24 Ian Lance Taylor <iant@google.com>
10514 * descriptors.cc: New file.
10515 * descriptors.h: New file.
10516 * gold-threads.h (class Hold_optional_lock): New class.
10517 * fileread.cc: Include "descriptors.h".
10518 (File_read::~File_read): Release descriptor rather than closing
10520 (File_read::open) [file]: Call open_descriptor rather than open.
10521 Set is_descriptor_opened_.
10522 (File_read::open) [memory]: Assert that descriptor is not open.
10523 (File_read::reopen_descriptor): New function.
10524 (File_read::release): Release descriptor.
10525 (File_read::do_read): Make non-const. Reopen descriptor.
10526 (File_read::read): Make non-const.
10527 (File_read::make_view): Reopen descriptor.
10528 (File_read::do_readv): Likewise.
10529 * fileread.h (class File_read): Add is_descriptor_opened_ field.
10530 Update declarations.
10531 * layout.cc: Include "descriptors.h".
10532 (Layout::create_build_id): Use open_descriptor rather than open.
10533 * output.cc: Include "descriptors.h".
10534 (Output_file::open): Use open_descriptor rather than open.
10535 * archive.cc (Archive::const_iterator): Change Archive to be
10537 (Archive::begin, Archive::end): Make non-const.
10538 (Archive::count_members): Likewise.
10539 * archive.h (class Archive): Update declarations.
10540 * object.h (Object::read): Make non-const.
10541 * Makefile.am (CCFILES): Add descriptors.cc.
10542 (HFILES): Add descriptors.h.
10543 * Makefile.in: Rebuild.
10546 * gold.h: Always include <clocale>. Add Solaris workarounds
10547 following code in binutils/sysdep.h.
10550 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
10551 this->eh_frame_hdr_ is NULL before using it.
10553 * dynobj.cc (Versions::Versions): Update comment.
10555 * dynobj.cc (Versions::Versions): If there is an soname, use it as
10556 the base version name.
10558 * stringpool.cc (Stringpool_template::add_with_length): Set key to
10559 array size plus one.
10560 (Stringpool_template::set_string_offsets): Subtract one from key
10561 before using it as an array index.
10562 (Stringpool_template::get_offset_with_length): Likewise.
10563 (Stringpool_template::write_to_buffer): Likewise.
10564 * stringpool.h (Stringpool_template::get_offset_from_key):
10567 2008-07-23 Ian Lance Taylor <iant@google.com>
10570 * object.h (Merged_symbol_value::value): Do our best to handle a
10574 * script.cc (Version_script_info::get_versions): Don't add empty
10575 version tag to return value.
10576 (Version_script_info::get_symbol_version_helper): Change return
10577 type to bool. Add pversion parameter. Change all callers.
10578 (script_register_vers_node): Don't require a non-NULL tag.
10579 * script.h (class Version_script_info): Update declarations.
10580 (Version_script_info::get_symbol_version): Change return type to
10581 bool. Add version parameter. Change all callers.
10582 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
10583 handling. Handle an empty version from a version script.
10584 (Symbol_table::define_special_symbol): Likewise.
10585 * testsuite/ver_test_10.script: New file.
10586 * testsuite/ver_test_10.sh: New file.
10587 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
10588 (check_DATA): Add ver_test_10.syms.
10589 (ver_test_10.syms, ver_test_10.so): New target.
10590 * testsuite/Makefile.in: Rebuild.
10592 2008-07-23 Simon Baldwin <simonb@google.com>
10594 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
10595 to zero for undefined symbols from dynamic libraries.
10597 2008-07-23 Ian Lance Taylor <iant@google.com>
10599 * symtab.cc (Symbol_table::resolve): Remove version parameter.
10600 Change all callers.
10601 * symtab.h (class Symbol_table): Update declaration.
10602 * testsuite/ver_test_9.cc: New file.
10603 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
10604 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
10605 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
10606 (ver_test_9.so, ver_test_9.o): New targets.
10607 * testsuite/Makefile.in: Rebuild.
10609 2008-07-22 Ian Lance Taylor <iant@google.com>
10611 * options.h (class General_options): Define --check-sections.
10612 * layout.cc (Layout::set_segment_offsets): Handle
10615 * options.h (class General_options): Define -n/--nmagic and
10617 * options.cc (General_options::finalize): For -n/--nmagic or
10618 -N/--omagic, set -static.
10619 * layout.cc (Layout::attach_allocated_section_to_segment): If
10620 -N/--omagic, don't put read-only and read-write sections in
10621 different segments.
10622 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
10623 finding a read-only segment.
10624 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
10625 don't set the minimum segment alignment to the common page size,
10626 and don't set the file offset to the address modulo the page size.
10627 * script-sections.cc (Script_sections::create_segments): If
10628 -n/--omagic, don't put read-only and read-write sections in
10629 different segments.
10631 * cref.cc: New file.
10632 * cref.h: New file.
10633 * options.h (class General_options): Add --print-symbol-counts.
10634 * main.cc (main): Issue defined symbol report if requested.
10635 * archive.cc (Archive::interpret_header): Make into a const member
10637 (Archive::add_symbols): Call Input_objects::archive_start and
10639 (Archive::const_iterator): Define new class.
10640 (Archive::begin, Archive::end): New functions.
10641 (Archive::include_all_members): Rewrite to use iterator.
10642 (Archive::count_members): New function.
10643 * archive.h (class Archive): Update declarations.
10644 (Archive::filename): New function.
10645 * object.cc: Include "cref.h".
10646 (Sized_relobj::Sized_relobj): Initialize defined_count_.
10647 (Sized_relobj::do_get_global_symbol_counts): New function.
10648 (Input_objects::add_object): Add object to cross-referencer.
10649 (Input_objects::archive_start): New function.
10650 (Input_objects::archive_stop): New function.
10651 (Input_objects::print_symbol_counts): New function.
10652 * object.h: Declare Cref and Archive.
10653 (Object::get_global_symbol_counts): New function.
10654 (Object::do_get_global_symbol_counts): New pure virtual function.
10655 (class Sized_relobj): Add defined_count_ field. Update
10657 (class Input_objects): Add cref_ field. Update constructor.
10658 Update declarations.
10659 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
10661 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
10663 (Sized_dynobj::do_get_global_symbol_counts): New function.
10664 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
10665 defined_count_. Update declarations. Define Symbols typedef.
10666 * symtab.cc (Symbol_table::add_from_relobj): Add defined
10667 parameter. Change all callers.
10668 (Symbol_table::add_from_dynobj): Add sympointers and defined
10669 parameters. Change all callers.
10670 * symtab.h (class Symbol_table): Update declarations.
10671 * Makefile.am (CCFILES): Add cref.cc.
10672 (HFILES): Add cref.h.
10673 * Makefile.in: Rebuild.
10675 2008-07-22 Simon Baldwin <simonb@google.com>
10677 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
10678 to zero when writing undefined symbols.
10680 2008-07-22 Ian Lance Taylor <iant@google.com>
10682 * output.cc (Output_section::add_input_section): Don't try to
10683 merge empty merge sections.
10685 2008-07-21 Craig Silverstein <csilvers@google.com>
10687 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10688 Include symbol version in error message.
10690 2008-07-20 Chris Demetriou <cgd@google.com>
10692 * configure.ac (gold_cv_c_random_seed): New configured variable.
10693 (RANDOM_SEED_CFLAGS): New substituted variable.
10694 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
10695 * configure: Rebuild.
10696 * Makefile.in: Likewise.
10697 * testsuite/Makefile.in: Likewise.
10699 2008-07-18 Ian Lance Taylor <iant@google.com>
10701 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
10702 where we see NAME/NULL and NAME/VERSION as separate symbols.
10703 * testsuite/ver_test_main.cc (main): Call t4.
10704 (t4, t4_2a): Define.
10705 * testsuite/ver_test_2.cc (t4_2): Define.
10706 * testsuite/ver_test_2.script: Put t4_2a in VER2.
10707 * testsuite/ver_test_4.cc (t4_2a): Define.
10708 * testsuite/ver_test_4.script: Put t4_2a in VER2.
10709 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
10711 2008-07-17 Ian Lance Taylor <iant@google.com>
10713 * dynobj.cc (Versions::add_def): If we give an error about a
10714 missing version, go ahead and create the version anyhow.
10716 2008-07-10 Ian Lance Taylor <iant@google.com>
10718 Handle output sections with more than 0x7fffffff bytes.
10719 * object.h (class Relobj): Change map_to_output_ to
10720 output_sections_, and just keep a section pointer. Change all
10721 uses. Move comdat group support to Sized_relobj.
10722 (Relobj::is_section_specially_mapped): Remove.
10723 (Relobj::output_section): Remove poff parameter. Change all
10725 (Relobj::output_section_offset): New function.
10726 (Relobj::set_section_offset): Rewrite.
10727 (Relobj::map_to_output): Remove.
10728 (Relobj::output_sections): New function.
10729 (Relobj::do_output_section_offset): New pure virtual function.
10730 (Relobj::do_set_section_offset): Likewise.
10731 (class Sized_relobj): Add section_offsets_ field. Add comdat
10732 group support from Relobj. Update declarations.
10733 (Sized_relobj::get_output_section_offset): New function.
10734 (Sized_relobj::do_output_section_offset): New function.
10735 (Sized_relobj::do_set_section_offset): New function.
10736 * object.cc (Relobj::output_section_address): Remove.
10737 (Sized_relobj::Sized_relobj): Initialize new fields.
10738 (Sized_relobj::include_section_group): Cast find_kept_object to
10740 (Sized_relobj::include_linkonce_section): Likewise.
10741 (Sized_relobj::do_layout): Use separate arrays for output section
10743 (Sized_relobj::do_count_local_symbols): Change map_to_output to
10745 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
10746 output_sections and section_offsets.
10747 (Sized_relobj::write_local_symbols): Likewise.
10748 (map_to_kept_section): Compute output address directly.
10749 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
10750 output_sections and section_offsets.
10751 (Sized_relobj::write_sections): Likewise.
10752 (Sized_relobj::relocate_sections): Likewise.
10753 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
10754 * output.h (class Output_reloc): Update declarations. Change
10755 u2_.relobj to Sized_relobj*.
10756 (class Output_data_reloc): Change add functions to use
10758 * output.cc (Output_reloc::Output_reloc): Change relobj to
10760 (Output_reloc::local_section_offset): Change return type to
10761 Elf_Addr. Use get_output_section_offset.
10762 (Output_reloc::get_address): Likewise.
10763 (Output_section::is_input_address_mapped): Don't call
10764 is_section_specially_mapped.
10765 (Output_section::output_offset): Likewise.
10766 (Output_section::output_address): Likewise.
10767 (Output_section::starting_output_address): Likewise.
10768 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
10769 parameter to Sized_relobj*.
10770 (Copy_relocs::need_copy_reloc): Likewise.
10771 (Copy_relocs::save): Likewise.
10772 * copy-relocs.h (class Copy_relocs): Update declarations.
10773 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
10774 Sized_relobj*. Change relobj_ field to Sized_relobj*.
10775 * target-reloc.h (relocate_for_relocatable): Change
10776 offset_in_output_section type to Elf_Addr. Change code that uses
10778 * layout.cc (Layout::layout): Always set *off.
10779 * mapfile.cc (Mapfile::print_input_section): Use
10780 output_section_offset.
10781 * i386.cc (Target_i386::copy_reloc): Change object parameter to
10783 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
10784 * sparc.cc (Target_sparc::copy_reloc): Likewise.
10785 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
10787 2008-07-03 Ian Lance Taylor <iant@google.com>
10789 * layout.cc (Layout::include_section): Do not discard unrecognized
10790 SHT_STRTAB sections.
10792 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
10794 * script.cc (Lex::can_continue_name): Make '?' allowable in
10795 version-script names.
10796 * testsuite/version_script.map: Change glob pattern to use '?'
10798 2008-06-30 Manish Singh <yosh@gimp.org>
10801 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
10804 2008-06-30 Ian Lance Taylor <iant@google.com>
10808 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
10809 versions]: Don't try to read the value in the contents, since we
10810 don't use it. Use the template endianness when writing.
10812 2008-06-25 Cary Coutant <ccoutant@google.com>
10814 * fileread.cc (File_read::make_view): Assert on zero-length view.
10815 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
10816 symbol table when there are no symbols to read.
10818 2008-06-23 Craig Silverstein <csilvers@google.com>
10820 * version.cc (version_string): Bump to 1.7
10822 2008-06-18 Craig Silverstein <csilvers@google.com>
10824 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
10825 constant 0xFFFF to type Valtype.
10826 (Powerpc_relocate_functions::rel16_ha): Likewise.
10828 2008-06-17 Ian Lance Taylor <iant@google.com>
10830 * output.h (Output_section::Input_section): Initialize p2align_ to
10831 zero for Output_section_data constructors.
10832 (Output_section::Input_section::addralign): If not an input
10833 section, return the alignment of the Output_section_data.
10834 * testsuite/copy_test.cc: New file.
10835 * testsuite/copy_test_1.cc: New file.
10836 * testsuite/copy_test_2.cc: New file.
10837 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
10838 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
10839 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
10840 (copy_test_1_pic.o, copy_test_1.so): New targets.
10841 (copy_test_2_pic.o, copy_test_2.so): New targets.
10842 * testsuite/Makefile.in: Rebuild.
10844 * script-sections.cc (Script_sections::place_orphan): Initialize
10845 local variable exact.
10847 2008-06-13 David Edelsohn <edelsohn@gnu.org>
10849 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
10851 2008-06-12 David Edelsohn <edelsohn@gnu.org>
10852 David S. Miller <davem@davemloft.net>
10854 * powerpc.cc: New file.
10855 * Makefile.am (TARGETSOURCES): Add powerpc.cc
10856 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
10857 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
10858 * Makefile.in: Rebuild.
10860 2008-06-09 Ian Lance Taylor <iant@google.com>
10862 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
10864 (throwing, orig_terminate): New static variables.
10865 (terminate_handler): New static function.
10866 (t2): Set terminate handler.
10868 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
10871 * binary.cc (Binary_to_elf::sized_convert): Fix .data
10874 2008-05-30 Cary Coutant <ccoutant@google.com>
10876 * archive.cc (Archive::include_all_members) Correct to step
10877 over symbol table and extended name table in thin archives.
10879 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
10882 * target-reloc.h (relocate_for_relocatable): Fix new_offset
10885 2008-05-28 Caleb Howe <cshowe@google.com>
10887 * reduced_debug_output.cc: New file.
10888 * reduced_debug_output.h: New file.
10889 * options.h (class General_options): Add --strip-debug-non-line.
10890 * options.cc (General_options::finalize): Add strip_debug_non_line
10891 to the strip heirarchy.
10892 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
10894 * layout.cc: Include "reduced_debug_output.h".
10895 (Layout::Layout): Initialize new fields.
10896 (line_only_debug_sections): New static array.
10897 (is_lines_only_debug_sections): New static inline function.
10898 (Layout::include_section): Handle --strip-debug-non-line.
10899 (Layout::make_output_section): If --strip-debug-non-line, build
10900 new output sections for .debug_abbrev and .debug_info.
10901 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
10902 gold. Warn about possible overflow.
10903 (read_signed_LEB_128): Likewise.
10904 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
10905 (read_signed_LEB_128): Declare.
10906 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
10907 (HFILES): Add reduced_debug_output.h.
10908 * Makefile.in: Rebuild.
10910 2008-05-21 Ian Lance Taylor <iant@google.com>
10912 * mapfile.cc: New file.
10913 * mapfile.h: New file.
10914 * options.h (class General_options): Add -M/--print-map and -Map.
10915 * options.cc (General_options::finalize): Make -M equivalent to
10917 * main.cc: Include <cstdio> and "mapfile.h".
10918 (main): Open mapfile if requested.
10919 * gold.cc (class Middle_runner): Add mapfile_ field. Update
10920 constructor. Change caller.
10921 (queue_initial_tasks): Add mapfile parameter. Change caller.
10922 (queue_middle_tasks): Likewise.
10923 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
10925 * archive.cc: Include "mapfile.h".
10926 (Archive::add_symbols): Add mapfile parameter. Change all
10927 callers. Pass mapfile, symbol, and reason to include_member.
10928 (Archive::include_all_members): Add mapfile parameter. Change all
10930 (Archive::include_member): Add mapfile, sym, and why parameters.
10931 Change all callers. Report inclusion to map file.
10932 * archive.h: Include "fileread.h".
10933 (class Archive): Update declarations.
10934 (Archive::file): New const method.
10935 (class Add_archive_symbols): Add mapfile_ field. Update
10936 constructor. Change all callers.
10937 * readsyms.h (class Read_symbols): Likewise.
10938 (class Finish_group): Likewise.
10939 (class Read_script): Likewise.
10940 * common.cc: Include "mapfile.h".
10941 (Symbol_table::allocate_commons): Add mapfile parameter. Change
10943 (Symbol_table::do_allocate_commons): Likewise.
10944 (Symbol_table::do_allocate_commons_list): Likewise. Report common
10945 symbol allocation to mapfile.
10946 * common.h (class Allocate_commons_task): Add mapfile_ field.
10947 Update constructor. Change all callers.
10948 * symtab.h (class Symbol_table): Update declarations.
10949 * layout.cc: Include "mapfile.h".
10950 (Layout_task_runner::run): Print information to mapfile.
10951 (Layout::create_gold_note): Change Output_data_fixed_space to
10952 Output_data_zero_fill.
10953 (Layout::create_build_id): Likewise.
10954 (Layout::print_to_mapfile): New function.
10955 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
10956 constructor. Change caller.
10957 (class Layout): Declare print_to_mapfile.
10958 * output.cc (Output_section::Input_section::print_to_mapfile): New
10960 (Output_section::add_input_section): If producing a map, always
10961 add to input_sections_ list.
10962 (Output_section::do_print_to_mapfile): New function.
10963 (Output_segment::print_sections_to_mapfile): New function.
10964 (Output_segment::print_section_list_to_mapfile): New function.
10965 * output.h: Include "mapfile.h".
10966 (Output_data::print_to_mapfile): New function.
10967 (Output_data::do_print_to_mapfile): New virtual function.
10968 (Output_segment_headers::do_print_to_mapfile): New function.
10969 (Output_file_header::do_print_to_mapfile): New function.
10970 (Output_data_const::do_print_to_mapfile): New function.
10971 (class Output_data_const_buffer): Add map_name_ field. Update
10972 constructor. Change all callers. Add do_print_to_mapfile
10974 (class Output_data_fixed_space): Likewise.
10975 (class Output_data_space): Likewise.
10976 (class Output_data_zero_fill): New class.
10977 (Output_data_strtab::do_print_to_mapfile): New function.
10978 (Output_data_reloc_base::do_print_to_mapfile): New function.
10979 (Output_relocatable_relocs::do_print_to_mapfile): New function.
10980 (Output_data_group::do_print_to_mapfile): New function.
10981 (Output_data_got::do_print_to_mapfile): New function.
10982 (Output_data_dynamic::do_print_to_mapfile): New function.
10983 (Output_symtab_xindex::do_print_to_mapfile): New function.
10984 (class Output_section): Declare do_print_to_mapflie. Declare
10985 print_to_mapfile in Input_section.
10986 (class Output_segment): Declare new functions.
10987 * object.h (Sized_relobj::symbol_count): New function.
10988 * script-sections.cc
10989 (Output_section_element_dot_assignment::set_section_addresses):
10990 Change Output_data_fixed_space to Output_data_zero_fill.
10991 (Output_data_expression::do_print_to_mapfile): New function.
10992 * script.cc (read_input_script): Add mapfile parameter. Change
10994 * script.h (read_input_script): Update declaration.
10995 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
10996 (Eh_frame::do_print_to_mapfile): New function.
10997 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
10998 (Output_merge_string::do_print_to_mapfile): New function.
10999 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
11001 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
11003 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
11005 * Makefile.am (CCFILES): Add mapfile.cc.
11006 (HFILES): Add mapfile.h.
11007 * Makefile.in: Rebuild.
11009 2008-05-19 Ian Lance Taylor <iant@google.com>
11011 * options.h (class General_options): Add -z relro.
11012 * layout.cc (Layout::Layout): Initialize relro_segment_.
11013 (Layout::add_output_section_data): Return the output section.
11014 (Layout::make_output_section): Rcognize relro sections and mark
11015 them appropriately.
11016 (Layout::attach_allocated_section_to_segment): Put relro sections
11017 in a PT_GNU_RELRO segment.
11018 (Layout::create_initial_dynamic_sections): Mark the .dynamic
11020 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11022 (Layout::linkonce_mapping): Map d.rel.ro.local to
11023 .data.rel.ro.local.
11024 (Layout::output_section_name): Us .data.rel.ro.local for any
11025 section which begins with that.
11026 * layout.h (class Layout): Update add_output_section_data
11027 declaration. Add relro_segment_ field.
11028 * output.cc (Output_section::Output_section): Initialize is_relro_
11029 and is_relro_local_ fields.
11030 (Output_segment::add_output_section): Group relro sections.
11031 (Output_segment::is_first_section_relro): New function.
11032 (Output_segment::maximum_alignment): If there is a relro section,
11033 align the segment to the common page size.
11034 (Output_segment::set_section_addresses): Track whether we are
11035 looking at relro sections. If the last section is a relro
11036 section, align to the common page size.
11037 (Output_segment::set_section_list_addresses): Add in_relro
11038 parameter. Change all callers. Align to the page size when
11039 moving from relro to non-relro section.
11040 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
11042 * output.h (class Output_section): Add is_relro_ and
11043 is_relro_local_ fields.
11044 (Output_section::is_relro): New function.
11045 (Output_section::set_is_relro): New function.
11046 (Output_section::is_relro_local): New function.
11047 (Output_section::set_is_relro_local): New function.
11048 (class Output_segment): Update declarations.
11049 * i386.cc (Target_i386::got_section): Mark .got section as relro.
11050 * sparc.cc (Target_sparc::got_section): Likewise.
11051 * x86_64.cc (Target_x86_64::got_section): Likewise.
11052 * testsuite/relro_test_main.cc: New file.
11053 * testsuite/relro_test.cc: New file.
11054 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11055 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11056 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11057 (relro_test.so, relro_test_pic.o): New targets.
11058 * testsuite/Makefile.in: Rebuild.
11060 2008-05-16 Ian Lance Taylor <iant@google.com>
11062 * output.cc (Output_segment::add_output_section): Remove front
11064 * output.h (class Output_segment): Remove
11065 add_initial_output_section and overloaded add_output_section.
11066 Update declaration of remaining add_output_section.
11067 * layout.cc (Layout::create_interp): Call add_output_section
11068 rather than add_initial_output_section.
11069 (Layout::finish_dynamic_section): Likewise.
11071 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
11072 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
11073 know the dynamic type.
11074 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
11075 field. Initialize it in constructor.
11076 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
11077 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
11078 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
11081 * output.cc (Output_reloc::get_address): Change return type to
11083 * output.h (class Output_reloc): Update get_address declaration.
11084 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
11085 for section addresses.
11087 2008-05-09 Ian Lance Taylor <iant@google.com>
11090 * gold.cc (gold_nomem): Use return value of write.
11092 2008-05-08 Ian Lance Taylor <iant@google.com>
11094 * symtab.c (Symbol::init_base_output_data): Add version
11095 parameter. Change all callers.
11096 (Symbol::init_base_output_segment): Likewise.
11097 (Symbol::init_base_constant): Likewise.
11098 (Symbol::init_base_undefined): Likewise.
11099 (Sized_symbol::init_output_data): Likewise.
11100 (Sized_symbol::init_output_segment): Likewise.
11101 (Sized_symbol::init_constant): Likewise.
11102 (Sized_symbol::init_undefined): Likewise.
11103 (Symbol_table::do_define_in_output_data): If the new symbol has a
11104 version, mark it as the default.
11105 (Symbol_table::do_define_in_output_segment): Likewise.
11106 (Symbol_table::do_define_as_constant): Likewise.
11107 * symtab.h (class Symbol): Update declarations.
11108 (class Sized_symbol): Likewise.
11109 * resolve.cc (Symbol::override_version): New function.
11110 (Symbol::override_base): Call override_version.
11111 (Symbol::override_base_with_special): Likewise.
11112 * testsuite/ver_script_8.script: New file.
11113 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
11114 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
11115 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
11116 (ver_test_8_1.so, ver_test_8_2.so): New targets.
11118 2008-05-06 Ian Lance Taylor <iant@google.com>
11121 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
11123 (class General_options): Remove existing --undefined, and add
11124 --no-undefined instead. Add new --undefined as synonym for -u.
11125 * archive.cc (Archive::add_symbols): Check whether symbol was
11127 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
11128 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
11129 all uses. Add IS_UNDEFINED. Update declarations to split
11130 different versions of init_base. Declare init_base_undefined.
11131 (Symbol::is_defined): Handle IS_UNDEFINED.
11132 (Symbol::is_undefined): Likewise.
11133 (Symbol::is_weak_undefined): Call is_undefined.
11134 (Symbol::is_absolute): Handle IS_CONSTANT.
11135 (class Sized_symbol): Update declarations to split different
11136 versions of init. Declare init_undefined.
11137 (class Symbol_table): Declare new functions.
11138 * symtab.cc (Symbol::init_base_object): Rename from init_base.
11139 Change all callers.
11140 (Symbol::init_base_output_data): Likewise.
11141 (Symbol::init_base_output_segment): Likewise.
11142 (Symbol::init_base_constant): Likewise.
11143 (Symbol::init_base_undefined): New function.
11144 (Sized_symbol::init_object): Rename from init. Change all
11146 (Sized_symbol::init_output_data): Likewise.
11147 (Sized_symbol::init_output_segment): Likewise.
11148 (Sized_symbol::init_constant): Likewise.
11149 (Sized_symbol::init_undefined): New function.
11150 (Symbol_table::add_undefined_symbols_from_command_line): New
11152 (Symbol_table::do_add_undefined_symbols_from_command_line): New
11154 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
11155 (Symbol::output_section): Likewise.
11156 (Symbol::set_output_section): Likewise.
11157 (Symbol_table::sized_finalize_symbol): Likewise.
11158 (Symbol_table::sized_write_globals): Likewise.
11159 * resolve.cc (Symbol_table::should_override): Likewise.
11160 (Symbol::override_base_with_special): Likewise.
11162 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
11163 symbol, change it to have default visibility.
11164 * testsuite/protected_1.cc: New file.
11165 * testsuite/protected_2.cc: New file.
11166 * testsuite/protected_3.cc: New file.
11167 * testsuite/protected_main_1.cc: New file.
11168 * testsuite/protected_main_2.cc: New file.
11169 * testsuite/protected_main_3.cc: New file.
11170 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
11171 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
11172 (protected_1_LDFLAGS, protected_1_LDADD): Define.
11173 (protected_1.so): New target.
11174 (protected_1_pic.o, protected_2_pic.o): New targets.
11175 (protected_3_pic.o): New target.
11176 (check_PROGRAMS): Add protected_2.
11177 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
11178 (protected_2_LDFLAGS, protected_2_LDADD): Define.
11179 * testsuite/Makefile.in: Rebuild.
11181 * options.h (DEFINE_var): Add set_user_set_##varname__.
11182 (DEFINE_bool_alias): New macro.
11183 (class General_options): Define -Bstatic using DEFINE_bool_alias
11184 rather than DEFINE_special. Add --undefined as an alias for -z
11186 * options.cc (General_options::parse_Bstatic): Remove.
11188 * options.h (class General_options): Add --fatal-warnings.
11189 * main.cc (main): Implement --fatal-warnings.
11190 * errors.h (Errors::warning_count): New function.
11192 * options.h (class General_options): Add -Bsymbolic-functions.
11193 * symtab.h (Symbol::is_preemptible): Check for
11194 -Bsymbolic-functions.
11196 2008-05-05 Ian Lance Taylor <iant@google.com>
11198 * options.h (DEFINE_bool): For DASH_Z, create the negative option
11199 as noVARNAME rather than no-VARNAME.
11200 (class General_options): Add option -z combreloc.
11201 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
11203 (Output_reloc::sort_before) [SHT_REL]: New function.
11204 (Output_reloc::sort_before) [SHT_RELA]: New function.
11205 (class Output_data_reloc_base): Add sort_relocs_ field. Define
11206 Sort_relocs_comparison.
11207 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
11208 parameter. Change all callers.
11209 (Output_data_reloc::Output_data_reloc) [both versions]: Add
11210 sort_relocs parameter. Change all callers.
11211 * output.cc (Output_reloc::get_address): New function, broken out
11213 (Output_reloc::write_rel): Call it.
11214 (Output_reloc::compare): New function.
11215 (Output_data_reloc_base::do_write): Optionally sort relocs.
11217 * configure.ac: If targ_extra_obj is set, link it in.
11218 * configure.tgt: Initialize all variables.
11219 (x86_64*): Set targ_extra_obj and targ_extra_size.
11220 * configure: Rebuild.
11222 * object.cc (Sized_relobj::include_section_group): Adjust section
11223 indexes read from group data. Build vector to pass to
11225 * layout.cc (Layout::layout_group): Add flags and shndxes
11226 parameters. Remove contents parameter. Change caller. Update
11227 explicit instantiations.
11228 * layout.h (class Layout): Update layout_group declaration.
11229 * output.cc (Output_data_group::Output_data_group): Add flags and
11230 input_shndxes parameters. Remove contents parameter. Change
11232 (Output_data_group::do_write): Change input_sections_ to
11234 * output.h (class Output_data_group): Update constructor
11235 declaration. Rename input_sections_ to input_shndxes_.
11236 * testsuite/many_sections_test.cc: Add template.
11238 2008-04-30 Cary Coutant <ccoutant@google.com>
11240 * target-reloc.h (relocate_section): Fix dead-pointer bug.
11242 * layout.cc (Layout::include_section): Refactored check for debug
11244 (Layout::add_comdat): Add new parameters. Change type
11245 of signature parameter. Add object and shndx to signatures table.
11246 (Layout::find_kept_object): New function.
11247 * layout.h: Include <cstring>.
11248 (Layout::is_debug_info_section): New function.
11249 (Layout::add_comdat): Add new parameters.
11250 (Layout::find_kept_object): New function.
11251 (Layout::Kept_section): New struct.
11252 (Layout::Signatures): Change type of map range.
11253 * object.cc (Relobj::output_section_address): New function.
11254 (Sized_relobj::include_section_group): Add new parameters. Change
11255 calls to Layout::add_comdat. Change to build table of kept comdat
11256 groups and table mapping discarded sections to kept sections.
11257 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
11258 (Sized_relobj::do_layout): Change calls to include_section_group and
11259 include_linkonce_section.
11260 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
11261 value to zero when section is discarded.
11262 (Sized_relobj::map_to_kept_section): New function.
11263 * object.h (Relobj::output_section_address): New function.
11264 (Relobj::Comdat_group): New type.
11265 (Relobj::find_comdat_group): New function.
11266 (Relobj::Comdat_group_table): New type.
11267 (Relobj::Kept_comdat_section): New type.
11268 (Relobj::Kept_comdat_section_table): New type.
11269 (Relobj::add_comdat_group): New function.
11270 (Relobj::set_kept_comdat_section): New function.
11271 (Relobj::get_kept_comdat_section): New function.
11272 (Relobj::comdat_groups_): New field.
11273 (Relobj::kept_comdat_sections_): New field.
11274 (Symbol_value::input_value): Update comment.
11275 (Sized_relobj::map_to_kept_section) New function.
11276 (Sized_relobj::include_linkonce_section): Add new parameter.
11277 * target-reloc.h (Comdat_behavior): New type.
11278 (get_comdat_behavior): New function.
11279 (relocate_section): Add code to map a discarded section to the
11280 corresponding kept section when applying a relocation.
11282 2008-04-30 Craig Silverstein <csilvers@google.com>
11284 * dwarf_reader.cc (next_generation_count): New static var.
11285 (Addr2line_cache_entry): New struct.
11286 (addr2line_cache): New static var.
11287 (Dwarf_line_info::one_addr2line): Added caching.
11288 (Dwarf_line_info::clear_addr2line_cache): New function.
11289 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
11290 cache-size parameter.
11291 (Dwarf_line_info::one_addr2line_cache): New function.
11292 * symtab.cc (Symbol_table::detect_odr_violations): Pass
11293 new cache-size argument to one_addr2line(), and clear cache.
11295 2008-04-28 Cary Coutant <ccoutant@google.com>
11297 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
11298 R_386_PC8 relocations.
11300 2008-04-23 Ian Lance Taylor <iant@google.com>
11302 * object.cc (Sized_relobj::include_section_group): Check for
11303 invalid section group.
11305 * object.cc (make_elf_object): Correct test for 64-bit ELF file
11308 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
11309 than read for file header.
11310 * archive.cc (Archive::include_member): Likewise.
11312 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
11314 * aclocal.m4: Regenerate.
11315 * configure: Regenerate.
11317 2008-04-19 Ian Lance Taylor <iant@google.com>
11319 * version.cc (version_string): Bump to 1.6.
11321 * testsuite/Makefile.am (many_sections_r_test): New target.
11322 (many_sections_r_test_SOURCES): Remove.
11323 (many_sections_r_test_DEPENDENCIES): Remove.
11324 (many_sections_r_test_LDFLAGS): Remove.
11325 (many_sections_r_test_LDADD): Remove.
11327 * object.cc (Sized_relobj::do_add_symbols): Always pass
11328 local_symbol_count_ to add_from_relobj.
11330 * testsuite/Makefile.am (many_sections_check.h): Only check one in
11331 every thousand variables.
11332 * testsuite/Makefile.in: Rebuild.
11334 * object.cc (Xindex::initialize_symtab_xindex): New function.
11335 (Xindex::read_symtab_xindex): New function.
11336 (Xindex::sym_xindex_to_shndx): New function.
11337 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
11339 (Sized_relobj::do_initialize_xindex): New function.
11340 (Sized_relobj::do_read_symbols): Adjust section links.
11341 (Sized_relobj::symbol_section_and_value): Add is_ordinary
11342 parameter. Change all callers.
11343 (Sized_relobj::include_section_group): Adjust section links and
11344 symbol section indexes.
11345 (Sized_relobj::do_layout): Adjust section links.
11346 (Sized_relobj::do_count_local_symbols): Adjust section links and
11347 symbol section indexes.
11348 (Sized_relobj::do_finalize_local_symbols): Distinguish between
11349 ordinary and special symbols.
11350 (Sized_relobj::write_local_symbols): Add symtab_xindex and
11351 dynsym_xindex parameters. Change all callers. Adjust section
11352 links. Use SHN_XINDEX when needed.
11353 (Sized_relobj::get_symbol_location_info): Adjust section links.
11354 Don't get fooled by special symbols.
11355 * object.h (class Xindex): Define.
11356 (class Object): Add xindex_ parameter. Declare virtual functoin
11357 do_initialize_xindex.
11358 (Object::adjust_sym_shndx): New function.
11359 (Object::set_xindex): New protected function.
11360 (class Symbol_value): Add is_ordinary_shndx_ field.
11361 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
11362 (Symbol_value::value): Assert ordinary section.
11363 (Symbol_value::initialize_input_to_output_map): Likewise.
11364 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
11365 Change all callers.
11366 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
11368 (class Sized_relobj): Update declarations.
11369 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
11370 parameter. Change all callers.
11371 (Sized_relobj::adjust_shndx): New function.
11372 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
11374 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
11375 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
11376 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
11377 (Sized_dynobj::read_dynsym_section): Adjust section links.
11378 (Sized_dynobj::read_dynamic): Likewise.
11379 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
11381 (Sized_dynobj::do_initialize_xindex): New function.
11382 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
11383 do_initialize_xindex.
11384 (Sized_dynobj::adjust_shndx): New function.
11385 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
11386 dynsym_xindex_ fields.
11387 (Layout::finalize): Add a call to set_section_indexes before
11388 creating the symtab sections.
11389 (Layout::set_section_indexes): Don't do anything if the section
11390 already has a section index.
11391 (Layout::create_symtab_sections): Add shnum parameter. Change
11392 caller. Create .symtab_shndx section if needed.
11393 (Layout::create_shdrs): Add shstrtab_section parameter. Change
11395 (Layout::allocated_output_section_count): New function.
11396 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
11398 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
11399 fields. Update declarations.
11400 (Layout::symtab_xindex): New function.
11401 (Layout::dynsym_xindex): New function.
11402 (class Write_symbols_task): Add layout_ field.
11403 (Write_symbols_task::Write_symbols_task): Add layout parameter.
11405 * output.cc (Output_section_headers::Output_section_headers): Add
11406 shstrtab_section parameter. Change all callers.
11407 (Output_section_headers::do_sized_write): Store overflow values
11408 for section count and section string table section index in
11409 section header zero.
11410 (Output_file_header::do_sized_write): Check for overflow of
11411 section count and section string table section index.
11412 (Output_symtab_xindex::do_write): New function.
11413 (Output_symtab_xindex::endian_do_write): New function.
11414 * output.h (class Output_section_headers): Add shstrtab_section_.
11415 Update declarations.
11416 (class Output_symtab_xindex): Define.
11417 (Output_section::has_out_shndx): New function.
11418 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
11420 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
11421 Change all callers.
11422 (Sized_symbol::init): Likewise.
11423 (Symbol::output_section): Check for ordinary symbol.
11424 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
11425 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
11427 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
11428 Change all callers. Simplify handling of symbols from sections
11429 not included in the link.
11430 (Symbol_table::add_from_dynobj): Handle ordinary symbol
11432 (Weak_alias_sorter::operator()): Assert that symbols are
11434 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
11436 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
11437 parameters. Change all callers.
11438 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
11439 symbol distinction. Use SHN_XINDEX when needed.
11440 (Symbol_table::write_section_symbol): Add symtab_xindex
11441 parameter. Change all callers.
11442 (Symbol_table::sized_write_section_symbol): Likewise. Use
11443 SHN_XINDEX when needed.
11444 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
11446 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
11447 (Symbol::is_defined): Check is_ordinary.
11448 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
11449 (Symbol::is_absolute, Symbol::is_common): Likewise.
11450 (class Sized_symbol): Update declarations.
11451 (class Symbol_table): Update declarations.
11452 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
11453 parameters. Change all callers.
11454 (Sized_symbol::override): Likewise.
11455 (Symbol_table::override): Likewise.
11456 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
11457 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
11458 is_ordinary, and orig_st_shndx parameters. Change all callers.
11459 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
11460 to be in an ordinary section.
11461 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
11462 object and is_ordinary parameters. Change all callers.
11463 (Sized_dwarf_line_info::read_relocs): Add object parameter.
11464 Change all callers. Don't add undefined or non-ordinary symbols
11466 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
11467 Change all callers.
11468 * dwarf_reader.h (class Sized_dwarf_line_info): Update
11470 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
11471 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
11472 (Sized_relobj::relocate_sections): Likewise.
11473 * target-reloc.h (scan_relocs): Adjust section symbol index.
11474 (scan_relocatable_relocs): Likewise.
11475 * i386.cc (Scan::local): Check for ordinary symbols.
11476 * sparc.cc (Scan::local): Likewise.
11477 * x86_64.cc (Scan::local): Likewise.
11478 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
11479 to symbol_section_and_value.
11480 * testsuite/many_sections_test.cc: New file.
11481 * testsuite/Makefile.am (BUILT_SOURCES): Define.
11482 (check_PROGRAMS): Add many_sections_test.
11483 (many_sections_test_SOURCES): Define.
11484 (many_sections_test_DEPENDENCIES): Define.
11485 (many_sections_test_LDFLAGS): Define.
11486 (BUILT_SOURCES): Add many_sections_define.h.
11487 (many_sections_define.h): New target.
11488 (BUILT_SOURCES): Add many_sections_check.h.
11489 (many_sections_check.h): New target.
11490 (check_PROGRAMS): Add many_sections_r_test.
11491 (many_sections_r_test_SOURCES): Define.
11492 (many_sections_r_test_DEPENDENCIES): Define.
11493 (many_sections_r_test_LDFLAGS): Define.
11494 (many_sections_r_test_LDADD): Define.
11495 (many_sections_r_test.o): New target.
11496 * testsuite/Makefile.in: Rebuild.
11498 2008-04-17 Cary Coutant <ccoutant@google.com>
11500 * errors.cc (Errors::info): New function.
11501 (gold_info): New function.
11502 * errors.h (Errors::info): New function.
11503 * gold.h (gold_info): New function.
11504 * object.cc (Input_objects::add_object): Print trace output.
11505 * options.cc (options::parse_set): New function.
11506 (General_options::parse_wrap): Deleted.
11507 (General_options::General_options): Deleted initializer.
11508 * options.h (options::String_set): New typedef.
11509 (options::parse_set): New function.
11510 (DEFINE_set): New macro.
11511 (General_options::wrap): Changed to use DEFINE_set. Changed
11512 callers of any_wrap_symbols and is_wrap_symbol.
11513 (General_options::trace, General_options::trace_symbol):
11515 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
11516 (General_options::wrap_symbols_): Deleted.
11517 * symtab.cc (Symbol_table::add_from_object): Print trace output.
11519 2008-04-17 David S. Miller <davem@davemloft.net>
11521 * options.cc (General_options::parse_V): New function.
11522 * options.h: Add entries for -V and -Qy.
11524 2008-04-17 Ian Lance Taylor <iant@google.com>
11526 * common.cc (Symbol_table::allocate_commons): Remove options
11527 parameter. Change caller.
11528 (Symbol_table::do_allocate_commons): Remove options parameter.
11529 Change caller. Just call do_allocate_commons_list twice.
11530 (Symbol_table::do_allocate_commons_list): New function, broken out
11531 of do_allocate_commons.
11532 * common.h (class Allocate_commons_task): Remove options_ field.
11533 Update constructor.
11534 * symtab.cc (Symbol_table::Symbol_table): Initialize
11536 (Symbol_table::add_from_object): Put TLS common symbols on
11538 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
11539 which are IN_OUTPUT_DATA.
11540 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
11541 allocate_commons and do_allocate_commons declarations. Declare
11542 do_allocate_commons_list.
11543 * gold.cc (queue_middle_tasks): Update creation of
11544 Allocate_commons_task to not pass options.
11545 * testsuite/Makefile.am (INCLUDES): Add -I.. .
11546 (TLS_TEST_C_FLAGS): New variable.
11547 (tls_test_c_pic.o): New target.
11548 (tls_test_shared.so): Link in tls_test_c_pic.o.
11549 (tls_test_c_pic_ie.o): New target.
11550 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
11551 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
11552 (tls_test_c.o): New target.
11553 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
11554 (tls_pic_test_LDADD): Likewise.
11555 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
11556 (tls_shared_gd_to_ie_test_LDADD): Likewise.
11557 (tls_test_c_gnu2.o): New target.
11558 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
11560 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
11561 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
11562 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
11563 * testsuite/tls_test.cc: Include "config.h".
11564 (t_last): Call t11_last.
11565 * testsuite/tls_test.h (t11, t11_last): Declare.
11566 * testsuite/tls_test_c.c: New file.
11567 * testsuite/tls_test_main.cc (thread_routine): Call t11.
11568 * configure.ac: Check for OpenMP support.
11569 * configure, config.in, Makefile.in: Rebuild.
11570 * testsuite/Makefile.in: Rebuild.
11572 2008-04-16 Cary Coutant <ccoutant@google.com>
11574 * i386.cc (Target_i386::define_tls_base_symbol): New function.
11575 (Target_i386::tls_base_symbol_defined_): New field.
11576 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11577 (Target_i386::Scan::global): Likewise.
11578 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
11579 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
11580 (Target_x86_64::tls_base_symbol_defined_): New field.
11581 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11582 (Target_x86_64::Scan::global): Likewise.
11584 2008-04-16 Cary Coutant <ccoutant@google.com>
11586 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
11587 (Symbol::needs_plt_entry): Allow weak undefined symbols.
11588 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
11589 building shared libraries.
11590 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
11591 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
11592 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
11593 * testsuite/Makefile.in: Rebuild.
11594 * testsuite/weak_undef.h: New file.
11595 * testsuite/weak_undef_file1.cc: Add extra test cases.
11596 * testsuite/weak_undef_file2.cc: Likewise.
11597 * testsuite/weak_undef_test.cc: Likewise.
11599 2008-04-16 David S. Miller <davem@davemloft.net>
11601 * sparc.cc (Target_sparc::Scan): Change from struct to class.
11602 Add issued_non_pic_error_ field. Declare check_non_pic.
11603 (Target_sparc::Scan::check_non_pic): New function.
11604 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
11605 (Target_sparc::Scan::global): Likewise.
11607 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
11608 * configure: Rebuild.
11610 * options.h (DEFINE_enable): New macro.
11611 (new_dtags): New enable option.
11612 (initfirst, interpose, loadfltr, nodefaultlib,
11613 nodelete, nodlopen, nodump): New -z options.
11614 * layout.cc (Layout:finish_dynamic_section): If new
11615 dtags enabled, emit DT_RUNPATH. Also, emit a
11616 DT_FLAGS_1 containing any specified -z flags.
11618 2008-04-16 Ian Lance Taylor <iant@google.com>
11620 * copy-relocs.cc: New file.
11621 * copy-relocs.h: New file.
11622 * reloc.cc: Remove Copy_relocs code.
11623 * reloc.h: Likewise.
11624 * reloc-types.h (struct Reloc_types) [both versions]: Add
11625 get_reloc_addend_noerror.
11626 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
11627 variants of add_global which take an addend which must be zero.
11628 * i386.cc: Include "copy-relocs.h".
11629 (class Target_i386): Change type of copy_relocs_ to variable,
11630 update initializer.
11631 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
11632 Change all callers.
11633 (Target_i386::do_finalize_sections): Change handling of
11635 * sparc.cc: Include "copy-relocs.h".
11636 (class Target_sparc): Change type of copy_relocs_ to variable,
11637 update initializer.
11638 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
11639 Change all callers.
11640 (Target_sparc::do_finalize_sections): Change handling of
11642 * x86_64.cc: Include "copy-relocs.h".
11643 (class Target_x86_64): Change type of copy_relocs_ to variable,
11644 update initializer.
11645 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
11646 class. Change all callers.
11647 (Target_x86_64::do_finalize_sections): Change handling of
11649 * Makefile.am (CCFILES): Add copy-relocs.cc.
11650 (HFILES): Add copy-relocs.h.
11652 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
11654 * testsuite/script_test_4.sh: Permit leading zeroes.
11656 2008-04-15 Ian Lance Taylor <iant@google.com>
11658 * script-sections.cc (Script_sections::create_segments): Use
11659 header_size_adjustment even when there is enough room for the
11661 * testsuite/script_test_4.sh: New file.
11662 * testsuite/script_test_4.t: New file.
11663 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
11664 (check_DATA): Add script_test_4.stdout.
11665 (MOSTLYCLEANFILES): Likewise.
11666 (script_test_4): New target.
11667 (script_test_4.stdout): New target.
11668 * testsuite/Makefile.in: Rebuild.
11670 * sparc.cc: Add definitions for Output_data_plt_sparc class
11673 2008-04-14 David S. Miller <davem@davemloft.net>
11675 * sparc.cc: New file.
11676 * Makefile.am (TARGETSOURCES): Add sparc.cc
11677 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
11678 * configure.tgt: Document targ_extra_size and
11679 targ_extra_big_endian. Add entries for sparc-* and
11681 * configure.ac: Handle targ_extra_size and
11682 targ_extra_big_endian.
11683 * Makefile.in: Rebuild.
11684 * configure: Likewise.
11685 * po/POTFILES.in: Likewise.
11686 * po/gold.pot: Likewise.
11688 2008-04-14 Ian Lance Taylor <iant@google.com>
11690 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
11691 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
11692 in the name/type/flags to section mapping. Don't call
11693 allocate_output_section.
11694 (Layout::choose_output_section): Change parameter from adjust_name
11695 to is_input_section. Don't permit input sections after sections
11696 are attached to segments. Don't call allocate_output_section.
11697 (Layout::layout_eh_frame): Call update_flags_for_input_section,
11698 not write_enable_output_section.
11699 (Layout::make_output_section): Don't push to
11700 unattached_section_list_ nor call attach_to_segment. Call
11701 attach_section_to_segment if sections are attached.
11702 (Layout::attach_sections_to_segments): New function.
11703 (Layout::attach_section_to_segment): New function.
11704 (Layout::attach_allocated_section_to_segment): Rename from
11705 attach_to_segment. Remove flags parameter.
11706 (Layout::allocate_output_section): Remove function.
11707 (Layout::write_enable_output_section): Remove function.
11708 * layout.h (class Layout): Update for above changes. Add new
11709 field sections_are_attached_.
11710 * output.h (Output_section::update_flags_for_input_section): New
11712 * output.cc (Output_section::add_input_section): Call
11713 update_flags_for_input_section.
11714 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
11716 2008-04-11 Cary Coutant <ccoutant@google.com>
11718 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
11719 thought unnecessary.
11720 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
11722 2008-04-11 Ian Lance Taylor <iant@google.com>
11724 * output.h (class Output_section_data): Remove inline definition
11726 * output.cc (Output_section_data::set_addralign): New function.
11728 2008-04-11 Cary Coutant <ccoutant@google.com>
11730 Add support for TLS descriptors for i386 and x86_64.
11731 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
11732 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
11733 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
11735 (Target_i386::got_mod_index_entry): Remove unnecessary code.
11736 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
11737 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
11739 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
11740 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
11741 Fix problem with initial-exec relocations.
11742 (Target_i386::Relocate::relocate_tls): Likewise.
11743 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
11745 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
11746 support for section-plus-offset dynamic table entries.
11747 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
11748 (Output_data_dynamic::Dynamic_entry): Add support for
11749 section-plus-offset dynamic table entries.
11750 (Output_data_dynamic::Classification): Likewise.
11751 (Output_data_dynamic::classification_): Renamed offset_.
11752 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
11753 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
11754 (Target_x86_64::make_plt_section): New function.
11755 (Target_x86_64::reserve_tlsdesc_entries): New function.
11756 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
11757 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
11758 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
11759 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
11760 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
11761 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
11762 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
11763 add extra PLT entry for TLS descriptors.
11764 (Output_data_plt_x86_64::got_): New field.
11765 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
11766 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
11768 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
11770 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
11771 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
11772 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
11773 R_386_TLS_DESC_CALL relocations.
11774 (Target_x86_64::Scan::global): Likewise.
11775 (Target_x86_64::do_finalize_sections): Add dynamic table entries
11776 for TLS descriptors.
11777 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
11778 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
11779 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
11780 GD-to-IE relaxation.
11781 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
11782 and TLS_DESCRIPTORS.
11783 * Makefile.in: Rebuild.
11784 * configure: Rebuild.
11785 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
11786 (tls_test_shared2.so): New target.
11787 (tls_shared_gd_to_ie_test_SOURCES): New variable.
11788 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
11789 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
11790 (tls_shared_gd_to_ie_test_LDADD): New variable.
11791 (tls_shared_gnu2_gd_to_ie_test): New target.
11792 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
11794 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
11795 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
11796 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
11797 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
11798 (tls_shared_gnu2_test): New target.
11799 (tls_test_gnu2_shared.so): New target.
11800 (tls_shared_gnu2_test_SOURCES): New variable.
11801 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
11802 (tls_shared_gnu2_test_LDFLAGS): New variable.
11803 (tls_shared_gnu2_test_LDADD): New variable.
11804 * testsuite/Makefile.in: Rebuild.
11805 * testsuite/Makefile.
11807 2008-04-11 Ian Lance Taylor <iant@google.com>
11809 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
11811 * testsuite/Makefile.in: Rebuild.
11813 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
11815 * testsuite/script_test_2.cc (main): Adjust test.
11817 2008-04-11 David S. Miller <davem@davemloft.net>
11818 Ian Lance Taylor <iant@google.com>
11820 * options.h (General_options): Add entries for '-Y' and
11822 * options.cc (General_options:finalize): If -Y was used, add those
11823 entries to the library path instead of the default "/lib" and
11826 2008-04-11 David S. Miller <davem@davemloft.net>
11828 * testsuite/justsyms.t: Start at 0x100.
11829 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
11830 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
11832 * testsuite/script_test_2.cc: Adjust string and section length
11835 2008-04-09 Ian Lance Taylor <iant@google.com>
11838 * script-sections.cc (Sections_element::allocate_to_segment): Add
11840 (Output_section_definition::allocate_to_segment): Likewise.
11841 (Orphan_output_section::allocate_to_segment): Likewise.
11842 (Script_sections::attach_sections_using_phdrs_clause): Don't
11843 propagate non-PT_LOAD segments to orphan sections.
11844 * testsuite/Makefile.am (script_test_3.stdout): Generate using
11845 readelf rather than objdump.
11846 * testsuite/script_test_3.sh: Adjust accordingly. Test that
11847 .interp section and PT_INTERP segment are the same size.
11848 * testsuite/Makefile.in: Rebuild.
11850 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
11851 aliases for symbols defined in the same object.
11852 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
11853 (weak_alias_test_SOURCES): New variable.
11854 (weak_alias_test_DEPENDENCIES): New variable.
11855 (weak_alias_test_LDFLAGS): New variable.
11856 (weak_alias_test_LDADD): New variable.
11857 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
11858 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
11859 (weak_alias_test_3.o): New target.
11860 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
11861 * testsuite/weak_alias_test_main.cc: New file.
11862 * testsuite/weak_alias_test_1.cc: New file.
11863 * testsuite/weak_alias_test_2.cc: New file.
11864 * testsuite/weak_alias_test_3.cc: New file.
11866 2008-04-08 Ian Lance Taylor <iant@google.com>
11868 * options.h (class General_options): Add --noinhibit-exec option.
11869 * main.cc (main): Check --noinhibit-exec.
11871 * options.h (class General_options): Define --wrap as a special
11872 option. Add wrap_symbols_ field.
11873 (General_options::any_wrap_symbols): New function.
11874 (General_options::is_wrap_symbol): New function.
11875 * options.cc (General_options::parse_wrap): New function.
11876 (General_options::General_options): Initialize wrap_symbols_.
11877 * symtab.cc (Symbol_table::wrap_symbol): New function.
11878 (Symbol_table::add_from_object): Handle --wrap.
11879 * symtab.h (class Symbol_table): Declare wrap_symbol.
11880 * target.h (Target::wrap_char): New function.
11881 (Target::Target_info): Add wrap_char field.
11882 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
11883 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11884 * testsuite/testfile.cc (Target_test::test_target_info):
11887 * errors.cc (Errors::undefined_symbol): Mention symbol version if
11890 * layout.h (class Layout): Add added_eh_frame_data_ field.
11891 * layout.cc (Layout::Layout): Initialize new field.
11892 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
11893 output section until we find a section we merged successfully.
11894 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
11895 that the size be non-zero.
11897 * merge.cc (Object_merge_map::get_output_offset): Remove inline
11900 2008-04-08 Craig Silverstein <csilvers@google.com>
11902 * configure.ac: Export new conditional variable HAVE_ZLIB.
11903 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
11905 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
11906 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11908 2008-04-07 Ian Lance Taylor <iant@google.com>
11910 * version.cc (version_string): Set to "1.5".
11912 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
11913 Add issued_non_pic_error_ field. Declare check_non_pic.
11914 (Target_x86_64::Scan::check_non_pic): New function.
11915 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
11916 (Target_x86_64::Scan::global): Likewise.
11918 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
11919 addend parameter. Change caller. Handle merge sections.
11920 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
11921 Address to Addend. Don't add in the result of
11922 local_section_offset, pass down the addend and use the returned
11924 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
11925 Update declarations of local_section_offset and symbol_value.
11926 * testsuite/two_file_test_1.cc (t18): New function.
11927 * testsuite/two_file_test_2.cc (f18): New function.
11928 * testsuite/two_file_test_main.cc (main): Call t18.
11929 * testsuite/two_file_test.h (t18, f18): Declare.
11931 * configure.ac: Don't test for objdump, c++filt, or readelf.
11932 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
11934 (TEST_READELF): New variable.
11935 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
11936 (check_PROGRAMS): Add two_file_strip_test.
11937 (two_file_strip_test): New target.
11938 (check_PROGRAMS): Add two_file_same_shared_strip_test.
11939 (two_file_same_shared_strip_test_SOURCES): New variable.
11940 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
11941 (two_file_same_shared_strip_test_LDFLAGS): New variable.
11942 (two_file_same_shared_strip_test_LDADD): New variable.
11943 (two_file_shared_strip.so): New target.
11944 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
11945 (ver_test_5.syms, ver_test_7.syms): Likewise.
11946 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
11947 (strip_test_3.stdout): Use TEST_OBJDUMP.
11948 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11950 2008-04-04 Cary Coutant <ccoutant@google.com>
11952 * symtab.h (Symbol::is_weak_undefined): New function.
11953 (Symbol::is_strong_undefined): New function.
11954 (Symbol::is_absolute): New function.
11955 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
11956 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
11958 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
11959 (weak_undef_test): New target.
11960 * testsuite/Makefile.in: Rebuild.
11961 * testsuite/weak_undef_file1.cc: New file.
11962 * testsuite/weak_undef_file2.cc: New file.
11963 * testsuite/weak_undef_test.cc: New file.
11965 2008-04-03 Craig Silverstein <csilvers@google.com>
11967 * compressed_output.h (class Output_compressed_section): Use
11969 * compressed_output.cc (zlib_compress): Use unsigned buffers,
11971 (zlib_compressed_suffix): Removed.
11972 (Output_compressed_section::set_final_data_size): Use unsigned
11974 * testsuite/Makefile.am (flagstest_compress_debug_sections):
11975 Fix linker invocation.
11976 (flagstest_o_specialfile_and_compress_debug_sections):
11978 * testsuite/Makefile.in: Regenerated.
11980 2008-04-02 David S. Miller <davem@davemloft.net>
11982 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
11983 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
11985 2008-04-02 Craig Silverstein <csilvers@google.com>
11989 2008-04-02 Ian Lance Taylor <iant@google.com>
11991 * fileread.cc (File_read::find_view): Add byteshift and vshifted
11992 parameters. Update for new key type to views_. Change all
11994 (File_read::read): Adjust for byteshift in returned view.
11995 (File_read::add_view): New function, broken out of
11996 find_and_make_view.
11997 (File_read::make_view): New function, broken out of
11998 find_and_make_view.
11999 (File_read::find_or_make_view): Add offset and aligned
12000 parameters. Rewrite accordingly. Change all callers.
12001 (File_read::get_view): Add offset and aligned parameters. Adjust
12002 for byteshift in return value.
12003 (File_read::get_lasting_view): Likewise.
12004 * fileread.h (class File_read): Update declarations.
12005 (class File_read::View): Add byteshift_ field. Add byteshift to
12006 constructor. Add byteshift method.
12007 * archive.h (Archive::clear_uncached_views): New function.
12008 (Archive::get_view): Add aligned parameter. Change all callers.
12009 * object.h (Object::get_view): Add aligned parameter. Change all
12011 (Object::get_lasting_view): Likewise.
12013 * fileread.cc (File_read::release): Don't call clear_views if
12014 there are multiple objects.
12015 * fileread.h (File_read::clear_uncached_views): New function.
12016 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
12019 2008-03-31 Cary Coutant <ccoutant@google.com>
12021 Add thin archive support.
12022 * archive.cc (Archive::armagt): New const.
12023 (Archive::setup): Remove task parameter and calls to unlock.
12024 (Archive::unlock_nested_archives): New function.
12025 (Archive::read_header): Add nested_off parameter. Change
12027 (Archive::interpret_header): Likewise.
12028 (Archive::include_all_members): Change to handle thin
12030 (Archive::include_member): Likewise.
12031 * archive.h (Archive::Archive): Add new parameters and
12033 (Archive::armagt): New const.
12034 (Archive::setup): Remove task parameter.
12035 (Archive::unlock_nested_archives): New function.
12036 (Archive::read_header): Add nested_off parameter.
12037 (Archive::interpret_header): Likewise.
12038 (Archive::Nested_archive_table): New typedef.
12039 (Archive::is_thin_archive_): New field.
12040 (Archive::nested_archives_): New field.
12041 (Archive::options_): New field.
12042 (Archive::dirpath_): New field.
12043 (Archive::task_): New field.
12044 * readsyms.cc (Read_symbols::do_read_symbols): Add check
12045 for thin archives. Pass additional parameters to
12046 Archive::Archive. Unlock the archive file after calling
12049 2008-03-29 Ian Lance Taylor <iant@google.com>
12051 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12052 version symbol to be local.
12053 * testsuite/ver_test_4.sh: New file.
12054 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12055 (check_DATA): Add ver_test_4.syms.
12056 (ver_test_4.syms): New target.
12057 * testsuite/Makefile.in: Rebuild.
12060 (Output_section::Input_section_sort_entry::has_priority): New
12062 (Output_section::Input_section_sort_entry::match_file_name): New
12064 (Output_section::Input_section_sort_entry::match_section_name):
12066 (Output_section::Input_section_sort_entry::match_section_name_prefix):
12068 (Output_section::Input_section_sort_entry::match_section_file):
12070 (Output_section::Input_section_sort_compare::operator()): Rewrite
12071 using new Input_section_sort_entry functions. Sort crtbegin and
12072 crtend first. Sort sections with no priority before sections with
12074 * testsuite/initpri1.c (d3): Check j != 4.
12075 (cd5): New constructor/destructor function.
12076 (main): Check j != 2.
12078 * symtab.cc (Symbol_table::add_from_object): If we don't use the
12079 new symbol when resolving, don't call set_is_default.
12080 * testsuite/ver_test_7.cc: New file.
12081 * testsuite/ver_test_7.sh: New file.
12082 * testsuite/Makefile.am (ver_test_7.so): New target.
12083 (ver_test_7.o): New target.
12084 (check_SCRIPTS): Add ver_test_7.sh.
12085 (check_DATA): Add ver_test_7.syms.
12086 (ver_test_7.syms): New target.
12088 2008-03-28 Ian Lance Taylor <iant@google.com>
12090 * layout.cc (Layout::layout): If we see an input section with a
12091 name that needs sorting, set the must_sort flag for the output
12093 (Layout::make_output_section): If the name of the output section
12094 indicates that it might require sorting, set the may_sort flag.
12095 * output.h (Output_section::may_sort_attached_input_sections): New
12097 (Output_section::set_may_sort_attached_input_sections): New
12099 (Output_section::must_sort_attached_input_sections): New
12101 (Output_section::set_must_sort_attached_input_sections): New
12103 (class Output_section): Declare Input_section_sort_entry. Define
12104 Input_section_sort_compare. Declare
12105 sort_attached_input_sections. Add new fields:
12106 may_sort_attached_input_sections_,
12107 must_sort_attached_input_sections_,
12108 attached_input_sections_are_sorted_.
12109 * output.cc (Output_section::Output_section): Initialize new
12111 (Output_section::add_input_section): Add an entry to
12112 input_sections_ if may_sort or must_sort are true.
12113 (Output_section::set_final_data_size): Call
12114 sort_attached_input_sections if necessary.
12115 (Output_section::Input_section_sort_entry): Define new class.
12116 (Output_section::Input_section_sort_compare::operator()): New
12118 (Output_section::sort_attached_input_sections): New function.
12119 * configure.ac: Check whether the compiler supports constructor
12120 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
12121 * testsuite/initpri1.c: New file.
12122 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
12123 CONSTRUCTOR_PRIORITY.
12124 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
12125 (initpri1_LDFLAGS): New variable.
12126 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12128 2008-03-27 Ian Lance Taylor <iant@google.com>
12130 * common.cc (Sort_commons::operator): Correct sorting algorithm.
12131 * testsuite/common_test_1.c: New file.
12132 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
12133 (common_test_1_SOURCES): New variable.
12134 (common_test_1_DEPENDENCIES): New variable.
12135 (common_test_1_LDFLAGS): New variable.
12137 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
12138 and commons_ correctly when NAME/VERSION does not override
12140 * testsuite/ver_test_6.c: New file.
12141 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
12142 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
12143 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
12145 2008-03-26 Ian Lance Taylor <iant@google.com>
12147 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
12148 of an undefined symbol from a version script.
12149 * testsuite/Makefile.am (ver_test_5.so): New target.
12150 (ver_test_5.o): New target.
12151 (check_SCRIPTS): Add ver_test_5.sh.
12152 (check_DATA): Add ver_test_5.syms.
12153 (ver_test_5.syms): New target.
12154 * testsuite/ver_test_5.cc: New file.
12155 * testsuite/ver_test_5.script: New file.
12156 * testsuite/ver_test_5.sh: New file.
12157 * Makefile.in, testsuite/Makefile.in: Rebuild.
12160 Fix problems building gold with gcc 4.3.0.
12161 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
12162 (gold_error_at_location, gold_warning_at_location): Use it.
12163 * configure.ac: Check whether we can compile and use a template
12164 function with a printf attribute.
12165 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
12166 when jumping over bytes.
12167 * object.cc: Instantiate Object::read_section_data.
12168 * debug.h: Include <cstring>
12169 * dwarf_reader.cc: Include <algorithm>
12170 * main.cc: Include <cstring>.
12171 * options.cc: Include <cstring>.
12172 * output.cc: Include <cstring>.
12173 * script.cc: Include <cstring>.
12174 * script.h: Include <string>.
12175 * symtab.cc: Include <cstring> and <algorithm>.
12176 * target-select.cc: Include <cstring>.
12177 * version.cc: Include <string>.
12178 * testsuite/testmain.cc: Include <cstdlib>.
12179 * configure, config.in: Rebuild.
12181 2008-03-25 Ian Lance Taylor <iant@google.com>
12183 * options.cc: Include "../bfd/bfdver.h".
12184 (options::help): Print bug reporting address.
12186 * version.cc (print_version): Adjust output for current value of
12187 BFD_VERSION_STRING.
12191 * options.cc (options::help): Print list of supported targets.
12192 * target-select.h: Include <vector>.
12193 (class Target_selector): Make machine_, size_, and is_big_endian_
12194 fields const. Add bfd_name_ and instantiated_target_ fields.
12195 (Target_selector::Target_selector): Add bfd_name parameter.
12196 (Target_selector::recognize): Make non-virtual, call
12198 (Target_selector::recognize_by_name): Make non-virtual, call
12199 do_recognize_by_name.
12200 (Target_selector::supported_names): New function.
12201 (Target_selector::bfd_name): New function.
12202 (Target_selector::do_instantiate_target): New pure virtual
12204 (Target_selector::do_recognize): New virtual function.
12205 (Target_selector::do_recognize_by_name): New virtual function.
12206 (Target_selector::instantiate_target): New private function.
12207 (supported_target_names): Declare.
12208 * target-select.cc (Target_selector::Target_selector): Update for
12209 new parameter and fields.
12210 (select_target_by_name): Check that the name matches before
12211 calling recognize_by_name.
12212 (supported_target_names): New function.
12213 * i386.cc (class Target_selector_i386): Update Target_selector
12214 constructor call. Remove recognize and recognize_by_name. Add
12215 do_instantiate_target.
12216 * x86_64.cc (class Target_selector_x86_64): Likewise.
12217 * testsuite/testfile.cc (class Target_selector_test): Update for
12218 changes to Target_selector.
12220 * README: Rewrite, with some notes on unsupported features.
12222 2008-03-24 Cary Coutant <ccoutant@google.com>
12224 * i386.cc (Target_i386::Got_type): New enum declaration.
12225 (Target_i386::Scan::local): Updated callers of Output_data_got
12227 (Target_i386::Scan::global): Likewise.
12228 (Target_i386::Relocate::relocate): Likewise.
12229 (Target_i386::Relocate::relocate_tls): Likewise.
12230 * object.h (Got_offset_list): New class.
12231 (Sized_relobj::local_has_got_offset): Added got_type parameter.
12232 (Sized_relobj::local_got_offset): Likewise.
12233 (Sized_relobj::set_local_got_offset): Likewise.
12234 (Sized_relobj::local_has_tls_got_offset): Removed.
12235 (Sized_relobj::local_tls_got_offset): Removed.
12236 (Sized_relobj::set_local_tls_got_offset): Removed.
12237 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
12238 * output.cc (Output_data_got::add_global): Added got_type parameter.
12239 (Output_data_got::add_global_with_rel): Likewise.
12240 (Output_data_got::add_global_with_rela): Likewise.
12241 (Output_data_got::add_global_pair_with_rel): New function.
12242 (Output_data_got::add_global_pair_with_rela): New function.
12243 (Output_data_got::add_local): Added got_type parameter.
12244 (Output_data_got::add_local_with_rel): Likewise.
12245 (Output_data_got::add_local_with_rela): Likewise.
12246 (Output_data_got::add_local_pair_with_rel): New function.
12247 (Output_data_got::add_local_pair_with_rela): New function.
12248 (Output_data_got::add_global_tls): Removed.
12249 (Output_data_got::add_global_tls_with_rel): Removed.
12250 (Output_data_got::add_global_tls_with_rela): Removed.
12251 (Output_data_got::add_local_tls): Removed.
12252 (Output_data_got::add_local_tls_with_rel): Removed.
12253 (Output_data_got::add_local_tls_with_rela): Removed.
12254 * output.h (Output_data_got::add_global): Added got_type parameter.
12255 (Output_data_got::add_global_with_rel): Likewise.
12256 (Output_data_got::add_global_with_rela): Likewise.
12257 (Output_data_got::add_global_pair_with_rel): New function.
12258 (Output_data_got::add_global_pair_with_rela): New function.
12259 (Output_data_got::add_local): Added got_type parameter.
12260 (Output_data_got::add_local_with_rel): Likewise.
12261 (Output_data_got::add_local_with_rela): Likewise.
12262 (Output_data_got::add_local_pair_with_rel): New function.
12263 (Output_data_got::add_local_pair_with_rela): New function.
12264 (Output_data_got::add_global_tls): Removed.
12265 (Output_data_got::add_global_tls_with_rel): Removed.
12266 (Output_data_got::add_global_tls_with_rela): Removed.
12267 (Output_data_got::add_local_tls): Removed.
12268 (Output_data_got::add_local_tls_with_rel): Removed.
12269 (Output_data_got::add_local_tls_with_rela): Removed.
12270 * resolve.cc (Symbol::override_base_with_special): Removed
12271 reference to has_got_offset_ field.
12272 * symtab.cc (Symbol::init_fields): Replaced initialization
12273 of got_offset_ with got_offsets_. Removed initialization
12275 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
12276 (Symbol::got_offset): Likewise.
12277 (Symbol::set_got_offset): Likewise.
12278 (Symbol::has_tls_got_offset): Removed.
12279 (Symbol::tls_got_offset): Removed.
12280 (Symbol::set_tls_got_offset): Removed.
12281 (Symbol::got_offset_): Removed.
12282 (Symbol::tls_mod_got_offset_): Removed.
12283 (Symbol::tls_pair_got_offset_): Removed.
12284 (Symbol::got_offsets_): New field.
12285 (Symbol::has_got_offset): Removed.
12286 (Symbol::has_tls_mod_got_offset): Removed.
12287 (Symbol::has_tls_pair_got_offset): Removed.
12288 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
12289 (Target_x86_64::Scan::local): Updated callers of Output_data_got
12291 (Target_x86_64::Scan::global): Likewise.
12292 (Target_x86_64::Relocate::relocate): Likewise.
12293 (Target_x86_64::Relocate::relocate_tls): Likewise.
12295 2008-03-25 Ben Elliston <bje@au.ibm.com>
12297 * yyscript.y: Fix spelling error in comment.
12299 2008-03-24 Ian Lance Taylor <iant@google.com>
12301 * options.h (class General_options): Define build_id option.
12302 * layout.h (class Layout): Declare write_build_id, create_note,
12303 create_build_id. Add build_id_note_ member.
12304 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
12305 "libiberty.h", "md5.h", "sha1.h".
12306 (Layout::Layout): Initialize eh_frame_data_,
12307 eh_frame_hdr_section_, and build_id_note_.
12308 (Layout::finalize): Call create_build_id.
12309 (Layout::create_note): New function, broken out of
12310 Layout::create_gold_note.
12311 (Layout::create_gold_note): Call create_note.
12312 (Layout::create_build_id): New function.
12313 (Layout::write_build_id): New function.
12314 (Close_task_runner::run): Call write_build_id.
12316 * x86_64.cc: Correct license to GPLv3.
12318 2008-03-23 Ian Lance Taylor <iant@google.com>
12320 * options.cc: Include "demangle.h".
12321 (parse_optional_string): New function.
12322 (parse_long_option): Handle takes_optional_argument.
12323 (parse_short_option): Update dash_z initializer. Handle
12324 takes_optional_argument.
12325 (General_options::General_options): Initialize do_demangle_.
12326 (General_options::finalize): Set do_demangle_. Handle demangling
12328 * options.h (parse_optional_string): Declare.
12329 (struct One_option): Add optional_arg field. Update constructor.
12330 Update call constructor calls. Add takes_optional_argument
12332 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
12333 (DEFINE_optional_string): Define.
12334 (General_options::demangle): Change from DEFINE_bool to
12335 DEFINE_optional_string.
12336 (General_options::no_demangle): New function.
12337 (General_options::do_demangle): New function.
12338 (General_options::set_do_demangle): New function.
12339 (General_options::execstack_status_): Move definition to end of
12341 (General_options::static_): Likewise.
12342 (General_options::do_demangle_): New field.
12343 * object.cc (big_endian>::get_symbol_location_info): Call
12344 Options::do_demangle, not Options::demangle.
12345 * symtab.cc (demangle): Likewise.
12347 2008-03-22 Ian Lance Taylor <iant@google.com>
12349 * gold.h: Include <cstddef> and <sys/types.h>
12350 * options.h: Include <cstring>.
12352 2008-03-21 Ian Lance Taylor <iant@google.com>
12354 * Added source code to GNU binutils.