1 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
3 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
4 (Relocate::tls_gd_to_le): Likewise.
6 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
8 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
10 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
12 * configure.ac: Check if -mcmodel=medium works.
13 * configure: Regenerated.
15 2012-01-24 Cary Coutant <ccoutant@google.com>
17 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
19 (read_unsigned_LEB_128_x): ... this new function.
20 (read_signed_LEB_128): Replaced with inline definition and ...
21 (read_signed_LEB_128_x): ... this new function.
22 * int_encoding.h (read_unsigned_LEB_128_x): New function.
23 (read_unsigned_LEB_128): Add inline definition.
24 (read_signed_LEB_128_x): New function.
25 (read_signed_LEB_128): Add inline definition.
26 * testsuite/Makefile.am (leb128_unittest): New unit test.
27 * testsuite/Makefile.in: Regenerate.
28 * testsuite/leb128_unittest.cc: New unit test.
30 2012-01-23 Ian Lance Taylor <iant@google.com>
33 * i386.cc (Target_i386::do_code_fill): When using a jmp
34 instruction, pad with nop instructions.
35 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
37 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
39 * x86_64.cc (gc_process_relocs): Add typename on types used in
41 (scan_relocs): Likewise.
42 (relocate_section): Likewise.
43 (apply_relocation): Likewise.
45 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
47 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
48 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
51 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
53 * x86_64.cc: Initial support for x32.
55 2012-01-03 Cary Coutant <ccoutant@google.com>
57 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
58 Use abstract base class for GOT.
59 * gold/output.h (class Output_data_got_base): New abstract base class.
60 (class Output_data_got): Derive from new base class, adjust ctors.
61 (Output_data_got::reserve_slot): Make virtual; rename to
62 do_reserve_slot; Adjust callers.
63 * gold/target.h (Sized_target::init_got_plt_for_update): Return
64 pointer to abstract base class.
65 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
67 2011-12-18 Ian Lance Taylor <iant@google.com>
69 * object.h (Relobj::local_symbol_value): New function.
70 (Relobj::local_plt_offset): New function.
71 (Relobj::local_has_got_offset): New function.
72 (Relobj::local_got_offset): New function.
73 (Relobj::set_local_got_offset): New function.
74 (Relobj::do_local_symbol_value): New pure virtual function.
75 (Relobj::do_local_plt_offset): Likewise.
76 (Relobj::do_local_has_got_offset): Likewise.
77 (Relobj::do_local_got_offset): Likewise.
78 (Relobj::do_set_local_got_offset): Likewise.
79 (Sized_relobj::do_local_has_got_offset): Rename from
81 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
82 (Sized_relobj::do_set_local_got_offset): Rename from
84 (Sized_relobj_file::do_local_plt_offset): Rename from
86 (Sized_relobj_file::do_local_symbol_value): New function.
87 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
89 * output.cc (Output_data_got::Got_entry::write): Change object to
90 Relobj. Use local_symbol_value.
91 (Output_data_got::add_global_with_rel): Change rel_dyn to
92 Output_data_reloc_generic*. Use add_global_generic.
93 (Output_data_got::add_global_with_rela): Remove. Change all
94 callers to use add_global_with_rel.
95 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
96 Output_data_reloc_generic*. Use add_global_generic.
97 (Output_data_got::add_global_pair_with_rela): Remove. Change all
98 callers to use add_global_pair_with_rel.
99 (Output_data_got::add_local): Change object to Relobj*.
100 (Output_data_got::add_local_plt): Likewise.
101 (Output_data_got::add_local_with_rel): Change object to Relobj*,
102 change rel_dyn to Output_data_reloc_generic*. Use
104 (Output_data_got::add_local_with_rela): Remove. Change all
105 callers to use all_local_with_rel.
106 (Output_data_got::add_local_pair_with_rel): Change object to
107 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
108 add_output_section_generic.
109 (Output_data_got::add_local_pair_with_rela): Remove. Change all
110 callers to use add_local_pair_with_rel.
111 (Output_data_got::reserve_local): Change object to Relobj*.
112 * output.h: (class Output_data_reloc_generic): Add pure virtual
113 declarations for add_global_generic, add_local_generic,
114 add_output_section_generic.
115 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
116 functions for Output_data_reloc_generic. Update declarations for
117 changes listed in output.cc.
118 (class Output_data_got): Change template parameter to got_size.
119 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
120 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
122 (Sized_relobj_incr::do_local_plt_offset): New function.
123 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
126 2011-12-17 Cary Coutant <ccoutant@google.com>
128 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
129 * resolve.cc (Symbol_table::resolve): Likewise.
130 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
132 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
134 2011-12-16 Ian Lance Taylor <iant@google.com>
136 * output.h (Output_data_reloc_generic::add): Only call
137 add_dynamic_reloc if this is a dynamic reloc section.
139 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
142 * target-reloc.h (apply_relocation): Replace <64, false> with
145 2011-11-25 Nick Clifton <nickc@redhat.com>
147 * po/it.po: New Italian translation.
149 2011-11-17 Sterling Augustine <saugustine@google.com>
151 * script.cc (script_include_directive): Implement.
152 (read_script_file): New local variables name and search_path. Update
153 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
154 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
155 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
157 2011-11-11 Sterling Augustine <saugustine@google.com>
159 * yyscript.y (section_cmd): Add support for INCLUDE directive.
160 (file_or_sections_cmd): Likewise.
162 2011-11-11 Doug Kwan <dougkwan@google.com>
164 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
165 if --just-symbols is given.
167 2011-11-10 Doug Kwan <dougkwan@google.com>
170 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
171 when processing data relocs.
172 * reloc.h (Relocate_functions::rel_unaligned): New method.
173 (Relocate_functions::pcrel_unaligned): Ditto.
174 (Relocate_functions::rel32_unaligned): Ditto.
175 (Relocate_functions::pcrel32_unaligned): Ditto.
177 2011-11-09 Doug Kwan <dougkwan@google.com>
180 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
181 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
182 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
183 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
184 (Relocate_functions::rel_unaligned): New.
185 (Relocate_functions::rel32_unaligned): New.
186 * target-reloc.h (relocate_for_relocatable): Add code to handle
187 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
188 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
189 arm_unaligned_reloc_r): New targets.
190 * testsuite/Makefile.in: Regenerate.
191 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
194 2011-11-02 Ian Lance Taylor <iant@google.com>
196 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
198 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
199 * options.cc (General_options::finalize): Use library search path
200 from configure script if specified. If not native and no sysroot,
201 only search TOOLLIBDIR.
202 * options.h (Search_directory::Search_directory): Change name to
204 (General_options::add_to_library_path_with_sysroot): Change arg to
206 * configure, Makefile.in, config.in: Rebuild.
208 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
210 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
211 we are working around the ARM1176 Erratum.
212 * options.h (General_options::fix_arm1176): Add option.
213 * testsuite/Makefile.am: Add testcases, and keep current ones
215 * testsuite/Makefile.in: Regenerate.
216 * testsuite/arm_fix_1176.s: New file.
217 * testsuite/arm_fix_1176.sh: Likewise.
219 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
221 * arm.cc (Target_arm::Target_arm): Remove initialisation of
223 (Target_arm::may_use_blx): Remove method.
224 (Target_arm::set_may_use_blx): Likewise.
225 (Target_arm::may_use_v4t_interworking): New method.
226 (Target_arm::may_use_v5t_interworking): Likewise.
227 (Target_arm::may_use_blx_): Remove member variable.
228 (Arm_relocate_functions::arm_branch_common): Check for v5T
230 (Arm_relocate_functions::thumb_branch_common): Likewise.
231 (Reloc_stub::stub_type_for_reloc): Likewise.
232 (Target_arm::do_finalize_sections): Correct interworking checks.
233 * testsuite/Makefile.am: Add new tests.
234 * testsuite/Makefile.in: Regenerate.
235 * testsuite/arm_farcall_arm_arm.s: New test.
236 * testsuite/arm_farcall_arm_arm.sh: Likewise.
237 * testsuite/arm_farcall_arm_thumb.s: Likewise.
238 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
239 * testsuite/arm_farcall_thumb_arm.s: Likewise.
240 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
241 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
242 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
244 2011-10-31 Cary Coutant <ccoutant@google.com>
247 * expression.cc (Expression::eval_with_dot): Add
248 is_section_dot_assignment parameter.
249 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
250 absolute and assigning to dot within a section.
252 (Output_section_element_assignment::set_section_addresses): Pass
253 dot_section to set_if_absolute.
254 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
255 as is_section_dot_assignment flag to eval_with_dot.
256 (Output_section_element_dot_assignment::set_section_addresses):
258 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
259 parameter. Also set value if relative to dot_section; set the
260 symbol's output_section.
261 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
262 parameter. Adjust all callers.
263 (Expression::eval_maybe_dot): Likewise.
264 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
266 * testsuite/script_test_2.t: Test assignment of an absolute value
267 to dot within an output section element.
269 2011-10-31 Cary Coutant <ccoutant@google.com>
271 * options.h (class General_options): Add --[no-]gnu-unique options.
272 * symtab.cc (Symbol_table::sized_write_globals): Convert
273 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
275 2011-10-31 Cary Coutant <ccoutant@google.com>
278 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
279 unnecessary assertion.
280 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
282 2011-10-31 Sriraman Tallam <tmsriram@google.com>
284 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
286 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
288 Change to just keep the section associated with symbol.
289 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
290 they are externally visible and --export-dynamic is turned on.
291 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
293 2011-10-19 Ian Lance Taylor <iant@google.com>
297 (Output_section_element_dot_assignment::needs_output_section): New
300 2011-10-19 Ian Lance Taylor <iant@google.com>
303 * layout.cc (Layout::segment_precedes): Don't assert failure if a
304 --section-start option was seen.
305 * options.h (General_options::any_section_start): New function.
307 2011-10-18 David S. Miller <davem@davemloft.net>
310 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
311 member to track relocation locations that have moved during TLS
313 (Target_sparc::Relocate::Relocate): Initialize to NULL.
314 (Target_sparc::Relocate::relocate): Adjust view down by 4
315 bytes if it matches reloc_adjust_addr_.
316 (Target_sparc::Relocate::relocate_tls): Always move the
317 __tls_get_addr call delay slot instruction forward 4 bytes when
318 performing relaxation.
320 2011-10-18 Cary Coutant <ccoutant@google.com>
322 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
323 (Output_file::map_no_anonymous): Check for non-zero
324 return code from posix_fallocate.
326 2011-10-17 Cary Coutant <ccoutant@google.com>
329 * plugin.cc (is_visible_from_outside): Check for symbols
330 referenced from dynamic objects.
331 * resolve.cc (Symbol_table::resolve): Don't count references
332 from dynamic objects as references from real ELF files.
333 * testsuite/plugin_test_2.sh: Adjust expected result.
335 2011-10-17 Cary Coutant <ccoutant@google.com>
337 * gold.cc: Include timer.h.
338 (queue_middle_tasks): Stamp time.
339 (queue_final_tasks): Likewise.
340 * main.cc (main): Store timer in parameters. Print timers
342 * parameters.cc (Parameters::Parameters): Initialize timer_.
343 (Parameters::set_timer): New function.
344 (set_parameters_timer): New function.
345 * parameters.h (Parameters::set_timer): New function.
346 (Parameters::timer): New function.
347 (Parameters::timer_): New data member.
348 (set_parameters_timer): New function.
349 * timer.cc (Timer::stamp): New function.
350 (Timer::get_pass_time): New function.
351 * timer.h (Timer::stamp): New function.
352 (Timer::get_pass_time): New function.
353 (Timer::pass_times_): New data member.
355 2011-10-17 Cary Coutant <ccoutant@google.com>
357 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
358 task for members of lib groups.
360 2011-10-17 Cary Coutant <ccoutant@google.com>
363 * fileread.cc (File_read::find_view): Add assert.
364 (File_read::make_view): Move bounds check (replace with assert)...
365 (File_read::find_or_make_view): ... to here.
367 2011-10-12 Cary Coutant <ccoutant@google.com>
369 * output.cc (Output_file::open_base_file): Handle case where
370 ::read returns less than requested size.
372 2011-10-10 Cary Coutant <ccoutant@google.com>
374 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
375 Initialize defined_count_.
376 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
377 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
378 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
379 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
380 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
381 * incremental.h (Sized_relobj_incr::defined_count_): New data
383 (Sized_incr_dynobj::defined_count_): New data member.
384 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
385 Return zeroes instead of internal error.
387 2011-10-10 Cary Coutant <ccoutant@google.com>
390 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
391 (Output_reloc::symbol_value): Return PLT offset if flag is set.
392 * output.h (class Output_reloc): Add use_plt_offset flag.
393 (Output_reloc::type_): Adjust size of bit field.
394 (Output_reloc::use_plt_offset_): New bit field.
395 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
396 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
397 flag. Adjust all callers.
398 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
399 creating RELATIVE relocations.
401 2011-10-10 Nick Clifton <nickc@redhat.com>
403 * po/es.po: Updated Spanish translation.
404 * po/fi.po: Updated Finnish translation.
406 2011-10-03 Diego Novillo <dnovillo@google.com>
408 * options.cc (parse_uint): Fix dereference of RETVAL.
410 2011-09-29 Sriraman Tallam <tmsriram@google.com>
412 * layout.h (section_order_map_): New member.
413 (get_section_order_map): New member function.
414 * output.cc (Output_section::add_input_section): Check for patterns
415 only when --section-ordering-file is specified.
416 * gold.cc (queue_middle_tasks): Delay updating order of sections till
417 output_sections have been formed.
418 * layout.cc (Layout_Layout): Initialize section_order_map_.
419 * plugin.cc (update_section_order): Store order in order_map. Do not
421 * testsuite/Makefile.am: Add test case for plugin_final_layout.
422 * testsuite/Makefile.in: Regenerate.
423 * testsuite/plugin_section_order.c: New file.
424 * testsuite/plugin_final_layout.cc: New file.
425 * testsuite/plugin_final_layout.sh: New file.
427 2011-09-29 Cary Coutant <ccoutant@google.com>
429 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
431 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
432 symbols during incremental update.
433 (Symbol_table::add_from_dynobj): Likewise.
435 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
436 Ian Lance Taylor <iant@google.com>
438 * symtab.cc (Symbol_table::define_special_symbol): Always
439 canonicalize version string.
441 2011-09-26 Cary Coutant <ccoutant@google.com>
443 * gold.cc (queue_initial_tasks): Move option checks ...
444 * options.cc (General_options::finalize): ... to here. Disable
445 some options; make others fatal.
447 2011-09-26 Cary Coutant <ccoutant@google.com>
450 * plugin.cc (get_symbols_v2): New function.
451 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
452 (is_referenced_from_outside): New function.
453 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
454 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
455 (get_symbols): Pass version parameter.
456 (get_symbols_v2): New function.
457 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
459 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
460 (onload): Add LDPT_GET_SYMBOLS_V2.
461 (all_symbols_read_hook): Use get_symbols_v2; check for
462 LDPR_PREVAILING_DEF_IRONLY_EXP.
463 * testsuite/plugin_test_3.sh: Update expected results.
465 2011-09-23 Simon Baldwin <simonb@google.com>
467 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
468 configuration options.
469 * configure: Regenerate.
470 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
471 * Makefile.in: Regenerate.
472 * testsuite/Makefile.in: Regenerate.
474 2011-09-19 Sriraman Tallam <tmsriram@google.com>
476 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
478 2011-09-19 Cary Coutant <ccoutant@google.com>
480 * incremental.cc (can_incremental_update): Fix typo in comment.
481 * incremental.h (can_incremental_update): Likewise.
483 2011-09-18 Cary Coutant <ccoutant@google.com>
485 * incremental.cc (can_incremental_update): New function.
486 * incremental.h (can_incremental_update): New function.
487 * layout.cc (Layout::init_fixed_output_section): Call it.
488 (Layout::make_output_section): Don't allow patch space in .eh_frame.
489 * object.cc (Sized_relobj_file::do_layout): Call
490 can_incremental_update.
492 2011-09-13 Cary Coutant <ccoutant@google.com>
494 * configure.ac: Check for glibc support for gnu_indirect_function
495 support with static linking, setting automake conditional
497 * Makefile.in: Regenerate.
498 * configure: Regenerate.
500 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
501 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
503 * testsuite/Makefile.in: Regenerate.
505 2011-09-13 Cary Coutant <ccoutant@google.com>
507 * incremental.cc (Sized_relobj_incr::do_layout): Call
508 report_comdat_group for kept comdat sections.
509 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
510 * testsuite/Makefile.in: Regenerate.
511 * testsuite/incr_comdat_test_1.cc: New source file.
512 * testsuite/incr_comdat_test_2_v1.cc: New source file.
513 * testsuite/incr_comdat_test_2_v2.cc: New source file.
514 * testsuite/incr_comdat_test_2_v3.cc: New source file.
516 2011-09-13 Ian Lance Taylor <iant@google.com>
518 * object.cc (Sized_relobj_file::do_layout): Remove unused local
519 variable external_symbols_offset.
521 2011-09-12 Ian Lance Taylor <iant@google.com>
523 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
524 triggered if object has no symbols.
526 2011-09-09 David S. Miller <davem@davemloft.net>
528 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
529 (Output_fill_debug_line::do_write): Likewise.
531 2011-08-29 Cary Coutant <ccoutant@google.com>
533 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
534 casts to match formatting specs.
535 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
537 2011-08-26 Cary Coutant <ccoutant@google.com>
539 * layout.cc (Free_list::allocate): Provide guarantee of minimum
540 remaining hole size when allocating.
541 (Layout::make_output_section): Set fill methods for debug sections.
542 * layout.h (Free_list::Free_list_node): Move from private to
544 (Free_list::set_min_hole_size): New function.
545 (Free_list::begin, Free_list::end): New functions.
546 (Free_list::min_hole_): New data member.
547 * output.cc: Include dwarf.h.
548 (Output_fill_debug_info::do_minimum_hole_size): New function.
549 (Output_fill_debug_info::do_write): New function.
550 (Output_fill_debug_line::do_minimum_hole_size): New function.
551 (Output_fill_debug_line::do_write): New function.
552 (Output_section::Output_section): Initialize new data member.
553 (Output_section::set_final_data_size): Ensure patch space is larger
554 than minimum hole size.
555 (Output_section::do_write): Fill holes in debug sections.
556 * output.h (Output_fill): New class.
557 (Output_fill_debug_info): New class.
558 (Output_fill_debug_line): New class.
559 (Output_section::set_free_space_fill): New function.
560 (Output_section::free_space_fill_): New data member.
561 * testsuite/Makefile.am (incremental_test_3): Add
562 --incremental-patch option.
563 (incremental_test_4): Likewise.
564 (incremental_test_5): Likewise.
565 (incremental_test_6): Likewise.
566 (incremental_copy_test): Likewise.
567 (incremental_common_test_1): Likewise.
568 * testsuite/Makefile.in: Regenerate.
570 2011-08-26 Nick Clifton <nickc@redhat.com>
572 * po/es.po: Updated Spanish translation.
574 2011-08-01 Cary Coutant <ccoutant@google.com>
576 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
577 * gold/testsuite/Makefile.in: Regenerate.
578 * gold/testsuite/justsyms_exec.c: New source file.
579 * gold/testsuite/justsyms_lib.c: New source file.
581 2011-08-01 Cary Coutant <ccoutant@google.com>
583 * layout.cc (Layout::set_segment_offsets): Don't realign text
584 segment if -Ttext was specified.
585 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
587 * object.h (Sized_relobj_file::e_type): New function.
588 (Sized_relobj_file::e_type_): New data member.
589 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
590 base address for ET_EXEC files.
591 * target.cc (Target::do_make_elf_object_implementation): Allow
592 ET_EXEC files with --just-symbols option.
594 2011-07-28 Cary Coutant <ccoutant@google.com>
596 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
597 Add thread_number parameter.
598 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
599 * workqueue-threads.cc
600 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
601 current thread if its thread number is greater than desired thread
603 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
604 Add thread_number parameter.
605 (Workqueue::should_cancel_thread): Likewise.
606 (Workqueue::find_runnable_or_wait): Pass thread_number to
607 should_cancel_thread.
608 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
611 2011-07-22 Sriraman Tallam <tmsriram@google.com>
613 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
614 only after checking if it cannot be forced local.
615 * symtab.h (is_externally_visible): Check if the symbol is not forced
618 2011-07-15 Ian Lance Taylor <iant@google.com>
620 * options.h (class General_options): Add --print-output-format.
621 Move -EL next to -EB, for better --help output.
622 * target-select.cc: Include <cstdio>, "options.h", and
624 (Target_selector::do_target_bfd_name): New function.
625 (print_output_format): New function.
626 * target-select.h (class Target_selector): Update declarations.
627 (Target_selector::target_bfd_name): New function.
628 (print_output_format): Declare.
629 * main.cc: Include "target-select.h".
630 (main): Handle --print-output-format.
631 * gold.cc: Include "target-select.h".
632 (queue_initial_tasks): Handle --print-output-format when there are
634 * parameters.cc (parameters_force_valid_target): Give a better
635 error message if -EB/-EL does not match target.
636 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
639 2011-07-15 Ian Lance Taylor <iant@google.com>
641 * i386.cc (class Output_data_plt_i386): Add layout_ field.
642 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
643 (Output_data_plt_i386::do_write): Write address of .dynamic
644 section to first entry in .got.plt section.
645 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
646 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
648 (Output_data_plt_x86_64::do_write): Write address of .dynamic
649 section to first entry in .got.plt section.
650 * layout.h (Layout::dynamic_section): New function.
652 2011-07-13 Sriraman Tallam <tmsriram@google.com>
654 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
656 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
657 input_section_position_, and input_section_glob_.
658 (read_layout_from_file): Call function section_ordering_specified.
659 * layout.h (is_section_ordering_specified): New function.
660 (section_ordering_specified): New function.
661 (section_ordering_specified_): New boolean member.
662 * main.cc(main): Call load_plugins after layout object is defined.
663 * output.cc (Output_section::add_input_section): Use
664 function section_ordering_specified to check if section ordering is
666 * output.cc (Output_section::add_relaxed_input_section): Use
667 function section_ordering_specified to check if section ordering is
669 (Output_section::update_section_layout): New function.
670 (Output_section::sort_attached_input_sections): Check if input section
672 * output.h (Output_section::update_section_layout): New function.
673 * plugin.cc (get_section_count): New function.
674 (get_section_type): New function.
675 (get_section_name): New function.
676 (get_section_contents): New function.
677 (update_section_order): New function.
678 (allow_section_ordering): New function.
679 (Plugin::load): Add the new interfaces to the transfer vector.
680 (Plugin_manager::load_plugins): New parameter.
681 (Plugin_manager::all_symbols_read): New parameter.
682 (Plugin_manager::claim_file): New parameter. Save the elf object for
684 (Plugin_manager::get_elf_object): New function.
685 (Plugin_manager::get_view): Change to directly use the bool to check
686 if get_view is called from claim_file_hook.
687 * plugin.h (input_objects): New function
688 (Plugin__manager::load_plugins): New parameter.
689 (Plugin_manager::claim_file): New parameter.
690 (Plugin_manager::get_elf_object): New function.
691 (Plugin_manager::in_claim_file_handler): New function.
692 (Plugin_manager::in_claim_file_handler_): New member.
693 (layout): New function.
694 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
695 handler with an extra parameter. Make the elf object before calling
697 * testsuite/plugin_test.c (get_section_count): New function pointer.
698 (get_section_type): New function pointer.
699 (get_section_name): New function pointer.
700 (get_section_contents): New function pointer.
701 (update_section_order): New function pointer.
702 (allow_section_ordering): New function pointer.
703 (onload): Check if the new interfaces exist.
705 2011-07-13 Ian Lance Taylor <iant@google.com>
707 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
709 * x86_64.cc (Target_x86_64::got_section): Likewise.
710 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
711 (relro_now_test_SOURCES): New variable.
712 (relro_now_test_DEPENDENCIES): New variable.
713 (relro_now_test_LDFLAGS): New variable.
714 (relro_now_test_LDADD): New variable.
715 (relro_now_test.so): New target.
716 * testsuite/Makefile.in: Rebuild.
718 2011-07-12 Ian Lance Taylor <iant@google.com>
721 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
722 GLOB_DAT relocation rather than a RELATIVE relocation for a
723 protected symbol when creating a shared library.
724 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
725 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
726 * testsuite/protected_main_1.cc (main): Test that protected
727 function has same address.
729 2011-07-11 Ian Lance Taylor <iant@google.com>
732 * options.h (class General_options): Add -Bgroup.
733 * options.cc (General_options::finalize): If -Bgroup is set,
734 default to --unresolved-symbols=report-all.
735 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
736 * target-reloc.h (issue_undefined_symbol_error): Handle
737 --unresolved-symbols=report-all.
739 2011-07-08 Ian Lance Taylor <iant@google.com>
742 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
743 if linker script discards key sections.
744 (Layout::create_dynamic_symtab): Likewise.
745 (Layout::assign_local_dynsym_offsets): Likewise.
746 (Layout::sized_create_version_sections): Likewise.
747 (Layout::create_interp): Likewise.
748 (Layout::finish_dynamic_section): Likewise.
749 (Layout::set_dynamic_symbol_size): Likewise.
751 2011-07-08 Ian Lance Taylor <iant@google.com>
754 * options.h (class General_options): Add --unresolved-symbols.
755 * target-reloc.h (issue_undefined_symbol_error): Check
756 --unresolved-symbols. Add comments.
758 2011-07-08 Ian Lance Taylor <iant@google.com>
760 * testsuite/odr_violation2.cc (Ordering::operator()): Make
761 expression more complex.
763 2011-07-08 Ian Lance Taylor <iant@google.com>
766 * target-reloc.h (issue_undefined_symbol_error): New inline
767 function, broken out of relocate_section.
768 (relocate_section): Call issue_undefined_symbol_error.
769 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
770 there is no TLS segment if we are about to issue an undefined
772 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
774 2011-07-08 Ian Lance Taylor <iant@google.com>
777 * resolve.cc (Symbol_table::should_override): Add fromtype
778 parameter. Change all callers. Give error when linking together
779 TLS and non-TLS symbol.
780 (Symbol_table::should_override_with_special): Add fromtype
781 parameter. Change all callers.
782 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
783 there is no TLS segment if we have reported some errors.
784 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
786 2011-07-08 Ian Lance Taylor <iant@google.com>
789 * target.h (Target::plt_address_for_global): New function.
790 (Target::plt_address_for_local): New function.
791 (Target::plt_section_for_global): Remove.
792 (Target::plt_section_for_local): Remove.
793 (Target::do_plt_address_for_global): New virtual function.
794 (Target::do_plt_address_for_local): New virtual function.
795 (Target::do_plt_section_for_global): Remove.
796 (Target::do_plt_section_for_local): Remove.
797 (Target::register_global_plt_entry): Add Symbol_table and Layout
799 * output.cc (Output_data_got::Got_entry::write): Use
800 plt_address_for_global and plt_address_for_local.
801 * layout.cc (Layout::add_target_dynamic_tags): Use size and
802 address of output section.
803 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
804 got_irelative_, and irelative_count_ fields. Update
806 (Output_data_plt_i386::has_irelative_section): New function.
807 (Output_data_plt_i386::entry_count): Add irelative_count_.
808 (Output_data_plt_i386::set_final_data_size): Likewise.
809 (class Target_i386): Add got_irelative_ and rel_irelative_
810 fields. Update declarations.
811 (Target_i386::Target_i386): Initialize new fields.
812 (Target_i386::do_plt_address_for_global): New function replacing
813 do_plt_section_for_global.
814 (Target_i386::do_plt_address_for_local): New function replacing
815 do_plt_section_for_local.
816 (Target_i386::got_section): Create got_irelative_.
817 (Target_i386::rel_irelative_section): New function.
818 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
819 fields. Don't define __rel_iplt_{start,end}.
820 (Output_data_plt_i386::add_entry): Add symtab and layout
821 parameters. Change all callers. Use different PLT and GOT for
823 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
824 layout parameters. Change all callers. Use different PLT and
826 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
827 (Output_data_plt_i386::rel_irelative): New function.
828 (Output_data_plt_i386::address_for_global): New function.
829 (Output_data_plt_i386::address_for_local): New function.
830 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
831 IRELATIVE GOT when changing IFUNC GOT entries.
832 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
834 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
835 if we didn't create an IRELATIVE GOT.
836 (Target_i386::Relocate::relocate): Use plt_address_for_global and
837 plt_address_for_local.
838 (Target_i386::do_dynsym_value): Use plt_address_for_global.
839 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
840 got_irelative_, and irelative_count_ fields. Update
842 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
843 Initialize new fields. Remove symtab parameter. Change all
845 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
847 (Output_data_plt_x86_64::has_irelative_section): New function.
848 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
849 (class Target_x86_64): Add got_irelative_ and rel_irelative_
850 fields. Update declarations.
851 (Target_x86_64::Target_x86_64): Initialize new fields.
852 (Target_x86_64::do_plt_address_for_global): New function replacing
853 do_plt_section_for_global.
854 (Target_x86_64::do_plt_address_for_local): New function replacing
855 do_plt_section_for_local.
856 (Target_x86_64::got_section): Create got_irelative_.
857 (Target_x86_64::rela_irelative_section): New function.
858 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
859 all callers. Don't create __rel_iplt_{start,end}.
860 (Output_data_plt_x86_64::add_entry): Add symtab and layout
861 parameters. Change all callers. Use different PLT and GOT for
863 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
864 layout parameters. Change all callers. Use different PLT and
866 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
867 parameters. Change all callers. Use different PLT and GOT for
869 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
870 (Output_data_plt_x86_64::rela_irelative): New function.
871 (Output_data_plt_x86_64::address_for_global): New function.
872 (Output_data_plt_x86_64::address_for_local): New function.
873 (Output_data_plt_x86_64::set_final_data_size): Likewise.
874 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
875 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
876 (Target_x86_64::register_global_plt_entry): Add symtab and layout
878 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
880 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
881 symbols if we didn't create an IRELATIVE GOT.
882 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
883 plt_address_for_local.
884 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
885 * testsuite/ifuncvar1.c: New test file.
886 * testsuite/ifuncvar2.c: New test file.
887 * testsuite/ifuncvar3.c: New test file.
888 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
889 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
890 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
891 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
892 * testsuite/Makefile.in: Rebuild.
894 2011-07-07 Cary Coutant <ccoutant@google.com>
896 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
897 (two_file_test_1_ndebug.o): Likewise.
898 (two_file_test_1b_ndebug.o): Likewise.
899 (two_file_test_2_ndebug.o): Likewise.
900 (two_file_test_main_ndebug.o): Likewise.
901 (incremental_test_2): Link with no-debug versions.
903 2011-07-06 Cary Coutant <ccoutant@google.com>
905 * gold/incremental.cc
906 (Output_section_incremental_inputs::write_info_blocks): Check for
907 hidden and internal symbols.
909 2011-07-06 Cary Coutant <ccoutant@google.com>
911 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
912 Check disposition for startup file.
913 (Incremental_inputs::report_command_line): Ignore
914 --incremental-startup-unchanged option.
915 * options.cc (General_options::parse_incremental_startup_unchanged):
917 (General_options::General_options): Initialize new data member.
918 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
919 (General_options): Add --incremental-startup-unchanged option.
920 (General_options::incremental_startup_disposition): New function.
921 (General_options::incremental_startup_disposition_): New data member.
923 2011-07-06 Cary Coutant <ccoutant@google.com>
925 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
926 input file index to Script_info ctor.
927 (Sized_incremental_binary::do_file_has_changed): Find the
928 command-line argument for files named in scripts.
929 * incremental.h (Script_info::Script_info): New ctor
930 with input file index.
931 (Script_info::input_file_index): New function.
932 (Script_info::input_file_index_): New data member.
933 (Incremental_binary::get_library): Add const.
934 (Incremental_binary::get_script_info): Add const.
935 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
936 * testsuite/Makefile.am (incremental_test_5): New test case.
937 (incremental_test_6): New test case.
938 * testsuite/Makefile.in: Regenerate.
940 2011-07-06 Cary Coutant <ccoutant@google.com>
942 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
943 debug output when command lines differ.
945 2011-07-06 Cary Coutant <ccoutant@google.com>
947 * incremental.cc (Incremental_inputs::report_command_line): Ignore
948 --incremental-patch option.
949 * layout.cc (Free_list::allocate): Extend allocation beyond original
951 (Layout::make_output_section): Mark sections that should get
953 * options.cc (parse_percent): New function.
954 * options.h (parse_percent): New function.
955 (DEFINE_percent): New macro.
956 (General_options): Add --incremental-patch option.
957 * output.cc (Output_section::Output_section): Initialize new data
959 (Output_section::add_input_section): Print section name when out
961 (Output_section::add_output_section_data): Likewise.
962 (Output_section::set_final_data_size): Add patch space when
963 doing --incremental-full.
964 (Output_section::do_reset_address_and_file_offset): Remove patch
966 (Output_segment::set_section_list_addresses): Print debug output
967 only if --incremental-update.
968 * output.h (Output_section::set_is_patch_space_allowed): New function.
969 (Output_section::is_patch_space_allowed_): New data member.
970 (Output_section::patch_space_): New data member.
971 * parameters.cc (Parameters::incremental_full): New function.
972 * parameters.h (Parameters::incremental_full): New function
973 * testsuite/Makefile.am (incremental_test_2): Add test for
974 --incremental-patch option.
975 * testsuite/Makefile.in: Regenerate.
976 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
977 (t18): Remove function body.
979 2011-07-05 Doug Kwan <dougkwan@google.com>
982 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
983 Arm_Address type for relocation result.
984 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
986 (Arm_relocate_functions::abs32): Use unaligned access.
987 (Arm_relocate_functions::rel32): Ditto.
988 (Arm_relocate_functions::prel31): Ditto.
989 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
990 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
991 static data relocations.
992 * testsuite/Makefile.in: Regnerate.
993 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
995 2011-07-05 Ian Lance Taylor <iant@google.com>
998 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
999 symbols if necessary.
1000 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1002 2011-07-05 Ian Lance Taylor <iant@google.com>
1005 * resolve.cc (Symbol::override_base_with_special): Simply override
1006 version with special symbol version, ignoring previous version.
1008 2011-07-05 Ian Lance Taylor <iant@google.com>
1010 * object.cc (Sized_relobj_file::include_section_group): Add
1011 information to comment about signature location.
1013 2011-07-02 Ian Lance Taylor <iant@google.com>
1016 * options.h (class General_options): Add -f and -F.
1017 * options.cc (General_options::finalize): Fatal error if -f/-F
1018 are used without -shared.
1019 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
1021 2011-07-02 Ian Lance Taylor <iant@google.com>
1023 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
1025 2011-07-01 Ian Lance Taylor <iant@google.com>
1029 * resolve.cc (Symbol::override_base_with_special): Don't override
1030 the version if the overriding symbol has a different name.
1031 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
1032 all callers. If we give an error about an undefined version,
1033 define the base version if necessary.
1034 * dynobj.h (class Versions): Update declaration.
1035 * testsuite/weak_alias_test_5.cc: New file.
1036 * testsuite/weak_alias_test.script: New file.
1037 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
1038 and versioned_alias have the right value, and call t2.
1039 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
1040 weak_alias_test_5.so.
1041 (weak_alias_test_LDADD): Likewise.
1042 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
1043 * testsuite/Makefile.in: Rebuild.
1045 2011-07-01 Ian Lance Taylor <iant@google.com>
1048 * options.h (class General_options): Support -z notext.
1049 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
1051 (two_file_shared_nonpic.so): Likewise.
1052 (two_file_shared_mixed.so): Likewise.
1053 (two_file_shared_mixed_1.so): Likewise.
1054 (weak_undef_lib_nonpic.so): Likewise.
1055 (alt/weak_undef_lib_nonpic.so): Likewise.
1056 (tls_test_shared_nonpic.so): Likewise.
1057 * testsuite/Makefile.in: Rebuild.
1059 2011-07-01 Ian Lance Taylor <iant@google.com>
1062 * configure.ac: Test whether static linking works, setting
1063 the automake conditional HAVE_STATIC.
1064 * testsuite/Makefile.am: Disable tests using -static if
1065 HAVE_STATIC is not true.
1066 * configure, testsuite/Makefile.in: Rebuild.
1068 2011-07-01 Ian Lance Taylor <iant@google.com>
1071 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
1072 Assert if we see DW_EH_PE_indirect.
1073 * target.h (Target::ehframe_datarel_base): New function.
1074 (Target::do_ehframe_datarel_base): New target function.
1075 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
1076 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
1079 2011-07-01 Ian Lance Taylor <iant@google.com>
1082 * options.h (class General_options): Add
1083 --ld-generated-unwind-info.
1084 * ehframe.cc (Fde::write): Add address parameter. Change all
1085 callers. If associated with PLT, fill in address and size.
1086 (Cie::set_output_offset): Only add merge mapping if there is an
1088 (Cie::write): Add address parameter. Change all callers.
1089 (Eh_frame::add_ehframe_for_plt): New function.
1090 * ehframe.h (class Fde): Update declarations. Move shndx_ and
1091 input_offset_ fields into union u_, with new plt field.
1092 (Fde::Fde): Adjust for new union field.
1093 (Fde::Fde) [Output_data version]: New constructor.
1094 (Fde::add_mapping): Only add merge mapping if there is an object.
1095 (class Cie): Update declarations.
1096 (class Eh_frame): Declare add_ehframe_for_plt.
1097 * layout.cc (Layout::layout_eh_frame): Break out code into
1098 make_eh_frame_section, and call it.
1099 (Layout::make_eh_frame_section): New function.
1100 (Layout::add_eh_frame_for_plt): New function.
1101 * layout.h (class Layout): Update declarations.
1102 * merge.cc (Merge_map::add_mapping): Add assertion.
1103 * i386.cc: Include "dwarf.h".
1104 (class Output_data_plt_i386): Make first_plt_entry,
1105 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
1106 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1107 and plt_eh_frame_fde.
1108 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
1109 boundary. Call add_eh_frame_for_plt if appropriate.
1110 * x86_64.cc: Include "dwarf.h".
1111 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
1112 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
1113 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1114 and plt_eh_frame_fde.
1115 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
1118 2011-06-29 Ian Lance Taylor <iant@google.com>
1121 * object.cc (Sized_relobj_file::layout_section): Change shdr
1122 parameter to be const.
1123 (Sized_relobj_file::layout_eh_frame_section): New function, broken
1125 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
1126 appropriate. Call layout_eh_frame_section.
1127 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
1129 * object.h (class Sized_relobj_file): Update declarations.
1131 2011-06-29 Ian Lance Taylor <iant@google.com>
1134 * script.cc (Token::integer_value): Accept trailing M/m/K/k
1136 (Lex::gather_token): Accept trailing M/m/K/k for integers.
1138 2011-06-29 Ian Lance Taylor <iant@google.com>
1141 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
1143 * layout.cc (Layout::layout_eh_frame): Likewise.
1145 2011-06-29 Ian Lance Taylor <iant@google.com>
1148 * layout.cc (Layout::symtab_section_shndx): New function.
1149 * layout.h (class Layout): Declare symtab_section_shndx.
1150 * output.cc (Output_section::write_header): Call it.
1152 2011-06-29 Ian Lance Taylor <iant@google.com>
1155 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
1156 symbols which are not used in a relocation.
1158 2011-06-28 Ian Lance Taylor <iant@google.com>
1161 * layout.cc (Layout::segment_precedes): Don't crash if a linker
1162 script create indistinguishable segments.
1163 (Layout::set_segment_offsets): Use stable_sort when sorting
1164 segments. Pass this to Compare_segments constructor.
1165 * layout.h (class Layout): Make segment_precedes non-static.
1166 (class Compare_segments): Change from struct to class. Add
1167 layout_ field. Add constructor.
1168 * script-sections.cc
1169 (Script_sections::attach_sections_using_phdrs_clause): Rename
1170 local orphan to is_orphan. Don't report failure to put empty
1171 section in segment. On attachment failure, report name of
1172 section, and attach to first PT_LOAD segment.
1174 2011-06-28 Ian Lance Taylor <iant@google.com>
1177 * target-select.cc (Target_selector::Target_selector): Add
1178 emulation parameter. Change all callers.
1179 (select_target_by_bfd_name): Rename from select_target_by_name.
1181 (select_target_by_emulation): New function.
1182 (supported_emulation_names): New function.
1183 * target-select.h (class Target_selector): Add emulation_ field.
1184 Update declarations.
1185 (Target_selector::recognize_by_bfd_name): Rename from
1186 recognize_by_name. Change all callers.
1187 (Target_selector::supported_bfd_names): Rename from
1188 supported_names. Change all callers.
1189 (Target_selector::recognize_by_emulation): New function.
1190 (Target_selector::supported_emulations): New function.
1191 (Target_selector::emulation): New function.
1192 (Target_selector::do_recognize_by_bfd_name): Rename from
1193 do_recognize_by_name. Change all callers.
1194 (Target_selector::do_supported_bfd_names): Rename from
1195 do_supported_names. Change all callers.
1196 (Target_selector::do_recognize_by_emulation): New function.
1197 (Target_selector::do_supported_emulations): New function.
1198 (select_target_by_bfd_name): Change name in declaration.
1199 (select_target_by_emulation): Declare.
1200 (supported_emulation_names): Declare.
1201 * parameters.cc (parameters_force_valid_target): Try to find
1202 target based on emulation from -m option.
1203 * options.h (class General_options): Change doc string for -m.
1204 * options.cc (help): Print emulations.
1205 (General_options::parse_V): Likewise.
1206 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1207 Add emulation parameter. Change all callers.
1209 2011-06-28 Ian Lance Taylor <iant@google.com>
1211 * target.h (class Target): Add osabi_ field.
1212 (Target::osabi): New function.
1213 (Target::set_osabi): New function.
1214 (Target::Target): Initialize osabi_.
1215 (Target::do_adjust_elf_header): Make pure virtual.
1216 (Sized_target::do_adjust_elf_header): Declare.
1217 * target.cc (Sized_target::do_adjust_elf_header): New function.
1218 (class Sized_target): Instantiate all versions.
1219 * freebsd.h (class Target_freebsd): Remove.
1220 (Target_selector_freebsd::do_recognize): Call set_osabi on
1222 (Target_selector_freebsd::do_recognize_by_name): Likewise.
1223 (Target_selector_freebsd::set_osabi): Remove.
1224 * i386.cc (class Target_i386): Inherit from Sized_target rather
1225 than Target_freebsd.
1226 * x86_64.cc (class Target_x86_64): Likewise.
1228 2011-06-28 Ian Lance Taylor <iant@google.com>
1230 * target.h (Target::can_check_for_function_pointers): Rewrite.
1232 (Target::can_icf_inline_merge_sections): Likewise.
1233 (Target::section_may_have_icf_unsafe_poineters): Likewise.
1234 (Target::Target_info): Add can_icf_inline_merge_sections field.
1235 (Target::do_can_check_for_function_pointers): New virtual
1237 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
1238 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
1239 from can_check_for_function_pointers, move in file.
1240 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
1241 section_may_have_icf_unsafe_poineters, move in file.
1242 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
1243 * i386.cc (Target_i386::do_can_check_for_function_pointers):
1244 Rename from can_check_for_function_pointers, move in file.
1245 (Target_i386::can_icf_inline_merge_sections): Remove.
1246 (Target_i386::i386_info): Initialize
1247 can_icf_inline_merge_sections.
1248 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1249 Initialize can_icf_inline_merge_sections.
1250 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
1251 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
1252 Rename from can_check_for_function_pointers, move in file.
1253 (Target_x86_64::can_icf_inline_merge_sections): Remove.
1254 (Target_x86_64::x86_64_info): Initialize
1255 can_icf_inline_merge_sections.
1256 * testsuite/testfile.cc (Target_test::test_target_info):
1258 * icf.cc (get_section_contents): Correct formatting.
1260 2011-06-27 Ian Lance Taylor <iant@google.com>
1262 * symtab.cc (Symbol::versioned_name): New function.
1263 (Symbol_table::add_to_final_symtab): Use versioned_name when
1265 (Symbol_table::sized_write_symbol): Likewise.
1266 * symtab.h (class Symbol): Declare versioned_name.
1267 * stringpool.h (class Stringpool_template): Add variant of add
1268 which takes a std::basic_string.
1269 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
1270 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
1271 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
1272 (ver_test_12.o): New target.
1273 * testsuite/Makefile.in: Rebuild.
1275 2011-06-27 Doug Kwan <dougkwan@google.com>
1277 * arm.cc (Arm_relocate_functions::thm_jump8,
1278 Arm_relocate_functions::thm_jump11): Use a wider signed
1279 type to compute offset.
1280 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
1282 * testsuite/Makefile.in: Regenerate.
1283 * testsuite/arm_branch_in_range.sh: Check test results of
1284 arm_thm_jump11 and arm_thm_jump8.
1285 * testsuite/arm_thm_jump11.s: New test source file.
1286 * testsuite/arm_thm_jump11.t: New linker script.
1287 * testsuite/arm_thm_jump8.s: New test source file.
1288 * testsuite/arm_thm_jump8.t: New linker script.
1290 2011-06-24 Ian Lance Taylor <iant@google.com>
1292 * layout.cc: Include "object.h".
1293 (ctors_sections_in_init_array): New static variable.
1294 (Layout::is_ctors_in_init_array): New function.
1295 (Layout::layout): Add entry to ctors_sections_in_init_array if
1297 * layout.h (class Layout): Declare is_ctors_in_init_array.
1298 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
1299 is_ctors_reverse_view is set.
1300 (Sized_relobj_file::write_sections): Add layout parameter. Change
1301 all callers. Set is_ctors_reverse_view field of View_size.
1302 (Sized_relobj_file::reverse_words): New function.
1303 * object.h (Sized_relobj_file::View_size): Add
1304 is_ctors_reverse_view field.
1305 (class Sized_relobj_file): Update declarations.
1306 * testsuite/initpri3.c: New test.
1307 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
1309 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
1310 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
1311 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
1312 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
1313 * testsuite/Makefile.in: Rebuild.
1315 2011-06-24 Cary Coutant <ccoutant@google.com>
1317 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
1318 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
1319 (debug_msg_cdebug.err): New targets.
1320 * testsuite/Makefile.in: Regenerate.
1321 * testsuite/debug_msg.sh: Check output of link with compressed debug.
1322 Fix checks for link with shared library.
1324 2011-06-24 Doug Kwan <dougkwan@google.com>
1326 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
1327 skip empty text sections.
1328 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
1330 2011-06-22 Ian Lance Taylor <iant@google.com>
1333 * options.h (class General_options): Add --ctors-in-init-array.
1334 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
1335 friends as SHT_PROGBITS for merging sections.
1336 (Layout::layout): Remove special handling of .init_array and
1337 friends. Don't sort if doing relocatable link. Sort for .ctors
1338 and .dtors if ctors_in_init_array.
1339 (Layout::make_output_section): Force correct section types for
1340 .init_array and friends. Don't sort if doing relocatable link,
1341 Don't sort .ctors and .dtors if ctors_in_init_array.
1342 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
1343 (Layout::output_section_name): Add relobj parameter. Change all
1344 callers. Handle .ctors. and .dtors. in code rather than table.
1345 Handle .ctors and .dtors if ctors_in_init_array.
1346 (Layout::match_file_name): New function, moved from output.cc.
1347 * layout.h (class Layout): Update declarations.
1348 * output.cc: Include "layout.h".
1349 (Input_section_sort_entry::get_priority): New function.
1350 (Input_section_sort_entry::match_file_name): Just call
1351 Layout::match_file_name.
1352 (Output_section::Input_section_sort_init_fini_compare::operator()):
1353 Handle .ctors and .dtors. Sort by explicit priority rather than
1355 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
1356 * testsuite/initpri2.c: New test.
1357 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
1358 (check_PROGRAMS): Add initpri2.
1359 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
1360 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
1361 * configure, testsuite/Makefile.in: Rebuild.
1363 2011-06-19 Ian Lance Taylor <iant@google.com>
1366 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
1367 .interp section to a PT_INTERP segment even if we have seen a
1368 --dynamic-linker option. Don't do it if we have seen a PHDRS
1369 clause in a linker script.
1370 (Layout::finalize): Don't create a .interp section if we've
1371 already create a PT_INTERP segment.
1372 (Layout::create_interp): Always call choose_output_section (revert
1373 patch of 2011-06-17). Don't create PT_INTERP segment.
1374 * script-sections.cc
1375 (Script_sections::create_note_and_tls_segments): Add a .interp
1376 section to a PT_INTERP segment even if we have seen a
1377 --dynamic-linker option.
1379 2011-06-18 Ian Lance Taylor <iant@google.com>
1381 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
1382 merely because a non-PT_LOAD segment has a dynamic reloc.
1384 2011-06-18 Ian Lance Taylor <iant@google.com>
1386 * layout.cc (Layout::finish_dynamic_section): Don't create
1387 DT_FLAGS entry if not needed.
1389 2011-06-18 Ian Lance Taylor <iant@google.com>
1392 * layout.cc (Layout::layout_eh_frame): Correct handling of
1393 writable .eh_frame section.
1395 2011-06-17 Ian Lance Taylor <iant@google.com>
1398 * resolve.cc (Symbol_table::resolve): Don't give an error if a
1399 symbol is redefined with the exact same object and value.
1401 2011-06-17 Ian Lance Taylor <iant@google.com>
1404 * layout.h (class Layout): Add interp_segment_ field.
1405 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
1406 (Layout::attach_allocated_section_to_segment): If making shared
1407 library, put .interp section in PT_INTERP segment.
1408 (Layout::finalize): Also call create_interp if -dynamic-linker
1410 (Layout::create_interp): Assert that there is no PT_INTERP
1411 segment. If not using a SECTIONS clause, use make_output_section.
1412 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
1413 * script-sections.cc
1414 (Script_sections::create_note_and_tls_segments): If making shared
1415 library, put .interp section in PT_INTERP segment.
1417 2011-06-17 Ian Lance Taylor <iant@google.com>
1419 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
1420 when making a shared library.
1422 2011-06-17 Ian Lance Taylor <iant@google.com>
1424 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
1425 parameter. Change all callers. Don't issue warning about PC32
1426 against locally defined symbol.
1428 2011-06-16 Ian Lance Taylor <iant@google.com>
1430 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
1431 occurs in same object.
1433 2011-06-14 Alan Modra <amodra@gmail.com>
1435 * po/POTFILES.in: Regenerate.
1437 2011-06-09 Ian Lance Taylor <iant@google.com>
1439 * script-sections.cc
1440 (Orphan_output_section::set_section_addresses): For a relocatable
1441 link set address to 0.
1443 2011-06-09 Cary Coutant <ccoutant@google.com>
1446 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
1447 used with --compress-debug-sections.
1448 * gold/object.cc (Sized_relobj_file::do_layout): Report
1449 uncompressed size of compressed input sections.
1451 2011-06-08 Cary Coutant <ccoutant@google.com>
1454 * testsuite/two_file_test_2_v1.cc: Change initialization of
1455 v2 to keep it in .data.
1457 2011-06-07 Cary Coutant <ccoutant@google.com>
1459 * common.cc (Symbol_table::do_allocate_commons_list): Call
1461 * errors.cc (Errors::fatal): Adjust call to gold_exit.
1462 (Errors::fallback): New function.
1463 (gold_fallback): New function.
1464 * errors.h (Errors::fallback): New function.
1465 * gold.cc (gold_exit): Change status parameter to enum; adjust
1467 (queue_initial_tasks): Call gold_fallback.
1468 * gold.h: Include cstdlib.
1469 (Exit_status): New enum type.
1470 (gold_exit): Change status parameter to enum.
1471 (gold_fallback): New function.
1472 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
1473 (Layout::create_symtab_sections): Likewise.
1474 (Layout::create_shdrs): Likewise.
1475 * main.cc (main): Adjust call to gold_exit.
1476 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
1477 (Output_data_got::add_got_entry_pair): Likewise.
1478 (Output_section::add_input_section): Likewise.
1479 (Output_section::add_output_section_data): Likewise.
1480 (Output_segment::set_section_list_addresses): Likewise.
1481 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
1483 2011-06-07 Cary Coutant <ccoutant@google.com>
1485 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
1486 for incremental links.
1487 * output.cc (Output_segment::set_section_list_addresses): Remove
1488 FIXME and test for TLS or BSS.
1490 2011-06-07 Cary Coutant <ccoutant@google.com>
1492 * testsuite/Makefile.am: Add incremental_copy_test,
1493 incremental_common_test_1.
1494 * testsuite/Makefile.in: Regenerate.
1495 * testsuite/common_test_1_v1.c: New source file.
1496 * testsuite/common_test_1_v2.c: New source file.
1497 * testsuite/copy_test_v1.cc: New source file.
1499 2011-06-07 Cary Coutant <ccoutant@google.com>
1501 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
1502 update, allocate common from bss section's free list.
1503 * incremental-dump.cc (dump_incremental_inputs): Print flag for
1504 linker-defined symbols.
1505 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1506 Skip GOT and PLT entries that are no longer referenced.
1507 (Output_section_incremental_inputs::write_info_blocks): Mark
1508 linker-defined symbols.
1509 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
1510 * output.cc (Output_section::allocate): New function.
1511 * output.h (Output_section::allocate): New function.
1512 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
1513 linker-defined symbols.
1514 (Symbol::override_base_with_special): Copy is_predefined_ flag.
1515 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
1516 (Symbol::init_base_output_data): Likewise.
1517 (Symbol::init_base_output_segment): Likewise.
1518 (Symbol::init_base_constant): Likewise.
1519 (Sized_symbol::init_output_data): Likewise.
1520 (Sized_symbol::init_output_segment): Likewise.
1521 (Sized_symbol::init_constant): Likewise.
1522 (Symbol_table::do_define_in_output_data): Likewise.
1523 (Symbol_table::do_define_in_output_segment): Likewise.
1524 (Symbol_table::do_define_as_constant): Likewise.
1525 * symtab.h (Symbol::is_predefined): New function.
1526 (Symbol::init_base_output_data): Add is_predefined parameter.
1527 (Symbol::init_base_output_segment): Likewise.
1528 (Symbol::init_base_constant): Likewise.
1529 (Symbol::is_predefined_): New data member.
1530 (Sized_symbol::init_output_data): Add is_predefined parameter.
1531 (Sized_symbol::init_output_segment): Likewise.
1532 (Sized_symbol::init_constant): Likewise.
1533 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
1535 2011-06-07 Cary Coutant <ccoutant@google.com>
1537 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
1538 instead of emit_copy_reloc.
1539 (Copy_relocs::emit_copy_reloc): Refactor.
1540 (Copy_relocs::make_copy_reloc): New function.
1541 (Copy_relocs::add_copy_reloc): Remove.
1542 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
1544 (Copy_relocs::make_copy_reloc): New function.
1545 (Copy_relocs::add_copy_reloc): Remove.
1546 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
1547 unchanged input files.
1548 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
1549 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
1550 Reserve BSS space for COPY relocations.
1551 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1552 (Output_section_incremental_inputs::write_info_blocks): Record
1553 whether a symbol is copied from a shared object.
1554 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
1555 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
1556 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
1557 (Incremental_input_entry_reader::get_output_symbol_index): Add
1559 (Incremental_binary::emit_copy_relocs): New function.
1560 (Incremental_binary::do_emit_copy_relocs): New function.
1561 (Sized_incremental_binary::Sized_incremental_binary): Initialize
1563 (Sized_incremental_binary::add_copy_reloc): New function.
1564 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1565 (Sized_incremental_binary::Copy_reloc): New struct.
1566 (Sized_incremental_binary::Copy_relocs): New typedef.
1567 (Sized_incremental_binary::copy_relocs_): New data member.
1568 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
1569 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
1570 * target.h (Sized_target::emit_copy_reloc): New function.
1571 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
1573 2011-06-02 Cary Coutant <ccoutant@google.com>
1576 * gold/archive.cc (Archive::Archive): Initialize new data member.
1577 (Archive::include_all_members): Return if archive has already been
1579 * gold/archive.h (Archive::include_all_members_): New data member.
1581 2011-06-02 Nick Clifton <nickc@redhat.com>
1583 * dynobj.h: Fix spelling mistake in comment.
1584 * output.cc: Likewise.
1586 2011-05-31 Doug Kwan <dougkwan@google.com>
1590 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
1591 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
1592 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
1593 redundant arm_exidx_test.so.
1594 * testsuite/Makefile.in: Regenerate.
1595 (check_SCRIPTS): Add pr12826.sh
1596 (check_DATA): Add pr12826.stdout
1597 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
1598 * testsuite/pr12826.sh: New file.
1599 * testsuite/pr12826_1.s: Ditto.
1600 * testsuite/pr12826_1.s: Ditto.
1602 2011-05-30 Ian Lance Taylor <iant@google.com>
1604 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
1607 2011-05-29 Ian Lance Taylor <iant@google.com>
1610 * testsuite/Makefile.am: Use different file name for two_file_test
1611 temporary file for each incremental test.
1612 * testsuite/Makefile.in: Rebuild.
1614 2011-05-29 Ian Lance Taylor <iant@google.com>
1616 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
1617 binary input file is empty.
1619 2011-05-27 Ian Lance Taylor <iant@google.com>
1621 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
1622 (ver_test_9.so): Likewise.
1623 * testsuite/Makefile.in: Rebuild.
1625 2011-05-26 Cary Coutant <ccoutant@google.com>
1627 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
1628 * incremental.cc (Incremental_inputs::report_input_section): Fix
1629 comment, indentation.
1630 (Incremental_inputs::report_comdat_group): New function.
1631 (Output_section_incremental_inputs::set_final_data_size): Adjust size
1632 of data for incremental input file entry.
1633 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
1634 group count, COMDAT group signatures.
1635 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
1636 an unchanged input file.
1637 * incremental.h (Incremental_object_entry::Incremental_object_entry):
1638 Initialize new data member.
1639 (Incremental_object_entry::add_comdat_group): New function.
1640 (Incremental_object_entry::get_comdat_group_count): New function.
1641 (Incremental_object_entry::get_comdat_signature_key): New function.
1642 (Incremental_object_entry::groups_): New data member.
1643 (Incremental_inputs::report_comdat_group): New function.
1644 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
1645 data for incremental input file entry.
1646 (Incremental_input_entry_reader::get_comdat_group_count): New function.
1647 (Incremental_input_entry_reader::get_input_section): Adjust size of
1648 data for incremental input file entry.
1649 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
1650 (Incremental_input_entry_reader::get_comdat_group_signature): New
1652 * object.cc (Sized_relobj::include_section_group): Report kept
1653 COMDAT groups for incremental links.
1655 2011-05-24 David Meyer <pdox@google.com>
1657 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
1658 with name parameter. Add found_name parameter.
1659 * fileread.cc (Input_file::find_file): Adjust code accordingly.
1660 * dirsearch.h (class Dirsearch): Update declaration.
1662 2011-05-24 Ian Lance Taylor <iant@google.com>
1664 * archive.cc (Library_base::should_include_member): Pull in object
1665 from archive if it defines the entry symbol.
1666 * parameters.cc (Parameters::entry): New function.
1667 * parameters.h (class Parameters): Declare entry.
1668 * output.h (class Output_file_header): Remove entry_ field.
1669 * output.cc (Output_file_header::Output_file_header): Remove entry
1670 parameter. Change all callers.
1671 (Output_file_header::entry): Use parameters->entry.
1672 * gold.cc (queue_middle_tasks): Likewise.
1673 * plugin.cc (Plugin_hook::run): Likewise.
1675 2011-05-24 Cary Coutant <ccoutant@google.com>
1677 * gold.cc (queue_initial_tasks): Pass incremental base filename
1678 to Output_file::open_base_file; don't print error message.
1679 * incremental-dump.cc (main): Adjust call to
1680 Output_file::open_for_modification.
1681 * incremental-dump.cc (main): Likewise.
1682 * incremental.cc (Incremental_inputs::report_command_line):
1683 Ignore --incremental-base option when comparing command lines.
1684 Ignore parameter when given as separate argument.
1685 * options.h (class General_options): Add --incremental-base.
1686 * output.cc (Output_file::Output_file):
1687 (Output_file::open_base_file): Add base_name and writable parameters;
1688 read base file into new file; print error message here.
1689 (Output_file::map_no_anonymous): Add writable parameter; adjust all
1691 * output.h (Output_file::open_for_modification): Rename to...
1692 (Output_file::open_base_file): ...this; add base_name and
1693 writable parameters; adjust all callers.
1694 (Output_file::map_no_anonymous): Add writable parameter; adjust all
1696 * testsuite/Makefile.am (incremental_test_4): Test
1698 * testsuite/Makefile.in: Regenerate.
1700 2011-05-24 Cary Coutant <ccoutant@google.com>
1702 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
1704 * testsuite/Makefile.in: Regenerate.
1705 * testsuite/two_file_test_1_v1.cc: New test source file.
1706 * testsuite/two_file_test_1b_v1.cc: New test source file.
1707 * testsuite/two_file_test_2_v1.cc: New test source file.
1709 2011-05-24 Cary Coutant <ccoutant@google.com>
1711 * dynobj.h (Dynobj::do_dynobj): New function.
1712 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
1713 flag and soname for shared objects.
1714 * incremental.cc (Incremental_inputs::report_object): Make
1715 either Incremental_object_entry or Incremental_dynobj_entry; add
1716 soname to string table.
1717 (Incremental_inputs::report_input_section): Add assertion.
1718 (Output_section_incremental_inputs::set_final_data_size): Adjust
1719 type of input file entry for shared libraries; adjust size of
1720 shared library info entry.
1721 (Output_section_incremental_inputs::write_input_files): Write
1722 as_needed flag for shared libraries.
1723 (Output_section_incremental_inputs::write_info_blocks): Adjust type
1724 of input file entry for shared libraries; write soname.
1725 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
1726 soname from incremental info.
1727 * incremental.h (enum Incremental_input_flags): Add
1728 INCREMENTAL_INPUT_AS_NEEDED.
1729 (Incremental_input_entry::Incremental_input_entry): Initialize new
1731 (Incremental_input_entry::set_as_needed): New function.
1732 (Incremental_input_entry::as_needed): New function.
1733 (Incremental_input_entry::do_dynobj_entry): New function.
1734 (Incremental_input_entry::as_needed_): New data member.
1735 (Incremental_object_entry::Incremental_object_entry): Don't check
1737 (Incremental_object_entry::do_type): Likewise.
1738 (class Incremental_dynobj_entry): New class.
1739 (Incremental_input_entry_reader::as_needed): New function.
1740 (Incremental_input_entry_reader::get_soname): New function.
1741 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
1742 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
1743 size of shared library info entry.
1744 * layout.cc (Layout::finish_dynamic_section): Don't test for
1745 incremental link when adding DT_NEEDED entries.
1746 * object.h (Object::Object): Initialize new data member.
1747 (Object::dynobj): New function.
1748 (Object::set_as_needed): New function.
1749 (Object::as_needed): New function.
1750 (Object::do_dynobj): New function.
1751 (Object::as_needed_): New data member.
1753 2011-05-24 Cary Coutant <ccoutant@google.com>
1755 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
1756 info; adjust display of GOT entries.
1757 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1758 vector of input objects; remove file_status_.
1759 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
1760 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
1761 got_plt reader; call target hooks to reserve GOT entries.
1762 (Output_section_incremental_inputs::set_final_data_size): Adjust size
1763 of input file info header and GOT info entry.
1764 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
1766 (Got_plt_view_info::got_descriptor): Remove.
1767 (Got_plt_view_info::sym_index): New data member.
1768 (Got_plt_view_info::input_index): New data member.
1769 (Local_got_offset_visitor::visit): Write input file index.
1770 (Global_got_offset_visitor::visit): Write 0 for input file index.
1771 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
1772 with sym_index and input_index.
1773 (Output_section_incremental_inputs::write_got_plt): Adjust size of
1774 incremental info GOT entry; replace got_descriptor with input_index.
1775 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
1776 map from input file index to object.
1777 (Sized_relobj_incr::do_layout): Replace direct data member reference
1778 with accessor function.
1779 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
1780 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
1781 Adjust size of input file info header.
1782 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
1783 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
1784 (Incremental_input_entry_reader::get_input_section): Adjust size of
1785 input file info header.
1786 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
1787 of incremental info GOT entry.
1788 (Incremental_got_plt_reader::get_got_desc): Remove.
1789 (Incremental_got_plt_reader::get_got_symndx): New function.
1790 (Incremental_got_plt_reader::get_got_input_index): New function.
1791 (Sized_incremental_binary::Sized_incremental_binary): Remove
1792 file_status_; add input_objects_.
1793 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
1794 (Sized_incremental_binary::set_file_is_unchanged): Remove.
1795 (Sized_incremental_binary::file_is_unchanged): Remove.
1796 (Sized_incremental_binary::set_input_object): New function.
1797 (Sized_incremental_binary::input_object): New function.
1798 (Sized_incremental_binary::file_status_): Remove.
1799 (Sized_incremental_binary::input_objects_): New data member.
1800 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
1802 (Sized_relobj_incr::invalid_address): Move to base class.
1803 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
1805 (Sized_relobj_incr::do_output_section_offset): Likewise.
1806 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
1807 (Sized_relobj_incr::section_offsets_): Likewise.
1808 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
1810 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
1811 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
1812 with accessor function.
1813 (Sized_relobj_file::do_layout): Likewise.
1814 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
1815 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
1816 (Sized_relobj_file::compute_final_local_value): Replace refs to
1817 section_offsets_ with accessor function.
1818 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
1819 * object.h (Relobj::Relobj): Initialize new data members.
1820 (Relobj::add_dyn_reloc): New function.
1821 (Relobj::first_dyn_reloc): New function.
1822 (Relobj::dyn_reloc_count): New function.
1823 (Relobj::first_dyn_reloc_): New data member.
1824 (Relobj::dyn_reloc_count_): New data member.
1825 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
1827 (Sized_relobj::Address): New typedef.
1828 (Sized_relobj::invalid_address): Move here from child class.
1829 (Sized_relobj::Sized_relobj): Initialize new data members.
1830 (Sized_relobj::sized_relobj): New function.
1831 (Sized_relobj::is_output_section_offset_invalid): Move here from
1833 (Sized_relobj::get_output_section_offset): Likewise.
1834 (Sized_relobj::local_has_got_offset): Likewise.
1835 (Sized_relobj::local_got_offset): Likewise.
1836 (Sized_relobj::set_local_got_offset): Likewise.
1837 (Sized_relobj::do_for_all_local_got_entries): Likewise.
1838 (Sized_relobj::clear_got_offsets): New function.
1839 (Sized_relobj::section_offsets): Move here from child class.
1840 (Sized_relobj::do_output_section_offset): Likewise.
1841 (Sized_relobj::do_set_section_offset): Likewise.
1842 (Sized_relobj::Local_got_offsets): Likewise.
1843 (Sized_relobj::local_got_offsets_): Likewise.
1844 (Sized_relobj::section_offsets_): Likewise.
1845 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
1847 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
1849 (Sized_relobj_file::sized_relobj): New function
1850 (Sized_relobj_file::local_has_got_offset): Move to base class.
1851 (Sized_relobj_file::local_got_offset): Likewise.
1852 (Sized_relobj_file::set_local_got_offset): Likewise.
1853 (Sized_relobj_file::get_output_section_offset): Likewise.
1854 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
1855 (Sized_relobj_file::do_output_section_offset): Likewise.
1856 (Sized_relobj_file::do_set_section_offset): Likewise.
1857 (Sized_relobj_file::Local_got_offsets): Likewise.
1858 (Sized_relobj_file::local_got_offsets_): Likewise.
1859 (Sized_relobj_file::section_offsets_): Likewise.
1860 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
1862 (set_needs_dynsym_index): Convert relobj to derived class pointer.
1863 (Output_reloc::get_symbol_index): Likewise.
1864 (Output_reloc::local_section_offset): Likewise.
1865 (Output_reloc::get_address): Likewise.
1866 (Output_reloc::symbol_value): Likewise.
1867 (Output_data_got::reserve_slot): Move to class definition.
1868 (Output_data_got::reserve_local): New function.
1869 (Output_data_got::reserve_slot_for_global): Remove.
1870 (Output_data_got::reserve_global): New function.
1871 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
1872 (all constructors, two instantiations).
1873 (Output_reloc::get_relobj): New function (two instantiations).
1874 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
1875 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
1876 (Output_data_reloc::add_global): Adjust type of relobj.
1877 (Output_data_reloc::add_global_relative): Likewise.
1878 (Output_data_reloc::add_symbolless_global_addend): Likewise.
1879 (Output_data_reloc::add_local): Likewise.
1880 (Output_data_reloc::add_local_relative): Likewise.
1881 (Output_data_reloc::add_symbolless_local_addend): Likewise.
1882 (Output_data_reloc::add_local_section): Likewise.
1883 (Output_data_reloc::add_output_section): Likewise.
1884 (Output_data_reloc::add_absolute): Likewise.
1885 (Output_data_reloc::add_target_specific): Likewise.
1886 (Output_data_got::reserve_slot): Move definition here.
1887 (Output_data_got::reserve_local): New function.
1888 (Output_data_got::reserve_global): New function.
1889 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
1890 section_offsets_ with accessor function.
1891 (Sized_relobj_file::write_sections): Likewise.
1892 (Sized_relobj_file::do_relocate_sections): Likewise.
1893 * target.h (Sized_target::reserve_local_got_entry): New function.
1894 (Sized_target::reserve_global_got_entry): New function.
1895 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
1896 (Target_x86_64::reserve_global_got_entry): New function.
1897 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
1899 2011-05-23 Cary Coutant <ccoutant@google.com>
1901 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
1902 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
1903 bit when checking got_type.
1904 * incremental.cc (Sized_incremental_binary::setup_readers):
1905 Store symbol table and string table locations; initialize bit vector
1906 of file status flags.
1907 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
1909 (Sized_incremental_binary::do_process_got_plt): New function.
1910 (Sized_incremental_binary::get_symtab_view): Use stored locations.
1911 (Output_section_incremental_inputs::set_final_data_size): Record
1912 file index for each input file.
1913 (Output_section_incremental_inputs::write_got_plt): Store file index
1914 instead of input entry offset for each GOT entry.
1916 (Incremental_input_entry::Incremental_input_entry): Initialize new
1918 (Incremental_input_entry::set_offset): Store file index.
1919 (Incremental_input_entry::get_file_index): New function.
1920 (Incremental_input_entry::file_index_): New data member.
1921 (Incremental_binary::process_got_plt): New function.
1922 (Incremental_binary::do_process_got_plt): New function.
1923 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1925 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
1926 (Sized_incremental_binary::set_file_is_unchanged): New function.
1927 (Sized_incremental_binary::file_is_unchanged): New function.
1928 (Sized_incremental_binary::do_process_got_plt): New function.
1929 (Sized_incremental_binary::file_status_): New data member.
1930 (Sized_incremental_binary::main_symtab_loc_): New data member.
1931 (Sized_incremental_binary::main_strtab_loc_): New data member.
1932 * output.cc (Output_data_got::Got_entry::write): Add case
1934 (Output_data_got::add_global): Call add_got_entry.
1935 (Output_data_got::add_global_plt): Likewise.
1936 (Output_data_got::add_global_with_rel): Likewise.
1937 (Output_data_got::add_global_with_rela): Likewise.
1938 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
1939 (Output_data_got::add_global_pair_with_rela): Likewise.
1940 (Output_data_got::add_local): Call add_got_entry.
1941 (Output_data_got::add_local_plt): Likewise.
1942 (Output_data_got::add_local_with_rel): Likewise.
1943 (Output_data_got::add_local_with_rela): Likewise.
1944 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
1945 (Output_data_got::add_local_pair_with_rela): Likewise.
1946 (Output_data_got::reserve_slot): New function.
1947 (Output_data_got::reserve_slot_for_global): New function.
1948 (Output_data_got::add_got_entry): New function.
1949 (Output_data_got::add_got_entry_pair): New function.
1950 (Output_section::add_output_section_data): Edit FIXME.
1952 (Output_section_data_build::Output_section_data_build): New
1953 constructor with size parameter.
1954 (Output_data_space::Output_data_space): Likewise.
1955 (Output_data_got::Output_data_got): Initialize new data member; new
1956 constructor with size parameter.
1957 (Output_data_got::add_constant): Call add_got_entry.
1958 (Output_data_got::reserve_slot): New function.
1959 (Output_data_got::reserve_slot_for_global): New function.
1960 (class Output_data_got::Got_entry): Add RESERVED_CODE.
1961 (Output_data_got::add_got_entry): New function.
1962 (Output_data_got::add_got_entry_pair): New function.
1963 (Output_data_got::free_list_): New data member.
1964 * target.h (Sized_target::init_got_plt_for_update): New function.
1965 (Sized_target::register_global_plt_entry): New function.
1966 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1967 Initialize new data member; call init; add constructor with PLT count.
1968 (Output_data_plt_x86_64::init): New function.
1969 (Output_data_plt_x86_64::add_relocation): New function.
1970 (Output_data_plt_x86_64::reserve_slot): New function.
1971 (Output_data_plt_x86_64::free_list_): New data member.
1972 (Target_x86_64::init_got_plt_for_update): New function.
1973 (Target_x86_64::register_global_plt_entry): New function.
1974 (Output_data_plt_x86_64::add_entry): Allocate from free list for
1975 incremental updates.
1976 (Output_data_plt_x86_64::add_relocation): New function.
1977 * testsuite/object_unittest.cc (Object_test): Set default options.
1979 2011-05-16 Ian Lance Taylor <iant@google.com>
1981 * options.h (class General_options): Make -i a synonym for -r.
1983 2011-05-16 Ian Lance Taylor <iant@google.com>
1985 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
1987 2011-05-10 Cary Coutant <ccoutant@google.com>
1989 * object.cc (Sized_relobj::do_count_local_symbols): Check for
1992 2011-05-06 Ian Lance Taylor <iant@google.com>
1994 * layout.cc (Layout::layout): If the output section flags change,
1995 update the ordering.
1997 2011-04-25 Cary Coutant <ccoutant@google.com>
1999 * incremental-dump.cc (dump_incremental_inputs): Print local
2000 symbol info for each input file.
2002 (Output_section_incremental_inputs::set_final_data_size): Add local
2003 symbol info to input file entries in incremental info.
2004 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2005 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
2006 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
2007 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
2009 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
2010 (Sized_incr_relobj::do_relocate): Write the local symbols.
2011 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
2012 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
2013 Adjust size of input file header.
2014 (Incremental_inputs_reader::get_local_symbol_offset): New function.
2015 (Incremental_inputs_reader::get_local_symbol_count): New function.
2016 (Incremental_inputs_reader::get_input_section): Adjust size of input
2018 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
2019 (Sized_incr_relobj::This): New typedef.
2020 (Sized_incr_relobj::sym_size): New const data member.
2021 (Sized_incr_relobj::Local_symbol): New struct.
2022 (Sized_incr_relobj::do_output_local_symbol_count): New function.
2023 (Sized_incr_relobj::do_local_symbol_offset): New function.
2024 (Sized_incr_relobj::local_symbol_count_): New data member.
2025 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
2026 (Sized_incr_relobj::local_symbol_index_): New data member.
2027 (Sized_incr_relobj::local_symbol_offset_): New data member.
2028 (Sized_incr_relobj::local_dynsym_offset_): New data member.
2029 (Sized_incr_relobj::local_symbols_): New data member.
2030 * object.h (Relobj::output_local_symbol_count): New function.
2031 (Relobj::local_symbol_offset): New function.
2032 (Relobj::do_output_local_symbol_count): New function.
2033 (Relobj::do_local_symbol_offset): New function.
2034 (Sized_relobj::do_output_local_symbol_count): New function.
2035 (Sized_relobj::do_local_symbol_offset): New function.
2037 2011-04-22 Vladimir Simonov <sv@sw.ru>
2039 * descriptors.cc (set_close_on_exec): New function.
2040 (Descriptors::open): Use set_close_on_exec.
2041 * output.cc (S_ISLNK): Define if not defined.
2043 2011-04-22 Cary Coutant <ccoutant@google.com>
2045 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2047 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2048 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
2049 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
2051 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
2052 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
2053 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
2055 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
2057 (Incremental_binary::apply_incremental_relocs): New function.
2058 (Incremental_binary::do_apply_incremental_relocs): New function.
2059 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2061 (Sized_incremental_binary::add_global_symbol): New function.
2062 (Sized_incremental_binary::global_symbol): New function.
2063 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2064 (Sized_incremental_binary::symbol_map_): New data member.
2065 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
2066 * target.h (Sized_target::apply_relocation): New function.
2067 * target-reloc.h (apply_relocation): New function.
2068 * x86_64.cc (Target_x86_64::apply_relocation): New function.
2070 2011-04-22 Doug Kwan <dougkwan@google.com>
2072 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
2073 flag of a SHT_ARM_EXIDX section.
2074 * testsuite/Makefile.am (arm_exidx_test): New test rules.
2075 * testsuite/Makefile.in: Regenerate.
2076 * testsuite/arm_exidx_test.s: New file.
2077 * testsuite/arm_exidx_test.sh: Same.
2079 2011-04-20 Cary Coutant <ccoutant@google.com>
2082 * archive.h (Incremental_archive_entry::Archive_member):
2083 Initialize arg_serial_ (second constructor).
2085 2011-04-17 Ian Lance Taylor <iant@google.com>
2087 * object.cc (Relocate_info::location): Simplify location string.
2088 * errors.cc (Errors::error_at_location): Don't print program
2090 (Errors::warning_at_location): Likewise.
2091 (Errors::undefined_symbol): Likewise.
2092 * testsuite/debug_msg.sh: Update accordingly.
2094 2011-04-14 Cary Coutant <ccoutant@google.com>
2096 * gold/layout.cc (Layout::symtab_section_offset): New function.
2097 * gold/layout.h (Layout::symtab_section_offset): New function.
2098 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
2100 2011-04-12 Ian Lance Taylor <iant@google.com>
2102 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
2103 with MREMAP_MAYMOVE.
2104 * output.h (class Output_file): Add map_is_allocated_ field.
2105 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
2106 not available, provide stubs. If mremap is not available, #define
2108 (MREMAP_MAYMOVE): Define if not defined.
2109 (Output_file::Output_file): Initialize map_is_allocated_.
2110 (Output_file::resize): Check map_is_allocated_.
2111 (Output_file::map_anonymous): If mmap fails, use malloc.
2112 (Output_file::unmap): Don't do anything for an anonymous map.
2113 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
2114 is not available, provide stubs.
2115 (File_read::View::~View): Use free rather than delete[].
2116 (File_read::make_view): Use malloc rather than new[]. If mmap
2118 (File_read::find_or_make_view): Use malloc rather than new[].
2119 * gold.h: Remove HAVE_REMAP code.
2120 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
2121 exists. Rename mremap to gold_mremap. If mmap is not available
2123 * configure, config.in: Rebuild.
2125 2011-04-11 Ian Lance Taylor <iant@google.com>
2127 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
2128 initialize local variable v.
2130 2011-04-11 Cary Coutant <ccoutant@google.com>
2132 * archive.cc (Archive::include_member): Adjust call to
2134 (Add_archive_symbols::run): Track argument serial numbers.
2135 (Lib_group::include_member): Likewise.
2136 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
2137 * archive.h (Incremental_archive_entry::Archive_member):
2138 Initialize arg_serial_.
2139 (Archive_member::arg_serial_): New data member.
2140 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
2141 (Sized_dynobj::do_add_symbols): Track symbols when doing an
2143 (Sized_dynobj::do_for_all_local_got_entries): New function.
2144 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
2146 * fileread.cc (get_mtime): New function.
2147 * fileread.h (get_mtime): New function.
2148 * gold.cc (queue_initial_tasks): Check for incremental update.
2149 (process_incremental_input): New function.
2150 (queue_middle_tasks): Don't force valid target for incremental
2152 * incremental-dump.cc (find_input_containing_global): Adjust
2153 size of symbol info entry.
2154 (dump_incremental_inputs): Dump argument serial number and
2155 in_system_directory flag; bias shndx by 1; print symbol names
2156 when dumping per-file symbol lists; use new symbol info readers.
2158 (Output_section_incremental_inputs:update_data_size): New function.
2159 (Sized_incremental_binary::setup_readers): Setup input readers
2160 for each input file; build maps for files added from libraries
2162 (Sized_incremental_binary::check_input_args): New function.
2163 (Sized_incremental_binary::do_check_inputs): Build map of argument
2164 serial numbers to input arguments.
2165 (Sized_incremental_binary::do_file_has_changed): Rename
2166 do_file_is_unchanged to this; compare file modification times.
2167 (Sized_incremental_binary::do_init_layout): New function.
2168 (Sized_incremental_binary::do_reserve_layout): New function.
2169 (Sized_incremental_binary::do_get_input_reader): Remove.
2170 (Sized_incremental_binary::get_symtab_view): New function.
2171 (Incremental_checker::can_incrementally_link_output_file): Remove.
2172 (Incremental_inputs::report_command_line): Exclude --debug options.
2173 (Incremental_inputs::report_archive_begin): Add parameter; track
2174 argument serial numbers; don't put input file entry for archive
2175 before archive members.
2176 (Incremental_inputs::report_archive_end): Put input file entry
2177 for archive after archive members.
2178 (Incremental_inputs::report_object): Add parameter; track argument
2179 serial numbers and in_system_directory flag.
2180 (Incremental_inputs::report_script): Add parameter; track argument
2182 (Output_section_incremental_inputs::set_final_data_size): Adjust
2183 size of symbol info entry; check for forwarding symbols.
2184 (Output_section_incremental_inputs::write_input_files): Write
2185 in_system_directory flag and argument serial number.
2186 (Output_section_incremental_inputs::write_info_blocks): Map section
2187 indices between incremental info and original input file; store
2188 input section index for each symbol.
2189 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2190 change operator() to visit().
2191 (class Global_got_offset_visitor): Likewise.
2192 (class Global_symbol_visitor_got_plt):
2193 (Output_section_incremental_inputs::write_got_plt): Use new visitor
2195 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
2196 (Sized_incr_relobj::do_read_symbols): New function.
2197 (Sized_incr_relobj::do_layout): New function.
2198 (Sized_incr_relobj::do_layout_deferred_sections): New function.
2199 (Sized_incr_relobj::do_add_symbols): New function.
2200 (Sized_incr_relobj::do_should_include_member): New function.
2201 (Sized_incr_relobj::do_for_all_global_symbols): New function.
2202 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
2203 (Sized_incr_relobj::do_section_size): New function.
2204 (Sized_incr_relobj::do_section_name): New function.
2205 (Sized_incr_relobj::do_section_contents): New function.
2206 (Sized_incr_relobj::do_section_flags): New function.
2207 (Sized_incr_relobj::do_section_entsize): New function.
2208 (Sized_incr_relobj::do_section_address): New function.
2209 (Sized_incr_relobj::do_section_type): New function.
2210 (Sized_incr_relobj::do_section_link): New function.
2211 (Sized_incr_relobj::do_section_info): New function.
2212 (Sized_incr_relobj::do_section_addralign): New function.
2213 (Sized_incr_relobj::do_initialize_xindex): New function.
2214 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2215 (Sized_incr_relobj::do_read_relocs): New function.
2216 (Sized_incr_relobj::do_gc_process_relocs): New function.
2217 (Sized_incr_relobj::do_scan_relocs): New function.
2218 (Sized_incr_relobj::do_count_local_symbols): New function.
2219 (Sized_incr_relobj::do_finalize_local_symbols): New function.
2220 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2221 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2222 (Sized_incr_relobj::do_relocate): New function.
2223 (Sized_incr_relobj::do_set_section_offset): New function.
2224 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2225 (Sized_incr_dynobj::do_read_symbols): New function.
2226 (Sized_incr_dynobj::do_layout): New function.
2227 (Sized_incr_dynobj::do_add_symbols): New function.
2228 (Sized_incr_dynobj::do_should_include_member): New function.
2229 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
2230 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
2231 (Sized_incr_dynobj::do_section_size): New function.
2232 (Sized_incr_dynobj::do_section_name): New function.
2233 (Sized_incr_dynobj::do_section_contents): New function.
2234 (Sized_incr_dynobj::do_section_flags): New function.
2235 (Sized_incr_dynobj::do_section_entsize): New function.
2236 (Sized_incr_dynobj::do_section_address): New function.
2237 (Sized_incr_dynobj::do_section_type): New function.
2238 (Sized_incr_dynobj::do_section_link): New function.
2239 (Sized_incr_dynobj::do_section_info): New function.
2240 (Sized_incr_dynobj::do_section_addralign): New function.
2241 (Sized_incr_dynobj::do_initialize_xindex): New function.
2242 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
2243 (make_sized_incremental_object): New function.
2244 (Incremental_library::copy_unused_symbols): New function.
2245 (Incremental_library::do_for_all_unused_symbols): New function.
2246 * incremental.h (enum Incremental_input_flags): New type.
2247 (class Incremental_checker): Remove.
2248 (Incremental_input_entry::Incremental_input_entry): Add argument
2250 (Incremental_input_entry::arg_serial): New function.
2251 (Incremental_input_entry::set_is_in_system_directory): New function.
2252 (Incremental_input_entry::is_in_system_directory): New function.
2253 (Incremental_input_entry::arg_serial_): New data member.
2254 (Incremental_input_entry::is_in_system_directory_): New data member.
2255 (class Script_info): Move here from script.h.
2256 (Script_info::Script_info): Add filename parameter.
2257 (Script_info::filename): New function.
2258 (Script_info::filename_): New data member.
2259 (Incremental_script_entry::Incremental_script_entry): Add argument
2261 (Incremental_object_entry::Incremental_object_entry): Likewise.
2262 (Incremental_object_entry::add_input_section): Build list of input
2263 sections with map to original shndx.
2264 (Incremental_object_entry::get_input_section_index): New function.
2265 (Incremental_object_entry::shndx_): New data member.
2266 (Incremental_object_entry::name_key_): Rename; adjust all refs.
2267 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
2268 (Incremental_archive_entry::Incremental_archive_entry): Add argument
2270 (Incremental_inputs::report_archive_begin): Likewise.
2271 (Incremental_inputs::report_object): Likewise.
2272 (Incremental_inputs::report_script): Likewise.
2273 (class Incremental_global_symbol_reader): New class.
2274 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
2275 and store flags and input file type.
2276 (Incremental_input_entry_reader::arg_serial): New function.
2277 (Incremental_input_entry_reader::type): Extract type from flags.
2278 (Incremental_input_entry_reader::is_in_system_directory): New function.
2279 (Incremental_input_entry_reader::get_input_section_count): Call
2280 accessor function for type.
2281 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
2282 function for type; adjust size of global symbol entry.
2283 (Incremental_input_entry_reader::get_global_symbol_count): Call
2284 accessor function for type.
2285 (Incremental_input_entry_reader::get_object_count): Likewise.
2286 (Incremental_input_entry_reader::get_object_offset): Likewise.
2287 (Incremental_input_entry_reader::get_member_count): Likewise.
2288 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
2289 (Incremental_input_entry_reader::get_member_offset): Likewise.
2290 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
2291 (Incremental_input_entry_reader::Global_symbol_info): Remove.
2292 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
2293 (Incremental_input_entry_reader::get_global_symbol_reader): New
2295 (Incremental_input_entry_reader::get_output_symbol_index): New
2297 (Incremental_input_entry_reader::type_): Remove.
2298 (Incremental_input_entry_reader::flags_): New data member.
2299 (Incremental_inputs_reader::input_file_offset): New function.
2300 (Incremental_inputs_reader::input_file_index): New function.
2301 (Incremental_inputs_reader::input_file): Call input_file_offset.
2302 (Incremental_inputs_reader::input_file_at_offset): New function.
2303 (Incremental_relocs_reader::get_r_type): Reformat.
2304 (Incremental_relocs_reader::get_r_shndx): Reformat.
2305 (Incremental_relocs_reader::get_r_offset): Reformat.
2306 (Incremental_relocs_reader::data): New function.
2307 (Incremental_binary::Incremental_binary): Initialize new data members.
2308 (Incremental_binary::check_inputs): Add cmdline parameter.
2309 (Incremental_binary::file_is_unchanged): Remove.
2310 (Input_reader::arg_serial): New function.
2311 (Input_reader::get_unused_symbol_count): New function.
2312 (Input_reader::get_unused_symbol): New function.
2313 (Input_reader::do_arg_serial): New function.
2314 (Input_reader::do_get_unused_symbol_count): New function.
2315 (Input_reader::do_get_unused_symbol): New function.
2316 (Incremental_binary::input_file_count): New function.
2317 (Incremental_binary::get_input_reader): Change signature to use
2318 index instead of filename.
2319 (Incremental_binary::file_has_changed): New function.
2320 (Incremental_binary::get_input_argument): New function.
2321 (Incremental_binary::get_library): New function.
2322 (Incremental_binary::get_script_info): New function.
2323 (Incremental_binary::init_layout): New function.
2324 (Incremental_binary::reserve_layout): New function.
2325 (Incremental_binary::output_file): New function.
2326 (Incremental_binary::do_check_inputs): New function.
2327 (Incremental_binary::do_file_is_unchanged): Remove.
2328 (Incremental_binary::do_file_has_changed): New function.
2329 (Incremental_binary::do_init_layout): New function.
2330 (Incremental_binary::do_reserve_layout): New function.
2331 (Incremental_binary::do_input_file_count): New function.
2332 (Incremental_binary::do_get_input_reader): Change signature.
2333 (Incremental_binary::input_args_map_): New data member.
2334 (Incremental_binary::library_map_): New data member.
2335 (Incremental_binary::script_map_): New data member.
2336 (Sized_incremental_binary::Sized_incremental_binary): Initialize
2338 (Sized_incremental_binary::output_section): New function.
2339 (Sized_incremental_binary::inputs_reader): Add const.
2340 (Sized_incremental_binary::symtab_reader): Add const.
2341 (Sized_incremental_binary::relocs_reader): Add const.
2342 (Sized_incremental_binary::got_plt_reader): Add const.
2343 (Sized_incremental_binary::get_symtab_view): New function.
2344 (Sized_incremental_binary::Inputs_reader): New typedef.
2345 (Sized_incremental_binary::Input_entry_reader): New typedef.
2346 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
2347 (Sized_incremental_binary::do_file_is_unchanged): Remove.
2348 (Sized_incremental_binary::do_file_has_changed): New function.
2349 (Sized_incremental_binary::do_init_layout): New function.
2350 (Sized_incremental_binary::do_reserve_layout): New function.
2351 (Sized_input_reader::Inputs_reader): Remove.
2352 (Sized_input_reader::Input_entry_reader): Remove.
2353 (Sized_input_reader::do_arg_serial): New function.
2354 (Sized_input_reader::do_get_unused_symbol_count): New function.
2355 (Sized_input_reader::do_get_unused_symbol): New function.
2356 (Sized_incremental_binary::do_input_file_count): New function.
2357 (Sized_incremental_binary::do_get_input_reader): Change signature;
2358 use index instead of filename.
2359 (Sized_incremental_binary::section_map_): New data member.
2360 (Sized_incremental_binary::input_entry_readers_): New data member.
2361 (class Sized_incr_relobj): New class.
2362 (class Sized_incr_dynobj): New class.
2363 (make_sized_incremental_object): New function.
2364 (class Incremental_library): New class.
2365 * layout.cc (Free_list::num_lists): New static data member.
2366 (Free_list::num_nodes): New static data member.
2367 (Free_list::num_removes): New static data member.
2368 (Free_list::num_remove_visits): New static data member.
2369 (Free_list::num_allocates): New static data member.
2370 (Free_list::num_allocate_visits): New static data member.
2371 (Free_list::init): New function.
2372 (Free_list::remove): New function.
2373 (Free_list::allocate): New function.
2374 (Free_list::dump): New function.
2375 (Free_list::print_stats): New function.
2376 (Layout_task_runner::run): Resize output file for incremental updates.
2377 (Layout::Layout): Initialize new data members.
2378 (Layout::set_incremental_base): New function.
2379 (Layout::init_fixed_output_section): New function.
2380 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
2381 incremental updates.
2382 (Layout::create_gold_note): Do not create gold note section for
2383 incremental updates.
2384 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
2385 for incremental updates.
2386 (Layout::set_section_offsets): For incremental updates, allocate space
2388 (Layout::create_symtab_sections): Layout with offsets relative to
2389 start of section; for incremental updates, allocate space from free
2391 (Layout::create_shdrs): For incremental updates, allocate space from
2393 (Layout::finish_dynamic_section): For incremental updates, do not
2394 check --as-needed (fixed in subsequent patch).
2395 * layout.h (class Free_list): New class.
2396 (Layout::set_incremental_base): New function.
2397 (Layout::incremental_base): New function.
2398 (Layout::init_fixed_output_section): New function.
2399 (Layout::allocate): New function.
2400 (Layout::incremental_base_): New data member.
2401 (Layout::free_list_): New data member.
2402 * main.cc (main): Print Free_list statistics.
2403 * object.cc (Relobj::finalize_incremental_relocs): Add
2404 clear_counts parameter; clear counts only when clear_counts is set.
2405 (Sized_relobj::Sized_relobj): Initialize new base class.
2406 (Sized_relobj::do_layout): Don't report special sections.
2407 (Sized_relobj::do_for_all_local_got_entries): New function.
2408 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
2409 symtab_off to all symbol table offsets.
2410 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
2411 * object.h (class Got_offset_list): Move to top of file.
2412 (Object::Object): Allow case where input_file == NULL.
2413 (Object::~Object): Likewise.
2414 (Object::input_file): Assert that input_file != NULL.
2415 (Object::lock): Allow case where input_file == NULL.
2416 (Object::unlock): Likewise.
2417 (Object::is_locked): Likewise.
2418 (Object::token): Likewise.
2419 (Object::release): Likewise.
2420 (Object::is_incremental): New function.
2421 (Object::get_mtime): New function.
2422 (Object::for_all_local_got_entries): New function.
2423 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
2424 (Object::set_is_in_system_directory): New function.
2425 (Object::is_in_system_directory): New function.
2426 (Object::do_is_incremental): New function.
2427 (Object::do_get_mtime): New function.
2428 (Object::do_for_all_local_got_entries): New function.
2429 (Object::is_in_system_directory_): New data member.
2430 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
2431 (class Sized_relobj_base): New class.
2432 (class Sized_relobj): Derive from Sized_relobj_base.
2433 (class Sized_relobj::Symbols): Redeclare from base class.
2434 (class Sized_relobj::local_got_offset_list): Remove.
2435 (class Sized_relobj::Output_sections): Redeclare from base class.
2436 (class Sized_relobj::do_for_all_local_got_entries): New function.
2437 (class Sized_relobj::write_local_symbols): Add offset parameter.
2438 (class Sized_relobj::local_symbol_offset_): Update comment.
2439 (class Sized_relobj::local_dynsym_offset_): Update comment.
2440 * options.cc (Input_arguments::add_file): Remove const.
2441 * options.h (Input_file_argument::Input_file_argument):
2442 Initialize arg_serial_ (all constructors).
2443 (Input_file_argument::set_arg_serial): New function.
2444 (Input_file_argument::arg_serial): New function.
2445 (Input_file_argument::arg_serial_): New data member.
2446 (Input_arguments::Input_arguments): Initialize file_count_.
2447 (Input_arguments::add_file): Remove const.
2448 (Input_arguments::number_of_input_files): New function.
2449 (Input_arguments::file_count_): New data member.
2450 (Command_line::number_of_input_files): Call
2451 Input_arguments::number_of_input_files.
2452 * output.cc (Output_segment_headers::Output_segment_headers):
2454 (Output_section::Input_section::current_data_size): New function.
2455 (Output_section::Output_section): Initialize new data members.
2456 (Output_section::add_input_section): Don't do merge sections for
2457 an incremental link; allocate space from free list for an
2459 (Output_section::add_output_section_data): Allocate space from
2460 free list for an incremental update.
2461 (Output_section::update_data_size): New function.
2462 (Output_section::set_fixed_layout): New function.
2463 (Output_section::reserve): New function.
2464 (Output_segment::set_section_addresses): Remove const.
2465 (Output_segment::set_section_list_addresses): Remove const; allocate
2466 space from free list for an incremental update.
2467 (Output_segment::set_offset): Adjust size of RELRO segment for an
2469 * output.h (Output_data::current_data_size): Move here from
2471 (Output_data::pre_finalize_data_size): New function.
2472 (Output_data::update_data_size): New function.
2473 (Output_section_headers::update_data_size): new function.
2474 (Output_section_data_build::current_data_size): Move to Output_data.
2475 (Output_data_strtab::update_data_size): New function.
2476 (Output_section::current_data_size): Move to Output_data.
2477 (Output_section::set_fixed_layout): New function.
2478 (Output_section::has_fixed_layout): New function.
2479 (Output_section::reserve): New function.
2480 (Output_section::update_data_size): New function.
2481 (Output_section::has_fixed_layout_): New data member.
2482 (Output_section::free_list_): New data member.
2483 (Output_segment::set_section_addresses): Remove const.
2484 (Output_segment::set_section_list_addresses): Remove const.
2485 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
2487 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
2489 * readsyms.cc (Read_symbols::do_read_symbols): Add library
2490 parameter when calling Add_symbols constructor; store argument
2491 serial number for members of a lib group.
2492 (Add_symbols::locks): Allow case where token == NULL.
2493 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
2494 (Read_member::~Read_member): New function.
2495 (Read_member::is_runnable): New function.
2496 (Read_member::locks): New function.
2497 (Read_member::run): New function.
2498 (Check_script::~Check_script): New function.
2499 (Check_script::is_runnable): New function.
2500 (Check_script::locks): New function.
2501 (Check_script::run): New function.
2502 (Check_library::~Check_library): New function.
2503 (Check_library::is_runnable): New function.
2504 (Check_library::locks): New function.
2505 (Check_library::run): New function.
2506 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
2507 (Add_symbols::library_): New data member.
2508 (class Read_member): New class.
2509 (class Check_script): New class.
2510 (class Check_library): New class.
2511 * reloc.cc (Read_relocs::is_runnable): Allow case where
2513 (Read_relocs::locks): Likewise.
2514 (Scan_relocs::locks): Likewise.
2515 (Relocate_task::locks): Likewise.
2516 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
2518 (Sized_relobj::incremental_relocs_scan): Fix comment.
2519 (Sized_relobj::do_relocate): Pass output file offset to
2520 write_local_symbols.
2521 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
2522 from class declaration.
2523 * script.cc (read_input_script): Allocate Script_info; pass
2524 argument serial number to report_script.
2525 * script.h (class Script_info): Move to incremental.h.
2526 * symtab.cc (Symbol_table::add_from_incrobj): New function.
2527 * symtab.h (Symbol_table::add_from_incrobj): New function.
2528 (Symbol_table::set_file_offset): New function.
2530 2011-04-05 Cary Coutant <ccoutant@google.com>
2532 * incremental-dump.cc (dump_incremental_inputs): Change signature
2533 to take a Sized_incremental_binary; change caller. Use readers
2534 in Sized_incremental_binary.
2536 (Sized_incremental_binary::find_incremental_inputs_sections):
2537 Rename do_find_incremental_inputs_sections to this.
2538 (Sized_incremental_binary::setup_readers): New function.
2539 (Sized_incremental_binary::do_check_inputs): Check
2540 has_incremental_info_ flag; move setup code to setup_readers;
2542 (Sized_incremental_binary::do_file_is_unchanged): New function.
2543 (Sized_incremental_binary::do_get_input_reader): New function.
2544 * incremental.h (class Incremental_binary): Move to end of file.
2545 (Incremental_binary::file_is_unchanged): New function.
2546 (Incremental_binary::do_file_is_unchanged): New function.
2547 (Incremental_binary::Input_reader): New class.
2548 (Incremental_binary::get_input_reader): New function.
2549 (class Sized_incremental_binary): Move to end of file.
2550 (Sized_incremental_binary::Sized_incremental_binary): Setup the
2551 input section reader classes.
2552 (Sized_incremental_binary::has_incremental_info): New function.
2553 (Sized_incremental_binary::inputs_reader): New function.
2554 (Sized_incremental_binary::symtab_reader): New function.
2555 (Sized_incremental_binary::relocs_reader): New function.
2556 (Sized_incremental_binary::got_plt_reader): New function.
2557 (Sized_incremental_binary::do_file_is_unchanged): New function.
2558 (Sized_incremental_binary::Sized_input_reader): New class.
2559 (Sized_incremental_binary::get_input_reader): New function.
2560 (Sized_incremental_binary::find_incremental_inputs_sections):
2561 Rename do_find_incremental_inputs_sections to this.
2562 (Sized_incremental_binary::setup_readers): New function.
2563 (Sized_incremental_binary::has_incremental_info_): New data member.
2564 (Sized_incremental_binary::inputs_reader_): New data member.
2565 (Sized_incremental_binary::symtab_reader_): New data member.
2566 (Sized_incremental_binary::relocs_reader_): New data member.
2567 (Sized_incremental_binary::got_plt_reader_): New data member.
2568 (Sized_incremental_binary::current_input_file_): New data member.
2570 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
2573 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
2576 2011-03-30 Cary Coutant <ccoutant@google.com>
2578 * archive.cc (Archive::include_member): Adjust call to report_object.
2579 (Add_archive_symbols::run): Add script_info to call to
2580 report_archive_begin.
2581 (Lib_group::include_member): Adjust call to report_object.
2582 (Add_lib_group_symbols::run): Adjust call to report_object.
2583 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
2584 blocks. Add object count for script input files.
2585 * incremental.cc (Incremental_inputs::report_archive_begin): Add
2586 script_info parameter; change all callers.
2587 (Incremental_inputs::report_object): Add script_info parameter;
2589 (Incremental_inputs::report_script): Store backpointer to
2590 incremental info entry.
2591 (Output_section_incremental_inputs::set_final_data_size): Record
2592 additional information for scripts.
2593 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2594 * incremental.h (Incremental_script_entry::add_object): New function.
2595 (Incremental_script_entry::get_object_count): New function.
2596 (Incremental_script_entry::get_object): New function.
2597 (Incremental_script_entry::objects_): New data member; adjust
2599 (Incremental_inputs::report_archive_begin): Add script_info parameter.
2600 (Incremental_inputs::report_object): Add script_info parameter.
2601 (Incremental_inputs_reader::get_object_count): New function.
2602 (Incremental_inputs_reader::get_object_offset): New function.
2603 * options.cc (Input_arguments::add_file): Return reference to
2605 * options.h (Input_argument::set_script_info): New function.
2606 (Input_argument::script_info): New function.
2607 (Input_argument::script_info_): New data member; adjust all
2609 (Input_file_group::add_file): Return reference to new input argument.
2610 (Input_file_lib::add_file): Likewise.
2611 (Input_arguments::add_file): Likewise.
2612 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
2613 * script.cc (Parser_closure::Parser_closure): Add script_info
2614 parameter; adjust all callers.
2615 (Parser_closure::script_info): New function.
2616 (Parser_closure::script_info_): New data member.
2617 (read_input_script): Report scripts earlier to incremental info.
2618 (script_add_file): Set script_info in Input_argument.
2619 (script_add_library): Likewise.
2620 * script.h (Script_options::Script_info): Rewrite class.
2622 2011-03-29 Cary Coutant <ccoutant@google.com>
2624 * archive.cc (Library_base::should_include_member): Move
2625 method here from class Archive.
2626 (Archive::Archive): Initialize base class.
2627 (Archive::should_include_member): Move to base class.
2628 (Archive::do_for_all_unused_symbols): New function.
2629 (Add_archive_symbols::run): Remove redundant access to
2631 (Lib_group::Lib_group): Initialize base class.
2632 (Lib_group::do_filename): New function.
2633 (Lib_group::include_member): Pass pointer to Lib_group to
2635 (Lib_group::do_for_all_unused_symbols): New function.
2636 (Add_lib_group_symbols::run): Report archive information for
2638 * archive.h (class Library_base): New base class.
2639 (class Archive): Derive from Library_base.
2640 (Archive::filename): Move to base class.
2641 (Archive::set_incremental_info): Likewise.
2642 (Archive::incremental_info): Likewise.
2643 (Archive::Should_include): Likewise.
2644 (Archive::should_include_member): Likewise.
2645 (Archive::Armap_entry): Remove.
2646 (Archive::Unused_symbol_iterator): Remove.
2647 (Archive::unused_symbols_begin): Remove.
2648 (Archive::unused_symbols_end): Remove.
2649 (Archive::do_filename): New function.
2650 (Archive::do_get_mtime): New function.
2651 (Archive::do_for_all_unused_symbols): New function.
2652 (Archive::task_): Move to base class.
2653 (Archive::incremental_info_): Likewise.
2654 (class Lib_group): Derive from Library_base.
2655 (Lib_group::do_filename): New function.
2656 (Lib_group::do_get_mtime): New function.
2657 (Lib_group::do_for_all_unused_symbols): New function.
2658 (Lib_group::task_): Move to base class.
2659 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
2661 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
2663 * incremental.cc (Incremental_inputs::report_archive_begin):
2664 Use Library_base; call library's get_mtime; add incremental inputs
2665 entry before members.
2666 (class Unused_symbol_visitor): New class.
2667 (Incremental_inputs::report_archive_end): Use Library_base; use
2668 visitor class to record unused symbols; don't add incremental inputs
2669 entry after members.
2670 (Incremental_inputs::report_object): Use Library_base.
2672 (Incremental_archive_entry::Incremental_archive_entry): Remove
2673 unused Archive parameter.
2674 (Incremental_inputs::report_archive_begin): Use Library_base.
2675 (Incremental_inputs::report_archive_end): Likewise.
2676 (Incremental_inputs::report_object): Likewise.
2677 * object.cc (Sized_relobj::do_for_all_global_symbols): New
2679 * object.h (Object::for_all_global_symbols): New function.
2680 (Object::do_for_all_global_symbols): New function.
2681 (Sized_relobj::do_for_all_global_symbols): New function.
2682 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
2684 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
2687 2011-03-27 Ian Lance Taylor <iant@google.com>
2689 * archive.cc (Archive::interpret_header): Return -1 if something
2690 goes wrong. Change callers accordingly.
2692 2011-03-25 Cary Coutant <ccoutant@google.com>
2694 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
2695 * testsuite/Makefile.in: Regenerate.
2697 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
2699 * plugin.cc (get_view): New.
2700 (Plugin::load): Pass get_view to the plugin.
2701 (Plugin_manager::get_view): New.
2703 2011-03-21 Ian Lance Taylor <iant@google.com>
2705 * testsuite/final_layout.sh: Rewrite to not use dc.
2706 * testsuite/relro_test.sh: Fail if dc is not present.
2708 2011-03-21 Sriraman Tallam <tmsriram@google.com>
2710 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
2712 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
2713 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
2715 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
2716 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
2718 2011-03-14 Ian Lance Taylor <iant@google.com>
2720 * script-sections.cc (Sort_output_sections::script_compare):
2721 Rename from is_before, change return type.
2722 (Sort_output_sections::operator()): Adjust accordingly.
2724 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
2727 * testsuite/odr_violation2.cc: Add comment to make all error line
2728 numbers double digits.
2729 * testsuite/debug_msg.sh: Adjust expected errors.
2731 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
2733 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
2734 but mark earlier ones as non-canonical
2735 (offset_to_iterator): Update search target and example
2736 (do_addr2line): Return extra lines in a vector*
2737 (format_file_lineno): Extract from do_addr2line
2738 (one_addr2line): Add vector* out-param
2739 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
2740 when a lineno entry appeared last for its instruction
2741 (Dwarf_line_info): Add vector* out-param
2742 * object.cc (Relocate_info): Pass NULL for the vector* out-param
2743 * symtab.cc (Odr_violation_compare): Include the lineno in the
2745 (linenos_from_loc): New. Combine the canonical line for an
2746 address with its other lines.
2747 (True_if_intersect): New. Helper functor to make
2748 std::set_intersection a query.
2749 (detect_odr_violations): Compare sets of lines instead of just
2750 one line for each function. This became less deterministic, but
2751 has fewer false positives.
2752 * symtab.h: Declarations.
2753 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
2754 mix an optimized and non-optimized object in the same binary
2755 (odr_violation2.so): Same.
2756 * testsuite/Makefile.in: Regenerate from Makefile.am.
2757 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
2758 * testsuite/debug_msg.sh: Update line numbers and add
2760 * testsuite/odr_violation1.cc: Use OdrDerived, in a
2761 non-optimized context.
2762 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
2763 isn't inlined, and use OdrDerived in an optimized context.
2764 * testsuite/odr_header1.h: Defines OdrDerived, where
2765 optimization will change the
2766 first-instruction-in-the-destructor's file and line number.
2767 * testsuite/odr_header2.h: Defines OdrBase.
2769 2011-03-09 Ian Lance Taylor <iant@google.com>
2771 * fileread.cc (File_read::clear_views): Don't delete the whole
2774 2011-03-08 Ian Lance Taylor <iant@google.com>
2777 * fileread.cc: #include <climits>.
2778 (GOLD_IOV_MAX): Define.
2779 (File_read::read_multiple): Limit number of entries by iov_max.
2780 * fileread.h (class File_read): Always set max_readv_entries to
2783 2011-03-07 Ian Lance Taylor <iant@google.com>
2786 * options.h (class General_options): Add -dy and -dn.
2788 2011-03-02 Cary Coutant <ccoutant@google.com>
2790 * testsuite/script_test_9.t: Add TLS segment.
2792 2011-03-02 Simon Baldwin <simonb@google.com>
2794 * configure.ac: Add check for gnu_indirect_function support in
2795 the toolchain building binutils.
2796 * configure: Rebuild.
2798 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
2800 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
2801 plugin only symbols.
2802 (Symbol_table::sized_finalize_symbol) Mark symbol only present
2803 in plugin files as not needed in the symbol table.
2805 2011-02-11 Sriraman Tallam <tmsriram@google.com>
2807 * output.cc (Output_section::add_input_section): Delay fill
2808 generation for section ordering.
2810 2011-02-09 Ian Lance Taylor <iant@google.com>
2813 * object.h (class Sized_relobj): Remove clear_local_symbols.
2814 * reloc.cc (Sized_relobj::do_relocate): Don't call
2815 clear_local_symbols.
2817 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
2819 * plugin.cc (is_visible_from_outside): Return true for symbols
2822 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
2824 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
2827 2011-02-02 Sriraman Tallam <tmsriram@google.com>
2829 * icf.h (is_section_foldable_candidate): Change type of parameter
2831 * icf.cc (Icf::find_identical_sections): Change type of local variable
2832 section_name to be std::string.
2833 (is_function_ctor_or_dtor): Change type of parameter to std::string.
2835 2011-01-25 Ian Lance Taylor <iant@google.com>
2837 * script.cc (script_add_extern): Rewrite to use
2838 add_symbol_reference.
2840 2011-01-25 Doug Kwan <dougkwan@google.com>
2842 * icf.cc (get_section_contents): Always lock section's object.
2844 2011-01-24 Ian Lance Taylor <iant@google.com>
2846 * options.h (class General_options): Accept
2847 --no-detect-odr-violations.
2849 2011-01-24 Ian Lance Taylor <iant@google.com>
2851 * version.cc (version_string): Bump to 1.11.
2853 2011-01-24 Ian Lance Taylor <iant@google.com>
2855 * plugin.cc (class Plugin_rescan): Define new class.
2856 (Plugin_manager::claim_file): Set any_claimed_.
2857 (Plugin_manager::save_archive): New function.
2858 (Plugin_manager::save_input_group): New function.
2859 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
2861 (Plugin_manager::new_undefined_symbol): New function.
2862 (Plugin_manager::rescan): New function.
2863 (Plugin_manager::rescannable_defines): New function.
2864 (Plugin_manager::add_input_file): Set any_added_.
2865 * plugin.h (class Plugin_manager): define new fields rescannable_,
2866 undefined_symbols_, any_claimed_, and any_added_. Declare
2867 Plugin_rescan as friend. Declare new functions.
2868 (Plugin_manager::Rescannable): Define type.
2869 (Plugin_manager::Rescannable_list): Define type.
2870 (Plugin_manager::Undefined_symbol_list): Define type.
2871 (Plugin_manager::Plugin_manager): Initialize new fields.
2872 * archive.cc (Archive::defines_symbol): New function.
2873 (Add_archive_symbols::run): Pass archive to plugins if any.
2874 * archive.h (class Archive): Declare defines_symbol.
2875 * readsyms.cc (Input_group::~Input_group): New function.
2876 (Finish_group::run): Pass input_group to plugins if any.
2877 * readsyms.h (class Input_group): Declare destructor.
2878 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
2881 2011-01-10 Ian Lance Taylor <iant@google.com>
2883 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
2885 (Layout::set_segment_offsets): Reset increase_relro before calling
2886 set_section_addresses a second time.
2888 2011-01-04 Cary Coutant <ccoutant@google.com>
2890 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
2891 sections before NOBITS sections.
2893 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
2895 * version.cc (print_version): Update copyright to 2011.
2897 2010-12-23 Cary Coutant <ccoutant@google.com>
2899 * output.h (Output_data_reloc::add_output_section): Pass OD instead
2900 of OS to this->add. Add OD parameter to second form of the function.
2902 2010-12-20 Ian Lance Taylor <iant@google.com>
2904 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
2905 second of two consecutive entries with same offset.
2907 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2909 * testsuite/Makefile.am (ifuncmain2static_LDADD)
2910 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
2911 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
2912 to avoid unneeded links against $(LDADD).
2913 * testsuite/Makefile.in: Regenerate.
2915 2010-12-15 Ian Lance Taylor <iant@google.com>
2918 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
2919 for R_X86_64_32 and R_X86_64_PC32.
2920 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
2921 ver_matching_def_pic.o.
2922 (ver_matching_def_pic.o): New target.
2924 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2926 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
2927 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
2928 Move definition before File_read::View member definitions.
2929 (File_read::View::~View): Initialize and hold lock before
2930 updating current_mapped_bytes.
2932 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2934 * dwarf_reader.cc: Remove outdated comment.
2935 * gold-threads.cc: Fix typo in error message.
2936 * archive.cc: Fix typos in comments.
2937 * archive.h: Likewise.
2938 * arm-reloc-property.cc: Likewise.
2939 * arm-reloc-property.h: Likewise.
2940 * arm-reloc.def: Likewise.
2942 * attributes.h: Likewise.
2943 * cref.cc: Likewise.
2944 * ehframe.cc: Likewise.
2945 * fileread.h: Likewise.
2947 * i386.cc: Likewise.
2949 * incremental.h: Likewise.
2950 * int_encoding.cc: Likewise.
2951 * layout.h: Likewise.
2952 * main.cc: Likewise.
2953 * merge.h: Likewise.
2954 * object.cc: Likewise.
2955 * object.h: Likewise.
2956 * options.cc: Likewise.
2957 * readsyms.cc: Likewise.
2958 * reduced_debug_output.cc: Likewise.
2959 * reloc.cc: Likewise.
2960 * script-sections.cc: Likewise.
2961 * sparc.cc: Likewise.
2962 * symtab.h: Likewise.
2963 * target-reloc.h: Likewise.
2964 * target.cc: Likewise.
2965 * target.h: Likewise.
2966 * timer.cc: Likewise.
2967 * timer.h: Likewise.
2968 * x86_64.cc: Likewise.
2970 2010-12-09 Cary Coutant <ccoutant@google.com>
2972 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
2974 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
2975 parameter; change all callers.
2976 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
2977 * options.h (warn_execstack): New option.
2979 2010-12-07 Doug Kwan <dougkwan@google.com>
2981 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
2982 like function call relocations.
2984 2010-12-07 Ian Lance Taylor <iant@google.com>
2986 * archive.cc (Archive::get_elf_object_for_member): Permit
2987 punconfigured to be NULL.
2988 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
2989 (Archive::include_member): Pass NULL to get_elf_object_for_member
2990 if we searched for the archive and this is the first included
2993 2010-12-01 Ian Lance Taylor <iant@google.com>
2995 * dwarf_reader.h (class Sized_dwarf_line_info): Add
2996 track_relocs_type_ field.
2997 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2998 Set track_relocs_type_.
2999 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
3000 contents when using RELA relocs.
3001 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
3003 * reloc.cc (Track_relocs::next_addend): New function.
3004 * reloc.h (class Track_relocs): Declare next_addend.
3006 2010-12-01 Ian Lance Taylor <iant@google.com>
3008 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
3011 2010-12-01 Ian Lance Taylor <iant@google.com>
3013 * README: Update compilers known to work and fail.
3015 2010-11-23 Matthias Klose <doko@ubuntu.com>
3017 * configure.in: For --enable-gold, handle value `default' instead of
3018 `both*'. Always install ld as ld.bfd, install as ld if gold is
3020 * configure: Regenerate.
3022 2010-11-18 Doug Kwan <dougkwan@google.com>
3024 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
3025 and right_alignment to be zero. Store result alignment only if it is
3026 greater than existing alignment.
3028 2010-11-16 Cary Coutant <ccoutant@google.com>
3031 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3032 Check for ".zdebug_line".
3034 2010-11-16 Doug Kwan <dougkwan@google.com>
3035 Cary Coutant <ccoutant@google.com>
3037 * output.h (Output_segment::set_section_addresses): Pass increase_relro
3038 by reference; adjust all callers.
3039 * output.cc (Output_segment::set_section_addresses): Adjust references
3040 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
3042 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
3043 end at page boundary.
3045 2010-11-16 Cary Coutant <ccoutant@google.com>
3048 * layout.cc (Layout::choose_output_section): Transform names of
3049 compressed sections even when using a script with a SECTIONS clause.
3050 (Layout::output_section_name): Remove code to transform
3051 compressed debug section names.
3052 * output.cc (Output_section::add_input_section): Use uncompressed
3053 section size when tracking input sections.
3055 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
3057 * symtab.h (Symbol::NON_PIC_REF): Remove.
3058 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
3059 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
3060 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
3061 (Symbol::use_plt_offset): Take a flags argument and pass it
3062 directly to needs_dynamic_reloc. Restrict check for undefined
3063 weak symbols to function calls.
3064 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
3065 (Target_arm::Scan::global): Use it.
3066 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
3067 (Target_arm::Relocate::relocate): Likewise.
3068 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
3069 parameter with an r_type parameter. Use get_reference_flags
3071 (Target_arm::Relocate::relocate): Update accordingly.
3072 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
3073 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
3074 (Target_i386::Scan::global): Likewise.
3075 (Target_i386::Relocate::relocate): Likewise.
3076 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
3077 parameter with an r_type parameter. Use get_reference_flags
3079 (Target_i386::Relocate::relocate): Update accordingly.
3080 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
3081 (Target_powerpc::Scan::global): Use it.
3082 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
3083 (Target_powerpc::Relocate::relocate): Likewise.
3084 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
3085 (Target_sparc::Scan::global): Use it.
3086 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
3087 (Target_sparc::Relocate::relocate): Likewise.
3088 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
3089 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
3090 (Target_x86_64::Scan::global): Likewise.
3091 (Target_x86_64::Relocate::relocate): Likewise.
3093 2010-11-08 Doug Kwan <dougkwan@google.com>
3094 Cary Coutant <ccoutant@google.com>
3096 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
3097 (Arm_exidx_merge_section::section_contents_): New data member.
3098 (Arm_input_section::Arm_input_section): Initialize original_contents_.
3099 (Arm_input_section::~Arm_input_section): De-allocate memory.
3100 (Arm_input_section::original_contents_): New data member.
3101 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
3102 in parameters instead of calling Object::section_contents without
3104 (Arm_output_section::group_section): New parameter TASK. Pass it
3105 to callees that need locking objects.
3106 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
3107 to lock EXIDX input sections. Fix a formatting issue. Call
3108 Arm_exidx_merged_section::build_contents to create merged section
3110 (Arm_output_section::create_stub_group): New parameter TASK. Use it
3111 to lock object of stub table owner.
3112 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
3113 TEXT_SIZE to initialize data member TEXT_SIZE_.
3114 (Arm_exidx_input_section::addralign): Fix typo in comment.
3115 (Arm_exidx_input_section::text_size): New method.
3116 (Target_arm::do_relax): New parameter TASK. Pass it to callees
3117 that require locking objects. Lock objects before scanning for stubs
3118 and updating local symbols.
3119 (Arm_input_section<big_endian>::init): Copy contents of original
3121 (Arm_input_section<big_endian>::do_write): Use saved contents of
3122 original input section instead of calling Object::section_contents
3124 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
3125 size without calling Object::section_size().
3126 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
3127 for size. Allocate a buffer for merged EXIDX entries.
3128 (Arm_exidx_merged_section::build_contents): New method.
3129 (Arm_exidx_merged_section::do_write): Move merge section contents
3130 building code to Arm_exidx_merged_section::build_contetns. Write
3131 out contetns in buffer instead of building it on the fly.
3132 (Arm_relobj::make_exidx_input_section): Also pass text section size
3133 to Arm_exidx_input_section constructor.
3134 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
3135 (Arm_dynobj::do_read_symbols): Fix memory leak.
3136 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
3137 * target.h: (class Task): Add forward declaration.
3138 (Target::relax): Add new parameter TASK and pass it to
3140 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
3142 2010-11-05 Cary Coutant <ccoutant@google.com>
3145 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
3146 object when reading from the file.
3147 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
3149 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
3150 when reading section contents.
3151 (get_section_contents): Likewise.
3152 (icf::find_identical_sections): Likewise.
3153 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
3154 object when reading from the file.
3155 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
3156 the object when doing deferred section layout.
3158 2010-11-03 Nick Clifton <nickc@redhat.com>
3161 * script.h (class Symbol_assignment: name): New member. Returns
3162 the name of the symbol.
3163 * scrfipt.cc (Script_options::is_pending_assignment): New member.
3164 Returns true if the given symbol name is on the list of
3165 assignments wating to be processed.
3166 * archive.cc (should_incldue_member): If the symbol is undefined,
3167 check to see if it is on the list of symbols pending assignment.
3169 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
3171 * script-sections.cc (Script_sections::find_memory_region): Check
3172 for a NULL output section pointer.
3174 2010-10-29 Doug Kwan <dougkwan@google.com>
3176 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3177 Output_section::add_relaxed_input_section.
3178 * output.cc (Output_section::add_relaxed_input_section): Add new
3179 arguments LAYOUT and NAME. Set section order index.
3180 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3181 Copy section order index.
3182 * output.h (Output_section::add_relaxed_input_section): Add new
3183 arguments LAYOUT and NAME.
3185 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3187 * testsuite/Makefile.am: Move gcctestdir/ld rule to
3188 NATIVE_OR_CROSS_LINKER.
3189 * testsuite/Makefile.in: Regenerate.
3191 2010-10-20 Doug Kwan <dougkwan@google.com>
3193 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
3194 without SHF_LINK_ORDER flags.
3195 * layout.cc (Layout::choose_output_section): Do not filter
3196 SHF_LINK_ORDER flag in a relocatable link.
3198 2010-10-17 Cary Coutant <ccoutant@google.com>
3200 * output.h (Output_segment::set_section_addresses): Change function
3201 signature. Update all callers.
3202 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
3204 (Output_segment::set_section_addresses): Align after last TLS
3205 section. Add padding before last relro section instead of after.
3207 2010-10-17 Doug Kwan <dougkwan@google.com>
3209 * gold/arm.cc (Target_arm::got_section): Use correct order and set
3210 GOT output section to be writable.
3212 2010-10-14 Cary Coutant <ccoutant@google.com>
3214 * debug.h (DEBUG_INCREMENTAL): New flag.
3215 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3216 * gold.cc (queue_initial_tasks): Check parameters for incremental link
3218 * incremental.cc (report_command_line): Ignore all forms of
3220 * layout.cc (Layout::Layout): Check parameters for incremental link
3222 * options.cc (General_options::parse_incremental): New function.
3223 (General_options::parse_no_incremental): New function.
3224 (General_options::parse_incremental_full): New function.
3225 (General_options::parse_incremental_update): New function.
3226 (General_options::incremental_mode_): New data member.
3227 (General_options::finalize): Check incremental_mode_.
3228 * options.h (General_options): Update help text for --incremental.
3229 Add --no-incremental, --incremental-full, --incremental-update.
3230 (General_options::Incremental_mode): New enum type.
3231 (General_options::incremental_mode): New function.
3232 (General_options::incremental_mode_): New data member.
3233 * parameters.cc (Parameters::incremental_mode_): New data member.
3234 (Parameters::set_options): Set incremental_mode_.
3235 (Parameters::set_incremental_full): New function.
3236 (Parameters::incremental): New function.
3237 (Parameters::incremental_update): New function.
3238 (set_parameters_incremental_full): New function.
3239 * parameters.h (Parameters::set_incremental_full): New function.
3240 (Parameters::incremental): New function.
3241 (Parameters::incremental_update): New function.
3242 (Parameters::incremental_mode_): New data member.
3243 (set_parameters_incremental_full): New function.
3244 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
3245 incremental link mode.
3246 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
3247 (Sized_relobj::do_relocate_sections): Likewise.
3248 * testsuite/Makefile.am (incremental_test): Use --incremental-full
3250 * testsuite/Makefile.in: Regenerate.
3251 * testsuite/incremental_test.sh: Filter all forms of --incremental.
3253 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3255 * script-sections.h (class Script_sections): Make
3256 Sections_elements typedef public.
3257 * script-sections.cc (class Sort_output_sections): Add elements_
3258 field. Add constructor which sets it; change all callers.
3259 (Sort_output_sections::is_before): New function.
3260 (Sort_output_sections::operator()): Call is_before.
3261 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
3263 * testsuite/script_test_10.sh: New test. Test script section
3265 * testsuite/script_test_10.t: Likewise.
3266 * testsuite/script_test_10.s: Likewise.
3267 * testsuite/Makefile.am: Wrap the cross linker tests and the
3268 common tests into NATIVE_OR_CROSS_LINKER.
3269 (check_SCRIPTS): Add script_test_10.sh.
3270 (check_DATA): Add script_test_10.stdout.
3271 (script_test_10.o, script_test_10): New targets.
3272 (script_test_10.stdout): New target.
3273 * configure, testsuite/Makefile.in: Regenerate.
3275 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3277 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
3278 error for the deprecated relocations.
3279 (Target_arm::Scan::global): Likewise.
3280 (Target_arm::Relocate::relocate): Likewise.
3282 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
3284 * fileread.cc (Input_file::find_file): Initialize *found_name
3285 and *namep when using the fallback search for case 4.
3287 2010-10-11 Cary Coutant <ccoutant@google.com>
3289 * options.h (class General_options): Redefine -z lazy as an alias for
3290 the negation of -z now.
3292 2010-10-11 Ian Lance Taylor <iant@google.com>
3294 * resolve.cc (symbol_to_bits): Report the value of the unsupported
3297 2010-10-06 Nick Clifton <nickc@redhat.com>
3299 * script-sections.cc(class Memory_region): Remove
3300 current_lma_offset_ field. Rename current_vma_offset_ to
3301 current_offset_. Add last_section_ field.
3302 (Memory_region::get_current_vma_address): Rename to
3303 get_current_address.
3304 (Memory_region::get_current_lma_address): Delete.
3305 (Memory_region::increment_vma_offset): Rename to
3307 (Memory_region::increment_lma_offset): Delete.
3308 (Memory_region::attributes_compatible): New method. Returns
3309 true if the provided section is compatible with the region.
3310 (Memory_region::get_last_section): New method. Returns the last
3311 section to use the region.
3312 (Memory_region::set_last_section): New method. Stores the last
3313 section to use the region.
3314 (Script_sections::block_in_region): New method. Returns true if
3315 a block of memory is contained within a region.
3316 (Script_sections::find_memory_region): New method. Locates a
3317 memory region to be used to set a VMA or LMA address.
3318 (Output_section_definition::set_section_addresses): Add code to
3319 check for addresses set by memory regions.
3320 (Output_segment::set_section_addresses): Remove memory region
3322 (Script_sections::create_segment): Add a warning if a header
3323 segment is created outside of any region.
3324 * script-sections.h (class Script_sections): Add prototypes for
3325 find_memory_region and block_in_region methods.
3326 * testsuite/memory_test.s: Use .long instead of .word.
3327 * testsuite/memory_test.t: Add some more output sections.
3328 * testsuite/memory_test.sh: Update expected output.
3330 2010-10-02 Doug Kwan <dougkwan@google.com>
3332 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
3333 defintion to symtab.h
3334 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
3335 declaration to defintion.
3337 2010-10-01 Nick Clifton <nickc@redhat.com>
3339 * expression.cc (eval): Replace dummy argument with NULL.
3340 (eval_maybe_dot): Check for a NULL result section pointer.
3341 (Symbol_expression::value): Likewise.
3342 (Dot_expression::value): Likewise.
3343 (BINARY_EXPRESSION): Likewise.
3344 (Max_expression::value): Likewise.
3345 (Min_expression::value): Likewise.
3346 (Absolute_expression::value): Likewise.
3347 (Addr_expression::value_from_output_section): Likewise.
3348 (Loaddddr_expression::value_from_output_section): Likewise.
3349 (Segment_start_expression::value): Likewise.
3350 * script-sections.cc
3351 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
3353 (Sections_elememt_dot_assignment::set_section_addresses):
3355 (Output_data_expression::do_write_to_buffer): Likewise.
3356 (Output_section_definition::finalize_symbols): Likewise.
3357 (Output_section_definition::set_section_addresses): Likewise.
3359 2010-09-30 Doug Kwan <dougkwan@google.com>
3361 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
3363 2010-09-28 Sriraman Tallam <tmsriram@google.com>
3365 * target.h (Target::can_icf_inline_merge_sections): New virtual
3367 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
3369 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
3371 * icf.cc (get_section_contents): Inline merge sections only when
3374 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3376 * configure: Regenerate.
3378 2010-09-17 Ian Lance Taylor <iant@google.com>
3380 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
3381 * testsuite/Makefile.am (memory_test.o): New target.
3382 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
3384 * testsuite/Makefile.in: Rebuild.
3386 2010-09-17 Doug Kwan <dougkwan@google.com>
3388 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
3389 defintion if relocation uses GOT entries of the symbol.
3390 * testsuite/icf_safe_test.sh: Fix test.
3391 * testsuite/icf_safe_so_test.sh: Fix test.
3393 2010-09-16 Cary Coutant <ccoutant@google.com>
3395 * script_sections.cc (class Memory_region): Remove "NULL" from
3396 vector initializations.
3398 2010-09-15 Cary Coutant <ccoutant@google.com>
3400 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
3401 Resolve forwarding symbols.
3403 2010-09-15 Doug Kwan <dougkwan@google.com>
3405 * gold/testsuite/script_test_3.t: Add ARM special sections.
3406 * gold/testsuite/script_test_4.t: Same.
3407 * gold/testsuite/script_test_5.t: Same.
3408 * gold/testsuite/script_test_6.t: Same.
3409 * gold/testsuite/script_test_7.t: Same.
3410 * gold/testsuite/script_test_7.t: Same.
3411 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
3413 2010-09-14 Cary Coutant <ccoutant@google.com>
3415 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
3416 (Target_x86_64::Relocate::relocate_tls): Replace check for
3417 saw_tls_block_reloc_ with test for executable section.
3419 2010-09-12 Cary Coutant <ccoutant@google.com>
3421 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
3422 position-independent executables to shared libraries need dynamic
3424 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
3425 position-independent executables.
3426 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
3427 * testsuite/Makefile.in: Regenerate.
3429 2010-09-10 Nick Clifton <nickc@redhat.com>
3432 * testsuite/memory_test.t: Discard any sections that are not
3435 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
3438 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
3439 "This::" to work around a bug in gcc 4.2.
3441 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
3443 2010-09-09 Rafael Espindola <espindola@google.com>
3445 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
3446 sections with different PF_X flags in the same segment.
3447 (Layout::find_first_load_seg): Search all segments to find the first
3449 * options.h (rosegment): New.
3451 2010-09-08 Rafael Espindola <espindola@google.com>
3453 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
3455 2010-09-08 Doug Kwan <dougkwan@google.com>
3457 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
3458 (Arm_relobj::do_relocate_sections): Add new parameter for output
3459 file to match the parent.
3460 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
3461 of local symbols instead of input values. Update code to track
3462 changes in gold::relocate_section.
3463 * object.cc (Sized_relobj::compute_final_local_value): New methods.
3464 (Sized_relobj::compute_final_local_value_internal): New methods.
3465 (Sized_relobj::do_finalize_local_symbols): Move code from loop
3466 body into private version of Sized_relobj::compute_final_local_value.
3467 Call the inline method.
3468 * object.h (Symbol_value::Symbol_value): Define destructor. Free
3469 merged symbol value if there is one.
3470 (Symbol_value::has_output_value): New method defintiion.
3471 (Sized_relobj::Compute_final_local_value_status): New enum type.
3472 (Sized_relobj::compute_final_local_value): New methods.
3473 (Sized_relobj::compute_final_local_value_internal): New methods.
3474 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
3475 and arm_cortex_a8.sh.
3476 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
3477 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
3479 * Makefile.in: Regenerate.
3480 * testsuite/arm_bl_out_of_range.s: Update test.
3481 * testsuite/thumb_bl_out_of_range.s: Ditto.
3482 * testsuite/thumb_blx_out_of_range.s: Ditto.
3483 * testsuite/arm_branch_out_of_range.sh: New file.
3484 * testsuite/arm_cortex_a8.sh: Ditto.
3485 * testsuite/arm_cortex_a8_b.s: Ditto.
3486 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
3487 * testsuite/arm_cortex_a8_b_local.s: Ditto.
3488 * testsuite/arm_cortex_a8_bl.s: Ditto.
3489 * testsuite/arm_cortex_a8_blx.s: Ditto.
3490 * testsuite/arm_cortex_a8_local.s: Ditto.
3491 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
3492 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
3494 2010-09-08 Rafael Espindola <espindola@google.com>
3496 * Makefile.am (memory_test.stdout): Run readelf with -W.
3497 * Makefile.in: Regenerate.
3498 * testsuite/memory_test.sh: Make the regexps accept both 32 and
3501 2010-09-08 Rafael Espindola <espindola@google.com>
3503 * script-sections.cc (Script_sections::add_memory_region): Convert
3504 field precision to int.
3505 * script.cc (script_set_section_region, script_set_section_region):
3506 Convert field precision to int.
3508 2010-09-08 Rafael Espindola <espindola@google.com>
3510 * arm.cc (do_finalize_sections): Create the __exidx_start and
3511 __exdix_end symbols even when the section is missing.
3513 2010-09-08 Nick Clifton <nickc@redhat.com>
3515 * README: Remove claim that MEMORY is not supported.
3516 * expression.cc (script_exp_function_origin)
3517 (script_exp_function_length): Move from here to ...
3518 * script.cc: ... here.
3519 (script_set_section_region, script_add_memory)
3520 (script_parse_memory_attr, script_include_directive): New
3522 * script-sections.cc
3523 (class Memory_region): New class.
3524 (class Output_section_definition): Add set_memory_region,
3525 set_section_vma, set_section_lma and get_section_name methods.
3526 (class Script_Sections): Add add_memory_region,
3527 find_memory_region, find_memory_region_origin,
3528 find_memory_region_length and set_memory_region methods.
3529 Have set_section_addresses method walk the list of set memory
3531 Extend the print methos to display memory regions.
3532 * script-sections.h: Add prototypes for new methods.
3533 Add enum for MEMORY region attributes.
3534 * yyscript.y: Add support for parsing MEMORY regions.
3535 * script-c.h: Add prototypes for new functions.
3536 * testsuite/Makefile.am: Add test of MEMORY region functionality.
3537 * testsuite/Makefile.in: Regenerate.
3538 * testsuite/memory_test.sh: New script.
3539 * testsuite/memory_test.s: New assembler source file.
3540 * testsuite/memory_test.t: New linker script.
3542 2010-08-27 Doug Kwan <dougkwan@google.com>
3544 * gold/resolve.cc (Symbol_table::should_override): Let a weak
3545 reference override an existing dynamic weak reference.
3546 * testsuite/Makefile.am: Add new test dyn_weak_ref.
3547 * testsuite/Makefile.in: Regenerate.
3548 * testsuite/dyn_weak_ref.sh: New file.
3549 * testsuite/dyn_weak_ref_1.c: Ditto.
3550 * testsuite/dyn_weak_ref_2.c: Ditto.
3552 2010-08-27 Ian Lance Taylor <iant@google.com>
3554 * incremental.h (class Incremental_input_entry): Add virtual
3557 2010-08-27 Ian Lance Taylor <iant@google.com>
3559 * testsuite/start_lib_test_3.c: Mark t3 as used.
3561 2010-08-27 Nick Clifton <nickc@redhat.com>
3563 * options.cc (version_script): Fix small typo in previous
3566 2010-08-25 Nick Clifton <nickc@redhat.com>
3568 * archive.cc: Formatting fixes: Remove whitespace between
3569 typename and following asterisk. Remove whitespace between
3570 function name and opening parenthesis.
3571 * archive.h: Likewise.
3573 * attributes.cc: Likewise.
3574 * attributes.h: Likewise.
3575 * common.cc: Likewise.
3576 * copy-relocs.cc: Likewise.
3577 * dirsearch.h: Likewise.
3578 * dynobj.cc: Likewise.
3579 * ehframe.cc: Likewise.
3580 * ehframe.h: Likewise.
3581 * expression.cc: Likewise.
3582 * fileread.cc: Likewise.
3583 * fileread.h: Likewise.
3585 * gold-threads.cc: Likewise.
3586 * gold.cc: Likewise.
3587 * i386.cc: Likewise.
3589 * incremental-dump.cc: Likewise.
3590 * incremental.cc: Likewise.
3591 * layout.cc: Likewise.
3592 * layout.h: Likewise.
3593 * main.cc: Likewise.
3594 * merge.cc: Likewise.
3595 * merge.h: Likewise.
3596 * object.cc: Likewise.
3597 * object.h: Likewise.
3598 * options.cc: Likewise.
3599 * options.h: Likewise.
3600 * output.cc: Likewise.
3601 * output.h: Likewise.
3602 * plugin.cc: Likewise.
3603 * plugin.h: Likewise.
3604 * powerpc.cc: Likewise.
3605 * reloc.cc: Likewise.
3606 * script-c.h: Likewise.
3607 * script-sections.cc: Likewise.
3608 * script.cc: Likewise.
3609 * stringpool.cc: Likewise.
3610 * symtab.cc: Likewise.
3611 * symtab.h: Likewise.
3612 * target.cc: Likewise.
3613 * timer.cc: Likewise.
3614 * timer.h: Likewise.
3615 * version.cc: Likewise.
3616 * x86_64.cc: Likewise.
3618 2010-08-24 Nick Clifton <nickc@redhat.com>
3621 * layout.cc (segment_precedes): Sort segments by their physical
3622 addresses, if they have been set.
3624 2010-08-23 Cary Coutant <ccoutant@google.com>
3626 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
3628 (Lib_group::include_member): Unlock object after deleting its
3630 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
3633 2010-08-19 Neil Vachharajani <nvachhar@google.com>
3634 Cary Coutant <ccoutant@google.com>
3636 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
3637 constructor, and set_blocker.
3638 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
3640 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
3641 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
3642 * testsuite/Makefile.am (start_lib_test): New test case.
3643 * testsuite/Makefile.in: Regenerate.
3644 * testsuite/start_lib_test_main.c: New file.
3645 * testsuite/start_lib_test_1.c: New file.
3646 * testsuite/start_lib_test_2.c: New file.
3647 * testsuite/start_lib_test_3.c: New file.
3649 2010-08-19 Ian Lance Taylor <iant@google.com>
3651 * Makefile.in: Rebuild with automake 1.11.1.
3652 * aclocal.m4: Likewise.
3653 * testsuite/Makefile.in: Likewise.
3655 2010-08-19 Ian Lance Taylor <iant@google.com>
3658 * i386.cc (class Output_data_plt_i386): Update declarations.
3659 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
3660 local_ifuncs_ fields.
3661 (Target_i386::do_plt_section_for_global): New function.
3662 (Target_i386::do_plt_section_for_local): New function.
3663 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
3664 parameter; change all callers. Initialize global_ifuncs_ and
3665 local_ifuncs_. If doing a static link define __rel_iplt_start and
3667 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
3668 (Output_data_plt_i386::add_local_ifunc_entry): New function.
3669 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
3671 (Target_i386::make_plt_section): New function, broken out of
3672 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
3673 (Target_i386::make_plt_entry): Call make_plt_section.
3674 (Target_i386::make_local_ifunc_plt_entry): New function.
3675 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
3676 (Target_i386::Scan::local): Handle IFUNC symbols. Add
3677 R_386_IRELATIVE to switch.
3678 (Target_i386::Scan::global): Likewise.
3679 (Target_i386::Relocate::relocate): Likewise.
3680 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
3682 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
3683 (Target_x86_64::do_plt_section_for_global): New function.
3684 (Target_x86_64::do_plt_section_for_local): New function.
3685 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
3686 parameter; change all callers. If doing a static link define
3687 __rela_iplt_start and __rela_iplt_end.
3688 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
3689 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
3690 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
3692 (Target_x86_64::make_local_ifunc_plt_entry): New function.
3693 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
3695 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
3696 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
3697 R_X86_64_IRELATIVE to switch.
3698 (Target_x86_64::Scan::global): Likewise.
3699 (Target_x86_64::Relocate::relocate): Likewise.
3700 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
3702 * target.h (class Target): Add plt_section_for_global and
3703 plt_section_for_local functions. Add do_plt_section_for_global
3704 and do_plt_section_for_local virtual functions.
3705 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
3706 clarifying comments.
3707 (Symbol::use_plt_offset): Handle IFUNC symbol.
3708 * object.cc (Sized_relobj::Sized_relobj): Initialize
3710 (Sized_relobj::local_has_plt_offset): New function.
3711 (Sized_relobj::local_plt_offset): New function.
3712 (Sized_relobj::set_local_plt_offset): New function.
3713 (Sized_relobj::do_count): Handle IFUNC symbol.
3714 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
3715 a bit away from input_shndx_ field. Add set_is_func_symbol and
3716 is_ifunc_symbol functions.
3717 (class Sized_relobj): Update declarations. Remove Tls_got_entry
3718 and Local_tls_got_offsets. Define Local_plt_offsets. Add
3719 local_plt_offsets_ field.
3720 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
3721 * output.h (class Output_section_data): Add non-const
3722 output_section function.
3723 (class Output_data_got): Update declarations.
3724 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
3725 Add use_plt_offset parameter to global and local constructors.
3726 Change all callers. Change local_sym_index_ field to 31 bits.
3727 Change GSYM_CODE and CONSTANT_CODE accordingly.
3728 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
3729 doing a static link don't set sh_link field.
3730 (Output_data_got::Got_entry::write): Use PLT offset if
3732 (Output_data_got::add_global_plt): New function.
3733 (Output_data_got::add_local_plt): New function.
3734 * target-reloc.h (relocate_section): Handle IFUNC symbol.
3735 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
3736 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
3737 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
3738 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
3740 * testsuite/ifunc-sel.h: New file.
3741 * testsuite/ifuncmain1.c: New file.
3742 * testsuite/ifuncmain1vis.c: New file.
3743 * testsuite/ifuncmod1.c: New file.
3744 * testsuite/ifuncdep2.c: New file.
3745 * testsuite/ifuncmain2.c: New file.
3746 * testsuite/ifuncmain3.c: New file.
3747 * testsuite/ifuncmod3.c: New file.
3748 * testsuite/ifuncmain4.c: New file.
3749 * testsuite/ifuncmain5.c: New file.
3750 * testsuite/ifuncmod5.c: New file.
3751 * testsuite/ifuncmain6pie.c: New file.
3752 * testsuite/ifuncmod6.c: New file.
3753 * testsuite/ifuncmain7.c: New file.
3754 * configure, testsuite/Makefile.in: Rebuild.
3756 2010-08-18 Ian Lance Taylor <iant@google.com>
3759 (Output_section_incremental_inputs::write_input_files): Add cast
3760 to avoid signed/unsigned comparison warning.
3761 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3763 2010-08-12 Cary Coutant <ccoutant@google.com>
3765 * common.cc (Sort_commons::operator()): Remove unnecessary code.
3767 2010-08-13 Ian Lance Taylor <iant@google.com>
3769 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
3771 2010-08-12 Cary Coutant <ccoutant@google.com>
3772 Doug Kwan <dougkwan@google.com>
3774 * resolve.cc (Symbol_table::should_override): When a weak dynamic
3775 defintion overrides non-weak undef, remember that the original undef
3777 * symtab.cc (Symbol_table::sized_write_global): For undef without
3778 an original weak binding, set binding to global in output.
3779 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
3780 * testsuite/Makefile.in: Regenerate.
3781 * testsuite/strong_ref_weak_def.sh: New file.
3782 * testsuite/strong_ref_weak_def_1.c: Ditto.
3783 * testsuite/strong_ref_weak_def_2.c: Ditto.
3785 2010-08-12 Cary Coutant <ccoutant@google.com>
3787 * testsuite/incremental_test.sh: Rewrite.
3788 * testsuite/incremental_test_1.c: Rewrite.
3789 * testsuite/incremental_test_2.c: Rewrite.
3791 2010-08-12 Cary Coutant <ccoutant@google.com>
3793 * arm.cc (Target_arm::got_size): Add const.
3794 (Target_arm::got_entry_count): New function.
3795 (Target_arm::plt_entry_count): New function.
3796 (Target_arm::first_plt_entry_offset): New function.
3797 (Target_arm::plt_entry_size): New function.
3798 (Output_data_plt_arm::entry_count): New function.
3799 (Output_data_plt_arm::first_plt_entry_offset): New function.
3800 (Output_data_plt_arm::get_plt_entry_size): New function.
3801 * i386.cc (Target_i386::got_size): Add const.
3802 (Target_i386::got_entry_count): New function.
3803 (Target_i386::plt_entry_count): New function.
3804 (Target_i386::first_plt_entry_offset): New function.
3805 (Target_i386::plt_entry_size): New function.
3806 (Output_data_plt_i386::entry_count): New function.
3807 (Output_data_plt_i386::first_plt_entry_offset): New function.
3808 (Output_data_plt_i386::get_plt_entry_size): New function.
3809 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
3810 find_incremental_inputs_sections. Dump incremental_got_plt section.
3811 * incremental.cc: Include target.h.
3812 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
3813 parameter. Adjust all callers. Find incremental_got_plt section.
3814 (Incremental_inputs::create_data_sections): Create incremental_got_plt
3816 (Output_section_incremental_inputs::set_final_data_size): Calculate
3817 size of incremental_got_plt section.
3818 (Output_section_incremental_inputs::do_write): Write the
3819 incremental_got_plt section.
3820 (Got_plt_view_info): New struct.
3821 (Local_got_offset_visitor): New class.
3822 (Global_got_offset_visitor): New class.
3823 (Global_symbol_visitor_got_plt): New class.
3824 (Output_section_incremental_inputs::write_got_plt): New function.
3825 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
3826 Add parameter. Adjust all callers.
3827 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3828 (Incremental_inputs::got_plt_section): New function.
3829 (Incremental_inputs::got_plt_section_): New data member.
3830 (Incremental_got_plt_reader): New class.
3831 * layout.cc (Layout::create_incremental_info_sections): Add the
3832 incremental_got_plt section.
3833 * object.h (Got_offset_list::get_list): New function.
3834 (Got offset_list::for_all_got_offsets): New function.
3835 (Sized_relobj::local_got_offset_list): New function.
3836 * powerpc.cc (Target_powerpc::got_size): Add const.
3837 (Target_powerpc::got_entry_count): New function.
3838 (Target_powerpc::plt_entry_count): New function.
3839 (Target_powerpc::first_plt_entry_offset): New function.
3840 (Target_powerpc::plt_entry_size): New function.
3841 (Output_data_plt_powerpc::entry_count): New function.
3842 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
3843 (Output_data_plt_powerpc::get_plt_entry_size): New function.
3844 * sparc.cc (Target_sparc::got_size): Add const.
3845 (Target_sparc::got_entry_count): New function.
3846 (Target_sparc::plt_entry_count): New function.
3847 (Target_sparc::first_plt_entry_offset): New function.
3848 (Target_sparc::plt_entry_size): New function.
3849 (Output_data_plt_sparc::entry_count): New function.
3850 (Output_data_plt_sparc::first_plt_entry_offset): New function.
3851 (Output_data_plt_sparc::get_plt_entry_size): New function.
3852 * symtab.h (Symbol::got_offset_list): New function.
3853 (Symbol_table::for_all_symbols): New function.
3854 * target.h (Sized_target::got_entry_count): New function.
3855 (Sized_target::plt_entry_count): New function.
3856 (Sized_target::plt_entry_size): New function.
3857 * x86_64.cc (Target_x86_64::got_size): Add const.
3858 (Target_x86_64::got_entry_count): New function.
3859 (Target_x86_64::plt_entry_count): New function.
3860 (Target_x86_64::first_plt_entry_offset): New function.
3861 (Target_x86_64::plt_entry_size): New function.
3862 (Output_data_plt_x86_64::entry_count): New function.
3863 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
3864 (Output_data_plt_x86_64::get_plt_entry_size): New function.
3866 2010-08-12 Cary Coutant <ccoutant@google.com>
3868 * archive.cc: Include incremental.h.
3869 (Archive::Archive): Initialize incremental_info_.
3870 (Archive::include_member): Record archive members in incremental info.
3871 (Add_archive_symbols::run): Record begin and end of an archive in
3873 (Lib_group::include_member): Record objects in incremental info.
3874 * archive.h (Incremental_archive_entry): Forward declaration.
3875 (Archive::set_incremental_info): New member function.
3876 (Archive::incremental_info): New member function.
3877 (Archive::Unused_symbol_iterator): New class.
3878 (Archive::unused_symbols_begin): New member function.
3879 (Archive::unused_symbols_end): New member function.
3880 (Archive::incremental_info_): New data member.
3881 * incremental-dump.cc (find_input_containing_global): New function.
3882 (dump_incremental_inputs): Dump new incremental info sections.
3883 * incremental.cc: Include symtab.h.
3884 (Output_section_incremental_inputs): New class.
3885 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
3886 new incremental info sections.
3887 (Sized_incremental_binary::do_check_inputs): Likewise.
3888 (Incremental_inputs::report_archive): Remove.
3889 (Incremental_inputs::report_archive_begin): New function.
3890 (Incremental_inputs::report_archive_end): New function.
3891 (Incremental_inputs::report_object): New function.
3892 (Incremental_inputs::finalize_inputs): Remove.
3893 (Incremental_inputs::report_input_section): New function.
3894 (Incremental_inputs::report_script): Rewrite.
3895 (Incremental_inputs::finalize): Do nothing but finalize string table.
3896 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3897 (Incremental_inputs::sized_create_inputs_section_data): Remove.
3898 (Incremental_inputs::create_data_sections): New function.
3899 (Incremental_inputs::relocs_entsize): New function.
3900 (Output_section_incremental_inputs::set_final_data_size): New function.
3901 (Output_section_incremental_inputs::do_write): New function.
3902 (Output_section_incremental_inputs::write_header): New function.
3903 (Output_section_incremental_inputs::write_input_files): New function.
3904 (Output_section_incremental_inputs::write_info_blocks): New function.
3905 (Output_section_incremental_inputs::write_symtab): New function.
3906 * incremental.h (Incremental_script_entry): Forward declaration.
3907 (Incremental_object_entry): Forward declaration.
3908 (Incremental_archive_entry): Forward declaration.
3909 (Incremental_inputs): Forward declaration.
3910 (Incremental_inputs_header_data): Remove.
3911 (Incremental_inputs_header): Remove.
3912 (Incremental_inputs_header_write): Remove.
3913 (Incremental_inputs_entry_data): Remove.
3914 (Incremental_inputs_entry): Remove.
3915 (Incremental_inputs_entry_write): Remove.
3916 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
3917 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
3918 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3919 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
3921 (Incremental_input_entry): New class.
3922 (Incremental_script_entry): New class.
3923 (Incremental_object_entry): New class.
3924 (Incremental_archive_entry): New class.
3925 (Incremental_inputs::Incremental_inputs): Initialize new data members.
3926 (Incremental_inputs::report_inputs): Remove.
3927 (Incremental_inputs::report_archive): Remove.
3928 (Incremental_inputs::report_archive_begin): New function.
3929 (Incremental_inputs::report_archive_end): New function.
3930 (Incremental_inputs::report_object): Change prototype.
3931 (Incremental_inputs::report_input_section): New function.
3932 (Incremental_inputs::report_script): Change prototype.
3933 (Incremental_inputs::get_reloc_count): New function.
3934 (Incremental_inputs::set_reloc_count): New function.
3935 (Incremental_inputs::create_data_sections): New function.
3936 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3937 (Incremental_inputs::inputs_section): New function.
3938 (Incremental_inputs::symtab_section): New function.
3939 (Incremental_inputs::relocs_section): New function.
3940 (Incremental_inputs::get_stringpool): Add const.
3941 (Incremental_inputs::command_line): Add const.
3942 (Incremental_inputs::inputs): Remove.
3943 (Incremental_inputs::command_line_key): New function.
3944 (Incremental_inputs::input_file_count): New function.
3945 (Incremental_inputs::input_files): New function.
3946 (Incremental_inputs::relocs_entsize): New function.
3947 (Incremental_inputs::sized_create_inputs_section_data): Remove.
3948 (Incremental_inputs::finalize_inputs): Remove.
3949 (Incremental_inputs::Input_info): Remove.
3950 (Incremental_inputs::lock_): Remove.
3951 (Incremental_inputs::inputs_): Change type.
3952 (Incremental_inputs::inputs_map_): Remove.
3953 (Incremental_inputs::current_object_entry_): New data member.
3954 (Incremental_inputs::inputs_section_): New data member.
3955 (Incremental_inputs::symtab_section_): New data member.
3956 (Incremental_inputs::relocs_section_): New data member.
3957 (Incremental_inputs::reloc_count_): New data member.
3958 (Incremental_inputs_reader): New class.
3959 (Incremental_symtab_reader): New class.
3960 (Incremental_relocs_reader): New class.
3961 * layout.cc (Layout::finalize): Move finalization of incremental info
3962 and creation of incremental info sections to follow finalization of
3963 symbol table. Set offsets for postprocessing sections.
3964 (Layout::create_incremental_info_sections): Call
3965 Incremental_inputs::create_data_sections. Add incremental symtab
3966 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
3967 sections to layout after input sections.
3968 * layout.h (struct Timespec): Forward declaration.
3969 (Layout::incremental_inputs): Add const.
3970 (Layout::create_incremental_info_sections): Add parameter.
3971 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
3972 * object.cc: Include incremental.h.
3973 (Relobj::finalize_incremental_relocs): New function.
3974 (Sized_relobj::do_layout): Record input sections in incremental info.
3975 * object.h (Object::output_section): New function.
3976 (Object::output_section_offset): Moved from Relobj.
3977 (Object::get_incremental_reloc_base): New function.
3978 (Object::get_incremental_reloc_count): New function.
3979 (Object::do_output_section): New function.
3980 (Object::do_output_section_offset): Moved from Relobj.
3981 (Object::do_get_incremental_reloc_base): New function.
3982 (Object::do_get_incremental_reloc_count): New function.
3983 (Object::Object): Initialize new data members.
3984 (Relobj::output_section): Renamed do_output_section and moved to
3986 (Relobj::output_section_offset): Moved to Object.
3987 (Relobj::do_get_incremental_reloc_base): New function.
3988 (Relobj::do_get_incremental_reloc_count): New function.
3989 (Relobj::allocate_incremental_reloc_counts): New function.
3990 (Relobj::count_incremental_reloc): New function.
3991 (Relobj::finalize_incremental_relocs): New function.
3992 (Relobj::next_incremental_reloc_index): New function.
3993 (Relobj::reloc_counts_): New data member.
3994 (Relobj::reloc_bases_): New data member.
3995 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
3996 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
3997 (Sized_relobj::incremental_relocs_scan): New function.
3998 (Sized_relobj::incremental_relocs_scan_reltype): New function.
3999 (Sized_relobj::incremental_relocs_write): New function.
4000 (Sized_relobj::incremental_relocs_write_reltype): New function.
4001 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
4003 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
4004 archives and object files elsewhere.
4005 (Add_symbols::run): Report object files here.
4006 (Finish_group::run): Report end of archive at end of group.
4007 * reloc.cc: Include layout.h, incremental.h.
4008 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
4009 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
4010 (Sized_relobj::incremental_relocs_scan): New function.
4011 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4012 (Sized_relobj::do_relocate_sections): Write incremental relocations.
4013 (Sized_relobj::incremental_relocs_write): New function.
4014 (Sized_relobj::incremental_relocs_write_reltype): New function.
4015 * script.cc (read_input_script): Rewrite test for incremental link.
4016 Change call to Incremental_inputs::report_script.
4017 * symtab.h (Symbol_table::first_global_index): New function.
4018 (Symbol_table::output_count): New function.
4020 2010-08-12 Doug Kwan <dougkwan@google.com>
4022 * arm.cc (Target_arm::merge_object_attributes): Check command line
4023 options --no-wchar-size-warning and --no-enum-size-warning.
4024 * options.h (General_options): Add ld-compatible options
4025 --no-enum-size-warning and --no-wchar-size-warning.
4027 2010-08-04 Ian Lance Taylor <iant@google.com>
4029 * x86_64.cc (Target_x86_64::Scan::local): Use
4030 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
4031 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
4032 (Target_x86_64::Scan::global): Likewise.
4033 (Target_x86_64::Relocate::relocate): Likewise.
4034 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
4037 2010-08-03 Cary Coutant <ccoutant@google.com>
4039 * merge.cc (Output_merge_string::do_add_input_section): Count strings
4040 to reserve space in merged_strings vector. Keep total input size
4042 (Output_merge_string::do_print_merge_stats): Print total input size.
4043 * merge.h (Output_merge_string): Add input_size_ field.
4044 * stringpool.cc (Stringpool_template::string_length): Move
4045 implementations out of Stringpool_template class and place in
4047 * stringpool.h (string_length): Move out of Stringpool_template.
4049 2010-08-03 Ian Lance Taylor <iant@google.com>
4052 * layout.cc (relaxation_loop_body): If address of load segment is
4053 set, adjust address to include headers if possible.
4055 2010-08-03 Ian Lance Taylor <iant@google.com>
4057 * version.cc (version_string): Bump to 1.10.
4059 2010-08-03 Ian Lance Taylor <iant@google.com>
4062 * layout.h (enum Output_section_order): Define.
4063 (class Layout): Update declarations.
4064 * layout.cc (Layout::get_output_section): Add order parameter.
4065 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
4066 is_first_non_relro parameters. Change all callers.
4067 (Layout::choose_output_section): Likewise.
4068 (Layout::add_output_section_data): Likewise.
4069 (Layout::make_output_section): Likewise. Set order.
4070 (Layout::default_section_order): New function.
4071 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
4072 * output.cc (Output_section::Output_section): Initialize order_.
4073 Don't initialize deleted fields.
4074 (Output_segment::Output_segment): Don't initialize deleted
4076 (Output_segment::add_output_section_to_load): New function
4077 replacing add_output_section. Change all callers to call this or
4078 add_output_section_to_nonload.
4079 (Output_segment::add_output_section_to_nonload): New function.
4080 (Output_segment::remove_output_section): Rewrite.
4081 (Output_segment::add_initial_output_data): Likewise.
4082 (Output_segment::has_any_data_sections): Likewise.
4083 (Output_segment::is_first_section_relro): Likewise.
4084 (Output_segment::maximum_alignment): Likewise.
4085 (Output_segment::has_dynamic_reloc): New function replacing
4086 dynamic_reloc_count. Change all callers.
4087 (Output_segment::has_dynamic_reloc_list): New function replacing
4088 dynamic_reloc_count_list. Change all callers.
4089 (Output_segment::set_section_addresses): Rewrite.
4090 (Output_segment::set_offset): Rewrite.
4091 (Output_segment::find_first_and_last_list): Remove.
4092 (Output_segment::set_tls_offsets): Rewrite.
4093 (Output_segment::first_section_load_address): Likewise.
4094 (Output_segment::output_section_count): Likewise.
4095 (Output_segment::section_with_lowest_load_address): Likewise.
4096 (Output_segment::write_section_headers): Likewise.
4097 (Output_segment::print_sections_to_map): Likewise.
4098 * output.h (class Output_data): Remove dynamic_reloc_count_
4099 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
4100 (Output_data::add_dynamic_reloc): Rewrite.
4101 (Output_data::has_dynamic_reloc): New function.
4102 (Output_data::dynamic_reloc_count): Remove.
4103 (class Output_section): Add order_ field. Remvoe is_relro_local_,
4104 is_last_relro_, is_first_non_relro_, is_interp_,
4105 is_dynamic_linker_section_ fields. Add order and set_order
4106 functions. Remove is_relro_local, set_is_relro_local,
4107 is_last_relro, set_is_last_relro, is_first_non_relro,
4108 set_is_first_non_relro functions, is_interp, set_is_interp,
4109 is_dynamic_linker_section, and set_is_dynamic_linker_section
4111 (class Output_segment): Change Output_data_list from std::list to
4112 std:;vector. Add output_lists_ field. Remove output_data_ and
4113 output_bss_ fields. Update declarations.
4115 2010-08-02 Ian Lance Taylor <iant@google.com>
4117 * arm.cc (Target_arm::gc_process_relocs): Use typename.
4118 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
4119 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
4121 2010-08-02 Ian Lance Taylor <iant@google.com>
4124 * script.cc (Script_options::Script_options): Initialize
4125 symbol_definitions_ and symbol_references_.
4126 (Script_options::add_symbol_assignment): Update
4127 symbol_definitions_ and symbol_references_.
4128 (Script_options::add_symbol_reference): New function.
4129 (script_symbol): New function.
4130 * script.h (class Script_options): Add symbol_definitions_ and
4131 symbol_references_ fields.
4132 (Script_options::referenced_const_iterator): New type.
4133 (Script_options::referenced_begin): New function.
4134 (Script_options::referenced_end): New function.
4135 (Script_options::is_referenced): New function.
4136 (Script_options::any_unreferenced): New function.
4137 * script-c.h (script_symbol): Declare.
4138 * yyscript.y (exp): Call script_symbol.
4139 * symtab.cc: Include "script.h".
4140 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
4141 Change all callers. Check symbols referenced by scripts.
4142 (Symbol_table::add_undefined_symbols_from_command_line): Add
4143 layout parameter. Change all callers.
4144 (Symbol_table::do_add_undefined_symbols_from_command_line):
4145 Likewise. Break out loop body. Check symbols referenced by
4147 (Symbol_table::add_undefined_symbol_from_command_line): New
4148 function broken out of
4149 do_add_undefined_symbols_from_command_line.
4150 * symtab.h (class Symbol_table): Update declarations.
4151 * archive.cc: Include "layout.h".
4152 (Archive::should_include_member): Add layout parameter. Change
4153 all callers. Check for symbol mentioned in expression.
4154 * archive.h (class Archive): Update declaration.
4155 * object.cc (Sized_relobj::do_should_include_member): Add layout
4157 * object.h (Object::should_include_member): Add layout parameter.
4159 (Object::do_should_include_member): Add layout parameter.
4160 (class Sized_relobj): Update declaration.
4161 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
4163 * dynobj.h (class Sized_dynobj): Update declaration.
4164 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
4166 * plugin.h (class Sized_pluginobj): Update declaration.
4168 2010-08-02 Ian Lance Taylor <iant@google.com>
4171 * output.cc (Output_segment::set_offset): Search for the first and
4172 last sections rather than assuming that the list is in order.
4173 (Output_segment::find_first_and_last_list): New function.
4174 * output.h (class Output_segment): Update declarations.
4175 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4176 (relro_strip_test_SOURCES): New variable.
4177 (relro_strip_test_DEPENDENCIES): New variable.
4178 (relro_strip_test_LDFLAGS): New variable.
4179 (relro_strip_test_LDADD): New variable.
4180 (relro_strip_test.so): New target.
4182 2010-08-02 Ian Lance Taylor <iant@google.com>
4184 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4185 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4186 (Target_i386::got_tlsdesc_section): New function.
4187 (Target_i386::got_section): Create space for GOT entries for
4188 TLSDESC relocations.
4189 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4191 (Target_i386::Scan::global): Likewise.
4192 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
4194 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
4195 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
4196 (Target_x86_64::got_tlsdesc_section): New function.
4197 (Target_x86_64::got_section): Create space for GOT entries for
4198 TLSDESC relocations.
4199 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
4201 (Target_x86_64::Scan::global): Likewise.
4202 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
4205 2010-08-02 Ian Lance Taylor <iant@google.com>
4207 * testsuite/final_layout.sh: Use dc to convert from hex to
4210 2010-07-29 Sriraman Tallam <tmsriram@google.com>
4212 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4213 paramter to the call to gold::gc_process_relocs.
4214 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4215 paramter to the call to gold::gc_process_relocs.
4216 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4217 parameter to the call to gold::gc_process_relocs.
4218 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4219 template parameter to the call to gold::gc_process_relocs.
4220 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4221 paramter to the call to gold::gc_process_relocs.
4222 * gc.h (get_embedded_addend_size): New function.
4223 (gc_process_relocs): Save the size of the reloc for use by ICF.
4224 * icf.cc (get_section_contents): Get the addend from the text section
4225 for SHT_REL relocation sections.
4226 * icf.h (Icf::Reloc_addend_size_info): New typedef.
4227 (Icf::Reloc_info): Add new member reloc_addend_size_info.
4228 * int_encoding.h (read_from_pointer): New overloaded function.
4229 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
4230 * testsuite/icf_sht_rel_addend_test.sh: New file.
4231 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
4232 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
4234 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4236 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
4237 * Makefile.in: Regenerate.
4238 * testsuite/Makefile.in: Regenerate.
4240 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
4242 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
4243 * gold/testsuite/debug_msg.cc: Likewise.
4244 * gold/testsuite/odr_violation1.cc
4245 * gold/testsuite/odr_violation2.cc
4247 2010-07-21 Cary Coutant <ccoutant@google.com>
4249 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
4250 string, and length fields.
4251 (Output_merge_string::Merged_strings_list): New type.
4252 (Output_merge_string::Merged_strings_lists): New typedef.
4253 (Output_merge_string): Replace merged_strings_ with
4254 merged_strings_lists_.
4255 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
4256 Merged_strings_list per input object and section. Don't store pointer
4257 to the string. Don't store length with each merged string entry.
4258 (Output_merge_string::finalize_merged_data): Loop over list of merged
4259 strings lists. Recompute length of each merged string.
4261 2010-07-15 Cary Coutant <ccoutant@google.com>
4263 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
4266 2010-07-14 Ian Lance Taylor <iant@google.com>
4268 * descriptors.cc (Descriptors::open): Report correct name in error
4271 2010-07-13 Doug Kwan <dougkwan@google.com>
4273 * arm.cc (Arm_input_section::Arm_input_section): For a
4274 SHT_ARM_EXIDX section, always keeps the input sections.
4275 (Arm_input_section::set_exidx_section_link): New method.
4276 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
4277 has_errors_ to false.
4278 (Arm_exidx_input_section::has_errors,
4279 Arm_exidx_input_section::set_has_errors): New methods.
4280 (Arm_exidx_input_section::has_errors_): New data member.
4281 (Arm_relobj::get_exidx_shndx_list): New method.
4282 (Arm_output_section::append_text_sections_to_list): Do not skip
4283 section without SHF_EXECINSTR.
4284 (Arm_output_section::fix_exidx_coverage): Skip input sections with
4286 (Arm_relobj::make_exidx_input_section): Add new parameter for text
4287 section header. Make error messages more verbose. Check for
4288 a non-executable section linked to an EXIDX section.
4289 (Arm_relobj::do_read_symbols): Remove error checking, which has been
4290 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
4291 check that there is no deferred EXIDX section if we exit early.
4292 Instead of not making an EXIDX section in case of an error, make one
4293 and set the has_errors flag of it.
4294 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
4295 in a relocatable link.
4296 (Target_arm::do_relax): Look for the EXIDX output section instead of
4297 assuming that it is called .ARM.exidx.
4298 (Target_arm::fix_exidx_coverage): Add a new parameter for input
4299 section list. Do not check for SHF_EXECINSTR section flags but
4300 skip any input section with errors.
4301 * output.cc (Output_section::Output_section): Initialize
4302 always_keeps_input_sections_ to false.
4303 (Output_section::add_input_section): Check for
4304 always_keeps_input_sections_.
4305 * output.h (Output_section::always_keeps_input_sections,
4306 Output_section::set_always_keeps_input_sections): New methods.
4307 (Output_section::always_keeps_input_sections): New data member.
4309 2010-07-13 Rafael Espindola <espindola@google.com>
4311 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
4312 * fileread.h (Input_file): Add try_extra_search_path and find_file.
4314 2010-07-13 Philip Herron <herron.philip@googlemail.com>
4315 Ian Lance Taylor <iant@google.com>
4317 * output.h (Output_section_lookup_maps::add_merge_section):
4318 Correct check of whether value was inserted.
4319 (Output_section_lookup_maps::add_merge_input_section): Likewise.
4320 (Output_section_lookup_maps::add_relaxed_input_section):
4322 * arm.cc (Target_arm::got_section): Remove used local os.
4323 * i386.cc (Target_i386::got_section): Likewise.
4324 * x86_64.cc (Target_x86_64::got_section): Likewise.
4325 * sparc.cc (Target_sparc::got_section): Likewise.
4326 (Target_sparc::relocate): Remove unused local have_got_offset.
4327 * powerpc.cc (Target_powerpc::relocate): Likewise.
4329 2010-07-13 Ian Lance Taylor <iant@google.com>
4331 * compressed_output.cc (zlib_decompress): Fix signature in
4334 * archive.cc (Archive::include_member): Unlock an external member
4335 of a thin archive. Don't bother to delete an object we know is
4338 2010-07-12 Cary Coutant <ccoutant@google.com>
4340 * compressed_output.cc (zlib_decompress): New function.
4341 (get_uncompressed_size): New function.
4342 (decompress_input_section): New function.
4343 * compressed_output.h (get_uncompressed_size): New function.
4344 (decompress_input_section): New function.
4345 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
4346 Handle compressed debug sections.
4347 * layout.cc (is_compressed_debug_section): New function.
4348 (Layout::output_section_name): Map compressed section names to
4350 * layout.h (is_compressed_debug_section): New function.
4351 (is_debug_info_section): Recognize compressed debug sections.
4352 * merge.cc: Include compressed_output.h.
4353 (Output_merge_data::do_add_input_section): Handle compressed
4355 (Output_merge_string::do_add_input_section): Handle compressed
4357 * object.cc: Include compressed_output.h.
4358 (Sized_relobj::Sized_relobj): Initialize new data members.
4359 (build_compressed_section_map): New function.
4360 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
4361 * object.h (Object::section_is_compressed): New method.
4362 (Object::do_section_is_compressed): New method.
4363 (Sized_relobj::Compressed_section_map): New type.
4364 (Sized_relobj::do_section_is_compressed): New method.
4365 (Sized_relobj::compressed_sections_): New data member.
4366 * output.cc (Output_section::add_input_section): Handle compressed
4368 * reloc.cc: Include compressed_output.h.
4369 (Sized_relobj::write_sections): Handle compressed debug sections.
4371 2010-07-08 Cary Coutant <ccoutant@google.com>
4373 * resolve.cc (Symbol_table::resolve): Remember whether undef was
4374 weak when resolving to a dynamic def.
4375 (Symbol_table::should_override): Add adjust_dyndef flag; set it
4376 for weak undef/dynamic def cases. Adjust callers.
4377 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
4378 undef_binding_weak_.
4379 (Symbol_table::sized_write_globals): Adjust symbol binding.
4380 (Symbol_table::sized_write_symbol): Add binding parameter.
4381 * symtab.h (Symbol::set_undef_binding): New method.
4382 (Symbol::is_undef_binding_weak): New method.
4383 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
4384 (Symbol_table::should_override): Add new parameter.
4385 (Symbol_table::sized_write_symbol): Add new parameter.
4387 * testsuite/weak_undef_file1.cc: Add new test case.
4388 * testsuite/weak_undef_file2.cc: Fix header comment.
4389 * testsuite/weak_undef_test.cc: Add new test case.
4391 2010-06-29 Doug Kwan <dougkwan@google.com>
4393 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
4394 Initialize USE_SYMBOL_.
4395 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
4397 (Arm_reloc_property::uses_symbol_): New data member declaration.
4398 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
4399 uses symbol value and symbol is undefined but not weakly undefined.
4401 2010-06-28 Rafael Espindola <espindola@google.com>
4403 * plugin.cc (Plugin::load): Use dlerror.
4405 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
4407 * symtab.cc (detect_odr_violations): When reporting an ODR
4408 violation, report an object where the symbol is defined.
4410 2010-06-25 Doug Kwan <dougkwan@google.com>
4412 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
4413 (Target_arm::section_may_have_icf_unsafe_pointers): New method
4415 (Target_arm::Scan::local_reloc_may_be_function_pointer,
4416 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
4417 target hook to detect function points.
4418 (Target_arm::Scan::possible_function_pointer_reloc): New method.
4419 * icf.h (Icf::check_section_for_function_pointers): Change type of
4420 parameter SECTION_NAME to const reference to std::string. Use
4421 target hook to determine if section may have unsafe pointers.
4422 * target.h (Target::section_may_have_icf_unsafe_pointers): New
4425 2010-06-21 Rafael Espindola <espindola@google.com>
4427 * fileread.cc (Input_file::find_fie): New
4428 (Input_file::open): Use Input_file::find_fie.
4429 * fileread.h (Input_file::find_fie): New
4430 * plugin.cc (set_extra_library_path): New.
4431 (Plugin::load): Add set_extra_library_path to the transfer vector.
4432 (Plugin_manager::set_extra_library_path): New.
4433 (Plugin_manager::add_input_file): Use the extra search path if set.
4434 (set_extra_library_path(): New.
4435 * plugin.h (Plugin_manager): Add set_extra_library_path and
4438 2010-06-19 Cary Coutant <ccoutant@google.com>
4440 * layout.cc (gdb_sections): Add .debug_types.
4441 (lines_only_debug_sections): Likewise.
4443 2010-06-18 Rafael Espindola <espindola@google.com>
4445 * plugin.cc (add_input_file,add_input_library)
4446 (Plugin_manager::add_input_file): Make filename arguments const.
4447 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
4450 2010-06-16 Doug Kwan <dougkwan@google.com>
4452 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
4453 .ARM.attributes section if we have not merged any input
4454 attributes sections.
4456 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4458 * arm.cc: Allow combining objects with no EABI version
4461 2010-06-15 Rafael Espindola <espindola@google.com>
4463 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
4465 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4467 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
4468 (struct iovec): Correct !HAVE_READV definition.
4470 2010-06-10 Cary Coutant <ccoutant@google.com>
4472 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
4473 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
4475 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
4478 * symtab.h (Symbol::is_placeholder): New member function.
4479 * target-reloc.h (relocate_section): Check for placeholder symbols.
4481 * testsuite/Makefile.am (plugin_test_8): New test.
4482 (plugin_test_9): New test.
4483 * testsuite/Makefile.in: Regenerate.
4485 2010-06-09 Nick Clifton <nickc@redhat.com>
4487 * yyscript.y (input_list_element): Allow strings prefixed with
4488 the '-' character. Treat these as libraries.
4489 * script.cc (script_add_library): New function. Adds a library
4490 specified by "-l<name>" found in an input script.
4491 * script-c.h: Add prototype for script_add_library.
4493 2010-06-07 Doug Kwan <dougkwan@google.com>
4495 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
4496 Restrict stub-group size to be within long conditional branch
4497 range when working around cortex-A8 erratum.
4499 2010-06-07 Damien Diederen <dd@crosstwine.com>
4501 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
4504 2010-06-03 Sriraman Tallam <tmsriram@google.com>
4508 (Output_section::Input_section_sort_entry::compare_section_ordering):
4509 Change to return non-zero correctly.
4510 (Output_section::Input_section_sort_section_order_index_compare
4511 ::operator()): Change to fix ambiguity in comparisons.
4513 2010-06-01 Sriraman Tallam <tmsriram@google.com>
4515 * gold.h (is_wildcard_string): New function.
4516 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
4517 (Layout::layout_eh_frame): Ditto.
4518 (Layout::find_section_order_index): New method.
4519 (Layout::read_layout_from_file): New method.
4520 * layout.h (Layout::find_section_order_index): New method.
4521 (Layout::read_layout_from_file): New method.
4522 (Layout::input_section_position_): New private member.
4523 (Layout::input_section_glob_): New private member.
4524 * main.cc (main): Call read_layout_from_file here.
4525 * options.h (--section-ordering-file): New option.
4526 * output.cc (Output_section::input_section_order_specified_): New
4528 (Output_section::Output_section): Initialize new member.
4529 (Output_section::add_input_section): Add new parameter.
4530 Keep input sections when --section-ordering-file is used.
4531 (Output_section::set_final_data_size): Sort input sections when
4532 section ordering file is specified.
4533 (Output_section::Input_section_sort_entry): Add new parameter.
4535 (Output_section::Input_section_sort_entry::compare_section_ordering):
4537 (Output_section::Input_section_sort_compare::operator()): Change to
4538 consider section_order_index.
4539 (Output_section::Input_section_sort_init_fini_compare::operator()):
4540 Change to consider section_order_index.
4541 (Output_section::Input_section_sort_section_order_index_compare
4542 ::operator()): New method.
4543 (Output_section::sort_attached_input_sections): Change to sort
4544 according to section order when specified.
4545 (Output_section::add_input_section<32, true>): Add new parameter.
4546 (Output_section::add_input_section<64, true>): Add new parameter.
4547 (Output_section::add_input_section<32, false>): Add new parameter.
4548 (Output_section::add_input_section<64, false>): Add new parameter.
4549 * output.h (Output_section::add_input_section): Add new parameter.
4550 (Output_section::input_section_order_specified): New
4552 (Output_section::set_input_section_order_specified): New method.
4553 (Input_section::Input_section): Initialize section_order_index_.
4554 (Input_section::section_order_index): New method.
4555 (Input_section::set_section_order_index): New method.
4556 (Input_section::section_order_index_): New member.
4557 (Input_section::Input_section_sort_section_order_index_compare): New
4559 (Output_section::input_section_order_specified_): New member.
4560 * script-sections.cc (is_wildcard_string): Delete and move modified
4562 (Output_section_element_input::Output_section_element_input): Modify
4563 call to is_wildcard_string.
4564 (Output_section_element_input::Input_section_pattern
4565 ::Input_section_pattern): Ditto.
4566 (Output_section_element_input::Output_section_element_input): Ditto.
4567 * testsuite/Makefile.am (final_layout): New test case.
4568 * testsuite/Makefile.in: Regenerate.
4569 * testsuite/final_layout.cc: New file.
4570 * testsuite/final_layout.sh: New file.
4572 2010-06-01 Rafael Espindola <espindola@google.com>
4574 * plugin.cc (Plugin::load): Pass the output name to the plugin.
4576 2010-06-01 Rafael Espindola <espindola@google.com>
4578 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
4579 visibility of symbols.
4581 2010-05-27 Doug Kwan <dougkwan@google.com>
4583 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
4584 from start of output section instead of address for a local symbol
4585 in a merged or relaxed section when doing a relocatable link.
4587 2010-05-26 Rafael Espindola <espindola@google.com>
4590 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
4591 adding sections the garbage collector removed.
4592 * gold/testsuite/Makefile.am: Add test.
4593 * gold/testsuite/Makefile.in: Regenerate.
4594 * gold/testsuite/plugin_test_7.sh: New.
4595 * gold/testsuite/plugin_test_7_1.c: New.
4596 * gold/testsuite/plugin_test_7_2.c: New.
4598 2010-05-26 Rafael Espindola <espindola@google.com>
4600 * script-sections.cc (Output_section_definition::set_section_addresses):
4601 Check for --section-start.
4603 2010-05-26 Doug Kwan <dougkwan@google.com>
4605 * arm.cc (Arm_scan_relocatable_relocs): New class.
4606 (Target_arm::relocate_special_relocatable): New method.
4607 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
4608 (Arm_relocate_functions::thumb_branch_common): Same.
4609 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
4610 instead of Default_scan_relocatable_relocs.
4611 * target-reloc.h (relocate_for_relocatable): Let target handle
4612 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
4613 * target.h (Sized_target::relocate_special_relocatable): New method.
4615 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4617 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
4619 2010-05-23 Doug Kwan <dougkwan@google.com>
4621 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
4623 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
4624 with a direct branch, not a conditional branch, to a stub.
4625 * merge.cc (Output_merge_base::record_input_section): New method
4627 (Output_merge_data::do_add_input_section): Record input section if
4628 keeps-input-sections flag is set.
4629 (Output_merge_string::do_add_input_section): Ditto.
4630 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
4631 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
4633 (Output_merge_base::keeps_input_sections,
4634 Output_merge_base::set_keeps_input_sections,
4635 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
4637 (Output_merge_base::Input_sections): New type declaration.
4638 (Output_merge_base::input_sections_begin,
4639 Output_merge_base::input_sections_end,
4640 Output_merge_base::do_set_keeps_input_sections): New method definitions.
4641 (Output_merge_base::bool keeps_input_sections_,
4642 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
4643 Output_merge_base::input_sections_): New data members.
4644 (Output_merge_data::do_set_keeps_input_sections): New method
4646 (Output_merge_string::do_set_keeps_input_sections): Ditto.
4647 * output.cc (Output_section::Input_section::relobj): Move method
4648 defintion from class declaration to here and handle merge sections.
4649 (Output_section::Input_section::shndx): Ditto.
4650 (Output_section::Output_section): Remove initializations of removed
4651 data members and initialize new data member LOOKUP_MAPS_.
4652 (Output_section::add_input_section): Set keeps-input-sections flag
4653 for a newly created merge output section as appropriate. Adjust code
4654 to use Output_section_lookup_maps class.
4655 (Output_section::add_relaxed_input_section): Adjst code for lookup
4656 maps code refactoring.
4657 (Output_section::add_merge_input_section): Add a new parameter
4658 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
4659 class. If adding input section to a newly created merge output
4660 section fails, remove the new merge section.
4661 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
4662 Adjust code for use of the Output_section_lookup_maps class.
4663 (Output_section::find_merge_section): Ditto.
4664 (Output_section::build_lookup_maps): New method defintion.
4665 (Output_section::find_relaxed_input_section): Adjust code to use
4666 Output_section_lookup_maps class.
4667 (Output_section::get_input_sections): Export merge sections. Adjust
4668 code to use Output_section_lookup_maps class.
4669 (Output_section:::add_script_input_section): Adjust code to use
4670 Output_section_lookup_maps class. Update lookup maps for merge
4672 (Output_section::discard_states): Use Output_section_lookup_maps.
4673 (Output_section::restore_states): Same.
4674 * output.h (Merge_section_properties): Move class defintion out of
4676 (Output_section_lookup_maps): New class.
4677 (Output_section::Input_section::is_merge_section): New method
4679 (Output_section::Input_section::relobj): Move defintion out of class
4680 defintion. Declare method only.
4681 (Output_section::Input_section::shndx): Ditto.
4682 (Output_section::Input_section::output_merge_base): New method defintion.
4683 (Output_section::Input_section::u2_.pomb): New union field.
4684 (Output_section::Merge_section_by_properties_map,
4685 Output_section::Output_section_data_by_input_section_map,
4686 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
4688 (Output_section::add_merge_input_section): Add new parameter
4689 KEEPS_INPUT_SECTIONS.
4690 (Output_section::build_lookup_maps): New method declaration.
4691 (Output_section::merge_section_map_,
4692 Output_section::merge_section_by_properties_map_,
4693 Output_section::relaxed_input_section_map_,
4694 Output_section::is_relaxed_input_section_map_valid_): Remove data
4696 (Output_section::lookup_maps_): New data member.
4698 2010-05-21 Doug Kwan <dougkwan@google.com>
4701 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
4702 avoid a compilation error.
4704 2010-05-19 Rafael Espindola <espindola@google.com>
4706 * script-sections.cc (Output_section_definition::allocate_to_segment):
4707 Update the phdrs_list even when the output section is NULL.
4708 * testsuite/Makefile.am: Add test.
4709 * testsuite/Makefile.in: Regenerate.
4710 * testsuite/script_test_9.cc: New.
4711 * testsuite/script_test_9.sh: New.
4712 * testsuite/script_test_9.t: New.
4714 2010-05-19 Doug Kwan <dougkwan@google.com>
4716 * arm.cc (Arm_input_section::original_size): New method.
4717 (Arm_input_section::do_addralign): Add a cast.
4718 (Arm_input_section::do_output_offset): Remove static cast.
4719 (Arm_input_section::original_addralign,
4720 Arm_input_section::original_size_): Change type to uint32_t.
4721 (Arm_input_section::init): Add safe casts for section alignment
4723 (Arm_input_section::set_final_data_size): Do not set address and
4724 offset of stub table.
4725 (Arm_output_section::fix_exidx_coverage): Change use of of
4726 Output_section::Simple_input_section to that of
4727 Output_section::Input_section.
4728 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
4729 except for the first pass.
4730 * output.cc (Output_section::get_input_sections): Change type of
4731 input_sections to std::list<Input_section>.
4732 (Output_section::add_script_input_section): Rename from
4733 Output_section::add_simple_input_section. Change type of SIS
4734 parameter from Simple_input_section to Input_section.
4735 * output.h (Output_section::Simple_input_section): Remove class.
4736 (Output_section::Input_section): Change class visibility to public.
4737 (Output_section::Input_section::addralign): Use stored alignments
4738 for special input sections if set.
4739 (Output_section::Input_section::set_addralign): New method.
4740 (Output_section::get_input_sections): Change parameter type from
4741 list of Simple_input_section to list of Input_section.
4742 (Output_section::add_script_input_section): Rename from
4743 Output_section::add_simple_input_section. Change first parameter's
4744 type from Simple_input_section to Input_section and remove the
4745 second and third parameters.
4746 * script-sections.cc (Input_section::Input_section_list): Change
4747 type to list of Output_section::Input_section/
4748 (Input_section_info::Input_section_info): Change parameter type of
4749 INPUT_SECTION to Output_section::Input_section.
4750 (Input_section_info::input_section): Change return type.
4751 (Input_section_info::input_section_): Change type to
4752 Output_section::Input_section.
4753 (Output_section_element_input::set_section_addresses): Adjust code
4754 to use Output_section::Input_section instead of
4755 Output_section::Simple_input_section. Adjust code for renaming
4756 of Output_section::add_simple_input_section.
4757 (Orphan_output_section::set_section_addresses): Ditto.
4759 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4761 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
4762 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
4764 2010-05-18 Rafael Espindola <espindola@google.com>
4766 * options.cc (General_options::finalize): Handle -nostdlib.
4767 * options.h (nostdlib): New option.
4768 * script.cc (script_add_search_dir): Handle -nostdlib.
4770 2010-05-12 Doug Kwan <dougkwan@google.com>
4772 * arm.cc (Target_arm::do_finalize_sections): Create an empty
4773 attributes section only if there no attributes section after merging.
4774 (Target_arm::merge_object_attributes): Move value of
4775 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
4776 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
4777 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
4778 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
4779 and arm_attr_merge_7.stdout.
4780 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
4781 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
4782 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
4783 arm_attr_merge_7b.o): New rules.
4784 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
4786 * testsuite/Makefile.in: Regenerate.
4787 * testsuite/arm_attr_merge.sh: New file.
4788 * testsuite/arm_attr_merge_[67][ab].s: Same.
4790 2010-05-05 Nick Clifton <nickc@redhat.com>
4792 * po/es.po: Updated Spanish translation.
4794 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
4796 * Makefile.am (install-exec-local): Properly install gold as
4797 default cross linker.
4798 * Makefile.in: Regenerated.
4800 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
4801 Nick Clifton <nickc@redhat.com>
4803 * configure.ac (install_as_default): Define and set to false
4804 unless --enable-gold or --enable-gold=both/gold has been
4806 * configure: Regenerate.
4808 * Makefile.am (install-exec-local): Install the executable as
4809 'ld.gold'. If install_as_default is true then also install it as
4811 * Makefile.in: Regenerated.
4813 2010-04-24 Ian Lance Taylor <iant@google.com>
4815 * layout.cc (Layout::layout_reloc): In relocatable link don't
4816 combine reloc sections for grouped sections.
4818 2010-04-23 Sriraman Tallam <tmsriram@google.com>
4820 * gc.h (gc_process_relocs): Pass information on relocs pointing to
4821 sections that are not ordinary to icf.
4822 * icf.cc (get_section_contents): Handle relocation pointing to section
4823 with no object or shndx information.
4824 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
4825 * testsuite/Makefile.in: Regenerate.
4826 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
4827 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
4829 2010-04-22 Ian Lance Taylor <iant@google.com>
4831 * expression.cc (Expression::Expression_eval_info): Add
4832 result_alignment_pointer field.
4833 (Expression::eval_with_dot): Add result_alignment_pointer
4834 parameter. Change all callers.
4835 (Expression::eval_maybe_dot): Likewise.
4836 (class Binary_expression): Add alignment_pointer parameter to
4837 left_value and right_value. Change all callers.
4838 (BINARY_EXPRESSION): Set result alignment.
4839 (class Trinary_expression): Add alignment_pointer parameter to
4840 arg2_value and arg3_value. Change all callers.
4841 (Trinary_cond::value): Set result alignment.
4842 (Max_expression::value, Min_expression::value): Likewise.
4843 (Align_expression::value): Likewise.
4844 * script-sections.cc (class Sections_element): Add dot_alignment
4845 parameter to set_section_addresses virtual function. Update
4847 (class Output_section_element): Likewise.
4848 (Script_sections::create_segments): Add dot_alignment parameter.
4850 (Script_sections::create_segments_from_phdrs_clause): Likewise.
4851 (Script_sections::set_phdrs_clause_addresses): Likewise.
4852 * script-sections.h: Update declarations.
4853 * script.h: Update declarations.
4854 * output.h (Output_segment::set_minimum_p_align): Don't decrease
4856 * testsuite/script_test_3.t: Set large alignment.
4857 * testsuite/script_test_3.sh: Make sure that at least one LOAD
4858 segment has expected alignment.
4860 2010-04-22 Nick Clifton <nickc@redhat.com>
4862 * po/gold.pot: Updated by the Translation project.
4863 * po/vi.po: Updated Vietnamese translation.
4865 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
4867 * testsuite/Makefile.am (check_PROGRAMS): Add
4868 icf_virtual_function_folding_test.
4869 * testsuite/Makefile.in: Regenerated.
4871 2010-04-15 Andrew Haley <aph@redhat.com>
4873 * options.h (merge_exidx_entries): New option.
4874 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
4875 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
4876 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
4877 (Target_arm::merge_exidx_entries): New function.
4878 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
4879 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
4880 to Arm_exidx_fixup constructor.
4881 Add new arg, merge_exidx_entries.
4882 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
4883 Arm_output_section::fix_exidx_coverage.
4885 2010-04-18 Sriraman Tallam <tmsriram@google.com>
4887 * icf.cc (get_section_contents): Check for preemptible functions.
4888 Ignore addend when appropriate.
4889 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
4891 (add_from_relobj): Check for section folded.
4892 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
4893 * symtab.h (should_add_dynsym_entry): Add new parameter.
4894 * target-reloc.h (scan_relocs): Check for section folded.
4895 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
4896 Check reloc types for function pointers in shared objects.
4897 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
4899 (icf_preemptible_functions_test): New test case.
4900 (icf_string_merge_test): New test case.
4901 * testsuite.Makefile.in: Regenerate.
4902 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
4903 bar_glob. Refactor code.
4904 * testsuite/icf_preemptible_functions_test.cc: New file.
4905 * testsuite/icf_preemptible_functions_test.sh: New file.
4906 * testsuite/icf_string_merge_test.cc: New file.
4907 * testsuite/icf_string_merge_test.sh: New file.
4908 * testsuite/icf_virtual_function_folding_test.cc: New file.
4909 * testsuite/icf_virtual_function_folding_test.sh: New file.
4911 2010-04-14 Doug Kwan <dougkwan@google.com>
4913 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
4914 for local symbol recounting if we remove a section due to ICF.
4915 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
4916 there are no regular objects in input.
4918 2010-04-13 Doug Kwan <dougkwan@google.com>
4920 * arm.cc (Arm_input_section::set_final_data_size): Compute
4921 accurate final data size instead of using current data size.
4923 2010-04-09 Doug Kwan <dougkwan@google.com>
4925 * layout.cc (Layout::choose_output_section): Handle script section
4927 (Layout::make_output_section_for_script): Add section type parameter.
4928 Handle script section types.
4929 * layout.h (Layout::make_output_section_for_script): Add section
4931 * output.cc (Output_section::Output_section): Initialize data member
4933 (Output_section::do_reset_address_and_file_offset): Do not set address
4934 to 0 if section is a NOLOAD section.
4935 * output.h (Output_section::is_noload): New method.
4936 (Output_section::set_is_noload): Ditto.
4937 (Output_section::is_noload_): New data member.
4938 * script-c.h (Script_section_type): New enum type.
4939 (struct Parser_output_section_header): Add new file section_type.
4940 * script-sections.cc (Sections_element::output_section_name): Add
4941 parameter for returning script section type.
4942 (Output_section_definition::output_section_name): Ditto.
4943 (Output_section_definition::section_type)P; New method.
4944 (Output_section_definiton::script_section_type_name): Ditto.
4945 (Output_section_definition::script_section_type_): New data member.
4946 (Output_section_definition::Output_section_definition): Initialize
4947 data member Output_section_definition::script_section_type_.
4948 (Output_section_definition::create_sections): Pass script section type
4949 to Layout::make_output_section_for_script.
4950 (Output_section_definition::output_section_name): Return script
4951 section type to caller.
4952 (Output_section_definition::set_section_address): Do not advance
4953 dot value and load address if section type is NOLOAD. Set address
4954 of NOLOAD sections regardless of section flags.
4955 (Output_section_definition::print): Print section type if it is
4956 not SCRIPT_SECTION_TYPE_NONE.
4957 (Output_section_definition::section_type): New method.
4958 (Output_section_definition::script_section_type_name): Ditto.
4959 (Script_sections::output_section_name): Add new parameter
4960 PSECTION_TYPE for returning script section type. Pass it to
4961 section elements. Handle discard sections.
4962 (Sort_output_sections::operator()): Handle NOLOAD sections.
4963 * script-sections.h (Script_sections::Section_type): New enum type.
4964 (Script_sections::output_section_name): Add a new parameter for
4965 returning script section type.
4966 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
4968 * yyscript.y (union): Add new field SECTION_TYPE.
4969 (COPY, DSECT, INFO, NOLOAD): New tokens.
4970 (opt_address_and_section_type): Change type to output_section_header.
4971 (section_type): New non-terminal
4972 (section_header): Handle section type.
4973 (opt_address_and_section_type): Return section type value.
4975 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
4977 * testsuite/plugin_common_test_1.c (foo): Add prototype.
4978 * testsuite/plugin_common_test_2.c (foo): Likewise.
4980 2010-04-08 Doug Kwan <dougkwan@google.com>
4982 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
4984 * output.cc (Output_section::add_merge_input_section): Simplify
4985 code and return status of Output_merge_base::add_input_section.
4986 Update merge section map only if Output_merge_base::add_input_section
4989 2010-04-07 Doug Kwan <dougkwan@google.com>
4991 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
4992 if section is marked as containing instructions but has no mapping
4994 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
4995 correct section index.
4996 (Arm_relobj::find_linked_text_section): Ditto.
4998 2010-04-07 Cary Coutant <ccoutant@google.com>
5000 * archive.cc (include_member): Destroy Read_symbols_data object before
5002 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
5003 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
5004 (Read_symbols_data::~Read_symbols_data) New destructor.
5005 (Section_relocs::Section_relocs) New constructor.
5006 (Section_relocs::~Section_relocs) New destructor.
5007 (Read_relocs_data::Read_relocs_data) New constructor.
5008 (Read_relocs_data::~Read_relocs_data) New destructor.
5009 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
5010 pointers to NULL after deleting.
5012 2010-04-07 Doug Kwan <dougkwan@google.com>
5014 * arm.cc: Replace "endianity" with "endianness" in comments.
5015 (Arm_exidx_cantunwind): Ditto.
5016 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
5017 (Arm_relobj::merge_flags_and_attributes): New method.
5018 (Arm_relobj::merge_flags_and_attributes_): New data member.
5019 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
5020 (Arm_relobj::scan_sections_for_stubs): Ditto.
5021 (Arm_relobj::do_read_symbols): Check to see if we really want to
5022 merge processor-specific flags and attributes. Exit early if
5023 an object is empty except for section names and the undefined symbol.
5024 (Target_arm::do_finalize_sections): Move check for ELF format to
5025 Arm_relobj::do_read_symbols. Merge processor specific flags and
5026 attributes from a regular object only when we have determined that
5027 it is aapropriate. Do not create an .ARM.attributes section in
5028 output if there is no regular input object.
5029 (Target_arm::merge_processor_specific_flags): Check
5030 --warn-mismatch before printing any error.
5031 (Target_arm::merge_object_attributes): Ditto.
5032 * gold.cc (queue_middle_tasks): Handle the case in which there is
5033 no regular object in input.
5034 * options.cc (General_options::parse_EB): New method.
5035 (General_options::parse_EL): Same.
5036 (General_options::General_options): Initialize endianness_.
5037 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
5039 (General_options::Endianness): New enum.
5040 (General_options::endianness): New method.
5041 (General_options::endianness_): New data member.
5042 * parameters.cc (Parameters::set_options): Check target endianness.
5043 (Parameters::set_target_once): Ditto.
5044 (Parameters::check_target_endianness): New method.
5045 (parameters_force_valid_target): If either -EL or -EB is specified,
5046 use it to define endianness of default target.
5047 * parameters.h (Parameters::check_target_endianness): New method
5049 * target.h (class Target): Change "endianity" to "endianness"
5052 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5054 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
5055 * configure: Regenerate.
5056 * Makefile.in: Regenerate.
5057 * testsuite/Makefile.in: Regenerate.
5059 2010-04-06 Cary Coutant <ccoutant@google.com>
5062 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
5063 prevailing definitions of common symbols.
5064 * testsuite/plugin_test_6.sh: New test case.
5065 * testsuite/plugin_common_test_1.c: New test case.
5066 * testsuite/plugin_common_test_2.c: New test case.
5067 * testsuite/Makefile.am (plugin_test_6): New test case.
5068 * testsuite/Makefile.in: Regenerate.
5070 2010-04-06 Nick Clifton <nickc@redhat.com>
5072 * po/vi.po: New Vietnamese translation.
5074 2010-03-30 Doug Kwan <dougkwan@google.com>
5076 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
5078 2010-03-25 Doug Kwan <dougkwan@google.com>
5080 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
5081 to avoid a conversion warning on a 32-bit host.
5083 2010-03-24 Ian Lance Taylor <iant@google.com>
5085 * testsuite/script_test_3.t: Add a TLS segment.
5086 * testsuite/Makefile.am (check_PROGRAMS): Add
5087 tls_phdrs_script_test.
5088 (tls_phdrs_script_test_SOURCES): Define.
5089 (tls_phdrs_script_test_DEPENDENCIES): Define.
5090 (tls_phdrs_script_test_LDFLAGS): Define.
5091 (tls_phdrs_script_test_LDADD): Define.
5092 * testsuite/Makefile.in: Rebuild.
5094 2010-03-23 Cary Coutant <ccoutant@google.com>
5096 * fileread.cc (find_or_make_view): Fix comment.
5098 2010-03-23 Ian Lance Taylor <iant@google.com>
5100 * script-sections.cc (class Orphan_section_placement): Define
5101 PLACE_TLS and PLACE_TLS_BSS.
5102 (Orphan_section_placement::Orphan_section_placement): Initialize
5104 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
5105 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
5106 (tls_script_test_SOURCES): Define.
5107 (tls_script_test_DEPENDENCIES): Define.
5108 (tls_script_test_LDFLAGS): Define.
5109 (tls_script_test_LDADD): Define.
5110 * testsuite/Makefile.in: Rebuild.
5112 2010-03-22 Doug Kwan <dougkwan@google.com>
5114 * arm.cc (Arm_relocate_functions::abs8,
5115 Arm_relocate_functions::abs16): Use correct check for overflow
5116 specified in the ARM ELF specs.
5117 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
5118 target of a BLX instruction specially.
5119 (Reloc_stub::stub_type_for_reloc): Ditto.
5120 (Relocate::relocate): Use symbolic names instead of numeric relocation
5121 codes to report error.
5122 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
5124 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
5125 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
5126 thumb2_blx_out_of_range.stdout
5127 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
5128 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
5129 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
5130 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
5131 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
5132 thumb2_blx_in_range, thumb2_blx_in_range.o,
5133 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
5134 thumb2_blx_out_of_range.o): New rules.
5135 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
5136 thumb2_blx_in_range and thumb2_blx_out_of_range.
5137 * testsuite/Makefile.in: Regenerate.
5138 * arm_branch_in_range.sh: Add tests for THUMB BLX.
5139 * testsuite/thumb_blx_in_range.s: New file.
5140 * testsuite/thumb_blx_out_of_range.s: New file.
5142 2010-03-22 Rafael Espindola <espindola@google.com>
5144 * archive.cc (Should_include): Move to archive.h.
5145 (should_include_member): Make it a member of Archive.
5147 (Add_lib_group_symbols): New.
5148 * archive.h: Include options.h.
5149 (Archive_member): Moved from Archive.
5150 (Should_include): Moved from archive.cc.
5152 (Add_lib_group_symbols): New.
5153 * dynobj.cc (do_should_include_member): New.
5154 * dynobj.h (do_should_include_member): New.
5155 * gold.cc (queue_initial_tasks): Update call to queue.
5156 * main.cc (main): Print lib group stats.
5157 * object.cc (do_should_include_member): New.
5158 * object.h: Include archive.h.
5159 (Object::should_include_member): New.
5160 (Object::do_should_include_member): New.
5161 (Sized_relobj::do_should_include_member): New.
5162 * options.cc (General_options::parse_start_lib): New.
5163 (General_options::parse_end_lib): New.
5164 (Input_arguments::add_file): Handle lib groups.
5165 (Input_arguments::start_group): Check we are not in a lib.
5166 (Input_arguments::start_lib): New.
5167 (Input_arguments::end_lib): New.
5168 * options.h (General_options): Add start_lib and end_lib.
5169 (Input_argument::lib_): New.
5170 (Input_argument::lib): New.
5171 (Input_argument::is_lib): New.
5172 (Input_file_lib): New.
5173 (Input_arguments::in_lib_): New.
5174 (Input_arguments::in_lib): New.
5175 (Input_arguments::start_lib): New.
5176 (Input_arguments::end_lib_): New.
5177 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5178 in unused members as preempted.
5179 (Sized_pluginobj::do_should_include_member): New.
5180 * plugin.h (Sized_pluginobj::do_should_include_member): New.
5181 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5183 (Read_symbols::do_whole_lib_group): New.
5184 (Read_symbols::do_lib_group): New.
5185 (Read_symbols::do_read_symbols): Handle lib groups.
5186 (Read_symbols::get_name): Handle lib groups.
5187 * readsyms.h (Read_symbols): Add an archive member pointer.
5188 (Read_symbols::do_whole_lib_group): New.
5189 (Read_symbols::do_lib_group): New.
5190 (Read_symbols::member_): New.
5191 * script.cc (read_input_script): Update call to queue_soon.
5193 2010-03-19 Doug Kwan <dougkwan@google.com>
5195 * arm.cc (Stub_table::Stub_table): Initialize new data members
5196 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5197 (Stub_table::add_reloc_stub): Assign stub offset and update
5198 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5199 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
5201 (Stub_table::update_data_size_and_addralign): Use
5202 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
5203 instead of going over all reloc stubs.
5204 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
5205 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5206 Stringpool_template::offset_ to size of Stringpool_char.
5207 (Stringpool_template::new_key_offset): Remove code to initialize
5208 Stringpool_template::offset_.
5209 * stringpool.h (Stringpool_template::set_no_zero_null): Set
5210 Stringpool_template::offset_ to zero.
5212 2010-03-15 Doug Kwan <dougkwan@google.com>
5214 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5216 (Stringpool_template::new_key_offset): New method.
5217 (Stringpool_template::add_string): Assign offsets when adding new
5219 (Stringpool_template::set_string_offsets): Do not set string offsets
5220 when not optimizing.
5221 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5223 (Chunked_vector::clear): Clear size_.
5224 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5225 (Chunked_vector::size): Return size_.
5226 (Chunked_vector::push_back): Use size_ to find insert position.
5227 (Chunked_vector::size_): New data member.
5228 (Stringpool_template::set_no_zero_null): Assert string set is empty.
5229 (Stringpool_template::new_key_offset): New method declaration.
5230 (Stringpool_template::offset_): New data member.
5232 2010-03-15 Rafael Espindola <espindola@google.com>
5234 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
5235 Add_symbols' constructor.
5236 * readsyms.h (Add_symbols): Remove the input_group member.
5238 2010-03-10 Ian Lance Taylor <iant@google.com>
5240 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
5241 target to ask whether a reference to a symbol requires a stack
5243 * target.h (Target::is_call_to_non_split): New function.
5244 (Target::do_is_call_to_non_split): Declare virtual function.
5245 * target.cc: Include "symtab.h".
5246 (Target::do_is_call_to_non_split): New function.
5247 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
5249 2010-03-10 Cary Coutant <ccoutant@google.com>
5251 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
5252 (File_read::open[1]): Remove initial mapping of whole_file_view_.
5253 (File_read::open[2]): Add whole_file_view_ to list of views.
5254 (File_read::make_view): Remove test of whole_file_view_.
5255 (File_read::find_or_make_view): Create whole_file_view_ if
5257 (File_read::clear_views): Replace bool parameter with enum;
5258 adjust all callers. Don't delete views with permanent data;
5259 do delete cached views and views from archives if
5260 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
5261 if clearing the corresponding view.
5262 * fileread.h (File_read::Clear_views_mode): New enum.
5263 (File_read::View::is_permanent_view): New method.
5264 (File_read::clear_views): Replace bool parameter
5265 with enum; adjust all callers.
5266 * options.h (General_options): Change keep_files_mapped option;
5267 add map_whole_files.
5268 * readsyms.cc (Add_symbols::run): Delete sd_ object before
5270 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
5273 2010-03-10 David S. Miller <davem@davemloft.net>
5275 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
5277 2010-03-09 Sriraman Tallam <tmsriram@google.com>
5279 * icf.cc (get_section_contents): Add '@' marker after processing the
5282 2010-03-08 Doug Kwan <dougkwan@google.com>
5284 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
5285 due to a conversion warning.
5286 (Arm_relobj::update_output_local_symbol_count): Check for local
5287 symbol with unset output index.
5289 2010-03-05 Ian Lance Taylor <iant@google.com>
5291 * options.h (class General_options): Add --spare-dynamic-tags.
5292 * output.cc (Output_data_dynamic::set_final_data_size): Implement
5293 --spare-dynamic-tags.
5295 2010-03-05 Ian Lance Taylor <iant@google.com>
5297 * incremental.cc: Include "libiberty.h".
5299 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
5301 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
5302 function, is_info_ member.
5303 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
5304 (Versions::Versions): Update caller.
5305 (Versions::define_base_version): Likewise.
5306 (Versions::add_def): Likewise.
5308 2010-03-03 Sriraman Tallam <tmsriram@google.com>
5310 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
5311 (Scan::possible_function_pointer_reloc): New function.
5312 (Scan::local_reloc_may_be_function_pointer): Change to call
5313 possible_function_pointer_reloc.
5314 (Scan::global_reloc_may_be_function_pointer): Ditto.
5315 * icf.h (Icf::check_section_for_function_pointers): Change to reject
5316 relocations in ".data.rel.ro._ZTV" section.
5317 * testsuite/icf_safe_so_test.sh: Change to pass i386.
5318 * testsuite/icf_safe_so_test.cc: Ditto.
5319 * testsuite/icf_safe_test.cc: Ditto.
5320 * testsuite/icf_safe_test.sh: Ditto.
5322 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5323 Ian Lance Taylor <iant@google.com>
5325 * target-reloc.h (relocate_section): Check the symbol table index
5326 for -1U before setting the local symbol index.
5327 (scan_relocatable_relocs): If copying the relocation, record that
5328 the local symbol is required.
5329 * object.h (Symbol_value::is_output_symtab_index_set): New
5331 (Symbol_value::may_be_discarded_from_output_symtab): New
5333 (Symbol_value::has_output_symtab_entry): New function.
5334 (Symbol_value::needs_output_symtab_entry): Remove.
5335 (Symbol_value::output_symtab_index): Make sure the symbol index is
5337 (Symbol_value::set_output_symtab_index): Make sure the symbol
5338 index is not set. Make sure the new index is valid.
5339 (Symbol_value::set_must_have_output_symtab_entry): New function.
5340 (Symbol_value::has_output_dynsym_entry): New function.
5341 (Symbol_value::set_output_dynsym_index): Make sure the new index
5343 (Sized_relobj::set_must_have_output_symtab_entry): New function.
5344 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
5345 local symbol if permitted.
5346 (Sized_relobj::do_finalize_local_symbols): Call
5347 is_output_symtab_index_set rather than needs_output_symtab_entry.
5348 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
5349 rather than needs_output_symtab_entry. Call
5350 has_output_dynsym_entry rather than needs_output_dynsym_entry.
5351 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
5352 is_output_symtab_index_set rather than needs_output_symtab_entry.
5353 * testsuite/discard_locals_relocatable_test.c: New file.
5354 * testsuite/discard_locals_test.sh: Test -r.
5355 * testsuite/Makefile.am (check_DATA): Add
5356 discard_locals_relocatable_test1.syms,
5357 discard_local_relocatable_test2.syms.
5358 (MOSTLYCLEANFILES): Likewise. Also add
5359 discard_locals_relocatable_test1.lout and
5360 discard_locals_relocatable_test2.out.
5361 (discard_locals_relocatable_test1.syms): New target.
5362 (discard_locals_relocatable_test.o): New target.
5363 (discard_locals_relocatable_test1.out): New target.
5364 (discard_locals_relocatable_test2.syms): New target.
5365 (discard_locals_relocatable_test2.out): New target.
5366 (various): Add missing ../ld-new dependencies.
5367 * testsuite/Makefile.in: Rebuild.
5369 2010-03-03 Nick Clifton <nickc@redhat.com>
5371 * po/fi.po: New Finnish translation.
5373 2010-03-01 Doug Kwan <dougkwan@google.com>
5375 * layout.cc (Layout::Layout): Force section types of .init_array*,
5376 .preinit_array* and .fini_array* sections.
5377 * output.cc (Output_section::Input_section_sort_entry::has_priority):
5378 Fix check of return value of std::string::find.().
5379 (Output_section::Input_section_sort_compare::operator()): Remove
5380 comment about .init_array.
5381 (Output_section::Input_section_sort_init_fini_compare::operator()):
5383 (Output_section::sort_attached_input_sections): Handle .init_array
5384 and .fini_array specially.
5385 * output.h (Output_section::Inut_section_sort_compare): Update
5387 (Output_section::Input_section_sort_init_fini_compare): New struct.
5389 2010-02-26 Doug Kwan <dougkwan@google.com>
5391 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
5392 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
5393 * testsuite/debug_msg.sh: Avoid matching source line number for
5394 use of global variable undef_int.
5396 2010-02-26 Doug Kwan <dougkwan@google.com>
5398 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
5399 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
5400 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
5401 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
5402 * options.cc (General_options::General_options): Initialize member
5404 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
5405 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
5406 and rm_no_fix_v4bx.stdout
5407 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
5408 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
5409 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
5410 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
5411 and arm_no_fix_v4bx.
5412 * Makefile.in: Regenerate.
5413 * testsuite/arm_fix_v4bx.s: New file.
5414 * testsuite/arm_fix_v4bx.sh: Ditto.
5416 2010-02-24 Doug Kwan <dougkwan@google.com>
5418 * arm.cc (Target_arm::got_section): Make the .got section the first
5419 non RELRO section in the data segment.
5420 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
5421 suffixes of section names.
5423 2010-02-24 Doug Kwan <dougkwan@google.com>
5425 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
5426 flags and attributes merging if an input file is a binary file.
5427 * fileread.cc (Input_file::open): Record format of original file.
5428 * fileread.h (Input_file::Format): New enum type.
5429 (Input_file::Input_file): Initialize data member format_.
5430 (Input_file::format): New method definition.
5431 (Input_file::format_):: New data member.
5433 2010-02-24 Doug Kwan <dougkwan@google.com>
5435 * arm.cc (Arm_output_data_got): New class.
5436 (ARM_TCB_SIZE): New constant
5437 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
5438 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
5439 If user uses a script with a SECTIONS clause, issue only a warning
5440 for a misplaced EXIDX input section. Otherwise, issue an error.
5441 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
5443 (Target_arm::got_mode_index_entry): Handle static linking.
5444 (Target_arm::Scan::local): Ditto.
5445 (Target_arm::Scan::global): Ditto.
5446 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
5447 all incorrectly implemented relocations.
5448 (Target_arm::fix_exidx_coverage): Pass layout to
5449 Arm_output_section::fix_exidx_coverage.
5450 * layout.cc (Layout::section_name_mapping): Remove trailing dots
5451 from ".ARM.exidx." and ".ARM.extab.".
5453 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5455 * arm.cc (Target_arm::do_finalize_sections): Create attribute
5456 section if it does not already exist.
5457 * attributes.cc (Attributes_section_data::Attributes_section_data):
5458 Don't crash if size is zero.
5460 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5461 Ian Lance Taylor <iant@google.com>
5463 * gold.cc (queue_middle_tasks): If no input files were opened,
5465 * workqueue.h (Task_function::Task_function): Assert that there is
5468 2010-02-22 Doug Kwan <dougkwan@google.com>
5470 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
5471 * icf.cc (get_section_contents): Cast snprintf arguments to long long
5472 types to avoid warnings due to different uint64_t implementations
5475 2010-02-21 Doug Kwan <dougkwan@google.com>
5477 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
5478 handling of the maximum backward branch offset.
5479 (Arm_relocate_functions::thumb_branch_common): Ditto.
5480 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
5481 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
5482 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
5483 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
5484 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
5485 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
5486 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
5487 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
5488 thumb_bl_out_of_range thumb_bl_out_of_range.o,
5489 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
5490 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
5491 thumb2_bl_out_of_range.o): New rules.
5492 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
5493 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
5494 thumb2_bl_out_of_range
5495 * testsuite/Makefile.in: Regenerate.
5496 * testsuite/arm_bl_in_range.s: New file.
5497 * testsuite/arm_bl_out_of_range.s: Ditto.
5498 * testsuite/arm_branch_in_range.sh: Ditto.
5499 * testsuite/arm_branch_range.t: Ditto.
5500 * testsuite/thumb2_branch_range.t: Ditto.
5501 * testsuite/thumb_bl_in_range.s: Ditto.
5502 * testsuite/thumb_bl_out_of_range.s: Ditto.
5503 * testsuite/thumb_branch_range.t: Ditto.
5505 2010-02-20 Sriraman Tallam <tmsriram@google.com>
5507 * gc.h (gc_process_relocs): Change vectors to point to the new list.
5508 Add reloc offset information.
5509 * icf.cc (get_section_contents): Change iterators to point to the new
5510 vectors. Add reloc offset information to the contents.
5511 * icf.h (Icf::Sections_reachable_info): New typedef.
5512 (Icf::Sections_reachable_list): New typedef.
5513 (Icf::Offset_info): New typedef.
5514 (Icf::Reloc_info): New struct typedef.
5515 (Icf::Reloc_info_list): New typedef.
5516 (Icf::symbol_reloc_list): Delete method.
5517 (Icf::addend_reloc_list): Delete method.
5518 (Icf::section_reloc_list): Delete method.
5519 (Icf::reloc_info_list): New method.
5520 (Icf::reloc_info_list_): New member.
5522 2010-02-19 Doug Kwan <dougkwan@google.com>
5524 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
5525 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
5526 * arm.cc (Arm_relocation_functions): New forward declaration.
5527 (Target_arm::Target_arm): Initialize new data members
5528 got_mod_index_offset_ and tls_base_symbol_defined_.
5529 (Target_arm::Relocate::relocate_tls): New method.
5530 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
5531 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
5533 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
5534 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
5535 (Target_arm::got_mod_index_offset_,
5536 Target_arm::tls_base_symbol_defined_): New data members.
5537 (Target_arm::Scan::local, Target::Scan::global,
5538 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
5541 2010-02-18 Doug Kwan <dougkwan@google.com>
5543 * arm.cc (Arm_relobj::find_linked_text_section): New method.
5544 (Arm_relobj::make_exidx_input_section): Pass section index of linked
5545 text section as a parameter becuase some broken tools may not set
5546 the link in section header.
5547 (Target_arm::has_got_section): New method.
5548 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
5549 without any mapping symbol as data only. Remove warning.
5550 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
5551 link in its section header, try to discover the link by inspecting the
5552 REL31 relocation at the beginning of the section.
5553 (Target_arm::Scan::check_non_pic): Report name of offending relocation
5555 (Target_arm::Scan::global): Treat any reference to the symbol
5556 _GLOBAL_OFFSET_TABLE_ as a GOT access.
5558 2010-02-12 Sriraman Tallam <tmsriram@google.com>
5560 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
5561 (Scan::global_reloc_may_be_function_pointer): New function.
5562 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5563 (Scan::global_reloc_may_be_function_pointer): New function.
5564 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5565 (Scan::global_reloc_may_be_function_pointer): New function.
5566 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
5567 (Scan::global_reloc_may_be_function_pointer): New function.
5568 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
5569 (Scan::global_reloc_may_be_function_pointer): New function.
5570 (Scan::possible_function_pointer_reloc): New function.
5571 (Target_x86_64::can_check_for_function_pointers): New function.
5572 * gc.h (gc_process_relocs): Scan relocation types to determine if
5573 function pointers were taken for targets that support it.
5574 * icf.cc (Icf::find_identical_sections): Include functions for
5575 folding in safe ICF whose pointer is not taken.
5576 * icf.h (Secn_fptr_taken_set): New typedef.
5577 (fptr_section_id_): New member.
5578 (section_has_function_pointers): New function.
5579 (set_section_has_function_pointers): New function.
5580 (check_section_for_function_pointers): New function.
5581 * options.h: Fix comment for safe ICF option.
5582 * target.h (can_check_for_function_pointers): New function.
5583 * testsuite/Makefile.am: Add icf_safe_so_test test case.
5584 Modify icf_safe_test for X86-64.
5585 * testsuite/Makefile.in: Regenerate.
5586 * testsuite/icf_safe_so_test.cc: New file.
5587 * testsuite/icf_safe_so_test.sh: New file.
5588 * testsuite/icf_safe_test.cc (kept_func_3): New function.
5589 (main): Change to take pointer to function kept_func_3.
5590 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
5591 folding is done correctly for X86-64.
5593 2010-02-12 David S. Miller <davem@davemloft.net>
5595 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
5596 is_symbolless parameter.
5597 (Output_reloc<SHT_REL>::is_symbolless): New.
5598 (Output_reloc<SHT_REL>::is_symbolless_): New.
5599 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
5600 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
5601 (Output_reloc<SHT_RELA>::is_symbolless): New.
5602 (Output_data_reloc::add_global): Handle is_symbolless.
5603 (Output_data_reloc::add_global_relative): Likewise.
5604 (Output_data_reloc::add_local): Likewise.
5605 (Output_data_reloc::add_local_relative): Likewise.
5606 (Output_data_reloc::add_symbolless_global_addend): New.
5607 (Output_data_reloc::add_symbolless_local_addend): New.
5608 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
5610 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
5611 instead of ->is_relative_
5612 (Output_reloc::write): Likewise.
5613 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
5614 (Output_reloc::write_rel): Simplify.
5616 * sparc.cc (Target_sparc::Scan::local): Use
5617 ->add_symbolless_local_addend as needed.
5618 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
5619 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
5620 based upon relocation offset.
5622 2010-02-11 Doug Kwan <dougkwan@google.com>
5624 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
5625 (Target_arm::Scan::global): Ditto. Also remove a comment before the
5626 beginning of function.
5627 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
5628 and MOVT_ABS relocations. Those are non issued in scanning. Fix
5629 parameter is_32bit in calls to should_apply_static_reloc.
5630 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
5631 (check_DATA): Add arm_abs_global.stdout.
5632 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
5633 arm_abs_global.stdout): New rules.
5634 (MOSTLLYCLEANFILES): Add arm_abs_global
5635 * Makefile.in: Regenerate.
5636 * testsuite/arm_abs_global.s: New file.
5637 * testsuite/arm_abs_global.sh: Ditto.
5638 * testsuite/arm_abs_lib.s: Ditto.
5640 2010-02-11 Ian Lance Taylor <iant@google.com>
5642 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
5644 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
5645 Allocate_commons_task first.
5646 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
5647 task, rather than symtab_lock_.
5648 (Gc_process_relocs::~Gc_process_relocs): New function.
5649 (Gc_process_relocs::is_runnable): Check this_blocker_.
5650 (Gc_process_relocs::locks): Use next_blocker_ rather than
5652 (Scan_relocs::~Scan_relocs): New function.
5653 (Scan_relocs::is_runnable): Check this_blocker_ rather than
5655 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
5657 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
5658 fields. Add this_blocker_ and next_blocker_ fields. Adjust
5659 constructor accordingly.
5660 (class Gc_process_relocs): Likewise.
5661 (class Scan_relocs): Likewise.
5662 * common.h (class Allocate_commons_task): Remove symtab_lock_
5663 field, and corresponding constructor parameter.
5664 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
5666 (Allocate_commons_task::locks): Likewise.
5668 2010-02-11 Ian Lance Taylor <iant@google.com>
5670 * gold-threads.h (class Once): Define.
5671 (class Initialize_lock): Rewrite as child of Once.
5672 * gold-threads.cc (class Once_initialize): Define.
5673 (once_pointer_control): New static variable.
5674 (once_pointer, once_arg): New static variables.
5675 (c_run_once): New static function.
5676 (Once::Once, Once::run_once, Once::internal_run): New functions.
5677 (class Initialize_lock_once): Remove.
5678 (initialize_lock_control): Remove.
5679 (initialize_lock_pointer): Remove.
5680 (initialize_lock_once): Remove.
5681 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
5682 (Initialize_lock::initialize): Rewrite.
5683 (Initialize_lock::do_run_once): New function.
5684 * archive.cc (Archive::interpret_header): Only clear name if it is
5686 * fileread.cc: Include "gold-threads.h"
5687 (file_counts_lock): New static variable.
5688 (file_counts_initialize_lock): Likewise.
5689 (File_read::release): Only increment counts when using --stats.
5690 Use a lock around the increment.
5691 * parameters.cc (class Set_parameters_target_once): Define.
5692 (set_parameters_target_once): New static variable.
5693 (Parameters::Parameters): Move here from parameters.h.
5694 (Parameters::set_target): Rewrite.
5695 (Parameters::set_target_once): New function.
5696 (Parameters::clear_target): Move here and rewrite.
5697 * parameters.h (class Parameters): Update declarations. Add
5698 set_parameters_target_once_ field.
5699 (Parameters::Parameters): Move to parameters.cc.
5700 (Parameters::clear_target): Likewise.
5701 * readsyms.cc (Read_symbols::do_group): Create a Start_group
5703 (Start_group::~Start_group): New function.
5704 (Start_group::is_runnable): New function.
5705 (Start_group::locks, Start_group::run): New functions.
5706 (Finish_group::run): Change saw_undefined to size_t.
5707 * readsyms.h (class Start_group): Define.
5708 (class Finish_group): Change saw_undefined_ field to size_t.
5709 (Finish_group::Finish_group): Remove saw_undefined and
5710 this_blocker parameters. Change all callers.
5711 (Finish_group::set_saw_undefined): New function.
5712 (Finish_group::set_blocker): New function.
5713 * symtab.h (class Symbol_table): Change saw_undefined to return
5714 size_t. Change saw_undefined_ field to size_t.
5715 * target-select.cc (Set_target_once::do_run_once): New function.
5716 (Target_selector::Target_selector): Initialize set_target_once_
5717 field. Don't initialize lock_ and initialize_lock_ fields.
5718 (Target_selector::instantiate_target): Rewrite.
5719 (Target_selector::set_target): New function.
5720 * target-select.h (class Set_target_once): Define.
5721 (class Target_selector): Update declarations. Make
5722 Set_target_once a friend. Remove lock_ and initialize_lock_
5723 fields. Add set_target_once_ field.
5725 2010-02-10 Ian Lance Taylor <iant@google.com>
5727 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
5729 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
5730 (queue_middle_tasks): Add all blockers before queueing any tasks.
5731 (queue_final_tasks): Likewise.
5732 * token.h (Task_token::add_blockers): New function.
5733 * object.h (Input_objects::number_of_relobjs): New function.
5735 2010-02-10 Ian Lance Taylor <iant@google.com>
5737 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
5738 shared, not if not position independent.
5739 * x86_64.cc (Relocate::relocate_tls): Likewise.
5740 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
5741 (tls_pie_pic_test): New target.
5742 * testsuite/Makefile.in: Rebuild.
5744 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
5745 (tls_test_main_pie.o, tls_test_pie.o): New targets.
5746 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
5747 * testsuite/Makefile.in: Rebuild.
5749 2010-02-09 David S. Miller <davem@davemloft.net>
5751 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
5752 R_SPARC_RELATIVE using ->add_local_relative().
5753 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
5755 * output.h (Output_data_dynamic::add_section_size): New method
5756 that takes two Output_data objects.
5757 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
5758 entry param. Handle it in initializers.
5759 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
5760 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
5761 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
5763 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
5764 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
5765 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
5766 for dynrel_includes_plt.
5767 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5768 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5769 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
5771 (Target_sparc::do_finalize_sections): Update to pass true for
5772 dynrel_includes_plt.
5773 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
5774 output before .rela.plt
5775 (Target_powerpc::do_finalize_sections): Update to pass true for
5776 dynrel_includes_plt when 32-bit.
5778 2010-02-08 Doug Kwan <dougkwan@google.com>
5780 * arm.cc (Arm_relobj::simple_input_section_output_address): New
5782 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
5783 Arm_relobj::scan_section_for_cortex_a8_stubs,
5784 Arm_relobj::do_relocation_section): Instead of calling
5785 Output_section::output_address, use faster
5786 Arm_relobj::simple_input_section_output_address.
5788 2010-02-08 David S. Miller <davem@davemloft.net>
5790 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
5791 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
5792 relocation helper function.
5794 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
5795 just like R_SPARC_GOT{10,13,22}.
5796 (Target_sparc::Scan::local): Likewise.
5797 (Target_sparc::Relocate:relocate): Likewise.
5799 2010-02-06 Ian Lance Taylor <iant@google.com>
5801 * configure.ac: Rewrite targetobjs duplicate removal code to use
5802 only shell constructs.
5803 * configure: Rebuild.
5805 2010-02-05 Doug Kwan <dougkwan@google.com>
5808 * arm.cc (Arm_relobj::section_is_scannable): New method.
5809 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
5810 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
5812 2010-02-04 Doug Kwan <dougkwan@google.com>
5815 * arm-reloc-property.cc (cstdio): Include.
5816 * configure.ac (targetobjs): Remove duplicates.
5817 * configure: Regenerate.
5818 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
5819 big and little endian version for a given address size.
5821 2010-02-03 Doug Kwan <dougkwan@google.com>
5823 * arm-reloc-property.cc
5824 (Arm_reloc_property_table::reloc_name_in_error_message): New method
5826 * arm-reloc-property.h
5827 (Arm_reloc_property_table::get_implemented_static_reloc_property):
5828 New method definition.
5829 (Arm_reloc_property_table::reloc_name_in_error_message): New method
5831 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
5833 (GOT_PREL): Change implemented to Y.
5834 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
5835 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
5836 (Arm_relocate_functions::movw_abs_nc): Remove method.
5837 (Arm_relocate_functions::movt_abs): Ditto.
5838 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
5839 (Arm_relocate_functions::thm_movt_abs): Ditto.
5840 (Arm_relocate_functions::movw_rel_nc): Ditto.
5841 (Arm_relocate_functions::movw_rel): Ditto.
5842 (Arm_relocate_functions::movt_rel): Ditto.
5843 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
5844 (Arm_relocate_functions:thm_movw_rel): Ditto.
5845 (Arm_relocate_functions:thm_movt_rel): Ditto.
5846 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
5847 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
5848 New method definitions.
5849 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
5850 (Arm_relocation_functions::arm_grp_ldr): Ditto.
5851 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
5852 (Arm_relocation_functions::arm_grp_ldc): Ditto.
5853 (Target_arm::Relocate::relocate): Check for non-static or
5854 unimplemented relocation code and exit early. Change calls to
5855 Target_arm::reloc_uses_thumb_bit and
5856 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
5857 instead. Refactor code to handle similar relocations to increase
5858 code sharing. Remove check for unsupported relocation code in switch
5860 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
5861 relocation property table to find out size. Change error message to
5862 print out the name of a relocation code instead of the numeric value.
5863 (Target_arm::scan_reloc_for_stub): Use relocation property table
5864 instead of calling Target_arm::reloc_uses_thumb_bit().
5866 2010-02-02 Doug Kwan <dougkwan@google.com>
5868 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
5869 types of relaxed input section.
5871 2010-02-02 Doug Kwan <dougkwan@google.com>
5873 * Makefile.am (HFILES): Add arm-reloc-property.h.
5875 (TARGETSOURCES): Add arm-reloc-property.cc
5876 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
5877 (libgold_a_SOURCES): $(DEFFILES)
5878 * Makefile.in: Regenerate.
5879 * arm-reloc-property.cc: New file.
5880 * arm-reloc-property.h: New file.
5881 * arm-reloc.def: New file.
5882 * arm.cc: Update comments.
5883 (arm-reloc-property.h): New included header.
5884 (arm_reloc_property_table): New global variable.
5885 (Target_arm::do_select_as_default_target): New method definition.
5886 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
5887 arm-reloc-property to targ_extra_obj.
5888 * parameters.cc (set_parameters_target): Call
5889 Target::select_as_default_target().
5890 * target.h (Target::select_as_default_target): New method definition.
5891 (Target::do_select_as_default_target): Same.
5893 2010-02-01 Doug Kwan <dougkwan@google.com>
5895 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
5896 first_output_text_section_.
5897 (Arm_exidx_fixup::first_output_text_section): New method definition.
5898 (Arm_exidx_fixup::first_output_text_section_): New data member.
5899 (Arm_exidx_fixup::process_exidx_section): Record the first text
5900 output section seen.
5901 (Arm_output_section::fix_exidx_coverage): Set correct linked section
5902 and entsize in output section header.
5904 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5906 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
5907 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
5908 (Arm_relocate_functions::thm_alu11): New Method.
5909 (Arm_relocate_functions::thm_pc8): New Method.
5910 (Arm_relocate_functions::thm_pc12): New Method.
5911 (Target_arm::Scan::local): Handle the relocations.
5912 (Target_arm::Scan::global): Likewise.
5913 (Target_arm::Relocate::relocate): Likewise.
5914 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
5916 2010-01-29 Doug Kwan <dougkwan@google.com>
5918 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
5919 of relocation types as ld.
5921 2010-01-29 Doug Kwan <dougkwan@google.com>
5923 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
5925 (Arm_relocate_functions::thumb_branch_common): Ditto.
5926 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
5927 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
5928 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
5929 Arm_relocate_functions::jump24): Remove.
5930 (Target_arm::Relocate::relocate): Adjust code to call
5931 Arm_relocation_functions::arm_branch_common and
5932 Arm_relocation_functions::thumb_branch_common instead of their removed
5933 wrappers. Merge switch-cases together to reduce source code size.
5935 2010-01-29 Doug Kwan <dougkwan@google.com>
5937 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
5938 output_local_symbol_count_needs_update_.
5939 (Arm_relobj::output_local_symbol_count_needs_update,
5940 Arm_relobj::set_output_local_symbol_count_needs_update,
5941 Arm_relobj::update_output_local_symbol_count): New methods.
5942 (Arm_relobj::output_local_symbol_count_needs_update_): New data
5944 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
5945 of pointed function as in a R_ARM_PREL31 relocation.
5946 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
5947 for output local symbol count updating.
5948 (Target_arm::do_relax): Update output local symbol counts in objects
5950 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
5952 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5954 * arm.cc: Added support for the ARM relocations:
5955 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
5956 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
5957 (Arm_relocate_functions::movw_rel_nc): Renamed (was
5959 (Arm_relocate_functions::movw_rel): New method.
5960 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
5961 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
5963 (Arm_relocate_functions::thm_movw_rel): New method.
5964 (Arm_relocate_functions::thm_movt_rel): Renamed (was
5966 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
5968 (Target_arm::Scan::global): Likewise.
5969 (Target_arm::Relocate::relocate): Likewise.
5970 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5973 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5975 * arm.cc: Added support for ARM group relocations.
5976 (Target_arm::reloc_needs_sym_origin): New method.
5977 (Arm_relocate_functions::calc_grp_kn): New method.
5978 (Arm_relocate_functions::calc_grp_residual): New method.
5979 (Arm_relocate_functions::calc_grp_gn): New method.
5980 (Arm_relocate_functions::arm_grp_alu): New Method.
5981 (Arm_relocate_functions::arm_grp_ldr): New Method.
5982 (Arm_relocate_functions::arm_grp_ldrs): New Method.
5983 (Arm_relocate_functions::arm_grp_ldc): New Method.
5984 (Target_arm::Scan::local): Handle the ARM group relocations.
5985 (Target_arm::Scan::global): Likewise.
5986 (Target_arm::Relocate::relocate): Likewise.
5987 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5990 2010-01-26 Doug Kwan <dougkwan@google.com>
5992 * arm.cc (set): Include.
5993 (class Arm_exidx_fixup): Change type of last_input_section_ to const
5995 (Arm_output_section::Text_section_list): New type.
5996 (Arm_output_section::append_text_sections_to_list): New method.
5997 (Arm_output_section::fix_exidx_coverage): Ditto.
5998 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
5999 (Arm_relobj::convert_input_section_to_relaxed_section): Use
6000 Relobj::set_section_offset() instead of
6001 Sized_relobj::invalidate_section_offset().
6002 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
6003 parameter for section headers. Ignore relocation sections for
6004 unallocated sections and EXIDX sections.
6005 (Target_arm::fix_exidx_coverage): New method.
6006 (Target_arm::output_section_address_less_than): New type.
6007 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
6008 linked text section instead of the EXIDX section.
6009 (Arm_output_section::create_stub_group): Add an assertion to check
6010 that this is not an EXIDX output section.
6011 (Arm_output_section::append_text_sections_to_list): New method.
6012 (Arm_output_section::fix_exidx_coverage): Ditto.
6013 (Arm_relobj::scan_sections_for_stubs): Adjust call to
6014 Arm_relobj::section_needs_reloc_stub_scanning.
6015 (Target_arm::do_relax): Fix EXIDX output section coverage in the
6017 (Target_arm::fix_exidx_coverage): New method.
6018 * object.h (Relobj::set_output_section): New method.
6019 (Sized_relobj::invalidate_section_offset): Remove method.
6020 (Sized_relobj::do_invalidate_section_offset): Remove method.
6021 (Sized_relobj::do_set_section_offset): Handle offset value -1.
6023 2010-01-25 Doug Kwan <dougkwan@google.com>
6025 * arm.cc (Arm_exidx_merged_section::do_output_offset):
6026 Fix warning due to signed and unsigned comparison on a 32-bit host.
6028 2010-01-22 Doug Kwan <dougkwan@google.com>
6030 * arm.cc (Target_arm::do_relax): Record an output section for section
6031 offset adjustment it contains any stub table that has changed.
6032 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
6033 offsets in an output section if necessary.
6034 * output.cc (Output_section::Output_section): Initialize
6035 section_offsets_need_adjustments_.
6036 (Output_section::add_input_section_for_script): Renamed to
6037 Output_section::add_simple_input_section.
6038 (Output_section::save_states): Add a comment.
6039 (Output_section::discard_states): New method defintion.
6040 (Output_section::adjust_section_offsets): Same.
6041 * output.h (Output_section::add_input_section_for_script): Renamed to
6042 Output_section::add_simple_input_section.
6043 (Output_section::discard_states): New method declaration.
6044 (Output_section::adjust_section_offsets): Same.
6045 (Output_section::section_offsets_need_adjustment,
6046 Output_section::set_section_offsets_need_adjustment): New method
6048 (Output_section::section_offsets_need_adjustment_): New data member.
6049 * script-sections.cc
6050 (Output_section_element_input::set_section_address): Adjust code for
6051 renaming of Output_section::add_input_section_for_script.
6052 (Orphan_output_section::set_section_address): Same.
6054 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6056 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
6057 Fix_v4bx enum values .
6058 * gold/options.h (General_options): New option definitions.
6059 (General_options::fix_v4bx): New method.
6060 (General_options::Fix_v4bx): New enum.
6061 * gold/options.cc (General_options::parse_fix_v4bx): New method.
6062 (General_options::parse_fix_v4bx_interworking): New method.
6064 2010-01-22 Doug Kwan <dougkwan@google.com>
6066 * arm.cc (Arm_exidx_fixup): New class.
6068 2010-01-21 Doug Kwan <dougkwan@google.com>
6070 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
6072 (Arm_exidx_section_offset_map): New type.
6074 2010-01-21 Doug Kwan <dougkwan@google.com>
6076 * arm.cc (Arm_exidx_input_section): New class.
6077 (Arm_relobj::exidx_input_section_by_link,
6078 Arm_relobj::exidx_input_section_by_shndx,
6079 Arm_relobj::make_exidx_input_section): New methods.
6080 (read_arm_attributes_section): Remove.
6081 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
6082 information about them.
6083 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
6086 2010-01-20 Doug Kwan <dougkwan@google.com>
6088 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
6089 Input_section_specifier to Section_id.
6090 (Target_arm::new_arm_input_section: Adjust code for change of key
6092 (Target_arm::find_arm_input_section): Ditto.
6093 * gc.h (object.h): Include for Section_id nand Section_id_hash.
6094 (Section_id): Remove.
6095 (Garbage_collection::Section_id_hash): Remove.
6096 * icf.h (object.h): Include for Section_id nand Section_id_hash.
6097 (Section_id): Remove.
6098 (Icf::Section_id_hash): Remove.
6099 * object.h (Section_id, Const_section_id, Section_id_hash,
6100 Const_section_id_hash): New type definitions.
6101 * output.cc (Output_section::add_relaxed_input_section): Change to
6102 use Const_section_id instead of Input_section_specifier as key type.
6103 (Output_section::add_merge_input_section): Ditto.
6104 (Output_section::build_relaxation_map): Change to use Section_id
6105 instead of Input_section_specifier as key type.
6106 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6108 (Output_section::convert_input_sections_to_relaxed_sections): Change
6109 to use Const_section_id instead of Input_section_specifier as key type.
6110 (Output_section::find_merge_section): Ditto.
6111 (Output_section::find_relaxed_input_section): Ditto.
6112 * output.h (Input_section_specifier): Remove class.
6113 (Output_section::Output_section_data_by_input_section_map): Change
6114 key type to Const_section_id.
6115 (Output_section::Output_relaxed_input_section_by_input_section_map):
6117 (Output_section::Relaxation_map): Change key type to Section_id.
6119 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6121 * gold/arm.cc: Added support for R_ARM_V4BX relocation
6122 (class Arm_v4bx_stub): New class.
6123 (DEF_STUBS): Updated definition to support v4_veneer_bx.
6124 (Stub_factory::make_arm_v4bx_stub): New method.
6125 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
6126 (Stub_table::empty): Handle v4bx stubs.
6127 (Stub_table::add_arm_v4bx_stub): New method.
6128 (Stub_table::find_arm_v4bx_stub): New method.
6129 (Arm_relocate_functions::v4bx): New method.
6130 (Target_arm::fix_v4bx): New method.
6131 (Target_arm::Target_arm): Handle R_ARM_V4BX.
6132 (Stub_table::relocate_stubs): Likewise.
6133 (Stub_table::do_write): Likewise.
6134 (Stub_table::update_data_size_and_addralign): Likewise.
6135 (Stub_table::finalize_stubs): Likewise.
6136 (Target_arm::Scan::local): Likewise.
6137 (Target_arm::Scan::global): Likewise.
6138 (Target_arm::do_finalize_sections): Likewise.
6139 (Target_arm::Relocate::relocate): Likewise.
6140 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6142 (Target_arm::scan_reloc_for_stub): Likewise.
6143 (Target_arm::scan_reloc_section_for_stubs): Likewise.
6145 2010-01-19 Ian Lance Taylor <iant@google.com>
6147 * output.cc (Output_section_headers::do_sized_write): Write large
6148 segment count to sh_info field.
6149 (Output_file_header::do_sized_write): For large segment count,
6150 write PN_XNUM to e_phnum field.
6152 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6154 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
6155 (Arm_relocate_functions::thm_jump8): New function.
6156 (Arm_relocate_functions::thm_jump11): New function.
6157 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
6159 (Target_arm::Scan::global): Likewise.
6160 (Target_arm::Relocate::relocate): Likewise.
6161 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6164 2010-01-14 Doug Kwan <dougkwan@google.com>
6166 * arm.cc (map, utility): Include headers.
6167 (Target_arm::apply_cortex_a8_workaround): New method.
6168 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
6169 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
6170 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
6171 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
6172 the --[no-]fix-cortex-a8 command line options.
6173 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
6174 (Target_arm::relocate_stub): Use addend in instruction template.
6175 * options.h (DEFINE_bool): Set the user-set flag.
6176 (General_options): Add --[no-]-fix-cortex options.
6177 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
6178 : Update fast look-up map after conversion.
6180 2010-01-14 Sriraman Tallam <tmsriram@google.com>
6182 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6183 in the first pass of do_layout.
6185 2010-01-13 Doug Kwan <dougkwan@google.com>
6187 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6188 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6189 apparent compiler problem of not folding static constant integral
6190 data members of elfcpp::Elf_sizes<32>.
6192 2010-01-13 Doug Kwan <dougkwan@google.com>
6194 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6195 Arm_relobj::section_needs_cortex_a8_stub_scanning,
6196 Arm_relobj::scan_section_for_cortex_a8_erratum,
6197 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
6198 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
6199 sections to scan for relocation stubs into a new method
6200 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
6201 relocation and Cortex-A8 stub scanning.
6202 (Target_arm::do_relax): Force stubs to be after stubbed sections
6203 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
6204 the beginning of a new relaxation pass. Update a comment.
6205 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
6207 2010-01-12 Ian Lance Taylor <iant@google.com>
6209 * target-reloc.h (visibility_error): New inline function.
6210 (relocate_section): Call visibility_error.
6211 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6212 (MOSTLYCLEANFILES): Likewise.
6213 (protected_4_pic.o, protected_3.err): New targets.
6214 * testsuite/protected_4.cc: New file.
6216 2010-01-12 Doug Kwan <dougkwan@google.com>
6218 * arm.cc (Cortex_a8_reloc): New class.
6219 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6220 and cortex_a8_relocs_info_.
6221 (Target_arm::fix_cortex_a8): New method definition.
6222 (Target_arm::Cortex_a8_relocs_info): New type.
6223 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6224 New data member declarations.
6225 (Target_arm::scan_reloc_for_stub): Record information about
6226 relocations for THUMB branches that might be exempted from the
6227 Cortex-A8 workaround.
6228 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
6229 at the beginning of a relaxation pass.
6231 2010-01-12 Doug Kwan <dougkwan@google.com>
6233 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
6234 (Arm_relobj::Mapping_symbol_position,
6235 Arm_reloj::Mapping_symbol_position_less,
6236 Arm_relobj::Mapping_symbols_info): New types.
6237 (Target_arm::is_mapping_symbol_name): New method definition.
6238 (Arm_relobj::do_count_local_symbols): Save information about mapping
6241 2010-01-11 Doug Kwan <dougkwan@google.com>
6243 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
6244 Arm_relocate_functions::thumb32_branch_upper,
6245 Arm_relocate_functions::thumb32_branch_lower,
6246 Arm_relocate_functions::thumb32_cond_branch_offset,
6247 Arm_relocate_functions::thumb32_cond_branch_upper,
6248 Arm_relocate_functions::thumb32_cond_branch_lower,
6249 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
6250 branch offset encoding.
6251 (Arm_relocate_functions::thumb_branch_common): Use new branch
6252 offset encoding methods to avoid code duplication.
6253 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
6254 (Stub_addend_reader::operator()): Use new branch encoding method
6255 to avoid code duplication.
6257 2010-01-11 Doug Kwan <dougkwan@google.com>
6259 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
6260 (Target_arm::do_finalize_sections): Define special EXIDX section
6261 symbols only if referenced.
6262 * gc.h (Garbage_collection::add_reference): New method.
6263 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
6266 2010-01-11 Ian Lance Taylor <iant@google.com>
6268 * script.cc (Version_script_info::build_expression_list_lookup):
6269 Change complaing about duplicate wildcard match from error to
6272 * script.cc (class Lazy_demangler): Recreate--revert part of patch
6274 (Version_script_info::Version_script_info): Initialize globs_,
6275 default_version_, default_is_global_, and exact_. Don't
6276 initialize globals_ or locals_.
6277 (Version_script_info::build_lookup_tables): Build local symbols
6279 (Version_script_info::unquote): New function.
6280 (Version_script_info::add_exact_match): New function.
6281 (Version_script_info::build_expression_list_lookup): Remove lookup
6282 parameter. Add is_global parameter. Change all callers. Handle
6283 wildcard pattern specially. Unquote pattern. Call
6285 (Version_script_info::get_name_to_match): New function.
6286 (Version_script_info::get_symbol_version): New function.
6287 (Version_script_info::get_symbol_version_helper): Remove.
6288 (Version_script_info::check_unmatched_names): Call unquote.
6289 * script.h (class Version_script_info): Change get_symbol_version
6290 to be non-inline and add is_global parameter; change all callers.
6291 Rewrite symbol_is_local. Update declarations. Define struct
6292 Version_tree_match, Exact, Globs. Don't define struct Lookup.
6293 Remove globals_ and locals_ members. Add exact_, globs_,
6294 default_version_, is_global_.
6295 (Version_script_info::Glob): Remove pattern, add expression and
6296 is_global. Update constructor. Change all callers.
6297 * dynobj.cc (Versions::finalize): Mark the version symbol as the
6299 (Versions::symbol_section_contents): If a symbol is undefined, or
6300 defined in a dynamic object, set the version index to
6302 * symtab.cc (Symbol_table::add_from_relobj): Don't call
6304 (Symbol_table::add_from_pluginobj): Likewise.
6305 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
6307 2010-01-11 Doug Kwan <dougkwan@google.com>
6309 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
6310 (incremental_dump_LDADD): Add linking option for libintl.
6311 * Makefile.in: Regenerate.
6313 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
6316 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
6318 * testsuite/Makefile.in: Regenerated.
6320 2010-01-10 Doug Kwan <dougkwan@google.com>
6322 * options.h (DEFINE_var): Use parentheses around argument varname__
6323 in macro body to avoid any unintended subsequent substitutions.
6325 2010-01-10 Ian Lance Taylor <iant@google.com>
6327 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
6328 candidates before doing symbol resolution.
6330 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
6331 ODR candidates if only one is weak.
6333 2010-01-08 Ian Lance Taylor <iant@google.com>
6335 * script.cc (Version_script_info::build_expression_list_lookup):
6336 Don't warn about ambiguous version, just record the ambiguity.
6337 (Version_script_info::get_symbol_version_helper): Give error if
6338 version is ambiguous.
6340 2010-01-08 Doug Kwan <dougkwan@google.com>
6342 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
6343 prev_data_size_ and prev_addralign_. Remove initializer for
6344 deleted data member has_been_changed_.
6345 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
6346 to determine if the table is empty.
6347 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
6349 (Stub_table::add_reloc_stub): Define method in class definition
6350 instead of just declaring it there.
6351 (Stub_table::add_cortex_a8_stub): New method definition.
6352 (Stub_table::update_data_size_and_addralign): Ditto.
6353 (Stub_table::finalize_stubs): Ditto.
6354 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
6355 (Stub_table::do_addralign_): Return address alignment in the
6356 (Stub_table::do_reset_address_and_file_offset): Define method in
6357 class definition instead of declaring it there. Set current data
6358 size to be the data size of the previous pass.
6359 (Stub_table::set_final_data_size): Use current data size as the
6361 (Stub_table::relocate_stub): Change parameter type of stub from
6362 Reloc_stub pointer to Stub pointer.
6363 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
6364 (Stub_table::Cortex_a8_stub_list): New typedef.
6365 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
6366 Stub_table::prev_addralign_): New data member.
6367 (Arm_relobj::Arm_relobj): Initialize data member
6368 section_has_cortex_a8_workaround_.
6369 (Arm_relobj::section_has_cortex_a8_workaround,
6370 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
6372 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
6374 (Target_arm::relocate_stub): Change parameter type of stub from
6375 Reloc_stub pointer to Stub pointer.
6376 (Insn_template::size, Insn_template::alignment): Handle
6377 THUMB16_SPECIAL_TYPE.
6378 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
6379 Stub_table::update_data_size_and_addralign,
6380 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
6382 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
6383 (Stub_table::do_write): Ditto.
6384 (Target_arm::do_relax): Adjust code for changes in Stub_table.
6386 2010-01-08 Ian Lance Taylor <iant@google.com>
6389 * symtab.h (class Symbol): Remove fields is_target_special_ and
6390 has_plt_offset_. Add field is_defined_in_discarded_section_.
6391 (Symbol::is_defined_in_discarded_section): New function.
6392 (Symbol::set_is_defined_in_discarded_section): New function.
6393 (Symbol::has_plt_offset): Rewrite.
6394 (Symbol::set_plt_offset): Verify that new offset is not -1U.
6395 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
6396 Don't initialize is_target_special_ or has_plt_offset_.
6397 Initialize is_defined_in_discarded_section_.
6398 (Symbol_table::add_from_relobj): If appropriate, set
6399 is_defined_in_discarded_section.
6400 * resolve.cc (Symbol::override_base_with_special): Don't test
6401 is_target_special_. Change has_plt_offset_ to has_plt_offset().
6402 * target-reloc.h (relocate_section): Do special handling for
6403 symbols defined in discarded sections for global symbols as well
6406 2010-01-08 Ian Lance Taylor <iant@google.com>
6408 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
6409 the SHT_SYMTAB case.
6411 2010-01-08 Ian Lance Taylor <iant@google.com>
6413 * object.cc (Sized_relobj::do_layout): Don't get confused if
6414 layout_eh_frame returns NULL.
6416 2010-01-08 Ian Lance Taylor <iant@google.com>
6419 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
6420 dynamic symbol table, use the normal symbol table.
6421 (Sized_dynobj::do_read_symbols): Remove assertion about type of
6424 2010-01-08 Ian Lance Taylor <iant@google.com>
6427 * layout.cc (Layout::include_section): Remove .gnu_debuglink
6430 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
6432 * version.cc (print_version): Change to "Copyright 2010".
6434 2010-01-08 Ian Lance Taylor <iant@google.com>
6438 * i386.cc (class Target_i386): Change return type of plt_section
6440 (class Output_data_plt_i386): Add tls_desc_rel_ field.
6441 (Output_data_plt_i386::Output_data_plt_i386): Initialize
6442 tls_desc_rel_ field.
6443 (Output_data_plt_i386::rel_tls_desc): New function.
6444 (Target_i386::rel_tls_desc_section): New function.
6445 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
6446 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
6447 R_386_TLS_DESC reloc in rel_tls_desc_section.
6448 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
6449 Define struct Tlsdesc_info.
6450 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
6451 (Target_x86_64::do_reloc_symbol_index): New function.
6452 (Target_x86_64::add_tlsdesc_info): New function.
6453 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
6454 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
6456 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
6458 (Output_data_plt_x86_64::rela_tlsdesc): New function.
6459 (Target_x86_64::rela_tlsdesc_section): New function.
6460 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
6462 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
6463 (Target_x86_64::do_reloc_addend): New function.
6464 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
6465 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
6466 declarations. Define TARGET_CODE. Add arg field to u1_ union.
6467 (Output_reloc::type): New function.
6468 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
6469 (Output_reloc::is_target_specific): New function.
6470 (Output_reloc::target_arg): New function.
6471 (class Output_reloc) [SHT_RELA]: Add four new constructors for
6472 absolute relocs and target specific relocs.
6473 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
6474 add_target_specific.
6475 (class Output_data_reloc) [SHT_RELA]: Likewise.
6476 * output.cc (Output_reloc::Output_reloc): Add four new versions
6477 for absolute relocs and target specific relocs.
6478 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
6479 (Output_reloc::get_symbol_index): Likewise.
6480 (Output_reloc::local_section_offset): Check that local_sym_index_
6481 is not TARGET_CODE or 0.
6482 (Output_reloc::symbol_value): Likewise.
6483 (Output_reloc::write) [SHT_RELA]: Call target for target specific
6485 * target.h (class Target): Add reloc_symbol_index and reloc_addend
6486 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
6488 * layout.cc (add_target_dynamic_tags): Use output section for
6489 DT_PLTRELSZ and DT_JMPREL.
6491 2010-01-07 Ian Lance Taylor <iant@google.com>
6494 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
6496 (class Output_data_reloc_generic): Define.
6497 (class Output_data_reloc_base): Change base class to
6498 Output_data_reloc_generic. Change add() method to call
6499 bump_relative_reloc_count for a relative reloc. Remove
6501 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
6503 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
6504 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
6506 * layout.h (class Layout): Update declaration.
6508 2010-01-07 Ian Lance Taylor <iant@google.com>
6510 * output.h (class Output_data): Add const version of
6511 output_section and do_output_section.
6512 (class Output_section_data): Add const version of
6514 (class Output_section): Likewise.
6515 * layout.cc (Layout::add_target_dynamic_tags): New function.
6516 * layout.h (class Layout): Update declarations.
6517 * arm.cc (Target_arm::do_finalize_sections): Use
6518 add_target_dynamic_tags.
6519 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6520 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6521 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6522 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6524 2010-01-07 Ian Lance Taylor <iant@google.com>
6527 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
6530 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
6531 Ian Lance Taylor <iant@google.com>
6534 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
6535 Xindex::read_symtab_xindex.
6537 2010-01-07 Doug Kwan <dougkwan@google.com>
6539 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
6540 (Insn_template::thumb16_bcond_insn): New method declaration.
6541 (Insn_template): Fix spelling.
6542 (Stub::thumb16_special): New method declaration.
6543 (Stub::do_write): Define virtual method which was previously pure
6545 (Stub::do_thumb16_special): New method declaration.
6546 (Stub::do_fixed_endian_write): New template member.
6547 (Reloc_stub::do_write): Remove.
6548 (Reloc_stub::do_fixed_endian_write): Remove.
6549 (Cortex_a8_stub): New class definition.
6550 (Stub_factory::make_cortex_a8_stub): New method definition.
6551 (Stub_factory::Stub_factory): Add missing static storage class
6552 qualifier for elf32_arm_stub_a8_veneer_blx.
6554 2010-01-07 Ian Lance Taylor <iant@google.com>
6557 * options.h (class General_options): Add --warn-unresolved-symbols
6558 and --error-unresolved-symbols.
6559 * errors.cc (Errors::undefined_symbol): Implement
6560 --warn-unresolved-symbols.
6562 * options.h (class General_options): Add -z text and -z textoff.
6563 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
6565 2010-01-06 Sriraman Tallam <tmsriram@google.com>
6567 * gc.h (Garbage_collection::Cident_section_map): New typedef.
6568 (Garbage_collection::cident_sections): New function.
6569 (Garbage_collection::add_cident_section): New function.
6570 (Garbage_collection::cident_sections_): New member.
6571 (gc_process_relocs): Add references to sections whose names are C
6573 * gold.h (cident_section_start_prefix): New constant.
6574 (cident_section_stop_prefix): New constant.
6575 (is_cident): New function.
6576 * layout.cc (Layout::define_section_symbols): Replace string constants
6577 with the newly defined constants.
6578 * object.cc (Sized_relobj::do_layout): Track sections whose names are
6580 * testsuite/Makefile.am: Add gc_orphan_section_test.
6581 * testsuite/Makefile.in: Regenerate.
6582 * testsuite/gc_orphan_section_test.cc: New file.
6583 * testsuite/gc_orphan_section_test.sh: New file.
6585 2010-01-06 Ian Lance Taylor <iant@google.com>
6588 * options.h (class General_options): Add --warn-shared-textrel.
6589 * layout.cc (Layout::finish_dynamic_section): Implement
6590 --warn-shared-textrel.
6593 * options.h (class General_options): Add --warn-multiple-gp.
6595 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6597 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
6598 $(THREADSLIB) and $(LIBDL).
6599 * Makefile.in: Rebuild.
6601 2010-01-06 Ian Lance Taylor <iant@google.com>
6604 * options.cc (General_options::parse_section_start): New function.
6605 (General_options::section_start): New function.
6606 (General_options::General_options): Initialize all members.
6607 * options.h: Include <map>
6608 (class General_options): Add --section-start. Add section_starts_
6610 * layout.cc (Layout::attach_allocated_section_to_segment): If
6611 --section-start was used, set the address of the segment. Remove
6612 local sort_sections.
6613 (Layout::relaxation_loop_body): If the address of the load segment
6614 has been set by --section-start, don't use it.
6615 * output.h (Output_segment::update_flags_for_output_section): New
6617 * output.cc (Output_segment::add_output_section): Call
6618 update_flags_for_output_section.
6620 2010-01-05 Ian Lance Taylor <iant@google.com>
6623 * options.h (class General_options): Add --undefined-version.
6624 * script.cc (struct Version_expression): Add was_matched_by_symbol
6626 (Version_script_info::matched_symbol): New function.
6627 (Version_script_info::get_symbol_version_helper): Call
6629 (Version_script_info::check_unmatched_names): New function.
6630 * script.h (class Version_script_info): Update declarations.
6631 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
6633 * options.h (class General_options): Use DEFINE_bool_alias for
6634 allow_multiple_definition.
6635 * resolve.cc (Symbol_table::should_override): Don't test
6636 allow_multiple_definition.
6639 * options.h (class General_options): Add --cref.
6640 * main.cc (main): Print cref table if --cref. Don't close mapfile
6641 until after printing cref table.
6642 * cref.cc: Include "symtab.h".
6643 (class Cref_inputs): Define Cref_table_compare and Cref_table.
6644 (Cref_table_compare::operator()): New function.
6645 (Cref_inputs::gather_cref): New function.
6646 (filecol): New static const.
6647 (Cref_inputs::print_cref): New function.
6648 (Cref::print_cref): New function.
6649 * cref.h: Include <cstdio>.
6650 (class Cref): Update declarations.
6651 * mapfile.h (Mapfile::file): New function.
6652 * object.h (class Object): Define Symbols. Declare virtual
6653 do_get_global_symbols.
6654 (Object::get_global_symbols): New function.
6655 * object.cc (Input_objects::add_object): Pass object to cref_ if
6657 (Input_objects::archive_start): Likewise.
6658 (Input_objects::archive_stop): Likewise.
6659 (Input_objects::print_cref): New function.
6660 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
6661 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
6663 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
6665 * plugin.h (class Sized_pluginobj): Update declarations.
6667 2010-01-05 Ian Lance Taylor <iant@google.com>
6669 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
6670 to is_default_version. Rename insdef to insdefault.
6671 (Symbol_table::add_from_relobj): Rename def to is_default_version
6672 and local to is_forced_local.
6673 (Symbol_table::add_from_pluginobj): Likewise.
6674 (Symbol_table::add_from_dynobj): Likewise.
6675 (Symbol_table::define_special_symbol): Rename insdef to
6678 2010-01-04 Ian Lance Taylor <iant@google.com>
6681 * options.h (class General_options): Add
6682 --allow-multiple-definition and -z muldefs.
6683 * resolve.cc (Symbol_table::should_override): Don't warn about a
6684 multiple symbol definition if --allow-multiple-definition or -z
6688 * options.h (class General_options): Add --add-needed and
6689 --copy-dt-needed-entries. Tweak --as-needed help entry.
6690 * object.cc (Input_objects::check_dynamic_dependencies): Give an
6691 error if --copy-dt-needed-entries aka --add-needed is used and
6692 would cause a change in behaviour.
6695 * options.h (class General_options): Add -G as a short version of
6696 --shared. Add no-op options -assert, -g, and -i.
6698 2010-01-04 Sriraman Tallam <tmsriram@google.com>
6700 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
6701 check for .text or .gnu.linkonce.t sections.
6702 * icf.cc (Icf::find_identical_sections): Ditto.
6703 Change the detection for mangled function name within the section
6705 * icf.h (is_section_foldable_candidate): New function.
6707 2009-12-30 Ian Lance Taylor <iant@google.com>
6710 * options.h (class General_options): Permit two dashes with
6711 --retain-symbols-file.
6713 2009-12-30 Ian Lance Taylor <iant@google.com>
6716 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
6717 don't put the file header and segment headers in the text
6721 * common.cc (Sort_commons::operator()): Stabilize sort when both
6723 (Symbol_table::do_allocate_commons_list): When allocating common
6724 symbols, skip a symbol which is no longer common.
6725 * symtab.h (Symbol::is_common): Test whether the symbol comes from
6726 an object before checking its type.
6727 * testsuite/common_test_2.c: New file.
6728 * testsuite/common_test_3.c: New file.
6729 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
6730 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
6731 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
6732 (common_test_2_pic.o, common_test_2.so): New targets.
6733 (common_test_3_pic.o, common_test_3.so): New targets.
6734 * testsuite/Makefile.in: Rebuild.
6737 * script.cc (read_input_script): If we see a new SECTIONS clause,
6738 and we have added an input section, give an error.
6739 * layout.h (class Layout): Add have_added_input_section function.
6740 Add have_added_input_section_ field.
6741 * layout.cc (Layout::Layout): Initialize
6742 have_added_input_section_.
6743 (Layout::layout): Set have_added_input_section_.
6744 (Layout::layout_eh_frame): Likewise.
6746 2009-12-30 Ian Lance Taylor <iant@google.com>
6749 * options.h (class General_options): Add --sort-common option.
6750 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
6751 * common.cc (Sort_common): Add sort_order parameter to
6752 constructor. Add sort_order_ field.
6753 (Sort_commons::operator): Check sort_order_.
6754 (Symbol_table::allocate_commons): Determine the sort order.
6755 (Symbol_table::do_allocate_commons): Add sort_order parameter.
6757 (Symbol_table::do_allocate_commons_list): Likewise.
6759 2009-12-30 Ian Lance Taylor <iant@google.com>
6762 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
6763 symbols from this object, don't change the visibility of an
6765 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
6767 2009-12-30 Ian Lance Taylor <iant@google.com>
6770 * script.h (class Version_script_info): Define Language enum.
6771 Update declarations. Define Glob, Exact, and Lookup types. Add
6772 new fields globals_, locals_, and is_finalized_.
6773 * script.cc: Various formatting fixes.
6774 (class Parser_closure): Change language_stack_ from a vector of
6775 std::string to one of Version_script_info::Language. Adjust all
6777 (class Lazy_demangler): Remove.
6778 (struct Version_expression): Change language from std::string to
6779 Version_script_info::Language.
6780 (Version_script_info::Version_script_info): New function.
6781 (Version_script_info::~Version_script_info): Don't call clear.
6782 (Version_script_info::finalize): New function.
6783 (Version_script_info::build_lookup_tables): New function.
6784 (Version_script_info::build_expression_list_lookup): New
6786 (Version_script_info::get_symbol_version_helper): Rewrite to use
6788 (Version_script_info::print_expression_list): Adjust to use
6789 Version_script_info::Language.
6790 (script_push_lex_into_version_mode): Check that the version script
6791 has not been finalized.
6792 (version_script_push_lang): Change language string to
6793 Version_script_info::Language.
6794 * options.cc (Command_line::version_script): New function.
6795 * options.h (class General_options): Add finalize_dynamic_list
6796 function. Change version_script from declaration to definition.
6797 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
6798 * testsuite/version_script.map: Remove duplicate def of foo.
6799 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
6801 * testsuite/Makefile.in: Rebuild.
6803 2009-12-30 Ian Lance Taylor <iant@google.com>
6806 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
6807 if the input symbol index is 0, make the output symbol index 0.
6809 2009-12-30 Ian Lance Taylor <iant@google.com>
6812 * options.h (class General_options): Add -x/--discard-all.
6813 * object.cc (Sized_relobj::do_count_local_symbols): Handle
6814 --discard-all. If the local symbol needs a dynamic entry, check
6815 that before handling --discard-locals.
6817 2009-12-30 Ian Lance Taylor <iant@google.com>
6820 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
6822 (Output_segment::add_output_section): Don't change the flags if
6826 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
6827 GNU hash table if they need a dynamic value. Otherwise, don't add
6828 them if they are defined in a dynamic object or are forced local.
6830 2009-12-29 Ian Lance Taylor <iant@google.com>
6833 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
6834 .gnu.hash table for a 32-bit target.
6837 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
6838 regular and a dynamic object only needs a dynamic symbol table
6839 entry if it is externally visible.
6842 * i386.cc (class Target_i386): Initialize global_offset_table_ in
6843 constructor. Add global_offset_table_ field.
6844 (Target_i386::got_section): Set global_offset_table_.
6845 (Target_i386::do_finalize_sections): Set global_offset_table_
6847 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
6848 in constructor. Add global_offset_table_ field.
6849 (Target_x86_64::got_section): Set global_offset_table_.
6850 (Target_x86_64::do_finalize_sections): Set global_offset_table_
6853 * layout.cc (Layout::Layout): Initialize increase_relro_.
6854 (Layout::get_output_section): Add is_relro, is_last_relro, and
6855 is_first_non_relro parameters. Change all callers.
6856 (Layout::choose_output_section): Likewise.
6857 (Layout::add_output_section_data): Likewise.
6858 (Layout::make_output_section): Likewise.
6859 (Layout::set_segment_offsets): Clear increase_relro when using a
6861 * layout.h (class Layout): Add increase_relro method. Add
6862 increase_relro_ field. Update declarations.
6863 * output.cc (Output_section::Output_section): Initialize
6864 is_last_relro_ and is_first_non_relro_.
6865 (Output_segment::add_output_section): Group relro sections is
6866 do_sort is true. Handle is_last_relro and is_first_non_relro.
6867 (Output_segment::maximum_alignment): Remove relro handling.
6868 (Output_segment::set_section_addresses): Add increase_relro
6869 parameter. Change all callers. Add initial alignment to align
6870 relro sections on separate page. Remove old relro handling.
6871 (Output_segment::set_section_list_addresses): Remove in_relro
6872 parameter. Change all callers.
6873 (Output_segment::set_offset): Add increase parameter. Change all
6874 callers. Remove old relro handling.
6875 * output.h (class Output_section): Add new methods: is_last_relro,
6876 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
6877 Add is_last_relro_ and is_first_non_relro_ fields.
6878 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
6879 Create separate .got.plt section. Call increase_relro.
6880 * x86_64.cc (Target_x86_64::got_section): Likewise.
6881 * testsuite/relro_script_test.t: Add .got.plt.
6884 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
6885 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
6886 (Layout::finalize): Call set_dynamic_symbol_size.
6887 (Layout::set_dynamic_symbol_size): New function.
6888 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
6889 set_dynamic_symbol_size.
6892 * output.h (class Output_section): Add is_entsize_zero_ field.
6893 * output.cc (Output_section::Output_section): Initialize
6895 (Output_section::set_entsize): If two different entsizes are
6896 requested, force it to zero.
6897 (Output_section::add_input_section): Set flags for .debug_str
6898 before updating section flags. Set entsize.
6899 (Output_section::update_flags_for_input_section): Set SHF_MERGE
6900 and SHF_STRING if all input sections have those flags.
6902 2009-12-29 Rafael Espindola <espindola@google.com>
6904 * main.cc (main): Fix the sys time reporting.
6905 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
6908 2009-12-29 Sriraman Tallam <tmsriram@google.com>
6910 * options.cc (General_options::parse_version): Allow -v to exit
6911 without an error if there is nothing to link.
6913 2009-12-29 Ian Lance Taylor <iant@google.com>
6915 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
6916 using a version of gcc before 4.1.
6917 * configure: Rebuild.
6919 2009-12-28 Chris Demetriou <cgd@google.com>
6921 * attributes.cc (Output_attributes_section_data::do_write): Use
6922 std::vector::front rather than std::vector::data.
6924 2009-12-28 Ian Lance Taylor <iant@google.com>
6926 * symtab.h (class Symbol_table): Add enum Defined.
6927 * resolve.cc (Symbol_table::should_override): Add defined
6928 parameter. Change all callers. Test whether object is NULL
6929 before calling a method on it.
6930 (Symbol_table::report_resolve_problem): Add defined parameter.
6932 (Symbol_table::should_override_with_special): Likewise.
6933 * symtab.cc (Symbol_table::define_in_output_data): Add defined
6934 parameter. Change all callers.
6935 (Symbol_table::do_define_in_output_data): Likewise.
6936 (Symbol_table::define_in_output_segment): Likewise.
6937 (Symbol_table::do_define_in_output_segment): Likewise.
6938 (Symbol_table::define_as_constant): Likewise.
6939 (Symbol_table::do_define_as_constant): Likewise.
6940 * script.h (class Symbol_assignment): Add is_defsym parameter to
6941 constructor; change all callers.
6942 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
6943 parameter. Change all callers. Add is_defsym_ field.
6944 (class Parser_closure): Add parsing_defsym parameter to
6945 constructor; change all callers. Add parsing_defsym accessor
6946 function. Add parsing_defsym_ field.
6948 2009-12-28 Ian Lance Taylor <iant@google.com>
6950 * gold.cc (queue_middle_tasks): Fix formatting.
6951 * object.cc (Relobj::is_section_name_included): Likewise.
6953 2009-12-23 Ian Lance Taylor <iant@google.com>
6955 * i386.cc (Target_i386::do_calls_non_split): Recognize
6956 -fsplit-stack prologue for a function with a static chain.
6957 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
6958 -fsplit-stack prologue when using %r11.
6960 2009-12-21 Sriraman Tallam <tmsriram@google.com>
6962 * options.cc (General_options::parse_version): Make -v continue and do
6963 the link like GNU ld does.
6965 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
6967 * Makefile.am (CCFILES): Add timer.cc.
6968 (HFILES): Add timer.h.
6969 * configure.ac: Check for sysconf and times.
6970 * main.cc: include timer.h.
6971 (main): Use Timer instead of get_run_time.
6974 * workqueue.cc: include timer.h.
6975 (Workqueue::find_and_run_task):
6976 Report user, sys and wall time.
6977 * Makefile.in: Regenerate.
6978 * config.in: Regenerate.
6979 * configure: Regenerate.
6981 2009-12-16 Doug Kwan <dougkwan@google.com>
6983 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
6985 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
6986 relaxed input sections.
6987 * output.cc (Output_section::find_relaxed_input_section): Change
6988 return type to Output_relaxed_input_section pointer. Adjust code
6989 for new type of relaxed_input_section_map_.
6990 * output.h (Output_section::find_relaxed_input_section): Change
6991 return type to Output_relaxed_input_section pointer.
6992 (Output_section::Output_relaxed_input_section_by_input_section_map):
6994 (Output_section::relaxed_input_section_map_): Change type to
6995 Output_section::Output_relaxed_input_section_by_input_section_map.
6996 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
6999 2009-12-15 Ian Lance Taylor <iant@google.com>
7001 * layout.cc (Layout::create_shstrtab): Only write out after input
7002 sections if we are compressing debug sections.
7004 2009-12-15 Ian Lance Taylor <iant@google.com>
7006 * archive.cc (Archive::add_symbols): Only look up a symbol without
7007 a version if there is, in fact, a version.
7009 2009-12-14 Ian Lance Taylor <iant@google.com>
7011 Revert -Wshadow changes, all changes from:
7012 2009-12-11 Doug Kwan <dougkwan@google.com>
7013 2009-12-11 Nick Clifton <nickc@redhat.com>
7014 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
7016 2009-12-11 Doug Kwan <dougkwan@google.com>
7018 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
7020 * attributes.cc (Object_attribute::size): Ditto.
7021 (Attributes_section_data::size): Ditto.
7022 (Attributes_section_data::Attributes_section_data): Ditto.
7023 (Output_attributes_section_data::do_write): Ditto.
7024 * attributes.h (Object_attribute::set_type): Ditto.
7025 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
7027 2009-12-11 Nick Clifton <nickc@redhat.com>
7029 * archive.cc: Fix shadowed variable warnings.
7031 * compressed_output.cc: Likewise.
7032 * compressed_output.h: Likewise.
7033 * configure: Likewise.
7034 * dwarf_reader.cc: Likewise.
7035 * dynobj.cc: Likewise.
7036 * dynobj.h: Likewise.
7037 * ehframe.cc: Likewise.
7038 * ehframe.h: Likewise.
7039 * errors.cc: Likewise.
7040 * expression.cc: Likewise.
7041 * fileread.cc: Likewise.
7042 * fileread.h: Likewise.
7043 * freebsd.h: Likewise.
7044 * i386.cc: Likewise.
7046 * incremental.h: Likewise.
7047 * layout.cc: Likewise.
7048 * layout.h: Likewise.
7049 * mapfile.cc: Likewise.
7050 * merge.cc: Likewise.
7051 * merge.h: Likewise.
7052 * object.cc: Likewise.
7053 * object.h: Likewise.
7054 * options.h: Likewise.
7055 * output.cc: Likewise.
7056 * output.h: Likewise.
7057 * parameters.cc: Likewise.
7058 * plugin.cc: Likewise.
7059 * powerpc.cc: Likewise.
7060 * reduced_debug_output.cc: Likewise.
7061 * reduced_debug_output.h: Likewise.
7062 * reloc.cc: Likewise.
7063 * reloc.h: Likewise.
7064 * resolve.cc: Likewise.
7065 * script-sections.cc: Likewise.
7066 * script.cc: Likewise.
7067 * script.h: Likewise.
7068 * sparc.cc: Likewise.
7069 * symtab.cc: Likewise.
7070 * symtab.h: Likewise.
7071 * target-select.cc: Likewise.
7072 * target-select.h: Likewise.
7073 * token.h: Likewise.
7074 * workqueue.cc: Likewise.
7075 * workqueue.h: Likewise.
7076 * x86_64.cc: Likewise.
7078 2009-12-10 Doug Kwan <dougkwan@google.com>
7080 * arm.cc (attributes.h): New include.
7081 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
7082 (Arm_relobj::~Arm_relobj): Delete object pointed by
7083 attributes_section_data_.
7084 (Arm_relobj::attributes_section_data): New method definition.
7085 (Arm_relobj::attributes_section_data_): New data member declaration.
7086 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
7087 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
7088 attributes_section_data_.
7089 (Arm_dynobj::attributes_section_data): New method definition.
7090 (Arm_dynobj::attributes_section_data_): New data member declaration.
7091 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
7092 initialization value of may_use_blx_ to false.
7093 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
7094 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
7095 object attributes to compute results instead of hard-coding.
7096 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
7097 Target_arm::get_secondary_compatible_arch,
7098 Target_arm::set_secondary_compatible_arch
7099 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7100 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
7101 New method declarations.
7102 (Target_arm::get_aeabi_object_attribute): New method definition.
7103 (Target_arm::attributes_section_data_): New data member declaration.
7104 (read_arm_attributes_section): New template definition.
7105 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
7106 (Arm_dynobj::do_read_symbols): Ditto.
7107 (Target_arm::do_finalize_sections): Merge attributes sections from
7108 input. Check for BLX use after attributes section merging.
7109 Fix __exidx_start and __exidx_end visibility. Create an
7110 .ARM.attributes section if necessary.
7111 (Target_arm::get_secondary_compatible_arch,
7112 Target_arm::set_secondary_compatible_arch,
7113 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7114 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
7115 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
7116 New method definitions.
7118 2009-12-09 Ian Lance Taylor <iant@google.com>
7120 * plugin.cc (Plugin::load): Don't cast from void* to a function
7123 2009-12-09 Ian Lance Taylor <iant@google.com>
7125 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
7128 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
7130 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
7131 Replace two_file_shared_1.so with two_file_shared_2.so.
7132 * testsuite/Makefile.in: Regenerated.
7134 2009-12-08 Doug Kwan <dougkwan@google.com>
7136 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
7137 (HFILES): Add attributes.h and int_encoding.h.
7138 * Makefile.in: Regenerate.
7139 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
7140 function definitions to int_encoding.cc
7141 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
7142 prototypes to int_encoding.h
7143 * reduced_debug_output.cc (int_encoding.h): New include.
7144 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
7145 function definitions to int_encoding.cc
7146 (insert_into_vector, read_from_pointer): Move template definitions to
7148 * attributes.cc: New file.
7149 * attributes.h: New file.
7150 * int_encoding.cc: New file.
7151 * int_encoding.h: New file.
7153 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
7156 * incremental-dump.cc (dump_incremental_inputs): New.
7157 (main): Use dump_incremental_inputs.
7159 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
7162 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
7163 checking elfcpp::STT_FUNC.
7164 (Target_i386::Relocate::relocate): Likewise.
7165 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
7167 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
7168 symbols from shared libraries into normal FUNC symbols.
7170 * symtab.h (Symbol): Add is_func and use it.
7172 2009-12-05 Doug Kwan <dougkwan@google.com>
7174 * arm.cc (Target_arm::arm_info): Initialize new fields
7175 attributes_section and attributes_vendor.
7176 * i386.cc (Target_i386::i386_info): Same.
7177 * object.cc (Sized_relobj::do_layout): Skip attribute section.
7178 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7179 fields attributes_section and attributes_vendor.
7180 * sparc.cc (Target_sparc::sparc_info): Same.
7181 * target.h (Target::attributes_section, Target::attributes_vendor,
7182 Target::is_attributes_section, Target::attribute_arg_type,
7183 Target::attributes_order): New method definitions.
7184 (Target::Target_info::attributes_section,
7185 Target::Target_info::attributes_vendor): New fields.
7186 (Target::do_attribute_arg_type, Target::do_attributes_order): New
7187 virtual method definitions.
7188 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7189 attributes_section and attributes_vendor.
7190 * testsuite/testfile.cc (Target_test::test_target_info): Same.
7192 2009-12-05 Doug Kwan <dougkwan@google.com>
7194 * arm.cc: Update comments about interworking and stub generation.
7195 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
7196 considered as non-PIC.
7197 (Arm_relocate_functions::base_abs): Fix formatting.
7198 (Arm_relocate_functions::got_prel): Fix comment. Change interface
7199 of function to use GOT entry address instead of offset.
7200 (Target_arm::Scan::global): Issue an error if a symbol would need a
7201 PLT does not get one because it is untyped. Remove code to create
7202 dynamic symbols for relative branches.
7203 (Target_arm::Relocate::relocate: Use 0 instead of false since function
7204 takes unsigned integer instead of boolean.
7206 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
7208 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7209 (two_file_test_LDADD): Likewise.
7210 (common_test_1_LDADD): Likewise.
7211 (exception_test_LDADD) Likewise.
7212 (weak_test_LDADD): Likewise.
7213 (many_sections_test_LDADD): Likewise.
7214 (initpri1_LDADD): Likewise.
7215 (script_test_1_LDADD): Likewise.
7216 (script_test_2_LDADD): Likewise.
7217 (justsyms_LDADD): Likewise.
7218 (binary_test_LDADD): Likewise.
7219 (large_LDADD): Likewise.
7220 * testsuite/Makefile.in: Regenerated.
7222 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
7224 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7225 (Symbol_table::override_with_special): Likewise.
7226 (Symbol_table::add_from_object): Likewise.
7228 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
7230 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7231 Don't set the data_offset twice.
7233 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
7235 * testsuite/Makefile.in: Regenerate.
7237 2009-12-03 Doug Kwan <dougkwan@google.com>
7239 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
7240 (Target_arm::do_finalize_sections): Add parameter for symbol table
7241 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
7242 * i386.cc (Target_i386::do_finalize_sections): Add an additional
7243 parameter for symbol table pointer.
7244 * layout.cc (Layout::finalize): Call Target::finalize_sections with
7245 an additional parameter for a pointer to symbol table.
7246 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
7247 parameter for a symbol table pointer.
7248 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
7249 * target.h (Target::finalize_sections, Target::do_finalize_sections):
7251 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
7252 parameter for a symbol table pointer.
7254 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
7256 * incremental.cc (Incremental_inputs_header)
7257 (Incremental_inputs_header_write, Incremental_inputs_entry)
7258 (Incremental_inputs_entry_write): Move ...
7259 * incremental.h (Incremental_inputs_header)
7260 (Incremental_inputs_header_write, Incremental_inputs_entry)
7261 (Incremental_inputs_entry_write): here.
7263 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7265 * incremental.cc (make_sized_incremental_binary): Set the target.
7266 Error if it is incompatible.
7267 * output.h (Output_file): Add filename method.
7269 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7271 * incremental.cc (Incremental_inputs_entry): Remove unused argument
7272 from the get_* methods.
7274 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7276 * incremental-dump.cc (main): Check that the offeset of a script is 0.
7277 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7278 Write 0 for the data_offset of scripts.
7280 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7282 * testsuite/Makefile.am: Add the incremental_test.sh test.
7283 * testsuite/incremental_test.sh: New.
7284 * testsuite/incremental_test_1.c: New.
7285 * testsuite/incremental_test_2.c: New.
7287 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
7289 * incremental-dump.cc (main): Fix typos.
7291 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
7294 * incremental-dump.cc (main): Use llu to print 64 bit values.
7296 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
7297 H.J. Lu <hongjiu.lu@intel.com>
7299 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
7301 (incremental_dump_LDADD): Likewise.
7302 * Makefile.in: Regenerated.
7304 2009-11-25 Doug Kwan <dougkwan@google.com>
7308 2009-11-25 Doug Kwan <dougkwan@google.com>
7310 * arm.cc (Target_arm::Target_arm): Move method definition
7311 outside of class definition. Add code to handle
7312 --target1-rel, --target1-abs and --target2= options.
7313 (Target_arm::get_reloc_reloc_type): Change method to be
7314 non-static and const.
7315 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
7316 New data member declaration.
7317 (Target_arm::Scan::local, Target_arm::Scan::global,
7318 Target_arm::Relocate::relocate,
7319 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7320 Adjust call to Target_arm::get_real_reloc_type.
7321 (Target_arm::get_real_reloc_type): Use command line options
7322 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7323 * options.h (--target1-rel, --target1-abs, --target2): New
7326 2009-11-25 Doug Kwan <dougkwan@google.com>
7328 * arm.cc (Target_arm::Target_arm): Move method definition outside of
7329 class definition. Add code to handle --target1-rel, --target1-abs
7330 and --target2= options.
7331 (Target_arm::get_reloc_reloc_type): Change method to be non-static
7333 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
7335 (Target_arm::Scan::local, Target_arm::Scan::global,
7336 Target_arm::Relocate::relocate,
7337 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
7338 call to Target_arm::get_real_reloc_type.
7339 (Target_arm::get_real_reloc_type): Use command line options to
7340 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7341 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
7344 2009-11-25 Doug Kwan <dougkwan@google.com>
7346 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
7347 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
7348 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
7350 (Arm_relocate_functions::thm_call): Replace body with a call to
7351 Arm_relocate_functions::thumb_branch_common.
7352 (Arm_relocate_functions::thm_jump24,
7353 Arm_relocate_functions::thm_xpc22): New method definitions.
7354 (Arm_relocate_functions::thumb_branch_common): New method definition.
7355 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
7357 (Target_arm::Relocate::relocate): Adjust call to thm_call.
7358 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
7360 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
7362 * Makefile.am: Build incremental-dump
7363 * Makefile.in: Regenerate.
7364 * incremental-dump.cc: New.
7365 * incremental.cc (Incremental_inputs_header_data,
7366 Incremental_inputs_entry_data): Move to incremental.h
7367 * incremental.h: (Incremental_inputs_header_data,
7368 Incremental_inputs_entry_data): Move from incremental.cc
7370 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
7372 * incremental.cc (Incremental_inputs_header,
7373 Incremental_inputs_header_write, Incremental_inputs_entry,
7374 Incremental_inputs_entry_write): Add a typedef with the data type.
7376 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
7378 * incremental.cc (Incremental_inputs_header,
7379 Incremental_inputs_header_write, Incremental_inputs_entry,
7380 Incremental_inputs_entry_write): Update comment about which
7381 type has the filed descriptions.
7383 2009-11-15 Doug Kwan <dougkwan@google.com>
7385 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
7386 (Arm_relocate_functions::arm_branch_common): Change method defintion
7387 in class definition to a method declaration and update list of formal
7389 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
7390 Arm_relocation_functions::jump24): Adjust call to
7391 Arm_relocate_functions::arm_branch_common. Update list of formal
7393 (Arm_relocate_functions::xpc25): New method definition.
7394 (Arm_relocate_functions::arm_branch_common): Move method defintion
7395 out from class definition. Use stubs for mode-switching and extending
7397 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
7398 specially. Change code to enable use of stubs in ARM branches.
7400 2009-11-10 Doug Kwan <dougkwan@google.com>
7402 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
7403 in method declaration.
7404 (Target_arm::relocate_stub): New method declaration.
7405 (Target_arm::default_target): Change to return a pointer instead of
7407 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
7408 Target_arm::default_target.
7409 (Arm_Relobj::do_relocate_sections): Remove options paramater in
7411 (Target_arm::relocate_section): Adjust view.
7412 (Target_arm::relocate_stub): New method definition.
7414 2009-11-10 Doug Kwan <dougkwan@google.com>
7416 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
7418 * incremental.cc (open_incremental_binary): Initialized local
7419 variables to avoid warnings.
7420 * object.cc (make_elf_object): Ditto.
7421 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
7424 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
7427 * testsuite/plugin_test.c: Include "config.h".
7429 2009-11-09 Doug Kwan <dougkwan@google.com>
7431 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
7432 (arm_symbol_value): Remove.
7433 (Arm_relocate_functions::arm_branch_common,
7434 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
7435 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
7436 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
7437 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
7438 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
7439 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
7440 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
7441 Arm_relocate_functions::thm_mobw_abs_nc,
7442 Arm_relocate_functions::thm_mov_abs,
7443 Arm_relocate_functions::movw_prel_nc,
7444 Arm_relocate_functions::thm_movt_abs,
7445 Arm_relocate_functions::movt_prel,
7446 Arm_relocate_functions::thm_movw_prel_nc,
7447 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
7448 (Target_arm::Relocate::relocate): Only decompose address into two
7449 parts if relocation type uses the thumb-bit and pass the actual
7450 bit instead of a flag indicating that the thumb-bit is used. Adjust
7451 calls to methods in Arm_relocate_functions for this change.
7453 2009-11-08 Ian Lance Taylor <iant@google.com>
7456 * reloc.cc: Instantiate
7457 Sized_relobj::initialize_input_to_output_maps and
7458 Sized_relobj:free_input_to_output_maps.
7460 2009-11-06 Ian Lance Taylor <iant@google.com>
7463 * defstd.cc (in_segment): Set only_if_ref true for "end".
7465 2009-11-06 Doug Kwan <dougkwan@google.com>
7467 * arm.cc (class Reloc_stub): Correct a comment.
7468 (Target_arm::Target_arm): Initialize arm_input_section_map_.
7469 (Target_arm::scan_section_for_stubs): New method declaration.
7470 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
7471 Change methods from private to protected.
7472 (Target_arm::do_may_relax): New method definition.
7473 (Target_arm::do_relax, Target_arm::group_sections,
7474 Target_arm::scan_reloc_for_stub,
7475 Target_arm::scan_reloc_section_for_stubs): New method declarations.
7476 (Target_arm::arm_input_section_map_): New data member declaration.
7477 (Target_arm::scan_reloc_for_stub,
7478 Target_arm::scan_reloc_section_for_stubs,
7479 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
7480 Target_arm::do_relax): New method definitions.
7482 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
7484 * configure.ac: Check for (struct stat)::st_mtim
7485 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
7486 * config.in: Regenerate.
7487 * configure: Regenerate.
7489 2009-11-05 Ian Lance Taylor <iant@google.com>
7492 * output.cc (Output_segment::add_output_section): Add missing
7495 2009-11-04 Ian Lance Taylor <iant@google.com>
7498 * object.h (class Object): Add is_needed and set_is_needed
7499 methods. Add is_needed_ field. Make bool fields into bitfields.
7500 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
7501 defined in a dynamic object and referenced by a regular object,
7502 set is_needed for the dynamic object.
7503 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
7504 if the file is marked with as_needed and it is not needed.
7506 2009-11-04 Ian Lance Taylor <iant@google.com>
7509 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
7510 tags if data is discarded by linker script.
7511 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7512 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7513 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7514 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7516 2009-11-04 Ian Lance Taylor <iant@google.com>
7518 * layout.cc (Layout::get_output_section): Add is_interp and
7519 is_dynamic_linker_section parameters. Change all callers.
7520 (Layout::choose_output_section): Likewise.
7521 (Layout::make_output_section): Likewise.
7522 (Layout::add_output_section_data): Add is_dynamic_linker_section
7523 parameter. Change all callers.
7524 * layout.h (class Layout): Update declarations.
7525 * output.h (class Output_section): Add is_interp, set_is_interp,
7526 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
7527 Add is_interp_, is_dynamic_linker_section_ fields. Change
7528 generate_code_fills_at_write_ to a bitfield.
7529 * output.cc (Output_section::Output_sections): Initialize new
7531 (Output_segment::add_output_section): Add do_sort parameter.
7534 2009-11-03 Ian Lance Taylor <iant@google.com>
7537 * options.h (class General_options): Add --warn-common.
7538 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
7539 merging two common symbols.
7540 (Symbol_table::should_override): Handle --warn-common when merging
7541 a common symbol with a defined symbol. Use report_resolve_problem
7542 for multiple definitions.
7543 (Symbol_table::report_resolve_problem): New function.
7544 * symtab.h (class Symbol_table): Declare report_resolve_problem.
7546 2009-11-03 Doug Kwan <dougkwan@google.com>
7548 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
7550 (Target_arm::stub_factory): New method definition.
7551 (Target_arm::new_arm_input_section,
7552 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
7553 Target_arm::reloc_uses_thumb_bit): New method declarations.
7554 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
7555 New type definitions.
7556 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
7557 member declarations.
7558 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
7559 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
7560 New method definitions.
7562 2009-11-03 Ian Lance Taylor <iant@google.com>
7564 * options.h (class General_options): Add --warn_constructors.
7566 2009-11-03 Ian Lance Taylor <iant@google.com>
7569 * defstd.cc (in_section): Add entries for __rel_iplt_start,
7570 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
7572 2009-11-03 Ian Lance Taylor <iant@google.com>
7575 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
7576 --msgid-bugs-address.
7577 (install-pdf): New target.
7578 (install-data_yes): Look up one directory to find mkinstalldirs.
7580 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
7582 * po/Make-in (.po.gmo): Don't generate .gmo files in source
7585 2009-10-30 Doug Kwan <dougkwan@google.com>
7587 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
7589 2009-10-30 Doug Kwan <dougkwan@google.com>
7591 * arm.cc (Stub_addend_reader): New struct template definition
7592 and partial specializations.
7593 (Stub_addend_reader::operator()): New method definition for a
7594 partially specialized template.
7596 2009-10-30 Doug Kwan <dougkwan@google.com>
7598 * arm.cc (Arm_relobj::processor_specific_flags): New method
7600 (Arm_relobj::do_read_symbols): New method declaration.
7601 (Arm_relobj::processor_specific_flags_): New data member declaration.
7602 (Arm_dynobj): New class definition.
7603 (Target_arm::do_finalize_sections): Add input_objects parameter.
7604 (Target_arm::do_adjust_elf_header): New method declaration.
7605 (Target_arm::are_eabi_versions_compatible,
7606 (Target_arm::merge_processor_specific_flags): New method declaration.
7607 (Target_arm::do_make_elf_object): New overloaded method definitions
7609 (Arm_relobj::do_read_symbols): New method definition.
7610 (Arm_dynobj::do_read_symbols): Ditto.
7611 (Target_arm::do_finalize_sections): Add input_objects parameters.
7612 Merge processor-specific flags from all input objects.
7613 (Target_arm::are_eabi_versions_compatible,
7614 Target_arm::merge_processor_specific_flags,
7615 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
7616 New method definitions.
7617 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
7618 Input_objects pointer type parameter.
7619 * layout.cc (Layout::finalize): Pass input objects to target's.
7620 finalize_sections function.
7621 * output.cc (Output_file_header::do_sized_write): Set ELF file
7622 header's processor-specific flags.
7623 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
7624 Input_objects pointer type parameter.
7625 * sparc.cc (Target_sparc::do_finalize_sections): Same.
7626 * target.h (Input_objects): New forward class declaration.
7627 (Target::processor_specific_flags,
7628 Target::are_processor_specific_flags_sect): New method definitions.
7629 (Target::finalize_sections): Add input_objects parameter.
7630 (Target::Target): Initialize processor_specific_flags_ and
7631 are_processor_specific_flags_set_.
7632 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
7634 (Target::set_processor_specific_flags): New method definition.
7635 (Target::processor_specific_flags_,
7636 Target::are_processor_specific_flags_set_): New data member
7638 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
7639 Input_objects pointer type parameter.
7641 2009-10-30 Doug Kwan <dougkwan@google.com>
7643 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
7645 2009-10-28 Ian Lance Taylor <iant@google.com>
7647 * object.h (class Relobj): Drop options parameter from
7648 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
7649 do_scan_relocs, do_relocate. Change all callers.
7650 (class Sized_relobj): Drop options parameters from
7651 do_gc_process_relocs, do_scan_relocs, do_relocate,
7652 do_relocate_sections, relocate_sections, emit_relocs_scan,
7653 emit_relocs_scan_reltype. Change all callers.
7654 (struct Relocate_info): Remove options field and all references to
7656 * reloc.h (class Read_relocs): Remove options constructor
7657 parameter and options_ field. Change all callers.
7658 (class Gc_process_relocs, class Scan_relocs): Likewise.
7659 (class Relocate_task): Likewise.
7660 * target-reloc.h (scan_relocs): Remove options parameter. Change
7662 (scan_relocatable_relocs): Likewise.
7663 * target.h (class Sized_target): Remove options parameter from
7664 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
7666 * gc.h (gc_process_relocs): Remove options parameter. Change all
7668 * arm.cc: Update functions to remove options parameters.
7669 * i386.cc: Likewise.
7670 * powerpc.cc: Likewise.
7671 * sparc.cc: Likewise.
7672 * x86_64.cc: Likewise.
7673 * testsuite/testfile.cc: Likewise.
7675 2009-10-28 Doug Kwan <dougkwan@google.com>
7677 * arm.cc (Arm_relobj): New class definition.
7678 (Arm_relobj::scan_sections_for_stubs,
7679 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
7680 New method definitions.
7682 2009-10-28 Cary Coutant <ccoutant@google.com>
7684 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
7685 (Plugin::cleanup_done_): New member.
7686 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
7687 (Plugin_manager::cleanup_done_): Remove.
7688 (Plugin_manager::add_input_file): Edit error message.
7689 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
7690 (Plugin_manager::cleanup): Remove use of cleanup_done_.
7692 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
7694 * fileread.cc: (File_read::View::~View): Use the new
7695 data_ownership_ filed.
7696 (File_read::~File_read): Dispose the new whole_file_view_.
7697 (File_read::open): Mmap the whole file if needed.
7698 (File_read::open): Use whole_file_view_ instead of contents_.
7699 (File_read::find_view): Use whole_file_view_ if applicable.
7700 (File_read::do_read): Use whole_file_view_ instead of contents_.
7701 (File_read::make_view): Use whole_file_view_ instead of contents_,
7702 update File_read::View::View call.
7703 (File_read::find_or_make_view): Update File_read::View::View
7705 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
7707 (File_read::View::Data_ownership): New enum.
7708 (File_read::View::View): Replace bool mapped_ with Data_ownership
7710 (File_read::View::mapped_): Remove (replaced by data_ownership_).
7711 (File_read::View::data_ownership_): New field.
7712 (File_read::contents_): Remove (replaced by whole_file_view_).
7713 (File_read::whole_file_view_): New field.
7714 * options.h (class General_options): Add --keep-files-mapped.
7716 2009-10-27 Cary Coutant <ccoutant@google.com>
7718 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
7719 * testsuite/Makefile.am (plugin_test_5): New test case.
7720 * testsuite/Makefile.in: Regenerate.
7722 2009-10-25 Doug Kwan <dougkwan@google.com>
7724 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
7725 from private to protected to allow access by child class.
7726 (Sized_relobj::do_relocate_sections): New method declaration.
7727 (Sized_relobj::relocate_sections): Virtualize.
7728 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
7729 Sized_relobj::relocate_sections. Instantiate template explicitly
7730 for different target sizes and endianity.
7732 2009-10-24 Doug Kwan <dougkwan@google.com>
7734 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
7735 (Arm_input_section::as_arm_input_section): New method.
7736 (Arm_output_section): New class definition.
7737 (Arm_output_section::create_stub_group,
7738 Arm_output_section::group_sections): New method definitions.
7740 2009-10-22 Doug Kwan <dougkwan@google.com>
7742 * arm.cc (Arm_input_section): New class definition.
7743 (Arm_input_section::init, Arm_input_section:do_write,
7744 Arm_input_section::set_final_data_size,
7745 Arm_input_section::do_reset_address_and_file_offset): New method
7748 2009-10-21 Doug Kwan <dougkwan@google.com>
7750 * arm.cc (Stub_table, Arm_input_section): New forward class
7752 (Stub_table): New class defintion.
7753 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
7754 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
7755 New method definition.
7757 2009-10-21 Doug Kwan <dougkwan@google.com>
7759 * arm.cc: Update copyright comments.
7760 (Target_arm): New forward class template declaration.
7761 (Arm_address): New type.
7762 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
7763 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
7764 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
7766 (Insn_template): Same.
7767 (DEF_STUBS): New macro.
7768 (Stub_type): New enum type.
7769 (Stub_template): New class definition.
7772 (Stub_factory): Same.
7773 (Target_arm::Target_arm): Initialize may_use_blx_ and
7774 should_force_pic_veneer_.
7775 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
7776 Target_arm::should_force_pic_veneer,
7777 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
7778 Target_arm::using_thumb_only, Target_arm:;default_target): New
7780 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
7781 New data member declarations.
7782 (Insn_template::size, Insn_template::alignment): New method defintions.
7783 (Stub_template::Stub_template): New method definition.
7784 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
7785 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
7786 (Stub_factory::Stub_factory): New method definition.
7787 * gold.h (string_hash): New template.
7788 * output.h (Input_section_specifier::hash_value): Use
7790 (Input_section_specifier::string_hash): Remove.
7791 * stringpool.cc (Stringpool_template::string_hash): Use
7794 2009-10-20 Doug Kwan <dougkwan@google.com>
7796 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
7797 symbols of relaxed input sections.
7798 * output.h (Output_section::find_relaxed_input_section): Make
7801 2009-10-16 Doug Kwan <dougkwan@google.com>
7803 * dynobj.cc (Versions::Versions): Initialize version_script_.
7804 Only insert base version symbol definition for a shared object
7805 if version script defines any version versions.
7806 (Versions::define_base_version): New method definition.
7807 (Versions::add_def): Check that base version is not needed.
7808 (Versions::add_need): Define base version lazily.
7809 * dynobj.h (Versions::define_base_version): New method declaration.
7810 (Versions::needs_base_version_): New data member declaration.
7811 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
7812 (check_DATA): Add no_version_test.stdout.
7813 (libno_version_test.so, no_version_test.o no_version_test.stdout):
7815 * testsuite/Makefile.in: Regenerate.
7816 * testsuite/no_version_test.c: New file.
7817 * testsuite/no_version_test.sh: Ditto.
7819 2009-10-16 Doug Kwan <dougkwan@google.com>
7821 * expression.cc (class Segment_start_expression): New class definition.
7822 (Segment_start_expression::value): New method definition.
7823 (script_exp_function_segment_start): Return a new
7824 Segment_start_expression.
7825 * gold/script-c.h (script_saw_segment_start_expression): New function
7827 * script-sections.cc (Script_sections::Script_sections): Initialize
7828 SAW_SEGMENT_START_EXPRESSION_ to false.
7829 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
7830 and -Tbbs options to specify section addresses if given in
7831 command line and no SEGMENT_START expression is seen in a script.
7832 * script-sections.h (Script_sections::saw_segment_start_expression,
7833 Script_sections::set_saw_segment_start_expression): New method
7835 (Script_sections::saw_segment_start_expression_): New data member
7837 * script.cc (script_saw_segment_start_expression): New function.
7838 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
7839 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
7840 script_test_7.sh and script_test_8.sh.
7841 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
7842 script_test_8.stdout.
7843 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
7844 (script_test_6, script_test_6.stdout, script_test_7,
7845 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
7846 * Makefile.in: Regenerate.
7847 * testsuite/script_test_6.sh: New file.
7848 * testsuite/script_test_6.t: Same.
7849 * testsuite/script_test_7.sh: Same.
7850 * testsuite/script_test_7.t: Same.
7851 * testsuite/script_test_8.sh: Same.
7853 2009-10-16 Doug Kwan <dougkwan@google.com>
7855 * output.cc (Output_segment::set_section_list_address): Cast
7856 expressions to unsigned long long type to avoid format warnings.
7858 2009-10-15 Ian Lance Taylor <iant@google.com>
7860 * script.cc (Script_options::add_symbol_assignment): Always add a
7861 dot assignment to script_sections_.
7862 * script-sections.cc (Script_sections::add_dot_assignment):
7863 Initialize if necessary.
7865 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
7866 program headers with no load segment if there is a linker script.
7868 * layout.cc (Layout::set_segment_offsets): Align the file offset
7869 to the segment aligment for -N or -n with no load segment.
7870 * output.cc (Output_segment::add_output_section): Don't crash if
7871 the first section is a TLS section.
7872 (Output_segment::set_section_list_addresses): Print an error
7873 message if the address moves backward in a linker script.
7874 * script-sections.cc
7875 (Output_section_element_input::set_section_addresses): Don't
7876 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
7877 (Orphan_output_section::set_section_addresses): Likewise.
7879 2009-10-15 Doug Kwan <dougkwan@google.com>
7881 * layout.cc (Layout::finish_dynamic_section): Generate tags
7882 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
7883 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
7884 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
7886 2009-10-14 Ian Lance Taylor <iant@google.com>
7888 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
7890 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
7891 data_shdr fields of relinfo.
7892 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
7893 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
7894 R_386_TLS_LDO_32, adjust based on section flags.
7895 (Target_i386::Relocate::fix_up_ldo): Remove.
7897 2009-10-13 Ian Lance Taylor <iant@google.com>
7899 Add support for -pie.
7900 * options.h (class General_options): Add -pie and
7902 (General_options::output_is_position_independent): Test -pie.
7903 (General_options::output_is_executable): Return true if not shared
7904 and not relocatable.
7905 (General_options::output_is_pie): Remove.
7906 * options.cc (General_options::finalize): Reject incompatible uses
7908 * gold.cc (queue_middle_tasks): A -pie link is not static.
7909 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
7910 * symtab.cc (Symbol::final_value_is_known): Return false if
7911 output_is_position_independent.
7912 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
7913 output_is_position_independent.
7914 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
7915 output_is_position_independent.
7916 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
7917 output_is_position_independent.
7918 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
7920 (basic_pie_test.o, basic_pie_test): New targets.
7921 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
7922 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
7923 (two_file_pie_test): New target.
7924 * testsuite/Makefile.in: Rebuild.
7925 * README: Remove note saying that -pie is not supported.
7927 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
7929 * options.h (class General_options): Add -init and -fini.
7930 * layout.cc (Layout::finish_dynamic_section): Emit
7931 given init and fini functions.
7933 2009-10-13 Sriraman Tallam <tmsriram@google.com>
7935 * gc.h (gc_process_relocs): Check if icf is enabled using new
7937 * gold.cc (queue_initial_tasks): Likewise.
7938 (queue_middle_tasks): Likewise.
7939 * object.cc (do_layout): Likewise.
7940 * symtab.cc (is_section_folded): Likewise.
7941 * main.cc (main): Likewise.
7942 * reloc.cc (Read_relocs::run): Likewise.
7943 (Sized_relobj::do_scan_relocs): Likewise.
7944 * icf.cc (is_function_ctor_or_dtor): New function.
7945 (Icf::find_identical_sections): Check if function is ctor or dtor when
7947 * options.h (General_options::icf): Change option to be an enum.
7948 (Icf_status): New enum.
7949 (icf_enabled): New method.
7950 (icf_safe_folding): New method.
7951 (set_icf_status): New method.
7952 (icf_status_): New variable.
7953 * (options.cc) (General_options::finalize): Set icf_status_.
7954 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
7955 icf_test and icf_keep_unique_test to use the --icf enum flag.
7956 * testsuite/icf_safe_test.sh: New file.
7957 * testsuite/icf_safe_test.cc: New file.
7959 2009-10-12 Sriraman Tallam <tmsriram@google.com>
7961 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
7962 includes to gc.h and icf.h.
7963 * arm.cc: Include gc.h.
7964 * gold.cc: Likewise.
7965 * i386.cc: Likewise.
7966 * powerpc.cc: Likewise.
7967 * sparc.cc: Likewise.
7968 * x86_64.cc: Likewise.
7969 * gc.h: Include icf.h.
7971 2009-10-11 Ian Lance Taylor <iant@google.com>
7973 * plugin.cc: Include "gold.h" before other header files.
7975 2009-10-10 Chris Demetriou <cgd@google.com>
7977 * options.h (Input_file_argument::Input_file_type): New enum.
7978 (Input_file_argument::is_lib_): Replace with...
7979 (Input_file_argument::type_): New member.
7980 (Input_file_argument::Input_file_argument): Take Input_file_type
7981 'type' rather than boolean 'is_lib' as second argument.
7982 (Input_file_argument::is_lib): Use type_.
7983 (Input_file_argument::is_searched_file): New function.
7984 (Input_file_argument::may_need_search): Handle is_searched_file.
7985 * options.cc (General_options::parse_library): Support -l:filename.
7986 (General_options::parse_just_symbols): Update for Input_file_argument
7988 (Command_line::process): Likewise.
7989 * archive.cc (Archive::get_file_and_offset): Likewise.
7990 * plugin.cc (Plugin_manager::release_input_file): Likewise.
7991 * script.cc (read_script_file, script_add_file): Likewise.
7992 * fileread.cc (Input_file::Input_file): Likewise.
7993 (Input_file::will_search_for): Handle is_searched_file.
7994 (Input_file::open): Likewise.
7995 * readsyms.cc (Read_symbols::get_name): Likewise.
7996 * testsuite/Makefile.am (searched_file_test): New test.
7997 * testsuite/Makefile.in: Regenerate.
7998 * testsuite/searched_file_test.cc: New file.
7999 * testsuite/searched_file_test_lib.cc: New file.
8001 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8002 Ian Lance Taylor <iant@google.com>
8004 * descriptor.cc: Include <cstdio> and "binary-io.h".
8005 (Descriptors::open): Open the files in binary mode always.
8006 * script.cc (Lex::get_token): Treat \r as whitespace.
8008 2009-10-09 Ian Lance Taylor <iant@google.com>
8010 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
8012 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8013 Ian Lance Taylor <iant@google.com>
8015 * configure.ac: Check for readv function also.
8016 * fileread.cc (readv): Define if not HAVE_READV.
8017 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
8019 * config.in: Regenerate.
8020 * configure: Regenerate.
8022 2009-10-09 Doug Kwan <dougkwan@google.com>
8024 * layout.cc (Layout::make_output_section): Call target hook to make
8025 ordinary output section.
8026 (Layout::finalize): Adjust parameter list of call the
8027 Target::may_relax().
8028 * layout.h (class Layout::section_list): New method.
8029 * merge.h (Output_merge_base::entsize): Change visibility to public.
8030 (Output_merge_base::is_string, Output_merge_base::do_is_string):
8032 (Output_merge_string::do_is_string): New method.
8033 * object.cc (Sized_relobj::do_setup): renamed from
8034 Sized_relobj::set_up.
8035 * object.h (Sized_relobj::adjust_shndx,
8036 Sized_relobj::initializ_input_to_output_maps,
8037 Sized_relobj::free_input_to_output_maps): Change visibilities to
8039 (Sized_relobj::setup): Virtualize.
8040 (Sized_relobj::do_setup): New method declaration.
8041 (Sized_relobj::invalidate_section_offset,
8042 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
8043 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
8044 * options.cc (parse_int): New function.
8045 * options.h (parse_int): New declaration.
8046 (DEFINE_int): New macro.
8047 (stub_group_size): New option.
8048 * output.cc (Output_section::Output_section): Initialize memebers
8049 merge_section_map_, merge_section_by_properties_map_,
8050 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
8051 (Output_section::add_input_section): Handled deferred code-fill
8052 generation and remove an old comment.
8053 (Output_section::add_relaxed_input_section): New method definition.
8054 (Output_section::add_merge_input_section): Use merge section by
8055 properties map to speed to search. Update merge section maps
8057 (Output_section::build_relaxation_map): New method definition.
8058 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8060 (Output_section::relax_input_section): Renamed to
8061 Output_section::convert_input_sections_to_relaxed_sections and change
8062 interface to take a vector of pointers to relaxed sections.
8063 (Output_section::find_merge_section,
8064 Output_section::find_relaxed_input_section): New method definitions.
8065 (Output_section::is_input_address_mapped,
8066 Output_section::output_offset, Output_section::output_address):
8067 Use output section data maps to speed up searching.
8068 (Output_section::find_starting_output_address): Add comments.
8069 (Output_section::do_write,
8070 Output_section::write_to_postprocessing_buffer): Do code-fill
8071 generation as appropriate.
8072 (Output_section::get_input_sections): Invalidate relaxed input section
8074 (Output_section::restore_states): Adjust type of checkpoint .
8075 Invalidate relaxed input section map.
8076 * output.h (Output_merge_base): New class declaration.
8077 (Input_section_specifier): New class defintion.
8078 (class Output_relaxed_input_section) Change base class to
8079 Output_section_data_build.
8080 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
8081 base class initializer.
8082 (Output_section::add_relaxed_input_section): New method declaration.
8083 (Output_section::Input_section): Change visibility to protected.
8084 (Output_section::Input_section::relobj,
8085 Output_section::Input_section::shndx): Handle relaxed input sections.
8086 Output_section::input_sections) Change visibility to protected. Also
8087 define overload to return a non-const pointer.
8088 (Output_section::Merge_section_properties): New class defintion.
8089 (Output_section::Merge_section_by_properties_map,
8090 Output_section::Output_section_data_by_input_section_map,
8091 Output_section::Relaxation_map): New types.
8092 (Output_section::relax_input_section): Rename method to
8093 Output_section::convert_input_sections_to_relaxed_sections and change
8094 interface to take a vector of relaxed section pointers.
8095 (Output_section::find_merge_section,
8096 Output_section::find_relaxed_input_section,
8097 Output_section::build_relaxation_map,
8098 Output_section::convert_input_sections_in_list_to_relaxed_sections):
8099 New method declarations.
8100 (Output_section::merge_section_map_
8101 Output_section::merge_section_by_properties_map_,
8102 Output_section::relaxed_input_section_map_,
8103 Output_section::is_relaxed_input_section_map_valid_,
8104 Output_section::generate_code_fills_at_write_): New data members.
8105 * script-sections.cc
8106 (Output_section_element_input::set_section_addresses): Call
8107 current_data_size and addralign methods of relaxed input sections.
8108 (Orphan_output_section::set_section_addresses): Call current_data_size
8109 and addralign methods of relaxed input sections.
8110 * symtab.cc (Symbol_table::compute_final_value): Extract template
8111 from the body of Symbol_table::sized_finalize_symbol.
8112 (Symbol_table::sized_finalized_symbol): Call
8113 Symbol_table::compute_final_value.
8114 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
8115 (Symbol_table::compute_final_value): New templated method declaration.
8116 * target.cc (Target::do_make_output_section): New method defintion.
8117 * target.h (Target::make_output_section): New method declaration.
8118 (Target::relax): Add more parameters for input objects, symbol table
8119 and layout. Adjust call to do_relax.
8120 (Target::do_make_output_section): New method declaration.
8121 (Target::do_relax): Add parameters for input objects, symbol table
8124 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8126 * pread.c: Include stdio.h.
8128 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8130 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
8133 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8135 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8136 Change read_shndx type to unsigned int.
8137 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8139 (Sized_dwarf_line_info::read_line_mappings): Likewise.
8140 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
8141 Change read_shndx type to unsigned int.
8142 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8144 (Sized_dwarf_line_info::read_line_mappings): Likewise.
8145 * layout.cc (Layout::create_symtab_sections): Cast the result of
8146 local_symcount * symsize to off_t in the gold_assert.
8148 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8150 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
8151 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
8153 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
8154 (Arm_relocate_functions::thm_abs5): New function.
8155 (Arm_relocate_functions::abs12): New function.
8156 (Arm_relocate_functions::abs16): New function.
8157 (Arm_relocate_functions::base_abs): New function.
8158 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
8159 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
8160 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
8162 (Scan::global): Likewise.
8163 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
8164 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
8165 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
8166 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
8169 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8171 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
8172 (Arm_relocate_functions::movt_prel): New function.
8173 (Arm_relocate_functions::thm_movw_prel_nc): New function.
8174 (Arm_relocate_functions::thm_movt_prel): New function.
8175 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8176 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8177 (Scan::global, Relocate::relocate): Likewise.
8178 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8180 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8182 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8183 Incremental_checker.
8184 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8186 (class Incremental_inputs_header): New class.
8187 (Incremental_inputs_header_writer): Edit comment.
8188 (Incremental_inputs_entry): New class.
8189 (Incremental_inputs_entry_writer): Edit comment.
8190 (Sized_incremental_binary::do_find_incremental_inputs_section):
8191 Add *strtab_shndx parameter, fill it.
8192 (Sized_incremental_binary::do_check_inputs): New method.
8193 (Incremental_checker::can_incrementally_link_output_file): Use
8194 Sized_incremental_binary::check_inputs.
8195 (Incremental_inputs::report_command_line): Save command line in
8198 (Incremental_binary::find_incremental_inputs_section): New
8200 (Incremental_binary::do_find_incremental_inputs_section): Add
8201 strtab_shndx parameter.
8202 (Incremental_binary::do_check_inputs): New pure virtual method.
8203 (Sized_incremental_binary::do_check_inputs): Declare.
8204 (Incremental_checker::Incremental_checker): Add incremental_inputs
8205 parameter, use it to initialize incremental_inputs_.
8206 (Incremental_checker::incremental_inputs_): New field.
8207 (Incremental_checker::command_line): New method.
8208 (Incremental_checker::inputs): New method.
8209 (Incremental_checker::command_line_): New field.
8211 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8213 * incremental.cc: Include <cstdarg> and "target-select.h".
8214 (vexplain_no_incremental): New function.
8215 (explain_no_incremental): New function.
8216 (Incremental_binary::error): New method.
8217 (Sized_incremental_binary::do_find_incremental_inputs_section): New
8219 (make_sized_incremental_binary): New function.
8220 (open_incremental_binary): New function.
8221 (can_incrementally_link_file): Add checks if output is ELF and has
8223 * incremental.h: Include "elfcpp_file.h" and "output.h".
8224 (Incremental_binary): New class.
8225 (Sized_incremental_binary): New class.
8226 (open_incremental_binary): Declare.
8227 * object.cc (is_elf_object): Use
8228 elfcpp::Elf_recognizer::is_elf_file.
8229 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
8230 * output.h (Output_file::filesize): New method.
8232 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8234 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
8236 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
8237 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
8239 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
8241 (Arm_relocate_functions::movw_abs_nc): New function.
8242 (Arm_relocate_functions::movt_abs): New function.
8243 (Arm_relocate_functions::thm_movw_abs_nc): New function.
8244 (Arm_relocate_functions::thm_movt_abs): New function.
8245 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
8246 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
8247 (Scan::global): Likewise.
8248 (Relocate::relocate): Likewise.
8249 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8251 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8253 * arm.cc (Arm_relocate_functions::got_prel) New function.
8254 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
8255 (Relocate::relocate): Likewise.
8256 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8258 2009-10-06 Ian Lance Taylor <iant@google.com>
8260 * options.h (class General_options): Define
8261 split_stack_adjust_size parameter.
8262 * object.h (class Object): Add uses_split_stack_ and
8263 has_no_split_stack_ fields. Add uses_split_stack and
8264 has_no_split_stack accessor functions. Declare
8265 handle_split_stack_section.
8266 (class Reloc_symbol_changes): Define.
8267 (class Sized_relobj): Define Function_offsets. Declare
8268 split_stack_adjust, split_stack_adjust_reltype, and
8270 * object.cc (Object::handle_split_stack_section): New function.
8271 (Sized_relobj::do_layout): Call handle_split_stack_section.
8272 * dynobj.cc (Sized_dynobj::do_layout): Call
8273 handle_split_stack_section.
8274 * reloc.cc (Sized_relobj::relocate_sections): Call
8275 split_stack_adjust for executable sections in split_stack
8276 objects. Pass reloc_map to relocate_section.
8277 (Sized_relobj::split_stack_adjust): New function.
8278 (Sized_relobj::split_stack_adjust_reltype): New function.
8279 (Sized_relobj::find_functions): New function.
8280 * target-reloc.h: Include "object.h".
8281 (relocate_section): Add reloc_symbol_changes parameter. Change
8283 * target.h (class Target): Add calls_non_split method. Declare
8284 do_calls_non_split virtual method. Declare match_view and
8286 * target.cc: Include "elfcpp.h".
8287 (Target::do_calls_non_split): New function.
8288 (Target::match_view): New function.
8289 (Target::set_view_to_nop): New function.
8290 * gold.cc (queue_middle_tasks): Give an error if mixing
8291 split-stack and non-split-stack objects with -r.
8292 * i386.cc (Target_i386::relocate_section): Add
8293 reloc_symbol_changes parameter.
8294 (Target_i386::do_calls_non_split): New function.
8295 * x86_64.cc (Target_x86_64::relocate_section): Add
8296 reloc_symbol_changes parameter.
8297 (Target_x86_64::do_calls_non_split): New function.
8298 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
8300 * powerpc.cc (Target_powerpc::relocate_section): Add
8301 reloc_symbol_changes parameter.
8302 * sparc.cc (Target_sparc::relocate_section): Add
8303 reloc_symbol_changes parameter.
8304 * configure.ac: Call AM_CONDITIONAL for the default target.
8305 * configure: Rebuild.
8306 * testsuite/Makefile.am (TEST_AS): New variable.
8307 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
8308 (check_DATA): Add split_i386 and split_x86_64 files.
8309 (SPLIT_DEFSYMS): Define.
8310 (split_i386_[1234n].o): New targets.
8311 (split_i386_[124]): New targets.
8312 (split_i386_[1234r].stdout): New targets.
8313 (split_x86_64_[1234n].o): New targets.
8314 (split_x86_64_[124]): New targets.
8315 (split_x86_64_[1234r].stdout): New targets.
8316 (MOSTLYCLEANFILES): Add new executables.
8317 * testsuite/split_i386.sh: New file.
8318 * testsuite/split_x86_64.sh: New file.
8319 * testsuite/split_i386_1.s: New file.
8320 * testsuite/split_i386_2.s: New file.
8321 * testsuite/split_i386_3.s: New file.
8322 * testsuite/split_i386_4.s: New file.
8323 * testsuite/split_i386_n.s: New file.
8324 * testsuite/split_x86_64_1.s: New file.
8325 * testsuite/split_x86_64_2.s: New file.
8326 * testsuite/split_x86_64_3.s: New file.
8327 * testsuite/split_x86_64_4.s: New file.
8328 * testsuite/split_x86_64_n.s: New file.
8329 * testsuite/testfile.cc (Target_test): Update relocation_section
8331 * testsuite/Makefile.in: Rebuild.
8333 2009-10-06 Ian Lance Taylor <iant@google.com>
8335 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
8336 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
8337 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
8338 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
8339 the address on ldo_addrs_.
8340 (Target_i386::Relocate::fix_up_ldo): New function.
8342 2009-10-06 Rafael Espindola <espindola@google.com>
8344 * plugin.cc (add_input_library): New.
8345 (Plugin::load): Add add_input_library to tv.
8346 (Plugin_manager::add_input_file): Add the is_lib argument.
8347 (add_input_file): Update call to Plugin_manager::add_input_file.
8348 (add_input_library): New.
8349 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
8351 2009-09-30 Doug Kwan <dougkwan@google.com>
8353 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
8354 symbol and call Symbol::may_need_copy_reloc to determine if
8355 a copy reloc is needed.
8356 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
8357 nocopyreloc is given in command line.
8358 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
8359 given in command line.
8360 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
8361 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
8362 of the removed Target_i386::may_need_copy_reloc.
8363 * options.h (copyreloc): New option with default value false.
8364 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8365 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
8366 instead of the removed Target_powerpc::may_need_copy_reloc.
8367 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8368 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
8369 instead of the removed Target_sparc::may_need_copy_reloc.
8370 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
8371 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
8372 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
8373 instead of the removed Target_x86_64::may_need_copy_reloc.
8375 2009-09-30 Ian Lance Taylor <iant@google.com>
8377 * object.h (class Object): Remove target_ field, and target,
8378 sized_target, and set_target methods.
8379 (Object::sized_target): Remove.
8380 (class Sized_relobj): Update declarations. Remove sized_target.
8381 * object.cc (Sized_relobj::setup): Remove target parameter.
8383 (Input_objects::add_object): Don't do anything with the target.
8384 (make_elf_sized_object): Add punconfigured parameter. Change all
8385 callers. Set or test parameter target.
8386 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
8388 * parameters.cc (Parameters::set_target): Change parameter type to
8390 (Parameters::default_target): Remove.
8391 (set_parameters_target): Change parameter type to be non-const.
8392 (parameters_force_valid_target): New function.
8393 (parameters_clear_target): New function.
8394 * parameters.h (class Parameters): Update declarations. Remove
8395 default_target method. Add sized_target and clear_target
8396 methods. Change target_ to be non-const.
8397 (set_parameters_target): Update declaration.
8398 (parameters_force_valid_target): Declare.
8399 (parameters_clear_target): Declare.
8400 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
8401 as NULL if we aren't searching.
8402 (Add_symbols::run): Don't check for compatible target.
8403 * fileread.cc (Input_file::open_binary): Call
8404 parameters_force_valid_target.
8405 * gold.cc (queue_middle_tasks): Likewise.
8406 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
8407 set_target on object.
8408 * dynobj.h (class Sized_dynobj): Update declarations.
8409 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
8410 make_elf_object returns NULL.
8411 (Archive::include_member): Don't check whether object target is
8413 * output.cc (Output_section::add_input_section): Get target from
8415 (Output_section::relax_input_section): Likewise.
8416 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
8418 (Sized_relobj::do_scan_relocs): Likewise.
8419 (Sized_relobj::relocate_sections): Likewise.
8420 * resolve.cc (Symbol_table::resolve): Likewise.
8421 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
8422 parameter. Change all callers.
8423 (Symbol_table::add_from_object): Get target from parameters.
8424 (Symbol_table::add_from_relobj): Don't check object target.
8425 (Symbol_table::add_from_dynobj): Likewise.
8426 (Symbol_table::define_special_symbol): Get target from
8428 * symtab.h (class Symbol_table): Update declaration.
8429 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
8430 parameter. Change all callers. Clear parameter target.
8431 (Binary_test): Test target here.
8432 * testsuite/object_unittest.cc (gold_testsuite): Remove
8433 target_test_pointer parameter. Change all callers.
8434 (Object_test): Test target here.
8436 2009-09-26 Ian Lance Taylor <iant@google.com>
8438 * testsuite/initpri1.c: Don't try to use constructor priorities if
8439 compiling with gcc before 4.3.
8441 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
8443 * testsuite/retain_symbols_file_test.sh (check_present): Change
8444 output file name to retain_symbols_file_test.stdout.
8445 (check_absent): Likewise.
8447 2009-09-18 Craig Silverstein <csilvers@google.com>
8449 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
8450 * options.cc: Include <cerrno> and <fstream>.
8451 (General_options::finalize): Parse -retain-symbols-file tag.
8452 * options.h: New flag.
8453 (General_options): New method should_retain_symbol, new
8454 variable symbols_to_retain.
8455 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
8456 should_retain_symbol map.
8457 * testsuite/Makefile.am (retain_symbols_file_test): New test.
8458 * testsuite/Makefile.in: Regenerate.
8459 * testsuite/retain_symbols_file_test.sh: New file.
8461 2009-09-18 Nick Clifton <nickc@redhat.com>
8463 * po/es.po: Updated Spanish translation.
8465 2009-09-17 Doug Kwan <dougkwan@google.com>
8467 * debug.h (DEBUG_RELAXATION): New constant.
8468 (DEBUG_ALL): Add DEBUG_RELAXATION.
8469 (debug_string_to_enum): Add relaxation debug option.
8471 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
8472 Layout::Relaxation_debug_check::read_sections,
8473 Layout::Relaxation_debug_check::read_sections): New method definitions.
8474 (Layout::Layout): Initialize data members
8475 record_output_section_data_from_scrips_,
8476 script_output_section_data_list_ and relaxation_debug_check_.
8477 (Layout::save_segments, Layout::restore_segments,
8478 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8479 Layout::relaxation_loop_body): New method definitions.
8480 (Layout::finalize): Support relaxation. Move section layout code to
8481 Layout::relaxation_loop_body.
8482 (Layout::set_asection_address_from_script): Move code for orphan
8483 section placement out.
8484 (Layout::place_orphan_sections_in_script): New method definition.
8485 * layout.h (Output_segment_headers, Output_file_header):
8486 New forward class declarations.
8487 (Layout::~Layout): Define.
8488 (Layout::new_output_section_data_from_script): New method definition.
8489 (Layout::place_orphan_sections_in_script): New method declaration.
8490 (Layout::Segment_states): New type declaration.
8491 (Layout::save_segments, Layout::restore_segments,
8492 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8493 Layout::relaxation_loop_body): New method declarations.
8494 (Layout::Output_section_data_list): New type declaration.
8495 (Layout::Relaxation_debug_check): New class definition.
8496 (Layout::record_output_section_data_from_script_,
8497 Layout::script_output_section_data_list_, Layout::segment_states_,
8498 Layout::relaxation_debug_check_): New data members.
8499 * output.cc: (Output_section_headers::do_size): New method definition.
8500 (Output_section_headers::Output_section_headers): Move size
8501 computation to Output_section_headers::do_size.
8502 (Output_segment_headers::do_size): New method definition.
8503 (Output_file_header::Output_file_header): Move size computation to
8504 Output_file_header::do_size and call it.
8505 (Output_file_header::do_size): New method definition.
8506 (Output_data_group::Output_data_group): Adjust call to
8507 Output_section_data.
8508 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
8509 (Output_symtab_xindex::do_write): Add array bound check.
8510 (Output_section::Input_section::print_to_mapfile): Handle
8511 RELAXED_INPUT_SECTION_CODE.
8512 (Output_section::Output_section): Initialize data member checkpoint_.
8513 (Output_section::~Output_section): Delete checkpoint object pointed
8515 (Output_section::add_input_section): Always add an Input_section if
8517 (Output_section::add_merge_input_section): Add assert.
8518 (Output_section::relax_input_section): New method definition.
8519 (Output_section::set_final_data_size): Set load address to zero for
8520 an unallocated section.
8521 (Output_section::do_address_and_file_offset_have_reset_values):
8522 New method definition.
8523 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
8524 Handle relaxed input section.
8525 (Output_section::sort_attached_input_sections): Checkpoint input
8526 section list lazily.
8527 (Output_section::get_input_sections): Change type of input_sections to
8528 list of Simple_input_section pointers. Checkpoint input section list
8529 lazily. Also handle relaxed input sections.
8530 (Output_section::add_input_section_for_script): Take a reference to
8531 a Simple_input_section object instead of Relobj pointer and section
8532 index as parameter. Handle relaxed input sections.
8533 (Output_section::save_states, Output_section::restore_states): New
8535 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
8536 (Output_data::is_data_size_fixed): New method definition.
8537 (Output_data::reset_addresss_and_file_offset): Do not reset data size
8539 (Output_data::address_and_file_offset_have_reset_values): New method
8541 (Output_data::do_address_and_file_offset_have_reset_values): New method
8543 (Output_data::set_data_size): Check that data size is not fixed.
8544 (Output_data::fix_data_size): New method definition.
8545 (Output_data::is_data_size_fixed_): New data member.
8546 (Output_section_headers::set_final_data_size): New method definition.
8547 (Output_section_headers::do_size): New method declaration.
8548 (Output_segment_headers::set_final_data_size): New method definition.
8549 (Output_segment_headers::do_size): New method declaration.
8550 (Output_file_header::set_final_data_size)::New method definition.
8551 (Output_file_header::do_size)::New method declaration.
8552 (Output_section_data::Output_section_data): Add new parameter
8553 is_data_size_fixed and use it to fix data size.
8554 (Output_data_const::Output_data_const): Adjust call to base class
8555 constructor and fix data size.
8556 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
8557 base class constructor and fix data size.
8558 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
8559 base class constructor and fix data size.
8560 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
8561 class constructor and fix data size.
8562 (Output_data_group::set_final_data_size): New method definition.
8563 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
8564 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
8565 class constructor and fix data size.
8566 (Output_relaxed_input_section): New class definition.
8567 (Output_section::Simple_input_section): New class definition.
8568 (Output_section::get_input_sections): Adjust parameter list.
8569 (Output_section::add_input_section_for_script): Same.
8570 (Output_section::save_states, Output_section::restore_states,
8571 Output_section::do_address_and_file_offset_have_reset_values,
8572 (Output_section::Input_section::Input_section): Handle
8573 RELAXED_INPUT_SECTION_CODE. Add new overload for
8574 Output_relaxed_input_section.
8575 (Output_section::Input_section::is_input_section,
8576 Output_section::Input_section::set_output_section): Handle relaxed
8578 (Output_section::Input_section::is_relaxed_input_section,
8579 Output_section::Input_section::output_section_data,
8580 Output_section::Input_section::relaxed_input_section): New method
8582 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
8584 (Output_section::Input_section::u1_): Update comments.
8585 (Output_section::Input_section::u2_): Add new union member poris.
8586 (Output_section::Checkpoint_output_section): New classs definition.
8587 (Output_section::relax_input_section): New method declaration.
8588 (Output_section::checkpoint_): New data member.
8589 (Output_segment): Update comments.
8590 (Output_segment::Output_segment): Un-privatize copy constructor.
8591 (Output_segment::operator=): Un-privatize.
8592 * script-sections.cc (Output_section_element::Input_section_list):
8593 Change element type to Output_section::Simple_input_section.
8594 (Output_section_element_dot_assignment::set_section_addresses):
8595 Register output section data for relaxation clean up.
8596 (Output_data_exression::Output_data_expression): Adjust call to base
8597 constructor to fix data size.
8598 (Output_section_element_data::set_section_addresses): Register
8599 Output_data_expression object for relaxation clean up.
8600 (struct Input_section_info): Replace Relobj pointer and section index
8601 pair with Output_section::Simple_input_section and Convert struct to a
8603 (Input_section_sorter::operator()): Adjust access to
8604 Input_section_info data member to use accessors.
8605 (Output_section_element_input::set_section_addresses): Use layout
8606 parameter. Adjust code to use Output_section::Simple_input_section
8607 and Input_secction_info classes. Register filler for relaxation
8609 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
8610 and section index pair with Output_section::Simple_input_section
8611 class. Adjust code accordingly.
8612 (Phdrs_element::release_segment): New method definition.
8613 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
8615 (Script_sections::release_segments): New method definition.
8616 * gold/script-sections.h (Script_sections::release_segments): New
8618 * gold/target.h (Target::may_relax, Target::relax,
8619 Target::do_may_relax, Target::do_relax): New method definitions.
8621 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8623 * arm.cc (has_signed_unsigned_overflow): New function.
8624 (Arm_relocate_functions::abs8): New function.
8625 (Target_arm::Scan::local): Handle R_ARM_ABS8.
8626 (Target_arm::Scan::global): Likewise.
8627 (Target_arm::relocate::relocate): Likewise.
8628 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8631 2009-09-16 Cary Coutant <ccoutant@google.com>
8633 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
8634 * testsuite/Makefile.in: Regenerate.
8636 2009-09-11 Nick Clifton <nickc@redhat.com>
8638 * po/gold.pot: Updated by the Translation project.
8640 2009-09-08 Cary Coutant <ccoutant@google.com>
8642 * output.cc (Output_file::open): Add execute permission to empty file.
8643 * testsuite/Makefile.am (permission_test): New test.
8644 * testsuite/Makefile.in: Regenerate.
8646 2009-09-02 Ian Lance Taylor <iant@google.com>
8648 * output.cc (Output_file::resize): Call map_no_anonymous rather
8651 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
8653 * gold.cc: Include "incremental.h".
8654 (queue_initial_tasks): Call Incremental_checker methods.
8655 * incremental.cc: Include "output.h".
8656 (Incremental_checker::can_incrementally_link_output_file): New
8658 * incremental.h (Incremental_checker): New class.
8660 * output.cc (Output_file::open_for_modification): New method.
8661 (Output_file::map_anonymous): Changed return type to bool. Record
8663 (Output_file::map_no_anonymous): New method, broken out of map.
8664 (Output_file::map): Use map_no_anonymous and map_anonymous.
8665 * output.h (class Output_file): Update declarations.
8667 2009-08-24 Cary Coutant <ccoutant@google.com>
8669 * options.h (Command_line::Pre_options): New class.
8670 (Command_line::pre_options): New member.
8671 * options.cc (gold::options::ready_to_register): New variable.
8672 (One_option::register_option): Do nothing if not registering options.
8673 Assert if same short option registered twice.
8674 (General_options::General_options): Turn off option registration when
8676 (Command_line::Pre_options::Pre_options): New constructor.
8678 2009-08-24 Cary Coutant <ccoutant@google.com>
8680 * options.h (General_options::no_keep_memory): Remove incorrect
8683 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8685 * Makefile.am (am__skiplex, am__skipyacc): New.
8686 * Makefile.in: Regenerate.
8688 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8690 * Makefile.am (AM_CPPFLAGS): Renamed from ...
8691 (INCLUDES): ... this.
8692 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
8693 (AM_CPPFLAGS): Renamed from ...
8694 (INCLUDE): ... this.
8695 * Makefile.in, testsuite/Makefile.in: Regenerate.
8697 * Makefile.in: Regenerate.
8698 * aclocal.m4: Likewise.
8699 * config.in: Likewise.
8700 * configure: Likewise.
8701 * testsuite/Makefile.in: Likewise.
8703 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8704 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8705 * Makefile.in: Regenerate.
8706 * testsuite/Makefile.in: Regenerate.
8708 2009-08-19 Cary Coutant <ccoutant@google.com>
8710 * resolve.cc (Symbol_table::resolve): Don't complain about defined
8711 symbols in shared libraries overridden by hidden or internal symbols
8712 in the main program.
8714 2009-08-19 Chris Demetriou <cgd@google.com>
8716 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
8717 checking source file names in error messages.
8719 2009-08-18 Doug Kwan <dougkwan@google.com>
8721 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
8722 an elcpp::Ehdr as parameter. Adjust call to set_target.
8723 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
8724 an elfcpp::Ehdr as parameter.
8725 * object.cc (Object::set_target): Remove the version that looks up
8726 a target and sets it.
8727 (Sized_relobj::setup): Take a Target object instead of
8728 an elfcpp::Ehdr as parameter. Adjust call to set_target.
8729 (make_elf_sized_object): Find target and ask target to
8731 * object.h: (Object::set_target): Remove the version that looks up
8732 a target and sets it.
8733 (Sized_relobj::setup): Take a Target object instead of
8734 an elfcpp:Ehdr as parameter.
8735 * target.cc: Include dynobj.h.
8736 (Target::do_make_elf_object_implementation): New.
8737 (Target::do_make_elf_object): New.
8738 * target.h (Target::make_elf_object): New template declaration.
8739 (Target::do_make_elf_object): New method declarations.
8740 (Target::do_make_elf_object_implementation): New template declaration.
8742 2009-08-14 Ian Lance Taylor <iant@google.com>
8744 * gold.h (FUNCTION_NAME): Define.
8745 (gold_unreachable): Use FUNCTION_NAME.
8747 2009-08-12 Sriraman Tallam <tmsriram@google.com>
8749 * icf.cc (Icf::find_identical_sections): Issue a warning when a
8750 symbol in the --keep-unique list is not found.
8752 2009-08-12 Sriraman Tallam <tmsriram@google.com>
8754 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
8755 been maked as --keep-unique.
8756 (Icf::unfold_section): New function.
8757 * icf.h (Icf::unfold_section): New function.
8758 * options.h (General_options::keep_unique): New option.
8759 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
8760 * testsuite/Makefile.in: Regenerate.
8761 * testsuite/icf_keep_unique_test.sh: New file.
8762 * testsuite/icf_keep_unique_test.cc: New file.
8764 2009-08-12 Cary Coutant <ccoutant@google.com>
8767 * resolve.cc (Symbol_table::resolve): Check for references from
8768 dynamic objects to hidden and internal symbols.
8769 * testsuite/Makefile.am (hidden_test.sh): New test.
8770 * testsuite/Makefile.in: Regenerate.
8771 * testsuite/hidden_test.sh: New script.
8772 * testsuite/hidden_test_1.c: New test source.
8773 * testsuite/hidden_test_main.c: New test source.
8775 2009-08-11 Doug Kwan <dougkwan@google.com>
8777 * arm.cc: Update comments.
8778 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
8779 segment to locate the .ARM.exidx section if present.
8781 2009-08-09 Doug Kwan <dougkwan@google.com>
8783 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
8786 2009-08-07 Sriraman Tallam <tmsriram@google.com>
8787 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
8790 2009-08-06 Sriraman Tallam <tmsriram@google.com>
8792 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
8793 valid tls_segment only for non-debug-section relocations.
8794 * testsuite/Makefile.am: Add gc_tls_test.
8795 * testsuite/Makefile.in: Regenerate.
8796 * testsuite/gc_tls_test.cc: New file.
8797 * testsuite/gc_tls_test.sh: New file.
8799 2009-08-05 Sriraman Tallam <tmsriram@google.com>
8803 * Makefile.am (CCFILES): Add icf.cc.
8805 * Makefile.in: Regenerate.
8806 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
8807 * gc.h (gc_process_relocs): Populate lists used by icf to contain
8808 section, symbol and addend information for the relocs.
8809 * gold.cc (queue_middle_tasks): Call identical code folding.
8810 * gold.h: Add defines for multimap.
8811 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
8812 to the call of finalize_local_symbols.
8813 * main.cc (main): Create object of class Icf.
8814 * object.cc (Sized_relobj::do_layout): Allow this function to be
8815 called twice during icf.
8816 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
8817 to sections marked as identical by icf.
8818 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
8820 (Sized_relobj::do_section_entsize): New function.
8821 * object.h (Object::section_entsize): New function.
8822 (Object::do_section_entsize): New pure virtual function.
8823 (Relobj::finalize_local_symbols): Add new parameter.
8824 (Relobj::do_section_entsize): New function.
8825 * options.h (General_options::icf): New option.
8826 (General_options::icf_iterations): New option.
8827 (General_options::print_icf_sections): New option.
8828 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
8829 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
8830 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
8832 * symtab.cc (Symbol_table::is_section_folded): New function.
8833 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
8834 to sections marked as identical by icf.
8835 * symtab.h (Symbol_table::set_icf): New function.
8836 (Symbol_table::icf): New function.
8837 (Symbol_table::is_section_folded): New function.
8838 (Symbol_table::icf_): New data member.
8839 * target-reloc.h (relocate_section): Ignore sections folded by icf.
8840 * testsuite/Makefile.am: Add commands to build icf_test.
8841 * testsuite/Makefile.in: Regenerate.
8842 * testsuite/icf_test.sh: New file.
8843 * testsuite/icf_test.cc: New file.
8845 2009-07-24 Chris Demetriou <cgd@google.com>
8847 * layout.cc (is_compressible_debug_section): Fix incorrect
8848 comment about compressed section names.
8850 2009-07-20 Ian Lance Taylor <ian@airs.com>
8853 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
8855 2009-07-16 Ian Lance Taylor <iant@google.com>
8858 * layout.h: #include <map>.
8859 (class Kept_section): Change from struct to class. Add accessors
8860 and setters. Add section size to Comdat_group mapping. Change
8861 Comdat_group to std::map. Add is_comdat_ field. Add
8862 linkonce_size field in union.
8863 (class Layout): Update declaration of find_or_add_kept_section.
8864 Don't declare find_kept_object.
8865 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
8866 parameter. Add object, shndx, is_comdat, and is_group_name
8867 parameters. Change all callers. Adjust for new Kept_section.
8868 (Layout::find_kept_object): Remove.
8869 * object.cc (Sized_relobj::include_section_group): Update use of
8870 Kept_section. Rename secnum to shndx. Only record
8871 Kept_comdat_section if sections are the same size.
8872 (Sized_relobj::include_linkonce_section): Update use of
8873 Kept_section. Only record Kept_comdat_section if sections are the
8874 same size. Set size of linkonce section.
8875 (Sized_relobj::map_to_kept_section): Update call to
8876 get_kept_comdat_section.
8877 * object.h (class Sized_relobj): Rename fields in
8878 Kept_comdat_section to drop trailing underscores; change object
8879 field to Relobj*. Change Kept_comdat_section_table to store
8880 struct rather than pointer.
8881 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
8882 Add kept_object and kept_shndx parameters. Change all callers.
8883 (Sized_relobj::get_kept_comdat_section): Change return type to
8884 bool. Add kept_object and kept_shndx parameters. Change all
8886 * plugin.cc (Pluginobj::include_comdat_group): Update call to
8887 Layout::find_or_add_kept_section.
8889 2009-07-09 Ian Lance Taylor <iant@google.com>
8891 * merge.cc (Object_merge_map::initialize_input_to_output_map):
8892 Reserve space in the hash table.
8894 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
8896 * fileread.cc (File_read::get_mtime): New method.
8897 * fileread.h (Timespec): New structure.
8898 (File_read::get_mtime): New method.
8899 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
8900 Renamed from timestamp_nsec.
8901 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
8903 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
8905 (Incremental_inputs::report_archive): Save mtime; style fix.
8906 (Incremental_inputs::report_obejct): Save mtime; style fix.
8907 (Incremental_inputs::report_script): Save mtime; style fix.
8908 (Incremental_inputs::finalize_inputs): Style fix.
8909 (Incremental_inputs::finalize): Style fix.
8910 (Incremental_inputs::create_input_section_data): Store inputs
8912 * incremental.h (Incremental_inputs::report_script): Add mtime
8914 (Incremental_inputs::Input_info::Input_info): Intialize only one
8916 (Incremental_inputs::Input_info::archive): Move to nameless
8918 (Incremental_inputs::Input_info::obejct): Move to nameless union.
8919 (Incremental_inputs::Input_info::script): Move to nameless union.
8920 (Incremental_inputs::mtime): New field.
8921 * script.cc (read_input_script): Pass file mtime to
8923 * script.h (Script_info::inputs): Style fix.
8925 2009-07-01 Ian Lance Taylor <ian@airs.com>
8927 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
8930 2009-06-24 Ian Lance Taylor <iant@google.com>
8933 * layout.cc (Layout::choose_output_section): If we find an
8934 existing section, update the flags.
8935 (Layout::create_notes): New function, broken out of
8937 (Layout::finalize): Don't create note sections.
8938 (Layout::create_note): Don't crash if linker script discards
8940 (Layout::create_gold_note): Likewise.
8941 (Layout::create_build_id): Likewise. Don't set
8942 after_input_sections on the section.
8943 (Layout::create_executable_stack_info): Remove target parameter.
8945 * layout.h (class Layout): Declare create_notes. Update
8946 declaration of create_executable_stack_info.
8947 * gold.cc (queue_middle_tasks): Call create_notes.
8948 * output.cc (Output_section::update_flags_for_input_section): Move
8949 here from output.h. If SHF_ALLOC flag is newly set, mark address
8951 * output.h (Output_data::mark_address_invalid): New function.
8952 (class Output_section): Only declare, not define,
8953 update_flags_for_input_section. Remove set_flags.
8955 2009-06-24 Ian Lance Taylor <iant@google.com>
8957 * script-sections.cc (Output_section_definition::
8958 set_section_addresses): Rename shadowing local load_address to
8961 2009-06-24 Ian Lance Taylor <iant@google.com>
8964 * reloc.cc (relocate_sections): Skip empty relocation sections.
8966 2009-06-23 Ian Lance Taylor <iant@google.com>
8969 * layout.cc (Layout::create_note): Use choose_output_section
8970 rather than make_output_section.
8972 2009-06-23 Ian Lance Taylor <iant@google.com>
8975 * options.cc (General_options::parse_V): Set printed_version_.
8976 (General_options::General_options): Initialize printed_version_.
8977 * options.h (class General_options): Add printed_version_ field.
8978 * gold.cc (queue_initial_tasks): If there are no input files,
8979 don't give a fatal error if we printed the version information.
8980 (queue_middle_tasks): If using -r with a shared object, give a
8981 fatal error rather than an ordinary error.
8983 2009-06-23 Ian Lance Taylor <iant@google.com>
8986 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
8987 (Layout::make_output_section): Set have_stabstr_section_ if we see
8988 a .stab*str section.
8989 (Layout::finalize): Call link_stabs_sections.
8990 (Layout::link_stabs_sections): New file.
8991 * layout.h (class Layout): Add have_stabstr_section_ field.
8992 Declare link_stabs_sections.
8994 2009-06-23 Doug Kwan <dougkwan@google.com>
8996 * Makefile.am (libgold_a_LIBADD): New.
8997 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
8998 * Makefile.in: Regenerate.
8999 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
9000 * configure: Regenerate.
9001 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
9002 * fileread.cc: Include sys/state.h
9003 * gold.h: Declare memmem and strndup if found missing.
9004 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
9006 2009-06-23 Ian Lance Taylor <iant@google.com>
9008 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
9009 * configure: Rebuild.
9011 2009-06-23 Ian Lance Taylor <iant@google.com>
9014 * object.cc (Object::section_contents): Don't try to get a view if
9015 the section has length zero.
9016 (Object::handle_gnu_warning_section): If the section is empty, use
9017 the name of the section as the warning.
9019 2009-06-23 Ian Lance Taylor <iant@google.com>
9022 * stringpool.h (class Stringpool_template): Add optimize_ field.
9023 (Stringpool_template::set_optimize): New function.
9024 * stringpool.cc (Stringpool_template::Stringpool_template):
9025 Initialize optimize_ field.
9026 (Stringpool_template::set_string_offsets): Test local optimize
9027 fild rather than parameter.
9028 * layout.cc (Layout::Layout): Call set_optimize on the section
9031 2009-06-22 Ian Lance Taylor <iant@google.com>
9034 * yyscript.y: Parse TARGET.
9035 * script.cc (script_set_target): New function.
9036 * script-c.h (script_set_target): Declare.
9037 * options.cc (General_options::string_to_object_format): Rename
9038 from string_to_object_format in anonymous namespace. Change
9040 * options.h (class General_options): Declare
9041 string_to_object_format.
9043 2009-06-22 Ian Lance Taylor <iant@google.com>
9045 * script-sections.cc (Script_sections::create_segments): Don't put
9046 program headers in a PT_LOAD segment if -n or -N.
9048 2009-06-22 Ian Lance Taylor <iant@google.com>
9051 * options.h (class General_options): Add -z lazy and -z now. Sort
9052 -z options into alphabetical order.
9053 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
9055 2009-06-21 Ian Lance Taylor <iant@google.com>
9057 * layout.cc (Layout::make_output_section): Call
9058 Target::new_output_section.
9059 (Layout::attach_allocated_section_to_segment): Put large section
9060 sections in a separate load segment with the large segment flag
9062 (Layout::segment_precedes): Sort large data segments after other
9064 (align_file_offset): New static function.
9065 (Layout::set_segment_offsets): Use align_file_offset.
9066 * output.h (class Output_section): Add is_small_section_ and
9067 is_large_section_ fields.
9068 (Output_section::is_small_section): New function.
9069 (Output_section::set_is_small_section): New function.
9070 (Output_section::is_large_section): New function.
9071 (Output_section::set_is_large_section): New function.
9072 (Output_section::is_large_data_section): New function.
9073 (class Output_segment): Add is_large_data_segment_ field.
9074 (Output_segment::is_large_data_segment): New function.
9075 (Output_segment::set_is_large_data_segment): New function.
9076 * output.cc (Output_section::Output_section): Initialize new
9078 (Output_segment::Output_segment): Likewise.
9079 (Output_segment::add_output_section): Add assertion that large
9080 data sections always go in large data segments. Force small data
9081 sections to the end of the list of data sections. Force small BSS
9082 sections to the start of the list of BSS sections. For large BSS
9083 sections to the end of the list of BSS sections.
9084 * symtab.h (class Symbol): Declare is_common_shndx.
9085 (Symbol::is_defined): Check Symbol::is_common_shndx.
9086 (Symbol::is_common): Likewise.
9087 (class Symbol_table): Define enum Commons_section_type. Update
9088 declarations. Add small_commons_ and large_commons_ fields.
9089 * symtab.cc (Symbol::is_common_shndx): New function.
9090 (Symbol_table::Symbol_table): Initialize new fields.
9091 (Symbol_table::add_from_object): Put small and large common
9092 symbols in the right list.
9093 (Symbol_table::sized_finalized_symbol): Check
9094 Symbol::is_common_shndx.
9095 (Symbol_table::sized_write_globals): Likewise.
9096 * common.cc (Symbol_table::do_allocate_commons): Allocate new
9097 common symbol lists. Don't call do_allocate_commons_list if the
9099 (Symbol_table::do_allocate_commons_list): Remove is_tls
9100 parameter. Add comons_section_type parameter. Change all
9101 callers. Handle small and large common symbols.
9102 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
9103 Symbol::is_common_shndx.
9104 * resolve.cc (symbol_to_bits): Likewise.
9105 * target.h (Target::small_common_shndx): New function.
9106 (Target::small_common_section_flags): New function.
9107 (Target::large_common_shndx): New function.
9108 (Target::large_common_section_flags): New function.
9109 (Target::new_output_section): New function.
9110 (Target::Target_info): Add small_common_shndx, large_common_shndx,
9111 small_common_section_flags, and large_common_section_flags
9113 (Target::do_new_output_section): New virtual function.
9114 * arm.cc (Target_arm::arm_info): Initialize new fields.
9115 * i386.cc (Target_i386::i386_info): Likewise.
9116 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
9118 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
9119 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9120 (Target_x86_64::do_new_output_section): New function.
9121 * configure.ac: Define conditional MCMODEL_MEDIUM.
9122 * testsuite/Makefile.am (check_PROGRAMS): Add large.
9123 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
9124 (large_LDFLAGS): Define.
9125 * testsuite/large.c: New file.
9126 * testsuite/testfile.cc (Target_test::test_target_info):
9127 Initialize new fields.
9128 * configure, testsuite/Makefile.in: Rebuild.
9130 2009-06-05 Doug Kwan <dougkwan@google.com>
9132 * Makefile.am (CCFILES): Add target.cc.
9133 * Makefile.in: Regenerate.
9134 * i386.cc (class Target_i386): Define new virtual method to
9135 override do_is_local_label_name in parent.
9136 * object.cc (Sized_relobj::do_count_local_symbols): Discard
9137 local symbols if --discard-locals or -X is given.
9138 * options.h (class General_options): Declare new options
9139 '--discard-locals' and '-X' for discarding locals.
9140 * target.h (class Target): Define new methods is_local_label_name.
9141 Declare new virtual method do_is_local_label_name.
9142 * target.cc: New file.
9143 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
9144 (check_SCRIPTS): Add discard_locals_test.sh.
9145 (check_DATA): Add discard_local_tests.syms.
9146 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
9147 (discard_local_tests.syms, discard_locals_test.o): New make rules.
9148 * testsuite/Makefile.in: Regenerate.
9149 * testsuite/discard_locals_test.c: New file.
9150 * testsuite/discard_locals_test.sh: Same.
9152 2009-06-05 Doug Kwan <dougkwan@google.com>
9154 * object.cc (Sized_relobj::Sized_relobj): Initialize
9155 discarded_eh_frame_shndx_ to -1U.
9156 (Sized_relobj::do_layout): Record index of a discard .eh_frame
9158 (Sized_relobj::do_count_local_symbols): Skip local symbols in
9159 a discarded .eh_frame section.
9160 (Sized_relobj::do_finalize_local_symbols): Ditto.
9161 * object.h (class Sized_relobj): Declare new member
9162 discarded_eh_frame_shndx_.
9163 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
9164 (local_labels_test.o, local_labels_test): New rules.
9165 * testsuite/Makefile.in: Regenerate.
9167 2009-06-04 Doug Kwan <dougkwan@google.com>
9169 * layout.cc (Layout::section_name_mapping): Add mapping for
9170 special ARM sections.
9172 2009-06-03 Doug Kwan <dougkwan@google.com>
9174 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
9175 (utils::has_overflow): Same.
9177 2009-06-03 Ian Lance Taylor <iant@google.com>
9179 * layout.cc (Layout::section_name_mapping): New array, replacing
9180 Layout::linkonce_mapping.
9181 (Layout::section_name_mapping_count): New variable, replacing
9182 Layout::linkonce_mapping_count.
9183 (Layout::linkonce_output_name): Remove.
9184 (Layout::output_section_name): Rewrite.
9185 * layout.h (class Layout): Rename Linkonce_mapping to
9186 Section_name_mapping, linkonce_mapping to section_name_mapping,
9187 linkonce_mapping_count to section_name_mapping_count. Don't
9188 declare linkonce_output_name.
9190 2009-06-03 Doug Kwan <dougkwan@google.com>
9192 * gold/arm.cc (namespace utils): New.
9193 (Target_arm::reloc_is_non_pic): Define new method.
9194 (class Arm_relocate_functions): New.
9195 (Target_arm::Relocate::relocate): Handle relocation types used by
9198 2009-06-03 Ian Lance Taylor <iant@google.com>
9200 * arm.cc (Target_arm::scan::global): Use || instead of |.
9202 2009-06-02 Doug Kwan <dougkwan@google.com>
9204 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
9205 issued_non_pic_error_.
9206 (class Target_arm::Scan): Declare new method check_non_pic.
9207 Define new method symbol_needs_plt_entry.
9208 Declare new data member issued_non_pic_error_.
9209 (class Target_arm::Relocate): Declare new method
9210 should_apply_static_reloc.
9211 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9212 (Target_arm::Scan::check_non_pic): Define new method.
9213 (Target_arm::Scan::local): Handle a small subset of reloc types used
9215 (Target_arm::Scan::local): Same.
9216 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9218 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
9220 * incremental.cc (Incremental_inputs::report_command_line): Filter
9221 out --incremental-* options.
9223 2009-05-29 Doug Kwan <dougkwan@google.com>
9225 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9227 (class Target_arm): Update comment.
9228 (Target_arm::Target_arm): Initialize new data members GOT_,
9229 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
9230 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
9231 and Target_arm::rel_dyn_section.
9232 Declare new_enum Target_arm::Got_type.
9233 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
9235 Update commments for member do_dynsym_value.
9236 (Target_arm::got_size, Target_arm::plt_section,
9237 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
9238 new methods inside class defintion.
9239 (Target_arm::got_section): Define new method.
9240 (Target_arm::rel_dyn_section): Same.
9241 (Output_data_plt_arm): New template class.
9242 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
9243 (Output_data_plt_arm:do_adjust_output_section): Define new method.
9244 (Output_data_plt_arm::add_entry): Same.
9245 (Output_data_plt_arm::first_plt_entry): Define new
9246 static data member for PLT instruction template.
9247 (Output_data_plt_arm::plt_entry): Same.
9248 (Output_data_plt_arm::do_write): Define new method.
9249 (Target_arm::make_plt_entry): Same.
9250 (Target_arm::do_finalize_sections): Same.
9251 (Target_arm::do_dynsym_value): Same.
9253 2009-05-28 Doug Kwan <dougkwan@google.com>
9255 * Makefile.am (TARGETSOURCES): Add arm.cc.
9256 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
9257 * Makefile.in: Regenerate.
9259 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
9261 2009-05-26 Doug Kwan <dougkwan@google.com>
9263 * options.cc (General_options::parse_exclude_libs). Fix a comment.
9264 (General_options::check_excluded_libs): Strip off directories in
9265 archive name before matching like GNU ld does.
9266 * testsuite/Makefile.am (MOSTLYCLEANFILES,
9267 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
9268 (exclude_libs_test_LDFLAGS): Add linker option
9269 -Wl,--exclude-libs,libexclude_libs_test_3
9270 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
9271 an explicit archive without using -l.
9272 (alt/libexclude_libs_test_3.a): New make rule.
9273 * testsuite/Makefile.in: Regenerate.
9274 * testsuite/exclude_libs_test.c : Declare lib3_default().
9276 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
9277 * exclude_libs_test_3.c: New file.
9279 2009-05-26 Nick Clifton <nickc@redhat.com>
9281 * po/id.po: New Indonesian translation.
9282 * po/gold.pot: Updated template file.
9284 2009-05-22 Sriraman Tallam <tmsriram@google.com>
9286 * testsuite/Makefile.am: Add -ffunction-sections to compile
9287 gc_comdat_test files. Add -Wl,--gc-sections to build
9289 * testsuite/Makefile.in: Regenerate.
9290 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
9292 2009-05-21 Sriraman Tallam <tmsriram@google.com>
9294 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
9295 kept comdat section was garbage collected.
9296 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
9297 * testsuite/Makefile.in: Regenerate.
9298 * testsuite/gc_comdat_test.sh: New file.
9299 * testsuite/gc_comdat_test_1.cc: New file.
9300 * testsuite/gc_comdat_test_2.cc: New file.
9302 2009-05-19 Doug Kwan <dougkwan@google.com>
9304 * archive.cc (Archive::Archive): Move constructor from archive.h
9305 to here. Initialize no_export_.
9306 (Archive::get_elf_object_for_member): Set no_export flag of object.
9307 * archive.h (Archive::Archive): Move constructor body to
9309 (Archive::no_export): New method.
9310 (Archive::no_export_): New field.
9311 * object.h (Object::Object): Initialize no_export_ to false.
9312 (Object::no_export, Object::set_no_export): New methods.
9313 (Object::no_export_): New field.
9314 * options.cc (General_options::parse_exclude_libs): New method.
9315 (General_options::check_excluded_libs) Same.
9316 * options.h (exclude_libs): New option.
9317 (General_options::check_excluded_libs): New method declaration.
9318 (General_options::excluded_libs_): New field.
9319 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
9320 default or protected visibility if an object has no-export flag set.
9321 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
9322 (check_SCRIPTS): Add exclude_libs_test.sh.
9323 (check_DATA): Add exclude_libs_test.syms.
9324 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
9325 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
9326 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
9327 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
9328 (exclude_libs_test.syms, libexclude_libs_test_1.a,
9329 libexclude_libs_test_2.a): New rules.
9330 * testsuite/Makefile.in: Regenerate.
9331 * testsuite/exclude_libs_test.c: New file.
9332 * testsuite/exclude_libs_test.sh: Ditto.
9333 * testsuite/exclude_libs_test_1.c: Ditto.
9334 * testsuite/exclude_libs_test_2.c: Ditto.
9336 2009-05-15 Ian Lance Taylor <iant@google.com>
9338 * configure.ac: Check for declarations for cases where libiberty.h
9339 checks HAVE_DECL_xxx.
9340 * configure, config.in: Rebuild.
9342 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
9344 * gold.h (Incremental_argument_list): Remove (invalid) forward
9346 * incremental.cc (Incremental_inputs::report_achive): New method.
9347 (Incremental_inputs::report_object): New method.
9348 (Incremental_inputs::report_script): New method.
9349 (Incremental_inputs::finalize_inputs): New method.
9350 (Incremental_inputs::finalize): Call finalize_inputs().
9351 (Incremental_inputs::sized_create_incremental_inputs_section_data):
9352 Create inputs entries.
9353 * incremental.h (Incremental_input_type): New enum.
9354 (Incremental_inputs::Incremental_input): Initialize new fields.
9355 (Incremental_inputs::report_inputs): New method.
9356 (Incremental_inputs::report_achive): New method.
9357 (Incremental_inputs::report_object): New method.
9358 (Incremental_inputs::report_script): New method.
9359 (Incremental_inputs::finalize_inputs): New method.
9360 (Incremental_inputs::Input_info): New struct.
9361 (Incremental_inputs::Input_info_map): New typedef.
9362 (Incremental_inputs::lock_): New field.
9363 (Incremental_inputs::Inputs_): New field.
9364 (Incremental_inputs::Inputs_map): New field.
9365 * main.cc (main): Call Incremental_input::report_inputs.
9366 * options.h (Input_argument_list): Typedef moved from
9368 (Input_file_group::Files): Remove, use ::Input_argument_list.
9369 (Input_file_group::Input_argument_list): Remove, use
9370 ::Input_argument_list.
9371 * plugin.cc (Plugin_manager::add_input_file): Add error in
9373 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
9375 * script.cc (read_input_script): Call
9376 Incremental_input::report_script.
9377 * script.h (Script_info): New class.
9379 2009-04-27 Ian Lance Taylor <iant@google.com>
9381 * x86_64.cc (do_adjust_output_section): Set entsize to
9384 2009-04-23 Elliott Hughes <enh@google.com>
9386 * output.cc (Output_file::close): After short writes, continue
9387 writing from the correct offset in the buffer being written.
9389 2009-04-23 Chris Demetriou <cgd@google.com>
9391 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
9392 * configure: Regenerate.
9393 * config.in: Regenerate.
9394 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
9395 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
9397 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
9399 * incremental.cc (Incremental_inputs_header_data): Renamed from
9400 Incremental_input_header_data.
9401 (Incremental_inputs_header_data::data_size): New field.
9402 (Incremental_inputs_header_data::put_input_file_count): Renamed
9403 from input_file_count.
9404 (Incremental_inputs_header_data::put_command_line_offset): Renamed
9405 from command_line_offset.
9406 (Incremental_inputs_header_data::put_reserved): Renamed from
9408 (Incremental_inputs_entry_data): Renamed from
9409 Incremental_input_entry_data.
9410 (Incremental_inputs_entry_data::data_size): New field.
9411 (Incremental_inputs::report_command_line): New method.
9412 (Incremental_inputs::finalize): New method.
9413 (Incremental_inputs::create_incremental_inputs_data): New method.
9414 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
9415 * incremental.h: New file.
9416 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
9417 (Layout::finalize): Create incremental inputs section in
9419 (Layout::create_incremental_info_sections): New method.
9420 * layout.h (Layout::incremental_inputs): New method.
9421 (Layout::create_incremental_info_sections): New method.
9422 (Layout::incremental_inputs_): New field.
9423 * main.cc (main): Notify Incremental_input of the command line.
9425 2009-04-01 Ian Lance Taylor <iant@google.com>
9426 Mikolaj Zalewski <mikolajz@google.com>
9428 * gold.h (reserve_unordered_map): Define, three versions, one for
9429 each version of Unordered_map.
9430 * layout.cc (Layout::Layout): Remove options parameter. Add
9431 number_of_input_files parameter. Don't initialize options_.
9432 Initialize number_of_input_files_ and resized_signatures_. Move
9433 sections_are_attached_.
9434 (Layout::layout_group): Reserve space for group_signatures_.
9435 (Layout::find_or_add_kept_section): Change name parameter to be a
9436 reference. Resize signatures_ map when it gets large enough.
9437 (Layout::layout_eh_frame): Use parameters->options() instead of
9439 (Layout::make_output_section): Likewise.
9440 (Layout::attach_allocated_section_to_segment): Likewise.
9441 (Layout::finalize, Layout::create_executable_stack): Likewise.
9442 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
9443 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
9444 * layout.h (class Layout): Update declarations. Remove options_
9445 field. Add number_of_input_files_ and resized_signatures_
9446 fields. Move sections_are_attached_ field.
9447 * main.cc (main): Pass number of input files to Layout
9448 constructor. Don't pass options.
9450 2009-03-30 Ian Lance Taylor <iant@google.com>
9452 * ffsll.c (ffsll): Correct implementation.
9454 2009-03-27 Ian Lance Taylor <iant@google.com>
9456 * ffsll.c: New file.
9457 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
9458 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
9459 * ftruncate.c (ftruncate): Declare before definition.
9460 * mremap.c (mremap): Likewise.
9461 * pread.c (pread): Likewise.
9462 * configure, Makefile.in, config.in: Rebuild.
9464 * mremap.c: New file.
9465 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
9466 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
9467 (mremap): Declare if HAVE_MREMAP is not defined.
9468 * configure, Makefile.in, config.in: Rebuild.
9470 2009-03-27 Cary Coutant <ccoutant@google.com>
9472 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
9473 position independent.
9474 * sparc.cc (Target_sparc::check_non_pic): Likewise.
9475 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
9477 2009-03-24 Cary Coutant <ccoutant@google.com>
9479 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
9481 (needs_dynamic_reloc): Likewise.
9483 2009-03-24 Ian Lance Taylor <iant@google.com>
9485 * yyscript.y (file_cmd): Recognize EXTERN.
9486 (extern_name_list, extern_name_list_body): New nonterminals.
9487 * script.cc (script_add_extern): Define.
9488 * script-c.h (script_add_extern): Declare.
9490 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
9492 * object.cc (is_elf_object): Define.
9493 * object.h (is_elf_object): Declare.
9494 * archive.cc (Archive::get_elf_object_for_member): Call
9496 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
9498 2009-03-24 Elliott Hughes <enh@google.com>
9500 * output.cc (Output_file::map_anonymous): Define.
9501 (Output_file::map): Use map_anonymous. If the regular mmap fails,
9502 try an anonymous one. Report the size if the mmap fails.
9503 * output.h (class Output_file): Declare map_anonymous.
9505 2009-03-24 Ian Lance Taylor <iant@google.com>
9507 * target-select.cc (instantiate_target): Don't acquire the lock if
9508 the instantiated_target_ field has already been set.
9510 2009-03-23 Ian Lance Taylor <iant@google.com>
9512 * gold-threads.h (class Initialize_lock): Define.
9513 * gold-threads.cc (class Initialize_lock_once): Define.
9514 (initialize_lock_control): New static variable.
9515 (initialize_lock_pointer): New static variable.
9516 (initialize_lock_once): New static function.
9517 (Initialize_lock::Initialize_lock): Define.
9518 (Initialize_lock::initialize): Define.
9519 * target-select.h: Include "gold-threads.h".
9520 (class Target_selector): Add lock_ and initialize_lock_ fields.
9521 Don't define instantiate_target, just declare it.
9522 * target-select.cc (Target_selector::Target_selector): Initialize
9524 (Target_selector::instantiate_target): Define.
9525 * descriptors.h: Include "gold-threads.h".
9526 (class Descriptors): Add initialize_lock_ field.
9527 * descriptors.cc (Descriptors::Descriptors): Initialize new
9529 (Descriptors::open): Use initialize_lock_ field
9530 * errors.h (class Errors): Add initialize_lock_ field.
9531 * errors.cc (Errors::Errors): Initialize new field.
9532 (Errors::initialize_lock): Use initialize_lock_ field.
9533 * powerpc.cc (class Target_selector_powerpc): Remove
9534 instantiated_target_ field. In do_recognize call
9535 instantiate_target rather than do_instantiate_target. In
9536 do_instantiate_target just allocate a new target.
9537 * sparc.cc (class Target_selector_sparc): Likewise.
9539 * freebsd.h: New file.
9540 * i386.cc: Include "freebsd.h".
9541 (Target_i386): Derive from Target_freebsd rather than
9543 (Target_selector_i386): Derive from Target_selector_freebsd rather
9544 than Target_selector.
9545 * x86_64.cc: Include "freebsd.h".
9546 (Target_x86_64): Derive from Target_freebsd rather than
9548 (Target_selector_x86_64): Derive from Target_selector_freebsd
9549 rather than Target_selector.
9550 * target.h (class Target): Add adjust_elf_header and
9551 do_adjust_elf_header.
9552 * output.cc (Output_file_header:: do_sized_write): Call target
9553 adjust_elf_header routine.
9554 * configure.tgt: Set targ_osabi.
9555 * configure.ac: Define GOLD_DEFAULT_OSABI.
9556 * parameters.cc (Parameters::default_target): Pass
9557 GOLD_DEFAULT_OSABI to select_target.
9558 * target-select.h (class Target_selector): Make instantiate_target
9559 protected rather than private.
9560 * Makefile.am (HFILES): Add freebsd.h.
9561 * configure, Makefile.in, config.in: Rebuild.
9563 * merge.cc (do_add_input_section): Correct pend value. Change
9564 message about last entry not being null terminated from error to
9567 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
9569 * incremental.cc: New file.
9570 * Makefile.am (CCFILES): Add incremental.cc.
9571 * Makefile.in: Rebuild.
9573 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
9575 * layout.cc (Layout::output_section_name): Preserve names
9576 of '.note.' sections.
9578 2009-03-19 Ian Lance Taylor <iant@google.com>
9580 * descriptors.cc (Descriptors::open): Check that the options are
9581 valid before using them.
9583 2009-03-18 Ian Lance Taylor <iant@google.com>
9585 * script-sections.h: Include <list>.
9586 (class Script_sections): Change Sections_elements from std::vector
9587 to std::list. Typedef public Elements_iterator. Add
9588 orphan_section_placement_, data_segment_align_start_, and
9589 saw_data_segment_align_ fields. Remove data_segment_align_index_
9591 * script-sections.cc (class Orphan_section_placement): New class.
9592 (class Sections_element): Add virtual functions is_relro and
9593 orphan_section_init. Remove virtual function place_orphan_here.
9594 (class Output_section_definition): Add is_relro and
9595 orphan_section_init. Remove place_orphan_here.
9596 (class Orphan_output_section): Likewise.
9597 (Script_sections::Script_sections): Update for field changes.
9598 (Script_sections::data_segment_align): Set saw_data_segment_align_
9599 and data_segment_align_start_, not data_segment_align_index.
9600 (Script_sections::data_segment_relro_end): Check
9601 saw_data_segment_align_. Use data_segment_align_start_ rather
9602 than data_segment_align_index_.
9603 (Script_sections::place_orphan): Rewrite to use
9604 Orphan_section_placement.
9606 2009-03-17 Ian Lance Taylor <iant@google.com>
9608 * archive.cc (Archive::add_symbols): Check for a version attached
9609 to the symbol name in the archive map.
9610 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
9611 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
9612 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
9613 (ver_test_11.a): New target.
9614 * testsuite/Makefile.in: Rebuild.
9616 * configure.ac: Check for chsize and posix_fallocate. Replace
9618 * ftruncate.c: New file, from gnulib.
9619 * output.cc (posix_fallocate): Define dummy version if not
9620 HAVE_POSIX_FALLOCATE.
9621 (Output_file::map): Call posix_fallocate rather than lseek and
9623 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
9624 * configure, Makefile.in, config.in: Rebuild.
9626 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
9628 * layout.h (Layout::create_note): Add section_name parameter.
9629 * layout.cc (Layout::create_note): Likewise.
9630 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
9632 2009-03-17 Ian Lance Taylor <iant@google.com>
9634 * descriptors.cc: Include "options.h".
9635 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
9636 (Descriptors::open): Always use O_CLOEXEC when opening a new
9637 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
9638 then set FD_CLOEXEC.
9640 * sparc.cc (class Target_sparc): Add has_got_section.
9641 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
9642 make sure we have a GOT section.
9644 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
9645 (Target_sparc::Scan::local): Likewise.
9646 (Target_sparc::Scan::global): Likewise.
9647 (Target_sparc::Relocate::relocate): Likewise.
9648 (Target_sparc::Relocate::relocate_tls): Likewise.
9650 * symtab.cc (Symbol_table::define_default_version): New function,
9651 broken out of add_from_object.
9652 (Symbol_table::add_from_object): Call define_default_version.
9653 (Symbol_table::define_special_symbol): Add resolve_oldsym
9654 parameter. Change all callers. If the version for a symbol comes
9655 from a version script, resolve it with the symbol with the same
9656 name with no version. Also add the symbol without a version if
9658 (do_define_in_output_data): If resolving with oldsym, don't delete
9660 (do_define_in_output_segment): Likewise.
9661 (do_define_as_constant): Likewise.
9662 * symtab.h (class Symbol_table): Update declarations.
9664 2009-03-13 Ian Lance Taylor <iant@google.com>
9666 * readsyms.cc (Read_symbols::incompatible_warning): New function.
9667 (Read_symbols::requeue): New function.
9668 (Read_symbols::do_read_symbols): If make_elf_object fails because
9669 the target type is not configured, and the file was searched for,
9670 issue a warning and retry with the next directory.
9671 (Add_symbols::run): If the file has an incompatible format, and
9672 it was searched for, requeue the Read_symbols task. On error,
9674 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
9675 dirindex parameter to constructor. Change all callers. Declare
9676 incompatible_warning and requeue.
9677 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
9678 input_argument_ and input_group_ fields. Add them to
9679 constructor. Change all callers.
9680 (class Read_script): Add dirindex_ field. Add it to constructor.
9682 * archive.cc (Archive::setup): Remove input_objects parameter.
9684 (Archive::get_file_and_offset): Likewise.
9685 (Archive::read_all_symbols): Likewise.
9686 (Archive::read_symbols): Likewise.
9687 (Archive::get_elf_object_for_member): Remove input_objects
9688 parameter. Add punconfigured parameter. Change all callers.
9689 (Archive::add_symbols): Change return type to bool. Check return
9690 value of include_member.
9691 (Archive::include_all_members): Likewise.
9692 (Archive::include_member): Change return type to bool. Return
9693 false if first included object has incompatible target. Set
9694 included_member_ field.
9695 (Add_archive_symbols::run): If add_symbols returns false, requeue
9697 * archive.h (class Archive): Add included_member_ field.
9698 Initialize it in constructor. Add input_file and searched_for
9699 methods. Update declarations.
9700 (class Add_archive_symbols): Add dirpath_, dirindex_, and
9701 input_argument_ fields. Add them to constructor. Change all
9703 * script.cc: Include "target-select.h".
9704 (class Parser_closure): Add skip_on_incompatible_target_ and
9705 found_incompatible_target_ fields. Add
9706 skip_on_incompatible_target parameter to constructor. Change all
9707 callers. Add methods skip_on_incompatible_target,
9708 clear_skip_on_incompatible_target, found_incompatible_target, and
9709 set_found_incompatible_target.
9710 (read_input_script): Add dirindex parameter. Change all callers.
9711 If parser finds an incompatible target, requeue Read_symbols
9713 (script_set_symbol): Clear skip_on_incompatible_target in
9715 (script_add_assertion, script_parse_option): Likewise.
9716 (script_start_sections, script_add_phdr): Likewise.
9717 (script_check_output_format): New function.
9718 * script.h (read_input_script): Update declaration.
9719 * script-c.h (script_check_output_format): Declare.
9720 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
9721 (ignore_cmd): Remove OUTPUT_FORMAT.
9722 * fileread.cc (Input_file::Input_file): Add explicit this.
9723 (Input_file::will_search_for): New function.
9724 (Input_file::open): Add pindex parameter. Change all callers.
9725 * fileread.h (class Input_file): Add input_file_argument method.
9726 Declare will_search_for. Update declarations.
9727 * object.cc (make_elf_object): Add punconfigured parameter.
9729 * object.h (class Object): Make input_file public. Add
9730 searched_for method.
9731 (make_elf_object): Update declaration.
9732 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
9734 * dirsearch.h (class Dirsearch): Update declaration.
9735 * options.h (class General_options): Add --warn-search-mismatch.
9736 * parameters.cc (Parameters::is_compatible_target): New function.
9737 * parameters.h (class Parameters): Declare is_compatible_target.
9738 * workqueue.cc (Workqueue::add_blocker): New function.
9739 * workqueue.h (class Workqueue): Declare add_blocker.
9741 * fileread.cc (Input_file::open): Remove options parameter.
9743 (Input_file::open_binary): Likewise.
9744 * script.cc (read_input_script): Likewise.
9745 * readsyms.h (class Read_symbols): Remove options_ field. Remove
9746 options parameter from constructor. Change all callers.
9747 (class Read_script): Likewise.
9748 * fileread.h (class Input_file): Update declarations.
9749 * script.h (read_input_script): Update declaration.
9751 2009-03-10 Nick Clifton <nickc@redhat.com>
9753 * po/es.po: New Spanish translation.
9755 2009-03-06 Cary Coutant <ccoutant@google.com>
9757 * options.cc (parse_short_option): Keep dash_z from registering itself.
9759 2009-03-03 Ian Lance Taylor <iant@google.com>
9762 * target-reloc.h (relocate_section): Pass output_section to
9764 * i386.cc (Target_i386::should_apply_static_reloc): Add
9765 output_section parameter. Change all callers.
9766 (Target_i386::Relocate::relocate): Add output_section parameter.
9767 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9768 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
9769 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
9770 * testsuite/two_file_shared.sh: New script.
9771 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
9772 (check_DATA): Add two_file_shared.dbg.
9773 (two_file_shared.dbg): New target.
9774 * testsuite/Makefile.in: Rebuild.
9776 2009-03-01 Ian Lance Taylor <iant@google.com>
9778 * configure.ac: Check for byteswap.h.
9779 * configure: Rebuild.
9780 * config.in: Rebuild.
9782 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
9784 * layout.cc (Layout::find_or_add_kept_section): New function.
9785 (Layout::add_comdat): Removed.
9786 * layout.h (struct Kept_section): Move out of class Layout.
9787 Remove trailing underscores from field names. Add group_sections
9788 field. Rename group_ field to is_group. Change all uses.
9789 (class Layout): Declare find_or_add_kept_section, not add_comdat.
9790 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
9791 comdat_groups_ field.
9792 (Sized_relobj::include_section_group): Use
9793 find_or_add_kept_section and Kept_section::group_sections.
9794 (Sized_relobj::include_linkonce_section): Likewise.
9795 * object.cc (class Sized_relobj): Don't define Comdat_group or
9796 Comdat_group_table. Remove find_comdat_group and
9797 add_comdat_group. Remove comdat_groups_ field.
9798 * plugin.cc (include_comdat_group): Use
9799 Layout::find_or_add_kept_section.
9801 2009-02-28 Ian Lance Taylor <iant@google.com>
9803 * README: --gc-sections and map files are now supported. Document
9804 some build requirements.
9807 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
9808 relocatable link set the value of the section symbol to zero.
9809 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
9810 relocatable link don't include the section address in the local
9813 2009-02-27 Ian Lance Taylor <iant@google.com>
9816 * options.h (class Search_directory): Add is_system_directory.
9817 (class General_options): Declare is_in_system_directory.
9818 * options.cc (get_relative_sysroot): Make static.
9819 (get_default_sysroot): Make static.
9820 (General_optoins::is_in_system_directory): New function.
9821 * fileread.cc (Input_file::is_in_system_directory): New function.
9822 * fileread.h (class Input_file): Declare is_in_system_directory.
9823 * object.h (class Object): Add is_in_system_directory.
9824 (class Input_objects): Remove system_library_directory_ field.
9825 * object.cc (Input_objects::add_object): Don't set
9826 system_library_directory_.
9827 (input_objects::found_in_system_library_directory): Remove.
9828 * symtab.cc (Symbol_table::write_globals): Remove input_objects
9829 parameter. Change all callers.
9830 (Symbol_table::sized_write_globals): Likewise.
9831 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
9832 Call Object::is_in_system_directory.
9833 * symtab.h (class Symbol_table): Update declarations.
9836 * descriptors.h (Open_descriptor): Add is_on_stack field.
9837 * descriptors.cc (Descriptors::open): If the descriptor is on the
9838 top of the stack, remove it. Initialize is_on_stack field.
9839 (Descriptors::release): Only add pod to stack if it is not on the
9841 (Descriptors::close_some_descriptor): Clear stack_next and
9845 * output.cc (Output_section::find_starting_output_address): Rename
9846 from starting_output_address; add PADDR parameter; change return
9848 * output.h (class Output_section): Declare
9849 find_starting_output_address instead of starting_output_address.
9850 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
9851 section symbol for which we can't find a merge section.
9854 * symtab.cc (Symbol_table::add_from_object): If the visibility is
9855 hidden or internal, force the symbol to be local.
9856 * resolve.cc (Symbol::override_visibility): Define.
9857 (Symbol::override_base): Use override_visibility.
9858 (Symbol_table::resolve): Likewise.
9859 (Symbol::override_base_with_special): Likewise.
9860 (Symbol_table::override_with_special): If the visibility is hidden
9861 or internal, force the symbol to be local.
9862 * symtab.h (class Symbol): Add set_visibility and
9863 override_visibility.
9864 * testsuite/ver_test_1.sh: New file.
9865 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
9866 (check_DATA): Add ver_test_1.syms.
9867 (ver_test_1.syms): New target.
9868 * testsuite/Makefile.in: Rebuild.
9870 2009-02-25 Cary Coutant <ccoutant@google.com>
9872 * layout.cc (Layout::choose_output_section): Don't rename sections
9873 when using a linker script that has a SECTIONS clause.
9874 * Makefile.in: Regenerate.
9876 * testsuite/Makefile.am (script_test_5.sh): New test case.
9877 * testsuite/Makefile.in: Regenerate.
9878 * testsuite/script_test_5.cc: New file.
9879 * testsuite/script_test_5.sh: New file.
9880 * testsuite/script_test_5.t: New file.
9882 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
9884 * archive.cc (Archive::include_member): Update calls to add_symbols.
9885 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
9886 the Layout argument.
9887 * dynobj.h (do_add_symbols): Add the Layout argument.
9888 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
9890 * object.h (Object::add_symbols): Add the Layout argument.
9891 (Object::do_add_symbols): Add the Layout argument.
9892 (Sized_relobj::do_add_symbols): Add the Layout argument.
9893 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
9894 Unify the two versions.
9895 (Add_plugin_symbols): Remove.
9896 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
9897 (Sized_pluginobj::do_add_symbols): Unify the two versions.
9898 (Add_plugin_symbols): Remove.
9899 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
9900 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
9901 (Add_symbols::run): Make it work with Pulginobj.
9903 2009-02-06 Ian Lance Taylor <iant@google.com>
9905 * object.cc (Sized_relobj::do_layout): Make info message start
9906 with lower case letter.
9908 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
9910 * binary.cc: Fix file comment.
9912 * options.h (enum Incremental_disposition): Define.
9913 (class General_options): Add new options: --incremental,
9914 --incremental_changed, --incremental_unchanged,
9915 --incremental_unknown. Add incremental_disposition_ and
9916 implicit_incremental_ fields.
9917 (General_options::incremental_disposition): New function.
9918 (class Position_dependent_options): Add incremental_disposition
9920 (Position_dependent_options::copy_from_options): Set incremental
9922 * options.cc (General_options::parse_incremental_changed): New
9924 (General_options::parse_incremental_unchanged): New function.
9925 (General_options::parse_incremental_unknown): New function.
9926 (General_options::General_options): Initialize new fields
9927 incremental_disposition_ and implicit_incremental_.
9928 (General_options::finalize): Check for uasge of --incremental-*
9929 without --incremental.
9931 2009-02-06 Chris Demetriou <cgd@google.com>
9933 * gold.h (gold_undefined_symbol): Change to take only a Symbol
9934 pointer and to report location as the file name associated with
9936 (gold_undefined_symbol_at_location): New function to replace the
9937 old gold_undefined_symbol functionality.
9938 * target-reloc.h (relocate_section): Update to use
9939 gold_undefined_symbol_at_location.
9940 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9941 Call gold_undefined_symbol function rather than gold_error.
9942 * errors.h (Errors::undefined_symbol): Take location as a
9943 string, rather than calculating it from a relocation.
9944 * errors.cc (Errors::fatal): Print "fatal error:" before the
9946 (Errors::error, Errors::error_at_location): Print "error: "
9947 before the formatted message.
9948 (Errors::undefined_symbol): Take location as a string, rather
9949 than calculating it from a relocation.
9950 (gold_undefined_symbol_at_location): New function akin to
9951 old gold_undefined_symbol, calculates location from relocation.
9952 (gold_undefined_symbol): Change to take only a Symbol pointer
9953 and to report location as the file name associated with the symbol.
9954 * testsuite/debug_msg.sh: Update for changed error messages.
9955 * testsuite/undef_symbol.sh: Likewise.
9957 2009-02-04 Duncan Sands <baldrick@free.fr>
9960 * reduced_debug_output.h
9961 (Output_reduced_debug_abbrev_section::failed): Use format for
9963 (Output_reduced_debug_info_section::faild): Likewise.
9965 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
9967 * script.cc (Lazy_demangler): New class.
9968 (Version_script_info::get_symbol_version_helper): Demangle a
9971 2009-01-29 Cary Coutant <ccoutant@google.com>
9973 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
9975 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9977 2009-01-28 Ian Lance Taylor <iant@google.com>
9979 * version.cc (version_string): Bump to 1.9.
9981 * gold.h: Include <cstring> and <stdint.h>.
9982 * version.cc: Include <cstdio>.
9983 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
9985 * reduced_debug_output.cc (insert_into_vector): Rename from
9986 Insert_into_vector; change all callers. Use Swap_unaligned to
9987 avoid aliasing issue; remove union since it is unnecessary.
9989 2009-01-27 Sriraman Tallam <tmsriram@google.com>
9991 * Makefile.am (CCFILES): Add gc.cc.
9993 * Makefile.in: Regenerate.
9994 * gold.cc (Gc_runner): New class.
9995 (queue_initial_tasks): Call garbage collection related tasks
9996 when corresponding options are invoked.
9997 (queue_middle_gc_tasks): New function.
9998 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
9999 processed early before laying out sections during garbage collection.
10000 * gold.h (queue_middle_gc_tasks): New function.
10001 (is_prefix_of): Move from "layout.cc".
10002 * i386.cc (Target_i386::gc_process_relocs): New function.
10003 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
10004 * main.cc (main): Create object of class "Garbage_collection".
10005 * object.cc (Relobj::copy_symbols_data): New function.
10006 (Relobj::is_section_name_included): New function.
10007 (Sized_relobj::do_layout): Allow this function to be called twice
10008 during garbage collection and defer layout of section during the
10010 * object.h (Relobj::get_symbols_data): New function.
10011 (Relobj::is_section_name_included): New function.
10012 (Relobj::copy_symbols_data): New function.
10013 (Relobj::set_symbols_data): New function.
10014 (Relobj::get_relocs_data): New function.
10015 (Relobj::set_relocs_data): New function.
10016 (Relobj::is_output_section_offset_invalid): New pure virtual function.
10017 (Relobj::gc_process_relocs): New function.
10018 (Relobj::do_gc_process_relocs): New pure virtual function.
10019 (Relobj::sd_): New data member.
10020 (Sized_relobj::is_output_section_offset_invalid): New function.
10021 (Sized_relobj::do_gc_process_relocs): New function.
10022 * options.h (General_options::gc_sections): Modify to not be a no-op.
10023 (General_options::print_gc_sections): New option.
10024 * plugin.cc (Plugin_finish::run): Remove function call to
10025 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
10026 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
10027 * reloc.cc (Read_relocs::run): Add task to process relocs and
10028 determine unreferenced sections when doing garbage collection.
10029 (Gc_process_relocs): New class.
10030 (Sized_relobj::do_gc_process_relocs): New function.
10031 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
10032 sections that are garbage collected.
10033 * reloc.h (Gc_process_relocs): New class.
10034 * sparc.cc (Target_sparc::gc_process_relocs): New function.
10035 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
10036 symbols whose corresponding sections are garbage collected.
10037 (Symbol_table::Symbol_table): Add new parameter for the garbage
10039 (Symbol_table::gc_mark_undef_symbols): New function.
10040 (Symbol_table::gc_mark_symbol_for_shlib): New function.
10041 (Symbol_table::gc_mark_dyn_syms): New function.
10042 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
10044 (Symbol_table::add_from_object): Likewise.
10045 (Symbol_table::add_from_relobj): When building shared objects, do not
10046 treat externally visible symbols as garbage.
10047 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
10048 table information for static and relocatable links.
10049 * symtab.h (Symbol_table::set_gc): New function.
10050 (Symbol_table::gc): New function.
10051 (Symbol_table::gc_mark_undef_symbols): New function.
10052 (Symbol_table::gc_mark_symbol_for_shlib): New function.
10053 (Symbol_table::gc_mark_dyn_syms): New function.
10054 (Symbol_table::gc_): New data member.
10055 * target.h (Sized_target::gc_process_relocs): New pure virtual
10057 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
10058 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
10060 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
10062 * options.h (General_options::gc_sections): Define as a no-op for now.
10063 (General_options::no_keep_memory): Ditto.
10064 (General_options::Bshareable): Define.
10065 * options.cc (General_options::finalize): Honor -Bshareable.
10067 2009-01-20 Andreas Schwab <schwab@suse.de>
10069 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
10070 read the value in the contents, since we don't use it. Use the
10071 template endianness when writing.
10072 (Relocate::relocate): Use it for R_PPC_REL16_HA.
10074 2009-01-19 Andreas Schwab <schwab@suse.de>
10076 * configure.tgt (powerpc64-*): Fix targ_obj.
10078 2009-01-15 Ian Lance Taylor <iant@google.com>
10080 * object.cc (Sized_relobj::write_local_symbols): Don't write out
10081 local symbols when stripping all symbols.
10083 2009-01-14 Cary Coutant <ccoutant@google.com>
10085 * output.cc (Output_reloc): Add explicit instantiations.
10087 2009-01-14 Cary Coutant <ccoutant@google.com>
10089 * archive.cc (Archive::get_elf_object_for_member): Remove call
10090 to File_read::claim_for_plugin.
10091 * descriptors.cc (Descriptors::open): Remove reference to
10093 (Descriptors::claim_for_plugin): Remove.
10094 * descriptors.h (Descriptors::claim_for_plugin): Remove.
10095 (Descriptors::is_claimed): Remove.
10096 (claim_descriptor_for_plugin): Remove.
10097 * fileread.cc (File_read::claim_for_plugin): Remove.
10098 * fileread.h (File_read::claim_for_plugin): Remove.
10099 (File_read::descriptor): Reopen descriptor if necessary.
10100 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
10101 (Plugin_manager::all_symbols_read): Add task parameter. Change
10103 (Plugin_manager::get_input_file): New function.
10104 (Plugin_manager::release_input_file): New function.
10105 (Pluginobj::Pluginobj): Add filesize parameter and initialize
10106 corresponding data member.
10107 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
10108 and pass to base constructor. Change all callers.
10109 (get_input_file, release_input_file): New functions.
10110 (make_sized_plugin_object): Add filesize parameter. Change all callers.
10111 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
10112 (Plugin_manager::all_symbols_read): Add task parameter.
10113 (Plugin_manager::get_input_file): New function.
10114 (Plugin_manager::release_input_file): New function.
10115 (Plugin_manager::task_): New data member.
10116 (Pluginobj::Pluginobj): Add filesize parameter.
10117 (Pluginobj::filename): New function.
10118 (Pluginobj::descriptor): New function.
10119 (Pluginobj::filesize): New function.
10120 (Pluginobj::filesize_): New data member.
10121 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
10122 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
10123 File_read::claim_for_plugin; use Object::unlock to unlock the file.
10125 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
10126 with archive libraries.
10127 * testsuite/Makefile.in: Regenerate.
10128 * testsuite/plugin_test.c (struct sym_info): New type.
10129 (get_input_file, release_input_file): New static variables.
10130 (onload): Capture new transfer vector entries.
10131 (claim_file_hook): Stop reading at end of file according to filesize.
10132 Factor out parsing of readelf output into separate function.
10133 (all_symbols_read_hook): Exercise get_input_file and release_input_file
10134 APIs and get the source file name from the symbol table. Convert
10135 source file name to corresponding object file name. Print info
10136 message when adding new input files.
10137 (parse_readelf_line): New function.
10138 * testsuite/plugin_test_1.sh: Add checks for new info messages.
10139 * testsuite/plugin_test_2.sh: Likewise.
10140 * testsuite/plugin_test_3.sh: Likewise.
10141 * testsuite/plugin_test_4.sh: New test case.
10143 2009-01-07 Ian Lance Taylor <iant@google.com>
10145 * version.cc (version_string): Bump to 1.8.
10147 2008-12-23 Cary Coutant <ccoutant@google.com>
10149 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
10150 * plugin.cc (Plugin_manager::finish): Rename as
10151 layout_deferred_objects. Move cleanup to separate function.
10152 (Plugin_manager::cleanup): New function.
10153 (Plugin_finish::run): Call layout_deferred_objects and cleanup
10155 * plugin.h (Plugin_manager::finish): Rename as
10156 layout_deferred_objects.
10157 (Plugin_manager::cleanup): New function.
10158 (Plugin_manager::cleanup_done): New field.
10160 2008-12-23 Cary Coutant <ccoutant@google.com>
10162 * plugin.cc (is_visible_from_outside): New function.
10163 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
10164 so we don't return "IR only" status for exported symbols or -r links.
10166 * testsuite/Makefile.am (plugin_test_3): New test case.
10167 * testsuite/Makefile.in: Regenerate.
10168 * testsuite/plugin_test_3.sh: New file.
10170 2008-12-22 Cary Coutant <ccoutant@google.com>
10172 * object.cc (Sized_relobj::layout_section): New function.
10173 (Sized_relobj::do_layout): Defer layout of input sections until after
10174 plugin has provided replacement files.
10175 (Sized_relobj::do_layout_deferred_sections): New function.
10176 * object.h (Relobj::set_section_offset): Remove virtual keyword.
10177 (Relobj::layout_deferred_sections): New function.
10178 (Relobj::do_layout_deferred_sections): New function.
10179 (Sized_relobj::do_layout_deferred_sections): New function.
10180 (Sized_relobj::layout_section): New function.
10181 (Sized_relobj::Deferred_layout): New structure.
10182 (Sized_relobj::deferred_layout_): New field.
10183 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10184 Change all callers. Layout deferred sections.
10185 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
10187 (Plugin_hook::run): Move code from do_plugin_hook inline.
10188 (Plugin_hook::do_plugin_hook): Remove.
10189 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10190 (Plugin_manager::finish): Renamed, was cleanup.
10191 (Plugin_manager::should_defer_layout): New function.
10192 (Plugin_manager::add_deferred_layout_object): New function.
10193 (Plugin_manager::Deferred_layout_list): New type.
10194 (Plugin_manager::deferred_layout_objects_): New field.
10195 (Plugin_hook::do_plugin_hook): Remove.
10197 2008-12-17 Ian Lance Taylor <iant@google.com>
10199 * options.h (class General_options): Add --no case for
10202 2008-12-16 Cary Coutant <ccoutant@google.com>
10204 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
10206 (Plugin_manager::claim_file): Create plugin object even if
10207 plugin did not call the add_symbols callback.
10208 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10209 asking for more symbols than were added.
10210 * testsuite/Makefile.am (plugin_test_1): Add test case with
10212 (empty.syms): New target.
10213 * testsuite/Makefile.in: Regenerate.
10214 * testsuite/plugin_test.c (claim_file_hook): Add new debug
10215 message. Don't call add_symbols if no globals.
10216 (all_symbols_read_hook): Don't provide replacement for empty
10219 2008-12-12 Ian Lance Taylor <iant@google.com>
10221 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10222 r_type == 0 for a local symbol with r_sym == 0.
10223 (scan_relocatable_relocs): Pass r_sym to
10224 local_non_section_strategy.
10225 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10228 * configure.ac: Update test for TLS descriptors: they are
10229 supported as of glibc 2.9.
10230 * configure: Rebuild.
10232 2008-12-11 Ian Lance Taylor <iant@google.com>
10235 * target-reloc.h (Default_scan_relocatable_relocs): For each
10236 function, map r_type == 0 to RELOC_DISCARD.
10238 2008-12-10 Cary Coutant <ccoutant@google.com>
10240 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
10241 object to override a kept COMDAT group from a plugin object.
10243 2008-12-09 Ian Lance Taylor <iant@google.com>
10246 * yyscript.y (file_cmd): Handle INPUT.
10248 * testsuite/initpri1.c: Change all declarations to be full
10249 prototypes by adding void, to avoid compiler warnings.
10251 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
10253 * options.cc (General_options::parse_plugin_opt): New.
10254 (General_options::add_plugin): The argument now is just the filename.
10255 (General_options::add_plugin_option): New.
10256 * options.h (plugin_opt): New.
10257 (add_plugin): Change argument name.
10258 (add_plugin_option): New.
10259 * plugin.cc (Plugin::load): Don't parse the plugin option.
10260 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
10261 (Plugin::add_option): New.
10262 (Plugin::args_): Change type.
10263 (Plugin::filename_): New.
10264 (Plugin_manager::add_plugin_option): New.
10265 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
10266 * testsuite/Makefile.in: Regenerate.
10268 2008-12-05 Cary Coutant <ccoutant@google.com>
10270 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
10271 Handle --strip-lto-sections option.
10272 * options.h (strip_lto_sections): New option.
10274 2008-12-01 Cary Coutant <ccoutant@google.com>
10276 * plugin.cc (ld_plugin_message): Change format parameter to const.
10277 Fix mismatch between new[] and delete.
10279 2008-11-14 Cary Coutant <ccoutant@google.com>
10281 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
10284 2008-11-05 Craig Silverstein <csilvers@google.com>
10286 * options.cc (General_options::parse_dynamic_list): New function.
10287 * options.h (General_options): New flags dynamic_list,
10288 dynamic_list_data, dynamic_list_cpp_new, and
10289 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
10290 (General_options::in_dynamic_list): New function.
10291 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
10292 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
10293 (Lex::can_continue_name): Likewise.
10295 (read_script_file): New parameter script_options.
10296 (read_dynamic_list): New function.
10297 (Script_options::define_dynamic_list): New function.
10298 (dynamic_list_keyword_parsecodes): New variable.
10299 (dynamic_list_keywords): New variable.
10300 * script.h (Script_options::define_dynamic_list): New function
10302 (read_dynamic_list): New function prototype.
10303 * symtab.cc (strprefix): New macro.
10304 (Symbol::should_add_dynsym_entry): Support dynamic_list,
10305 dynamic_list_data, dynamic_list_cpp_new, and
10306 dynamic_list_cpp_typeinfo.
10307 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
10308 (dynamic_list_expr): New rule.
10309 (dynamic_list_nodes): Likewise.
10310 (dynamic_list_node): Likewise.
10311 * testsuite/Makefile.am (dynamic_list): New test.
10312 * testsuite/Makefile.in: Regenerated.
10313 * testsuite/dynamic_list.t: New file.
10314 * testsuite/dynamic_list.sh: New file.
10316 2008-11-05 Craig Silverstein <csilvers@google.com>
10318 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
10319 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
10320 (t11_last): Likewise.
10321 * testsuite/ver_test_6.c (main): Likewise.
10323 2008-10-07 Cary Coutant <ccoutant@google.com>
10325 * options.c (General_options::finalize): Add check for -static and
10327 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
10330 2008-10-02 Cary Coutant <ccoutant@google.com>
10332 * plugin.cc (make_sized_plugin_object): Fix conditional
10333 compilation to work when not all targets are enabled.
10335 2008-09-29 Cary Coutant <ccoutant@google.com>
10337 * archive.cc (Archive::get_file_and_offset): Use filename instead
10338 of name to get library path.
10339 (Archive::include_member): Unlock external member of a thin archive.
10341 * testsuite/Makefile.am (TEST_AR): New variable.
10342 (thin_archive_test_1): New test.
10343 (thin_archive_test_2): New test.
10344 * testsuite/Makefile.in: Regenerate.
10345 * testsuite/thin_archive_main.cc: New file.
10346 * testsuite/thin_archive_test_1.cc: New file.
10347 * testsuite/thin_archive_test_2.cc: New file.
10348 * testsuite/thin_archive_test_3.cc: New file.
10349 * testsuite/thin_archive_test_4.cc: New file.
10351 2008-09-29 Cary Coutant <ccoutant@google.com>
10353 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
10354 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
10356 (Sized_relobj::do_finalize_local_symbols): Likewise.
10357 (Sized_relobj::map_to_kept_section): Likewise.
10358 * object.h (Sized_relobj::invalid_address): New constant.
10359 (Sized_relobj::do_output_section_offset): Check for invalid_address
10361 * output.cc (Output_reloc::local_section_offset): Use constant
10362 invalid_address instead of -1U.
10363 (Output_reloc::get_address): Likewise.
10364 (Output_section::output_address): Change -1U to -1ULL.
10365 * output.h (Output_reloc::invalid_address): New constant.
10366 * reloc.cc (Sized_relobj::write_sections): Use constant
10367 invalid_address instead of -1U.
10368 (Sized_relobj::relocate_sections): Likewise.
10369 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
10370 values for merge sections.
10371 * target-reloc.h (relocate_for_relocatable): Use constant
10372 invalid_address instead of -1U.
10374 2008-09-19 Cary Coutant <ccoutant@google.com>
10376 Add plugin functionality for link-time optimization (LTO).
10377 * configure.ac (plugins): Add --enable-plugins option.
10378 * configure: Regenerate.
10379 * config.in: Regenerate.
10380 * Makefile.am (LIBDL): New variable.
10381 (CCFILES): Add plugin.cc.
10382 (HFILES): Add plugin.h.
10383 (ldadd_var): Add LIBDL.
10384 * Makefile.in: Regenerate.
10386 * archive.cc: Include "plugin.h".
10387 (Archive::setup): Don't preread archive symbols when using a plugin.
10388 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
10389 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
10391 (Archive::include_member): Add symbols from plugin objects.
10392 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
10393 * descriptors.cc (Descriptors::open): Check for file descriptors
10394 abandoned by plugins.
10395 (Descriptors::claim_for_plugin): New function.
10396 * descriptors.h (Descriptors::claim_for_plugin): New function.
10397 (Open_descriptor::is_claimed): New field.
10398 (claim_descriptor_for_plugin): New function.
10399 * fileread.cc (File_read::claim_for_plugin): New function.
10400 * fileread.h (File_read::claim_for_plugin): New function.
10401 (File_read::descriptor): New function.
10402 * gold.cc: Include "plugin.h".
10403 (queue_initial_tasks): Add task to call plugin hooks for generating
10405 * main.cc: Include "plugin.h".
10406 (main): Load plugin libraries.
10407 * object.h (Pluginobj): Declare.
10408 (Object::pluginobj): New function.
10409 (Object::do_pluginobj): New function.
10410 (Object::set_target): New function.
10411 * options.cc: Include "plugin.h".
10412 (General_options::parse_plugin): New function.
10413 (General_options::General_options): Initialize plugins_ field.
10414 (General_options::add_plugin): New function.
10415 * options.h (Plugin_manager): Declare.
10416 (General_options): Add --plugin option.
10417 (General_options::has_plugins): New function.
10418 (General_options::plugins): New function.
10419 (General_options::add_plugin): New function.
10420 (General_options::plugins_): New field.
10421 * plugin.cc: New file.
10422 * plugin.h: New file.
10423 * readsyms.cc: Include "plugin.h".
10424 (Read_symbols::do_read_symbols): Check for archive before checking
10425 for ELF file. Call plugin hooks to claim files.
10426 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
10427 from a real object file; force override when processing replacement
10429 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
10430 (Symbol::init_base_object): Likewise.
10431 (Symbol::init_base_output_data): Likewise.
10432 (Symbol::init_base_output_segment): Likewise.
10433 (Symbol::init_base_constant): Likewise.
10434 (Symbol::init_base_undefined): Likewise.
10435 (Symbol::output_section): Assert that object is not a plugin.
10436 (Symbol_table::add_from_pluginobj): New function.
10437 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
10439 (Symbol_table::sized_write_globals): Likewise.
10440 (Symbol_table::add_from_pluginobj): Instantiate template.
10441 * symtab.h (Sized_pluginobj): Declare.
10442 (Symbol::in_real_elf): New function.
10443 (Symbol::set_in_real_elf): New function.
10444 (Symbol::in_real_elf_): New field.
10445 (Symbol_table::add_from_pluginobj): New function.
10447 * testsuite/Makefile.am (AM_CFLAGS): New variable.
10448 (LIBDL): New variable.
10449 (LDADD): Add LIBDL.
10450 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
10451 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
10452 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
10453 (MOSTLYCLEANFILES): Likewise.
10454 * testsuite/Makefile.in: Regenerate.
10455 * testsuite/plugin_test.c: New file.
10456 * testsuite/plugin_test_1.sh: New file.
10457 * testsuite/plugin_test_2.sh: New file.
10459 2008-09-16 Ian Lance Taylor <iant@google.com>
10461 * target-reloc.h (relocate_section): Check whether a symbol is
10462 defined by the ABI before reporting an undefined symbol error.
10463 * target.h (Target::is_defined_by_abi): Make parameter const.
10464 (Target::do_is_defined_by_abi): Likewise.
10465 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
10466 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
10467 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
10468 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
10469 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
10470 * testsuite/Makefile.in: Rebuild.
10472 * fileread.cc (make_view): Add casts to avoid warning.
10474 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
10476 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
10477 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10479 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
10481 * options.h (General_options::output_is_executable): New.
10482 (General_options::output_is_pie): New.
10483 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
10484 for shared libraries.
10485 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10487 2008-09-11 Chris Demetriou <cgd@google.com>
10489 * options.h (origin): New -z option.
10490 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
10491 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
10494 2008-09-05 Cary Coutant <ccoutant@google.com>
10496 * fileread.cc (File_read::make_view): Add check for attempt to map
10497 beyond end of file.
10499 2008-09-05 Cary Coutant <ccoutant@google.com>
10501 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
10502 explicit instantiations.
10504 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
10507 * options.cc (General_options::finalize): Allow undefined symbols
10508 in shlibs if linking -shared.
10511 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
10512 symbols as not needing a dynsym entry.
10514 2008-08-20 Craig Silverstein <csilvers@google.com>
10516 * fileread.cc (File_read::open): Do not lock the file unless it
10517 was successfully opened.
10519 2008-08-14 Cary Coutant <ccoutant@google.com>
10521 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
10522 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
10523 * testsuite/tls_test.cc (struct int128): 128-bit struct
10524 for testing TLS relocs with non-zero addend.
10525 (v12): New TLS variable.
10527 (t_last): Add check for v12.
10528 * testsuite/tls_test.h (t12): New function.
10529 * testsuite/tls_test_main.cc (thread_routine): Call new test.
10531 2008-08-13 Ian Lance Taylor <iant@google.com>
10533 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
10534 set tls_segment_ or relro_segment_.
10535 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
10537 * output.h (Output_section::clear_is_relro): New function.
10538 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
10539 sections specially even when output_data_ is empty.
10540 (Output_segment::maximum_alignment): When first section is relro,
10541 only force alignment for PT_LOAD segments.
10542 * script.cc (script_data_segment_align): New function.
10543 (script_data_segment_relro_end): New function.
10544 * script-c.h (script_data_segment_align): Declare.
10545 (script_data_segment_relro_end): Declare.
10546 * script-sections.h (class Script_sections): Declare
10547 data_segment_align and data_segment_relro_end. Add fields
10548 segment_align_index_ and saw_relro_end_.
10549 * script-sections.cc (class Sections_element): Add set_is_relro
10550 virtual function. Add new bool* parameter to place_orphan_here.
10551 Add get_output_section virtual function.
10552 (class Output_section_definition): Add set_is_relro. Add new
10553 bool* parameter to place_orphan_here. Add get_output_section.
10554 Add is_relro_ field.
10555 (Output_section_definition::Output_section_definition): Initialize
10556 evaluated_address_, evaluated_load_address, evaluated_addralign_,
10557 and is_relro_ fields.
10558 (Output_section_definition::place_orphan_here): Add is_relro
10560 (Output_section_definition::set_section_addresses): Set relro for
10562 (Output_section_definition::alternate_constraint): Likewise.
10563 (class Orphan_output_section): Add new bool* parameter to
10564 place_orphan_here. Add get_output_section.
10565 (Orphan_output_section::place_orphan_here): Add is_relro
10567 (Script_sections::Script_sections): Initialize
10568 data_segment_align_index_ and saw_relro_end_.
10569 (Script_sections::data_segment_align): New function.
10570 (Script_sections::data_segment_relro_end): New function.
10571 (Script_sections::place_orphan): Set or clear is_relro.
10572 (Script_sections::set_section_addresses): Force alignment of first
10574 * yyscript.y (exp): Call script_data_segment_align and
10575 script_data_segment_relro_end.
10576 * testsuite/relro_script_test.t: New file.
10577 * testsuite/relro_test.cc (using_script): Declare.
10578 (t1, t2): Test using_script.
10579 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
10580 (relro_script_test_SOURCES): Define.
10581 (relro_script_test_DEPENDENCIES): Define.
10582 (relro_script_test_LDFLAGS): Define.
10583 (relro_script_test_LDADD): Define.
10584 (relro_script_test.so): New target.
10585 * testsuite/Makefile.in: Rebuild.
10587 2008-08-06 Cary Coutant <ccoutant@google.com>
10589 * archive.cc (Archive::total_archives, Archive::total_members)
10590 (Archive::total_members_loaded): New variables.
10591 (Archive::setup): Add parameter. Add option to preread
10593 (Archive::read_armap): Add counter.
10594 (Archive::get_file_and_offset): New function.
10595 (Archive::get_elf_object_for_member): New function.
10596 (Archive::read_all_symbols): New function.
10597 (Archive::read_symbols): New function.
10598 (Archive::add_symbols): Add counters.
10599 (Archive::include_all_members): Use armap to find members if it's
10601 (Archive::include_member): Skip reading symbols if already read.
10602 Factored code into Archive::get_file_and_offset and
10603 Archive::get_elf_object_for_member. Changed call to
10604 Mapfile::report_include_archive_member.
10605 (Archive::print_stats): New function.
10606 * archive.h: Declare Object and Read_symbols_data classes.
10607 (Archive::Archive): Add initializers for new members.
10608 (Archive::setup): Add parameter.
10609 (Archive::print_stats): New function.
10610 (Archive::total_archives, Archive::total_members)
10611 (Archive::total_members_loaded): New variables.
10612 (Archive::get_file_and_offset): New function.
10613 (Archive::get_elf_object_for_member): New function.
10614 (Archive::read_all_symbols): New function.
10615 (Archive::read_symbols): New function.
10616 (Archive::Archive_member): New class.
10617 (Archive::members_): New member.
10618 (Archive::num_members_): New member.
10619 * main.cc: Include archive.h.
10620 (main): Call Archive::print_stats.
10621 * mapfile.cc (Mapfile::report_include_archive_member): Delete
10622 archive parameter; member_name is now the fully-decorated name.
10623 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
10624 * options.h: (General_options): Add --preread-archive-symbols option.
10625 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
10628 2008-08-04 Ian Lance Taylor <iant@google.com>
10630 * symtab.h (Symbol::use_plt_offset): New function.
10631 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
10632 * powerpc.cc (Relocate::relocate): Likewise.
10633 * sparc.cc (Relocate::relocate): Likewise.
10634 * x86_64.cc (Relocate::relocate): Likewise.
10635 * testsuite/weak_plt.sh: New test.
10636 * testsuite/weak_plt_main.cc: New test.
10637 * testsuite/weak_plt_shared.cc: New test.
10638 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
10639 (check_PROGRAMS): Add weak_plt.
10640 (check_DATA): Add weak_plt_shared.so.
10641 (weak_plt_main_pic.o, weak_plt): New targets.
10642 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
10643 * testsuite/Makefile.in: Rebuild.
10645 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
10647 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
10648 * testsuite/Makefile.in: Rebuild.
10650 2008-08-04 Alan Modra <amodra@bigpond.net.au>
10652 * Makefile.am (POTFILES.in): Set LC_ALL=C.
10653 * Makefile.in: Regenerate.
10654 * po/POTFILES.in: Regenerate.
10656 2008-07-29 Ian Lance Taylor <iant@google.com>
10658 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
10659 symbols before other symbols.
10660 * testsuite/script_test_2.cc (test_addr): Declare.
10661 (test_addr_alias): Declare.
10662 (main): Check that test_addr and test_addr_alias have the right
10664 * testsuite/script_test_2.t: Define test_addr_alias and
10667 2008-07-24 Ian Lance Taylor <iant@google.com>
10670 * descriptors.cc: New file.
10671 * descriptors.h: New file.
10672 * gold-threads.h (class Hold_optional_lock): New class.
10673 * fileread.cc: Include "descriptors.h".
10674 (File_read::~File_read): Release descriptor rather than closing
10676 (File_read::open) [file]: Call open_descriptor rather than open.
10677 Set is_descriptor_opened_.
10678 (File_read::open) [memory]: Assert that descriptor is not open.
10679 (File_read::reopen_descriptor): New function.
10680 (File_read::release): Release descriptor.
10681 (File_read::do_read): Make non-const. Reopen descriptor.
10682 (File_read::read): Make non-const.
10683 (File_read::make_view): Reopen descriptor.
10684 (File_read::do_readv): Likewise.
10685 * fileread.h (class File_read): Add is_descriptor_opened_ field.
10686 Update declarations.
10687 * layout.cc: Include "descriptors.h".
10688 (Layout::create_build_id): Use open_descriptor rather than open.
10689 * output.cc: Include "descriptors.h".
10690 (Output_file::open): Use open_descriptor rather than open.
10691 * archive.cc (Archive::const_iterator): Change Archive to be
10693 (Archive::begin, Archive::end): Make non-const.
10694 (Archive::count_members): Likewise.
10695 * archive.h (class Archive): Update declarations.
10696 * object.h (Object::read): Make non-const.
10697 * Makefile.am (CCFILES): Add descriptors.cc.
10698 (HFILES): Add descriptors.h.
10699 * Makefile.in: Rebuild.
10702 * gold.h: Always include <clocale>. Add Solaris workarounds
10703 following code in binutils/sysdep.h.
10706 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
10707 this->eh_frame_hdr_ is NULL before using it.
10709 * dynobj.cc (Versions::Versions): Update comment.
10711 * dynobj.cc (Versions::Versions): If there is an soname, use it as
10712 the base version name.
10714 * stringpool.cc (Stringpool_template::add_with_length): Set key to
10715 array size plus one.
10716 (Stringpool_template::set_string_offsets): Subtract one from key
10717 before using it as an array index.
10718 (Stringpool_template::get_offset_with_length): Likewise.
10719 (Stringpool_template::write_to_buffer): Likewise.
10720 * stringpool.h (Stringpool_template::get_offset_from_key):
10723 2008-07-23 Ian Lance Taylor <iant@google.com>
10726 * object.h (Merged_symbol_value::value): Do our best to handle a
10730 * script.cc (Version_script_info::get_versions): Don't add empty
10731 version tag to return value.
10732 (Version_script_info::get_symbol_version_helper): Change return
10733 type to bool. Add pversion parameter. Change all callers.
10734 (script_register_vers_node): Don't require a non-NULL tag.
10735 * script.h (class Version_script_info): Update declarations.
10736 (Version_script_info::get_symbol_version): Change return type to
10737 bool. Add version parameter. Change all callers.
10738 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
10739 handling. Handle an empty version from a version script.
10740 (Symbol_table::define_special_symbol): Likewise.
10741 * testsuite/ver_test_10.script: New file.
10742 * testsuite/ver_test_10.sh: New file.
10743 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
10744 (check_DATA): Add ver_test_10.syms.
10745 (ver_test_10.syms, ver_test_10.so): New target.
10746 * testsuite/Makefile.in: Rebuild.
10748 2008-07-23 Simon Baldwin <simonb@google.com>
10750 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
10751 to zero for undefined symbols from dynamic libraries.
10753 2008-07-23 Ian Lance Taylor <iant@google.com>
10755 * symtab.cc (Symbol_table::resolve): Remove version parameter.
10756 Change all callers.
10757 * symtab.h (class Symbol_table): Update declaration.
10758 * testsuite/ver_test_9.cc: New file.
10759 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
10760 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
10761 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
10762 (ver_test_9.so, ver_test_9.o): New targets.
10763 * testsuite/Makefile.in: Rebuild.
10765 2008-07-22 Ian Lance Taylor <iant@google.com>
10767 * options.h (class General_options): Define --check-sections.
10768 * layout.cc (Layout::set_segment_offsets): Handle
10771 * options.h (class General_options): Define -n/--nmagic and
10773 * options.cc (General_options::finalize): For -n/--nmagic or
10774 -N/--omagic, set -static.
10775 * layout.cc (Layout::attach_allocated_section_to_segment): If
10776 -N/--omagic, don't put read-only and read-write sections in
10777 different segments.
10778 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
10779 finding a read-only segment.
10780 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
10781 don't set the minimum segment alignment to the common page size,
10782 and don't set the file offset to the address modulo the page size.
10783 * script-sections.cc (Script_sections::create_segments): If
10784 -n/--omagic, don't put read-only and read-write sections in
10785 different segments.
10787 * cref.cc: New file.
10788 * cref.h: New file.
10789 * options.h (class General_options): Add --print-symbol-counts.
10790 * main.cc (main): Issue defined symbol report if requested.
10791 * archive.cc (Archive::interpret_header): Make into a const member
10793 (Archive::add_symbols): Call Input_objects::archive_start and
10795 (Archive::const_iterator): Define new class.
10796 (Archive::begin, Archive::end): New functions.
10797 (Archive::include_all_members): Rewrite to use iterator.
10798 (Archive::count_members): New function.
10799 * archive.h (class Archive): Update declarations.
10800 (Archive::filename): New function.
10801 * object.cc: Include "cref.h".
10802 (Sized_relobj::Sized_relobj): Initialize defined_count_.
10803 (Sized_relobj::do_get_global_symbol_counts): New function.
10804 (Input_objects::add_object): Add object to cross-referencer.
10805 (Input_objects::archive_start): New function.
10806 (Input_objects::archive_stop): New function.
10807 (Input_objects::print_symbol_counts): New function.
10808 * object.h: Declare Cref and Archive.
10809 (Object::get_global_symbol_counts): New function.
10810 (Object::do_get_global_symbol_counts): New pure virtual function.
10811 (class Sized_relobj): Add defined_count_ field. Update
10813 (class Input_objects): Add cref_ field. Update constructor.
10814 Update declarations.
10815 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
10817 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
10819 (Sized_dynobj::do_get_global_symbol_counts): New function.
10820 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
10821 defined_count_. Update declarations. Define Symbols typedef.
10822 * symtab.cc (Symbol_table::add_from_relobj): Add defined
10823 parameter. Change all callers.
10824 (Symbol_table::add_from_dynobj): Add sympointers and defined
10825 parameters. Change all callers.
10826 * symtab.h (class Symbol_table): Update declarations.
10827 * Makefile.am (CCFILES): Add cref.cc.
10828 (HFILES): Add cref.h.
10829 * Makefile.in: Rebuild.
10831 2008-07-22 Simon Baldwin <simonb@google.com>
10833 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
10834 to zero when writing undefined symbols.
10836 2008-07-22 Ian Lance Taylor <iant@google.com>
10838 * output.cc (Output_section::add_input_section): Don't try to
10839 merge empty merge sections.
10841 2008-07-21 Craig Silverstein <csilvers@google.com>
10843 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10844 Include symbol version in error message.
10846 2008-07-20 Chris Demetriou <cgd@google.com>
10848 * configure.ac (gold_cv_c_random_seed): New configured variable.
10849 (RANDOM_SEED_CFLAGS): New substituted variable.
10850 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
10851 * configure: Rebuild.
10852 * Makefile.in: Likewise.
10853 * testsuite/Makefile.in: Likewise.
10855 2008-07-18 Ian Lance Taylor <iant@google.com>
10857 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
10858 where we see NAME/NULL and NAME/VERSION as separate symbols.
10859 * testsuite/ver_test_main.cc (main): Call t4.
10860 (t4, t4_2a): Define.
10861 * testsuite/ver_test_2.cc (t4_2): Define.
10862 * testsuite/ver_test_2.script: Put t4_2a in VER2.
10863 * testsuite/ver_test_4.cc (t4_2a): Define.
10864 * testsuite/ver_test_4.script: Put t4_2a in VER2.
10865 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
10867 2008-07-17 Ian Lance Taylor <iant@google.com>
10869 * dynobj.cc (Versions::add_def): If we give an error about a
10870 missing version, go ahead and create the version anyhow.
10872 2008-07-10 Ian Lance Taylor <iant@google.com>
10874 Handle output sections with more than 0x7fffffff bytes.
10875 * object.h (class Relobj): Change map_to_output_ to
10876 output_sections_, and just keep a section pointer. Change all
10877 uses. Move comdat group support to Sized_relobj.
10878 (Relobj::is_section_specially_mapped): Remove.
10879 (Relobj::output_section): Remove poff parameter. Change all
10881 (Relobj::output_section_offset): New function.
10882 (Relobj::set_section_offset): Rewrite.
10883 (Relobj::map_to_output): Remove.
10884 (Relobj::output_sections): New function.
10885 (Relobj::do_output_section_offset): New pure virtual function.
10886 (Relobj::do_set_section_offset): Likewise.
10887 (class Sized_relobj): Add section_offsets_ field. Add comdat
10888 group support from Relobj. Update declarations.
10889 (Sized_relobj::get_output_section_offset): New function.
10890 (Sized_relobj::do_output_section_offset): New function.
10891 (Sized_relobj::do_set_section_offset): New function.
10892 * object.cc (Relobj::output_section_address): Remove.
10893 (Sized_relobj::Sized_relobj): Initialize new fields.
10894 (Sized_relobj::include_section_group): Cast find_kept_object to
10896 (Sized_relobj::include_linkonce_section): Likewise.
10897 (Sized_relobj::do_layout): Use separate arrays for output section
10899 (Sized_relobj::do_count_local_symbols): Change map_to_output to
10901 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
10902 output_sections and section_offsets.
10903 (Sized_relobj::write_local_symbols): Likewise.
10904 (map_to_kept_section): Compute output address directly.
10905 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
10906 output_sections and section_offsets.
10907 (Sized_relobj::write_sections): Likewise.
10908 (Sized_relobj::relocate_sections): Likewise.
10909 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
10910 * output.h (class Output_reloc): Update declarations. Change
10911 u2_.relobj to Sized_relobj*.
10912 (class Output_data_reloc): Change add functions to use
10914 * output.cc (Output_reloc::Output_reloc): Change relobj to
10916 (Output_reloc::local_section_offset): Change return type to
10917 Elf_Addr. Use get_output_section_offset.
10918 (Output_reloc::get_address): Likewise.
10919 (Output_section::is_input_address_mapped): Don't call
10920 is_section_specially_mapped.
10921 (Output_section::output_offset): Likewise.
10922 (Output_section::output_address): Likewise.
10923 (Output_section::starting_output_address): Likewise.
10924 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
10925 parameter to Sized_relobj*.
10926 (Copy_relocs::need_copy_reloc): Likewise.
10927 (Copy_relocs::save): Likewise.
10928 * copy-relocs.h (class Copy_relocs): Update declarations.
10929 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
10930 Sized_relobj*. Change relobj_ field to Sized_relobj*.
10931 * target-reloc.h (relocate_for_relocatable): Change
10932 offset_in_output_section type to Elf_Addr. Change code that uses
10934 * layout.cc (Layout::layout): Always set *off.
10935 * mapfile.cc (Mapfile::print_input_section): Use
10936 output_section_offset.
10937 * i386.cc (Target_i386::copy_reloc): Change object parameter to
10939 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
10940 * sparc.cc (Target_sparc::copy_reloc): Likewise.
10941 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
10943 2008-07-03 Ian Lance Taylor <iant@google.com>
10945 * layout.cc (Layout::include_section): Do not discard unrecognized
10946 SHT_STRTAB sections.
10948 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
10950 * script.cc (Lex::can_continue_name): Make '?' allowable in
10951 version-script names.
10952 * testsuite/version_script.map: Change glob pattern to use '?'
10954 2008-06-30 Manish Singh <yosh@gimp.org>
10957 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
10960 2008-06-30 Ian Lance Taylor <iant@google.com>
10964 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
10965 versions]: Don't try to read the value in the contents, since we
10966 don't use it. Use the template endianness when writing.
10968 2008-06-25 Cary Coutant <ccoutant@google.com>
10970 * fileread.cc (File_read::make_view): Assert on zero-length view.
10971 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
10972 symbol table when there are no symbols to read.
10974 2008-06-23 Craig Silverstein <csilvers@google.com>
10976 * version.cc (version_string): Bump to 1.7
10978 2008-06-18 Craig Silverstein <csilvers@google.com>
10980 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
10981 constant 0xFFFF to type Valtype.
10982 (Powerpc_relocate_functions::rel16_ha): Likewise.
10984 2008-06-17 Ian Lance Taylor <iant@google.com>
10986 * output.h (Output_section::Input_section): Initialize p2align_ to
10987 zero for Output_section_data constructors.
10988 (Output_section::Input_section::addralign): If not an input
10989 section, return the alignment of the Output_section_data.
10990 * testsuite/copy_test.cc: New file.
10991 * testsuite/copy_test_1.cc: New file.
10992 * testsuite/copy_test_2.cc: New file.
10993 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
10994 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
10995 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
10996 (copy_test_1_pic.o, copy_test_1.so): New targets.
10997 (copy_test_2_pic.o, copy_test_2.so): New targets.
10998 * testsuite/Makefile.in: Rebuild.
11000 * script-sections.cc (Script_sections::place_orphan): Initialize
11001 local variable exact.
11003 2008-06-13 David Edelsohn <edelsohn@gnu.org>
11005 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
11007 2008-06-12 David Edelsohn <edelsohn@gnu.org>
11008 David S. Miller <davem@davemloft.net>
11010 * powerpc.cc: New file.
11011 * Makefile.am (TARGETSOURCES): Add powerpc.cc
11012 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
11013 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
11014 * Makefile.in: Rebuild.
11016 2008-06-09 Ian Lance Taylor <iant@google.com>
11018 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
11020 (throwing, orig_terminate): New static variables.
11021 (terminate_handler): New static function.
11022 (t2): Set terminate handler.
11024 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
11027 * binary.cc (Binary_to_elf::sized_convert): Fix .data
11030 2008-05-30 Cary Coutant <ccoutant@google.com>
11032 * archive.cc (Archive::include_all_members) Correct to step
11033 over symbol table and extended name table in thin archives.
11035 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
11038 * target-reloc.h (relocate_for_relocatable): Fix new_offset
11041 2008-05-28 Caleb Howe <cshowe@google.com>
11043 * reduced_debug_output.cc: New file.
11044 * reduced_debug_output.h: New file.
11045 * options.h (class General_options): Add --strip-debug-non-line.
11046 * options.cc (General_options::finalize): Add strip_debug_non_line
11047 to the strip heirarchy.
11048 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
11050 * layout.cc: Include "reduced_debug_output.h".
11051 (Layout::Layout): Initialize new fields.
11052 (line_only_debug_sections): New static array.
11053 (is_lines_only_debug_sections): New static inline function.
11054 (Layout::include_section): Handle --strip-debug-non-line.
11055 (Layout::make_output_section): If --strip-debug-non-line, build
11056 new output sections for .debug_abbrev and .debug_info.
11057 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
11058 gold. Warn about possible overflow.
11059 (read_signed_LEB_128): Likewise.
11060 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
11061 (read_signed_LEB_128): Declare.
11062 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
11063 (HFILES): Add reduced_debug_output.h.
11064 * Makefile.in: Rebuild.
11066 2008-05-21 Ian Lance Taylor <iant@google.com>
11068 * mapfile.cc: New file.
11069 * mapfile.h: New file.
11070 * options.h (class General_options): Add -M/--print-map and -Map.
11071 * options.cc (General_options::finalize): Make -M equivalent to
11073 * main.cc: Include <cstdio> and "mapfile.h".
11074 (main): Open mapfile if requested.
11075 * gold.cc (class Middle_runner): Add mapfile_ field. Update
11076 constructor. Change caller.
11077 (queue_initial_tasks): Add mapfile parameter. Change caller.
11078 (queue_middle_tasks): Likewise.
11079 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
11081 * archive.cc: Include "mapfile.h".
11082 (Archive::add_symbols): Add mapfile parameter. Change all
11083 callers. Pass mapfile, symbol, and reason to include_member.
11084 (Archive::include_all_members): Add mapfile parameter. Change all
11086 (Archive::include_member): Add mapfile, sym, and why parameters.
11087 Change all callers. Report inclusion to map file.
11088 * archive.h: Include "fileread.h".
11089 (class Archive): Update declarations.
11090 (Archive::file): New const method.
11091 (class Add_archive_symbols): Add mapfile_ field. Update
11092 constructor. Change all callers.
11093 * readsyms.h (class Read_symbols): Likewise.
11094 (class Finish_group): Likewise.
11095 (class Read_script): Likewise.
11096 * common.cc: Include "mapfile.h".
11097 (Symbol_table::allocate_commons): Add mapfile parameter. Change
11099 (Symbol_table::do_allocate_commons): Likewise.
11100 (Symbol_table::do_allocate_commons_list): Likewise. Report common
11101 symbol allocation to mapfile.
11102 * common.h (class Allocate_commons_task): Add mapfile_ field.
11103 Update constructor. Change all callers.
11104 * symtab.h (class Symbol_table): Update declarations.
11105 * layout.cc: Include "mapfile.h".
11106 (Layout_task_runner::run): Print information to mapfile.
11107 (Layout::create_gold_note): Change Output_data_fixed_space to
11108 Output_data_zero_fill.
11109 (Layout::create_build_id): Likewise.
11110 (Layout::print_to_mapfile): New function.
11111 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
11112 constructor. Change caller.
11113 (class Layout): Declare print_to_mapfile.
11114 * output.cc (Output_section::Input_section::print_to_mapfile): New
11116 (Output_section::add_input_section): If producing a map, always
11117 add to input_sections_ list.
11118 (Output_section::do_print_to_mapfile): New function.
11119 (Output_segment::print_sections_to_mapfile): New function.
11120 (Output_segment::print_section_list_to_mapfile): New function.
11121 * output.h: Include "mapfile.h".
11122 (Output_data::print_to_mapfile): New function.
11123 (Output_data::do_print_to_mapfile): New virtual function.
11124 (Output_segment_headers::do_print_to_mapfile): New function.
11125 (Output_file_header::do_print_to_mapfile): New function.
11126 (Output_data_const::do_print_to_mapfile): New function.
11127 (class Output_data_const_buffer): Add map_name_ field. Update
11128 constructor. Change all callers. Add do_print_to_mapfile
11130 (class Output_data_fixed_space): Likewise.
11131 (class Output_data_space): Likewise.
11132 (class Output_data_zero_fill): New class.
11133 (Output_data_strtab::do_print_to_mapfile): New function.
11134 (Output_data_reloc_base::do_print_to_mapfile): New function.
11135 (Output_relocatable_relocs::do_print_to_mapfile): New function.
11136 (Output_data_group::do_print_to_mapfile): New function.
11137 (Output_data_got::do_print_to_mapfile): New function.
11138 (Output_data_dynamic::do_print_to_mapfile): New function.
11139 (Output_symtab_xindex::do_print_to_mapfile): New function.
11140 (class Output_section): Declare do_print_to_mapflie. Declare
11141 print_to_mapfile in Input_section.
11142 (class Output_segment): Declare new functions.
11143 * object.h (Sized_relobj::symbol_count): New function.
11144 * script-sections.cc
11145 (Output_section_element_dot_assignment::set_section_addresses):
11146 Change Output_data_fixed_space to Output_data_zero_fill.
11147 (Output_data_expression::do_print_to_mapfile): New function.
11148 * script.cc (read_input_script): Add mapfile parameter. Change
11150 * script.h (read_input_script): Update declaration.
11151 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
11152 (Eh_frame::do_print_to_mapfile): New function.
11153 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
11154 (Output_merge_string::do_print_to_mapfile): New function.
11155 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
11157 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
11159 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
11161 * Makefile.am (CCFILES): Add mapfile.cc.
11162 (HFILES): Add mapfile.h.
11163 * Makefile.in: Rebuild.
11165 2008-05-19 Ian Lance Taylor <iant@google.com>
11167 * options.h (class General_options): Add -z relro.
11168 * layout.cc (Layout::Layout): Initialize relro_segment_.
11169 (Layout::add_output_section_data): Return the output section.
11170 (Layout::make_output_section): Rcognize relro sections and mark
11171 them appropriately.
11172 (Layout::attach_allocated_section_to_segment): Put relro sections
11173 in a PT_GNU_RELRO segment.
11174 (Layout::create_initial_dynamic_sections): Mark the .dynamic
11176 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11178 (Layout::linkonce_mapping): Map d.rel.ro.local to
11179 .data.rel.ro.local.
11180 (Layout::output_section_name): Us .data.rel.ro.local for any
11181 section which begins with that.
11182 * layout.h (class Layout): Update add_output_section_data
11183 declaration. Add relro_segment_ field.
11184 * output.cc (Output_section::Output_section): Initialize is_relro_
11185 and is_relro_local_ fields.
11186 (Output_segment::add_output_section): Group relro sections.
11187 (Output_segment::is_first_section_relro): New function.
11188 (Output_segment::maximum_alignment): If there is a relro section,
11189 align the segment to the common page size.
11190 (Output_segment::set_section_addresses): Track whether we are
11191 looking at relro sections. If the last section is a relro
11192 section, align to the common page size.
11193 (Output_segment::set_section_list_addresses): Add in_relro
11194 parameter. Change all callers. Align to the page size when
11195 moving from relro to non-relro section.
11196 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
11198 * output.h (class Output_section): Add is_relro_ and
11199 is_relro_local_ fields.
11200 (Output_section::is_relro): New function.
11201 (Output_section::set_is_relro): New function.
11202 (Output_section::is_relro_local): New function.
11203 (Output_section::set_is_relro_local): New function.
11204 (class Output_segment): Update declarations.
11205 * i386.cc (Target_i386::got_section): Mark .got section as relro.
11206 * sparc.cc (Target_sparc::got_section): Likewise.
11207 * x86_64.cc (Target_x86_64::got_section): Likewise.
11208 * testsuite/relro_test_main.cc: New file.
11209 * testsuite/relro_test.cc: New file.
11210 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11211 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11212 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11213 (relro_test.so, relro_test_pic.o): New targets.
11214 * testsuite/Makefile.in: Rebuild.
11216 2008-05-16 Ian Lance Taylor <iant@google.com>
11218 * output.cc (Output_segment::add_output_section): Remove front
11220 * output.h (class Output_segment): Remove
11221 add_initial_output_section and overloaded add_output_section.
11222 Update declaration of remaining add_output_section.
11223 * layout.cc (Layout::create_interp): Call add_output_section
11224 rather than add_initial_output_section.
11225 (Layout::finish_dynamic_section): Likewise.
11227 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
11228 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
11229 know the dynamic type.
11230 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
11231 field. Initialize it in constructor.
11232 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
11233 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
11234 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
11237 * output.cc (Output_reloc::get_address): Change return type to
11239 * output.h (class Output_reloc): Update get_address declaration.
11240 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
11241 for section addresses.
11243 2008-05-09 Ian Lance Taylor <iant@google.com>
11246 * gold.cc (gold_nomem): Use return value of write.
11248 2008-05-08 Ian Lance Taylor <iant@google.com>
11250 * symtab.c (Symbol::init_base_output_data): Add version
11251 parameter. Change all callers.
11252 (Symbol::init_base_output_segment): Likewise.
11253 (Symbol::init_base_constant): Likewise.
11254 (Symbol::init_base_undefined): Likewise.
11255 (Sized_symbol::init_output_data): Likewise.
11256 (Sized_symbol::init_output_segment): Likewise.
11257 (Sized_symbol::init_constant): Likewise.
11258 (Sized_symbol::init_undefined): Likewise.
11259 (Symbol_table::do_define_in_output_data): If the new symbol has a
11260 version, mark it as the default.
11261 (Symbol_table::do_define_in_output_segment): Likewise.
11262 (Symbol_table::do_define_as_constant): Likewise.
11263 * symtab.h (class Symbol): Update declarations.
11264 (class Sized_symbol): Likewise.
11265 * resolve.cc (Symbol::override_version): New function.
11266 (Symbol::override_base): Call override_version.
11267 (Symbol::override_base_with_special): Likewise.
11268 * testsuite/ver_script_8.script: New file.
11269 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
11270 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
11271 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
11272 (ver_test_8_1.so, ver_test_8_2.so): New targets.
11274 2008-05-06 Ian Lance Taylor <iant@google.com>
11277 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
11279 (class General_options): Remove existing --undefined, and add
11280 --no-undefined instead. Add new --undefined as synonym for -u.
11281 * archive.cc (Archive::add_symbols): Check whether symbol was
11283 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
11284 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
11285 all uses. Add IS_UNDEFINED. Update declarations to split
11286 different versions of init_base. Declare init_base_undefined.
11287 (Symbol::is_defined): Handle IS_UNDEFINED.
11288 (Symbol::is_undefined): Likewise.
11289 (Symbol::is_weak_undefined): Call is_undefined.
11290 (Symbol::is_absolute): Handle IS_CONSTANT.
11291 (class Sized_symbol): Update declarations to split different
11292 versions of init. Declare init_undefined.
11293 (class Symbol_table): Declare new functions.
11294 * symtab.cc (Symbol::init_base_object): Rename from init_base.
11295 Change all callers.
11296 (Symbol::init_base_output_data): Likewise.
11297 (Symbol::init_base_output_segment): Likewise.
11298 (Symbol::init_base_constant): Likewise.
11299 (Symbol::init_base_undefined): New function.
11300 (Sized_symbol::init_object): Rename from init. Change all
11302 (Sized_symbol::init_output_data): Likewise.
11303 (Sized_symbol::init_output_segment): Likewise.
11304 (Sized_symbol::init_constant): Likewise.
11305 (Sized_symbol::init_undefined): New function.
11306 (Symbol_table::add_undefined_symbols_from_command_line): New
11308 (Symbol_table::do_add_undefined_symbols_from_command_line): New
11310 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
11311 (Symbol::output_section): Likewise.
11312 (Symbol::set_output_section): Likewise.
11313 (Symbol_table::sized_finalize_symbol): Likewise.
11314 (Symbol_table::sized_write_globals): Likewise.
11315 * resolve.cc (Symbol_table::should_override): Likewise.
11316 (Symbol::override_base_with_special): Likewise.
11318 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
11319 symbol, change it to have default visibility.
11320 * testsuite/protected_1.cc: New file.
11321 * testsuite/protected_2.cc: New file.
11322 * testsuite/protected_3.cc: New file.
11323 * testsuite/protected_main_1.cc: New file.
11324 * testsuite/protected_main_2.cc: New file.
11325 * testsuite/protected_main_3.cc: New file.
11326 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
11327 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
11328 (protected_1_LDFLAGS, protected_1_LDADD): Define.
11329 (protected_1.so): New target.
11330 (protected_1_pic.o, protected_2_pic.o): New targets.
11331 (protected_3_pic.o): New target.
11332 (check_PROGRAMS): Add protected_2.
11333 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
11334 (protected_2_LDFLAGS, protected_2_LDADD): Define.
11335 * testsuite/Makefile.in: Rebuild.
11337 * options.h (DEFINE_var): Add set_user_set_##varname__.
11338 (DEFINE_bool_alias): New macro.
11339 (class General_options): Define -Bstatic using DEFINE_bool_alias
11340 rather than DEFINE_special. Add --undefined as an alias for -z
11342 * options.cc (General_options::parse_Bstatic): Remove.
11344 * options.h (class General_options): Add --fatal-warnings.
11345 * main.cc (main): Implement --fatal-warnings.
11346 * errors.h (Errors::warning_count): New function.
11348 * options.h (class General_options): Add -Bsymbolic-functions.
11349 * symtab.h (Symbol::is_preemptible): Check for
11350 -Bsymbolic-functions.
11352 2008-05-05 Ian Lance Taylor <iant@google.com>
11354 * options.h (DEFINE_bool): For DASH_Z, create the negative option
11355 as noVARNAME rather than no-VARNAME.
11356 (class General_options): Add option -z combreloc.
11357 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
11359 (Output_reloc::sort_before) [SHT_REL]: New function.
11360 (Output_reloc::sort_before) [SHT_RELA]: New function.
11361 (class Output_data_reloc_base): Add sort_relocs_ field. Define
11362 Sort_relocs_comparison.
11363 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
11364 parameter. Change all callers.
11365 (Output_data_reloc::Output_data_reloc) [both versions]: Add
11366 sort_relocs parameter. Change all callers.
11367 * output.cc (Output_reloc::get_address): New function, broken out
11369 (Output_reloc::write_rel): Call it.
11370 (Output_reloc::compare): New function.
11371 (Output_data_reloc_base::do_write): Optionally sort relocs.
11373 * configure.ac: If targ_extra_obj is set, link it in.
11374 * configure.tgt: Initialize all variables.
11375 (x86_64*): Set targ_extra_obj and targ_extra_size.
11376 * configure: Rebuild.
11378 * object.cc (Sized_relobj::include_section_group): Adjust section
11379 indexes read from group data. Build vector to pass to
11381 * layout.cc (Layout::layout_group): Add flags and shndxes
11382 parameters. Remove contents parameter. Change caller. Update
11383 explicit instantiations.
11384 * layout.h (class Layout): Update layout_group declaration.
11385 * output.cc (Output_data_group::Output_data_group): Add flags and
11386 input_shndxes parameters. Remove contents parameter. Change
11388 (Output_data_group::do_write): Change input_sections_ to
11390 * output.h (class Output_data_group): Update constructor
11391 declaration. Rename input_sections_ to input_shndxes_.
11392 * testsuite/many_sections_test.cc: Add template.
11394 2008-04-30 Cary Coutant <ccoutant@google.com>
11396 * target-reloc.h (relocate_section): Fix dead-pointer bug.
11398 * layout.cc (Layout::include_section): Refactored check for debug
11400 (Layout::add_comdat): Add new parameters. Change type
11401 of signature parameter. Add object and shndx to signatures table.
11402 (Layout::find_kept_object): New function.
11403 * layout.h: Include <cstring>.
11404 (Layout::is_debug_info_section): New function.
11405 (Layout::add_comdat): Add new parameters.
11406 (Layout::find_kept_object): New function.
11407 (Layout::Kept_section): New struct.
11408 (Layout::Signatures): Change type of map range.
11409 * object.cc (Relobj::output_section_address): New function.
11410 (Sized_relobj::include_section_group): Add new parameters. Change
11411 calls to Layout::add_comdat. Change to build table of kept comdat
11412 groups and table mapping discarded sections to kept sections.
11413 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
11414 (Sized_relobj::do_layout): Change calls to include_section_group and
11415 include_linkonce_section.
11416 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
11417 value to zero when section is discarded.
11418 (Sized_relobj::map_to_kept_section): New function.
11419 * object.h (Relobj::output_section_address): New function.
11420 (Relobj::Comdat_group): New type.
11421 (Relobj::find_comdat_group): New function.
11422 (Relobj::Comdat_group_table): New type.
11423 (Relobj::Kept_comdat_section): New type.
11424 (Relobj::Kept_comdat_section_table): New type.
11425 (Relobj::add_comdat_group): New function.
11426 (Relobj::set_kept_comdat_section): New function.
11427 (Relobj::get_kept_comdat_section): New function.
11428 (Relobj::comdat_groups_): New field.
11429 (Relobj::kept_comdat_sections_): New field.
11430 (Symbol_value::input_value): Update comment.
11431 (Sized_relobj::map_to_kept_section) New function.
11432 (Sized_relobj::include_linkonce_section): Add new parameter.
11433 * target-reloc.h (Comdat_behavior): New type.
11434 (get_comdat_behavior): New function.
11435 (relocate_section): Add code to map a discarded section to the
11436 corresponding kept section when applying a relocation.
11438 2008-04-30 Craig Silverstein <csilvers@google.com>
11440 * dwarf_reader.cc (next_generation_count): New static var.
11441 (Addr2line_cache_entry): New struct.
11442 (addr2line_cache): New static var.
11443 (Dwarf_line_info::one_addr2line): Added caching.
11444 (Dwarf_line_info::clear_addr2line_cache): New function.
11445 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
11446 cache-size parameter.
11447 (Dwarf_line_info::one_addr2line_cache): New function.
11448 * symtab.cc (Symbol_table::detect_odr_violations): Pass
11449 new cache-size argument to one_addr2line(), and clear cache.
11451 2008-04-28 Cary Coutant <ccoutant@google.com>
11453 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
11454 R_386_PC8 relocations.
11456 2008-04-23 Ian Lance Taylor <iant@google.com>
11458 * object.cc (Sized_relobj::include_section_group): Check for
11459 invalid section group.
11461 * object.cc (make_elf_object): Correct test for 64-bit ELF file
11464 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
11465 than read for file header.
11466 * archive.cc (Archive::include_member): Likewise.
11468 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
11470 * aclocal.m4: Regenerate.
11471 * configure: Regenerate.
11473 2008-04-19 Ian Lance Taylor <iant@google.com>
11475 * version.cc (version_string): Bump to 1.6.
11477 * testsuite/Makefile.am (many_sections_r_test): New target.
11478 (many_sections_r_test_SOURCES): Remove.
11479 (many_sections_r_test_DEPENDENCIES): Remove.
11480 (many_sections_r_test_LDFLAGS): Remove.
11481 (many_sections_r_test_LDADD): Remove.
11483 * object.cc (Sized_relobj::do_add_symbols): Always pass
11484 local_symbol_count_ to add_from_relobj.
11486 * testsuite/Makefile.am (many_sections_check.h): Only check one in
11487 every thousand variables.
11488 * testsuite/Makefile.in: Rebuild.
11490 * object.cc (Xindex::initialize_symtab_xindex): New function.
11491 (Xindex::read_symtab_xindex): New function.
11492 (Xindex::sym_xindex_to_shndx): New function.
11493 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
11495 (Sized_relobj::do_initialize_xindex): New function.
11496 (Sized_relobj::do_read_symbols): Adjust section links.
11497 (Sized_relobj::symbol_section_and_value): Add is_ordinary
11498 parameter. Change all callers.
11499 (Sized_relobj::include_section_group): Adjust section links and
11500 symbol section indexes.
11501 (Sized_relobj::do_layout): Adjust section links.
11502 (Sized_relobj::do_count_local_symbols): Adjust section links and
11503 symbol section indexes.
11504 (Sized_relobj::do_finalize_local_symbols): Distinguish between
11505 ordinary and special symbols.
11506 (Sized_relobj::write_local_symbols): Add symtab_xindex and
11507 dynsym_xindex parameters. Change all callers. Adjust section
11508 links. Use SHN_XINDEX when needed.
11509 (Sized_relobj::get_symbol_location_info): Adjust section links.
11510 Don't get fooled by special symbols.
11511 * object.h (class Xindex): Define.
11512 (class Object): Add xindex_ parameter. Declare virtual functoin
11513 do_initialize_xindex.
11514 (Object::adjust_sym_shndx): New function.
11515 (Object::set_xindex): New protected function.
11516 (class Symbol_value): Add is_ordinary_shndx_ field.
11517 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
11518 (Symbol_value::value): Assert ordinary section.
11519 (Symbol_value::initialize_input_to_output_map): Likewise.
11520 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
11521 Change all callers.
11522 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
11524 (class Sized_relobj): Update declarations.
11525 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
11526 parameter. Change all callers.
11527 (Sized_relobj::adjust_shndx): New function.
11528 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
11530 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
11531 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
11532 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
11533 (Sized_dynobj::read_dynsym_section): Adjust section links.
11534 (Sized_dynobj::read_dynamic): Likewise.
11535 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
11537 (Sized_dynobj::do_initialize_xindex): New function.
11538 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
11539 do_initialize_xindex.
11540 (Sized_dynobj::adjust_shndx): New function.
11541 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
11542 dynsym_xindex_ fields.
11543 (Layout::finalize): Add a call to set_section_indexes before
11544 creating the symtab sections.
11545 (Layout::set_section_indexes): Don't do anything if the section
11546 already has a section index.
11547 (Layout::create_symtab_sections): Add shnum parameter. Change
11548 caller. Create .symtab_shndx section if needed.
11549 (Layout::create_shdrs): Add shstrtab_section parameter. Change
11551 (Layout::allocated_output_section_count): New function.
11552 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
11554 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
11555 fields. Update declarations.
11556 (Layout::symtab_xindex): New function.
11557 (Layout::dynsym_xindex): New function.
11558 (class Write_symbols_task): Add layout_ field.
11559 (Write_symbols_task::Write_symbols_task): Add layout parameter.
11561 * output.cc (Output_section_headers::Output_section_headers): Add
11562 shstrtab_section parameter. Change all callers.
11563 (Output_section_headers::do_sized_write): Store overflow values
11564 for section count and section string table section index in
11565 section header zero.
11566 (Output_file_header::do_sized_write): Check for overflow of
11567 section count and section string table section index.
11568 (Output_symtab_xindex::do_write): New function.
11569 (Output_symtab_xindex::endian_do_write): New function.
11570 * output.h (class Output_section_headers): Add shstrtab_section_.
11571 Update declarations.
11572 (class Output_symtab_xindex): Define.
11573 (Output_section::has_out_shndx): New function.
11574 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
11576 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
11577 Change all callers.
11578 (Sized_symbol::init): Likewise.
11579 (Symbol::output_section): Check for ordinary symbol.
11580 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
11581 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
11583 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
11584 Change all callers. Simplify handling of symbols from sections
11585 not included in the link.
11586 (Symbol_table::add_from_dynobj): Handle ordinary symbol
11588 (Weak_alias_sorter::operator()): Assert that symbols are
11590 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
11592 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
11593 parameters. Change all callers.
11594 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
11595 symbol distinction. Use SHN_XINDEX when needed.
11596 (Symbol_table::write_section_symbol): Add symtab_xindex
11597 parameter. Change all callers.
11598 (Symbol_table::sized_write_section_symbol): Likewise. Use
11599 SHN_XINDEX when needed.
11600 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
11602 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
11603 (Symbol::is_defined): Check is_ordinary.
11604 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
11605 (Symbol::is_absolute, Symbol::is_common): Likewise.
11606 (class Sized_symbol): Update declarations.
11607 (class Symbol_table): Update declarations.
11608 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
11609 parameters. Change all callers.
11610 (Sized_symbol::override): Likewise.
11611 (Symbol_table::override): Likewise.
11612 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
11613 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
11614 is_ordinary, and orig_st_shndx parameters. Change all callers.
11615 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
11616 to be in an ordinary section.
11617 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
11618 object and is_ordinary parameters. Change all callers.
11619 (Sized_dwarf_line_info::read_relocs): Add object parameter.
11620 Change all callers. Don't add undefined or non-ordinary symbols
11622 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
11623 Change all callers.
11624 * dwarf_reader.h (class Sized_dwarf_line_info): Update
11626 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
11627 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
11628 (Sized_relobj::relocate_sections): Likewise.
11629 * target-reloc.h (scan_relocs): Adjust section symbol index.
11630 (scan_relocatable_relocs): Likewise.
11631 * i386.cc (Scan::local): Check for ordinary symbols.
11632 * sparc.cc (Scan::local): Likewise.
11633 * x86_64.cc (Scan::local): Likewise.
11634 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
11635 to symbol_section_and_value.
11636 * testsuite/many_sections_test.cc: New file.
11637 * testsuite/Makefile.am (BUILT_SOURCES): Define.
11638 (check_PROGRAMS): Add many_sections_test.
11639 (many_sections_test_SOURCES): Define.
11640 (many_sections_test_DEPENDENCIES): Define.
11641 (many_sections_test_LDFLAGS): Define.
11642 (BUILT_SOURCES): Add many_sections_define.h.
11643 (many_sections_define.h): New target.
11644 (BUILT_SOURCES): Add many_sections_check.h.
11645 (many_sections_check.h): New target.
11646 (check_PROGRAMS): Add many_sections_r_test.
11647 (many_sections_r_test_SOURCES): Define.
11648 (many_sections_r_test_DEPENDENCIES): Define.
11649 (many_sections_r_test_LDFLAGS): Define.
11650 (many_sections_r_test_LDADD): Define.
11651 (many_sections_r_test.o): New target.
11652 * testsuite/Makefile.in: Rebuild.
11654 2008-04-17 Cary Coutant <ccoutant@google.com>
11656 * errors.cc (Errors::info): New function.
11657 (gold_info): New function.
11658 * errors.h (Errors::info): New function.
11659 * gold.h (gold_info): New function.
11660 * object.cc (Input_objects::add_object): Print trace output.
11661 * options.cc (options::parse_set): New function.
11662 (General_options::parse_wrap): Deleted.
11663 (General_options::General_options): Deleted initializer.
11664 * options.h (options::String_set): New typedef.
11665 (options::parse_set): New function.
11666 (DEFINE_set): New macro.
11667 (General_options::wrap): Changed to use DEFINE_set. Changed
11668 callers of any_wrap_symbols and is_wrap_symbol.
11669 (General_options::trace, General_options::trace_symbol):
11671 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
11672 (General_options::wrap_symbols_): Deleted.
11673 * symtab.cc (Symbol_table::add_from_object): Print trace output.
11675 2008-04-17 David S. Miller <davem@davemloft.net>
11677 * options.cc (General_options::parse_V): New function.
11678 * options.h: Add entries for -V and -Qy.
11680 2008-04-17 Ian Lance Taylor <iant@google.com>
11682 * common.cc (Symbol_table::allocate_commons): Remove options
11683 parameter. Change caller.
11684 (Symbol_table::do_allocate_commons): Remove options parameter.
11685 Change caller. Just call do_allocate_commons_list twice.
11686 (Symbol_table::do_allocate_commons_list): New function, broken out
11687 of do_allocate_commons.
11688 * common.h (class Allocate_commons_task): Remove options_ field.
11689 Update constructor.
11690 * symtab.cc (Symbol_table::Symbol_table): Initialize
11692 (Symbol_table::add_from_object): Put TLS common symbols on
11694 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
11695 which are IN_OUTPUT_DATA.
11696 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
11697 allocate_commons and do_allocate_commons declarations. Declare
11698 do_allocate_commons_list.
11699 * gold.cc (queue_middle_tasks): Update creation of
11700 Allocate_commons_task to not pass options.
11701 * testsuite/Makefile.am (INCLUDES): Add -I.. .
11702 (TLS_TEST_C_FLAGS): New variable.
11703 (tls_test_c_pic.o): New target.
11704 (tls_test_shared.so): Link in tls_test_c_pic.o.
11705 (tls_test_c_pic_ie.o): New target.
11706 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
11707 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
11708 (tls_test_c.o): New target.
11709 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
11710 (tls_pic_test_LDADD): Likewise.
11711 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
11712 (tls_shared_gd_to_ie_test_LDADD): Likewise.
11713 (tls_test_c_gnu2.o): New target.
11714 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
11716 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
11717 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
11718 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
11719 * testsuite/tls_test.cc: Include "config.h".
11720 (t_last): Call t11_last.
11721 * testsuite/tls_test.h (t11, t11_last): Declare.
11722 * testsuite/tls_test_c.c: New file.
11723 * testsuite/tls_test_main.cc (thread_routine): Call t11.
11724 * configure.ac: Check for OpenMP support.
11725 * configure, config.in, Makefile.in: Rebuild.
11726 * testsuite/Makefile.in: Rebuild.
11728 2008-04-16 Cary Coutant <ccoutant@google.com>
11730 * i386.cc (Target_i386::define_tls_base_symbol): New function.
11731 (Target_i386::tls_base_symbol_defined_): New field.
11732 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11733 (Target_i386::Scan::global): Likewise.
11734 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
11735 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
11736 (Target_x86_64::tls_base_symbol_defined_): New field.
11737 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11738 (Target_x86_64::Scan::global): Likewise.
11740 2008-04-16 Cary Coutant <ccoutant@google.com>
11742 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
11743 (Symbol::needs_plt_entry): Allow weak undefined symbols.
11744 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
11745 building shared libraries.
11746 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
11747 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
11748 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
11749 * testsuite/Makefile.in: Rebuild.
11750 * testsuite/weak_undef.h: New file.
11751 * testsuite/weak_undef_file1.cc: Add extra test cases.
11752 * testsuite/weak_undef_file2.cc: Likewise.
11753 * testsuite/weak_undef_test.cc: Likewise.
11755 2008-04-16 David S. Miller <davem@davemloft.net>
11757 * sparc.cc (Target_sparc::Scan): Change from struct to class.
11758 Add issued_non_pic_error_ field. Declare check_non_pic.
11759 (Target_sparc::Scan::check_non_pic): New function.
11760 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
11761 (Target_sparc::Scan::global): Likewise.
11763 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
11764 * configure: Rebuild.
11766 * options.h (DEFINE_enable): New macro.
11767 (new_dtags): New enable option.
11768 (initfirst, interpose, loadfltr, nodefaultlib,
11769 nodelete, nodlopen, nodump): New -z options.
11770 * layout.cc (Layout:finish_dynamic_section): If new
11771 dtags enabled, emit DT_RUNPATH. Also, emit a
11772 DT_FLAGS_1 containing any specified -z flags.
11774 2008-04-16 Ian Lance Taylor <iant@google.com>
11776 * copy-relocs.cc: New file.
11777 * copy-relocs.h: New file.
11778 * reloc.cc: Remove Copy_relocs code.
11779 * reloc.h: Likewise.
11780 * reloc-types.h (struct Reloc_types) [both versions]: Add
11781 get_reloc_addend_noerror.
11782 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
11783 variants of add_global which take an addend which must be zero.
11784 * i386.cc: Include "copy-relocs.h".
11785 (class Target_i386): Change type of copy_relocs_ to variable,
11786 update initializer.
11787 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
11788 Change all callers.
11789 (Target_i386::do_finalize_sections): Change handling of
11791 * sparc.cc: Include "copy-relocs.h".
11792 (class Target_sparc): Change type of copy_relocs_ to variable,
11793 update initializer.
11794 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
11795 Change all callers.
11796 (Target_sparc::do_finalize_sections): Change handling of
11798 * x86_64.cc: Include "copy-relocs.h".
11799 (class Target_x86_64): Change type of copy_relocs_ to variable,
11800 update initializer.
11801 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
11802 class. Change all callers.
11803 (Target_x86_64::do_finalize_sections): Change handling of
11805 * Makefile.am (CCFILES): Add copy-relocs.cc.
11806 (HFILES): Add copy-relocs.h.
11808 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
11810 * testsuite/script_test_4.sh: Permit leading zeroes.
11812 2008-04-15 Ian Lance Taylor <iant@google.com>
11814 * script-sections.cc (Script_sections::create_segments): Use
11815 header_size_adjustment even when there is enough room for the
11817 * testsuite/script_test_4.sh: New file.
11818 * testsuite/script_test_4.t: New file.
11819 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
11820 (check_DATA): Add script_test_4.stdout.
11821 (MOSTLYCLEANFILES): Likewise.
11822 (script_test_4): New target.
11823 (script_test_4.stdout): New target.
11824 * testsuite/Makefile.in: Rebuild.
11826 * sparc.cc: Add definitions for Output_data_plt_sparc class
11829 2008-04-14 David S. Miller <davem@davemloft.net>
11831 * sparc.cc: New file.
11832 * Makefile.am (TARGETSOURCES): Add sparc.cc
11833 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
11834 * configure.tgt: Document targ_extra_size and
11835 targ_extra_big_endian. Add entries for sparc-* and
11837 * configure.ac: Handle targ_extra_size and
11838 targ_extra_big_endian.
11839 * Makefile.in: Rebuild.
11840 * configure: Likewise.
11841 * po/POTFILES.in: Likewise.
11842 * po/gold.pot: Likewise.
11844 2008-04-14 Ian Lance Taylor <iant@google.com>
11846 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
11847 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
11848 in the name/type/flags to section mapping. Don't call
11849 allocate_output_section.
11850 (Layout::choose_output_section): Change parameter from adjust_name
11851 to is_input_section. Don't permit input sections after sections
11852 are attached to segments. Don't call allocate_output_section.
11853 (Layout::layout_eh_frame): Call update_flags_for_input_section,
11854 not write_enable_output_section.
11855 (Layout::make_output_section): Don't push to
11856 unattached_section_list_ nor call attach_to_segment. Call
11857 attach_section_to_segment if sections are attached.
11858 (Layout::attach_sections_to_segments): New function.
11859 (Layout::attach_section_to_segment): New function.
11860 (Layout::attach_allocated_section_to_segment): Rename from
11861 attach_to_segment. Remove flags parameter.
11862 (Layout::allocate_output_section): Remove function.
11863 (Layout::write_enable_output_section): Remove function.
11864 * layout.h (class Layout): Update for above changes. Add new
11865 field sections_are_attached_.
11866 * output.h (Output_section::update_flags_for_input_section): New
11868 * output.cc (Output_section::add_input_section): Call
11869 update_flags_for_input_section.
11870 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
11872 2008-04-11 Cary Coutant <ccoutant@google.com>
11874 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
11875 thought unnecessary.
11876 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
11878 2008-04-11 Ian Lance Taylor <iant@google.com>
11880 * output.h (class Output_section_data): Remove inline definition
11882 * output.cc (Output_section_data::set_addralign): New function.
11884 2008-04-11 Cary Coutant <ccoutant@google.com>
11886 Add support for TLS descriptors for i386 and x86_64.
11887 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
11888 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
11889 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
11891 (Target_i386::got_mod_index_entry): Remove unnecessary code.
11892 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
11893 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
11895 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
11896 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
11897 Fix problem with initial-exec relocations.
11898 (Target_i386::Relocate::relocate_tls): Likewise.
11899 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
11901 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
11902 support for section-plus-offset dynamic table entries.
11903 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
11904 (Output_data_dynamic::Dynamic_entry): Add support for
11905 section-plus-offset dynamic table entries.
11906 (Output_data_dynamic::Classification): Likewise.
11907 (Output_data_dynamic::classification_): Renamed offset_.
11908 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
11909 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
11910 (Target_x86_64::make_plt_section): New function.
11911 (Target_x86_64::reserve_tlsdesc_entries): New function.
11912 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
11913 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
11914 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
11915 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
11916 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
11917 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
11918 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
11919 add extra PLT entry for TLS descriptors.
11920 (Output_data_plt_x86_64::got_): New field.
11921 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
11922 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
11924 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
11926 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
11927 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
11928 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
11929 R_386_TLS_DESC_CALL relocations.
11930 (Target_x86_64::Scan::global): Likewise.
11931 (Target_x86_64::do_finalize_sections): Add dynamic table entries
11932 for TLS descriptors.
11933 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
11934 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
11935 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
11936 GD-to-IE relaxation.
11937 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
11938 and TLS_DESCRIPTORS.
11939 * Makefile.in: Rebuild.
11940 * configure: Rebuild.
11941 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
11942 (tls_test_shared2.so): New target.
11943 (tls_shared_gd_to_ie_test_SOURCES): New variable.
11944 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
11945 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
11946 (tls_shared_gd_to_ie_test_LDADD): New variable.
11947 (tls_shared_gnu2_gd_to_ie_test): New target.
11948 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
11950 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
11951 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
11952 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
11953 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
11954 (tls_shared_gnu2_test): New target.
11955 (tls_test_gnu2_shared.so): New target.
11956 (tls_shared_gnu2_test_SOURCES): New variable.
11957 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
11958 (tls_shared_gnu2_test_LDFLAGS): New variable.
11959 (tls_shared_gnu2_test_LDADD): New variable.
11960 * testsuite/Makefile.in: Rebuild.
11961 * testsuite/Makefile.
11963 2008-04-11 Ian Lance Taylor <iant@google.com>
11965 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
11967 * testsuite/Makefile.in: Rebuild.
11969 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
11971 * testsuite/script_test_2.cc (main): Adjust test.
11973 2008-04-11 David S. Miller <davem@davemloft.net>
11974 Ian Lance Taylor <iant@google.com>
11976 * options.h (General_options): Add entries for '-Y' and
11978 * options.cc (General_options:finalize): If -Y was used, add those
11979 entries to the library path instead of the default "/lib" and
11982 2008-04-11 David S. Miller <davem@davemloft.net>
11984 * testsuite/justsyms.t: Start at 0x100.
11985 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
11986 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
11988 * testsuite/script_test_2.cc: Adjust string and section length
11991 2008-04-09 Ian Lance Taylor <iant@google.com>
11994 * script-sections.cc (Sections_element::allocate_to_segment): Add
11996 (Output_section_definition::allocate_to_segment): Likewise.
11997 (Orphan_output_section::allocate_to_segment): Likewise.
11998 (Script_sections::attach_sections_using_phdrs_clause): Don't
11999 propagate non-PT_LOAD segments to orphan sections.
12000 * testsuite/Makefile.am (script_test_3.stdout): Generate using
12001 readelf rather than objdump.
12002 * testsuite/script_test_3.sh: Adjust accordingly. Test that
12003 .interp section and PT_INTERP segment are the same size.
12004 * testsuite/Makefile.in: Rebuild.
12006 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
12007 aliases for symbols defined in the same object.
12008 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
12009 (weak_alias_test_SOURCES): New variable.
12010 (weak_alias_test_DEPENDENCIES): New variable.
12011 (weak_alias_test_LDFLAGS): New variable.
12012 (weak_alias_test_LDADD): New variable.
12013 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
12014 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
12015 (weak_alias_test_3.o): New target.
12016 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
12017 * testsuite/weak_alias_test_main.cc: New file.
12018 * testsuite/weak_alias_test_1.cc: New file.
12019 * testsuite/weak_alias_test_2.cc: New file.
12020 * testsuite/weak_alias_test_3.cc: New file.
12022 2008-04-08 Ian Lance Taylor <iant@google.com>
12024 * options.h (class General_options): Add --noinhibit-exec option.
12025 * main.cc (main): Check --noinhibit-exec.
12027 * options.h (class General_options): Define --wrap as a special
12028 option. Add wrap_symbols_ field.
12029 (General_options::any_wrap_symbols): New function.
12030 (General_options::is_wrap_symbol): New function.
12031 * options.cc (General_options::parse_wrap): New function.
12032 (General_options::General_options): Initialize wrap_symbols_.
12033 * symtab.cc (Symbol_table::wrap_symbol): New function.
12034 (Symbol_table::add_from_object): Handle --wrap.
12035 * symtab.h (class Symbol_table): Declare wrap_symbol.
12036 * target.h (Target::wrap_char): New function.
12037 (Target::Target_info): Add wrap_char field.
12038 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
12039 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12040 * testsuite/testfile.cc (Target_test::test_target_info):
12043 * errors.cc (Errors::undefined_symbol): Mention symbol version if
12046 * layout.h (class Layout): Add added_eh_frame_data_ field.
12047 * layout.cc (Layout::Layout): Initialize new field.
12048 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
12049 output section until we find a section we merged successfully.
12050 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
12051 that the size be non-zero.
12053 * merge.cc (Object_merge_map::get_output_offset): Remove inline
12056 2008-04-08 Craig Silverstein <csilvers@google.com>
12058 * configure.ac: Export new conditional variable HAVE_ZLIB.
12059 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
12061 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
12062 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12064 2008-04-07 Ian Lance Taylor <iant@google.com>
12066 * version.cc (version_string): Set to "1.5".
12068 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
12069 Add issued_non_pic_error_ field. Declare check_non_pic.
12070 (Target_x86_64::Scan::check_non_pic): New function.
12071 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
12072 (Target_x86_64::Scan::global): Likewise.
12074 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
12075 addend parameter. Change caller. Handle merge sections.
12076 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
12077 Address to Addend. Don't add in the result of
12078 local_section_offset, pass down the addend and use the returned
12080 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
12081 Update declarations of local_section_offset and symbol_value.
12082 * testsuite/two_file_test_1.cc (t18): New function.
12083 * testsuite/two_file_test_2.cc (f18): New function.
12084 * testsuite/two_file_test_main.cc (main): Call t18.
12085 * testsuite/two_file_test.h (t18, f18): Declare.
12087 * configure.ac: Don't test for objdump, c++filt, or readelf.
12088 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
12090 (TEST_READELF): New variable.
12091 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
12092 (check_PROGRAMS): Add two_file_strip_test.
12093 (two_file_strip_test): New target.
12094 (check_PROGRAMS): Add two_file_same_shared_strip_test.
12095 (two_file_same_shared_strip_test_SOURCES): New variable.
12096 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
12097 (two_file_same_shared_strip_test_LDFLAGS): New variable.
12098 (two_file_same_shared_strip_test_LDADD): New variable.
12099 (two_file_shared_strip.so): New target.
12100 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
12101 (ver_test_5.syms, ver_test_7.syms): Likewise.
12102 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
12103 (strip_test_3.stdout): Use TEST_OBJDUMP.
12104 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12106 2008-04-04 Cary Coutant <ccoutant@google.com>
12108 * symtab.h (Symbol::is_weak_undefined): New function.
12109 (Symbol::is_strong_undefined): New function.
12110 (Symbol::is_absolute): New function.
12111 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
12112 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
12114 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
12115 (weak_undef_test): New target.
12116 * testsuite/Makefile.in: Rebuild.
12117 * testsuite/weak_undef_file1.cc: New file.
12118 * testsuite/weak_undef_file2.cc: New file.
12119 * testsuite/weak_undef_test.cc: New file.
12121 2008-04-03 Craig Silverstein <csilvers@google.com>
12123 * compressed_output.h (class Output_compressed_section): Use
12125 * compressed_output.cc (zlib_compress): Use unsigned buffers,
12127 (zlib_compressed_suffix): Removed.
12128 (Output_compressed_section::set_final_data_size): Use unsigned
12130 * testsuite/Makefile.am (flagstest_compress_debug_sections):
12131 Fix linker invocation.
12132 (flagstest_o_specialfile_and_compress_debug_sections):
12134 * testsuite/Makefile.in: Regenerated.
12136 2008-04-02 David S. Miller <davem@davemloft.net>
12138 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
12139 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
12141 2008-04-02 Craig Silverstein <csilvers@google.com>
12145 2008-04-02 Ian Lance Taylor <iant@google.com>
12147 * fileread.cc (File_read::find_view): Add byteshift and vshifted
12148 parameters. Update for new key type to views_. Change all
12150 (File_read::read): Adjust for byteshift in returned view.
12151 (File_read::add_view): New function, broken out of
12152 find_and_make_view.
12153 (File_read::make_view): New function, broken out of
12154 find_and_make_view.
12155 (File_read::find_or_make_view): Add offset and aligned
12156 parameters. Rewrite accordingly. Change all callers.
12157 (File_read::get_view): Add offset and aligned parameters. Adjust
12158 for byteshift in return value.
12159 (File_read::get_lasting_view): Likewise.
12160 * fileread.h (class File_read): Update declarations.
12161 (class File_read::View): Add byteshift_ field. Add byteshift to
12162 constructor. Add byteshift method.
12163 * archive.h (Archive::clear_uncached_views): New function.
12164 (Archive::get_view): Add aligned parameter. Change all callers.
12165 * object.h (Object::get_view): Add aligned parameter. Change all
12167 (Object::get_lasting_view): Likewise.
12169 * fileread.cc (File_read::release): Don't call clear_views if
12170 there are multiple objects.
12171 * fileread.h (File_read::clear_uncached_views): New function.
12172 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
12175 2008-03-31 Cary Coutant <ccoutant@google.com>
12177 Add thin archive support.
12178 * archive.cc (Archive::armagt): New const.
12179 (Archive::setup): Remove task parameter and calls to unlock.
12180 (Archive::unlock_nested_archives): New function.
12181 (Archive::read_header): Add nested_off parameter. Change
12183 (Archive::interpret_header): Likewise.
12184 (Archive::include_all_members): Change to handle thin
12186 (Archive::include_member): Likewise.
12187 * archive.h (Archive::Archive): Add new parameters and
12189 (Archive::armagt): New const.
12190 (Archive::setup): Remove task parameter.
12191 (Archive::unlock_nested_archives): New function.
12192 (Archive::read_header): Add nested_off parameter.
12193 (Archive::interpret_header): Likewise.
12194 (Archive::Nested_archive_table): New typedef.
12195 (Archive::is_thin_archive_): New field.
12196 (Archive::nested_archives_): New field.
12197 (Archive::options_): New field.
12198 (Archive::dirpath_): New field.
12199 (Archive::task_): New field.
12200 * readsyms.cc (Read_symbols::do_read_symbols): Add check
12201 for thin archives. Pass additional parameters to
12202 Archive::Archive. Unlock the archive file after calling
12205 2008-03-29 Ian Lance Taylor <iant@google.com>
12207 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12208 version symbol to be local.
12209 * testsuite/ver_test_4.sh: New file.
12210 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12211 (check_DATA): Add ver_test_4.syms.
12212 (ver_test_4.syms): New target.
12213 * testsuite/Makefile.in: Rebuild.
12216 (Output_section::Input_section_sort_entry::has_priority): New
12218 (Output_section::Input_section_sort_entry::match_file_name): New
12220 (Output_section::Input_section_sort_entry::match_section_name):
12222 (Output_section::Input_section_sort_entry::match_section_name_prefix):
12224 (Output_section::Input_section_sort_entry::match_section_file):
12226 (Output_section::Input_section_sort_compare::operator()): Rewrite
12227 using new Input_section_sort_entry functions. Sort crtbegin and
12228 crtend first. Sort sections with no priority before sections with
12230 * testsuite/initpri1.c (d3): Check j != 4.
12231 (cd5): New constructor/destructor function.
12232 (main): Check j != 2.
12234 * symtab.cc (Symbol_table::add_from_object): If we don't use the
12235 new symbol when resolving, don't call set_is_default.
12236 * testsuite/ver_test_7.cc: New file.
12237 * testsuite/ver_test_7.sh: New file.
12238 * testsuite/Makefile.am (ver_test_7.so): New target.
12239 (ver_test_7.o): New target.
12240 (check_SCRIPTS): Add ver_test_7.sh.
12241 (check_DATA): Add ver_test_7.syms.
12242 (ver_test_7.syms): New target.
12244 2008-03-28 Ian Lance Taylor <iant@google.com>
12246 * layout.cc (Layout::layout): If we see an input section with a
12247 name that needs sorting, set the must_sort flag for the output
12249 (Layout::make_output_section): If the name of the output section
12250 indicates that it might require sorting, set the may_sort flag.
12251 * output.h (Output_section::may_sort_attached_input_sections): New
12253 (Output_section::set_may_sort_attached_input_sections): New
12255 (Output_section::must_sort_attached_input_sections): New
12257 (Output_section::set_must_sort_attached_input_sections): New
12259 (class Output_section): Declare Input_section_sort_entry. Define
12260 Input_section_sort_compare. Declare
12261 sort_attached_input_sections. Add new fields:
12262 may_sort_attached_input_sections_,
12263 must_sort_attached_input_sections_,
12264 attached_input_sections_are_sorted_.
12265 * output.cc (Output_section::Output_section): Initialize new
12267 (Output_section::add_input_section): Add an entry to
12268 input_sections_ if may_sort or must_sort are true.
12269 (Output_section::set_final_data_size): Call
12270 sort_attached_input_sections if necessary.
12271 (Output_section::Input_section_sort_entry): Define new class.
12272 (Output_section::Input_section_sort_compare::operator()): New
12274 (Output_section::sort_attached_input_sections): New function.
12275 * configure.ac: Check whether the compiler supports constructor
12276 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
12277 * testsuite/initpri1.c: New file.
12278 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
12279 CONSTRUCTOR_PRIORITY.
12280 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
12281 (initpri1_LDFLAGS): New variable.
12282 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12284 2008-03-27 Ian Lance Taylor <iant@google.com>
12286 * common.cc (Sort_commons::operator): Correct sorting algorithm.
12287 * testsuite/common_test_1.c: New file.
12288 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
12289 (common_test_1_SOURCES): New variable.
12290 (common_test_1_DEPENDENCIES): New variable.
12291 (common_test_1_LDFLAGS): New variable.
12293 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
12294 and commons_ correctly when NAME/VERSION does not override
12296 * testsuite/ver_test_6.c: New file.
12297 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
12298 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
12299 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
12301 2008-03-26 Ian Lance Taylor <iant@google.com>
12303 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
12304 of an undefined symbol from a version script.
12305 * testsuite/Makefile.am (ver_test_5.so): New target.
12306 (ver_test_5.o): New target.
12307 (check_SCRIPTS): Add ver_test_5.sh.
12308 (check_DATA): Add ver_test_5.syms.
12309 (ver_test_5.syms): New target.
12310 * testsuite/ver_test_5.cc: New file.
12311 * testsuite/ver_test_5.script: New file.
12312 * testsuite/ver_test_5.sh: New file.
12313 * Makefile.in, testsuite/Makefile.in: Rebuild.
12316 Fix problems building gold with gcc 4.3.0.
12317 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
12318 (gold_error_at_location, gold_warning_at_location): Use it.
12319 * configure.ac: Check whether we can compile and use a template
12320 function with a printf attribute.
12321 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
12322 when jumping over bytes.
12323 * object.cc: Instantiate Object::read_section_data.
12324 * debug.h: Include <cstring>
12325 * dwarf_reader.cc: Include <algorithm>
12326 * main.cc: Include <cstring>.
12327 * options.cc: Include <cstring>.
12328 * output.cc: Include <cstring>.
12329 * script.cc: Include <cstring>.
12330 * script.h: Include <string>.
12331 * symtab.cc: Include <cstring> and <algorithm>.
12332 * target-select.cc: Include <cstring>.
12333 * version.cc: Include <string>.
12334 * testsuite/testmain.cc: Include <cstdlib>.
12335 * configure, config.in: Rebuild.
12337 2008-03-25 Ian Lance Taylor <iant@google.com>
12339 * options.cc: Include "../bfd/bfdver.h".
12340 (options::help): Print bug reporting address.
12342 * version.cc (print_version): Adjust output for current value of
12343 BFD_VERSION_STRING.
12347 * options.cc (options::help): Print list of supported targets.
12348 * target-select.h: Include <vector>.
12349 (class Target_selector): Make machine_, size_, and is_big_endian_
12350 fields const. Add bfd_name_ and instantiated_target_ fields.
12351 (Target_selector::Target_selector): Add bfd_name parameter.
12352 (Target_selector::recognize): Make non-virtual, call
12354 (Target_selector::recognize_by_name): Make non-virtual, call
12355 do_recognize_by_name.
12356 (Target_selector::supported_names): New function.
12357 (Target_selector::bfd_name): New function.
12358 (Target_selector::do_instantiate_target): New pure virtual
12360 (Target_selector::do_recognize): New virtual function.
12361 (Target_selector::do_recognize_by_name): New virtual function.
12362 (Target_selector::instantiate_target): New private function.
12363 (supported_target_names): Declare.
12364 * target-select.cc (Target_selector::Target_selector): Update for
12365 new parameter and fields.
12366 (select_target_by_name): Check that the name matches before
12367 calling recognize_by_name.
12368 (supported_target_names): New function.
12369 * i386.cc (class Target_selector_i386): Update Target_selector
12370 constructor call. Remove recognize and recognize_by_name. Add
12371 do_instantiate_target.
12372 * x86_64.cc (class Target_selector_x86_64): Likewise.
12373 * testsuite/testfile.cc (class Target_selector_test): Update for
12374 changes to Target_selector.
12376 * README: Rewrite, with some notes on unsupported features.
12378 2008-03-24 Cary Coutant <ccoutant@google.com>
12380 * i386.cc (Target_i386::Got_type): New enum declaration.
12381 (Target_i386::Scan::local): Updated callers of Output_data_got
12383 (Target_i386::Scan::global): Likewise.
12384 (Target_i386::Relocate::relocate): Likewise.
12385 (Target_i386::Relocate::relocate_tls): Likewise.
12386 * object.h (Got_offset_list): New class.
12387 (Sized_relobj::local_has_got_offset): Added got_type parameter.
12388 (Sized_relobj::local_got_offset): Likewise.
12389 (Sized_relobj::set_local_got_offset): Likewise.
12390 (Sized_relobj::local_has_tls_got_offset): Removed.
12391 (Sized_relobj::local_tls_got_offset): Removed.
12392 (Sized_relobj::set_local_tls_got_offset): Removed.
12393 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
12394 * output.cc (Output_data_got::add_global): Added got_type parameter.
12395 (Output_data_got::add_global_with_rel): Likewise.
12396 (Output_data_got::add_global_with_rela): Likewise.
12397 (Output_data_got::add_global_pair_with_rel): New function.
12398 (Output_data_got::add_global_pair_with_rela): New function.
12399 (Output_data_got::add_local): Added got_type parameter.
12400 (Output_data_got::add_local_with_rel): Likewise.
12401 (Output_data_got::add_local_with_rela): Likewise.
12402 (Output_data_got::add_local_pair_with_rel): New function.
12403 (Output_data_got::add_local_pair_with_rela): New function.
12404 (Output_data_got::add_global_tls): Removed.
12405 (Output_data_got::add_global_tls_with_rel): Removed.
12406 (Output_data_got::add_global_tls_with_rela): Removed.
12407 (Output_data_got::add_local_tls): Removed.
12408 (Output_data_got::add_local_tls_with_rel): Removed.
12409 (Output_data_got::add_local_tls_with_rela): Removed.
12410 * output.h (Output_data_got::add_global): Added got_type parameter.
12411 (Output_data_got::add_global_with_rel): Likewise.
12412 (Output_data_got::add_global_with_rela): Likewise.
12413 (Output_data_got::add_global_pair_with_rel): New function.
12414 (Output_data_got::add_global_pair_with_rela): New function.
12415 (Output_data_got::add_local): Added got_type parameter.
12416 (Output_data_got::add_local_with_rel): Likewise.
12417 (Output_data_got::add_local_with_rela): Likewise.
12418 (Output_data_got::add_local_pair_with_rel): New function.
12419 (Output_data_got::add_local_pair_with_rela): New function.
12420 (Output_data_got::add_global_tls): Removed.
12421 (Output_data_got::add_global_tls_with_rel): Removed.
12422 (Output_data_got::add_global_tls_with_rela): Removed.
12423 (Output_data_got::add_local_tls): Removed.
12424 (Output_data_got::add_local_tls_with_rel): Removed.
12425 (Output_data_got::add_local_tls_with_rela): Removed.
12426 * resolve.cc (Symbol::override_base_with_special): Removed
12427 reference to has_got_offset_ field.
12428 * symtab.cc (Symbol::init_fields): Replaced initialization
12429 of got_offset_ with got_offsets_. Removed initialization
12431 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
12432 (Symbol::got_offset): Likewise.
12433 (Symbol::set_got_offset): Likewise.
12434 (Symbol::has_tls_got_offset): Removed.
12435 (Symbol::tls_got_offset): Removed.
12436 (Symbol::set_tls_got_offset): Removed.
12437 (Symbol::got_offset_): Removed.
12438 (Symbol::tls_mod_got_offset_): Removed.
12439 (Symbol::tls_pair_got_offset_): Removed.
12440 (Symbol::got_offsets_): New field.
12441 (Symbol::has_got_offset): Removed.
12442 (Symbol::has_tls_mod_got_offset): Removed.
12443 (Symbol::has_tls_pair_got_offset): Removed.
12444 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
12445 (Target_x86_64::Scan::local): Updated callers of Output_data_got
12447 (Target_x86_64::Scan::global): Likewise.
12448 (Target_x86_64::Relocate::relocate): Likewise.
12449 (Target_x86_64::Relocate::relocate_tls): Likewise.
12451 2008-03-25 Ben Elliston <bje@au.ibm.com>
12453 * yyscript.y: Fix spelling error in comment.
12455 2008-03-24 Ian Lance Taylor <iant@google.com>
12457 * options.h (class General_options): Define build_id option.
12458 * layout.h (class Layout): Declare write_build_id, create_note,
12459 create_build_id. Add build_id_note_ member.
12460 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
12461 "libiberty.h", "md5.h", "sha1.h".
12462 (Layout::Layout): Initialize eh_frame_data_,
12463 eh_frame_hdr_section_, and build_id_note_.
12464 (Layout::finalize): Call create_build_id.
12465 (Layout::create_note): New function, broken out of
12466 Layout::create_gold_note.
12467 (Layout::create_gold_note): Call create_note.
12468 (Layout::create_build_id): New function.
12469 (Layout::write_build_id): New function.
12470 (Close_task_runner::run): Call write_build_id.
12472 * x86_64.cc: Correct license to GPLv3.
12474 2008-03-23 Ian Lance Taylor <iant@google.com>
12476 * options.cc: Include "demangle.h".
12477 (parse_optional_string): New function.
12478 (parse_long_option): Handle takes_optional_argument.
12479 (parse_short_option): Update dash_z initializer. Handle
12480 takes_optional_argument.
12481 (General_options::General_options): Initialize do_demangle_.
12482 (General_options::finalize): Set do_demangle_. Handle demangling
12484 * options.h (parse_optional_string): Declare.
12485 (struct One_option): Add optional_arg field. Update constructor.
12486 Update call constructor calls. Add takes_optional_argument
12488 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
12489 (DEFINE_optional_string): Define.
12490 (General_options::demangle): Change from DEFINE_bool to
12491 DEFINE_optional_string.
12492 (General_options::no_demangle): New function.
12493 (General_options::do_demangle): New function.
12494 (General_options::set_do_demangle): New function.
12495 (General_options::execstack_status_): Move definition to end of
12497 (General_options::static_): Likewise.
12498 (General_options::do_demangle_): New field.
12499 * object.cc (big_endian>::get_symbol_location_info): Call
12500 Options::do_demangle, not Options::demangle.
12501 * symtab.cc (demangle): Likewise.
12503 2008-03-22 Ian Lance Taylor <iant@google.com>
12505 * gold.h: Include <cstddef> and <sys/types.h>
12506 * options.h: Include <cstring>.
12508 2008-03-21 Ian Lance Taylor <iant@google.com>
12510 * Added source code to GNU binutils.