1 2011-11-10 Doug Kwan <dougkwan@google.com>
4 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
5 when processing data relocs.
6 * reloc.h (Relocate_functions::rel_unaligned): New method.
7 (Relocate_functions::pcrel_unaligned): Ditto.
8 (Relocate_functions::rel32_unaligned): Ditto.
9 (Relocate_functions::pcrel32_unaligned): Ditto.
11 2011-11-09 Doug Kwan <dougkwan@google.com>
14 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
15 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
16 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
17 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
18 (Relocate_functions::rel_unaligned): New.
19 (Relocate_functions::rel32_unaligned): New.
20 * target-reloc.h (relocate_for_relocatable): Add code to handle
21 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
22 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
23 arm_unaligned_reloc_r): New targets.
24 * testsuite/Makefile.in: Regenerate.
25 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
28 2011-11-02 Ian Lance Taylor <iant@google.com>
30 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
32 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
33 * options.cc (General_options::finalize): Use library search path
34 from configure script if specified. If not native and no sysroot,
35 only search TOOLLIBDIR.
36 * options.h (Search_directory::Search_directory): Change name to
38 (General_options::add_to_library_path_with_sysroot): Change arg to
40 * configure, Makefile.in, config.in: Rebuild.
42 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
44 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
45 we are working around the ARM1176 Erratum.
46 * options.h (General_options::fix_arm1176): Add option.
47 * testsuite/Makefile.am: Add testcases, and keep current ones
49 * testsuite/Makefile.in: Regenerate.
50 * testsuite/arm_fix_1176.s: New file.
51 * testsuite/arm_fix_1176.sh: Likewise.
53 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
55 * arm.cc (Target_arm::Target_arm): Remove initialisation of
57 (Target_arm::may_use_blx): Remove method.
58 (Target_arm::set_may_use_blx): Likewise.
59 (Target_arm::may_use_v4t_interworking): New method.
60 (Target_arm::may_use_v5t_interworking): Likewise.
61 (Target_arm::may_use_blx_): Remove member variable.
62 (Arm_relocate_functions::arm_branch_common): Check for v5T
64 (Arm_relocate_functions::thumb_branch_common): Likewise.
65 (Reloc_stub::stub_type_for_reloc): Likewise.
66 (Target_arm::do_finalize_sections): Correct interworking checks.
67 * testsuite/Makefile.am: Add new tests.
68 * testsuite/Makefile.in: Regenerate.
69 * testsuite/arm_farcall_arm_arm.s: New test.
70 * testsuite/arm_farcall_arm_arm.sh: Likewise.
71 * testsuite/arm_farcall_arm_thumb.s: Likewise.
72 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
73 * testsuite/arm_farcall_thumb_arm.s: Likewise.
74 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
75 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
76 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
78 2011-10-31 Cary Coutant <ccoutant@google.com>
81 * expression.cc (Expression::eval_with_dot): Add
82 is_section_dot_assignment parameter.
83 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
84 absolute and assigning to dot within a section.
86 (Output_section_element_assignment::set_section_addresses): Pass
87 dot_section to set_if_absolute.
88 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
89 as is_section_dot_assignment flag to eval_with_dot.
90 (Output_section_element_dot_assignment::set_section_addresses):
92 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
93 parameter. Also set value if relative to dot_section; set the
94 symbol's output_section.
95 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
96 parameter. Adjust all callers.
97 (Expression::eval_maybe_dot): Likewise.
98 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
100 * testsuite/script_test_2.t: Test assignment of an absolute value
101 to dot within an output section element.
103 2011-10-31 Cary Coutant <ccoutant@google.com>
105 * options.h (class General_options): Add --[no-]gnu-unique options.
106 * symtab.cc (Symbol_table::sized_write_globals): Convert
107 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
109 2011-10-31 Cary Coutant <ccoutant@google.com>
112 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
113 unnecessary assertion.
114 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
116 2011-10-31 Sriraman Tallam <tmsriram@google.com>
118 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
120 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
122 Change to just keep the section associated with symbol.
123 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
124 they are externally visible and --export-dynamic is turned on.
125 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
127 2011-10-19 Ian Lance Taylor <iant@google.com>
131 (Output_section_element_dot_assignment::needs_output_section): New
134 2011-10-19 Ian Lance Taylor <iant@google.com>
137 * layout.cc (Layout::segment_precedes): Don't assert failure if a
138 --section-start option was seen.
139 * options.h (General_options::any_section_start): New function.
141 2011-10-18 David S. Miller <davem@davemloft.net>
144 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
145 member to track relocation locations that have moved during TLS
147 (Target_sparc::Relocate::Relocate): Initialize to NULL.
148 (Target_sparc::Relocate::relocate): Adjust view down by 4
149 bytes if it matches reloc_adjust_addr_.
150 (Target_sparc::Relocate::relocate_tls): Always move the
151 __tls_get_addr call delay slot instruction forward 4 bytes when
152 performing relaxation.
154 2011-10-18 Cary Coutant <ccoutant@google.com>
156 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
157 (Output_file::map_no_anonymous): Check for non-zero
158 return code from posix_fallocate.
160 2011-10-17 Cary Coutant <ccoutant@google.com>
163 * plugin.cc (is_visible_from_outside): Check for symbols
164 referenced from dynamic objects.
165 * resolve.cc (Symbol_table::resolve): Don't count references
166 from dynamic objects as references from real ELF files.
167 * testsuite/plugin_test_2.sh: Adjust expected result.
169 2011-10-17 Cary Coutant <ccoutant@google.com>
171 * gold.cc: Include timer.h.
172 (queue_middle_tasks): Stamp time.
173 (queue_final_tasks): Likewise.
174 * main.cc (main): Store timer in parameters. Print timers
176 * parameters.cc (Parameters::Parameters): Initialize timer_.
177 (Parameters::set_timer): New function.
178 (set_parameters_timer): New function.
179 * parameters.h (Parameters::set_timer): New function.
180 (Parameters::timer): New function.
181 (Parameters::timer_): New data member.
182 (set_parameters_timer): New function.
183 * timer.cc (Timer::stamp): New function.
184 (Timer::get_pass_time): New function.
185 * timer.h (Timer::stamp): New function.
186 (Timer::get_pass_time): New function.
187 (Timer::pass_times_): New data member.
189 2011-10-17 Cary Coutant <ccoutant@google.com>
191 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
192 task for members of lib groups.
194 2011-10-17 Cary Coutant <ccoutant@google.com>
197 * fileread.cc (File_read::find_view): Add assert.
198 (File_read::make_view): Move bounds check (replace with assert)...
199 (File_read::find_or_make_view): ... to here.
201 2011-10-12 Cary Coutant <ccoutant@google.com>
203 * output.cc (Output_file::open_base_file): Handle case where
204 ::read returns less than requested size.
206 2011-10-10 Cary Coutant <ccoutant@google.com>
208 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
209 Initialize defined_count_.
210 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
211 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
212 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
213 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
214 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
215 * incremental.h (Sized_relobj_incr::defined_count_): New data
217 (Sized_incr_dynobj::defined_count_): New data member.
218 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
219 Return zeroes instead of internal error.
221 2011-10-10 Cary Coutant <ccoutant@google.com>
224 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
225 (Output_reloc::symbol_value): Return PLT offset if flag is set.
226 * output.h (class Output_reloc): Add use_plt_offset flag.
227 (Output_reloc::type_): Adjust size of bit field.
228 (Output_reloc::use_plt_offset_): New bit field.
229 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
230 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
231 flag. Adjust all callers.
232 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
233 creating RELATIVE relocations.
235 2011-10-10 Nick Clifton <nickc@redhat.com>
237 * po/es.po: Updated Spanish translation.
238 * po/fi.po: Updated Finnish translation.
240 2011-10-03 Diego Novillo <dnovillo@google.com>
242 * options.cc (parse_uint): Fix dereference of RETVAL.
244 2011-09-29 Sriraman Tallam <tmsriram@google.com>
246 * layout.h (section_order_map_): New member.
247 (get_section_order_map): New member function.
248 * output.cc (Output_section::add_input_section): Check for patterns
249 only when --section-ordering-file is specified.
250 * gold.cc (queue_middle_tasks): Delay updating order of sections till
251 output_sections have been formed.
252 * layout.cc (Layout_Layout): Initialize section_order_map_.
253 * plugin.cc (update_section_order): Store order in order_map. Do not
255 * testsuite/Makefile.am: Add test case for plugin_final_layout.
256 * testsuite/Makefile.in: Regenerate.
257 * testsuite/plugin_section_order.c: New file.
258 * testsuite/plugin_final_layout.cc: New file.
259 * testsuite/plugin_final_layout.sh: New file.
261 2011-09-29 Cary Coutant <ccoutant@google.com>
263 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
265 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
266 symbols during incremental update.
267 (Symbol_table::add_from_dynobj): Likewise.
269 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
270 Ian Lance Taylor <iant@google.com>
272 * symtab.cc (Symbol_table::define_special_symbol): Always
273 canonicalize version string.
275 2011-09-26 Cary Coutant <ccoutant@google.com>
277 * gold.cc (queue_initial_tasks): Move option checks ...
278 * options.cc (General_options::finalize): ... to here. Disable
279 some options; make others fatal.
281 2011-09-26 Cary Coutant <ccoutant@google.com>
284 * plugin.cc (get_symbols_v2): New function.
285 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
286 (is_referenced_from_outside): New function.
287 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
288 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
289 (get_symbols): Pass version parameter.
290 (get_symbols_v2): New function.
291 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
293 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
294 (onload): Add LDPT_GET_SYMBOLS_V2.
295 (all_symbols_read_hook): Use get_symbols_v2; check for
296 LDPR_PREVAILING_DEF_IRONLY_EXP.
297 * testsuite/plugin_test_3.sh: Update expected results.
299 2011-09-23 Simon Baldwin <simonb@google.com>
301 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
302 configuration options.
303 * configure: Regenerate.
304 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
305 * Makefile.in: Regenerate.
306 * testsuite/Makefile.in: Regenerate.
308 2011-09-19 Sriraman Tallam <tmsriram@google.com>
310 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
312 2011-09-19 Cary Coutant <ccoutant@google.com>
314 * incremental.cc (can_incremental_update): Fix typo in comment.
315 * incremental.h (can_incremental_update): Likewise.
317 2011-09-18 Cary Coutant <ccoutant@google.com>
319 * incremental.cc (can_incremental_update): New function.
320 * incremental.h (can_incremental_update): New function.
321 * layout.cc (Layout::init_fixed_output_section): Call it.
322 (Layout::make_output_section): Don't allow patch space in .eh_frame.
323 * object.cc (Sized_relobj_file::do_layout): Call
324 can_incremental_update.
326 2011-09-13 Cary Coutant <ccoutant@google.com>
328 * configure.ac: Check for glibc support for gnu_indirect_function
329 support with static linking, setting automake conditional
331 * Makefile.in: Regenerate.
332 * configure: Regenerate.
334 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
335 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
337 * testsuite/Makefile.in: Regenerate.
339 2011-09-13 Cary Coutant <ccoutant@google.com>
341 * incremental.cc (Sized_relobj_incr::do_layout): Call
342 report_comdat_group for kept comdat sections.
343 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
344 * testsuite/Makefile.in: Regenerate.
345 * testsuite/incr_comdat_test_1.cc: New source file.
346 * testsuite/incr_comdat_test_2_v1.cc: New source file.
347 * testsuite/incr_comdat_test_2_v2.cc: New source file.
348 * testsuite/incr_comdat_test_2_v3.cc: New source file.
350 2011-09-13 Ian Lance Taylor <iant@google.com>
352 * object.cc (Sized_relobj_file::do_layout): Remove unused local
353 variable external_symbols_offset.
355 2011-09-12 Ian Lance Taylor <iant@google.com>
357 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
358 triggered if object has no symbols.
360 2011-09-09 David S. Miller <davem@davemloft.net>
362 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
363 (Output_fill_debug_line::do_write): Likewise.
365 2011-08-29 Cary Coutant <ccoutant@google.com>
367 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
368 casts to match formatting specs.
369 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
371 2011-08-26 Cary Coutant <ccoutant@google.com>
373 * layout.cc (Free_list::allocate): Provide guarantee of minimum
374 remaining hole size when allocating.
375 (Layout::make_output_section): Set fill methods for debug sections.
376 * layout.h (Free_list::Free_list_node): Move from private to
378 (Free_list::set_min_hole_size): New function.
379 (Free_list::begin, Free_list::end): New functions.
380 (Free_list::min_hole_): New data member.
381 * output.cc: Include dwarf.h.
382 (Output_fill_debug_info::do_minimum_hole_size): New function.
383 (Output_fill_debug_info::do_write): New function.
384 (Output_fill_debug_line::do_minimum_hole_size): New function.
385 (Output_fill_debug_line::do_write): New function.
386 (Output_section::Output_section): Initialize new data member.
387 (Output_section::set_final_data_size): Ensure patch space is larger
388 than minimum hole size.
389 (Output_section::do_write): Fill holes in debug sections.
390 * output.h (Output_fill): New class.
391 (Output_fill_debug_info): New class.
392 (Output_fill_debug_line): New class.
393 (Output_section::set_free_space_fill): New function.
394 (Output_section::free_space_fill_): New data member.
395 * testsuite/Makefile.am (incremental_test_3): Add
396 --incremental-patch option.
397 (incremental_test_4): Likewise.
398 (incremental_test_5): Likewise.
399 (incremental_test_6): Likewise.
400 (incremental_copy_test): Likewise.
401 (incremental_common_test_1): Likewise.
402 * testsuite/Makefile.in: Regenerate.
404 2011-08-26 Nick Clifton <nickc@redhat.com>
406 * po/es.po: Updated Spanish translation.
408 2011-08-01 Cary Coutant <ccoutant@google.com>
410 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
411 * gold/testsuite/Makefile.in: Regenerate.
412 * gold/testsuite/justsyms_exec.c: New source file.
413 * gold/testsuite/justsyms_lib.c: New source file.
415 2011-08-01 Cary Coutant <ccoutant@google.com>
417 * layout.cc (Layout::set_segment_offsets): Don't realign text
418 segment if -Ttext was specified.
419 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
421 * object.h (Sized_relobj_file::e_type): New function.
422 (Sized_relobj_file::e_type_): New data member.
423 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
424 base address for ET_EXEC files.
425 * target.cc (Target::do_make_elf_object_implementation): Allow
426 ET_EXEC files with --just-symbols option.
428 2011-07-28 Cary Coutant <ccoutant@google.com>
430 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
431 Add thread_number parameter.
432 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
433 * workqueue-threads.cc
434 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
435 current thread if its thread number is greater than desired thread
437 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
438 Add thread_number parameter.
439 (Workqueue::should_cancel_thread): Likewise.
440 (Workqueue::find_runnable_or_wait): Pass thread_number to
441 should_cancel_thread.
442 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
445 2011-07-22 Sriraman Tallam <tmsriram@google.com>
447 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
448 only after checking if it cannot be forced local.
449 * symtab.h (is_externally_visible): Check if the symbol is not forced
452 2011-07-15 Ian Lance Taylor <iant@google.com>
454 * options.h (class General_options): Add --print-output-format.
455 Move -EL next to -EB, for better --help output.
456 * target-select.cc: Include <cstdio>, "options.h", and
458 (Target_selector::do_target_bfd_name): New function.
459 (print_output_format): New function.
460 * target-select.h (class Target_selector): Update declarations.
461 (Target_selector::target_bfd_name): New function.
462 (print_output_format): Declare.
463 * main.cc: Include "target-select.h".
464 (main): Handle --print-output-format.
465 * gold.cc: Include "target-select.h".
466 (queue_initial_tasks): Handle --print-output-format when there are
468 * parameters.cc (parameters_force_valid_target): Give a better
469 error message if -EB/-EL does not match target.
470 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
473 2011-07-15 Ian Lance Taylor <iant@google.com>
475 * i386.cc (class Output_data_plt_i386): Add layout_ field.
476 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
477 (Output_data_plt_i386::do_write): Write address of .dynamic
478 section to first entry in .got.plt section.
479 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
480 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
482 (Output_data_plt_x86_64::do_write): Write address of .dynamic
483 section to first entry in .got.plt section.
484 * layout.h (Layout::dynamic_section): New function.
486 2011-07-13 Sriraman Tallam <tmsriram@google.com>
488 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
490 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
491 input_section_position_, and input_section_glob_.
492 (read_layout_from_file): Call function section_ordering_specified.
493 * layout.h (is_section_ordering_specified): New function.
494 (section_ordering_specified): New function.
495 (section_ordering_specified_): New boolean member.
496 * main.cc(main): Call load_plugins after layout object is defined.
497 * output.cc (Output_section::add_input_section): Use
498 function section_ordering_specified to check if section ordering is
500 * output.cc (Output_section::add_relaxed_input_section): Use
501 function section_ordering_specified to check if section ordering is
503 (Output_section::update_section_layout): New function.
504 (Output_section::sort_attached_input_sections): Check if input section
506 * output.h (Output_section::update_section_layout): New function.
507 * plugin.cc (get_section_count): New function.
508 (get_section_type): New function.
509 (get_section_name): New function.
510 (get_section_contents): New function.
511 (update_section_order): New function.
512 (allow_section_ordering): New function.
513 (Plugin::load): Add the new interfaces to the transfer vector.
514 (Plugin_manager::load_plugins): New parameter.
515 (Plugin_manager::all_symbols_read): New parameter.
516 (Plugin_manager::claim_file): New parameter. Save the elf object for
518 (Plugin_manager::get_elf_object): New function.
519 (Plugin_manager::get_view): Change to directly use the bool to check
520 if get_view is called from claim_file_hook.
521 * plugin.h (input_objects): New function
522 (Plugin__manager::load_plugins): New parameter.
523 (Plugin_manager::claim_file): New parameter.
524 (Plugin_manager::get_elf_object): New function.
525 (Plugin_manager::in_claim_file_handler): New function.
526 (Plugin_manager::in_claim_file_handler_): New member.
527 (layout): New function.
528 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
529 handler with an extra parameter. Make the elf object before calling
531 * testsuite/plugin_test.c (get_section_count): New function pointer.
532 (get_section_type): New function pointer.
533 (get_section_name): New function pointer.
534 (get_section_contents): New function pointer.
535 (update_section_order): New function pointer.
536 (allow_section_ordering): New function pointer.
537 (onload): Check if the new interfaces exist.
539 2011-07-13 Ian Lance Taylor <iant@google.com>
541 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
543 * x86_64.cc (Target_x86_64::got_section): Likewise.
544 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
545 (relro_now_test_SOURCES): New variable.
546 (relro_now_test_DEPENDENCIES): New variable.
547 (relro_now_test_LDFLAGS): New variable.
548 (relro_now_test_LDADD): New variable.
549 (relro_now_test.so): New target.
550 * testsuite/Makefile.in: Rebuild.
552 2011-07-12 Ian Lance Taylor <iant@google.com>
555 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
556 GLOB_DAT relocation rather than a RELATIVE relocation for a
557 protected symbol when creating a shared library.
558 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
559 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
560 * testsuite/protected_main_1.cc (main): Test that protected
561 function has same address.
563 2011-07-11 Ian Lance Taylor <iant@google.com>
566 * options.h (class General_options): Add -Bgroup.
567 * options.cc (General_options::finalize): If -Bgroup is set,
568 default to --unresolved-symbols=report-all.
569 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
570 * target-reloc.h (issue_undefined_symbol_error): Handle
571 --unresolved-symbols=report-all.
573 2011-07-08 Ian Lance Taylor <iant@google.com>
576 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
577 if linker script discards key sections.
578 (Layout::create_dynamic_symtab): Likewise.
579 (Layout::assign_local_dynsym_offsets): Likewise.
580 (Layout::sized_create_version_sections): Likewise.
581 (Layout::create_interp): Likewise.
582 (Layout::finish_dynamic_section): Likewise.
583 (Layout::set_dynamic_symbol_size): Likewise.
585 2011-07-08 Ian Lance Taylor <iant@google.com>
588 * options.h (class General_options): Add --unresolved-symbols.
589 * target-reloc.h (issue_undefined_symbol_error): Check
590 --unresolved-symbols. Add comments.
592 2011-07-08 Ian Lance Taylor <iant@google.com>
594 * testsuite/odr_violation2.cc (Ordering::operator()): Make
595 expression more complex.
597 2011-07-08 Ian Lance Taylor <iant@google.com>
600 * target-reloc.h (issue_undefined_symbol_error): New inline
601 function, broken out of relocate_section.
602 (relocate_section): Call issue_undefined_symbol_error.
603 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
604 there is no TLS segment if we are about to issue an undefined
606 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
608 2011-07-08 Ian Lance Taylor <iant@google.com>
611 * resolve.cc (Symbol_table::should_override): Add fromtype
612 parameter. Change all callers. Give error when linking together
613 TLS and non-TLS symbol.
614 (Symbol_table::should_override_with_special): Add fromtype
615 parameter. Change all callers.
616 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
617 there is no TLS segment if we have reported some errors.
618 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
620 2011-07-08 Ian Lance Taylor <iant@google.com>
623 * target.h (Target::plt_address_for_global): New function.
624 (Target::plt_address_for_local): New function.
625 (Target::plt_section_for_global): Remove.
626 (Target::plt_section_for_local): Remove.
627 (Target::do_plt_address_for_global): New virtual function.
628 (Target::do_plt_address_for_local): New virtual function.
629 (Target::do_plt_section_for_global): Remove.
630 (Target::do_plt_section_for_local): Remove.
631 (Target::register_global_plt_entry): Add Symbol_table and Layout
633 * output.cc (Output_data_got::Got_entry::write): Use
634 plt_address_for_global and plt_address_for_local.
635 * layout.cc (Layout::add_target_dynamic_tags): Use size and
636 address of output section.
637 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
638 got_irelative_, and irelative_count_ fields. Update
640 (Output_data_plt_i386::has_irelative_section): New function.
641 (Output_data_plt_i386::entry_count): Add irelative_count_.
642 (Output_data_plt_i386::set_final_data_size): Likewise.
643 (class Target_i386): Add got_irelative_ and rel_irelative_
644 fields. Update declarations.
645 (Target_i386::Target_i386): Initialize new fields.
646 (Target_i386::do_plt_address_for_global): New function replacing
647 do_plt_section_for_global.
648 (Target_i386::do_plt_address_for_local): New function replacing
649 do_plt_section_for_local.
650 (Target_i386::got_section): Create got_irelative_.
651 (Target_i386::rel_irelative_section): New function.
652 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
653 fields. Don't define __rel_iplt_{start,end}.
654 (Output_data_plt_i386::add_entry): Add symtab and layout
655 parameters. Change all callers. Use different PLT and GOT for
657 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
658 layout parameters. Change all callers. Use different PLT and
660 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
661 (Output_data_plt_i386::rel_irelative): New function.
662 (Output_data_plt_i386::address_for_global): New function.
663 (Output_data_plt_i386::address_for_local): New function.
664 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
665 IRELATIVE GOT when changing IFUNC GOT entries.
666 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
668 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
669 if we didn't create an IRELATIVE GOT.
670 (Target_i386::Relocate::relocate): Use plt_address_for_global and
671 plt_address_for_local.
672 (Target_i386::do_dynsym_value): Use plt_address_for_global.
673 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
674 got_irelative_, and irelative_count_ fields. Update
676 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
677 Initialize new fields. Remove symtab parameter. Change all
679 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
681 (Output_data_plt_x86_64::has_irelative_section): New function.
682 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
683 (class Target_x86_64): Add got_irelative_ and rel_irelative_
684 fields. Update declarations.
685 (Target_x86_64::Target_x86_64): Initialize new fields.
686 (Target_x86_64::do_plt_address_for_global): New function replacing
687 do_plt_section_for_global.
688 (Target_x86_64::do_plt_address_for_local): New function replacing
689 do_plt_section_for_local.
690 (Target_x86_64::got_section): Create got_irelative_.
691 (Target_x86_64::rela_irelative_section): New function.
692 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
693 all callers. Don't create __rel_iplt_{start,end}.
694 (Output_data_plt_x86_64::add_entry): Add symtab and layout
695 parameters. Change all callers. Use different PLT and GOT for
697 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
698 layout parameters. Change all callers. Use different PLT and
700 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
701 parameters. Change all callers. Use different PLT and GOT for
703 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
704 (Output_data_plt_x86_64::rela_irelative): New function.
705 (Output_data_plt_x86_64::address_for_global): New function.
706 (Output_data_plt_x86_64::address_for_local): New function.
707 (Output_data_plt_x86_64::set_final_data_size): Likewise.
708 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
709 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
710 (Target_x86_64::register_global_plt_entry): Add symtab and layout
712 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
714 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
715 symbols if we didn't create an IRELATIVE GOT.
716 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
717 plt_address_for_local.
718 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
719 * testsuite/ifuncvar1.c: New test file.
720 * testsuite/ifuncvar2.c: New test file.
721 * testsuite/ifuncvar3.c: New test file.
722 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
723 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
724 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
725 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
726 * testsuite/Makefile.in: Rebuild.
728 2011-07-07 Cary Coutant <ccoutant@google.com>
730 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
731 (two_file_test_1_ndebug.o): Likewise.
732 (two_file_test_1b_ndebug.o): Likewise.
733 (two_file_test_2_ndebug.o): Likewise.
734 (two_file_test_main_ndebug.o): Likewise.
735 (incremental_test_2): Link with no-debug versions.
737 2011-07-06 Cary Coutant <ccoutant@google.com>
739 * gold/incremental.cc
740 (Output_section_incremental_inputs::write_info_blocks): Check for
741 hidden and internal symbols.
743 2011-07-06 Cary Coutant <ccoutant@google.com>
745 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
746 Check disposition for startup file.
747 (Incremental_inputs::report_command_line): Ignore
748 --incremental-startup-unchanged option.
749 * options.cc (General_options::parse_incremental_startup_unchanged):
751 (General_options::General_options): Initialize new data member.
752 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
753 (General_options): Add --incremental-startup-unchanged option.
754 (General_options::incremental_startup_disposition): New function.
755 (General_options::incremental_startup_disposition_): New data member.
757 2011-07-06 Cary Coutant <ccoutant@google.com>
759 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
760 input file index to Script_info ctor.
761 (Sized_incremental_binary::do_file_has_changed): Find the
762 command-line argument for files named in scripts.
763 * incremental.h (Script_info::Script_info): New ctor
764 with input file index.
765 (Script_info::input_file_index): New function.
766 (Script_info::input_file_index_): New data member.
767 (Incremental_binary::get_library): Add const.
768 (Incremental_binary::get_script_info): Add const.
769 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
770 * testsuite/Makefile.am (incremental_test_5): New test case.
771 (incremental_test_6): New test case.
772 * testsuite/Makefile.in: Regenerate.
774 2011-07-06 Cary Coutant <ccoutant@google.com>
776 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
777 debug output when command lines differ.
779 2011-07-06 Cary Coutant <ccoutant@google.com>
781 * incremental.cc (Incremental_inputs::report_command_line): Ignore
782 --incremental-patch option.
783 * layout.cc (Free_list::allocate): Extend allocation beyond original
785 (Layout::make_output_section): Mark sections that should get
787 * options.cc (parse_percent): New function.
788 * options.h (parse_percent): New function.
789 (DEFINE_percent): New macro.
790 (General_options): Add --incremental-patch option.
791 * output.cc (Output_section::Output_section): Initialize new data
793 (Output_section::add_input_section): Print section name when out
795 (Output_section::add_output_section_data): Likewise.
796 (Output_section::set_final_data_size): Add patch space when
797 doing --incremental-full.
798 (Output_section::do_reset_address_and_file_offset): Remove patch
800 (Output_segment::set_section_list_addresses): Print debug output
801 only if --incremental-update.
802 * output.h (Output_section::set_is_patch_space_allowed): New function.
803 (Output_section::is_patch_space_allowed_): New data member.
804 (Output_section::patch_space_): New data member.
805 * parameters.cc (Parameters::incremental_full): New function.
806 * parameters.h (Parameters::incremental_full): New function
807 * testsuite/Makefile.am (incremental_test_2): Add test for
808 --incremental-patch option.
809 * testsuite/Makefile.in: Regenerate.
810 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
811 (t18): Remove function body.
813 2011-07-05 Doug Kwan <dougkwan@google.com>
816 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
817 Arm_Address type for relocation result.
818 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
820 (Arm_relocate_functions::abs32): Use unaligned access.
821 (Arm_relocate_functions::rel32): Ditto.
822 (Arm_relocate_functions::prel31): Ditto.
823 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
824 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
825 static data relocations.
826 * testsuite/Makefile.in: Regnerate.
827 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
829 2011-07-05 Ian Lance Taylor <iant@google.com>
832 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
833 symbols if necessary.
834 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
836 2011-07-05 Ian Lance Taylor <iant@google.com>
839 * resolve.cc (Symbol::override_base_with_special): Simply override
840 version with special symbol version, ignoring previous version.
842 2011-07-05 Ian Lance Taylor <iant@google.com>
844 * object.cc (Sized_relobj_file::include_section_group): Add
845 information to comment about signature location.
847 2011-07-02 Ian Lance Taylor <iant@google.com>
850 * options.h (class General_options): Add -f and -F.
851 * options.cc (General_options::finalize): Fatal error if -f/-F
852 are used without -shared.
853 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
855 2011-07-02 Ian Lance Taylor <iant@google.com>
857 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
859 2011-07-01 Ian Lance Taylor <iant@google.com>
863 * resolve.cc (Symbol::override_base_with_special): Don't override
864 the version if the overriding symbol has a different name.
865 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
866 all callers. If we give an error about an undefined version,
867 define the base version if necessary.
868 * dynobj.h (class Versions): Update declaration.
869 * testsuite/weak_alias_test_5.cc: New file.
870 * testsuite/weak_alias_test.script: New file.
871 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
872 and versioned_alias have the right value, and call t2.
873 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
874 weak_alias_test_5.so.
875 (weak_alias_test_LDADD): Likewise.
876 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
877 * testsuite/Makefile.in: Rebuild.
879 2011-07-01 Ian Lance Taylor <iant@google.com>
882 * options.h (class General_options): Support -z notext.
883 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
885 (two_file_shared_nonpic.so): Likewise.
886 (two_file_shared_mixed.so): Likewise.
887 (two_file_shared_mixed_1.so): Likewise.
888 (weak_undef_lib_nonpic.so): Likewise.
889 (alt/weak_undef_lib_nonpic.so): Likewise.
890 (tls_test_shared_nonpic.so): Likewise.
891 * testsuite/Makefile.in: Rebuild.
893 2011-07-01 Ian Lance Taylor <iant@google.com>
896 * configure.ac: Test whether static linking works, setting
897 the automake conditional HAVE_STATIC.
898 * testsuite/Makefile.am: Disable tests using -static if
899 HAVE_STATIC is not true.
900 * configure, testsuite/Makefile.in: Rebuild.
902 2011-07-01 Ian Lance Taylor <iant@google.com>
905 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
906 Assert if we see DW_EH_PE_indirect.
907 * target.h (Target::ehframe_datarel_base): New function.
908 (Target::do_ehframe_datarel_base): New target function.
909 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
910 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
913 2011-07-01 Ian Lance Taylor <iant@google.com>
916 * options.h (class General_options): Add
917 --ld-generated-unwind-info.
918 * ehframe.cc (Fde::write): Add address parameter. Change all
919 callers. If associated with PLT, fill in address and size.
920 (Cie::set_output_offset): Only add merge mapping if there is an
922 (Cie::write): Add address parameter. Change all callers.
923 (Eh_frame::add_ehframe_for_plt): New function.
924 * ehframe.h (class Fde): Update declarations. Move shndx_ and
925 input_offset_ fields into union u_, with new plt field.
926 (Fde::Fde): Adjust for new union field.
927 (Fde::Fde) [Output_data version]: New constructor.
928 (Fde::add_mapping): Only add merge mapping if there is an object.
929 (class Cie): Update declarations.
930 (class Eh_frame): Declare add_ehframe_for_plt.
931 * layout.cc (Layout::layout_eh_frame): Break out code into
932 make_eh_frame_section, and call it.
933 (Layout::make_eh_frame_section): New function.
934 (Layout::add_eh_frame_for_plt): New function.
935 * layout.h (class Layout): Update declarations.
936 * merge.cc (Merge_map::add_mapping): Add assertion.
937 * i386.cc: Include "dwarf.h".
938 (class Output_data_plt_i386): Make first_plt_entry,
939 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
940 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
941 and plt_eh_frame_fde.
942 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
943 boundary. Call add_eh_frame_for_plt if appropriate.
944 * x86_64.cc: Include "dwarf.h".
945 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
946 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
947 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
948 and plt_eh_frame_fde.
949 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
952 2011-06-29 Ian Lance Taylor <iant@google.com>
955 * object.cc (Sized_relobj_file::layout_section): Change shdr
956 parameter to be const.
957 (Sized_relobj_file::layout_eh_frame_section): New function, broken
959 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
960 appropriate. Call layout_eh_frame_section.
961 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
963 * object.h (class Sized_relobj_file): Update declarations.
965 2011-06-29 Ian Lance Taylor <iant@google.com>
968 * script.cc (Token::integer_value): Accept trailing M/m/K/k
970 (Lex::gather_token): Accept trailing M/m/K/k for integers.
972 2011-06-29 Ian Lance Taylor <iant@google.com>
975 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
977 * layout.cc (Layout::layout_eh_frame): Likewise.
979 2011-06-29 Ian Lance Taylor <iant@google.com>
982 * layout.cc (Layout::symtab_section_shndx): New function.
983 * layout.h (class Layout): Declare symtab_section_shndx.
984 * output.cc (Output_section::write_header): Call it.
986 2011-06-29 Ian Lance Taylor <iant@google.com>
989 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
990 symbols which are not used in a relocation.
992 2011-06-28 Ian Lance Taylor <iant@google.com>
995 * layout.cc (Layout::segment_precedes): Don't crash if a linker
996 script create indistinguishable segments.
997 (Layout::set_segment_offsets): Use stable_sort when sorting
998 segments. Pass this to Compare_segments constructor.
999 * layout.h (class Layout): Make segment_precedes non-static.
1000 (class Compare_segments): Change from struct to class. Add
1001 layout_ field. Add constructor.
1002 * script-sections.cc
1003 (Script_sections::attach_sections_using_phdrs_clause): Rename
1004 local orphan to is_orphan. Don't report failure to put empty
1005 section in segment. On attachment failure, report name of
1006 section, and attach to first PT_LOAD segment.
1008 2011-06-28 Ian Lance Taylor <iant@google.com>
1011 * target-select.cc (Target_selector::Target_selector): Add
1012 emulation parameter. Change all callers.
1013 (select_target_by_bfd_name): Rename from select_target_by_name.
1015 (select_target_by_emulation): New function.
1016 (supported_emulation_names): New function.
1017 * target-select.h (class Target_selector): Add emulation_ field.
1018 Update declarations.
1019 (Target_selector::recognize_by_bfd_name): Rename from
1020 recognize_by_name. Change all callers.
1021 (Target_selector::supported_bfd_names): Rename from
1022 supported_names. Change all callers.
1023 (Target_selector::recognize_by_emulation): New function.
1024 (Target_selector::supported_emulations): New function.
1025 (Target_selector::emulation): New function.
1026 (Target_selector::do_recognize_by_bfd_name): Rename from
1027 do_recognize_by_name. Change all callers.
1028 (Target_selector::do_supported_bfd_names): Rename from
1029 do_supported_names. Change all callers.
1030 (Target_selector::do_recognize_by_emulation): New function.
1031 (Target_selector::do_supported_emulations): New function.
1032 (select_target_by_bfd_name): Change name in declaration.
1033 (select_target_by_emulation): Declare.
1034 (supported_emulation_names): Declare.
1035 * parameters.cc (parameters_force_valid_target): Try to find
1036 target based on emulation from -m option.
1037 * options.h (class General_options): Change doc string for -m.
1038 * options.cc (help): Print emulations.
1039 (General_options::parse_V): Likewise.
1040 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1041 Add emulation parameter. Change all callers.
1043 2011-06-28 Ian Lance Taylor <iant@google.com>
1045 * target.h (class Target): Add osabi_ field.
1046 (Target::osabi): New function.
1047 (Target::set_osabi): New function.
1048 (Target::Target): Initialize osabi_.
1049 (Target::do_adjust_elf_header): Make pure virtual.
1050 (Sized_target::do_adjust_elf_header): Declare.
1051 * target.cc (Sized_target::do_adjust_elf_header): New function.
1052 (class Sized_target): Instantiate all versions.
1053 * freebsd.h (class Target_freebsd): Remove.
1054 (Target_selector_freebsd::do_recognize): Call set_osabi on
1056 (Target_selector_freebsd::do_recognize_by_name): Likewise.
1057 (Target_selector_freebsd::set_osabi): Remove.
1058 * i386.cc (class Target_i386): Inherit from Sized_target rather
1059 than Target_freebsd.
1060 * x86_64.cc (class Target_x86_64): Likewise.
1062 2011-06-28 Ian Lance Taylor <iant@google.com>
1064 * target.h (Target::can_check_for_function_pointers): Rewrite.
1066 (Target::can_icf_inline_merge_sections): Likewise.
1067 (Target::section_may_have_icf_unsafe_poineters): Likewise.
1068 (Target::Target_info): Add can_icf_inline_merge_sections field.
1069 (Target::do_can_check_for_function_pointers): New virtual
1071 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
1072 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
1073 from can_check_for_function_pointers, move in file.
1074 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
1075 section_may_have_icf_unsafe_poineters, move in file.
1076 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
1077 * i386.cc (Target_i386::do_can_check_for_function_pointers):
1078 Rename from can_check_for_function_pointers, move in file.
1079 (Target_i386::can_icf_inline_merge_sections): Remove.
1080 (Target_i386::i386_info): Initialize
1081 can_icf_inline_merge_sections.
1082 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1083 Initialize can_icf_inline_merge_sections.
1084 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
1085 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
1086 Rename from can_check_for_function_pointers, move in file.
1087 (Target_x86_64::can_icf_inline_merge_sections): Remove.
1088 (Target_x86_64::x86_64_info): Initialize
1089 can_icf_inline_merge_sections.
1090 * testsuite/testfile.cc (Target_test::test_target_info):
1092 * icf.cc (get_section_contents): Correct formatting.
1094 2011-06-27 Ian Lance Taylor <iant@google.com>
1096 * symtab.cc (Symbol::versioned_name): New function.
1097 (Symbol_table::add_to_final_symtab): Use versioned_name when
1099 (Symbol_table::sized_write_symbol): Likewise.
1100 * symtab.h (class Symbol): Declare versioned_name.
1101 * stringpool.h (class Stringpool_template): Add variant of add
1102 which takes a std::basic_string.
1103 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
1104 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
1105 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
1106 (ver_test_12.o): New target.
1107 * testsuite/Makefile.in: Rebuild.
1109 2011-06-27 Doug Kwan <dougkwan@google.com>
1111 * arm.cc (Arm_relocate_functions::thm_jump8,
1112 Arm_relocate_functions::thm_jump11): Use a wider signed
1113 type to compute offset.
1114 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
1116 * testsuite/Makefile.in: Regenerate.
1117 * testsuite/arm_branch_in_range.sh: Check test results of
1118 arm_thm_jump11 and arm_thm_jump8.
1119 * testsuite/arm_thm_jump11.s: New test source file.
1120 * testsuite/arm_thm_jump11.t: New linker script.
1121 * testsuite/arm_thm_jump8.s: New test source file.
1122 * testsuite/arm_thm_jump8.t: New linker script.
1124 2011-06-24 Ian Lance Taylor <iant@google.com>
1126 * layout.cc: Include "object.h".
1127 (ctors_sections_in_init_array): New static variable.
1128 (Layout::is_ctors_in_init_array): New function.
1129 (Layout::layout): Add entry to ctors_sections_in_init_array if
1131 * layout.h (class Layout): Declare is_ctors_in_init_array.
1132 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
1133 is_ctors_reverse_view is set.
1134 (Sized_relobj_file::write_sections): Add layout parameter. Change
1135 all callers. Set is_ctors_reverse_view field of View_size.
1136 (Sized_relobj_file::reverse_words): New function.
1137 * object.h (Sized_relobj_file::View_size): Add
1138 is_ctors_reverse_view field.
1139 (class Sized_relobj_file): Update declarations.
1140 * testsuite/initpri3.c: New test.
1141 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
1143 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
1144 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
1145 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
1146 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
1147 * testsuite/Makefile.in: Rebuild.
1149 2011-06-24 Cary Coutant <ccoutant@google.com>
1151 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
1152 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
1153 (debug_msg_cdebug.err): New targets.
1154 * testsuite/Makefile.in: Regenerate.
1155 * testsuite/debug_msg.sh: Check output of link with compressed debug.
1156 Fix checks for link with shared library.
1158 2011-06-24 Doug Kwan <dougkwan@google.com>
1160 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
1161 skip empty text sections.
1162 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
1164 2011-06-22 Ian Lance Taylor <iant@google.com>
1167 * options.h (class General_options): Add --ctors-in-init-array.
1168 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
1169 friends as SHT_PROGBITS for merging sections.
1170 (Layout::layout): Remove special handling of .init_array and
1171 friends. Don't sort if doing relocatable link. Sort for .ctors
1172 and .dtors if ctors_in_init_array.
1173 (Layout::make_output_section): Force correct section types for
1174 .init_array and friends. Don't sort if doing relocatable link,
1175 Don't sort .ctors and .dtors if ctors_in_init_array.
1176 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
1177 (Layout::output_section_name): Add relobj parameter. Change all
1178 callers. Handle .ctors. and .dtors. in code rather than table.
1179 Handle .ctors and .dtors if ctors_in_init_array.
1180 (Layout::match_file_name): New function, moved from output.cc.
1181 * layout.h (class Layout): Update declarations.
1182 * output.cc: Include "layout.h".
1183 (Input_section_sort_entry::get_priority): New function.
1184 (Input_section_sort_entry::match_file_name): Just call
1185 Layout::match_file_name.
1186 (Output_section::Input_section_sort_init_fini_compare::operator()):
1187 Handle .ctors and .dtors. Sort by explicit priority rather than
1189 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
1190 * testsuite/initpri2.c: New test.
1191 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
1192 (check_PROGRAMS): Add initpri2.
1193 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
1194 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
1195 * configure, testsuite/Makefile.in: Rebuild.
1197 2011-06-19 Ian Lance Taylor <iant@google.com>
1200 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
1201 .interp section to a PT_INTERP segment even if we have seen a
1202 --dynamic-linker option. Don't do it if we have seen a PHDRS
1203 clause in a linker script.
1204 (Layout::finalize): Don't create a .interp section if we've
1205 already create a PT_INTERP segment.
1206 (Layout::create_interp): Always call choose_output_section (revert
1207 patch of 2011-06-17). Don't create PT_INTERP segment.
1208 * script-sections.cc
1209 (Script_sections::create_note_and_tls_segments): Add a .interp
1210 section to a PT_INTERP segment even if we have seen a
1211 --dynamic-linker option.
1213 2011-06-18 Ian Lance Taylor <iant@google.com>
1215 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
1216 merely because a non-PT_LOAD segment has a dynamic reloc.
1218 2011-06-18 Ian Lance Taylor <iant@google.com>
1220 * layout.cc (Layout::finish_dynamic_section): Don't create
1221 DT_FLAGS entry if not needed.
1223 2011-06-18 Ian Lance Taylor <iant@google.com>
1226 * layout.cc (Layout::layout_eh_frame): Correct handling of
1227 writable .eh_frame section.
1229 2011-06-17 Ian Lance Taylor <iant@google.com>
1232 * resolve.cc (Symbol_table::resolve): Don't give an error if a
1233 symbol is redefined with the exact same object and value.
1235 2011-06-17 Ian Lance Taylor <iant@google.com>
1238 * layout.h (class Layout): Add interp_segment_ field.
1239 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
1240 (Layout::attach_allocated_section_to_segment): If making shared
1241 library, put .interp section in PT_INTERP segment.
1242 (Layout::finalize): Also call create_interp if -dynamic-linker
1244 (Layout::create_interp): Assert that there is no PT_INTERP
1245 segment. If not using a SECTIONS clause, use make_output_section.
1246 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
1247 * script-sections.cc
1248 (Script_sections::create_note_and_tls_segments): If making shared
1249 library, put .interp section in PT_INTERP segment.
1251 2011-06-17 Ian Lance Taylor <iant@google.com>
1253 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
1254 when making a shared library.
1256 2011-06-17 Ian Lance Taylor <iant@google.com>
1258 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
1259 parameter. Change all callers. Don't issue warning about PC32
1260 against locally defined symbol.
1262 2011-06-16 Ian Lance Taylor <iant@google.com>
1264 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
1265 occurs in same object.
1267 2011-06-14 Alan Modra <amodra@gmail.com>
1269 * po/POTFILES.in: Regenerate.
1271 2011-06-09 Ian Lance Taylor <iant@google.com>
1273 * script-sections.cc
1274 (Orphan_output_section::set_section_addresses): For a relocatable
1275 link set address to 0.
1277 2011-06-09 Cary Coutant <ccoutant@google.com>
1280 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
1281 used with --compress-debug-sections.
1282 * gold/object.cc (Sized_relobj_file::do_layout): Report
1283 uncompressed size of compressed input sections.
1285 2011-06-08 Cary Coutant <ccoutant@google.com>
1288 * testsuite/two_file_test_2_v1.cc: Change initialization of
1289 v2 to keep it in .data.
1291 2011-06-07 Cary Coutant <ccoutant@google.com>
1293 * common.cc (Symbol_table::do_allocate_commons_list): Call
1295 * errors.cc (Errors::fatal): Adjust call to gold_exit.
1296 (Errors::fallback): New function.
1297 (gold_fallback): New function.
1298 * errors.h (Errors::fallback): New function.
1299 * gold.cc (gold_exit): Change status parameter to enum; adjust
1301 (queue_initial_tasks): Call gold_fallback.
1302 * gold.h: Include cstdlib.
1303 (Exit_status): New enum type.
1304 (gold_exit): Change status parameter to enum.
1305 (gold_fallback): New function.
1306 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
1307 (Layout::create_symtab_sections): Likewise.
1308 (Layout::create_shdrs): Likewise.
1309 * main.cc (main): Adjust call to gold_exit.
1310 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
1311 (Output_data_got::add_got_entry_pair): Likewise.
1312 (Output_section::add_input_section): Likewise.
1313 (Output_section::add_output_section_data): Likewise.
1314 (Output_segment::set_section_list_addresses): Likewise.
1315 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
1317 2011-06-07 Cary Coutant <ccoutant@google.com>
1319 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
1320 for incremental links.
1321 * output.cc (Output_segment::set_section_list_addresses): Remove
1322 FIXME and test for TLS or BSS.
1324 2011-06-07 Cary Coutant <ccoutant@google.com>
1326 * testsuite/Makefile.am: Add incremental_copy_test,
1327 incremental_common_test_1.
1328 * testsuite/Makefile.in: Regenerate.
1329 * testsuite/common_test_1_v1.c: New source file.
1330 * testsuite/common_test_1_v2.c: New source file.
1331 * testsuite/copy_test_v1.cc: New source file.
1333 2011-06-07 Cary Coutant <ccoutant@google.com>
1335 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
1336 update, allocate common from bss section's free list.
1337 * incremental-dump.cc (dump_incremental_inputs): Print flag for
1338 linker-defined symbols.
1339 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1340 Skip GOT and PLT entries that are no longer referenced.
1341 (Output_section_incremental_inputs::write_info_blocks): Mark
1342 linker-defined symbols.
1343 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
1344 * output.cc (Output_section::allocate): New function.
1345 * output.h (Output_section::allocate): New function.
1346 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
1347 linker-defined symbols.
1348 (Symbol::override_base_with_special): Copy is_predefined_ flag.
1349 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
1350 (Symbol::init_base_output_data): Likewise.
1351 (Symbol::init_base_output_segment): Likewise.
1352 (Symbol::init_base_constant): Likewise.
1353 (Sized_symbol::init_output_data): Likewise.
1354 (Sized_symbol::init_output_segment): Likewise.
1355 (Sized_symbol::init_constant): Likewise.
1356 (Symbol_table::do_define_in_output_data): Likewise.
1357 (Symbol_table::do_define_in_output_segment): Likewise.
1358 (Symbol_table::do_define_as_constant): Likewise.
1359 * symtab.h (Symbol::is_predefined): New function.
1360 (Symbol::init_base_output_data): Add is_predefined parameter.
1361 (Symbol::init_base_output_segment): Likewise.
1362 (Symbol::init_base_constant): Likewise.
1363 (Symbol::is_predefined_): New data member.
1364 (Sized_symbol::init_output_data): Add is_predefined parameter.
1365 (Sized_symbol::init_output_segment): Likewise.
1366 (Sized_symbol::init_constant): Likewise.
1367 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
1369 2011-06-07 Cary Coutant <ccoutant@google.com>
1371 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
1372 instead of emit_copy_reloc.
1373 (Copy_relocs::emit_copy_reloc): Refactor.
1374 (Copy_relocs::make_copy_reloc): New function.
1375 (Copy_relocs::add_copy_reloc): Remove.
1376 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
1378 (Copy_relocs::make_copy_reloc): New function.
1379 (Copy_relocs::add_copy_reloc): Remove.
1380 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
1381 unchanged input files.
1382 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
1383 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
1384 Reserve BSS space for COPY relocations.
1385 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1386 (Output_section_incremental_inputs::write_info_blocks): Record
1387 whether a symbol is copied from a shared object.
1388 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
1389 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
1390 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
1391 (Incremental_input_entry_reader::get_output_symbol_index): Add
1393 (Incremental_binary::emit_copy_relocs): New function.
1394 (Incremental_binary::do_emit_copy_relocs): New function.
1395 (Sized_incremental_binary::Sized_incremental_binary): Initialize
1397 (Sized_incremental_binary::add_copy_reloc): New function.
1398 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1399 (Sized_incremental_binary::Copy_reloc): New struct.
1400 (Sized_incremental_binary::Copy_relocs): New typedef.
1401 (Sized_incremental_binary::copy_relocs_): New data member.
1402 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
1403 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
1404 * target.h (Sized_target::emit_copy_reloc): New function.
1405 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
1407 2011-06-02 Cary Coutant <ccoutant@google.com>
1410 * gold/archive.cc (Archive::Archive): Initialize new data member.
1411 (Archive::include_all_members): Return if archive has already been
1413 * gold/archive.h (Archive::include_all_members_): New data member.
1415 2011-06-02 Nick Clifton <nickc@redhat.com>
1417 * dynobj.h: Fix spelling mistake in comment.
1418 * output.cc: Likewise.
1420 2011-05-31 Doug Kwan <dougkwan@google.com>
1424 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
1425 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
1426 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
1427 redundant arm_exidx_test.so.
1428 * testsuite/Makefile.in: Regenerate.
1429 (check_SCRIPTS): Add pr12826.sh
1430 (check_DATA): Add pr12826.stdout
1431 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
1432 * testsuite/pr12826.sh: New file.
1433 * testsuite/pr12826_1.s: Ditto.
1434 * testsuite/pr12826_1.s: Ditto.
1436 2011-05-30 Ian Lance Taylor <iant@google.com>
1438 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
1441 2011-05-29 Ian Lance Taylor <iant@google.com>
1444 * testsuite/Makefile.am: Use different file name for two_file_test
1445 temporary file for each incremental test.
1446 * testsuite/Makefile.in: Rebuild.
1448 2011-05-29 Ian Lance Taylor <iant@google.com>
1450 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
1451 binary input file is empty.
1453 2011-05-27 Ian Lance Taylor <iant@google.com>
1455 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
1456 (ver_test_9.so): Likewise.
1457 * testsuite/Makefile.in: Rebuild.
1459 2011-05-26 Cary Coutant <ccoutant@google.com>
1461 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
1462 * incremental.cc (Incremental_inputs::report_input_section): Fix
1463 comment, indentation.
1464 (Incremental_inputs::report_comdat_group): New function.
1465 (Output_section_incremental_inputs::set_final_data_size): Adjust size
1466 of data for incremental input file entry.
1467 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
1468 group count, COMDAT group signatures.
1469 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
1470 an unchanged input file.
1471 * incremental.h (Incremental_object_entry::Incremental_object_entry):
1472 Initialize new data member.
1473 (Incremental_object_entry::add_comdat_group): New function.
1474 (Incremental_object_entry::get_comdat_group_count): New function.
1475 (Incremental_object_entry::get_comdat_signature_key): New function.
1476 (Incremental_object_entry::groups_): New data member.
1477 (Incremental_inputs::report_comdat_group): New function.
1478 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
1479 data for incremental input file entry.
1480 (Incremental_input_entry_reader::get_comdat_group_count): New function.
1481 (Incremental_input_entry_reader::get_input_section): Adjust size of
1482 data for incremental input file entry.
1483 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
1484 (Incremental_input_entry_reader::get_comdat_group_signature): New
1486 * object.cc (Sized_relobj::include_section_group): Report kept
1487 COMDAT groups for incremental links.
1489 2011-05-24 David Meyer <pdox@google.com>
1491 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
1492 with name parameter. Add found_name parameter.
1493 * fileread.cc (Input_file::find_file): Adjust code accordingly.
1494 * dirsearch.h (class Dirsearch): Update declaration.
1496 2011-05-24 Ian Lance Taylor <iant@google.com>
1498 * archive.cc (Library_base::should_include_member): Pull in object
1499 from archive if it defines the entry symbol.
1500 * parameters.cc (Parameters::entry): New function.
1501 * parameters.h (class Parameters): Declare entry.
1502 * output.h (class Output_file_header): Remove entry_ field.
1503 * output.cc (Output_file_header::Output_file_header): Remove entry
1504 parameter. Change all callers.
1505 (Output_file_header::entry): Use parameters->entry.
1506 * gold.cc (queue_middle_tasks): Likewise.
1507 * plugin.cc (Plugin_hook::run): Likewise.
1509 2011-05-24 Cary Coutant <ccoutant@google.com>
1511 * gold.cc (queue_initial_tasks): Pass incremental base filename
1512 to Output_file::open_base_file; don't print error message.
1513 * incremental-dump.cc (main): Adjust call to
1514 Output_file::open_for_modification.
1515 * incremental-dump.cc (main): Likewise.
1516 * incremental.cc (Incremental_inputs::report_command_line):
1517 Ignore --incremental-base option when comparing command lines.
1518 Ignore parameter when given as separate argument.
1519 * options.h (class General_options): Add --incremental-base.
1520 * output.cc (Output_file::Output_file):
1521 (Output_file::open_base_file): Add base_name and writable parameters;
1522 read base file into new file; print error message here.
1523 (Output_file::map_no_anonymous): Add writable parameter; adjust all
1525 * output.h (Output_file::open_for_modification): Rename to...
1526 (Output_file::open_base_file): ...this; add base_name and
1527 writable parameters; adjust all callers.
1528 (Output_file::map_no_anonymous): Add writable parameter; adjust all
1530 * testsuite/Makefile.am (incremental_test_4): Test
1532 * testsuite/Makefile.in: Regenerate.
1534 2011-05-24 Cary Coutant <ccoutant@google.com>
1536 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
1538 * testsuite/Makefile.in: Regenerate.
1539 * testsuite/two_file_test_1_v1.cc: New test source file.
1540 * testsuite/two_file_test_1b_v1.cc: New test source file.
1541 * testsuite/two_file_test_2_v1.cc: New test source file.
1543 2011-05-24 Cary Coutant <ccoutant@google.com>
1545 * dynobj.h (Dynobj::do_dynobj): New function.
1546 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
1547 flag and soname for shared objects.
1548 * incremental.cc (Incremental_inputs::report_object): Make
1549 either Incremental_object_entry or Incremental_dynobj_entry; add
1550 soname to string table.
1551 (Incremental_inputs::report_input_section): Add assertion.
1552 (Output_section_incremental_inputs::set_final_data_size): Adjust
1553 type of input file entry for shared libraries; adjust size of
1554 shared library info entry.
1555 (Output_section_incremental_inputs::write_input_files): Write
1556 as_needed flag for shared libraries.
1557 (Output_section_incremental_inputs::write_info_blocks): Adjust type
1558 of input file entry for shared libraries; write soname.
1559 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
1560 soname from incremental info.
1561 * incremental.h (enum Incremental_input_flags): Add
1562 INCREMENTAL_INPUT_AS_NEEDED.
1563 (Incremental_input_entry::Incremental_input_entry): Initialize new
1565 (Incremental_input_entry::set_as_needed): New function.
1566 (Incremental_input_entry::as_needed): New function.
1567 (Incremental_input_entry::do_dynobj_entry): New function.
1568 (Incremental_input_entry::as_needed_): New data member.
1569 (Incremental_object_entry::Incremental_object_entry): Don't check
1571 (Incremental_object_entry::do_type): Likewise.
1572 (class Incremental_dynobj_entry): New class.
1573 (Incremental_input_entry_reader::as_needed): New function.
1574 (Incremental_input_entry_reader::get_soname): New function.
1575 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
1576 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
1577 size of shared library info entry.
1578 * layout.cc (Layout::finish_dynamic_section): Don't test for
1579 incremental link when adding DT_NEEDED entries.
1580 * object.h (Object::Object): Initialize new data member.
1581 (Object::dynobj): New function.
1582 (Object::set_as_needed): New function.
1583 (Object::as_needed): New function.
1584 (Object::do_dynobj): New function.
1585 (Object::as_needed_): New data member.
1587 2011-05-24 Cary Coutant <ccoutant@google.com>
1589 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
1590 info; adjust display of GOT entries.
1591 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1592 vector of input objects; remove file_status_.
1593 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
1594 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
1595 got_plt reader; call target hooks to reserve GOT entries.
1596 (Output_section_incremental_inputs::set_final_data_size): Adjust size
1597 of input file info header and GOT info entry.
1598 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
1600 (Got_plt_view_info::got_descriptor): Remove.
1601 (Got_plt_view_info::sym_index): New data member.
1602 (Got_plt_view_info::input_index): New data member.
1603 (Local_got_offset_visitor::visit): Write input file index.
1604 (Global_got_offset_visitor::visit): Write 0 for input file index.
1605 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
1606 with sym_index and input_index.
1607 (Output_section_incremental_inputs::write_got_plt): Adjust size of
1608 incremental info GOT entry; replace got_descriptor with input_index.
1609 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
1610 map from input file index to object.
1611 (Sized_relobj_incr::do_layout): Replace direct data member reference
1612 with accessor function.
1613 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
1614 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
1615 Adjust size of input file info header.
1616 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
1617 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
1618 (Incremental_input_entry_reader::get_input_section): Adjust size of
1619 input file info header.
1620 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
1621 of incremental info GOT entry.
1622 (Incremental_got_plt_reader::get_got_desc): Remove.
1623 (Incremental_got_plt_reader::get_got_symndx): New function.
1624 (Incremental_got_plt_reader::get_got_input_index): New function.
1625 (Sized_incremental_binary::Sized_incremental_binary): Remove
1626 file_status_; add input_objects_.
1627 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
1628 (Sized_incremental_binary::set_file_is_unchanged): Remove.
1629 (Sized_incremental_binary::file_is_unchanged): Remove.
1630 (Sized_incremental_binary::set_input_object): New function.
1631 (Sized_incremental_binary::input_object): New function.
1632 (Sized_incremental_binary::file_status_): Remove.
1633 (Sized_incremental_binary::input_objects_): New data member.
1634 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
1636 (Sized_relobj_incr::invalid_address): Move to base class.
1637 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
1639 (Sized_relobj_incr::do_output_section_offset): Likewise.
1640 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
1641 (Sized_relobj_incr::section_offsets_): Likewise.
1642 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
1644 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
1645 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
1646 with accessor function.
1647 (Sized_relobj_file::do_layout): Likewise.
1648 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
1649 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
1650 (Sized_relobj_file::compute_final_local_value): Replace refs to
1651 section_offsets_ with accessor function.
1652 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
1653 * object.h (Relobj::Relobj): Initialize new data members.
1654 (Relobj::add_dyn_reloc): New function.
1655 (Relobj::first_dyn_reloc): New function.
1656 (Relobj::dyn_reloc_count): New function.
1657 (Relobj::first_dyn_reloc_): New data member.
1658 (Relobj::dyn_reloc_count_): New data member.
1659 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
1661 (Sized_relobj::Address): New typedef.
1662 (Sized_relobj::invalid_address): Move here from child class.
1663 (Sized_relobj::Sized_relobj): Initialize new data members.
1664 (Sized_relobj::sized_relobj): New function.
1665 (Sized_relobj::is_output_section_offset_invalid): Move here from
1667 (Sized_relobj::get_output_section_offset): Likewise.
1668 (Sized_relobj::local_has_got_offset): Likewise.
1669 (Sized_relobj::local_got_offset): Likewise.
1670 (Sized_relobj::set_local_got_offset): Likewise.
1671 (Sized_relobj::do_for_all_local_got_entries): Likewise.
1672 (Sized_relobj::clear_got_offsets): New function.
1673 (Sized_relobj::section_offsets): Move here from child class.
1674 (Sized_relobj::do_output_section_offset): Likewise.
1675 (Sized_relobj::do_set_section_offset): Likewise.
1676 (Sized_relobj::Local_got_offsets): Likewise.
1677 (Sized_relobj::local_got_offsets_): Likewise.
1678 (Sized_relobj::section_offsets_): Likewise.
1679 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
1681 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
1683 (Sized_relobj_file::sized_relobj): New function
1684 (Sized_relobj_file::local_has_got_offset): Move to base class.
1685 (Sized_relobj_file::local_got_offset): Likewise.
1686 (Sized_relobj_file::set_local_got_offset): Likewise.
1687 (Sized_relobj_file::get_output_section_offset): Likewise.
1688 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
1689 (Sized_relobj_file::do_output_section_offset): Likewise.
1690 (Sized_relobj_file::do_set_section_offset): Likewise.
1691 (Sized_relobj_file::Local_got_offsets): Likewise.
1692 (Sized_relobj_file::local_got_offsets_): Likewise.
1693 (Sized_relobj_file::section_offsets_): Likewise.
1694 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
1696 (set_needs_dynsym_index): Convert relobj to derived class pointer.
1697 (Output_reloc::get_symbol_index): Likewise.
1698 (Output_reloc::local_section_offset): Likewise.
1699 (Output_reloc::get_address): Likewise.
1700 (Output_reloc::symbol_value): Likewise.
1701 (Output_data_got::reserve_slot): Move to class definition.
1702 (Output_data_got::reserve_local): New function.
1703 (Output_data_got::reserve_slot_for_global): Remove.
1704 (Output_data_got::reserve_global): New function.
1705 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
1706 (all constructors, two instantiations).
1707 (Output_reloc::get_relobj): New function (two instantiations).
1708 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
1709 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
1710 (Output_data_reloc::add_global): Adjust type of relobj.
1711 (Output_data_reloc::add_global_relative): Likewise.
1712 (Output_data_reloc::add_symbolless_global_addend): Likewise.
1713 (Output_data_reloc::add_local): Likewise.
1714 (Output_data_reloc::add_local_relative): Likewise.
1715 (Output_data_reloc::add_symbolless_local_addend): Likewise.
1716 (Output_data_reloc::add_local_section): Likewise.
1717 (Output_data_reloc::add_output_section): Likewise.
1718 (Output_data_reloc::add_absolute): Likewise.
1719 (Output_data_reloc::add_target_specific): Likewise.
1720 (Output_data_got::reserve_slot): Move definition here.
1721 (Output_data_got::reserve_local): New function.
1722 (Output_data_got::reserve_global): New function.
1723 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
1724 section_offsets_ with accessor function.
1725 (Sized_relobj_file::write_sections): Likewise.
1726 (Sized_relobj_file::do_relocate_sections): Likewise.
1727 * target.h (Sized_target::reserve_local_got_entry): New function.
1728 (Sized_target::reserve_global_got_entry): New function.
1729 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
1730 (Target_x86_64::reserve_global_got_entry): New function.
1731 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
1733 2011-05-23 Cary Coutant <ccoutant@google.com>
1735 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
1736 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
1737 bit when checking got_type.
1738 * incremental.cc (Sized_incremental_binary::setup_readers):
1739 Store symbol table and string table locations; initialize bit vector
1740 of file status flags.
1741 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
1743 (Sized_incremental_binary::do_process_got_plt): New function.
1744 (Sized_incremental_binary::get_symtab_view): Use stored locations.
1745 (Output_section_incremental_inputs::set_final_data_size): Record
1746 file index for each input file.
1747 (Output_section_incremental_inputs::write_got_plt): Store file index
1748 instead of input entry offset for each GOT entry.
1750 (Incremental_input_entry::Incremental_input_entry): Initialize new
1752 (Incremental_input_entry::set_offset): Store file index.
1753 (Incremental_input_entry::get_file_index): New function.
1754 (Incremental_input_entry::file_index_): New data member.
1755 (Incremental_binary::process_got_plt): New function.
1756 (Incremental_binary::do_process_got_plt): New function.
1757 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1759 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
1760 (Sized_incremental_binary::set_file_is_unchanged): New function.
1761 (Sized_incremental_binary::file_is_unchanged): New function.
1762 (Sized_incremental_binary::do_process_got_plt): New function.
1763 (Sized_incremental_binary::file_status_): New data member.
1764 (Sized_incremental_binary::main_symtab_loc_): New data member.
1765 (Sized_incremental_binary::main_strtab_loc_): New data member.
1766 * output.cc (Output_data_got::Got_entry::write): Add case
1768 (Output_data_got::add_global): Call add_got_entry.
1769 (Output_data_got::add_global_plt): Likewise.
1770 (Output_data_got::add_global_with_rel): Likewise.
1771 (Output_data_got::add_global_with_rela): Likewise.
1772 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
1773 (Output_data_got::add_global_pair_with_rela): Likewise.
1774 (Output_data_got::add_local): Call add_got_entry.
1775 (Output_data_got::add_local_plt): Likewise.
1776 (Output_data_got::add_local_with_rel): Likewise.
1777 (Output_data_got::add_local_with_rela): Likewise.
1778 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
1779 (Output_data_got::add_local_pair_with_rela): Likewise.
1780 (Output_data_got::reserve_slot): New function.
1781 (Output_data_got::reserve_slot_for_global): New function.
1782 (Output_data_got::add_got_entry): New function.
1783 (Output_data_got::add_got_entry_pair): New function.
1784 (Output_section::add_output_section_data): Edit FIXME.
1786 (Output_section_data_build::Output_section_data_build): New
1787 constructor with size parameter.
1788 (Output_data_space::Output_data_space): Likewise.
1789 (Output_data_got::Output_data_got): Initialize new data member; new
1790 constructor with size parameter.
1791 (Output_data_got::add_constant): Call add_got_entry.
1792 (Output_data_got::reserve_slot): New function.
1793 (Output_data_got::reserve_slot_for_global): New function.
1794 (class Output_data_got::Got_entry): Add RESERVED_CODE.
1795 (Output_data_got::add_got_entry): New function.
1796 (Output_data_got::add_got_entry_pair): New function.
1797 (Output_data_got::free_list_): New data member.
1798 * target.h (Sized_target::init_got_plt_for_update): New function.
1799 (Sized_target::register_global_plt_entry): New function.
1800 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1801 Initialize new data member; call init; add constructor with PLT count.
1802 (Output_data_plt_x86_64::init): New function.
1803 (Output_data_plt_x86_64::add_relocation): New function.
1804 (Output_data_plt_x86_64::reserve_slot): New function.
1805 (Output_data_plt_x86_64::free_list_): New data member.
1806 (Target_x86_64::init_got_plt_for_update): New function.
1807 (Target_x86_64::register_global_plt_entry): New function.
1808 (Output_data_plt_x86_64::add_entry): Allocate from free list for
1809 incremental updates.
1810 (Output_data_plt_x86_64::add_relocation): New function.
1811 * testsuite/object_unittest.cc (Object_test): Set default options.
1813 2011-05-16 Ian Lance Taylor <iant@google.com>
1815 * options.h (class General_options): Make -i a synonym for -r.
1817 2011-05-16 Ian Lance Taylor <iant@google.com>
1819 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
1821 2011-05-10 Cary Coutant <ccoutant@google.com>
1823 * object.cc (Sized_relobj::do_count_local_symbols): Check for
1826 2011-05-06 Ian Lance Taylor <iant@google.com>
1828 * layout.cc (Layout::layout): If the output section flags change,
1829 update the ordering.
1831 2011-04-25 Cary Coutant <ccoutant@google.com>
1833 * incremental-dump.cc (dump_incremental_inputs): Print local
1834 symbol info for each input file.
1836 (Output_section_incremental_inputs::set_final_data_size): Add local
1837 symbol info to input file entries in incremental info.
1838 (Output_section_incremental_inputs::write_info_blocks): Likewise.
1839 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
1840 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
1841 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
1843 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
1844 (Sized_incr_relobj::do_relocate): Write the local symbols.
1845 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
1846 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
1847 Adjust size of input file header.
1848 (Incremental_inputs_reader::get_local_symbol_offset): New function.
1849 (Incremental_inputs_reader::get_local_symbol_count): New function.
1850 (Incremental_inputs_reader::get_input_section): Adjust size of input
1852 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
1853 (Sized_incr_relobj::This): New typedef.
1854 (Sized_incr_relobj::sym_size): New const data member.
1855 (Sized_incr_relobj::Local_symbol): New struct.
1856 (Sized_incr_relobj::do_output_local_symbol_count): New function.
1857 (Sized_incr_relobj::do_local_symbol_offset): New function.
1858 (Sized_incr_relobj::local_symbol_count_): New data member.
1859 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
1860 (Sized_incr_relobj::local_symbol_index_): New data member.
1861 (Sized_incr_relobj::local_symbol_offset_): New data member.
1862 (Sized_incr_relobj::local_dynsym_offset_): New data member.
1863 (Sized_incr_relobj::local_symbols_): New data member.
1864 * object.h (Relobj::output_local_symbol_count): New function.
1865 (Relobj::local_symbol_offset): New function.
1866 (Relobj::do_output_local_symbol_count): New function.
1867 (Relobj::do_local_symbol_offset): New function.
1868 (Sized_relobj::do_output_local_symbol_count): New function.
1869 (Sized_relobj::do_local_symbol_offset): New function.
1871 2011-04-22 Vladimir Simonov <sv@sw.ru>
1873 * descriptors.cc (set_close_on_exec): New function.
1874 (Descriptors::open): Use set_close_on_exec.
1875 * output.cc (S_ISLNK): Define if not defined.
1877 2011-04-22 Cary Coutant <ccoutant@google.com>
1879 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1881 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1882 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
1883 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
1885 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
1886 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
1887 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
1889 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
1891 (Incremental_binary::apply_incremental_relocs): New function.
1892 (Incremental_binary::do_apply_incremental_relocs): New function.
1893 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1895 (Sized_incremental_binary::add_global_symbol): New function.
1896 (Sized_incremental_binary::global_symbol): New function.
1897 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1898 (Sized_incremental_binary::symbol_map_): New data member.
1899 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
1900 * target.h (Sized_target::apply_relocation): New function.
1901 * target-reloc.h (apply_relocation): New function.
1902 * x86_64.cc (Target_x86_64::apply_relocation): New function.
1904 2011-04-22 Doug Kwan <dougkwan@google.com>
1906 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
1907 flag of a SHT_ARM_EXIDX section.
1908 * testsuite/Makefile.am (arm_exidx_test): New test rules.
1909 * testsuite/Makefile.in: Regenerate.
1910 * testsuite/arm_exidx_test.s: New file.
1911 * testsuite/arm_exidx_test.sh: Same.
1913 2011-04-20 Cary Coutant <ccoutant@google.com>
1916 * archive.h (Incremental_archive_entry::Archive_member):
1917 Initialize arg_serial_ (second constructor).
1919 2011-04-17 Ian Lance Taylor <iant@google.com>
1921 * object.cc (Relocate_info::location): Simplify location string.
1922 * errors.cc (Errors::error_at_location): Don't print program
1924 (Errors::warning_at_location): Likewise.
1925 (Errors::undefined_symbol): Likewise.
1926 * testsuite/debug_msg.sh: Update accordingly.
1928 2011-04-14 Cary Coutant <ccoutant@google.com>
1930 * gold/layout.cc (Layout::symtab_section_offset): New function.
1931 * gold/layout.h (Layout::symtab_section_offset): New function.
1932 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
1934 2011-04-12 Ian Lance Taylor <iant@google.com>
1936 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
1937 with MREMAP_MAYMOVE.
1938 * output.h (class Output_file): Add map_is_allocated_ field.
1939 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
1940 not available, provide stubs. If mremap is not available, #define
1942 (MREMAP_MAYMOVE): Define if not defined.
1943 (Output_file::Output_file): Initialize map_is_allocated_.
1944 (Output_file::resize): Check map_is_allocated_.
1945 (Output_file::map_anonymous): If mmap fails, use malloc.
1946 (Output_file::unmap): Don't do anything for an anonymous map.
1947 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
1948 is not available, provide stubs.
1949 (File_read::View::~View): Use free rather than delete[].
1950 (File_read::make_view): Use malloc rather than new[]. If mmap
1952 (File_read::find_or_make_view): Use malloc rather than new[].
1953 * gold.h: Remove HAVE_REMAP code.
1954 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
1955 exists. Rename mremap to gold_mremap. If mmap is not available
1957 * configure, config.in: Rebuild.
1959 2011-04-11 Ian Lance Taylor <iant@google.com>
1961 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
1962 initialize local variable v.
1964 2011-04-11 Cary Coutant <ccoutant@google.com>
1966 * archive.cc (Archive::include_member): Adjust call to
1968 (Add_archive_symbols::run): Track argument serial numbers.
1969 (Lib_group::include_member): Likewise.
1970 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
1971 * archive.h (Incremental_archive_entry::Archive_member):
1972 Initialize arg_serial_.
1973 (Archive_member::arg_serial_): New data member.
1974 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
1975 (Sized_dynobj::do_add_symbols): Track symbols when doing an
1977 (Sized_dynobj::do_for_all_local_got_entries): New function.
1978 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
1980 * fileread.cc (get_mtime): New function.
1981 * fileread.h (get_mtime): New function.
1982 * gold.cc (queue_initial_tasks): Check for incremental update.
1983 (process_incremental_input): New function.
1984 (queue_middle_tasks): Don't force valid target for incremental
1986 * incremental-dump.cc (find_input_containing_global): Adjust
1987 size of symbol info entry.
1988 (dump_incremental_inputs): Dump argument serial number and
1989 in_system_directory flag; bias shndx by 1; print symbol names
1990 when dumping per-file symbol lists; use new symbol info readers.
1992 (Output_section_incremental_inputs:update_data_size): New function.
1993 (Sized_incremental_binary::setup_readers): Setup input readers
1994 for each input file; build maps for files added from libraries
1996 (Sized_incremental_binary::check_input_args): New function.
1997 (Sized_incremental_binary::do_check_inputs): Build map of argument
1998 serial numbers to input arguments.
1999 (Sized_incremental_binary::do_file_has_changed): Rename
2000 do_file_is_unchanged to this; compare file modification times.
2001 (Sized_incremental_binary::do_init_layout): New function.
2002 (Sized_incremental_binary::do_reserve_layout): New function.
2003 (Sized_incremental_binary::do_get_input_reader): Remove.
2004 (Sized_incremental_binary::get_symtab_view): New function.
2005 (Incremental_checker::can_incrementally_link_output_file): Remove.
2006 (Incremental_inputs::report_command_line): Exclude --debug options.
2007 (Incremental_inputs::report_archive_begin): Add parameter; track
2008 argument serial numbers; don't put input file entry for archive
2009 before archive members.
2010 (Incremental_inputs::report_archive_end): Put input file entry
2011 for archive after archive members.
2012 (Incremental_inputs::report_object): Add parameter; track argument
2013 serial numbers and in_system_directory flag.
2014 (Incremental_inputs::report_script): Add parameter; track argument
2016 (Output_section_incremental_inputs::set_final_data_size): Adjust
2017 size of symbol info entry; check for forwarding symbols.
2018 (Output_section_incremental_inputs::write_input_files): Write
2019 in_system_directory flag and argument serial number.
2020 (Output_section_incremental_inputs::write_info_blocks): Map section
2021 indices between incremental info and original input file; store
2022 input section index for each symbol.
2023 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2024 change operator() to visit().
2025 (class Global_got_offset_visitor): Likewise.
2026 (class Global_symbol_visitor_got_plt):
2027 (Output_section_incremental_inputs::write_got_plt): Use new visitor
2029 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
2030 (Sized_incr_relobj::do_read_symbols): New function.
2031 (Sized_incr_relobj::do_layout): New function.
2032 (Sized_incr_relobj::do_layout_deferred_sections): New function.
2033 (Sized_incr_relobj::do_add_symbols): New function.
2034 (Sized_incr_relobj::do_should_include_member): New function.
2035 (Sized_incr_relobj::do_for_all_global_symbols): New function.
2036 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
2037 (Sized_incr_relobj::do_section_size): New function.
2038 (Sized_incr_relobj::do_section_name): New function.
2039 (Sized_incr_relobj::do_section_contents): New function.
2040 (Sized_incr_relobj::do_section_flags): New function.
2041 (Sized_incr_relobj::do_section_entsize): New function.
2042 (Sized_incr_relobj::do_section_address): New function.
2043 (Sized_incr_relobj::do_section_type): New function.
2044 (Sized_incr_relobj::do_section_link): New function.
2045 (Sized_incr_relobj::do_section_info): New function.
2046 (Sized_incr_relobj::do_section_addralign): New function.
2047 (Sized_incr_relobj::do_initialize_xindex): New function.
2048 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2049 (Sized_incr_relobj::do_read_relocs): New function.
2050 (Sized_incr_relobj::do_gc_process_relocs): New function.
2051 (Sized_incr_relobj::do_scan_relocs): New function.
2052 (Sized_incr_relobj::do_count_local_symbols): New function.
2053 (Sized_incr_relobj::do_finalize_local_symbols): New function.
2054 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2055 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2056 (Sized_incr_relobj::do_relocate): New function.
2057 (Sized_incr_relobj::do_set_section_offset): New function.
2058 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2059 (Sized_incr_dynobj::do_read_symbols): New function.
2060 (Sized_incr_dynobj::do_layout): New function.
2061 (Sized_incr_dynobj::do_add_symbols): New function.
2062 (Sized_incr_dynobj::do_should_include_member): New function.
2063 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
2064 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
2065 (Sized_incr_dynobj::do_section_size): New function.
2066 (Sized_incr_dynobj::do_section_name): New function.
2067 (Sized_incr_dynobj::do_section_contents): New function.
2068 (Sized_incr_dynobj::do_section_flags): New function.
2069 (Sized_incr_dynobj::do_section_entsize): New function.
2070 (Sized_incr_dynobj::do_section_address): New function.
2071 (Sized_incr_dynobj::do_section_type): New function.
2072 (Sized_incr_dynobj::do_section_link): New function.
2073 (Sized_incr_dynobj::do_section_info): New function.
2074 (Sized_incr_dynobj::do_section_addralign): New function.
2075 (Sized_incr_dynobj::do_initialize_xindex): New function.
2076 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
2077 (make_sized_incremental_object): New function.
2078 (Incremental_library::copy_unused_symbols): New function.
2079 (Incremental_library::do_for_all_unused_symbols): New function.
2080 * incremental.h (enum Incremental_input_flags): New type.
2081 (class Incremental_checker): Remove.
2082 (Incremental_input_entry::Incremental_input_entry): Add argument
2084 (Incremental_input_entry::arg_serial): New function.
2085 (Incremental_input_entry::set_is_in_system_directory): New function.
2086 (Incremental_input_entry::is_in_system_directory): New function.
2087 (Incremental_input_entry::arg_serial_): New data member.
2088 (Incremental_input_entry::is_in_system_directory_): New data member.
2089 (class Script_info): Move here from script.h.
2090 (Script_info::Script_info): Add filename parameter.
2091 (Script_info::filename): New function.
2092 (Script_info::filename_): New data member.
2093 (Incremental_script_entry::Incremental_script_entry): Add argument
2095 (Incremental_object_entry::Incremental_object_entry): Likewise.
2096 (Incremental_object_entry::add_input_section): Build list of input
2097 sections with map to original shndx.
2098 (Incremental_object_entry::get_input_section_index): New function.
2099 (Incremental_object_entry::shndx_): New data member.
2100 (Incremental_object_entry::name_key_): Rename; adjust all refs.
2101 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
2102 (Incremental_archive_entry::Incremental_archive_entry): Add argument
2104 (Incremental_inputs::report_archive_begin): Likewise.
2105 (Incremental_inputs::report_object): Likewise.
2106 (Incremental_inputs::report_script): Likewise.
2107 (class Incremental_global_symbol_reader): New class.
2108 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
2109 and store flags and input file type.
2110 (Incremental_input_entry_reader::arg_serial): New function.
2111 (Incremental_input_entry_reader::type): Extract type from flags.
2112 (Incremental_input_entry_reader::is_in_system_directory): New function.
2113 (Incremental_input_entry_reader::get_input_section_count): Call
2114 accessor function for type.
2115 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
2116 function for type; adjust size of global symbol entry.
2117 (Incremental_input_entry_reader::get_global_symbol_count): Call
2118 accessor function for type.
2119 (Incremental_input_entry_reader::get_object_count): Likewise.
2120 (Incremental_input_entry_reader::get_object_offset): Likewise.
2121 (Incremental_input_entry_reader::get_member_count): Likewise.
2122 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
2123 (Incremental_input_entry_reader::get_member_offset): Likewise.
2124 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
2125 (Incremental_input_entry_reader::Global_symbol_info): Remove.
2126 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
2127 (Incremental_input_entry_reader::get_global_symbol_reader): New
2129 (Incremental_input_entry_reader::get_output_symbol_index): New
2131 (Incremental_input_entry_reader::type_): Remove.
2132 (Incremental_input_entry_reader::flags_): New data member.
2133 (Incremental_inputs_reader::input_file_offset): New function.
2134 (Incremental_inputs_reader::input_file_index): New function.
2135 (Incremental_inputs_reader::input_file): Call input_file_offset.
2136 (Incremental_inputs_reader::input_file_at_offset): New function.
2137 (Incremental_relocs_reader::get_r_type): Reformat.
2138 (Incremental_relocs_reader::get_r_shndx): Reformat.
2139 (Incremental_relocs_reader::get_r_offset): Reformat.
2140 (Incremental_relocs_reader::data): New function.
2141 (Incremental_binary::Incremental_binary): Initialize new data members.
2142 (Incremental_binary::check_inputs): Add cmdline parameter.
2143 (Incremental_binary::file_is_unchanged): Remove.
2144 (Input_reader::arg_serial): New function.
2145 (Input_reader::get_unused_symbol_count): New function.
2146 (Input_reader::get_unused_symbol): New function.
2147 (Input_reader::do_arg_serial): New function.
2148 (Input_reader::do_get_unused_symbol_count): New function.
2149 (Input_reader::do_get_unused_symbol): New function.
2150 (Incremental_binary::input_file_count): New function.
2151 (Incremental_binary::get_input_reader): Change signature to use
2152 index instead of filename.
2153 (Incremental_binary::file_has_changed): New function.
2154 (Incremental_binary::get_input_argument): New function.
2155 (Incremental_binary::get_library): New function.
2156 (Incremental_binary::get_script_info): New function.
2157 (Incremental_binary::init_layout): New function.
2158 (Incremental_binary::reserve_layout): New function.
2159 (Incremental_binary::output_file): New function.
2160 (Incremental_binary::do_check_inputs): New function.
2161 (Incremental_binary::do_file_is_unchanged): Remove.
2162 (Incremental_binary::do_file_has_changed): New function.
2163 (Incremental_binary::do_init_layout): New function.
2164 (Incremental_binary::do_reserve_layout): New function.
2165 (Incremental_binary::do_input_file_count): New function.
2166 (Incremental_binary::do_get_input_reader): Change signature.
2167 (Incremental_binary::input_args_map_): New data member.
2168 (Incremental_binary::library_map_): New data member.
2169 (Incremental_binary::script_map_): New data member.
2170 (Sized_incremental_binary::Sized_incremental_binary): Initialize
2172 (Sized_incremental_binary::output_section): New function.
2173 (Sized_incremental_binary::inputs_reader): Add const.
2174 (Sized_incremental_binary::symtab_reader): Add const.
2175 (Sized_incremental_binary::relocs_reader): Add const.
2176 (Sized_incremental_binary::got_plt_reader): Add const.
2177 (Sized_incremental_binary::get_symtab_view): New function.
2178 (Sized_incremental_binary::Inputs_reader): New typedef.
2179 (Sized_incremental_binary::Input_entry_reader): New typedef.
2180 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
2181 (Sized_incremental_binary::do_file_is_unchanged): Remove.
2182 (Sized_incremental_binary::do_file_has_changed): New function.
2183 (Sized_incremental_binary::do_init_layout): New function.
2184 (Sized_incremental_binary::do_reserve_layout): New function.
2185 (Sized_input_reader::Inputs_reader): Remove.
2186 (Sized_input_reader::Input_entry_reader): Remove.
2187 (Sized_input_reader::do_arg_serial): New function.
2188 (Sized_input_reader::do_get_unused_symbol_count): New function.
2189 (Sized_input_reader::do_get_unused_symbol): New function.
2190 (Sized_incremental_binary::do_input_file_count): New function.
2191 (Sized_incremental_binary::do_get_input_reader): Change signature;
2192 use index instead of filename.
2193 (Sized_incremental_binary::section_map_): New data member.
2194 (Sized_incremental_binary::input_entry_readers_): New data member.
2195 (class Sized_incr_relobj): New class.
2196 (class Sized_incr_dynobj): New class.
2197 (make_sized_incremental_object): New function.
2198 (class Incremental_library): New class.
2199 * layout.cc (Free_list::num_lists): New static data member.
2200 (Free_list::num_nodes): New static data member.
2201 (Free_list::num_removes): New static data member.
2202 (Free_list::num_remove_visits): New static data member.
2203 (Free_list::num_allocates): New static data member.
2204 (Free_list::num_allocate_visits): New static data member.
2205 (Free_list::init): New function.
2206 (Free_list::remove): New function.
2207 (Free_list::allocate): New function.
2208 (Free_list::dump): New function.
2209 (Free_list::print_stats): New function.
2210 (Layout_task_runner::run): Resize output file for incremental updates.
2211 (Layout::Layout): Initialize new data members.
2212 (Layout::set_incremental_base): New function.
2213 (Layout::init_fixed_output_section): New function.
2214 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
2215 incremental updates.
2216 (Layout::create_gold_note): Do not create gold note section for
2217 incremental updates.
2218 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
2219 for incremental updates.
2220 (Layout::set_section_offsets): For incremental updates, allocate space
2222 (Layout::create_symtab_sections): Layout with offsets relative to
2223 start of section; for incremental updates, allocate space from free
2225 (Layout::create_shdrs): For incremental updates, allocate space from
2227 (Layout::finish_dynamic_section): For incremental updates, do not
2228 check --as-needed (fixed in subsequent patch).
2229 * layout.h (class Free_list): New class.
2230 (Layout::set_incremental_base): New function.
2231 (Layout::incremental_base): New function.
2232 (Layout::init_fixed_output_section): New function.
2233 (Layout::allocate): New function.
2234 (Layout::incremental_base_): New data member.
2235 (Layout::free_list_): New data member.
2236 * main.cc (main): Print Free_list statistics.
2237 * object.cc (Relobj::finalize_incremental_relocs): Add
2238 clear_counts parameter; clear counts only when clear_counts is set.
2239 (Sized_relobj::Sized_relobj): Initialize new base class.
2240 (Sized_relobj::do_layout): Don't report special sections.
2241 (Sized_relobj::do_for_all_local_got_entries): New function.
2242 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
2243 symtab_off to all symbol table offsets.
2244 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
2245 * object.h (class Got_offset_list): Move to top of file.
2246 (Object::Object): Allow case where input_file == NULL.
2247 (Object::~Object): Likewise.
2248 (Object::input_file): Assert that input_file != NULL.
2249 (Object::lock): Allow case where input_file == NULL.
2250 (Object::unlock): Likewise.
2251 (Object::is_locked): Likewise.
2252 (Object::token): Likewise.
2253 (Object::release): Likewise.
2254 (Object::is_incremental): New function.
2255 (Object::get_mtime): New function.
2256 (Object::for_all_local_got_entries): New function.
2257 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
2258 (Object::set_is_in_system_directory): New function.
2259 (Object::is_in_system_directory): New function.
2260 (Object::do_is_incremental): New function.
2261 (Object::do_get_mtime): New function.
2262 (Object::do_for_all_local_got_entries): New function.
2263 (Object::is_in_system_directory_): New data member.
2264 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
2265 (class Sized_relobj_base): New class.
2266 (class Sized_relobj): Derive from Sized_relobj_base.
2267 (class Sized_relobj::Symbols): Redeclare from base class.
2268 (class Sized_relobj::local_got_offset_list): Remove.
2269 (class Sized_relobj::Output_sections): Redeclare from base class.
2270 (class Sized_relobj::do_for_all_local_got_entries): New function.
2271 (class Sized_relobj::write_local_symbols): Add offset parameter.
2272 (class Sized_relobj::local_symbol_offset_): Update comment.
2273 (class Sized_relobj::local_dynsym_offset_): Update comment.
2274 * options.cc (Input_arguments::add_file): Remove const.
2275 * options.h (Input_file_argument::Input_file_argument):
2276 Initialize arg_serial_ (all constructors).
2277 (Input_file_argument::set_arg_serial): New function.
2278 (Input_file_argument::arg_serial): New function.
2279 (Input_file_argument::arg_serial_): New data member.
2280 (Input_arguments::Input_arguments): Initialize file_count_.
2281 (Input_arguments::add_file): Remove const.
2282 (Input_arguments::number_of_input_files): New function.
2283 (Input_arguments::file_count_): New data member.
2284 (Command_line::number_of_input_files): Call
2285 Input_arguments::number_of_input_files.
2286 * output.cc (Output_segment_headers::Output_segment_headers):
2288 (Output_section::Input_section::current_data_size): New function.
2289 (Output_section::Output_section): Initialize new data members.
2290 (Output_section::add_input_section): Don't do merge sections for
2291 an incremental link; allocate space from free list for an
2293 (Output_section::add_output_section_data): Allocate space from
2294 free list for an incremental update.
2295 (Output_section::update_data_size): New function.
2296 (Output_section::set_fixed_layout): New function.
2297 (Output_section::reserve): New function.
2298 (Output_segment::set_section_addresses): Remove const.
2299 (Output_segment::set_section_list_addresses): Remove const; allocate
2300 space from free list for an incremental update.
2301 (Output_segment::set_offset): Adjust size of RELRO segment for an
2303 * output.h (Output_data::current_data_size): Move here from
2305 (Output_data::pre_finalize_data_size): New function.
2306 (Output_data::update_data_size): New function.
2307 (Output_section_headers::update_data_size): new function.
2308 (Output_section_data_build::current_data_size): Move to Output_data.
2309 (Output_data_strtab::update_data_size): New function.
2310 (Output_section::current_data_size): Move to Output_data.
2311 (Output_section::set_fixed_layout): New function.
2312 (Output_section::has_fixed_layout): New function.
2313 (Output_section::reserve): New function.
2314 (Output_section::update_data_size): New function.
2315 (Output_section::has_fixed_layout_): New data member.
2316 (Output_section::free_list_): New data member.
2317 (Output_segment::set_section_addresses): Remove const.
2318 (Output_segment::set_section_list_addresses): Remove const.
2319 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
2321 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
2323 * readsyms.cc (Read_symbols::do_read_symbols): Add library
2324 parameter when calling Add_symbols constructor; store argument
2325 serial number for members of a lib group.
2326 (Add_symbols::locks): Allow case where token == NULL.
2327 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
2328 (Read_member::~Read_member): New function.
2329 (Read_member::is_runnable): New function.
2330 (Read_member::locks): New function.
2331 (Read_member::run): New function.
2332 (Check_script::~Check_script): New function.
2333 (Check_script::is_runnable): New function.
2334 (Check_script::locks): New function.
2335 (Check_script::run): New function.
2336 (Check_library::~Check_library): New function.
2337 (Check_library::is_runnable): New function.
2338 (Check_library::locks): New function.
2339 (Check_library::run): New function.
2340 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
2341 (Add_symbols::library_): New data member.
2342 (class Read_member): New class.
2343 (class Check_script): New class.
2344 (class Check_library): New class.
2345 * reloc.cc (Read_relocs::is_runnable): Allow case where
2347 (Read_relocs::locks): Likewise.
2348 (Scan_relocs::locks): Likewise.
2349 (Relocate_task::locks): Likewise.
2350 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
2352 (Sized_relobj::incremental_relocs_scan): Fix comment.
2353 (Sized_relobj::do_relocate): Pass output file offset to
2354 write_local_symbols.
2355 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
2356 from class declaration.
2357 * script.cc (read_input_script): Allocate Script_info; pass
2358 argument serial number to report_script.
2359 * script.h (class Script_info): Move to incremental.h.
2360 * symtab.cc (Symbol_table::add_from_incrobj): New function.
2361 * symtab.h (Symbol_table::add_from_incrobj): New function.
2362 (Symbol_table::set_file_offset): New function.
2364 2011-04-05 Cary Coutant <ccoutant@google.com>
2366 * incremental-dump.cc (dump_incremental_inputs): Change signature
2367 to take a Sized_incremental_binary; change caller. Use readers
2368 in Sized_incremental_binary.
2370 (Sized_incremental_binary::find_incremental_inputs_sections):
2371 Rename do_find_incremental_inputs_sections to this.
2372 (Sized_incremental_binary::setup_readers): New function.
2373 (Sized_incremental_binary::do_check_inputs): Check
2374 has_incremental_info_ flag; move setup code to setup_readers;
2376 (Sized_incremental_binary::do_file_is_unchanged): New function.
2377 (Sized_incremental_binary::do_get_input_reader): New function.
2378 * incremental.h (class Incremental_binary): Move to end of file.
2379 (Incremental_binary::file_is_unchanged): New function.
2380 (Incremental_binary::do_file_is_unchanged): New function.
2381 (Incremental_binary::Input_reader): New class.
2382 (Incremental_binary::get_input_reader): New function.
2383 (class Sized_incremental_binary): Move to end of file.
2384 (Sized_incremental_binary::Sized_incremental_binary): Setup the
2385 input section reader classes.
2386 (Sized_incremental_binary::has_incremental_info): New function.
2387 (Sized_incremental_binary::inputs_reader): New function.
2388 (Sized_incremental_binary::symtab_reader): New function.
2389 (Sized_incremental_binary::relocs_reader): New function.
2390 (Sized_incremental_binary::got_plt_reader): New function.
2391 (Sized_incremental_binary::do_file_is_unchanged): New function.
2392 (Sized_incremental_binary::Sized_input_reader): New class.
2393 (Sized_incremental_binary::get_input_reader): New function.
2394 (Sized_incremental_binary::find_incremental_inputs_sections):
2395 Rename do_find_incremental_inputs_sections to this.
2396 (Sized_incremental_binary::setup_readers): New function.
2397 (Sized_incremental_binary::has_incremental_info_): New data member.
2398 (Sized_incremental_binary::inputs_reader_): New data member.
2399 (Sized_incremental_binary::symtab_reader_): New data member.
2400 (Sized_incremental_binary::relocs_reader_): New data member.
2401 (Sized_incremental_binary::got_plt_reader_): New data member.
2402 (Sized_incremental_binary::current_input_file_): New data member.
2404 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
2407 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
2410 2011-03-30 Cary Coutant <ccoutant@google.com>
2412 * archive.cc (Archive::include_member): Adjust call to report_object.
2413 (Add_archive_symbols::run): Add script_info to call to
2414 report_archive_begin.
2415 (Lib_group::include_member): Adjust call to report_object.
2416 (Add_lib_group_symbols::run): Adjust call to report_object.
2417 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
2418 blocks. Add object count for script input files.
2419 * incremental.cc (Incremental_inputs::report_archive_begin): Add
2420 script_info parameter; change all callers.
2421 (Incremental_inputs::report_object): Add script_info parameter;
2423 (Incremental_inputs::report_script): Store backpointer to
2424 incremental info entry.
2425 (Output_section_incremental_inputs::set_final_data_size): Record
2426 additional information for scripts.
2427 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2428 * incremental.h (Incremental_script_entry::add_object): New function.
2429 (Incremental_script_entry::get_object_count): New function.
2430 (Incremental_script_entry::get_object): New function.
2431 (Incremental_script_entry::objects_): New data member; adjust
2433 (Incremental_inputs::report_archive_begin): Add script_info parameter.
2434 (Incremental_inputs::report_object): Add script_info parameter.
2435 (Incremental_inputs_reader::get_object_count): New function.
2436 (Incremental_inputs_reader::get_object_offset): New function.
2437 * options.cc (Input_arguments::add_file): Return reference to
2439 * options.h (Input_argument::set_script_info): New function.
2440 (Input_argument::script_info): New function.
2441 (Input_argument::script_info_): New data member; adjust all
2443 (Input_file_group::add_file): Return reference to new input argument.
2444 (Input_file_lib::add_file): Likewise.
2445 (Input_arguments::add_file): Likewise.
2446 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
2447 * script.cc (Parser_closure::Parser_closure): Add script_info
2448 parameter; adjust all callers.
2449 (Parser_closure::script_info): New function.
2450 (Parser_closure::script_info_): New data member.
2451 (read_input_script): Report scripts earlier to incremental info.
2452 (script_add_file): Set script_info in Input_argument.
2453 (script_add_library): Likewise.
2454 * script.h (Script_options::Script_info): Rewrite class.
2456 2011-03-29 Cary Coutant <ccoutant@google.com>
2458 * archive.cc (Library_base::should_include_member): Move
2459 method here from class Archive.
2460 (Archive::Archive): Initialize base class.
2461 (Archive::should_include_member): Move to base class.
2462 (Archive::do_for_all_unused_symbols): New function.
2463 (Add_archive_symbols::run): Remove redundant access to
2465 (Lib_group::Lib_group): Initialize base class.
2466 (Lib_group::do_filename): New function.
2467 (Lib_group::include_member): Pass pointer to Lib_group to
2469 (Lib_group::do_for_all_unused_symbols): New function.
2470 (Add_lib_group_symbols::run): Report archive information for
2472 * archive.h (class Library_base): New base class.
2473 (class Archive): Derive from Library_base.
2474 (Archive::filename): Move to base class.
2475 (Archive::set_incremental_info): Likewise.
2476 (Archive::incremental_info): Likewise.
2477 (Archive::Should_include): Likewise.
2478 (Archive::should_include_member): Likewise.
2479 (Archive::Armap_entry): Remove.
2480 (Archive::Unused_symbol_iterator): Remove.
2481 (Archive::unused_symbols_begin): Remove.
2482 (Archive::unused_symbols_end): Remove.
2483 (Archive::do_filename): New function.
2484 (Archive::do_get_mtime): New function.
2485 (Archive::do_for_all_unused_symbols): New function.
2486 (Archive::task_): Move to base class.
2487 (Archive::incremental_info_): Likewise.
2488 (class Lib_group): Derive from Library_base.
2489 (Lib_group::do_filename): New function.
2490 (Lib_group::do_get_mtime): New function.
2491 (Lib_group::do_for_all_unused_symbols): New function.
2492 (Lib_group::task_): Move to base class.
2493 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
2495 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
2497 * incremental.cc (Incremental_inputs::report_archive_begin):
2498 Use Library_base; call library's get_mtime; add incremental inputs
2499 entry before members.
2500 (class Unused_symbol_visitor): New class.
2501 (Incremental_inputs::report_archive_end): Use Library_base; use
2502 visitor class to record unused symbols; don't add incremental inputs
2503 entry after members.
2504 (Incremental_inputs::report_object): Use Library_base.
2506 (Incremental_archive_entry::Incremental_archive_entry): Remove
2507 unused Archive parameter.
2508 (Incremental_inputs::report_archive_begin): Use Library_base.
2509 (Incremental_inputs::report_archive_end): Likewise.
2510 (Incremental_inputs::report_object): Likewise.
2511 * object.cc (Sized_relobj::do_for_all_global_symbols): New
2513 * object.h (Object::for_all_global_symbols): New function.
2514 (Object::do_for_all_global_symbols): New function.
2515 (Sized_relobj::do_for_all_global_symbols): New function.
2516 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
2518 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
2521 2011-03-27 Ian Lance Taylor <iant@google.com>
2523 * archive.cc (Archive::interpret_header): Return -1 if something
2524 goes wrong. Change callers accordingly.
2526 2011-03-25 Cary Coutant <ccoutant@google.com>
2528 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
2529 * testsuite/Makefile.in: Regenerate.
2531 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
2533 * plugin.cc (get_view): New.
2534 (Plugin::load): Pass get_view to the plugin.
2535 (Plugin_manager::get_view): New.
2537 2011-03-21 Ian Lance Taylor <iant@google.com>
2539 * testsuite/final_layout.sh: Rewrite to not use dc.
2540 * testsuite/relro_test.sh: Fail if dc is not present.
2542 2011-03-21 Sriraman Tallam <tmsriram@google.com>
2544 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
2546 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
2547 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
2549 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
2550 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
2552 2011-03-14 Ian Lance Taylor <iant@google.com>
2554 * script-sections.cc (Sort_output_sections::script_compare):
2555 Rename from is_before, change return type.
2556 (Sort_output_sections::operator()): Adjust accordingly.
2558 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
2561 * testsuite/odr_violation2.cc: Add comment to make all error line
2562 numbers double digits.
2563 * testsuite/debug_msg.sh: Adjust expected errors.
2565 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
2567 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
2568 but mark earlier ones as non-canonical
2569 (offset_to_iterator): Update search target and example
2570 (do_addr2line): Return extra lines in a vector*
2571 (format_file_lineno): Extract from do_addr2line
2572 (one_addr2line): Add vector* out-param
2573 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
2574 when a lineno entry appeared last for its instruction
2575 (Dwarf_line_info): Add vector* out-param
2576 * object.cc (Relocate_info): Pass NULL for the vector* out-param
2577 * symtab.cc (Odr_violation_compare): Include the lineno in the
2579 (linenos_from_loc): New. Combine the canonical line for an
2580 address with its other lines.
2581 (True_if_intersect): New. Helper functor to make
2582 std::set_intersection a query.
2583 (detect_odr_violations): Compare sets of lines instead of just
2584 one line for each function. This became less deterministic, but
2585 has fewer false positives.
2586 * symtab.h: Declarations.
2587 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
2588 mix an optimized and non-optimized object in the same binary
2589 (odr_violation2.so): Same.
2590 * testsuite/Makefile.in: Regenerate from Makefile.am.
2591 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
2592 * testsuite/debug_msg.sh: Update line numbers and add
2594 * testsuite/odr_violation1.cc: Use OdrDerived, in a
2595 non-optimized context.
2596 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
2597 isn't inlined, and use OdrDerived in an optimized context.
2598 * testsuite/odr_header1.h: Defines OdrDerived, where
2599 optimization will change the
2600 first-instruction-in-the-destructor's file and line number.
2601 * testsuite/odr_header2.h: Defines OdrBase.
2603 2011-03-09 Ian Lance Taylor <iant@google.com>
2605 * fileread.cc (File_read::clear_views): Don't delete the whole
2608 2011-03-08 Ian Lance Taylor <iant@google.com>
2611 * fileread.cc: #include <climits>.
2612 (GOLD_IOV_MAX): Define.
2613 (File_read::read_multiple): Limit number of entries by iov_max.
2614 * fileread.h (class File_read): Always set max_readv_entries to
2617 2011-03-07 Ian Lance Taylor <iant@google.com>
2620 * options.h (class General_options): Add -dy and -dn.
2622 2011-03-02 Cary Coutant <ccoutant@google.com>
2624 * testsuite/script_test_9.t: Add TLS segment.
2626 2011-03-02 Simon Baldwin <simonb@google.com>
2628 * configure.ac: Add check for gnu_indirect_function support in
2629 the toolchain building binutils.
2630 * configure: Rebuild.
2632 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
2634 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
2635 plugin only symbols.
2636 (Symbol_table::sized_finalize_symbol) Mark symbol only present
2637 in plugin files as not needed in the symbol table.
2639 2011-02-11 Sriraman Tallam <tmsriram@google.com>
2641 * output.cc (Output_section::add_input_section): Delay fill
2642 generation for section ordering.
2644 2011-02-09 Ian Lance Taylor <iant@google.com>
2647 * object.h (class Sized_relobj): Remove clear_local_symbols.
2648 * reloc.cc (Sized_relobj::do_relocate): Don't call
2649 clear_local_symbols.
2651 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
2653 * plugin.cc (is_visible_from_outside): Return true for symbols
2656 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
2658 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
2661 2011-02-02 Sriraman Tallam <tmsriram@google.com>
2663 * icf.h (is_section_foldable_candidate): Change type of parameter
2665 * icf.cc (Icf::find_identical_sections): Change type of local variable
2666 section_name to be std::string.
2667 (is_function_ctor_or_dtor): Change type of parameter to std::string.
2669 2011-01-25 Ian Lance Taylor <iant@google.com>
2671 * script.cc (script_add_extern): Rewrite to use
2672 add_symbol_reference.
2674 2011-01-25 Doug Kwan <dougkwan@google.com>
2676 * icf.cc (get_section_contents): Always lock section's object.
2678 2011-01-24 Ian Lance Taylor <iant@google.com>
2680 * options.h (class General_options): Accept
2681 --no-detect-odr-violations.
2683 2011-01-24 Ian Lance Taylor <iant@google.com>
2685 * version.cc (version_string): Bump to 1.11.
2687 2011-01-24 Ian Lance Taylor <iant@google.com>
2689 * plugin.cc (class Plugin_rescan): Define new class.
2690 (Plugin_manager::claim_file): Set any_claimed_.
2691 (Plugin_manager::save_archive): New function.
2692 (Plugin_manager::save_input_group): New function.
2693 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
2695 (Plugin_manager::new_undefined_symbol): New function.
2696 (Plugin_manager::rescan): New function.
2697 (Plugin_manager::rescannable_defines): New function.
2698 (Plugin_manager::add_input_file): Set any_added_.
2699 * plugin.h (class Plugin_manager): define new fields rescannable_,
2700 undefined_symbols_, any_claimed_, and any_added_. Declare
2701 Plugin_rescan as friend. Declare new functions.
2702 (Plugin_manager::Rescannable): Define type.
2703 (Plugin_manager::Rescannable_list): Define type.
2704 (Plugin_manager::Undefined_symbol_list): Define type.
2705 (Plugin_manager::Plugin_manager): Initialize new fields.
2706 * archive.cc (Archive::defines_symbol): New function.
2707 (Add_archive_symbols::run): Pass archive to plugins if any.
2708 * archive.h (class Archive): Declare defines_symbol.
2709 * readsyms.cc (Input_group::~Input_group): New function.
2710 (Finish_group::run): Pass input_group to plugins if any.
2711 * readsyms.h (class Input_group): Declare destructor.
2712 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
2715 2011-01-10 Ian Lance Taylor <iant@google.com>
2717 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
2719 (Layout::set_segment_offsets): Reset increase_relro before calling
2720 set_section_addresses a second time.
2722 2011-01-04 Cary Coutant <ccoutant@google.com>
2724 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
2725 sections before NOBITS sections.
2727 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
2729 * version.cc (print_version): Update copyright to 2011.
2731 2010-12-23 Cary Coutant <ccoutant@google.com>
2733 * output.h (Output_data_reloc::add_output_section): Pass OD instead
2734 of OS to this->add. Add OD parameter to second form of the function.
2736 2010-12-20 Ian Lance Taylor <iant@google.com>
2738 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
2739 second of two consecutive entries with same offset.
2741 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2743 * testsuite/Makefile.am (ifuncmain2static_LDADD)
2744 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
2745 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
2746 to avoid unneeded links against $(LDADD).
2747 * testsuite/Makefile.in: Regenerate.
2749 2010-12-15 Ian Lance Taylor <iant@google.com>
2752 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
2753 for R_X86_64_32 and R_X86_64_PC32.
2754 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
2755 ver_matching_def_pic.o.
2756 (ver_matching_def_pic.o): New target.
2758 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2760 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
2761 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
2762 Move definition before File_read::View member definitions.
2763 (File_read::View::~View): Initialize and hold lock before
2764 updating current_mapped_bytes.
2766 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2768 * dwarf_reader.cc: Remove outdated comment.
2769 * gold-threads.cc: Fix typo in error message.
2770 * archive.cc: Fix typos in comments.
2771 * archive.h: Likewise.
2772 * arm-reloc-property.cc: Likewise.
2773 * arm-reloc-property.h: Likewise.
2774 * arm-reloc.def: Likewise.
2776 * attributes.h: Likewise.
2777 * cref.cc: Likewise.
2778 * ehframe.cc: Likewise.
2779 * fileread.h: Likewise.
2781 * i386.cc: Likewise.
2783 * incremental.h: Likewise.
2784 * int_encoding.cc: Likewise.
2785 * layout.h: Likewise.
2786 * main.cc: Likewise.
2787 * merge.h: Likewise.
2788 * object.cc: Likewise.
2789 * object.h: Likewise.
2790 * options.cc: Likewise.
2791 * readsyms.cc: Likewise.
2792 * reduced_debug_output.cc: Likewise.
2793 * reloc.cc: Likewise.
2794 * script-sections.cc: Likewise.
2795 * sparc.cc: Likewise.
2796 * symtab.h: Likewise.
2797 * target-reloc.h: Likewise.
2798 * target.cc: Likewise.
2799 * target.h: Likewise.
2800 * timer.cc: Likewise.
2801 * timer.h: Likewise.
2802 * x86_64.cc: Likewise.
2804 2010-12-09 Cary Coutant <ccoutant@google.com>
2806 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
2808 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
2809 parameter; change all callers.
2810 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
2811 * options.h (warn_execstack): New option.
2813 2010-12-07 Doug Kwan <dougkwan@google.com>
2815 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
2816 like function call relocations.
2818 2010-12-07 Ian Lance Taylor <iant@google.com>
2820 * archive.cc (Archive::get_elf_object_for_member): Permit
2821 punconfigured to be NULL.
2822 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
2823 (Archive::include_member): Pass NULL to get_elf_object_for_member
2824 if we searched for the archive and this is the first included
2827 2010-12-01 Ian Lance Taylor <iant@google.com>
2829 * dwarf_reader.h (class Sized_dwarf_line_info): Add
2830 track_relocs_type_ field.
2831 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2832 Set track_relocs_type_.
2833 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
2834 contents when using RELA relocs.
2835 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
2837 * reloc.cc (Track_relocs::next_addend): New function.
2838 * reloc.h (class Track_relocs): Declare next_addend.
2840 2010-12-01 Ian Lance Taylor <iant@google.com>
2842 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
2845 2010-12-01 Ian Lance Taylor <iant@google.com>
2847 * README: Update compilers known to work and fail.
2849 2010-11-23 Matthias Klose <doko@ubuntu.com>
2851 * configure.in: For --enable-gold, handle value `default' instead of
2852 `both*'. Always install ld as ld.bfd, install as ld if gold is
2854 * configure: Regenerate.
2856 2010-11-18 Doug Kwan <dougkwan@google.com>
2858 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
2859 and right_alignment to be zero. Store result alignment only if it is
2860 greater than existing alignment.
2862 2010-11-16 Cary Coutant <ccoutant@google.com>
2865 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2866 Check for ".zdebug_line".
2868 2010-11-16 Doug Kwan <dougkwan@google.com>
2869 Cary Coutant <ccoutant@google.com>
2871 * output.h (Output_segment::set_section_addresses): Pass increase_relro
2872 by reference; adjust all callers.
2873 * output.cc (Output_segment::set_section_addresses): Adjust references
2874 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
2876 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
2877 end at page boundary.
2879 2010-11-16 Cary Coutant <ccoutant@google.com>
2882 * layout.cc (Layout::choose_output_section): Transform names of
2883 compressed sections even when using a script with a SECTIONS clause.
2884 (Layout::output_section_name): Remove code to transform
2885 compressed debug section names.
2886 * output.cc (Output_section::add_input_section): Use uncompressed
2887 section size when tracking input sections.
2889 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
2891 * symtab.h (Symbol::NON_PIC_REF): Remove.
2892 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
2893 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
2894 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
2895 (Symbol::use_plt_offset): Take a flags argument and pass it
2896 directly to needs_dynamic_reloc. Restrict check for undefined
2897 weak symbols to function calls.
2898 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
2899 (Target_arm::Scan::global): Use it.
2900 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
2901 (Target_arm::Relocate::relocate): Likewise.
2902 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
2903 parameter with an r_type parameter. Use get_reference_flags
2905 (Target_arm::Relocate::relocate): Update accordingly.
2906 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
2907 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
2908 (Target_i386::Scan::global): Likewise.
2909 (Target_i386::Relocate::relocate): Likewise.
2910 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
2911 parameter with an r_type parameter. Use get_reference_flags
2913 (Target_i386::Relocate::relocate): Update accordingly.
2914 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
2915 (Target_powerpc::Scan::global): Use it.
2916 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
2917 (Target_powerpc::Relocate::relocate): Likewise.
2918 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
2919 (Target_sparc::Scan::global): Use it.
2920 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
2921 (Target_sparc::Relocate::relocate): Likewise.
2922 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
2923 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
2924 (Target_x86_64::Scan::global): Likewise.
2925 (Target_x86_64::Relocate::relocate): Likewise.
2927 2010-11-08 Doug Kwan <dougkwan@google.com>
2928 Cary Coutant <ccoutant@google.com>
2930 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
2931 (Arm_exidx_merge_section::section_contents_): New data member.
2932 (Arm_input_section::Arm_input_section): Initialize original_contents_.
2933 (Arm_input_section::~Arm_input_section): De-allocate memory.
2934 (Arm_input_section::original_contents_): New data member.
2935 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
2936 in parameters instead of calling Object::section_contents without
2938 (Arm_output_section::group_section): New parameter TASK. Pass it
2939 to callees that need locking objects.
2940 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
2941 to lock EXIDX input sections. Fix a formatting issue. Call
2942 Arm_exidx_merged_section::build_contents to create merged section
2944 (Arm_output_section::create_stub_group): New parameter TASK. Use it
2945 to lock object of stub table owner.
2946 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
2947 TEXT_SIZE to initialize data member TEXT_SIZE_.
2948 (Arm_exidx_input_section::addralign): Fix typo in comment.
2949 (Arm_exidx_input_section::text_size): New method.
2950 (Target_arm::do_relax): New parameter TASK. Pass it to callees
2951 that require locking objects. Lock objects before scanning for stubs
2952 and updating local symbols.
2953 (Arm_input_section<big_endian>::init): Copy contents of original
2955 (Arm_input_section<big_endian>::do_write): Use saved contents of
2956 original input section instead of calling Object::section_contents
2958 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
2959 size without calling Object::section_size().
2960 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
2961 for size. Allocate a buffer for merged EXIDX entries.
2962 (Arm_exidx_merged_section::build_contents): New method.
2963 (Arm_exidx_merged_section::do_write): Move merge section contents
2964 building code to Arm_exidx_merged_section::build_contetns. Write
2965 out contetns in buffer instead of building it on the fly.
2966 (Arm_relobj::make_exidx_input_section): Also pass text section size
2967 to Arm_exidx_input_section constructor.
2968 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
2969 (Arm_dynobj::do_read_symbols): Fix memory leak.
2970 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
2971 * target.h: (class Task): Add forward declaration.
2972 (Target::relax): Add new parameter TASK and pass it to
2974 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
2976 2010-11-05 Cary Coutant <ccoutant@google.com>
2979 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
2980 object when reading from the file.
2981 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
2983 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
2984 when reading section contents.
2985 (get_section_contents): Likewise.
2986 (icf::find_identical_sections): Likewise.
2987 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
2988 object when reading from the file.
2989 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
2990 the object when doing deferred section layout.
2992 2010-11-03 Nick Clifton <nickc@redhat.com>
2995 * script.h (class Symbol_assignment: name): New member. Returns
2996 the name of the symbol.
2997 * scrfipt.cc (Script_options::is_pending_assignment): New member.
2998 Returns true if the given symbol name is on the list of
2999 assignments wating to be processed.
3000 * archive.cc (should_incldue_member): If the symbol is undefined,
3001 check to see if it is on the list of symbols pending assignment.
3003 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
3005 * script-sections.cc (Script_sections::find_memory_region): Check
3006 for a NULL output section pointer.
3008 2010-10-29 Doug Kwan <dougkwan@google.com>
3010 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3011 Output_section::add_relaxed_input_section.
3012 * output.cc (Output_section::add_relaxed_input_section): Add new
3013 arguments LAYOUT and NAME. Set section order index.
3014 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3015 Copy section order index.
3016 * output.h (Output_section::add_relaxed_input_section): Add new
3017 arguments LAYOUT and NAME.
3019 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3021 * testsuite/Makefile.am: Move gcctestdir/ld rule to
3022 NATIVE_OR_CROSS_LINKER.
3023 * testsuite/Makefile.in: Regenerate.
3025 2010-10-20 Doug Kwan <dougkwan@google.com>
3027 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
3028 without SHF_LINK_ORDER flags.
3029 * layout.cc (Layout::choose_output_section): Do not filter
3030 SHF_LINK_ORDER flag in a relocatable link.
3032 2010-10-17 Cary Coutant <ccoutant@google.com>
3034 * output.h (Output_segment::set_section_addresses): Change function
3035 signature. Update all callers.
3036 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
3038 (Output_segment::set_section_addresses): Align after last TLS
3039 section. Add padding before last relro section instead of after.
3041 2010-10-17 Doug Kwan <dougkwan@google.com>
3043 * gold/arm.cc (Target_arm::got_section): Use correct order and set
3044 GOT output section to be writable.
3046 2010-10-14 Cary Coutant <ccoutant@google.com>
3048 * debug.h (DEBUG_INCREMENTAL): New flag.
3049 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3050 * gold.cc (queue_initial_tasks): Check parameters for incremental link
3052 * incremental.cc (report_command_line): Ignore all forms of
3054 * layout.cc (Layout::Layout): Check parameters for incremental link
3056 * options.cc (General_options::parse_incremental): New function.
3057 (General_options::parse_no_incremental): New function.
3058 (General_options::parse_incremental_full): New function.
3059 (General_options::parse_incremental_update): New function.
3060 (General_options::incremental_mode_): New data member.
3061 (General_options::finalize): Check incremental_mode_.
3062 * options.h (General_options): Update help text for --incremental.
3063 Add --no-incremental, --incremental-full, --incremental-update.
3064 (General_options::Incremental_mode): New enum type.
3065 (General_options::incremental_mode): New function.
3066 (General_options::incremental_mode_): New data member.
3067 * parameters.cc (Parameters::incremental_mode_): New data member.
3068 (Parameters::set_options): Set incremental_mode_.
3069 (Parameters::set_incremental_full): New function.
3070 (Parameters::incremental): New function.
3071 (Parameters::incremental_update): New function.
3072 (set_parameters_incremental_full): New function.
3073 * parameters.h (Parameters::set_incremental_full): New function.
3074 (Parameters::incremental): New function.
3075 (Parameters::incremental_update): New function.
3076 (Parameters::incremental_mode_): New data member.
3077 (set_parameters_incremental_full): New function.
3078 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
3079 incremental link mode.
3080 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
3081 (Sized_relobj::do_relocate_sections): Likewise.
3082 * testsuite/Makefile.am (incremental_test): Use --incremental-full
3084 * testsuite/Makefile.in: Regenerate.
3085 * testsuite/incremental_test.sh: Filter all forms of --incremental.
3087 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3089 * script-sections.h (class Script_sections): Make
3090 Sections_elements typedef public.
3091 * script-sections.cc (class Sort_output_sections): Add elements_
3092 field. Add constructor which sets it; change all callers.
3093 (Sort_output_sections::is_before): New function.
3094 (Sort_output_sections::operator()): Call is_before.
3095 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
3097 * testsuite/script_test_10.sh: New test. Test script section
3099 * testsuite/script_test_10.t: Likewise.
3100 * testsuite/script_test_10.s: Likewise.
3101 * testsuite/Makefile.am: Wrap the cross linker tests and the
3102 common tests into NATIVE_OR_CROSS_LINKER.
3103 (check_SCRIPTS): Add script_test_10.sh.
3104 (check_DATA): Add script_test_10.stdout.
3105 (script_test_10.o, script_test_10): New targets.
3106 (script_test_10.stdout): New target.
3107 * configure, testsuite/Makefile.in: Regenerate.
3109 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3111 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
3112 error for the deprecated relocations.
3113 (Target_arm::Scan::global): Likewise.
3114 (Target_arm::Relocate::relocate): Likewise.
3116 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
3118 * fileread.cc (Input_file::find_file): Initialize *found_name
3119 and *namep when using the fallback search for case 4.
3121 2010-10-11 Cary Coutant <ccoutant@google.com>
3123 * options.h (class General_options): Redefine -z lazy as an alias for
3124 the negation of -z now.
3126 2010-10-11 Ian Lance Taylor <iant@google.com>
3128 * resolve.cc (symbol_to_bits): Report the value of the unsupported
3131 2010-10-06 Nick Clifton <nickc@redhat.com>
3133 * script-sections.cc(class Memory_region): Remove
3134 current_lma_offset_ field. Rename current_vma_offset_ to
3135 current_offset_. Add last_section_ field.
3136 (Memory_region::get_current_vma_address): Rename to
3137 get_current_address.
3138 (Memory_region::get_current_lma_address): Delete.
3139 (Memory_region::increment_vma_offset): Rename to
3141 (Memory_region::increment_lma_offset): Delete.
3142 (Memory_region::attributes_compatible): New method. Returns
3143 true if the provided section is compatible with the region.
3144 (Memory_region::get_last_section): New method. Returns the last
3145 section to use the region.
3146 (Memory_region::set_last_section): New method. Stores the last
3147 section to use the region.
3148 (Script_sections::block_in_region): New method. Returns true if
3149 a block of memory is contained within a region.
3150 (Script_sections::find_memory_region): New method. Locates a
3151 memory region to be used to set a VMA or LMA address.
3152 (Output_section_definition::set_section_addresses): Add code to
3153 check for addresses set by memory regions.
3154 (Output_segment::set_section_addresses): Remove memory region
3156 (Script_sections::create_segment): Add a warning if a header
3157 segment is created outside of any region.
3158 * script-sections.h (class Script_sections): Add prototypes for
3159 find_memory_region and block_in_region methods.
3160 * testsuite/memory_test.s: Use .long instead of .word.
3161 * testsuite/memory_test.t: Add some more output sections.
3162 * testsuite/memory_test.sh: Update expected output.
3164 2010-10-02 Doug Kwan <dougkwan@google.com>
3166 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
3167 defintion to symtab.h
3168 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
3169 declaration to defintion.
3171 2010-10-01 Nick Clifton <nickc@redhat.com>
3173 * expression.cc (eval): Replace dummy argument with NULL.
3174 (eval_maybe_dot): Check for a NULL result section pointer.
3175 (Symbol_expression::value): Likewise.
3176 (Dot_expression::value): Likewise.
3177 (BINARY_EXPRESSION): Likewise.
3178 (Max_expression::value): Likewise.
3179 (Min_expression::value): Likewise.
3180 (Absolute_expression::value): Likewise.
3181 (Addr_expression::value_from_output_section): Likewise.
3182 (Loaddddr_expression::value_from_output_section): Likewise.
3183 (Segment_start_expression::value): Likewise.
3184 * script-sections.cc
3185 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
3187 (Sections_elememt_dot_assignment::set_section_addresses):
3189 (Output_data_expression::do_write_to_buffer): Likewise.
3190 (Output_section_definition::finalize_symbols): Likewise.
3191 (Output_section_definition::set_section_addresses): Likewise.
3193 2010-09-30 Doug Kwan <dougkwan@google.com>
3195 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
3197 2010-09-28 Sriraman Tallam <tmsriram@google.com>
3199 * target.h (Target::can_icf_inline_merge_sections): New virtual
3201 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
3203 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
3205 * icf.cc (get_section_contents): Inline merge sections only when
3208 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3210 * configure: Regenerate.
3212 2010-09-17 Ian Lance Taylor <iant@google.com>
3214 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
3215 * testsuite/Makefile.am (memory_test.o): New target.
3216 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
3218 * testsuite/Makefile.in: Rebuild.
3220 2010-09-17 Doug Kwan <dougkwan@google.com>
3222 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
3223 defintion if relocation uses GOT entries of the symbol.
3224 * testsuite/icf_safe_test.sh: Fix test.
3225 * testsuite/icf_safe_so_test.sh: Fix test.
3227 2010-09-16 Cary Coutant <ccoutant@google.com>
3229 * script_sections.cc (class Memory_region): Remove "NULL" from
3230 vector initializations.
3232 2010-09-15 Cary Coutant <ccoutant@google.com>
3234 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
3235 Resolve forwarding symbols.
3237 2010-09-15 Doug Kwan <dougkwan@google.com>
3239 * gold/testsuite/script_test_3.t: Add ARM special sections.
3240 * gold/testsuite/script_test_4.t: Same.
3241 * gold/testsuite/script_test_5.t: Same.
3242 * gold/testsuite/script_test_6.t: Same.
3243 * gold/testsuite/script_test_7.t: Same.
3244 * gold/testsuite/script_test_7.t: Same.
3245 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
3247 2010-09-14 Cary Coutant <ccoutant@google.com>
3249 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
3250 (Target_x86_64::Relocate::relocate_tls): Replace check for
3251 saw_tls_block_reloc_ with test for executable section.
3253 2010-09-12 Cary Coutant <ccoutant@google.com>
3255 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
3256 position-independent executables to shared libraries need dynamic
3258 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
3259 position-independent executables.
3260 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
3261 * testsuite/Makefile.in: Regenerate.
3263 2010-09-10 Nick Clifton <nickc@redhat.com>
3266 * testsuite/memory_test.t: Discard any sections that are not
3269 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
3272 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
3273 "This::" to work around a bug in gcc 4.2.
3275 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
3277 2010-09-09 Rafael Espindola <espindola@google.com>
3279 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
3280 sections with different PF_X flags in the same segment.
3281 (Layout::find_first_load_seg): Search all segments to find the first
3283 * options.h (rosegment): New.
3285 2010-09-08 Rafael Espindola <espindola@google.com>
3287 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
3289 2010-09-08 Doug Kwan <dougkwan@google.com>
3291 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
3292 (Arm_relobj::do_relocate_sections): Add new parameter for output
3293 file to match the parent.
3294 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
3295 of local symbols instead of input values. Update code to track
3296 changes in gold::relocate_section.
3297 * object.cc (Sized_relobj::compute_final_local_value): New methods.
3298 (Sized_relobj::compute_final_local_value_internal): New methods.
3299 (Sized_relobj::do_finalize_local_symbols): Move code from loop
3300 body into private version of Sized_relobj::compute_final_local_value.
3301 Call the inline method.
3302 * object.h (Symbol_value::Symbol_value): Define destructor. Free
3303 merged symbol value if there is one.
3304 (Symbol_value::has_output_value): New method defintiion.
3305 (Sized_relobj::Compute_final_local_value_status): New enum type.
3306 (Sized_relobj::compute_final_local_value): New methods.
3307 (Sized_relobj::compute_final_local_value_internal): New methods.
3308 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
3309 and arm_cortex_a8.sh.
3310 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
3311 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
3313 * Makefile.in: Regenerate.
3314 * testsuite/arm_bl_out_of_range.s: Update test.
3315 * testsuite/thumb_bl_out_of_range.s: Ditto.
3316 * testsuite/thumb_blx_out_of_range.s: Ditto.
3317 * testsuite/arm_branch_out_of_range.sh: New file.
3318 * testsuite/arm_cortex_a8.sh: Ditto.
3319 * testsuite/arm_cortex_a8_b.s: Ditto.
3320 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
3321 * testsuite/arm_cortex_a8_b_local.s: Ditto.
3322 * testsuite/arm_cortex_a8_bl.s: Ditto.
3323 * testsuite/arm_cortex_a8_blx.s: Ditto.
3324 * testsuite/arm_cortex_a8_local.s: Ditto.
3325 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
3326 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
3328 2010-09-08 Rafael Espindola <espindola@google.com>
3330 * Makefile.am (memory_test.stdout): Run readelf with -W.
3331 * Makefile.in: Regenerate.
3332 * testsuite/memory_test.sh: Make the regexps accept both 32 and
3335 2010-09-08 Rafael Espindola <espindola@google.com>
3337 * script-sections.cc (Script_sections::add_memory_region): Convert
3338 field precision to int.
3339 * script.cc (script_set_section_region, script_set_section_region):
3340 Convert field precision to int.
3342 2010-09-08 Rafael Espindola <espindola@google.com>
3344 * arm.cc (do_finalize_sections): Create the __exidx_start and
3345 __exdix_end symbols even when the section is missing.
3347 2010-09-08 Nick Clifton <nickc@redhat.com>
3349 * README: Remove claim that MEMORY is not supported.
3350 * expression.cc (script_exp_function_origin)
3351 (script_exp_function_length): Move from here to ...
3352 * script.cc: ... here.
3353 (script_set_section_region, script_add_memory)
3354 (script_parse_memory_attr, script_include_directive): New
3356 * script-sections.cc
3357 (class Memory_region): New class.
3358 (class Output_section_definition): Add set_memory_region,
3359 set_section_vma, set_section_lma and get_section_name methods.
3360 (class Script_Sections): Add add_memory_region,
3361 find_memory_region, find_memory_region_origin,
3362 find_memory_region_length and set_memory_region methods.
3363 Have set_section_addresses method walk the list of set memory
3365 Extend the print methos to display memory regions.
3366 * script-sections.h: Add prototypes for new methods.
3367 Add enum for MEMORY region attributes.
3368 * yyscript.y: Add support for parsing MEMORY regions.
3369 * script-c.h: Add prototypes for new functions.
3370 * testsuite/Makefile.am: Add test of MEMORY region functionality.
3371 * testsuite/Makefile.in: Regenerate.
3372 * testsuite/memory_test.sh: New script.
3373 * testsuite/memory_test.s: New assembler source file.
3374 * testsuite/memory_test.t: New linker script.
3376 2010-08-27 Doug Kwan <dougkwan@google.com>
3378 * gold/resolve.cc (Symbol_table::should_override): Let a weak
3379 reference override an existing dynamic weak reference.
3380 * testsuite/Makefile.am: Add new test dyn_weak_ref.
3381 * testsuite/Makefile.in: Regenerate.
3382 * testsuite/dyn_weak_ref.sh: New file.
3383 * testsuite/dyn_weak_ref_1.c: Ditto.
3384 * testsuite/dyn_weak_ref_2.c: Ditto.
3386 2010-08-27 Ian Lance Taylor <iant@google.com>
3388 * incremental.h (class Incremental_input_entry): Add virtual
3391 2010-08-27 Ian Lance Taylor <iant@google.com>
3393 * testsuite/start_lib_test_3.c: Mark t3 as used.
3395 2010-08-27 Nick Clifton <nickc@redhat.com>
3397 * options.cc (version_script): Fix small typo in previous
3400 2010-08-25 Nick Clifton <nickc@redhat.com>
3402 * archive.cc: Formatting fixes: Remove whitespace between
3403 typename and following asterisk. Remove whitespace between
3404 function name and opening parenthesis.
3405 * archive.h: Likewise.
3407 * attributes.cc: Likewise.
3408 * attributes.h: Likewise.
3409 * common.cc: Likewise.
3410 * copy-relocs.cc: Likewise.
3411 * dirsearch.h: Likewise.
3412 * dynobj.cc: Likewise.
3413 * ehframe.cc: Likewise.
3414 * ehframe.h: Likewise.
3415 * expression.cc: Likewise.
3416 * fileread.cc: Likewise.
3417 * fileread.h: Likewise.
3419 * gold-threads.cc: Likewise.
3420 * gold.cc: Likewise.
3421 * i386.cc: Likewise.
3423 * incremental-dump.cc: Likewise.
3424 * incremental.cc: Likewise.
3425 * layout.cc: Likewise.
3426 * layout.h: Likewise.
3427 * main.cc: Likewise.
3428 * merge.cc: Likewise.
3429 * merge.h: Likewise.
3430 * object.cc: Likewise.
3431 * object.h: Likewise.
3432 * options.cc: Likewise.
3433 * options.h: Likewise.
3434 * output.cc: Likewise.
3435 * output.h: Likewise.
3436 * plugin.cc: Likewise.
3437 * plugin.h: Likewise.
3438 * powerpc.cc: Likewise.
3439 * reloc.cc: Likewise.
3440 * script-c.h: Likewise.
3441 * script-sections.cc: Likewise.
3442 * script.cc: Likewise.
3443 * stringpool.cc: Likewise.
3444 * symtab.cc: Likewise.
3445 * symtab.h: Likewise.
3446 * target.cc: Likewise.
3447 * timer.cc: Likewise.
3448 * timer.h: Likewise.
3449 * version.cc: Likewise.
3450 * x86_64.cc: Likewise.
3452 2010-08-24 Nick Clifton <nickc@redhat.com>
3455 * layout.cc (segment_precedes): Sort segments by their physical
3456 addresses, if they have been set.
3458 2010-08-23 Cary Coutant <ccoutant@google.com>
3460 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
3462 (Lib_group::include_member): Unlock object after deleting its
3464 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
3467 2010-08-19 Neil Vachharajani <nvachhar@google.com>
3468 Cary Coutant <ccoutant@google.com>
3470 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
3471 constructor, and set_blocker.
3472 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
3474 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
3475 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
3476 * testsuite/Makefile.am (start_lib_test): New test case.
3477 * testsuite/Makefile.in: Regenerate.
3478 * testsuite/start_lib_test_main.c: New file.
3479 * testsuite/start_lib_test_1.c: New file.
3480 * testsuite/start_lib_test_2.c: New file.
3481 * testsuite/start_lib_test_3.c: New file.
3483 2010-08-19 Ian Lance Taylor <iant@google.com>
3485 * Makefile.in: Rebuild with automake 1.11.1.
3486 * aclocal.m4: Likewise.
3487 * testsuite/Makefile.in: Likewise.
3489 2010-08-19 Ian Lance Taylor <iant@google.com>
3492 * i386.cc (class Output_data_plt_i386): Update declarations.
3493 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
3494 local_ifuncs_ fields.
3495 (Target_i386::do_plt_section_for_global): New function.
3496 (Target_i386::do_plt_section_for_local): New function.
3497 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
3498 parameter; change all callers. Initialize global_ifuncs_ and
3499 local_ifuncs_. If doing a static link define __rel_iplt_start and
3501 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
3502 (Output_data_plt_i386::add_local_ifunc_entry): New function.
3503 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
3505 (Target_i386::make_plt_section): New function, broken out of
3506 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
3507 (Target_i386::make_plt_entry): Call make_plt_section.
3508 (Target_i386::make_local_ifunc_plt_entry): New function.
3509 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
3510 (Target_i386::Scan::local): Handle IFUNC symbols. Add
3511 R_386_IRELATIVE to switch.
3512 (Target_i386::Scan::global): Likewise.
3513 (Target_i386::Relocate::relocate): Likewise.
3514 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
3516 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
3517 (Target_x86_64::do_plt_section_for_global): New function.
3518 (Target_x86_64::do_plt_section_for_local): New function.
3519 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
3520 parameter; change all callers. If doing a static link define
3521 __rela_iplt_start and __rela_iplt_end.
3522 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
3523 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
3524 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
3526 (Target_x86_64::make_local_ifunc_plt_entry): New function.
3527 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
3529 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
3530 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
3531 R_X86_64_IRELATIVE to switch.
3532 (Target_x86_64::Scan::global): Likewise.
3533 (Target_x86_64::Relocate::relocate): Likewise.
3534 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
3536 * target.h (class Target): Add plt_section_for_global and
3537 plt_section_for_local functions. Add do_plt_section_for_global
3538 and do_plt_section_for_local virtual functions.
3539 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
3540 clarifying comments.
3541 (Symbol::use_plt_offset): Handle IFUNC symbol.
3542 * object.cc (Sized_relobj::Sized_relobj): Initialize
3544 (Sized_relobj::local_has_plt_offset): New function.
3545 (Sized_relobj::local_plt_offset): New function.
3546 (Sized_relobj::set_local_plt_offset): New function.
3547 (Sized_relobj::do_count): Handle IFUNC symbol.
3548 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
3549 a bit away from input_shndx_ field. Add set_is_func_symbol and
3550 is_ifunc_symbol functions.
3551 (class Sized_relobj): Update declarations. Remove Tls_got_entry
3552 and Local_tls_got_offsets. Define Local_plt_offsets. Add
3553 local_plt_offsets_ field.
3554 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
3555 * output.h (class Output_section_data): Add non-const
3556 output_section function.
3557 (class Output_data_got): Update declarations.
3558 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
3559 Add use_plt_offset parameter to global and local constructors.
3560 Change all callers. Change local_sym_index_ field to 31 bits.
3561 Change GSYM_CODE and CONSTANT_CODE accordingly.
3562 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
3563 doing a static link don't set sh_link field.
3564 (Output_data_got::Got_entry::write): Use PLT offset if
3566 (Output_data_got::add_global_plt): New function.
3567 (Output_data_got::add_local_plt): New function.
3568 * target-reloc.h (relocate_section): Handle IFUNC symbol.
3569 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
3570 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
3571 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
3572 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
3574 * testsuite/ifunc-sel.h: New file.
3575 * testsuite/ifuncmain1.c: New file.
3576 * testsuite/ifuncmain1vis.c: New file.
3577 * testsuite/ifuncmod1.c: New file.
3578 * testsuite/ifuncdep2.c: New file.
3579 * testsuite/ifuncmain2.c: New file.
3580 * testsuite/ifuncmain3.c: New file.
3581 * testsuite/ifuncmod3.c: New file.
3582 * testsuite/ifuncmain4.c: New file.
3583 * testsuite/ifuncmain5.c: New file.
3584 * testsuite/ifuncmod5.c: New file.
3585 * testsuite/ifuncmain6pie.c: New file.
3586 * testsuite/ifuncmod6.c: New file.
3587 * testsuite/ifuncmain7.c: New file.
3588 * configure, testsuite/Makefile.in: Rebuild.
3590 2010-08-18 Ian Lance Taylor <iant@google.com>
3593 (Output_section_incremental_inputs::write_input_files): Add cast
3594 to avoid signed/unsigned comparison warning.
3595 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3597 2010-08-12 Cary Coutant <ccoutant@google.com>
3599 * common.cc (Sort_commons::operator()): Remove unnecessary code.
3601 2010-08-13 Ian Lance Taylor <iant@google.com>
3603 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
3605 2010-08-12 Cary Coutant <ccoutant@google.com>
3606 Doug Kwan <dougkwan@google.com>
3608 * resolve.cc (Symbol_table::should_override): When a weak dynamic
3609 defintion overrides non-weak undef, remember that the original undef
3611 * symtab.cc (Symbol_table::sized_write_global): For undef without
3612 an original weak binding, set binding to global in output.
3613 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
3614 * testsuite/Makefile.in: Regenerate.
3615 * testsuite/strong_ref_weak_def.sh: New file.
3616 * testsuite/strong_ref_weak_def_1.c: Ditto.
3617 * testsuite/strong_ref_weak_def_2.c: Ditto.
3619 2010-08-12 Cary Coutant <ccoutant@google.com>
3621 * testsuite/incremental_test.sh: Rewrite.
3622 * testsuite/incremental_test_1.c: Rewrite.
3623 * testsuite/incremental_test_2.c: Rewrite.
3625 2010-08-12 Cary Coutant <ccoutant@google.com>
3627 * arm.cc (Target_arm::got_size): Add const.
3628 (Target_arm::got_entry_count): New function.
3629 (Target_arm::plt_entry_count): New function.
3630 (Target_arm::first_plt_entry_offset): New function.
3631 (Target_arm::plt_entry_size): New function.
3632 (Output_data_plt_arm::entry_count): New function.
3633 (Output_data_plt_arm::first_plt_entry_offset): New function.
3634 (Output_data_plt_arm::get_plt_entry_size): New function.
3635 * i386.cc (Target_i386::got_size): Add const.
3636 (Target_i386::got_entry_count): New function.
3637 (Target_i386::plt_entry_count): New function.
3638 (Target_i386::first_plt_entry_offset): New function.
3639 (Target_i386::plt_entry_size): New function.
3640 (Output_data_plt_i386::entry_count): New function.
3641 (Output_data_plt_i386::first_plt_entry_offset): New function.
3642 (Output_data_plt_i386::get_plt_entry_size): New function.
3643 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
3644 find_incremental_inputs_sections. Dump incremental_got_plt section.
3645 * incremental.cc: Include target.h.
3646 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
3647 parameter. Adjust all callers. Find incremental_got_plt section.
3648 (Incremental_inputs::create_data_sections): Create incremental_got_plt
3650 (Output_section_incremental_inputs::set_final_data_size): Calculate
3651 size of incremental_got_plt section.
3652 (Output_section_incremental_inputs::do_write): Write the
3653 incremental_got_plt section.
3654 (Got_plt_view_info): New struct.
3655 (Local_got_offset_visitor): New class.
3656 (Global_got_offset_visitor): New class.
3657 (Global_symbol_visitor_got_plt): New class.
3658 (Output_section_incremental_inputs::write_got_plt): New function.
3659 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
3660 Add parameter. Adjust all callers.
3661 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3662 (Incremental_inputs::got_plt_section): New function.
3663 (Incremental_inputs::got_plt_section_): New data member.
3664 (Incremental_got_plt_reader): New class.
3665 * layout.cc (Layout::create_incremental_info_sections): Add the
3666 incremental_got_plt section.
3667 * object.h (Got_offset_list::get_list): New function.
3668 (Got offset_list::for_all_got_offsets): New function.
3669 (Sized_relobj::local_got_offset_list): New function.
3670 * powerpc.cc (Target_powerpc::got_size): Add const.
3671 (Target_powerpc::got_entry_count): New function.
3672 (Target_powerpc::plt_entry_count): New function.
3673 (Target_powerpc::first_plt_entry_offset): New function.
3674 (Target_powerpc::plt_entry_size): New function.
3675 (Output_data_plt_powerpc::entry_count): New function.
3676 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
3677 (Output_data_plt_powerpc::get_plt_entry_size): New function.
3678 * sparc.cc (Target_sparc::got_size): Add const.
3679 (Target_sparc::got_entry_count): New function.
3680 (Target_sparc::plt_entry_count): New function.
3681 (Target_sparc::first_plt_entry_offset): New function.
3682 (Target_sparc::plt_entry_size): New function.
3683 (Output_data_plt_sparc::entry_count): New function.
3684 (Output_data_plt_sparc::first_plt_entry_offset): New function.
3685 (Output_data_plt_sparc::get_plt_entry_size): New function.
3686 * symtab.h (Symbol::got_offset_list): New function.
3687 (Symbol_table::for_all_symbols): New function.
3688 * target.h (Sized_target::got_entry_count): New function.
3689 (Sized_target::plt_entry_count): New function.
3690 (Sized_target::plt_entry_size): New function.
3691 * x86_64.cc (Target_x86_64::got_size): Add const.
3692 (Target_x86_64::got_entry_count): New function.
3693 (Target_x86_64::plt_entry_count): New function.
3694 (Target_x86_64::first_plt_entry_offset): New function.
3695 (Target_x86_64::plt_entry_size): New function.
3696 (Output_data_plt_x86_64::entry_count): New function.
3697 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
3698 (Output_data_plt_x86_64::get_plt_entry_size): New function.
3700 2010-08-12 Cary Coutant <ccoutant@google.com>
3702 * archive.cc: Include incremental.h.
3703 (Archive::Archive): Initialize incremental_info_.
3704 (Archive::include_member): Record archive members in incremental info.
3705 (Add_archive_symbols::run): Record begin and end of an archive in
3707 (Lib_group::include_member): Record objects in incremental info.
3708 * archive.h (Incremental_archive_entry): Forward declaration.
3709 (Archive::set_incremental_info): New member function.
3710 (Archive::incremental_info): New member function.
3711 (Archive::Unused_symbol_iterator): New class.
3712 (Archive::unused_symbols_begin): New member function.
3713 (Archive::unused_symbols_end): New member function.
3714 (Archive::incremental_info_): New data member.
3715 * incremental-dump.cc (find_input_containing_global): New function.
3716 (dump_incremental_inputs): Dump new incremental info sections.
3717 * incremental.cc: Include symtab.h.
3718 (Output_section_incremental_inputs): New class.
3719 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
3720 new incremental info sections.
3721 (Sized_incremental_binary::do_check_inputs): Likewise.
3722 (Incremental_inputs::report_archive): Remove.
3723 (Incremental_inputs::report_archive_begin): New function.
3724 (Incremental_inputs::report_archive_end): New function.
3725 (Incremental_inputs::report_object): New function.
3726 (Incremental_inputs::finalize_inputs): Remove.
3727 (Incremental_inputs::report_input_section): New function.
3728 (Incremental_inputs::report_script): Rewrite.
3729 (Incremental_inputs::finalize): Do nothing but finalize string table.
3730 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3731 (Incremental_inputs::sized_create_inputs_section_data): Remove.
3732 (Incremental_inputs::create_data_sections): New function.
3733 (Incremental_inputs::relocs_entsize): New function.
3734 (Output_section_incremental_inputs::set_final_data_size): New function.
3735 (Output_section_incremental_inputs::do_write): New function.
3736 (Output_section_incremental_inputs::write_header): New function.
3737 (Output_section_incremental_inputs::write_input_files): New function.
3738 (Output_section_incremental_inputs::write_info_blocks): New function.
3739 (Output_section_incremental_inputs::write_symtab): New function.
3740 * incremental.h (Incremental_script_entry): Forward declaration.
3741 (Incremental_object_entry): Forward declaration.
3742 (Incremental_archive_entry): Forward declaration.
3743 (Incremental_inputs): Forward declaration.
3744 (Incremental_inputs_header_data): Remove.
3745 (Incremental_inputs_header): Remove.
3746 (Incremental_inputs_header_write): Remove.
3747 (Incremental_inputs_entry_data): Remove.
3748 (Incremental_inputs_entry): Remove.
3749 (Incremental_inputs_entry_write): Remove.
3750 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
3751 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
3752 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3753 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
3755 (Incremental_input_entry): New class.
3756 (Incremental_script_entry): New class.
3757 (Incremental_object_entry): New class.
3758 (Incremental_archive_entry): New class.
3759 (Incremental_inputs::Incremental_inputs): Initialize new data members.
3760 (Incremental_inputs::report_inputs): Remove.
3761 (Incremental_inputs::report_archive): Remove.
3762 (Incremental_inputs::report_archive_begin): New function.
3763 (Incremental_inputs::report_archive_end): New function.
3764 (Incremental_inputs::report_object): Change prototype.
3765 (Incremental_inputs::report_input_section): New function.
3766 (Incremental_inputs::report_script): Change prototype.
3767 (Incremental_inputs::get_reloc_count): New function.
3768 (Incremental_inputs::set_reloc_count): New function.
3769 (Incremental_inputs::create_data_sections): New function.
3770 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3771 (Incremental_inputs::inputs_section): New function.
3772 (Incremental_inputs::symtab_section): New function.
3773 (Incremental_inputs::relocs_section): New function.
3774 (Incremental_inputs::get_stringpool): Add const.
3775 (Incremental_inputs::command_line): Add const.
3776 (Incremental_inputs::inputs): Remove.
3777 (Incremental_inputs::command_line_key): New function.
3778 (Incremental_inputs::input_file_count): New function.
3779 (Incremental_inputs::input_files): New function.
3780 (Incremental_inputs::relocs_entsize): New function.
3781 (Incremental_inputs::sized_create_inputs_section_data): Remove.
3782 (Incremental_inputs::finalize_inputs): Remove.
3783 (Incremental_inputs::Input_info): Remove.
3784 (Incremental_inputs::lock_): Remove.
3785 (Incremental_inputs::inputs_): Change type.
3786 (Incremental_inputs::inputs_map_): Remove.
3787 (Incremental_inputs::current_object_entry_): New data member.
3788 (Incremental_inputs::inputs_section_): New data member.
3789 (Incremental_inputs::symtab_section_): New data member.
3790 (Incremental_inputs::relocs_section_): New data member.
3791 (Incremental_inputs::reloc_count_): New data member.
3792 (Incremental_inputs_reader): New class.
3793 (Incremental_symtab_reader): New class.
3794 (Incremental_relocs_reader): New class.
3795 * layout.cc (Layout::finalize): Move finalization of incremental info
3796 and creation of incremental info sections to follow finalization of
3797 symbol table. Set offsets for postprocessing sections.
3798 (Layout::create_incremental_info_sections): Call
3799 Incremental_inputs::create_data_sections. Add incremental symtab
3800 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
3801 sections to layout after input sections.
3802 * layout.h (struct Timespec): Forward declaration.
3803 (Layout::incremental_inputs): Add const.
3804 (Layout::create_incremental_info_sections): Add parameter.
3805 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
3806 * object.cc: Include incremental.h.
3807 (Relobj::finalize_incremental_relocs): New function.
3808 (Sized_relobj::do_layout): Record input sections in incremental info.
3809 * object.h (Object::output_section): New function.
3810 (Object::output_section_offset): Moved from Relobj.
3811 (Object::get_incremental_reloc_base): New function.
3812 (Object::get_incremental_reloc_count): New function.
3813 (Object::do_output_section): New function.
3814 (Object::do_output_section_offset): Moved from Relobj.
3815 (Object::do_get_incremental_reloc_base): New function.
3816 (Object::do_get_incremental_reloc_count): New function.
3817 (Object::Object): Initialize new data members.
3818 (Relobj::output_section): Renamed do_output_section and moved to
3820 (Relobj::output_section_offset): Moved to Object.
3821 (Relobj::do_get_incremental_reloc_base): New function.
3822 (Relobj::do_get_incremental_reloc_count): New function.
3823 (Relobj::allocate_incremental_reloc_counts): New function.
3824 (Relobj::count_incremental_reloc): New function.
3825 (Relobj::finalize_incremental_relocs): New function.
3826 (Relobj::next_incremental_reloc_index): New function.
3827 (Relobj::reloc_counts_): New data member.
3828 (Relobj::reloc_bases_): New data member.
3829 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
3830 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
3831 (Sized_relobj::incremental_relocs_scan): New function.
3832 (Sized_relobj::incremental_relocs_scan_reltype): New function.
3833 (Sized_relobj::incremental_relocs_write): New function.
3834 (Sized_relobj::incremental_relocs_write_reltype): New function.
3835 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
3837 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
3838 archives and object files elsewhere.
3839 (Add_symbols::run): Report object files here.
3840 (Finish_group::run): Report end of archive at end of group.
3841 * reloc.cc: Include layout.h, incremental.h.
3842 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
3843 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
3844 (Sized_relobj::incremental_relocs_scan): New function.
3845 (Sized_relobj::incremental_relocs_scan_reltype): New function.
3846 (Sized_relobj::do_relocate_sections): Write incremental relocations.
3847 (Sized_relobj::incremental_relocs_write): New function.
3848 (Sized_relobj::incremental_relocs_write_reltype): New function.
3849 * script.cc (read_input_script): Rewrite test for incremental link.
3850 Change call to Incremental_inputs::report_script.
3851 * symtab.h (Symbol_table::first_global_index): New function.
3852 (Symbol_table::output_count): New function.
3854 2010-08-12 Doug Kwan <dougkwan@google.com>
3856 * arm.cc (Target_arm::merge_object_attributes): Check command line
3857 options --no-wchar-size-warning and --no-enum-size-warning.
3858 * options.h (General_options): Add ld-compatible options
3859 --no-enum-size-warning and --no-wchar-size-warning.
3861 2010-08-04 Ian Lance Taylor <iant@google.com>
3863 * x86_64.cc (Target_x86_64::Scan::local): Use
3864 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
3865 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
3866 (Target_x86_64::Scan::global): Likewise.
3867 (Target_x86_64::Relocate::relocate): Likewise.
3868 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
3871 2010-08-03 Cary Coutant <ccoutant@google.com>
3873 * merge.cc (Output_merge_string::do_add_input_section): Count strings
3874 to reserve space in merged_strings vector. Keep total input size
3876 (Output_merge_string::do_print_merge_stats): Print total input size.
3877 * merge.h (Output_merge_string): Add input_size_ field.
3878 * stringpool.cc (Stringpool_template::string_length): Move
3879 implementations out of Stringpool_template class and place in
3881 * stringpool.h (string_length): Move out of Stringpool_template.
3883 2010-08-03 Ian Lance Taylor <iant@google.com>
3886 * layout.cc (relaxation_loop_body): If address of load segment is
3887 set, adjust address to include headers if possible.
3889 2010-08-03 Ian Lance Taylor <iant@google.com>
3891 * version.cc (version_string): Bump to 1.10.
3893 2010-08-03 Ian Lance Taylor <iant@google.com>
3896 * layout.h (enum Output_section_order): Define.
3897 (class Layout): Update declarations.
3898 * layout.cc (Layout::get_output_section): Add order parameter.
3899 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
3900 is_first_non_relro parameters. Change all callers.
3901 (Layout::choose_output_section): Likewise.
3902 (Layout::add_output_section_data): Likewise.
3903 (Layout::make_output_section): Likewise. Set order.
3904 (Layout::default_section_order): New function.
3905 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
3906 * output.cc (Output_section::Output_section): Initialize order_.
3907 Don't initialize deleted fields.
3908 (Output_segment::Output_segment): Don't initialize deleted
3910 (Output_segment::add_output_section_to_load): New function
3911 replacing add_output_section. Change all callers to call this or
3912 add_output_section_to_nonload.
3913 (Output_segment::add_output_section_to_nonload): New function.
3914 (Output_segment::remove_output_section): Rewrite.
3915 (Output_segment::add_initial_output_data): Likewise.
3916 (Output_segment::has_any_data_sections): Likewise.
3917 (Output_segment::is_first_section_relro): Likewise.
3918 (Output_segment::maximum_alignment): Likewise.
3919 (Output_segment::has_dynamic_reloc): New function replacing
3920 dynamic_reloc_count. Change all callers.
3921 (Output_segment::has_dynamic_reloc_list): New function replacing
3922 dynamic_reloc_count_list. Change all callers.
3923 (Output_segment::set_section_addresses): Rewrite.
3924 (Output_segment::set_offset): Rewrite.
3925 (Output_segment::find_first_and_last_list): Remove.
3926 (Output_segment::set_tls_offsets): Rewrite.
3927 (Output_segment::first_section_load_address): Likewise.
3928 (Output_segment::output_section_count): Likewise.
3929 (Output_segment::section_with_lowest_load_address): Likewise.
3930 (Output_segment::write_section_headers): Likewise.
3931 (Output_segment::print_sections_to_map): Likewise.
3932 * output.h (class Output_data): Remove dynamic_reloc_count_
3933 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
3934 (Output_data::add_dynamic_reloc): Rewrite.
3935 (Output_data::has_dynamic_reloc): New function.
3936 (Output_data::dynamic_reloc_count): Remove.
3937 (class Output_section): Add order_ field. Remvoe is_relro_local_,
3938 is_last_relro_, is_first_non_relro_, is_interp_,
3939 is_dynamic_linker_section_ fields. Add order and set_order
3940 functions. Remove is_relro_local, set_is_relro_local,
3941 is_last_relro, set_is_last_relro, is_first_non_relro,
3942 set_is_first_non_relro functions, is_interp, set_is_interp,
3943 is_dynamic_linker_section, and set_is_dynamic_linker_section
3945 (class Output_segment): Change Output_data_list from std::list to
3946 std:;vector. Add output_lists_ field. Remove output_data_ and
3947 output_bss_ fields. Update declarations.
3949 2010-08-02 Ian Lance Taylor <iant@google.com>
3951 * arm.cc (Target_arm::gc_process_relocs): Use typename.
3952 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
3953 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
3955 2010-08-02 Ian Lance Taylor <iant@google.com>
3958 * script.cc (Script_options::Script_options): Initialize
3959 symbol_definitions_ and symbol_references_.
3960 (Script_options::add_symbol_assignment): Update
3961 symbol_definitions_ and symbol_references_.
3962 (Script_options::add_symbol_reference): New function.
3963 (script_symbol): New function.
3964 * script.h (class Script_options): Add symbol_definitions_ and
3965 symbol_references_ fields.
3966 (Script_options::referenced_const_iterator): New type.
3967 (Script_options::referenced_begin): New function.
3968 (Script_options::referenced_end): New function.
3969 (Script_options::is_referenced): New function.
3970 (Script_options::any_unreferenced): New function.
3971 * script-c.h (script_symbol): Declare.
3972 * yyscript.y (exp): Call script_symbol.
3973 * symtab.cc: Include "script.h".
3974 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
3975 Change all callers. Check symbols referenced by scripts.
3976 (Symbol_table::add_undefined_symbols_from_command_line): Add
3977 layout parameter. Change all callers.
3978 (Symbol_table::do_add_undefined_symbols_from_command_line):
3979 Likewise. Break out loop body. Check symbols referenced by
3981 (Symbol_table::add_undefined_symbol_from_command_line): New
3982 function broken out of
3983 do_add_undefined_symbols_from_command_line.
3984 * symtab.h (class Symbol_table): Update declarations.
3985 * archive.cc: Include "layout.h".
3986 (Archive::should_include_member): Add layout parameter. Change
3987 all callers. Check for symbol mentioned in expression.
3988 * archive.h (class Archive): Update declaration.
3989 * object.cc (Sized_relobj::do_should_include_member): Add layout
3991 * object.h (Object::should_include_member): Add layout parameter.
3993 (Object::do_should_include_member): Add layout parameter.
3994 (class Sized_relobj): Update declaration.
3995 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
3997 * dynobj.h (class Sized_dynobj): Update declaration.
3998 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
4000 * plugin.h (class Sized_pluginobj): Update declaration.
4002 2010-08-02 Ian Lance Taylor <iant@google.com>
4005 * output.cc (Output_segment::set_offset): Search for the first and
4006 last sections rather than assuming that the list is in order.
4007 (Output_segment::find_first_and_last_list): New function.
4008 * output.h (class Output_segment): Update declarations.
4009 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4010 (relro_strip_test_SOURCES): New variable.
4011 (relro_strip_test_DEPENDENCIES): New variable.
4012 (relro_strip_test_LDFLAGS): New variable.
4013 (relro_strip_test_LDADD): New variable.
4014 (relro_strip_test.so): New target.
4016 2010-08-02 Ian Lance Taylor <iant@google.com>
4018 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4019 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4020 (Target_i386::got_tlsdesc_section): New function.
4021 (Target_i386::got_section): Create space for GOT entries for
4022 TLSDESC relocations.
4023 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4025 (Target_i386::Scan::global): Likewise.
4026 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
4028 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
4029 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
4030 (Target_x86_64::got_tlsdesc_section): New function.
4031 (Target_x86_64::got_section): Create space for GOT entries for
4032 TLSDESC relocations.
4033 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
4035 (Target_x86_64::Scan::global): Likewise.
4036 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
4039 2010-08-02 Ian Lance Taylor <iant@google.com>
4041 * testsuite/final_layout.sh: Use dc to convert from hex to
4044 2010-07-29 Sriraman Tallam <tmsriram@google.com>
4046 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4047 paramter to the call to gold::gc_process_relocs.
4048 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4049 paramter to the call to gold::gc_process_relocs.
4050 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4051 parameter to the call to gold::gc_process_relocs.
4052 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4053 template parameter to the call to gold::gc_process_relocs.
4054 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4055 paramter to the call to gold::gc_process_relocs.
4056 * gc.h (get_embedded_addend_size): New function.
4057 (gc_process_relocs): Save the size of the reloc for use by ICF.
4058 * icf.cc (get_section_contents): Get the addend from the text section
4059 for SHT_REL relocation sections.
4060 * icf.h (Icf::Reloc_addend_size_info): New typedef.
4061 (Icf::Reloc_info): Add new member reloc_addend_size_info.
4062 * int_encoding.h (read_from_pointer): New overloaded function.
4063 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
4064 * testsuite/icf_sht_rel_addend_test.sh: New file.
4065 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
4066 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
4068 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4070 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
4071 * Makefile.in: Regenerate.
4072 * testsuite/Makefile.in: Regenerate.
4074 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
4076 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
4077 * gold/testsuite/debug_msg.cc: Likewise.
4078 * gold/testsuite/odr_violation1.cc
4079 * gold/testsuite/odr_violation2.cc
4081 2010-07-21 Cary Coutant <ccoutant@google.com>
4083 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
4084 string, and length fields.
4085 (Output_merge_string::Merged_strings_list): New type.
4086 (Output_merge_string::Merged_strings_lists): New typedef.
4087 (Output_merge_string): Replace merged_strings_ with
4088 merged_strings_lists_.
4089 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
4090 Merged_strings_list per input object and section. Don't store pointer
4091 to the string. Don't store length with each merged string entry.
4092 (Output_merge_string::finalize_merged_data): Loop over list of merged
4093 strings lists. Recompute length of each merged string.
4095 2010-07-15 Cary Coutant <ccoutant@google.com>
4097 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
4100 2010-07-14 Ian Lance Taylor <iant@google.com>
4102 * descriptors.cc (Descriptors::open): Report correct name in error
4105 2010-07-13 Doug Kwan <dougkwan@google.com>
4107 * arm.cc (Arm_input_section::Arm_input_section): For a
4108 SHT_ARM_EXIDX section, always keeps the input sections.
4109 (Arm_input_section::set_exidx_section_link): New method.
4110 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
4111 has_errors_ to false.
4112 (Arm_exidx_input_section::has_errors,
4113 Arm_exidx_input_section::set_has_errors): New methods.
4114 (Arm_exidx_input_section::has_errors_): New data member.
4115 (Arm_relobj::get_exidx_shndx_list): New method.
4116 (Arm_output_section::append_text_sections_to_list): Do not skip
4117 section without SHF_EXECINSTR.
4118 (Arm_output_section::fix_exidx_coverage): Skip input sections with
4120 (Arm_relobj::make_exidx_input_section): Add new parameter for text
4121 section header. Make error messages more verbose. Check for
4122 a non-executable section linked to an EXIDX section.
4123 (Arm_relobj::do_read_symbols): Remove error checking, which has been
4124 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
4125 check that there is no deferred EXIDX section if we exit early.
4126 Instead of not making an EXIDX section in case of an error, make one
4127 and set the has_errors flag of it.
4128 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
4129 in a relocatable link.
4130 (Target_arm::do_relax): Look for the EXIDX output section instead of
4131 assuming that it is called .ARM.exidx.
4132 (Target_arm::fix_exidx_coverage): Add a new parameter for input
4133 section list. Do not check for SHF_EXECINSTR section flags but
4134 skip any input section with errors.
4135 * output.cc (Output_section::Output_section): Initialize
4136 always_keeps_input_sections_ to false.
4137 (Output_section::add_input_section): Check for
4138 always_keeps_input_sections_.
4139 * output.h (Output_section::always_keeps_input_sections,
4140 Output_section::set_always_keeps_input_sections): New methods.
4141 (Output_section::always_keeps_input_sections): New data member.
4143 2010-07-13 Rafael Espindola <espindola@google.com>
4145 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
4146 * fileread.h (Input_file): Add try_extra_search_path and find_file.
4148 2010-07-13 Philip Herron <herron.philip@googlemail.com>
4149 Ian Lance Taylor <iant@google.com>
4151 * output.h (Output_section_lookup_maps::add_merge_section):
4152 Correct check of whether value was inserted.
4153 (Output_section_lookup_maps::add_merge_input_section): Likewise.
4154 (Output_section_lookup_maps::add_relaxed_input_section):
4156 * arm.cc (Target_arm::got_section): Remove used local os.
4157 * i386.cc (Target_i386::got_section): Likewise.
4158 * x86_64.cc (Target_x86_64::got_section): Likewise.
4159 * sparc.cc (Target_sparc::got_section): Likewise.
4160 (Target_sparc::relocate): Remove unused local have_got_offset.
4161 * powerpc.cc (Target_powerpc::relocate): Likewise.
4163 2010-07-13 Ian Lance Taylor <iant@google.com>
4165 * compressed_output.cc (zlib_decompress): Fix signature in
4168 * archive.cc (Archive::include_member): Unlock an external member
4169 of a thin archive. Don't bother to delete an object we know is
4172 2010-07-12 Cary Coutant <ccoutant@google.com>
4174 * compressed_output.cc (zlib_decompress): New function.
4175 (get_uncompressed_size): New function.
4176 (decompress_input_section): New function.
4177 * compressed_output.h (get_uncompressed_size): New function.
4178 (decompress_input_section): New function.
4179 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
4180 Handle compressed debug sections.
4181 * layout.cc (is_compressed_debug_section): New function.
4182 (Layout::output_section_name): Map compressed section names to
4184 * layout.h (is_compressed_debug_section): New function.
4185 (is_debug_info_section): Recognize compressed debug sections.
4186 * merge.cc: Include compressed_output.h.
4187 (Output_merge_data::do_add_input_section): Handle compressed
4189 (Output_merge_string::do_add_input_section): Handle compressed
4191 * object.cc: Include compressed_output.h.
4192 (Sized_relobj::Sized_relobj): Initialize new data members.
4193 (build_compressed_section_map): New function.
4194 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
4195 * object.h (Object::section_is_compressed): New method.
4196 (Object::do_section_is_compressed): New method.
4197 (Sized_relobj::Compressed_section_map): New type.
4198 (Sized_relobj::do_section_is_compressed): New method.
4199 (Sized_relobj::compressed_sections_): New data member.
4200 * output.cc (Output_section::add_input_section): Handle compressed
4202 * reloc.cc: Include compressed_output.h.
4203 (Sized_relobj::write_sections): Handle compressed debug sections.
4205 2010-07-08 Cary Coutant <ccoutant@google.com>
4207 * resolve.cc (Symbol_table::resolve): Remember whether undef was
4208 weak when resolving to a dynamic def.
4209 (Symbol_table::should_override): Add adjust_dyndef flag; set it
4210 for weak undef/dynamic def cases. Adjust callers.
4211 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
4212 undef_binding_weak_.
4213 (Symbol_table::sized_write_globals): Adjust symbol binding.
4214 (Symbol_table::sized_write_symbol): Add binding parameter.
4215 * symtab.h (Symbol::set_undef_binding): New method.
4216 (Symbol::is_undef_binding_weak): New method.
4217 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
4218 (Symbol_table::should_override): Add new parameter.
4219 (Symbol_table::sized_write_symbol): Add new parameter.
4221 * testsuite/weak_undef_file1.cc: Add new test case.
4222 * testsuite/weak_undef_file2.cc: Fix header comment.
4223 * testsuite/weak_undef_test.cc: Add new test case.
4225 2010-06-29 Doug Kwan <dougkwan@google.com>
4227 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
4228 Initialize USE_SYMBOL_.
4229 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
4231 (Arm_reloc_property::uses_symbol_): New data member declaration.
4232 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
4233 uses symbol value and symbol is undefined but not weakly undefined.
4235 2010-06-28 Rafael Espindola <espindola@google.com>
4237 * plugin.cc (Plugin::load): Use dlerror.
4239 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
4241 * symtab.cc (detect_odr_violations): When reporting an ODR
4242 violation, report an object where the symbol is defined.
4244 2010-06-25 Doug Kwan <dougkwan@google.com>
4246 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
4247 (Target_arm::section_may_have_icf_unsafe_pointers): New method
4249 (Target_arm::Scan::local_reloc_may_be_function_pointer,
4250 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
4251 target hook to detect function points.
4252 (Target_arm::Scan::possible_function_pointer_reloc): New method.
4253 * icf.h (Icf::check_section_for_function_pointers): Change type of
4254 parameter SECTION_NAME to const reference to std::string. Use
4255 target hook to determine if section may have unsafe pointers.
4256 * target.h (Target::section_may_have_icf_unsafe_pointers): New
4259 2010-06-21 Rafael Espindola <espindola@google.com>
4261 * fileread.cc (Input_file::find_fie): New
4262 (Input_file::open): Use Input_file::find_fie.
4263 * fileread.h (Input_file::find_fie): New
4264 * plugin.cc (set_extra_library_path): New.
4265 (Plugin::load): Add set_extra_library_path to the transfer vector.
4266 (Plugin_manager::set_extra_library_path): New.
4267 (Plugin_manager::add_input_file): Use the extra search path if set.
4268 (set_extra_library_path(): New.
4269 * plugin.h (Plugin_manager): Add set_extra_library_path and
4272 2010-06-19 Cary Coutant <ccoutant@google.com>
4274 * layout.cc (gdb_sections): Add .debug_types.
4275 (lines_only_debug_sections): Likewise.
4277 2010-06-18 Rafael Espindola <espindola@google.com>
4279 * plugin.cc (add_input_file,add_input_library)
4280 (Plugin_manager::add_input_file): Make filename arguments const.
4281 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
4284 2010-06-16 Doug Kwan <dougkwan@google.com>
4286 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
4287 .ARM.attributes section if we have not merged any input
4288 attributes sections.
4290 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4292 * arm.cc: Allow combining objects with no EABI version
4295 2010-06-15 Rafael Espindola <espindola@google.com>
4297 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
4299 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4301 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
4302 (struct iovec): Correct !HAVE_READV definition.
4304 2010-06-10 Cary Coutant <ccoutant@google.com>
4306 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
4307 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
4309 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
4312 * symtab.h (Symbol::is_placeholder): New member function.
4313 * target-reloc.h (relocate_section): Check for placeholder symbols.
4315 * testsuite/Makefile.am (plugin_test_8): New test.
4316 (plugin_test_9): New test.
4317 * testsuite/Makefile.in: Regenerate.
4319 2010-06-09 Nick Clifton <nickc@redhat.com>
4321 * yyscript.y (input_list_element): Allow strings prefixed with
4322 the '-' character. Treat these as libraries.
4323 * script.cc (script_add_library): New function. Adds a library
4324 specified by "-l<name>" found in an input script.
4325 * script-c.h: Add prototype for script_add_library.
4327 2010-06-07 Doug Kwan <dougkwan@google.com>
4329 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
4330 Restrict stub-group size to be within long conditional branch
4331 range when working around cortex-A8 erratum.
4333 2010-06-07 Damien Diederen <dd@crosstwine.com>
4335 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
4338 2010-06-03 Sriraman Tallam <tmsriram@google.com>
4342 (Output_section::Input_section_sort_entry::compare_section_ordering):
4343 Change to return non-zero correctly.
4344 (Output_section::Input_section_sort_section_order_index_compare
4345 ::operator()): Change to fix ambiguity in comparisons.
4347 2010-06-01 Sriraman Tallam <tmsriram@google.com>
4349 * gold.h (is_wildcard_string): New function.
4350 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
4351 (Layout::layout_eh_frame): Ditto.
4352 (Layout::find_section_order_index): New method.
4353 (Layout::read_layout_from_file): New method.
4354 * layout.h (Layout::find_section_order_index): New method.
4355 (Layout::read_layout_from_file): New method.
4356 (Layout::input_section_position_): New private member.
4357 (Layout::input_section_glob_): New private member.
4358 * main.cc (main): Call read_layout_from_file here.
4359 * options.h (--section-ordering-file): New option.
4360 * output.cc (Output_section::input_section_order_specified_): New
4362 (Output_section::Output_section): Initialize new member.
4363 (Output_section::add_input_section): Add new parameter.
4364 Keep input sections when --section-ordering-file is used.
4365 (Output_section::set_final_data_size): Sort input sections when
4366 section ordering file is specified.
4367 (Output_section::Input_section_sort_entry): Add new parameter.
4369 (Output_section::Input_section_sort_entry::compare_section_ordering):
4371 (Output_section::Input_section_sort_compare::operator()): Change to
4372 consider section_order_index.
4373 (Output_section::Input_section_sort_init_fini_compare::operator()):
4374 Change to consider section_order_index.
4375 (Output_section::Input_section_sort_section_order_index_compare
4376 ::operator()): New method.
4377 (Output_section::sort_attached_input_sections): Change to sort
4378 according to section order when specified.
4379 (Output_section::add_input_section<32, true>): Add new parameter.
4380 (Output_section::add_input_section<64, true>): Add new parameter.
4381 (Output_section::add_input_section<32, false>): Add new parameter.
4382 (Output_section::add_input_section<64, false>): Add new parameter.
4383 * output.h (Output_section::add_input_section): Add new parameter.
4384 (Output_section::input_section_order_specified): New
4386 (Output_section::set_input_section_order_specified): New method.
4387 (Input_section::Input_section): Initialize section_order_index_.
4388 (Input_section::section_order_index): New method.
4389 (Input_section::set_section_order_index): New method.
4390 (Input_section::section_order_index_): New member.
4391 (Input_section::Input_section_sort_section_order_index_compare): New
4393 (Output_section::input_section_order_specified_): New member.
4394 * script-sections.cc (is_wildcard_string): Delete and move modified
4396 (Output_section_element_input::Output_section_element_input): Modify
4397 call to is_wildcard_string.
4398 (Output_section_element_input::Input_section_pattern
4399 ::Input_section_pattern): Ditto.
4400 (Output_section_element_input::Output_section_element_input): Ditto.
4401 * testsuite/Makefile.am (final_layout): New test case.
4402 * testsuite/Makefile.in: Regenerate.
4403 * testsuite/final_layout.cc: New file.
4404 * testsuite/final_layout.sh: New file.
4406 2010-06-01 Rafael Espindola <espindola@google.com>
4408 * plugin.cc (Plugin::load): Pass the output name to the plugin.
4410 2010-06-01 Rafael Espindola <espindola@google.com>
4412 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
4413 visibility of symbols.
4415 2010-05-27 Doug Kwan <dougkwan@google.com>
4417 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
4418 from start of output section instead of address for a local symbol
4419 in a merged or relaxed section when doing a relocatable link.
4421 2010-05-26 Rafael Espindola <espindola@google.com>
4424 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
4425 adding sections the garbage collector removed.
4426 * gold/testsuite/Makefile.am: Add test.
4427 * gold/testsuite/Makefile.in: Regenerate.
4428 * gold/testsuite/plugin_test_7.sh: New.
4429 * gold/testsuite/plugin_test_7_1.c: New.
4430 * gold/testsuite/plugin_test_7_2.c: New.
4432 2010-05-26 Rafael Espindola <espindola@google.com>
4434 * script-sections.cc (Output_section_definition::set_section_addresses):
4435 Check for --section-start.
4437 2010-05-26 Doug Kwan <dougkwan@google.com>
4439 * arm.cc (Arm_scan_relocatable_relocs): New class.
4440 (Target_arm::relocate_special_relocatable): New method.
4441 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
4442 (Arm_relocate_functions::thumb_branch_common): Same.
4443 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
4444 instead of Default_scan_relocatable_relocs.
4445 * target-reloc.h (relocate_for_relocatable): Let target handle
4446 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
4447 * target.h (Sized_target::relocate_special_relocatable): New method.
4449 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4451 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
4453 2010-05-23 Doug Kwan <dougkwan@google.com>
4455 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
4457 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
4458 with a direct branch, not a conditional branch, to a stub.
4459 * merge.cc (Output_merge_base::record_input_section): New method
4461 (Output_merge_data::do_add_input_section): Record input section if
4462 keeps-input-sections flag is set.
4463 (Output_merge_string::do_add_input_section): Ditto.
4464 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
4465 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
4467 (Output_merge_base::keeps_input_sections,
4468 Output_merge_base::set_keeps_input_sections,
4469 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
4471 (Output_merge_base::Input_sections): New type declaration.
4472 (Output_merge_base::input_sections_begin,
4473 Output_merge_base::input_sections_end,
4474 Output_merge_base::do_set_keeps_input_sections): New method definitions.
4475 (Output_merge_base::bool keeps_input_sections_,
4476 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
4477 Output_merge_base::input_sections_): New data members.
4478 (Output_merge_data::do_set_keeps_input_sections): New method
4480 (Output_merge_string::do_set_keeps_input_sections): Ditto.
4481 * output.cc (Output_section::Input_section::relobj): Move method
4482 defintion from class declaration to here and handle merge sections.
4483 (Output_section::Input_section::shndx): Ditto.
4484 (Output_section::Output_section): Remove initializations of removed
4485 data members and initialize new data member LOOKUP_MAPS_.
4486 (Output_section::add_input_section): Set keeps-input-sections flag
4487 for a newly created merge output section as appropriate. Adjust code
4488 to use Output_section_lookup_maps class.
4489 (Output_section::add_relaxed_input_section): Adjst code for lookup
4490 maps code refactoring.
4491 (Output_section::add_merge_input_section): Add a new parameter
4492 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
4493 class. If adding input section to a newly created merge output
4494 section fails, remove the new merge section.
4495 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
4496 Adjust code for use of the Output_section_lookup_maps class.
4497 (Output_section::find_merge_section): Ditto.
4498 (Output_section::build_lookup_maps): New method defintion.
4499 (Output_section::find_relaxed_input_section): Adjust code to use
4500 Output_section_lookup_maps class.
4501 (Output_section::get_input_sections): Export merge sections. Adjust
4502 code to use Output_section_lookup_maps class.
4503 (Output_section:::add_script_input_section): Adjust code to use
4504 Output_section_lookup_maps class. Update lookup maps for merge
4506 (Output_section::discard_states): Use Output_section_lookup_maps.
4507 (Output_section::restore_states): Same.
4508 * output.h (Merge_section_properties): Move class defintion out of
4510 (Output_section_lookup_maps): New class.
4511 (Output_section::Input_section::is_merge_section): New method
4513 (Output_section::Input_section::relobj): Move defintion out of class
4514 defintion. Declare method only.
4515 (Output_section::Input_section::shndx): Ditto.
4516 (Output_section::Input_section::output_merge_base): New method defintion.
4517 (Output_section::Input_section::u2_.pomb): New union field.
4518 (Output_section::Merge_section_by_properties_map,
4519 Output_section::Output_section_data_by_input_section_map,
4520 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
4522 (Output_section::add_merge_input_section): Add new parameter
4523 KEEPS_INPUT_SECTIONS.
4524 (Output_section::build_lookup_maps): New method declaration.
4525 (Output_section::merge_section_map_,
4526 Output_section::merge_section_by_properties_map_,
4527 Output_section::relaxed_input_section_map_,
4528 Output_section::is_relaxed_input_section_map_valid_): Remove data
4530 (Output_section::lookup_maps_): New data member.
4532 2010-05-21 Doug Kwan <dougkwan@google.com>
4535 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
4536 avoid a compilation error.
4538 2010-05-19 Rafael Espindola <espindola@google.com>
4540 * script-sections.cc (Output_section_definition::allocate_to_segment):
4541 Update the phdrs_list even when the output section is NULL.
4542 * testsuite/Makefile.am: Add test.
4543 * testsuite/Makefile.in: Regenerate.
4544 * testsuite/script_test_9.cc: New.
4545 * testsuite/script_test_9.sh: New.
4546 * testsuite/script_test_9.t: New.
4548 2010-05-19 Doug Kwan <dougkwan@google.com>
4550 * arm.cc (Arm_input_section::original_size): New method.
4551 (Arm_input_section::do_addralign): Add a cast.
4552 (Arm_input_section::do_output_offset): Remove static cast.
4553 (Arm_input_section::original_addralign,
4554 Arm_input_section::original_size_): Change type to uint32_t.
4555 (Arm_input_section::init): Add safe casts for section alignment
4557 (Arm_input_section::set_final_data_size): Do not set address and
4558 offset of stub table.
4559 (Arm_output_section::fix_exidx_coverage): Change use of of
4560 Output_section::Simple_input_section to that of
4561 Output_section::Input_section.
4562 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
4563 except for the first pass.
4564 * output.cc (Output_section::get_input_sections): Change type of
4565 input_sections to std::list<Input_section>.
4566 (Output_section::add_script_input_section): Rename from
4567 Output_section::add_simple_input_section. Change type of SIS
4568 parameter from Simple_input_section to Input_section.
4569 * output.h (Output_section::Simple_input_section): Remove class.
4570 (Output_section::Input_section): Change class visibility to public.
4571 (Output_section::Input_section::addralign): Use stored alignments
4572 for special input sections if set.
4573 (Output_section::Input_section::set_addralign): New method.
4574 (Output_section::get_input_sections): Change parameter type from
4575 list of Simple_input_section to list of Input_section.
4576 (Output_section::add_script_input_section): Rename from
4577 Output_section::add_simple_input_section. Change first parameter's
4578 type from Simple_input_section to Input_section and remove the
4579 second and third parameters.
4580 * script-sections.cc (Input_section::Input_section_list): Change
4581 type to list of Output_section::Input_section/
4582 (Input_section_info::Input_section_info): Change parameter type of
4583 INPUT_SECTION to Output_section::Input_section.
4584 (Input_section_info::input_section): Change return type.
4585 (Input_section_info::input_section_): Change type to
4586 Output_section::Input_section.
4587 (Output_section_element_input::set_section_addresses): Adjust code
4588 to use Output_section::Input_section instead of
4589 Output_section::Simple_input_section. Adjust code for renaming
4590 of Output_section::add_simple_input_section.
4591 (Orphan_output_section::set_section_addresses): Ditto.
4593 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4595 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
4596 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
4598 2010-05-18 Rafael Espindola <espindola@google.com>
4600 * options.cc (General_options::finalize): Handle -nostdlib.
4601 * options.h (nostdlib): New option.
4602 * script.cc (script_add_search_dir): Handle -nostdlib.
4604 2010-05-12 Doug Kwan <dougkwan@google.com>
4606 * arm.cc (Target_arm::do_finalize_sections): Create an empty
4607 attributes section only if there no attributes section after merging.
4608 (Target_arm::merge_object_attributes): Move value of
4609 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
4610 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
4611 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
4612 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
4613 and arm_attr_merge_7.stdout.
4614 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
4615 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
4616 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
4617 arm_attr_merge_7b.o): New rules.
4618 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
4620 * testsuite/Makefile.in: Regenerate.
4621 * testsuite/arm_attr_merge.sh: New file.
4622 * testsuite/arm_attr_merge_[67][ab].s: Same.
4624 2010-05-05 Nick Clifton <nickc@redhat.com>
4626 * po/es.po: Updated Spanish translation.
4628 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
4630 * Makefile.am (install-exec-local): Properly install gold as
4631 default cross linker.
4632 * Makefile.in: Regenerated.
4634 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
4635 Nick Clifton <nickc@redhat.com>
4637 * configure.ac (install_as_default): Define and set to false
4638 unless --enable-gold or --enable-gold=both/gold has been
4640 * configure: Regenerate.
4642 * Makefile.am (install-exec-local): Install the executable as
4643 'ld.gold'. If install_as_default is true then also install it as
4645 * Makefile.in: Regenerated.
4647 2010-04-24 Ian Lance Taylor <iant@google.com>
4649 * layout.cc (Layout::layout_reloc): In relocatable link don't
4650 combine reloc sections for grouped sections.
4652 2010-04-23 Sriraman Tallam <tmsriram@google.com>
4654 * gc.h (gc_process_relocs): Pass information on relocs pointing to
4655 sections that are not ordinary to icf.
4656 * icf.cc (get_section_contents): Handle relocation pointing to section
4657 with no object or shndx information.
4658 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
4659 * testsuite/Makefile.in: Regenerate.
4660 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
4661 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
4663 2010-04-22 Ian Lance Taylor <iant@google.com>
4665 * expression.cc (Expression::Expression_eval_info): Add
4666 result_alignment_pointer field.
4667 (Expression::eval_with_dot): Add result_alignment_pointer
4668 parameter. Change all callers.
4669 (Expression::eval_maybe_dot): Likewise.
4670 (class Binary_expression): Add alignment_pointer parameter to
4671 left_value and right_value. Change all callers.
4672 (BINARY_EXPRESSION): Set result alignment.
4673 (class Trinary_expression): Add alignment_pointer parameter to
4674 arg2_value and arg3_value. Change all callers.
4675 (Trinary_cond::value): Set result alignment.
4676 (Max_expression::value, Min_expression::value): Likewise.
4677 (Align_expression::value): Likewise.
4678 * script-sections.cc (class Sections_element): Add dot_alignment
4679 parameter to set_section_addresses virtual function. Update
4681 (class Output_section_element): Likewise.
4682 (Script_sections::create_segments): Add dot_alignment parameter.
4684 (Script_sections::create_segments_from_phdrs_clause): Likewise.
4685 (Script_sections::set_phdrs_clause_addresses): Likewise.
4686 * script-sections.h: Update declarations.
4687 * script.h: Update declarations.
4688 * output.h (Output_segment::set_minimum_p_align): Don't decrease
4690 * testsuite/script_test_3.t: Set large alignment.
4691 * testsuite/script_test_3.sh: Make sure that at least one LOAD
4692 segment has expected alignment.
4694 2010-04-22 Nick Clifton <nickc@redhat.com>
4696 * po/gold.pot: Updated by the Translation project.
4697 * po/vi.po: Updated Vietnamese translation.
4699 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
4701 * testsuite/Makefile.am (check_PROGRAMS): Add
4702 icf_virtual_function_folding_test.
4703 * testsuite/Makefile.in: Regenerated.
4705 2010-04-15 Andrew Haley <aph@redhat.com>
4707 * options.h (merge_exidx_entries): New option.
4708 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
4709 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
4710 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
4711 (Target_arm::merge_exidx_entries): New function.
4712 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
4713 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
4714 to Arm_exidx_fixup constructor.
4715 Add new arg, merge_exidx_entries.
4716 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
4717 Arm_output_section::fix_exidx_coverage.
4719 2010-04-18 Sriraman Tallam <tmsriram@google.com>
4721 * icf.cc (get_section_contents): Check for preemptible functions.
4722 Ignore addend when appropriate.
4723 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
4725 (add_from_relobj): Check for section folded.
4726 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
4727 * symtab.h (should_add_dynsym_entry): Add new parameter.
4728 * target-reloc.h (scan_relocs): Check for section folded.
4729 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
4730 Check reloc types for function pointers in shared objects.
4731 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
4733 (icf_preemptible_functions_test): New test case.
4734 (icf_string_merge_test): New test case.
4735 * testsuite.Makefile.in: Regenerate.
4736 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
4737 bar_glob. Refactor code.
4738 * testsuite/icf_preemptible_functions_test.cc: New file.
4739 * testsuite/icf_preemptible_functions_test.sh: New file.
4740 * testsuite/icf_string_merge_test.cc: New file.
4741 * testsuite/icf_string_merge_test.sh: New file.
4742 * testsuite/icf_virtual_function_folding_test.cc: New file.
4743 * testsuite/icf_virtual_function_folding_test.sh: New file.
4745 2010-04-14 Doug Kwan <dougkwan@google.com>
4747 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
4748 for local symbol recounting if we remove a section due to ICF.
4749 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
4750 there are no regular objects in input.
4752 2010-04-13 Doug Kwan <dougkwan@google.com>
4754 * arm.cc (Arm_input_section::set_final_data_size): Compute
4755 accurate final data size instead of using current data size.
4757 2010-04-09 Doug Kwan <dougkwan@google.com>
4759 * layout.cc (Layout::choose_output_section): Handle script section
4761 (Layout::make_output_section_for_script): Add section type parameter.
4762 Handle script section types.
4763 * layout.h (Layout::make_output_section_for_script): Add section
4765 * output.cc (Output_section::Output_section): Initialize data member
4767 (Output_section::do_reset_address_and_file_offset): Do not set address
4768 to 0 if section is a NOLOAD section.
4769 * output.h (Output_section::is_noload): New method.
4770 (Output_section::set_is_noload): Ditto.
4771 (Output_section::is_noload_): New data member.
4772 * script-c.h (Script_section_type): New enum type.
4773 (struct Parser_output_section_header): Add new file section_type.
4774 * script-sections.cc (Sections_element::output_section_name): Add
4775 parameter for returning script section type.
4776 (Output_section_definition::output_section_name): Ditto.
4777 (Output_section_definition::section_type)P; New method.
4778 (Output_section_definiton::script_section_type_name): Ditto.
4779 (Output_section_definition::script_section_type_): New data member.
4780 (Output_section_definition::Output_section_definition): Initialize
4781 data member Output_section_definition::script_section_type_.
4782 (Output_section_definition::create_sections): Pass script section type
4783 to Layout::make_output_section_for_script.
4784 (Output_section_definition::output_section_name): Return script
4785 section type to caller.
4786 (Output_section_definition::set_section_address): Do not advance
4787 dot value and load address if section type is NOLOAD. Set address
4788 of NOLOAD sections regardless of section flags.
4789 (Output_section_definition::print): Print section type if it is
4790 not SCRIPT_SECTION_TYPE_NONE.
4791 (Output_section_definition::section_type): New method.
4792 (Output_section_definition::script_section_type_name): Ditto.
4793 (Script_sections::output_section_name): Add new parameter
4794 PSECTION_TYPE for returning script section type. Pass it to
4795 section elements. Handle discard sections.
4796 (Sort_output_sections::operator()): Handle NOLOAD sections.
4797 * script-sections.h (Script_sections::Section_type): New enum type.
4798 (Script_sections::output_section_name): Add a new parameter for
4799 returning script section type.
4800 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
4802 * yyscript.y (union): Add new field SECTION_TYPE.
4803 (COPY, DSECT, INFO, NOLOAD): New tokens.
4804 (opt_address_and_section_type): Change type to output_section_header.
4805 (section_type): New non-terminal
4806 (section_header): Handle section type.
4807 (opt_address_and_section_type): Return section type value.
4809 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
4811 * testsuite/plugin_common_test_1.c (foo): Add prototype.
4812 * testsuite/plugin_common_test_2.c (foo): Likewise.
4814 2010-04-08 Doug Kwan <dougkwan@google.com>
4816 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
4818 * output.cc (Output_section::add_merge_input_section): Simplify
4819 code and return status of Output_merge_base::add_input_section.
4820 Update merge section map only if Output_merge_base::add_input_section
4823 2010-04-07 Doug Kwan <dougkwan@google.com>
4825 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
4826 if section is marked as containing instructions but has no mapping
4828 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
4829 correct section index.
4830 (Arm_relobj::find_linked_text_section): Ditto.
4832 2010-04-07 Cary Coutant <ccoutant@google.com>
4834 * archive.cc (include_member): Destroy Read_symbols_data object before
4836 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
4837 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
4838 (Read_symbols_data::~Read_symbols_data) New destructor.
4839 (Section_relocs::Section_relocs) New constructor.
4840 (Section_relocs::~Section_relocs) New destructor.
4841 (Read_relocs_data::Read_relocs_data) New constructor.
4842 (Read_relocs_data::~Read_relocs_data) New destructor.
4843 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
4844 pointers to NULL after deleting.
4846 2010-04-07 Doug Kwan <dougkwan@google.com>
4848 * arm.cc: Replace "endianity" with "endianness" in comments.
4849 (Arm_exidx_cantunwind): Ditto.
4850 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
4851 (Arm_relobj::merge_flags_and_attributes): New method.
4852 (Arm_relobj::merge_flags_and_attributes_): New data member.
4853 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
4854 (Arm_relobj::scan_sections_for_stubs): Ditto.
4855 (Arm_relobj::do_read_symbols): Check to see if we really want to
4856 merge processor-specific flags and attributes. Exit early if
4857 an object is empty except for section names and the undefined symbol.
4858 (Target_arm::do_finalize_sections): Move check for ELF format to
4859 Arm_relobj::do_read_symbols. Merge processor specific flags and
4860 attributes from a regular object only when we have determined that
4861 it is aapropriate. Do not create an .ARM.attributes section in
4862 output if there is no regular input object.
4863 (Target_arm::merge_processor_specific_flags): Check
4864 --warn-mismatch before printing any error.
4865 (Target_arm::merge_object_attributes): Ditto.
4866 * gold.cc (queue_middle_tasks): Handle the case in which there is
4867 no regular object in input.
4868 * options.cc (General_options::parse_EB): New method.
4869 (General_options::parse_EL): Same.
4870 (General_options::General_options): Initialize endianness_.
4871 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
4873 (General_options::Endianness): New enum.
4874 (General_options::endianness): New method.
4875 (General_options::endianness_): New data member.
4876 * parameters.cc (Parameters::set_options): Check target endianness.
4877 (Parameters::set_target_once): Ditto.
4878 (Parameters::check_target_endianness): New method.
4879 (parameters_force_valid_target): If either -EL or -EB is specified,
4880 use it to define endianness of default target.
4881 * parameters.h (Parameters::check_target_endianness): New method
4883 * target.h (class Target): Change "endianity" to "endianness"
4886 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4888 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
4889 * configure: Regenerate.
4890 * Makefile.in: Regenerate.
4891 * testsuite/Makefile.in: Regenerate.
4893 2010-04-06 Cary Coutant <ccoutant@google.com>
4896 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
4897 prevailing definitions of common symbols.
4898 * testsuite/plugin_test_6.sh: New test case.
4899 * testsuite/plugin_common_test_1.c: New test case.
4900 * testsuite/plugin_common_test_2.c: New test case.
4901 * testsuite/Makefile.am (plugin_test_6): New test case.
4902 * testsuite/Makefile.in: Regenerate.
4904 2010-04-06 Nick Clifton <nickc@redhat.com>
4906 * po/vi.po: New Vietnamese translation.
4908 2010-03-30 Doug Kwan <dougkwan@google.com>
4910 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
4912 2010-03-25 Doug Kwan <dougkwan@google.com>
4914 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
4915 to avoid a conversion warning on a 32-bit host.
4917 2010-03-24 Ian Lance Taylor <iant@google.com>
4919 * testsuite/script_test_3.t: Add a TLS segment.
4920 * testsuite/Makefile.am (check_PROGRAMS): Add
4921 tls_phdrs_script_test.
4922 (tls_phdrs_script_test_SOURCES): Define.
4923 (tls_phdrs_script_test_DEPENDENCIES): Define.
4924 (tls_phdrs_script_test_LDFLAGS): Define.
4925 (tls_phdrs_script_test_LDADD): Define.
4926 * testsuite/Makefile.in: Rebuild.
4928 2010-03-23 Cary Coutant <ccoutant@google.com>
4930 * fileread.cc (find_or_make_view): Fix comment.
4932 2010-03-23 Ian Lance Taylor <iant@google.com>
4934 * script-sections.cc (class Orphan_section_placement): Define
4935 PLACE_TLS and PLACE_TLS_BSS.
4936 (Orphan_section_placement::Orphan_section_placement): Initialize
4938 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
4939 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
4940 (tls_script_test_SOURCES): Define.
4941 (tls_script_test_DEPENDENCIES): Define.
4942 (tls_script_test_LDFLAGS): Define.
4943 (tls_script_test_LDADD): Define.
4944 * testsuite/Makefile.in: Rebuild.
4946 2010-03-22 Doug Kwan <dougkwan@google.com>
4948 * arm.cc (Arm_relocate_functions::abs8,
4949 Arm_relocate_functions::abs16): Use correct check for overflow
4950 specified in the ARM ELF specs.
4951 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
4952 target of a BLX instruction specially.
4953 (Reloc_stub::stub_type_for_reloc): Ditto.
4954 (Relocate::relocate): Use symbolic names instead of numeric relocation
4955 codes to report error.
4956 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
4958 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
4959 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
4960 thumb2_blx_out_of_range.stdout
4961 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
4962 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
4963 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
4964 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
4965 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
4966 thumb2_blx_in_range, thumb2_blx_in_range.o,
4967 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
4968 thumb2_blx_out_of_range.o): New rules.
4969 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
4970 thumb2_blx_in_range and thumb2_blx_out_of_range.
4971 * testsuite/Makefile.in: Regenerate.
4972 * arm_branch_in_range.sh: Add tests for THUMB BLX.
4973 * testsuite/thumb_blx_in_range.s: New file.
4974 * testsuite/thumb_blx_out_of_range.s: New file.
4976 2010-03-22 Rafael Espindola <espindola@google.com>
4978 * archive.cc (Should_include): Move to archive.h.
4979 (should_include_member): Make it a member of Archive.
4981 (Add_lib_group_symbols): New.
4982 * archive.h: Include options.h.
4983 (Archive_member): Moved from Archive.
4984 (Should_include): Moved from archive.cc.
4986 (Add_lib_group_symbols): New.
4987 * dynobj.cc (do_should_include_member): New.
4988 * dynobj.h (do_should_include_member): New.
4989 * gold.cc (queue_initial_tasks): Update call to queue.
4990 * main.cc (main): Print lib group stats.
4991 * object.cc (do_should_include_member): New.
4992 * object.h: Include archive.h.
4993 (Object::should_include_member): New.
4994 (Object::do_should_include_member): New.
4995 (Sized_relobj::do_should_include_member): New.
4996 * options.cc (General_options::parse_start_lib): New.
4997 (General_options::parse_end_lib): New.
4998 (Input_arguments::add_file): Handle lib groups.
4999 (Input_arguments::start_group): Check we are not in a lib.
5000 (Input_arguments::start_lib): New.
5001 (Input_arguments::end_lib): New.
5002 * options.h (General_options): Add start_lib and end_lib.
5003 (Input_argument::lib_): New.
5004 (Input_argument::lib): New.
5005 (Input_argument::is_lib): New.
5006 (Input_file_lib): New.
5007 (Input_arguments::in_lib_): New.
5008 (Input_arguments::in_lib): New.
5009 (Input_arguments::start_lib): New.
5010 (Input_arguments::end_lib_): New.
5011 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5012 in unused members as preempted.
5013 (Sized_pluginobj::do_should_include_member): New.
5014 * plugin.h (Sized_pluginobj::do_should_include_member): New.
5015 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5017 (Read_symbols::do_whole_lib_group): New.
5018 (Read_symbols::do_lib_group): New.
5019 (Read_symbols::do_read_symbols): Handle lib groups.
5020 (Read_symbols::get_name): Handle lib groups.
5021 * readsyms.h (Read_symbols): Add an archive member pointer.
5022 (Read_symbols::do_whole_lib_group): New.
5023 (Read_symbols::do_lib_group): New.
5024 (Read_symbols::member_): New.
5025 * script.cc (read_input_script): Update call to queue_soon.
5027 2010-03-19 Doug Kwan <dougkwan@google.com>
5029 * arm.cc (Stub_table::Stub_table): Initialize new data members
5030 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5031 (Stub_table::add_reloc_stub): Assign stub offset and update
5032 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5033 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
5035 (Stub_table::update_data_size_and_addralign): Use
5036 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
5037 instead of going over all reloc stubs.
5038 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
5039 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5040 Stringpool_template::offset_ to size of Stringpool_char.
5041 (Stringpool_template::new_key_offset): Remove code to initialize
5042 Stringpool_template::offset_.
5043 * stringpool.h (Stringpool_template::set_no_zero_null): Set
5044 Stringpool_template::offset_ to zero.
5046 2010-03-15 Doug Kwan <dougkwan@google.com>
5048 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5050 (Stringpool_template::new_key_offset): New method.
5051 (Stringpool_template::add_string): Assign offsets when adding new
5053 (Stringpool_template::set_string_offsets): Do not set string offsets
5054 when not optimizing.
5055 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5057 (Chunked_vector::clear): Clear size_.
5058 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5059 (Chunked_vector::size): Return size_.
5060 (Chunked_vector::push_back): Use size_ to find insert position.
5061 (Chunked_vector::size_): New data member.
5062 (Stringpool_template::set_no_zero_null): Assert string set is empty.
5063 (Stringpool_template::new_key_offset): New method declaration.
5064 (Stringpool_template::offset_): New data member.
5066 2010-03-15 Rafael Espindola <espindola@google.com>
5068 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
5069 Add_symbols' constructor.
5070 * readsyms.h (Add_symbols): Remove the input_group member.
5072 2010-03-10 Ian Lance Taylor <iant@google.com>
5074 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
5075 target to ask whether a reference to a symbol requires a stack
5077 * target.h (Target::is_call_to_non_split): New function.
5078 (Target::do_is_call_to_non_split): Declare virtual function.
5079 * target.cc: Include "symtab.h".
5080 (Target::do_is_call_to_non_split): New function.
5081 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
5083 2010-03-10 Cary Coutant <ccoutant@google.com>
5085 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
5086 (File_read::open[1]): Remove initial mapping of whole_file_view_.
5087 (File_read::open[2]): Add whole_file_view_ to list of views.
5088 (File_read::make_view): Remove test of whole_file_view_.
5089 (File_read::find_or_make_view): Create whole_file_view_ if
5091 (File_read::clear_views): Replace bool parameter with enum;
5092 adjust all callers. Don't delete views with permanent data;
5093 do delete cached views and views from archives if
5094 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
5095 if clearing the corresponding view.
5096 * fileread.h (File_read::Clear_views_mode): New enum.
5097 (File_read::View::is_permanent_view): New method.
5098 (File_read::clear_views): Replace bool parameter
5099 with enum; adjust all callers.
5100 * options.h (General_options): Change keep_files_mapped option;
5101 add map_whole_files.
5102 * readsyms.cc (Add_symbols::run): Delete sd_ object before
5104 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
5107 2010-03-10 David S. Miller <davem@davemloft.net>
5109 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
5111 2010-03-09 Sriraman Tallam <tmsriram@google.com>
5113 * icf.cc (get_section_contents): Add '@' marker after processing the
5116 2010-03-08 Doug Kwan <dougkwan@google.com>
5118 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
5119 due to a conversion warning.
5120 (Arm_relobj::update_output_local_symbol_count): Check for local
5121 symbol with unset output index.
5123 2010-03-05 Ian Lance Taylor <iant@google.com>
5125 * options.h (class General_options): Add --spare-dynamic-tags.
5126 * output.cc (Output_data_dynamic::set_final_data_size): Implement
5127 --spare-dynamic-tags.
5129 2010-03-05 Ian Lance Taylor <iant@google.com>
5131 * incremental.cc: Include "libiberty.h".
5133 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
5135 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
5136 function, is_info_ member.
5137 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
5138 (Versions::Versions): Update caller.
5139 (Versions::define_base_version): Likewise.
5140 (Versions::add_def): Likewise.
5142 2010-03-03 Sriraman Tallam <tmsriram@google.com>
5144 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
5145 (Scan::possible_function_pointer_reloc): New function.
5146 (Scan::local_reloc_may_be_function_pointer): Change to call
5147 possible_function_pointer_reloc.
5148 (Scan::global_reloc_may_be_function_pointer): Ditto.
5149 * icf.h (Icf::check_section_for_function_pointers): Change to reject
5150 relocations in ".data.rel.ro._ZTV" section.
5151 * testsuite/icf_safe_so_test.sh: Change to pass i386.
5152 * testsuite/icf_safe_so_test.cc: Ditto.
5153 * testsuite/icf_safe_test.cc: Ditto.
5154 * testsuite/icf_safe_test.sh: Ditto.
5156 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5157 Ian Lance Taylor <iant@google.com>
5159 * target-reloc.h (relocate_section): Check the symbol table index
5160 for -1U before setting the local symbol index.
5161 (scan_relocatable_relocs): If copying the relocation, record that
5162 the local symbol is required.
5163 * object.h (Symbol_value::is_output_symtab_index_set): New
5165 (Symbol_value::may_be_discarded_from_output_symtab): New
5167 (Symbol_value::has_output_symtab_entry): New function.
5168 (Symbol_value::needs_output_symtab_entry): Remove.
5169 (Symbol_value::output_symtab_index): Make sure the symbol index is
5171 (Symbol_value::set_output_symtab_index): Make sure the symbol
5172 index is not set. Make sure the new index is valid.
5173 (Symbol_value::set_must_have_output_symtab_entry): New function.
5174 (Symbol_value::has_output_dynsym_entry): New function.
5175 (Symbol_value::set_output_dynsym_index): Make sure the new index
5177 (Sized_relobj::set_must_have_output_symtab_entry): New function.
5178 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
5179 local symbol if permitted.
5180 (Sized_relobj::do_finalize_local_symbols): Call
5181 is_output_symtab_index_set rather than needs_output_symtab_entry.
5182 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
5183 rather than needs_output_symtab_entry. Call
5184 has_output_dynsym_entry rather than needs_output_dynsym_entry.
5185 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
5186 is_output_symtab_index_set rather than needs_output_symtab_entry.
5187 * testsuite/discard_locals_relocatable_test.c: New file.
5188 * testsuite/discard_locals_test.sh: Test -r.
5189 * testsuite/Makefile.am (check_DATA): Add
5190 discard_locals_relocatable_test1.syms,
5191 discard_local_relocatable_test2.syms.
5192 (MOSTLYCLEANFILES): Likewise. Also add
5193 discard_locals_relocatable_test1.lout and
5194 discard_locals_relocatable_test2.out.
5195 (discard_locals_relocatable_test1.syms): New target.
5196 (discard_locals_relocatable_test.o): New target.
5197 (discard_locals_relocatable_test1.out): New target.
5198 (discard_locals_relocatable_test2.syms): New target.
5199 (discard_locals_relocatable_test2.out): New target.
5200 (various): Add missing ../ld-new dependencies.
5201 * testsuite/Makefile.in: Rebuild.
5203 2010-03-03 Nick Clifton <nickc@redhat.com>
5205 * po/fi.po: New Finnish translation.
5207 2010-03-01 Doug Kwan <dougkwan@google.com>
5209 * layout.cc (Layout::Layout): Force section types of .init_array*,
5210 .preinit_array* and .fini_array* sections.
5211 * output.cc (Output_section::Input_section_sort_entry::has_priority):
5212 Fix check of return value of std::string::find.().
5213 (Output_section::Input_section_sort_compare::operator()): Remove
5214 comment about .init_array.
5215 (Output_section::Input_section_sort_init_fini_compare::operator()):
5217 (Output_section::sort_attached_input_sections): Handle .init_array
5218 and .fini_array specially.
5219 * output.h (Output_section::Inut_section_sort_compare): Update
5221 (Output_section::Input_section_sort_init_fini_compare): New struct.
5223 2010-02-26 Doug Kwan <dougkwan@google.com>
5225 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
5226 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
5227 * testsuite/debug_msg.sh: Avoid matching source line number for
5228 use of global variable undef_int.
5230 2010-02-26 Doug Kwan <dougkwan@google.com>
5232 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
5233 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
5234 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
5235 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
5236 * options.cc (General_options::General_options): Initialize member
5238 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
5239 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
5240 and rm_no_fix_v4bx.stdout
5241 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
5242 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
5243 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
5244 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
5245 and arm_no_fix_v4bx.
5246 * Makefile.in: Regenerate.
5247 * testsuite/arm_fix_v4bx.s: New file.
5248 * testsuite/arm_fix_v4bx.sh: Ditto.
5250 2010-02-24 Doug Kwan <dougkwan@google.com>
5252 * arm.cc (Target_arm::got_section): Make the .got section the first
5253 non RELRO section in the data segment.
5254 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
5255 suffixes of section names.
5257 2010-02-24 Doug Kwan <dougkwan@google.com>
5259 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
5260 flags and attributes merging if an input file is a binary file.
5261 * fileread.cc (Input_file::open): Record format of original file.
5262 * fileread.h (Input_file::Format): New enum type.
5263 (Input_file::Input_file): Initialize data member format_.
5264 (Input_file::format): New method definition.
5265 (Input_file::format_):: New data member.
5267 2010-02-24 Doug Kwan <dougkwan@google.com>
5269 * arm.cc (Arm_output_data_got): New class.
5270 (ARM_TCB_SIZE): New constant
5271 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
5272 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
5273 If user uses a script with a SECTIONS clause, issue only a warning
5274 for a misplaced EXIDX input section. Otherwise, issue an error.
5275 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
5277 (Target_arm::got_mode_index_entry): Handle static linking.
5278 (Target_arm::Scan::local): Ditto.
5279 (Target_arm::Scan::global): Ditto.
5280 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
5281 all incorrectly implemented relocations.
5282 (Target_arm::fix_exidx_coverage): Pass layout to
5283 Arm_output_section::fix_exidx_coverage.
5284 * layout.cc (Layout::section_name_mapping): Remove trailing dots
5285 from ".ARM.exidx." and ".ARM.extab.".
5287 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5289 * arm.cc (Target_arm::do_finalize_sections): Create attribute
5290 section if it does not already exist.
5291 * attributes.cc (Attributes_section_data::Attributes_section_data):
5292 Don't crash if size is zero.
5294 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5295 Ian Lance Taylor <iant@google.com>
5297 * gold.cc (queue_middle_tasks): If no input files were opened,
5299 * workqueue.h (Task_function::Task_function): Assert that there is
5302 2010-02-22 Doug Kwan <dougkwan@google.com>
5304 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
5305 * icf.cc (get_section_contents): Cast snprintf arguments to long long
5306 types to avoid warnings due to different uint64_t implementations
5309 2010-02-21 Doug Kwan <dougkwan@google.com>
5311 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
5312 handling of the maximum backward branch offset.
5313 (Arm_relocate_functions::thumb_branch_common): Ditto.
5314 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
5315 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
5316 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
5317 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
5318 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
5319 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
5320 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
5321 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
5322 thumb_bl_out_of_range thumb_bl_out_of_range.o,
5323 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
5324 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
5325 thumb2_bl_out_of_range.o): New rules.
5326 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
5327 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
5328 thumb2_bl_out_of_range
5329 * testsuite/Makefile.in: Regenerate.
5330 * testsuite/arm_bl_in_range.s: New file.
5331 * testsuite/arm_bl_out_of_range.s: Ditto.
5332 * testsuite/arm_branch_in_range.sh: Ditto.
5333 * testsuite/arm_branch_range.t: Ditto.
5334 * testsuite/thumb2_branch_range.t: Ditto.
5335 * testsuite/thumb_bl_in_range.s: Ditto.
5336 * testsuite/thumb_bl_out_of_range.s: Ditto.
5337 * testsuite/thumb_branch_range.t: Ditto.
5339 2010-02-20 Sriraman Tallam <tmsriram@google.com>
5341 * gc.h (gc_process_relocs): Change vectors to point to the new list.
5342 Add reloc offset information.
5343 * icf.cc (get_section_contents): Change iterators to point to the new
5344 vectors. Add reloc offset information to the contents.
5345 * icf.h (Icf::Sections_reachable_info): New typedef.
5346 (Icf::Sections_reachable_list): New typedef.
5347 (Icf::Offset_info): New typedef.
5348 (Icf::Reloc_info): New struct typedef.
5349 (Icf::Reloc_info_list): New typedef.
5350 (Icf::symbol_reloc_list): Delete method.
5351 (Icf::addend_reloc_list): Delete method.
5352 (Icf::section_reloc_list): Delete method.
5353 (Icf::reloc_info_list): New method.
5354 (Icf::reloc_info_list_): New member.
5356 2010-02-19 Doug Kwan <dougkwan@google.com>
5358 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
5359 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
5360 * arm.cc (Arm_relocation_functions): New forward declaration.
5361 (Target_arm::Target_arm): Initialize new data members
5362 got_mod_index_offset_ and tls_base_symbol_defined_.
5363 (Target_arm::Relocate::relocate_tls): New method.
5364 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
5365 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
5367 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
5368 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
5369 (Target_arm::got_mod_index_offset_,
5370 Target_arm::tls_base_symbol_defined_): New data members.
5371 (Target_arm::Scan::local, Target::Scan::global,
5372 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
5375 2010-02-18 Doug Kwan <dougkwan@google.com>
5377 * arm.cc (Arm_relobj::find_linked_text_section): New method.
5378 (Arm_relobj::make_exidx_input_section): Pass section index of linked
5379 text section as a parameter becuase some broken tools may not set
5380 the link in section header.
5381 (Target_arm::has_got_section): New method.
5382 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
5383 without any mapping symbol as data only. Remove warning.
5384 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
5385 link in its section header, try to discover the link by inspecting the
5386 REL31 relocation at the beginning of the section.
5387 (Target_arm::Scan::check_non_pic): Report name of offending relocation
5389 (Target_arm::Scan::global): Treat any reference to the symbol
5390 _GLOBAL_OFFSET_TABLE_ as a GOT access.
5392 2010-02-12 Sriraman Tallam <tmsriram@google.com>
5394 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
5395 (Scan::global_reloc_may_be_function_pointer): New function.
5396 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5397 (Scan::global_reloc_may_be_function_pointer): New function.
5398 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5399 (Scan::global_reloc_may_be_function_pointer): New function.
5400 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
5401 (Scan::global_reloc_may_be_function_pointer): New function.
5402 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
5403 (Scan::global_reloc_may_be_function_pointer): New function.
5404 (Scan::possible_function_pointer_reloc): New function.
5405 (Target_x86_64::can_check_for_function_pointers): New function.
5406 * gc.h (gc_process_relocs): Scan relocation types to determine if
5407 function pointers were taken for targets that support it.
5408 * icf.cc (Icf::find_identical_sections): Include functions for
5409 folding in safe ICF whose pointer is not taken.
5410 * icf.h (Secn_fptr_taken_set): New typedef.
5411 (fptr_section_id_): New member.
5412 (section_has_function_pointers): New function.
5413 (set_section_has_function_pointers): New function.
5414 (check_section_for_function_pointers): New function.
5415 * options.h: Fix comment for safe ICF option.
5416 * target.h (can_check_for_function_pointers): New function.
5417 * testsuite/Makefile.am: Add icf_safe_so_test test case.
5418 Modify icf_safe_test for X86-64.
5419 * testsuite/Makefile.in: Regenerate.
5420 * testsuite/icf_safe_so_test.cc: New file.
5421 * testsuite/icf_safe_so_test.sh: New file.
5422 * testsuite/icf_safe_test.cc (kept_func_3): New function.
5423 (main): Change to take pointer to function kept_func_3.
5424 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
5425 folding is done correctly for X86-64.
5427 2010-02-12 David S. Miller <davem@davemloft.net>
5429 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
5430 is_symbolless parameter.
5431 (Output_reloc<SHT_REL>::is_symbolless): New.
5432 (Output_reloc<SHT_REL>::is_symbolless_): New.
5433 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
5434 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
5435 (Output_reloc<SHT_RELA>::is_symbolless): New.
5436 (Output_data_reloc::add_global): Handle is_symbolless.
5437 (Output_data_reloc::add_global_relative): Likewise.
5438 (Output_data_reloc::add_local): Likewise.
5439 (Output_data_reloc::add_local_relative): Likewise.
5440 (Output_data_reloc::add_symbolless_global_addend): New.
5441 (Output_data_reloc::add_symbolless_local_addend): New.
5442 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
5444 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
5445 instead of ->is_relative_
5446 (Output_reloc::write): Likewise.
5447 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
5448 (Output_reloc::write_rel): Simplify.
5450 * sparc.cc (Target_sparc::Scan::local): Use
5451 ->add_symbolless_local_addend as needed.
5452 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
5453 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
5454 based upon relocation offset.
5456 2010-02-11 Doug Kwan <dougkwan@google.com>
5458 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
5459 (Target_arm::Scan::global): Ditto. Also remove a comment before the
5460 beginning of function.
5461 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
5462 and MOVT_ABS relocations. Those are non issued in scanning. Fix
5463 parameter is_32bit in calls to should_apply_static_reloc.
5464 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
5465 (check_DATA): Add arm_abs_global.stdout.
5466 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
5467 arm_abs_global.stdout): New rules.
5468 (MOSTLLYCLEANFILES): Add arm_abs_global
5469 * Makefile.in: Regenerate.
5470 * testsuite/arm_abs_global.s: New file.
5471 * testsuite/arm_abs_global.sh: Ditto.
5472 * testsuite/arm_abs_lib.s: Ditto.
5474 2010-02-11 Ian Lance Taylor <iant@google.com>
5476 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
5478 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
5479 Allocate_commons_task first.
5480 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
5481 task, rather than symtab_lock_.
5482 (Gc_process_relocs::~Gc_process_relocs): New function.
5483 (Gc_process_relocs::is_runnable): Check this_blocker_.
5484 (Gc_process_relocs::locks): Use next_blocker_ rather than
5486 (Scan_relocs::~Scan_relocs): New function.
5487 (Scan_relocs::is_runnable): Check this_blocker_ rather than
5489 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
5491 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
5492 fields. Add this_blocker_ and next_blocker_ fields. Adjust
5493 constructor accordingly.
5494 (class Gc_process_relocs): Likewise.
5495 (class Scan_relocs): Likewise.
5496 * common.h (class Allocate_commons_task): Remove symtab_lock_
5497 field, and corresponding constructor parameter.
5498 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
5500 (Allocate_commons_task::locks): Likewise.
5502 2010-02-11 Ian Lance Taylor <iant@google.com>
5504 * gold-threads.h (class Once): Define.
5505 (class Initialize_lock): Rewrite as child of Once.
5506 * gold-threads.cc (class Once_initialize): Define.
5507 (once_pointer_control): New static variable.
5508 (once_pointer, once_arg): New static variables.
5509 (c_run_once): New static function.
5510 (Once::Once, Once::run_once, Once::internal_run): New functions.
5511 (class Initialize_lock_once): Remove.
5512 (initialize_lock_control): Remove.
5513 (initialize_lock_pointer): Remove.
5514 (initialize_lock_once): Remove.
5515 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
5516 (Initialize_lock::initialize): Rewrite.
5517 (Initialize_lock::do_run_once): New function.
5518 * archive.cc (Archive::interpret_header): Only clear name if it is
5520 * fileread.cc: Include "gold-threads.h"
5521 (file_counts_lock): New static variable.
5522 (file_counts_initialize_lock): Likewise.
5523 (File_read::release): Only increment counts when using --stats.
5524 Use a lock around the increment.
5525 * parameters.cc (class Set_parameters_target_once): Define.
5526 (set_parameters_target_once): New static variable.
5527 (Parameters::Parameters): Move here from parameters.h.
5528 (Parameters::set_target): Rewrite.
5529 (Parameters::set_target_once): New function.
5530 (Parameters::clear_target): Move here and rewrite.
5531 * parameters.h (class Parameters): Update declarations. Add
5532 set_parameters_target_once_ field.
5533 (Parameters::Parameters): Move to parameters.cc.
5534 (Parameters::clear_target): Likewise.
5535 * readsyms.cc (Read_symbols::do_group): Create a Start_group
5537 (Start_group::~Start_group): New function.
5538 (Start_group::is_runnable): New function.
5539 (Start_group::locks, Start_group::run): New functions.
5540 (Finish_group::run): Change saw_undefined to size_t.
5541 * readsyms.h (class Start_group): Define.
5542 (class Finish_group): Change saw_undefined_ field to size_t.
5543 (Finish_group::Finish_group): Remove saw_undefined and
5544 this_blocker parameters. Change all callers.
5545 (Finish_group::set_saw_undefined): New function.
5546 (Finish_group::set_blocker): New function.
5547 * symtab.h (class Symbol_table): Change saw_undefined to return
5548 size_t. Change saw_undefined_ field to size_t.
5549 * target-select.cc (Set_target_once::do_run_once): New function.
5550 (Target_selector::Target_selector): Initialize set_target_once_
5551 field. Don't initialize lock_ and initialize_lock_ fields.
5552 (Target_selector::instantiate_target): Rewrite.
5553 (Target_selector::set_target): New function.
5554 * target-select.h (class Set_target_once): Define.
5555 (class Target_selector): Update declarations. Make
5556 Set_target_once a friend. Remove lock_ and initialize_lock_
5557 fields. Add set_target_once_ field.
5559 2010-02-10 Ian Lance Taylor <iant@google.com>
5561 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
5563 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
5564 (queue_middle_tasks): Add all blockers before queueing any tasks.
5565 (queue_final_tasks): Likewise.
5566 * token.h (Task_token::add_blockers): New function.
5567 * object.h (Input_objects::number_of_relobjs): New function.
5569 2010-02-10 Ian Lance Taylor <iant@google.com>
5571 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
5572 shared, not if not position independent.
5573 * x86_64.cc (Relocate::relocate_tls): Likewise.
5574 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
5575 (tls_pie_pic_test): New target.
5576 * testsuite/Makefile.in: Rebuild.
5578 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
5579 (tls_test_main_pie.o, tls_test_pie.o): New targets.
5580 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
5581 * testsuite/Makefile.in: Rebuild.
5583 2010-02-09 David S. Miller <davem@davemloft.net>
5585 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
5586 R_SPARC_RELATIVE using ->add_local_relative().
5587 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
5589 * output.h (Output_data_dynamic::add_section_size): New method
5590 that takes two Output_data objects.
5591 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
5592 entry param. Handle it in initializers.
5593 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
5594 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
5595 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
5597 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
5598 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
5599 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
5600 for dynrel_includes_plt.
5601 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5602 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5603 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
5605 (Target_sparc::do_finalize_sections): Update to pass true for
5606 dynrel_includes_plt.
5607 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
5608 output before .rela.plt
5609 (Target_powerpc::do_finalize_sections): Update to pass true for
5610 dynrel_includes_plt when 32-bit.
5612 2010-02-08 Doug Kwan <dougkwan@google.com>
5614 * arm.cc (Arm_relobj::simple_input_section_output_address): New
5616 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
5617 Arm_relobj::scan_section_for_cortex_a8_stubs,
5618 Arm_relobj::do_relocation_section): Instead of calling
5619 Output_section::output_address, use faster
5620 Arm_relobj::simple_input_section_output_address.
5622 2010-02-08 David S. Miller <davem@davemloft.net>
5624 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
5625 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
5626 relocation helper function.
5628 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
5629 just like R_SPARC_GOT{10,13,22}.
5630 (Target_sparc::Scan::local): Likewise.
5631 (Target_sparc::Relocate:relocate): Likewise.
5633 2010-02-06 Ian Lance Taylor <iant@google.com>
5635 * configure.ac: Rewrite targetobjs duplicate removal code to use
5636 only shell constructs.
5637 * configure: Rebuild.
5639 2010-02-05 Doug Kwan <dougkwan@google.com>
5642 * arm.cc (Arm_relobj::section_is_scannable): New method.
5643 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
5644 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
5646 2010-02-04 Doug Kwan <dougkwan@google.com>
5649 * arm-reloc-property.cc (cstdio): Include.
5650 * configure.ac (targetobjs): Remove duplicates.
5651 * configure: Regenerate.
5652 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
5653 big and little endian version for a given address size.
5655 2010-02-03 Doug Kwan <dougkwan@google.com>
5657 * arm-reloc-property.cc
5658 (Arm_reloc_property_table::reloc_name_in_error_message): New method
5660 * arm-reloc-property.h
5661 (Arm_reloc_property_table::get_implemented_static_reloc_property):
5662 New method definition.
5663 (Arm_reloc_property_table::reloc_name_in_error_message): New method
5665 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
5667 (GOT_PREL): Change implemented to Y.
5668 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
5669 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
5670 (Arm_relocate_functions::movw_abs_nc): Remove method.
5671 (Arm_relocate_functions::movt_abs): Ditto.
5672 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
5673 (Arm_relocate_functions::thm_movt_abs): Ditto.
5674 (Arm_relocate_functions::movw_rel_nc): Ditto.
5675 (Arm_relocate_functions::movw_rel): Ditto.
5676 (Arm_relocate_functions::movt_rel): Ditto.
5677 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
5678 (Arm_relocate_functions:thm_movw_rel): Ditto.
5679 (Arm_relocate_functions:thm_movt_rel): Ditto.
5680 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
5681 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
5682 New method definitions.
5683 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
5684 (Arm_relocation_functions::arm_grp_ldr): Ditto.
5685 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
5686 (Arm_relocation_functions::arm_grp_ldc): Ditto.
5687 (Target_arm::Relocate::relocate): Check for non-static or
5688 unimplemented relocation code and exit early. Change calls to
5689 Target_arm::reloc_uses_thumb_bit and
5690 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
5691 instead. Refactor code to handle similar relocations to increase
5692 code sharing. Remove check for unsupported relocation code in switch
5694 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
5695 relocation property table to find out size. Change error message to
5696 print out the name of a relocation code instead of the numeric value.
5697 (Target_arm::scan_reloc_for_stub): Use relocation property table
5698 instead of calling Target_arm::reloc_uses_thumb_bit().
5700 2010-02-02 Doug Kwan <dougkwan@google.com>
5702 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
5703 types of relaxed input section.
5705 2010-02-02 Doug Kwan <dougkwan@google.com>
5707 * Makefile.am (HFILES): Add arm-reloc-property.h.
5709 (TARGETSOURCES): Add arm-reloc-property.cc
5710 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
5711 (libgold_a_SOURCES): $(DEFFILES)
5712 * Makefile.in: Regenerate.
5713 * arm-reloc-property.cc: New file.
5714 * arm-reloc-property.h: New file.
5715 * arm-reloc.def: New file.
5716 * arm.cc: Update comments.
5717 (arm-reloc-property.h): New included header.
5718 (arm_reloc_property_table): New global variable.
5719 (Target_arm::do_select_as_default_target): New method definition.
5720 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
5721 arm-reloc-property to targ_extra_obj.
5722 * parameters.cc (set_parameters_target): Call
5723 Target::select_as_default_target().
5724 * target.h (Target::select_as_default_target): New method definition.
5725 (Target::do_select_as_default_target): Same.
5727 2010-02-01 Doug Kwan <dougkwan@google.com>
5729 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
5730 first_output_text_section_.
5731 (Arm_exidx_fixup::first_output_text_section): New method definition.
5732 (Arm_exidx_fixup::first_output_text_section_): New data member.
5733 (Arm_exidx_fixup::process_exidx_section): Record the first text
5734 output section seen.
5735 (Arm_output_section::fix_exidx_coverage): Set correct linked section
5736 and entsize in output section header.
5738 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5740 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
5741 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
5742 (Arm_relocate_functions::thm_alu11): New Method.
5743 (Arm_relocate_functions::thm_pc8): New Method.
5744 (Arm_relocate_functions::thm_pc12): New Method.
5745 (Target_arm::Scan::local): Handle the relocations.
5746 (Target_arm::Scan::global): Likewise.
5747 (Target_arm::Relocate::relocate): Likewise.
5748 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
5750 2010-01-29 Doug Kwan <dougkwan@google.com>
5752 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
5753 of relocation types as ld.
5755 2010-01-29 Doug Kwan <dougkwan@google.com>
5757 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
5759 (Arm_relocate_functions::thumb_branch_common): Ditto.
5760 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
5761 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
5762 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
5763 Arm_relocate_functions::jump24): Remove.
5764 (Target_arm::Relocate::relocate): Adjust code to call
5765 Arm_relocation_functions::arm_branch_common and
5766 Arm_relocation_functions::thumb_branch_common instead of their removed
5767 wrappers. Merge switch-cases together to reduce source code size.
5769 2010-01-29 Doug Kwan <dougkwan@google.com>
5771 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
5772 output_local_symbol_count_needs_update_.
5773 (Arm_relobj::output_local_symbol_count_needs_update,
5774 Arm_relobj::set_output_local_symbol_count_needs_update,
5775 Arm_relobj::update_output_local_symbol_count): New methods.
5776 (Arm_relobj::output_local_symbol_count_needs_update_): New data
5778 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
5779 of pointed function as in a R_ARM_PREL31 relocation.
5780 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
5781 for output local symbol count updating.
5782 (Target_arm::do_relax): Update output local symbol counts in objects
5784 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
5786 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5788 * arm.cc: Added support for the ARM relocations:
5789 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
5790 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
5791 (Arm_relocate_functions::movw_rel_nc): Renamed (was
5793 (Arm_relocate_functions::movw_rel): New method.
5794 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
5795 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
5797 (Arm_relocate_functions::thm_movw_rel): New method.
5798 (Arm_relocate_functions::thm_movt_rel): Renamed (was
5800 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
5802 (Target_arm::Scan::global): Likewise.
5803 (Target_arm::Relocate::relocate): Likewise.
5804 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5807 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5809 * arm.cc: Added support for ARM group relocations.
5810 (Target_arm::reloc_needs_sym_origin): New method.
5811 (Arm_relocate_functions::calc_grp_kn): New method.
5812 (Arm_relocate_functions::calc_grp_residual): New method.
5813 (Arm_relocate_functions::calc_grp_gn): New method.
5814 (Arm_relocate_functions::arm_grp_alu): New Method.
5815 (Arm_relocate_functions::arm_grp_ldr): New Method.
5816 (Arm_relocate_functions::arm_grp_ldrs): New Method.
5817 (Arm_relocate_functions::arm_grp_ldc): New Method.
5818 (Target_arm::Scan::local): Handle the ARM group relocations.
5819 (Target_arm::Scan::global): Likewise.
5820 (Target_arm::Relocate::relocate): Likewise.
5821 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5824 2010-01-26 Doug Kwan <dougkwan@google.com>
5826 * arm.cc (set): Include.
5827 (class Arm_exidx_fixup): Change type of last_input_section_ to const
5829 (Arm_output_section::Text_section_list): New type.
5830 (Arm_output_section::append_text_sections_to_list): New method.
5831 (Arm_output_section::fix_exidx_coverage): Ditto.
5832 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
5833 (Arm_relobj::convert_input_section_to_relaxed_section): Use
5834 Relobj::set_section_offset() instead of
5835 Sized_relobj::invalidate_section_offset().
5836 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
5837 parameter for section headers. Ignore relocation sections for
5838 unallocated sections and EXIDX sections.
5839 (Target_arm::fix_exidx_coverage): New method.
5840 (Target_arm::output_section_address_less_than): New type.
5841 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
5842 linked text section instead of the EXIDX section.
5843 (Arm_output_section::create_stub_group): Add an assertion to check
5844 that this is not an EXIDX output section.
5845 (Arm_output_section::append_text_sections_to_list): New method.
5846 (Arm_output_section::fix_exidx_coverage): Ditto.
5847 (Arm_relobj::scan_sections_for_stubs): Adjust call to
5848 Arm_relobj::section_needs_reloc_stub_scanning.
5849 (Target_arm::do_relax): Fix EXIDX output section coverage in the
5851 (Target_arm::fix_exidx_coverage): New method.
5852 * object.h (Relobj::set_output_section): New method.
5853 (Sized_relobj::invalidate_section_offset): Remove method.
5854 (Sized_relobj::do_invalidate_section_offset): Remove method.
5855 (Sized_relobj::do_set_section_offset): Handle offset value -1.
5857 2010-01-25 Doug Kwan <dougkwan@google.com>
5859 * arm.cc (Arm_exidx_merged_section::do_output_offset):
5860 Fix warning due to signed and unsigned comparison on a 32-bit host.
5862 2010-01-22 Doug Kwan <dougkwan@google.com>
5864 * arm.cc (Target_arm::do_relax): Record an output section for section
5865 offset adjustment it contains any stub table that has changed.
5866 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
5867 offsets in an output section if necessary.
5868 * output.cc (Output_section::Output_section): Initialize
5869 section_offsets_need_adjustments_.
5870 (Output_section::add_input_section_for_script): Renamed to
5871 Output_section::add_simple_input_section.
5872 (Output_section::save_states): Add a comment.
5873 (Output_section::discard_states): New method defintion.
5874 (Output_section::adjust_section_offsets): Same.
5875 * output.h (Output_section::add_input_section_for_script): Renamed to
5876 Output_section::add_simple_input_section.
5877 (Output_section::discard_states): New method declaration.
5878 (Output_section::adjust_section_offsets): Same.
5879 (Output_section::section_offsets_need_adjustment,
5880 Output_section::set_section_offsets_need_adjustment): New method
5882 (Output_section::section_offsets_need_adjustment_): New data member.
5883 * script-sections.cc
5884 (Output_section_element_input::set_section_address): Adjust code for
5885 renaming of Output_section::add_input_section_for_script.
5886 (Orphan_output_section::set_section_address): Same.
5888 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5890 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
5891 Fix_v4bx enum values .
5892 * gold/options.h (General_options): New option definitions.
5893 (General_options::fix_v4bx): New method.
5894 (General_options::Fix_v4bx): New enum.
5895 * gold/options.cc (General_options::parse_fix_v4bx): New method.
5896 (General_options::parse_fix_v4bx_interworking): New method.
5898 2010-01-22 Doug Kwan <dougkwan@google.com>
5900 * arm.cc (Arm_exidx_fixup): New class.
5902 2010-01-21 Doug Kwan <dougkwan@google.com>
5904 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
5906 (Arm_exidx_section_offset_map): New type.
5908 2010-01-21 Doug Kwan <dougkwan@google.com>
5910 * arm.cc (Arm_exidx_input_section): New class.
5911 (Arm_relobj::exidx_input_section_by_link,
5912 Arm_relobj::exidx_input_section_by_shndx,
5913 Arm_relobj::make_exidx_input_section): New methods.
5914 (read_arm_attributes_section): Remove.
5915 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
5916 information about them.
5917 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
5920 2010-01-20 Doug Kwan <dougkwan@google.com>
5922 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
5923 Input_section_specifier to Section_id.
5924 (Target_arm::new_arm_input_section: Adjust code for change of key
5926 (Target_arm::find_arm_input_section): Ditto.
5927 * gc.h (object.h): Include for Section_id nand Section_id_hash.
5928 (Section_id): Remove.
5929 (Garbage_collection::Section_id_hash): Remove.
5930 * icf.h (object.h): Include for Section_id nand Section_id_hash.
5931 (Section_id): Remove.
5932 (Icf::Section_id_hash): Remove.
5933 * object.h (Section_id, Const_section_id, Section_id_hash,
5934 Const_section_id_hash): New type definitions.
5935 * output.cc (Output_section::add_relaxed_input_section): Change to
5936 use Const_section_id instead of Input_section_specifier as key type.
5937 (Output_section::add_merge_input_section): Ditto.
5938 (Output_section::build_relaxation_map): Change to use Section_id
5939 instead of Input_section_specifier as key type.
5940 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5942 (Output_section::convert_input_sections_to_relaxed_sections): Change
5943 to use Const_section_id instead of Input_section_specifier as key type.
5944 (Output_section::find_merge_section): Ditto.
5945 (Output_section::find_relaxed_input_section): Ditto.
5946 * output.h (Input_section_specifier): Remove class.
5947 (Output_section::Output_section_data_by_input_section_map): Change
5948 key type to Const_section_id.
5949 (Output_section::Output_relaxed_input_section_by_input_section_map):
5951 (Output_section::Relaxation_map): Change key type to Section_id.
5953 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5955 * gold/arm.cc: Added support for R_ARM_V4BX relocation
5956 (class Arm_v4bx_stub): New class.
5957 (DEF_STUBS): Updated definition to support v4_veneer_bx.
5958 (Stub_factory::make_arm_v4bx_stub): New method.
5959 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
5960 (Stub_table::empty): Handle v4bx stubs.
5961 (Stub_table::add_arm_v4bx_stub): New method.
5962 (Stub_table::find_arm_v4bx_stub): New method.
5963 (Arm_relocate_functions::v4bx): New method.
5964 (Target_arm::fix_v4bx): New method.
5965 (Target_arm::Target_arm): Handle R_ARM_V4BX.
5966 (Stub_table::relocate_stubs): Likewise.
5967 (Stub_table::do_write): Likewise.
5968 (Stub_table::update_data_size_and_addralign): Likewise.
5969 (Stub_table::finalize_stubs): Likewise.
5970 (Target_arm::Scan::local): Likewise.
5971 (Target_arm::Scan::global): Likewise.
5972 (Target_arm::do_finalize_sections): Likewise.
5973 (Target_arm::Relocate::relocate): Likewise.
5974 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5976 (Target_arm::scan_reloc_for_stub): Likewise.
5977 (Target_arm::scan_reloc_section_for_stubs): Likewise.
5979 2010-01-19 Ian Lance Taylor <iant@google.com>
5981 * output.cc (Output_section_headers::do_sized_write): Write large
5982 segment count to sh_info field.
5983 (Output_file_header::do_sized_write): For large segment count,
5984 write PN_XNUM to e_phnum field.
5986 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5988 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
5989 (Arm_relocate_functions::thm_jump8): New function.
5990 (Arm_relocate_functions::thm_jump11): New function.
5991 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
5993 (Target_arm::Scan::global): Likewise.
5994 (Target_arm::Relocate::relocate): Likewise.
5995 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5998 2010-01-14 Doug Kwan <dougkwan@google.com>
6000 * arm.cc (map, utility): Include headers.
6001 (Target_arm::apply_cortex_a8_workaround): New method.
6002 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
6003 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
6004 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
6005 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
6006 the --[no-]fix-cortex-a8 command line options.
6007 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
6008 (Target_arm::relocate_stub): Use addend in instruction template.
6009 * options.h (DEFINE_bool): Set the user-set flag.
6010 (General_options): Add --[no-]-fix-cortex options.
6011 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
6012 : Update fast look-up map after conversion.
6014 2010-01-14 Sriraman Tallam <tmsriram@google.com>
6016 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6017 in the first pass of do_layout.
6019 2010-01-13 Doug Kwan <dougkwan@google.com>
6021 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6022 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6023 apparent compiler problem of not folding static constant integral
6024 data members of elfcpp::Elf_sizes<32>.
6026 2010-01-13 Doug Kwan <dougkwan@google.com>
6028 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6029 Arm_relobj::section_needs_cortex_a8_stub_scanning,
6030 Arm_relobj::scan_section_for_cortex_a8_erratum,
6031 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
6032 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
6033 sections to scan for relocation stubs into a new method
6034 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
6035 relocation and Cortex-A8 stub scanning.
6036 (Target_arm::do_relax): Force stubs to be after stubbed sections
6037 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
6038 the beginning of a new relaxation pass. Update a comment.
6039 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
6041 2010-01-12 Ian Lance Taylor <iant@google.com>
6043 * target-reloc.h (visibility_error): New inline function.
6044 (relocate_section): Call visibility_error.
6045 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6046 (MOSTLYCLEANFILES): Likewise.
6047 (protected_4_pic.o, protected_3.err): New targets.
6048 * testsuite/protected_4.cc: New file.
6050 2010-01-12 Doug Kwan <dougkwan@google.com>
6052 * arm.cc (Cortex_a8_reloc): New class.
6053 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6054 and cortex_a8_relocs_info_.
6055 (Target_arm::fix_cortex_a8): New method definition.
6056 (Target_arm::Cortex_a8_relocs_info): New type.
6057 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6058 New data member declarations.
6059 (Target_arm::scan_reloc_for_stub): Record information about
6060 relocations for THUMB branches that might be exempted from the
6061 Cortex-A8 workaround.
6062 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
6063 at the beginning of a relaxation pass.
6065 2010-01-12 Doug Kwan <dougkwan@google.com>
6067 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
6068 (Arm_relobj::Mapping_symbol_position,
6069 Arm_reloj::Mapping_symbol_position_less,
6070 Arm_relobj::Mapping_symbols_info): New types.
6071 (Target_arm::is_mapping_symbol_name): New method definition.
6072 (Arm_relobj::do_count_local_symbols): Save information about mapping
6075 2010-01-11 Doug Kwan <dougkwan@google.com>
6077 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
6078 Arm_relocate_functions::thumb32_branch_upper,
6079 Arm_relocate_functions::thumb32_branch_lower,
6080 Arm_relocate_functions::thumb32_cond_branch_offset,
6081 Arm_relocate_functions::thumb32_cond_branch_upper,
6082 Arm_relocate_functions::thumb32_cond_branch_lower,
6083 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
6084 branch offset encoding.
6085 (Arm_relocate_functions::thumb_branch_common): Use new branch
6086 offset encoding methods to avoid code duplication.
6087 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
6088 (Stub_addend_reader::operator()): Use new branch encoding method
6089 to avoid code duplication.
6091 2010-01-11 Doug Kwan <dougkwan@google.com>
6093 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
6094 (Target_arm::do_finalize_sections): Define special EXIDX section
6095 symbols only if referenced.
6096 * gc.h (Garbage_collection::add_reference): New method.
6097 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
6100 2010-01-11 Ian Lance Taylor <iant@google.com>
6102 * script.cc (Version_script_info::build_expression_list_lookup):
6103 Change complaing about duplicate wildcard match from error to
6106 * script.cc (class Lazy_demangler): Recreate--revert part of patch
6108 (Version_script_info::Version_script_info): Initialize globs_,
6109 default_version_, default_is_global_, and exact_. Don't
6110 initialize globals_ or locals_.
6111 (Version_script_info::build_lookup_tables): Build local symbols
6113 (Version_script_info::unquote): New function.
6114 (Version_script_info::add_exact_match): New function.
6115 (Version_script_info::build_expression_list_lookup): Remove lookup
6116 parameter. Add is_global parameter. Change all callers. Handle
6117 wildcard pattern specially. Unquote pattern. Call
6119 (Version_script_info::get_name_to_match): New function.
6120 (Version_script_info::get_symbol_version): New function.
6121 (Version_script_info::get_symbol_version_helper): Remove.
6122 (Version_script_info::check_unmatched_names): Call unquote.
6123 * script.h (class Version_script_info): Change get_symbol_version
6124 to be non-inline and add is_global parameter; change all callers.
6125 Rewrite symbol_is_local. Update declarations. Define struct
6126 Version_tree_match, Exact, Globs. Don't define struct Lookup.
6127 Remove globals_ and locals_ members. Add exact_, globs_,
6128 default_version_, is_global_.
6129 (Version_script_info::Glob): Remove pattern, add expression and
6130 is_global. Update constructor. Change all callers.
6131 * dynobj.cc (Versions::finalize): Mark the version symbol as the
6133 (Versions::symbol_section_contents): If a symbol is undefined, or
6134 defined in a dynamic object, set the version index to
6136 * symtab.cc (Symbol_table::add_from_relobj): Don't call
6138 (Symbol_table::add_from_pluginobj): Likewise.
6139 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
6141 2010-01-11 Doug Kwan <dougkwan@google.com>
6143 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
6144 (incremental_dump_LDADD): Add linking option for libintl.
6145 * Makefile.in: Regenerate.
6147 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
6150 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
6152 * testsuite/Makefile.in: Regenerated.
6154 2010-01-10 Doug Kwan <dougkwan@google.com>
6156 * options.h (DEFINE_var): Use parentheses around argument varname__
6157 in macro body to avoid any unintended subsequent substitutions.
6159 2010-01-10 Ian Lance Taylor <iant@google.com>
6161 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
6162 candidates before doing symbol resolution.
6164 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
6165 ODR candidates if only one is weak.
6167 2010-01-08 Ian Lance Taylor <iant@google.com>
6169 * script.cc (Version_script_info::build_expression_list_lookup):
6170 Don't warn about ambiguous version, just record the ambiguity.
6171 (Version_script_info::get_symbol_version_helper): Give error if
6172 version is ambiguous.
6174 2010-01-08 Doug Kwan <dougkwan@google.com>
6176 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
6177 prev_data_size_ and prev_addralign_. Remove initializer for
6178 deleted data member has_been_changed_.
6179 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
6180 to determine if the table is empty.
6181 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
6183 (Stub_table::add_reloc_stub): Define method in class definition
6184 instead of just declaring it there.
6185 (Stub_table::add_cortex_a8_stub): New method definition.
6186 (Stub_table::update_data_size_and_addralign): Ditto.
6187 (Stub_table::finalize_stubs): Ditto.
6188 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
6189 (Stub_table::do_addralign_): Return address alignment in the
6190 (Stub_table::do_reset_address_and_file_offset): Define method in
6191 class definition instead of declaring it there. Set current data
6192 size to be the data size of the previous pass.
6193 (Stub_table::set_final_data_size): Use current data size as the
6195 (Stub_table::relocate_stub): Change parameter type of stub from
6196 Reloc_stub pointer to Stub pointer.
6197 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
6198 (Stub_table::Cortex_a8_stub_list): New typedef.
6199 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
6200 Stub_table::prev_addralign_): New data member.
6201 (Arm_relobj::Arm_relobj): Initialize data member
6202 section_has_cortex_a8_workaround_.
6203 (Arm_relobj::section_has_cortex_a8_workaround,
6204 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
6206 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
6208 (Target_arm::relocate_stub): Change parameter type of stub from
6209 Reloc_stub pointer to Stub pointer.
6210 (Insn_template::size, Insn_template::alignment): Handle
6211 THUMB16_SPECIAL_TYPE.
6212 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
6213 Stub_table::update_data_size_and_addralign,
6214 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
6216 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
6217 (Stub_table::do_write): Ditto.
6218 (Target_arm::do_relax): Adjust code for changes in Stub_table.
6220 2010-01-08 Ian Lance Taylor <iant@google.com>
6223 * symtab.h (class Symbol): Remove fields is_target_special_ and
6224 has_plt_offset_. Add field is_defined_in_discarded_section_.
6225 (Symbol::is_defined_in_discarded_section): New function.
6226 (Symbol::set_is_defined_in_discarded_section): New function.
6227 (Symbol::has_plt_offset): Rewrite.
6228 (Symbol::set_plt_offset): Verify that new offset is not -1U.
6229 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
6230 Don't initialize is_target_special_ or has_plt_offset_.
6231 Initialize is_defined_in_discarded_section_.
6232 (Symbol_table::add_from_relobj): If appropriate, set
6233 is_defined_in_discarded_section.
6234 * resolve.cc (Symbol::override_base_with_special): Don't test
6235 is_target_special_. Change has_plt_offset_ to has_plt_offset().
6236 * target-reloc.h (relocate_section): Do special handling for
6237 symbols defined in discarded sections for global symbols as well
6240 2010-01-08 Ian Lance Taylor <iant@google.com>
6242 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
6243 the SHT_SYMTAB case.
6245 2010-01-08 Ian Lance Taylor <iant@google.com>
6247 * object.cc (Sized_relobj::do_layout): Don't get confused if
6248 layout_eh_frame returns NULL.
6250 2010-01-08 Ian Lance Taylor <iant@google.com>
6253 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
6254 dynamic symbol table, use the normal symbol table.
6255 (Sized_dynobj::do_read_symbols): Remove assertion about type of
6258 2010-01-08 Ian Lance Taylor <iant@google.com>
6261 * layout.cc (Layout::include_section): Remove .gnu_debuglink
6264 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
6266 * version.cc (print_version): Change to "Copyright 2010".
6268 2010-01-08 Ian Lance Taylor <iant@google.com>
6272 * i386.cc (class Target_i386): Change return type of plt_section
6274 (class Output_data_plt_i386): Add tls_desc_rel_ field.
6275 (Output_data_plt_i386::Output_data_plt_i386): Initialize
6276 tls_desc_rel_ field.
6277 (Output_data_plt_i386::rel_tls_desc): New function.
6278 (Target_i386::rel_tls_desc_section): New function.
6279 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
6280 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
6281 R_386_TLS_DESC reloc in rel_tls_desc_section.
6282 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
6283 Define struct Tlsdesc_info.
6284 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
6285 (Target_x86_64::do_reloc_symbol_index): New function.
6286 (Target_x86_64::add_tlsdesc_info): New function.
6287 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
6288 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
6290 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
6292 (Output_data_plt_x86_64::rela_tlsdesc): New function.
6293 (Target_x86_64::rela_tlsdesc_section): New function.
6294 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
6296 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
6297 (Target_x86_64::do_reloc_addend): New function.
6298 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
6299 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
6300 declarations. Define TARGET_CODE. Add arg field to u1_ union.
6301 (Output_reloc::type): New function.
6302 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
6303 (Output_reloc::is_target_specific): New function.
6304 (Output_reloc::target_arg): New function.
6305 (class Output_reloc) [SHT_RELA]: Add four new constructors for
6306 absolute relocs and target specific relocs.
6307 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
6308 add_target_specific.
6309 (class Output_data_reloc) [SHT_RELA]: Likewise.
6310 * output.cc (Output_reloc::Output_reloc): Add four new versions
6311 for absolute relocs and target specific relocs.
6312 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
6313 (Output_reloc::get_symbol_index): Likewise.
6314 (Output_reloc::local_section_offset): Check that local_sym_index_
6315 is not TARGET_CODE or 0.
6316 (Output_reloc::symbol_value): Likewise.
6317 (Output_reloc::write) [SHT_RELA]: Call target for target specific
6319 * target.h (class Target): Add reloc_symbol_index and reloc_addend
6320 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
6322 * layout.cc (add_target_dynamic_tags): Use output section for
6323 DT_PLTRELSZ and DT_JMPREL.
6325 2010-01-07 Ian Lance Taylor <iant@google.com>
6328 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
6330 (class Output_data_reloc_generic): Define.
6331 (class Output_data_reloc_base): Change base class to
6332 Output_data_reloc_generic. Change add() method to call
6333 bump_relative_reloc_count for a relative reloc. Remove
6335 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
6337 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
6338 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
6340 * layout.h (class Layout): Update declaration.
6342 2010-01-07 Ian Lance Taylor <iant@google.com>
6344 * output.h (class Output_data): Add const version of
6345 output_section and do_output_section.
6346 (class Output_section_data): Add const version of
6348 (class Output_section): Likewise.
6349 * layout.cc (Layout::add_target_dynamic_tags): New function.
6350 * layout.h (class Layout): Update declarations.
6351 * arm.cc (Target_arm::do_finalize_sections): Use
6352 add_target_dynamic_tags.
6353 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6354 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6355 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6356 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6358 2010-01-07 Ian Lance Taylor <iant@google.com>
6361 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
6364 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
6365 Ian Lance Taylor <iant@google.com>
6368 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
6369 Xindex::read_symtab_xindex.
6371 2010-01-07 Doug Kwan <dougkwan@google.com>
6373 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
6374 (Insn_template::thumb16_bcond_insn): New method declaration.
6375 (Insn_template): Fix spelling.
6376 (Stub::thumb16_special): New method declaration.
6377 (Stub::do_write): Define virtual method which was previously pure
6379 (Stub::do_thumb16_special): New method declaration.
6380 (Stub::do_fixed_endian_write): New template member.
6381 (Reloc_stub::do_write): Remove.
6382 (Reloc_stub::do_fixed_endian_write): Remove.
6383 (Cortex_a8_stub): New class definition.
6384 (Stub_factory::make_cortex_a8_stub): New method definition.
6385 (Stub_factory::Stub_factory): Add missing static storage class
6386 qualifier for elf32_arm_stub_a8_veneer_blx.
6388 2010-01-07 Ian Lance Taylor <iant@google.com>
6391 * options.h (class General_options): Add --warn-unresolved-symbols
6392 and --error-unresolved-symbols.
6393 * errors.cc (Errors::undefined_symbol): Implement
6394 --warn-unresolved-symbols.
6396 * options.h (class General_options): Add -z text and -z textoff.
6397 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
6399 2010-01-06 Sriraman Tallam <tmsriram@google.com>
6401 * gc.h (Garbage_collection::Cident_section_map): New typedef.
6402 (Garbage_collection::cident_sections): New function.
6403 (Garbage_collection::add_cident_section): New function.
6404 (Garbage_collection::cident_sections_): New member.
6405 (gc_process_relocs): Add references to sections whose names are C
6407 * gold.h (cident_section_start_prefix): New constant.
6408 (cident_section_stop_prefix): New constant.
6409 (is_cident): New function.
6410 * layout.cc (Layout::define_section_symbols): Replace string constants
6411 with the newly defined constants.
6412 * object.cc (Sized_relobj::do_layout): Track sections whose names are
6414 * testsuite/Makefile.am: Add gc_orphan_section_test.
6415 * testsuite/Makefile.in: Regenerate.
6416 * testsuite/gc_orphan_section_test.cc: New file.
6417 * testsuite/gc_orphan_section_test.sh: New file.
6419 2010-01-06 Ian Lance Taylor <iant@google.com>
6422 * options.h (class General_options): Add --warn-shared-textrel.
6423 * layout.cc (Layout::finish_dynamic_section): Implement
6424 --warn-shared-textrel.
6427 * options.h (class General_options): Add --warn-multiple-gp.
6429 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6431 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
6432 $(THREADSLIB) and $(LIBDL).
6433 * Makefile.in: Rebuild.
6435 2010-01-06 Ian Lance Taylor <iant@google.com>
6438 * options.cc (General_options::parse_section_start): New function.
6439 (General_options::section_start): New function.
6440 (General_options::General_options): Initialize all members.
6441 * options.h: Include <map>
6442 (class General_options): Add --section-start. Add section_starts_
6444 * layout.cc (Layout::attach_allocated_section_to_segment): If
6445 --section-start was used, set the address of the segment. Remove
6446 local sort_sections.
6447 (Layout::relaxation_loop_body): If the address of the load segment
6448 has been set by --section-start, don't use it.
6449 * output.h (Output_segment::update_flags_for_output_section): New
6451 * output.cc (Output_segment::add_output_section): Call
6452 update_flags_for_output_section.
6454 2010-01-05 Ian Lance Taylor <iant@google.com>
6457 * options.h (class General_options): Add --undefined-version.
6458 * script.cc (struct Version_expression): Add was_matched_by_symbol
6460 (Version_script_info::matched_symbol): New function.
6461 (Version_script_info::get_symbol_version_helper): Call
6463 (Version_script_info::check_unmatched_names): New function.
6464 * script.h (class Version_script_info): Update declarations.
6465 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
6467 * options.h (class General_options): Use DEFINE_bool_alias for
6468 allow_multiple_definition.
6469 * resolve.cc (Symbol_table::should_override): Don't test
6470 allow_multiple_definition.
6473 * options.h (class General_options): Add --cref.
6474 * main.cc (main): Print cref table if --cref. Don't close mapfile
6475 until after printing cref table.
6476 * cref.cc: Include "symtab.h".
6477 (class Cref_inputs): Define Cref_table_compare and Cref_table.
6478 (Cref_table_compare::operator()): New function.
6479 (Cref_inputs::gather_cref): New function.
6480 (filecol): New static const.
6481 (Cref_inputs::print_cref): New function.
6482 (Cref::print_cref): New function.
6483 * cref.h: Include <cstdio>.
6484 (class Cref): Update declarations.
6485 * mapfile.h (Mapfile::file): New function.
6486 * object.h (class Object): Define Symbols. Declare virtual
6487 do_get_global_symbols.
6488 (Object::get_global_symbols): New function.
6489 * object.cc (Input_objects::add_object): Pass object to cref_ if
6491 (Input_objects::archive_start): Likewise.
6492 (Input_objects::archive_stop): Likewise.
6493 (Input_objects::print_cref): New function.
6494 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
6495 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
6497 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
6499 * plugin.h (class Sized_pluginobj): Update declarations.
6501 2010-01-05 Ian Lance Taylor <iant@google.com>
6503 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
6504 to is_default_version. Rename insdef to insdefault.
6505 (Symbol_table::add_from_relobj): Rename def to is_default_version
6506 and local to is_forced_local.
6507 (Symbol_table::add_from_pluginobj): Likewise.
6508 (Symbol_table::add_from_dynobj): Likewise.
6509 (Symbol_table::define_special_symbol): Rename insdef to
6512 2010-01-04 Ian Lance Taylor <iant@google.com>
6515 * options.h (class General_options): Add
6516 --allow-multiple-definition and -z muldefs.
6517 * resolve.cc (Symbol_table::should_override): Don't warn about a
6518 multiple symbol definition if --allow-multiple-definition or -z
6522 * options.h (class General_options): Add --add-needed and
6523 --copy-dt-needed-entries. Tweak --as-needed help entry.
6524 * object.cc (Input_objects::check_dynamic_dependencies): Give an
6525 error if --copy-dt-needed-entries aka --add-needed is used and
6526 would cause a change in behaviour.
6529 * options.h (class General_options): Add -G as a short version of
6530 --shared. Add no-op options -assert, -g, and -i.
6532 2010-01-04 Sriraman Tallam <tmsriram@google.com>
6534 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
6535 check for .text or .gnu.linkonce.t sections.
6536 * icf.cc (Icf::find_identical_sections): Ditto.
6537 Change the detection for mangled function name within the section
6539 * icf.h (is_section_foldable_candidate): New function.
6541 2009-12-30 Ian Lance Taylor <iant@google.com>
6544 * options.h (class General_options): Permit two dashes with
6545 --retain-symbols-file.
6547 2009-12-30 Ian Lance Taylor <iant@google.com>
6550 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
6551 don't put the file header and segment headers in the text
6555 * common.cc (Sort_commons::operator()): Stabilize sort when both
6557 (Symbol_table::do_allocate_commons_list): When allocating common
6558 symbols, skip a symbol which is no longer common.
6559 * symtab.h (Symbol::is_common): Test whether the symbol comes from
6560 an object before checking its type.
6561 * testsuite/common_test_2.c: New file.
6562 * testsuite/common_test_3.c: New file.
6563 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
6564 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
6565 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
6566 (common_test_2_pic.o, common_test_2.so): New targets.
6567 (common_test_3_pic.o, common_test_3.so): New targets.
6568 * testsuite/Makefile.in: Rebuild.
6571 * script.cc (read_input_script): If we see a new SECTIONS clause,
6572 and we have added an input section, give an error.
6573 * layout.h (class Layout): Add have_added_input_section function.
6574 Add have_added_input_section_ field.
6575 * layout.cc (Layout::Layout): Initialize
6576 have_added_input_section_.
6577 (Layout::layout): Set have_added_input_section_.
6578 (Layout::layout_eh_frame): Likewise.
6580 2009-12-30 Ian Lance Taylor <iant@google.com>
6583 * options.h (class General_options): Add --sort-common option.
6584 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
6585 * common.cc (Sort_common): Add sort_order parameter to
6586 constructor. Add sort_order_ field.
6587 (Sort_commons::operator): Check sort_order_.
6588 (Symbol_table::allocate_commons): Determine the sort order.
6589 (Symbol_table::do_allocate_commons): Add sort_order parameter.
6591 (Symbol_table::do_allocate_commons_list): Likewise.
6593 2009-12-30 Ian Lance Taylor <iant@google.com>
6596 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
6597 symbols from this object, don't change the visibility of an
6599 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
6601 2009-12-30 Ian Lance Taylor <iant@google.com>
6604 * script.h (class Version_script_info): Define Language enum.
6605 Update declarations. Define Glob, Exact, and Lookup types. Add
6606 new fields globals_, locals_, and is_finalized_.
6607 * script.cc: Various formatting fixes.
6608 (class Parser_closure): Change language_stack_ from a vector of
6609 std::string to one of Version_script_info::Language. Adjust all
6611 (class Lazy_demangler): Remove.
6612 (struct Version_expression): Change language from std::string to
6613 Version_script_info::Language.
6614 (Version_script_info::Version_script_info): New function.
6615 (Version_script_info::~Version_script_info): Don't call clear.
6616 (Version_script_info::finalize): New function.
6617 (Version_script_info::build_lookup_tables): New function.
6618 (Version_script_info::build_expression_list_lookup): New
6620 (Version_script_info::get_symbol_version_helper): Rewrite to use
6622 (Version_script_info::print_expression_list): Adjust to use
6623 Version_script_info::Language.
6624 (script_push_lex_into_version_mode): Check that the version script
6625 has not been finalized.
6626 (version_script_push_lang): Change language string to
6627 Version_script_info::Language.
6628 * options.cc (Command_line::version_script): New function.
6629 * options.h (class General_options): Add finalize_dynamic_list
6630 function. Change version_script from declaration to definition.
6631 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
6632 * testsuite/version_script.map: Remove duplicate def of foo.
6633 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
6635 * testsuite/Makefile.in: Rebuild.
6637 2009-12-30 Ian Lance Taylor <iant@google.com>
6640 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
6641 if the input symbol index is 0, make the output symbol index 0.
6643 2009-12-30 Ian Lance Taylor <iant@google.com>
6646 * options.h (class General_options): Add -x/--discard-all.
6647 * object.cc (Sized_relobj::do_count_local_symbols): Handle
6648 --discard-all. If the local symbol needs a dynamic entry, check
6649 that before handling --discard-locals.
6651 2009-12-30 Ian Lance Taylor <iant@google.com>
6654 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
6656 (Output_segment::add_output_section): Don't change the flags if
6660 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
6661 GNU hash table if they need a dynamic value. Otherwise, don't add
6662 them if they are defined in a dynamic object or are forced local.
6664 2009-12-29 Ian Lance Taylor <iant@google.com>
6667 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
6668 .gnu.hash table for a 32-bit target.
6671 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
6672 regular and a dynamic object only needs a dynamic symbol table
6673 entry if it is externally visible.
6676 * i386.cc (class Target_i386): Initialize global_offset_table_ in
6677 constructor. Add global_offset_table_ field.
6678 (Target_i386::got_section): Set global_offset_table_.
6679 (Target_i386::do_finalize_sections): Set global_offset_table_
6681 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
6682 in constructor. Add global_offset_table_ field.
6683 (Target_x86_64::got_section): Set global_offset_table_.
6684 (Target_x86_64::do_finalize_sections): Set global_offset_table_
6687 * layout.cc (Layout::Layout): Initialize increase_relro_.
6688 (Layout::get_output_section): Add is_relro, is_last_relro, and
6689 is_first_non_relro parameters. Change all callers.
6690 (Layout::choose_output_section): Likewise.
6691 (Layout::add_output_section_data): Likewise.
6692 (Layout::make_output_section): Likewise.
6693 (Layout::set_segment_offsets): Clear increase_relro when using a
6695 * layout.h (class Layout): Add increase_relro method. Add
6696 increase_relro_ field. Update declarations.
6697 * output.cc (Output_section::Output_section): Initialize
6698 is_last_relro_ and is_first_non_relro_.
6699 (Output_segment::add_output_section): Group relro sections is
6700 do_sort is true. Handle is_last_relro and is_first_non_relro.
6701 (Output_segment::maximum_alignment): Remove relro handling.
6702 (Output_segment::set_section_addresses): Add increase_relro
6703 parameter. Change all callers. Add initial alignment to align
6704 relro sections on separate page. Remove old relro handling.
6705 (Output_segment::set_section_list_addresses): Remove in_relro
6706 parameter. Change all callers.
6707 (Output_segment::set_offset): Add increase parameter. Change all
6708 callers. Remove old relro handling.
6709 * output.h (class Output_section): Add new methods: is_last_relro,
6710 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
6711 Add is_last_relro_ and is_first_non_relro_ fields.
6712 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
6713 Create separate .got.plt section. Call increase_relro.
6714 * x86_64.cc (Target_x86_64::got_section): Likewise.
6715 * testsuite/relro_script_test.t: Add .got.plt.
6718 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
6719 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
6720 (Layout::finalize): Call set_dynamic_symbol_size.
6721 (Layout::set_dynamic_symbol_size): New function.
6722 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
6723 set_dynamic_symbol_size.
6726 * output.h (class Output_section): Add is_entsize_zero_ field.
6727 * output.cc (Output_section::Output_section): Initialize
6729 (Output_section::set_entsize): If two different entsizes are
6730 requested, force it to zero.
6731 (Output_section::add_input_section): Set flags for .debug_str
6732 before updating section flags. Set entsize.
6733 (Output_section::update_flags_for_input_section): Set SHF_MERGE
6734 and SHF_STRING if all input sections have those flags.
6736 2009-12-29 Rafael Espindola <espindola@google.com>
6738 * main.cc (main): Fix the sys time reporting.
6739 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
6742 2009-12-29 Sriraman Tallam <tmsriram@google.com>
6744 * options.cc (General_options::parse_version): Allow -v to exit
6745 without an error if there is nothing to link.
6747 2009-12-29 Ian Lance Taylor <iant@google.com>
6749 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
6750 using a version of gcc before 4.1.
6751 * configure: Rebuild.
6753 2009-12-28 Chris Demetriou <cgd@google.com>
6755 * attributes.cc (Output_attributes_section_data::do_write): Use
6756 std::vector::front rather than std::vector::data.
6758 2009-12-28 Ian Lance Taylor <iant@google.com>
6760 * symtab.h (class Symbol_table): Add enum Defined.
6761 * resolve.cc (Symbol_table::should_override): Add defined
6762 parameter. Change all callers. Test whether object is NULL
6763 before calling a method on it.
6764 (Symbol_table::report_resolve_problem): Add defined parameter.
6766 (Symbol_table::should_override_with_special): Likewise.
6767 * symtab.cc (Symbol_table::define_in_output_data): Add defined
6768 parameter. Change all callers.
6769 (Symbol_table::do_define_in_output_data): Likewise.
6770 (Symbol_table::define_in_output_segment): Likewise.
6771 (Symbol_table::do_define_in_output_segment): Likewise.
6772 (Symbol_table::define_as_constant): Likewise.
6773 (Symbol_table::do_define_as_constant): Likewise.
6774 * script.h (class Symbol_assignment): Add is_defsym parameter to
6775 constructor; change all callers.
6776 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
6777 parameter. Change all callers. Add is_defsym_ field.
6778 (class Parser_closure): Add parsing_defsym parameter to
6779 constructor; change all callers. Add parsing_defsym accessor
6780 function. Add parsing_defsym_ field.
6782 2009-12-28 Ian Lance Taylor <iant@google.com>
6784 * gold.cc (queue_middle_tasks): Fix formatting.
6785 * object.cc (Relobj::is_section_name_included): Likewise.
6787 2009-12-23 Ian Lance Taylor <iant@google.com>
6789 * i386.cc (Target_i386::do_calls_non_split): Recognize
6790 -fsplit-stack prologue for a function with a static chain.
6791 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
6792 -fsplit-stack prologue when using %r11.
6794 2009-12-21 Sriraman Tallam <tmsriram@google.com>
6796 * options.cc (General_options::parse_version): Make -v continue and do
6797 the link like GNU ld does.
6799 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
6801 * Makefile.am (CCFILES): Add timer.cc.
6802 (HFILES): Add timer.h.
6803 * configure.ac: Check for sysconf and times.
6804 * main.cc: include timer.h.
6805 (main): Use Timer instead of get_run_time.
6808 * workqueue.cc: include timer.h.
6809 (Workqueue::find_and_run_task):
6810 Report user, sys and wall time.
6811 * Makefile.in: Regenerate.
6812 * config.in: Regenerate.
6813 * configure: Regenerate.
6815 2009-12-16 Doug Kwan <dougkwan@google.com>
6817 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
6819 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
6820 relaxed input sections.
6821 * output.cc (Output_section::find_relaxed_input_section): Change
6822 return type to Output_relaxed_input_section pointer. Adjust code
6823 for new type of relaxed_input_section_map_.
6824 * output.h (Output_section::find_relaxed_input_section): Change
6825 return type to Output_relaxed_input_section pointer.
6826 (Output_section::Output_relaxed_input_section_by_input_section_map):
6828 (Output_section::relaxed_input_section_map_): Change type to
6829 Output_section::Output_relaxed_input_section_by_input_section_map.
6830 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
6833 2009-12-15 Ian Lance Taylor <iant@google.com>
6835 * layout.cc (Layout::create_shstrtab): Only write out after input
6836 sections if we are compressing debug sections.
6838 2009-12-15 Ian Lance Taylor <iant@google.com>
6840 * archive.cc (Archive::add_symbols): Only look up a symbol without
6841 a version if there is, in fact, a version.
6843 2009-12-14 Ian Lance Taylor <iant@google.com>
6845 Revert -Wshadow changes, all changes from:
6846 2009-12-11 Doug Kwan <dougkwan@google.com>
6847 2009-12-11 Nick Clifton <nickc@redhat.com>
6848 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
6850 2009-12-11 Doug Kwan <dougkwan@google.com>
6852 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
6854 * attributes.cc (Object_attribute::size): Ditto.
6855 (Attributes_section_data::size): Ditto.
6856 (Attributes_section_data::Attributes_section_data): Ditto.
6857 (Output_attributes_section_data::do_write): Ditto.
6858 * attributes.h (Object_attribute::set_type): Ditto.
6859 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
6861 2009-12-11 Nick Clifton <nickc@redhat.com>
6863 * archive.cc: Fix shadowed variable warnings.
6865 * compressed_output.cc: Likewise.
6866 * compressed_output.h: Likewise.
6867 * configure: Likewise.
6868 * dwarf_reader.cc: Likewise.
6869 * dynobj.cc: Likewise.
6870 * dynobj.h: Likewise.
6871 * ehframe.cc: Likewise.
6872 * ehframe.h: Likewise.
6873 * errors.cc: Likewise.
6874 * expression.cc: Likewise.
6875 * fileread.cc: Likewise.
6876 * fileread.h: Likewise.
6877 * freebsd.h: Likewise.
6878 * i386.cc: Likewise.
6880 * incremental.h: Likewise.
6881 * layout.cc: Likewise.
6882 * layout.h: Likewise.
6883 * mapfile.cc: Likewise.
6884 * merge.cc: Likewise.
6885 * merge.h: Likewise.
6886 * object.cc: Likewise.
6887 * object.h: Likewise.
6888 * options.h: Likewise.
6889 * output.cc: Likewise.
6890 * output.h: Likewise.
6891 * parameters.cc: Likewise.
6892 * plugin.cc: Likewise.
6893 * powerpc.cc: Likewise.
6894 * reduced_debug_output.cc: Likewise.
6895 * reduced_debug_output.h: Likewise.
6896 * reloc.cc: Likewise.
6897 * reloc.h: Likewise.
6898 * resolve.cc: Likewise.
6899 * script-sections.cc: Likewise.
6900 * script.cc: Likewise.
6901 * script.h: Likewise.
6902 * sparc.cc: Likewise.
6903 * symtab.cc: Likewise.
6904 * symtab.h: Likewise.
6905 * target-select.cc: Likewise.
6906 * target-select.h: Likewise.
6907 * token.h: Likewise.
6908 * workqueue.cc: Likewise.
6909 * workqueue.h: Likewise.
6910 * x86_64.cc: Likewise.
6912 2009-12-10 Doug Kwan <dougkwan@google.com>
6914 * arm.cc (attributes.h): New include.
6915 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
6916 (Arm_relobj::~Arm_relobj): Delete object pointed by
6917 attributes_section_data_.
6918 (Arm_relobj::attributes_section_data): New method definition.
6919 (Arm_relobj::attributes_section_data_): New data member declaration.
6920 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
6921 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
6922 attributes_section_data_.
6923 (Arm_dynobj::attributes_section_data): New method definition.
6924 (Arm_dynobj::attributes_section_data_): New data member declaration.
6925 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
6926 initialization value of may_use_blx_ to false.
6927 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
6928 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
6929 object attributes to compute results instead of hard-coding.
6930 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
6931 Target_arm::get_secondary_compatible_arch,
6932 Target_arm::set_secondary_compatible_arch
6933 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6934 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
6935 New method declarations.
6936 (Target_arm::get_aeabi_object_attribute): New method definition.
6937 (Target_arm::attributes_section_data_): New data member declaration.
6938 (read_arm_attributes_section): New template definition.
6939 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
6940 (Arm_dynobj::do_read_symbols): Ditto.
6941 (Target_arm::do_finalize_sections): Merge attributes sections from
6942 input. Check for BLX use after attributes section merging.
6943 Fix __exidx_start and __exidx_end visibility. Create an
6944 .ARM.attributes section if necessary.
6945 (Target_arm::get_secondary_compatible_arch,
6946 Target_arm::set_secondary_compatible_arch,
6947 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6948 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
6949 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
6950 New method definitions.
6952 2009-12-09 Ian Lance Taylor <iant@google.com>
6954 * plugin.cc (Plugin::load): Don't cast from void* to a function
6957 2009-12-09 Ian Lance Taylor <iant@google.com>
6959 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
6962 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
6964 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
6965 Replace two_file_shared_1.so with two_file_shared_2.so.
6966 * testsuite/Makefile.in: Regenerated.
6968 2009-12-08 Doug Kwan <dougkwan@google.com>
6970 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
6971 (HFILES): Add attributes.h and int_encoding.h.
6972 * Makefile.in: Regenerate.
6973 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
6974 function definitions to int_encoding.cc
6975 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
6976 prototypes to int_encoding.h
6977 * reduced_debug_output.cc (int_encoding.h): New include.
6978 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
6979 function definitions to int_encoding.cc
6980 (insert_into_vector, read_from_pointer): Move template definitions to
6982 * attributes.cc: New file.
6983 * attributes.h: New file.
6984 * int_encoding.cc: New file.
6985 * int_encoding.h: New file.
6987 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
6990 * incremental-dump.cc (dump_incremental_inputs): New.
6991 (main): Use dump_incremental_inputs.
6993 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
6996 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
6997 checking elfcpp::STT_FUNC.
6998 (Target_i386::Relocate::relocate): Likewise.
6999 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
7001 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
7002 symbols from shared libraries into normal FUNC symbols.
7004 * symtab.h (Symbol): Add is_func and use it.
7006 2009-12-05 Doug Kwan <dougkwan@google.com>
7008 * arm.cc (Target_arm::arm_info): Initialize new fields
7009 attributes_section and attributes_vendor.
7010 * i386.cc (Target_i386::i386_info): Same.
7011 * object.cc (Sized_relobj::do_layout): Skip attribute section.
7012 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7013 fields attributes_section and attributes_vendor.
7014 * sparc.cc (Target_sparc::sparc_info): Same.
7015 * target.h (Target::attributes_section, Target::attributes_vendor,
7016 Target::is_attributes_section, Target::attribute_arg_type,
7017 Target::attributes_order): New method definitions.
7018 (Target::Target_info::attributes_section,
7019 Target::Target_info::attributes_vendor): New fields.
7020 (Target::do_attribute_arg_type, Target::do_attributes_order): New
7021 virtual method definitions.
7022 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7023 attributes_section and attributes_vendor.
7024 * testsuite/testfile.cc (Target_test::test_target_info): Same.
7026 2009-12-05 Doug Kwan <dougkwan@google.com>
7028 * arm.cc: Update comments about interworking and stub generation.
7029 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
7030 considered as non-PIC.
7031 (Arm_relocate_functions::base_abs): Fix formatting.
7032 (Arm_relocate_functions::got_prel): Fix comment. Change interface
7033 of function to use GOT entry address instead of offset.
7034 (Target_arm::Scan::global): Issue an error if a symbol would need a
7035 PLT does not get one because it is untyped. Remove code to create
7036 dynamic symbols for relative branches.
7037 (Target_arm::Relocate::relocate: Use 0 instead of false since function
7038 takes unsigned integer instead of boolean.
7040 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
7042 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7043 (two_file_test_LDADD): Likewise.
7044 (common_test_1_LDADD): Likewise.
7045 (exception_test_LDADD) Likewise.
7046 (weak_test_LDADD): Likewise.
7047 (many_sections_test_LDADD): Likewise.
7048 (initpri1_LDADD): Likewise.
7049 (script_test_1_LDADD): Likewise.
7050 (script_test_2_LDADD): Likewise.
7051 (justsyms_LDADD): Likewise.
7052 (binary_test_LDADD): Likewise.
7053 (large_LDADD): Likewise.
7054 * testsuite/Makefile.in: Regenerated.
7056 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
7058 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7059 (Symbol_table::override_with_special): Likewise.
7060 (Symbol_table::add_from_object): Likewise.
7062 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
7064 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7065 Don't set the data_offset twice.
7067 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
7069 * testsuite/Makefile.in: Regenerate.
7071 2009-12-03 Doug Kwan <dougkwan@google.com>
7073 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
7074 (Target_arm::do_finalize_sections): Add parameter for symbol table
7075 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
7076 * i386.cc (Target_i386::do_finalize_sections): Add an additional
7077 parameter for symbol table pointer.
7078 * layout.cc (Layout::finalize): Call Target::finalize_sections with
7079 an additional parameter for a pointer to symbol table.
7080 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
7081 parameter for a symbol table pointer.
7082 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
7083 * target.h (Target::finalize_sections, Target::do_finalize_sections):
7085 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
7086 parameter for a symbol table pointer.
7088 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
7090 * incremental.cc (Incremental_inputs_header)
7091 (Incremental_inputs_header_write, Incremental_inputs_entry)
7092 (Incremental_inputs_entry_write): Move ...
7093 * incremental.h (Incremental_inputs_header)
7094 (Incremental_inputs_header_write, Incremental_inputs_entry)
7095 (Incremental_inputs_entry_write): here.
7097 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7099 * incremental.cc (make_sized_incremental_binary): Set the target.
7100 Error if it is incompatible.
7101 * output.h (Output_file): Add filename method.
7103 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7105 * incremental.cc (Incremental_inputs_entry): Remove unused argument
7106 from the get_* methods.
7108 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7110 * incremental-dump.cc (main): Check that the offeset of a script is 0.
7111 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7112 Write 0 for the data_offset of scripts.
7114 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7116 * testsuite/Makefile.am: Add the incremental_test.sh test.
7117 * testsuite/incremental_test.sh: New.
7118 * testsuite/incremental_test_1.c: New.
7119 * testsuite/incremental_test_2.c: New.
7121 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
7123 * incremental-dump.cc (main): Fix typos.
7125 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
7128 * incremental-dump.cc (main): Use llu to print 64 bit values.
7130 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
7131 H.J. Lu <hongjiu.lu@intel.com>
7133 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
7135 (incremental_dump_LDADD): Likewise.
7136 * Makefile.in: Regenerated.
7138 2009-11-25 Doug Kwan <dougkwan@google.com>
7142 2009-11-25 Doug Kwan <dougkwan@google.com>
7144 * arm.cc (Target_arm::Target_arm): Move method definition
7145 outside of class definition. Add code to handle
7146 --target1-rel, --target1-abs and --target2= options.
7147 (Target_arm::get_reloc_reloc_type): Change method to be
7148 non-static and const.
7149 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
7150 New data member declaration.
7151 (Target_arm::Scan::local, Target_arm::Scan::global,
7152 Target_arm::Relocate::relocate,
7153 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7154 Adjust call to Target_arm::get_real_reloc_type.
7155 (Target_arm::get_real_reloc_type): Use command line options
7156 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7157 * options.h (--target1-rel, --target1-abs, --target2): New
7160 2009-11-25 Doug Kwan <dougkwan@google.com>
7162 * arm.cc (Target_arm::Target_arm): Move method definition outside of
7163 class definition. Add code to handle --target1-rel, --target1-abs
7164 and --target2= options.
7165 (Target_arm::get_reloc_reloc_type): Change method to be non-static
7167 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
7169 (Target_arm::Scan::local, Target_arm::Scan::global,
7170 Target_arm::Relocate::relocate,
7171 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
7172 call to Target_arm::get_real_reloc_type.
7173 (Target_arm::get_real_reloc_type): Use command line options to
7174 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7175 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
7178 2009-11-25 Doug Kwan <dougkwan@google.com>
7180 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
7181 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
7182 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
7184 (Arm_relocate_functions::thm_call): Replace body with a call to
7185 Arm_relocate_functions::thumb_branch_common.
7186 (Arm_relocate_functions::thm_jump24,
7187 Arm_relocate_functions::thm_xpc22): New method definitions.
7188 (Arm_relocate_functions::thumb_branch_common): New method definition.
7189 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
7191 (Target_arm::Relocate::relocate): Adjust call to thm_call.
7192 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
7194 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
7196 * Makefile.am: Build incremental-dump
7197 * Makefile.in: Regenerate.
7198 * incremental-dump.cc: New.
7199 * incremental.cc (Incremental_inputs_header_data,
7200 Incremental_inputs_entry_data): Move to incremental.h
7201 * incremental.h: (Incremental_inputs_header_data,
7202 Incremental_inputs_entry_data): Move from incremental.cc
7204 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
7206 * incremental.cc (Incremental_inputs_header,
7207 Incremental_inputs_header_write, Incremental_inputs_entry,
7208 Incremental_inputs_entry_write): Add a typedef with the data type.
7210 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
7212 * incremental.cc (Incremental_inputs_header,
7213 Incremental_inputs_header_write, Incremental_inputs_entry,
7214 Incremental_inputs_entry_write): Update comment about which
7215 type has the filed descriptions.
7217 2009-11-15 Doug Kwan <dougkwan@google.com>
7219 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
7220 (Arm_relocate_functions::arm_branch_common): Change method defintion
7221 in class definition to a method declaration and update list of formal
7223 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
7224 Arm_relocation_functions::jump24): Adjust call to
7225 Arm_relocate_functions::arm_branch_common. Update list of formal
7227 (Arm_relocate_functions::xpc25): New method definition.
7228 (Arm_relocate_functions::arm_branch_common): Move method defintion
7229 out from class definition. Use stubs for mode-switching and extending
7231 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
7232 specially. Change code to enable use of stubs in ARM branches.
7234 2009-11-10 Doug Kwan <dougkwan@google.com>
7236 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
7237 in method declaration.
7238 (Target_arm::relocate_stub): New method declaration.
7239 (Target_arm::default_target): Change to return a pointer instead of
7241 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
7242 Target_arm::default_target.
7243 (Arm_Relobj::do_relocate_sections): Remove options paramater in
7245 (Target_arm::relocate_section): Adjust view.
7246 (Target_arm::relocate_stub): New method definition.
7248 2009-11-10 Doug Kwan <dougkwan@google.com>
7250 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
7252 * incremental.cc (open_incremental_binary): Initialized local
7253 variables to avoid warnings.
7254 * object.cc (make_elf_object): Ditto.
7255 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
7258 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
7261 * testsuite/plugin_test.c: Include "config.h".
7263 2009-11-09 Doug Kwan <dougkwan@google.com>
7265 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
7266 (arm_symbol_value): Remove.
7267 (Arm_relocate_functions::arm_branch_common,
7268 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
7269 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
7270 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
7271 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
7272 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
7273 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
7274 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
7275 Arm_relocate_functions::thm_mobw_abs_nc,
7276 Arm_relocate_functions::thm_mov_abs,
7277 Arm_relocate_functions::movw_prel_nc,
7278 Arm_relocate_functions::thm_movt_abs,
7279 Arm_relocate_functions::movt_prel,
7280 Arm_relocate_functions::thm_movw_prel_nc,
7281 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
7282 (Target_arm::Relocate::relocate): Only decompose address into two
7283 parts if relocation type uses the thumb-bit and pass the actual
7284 bit instead of a flag indicating that the thumb-bit is used. Adjust
7285 calls to methods in Arm_relocate_functions for this change.
7287 2009-11-08 Ian Lance Taylor <iant@google.com>
7290 * reloc.cc: Instantiate
7291 Sized_relobj::initialize_input_to_output_maps and
7292 Sized_relobj:free_input_to_output_maps.
7294 2009-11-06 Ian Lance Taylor <iant@google.com>
7297 * defstd.cc (in_segment): Set only_if_ref true for "end".
7299 2009-11-06 Doug Kwan <dougkwan@google.com>
7301 * arm.cc (class Reloc_stub): Correct a comment.
7302 (Target_arm::Target_arm): Initialize arm_input_section_map_.
7303 (Target_arm::scan_section_for_stubs): New method declaration.
7304 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
7305 Change methods from private to protected.
7306 (Target_arm::do_may_relax): New method definition.
7307 (Target_arm::do_relax, Target_arm::group_sections,
7308 Target_arm::scan_reloc_for_stub,
7309 Target_arm::scan_reloc_section_for_stubs): New method declarations.
7310 (Target_arm::arm_input_section_map_): New data member declaration.
7311 (Target_arm::scan_reloc_for_stub,
7312 Target_arm::scan_reloc_section_for_stubs,
7313 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
7314 Target_arm::do_relax): New method definitions.
7316 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
7318 * configure.ac: Check for (struct stat)::st_mtim
7319 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
7320 * config.in: Regenerate.
7321 * configure: Regenerate.
7323 2009-11-05 Ian Lance Taylor <iant@google.com>
7326 * output.cc (Output_segment::add_output_section): Add missing
7329 2009-11-04 Ian Lance Taylor <iant@google.com>
7332 * object.h (class Object): Add is_needed and set_is_needed
7333 methods. Add is_needed_ field. Make bool fields into bitfields.
7334 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
7335 defined in a dynamic object and referenced by a regular object,
7336 set is_needed for the dynamic object.
7337 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
7338 if the file is marked with as_needed and it is not needed.
7340 2009-11-04 Ian Lance Taylor <iant@google.com>
7343 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
7344 tags if data is discarded by linker script.
7345 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7346 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7347 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7348 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7350 2009-11-04 Ian Lance Taylor <iant@google.com>
7352 * layout.cc (Layout::get_output_section): Add is_interp and
7353 is_dynamic_linker_section parameters. Change all callers.
7354 (Layout::choose_output_section): Likewise.
7355 (Layout::make_output_section): Likewise.
7356 (Layout::add_output_section_data): Add is_dynamic_linker_section
7357 parameter. Change all callers.
7358 * layout.h (class Layout): Update declarations.
7359 * output.h (class Output_section): Add is_interp, set_is_interp,
7360 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
7361 Add is_interp_, is_dynamic_linker_section_ fields. Change
7362 generate_code_fills_at_write_ to a bitfield.
7363 * output.cc (Output_section::Output_sections): Initialize new
7365 (Output_segment::add_output_section): Add do_sort parameter.
7368 2009-11-03 Ian Lance Taylor <iant@google.com>
7371 * options.h (class General_options): Add --warn-common.
7372 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
7373 merging two common symbols.
7374 (Symbol_table::should_override): Handle --warn-common when merging
7375 a common symbol with a defined symbol. Use report_resolve_problem
7376 for multiple definitions.
7377 (Symbol_table::report_resolve_problem): New function.
7378 * symtab.h (class Symbol_table): Declare report_resolve_problem.
7380 2009-11-03 Doug Kwan <dougkwan@google.com>
7382 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
7384 (Target_arm::stub_factory): New method definition.
7385 (Target_arm::new_arm_input_section,
7386 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
7387 Target_arm::reloc_uses_thumb_bit): New method declarations.
7388 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
7389 New type definitions.
7390 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
7391 member declarations.
7392 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
7393 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
7394 New method definitions.
7396 2009-11-03 Ian Lance Taylor <iant@google.com>
7398 * options.h (class General_options): Add --warn_constructors.
7400 2009-11-03 Ian Lance Taylor <iant@google.com>
7403 * defstd.cc (in_section): Add entries for __rel_iplt_start,
7404 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
7406 2009-11-03 Ian Lance Taylor <iant@google.com>
7409 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
7410 --msgid-bugs-address.
7411 (install-pdf): New target.
7412 (install-data_yes): Look up one directory to find mkinstalldirs.
7414 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
7416 * po/Make-in (.po.gmo): Don't generate .gmo files in source
7419 2009-10-30 Doug Kwan <dougkwan@google.com>
7421 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
7423 2009-10-30 Doug Kwan <dougkwan@google.com>
7425 * arm.cc (Stub_addend_reader): New struct template definition
7426 and partial specializations.
7427 (Stub_addend_reader::operator()): New method definition for a
7428 partially specialized template.
7430 2009-10-30 Doug Kwan <dougkwan@google.com>
7432 * arm.cc (Arm_relobj::processor_specific_flags): New method
7434 (Arm_relobj::do_read_symbols): New method declaration.
7435 (Arm_relobj::processor_specific_flags_): New data member declaration.
7436 (Arm_dynobj): New class definition.
7437 (Target_arm::do_finalize_sections): Add input_objects parameter.
7438 (Target_arm::do_adjust_elf_header): New method declaration.
7439 (Target_arm::are_eabi_versions_compatible,
7440 (Target_arm::merge_processor_specific_flags): New method declaration.
7441 (Target_arm::do_make_elf_object): New overloaded method definitions
7443 (Arm_relobj::do_read_symbols): New method definition.
7444 (Arm_dynobj::do_read_symbols): Ditto.
7445 (Target_arm::do_finalize_sections): Add input_objects parameters.
7446 Merge processor-specific flags from all input objects.
7447 (Target_arm::are_eabi_versions_compatible,
7448 Target_arm::merge_processor_specific_flags,
7449 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
7450 New method definitions.
7451 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
7452 Input_objects pointer type parameter.
7453 * layout.cc (Layout::finalize): Pass input objects to target's.
7454 finalize_sections function.
7455 * output.cc (Output_file_header::do_sized_write): Set ELF file
7456 header's processor-specific flags.
7457 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
7458 Input_objects pointer type parameter.
7459 * sparc.cc (Target_sparc::do_finalize_sections): Same.
7460 * target.h (Input_objects): New forward class declaration.
7461 (Target::processor_specific_flags,
7462 Target::are_processor_specific_flags_sect): New method definitions.
7463 (Target::finalize_sections): Add input_objects parameter.
7464 (Target::Target): Initialize processor_specific_flags_ and
7465 are_processor_specific_flags_set_.
7466 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
7468 (Target::set_processor_specific_flags): New method definition.
7469 (Target::processor_specific_flags_,
7470 Target::are_processor_specific_flags_set_): New data member
7472 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
7473 Input_objects pointer type parameter.
7475 2009-10-30 Doug Kwan <dougkwan@google.com>
7477 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
7479 2009-10-28 Ian Lance Taylor <iant@google.com>
7481 * object.h (class Relobj): Drop options parameter from
7482 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
7483 do_scan_relocs, do_relocate. Change all callers.
7484 (class Sized_relobj): Drop options parameters from
7485 do_gc_process_relocs, do_scan_relocs, do_relocate,
7486 do_relocate_sections, relocate_sections, emit_relocs_scan,
7487 emit_relocs_scan_reltype. Change all callers.
7488 (struct Relocate_info): Remove options field and all references to
7490 * reloc.h (class Read_relocs): Remove options constructor
7491 parameter and options_ field. Change all callers.
7492 (class Gc_process_relocs, class Scan_relocs): Likewise.
7493 (class Relocate_task): Likewise.
7494 * target-reloc.h (scan_relocs): Remove options parameter. Change
7496 (scan_relocatable_relocs): Likewise.
7497 * target.h (class Sized_target): Remove options parameter from
7498 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
7500 * gc.h (gc_process_relocs): Remove options parameter. Change all
7502 * arm.cc: Update functions to remove options parameters.
7503 * i386.cc: Likewise.
7504 * powerpc.cc: Likewise.
7505 * sparc.cc: Likewise.
7506 * x86_64.cc: Likewise.
7507 * testsuite/testfile.cc: Likewise.
7509 2009-10-28 Doug Kwan <dougkwan@google.com>
7511 * arm.cc (Arm_relobj): New class definition.
7512 (Arm_relobj::scan_sections_for_stubs,
7513 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
7514 New method definitions.
7516 2009-10-28 Cary Coutant <ccoutant@google.com>
7518 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
7519 (Plugin::cleanup_done_): New member.
7520 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
7521 (Plugin_manager::cleanup_done_): Remove.
7522 (Plugin_manager::add_input_file): Edit error message.
7523 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
7524 (Plugin_manager::cleanup): Remove use of cleanup_done_.
7526 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
7528 * fileread.cc: (File_read::View::~View): Use the new
7529 data_ownership_ filed.
7530 (File_read::~File_read): Dispose the new whole_file_view_.
7531 (File_read::open): Mmap the whole file if needed.
7532 (File_read::open): Use whole_file_view_ instead of contents_.
7533 (File_read::find_view): Use whole_file_view_ if applicable.
7534 (File_read::do_read): Use whole_file_view_ instead of contents_.
7535 (File_read::make_view): Use whole_file_view_ instead of contents_,
7536 update File_read::View::View call.
7537 (File_read::find_or_make_view): Update File_read::View::View
7539 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
7541 (File_read::View::Data_ownership): New enum.
7542 (File_read::View::View): Replace bool mapped_ with Data_ownership
7544 (File_read::View::mapped_): Remove (replaced by data_ownership_).
7545 (File_read::View::data_ownership_): New field.
7546 (File_read::contents_): Remove (replaced by whole_file_view_).
7547 (File_read::whole_file_view_): New field.
7548 * options.h (class General_options): Add --keep-files-mapped.
7550 2009-10-27 Cary Coutant <ccoutant@google.com>
7552 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
7553 * testsuite/Makefile.am (plugin_test_5): New test case.
7554 * testsuite/Makefile.in: Regenerate.
7556 2009-10-25 Doug Kwan <dougkwan@google.com>
7558 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
7559 from private to protected to allow access by child class.
7560 (Sized_relobj::do_relocate_sections): New method declaration.
7561 (Sized_relobj::relocate_sections): Virtualize.
7562 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
7563 Sized_relobj::relocate_sections. Instantiate template explicitly
7564 for different target sizes and endianity.
7566 2009-10-24 Doug Kwan <dougkwan@google.com>
7568 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
7569 (Arm_input_section::as_arm_input_section): New method.
7570 (Arm_output_section): New class definition.
7571 (Arm_output_section::create_stub_group,
7572 Arm_output_section::group_sections): New method definitions.
7574 2009-10-22 Doug Kwan <dougkwan@google.com>
7576 * arm.cc (Arm_input_section): New class definition.
7577 (Arm_input_section::init, Arm_input_section:do_write,
7578 Arm_input_section::set_final_data_size,
7579 Arm_input_section::do_reset_address_and_file_offset): New method
7582 2009-10-21 Doug Kwan <dougkwan@google.com>
7584 * arm.cc (Stub_table, Arm_input_section): New forward class
7586 (Stub_table): New class defintion.
7587 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
7588 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
7589 New method definition.
7591 2009-10-21 Doug Kwan <dougkwan@google.com>
7593 * arm.cc: Update copyright comments.
7594 (Target_arm): New forward class template declaration.
7595 (Arm_address): New type.
7596 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
7597 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
7598 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
7600 (Insn_template): Same.
7601 (DEF_STUBS): New macro.
7602 (Stub_type): New enum type.
7603 (Stub_template): New class definition.
7606 (Stub_factory): Same.
7607 (Target_arm::Target_arm): Initialize may_use_blx_ and
7608 should_force_pic_veneer_.
7609 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
7610 Target_arm::should_force_pic_veneer,
7611 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
7612 Target_arm::using_thumb_only, Target_arm:;default_target): New
7614 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
7615 New data member declarations.
7616 (Insn_template::size, Insn_template::alignment): New method defintions.
7617 (Stub_template::Stub_template): New method definition.
7618 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
7619 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
7620 (Stub_factory::Stub_factory): New method definition.
7621 * gold.h (string_hash): New template.
7622 * output.h (Input_section_specifier::hash_value): Use
7624 (Input_section_specifier::string_hash): Remove.
7625 * stringpool.cc (Stringpool_template::string_hash): Use
7628 2009-10-20 Doug Kwan <dougkwan@google.com>
7630 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
7631 symbols of relaxed input sections.
7632 * output.h (Output_section::find_relaxed_input_section): Make
7635 2009-10-16 Doug Kwan <dougkwan@google.com>
7637 * dynobj.cc (Versions::Versions): Initialize version_script_.
7638 Only insert base version symbol definition for a shared object
7639 if version script defines any version versions.
7640 (Versions::define_base_version): New method definition.
7641 (Versions::add_def): Check that base version is not needed.
7642 (Versions::add_need): Define base version lazily.
7643 * dynobj.h (Versions::define_base_version): New method declaration.
7644 (Versions::needs_base_version_): New data member declaration.
7645 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
7646 (check_DATA): Add no_version_test.stdout.
7647 (libno_version_test.so, no_version_test.o no_version_test.stdout):
7649 * testsuite/Makefile.in: Regenerate.
7650 * testsuite/no_version_test.c: New file.
7651 * testsuite/no_version_test.sh: Ditto.
7653 2009-10-16 Doug Kwan <dougkwan@google.com>
7655 * expression.cc (class Segment_start_expression): New class definition.
7656 (Segment_start_expression::value): New method definition.
7657 (script_exp_function_segment_start): Return a new
7658 Segment_start_expression.
7659 * gold/script-c.h (script_saw_segment_start_expression): New function
7661 * script-sections.cc (Script_sections::Script_sections): Initialize
7662 SAW_SEGMENT_START_EXPRESSION_ to false.
7663 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
7664 and -Tbbs options to specify section addresses if given in
7665 command line and no SEGMENT_START expression is seen in a script.
7666 * script-sections.h (Script_sections::saw_segment_start_expression,
7667 Script_sections::set_saw_segment_start_expression): New method
7669 (Script_sections::saw_segment_start_expression_): New data member
7671 * script.cc (script_saw_segment_start_expression): New function.
7672 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
7673 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
7674 script_test_7.sh and script_test_8.sh.
7675 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
7676 script_test_8.stdout.
7677 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
7678 (script_test_6, script_test_6.stdout, script_test_7,
7679 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
7680 * Makefile.in: Regenerate.
7681 * testsuite/script_test_6.sh: New file.
7682 * testsuite/script_test_6.t: Same.
7683 * testsuite/script_test_7.sh: Same.
7684 * testsuite/script_test_7.t: Same.
7685 * testsuite/script_test_8.sh: Same.
7687 2009-10-16 Doug Kwan <dougkwan@google.com>
7689 * output.cc (Output_segment::set_section_list_address): Cast
7690 expressions to unsigned long long type to avoid format warnings.
7692 2009-10-15 Ian Lance Taylor <iant@google.com>
7694 * script.cc (Script_options::add_symbol_assignment): Always add a
7695 dot assignment to script_sections_.
7696 * script-sections.cc (Script_sections::add_dot_assignment):
7697 Initialize if necessary.
7699 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
7700 program headers with no load segment if there is a linker script.
7702 * layout.cc (Layout::set_segment_offsets): Align the file offset
7703 to the segment aligment for -N or -n with no load segment.
7704 * output.cc (Output_segment::add_output_section): Don't crash if
7705 the first section is a TLS section.
7706 (Output_segment::set_section_list_addresses): Print an error
7707 message if the address moves backward in a linker script.
7708 * script-sections.cc
7709 (Output_section_element_input::set_section_addresses): Don't
7710 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
7711 (Orphan_output_section::set_section_addresses): Likewise.
7713 2009-10-15 Doug Kwan <dougkwan@google.com>
7715 * layout.cc (Layout::finish_dynamic_section): Generate tags
7716 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
7717 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
7718 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
7720 2009-10-14 Ian Lance Taylor <iant@google.com>
7722 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
7724 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
7725 data_shdr fields of relinfo.
7726 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
7727 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
7728 R_386_TLS_LDO_32, adjust based on section flags.
7729 (Target_i386::Relocate::fix_up_ldo): Remove.
7731 2009-10-13 Ian Lance Taylor <iant@google.com>
7733 Add support for -pie.
7734 * options.h (class General_options): Add -pie and
7736 (General_options::output_is_position_independent): Test -pie.
7737 (General_options::output_is_executable): Return true if not shared
7738 and not relocatable.
7739 (General_options::output_is_pie): Remove.
7740 * options.cc (General_options::finalize): Reject incompatible uses
7742 * gold.cc (queue_middle_tasks): A -pie link is not static.
7743 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
7744 * symtab.cc (Symbol::final_value_is_known): Return false if
7745 output_is_position_independent.
7746 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
7747 output_is_position_independent.
7748 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
7749 output_is_position_independent.
7750 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
7751 output_is_position_independent.
7752 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
7754 (basic_pie_test.o, basic_pie_test): New targets.
7755 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
7756 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
7757 (two_file_pie_test): New target.
7758 * testsuite/Makefile.in: Rebuild.
7759 * README: Remove note saying that -pie is not supported.
7761 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
7763 * options.h (class General_options): Add -init and -fini.
7764 * layout.cc (Layout::finish_dynamic_section): Emit
7765 given init and fini functions.
7767 2009-10-13 Sriraman Tallam <tmsriram@google.com>
7769 * gc.h (gc_process_relocs): Check if icf is enabled using new
7771 * gold.cc (queue_initial_tasks): Likewise.
7772 (queue_middle_tasks): Likewise.
7773 * object.cc (do_layout): Likewise.
7774 * symtab.cc (is_section_folded): Likewise.
7775 * main.cc (main): Likewise.
7776 * reloc.cc (Read_relocs::run): Likewise.
7777 (Sized_relobj::do_scan_relocs): Likewise.
7778 * icf.cc (is_function_ctor_or_dtor): New function.
7779 (Icf::find_identical_sections): Check if function is ctor or dtor when
7781 * options.h (General_options::icf): Change option to be an enum.
7782 (Icf_status): New enum.
7783 (icf_enabled): New method.
7784 (icf_safe_folding): New method.
7785 (set_icf_status): New method.
7786 (icf_status_): New variable.
7787 * (options.cc) (General_options::finalize): Set icf_status_.
7788 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
7789 icf_test and icf_keep_unique_test to use the --icf enum flag.
7790 * testsuite/icf_safe_test.sh: New file.
7791 * testsuite/icf_safe_test.cc: New file.
7793 2009-10-12 Sriraman Tallam <tmsriram@google.com>
7795 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
7796 includes to gc.h and icf.h.
7797 * arm.cc: Include gc.h.
7798 * gold.cc: Likewise.
7799 * i386.cc: Likewise.
7800 * powerpc.cc: Likewise.
7801 * sparc.cc: Likewise.
7802 * x86_64.cc: Likewise.
7803 * gc.h: Include icf.h.
7805 2009-10-11 Ian Lance Taylor <iant@google.com>
7807 * plugin.cc: Include "gold.h" before other header files.
7809 2009-10-10 Chris Demetriou <cgd@google.com>
7811 * options.h (Input_file_argument::Input_file_type): New enum.
7812 (Input_file_argument::is_lib_): Replace with...
7813 (Input_file_argument::type_): New member.
7814 (Input_file_argument::Input_file_argument): Take Input_file_type
7815 'type' rather than boolean 'is_lib' as second argument.
7816 (Input_file_argument::is_lib): Use type_.
7817 (Input_file_argument::is_searched_file): New function.
7818 (Input_file_argument::may_need_search): Handle is_searched_file.
7819 * options.cc (General_options::parse_library): Support -l:filename.
7820 (General_options::parse_just_symbols): Update for Input_file_argument
7822 (Command_line::process): Likewise.
7823 * archive.cc (Archive::get_file_and_offset): Likewise.
7824 * plugin.cc (Plugin_manager::release_input_file): Likewise.
7825 * script.cc (read_script_file, script_add_file): Likewise.
7826 * fileread.cc (Input_file::Input_file): Likewise.
7827 (Input_file::will_search_for): Handle is_searched_file.
7828 (Input_file::open): Likewise.
7829 * readsyms.cc (Read_symbols::get_name): Likewise.
7830 * testsuite/Makefile.am (searched_file_test): New test.
7831 * testsuite/Makefile.in: Regenerate.
7832 * testsuite/searched_file_test.cc: New file.
7833 * testsuite/searched_file_test_lib.cc: New file.
7835 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7836 Ian Lance Taylor <iant@google.com>
7838 * descriptor.cc: Include <cstdio> and "binary-io.h".
7839 (Descriptors::open): Open the files in binary mode always.
7840 * script.cc (Lex::get_token): Treat \r as whitespace.
7842 2009-10-09 Ian Lance Taylor <iant@google.com>
7844 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
7846 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7847 Ian Lance Taylor <iant@google.com>
7849 * configure.ac: Check for readv function also.
7850 * fileread.cc (readv): Define if not HAVE_READV.
7851 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
7853 * config.in: Regenerate.
7854 * configure: Regenerate.
7856 2009-10-09 Doug Kwan <dougkwan@google.com>
7858 * layout.cc (Layout::make_output_section): Call target hook to make
7859 ordinary output section.
7860 (Layout::finalize): Adjust parameter list of call the
7861 Target::may_relax().
7862 * layout.h (class Layout::section_list): New method.
7863 * merge.h (Output_merge_base::entsize): Change visibility to public.
7864 (Output_merge_base::is_string, Output_merge_base::do_is_string):
7866 (Output_merge_string::do_is_string): New method.
7867 * object.cc (Sized_relobj::do_setup): renamed from
7868 Sized_relobj::set_up.
7869 * object.h (Sized_relobj::adjust_shndx,
7870 Sized_relobj::initializ_input_to_output_maps,
7871 Sized_relobj::free_input_to_output_maps): Change visibilities to
7873 (Sized_relobj::setup): Virtualize.
7874 (Sized_relobj::do_setup): New method declaration.
7875 (Sized_relobj::invalidate_section_offset,
7876 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
7877 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
7878 * options.cc (parse_int): New function.
7879 * options.h (parse_int): New declaration.
7880 (DEFINE_int): New macro.
7881 (stub_group_size): New option.
7882 * output.cc (Output_section::Output_section): Initialize memebers
7883 merge_section_map_, merge_section_by_properties_map_,
7884 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
7885 (Output_section::add_input_section): Handled deferred code-fill
7886 generation and remove an old comment.
7887 (Output_section::add_relaxed_input_section): New method definition.
7888 (Output_section::add_merge_input_section): Use merge section by
7889 properties map to speed to search. Update merge section maps
7891 (Output_section::build_relaxation_map): New method definition.
7892 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7894 (Output_section::relax_input_section): Renamed to
7895 Output_section::convert_input_sections_to_relaxed_sections and change
7896 interface to take a vector of pointers to relaxed sections.
7897 (Output_section::find_merge_section,
7898 Output_section::find_relaxed_input_section): New method definitions.
7899 (Output_section::is_input_address_mapped,
7900 Output_section::output_offset, Output_section::output_address):
7901 Use output section data maps to speed up searching.
7902 (Output_section::find_starting_output_address): Add comments.
7903 (Output_section::do_write,
7904 Output_section::write_to_postprocessing_buffer): Do code-fill
7905 generation as appropriate.
7906 (Output_section::get_input_sections): Invalidate relaxed input section
7908 (Output_section::restore_states): Adjust type of checkpoint .
7909 Invalidate relaxed input section map.
7910 * output.h (Output_merge_base): New class declaration.
7911 (Input_section_specifier): New class defintion.
7912 (class Output_relaxed_input_section) Change base class to
7913 Output_section_data_build.
7914 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
7915 base class initializer.
7916 (Output_section::add_relaxed_input_section): New method declaration.
7917 (Output_section::Input_section): Change visibility to protected.
7918 (Output_section::Input_section::relobj,
7919 Output_section::Input_section::shndx): Handle relaxed input sections.
7920 Output_section::input_sections) Change visibility to protected. Also
7921 define overload to return a non-const pointer.
7922 (Output_section::Merge_section_properties): New class defintion.
7923 (Output_section::Merge_section_by_properties_map,
7924 Output_section::Output_section_data_by_input_section_map,
7925 Output_section::Relaxation_map): New types.
7926 (Output_section::relax_input_section): Rename method to
7927 Output_section::convert_input_sections_to_relaxed_sections and change
7928 interface to take a vector of relaxed section pointers.
7929 (Output_section::find_merge_section,
7930 Output_section::find_relaxed_input_section,
7931 Output_section::build_relaxation_map,
7932 Output_section::convert_input_sections_in_list_to_relaxed_sections):
7933 New method declarations.
7934 (Output_section::merge_section_map_
7935 Output_section::merge_section_by_properties_map_,
7936 Output_section::relaxed_input_section_map_,
7937 Output_section::is_relaxed_input_section_map_valid_,
7938 Output_section::generate_code_fills_at_write_): New data members.
7939 * script-sections.cc
7940 (Output_section_element_input::set_section_addresses): Call
7941 current_data_size and addralign methods of relaxed input sections.
7942 (Orphan_output_section::set_section_addresses): Call current_data_size
7943 and addralign methods of relaxed input sections.
7944 * symtab.cc (Symbol_table::compute_final_value): Extract template
7945 from the body of Symbol_table::sized_finalize_symbol.
7946 (Symbol_table::sized_finalized_symbol): Call
7947 Symbol_table::compute_final_value.
7948 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
7949 (Symbol_table::compute_final_value): New templated method declaration.
7950 * target.cc (Target::do_make_output_section): New method defintion.
7951 * target.h (Target::make_output_section): New method declaration.
7952 (Target::relax): Add more parameters for input objects, symbol table
7953 and layout. Adjust call to do_relax.
7954 (Target::do_make_output_section): New method declaration.
7955 (Target::do_relax): Add parameters for input objects, symbol table
7958 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7960 * pread.c: Include stdio.h.
7962 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7964 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
7967 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7969 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7970 Change read_shndx type to unsigned int.
7971 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7973 (Sized_dwarf_line_info::read_line_mappings): Likewise.
7974 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
7975 Change read_shndx type to unsigned int.
7976 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7978 (Sized_dwarf_line_info::read_line_mappings): Likewise.
7979 * layout.cc (Layout::create_symtab_sections): Cast the result of
7980 local_symcount * symsize to off_t in the gold_assert.
7982 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7984 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
7985 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
7987 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
7988 (Arm_relocate_functions::thm_abs5): New function.
7989 (Arm_relocate_functions::abs12): New function.
7990 (Arm_relocate_functions::abs16): New function.
7991 (Arm_relocate_functions::base_abs): New function.
7992 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
7993 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
7994 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
7996 (Scan::global): Likewise.
7997 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
7998 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
7999 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
8000 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
8003 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8005 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
8006 (Arm_relocate_functions::movt_prel): New function.
8007 (Arm_relocate_functions::thm_movw_prel_nc): New function.
8008 (Arm_relocate_functions::thm_movt_prel): New function.
8009 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8010 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8011 (Scan::global, Relocate::relocate): Likewise.
8012 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8014 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8016 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8017 Incremental_checker.
8018 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8020 (class Incremental_inputs_header): New class.
8021 (Incremental_inputs_header_writer): Edit comment.
8022 (Incremental_inputs_entry): New class.
8023 (Incremental_inputs_entry_writer): Edit comment.
8024 (Sized_incremental_binary::do_find_incremental_inputs_section):
8025 Add *strtab_shndx parameter, fill it.
8026 (Sized_incremental_binary::do_check_inputs): New method.
8027 (Incremental_checker::can_incrementally_link_output_file): Use
8028 Sized_incremental_binary::check_inputs.
8029 (Incremental_inputs::report_command_line): Save command line in
8032 (Incremental_binary::find_incremental_inputs_section): New
8034 (Incremental_binary::do_find_incremental_inputs_section): Add
8035 strtab_shndx parameter.
8036 (Incremental_binary::do_check_inputs): New pure virtual method.
8037 (Sized_incremental_binary::do_check_inputs): Declare.
8038 (Incremental_checker::Incremental_checker): Add incremental_inputs
8039 parameter, use it to initialize incremental_inputs_.
8040 (Incremental_checker::incremental_inputs_): New field.
8041 (Incremental_checker::command_line): New method.
8042 (Incremental_checker::inputs): New method.
8043 (Incremental_checker::command_line_): New field.
8045 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8047 * incremental.cc: Include <cstdarg> and "target-select.h".
8048 (vexplain_no_incremental): New function.
8049 (explain_no_incremental): New function.
8050 (Incremental_binary::error): New method.
8051 (Sized_incremental_binary::do_find_incremental_inputs_section): New
8053 (make_sized_incremental_binary): New function.
8054 (open_incremental_binary): New function.
8055 (can_incrementally_link_file): Add checks if output is ELF and has
8057 * incremental.h: Include "elfcpp_file.h" and "output.h".
8058 (Incremental_binary): New class.
8059 (Sized_incremental_binary): New class.
8060 (open_incremental_binary): Declare.
8061 * object.cc (is_elf_object): Use
8062 elfcpp::Elf_recognizer::is_elf_file.
8063 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
8064 * output.h (Output_file::filesize): New method.
8066 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8068 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
8070 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
8071 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
8073 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
8075 (Arm_relocate_functions::movw_abs_nc): New function.
8076 (Arm_relocate_functions::movt_abs): New function.
8077 (Arm_relocate_functions::thm_movw_abs_nc): New function.
8078 (Arm_relocate_functions::thm_movt_abs): New function.
8079 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
8080 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
8081 (Scan::global): Likewise.
8082 (Relocate::relocate): Likewise.
8083 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8085 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8087 * arm.cc (Arm_relocate_functions::got_prel) New function.
8088 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
8089 (Relocate::relocate): Likewise.
8090 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8092 2009-10-06 Ian Lance Taylor <iant@google.com>
8094 * options.h (class General_options): Define
8095 split_stack_adjust_size parameter.
8096 * object.h (class Object): Add uses_split_stack_ and
8097 has_no_split_stack_ fields. Add uses_split_stack and
8098 has_no_split_stack accessor functions. Declare
8099 handle_split_stack_section.
8100 (class Reloc_symbol_changes): Define.
8101 (class Sized_relobj): Define Function_offsets. Declare
8102 split_stack_adjust, split_stack_adjust_reltype, and
8104 * object.cc (Object::handle_split_stack_section): New function.
8105 (Sized_relobj::do_layout): Call handle_split_stack_section.
8106 * dynobj.cc (Sized_dynobj::do_layout): Call
8107 handle_split_stack_section.
8108 * reloc.cc (Sized_relobj::relocate_sections): Call
8109 split_stack_adjust for executable sections in split_stack
8110 objects. Pass reloc_map to relocate_section.
8111 (Sized_relobj::split_stack_adjust): New function.
8112 (Sized_relobj::split_stack_adjust_reltype): New function.
8113 (Sized_relobj::find_functions): New function.
8114 * target-reloc.h: Include "object.h".
8115 (relocate_section): Add reloc_symbol_changes parameter. Change
8117 * target.h (class Target): Add calls_non_split method. Declare
8118 do_calls_non_split virtual method. Declare match_view and
8120 * target.cc: Include "elfcpp.h".
8121 (Target::do_calls_non_split): New function.
8122 (Target::match_view): New function.
8123 (Target::set_view_to_nop): New function.
8124 * gold.cc (queue_middle_tasks): Give an error if mixing
8125 split-stack and non-split-stack objects with -r.
8126 * i386.cc (Target_i386::relocate_section): Add
8127 reloc_symbol_changes parameter.
8128 (Target_i386::do_calls_non_split): New function.
8129 * x86_64.cc (Target_x86_64::relocate_section): Add
8130 reloc_symbol_changes parameter.
8131 (Target_x86_64::do_calls_non_split): New function.
8132 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
8134 * powerpc.cc (Target_powerpc::relocate_section): Add
8135 reloc_symbol_changes parameter.
8136 * sparc.cc (Target_sparc::relocate_section): Add
8137 reloc_symbol_changes parameter.
8138 * configure.ac: Call AM_CONDITIONAL for the default target.
8139 * configure: Rebuild.
8140 * testsuite/Makefile.am (TEST_AS): New variable.
8141 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
8142 (check_DATA): Add split_i386 and split_x86_64 files.
8143 (SPLIT_DEFSYMS): Define.
8144 (split_i386_[1234n].o): New targets.
8145 (split_i386_[124]): New targets.
8146 (split_i386_[1234r].stdout): New targets.
8147 (split_x86_64_[1234n].o): New targets.
8148 (split_x86_64_[124]): New targets.
8149 (split_x86_64_[1234r].stdout): New targets.
8150 (MOSTLYCLEANFILES): Add new executables.
8151 * testsuite/split_i386.sh: New file.
8152 * testsuite/split_x86_64.sh: New file.
8153 * testsuite/split_i386_1.s: New file.
8154 * testsuite/split_i386_2.s: New file.
8155 * testsuite/split_i386_3.s: New file.
8156 * testsuite/split_i386_4.s: New file.
8157 * testsuite/split_i386_n.s: New file.
8158 * testsuite/split_x86_64_1.s: New file.
8159 * testsuite/split_x86_64_2.s: New file.
8160 * testsuite/split_x86_64_3.s: New file.
8161 * testsuite/split_x86_64_4.s: New file.
8162 * testsuite/split_x86_64_n.s: New file.
8163 * testsuite/testfile.cc (Target_test): Update relocation_section
8165 * testsuite/Makefile.in: Rebuild.
8167 2009-10-06 Ian Lance Taylor <iant@google.com>
8169 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
8170 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
8171 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
8172 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
8173 the address on ldo_addrs_.
8174 (Target_i386::Relocate::fix_up_ldo): New function.
8176 2009-10-06 Rafael Espindola <espindola@google.com>
8178 * plugin.cc (add_input_library): New.
8179 (Plugin::load): Add add_input_library to tv.
8180 (Plugin_manager::add_input_file): Add the is_lib argument.
8181 (add_input_file): Update call to Plugin_manager::add_input_file.
8182 (add_input_library): New.
8183 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
8185 2009-09-30 Doug Kwan <dougkwan@google.com>
8187 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
8188 symbol and call Symbol::may_need_copy_reloc to determine if
8189 a copy reloc is needed.
8190 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
8191 nocopyreloc is given in command line.
8192 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
8193 given in command line.
8194 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
8195 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
8196 of the removed Target_i386::may_need_copy_reloc.
8197 * options.h (copyreloc): New option with default value false.
8198 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8199 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
8200 instead of the removed Target_powerpc::may_need_copy_reloc.
8201 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8202 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
8203 instead of the removed Target_sparc::may_need_copy_reloc.
8204 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
8205 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
8206 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
8207 instead of the removed Target_x86_64::may_need_copy_reloc.
8209 2009-09-30 Ian Lance Taylor <iant@google.com>
8211 * object.h (class Object): Remove target_ field, and target,
8212 sized_target, and set_target methods.
8213 (Object::sized_target): Remove.
8214 (class Sized_relobj): Update declarations. Remove sized_target.
8215 * object.cc (Sized_relobj::setup): Remove target parameter.
8217 (Input_objects::add_object): Don't do anything with the target.
8218 (make_elf_sized_object): Add punconfigured parameter. Change all
8219 callers. Set or test parameter target.
8220 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
8222 * parameters.cc (Parameters::set_target): Change parameter type to
8224 (Parameters::default_target): Remove.
8225 (set_parameters_target): Change parameter type to be non-const.
8226 (parameters_force_valid_target): New function.
8227 (parameters_clear_target): New function.
8228 * parameters.h (class Parameters): Update declarations. Remove
8229 default_target method. Add sized_target and clear_target
8230 methods. Change target_ to be non-const.
8231 (set_parameters_target): Update declaration.
8232 (parameters_force_valid_target): Declare.
8233 (parameters_clear_target): Declare.
8234 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
8235 as NULL if we aren't searching.
8236 (Add_symbols::run): Don't check for compatible target.
8237 * fileread.cc (Input_file::open_binary): Call
8238 parameters_force_valid_target.
8239 * gold.cc (queue_middle_tasks): Likewise.
8240 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
8241 set_target on object.
8242 * dynobj.h (class Sized_dynobj): Update declarations.
8243 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
8244 make_elf_object returns NULL.
8245 (Archive::include_member): Don't check whether object target is
8247 * output.cc (Output_section::add_input_section): Get target from
8249 (Output_section::relax_input_section): Likewise.
8250 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
8252 (Sized_relobj::do_scan_relocs): Likewise.
8253 (Sized_relobj::relocate_sections): Likewise.
8254 * resolve.cc (Symbol_table::resolve): Likewise.
8255 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
8256 parameter. Change all callers.
8257 (Symbol_table::add_from_object): Get target from parameters.
8258 (Symbol_table::add_from_relobj): Don't check object target.
8259 (Symbol_table::add_from_dynobj): Likewise.
8260 (Symbol_table::define_special_symbol): Get target from
8262 * symtab.h (class Symbol_table): Update declaration.
8263 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
8264 parameter. Change all callers. Clear parameter target.
8265 (Binary_test): Test target here.
8266 * testsuite/object_unittest.cc (gold_testsuite): Remove
8267 target_test_pointer parameter. Change all callers.
8268 (Object_test): Test target here.
8270 2009-09-26 Ian Lance Taylor <iant@google.com>
8272 * testsuite/initpri1.c: Don't try to use constructor priorities if
8273 compiling with gcc before 4.3.
8275 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
8277 * testsuite/retain_symbols_file_test.sh (check_present): Change
8278 output file name to retain_symbols_file_test.stdout.
8279 (check_absent): Likewise.
8281 2009-09-18 Craig Silverstein <csilvers@google.com>
8283 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
8284 * options.cc: Include <cerrno> and <fstream>.
8285 (General_options::finalize): Parse -retain-symbols-file tag.
8286 * options.h: New flag.
8287 (General_options): New method should_retain_symbol, new
8288 variable symbols_to_retain.
8289 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
8290 should_retain_symbol map.
8291 * testsuite/Makefile.am (retain_symbols_file_test): New test.
8292 * testsuite/Makefile.in: Regenerate.
8293 * testsuite/retain_symbols_file_test.sh: New file.
8295 2009-09-18 Nick Clifton <nickc@redhat.com>
8297 * po/es.po: Updated Spanish translation.
8299 2009-09-17 Doug Kwan <dougkwan@google.com>
8301 * debug.h (DEBUG_RELAXATION): New constant.
8302 (DEBUG_ALL): Add DEBUG_RELAXATION.
8303 (debug_string_to_enum): Add relaxation debug option.
8305 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
8306 Layout::Relaxation_debug_check::read_sections,
8307 Layout::Relaxation_debug_check::read_sections): New method definitions.
8308 (Layout::Layout): Initialize data members
8309 record_output_section_data_from_scrips_,
8310 script_output_section_data_list_ and relaxation_debug_check_.
8311 (Layout::save_segments, Layout::restore_segments,
8312 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8313 Layout::relaxation_loop_body): New method definitions.
8314 (Layout::finalize): Support relaxation. Move section layout code to
8315 Layout::relaxation_loop_body.
8316 (Layout::set_asection_address_from_script): Move code for orphan
8317 section placement out.
8318 (Layout::place_orphan_sections_in_script): New method definition.
8319 * layout.h (Output_segment_headers, Output_file_header):
8320 New forward class declarations.
8321 (Layout::~Layout): Define.
8322 (Layout::new_output_section_data_from_script): New method definition.
8323 (Layout::place_orphan_sections_in_script): New method declaration.
8324 (Layout::Segment_states): New type declaration.
8325 (Layout::save_segments, Layout::restore_segments,
8326 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8327 Layout::relaxation_loop_body): New method declarations.
8328 (Layout::Output_section_data_list): New type declaration.
8329 (Layout::Relaxation_debug_check): New class definition.
8330 (Layout::record_output_section_data_from_script_,
8331 Layout::script_output_section_data_list_, Layout::segment_states_,
8332 Layout::relaxation_debug_check_): New data members.
8333 * output.cc: (Output_section_headers::do_size): New method definition.
8334 (Output_section_headers::Output_section_headers): Move size
8335 computation to Output_section_headers::do_size.
8336 (Output_segment_headers::do_size): New method definition.
8337 (Output_file_header::Output_file_header): Move size computation to
8338 Output_file_header::do_size and call it.
8339 (Output_file_header::do_size): New method definition.
8340 (Output_data_group::Output_data_group): Adjust call to
8341 Output_section_data.
8342 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
8343 (Output_symtab_xindex::do_write): Add array bound check.
8344 (Output_section::Input_section::print_to_mapfile): Handle
8345 RELAXED_INPUT_SECTION_CODE.
8346 (Output_section::Output_section): Initialize data member checkpoint_.
8347 (Output_section::~Output_section): Delete checkpoint object pointed
8349 (Output_section::add_input_section): Always add an Input_section if
8351 (Output_section::add_merge_input_section): Add assert.
8352 (Output_section::relax_input_section): New method definition.
8353 (Output_section::set_final_data_size): Set load address to zero for
8354 an unallocated section.
8355 (Output_section::do_address_and_file_offset_have_reset_values):
8356 New method definition.
8357 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
8358 Handle relaxed input section.
8359 (Output_section::sort_attached_input_sections): Checkpoint input
8360 section list lazily.
8361 (Output_section::get_input_sections): Change type of input_sections to
8362 list of Simple_input_section pointers. Checkpoint input section list
8363 lazily. Also handle relaxed input sections.
8364 (Output_section::add_input_section_for_script): Take a reference to
8365 a Simple_input_section object instead of Relobj pointer and section
8366 index as parameter. Handle relaxed input sections.
8367 (Output_section::save_states, Output_section::restore_states): New
8369 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
8370 (Output_data::is_data_size_fixed): New method definition.
8371 (Output_data::reset_addresss_and_file_offset): Do not reset data size
8373 (Output_data::address_and_file_offset_have_reset_values): New method
8375 (Output_data::do_address_and_file_offset_have_reset_values): New method
8377 (Output_data::set_data_size): Check that data size is not fixed.
8378 (Output_data::fix_data_size): New method definition.
8379 (Output_data::is_data_size_fixed_): New data member.
8380 (Output_section_headers::set_final_data_size): New method definition.
8381 (Output_section_headers::do_size): New method declaration.
8382 (Output_segment_headers::set_final_data_size): New method definition.
8383 (Output_segment_headers::do_size): New method declaration.
8384 (Output_file_header::set_final_data_size)::New method definition.
8385 (Output_file_header::do_size)::New method declaration.
8386 (Output_section_data::Output_section_data): Add new parameter
8387 is_data_size_fixed and use it to fix data size.
8388 (Output_data_const::Output_data_const): Adjust call to base class
8389 constructor and fix data size.
8390 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
8391 base class constructor and fix data size.
8392 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
8393 base class constructor and fix data size.
8394 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
8395 class constructor and fix data size.
8396 (Output_data_group::set_final_data_size): New method definition.
8397 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
8398 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
8399 class constructor and fix data size.
8400 (Output_relaxed_input_section): New class definition.
8401 (Output_section::Simple_input_section): New class definition.
8402 (Output_section::get_input_sections): Adjust parameter list.
8403 (Output_section::add_input_section_for_script): Same.
8404 (Output_section::save_states, Output_section::restore_states,
8405 Output_section::do_address_and_file_offset_have_reset_values,
8406 (Output_section::Input_section::Input_section): Handle
8407 RELAXED_INPUT_SECTION_CODE. Add new overload for
8408 Output_relaxed_input_section.
8409 (Output_section::Input_section::is_input_section,
8410 Output_section::Input_section::set_output_section): Handle relaxed
8412 (Output_section::Input_section::is_relaxed_input_section,
8413 Output_section::Input_section::output_section_data,
8414 Output_section::Input_section::relaxed_input_section): New method
8416 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
8418 (Output_section::Input_section::u1_): Update comments.
8419 (Output_section::Input_section::u2_): Add new union member poris.
8420 (Output_section::Checkpoint_output_section): New classs definition.
8421 (Output_section::relax_input_section): New method declaration.
8422 (Output_section::checkpoint_): New data member.
8423 (Output_segment): Update comments.
8424 (Output_segment::Output_segment): Un-privatize copy constructor.
8425 (Output_segment::operator=): Un-privatize.
8426 * script-sections.cc (Output_section_element::Input_section_list):
8427 Change element type to Output_section::Simple_input_section.
8428 (Output_section_element_dot_assignment::set_section_addresses):
8429 Register output section data for relaxation clean up.
8430 (Output_data_exression::Output_data_expression): Adjust call to base
8431 constructor to fix data size.
8432 (Output_section_element_data::set_section_addresses): Register
8433 Output_data_expression object for relaxation clean up.
8434 (struct Input_section_info): Replace Relobj pointer and section index
8435 pair with Output_section::Simple_input_section and Convert struct to a
8437 (Input_section_sorter::operator()): Adjust access to
8438 Input_section_info data member to use accessors.
8439 (Output_section_element_input::set_section_addresses): Use layout
8440 parameter. Adjust code to use Output_section::Simple_input_section
8441 and Input_secction_info classes. Register filler for relaxation
8443 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
8444 and section index pair with Output_section::Simple_input_section
8445 class. Adjust code accordingly.
8446 (Phdrs_element::release_segment): New method definition.
8447 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
8449 (Script_sections::release_segments): New method definition.
8450 * gold/script-sections.h (Script_sections::release_segments): New
8452 * gold/target.h (Target::may_relax, Target::relax,
8453 Target::do_may_relax, Target::do_relax): New method definitions.
8455 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8457 * arm.cc (has_signed_unsigned_overflow): New function.
8458 (Arm_relocate_functions::abs8): New function.
8459 (Target_arm::Scan::local): Handle R_ARM_ABS8.
8460 (Target_arm::Scan::global): Likewise.
8461 (Target_arm::relocate::relocate): Likewise.
8462 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8465 2009-09-16 Cary Coutant <ccoutant@google.com>
8467 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
8468 * testsuite/Makefile.in: Regenerate.
8470 2009-09-11 Nick Clifton <nickc@redhat.com>
8472 * po/gold.pot: Updated by the Translation project.
8474 2009-09-08 Cary Coutant <ccoutant@google.com>
8476 * output.cc (Output_file::open): Add execute permission to empty file.
8477 * testsuite/Makefile.am (permission_test): New test.
8478 * testsuite/Makefile.in: Regenerate.
8480 2009-09-02 Ian Lance Taylor <iant@google.com>
8482 * output.cc (Output_file::resize): Call map_no_anonymous rather
8485 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
8487 * gold.cc: Include "incremental.h".
8488 (queue_initial_tasks): Call Incremental_checker methods.
8489 * incremental.cc: Include "output.h".
8490 (Incremental_checker::can_incrementally_link_output_file): New
8492 * incremental.h (Incremental_checker): New class.
8494 * output.cc (Output_file::open_for_modification): New method.
8495 (Output_file::map_anonymous): Changed return type to bool. Record
8497 (Output_file::map_no_anonymous): New method, broken out of map.
8498 (Output_file::map): Use map_no_anonymous and map_anonymous.
8499 * output.h (class Output_file): Update declarations.
8501 2009-08-24 Cary Coutant <ccoutant@google.com>
8503 * options.h (Command_line::Pre_options): New class.
8504 (Command_line::pre_options): New member.
8505 * options.cc (gold::options::ready_to_register): New variable.
8506 (One_option::register_option): Do nothing if not registering options.
8507 Assert if same short option registered twice.
8508 (General_options::General_options): Turn off option registration when
8510 (Command_line::Pre_options::Pre_options): New constructor.
8512 2009-08-24 Cary Coutant <ccoutant@google.com>
8514 * options.h (General_options::no_keep_memory): Remove incorrect
8517 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8519 * Makefile.am (am__skiplex, am__skipyacc): New.
8520 * Makefile.in: Regenerate.
8522 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8524 * Makefile.am (AM_CPPFLAGS): Renamed from ...
8525 (INCLUDES): ... this.
8526 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
8527 (AM_CPPFLAGS): Renamed from ...
8528 (INCLUDE): ... this.
8529 * Makefile.in, testsuite/Makefile.in: Regenerate.
8531 * Makefile.in: Regenerate.
8532 * aclocal.m4: Likewise.
8533 * config.in: Likewise.
8534 * configure: Likewise.
8535 * testsuite/Makefile.in: Likewise.
8537 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8538 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8539 * Makefile.in: Regenerate.
8540 * testsuite/Makefile.in: Regenerate.
8542 2009-08-19 Cary Coutant <ccoutant@google.com>
8544 * resolve.cc (Symbol_table::resolve): Don't complain about defined
8545 symbols in shared libraries overridden by hidden or internal symbols
8546 in the main program.
8548 2009-08-19 Chris Demetriou <cgd@google.com>
8550 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
8551 checking source file names in error messages.
8553 2009-08-18 Doug Kwan <dougkwan@google.com>
8555 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
8556 an elcpp::Ehdr as parameter. Adjust call to set_target.
8557 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
8558 an elfcpp::Ehdr as parameter.
8559 * object.cc (Object::set_target): Remove the version that looks up
8560 a target and sets it.
8561 (Sized_relobj::setup): Take a Target object instead of
8562 an elfcpp::Ehdr as parameter. Adjust call to set_target.
8563 (make_elf_sized_object): Find target and ask target to
8565 * object.h: (Object::set_target): Remove the version that looks up
8566 a target and sets it.
8567 (Sized_relobj::setup): Take a Target object instead of
8568 an elfcpp:Ehdr as parameter.
8569 * target.cc: Include dynobj.h.
8570 (Target::do_make_elf_object_implementation): New.
8571 (Target::do_make_elf_object): New.
8572 * target.h (Target::make_elf_object): New template declaration.
8573 (Target::do_make_elf_object): New method declarations.
8574 (Target::do_make_elf_object_implementation): New template declaration.
8576 2009-08-14 Ian Lance Taylor <iant@google.com>
8578 * gold.h (FUNCTION_NAME): Define.
8579 (gold_unreachable): Use FUNCTION_NAME.
8581 2009-08-12 Sriraman Tallam <tmsriram@google.com>
8583 * icf.cc (Icf::find_identical_sections): Issue a warning when a
8584 symbol in the --keep-unique list is not found.
8586 2009-08-12 Sriraman Tallam <tmsriram@google.com>
8588 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
8589 been maked as --keep-unique.
8590 (Icf::unfold_section): New function.
8591 * icf.h (Icf::unfold_section): New function.
8592 * options.h (General_options::keep_unique): New option.
8593 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
8594 * testsuite/Makefile.in: Regenerate.
8595 * testsuite/icf_keep_unique_test.sh: New file.
8596 * testsuite/icf_keep_unique_test.cc: New file.
8598 2009-08-12 Cary Coutant <ccoutant@google.com>
8601 * resolve.cc (Symbol_table::resolve): Check for references from
8602 dynamic objects to hidden and internal symbols.
8603 * testsuite/Makefile.am (hidden_test.sh): New test.
8604 * testsuite/Makefile.in: Regenerate.
8605 * testsuite/hidden_test.sh: New script.
8606 * testsuite/hidden_test_1.c: New test source.
8607 * testsuite/hidden_test_main.c: New test source.
8609 2009-08-11 Doug Kwan <dougkwan@google.com>
8611 * arm.cc: Update comments.
8612 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
8613 segment to locate the .ARM.exidx section if present.
8615 2009-08-09 Doug Kwan <dougkwan@google.com>
8617 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
8620 2009-08-07 Sriraman Tallam <tmsriram@google.com>
8621 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
8624 2009-08-06 Sriraman Tallam <tmsriram@google.com>
8626 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
8627 valid tls_segment only for non-debug-section relocations.
8628 * testsuite/Makefile.am: Add gc_tls_test.
8629 * testsuite/Makefile.in: Regenerate.
8630 * testsuite/gc_tls_test.cc: New file.
8631 * testsuite/gc_tls_test.sh: New file.
8633 2009-08-05 Sriraman Tallam <tmsriram@google.com>
8637 * Makefile.am (CCFILES): Add icf.cc.
8639 * Makefile.in: Regenerate.
8640 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
8641 * gc.h (gc_process_relocs): Populate lists used by icf to contain
8642 section, symbol and addend information for the relocs.
8643 * gold.cc (queue_middle_tasks): Call identical code folding.
8644 * gold.h: Add defines for multimap.
8645 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
8646 to the call of finalize_local_symbols.
8647 * main.cc (main): Create object of class Icf.
8648 * object.cc (Sized_relobj::do_layout): Allow this function to be
8649 called twice during icf.
8650 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
8651 to sections marked as identical by icf.
8652 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
8654 (Sized_relobj::do_section_entsize): New function.
8655 * object.h (Object::section_entsize): New function.
8656 (Object::do_section_entsize): New pure virtual function.
8657 (Relobj::finalize_local_symbols): Add new parameter.
8658 (Relobj::do_section_entsize): New function.
8659 * options.h (General_options::icf): New option.
8660 (General_options::icf_iterations): New option.
8661 (General_options::print_icf_sections): New option.
8662 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
8663 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
8664 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
8666 * symtab.cc (Symbol_table::is_section_folded): New function.
8667 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
8668 to sections marked as identical by icf.
8669 * symtab.h (Symbol_table::set_icf): New function.
8670 (Symbol_table::icf): New function.
8671 (Symbol_table::is_section_folded): New function.
8672 (Symbol_table::icf_): New data member.
8673 * target-reloc.h (relocate_section): Ignore sections folded by icf.
8674 * testsuite/Makefile.am: Add commands to build icf_test.
8675 * testsuite/Makefile.in: Regenerate.
8676 * testsuite/icf_test.sh: New file.
8677 * testsuite/icf_test.cc: New file.
8679 2009-07-24 Chris Demetriou <cgd@google.com>
8681 * layout.cc (is_compressible_debug_section): Fix incorrect
8682 comment about compressed section names.
8684 2009-07-20 Ian Lance Taylor <ian@airs.com>
8687 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
8689 2009-07-16 Ian Lance Taylor <iant@google.com>
8692 * layout.h: #include <map>.
8693 (class Kept_section): Change from struct to class. Add accessors
8694 and setters. Add section size to Comdat_group mapping. Change
8695 Comdat_group to std::map. Add is_comdat_ field. Add
8696 linkonce_size field in union.
8697 (class Layout): Update declaration of find_or_add_kept_section.
8698 Don't declare find_kept_object.
8699 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
8700 parameter. Add object, shndx, is_comdat, and is_group_name
8701 parameters. Change all callers. Adjust for new Kept_section.
8702 (Layout::find_kept_object): Remove.
8703 * object.cc (Sized_relobj::include_section_group): Update use of
8704 Kept_section. Rename secnum to shndx. Only record
8705 Kept_comdat_section if sections are the same size.
8706 (Sized_relobj::include_linkonce_section): Update use of
8707 Kept_section. Only record Kept_comdat_section if sections are the
8708 same size. Set size of linkonce section.
8709 (Sized_relobj::map_to_kept_section): Update call to
8710 get_kept_comdat_section.
8711 * object.h (class Sized_relobj): Rename fields in
8712 Kept_comdat_section to drop trailing underscores; change object
8713 field to Relobj*. Change Kept_comdat_section_table to store
8714 struct rather than pointer.
8715 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
8716 Add kept_object and kept_shndx parameters. Change all callers.
8717 (Sized_relobj::get_kept_comdat_section): Change return type to
8718 bool. Add kept_object and kept_shndx parameters. Change all
8720 * plugin.cc (Pluginobj::include_comdat_group): Update call to
8721 Layout::find_or_add_kept_section.
8723 2009-07-09 Ian Lance Taylor <iant@google.com>
8725 * merge.cc (Object_merge_map::initialize_input_to_output_map):
8726 Reserve space in the hash table.
8728 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
8730 * fileread.cc (File_read::get_mtime): New method.
8731 * fileread.h (Timespec): New structure.
8732 (File_read::get_mtime): New method.
8733 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
8734 Renamed from timestamp_nsec.
8735 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
8737 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
8739 (Incremental_inputs::report_archive): Save mtime; style fix.
8740 (Incremental_inputs::report_obejct): Save mtime; style fix.
8741 (Incremental_inputs::report_script): Save mtime; style fix.
8742 (Incremental_inputs::finalize_inputs): Style fix.
8743 (Incremental_inputs::finalize): Style fix.
8744 (Incremental_inputs::create_input_section_data): Store inputs
8746 * incremental.h (Incremental_inputs::report_script): Add mtime
8748 (Incremental_inputs::Input_info::Input_info): Intialize only one
8750 (Incremental_inputs::Input_info::archive): Move to nameless
8752 (Incremental_inputs::Input_info::obejct): Move to nameless union.
8753 (Incremental_inputs::Input_info::script): Move to nameless union.
8754 (Incremental_inputs::mtime): New field.
8755 * script.cc (read_input_script): Pass file mtime to
8757 * script.h (Script_info::inputs): Style fix.
8759 2009-07-01 Ian Lance Taylor <ian@airs.com>
8761 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
8764 2009-06-24 Ian Lance Taylor <iant@google.com>
8767 * layout.cc (Layout::choose_output_section): If we find an
8768 existing section, update the flags.
8769 (Layout::create_notes): New function, broken out of
8771 (Layout::finalize): Don't create note sections.
8772 (Layout::create_note): Don't crash if linker script discards
8774 (Layout::create_gold_note): Likewise.
8775 (Layout::create_build_id): Likewise. Don't set
8776 after_input_sections on the section.
8777 (Layout::create_executable_stack_info): Remove target parameter.
8779 * layout.h (class Layout): Declare create_notes. Update
8780 declaration of create_executable_stack_info.
8781 * gold.cc (queue_middle_tasks): Call create_notes.
8782 * output.cc (Output_section::update_flags_for_input_section): Move
8783 here from output.h. If SHF_ALLOC flag is newly set, mark address
8785 * output.h (Output_data::mark_address_invalid): New function.
8786 (class Output_section): Only declare, not define,
8787 update_flags_for_input_section. Remove set_flags.
8789 2009-06-24 Ian Lance Taylor <iant@google.com>
8791 * script-sections.cc (Output_section_definition::
8792 set_section_addresses): Rename shadowing local load_address to
8795 2009-06-24 Ian Lance Taylor <iant@google.com>
8798 * reloc.cc (relocate_sections): Skip empty relocation sections.
8800 2009-06-23 Ian Lance Taylor <iant@google.com>
8803 * layout.cc (Layout::create_note): Use choose_output_section
8804 rather than make_output_section.
8806 2009-06-23 Ian Lance Taylor <iant@google.com>
8809 * options.cc (General_options::parse_V): Set printed_version_.
8810 (General_options::General_options): Initialize printed_version_.
8811 * options.h (class General_options): Add printed_version_ field.
8812 * gold.cc (queue_initial_tasks): If there are no input files,
8813 don't give a fatal error if we printed the version information.
8814 (queue_middle_tasks): If using -r with a shared object, give a
8815 fatal error rather than an ordinary error.
8817 2009-06-23 Ian Lance Taylor <iant@google.com>
8820 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
8821 (Layout::make_output_section): Set have_stabstr_section_ if we see
8822 a .stab*str section.
8823 (Layout::finalize): Call link_stabs_sections.
8824 (Layout::link_stabs_sections): New file.
8825 * layout.h (class Layout): Add have_stabstr_section_ field.
8826 Declare link_stabs_sections.
8828 2009-06-23 Doug Kwan <dougkwan@google.com>
8830 * Makefile.am (libgold_a_LIBADD): New.
8831 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
8832 * Makefile.in: Regenerate.
8833 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
8834 * configure: Regenerate.
8835 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
8836 * fileread.cc: Include sys/state.h
8837 * gold.h: Declare memmem and strndup if found missing.
8838 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
8840 2009-06-23 Ian Lance Taylor <iant@google.com>
8842 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
8843 * configure: Rebuild.
8845 2009-06-23 Ian Lance Taylor <iant@google.com>
8848 * object.cc (Object::section_contents): Don't try to get a view if
8849 the section has length zero.
8850 (Object::handle_gnu_warning_section): If the section is empty, use
8851 the name of the section as the warning.
8853 2009-06-23 Ian Lance Taylor <iant@google.com>
8856 * stringpool.h (class Stringpool_template): Add optimize_ field.
8857 (Stringpool_template::set_optimize): New function.
8858 * stringpool.cc (Stringpool_template::Stringpool_template):
8859 Initialize optimize_ field.
8860 (Stringpool_template::set_string_offsets): Test local optimize
8861 fild rather than parameter.
8862 * layout.cc (Layout::Layout): Call set_optimize on the section
8865 2009-06-22 Ian Lance Taylor <iant@google.com>
8868 * yyscript.y: Parse TARGET.
8869 * script.cc (script_set_target): New function.
8870 * script-c.h (script_set_target): Declare.
8871 * options.cc (General_options::string_to_object_format): Rename
8872 from string_to_object_format in anonymous namespace. Change
8874 * options.h (class General_options): Declare
8875 string_to_object_format.
8877 2009-06-22 Ian Lance Taylor <iant@google.com>
8879 * script-sections.cc (Script_sections::create_segments): Don't put
8880 program headers in a PT_LOAD segment if -n or -N.
8882 2009-06-22 Ian Lance Taylor <iant@google.com>
8885 * options.h (class General_options): Add -z lazy and -z now. Sort
8886 -z options into alphabetical order.
8887 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
8889 2009-06-21 Ian Lance Taylor <iant@google.com>
8891 * layout.cc (Layout::make_output_section): Call
8892 Target::new_output_section.
8893 (Layout::attach_allocated_section_to_segment): Put large section
8894 sections in a separate load segment with the large segment flag
8896 (Layout::segment_precedes): Sort large data segments after other
8898 (align_file_offset): New static function.
8899 (Layout::set_segment_offsets): Use align_file_offset.
8900 * output.h (class Output_section): Add is_small_section_ and
8901 is_large_section_ fields.
8902 (Output_section::is_small_section): New function.
8903 (Output_section::set_is_small_section): New function.
8904 (Output_section::is_large_section): New function.
8905 (Output_section::set_is_large_section): New function.
8906 (Output_section::is_large_data_section): New function.
8907 (class Output_segment): Add is_large_data_segment_ field.
8908 (Output_segment::is_large_data_segment): New function.
8909 (Output_segment::set_is_large_data_segment): New function.
8910 * output.cc (Output_section::Output_section): Initialize new
8912 (Output_segment::Output_segment): Likewise.
8913 (Output_segment::add_output_section): Add assertion that large
8914 data sections always go in large data segments. Force small data
8915 sections to the end of the list of data sections. Force small BSS
8916 sections to the start of the list of BSS sections. For large BSS
8917 sections to the end of the list of BSS sections.
8918 * symtab.h (class Symbol): Declare is_common_shndx.
8919 (Symbol::is_defined): Check Symbol::is_common_shndx.
8920 (Symbol::is_common): Likewise.
8921 (class Symbol_table): Define enum Commons_section_type. Update
8922 declarations. Add small_commons_ and large_commons_ fields.
8923 * symtab.cc (Symbol::is_common_shndx): New function.
8924 (Symbol_table::Symbol_table): Initialize new fields.
8925 (Symbol_table::add_from_object): Put small and large common
8926 symbols in the right list.
8927 (Symbol_table::sized_finalized_symbol): Check
8928 Symbol::is_common_shndx.
8929 (Symbol_table::sized_write_globals): Likewise.
8930 * common.cc (Symbol_table::do_allocate_commons): Allocate new
8931 common symbol lists. Don't call do_allocate_commons_list if the
8933 (Symbol_table::do_allocate_commons_list): Remove is_tls
8934 parameter. Add comons_section_type parameter. Change all
8935 callers. Handle small and large common symbols.
8936 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
8937 Symbol::is_common_shndx.
8938 * resolve.cc (symbol_to_bits): Likewise.
8939 * target.h (Target::small_common_shndx): New function.
8940 (Target::small_common_section_flags): New function.
8941 (Target::large_common_shndx): New function.
8942 (Target::large_common_section_flags): New function.
8943 (Target::new_output_section): New function.
8944 (Target::Target_info): Add small_common_shndx, large_common_shndx,
8945 small_common_section_flags, and large_common_section_flags
8947 (Target::do_new_output_section): New virtual function.
8948 * arm.cc (Target_arm::arm_info): Initialize new fields.
8949 * i386.cc (Target_i386::i386_info): Likewise.
8950 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
8952 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
8953 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
8954 (Target_x86_64::do_new_output_section): New function.
8955 * configure.ac: Define conditional MCMODEL_MEDIUM.
8956 * testsuite/Makefile.am (check_PROGRAMS): Add large.
8957 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
8958 (large_LDFLAGS): Define.
8959 * testsuite/large.c: New file.
8960 * testsuite/testfile.cc (Target_test::test_target_info):
8961 Initialize new fields.
8962 * configure, testsuite/Makefile.in: Rebuild.
8964 2009-06-05 Doug Kwan <dougkwan@google.com>
8966 * Makefile.am (CCFILES): Add target.cc.
8967 * Makefile.in: Regenerate.
8968 * i386.cc (class Target_i386): Define new virtual method to
8969 override do_is_local_label_name in parent.
8970 * object.cc (Sized_relobj::do_count_local_symbols): Discard
8971 local symbols if --discard-locals or -X is given.
8972 * options.h (class General_options): Declare new options
8973 '--discard-locals' and '-X' for discarding locals.
8974 * target.h (class Target): Define new methods is_local_label_name.
8975 Declare new virtual method do_is_local_label_name.
8976 * target.cc: New file.
8977 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
8978 (check_SCRIPTS): Add discard_locals_test.sh.
8979 (check_DATA): Add discard_local_tests.syms.
8980 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
8981 (discard_local_tests.syms, discard_locals_test.o): New make rules.
8982 * testsuite/Makefile.in: Regenerate.
8983 * testsuite/discard_locals_test.c: New file.
8984 * testsuite/discard_locals_test.sh: Same.
8986 2009-06-05 Doug Kwan <dougkwan@google.com>
8988 * object.cc (Sized_relobj::Sized_relobj): Initialize
8989 discarded_eh_frame_shndx_ to -1U.
8990 (Sized_relobj::do_layout): Record index of a discard .eh_frame
8992 (Sized_relobj::do_count_local_symbols): Skip local symbols in
8993 a discarded .eh_frame section.
8994 (Sized_relobj::do_finalize_local_symbols): Ditto.
8995 * object.h (class Sized_relobj): Declare new member
8996 discarded_eh_frame_shndx_.
8997 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
8998 (local_labels_test.o, local_labels_test): New rules.
8999 * testsuite/Makefile.in: Regenerate.
9001 2009-06-04 Doug Kwan <dougkwan@google.com>
9003 * layout.cc (Layout::section_name_mapping): Add mapping for
9004 special ARM sections.
9006 2009-06-03 Doug Kwan <dougkwan@google.com>
9008 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
9009 (utils::has_overflow): Same.
9011 2009-06-03 Ian Lance Taylor <iant@google.com>
9013 * layout.cc (Layout::section_name_mapping): New array, replacing
9014 Layout::linkonce_mapping.
9015 (Layout::section_name_mapping_count): New variable, replacing
9016 Layout::linkonce_mapping_count.
9017 (Layout::linkonce_output_name): Remove.
9018 (Layout::output_section_name): Rewrite.
9019 * layout.h (class Layout): Rename Linkonce_mapping to
9020 Section_name_mapping, linkonce_mapping to section_name_mapping,
9021 linkonce_mapping_count to section_name_mapping_count. Don't
9022 declare linkonce_output_name.
9024 2009-06-03 Doug Kwan <dougkwan@google.com>
9026 * gold/arm.cc (namespace utils): New.
9027 (Target_arm::reloc_is_non_pic): Define new method.
9028 (class Arm_relocate_functions): New.
9029 (Target_arm::Relocate::relocate): Handle relocation types used by
9032 2009-06-03 Ian Lance Taylor <iant@google.com>
9034 * arm.cc (Target_arm::scan::global): Use || instead of |.
9036 2009-06-02 Doug Kwan <dougkwan@google.com>
9038 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
9039 issued_non_pic_error_.
9040 (class Target_arm::Scan): Declare new method check_non_pic.
9041 Define new method symbol_needs_plt_entry.
9042 Declare new data member issued_non_pic_error_.
9043 (class Target_arm::Relocate): Declare new method
9044 should_apply_static_reloc.
9045 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9046 (Target_arm::Scan::check_non_pic): Define new method.
9047 (Target_arm::Scan::local): Handle a small subset of reloc types used
9049 (Target_arm::Scan::local): Same.
9050 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9052 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
9054 * incremental.cc (Incremental_inputs::report_command_line): Filter
9055 out --incremental-* options.
9057 2009-05-29 Doug Kwan <dougkwan@google.com>
9059 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9061 (class Target_arm): Update comment.
9062 (Target_arm::Target_arm): Initialize new data members GOT_,
9063 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
9064 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
9065 and Target_arm::rel_dyn_section.
9066 Declare new_enum Target_arm::Got_type.
9067 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
9069 Update commments for member do_dynsym_value.
9070 (Target_arm::got_size, Target_arm::plt_section,
9071 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
9072 new methods inside class defintion.
9073 (Target_arm::got_section): Define new method.
9074 (Target_arm::rel_dyn_section): Same.
9075 (Output_data_plt_arm): New template class.
9076 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
9077 (Output_data_plt_arm:do_adjust_output_section): Define new method.
9078 (Output_data_plt_arm::add_entry): Same.
9079 (Output_data_plt_arm::first_plt_entry): Define new
9080 static data member for PLT instruction template.
9081 (Output_data_plt_arm::plt_entry): Same.
9082 (Output_data_plt_arm::do_write): Define new method.
9083 (Target_arm::make_plt_entry): Same.
9084 (Target_arm::do_finalize_sections): Same.
9085 (Target_arm::do_dynsym_value): Same.
9087 2009-05-28 Doug Kwan <dougkwan@google.com>
9089 * Makefile.am (TARGETSOURCES): Add arm.cc.
9090 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
9091 * Makefile.in: Regenerate.
9093 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
9095 2009-05-26 Doug Kwan <dougkwan@google.com>
9097 * options.cc (General_options::parse_exclude_libs). Fix a comment.
9098 (General_options::check_excluded_libs): Strip off directories in
9099 archive name before matching like GNU ld does.
9100 * testsuite/Makefile.am (MOSTLYCLEANFILES,
9101 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
9102 (exclude_libs_test_LDFLAGS): Add linker option
9103 -Wl,--exclude-libs,libexclude_libs_test_3
9104 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
9105 an explicit archive without using -l.
9106 (alt/libexclude_libs_test_3.a): New make rule.
9107 * testsuite/Makefile.in: Regenerate.
9108 * testsuite/exclude_libs_test.c : Declare lib3_default().
9110 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
9111 * exclude_libs_test_3.c: New file.
9113 2009-05-26 Nick Clifton <nickc@redhat.com>
9115 * po/id.po: New Indonesian translation.
9116 * po/gold.pot: Updated template file.
9118 2009-05-22 Sriraman Tallam <tmsriram@google.com>
9120 * testsuite/Makefile.am: Add -ffunction-sections to compile
9121 gc_comdat_test files. Add -Wl,--gc-sections to build
9123 * testsuite/Makefile.in: Regenerate.
9124 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
9126 2009-05-21 Sriraman Tallam <tmsriram@google.com>
9128 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
9129 kept comdat section was garbage collected.
9130 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
9131 * testsuite/Makefile.in: Regenerate.
9132 * testsuite/gc_comdat_test.sh: New file.
9133 * testsuite/gc_comdat_test_1.cc: New file.
9134 * testsuite/gc_comdat_test_2.cc: New file.
9136 2009-05-19 Doug Kwan <dougkwan@google.com>
9138 * archive.cc (Archive::Archive): Move constructor from archive.h
9139 to here. Initialize no_export_.
9140 (Archive::get_elf_object_for_member): Set no_export flag of object.
9141 * archive.h (Archive::Archive): Move constructor body to
9143 (Archive::no_export): New method.
9144 (Archive::no_export_): New field.
9145 * object.h (Object::Object): Initialize no_export_ to false.
9146 (Object::no_export, Object::set_no_export): New methods.
9147 (Object::no_export_): New field.
9148 * options.cc (General_options::parse_exclude_libs): New method.
9149 (General_options::check_excluded_libs) Same.
9150 * options.h (exclude_libs): New option.
9151 (General_options::check_excluded_libs): New method declaration.
9152 (General_options::excluded_libs_): New field.
9153 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
9154 default or protected visibility if an object has no-export flag set.
9155 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
9156 (check_SCRIPTS): Add exclude_libs_test.sh.
9157 (check_DATA): Add exclude_libs_test.syms.
9158 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
9159 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
9160 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
9161 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
9162 (exclude_libs_test.syms, libexclude_libs_test_1.a,
9163 libexclude_libs_test_2.a): New rules.
9164 * testsuite/Makefile.in: Regenerate.
9165 * testsuite/exclude_libs_test.c: New file.
9166 * testsuite/exclude_libs_test.sh: Ditto.
9167 * testsuite/exclude_libs_test_1.c: Ditto.
9168 * testsuite/exclude_libs_test_2.c: Ditto.
9170 2009-05-15 Ian Lance Taylor <iant@google.com>
9172 * configure.ac: Check for declarations for cases where libiberty.h
9173 checks HAVE_DECL_xxx.
9174 * configure, config.in: Rebuild.
9176 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
9178 * gold.h (Incremental_argument_list): Remove (invalid) forward
9180 * incremental.cc (Incremental_inputs::report_achive): New method.
9181 (Incremental_inputs::report_object): New method.
9182 (Incremental_inputs::report_script): New method.
9183 (Incremental_inputs::finalize_inputs): New method.
9184 (Incremental_inputs::finalize): Call finalize_inputs().
9185 (Incremental_inputs::sized_create_incremental_inputs_section_data):
9186 Create inputs entries.
9187 * incremental.h (Incremental_input_type): New enum.
9188 (Incremental_inputs::Incremental_input): Initialize new fields.
9189 (Incremental_inputs::report_inputs): New method.
9190 (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::Input_info): New struct.
9195 (Incremental_inputs::Input_info_map): New typedef.
9196 (Incremental_inputs::lock_): New field.
9197 (Incremental_inputs::Inputs_): New field.
9198 (Incremental_inputs::Inputs_map): New field.
9199 * main.cc (main): Call Incremental_input::report_inputs.
9200 * options.h (Input_argument_list): Typedef moved from
9202 (Input_file_group::Files): Remove, use ::Input_argument_list.
9203 (Input_file_group::Input_argument_list): Remove, use
9204 ::Input_argument_list.
9205 * plugin.cc (Plugin_manager::add_input_file): Add error in
9207 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
9209 * script.cc (read_input_script): Call
9210 Incremental_input::report_script.
9211 * script.h (Script_info): New class.
9213 2009-04-27 Ian Lance Taylor <iant@google.com>
9215 * x86_64.cc (do_adjust_output_section): Set entsize to
9218 2009-04-23 Elliott Hughes <enh@google.com>
9220 * output.cc (Output_file::close): After short writes, continue
9221 writing from the correct offset in the buffer being written.
9223 2009-04-23 Chris Demetriou <cgd@google.com>
9225 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
9226 * configure: Regenerate.
9227 * config.in: Regenerate.
9228 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
9229 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
9231 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
9233 * incremental.cc (Incremental_inputs_header_data): Renamed from
9234 Incremental_input_header_data.
9235 (Incremental_inputs_header_data::data_size): New field.
9236 (Incremental_inputs_header_data::put_input_file_count): Renamed
9237 from input_file_count.
9238 (Incremental_inputs_header_data::put_command_line_offset): Renamed
9239 from command_line_offset.
9240 (Incremental_inputs_header_data::put_reserved): Renamed from
9242 (Incremental_inputs_entry_data): Renamed from
9243 Incremental_input_entry_data.
9244 (Incremental_inputs_entry_data::data_size): New field.
9245 (Incremental_inputs::report_command_line): New method.
9246 (Incremental_inputs::finalize): New method.
9247 (Incremental_inputs::create_incremental_inputs_data): New method.
9248 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
9249 * incremental.h: New file.
9250 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
9251 (Layout::finalize): Create incremental inputs section in
9253 (Layout::create_incremental_info_sections): New method.
9254 * layout.h (Layout::incremental_inputs): New method.
9255 (Layout::create_incremental_info_sections): New method.
9256 (Layout::incremental_inputs_): New field.
9257 * main.cc (main): Notify Incremental_input of the command line.
9259 2009-04-01 Ian Lance Taylor <iant@google.com>
9260 Mikolaj Zalewski <mikolajz@google.com>
9262 * gold.h (reserve_unordered_map): Define, three versions, one for
9263 each version of Unordered_map.
9264 * layout.cc (Layout::Layout): Remove options parameter. Add
9265 number_of_input_files parameter. Don't initialize options_.
9266 Initialize number_of_input_files_ and resized_signatures_. Move
9267 sections_are_attached_.
9268 (Layout::layout_group): Reserve space for group_signatures_.
9269 (Layout::find_or_add_kept_section): Change name parameter to be a
9270 reference. Resize signatures_ map when it gets large enough.
9271 (Layout::layout_eh_frame): Use parameters->options() instead of
9273 (Layout::make_output_section): Likewise.
9274 (Layout::attach_allocated_section_to_segment): Likewise.
9275 (Layout::finalize, Layout::create_executable_stack): Likewise.
9276 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
9277 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
9278 * layout.h (class Layout): Update declarations. Remove options_
9279 field. Add number_of_input_files_ and resized_signatures_
9280 fields. Move sections_are_attached_ field.
9281 * main.cc (main): Pass number of input files to Layout
9282 constructor. Don't pass options.
9284 2009-03-30 Ian Lance Taylor <iant@google.com>
9286 * ffsll.c (ffsll): Correct implementation.
9288 2009-03-27 Ian Lance Taylor <iant@google.com>
9290 * ffsll.c: New file.
9291 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
9292 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
9293 * ftruncate.c (ftruncate): Declare before definition.
9294 * mremap.c (mremap): Likewise.
9295 * pread.c (pread): Likewise.
9296 * configure, Makefile.in, config.in: Rebuild.
9298 * mremap.c: New file.
9299 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
9300 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
9301 (mremap): Declare if HAVE_MREMAP is not defined.
9302 * configure, Makefile.in, config.in: Rebuild.
9304 2009-03-27 Cary Coutant <ccoutant@google.com>
9306 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
9307 position independent.
9308 * sparc.cc (Target_sparc::check_non_pic): Likewise.
9309 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
9311 2009-03-24 Cary Coutant <ccoutant@google.com>
9313 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
9315 (needs_dynamic_reloc): Likewise.
9317 2009-03-24 Ian Lance Taylor <iant@google.com>
9319 * yyscript.y (file_cmd): Recognize EXTERN.
9320 (extern_name_list, extern_name_list_body): New nonterminals.
9321 * script.cc (script_add_extern): Define.
9322 * script-c.h (script_add_extern): Declare.
9324 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
9326 * object.cc (is_elf_object): Define.
9327 * object.h (is_elf_object): Declare.
9328 * archive.cc (Archive::get_elf_object_for_member): Call
9330 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
9332 2009-03-24 Elliott Hughes <enh@google.com>
9334 * output.cc (Output_file::map_anonymous): Define.
9335 (Output_file::map): Use map_anonymous. If the regular mmap fails,
9336 try an anonymous one. Report the size if the mmap fails.
9337 * output.h (class Output_file): Declare map_anonymous.
9339 2009-03-24 Ian Lance Taylor <iant@google.com>
9341 * target-select.cc (instantiate_target): Don't acquire the lock if
9342 the instantiated_target_ field has already been set.
9344 2009-03-23 Ian Lance Taylor <iant@google.com>
9346 * gold-threads.h (class Initialize_lock): Define.
9347 * gold-threads.cc (class Initialize_lock_once): Define.
9348 (initialize_lock_control): New static variable.
9349 (initialize_lock_pointer): New static variable.
9350 (initialize_lock_once): New static function.
9351 (Initialize_lock::Initialize_lock): Define.
9352 (Initialize_lock::initialize): Define.
9353 * target-select.h: Include "gold-threads.h".
9354 (class Target_selector): Add lock_ and initialize_lock_ fields.
9355 Don't define instantiate_target, just declare it.
9356 * target-select.cc (Target_selector::Target_selector): Initialize
9358 (Target_selector::instantiate_target): Define.
9359 * descriptors.h: Include "gold-threads.h".
9360 (class Descriptors): Add initialize_lock_ field.
9361 * descriptors.cc (Descriptors::Descriptors): Initialize new
9363 (Descriptors::open): Use initialize_lock_ field
9364 * errors.h (class Errors): Add initialize_lock_ field.
9365 * errors.cc (Errors::Errors): Initialize new field.
9366 (Errors::initialize_lock): Use initialize_lock_ field.
9367 * powerpc.cc (class Target_selector_powerpc): Remove
9368 instantiated_target_ field. In do_recognize call
9369 instantiate_target rather than do_instantiate_target. In
9370 do_instantiate_target just allocate a new target.
9371 * sparc.cc (class Target_selector_sparc): Likewise.
9373 * freebsd.h: New file.
9374 * i386.cc: Include "freebsd.h".
9375 (Target_i386): Derive from Target_freebsd rather than
9377 (Target_selector_i386): Derive from Target_selector_freebsd rather
9378 than Target_selector.
9379 * x86_64.cc: Include "freebsd.h".
9380 (Target_x86_64): Derive from Target_freebsd rather than
9382 (Target_selector_x86_64): Derive from Target_selector_freebsd
9383 rather than Target_selector.
9384 * target.h (class Target): Add adjust_elf_header and
9385 do_adjust_elf_header.
9386 * output.cc (Output_file_header:: do_sized_write): Call target
9387 adjust_elf_header routine.
9388 * configure.tgt: Set targ_osabi.
9389 * configure.ac: Define GOLD_DEFAULT_OSABI.
9390 * parameters.cc (Parameters::default_target): Pass
9391 GOLD_DEFAULT_OSABI to select_target.
9392 * target-select.h (class Target_selector): Make instantiate_target
9393 protected rather than private.
9394 * Makefile.am (HFILES): Add freebsd.h.
9395 * configure, Makefile.in, config.in: Rebuild.
9397 * merge.cc (do_add_input_section): Correct pend value. Change
9398 message about last entry not being null terminated from error to
9401 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
9403 * incremental.cc: New file.
9404 * Makefile.am (CCFILES): Add incremental.cc.
9405 * Makefile.in: Rebuild.
9407 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
9409 * layout.cc (Layout::output_section_name): Preserve names
9410 of '.note.' sections.
9412 2009-03-19 Ian Lance Taylor <iant@google.com>
9414 * descriptors.cc (Descriptors::open): Check that the options are
9415 valid before using them.
9417 2009-03-18 Ian Lance Taylor <iant@google.com>
9419 * script-sections.h: Include <list>.
9420 (class Script_sections): Change Sections_elements from std::vector
9421 to std::list. Typedef public Elements_iterator. Add
9422 orphan_section_placement_, data_segment_align_start_, and
9423 saw_data_segment_align_ fields. Remove data_segment_align_index_
9425 * script-sections.cc (class Orphan_section_placement): New class.
9426 (class Sections_element): Add virtual functions is_relro and
9427 orphan_section_init. Remove virtual function place_orphan_here.
9428 (class Output_section_definition): Add is_relro and
9429 orphan_section_init. Remove place_orphan_here.
9430 (class Orphan_output_section): Likewise.
9431 (Script_sections::Script_sections): Update for field changes.
9432 (Script_sections::data_segment_align): Set saw_data_segment_align_
9433 and data_segment_align_start_, not data_segment_align_index.
9434 (Script_sections::data_segment_relro_end): Check
9435 saw_data_segment_align_. Use data_segment_align_start_ rather
9436 than data_segment_align_index_.
9437 (Script_sections::place_orphan): Rewrite to use
9438 Orphan_section_placement.
9440 2009-03-17 Ian Lance Taylor <iant@google.com>
9442 * archive.cc (Archive::add_symbols): Check for a version attached
9443 to the symbol name in the archive map.
9444 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
9445 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
9446 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
9447 (ver_test_11.a): New target.
9448 * testsuite/Makefile.in: Rebuild.
9450 * configure.ac: Check for chsize and posix_fallocate. Replace
9452 * ftruncate.c: New file, from gnulib.
9453 * output.cc (posix_fallocate): Define dummy version if not
9454 HAVE_POSIX_FALLOCATE.
9455 (Output_file::map): Call posix_fallocate rather than lseek and
9457 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
9458 * configure, Makefile.in, config.in: Rebuild.
9460 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
9462 * layout.h (Layout::create_note): Add section_name parameter.
9463 * layout.cc (Layout::create_note): Likewise.
9464 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
9466 2009-03-17 Ian Lance Taylor <iant@google.com>
9468 * descriptors.cc: Include "options.h".
9469 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
9470 (Descriptors::open): Always use O_CLOEXEC when opening a new
9471 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
9472 then set FD_CLOEXEC.
9474 * sparc.cc (class Target_sparc): Add has_got_section.
9475 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
9476 make sure we have a GOT section.
9478 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
9479 (Target_sparc::Scan::local): Likewise.
9480 (Target_sparc::Scan::global): Likewise.
9481 (Target_sparc::Relocate::relocate): Likewise.
9482 (Target_sparc::Relocate::relocate_tls): Likewise.
9484 * symtab.cc (Symbol_table::define_default_version): New function,
9485 broken out of add_from_object.
9486 (Symbol_table::add_from_object): Call define_default_version.
9487 (Symbol_table::define_special_symbol): Add resolve_oldsym
9488 parameter. Change all callers. If the version for a symbol comes
9489 from a version script, resolve it with the symbol with the same
9490 name with no version. Also add the symbol without a version if
9492 (do_define_in_output_data): If resolving with oldsym, don't delete
9494 (do_define_in_output_segment): Likewise.
9495 (do_define_as_constant): Likewise.
9496 * symtab.h (class Symbol_table): Update declarations.
9498 2009-03-13 Ian Lance Taylor <iant@google.com>
9500 * readsyms.cc (Read_symbols::incompatible_warning): New function.
9501 (Read_symbols::requeue): New function.
9502 (Read_symbols::do_read_symbols): If make_elf_object fails because
9503 the target type is not configured, and the file was searched for,
9504 issue a warning and retry with the next directory.
9505 (Add_symbols::run): If the file has an incompatible format, and
9506 it was searched for, requeue the Read_symbols task. On error,
9508 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
9509 dirindex parameter to constructor. Change all callers. Declare
9510 incompatible_warning and requeue.
9511 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
9512 input_argument_ and input_group_ fields. Add them to
9513 constructor. Change all callers.
9514 (class Read_script): Add dirindex_ field. Add it to constructor.
9516 * archive.cc (Archive::setup): Remove input_objects parameter.
9518 (Archive::get_file_and_offset): Likewise.
9519 (Archive::read_all_symbols): Likewise.
9520 (Archive::read_symbols): Likewise.
9521 (Archive::get_elf_object_for_member): Remove input_objects
9522 parameter. Add punconfigured parameter. Change all callers.
9523 (Archive::add_symbols): Change return type to bool. Check return
9524 value of include_member.
9525 (Archive::include_all_members): Likewise.
9526 (Archive::include_member): Change return type to bool. Return
9527 false if first included object has incompatible target. Set
9528 included_member_ field.
9529 (Add_archive_symbols::run): If add_symbols returns false, requeue
9531 * archive.h (class Archive): Add included_member_ field.
9532 Initialize it in constructor. Add input_file and searched_for
9533 methods. Update declarations.
9534 (class Add_archive_symbols): Add dirpath_, dirindex_, and
9535 input_argument_ fields. Add them to constructor. Change all
9537 * script.cc: Include "target-select.h".
9538 (class Parser_closure): Add skip_on_incompatible_target_ and
9539 found_incompatible_target_ fields. Add
9540 skip_on_incompatible_target parameter to constructor. Change all
9541 callers. Add methods skip_on_incompatible_target,
9542 clear_skip_on_incompatible_target, found_incompatible_target, and
9543 set_found_incompatible_target.
9544 (read_input_script): Add dirindex parameter. Change all callers.
9545 If parser finds an incompatible target, requeue Read_symbols
9547 (script_set_symbol): Clear skip_on_incompatible_target in
9549 (script_add_assertion, script_parse_option): Likewise.
9550 (script_start_sections, script_add_phdr): Likewise.
9551 (script_check_output_format): New function.
9552 * script.h (read_input_script): Update declaration.
9553 * script-c.h (script_check_output_format): Declare.
9554 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
9555 (ignore_cmd): Remove OUTPUT_FORMAT.
9556 * fileread.cc (Input_file::Input_file): Add explicit this.
9557 (Input_file::will_search_for): New function.
9558 (Input_file::open): Add pindex parameter. Change all callers.
9559 * fileread.h (class Input_file): Add input_file_argument method.
9560 Declare will_search_for. Update declarations.
9561 * object.cc (make_elf_object): Add punconfigured parameter.
9563 * object.h (class Object): Make input_file public. Add
9564 searched_for method.
9565 (make_elf_object): Update declaration.
9566 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
9568 * dirsearch.h (class Dirsearch): Update declaration.
9569 * options.h (class General_options): Add --warn-search-mismatch.
9570 * parameters.cc (Parameters::is_compatible_target): New function.
9571 * parameters.h (class Parameters): Declare is_compatible_target.
9572 * workqueue.cc (Workqueue::add_blocker): New function.
9573 * workqueue.h (class Workqueue): Declare add_blocker.
9575 * fileread.cc (Input_file::open): Remove options parameter.
9577 (Input_file::open_binary): Likewise.
9578 * script.cc (read_input_script): Likewise.
9579 * readsyms.h (class Read_symbols): Remove options_ field. Remove
9580 options parameter from constructor. Change all callers.
9581 (class Read_script): Likewise.
9582 * fileread.h (class Input_file): Update declarations.
9583 * script.h (read_input_script): Update declaration.
9585 2009-03-10 Nick Clifton <nickc@redhat.com>
9587 * po/es.po: New Spanish translation.
9589 2009-03-06 Cary Coutant <ccoutant@google.com>
9591 * options.cc (parse_short_option): Keep dash_z from registering itself.
9593 2009-03-03 Ian Lance Taylor <iant@google.com>
9596 * target-reloc.h (relocate_section): Pass output_section to
9598 * i386.cc (Target_i386::should_apply_static_reloc): Add
9599 output_section parameter. Change all callers.
9600 (Target_i386::Relocate::relocate): Add output_section parameter.
9601 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9602 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
9603 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
9604 * testsuite/two_file_shared.sh: New script.
9605 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
9606 (check_DATA): Add two_file_shared.dbg.
9607 (two_file_shared.dbg): New target.
9608 * testsuite/Makefile.in: Rebuild.
9610 2009-03-01 Ian Lance Taylor <iant@google.com>
9612 * configure.ac: Check for byteswap.h.
9613 * configure: Rebuild.
9614 * config.in: Rebuild.
9616 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
9618 * layout.cc (Layout::find_or_add_kept_section): New function.
9619 (Layout::add_comdat): Removed.
9620 * layout.h (struct Kept_section): Move out of class Layout.
9621 Remove trailing underscores from field names. Add group_sections
9622 field. Rename group_ field to is_group. Change all uses.
9623 (class Layout): Declare find_or_add_kept_section, not add_comdat.
9624 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
9625 comdat_groups_ field.
9626 (Sized_relobj::include_section_group): Use
9627 find_or_add_kept_section and Kept_section::group_sections.
9628 (Sized_relobj::include_linkonce_section): Likewise.
9629 * object.cc (class Sized_relobj): Don't define Comdat_group or
9630 Comdat_group_table. Remove find_comdat_group and
9631 add_comdat_group. Remove comdat_groups_ field.
9632 * plugin.cc (include_comdat_group): Use
9633 Layout::find_or_add_kept_section.
9635 2009-02-28 Ian Lance Taylor <iant@google.com>
9637 * README: --gc-sections and map files are now supported. Document
9638 some build requirements.
9641 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
9642 relocatable link set the value of the section symbol to zero.
9643 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
9644 relocatable link don't include the section address in the local
9647 2009-02-27 Ian Lance Taylor <iant@google.com>
9650 * options.h (class Search_directory): Add is_system_directory.
9651 (class General_options): Declare is_in_system_directory.
9652 * options.cc (get_relative_sysroot): Make static.
9653 (get_default_sysroot): Make static.
9654 (General_optoins::is_in_system_directory): New function.
9655 * fileread.cc (Input_file::is_in_system_directory): New function.
9656 * fileread.h (class Input_file): Declare is_in_system_directory.
9657 * object.h (class Object): Add is_in_system_directory.
9658 (class Input_objects): Remove system_library_directory_ field.
9659 * object.cc (Input_objects::add_object): Don't set
9660 system_library_directory_.
9661 (input_objects::found_in_system_library_directory): Remove.
9662 * symtab.cc (Symbol_table::write_globals): Remove input_objects
9663 parameter. Change all callers.
9664 (Symbol_table::sized_write_globals): Likewise.
9665 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
9666 Call Object::is_in_system_directory.
9667 * symtab.h (class Symbol_table): Update declarations.
9670 * descriptors.h (Open_descriptor): Add is_on_stack field.
9671 * descriptors.cc (Descriptors::open): If the descriptor is on the
9672 top of the stack, remove it. Initialize is_on_stack field.
9673 (Descriptors::release): Only add pod to stack if it is not on the
9675 (Descriptors::close_some_descriptor): Clear stack_next and
9679 * output.cc (Output_section::find_starting_output_address): Rename
9680 from starting_output_address; add PADDR parameter; change return
9682 * output.h (class Output_section): Declare
9683 find_starting_output_address instead of starting_output_address.
9684 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
9685 section symbol for which we can't find a merge section.
9688 * symtab.cc (Symbol_table::add_from_object): If the visibility is
9689 hidden or internal, force the symbol to be local.
9690 * resolve.cc (Symbol::override_visibility): Define.
9691 (Symbol::override_base): Use override_visibility.
9692 (Symbol_table::resolve): Likewise.
9693 (Symbol::override_base_with_special): Likewise.
9694 (Symbol_table::override_with_special): If the visibility is hidden
9695 or internal, force the symbol to be local.
9696 * symtab.h (class Symbol): Add set_visibility and
9697 override_visibility.
9698 * testsuite/ver_test_1.sh: New file.
9699 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
9700 (check_DATA): Add ver_test_1.syms.
9701 (ver_test_1.syms): New target.
9702 * testsuite/Makefile.in: Rebuild.
9704 2009-02-25 Cary Coutant <ccoutant@google.com>
9706 * layout.cc (Layout::choose_output_section): Don't rename sections
9707 when using a linker script that has a SECTIONS clause.
9708 * Makefile.in: Regenerate.
9710 * testsuite/Makefile.am (script_test_5.sh): New test case.
9711 * testsuite/Makefile.in: Regenerate.
9712 * testsuite/script_test_5.cc: New file.
9713 * testsuite/script_test_5.sh: New file.
9714 * testsuite/script_test_5.t: New file.
9716 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
9718 * archive.cc (Archive::include_member): Update calls to add_symbols.
9719 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
9720 the Layout argument.
9721 * dynobj.h (do_add_symbols): Add the Layout argument.
9722 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
9724 * object.h (Object::add_symbols): Add the Layout argument.
9725 (Object::do_add_symbols): Add the Layout argument.
9726 (Sized_relobj::do_add_symbols): Add the Layout argument.
9727 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
9728 Unify the two versions.
9729 (Add_plugin_symbols): Remove.
9730 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
9731 (Sized_pluginobj::do_add_symbols): Unify the two versions.
9732 (Add_plugin_symbols): Remove.
9733 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
9734 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
9735 (Add_symbols::run): Make it work with Pulginobj.
9737 2009-02-06 Ian Lance Taylor <iant@google.com>
9739 * object.cc (Sized_relobj::do_layout): Make info message start
9740 with lower case letter.
9742 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
9744 * binary.cc: Fix file comment.
9746 * options.h (enum Incremental_disposition): Define.
9747 (class General_options): Add new options: --incremental,
9748 --incremental_changed, --incremental_unchanged,
9749 --incremental_unknown. Add incremental_disposition_ and
9750 implicit_incremental_ fields.
9751 (General_options::incremental_disposition): New function.
9752 (class Position_dependent_options): Add incremental_disposition
9754 (Position_dependent_options::copy_from_options): Set incremental
9756 * options.cc (General_options::parse_incremental_changed): New
9758 (General_options::parse_incremental_unchanged): New function.
9759 (General_options::parse_incremental_unknown): New function.
9760 (General_options::General_options): Initialize new fields
9761 incremental_disposition_ and implicit_incremental_.
9762 (General_options::finalize): Check for uasge of --incremental-*
9763 without --incremental.
9765 2009-02-06 Chris Demetriou <cgd@google.com>
9767 * gold.h (gold_undefined_symbol): Change to take only a Symbol
9768 pointer and to report location as the file name associated with
9770 (gold_undefined_symbol_at_location): New function to replace the
9771 old gold_undefined_symbol functionality.
9772 * target-reloc.h (relocate_section): Update to use
9773 gold_undefined_symbol_at_location.
9774 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9775 Call gold_undefined_symbol function rather than gold_error.
9776 * errors.h (Errors::undefined_symbol): Take location as a
9777 string, rather than calculating it from a relocation.
9778 * errors.cc (Errors::fatal): Print "fatal error:" before the
9780 (Errors::error, Errors::error_at_location): Print "error: "
9781 before the formatted message.
9782 (Errors::undefined_symbol): Take location as a string, rather
9783 than calculating it from a relocation.
9784 (gold_undefined_symbol_at_location): New function akin to
9785 old gold_undefined_symbol, calculates location from relocation.
9786 (gold_undefined_symbol): Change to take only a Symbol pointer
9787 and to report location as the file name associated with the symbol.
9788 * testsuite/debug_msg.sh: Update for changed error messages.
9789 * testsuite/undef_symbol.sh: Likewise.
9791 2009-02-04 Duncan Sands <baldrick@free.fr>
9794 * reduced_debug_output.h
9795 (Output_reduced_debug_abbrev_section::failed): Use format for
9797 (Output_reduced_debug_info_section::faild): Likewise.
9799 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
9801 * script.cc (Lazy_demangler): New class.
9802 (Version_script_info::get_symbol_version_helper): Demangle a
9805 2009-01-29 Cary Coutant <ccoutant@google.com>
9807 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
9809 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9811 2009-01-28 Ian Lance Taylor <iant@google.com>
9813 * version.cc (version_string): Bump to 1.9.
9815 * gold.h: Include <cstring> and <stdint.h>.
9816 * version.cc: Include <cstdio>.
9817 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
9819 * reduced_debug_output.cc (insert_into_vector): Rename from
9820 Insert_into_vector; change all callers. Use Swap_unaligned to
9821 avoid aliasing issue; remove union since it is unnecessary.
9823 2009-01-27 Sriraman Tallam <tmsriram@google.com>
9825 * Makefile.am (CCFILES): Add gc.cc.
9827 * Makefile.in: Regenerate.
9828 * gold.cc (Gc_runner): New class.
9829 (queue_initial_tasks): Call garbage collection related tasks
9830 when corresponding options are invoked.
9831 (queue_middle_gc_tasks): New function.
9832 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
9833 processed early before laying out sections during garbage collection.
9834 * gold.h (queue_middle_gc_tasks): New function.
9835 (is_prefix_of): Move from "layout.cc".
9836 * i386.cc (Target_i386::gc_process_relocs): New function.
9837 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
9838 * main.cc (main): Create object of class "Garbage_collection".
9839 * object.cc (Relobj::copy_symbols_data): New function.
9840 (Relobj::is_section_name_included): New function.
9841 (Sized_relobj::do_layout): Allow this function to be called twice
9842 during garbage collection and defer layout of section during the
9844 * object.h (Relobj::get_symbols_data): New function.
9845 (Relobj::is_section_name_included): New function.
9846 (Relobj::copy_symbols_data): New function.
9847 (Relobj::set_symbols_data): New function.
9848 (Relobj::get_relocs_data): New function.
9849 (Relobj::set_relocs_data): New function.
9850 (Relobj::is_output_section_offset_invalid): New pure virtual function.
9851 (Relobj::gc_process_relocs): New function.
9852 (Relobj::do_gc_process_relocs): New pure virtual function.
9853 (Relobj::sd_): New data member.
9854 (Sized_relobj::is_output_section_offset_invalid): New function.
9855 (Sized_relobj::do_gc_process_relocs): New function.
9856 * options.h (General_options::gc_sections): Modify to not be a no-op.
9857 (General_options::print_gc_sections): New option.
9858 * plugin.cc (Plugin_finish::run): Remove function call to
9859 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
9860 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
9861 * reloc.cc (Read_relocs::run): Add task to process relocs and
9862 determine unreferenced sections when doing garbage collection.
9863 (Gc_process_relocs): New class.
9864 (Sized_relobj::do_gc_process_relocs): New function.
9865 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
9866 sections that are garbage collected.
9867 * reloc.h (Gc_process_relocs): New class.
9868 * sparc.cc (Target_sparc::gc_process_relocs): New function.
9869 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
9870 symbols whose corresponding sections are garbage collected.
9871 (Symbol_table::Symbol_table): Add new parameter for the garbage
9873 (Symbol_table::gc_mark_undef_symbols): New function.
9874 (Symbol_table::gc_mark_symbol_for_shlib): New function.
9875 (Symbol_table::gc_mark_dyn_syms): New function.
9876 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
9878 (Symbol_table::add_from_object): Likewise.
9879 (Symbol_table::add_from_relobj): When building shared objects, do not
9880 treat externally visible symbols as garbage.
9881 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
9882 table information for static and relocatable links.
9883 * symtab.h (Symbol_table::set_gc): New function.
9884 (Symbol_table::gc): New function.
9885 (Symbol_table::gc_mark_undef_symbols): New function.
9886 (Symbol_table::gc_mark_symbol_for_shlib): New function.
9887 (Symbol_table::gc_mark_dyn_syms): New function.
9888 (Symbol_table::gc_): New data member.
9889 * target.h (Sized_target::gc_process_relocs): New pure virtual
9891 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
9892 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
9894 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
9896 * options.h (General_options::gc_sections): Define as a no-op for now.
9897 (General_options::no_keep_memory): Ditto.
9898 (General_options::Bshareable): Define.
9899 * options.cc (General_options::finalize): Honor -Bshareable.
9901 2009-01-20 Andreas Schwab <schwab@suse.de>
9903 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
9904 read the value in the contents, since we don't use it. Use the
9905 template endianness when writing.
9906 (Relocate::relocate): Use it for R_PPC_REL16_HA.
9908 2009-01-19 Andreas Schwab <schwab@suse.de>
9910 * configure.tgt (powerpc64-*): Fix targ_obj.
9912 2009-01-15 Ian Lance Taylor <iant@google.com>
9914 * object.cc (Sized_relobj::write_local_symbols): Don't write out
9915 local symbols when stripping all symbols.
9917 2009-01-14 Cary Coutant <ccoutant@google.com>
9919 * output.cc (Output_reloc): Add explicit instantiations.
9921 2009-01-14 Cary Coutant <ccoutant@google.com>
9923 * archive.cc (Archive::get_elf_object_for_member): Remove call
9924 to File_read::claim_for_plugin.
9925 * descriptors.cc (Descriptors::open): Remove reference to
9927 (Descriptors::claim_for_plugin): Remove.
9928 * descriptors.h (Descriptors::claim_for_plugin): Remove.
9929 (Descriptors::is_claimed): Remove.
9930 (claim_descriptor_for_plugin): Remove.
9931 * fileread.cc (File_read::claim_for_plugin): Remove.
9932 * fileread.h (File_read::claim_for_plugin): Remove.
9933 (File_read::descriptor): Reopen descriptor if necessary.
9934 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
9935 (Plugin_manager::all_symbols_read): Add task parameter. Change
9937 (Plugin_manager::get_input_file): New function.
9938 (Plugin_manager::release_input_file): New function.
9939 (Pluginobj::Pluginobj): Add filesize parameter and initialize
9940 corresponding data member.
9941 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
9942 and pass to base constructor. Change all callers.
9943 (get_input_file, release_input_file): New functions.
9944 (make_sized_plugin_object): Add filesize parameter. Change all callers.
9945 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
9946 (Plugin_manager::all_symbols_read): Add task parameter.
9947 (Plugin_manager::get_input_file): New function.
9948 (Plugin_manager::release_input_file): New function.
9949 (Plugin_manager::task_): New data member.
9950 (Pluginobj::Pluginobj): Add filesize parameter.
9951 (Pluginobj::filename): New function.
9952 (Pluginobj::descriptor): New function.
9953 (Pluginobj::filesize): New function.
9954 (Pluginobj::filesize_): New data member.
9955 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
9956 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
9957 File_read::claim_for_plugin; use Object::unlock to unlock the file.
9959 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
9960 with archive libraries.
9961 * testsuite/Makefile.in: Regenerate.
9962 * testsuite/plugin_test.c (struct sym_info): New type.
9963 (get_input_file, release_input_file): New static variables.
9964 (onload): Capture new transfer vector entries.
9965 (claim_file_hook): Stop reading at end of file according to filesize.
9966 Factor out parsing of readelf output into separate function.
9967 (all_symbols_read_hook): Exercise get_input_file and release_input_file
9968 APIs and get the source file name from the symbol table. Convert
9969 source file name to corresponding object file name. Print info
9970 message when adding new input files.
9971 (parse_readelf_line): New function.
9972 * testsuite/plugin_test_1.sh: Add checks for new info messages.
9973 * testsuite/plugin_test_2.sh: Likewise.
9974 * testsuite/plugin_test_3.sh: Likewise.
9975 * testsuite/plugin_test_4.sh: New test case.
9977 2009-01-07 Ian Lance Taylor <iant@google.com>
9979 * version.cc (version_string): Bump to 1.8.
9981 2008-12-23 Cary Coutant <ccoutant@google.com>
9983 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
9984 * plugin.cc (Plugin_manager::finish): Rename as
9985 layout_deferred_objects. Move cleanup to separate function.
9986 (Plugin_manager::cleanup): New function.
9987 (Plugin_finish::run): Call layout_deferred_objects and cleanup
9989 * plugin.h (Plugin_manager::finish): Rename as
9990 layout_deferred_objects.
9991 (Plugin_manager::cleanup): New function.
9992 (Plugin_manager::cleanup_done): New field.
9994 2008-12-23 Cary Coutant <ccoutant@google.com>
9996 * plugin.cc (is_visible_from_outside): New function.
9997 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
9998 so we don't return "IR only" status for exported symbols or -r links.
10000 * testsuite/Makefile.am (plugin_test_3): New test case.
10001 * testsuite/Makefile.in: Regenerate.
10002 * testsuite/plugin_test_3.sh: New file.
10004 2008-12-22 Cary Coutant <ccoutant@google.com>
10006 * object.cc (Sized_relobj::layout_section): New function.
10007 (Sized_relobj::do_layout): Defer layout of input sections until after
10008 plugin has provided replacement files.
10009 (Sized_relobj::do_layout_deferred_sections): New function.
10010 * object.h (Relobj::set_section_offset): Remove virtual keyword.
10011 (Relobj::layout_deferred_sections): New function.
10012 (Relobj::do_layout_deferred_sections): New function.
10013 (Sized_relobj::do_layout_deferred_sections): New function.
10014 (Sized_relobj::layout_section): New function.
10015 (Sized_relobj::Deferred_layout): New structure.
10016 (Sized_relobj::deferred_layout_): New field.
10017 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10018 Change all callers. Layout deferred sections.
10019 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
10021 (Plugin_hook::run): Move code from do_plugin_hook inline.
10022 (Plugin_hook::do_plugin_hook): Remove.
10023 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10024 (Plugin_manager::finish): Renamed, was cleanup.
10025 (Plugin_manager::should_defer_layout): New function.
10026 (Plugin_manager::add_deferred_layout_object): New function.
10027 (Plugin_manager::Deferred_layout_list): New type.
10028 (Plugin_manager::deferred_layout_objects_): New field.
10029 (Plugin_hook::do_plugin_hook): Remove.
10031 2008-12-17 Ian Lance Taylor <iant@google.com>
10033 * options.h (class General_options): Add --no case for
10036 2008-12-16 Cary Coutant <ccoutant@google.com>
10038 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
10040 (Plugin_manager::claim_file): Create plugin object even if
10041 plugin did not call the add_symbols callback.
10042 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10043 asking for more symbols than were added.
10044 * testsuite/Makefile.am (plugin_test_1): Add test case with
10046 (empty.syms): New target.
10047 * testsuite/Makefile.in: Regenerate.
10048 * testsuite/plugin_test.c (claim_file_hook): Add new debug
10049 message. Don't call add_symbols if no globals.
10050 (all_symbols_read_hook): Don't provide replacement for empty
10053 2008-12-12 Ian Lance Taylor <iant@google.com>
10055 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10056 r_type == 0 for a local symbol with r_sym == 0.
10057 (scan_relocatable_relocs): Pass r_sym to
10058 local_non_section_strategy.
10059 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10062 * configure.ac: Update test for TLS descriptors: they are
10063 supported as of glibc 2.9.
10064 * configure: Rebuild.
10066 2008-12-11 Ian Lance Taylor <iant@google.com>
10069 * target-reloc.h (Default_scan_relocatable_relocs): For each
10070 function, map r_type == 0 to RELOC_DISCARD.
10072 2008-12-10 Cary Coutant <ccoutant@google.com>
10074 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
10075 object to override a kept COMDAT group from a plugin object.
10077 2008-12-09 Ian Lance Taylor <iant@google.com>
10080 * yyscript.y (file_cmd): Handle INPUT.
10082 * testsuite/initpri1.c: Change all declarations to be full
10083 prototypes by adding void, to avoid compiler warnings.
10085 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
10087 * options.cc (General_options::parse_plugin_opt): New.
10088 (General_options::add_plugin): The argument now is just the filename.
10089 (General_options::add_plugin_option): New.
10090 * options.h (plugin_opt): New.
10091 (add_plugin): Change argument name.
10092 (add_plugin_option): New.
10093 * plugin.cc (Plugin::load): Don't parse the plugin option.
10094 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
10095 (Plugin::add_option): New.
10096 (Plugin::args_): Change type.
10097 (Plugin::filename_): New.
10098 (Plugin_manager::add_plugin_option): New.
10099 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
10100 * testsuite/Makefile.in: Regenerate.
10102 2008-12-05 Cary Coutant <ccoutant@google.com>
10104 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
10105 Handle --strip-lto-sections option.
10106 * options.h (strip_lto_sections): New option.
10108 2008-12-01 Cary Coutant <ccoutant@google.com>
10110 * plugin.cc (ld_plugin_message): Change format parameter to const.
10111 Fix mismatch between new[] and delete.
10113 2008-11-14 Cary Coutant <ccoutant@google.com>
10115 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
10118 2008-11-05 Craig Silverstein <csilvers@google.com>
10120 * options.cc (General_options::parse_dynamic_list): New function.
10121 * options.h (General_options): New flags dynamic_list,
10122 dynamic_list_data, dynamic_list_cpp_new, and
10123 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
10124 (General_options::in_dynamic_list): New function.
10125 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
10126 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
10127 (Lex::can_continue_name): Likewise.
10129 (read_script_file): New parameter script_options.
10130 (read_dynamic_list): New function.
10131 (Script_options::define_dynamic_list): New function.
10132 (dynamic_list_keyword_parsecodes): New variable.
10133 (dynamic_list_keywords): New variable.
10134 * script.h (Script_options::define_dynamic_list): New function
10136 (read_dynamic_list): New function prototype.
10137 * symtab.cc (strprefix): New macro.
10138 (Symbol::should_add_dynsym_entry): Support dynamic_list,
10139 dynamic_list_data, dynamic_list_cpp_new, and
10140 dynamic_list_cpp_typeinfo.
10141 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
10142 (dynamic_list_expr): New rule.
10143 (dynamic_list_nodes): Likewise.
10144 (dynamic_list_node): Likewise.
10145 * testsuite/Makefile.am (dynamic_list): New test.
10146 * testsuite/Makefile.in: Regenerated.
10147 * testsuite/dynamic_list.t: New file.
10148 * testsuite/dynamic_list.sh: New file.
10150 2008-11-05 Craig Silverstein <csilvers@google.com>
10152 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
10153 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
10154 (t11_last): Likewise.
10155 * testsuite/ver_test_6.c (main): Likewise.
10157 2008-10-07 Cary Coutant <ccoutant@google.com>
10159 * options.c (General_options::finalize): Add check for -static and
10161 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
10164 2008-10-02 Cary Coutant <ccoutant@google.com>
10166 * plugin.cc (make_sized_plugin_object): Fix conditional
10167 compilation to work when not all targets are enabled.
10169 2008-09-29 Cary Coutant <ccoutant@google.com>
10171 * archive.cc (Archive::get_file_and_offset): Use filename instead
10172 of name to get library path.
10173 (Archive::include_member): Unlock external member of a thin archive.
10175 * testsuite/Makefile.am (TEST_AR): New variable.
10176 (thin_archive_test_1): New test.
10177 (thin_archive_test_2): New test.
10178 * testsuite/Makefile.in: Regenerate.
10179 * testsuite/thin_archive_main.cc: New file.
10180 * testsuite/thin_archive_test_1.cc: New file.
10181 * testsuite/thin_archive_test_2.cc: New file.
10182 * testsuite/thin_archive_test_3.cc: New file.
10183 * testsuite/thin_archive_test_4.cc: New file.
10185 2008-09-29 Cary Coutant <ccoutant@google.com>
10187 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
10188 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
10190 (Sized_relobj::do_finalize_local_symbols): Likewise.
10191 (Sized_relobj::map_to_kept_section): Likewise.
10192 * object.h (Sized_relobj::invalid_address): New constant.
10193 (Sized_relobj::do_output_section_offset): Check for invalid_address
10195 * output.cc (Output_reloc::local_section_offset): Use constant
10196 invalid_address instead of -1U.
10197 (Output_reloc::get_address): Likewise.
10198 (Output_section::output_address): Change -1U to -1ULL.
10199 * output.h (Output_reloc::invalid_address): New constant.
10200 * reloc.cc (Sized_relobj::write_sections): Use constant
10201 invalid_address instead of -1U.
10202 (Sized_relobj::relocate_sections): Likewise.
10203 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
10204 values for merge sections.
10205 * target-reloc.h (relocate_for_relocatable): Use constant
10206 invalid_address instead of -1U.
10208 2008-09-19 Cary Coutant <ccoutant@google.com>
10210 Add plugin functionality for link-time optimization (LTO).
10211 * configure.ac (plugins): Add --enable-plugins option.
10212 * configure: Regenerate.
10213 * config.in: Regenerate.
10214 * Makefile.am (LIBDL): New variable.
10215 (CCFILES): Add plugin.cc.
10216 (HFILES): Add plugin.h.
10217 (ldadd_var): Add LIBDL.
10218 * Makefile.in: Regenerate.
10220 * archive.cc: Include "plugin.h".
10221 (Archive::setup): Don't preread archive symbols when using a plugin.
10222 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
10223 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
10225 (Archive::include_member): Add symbols from plugin objects.
10226 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
10227 * descriptors.cc (Descriptors::open): Check for file descriptors
10228 abandoned by plugins.
10229 (Descriptors::claim_for_plugin): New function.
10230 * descriptors.h (Descriptors::claim_for_plugin): New function.
10231 (Open_descriptor::is_claimed): New field.
10232 (claim_descriptor_for_plugin): New function.
10233 * fileread.cc (File_read::claim_for_plugin): New function.
10234 * fileread.h (File_read::claim_for_plugin): New function.
10235 (File_read::descriptor): New function.
10236 * gold.cc: Include "plugin.h".
10237 (queue_initial_tasks): Add task to call plugin hooks for generating
10239 * main.cc: Include "plugin.h".
10240 (main): Load plugin libraries.
10241 * object.h (Pluginobj): Declare.
10242 (Object::pluginobj): New function.
10243 (Object::do_pluginobj): New function.
10244 (Object::set_target): New function.
10245 * options.cc: Include "plugin.h".
10246 (General_options::parse_plugin): New function.
10247 (General_options::General_options): Initialize plugins_ field.
10248 (General_options::add_plugin): New function.
10249 * options.h (Plugin_manager): Declare.
10250 (General_options): Add --plugin option.
10251 (General_options::has_plugins): New function.
10252 (General_options::plugins): New function.
10253 (General_options::add_plugin): New function.
10254 (General_options::plugins_): New field.
10255 * plugin.cc: New file.
10256 * plugin.h: New file.
10257 * readsyms.cc: Include "plugin.h".
10258 (Read_symbols::do_read_symbols): Check for archive before checking
10259 for ELF file. Call plugin hooks to claim files.
10260 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
10261 from a real object file; force override when processing replacement
10263 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
10264 (Symbol::init_base_object): Likewise.
10265 (Symbol::init_base_output_data): Likewise.
10266 (Symbol::init_base_output_segment): Likewise.
10267 (Symbol::init_base_constant): Likewise.
10268 (Symbol::init_base_undefined): Likewise.
10269 (Symbol::output_section): Assert that object is not a plugin.
10270 (Symbol_table::add_from_pluginobj): New function.
10271 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
10273 (Symbol_table::sized_write_globals): Likewise.
10274 (Symbol_table::add_from_pluginobj): Instantiate template.
10275 * symtab.h (Sized_pluginobj): Declare.
10276 (Symbol::in_real_elf): New function.
10277 (Symbol::set_in_real_elf): New function.
10278 (Symbol::in_real_elf_): New field.
10279 (Symbol_table::add_from_pluginobj): New function.
10281 * testsuite/Makefile.am (AM_CFLAGS): New variable.
10282 (LIBDL): New variable.
10283 (LDADD): Add LIBDL.
10284 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
10285 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
10286 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
10287 (MOSTLYCLEANFILES): Likewise.
10288 * testsuite/Makefile.in: Regenerate.
10289 * testsuite/plugin_test.c: New file.
10290 * testsuite/plugin_test_1.sh: New file.
10291 * testsuite/plugin_test_2.sh: New file.
10293 2008-09-16 Ian Lance Taylor <iant@google.com>
10295 * target-reloc.h (relocate_section): Check whether a symbol is
10296 defined by the ABI before reporting an undefined symbol error.
10297 * target.h (Target::is_defined_by_abi): Make parameter const.
10298 (Target::do_is_defined_by_abi): Likewise.
10299 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
10300 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
10301 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
10302 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
10303 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
10304 * testsuite/Makefile.in: Rebuild.
10306 * fileread.cc (make_view): Add casts to avoid warning.
10308 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
10310 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
10311 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10313 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
10315 * options.h (General_options::output_is_executable): New.
10316 (General_options::output_is_pie): New.
10317 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
10318 for shared libraries.
10319 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10321 2008-09-11 Chris Demetriou <cgd@google.com>
10323 * options.h (origin): New -z option.
10324 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
10325 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
10328 2008-09-05 Cary Coutant <ccoutant@google.com>
10330 * fileread.cc (File_read::make_view): Add check for attempt to map
10331 beyond end of file.
10333 2008-09-05 Cary Coutant <ccoutant@google.com>
10335 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
10336 explicit instantiations.
10338 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
10341 * options.cc (General_options::finalize): Allow undefined symbols
10342 in shlibs if linking -shared.
10345 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
10346 symbols as not needing a dynsym entry.
10348 2008-08-20 Craig Silverstein <csilvers@google.com>
10350 * fileread.cc (File_read::open): Do not lock the file unless it
10351 was successfully opened.
10353 2008-08-14 Cary Coutant <ccoutant@google.com>
10355 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
10356 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
10357 * testsuite/tls_test.cc (struct int128): 128-bit struct
10358 for testing TLS relocs with non-zero addend.
10359 (v12): New TLS variable.
10361 (t_last): Add check for v12.
10362 * testsuite/tls_test.h (t12): New function.
10363 * testsuite/tls_test_main.cc (thread_routine): Call new test.
10365 2008-08-13 Ian Lance Taylor <iant@google.com>
10367 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
10368 set tls_segment_ or relro_segment_.
10369 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
10371 * output.h (Output_section::clear_is_relro): New function.
10372 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
10373 sections specially even when output_data_ is empty.
10374 (Output_segment::maximum_alignment): When first section is relro,
10375 only force alignment for PT_LOAD segments.
10376 * script.cc (script_data_segment_align): New function.
10377 (script_data_segment_relro_end): New function.
10378 * script-c.h (script_data_segment_align): Declare.
10379 (script_data_segment_relro_end): Declare.
10380 * script-sections.h (class Script_sections): Declare
10381 data_segment_align and data_segment_relro_end. Add fields
10382 segment_align_index_ and saw_relro_end_.
10383 * script-sections.cc (class Sections_element): Add set_is_relro
10384 virtual function. Add new bool* parameter to place_orphan_here.
10385 Add get_output_section virtual function.
10386 (class Output_section_definition): Add set_is_relro. Add new
10387 bool* parameter to place_orphan_here. Add get_output_section.
10388 Add is_relro_ field.
10389 (Output_section_definition::Output_section_definition): Initialize
10390 evaluated_address_, evaluated_load_address, evaluated_addralign_,
10391 and is_relro_ fields.
10392 (Output_section_definition::place_orphan_here): Add is_relro
10394 (Output_section_definition::set_section_addresses): Set relro for
10396 (Output_section_definition::alternate_constraint): Likewise.
10397 (class Orphan_output_section): Add new bool* parameter to
10398 place_orphan_here. Add get_output_section.
10399 (Orphan_output_section::place_orphan_here): Add is_relro
10401 (Script_sections::Script_sections): Initialize
10402 data_segment_align_index_ and saw_relro_end_.
10403 (Script_sections::data_segment_align): New function.
10404 (Script_sections::data_segment_relro_end): New function.
10405 (Script_sections::place_orphan): Set or clear is_relro.
10406 (Script_sections::set_section_addresses): Force alignment of first
10408 * yyscript.y (exp): Call script_data_segment_align and
10409 script_data_segment_relro_end.
10410 * testsuite/relro_script_test.t: New file.
10411 * testsuite/relro_test.cc (using_script): Declare.
10412 (t1, t2): Test using_script.
10413 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
10414 (relro_script_test_SOURCES): Define.
10415 (relro_script_test_DEPENDENCIES): Define.
10416 (relro_script_test_LDFLAGS): Define.
10417 (relro_script_test_LDADD): Define.
10418 (relro_script_test.so): New target.
10419 * testsuite/Makefile.in: Rebuild.
10421 2008-08-06 Cary Coutant <ccoutant@google.com>
10423 * archive.cc (Archive::total_archives, Archive::total_members)
10424 (Archive::total_members_loaded): New variables.
10425 (Archive::setup): Add parameter. Add option to preread
10427 (Archive::read_armap): Add counter.
10428 (Archive::get_file_and_offset): New function.
10429 (Archive::get_elf_object_for_member): New function.
10430 (Archive::read_all_symbols): New function.
10431 (Archive::read_symbols): New function.
10432 (Archive::add_symbols): Add counters.
10433 (Archive::include_all_members): Use armap to find members if it's
10435 (Archive::include_member): Skip reading symbols if already read.
10436 Factored code into Archive::get_file_and_offset and
10437 Archive::get_elf_object_for_member. Changed call to
10438 Mapfile::report_include_archive_member.
10439 (Archive::print_stats): New function.
10440 * archive.h: Declare Object and Read_symbols_data classes.
10441 (Archive::Archive): Add initializers for new members.
10442 (Archive::setup): Add parameter.
10443 (Archive::print_stats): New function.
10444 (Archive::total_archives, Archive::total_members)
10445 (Archive::total_members_loaded): New variables.
10446 (Archive::get_file_and_offset): New function.
10447 (Archive::get_elf_object_for_member): New function.
10448 (Archive::read_all_symbols): New function.
10449 (Archive::read_symbols): New function.
10450 (Archive::Archive_member): New class.
10451 (Archive::members_): New member.
10452 (Archive::num_members_): New member.
10453 * main.cc: Include archive.h.
10454 (main): Call Archive::print_stats.
10455 * mapfile.cc (Mapfile::report_include_archive_member): Delete
10456 archive parameter; member_name is now the fully-decorated name.
10457 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
10458 * options.h: (General_options): Add --preread-archive-symbols option.
10459 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
10462 2008-08-04 Ian Lance Taylor <iant@google.com>
10464 * symtab.h (Symbol::use_plt_offset): New function.
10465 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
10466 * powerpc.cc (Relocate::relocate): Likewise.
10467 * sparc.cc (Relocate::relocate): Likewise.
10468 * x86_64.cc (Relocate::relocate): Likewise.
10469 * testsuite/weak_plt.sh: New test.
10470 * testsuite/weak_plt_main.cc: New test.
10471 * testsuite/weak_plt_shared.cc: New test.
10472 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
10473 (check_PROGRAMS): Add weak_plt.
10474 (check_DATA): Add weak_plt_shared.so.
10475 (weak_plt_main_pic.o, weak_plt): New targets.
10476 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
10477 * testsuite/Makefile.in: Rebuild.
10479 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
10481 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
10482 * testsuite/Makefile.in: Rebuild.
10484 2008-08-04 Alan Modra <amodra@bigpond.net.au>
10486 * Makefile.am (POTFILES.in): Set LC_ALL=C.
10487 * Makefile.in: Regenerate.
10488 * po/POTFILES.in: Regenerate.
10490 2008-07-29 Ian Lance Taylor <iant@google.com>
10492 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
10493 symbols before other symbols.
10494 * testsuite/script_test_2.cc (test_addr): Declare.
10495 (test_addr_alias): Declare.
10496 (main): Check that test_addr and test_addr_alias have the right
10498 * testsuite/script_test_2.t: Define test_addr_alias and
10501 2008-07-24 Ian Lance Taylor <iant@google.com>
10504 * descriptors.cc: New file.
10505 * descriptors.h: New file.
10506 * gold-threads.h (class Hold_optional_lock): New class.
10507 * fileread.cc: Include "descriptors.h".
10508 (File_read::~File_read): Release descriptor rather than closing
10510 (File_read::open) [file]: Call open_descriptor rather than open.
10511 Set is_descriptor_opened_.
10512 (File_read::open) [memory]: Assert that descriptor is not open.
10513 (File_read::reopen_descriptor): New function.
10514 (File_read::release): Release descriptor.
10515 (File_read::do_read): Make non-const. Reopen descriptor.
10516 (File_read::read): Make non-const.
10517 (File_read::make_view): Reopen descriptor.
10518 (File_read::do_readv): Likewise.
10519 * fileread.h (class File_read): Add is_descriptor_opened_ field.
10520 Update declarations.
10521 * layout.cc: Include "descriptors.h".
10522 (Layout::create_build_id): Use open_descriptor rather than open.
10523 * output.cc: Include "descriptors.h".
10524 (Output_file::open): Use open_descriptor rather than open.
10525 * archive.cc (Archive::const_iterator): Change Archive to be
10527 (Archive::begin, Archive::end): Make non-const.
10528 (Archive::count_members): Likewise.
10529 * archive.h (class Archive): Update declarations.
10530 * object.h (Object::read): Make non-const.
10531 * Makefile.am (CCFILES): Add descriptors.cc.
10532 (HFILES): Add descriptors.h.
10533 * Makefile.in: Rebuild.
10536 * gold.h: Always include <clocale>. Add Solaris workarounds
10537 following code in binutils/sysdep.h.
10540 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
10541 this->eh_frame_hdr_ is NULL before using it.
10543 * dynobj.cc (Versions::Versions): Update comment.
10545 * dynobj.cc (Versions::Versions): If there is an soname, use it as
10546 the base version name.
10548 * stringpool.cc (Stringpool_template::add_with_length): Set key to
10549 array size plus one.
10550 (Stringpool_template::set_string_offsets): Subtract one from key
10551 before using it as an array index.
10552 (Stringpool_template::get_offset_with_length): Likewise.
10553 (Stringpool_template::write_to_buffer): Likewise.
10554 * stringpool.h (Stringpool_template::get_offset_from_key):
10557 2008-07-23 Ian Lance Taylor <iant@google.com>
10560 * object.h (Merged_symbol_value::value): Do our best to handle a
10564 * script.cc (Version_script_info::get_versions): Don't add empty
10565 version tag to return value.
10566 (Version_script_info::get_symbol_version_helper): Change return
10567 type to bool. Add pversion parameter. Change all callers.
10568 (script_register_vers_node): Don't require a non-NULL tag.
10569 * script.h (class Version_script_info): Update declarations.
10570 (Version_script_info::get_symbol_version): Change return type to
10571 bool. Add version parameter. Change all callers.
10572 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
10573 handling. Handle an empty version from a version script.
10574 (Symbol_table::define_special_symbol): Likewise.
10575 * testsuite/ver_test_10.script: New file.
10576 * testsuite/ver_test_10.sh: New file.
10577 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
10578 (check_DATA): Add ver_test_10.syms.
10579 (ver_test_10.syms, ver_test_10.so): New target.
10580 * testsuite/Makefile.in: Rebuild.
10582 2008-07-23 Simon Baldwin <simonb@google.com>
10584 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
10585 to zero for undefined symbols from dynamic libraries.
10587 2008-07-23 Ian Lance Taylor <iant@google.com>
10589 * symtab.cc (Symbol_table::resolve): Remove version parameter.
10590 Change all callers.
10591 * symtab.h (class Symbol_table): Update declaration.
10592 * testsuite/ver_test_9.cc: New file.
10593 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
10594 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
10595 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
10596 (ver_test_9.so, ver_test_9.o): New targets.
10597 * testsuite/Makefile.in: Rebuild.
10599 2008-07-22 Ian Lance Taylor <iant@google.com>
10601 * options.h (class General_options): Define --check-sections.
10602 * layout.cc (Layout::set_segment_offsets): Handle
10605 * options.h (class General_options): Define -n/--nmagic and
10607 * options.cc (General_options::finalize): For -n/--nmagic or
10608 -N/--omagic, set -static.
10609 * layout.cc (Layout::attach_allocated_section_to_segment): If
10610 -N/--omagic, don't put read-only and read-write sections in
10611 different segments.
10612 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
10613 finding a read-only segment.
10614 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
10615 don't set the minimum segment alignment to the common page size,
10616 and don't set the file offset to the address modulo the page size.
10617 * script-sections.cc (Script_sections::create_segments): If
10618 -n/--omagic, don't put read-only and read-write sections in
10619 different segments.
10621 * cref.cc: New file.
10622 * cref.h: New file.
10623 * options.h (class General_options): Add --print-symbol-counts.
10624 * main.cc (main): Issue defined symbol report if requested.
10625 * archive.cc (Archive::interpret_header): Make into a const member
10627 (Archive::add_symbols): Call Input_objects::archive_start and
10629 (Archive::const_iterator): Define new class.
10630 (Archive::begin, Archive::end): New functions.
10631 (Archive::include_all_members): Rewrite to use iterator.
10632 (Archive::count_members): New function.
10633 * archive.h (class Archive): Update declarations.
10634 (Archive::filename): New function.
10635 * object.cc: Include "cref.h".
10636 (Sized_relobj::Sized_relobj): Initialize defined_count_.
10637 (Sized_relobj::do_get_global_symbol_counts): New function.
10638 (Input_objects::add_object): Add object to cross-referencer.
10639 (Input_objects::archive_start): New function.
10640 (Input_objects::archive_stop): New function.
10641 (Input_objects::print_symbol_counts): New function.
10642 * object.h: Declare Cref and Archive.
10643 (Object::get_global_symbol_counts): New function.
10644 (Object::do_get_global_symbol_counts): New pure virtual function.
10645 (class Sized_relobj): Add defined_count_ field. Update
10647 (class Input_objects): Add cref_ field. Update constructor.
10648 Update declarations.
10649 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
10651 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
10653 (Sized_dynobj::do_get_global_symbol_counts): New function.
10654 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
10655 defined_count_. Update declarations. Define Symbols typedef.
10656 * symtab.cc (Symbol_table::add_from_relobj): Add defined
10657 parameter. Change all callers.
10658 (Symbol_table::add_from_dynobj): Add sympointers and defined
10659 parameters. Change all callers.
10660 * symtab.h (class Symbol_table): Update declarations.
10661 * Makefile.am (CCFILES): Add cref.cc.
10662 (HFILES): Add cref.h.
10663 * Makefile.in: Rebuild.
10665 2008-07-22 Simon Baldwin <simonb@google.com>
10667 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
10668 to zero when writing undefined symbols.
10670 2008-07-22 Ian Lance Taylor <iant@google.com>
10672 * output.cc (Output_section::add_input_section): Don't try to
10673 merge empty merge sections.
10675 2008-07-21 Craig Silverstein <csilvers@google.com>
10677 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10678 Include symbol version in error message.
10680 2008-07-20 Chris Demetriou <cgd@google.com>
10682 * configure.ac (gold_cv_c_random_seed): New configured variable.
10683 (RANDOM_SEED_CFLAGS): New substituted variable.
10684 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
10685 * configure: Rebuild.
10686 * Makefile.in: Likewise.
10687 * testsuite/Makefile.in: Likewise.
10689 2008-07-18 Ian Lance Taylor <iant@google.com>
10691 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
10692 where we see NAME/NULL and NAME/VERSION as separate symbols.
10693 * testsuite/ver_test_main.cc (main): Call t4.
10694 (t4, t4_2a): Define.
10695 * testsuite/ver_test_2.cc (t4_2): Define.
10696 * testsuite/ver_test_2.script: Put t4_2a in VER2.
10697 * testsuite/ver_test_4.cc (t4_2a): Define.
10698 * testsuite/ver_test_4.script: Put t4_2a in VER2.
10699 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
10701 2008-07-17 Ian Lance Taylor <iant@google.com>
10703 * dynobj.cc (Versions::add_def): If we give an error about a
10704 missing version, go ahead and create the version anyhow.
10706 2008-07-10 Ian Lance Taylor <iant@google.com>
10708 Handle output sections with more than 0x7fffffff bytes.
10709 * object.h (class Relobj): Change map_to_output_ to
10710 output_sections_, and just keep a section pointer. Change all
10711 uses. Move comdat group support to Sized_relobj.
10712 (Relobj::is_section_specially_mapped): Remove.
10713 (Relobj::output_section): Remove poff parameter. Change all
10715 (Relobj::output_section_offset): New function.
10716 (Relobj::set_section_offset): Rewrite.
10717 (Relobj::map_to_output): Remove.
10718 (Relobj::output_sections): New function.
10719 (Relobj::do_output_section_offset): New pure virtual function.
10720 (Relobj::do_set_section_offset): Likewise.
10721 (class Sized_relobj): Add section_offsets_ field. Add comdat
10722 group support from Relobj. Update declarations.
10723 (Sized_relobj::get_output_section_offset): New function.
10724 (Sized_relobj::do_output_section_offset): New function.
10725 (Sized_relobj::do_set_section_offset): New function.
10726 * object.cc (Relobj::output_section_address): Remove.
10727 (Sized_relobj::Sized_relobj): Initialize new fields.
10728 (Sized_relobj::include_section_group): Cast find_kept_object to
10730 (Sized_relobj::include_linkonce_section): Likewise.
10731 (Sized_relobj::do_layout): Use separate arrays for output section
10733 (Sized_relobj::do_count_local_symbols): Change map_to_output to
10735 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
10736 output_sections and section_offsets.
10737 (Sized_relobj::write_local_symbols): Likewise.
10738 (map_to_kept_section): Compute output address directly.
10739 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
10740 output_sections and section_offsets.
10741 (Sized_relobj::write_sections): Likewise.
10742 (Sized_relobj::relocate_sections): Likewise.
10743 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
10744 * output.h (class Output_reloc): Update declarations. Change
10745 u2_.relobj to Sized_relobj*.
10746 (class Output_data_reloc): Change add functions to use
10748 * output.cc (Output_reloc::Output_reloc): Change relobj to
10750 (Output_reloc::local_section_offset): Change return type to
10751 Elf_Addr. Use get_output_section_offset.
10752 (Output_reloc::get_address): Likewise.
10753 (Output_section::is_input_address_mapped): Don't call
10754 is_section_specially_mapped.
10755 (Output_section::output_offset): Likewise.
10756 (Output_section::output_address): Likewise.
10757 (Output_section::starting_output_address): Likewise.
10758 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
10759 parameter to Sized_relobj*.
10760 (Copy_relocs::need_copy_reloc): Likewise.
10761 (Copy_relocs::save): Likewise.
10762 * copy-relocs.h (class Copy_relocs): Update declarations.
10763 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
10764 Sized_relobj*. Change relobj_ field to Sized_relobj*.
10765 * target-reloc.h (relocate_for_relocatable): Change
10766 offset_in_output_section type to Elf_Addr. Change code that uses
10768 * layout.cc (Layout::layout): Always set *off.
10769 * mapfile.cc (Mapfile::print_input_section): Use
10770 output_section_offset.
10771 * i386.cc (Target_i386::copy_reloc): Change object parameter to
10773 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
10774 * sparc.cc (Target_sparc::copy_reloc): Likewise.
10775 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
10777 2008-07-03 Ian Lance Taylor <iant@google.com>
10779 * layout.cc (Layout::include_section): Do not discard unrecognized
10780 SHT_STRTAB sections.
10782 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
10784 * script.cc (Lex::can_continue_name): Make '?' allowable in
10785 version-script names.
10786 * testsuite/version_script.map: Change glob pattern to use '?'
10788 2008-06-30 Manish Singh <yosh@gimp.org>
10791 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
10794 2008-06-30 Ian Lance Taylor <iant@google.com>
10798 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
10799 versions]: Don't try to read the value in the contents, since we
10800 don't use it. Use the template endianness when writing.
10802 2008-06-25 Cary Coutant <ccoutant@google.com>
10804 * fileread.cc (File_read::make_view): Assert on zero-length view.
10805 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
10806 symbol table when there are no symbols to read.
10808 2008-06-23 Craig Silverstein <csilvers@google.com>
10810 * version.cc (version_string): Bump to 1.7
10812 2008-06-18 Craig Silverstein <csilvers@google.com>
10814 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
10815 constant 0xFFFF to type Valtype.
10816 (Powerpc_relocate_functions::rel16_ha): Likewise.
10818 2008-06-17 Ian Lance Taylor <iant@google.com>
10820 * output.h (Output_section::Input_section): Initialize p2align_ to
10821 zero for Output_section_data constructors.
10822 (Output_section::Input_section::addralign): If not an input
10823 section, return the alignment of the Output_section_data.
10824 * testsuite/copy_test.cc: New file.
10825 * testsuite/copy_test_1.cc: New file.
10826 * testsuite/copy_test_2.cc: New file.
10827 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
10828 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
10829 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
10830 (copy_test_1_pic.o, copy_test_1.so): New targets.
10831 (copy_test_2_pic.o, copy_test_2.so): New targets.
10832 * testsuite/Makefile.in: Rebuild.
10834 * script-sections.cc (Script_sections::place_orphan): Initialize
10835 local variable exact.
10837 2008-06-13 David Edelsohn <edelsohn@gnu.org>
10839 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
10841 2008-06-12 David Edelsohn <edelsohn@gnu.org>
10842 David S. Miller <davem@davemloft.net>
10844 * powerpc.cc: New file.
10845 * Makefile.am (TARGETSOURCES): Add powerpc.cc
10846 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
10847 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
10848 * Makefile.in: Rebuild.
10850 2008-06-09 Ian Lance Taylor <iant@google.com>
10852 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
10854 (throwing, orig_terminate): New static variables.
10855 (terminate_handler): New static function.
10856 (t2): Set terminate handler.
10858 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
10861 * binary.cc (Binary_to_elf::sized_convert): Fix .data
10864 2008-05-30 Cary Coutant <ccoutant@google.com>
10866 * archive.cc (Archive::include_all_members) Correct to step
10867 over symbol table and extended name table in thin archives.
10869 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
10872 * target-reloc.h (relocate_for_relocatable): Fix new_offset
10875 2008-05-28 Caleb Howe <cshowe@google.com>
10877 * reduced_debug_output.cc: New file.
10878 * reduced_debug_output.h: New file.
10879 * options.h (class General_options): Add --strip-debug-non-line.
10880 * options.cc (General_options::finalize): Add strip_debug_non_line
10881 to the strip heirarchy.
10882 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
10884 * layout.cc: Include "reduced_debug_output.h".
10885 (Layout::Layout): Initialize new fields.
10886 (line_only_debug_sections): New static array.
10887 (is_lines_only_debug_sections): New static inline function.
10888 (Layout::include_section): Handle --strip-debug-non-line.
10889 (Layout::make_output_section): If --strip-debug-non-line, build
10890 new output sections for .debug_abbrev and .debug_info.
10891 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
10892 gold. Warn about possible overflow.
10893 (read_signed_LEB_128): Likewise.
10894 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
10895 (read_signed_LEB_128): Declare.
10896 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
10897 (HFILES): Add reduced_debug_output.h.
10898 * Makefile.in: Rebuild.
10900 2008-05-21 Ian Lance Taylor <iant@google.com>
10902 * mapfile.cc: New file.
10903 * mapfile.h: New file.
10904 * options.h (class General_options): Add -M/--print-map and -Map.
10905 * options.cc (General_options::finalize): Make -M equivalent to
10907 * main.cc: Include <cstdio> and "mapfile.h".
10908 (main): Open mapfile if requested.
10909 * gold.cc (class Middle_runner): Add mapfile_ field. Update
10910 constructor. Change caller.
10911 (queue_initial_tasks): Add mapfile parameter. Change caller.
10912 (queue_middle_tasks): Likewise.
10913 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
10915 * archive.cc: Include "mapfile.h".
10916 (Archive::add_symbols): Add mapfile parameter. Change all
10917 callers. Pass mapfile, symbol, and reason to include_member.
10918 (Archive::include_all_members): Add mapfile parameter. Change all
10920 (Archive::include_member): Add mapfile, sym, and why parameters.
10921 Change all callers. Report inclusion to map file.
10922 * archive.h: Include "fileread.h".
10923 (class Archive): Update declarations.
10924 (Archive::file): New const method.
10925 (class Add_archive_symbols): Add mapfile_ field. Update
10926 constructor. Change all callers.
10927 * readsyms.h (class Read_symbols): Likewise.
10928 (class Finish_group): Likewise.
10929 (class Read_script): Likewise.
10930 * common.cc: Include "mapfile.h".
10931 (Symbol_table::allocate_commons): Add mapfile parameter. Change
10933 (Symbol_table::do_allocate_commons): Likewise.
10934 (Symbol_table::do_allocate_commons_list): Likewise. Report common
10935 symbol allocation to mapfile.
10936 * common.h (class Allocate_commons_task): Add mapfile_ field.
10937 Update constructor. Change all callers.
10938 * symtab.h (class Symbol_table): Update declarations.
10939 * layout.cc: Include "mapfile.h".
10940 (Layout_task_runner::run): Print information to mapfile.
10941 (Layout::create_gold_note): Change Output_data_fixed_space to
10942 Output_data_zero_fill.
10943 (Layout::create_build_id): Likewise.
10944 (Layout::print_to_mapfile): New function.
10945 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
10946 constructor. Change caller.
10947 (class Layout): Declare print_to_mapfile.
10948 * output.cc (Output_section::Input_section::print_to_mapfile): New
10950 (Output_section::add_input_section): If producing a map, always
10951 add to input_sections_ list.
10952 (Output_section::do_print_to_mapfile): New function.
10953 (Output_segment::print_sections_to_mapfile): New function.
10954 (Output_segment::print_section_list_to_mapfile): New function.
10955 * output.h: Include "mapfile.h".
10956 (Output_data::print_to_mapfile): New function.
10957 (Output_data::do_print_to_mapfile): New virtual function.
10958 (Output_segment_headers::do_print_to_mapfile): New function.
10959 (Output_file_header::do_print_to_mapfile): New function.
10960 (Output_data_const::do_print_to_mapfile): New function.
10961 (class Output_data_const_buffer): Add map_name_ field. Update
10962 constructor. Change all callers. Add do_print_to_mapfile
10964 (class Output_data_fixed_space): Likewise.
10965 (class Output_data_space): Likewise.
10966 (class Output_data_zero_fill): New class.
10967 (Output_data_strtab::do_print_to_mapfile): New function.
10968 (Output_data_reloc_base::do_print_to_mapfile): New function.
10969 (Output_relocatable_relocs::do_print_to_mapfile): New function.
10970 (Output_data_group::do_print_to_mapfile): New function.
10971 (Output_data_got::do_print_to_mapfile): New function.
10972 (Output_data_dynamic::do_print_to_mapfile): New function.
10973 (Output_symtab_xindex::do_print_to_mapfile): New function.
10974 (class Output_section): Declare do_print_to_mapflie. Declare
10975 print_to_mapfile in Input_section.
10976 (class Output_segment): Declare new functions.
10977 * object.h (Sized_relobj::symbol_count): New function.
10978 * script-sections.cc
10979 (Output_section_element_dot_assignment::set_section_addresses):
10980 Change Output_data_fixed_space to Output_data_zero_fill.
10981 (Output_data_expression::do_print_to_mapfile): New function.
10982 * script.cc (read_input_script): Add mapfile parameter. Change
10984 * script.h (read_input_script): Update declaration.
10985 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
10986 (Eh_frame::do_print_to_mapfile): New function.
10987 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
10988 (Output_merge_string::do_print_to_mapfile): New function.
10989 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
10991 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
10993 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
10995 * Makefile.am (CCFILES): Add mapfile.cc.
10996 (HFILES): Add mapfile.h.
10997 * Makefile.in: Rebuild.
10999 2008-05-19 Ian Lance Taylor <iant@google.com>
11001 * options.h (class General_options): Add -z relro.
11002 * layout.cc (Layout::Layout): Initialize relro_segment_.
11003 (Layout::add_output_section_data): Return the output section.
11004 (Layout::make_output_section): Rcognize relro sections and mark
11005 them appropriately.
11006 (Layout::attach_allocated_section_to_segment): Put relro sections
11007 in a PT_GNU_RELRO segment.
11008 (Layout::create_initial_dynamic_sections): Mark the .dynamic
11010 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11012 (Layout::linkonce_mapping): Map d.rel.ro.local to
11013 .data.rel.ro.local.
11014 (Layout::output_section_name): Us .data.rel.ro.local for any
11015 section which begins with that.
11016 * layout.h (class Layout): Update add_output_section_data
11017 declaration. Add relro_segment_ field.
11018 * output.cc (Output_section::Output_section): Initialize is_relro_
11019 and is_relro_local_ fields.
11020 (Output_segment::add_output_section): Group relro sections.
11021 (Output_segment::is_first_section_relro): New function.
11022 (Output_segment::maximum_alignment): If there is a relro section,
11023 align the segment to the common page size.
11024 (Output_segment::set_section_addresses): Track whether we are
11025 looking at relro sections. If the last section is a relro
11026 section, align to the common page size.
11027 (Output_segment::set_section_list_addresses): Add in_relro
11028 parameter. Change all callers. Align to the page size when
11029 moving from relro to non-relro section.
11030 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
11032 * output.h (class Output_section): Add is_relro_ and
11033 is_relro_local_ fields.
11034 (Output_section::is_relro): New function.
11035 (Output_section::set_is_relro): New function.
11036 (Output_section::is_relro_local): New function.
11037 (Output_section::set_is_relro_local): New function.
11038 (class Output_segment): Update declarations.
11039 * i386.cc (Target_i386::got_section): Mark .got section as relro.
11040 * sparc.cc (Target_sparc::got_section): Likewise.
11041 * x86_64.cc (Target_x86_64::got_section): Likewise.
11042 * testsuite/relro_test_main.cc: New file.
11043 * testsuite/relro_test.cc: New file.
11044 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11045 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11046 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11047 (relro_test.so, relro_test_pic.o): New targets.
11048 * testsuite/Makefile.in: Rebuild.
11050 2008-05-16 Ian Lance Taylor <iant@google.com>
11052 * output.cc (Output_segment::add_output_section): Remove front
11054 * output.h (class Output_segment): Remove
11055 add_initial_output_section and overloaded add_output_section.
11056 Update declaration of remaining add_output_section.
11057 * layout.cc (Layout::create_interp): Call add_output_section
11058 rather than add_initial_output_section.
11059 (Layout::finish_dynamic_section): Likewise.
11061 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
11062 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
11063 know the dynamic type.
11064 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
11065 field. Initialize it in constructor.
11066 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
11067 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
11068 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
11071 * output.cc (Output_reloc::get_address): Change return type to
11073 * output.h (class Output_reloc): Update get_address declaration.
11074 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
11075 for section addresses.
11077 2008-05-09 Ian Lance Taylor <iant@google.com>
11080 * gold.cc (gold_nomem): Use return value of write.
11082 2008-05-08 Ian Lance Taylor <iant@google.com>
11084 * symtab.c (Symbol::init_base_output_data): Add version
11085 parameter. Change all callers.
11086 (Symbol::init_base_output_segment): Likewise.
11087 (Symbol::init_base_constant): Likewise.
11088 (Symbol::init_base_undefined): Likewise.
11089 (Sized_symbol::init_output_data): Likewise.
11090 (Sized_symbol::init_output_segment): Likewise.
11091 (Sized_symbol::init_constant): Likewise.
11092 (Sized_symbol::init_undefined): Likewise.
11093 (Symbol_table::do_define_in_output_data): If the new symbol has a
11094 version, mark it as the default.
11095 (Symbol_table::do_define_in_output_segment): Likewise.
11096 (Symbol_table::do_define_as_constant): Likewise.
11097 * symtab.h (class Symbol): Update declarations.
11098 (class Sized_symbol): Likewise.
11099 * resolve.cc (Symbol::override_version): New function.
11100 (Symbol::override_base): Call override_version.
11101 (Symbol::override_base_with_special): Likewise.
11102 * testsuite/ver_script_8.script: New file.
11103 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
11104 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
11105 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
11106 (ver_test_8_1.so, ver_test_8_2.so): New targets.
11108 2008-05-06 Ian Lance Taylor <iant@google.com>
11111 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
11113 (class General_options): Remove existing --undefined, and add
11114 --no-undefined instead. Add new --undefined as synonym for -u.
11115 * archive.cc (Archive::add_symbols): Check whether symbol was
11117 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
11118 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
11119 all uses. Add IS_UNDEFINED. Update declarations to split
11120 different versions of init_base. Declare init_base_undefined.
11121 (Symbol::is_defined): Handle IS_UNDEFINED.
11122 (Symbol::is_undefined): Likewise.
11123 (Symbol::is_weak_undefined): Call is_undefined.
11124 (Symbol::is_absolute): Handle IS_CONSTANT.
11125 (class Sized_symbol): Update declarations to split different
11126 versions of init. Declare init_undefined.
11127 (class Symbol_table): Declare new functions.
11128 * symtab.cc (Symbol::init_base_object): Rename from init_base.
11129 Change all callers.
11130 (Symbol::init_base_output_data): Likewise.
11131 (Symbol::init_base_output_segment): Likewise.
11132 (Symbol::init_base_constant): Likewise.
11133 (Symbol::init_base_undefined): New function.
11134 (Sized_symbol::init_object): Rename from init. Change all
11136 (Sized_symbol::init_output_data): Likewise.
11137 (Sized_symbol::init_output_segment): Likewise.
11138 (Sized_symbol::init_constant): Likewise.
11139 (Sized_symbol::init_undefined): New function.
11140 (Symbol_table::add_undefined_symbols_from_command_line): New
11142 (Symbol_table::do_add_undefined_symbols_from_command_line): New
11144 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
11145 (Symbol::output_section): Likewise.
11146 (Symbol::set_output_section): Likewise.
11147 (Symbol_table::sized_finalize_symbol): Likewise.
11148 (Symbol_table::sized_write_globals): Likewise.
11149 * resolve.cc (Symbol_table::should_override): Likewise.
11150 (Symbol::override_base_with_special): Likewise.
11152 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
11153 symbol, change it to have default visibility.
11154 * testsuite/protected_1.cc: New file.
11155 * testsuite/protected_2.cc: New file.
11156 * testsuite/protected_3.cc: New file.
11157 * testsuite/protected_main_1.cc: New file.
11158 * testsuite/protected_main_2.cc: New file.
11159 * testsuite/protected_main_3.cc: New file.
11160 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
11161 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
11162 (protected_1_LDFLAGS, protected_1_LDADD): Define.
11163 (protected_1.so): New target.
11164 (protected_1_pic.o, protected_2_pic.o): New targets.
11165 (protected_3_pic.o): New target.
11166 (check_PROGRAMS): Add protected_2.
11167 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
11168 (protected_2_LDFLAGS, protected_2_LDADD): Define.
11169 * testsuite/Makefile.in: Rebuild.
11171 * options.h (DEFINE_var): Add set_user_set_##varname__.
11172 (DEFINE_bool_alias): New macro.
11173 (class General_options): Define -Bstatic using DEFINE_bool_alias
11174 rather than DEFINE_special. Add --undefined as an alias for -z
11176 * options.cc (General_options::parse_Bstatic): Remove.
11178 * options.h (class General_options): Add --fatal-warnings.
11179 * main.cc (main): Implement --fatal-warnings.
11180 * errors.h (Errors::warning_count): New function.
11182 * options.h (class General_options): Add -Bsymbolic-functions.
11183 * symtab.h (Symbol::is_preemptible): Check for
11184 -Bsymbolic-functions.
11186 2008-05-05 Ian Lance Taylor <iant@google.com>
11188 * options.h (DEFINE_bool): For DASH_Z, create the negative option
11189 as noVARNAME rather than no-VARNAME.
11190 (class General_options): Add option -z combreloc.
11191 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
11193 (Output_reloc::sort_before) [SHT_REL]: New function.
11194 (Output_reloc::sort_before) [SHT_RELA]: New function.
11195 (class Output_data_reloc_base): Add sort_relocs_ field. Define
11196 Sort_relocs_comparison.
11197 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
11198 parameter. Change all callers.
11199 (Output_data_reloc::Output_data_reloc) [both versions]: Add
11200 sort_relocs parameter. Change all callers.
11201 * output.cc (Output_reloc::get_address): New function, broken out
11203 (Output_reloc::write_rel): Call it.
11204 (Output_reloc::compare): New function.
11205 (Output_data_reloc_base::do_write): Optionally sort relocs.
11207 * configure.ac: If targ_extra_obj is set, link it in.
11208 * configure.tgt: Initialize all variables.
11209 (x86_64*): Set targ_extra_obj and targ_extra_size.
11210 * configure: Rebuild.
11212 * object.cc (Sized_relobj::include_section_group): Adjust section
11213 indexes read from group data. Build vector to pass to
11215 * layout.cc (Layout::layout_group): Add flags and shndxes
11216 parameters. Remove contents parameter. Change caller. Update
11217 explicit instantiations.
11218 * layout.h (class Layout): Update layout_group declaration.
11219 * output.cc (Output_data_group::Output_data_group): Add flags and
11220 input_shndxes parameters. Remove contents parameter. Change
11222 (Output_data_group::do_write): Change input_sections_ to
11224 * output.h (class Output_data_group): Update constructor
11225 declaration. Rename input_sections_ to input_shndxes_.
11226 * testsuite/many_sections_test.cc: Add template.
11228 2008-04-30 Cary Coutant <ccoutant@google.com>
11230 * target-reloc.h (relocate_section): Fix dead-pointer bug.
11232 * layout.cc (Layout::include_section): Refactored check for debug
11234 (Layout::add_comdat): Add new parameters. Change type
11235 of signature parameter. Add object and shndx to signatures table.
11236 (Layout::find_kept_object): New function.
11237 * layout.h: Include <cstring>.
11238 (Layout::is_debug_info_section): New function.
11239 (Layout::add_comdat): Add new parameters.
11240 (Layout::find_kept_object): New function.
11241 (Layout::Kept_section): New struct.
11242 (Layout::Signatures): Change type of map range.
11243 * object.cc (Relobj::output_section_address): New function.
11244 (Sized_relobj::include_section_group): Add new parameters. Change
11245 calls to Layout::add_comdat. Change to build table of kept comdat
11246 groups and table mapping discarded sections to kept sections.
11247 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
11248 (Sized_relobj::do_layout): Change calls to include_section_group and
11249 include_linkonce_section.
11250 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
11251 value to zero when section is discarded.
11252 (Sized_relobj::map_to_kept_section): New function.
11253 * object.h (Relobj::output_section_address): New function.
11254 (Relobj::Comdat_group): New type.
11255 (Relobj::find_comdat_group): New function.
11256 (Relobj::Comdat_group_table): New type.
11257 (Relobj::Kept_comdat_section): New type.
11258 (Relobj::Kept_comdat_section_table): New type.
11259 (Relobj::add_comdat_group): New function.
11260 (Relobj::set_kept_comdat_section): New function.
11261 (Relobj::get_kept_comdat_section): New function.
11262 (Relobj::comdat_groups_): New field.
11263 (Relobj::kept_comdat_sections_): New field.
11264 (Symbol_value::input_value): Update comment.
11265 (Sized_relobj::map_to_kept_section) New function.
11266 (Sized_relobj::include_linkonce_section): Add new parameter.
11267 * target-reloc.h (Comdat_behavior): New type.
11268 (get_comdat_behavior): New function.
11269 (relocate_section): Add code to map a discarded section to the
11270 corresponding kept section when applying a relocation.
11272 2008-04-30 Craig Silverstein <csilvers@google.com>
11274 * dwarf_reader.cc (next_generation_count): New static var.
11275 (Addr2line_cache_entry): New struct.
11276 (addr2line_cache): New static var.
11277 (Dwarf_line_info::one_addr2line): Added caching.
11278 (Dwarf_line_info::clear_addr2line_cache): New function.
11279 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
11280 cache-size parameter.
11281 (Dwarf_line_info::one_addr2line_cache): New function.
11282 * symtab.cc (Symbol_table::detect_odr_violations): Pass
11283 new cache-size argument to one_addr2line(), and clear cache.
11285 2008-04-28 Cary Coutant <ccoutant@google.com>
11287 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
11288 R_386_PC8 relocations.
11290 2008-04-23 Ian Lance Taylor <iant@google.com>
11292 * object.cc (Sized_relobj::include_section_group): Check for
11293 invalid section group.
11295 * object.cc (make_elf_object): Correct test for 64-bit ELF file
11298 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
11299 than read for file header.
11300 * archive.cc (Archive::include_member): Likewise.
11302 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
11304 * aclocal.m4: Regenerate.
11305 * configure: Regenerate.
11307 2008-04-19 Ian Lance Taylor <iant@google.com>
11309 * version.cc (version_string): Bump to 1.6.
11311 * testsuite/Makefile.am (many_sections_r_test): New target.
11312 (many_sections_r_test_SOURCES): Remove.
11313 (many_sections_r_test_DEPENDENCIES): Remove.
11314 (many_sections_r_test_LDFLAGS): Remove.
11315 (many_sections_r_test_LDADD): Remove.
11317 * object.cc (Sized_relobj::do_add_symbols): Always pass
11318 local_symbol_count_ to add_from_relobj.
11320 * testsuite/Makefile.am (many_sections_check.h): Only check one in
11321 every thousand variables.
11322 * testsuite/Makefile.in: Rebuild.
11324 * object.cc (Xindex::initialize_symtab_xindex): New function.
11325 (Xindex::read_symtab_xindex): New function.
11326 (Xindex::sym_xindex_to_shndx): New function.
11327 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
11329 (Sized_relobj::do_initialize_xindex): New function.
11330 (Sized_relobj::do_read_symbols): Adjust section links.
11331 (Sized_relobj::symbol_section_and_value): Add is_ordinary
11332 parameter. Change all callers.
11333 (Sized_relobj::include_section_group): Adjust section links and
11334 symbol section indexes.
11335 (Sized_relobj::do_layout): Adjust section links.
11336 (Sized_relobj::do_count_local_symbols): Adjust section links and
11337 symbol section indexes.
11338 (Sized_relobj::do_finalize_local_symbols): Distinguish between
11339 ordinary and special symbols.
11340 (Sized_relobj::write_local_symbols): Add symtab_xindex and
11341 dynsym_xindex parameters. Change all callers. Adjust section
11342 links. Use SHN_XINDEX when needed.
11343 (Sized_relobj::get_symbol_location_info): Adjust section links.
11344 Don't get fooled by special symbols.
11345 * object.h (class Xindex): Define.
11346 (class Object): Add xindex_ parameter. Declare virtual functoin
11347 do_initialize_xindex.
11348 (Object::adjust_sym_shndx): New function.
11349 (Object::set_xindex): New protected function.
11350 (class Symbol_value): Add is_ordinary_shndx_ field.
11351 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
11352 (Symbol_value::value): Assert ordinary section.
11353 (Symbol_value::initialize_input_to_output_map): Likewise.
11354 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
11355 Change all callers.
11356 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
11358 (class Sized_relobj): Update declarations.
11359 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
11360 parameter. Change all callers.
11361 (Sized_relobj::adjust_shndx): New function.
11362 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
11364 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
11365 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
11366 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
11367 (Sized_dynobj::read_dynsym_section): Adjust section links.
11368 (Sized_dynobj::read_dynamic): Likewise.
11369 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
11371 (Sized_dynobj::do_initialize_xindex): New function.
11372 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
11373 do_initialize_xindex.
11374 (Sized_dynobj::adjust_shndx): New function.
11375 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
11376 dynsym_xindex_ fields.
11377 (Layout::finalize): Add a call to set_section_indexes before
11378 creating the symtab sections.
11379 (Layout::set_section_indexes): Don't do anything if the section
11380 already has a section index.
11381 (Layout::create_symtab_sections): Add shnum parameter. Change
11382 caller. Create .symtab_shndx section if needed.
11383 (Layout::create_shdrs): Add shstrtab_section parameter. Change
11385 (Layout::allocated_output_section_count): New function.
11386 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
11388 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
11389 fields. Update declarations.
11390 (Layout::symtab_xindex): New function.
11391 (Layout::dynsym_xindex): New function.
11392 (class Write_symbols_task): Add layout_ field.
11393 (Write_symbols_task::Write_symbols_task): Add layout parameter.
11395 * output.cc (Output_section_headers::Output_section_headers): Add
11396 shstrtab_section parameter. Change all callers.
11397 (Output_section_headers::do_sized_write): Store overflow values
11398 for section count and section string table section index in
11399 section header zero.
11400 (Output_file_header::do_sized_write): Check for overflow of
11401 section count and section string table section index.
11402 (Output_symtab_xindex::do_write): New function.
11403 (Output_symtab_xindex::endian_do_write): New function.
11404 * output.h (class Output_section_headers): Add shstrtab_section_.
11405 Update declarations.
11406 (class Output_symtab_xindex): Define.
11407 (Output_section::has_out_shndx): New function.
11408 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
11410 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
11411 Change all callers.
11412 (Sized_symbol::init): Likewise.
11413 (Symbol::output_section): Check for ordinary symbol.
11414 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
11415 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
11417 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
11418 Change all callers. Simplify handling of symbols from sections
11419 not included in the link.
11420 (Symbol_table::add_from_dynobj): Handle ordinary symbol
11422 (Weak_alias_sorter::operator()): Assert that symbols are
11424 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
11426 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
11427 parameters. Change all callers.
11428 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
11429 symbol distinction. Use SHN_XINDEX when needed.
11430 (Symbol_table::write_section_symbol): Add symtab_xindex
11431 parameter. Change all callers.
11432 (Symbol_table::sized_write_section_symbol): Likewise. Use
11433 SHN_XINDEX when needed.
11434 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
11436 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
11437 (Symbol::is_defined): Check is_ordinary.
11438 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
11439 (Symbol::is_absolute, Symbol::is_common): Likewise.
11440 (class Sized_symbol): Update declarations.
11441 (class Symbol_table): Update declarations.
11442 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
11443 parameters. Change all callers.
11444 (Sized_symbol::override): Likewise.
11445 (Symbol_table::override): Likewise.
11446 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
11447 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
11448 is_ordinary, and orig_st_shndx parameters. Change all callers.
11449 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
11450 to be in an ordinary section.
11451 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
11452 object and is_ordinary parameters. Change all callers.
11453 (Sized_dwarf_line_info::read_relocs): Add object parameter.
11454 Change all callers. Don't add undefined or non-ordinary symbols
11456 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
11457 Change all callers.
11458 * dwarf_reader.h (class Sized_dwarf_line_info): Update
11460 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
11461 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
11462 (Sized_relobj::relocate_sections): Likewise.
11463 * target-reloc.h (scan_relocs): Adjust section symbol index.
11464 (scan_relocatable_relocs): Likewise.
11465 * i386.cc (Scan::local): Check for ordinary symbols.
11466 * sparc.cc (Scan::local): Likewise.
11467 * x86_64.cc (Scan::local): Likewise.
11468 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
11469 to symbol_section_and_value.
11470 * testsuite/many_sections_test.cc: New file.
11471 * testsuite/Makefile.am (BUILT_SOURCES): Define.
11472 (check_PROGRAMS): Add many_sections_test.
11473 (many_sections_test_SOURCES): Define.
11474 (many_sections_test_DEPENDENCIES): Define.
11475 (many_sections_test_LDFLAGS): Define.
11476 (BUILT_SOURCES): Add many_sections_define.h.
11477 (many_sections_define.h): New target.
11478 (BUILT_SOURCES): Add many_sections_check.h.
11479 (many_sections_check.h): New target.
11480 (check_PROGRAMS): Add many_sections_r_test.
11481 (many_sections_r_test_SOURCES): Define.
11482 (many_sections_r_test_DEPENDENCIES): Define.
11483 (many_sections_r_test_LDFLAGS): Define.
11484 (many_sections_r_test_LDADD): Define.
11485 (many_sections_r_test.o): New target.
11486 * testsuite/Makefile.in: Rebuild.
11488 2008-04-17 Cary Coutant <ccoutant@google.com>
11490 * errors.cc (Errors::info): New function.
11491 (gold_info): New function.
11492 * errors.h (Errors::info): New function.
11493 * gold.h (gold_info): New function.
11494 * object.cc (Input_objects::add_object): Print trace output.
11495 * options.cc (options::parse_set): New function.
11496 (General_options::parse_wrap): Deleted.
11497 (General_options::General_options): Deleted initializer.
11498 * options.h (options::String_set): New typedef.
11499 (options::parse_set): New function.
11500 (DEFINE_set): New macro.
11501 (General_options::wrap): Changed to use DEFINE_set. Changed
11502 callers of any_wrap_symbols and is_wrap_symbol.
11503 (General_options::trace, General_options::trace_symbol):
11505 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
11506 (General_options::wrap_symbols_): Deleted.
11507 * symtab.cc (Symbol_table::add_from_object): Print trace output.
11509 2008-04-17 David S. Miller <davem@davemloft.net>
11511 * options.cc (General_options::parse_V): New function.
11512 * options.h: Add entries for -V and -Qy.
11514 2008-04-17 Ian Lance Taylor <iant@google.com>
11516 * common.cc (Symbol_table::allocate_commons): Remove options
11517 parameter. Change caller.
11518 (Symbol_table::do_allocate_commons): Remove options parameter.
11519 Change caller. Just call do_allocate_commons_list twice.
11520 (Symbol_table::do_allocate_commons_list): New function, broken out
11521 of do_allocate_commons.
11522 * common.h (class Allocate_commons_task): Remove options_ field.
11523 Update constructor.
11524 * symtab.cc (Symbol_table::Symbol_table): Initialize
11526 (Symbol_table::add_from_object): Put TLS common symbols on
11528 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
11529 which are IN_OUTPUT_DATA.
11530 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
11531 allocate_commons and do_allocate_commons declarations. Declare
11532 do_allocate_commons_list.
11533 * gold.cc (queue_middle_tasks): Update creation of
11534 Allocate_commons_task to not pass options.
11535 * testsuite/Makefile.am (INCLUDES): Add -I.. .
11536 (TLS_TEST_C_FLAGS): New variable.
11537 (tls_test_c_pic.o): New target.
11538 (tls_test_shared.so): Link in tls_test_c_pic.o.
11539 (tls_test_c_pic_ie.o): New target.
11540 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
11541 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
11542 (tls_test_c.o): New target.
11543 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
11544 (tls_pic_test_LDADD): Likewise.
11545 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
11546 (tls_shared_gd_to_ie_test_LDADD): Likewise.
11547 (tls_test_c_gnu2.o): New target.
11548 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
11550 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
11551 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
11552 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
11553 * testsuite/tls_test.cc: Include "config.h".
11554 (t_last): Call t11_last.
11555 * testsuite/tls_test.h (t11, t11_last): Declare.
11556 * testsuite/tls_test_c.c: New file.
11557 * testsuite/tls_test_main.cc (thread_routine): Call t11.
11558 * configure.ac: Check for OpenMP support.
11559 * configure, config.in, Makefile.in: Rebuild.
11560 * testsuite/Makefile.in: Rebuild.
11562 2008-04-16 Cary Coutant <ccoutant@google.com>
11564 * i386.cc (Target_i386::define_tls_base_symbol): New function.
11565 (Target_i386::tls_base_symbol_defined_): New field.
11566 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11567 (Target_i386::Scan::global): Likewise.
11568 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
11569 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
11570 (Target_x86_64::tls_base_symbol_defined_): New field.
11571 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11572 (Target_x86_64::Scan::global): Likewise.
11574 2008-04-16 Cary Coutant <ccoutant@google.com>
11576 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
11577 (Symbol::needs_plt_entry): Allow weak undefined symbols.
11578 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
11579 building shared libraries.
11580 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
11581 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
11582 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
11583 * testsuite/Makefile.in: Rebuild.
11584 * testsuite/weak_undef.h: New file.
11585 * testsuite/weak_undef_file1.cc: Add extra test cases.
11586 * testsuite/weak_undef_file2.cc: Likewise.
11587 * testsuite/weak_undef_test.cc: Likewise.
11589 2008-04-16 David S. Miller <davem@davemloft.net>
11591 * sparc.cc (Target_sparc::Scan): Change from struct to class.
11592 Add issued_non_pic_error_ field. Declare check_non_pic.
11593 (Target_sparc::Scan::check_non_pic): New function.
11594 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
11595 (Target_sparc::Scan::global): Likewise.
11597 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
11598 * configure: Rebuild.
11600 * options.h (DEFINE_enable): New macro.
11601 (new_dtags): New enable option.
11602 (initfirst, interpose, loadfltr, nodefaultlib,
11603 nodelete, nodlopen, nodump): New -z options.
11604 * layout.cc (Layout:finish_dynamic_section): If new
11605 dtags enabled, emit DT_RUNPATH. Also, emit a
11606 DT_FLAGS_1 containing any specified -z flags.
11608 2008-04-16 Ian Lance Taylor <iant@google.com>
11610 * copy-relocs.cc: New file.
11611 * copy-relocs.h: New file.
11612 * reloc.cc: Remove Copy_relocs code.
11613 * reloc.h: Likewise.
11614 * reloc-types.h (struct Reloc_types) [both versions]: Add
11615 get_reloc_addend_noerror.
11616 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
11617 variants of add_global which take an addend which must be zero.
11618 * i386.cc: Include "copy-relocs.h".
11619 (class Target_i386): Change type of copy_relocs_ to variable,
11620 update initializer.
11621 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
11622 Change all callers.
11623 (Target_i386::do_finalize_sections): Change handling of
11625 * sparc.cc: Include "copy-relocs.h".
11626 (class Target_sparc): Change type of copy_relocs_ to variable,
11627 update initializer.
11628 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
11629 Change all callers.
11630 (Target_sparc::do_finalize_sections): Change handling of
11632 * x86_64.cc: Include "copy-relocs.h".
11633 (class Target_x86_64): Change type of copy_relocs_ to variable,
11634 update initializer.
11635 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
11636 class. Change all callers.
11637 (Target_x86_64::do_finalize_sections): Change handling of
11639 * Makefile.am (CCFILES): Add copy-relocs.cc.
11640 (HFILES): Add copy-relocs.h.
11642 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
11644 * testsuite/script_test_4.sh: Permit leading zeroes.
11646 2008-04-15 Ian Lance Taylor <iant@google.com>
11648 * script-sections.cc (Script_sections::create_segments): Use
11649 header_size_adjustment even when there is enough room for the
11651 * testsuite/script_test_4.sh: New file.
11652 * testsuite/script_test_4.t: New file.
11653 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
11654 (check_DATA): Add script_test_4.stdout.
11655 (MOSTLYCLEANFILES): Likewise.
11656 (script_test_4): New target.
11657 (script_test_4.stdout): New target.
11658 * testsuite/Makefile.in: Rebuild.
11660 * sparc.cc: Add definitions for Output_data_plt_sparc class
11663 2008-04-14 David S. Miller <davem@davemloft.net>
11665 * sparc.cc: New file.
11666 * Makefile.am (TARGETSOURCES): Add sparc.cc
11667 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
11668 * configure.tgt: Document targ_extra_size and
11669 targ_extra_big_endian. Add entries for sparc-* and
11671 * configure.ac: Handle targ_extra_size and
11672 targ_extra_big_endian.
11673 * Makefile.in: Rebuild.
11674 * configure: Likewise.
11675 * po/POTFILES.in: Likewise.
11676 * po/gold.pot: Likewise.
11678 2008-04-14 Ian Lance Taylor <iant@google.com>
11680 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
11681 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
11682 in the name/type/flags to section mapping. Don't call
11683 allocate_output_section.
11684 (Layout::choose_output_section): Change parameter from adjust_name
11685 to is_input_section. Don't permit input sections after sections
11686 are attached to segments. Don't call allocate_output_section.
11687 (Layout::layout_eh_frame): Call update_flags_for_input_section,
11688 not write_enable_output_section.
11689 (Layout::make_output_section): Don't push to
11690 unattached_section_list_ nor call attach_to_segment. Call
11691 attach_section_to_segment if sections are attached.
11692 (Layout::attach_sections_to_segments): New function.
11693 (Layout::attach_section_to_segment): New function.
11694 (Layout::attach_allocated_section_to_segment): Rename from
11695 attach_to_segment. Remove flags parameter.
11696 (Layout::allocate_output_section): Remove function.
11697 (Layout::write_enable_output_section): Remove function.
11698 * layout.h (class Layout): Update for above changes. Add new
11699 field sections_are_attached_.
11700 * output.h (Output_section::update_flags_for_input_section): New
11702 * output.cc (Output_section::add_input_section): Call
11703 update_flags_for_input_section.
11704 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
11706 2008-04-11 Cary Coutant <ccoutant@google.com>
11708 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
11709 thought unnecessary.
11710 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
11712 2008-04-11 Ian Lance Taylor <iant@google.com>
11714 * output.h (class Output_section_data): Remove inline definition
11716 * output.cc (Output_section_data::set_addralign): New function.
11718 2008-04-11 Cary Coutant <ccoutant@google.com>
11720 Add support for TLS descriptors for i386 and x86_64.
11721 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
11722 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
11723 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
11725 (Target_i386::got_mod_index_entry): Remove unnecessary code.
11726 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
11727 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
11729 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
11730 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
11731 Fix problem with initial-exec relocations.
11732 (Target_i386::Relocate::relocate_tls): Likewise.
11733 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
11735 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
11736 support for section-plus-offset dynamic table entries.
11737 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
11738 (Output_data_dynamic::Dynamic_entry): Add support for
11739 section-plus-offset dynamic table entries.
11740 (Output_data_dynamic::Classification): Likewise.
11741 (Output_data_dynamic::classification_): Renamed offset_.
11742 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
11743 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
11744 (Target_x86_64::make_plt_section): New function.
11745 (Target_x86_64::reserve_tlsdesc_entries): New function.
11746 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
11747 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
11748 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
11749 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
11750 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
11751 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
11752 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
11753 add extra PLT entry for TLS descriptors.
11754 (Output_data_plt_x86_64::got_): New field.
11755 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
11756 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
11758 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
11760 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
11761 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
11762 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
11763 R_386_TLS_DESC_CALL relocations.
11764 (Target_x86_64::Scan::global): Likewise.
11765 (Target_x86_64::do_finalize_sections): Add dynamic table entries
11766 for TLS descriptors.
11767 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
11768 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
11769 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
11770 GD-to-IE relaxation.
11771 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
11772 and TLS_DESCRIPTORS.
11773 * Makefile.in: Rebuild.
11774 * configure: Rebuild.
11775 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
11776 (tls_test_shared2.so): New target.
11777 (tls_shared_gd_to_ie_test_SOURCES): New variable.
11778 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
11779 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
11780 (tls_shared_gd_to_ie_test_LDADD): New variable.
11781 (tls_shared_gnu2_gd_to_ie_test): New target.
11782 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
11784 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
11785 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
11786 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
11787 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
11788 (tls_shared_gnu2_test): New target.
11789 (tls_test_gnu2_shared.so): New target.
11790 (tls_shared_gnu2_test_SOURCES): New variable.
11791 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
11792 (tls_shared_gnu2_test_LDFLAGS): New variable.
11793 (tls_shared_gnu2_test_LDADD): New variable.
11794 * testsuite/Makefile.in: Rebuild.
11795 * testsuite/Makefile.
11797 2008-04-11 Ian Lance Taylor <iant@google.com>
11799 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
11801 * testsuite/Makefile.in: Rebuild.
11803 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
11805 * testsuite/script_test_2.cc (main): Adjust test.
11807 2008-04-11 David S. Miller <davem@davemloft.net>
11808 Ian Lance Taylor <iant@google.com>
11810 * options.h (General_options): Add entries for '-Y' and
11812 * options.cc (General_options:finalize): If -Y was used, add those
11813 entries to the library path instead of the default "/lib" and
11816 2008-04-11 David S. Miller <davem@davemloft.net>
11818 * testsuite/justsyms.t: Start at 0x100.
11819 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
11820 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
11822 * testsuite/script_test_2.cc: Adjust string and section length
11825 2008-04-09 Ian Lance Taylor <iant@google.com>
11828 * script-sections.cc (Sections_element::allocate_to_segment): Add
11830 (Output_section_definition::allocate_to_segment): Likewise.
11831 (Orphan_output_section::allocate_to_segment): Likewise.
11832 (Script_sections::attach_sections_using_phdrs_clause): Don't
11833 propagate non-PT_LOAD segments to orphan sections.
11834 * testsuite/Makefile.am (script_test_3.stdout): Generate using
11835 readelf rather than objdump.
11836 * testsuite/script_test_3.sh: Adjust accordingly. Test that
11837 .interp section and PT_INTERP segment are the same size.
11838 * testsuite/Makefile.in: Rebuild.
11840 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
11841 aliases for symbols defined in the same object.
11842 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
11843 (weak_alias_test_SOURCES): New variable.
11844 (weak_alias_test_DEPENDENCIES): New variable.
11845 (weak_alias_test_LDFLAGS): New variable.
11846 (weak_alias_test_LDADD): New variable.
11847 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
11848 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
11849 (weak_alias_test_3.o): New target.
11850 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
11851 * testsuite/weak_alias_test_main.cc: New file.
11852 * testsuite/weak_alias_test_1.cc: New file.
11853 * testsuite/weak_alias_test_2.cc: New file.
11854 * testsuite/weak_alias_test_3.cc: New file.
11856 2008-04-08 Ian Lance Taylor <iant@google.com>
11858 * options.h (class General_options): Add --noinhibit-exec option.
11859 * main.cc (main): Check --noinhibit-exec.
11861 * options.h (class General_options): Define --wrap as a special
11862 option. Add wrap_symbols_ field.
11863 (General_options::any_wrap_symbols): New function.
11864 (General_options::is_wrap_symbol): New function.
11865 * options.cc (General_options::parse_wrap): New function.
11866 (General_options::General_options): Initialize wrap_symbols_.
11867 * symtab.cc (Symbol_table::wrap_symbol): New function.
11868 (Symbol_table::add_from_object): Handle --wrap.
11869 * symtab.h (class Symbol_table): Declare wrap_symbol.
11870 * target.h (Target::wrap_char): New function.
11871 (Target::Target_info): Add wrap_char field.
11872 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
11873 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11874 * testsuite/testfile.cc (Target_test::test_target_info):
11877 * errors.cc (Errors::undefined_symbol): Mention symbol version if
11880 * layout.h (class Layout): Add added_eh_frame_data_ field.
11881 * layout.cc (Layout::Layout): Initialize new field.
11882 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
11883 output section until we find a section we merged successfully.
11884 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
11885 that the size be non-zero.
11887 * merge.cc (Object_merge_map::get_output_offset): Remove inline
11890 2008-04-08 Craig Silverstein <csilvers@google.com>
11892 * configure.ac: Export new conditional variable HAVE_ZLIB.
11893 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
11895 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
11896 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11898 2008-04-07 Ian Lance Taylor <iant@google.com>
11900 * version.cc (version_string): Set to "1.5".
11902 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
11903 Add issued_non_pic_error_ field. Declare check_non_pic.
11904 (Target_x86_64::Scan::check_non_pic): New function.
11905 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
11906 (Target_x86_64::Scan::global): Likewise.
11908 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
11909 addend parameter. Change caller. Handle merge sections.
11910 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
11911 Address to Addend. Don't add in the result of
11912 local_section_offset, pass down the addend and use the returned
11914 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
11915 Update declarations of local_section_offset and symbol_value.
11916 * testsuite/two_file_test_1.cc (t18): New function.
11917 * testsuite/two_file_test_2.cc (f18): New function.
11918 * testsuite/two_file_test_main.cc (main): Call t18.
11919 * testsuite/two_file_test.h (t18, f18): Declare.
11921 * configure.ac: Don't test for objdump, c++filt, or readelf.
11922 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
11924 (TEST_READELF): New variable.
11925 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
11926 (check_PROGRAMS): Add two_file_strip_test.
11927 (two_file_strip_test): New target.
11928 (check_PROGRAMS): Add two_file_same_shared_strip_test.
11929 (two_file_same_shared_strip_test_SOURCES): New variable.
11930 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
11931 (two_file_same_shared_strip_test_LDFLAGS): New variable.
11932 (two_file_same_shared_strip_test_LDADD): New variable.
11933 (two_file_shared_strip.so): New target.
11934 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
11935 (ver_test_5.syms, ver_test_7.syms): Likewise.
11936 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
11937 (strip_test_3.stdout): Use TEST_OBJDUMP.
11938 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11940 2008-04-04 Cary Coutant <ccoutant@google.com>
11942 * symtab.h (Symbol::is_weak_undefined): New function.
11943 (Symbol::is_strong_undefined): New function.
11944 (Symbol::is_absolute): New function.
11945 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
11946 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
11948 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
11949 (weak_undef_test): New target.
11950 * testsuite/Makefile.in: Rebuild.
11951 * testsuite/weak_undef_file1.cc: New file.
11952 * testsuite/weak_undef_file2.cc: New file.
11953 * testsuite/weak_undef_test.cc: New file.
11955 2008-04-03 Craig Silverstein <csilvers@google.com>
11957 * compressed_output.h (class Output_compressed_section): Use
11959 * compressed_output.cc (zlib_compress): Use unsigned buffers,
11961 (zlib_compressed_suffix): Removed.
11962 (Output_compressed_section::set_final_data_size): Use unsigned
11964 * testsuite/Makefile.am (flagstest_compress_debug_sections):
11965 Fix linker invocation.
11966 (flagstest_o_specialfile_and_compress_debug_sections):
11968 * testsuite/Makefile.in: Regenerated.
11970 2008-04-02 David S. Miller <davem@davemloft.net>
11972 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
11973 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
11975 2008-04-02 Craig Silverstein <csilvers@google.com>
11979 2008-04-02 Ian Lance Taylor <iant@google.com>
11981 * fileread.cc (File_read::find_view): Add byteshift and vshifted
11982 parameters. Update for new key type to views_. Change all
11984 (File_read::read): Adjust for byteshift in returned view.
11985 (File_read::add_view): New function, broken out of
11986 find_and_make_view.
11987 (File_read::make_view): New function, broken out of
11988 find_and_make_view.
11989 (File_read::find_or_make_view): Add offset and aligned
11990 parameters. Rewrite accordingly. Change all callers.
11991 (File_read::get_view): Add offset and aligned parameters. Adjust
11992 for byteshift in return value.
11993 (File_read::get_lasting_view): Likewise.
11994 * fileread.h (class File_read): Update declarations.
11995 (class File_read::View): Add byteshift_ field. Add byteshift to
11996 constructor. Add byteshift method.
11997 * archive.h (Archive::clear_uncached_views): New function.
11998 (Archive::get_view): Add aligned parameter. Change all callers.
11999 * object.h (Object::get_view): Add aligned parameter. Change all
12001 (Object::get_lasting_view): Likewise.
12003 * fileread.cc (File_read::release): Don't call clear_views if
12004 there are multiple objects.
12005 * fileread.h (File_read::clear_uncached_views): New function.
12006 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
12009 2008-03-31 Cary Coutant <ccoutant@google.com>
12011 Add thin archive support.
12012 * archive.cc (Archive::armagt): New const.
12013 (Archive::setup): Remove task parameter and calls to unlock.
12014 (Archive::unlock_nested_archives): New function.
12015 (Archive::read_header): Add nested_off parameter. Change
12017 (Archive::interpret_header): Likewise.
12018 (Archive::include_all_members): Change to handle thin
12020 (Archive::include_member): Likewise.
12021 * archive.h (Archive::Archive): Add new parameters and
12023 (Archive::armagt): New const.
12024 (Archive::setup): Remove task parameter.
12025 (Archive::unlock_nested_archives): New function.
12026 (Archive::read_header): Add nested_off parameter.
12027 (Archive::interpret_header): Likewise.
12028 (Archive::Nested_archive_table): New typedef.
12029 (Archive::is_thin_archive_): New field.
12030 (Archive::nested_archives_): New field.
12031 (Archive::options_): New field.
12032 (Archive::dirpath_): New field.
12033 (Archive::task_): New field.
12034 * readsyms.cc (Read_symbols::do_read_symbols): Add check
12035 for thin archives. Pass additional parameters to
12036 Archive::Archive. Unlock the archive file after calling
12039 2008-03-29 Ian Lance Taylor <iant@google.com>
12041 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12042 version symbol to be local.
12043 * testsuite/ver_test_4.sh: New file.
12044 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12045 (check_DATA): Add ver_test_4.syms.
12046 (ver_test_4.syms): New target.
12047 * testsuite/Makefile.in: Rebuild.
12050 (Output_section::Input_section_sort_entry::has_priority): New
12052 (Output_section::Input_section_sort_entry::match_file_name): New
12054 (Output_section::Input_section_sort_entry::match_section_name):
12056 (Output_section::Input_section_sort_entry::match_section_name_prefix):
12058 (Output_section::Input_section_sort_entry::match_section_file):
12060 (Output_section::Input_section_sort_compare::operator()): Rewrite
12061 using new Input_section_sort_entry functions. Sort crtbegin and
12062 crtend first. Sort sections with no priority before sections with
12064 * testsuite/initpri1.c (d3): Check j != 4.
12065 (cd5): New constructor/destructor function.
12066 (main): Check j != 2.
12068 * symtab.cc (Symbol_table::add_from_object): If we don't use the
12069 new symbol when resolving, don't call set_is_default.
12070 * testsuite/ver_test_7.cc: New file.
12071 * testsuite/ver_test_7.sh: New file.
12072 * testsuite/Makefile.am (ver_test_7.so): New target.
12073 (ver_test_7.o): New target.
12074 (check_SCRIPTS): Add ver_test_7.sh.
12075 (check_DATA): Add ver_test_7.syms.
12076 (ver_test_7.syms): New target.
12078 2008-03-28 Ian Lance Taylor <iant@google.com>
12080 * layout.cc (Layout::layout): If we see an input section with a
12081 name that needs sorting, set the must_sort flag for the output
12083 (Layout::make_output_section): If the name of the output section
12084 indicates that it might require sorting, set the may_sort flag.
12085 * output.h (Output_section::may_sort_attached_input_sections): New
12087 (Output_section::set_may_sort_attached_input_sections): New
12089 (Output_section::must_sort_attached_input_sections): New
12091 (Output_section::set_must_sort_attached_input_sections): New
12093 (class Output_section): Declare Input_section_sort_entry. Define
12094 Input_section_sort_compare. Declare
12095 sort_attached_input_sections. Add new fields:
12096 may_sort_attached_input_sections_,
12097 must_sort_attached_input_sections_,
12098 attached_input_sections_are_sorted_.
12099 * output.cc (Output_section::Output_section): Initialize new
12101 (Output_section::add_input_section): Add an entry to
12102 input_sections_ if may_sort or must_sort are true.
12103 (Output_section::set_final_data_size): Call
12104 sort_attached_input_sections if necessary.
12105 (Output_section::Input_section_sort_entry): Define new class.
12106 (Output_section::Input_section_sort_compare::operator()): New
12108 (Output_section::sort_attached_input_sections): New function.
12109 * configure.ac: Check whether the compiler supports constructor
12110 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
12111 * testsuite/initpri1.c: New file.
12112 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
12113 CONSTRUCTOR_PRIORITY.
12114 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
12115 (initpri1_LDFLAGS): New variable.
12116 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12118 2008-03-27 Ian Lance Taylor <iant@google.com>
12120 * common.cc (Sort_commons::operator): Correct sorting algorithm.
12121 * testsuite/common_test_1.c: New file.
12122 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
12123 (common_test_1_SOURCES): New variable.
12124 (common_test_1_DEPENDENCIES): New variable.
12125 (common_test_1_LDFLAGS): New variable.
12127 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
12128 and commons_ correctly when NAME/VERSION does not override
12130 * testsuite/ver_test_6.c: New file.
12131 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
12132 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
12133 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
12135 2008-03-26 Ian Lance Taylor <iant@google.com>
12137 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
12138 of an undefined symbol from a version script.
12139 * testsuite/Makefile.am (ver_test_5.so): New target.
12140 (ver_test_5.o): New target.
12141 (check_SCRIPTS): Add ver_test_5.sh.
12142 (check_DATA): Add ver_test_5.syms.
12143 (ver_test_5.syms): New target.
12144 * testsuite/ver_test_5.cc: New file.
12145 * testsuite/ver_test_5.script: New file.
12146 * testsuite/ver_test_5.sh: New file.
12147 * Makefile.in, testsuite/Makefile.in: Rebuild.
12150 Fix problems building gold with gcc 4.3.0.
12151 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
12152 (gold_error_at_location, gold_warning_at_location): Use it.
12153 * configure.ac: Check whether we can compile and use a template
12154 function with a printf attribute.
12155 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
12156 when jumping over bytes.
12157 * object.cc: Instantiate Object::read_section_data.
12158 * debug.h: Include <cstring>
12159 * dwarf_reader.cc: Include <algorithm>
12160 * main.cc: Include <cstring>.
12161 * options.cc: Include <cstring>.
12162 * output.cc: Include <cstring>.
12163 * script.cc: Include <cstring>.
12164 * script.h: Include <string>.
12165 * symtab.cc: Include <cstring> and <algorithm>.
12166 * target-select.cc: Include <cstring>.
12167 * version.cc: Include <string>.
12168 * testsuite/testmain.cc: Include <cstdlib>.
12169 * configure, config.in: Rebuild.
12171 2008-03-25 Ian Lance Taylor <iant@google.com>
12173 * options.cc: Include "../bfd/bfdver.h".
12174 (options::help): Print bug reporting address.
12176 * version.cc (print_version): Adjust output for current value of
12177 BFD_VERSION_STRING.
12181 * options.cc (options::help): Print list of supported targets.
12182 * target-select.h: Include <vector>.
12183 (class Target_selector): Make machine_, size_, and is_big_endian_
12184 fields const. Add bfd_name_ and instantiated_target_ fields.
12185 (Target_selector::Target_selector): Add bfd_name parameter.
12186 (Target_selector::recognize): Make non-virtual, call
12188 (Target_selector::recognize_by_name): Make non-virtual, call
12189 do_recognize_by_name.
12190 (Target_selector::supported_names): New function.
12191 (Target_selector::bfd_name): New function.
12192 (Target_selector::do_instantiate_target): New pure virtual
12194 (Target_selector::do_recognize): New virtual function.
12195 (Target_selector::do_recognize_by_name): New virtual function.
12196 (Target_selector::instantiate_target): New private function.
12197 (supported_target_names): Declare.
12198 * target-select.cc (Target_selector::Target_selector): Update for
12199 new parameter and fields.
12200 (select_target_by_name): Check that the name matches before
12201 calling recognize_by_name.
12202 (supported_target_names): New function.
12203 * i386.cc (class Target_selector_i386): Update Target_selector
12204 constructor call. Remove recognize and recognize_by_name. Add
12205 do_instantiate_target.
12206 * x86_64.cc (class Target_selector_x86_64): Likewise.
12207 * testsuite/testfile.cc (class Target_selector_test): Update for
12208 changes to Target_selector.
12210 * README: Rewrite, with some notes on unsupported features.
12212 2008-03-24 Cary Coutant <ccoutant@google.com>
12214 * i386.cc (Target_i386::Got_type): New enum declaration.
12215 (Target_i386::Scan::local): Updated callers of Output_data_got
12217 (Target_i386::Scan::global): Likewise.
12218 (Target_i386::Relocate::relocate): Likewise.
12219 (Target_i386::Relocate::relocate_tls): Likewise.
12220 * object.h (Got_offset_list): New class.
12221 (Sized_relobj::local_has_got_offset): Added got_type parameter.
12222 (Sized_relobj::local_got_offset): Likewise.
12223 (Sized_relobj::set_local_got_offset): Likewise.
12224 (Sized_relobj::local_has_tls_got_offset): Removed.
12225 (Sized_relobj::local_tls_got_offset): Removed.
12226 (Sized_relobj::set_local_tls_got_offset): Removed.
12227 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
12228 * output.cc (Output_data_got::add_global): Added got_type parameter.
12229 (Output_data_got::add_global_with_rel): Likewise.
12230 (Output_data_got::add_global_with_rela): Likewise.
12231 (Output_data_got::add_global_pair_with_rel): New function.
12232 (Output_data_got::add_global_pair_with_rela): New function.
12233 (Output_data_got::add_local): Added got_type parameter.
12234 (Output_data_got::add_local_with_rel): Likewise.
12235 (Output_data_got::add_local_with_rela): Likewise.
12236 (Output_data_got::add_local_pair_with_rel): New function.
12237 (Output_data_got::add_local_pair_with_rela): New function.
12238 (Output_data_got::add_global_tls): Removed.
12239 (Output_data_got::add_global_tls_with_rel): Removed.
12240 (Output_data_got::add_global_tls_with_rela): Removed.
12241 (Output_data_got::add_local_tls): Removed.
12242 (Output_data_got::add_local_tls_with_rel): Removed.
12243 (Output_data_got::add_local_tls_with_rela): Removed.
12244 * output.h (Output_data_got::add_global): Added got_type parameter.
12245 (Output_data_got::add_global_with_rel): Likewise.
12246 (Output_data_got::add_global_with_rela): Likewise.
12247 (Output_data_got::add_global_pair_with_rel): New function.
12248 (Output_data_got::add_global_pair_with_rela): New function.
12249 (Output_data_got::add_local): Added got_type parameter.
12250 (Output_data_got::add_local_with_rel): Likewise.
12251 (Output_data_got::add_local_with_rela): Likewise.
12252 (Output_data_got::add_local_pair_with_rel): New function.
12253 (Output_data_got::add_local_pair_with_rela): New function.
12254 (Output_data_got::add_global_tls): Removed.
12255 (Output_data_got::add_global_tls_with_rel): Removed.
12256 (Output_data_got::add_global_tls_with_rela): Removed.
12257 (Output_data_got::add_local_tls): Removed.
12258 (Output_data_got::add_local_tls_with_rel): Removed.
12259 (Output_data_got::add_local_tls_with_rela): Removed.
12260 * resolve.cc (Symbol::override_base_with_special): Removed
12261 reference to has_got_offset_ field.
12262 * symtab.cc (Symbol::init_fields): Replaced initialization
12263 of got_offset_ with got_offsets_. Removed initialization
12265 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
12266 (Symbol::got_offset): Likewise.
12267 (Symbol::set_got_offset): Likewise.
12268 (Symbol::has_tls_got_offset): Removed.
12269 (Symbol::tls_got_offset): Removed.
12270 (Symbol::set_tls_got_offset): Removed.
12271 (Symbol::got_offset_): Removed.
12272 (Symbol::tls_mod_got_offset_): Removed.
12273 (Symbol::tls_pair_got_offset_): Removed.
12274 (Symbol::got_offsets_): New field.
12275 (Symbol::has_got_offset): Removed.
12276 (Symbol::has_tls_mod_got_offset): Removed.
12277 (Symbol::has_tls_pair_got_offset): Removed.
12278 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
12279 (Target_x86_64::Scan::local): Updated callers of Output_data_got
12281 (Target_x86_64::Scan::global): Likewise.
12282 (Target_x86_64::Relocate::relocate): Likewise.
12283 (Target_x86_64::Relocate::relocate_tls): Likewise.
12285 2008-03-25 Ben Elliston <bje@au.ibm.com>
12287 * yyscript.y: Fix spelling error in comment.
12289 2008-03-24 Ian Lance Taylor <iant@google.com>
12291 * options.h (class General_options): Define build_id option.
12292 * layout.h (class Layout): Declare write_build_id, create_note,
12293 create_build_id. Add build_id_note_ member.
12294 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
12295 "libiberty.h", "md5.h", "sha1.h".
12296 (Layout::Layout): Initialize eh_frame_data_,
12297 eh_frame_hdr_section_, and build_id_note_.
12298 (Layout::finalize): Call create_build_id.
12299 (Layout::create_note): New function, broken out of
12300 Layout::create_gold_note.
12301 (Layout::create_gold_note): Call create_note.
12302 (Layout::create_build_id): New function.
12303 (Layout::write_build_id): New function.
12304 (Close_task_runner::run): Call write_build_id.
12306 * x86_64.cc: Correct license to GPLv3.
12308 2008-03-23 Ian Lance Taylor <iant@google.com>
12310 * options.cc: Include "demangle.h".
12311 (parse_optional_string): New function.
12312 (parse_long_option): Handle takes_optional_argument.
12313 (parse_short_option): Update dash_z initializer. Handle
12314 takes_optional_argument.
12315 (General_options::General_options): Initialize do_demangle_.
12316 (General_options::finalize): Set do_demangle_. Handle demangling
12318 * options.h (parse_optional_string): Declare.
12319 (struct One_option): Add optional_arg field. Update constructor.
12320 Update call constructor calls. Add takes_optional_argument
12322 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
12323 (DEFINE_optional_string): Define.
12324 (General_options::demangle): Change from DEFINE_bool to
12325 DEFINE_optional_string.
12326 (General_options::no_demangle): New function.
12327 (General_options::do_demangle): New function.
12328 (General_options::set_do_demangle): New function.
12329 (General_options::execstack_status_): Move definition to end of
12331 (General_options::static_): Likewise.
12332 (General_options::do_demangle_): New field.
12333 * object.cc (big_endian>::get_symbol_location_info): Call
12334 Options::do_demangle, not Options::demangle.
12335 * symtab.cc (demangle): Likewise.
12337 2008-03-22 Ian Lance Taylor <iant@google.com>
12339 * gold.h: Include <cstddef> and <sys/types.h>
12340 * options.h: Include <cstring>.
12342 2008-03-21 Ian Lance Taylor <iant@google.com>
12344 * Added source code to GNU binutils.