1 2011-12-17 Cary Coutant <ccoutant@google.com>
3 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
4 * resolve.cc (Symbol_table::resolve): Likewise.
5 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
7 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
9 2011-12-16 Ian Lance Taylor <iant@google.com>
11 * output.h (Output_data_reloc_generic::add): Only call
12 add_dynamic_reloc if this is a dynamic reloc section.
14 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
17 * target-reloc.h (apply_relocation): Replace <64, false> with
20 2011-11-25 Nick Clifton <nickc@redhat.com>
22 * po/it.po: New Italian translation.
24 2011-11-17 Sterling Augustine <saugustine@google.com>
26 * script.cc (script_include_directive): Implement.
27 (read_script_file): New local variables name and search_path. Update
28 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
29 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
30 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
32 2011-11-11 Sterling Augustine <saugustine@google.com>
34 * yyscript.y (section_cmd): Add support for INCLUDE directive.
35 (file_or_sections_cmd): Likewise.
37 2011-11-11 Doug Kwan <dougkwan@google.com>
39 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
40 if --just-symbols is given.
42 2011-11-10 Doug Kwan <dougkwan@google.com>
45 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
46 when processing data relocs.
47 * reloc.h (Relocate_functions::rel_unaligned): New method.
48 (Relocate_functions::pcrel_unaligned): Ditto.
49 (Relocate_functions::rel32_unaligned): Ditto.
50 (Relocate_functions::pcrel32_unaligned): Ditto.
52 2011-11-09 Doug Kwan <dougkwan@google.com>
55 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
56 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
57 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
58 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
59 (Relocate_functions::rel_unaligned): New.
60 (Relocate_functions::rel32_unaligned): New.
61 * target-reloc.h (relocate_for_relocatable): Add code to handle
62 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
63 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
64 arm_unaligned_reloc_r): New targets.
65 * testsuite/Makefile.in: Regenerate.
66 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
69 2011-11-02 Ian Lance Taylor <iant@google.com>
71 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
73 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
74 * options.cc (General_options::finalize): Use library search path
75 from configure script if specified. If not native and no sysroot,
76 only search TOOLLIBDIR.
77 * options.h (Search_directory::Search_directory): Change name to
79 (General_options::add_to_library_path_with_sysroot): Change arg to
81 * configure, Makefile.in, config.in: Rebuild.
83 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
85 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
86 we are working around the ARM1176 Erratum.
87 * options.h (General_options::fix_arm1176): Add option.
88 * testsuite/Makefile.am: Add testcases, and keep current ones
90 * testsuite/Makefile.in: Regenerate.
91 * testsuite/arm_fix_1176.s: New file.
92 * testsuite/arm_fix_1176.sh: Likewise.
94 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
96 * arm.cc (Target_arm::Target_arm): Remove initialisation of
98 (Target_arm::may_use_blx): Remove method.
99 (Target_arm::set_may_use_blx): Likewise.
100 (Target_arm::may_use_v4t_interworking): New method.
101 (Target_arm::may_use_v5t_interworking): Likewise.
102 (Target_arm::may_use_blx_): Remove member variable.
103 (Arm_relocate_functions::arm_branch_common): Check for v5T
105 (Arm_relocate_functions::thumb_branch_common): Likewise.
106 (Reloc_stub::stub_type_for_reloc): Likewise.
107 (Target_arm::do_finalize_sections): Correct interworking checks.
108 * testsuite/Makefile.am: Add new tests.
109 * testsuite/Makefile.in: Regenerate.
110 * testsuite/arm_farcall_arm_arm.s: New test.
111 * testsuite/arm_farcall_arm_arm.sh: Likewise.
112 * testsuite/arm_farcall_arm_thumb.s: Likewise.
113 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
114 * testsuite/arm_farcall_thumb_arm.s: Likewise.
115 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
116 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
117 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
119 2011-10-31 Cary Coutant <ccoutant@google.com>
122 * expression.cc (Expression::eval_with_dot): Add
123 is_section_dot_assignment parameter.
124 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
125 absolute and assigning to dot within a section.
127 (Output_section_element_assignment::set_section_addresses): Pass
128 dot_section to set_if_absolute.
129 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
130 as is_section_dot_assignment flag to eval_with_dot.
131 (Output_section_element_dot_assignment::set_section_addresses):
133 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
134 parameter. Also set value if relative to dot_section; set the
135 symbol's output_section.
136 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
137 parameter. Adjust all callers.
138 (Expression::eval_maybe_dot): Likewise.
139 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
141 * testsuite/script_test_2.t: Test assignment of an absolute value
142 to dot within an output section element.
144 2011-10-31 Cary Coutant <ccoutant@google.com>
146 * options.h (class General_options): Add --[no-]gnu-unique options.
147 * symtab.cc (Symbol_table::sized_write_globals): Convert
148 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
150 2011-10-31 Cary Coutant <ccoutant@google.com>
153 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
154 unnecessary assertion.
155 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
157 2011-10-31 Sriraman Tallam <tmsriram@google.com>
159 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
161 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
163 Change to just keep the section associated with symbol.
164 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
165 they are externally visible and --export-dynamic is turned on.
166 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
168 2011-10-19 Ian Lance Taylor <iant@google.com>
172 (Output_section_element_dot_assignment::needs_output_section): New
175 2011-10-19 Ian Lance Taylor <iant@google.com>
178 * layout.cc (Layout::segment_precedes): Don't assert failure if a
179 --section-start option was seen.
180 * options.h (General_options::any_section_start): New function.
182 2011-10-18 David S. Miller <davem@davemloft.net>
185 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
186 member to track relocation locations that have moved during TLS
188 (Target_sparc::Relocate::Relocate): Initialize to NULL.
189 (Target_sparc::Relocate::relocate): Adjust view down by 4
190 bytes if it matches reloc_adjust_addr_.
191 (Target_sparc::Relocate::relocate_tls): Always move the
192 __tls_get_addr call delay slot instruction forward 4 bytes when
193 performing relaxation.
195 2011-10-18 Cary Coutant <ccoutant@google.com>
197 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
198 (Output_file::map_no_anonymous): Check for non-zero
199 return code from posix_fallocate.
201 2011-10-17 Cary Coutant <ccoutant@google.com>
204 * plugin.cc (is_visible_from_outside): Check for symbols
205 referenced from dynamic objects.
206 * resolve.cc (Symbol_table::resolve): Don't count references
207 from dynamic objects as references from real ELF files.
208 * testsuite/plugin_test_2.sh: Adjust expected result.
210 2011-10-17 Cary Coutant <ccoutant@google.com>
212 * gold.cc: Include timer.h.
213 (queue_middle_tasks): Stamp time.
214 (queue_final_tasks): Likewise.
215 * main.cc (main): Store timer in parameters. Print timers
217 * parameters.cc (Parameters::Parameters): Initialize timer_.
218 (Parameters::set_timer): New function.
219 (set_parameters_timer): New function.
220 * parameters.h (Parameters::set_timer): New function.
221 (Parameters::timer): New function.
222 (Parameters::timer_): New data member.
223 (set_parameters_timer): New function.
224 * timer.cc (Timer::stamp): New function.
225 (Timer::get_pass_time): New function.
226 * timer.h (Timer::stamp): New function.
227 (Timer::get_pass_time): New function.
228 (Timer::pass_times_): New data member.
230 2011-10-17 Cary Coutant <ccoutant@google.com>
232 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
233 task for members of lib groups.
235 2011-10-17 Cary Coutant <ccoutant@google.com>
238 * fileread.cc (File_read::find_view): Add assert.
239 (File_read::make_view): Move bounds check (replace with assert)...
240 (File_read::find_or_make_view): ... to here.
242 2011-10-12 Cary Coutant <ccoutant@google.com>
244 * output.cc (Output_file::open_base_file): Handle case where
245 ::read returns less than requested size.
247 2011-10-10 Cary Coutant <ccoutant@google.com>
249 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
250 Initialize defined_count_.
251 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
252 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
253 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
254 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
255 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
256 * incremental.h (Sized_relobj_incr::defined_count_): New data
258 (Sized_incr_dynobj::defined_count_): New data member.
259 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
260 Return zeroes instead of internal error.
262 2011-10-10 Cary Coutant <ccoutant@google.com>
265 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
266 (Output_reloc::symbol_value): Return PLT offset if flag is set.
267 * output.h (class Output_reloc): Add use_plt_offset flag.
268 (Output_reloc::type_): Adjust size of bit field.
269 (Output_reloc::use_plt_offset_): New bit field.
270 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
271 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
272 flag. Adjust all callers.
273 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
274 creating RELATIVE relocations.
276 2011-10-10 Nick Clifton <nickc@redhat.com>
278 * po/es.po: Updated Spanish translation.
279 * po/fi.po: Updated Finnish translation.
281 2011-10-03 Diego Novillo <dnovillo@google.com>
283 * options.cc (parse_uint): Fix dereference of RETVAL.
285 2011-09-29 Sriraman Tallam <tmsriram@google.com>
287 * layout.h (section_order_map_): New member.
288 (get_section_order_map): New member function.
289 * output.cc (Output_section::add_input_section): Check for patterns
290 only when --section-ordering-file is specified.
291 * gold.cc (queue_middle_tasks): Delay updating order of sections till
292 output_sections have been formed.
293 * layout.cc (Layout_Layout): Initialize section_order_map_.
294 * plugin.cc (update_section_order): Store order in order_map. Do not
296 * testsuite/Makefile.am: Add test case for plugin_final_layout.
297 * testsuite/Makefile.in: Regenerate.
298 * testsuite/plugin_section_order.c: New file.
299 * testsuite/plugin_final_layout.cc: New file.
300 * testsuite/plugin_final_layout.sh: New file.
302 2011-09-29 Cary Coutant <ccoutant@google.com>
304 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
306 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
307 symbols during incremental update.
308 (Symbol_table::add_from_dynobj): Likewise.
310 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
311 Ian Lance Taylor <iant@google.com>
313 * symtab.cc (Symbol_table::define_special_symbol): Always
314 canonicalize version string.
316 2011-09-26 Cary Coutant <ccoutant@google.com>
318 * gold.cc (queue_initial_tasks): Move option checks ...
319 * options.cc (General_options::finalize): ... to here. Disable
320 some options; make others fatal.
322 2011-09-26 Cary Coutant <ccoutant@google.com>
325 * plugin.cc (get_symbols_v2): New function.
326 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
327 (is_referenced_from_outside): New function.
328 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
329 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
330 (get_symbols): Pass version parameter.
331 (get_symbols_v2): New function.
332 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
334 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
335 (onload): Add LDPT_GET_SYMBOLS_V2.
336 (all_symbols_read_hook): Use get_symbols_v2; check for
337 LDPR_PREVAILING_DEF_IRONLY_EXP.
338 * testsuite/plugin_test_3.sh: Update expected results.
340 2011-09-23 Simon Baldwin <simonb@google.com>
342 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
343 configuration options.
344 * configure: Regenerate.
345 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
346 * Makefile.in: Regenerate.
347 * testsuite/Makefile.in: Regenerate.
349 2011-09-19 Sriraman Tallam <tmsriram@google.com>
351 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
353 2011-09-19 Cary Coutant <ccoutant@google.com>
355 * incremental.cc (can_incremental_update): Fix typo in comment.
356 * incremental.h (can_incremental_update): Likewise.
358 2011-09-18 Cary Coutant <ccoutant@google.com>
360 * incremental.cc (can_incremental_update): New function.
361 * incremental.h (can_incremental_update): New function.
362 * layout.cc (Layout::init_fixed_output_section): Call it.
363 (Layout::make_output_section): Don't allow patch space in .eh_frame.
364 * object.cc (Sized_relobj_file::do_layout): Call
365 can_incremental_update.
367 2011-09-13 Cary Coutant <ccoutant@google.com>
369 * configure.ac: Check for glibc support for gnu_indirect_function
370 support with static linking, setting automake conditional
372 * Makefile.in: Regenerate.
373 * configure: Regenerate.
375 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
376 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
378 * testsuite/Makefile.in: Regenerate.
380 2011-09-13 Cary Coutant <ccoutant@google.com>
382 * incremental.cc (Sized_relobj_incr::do_layout): Call
383 report_comdat_group for kept comdat sections.
384 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
385 * testsuite/Makefile.in: Regenerate.
386 * testsuite/incr_comdat_test_1.cc: New source file.
387 * testsuite/incr_comdat_test_2_v1.cc: New source file.
388 * testsuite/incr_comdat_test_2_v2.cc: New source file.
389 * testsuite/incr_comdat_test_2_v3.cc: New source file.
391 2011-09-13 Ian Lance Taylor <iant@google.com>
393 * object.cc (Sized_relobj_file::do_layout): Remove unused local
394 variable external_symbols_offset.
396 2011-09-12 Ian Lance Taylor <iant@google.com>
398 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
399 triggered if object has no symbols.
401 2011-09-09 David S. Miller <davem@davemloft.net>
403 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
404 (Output_fill_debug_line::do_write): Likewise.
406 2011-08-29 Cary Coutant <ccoutant@google.com>
408 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
409 casts to match formatting specs.
410 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
412 2011-08-26 Cary Coutant <ccoutant@google.com>
414 * layout.cc (Free_list::allocate): Provide guarantee of minimum
415 remaining hole size when allocating.
416 (Layout::make_output_section): Set fill methods for debug sections.
417 * layout.h (Free_list::Free_list_node): Move from private to
419 (Free_list::set_min_hole_size): New function.
420 (Free_list::begin, Free_list::end): New functions.
421 (Free_list::min_hole_): New data member.
422 * output.cc: Include dwarf.h.
423 (Output_fill_debug_info::do_minimum_hole_size): New function.
424 (Output_fill_debug_info::do_write): New function.
425 (Output_fill_debug_line::do_minimum_hole_size): New function.
426 (Output_fill_debug_line::do_write): New function.
427 (Output_section::Output_section): Initialize new data member.
428 (Output_section::set_final_data_size): Ensure patch space is larger
429 than minimum hole size.
430 (Output_section::do_write): Fill holes in debug sections.
431 * output.h (Output_fill): New class.
432 (Output_fill_debug_info): New class.
433 (Output_fill_debug_line): New class.
434 (Output_section::set_free_space_fill): New function.
435 (Output_section::free_space_fill_): New data member.
436 * testsuite/Makefile.am (incremental_test_3): Add
437 --incremental-patch option.
438 (incremental_test_4): Likewise.
439 (incremental_test_5): Likewise.
440 (incremental_test_6): Likewise.
441 (incremental_copy_test): Likewise.
442 (incremental_common_test_1): Likewise.
443 * testsuite/Makefile.in: Regenerate.
445 2011-08-26 Nick Clifton <nickc@redhat.com>
447 * po/es.po: Updated Spanish translation.
449 2011-08-01 Cary Coutant <ccoutant@google.com>
451 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
452 * gold/testsuite/Makefile.in: Regenerate.
453 * gold/testsuite/justsyms_exec.c: New source file.
454 * gold/testsuite/justsyms_lib.c: New source file.
456 2011-08-01 Cary Coutant <ccoutant@google.com>
458 * layout.cc (Layout::set_segment_offsets): Don't realign text
459 segment if -Ttext was specified.
460 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
462 * object.h (Sized_relobj_file::e_type): New function.
463 (Sized_relobj_file::e_type_): New data member.
464 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
465 base address for ET_EXEC files.
466 * target.cc (Target::do_make_elf_object_implementation): Allow
467 ET_EXEC files with --just-symbols option.
469 2011-07-28 Cary Coutant <ccoutant@google.com>
471 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
472 Add thread_number parameter.
473 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
474 * workqueue-threads.cc
475 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
476 current thread if its thread number is greater than desired thread
478 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
479 Add thread_number parameter.
480 (Workqueue::should_cancel_thread): Likewise.
481 (Workqueue::find_runnable_or_wait): Pass thread_number to
482 should_cancel_thread.
483 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
486 2011-07-22 Sriraman Tallam <tmsriram@google.com>
488 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
489 only after checking if it cannot be forced local.
490 * symtab.h (is_externally_visible): Check if the symbol is not forced
493 2011-07-15 Ian Lance Taylor <iant@google.com>
495 * options.h (class General_options): Add --print-output-format.
496 Move -EL next to -EB, for better --help output.
497 * target-select.cc: Include <cstdio>, "options.h", and
499 (Target_selector::do_target_bfd_name): New function.
500 (print_output_format): New function.
501 * target-select.h (class Target_selector): Update declarations.
502 (Target_selector::target_bfd_name): New function.
503 (print_output_format): Declare.
504 * main.cc: Include "target-select.h".
505 (main): Handle --print-output-format.
506 * gold.cc: Include "target-select.h".
507 (queue_initial_tasks): Handle --print-output-format when there are
509 * parameters.cc (parameters_force_valid_target): Give a better
510 error message if -EB/-EL does not match target.
511 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
514 2011-07-15 Ian Lance Taylor <iant@google.com>
516 * i386.cc (class Output_data_plt_i386): Add layout_ field.
517 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
518 (Output_data_plt_i386::do_write): Write address of .dynamic
519 section to first entry in .got.plt section.
520 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
521 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
523 (Output_data_plt_x86_64::do_write): Write address of .dynamic
524 section to first entry in .got.plt section.
525 * layout.h (Layout::dynamic_section): New function.
527 2011-07-13 Sriraman Tallam <tmsriram@google.com>
529 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
531 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
532 input_section_position_, and input_section_glob_.
533 (read_layout_from_file): Call function section_ordering_specified.
534 * layout.h (is_section_ordering_specified): New function.
535 (section_ordering_specified): New function.
536 (section_ordering_specified_): New boolean member.
537 * main.cc(main): Call load_plugins after layout object is defined.
538 * output.cc (Output_section::add_input_section): Use
539 function section_ordering_specified to check if section ordering is
541 * output.cc (Output_section::add_relaxed_input_section): Use
542 function section_ordering_specified to check if section ordering is
544 (Output_section::update_section_layout): New function.
545 (Output_section::sort_attached_input_sections): Check if input section
547 * output.h (Output_section::update_section_layout): New function.
548 * plugin.cc (get_section_count): New function.
549 (get_section_type): New function.
550 (get_section_name): New function.
551 (get_section_contents): New function.
552 (update_section_order): New function.
553 (allow_section_ordering): New function.
554 (Plugin::load): Add the new interfaces to the transfer vector.
555 (Plugin_manager::load_plugins): New parameter.
556 (Plugin_manager::all_symbols_read): New parameter.
557 (Plugin_manager::claim_file): New parameter. Save the elf object for
559 (Plugin_manager::get_elf_object): New function.
560 (Plugin_manager::get_view): Change to directly use the bool to check
561 if get_view is called from claim_file_hook.
562 * plugin.h (input_objects): New function
563 (Plugin__manager::load_plugins): New parameter.
564 (Plugin_manager::claim_file): New parameter.
565 (Plugin_manager::get_elf_object): New function.
566 (Plugin_manager::in_claim_file_handler): New function.
567 (Plugin_manager::in_claim_file_handler_): New member.
568 (layout): New function.
569 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
570 handler with an extra parameter. Make the elf object before calling
572 * testsuite/plugin_test.c (get_section_count): New function pointer.
573 (get_section_type): New function pointer.
574 (get_section_name): New function pointer.
575 (get_section_contents): New function pointer.
576 (update_section_order): New function pointer.
577 (allow_section_ordering): New function pointer.
578 (onload): Check if the new interfaces exist.
580 2011-07-13 Ian Lance Taylor <iant@google.com>
582 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
584 * x86_64.cc (Target_x86_64::got_section): Likewise.
585 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
586 (relro_now_test_SOURCES): New variable.
587 (relro_now_test_DEPENDENCIES): New variable.
588 (relro_now_test_LDFLAGS): New variable.
589 (relro_now_test_LDADD): New variable.
590 (relro_now_test.so): New target.
591 * testsuite/Makefile.in: Rebuild.
593 2011-07-12 Ian Lance Taylor <iant@google.com>
596 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
597 GLOB_DAT relocation rather than a RELATIVE relocation for a
598 protected symbol when creating a shared library.
599 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
600 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
601 * testsuite/protected_main_1.cc (main): Test that protected
602 function has same address.
604 2011-07-11 Ian Lance Taylor <iant@google.com>
607 * options.h (class General_options): Add -Bgroup.
608 * options.cc (General_options::finalize): If -Bgroup is set,
609 default to --unresolved-symbols=report-all.
610 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
611 * target-reloc.h (issue_undefined_symbol_error): Handle
612 --unresolved-symbols=report-all.
614 2011-07-08 Ian Lance Taylor <iant@google.com>
617 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
618 if linker script discards key sections.
619 (Layout::create_dynamic_symtab): Likewise.
620 (Layout::assign_local_dynsym_offsets): Likewise.
621 (Layout::sized_create_version_sections): Likewise.
622 (Layout::create_interp): Likewise.
623 (Layout::finish_dynamic_section): Likewise.
624 (Layout::set_dynamic_symbol_size): Likewise.
626 2011-07-08 Ian Lance Taylor <iant@google.com>
629 * options.h (class General_options): Add --unresolved-symbols.
630 * target-reloc.h (issue_undefined_symbol_error): Check
631 --unresolved-symbols. Add comments.
633 2011-07-08 Ian Lance Taylor <iant@google.com>
635 * testsuite/odr_violation2.cc (Ordering::operator()): Make
636 expression more complex.
638 2011-07-08 Ian Lance Taylor <iant@google.com>
641 * target-reloc.h (issue_undefined_symbol_error): New inline
642 function, broken out of relocate_section.
643 (relocate_section): Call issue_undefined_symbol_error.
644 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
645 there is no TLS segment if we are about to issue an undefined
647 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
649 2011-07-08 Ian Lance Taylor <iant@google.com>
652 * resolve.cc (Symbol_table::should_override): Add fromtype
653 parameter. Change all callers. Give error when linking together
654 TLS and non-TLS symbol.
655 (Symbol_table::should_override_with_special): Add fromtype
656 parameter. Change all callers.
657 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
658 there is no TLS segment if we have reported some errors.
659 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
661 2011-07-08 Ian Lance Taylor <iant@google.com>
664 * target.h (Target::plt_address_for_global): New function.
665 (Target::plt_address_for_local): New function.
666 (Target::plt_section_for_global): Remove.
667 (Target::plt_section_for_local): Remove.
668 (Target::do_plt_address_for_global): New virtual function.
669 (Target::do_plt_address_for_local): New virtual function.
670 (Target::do_plt_section_for_global): Remove.
671 (Target::do_plt_section_for_local): Remove.
672 (Target::register_global_plt_entry): Add Symbol_table and Layout
674 * output.cc (Output_data_got::Got_entry::write): Use
675 plt_address_for_global and plt_address_for_local.
676 * layout.cc (Layout::add_target_dynamic_tags): Use size and
677 address of output section.
678 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
679 got_irelative_, and irelative_count_ fields. Update
681 (Output_data_plt_i386::has_irelative_section): New function.
682 (Output_data_plt_i386::entry_count): Add irelative_count_.
683 (Output_data_plt_i386::set_final_data_size): Likewise.
684 (class Target_i386): Add got_irelative_ and rel_irelative_
685 fields. Update declarations.
686 (Target_i386::Target_i386): Initialize new fields.
687 (Target_i386::do_plt_address_for_global): New function replacing
688 do_plt_section_for_global.
689 (Target_i386::do_plt_address_for_local): New function replacing
690 do_plt_section_for_local.
691 (Target_i386::got_section): Create got_irelative_.
692 (Target_i386::rel_irelative_section): New function.
693 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
694 fields. Don't define __rel_iplt_{start,end}.
695 (Output_data_plt_i386::add_entry): Add symtab and layout
696 parameters. Change all callers. Use different PLT and GOT for
698 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
699 layout parameters. Change all callers. Use different PLT and
701 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
702 (Output_data_plt_i386::rel_irelative): New function.
703 (Output_data_plt_i386::address_for_global): New function.
704 (Output_data_plt_i386::address_for_local): New function.
705 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
706 IRELATIVE GOT when changing IFUNC GOT entries.
707 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
709 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
710 if we didn't create an IRELATIVE GOT.
711 (Target_i386::Relocate::relocate): Use plt_address_for_global and
712 plt_address_for_local.
713 (Target_i386::do_dynsym_value): Use plt_address_for_global.
714 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
715 got_irelative_, and irelative_count_ fields. Update
717 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
718 Initialize new fields. Remove symtab parameter. Change all
720 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
722 (Output_data_plt_x86_64::has_irelative_section): New function.
723 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
724 (class Target_x86_64): Add got_irelative_ and rel_irelative_
725 fields. Update declarations.
726 (Target_x86_64::Target_x86_64): Initialize new fields.
727 (Target_x86_64::do_plt_address_for_global): New function replacing
728 do_plt_section_for_global.
729 (Target_x86_64::do_plt_address_for_local): New function replacing
730 do_plt_section_for_local.
731 (Target_x86_64::got_section): Create got_irelative_.
732 (Target_x86_64::rela_irelative_section): New function.
733 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
734 all callers. Don't create __rel_iplt_{start,end}.
735 (Output_data_plt_x86_64::add_entry): Add symtab and layout
736 parameters. Change all callers. Use different PLT and GOT for
738 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
739 layout parameters. Change all callers. Use different PLT and
741 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
742 parameters. Change all callers. Use different PLT and GOT for
744 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
745 (Output_data_plt_x86_64::rela_irelative): New function.
746 (Output_data_plt_x86_64::address_for_global): New function.
747 (Output_data_plt_x86_64::address_for_local): New function.
748 (Output_data_plt_x86_64::set_final_data_size): Likewise.
749 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
750 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
751 (Target_x86_64::register_global_plt_entry): Add symtab and layout
753 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
755 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
756 symbols if we didn't create an IRELATIVE GOT.
757 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
758 plt_address_for_local.
759 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
760 * testsuite/ifuncvar1.c: New test file.
761 * testsuite/ifuncvar2.c: New test file.
762 * testsuite/ifuncvar3.c: New test file.
763 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
764 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
765 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
766 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
767 * testsuite/Makefile.in: Rebuild.
769 2011-07-07 Cary Coutant <ccoutant@google.com>
771 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
772 (two_file_test_1_ndebug.o): Likewise.
773 (two_file_test_1b_ndebug.o): Likewise.
774 (two_file_test_2_ndebug.o): Likewise.
775 (two_file_test_main_ndebug.o): Likewise.
776 (incremental_test_2): Link with no-debug versions.
778 2011-07-06 Cary Coutant <ccoutant@google.com>
780 * gold/incremental.cc
781 (Output_section_incremental_inputs::write_info_blocks): Check for
782 hidden and internal symbols.
784 2011-07-06 Cary Coutant <ccoutant@google.com>
786 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
787 Check disposition for startup file.
788 (Incremental_inputs::report_command_line): Ignore
789 --incremental-startup-unchanged option.
790 * options.cc (General_options::parse_incremental_startup_unchanged):
792 (General_options::General_options): Initialize new data member.
793 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
794 (General_options): Add --incremental-startup-unchanged option.
795 (General_options::incremental_startup_disposition): New function.
796 (General_options::incremental_startup_disposition_): New data member.
798 2011-07-06 Cary Coutant <ccoutant@google.com>
800 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
801 input file index to Script_info ctor.
802 (Sized_incremental_binary::do_file_has_changed): Find the
803 command-line argument for files named in scripts.
804 * incremental.h (Script_info::Script_info): New ctor
805 with input file index.
806 (Script_info::input_file_index): New function.
807 (Script_info::input_file_index_): New data member.
808 (Incremental_binary::get_library): Add const.
809 (Incremental_binary::get_script_info): Add const.
810 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
811 * testsuite/Makefile.am (incremental_test_5): New test case.
812 (incremental_test_6): New test case.
813 * testsuite/Makefile.in: Regenerate.
815 2011-07-06 Cary Coutant <ccoutant@google.com>
817 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
818 debug output when command lines differ.
820 2011-07-06 Cary Coutant <ccoutant@google.com>
822 * incremental.cc (Incremental_inputs::report_command_line): Ignore
823 --incremental-patch option.
824 * layout.cc (Free_list::allocate): Extend allocation beyond original
826 (Layout::make_output_section): Mark sections that should get
828 * options.cc (parse_percent): New function.
829 * options.h (parse_percent): New function.
830 (DEFINE_percent): New macro.
831 (General_options): Add --incremental-patch option.
832 * output.cc (Output_section::Output_section): Initialize new data
834 (Output_section::add_input_section): Print section name when out
836 (Output_section::add_output_section_data): Likewise.
837 (Output_section::set_final_data_size): Add patch space when
838 doing --incremental-full.
839 (Output_section::do_reset_address_and_file_offset): Remove patch
841 (Output_segment::set_section_list_addresses): Print debug output
842 only if --incremental-update.
843 * output.h (Output_section::set_is_patch_space_allowed): New function.
844 (Output_section::is_patch_space_allowed_): New data member.
845 (Output_section::patch_space_): New data member.
846 * parameters.cc (Parameters::incremental_full): New function.
847 * parameters.h (Parameters::incremental_full): New function
848 * testsuite/Makefile.am (incremental_test_2): Add test for
849 --incremental-patch option.
850 * testsuite/Makefile.in: Regenerate.
851 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
852 (t18): Remove function body.
854 2011-07-05 Doug Kwan <dougkwan@google.com>
857 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
858 Arm_Address type for relocation result.
859 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
861 (Arm_relocate_functions::abs32): Use unaligned access.
862 (Arm_relocate_functions::rel32): Ditto.
863 (Arm_relocate_functions::prel31): Ditto.
864 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
865 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
866 static data relocations.
867 * testsuite/Makefile.in: Regnerate.
868 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
870 2011-07-05 Ian Lance Taylor <iant@google.com>
873 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
874 symbols if necessary.
875 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
877 2011-07-05 Ian Lance Taylor <iant@google.com>
880 * resolve.cc (Symbol::override_base_with_special): Simply override
881 version with special symbol version, ignoring previous version.
883 2011-07-05 Ian Lance Taylor <iant@google.com>
885 * object.cc (Sized_relobj_file::include_section_group): Add
886 information to comment about signature location.
888 2011-07-02 Ian Lance Taylor <iant@google.com>
891 * options.h (class General_options): Add -f and -F.
892 * options.cc (General_options::finalize): Fatal error if -f/-F
893 are used without -shared.
894 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
896 2011-07-02 Ian Lance Taylor <iant@google.com>
898 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
900 2011-07-01 Ian Lance Taylor <iant@google.com>
904 * resolve.cc (Symbol::override_base_with_special): Don't override
905 the version if the overriding symbol has a different name.
906 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
907 all callers. If we give an error about an undefined version,
908 define the base version if necessary.
909 * dynobj.h (class Versions): Update declaration.
910 * testsuite/weak_alias_test_5.cc: New file.
911 * testsuite/weak_alias_test.script: New file.
912 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
913 and versioned_alias have the right value, and call t2.
914 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
915 weak_alias_test_5.so.
916 (weak_alias_test_LDADD): Likewise.
917 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
918 * testsuite/Makefile.in: Rebuild.
920 2011-07-01 Ian Lance Taylor <iant@google.com>
923 * options.h (class General_options): Support -z notext.
924 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
926 (two_file_shared_nonpic.so): Likewise.
927 (two_file_shared_mixed.so): Likewise.
928 (two_file_shared_mixed_1.so): Likewise.
929 (weak_undef_lib_nonpic.so): Likewise.
930 (alt/weak_undef_lib_nonpic.so): Likewise.
931 (tls_test_shared_nonpic.so): Likewise.
932 * testsuite/Makefile.in: Rebuild.
934 2011-07-01 Ian Lance Taylor <iant@google.com>
937 * configure.ac: Test whether static linking works, setting
938 the automake conditional HAVE_STATIC.
939 * testsuite/Makefile.am: Disable tests using -static if
940 HAVE_STATIC is not true.
941 * configure, testsuite/Makefile.in: Rebuild.
943 2011-07-01 Ian Lance Taylor <iant@google.com>
946 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
947 Assert if we see DW_EH_PE_indirect.
948 * target.h (Target::ehframe_datarel_base): New function.
949 (Target::do_ehframe_datarel_base): New target function.
950 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
951 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
954 2011-07-01 Ian Lance Taylor <iant@google.com>
957 * options.h (class General_options): Add
958 --ld-generated-unwind-info.
959 * ehframe.cc (Fde::write): Add address parameter. Change all
960 callers. If associated with PLT, fill in address and size.
961 (Cie::set_output_offset): Only add merge mapping if there is an
963 (Cie::write): Add address parameter. Change all callers.
964 (Eh_frame::add_ehframe_for_plt): New function.
965 * ehframe.h (class Fde): Update declarations. Move shndx_ and
966 input_offset_ fields into union u_, with new plt field.
967 (Fde::Fde): Adjust for new union field.
968 (Fde::Fde) [Output_data version]: New constructor.
969 (Fde::add_mapping): Only add merge mapping if there is an object.
970 (class Cie): Update declarations.
971 (class Eh_frame): Declare add_ehframe_for_plt.
972 * layout.cc (Layout::layout_eh_frame): Break out code into
973 make_eh_frame_section, and call it.
974 (Layout::make_eh_frame_section): New function.
975 (Layout::add_eh_frame_for_plt): New function.
976 * layout.h (class Layout): Update declarations.
977 * merge.cc (Merge_map::add_mapping): Add assertion.
978 * i386.cc: Include "dwarf.h".
979 (class Output_data_plt_i386): Make first_plt_entry,
980 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
981 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
982 and plt_eh_frame_fde.
983 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
984 boundary. Call add_eh_frame_for_plt if appropriate.
985 * x86_64.cc: Include "dwarf.h".
986 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
987 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
988 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
989 and plt_eh_frame_fde.
990 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
993 2011-06-29 Ian Lance Taylor <iant@google.com>
996 * object.cc (Sized_relobj_file::layout_section): Change shdr
997 parameter to be const.
998 (Sized_relobj_file::layout_eh_frame_section): New function, broken
1000 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
1001 appropriate. Call layout_eh_frame_section.
1002 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
1004 * object.h (class Sized_relobj_file): Update declarations.
1006 2011-06-29 Ian Lance Taylor <iant@google.com>
1009 * script.cc (Token::integer_value): Accept trailing M/m/K/k
1011 (Lex::gather_token): Accept trailing M/m/K/k for integers.
1013 2011-06-29 Ian Lance Taylor <iant@google.com>
1016 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
1018 * layout.cc (Layout::layout_eh_frame): Likewise.
1020 2011-06-29 Ian Lance Taylor <iant@google.com>
1023 * layout.cc (Layout::symtab_section_shndx): New function.
1024 * layout.h (class Layout): Declare symtab_section_shndx.
1025 * output.cc (Output_section::write_header): Call it.
1027 2011-06-29 Ian Lance Taylor <iant@google.com>
1030 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
1031 symbols which are not used in a relocation.
1033 2011-06-28 Ian Lance Taylor <iant@google.com>
1036 * layout.cc (Layout::segment_precedes): Don't crash if a linker
1037 script create indistinguishable segments.
1038 (Layout::set_segment_offsets): Use stable_sort when sorting
1039 segments. Pass this to Compare_segments constructor.
1040 * layout.h (class Layout): Make segment_precedes non-static.
1041 (class Compare_segments): Change from struct to class. Add
1042 layout_ field. Add constructor.
1043 * script-sections.cc
1044 (Script_sections::attach_sections_using_phdrs_clause): Rename
1045 local orphan to is_orphan. Don't report failure to put empty
1046 section in segment. On attachment failure, report name of
1047 section, and attach to first PT_LOAD segment.
1049 2011-06-28 Ian Lance Taylor <iant@google.com>
1052 * target-select.cc (Target_selector::Target_selector): Add
1053 emulation parameter. Change all callers.
1054 (select_target_by_bfd_name): Rename from select_target_by_name.
1056 (select_target_by_emulation): New function.
1057 (supported_emulation_names): New function.
1058 * target-select.h (class Target_selector): Add emulation_ field.
1059 Update declarations.
1060 (Target_selector::recognize_by_bfd_name): Rename from
1061 recognize_by_name. Change all callers.
1062 (Target_selector::supported_bfd_names): Rename from
1063 supported_names. Change all callers.
1064 (Target_selector::recognize_by_emulation): New function.
1065 (Target_selector::supported_emulations): New function.
1066 (Target_selector::emulation): New function.
1067 (Target_selector::do_recognize_by_bfd_name): Rename from
1068 do_recognize_by_name. Change all callers.
1069 (Target_selector::do_supported_bfd_names): Rename from
1070 do_supported_names. Change all callers.
1071 (Target_selector::do_recognize_by_emulation): New function.
1072 (Target_selector::do_supported_emulations): New function.
1073 (select_target_by_bfd_name): Change name in declaration.
1074 (select_target_by_emulation): Declare.
1075 (supported_emulation_names): Declare.
1076 * parameters.cc (parameters_force_valid_target): Try to find
1077 target based on emulation from -m option.
1078 * options.h (class General_options): Change doc string for -m.
1079 * options.cc (help): Print emulations.
1080 (General_options::parse_V): Likewise.
1081 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1082 Add emulation parameter. Change all callers.
1084 2011-06-28 Ian Lance Taylor <iant@google.com>
1086 * target.h (class Target): Add osabi_ field.
1087 (Target::osabi): New function.
1088 (Target::set_osabi): New function.
1089 (Target::Target): Initialize osabi_.
1090 (Target::do_adjust_elf_header): Make pure virtual.
1091 (Sized_target::do_adjust_elf_header): Declare.
1092 * target.cc (Sized_target::do_adjust_elf_header): New function.
1093 (class Sized_target): Instantiate all versions.
1094 * freebsd.h (class Target_freebsd): Remove.
1095 (Target_selector_freebsd::do_recognize): Call set_osabi on
1097 (Target_selector_freebsd::do_recognize_by_name): Likewise.
1098 (Target_selector_freebsd::set_osabi): Remove.
1099 * i386.cc (class Target_i386): Inherit from Sized_target rather
1100 than Target_freebsd.
1101 * x86_64.cc (class Target_x86_64): Likewise.
1103 2011-06-28 Ian Lance Taylor <iant@google.com>
1105 * target.h (Target::can_check_for_function_pointers): Rewrite.
1107 (Target::can_icf_inline_merge_sections): Likewise.
1108 (Target::section_may_have_icf_unsafe_poineters): Likewise.
1109 (Target::Target_info): Add can_icf_inline_merge_sections field.
1110 (Target::do_can_check_for_function_pointers): New virtual
1112 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
1113 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
1114 from can_check_for_function_pointers, move in file.
1115 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
1116 section_may_have_icf_unsafe_poineters, move in file.
1117 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
1118 * i386.cc (Target_i386::do_can_check_for_function_pointers):
1119 Rename from can_check_for_function_pointers, move in file.
1120 (Target_i386::can_icf_inline_merge_sections): Remove.
1121 (Target_i386::i386_info): Initialize
1122 can_icf_inline_merge_sections.
1123 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1124 Initialize can_icf_inline_merge_sections.
1125 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
1126 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
1127 Rename from can_check_for_function_pointers, move in file.
1128 (Target_x86_64::can_icf_inline_merge_sections): Remove.
1129 (Target_x86_64::x86_64_info): Initialize
1130 can_icf_inline_merge_sections.
1131 * testsuite/testfile.cc (Target_test::test_target_info):
1133 * icf.cc (get_section_contents): Correct formatting.
1135 2011-06-27 Ian Lance Taylor <iant@google.com>
1137 * symtab.cc (Symbol::versioned_name): New function.
1138 (Symbol_table::add_to_final_symtab): Use versioned_name when
1140 (Symbol_table::sized_write_symbol): Likewise.
1141 * symtab.h (class Symbol): Declare versioned_name.
1142 * stringpool.h (class Stringpool_template): Add variant of add
1143 which takes a std::basic_string.
1144 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
1145 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
1146 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
1147 (ver_test_12.o): New target.
1148 * testsuite/Makefile.in: Rebuild.
1150 2011-06-27 Doug Kwan <dougkwan@google.com>
1152 * arm.cc (Arm_relocate_functions::thm_jump8,
1153 Arm_relocate_functions::thm_jump11): Use a wider signed
1154 type to compute offset.
1155 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
1157 * testsuite/Makefile.in: Regenerate.
1158 * testsuite/arm_branch_in_range.sh: Check test results of
1159 arm_thm_jump11 and arm_thm_jump8.
1160 * testsuite/arm_thm_jump11.s: New test source file.
1161 * testsuite/arm_thm_jump11.t: New linker script.
1162 * testsuite/arm_thm_jump8.s: New test source file.
1163 * testsuite/arm_thm_jump8.t: New linker script.
1165 2011-06-24 Ian Lance Taylor <iant@google.com>
1167 * layout.cc: Include "object.h".
1168 (ctors_sections_in_init_array): New static variable.
1169 (Layout::is_ctors_in_init_array): New function.
1170 (Layout::layout): Add entry to ctors_sections_in_init_array if
1172 * layout.h (class Layout): Declare is_ctors_in_init_array.
1173 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
1174 is_ctors_reverse_view is set.
1175 (Sized_relobj_file::write_sections): Add layout parameter. Change
1176 all callers. Set is_ctors_reverse_view field of View_size.
1177 (Sized_relobj_file::reverse_words): New function.
1178 * object.h (Sized_relobj_file::View_size): Add
1179 is_ctors_reverse_view field.
1180 (class Sized_relobj_file): Update declarations.
1181 * testsuite/initpri3.c: New test.
1182 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
1184 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
1185 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
1186 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
1187 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
1188 * testsuite/Makefile.in: Rebuild.
1190 2011-06-24 Cary Coutant <ccoutant@google.com>
1192 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
1193 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
1194 (debug_msg_cdebug.err): New targets.
1195 * testsuite/Makefile.in: Regenerate.
1196 * testsuite/debug_msg.sh: Check output of link with compressed debug.
1197 Fix checks for link with shared library.
1199 2011-06-24 Doug Kwan <dougkwan@google.com>
1201 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
1202 skip empty text sections.
1203 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
1205 2011-06-22 Ian Lance Taylor <iant@google.com>
1208 * options.h (class General_options): Add --ctors-in-init-array.
1209 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
1210 friends as SHT_PROGBITS for merging sections.
1211 (Layout::layout): Remove special handling of .init_array and
1212 friends. Don't sort if doing relocatable link. Sort for .ctors
1213 and .dtors if ctors_in_init_array.
1214 (Layout::make_output_section): Force correct section types for
1215 .init_array and friends. Don't sort if doing relocatable link,
1216 Don't sort .ctors and .dtors if ctors_in_init_array.
1217 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
1218 (Layout::output_section_name): Add relobj parameter. Change all
1219 callers. Handle .ctors. and .dtors. in code rather than table.
1220 Handle .ctors and .dtors if ctors_in_init_array.
1221 (Layout::match_file_name): New function, moved from output.cc.
1222 * layout.h (class Layout): Update declarations.
1223 * output.cc: Include "layout.h".
1224 (Input_section_sort_entry::get_priority): New function.
1225 (Input_section_sort_entry::match_file_name): Just call
1226 Layout::match_file_name.
1227 (Output_section::Input_section_sort_init_fini_compare::operator()):
1228 Handle .ctors and .dtors. Sort by explicit priority rather than
1230 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
1231 * testsuite/initpri2.c: New test.
1232 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
1233 (check_PROGRAMS): Add initpri2.
1234 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
1235 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
1236 * configure, testsuite/Makefile.in: Rebuild.
1238 2011-06-19 Ian Lance Taylor <iant@google.com>
1241 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
1242 .interp section to a PT_INTERP segment even if we have seen a
1243 --dynamic-linker option. Don't do it if we have seen a PHDRS
1244 clause in a linker script.
1245 (Layout::finalize): Don't create a .interp section if we've
1246 already create a PT_INTERP segment.
1247 (Layout::create_interp): Always call choose_output_section (revert
1248 patch of 2011-06-17). Don't create PT_INTERP segment.
1249 * script-sections.cc
1250 (Script_sections::create_note_and_tls_segments): Add a .interp
1251 section to a PT_INTERP segment even if we have seen a
1252 --dynamic-linker option.
1254 2011-06-18 Ian Lance Taylor <iant@google.com>
1256 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
1257 merely because a non-PT_LOAD segment has a dynamic reloc.
1259 2011-06-18 Ian Lance Taylor <iant@google.com>
1261 * layout.cc (Layout::finish_dynamic_section): Don't create
1262 DT_FLAGS entry if not needed.
1264 2011-06-18 Ian Lance Taylor <iant@google.com>
1267 * layout.cc (Layout::layout_eh_frame): Correct handling of
1268 writable .eh_frame section.
1270 2011-06-17 Ian Lance Taylor <iant@google.com>
1273 * resolve.cc (Symbol_table::resolve): Don't give an error if a
1274 symbol is redefined with the exact same object and value.
1276 2011-06-17 Ian Lance Taylor <iant@google.com>
1279 * layout.h (class Layout): Add interp_segment_ field.
1280 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
1281 (Layout::attach_allocated_section_to_segment): If making shared
1282 library, put .interp section in PT_INTERP segment.
1283 (Layout::finalize): Also call create_interp if -dynamic-linker
1285 (Layout::create_interp): Assert that there is no PT_INTERP
1286 segment. If not using a SECTIONS clause, use make_output_section.
1287 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
1288 * script-sections.cc
1289 (Script_sections::create_note_and_tls_segments): If making shared
1290 library, put .interp section in PT_INTERP segment.
1292 2011-06-17 Ian Lance Taylor <iant@google.com>
1294 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
1295 when making a shared library.
1297 2011-06-17 Ian Lance Taylor <iant@google.com>
1299 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
1300 parameter. Change all callers. Don't issue warning about PC32
1301 against locally defined symbol.
1303 2011-06-16 Ian Lance Taylor <iant@google.com>
1305 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
1306 occurs in same object.
1308 2011-06-14 Alan Modra <amodra@gmail.com>
1310 * po/POTFILES.in: Regenerate.
1312 2011-06-09 Ian Lance Taylor <iant@google.com>
1314 * script-sections.cc
1315 (Orphan_output_section::set_section_addresses): For a relocatable
1316 link set address to 0.
1318 2011-06-09 Cary Coutant <ccoutant@google.com>
1321 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
1322 used with --compress-debug-sections.
1323 * gold/object.cc (Sized_relobj_file::do_layout): Report
1324 uncompressed size of compressed input sections.
1326 2011-06-08 Cary Coutant <ccoutant@google.com>
1329 * testsuite/two_file_test_2_v1.cc: Change initialization of
1330 v2 to keep it in .data.
1332 2011-06-07 Cary Coutant <ccoutant@google.com>
1334 * common.cc (Symbol_table::do_allocate_commons_list): Call
1336 * errors.cc (Errors::fatal): Adjust call to gold_exit.
1337 (Errors::fallback): New function.
1338 (gold_fallback): New function.
1339 * errors.h (Errors::fallback): New function.
1340 * gold.cc (gold_exit): Change status parameter to enum; adjust
1342 (queue_initial_tasks): Call gold_fallback.
1343 * gold.h: Include cstdlib.
1344 (Exit_status): New enum type.
1345 (gold_exit): Change status parameter to enum.
1346 (gold_fallback): New function.
1347 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
1348 (Layout::create_symtab_sections): Likewise.
1349 (Layout::create_shdrs): Likewise.
1350 * main.cc (main): Adjust call to gold_exit.
1351 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
1352 (Output_data_got::add_got_entry_pair): Likewise.
1353 (Output_section::add_input_section): Likewise.
1354 (Output_section::add_output_section_data): Likewise.
1355 (Output_segment::set_section_list_addresses): Likewise.
1356 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
1358 2011-06-07 Cary Coutant <ccoutant@google.com>
1360 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
1361 for incremental links.
1362 * output.cc (Output_segment::set_section_list_addresses): Remove
1363 FIXME and test for TLS or BSS.
1365 2011-06-07 Cary Coutant <ccoutant@google.com>
1367 * testsuite/Makefile.am: Add incremental_copy_test,
1368 incremental_common_test_1.
1369 * testsuite/Makefile.in: Regenerate.
1370 * testsuite/common_test_1_v1.c: New source file.
1371 * testsuite/common_test_1_v2.c: New source file.
1372 * testsuite/copy_test_v1.cc: New source file.
1374 2011-06-07 Cary Coutant <ccoutant@google.com>
1376 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
1377 update, allocate common from bss section's free list.
1378 * incremental-dump.cc (dump_incremental_inputs): Print flag for
1379 linker-defined symbols.
1380 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1381 Skip GOT and PLT entries that are no longer referenced.
1382 (Output_section_incremental_inputs::write_info_blocks): Mark
1383 linker-defined symbols.
1384 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
1385 * output.cc (Output_section::allocate): New function.
1386 * output.h (Output_section::allocate): New function.
1387 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
1388 linker-defined symbols.
1389 (Symbol::override_base_with_special): Copy is_predefined_ flag.
1390 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
1391 (Symbol::init_base_output_data): Likewise.
1392 (Symbol::init_base_output_segment): Likewise.
1393 (Symbol::init_base_constant): Likewise.
1394 (Sized_symbol::init_output_data): Likewise.
1395 (Sized_symbol::init_output_segment): Likewise.
1396 (Sized_symbol::init_constant): Likewise.
1397 (Symbol_table::do_define_in_output_data): Likewise.
1398 (Symbol_table::do_define_in_output_segment): Likewise.
1399 (Symbol_table::do_define_as_constant): Likewise.
1400 * symtab.h (Symbol::is_predefined): New function.
1401 (Symbol::init_base_output_data): Add is_predefined parameter.
1402 (Symbol::init_base_output_segment): Likewise.
1403 (Symbol::init_base_constant): Likewise.
1404 (Symbol::is_predefined_): New data member.
1405 (Sized_symbol::init_output_data): Add is_predefined parameter.
1406 (Sized_symbol::init_output_segment): Likewise.
1407 (Sized_symbol::init_constant): Likewise.
1408 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
1410 2011-06-07 Cary Coutant <ccoutant@google.com>
1412 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
1413 instead of emit_copy_reloc.
1414 (Copy_relocs::emit_copy_reloc): Refactor.
1415 (Copy_relocs::make_copy_reloc): New function.
1416 (Copy_relocs::add_copy_reloc): Remove.
1417 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
1419 (Copy_relocs::make_copy_reloc): New function.
1420 (Copy_relocs::add_copy_reloc): Remove.
1421 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
1422 unchanged input files.
1423 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
1424 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
1425 Reserve BSS space for COPY relocations.
1426 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1427 (Output_section_incremental_inputs::write_info_blocks): Record
1428 whether a symbol is copied from a shared object.
1429 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
1430 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
1431 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
1432 (Incremental_input_entry_reader::get_output_symbol_index): Add
1434 (Incremental_binary::emit_copy_relocs): New function.
1435 (Incremental_binary::do_emit_copy_relocs): New function.
1436 (Sized_incremental_binary::Sized_incremental_binary): Initialize
1438 (Sized_incremental_binary::add_copy_reloc): New function.
1439 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1440 (Sized_incremental_binary::Copy_reloc): New struct.
1441 (Sized_incremental_binary::Copy_relocs): New typedef.
1442 (Sized_incremental_binary::copy_relocs_): New data member.
1443 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
1444 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
1445 * target.h (Sized_target::emit_copy_reloc): New function.
1446 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
1448 2011-06-02 Cary Coutant <ccoutant@google.com>
1451 * gold/archive.cc (Archive::Archive): Initialize new data member.
1452 (Archive::include_all_members): Return if archive has already been
1454 * gold/archive.h (Archive::include_all_members_): New data member.
1456 2011-06-02 Nick Clifton <nickc@redhat.com>
1458 * dynobj.h: Fix spelling mistake in comment.
1459 * output.cc: Likewise.
1461 2011-05-31 Doug Kwan <dougkwan@google.com>
1465 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
1466 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
1467 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
1468 redundant arm_exidx_test.so.
1469 * testsuite/Makefile.in: Regenerate.
1470 (check_SCRIPTS): Add pr12826.sh
1471 (check_DATA): Add pr12826.stdout
1472 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
1473 * testsuite/pr12826.sh: New file.
1474 * testsuite/pr12826_1.s: Ditto.
1475 * testsuite/pr12826_1.s: Ditto.
1477 2011-05-30 Ian Lance Taylor <iant@google.com>
1479 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
1482 2011-05-29 Ian Lance Taylor <iant@google.com>
1485 * testsuite/Makefile.am: Use different file name for two_file_test
1486 temporary file for each incremental test.
1487 * testsuite/Makefile.in: Rebuild.
1489 2011-05-29 Ian Lance Taylor <iant@google.com>
1491 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
1492 binary input file is empty.
1494 2011-05-27 Ian Lance Taylor <iant@google.com>
1496 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
1497 (ver_test_9.so): Likewise.
1498 * testsuite/Makefile.in: Rebuild.
1500 2011-05-26 Cary Coutant <ccoutant@google.com>
1502 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
1503 * incremental.cc (Incremental_inputs::report_input_section): Fix
1504 comment, indentation.
1505 (Incremental_inputs::report_comdat_group): New function.
1506 (Output_section_incremental_inputs::set_final_data_size): Adjust size
1507 of data for incremental input file entry.
1508 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
1509 group count, COMDAT group signatures.
1510 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
1511 an unchanged input file.
1512 * incremental.h (Incremental_object_entry::Incremental_object_entry):
1513 Initialize new data member.
1514 (Incremental_object_entry::add_comdat_group): New function.
1515 (Incremental_object_entry::get_comdat_group_count): New function.
1516 (Incremental_object_entry::get_comdat_signature_key): New function.
1517 (Incremental_object_entry::groups_): New data member.
1518 (Incremental_inputs::report_comdat_group): New function.
1519 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
1520 data for incremental input file entry.
1521 (Incremental_input_entry_reader::get_comdat_group_count): New function.
1522 (Incremental_input_entry_reader::get_input_section): Adjust size of
1523 data for incremental input file entry.
1524 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
1525 (Incremental_input_entry_reader::get_comdat_group_signature): New
1527 * object.cc (Sized_relobj::include_section_group): Report kept
1528 COMDAT groups for incremental links.
1530 2011-05-24 David Meyer <pdox@google.com>
1532 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
1533 with name parameter. Add found_name parameter.
1534 * fileread.cc (Input_file::find_file): Adjust code accordingly.
1535 * dirsearch.h (class Dirsearch): Update declaration.
1537 2011-05-24 Ian Lance Taylor <iant@google.com>
1539 * archive.cc (Library_base::should_include_member): Pull in object
1540 from archive if it defines the entry symbol.
1541 * parameters.cc (Parameters::entry): New function.
1542 * parameters.h (class Parameters): Declare entry.
1543 * output.h (class Output_file_header): Remove entry_ field.
1544 * output.cc (Output_file_header::Output_file_header): Remove entry
1545 parameter. Change all callers.
1546 (Output_file_header::entry): Use parameters->entry.
1547 * gold.cc (queue_middle_tasks): Likewise.
1548 * plugin.cc (Plugin_hook::run): Likewise.
1550 2011-05-24 Cary Coutant <ccoutant@google.com>
1552 * gold.cc (queue_initial_tasks): Pass incremental base filename
1553 to Output_file::open_base_file; don't print error message.
1554 * incremental-dump.cc (main): Adjust call to
1555 Output_file::open_for_modification.
1556 * incremental-dump.cc (main): Likewise.
1557 * incremental.cc (Incremental_inputs::report_command_line):
1558 Ignore --incremental-base option when comparing command lines.
1559 Ignore parameter when given as separate argument.
1560 * options.h (class General_options): Add --incremental-base.
1561 * output.cc (Output_file::Output_file):
1562 (Output_file::open_base_file): Add base_name and writable parameters;
1563 read base file into new file; print error message here.
1564 (Output_file::map_no_anonymous): Add writable parameter; adjust all
1566 * output.h (Output_file::open_for_modification): Rename to...
1567 (Output_file::open_base_file): ...this; add base_name and
1568 writable parameters; adjust all callers.
1569 (Output_file::map_no_anonymous): Add writable parameter; adjust all
1571 * testsuite/Makefile.am (incremental_test_4): Test
1573 * testsuite/Makefile.in: Regenerate.
1575 2011-05-24 Cary Coutant <ccoutant@google.com>
1577 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
1579 * testsuite/Makefile.in: Regenerate.
1580 * testsuite/two_file_test_1_v1.cc: New test source file.
1581 * testsuite/two_file_test_1b_v1.cc: New test source file.
1582 * testsuite/two_file_test_2_v1.cc: New test source file.
1584 2011-05-24 Cary Coutant <ccoutant@google.com>
1586 * dynobj.h (Dynobj::do_dynobj): New function.
1587 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
1588 flag and soname for shared objects.
1589 * incremental.cc (Incremental_inputs::report_object): Make
1590 either Incremental_object_entry or Incremental_dynobj_entry; add
1591 soname to string table.
1592 (Incremental_inputs::report_input_section): Add assertion.
1593 (Output_section_incremental_inputs::set_final_data_size): Adjust
1594 type of input file entry for shared libraries; adjust size of
1595 shared library info entry.
1596 (Output_section_incremental_inputs::write_input_files): Write
1597 as_needed flag for shared libraries.
1598 (Output_section_incremental_inputs::write_info_blocks): Adjust type
1599 of input file entry for shared libraries; write soname.
1600 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
1601 soname from incremental info.
1602 * incremental.h (enum Incremental_input_flags): Add
1603 INCREMENTAL_INPUT_AS_NEEDED.
1604 (Incremental_input_entry::Incremental_input_entry): Initialize new
1606 (Incremental_input_entry::set_as_needed): New function.
1607 (Incremental_input_entry::as_needed): New function.
1608 (Incremental_input_entry::do_dynobj_entry): New function.
1609 (Incremental_input_entry::as_needed_): New data member.
1610 (Incremental_object_entry::Incremental_object_entry): Don't check
1612 (Incremental_object_entry::do_type): Likewise.
1613 (class Incremental_dynobj_entry): New class.
1614 (Incremental_input_entry_reader::as_needed): New function.
1615 (Incremental_input_entry_reader::get_soname): New function.
1616 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
1617 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
1618 size of shared library info entry.
1619 * layout.cc (Layout::finish_dynamic_section): Don't test for
1620 incremental link when adding DT_NEEDED entries.
1621 * object.h (Object::Object): Initialize new data member.
1622 (Object::dynobj): New function.
1623 (Object::set_as_needed): New function.
1624 (Object::as_needed): New function.
1625 (Object::do_dynobj): New function.
1626 (Object::as_needed_): New data member.
1628 2011-05-24 Cary Coutant <ccoutant@google.com>
1630 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
1631 info; adjust display of GOT entries.
1632 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1633 vector of input objects; remove file_status_.
1634 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
1635 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
1636 got_plt reader; call target hooks to reserve GOT entries.
1637 (Output_section_incremental_inputs::set_final_data_size): Adjust size
1638 of input file info header and GOT info entry.
1639 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
1641 (Got_plt_view_info::got_descriptor): Remove.
1642 (Got_plt_view_info::sym_index): New data member.
1643 (Got_plt_view_info::input_index): New data member.
1644 (Local_got_offset_visitor::visit): Write input file index.
1645 (Global_got_offset_visitor::visit): Write 0 for input file index.
1646 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
1647 with sym_index and input_index.
1648 (Output_section_incremental_inputs::write_got_plt): Adjust size of
1649 incremental info GOT entry; replace got_descriptor with input_index.
1650 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
1651 map from input file index to object.
1652 (Sized_relobj_incr::do_layout): Replace direct data member reference
1653 with accessor function.
1654 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
1655 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
1656 Adjust size of input file info header.
1657 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
1658 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
1659 (Incremental_input_entry_reader::get_input_section): Adjust size of
1660 input file info header.
1661 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
1662 of incremental info GOT entry.
1663 (Incremental_got_plt_reader::get_got_desc): Remove.
1664 (Incremental_got_plt_reader::get_got_symndx): New function.
1665 (Incremental_got_plt_reader::get_got_input_index): New function.
1666 (Sized_incremental_binary::Sized_incremental_binary): Remove
1667 file_status_; add input_objects_.
1668 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
1669 (Sized_incremental_binary::set_file_is_unchanged): Remove.
1670 (Sized_incremental_binary::file_is_unchanged): Remove.
1671 (Sized_incremental_binary::set_input_object): New function.
1672 (Sized_incremental_binary::input_object): New function.
1673 (Sized_incremental_binary::file_status_): Remove.
1674 (Sized_incremental_binary::input_objects_): New data member.
1675 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
1677 (Sized_relobj_incr::invalid_address): Move to base class.
1678 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
1680 (Sized_relobj_incr::do_output_section_offset): Likewise.
1681 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
1682 (Sized_relobj_incr::section_offsets_): Likewise.
1683 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
1685 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
1686 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
1687 with accessor function.
1688 (Sized_relobj_file::do_layout): Likewise.
1689 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
1690 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
1691 (Sized_relobj_file::compute_final_local_value): Replace refs to
1692 section_offsets_ with accessor function.
1693 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
1694 * object.h (Relobj::Relobj): Initialize new data members.
1695 (Relobj::add_dyn_reloc): New function.
1696 (Relobj::first_dyn_reloc): New function.
1697 (Relobj::dyn_reloc_count): New function.
1698 (Relobj::first_dyn_reloc_): New data member.
1699 (Relobj::dyn_reloc_count_): New data member.
1700 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
1702 (Sized_relobj::Address): New typedef.
1703 (Sized_relobj::invalid_address): Move here from child class.
1704 (Sized_relobj::Sized_relobj): Initialize new data members.
1705 (Sized_relobj::sized_relobj): New function.
1706 (Sized_relobj::is_output_section_offset_invalid): Move here from
1708 (Sized_relobj::get_output_section_offset): Likewise.
1709 (Sized_relobj::local_has_got_offset): Likewise.
1710 (Sized_relobj::local_got_offset): Likewise.
1711 (Sized_relobj::set_local_got_offset): Likewise.
1712 (Sized_relobj::do_for_all_local_got_entries): Likewise.
1713 (Sized_relobj::clear_got_offsets): New function.
1714 (Sized_relobj::section_offsets): Move here from child class.
1715 (Sized_relobj::do_output_section_offset): Likewise.
1716 (Sized_relobj::do_set_section_offset): Likewise.
1717 (Sized_relobj::Local_got_offsets): Likewise.
1718 (Sized_relobj::local_got_offsets_): Likewise.
1719 (Sized_relobj::section_offsets_): Likewise.
1720 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
1722 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
1724 (Sized_relobj_file::sized_relobj): New function
1725 (Sized_relobj_file::local_has_got_offset): Move to base class.
1726 (Sized_relobj_file::local_got_offset): Likewise.
1727 (Sized_relobj_file::set_local_got_offset): Likewise.
1728 (Sized_relobj_file::get_output_section_offset): Likewise.
1729 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
1730 (Sized_relobj_file::do_output_section_offset): Likewise.
1731 (Sized_relobj_file::do_set_section_offset): Likewise.
1732 (Sized_relobj_file::Local_got_offsets): Likewise.
1733 (Sized_relobj_file::local_got_offsets_): Likewise.
1734 (Sized_relobj_file::section_offsets_): Likewise.
1735 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
1737 (set_needs_dynsym_index): Convert relobj to derived class pointer.
1738 (Output_reloc::get_symbol_index): Likewise.
1739 (Output_reloc::local_section_offset): Likewise.
1740 (Output_reloc::get_address): Likewise.
1741 (Output_reloc::symbol_value): Likewise.
1742 (Output_data_got::reserve_slot): Move to class definition.
1743 (Output_data_got::reserve_local): New function.
1744 (Output_data_got::reserve_slot_for_global): Remove.
1745 (Output_data_got::reserve_global): New function.
1746 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
1747 (all constructors, two instantiations).
1748 (Output_reloc::get_relobj): New function (two instantiations).
1749 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
1750 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
1751 (Output_data_reloc::add_global): Adjust type of relobj.
1752 (Output_data_reloc::add_global_relative): Likewise.
1753 (Output_data_reloc::add_symbolless_global_addend): Likewise.
1754 (Output_data_reloc::add_local): Likewise.
1755 (Output_data_reloc::add_local_relative): Likewise.
1756 (Output_data_reloc::add_symbolless_local_addend): Likewise.
1757 (Output_data_reloc::add_local_section): Likewise.
1758 (Output_data_reloc::add_output_section): Likewise.
1759 (Output_data_reloc::add_absolute): Likewise.
1760 (Output_data_reloc::add_target_specific): Likewise.
1761 (Output_data_got::reserve_slot): Move definition here.
1762 (Output_data_got::reserve_local): New function.
1763 (Output_data_got::reserve_global): New function.
1764 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
1765 section_offsets_ with accessor function.
1766 (Sized_relobj_file::write_sections): Likewise.
1767 (Sized_relobj_file::do_relocate_sections): Likewise.
1768 * target.h (Sized_target::reserve_local_got_entry): New function.
1769 (Sized_target::reserve_global_got_entry): New function.
1770 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
1771 (Target_x86_64::reserve_global_got_entry): New function.
1772 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
1774 2011-05-23 Cary Coutant <ccoutant@google.com>
1776 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
1777 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
1778 bit when checking got_type.
1779 * incremental.cc (Sized_incremental_binary::setup_readers):
1780 Store symbol table and string table locations; initialize bit vector
1781 of file status flags.
1782 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
1784 (Sized_incremental_binary::do_process_got_plt): New function.
1785 (Sized_incremental_binary::get_symtab_view): Use stored locations.
1786 (Output_section_incremental_inputs::set_final_data_size): Record
1787 file index for each input file.
1788 (Output_section_incremental_inputs::write_got_plt): Store file index
1789 instead of input entry offset for each GOT entry.
1791 (Incremental_input_entry::Incremental_input_entry): Initialize new
1793 (Incremental_input_entry::set_offset): Store file index.
1794 (Incremental_input_entry::get_file_index): New function.
1795 (Incremental_input_entry::file_index_): New data member.
1796 (Incremental_binary::process_got_plt): New function.
1797 (Incremental_binary::do_process_got_plt): New function.
1798 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1800 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
1801 (Sized_incremental_binary::set_file_is_unchanged): New function.
1802 (Sized_incremental_binary::file_is_unchanged): New function.
1803 (Sized_incremental_binary::do_process_got_plt): New function.
1804 (Sized_incremental_binary::file_status_): New data member.
1805 (Sized_incremental_binary::main_symtab_loc_): New data member.
1806 (Sized_incremental_binary::main_strtab_loc_): New data member.
1807 * output.cc (Output_data_got::Got_entry::write): Add case
1809 (Output_data_got::add_global): Call add_got_entry.
1810 (Output_data_got::add_global_plt): Likewise.
1811 (Output_data_got::add_global_with_rel): Likewise.
1812 (Output_data_got::add_global_with_rela): Likewise.
1813 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
1814 (Output_data_got::add_global_pair_with_rela): Likewise.
1815 (Output_data_got::add_local): Call add_got_entry.
1816 (Output_data_got::add_local_plt): Likewise.
1817 (Output_data_got::add_local_with_rel): Likewise.
1818 (Output_data_got::add_local_with_rela): Likewise.
1819 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
1820 (Output_data_got::add_local_pair_with_rela): Likewise.
1821 (Output_data_got::reserve_slot): New function.
1822 (Output_data_got::reserve_slot_for_global): New function.
1823 (Output_data_got::add_got_entry): New function.
1824 (Output_data_got::add_got_entry_pair): New function.
1825 (Output_section::add_output_section_data): Edit FIXME.
1827 (Output_section_data_build::Output_section_data_build): New
1828 constructor with size parameter.
1829 (Output_data_space::Output_data_space): Likewise.
1830 (Output_data_got::Output_data_got): Initialize new data member; new
1831 constructor with size parameter.
1832 (Output_data_got::add_constant): Call add_got_entry.
1833 (Output_data_got::reserve_slot): New function.
1834 (Output_data_got::reserve_slot_for_global): New function.
1835 (class Output_data_got::Got_entry): Add RESERVED_CODE.
1836 (Output_data_got::add_got_entry): New function.
1837 (Output_data_got::add_got_entry_pair): New function.
1838 (Output_data_got::free_list_): New data member.
1839 * target.h (Sized_target::init_got_plt_for_update): New function.
1840 (Sized_target::register_global_plt_entry): New function.
1841 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1842 Initialize new data member; call init; add constructor with PLT count.
1843 (Output_data_plt_x86_64::init): New function.
1844 (Output_data_plt_x86_64::add_relocation): New function.
1845 (Output_data_plt_x86_64::reserve_slot): New function.
1846 (Output_data_plt_x86_64::free_list_): New data member.
1847 (Target_x86_64::init_got_plt_for_update): New function.
1848 (Target_x86_64::register_global_plt_entry): New function.
1849 (Output_data_plt_x86_64::add_entry): Allocate from free list for
1850 incremental updates.
1851 (Output_data_plt_x86_64::add_relocation): New function.
1852 * testsuite/object_unittest.cc (Object_test): Set default options.
1854 2011-05-16 Ian Lance Taylor <iant@google.com>
1856 * options.h (class General_options): Make -i a synonym for -r.
1858 2011-05-16 Ian Lance Taylor <iant@google.com>
1860 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
1862 2011-05-10 Cary Coutant <ccoutant@google.com>
1864 * object.cc (Sized_relobj::do_count_local_symbols): Check for
1867 2011-05-06 Ian Lance Taylor <iant@google.com>
1869 * layout.cc (Layout::layout): If the output section flags change,
1870 update the ordering.
1872 2011-04-25 Cary Coutant <ccoutant@google.com>
1874 * incremental-dump.cc (dump_incremental_inputs): Print local
1875 symbol info for each input file.
1877 (Output_section_incremental_inputs::set_final_data_size): Add local
1878 symbol info to input file entries in incremental info.
1879 (Output_section_incremental_inputs::write_info_blocks): Likewise.
1880 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
1881 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
1882 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
1884 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
1885 (Sized_incr_relobj::do_relocate): Write the local symbols.
1886 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
1887 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
1888 Adjust size of input file header.
1889 (Incremental_inputs_reader::get_local_symbol_offset): New function.
1890 (Incremental_inputs_reader::get_local_symbol_count): New function.
1891 (Incremental_inputs_reader::get_input_section): Adjust size of input
1893 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
1894 (Sized_incr_relobj::This): New typedef.
1895 (Sized_incr_relobj::sym_size): New const data member.
1896 (Sized_incr_relobj::Local_symbol): New struct.
1897 (Sized_incr_relobj::do_output_local_symbol_count): New function.
1898 (Sized_incr_relobj::do_local_symbol_offset): New function.
1899 (Sized_incr_relobj::local_symbol_count_): New data member.
1900 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
1901 (Sized_incr_relobj::local_symbol_index_): New data member.
1902 (Sized_incr_relobj::local_symbol_offset_): New data member.
1903 (Sized_incr_relobj::local_dynsym_offset_): New data member.
1904 (Sized_incr_relobj::local_symbols_): New data member.
1905 * object.h (Relobj::output_local_symbol_count): New function.
1906 (Relobj::local_symbol_offset): New function.
1907 (Relobj::do_output_local_symbol_count): New function.
1908 (Relobj::do_local_symbol_offset): New function.
1909 (Sized_relobj::do_output_local_symbol_count): New function.
1910 (Sized_relobj::do_local_symbol_offset): New function.
1912 2011-04-22 Vladimir Simonov <sv@sw.ru>
1914 * descriptors.cc (set_close_on_exec): New function.
1915 (Descriptors::open): Use set_close_on_exec.
1916 * output.cc (S_ISLNK): Define if not defined.
1918 2011-04-22 Cary Coutant <ccoutant@google.com>
1920 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1922 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1923 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
1924 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
1926 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
1927 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
1928 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
1930 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
1932 (Incremental_binary::apply_incremental_relocs): New function.
1933 (Incremental_binary::do_apply_incremental_relocs): New function.
1934 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1936 (Sized_incremental_binary::add_global_symbol): New function.
1937 (Sized_incremental_binary::global_symbol): New function.
1938 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1939 (Sized_incremental_binary::symbol_map_): New data member.
1940 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
1941 * target.h (Sized_target::apply_relocation): New function.
1942 * target-reloc.h (apply_relocation): New function.
1943 * x86_64.cc (Target_x86_64::apply_relocation): New function.
1945 2011-04-22 Doug Kwan <dougkwan@google.com>
1947 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
1948 flag of a SHT_ARM_EXIDX section.
1949 * testsuite/Makefile.am (arm_exidx_test): New test rules.
1950 * testsuite/Makefile.in: Regenerate.
1951 * testsuite/arm_exidx_test.s: New file.
1952 * testsuite/arm_exidx_test.sh: Same.
1954 2011-04-20 Cary Coutant <ccoutant@google.com>
1957 * archive.h (Incremental_archive_entry::Archive_member):
1958 Initialize arg_serial_ (second constructor).
1960 2011-04-17 Ian Lance Taylor <iant@google.com>
1962 * object.cc (Relocate_info::location): Simplify location string.
1963 * errors.cc (Errors::error_at_location): Don't print program
1965 (Errors::warning_at_location): Likewise.
1966 (Errors::undefined_symbol): Likewise.
1967 * testsuite/debug_msg.sh: Update accordingly.
1969 2011-04-14 Cary Coutant <ccoutant@google.com>
1971 * gold/layout.cc (Layout::symtab_section_offset): New function.
1972 * gold/layout.h (Layout::symtab_section_offset): New function.
1973 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
1975 2011-04-12 Ian Lance Taylor <iant@google.com>
1977 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
1978 with MREMAP_MAYMOVE.
1979 * output.h (class Output_file): Add map_is_allocated_ field.
1980 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
1981 not available, provide stubs. If mremap is not available, #define
1983 (MREMAP_MAYMOVE): Define if not defined.
1984 (Output_file::Output_file): Initialize map_is_allocated_.
1985 (Output_file::resize): Check map_is_allocated_.
1986 (Output_file::map_anonymous): If mmap fails, use malloc.
1987 (Output_file::unmap): Don't do anything for an anonymous map.
1988 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
1989 is not available, provide stubs.
1990 (File_read::View::~View): Use free rather than delete[].
1991 (File_read::make_view): Use malloc rather than new[]. If mmap
1993 (File_read::find_or_make_view): Use malloc rather than new[].
1994 * gold.h: Remove HAVE_REMAP code.
1995 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
1996 exists. Rename mremap to gold_mremap. If mmap is not available
1998 * configure, config.in: Rebuild.
2000 2011-04-11 Ian Lance Taylor <iant@google.com>
2002 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
2003 initialize local variable v.
2005 2011-04-11 Cary Coutant <ccoutant@google.com>
2007 * archive.cc (Archive::include_member): Adjust call to
2009 (Add_archive_symbols::run): Track argument serial numbers.
2010 (Lib_group::include_member): Likewise.
2011 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
2012 * archive.h (Incremental_archive_entry::Archive_member):
2013 Initialize arg_serial_.
2014 (Archive_member::arg_serial_): New data member.
2015 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
2016 (Sized_dynobj::do_add_symbols): Track symbols when doing an
2018 (Sized_dynobj::do_for_all_local_got_entries): New function.
2019 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
2021 * fileread.cc (get_mtime): New function.
2022 * fileread.h (get_mtime): New function.
2023 * gold.cc (queue_initial_tasks): Check for incremental update.
2024 (process_incremental_input): New function.
2025 (queue_middle_tasks): Don't force valid target for incremental
2027 * incremental-dump.cc (find_input_containing_global): Adjust
2028 size of symbol info entry.
2029 (dump_incremental_inputs): Dump argument serial number and
2030 in_system_directory flag; bias shndx by 1; print symbol names
2031 when dumping per-file symbol lists; use new symbol info readers.
2033 (Output_section_incremental_inputs:update_data_size): New function.
2034 (Sized_incremental_binary::setup_readers): Setup input readers
2035 for each input file; build maps for files added from libraries
2037 (Sized_incremental_binary::check_input_args): New function.
2038 (Sized_incremental_binary::do_check_inputs): Build map of argument
2039 serial numbers to input arguments.
2040 (Sized_incremental_binary::do_file_has_changed): Rename
2041 do_file_is_unchanged to this; compare file modification times.
2042 (Sized_incremental_binary::do_init_layout): New function.
2043 (Sized_incremental_binary::do_reserve_layout): New function.
2044 (Sized_incremental_binary::do_get_input_reader): Remove.
2045 (Sized_incremental_binary::get_symtab_view): New function.
2046 (Incremental_checker::can_incrementally_link_output_file): Remove.
2047 (Incremental_inputs::report_command_line): Exclude --debug options.
2048 (Incremental_inputs::report_archive_begin): Add parameter; track
2049 argument serial numbers; don't put input file entry for archive
2050 before archive members.
2051 (Incremental_inputs::report_archive_end): Put input file entry
2052 for archive after archive members.
2053 (Incremental_inputs::report_object): Add parameter; track argument
2054 serial numbers and in_system_directory flag.
2055 (Incremental_inputs::report_script): Add parameter; track argument
2057 (Output_section_incremental_inputs::set_final_data_size): Adjust
2058 size of symbol info entry; check for forwarding symbols.
2059 (Output_section_incremental_inputs::write_input_files): Write
2060 in_system_directory flag and argument serial number.
2061 (Output_section_incremental_inputs::write_info_blocks): Map section
2062 indices between incremental info and original input file; store
2063 input section index for each symbol.
2064 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2065 change operator() to visit().
2066 (class Global_got_offset_visitor): Likewise.
2067 (class Global_symbol_visitor_got_plt):
2068 (Output_section_incremental_inputs::write_got_plt): Use new visitor
2070 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
2071 (Sized_incr_relobj::do_read_symbols): New function.
2072 (Sized_incr_relobj::do_layout): New function.
2073 (Sized_incr_relobj::do_layout_deferred_sections): New function.
2074 (Sized_incr_relobj::do_add_symbols): New function.
2075 (Sized_incr_relobj::do_should_include_member): New function.
2076 (Sized_incr_relobj::do_for_all_global_symbols): New function.
2077 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
2078 (Sized_incr_relobj::do_section_size): New function.
2079 (Sized_incr_relobj::do_section_name): New function.
2080 (Sized_incr_relobj::do_section_contents): New function.
2081 (Sized_incr_relobj::do_section_flags): New function.
2082 (Sized_incr_relobj::do_section_entsize): New function.
2083 (Sized_incr_relobj::do_section_address): New function.
2084 (Sized_incr_relobj::do_section_type): New function.
2085 (Sized_incr_relobj::do_section_link): New function.
2086 (Sized_incr_relobj::do_section_info): New function.
2087 (Sized_incr_relobj::do_section_addralign): New function.
2088 (Sized_incr_relobj::do_initialize_xindex): New function.
2089 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2090 (Sized_incr_relobj::do_read_relocs): New function.
2091 (Sized_incr_relobj::do_gc_process_relocs): New function.
2092 (Sized_incr_relobj::do_scan_relocs): New function.
2093 (Sized_incr_relobj::do_count_local_symbols): New function.
2094 (Sized_incr_relobj::do_finalize_local_symbols): New function.
2095 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2096 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2097 (Sized_incr_relobj::do_relocate): New function.
2098 (Sized_incr_relobj::do_set_section_offset): New function.
2099 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2100 (Sized_incr_dynobj::do_read_symbols): New function.
2101 (Sized_incr_dynobj::do_layout): New function.
2102 (Sized_incr_dynobj::do_add_symbols): New function.
2103 (Sized_incr_dynobj::do_should_include_member): New function.
2104 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
2105 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
2106 (Sized_incr_dynobj::do_section_size): New function.
2107 (Sized_incr_dynobj::do_section_name): New function.
2108 (Sized_incr_dynobj::do_section_contents): New function.
2109 (Sized_incr_dynobj::do_section_flags): New function.
2110 (Sized_incr_dynobj::do_section_entsize): New function.
2111 (Sized_incr_dynobj::do_section_address): New function.
2112 (Sized_incr_dynobj::do_section_type): New function.
2113 (Sized_incr_dynobj::do_section_link): New function.
2114 (Sized_incr_dynobj::do_section_info): New function.
2115 (Sized_incr_dynobj::do_section_addralign): New function.
2116 (Sized_incr_dynobj::do_initialize_xindex): New function.
2117 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
2118 (make_sized_incremental_object): New function.
2119 (Incremental_library::copy_unused_symbols): New function.
2120 (Incremental_library::do_for_all_unused_symbols): New function.
2121 * incremental.h (enum Incremental_input_flags): New type.
2122 (class Incremental_checker): Remove.
2123 (Incremental_input_entry::Incremental_input_entry): Add argument
2125 (Incremental_input_entry::arg_serial): New function.
2126 (Incremental_input_entry::set_is_in_system_directory): New function.
2127 (Incremental_input_entry::is_in_system_directory): New function.
2128 (Incremental_input_entry::arg_serial_): New data member.
2129 (Incremental_input_entry::is_in_system_directory_): New data member.
2130 (class Script_info): Move here from script.h.
2131 (Script_info::Script_info): Add filename parameter.
2132 (Script_info::filename): New function.
2133 (Script_info::filename_): New data member.
2134 (Incremental_script_entry::Incremental_script_entry): Add argument
2136 (Incremental_object_entry::Incremental_object_entry): Likewise.
2137 (Incremental_object_entry::add_input_section): Build list of input
2138 sections with map to original shndx.
2139 (Incremental_object_entry::get_input_section_index): New function.
2140 (Incremental_object_entry::shndx_): New data member.
2141 (Incremental_object_entry::name_key_): Rename; adjust all refs.
2142 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
2143 (Incremental_archive_entry::Incremental_archive_entry): Add argument
2145 (Incremental_inputs::report_archive_begin): Likewise.
2146 (Incremental_inputs::report_object): Likewise.
2147 (Incremental_inputs::report_script): Likewise.
2148 (class Incremental_global_symbol_reader): New class.
2149 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
2150 and store flags and input file type.
2151 (Incremental_input_entry_reader::arg_serial): New function.
2152 (Incremental_input_entry_reader::type): Extract type from flags.
2153 (Incremental_input_entry_reader::is_in_system_directory): New function.
2154 (Incremental_input_entry_reader::get_input_section_count): Call
2155 accessor function for type.
2156 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
2157 function for type; adjust size of global symbol entry.
2158 (Incremental_input_entry_reader::get_global_symbol_count): Call
2159 accessor function for type.
2160 (Incremental_input_entry_reader::get_object_count): Likewise.
2161 (Incremental_input_entry_reader::get_object_offset): Likewise.
2162 (Incremental_input_entry_reader::get_member_count): Likewise.
2163 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
2164 (Incremental_input_entry_reader::get_member_offset): Likewise.
2165 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
2166 (Incremental_input_entry_reader::Global_symbol_info): Remove.
2167 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
2168 (Incremental_input_entry_reader::get_global_symbol_reader): New
2170 (Incremental_input_entry_reader::get_output_symbol_index): New
2172 (Incremental_input_entry_reader::type_): Remove.
2173 (Incremental_input_entry_reader::flags_): New data member.
2174 (Incremental_inputs_reader::input_file_offset): New function.
2175 (Incremental_inputs_reader::input_file_index): New function.
2176 (Incremental_inputs_reader::input_file): Call input_file_offset.
2177 (Incremental_inputs_reader::input_file_at_offset): New function.
2178 (Incremental_relocs_reader::get_r_type): Reformat.
2179 (Incremental_relocs_reader::get_r_shndx): Reformat.
2180 (Incremental_relocs_reader::get_r_offset): Reformat.
2181 (Incremental_relocs_reader::data): New function.
2182 (Incremental_binary::Incremental_binary): Initialize new data members.
2183 (Incremental_binary::check_inputs): Add cmdline parameter.
2184 (Incremental_binary::file_is_unchanged): Remove.
2185 (Input_reader::arg_serial): New function.
2186 (Input_reader::get_unused_symbol_count): New function.
2187 (Input_reader::get_unused_symbol): New function.
2188 (Input_reader::do_arg_serial): New function.
2189 (Input_reader::do_get_unused_symbol_count): New function.
2190 (Input_reader::do_get_unused_symbol): New function.
2191 (Incremental_binary::input_file_count): New function.
2192 (Incremental_binary::get_input_reader): Change signature to use
2193 index instead of filename.
2194 (Incremental_binary::file_has_changed): New function.
2195 (Incremental_binary::get_input_argument): New function.
2196 (Incremental_binary::get_library): New function.
2197 (Incremental_binary::get_script_info): New function.
2198 (Incremental_binary::init_layout): New function.
2199 (Incremental_binary::reserve_layout): New function.
2200 (Incremental_binary::output_file): New function.
2201 (Incremental_binary::do_check_inputs): New function.
2202 (Incremental_binary::do_file_is_unchanged): Remove.
2203 (Incremental_binary::do_file_has_changed): New function.
2204 (Incremental_binary::do_init_layout): New function.
2205 (Incremental_binary::do_reserve_layout): New function.
2206 (Incremental_binary::do_input_file_count): New function.
2207 (Incremental_binary::do_get_input_reader): Change signature.
2208 (Incremental_binary::input_args_map_): New data member.
2209 (Incremental_binary::library_map_): New data member.
2210 (Incremental_binary::script_map_): New data member.
2211 (Sized_incremental_binary::Sized_incremental_binary): Initialize
2213 (Sized_incremental_binary::output_section): New function.
2214 (Sized_incremental_binary::inputs_reader): Add const.
2215 (Sized_incremental_binary::symtab_reader): Add const.
2216 (Sized_incremental_binary::relocs_reader): Add const.
2217 (Sized_incremental_binary::got_plt_reader): Add const.
2218 (Sized_incremental_binary::get_symtab_view): New function.
2219 (Sized_incremental_binary::Inputs_reader): New typedef.
2220 (Sized_incremental_binary::Input_entry_reader): New typedef.
2221 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
2222 (Sized_incremental_binary::do_file_is_unchanged): Remove.
2223 (Sized_incremental_binary::do_file_has_changed): New function.
2224 (Sized_incremental_binary::do_init_layout): New function.
2225 (Sized_incremental_binary::do_reserve_layout): New function.
2226 (Sized_input_reader::Inputs_reader): Remove.
2227 (Sized_input_reader::Input_entry_reader): Remove.
2228 (Sized_input_reader::do_arg_serial): New function.
2229 (Sized_input_reader::do_get_unused_symbol_count): New function.
2230 (Sized_input_reader::do_get_unused_symbol): New function.
2231 (Sized_incremental_binary::do_input_file_count): New function.
2232 (Sized_incremental_binary::do_get_input_reader): Change signature;
2233 use index instead of filename.
2234 (Sized_incremental_binary::section_map_): New data member.
2235 (Sized_incremental_binary::input_entry_readers_): New data member.
2236 (class Sized_incr_relobj): New class.
2237 (class Sized_incr_dynobj): New class.
2238 (make_sized_incremental_object): New function.
2239 (class Incremental_library): New class.
2240 * layout.cc (Free_list::num_lists): New static data member.
2241 (Free_list::num_nodes): New static data member.
2242 (Free_list::num_removes): New static data member.
2243 (Free_list::num_remove_visits): New static data member.
2244 (Free_list::num_allocates): New static data member.
2245 (Free_list::num_allocate_visits): New static data member.
2246 (Free_list::init): New function.
2247 (Free_list::remove): New function.
2248 (Free_list::allocate): New function.
2249 (Free_list::dump): New function.
2250 (Free_list::print_stats): New function.
2251 (Layout_task_runner::run): Resize output file for incremental updates.
2252 (Layout::Layout): Initialize new data members.
2253 (Layout::set_incremental_base): New function.
2254 (Layout::init_fixed_output_section): New function.
2255 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
2256 incremental updates.
2257 (Layout::create_gold_note): Do not create gold note section for
2258 incremental updates.
2259 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
2260 for incremental updates.
2261 (Layout::set_section_offsets): For incremental updates, allocate space
2263 (Layout::create_symtab_sections): Layout with offsets relative to
2264 start of section; for incremental updates, allocate space from free
2266 (Layout::create_shdrs): For incremental updates, allocate space from
2268 (Layout::finish_dynamic_section): For incremental updates, do not
2269 check --as-needed (fixed in subsequent patch).
2270 * layout.h (class Free_list): New class.
2271 (Layout::set_incremental_base): New function.
2272 (Layout::incremental_base): New function.
2273 (Layout::init_fixed_output_section): New function.
2274 (Layout::allocate): New function.
2275 (Layout::incremental_base_): New data member.
2276 (Layout::free_list_): New data member.
2277 * main.cc (main): Print Free_list statistics.
2278 * object.cc (Relobj::finalize_incremental_relocs): Add
2279 clear_counts parameter; clear counts only when clear_counts is set.
2280 (Sized_relobj::Sized_relobj): Initialize new base class.
2281 (Sized_relobj::do_layout): Don't report special sections.
2282 (Sized_relobj::do_for_all_local_got_entries): New function.
2283 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
2284 symtab_off to all symbol table offsets.
2285 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
2286 * object.h (class Got_offset_list): Move to top of file.
2287 (Object::Object): Allow case where input_file == NULL.
2288 (Object::~Object): Likewise.
2289 (Object::input_file): Assert that input_file != NULL.
2290 (Object::lock): Allow case where input_file == NULL.
2291 (Object::unlock): Likewise.
2292 (Object::is_locked): Likewise.
2293 (Object::token): Likewise.
2294 (Object::release): Likewise.
2295 (Object::is_incremental): New function.
2296 (Object::get_mtime): New function.
2297 (Object::for_all_local_got_entries): New function.
2298 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
2299 (Object::set_is_in_system_directory): New function.
2300 (Object::is_in_system_directory): New function.
2301 (Object::do_is_incremental): New function.
2302 (Object::do_get_mtime): New function.
2303 (Object::do_for_all_local_got_entries): New function.
2304 (Object::is_in_system_directory_): New data member.
2305 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
2306 (class Sized_relobj_base): New class.
2307 (class Sized_relobj): Derive from Sized_relobj_base.
2308 (class Sized_relobj::Symbols): Redeclare from base class.
2309 (class Sized_relobj::local_got_offset_list): Remove.
2310 (class Sized_relobj::Output_sections): Redeclare from base class.
2311 (class Sized_relobj::do_for_all_local_got_entries): New function.
2312 (class Sized_relobj::write_local_symbols): Add offset parameter.
2313 (class Sized_relobj::local_symbol_offset_): Update comment.
2314 (class Sized_relobj::local_dynsym_offset_): Update comment.
2315 * options.cc (Input_arguments::add_file): Remove const.
2316 * options.h (Input_file_argument::Input_file_argument):
2317 Initialize arg_serial_ (all constructors).
2318 (Input_file_argument::set_arg_serial): New function.
2319 (Input_file_argument::arg_serial): New function.
2320 (Input_file_argument::arg_serial_): New data member.
2321 (Input_arguments::Input_arguments): Initialize file_count_.
2322 (Input_arguments::add_file): Remove const.
2323 (Input_arguments::number_of_input_files): New function.
2324 (Input_arguments::file_count_): New data member.
2325 (Command_line::number_of_input_files): Call
2326 Input_arguments::number_of_input_files.
2327 * output.cc (Output_segment_headers::Output_segment_headers):
2329 (Output_section::Input_section::current_data_size): New function.
2330 (Output_section::Output_section): Initialize new data members.
2331 (Output_section::add_input_section): Don't do merge sections for
2332 an incremental link; allocate space from free list for an
2334 (Output_section::add_output_section_data): Allocate space from
2335 free list for an incremental update.
2336 (Output_section::update_data_size): New function.
2337 (Output_section::set_fixed_layout): New function.
2338 (Output_section::reserve): New function.
2339 (Output_segment::set_section_addresses): Remove const.
2340 (Output_segment::set_section_list_addresses): Remove const; allocate
2341 space from free list for an incremental update.
2342 (Output_segment::set_offset): Adjust size of RELRO segment for an
2344 * output.h (Output_data::current_data_size): Move here from
2346 (Output_data::pre_finalize_data_size): New function.
2347 (Output_data::update_data_size): New function.
2348 (Output_section_headers::update_data_size): new function.
2349 (Output_section_data_build::current_data_size): Move to Output_data.
2350 (Output_data_strtab::update_data_size): New function.
2351 (Output_section::current_data_size): Move to Output_data.
2352 (Output_section::set_fixed_layout): New function.
2353 (Output_section::has_fixed_layout): New function.
2354 (Output_section::reserve): New function.
2355 (Output_section::update_data_size): New function.
2356 (Output_section::has_fixed_layout_): New data member.
2357 (Output_section::free_list_): New data member.
2358 (Output_segment::set_section_addresses): Remove const.
2359 (Output_segment::set_section_list_addresses): Remove const.
2360 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
2362 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
2364 * readsyms.cc (Read_symbols::do_read_symbols): Add library
2365 parameter when calling Add_symbols constructor; store argument
2366 serial number for members of a lib group.
2367 (Add_symbols::locks): Allow case where token == NULL.
2368 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
2369 (Read_member::~Read_member): New function.
2370 (Read_member::is_runnable): New function.
2371 (Read_member::locks): New function.
2372 (Read_member::run): New function.
2373 (Check_script::~Check_script): New function.
2374 (Check_script::is_runnable): New function.
2375 (Check_script::locks): New function.
2376 (Check_script::run): New function.
2377 (Check_library::~Check_library): New function.
2378 (Check_library::is_runnable): New function.
2379 (Check_library::locks): New function.
2380 (Check_library::run): New function.
2381 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
2382 (Add_symbols::library_): New data member.
2383 (class Read_member): New class.
2384 (class Check_script): New class.
2385 (class Check_library): New class.
2386 * reloc.cc (Read_relocs::is_runnable): Allow case where
2388 (Read_relocs::locks): Likewise.
2389 (Scan_relocs::locks): Likewise.
2390 (Relocate_task::locks): Likewise.
2391 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
2393 (Sized_relobj::incremental_relocs_scan): Fix comment.
2394 (Sized_relobj::do_relocate): Pass output file offset to
2395 write_local_symbols.
2396 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
2397 from class declaration.
2398 * script.cc (read_input_script): Allocate Script_info; pass
2399 argument serial number to report_script.
2400 * script.h (class Script_info): Move to incremental.h.
2401 * symtab.cc (Symbol_table::add_from_incrobj): New function.
2402 * symtab.h (Symbol_table::add_from_incrobj): New function.
2403 (Symbol_table::set_file_offset): New function.
2405 2011-04-05 Cary Coutant <ccoutant@google.com>
2407 * incremental-dump.cc (dump_incremental_inputs): Change signature
2408 to take a Sized_incremental_binary; change caller. Use readers
2409 in Sized_incremental_binary.
2411 (Sized_incremental_binary::find_incremental_inputs_sections):
2412 Rename do_find_incremental_inputs_sections to this.
2413 (Sized_incremental_binary::setup_readers): New function.
2414 (Sized_incremental_binary::do_check_inputs): Check
2415 has_incremental_info_ flag; move setup code to setup_readers;
2417 (Sized_incremental_binary::do_file_is_unchanged): New function.
2418 (Sized_incremental_binary::do_get_input_reader): New function.
2419 * incremental.h (class Incremental_binary): Move to end of file.
2420 (Incremental_binary::file_is_unchanged): New function.
2421 (Incremental_binary::do_file_is_unchanged): New function.
2422 (Incremental_binary::Input_reader): New class.
2423 (Incremental_binary::get_input_reader): New function.
2424 (class Sized_incremental_binary): Move to end of file.
2425 (Sized_incremental_binary::Sized_incremental_binary): Setup the
2426 input section reader classes.
2427 (Sized_incremental_binary::has_incremental_info): New function.
2428 (Sized_incremental_binary::inputs_reader): New function.
2429 (Sized_incremental_binary::symtab_reader): New function.
2430 (Sized_incremental_binary::relocs_reader): New function.
2431 (Sized_incremental_binary::got_plt_reader): New function.
2432 (Sized_incremental_binary::do_file_is_unchanged): New function.
2433 (Sized_incremental_binary::Sized_input_reader): New class.
2434 (Sized_incremental_binary::get_input_reader): New function.
2435 (Sized_incremental_binary::find_incremental_inputs_sections):
2436 Rename do_find_incremental_inputs_sections to this.
2437 (Sized_incremental_binary::setup_readers): New function.
2438 (Sized_incremental_binary::has_incremental_info_): New data member.
2439 (Sized_incremental_binary::inputs_reader_): New data member.
2440 (Sized_incremental_binary::symtab_reader_): New data member.
2441 (Sized_incremental_binary::relocs_reader_): New data member.
2442 (Sized_incremental_binary::got_plt_reader_): New data member.
2443 (Sized_incremental_binary::current_input_file_): New data member.
2445 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
2448 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
2451 2011-03-30 Cary Coutant <ccoutant@google.com>
2453 * archive.cc (Archive::include_member): Adjust call to report_object.
2454 (Add_archive_symbols::run): Add script_info to call to
2455 report_archive_begin.
2456 (Lib_group::include_member): Adjust call to report_object.
2457 (Add_lib_group_symbols::run): Adjust call to report_object.
2458 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
2459 blocks. Add object count for script input files.
2460 * incremental.cc (Incremental_inputs::report_archive_begin): Add
2461 script_info parameter; change all callers.
2462 (Incremental_inputs::report_object): Add script_info parameter;
2464 (Incremental_inputs::report_script): Store backpointer to
2465 incremental info entry.
2466 (Output_section_incremental_inputs::set_final_data_size): Record
2467 additional information for scripts.
2468 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2469 * incremental.h (Incremental_script_entry::add_object): New function.
2470 (Incremental_script_entry::get_object_count): New function.
2471 (Incremental_script_entry::get_object): New function.
2472 (Incremental_script_entry::objects_): New data member; adjust
2474 (Incremental_inputs::report_archive_begin): Add script_info parameter.
2475 (Incremental_inputs::report_object): Add script_info parameter.
2476 (Incremental_inputs_reader::get_object_count): New function.
2477 (Incremental_inputs_reader::get_object_offset): New function.
2478 * options.cc (Input_arguments::add_file): Return reference to
2480 * options.h (Input_argument::set_script_info): New function.
2481 (Input_argument::script_info): New function.
2482 (Input_argument::script_info_): New data member; adjust all
2484 (Input_file_group::add_file): Return reference to new input argument.
2485 (Input_file_lib::add_file): Likewise.
2486 (Input_arguments::add_file): Likewise.
2487 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
2488 * script.cc (Parser_closure::Parser_closure): Add script_info
2489 parameter; adjust all callers.
2490 (Parser_closure::script_info): New function.
2491 (Parser_closure::script_info_): New data member.
2492 (read_input_script): Report scripts earlier to incremental info.
2493 (script_add_file): Set script_info in Input_argument.
2494 (script_add_library): Likewise.
2495 * script.h (Script_options::Script_info): Rewrite class.
2497 2011-03-29 Cary Coutant <ccoutant@google.com>
2499 * archive.cc (Library_base::should_include_member): Move
2500 method here from class Archive.
2501 (Archive::Archive): Initialize base class.
2502 (Archive::should_include_member): Move to base class.
2503 (Archive::do_for_all_unused_symbols): New function.
2504 (Add_archive_symbols::run): Remove redundant access to
2506 (Lib_group::Lib_group): Initialize base class.
2507 (Lib_group::do_filename): New function.
2508 (Lib_group::include_member): Pass pointer to Lib_group to
2510 (Lib_group::do_for_all_unused_symbols): New function.
2511 (Add_lib_group_symbols::run): Report archive information for
2513 * archive.h (class Library_base): New base class.
2514 (class Archive): Derive from Library_base.
2515 (Archive::filename): Move to base class.
2516 (Archive::set_incremental_info): Likewise.
2517 (Archive::incremental_info): Likewise.
2518 (Archive::Should_include): Likewise.
2519 (Archive::should_include_member): Likewise.
2520 (Archive::Armap_entry): Remove.
2521 (Archive::Unused_symbol_iterator): Remove.
2522 (Archive::unused_symbols_begin): Remove.
2523 (Archive::unused_symbols_end): Remove.
2524 (Archive::do_filename): New function.
2525 (Archive::do_get_mtime): New function.
2526 (Archive::do_for_all_unused_symbols): New function.
2527 (Archive::task_): Move to base class.
2528 (Archive::incremental_info_): Likewise.
2529 (class Lib_group): Derive from Library_base.
2530 (Lib_group::do_filename): New function.
2531 (Lib_group::do_get_mtime): New function.
2532 (Lib_group::do_for_all_unused_symbols): New function.
2533 (Lib_group::task_): Move to base class.
2534 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
2536 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
2538 * incremental.cc (Incremental_inputs::report_archive_begin):
2539 Use Library_base; call library's get_mtime; add incremental inputs
2540 entry before members.
2541 (class Unused_symbol_visitor): New class.
2542 (Incremental_inputs::report_archive_end): Use Library_base; use
2543 visitor class to record unused symbols; don't add incremental inputs
2544 entry after members.
2545 (Incremental_inputs::report_object): Use Library_base.
2547 (Incremental_archive_entry::Incremental_archive_entry): Remove
2548 unused Archive parameter.
2549 (Incremental_inputs::report_archive_begin): Use Library_base.
2550 (Incremental_inputs::report_archive_end): Likewise.
2551 (Incremental_inputs::report_object): Likewise.
2552 * object.cc (Sized_relobj::do_for_all_global_symbols): New
2554 * object.h (Object::for_all_global_symbols): New function.
2555 (Object::do_for_all_global_symbols): New function.
2556 (Sized_relobj::do_for_all_global_symbols): New function.
2557 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
2559 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
2562 2011-03-27 Ian Lance Taylor <iant@google.com>
2564 * archive.cc (Archive::interpret_header): Return -1 if something
2565 goes wrong. Change callers accordingly.
2567 2011-03-25 Cary Coutant <ccoutant@google.com>
2569 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
2570 * testsuite/Makefile.in: Regenerate.
2572 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
2574 * plugin.cc (get_view): New.
2575 (Plugin::load): Pass get_view to the plugin.
2576 (Plugin_manager::get_view): New.
2578 2011-03-21 Ian Lance Taylor <iant@google.com>
2580 * testsuite/final_layout.sh: Rewrite to not use dc.
2581 * testsuite/relro_test.sh: Fail if dc is not present.
2583 2011-03-21 Sriraman Tallam <tmsriram@google.com>
2585 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
2587 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
2588 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
2590 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
2591 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
2593 2011-03-14 Ian Lance Taylor <iant@google.com>
2595 * script-sections.cc (Sort_output_sections::script_compare):
2596 Rename from is_before, change return type.
2597 (Sort_output_sections::operator()): Adjust accordingly.
2599 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
2602 * testsuite/odr_violation2.cc: Add comment to make all error line
2603 numbers double digits.
2604 * testsuite/debug_msg.sh: Adjust expected errors.
2606 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
2608 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
2609 but mark earlier ones as non-canonical
2610 (offset_to_iterator): Update search target and example
2611 (do_addr2line): Return extra lines in a vector*
2612 (format_file_lineno): Extract from do_addr2line
2613 (one_addr2line): Add vector* out-param
2614 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
2615 when a lineno entry appeared last for its instruction
2616 (Dwarf_line_info): Add vector* out-param
2617 * object.cc (Relocate_info): Pass NULL for the vector* out-param
2618 * symtab.cc (Odr_violation_compare): Include the lineno in the
2620 (linenos_from_loc): New. Combine the canonical line for an
2621 address with its other lines.
2622 (True_if_intersect): New. Helper functor to make
2623 std::set_intersection a query.
2624 (detect_odr_violations): Compare sets of lines instead of just
2625 one line for each function. This became less deterministic, but
2626 has fewer false positives.
2627 * symtab.h: Declarations.
2628 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
2629 mix an optimized and non-optimized object in the same binary
2630 (odr_violation2.so): Same.
2631 * testsuite/Makefile.in: Regenerate from Makefile.am.
2632 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
2633 * testsuite/debug_msg.sh: Update line numbers and add
2635 * testsuite/odr_violation1.cc: Use OdrDerived, in a
2636 non-optimized context.
2637 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
2638 isn't inlined, and use OdrDerived in an optimized context.
2639 * testsuite/odr_header1.h: Defines OdrDerived, where
2640 optimization will change the
2641 first-instruction-in-the-destructor's file and line number.
2642 * testsuite/odr_header2.h: Defines OdrBase.
2644 2011-03-09 Ian Lance Taylor <iant@google.com>
2646 * fileread.cc (File_read::clear_views): Don't delete the whole
2649 2011-03-08 Ian Lance Taylor <iant@google.com>
2652 * fileread.cc: #include <climits>.
2653 (GOLD_IOV_MAX): Define.
2654 (File_read::read_multiple): Limit number of entries by iov_max.
2655 * fileread.h (class File_read): Always set max_readv_entries to
2658 2011-03-07 Ian Lance Taylor <iant@google.com>
2661 * options.h (class General_options): Add -dy and -dn.
2663 2011-03-02 Cary Coutant <ccoutant@google.com>
2665 * testsuite/script_test_9.t: Add TLS segment.
2667 2011-03-02 Simon Baldwin <simonb@google.com>
2669 * configure.ac: Add check for gnu_indirect_function support in
2670 the toolchain building binutils.
2671 * configure: Rebuild.
2673 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
2675 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
2676 plugin only symbols.
2677 (Symbol_table::sized_finalize_symbol) Mark symbol only present
2678 in plugin files as not needed in the symbol table.
2680 2011-02-11 Sriraman Tallam <tmsriram@google.com>
2682 * output.cc (Output_section::add_input_section): Delay fill
2683 generation for section ordering.
2685 2011-02-09 Ian Lance Taylor <iant@google.com>
2688 * object.h (class Sized_relobj): Remove clear_local_symbols.
2689 * reloc.cc (Sized_relobj::do_relocate): Don't call
2690 clear_local_symbols.
2692 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
2694 * plugin.cc (is_visible_from_outside): Return true for symbols
2697 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
2699 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
2702 2011-02-02 Sriraman Tallam <tmsriram@google.com>
2704 * icf.h (is_section_foldable_candidate): Change type of parameter
2706 * icf.cc (Icf::find_identical_sections): Change type of local variable
2707 section_name to be std::string.
2708 (is_function_ctor_or_dtor): Change type of parameter to std::string.
2710 2011-01-25 Ian Lance Taylor <iant@google.com>
2712 * script.cc (script_add_extern): Rewrite to use
2713 add_symbol_reference.
2715 2011-01-25 Doug Kwan <dougkwan@google.com>
2717 * icf.cc (get_section_contents): Always lock section's object.
2719 2011-01-24 Ian Lance Taylor <iant@google.com>
2721 * options.h (class General_options): Accept
2722 --no-detect-odr-violations.
2724 2011-01-24 Ian Lance Taylor <iant@google.com>
2726 * version.cc (version_string): Bump to 1.11.
2728 2011-01-24 Ian Lance Taylor <iant@google.com>
2730 * plugin.cc (class Plugin_rescan): Define new class.
2731 (Plugin_manager::claim_file): Set any_claimed_.
2732 (Plugin_manager::save_archive): New function.
2733 (Plugin_manager::save_input_group): New function.
2734 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
2736 (Plugin_manager::new_undefined_symbol): New function.
2737 (Plugin_manager::rescan): New function.
2738 (Plugin_manager::rescannable_defines): New function.
2739 (Plugin_manager::add_input_file): Set any_added_.
2740 * plugin.h (class Plugin_manager): define new fields rescannable_,
2741 undefined_symbols_, any_claimed_, and any_added_. Declare
2742 Plugin_rescan as friend. Declare new functions.
2743 (Plugin_manager::Rescannable): Define type.
2744 (Plugin_manager::Rescannable_list): Define type.
2745 (Plugin_manager::Undefined_symbol_list): Define type.
2746 (Plugin_manager::Plugin_manager): Initialize new fields.
2747 * archive.cc (Archive::defines_symbol): New function.
2748 (Add_archive_symbols::run): Pass archive to plugins if any.
2749 * archive.h (class Archive): Declare defines_symbol.
2750 * readsyms.cc (Input_group::~Input_group): New function.
2751 (Finish_group::run): Pass input_group to plugins if any.
2752 * readsyms.h (class Input_group): Declare destructor.
2753 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
2756 2011-01-10 Ian Lance Taylor <iant@google.com>
2758 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
2760 (Layout::set_segment_offsets): Reset increase_relro before calling
2761 set_section_addresses a second time.
2763 2011-01-04 Cary Coutant <ccoutant@google.com>
2765 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
2766 sections before NOBITS sections.
2768 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
2770 * version.cc (print_version): Update copyright to 2011.
2772 2010-12-23 Cary Coutant <ccoutant@google.com>
2774 * output.h (Output_data_reloc::add_output_section): Pass OD instead
2775 of OS to this->add. Add OD parameter to second form of the function.
2777 2010-12-20 Ian Lance Taylor <iant@google.com>
2779 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
2780 second of two consecutive entries with same offset.
2782 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2784 * testsuite/Makefile.am (ifuncmain2static_LDADD)
2785 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
2786 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
2787 to avoid unneeded links against $(LDADD).
2788 * testsuite/Makefile.in: Regenerate.
2790 2010-12-15 Ian Lance Taylor <iant@google.com>
2793 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
2794 for R_X86_64_32 and R_X86_64_PC32.
2795 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
2796 ver_matching_def_pic.o.
2797 (ver_matching_def_pic.o): New target.
2799 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2801 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
2802 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
2803 Move definition before File_read::View member definitions.
2804 (File_read::View::~View): Initialize and hold lock before
2805 updating current_mapped_bytes.
2807 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2809 * dwarf_reader.cc: Remove outdated comment.
2810 * gold-threads.cc: Fix typo in error message.
2811 * archive.cc: Fix typos in comments.
2812 * archive.h: Likewise.
2813 * arm-reloc-property.cc: Likewise.
2814 * arm-reloc-property.h: Likewise.
2815 * arm-reloc.def: Likewise.
2817 * attributes.h: Likewise.
2818 * cref.cc: Likewise.
2819 * ehframe.cc: Likewise.
2820 * fileread.h: Likewise.
2822 * i386.cc: Likewise.
2824 * incremental.h: Likewise.
2825 * int_encoding.cc: Likewise.
2826 * layout.h: Likewise.
2827 * main.cc: Likewise.
2828 * merge.h: Likewise.
2829 * object.cc: Likewise.
2830 * object.h: Likewise.
2831 * options.cc: Likewise.
2832 * readsyms.cc: Likewise.
2833 * reduced_debug_output.cc: Likewise.
2834 * reloc.cc: Likewise.
2835 * script-sections.cc: Likewise.
2836 * sparc.cc: Likewise.
2837 * symtab.h: Likewise.
2838 * target-reloc.h: Likewise.
2839 * target.cc: Likewise.
2840 * target.h: Likewise.
2841 * timer.cc: Likewise.
2842 * timer.h: Likewise.
2843 * x86_64.cc: Likewise.
2845 2010-12-09 Cary Coutant <ccoutant@google.com>
2847 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
2849 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
2850 parameter; change all callers.
2851 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
2852 * options.h (warn_execstack): New option.
2854 2010-12-07 Doug Kwan <dougkwan@google.com>
2856 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
2857 like function call relocations.
2859 2010-12-07 Ian Lance Taylor <iant@google.com>
2861 * archive.cc (Archive::get_elf_object_for_member): Permit
2862 punconfigured to be NULL.
2863 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
2864 (Archive::include_member): Pass NULL to get_elf_object_for_member
2865 if we searched for the archive and this is the first included
2868 2010-12-01 Ian Lance Taylor <iant@google.com>
2870 * dwarf_reader.h (class Sized_dwarf_line_info): Add
2871 track_relocs_type_ field.
2872 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2873 Set track_relocs_type_.
2874 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
2875 contents when using RELA relocs.
2876 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
2878 * reloc.cc (Track_relocs::next_addend): New function.
2879 * reloc.h (class Track_relocs): Declare next_addend.
2881 2010-12-01 Ian Lance Taylor <iant@google.com>
2883 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
2886 2010-12-01 Ian Lance Taylor <iant@google.com>
2888 * README: Update compilers known to work and fail.
2890 2010-11-23 Matthias Klose <doko@ubuntu.com>
2892 * configure.in: For --enable-gold, handle value `default' instead of
2893 `both*'. Always install ld as ld.bfd, install as ld if gold is
2895 * configure: Regenerate.
2897 2010-11-18 Doug Kwan <dougkwan@google.com>
2899 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
2900 and right_alignment to be zero. Store result alignment only if it is
2901 greater than existing alignment.
2903 2010-11-16 Cary Coutant <ccoutant@google.com>
2906 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2907 Check for ".zdebug_line".
2909 2010-11-16 Doug Kwan <dougkwan@google.com>
2910 Cary Coutant <ccoutant@google.com>
2912 * output.h (Output_segment::set_section_addresses): Pass increase_relro
2913 by reference; adjust all callers.
2914 * output.cc (Output_segment::set_section_addresses): Adjust references
2915 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
2917 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
2918 end at page boundary.
2920 2010-11-16 Cary Coutant <ccoutant@google.com>
2923 * layout.cc (Layout::choose_output_section): Transform names of
2924 compressed sections even when using a script with a SECTIONS clause.
2925 (Layout::output_section_name): Remove code to transform
2926 compressed debug section names.
2927 * output.cc (Output_section::add_input_section): Use uncompressed
2928 section size when tracking input sections.
2930 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
2932 * symtab.h (Symbol::NON_PIC_REF): Remove.
2933 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
2934 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
2935 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
2936 (Symbol::use_plt_offset): Take a flags argument and pass it
2937 directly to needs_dynamic_reloc. Restrict check for undefined
2938 weak symbols to function calls.
2939 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
2940 (Target_arm::Scan::global): Use it.
2941 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
2942 (Target_arm::Relocate::relocate): Likewise.
2943 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
2944 parameter with an r_type parameter. Use get_reference_flags
2946 (Target_arm::Relocate::relocate): Update accordingly.
2947 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
2948 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
2949 (Target_i386::Scan::global): Likewise.
2950 (Target_i386::Relocate::relocate): Likewise.
2951 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
2952 parameter with an r_type parameter. Use get_reference_flags
2954 (Target_i386::Relocate::relocate): Update accordingly.
2955 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
2956 (Target_powerpc::Scan::global): Use it.
2957 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
2958 (Target_powerpc::Relocate::relocate): Likewise.
2959 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
2960 (Target_sparc::Scan::global): Use it.
2961 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
2962 (Target_sparc::Relocate::relocate): Likewise.
2963 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
2964 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
2965 (Target_x86_64::Scan::global): Likewise.
2966 (Target_x86_64::Relocate::relocate): Likewise.
2968 2010-11-08 Doug Kwan <dougkwan@google.com>
2969 Cary Coutant <ccoutant@google.com>
2971 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
2972 (Arm_exidx_merge_section::section_contents_): New data member.
2973 (Arm_input_section::Arm_input_section): Initialize original_contents_.
2974 (Arm_input_section::~Arm_input_section): De-allocate memory.
2975 (Arm_input_section::original_contents_): New data member.
2976 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
2977 in parameters instead of calling Object::section_contents without
2979 (Arm_output_section::group_section): New parameter TASK. Pass it
2980 to callees that need locking objects.
2981 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
2982 to lock EXIDX input sections. Fix a formatting issue. Call
2983 Arm_exidx_merged_section::build_contents to create merged section
2985 (Arm_output_section::create_stub_group): New parameter TASK. Use it
2986 to lock object of stub table owner.
2987 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
2988 TEXT_SIZE to initialize data member TEXT_SIZE_.
2989 (Arm_exidx_input_section::addralign): Fix typo in comment.
2990 (Arm_exidx_input_section::text_size): New method.
2991 (Target_arm::do_relax): New parameter TASK. Pass it to callees
2992 that require locking objects. Lock objects before scanning for stubs
2993 and updating local symbols.
2994 (Arm_input_section<big_endian>::init): Copy contents of original
2996 (Arm_input_section<big_endian>::do_write): Use saved contents of
2997 original input section instead of calling Object::section_contents
2999 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
3000 size without calling Object::section_size().
3001 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
3002 for size. Allocate a buffer for merged EXIDX entries.
3003 (Arm_exidx_merged_section::build_contents): New method.
3004 (Arm_exidx_merged_section::do_write): Move merge section contents
3005 building code to Arm_exidx_merged_section::build_contetns. Write
3006 out contetns in buffer instead of building it on the fly.
3007 (Arm_relobj::make_exidx_input_section): Also pass text section size
3008 to Arm_exidx_input_section constructor.
3009 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
3010 (Arm_dynobj::do_read_symbols): Fix memory leak.
3011 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
3012 * target.h: (class Task): Add forward declaration.
3013 (Target::relax): Add new parameter TASK and pass it to
3015 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
3017 2010-11-05 Cary Coutant <ccoutant@google.com>
3020 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
3021 object when reading from the file.
3022 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
3024 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
3025 when reading section contents.
3026 (get_section_contents): Likewise.
3027 (icf::find_identical_sections): Likewise.
3028 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
3029 object when reading from the file.
3030 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
3031 the object when doing deferred section layout.
3033 2010-11-03 Nick Clifton <nickc@redhat.com>
3036 * script.h (class Symbol_assignment: name): New member. Returns
3037 the name of the symbol.
3038 * scrfipt.cc (Script_options::is_pending_assignment): New member.
3039 Returns true if the given symbol name is on the list of
3040 assignments wating to be processed.
3041 * archive.cc (should_incldue_member): If the symbol is undefined,
3042 check to see if it is on the list of symbols pending assignment.
3044 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
3046 * script-sections.cc (Script_sections::find_memory_region): Check
3047 for a NULL output section pointer.
3049 2010-10-29 Doug Kwan <dougkwan@google.com>
3051 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3052 Output_section::add_relaxed_input_section.
3053 * output.cc (Output_section::add_relaxed_input_section): Add new
3054 arguments LAYOUT and NAME. Set section order index.
3055 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3056 Copy section order index.
3057 * output.h (Output_section::add_relaxed_input_section): Add new
3058 arguments LAYOUT and NAME.
3060 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3062 * testsuite/Makefile.am: Move gcctestdir/ld rule to
3063 NATIVE_OR_CROSS_LINKER.
3064 * testsuite/Makefile.in: Regenerate.
3066 2010-10-20 Doug Kwan <dougkwan@google.com>
3068 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
3069 without SHF_LINK_ORDER flags.
3070 * layout.cc (Layout::choose_output_section): Do not filter
3071 SHF_LINK_ORDER flag in a relocatable link.
3073 2010-10-17 Cary Coutant <ccoutant@google.com>
3075 * output.h (Output_segment::set_section_addresses): Change function
3076 signature. Update all callers.
3077 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
3079 (Output_segment::set_section_addresses): Align after last TLS
3080 section. Add padding before last relro section instead of after.
3082 2010-10-17 Doug Kwan <dougkwan@google.com>
3084 * gold/arm.cc (Target_arm::got_section): Use correct order and set
3085 GOT output section to be writable.
3087 2010-10-14 Cary Coutant <ccoutant@google.com>
3089 * debug.h (DEBUG_INCREMENTAL): New flag.
3090 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3091 * gold.cc (queue_initial_tasks): Check parameters for incremental link
3093 * incremental.cc (report_command_line): Ignore all forms of
3095 * layout.cc (Layout::Layout): Check parameters for incremental link
3097 * options.cc (General_options::parse_incremental): New function.
3098 (General_options::parse_no_incremental): New function.
3099 (General_options::parse_incremental_full): New function.
3100 (General_options::parse_incremental_update): New function.
3101 (General_options::incremental_mode_): New data member.
3102 (General_options::finalize): Check incremental_mode_.
3103 * options.h (General_options): Update help text for --incremental.
3104 Add --no-incremental, --incremental-full, --incremental-update.
3105 (General_options::Incremental_mode): New enum type.
3106 (General_options::incremental_mode): New function.
3107 (General_options::incremental_mode_): New data member.
3108 * parameters.cc (Parameters::incremental_mode_): New data member.
3109 (Parameters::set_options): Set incremental_mode_.
3110 (Parameters::set_incremental_full): New function.
3111 (Parameters::incremental): New function.
3112 (Parameters::incremental_update): New function.
3113 (set_parameters_incremental_full): New function.
3114 * parameters.h (Parameters::set_incremental_full): New function.
3115 (Parameters::incremental): New function.
3116 (Parameters::incremental_update): New function.
3117 (Parameters::incremental_mode_): New data member.
3118 (set_parameters_incremental_full): New function.
3119 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
3120 incremental link mode.
3121 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
3122 (Sized_relobj::do_relocate_sections): Likewise.
3123 * testsuite/Makefile.am (incremental_test): Use --incremental-full
3125 * testsuite/Makefile.in: Regenerate.
3126 * testsuite/incremental_test.sh: Filter all forms of --incremental.
3128 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3130 * script-sections.h (class Script_sections): Make
3131 Sections_elements typedef public.
3132 * script-sections.cc (class Sort_output_sections): Add elements_
3133 field. Add constructor which sets it; change all callers.
3134 (Sort_output_sections::is_before): New function.
3135 (Sort_output_sections::operator()): Call is_before.
3136 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
3138 * testsuite/script_test_10.sh: New test. Test script section
3140 * testsuite/script_test_10.t: Likewise.
3141 * testsuite/script_test_10.s: Likewise.
3142 * testsuite/Makefile.am: Wrap the cross linker tests and the
3143 common tests into NATIVE_OR_CROSS_LINKER.
3144 (check_SCRIPTS): Add script_test_10.sh.
3145 (check_DATA): Add script_test_10.stdout.
3146 (script_test_10.o, script_test_10): New targets.
3147 (script_test_10.stdout): New target.
3148 * configure, testsuite/Makefile.in: Regenerate.
3150 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3152 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
3153 error for the deprecated relocations.
3154 (Target_arm::Scan::global): Likewise.
3155 (Target_arm::Relocate::relocate): Likewise.
3157 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
3159 * fileread.cc (Input_file::find_file): Initialize *found_name
3160 and *namep when using the fallback search for case 4.
3162 2010-10-11 Cary Coutant <ccoutant@google.com>
3164 * options.h (class General_options): Redefine -z lazy as an alias for
3165 the negation of -z now.
3167 2010-10-11 Ian Lance Taylor <iant@google.com>
3169 * resolve.cc (symbol_to_bits): Report the value of the unsupported
3172 2010-10-06 Nick Clifton <nickc@redhat.com>
3174 * script-sections.cc(class Memory_region): Remove
3175 current_lma_offset_ field. Rename current_vma_offset_ to
3176 current_offset_. Add last_section_ field.
3177 (Memory_region::get_current_vma_address): Rename to
3178 get_current_address.
3179 (Memory_region::get_current_lma_address): Delete.
3180 (Memory_region::increment_vma_offset): Rename to
3182 (Memory_region::increment_lma_offset): Delete.
3183 (Memory_region::attributes_compatible): New method. Returns
3184 true if the provided section is compatible with the region.
3185 (Memory_region::get_last_section): New method. Returns the last
3186 section to use the region.
3187 (Memory_region::set_last_section): New method. Stores the last
3188 section to use the region.
3189 (Script_sections::block_in_region): New method. Returns true if
3190 a block of memory is contained within a region.
3191 (Script_sections::find_memory_region): New method. Locates a
3192 memory region to be used to set a VMA or LMA address.
3193 (Output_section_definition::set_section_addresses): Add code to
3194 check for addresses set by memory regions.
3195 (Output_segment::set_section_addresses): Remove memory region
3197 (Script_sections::create_segment): Add a warning if a header
3198 segment is created outside of any region.
3199 * script-sections.h (class Script_sections): Add prototypes for
3200 find_memory_region and block_in_region methods.
3201 * testsuite/memory_test.s: Use .long instead of .word.
3202 * testsuite/memory_test.t: Add some more output sections.
3203 * testsuite/memory_test.sh: Update expected output.
3205 2010-10-02 Doug Kwan <dougkwan@google.com>
3207 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
3208 defintion to symtab.h
3209 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
3210 declaration to defintion.
3212 2010-10-01 Nick Clifton <nickc@redhat.com>
3214 * expression.cc (eval): Replace dummy argument with NULL.
3215 (eval_maybe_dot): Check for a NULL result section pointer.
3216 (Symbol_expression::value): Likewise.
3217 (Dot_expression::value): Likewise.
3218 (BINARY_EXPRESSION): Likewise.
3219 (Max_expression::value): Likewise.
3220 (Min_expression::value): Likewise.
3221 (Absolute_expression::value): Likewise.
3222 (Addr_expression::value_from_output_section): Likewise.
3223 (Loaddddr_expression::value_from_output_section): Likewise.
3224 (Segment_start_expression::value): Likewise.
3225 * script-sections.cc
3226 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
3228 (Sections_elememt_dot_assignment::set_section_addresses):
3230 (Output_data_expression::do_write_to_buffer): Likewise.
3231 (Output_section_definition::finalize_symbols): Likewise.
3232 (Output_section_definition::set_section_addresses): Likewise.
3234 2010-09-30 Doug Kwan <dougkwan@google.com>
3236 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
3238 2010-09-28 Sriraman Tallam <tmsriram@google.com>
3240 * target.h (Target::can_icf_inline_merge_sections): New virtual
3242 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
3244 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
3246 * icf.cc (get_section_contents): Inline merge sections only when
3249 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3251 * configure: Regenerate.
3253 2010-09-17 Ian Lance Taylor <iant@google.com>
3255 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
3256 * testsuite/Makefile.am (memory_test.o): New target.
3257 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
3259 * testsuite/Makefile.in: Rebuild.
3261 2010-09-17 Doug Kwan <dougkwan@google.com>
3263 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
3264 defintion if relocation uses GOT entries of the symbol.
3265 * testsuite/icf_safe_test.sh: Fix test.
3266 * testsuite/icf_safe_so_test.sh: Fix test.
3268 2010-09-16 Cary Coutant <ccoutant@google.com>
3270 * script_sections.cc (class Memory_region): Remove "NULL" from
3271 vector initializations.
3273 2010-09-15 Cary Coutant <ccoutant@google.com>
3275 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
3276 Resolve forwarding symbols.
3278 2010-09-15 Doug Kwan <dougkwan@google.com>
3280 * gold/testsuite/script_test_3.t: Add ARM special sections.
3281 * gold/testsuite/script_test_4.t: Same.
3282 * gold/testsuite/script_test_5.t: Same.
3283 * gold/testsuite/script_test_6.t: Same.
3284 * gold/testsuite/script_test_7.t: Same.
3285 * gold/testsuite/script_test_7.t: Same.
3286 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
3288 2010-09-14 Cary Coutant <ccoutant@google.com>
3290 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
3291 (Target_x86_64::Relocate::relocate_tls): Replace check for
3292 saw_tls_block_reloc_ with test for executable section.
3294 2010-09-12 Cary Coutant <ccoutant@google.com>
3296 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
3297 position-independent executables to shared libraries need dynamic
3299 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
3300 position-independent executables.
3301 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
3302 * testsuite/Makefile.in: Regenerate.
3304 2010-09-10 Nick Clifton <nickc@redhat.com>
3307 * testsuite/memory_test.t: Discard any sections that are not
3310 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
3313 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
3314 "This::" to work around a bug in gcc 4.2.
3316 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
3318 2010-09-09 Rafael Espindola <espindola@google.com>
3320 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
3321 sections with different PF_X flags in the same segment.
3322 (Layout::find_first_load_seg): Search all segments to find the first
3324 * options.h (rosegment): New.
3326 2010-09-08 Rafael Espindola <espindola@google.com>
3328 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
3330 2010-09-08 Doug Kwan <dougkwan@google.com>
3332 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
3333 (Arm_relobj::do_relocate_sections): Add new parameter for output
3334 file to match the parent.
3335 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
3336 of local symbols instead of input values. Update code to track
3337 changes in gold::relocate_section.
3338 * object.cc (Sized_relobj::compute_final_local_value): New methods.
3339 (Sized_relobj::compute_final_local_value_internal): New methods.
3340 (Sized_relobj::do_finalize_local_symbols): Move code from loop
3341 body into private version of Sized_relobj::compute_final_local_value.
3342 Call the inline method.
3343 * object.h (Symbol_value::Symbol_value): Define destructor. Free
3344 merged symbol value if there is one.
3345 (Symbol_value::has_output_value): New method defintiion.
3346 (Sized_relobj::Compute_final_local_value_status): New enum type.
3347 (Sized_relobj::compute_final_local_value): New methods.
3348 (Sized_relobj::compute_final_local_value_internal): New methods.
3349 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
3350 and arm_cortex_a8.sh.
3351 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
3352 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
3354 * Makefile.in: Regenerate.
3355 * testsuite/arm_bl_out_of_range.s: Update test.
3356 * testsuite/thumb_bl_out_of_range.s: Ditto.
3357 * testsuite/thumb_blx_out_of_range.s: Ditto.
3358 * testsuite/arm_branch_out_of_range.sh: New file.
3359 * testsuite/arm_cortex_a8.sh: Ditto.
3360 * testsuite/arm_cortex_a8_b.s: Ditto.
3361 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
3362 * testsuite/arm_cortex_a8_b_local.s: Ditto.
3363 * testsuite/arm_cortex_a8_bl.s: Ditto.
3364 * testsuite/arm_cortex_a8_blx.s: Ditto.
3365 * testsuite/arm_cortex_a8_local.s: Ditto.
3366 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
3367 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
3369 2010-09-08 Rafael Espindola <espindola@google.com>
3371 * Makefile.am (memory_test.stdout): Run readelf with -W.
3372 * Makefile.in: Regenerate.
3373 * testsuite/memory_test.sh: Make the regexps accept both 32 and
3376 2010-09-08 Rafael Espindola <espindola@google.com>
3378 * script-sections.cc (Script_sections::add_memory_region): Convert
3379 field precision to int.
3380 * script.cc (script_set_section_region, script_set_section_region):
3381 Convert field precision to int.
3383 2010-09-08 Rafael Espindola <espindola@google.com>
3385 * arm.cc (do_finalize_sections): Create the __exidx_start and
3386 __exdix_end symbols even when the section is missing.
3388 2010-09-08 Nick Clifton <nickc@redhat.com>
3390 * README: Remove claim that MEMORY is not supported.
3391 * expression.cc (script_exp_function_origin)
3392 (script_exp_function_length): Move from here to ...
3393 * script.cc: ... here.
3394 (script_set_section_region, script_add_memory)
3395 (script_parse_memory_attr, script_include_directive): New
3397 * script-sections.cc
3398 (class Memory_region): New class.
3399 (class Output_section_definition): Add set_memory_region,
3400 set_section_vma, set_section_lma and get_section_name methods.
3401 (class Script_Sections): Add add_memory_region,
3402 find_memory_region, find_memory_region_origin,
3403 find_memory_region_length and set_memory_region methods.
3404 Have set_section_addresses method walk the list of set memory
3406 Extend the print methos to display memory regions.
3407 * script-sections.h: Add prototypes for new methods.
3408 Add enum for MEMORY region attributes.
3409 * yyscript.y: Add support for parsing MEMORY regions.
3410 * script-c.h: Add prototypes for new functions.
3411 * testsuite/Makefile.am: Add test of MEMORY region functionality.
3412 * testsuite/Makefile.in: Regenerate.
3413 * testsuite/memory_test.sh: New script.
3414 * testsuite/memory_test.s: New assembler source file.
3415 * testsuite/memory_test.t: New linker script.
3417 2010-08-27 Doug Kwan <dougkwan@google.com>
3419 * gold/resolve.cc (Symbol_table::should_override): Let a weak
3420 reference override an existing dynamic weak reference.
3421 * testsuite/Makefile.am: Add new test dyn_weak_ref.
3422 * testsuite/Makefile.in: Regenerate.
3423 * testsuite/dyn_weak_ref.sh: New file.
3424 * testsuite/dyn_weak_ref_1.c: Ditto.
3425 * testsuite/dyn_weak_ref_2.c: Ditto.
3427 2010-08-27 Ian Lance Taylor <iant@google.com>
3429 * incremental.h (class Incremental_input_entry): Add virtual
3432 2010-08-27 Ian Lance Taylor <iant@google.com>
3434 * testsuite/start_lib_test_3.c: Mark t3 as used.
3436 2010-08-27 Nick Clifton <nickc@redhat.com>
3438 * options.cc (version_script): Fix small typo in previous
3441 2010-08-25 Nick Clifton <nickc@redhat.com>
3443 * archive.cc: Formatting fixes: Remove whitespace between
3444 typename and following asterisk. Remove whitespace between
3445 function name and opening parenthesis.
3446 * archive.h: Likewise.
3448 * attributes.cc: Likewise.
3449 * attributes.h: Likewise.
3450 * common.cc: Likewise.
3451 * copy-relocs.cc: Likewise.
3452 * dirsearch.h: Likewise.
3453 * dynobj.cc: Likewise.
3454 * ehframe.cc: Likewise.
3455 * ehframe.h: Likewise.
3456 * expression.cc: Likewise.
3457 * fileread.cc: Likewise.
3458 * fileread.h: Likewise.
3460 * gold-threads.cc: Likewise.
3461 * gold.cc: Likewise.
3462 * i386.cc: Likewise.
3464 * incremental-dump.cc: Likewise.
3465 * incremental.cc: Likewise.
3466 * layout.cc: Likewise.
3467 * layout.h: Likewise.
3468 * main.cc: Likewise.
3469 * merge.cc: Likewise.
3470 * merge.h: Likewise.
3471 * object.cc: Likewise.
3472 * object.h: Likewise.
3473 * options.cc: Likewise.
3474 * options.h: Likewise.
3475 * output.cc: Likewise.
3476 * output.h: Likewise.
3477 * plugin.cc: Likewise.
3478 * plugin.h: Likewise.
3479 * powerpc.cc: Likewise.
3480 * reloc.cc: Likewise.
3481 * script-c.h: Likewise.
3482 * script-sections.cc: Likewise.
3483 * script.cc: Likewise.
3484 * stringpool.cc: Likewise.
3485 * symtab.cc: Likewise.
3486 * symtab.h: Likewise.
3487 * target.cc: Likewise.
3488 * timer.cc: Likewise.
3489 * timer.h: Likewise.
3490 * version.cc: Likewise.
3491 * x86_64.cc: Likewise.
3493 2010-08-24 Nick Clifton <nickc@redhat.com>
3496 * layout.cc (segment_precedes): Sort segments by their physical
3497 addresses, if they have been set.
3499 2010-08-23 Cary Coutant <ccoutant@google.com>
3501 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
3503 (Lib_group::include_member): Unlock object after deleting its
3505 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
3508 2010-08-19 Neil Vachharajani <nvachhar@google.com>
3509 Cary Coutant <ccoutant@google.com>
3511 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
3512 constructor, and set_blocker.
3513 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
3515 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
3516 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
3517 * testsuite/Makefile.am (start_lib_test): New test case.
3518 * testsuite/Makefile.in: Regenerate.
3519 * testsuite/start_lib_test_main.c: New file.
3520 * testsuite/start_lib_test_1.c: New file.
3521 * testsuite/start_lib_test_2.c: New file.
3522 * testsuite/start_lib_test_3.c: New file.
3524 2010-08-19 Ian Lance Taylor <iant@google.com>
3526 * Makefile.in: Rebuild with automake 1.11.1.
3527 * aclocal.m4: Likewise.
3528 * testsuite/Makefile.in: Likewise.
3530 2010-08-19 Ian Lance Taylor <iant@google.com>
3533 * i386.cc (class Output_data_plt_i386): Update declarations.
3534 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
3535 local_ifuncs_ fields.
3536 (Target_i386::do_plt_section_for_global): New function.
3537 (Target_i386::do_plt_section_for_local): New function.
3538 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
3539 parameter; change all callers. Initialize global_ifuncs_ and
3540 local_ifuncs_. If doing a static link define __rel_iplt_start and
3542 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
3543 (Output_data_plt_i386::add_local_ifunc_entry): New function.
3544 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
3546 (Target_i386::make_plt_section): New function, broken out of
3547 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
3548 (Target_i386::make_plt_entry): Call make_plt_section.
3549 (Target_i386::make_local_ifunc_plt_entry): New function.
3550 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
3551 (Target_i386::Scan::local): Handle IFUNC symbols. Add
3552 R_386_IRELATIVE to switch.
3553 (Target_i386::Scan::global): Likewise.
3554 (Target_i386::Relocate::relocate): Likewise.
3555 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
3557 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
3558 (Target_x86_64::do_plt_section_for_global): New function.
3559 (Target_x86_64::do_plt_section_for_local): New function.
3560 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
3561 parameter; change all callers. If doing a static link define
3562 __rela_iplt_start and __rela_iplt_end.
3563 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
3564 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
3565 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
3567 (Target_x86_64::make_local_ifunc_plt_entry): New function.
3568 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
3570 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
3571 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
3572 R_X86_64_IRELATIVE to switch.
3573 (Target_x86_64::Scan::global): Likewise.
3574 (Target_x86_64::Relocate::relocate): Likewise.
3575 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
3577 * target.h (class Target): Add plt_section_for_global and
3578 plt_section_for_local functions. Add do_plt_section_for_global
3579 and do_plt_section_for_local virtual functions.
3580 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
3581 clarifying comments.
3582 (Symbol::use_plt_offset): Handle IFUNC symbol.
3583 * object.cc (Sized_relobj::Sized_relobj): Initialize
3585 (Sized_relobj::local_has_plt_offset): New function.
3586 (Sized_relobj::local_plt_offset): New function.
3587 (Sized_relobj::set_local_plt_offset): New function.
3588 (Sized_relobj::do_count): Handle IFUNC symbol.
3589 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
3590 a bit away from input_shndx_ field. Add set_is_func_symbol and
3591 is_ifunc_symbol functions.
3592 (class Sized_relobj): Update declarations. Remove Tls_got_entry
3593 and Local_tls_got_offsets. Define Local_plt_offsets. Add
3594 local_plt_offsets_ field.
3595 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
3596 * output.h (class Output_section_data): Add non-const
3597 output_section function.
3598 (class Output_data_got): Update declarations.
3599 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
3600 Add use_plt_offset parameter to global and local constructors.
3601 Change all callers. Change local_sym_index_ field to 31 bits.
3602 Change GSYM_CODE and CONSTANT_CODE accordingly.
3603 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
3604 doing a static link don't set sh_link field.
3605 (Output_data_got::Got_entry::write): Use PLT offset if
3607 (Output_data_got::add_global_plt): New function.
3608 (Output_data_got::add_local_plt): New function.
3609 * target-reloc.h (relocate_section): Handle IFUNC symbol.
3610 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
3611 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
3612 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
3613 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
3615 * testsuite/ifunc-sel.h: New file.
3616 * testsuite/ifuncmain1.c: New file.
3617 * testsuite/ifuncmain1vis.c: New file.
3618 * testsuite/ifuncmod1.c: New file.
3619 * testsuite/ifuncdep2.c: New file.
3620 * testsuite/ifuncmain2.c: New file.
3621 * testsuite/ifuncmain3.c: New file.
3622 * testsuite/ifuncmod3.c: New file.
3623 * testsuite/ifuncmain4.c: New file.
3624 * testsuite/ifuncmain5.c: New file.
3625 * testsuite/ifuncmod5.c: New file.
3626 * testsuite/ifuncmain6pie.c: New file.
3627 * testsuite/ifuncmod6.c: New file.
3628 * testsuite/ifuncmain7.c: New file.
3629 * configure, testsuite/Makefile.in: Rebuild.
3631 2010-08-18 Ian Lance Taylor <iant@google.com>
3634 (Output_section_incremental_inputs::write_input_files): Add cast
3635 to avoid signed/unsigned comparison warning.
3636 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3638 2010-08-12 Cary Coutant <ccoutant@google.com>
3640 * common.cc (Sort_commons::operator()): Remove unnecessary code.
3642 2010-08-13 Ian Lance Taylor <iant@google.com>
3644 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
3646 2010-08-12 Cary Coutant <ccoutant@google.com>
3647 Doug Kwan <dougkwan@google.com>
3649 * resolve.cc (Symbol_table::should_override): When a weak dynamic
3650 defintion overrides non-weak undef, remember that the original undef
3652 * symtab.cc (Symbol_table::sized_write_global): For undef without
3653 an original weak binding, set binding to global in output.
3654 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
3655 * testsuite/Makefile.in: Regenerate.
3656 * testsuite/strong_ref_weak_def.sh: New file.
3657 * testsuite/strong_ref_weak_def_1.c: Ditto.
3658 * testsuite/strong_ref_weak_def_2.c: Ditto.
3660 2010-08-12 Cary Coutant <ccoutant@google.com>
3662 * testsuite/incremental_test.sh: Rewrite.
3663 * testsuite/incremental_test_1.c: Rewrite.
3664 * testsuite/incremental_test_2.c: Rewrite.
3666 2010-08-12 Cary Coutant <ccoutant@google.com>
3668 * arm.cc (Target_arm::got_size): Add const.
3669 (Target_arm::got_entry_count): New function.
3670 (Target_arm::plt_entry_count): New function.
3671 (Target_arm::first_plt_entry_offset): New function.
3672 (Target_arm::plt_entry_size): New function.
3673 (Output_data_plt_arm::entry_count): New function.
3674 (Output_data_plt_arm::first_plt_entry_offset): New function.
3675 (Output_data_plt_arm::get_plt_entry_size): New function.
3676 * i386.cc (Target_i386::got_size): Add const.
3677 (Target_i386::got_entry_count): New function.
3678 (Target_i386::plt_entry_count): New function.
3679 (Target_i386::first_plt_entry_offset): New function.
3680 (Target_i386::plt_entry_size): New function.
3681 (Output_data_plt_i386::entry_count): New function.
3682 (Output_data_plt_i386::first_plt_entry_offset): New function.
3683 (Output_data_plt_i386::get_plt_entry_size): New function.
3684 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
3685 find_incremental_inputs_sections. Dump incremental_got_plt section.
3686 * incremental.cc: Include target.h.
3687 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
3688 parameter. Adjust all callers. Find incremental_got_plt section.
3689 (Incremental_inputs::create_data_sections): Create incremental_got_plt
3691 (Output_section_incremental_inputs::set_final_data_size): Calculate
3692 size of incremental_got_plt section.
3693 (Output_section_incremental_inputs::do_write): Write the
3694 incremental_got_plt section.
3695 (Got_plt_view_info): New struct.
3696 (Local_got_offset_visitor): New class.
3697 (Global_got_offset_visitor): New class.
3698 (Global_symbol_visitor_got_plt): New class.
3699 (Output_section_incremental_inputs::write_got_plt): New function.
3700 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
3701 Add parameter. Adjust all callers.
3702 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3703 (Incremental_inputs::got_plt_section): New function.
3704 (Incremental_inputs::got_plt_section_): New data member.
3705 (Incremental_got_plt_reader): New class.
3706 * layout.cc (Layout::create_incremental_info_sections): Add the
3707 incremental_got_plt section.
3708 * object.h (Got_offset_list::get_list): New function.
3709 (Got offset_list::for_all_got_offsets): New function.
3710 (Sized_relobj::local_got_offset_list): New function.
3711 * powerpc.cc (Target_powerpc::got_size): Add const.
3712 (Target_powerpc::got_entry_count): New function.
3713 (Target_powerpc::plt_entry_count): New function.
3714 (Target_powerpc::first_plt_entry_offset): New function.
3715 (Target_powerpc::plt_entry_size): New function.
3716 (Output_data_plt_powerpc::entry_count): New function.
3717 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
3718 (Output_data_plt_powerpc::get_plt_entry_size): New function.
3719 * sparc.cc (Target_sparc::got_size): Add const.
3720 (Target_sparc::got_entry_count): New function.
3721 (Target_sparc::plt_entry_count): New function.
3722 (Target_sparc::first_plt_entry_offset): New function.
3723 (Target_sparc::plt_entry_size): New function.
3724 (Output_data_plt_sparc::entry_count): New function.
3725 (Output_data_plt_sparc::first_plt_entry_offset): New function.
3726 (Output_data_plt_sparc::get_plt_entry_size): New function.
3727 * symtab.h (Symbol::got_offset_list): New function.
3728 (Symbol_table::for_all_symbols): New function.
3729 * target.h (Sized_target::got_entry_count): New function.
3730 (Sized_target::plt_entry_count): New function.
3731 (Sized_target::plt_entry_size): New function.
3732 * x86_64.cc (Target_x86_64::got_size): Add const.
3733 (Target_x86_64::got_entry_count): New function.
3734 (Target_x86_64::plt_entry_count): New function.
3735 (Target_x86_64::first_plt_entry_offset): New function.
3736 (Target_x86_64::plt_entry_size): New function.
3737 (Output_data_plt_x86_64::entry_count): New function.
3738 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
3739 (Output_data_plt_x86_64::get_plt_entry_size): New function.
3741 2010-08-12 Cary Coutant <ccoutant@google.com>
3743 * archive.cc: Include incremental.h.
3744 (Archive::Archive): Initialize incremental_info_.
3745 (Archive::include_member): Record archive members in incremental info.
3746 (Add_archive_symbols::run): Record begin and end of an archive in
3748 (Lib_group::include_member): Record objects in incremental info.
3749 * archive.h (Incremental_archive_entry): Forward declaration.
3750 (Archive::set_incremental_info): New member function.
3751 (Archive::incremental_info): New member function.
3752 (Archive::Unused_symbol_iterator): New class.
3753 (Archive::unused_symbols_begin): New member function.
3754 (Archive::unused_symbols_end): New member function.
3755 (Archive::incremental_info_): New data member.
3756 * incremental-dump.cc (find_input_containing_global): New function.
3757 (dump_incremental_inputs): Dump new incremental info sections.
3758 * incremental.cc: Include symtab.h.
3759 (Output_section_incremental_inputs): New class.
3760 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
3761 new incremental info sections.
3762 (Sized_incremental_binary::do_check_inputs): Likewise.
3763 (Incremental_inputs::report_archive): Remove.
3764 (Incremental_inputs::report_archive_begin): New function.
3765 (Incremental_inputs::report_archive_end): New function.
3766 (Incremental_inputs::report_object): New function.
3767 (Incremental_inputs::finalize_inputs): Remove.
3768 (Incremental_inputs::report_input_section): New function.
3769 (Incremental_inputs::report_script): Rewrite.
3770 (Incremental_inputs::finalize): Do nothing but finalize string table.
3771 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3772 (Incremental_inputs::sized_create_inputs_section_data): Remove.
3773 (Incremental_inputs::create_data_sections): New function.
3774 (Incremental_inputs::relocs_entsize): New function.
3775 (Output_section_incremental_inputs::set_final_data_size): New function.
3776 (Output_section_incremental_inputs::do_write): New function.
3777 (Output_section_incremental_inputs::write_header): New function.
3778 (Output_section_incremental_inputs::write_input_files): New function.
3779 (Output_section_incremental_inputs::write_info_blocks): New function.
3780 (Output_section_incremental_inputs::write_symtab): New function.
3781 * incremental.h (Incremental_script_entry): Forward declaration.
3782 (Incremental_object_entry): Forward declaration.
3783 (Incremental_archive_entry): Forward declaration.
3784 (Incremental_inputs): Forward declaration.
3785 (Incremental_inputs_header_data): Remove.
3786 (Incremental_inputs_header): Remove.
3787 (Incremental_inputs_header_write): Remove.
3788 (Incremental_inputs_entry_data): Remove.
3789 (Incremental_inputs_entry): Remove.
3790 (Incremental_inputs_entry_write): Remove.
3791 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
3792 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
3793 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3794 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
3796 (Incremental_input_entry): New class.
3797 (Incremental_script_entry): New class.
3798 (Incremental_object_entry): New class.
3799 (Incremental_archive_entry): New class.
3800 (Incremental_inputs::Incremental_inputs): Initialize new data members.
3801 (Incremental_inputs::report_inputs): Remove.
3802 (Incremental_inputs::report_archive): Remove.
3803 (Incremental_inputs::report_archive_begin): New function.
3804 (Incremental_inputs::report_archive_end): New function.
3805 (Incremental_inputs::report_object): Change prototype.
3806 (Incremental_inputs::report_input_section): New function.
3807 (Incremental_inputs::report_script): Change prototype.
3808 (Incremental_inputs::get_reloc_count): New function.
3809 (Incremental_inputs::set_reloc_count): New function.
3810 (Incremental_inputs::create_data_sections): New function.
3811 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3812 (Incremental_inputs::inputs_section): New function.
3813 (Incremental_inputs::symtab_section): New function.
3814 (Incremental_inputs::relocs_section): New function.
3815 (Incremental_inputs::get_stringpool): Add const.
3816 (Incremental_inputs::command_line): Add const.
3817 (Incremental_inputs::inputs): Remove.
3818 (Incremental_inputs::command_line_key): New function.
3819 (Incremental_inputs::input_file_count): New function.
3820 (Incremental_inputs::input_files): New function.
3821 (Incremental_inputs::relocs_entsize): New function.
3822 (Incremental_inputs::sized_create_inputs_section_data): Remove.
3823 (Incremental_inputs::finalize_inputs): Remove.
3824 (Incremental_inputs::Input_info): Remove.
3825 (Incremental_inputs::lock_): Remove.
3826 (Incremental_inputs::inputs_): Change type.
3827 (Incremental_inputs::inputs_map_): Remove.
3828 (Incremental_inputs::current_object_entry_): New data member.
3829 (Incremental_inputs::inputs_section_): New data member.
3830 (Incremental_inputs::symtab_section_): New data member.
3831 (Incremental_inputs::relocs_section_): New data member.
3832 (Incremental_inputs::reloc_count_): New data member.
3833 (Incremental_inputs_reader): New class.
3834 (Incremental_symtab_reader): New class.
3835 (Incremental_relocs_reader): New class.
3836 * layout.cc (Layout::finalize): Move finalization of incremental info
3837 and creation of incremental info sections to follow finalization of
3838 symbol table. Set offsets for postprocessing sections.
3839 (Layout::create_incremental_info_sections): Call
3840 Incremental_inputs::create_data_sections. Add incremental symtab
3841 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
3842 sections to layout after input sections.
3843 * layout.h (struct Timespec): Forward declaration.
3844 (Layout::incremental_inputs): Add const.
3845 (Layout::create_incremental_info_sections): Add parameter.
3846 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
3847 * object.cc: Include incremental.h.
3848 (Relobj::finalize_incremental_relocs): New function.
3849 (Sized_relobj::do_layout): Record input sections in incremental info.
3850 * object.h (Object::output_section): New function.
3851 (Object::output_section_offset): Moved from Relobj.
3852 (Object::get_incremental_reloc_base): New function.
3853 (Object::get_incremental_reloc_count): New function.
3854 (Object::do_output_section): New function.
3855 (Object::do_output_section_offset): Moved from Relobj.
3856 (Object::do_get_incremental_reloc_base): New function.
3857 (Object::do_get_incremental_reloc_count): New function.
3858 (Object::Object): Initialize new data members.
3859 (Relobj::output_section): Renamed do_output_section and moved to
3861 (Relobj::output_section_offset): Moved to Object.
3862 (Relobj::do_get_incremental_reloc_base): New function.
3863 (Relobj::do_get_incremental_reloc_count): New function.
3864 (Relobj::allocate_incremental_reloc_counts): New function.
3865 (Relobj::count_incremental_reloc): New function.
3866 (Relobj::finalize_incremental_relocs): New function.
3867 (Relobj::next_incremental_reloc_index): New function.
3868 (Relobj::reloc_counts_): New data member.
3869 (Relobj::reloc_bases_): New data member.
3870 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
3871 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
3872 (Sized_relobj::incremental_relocs_scan): New function.
3873 (Sized_relobj::incremental_relocs_scan_reltype): New function.
3874 (Sized_relobj::incremental_relocs_write): New function.
3875 (Sized_relobj::incremental_relocs_write_reltype): New function.
3876 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
3878 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
3879 archives and object files elsewhere.
3880 (Add_symbols::run): Report object files here.
3881 (Finish_group::run): Report end of archive at end of group.
3882 * reloc.cc: Include layout.h, incremental.h.
3883 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
3884 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
3885 (Sized_relobj::incremental_relocs_scan): New function.
3886 (Sized_relobj::incremental_relocs_scan_reltype): New function.
3887 (Sized_relobj::do_relocate_sections): Write incremental relocations.
3888 (Sized_relobj::incremental_relocs_write): New function.
3889 (Sized_relobj::incremental_relocs_write_reltype): New function.
3890 * script.cc (read_input_script): Rewrite test for incremental link.
3891 Change call to Incremental_inputs::report_script.
3892 * symtab.h (Symbol_table::first_global_index): New function.
3893 (Symbol_table::output_count): New function.
3895 2010-08-12 Doug Kwan <dougkwan@google.com>
3897 * arm.cc (Target_arm::merge_object_attributes): Check command line
3898 options --no-wchar-size-warning and --no-enum-size-warning.
3899 * options.h (General_options): Add ld-compatible options
3900 --no-enum-size-warning and --no-wchar-size-warning.
3902 2010-08-04 Ian Lance Taylor <iant@google.com>
3904 * x86_64.cc (Target_x86_64::Scan::local): Use
3905 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
3906 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
3907 (Target_x86_64::Scan::global): Likewise.
3908 (Target_x86_64::Relocate::relocate): Likewise.
3909 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
3912 2010-08-03 Cary Coutant <ccoutant@google.com>
3914 * merge.cc (Output_merge_string::do_add_input_section): Count strings
3915 to reserve space in merged_strings vector. Keep total input size
3917 (Output_merge_string::do_print_merge_stats): Print total input size.
3918 * merge.h (Output_merge_string): Add input_size_ field.
3919 * stringpool.cc (Stringpool_template::string_length): Move
3920 implementations out of Stringpool_template class and place in
3922 * stringpool.h (string_length): Move out of Stringpool_template.
3924 2010-08-03 Ian Lance Taylor <iant@google.com>
3927 * layout.cc (relaxation_loop_body): If address of load segment is
3928 set, adjust address to include headers if possible.
3930 2010-08-03 Ian Lance Taylor <iant@google.com>
3932 * version.cc (version_string): Bump to 1.10.
3934 2010-08-03 Ian Lance Taylor <iant@google.com>
3937 * layout.h (enum Output_section_order): Define.
3938 (class Layout): Update declarations.
3939 * layout.cc (Layout::get_output_section): Add order parameter.
3940 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
3941 is_first_non_relro parameters. Change all callers.
3942 (Layout::choose_output_section): Likewise.
3943 (Layout::add_output_section_data): Likewise.
3944 (Layout::make_output_section): Likewise. Set order.
3945 (Layout::default_section_order): New function.
3946 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
3947 * output.cc (Output_section::Output_section): Initialize order_.
3948 Don't initialize deleted fields.
3949 (Output_segment::Output_segment): Don't initialize deleted
3951 (Output_segment::add_output_section_to_load): New function
3952 replacing add_output_section. Change all callers to call this or
3953 add_output_section_to_nonload.
3954 (Output_segment::add_output_section_to_nonload): New function.
3955 (Output_segment::remove_output_section): Rewrite.
3956 (Output_segment::add_initial_output_data): Likewise.
3957 (Output_segment::has_any_data_sections): Likewise.
3958 (Output_segment::is_first_section_relro): Likewise.
3959 (Output_segment::maximum_alignment): Likewise.
3960 (Output_segment::has_dynamic_reloc): New function replacing
3961 dynamic_reloc_count. Change all callers.
3962 (Output_segment::has_dynamic_reloc_list): New function replacing
3963 dynamic_reloc_count_list. Change all callers.
3964 (Output_segment::set_section_addresses): Rewrite.
3965 (Output_segment::set_offset): Rewrite.
3966 (Output_segment::find_first_and_last_list): Remove.
3967 (Output_segment::set_tls_offsets): Rewrite.
3968 (Output_segment::first_section_load_address): Likewise.
3969 (Output_segment::output_section_count): Likewise.
3970 (Output_segment::section_with_lowest_load_address): Likewise.
3971 (Output_segment::write_section_headers): Likewise.
3972 (Output_segment::print_sections_to_map): Likewise.
3973 * output.h (class Output_data): Remove dynamic_reloc_count_
3974 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
3975 (Output_data::add_dynamic_reloc): Rewrite.
3976 (Output_data::has_dynamic_reloc): New function.
3977 (Output_data::dynamic_reloc_count): Remove.
3978 (class Output_section): Add order_ field. Remvoe is_relro_local_,
3979 is_last_relro_, is_first_non_relro_, is_interp_,
3980 is_dynamic_linker_section_ fields. Add order and set_order
3981 functions. Remove is_relro_local, set_is_relro_local,
3982 is_last_relro, set_is_last_relro, is_first_non_relro,
3983 set_is_first_non_relro functions, is_interp, set_is_interp,
3984 is_dynamic_linker_section, and set_is_dynamic_linker_section
3986 (class Output_segment): Change Output_data_list from std::list to
3987 std:;vector. Add output_lists_ field. Remove output_data_ and
3988 output_bss_ fields. Update declarations.
3990 2010-08-02 Ian Lance Taylor <iant@google.com>
3992 * arm.cc (Target_arm::gc_process_relocs): Use typename.
3993 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
3994 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
3996 2010-08-02 Ian Lance Taylor <iant@google.com>
3999 * script.cc (Script_options::Script_options): Initialize
4000 symbol_definitions_ and symbol_references_.
4001 (Script_options::add_symbol_assignment): Update
4002 symbol_definitions_ and symbol_references_.
4003 (Script_options::add_symbol_reference): New function.
4004 (script_symbol): New function.
4005 * script.h (class Script_options): Add symbol_definitions_ and
4006 symbol_references_ fields.
4007 (Script_options::referenced_const_iterator): New type.
4008 (Script_options::referenced_begin): New function.
4009 (Script_options::referenced_end): New function.
4010 (Script_options::is_referenced): New function.
4011 (Script_options::any_unreferenced): New function.
4012 * script-c.h (script_symbol): Declare.
4013 * yyscript.y (exp): Call script_symbol.
4014 * symtab.cc: Include "script.h".
4015 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
4016 Change all callers. Check symbols referenced by scripts.
4017 (Symbol_table::add_undefined_symbols_from_command_line): Add
4018 layout parameter. Change all callers.
4019 (Symbol_table::do_add_undefined_symbols_from_command_line):
4020 Likewise. Break out loop body. Check symbols referenced by
4022 (Symbol_table::add_undefined_symbol_from_command_line): New
4023 function broken out of
4024 do_add_undefined_symbols_from_command_line.
4025 * symtab.h (class Symbol_table): Update declarations.
4026 * archive.cc: Include "layout.h".
4027 (Archive::should_include_member): Add layout parameter. Change
4028 all callers. Check for symbol mentioned in expression.
4029 * archive.h (class Archive): Update declaration.
4030 * object.cc (Sized_relobj::do_should_include_member): Add layout
4032 * object.h (Object::should_include_member): Add layout parameter.
4034 (Object::do_should_include_member): Add layout parameter.
4035 (class Sized_relobj): Update declaration.
4036 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
4038 * dynobj.h (class Sized_dynobj): Update declaration.
4039 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
4041 * plugin.h (class Sized_pluginobj): Update declaration.
4043 2010-08-02 Ian Lance Taylor <iant@google.com>
4046 * output.cc (Output_segment::set_offset): Search for the first and
4047 last sections rather than assuming that the list is in order.
4048 (Output_segment::find_first_and_last_list): New function.
4049 * output.h (class Output_segment): Update declarations.
4050 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4051 (relro_strip_test_SOURCES): New variable.
4052 (relro_strip_test_DEPENDENCIES): New variable.
4053 (relro_strip_test_LDFLAGS): New variable.
4054 (relro_strip_test_LDADD): New variable.
4055 (relro_strip_test.so): New target.
4057 2010-08-02 Ian Lance Taylor <iant@google.com>
4059 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4060 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4061 (Target_i386::got_tlsdesc_section): New function.
4062 (Target_i386::got_section): Create space for GOT entries for
4063 TLSDESC relocations.
4064 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4066 (Target_i386::Scan::global): Likewise.
4067 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
4069 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
4070 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
4071 (Target_x86_64::got_tlsdesc_section): New function.
4072 (Target_x86_64::got_section): Create space for GOT entries for
4073 TLSDESC relocations.
4074 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
4076 (Target_x86_64::Scan::global): Likewise.
4077 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
4080 2010-08-02 Ian Lance Taylor <iant@google.com>
4082 * testsuite/final_layout.sh: Use dc to convert from hex to
4085 2010-07-29 Sriraman Tallam <tmsriram@google.com>
4087 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4088 paramter to the call to gold::gc_process_relocs.
4089 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4090 paramter to the call to gold::gc_process_relocs.
4091 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4092 parameter to the call to gold::gc_process_relocs.
4093 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4094 template parameter to the call to gold::gc_process_relocs.
4095 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4096 paramter to the call to gold::gc_process_relocs.
4097 * gc.h (get_embedded_addend_size): New function.
4098 (gc_process_relocs): Save the size of the reloc for use by ICF.
4099 * icf.cc (get_section_contents): Get the addend from the text section
4100 for SHT_REL relocation sections.
4101 * icf.h (Icf::Reloc_addend_size_info): New typedef.
4102 (Icf::Reloc_info): Add new member reloc_addend_size_info.
4103 * int_encoding.h (read_from_pointer): New overloaded function.
4104 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
4105 * testsuite/icf_sht_rel_addend_test.sh: New file.
4106 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
4107 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
4109 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4111 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
4112 * Makefile.in: Regenerate.
4113 * testsuite/Makefile.in: Regenerate.
4115 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
4117 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
4118 * gold/testsuite/debug_msg.cc: Likewise.
4119 * gold/testsuite/odr_violation1.cc
4120 * gold/testsuite/odr_violation2.cc
4122 2010-07-21 Cary Coutant <ccoutant@google.com>
4124 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
4125 string, and length fields.
4126 (Output_merge_string::Merged_strings_list): New type.
4127 (Output_merge_string::Merged_strings_lists): New typedef.
4128 (Output_merge_string): Replace merged_strings_ with
4129 merged_strings_lists_.
4130 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
4131 Merged_strings_list per input object and section. Don't store pointer
4132 to the string. Don't store length with each merged string entry.
4133 (Output_merge_string::finalize_merged_data): Loop over list of merged
4134 strings lists. Recompute length of each merged string.
4136 2010-07-15 Cary Coutant <ccoutant@google.com>
4138 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
4141 2010-07-14 Ian Lance Taylor <iant@google.com>
4143 * descriptors.cc (Descriptors::open): Report correct name in error
4146 2010-07-13 Doug Kwan <dougkwan@google.com>
4148 * arm.cc (Arm_input_section::Arm_input_section): For a
4149 SHT_ARM_EXIDX section, always keeps the input sections.
4150 (Arm_input_section::set_exidx_section_link): New method.
4151 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
4152 has_errors_ to false.
4153 (Arm_exidx_input_section::has_errors,
4154 Arm_exidx_input_section::set_has_errors): New methods.
4155 (Arm_exidx_input_section::has_errors_): New data member.
4156 (Arm_relobj::get_exidx_shndx_list): New method.
4157 (Arm_output_section::append_text_sections_to_list): Do not skip
4158 section without SHF_EXECINSTR.
4159 (Arm_output_section::fix_exidx_coverage): Skip input sections with
4161 (Arm_relobj::make_exidx_input_section): Add new parameter for text
4162 section header. Make error messages more verbose. Check for
4163 a non-executable section linked to an EXIDX section.
4164 (Arm_relobj::do_read_symbols): Remove error checking, which has been
4165 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
4166 check that there is no deferred EXIDX section if we exit early.
4167 Instead of not making an EXIDX section in case of an error, make one
4168 and set the has_errors flag of it.
4169 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
4170 in a relocatable link.
4171 (Target_arm::do_relax): Look for the EXIDX output section instead of
4172 assuming that it is called .ARM.exidx.
4173 (Target_arm::fix_exidx_coverage): Add a new parameter for input
4174 section list. Do not check for SHF_EXECINSTR section flags but
4175 skip any input section with errors.
4176 * output.cc (Output_section::Output_section): Initialize
4177 always_keeps_input_sections_ to false.
4178 (Output_section::add_input_section): Check for
4179 always_keeps_input_sections_.
4180 * output.h (Output_section::always_keeps_input_sections,
4181 Output_section::set_always_keeps_input_sections): New methods.
4182 (Output_section::always_keeps_input_sections): New data member.
4184 2010-07-13 Rafael Espindola <espindola@google.com>
4186 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
4187 * fileread.h (Input_file): Add try_extra_search_path and find_file.
4189 2010-07-13 Philip Herron <herron.philip@googlemail.com>
4190 Ian Lance Taylor <iant@google.com>
4192 * output.h (Output_section_lookup_maps::add_merge_section):
4193 Correct check of whether value was inserted.
4194 (Output_section_lookup_maps::add_merge_input_section): Likewise.
4195 (Output_section_lookup_maps::add_relaxed_input_section):
4197 * arm.cc (Target_arm::got_section): Remove used local os.
4198 * i386.cc (Target_i386::got_section): Likewise.
4199 * x86_64.cc (Target_x86_64::got_section): Likewise.
4200 * sparc.cc (Target_sparc::got_section): Likewise.
4201 (Target_sparc::relocate): Remove unused local have_got_offset.
4202 * powerpc.cc (Target_powerpc::relocate): Likewise.
4204 2010-07-13 Ian Lance Taylor <iant@google.com>
4206 * compressed_output.cc (zlib_decompress): Fix signature in
4209 * archive.cc (Archive::include_member): Unlock an external member
4210 of a thin archive. Don't bother to delete an object we know is
4213 2010-07-12 Cary Coutant <ccoutant@google.com>
4215 * compressed_output.cc (zlib_decompress): New function.
4216 (get_uncompressed_size): New function.
4217 (decompress_input_section): New function.
4218 * compressed_output.h (get_uncompressed_size): New function.
4219 (decompress_input_section): New function.
4220 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
4221 Handle compressed debug sections.
4222 * layout.cc (is_compressed_debug_section): New function.
4223 (Layout::output_section_name): Map compressed section names to
4225 * layout.h (is_compressed_debug_section): New function.
4226 (is_debug_info_section): Recognize compressed debug sections.
4227 * merge.cc: Include compressed_output.h.
4228 (Output_merge_data::do_add_input_section): Handle compressed
4230 (Output_merge_string::do_add_input_section): Handle compressed
4232 * object.cc: Include compressed_output.h.
4233 (Sized_relobj::Sized_relobj): Initialize new data members.
4234 (build_compressed_section_map): New function.
4235 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
4236 * object.h (Object::section_is_compressed): New method.
4237 (Object::do_section_is_compressed): New method.
4238 (Sized_relobj::Compressed_section_map): New type.
4239 (Sized_relobj::do_section_is_compressed): New method.
4240 (Sized_relobj::compressed_sections_): New data member.
4241 * output.cc (Output_section::add_input_section): Handle compressed
4243 * reloc.cc: Include compressed_output.h.
4244 (Sized_relobj::write_sections): Handle compressed debug sections.
4246 2010-07-08 Cary Coutant <ccoutant@google.com>
4248 * resolve.cc (Symbol_table::resolve): Remember whether undef was
4249 weak when resolving to a dynamic def.
4250 (Symbol_table::should_override): Add adjust_dyndef flag; set it
4251 for weak undef/dynamic def cases. Adjust callers.
4252 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
4253 undef_binding_weak_.
4254 (Symbol_table::sized_write_globals): Adjust symbol binding.
4255 (Symbol_table::sized_write_symbol): Add binding parameter.
4256 * symtab.h (Symbol::set_undef_binding): New method.
4257 (Symbol::is_undef_binding_weak): New method.
4258 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
4259 (Symbol_table::should_override): Add new parameter.
4260 (Symbol_table::sized_write_symbol): Add new parameter.
4262 * testsuite/weak_undef_file1.cc: Add new test case.
4263 * testsuite/weak_undef_file2.cc: Fix header comment.
4264 * testsuite/weak_undef_test.cc: Add new test case.
4266 2010-06-29 Doug Kwan <dougkwan@google.com>
4268 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
4269 Initialize USE_SYMBOL_.
4270 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
4272 (Arm_reloc_property::uses_symbol_): New data member declaration.
4273 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
4274 uses symbol value and symbol is undefined but not weakly undefined.
4276 2010-06-28 Rafael Espindola <espindola@google.com>
4278 * plugin.cc (Plugin::load): Use dlerror.
4280 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
4282 * symtab.cc (detect_odr_violations): When reporting an ODR
4283 violation, report an object where the symbol is defined.
4285 2010-06-25 Doug Kwan <dougkwan@google.com>
4287 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
4288 (Target_arm::section_may_have_icf_unsafe_pointers): New method
4290 (Target_arm::Scan::local_reloc_may_be_function_pointer,
4291 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
4292 target hook to detect function points.
4293 (Target_arm::Scan::possible_function_pointer_reloc): New method.
4294 * icf.h (Icf::check_section_for_function_pointers): Change type of
4295 parameter SECTION_NAME to const reference to std::string. Use
4296 target hook to determine if section may have unsafe pointers.
4297 * target.h (Target::section_may_have_icf_unsafe_pointers): New
4300 2010-06-21 Rafael Espindola <espindola@google.com>
4302 * fileread.cc (Input_file::find_fie): New
4303 (Input_file::open): Use Input_file::find_fie.
4304 * fileread.h (Input_file::find_fie): New
4305 * plugin.cc (set_extra_library_path): New.
4306 (Plugin::load): Add set_extra_library_path to the transfer vector.
4307 (Plugin_manager::set_extra_library_path): New.
4308 (Plugin_manager::add_input_file): Use the extra search path if set.
4309 (set_extra_library_path(): New.
4310 * plugin.h (Plugin_manager): Add set_extra_library_path and
4313 2010-06-19 Cary Coutant <ccoutant@google.com>
4315 * layout.cc (gdb_sections): Add .debug_types.
4316 (lines_only_debug_sections): Likewise.
4318 2010-06-18 Rafael Espindola <espindola@google.com>
4320 * plugin.cc (add_input_file,add_input_library)
4321 (Plugin_manager::add_input_file): Make filename arguments const.
4322 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
4325 2010-06-16 Doug Kwan <dougkwan@google.com>
4327 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
4328 .ARM.attributes section if we have not merged any input
4329 attributes sections.
4331 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4333 * arm.cc: Allow combining objects with no EABI version
4336 2010-06-15 Rafael Espindola <espindola@google.com>
4338 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
4340 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4342 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
4343 (struct iovec): Correct !HAVE_READV definition.
4345 2010-06-10 Cary Coutant <ccoutant@google.com>
4347 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
4348 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
4350 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
4353 * symtab.h (Symbol::is_placeholder): New member function.
4354 * target-reloc.h (relocate_section): Check for placeholder symbols.
4356 * testsuite/Makefile.am (plugin_test_8): New test.
4357 (plugin_test_9): New test.
4358 * testsuite/Makefile.in: Regenerate.
4360 2010-06-09 Nick Clifton <nickc@redhat.com>
4362 * yyscript.y (input_list_element): Allow strings prefixed with
4363 the '-' character. Treat these as libraries.
4364 * script.cc (script_add_library): New function. Adds a library
4365 specified by "-l<name>" found in an input script.
4366 * script-c.h: Add prototype for script_add_library.
4368 2010-06-07 Doug Kwan <dougkwan@google.com>
4370 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
4371 Restrict stub-group size to be within long conditional branch
4372 range when working around cortex-A8 erratum.
4374 2010-06-07 Damien Diederen <dd@crosstwine.com>
4376 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
4379 2010-06-03 Sriraman Tallam <tmsriram@google.com>
4383 (Output_section::Input_section_sort_entry::compare_section_ordering):
4384 Change to return non-zero correctly.
4385 (Output_section::Input_section_sort_section_order_index_compare
4386 ::operator()): Change to fix ambiguity in comparisons.
4388 2010-06-01 Sriraman Tallam <tmsriram@google.com>
4390 * gold.h (is_wildcard_string): New function.
4391 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
4392 (Layout::layout_eh_frame): Ditto.
4393 (Layout::find_section_order_index): New method.
4394 (Layout::read_layout_from_file): New method.
4395 * layout.h (Layout::find_section_order_index): New method.
4396 (Layout::read_layout_from_file): New method.
4397 (Layout::input_section_position_): New private member.
4398 (Layout::input_section_glob_): New private member.
4399 * main.cc (main): Call read_layout_from_file here.
4400 * options.h (--section-ordering-file): New option.
4401 * output.cc (Output_section::input_section_order_specified_): New
4403 (Output_section::Output_section): Initialize new member.
4404 (Output_section::add_input_section): Add new parameter.
4405 Keep input sections when --section-ordering-file is used.
4406 (Output_section::set_final_data_size): Sort input sections when
4407 section ordering file is specified.
4408 (Output_section::Input_section_sort_entry): Add new parameter.
4410 (Output_section::Input_section_sort_entry::compare_section_ordering):
4412 (Output_section::Input_section_sort_compare::operator()): Change to
4413 consider section_order_index.
4414 (Output_section::Input_section_sort_init_fini_compare::operator()):
4415 Change to consider section_order_index.
4416 (Output_section::Input_section_sort_section_order_index_compare
4417 ::operator()): New method.
4418 (Output_section::sort_attached_input_sections): Change to sort
4419 according to section order when specified.
4420 (Output_section::add_input_section<32, true>): Add new parameter.
4421 (Output_section::add_input_section<64, true>): Add new parameter.
4422 (Output_section::add_input_section<32, false>): Add new parameter.
4423 (Output_section::add_input_section<64, false>): Add new parameter.
4424 * output.h (Output_section::add_input_section): Add new parameter.
4425 (Output_section::input_section_order_specified): New
4427 (Output_section::set_input_section_order_specified): New method.
4428 (Input_section::Input_section): Initialize section_order_index_.
4429 (Input_section::section_order_index): New method.
4430 (Input_section::set_section_order_index): New method.
4431 (Input_section::section_order_index_): New member.
4432 (Input_section::Input_section_sort_section_order_index_compare): New
4434 (Output_section::input_section_order_specified_): New member.
4435 * script-sections.cc (is_wildcard_string): Delete and move modified
4437 (Output_section_element_input::Output_section_element_input): Modify
4438 call to is_wildcard_string.
4439 (Output_section_element_input::Input_section_pattern
4440 ::Input_section_pattern): Ditto.
4441 (Output_section_element_input::Output_section_element_input): Ditto.
4442 * testsuite/Makefile.am (final_layout): New test case.
4443 * testsuite/Makefile.in: Regenerate.
4444 * testsuite/final_layout.cc: New file.
4445 * testsuite/final_layout.sh: New file.
4447 2010-06-01 Rafael Espindola <espindola@google.com>
4449 * plugin.cc (Plugin::load): Pass the output name to the plugin.
4451 2010-06-01 Rafael Espindola <espindola@google.com>
4453 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
4454 visibility of symbols.
4456 2010-05-27 Doug Kwan <dougkwan@google.com>
4458 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
4459 from start of output section instead of address for a local symbol
4460 in a merged or relaxed section when doing a relocatable link.
4462 2010-05-26 Rafael Espindola <espindola@google.com>
4465 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
4466 adding sections the garbage collector removed.
4467 * gold/testsuite/Makefile.am: Add test.
4468 * gold/testsuite/Makefile.in: Regenerate.
4469 * gold/testsuite/plugin_test_7.sh: New.
4470 * gold/testsuite/plugin_test_7_1.c: New.
4471 * gold/testsuite/plugin_test_7_2.c: New.
4473 2010-05-26 Rafael Espindola <espindola@google.com>
4475 * script-sections.cc (Output_section_definition::set_section_addresses):
4476 Check for --section-start.
4478 2010-05-26 Doug Kwan <dougkwan@google.com>
4480 * arm.cc (Arm_scan_relocatable_relocs): New class.
4481 (Target_arm::relocate_special_relocatable): New method.
4482 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
4483 (Arm_relocate_functions::thumb_branch_common): Same.
4484 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
4485 instead of Default_scan_relocatable_relocs.
4486 * target-reloc.h (relocate_for_relocatable): Let target handle
4487 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
4488 * target.h (Sized_target::relocate_special_relocatable): New method.
4490 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4492 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
4494 2010-05-23 Doug Kwan <dougkwan@google.com>
4496 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
4498 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
4499 with a direct branch, not a conditional branch, to a stub.
4500 * merge.cc (Output_merge_base::record_input_section): New method
4502 (Output_merge_data::do_add_input_section): Record input section if
4503 keeps-input-sections flag is set.
4504 (Output_merge_string::do_add_input_section): Ditto.
4505 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
4506 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
4508 (Output_merge_base::keeps_input_sections,
4509 Output_merge_base::set_keeps_input_sections,
4510 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
4512 (Output_merge_base::Input_sections): New type declaration.
4513 (Output_merge_base::input_sections_begin,
4514 Output_merge_base::input_sections_end,
4515 Output_merge_base::do_set_keeps_input_sections): New method definitions.
4516 (Output_merge_base::bool keeps_input_sections_,
4517 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
4518 Output_merge_base::input_sections_): New data members.
4519 (Output_merge_data::do_set_keeps_input_sections): New method
4521 (Output_merge_string::do_set_keeps_input_sections): Ditto.
4522 * output.cc (Output_section::Input_section::relobj): Move method
4523 defintion from class declaration to here and handle merge sections.
4524 (Output_section::Input_section::shndx): Ditto.
4525 (Output_section::Output_section): Remove initializations of removed
4526 data members and initialize new data member LOOKUP_MAPS_.
4527 (Output_section::add_input_section): Set keeps-input-sections flag
4528 for a newly created merge output section as appropriate. Adjust code
4529 to use Output_section_lookup_maps class.
4530 (Output_section::add_relaxed_input_section): Adjst code for lookup
4531 maps code refactoring.
4532 (Output_section::add_merge_input_section): Add a new parameter
4533 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
4534 class. If adding input section to a newly created merge output
4535 section fails, remove the new merge section.
4536 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
4537 Adjust code for use of the Output_section_lookup_maps class.
4538 (Output_section::find_merge_section): Ditto.
4539 (Output_section::build_lookup_maps): New method defintion.
4540 (Output_section::find_relaxed_input_section): Adjust code to use
4541 Output_section_lookup_maps class.
4542 (Output_section::get_input_sections): Export merge sections. Adjust
4543 code to use Output_section_lookup_maps class.
4544 (Output_section:::add_script_input_section): Adjust code to use
4545 Output_section_lookup_maps class. Update lookup maps for merge
4547 (Output_section::discard_states): Use Output_section_lookup_maps.
4548 (Output_section::restore_states): Same.
4549 * output.h (Merge_section_properties): Move class defintion out of
4551 (Output_section_lookup_maps): New class.
4552 (Output_section::Input_section::is_merge_section): New method
4554 (Output_section::Input_section::relobj): Move defintion out of class
4555 defintion. Declare method only.
4556 (Output_section::Input_section::shndx): Ditto.
4557 (Output_section::Input_section::output_merge_base): New method defintion.
4558 (Output_section::Input_section::u2_.pomb): New union field.
4559 (Output_section::Merge_section_by_properties_map,
4560 Output_section::Output_section_data_by_input_section_map,
4561 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
4563 (Output_section::add_merge_input_section): Add new parameter
4564 KEEPS_INPUT_SECTIONS.
4565 (Output_section::build_lookup_maps): New method declaration.
4566 (Output_section::merge_section_map_,
4567 Output_section::merge_section_by_properties_map_,
4568 Output_section::relaxed_input_section_map_,
4569 Output_section::is_relaxed_input_section_map_valid_): Remove data
4571 (Output_section::lookup_maps_): New data member.
4573 2010-05-21 Doug Kwan <dougkwan@google.com>
4576 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
4577 avoid a compilation error.
4579 2010-05-19 Rafael Espindola <espindola@google.com>
4581 * script-sections.cc (Output_section_definition::allocate_to_segment):
4582 Update the phdrs_list even when the output section is NULL.
4583 * testsuite/Makefile.am: Add test.
4584 * testsuite/Makefile.in: Regenerate.
4585 * testsuite/script_test_9.cc: New.
4586 * testsuite/script_test_9.sh: New.
4587 * testsuite/script_test_9.t: New.
4589 2010-05-19 Doug Kwan <dougkwan@google.com>
4591 * arm.cc (Arm_input_section::original_size): New method.
4592 (Arm_input_section::do_addralign): Add a cast.
4593 (Arm_input_section::do_output_offset): Remove static cast.
4594 (Arm_input_section::original_addralign,
4595 Arm_input_section::original_size_): Change type to uint32_t.
4596 (Arm_input_section::init): Add safe casts for section alignment
4598 (Arm_input_section::set_final_data_size): Do not set address and
4599 offset of stub table.
4600 (Arm_output_section::fix_exidx_coverage): Change use of of
4601 Output_section::Simple_input_section to that of
4602 Output_section::Input_section.
4603 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
4604 except for the first pass.
4605 * output.cc (Output_section::get_input_sections): Change type of
4606 input_sections to std::list<Input_section>.
4607 (Output_section::add_script_input_section): Rename from
4608 Output_section::add_simple_input_section. Change type of SIS
4609 parameter from Simple_input_section to Input_section.
4610 * output.h (Output_section::Simple_input_section): Remove class.
4611 (Output_section::Input_section): Change class visibility to public.
4612 (Output_section::Input_section::addralign): Use stored alignments
4613 for special input sections if set.
4614 (Output_section::Input_section::set_addralign): New method.
4615 (Output_section::get_input_sections): Change parameter type from
4616 list of Simple_input_section to list of Input_section.
4617 (Output_section::add_script_input_section): Rename from
4618 Output_section::add_simple_input_section. Change first parameter's
4619 type from Simple_input_section to Input_section and remove the
4620 second and third parameters.
4621 * script-sections.cc (Input_section::Input_section_list): Change
4622 type to list of Output_section::Input_section/
4623 (Input_section_info::Input_section_info): Change parameter type of
4624 INPUT_SECTION to Output_section::Input_section.
4625 (Input_section_info::input_section): Change return type.
4626 (Input_section_info::input_section_): Change type to
4627 Output_section::Input_section.
4628 (Output_section_element_input::set_section_addresses): Adjust code
4629 to use Output_section::Input_section instead of
4630 Output_section::Simple_input_section. Adjust code for renaming
4631 of Output_section::add_simple_input_section.
4632 (Orphan_output_section::set_section_addresses): Ditto.
4634 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4636 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
4637 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
4639 2010-05-18 Rafael Espindola <espindola@google.com>
4641 * options.cc (General_options::finalize): Handle -nostdlib.
4642 * options.h (nostdlib): New option.
4643 * script.cc (script_add_search_dir): Handle -nostdlib.
4645 2010-05-12 Doug Kwan <dougkwan@google.com>
4647 * arm.cc (Target_arm::do_finalize_sections): Create an empty
4648 attributes section only if there no attributes section after merging.
4649 (Target_arm::merge_object_attributes): Move value of
4650 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
4651 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
4652 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
4653 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
4654 and arm_attr_merge_7.stdout.
4655 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
4656 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
4657 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
4658 arm_attr_merge_7b.o): New rules.
4659 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
4661 * testsuite/Makefile.in: Regenerate.
4662 * testsuite/arm_attr_merge.sh: New file.
4663 * testsuite/arm_attr_merge_[67][ab].s: Same.
4665 2010-05-05 Nick Clifton <nickc@redhat.com>
4667 * po/es.po: Updated Spanish translation.
4669 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
4671 * Makefile.am (install-exec-local): Properly install gold as
4672 default cross linker.
4673 * Makefile.in: Regenerated.
4675 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
4676 Nick Clifton <nickc@redhat.com>
4678 * configure.ac (install_as_default): Define and set to false
4679 unless --enable-gold or --enable-gold=both/gold has been
4681 * configure: Regenerate.
4683 * Makefile.am (install-exec-local): Install the executable as
4684 'ld.gold'. If install_as_default is true then also install it as
4686 * Makefile.in: Regenerated.
4688 2010-04-24 Ian Lance Taylor <iant@google.com>
4690 * layout.cc (Layout::layout_reloc): In relocatable link don't
4691 combine reloc sections for grouped sections.
4693 2010-04-23 Sriraman Tallam <tmsriram@google.com>
4695 * gc.h (gc_process_relocs): Pass information on relocs pointing to
4696 sections that are not ordinary to icf.
4697 * icf.cc (get_section_contents): Handle relocation pointing to section
4698 with no object or shndx information.
4699 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
4700 * testsuite/Makefile.in: Regenerate.
4701 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
4702 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
4704 2010-04-22 Ian Lance Taylor <iant@google.com>
4706 * expression.cc (Expression::Expression_eval_info): Add
4707 result_alignment_pointer field.
4708 (Expression::eval_with_dot): Add result_alignment_pointer
4709 parameter. Change all callers.
4710 (Expression::eval_maybe_dot): Likewise.
4711 (class Binary_expression): Add alignment_pointer parameter to
4712 left_value and right_value. Change all callers.
4713 (BINARY_EXPRESSION): Set result alignment.
4714 (class Trinary_expression): Add alignment_pointer parameter to
4715 arg2_value and arg3_value. Change all callers.
4716 (Trinary_cond::value): Set result alignment.
4717 (Max_expression::value, Min_expression::value): Likewise.
4718 (Align_expression::value): Likewise.
4719 * script-sections.cc (class Sections_element): Add dot_alignment
4720 parameter to set_section_addresses virtual function. Update
4722 (class Output_section_element): Likewise.
4723 (Script_sections::create_segments): Add dot_alignment parameter.
4725 (Script_sections::create_segments_from_phdrs_clause): Likewise.
4726 (Script_sections::set_phdrs_clause_addresses): Likewise.
4727 * script-sections.h: Update declarations.
4728 * script.h: Update declarations.
4729 * output.h (Output_segment::set_minimum_p_align): Don't decrease
4731 * testsuite/script_test_3.t: Set large alignment.
4732 * testsuite/script_test_3.sh: Make sure that at least one LOAD
4733 segment has expected alignment.
4735 2010-04-22 Nick Clifton <nickc@redhat.com>
4737 * po/gold.pot: Updated by the Translation project.
4738 * po/vi.po: Updated Vietnamese translation.
4740 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
4742 * testsuite/Makefile.am (check_PROGRAMS): Add
4743 icf_virtual_function_folding_test.
4744 * testsuite/Makefile.in: Regenerated.
4746 2010-04-15 Andrew Haley <aph@redhat.com>
4748 * options.h (merge_exidx_entries): New option.
4749 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
4750 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
4751 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
4752 (Target_arm::merge_exidx_entries): New function.
4753 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
4754 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
4755 to Arm_exidx_fixup constructor.
4756 Add new arg, merge_exidx_entries.
4757 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
4758 Arm_output_section::fix_exidx_coverage.
4760 2010-04-18 Sriraman Tallam <tmsriram@google.com>
4762 * icf.cc (get_section_contents): Check for preemptible functions.
4763 Ignore addend when appropriate.
4764 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
4766 (add_from_relobj): Check for section folded.
4767 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
4768 * symtab.h (should_add_dynsym_entry): Add new parameter.
4769 * target-reloc.h (scan_relocs): Check for section folded.
4770 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
4771 Check reloc types for function pointers in shared objects.
4772 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
4774 (icf_preemptible_functions_test): New test case.
4775 (icf_string_merge_test): New test case.
4776 * testsuite.Makefile.in: Regenerate.
4777 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
4778 bar_glob. Refactor code.
4779 * testsuite/icf_preemptible_functions_test.cc: New file.
4780 * testsuite/icf_preemptible_functions_test.sh: New file.
4781 * testsuite/icf_string_merge_test.cc: New file.
4782 * testsuite/icf_string_merge_test.sh: New file.
4783 * testsuite/icf_virtual_function_folding_test.cc: New file.
4784 * testsuite/icf_virtual_function_folding_test.sh: New file.
4786 2010-04-14 Doug Kwan <dougkwan@google.com>
4788 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
4789 for local symbol recounting if we remove a section due to ICF.
4790 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
4791 there are no regular objects in input.
4793 2010-04-13 Doug Kwan <dougkwan@google.com>
4795 * arm.cc (Arm_input_section::set_final_data_size): Compute
4796 accurate final data size instead of using current data size.
4798 2010-04-09 Doug Kwan <dougkwan@google.com>
4800 * layout.cc (Layout::choose_output_section): Handle script section
4802 (Layout::make_output_section_for_script): Add section type parameter.
4803 Handle script section types.
4804 * layout.h (Layout::make_output_section_for_script): Add section
4806 * output.cc (Output_section::Output_section): Initialize data member
4808 (Output_section::do_reset_address_and_file_offset): Do not set address
4809 to 0 if section is a NOLOAD section.
4810 * output.h (Output_section::is_noload): New method.
4811 (Output_section::set_is_noload): Ditto.
4812 (Output_section::is_noload_): New data member.
4813 * script-c.h (Script_section_type): New enum type.
4814 (struct Parser_output_section_header): Add new file section_type.
4815 * script-sections.cc (Sections_element::output_section_name): Add
4816 parameter for returning script section type.
4817 (Output_section_definition::output_section_name): Ditto.
4818 (Output_section_definition::section_type)P; New method.
4819 (Output_section_definiton::script_section_type_name): Ditto.
4820 (Output_section_definition::script_section_type_): New data member.
4821 (Output_section_definition::Output_section_definition): Initialize
4822 data member Output_section_definition::script_section_type_.
4823 (Output_section_definition::create_sections): Pass script section type
4824 to Layout::make_output_section_for_script.
4825 (Output_section_definition::output_section_name): Return script
4826 section type to caller.
4827 (Output_section_definition::set_section_address): Do not advance
4828 dot value and load address if section type is NOLOAD. Set address
4829 of NOLOAD sections regardless of section flags.
4830 (Output_section_definition::print): Print section type if it is
4831 not SCRIPT_SECTION_TYPE_NONE.
4832 (Output_section_definition::section_type): New method.
4833 (Output_section_definition::script_section_type_name): Ditto.
4834 (Script_sections::output_section_name): Add new parameter
4835 PSECTION_TYPE for returning script section type. Pass it to
4836 section elements. Handle discard sections.
4837 (Sort_output_sections::operator()): Handle NOLOAD sections.
4838 * script-sections.h (Script_sections::Section_type): New enum type.
4839 (Script_sections::output_section_name): Add a new parameter for
4840 returning script section type.
4841 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
4843 * yyscript.y (union): Add new field SECTION_TYPE.
4844 (COPY, DSECT, INFO, NOLOAD): New tokens.
4845 (opt_address_and_section_type): Change type to output_section_header.
4846 (section_type): New non-terminal
4847 (section_header): Handle section type.
4848 (opt_address_and_section_type): Return section type value.
4850 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
4852 * testsuite/plugin_common_test_1.c (foo): Add prototype.
4853 * testsuite/plugin_common_test_2.c (foo): Likewise.
4855 2010-04-08 Doug Kwan <dougkwan@google.com>
4857 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
4859 * output.cc (Output_section::add_merge_input_section): Simplify
4860 code and return status of Output_merge_base::add_input_section.
4861 Update merge section map only if Output_merge_base::add_input_section
4864 2010-04-07 Doug Kwan <dougkwan@google.com>
4866 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
4867 if section is marked as containing instructions but has no mapping
4869 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
4870 correct section index.
4871 (Arm_relobj::find_linked_text_section): Ditto.
4873 2010-04-07 Cary Coutant <ccoutant@google.com>
4875 * archive.cc (include_member): Destroy Read_symbols_data object before
4877 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
4878 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
4879 (Read_symbols_data::~Read_symbols_data) New destructor.
4880 (Section_relocs::Section_relocs) New constructor.
4881 (Section_relocs::~Section_relocs) New destructor.
4882 (Read_relocs_data::Read_relocs_data) New constructor.
4883 (Read_relocs_data::~Read_relocs_data) New destructor.
4884 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
4885 pointers to NULL after deleting.
4887 2010-04-07 Doug Kwan <dougkwan@google.com>
4889 * arm.cc: Replace "endianity" with "endianness" in comments.
4890 (Arm_exidx_cantunwind): Ditto.
4891 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
4892 (Arm_relobj::merge_flags_and_attributes): New method.
4893 (Arm_relobj::merge_flags_and_attributes_): New data member.
4894 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
4895 (Arm_relobj::scan_sections_for_stubs): Ditto.
4896 (Arm_relobj::do_read_symbols): Check to see if we really want to
4897 merge processor-specific flags and attributes. Exit early if
4898 an object is empty except for section names and the undefined symbol.
4899 (Target_arm::do_finalize_sections): Move check for ELF format to
4900 Arm_relobj::do_read_symbols. Merge processor specific flags and
4901 attributes from a regular object only when we have determined that
4902 it is aapropriate. Do not create an .ARM.attributes section in
4903 output if there is no regular input object.
4904 (Target_arm::merge_processor_specific_flags): Check
4905 --warn-mismatch before printing any error.
4906 (Target_arm::merge_object_attributes): Ditto.
4907 * gold.cc (queue_middle_tasks): Handle the case in which there is
4908 no regular object in input.
4909 * options.cc (General_options::parse_EB): New method.
4910 (General_options::parse_EL): Same.
4911 (General_options::General_options): Initialize endianness_.
4912 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
4914 (General_options::Endianness): New enum.
4915 (General_options::endianness): New method.
4916 (General_options::endianness_): New data member.
4917 * parameters.cc (Parameters::set_options): Check target endianness.
4918 (Parameters::set_target_once): Ditto.
4919 (Parameters::check_target_endianness): New method.
4920 (parameters_force_valid_target): If either -EL or -EB is specified,
4921 use it to define endianness of default target.
4922 * parameters.h (Parameters::check_target_endianness): New method
4924 * target.h (class Target): Change "endianity" to "endianness"
4927 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4929 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
4930 * configure: Regenerate.
4931 * Makefile.in: Regenerate.
4932 * testsuite/Makefile.in: Regenerate.
4934 2010-04-06 Cary Coutant <ccoutant@google.com>
4937 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
4938 prevailing definitions of common symbols.
4939 * testsuite/plugin_test_6.sh: New test case.
4940 * testsuite/plugin_common_test_1.c: New test case.
4941 * testsuite/plugin_common_test_2.c: New test case.
4942 * testsuite/Makefile.am (plugin_test_6): New test case.
4943 * testsuite/Makefile.in: Regenerate.
4945 2010-04-06 Nick Clifton <nickc@redhat.com>
4947 * po/vi.po: New Vietnamese translation.
4949 2010-03-30 Doug Kwan <dougkwan@google.com>
4951 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
4953 2010-03-25 Doug Kwan <dougkwan@google.com>
4955 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
4956 to avoid a conversion warning on a 32-bit host.
4958 2010-03-24 Ian Lance Taylor <iant@google.com>
4960 * testsuite/script_test_3.t: Add a TLS segment.
4961 * testsuite/Makefile.am (check_PROGRAMS): Add
4962 tls_phdrs_script_test.
4963 (tls_phdrs_script_test_SOURCES): Define.
4964 (tls_phdrs_script_test_DEPENDENCIES): Define.
4965 (tls_phdrs_script_test_LDFLAGS): Define.
4966 (tls_phdrs_script_test_LDADD): Define.
4967 * testsuite/Makefile.in: Rebuild.
4969 2010-03-23 Cary Coutant <ccoutant@google.com>
4971 * fileread.cc (find_or_make_view): Fix comment.
4973 2010-03-23 Ian Lance Taylor <iant@google.com>
4975 * script-sections.cc (class Orphan_section_placement): Define
4976 PLACE_TLS and PLACE_TLS_BSS.
4977 (Orphan_section_placement::Orphan_section_placement): Initialize
4979 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
4980 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
4981 (tls_script_test_SOURCES): Define.
4982 (tls_script_test_DEPENDENCIES): Define.
4983 (tls_script_test_LDFLAGS): Define.
4984 (tls_script_test_LDADD): Define.
4985 * testsuite/Makefile.in: Rebuild.
4987 2010-03-22 Doug Kwan <dougkwan@google.com>
4989 * arm.cc (Arm_relocate_functions::abs8,
4990 Arm_relocate_functions::abs16): Use correct check for overflow
4991 specified in the ARM ELF specs.
4992 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
4993 target of a BLX instruction specially.
4994 (Reloc_stub::stub_type_for_reloc): Ditto.
4995 (Relocate::relocate): Use symbolic names instead of numeric relocation
4996 codes to report error.
4997 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
4999 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
5000 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
5001 thumb2_blx_out_of_range.stdout
5002 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
5003 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
5004 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
5005 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
5006 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
5007 thumb2_blx_in_range, thumb2_blx_in_range.o,
5008 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
5009 thumb2_blx_out_of_range.o): New rules.
5010 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
5011 thumb2_blx_in_range and thumb2_blx_out_of_range.
5012 * testsuite/Makefile.in: Regenerate.
5013 * arm_branch_in_range.sh: Add tests for THUMB BLX.
5014 * testsuite/thumb_blx_in_range.s: New file.
5015 * testsuite/thumb_blx_out_of_range.s: New file.
5017 2010-03-22 Rafael Espindola <espindola@google.com>
5019 * archive.cc (Should_include): Move to archive.h.
5020 (should_include_member): Make it a member of Archive.
5022 (Add_lib_group_symbols): New.
5023 * archive.h: Include options.h.
5024 (Archive_member): Moved from Archive.
5025 (Should_include): Moved from archive.cc.
5027 (Add_lib_group_symbols): New.
5028 * dynobj.cc (do_should_include_member): New.
5029 * dynobj.h (do_should_include_member): New.
5030 * gold.cc (queue_initial_tasks): Update call to queue.
5031 * main.cc (main): Print lib group stats.
5032 * object.cc (do_should_include_member): New.
5033 * object.h: Include archive.h.
5034 (Object::should_include_member): New.
5035 (Object::do_should_include_member): New.
5036 (Sized_relobj::do_should_include_member): New.
5037 * options.cc (General_options::parse_start_lib): New.
5038 (General_options::parse_end_lib): New.
5039 (Input_arguments::add_file): Handle lib groups.
5040 (Input_arguments::start_group): Check we are not in a lib.
5041 (Input_arguments::start_lib): New.
5042 (Input_arguments::end_lib): New.
5043 * options.h (General_options): Add start_lib and end_lib.
5044 (Input_argument::lib_): New.
5045 (Input_argument::lib): New.
5046 (Input_argument::is_lib): New.
5047 (Input_file_lib): New.
5048 (Input_arguments::in_lib_): New.
5049 (Input_arguments::in_lib): New.
5050 (Input_arguments::start_lib): New.
5051 (Input_arguments::end_lib_): New.
5052 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5053 in unused members as preempted.
5054 (Sized_pluginobj::do_should_include_member): New.
5055 * plugin.h (Sized_pluginobj::do_should_include_member): New.
5056 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5058 (Read_symbols::do_whole_lib_group): New.
5059 (Read_symbols::do_lib_group): New.
5060 (Read_symbols::do_read_symbols): Handle lib groups.
5061 (Read_symbols::get_name): Handle lib groups.
5062 * readsyms.h (Read_symbols): Add an archive member pointer.
5063 (Read_symbols::do_whole_lib_group): New.
5064 (Read_symbols::do_lib_group): New.
5065 (Read_symbols::member_): New.
5066 * script.cc (read_input_script): Update call to queue_soon.
5068 2010-03-19 Doug Kwan <dougkwan@google.com>
5070 * arm.cc (Stub_table::Stub_table): Initialize new data members
5071 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5072 (Stub_table::add_reloc_stub): Assign stub offset and update
5073 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5074 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
5076 (Stub_table::update_data_size_and_addralign): Use
5077 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
5078 instead of going over all reloc stubs.
5079 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
5080 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5081 Stringpool_template::offset_ to size of Stringpool_char.
5082 (Stringpool_template::new_key_offset): Remove code to initialize
5083 Stringpool_template::offset_.
5084 * stringpool.h (Stringpool_template::set_no_zero_null): Set
5085 Stringpool_template::offset_ to zero.
5087 2010-03-15 Doug Kwan <dougkwan@google.com>
5089 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5091 (Stringpool_template::new_key_offset): New method.
5092 (Stringpool_template::add_string): Assign offsets when adding new
5094 (Stringpool_template::set_string_offsets): Do not set string offsets
5095 when not optimizing.
5096 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5098 (Chunked_vector::clear): Clear size_.
5099 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5100 (Chunked_vector::size): Return size_.
5101 (Chunked_vector::push_back): Use size_ to find insert position.
5102 (Chunked_vector::size_): New data member.
5103 (Stringpool_template::set_no_zero_null): Assert string set is empty.
5104 (Stringpool_template::new_key_offset): New method declaration.
5105 (Stringpool_template::offset_): New data member.
5107 2010-03-15 Rafael Espindola <espindola@google.com>
5109 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
5110 Add_symbols' constructor.
5111 * readsyms.h (Add_symbols): Remove the input_group member.
5113 2010-03-10 Ian Lance Taylor <iant@google.com>
5115 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
5116 target to ask whether a reference to a symbol requires a stack
5118 * target.h (Target::is_call_to_non_split): New function.
5119 (Target::do_is_call_to_non_split): Declare virtual function.
5120 * target.cc: Include "symtab.h".
5121 (Target::do_is_call_to_non_split): New function.
5122 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
5124 2010-03-10 Cary Coutant <ccoutant@google.com>
5126 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
5127 (File_read::open[1]): Remove initial mapping of whole_file_view_.
5128 (File_read::open[2]): Add whole_file_view_ to list of views.
5129 (File_read::make_view): Remove test of whole_file_view_.
5130 (File_read::find_or_make_view): Create whole_file_view_ if
5132 (File_read::clear_views): Replace bool parameter with enum;
5133 adjust all callers. Don't delete views with permanent data;
5134 do delete cached views and views from archives if
5135 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
5136 if clearing the corresponding view.
5137 * fileread.h (File_read::Clear_views_mode): New enum.
5138 (File_read::View::is_permanent_view): New method.
5139 (File_read::clear_views): Replace bool parameter
5140 with enum; adjust all callers.
5141 * options.h (General_options): Change keep_files_mapped option;
5142 add map_whole_files.
5143 * readsyms.cc (Add_symbols::run): Delete sd_ object before
5145 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
5148 2010-03-10 David S. Miller <davem@davemloft.net>
5150 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
5152 2010-03-09 Sriraman Tallam <tmsriram@google.com>
5154 * icf.cc (get_section_contents): Add '@' marker after processing the
5157 2010-03-08 Doug Kwan <dougkwan@google.com>
5159 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
5160 due to a conversion warning.
5161 (Arm_relobj::update_output_local_symbol_count): Check for local
5162 symbol with unset output index.
5164 2010-03-05 Ian Lance Taylor <iant@google.com>
5166 * options.h (class General_options): Add --spare-dynamic-tags.
5167 * output.cc (Output_data_dynamic::set_final_data_size): Implement
5168 --spare-dynamic-tags.
5170 2010-03-05 Ian Lance Taylor <iant@google.com>
5172 * incremental.cc: Include "libiberty.h".
5174 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
5176 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
5177 function, is_info_ member.
5178 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
5179 (Versions::Versions): Update caller.
5180 (Versions::define_base_version): Likewise.
5181 (Versions::add_def): Likewise.
5183 2010-03-03 Sriraman Tallam <tmsriram@google.com>
5185 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
5186 (Scan::possible_function_pointer_reloc): New function.
5187 (Scan::local_reloc_may_be_function_pointer): Change to call
5188 possible_function_pointer_reloc.
5189 (Scan::global_reloc_may_be_function_pointer): Ditto.
5190 * icf.h (Icf::check_section_for_function_pointers): Change to reject
5191 relocations in ".data.rel.ro._ZTV" section.
5192 * testsuite/icf_safe_so_test.sh: Change to pass i386.
5193 * testsuite/icf_safe_so_test.cc: Ditto.
5194 * testsuite/icf_safe_test.cc: Ditto.
5195 * testsuite/icf_safe_test.sh: Ditto.
5197 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5198 Ian Lance Taylor <iant@google.com>
5200 * target-reloc.h (relocate_section): Check the symbol table index
5201 for -1U before setting the local symbol index.
5202 (scan_relocatable_relocs): If copying the relocation, record that
5203 the local symbol is required.
5204 * object.h (Symbol_value::is_output_symtab_index_set): New
5206 (Symbol_value::may_be_discarded_from_output_symtab): New
5208 (Symbol_value::has_output_symtab_entry): New function.
5209 (Symbol_value::needs_output_symtab_entry): Remove.
5210 (Symbol_value::output_symtab_index): Make sure the symbol index is
5212 (Symbol_value::set_output_symtab_index): Make sure the symbol
5213 index is not set. Make sure the new index is valid.
5214 (Symbol_value::set_must_have_output_symtab_entry): New function.
5215 (Symbol_value::has_output_dynsym_entry): New function.
5216 (Symbol_value::set_output_dynsym_index): Make sure the new index
5218 (Sized_relobj::set_must_have_output_symtab_entry): New function.
5219 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
5220 local symbol if permitted.
5221 (Sized_relobj::do_finalize_local_symbols): Call
5222 is_output_symtab_index_set rather than needs_output_symtab_entry.
5223 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
5224 rather than needs_output_symtab_entry. Call
5225 has_output_dynsym_entry rather than needs_output_dynsym_entry.
5226 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
5227 is_output_symtab_index_set rather than needs_output_symtab_entry.
5228 * testsuite/discard_locals_relocatable_test.c: New file.
5229 * testsuite/discard_locals_test.sh: Test -r.
5230 * testsuite/Makefile.am (check_DATA): Add
5231 discard_locals_relocatable_test1.syms,
5232 discard_local_relocatable_test2.syms.
5233 (MOSTLYCLEANFILES): Likewise. Also add
5234 discard_locals_relocatable_test1.lout and
5235 discard_locals_relocatable_test2.out.
5236 (discard_locals_relocatable_test1.syms): New target.
5237 (discard_locals_relocatable_test.o): New target.
5238 (discard_locals_relocatable_test1.out): New target.
5239 (discard_locals_relocatable_test2.syms): New target.
5240 (discard_locals_relocatable_test2.out): New target.
5241 (various): Add missing ../ld-new dependencies.
5242 * testsuite/Makefile.in: Rebuild.
5244 2010-03-03 Nick Clifton <nickc@redhat.com>
5246 * po/fi.po: New Finnish translation.
5248 2010-03-01 Doug Kwan <dougkwan@google.com>
5250 * layout.cc (Layout::Layout): Force section types of .init_array*,
5251 .preinit_array* and .fini_array* sections.
5252 * output.cc (Output_section::Input_section_sort_entry::has_priority):
5253 Fix check of return value of std::string::find.().
5254 (Output_section::Input_section_sort_compare::operator()): Remove
5255 comment about .init_array.
5256 (Output_section::Input_section_sort_init_fini_compare::operator()):
5258 (Output_section::sort_attached_input_sections): Handle .init_array
5259 and .fini_array specially.
5260 * output.h (Output_section::Inut_section_sort_compare): Update
5262 (Output_section::Input_section_sort_init_fini_compare): New struct.
5264 2010-02-26 Doug Kwan <dougkwan@google.com>
5266 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
5267 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
5268 * testsuite/debug_msg.sh: Avoid matching source line number for
5269 use of global variable undef_int.
5271 2010-02-26 Doug Kwan <dougkwan@google.com>
5273 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
5274 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
5275 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
5276 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
5277 * options.cc (General_options::General_options): Initialize member
5279 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
5280 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
5281 and rm_no_fix_v4bx.stdout
5282 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
5283 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
5284 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
5285 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
5286 and arm_no_fix_v4bx.
5287 * Makefile.in: Regenerate.
5288 * testsuite/arm_fix_v4bx.s: New file.
5289 * testsuite/arm_fix_v4bx.sh: Ditto.
5291 2010-02-24 Doug Kwan <dougkwan@google.com>
5293 * arm.cc (Target_arm::got_section): Make the .got section the first
5294 non RELRO section in the data segment.
5295 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
5296 suffixes of section names.
5298 2010-02-24 Doug Kwan <dougkwan@google.com>
5300 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
5301 flags and attributes merging if an input file is a binary file.
5302 * fileread.cc (Input_file::open): Record format of original file.
5303 * fileread.h (Input_file::Format): New enum type.
5304 (Input_file::Input_file): Initialize data member format_.
5305 (Input_file::format): New method definition.
5306 (Input_file::format_):: New data member.
5308 2010-02-24 Doug Kwan <dougkwan@google.com>
5310 * arm.cc (Arm_output_data_got): New class.
5311 (ARM_TCB_SIZE): New constant
5312 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
5313 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
5314 If user uses a script with a SECTIONS clause, issue only a warning
5315 for a misplaced EXIDX input section. Otherwise, issue an error.
5316 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
5318 (Target_arm::got_mode_index_entry): Handle static linking.
5319 (Target_arm::Scan::local): Ditto.
5320 (Target_arm::Scan::global): Ditto.
5321 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
5322 all incorrectly implemented relocations.
5323 (Target_arm::fix_exidx_coverage): Pass layout to
5324 Arm_output_section::fix_exidx_coverage.
5325 * layout.cc (Layout::section_name_mapping): Remove trailing dots
5326 from ".ARM.exidx." and ".ARM.extab.".
5328 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5330 * arm.cc (Target_arm::do_finalize_sections): Create attribute
5331 section if it does not already exist.
5332 * attributes.cc (Attributes_section_data::Attributes_section_data):
5333 Don't crash if size is zero.
5335 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5336 Ian Lance Taylor <iant@google.com>
5338 * gold.cc (queue_middle_tasks): If no input files were opened,
5340 * workqueue.h (Task_function::Task_function): Assert that there is
5343 2010-02-22 Doug Kwan <dougkwan@google.com>
5345 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
5346 * icf.cc (get_section_contents): Cast snprintf arguments to long long
5347 types to avoid warnings due to different uint64_t implementations
5350 2010-02-21 Doug Kwan <dougkwan@google.com>
5352 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
5353 handling of the maximum backward branch offset.
5354 (Arm_relocate_functions::thumb_branch_common): Ditto.
5355 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
5356 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
5357 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
5358 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
5359 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
5360 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
5361 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
5362 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
5363 thumb_bl_out_of_range thumb_bl_out_of_range.o,
5364 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
5365 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
5366 thumb2_bl_out_of_range.o): New rules.
5367 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
5368 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
5369 thumb2_bl_out_of_range
5370 * testsuite/Makefile.in: Regenerate.
5371 * testsuite/arm_bl_in_range.s: New file.
5372 * testsuite/arm_bl_out_of_range.s: Ditto.
5373 * testsuite/arm_branch_in_range.sh: Ditto.
5374 * testsuite/arm_branch_range.t: Ditto.
5375 * testsuite/thumb2_branch_range.t: Ditto.
5376 * testsuite/thumb_bl_in_range.s: Ditto.
5377 * testsuite/thumb_bl_out_of_range.s: Ditto.
5378 * testsuite/thumb_branch_range.t: Ditto.
5380 2010-02-20 Sriraman Tallam <tmsriram@google.com>
5382 * gc.h (gc_process_relocs): Change vectors to point to the new list.
5383 Add reloc offset information.
5384 * icf.cc (get_section_contents): Change iterators to point to the new
5385 vectors. Add reloc offset information to the contents.
5386 * icf.h (Icf::Sections_reachable_info): New typedef.
5387 (Icf::Sections_reachable_list): New typedef.
5388 (Icf::Offset_info): New typedef.
5389 (Icf::Reloc_info): New struct typedef.
5390 (Icf::Reloc_info_list): New typedef.
5391 (Icf::symbol_reloc_list): Delete method.
5392 (Icf::addend_reloc_list): Delete method.
5393 (Icf::section_reloc_list): Delete method.
5394 (Icf::reloc_info_list): New method.
5395 (Icf::reloc_info_list_): New member.
5397 2010-02-19 Doug Kwan <dougkwan@google.com>
5399 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
5400 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
5401 * arm.cc (Arm_relocation_functions): New forward declaration.
5402 (Target_arm::Target_arm): Initialize new data members
5403 got_mod_index_offset_ and tls_base_symbol_defined_.
5404 (Target_arm::Relocate::relocate_tls): New method.
5405 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
5406 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
5408 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
5409 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
5410 (Target_arm::got_mod_index_offset_,
5411 Target_arm::tls_base_symbol_defined_): New data members.
5412 (Target_arm::Scan::local, Target::Scan::global,
5413 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
5416 2010-02-18 Doug Kwan <dougkwan@google.com>
5418 * arm.cc (Arm_relobj::find_linked_text_section): New method.
5419 (Arm_relobj::make_exidx_input_section): Pass section index of linked
5420 text section as a parameter becuase some broken tools may not set
5421 the link in section header.
5422 (Target_arm::has_got_section): New method.
5423 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
5424 without any mapping symbol as data only. Remove warning.
5425 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
5426 link in its section header, try to discover the link by inspecting the
5427 REL31 relocation at the beginning of the section.
5428 (Target_arm::Scan::check_non_pic): Report name of offending relocation
5430 (Target_arm::Scan::global): Treat any reference to the symbol
5431 _GLOBAL_OFFSET_TABLE_ as a GOT access.
5433 2010-02-12 Sriraman Tallam <tmsriram@google.com>
5435 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
5436 (Scan::global_reloc_may_be_function_pointer): New function.
5437 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5438 (Scan::global_reloc_may_be_function_pointer): New function.
5439 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5440 (Scan::global_reloc_may_be_function_pointer): New function.
5441 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
5442 (Scan::global_reloc_may_be_function_pointer): New function.
5443 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
5444 (Scan::global_reloc_may_be_function_pointer): New function.
5445 (Scan::possible_function_pointer_reloc): New function.
5446 (Target_x86_64::can_check_for_function_pointers): New function.
5447 * gc.h (gc_process_relocs): Scan relocation types to determine if
5448 function pointers were taken for targets that support it.
5449 * icf.cc (Icf::find_identical_sections): Include functions for
5450 folding in safe ICF whose pointer is not taken.
5451 * icf.h (Secn_fptr_taken_set): New typedef.
5452 (fptr_section_id_): New member.
5453 (section_has_function_pointers): New function.
5454 (set_section_has_function_pointers): New function.
5455 (check_section_for_function_pointers): New function.
5456 * options.h: Fix comment for safe ICF option.
5457 * target.h (can_check_for_function_pointers): New function.
5458 * testsuite/Makefile.am: Add icf_safe_so_test test case.
5459 Modify icf_safe_test for X86-64.
5460 * testsuite/Makefile.in: Regenerate.
5461 * testsuite/icf_safe_so_test.cc: New file.
5462 * testsuite/icf_safe_so_test.sh: New file.
5463 * testsuite/icf_safe_test.cc (kept_func_3): New function.
5464 (main): Change to take pointer to function kept_func_3.
5465 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
5466 folding is done correctly for X86-64.
5468 2010-02-12 David S. Miller <davem@davemloft.net>
5470 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
5471 is_symbolless parameter.
5472 (Output_reloc<SHT_REL>::is_symbolless): New.
5473 (Output_reloc<SHT_REL>::is_symbolless_): New.
5474 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
5475 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
5476 (Output_reloc<SHT_RELA>::is_symbolless): New.
5477 (Output_data_reloc::add_global): Handle is_symbolless.
5478 (Output_data_reloc::add_global_relative): Likewise.
5479 (Output_data_reloc::add_local): Likewise.
5480 (Output_data_reloc::add_local_relative): Likewise.
5481 (Output_data_reloc::add_symbolless_global_addend): New.
5482 (Output_data_reloc::add_symbolless_local_addend): New.
5483 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
5485 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
5486 instead of ->is_relative_
5487 (Output_reloc::write): Likewise.
5488 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
5489 (Output_reloc::write_rel): Simplify.
5491 * sparc.cc (Target_sparc::Scan::local): Use
5492 ->add_symbolless_local_addend as needed.
5493 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
5494 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
5495 based upon relocation offset.
5497 2010-02-11 Doug Kwan <dougkwan@google.com>
5499 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
5500 (Target_arm::Scan::global): Ditto. Also remove a comment before the
5501 beginning of function.
5502 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
5503 and MOVT_ABS relocations. Those are non issued in scanning. Fix
5504 parameter is_32bit in calls to should_apply_static_reloc.
5505 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
5506 (check_DATA): Add arm_abs_global.stdout.
5507 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
5508 arm_abs_global.stdout): New rules.
5509 (MOSTLLYCLEANFILES): Add arm_abs_global
5510 * Makefile.in: Regenerate.
5511 * testsuite/arm_abs_global.s: New file.
5512 * testsuite/arm_abs_global.sh: Ditto.
5513 * testsuite/arm_abs_lib.s: Ditto.
5515 2010-02-11 Ian Lance Taylor <iant@google.com>
5517 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
5519 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
5520 Allocate_commons_task first.
5521 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
5522 task, rather than symtab_lock_.
5523 (Gc_process_relocs::~Gc_process_relocs): New function.
5524 (Gc_process_relocs::is_runnable): Check this_blocker_.
5525 (Gc_process_relocs::locks): Use next_blocker_ rather than
5527 (Scan_relocs::~Scan_relocs): New function.
5528 (Scan_relocs::is_runnable): Check this_blocker_ rather than
5530 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
5532 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
5533 fields. Add this_blocker_ and next_blocker_ fields. Adjust
5534 constructor accordingly.
5535 (class Gc_process_relocs): Likewise.
5536 (class Scan_relocs): Likewise.
5537 * common.h (class Allocate_commons_task): Remove symtab_lock_
5538 field, and corresponding constructor parameter.
5539 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
5541 (Allocate_commons_task::locks): Likewise.
5543 2010-02-11 Ian Lance Taylor <iant@google.com>
5545 * gold-threads.h (class Once): Define.
5546 (class Initialize_lock): Rewrite as child of Once.
5547 * gold-threads.cc (class Once_initialize): Define.
5548 (once_pointer_control): New static variable.
5549 (once_pointer, once_arg): New static variables.
5550 (c_run_once): New static function.
5551 (Once::Once, Once::run_once, Once::internal_run): New functions.
5552 (class Initialize_lock_once): Remove.
5553 (initialize_lock_control): Remove.
5554 (initialize_lock_pointer): Remove.
5555 (initialize_lock_once): Remove.
5556 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
5557 (Initialize_lock::initialize): Rewrite.
5558 (Initialize_lock::do_run_once): New function.
5559 * archive.cc (Archive::interpret_header): Only clear name if it is
5561 * fileread.cc: Include "gold-threads.h"
5562 (file_counts_lock): New static variable.
5563 (file_counts_initialize_lock): Likewise.
5564 (File_read::release): Only increment counts when using --stats.
5565 Use a lock around the increment.
5566 * parameters.cc (class Set_parameters_target_once): Define.
5567 (set_parameters_target_once): New static variable.
5568 (Parameters::Parameters): Move here from parameters.h.
5569 (Parameters::set_target): Rewrite.
5570 (Parameters::set_target_once): New function.
5571 (Parameters::clear_target): Move here and rewrite.
5572 * parameters.h (class Parameters): Update declarations. Add
5573 set_parameters_target_once_ field.
5574 (Parameters::Parameters): Move to parameters.cc.
5575 (Parameters::clear_target): Likewise.
5576 * readsyms.cc (Read_symbols::do_group): Create a Start_group
5578 (Start_group::~Start_group): New function.
5579 (Start_group::is_runnable): New function.
5580 (Start_group::locks, Start_group::run): New functions.
5581 (Finish_group::run): Change saw_undefined to size_t.
5582 * readsyms.h (class Start_group): Define.
5583 (class Finish_group): Change saw_undefined_ field to size_t.
5584 (Finish_group::Finish_group): Remove saw_undefined and
5585 this_blocker parameters. Change all callers.
5586 (Finish_group::set_saw_undefined): New function.
5587 (Finish_group::set_blocker): New function.
5588 * symtab.h (class Symbol_table): Change saw_undefined to return
5589 size_t. Change saw_undefined_ field to size_t.
5590 * target-select.cc (Set_target_once::do_run_once): New function.
5591 (Target_selector::Target_selector): Initialize set_target_once_
5592 field. Don't initialize lock_ and initialize_lock_ fields.
5593 (Target_selector::instantiate_target): Rewrite.
5594 (Target_selector::set_target): New function.
5595 * target-select.h (class Set_target_once): Define.
5596 (class Target_selector): Update declarations. Make
5597 Set_target_once a friend. Remove lock_ and initialize_lock_
5598 fields. Add set_target_once_ field.
5600 2010-02-10 Ian Lance Taylor <iant@google.com>
5602 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
5604 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
5605 (queue_middle_tasks): Add all blockers before queueing any tasks.
5606 (queue_final_tasks): Likewise.
5607 * token.h (Task_token::add_blockers): New function.
5608 * object.h (Input_objects::number_of_relobjs): New function.
5610 2010-02-10 Ian Lance Taylor <iant@google.com>
5612 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
5613 shared, not if not position independent.
5614 * x86_64.cc (Relocate::relocate_tls): Likewise.
5615 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
5616 (tls_pie_pic_test): New target.
5617 * testsuite/Makefile.in: Rebuild.
5619 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
5620 (tls_test_main_pie.o, tls_test_pie.o): New targets.
5621 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
5622 * testsuite/Makefile.in: Rebuild.
5624 2010-02-09 David S. Miller <davem@davemloft.net>
5626 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
5627 R_SPARC_RELATIVE using ->add_local_relative().
5628 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
5630 * output.h (Output_data_dynamic::add_section_size): New method
5631 that takes two Output_data objects.
5632 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
5633 entry param. Handle it in initializers.
5634 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
5635 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
5636 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
5638 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
5639 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
5640 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
5641 for dynrel_includes_plt.
5642 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5643 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5644 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
5646 (Target_sparc::do_finalize_sections): Update to pass true for
5647 dynrel_includes_plt.
5648 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
5649 output before .rela.plt
5650 (Target_powerpc::do_finalize_sections): Update to pass true for
5651 dynrel_includes_plt when 32-bit.
5653 2010-02-08 Doug Kwan <dougkwan@google.com>
5655 * arm.cc (Arm_relobj::simple_input_section_output_address): New
5657 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
5658 Arm_relobj::scan_section_for_cortex_a8_stubs,
5659 Arm_relobj::do_relocation_section): Instead of calling
5660 Output_section::output_address, use faster
5661 Arm_relobj::simple_input_section_output_address.
5663 2010-02-08 David S. Miller <davem@davemloft.net>
5665 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
5666 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
5667 relocation helper function.
5669 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
5670 just like R_SPARC_GOT{10,13,22}.
5671 (Target_sparc::Scan::local): Likewise.
5672 (Target_sparc::Relocate:relocate): Likewise.
5674 2010-02-06 Ian Lance Taylor <iant@google.com>
5676 * configure.ac: Rewrite targetobjs duplicate removal code to use
5677 only shell constructs.
5678 * configure: Rebuild.
5680 2010-02-05 Doug Kwan <dougkwan@google.com>
5683 * arm.cc (Arm_relobj::section_is_scannable): New method.
5684 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
5685 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
5687 2010-02-04 Doug Kwan <dougkwan@google.com>
5690 * arm-reloc-property.cc (cstdio): Include.
5691 * configure.ac (targetobjs): Remove duplicates.
5692 * configure: Regenerate.
5693 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
5694 big and little endian version for a given address size.
5696 2010-02-03 Doug Kwan <dougkwan@google.com>
5698 * arm-reloc-property.cc
5699 (Arm_reloc_property_table::reloc_name_in_error_message): New method
5701 * arm-reloc-property.h
5702 (Arm_reloc_property_table::get_implemented_static_reloc_property):
5703 New method definition.
5704 (Arm_reloc_property_table::reloc_name_in_error_message): New method
5706 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
5708 (GOT_PREL): Change implemented to Y.
5709 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
5710 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
5711 (Arm_relocate_functions::movw_abs_nc): Remove method.
5712 (Arm_relocate_functions::movt_abs): Ditto.
5713 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
5714 (Arm_relocate_functions::thm_movt_abs): Ditto.
5715 (Arm_relocate_functions::movw_rel_nc): Ditto.
5716 (Arm_relocate_functions::movw_rel): Ditto.
5717 (Arm_relocate_functions::movt_rel): Ditto.
5718 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
5719 (Arm_relocate_functions:thm_movw_rel): Ditto.
5720 (Arm_relocate_functions:thm_movt_rel): Ditto.
5721 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
5722 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
5723 New method definitions.
5724 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
5725 (Arm_relocation_functions::arm_grp_ldr): Ditto.
5726 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
5727 (Arm_relocation_functions::arm_grp_ldc): Ditto.
5728 (Target_arm::Relocate::relocate): Check for non-static or
5729 unimplemented relocation code and exit early. Change calls to
5730 Target_arm::reloc_uses_thumb_bit and
5731 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
5732 instead. Refactor code to handle similar relocations to increase
5733 code sharing. Remove check for unsupported relocation code in switch
5735 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
5736 relocation property table to find out size. Change error message to
5737 print out the name of a relocation code instead of the numeric value.
5738 (Target_arm::scan_reloc_for_stub): Use relocation property table
5739 instead of calling Target_arm::reloc_uses_thumb_bit().
5741 2010-02-02 Doug Kwan <dougkwan@google.com>
5743 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
5744 types of relaxed input section.
5746 2010-02-02 Doug Kwan <dougkwan@google.com>
5748 * Makefile.am (HFILES): Add arm-reloc-property.h.
5750 (TARGETSOURCES): Add arm-reloc-property.cc
5751 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
5752 (libgold_a_SOURCES): $(DEFFILES)
5753 * Makefile.in: Regenerate.
5754 * arm-reloc-property.cc: New file.
5755 * arm-reloc-property.h: New file.
5756 * arm-reloc.def: New file.
5757 * arm.cc: Update comments.
5758 (arm-reloc-property.h): New included header.
5759 (arm_reloc_property_table): New global variable.
5760 (Target_arm::do_select_as_default_target): New method definition.
5761 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
5762 arm-reloc-property to targ_extra_obj.
5763 * parameters.cc (set_parameters_target): Call
5764 Target::select_as_default_target().
5765 * target.h (Target::select_as_default_target): New method definition.
5766 (Target::do_select_as_default_target): Same.
5768 2010-02-01 Doug Kwan <dougkwan@google.com>
5770 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
5771 first_output_text_section_.
5772 (Arm_exidx_fixup::first_output_text_section): New method definition.
5773 (Arm_exidx_fixup::first_output_text_section_): New data member.
5774 (Arm_exidx_fixup::process_exidx_section): Record the first text
5775 output section seen.
5776 (Arm_output_section::fix_exidx_coverage): Set correct linked section
5777 and entsize in output section header.
5779 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5781 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
5782 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
5783 (Arm_relocate_functions::thm_alu11): New Method.
5784 (Arm_relocate_functions::thm_pc8): New Method.
5785 (Arm_relocate_functions::thm_pc12): New Method.
5786 (Target_arm::Scan::local): Handle the relocations.
5787 (Target_arm::Scan::global): Likewise.
5788 (Target_arm::Relocate::relocate): Likewise.
5789 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
5791 2010-01-29 Doug Kwan <dougkwan@google.com>
5793 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
5794 of relocation types as ld.
5796 2010-01-29 Doug Kwan <dougkwan@google.com>
5798 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
5800 (Arm_relocate_functions::thumb_branch_common): Ditto.
5801 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
5802 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
5803 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
5804 Arm_relocate_functions::jump24): Remove.
5805 (Target_arm::Relocate::relocate): Adjust code to call
5806 Arm_relocation_functions::arm_branch_common and
5807 Arm_relocation_functions::thumb_branch_common instead of their removed
5808 wrappers. Merge switch-cases together to reduce source code size.
5810 2010-01-29 Doug Kwan <dougkwan@google.com>
5812 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
5813 output_local_symbol_count_needs_update_.
5814 (Arm_relobj::output_local_symbol_count_needs_update,
5815 Arm_relobj::set_output_local_symbol_count_needs_update,
5816 Arm_relobj::update_output_local_symbol_count): New methods.
5817 (Arm_relobj::output_local_symbol_count_needs_update_): New data
5819 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
5820 of pointed function as in a R_ARM_PREL31 relocation.
5821 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
5822 for output local symbol count updating.
5823 (Target_arm::do_relax): Update output local symbol counts in objects
5825 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
5827 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5829 * arm.cc: Added support for the ARM relocations:
5830 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
5831 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
5832 (Arm_relocate_functions::movw_rel_nc): Renamed (was
5834 (Arm_relocate_functions::movw_rel): New method.
5835 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
5836 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
5838 (Arm_relocate_functions::thm_movw_rel): New method.
5839 (Arm_relocate_functions::thm_movt_rel): Renamed (was
5841 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
5843 (Target_arm::Scan::global): Likewise.
5844 (Target_arm::Relocate::relocate): Likewise.
5845 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5848 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5850 * arm.cc: Added support for ARM group relocations.
5851 (Target_arm::reloc_needs_sym_origin): New method.
5852 (Arm_relocate_functions::calc_grp_kn): New method.
5853 (Arm_relocate_functions::calc_grp_residual): New method.
5854 (Arm_relocate_functions::calc_grp_gn): New method.
5855 (Arm_relocate_functions::arm_grp_alu): New Method.
5856 (Arm_relocate_functions::arm_grp_ldr): New Method.
5857 (Arm_relocate_functions::arm_grp_ldrs): New Method.
5858 (Arm_relocate_functions::arm_grp_ldc): New Method.
5859 (Target_arm::Scan::local): Handle the ARM group relocations.
5860 (Target_arm::Scan::global): Likewise.
5861 (Target_arm::Relocate::relocate): Likewise.
5862 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5865 2010-01-26 Doug Kwan <dougkwan@google.com>
5867 * arm.cc (set): Include.
5868 (class Arm_exidx_fixup): Change type of last_input_section_ to const
5870 (Arm_output_section::Text_section_list): New type.
5871 (Arm_output_section::append_text_sections_to_list): New method.
5872 (Arm_output_section::fix_exidx_coverage): Ditto.
5873 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
5874 (Arm_relobj::convert_input_section_to_relaxed_section): Use
5875 Relobj::set_section_offset() instead of
5876 Sized_relobj::invalidate_section_offset().
5877 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
5878 parameter for section headers. Ignore relocation sections for
5879 unallocated sections and EXIDX sections.
5880 (Target_arm::fix_exidx_coverage): New method.
5881 (Target_arm::output_section_address_less_than): New type.
5882 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
5883 linked text section instead of the EXIDX section.
5884 (Arm_output_section::create_stub_group): Add an assertion to check
5885 that this is not an EXIDX output section.
5886 (Arm_output_section::append_text_sections_to_list): New method.
5887 (Arm_output_section::fix_exidx_coverage): Ditto.
5888 (Arm_relobj::scan_sections_for_stubs): Adjust call to
5889 Arm_relobj::section_needs_reloc_stub_scanning.
5890 (Target_arm::do_relax): Fix EXIDX output section coverage in the
5892 (Target_arm::fix_exidx_coverage): New method.
5893 * object.h (Relobj::set_output_section): New method.
5894 (Sized_relobj::invalidate_section_offset): Remove method.
5895 (Sized_relobj::do_invalidate_section_offset): Remove method.
5896 (Sized_relobj::do_set_section_offset): Handle offset value -1.
5898 2010-01-25 Doug Kwan <dougkwan@google.com>
5900 * arm.cc (Arm_exidx_merged_section::do_output_offset):
5901 Fix warning due to signed and unsigned comparison on a 32-bit host.
5903 2010-01-22 Doug Kwan <dougkwan@google.com>
5905 * arm.cc (Target_arm::do_relax): Record an output section for section
5906 offset adjustment it contains any stub table that has changed.
5907 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
5908 offsets in an output section if necessary.
5909 * output.cc (Output_section::Output_section): Initialize
5910 section_offsets_need_adjustments_.
5911 (Output_section::add_input_section_for_script): Renamed to
5912 Output_section::add_simple_input_section.
5913 (Output_section::save_states): Add a comment.
5914 (Output_section::discard_states): New method defintion.
5915 (Output_section::adjust_section_offsets): Same.
5916 * output.h (Output_section::add_input_section_for_script): Renamed to
5917 Output_section::add_simple_input_section.
5918 (Output_section::discard_states): New method declaration.
5919 (Output_section::adjust_section_offsets): Same.
5920 (Output_section::section_offsets_need_adjustment,
5921 Output_section::set_section_offsets_need_adjustment): New method
5923 (Output_section::section_offsets_need_adjustment_): New data member.
5924 * script-sections.cc
5925 (Output_section_element_input::set_section_address): Adjust code for
5926 renaming of Output_section::add_input_section_for_script.
5927 (Orphan_output_section::set_section_address): Same.
5929 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5931 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
5932 Fix_v4bx enum values .
5933 * gold/options.h (General_options): New option definitions.
5934 (General_options::fix_v4bx): New method.
5935 (General_options::Fix_v4bx): New enum.
5936 * gold/options.cc (General_options::parse_fix_v4bx): New method.
5937 (General_options::parse_fix_v4bx_interworking): New method.
5939 2010-01-22 Doug Kwan <dougkwan@google.com>
5941 * arm.cc (Arm_exidx_fixup): New class.
5943 2010-01-21 Doug Kwan <dougkwan@google.com>
5945 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
5947 (Arm_exidx_section_offset_map): New type.
5949 2010-01-21 Doug Kwan <dougkwan@google.com>
5951 * arm.cc (Arm_exidx_input_section): New class.
5952 (Arm_relobj::exidx_input_section_by_link,
5953 Arm_relobj::exidx_input_section_by_shndx,
5954 Arm_relobj::make_exidx_input_section): New methods.
5955 (read_arm_attributes_section): Remove.
5956 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
5957 information about them.
5958 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
5961 2010-01-20 Doug Kwan <dougkwan@google.com>
5963 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
5964 Input_section_specifier to Section_id.
5965 (Target_arm::new_arm_input_section: Adjust code for change of key
5967 (Target_arm::find_arm_input_section): Ditto.
5968 * gc.h (object.h): Include for Section_id nand Section_id_hash.
5969 (Section_id): Remove.
5970 (Garbage_collection::Section_id_hash): Remove.
5971 * icf.h (object.h): Include for Section_id nand Section_id_hash.
5972 (Section_id): Remove.
5973 (Icf::Section_id_hash): Remove.
5974 * object.h (Section_id, Const_section_id, Section_id_hash,
5975 Const_section_id_hash): New type definitions.
5976 * output.cc (Output_section::add_relaxed_input_section): Change to
5977 use Const_section_id instead of Input_section_specifier as key type.
5978 (Output_section::add_merge_input_section): Ditto.
5979 (Output_section::build_relaxation_map): Change to use Section_id
5980 instead of Input_section_specifier as key type.
5981 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5983 (Output_section::convert_input_sections_to_relaxed_sections): Change
5984 to use Const_section_id instead of Input_section_specifier as key type.
5985 (Output_section::find_merge_section): Ditto.
5986 (Output_section::find_relaxed_input_section): Ditto.
5987 * output.h (Input_section_specifier): Remove class.
5988 (Output_section::Output_section_data_by_input_section_map): Change
5989 key type to Const_section_id.
5990 (Output_section::Output_relaxed_input_section_by_input_section_map):
5992 (Output_section::Relaxation_map): Change key type to Section_id.
5994 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5996 * gold/arm.cc: Added support for R_ARM_V4BX relocation
5997 (class Arm_v4bx_stub): New class.
5998 (DEF_STUBS): Updated definition to support v4_veneer_bx.
5999 (Stub_factory::make_arm_v4bx_stub): New method.
6000 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
6001 (Stub_table::empty): Handle v4bx stubs.
6002 (Stub_table::add_arm_v4bx_stub): New method.
6003 (Stub_table::find_arm_v4bx_stub): New method.
6004 (Arm_relocate_functions::v4bx): New method.
6005 (Target_arm::fix_v4bx): New method.
6006 (Target_arm::Target_arm): Handle R_ARM_V4BX.
6007 (Stub_table::relocate_stubs): Likewise.
6008 (Stub_table::do_write): Likewise.
6009 (Stub_table::update_data_size_and_addralign): Likewise.
6010 (Stub_table::finalize_stubs): Likewise.
6011 (Target_arm::Scan::local): Likewise.
6012 (Target_arm::Scan::global): Likewise.
6013 (Target_arm::do_finalize_sections): Likewise.
6014 (Target_arm::Relocate::relocate): Likewise.
6015 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6017 (Target_arm::scan_reloc_for_stub): Likewise.
6018 (Target_arm::scan_reloc_section_for_stubs): Likewise.
6020 2010-01-19 Ian Lance Taylor <iant@google.com>
6022 * output.cc (Output_section_headers::do_sized_write): Write large
6023 segment count to sh_info field.
6024 (Output_file_header::do_sized_write): For large segment count,
6025 write PN_XNUM to e_phnum field.
6027 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6029 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
6030 (Arm_relocate_functions::thm_jump8): New function.
6031 (Arm_relocate_functions::thm_jump11): New function.
6032 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
6034 (Target_arm::Scan::global): Likewise.
6035 (Target_arm::Relocate::relocate): Likewise.
6036 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6039 2010-01-14 Doug Kwan <dougkwan@google.com>
6041 * arm.cc (map, utility): Include headers.
6042 (Target_arm::apply_cortex_a8_workaround): New method.
6043 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
6044 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
6045 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
6046 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
6047 the --[no-]fix-cortex-a8 command line options.
6048 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
6049 (Target_arm::relocate_stub): Use addend in instruction template.
6050 * options.h (DEFINE_bool): Set the user-set flag.
6051 (General_options): Add --[no-]-fix-cortex options.
6052 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
6053 : Update fast look-up map after conversion.
6055 2010-01-14 Sriraman Tallam <tmsriram@google.com>
6057 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6058 in the first pass of do_layout.
6060 2010-01-13 Doug Kwan <dougkwan@google.com>
6062 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6063 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6064 apparent compiler problem of not folding static constant integral
6065 data members of elfcpp::Elf_sizes<32>.
6067 2010-01-13 Doug Kwan <dougkwan@google.com>
6069 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6070 Arm_relobj::section_needs_cortex_a8_stub_scanning,
6071 Arm_relobj::scan_section_for_cortex_a8_erratum,
6072 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
6073 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
6074 sections to scan for relocation stubs into a new method
6075 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
6076 relocation and Cortex-A8 stub scanning.
6077 (Target_arm::do_relax): Force stubs to be after stubbed sections
6078 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
6079 the beginning of a new relaxation pass. Update a comment.
6080 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
6082 2010-01-12 Ian Lance Taylor <iant@google.com>
6084 * target-reloc.h (visibility_error): New inline function.
6085 (relocate_section): Call visibility_error.
6086 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6087 (MOSTLYCLEANFILES): Likewise.
6088 (protected_4_pic.o, protected_3.err): New targets.
6089 * testsuite/protected_4.cc: New file.
6091 2010-01-12 Doug Kwan <dougkwan@google.com>
6093 * arm.cc (Cortex_a8_reloc): New class.
6094 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6095 and cortex_a8_relocs_info_.
6096 (Target_arm::fix_cortex_a8): New method definition.
6097 (Target_arm::Cortex_a8_relocs_info): New type.
6098 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6099 New data member declarations.
6100 (Target_arm::scan_reloc_for_stub): Record information about
6101 relocations for THUMB branches that might be exempted from the
6102 Cortex-A8 workaround.
6103 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
6104 at the beginning of a relaxation pass.
6106 2010-01-12 Doug Kwan <dougkwan@google.com>
6108 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
6109 (Arm_relobj::Mapping_symbol_position,
6110 Arm_reloj::Mapping_symbol_position_less,
6111 Arm_relobj::Mapping_symbols_info): New types.
6112 (Target_arm::is_mapping_symbol_name): New method definition.
6113 (Arm_relobj::do_count_local_symbols): Save information about mapping
6116 2010-01-11 Doug Kwan <dougkwan@google.com>
6118 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
6119 Arm_relocate_functions::thumb32_branch_upper,
6120 Arm_relocate_functions::thumb32_branch_lower,
6121 Arm_relocate_functions::thumb32_cond_branch_offset,
6122 Arm_relocate_functions::thumb32_cond_branch_upper,
6123 Arm_relocate_functions::thumb32_cond_branch_lower,
6124 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
6125 branch offset encoding.
6126 (Arm_relocate_functions::thumb_branch_common): Use new branch
6127 offset encoding methods to avoid code duplication.
6128 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
6129 (Stub_addend_reader::operator()): Use new branch encoding method
6130 to avoid code duplication.
6132 2010-01-11 Doug Kwan <dougkwan@google.com>
6134 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
6135 (Target_arm::do_finalize_sections): Define special EXIDX section
6136 symbols only if referenced.
6137 * gc.h (Garbage_collection::add_reference): New method.
6138 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
6141 2010-01-11 Ian Lance Taylor <iant@google.com>
6143 * script.cc (Version_script_info::build_expression_list_lookup):
6144 Change complaing about duplicate wildcard match from error to
6147 * script.cc (class Lazy_demangler): Recreate--revert part of patch
6149 (Version_script_info::Version_script_info): Initialize globs_,
6150 default_version_, default_is_global_, and exact_. Don't
6151 initialize globals_ or locals_.
6152 (Version_script_info::build_lookup_tables): Build local symbols
6154 (Version_script_info::unquote): New function.
6155 (Version_script_info::add_exact_match): New function.
6156 (Version_script_info::build_expression_list_lookup): Remove lookup
6157 parameter. Add is_global parameter. Change all callers. Handle
6158 wildcard pattern specially. Unquote pattern. Call
6160 (Version_script_info::get_name_to_match): New function.
6161 (Version_script_info::get_symbol_version): New function.
6162 (Version_script_info::get_symbol_version_helper): Remove.
6163 (Version_script_info::check_unmatched_names): Call unquote.
6164 * script.h (class Version_script_info): Change get_symbol_version
6165 to be non-inline and add is_global parameter; change all callers.
6166 Rewrite symbol_is_local. Update declarations. Define struct
6167 Version_tree_match, Exact, Globs. Don't define struct Lookup.
6168 Remove globals_ and locals_ members. Add exact_, globs_,
6169 default_version_, is_global_.
6170 (Version_script_info::Glob): Remove pattern, add expression and
6171 is_global. Update constructor. Change all callers.
6172 * dynobj.cc (Versions::finalize): Mark the version symbol as the
6174 (Versions::symbol_section_contents): If a symbol is undefined, or
6175 defined in a dynamic object, set the version index to
6177 * symtab.cc (Symbol_table::add_from_relobj): Don't call
6179 (Symbol_table::add_from_pluginobj): Likewise.
6180 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
6182 2010-01-11 Doug Kwan <dougkwan@google.com>
6184 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
6185 (incremental_dump_LDADD): Add linking option for libintl.
6186 * Makefile.in: Regenerate.
6188 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
6191 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
6193 * testsuite/Makefile.in: Regenerated.
6195 2010-01-10 Doug Kwan <dougkwan@google.com>
6197 * options.h (DEFINE_var): Use parentheses around argument varname__
6198 in macro body to avoid any unintended subsequent substitutions.
6200 2010-01-10 Ian Lance Taylor <iant@google.com>
6202 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
6203 candidates before doing symbol resolution.
6205 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
6206 ODR candidates if only one is weak.
6208 2010-01-08 Ian Lance Taylor <iant@google.com>
6210 * script.cc (Version_script_info::build_expression_list_lookup):
6211 Don't warn about ambiguous version, just record the ambiguity.
6212 (Version_script_info::get_symbol_version_helper): Give error if
6213 version is ambiguous.
6215 2010-01-08 Doug Kwan <dougkwan@google.com>
6217 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
6218 prev_data_size_ and prev_addralign_. Remove initializer for
6219 deleted data member has_been_changed_.
6220 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
6221 to determine if the table is empty.
6222 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
6224 (Stub_table::add_reloc_stub): Define method in class definition
6225 instead of just declaring it there.
6226 (Stub_table::add_cortex_a8_stub): New method definition.
6227 (Stub_table::update_data_size_and_addralign): Ditto.
6228 (Stub_table::finalize_stubs): Ditto.
6229 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
6230 (Stub_table::do_addralign_): Return address alignment in the
6231 (Stub_table::do_reset_address_and_file_offset): Define method in
6232 class definition instead of declaring it there. Set current data
6233 size to be the data size of the previous pass.
6234 (Stub_table::set_final_data_size): Use current data size as the
6236 (Stub_table::relocate_stub): Change parameter type of stub from
6237 Reloc_stub pointer to Stub pointer.
6238 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
6239 (Stub_table::Cortex_a8_stub_list): New typedef.
6240 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
6241 Stub_table::prev_addralign_): New data member.
6242 (Arm_relobj::Arm_relobj): Initialize data member
6243 section_has_cortex_a8_workaround_.
6244 (Arm_relobj::section_has_cortex_a8_workaround,
6245 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
6247 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
6249 (Target_arm::relocate_stub): Change parameter type of stub from
6250 Reloc_stub pointer to Stub pointer.
6251 (Insn_template::size, Insn_template::alignment): Handle
6252 THUMB16_SPECIAL_TYPE.
6253 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
6254 Stub_table::update_data_size_and_addralign,
6255 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
6257 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
6258 (Stub_table::do_write): Ditto.
6259 (Target_arm::do_relax): Adjust code for changes in Stub_table.
6261 2010-01-08 Ian Lance Taylor <iant@google.com>
6264 * symtab.h (class Symbol): Remove fields is_target_special_ and
6265 has_plt_offset_. Add field is_defined_in_discarded_section_.
6266 (Symbol::is_defined_in_discarded_section): New function.
6267 (Symbol::set_is_defined_in_discarded_section): New function.
6268 (Symbol::has_plt_offset): Rewrite.
6269 (Symbol::set_plt_offset): Verify that new offset is not -1U.
6270 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
6271 Don't initialize is_target_special_ or has_plt_offset_.
6272 Initialize is_defined_in_discarded_section_.
6273 (Symbol_table::add_from_relobj): If appropriate, set
6274 is_defined_in_discarded_section.
6275 * resolve.cc (Symbol::override_base_with_special): Don't test
6276 is_target_special_. Change has_plt_offset_ to has_plt_offset().
6277 * target-reloc.h (relocate_section): Do special handling for
6278 symbols defined in discarded sections for global symbols as well
6281 2010-01-08 Ian Lance Taylor <iant@google.com>
6283 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
6284 the SHT_SYMTAB case.
6286 2010-01-08 Ian Lance Taylor <iant@google.com>
6288 * object.cc (Sized_relobj::do_layout): Don't get confused if
6289 layout_eh_frame returns NULL.
6291 2010-01-08 Ian Lance Taylor <iant@google.com>
6294 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
6295 dynamic symbol table, use the normal symbol table.
6296 (Sized_dynobj::do_read_symbols): Remove assertion about type of
6299 2010-01-08 Ian Lance Taylor <iant@google.com>
6302 * layout.cc (Layout::include_section): Remove .gnu_debuglink
6305 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
6307 * version.cc (print_version): Change to "Copyright 2010".
6309 2010-01-08 Ian Lance Taylor <iant@google.com>
6313 * i386.cc (class Target_i386): Change return type of plt_section
6315 (class Output_data_plt_i386): Add tls_desc_rel_ field.
6316 (Output_data_plt_i386::Output_data_plt_i386): Initialize
6317 tls_desc_rel_ field.
6318 (Output_data_plt_i386::rel_tls_desc): New function.
6319 (Target_i386::rel_tls_desc_section): New function.
6320 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
6321 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
6322 R_386_TLS_DESC reloc in rel_tls_desc_section.
6323 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
6324 Define struct Tlsdesc_info.
6325 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
6326 (Target_x86_64::do_reloc_symbol_index): New function.
6327 (Target_x86_64::add_tlsdesc_info): New function.
6328 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
6329 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
6331 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
6333 (Output_data_plt_x86_64::rela_tlsdesc): New function.
6334 (Target_x86_64::rela_tlsdesc_section): New function.
6335 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
6337 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
6338 (Target_x86_64::do_reloc_addend): New function.
6339 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
6340 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
6341 declarations. Define TARGET_CODE. Add arg field to u1_ union.
6342 (Output_reloc::type): New function.
6343 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
6344 (Output_reloc::is_target_specific): New function.
6345 (Output_reloc::target_arg): New function.
6346 (class Output_reloc) [SHT_RELA]: Add four new constructors for
6347 absolute relocs and target specific relocs.
6348 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
6349 add_target_specific.
6350 (class Output_data_reloc) [SHT_RELA]: Likewise.
6351 * output.cc (Output_reloc::Output_reloc): Add four new versions
6352 for absolute relocs and target specific relocs.
6353 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
6354 (Output_reloc::get_symbol_index): Likewise.
6355 (Output_reloc::local_section_offset): Check that local_sym_index_
6356 is not TARGET_CODE or 0.
6357 (Output_reloc::symbol_value): Likewise.
6358 (Output_reloc::write) [SHT_RELA]: Call target for target specific
6360 * target.h (class Target): Add reloc_symbol_index and reloc_addend
6361 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
6363 * layout.cc (add_target_dynamic_tags): Use output section for
6364 DT_PLTRELSZ and DT_JMPREL.
6366 2010-01-07 Ian Lance Taylor <iant@google.com>
6369 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
6371 (class Output_data_reloc_generic): Define.
6372 (class Output_data_reloc_base): Change base class to
6373 Output_data_reloc_generic. Change add() method to call
6374 bump_relative_reloc_count for a relative reloc. Remove
6376 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
6378 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
6379 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
6381 * layout.h (class Layout): Update declaration.
6383 2010-01-07 Ian Lance Taylor <iant@google.com>
6385 * output.h (class Output_data): Add const version of
6386 output_section and do_output_section.
6387 (class Output_section_data): Add const version of
6389 (class Output_section): Likewise.
6390 * layout.cc (Layout::add_target_dynamic_tags): New function.
6391 * layout.h (class Layout): Update declarations.
6392 * arm.cc (Target_arm::do_finalize_sections): Use
6393 add_target_dynamic_tags.
6394 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6395 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6396 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6397 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6399 2010-01-07 Ian Lance Taylor <iant@google.com>
6402 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
6405 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
6406 Ian Lance Taylor <iant@google.com>
6409 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
6410 Xindex::read_symtab_xindex.
6412 2010-01-07 Doug Kwan <dougkwan@google.com>
6414 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
6415 (Insn_template::thumb16_bcond_insn): New method declaration.
6416 (Insn_template): Fix spelling.
6417 (Stub::thumb16_special): New method declaration.
6418 (Stub::do_write): Define virtual method which was previously pure
6420 (Stub::do_thumb16_special): New method declaration.
6421 (Stub::do_fixed_endian_write): New template member.
6422 (Reloc_stub::do_write): Remove.
6423 (Reloc_stub::do_fixed_endian_write): Remove.
6424 (Cortex_a8_stub): New class definition.
6425 (Stub_factory::make_cortex_a8_stub): New method definition.
6426 (Stub_factory::Stub_factory): Add missing static storage class
6427 qualifier for elf32_arm_stub_a8_veneer_blx.
6429 2010-01-07 Ian Lance Taylor <iant@google.com>
6432 * options.h (class General_options): Add --warn-unresolved-symbols
6433 and --error-unresolved-symbols.
6434 * errors.cc (Errors::undefined_symbol): Implement
6435 --warn-unresolved-symbols.
6437 * options.h (class General_options): Add -z text and -z textoff.
6438 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
6440 2010-01-06 Sriraman Tallam <tmsriram@google.com>
6442 * gc.h (Garbage_collection::Cident_section_map): New typedef.
6443 (Garbage_collection::cident_sections): New function.
6444 (Garbage_collection::add_cident_section): New function.
6445 (Garbage_collection::cident_sections_): New member.
6446 (gc_process_relocs): Add references to sections whose names are C
6448 * gold.h (cident_section_start_prefix): New constant.
6449 (cident_section_stop_prefix): New constant.
6450 (is_cident): New function.
6451 * layout.cc (Layout::define_section_symbols): Replace string constants
6452 with the newly defined constants.
6453 * object.cc (Sized_relobj::do_layout): Track sections whose names are
6455 * testsuite/Makefile.am: Add gc_orphan_section_test.
6456 * testsuite/Makefile.in: Regenerate.
6457 * testsuite/gc_orphan_section_test.cc: New file.
6458 * testsuite/gc_orphan_section_test.sh: New file.
6460 2010-01-06 Ian Lance Taylor <iant@google.com>
6463 * options.h (class General_options): Add --warn-shared-textrel.
6464 * layout.cc (Layout::finish_dynamic_section): Implement
6465 --warn-shared-textrel.
6468 * options.h (class General_options): Add --warn-multiple-gp.
6470 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6472 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
6473 $(THREADSLIB) and $(LIBDL).
6474 * Makefile.in: Rebuild.
6476 2010-01-06 Ian Lance Taylor <iant@google.com>
6479 * options.cc (General_options::parse_section_start): New function.
6480 (General_options::section_start): New function.
6481 (General_options::General_options): Initialize all members.
6482 * options.h: Include <map>
6483 (class General_options): Add --section-start. Add section_starts_
6485 * layout.cc (Layout::attach_allocated_section_to_segment): If
6486 --section-start was used, set the address of the segment. Remove
6487 local sort_sections.
6488 (Layout::relaxation_loop_body): If the address of the load segment
6489 has been set by --section-start, don't use it.
6490 * output.h (Output_segment::update_flags_for_output_section): New
6492 * output.cc (Output_segment::add_output_section): Call
6493 update_flags_for_output_section.
6495 2010-01-05 Ian Lance Taylor <iant@google.com>
6498 * options.h (class General_options): Add --undefined-version.
6499 * script.cc (struct Version_expression): Add was_matched_by_symbol
6501 (Version_script_info::matched_symbol): New function.
6502 (Version_script_info::get_symbol_version_helper): Call
6504 (Version_script_info::check_unmatched_names): New function.
6505 * script.h (class Version_script_info): Update declarations.
6506 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
6508 * options.h (class General_options): Use DEFINE_bool_alias for
6509 allow_multiple_definition.
6510 * resolve.cc (Symbol_table::should_override): Don't test
6511 allow_multiple_definition.
6514 * options.h (class General_options): Add --cref.
6515 * main.cc (main): Print cref table if --cref. Don't close mapfile
6516 until after printing cref table.
6517 * cref.cc: Include "symtab.h".
6518 (class Cref_inputs): Define Cref_table_compare and Cref_table.
6519 (Cref_table_compare::operator()): New function.
6520 (Cref_inputs::gather_cref): New function.
6521 (filecol): New static const.
6522 (Cref_inputs::print_cref): New function.
6523 (Cref::print_cref): New function.
6524 * cref.h: Include <cstdio>.
6525 (class Cref): Update declarations.
6526 * mapfile.h (Mapfile::file): New function.
6527 * object.h (class Object): Define Symbols. Declare virtual
6528 do_get_global_symbols.
6529 (Object::get_global_symbols): New function.
6530 * object.cc (Input_objects::add_object): Pass object to cref_ if
6532 (Input_objects::archive_start): Likewise.
6533 (Input_objects::archive_stop): Likewise.
6534 (Input_objects::print_cref): New function.
6535 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
6536 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
6538 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
6540 * plugin.h (class Sized_pluginobj): Update declarations.
6542 2010-01-05 Ian Lance Taylor <iant@google.com>
6544 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
6545 to is_default_version. Rename insdef to insdefault.
6546 (Symbol_table::add_from_relobj): Rename def to is_default_version
6547 and local to is_forced_local.
6548 (Symbol_table::add_from_pluginobj): Likewise.
6549 (Symbol_table::add_from_dynobj): Likewise.
6550 (Symbol_table::define_special_symbol): Rename insdef to
6553 2010-01-04 Ian Lance Taylor <iant@google.com>
6556 * options.h (class General_options): Add
6557 --allow-multiple-definition and -z muldefs.
6558 * resolve.cc (Symbol_table::should_override): Don't warn about a
6559 multiple symbol definition if --allow-multiple-definition or -z
6563 * options.h (class General_options): Add --add-needed and
6564 --copy-dt-needed-entries. Tweak --as-needed help entry.
6565 * object.cc (Input_objects::check_dynamic_dependencies): Give an
6566 error if --copy-dt-needed-entries aka --add-needed is used and
6567 would cause a change in behaviour.
6570 * options.h (class General_options): Add -G as a short version of
6571 --shared. Add no-op options -assert, -g, and -i.
6573 2010-01-04 Sriraman Tallam <tmsriram@google.com>
6575 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
6576 check for .text or .gnu.linkonce.t sections.
6577 * icf.cc (Icf::find_identical_sections): Ditto.
6578 Change the detection for mangled function name within the section
6580 * icf.h (is_section_foldable_candidate): New function.
6582 2009-12-30 Ian Lance Taylor <iant@google.com>
6585 * options.h (class General_options): Permit two dashes with
6586 --retain-symbols-file.
6588 2009-12-30 Ian Lance Taylor <iant@google.com>
6591 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
6592 don't put the file header and segment headers in the text
6596 * common.cc (Sort_commons::operator()): Stabilize sort when both
6598 (Symbol_table::do_allocate_commons_list): When allocating common
6599 symbols, skip a symbol which is no longer common.
6600 * symtab.h (Symbol::is_common): Test whether the symbol comes from
6601 an object before checking its type.
6602 * testsuite/common_test_2.c: New file.
6603 * testsuite/common_test_3.c: New file.
6604 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
6605 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
6606 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
6607 (common_test_2_pic.o, common_test_2.so): New targets.
6608 (common_test_3_pic.o, common_test_3.so): New targets.
6609 * testsuite/Makefile.in: Rebuild.
6612 * script.cc (read_input_script): If we see a new SECTIONS clause,
6613 and we have added an input section, give an error.
6614 * layout.h (class Layout): Add have_added_input_section function.
6615 Add have_added_input_section_ field.
6616 * layout.cc (Layout::Layout): Initialize
6617 have_added_input_section_.
6618 (Layout::layout): Set have_added_input_section_.
6619 (Layout::layout_eh_frame): Likewise.
6621 2009-12-30 Ian Lance Taylor <iant@google.com>
6624 * options.h (class General_options): Add --sort-common option.
6625 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
6626 * common.cc (Sort_common): Add sort_order parameter to
6627 constructor. Add sort_order_ field.
6628 (Sort_commons::operator): Check sort_order_.
6629 (Symbol_table::allocate_commons): Determine the sort order.
6630 (Symbol_table::do_allocate_commons): Add sort_order parameter.
6632 (Symbol_table::do_allocate_commons_list): Likewise.
6634 2009-12-30 Ian Lance Taylor <iant@google.com>
6637 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
6638 symbols from this object, don't change the visibility of an
6640 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
6642 2009-12-30 Ian Lance Taylor <iant@google.com>
6645 * script.h (class Version_script_info): Define Language enum.
6646 Update declarations. Define Glob, Exact, and Lookup types. Add
6647 new fields globals_, locals_, and is_finalized_.
6648 * script.cc: Various formatting fixes.
6649 (class Parser_closure): Change language_stack_ from a vector of
6650 std::string to one of Version_script_info::Language. Adjust all
6652 (class Lazy_demangler): Remove.
6653 (struct Version_expression): Change language from std::string to
6654 Version_script_info::Language.
6655 (Version_script_info::Version_script_info): New function.
6656 (Version_script_info::~Version_script_info): Don't call clear.
6657 (Version_script_info::finalize): New function.
6658 (Version_script_info::build_lookup_tables): New function.
6659 (Version_script_info::build_expression_list_lookup): New
6661 (Version_script_info::get_symbol_version_helper): Rewrite to use
6663 (Version_script_info::print_expression_list): Adjust to use
6664 Version_script_info::Language.
6665 (script_push_lex_into_version_mode): Check that the version script
6666 has not been finalized.
6667 (version_script_push_lang): Change language string to
6668 Version_script_info::Language.
6669 * options.cc (Command_line::version_script): New function.
6670 * options.h (class General_options): Add finalize_dynamic_list
6671 function. Change version_script from declaration to definition.
6672 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
6673 * testsuite/version_script.map: Remove duplicate def of foo.
6674 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
6676 * testsuite/Makefile.in: Rebuild.
6678 2009-12-30 Ian Lance Taylor <iant@google.com>
6681 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
6682 if the input symbol index is 0, make the output symbol index 0.
6684 2009-12-30 Ian Lance Taylor <iant@google.com>
6687 * options.h (class General_options): Add -x/--discard-all.
6688 * object.cc (Sized_relobj::do_count_local_symbols): Handle
6689 --discard-all. If the local symbol needs a dynamic entry, check
6690 that before handling --discard-locals.
6692 2009-12-30 Ian Lance Taylor <iant@google.com>
6695 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
6697 (Output_segment::add_output_section): Don't change the flags if
6701 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
6702 GNU hash table if they need a dynamic value. Otherwise, don't add
6703 them if they are defined in a dynamic object or are forced local.
6705 2009-12-29 Ian Lance Taylor <iant@google.com>
6708 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
6709 .gnu.hash table for a 32-bit target.
6712 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
6713 regular and a dynamic object only needs a dynamic symbol table
6714 entry if it is externally visible.
6717 * i386.cc (class Target_i386): Initialize global_offset_table_ in
6718 constructor. Add global_offset_table_ field.
6719 (Target_i386::got_section): Set global_offset_table_.
6720 (Target_i386::do_finalize_sections): Set global_offset_table_
6722 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
6723 in constructor. Add global_offset_table_ field.
6724 (Target_x86_64::got_section): Set global_offset_table_.
6725 (Target_x86_64::do_finalize_sections): Set global_offset_table_
6728 * layout.cc (Layout::Layout): Initialize increase_relro_.
6729 (Layout::get_output_section): Add is_relro, is_last_relro, and
6730 is_first_non_relro parameters. Change all callers.
6731 (Layout::choose_output_section): Likewise.
6732 (Layout::add_output_section_data): Likewise.
6733 (Layout::make_output_section): Likewise.
6734 (Layout::set_segment_offsets): Clear increase_relro when using a
6736 * layout.h (class Layout): Add increase_relro method. Add
6737 increase_relro_ field. Update declarations.
6738 * output.cc (Output_section::Output_section): Initialize
6739 is_last_relro_ and is_first_non_relro_.
6740 (Output_segment::add_output_section): Group relro sections is
6741 do_sort is true. Handle is_last_relro and is_first_non_relro.
6742 (Output_segment::maximum_alignment): Remove relro handling.
6743 (Output_segment::set_section_addresses): Add increase_relro
6744 parameter. Change all callers. Add initial alignment to align
6745 relro sections on separate page. Remove old relro handling.
6746 (Output_segment::set_section_list_addresses): Remove in_relro
6747 parameter. Change all callers.
6748 (Output_segment::set_offset): Add increase parameter. Change all
6749 callers. Remove old relro handling.
6750 * output.h (class Output_section): Add new methods: is_last_relro,
6751 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
6752 Add is_last_relro_ and is_first_non_relro_ fields.
6753 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
6754 Create separate .got.plt section. Call increase_relro.
6755 * x86_64.cc (Target_x86_64::got_section): Likewise.
6756 * testsuite/relro_script_test.t: Add .got.plt.
6759 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
6760 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
6761 (Layout::finalize): Call set_dynamic_symbol_size.
6762 (Layout::set_dynamic_symbol_size): New function.
6763 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
6764 set_dynamic_symbol_size.
6767 * output.h (class Output_section): Add is_entsize_zero_ field.
6768 * output.cc (Output_section::Output_section): Initialize
6770 (Output_section::set_entsize): If two different entsizes are
6771 requested, force it to zero.
6772 (Output_section::add_input_section): Set flags for .debug_str
6773 before updating section flags. Set entsize.
6774 (Output_section::update_flags_for_input_section): Set SHF_MERGE
6775 and SHF_STRING if all input sections have those flags.
6777 2009-12-29 Rafael Espindola <espindola@google.com>
6779 * main.cc (main): Fix the sys time reporting.
6780 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
6783 2009-12-29 Sriraman Tallam <tmsriram@google.com>
6785 * options.cc (General_options::parse_version): Allow -v to exit
6786 without an error if there is nothing to link.
6788 2009-12-29 Ian Lance Taylor <iant@google.com>
6790 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
6791 using a version of gcc before 4.1.
6792 * configure: Rebuild.
6794 2009-12-28 Chris Demetriou <cgd@google.com>
6796 * attributes.cc (Output_attributes_section_data::do_write): Use
6797 std::vector::front rather than std::vector::data.
6799 2009-12-28 Ian Lance Taylor <iant@google.com>
6801 * symtab.h (class Symbol_table): Add enum Defined.
6802 * resolve.cc (Symbol_table::should_override): Add defined
6803 parameter. Change all callers. Test whether object is NULL
6804 before calling a method on it.
6805 (Symbol_table::report_resolve_problem): Add defined parameter.
6807 (Symbol_table::should_override_with_special): Likewise.
6808 * symtab.cc (Symbol_table::define_in_output_data): Add defined
6809 parameter. Change all callers.
6810 (Symbol_table::do_define_in_output_data): Likewise.
6811 (Symbol_table::define_in_output_segment): Likewise.
6812 (Symbol_table::do_define_in_output_segment): Likewise.
6813 (Symbol_table::define_as_constant): Likewise.
6814 (Symbol_table::do_define_as_constant): Likewise.
6815 * script.h (class Symbol_assignment): Add is_defsym parameter to
6816 constructor; change all callers.
6817 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
6818 parameter. Change all callers. Add is_defsym_ field.
6819 (class Parser_closure): Add parsing_defsym parameter to
6820 constructor; change all callers. Add parsing_defsym accessor
6821 function. Add parsing_defsym_ field.
6823 2009-12-28 Ian Lance Taylor <iant@google.com>
6825 * gold.cc (queue_middle_tasks): Fix formatting.
6826 * object.cc (Relobj::is_section_name_included): Likewise.
6828 2009-12-23 Ian Lance Taylor <iant@google.com>
6830 * i386.cc (Target_i386::do_calls_non_split): Recognize
6831 -fsplit-stack prologue for a function with a static chain.
6832 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
6833 -fsplit-stack prologue when using %r11.
6835 2009-12-21 Sriraman Tallam <tmsriram@google.com>
6837 * options.cc (General_options::parse_version): Make -v continue and do
6838 the link like GNU ld does.
6840 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
6842 * Makefile.am (CCFILES): Add timer.cc.
6843 (HFILES): Add timer.h.
6844 * configure.ac: Check for sysconf and times.
6845 * main.cc: include timer.h.
6846 (main): Use Timer instead of get_run_time.
6849 * workqueue.cc: include timer.h.
6850 (Workqueue::find_and_run_task):
6851 Report user, sys and wall time.
6852 * Makefile.in: Regenerate.
6853 * config.in: Regenerate.
6854 * configure: Regenerate.
6856 2009-12-16 Doug Kwan <dougkwan@google.com>
6858 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
6860 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
6861 relaxed input sections.
6862 * output.cc (Output_section::find_relaxed_input_section): Change
6863 return type to Output_relaxed_input_section pointer. Adjust code
6864 for new type of relaxed_input_section_map_.
6865 * output.h (Output_section::find_relaxed_input_section): Change
6866 return type to Output_relaxed_input_section pointer.
6867 (Output_section::Output_relaxed_input_section_by_input_section_map):
6869 (Output_section::relaxed_input_section_map_): Change type to
6870 Output_section::Output_relaxed_input_section_by_input_section_map.
6871 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
6874 2009-12-15 Ian Lance Taylor <iant@google.com>
6876 * layout.cc (Layout::create_shstrtab): Only write out after input
6877 sections if we are compressing debug sections.
6879 2009-12-15 Ian Lance Taylor <iant@google.com>
6881 * archive.cc (Archive::add_symbols): Only look up a symbol without
6882 a version if there is, in fact, a version.
6884 2009-12-14 Ian Lance Taylor <iant@google.com>
6886 Revert -Wshadow changes, all changes from:
6887 2009-12-11 Doug Kwan <dougkwan@google.com>
6888 2009-12-11 Nick Clifton <nickc@redhat.com>
6889 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
6891 2009-12-11 Doug Kwan <dougkwan@google.com>
6893 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
6895 * attributes.cc (Object_attribute::size): Ditto.
6896 (Attributes_section_data::size): Ditto.
6897 (Attributes_section_data::Attributes_section_data): Ditto.
6898 (Output_attributes_section_data::do_write): Ditto.
6899 * attributes.h (Object_attribute::set_type): Ditto.
6900 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
6902 2009-12-11 Nick Clifton <nickc@redhat.com>
6904 * archive.cc: Fix shadowed variable warnings.
6906 * compressed_output.cc: Likewise.
6907 * compressed_output.h: Likewise.
6908 * configure: Likewise.
6909 * dwarf_reader.cc: Likewise.
6910 * dynobj.cc: Likewise.
6911 * dynobj.h: Likewise.
6912 * ehframe.cc: Likewise.
6913 * ehframe.h: Likewise.
6914 * errors.cc: Likewise.
6915 * expression.cc: Likewise.
6916 * fileread.cc: Likewise.
6917 * fileread.h: Likewise.
6918 * freebsd.h: Likewise.
6919 * i386.cc: Likewise.
6921 * incremental.h: Likewise.
6922 * layout.cc: Likewise.
6923 * layout.h: Likewise.
6924 * mapfile.cc: Likewise.
6925 * merge.cc: Likewise.
6926 * merge.h: Likewise.
6927 * object.cc: Likewise.
6928 * object.h: Likewise.
6929 * options.h: Likewise.
6930 * output.cc: Likewise.
6931 * output.h: Likewise.
6932 * parameters.cc: Likewise.
6933 * plugin.cc: Likewise.
6934 * powerpc.cc: Likewise.
6935 * reduced_debug_output.cc: Likewise.
6936 * reduced_debug_output.h: Likewise.
6937 * reloc.cc: Likewise.
6938 * reloc.h: Likewise.
6939 * resolve.cc: Likewise.
6940 * script-sections.cc: Likewise.
6941 * script.cc: Likewise.
6942 * script.h: Likewise.
6943 * sparc.cc: Likewise.
6944 * symtab.cc: Likewise.
6945 * symtab.h: Likewise.
6946 * target-select.cc: Likewise.
6947 * target-select.h: Likewise.
6948 * token.h: Likewise.
6949 * workqueue.cc: Likewise.
6950 * workqueue.h: Likewise.
6951 * x86_64.cc: Likewise.
6953 2009-12-10 Doug Kwan <dougkwan@google.com>
6955 * arm.cc (attributes.h): New include.
6956 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
6957 (Arm_relobj::~Arm_relobj): Delete object pointed by
6958 attributes_section_data_.
6959 (Arm_relobj::attributes_section_data): New method definition.
6960 (Arm_relobj::attributes_section_data_): New data member declaration.
6961 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
6962 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
6963 attributes_section_data_.
6964 (Arm_dynobj::attributes_section_data): New method definition.
6965 (Arm_dynobj::attributes_section_data_): New data member declaration.
6966 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
6967 initialization value of may_use_blx_ to false.
6968 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
6969 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
6970 object attributes to compute results instead of hard-coding.
6971 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
6972 Target_arm::get_secondary_compatible_arch,
6973 Target_arm::set_secondary_compatible_arch
6974 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6975 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
6976 New method declarations.
6977 (Target_arm::get_aeabi_object_attribute): New method definition.
6978 (Target_arm::attributes_section_data_): New data member declaration.
6979 (read_arm_attributes_section): New template definition.
6980 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
6981 (Arm_dynobj::do_read_symbols): Ditto.
6982 (Target_arm::do_finalize_sections): Merge attributes sections from
6983 input. Check for BLX use after attributes section merging.
6984 Fix __exidx_start and __exidx_end visibility. Create an
6985 .ARM.attributes section if necessary.
6986 (Target_arm::get_secondary_compatible_arch,
6987 Target_arm::set_secondary_compatible_arch,
6988 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6989 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
6990 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
6991 New method definitions.
6993 2009-12-09 Ian Lance Taylor <iant@google.com>
6995 * plugin.cc (Plugin::load): Don't cast from void* to a function
6998 2009-12-09 Ian Lance Taylor <iant@google.com>
7000 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
7003 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
7005 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
7006 Replace two_file_shared_1.so with two_file_shared_2.so.
7007 * testsuite/Makefile.in: Regenerated.
7009 2009-12-08 Doug Kwan <dougkwan@google.com>
7011 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
7012 (HFILES): Add attributes.h and int_encoding.h.
7013 * Makefile.in: Regenerate.
7014 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
7015 function definitions to int_encoding.cc
7016 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
7017 prototypes to int_encoding.h
7018 * reduced_debug_output.cc (int_encoding.h): New include.
7019 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
7020 function definitions to int_encoding.cc
7021 (insert_into_vector, read_from_pointer): Move template definitions to
7023 * attributes.cc: New file.
7024 * attributes.h: New file.
7025 * int_encoding.cc: New file.
7026 * int_encoding.h: New file.
7028 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
7031 * incremental-dump.cc (dump_incremental_inputs): New.
7032 (main): Use dump_incremental_inputs.
7034 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
7037 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
7038 checking elfcpp::STT_FUNC.
7039 (Target_i386::Relocate::relocate): Likewise.
7040 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
7042 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
7043 symbols from shared libraries into normal FUNC symbols.
7045 * symtab.h (Symbol): Add is_func and use it.
7047 2009-12-05 Doug Kwan <dougkwan@google.com>
7049 * arm.cc (Target_arm::arm_info): Initialize new fields
7050 attributes_section and attributes_vendor.
7051 * i386.cc (Target_i386::i386_info): Same.
7052 * object.cc (Sized_relobj::do_layout): Skip attribute section.
7053 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7054 fields attributes_section and attributes_vendor.
7055 * sparc.cc (Target_sparc::sparc_info): Same.
7056 * target.h (Target::attributes_section, Target::attributes_vendor,
7057 Target::is_attributes_section, Target::attribute_arg_type,
7058 Target::attributes_order): New method definitions.
7059 (Target::Target_info::attributes_section,
7060 Target::Target_info::attributes_vendor): New fields.
7061 (Target::do_attribute_arg_type, Target::do_attributes_order): New
7062 virtual method definitions.
7063 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7064 attributes_section and attributes_vendor.
7065 * testsuite/testfile.cc (Target_test::test_target_info): Same.
7067 2009-12-05 Doug Kwan <dougkwan@google.com>
7069 * arm.cc: Update comments about interworking and stub generation.
7070 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
7071 considered as non-PIC.
7072 (Arm_relocate_functions::base_abs): Fix formatting.
7073 (Arm_relocate_functions::got_prel): Fix comment. Change interface
7074 of function to use GOT entry address instead of offset.
7075 (Target_arm::Scan::global): Issue an error if a symbol would need a
7076 PLT does not get one because it is untyped. Remove code to create
7077 dynamic symbols for relative branches.
7078 (Target_arm::Relocate::relocate: Use 0 instead of false since function
7079 takes unsigned integer instead of boolean.
7081 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
7083 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7084 (two_file_test_LDADD): Likewise.
7085 (common_test_1_LDADD): Likewise.
7086 (exception_test_LDADD) Likewise.
7087 (weak_test_LDADD): Likewise.
7088 (many_sections_test_LDADD): Likewise.
7089 (initpri1_LDADD): Likewise.
7090 (script_test_1_LDADD): Likewise.
7091 (script_test_2_LDADD): Likewise.
7092 (justsyms_LDADD): Likewise.
7093 (binary_test_LDADD): Likewise.
7094 (large_LDADD): Likewise.
7095 * testsuite/Makefile.in: Regenerated.
7097 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
7099 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7100 (Symbol_table::override_with_special): Likewise.
7101 (Symbol_table::add_from_object): Likewise.
7103 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
7105 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7106 Don't set the data_offset twice.
7108 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
7110 * testsuite/Makefile.in: Regenerate.
7112 2009-12-03 Doug Kwan <dougkwan@google.com>
7114 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
7115 (Target_arm::do_finalize_sections): Add parameter for symbol table
7116 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
7117 * i386.cc (Target_i386::do_finalize_sections): Add an additional
7118 parameter for symbol table pointer.
7119 * layout.cc (Layout::finalize): Call Target::finalize_sections with
7120 an additional parameter for a pointer to symbol table.
7121 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
7122 parameter for a symbol table pointer.
7123 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
7124 * target.h (Target::finalize_sections, Target::do_finalize_sections):
7126 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
7127 parameter for a symbol table pointer.
7129 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
7131 * incremental.cc (Incremental_inputs_header)
7132 (Incremental_inputs_header_write, Incremental_inputs_entry)
7133 (Incremental_inputs_entry_write): Move ...
7134 * incremental.h (Incremental_inputs_header)
7135 (Incremental_inputs_header_write, Incremental_inputs_entry)
7136 (Incremental_inputs_entry_write): here.
7138 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7140 * incremental.cc (make_sized_incremental_binary): Set the target.
7141 Error if it is incompatible.
7142 * output.h (Output_file): Add filename method.
7144 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7146 * incremental.cc (Incremental_inputs_entry): Remove unused argument
7147 from the get_* methods.
7149 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7151 * incremental-dump.cc (main): Check that the offeset of a script is 0.
7152 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7153 Write 0 for the data_offset of scripts.
7155 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7157 * testsuite/Makefile.am: Add the incremental_test.sh test.
7158 * testsuite/incremental_test.sh: New.
7159 * testsuite/incremental_test_1.c: New.
7160 * testsuite/incremental_test_2.c: New.
7162 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
7164 * incremental-dump.cc (main): Fix typos.
7166 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
7169 * incremental-dump.cc (main): Use llu to print 64 bit values.
7171 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
7172 H.J. Lu <hongjiu.lu@intel.com>
7174 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
7176 (incremental_dump_LDADD): Likewise.
7177 * Makefile.in: Regenerated.
7179 2009-11-25 Doug Kwan <dougkwan@google.com>
7183 2009-11-25 Doug Kwan <dougkwan@google.com>
7185 * arm.cc (Target_arm::Target_arm): Move method definition
7186 outside of class definition. Add code to handle
7187 --target1-rel, --target1-abs and --target2= options.
7188 (Target_arm::get_reloc_reloc_type): Change method to be
7189 non-static and const.
7190 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
7191 New data member declaration.
7192 (Target_arm::Scan::local, Target_arm::Scan::global,
7193 Target_arm::Relocate::relocate,
7194 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7195 Adjust call to Target_arm::get_real_reloc_type.
7196 (Target_arm::get_real_reloc_type): Use command line options
7197 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7198 * options.h (--target1-rel, --target1-abs, --target2): New
7201 2009-11-25 Doug Kwan <dougkwan@google.com>
7203 * arm.cc (Target_arm::Target_arm): Move method definition outside of
7204 class definition. Add code to handle --target1-rel, --target1-abs
7205 and --target2= options.
7206 (Target_arm::get_reloc_reloc_type): Change method to be non-static
7208 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
7210 (Target_arm::Scan::local, Target_arm::Scan::global,
7211 Target_arm::Relocate::relocate,
7212 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
7213 call to Target_arm::get_real_reloc_type.
7214 (Target_arm::get_real_reloc_type): Use command line options to
7215 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7216 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
7219 2009-11-25 Doug Kwan <dougkwan@google.com>
7221 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
7222 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
7223 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
7225 (Arm_relocate_functions::thm_call): Replace body with a call to
7226 Arm_relocate_functions::thumb_branch_common.
7227 (Arm_relocate_functions::thm_jump24,
7228 Arm_relocate_functions::thm_xpc22): New method definitions.
7229 (Arm_relocate_functions::thumb_branch_common): New method definition.
7230 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
7232 (Target_arm::Relocate::relocate): Adjust call to thm_call.
7233 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
7235 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
7237 * Makefile.am: Build incremental-dump
7238 * Makefile.in: Regenerate.
7239 * incremental-dump.cc: New.
7240 * incremental.cc (Incremental_inputs_header_data,
7241 Incremental_inputs_entry_data): Move to incremental.h
7242 * incremental.h: (Incremental_inputs_header_data,
7243 Incremental_inputs_entry_data): Move from incremental.cc
7245 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
7247 * incremental.cc (Incremental_inputs_header,
7248 Incremental_inputs_header_write, Incremental_inputs_entry,
7249 Incremental_inputs_entry_write): Add a typedef with the data type.
7251 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
7253 * incremental.cc (Incremental_inputs_header,
7254 Incremental_inputs_header_write, Incremental_inputs_entry,
7255 Incremental_inputs_entry_write): Update comment about which
7256 type has the filed descriptions.
7258 2009-11-15 Doug Kwan <dougkwan@google.com>
7260 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
7261 (Arm_relocate_functions::arm_branch_common): Change method defintion
7262 in class definition to a method declaration and update list of formal
7264 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
7265 Arm_relocation_functions::jump24): Adjust call to
7266 Arm_relocate_functions::arm_branch_common. Update list of formal
7268 (Arm_relocate_functions::xpc25): New method definition.
7269 (Arm_relocate_functions::arm_branch_common): Move method defintion
7270 out from class definition. Use stubs for mode-switching and extending
7272 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
7273 specially. Change code to enable use of stubs in ARM branches.
7275 2009-11-10 Doug Kwan <dougkwan@google.com>
7277 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
7278 in method declaration.
7279 (Target_arm::relocate_stub): New method declaration.
7280 (Target_arm::default_target): Change to return a pointer instead of
7282 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
7283 Target_arm::default_target.
7284 (Arm_Relobj::do_relocate_sections): Remove options paramater in
7286 (Target_arm::relocate_section): Adjust view.
7287 (Target_arm::relocate_stub): New method definition.
7289 2009-11-10 Doug Kwan <dougkwan@google.com>
7291 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
7293 * incremental.cc (open_incremental_binary): Initialized local
7294 variables to avoid warnings.
7295 * object.cc (make_elf_object): Ditto.
7296 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
7299 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
7302 * testsuite/plugin_test.c: Include "config.h".
7304 2009-11-09 Doug Kwan <dougkwan@google.com>
7306 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
7307 (arm_symbol_value): Remove.
7308 (Arm_relocate_functions::arm_branch_common,
7309 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
7310 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
7311 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
7312 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
7313 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
7314 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
7315 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
7316 Arm_relocate_functions::thm_mobw_abs_nc,
7317 Arm_relocate_functions::thm_mov_abs,
7318 Arm_relocate_functions::movw_prel_nc,
7319 Arm_relocate_functions::thm_movt_abs,
7320 Arm_relocate_functions::movt_prel,
7321 Arm_relocate_functions::thm_movw_prel_nc,
7322 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
7323 (Target_arm::Relocate::relocate): Only decompose address into two
7324 parts if relocation type uses the thumb-bit and pass the actual
7325 bit instead of a flag indicating that the thumb-bit is used. Adjust
7326 calls to methods in Arm_relocate_functions for this change.
7328 2009-11-08 Ian Lance Taylor <iant@google.com>
7331 * reloc.cc: Instantiate
7332 Sized_relobj::initialize_input_to_output_maps and
7333 Sized_relobj:free_input_to_output_maps.
7335 2009-11-06 Ian Lance Taylor <iant@google.com>
7338 * defstd.cc (in_segment): Set only_if_ref true for "end".
7340 2009-11-06 Doug Kwan <dougkwan@google.com>
7342 * arm.cc (class Reloc_stub): Correct a comment.
7343 (Target_arm::Target_arm): Initialize arm_input_section_map_.
7344 (Target_arm::scan_section_for_stubs): New method declaration.
7345 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
7346 Change methods from private to protected.
7347 (Target_arm::do_may_relax): New method definition.
7348 (Target_arm::do_relax, Target_arm::group_sections,
7349 Target_arm::scan_reloc_for_stub,
7350 Target_arm::scan_reloc_section_for_stubs): New method declarations.
7351 (Target_arm::arm_input_section_map_): New data member declaration.
7352 (Target_arm::scan_reloc_for_stub,
7353 Target_arm::scan_reloc_section_for_stubs,
7354 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
7355 Target_arm::do_relax): New method definitions.
7357 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
7359 * configure.ac: Check for (struct stat)::st_mtim
7360 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
7361 * config.in: Regenerate.
7362 * configure: Regenerate.
7364 2009-11-05 Ian Lance Taylor <iant@google.com>
7367 * output.cc (Output_segment::add_output_section): Add missing
7370 2009-11-04 Ian Lance Taylor <iant@google.com>
7373 * object.h (class Object): Add is_needed and set_is_needed
7374 methods. Add is_needed_ field. Make bool fields into bitfields.
7375 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
7376 defined in a dynamic object and referenced by a regular object,
7377 set is_needed for the dynamic object.
7378 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
7379 if the file is marked with as_needed and it is not needed.
7381 2009-11-04 Ian Lance Taylor <iant@google.com>
7384 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
7385 tags if data is discarded by linker script.
7386 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7387 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7388 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7389 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7391 2009-11-04 Ian Lance Taylor <iant@google.com>
7393 * layout.cc (Layout::get_output_section): Add is_interp and
7394 is_dynamic_linker_section parameters. Change all callers.
7395 (Layout::choose_output_section): Likewise.
7396 (Layout::make_output_section): Likewise.
7397 (Layout::add_output_section_data): Add is_dynamic_linker_section
7398 parameter. Change all callers.
7399 * layout.h (class Layout): Update declarations.
7400 * output.h (class Output_section): Add is_interp, set_is_interp,
7401 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
7402 Add is_interp_, is_dynamic_linker_section_ fields. Change
7403 generate_code_fills_at_write_ to a bitfield.
7404 * output.cc (Output_section::Output_sections): Initialize new
7406 (Output_segment::add_output_section): Add do_sort parameter.
7409 2009-11-03 Ian Lance Taylor <iant@google.com>
7412 * options.h (class General_options): Add --warn-common.
7413 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
7414 merging two common symbols.
7415 (Symbol_table::should_override): Handle --warn-common when merging
7416 a common symbol with a defined symbol. Use report_resolve_problem
7417 for multiple definitions.
7418 (Symbol_table::report_resolve_problem): New function.
7419 * symtab.h (class Symbol_table): Declare report_resolve_problem.
7421 2009-11-03 Doug Kwan <dougkwan@google.com>
7423 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
7425 (Target_arm::stub_factory): New method definition.
7426 (Target_arm::new_arm_input_section,
7427 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
7428 Target_arm::reloc_uses_thumb_bit): New method declarations.
7429 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
7430 New type definitions.
7431 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
7432 member declarations.
7433 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
7434 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
7435 New method definitions.
7437 2009-11-03 Ian Lance Taylor <iant@google.com>
7439 * options.h (class General_options): Add --warn_constructors.
7441 2009-11-03 Ian Lance Taylor <iant@google.com>
7444 * defstd.cc (in_section): Add entries for __rel_iplt_start,
7445 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
7447 2009-11-03 Ian Lance Taylor <iant@google.com>
7450 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
7451 --msgid-bugs-address.
7452 (install-pdf): New target.
7453 (install-data_yes): Look up one directory to find mkinstalldirs.
7455 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
7457 * po/Make-in (.po.gmo): Don't generate .gmo files in source
7460 2009-10-30 Doug Kwan <dougkwan@google.com>
7462 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
7464 2009-10-30 Doug Kwan <dougkwan@google.com>
7466 * arm.cc (Stub_addend_reader): New struct template definition
7467 and partial specializations.
7468 (Stub_addend_reader::operator()): New method definition for a
7469 partially specialized template.
7471 2009-10-30 Doug Kwan <dougkwan@google.com>
7473 * arm.cc (Arm_relobj::processor_specific_flags): New method
7475 (Arm_relobj::do_read_symbols): New method declaration.
7476 (Arm_relobj::processor_specific_flags_): New data member declaration.
7477 (Arm_dynobj): New class definition.
7478 (Target_arm::do_finalize_sections): Add input_objects parameter.
7479 (Target_arm::do_adjust_elf_header): New method declaration.
7480 (Target_arm::are_eabi_versions_compatible,
7481 (Target_arm::merge_processor_specific_flags): New method declaration.
7482 (Target_arm::do_make_elf_object): New overloaded method definitions
7484 (Arm_relobj::do_read_symbols): New method definition.
7485 (Arm_dynobj::do_read_symbols): Ditto.
7486 (Target_arm::do_finalize_sections): Add input_objects parameters.
7487 Merge processor-specific flags from all input objects.
7488 (Target_arm::are_eabi_versions_compatible,
7489 Target_arm::merge_processor_specific_flags,
7490 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
7491 New method definitions.
7492 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
7493 Input_objects pointer type parameter.
7494 * layout.cc (Layout::finalize): Pass input objects to target's.
7495 finalize_sections function.
7496 * output.cc (Output_file_header::do_sized_write): Set ELF file
7497 header's processor-specific flags.
7498 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
7499 Input_objects pointer type parameter.
7500 * sparc.cc (Target_sparc::do_finalize_sections): Same.
7501 * target.h (Input_objects): New forward class declaration.
7502 (Target::processor_specific_flags,
7503 Target::are_processor_specific_flags_sect): New method definitions.
7504 (Target::finalize_sections): Add input_objects parameter.
7505 (Target::Target): Initialize processor_specific_flags_ and
7506 are_processor_specific_flags_set_.
7507 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
7509 (Target::set_processor_specific_flags): New method definition.
7510 (Target::processor_specific_flags_,
7511 Target::are_processor_specific_flags_set_): New data member
7513 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
7514 Input_objects pointer type parameter.
7516 2009-10-30 Doug Kwan <dougkwan@google.com>
7518 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
7520 2009-10-28 Ian Lance Taylor <iant@google.com>
7522 * object.h (class Relobj): Drop options parameter from
7523 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
7524 do_scan_relocs, do_relocate. Change all callers.
7525 (class Sized_relobj): Drop options parameters from
7526 do_gc_process_relocs, do_scan_relocs, do_relocate,
7527 do_relocate_sections, relocate_sections, emit_relocs_scan,
7528 emit_relocs_scan_reltype. Change all callers.
7529 (struct Relocate_info): Remove options field and all references to
7531 * reloc.h (class Read_relocs): Remove options constructor
7532 parameter and options_ field. Change all callers.
7533 (class Gc_process_relocs, class Scan_relocs): Likewise.
7534 (class Relocate_task): Likewise.
7535 * target-reloc.h (scan_relocs): Remove options parameter. Change
7537 (scan_relocatable_relocs): Likewise.
7538 * target.h (class Sized_target): Remove options parameter from
7539 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
7541 * gc.h (gc_process_relocs): Remove options parameter. Change all
7543 * arm.cc: Update functions to remove options parameters.
7544 * i386.cc: Likewise.
7545 * powerpc.cc: Likewise.
7546 * sparc.cc: Likewise.
7547 * x86_64.cc: Likewise.
7548 * testsuite/testfile.cc: Likewise.
7550 2009-10-28 Doug Kwan <dougkwan@google.com>
7552 * arm.cc (Arm_relobj): New class definition.
7553 (Arm_relobj::scan_sections_for_stubs,
7554 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
7555 New method definitions.
7557 2009-10-28 Cary Coutant <ccoutant@google.com>
7559 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
7560 (Plugin::cleanup_done_): New member.
7561 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
7562 (Plugin_manager::cleanup_done_): Remove.
7563 (Plugin_manager::add_input_file): Edit error message.
7564 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
7565 (Plugin_manager::cleanup): Remove use of cleanup_done_.
7567 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
7569 * fileread.cc: (File_read::View::~View): Use the new
7570 data_ownership_ filed.
7571 (File_read::~File_read): Dispose the new whole_file_view_.
7572 (File_read::open): Mmap the whole file if needed.
7573 (File_read::open): Use whole_file_view_ instead of contents_.
7574 (File_read::find_view): Use whole_file_view_ if applicable.
7575 (File_read::do_read): Use whole_file_view_ instead of contents_.
7576 (File_read::make_view): Use whole_file_view_ instead of contents_,
7577 update File_read::View::View call.
7578 (File_read::find_or_make_view): Update File_read::View::View
7580 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
7582 (File_read::View::Data_ownership): New enum.
7583 (File_read::View::View): Replace bool mapped_ with Data_ownership
7585 (File_read::View::mapped_): Remove (replaced by data_ownership_).
7586 (File_read::View::data_ownership_): New field.
7587 (File_read::contents_): Remove (replaced by whole_file_view_).
7588 (File_read::whole_file_view_): New field.
7589 * options.h (class General_options): Add --keep-files-mapped.
7591 2009-10-27 Cary Coutant <ccoutant@google.com>
7593 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
7594 * testsuite/Makefile.am (plugin_test_5): New test case.
7595 * testsuite/Makefile.in: Regenerate.
7597 2009-10-25 Doug Kwan <dougkwan@google.com>
7599 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
7600 from private to protected to allow access by child class.
7601 (Sized_relobj::do_relocate_sections): New method declaration.
7602 (Sized_relobj::relocate_sections): Virtualize.
7603 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
7604 Sized_relobj::relocate_sections. Instantiate template explicitly
7605 for different target sizes and endianity.
7607 2009-10-24 Doug Kwan <dougkwan@google.com>
7609 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
7610 (Arm_input_section::as_arm_input_section): New method.
7611 (Arm_output_section): New class definition.
7612 (Arm_output_section::create_stub_group,
7613 Arm_output_section::group_sections): New method definitions.
7615 2009-10-22 Doug Kwan <dougkwan@google.com>
7617 * arm.cc (Arm_input_section): New class definition.
7618 (Arm_input_section::init, Arm_input_section:do_write,
7619 Arm_input_section::set_final_data_size,
7620 Arm_input_section::do_reset_address_and_file_offset): New method
7623 2009-10-21 Doug Kwan <dougkwan@google.com>
7625 * arm.cc (Stub_table, Arm_input_section): New forward class
7627 (Stub_table): New class defintion.
7628 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
7629 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
7630 New method definition.
7632 2009-10-21 Doug Kwan <dougkwan@google.com>
7634 * arm.cc: Update copyright comments.
7635 (Target_arm): New forward class template declaration.
7636 (Arm_address): New type.
7637 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
7638 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
7639 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
7641 (Insn_template): Same.
7642 (DEF_STUBS): New macro.
7643 (Stub_type): New enum type.
7644 (Stub_template): New class definition.
7647 (Stub_factory): Same.
7648 (Target_arm::Target_arm): Initialize may_use_blx_ and
7649 should_force_pic_veneer_.
7650 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
7651 Target_arm::should_force_pic_veneer,
7652 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
7653 Target_arm::using_thumb_only, Target_arm:;default_target): New
7655 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
7656 New data member declarations.
7657 (Insn_template::size, Insn_template::alignment): New method defintions.
7658 (Stub_template::Stub_template): New method definition.
7659 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
7660 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
7661 (Stub_factory::Stub_factory): New method definition.
7662 * gold.h (string_hash): New template.
7663 * output.h (Input_section_specifier::hash_value): Use
7665 (Input_section_specifier::string_hash): Remove.
7666 * stringpool.cc (Stringpool_template::string_hash): Use
7669 2009-10-20 Doug Kwan <dougkwan@google.com>
7671 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
7672 symbols of relaxed input sections.
7673 * output.h (Output_section::find_relaxed_input_section): Make
7676 2009-10-16 Doug Kwan <dougkwan@google.com>
7678 * dynobj.cc (Versions::Versions): Initialize version_script_.
7679 Only insert base version symbol definition for a shared object
7680 if version script defines any version versions.
7681 (Versions::define_base_version): New method definition.
7682 (Versions::add_def): Check that base version is not needed.
7683 (Versions::add_need): Define base version lazily.
7684 * dynobj.h (Versions::define_base_version): New method declaration.
7685 (Versions::needs_base_version_): New data member declaration.
7686 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
7687 (check_DATA): Add no_version_test.stdout.
7688 (libno_version_test.so, no_version_test.o no_version_test.stdout):
7690 * testsuite/Makefile.in: Regenerate.
7691 * testsuite/no_version_test.c: New file.
7692 * testsuite/no_version_test.sh: Ditto.
7694 2009-10-16 Doug Kwan <dougkwan@google.com>
7696 * expression.cc (class Segment_start_expression): New class definition.
7697 (Segment_start_expression::value): New method definition.
7698 (script_exp_function_segment_start): Return a new
7699 Segment_start_expression.
7700 * gold/script-c.h (script_saw_segment_start_expression): New function
7702 * script-sections.cc (Script_sections::Script_sections): Initialize
7703 SAW_SEGMENT_START_EXPRESSION_ to false.
7704 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
7705 and -Tbbs options to specify section addresses if given in
7706 command line and no SEGMENT_START expression is seen in a script.
7707 * script-sections.h (Script_sections::saw_segment_start_expression,
7708 Script_sections::set_saw_segment_start_expression): New method
7710 (Script_sections::saw_segment_start_expression_): New data member
7712 * script.cc (script_saw_segment_start_expression): New function.
7713 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
7714 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
7715 script_test_7.sh and script_test_8.sh.
7716 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
7717 script_test_8.stdout.
7718 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
7719 (script_test_6, script_test_6.stdout, script_test_7,
7720 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
7721 * Makefile.in: Regenerate.
7722 * testsuite/script_test_6.sh: New file.
7723 * testsuite/script_test_6.t: Same.
7724 * testsuite/script_test_7.sh: Same.
7725 * testsuite/script_test_7.t: Same.
7726 * testsuite/script_test_8.sh: Same.
7728 2009-10-16 Doug Kwan <dougkwan@google.com>
7730 * output.cc (Output_segment::set_section_list_address): Cast
7731 expressions to unsigned long long type to avoid format warnings.
7733 2009-10-15 Ian Lance Taylor <iant@google.com>
7735 * script.cc (Script_options::add_symbol_assignment): Always add a
7736 dot assignment to script_sections_.
7737 * script-sections.cc (Script_sections::add_dot_assignment):
7738 Initialize if necessary.
7740 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
7741 program headers with no load segment if there is a linker script.
7743 * layout.cc (Layout::set_segment_offsets): Align the file offset
7744 to the segment aligment for -N or -n with no load segment.
7745 * output.cc (Output_segment::add_output_section): Don't crash if
7746 the first section is a TLS section.
7747 (Output_segment::set_section_list_addresses): Print an error
7748 message if the address moves backward in a linker script.
7749 * script-sections.cc
7750 (Output_section_element_input::set_section_addresses): Don't
7751 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
7752 (Orphan_output_section::set_section_addresses): Likewise.
7754 2009-10-15 Doug Kwan <dougkwan@google.com>
7756 * layout.cc (Layout::finish_dynamic_section): Generate tags
7757 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
7758 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
7759 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
7761 2009-10-14 Ian Lance Taylor <iant@google.com>
7763 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
7765 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
7766 data_shdr fields of relinfo.
7767 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
7768 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
7769 R_386_TLS_LDO_32, adjust based on section flags.
7770 (Target_i386::Relocate::fix_up_ldo): Remove.
7772 2009-10-13 Ian Lance Taylor <iant@google.com>
7774 Add support for -pie.
7775 * options.h (class General_options): Add -pie and
7777 (General_options::output_is_position_independent): Test -pie.
7778 (General_options::output_is_executable): Return true if not shared
7779 and not relocatable.
7780 (General_options::output_is_pie): Remove.
7781 * options.cc (General_options::finalize): Reject incompatible uses
7783 * gold.cc (queue_middle_tasks): A -pie link is not static.
7784 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
7785 * symtab.cc (Symbol::final_value_is_known): Return false if
7786 output_is_position_independent.
7787 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
7788 output_is_position_independent.
7789 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
7790 output_is_position_independent.
7791 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
7792 output_is_position_independent.
7793 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
7795 (basic_pie_test.o, basic_pie_test): New targets.
7796 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
7797 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
7798 (two_file_pie_test): New target.
7799 * testsuite/Makefile.in: Rebuild.
7800 * README: Remove note saying that -pie is not supported.
7802 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
7804 * options.h (class General_options): Add -init and -fini.
7805 * layout.cc (Layout::finish_dynamic_section): Emit
7806 given init and fini functions.
7808 2009-10-13 Sriraman Tallam <tmsriram@google.com>
7810 * gc.h (gc_process_relocs): Check if icf is enabled using new
7812 * gold.cc (queue_initial_tasks): Likewise.
7813 (queue_middle_tasks): Likewise.
7814 * object.cc (do_layout): Likewise.
7815 * symtab.cc (is_section_folded): Likewise.
7816 * main.cc (main): Likewise.
7817 * reloc.cc (Read_relocs::run): Likewise.
7818 (Sized_relobj::do_scan_relocs): Likewise.
7819 * icf.cc (is_function_ctor_or_dtor): New function.
7820 (Icf::find_identical_sections): Check if function is ctor or dtor when
7822 * options.h (General_options::icf): Change option to be an enum.
7823 (Icf_status): New enum.
7824 (icf_enabled): New method.
7825 (icf_safe_folding): New method.
7826 (set_icf_status): New method.
7827 (icf_status_): New variable.
7828 * (options.cc) (General_options::finalize): Set icf_status_.
7829 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
7830 icf_test and icf_keep_unique_test to use the --icf enum flag.
7831 * testsuite/icf_safe_test.sh: New file.
7832 * testsuite/icf_safe_test.cc: New file.
7834 2009-10-12 Sriraman Tallam <tmsriram@google.com>
7836 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
7837 includes to gc.h and icf.h.
7838 * arm.cc: Include gc.h.
7839 * gold.cc: Likewise.
7840 * i386.cc: Likewise.
7841 * powerpc.cc: Likewise.
7842 * sparc.cc: Likewise.
7843 * x86_64.cc: Likewise.
7844 * gc.h: Include icf.h.
7846 2009-10-11 Ian Lance Taylor <iant@google.com>
7848 * plugin.cc: Include "gold.h" before other header files.
7850 2009-10-10 Chris Demetriou <cgd@google.com>
7852 * options.h (Input_file_argument::Input_file_type): New enum.
7853 (Input_file_argument::is_lib_): Replace with...
7854 (Input_file_argument::type_): New member.
7855 (Input_file_argument::Input_file_argument): Take Input_file_type
7856 'type' rather than boolean 'is_lib' as second argument.
7857 (Input_file_argument::is_lib): Use type_.
7858 (Input_file_argument::is_searched_file): New function.
7859 (Input_file_argument::may_need_search): Handle is_searched_file.
7860 * options.cc (General_options::parse_library): Support -l:filename.
7861 (General_options::parse_just_symbols): Update for Input_file_argument
7863 (Command_line::process): Likewise.
7864 * archive.cc (Archive::get_file_and_offset): Likewise.
7865 * plugin.cc (Plugin_manager::release_input_file): Likewise.
7866 * script.cc (read_script_file, script_add_file): Likewise.
7867 * fileread.cc (Input_file::Input_file): Likewise.
7868 (Input_file::will_search_for): Handle is_searched_file.
7869 (Input_file::open): Likewise.
7870 * readsyms.cc (Read_symbols::get_name): Likewise.
7871 * testsuite/Makefile.am (searched_file_test): New test.
7872 * testsuite/Makefile.in: Regenerate.
7873 * testsuite/searched_file_test.cc: New file.
7874 * testsuite/searched_file_test_lib.cc: New file.
7876 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7877 Ian Lance Taylor <iant@google.com>
7879 * descriptor.cc: Include <cstdio> and "binary-io.h".
7880 (Descriptors::open): Open the files in binary mode always.
7881 * script.cc (Lex::get_token): Treat \r as whitespace.
7883 2009-10-09 Ian Lance Taylor <iant@google.com>
7885 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
7887 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7888 Ian Lance Taylor <iant@google.com>
7890 * configure.ac: Check for readv function also.
7891 * fileread.cc (readv): Define if not HAVE_READV.
7892 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
7894 * config.in: Regenerate.
7895 * configure: Regenerate.
7897 2009-10-09 Doug Kwan <dougkwan@google.com>
7899 * layout.cc (Layout::make_output_section): Call target hook to make
7900 ordinary output section.
7901 (Layout::finalize): Adjust parameter list of call the
7902 Target::may_relax().
7903 * layout.h (class Layout::section_list): New method.
7904 * merge.h (Output_merge_base::entsize): Change visibility to public.
7905 (Output_merge_base::is_string, Output_merge_base::do_is_string):
7907 (Output_merge_string::do_is_string): New method.
7908 * object.cc (Sized_relobj::do_setup): renamed from
7909 Sized_relobj::set_up.
7910 * object.h (Sized_relobj::adjust_shndx,
7911 Sized_relobj::initializ_input_to_output_maps,
7912 Sized_relobj::free_input_to_output_maps): Change visibilities to
7914 (Sized_relobj::setup): Virtualize.
7915 (Sized_relobj::do_setup): New method declaration.
7916 (Sized_relobj::invalidate_section_offset,
7917 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
7918 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
7919 * options.cc (parse_int): New function.
7920 * options.h (parse_int): New declaration.
7921 (DEFINE_int): New macro.
7922 (stub_group_size): New option.
7923 * output.cc (Output_section::Output_section): Initialize memebers
7924 merge_section_map_, merge_section_by_properties_map_,
7925 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
7926 (Output_section::add_input_section): Handled deferred code-fill
7927 generation and remove an old comment.
7928 (Output_section::add_relaxed_input_section): New method definition.
7929 (Output_section::add_merge_input_section): Use merge section by
7930 properties map to speed to search. Update merge section maps
7932 (Output_section::build_relaxation_map): New method definition.
7933 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7935 (Output_section::relax_input_section): Renamed to
7936 Output_section::convert_input_sections_to_relaxed_sections and change
7937 interface to take a vector of pointers to relaxed sections.
7938 (Output_section::find_merge_section,
7939 Output_section::find_relaxed_input_section): New method definitions.
7940 (Output_section::is_input_address_mapped,
7941 Output_section::output_offset, Output_section::output_address):
7942 Use output section data maps to speed up searching.
7943 (Output_section::find_starting_output_address): Add comments.
7944 (Output_section::do_write,
7945 Output_section::write_to_postprocessing_buffer): Do code-fill
7946 generation as appropriate.
7947 (Output_section::get_input_sections): Invalidate relaxed input section
7949 (Output_section::restore_states): Adjust type of checkpoint .
7950 Invalidate relaxed input section map.
7951 * output.h (Output_merge_base): New class declaration.
7952 (Input_section_specifier): New class defintion.
7953 (class Output_relaxed_input_section) Change base class to
7954 Output_section_data_build.
7955 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
7956 base class initializer.
7957 (Output_section::add_relaxed_input_section): New method declaration.
7958 (Output_section::Input_section): Change visibility to protected.
7959 (Output_section::Input_section::relobj,
7960 Output_section::Input_section::shndx): Handle relaxed input sections.
7961 Output_section::input_sections) Change visibility to protected. Also
7962 define overload to return a non-const pointer.
7963 (Output_section::Merge_section_properties): New class defintion.
7964 (Output_section::Merge_section_by_properties_map,
7965 Output_section::Output_section_data_by_input_section_map,
7966 Output_section::Relaxation_map): New types.
7967 (Output_section::relax_input_section): Rename method to
7968 Output_section::convert_input_sections_to_relaxed_sections and change
7969 interface to take a vector of relaxed section pointers.
7970 (Output_section::find_merge_section,
7971 Output_section::find_relaxed_input_section,
7972 Output_section::build_relaxation_map,
7973 Output_section::convert_input_sections_in_list_to_relaxed_sections):
7974 New method declarations.
7975 (Output_section::merge_section_map_
7976 Output_section::merge_section_by_properties_map_,
7977 Output_section::relaxed_input_section_map_,
7978 Output_section::is_relaxed_input_section_map_valid_,
7979 Output_section::generate_code_fills_at_write_): New data members.
7980 * script-sections.cc
7981 (Output_section_element_input::set_section_addresses): Call
7982 current_data_size and addralign methods of relaxed input sections.
7983 (Orphan_output_section::set_section_addresses): Call current_data_size
7984 and addralign methods of relaxed input sections.
7985 * symtab.cc (Symbol_table::compute_final_value): Extract template
7986 from the body of Symbol_table::sized_finalize_symbol.
7987 (Symbol_table::sized_finalized_symbol): Call
7988 Symbol_table::compute_final_value.
7989 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
7990 (Symbol_table::compute_final_value): New templated method declaration.
7991 * target.cc (Target::do_make_output_section): New method defintion.
7992 * target.h (Target::make_output_section): New method declaration.
7993 (Target::relax): Add more parameters for input objects, symbol table
7994 and layout. Adjust call to do_relax.
7995 (Target::do_make_output_section): New method declaration.
7996 (Target::do_relax): Add parameters for input objects, symbol table
7999 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8001 * pread.c: Include stdio.h.
8003 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8005 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
8008 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8010 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8011 Change read_shndx type to unsigned int.
8012 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8014 (Sized_dwarf_line_info::read_line_mappings): Likewise.
8015 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
8016 Change read_shndx type to unsigned int.
8017 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8019 (Sized_dwarf_line_info::read_line_mappings): Likewise.
8020 * layout.cc (Layout::create_symtab_sections): Cast the result of
8021 local_symcount * symsize to off_t in the gold_assert.
8023 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8025 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
8026 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
8028 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
8029 (Arm_relocate_functions::thm_abs5): New function.
8030 (Arm_relocate_functions::abs12): New function.
8031 (Arm_relocate_functions::abs16): New function.
8032 (Arm_relocate_functions::base_abs): New function.
8033 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
8034 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
8035 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
8037 (Scan::global): Likewise.
8038 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
8039 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
8040 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
8041 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
8044 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8046 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
8047 (Arm_relocate_functions::movt_prel): New function.
8048 (Arm_relocate_functions::thm_movw_prel_nc): New function.
8049 (Arm_relocate_functions::thm_movt_prel): New function.
8050 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8051 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8052 (Scan::global, Relocate::relocate): Likewise.
8053 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8055 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8057 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8058 Incremental_checker.
8059 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8061 (class Incremental_inputs_header): New class.
8062 (Incremental_inputs_header_writer): Edit comment.
8063 (Incremental_inputs_entry): New class.
8064 (Incremental_inputs_entry_writer): Edit comment.
8065 (Sized_incremental_binary::do_find_incremental_inputs_section):
8066 Add *strtab_shndx parameter, fill it.
8067 (Sized_incremental_binary::do_check_inputs): New method.
8068 (Incremental_checker::can_incrementally_link_output_file): Use
8069 Sized_incremental_binary::check_inputs.
8070 (Incremental_inputs::report_command_line): Save command line in
8073 (Incremental_binary::find_incremental_inputs_section): New
8075 (Incremental_binary::do_find_incremental_inputs_section): Add
8076 strtab_shndx parameter.
8077 (Incremental_binary::do_check_inputs): New pure virtual method.
8078 (Sized_incremental_binary::do_check_inputs): Declare.
8079 (Incremental_checker::Incremental_checker): Add incremental_inputs
8080 parameter, use it to initialize incremental_inputs_.
8081 (Incremental_checker::incremental_inputs_): New field.
8082 (Incremental_checker::command_line): New method.
8083 (Incremental_checker::inputs): New method.
8084 (Incremental_checker::command_line_): New field.
8086 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8088 * incremental.cc: Include <cstdarg> and "target-select.h".
8089 (vexplain_no_incremental): New function.
8090 (explain_no_incremental): New function.
8091 (Incremental_binary::error): New method.
8092 (Sized_incremental_binary::do_find_incremental_inputs_section): New
8094 (make_sized_incremental_binary): New function.
8095 (open_incremental_binary): New function.
8096 (can_incrementally_link_file): Add checks if output is ELF and has
8098 * incremental.h: Include "elfcpp_file.h" and "output.h".
8099 (Incremental_binary): New class.
8100 (Sized_incremental_binary): New class.
8101 (open_incremental_binary): Declare.
8102 * object.cc (is_elf_object): Use
8103 elfcpp::Elf_recognizer::is_elf_file.
8104 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
8105 * output.h (Output_file::filesize): New method.
8107 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8109 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
8111 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
8112 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
8114 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
8116 (Arm_relocate_functions::movw_abs_nc): New function.
8117 (Arm_relocate_functions::movt_abs): New function.
8118 (Arm_relocate_functions::thm_movw_abs_nc): New function.
8119 (Arm_relocate_functions::thm_movt_abs): New function.
8120 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
8121 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
8122 (Scan::global): Likewise.
8123 (Relocate::relocate): Likewise.
8124 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8126 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8128 * arm.cc (Arm_relocate_functions::got_prel) New function.
8129 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
8130 (Relocate::relocate): Likewise.
8131 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8133 2009-10-06 Ian Lance Taylor <iant@google.com>
8135 * options.h (class General_options): Define
8136 split_stack_adjust_size parameter.
8137 * object.h (class Object): Add uses_split_stack_ and
8138 has_no_split_stack_ fields. Add uses_split_stack and
8139 has_no_split_stack accessor functions. Declare
8140 handle_split_stack_section.
8141 (class Reloc_symbol_changes): Define.
8142 (class Sized_relobj): Define Function_offsets. Declare
8143 split_stack_adjust, split_stack_adjust_reltype, and
8145 * object.cc (Object::handle_split_stack_section): New function.
8146 (Sized_relobj::do_layout): Call handle_split_stack_section.
8147 * dynobj.cc (Sized_dynobj::do_layout): Call
8148 handle_split_stack_section.
8149 * reloc.cc (Sized_relobj::relocate_sections): Call
8150 split_stack_adjust for executable sections in split_stack
8151 objects. Pass reloc_map to relocate_section.
8152 (Sized_relobj::split_stack_adjust): New function.
8153 (Sized_relobj::split_stack_adjust_reltype): New function.
8154 (Sized_relobj::find_functions): New function.
8155 * target-reloc.h: Include "object.h".
8156 (relocate_section): Add reloc_symbol_changes parameter. Change
8158 * target.h (class Target): Add calls_non_split method. Declare
8159 do_calls_non_split virtual method. Declare match_view and
8161 * target.cc: Include "elfcpp.h".
8162 (Target::do_calls_non_split): New function.
8163 (Target::match_view): New function.
8164 (Target::set_view_to_nop): New function.
8165 * gold.cc (queue_middle_tasks): Give an error if mixing
8166 split-stack and non-split-stack objects with -r.
8167 * i386.cc (Target_i386::relocate_section): Add
8168 reloc_symbol_changes parameter.
8169 (Target_i386::do_calls_non_split): New function.
8170 * x86_64.cc (Target_x86_64::relocate_section): Add
8171 reloc_symbol_changes parameter.
8172 (Target_x86_64::do_calls_non_split): New function.
8173 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
8175 * powerpc.cc (Target_powerpc::relocate_section): Add
8176 reloc_symbol_changes parameter.
8177 * sparc.cc (Target_sparc::relocate_section): Add
8178 reloc_symbol_changes parameter.
8179 * configure.ac: Call AM_CONDITIONAL for the default target.
8180 * configure: Rebuild.
8181 * testsuite/Makefile.am (TEST_AS): New variable.
8182 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
8183 (check_DATA): Add split_i386 and split_x86_64 files.
8184 (SPLIT_DEFSYMS): Define.
8185 (split_i386_[1234n].o): New targets.
8186 (split_i386_[124]): New targets.
8187 (split_i386_[1234r].stdout): New targets.
8188 (split_x86_64_[1234n].o): New targets.
8189 (split_x86_64_[124]): New targets.
8190 (split_x86_64_[1234r].stdout): New targets.
8191 (MOSTLYCLEANFILES): Add new executables.
8192 * testsuite/split_i386.sh: New file.
8193 * testsuite/split_x86_64.sh: New file.
8194 * testsuite/split_i386_1.s: New file.
8195 * testsuite/split_i386_2.s: New file.
8196 * testsuite/split_i386_3.s: New file.
8197 * testsuite/split_i386_4.s: New file.
8198 * testsuite/split_i386_n.s: New file.
8199 * testsuite/split_x86_64_1.s: New file.
8200 * testsuite/split_x86_64_2.s: New file.
8201 * testsuite/split_x86_64_3.s: New file.
8202 * testsuite/split_x86_64_4.s: New file.
8203 * testsuite/split_x86_64_n.s: New file.
8204 * testsuite/testfile.cc (Target_test): Update relocation_section
8206 * testsuite/Makefile.in: Rebuild.
8208 2009-10-06 Ian Lance Taylor <iant@google.com>
8210 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
8211 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
8212 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
8213 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
8214 the address on ldo_addrs_.
8215 (Target_i386::Relocate::fix_up_ldo): New function.
8217 2009-10-06 Rafael Espindola <espindola@google.com>
8219 * plugin.cc (add_input_library): New.
8220 (Plugin::load): Add add_input_library to tv.
8221 (Plugin_manager::add_input_file): Add the is_lib argument.
8222 (add_input_file): Update call to Plugin_manager::add_input_file.
8223 (add_input_library): New.
8224 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
8226 2009-09-30 Doug Kwan <dougkwan@google.com>
8228 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
8229 symbol and call Symbol::may_need_copy_reloc to determine if
8230 a copy reloc is needed.
8231 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
8232 nocopyreloc is given in command line.
8233 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
8234 given in command line.
8235 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
8236 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
8237 of the removed Target_i386::may_need_copy_reloc.
8238 * options.h (copyreloc): New option with default value false.
8239 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8240 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
8241 instead of the removed Target_powerpc::may_need_copy_reloc.
8242 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8243 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
8244 instead of the removed Target_sparc::may_need_copy_reloc.
8245 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
8246 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
8247 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
8248 instead of the removed Target_x86_64::may_need_copy_reloc.
8250 2009-09-30 Ian Lance Taylor <iant@google.com>
8252 * object.h (class Object): Remove target_ field, and target,
8253 sized_target, and set_target methods.
8254 (Object::sized_target): Remove.
8255 (class Sized_relobj): Update declarations. Remove sized_target.
8256 * object.cc (Sized_relobj::setup): Remove target parameter.
8258 (Input_objects::add_object): Don't do anything with the target.
8259 (make_elf_sized_object): Add punconfigured parameter. Change all
8260 callers. Set or test parameter target.
8261 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
8263 * parameters.cc (Parameters::set_target): Change parameter type to
8265 (Parameters::default_target): Remove.
8266 (set_parameters_target): Change parameter type to be non-const.
8267 (parameters_force_valid_target): New function.
8268 (parameters_clear_target): New function.
8269 * parameters.h (class Parameters): Update declarations. Remove
8270 default_target method. Add sized_target and clear_target
8271 methods. Change target_ to be non-const.
8272 (set_parameters_target): Update declaration.
8273 (parameters_force_valid_target): Declare.
8274 (parameters_clear_target): Declare.
8275 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
8276 as NULL if we aren't searching.
8277 (Add_symbols::run): Don't check for compatible target.
8278 * fileread.cc (Input_file::open_binary): Call
8279 parameters_force_valid_target.
8280 * gold.cc (queue_middle_tasks): Likewise.
8281 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
8282 set_target on object.
8283 * dynobj.h (class Sized_dynobj): Update declarations.
8284 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
8285 make_elf_object returns NULL.
8286 (Archive::include_member): Don't check whether object target is
8288 * output.cc (Output_section::add_input_section): Get target from
8290 (Output_section::relax_input_section): Likewise.
8291 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
8293 (Sized_relobj::do_scan_relocs): Likewise.
8294 (Sized_relobj::relocate_sections): Likewise.
8295 * resolve.cc (Symbol_table::resolve): Likewise.
8296 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
8297 parameter. Change all callers.
8298 (Symbol_table::add_from_object): Get target from parameters.
8299 (Symbol_table::add_from_relobj): Don't check object target.
8300 (Symbol_table::add_from_dynobj): Likewise.
8301 (Symbol_table::define_special_symbol): Get target from
8303 * symtab.h (class Symbol_table): Update declaration.
8304 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
8305 parameter. Change all callers. Clear parameter target.
8306 (Binary_test): Test target here.
8307 * testsuite/object_unittest.cc (gold_testsuite): Remove
8308 target_test_pointer parameter. Change all callers.
8309 (Object_test): Test target here.
8311 2009-09-26 Ian Lance Taylor <iant@google.com>
8313 * testsuite/initpri1.c: Don't try to use constructor priorities if
8314 compiling with gcc before 4.3.
8316 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
8318 * testsuite/retain_symbols_file_test.sh (check_present): Change
8319 output file name to retain_symbols_file_test.stdout.
8320 (check_absent): Likewise.
8322 2009-09-18 Craig Silverstein <csilvers@google.com>
8324 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
8325 * options.cc: Include <cerrno> and <fstream>.
8326 (General_options::finalize): Parse -retain-symbols-file tag.
8327 * options.h: New flag.
8328 (General_options): New method should_retain_symbol, new
8329 variable symbols_to_retain.
8330 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
8331 should_retain_symbol map.
8332 * testsuite/Makefile.am (retain_symbols_file_test): New test.
8333 * testsuite/Makefile.in: Regenerate.
8334 * testsuite/retain_symbols_file_test.sh: New file.
8336 2009-09-18 Nick Clifton <nickc@redhat.com>
8338 * po/es.po: Updated Spanish translation.
8340 2009-09-17 Doug Kwan <dougkwan@google.com>
8342 * debug.h (DEBUG_RELAXATION): New constant.
8343 (DEBUG_ALL): Add DEBUG_RELAXATION.
8344 (debug_string_to_enum): Add relaxation debug option.
8346 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
8347 Layout::Relaxation_debug_check::read_sections,
8348 Layout::Relaxation_debug_check::read_sections): New method definitions.
8349 (Layout::Layout): Initialize data members
8350 record_output_section_data_from_scrips_,
8351 script_output_section_data_list_ and relaxation_debug_check_.
8352 (Layout::save_segments, Layout::restore_segments,
8353 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8354 Layout::relaxation_loop_body): New method definitions.
8355 (Layout::finalize): Support relaxation. Move section layout code to
8356 Layout::relaxation_loop_body.
8357 (Layout::set_asection_address_from_script): Move code for orphan
8358 section placement out.
8359 (Layout::place_orphan_sections_in_script): New method definition.
8360 * layout.h (Output_segment_headers, Output_file_header):
8361 New forward class declarations.
8362 (Layout::~Layout): Define.
8363 (Layout::new_output_section_data_from_script): New method definition.
8364 (Layout::place_orphan_sections_in_script): New method declaration.
8365 (Layout::Segment_states): New type declaration.
8366 (Layout::save_segments, Layout::restore_segments,
8367 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8368 Layout::relaxation_loop_body): New method declarations.
8369 (Layout::Output_section_data_list): New type declaration.
8370 (Layout::Relaxation_debug_check): New class definition.
8371 (Layout::record_output_section_data_from_script_,
8372 Layout::script_output_section_data_list_, Layout::segment_states_,
8373 Layout::relaxation_debug_check_): New data members.
8374 * output.cc: (Output_section_headers::do_size): New method definition.
8375 (Output_section_headers::Output_section_headers): Move size
8376 computation to Output_section_headers::do_size.
8377 (Output_segment_headers::do_size): New method definition.
8378 (Output_file_header::Output_file_header): Move size computation to
8379 Output_file_header::do_size and call it.
8380 (Output_file_header::do_size): New method definition.
8381 (Output_data_group::Output_data_group): Adjust call to
8382 Output_section_data.
8383 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
8384 (Output_symtab_xindex::do_write): Add array bound check.
8385 (Output_section::Input_section::print_to_mapfile): Handle
8386 RELAXED_INPUT_SECTION_CODE.
8387 (Output_section::Output_section): Initialize data member checkpoint_.
8388 (Output_section::~Output_section): Delete checkpoint object pointed
8390 (Output_section::add_input_section): Always add an Input_section if
8392 (Output_section::add_merge_input_section): Add assert.
8393 (Output_section::relax_input_section): New method definition.
8394 (Output_section::set_final_data_size): Set load address to zero for
8395 an unallocated section.
8396 (Output_section::do_address_and_file_offset_have_reset_values):
8397 New method definition.
8398 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
8399 Handle relaxed input section.
8400 (Output_section::sort_attached_input_sections): Checkpoint input
8401 section list lazily.
8402 (Output_section::get_input_sections): Change type of input_sections to
8403 list of Simple_input_section pointers. Checkpoint input section list
8404 lazily. Also handle relaxed input sections.
8405 (Output_section::add_input_section_for_script): Take a reference to
8406 a Simple_input_section object instead of Relobj pointer and section
8407 index as parameter. Handle relaxed input sections.
8408 (Output_section::save_states, Output_section::restore_states): New
8410 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
8411 (Output_data::is_data_size_fixed): New method definition.
8412 (Output_data::reset_addresss_and_file_offset): Do not reset data size
8414 (Output_data::address_and_file_offset_have_reset_values): New method
8416 (Output_data::do_address_and_file_offset_have_reset_values): New method
8418 (Output_data::set_data_size): Check that data size is not fixed.
8419 (Output_data::fix_data_size): New method definition.
8420 (Output_data::is_data_size_fixed_): New data member.
8421 (Output_section_headers::set_final_data_size): New method definition.
8422 (Output_section_headers::do_size): New method declaration.
8423 (Output_segment_headers::set_final_data_size): New method definition.
8424 (Output_segment_headers::do_size): New method declaration.
8425 (Output_file_header::set_final_data_size)::New method definition.
8426 (Output_file_header::do_size)::New method declaration.
8427 (Output_section_data::Output_section_data): Add new parameter
8428 is_data_size_fixed and use it to fix data size.
8429 (Output_data_const::Output_data_const): Adjust call to base class
8430 constructor and fix data size.
8431 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
8432 base class constructor and fix data size.
8433 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
8434 base class constructor and fix data size.
8435 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
8436 class constructor and fix data size.
8437 (Output_data_group::set_final_data_size): New method definition.
8438 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
8439 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
8440 class constructor and fix data size.
8441 (Output_relaxed_input_section): New class definition.
8442 (Output_section::Simple_input_section): New class definition.
8443 (Output_section::get_input_sections): Adjust parameter list.
8444 (Output_section::add_input_section_for_script): Same.
8445 (Output_section::save_states, Output_section::restore_states,
8446 Output_section::do_address_and_file_offset_have_reset_values,
8447 (Output_section::Input_section::Input_section): Handle
8448 RELAXED_INPUT_SECTION_CODE. Add new overload for
8449 Output_relaxed_input_section.
8450 (Output_section::Input_section::is_input_section,
8451 Output_section::Input_section::set_output_section): Handle relaxed
8453 (Output_section::Input_section::is_relaxed_input_section,
8454 Output_section::Input_section::output_section_data,
8455 Output_section::Input_section::relaxed_input_section): New method
8457 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
8459 (Output_section::Input_section::u1_): Update comments.
8460 (Output_section::Input_section::u2_): Add new union member poris.
8461 (Output_section::Checkpoint_output_section): New classs definition.
8462 (Output_section::relax_input_section): New method declaration.
8463 (Output_section::checkpoint_): New data member.
8464 (Output_segment): Update comments.
8465 (Output_segment::Output_segment): Un-privatize copy constructor.
8466 (Output_segment::operator=): Un-privatize.
8467 * script-sections.cc (Output_section_element::Input_section_list):
8468 Change element type to Output_section::Simple_input_section.
8469 (Output_section_element_dot_assignment::set_section_addresses):
8470 Register output section data for relaxation clean up.
8471 (Output_data_exression::Output_data_expression): Adjust call to base
8472 constructor to fix data size.
8473 (Output_section_element_data::set_section_addresses): Register
8474 Output_data_expression object for relaxation clean up.
8475 (struct Input_section_info): Replace Relobj pointer and section index
8476 pair with Output_section::Simple_input_section and Convert struct to a
8478 (Input_section_sorter::operator()): Adjust access to
8479 Input_section_info data member to use accessors.
8480 (Output_section_element_input::set_section_addresses): Use layout
8481 parameter. Adjust code to use Output_section::Simple_input_section
8482 and Input_secction_info classes. Register filler for relaxation
8484 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
8485 and section index pair with Output_section::Simple_input_section
8486 class. Adjust code accordingly.
8487 (Phdrs_element::release_segment): New method definition.
8488 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
8490 (Script_sections::release_segments): New method definition.
8491 * gold/script-sections.h (Script_sections::release_segments): New
8493 * gold/target.h (Target::may_relax, Target::relax,
8494 Target::do_may_relax, Target::do_relax): New method definitions.
8496 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8498 * arm.cc (has_signed_unsigned_overflow): New function.
8499 (Arm_relocate_functions::abs8): New function.
8500 (Target_arm::Scan::local): Handle R_ARM_ABS8.
8501 (Target_arm::Scan::global): Likewise.
8502 (Target_arm::relocate::relocate): Likewise.
8503 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8506 2009-09-16 Cary Coutant <ccoutant@google.com>
8508 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
8509 * testsuite/Makefile.in: Regenerate.
8511 2009-09-11 Nick Clifton <nickc@redhat.com>
8513 * po/gold.pot: Updated by the Translation project.
8515 2009-09-08 Cary Coutant <ccoutant@google.com>
8517 * output.cc (Output_file::open): Add execute permission to empty file.
8518 * testsuite/Makefile.am (permission_test): New test.
8519 * testsuite/Makefile.in: Regenerate.
8521 2009-09-02 Ian Lance Taylor <iant@google.com>
8523 * output.cc (Output_file::resize): Call map_no_anonymous rather
8526 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
8528 * gold.cc: Include "incremental.h".
8529 (queue_initial_tasks): Call Incremental_checker methods.
8530 * incremental.cc: Include "output.h".
8531 (Incremental_checker::can_incrementally_link_output_file): New
8533 * incremental.h (Incremental_checker): New class.
8535 * output.cc (Output_file::open_for_modification): New method.
8536 (Output_file::map_anonymous): Changed return type to bool. Record
8538 (Output_file::map_no_anonymous): New method, broken out of map.
8539 (Output_file::map): Use map_no_anonymous and map_anonymous.
8540 * output.h (class Output_file): Update declarations.
8542 2009-08-24 Cary Coutant <ccoutant@google.com>
8544 * options.h (Command_line::Pre_options): New class.
8545 (Command_line::pre_options): New member.
8546 * options.cc (gold::options::ready_to_register): New variable.
8547 (One_option::register_option): Do nothing if not registering options.
8548 Assert if same short option registered twice.
8549 (General_options::General_options): Turn off option registration when
8551 (Command_line::Pre_options::Pre_options): New constructor.
8553 2009-08-24 Cary Coutant <ccoutant@google.com>
8555 * options.h (General_options::no_keep_memory): Remove incorrect
8558 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8560 * Makefile.am (am__skiplex, am__skipyacc): New.
8561 * Makefile.in: Regenerate.
8563 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8565 * Makefile.am (AM_CPPFLAGS): Renamed from ...
8566 (INCLUDES): ... this.
8567 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
8568 (AM_CPPFLAGS): Renamed from ...
8569 (INCLUDE): ... this.
8570 * Makefile.in, testsuite/Makefile.in: Regenerate.
8572 * Makefile.in: Regenerate.
8573 * aclocal.m4: Likewise.
8574 * config.in: Likewise.
8575 * configure: Likewise.
8576 * testsuite/Makefile.in: Likewise.
8578 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8579 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8580 * Makefile.in: Regenerate.
8581 * testsuite/Makefile.in: Regenerate.
8583 2009-08-19 Cary Coutant <ccoutant@google.com>
8585 * resolve.cc (Symbol_table::resolve): Don't complain about defined
8586 symbols in shared libraries overridden by hidden or internal symbols
8587 in the main program.
8589 2009-08-19 Chris Demetriou <cgd@google.com>
8591 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
8592 checking source file names in error messages.
8594 2009-08-18 Doug Kwan <dougkwan@google.com>
8596 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
8597 an elcpp::Ehdr as parameter. Adjust call to set_target.
8598 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
8599 an elfcpp::Ehdr as parameter.
8600 * object.cc (Object::set_target): Remove the version that looks up
8601 a target and sets it.
8602 (Sized_relobj::setup): Take a Target object instead of
8603 an elfcpp::Ehdr as parameter. Adjust call to set_target.
8604 (make_elf_sized_object): Find target and ask target to
8606 * object.h: (Object::set_target): Remove the version that looks up
8607 a target and sets it.
8608 (Sized_relobj::setup): Take a Target object instead of
8609 an elfcpp:Ehdr as parameter.
8610 * target.cc: Include dynobj.h.
8611 (Target::do_make_elf_object_implementation): New.
8612 (Target::do_make_elf_object): New.
8613 * target.h (Target::make_elf_object): New template declaration.
8614 (Target::do_make_elf_object): New method declarations.
8615 (Target::do_make_elf_object_implementation): New template declaration.
8617 2009-08-14 Ian Lance Taylor <iant@google.com>
8619 * gold.h (FUNCTION_NAME): Define.
8620 (gold_unreachable): Use FUNCTION_NAME.
8622 2009-08-12 Sriraman Tallam <tmsriram@google.com>
8624 * icf.cc (Icf::find_identical_sections): Issue a warning when a
8625 symbol in the --keep-unique list is not found.
8627 2009-08-12 Sriraman Tallam <tmsriram@google.com>
8629 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
8630 been maked as --keep-unique.
8631 (Icf::unfold_section): New function.
8632 * icf.h (Icf::unfold_section): New function.
8633 * options.h (General_options::keep_unique): New option.
8634 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
8635 * testsuite/Makefile.in: Regenerate.
8636 * testsuite/icf_keep_unique_test.sh: New file.
8637 * testsuite/icf_keep_unique_test.cc: New file.
8639 2009-08-12 Cary Coutant <ccoutant@google.com>
8642 * resolve.cc (Symbol_table::resolve): Check for references from
8643 dynamic objects to hidden and internal symbols.
8644 * testsuite/Makefile.am (hidden_test.sh): New test.
8645 * testsuite/Makefile.in: Regenerate.
8646 * testsuite/hidden_test.sh: New script.
8647 * testsuite/hidden_test_1.c: New test source.
8648 * testsuite/hidden_test_main.c: New test source.
8650 2009-08-11 Doug Kwan <dougkwan@google.com>
8652 * arm.cc: Update comments.
8653 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
8654 segment to locate the .ARM.exidx section if present.
8656 2009-08-09 Doug Kwan <dougkwan@google.com>
8658 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
8661 2009-08-07 Sriraman Tallam <tmsriram@google.com>
8662 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
8665 2009-08-06 Sriraman Tallam <tmsriram@google.com>
8667 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
8668 valid tls_segment only for non-debug-section relocations.
8669 * testsuite/Makefile.am: Add gc_tls_test.
8670 * testsuite/Makefile.in: Regenerate.
8671 * testsuite/gc_tls_test.cc: New file.
8672 * testsuite/gc_tls_test.sh: New file.
8674 2009-08-05 Sriraman Tallam <tmsriram@google.com>
8678 * Makefile.am (CCFILES): Add icf.cc.
8680 * Makefile.in: Regenerate.
8681 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
8682 * gc.h (gc_process_relocs): Populate lists used by icf to contain
8683 section, symbol and addend information for the relocs.
8684 * gold.cc (queue_middle_tasks): Call identical code folding.
8685 * gold.h: Add defines for multimap.
8686 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
8687 to the call of finalize_local_symbols.
8688 * main.cc (main): Create object of class Icf.
8689 * object.cc (Sized_relobj::do_layout): Allow this function to be
8690 called twice during icf.
8691 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
8692 to sections marked as identical by icf.
8693 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
8695 (Sized_relobj::do_section_entsize): New function.
8696 * object.h (Object::section_entsize): New function.
8697 (Object::do_section_entsize): New pure virtual function.
8698 (Relobj::finalize_local_symbols): Add new parameter.
8699 (Relobj::do_section_entsize): New function.
8700 * options.h (General_options::icf): New option.
8701 (General_options::icf_iterations): New option.
8702 (General_options::print_icf_sections): New option.
8703 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
8704 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
8705 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
8707 * symtab.cc (Symbol_table::is_section_folded): New function.
8708 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
8709 to sections marked as identical by icf.
8710 * symtab.h (Symbol_table::set_icf): New function.
8711 (Symbol_table::icf): New function.
8712 (Symbol_table::is_section_folded): New function.
8713 (Symbol_table::icf_): New data member.
8714 * target-reloc.h (relocate_section): Ignore sections folded by icf.
8715 * testsuite/Makefile.am: Add commands to build icf_test.
8716 * testsuite/Makefile.in: Regenerate.
8717 * testsuite/icf_test.sh: New file.
8718 * testsuite/icf_test.cc: New file.
8720 2009-07-24 Chris Demetriou <cgd@google.com>
8722 * layout.cc (is_compressible_debug_section): Fix incorrect
8723 comment about compressed section names.
8725 2009-07-20 Ian Lance Taylor <ian@airs.com>
8728 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
8730 2009-07-16 Ian Lance Taylor <iant@google.com>
8733 * layout.h: #include <map>.
8734 (class Kept_section): Change from struct to class. Add accessors
8735 and setters. Add section size to Comdat_group mapping. Change
8736 Comdat_group to std::map. Add is_comdat_ field. Add
8737 linkonce_size field in union.
8738 (class Layout): Update declaration of find_or_add_kept_section.
8739 Don't declare find_kept_object.
8740 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
8741 parameter. Add object, shndx, is_comdat, and is_group_name
8742 parameters. Change all callers. Adjust for new Kept_section.
8743 (Layout::find_kept_object): Remove.
8744 * object.cc (Sized_relobj::include_section_group): Update use of
8745 Kept_section. Rename secnum to shndx. Only record
8746 Kept_comdat_section if sections are the same size.
8747 (Sized_relobj::include_linkonce_section): Update use of
8748 Kept_section. Only record Kept_comdat_section if sections are the
8749 same size. Set size of linkonce section.
8750 (Sized_relobj::map_to_kept_section): Update call to
8751 get_kept_comdat_section.
8752 * object.h (class Sized_relobj): Rename fields in
8753 Kept_comdat_section to drop trailing underscores; change object
8754 field to Relobj*. Change Kept_comdat_section_table to store
8755 struct rather than pointer.
8756 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
8757 Add kept_object and kept_shndx parameters. Change all callers.
8758 (Sized_relobj::get_kept_comdat_section): Change return type to
8759 bool. Add kept_object and kept_shndx parameters. Change all
8761 * plugin.cc (Pluginobj::include_comdat_group): Update call to
8762 Layout::find_or_add_kept_section.
8764 2009-07-09 Ian Lance Taylor <iant@google.com>
8766 * merge.cc (Object_merge_map::initialize_input_to_output_map):
8767 Reserve space in the hash table.
8769 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
8771 * fileread.cc (File_read::get_mtime): New method.
8772 * fileread.h (Timespec): New structure.
8773 (File_read::get_mtime): New method.
8774 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
8775 Renamed from timestamp_nsec.
8776 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
8778 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
8780 (Incremental_inputs::report_archive): Save mtime; style fix.
8781 (Incremental_inputs::report_obejct): Save mtime; style fix.
8782 (Incremental_inputs::report_script): Save mtime; style fix.
8783 (Incremental_inputs::finalize_inputs): Style fix.
8784 (Incremental_inputs::finalize): Style fix.
8785 (Incremental_inputs::create_input_section_data): Store inputs
8787 * incremental.h (Incremental_inputs::report_script): Add mtime
8789 (Incremental_inputs::Input_info::Input_info): Intialize only one
8791 (Incremental_inputs::Input_info::archive): Move to nameless
8793 (Incremental_inputs::Input_info::obejct): Move to nameless union.
8794 (Incremental_inputs::Input_info::script): Move to nameless union.
8795 (Incremental_inputs::mtime): New field.
8796 * script.cc (read_input_script): Pass file mtime to
8798 * script.h (Script_info::inputs): Style fix.
8800 2009-07-01 Ian Lance Taylor <ian@airs.com>
8802 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
8805 2009-06-24 Ian Lance Taylor <iant@google.com>
8808 * layout.cc (Layout::choose_output_section): If we find an
8809 existing section, update the flags.
8810 (Layout::create_notes): New function, broken out of
8812 (Layout::finalize): Don't create note sections.
8813 (Layout::create_note): Don't crash if linker script discards
8815 (Layout::create_gold_note): Likewise.
8816 (Layout::create_build_id): Likewise. Don't set
8817 after_input_sections on the section.
8818 (Layout::create_executable_stack_info): Remove target parameter.
8820 * layout.h (class Layout): Declare create_notes. Update
8821 declaration of create_executable_stack_info.
8822 * gold.cc (queue_middle_tasks): Call create_notes.
8823 * output.cc (Output_section::update_flags_for_input_section): Move
8824 here from output.h. If SHF_ALLOC flag is newly set, mark address
8826 * output.h (Output_data::mark_address_invalid): New function.
8827 (class Output_section): Only declare, not define,
8828 update_flags_for_input_section. Remove set_flags.
8830 2009-06-24 Ian Lance Taylor <iant@google.com>
8832 * script-sections.cc (Output_section_definition::
8833 set_section_addresses): Rename shadowing local load_address to
8836 2009-06-24 Ian Lance Taylor <iant@google.com>
8839 * reloc.cc (relocate_sections): Skip empty relocation sections.
8841 2009-06-23 Ian Lance Taylor <iant@google.com>
8844 * layout.cc (Layout::create_note): Use choose_output_section
8845 rather than make_output_section.
8847 2009-06-23 Ian Lance Taylor <iant@google.com>
8850 * options.cc (General_options::parse_V): Set printed_version_.
8851 (General_options::General_options): Initialize printed_version_.
8852 * options.h (class General_options): Add printed_version_ field.
8853 * gold.cc (queue_initial_tasks): If there are no input files,
8854 don't give a fatal error if we printed the version information.
8855 (queue_middle_tasks): If using -r with a shared object, give a
8856 fatal error rather than an ordinary error.
8858 2009-06-23 Ian Lance Taylor <iant@google.com>
8861 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
8862 (Layout::make_output_section): Set have_stabstr_section_ if we see
8863 a .stab*str section.
8864 (Layout::finalize): Call link_stabs_sections.
8865 (Layout::link_stabs_sections): New file.
8866 * layout.h (class Layout): Add have_stabstr_section_ field.
8867 Declare link_stabs_sections.
8869 2009-06-23 Doug Kwan <dougkwan@google.com>
8871 * Makefile.am (libgold_a_LIBADD): New.
8872 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
8873 * Makefile.in: Regenerate.
8874 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
8875 * configure: Regenerate.
8876 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
8877 * fileread.cc: Include sys/state.h
8878 * gold.h: Declare memmem and strndup if found missing.
8879 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
8881 2009-06-23 Ian Lance Taylor <iant@google.com>
8883 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
8884 * configure: Rebuild.
8886 2009-06-23 Ian Lance Taylor <iant@google.com>
8889 * object.cc (Object::section_contents): Don't try to get a view if
8890 the section has length zero.
8891 (Object::handle_gnu_warning_section): If the section is empty, use
8892 the name of the section as the warning.
8894 2009-06-23 Ian Lance Taylor <iant@google.com>
8897 * stringpool.h (class Stringpool_template): Add optimize_ field.
8898 (Stringpool_template::set_optimize): New function.
8899 * stringpool.cc (Stringpool_template::Stringpool_template):
8900 Initialize optimize_ field.
8901 (Stringpool_template::set_string_offsets): Test local optimize
8902 fild rather than parameter.
8903 * layout.cc (Layout::Layout): Call set_optimize on the section
8906 2009-06-22 Ian Lance Taylor <iant@google.com>
8909 * yyscript.y: Parse TARGET.
8910 * script.cc (script_set_target): New function.
8911 * script-c.h (script_set_target): Declare.
8912 * options.cc (General_options::string_to_object_format): Rename
8913 from string_to_object_format in anonymous namespace. Change
8915 * options.h (class General_options): Declare
8916 string_to_object_format.
8918 2009-06-22 Ian Lance Taylor <iant@google.com>
8920 * script-sections.cc (Script_sections::create_segments): Don't put
8921 program headers in a PT_LOAD segment if -n or -N.
8923 2009-06-22 Ian Lance Taylor <iant@google.com>
8926 * options.h (class General_options): Add -z lazy and -z now. Sort
8927 -z options into alphabetical order.
8928 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
8930 2009-06-21 Ian Lance Taylor <iant@google.com>
8932 * layout.cc (Layout::make_output_section): Call
8933 Target::new_output_section.
8934 (Layout::attach_allocated_section_to_segment): Put large section
8935 sections in a separate load segment with the large segment flag
8937 (Layout::segment_precedes): Sort large data segments after other
8939 (align_file_offset): New static function.
8940 (Layout::set_segment_offsets): Use align_file_offset.
8941 * output.h (class Output_section): Add is_small_section_ and
8942 is_large_section_ fields.
8943 (Output_section::is_small_section): New function.
8944 (Output_section::set_is_small_section): New function.
8945 (Output_section::is_large_section): New function.
8946 (Output_section::set_is_large_section): New function.
8947 (Output_section::is_large_data_section): New function.
8948 (class Output_segment): Add is_large_data_segment_ field.
8949 (Output_segment::is_large_data_segment): New function.
8950 (Output_segment::set_is_large_data_segment): New function.
8951 * output.cc (Output_section::Output_section): Initialize new
8953 (Output_segment::Output_segment): Likewise.
8954 (Output_segment::add_output_section): Add assertion that large
8955 data sections always go in large data segments. Force small data
8956 sections to the end of the list of data sections. Force small BSS
8957 sections to the start of the list of BSS sections. For large BSS
8958 sections to the end of the list of BSS sections.
8959 * symtab.h (class Symbol): Declare is_common_shndx.
8960 (Symbol::is_defined): Check Symbol::is_common_shndx.
8961 (Symbol::is_common): Likewise.
8962 (class Symbol_table): Define enum Commons_section_type. Update
8963 declarations. Add small_commons_ and large_commons_ fields.
8964 * symtab.cc (Symbol::is_common_shndx): New function.
8965 (Symbol_table::Symbol_table): Initialize new fields.
8966 (Symbol_table::add_from_object): Put small and large common
8967 symbols in the right list.
8968 (Symbol_table::sized_finalized_symbol): Check
8969 Symbol::is_common_shndx.
8970 (Symbol_table::sized_write_globals): Likewise.
8971 * common.cc (Symbol_table::do_allocate_commons): Allocate new
8972 common symbol lists. Don't call do_allocate_commons_list if the
8974 (Symbol_table::do_allocate_commons_list): Remove is_tls
8975 parameter. Add comons_section_type parameter. Change all
8976 callers. Handle small and large common symbols.
8977 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
8978 Symbol::is_common_shndx.
8979 * resolve.cc (symbol_to_bits): Likewise.
8980 * target.h (Target::small_common_shndx): New function.
8981 (Target::small_common_section_flags): New function.
8982 (Target::large_common_shndx): New function.
8983 (Target::large_common_section_flags): New function.
8984 (Target::new_output_section): New function.
8985 (Target::Target_info): Add small_common_shndx, large_common_shndx,
8986 small_common_section_flags, and large_common_section_flags
8988 (Target::do_new_output_section): New virtual function.
8989 * arm.cc (Target_arm::arm_info): Initialize new fields.
8990 * i386.cc (Target_i386::i386_info): Likewise.
8991 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
8993 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
8994 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
8995 (Target_x86_64::do_new_output_section): New function.
8996 * configure.ac: Define conditional MCMODEL_MEDIUM.
8997 * testsuite/Makefile.am (check_PROGRAMS): Add large.
8998 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
8999 (large_LDFLAGS): Define.
9000 * testsuite/large.c: New file.
9001 * testsuite/testfile.cc (Target_test::test_target_info):
9002 Initialize new fields.
9003 * configure, testsuite/Makefile.in: Rebuild.
9005 2009-06-05 Doug Kwan <dougkwan@google.com>
9007 * Makefile.am (CCFILES): Add target.cc.
9008 * Makefile.in: Regenerate.
9009 * i386.cc (class Target_i386): Define new virtual method to
9010 override do_is_local_label_name in parent.
9011 * object.cc (Sized_relobj::do_count_local_symbols): Discard
9012 local symbols if --discard-locals or -X is given.
9013 * options.h (class General_options): Declare new options
9014 '--discard-locals' and '-X' for discarding locals.
9015 * target.h (class Target): Define new methods is_local_label_name.
9016 Declare new virtual method do_is_local_label_name.
9017 * target.cc: New file.
9018 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
9019 (check_SCRIPTS): Add discard_locals_test.sh.
9020 (check_DATA): Add discard_local_tests.syms.
9021 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
9022 (discard_local_tests.syms, discard_locals_test.o): New make rules.
9023 * testsuite/Makefile.in: Regenerate.
9024 * testsuite/discard_locals_test.c: New file.
9025 * testsuite/discard_locals_test.sh: Same.
9027 2009-06-05 Doug Kwan <dougkwan@google.com>
9029 * object.cc (Sized_relobj::Sized_relobj): Initialize
9030 discarded_eh_frame_shndx_ to -1U.
9031 (Sized_relobj::do_layout): Record index of a discard .eh_frame
9033 (Sized_relobj::do_count_local_symbols): Skip local symbols in
9034 a discarded .eh_frame section.
9035 (Sized_relobj::do_finalize_local_symbols): Ditto.
9036 * object.h (class Sized_relobj): Declare new member
9037 discarded_eh_frame_shndx_.
9038 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
9039 (local_labels_test.o, local_labels_test): New rules.
9040 * testsuite/Makefile.in: Regenerate.
9042 2009-06-04 Doug Kwan <dougkwan@google.com>
9044 * layout.cc (Layout::section_name_mapping): Add mapping for
9045 special ARM sections.
9047 2009-06-03 Doug Kwan <dougkwan@google.com>
9049 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
9050 (utils::has_overflow): Same.
9052 2009-06-03 Ian Lance Taylor <iant@google.com>
9054 * layout.cc (Layout::section_name_mapping): New array, replacing
9055 Layout::linkonce_mapping.
9056 (Layout::section_name_mapping_count): New variable, replacing
9057 Layout::linkonce_mapping_count.
9058 (Layout::linkonce_output_name): Remove.
9059 (Layout::output_section_name): Rewrite.
9060 * layout.h (class Layout): Rename Linkonce_mapping to
9061 Section_name_mapping, linkonce_mapping to section_name_mapping,
9062 linkonce_mapping_count to section_name_mapping_count. Don't
9063 declare linkonce_output_name.
9065 2009-06-03 Doug Kwan <dougkwan@google.com>
9067 * gold/arm.cc (namespace utils): New.
9068 (Target_arm::reloc_is_non_pic): Define new method.
9069 (class Arm_relocate_functions): New.
9070 (Target_arm::Relocate::relocate): Handle relocation types used by
9073 2009-06-03 Ian Lance Taylor <iant@google.com>
9075 * arm.cc (Target_arm::scan::global): Use || instead of |.
9077 2009-06-02 Doug Kwan <dougkwan@google.com>
9079 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
9080 issued_non_pic_error_.
9081 (class Target_arm::Scan): Declare new method check_non_pic.
9082 Define new method symbol_needs_plt_entry.
9083 Declare new data member issued_non_pic_error_.
9084 (class Target_arm::Relocate): Declare new method
9085 should_apply_static_reloc.
9086 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9087 (Target_arm::Scan::check_non_pic): Define new method.
9088 (Target_arm::Scan::local): Handle a small subset of reloc types used
9090 (Target_arm::Scan::local): Same.
9091 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9093 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
9095 * incremental.cc (Incremental_inputs::report_command_line): Filter
9096 out --incremental-* options.
9098 2009-05-29 Doug Kwan <dougkwan@google.com>
9100 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9102 (class Target_arm): Update comment.
9103 (Target_arm::Target_arm): Initialize new data members GOT_,
9104 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
9105 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
9106 and Target_arm::rel_dyn_section.
9107 Declare new_enum Target_arm::Got_type.
9108 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
9110 Update commments for member do_dynsym_value.
9111 (Target_arm::got_size, Target_arm::plt_section,
9112 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
9113 new methods inside class defintion.
9114 (Target_arm::got_section): Define new method.
9115 (Target_arm::rel_dyn_section): Same.
9116 (Output_data_plt_arm): New template class.
9117 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
9118 (Output_data_plt_arm:do_adjust_output_section): Define new method.
9119 (Output_data_plt_arm::add_entry): Same.
9120 (Output_data_plt_arm::first_plt_entry): Define new
9121 static data member for PLT instruction template.
9122 (Output_data_plt_arm::plt_entry): Same.
9123 (Output_data_plt_arm::do_write): Define new method.
9124 (Target_arm::make_plt_entry): Same.
9125 (Target_arm::do_finalize_sections): Same.
9126 (Target_arm::do_dynsym_value): Same.
9128 2009-05-28 Doug Kwan <dougkwan@google.com>
9130 * Makefile.am (TARGETSOURCES): Add arm.cc.
9131 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
9132 * Makefile.in: Regenerate.
9134 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
9136 2009-05-26 Doug Kwan <dougkwan@google.com>
9138 * options.cc (General_options::parse_exclude_libs). Fix a comment.
9139 (General_options::check_excluded_libs): Strip off directories in
9140 archive name before matching like GNU ld does.
9141 * testsuite/Makefile.am (MOSTLYCLEANFILES,
9142 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
9143 (exclude_libs_test_LDFLAGS): Add linker option
9144 -Wl,--exclude-libs,libexclude_libs_test_3
9145 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
9146 an explicit archive without using -l.
9147 (alt/libexclude_libs_test_3.a): New make rule.
9148 * testsuite/Makefile.in: Regenerate.
9149 * testsuite/exclude_libs_test.c : Declare lib3_default().
9151 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
9152 * exclude_libs_test_3.c: New file.
9154 2009-05-26 Nick Clifton <nickc@redhat.com>
9156 * po/id.po: New Indonesian translation.
9157 * po/gold.pot: Updated template file.
9159 2009-05-22 Sriraman Tallam <tmsriram@google.com>
9161 * testsuite/Makefile.am: Add -ffunction-sections to compile
9162 gc_comdat_test files. Add -Wl,--gc-sections to build
9164 * testsuite/Makefile.in: Regenerate.
9165 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
9167 2009-05-21 Sriraman Tallam <tmsriram@google.com>
9169 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
9170 kept comdat section was garbage collected.
9171 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
9172 * testsuite/Makefile.in: Regenerate.
9173 * testsuite/gc_comdat_test.sh: New file.
9174 * testsuite/gc_comdat_test_1.cc: New file.
9175 * testsuite/gc_comdat_test_2.cc: New file.
9177 2009-05-19 Doug Kwan <dougkwan@google.com>
9179 * archive.cc (Archive::Archive): Move constructor from archive.h
9180 to here. Initialize no_export_.
9181 (Archive::get_elf_object_for_member): Set no_export flag of object.
9182 * archive.h (Archive::Archive): Move constructor body to
9184 (Archive::no_export): New method.
9185 (Archive::no_export_): New field.
9186 * object.h (Object::Object): Initialize no_export_ to false.
9187 (Object::no_export, Object::set_no_export): New methods.
9188 (Object::no_export_): New field.
9189 * options.cc (General_options::parse_exclude_libs): New method.
9190 (General_options::check_excluded_libs) Same.
9191 * options.h (exclude_libs): New option.
9192 (General_options::check_excluded_libs): New method declaration.
9193 (General_options::excluded_libs_): New field.
9194 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
9195 default or protected visibility if an object has no-export flag set.
9196 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
9197 (check_SCRIPTS): Add exclude_libs_test.sh.
9198 (check_DATA): Add exclude_libs_test.syms.
9199 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
9200 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
9201 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
9202 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
9203 (exclude_libs_test.syms, libexclude_libs_test_1.a,
9204 libexclude_libs_test_2.a): New rules.
9205 * testsuite/Makefile.in: Regenerate.
9206 * testsuite/exclude_libs_test.c: New file.
9207 * testsuite/exclude_libs_test.sh: Ditto.
9208 * testsuite/exclude_libs_test_1.c: Ditto.
9209 * testsuite/exclude_libs_test_2.c: Ditto.
9211 2009-05-15 Ian Lance Taylor <iant@google.com>
9213 * configure.ac: Check for declarations for cases where libiberty.h
9214 checks HAVE_DECL_xxx.
9215 * configure, config.in: Rebuild.
9217 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
9219 * gold.h (Incremental_argument_list): Remove (invalid) forward
9221 * incremental.cc (Incremental_inputs::report_achive): New method.
9222 (Incremental_inputs::report_object): New method.
9223 (Incremental_inputs::report_script): New method.
9224 (Incremental_inputs::finalize_inputs): New method.
9225 (Incremental_inputs::finalize): Call finalize_inputs().
9226 (Incremental_inputs::sized_create_incremental_inputs_section_data):
9227 Create inputs entries.
9228 * incremental.h (Incremental_input_type): New enum.
9229 (Incremental_inputs::Incremental_input): Initialize new fields.
9230 (Incremental_inputs::report_inputs): New method.
9231 (Incremental_inputs::report_achive): New method.
9232 (Incremental_inputs::report_object): New method.
9233 (Incremental_inputs::report_script): New method.
9234 (Incremental_inputs::finalize_inputs): New method.
9235 (Incremental_inputs::Input_info): New struct.
9236 (Incremental_inputs::Input_info_map): New typedef.
9237 (Incremental_inputs::lock_): New field.
9238 (Incremental_inputs::Inputs_): New field.
9239 (Incremental_inputs::Inputs_map): New field.
9240 * main.cc (main): Call Incremental_input::report_inputs.
9241 * options.h (Input_argument_list): Typedef moved from
9243 (Input_file_group::Files): Remove, use ::Input_argument_list.
9244 (Input_file_group::Input_argument_list): Remove, use
9245 ::Input_argument_list.
9246 * plugin.cc (Plugin_manager::add_input_file): Add error in
9248 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
9250 * script.cc (read_input_script): Call
9251 Incremental_input::report_script.
9252 * script.h (Script_info): New class.
9254 2009-04-27 Ian Lance Taylor <iant@google.com>
9256 * x86_64.cc (do_adjust_output_section): Set entsize to
9259 2009-04-23 Elliott Hughes <enh@google.com>
9261 * output.cc (Output_file::close): After short writes, continue
9262 writing from the correct offset in the buffer being written.
9264 2009-04-23 Chris Demetriou <cgd@google.com>
9266 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
9267 * configure: Regenerate.
9268 * config.in: Regenerate.
9269 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
9270 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
9272 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
9274 * incremental.cc (Incremental_inputs_header_data): Renamed from
9275 Incremental_input_header_data.
9276 (Incremental_inputs_header_data::data_size): New field.
9277 (Incremental_inputs_header_data::put_input_file_count): Renamed
9278 from input_file_count.
9279 (Incremental_inputs_header_data::put_command_line_offset): Renamed
9280 from command_line_offset.
9281 (Incremental_inputs_header_data::put_reserved): Renamed from
9283 (Incremental_inputs_entry_data): Renamed from
9284 Incremental_input_entry_data.
9285 (Incremental_inputs_entry_data::data_size): New field.
9286 (Incremental_inputs::report_command_line): New method.
9287 (Incremental_inputs::finalize): New method.
9288 (Incremental_inputs::create_incremental_inputs_data): New method.
9289 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
9290 * incremental.h: New file.
9291 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
9292 (Layout::finalize): Create incremental inputs section in
9294 (Layout::create_incremental_info_sections): New method.
9295 * layout.h (Layout::incremental_inputs): New method.
9296 (Layout::create_incremental_info_sections): New method.
9297 (Layout::incremental_inputs_): New field.
9298 * main.cc (main): Notify Incremental_input of the command line.
9300 2009-04-01 Ian Lance Taylor <iant@google.com>
9301 Mikolaj Zalewski <mikolajz@google.com>
9303 * gold.h (reserve_unordered_map): Define, three versions, one for
9304 each version of Unordered_map.
9305 * layout.cc (Layout::Layout): Remove options parameter. Add
9306 number_of_input_files parameter. Don't initialize options_.
9307 Initialize number_of_input_files_ and resized_signatures_. Move
9308 sections_are_attached_.
9309 (Layout::layout_group): Reserve space for group_signatures_.
9310 (Layout::find_or_add_kept_section): Change name parameter to be a
9311 reference. Resize signatures_ map when it gets large enough.
9312 (Layout::layout_eh_frame): Use parameters->options() instead of
9314 (Layout::make_output_section): Likewise.
9315 (Layout::attach_allocated_section_to_segment): Likewise.
9316 (Layout::finalize, Layout::create_executable_stack): Likewise.
9317 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
9318 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
9319 * layout.h (class Layout): Update declarations. Remove options_
9320 field. Add number_of_input_files_ and resized_signatures_
9321 fields. Move sections_are_attached_ field.
9322 * main.cc (main): Pass number of input files to Layout
9323 constructor. Don't pass options.
9325 2009-03-30 Ian Lance Taylor <iant@google.com>
9327 * ffsll.c (ffsll): Correct implementation.
9329 2009-03-27 Ian Lance Taylor <iant@google.com>
9331 * ffsll.c: New file.
9332 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
9333 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
9334 * ftruncate.c (ftruncate): Declare before definition.
9335 * mremap.c (mremap): Likewise.
9336 * pread.c (pread): Likewise.
9337 * configure, Makefile.in, config.in: Rebuild.
9339 * mremap.c: New file.
9340 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
9341 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
9342 (mremap): Declare if HAVE_MREMAP is not defined.
9343 * configure, Makefile.in, config.in: Rebuild.
9345 2009-03-27 Cary Coutant <ccoutant@google.com>
9347 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
9348 position independent.
9349 * sparc.cc (Target_sparc::check_non_pic): Likewise.
9350 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
9352 2009-03-24 Cary Coutant <ccoutant@google.com>
9354 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
9356 (needs_dynamic_reloc): Likewise.
9358 2009-03-24 Ian Lance Taylor <iant@google.com>
9360 * yyscript.y (file_cmd): Recognize EXTERN.
9361 (extern_name_list, extern_name_list_body): New nonterminals.
9362 * script.cc (script_add_extern): Define.
9363 * script-c.h (script_add_extern): Declare.
9365 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
9367 * object.cc (is_elf_object): Define.
9368 * object.h (is_elf_object): Declare.
9369 * archive.cc (Archive::get_elf_object_for_member): Call
9371 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
9373 2009-03-24 Elliott Hughes <enh@google.com>
9375 * output.cc (Output_file::map_anonymous): Define.
9376 (Output_file::map): Use map_anonymous. If the regular mmap fails,
9377 try an anonymous one. Report the size if the mmap fails.
9378 * output.h (class Output_file): Declare map_anonymous.
9380 2009-03-24 Ian Lance Taylor <iant@google.com>
9382 * target-select.cc (instantiate_target): Don't acquire the lock if
9383 the instantiated_target_ field has already been set.
9385 2009-03-23 Ian Lance Taylor <iant@google.com>
9387 * gold-threads.h (class Initialize_lock): Define.
9388 * gold-threads.cc (class Initialize_lock_once): Define.
9389 (initialize_lock_control): New static variable.
9390 (initialize_lock_pointer): New static variable.
9391 (initialize_lock_once): New static function.
9392 (Initialize_lock::Initialize_lock): Define.
9393 (Initialize_lock::initialize): Define.
9394 * target-select.h: Include "gold-threads.h".
9395 (class Target_selector): Add lock_ and initialize_lock_ fields.
9396 Don't define instantiate_target, just declare it.
9397 * target-select.cc (Target_selector::Target_selector): Initialize
9399 (Target_selector::instantiate_target): Define.
9400 * descriptors.h: Include "gold-threads.h".
9401 (class Descriptors): Add initialize_lock_ field.
9402 * descriptors.cc (Descriptors::Descriptors): Initialize new
9404 (Descriptors::open): Use initialize_lock_ field
9405 * errors.h (class Errors): Add initialize_lock_ field.
9406 * errors.cc (Errors::Errors): Initialize new field.
9407 (Errors::initialize_lock): Use initialize_lock_ field.
9408 * powerpc.cc (class Target_selector_powerpc): Remove
9409 instantiated_target_ field. In do_recognize call
9410 instantiate_target rather than do_instantiate_target. In
9411 do_instantiate_target just allocate a new target.
9412 * sparc.cc (class Target_selector_sparc): Likewise.
9414 * freebsd.h: New file.
9415 * i386.cc: Include "freebsd.h".
9416 (Target_i386): Derive from Target_freebsd rather than
9418 (Target_selector_i386): Derive from Target_selector_freebsd rather
9419 than Target_selector.
9420 * x86_64.cc: Include "freebsd.h".
9421 (Target_x86_64): Derive from Target_freebsd rather than
9423 (Target_selector_x86_64): Derive from Target_selector_freebsd
9424 rather than Target_selector.
9425 * target.h (class Target): Add adjust_elf_header and
9426 do_adjust_elf_header.
9427 * output.cc (Output_file_header:: do_sized_write): Call target
9428 adjust_elf_header routine.
9429 * configure.tgt: Set targ_osabi.
9430 * configure.ac: Define GOLD_DEFAULT_OSABI.
9431 * parameters.cc (Parameters::default_target): Pass
9432 GOLD_DEFAULT_OSABI to select_target.
9433 * target-select.h (class Target_selector): Make instantiate_target
9434 protected rather than private.
9435 * Makefile.am (HFILES): Add freebsd.h.
9436 * configure, Makefile.in, config.in: Rebuild.
9438 * merge.cc (do_add_input_section): Correct pend value. Change
9439 message about last entry not being null terminated from error to
9442 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
9444 * incremental.cc: New file.
9445 * Makefile.am (CCFILES): Add incremental.cc.
9446 * Makefile.in: Rebuild.
9448 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
9450 * layout.cc (Layout::output_section_name): Preserve names
9451 of '.note.' sections.
9453 2009-03-19 Ian Lance Taylor <iant@google.com>
9455 * descriptors.cc (Descriptors::open): Check that the options are
9456 valid before using them.
9458 2009-03-18 Ian Lance Taylor <iant@google.com>
9460 * script-sections.h: Include <list>.
9461 (class Script_sections): Change Sections_elements from std::vector
9462 to std::list. Typedef public Elements_iterator. Add
9463 orphan_section_placement_, data_segment_align_start_, and
9464 saw_data_segment_align_ fields. Remove data_segment_align_index_
9466 * script-sections.cc (class Orphan_section_placement): New class.
9467 (class Sections_element): Add virtual functions is_relro and
9468 orphan_section_init. Remove virtual function place_orphan_here.
9469 (class Output_section_definition): Add is_relro and
9470 orphan_section_init. Remove place_orphan_here.
9471 (class Orphan_output_section): Likewise.
9472 (Script_sections::Script_sections): Update for field changes.
9473 (Script_sections::data_segment_align): Set saw_data_segment_align_
9474 and data_segment_align_start_, not data_segment_align_index.
9475 (Script_sections::data_segment_relro_end): Check
9476 saw_data_segment_align_. Use data_segment_align_start_ rather
9477 than data_segment_align_index_.
9478 (Script_sections::place_orphan): Rewrite to use
9479 Orphan_section_placement.
9481 2009-03-17 Ian Lance Taylor <iant@google.com>
9483 * archive.cc (Archive::add_symbols): Check for a version attached
9484 to the symbol name in the archive map.
9485 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
9486 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
9487 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
9488 (ver_test_11.a): New target.
9489 * testsuite/Makefile.in: Rebuild.
9491 * configure.ac: Check for chsize and posix_fallocate. Replace
9493 * ftruncate.c: New file, from gnulib.
9494 * output.cc (posix_fallocate): Define dummy version if not
9495 HAVE_POSIX_FALLOCATE.
9496 (Output_file::map): Call posix_fallocate rather than lseek and
9498 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
9499 * configure, Makefile.in, config.in: Rebuild.
9501 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
9503 * layout.h (Layout::create_note): Add section_name parameter.
9504 * layout.cc (Layout::create_note): Likewise.
9505 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
9507 2009-03-17 Ian Lance Taylor <iant@google.com>
9509 * descriptors.cc: Include "options.h".
9510 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
9511 (Descriptors::open): Always use O_CLOEXEC when opening a new
9512 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
9513 then set FD_CLOEXEC.
9515 * sparc.cc (class Target_sparc): Add has_got_section.
9516 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
9517 make sure we have a GOT section.
9519 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
9520 (Target_sparc::Scan::local): Likewise.
9521 (Target_sparc::Scan::global): Likewise.
9522 (Target_sparc::Relocate::relocate): Likewise.
9523 (Target_sparc::Relocate::relocate_tls): Likewise.
9525 * symtab.cc (Symbol_table::define_default_version): New function,
9526 broken out of add_from_object.
9527 (Symbol_table::add_from_object): Call define_default_version.
9528 (Symbol_table::define_special_symbol): Add resolve_oldsym
9529 parameter. Change all callers. If the version for a symbol comes
9530 from a version script, resolve it with the symbol with the same
9531 name with no version. Also add the symbol without a version if
9533 (do_define_in_output_data): If resolving with oldsym, don't delete
9535 (do_define_in_output_segment): Likewise.
9536 (do_define_as_constant): Likewise.
9537 * symtab.h (class Symbol_table): Update declarations.
9539 2009-03-13 Ian Lance Taylor <iant@google.com>
9541 * readsyms.cc (Read_symbols::incompatible_warning): New function.
9542 (Read_symbols::requeue): New function.
9543 (Read_symbols::do_read_symbols): If make_elf_object fails because
9544 the target type is not configured, and the file was searched for,
9545 issue a warning and retry with the next directory.
9546 (Add_symbols::run): If the file has an incompatible format, and
9547 it was searched for, requeue the Read_symbols task. On error,
9549 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
9550 dirindex parameter to constructor. Change all callers. Declare
9551 incompatible_warning and requeue.
9552 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
9553 input_argument_ and input_group_ fields. Add them to
9554 constructor. Change all callers.
9555 (class Read_script): Add dirindex_ field. Add it to constructor.
9557 * archive.cc (Archive::setup): Remove input_objects parameter.
9559 (Archive::get_file_and_offset): Likewise.
9560 (Archive::read_all_symbols): Likewise.
9561 (Archive::read_symbols): Likewise.
9562 (Archive::get_elf_object_for_member): Remove input_objects
9563 parameter. Add punconfigured parameter. Change all callers.
9564 (Archive::add_symbols): Change return type to bool. Check return
9565 value of include_member.
9566 (Archive::include_all_members): Likewise.
9567 (Archive::include_member): Change return type to bool. Return
9568 false if first included object has incompatible target. Set
9569 included_member_ field.
9570 (Add_archive_symbols::run): If add_symbols returns false, requeue
9572 * archive.h (class Archive): Add included_member_ field.
9573 Initialize it in constructor. Add input_file and searched_for
9574 methods. Update declarations.
9575 (class Add_archive_symbols): Add dirpath_, dirindex_, and
9576 input_argument_ fields. Add them to constructor. Change all
9578 * script.cc: Include "target-select.h".
9579 (class Parser_closure): Add skip_on_incompatible_target_ and
9580 found_incompatible_target_ fields. Add
9581 skip_on_incompatible_target parameter to constructor. Change all
9582 callers. Add methods skip_on_incompatible_target,
9583 clear_skip_on_incompatible_target, found_incompatible_target, and
9584 set_found_incompatible_target.
9585 (read_input_script): Add dirindex parameter. Change all callers.
9586 If parser finds an incompatible target, requeue Read_symbols
9588 (script_set_symbol): Clear skip_on_incompatible_target in
9590 (script_add_assertion, script_parse_option): Likewise.
9591 (script_start_sections, script_add_phdr): Likewise.
9592 (script_check_output_format): New function.
9593 * script.h (read_input_script): Update declaration.
9594 * script-c.h (script_check_output_format): Declare.
9595 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
9596 (ignore_cmd): Remove OUTPUT_FORMAT.
9597 * fileread.cc (Input_file::Input_file): Add explicit this.
9598 (Input_file::will_search_for): New function.
9599 (Input_file::open): Add pindex parameter. Change all callers.
9600 * fileread.h (class Input_file): Add input_file_argument method.
9601 Declare will_search_for. Update declarations.
9602 * object.cc (make_elf_object): Add punconfigured parameter.
9604 * object.h (class Object): Make input_file public. Add
9605 searched_for method.
9606 (make_elf_object): Update declaration.
9607 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
9609 * dirsearch.h (class Dirsearch): Update declaration.
9610 * options.h (class General_options): Add --warn-search-mismatch.
9611 * parameters.cc (Parameters::is_compatible_target): New function.
9612 * parameters.h (class Parameters): Declare is_compatible_target.
9613 * workqueue.cc (Workqueue::add_blocker): New function.
9614 * workqueue.h (class Workqueue): Declare add_blocker.
9616 * fileread.cc (Input_file::open): Remove options parameter.
9618 (Input_file::open_binary): Likewise.
9619 * script.cc (read_input_script): Likewise.
9620 * readsyms.h (class Read_symbols): Remove options_ field. Remove
9621 options parameter from constructor. Change all callers.
9622 (class Read_script): Likewise.
9623 * fileread.h (class Input_file): Update declarations.
9624 * script.h (read_input_script): Update declaration.
9626 2009-03-10 Nick Clifton <nickc@redhat.com>
9628 * po/es.po: New Spanish translation.
9630 2009-03-06 Cary Coutant <ccoutant@google.com>
9632 * options.cc (parse_short_option): Keep dash_z from registering itself.
9634 2009-03-03 Ian Lance Taylor <iant@google.com>
9637 * target-reloc.h (relocate_section): Pass output_section to
9639 * i386.cc (Target_i386::should_apply_static_reloc): Add
9640 output_section parameter. Change all callers.
9641 (Target_i386::Relocate::relocate): Add output_section parameter.
9642 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9643 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
9644 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
9645 * testsuite/two_file_shared.sh: New script.
9646 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
9647 (check_DATA): Add two_file_shared.dbg.
9648 (two_file_shared.dbg): New target.
9649 * testsuite/Makefile.in: Rebuild.
9651 2009-03-01 Ian Lance Taylor <iant@google.com>
9653 * configure.ac: Check for byteswap.h.
9654 * configure: Rebuild.
9655 * config.in: Rebuild.
9657 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
9659 * layout.cc (Layout::find_or_add_kept_section): New function.
9660 (Layout::add_comdat): Removed.
9661 * layout.h (struct Kept_section): Move out of class Layout.
9662 Remove trailing underscores from field names. Add group_sections
9663 field. Rename group_ field to is_group. Change all uses.
9664 (class Layout): Declare find_or_add_kept_section, not add_comdat.
9665 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
9666 comdat_groups_ field.
9667 (Sized_relobj::include_section_group): Use
9668 find_or_add_kept_section and Kept_section::group_sections.
9669 (Sized_relobj::include_linkonce_section): Likewise.
9670 * object.cc (class Sized_relobj): Don't define Comdat_group or
9671 Comdat_group_table. Remove find_comdat_group and
9672 add_comdat_group. Remove comdat_groups_ field.
9673 * plugin.cc (include_comdat_group): Use
9674 Layout::find_or_add_kept_section.
9676 2009-02-28 Ian Lance Taylor <iant@google.com>
9678 * README: --gc-sections and map files are now supported. Document
9679 some build requirements.
9682 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
9683 relocatable link set the value of the section symbol to zero.
9684 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
9685 relocatable link don't include the section address in the local
9688 2009-02-27 Ian Lance Taylor <iant@google.com>
9691 * options.h (class Search_directory): Add is_system_directory.
9692 (class General_options): Declare is_in_system_directory.
9693 * options.cc (get_relative_sysroot): Make static.
9694 (get_default_sysroot): Make static.
9695 (General_optoins::is_in_system_directory): New function.
9696 * fileread.cc (Input_file::is_in_system_directory): New function.
9697 * fileread.h (class Input_file): Declare is_in_system_directory.
9698 * object.h (class Object): Add is_in_system_directory.
9699 (class Input_objects): Remove system_library_directory_ field.
9700 * object.cc (Input_objects::add_object): Don't set
9701 system_library_directory_.
9702 (input_objects::found_in_system_library_directory): Remove.
9703 * symtab.cc (Symbol_table::write_globals): Remove input_objects
9704 parameter. Change all callers.
9705 (Symbol_table::sized_write_globals): Likewise.
9706 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
9707 Call Object::is_in_system_directory.
9708 * symtab.h (class Symbol_table): Update declarations.
9711 * descriptors.h (Open_descriptor): Add is_on_stack field.
9712 * descriptors.cc (Descriptors::open): If the descriptor is on the
9713 top of the stack, remove it. Initialize is_on_stack field.
9714 (Descriptors::release): Only add pod to stack if it is not on the
9716 (Descriptors::close_some_descriptor): Clear stack_next and
9720 * output.cc (Output_section::find_starting_output_address): Rename
9721 from starting_output_address; add PADDR parameter; change return
9723 * output.h (class Output_section): Declare
9724 find_starting_output_address instead of starting_output_address.
9725 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
9726 section symbol for which we can't find a merge section.
9729 * symtab.cc (Symbol_table::add_from_object): If the visibility is
9730 hidden or internal, force the symbol to be local.
9731 * resolve.cc (Symbol::override_visibility): Define.
9732 (Symbol::override_base): Use override_visibility.
9733 (Symbol_table::resolve): Likewise.
9734 (Symbol::override_base_with_special): Likewise.
9735 (Symbol_table::override_with_special): If the visibility is hidden
9736 or internal, force the symbol to be local.
9737 * symtab.h (class Symbol): Add set_visibility and
9738 override_visibility.
9739 * testsuite/ver_test_1.sh: New file.
9740 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
9741 (check_DATA): Add ver_test_1.syms.
9742 (ver_test_1.syms): New target.
9743 * testsuite/Makefile.in: Rebuild.
9745 2009-02-25 Cary Coutant <ccoutant@google.com>
9747 * layout.cc (Layout::choose_output_section): Don't rename sections
9748 when using a linker script that has a SECTIONS clause.
9749 * Makefile.in: Regenerate.
9751 * testsuite/Makefile.am (script_test_5.sh): New test case.
9752 * testsuite/Makefile.in: Regenerate.
9753 * testsuite/script_test_5.cc: New file.
9754 * testsuite/script_test_5.sh: New file.
9755 * testsuite/script_test_5.t: New file.
9757 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
9759 * archive.cc (Archive::include_member): Update calls to add_symbols.
9760 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
9761 the Layout argument.
9762 * dynobj.h (do_add_symbols): Add the Layout argument.
9763 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
9765 * object.h (Object::add_symbols): Add the Layout argument.
9766 (Object::do_add_symbols): Add the Layout argument.
9767 (Sized_relobj::do_add_symbols): Add the Layout argument.
9768 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
9769 Unify the two versions.
9770 (Add_plugin_symbols): Remove.
9771 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
9772 (Sized_pluginobj::do_add_symbols): Unify the two versions.
9773 (Add_plugin_symbols): Remove.
9774 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
9775 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
9776 (Add_symbols::run): Make it work with Pulginobj.
9778 2009-02-06 Ian Lance Taylor <iant@google.com>
9780 * object.cc (Sized_relobj::do_layout): Make info message start
9781 with lower case letter.
9783 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
9785 * binary.cc: Fix file comment.
9787 * options.h (enum Incremental_disposition): Define.
9788 (class General_options): Add new options: --incremental,
9789 --incremental_changed, --incremental_unchanged,
9790 --incremental_unknown. Add incremental_disposition_ and
9791 implicit_incremental_ fields.
9792 (General_options::incremental_disposition): New function.
9793 (class Position_dependent_options): Add incremental_disposition
9795 (Position_dependent_options::copy_from_options): Set incremental
9797 * options.cc (General_options::parse_incremental_changed): New
9799 (General_options::parse_incremental_unchanged): New function.
9800 (General_options::parse_incremental_unknown): New function.
9801 (General_options::General_options): Initialize new fields
9802 incremental_disposition_ and implicit_incremental_.
9803 (General_options::finalize): Check for uasge of --incremental-*
9804 without --incremental.
9806 2009-02-06 Chris Demetriou <cgd@google.com>
9808 * gold.h (gold_undefined_symbol): Change to take only a Symbol
9809 pointer and to report location as the file name associated with
9811 (gold_undefined_symbol_at_location): New function to replace the
9812 old gold_undefined_symbol functionality.
9813 * target-reloc.h (relocate_section): Update to use
9814 gold_undefined_symbol_at_location.
9815 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9816 Call gold_undefined_symbol function rather than gold_error.
9817 * errors.h (Errors::undefined_symbol): Take location as a
9818 string, rather than calculating it from a relocation.
9819 * errors.cc (Errors::fatal): Print "fatal error:" before the
9821 (Errors::error, Errors::error_at_location): Print "error: "
9822 before the formatted message.
9823 (Errors::undefined_symbol): Take location as a string, rather
9824 than calculating it from a relocation.
9825 (gold_undefined_symbol_at_location): New function akin to
9826 old gold_undefined_symbol, calculates location from relocation.
9827 (gold_undefined_symbol): Change to take only a Symbol pointer
9828 and to report location as the file name associated with the symbol.
9829 * testsuite/debug_msg.sh: Update for changed error messages.
9830 * testsuite/undef_symbol.sh: Likewise.
9832 2009-02-04 Duncan Sands <baldrick@free.fr>
9835 * reduced_debug_output.h
9836 (Output_reduced_debug_abbrev_section::failed): Use format for
9838 (Output_reduced_debug_info_section::faild): Likewise.
9840 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
9842 * script.cc (Lazy_demangler): New class.
9843 (Version_script_info::get_symbol_version_helper): Demangle a
9846 2009-01-29 Cary Coutant <ccoutant@google.com>
9848 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
9850 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9852 2009-01-28 Ian Lance Taylor <iant@google.com>
9854 * version.cc (version_string): Bump to 1.9.
9856 * gold.h: Include <cstring> and <stdint.h>.
9857 * version.cc: Include <cstdio>.
9858 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
9860 * reduced_debug_output.cc (insert_into_vector): Rename from
9861 Insert_into_vector; change all callers. Use Swap_unaligned to
9862 avoid aliasing issue; remove union since it is unnecessary.
9864 2009-01-27 Sriraman Tallam <tmsriram@google.com>
9866 * Makefile.am (CCFILES): Add gc.cc.
9868 * Makefile.in: Regenerate.
9869 * gold.cc (Gc_runner): New class.
9870 (queue_initial_tasks): Call garbage collection related tasks
9871 when corresponding options are invoked.
9872 (queue_middle_gc_tasks): New function.
9873 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
9874 processed early before laying out sections during garbage collection.
9875 * gold.h (queue_middle_gc_tasks): New function.
9876 (is_prefix_of): Move from "layout.cc".
9877 * i386.cc (Target_i386::gc_process_relocs): New function.
9878 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
9879 * main.cc (main): Create object of class "Garbage_collection".
9880 * object.cc (Relobj::copy_symbols_data): New function.
9881 (Relobj::is_section_name_included): New function.
9882 (Sized_relobj::do_layout): Allow this function to be called twice
9883 during garbage collection and defer layout of section during the
9885 * object.h (Relobj::get_symbols_data): New function.
9886 (Relobj::is_section_name_included): New function.
9887 (Relobj::copy_symbols_data): New function.
9888 (Relobj::set_symbols_data): New function.
9889 (Relobj::get_relocs_data): New function.
9890 (Relobj::set_relocs_data): New function.
9891 (Relobj::is_output_section_offset_invalid): New pure virtual function.
9892 (Relobj::gc_process_relocs): New function.
9893 (Relobj::do_gc_process_relocs): New pure virtual function.
9894 (Relobj::sd_): New data member.
9895 (Sized_relobj::is_output_section_offset_invalid): New function.
9896 (Sized_relobj::do_gc_process_relocs): New function.
9897 * options.h (General_options::gc_sections): Modify to not be a no-op.
9898 (General_options::print_gc_sections): New option.
9899 * plugin.cc (Plugin_finish::run): Remove function call to
9900 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
9901 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
9902 * reloc.cc (Read_relocs::run): Add task to process relocs and
9903 determine unreferenced sections when doing garbage collection.
9904 (Gc_process_relocs): New class.
9905 (Sized_relobj::do_gc_process_relocs): New function.
9906 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
9907 sections that are garbage collected.
9908 * reloc.h (Gc_process_relocs): New class.
9909 * sparc.cc (Target_sparc::gc_process_relocs): New function.
9910 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
9911 symbols whose corresponding sections are garbage collected.
9912 (Symbol_table::Symbol_table): Add new parameter for the garbage
9914 (Symbol_table::gc_mark_undef_symbols): New function.
9915 (Symbol_table::gc_mark_symbol_for_shlib): New function.
9916 (Symbol_table::gc_mark_dyn_syms): New function.
9917 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
9919 (Symbol_table::add_from_object): Likewise.
9920 (Symbol_table::add_from_relobj): When building shared objects, do not
9921 treat externally visible symbols as garbage.
9922 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
9923 table information for static and relocatable links.
9924 * symtab.h (Symbol_table::set_gc): New function.
9925 (Symbol_table::gc): New function.
9926 (Symbol_table::gc_mark_undef_symbols): New function.
9927 (Symbol_table::gc_mark_symbol_for_shlib): New function.
9928 (Symbol_table::gc_mark_dyn_syms): New function.
9929 (Symbol_table::gc_): New data member.
9930 * target.h (Sized_target::gc_process_relocs): New pure virtual
9932 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
9933 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
9935 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
9937 * options.h (General_options::gc_sections): Define as a no-op for now.
9938 (General_options::no_keep_memory): Ditto.
9939 (General_options::Bshareable): Define.
9940 * options.cc (General_options::finalize): Honor -Bshareable.
9942 2009-01-20 Andreas Schwab <schwab@suse.de>
9944 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
9945 read the value in the contents, since we don't use it. Use the
9946 template endianness when writing.
9947 (Relocate::relocate): Use it for R_PPC_REL16_HA.
9949 2009-01-19 Andreas Schwab <schwab@suse.de>
9951 * configure.tgt (powerpc64-*): Fix targ_obj.
9953 2009-01-15 Ian Lance Taylor <iant@google.com>
9955 * object.cc (Sized_relobj::write_local_symbols): Don't write out
9956 local symbols when stripping all symbols.
9958 2009-01-14 Cary Coutant <ccoutant@google.com>
9960 * output.cc (Output_reloc): Add explicit instantiations.
9962 2009-01-14 Cary Coutant <ccoutant@google.com>
9964 * archive.cc (Archive::get_elf_object_for_member): Remove call
9965 to File_read::claim_for_plugin.
9966 * descriptors.cc (Descriptors::open): Remove reference to
9968 (Descriptors::claim_for_plugin): Remove.
9969 * descriptors.h (Descriptors::claim_for_plugin): Remove.
9970 (Descriptors::is_claimed): Remove.
9971 (claim_descriptor_for_plugin): Remove.
9972 * fileread.cc (File_read::claim_for_plugin): Remove.
9973 * fileread.h (File_read::claim_for_plugin): Remove.
9974 (File_read::descriptor): Reopen descriptor if necessary.
9975 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
9976 (Plugin_manager::all_symbols_read): Add task parameter. Change
9978 (Plugin_manager::get_input_file): New function.
9979 (Plugin_manager::release_input_file): New function.
9980 (Pluginobj::Pluginobj): Add filesize parameter and initialize
9981 corresponding data member.
9982 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
9983 and pass to base constructor. Change all callers.
9984 (get_input_file, release_input_file): New functions.
9985 (make_sized_plugin_object): Add filesize parameter. Change all callers.
9986 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
9987 (Plugin_manager::all_symbols_read): Add task parameter.
9988 (Plugin_manager::get_input_file): New function.
9989 (Plugin_manager::release_input_file): New function.
9990 (Plugin_manager::task_): New data member.
9991 (Pluginobj::Pluginobj): Add filesize parameter.
9992 (Pluginobj::filename): New function.
9993 (Pluginobj::descriptor): New function.
9994 (Pluginobj::filesize): New function.
9995 (Pluginobj::filesize_): New data member.
9996 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
9997 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
9998 File_read::claim_for_plugin; use Object::unlock to unlock the file.
10000 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
10001 with archive libraries.
10002 * testsuite/Makefile.in: Regenerate.
10003 * testsuite/plugin_test.c (struct sym_info): New type.
10004 (get_input_file, release_input_file): New static variables.
10005 (onload): Capture new transfer vector entries.
10006 (claim_file_hook): Stop reading at end of file according to filesize.
10007 Factor out parsing of readelf output into separate function.
10008 (all_symbols_read_hook): Exercise get_input_file and release_input_file
10009 APIs and get the source file name from the symbol table. Convert
10010 source file name to corresponding object file name. Print info
10011 message when adding new input files.
10012 (parse_readelf_line): New function.
10013 * testsuite/plugin_test_1.sh: Add checks for new info messages.
10014 * testsuite/plugin_test_2.sh: Likewise.
10015 * testsuite/plugin_test_3.sh: Likewise.
10016 * testsuite/plugin_test_4.sh: New test case.
10018 2009-01-07 Ian Lance Taylor <iant@google.com>
10020 * version.cc (version_string): Bump to 1.8.
10022 2008-12-23 Cary Coutant <ccoutant@google.com>
10024 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
10025 * plugin.cc (Plugin_manager::finish): Rename as
10026 layout_deferred_objects. Move cleanup to separate function.
10027 (Plugin_manager::cleanup): New function.
10028 (Plugin_finish::run): Call layout_deferred_objects and cleanup
10030 * plugin.h (Plugin_manager::finish): Rename as
10031 layout_deferred_objects.
10032 (Plugin_manager::cleanup): New function.
10033 (Plugin_manager::cleanup_done): New field.
10035 2008-12-23 Cary Coutant <ccoutant@google.com>
10037 * plugin.cc (is_visible_from_outside): New function.
10038 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
10039 so we don't return "IR only" status for exported symbols or -r links.
10041 * testsuite/Makefile.am (plugin_test_3): New test case.
10042 * testsuite/Makefile.in: Regenerate.
10043 * testsuite/plugin_test_3.sh: New file.
10045 2008-12-22 Cary Coutant <ccoutant@google.com>
10047 * object.cc (Sized_relobj::layout_section): New function.
10048 (Sized_relobj::do_layout): Defer layout of input sections until after
10049 plugin has provided replacement files.
10050 (Sized_relobj::do_layout_deferred_sections): New function.
10051 * object.h (Relobj::set_section_offset): Remove virtual keyword.
10052 (Relobj::layout_deferred_sections): New function.
10053 (Relobj::do_layout_deferred_sections): New function.
10054 (Sized_relobj::do_layout_deferred_sections): New function.
10055 (Sized_relobj::layout_section): New function.
10056 (Sized_relobj::Deferred_layout): New structure.
10057 (Sized_relobj::deferred_layout_): New field.
10058 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10059 Change all callers. Layout deferred sections.
10060 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
10062 (Plugin_hook::run): Move code from do_plugin_hook inline.
10063 (Plugin_hook::do_plugin_hook): Remove.
10064 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10065 (Plugin_manager::finish): Renamed, was cleanup.
10066 (Plugin_manager::should_defer_layout): New function.
10067 (Plugin_manager::add_deferred_layout_object): New function.
10068 (Plugin_manager::Deferred_layout_list): New type.
10069 (Plugin_manager::deferred_layout_objects_): New field.
10070 (Plugin_hook::do_plugin_hook): Remove.
10072 2008-12-17 Ian Lance Taylor <iant@google.com>
10074 * options.h (class General_options): Add --no case for
10077 2008-12-16 Cary Coutant <ccoutant@google.com>
10079 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
10081 (Plugin_manager::claim_file): Create plugin object even if
10082 plugin did not call the add_symbols callback.
10083 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10084 asking for more symbols than were added.
10085 * testsuite/Makefile.am (plugin_test_1): Add test case with
10087 (empty.syms): New target.
10088 * testsuite/Makefile.in: Regenerate.
10089 * testsuite/plugin_test.c (claim_file_hook): Add new debug
10090 message. Don't call add_symbols if no globals.
10091 (all_symbols_read_hook): Don't provide replacement for empty
10094 2008-12-12 Ian Lance Taylor <iant@google.com>
10096 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10097 r_type == 0 for a local symbol with r_sym == 0.
10098 (scan_relocatable_relocs): Pass r_sym to
10099 local_non_section_strategy.
10100 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10103 * configure.ac: Update test for TLS descriptors: they are
10104 supported as of glibc 2.9.
10105 * configure: Rebuild.
10107 2008-12-11 Ian Lance Taylor <iant@google.com>
10110 * target-reloc.h (Default_scan_relocatable_relocs): For each
10111 function, map r_type == 0 to RELOC_DISCARD.
10113 2008-12-10 Cary Coutant <ccoutant@google.com>
10115 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
10116 object to override a kept COMDAT group from a plugin object.
10118 2008-12-09 Ian Lance Taylor <iant@google.com>
10121 * yyscript.y (file_cmd): Handle INPUT.
10123 * testsuite/initpri1.c: Change all declarations to be full
10124 prototypes by adding void, to avoid compiler warnings.
10126 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
10128 * options.cc (General_options::parse_plugin_opt): New.
10129 (General_options::add_plugin): The argument now is just the filename.
10130 (General_options::add_plugin_option): New.
10131 * options.h (plugin_opt): New.
10132 (add_plugin): Change argument name.
10133 (add_plugin_option): New.
10134 * plugin.cc (Plugin::load): Don't parse the plugin option.
10135 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
10136 (Plugin::add_option): New.
10137 (Plugin::args_): Change type.
10138 (Plugin::filename_): New.
10139 (Plugin_manager::add_plugin_option): New.
10140 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
10141 * testsuite/Makefile.in: Regenerate.
10143 2008-12-05 Cary Coutant <ccoutant@google.com>
10145 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
10146 Handle --strip-lto-sections option.
10147 * options.h (strip_lto_sections): New option.
10149 2008-12-01 Cary Coutant <ccoutant@google.com>
10151 * plugin.cc (ld_plugin_message): Change format parameter to const.
10152 Fix mismatch between new[] and delete.
10154 2008-11-14 Cary Coutant <ccoutant@google.com>
10156 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
10159 2008-11-05 Craig Silverstein <csilvers@google.com>
10161 * options.cc (General_options::parse_dynamic_list): New function.
10162 * options.h (General_options): New flags dynamic_list,
10163 dynamic_list_data, dynamic_list_cpp_new, and
10164 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
10165 (General_options::in_dynamic_list): New function.
10166 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
10167 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
10168 (Lex::can_continue_name): Likewise.
10170 (read_script_file): New parameter script_options.
10171 (read_dynamic_list): New function.
10172 (Script_options::define_dynamic_list): New function.
10173 (dynamic_list_keyword_parsecodes): New variable.
10174 (dynamic_list_keywords): New variable.
10175 * script.h (Script_options::define_dynamic_list): New function
10177 (read_dynamic_list): New function prototype.
10178 * symtab.cc (strprefix): New macro.
10179 (Symbol::should_add_dynsym_entry): Support dynamic_list,
10180 dynamic_list_data, dynamic_list_cpp_new, and
10181 dynamic_list_cpp_typeinfo.
10182 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
10183 (dynamic_list_expr): New rule.
10184 (dynamic_list_nodes): Likewise.
10185 (dynamic_list_node): Likewise.
10186 * testsuite/Makefile.am (dynamic_list): New test.
10187 * testsuite/Makefile.in: Regenerated.
10188 * testsuite/dynamic_list.t: New file.
10189 * testsuite/dynamic_list.sh: New file.
10191 2008-11-05 Craig Silverstein <csilvers@google.com>
10193 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
10194 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
10195 (t11_last): Likewise.
10196 * testsuite/ver_test_6.c (main): Likewise.
10198 2008-10-07 Cary Coutant <ccoutant@google.com>
10200 * options.c (General_options::finalize): Add check for -static and
10202 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
10205 2008-10-02 Cary Coutant <ccoutant@google.com>
10207 * plugin.cc (make_sized_plugin_object): Fix conditional
10208 compilation to work when not all targets are enabled.
10210 2008-09-29 Cary Coutant <ccoutant@google.com>
10212 * archive.cc (Archive::get_file_and_offset): Use filename instead
10213 of name to get library path.
10214 (Archive::include_member): Unlock external member of a thin archive.
10216 * testsuite/Makefile.am (TEST_AR): New variable.
10217 (thin_archive_test_1): New test.
10218 (thin_archive_test_2): New test.
10219 * testsuite/Makefile.in: Regenerate.
10220 * testsuite/thin_archive_main.cc: New file.
10221 * testsuite/thin_archive_test_1.cc: New file.
10222 * testsuite/thin_archive_test_2.cc: New file.
10223 * testsuite/thin_archive_test_3.cc: New file.
10224 * testsuite/thin_archive_test_4.cc: New file.
10226 2008-09-29 Cary Coutant <ccoutant@google.com>
10228 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
10229 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
10231 (Sized_relobj::do_finalize_local_symbols): Likewise.
10232 (Sized_relobj::map_to_kept_section): Likewise.
10233 * object.h (Sized_relobj::invalid_address): New constant.
10234 (Sized_relobj::do_output_section_offset): Check for invalid_address
10236 * output.cc (Output_reloc::local_section_offset): Use constant
10237 invalid_address instead of -1U.
10238 (Output_reloc::get_address): Likewise.
10239 (Output_section::output_address): Change -1U to -1ULL.
10240 * output.h (Output_reloc::invalid_address): New constant.
10241 * reloc.cc (Sized_relobj::write_sections): Use constant
10242 invalid_address instead of -1U.
10243 (Sized_relobj::relocate_sections): Likewise.
10244 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
10245 values for merge sections.
10246 * target-reloc.h (relocate_for_relocatable): Use constant
10247 invalid_address instead of -1U.
10249 2008-09-19 Cary Coutant <ccoutant@google.com>
10251 Add plugin functionality for link-time optimization (LTO).
10252 * configure.ac (plugins): Add --enable-plugins option.
10253 * configure: Regenerate.
10254 * config.in: Regenerate.
10255 * Makefile.am (LIBDL): New variable.
10256 (CCFILES): Add plugin.cc.
10257 (HFILES): Add plugin.h.
10258 (ldadd_var): Add LIBDL.
10259 * Makefile.in: Regenerate.
10261 * archive.cc: Include "plugin.h".
10262 (Archive::setup): Don't preread archive symbols when using a plugin.
10263 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
10264 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
10266 (Archive::include_member): Add symbols from plugin objects.
10267 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
10268 * descriptors.cc (Descriptors::open): Check for file descriptors
10269 abandoned by plugins.
10270 (Descriptors::claim_for_plugin): New function.
10271 * descriptors.h (Descriptors::claim_for_plugin): New function.
10272 (Open_descriptor::is_claimed): New field.
10273 (claim_descriptor_for_plugin): New function.
10274 * fileread.cc (File_read::claim_for_plugin): New function.
10275 * fileread.h (File_read::claim_for_plugin): New function.
10276 (File_read::descriptor): New function.
10277 * gold.cc: Include "plugin.h".
10278 (queue_initial_tasks): Add task to call plugin hooks for generating
10280 * main.cc: Include "plugin.h".
10281 (main): Load plugin libraries.
10282 * object.h (Pluginobj): Declare.
10283 (Object::pluginobj): New function.
10284 (Object::do_pluginobj): New function.
10285 (Object::set_target): New function.
10286 * options.cc: Include "plugin.h".
10287 (General_options::parse_plugin): New function.
10288 (General_options::General_options): Initialize plugins_ field.
10289 (General_options::add_plugin): New function.
10290 * options.h (Plugin_manager): Declare.
10291 (General_options): Add --plugin option.
10292 (General_options::has_plugins): New function.
10293 (General_options::plugins): New function.
10294 (General_options::add_plugin): New function.
10295 (General_options::plugins_): New field.
10296 * plugin.cc: New file.
10297 * plugin.h: New file.
10298 * readsyms.cc: Include "plugin.h".
10299 (Read_symbols::do_read_symbols): Check for archive before checking
10300 for ELF file. Call plugin hooks to claim files.
10301 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
10302 from a real object file; force override when processing replacement
10304 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
10305 (Symbol::init_base_object): Likewise.
10306 (Symbol::init_base_output_data): Likewise.
10307 (Symbol::init_base_output_segment): Likewise.
10308 (Symbol::init_base_constant): Likewise.
10309 (Symbol::init_base_undefined): Likewise.
10310 (Symbol::output_section): Assert that object is not a plugin.
10311 (Symbol_table::add_from_pluginobj): New function.
10312 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
10314 (Symbol_table::sized_write_globals): Likewise.
10315 (Symbol_table::add_from_pluginobj): Instantiate template.
10316 * symtab.h (Sized_pluginobj): Declare.
10317 (Symbol::in_real_elf): New function.
10318 (Symbol::set_in_real_elf): New function.
10319 (Symbol::in_real_elf_): New field.
10320 (Symbol_table::add_from_pluginobj): New function.
10322 * testsuite/Makefile.am (AM_CFLAGS): New variable.
10323 (LIBDL): New variable.
10324 (LDADD): Add LIBDL.
10325 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
10326 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
10327 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
10328 (MOSTLYCLEANFILES): Likewise.
10329 * testsuite/Makefile.in: Regenerate.
10330 * testsuite/plugin_test.c: New file.
10331 * testsuite/plugin_test_1.sh: New file.
10332 * testsuite/plugin_test_2.sh: New file.
10334 2008-09-16 Ian Lance Taylor <iant@google.com>
10336 * target-reloc.h (relocate_section): Check whether a symbol is
10337 defined by the ABI before reporting an undefined symbol error.
10338 * target.h (Target::is_defined_by_abi): Make parameter const.
10339 (Target::do_is_defined_by_abi): Likewise.
10340 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
10341 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
10342 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
10343 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
10344 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
10345 * testsuite/Makefile.in: Rebuild.
10347 * fileread.cc (make_view): Add casts to avoid warning.
10349 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
10351 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
10352 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10354 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
10356 * options.h (General_options::output_is_executable): New.
10357 (General_options::output_is_pie): New.
10358 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
10359 for shared libraries.
10360 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10362 2008-09-11 Chris Demetriou <cgd@google.com>
10364 * options.h (origin): New -z option.
10365 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
10366 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
10369 2008-09-05 Cary Coutant <ccoutant@google.com>
10371 * fileread.cc (File_read::make_view): Add check for attempt to map
10372 beyond end of file.
10374 2008-09-05 Cary Coutant <ccoutant@google.com>
10376 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
10377 explicit instantiations.
10379 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
10382 * options.cc (General_options::finalize): Allow undefined symbols
10383 in shlibs if linking -shared.
10386 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
10387 symbols as not needing a dynsym entry.
10389 2008-08-20 Craig Silverstein <csilvers@google.com>
10391 * fileread.cc (File_read::open): Do not lock the file unless it
10392 was successfully opened.
10394 2008-08-14 Cary Coutant <ccoutant@google.com>
10396 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
10397 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
10398 * testsuite/tls_test.cc (struct int128): 128-bit struct
10399 for testing TLS relocs with non-zero addend.
10400 (v12): New TLS variable.
10402 (t_last): Add check for v12.
10403 * testsuite/tls_test.h (t12): New function.
10404 * testsuite/tls_test_main.cc (thread_routine): Call new test.
10406 2008-08-13 Ian Lance Taylor <iant@google.com>
10408 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
10409 set tls_segment_ or relro_segment_.
10410 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
10412 * output.h (Output_section::clear_is_relro): New function.
10413 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
10414 sections specially even when output_data_ is empty.
10415 (Output_segment::maximum_alignment): When first section is relro,
10416 only force alignment for PT_LOAD segments.
10417 * script.cc (script_data_segment_align): New function.
10418 (script_data_segment_relro_end): New function.
10419 * script-c.h (script_data_segment_align): Declare.
10420 (script_data_segment_relro_end): Declare.
10421 * script-sections.h (class Script_sections): Declare
10422 data_segment_align and data_segment_relro_end. Add fields
10423 segment_align_index_ and saw_relro_end_.
10424 * script-sections.cc (class Sections_element): Add set_is_relro
10425 virtual function. Add new bool* parameter to place_orphan_here.
10426 Add get_output_section virtual function.
10427 (class Output_section_definition): Add set_is_relro. Add new
10428 bool* parameter to place_orphan_here. Add get_output_section.
10429 Add is_relro_ field.
10430 (Output_section_definition::Output_section_definition): Initialize
10431 evaluated_address_, evaluated_load_address, evaluated_addralign_,
10432 and is_relro_ fields.
10433 (Output_section_definition::place_orphan_here): Add is_relro
10435 (Output_section_definition::set_section_addresses): Set relro for
10437 (Output_section_definition::alternate_constraint): Likewise.
10438 (class Orphan_output_section): Add new bool* parameter to
10439 place_orphan_here. Add get_output_section.
10440 (Orphan_output_section::place_orphan_here): Add is_relro
10442 (Script_sections::Script_sections): Initialize
10443 data_segment_align_index_ and saw_relro_end_.
10444 (Script_sections::data_segment_align): New function.
10445 (Script_sections::data_segment_relro_end): New function.
10446 (Script_sections::place_orphan): Set or clear is_relro.
10447 (Script_sections::set_section_addresses): Force alignment of first
10449 * yyscript.y (exp): Call script_data_segment_align and
10450 script_data_segment_relro_end.
10451 * testsuite/relro_script_test.t: New file.
10452 * testsuite/relro_test.cc (using_script): Declare.
10453 (t1, t2): Test using_script.
10454 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
10455 (relro_script_test_SOURCES): Define.
10456 (relro_script_test_DEPENDENCIES): Define.
10457 (relro_script_test_LDFLAGS): Define.
10458 (relro_script_test_LDADD): Define.
10459 (relro_script_test.so): New target.
10460 * testsuite/Makefile.in: Rebuild.
10462 2008-08-06 Cary Coutant <ccoutant@google.com>
10464 * archive.cc (Archive::total_archives, Archive::total_members)
10465 (Archive::total_members_loaded): New variables.
10466 (Archive::setup): Add parameter. Add option to preread
10468 (Archive::read_armap): Add counter.
10469 (Archive::get_file_and_offset): New function.
10470 (Archive::get_elf_object_for_member): New function.
10471 (Archive::read_all_symbols): New function.
10472 (Archive::read_symbols): New function.
10473 (Archive::add_symbols): Add counters.
10474 (Archive::include_all_members): Use armap to find members if it's
10476 (Archive::include_member): Skip reading symbols if already read.
10477 Factored code into Archive::get_file_and_offset and
10478 Archive::get_elf_object_for_member. Changed call to
10479 Mapfile::report_include_archive_member.
10480 (Archive::print_stats): New function.
10481 * archive.h: Declare Object and Read_symbols_data classes.
10482 (Archive::Archive): Add initializers for new members.
10483 (Archive::setup): Add parameter.
10484 (Archive::print_stats): New function.
10485 (Archive::total_archives, Archive::total_members)
10486 (Archive::total_members_loaded): New variables.
10487 (Archive::get_file_and_offset): New function.
10488 (Archive::get_elf_object_for_member): New function.
10489 (Archive::read_all_symbols): New function.
10490 (Archive::read_symbols): New function.
10491 (Archive::Archive_member): New class.
10492 (Archive::members_): New member.
10493 (Archive::num_members_): New member.
10494 * main.cc: Include archive.h.
10495 (main): Call Archive::print_stats.
10496 * mapfile.cc (Mapfile::report_include_archive_member): Delete
10497 archive parameter; member_name is now the fully-decorated name.
10498 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
10499 * options.h: (General_options): Add --preread-archive-symbols option.
10500 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
10503 2008-08-04 Ian Lance Taylor <iant@google.com>
10505 * symtab.h (Symbol::use_plt_offset): New function.
10506 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
10507 * powerpc.cc (Relocate::relocate): Likewise.
10508 * sparc.cc (Relocate::relocate): Likewise.
10509 * x86_64.cc (Relocate::relocate): Likewise.
10510 * testsuite/weak_plt.sh: New test.
10511 * testsuite/weak_plt_main.cc: New test.
10512 * testsuite/weak_plt_shared.cc: New test.
10513 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
10514 (check_PROGRAMS): Add weak_plt.
10515 (check_DATA): Add weak_plt_shared.so.
10516 (weak_plt_main_pic.o, weak_plt): New targets.
10517 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
10518 * testsuite/Makefile.in: Rebuild.
10520 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
10522 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
10523 * testsuite/Makefile.in: Rebuild.
10525 2008-08-04 Alan Modra <amodra@bigpond.net.au>
10527 * Makefile.am (POTFILES.in): Set LC_ALL=C.
10528 * Makefile.in: Regenerate.
10529 * po/POTFILES.in: Regenerate.
10531 2008-07-29 Ian Lance Taylor <iant@google.com>
10533 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
10534 symbols before other symbols.
10535 * testsuite/script_test_2.cc (test_addr): Declare.
10536 (test_addr_alias): Declare.
10537 (main): Check that test_addr and test_addr_alias have the right
10539 * testsuite/script_test_2.t: Define test_addr_alias and
10542 2008-07-24 Ian Lance Taylor <iant@google.com>
10545 * descriptors.cc: New file.
10546 * descriptors.h: New file.
10547 * gold-threads.h (class Hold_optional_lock): New class.
10548 * fileread.cc: Include "descriptors.h".
10549 (File_read::~File_read): Release descriptor rather than closing
10551 (File_read::open) [file]: Call open_descriptor rather than open.
10552 Set is_descriptor_opened_.
10553 (File_read::open) [memory]: Assert that descriptor is not open.
10554 (File_read::reopen_descriptor): New function.
10555 (File_read::release): Release descriptor.
10556 (File_read::do_read): Make non-const. Reopen descriptor.
10557 (File_read::read): Make non-const.
10558 (File_read::make_view): Reopen descriptor.
10559 (File_read::do_readv): Likewise.
10560 * fileread.h (class File_read): Add is_descriptor_opened_ field.
10561 Update declarations.
10562 * layout.cc: Include "descriptors.h".
10563 (Layout::create_build_id): Use open_descriptor rather than open.
10564 * output.cc: Include "descriptors.h".
10565 (Output_file::open): Use open_descriptor rather than open.
10566 * archive.cc (Archive::const_iterator): Change Archive to be
10568 (Archive::begin, Archive::end): Make non-const.
10569 (Archive::count_members): Likewise.
10570 * archive.h (class Archive): Update declarations.
10571 * object.h (Object::read): Make non-const.
10572 * Makefile.am (CCFILES): Add descriptors.cc.
10573 (HFILES): Add descriptors.h.
10574 * Makefile.in: Rebuild.
10577 * gold.h: Always include <clocale>. Add Solaris workarounds
10578 following code in binutils/sysdep.h.
10581 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
10582 this->eh_frame_hdr_ is NULL before using it.
10584 * dynobj.cc (Versions::Versions): Update comment.
10586 * dynobj.cc (Versions::Versions): If there is an soname, use it as
10587 the base version name.
10589 * stringpool.cc (Stringpool_template::add_with_length): Set key to
10590 array size plus one.
10591 (Stringpool_template::set_string_offsets): Subtract one from key
10592 before using it as an array index.
10593 (Stringpool_template::get_offset_with_length): Likewise.
10594 (Stringpool_template::write_to_buffer): Likewise.
10595 * stringpool.h (Stringpool_template::get_offset_from_key):
10598 2008-07-23 Ian Lance Taylor <iant@google.com>
10601 * object.h (Merged_symbol_value::value): Do our best to handle a
10605 * script.cc (Version_script_info::get_versions): Don't add empty
10606 version tag to return value.
10607 (Version_script_info::get_symbol_version_helper): Change return
10608 type to bool. Add pversion parameter. Change all callers.
10609 (script_register_vers_node): Don't require a non-NULL tag.
10610 * script.h (class Version_script_info): Update declarations.
10611 (Version_script_info::get_symbol_version): Change return type to
10612 bool. Add version parameter. Change all callers.
10613 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
10614 handling. Handle an empty version from a version script.
10615 (Symbol_table::define_special_symbol): Likewise.
10616 * testsuite/ver_test_10.script: New file.
10617 * testsuite/ver_test_10.sh: New file.
10618 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
10619 (check_DATA): Add ver_test_10.syms.
10620 (ver_test_10.syms, ver_test_10.so): New target.
10621 * testsuite/Makefile.in: Rebuild.
10623 2008-07-23 Simon Baldwin <simonb@google.com>
10625 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
10626 to zero for undefined symbols from dynamic libraries.
10628 2008-07-23 Ian Lance Taylor <iant@google.com>
10630 * symtab.cc (Symbol_table::resolve): Remove version parameter.
10631 Change all callers.
10632 * symtab.h (class Symbol_table): Update declaration.
10633 * testsuite/ver_test_9.cc: New file.
10634 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
10635 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
10636 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
10637 (ver_test_9.so, ver_test_9.o): New targets.
10638 * testsuite/Makefile.in: Rebuild.
10640 2008-07-22 Ian Lance Taylor <iant@google.com>
10642 * options.h (class General_options): Define --check-sections.
10643 * layout.cc (Layout::set_segment_offsets): Handle
10646 * options.h (class General_options): Define -n/--nmagic and
10648 * options.cc (General_options::finalize): For -n/--nmagic or
10649 -N/--omagic, set -static.
10650 * layout.cc (Layout::attach_allocated_section_to_segment): If
10651 -N/--omagic, don't put read-only and read-write sections in
10652 different segments.
10653 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
10654 finding a read-only segment.
10655 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
10656 don't set the minimum segment alignment to the common page size,
10657 and don't set the file offset to the address modulo the page size.
10658 * script-sections.cc (Script_sections::create_segments): If
10659 -n/--omagic, don't put read-only and read-write sections in
10660 different segments.
10662 * cref.cc: New file.
10663 * cref.h: New file.
10664 * options.h (class General_options): Add --print-symbol-counts.
10665 * main.cc (main): Issue defined symbol report if requested.
10666 * archive.cc (Archive::interpret_header): Make into a const member
10668 (Archive::add_symbols): Call Input_objects::archive_start and
10670 (Archive::const_iterator): Define new class.
10671 (Archive::begin, Archive::end): New functions.
10672 (Archive::include_all_members): Rewrite to use iterator.
10673 (Archive::count_members): New function.
10674 * archive.h (class Archive): Update declarations.
10675 (Archive::filename): New function.
10676 * object.cc: Include "cref.h".
10677 (Sized_relobj::Sized_relobj): Initialize defined_count_.
10678 (Sized_relobj::do_get_global_symbol_counts): New function.
10679 (Input_objects::add_object): Add object to cross-referencer.
10680 (Input_objects::archive_start): New function.
10681 (Input_objects::archive_stop): New function.
10682 (Input_objects::print_symbol_counts): New function.
10683 * object.h: Declare Cref and Archive.
10684 (Object::get_global_symbol_counts): New function.
10685 (Object::do_get_global_symbol_counts): New pure virtual function.
10686 (class Sized_relobj): Add defined_count_ field. Update
10688 (class Input_objects): Add cref_ field. Update constructor.
10689 Update declarations.
10690 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
10692 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
10694 (Sized_dynobj::do_get_global_symbol_counts): New function.
10695 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
10696 defined_count_. Update declarations. Define Symbols typedef.
10697 * symtab.cc (Symbol_table::add_from_relobj): Add defined
10698 parameter. Change all callers.
10699 (Symbol_table::add_from_dynobj): Add sympointers and defined
10700 parameters. Change all callers.
10701 * symtab.h (class Symbol_table): Update declarations.
10702 * Makefile.am (CCFILES): Add cref.cc.
10703 (HFILES): Add cref.h.
10704 * Makefile.in: Rebuild.
10706 2008-07-22 Simon Baldwin <simonb@google.com>
10708 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
10709 to zero when writing undefined symbols.
10711 2008-07-22 Ian Lance Taylor <iant@google.com>
10713 * output.cc (Output_section::add_input_section): Don't try to
10714 merge empty merge sections.
10716 2008-07-21 Craig Silverstein <csilvers@google.com>
10718 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10719 Include symbol version in error message.
10721 2008-07-20 Chris Demetriou <cgd@google.com>
10723 * configure.ac (gold_cv_c_random_seed): New configured variable.
10724 (RANDOM_SEED_CFLAGS): New substituted variable.
10725 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
10726 * configure: Rebuild.
10727 * Makefile.in: Likewise.
10728 * testsuite/Makefile.in: Likewise.
10730 2008-07-18 Ian Lance Taylor <iant@google.com>
10732 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
10733 where we see NAME/NULL and NAME/VERSION as separate symbols.
10734 * testsuite/ver_test_main.cc (main): Call t4.
10735 (t4, t4_2a): Define.
10736 * testsuite/ver_test_2.cc (t4_2): Define.
10737 * testsuite/ver_test_2.script: Put t4_2a in VER2.
10738 * testsuite/ver_test_4.cc (t4_2a): Define.
10739 * testsuite/ver_test_4.script: Put t4_2a in VER2.
10740 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
10742 2008-07-17 Ian Lance Taylor <iant@google.com>
10744 * dynobj.cc (Versions::add_def): If we give an error about a
10745 missing version, go ahead and create the version anyhow.
10747 2008-07-10 Ian Lance Taylor <iant@google.com>
10749 Handle output sections with more than 0x7fffffff bytes.
10750 * object.h (class Relobj): Change map_to_output_ to
10751 output_sections_, and just keep a section pointer. Change all
10752 uses. Move comdat group support to Sized_relobj.
10753 (Relobj::is_section_specially_mapped): Remove.
10754 (Relobj::output_section): Remove poff parameter. Change all
10756 (Relobj::output_section_offset): New function.
10757 (Relobj::set_section_offset): Rewrite.
10758 (Relobj::map_to_output): Remove.
10759 (Relobj::output_sections): New function.
10760 (Relobj::do_output_section_offset): New pure virtual function.
10761 (Relobj::do_set_section_offset): Likewise.
10762 (class Sized_relobj): Add section_offsets_ field. Add comdat
10763 group support from Relobj. Update declarations.
10764 (Sized_relobj::get_output_section_offset): New function.
10765 (Sized_relobj::do_output_section_offset): New function.
10766 (Sized_relobj::do_set_section_offset): New function.
10767 * object.cc (Relobj::output_section_address): Remove.
10768 (Sized_relobj::Sized_relobj): Initialize new fields.
10769 (Sized_relobj::include_section_group): Cast find_kept_object to
10771 (Sized_relobj::include_linkonce_section): Likewise.
10772 (Sized_relobj::do_layout): Use separate arrays for output section
10774 (Sized_relobj::do_count_local_symbols): Change map_to_output to
10776 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
10777 output_sections and section_offsets.
10778 (Sized_relobj::write_local_symbols): Likewise.
10779 (map_to_kept_section): Compute output address directly.
10780 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
10781 output_sections and section_offsets.
10782 (Sized_relobj::write_sections): Likewise.
10783 (Sized_relobj::relocate_sections): Likewise.
10784 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
10785 * output.h (class Output_reloc): Update declarations. Change
10786 u2_.relobj to Sized_relobj*.
10787 (class Output_data_reloc): Change add functions to use
10789 * output.cc (Output_reloc::Output_reloc): Change relobj to
10791 (Output_reloc::local_section_offset): Change return type to
10792 Elf_Addr. Use get_output_section_offset.
10793 (Output_reloc::get_address): Likewise.
10794 (Output_section::is_input_address_mapped): Don't call
10795 is_section_specially_mapped.
10796 (Output_section::output_offset): Likewise.
10797 (Output_section::output_address): Likewise.
10798 (Output_section::starting_output_address): Likewise.
10799 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
10800 parameter to Sized_relobj*.
10801 (Copy_relocs::need_copy_reloc): Likewise.
10802 (Copy_relocs::save): Likewise.
10803 * copy-relocs.h (class Copy_relocs): Update declarations.
10804 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
10805 Sized_relobj*. Change relobj_ field to Sized_relobj*.
10806 * target-reloc.h (relocate_for_relocatable): Change
10807 offset_in_output_section type to Elf_Addr. Change code that uses
10809 * layout.cc (Layout::layout): Always set *off.
10810 * mapfile.cc (Mapfile::print_input_section): Use
10811 output_section_offset.
10812 * i386.cc (Target_i386::copy_reloc): Change object parameter to
10814 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
10815 * sparc.cc (Target_sparc::copy_reloc): Likewise.
10816 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
10818 2008-07-03 Ian Lance Taylor <iant@google.com>
10820 * layout.cc (Layout::include_section): Do not discard unrecognized
10821 SHT_STRTAB sections.
10823 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
10825 * script.cc (Lex::can_continue_name): Make '?' allowable in
10826 version-script names.
10827 * testsuite/version_script.map: Change glob pattern to use '?'
10829 2008-06-30 Manish Singh <yosh@gimp.org>
10832 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
10835 2008-06-30 Ian Lance Taylor <iant@google.com>
10839 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
10840 versions]: Don't try to read the value in the contents, since we
10841 don't use it. Use the template endianness when writing.
10843 2008-06-25 Cary Coutant <ccoutant@google.com>
10845 * fileread.cc (File_read::make_view): Assert on zero-length view.
10846 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
10847 symbol table when there are no symbols to read.
10849 2008-06-23 Craig Silverstein <csilvers@google.com>
10851 * version.cc (version_string): Bump to 1.7
10853 2008-06-18 Craig Silverstein <csilvers@google.com>
10855 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
10856 constant 0xFFFF to type Valtype.
10857 (Powerpc_relocate_functions::rel16_ha): Likewise.
10859 2008-06-17 Ian Lance Taylor <iant@google.com>
10861 * output.h (Output_section::Input_section): Initialize p2align_ to
10862 zero for Output_section_data constructors.
10863 (Output_section::Input_section::addralign): If not an input
10864 section, return the alignment of the Output_section_data.
10865 * testsuite/copy_test.cc: New file.
10866 * testsuite/copy_test_1.cc: New file.
10867 * testsuite/copy_test_2.cc: New file.
10868 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
10869 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
10870 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
10871 (copy_test_1_pic.o, copy_test_1.so): New targets.
10872 (copy_test_2_pic.o, copy_test_2.so): New targets.
10873 * testsuite/Makefile.in: Rebuild.
10875 * script-sections.cc (Script_sections::place_orphan): Initialize
10876 local variable exact.
10878 2008-06-13 David Edelsohn <edelsohn@gnu.org>
10880 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
10882 2008-06-12 David Edelsohn <edelsohn@gnu.org>
10883 David S. Miller <davem@davemloft.net>
10885 * powerpc.cc: New file.
10886 * Makefile.am (TARGETSOURCES): Add powerpc.cc
10887 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
10888 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
10889 * Makefile.in: Rebuild.
10891 2008-06-09 Ian Lance Taylor <iant@google.com>
10893 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
10895 (throwing, orig_terminate): New static variables.
10896 (terminate_handler): New static function.
10897 (t2): Set terminate handler.
10899 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
10902 * binary.cc (Binary_to_elf::sized_convert): Fix .data
10905 2008-05-30 Cary Coutant <ccoutant@google.com>
10907 * archive.cc (Archive::include_all_members) Correct to step
10908 over symbol table and extended name table in thin archives.
10910 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
10913 * target-reloc.h (relocate_for_relocatable): Fix new_offset
10916 2008-05-28 Caleb Howe <cshowe@google.com>
10918 * reduced_debug_output.cc: New file.
10919 * reduced_debug_output.h: New file.
10920 * options.h (class General_options): Add --strip-debug-non-line.
10921 * options.cc (General_options::finalize): Add strip_debug_non_line
10922 to the strip heirarchy.
10923 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
10925 * layout.cc: Include "reduced_debug_output.h".
10926 (Layout::Layout): Initialize new fields.
10927 (line_only_debug_sections): New static array.
10928 (is_lines_only_debug_sections): New static inline function.
10929 (Layout::include_section): Handle --strip-debug-non-line.
10930 (Layout::make_output_section): If --strip-debug-non-line, build
10931 new output sections for .debug_abbrev and .debug_info.
10932 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
10933 gold. Warn about possible overflow.
10934 (read_signed_LEB_128): Likewise.
10935 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
10936 (read_signed_LEB_128): Declare.
10937 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
10938 (HFILES): Add reduced_debug_output.h.
10939 * Makefile.in: Rebuild.
10941 2008-05-21 Ian Lance Taylor <iant@google.com>
10943 * mapfile.cc: New file.
10944 * mapfile.h: New file.
10945 * options.h (class General_options): Add -M/--print-map and -Map.
10946 * options.cc (General_options::finalize): Make -M equivalent to
10948 * main.cc: Include <cstdio> and "mapfile.h".
10949 (main): Open mapfile if requested.
10950 * gold.cc (class Middle_runner): Add mapfile_ field. Update
10951 constructor. Change caller.
10952 (queue_initial_tasks): Add mapfile parameter. Change caller.
10953 (queue_middle_tasks): Likewise.
10954 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
10956 * archive.cc: Include "mapfile.h".
10957 (Archive::add_symbols): Add mapfile parameter. Change all
10958 callers. Pass mapfile, symbol, and reason to include_member.
10959 (Archive::include_all_members): Add mapfile parameter. Change all
10961 (Archive::include_member): Add mapfile, sym, and why parameters.
10962 Change all callers. Report inclusion to map file.
10963 * archive.h: Include "fileread.h".
10964 (class Archive): Update declarations.
10965 (Archive::file): New const method.
10966 (class Add_archive_symbols): Add mapfile_ field. Update
10967 constructor. Change all callers.
10968 * readsyms.h (class Read_symbols): Likewise.
10969 (class Finish_group): Likewise.
10970 (class Read_script): Likewise.
10971 * common.cc: Include "mapfile.h".
10972 (Symbol_table::allocate_commons): Add mapfile parameter. Change
10974 (Symbol_table::do_allocate_commons): Likewise.
10975 (Symbol_table::do_allocate_commons_list): Likewise. Report common
10976 symbol allocation to mapfile.
10977 * common.h (class Allocate_commons_task): Add mapfile_ field.
10978 Update constructor. Change all callers.
10979 * symtab.h (class Symbol_table): Update declarations.
10980 * layout.cc: Include "mapfile.h".
10981 (Layout_task_runner::run): Print information to mapfile.
10982 (Layout::create_gold_note): Change Output_data_fixed_space to
10983 Output_data_zero_fill.
10984 (Layout::create_build_id): Likewise.
10985 (Layout::print_to_mapfile): New function.
10986 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
10987 constructor. Change caller.
10988 (class Layout): Declare print_to_mapfile.
10989 * output.cc (Output_section::Input_section::print_to_mapfile): New
10991 (Output_section::add_input_section): If producing a map, always
10992 add to input_sections_ list.
10993 (Output_section::do_print_to_mapfile): New function.
10994 (Output_segment::print_sections_to_mapfile): New function.
10995 (Output_segment::print_section_list_to_mapfile): New function.
10996 * output.h: Include "mapfile.h".
10997 (Output_data::print_to_mapfile): New function.
10998 (Output_data::do_print_to_mapfile): New virtual function.
10999 (Output_segment_headers::do_print_to_mapfile): New function.
11000 (Output_file_header::do_print_to_mapfile): New function.
11001 (Output_data_const::do_print_to_mapfile): New function.
11002 (class Output_data_const_buffer): Add map_name_ field. Update
11003 constructor. Change all callers. Add do_print_to_mapfile
11005 (class Output_data_fixed_space): Likewise.
11006 (class Output_data_space): Likewise.
11007 (class Output_data_zero_fill): New class.
11008 (Output_data_strtab::do_print_to_mapfile): New function.
11009 (Output_data_reloc_base::do_print_to_mapfile): New function.
11010 (Output_relocatable_relocs::do_print_to_mapfile): New function.
11011 (Output_data_group::do_print_to_mapfile): New function.
11012 (Output_data_got::do_print_to_mapfile): New function.
11013 (Output_data_dynamic::do_print_to_mapfile): New function.
11014 (Output_symtab_xindex::do_print_to_mapfile): New function.
11015 (class Output_section): Declare do_print_to_mapflie. Declare
11016 print_to_mapfile in Input_section.
11017 (class Output_segment): Declare new functions.
11018 * object.h (Sized_relobj::symbol_count): New function.
11019 * script-sections.cc
11020 (Output_section_element_dot_assignment::set_section_addresses):
11021 Change Output_data_fixed_space to Output_data_zero_fill.
11022 (Output_data_expression::do_print_to_mapfile): New function.
11023 * script.cc (read_input_script): Add mapfile parameter. Change
11025 * script.h (read_input_script): Update declaration.
11026 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
11027 (Eh_frame::do_print_to_mapfile): New function.
11028 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
11029 (Output_merge_string::do_print_to_mapfile): New function.
11030 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
11032 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
11034 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
11036 * Makefile.am (CCFILES): Add mapfile.cc.
11037 (HFILES): Add mapfile.h.
11038 * Makefile.in: Rebuild.
11040 2008-05-19 Ian Lance Taylor <iant@google.com>
11042 * options.h (class General_options): Add -z relro.
11043 * layout.cc (Layout::Layout): Initialize relro_segment_.
11044 (Layout::add_output_section_data): Return the output section.
11045 (Layout::make_output_section): Rcognize relro sections and mark
11046 them appropriately.
11047 (Layout::attach_allocated_section_to_segment): Put relro sections
11048 in a PT_GNU_RELRO segment.
11049 (Layout::create_initial_dynamic_sections): Mark the .dynamic
11051 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11053 (Layout::linkonce_mapping): Map d.rel.ro.local to
11054 .data.rel.ro.local.
11055 (Layout::output_section_name): Us .data.rel.ro.local for any
11056 section which begins with that.
11057 * layout.h (class Layout): Update add_output_section_data
11058 declaration. Add relro_segment_ field.
11059 * output.cc (Output_section::Output_section): Initialize is_relro_
11060 and is_relro_local_ fields.
11061 (Output_segment::add_output_section): Group relro sections.
11062 (Output_segment::is_first_section_relro): New function.
11063 (Output_segment::maximum_alignment): If there is a relro section,
11064 align the segment to the common page size.
11065 (Output_segment::set_section_addresses): Track whether we are
11066 looking at relro sections. If the last section is a relro
11067 section, align to the common page size.
11068 (Output_segment::set_section_list_addresses): Add in_relro
11069 parameter. Change all callers. Align to the page size when
11070 moving from relro to non-relro section.
11071 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
11073 * output.h (class Output_section): Add is_relro_ and
11074 is_relro_local_ fields.
11075 (Output_section::is_relro): New function.
11076 (Output_section::set_is_relro): New function.
11077 (Output_section::is_relro_local): New function.
11078 (Output_section::set_is_relro_local): New function.
11079 (class Output_segment): Update declarations.
11080 * i386.cc (Target_i386::got_section): Mark .got section as relro.
11081 * sparc.cc (Target_sparc::got_section): Likewise.
11082 * x86_64.cc (Target_x86_64::got_section): Likewise.
11083 * testsuite/relro_test_main.cc: New file.
11084 * testsuite/relro_test.cc: New file.
11085 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11086 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11087 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11088 (relro_test.so, relro_test_pic.o): New targets.
11089 * testsuite/Makefile.in: Rebuild.
11091 2008-05-16 Ian Lance Taylor <iant@google.com>
11093 * output.cc (Output_segment::add_output_section): Remove front
11095 * output.h (class Output_segment): Remove
11096 add_initial_output_section and overloaded add_output_section.
11097 Update declaration of remaining add_output_section.
11098 * layout.cc (Layout::create_interp): Call add_output_section
11099 rather than add_initial_output_section.
11100 (Layout::finish_dynamic_section): Likewise.
11102 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
11103 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
11104 know the dynamic type.
11105 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
11106 field. Initialize it in constructor.
11107 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
11108 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
11109 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
11112 * output.cc (Output_reloc::get_address): Change return type to
11114 * output.h (class Output_reloc): Update get_address declaration.
11115 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
11116 for section addresses.
11118 2008-05-09 Ian Lance Taylor <iant@google.com>
11121 * gold.cc (gold_nomem): Use return value of write.
11123 2008-05-08 Ian Lance Taylor <iant@google.com>
11125 * symtab.c (Symbol::init_base_output_data): Add version
11126 parameter. Change all callers.
11127 (Symbol::init_base_output_segment): Likewise.
11128 (Symbol::init_base_constant): Likewise.
11129 (Symbol::init_base_undefined): Likewise.
11130 (Sized_symbol::init_output_data): Likewise.
11131 (Sized_symbol::init_output_segment): Likewise.
11132 (Sized_symbol::init_constant): Likewise.
11133 (Sized_symbol::init_undefined): Likewise.
11134 (Symbol_table::do_define_in_output_data): If the new symbol has a
11135 version, mark it as the default.
11136 (Symbol_table::do_define_in_output_segment): Likewise.
11137 (Symbol_table::do_define_as_constant): Likewise.
11138 * symtab.h (class Symbol): Update declarations.
11139 (class Sized_symbol): Likewise.
11140 * resolve.cc (Symbol::override_version): New function.
11141 (Symbol::override_base): Call override_version.
11142 (Symbol::override_base_with_special): Likewise.
11143 * testsuite/ver_script_8.script: New file.
11144 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
11145 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
11146 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
11147 (ver_test_8_1.so, ver_test_8_2.so): New targets.
11149 2008-05-06 Ian Lance Taylor <iant@google.com>
11152 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
11154 (class General_options): Remove existing --undefined, and add
11155 --no-undefined instead. Add new --undefined as synonym for -u.
11156 * archive.cc (Archive::add_symbols): Check whether symbol was
11158 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
11159 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
11160 all uses. Add IS_UNDEFINED. Update declarations to split
11161 different versions of init_base. Declare init_base_undefined.
11162 (Symbol::is_defined): Handle IS_UNDEFINED.
11163 (Symbol::is_undefined): Likewise.
11164 (Symbol::is_weak_undefined): Call is_undefined.
11165 (Symbol::is_absolute): Handle IS_CONSTANT.
11166 (class Sized_symbol): Update declarations to split different
11167 versions of init. Declare init_undefined.
11168 (class Symbol_table): Declare new functions.
11169 * symtab.cc (Symbol::init_base_object): Rename from init_base.
11170 Change all callers.
11171 (Symbol::init_base_output_data): Likewise.
11172 (Symbol::init_base_output_segment): Likewise.
11173 (Symbol::init_base_constant): Likewise.
11174 (Symbol::init_base_undefined): New function.
11175 (Sized_symbol::init_object): Rename from init. Change all
11177 (Sized_symbol::init_output_data): Likewise.
11178 (Sized_symbol::init_output_segment): Likewise.
11179 (Sized_symbol::init_constant): Likewise.
11180 (Sized_symbol::init_undefined): New function.
11181 (Symbol_table::add_undefined_symbols_from_command_line): New
11183 (Symbol_table::do_add_undefined_symbols_from_command_line): New
11185 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
11186 (Symbol::output_section): Likewise.
11187 (Symbol::set_output_section): Likewise.
11188 (Symbol_table::sized_finalize_symbol): Likewise.
11189 (Symbol_table::sized_write_globals): Likewise.
11190 * resolve.cc (Symbol_table::should_override): Likewise.
11191 (Symbol::override_base_with_special): Likewise.
11193 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
11194 symbol, change it to have default visibility.
11195 * testsuite/protected_1.cc: New file.
11196 * testsuite/protected_2.cc: New file.
11197 * testsuite/protected_3.cc: New file.
11198 * testsuite/protected_main_1.cc: New file.
11199 * testsuite/protected_main_2.cc: New file.
11200 * testsuite/protected_main_3.cc: New file.
11201 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
11202 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
11203 (protected_1_LDFLAGS, protected_1_LDADD): Define.
11204 (protected_1.so): New target.
11205 (protected_1_pic.o, protected_2_pic.o): New targets.
11206 (protected_3_pic.o): New target.
11207 (check_PROGRAMS): Add protected_2.
11208 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
11209 (protected_2_LDFLAGS, protected_2_LDADD): Define.
11210 * testsuite/Makefile.in: Rebuild.
11212 * options.h (DEFINE_var): Add set_user_set_##varname__.
11213 (DEFINE_bool_alias): New macro.
11214 (class General_options): Define -Bstatic using DEFINE_bool_alias
11215 rather than DEFINE_special. Add --undefined as an alias for -z
11217 * options.cc (General_options::parse_Bstatic): Remove.
11219 * options.h (class General_options): Add --fatal-warnings.
11220 * main.cc (main): Implement --fatal-warnings.
11221 * errors.h (Errors::warning_count): New function.
11223 * options.h (class General_options): Add -Bsymbolic-functions.
11224 * symtab.h (Symbol::is_preemptible): Check for
11225 -Bsymbolic-functions.
11227 2008-05-05 Ian Lance Taylor <iant@google.com>
11229 * options.h (DEFINE_bool): For DASH_Z, create the negative option
11230 as noVARNAME rather than no-VARNAME.
11231 (class General_options): Add option -z combreloc.
11232 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
11234 (Output_reloc::sort_before) [SHT_REL]: New function.
11235 (Output_reloc::sort_before) [SHT_RELA]: New function.
11236 (class Output_data_reloc_base): Add sort_relocs_ field. Define
11237 Sort_relocs_comparison.
11238 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
11239 parameter. Change all callers.
11240 (Output_data_reloc::Output_data_reloc) [both versions]: Add
11241 sort_relocs parameter. Change all callers.
11242 * output.cc (Output_reloc::get_address): New function, broken out
11244 (Output_reloc::write_rel): Call it.
11245 (Output_reloc::compare): New function.
11246 (Output_data_reloc_base::do_write): Optionally sort relocs.
11248 * configure.ac: If targ_extra_obj is set, link it in.
11249 * configure.tgt: Initialize all variables.
11250 (x86_64*): Set targ_extra_obj and targ_extra_size.
11251 * configure: Rebuild.
11253 * object.cc (Sized_relobj::include_section_group): Adjust section
11254 indexes read from group data. Build vector to pass to
11256 * layout.cc (Layout::layout_group): Add flags and shndxes
11257 parameters. Remove contents parameter. Change caller. Update
11258 explicit instantiations.
11259 * layout.h (class Layout): Update layout_group declaration.
11260 * output.cc (Output_data_group::Output_data_group): Add flags and
11261 input_shndxes parameters. Remove contents parameter. Change
11263 (Output_data_group::do_write): Change input_sections_ to
11265 * output.h (class Output_data_group): Update constructor
11266 declaration. Rename input_sections_ to input_shndxes_.
11267 * testsuite/many_sections_test.cc: Add template.
11269 2008-04-30 Cary Coutant <ccoutant@google.com>
11271 * target-reloc.h (relocate_section): Fix dead-pointer bug.
11273 * layout.cc (Layout::include_section): Refactored check for debug
11275 (Layout::add_comdat): Add new parameters. Change type
11276 of signature parameter. Add object and shndx to signatures table.
11277 (Layout::find_kept_object): New function.
11278 * layout.h: Include <cstring>.
11279 (Layout::is_debug_info_section): New function.
11280 (Layout::add_comdat): Add new parameters.
11281 (Layout::find_kept_object): New function.
11282 (Layout::Kept_section): New struct.
11283 (Layout::Signatures): Change type of map range.
11284 * object.cc (Relobj::output_section_address): New function.
11285 (Sized_relobj::include_section_group): Add new parameters. Change
11286 calls to Layout::add_comdat. Change to build table of kept comdat
11287 groups and table mapping discarded sections to kept sections.
11288 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
11289 (Sized_relobj::do_layout): Change calls to include_section_group and
11290 include_linkonce_section.
11291 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
11292 value to zero when section is discarded.
11293 (Sized_relobj::map_to_kept_section): New function.
11294 * object.h (Relobj::output_section_address): New function.
11295 (Relobj::Comdat_group): New type.
11296 (Relobj::find_comdat_group): New function.
11297 (Relobj::Comdat_group_table): New type.
11298 (Relobj::Kept_comdat_section): New type.
11299 (Relobj::Kept_comdat_section_table): New type.
11300 (Relobj::add_comdat_group): New function.
11301 (Relobj::set_kept_comdat_section): New function.
11302 (Relobj::get_kept_comdat_section): New function.
11303 (Relobj::comdat_groups_): New field.
11304 (Relobj::kept_comdat_sections_): New field.
11305 (Symbol_value::input_value): Update comment.
11306 (Sized_relobj::map_to_kept_section) New function.
11307 (Sized_relobj::include_linkonce_section): Add new parameter.
11308 * target-reloc.h (Comdat_behavior): New type.
11309 (get_comdat_behavior): New function.
11310 (relocate_section): Add code to map a discarded section to the
11311 corresponding kept section when applying a relocation.
11313 2008-04-30 Craig Silverstein <csilvers@google.com>
11315 * dwarf_reader.cc (next_generation_count): New static var.
11316 (Addr2line_cache_entry): New struct.
11317 (addr2line_cache): New static var.
11318 (Dwarf_line_info::one_addr2line): Added caching.
11319 (Dwarf_line_info::clear_addr2line_cache): New function.
11320 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
11321 cache-size parameter.
11322 (Dwarf_line_info::one_addr2line_cache): New function.
11323 * symtab.cc (Symbol_table::detect_odr_violations): Pass
11324 new cache-size argument to one_addr2line(), and clear cache.
11326 2008-04-28 Cary Coutant <ccoutant@google.com>
11328 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
11329 R_386_PC8 relocations.
11331 2008-04-23 Ian Lance Taylor <iant@google.com>
11333 * object.cc (Sized_relobj::include_section_group): Check for
11334 invalid section group.
11336 * object.cc (make_elf_object): Correct test for 64-bit ELF file
11339 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
11340 than read for file header.
11341 * archive.cc (Archive::include_member): Likewise.
11343 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
11345 * aclocal.m4: Regenerate.
11346 * configure: Regenerate.
11348 2008-04-19 Ian Lance Taylor <iant@google.com>
11350 * version.cc (version_string): Bump to 1.6.
11352 * testsuite/Makefile.am (many_sections_r_test): New target.
11353 (many_sections_r_test_SOURCES): Remove.
11354 (many_sections_r_test_DEPENDENCIES): Remove.
11355 (many_sections_r_test_LDFLAGS): Remove.
11356 (many_sections_r_test_LDADD): Remove.
11358 * object.cc (Sized_relobj::do_add_symbols): Always pass
11359 local_symbol_count_ to add_from_relobj.
11361 * testsuite/Makefile.am (many_sections_check.h): Only check one in
11362 every thousand variables.
11363 * testsuite/Makefile.in: Rebuild.
11365 * object.cc (Xindex::initialize_symtab_xindex): New function.
11366 (Xindex::read_symtab_xindex): New function.
11367 (Xindex::sym_xindex_to_shndx): New function.
11368 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
11370 (Sized_relobj::do_initialize_xindex): New function.
11371 (Sized_relobj::do_read_symbols): Adjust section links.
11372 (Sized_relobj::symbol_section_and_value): Add is_ordinary
11373 parameter. Change all callers.
11374 (Sized_relobj::include_section_group): Adjust section links and
11375 symbol section indexes.
11376 (Sized_relobj::do_layout): Adjust section links.
11377 (Sized_relobj::do_count_local_symbols): Adjust section links and
11378 symbol section indexes.
11379 (Sized_relobj::do_finalize_local_symbols): Distinguish between
11380 ordinary and special symbols.
11381 (Sized_relobj::write_local_symbols): Add symtab_xindex and
11382 dynsym_xindex parameters. Change all callers. Adjust section
11383 links. Use SHN_XINDEX when needed.
11384 (Sized_relobj::get_symbol_location_info): Adjust section links.
11385 Don't get fooled by special symbols.
11386 * object.h (class Xindex): Define.
11387 (class Object): Add xindex_ parameter. Declare virtual functoin
11388 do_initialize_xindex.
11389 (Object::adjust_sym_shndx): New function.
11390 (Object::set_xindex): New protected function.
11391 (class Symbol_value): Add is_ordinary_shndx_ field.
11392 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
11393 (Symbol_value::value): Assert ordinary section.
11394 (Symbol_value::initialize_input_to_output_map): Likewise.
11395 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
11396 Change all callers.
11397 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
11399 (class Sized_relobj): Update declarations.
11400 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
11401 parameter. Change all callers.
11402 (Sized_relobj::adjust_shndx): New function.
11403 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
11405 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
11406 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
11407 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
11408 (Sized_dynobj::read_dynsym_section): Adjust section links.
11409 (Sized_dynobj::read_dynamic): Likewise.
11410 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
11412 (Sized_dynobj::do_initialize_xindex): New function.
11413 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
11414 do_initialize_xindex.
11415 (Sized_dynobj::adjust_shndx): New function.
11416 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
11417 dynsym_xindex_ fields.
11418 (Layout::finalize): Add a call to set_section_indexes before
11419 creating the symtab sections.
11420 (Layout::set_section_indexes): Don't do anything if the section
11421 already has a section index.
11422 (Layout::create_symtab_sections): Add shnum parameter. Change
11423 caller. Create .symtab_shndx section if needed.
11424 (Layout::create_shdrs): Add shstrtab_section parameter. Change
11426 (Layout::allocated_output_section_count): New function.
11427 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
11429 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
11430 fields. Update declarations.
11431 (Layout::symtab_xindex): New function.
11432 (Layout::dynsym_xindex): New function.
11433 (class Write_symbols_task): Add layout_ field.
11434 (Write_symbols_task::Write_symbols_task): Add layout parameter.
11436 * output.cc (Output_section_headers::Output_section_headers): Add
11437 shstrtab_section parameter. Change all callers.
11438 (Output_section_headers::do_sized_write): Store overflow values
11439 for section count and section string table section index in
11440 section header zero.
11441 (Output_file_header::do_sized_write): Check for overflow of
11442 section count and section string table section index.
11443 (Output_symtab_xindex::do_write): New function.
11444 (Output_symtab_xindex::endian_do_write): New function.
11445 * output.h (class Output_section_headers): Add shstrtab_section_.
11446 Update declarations.
11447 (class Output_symtab_xindex): Define.
11448 (Output_section::has_out_shndx): New function.
11449 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
11451 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
11452 Change all callers.
11453 (Sized_symbol::init): Likewise.
11454 (Symbol::output_section): Check for ordinary symbol.
11455 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
11456 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
11458 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
11459 Change all callers. Simplify handling of symbols from sections
11460 not included in the link.
11461 (Symbol_table::add_from_dynobj): Handle ordinary symbol
11463 (Weak_alias_sorter::operator()): Assert that symbols are
11465 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
11467 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
11468 parameters. Change all callers.
11469 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
11470 symbol distinction. Use SHN_XINDEX when needed.
11471 (Symbol_table::write_section_symbol): Add symtab_xindex
11472 parameter. Change all callers.
11473 (Symbol_table::sized_write_section_symbol): Likewise. Use
11474 SHN_XINDEX when needed.
11475 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
11477 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
11478 (Symbol::is_defined): Check is_ordinary.
11479 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
11480 (Symbol::is_absolute, Symbol::is_common): Likewise.
11481 (class Sized_symbol): Update declarations.
11482 (class Symbol_table): Update declarations.
11483 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
11484 parameters. Change all callers.
11485 (Sized_symbol::override): Likewise.
11486 (Symbol_table::override): Likewise.
11487 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
11488 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
11489 is_ordinary, and orig_st_shndx parameters. Change all callers.
11490 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
11491 to be in an ordinary section.
11492 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
11493 object and is_ordinary parameters. Change all callers.
11494 (Sized_dwarf_line_info::read_relocs): Add object parameter.
11495 Change all callers. Don't add undefined or non-ordinary symbols
11497 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
11498 Change all callers.
11499 * dwarf_reader.h (class Sized_dwarf_line_info): Update
11501 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
11502 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
11503 (Sized_relobj::relocate_sections): Likewise.
11504 * target-reloc.h (scan_relocs): Adjust section symbol index.
11505 (scan_relocatable_relocs): Likewise.
11506 * i386.cc (Scan::local): Check for ordinary symbols.
11507 * sparc.cc (Scan::local): Likewise.
11508 * x86_64.cc (Scan::local): Likewise.
11509 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
11510 to symbol_section_and_value.
11511 * testsuite/many_sections_test.cc: New file.
11512 * testsuite/Makefile.am (BUILT_SOURCES): Define.
11513 (check_PROGRAMS): Add many_sections_test.
11514 (many_sections_test_SOURCES): Define.
11515 (many_sections_test_DEPENDENCIES): Define.
11516 (many_sections_test_LDFLAGS): Define.
11517 (BUILT_SOURCES): Add many_sections_define.h.
11518 (many_sections_define.h): New target.
11519 (BUILT_SOURCES): Add many_sections_check.h.
11520 (many_sections_check.h): New target.
11521 (check_PROGRAMS): Add many_sections_r_test.
11522 (many_sections_r_test_SOURCES): Define.
11523 (many_sections_r_test_DEPENDENCIES): Define.
11524 (many_sections_r_test_LDFLAGS): Define.
11525 (many_sections_r_test_LDADD): Define.
11526 (many_sections_r_test.o): New target.
11527 * testsuite/Makefile.in: Rebuild.
11529 2008-04-17 Cary Coutant <ccoutant@google.com>
11531 * errors.cc (Errors::info): New function.
11532 (gold_info): New function.
11533 * errors.h (Errors::info): New function.
11534 * gold.h (gold_info): New function.
11535 * object.cc (Input_objects::add_object): Print trace output.
11536 * options.cc (options::parse_set): New function.
11537 (General_options::parse_wrap): Deleted.
11538 (General_options::General_options): Deleted initializer.
11539 * options.h (options::String_set): New typedef.
11540 (options::parse_set): New function.
11541 (DEFINE_set): New macro.
11542 (General_options::wrap): Changed to use DEFINE_set. Changed
11543 callers of any_wrap_symbols and is_wrap_symbol.
11544 (General_options::trace, General_options::trace_symbol):
11546 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
11547 (General_options::wrap_symbols_): Deleted.
11548 * symtab.cc (Symbol_table::add_from_object): Print trace output.
11550 2008-04-17 David S. Miller <davem@davemloft.net>
11552 * options.cc (General_options::parse_V): New function.
11553 * options.h: Add entries for -V and -Qy.
11555 2008-04-17 Ian Lance Taylor <iant@google.com>
11557 * common.cc (Symbol_table::allocate_commons): Remove options
11558 parameter. Change caller.
11559 (Symbol_table::do_allocate_commons): Remove options parameter.
11560 Change caller. Just call do_allocate_commons_list twice.
11561 (Symbol_table::do_allocate_commons_list): New function, broken out
11562 of do_allocate_commons.
11563 * common.h (class Allocate_commons_task): Remove options_ field.
11564 Update constructor.
11565 * symtab.cc (Symbol_table::Symbol_table): Initialize
11567 (Symbol_table::add_from_object): Put TLS common symbols on
11569 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
11570 which are IN_OUTPUT_DATA.
11571 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
11572 allocate_commons and do_allocate_commons declarations. Declare
11573 do_allocate_commons_list.
11574 * gold.cc (queue_middle_tasks): Update creation of
11575 Allocate_commons_task to not pass options.
11576 * testsuite/Makefile.am (INCLUDES): Add -I.. .
11577 (TLS_TEST_C_FLAGS): New variable.
11578 (tls_test_c_pic.o): New target.
11579 (tls_test_shared.so): Link in tls_test_c_pic.o.
11580 (tls_test_c_pic_ie.o): New target.
11581 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
11582 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
11583 (tls_test_c.o): New target.
11584 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
11585 (tls_pic_test_LDADD): Likewise.
11586 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
11587 (tls_shared_gd_to_ie_test_LDADD): Likewise.
11588 (tls_test_c_gnu2.o): New target.
11589 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
11591 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
11592 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
11593 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
11594 * testsuite/tls_test.cc: Include "config.h".
11595 (t_last): Call t11_last.
11596 * testsuite/tls_test.h (t11, t11_last): Declare.
11597 * testsuite/tls_test_c.c: New file.
11598 * testsuite/tls_test_main.cc (thread_routine): Call t11.
11599 * configure.ac: Check for OpenMP support.
11600 * configure, config.in, Makefile.in: Rebuild.
11601 * testsuite/Makefile.in: Rebuild.
11603 2008-04-16 Cary Coutant <ccoutant@google.com>
11605 * i386.cc (Target_i386::define_tls_base_symbol): New function.
11606 (Target_i386::tls_base_symbol_defined_): New field.
11607 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11608 (Target_i386::Scan::global): Likewise.
11609 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
11610 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
11611 (Target_x86_64::tls_base_symbol_defined_): New field.
11612 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11613 (Target_x86_64::Scan::global): Likewise.
11615 2008-04-16 Cary Coutant <ccoutant@google.com>
11617 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
11618 (Symbol::needs_plt_entry): Allow weak undefined symbols.
11619 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
11620 building shared libraries.
11621 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
11622 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
11623 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
11624 * testsuite/Makefile.in: Rebuild.
11625 * testsuite/weak_undef.h: New file.
11626 * testsuite/weak_undef_file1.cc: Add extra test cases.
11627 * testsuite/weak_undef_file2.cc: Likewise.
11628 * testsuite/weak_undef_test.cc: Likewise.
11630 2008-04-16 David S. Miller <davem@davemloft.net>
11632 * sparc.cc (Target_sparc::Scan): Change from struct to class.
11633 Add issued_non_pic_error_ field. Declare check_non_pic.
11634 (Target_sparc::Scan::check_non_pic): New function.
11635 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
11636 (Target_sparc::Scan::global): Likewise.
11638 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
11639 * configure: Rebuild.
11641 * options.h (DEFINE_enable): New macro.
11642 (new_dtags): New enable option.
11643 (initfirst, interpose, loadfltr, nodefaultlib,
11644 nodelete, nodlopen, nodump): New -z options.
11645 * layout.cc (Layout:finish_dynamic_section): If new
11646 dtags enabled, emit DT_RUNPATH. Also, emit a
11647 DT_FLAGS_1 containing any specified -z flags.
11649 2008-04-16 Ian Lance Taylor <iant@google.com>
11651 * copy-relocs.cc: New file.
11652 * copy-relocs.h: New file.
11653 * reloc.cc: Remove Copy_relocs code.
11654 * reloc.h: Likewise.
11655 * reloc-types.h (struct Reloc_types) [both versions]: Add
11656 get_reloc_addend_noerror.
11657 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
11658 variants of add_global which take an addend which must be zero.
11659 * i386.cc: Include "copy-relocs.h".
11660 (class Target_i386): Change type of copy_relocs_ to variable,
11661 update initializer.
11662 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
11663 Change all callers.
11664 (Target_i386::do_finalize_sections): Change handling of
11666 * sparc.cc: Include "copy-relocs.h".
11667 (class Target_sparc): Change type of copy_relocs_ to variable,
11668 update initializer.
11669 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
11670 Change all callers.
11671 (Target_sparc::do_finalize_sections): Change handling of
11673 * x86_64.cc: Include "copy-relocs.h".
11674 (class Target_x86_64): Change type of copy_relocs_ to variable,
11675 update initializer.
11676 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
11677 class. Change all callers.
11678 (Target_x86_64::do_finalize_sections): Change handling of
11680 * Makefile.am (CCFILES): Add copy-relocs.cc.
11681 (HFILES): Add copy-relocs.h.
11683 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
11685 * testsuite/script_test_4.sh: Permit leading zeroes.
11687 2008-04-15 Ian Lance Taylor <iant@google.com>
11689 * script-sections.cc (Script_sections::create_segments): Use
11690 header_size_adjustment even when there is enough room for the
11692 * testsuite/script_test_4.sh: New file.
11693 * testsuite/script_test_4.t: New file.
11694 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
11695 (check_DATA): Add script_test_4.stdout.
11696 (MOSTLYCLEANFILES): Likewise.
11697 (script_test_4): New target.
11698 (script_test_4.stdout): New target.
11699 * testsuite/Makefile.in: Rebuild.
11701 * sparc.cc: Add definitions for Output_data_plt_sparc class
11704 2008-04-14 David S. Miller <davem@davemloft.net>
11706 * sparc.cc: New file.
11707 * Makefile.am (TARGETSOURCES): Add sparc.cc
11708 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
11709 * configure.tgt: Document targ_extra_size and
11710 targ_extra_big_endian. Add entries for sparc-* and
11712 * configure.ac: Handle targ_extra_size and
11713 targ_extra_big_endian.
11714 * Makefile.in: Rebuild.
11715 * configure: Likewise.
11716 * po/POTFILES.in: Likewise.
11717 * po/gold.pot: Likewise.
11719 2008-04-14 Ian Lance Taylor <iant@google.com>
11721 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
11722 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
11723 in the name/type/flags to section mapping. Don't call
11724 allocate_output_section.
11725 (Layout::choose_output_section): Change parameter from adjust_name
11726 to is_input_section. Don't permit input sections after sections
11727 are attached to segments. Don't call allocate_output_section.
11728 (Layout::layout_eh_frame): Call update_flags_for_input_section,
11729 not write_enable_output_section.
11730 (Layout::make_output_section): Don't push to
11731 unattached_section_list_ nor call attach_to_segment. Call
11732 attach_section_to_segment if sections are attached.
11733 (Layout::attach_sections_to_segments): New function.
11734 (Layout::attach_section_to_segment): New function.
11735 (Layout::attach_allocated_section_to_segment): Rename from
11736 attach_to_segment. Remove flags parameter.
11737 (Layout::allocate_output_section): Remove function.
11738 (Layout::write_enable_output_section): Remove function.
11739 * layout.h (class Layout): Update for above changes. Add new
11740 field sections_are_attached_.
11741 * output.h (Output_section::update_flags_for_input_section): New
11743 * output.cc (Output_section::add_input_section): Call
11744 update_flags_for_input_section.
11745 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
11747 2008-04-11 Cary Coutant <ccoutant@google.com>
11749 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
11750 thought unnecessary.
11751 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
11753 2008-04-11 Ian Lance Taylor <iant@google.com>
11755 * output.h (class Output_section_data): Remove inline definition
11757 * output.cc (Output_section_data::set_addralign): New function.
11759 2008-04-11 Cary Coutant <ccoutant@google.com>
11761 Add support for TLS descriptors for i386 and x86_64.
11762 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
11763 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
11764 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
11766 (Target_i386::got_mod_index_entry): Remove unnecessary code.
11767 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
11768 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
11770 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
11771 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
11772 Fix problem with initial-exec relocations.
11773 (Target_i386::Relocate::relocate_tls): Likewise.
11774 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
11776 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
11777 support for section-plus-offset dynamic table entries.
11778 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
11779 (Output_data_dynamic::Dynamic_entry): Add support for
11780 section-plus-offset dynamic table entries.
11781 (Output_data_dynamic::Classification): Likewise.
11782 (Output_data_dynamic::classification_): Renamed offset_.
11783 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
11784 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
11785 (Target_x86_64::make_plt_section): New function.
11786 (Target_x86_64::reserve_tlsdesc_entries): New function.
11787 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
11788 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
11789 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
11790 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
11791 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
11792 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
11793 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
11794 add extra PLT entry for TLS descriptors.
11795 (Output_data_plt_x86_64::got_): New field.
11796 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
11797 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
11799 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
11801 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
11802 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
11803 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
11804 R_386_TLS_DESC_CALL relocations.
11805 (Target_x86_64::Scan::global): Likewise.
11806 (Target_x86_64::do_finalize_sections): Add dynamic table entries
11807 for TLS descriptors.
11808 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
11809 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
11810 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
11811 GD-to-IE relaxation.
11812 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
11813 and TLS_DESCRIPTORS.
11814 * Makefile.in: Rebuild.
11815 * configure: Rebuild.
11816 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
11817 (tls_test_shared2.so): New target.
11818 (tls_shared_gd_to_ie_test_SOURCES): New variable.
11819 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
11820 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
11821 (tls_shared_gd_to_ie_test_LDADD): New variable.
11822 (tls_shared_gnu2_gd_to_ie_test): New target.
11823 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
11825 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
11826 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
11827 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
11828 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
11829 (tls_shared_gnu2_test): New target.
11830 (tls_test_gnu2_shared.so): New target.
11831 (tls_shared_gnu2_test_SOURCES): New variable.
11832 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
11833 (tls_shared_gnu2_test_LDFLAGS): New variable.
11834 (tls_shared_gnu2_test_LDADD): New variable.
11835 * testsuite/Makefile.in: Rebuild.
11836 * testsuite/Makefile.
11838 2008-04-11 Ian Lance Taylor <iant@google.com>
11840 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
11842 * testsuite/Makefile.in: Rebuild.
11844 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
11846 * testsuite/script_test_2.cc (main): Adjust test.
11848 2008-04-11 David S. Miller <davem@davemloft.net>
11849 Ian Lance Taylor <iant@google.com>
11851 * options.h (General_options): Add entries for '-Y' and
11853 * options.cc (General_options:finalize): If -Y was used, add those
11854 entries to the library path instead of the default "/lib" and
11857 2008-04-11 David S. Miller <davem@davemloft.net>
11859 * testsuite/justsyms.t: Start at 0x100.
11860 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
11861 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
11863 * testsuite/script_test_2.cc: Adjust string and section length
11866 2008-04-09 Ian Lance Taylor <iant@google.com>
11869 * script-sections.cc (Sections_element::allocate_to_segment): Add
11871 (Output_section_definition::allocate_to_segment): Likewise.
11872 (Orphan_output_section::allocate_to_segment): Likewise.
11873 (Script_sections::attach_sections_using_phdrs_clause): Don't
11874 propagate non-PT_LOAD segments to orphan sections.
11875 * testsuite/Makefile.am (script_test_3.stdout): Generate using
11876 readelf rather than objdump.
11877 * testsuite/script_test_3.sh: Adjust accordingly. Test that
11878 .interp section and PT_INTERP segment are the same size.
11879 * testsuite/Makefile.in: Rebuild.
11881 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
11882 aliases for symbols defined in the same object.
11883 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
11884 (weak_alias_test_SOURCES): New variable.
11885 (weak_alias_test_DEPENDENCIES): New variable.
11886 (weak_alias_test_LDFLAGS): New variable.
11887 (weak_alias_test_LDADD): New variable.
11888 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
11889 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
11890 (weak_alias_test_3.o): New target.
11891 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
11892 * testsuite/weak_alias_test_main.cc: New file.
11893 * testsuite/weak_alias_test_1.cc: New file.
11894 * testsuite/weak_alias_test_2.cc: New file.
11895 * testsuite/weak_alias_test_3.cc: New file.
11897 2008-04-08 Ian Lance Taylor <iant@google.com>
11899 * options.h (class General_options): Add --noinhibit-exec option.
11900 * main.cc (main): Check --noinhibit-exec.
11902 * options.h (class General_options): Define --wrap as a special
11903 option. Add wrap_symbols_ field.
11904 (General_options::any_wrap_symbols): New function.
11905 (General_options::is_wrap_symbol): New function.
11906 * options.cc (General_options::parse_wrap): New function.
11907 (General_options::General_options): Initialize wrap_symbols_.
11908 * symtab.cc (Symbol_table::wrap_symbol): New function.
11909 (Symbol_table::add_from_object): Handle --wrap.
11910 * symtab.h (class Symbol_table): Declare wrap_symbol.
11911 * target.h (Target::wrap_char): New function.
11912 (Target::Target_info): Add wrap_char field.
11913 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
11914 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11915 * testsuite/testfile.cc (Target_test::test_target_info):
11918 * errors.cc (Errors::undefined_symbol): Mention symbol version if
11921 * layout.h (class Layout): Add added_eh_frame_data_ field.
11922 * layout.cc (Layout::Layout): Initialize new field.
11923 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
11924 output section until we find a section we merged successfully.
11925 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
11926 that the size be non-zero.
11928 * merge.cc (Object_merge_map::get_output_offset): Remove inline
11931 2008-04-08 Craig Silverstein <csilvers@google.com>
11933 * configure.ac: Export new conditional variable HAVE_ZLIB.
11934 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
11936 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
11937 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11939 2008-04-07 Ian Lance Taylor <iant@google.com>
11941 * version.cc (version_string): Set to "1.5".
11943 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
11944 Add issued_non_pic_error_ field. Declare check_non_pic.
11945 (Target_x86_64::Scan::check_non_pic): New function.
11946 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
11947 (Target_x86_64::Scan::global): Likewise.
11949 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
11950 addend parameter. Change caller. Handle merge sections.
11951 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
11952 Address to Addend. Don't add in the result of
11953 local_section_offset, pass down the addend and use the returned
11955 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
11956 Update declarations of local_section_offset and symbol_value.
11957 * testsuite/two_file_test_1.cc (t18): New function.
11958 * testsuite/two_file_test_2.cc (f18): New function.
11959 * testsuite/two_file_test_main.cc (main): Call t18.
11960 * testsuite/two_file_test.h (t18, f18): Declare.
11962 * configure.ac: Don't test for objdump, c++filt, or readelf.
11963 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
11965 (TEST_READELF): New variable.
11966 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
11967 (check_PROGRAMS): Add two_file_strip_test.
11968 (two_file_strip_test): New target.
11969 (check_PROGRAMS): Add two_file_same_shared_strip_test.
11970 (two_file_same_shared_strip_test_SOURCES): New variable.
11971 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
11972 (two_file_same_shared_strip_test_LDFLAGS): New variable.
11973 (two_file_same_shared_strip_test_LDADD): New variable.
11974 (two_file_shared_strip.so): New target.
11975 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
11976 (ver_test_5.syms, ver_test_7.syms): Likewise.
11977 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
11978 (strip_test_3.stdout): Use TEST_OBJDUMP.
11979 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11981 2008-04-04 Cary Coutant <ccoutant@google.com>
11983 * symtab.h (Symbol::is_weak_undefined): New function.
11984 (Symbol::is_strong_undefined): New function.
11985 (Symbol::is_absolute): New function.
11986 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
11987 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
11989 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
11990 (weak_undef_test): New target.
11991 * testsuite/Makefile.in: Rebuild.
11992 * testsuite/weak_undef_file1.cc: New file.
11993 * testsuite/weak_undef_file2.cc: New file.
11994 * testsuite/weak_undef_test.cc: New file.
11996 2008-04-03 Craig Silverstein <csilvers@google.com>
11998 * compressed_output.h (class Output_compressed_section): Use
12000 * compressed_output.cc (zlib_compress): Use unsigned buffers,
12002 (zlib_compressed_suffix): Removed.
12003 (Output_compressed_section::set_final_data_size): Use unsigned
12005 * testsuite/Makefile.am (flagstest_compress_debug_sections):
12006 Fix linker invocation.
12007 (flagstest_o_specialfile_and_compress_debug_sections):
12009 * testsuite/Makefile.in: Regenerated.
12011 2008-04-02 David S. Miller <davem@davemloft.net>
12013 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
12014 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
12016 2008-04-02 Craig Silverstein <csilvers@google.com>
12020 2008-04-02 Ian Lance Taylor <iant@google.com>
12022 * fileread.cc (File_read::find_view): Add byteshift and vshifted
12023 parameters. Update for new key type to views_. Change all
12025 (File_read::read): Adjust for byteshift in returned view.
12026 (File_read::add_view): New function, broken out of
12027 find_and_make_view.
12028 (File_read::make_view): New function, broken out of
12029 find_and_make_view.
12030 (File_read::find_or_make_view): Add offset and aligned
12031 parameters. Rewrite accordingly. Change all callers.
12032 (File_read::get_view): Add offset and aligned parameters. Adjust
12033 for byteshift in return value.
12034 (File_read::get_lasting_view): Likewise.
12035 * fileread.h (class File_read): Update declarations.
12036 (class File_read::View): Add byteshift_ field. Add byteshift to
12037 constructor. Add byteshift method.
12038 * archive.h (Archive::clear_uncached_views): New function.
12039 (Archive::get_view): Add aligned parameter. Change all callers.
12040 * object.h (Object::get_view): Add aligned parameter. Change all
12042 (Object::get_lasting_view): Likewise.
12044 * fileread.cc (File_read::release): Don't call clear_views if
12045 there are multiple objects.
12046 * fileread.h (File_read::clear_uncached_views): New function.
12047 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
12050 2008-03-31 Cary Coutant <ccoutant@google.com>
12052 Add thin archive support.
12053 * archive.cc (Archive::armagt): New const.
12054 (Archive::setup): Remove task parameter and calls to unlock.
12055 (Archive::unlock_nested_archives): New function.
12056 (Archive::read_header): Add nested_off parameter. Change
12058 (Archive::interpret_header): Likewise.
12059 (Archive::include_all_members): Change to handle thin
12061 (Archive::include_member): Likewise.
12062 * archive.h (Archive::Archive): Add new parameters and
12064 (Archive::armagt): New const.
12065 (Archive::setup): Remove task parameter.
12066 (Archive::unlock_nested_archives): New function.
12067 (Archive::read_header): Add nested_off parameter.
12068 (Archive::interpret_header): Likewise.
12069 (Archive::Nested_archive_table): New typedef.
12070 (Archive::is_thin_archive_): New field.
12071 (Archive::nested_archives_): New field.
12072 (Archive::options_): New field.
12073 (Archive::dirpath_): New field.
12074 (Archive::task_): New field.
12075 * readsyms.cc (Read_symbols::do_read_symbols): Add check
12076 for thin archives. Pass additional parameters to
12077 Archive::Archive. Unlock the archive file after calling
12080 2008-03-29 Ian Lance Taylor <iant@google.com>
12082 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12083 version symbol to be local.
12084 * testsuite/ver_test_4.sh: New file.
12085 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12086 (check_DATA): Add ver_test_4.syms.
12087 (ver_test_4.syms): New target.
12088 * testsuite/Makefile.in: Rebuild.
12091 (Output_section::Input_section_sort_entry::has_priority): New
12093 (Output_section::Input_section_sort_entry::match_file_name): New
12095 (Output_section::Input_section_sort_entry::match_section_name):
12097 (Output_section::Input_section_sort_entry::match_section_name_prefix):
12099 (Output_section::Input_section_sort_entry::match_section_file):
12101 (Output_section::Input_section_sort_compare::operator()): Rewrite
12102 using new Input_section_sort_entry functions. Sort crtbegin and
12103 crtend first. Sort sections with no priority before sections with
12105 * testsuite/initpri1.c (d3): Check j != 4.
12106 (cd5): New constructor/destructor function.
12107 (main): Check j != 2.
12109 * symtab.cc (Symbol_table::add_from_object): If we don't use the
12110 new symbol when resolving, don't call set_is_default.
12111 * testsuite/ver_test_7.cc: New file.
12112 * testsuite/ver_test_7.sh: New file.
12113 * testsuite/Makefile.am (ver_test_7.so): New target.
12114 (ver_test_7.o): New target.
12115 (check_SCRIPTS): Add ver_test_7.sh.
12116 (check_DATA): Add ver_test_7.syms.
12117 (ver_test_7.syms): New target.
12119 2008-03-28 Ian Lance Taylor <iant@google.com>
12121 * layout.cc (Layout::layout): If we see an input section with a
12122 name that needs sorting, set the must_sort flag for the output
12124 (Layout::make_output_section): If the name of the output section
12125 indicates that it might require sorting, set the may_sort flag.
12126 * output.h (Output_section::may_sort_attached_input_sections): New
12128 (Output_section::set_may_sort_attached_input_sections): New
12130 (Output_section::must_sort_attached_input_sections): New
12132 (Output_section::set_must_sort_attached_input_sections): New
12134 (class Output_section): Declare Input_section_sort_entry. Define
12135 Input_section_sort_compare. Declare
12136 sort_attached_input_sections. Add new fields:
12137 may_sort_attached_input_sections_,
12138 must_sort_attached_input_sections_,
12139 attached_input_sections_are_sorted_.
12140 * output.cc (Output_section::Output_section): Initialize new
12142 (Output_section::add_input_section): Add an entry to
12143 input_sections_ if may_sort or must_sort are true.
12144 (Output_section::set_final_data_size): Call
12145 sort_attached_input_sections if necessary.
12146 (Output_section::Input_section_sort_entry): Define new class.
12147 (Output_section::Input_section_sort_compare::operator()): New
12149 (Output_section::sort_attached_input_sections): New function.
12150 * configure.ac: Check whether the compiler supports constructor
12151 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
12152 * testsuite/initpri1.c: New file.
12153 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
12154 CONSTRUCTOR_PRIORITY.
12155 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
12156 (initpri1_LDFLAGS): New variable.
12157 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12159 2008-03-27 Ian Lance Taylor <iant@google.com>
12161 * common.cc (Sort_commons::operator): Correct sorting algorithm.
12162 * testsuite/common_test_1.c: New file.
12163 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
12164 (common_test_1_SOURCES): New variable.
12165 (common_test_1_DEPENDENCIES): New variable.
12166 (common_test_1_LDFLAGS): New variable.
12168 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
12169 and commons_ correctly when NAME/VERSION does not override
12171 * testsuite/ver_test_6.c: New file.
12172 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
12173 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
12174 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
12176 2008-03-26 Ian Lance Taylor <iant@google.com>
12178 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
12179 of an undefined symbol from a version script.
12180 * testsuite/Makefile.am (ver_test_5.so): New target.
12181 (ver_test_5.o): New target.
12182 (check_SCRIPTS): Add ver_test_5.sh.
12183 (check_DATA): Add ver_test_5.syms.
12184 (ver_test_5.syms): New target.
12185 * testsuite/ver_test_5.cc: New file.
12186 * testsuite/ver_test_5.script: New file.
12187 * testsuite/ver_test_5.sh: New file.
12188 * Makefile.in, testsuite/Makefile.in: Rebuild.
12191 Fix problems building gold with gcc 4.3.0.
12192 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
12193 (gold_error_at_location, gold_warning_at_location): Use it.
12194 * configure.ac: Check whether we can compile and use a template
12195 function with a printf attribute.
12196 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
12197 when jumping over bytes.
12198 * object.cc: Instantiate Object::read_section_data.
12199 * debug.h: Include <cstring>
12200 * dwarf_reader.cc: Include <algorithm>
12201 * main.cc: Include <cstring>.
12202 * options.cc: Include <cstring>.
12203 * output.cc: Include <cstring>.
12204 * script.cc: Include <cstring>.
12205 * script.h: Include <string>.
12206 * symtab.cc: Include <cstring> and <algorithm>.
12207 * target-select.cc: Include <cstring>.
12208 * version.cc: Include <string>.
12209 * testsuite/testmain.cc: Include <cstdlib>.
12210 * configure, config.in: Rebuild.
12212 2008-03-25 Ian Lance Taylor <iant@google.com>
12214 * options.cc: Include "../bfd/bfdver.h".
12215 (options::help): Print bug reporting address.
12217 * version.cc (print_version): Adjust output for current value of
12218 BFD_VERSION_STRING.
12222 * options.cc (options::help): Print list of supported targets.
12223 * target-select.h: Include <vector>.
12224 (class Target_selector): Make machine_, size_, and is_big_endian_
12225 fields const. Add bfd_name_ and instantiated_target_ fields.
12226 (Target_selector::Target_selector): Add bfd_name parameter.
12227 (Target_selector::recognize): Make non-virtual, call
12229 (Target_selector::recognize_by_name): Make non-virtual, call
12230 do_recognize_by_name.
12231 (Target_selector::supported_names): New function.
12232 (Target_selector::bfd_name): New function.
12233 (Target_selector::do_instantiate_target): New pure virtual
12235 (Target_selector::do_recognize): New virtual function.
12236 (Target_selector::do_recognize_by_name): New virtual function.
12237 (Target_selector::instantiate_target): New private function.
12238 (supported_target_names): Declare.
12239 * target-select.cc (Target_selector::Target_selector): Update for
12240 new parameter and fields.
12241 (select_target_by_name): Check that the name matches before
12242 calling recognize_by_name.
12243 (supported_target_names): New function.
12244 * i386.cc (class Target_selector_i386): Update Target_selector
12245 constructor call. Remove recognize and recognize_by_name. Add
12246 do_instantiate_target.
12247 * x86_64.cc (class Target_selector_x86_64): Likewise.
12248 * testsuite/testfile.cc (class Target_selector_test): Update for
12249 changes to Target_selector.
12251 * README: Rewrite, with some notes on unsupported features.
12253 2008-03-24 Cary Coutant <ccoutant@google.com>
12255 * i386.cc (Target_i386::Got_type): New enum declaration.
12256 (Target_i386::Scan::local): Updated callers of Output_data_got
12258 (Target_i386::Scan::global): Likewise.
12259 (Target_i386::Relocate::relocate): Likewise.
12260 (Target_i386::Relocate::relocate_tls): Likewise.
12261 * object.h (Got_offset_list): New class.
12262 (Sized_relobj::local_has_got_offset): Added got_type parameter.
12263 (Sized_relobj::local_got_offset): Likewise.
12264 (Sized_relobj::set_local_got_offset): Likewise.
12265 (Sized_relobj::local_has_tls_got_offset): Removed.
12266 (Sized_relobj::local_tls_got_offset): Removed.
12267 (Sized_relobj::set_local_tls_got_offset): Removed.
12268 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
12269 * output.cc (Output_data_got::add_global): Added got_type parameter.
12270 (Output_data_got::add_global_with_rel): Likewise.
12271 (Output_data_got::add_global_with_rela): Likewise.
12272 (Output_data_got::add_global_pair_with_rel): New function.
12273 (Output_data_got::add_global_pair_with_rela): New function.
12274 (Output_data_got::add_local): Added got_type parameter.
12275 (Output_data_got::add_local_with_rel): Likewise.
12276 (Output_data_got::add_local_with_rela): Likewise.
12277 (Output_data_got::add_local_pair_with_rel): New function.
12278 (Output_data_got::add_local_pair_with_rela): New function.
12279 (Output_data_got::add_global_tls): Removed.
12280 (Output_data_got::add_global_tls_with_rel): Removed.
12281 (Output_data_got::add_global_tls_with_rela): Removed.
12282 (Output_data_got::add_local_tls): Removed.
12283 (Output_data_got::add_local_tls_with_rel): Removed.
12284 (Output_data_got::add_local_tls_with_rela): Removed.
12285 * output.h (Output_data_got::add_global): Added got_type parameter.
12286 (Output_data_got::add_global_with_rel): Likewise.
12287 (Output_data_got::add_global_with_rela): Likewise.
12288 (Output_data_got::add_global_pair_with_rel): New function.
12289 (Output_data_got::add_global_pair_with_rela): New function.
12290 (Output_data_got::add_local): Added got_type parameter.
12291 (Output_data_got::add_local_with_rel): Likewise.
12292 (Output_data_got::add_local_with_rela): Likewise.
12293 (Output_data_got::add_local_pair_with_rel): New function.
12294 (Output_data_got::add_local_pair_with_rela): New function.
12295 (Output_data_got::add_global_tls): Removed.
12296 (Output_data_got::add_global_tls_with_rel): Removed.
12297 (Output_data_got::add_global_tls_with_rela): Removed.
12298 (Output_data_got::add_local_tls): Removed.
12299 (Output_data_got::add_local_tls_with_rel): Removed.
12300 (Output_data_got::add_local_tls_with_rela): Removed.
12301 * resolve.cc (Symbol::override_base_with_special): Removed
12302 reference to has_got_offset_ field.
12303 * symtab.cc (Symbol::init_fields): Replaced initialization
12304 of got_offset_ with got_offsets_. Removed initialization
12306 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
12307 (Symbol::got_offset): Likewise.
12308 (Symbol::set_got_offset): Likewise.
12309 (Symbol::has_tls_got_offset): Removed.
12310 (Symbol::tls_got_offset): Removed.
12311 (Symbol::set_tls_got_offset): Removed.
12312 (Symbol::got_offset_): Removed.
12313 (Symbol::tls_mod_got_offset_): Removed.
12314 (Symbol::tls_pair_got_offset_): Removed.
12315 (Symbol::got_offsets_): New field.
12316 (Symbol::has_got_offset): Removed.
12317 (Symbol::has_tls_mod_got_offset): Removed.
12318 (Symbol::has_tls_pair_got_offset): Removed.
12319 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
12320 (Target_x86_64::Scan::local): Updated callers of Output_data_got
12322 (Target_x86_64::Scan::global): Likewise.
12323 (Target_x86_64::Relocate::relocate): Likewise.
12324 (Target_x86_64::Relocate::relocate_tls): Likewise.
12326 2008-03-25 Ben Elliston <bje@au.ibm.com>
12328 * yyscript.y: Fix spelling error in comment.
12330 2008-03-24 Ian Lance Taylor <iant@google.com>
12332 * options.h (class General_options): Define build_id option.
12333 * layout.h (class Layout): Declare write_build_id, create_note,
12334 create_build_id. Add build_id_note_ member.
12335 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
12336 "libiberty.h", "md5.h", "sha1.h".
12337 (Layout::Layout): Initialize eh_frame_data_,
12338 eh_frame_hdr_section_, and build_id_note_.
12339 (Layout::finalize): Call create_build_id.
12340 (Layout::create_note): New function, broken out of
12341 Layout::create_gold_note.
12342 (Layout::create_gold_note): Call create_note.
12343 (Layout::create_build_id): New function.
12344 (Layout::write_build_id): New function.
12345 (Close_task_runner::run): Call write_build_id.
12347 * x86_64.cc: Correct license to GPLv3.
12349 2008-03-23 Ian Lance Taylor <iant@google.com>
12351 * options.cc: Include "demangle.h".
12352 (parse_optional_string): New function.
12353 (parse_long_option): Handle takes_optional_argument.
12354 (parse_short_option): Update dash_z initializer. Handle
12355 takes_optional_argument.
12356 (General_options::General_options): Initialize do_demangle_.
12357 (General_options::finalize): Set do_demangle_. Handle demangling
12359 * options.h (parse_optional_string): Declare.
12360 (struct One_option): Add optional_arg field. Update constructor.
12361 Update call constructor calls. Add takes_optional_argument
12363 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
12364 (DEFINE_optional_string): Define.
12365 (General_options::demangle): Change from DEFINE_bool to
12366 DEFINE_optional_string.
12367 (General_options::no_demangle): New function.
12368 (General_options::do_demangle): New function.
12369 (General_options::set_do_demangle): New function.
12370 (General_options::execstack_status_): Move definition to end of
12372 (General_options::static_): Likewise.
12373 (General_options::do_demangle_): New field.
12374 * object.cc (big_endian>::get_symbol_location_info): Call
12375 Options::do_demangle, not Options::demangle.
12376 * symtab.cc (demangle): Likewise.
12378 2008-03-22 Ian Lance Taylor <iant@google.com>
12380 * gold.h: Include <cstddef> and <sys/types.h>
12381 * options.h: Include <cstring>.
12383 2008-03-21 Ian Lance Taylor <iant@google.com>
12385 * Added source code to GNU binutils.