1 2012-02-03 Doug Kwan <dougkwan@google.com>
3 * arm.cc (Arm_relocate_functions::abs8,
4 Arm_relocate_functions::abs16): Use
5 Bits::has_signed_unsigned_overflow32.
6 (Arm_relocate_functions::thm_abs8): Correct range of
8 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
11 2012-02-02 Doug Kwan <dougkwan@google.com>
13 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
14 position independent outputs, not just shared objects.
16 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
18 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
19 * configure: Regenerated.
21 2012-01-27 Ian Lance Taylor <iant@google.com>
23 * reloc.h (Bits): New class with static functions, copied from
24 namespace utils in arm.cc.
25 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
28 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
30 * incremental.cc (write_info_blocks): Correct relocation offset.
32 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
34 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
35 (Relocate::tls_gd_to_le): Likewise.
37 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
39 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
41 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
43 * configure.ac: Check if -mcmodel=medium works.
44 * configure: Regenerated.
46 2012-01-24 Cary Coutant <ccoutant@google.com>
48 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
50 (read_unsigned_LEB_128_x): ... this new function.
51 (read_signed_LEB_128): Replaced with inline definition and ...
52 (read_signed_LEB_128_x): ... this new function.
53 * int_encoding.h (read_unsigned_LEB_128_x): New function.
54 (read_unsigned_LEB_128): Add inline definition.
55 (read_signed_LEB_128_x): New function.
56 (read_signed_LEB_128): Add inline definition.
57 * testsuite/Makefile.am (leb128_unittest): New unit test.
58 * testsuite/Makefile.in: Regenerate.
59 * testsuite/leb128_unittest.cc: New unit test.
61 2012-01-23 Ian Lance Taylor <iant@google.com>
64 * i386.cc (Target_i386::do_code_fill): When using a jmp
65 instruction, pad with nop instructions.
66 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
68 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
70 * x86_64.cc (gc_process_relocs): Add typename on types used in
72 (scan_relocs): Likewise.
73 (relocate_section): Likewise.
74 (apply_relocation): Likewise.
76 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
78 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
79 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
82 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
84 * x86_64.cc: Initial support for x32.
86 2012-01-03 Cary Coutant <ccoutant@google.com>
88 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
89 Use abstract base class for GOT.
90 * gold/output.h (class Output_data_got_base): New abstract base class.
91 (class Output_data_got): Derive from new base class, adjust ctors.
92 (Output_data_got::reserve_slot): Make virtual; rename to
93 do_reserve_slot; Adjust callers.
94 * gold/target.h (Sized_target::init_got_plt_for_update): Return
95 pointer to abstract base class.
96 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
98 2011-12-18 Ian Lance Taylor <iant@google.com>
100 * object.h (Relobj::local_symbol_value): New function.
101 (Relobj::local_plt_offset): New function.
102 (Relobj::local_has_got_offset): New function.
103 (Relobj::local_got_offset): New function.
104 (Relobj::set_local_got_offset): New function.
105 (Relobj::do_local_symbol_value): New pure virtual function.
106 (Relobj::do_local_plt_offset): Likewise.
107 (Relobj::do_local_has_got_offset): Likewise.
108 (Relobj::do_local_got_offset): Likewise.
109 (Relobj::do_set_local_got_offset): Likewise.
110 (Sized_relobj::do_local_has_got_offset): Rename from
111 local_has_got_offset.
112 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
113 (Sized_relobj::do_set_local_got_offset): Rename from
114 set_local_got_offset.
115 (Sized_relobj_file::do_local_plt_offset): Rename from
117 (Sized_relobj_file::do_local_symbol_value): New function.
118 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
120 * output.cc (Output_data_got::Got_entry::write): Change object to
121 Relobj. Use local_symbol_value.
122 (Output_data_got::add_global_with_rel): Change rel_dyn to
123 Output_data_reloc_generic*. Use add_global_generic.
124 (Output_data_got::add_global_with_rela): Remove. Change all
125 callers to use add_global_with_rel.
126 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
127 Output_data_reloc_generic*. Use add_global_generic.
128 (Output_data_got::add_global_pair_with_rela): Remove. Change all
129 callers to use add_global_pair_with_rel.
130 (Output_data_got::add_local): Change object to Relobj*.
131 (Output_data_got::add_local_plt): Likewise.
132 (Output_data_got::add_local_with_rel): Change object to Relobj*,
133 change rel_dyn to Output_data_reloc_generic*. Use
135 (Output_data_got::add_local_with_rela): Remove. Change all
136 callers to use all_local_with_rel.
137 (Output_data_got::add_local_pair_with_rel): Change object to
138 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
139 add_output_section_generic.
140 (Output_data_got::add_local_pair_with_rela): Remove. Change all
141 callers to use add_local_pair_with_rel.
142 (Output_data_got::reserve_local): Change object to Relobj*.
143 * output.h: (class Output_data_reloc_generic): Add pure virtual
144 declarations for add_global_generic, add_local_generic,
145 add_output_section_generic.
146 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
147 functions for Output_data_reloc_generic. Update declarations for
148 changes listed in output.cc.
149 (class Output_data_got): Change template parameter to got_size.
150 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
151 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
153 (Sized_relobj_incr::do_local_plt_offset): New function.
154 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
157 2011-12-17 Cary Coutant <ccoutant@google.com>
159 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
160 * resolve.cc (Symbol_table::resolve): Likewise.
161 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
163 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
165 2011-12-16 Ian Lance Taylor <iant@google.com>
167 * output.h (Output_data_reloc_generic::add): Only call
168 add_dynamic_reloc if this is a dynamic reloc section.
170 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
173 * target-reloc.h (apply_relocation): Replace <64, false> with
176 2011-11-25 Nick Clifton <nickc@redhat.com>
178 * po/it.po: New Italian translation.
180 2011-11-17 Sterling Augustine <saugustine@google.com>
182 * script.cc (script_include_directive): Implement.
183 (read_script_file): New local variables name and search_path. Update
184 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
185 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
186 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
188 2011-11-11 Sterling Augustine <saugustine@google.com>
190 * yyscript.y (section_cmd): Add support for INCLUDE directive.
191 (file_or_sections_cmd): Likewise.
193 2011-11-11 Doug Kwan <dougkwan@google.com>
195 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
196 if --just-symbols is given.
198 2011-11-10 Doug Kwan <dougkwan@google.com>
201 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
202 when processing data relocs.
203 * reloc.h (Relocate_functions::rel_unaligned): New method.
204 (Relocate_functions::pcrel_unaligned): Ditto.
205 (Relocate_functions::rel32_unaligned): Ditto.
206 (Relocate_functions::pcrel32_unaligned): Ditto.
208 2011-11-09 Doug Kwan <dougkwan@google.com>
211 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
212 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
213 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
214 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
215 (Relocate_functions::rel_unaligned): New.
216 (Relocate_functions::rel32_unaligned): New.
217 * target-reloc.h (relocate_for_relocatable): Add code to handle
218 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
219 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
220 arm_unaligned_reloc_r): New targets.
221 * testsuite/Makefile.in: Regenerate.
222 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
225 2011-11-02 Ian Lance Taylor <iant@google.com>
227 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
229 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
230 * options.cc (General_options::finalize): Use library search path
231 from configure script if specified. If not native and no sysroot,
232 only search TOOLLIBDIR.
233 * options.h (Search_directory::Search_directory): Change name to
235 (General_options::add_to_library_path_with_sysroot): Change arg to
237 * configure, Makefile.in, config.in: Rebuild.
239 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
241 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
242 we are working around the ARM1176 Erratum.
243 * options.h (General_options::fix_arm1176): Add option.
244 * testsuite/Makefile.am: Add testcases, and keep current ones
246 * testsuite/Makefile.in: Regenerate.
247 * testsuite/arm_fix_1176.s: New file.
248 * testsuite/arm_fix_1176.sh: Likewise.
250 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
252 * arm.cc (Target_arm::Target_arm): Remove initialisation of
254 (Target_arm::may_use_blx): Remove method.
255 (Target_arm::set_may_use_blx): Likewise.
256 (Target_arm::may_use_v4t_interworking): New method.
257 (Target_arm::may_use_v5t_interworking): Likewise.
258 (Target_arm::may_use_blx_): Remove member variable.
259 (Arm_relocate_functions::arm_branch_common): Check for v5T
261 (Arm_relocate_functions::thumb_branch_common): Likewise.
262 (Reloc_stub::stub_type_for_reloc): Likewise.
263 (Target_arm::do_finalize_sections): Correct interworking checks.
264 * testsuite/Makefile.am: Add new tests.
265 * testsuite/Makefile.in: Regenerate.
266 * testsuite/arm_farcall_arm_arm.s: New test.
267 * testsuite/arm_farcall_arm_arm.sh: Likewise.
268 * testsuite/arm_farcall_arm_thumb.s: Likewise.
269 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
270 * testsuite/arm_farcall_thumb_arm.s: Likewise.
271 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
272 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
273 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
275 2011-10-31 Cary Coutant <ccoutant@google.com>
278 * expression.cc (Expression::eval_with_dot): Add
279 is_section_dot_assignment parameter.
280 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
281 absolute and assigning to dot within a section.
283 (Output_section_element_assignment::set_section_addresses): Pass
284 dot_section to set_if_absolute.
285 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
286 as is_section_dot_assignment flag to eval_with_dot.
287 (Output_section_element_dot_assignment::set_section_addresses):
289 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
290 parameter. Also set value if relative to dot_section; set the
291 symbol's output_section.
292 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
293 parameter. Adjust all callers.
294 (Expression::eval_maybe_dot): Likewise.
295 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
297 * testsuite/script_test_2.t: Test assignment of an absolute value
298 to dot within an output section element.
300 2011-10-31 Cary Coutant <ccoutant@google.com>
302 * options.h (class General_options): Add --[no-]gnu-unique options.
303 * symtab.cc (Symbol_table::sized_write_globals): Convert
304 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
306 2011-10-31 Cary Coutant <ccoutant@google.com>
309 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
310 unnecessary assertion.
311 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
313 2011-10-31 Sriraman Tallam <tmsriram@google.com>
315 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
317 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
319 Change to just keep the section associated with symbol.
320 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
321 they are externally visible and --export-dynamic is turned on.
322 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
324 2011-10-19 Ian Lance Taylor <iant@google.com>
328 (Output_section_element_dot_assignment::needs_output_section): New
331 2011-10-19 Ian Lance Taylor <iant@google.com>
334 * layout.cc (Layout::segment_precedes): Don't assert failure if a
335 --section-start option was seen.
336 * options.h (General_options::any_section_start): New function.
338 2011-10-18 David S. Miller <davem@davemloft.net>
341 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
342 member to track relocation locations that have moved during TLS
344 (Target_sparc::Relocate::Relocate): Initialize to NULL.
345 (Target_sparc::Relocate::relocate): Adjust view down by 4
346 bytes if it matches reloc_adjust_addr_.
347 (Target_sparc::Relocate::relocate_tls): Always move the
348 __tls_get_addr call delay slot instruction forward 4 bytes when
349 performing relaxation.
351 2011-10-18 Cary Coutant <ccoutant@google.com>
353 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
354 (Output_file::map_no_anonymous): Check for non-zero
355 return code from posix_fallocate.
357 2011-10-17 Cary Coutant <ccoutant@google.com>
360 * plugin.cc (is_visible_from_outside): Check for symbols
361 referenced from dynamic objects.
362 * resolve.cc (Symbol_table::resolve): Don't count references
363 from dynamic objects as references from real ELF files.
364 * testsuite/plugin_test_2.sh: Adjust expected result.
366 2011-10-17 Cary Coutant <ccoutant@google.com>
368 * gold.cc: Include timer.h.
369 (queue_middle_tasks): Stamp time.
370 (queue_final_tasks): Likewise.
371 * main.cc (main): Store timer in parameters. Print timers
373 * parameters.cc (Parameters::Parameters): Initialize timer_.
374 (Parameters::set_timer): New function.
375 (set_parameters_timer): New function.
376 * parameters.h (Parameters::set_timer): New function.
377 (Parameters::timer): New function.
378 (Parameters::timer_): New data member.
379 (set_parameters_timer): New function.
380 * timer.cc (Timer::stamp): New function.
381 (Timer::get_pass_time): New function.
382 * timer.h (Timer::stamp): New function.
383 (Timer::get_pass_time): New function.
384 (Timer::pass_times_): New data member.
386 2011-10-17 Cary Coutant <ccoutant@google.com>
388 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
389 task for members of lib groups.
391 2011-10-17 Cary Coutant <ccoutant@google.com>
394 * fileread.cc (File_read::find_view): Add assert.
395 (File_read::make_view): Move bounds check (replace with assert)...
396 (File_read::find_or_make_view): ... to here.
398 2011-10-12 Cary Coutant <ccoutant@google.com>
400 * output.cc (Output_file::open_base_file): Handle case where
401 ::read returns less than requested size.
403 2011-10-10 Cary Coutant <ccoutant@google.com>
405 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
406 Initialize defined_count_.
407 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
408 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
409 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
410 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
411 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
412 * incremental.h (Sized_relobj_incr::defined_count_): New data
414 (Sized_incr_dynobj::defined_count_): New data member.
415 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
416 Return zeroes instead of internal error.
418 2011-10-10 Cary Coutant <ccoutant@google.com>
421 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
422 (Output_reloc::symbol_value): Return PLT offset if flag is set.
423 * output.h (class Output_reloc): Add use_plt_offset flag.
424 (Output_reloc::type_): Adjust size of bit field.
425 (Output_reloc::use_plt_offset_): New bit field.
426 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
427 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
428 flag. Adjust all callers.
429 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
430 creating RELATIVE relocations.
432 2011-10-10 Nick Clifton <nickc@redhat.com>
434 * po/es.po: Updated Spanish translation.
435 * po/fi.po: Updated Finnish translation.
437 2011-10-03 Diego Novillo <dnovillo@google.com>
439 * options.cc (parse_uint): Fix dereference of RETVAL.
441 2011-09-29 Sriraman Tallam <tmsriram@google.com>
443 * layout.h (section_order_map_): New member.
444 (get_section_order_map): New member function.
445 * output.cc (Output_section::add_input_section): Check for patterns
446 only when --section-ordering-file is specified.
447 * gold.cc (queue_middle_tasks): Delay updating order of sections till
448 output_sections have been formed.
449 * layout.cc (Layout_Layout): Initialize section_order_map_.
450 * plugin.cc (update_section_order): Store order in order_map. Do not
452 * testsuite/Makefile.am: Add test case for plugin_final_layout.
453 * testsuite/Makefile.in: Regenerate.
454 * testsuite/plugin_section_order.c: New file.
455 * testsuite/plugin_final_layout.cc: New file.
456 * testsuite/plugin_final_layout.sh: New file.
458 2011-09-29 Cary Coutant <ccoutant@google.com>
460 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
462 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
463 symbols during incremental update.
464 (Symbol_table::add_from_dynobj): Likewise.
466 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
467 Ian Lance Taylor <iant@google.com>
469 * symtab.cc (Symbol_table::define_special_symbol): Always
470 canonicalize version string.
472 2011-09-26 Cary Coutant <ccoutant@google.com>
474 * gold.cc (queue_initial_tasks): Move option checks ...
475 * options.cc (General_options::finalize): ... to here. Disable
476 some options; make others fatal.
478 2011-09-26 Cary Coutant <ccoutant@google.com>
481 * plugin.cc (get_symbols_v2): New function.
482 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
483 (is_referenced_from_outside): New function.
484 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
485 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
486 (get_symbols): Pass version parameter.
487 (get_symbols_v2): New function.
488 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
490 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
491 (onload): Add LDPT_GET_SYMBOLS_V2.
492 (all_symbols_read_hook): Use get_symbols_v2; check for
493 LDPR_PREVAILING_DEF_IRONLY_EXP.
494 * testsuite/plugin_test_3.sh: Update expected results.
496 2011-09-23 Simon Baldwin <simonb@google.com>
498 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
499 configuration options.
500 * configure: Regenerate.
501 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
502 * Makefile.in: Regenerate.
503 * testsuite/Makefile.in: Regenerate.
505 2011-09-19 Sriraman Tallam <tmsriram@google.com>
507 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
509 2011-09-19 Cary Coutant <ccoutant@google.com>
511 * incremental.cc (can_incremental_update): Fix typo in comment.
512 * incremental.h (can_incremental_update): Likewise.
514 2011-09-18 Cary Coutant <ccoutant@google.com>
516 * incremental.cc (can_incremental_update): New function.
517 * incremental.h (can_incremental_update): New function.
518 * layout.cc (Layout::init_fixed_output_section): Call it.
519 (Layout::make_output_section): Don't allow patch space in .eh_frame.
520 * object.cc (Sized_relobj_file::do_layout): Call
521 can_incremental_update.
523 2011-09-13 Cary Coutant <ccoutant@google.com>
525 * configure.ac: Check for glibc support for gnu_indirect_function
526 support with static linking, setting automake conditional
528 * Makefile.in: Regenerate.
529 * configure: Regenerate.
531 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
532 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
534 * testsuite/Makefile.in: Regenerate.
536 2011-09-13 Cary Coutant <ccoutant@google.com>
538 * incremental.cc (Sized_relobj_incr::do_layout): Call
539 report_comdat_group for kept comdat sections.
540 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
541 * testsuite/Makefile.in: Regenerate.
542 * testsuite/incr_comdat_test_1.cc: New source file.
543 * testsuite/incr_comdat_test_2_v1.cc: New source file.
544 * testsuite/incr_comdat_test_2_v2.cc: New source file.
545 * testsuite/incr_comdat_test_2_v3.cc: New source file.
547 2011-09-13 Ian Lance Taylor <iant@google.com>
549 * object.cc (Sized_relobj_file::do_layout): Remove unused local
550 variable external_symbols_offset.
552 2011-09-12 Ian Lance Taylor <iant@google.com>
554 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
555 triggered if object has no symbols.
557 2011-09-09 David S. Miller <davem@davemloft.net>
559 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
560 (Output_fill_debug_line::do_write): Likewise.
562 2011-08-29 Cary Coutant <ccoutant@google.com>
564 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
565 casts to match formatting specs.
566 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
568 2011-08-26 Cary Coutant <ccoutant@google.com>
570 * layout.cc (Free_list::allocate): Provide guarantee of minimum
571 remaining hole size when allocating.
572 (Layout::make_output_section): Set fill methods for debug sections.
573 * layout.h (Free_list::Free_list_node): Move from private to
575 (Free_list::set_min_hole_size): New function.
576 (Free_list::begin, Free_list::end): New functions.
577 (Free_list::min_hole_): New data member.
578 * output.cc: Include dwarf.h.
579 (Output_fill_debug_info::do_minimum_hole_size): New function.
580 (Output_fill_debug_info::do_write): New function.
581 (Output_fill_debug_line::do_minimum_hole_size): New function.
582 (Output_fill_debug_line::do_write): New function.
583 (Output_section::Output_section): Initialize new data member.
584 (Output_section::set_final_data_size): Ensure patch space is larger
585 than minimum hole size.
586 (Output_section::do_write): Fill holes in debug sections.
587 * output.h (Output_fill): New class.
588 (Output_fill_debug_info): New class.
589 (Output_fill_debug_line): New class.
590 (Output_section::set_free_space_fill): New function.
591 (Output_section::free_space_fill_): New data member.
592 * testsuite/Makefile.am (incremental_test_3): Add
593 --incremental-patch option.
594 (incremental_test_4): Likewise.
595 (incremental_test_5): Likewise.
596 (incremental_test_6): Likewise.
597 (incremental_copy_test): Likewise.
598 (incremental_common_test_1): Likewise.
599 * testsuite/Makefile.in: Regenerate.
601 2011-08-26 Nick Clifton <nickc@redhat.com>
603 * po/es.po: Updated Spanish translation.
605 2011-08-01 Cary Coutant <ccoutant@google.com>
607 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
608 * gold/testsuite/Makefile.in: Regenerate.
609 * gold/testsuite/justsyms_exec.c: New source file.
610 * gold/testsuite/justsyms_lib.c: New source file.
612 2011-08-01 Cary Coutant <ccoutant@google.com>
614 * layout.cc (Layout::set_segment_offsets): Don't realign text
615 segment if -Ttext was specified.
616 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
618 * object.h (Sized_relobj_file::e_type): New function.
619 (Sized_relobj_file::e_type_): New data member.
620 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
621 base address for ET_EXEC files.
622 * target.cc (Target::do_make_elf_object_implementation): Allow
623 ET_EXEC files with --just-symbols option.
625 2011-07-28 Cary Coutant <ccoutant@google.com>
627 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
628 Add thread_number parameter.
629 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
630 * workqueue-threads.cc
631 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
632 current thread if its thread number is greater than desired thread
634 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
635 Add thread_number parameter.
636 (Workqueue::should_cancel_thread): Likewise.
637 (Workqueue::find_runnable_or_wait): Pass thread_number to
638 should_cancel_thread.
639 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
642 2011-07-22 Sriraman Tallam <tmsriram@google.com>
644 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
645 only after checking if it cannot be forced local.
646 * symtab.h (is_externally_visible): Check if the symbol is not forced
649 2011-07-15 Ian Lance Taylor <iant@google.com>
651 * options.h (class General_options): Add --print-output-format.
652 Move -EL next to -EB, for better --help output.
653 * target-select.cc: Include <cstdio>, "options.h", and
655 (Target_selector::do_target_bfd_name): New function.
656 (print_output_format): New function.
657 * target-select.h (class Target_selector): Update declarations.
658 (Target_selector::target_bfd_name): New function.
659 (print_output_format): Declare.
660 * main.cc: Include "target-select.h".
661 (main): Handle --print-output-format.
662 * gold.cc: Include "target-select.h".
663 (queue_initial_tasks): Handle --print-output-format when there are
665 * parameters.cc (parameters_force_valid_target): Give a better
666 error message if -EB/-EL does not match target.
667 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
670 2011-07-15 Ian Lance Taylor <iant@google.com>
672 * i386.cc (class Output_data_plt_i386): Add layout_ field.
673 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
674 (Output_data_plt_i386::do_write): Write address of .dynamic
675 section to first entry in .got.plt section.
676 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
677 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
679 (Output_data_plt_x86_64::do_write): Write address of .dynamic
680 section to first entry in .got.plt section.
681 * layout.h (Layout::dynamic_section): New function.
683 2011-07-13 Sriraman Tallam <tmsriram@google.com>
685 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
687 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
688 input_section_position_, and input_section_glob_.
689 (read_layout_from_file): Call function section_ordering_specified.
690 * layout.h (is_section_ordering_specified): New function.
691 (section_ordering_specified): New function.
692 (section_ordering_specified_): New boolean member.
693 * main.cc(main): Call load_plugins after layout object is defined.
694 * output.cc (Output_section::add_input_section): Use
695 function section_ordering_specified to check if section ordering is
697 * output.cc (Output_section::add_relaxed_input_section): Use
698 function section_ordering_specified to check if section ordering is
700 (Output_section::update_section_layout): New function.
701 (Output_section::sort_attached_input_sections): Check if input section
703 * output.h (Output_section::update_section_layout): New function.
704 * plugin.cc (get_section_count): New function.
705 (get_section_type): New function.
706 (get_section_name): New function.
707 (get_section_contents): New function.
708 (update_section_order): New function.
709 (allow_section_ordering): New function.
710 (Plugin::load): Add the new interfaces to the transfer vector.
711 (Plugin_manager::load_plugins): New parameter.
712 (Plugin_manager::all_symbols_read): New parameter.
713 (Plugin_manager::claim_file): New parameter. Save the elf object for
715 (Plugin_manager::get_elf_object): New function.
716 (Plugin_manager::get_view): Change to directly use the bool to check
717 if get_view is called from claim_file_hook.
718 * plugin.h (input_objects): New function
719 (Plugin__manager::load_plugins): New parameter.
720 (Plugin_manager::claim_file): New parameter.
721 (Plugin_manager::get_elf_object): New function.
722 (Plugin_manager::in_claim_file_handler): New function.
723 (Plugin_manager::in_claim_file_handler_): New member.
724 (layout): New function.
725 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
726 handler with an extra parameter. Make the elf object before calling
728 * testsuite/plugin_test.c (get_section_count): New function pointer.
729 (get_section_type): New function pointer.
730 (get_section_name): New function pointer.
731 (get_section_contents): New function pointer.
732 (update_section_order): New function pointer.
733 (allow_section_ordering): New function pointer.
734 (onload): Check if the new interfaces exist.
736 2011-07-13 Ian Lance Taylor <iant@google.com>
738 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
740 * x86_64.cc (Target_x86_64::got_section): Likewise.
741 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
742 (relro_now_test_SOURCES): New variable.
743 (relro_now_test_DEPENDENCIES): New variable.
744 (relro_now_test_LDFLAGS): New variable.
745 (relro_now_test_LDADD): New variable.
746 (relro_now_test.so): New target.
747 * testsuite/Makefile.in: Rebuild.
749 2011-07-12 Ian Lance Taylor <iant@google.com>
752 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
753 GLOB_DAT relocation rather than a RELATIVE relocation for a
754 protected symbol when creating a shared library.
755 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
756 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
757 * testsuite/protected_main_1.cc (main): Test that protected
758 function has same address.
760 2011-07-11 Ian Lance Taylor <iant@google.com>
763 * options.h (class General_options): Add -Bgroup.
764 * options.cc (General_options::finalize): If -Bgroup is set,
765 default to --unresolved-symbols=report-all.
766 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
767 * target-reloc.h (issue_undefined_symbol_error): Handle
768 --unresolved-symbols=report-all.
770 2011-07-08 Ian Lance Taylor <iant@google.com>
773 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
774 if linker script discards key sections.
775 (Layout::create_dynamic_symtab): Likewise.
776 (Layout::assign_local_dynsym_offsets): Likewise.
777 (Layout::sized_create_version_sections): Likewise.
778 (Layout::create_interp): Likewise.
779 (Layout::finish_dynamic_section): Likewise.
780 (Layout::set_dynamic_symbol_size): Likewise.
782 2011-07-08 Ian Lance Taylor <iant@google.com>
785 * options.h (class General_options): Add --unresolved-symbols.
786 * target-reloc.h (issue_undefined_symbol_error): Check
787 --unresolved-symbols. Add comments.
789 2011-07-08 Ian Lance Taylor <iant@google.com>
791 * testsuite/odr_violation2.cc (Ordering::operator()): Make
792 expression more complex.
794 2011-07-08 Ian Lance Taylor <iant@google.com>
797 * target-reloc.h (issue_undefined_symbol_error): New inline
798 function, broken out of relocate_section.
799 (relocate_section): Call issue_undefined_symbol_error.
800 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
801 there is no TLS segment if we are about to issue an undefined
803 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
805 2011-07-08 Ian Lance Taylor <iant@google.com>
808 * resolve.cc (Symbol_table::should_override): Add fromtype
809 parameter. Change all callers. Give error when linking together
810 TLS and non-TLS symbol.
811 (Symbol_table::should_override_with_special): Add fromtype
812 parameter. Change all callers.
813 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
814 there is no TLS segment if we have reported some errors.
815 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
817 2011-07-08 Ian Lance Taylor <iant@google.com>
820 * target.h (Target::plt_address_for_global): New function.
821 (Target::plt_address_for_local): New function.
822 (Target::plt_section_for_global): Remove.
823 (Target::plt_section_for_local): Remove.
824 (Target::do_plt_address_for_global): New virtual function.
825 (Target::do_plt_address_for_local): New virtual function.
826 (Target::do_plt_section_for_global): Remove.
827 (Target::do_plt_section_for_local): Remove.
828 (Target::register_global_plt_entry): Add Symbol_table and Layout
830 * output.cc (Output_data_got::Got_entry::write): Use
831 plt_address_for_global and plt_address_for_local.
832 * layout.cc (Layout::add_target_dynamic_tags): Use size and
833 address of output section.
834 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
835 got_irelative_, and irelative_count_ fields. Update
837 (Output_data_plt_i386::has_irelative_section): New function.
838 (Output_data_plt_i386::entry_count): Add irelative_count_.
839 (Output_data_plt_i386::set_final_data_size): Likewise.
840 (class Target_i386): Add got_irelative_ and rel_irelative_
841 fields. Update declarations.
842 (Target_i386::Target_i386): Initialize new fields.
843 (Target_i386::do_plt_address_for_global): New function replacing
844 do_plt_section_for_global.
845 (Target_i386::do_plt_address_for_local): New function replacing
846 do_plt_section_for_local.
847 (Target_i386::got_section): Create got_irelative_.
848 (Target_i386::rel_irelative_section): New function.
849 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
850 fields. Don't define __rel_iplt_{start,end}.
851 (Output_data_plt_i386::add_entry): Add symtab and layout
852 parameters. Change all callers. Use different PLT and GOT for
854 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
855 layout parameters. Change all callers. Use different PLT and
857 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
858 (Output_data_plt_i386::rel_irelative): New function.
859 (Output_data_plt_i386::address_for_global): New function.
860 (Output_data_plt_i386::address_for_local): New function.
861 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
862 IRELATIVE GOT when changing IFUNC GOT entries.
863 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
865 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
866 if we didn't create an IRELATIVE GOT.
867 (Target_i386::Relocate::relocate): Use plt_address_for_global and
868 plt_address_for_local.
869 (Target_i386::do_dynsym_value): Use plt_address_for_global.
870 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
871 got_irelative_, and irelative_count_ fields. Update
873 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
874 Initialize new fields. Remove symtab parameter. Change all
876 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
878 (Output_data_plt_x86_64::has_irelative_section): New function.
879 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
880 (class Target_x86_64): Add got_irelative_ and rel_irelative_
881 fields. Update declarations.
882 (Target_x86_64::Target_x86_64): Initialize new fields.
883 (Target_x86_64::do_plt_address_for_global): New function replacing
884 do_plt_section_for_global.
885 (Target_x86_64::do_plt_address_for_local): New function replacing
886 do_plt_section_for_local.
887 (Target_x86_64::got_section): Create got_irelative_.
888 (Target_x86_64::rela_irelative_section): New function.
889 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
890 all callers. Don't create __rel_iplt_{start,end}.
891 (Output_data_plt_x86_64::add_entry): Add symtab and layout
892 parameters. Change all callers. Use different PLT and GOT for
894 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
895 layout parameters. Change all callers. Use different PLT and
897 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
898 parameters. Change all callers. Use different PLT and GOT for
900 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
901 (Output_data_plt_x86_64::rela_irelative): New function.
902 (Output_data_plt_x86_64::address_for_global): New function.
903 (Output_data_plt_x86_64::address_for_local): New function.
904 (Output_data_plt_x86_64::set_final_data_size): Likewise.
905 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
906 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
907 (Target_x86_64::register_global_plt_entry): Add symtab and layout
909 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
911 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
912 symbols if we didn't create an IRELATIVE GOT.
913 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
914 plt_address_for_local.
915 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
916 * testsuite/ifuncvar1.c: New test file.
917 * testsuite/ifuncvar2.c: New test file.
918 * testsuite/ifuncvar3.c: New test file.
919 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
920 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
921 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
922 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
923 * testsuite/Makefile.in: Rebuild.
925 2011-07-07 Cary Coutant <ccoutant@google.com>
927 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
928 (two_file_test_1_ndebug.o): Likewise.
929 (two_file_test_1b_ndebug.o): Likewise.
930 (two_file_test_2_ndebug.o): Likewise.
931 (two_file_test_main_ndebug.o): Likewise.
932 (incremental_test_2): Link with no-debug versions.
934 2011-07-06 Cary Coutant <ccoutant@google.com>
936 * gold/incremental.cc
937 (Output_section_incremental_inputs::write_info_blocks): Check for
938 hidden and internal symbols.
940 2011-07-06 Cary Coutant <ccoutant@google.com>
942 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
943 Check disposition for startup file.
944 (Incremental_inputs::report_command_line): Ignore
945 --incremental-startup-unchanged option.
946 * options.cc (General_options::parse_incremental_startup_unchanged):
948 (General_options::General_options): Initialize new data member.
949 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
950 (General_options): Add --incremental-startup-unchanged option.
951 (General_options::incremental_startup_disposition): New function.
952 (General_options::incremental_startup_disposition_): New data member.
954 2011-07-06 Cary Coutant <ccoutant@google.com>
956 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
957 input file index to Script_info ctor.
958 (Sized_incremental_binary::do_file_has_changed): Find the
959 command-line argument for files named in scripts.
960 * incremental.h (Script_info::Script_info): New ctor
961 with input file index.
962 (Script_info::input_file_index): New function.
963 (Script_info::input_file_index_): New data member.
964 (Incremental_binary::get_library): Add const.
965 (Incremental_binary::get_script_info): Add const.
966 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
967 * testsuite/Makefile.am (incremental_test_5): New test case.
968 (incremental_test_6): New test case.
969 * testsuite/Makefile.in: Regenerate.
971 2011-07-06 Cary Coutant <ccoutant@google.com>
973 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
974 debug output when command lines differ.
976 2011-07-06 Cary Coutant <ccoutant@google.com>
978 * incremental.cc (Incremental_inputs::report_command_line): Ignore
979 --incremental-patch option.
980 * layout.cc (Free_list::allocate): Extend allocation beyond original
982 (Layout::make_output_section): Mark sections that should get
984 * options.cc (parse_percent): New function.
985 * options.h (parse_percent): New function.
986 (DEFINE_percent): New macro.
987 (General_options): Add --incremental-patch option.
988 * output.cc (Output_section::Output_section): Initialize new data
990 (Output_section::add_input_section): Print section name when out
992 (Output_section::add_output_section_data): Likewise.
993 (Output_section::set_final_data_size): Add patch space when
994 doing --incremental-full.
995 (Output_section::do_reset_address_and_file_offset): Remove patch
997 (Output_segment::set_section_list_addresses): Print debug output
998 only if --incremental-update.
999 * output.h (Output_section::set_is_patch_space_allowed): New function.
1000 (Output_section::is_patch_space_allowed_): New data member.
1001 (Output_section::patch_space_): New data member.
1002 * parameters.cc (Parameters::incremental_full): New function.
1003 * parameters.h (Parameters::incremental_full): New function
1004 * testsuite/Makefile.am (incremental_test_2): Add test for
1005 --incremental-patch option.
1006 * testsuite/Makefile.in: Regenerate.
1007 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
1008 (t18): Remove function body.
1010 2011-07-05 Doug Kwan <dougkwan@google.com>
1013 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
1014 Arm_Address type for relocation result.
1015 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
1017 (Arm_relocate_functions::abs32): Use unaligned access.
1018 (Arm_relocate_functions::rel32): Ditto.
1019 (Arm_relocate_functions::prel31): Ditto.
1020 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
1021 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
1022 static data relocations.
1023 * testsuite/Makefile.in: Regnerate.
1024 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
1026 2011-07-05 Ian Lance Taylor <iant@google.com>
1029 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
1030 symbols if necessary.
1031 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1033 2011-07-05 Ian Lance Taylor <iant@google.com>
1036 * resolve.cc (Symbol::override_base_with_special): Simply override
1037 version with special symbol version, ignoring previous version.
1039 2011-07-05 Ian Lance Taylor <iant@google.com>
1041 * object.cc (Sized_relobj_file::include_section_group): Add
1042 information to comment about signature location.
1044 2011-07-02 Ian Lance Taylor <iant@google.com>
1047 * options.h (class General_options): Add -f and -F.
1048 * options.cc (General_options::finalize): Fatal error if -f/-F
1049 are used without -shared.
1050 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
1052 2011-07-02 Ian Lance Taylor <iant@google.com>
1054 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
1056 2011-07-01 Ian Lance Taylor <iant@google.com>
1060 * resolve.cc (Symbol::override_base_with_special): Don't override
1061 the version if the overriding symbol has a different name.
1062 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
1063 all callers. If we give an error about an undefined version,
1064 define the base version if necessary.
1065 * dynobj.h (class Versions): Update declaration.
1066 * testsuite/weak_alias_test_5.cc: New file.
1067 * testsuite/weak_alias_test.script: New file.
1068 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
1069 and versioned_alias have the right value, and call t2.
1070 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
1071 weak_alias_test_5.so.
1072 (weak_alias_test_LDADD): Likewise.
1073 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
1074 * testsuite/Makefile.in: Rebuild.
1076 2011-07-01 Ian Lance Taylor <iant@google.com>
1079 * options.h (class General_options): Support -z notext.
1080 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
1082 (two_file_shared_nonpic.so): Likewise.
1083 (two_file_shared_mixed.so): Likewise.
1084 (two_file_shared_mixed_1.so): Likewise.
1085 (weak_undef_lib_nonpic.so): Likewise.
1086 (alt/weak_undef_lib_nonpic.so): Likewise.
1087 (tls_test_shared_nonpic.so): Likewise.
1088 * testsuite/Makefile.in: Rebuild.
1090 2011-07-01 Ian Lance Taylor <iant@google.com>
1093 * configure.ac: Test whether static linking works, setting
1094 the automake conditional HAVE_STATIC.
1095 * testsuite/Makefile.am: Disable tests using -static if
1096 HAVE_STATIC is not true.
1097 * configure, testsuite/Makefile.in: Rebuild.
1099 2011-07-01 Ian Lance Taylor <iant@google.com>
1102 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
1103 Assert if we see DW_EH_PE_indirect.
1104 * target.h (Target::ehframe_datarel_base): New function.
1105 (Target::do_ehframe_datarel_base): New target function.
1106 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
1107 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
1110 2011-07-01 Ian Lance Taylor <iant@google.com>
1113 * options.h (class General_options): Add
1114 --ld-generated-unwind-info.
1115 * ehframe.cc (Fde::write): Add address parameter. Change all
1116 callers. If associated with PLT, fill in address and size.
1117 (Cie::set_output_offset): Only add merge mapping if there is an
1119 (Cie::write): Add address parameter. Change all callers.
1120 (Eh_frame::add_ehframe_for_plt): New function.
1121 * ehframe.h (class Fde): Update declarations. Move shndx_ and
1122 input_offset_ fields into union u_, with new plt field.
1123 (Fde::Fde): Adjust for new union field.
1124 (Fde::Fde) [Output_data version]: New constructor.
1125 (Fde::add_mapping): Only add merge mapping if there is an object.
1126 (class Cie): Update declarations.
1127 (class Eh_frame): Declare add_ehframe_for_plt.
1128 * layout.cc (Layout::layout_eh_frame): Break out code into
1129 make_eh_frame_section, and call it.
1130 (Layout::make_eh_frame_section): New function.
1131 (Layout::add_eh_frame_for_plt): New function.
1132 * layout.h (class Layout): Update declarations.
1133 * merge.cc (Merge_map::add_mapping): Add assertion.
1134 * i386.cc: Include "dwarf.h".
1135 (class Output_data_plt_i386): Make first_plt_entry,
1136 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
1137 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1138 and plt_eh_frame_fde.
1139 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
1140 boundary. Call add_eh_frame_for_plt if appropriate.
1141 * x86_64.cc: Include "dwarf.h".
1142 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
1143 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
1144 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1145 and plt_eh_frame_fde.
1146 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
1149 2011-06-29 Ian Lance Taylor <iant@google.com>
1152 * object.cc (Sized_relobj_file::layout_section): Change shdr
1153 parameter to be const.
1154 (Sized_relobj_file::layout_eh_frame_section): New function, broken
1156 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
1157 appropriate. Call layout_eh_frame_section.
1158 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
1160 * object.h (class Sized_relobj_file): Update declarations.
1162 2011-06-29 Ian Lance Taylor <iant@google.com>
1165 * script.cc (Token::integer_value): Accept trailing M/m/K/k
1167 (Lex::gather_token): Accept trailing M/m/K/k for integers.
1169 2011-06-29 Ian Lance Taylor <iant@google.com>
1172 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
1174 * layout.cc (Layout::layout_eh_frame): Likewise.
1176 2011-06-29 Ian Lance Taylor <iant@google.com>
1179 * layout.cc (Layout::symtab_section_shndx): New function.
1180 * layout.h (class Layout): Declare symtab_section_shndx.
1181 * output.cc (Output_section::write_header): Call it.
1183 2011-06-29 Ian Lance Taylor <iant@google.com>
1186 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
1187 symbols which are not used in a relocation.
1189 2011-06-28 Ian Lance Taylor <iant@google.com>
1192 * layout.cc (Layout::segment_precedes): Don't crash if a linker
1193 script create indistinguishable segments.
1194 (Layout::set_segment_offsets): Use stable_sort when sorting
1195 segments. Pass this to Compare_segments constructor.
1196 * layout.h (class Layout): Make segment_precedes non-static.
1197 (class Compare_segments): Change from struct to class. Add
1198 layout_ field. Add constructor.
1199 * script-sections.cc
1200 (Script_sections::attach_sections_using_phdrs_clause): Rename
1201 local orphan to is_orphan. Don't report failure to put empty
1202 section in segment. On attachment failure, report name of
1203 section, and attach to first PT_LOAD segment.
1205 2011-06-28 Ian Lance Taylor <iant@google.com>
1208 * target-select.cc (Target_selector::Target_selector): Add
1209 emulation parameter. Change all callers.
1210 (select_target_by_bfd_name): Rename from select_target_by_name.
1212 (select_target_by_emulation): New function.
1213 (supported_emulation_names): New function.
1214 * target-select.h (class Target_selector): Add emulation_ field.
1215 Update declarations.
1216 (Target_selector::recognize_by_bfd_name): Rename from
1217 recognize_by_name. Change all callers.
1218 (Target_selector::supported_bfd_names): Rename from
1219 supported_names. Change all callers.
1220 (Target_selector::recognize_by_emulation): New function.
1221 (Target_selector::supported_emulations): New function.
1222 (Target_selector::emulation): New function.
1223 (Target_selector::do_recognize_by_bfd_name): Rename from
1224 do_recognize_by_name. Change all callers.
1225 (Target_selector::do_supported_bfd_names): Rename from
1226 do_supported_names. Change all callers.
1227 (Target_selector::do_recognize_by_emulation): New function.
1228 (Target_selector::do_supported_emulations): New function.
1229 (select_target_by_bfd_name): Change name in declaration.
1230 (select_target_by_emulation): Declare.
1231 (supported_emulation_names): Declare.
1232 * parameters.cc (parameters_force_valid_target): Try to find
1233 target based on emulation from -m option.
1234 * options.h (class General_options): Change doc string for -m.
1235 * options.cc (help): Print emulations.
1236 (General_options::parse_V): Likewise.
1237 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1238 Add emulation parameter. Change all callers.
1240 2011-06-28 Ian Lance Taylor <iant@google.com>
1242 * target.h (class Target): Add osabi_ field.
1243 (Target::osabi): New function.
1244 (Target::set_osabi): New function.
1245 (Target::Target): Initialize osabi_.
1246 (Target::do_adjust_elf_header): Make pure virtual.
1247 (Sized_target::do_adjust_elf_header): Declare.
1248 * target.cc (Sized_target::do_adjust_elf_header): New function.
1249 (class Sized_target): Instantiate all versions.
1250 * freebsd.h (class Target_freebsd): Remove.
1251 (Target_selector_freebsd::do_recognize): Call set_osabi on
1253 (Target_selector_freebsd::do_recognize_by_name): Likewise.
1254 (Target_selector_freebsd::set_osabi): Remove.
1255 * i386.cc (class Target_i386): Inherit from Sized_target rather
1256 than Target_freebsd.
1257 * x86_64.cc (class Target_x86_64): Likewise.
1259 2011-06-28 Ian Lance Taylor <iant@google.com>
1261 * target.h (Target::can_check_for_function_pointers): Rewrite.
1263 (Target::can_icf_inline_merge_sections): Likewise.
1264 (Target::section_may_have_icf_unsafe_poineters): Likewise.
1265 (Target::Target_info): Add can_icf_inline_merge_sections field.
1266 (Target::do_can_check_for_function_pointers): New virtual
1268 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
1269 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
1270 from can_check_for_function_pointers, move in file.
1271 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
1272 section_may_have_icf_unsafe_poineters, move in file.
1273 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
1274 * i386.cc (Target_i386::do_can_check_for_function_pointers):
1275 Rename from can_check_for_function_pointers, move in file.
1276 (Target_i386::can_icf_inline_merge_sections): Remove.
1277 (Target_i386::i386_info): Initialize
1278 can_icf_inline_merge_sections.
1279 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1280 Initialize can_icf_inline_merge_sections.
1281 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
1282 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
1283 Rename from can_check_for_function_pointers, move in file.
1284 (Target_x86_64::can_icf_inline_merge_sections): Remove.
1285 (Target_x86_64::x86_64_info): Initialize
1286 can_icf_inline_merge_sections.
1287 * testsuite/testfile.cc (Target_test::test_target_info):
1289 * icf.cc (get_section_contents): Correct formatting.
1291 2011-06-27 Ian Lance Taylor <iant@google.com>
1293 * symtab.cc (Symbol::versioned_name): New function.
1294 (Symbol_table::add_to_final_symtab): Use versioned_name when
1296 (Symbol_table::sized_write_symbol): Likewise.
1297 * symtab.h (class Symbol): Declare versioned_name.
1298 * stringpool.h (class Stringpool_template): Add variant of add
1299 which takes a std::basic_string.
1300 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
1301 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
1302 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
1303 (ver_test_12.o): New target.
1304 * testsuite/Makefile.in: Rebuild.
1306 2011-06-27 Doug Kwan <dougkwan@google.com>
1308 * arm.cc (Arm_relocate_functions::thm_jump8,
1309 Arm_relocate_functions::thm_jump11): Use a wider signed
1310 type to compute offset.
1311 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
1313 * testsuite/Makefile.in: Regenerate.
1314 * testsuite/arm_branch_in_range.sh: Check test results of
1315 arm_thm_jump11 and arm_thm_jump8.
1316 * testsuite/arm_thm_jump11.s: New test source file.
1317 * testsuite/arm_thm_jump11.t: New linker script.
1318 * testsuite/arm_thm_jump8.s: New test source file.
1319 * testsuite/arm_thm_jump8.t: New linker script.
1321 2011-06-24 Ian Lance Taylor <iant@google.com>
1323 * layout.cc: Include "object.h".
1324 (ctors_sections_in_init_array): New static variable.
1325 (Layout::is_ctors_in_init_array): New function.
1326 (Layout::layout): Add entry to ctors_sections_in_init_array if
1328 * layout.h (class Layout): Declare is_ctors_in_init_array.
1329 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
1330 is_ctors_reverse_view is set.
1331 (Sized_relobj_file::write_sections): Add layout parameter. Change
1332 all callers. Set is_ctors_reverse_view field of View_size.
1333 (Sized_relobj_file::reverse_words): New function.
1334 * object.h (Sized_relobj_file::View_size): Add
1335 is_ctors_reverse_view field.
1336 (class Sized_relobj_file): Update declarations.
1337 * testsuite/initpri3.c: New test.
1338 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
1340 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
1341 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
1342 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
1343 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
1344 * testsuite/Makefile.in: Rebuild.
1346 2011-06-24 Cary Coutant <ccoutant@google.com>
1348 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
1349 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
1350 (debug_msg_cdebug.err): New targets.
1351 * testsuite/Makefile.in: Regenerate.
1352 * testsuite/debug_msg.sh: Check output of link with compressed debug.
1353 Fix checks for link with shared library.
1355 2011-06-24 Doug Kwan <dougkwan@google.com>
1357 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
1358 skip empty text sections.
1359 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
1361 2011-06-22 Ian Lance Taylor <iant@google.com>
1364 * options.h (class General_options): Add --ctors-in-init-array.
1365 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
1366 friends as SHT_PROGBITS for merging sections.
1367 (Layout::layout): Remove special handling of .init_array and
1368 friends. Don't sort if doing relocatable link. Sort for .ctors
1369 and .dtors if ctors_in_init_array.
1370 (Layout::make_output_section): Force correct section types for
1371 .init_array and friends. Don't sort if doing relocatable link,
1372 Don't sort .ctors and .dtors if ctors_in_init_array.
1373 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
1374 (Layout::output_section_name): Add relobj parameter. Change all
1375 callers. Handle .ctors. and .dtors. in code rather than table.
1376 Handle .ctors and .dtors if ctors_in_init_array.
1377 (Layout::match_file_name): New function, moved from output.cc.
1378 * layout.h (class Layout): Update declarations.
1379 * output.cc: Include "layout.h".
1380 (Input_section_sort_entry::get_priority): New function.
1381 (Input_section_sort_entry::match_file_name): Just call
1382 Layout::match_file_name.
1383 (Output_section::Input_section_sort_init_fini_compare::operator()):
1384 Handle .ctors and .dtors. Sort by explicit priority rather than
1386 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
1387 * testsuite/initpri2.c: New test.
1388 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
1389 (check_PROGRAMS): Add initpri2.
1390 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
1391 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
1392 * configure, testsuite/Makefile.in: Rebuild.
1394 2011-06-19 Ian Lance Taylor <iant@google.com>
1397 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
1398 .interp section to a PT_INTERP segment even if we have seen a
1399 --dynamic-linker option. Don't do it if we have seen a PHDRS
1400 clause in a linker script.
1401 (Layout::finalize): Don't create a .interp section if we've
1402 already create a PT_INTERP segment.
1403 (Layout::create_interp): Always call choose_output_section (revert
1404 patch of 2011-06-17). Don't create PT_INTERP segment.
1405 * script-sections.cc
1406 (Script_sections::create_note_and_tls_segments): Add a .interp
1407 section to a PT_INTERP segment even if we have seen a
1408 --dynamic-linker option.
1410 2011-06-18 Ian Lance Taylor <iant@google.com>
1412 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
1413 merely because a non-PT_LOAD segment has a dynamic reloc.
1415 2011-06-18 Ian Lance Taylor <iant@google.com>
1417 * layout.cc (Layout::finish_dynamic_section): Don't create
1418 DT_FLAGS entry if not needed.
1420 2011-06-18 Ian Lance Taylor <iant@google.com>
1423 * layout.cc (Layout::layout_eh_frame): Correct handling of
1424 writable .eh_frame section.
1426 2011-06-17 Ian Lance Taylor <iant@google.com>
1429 * resolve.cc (Symbol_table::resolve): Don't give an error if a
1430 symbol is redefined with the exact same object and value.
1432 2011-06-17 Ian Lance Taylor <iant@google.com>
1435 * layout.h (class Layout): Add interp_segment_ field.
1436 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
1437 (Layout::attach_allocated_section_to_segment): If making shared
1438 library, put .interp section in PT_INTERP segment.
1439 (Layout::finalize): Also call create_interp if -dynamic-linker
1441 (Layout::create_interp): Assert that there is no PT_INTERP
1442 segment. If not using a SECTIONS clause, use make_output_section.
1443 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
1444 * script-sections.cc
1445 (Script_sections::create_note_and_tls_segments): If making shared
1446 library, put .interp section in PT_INTERP segment.
1448 2011-06-17 Ian Lance Taylor <iant@google.com>
1450 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
1451 when making a shared library.
1453 2011-06-17 Ian Lance Taylor <iant@google.com>
1455 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
1456 parameter. Change all callers. Don't issue warning about PC32
1457 against locally defined symbol.
1459 2011-06-16 Ian Lance Taylor <iant@google.com>
1461 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
1462 occurs in same object.
1464 2011-06-14 Alan Modra <amodra@gmail.com>
1466 * po/POTFILES.in: Regenerate.
1468 2011-06-09 Ian Lance Taylor <iant@google.com>
1470 * script-sections.cc
1471 (Orphan_output_section::set_section_addresses): For a relocatable
1472 link set address to 0.
1474 2011-06-09 Cary Coutant <ccoutant@google.com>
1477 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
1478 used with --compress-debug-sections.
1479 * gold/object.cc (Sized_relobj_file::do_layout): Report
1480 uncompressed size of compressed input sections.
1482 2011-06-08 Cary Coutant <ccoutant@google.com>
1485 * testsuite/two_file_test_2_v1.cc: Change initialization of
1486 v2 to keep it in .data.
1488 2011-06-07 Cary Coutant <ccoutant@google.com>
1490 * common.cc (Symbol_table::do_allocate_commons_list): Call
1492 * errors.cc (Errors::fatal): Adjust call to gold_exit.
1493 (Errors::fallback): New function.
1494 (gold_fallback): New function.
1495 * errors.h (Errors::fallback): New function.
1496 * gold.cc (gold_exit): Change status parameter to enum; adjust
1498 (queue_initial_tasks): Call gold_fallback.
1499 * gold.h: Include cstdlib.
1500 (Exit_status): New enum type.
1501 (gold_exit): Change status parameter to enum.
1502 (gold_fallback): New function.
1503 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
1504 (Layout::create_symtab_sections): Likewise.
1505 (Layout::create_shdrs): Likewise.
1506 * main.cc (main): Adjust call to gold_exit.
1507 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
1508 (Output_data_got::add_got_entry_pair): Likewise.
1509 (Output_section::add_input_section): Likewise.
1510 (Output_section::add_output_section_data): Likewise.
1511 (Output_segment::set_section_list_addresses): Likewise.
1512 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
1514 2011-06-07 Cary Coutant <ccoutant@google.com>
1516 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
1517 for incremental links.
1518 * output.cc (Output_segment::set_section_list_addresses): Remove
1519 FIXME and test for TLS or BSS.
1521 2011-06-07 Cary Coutant <ccoutant@google.com>
1523 * testsuite/Makefile.am: Add incremental_copy_test,
1524 incremental_common_test_1.
1525 * testsuite/Makefile.in: Regenerate.
1526 * testsuite/common_test_1_v1.c: New source file.
1527 * testsuite/common_test_1_v2.c: New source file.
1528 * testsuite/copy_test_v1.cc: New source file.
1530 2011-06-07 Cary Coutant <ccoutant@google.com>
1532 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
1533 update, allocate common from bss section's free list.
1534 * incremental-dump.cc (dump_incremental_inputs): Print flag for
1535 linker-defined symbols.
1536 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1537 Skip GOT and PLT entries that are no longer referenced.
1538 (Output_section_incremental_inputs::write_info_blocks): Mark
1539 linker-defined symbols.
1540 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
1541 * output.cc (Output_section::allocate): New function.
1542 * output.h (Output_section::allocate): New function.
1543 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
1544 linker-defined symbols.
1545 (Symbol::override_base_with_special): Copy is_predefined_ flag.
1546 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
1547 (Symbol::init_base_output_data): Likewise.
1548 (Symbol::init_base_output_segment): Likewise.
1549 (Symbol::init_base_constant): Likewise.
1550 (Sized_symbol::init_output_data): Likewise.
1551 (Sized_symbol::init_output_segment): Likewise.
1552 (Sized_symbol::init_constant): Likewise.
1553 (Symbol_table::do_define_in_output_data): Likewise.
1554 (Symbol_table::do_define_in_output_segment): Likewise.
1555 (Symbol_table::do_define_as_constant): Likewise.
1556 * symtab.h (Symbol::is_predefined): New function.
1557 (Symbol::init_base_output_data): Add is_predefined parameter.
1558 (Symbol::init_base_output_segment): Likewise.
1559 (Symbol::init_base_constant): Likewise.
1560 (Symbol::is_predefined_): New data member.
1561 (Sized_symbol::init_output_data): Add is_predefined parameter.
1562 (Sized_symbol::init_output_segment): Likewise.
1563 (Sized_symbol::init_constant): Likewise.
1564 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
1566 2011-06-07 Cary Coutant <ccoutant@google.com>
1568 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
1569 instead of emit_copy_reloc.
1570 (Copy_relocs::emit_copy_reloc): Refactor.
1571 (Copy_relocs::make_copy_reloc): New function.
1572 (Copy_relocs::add_copy_reloc): Remove.
1573 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
1575 (Copy_relocs::make_copy_reloc): New function.
1576 (Copy_relocs::add_copy_reloc): Remove.
1577 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
1578 unchanged input files.
1579 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
1580 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
1581 Reserve BSS space for COPY relocations.
1582 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1583 (Output_section_incremental_inputs::write_info_blocks): Record
1584 whether a symbol is copied from a shared object.
1585 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
1586 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
1587 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
1588 (Incremental_input_entry_reader::get_output_symbol_index): Add
1590 (Incremental_binary::emit_copy_relocs): New function.
1591 (Incremental_binary::do_emit_copy_relocs): New function.
1592 (Sized_incremental_binary::Sized_incremental_binary): Initialize
1594 (Sized_incremental_binary::add_copy_reloc): New function.
1595 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1596 (Sized_incremental_binary::Copy_reloc): New struct.
1597 (Sized_incremental_binary::Copy_relocs): New typedef.
1598 (Sized_incremental_binary::copy_relocs_): New data member.
1599 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
1600 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
1601 * target.h (Sized_target::emit_copy_reloc): New function.
1602 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
1604 2011-06-02 Cary Coutant <ccoutant@google.com>
1607 * gold/archive.cc (Archive::Archive): Initialize new data member.
1608 (Archive::include_all_members): Return if archive has already been
1610 * gold/archive.h (Archive::include_all_members_): New data member.
1612 2011-06-02 Nick Clifton <nickc@redhat.com>
1614 * dynobj.h: Fix spelling mistake in comment.
1615 * output.cc: Likewise.
1617 2011-05-31 Doug Kwan <dougkwan@google.com>
1621 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
1622 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
1623 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
1624 redundant arm_exidx_test.so.
1625 * testsuite/Makefile.in: Regenerate.
1626 (check_SCRIPTS): Add pr12826.sh
1627 (check_DATA): Add pr12826.stdout
1628 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
1629 * testsuite/pr12826.sh: New file.
1630 * testsuite/pr12826_1.s: Ditto.
1631 * testsuite/pr12826_1.s: Ditto.
1633 2011-05-30 Ian Lance Taylor <iant@google.com>
1635 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
1638 2011-05-29 Ian Lance Taylor <iant@google.com>
1641 * testsuite/Makefile.am: Use different file name for two_file_test
1642 temporary file for each incremental test.
1643 * testsuite/Makefile.in: Rebuild.
1645 2011-05-29 Ian Lance Taylor <iant@google.com>
1647 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
1648 binary input file is empty.
1650 2011-05-27 Ian Lance Taylor <iant@google.com>
1652 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
1653 (ver_test_9.so): Likewise.
1654 * testsuite/Makefile.in: Rebuild.
1656 2011-05-26 Cary Coutant <ccoutant@google.com>
1658 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
1659 * incremental.cc (Incremental_inputs::report_input_section): Fix
1660 comment, indentation.
1661 (Incremental_inputs::report_comdat_group): New function.
1662 (Output_section_incremental_inputs::set_final_data_size): Adjust size
1663 of data for incremental input file entry.
1664 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
1665 group count, COMDAT group signatures.
1666 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
1667 an unchanged input file.
1668 * incremental.h (Incremental_object_entry::Incremental_object_entry):
1669 Initialize new data member.
1670 (Incremental_object_entry::add_comdat_group): New function.
1671 (Incremental_object_entry::get_comdat_group_count): New function.
1672 (Incremental_object_entry::get_comdat_signature_key): New function.
1673 (Incremental_object_entry::groups_): New data member.
1674 (Incremental_inputs::report_comdat_group): New function.
1675 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
1676 data for incremental input file entry.
1677 (Incremental_input_entry_reader::get_comdat_group_count): New function.
1678 (Incremental_input_entry_reader::get_input_section): Adjust size of
1679 data for incremental input file entry.
1680 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
1681 (Incremental_input_entry_reader::get_comdat_group_signature): New
1683 * object.cc (Sized_relobj::include_section_group): Report kept
1684 COMDAT groups for incremental links.
1686 2011-05-24 David Meyer <pdox@google.com>
1688 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
1689 with name parameter. Add found_name parameter.
1690 * fileread.cc (Input_file::find_file): Adjust code accordingly.
1691 * dirsearch.h (class Dirsearch): Update declaration.
1693 2011-05-24 Ian Lance Taylor <iant@google.com>
1695 * archive.cc (Library_base::should_include_member): Pull in object
1696 from archive if it defines the entry symbol.
1697 * parameters.cc (Parameters::entry): New function.
1698 * parameters.h (class Parameters): Declare entry.
1699 * output.h (class Output_file_header): Remove entry_ field.
1700 * output.cc (Output_file_header::Output_file_header): Remove entry
1701 parameter. Change all callers.
1702 (Output_file_header::entry): Use parameters->entry.
1703 * gold.cc (queue_middle_tasks): Likewise.
1704 * plugin.cc (Plugin_hook::run): Likewise.
1706 2011-05-24 Cary Coutant <ccoutant@google.com>
1708 * gold.cc (queue_initial_tasks): Pass incremental base filename
1709 to Output_file::open_base_file; don't print error message.
1710 * incremental-dump.cc (main): Adjust call to
1711 Output_file::open_for_modification.
1712 * incremental-dump.cc (main): Likewise.
1713 * incremental.cc (Incremental_inputs::report_command_line):
1714 Ignore --incremental-base option when comparing command lines.
1715 Ignore parameter when given as separate argument.
1716 * options.h (class General_options): Add --incremental-base.
1717 * output.cc (Output_file::Output_file):
1718 (Output_file::open_base_file): Add base_name and writable parameters;
1719 read base file into new file; print error message here.
1720 (Output_file::map_no_anonymous): Add writable parameter; adjust all
1722 * output.h (Output_file::open_for_modification): Rename to...
1723 (Output_file::open_base_file): ...this; add base_name and
1724 writable parameters; adjust all callers.
1725 (Output_file::map_no_anonymous): Add writable parameter; adjust all
1727 * testsuite/Makefile.am (incremental_test_4): Test
1729 * testsuite/Makefile.in: Regenerate.
1731 2011-05-24 Cary Coutant <ccoutant@google.com>
1733 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
1735 * testsuite/Makefile.in: Regenerate.
1736 * testsuite/two_file_test_1_v1.cc: New test source file.
1737 * testsuite/two_file_test_1b_v1.cc: New test source file.
1738 * testsuite/two_file_test_2_v1.cc: New test source file.
1740 2011-05-24 Cary Coutant <ccoutant@google.com>
1742 * dynobj.h (Dynobj::do_dynobj): New function.
1743 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
1744 flag and soname for shared objects.
1745 * incremental.cc (Incremental_inputs::report_object): Make
1746 either Incremental_object_entry or Incremental_dynobj_entry; add
1747 soname to string table.
1748 (Incremental_inputs::report_input_section): Add assertion.
1749 (Output_section_incremental_inputs::set_final_data_size): Adjust
1750 type of input file entry for shared libraries; adjust size of
1751 shared library info entry.
1752 (Output_section_incremental_inputs::write_input_files): Write
1753 as_needed flag for shared libraries.
1754 (Output_section_incremental_inputs::write_info_blocks): Adjust type
1755 of input file entry for shared libraries; write soname.
1756 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
1757 soname from incremental info.
1758 * incremental.h (enum Incremental_input_flags): Add
1759 INCREMENTAL_INPUT_AS_NEEDED.
1760 (Incremental_input_entry::Incremental_input_entry): Initialize new
1762 (Incremental_input_entry::set_as_needed): New function.
1763 (Incremental_input_entry::as_needed): New function.
1764 (Incremental_input_entry::do_dynobj_entry): New function.
1765 (Incremental_input_entry::as_needed_): New data member.
1766 (Incremental_object_entry::Incremental_object_entry): Don't check
1768 (Incremental_object_entry::do_type): Likewise.
1769 (class Incremental_dynobj_entry): New class.
1770 (Incremental_input_entry_reader::as_needed): New function.
1771 (Incremental_input_entry_reader::get_soname): New function.
1772 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
1773 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
1774 size of shared library info entry.
1775 * layout.cc (Layout::finish_dynamic_section): Don't test for
1776 incremental link when adding DT_NEEDED entries.
1777 * object.h (Object::Object): Initialize new data member.
1778 (Object::dynobj): New function.
1779 (Object::set_as_needed): New function.
1780 (Object::as_needed): New function.
1781 (Object::do_dynobj): New function.
1782 (Object::as_needed_): New data member.
1784 2011-05-24 Cary Coutant <ccoutant@google.com>
1786 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
1787 info; adjust display of GOT entries.
1788 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1789 vector of input objects; remove file_status_.
1790 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
1791 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
1792 got_plt reader; call target hooks to reserve GOT entries.
1793 (Output_section_incremental_inputs::set_final_data_size): Adjust size
1794 of input file info header and GOT info entry.
1795 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
1797 (Got_plt_view_info::got_descriptor): Remove.
1798 (Got_plt_view_info::sym_index): New data member.
1799 (Got_plt_view_info::input_index): New data member.
1800 (Local_got_offset_visitor::visit): Write input file index.
1801 (Global_got_offset_visitor::visit): Write 0 for input file index.
1802 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
1803 with sym_index and input_index.
1804 (Output_section_incremental_inputs::write_got_plt): Adjust size of
1805 incremental info GOT entry; replace got_descriptor with input_index.
1806 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
1807 map from input file index to object.
1808 (Sized_relobj_incr::do_layout): Replace direct data member reference
1809 with accessor function.
1810 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
1811 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
1812 Adjust size of input file info header.
1813 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
1814 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
1815 (Incremental_input_entry_reader::get_input_section): Adjust size of
1816 input file info header.
1817 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
1818 of incremental info GOT entry.
1819 (Incremental_got_plt_reader::get_got_desc): Remove.
1820 (Incremental_got_plt_reader::get_got_symndx): New function.
1821 (Incremental_got_plt_reader::get_got_input_index): New function.
1822 (Sized_incremental_binary::Sized_incremental_binary): Remove
1823 file_status_; add input_objects_.
1824 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
1825 (Sized_incremental_binary::set_file_is_unchanged): Remove.
1826 (Sized_incremental_binary::file_is_unchanged): Remove.
1827 (Sized_incremental_binary::set_input_object): New function.
1828 (Sized_incremental_binary::input_object): New function.
1829 (Sized_incremental_binary::file_status_): Remove.
1830 (Sized_incremental_binary::input_objects_): New data member.
1831 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
1833 (Sized_relobj_incr::invalid_address): Move to base class.
1834 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
1836 (Sized_relobj_incr::do_output_section_offset): Likewise.
1837 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
1838 (Sized_relobj_incr::section_offsets_): Likewise.
1839 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
1841 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
1842 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
1843 with accessor function.
1844 (Sized_relobj_file::do_layout): Likewise.
1845 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
1846 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
1847 (Sized_relobj_file::compute_final_local_value): Replace refs to
1848 section_offsets_ with accessor function.
1849 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
1850 * object.h (Relobj::Relobj): Initialize new data members.
1851 (Relobj::add_dyn_reloc): New function.
1852 (Relobj::first_dyn_reloc): New function.
1853 (Relobj::dyn_reloc_count): New function.
1854 (Relobj::first_dyn_reloc_): New data member.
1855 (Relobj::dyn_reloc_count_): New data member.
1856 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
1858 (Sized_relobj::Address): New typedef.
1859 (Sized_relobj::invalid_address): Move here from child class.
1860 (Sized_relobj::Sized_relobj): Initialize new data members.
1861 (Sized_relobj::sized_relobj): New function.
1862 (Sized_relobj::is_output_section_offset_invalid): Move here from
1864 (Sized_relobj::get_output_section_offset): Likewise.
1865 (Sized_relobj::local_has_got_offset): Likewise.
1866 (Sized_relobj::local_got_offset): Likewise.
1867 (Sized_relobj::set_local_got_offset): Likewise.
1868 (Sized_relobj::do_for_all_local_got_entries): Likewise.
1869 (Sized_relobj::clear_got_offsets): New function.
1870 (Sized_relobj::section_offsets): Move here from child class.
1871 (Sized_relobj::do_output_section_offset): Likewise.
1872 (Sized_relobj::do_set_section_offset): Likewise.
1873 (Sized_relobj::Local_got_offsets): Likewise.
1874 (Sized_relobj::local_got_offsets_): Likewise.
1875 (Sized_relobj::section_offsets_): Likewise.
1876 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
1878 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
1880 (Sized_relobj_file::sized_relobj): New function
1881 (Sized_relobj_file::local_has_got_offset): Move to base class.
1882 (Sized_relobj_file::local_got_offset): Likewise.
1883 (Sized_relobj_file::set_local_got_offset): Likewise.
1884 (Sized_relobj_file::get_output_section_offset): Likewise.
1885 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
1886 (Sized_relobj_file::do_output_section_offset): Likewise.
1887 (Sized_relobj_file::do_set_section_offset): Likewise.
1888 (Sized_relobj_file::Local_got_offsets): Likewise.
1889 (Sized_relobj_file::local_got_offsets_): Likewise.
1890 (Sized_relobj_file::section_offsets_): Likewise.
1891 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
1893 (set_needs_dynsym_index): Convert relobj to derived class pointer.
1894 (Output_reloc::get_symbol_index): Likewise.
1895 (Output_reloc::local_section_offset): Likewise.
1896 (Output_reloc::get_address): Likewise.
1897 (Output_reloc::symbol_value): Likewise.
1898 (Output_data_got::reserve_slot): Move to class definition.
1899 (Output_data_got::reserve_local): New function.
1900 (Output_data_got::reserve_slot_for_global): Remove.
1901 (Output_data_got::reserve_global): New function.
1902 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
1903 (all constructors, two instantiations).
1904 (Output_reloc::get_relobj): New function (two instantiations).
1905 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
1906 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
1907 (Output_data_reloc::add_global): Adjust type of relobj.
1908 (Output_data_reloc::add_global_relative): Likewise.
1909 (Output_data_reloc::add_symbolless_global_addend): Likewise.
1910 (Output_data_reloc::add_local): Likewise.
1911 (Output_data_reloc::add_local_relative): Likewise.
1912 (Output_data_reloc::add_symbolless_local_addend): Likewise.
1913 (Output_data_reloc::add_local_section): Likewise.
1914 (Output_data_reloc::add_output_section): Likewise.
1915 (Output_data_reloc::add_absolute): Likewise.
1916 (Output_data_reloc::add_target_specific): Likewise.
1917 (Output_data_got::reserve_slot): Move definition here.
1918 (Output_data_got::reserve_local): New function.
1919 (Output_data_got::reserve_global): New function.
1920 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
1921 section_offsets_ with accessor function.
1922 (Sized_relobj_file::write_sections): Likewise.
1923 (Sized_relobj_file::do_relocate_sections): Likewise.
1924 * target.h (Sized_target::reserve_local_got_entry): New function.
1925 (Sized_target::reserve_global_got_entry): New function.
1926 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
1927 (Target_x86_64::reserve_global_got_entry): New function.
1928 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
1930 2011-05-23 Cary Coutant <ccoutant@google.com>
1932 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
1933 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
1934 bit when checking got_type.
1935 * incremental.cc (Sized_incremental_binary::setup_readers):
1936 Store symbol table and string table locations; initialize bit vector
1937 of file status flags.
1938 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
1940 (Sized_incremental_binary::do_process_got_plt): New function.
1941 (Sized_incremental_binary::get_symtab_view): Use stored locations.
1942 (Output_section_incremental_inputs::set_final_data_size): Record
1943 file index for each input file.
1944 (Output_section_incremental_inputs::write_got_plt): Store file index
1945 instead of input entry offset for each GOT entry.
1947 (Incremental_input_entry::Incremental_input_entry): Initialize new
1949 (Incremental_input_entry::set_offset): Store file index.
1950 (Incremental_input_entry::get_file_index): New function.
1951 (Incremental_input_entry::file_index_): New data member.
1952 (Incremental_binary::process_got_plt): New function.
1953 (Incremental_binary::do_process_got_plt): New function.
1954 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1956 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
1957 (Sized_incremental_binary::set_file_is_unchanged): New function.
1958 (Sized_incremental_binary::file_is_unchanged): New function.
1959 (Sized_incremental_binary::do_process_got_plt): New function.
1960 (Sized_incremental_binary::file_status_): New data member.
1961 (Sized_incremental_binary::main_symtab_loc_): New data member.
1962 (Sized_incremental_binary::main_strtab_loc_): New data member.
1963 * output.cc (Output_data_got::Got_entry::write): Add case
1965 (Output_data_got::add_global): Call add_got_entry.
1966 (Output_data_got::add_global_plt): Likewise.
1967 (Output_data_got::add_global_with_rel): Likewise.
1968 (Output_data_got::add_global_with_rela): Likewise.
1969 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
1970 (Output_data_got::add_global_pair_with_rela): Likewise.
1971 (Output_data_got::add_local): Call add_got_entry.
1972 (Output_data_got::add_local_plt): Likewise.
1973 (Output_data_got::add_local_with_rel): Likewise.
1974 (Output_data_got::add_local_with_rela): Likewise.
1975 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
1976 (Output_data_got::add_local_pair_with_rela): Likewise.
1977 (Output_data_got::reserve_slot): New function.
1978 (Output_data_got::reserve_slot_for_global): New function.
1979 (Output_data_got::add_got_entry): New function.
1980 (Output_data_got::add_got_entry_pair): New function.
1981 (Output_section::add_output_section_data): Edit FIXME.
1983 (Output_section_data_build::Output_section_data_build): New
1984 constructor with size parameter.
1985 (Output_data_space::Output_data_space): Likewise.
1986 (Output_data_got::Output_data_got): Initialize new data member; new
1987 constructor with size parameter.
1988 (Output_data_got::add_constant): Call add_got_entry.
1989 (Output_data_got::reserve_slot): New function.
1990 (Output_data_got::reserve_slot_for_global): New function.
1991 (class Output_data_got::Got_entry): Add RESERVED_CODE.
1992 (Output_data_got::add_got_entry): New function.
1993 (Output_data_got::add_got_entry_pair): New function.
1994 (Output_data_got::free_list_): New data member.
1995 * target.h (Sized_target::init_got_plt_for_update): New function.
1996 (Sized_target::register_global_plt_entry): New function.
1997 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1998 Initialize new data member; call init; add constructor with PLT count.
1999 (Output_data_plt_x86_64::init): New function.
2000 (Output_data_plt_x86_64::add_relocation): New function.
2001 (Output_data_plt_x86_64::reserve_slot): New function.
2002 (Output_data_plt_x86_64::free_list_): New data member.
2003 (Target_x86_64::init_got_plt_for_update): New function.
2004 (Target_x86_64::register_global_plt_entry): New function.
2005 (Output_data_plt_x86_64::add_entry): Allocate from free list for
2006 incremental updates.
2007 (Output_data_plt_x86_64::add_relocation): New function.
2008 * testsuite/object_unittest.cc (Object_test): Set default options.
2010 2011-05-16 Ian Lance Taylor <iant@google.com>
2012 * options.h (class General_options): Make -i a synonym for -r.
2014 2011-05-16 Ian Lance Taylor <iant@google.com>
2016 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
2018 2011-05-10 Cary Coutant <ccoutant@google.com>
2020 * object.cc (Sized_relobj::do_count_local_symbols): Check for
2023 2011-05-06 Ian Lance Taylor <iant@google.com>
2025 * layout.cc (Layout::layout): If the output section flags change,
2026 update the ordering.
2028 2011-04-25 Cary Coutant <ccoutant@google.com>
2030 * incremental-dump.cc (dump_incremental_inputs): Print local
2031 symbol info for each input file.
2033 (Output_section_incremental_inputs::set_final_data_size): Add local
2034 symbol info to input file entries in incremental info.
2035 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2036 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
2037 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
2038 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
2040 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
2041 (Sized_incr_relobj::do_relocate): Write the local symbols.
2042 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
2043 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
2044 Adjust size of input file header.
2045 (Incremental_inputs_reader::get_local_symbol_offset): New function.
2046 (Incremental_inputs_reader::get_local_symbol_count): New function.
2047 (Incremental_inputs_reader::get_input_section): Adjust size of input
2049 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
2050 (Sized_incr_relobj::This): New typedef.
2051 (Sized_incr_relobj::sym_size): New const data member.
2052 (Sized_incr_relobj::Local_symbol): New struct.
2053 (Sized_incr_relobj::do_output_local_symbol_count): New function.
2054 (Sized_incr_relobj::do_local_symbol_offset): New function.
2055 (Sized_incr_relobj::local_symbol_count_): New data member.
2056 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
2057 (Sized_incr_relobj::local_symbol_index_): New data member.
2058 (Sized_incr_relobj::local_symbol_offset_): New data member.
2059 (Sized_incr_relobj::local_dynsym_offset_): New data member.
2060 (Sized_incr_relobj::local_symbols_): New data member.
2061 * object.h (Relobj::output_local_symbol_count): New function.
2062 (Relobj::local_symbol_offset): New function.
2063 (Relobj::do_output_local_symbol_count): New function.
2064 (Relobj::do_local_symbol_offset): New function.
2065 (Sized_relobj::do_output_local_symbol_count): New function.
2066 (Sized_relobj::do_local_symbol_offset): New function.
2068 2011-04-22 Vladimir Simonov <sv@sw.ru>
2070 * descriptors.cc (set_close_on_exec): New function.
2071 (Descriptors::open): Use set_close_on_exec.
2072 * output.cc (S_ISLNK): Define if not defined.
2074 2011-04-22 Cary Coutant <ccoutant@google.com>
2076 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2078 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2079 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
2080 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
2082 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
2083 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
2084 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
2086 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
2088 (Incremental_binary::apply_incremental_relocs): New function.
2089 (Incremental_binary::do_apply_incremental_relocs): New function.
2090 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2092 (Sized_incremental_binary::add_global_symbol): New function.
2093 (Sized_incremental_binary::global_symbol): New function.
2094 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2095 (Sized_incremental_binary::symbol_map_): New data member.
2096 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
2097 * target.h (Sized_target::apply_relocation): New function.
2098 * target-reloc.h (apply_relocation): New function.
2099 * x86_64.cc (Target_x86_64::apply_relocation): New function.
2101 2011-04-22 Doug Kwan <dougkwan@google.com>
2103 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
2104 flag of a SHT_ARM_EXIDX section.
2105 * testsuite/Makefile.am (arm_exidx_test): New test rules.
2106 * testsuite/Makefile.in: Regenerate.
2107 * testsuite/arm_exidx_test.s: New file.
2108 * testsuite/arm_exidx_test.sh: Same.
2110 2011-04-20 Cary Coutant <ccoutant@google.com>
2113 * archive.h (Incremental_archive_entry::Archive_member):
2114 Initialize arg_serial_ (second constructor).
2116 2011-04-17 Ian Lance Taylor <iant@google.com>
2118 * object.cc (Relocate_info::location): Simplify location string.
2119 * errors.cc (Errors::error_at_location): Don't print program
2121 (Errors::warning_at_location): Likewise.
2122 (Errors::undefined_symbol): Likewise.
2123 * testsuite/debug_msg.sh: Update accordingly.
2125 2011-04-14 Cary Coutant <ccoutant@google.com>
2127 * gold/layout.cc (Layout::symtab_section_offset): New function.
2128 * gold/layout.h (Layout::symtab_section_offset): New function.
2129 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
2131 2011-04-12 Ian Lance Taylor <iant@google.com>
2133 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
2134 with MREMAP_MAYMOVE.
2135 * output.h (class Output_file): Add map_is_allocated_ field.
2136 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
2137 not available, provide stubs. If mremap is not available, #define
2139 (MREMAP_MAYMOVE): Define if not defined.
2140 (Output_file::Output_file): Initialize map_is_allocated_.
2141 (Output_file::resize): Check map_is_allocated_.
2142 (Output_file::map_anonymous): If mmap fails, use malloc.
2143 (Output_file::unmap): Don't do anything for an anonymous map.
2144 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
2145 is not available, provide stubs.
2146 (File_read::View::~View): Use free rather than delete[].
2147 (File_read::make_view): Use malloc rather than new[]. If mmap
2149 (File_read::find_or_make_view): Use malloc rather than new[].
2150 * gold.h: Remove HAVE_REMAP code.
2151 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
2152 exists. Rename mremap to gold_mremap. If mmap is not available
2154 * configure, config.in: Rebuild.
2156 2011-04-11 Ian Lance Taylor <iant@google.com>
2158 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
2159 initialize local variable v.
2161 2011-04-11 Cary Coutant <ccoutant@google.com>
2163 * archive.cc (Archive::include_member): Adjust call to
2165 (Add_archive_symbols::run): Track argument serial numbers.
2166 (Lib_group::include_member): Likewise.
2167 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
2168 * archive.h (Incremental_archive_entry::Archive_member):
2169 Initialize arg_serial_.
2170 (Archive_member::arg_serial_): New data member.
2171 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
2172 (Sized_dynobj::do_add_symbols): Track symbols when doing an
2174 (Sized_dynobj::do_for_all_local_got_entries): New function.
2175 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
2177 * fileread.cc (get_mtime): New function.
2178 * fileread.h (get_mtime): New function.
2179 * gold.cc (queue_initial_tasks): Check for incremental update.
2180 (process_incremental_input): New function.
2181 (queue_middle_tasks): Don't force valid target for incremental
2183 * incremental-dump.cc (find_input_containing_global): Adjust
2184 size of symbol info entry.
2185 (dump_incremental_inputs): Dump argument serial number and
2186 in_system_directory flag; bias shndx by 1; print symbol names
2187 when dumping per-file symbol lists; use new symbol info readers.
2189 (Output_section_incremental_inputs:update_data_size): New function.
2190 (Sized_incremental_binary::setup_readers): Setup input readers
2191 for each input file; build maps for files added from libraries
2193 (Sized_incremental_binary::check_input_args): New function.
2194 (Sized_incremental_binary::do_check_inputs): Build map of argument
2195 serial numbers to input arguments.
2196 (Sized_incremental_binary::do_file_has_changed): Rename
2197 do_file_is_unchanged to this; compare file modification times.
2198 (Sized_incremental_binary::do_init_layout): New function.
2199 (Sized_incremental_binary::do_reserve_layout): New function.
2200 (Sized_incremental_binary::do_get_input_reader): Remove.
2201 (Sized_incremental_binary::get_symtab_view): New function.
2202 (Incremental_checker::can_incrementally_link_output_file): Remove.
2203 (Incremental_inputs::report_command_line): Exclude --debug options.
2204 (Incremental_inputs::report_archive_begin): Add parameter; track
2205 argument serial numbers; don't put input file entry for archive
2206 before archive members.
2207 (Incremental_inputs::report_archive_end): Put input file entry
2208 for archive after archive members.
2209 (Incremental_inputs::report_object): Add parameter; track argument
2210 serial numbers and in_system_directory flag.
2211 (Incremental_inputs::report_script): Add parameter; track argument
2213 (Output_section_incremental_inputs::set_final_data_size): Adjust
2214 size of symbol info entry; check for forwarding symbols.
2215 (Output_section_incremental_inputs::write_input_files): Write
2216 in_system_directory flag and argument serial number.
2217 (Output_section_incremental_inputs::write_info_blocks): Map section
2218 indices between incremental info and original input file; store
2219 input section index for each symbol.
2220 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2221 change operator() to visit().
2222 (class Global_got_offset_visitor): Likewise.
2223 (class Global_symbol_visitor_got_plt):
2224 (Output_section_incremental_inputs::write_got_plt): Use new visitor
2226 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
2227 (Sized_incr_relobj::do_read_symbols): New function.
2228 (Sized_incr_relobj::do_layout): New function.
2229 (Sized_incr_relobj::do_layout_deferred_sections): New function.
2230 (Sized_incr_relobj::do_add_symbols): New function.
2231 (Sized_incr_relobj::do_should_include_member): New function.
2232 (Sized_incr_relobj::do_for_all_global_symbols): New function.
2233 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
2234 (Sized_incr_relobj::do_section_size): New function.
2235 (Sized_incr_relobj::do_section_name): New function.
2236 (Sized_incr_relobj::do_section_contents): New function.
2237 (Sized_incr_relobj::do_section_flags): New function.
2238 (Sized_incr_relobj::do_section_entsize): New function.
2239 (Sized_incr_relobj::do_section_address): New function.
2240 (Sized_incr_relobj::do_section_type): New function.
2241 (Sized_incr_relobj::do_section_link): New function.
2242 (Sized_incr_relobj::do_section_info): New function.
2243 (Sized_incr_relobj::do_section_addralign): New function.
2244 (Sized_incr_relobj::do_initialize_xindex): New function.
2245 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2246 (Sized_incr_relobj::do_read_relocs): New function.
2247 (Sized_incr_relobj::do_gc_process_relocs): New function.
2248 (Sized_incr_relobj::do_scan_relocs): New function.
2249 (Sized_incr_relobj::do_count_local_symbols): New function.
2250 (Sized_incr_relobj::do_finalize_local_symbols): New function.
2251 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2252 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2253 (Sized_incr_relobj::do_relocate): New function.
2254 (Sized_incr_relobj::do_set_section_offset): New function.
2255 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2256 (Sized_incr_dynobj::do_read_symbols): New function.
2257 (Sized_incr_dynobj::do_layout): New function.
2258 (Sized_incr_dynobj::do_add_symbols): New function.
2259 (Sized_incr_dynobj::do_should_include_member): New function.
2260 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
2261 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
2262 (Sized_incr_dynobj::do_section_size): New function.
2263 (Sized_incr_dynobj::do_section_name): New function.
2264 (Sized_incr_dynobj::do_section_contents): New function.
2265 (Sized_incr_dynobj::do_section_flags): New function.
2266 (Sized_incr_dynobj::do_section_entsize): New function.
2267 (Sized_incr_dynobj::do_section_address): New function.
2268 (Sized_incr_dynobj::do_section_type): New function.
2269 (Sized_incr_dynobj::do_section_link): New function.
2270 (Sized_incr_dynobj::do_section_info): New function.
2271 (Sized_incr_dynobj::do_section_addralign): New function.
2272 (Sized_incr_dynobj::do_initialize_xindex): New function.
2273 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
2274 (make_sized_incremental_object): New function.
2275 (Incremental_library::copy_unused_symbols): New function.
2276 (Incremental_library::do_for_all_unused_symbols): New function.
2277 * incremental.h (enum Incremental_input_flags): New type.
2278 (class Incremental_checker): Remove.
2279 (Incremental_input_entry::Incremental_input_entry): Add argument
2281 (Incremental_input_entry::arg_serial): New function.
2282 (Incremental_input_entry::set_is_in_system_directory): New function.
2283 (Incremental_input_entry::is_in_system_directory): New function.
2284 (Incremental_input_entry::arg_serial_): New data member.
2285 (Incremental_input_entry::is_in_system_directory_): New data member.
2286 (class Script_info): Move here from script.h.
2287 (Script_info::Script_info): Add filename parameter.
2288 (Script_info::filename): New function.
2289 (Script_info::filename_): New data member.
2290 (Incremental_script_entry::Incremental_script_entry): Add argument
2292 (Incremental_object_entry::Incremental_object_entry): Likewise.
2293 (Incremental_object_entry::add_input_section): Build list of input
2294 sections with map to original shndx.
2295 (Incremental_object_entry::get_input_section_index): New function.
2296 (Incremental_object_entry::shndx_): New data member.
2297 (Incremental_object_entry::name_key_): Rename; adjust all refs.
2298 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
2299 (Incremental_archive_entry::Incremental_archive_entry): Add argument
2301 (Incremental_inputs::report_archive_begin): Likewise.
2302 (Incremental_inputs::report_object): Likewise.
2303 (Incremental_inputs::report_script): Likewise.
2304 (class Incremental_global_symbol_reader): New class.
2305 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
2306 and store flags and input file type.
2307 (Incremental_input_entry_reader::arg_serial): New function.
2308 (Incremental_input_entry_reader::type): Extract type from flags.
2309 (Incremental_input_entry_reader::is_in_system_directory): New function.
2310 (Incremental_input_entry_reader::get_input_section_count): Call
2311 accessor function for type.
2312 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
2313 function for type; adjust size of global symbol entry.
2314 (Incremental_input_entry_reader::get_global_symbol_count): Call
2315 accessor function for type.
2316 (Incremental_input_entry_reader::get_object_count): Likewise.
2317 (Incremental_input_entry_reader::get_object_offset): Likewise.
2318 (Incremental_input_entry_reader::get_member_count): Likewise.
2319 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
2320 (Incremental_input_entry_reader::get_member_offset): Likewise.
2321 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
2322 (Incremental_input_entry_reader::Global_symbol_info): Remove.
2323 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
2324 (Incremental_input_entry_reader::get_global_symbol_reader): New
2326 (Incremental_input_entry_reader::get_output_symbol_index): New
2328 (Incremental_input_entry_reader::type_): Remove.
2329 (Incremental_input_entry_reader::flags_): New data member.
2330 (Incremental_inputs_reader::input_file_offset): New function.
2331 (Incremental_inputs_reader::input_file_index): New function.
2332 (Incremental_inputs_reader::input_file): Call input_file_offset.
2333 (Incremental_inputs_reader::input_file_at_offset): New function.
2334 (Incremental_relocs_reader::get_r_type): Reformat.
2335 (Incremental_relocs_reader::get_r_shndx): Reformat.
2336 (Incremental_relocs_reader::get_r_offset): Reformat.
2337 (Incremental_relocs_reader::data): New function.
2338 (Incremental_binary::Incremental_binary): Initialize new data members.
2339 (Incremental_binary::check_inputs): Add cmdline parameter.
2340 (Incremental_binary::file_is_unchanged): Remove.
2341 (Input_reader::arg_serial): New function.
2342 (Input_reader::get_unused_symbol_count): New function.
2343 (Input_reader::get_unused_symbol): New function.
2344 (Input_reader::do_arg_serial): New function.
2345 (Input_reader::do_get_unused_symbol_count): New function.
2346 (Input_reader::do_get_unused_symbol): New function.
2347 (Incremental_binary::input_file_count): New function.
2348 (Incremental_binary::get_input_reader): Change signature to use
2349 index instead of filename.
2350 (Incremental_binary::file_has_changed): New function.
2351 (Incremental_binary::get_input_argument): New function.
2352 (Incremental_binary::get_library): New function.
2353 (Incremental_binary::get_script_info): New function.
2354 (Incremental_binary::init_layout): New function.
2355 (Incremental_binary::reserve_layout): New function.
2356 (Incremental_binary::output_file): New function.
2357 (Incremental_binary::do_check_inputs): New function.
2358 (Incremental_binary::do_file_is_unchanged): Remove.
2359 (Incremental_binary::do_file_has_changed): New function.
2360 (Incremental_binary::do_init_layout): New function.
2361 (Incremental_binary::do_reserve_layout): New function.
2362 (Incremental_binary::do_input_file_count): New function.
2363 (Incremental_binary::do_get_input_reader): Change signature.
2364 (Incremental_binary::input_args_map_): New data member.
2365 (Incremental_binary::library_map_): New data member.
2366 (Incremental_binary::script_map_): New data member.
2367 (Sized_incremental_binary::Sized_incremental_binary): Initialize
2369 (Sized_incremental_binary::output_section): New function.
2370 (Sized_incremental_binary::inputs_reader): Add const.
2371 (Sized_incremental_binary::symtab_reader): Add const.
2372 (Sized_incremental_binary::relocs_reader): Add const.
2373 (Sized_incremental_binary::got_plt_reader): Add const.
2374 (Sized_incremental_binary::get_symtab_view): New function.
2375 (Sized_incremental_binary::Inputs_reader): New typedef.
2376 (Sized_incremental_binary::Input_entry_reader): New typedef.
2377 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
2378 (Sized_incremental_binary::do_file_is_unchanged): Remove.
2379 (Sized_incremental_binary::do_file_has_changed): New function.
2380 (Sized_incremental_binary::do_init_layout): New function.
2381 (Sized_incremental_binary::do_reserve_layout): New function.
2382 (Sized_input_reader::Inputs_reader): Remove.
2383 (Sized_input_reader::Input_entry_reader): Remove.
2384 (Sized_input_reader::do_arg_serial): New function.
2385 (Sized_input_reader::do_get_unused_symbol_count): New function.
2386 (Sized_input_reader::do_get_unused_symbol): New function.
2387 (Sized_incremental_binary::do_input_file_count): New function.
2388 (Sized_incremental_binary::do_get_input_reader): Change signature;
2389 use index instead of filename.
2390 (Sized_incremental_binary::section_map_): New data member.
2391 (Sized_incremental_binary::input_entry_readers_): New data member.
2392 (class Sized_incr_relobj): New class.
2393 (class Sized_incr_dynobj): New class.
2394 (make_sized_incremental_object): New function.
2395 (class Incremental_library): New class.
2396 * layout.cc (Free_list::num_lists): New static data member.
2397 (Free_list::num_nodes): New static data member.
2398 (Free_list::num_removes): New static data member.
2399 (Free_list::num_remove_visits): New static data member.
2400 (Free_list::num_allocates): New static data member.
2401 (Free_list::num_allocate_visits): New static data member.
2402 (Free_list::init): New function.
2403 (Free_list::remove): New function.
2404 (Free_list::allocate): New function.
2405 (Free_list::dump): New function.
2406 (Free_list::print_stats): New function.
2407 (Layout_task_runner::run): Resize output file for incremental updates.
2408 (Layout::Layout): Initialize new data members.
2409 (Layout::set_incremental_base): New function.
2410 (Layout::init_fixed_output_section): New function.
2411 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
2412 incremental updates.
2413 (Layout::create_gold_note): Do not create gold note section for
2414 incremental updates.
2415 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
2416 for incremental updates.
2417 (Layout::set_section_offsets): For incremental updates, allocate space
2419 (Layout::create_symtab_sections): Layout with offsets relative to
2420 start of section; for incremental updates, allocate space from free
2422 (Layout::create_shdrs): For incremental updates, allocate space from
2424 (Layout::finish_dynamic_section): For incremental updates, do not
2425 check --as-needed (fixed in subsequent patch).
2426 * layout.h (class Free_list): New class.
2427 (Layout::set_incremental_base): New function.
2428 (Layout::incremental_base): New function.
2429 (Layout::init_fixed_output_section): New function.
2430 (Layout::allocate): New function.
2431 (Layout::incremental_base_): New data member.
2432 (Layout::free_list_): New data member.
2433 * main.cc (main): Print Free_list statistics.
2434 * object.cc (Relobj::finalize_incremental_relocs): Add
2435 clear_counts parameter; clear counts only when clear_counts is set.
2436 (Sized_relobj::Sized_relobj): Initialize new base class.
2437 (Sized_relobj::do_layout): Don't report special sections.
2438 (Sized_relobj::do_for_all_local_got_entries): New function.
2439 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
2440 symtab_off to all symbol table offsets.
2441 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
2442 * object.h (class Got_offset_list): Move to top of file.
2443 (Object::Object): Allow case where input_file == NULL.
2444 (Object::~Object): Likewise.
2445 (Object::input_file): Assert that input_file != NULL.
2446 (Object::lock): Allow case where input_file == NULL.
2447 (Object::unlock): Likewise.
2448 (Object::is_locked): Likewise.
2449 (Object::token): Likewise.
2450 (Object::release): Likewise.
2451 (Object::is_incremental): New function.
2452 (Object::get_mtime): New function.
2453 (Object::for_all_local_got_entries): New function.
2454 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
2455 (Object::set_is_in_system_directory): New function.
2456 (Object::is_in_system_directory): New function.
2457 (Object::do_is_incremental): New function.
2458 (Object::do_get_mtime): New function.
2459 (Object::do_for_all_local_got_entries): New function.
2460 (Object::is_in_system_directory_): New data member.
2461 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
2462 (class Sized_relobj_base): New class.
2463 (class Sized_relobj): Derive from Sized_relobj_base.
2464 (class Sized_relobj::Symbols): Redeclare from base class.
2465 (class Sized_relobj::local_got_offset_list): Remove.
2466 (class Sized_relobj::Output_sections): Redeclare from base class.
2467 (class Sized_relobj::do_for_all_local_got_entries): New function.
2468 (class Sized_relobj::write_local_symbols): Add offset parameter.
2469 (class Sized_relobj::local_symbol_offset_): Update comment.
2470 (class Sized_relobj::local_dynsym_offset_): Update comment.
2471 * options.cc (Input_arguments::add_file): Remove const.
2472 * options.h (Input_file_argument::Input_file_argument):
2473 Initialize arg_serial_ (all constructors).
2474 (Input_file_argument::set_arg_serial): New function.
2475 (Input_file_argument::arg_serial): New function.
2476 (Input_file_argument::arg_serial_): New data member.
2477 (Input_arguments::Input_arguments): Initialize file_count_.
2478 (Input_arguments::add_file): Remove const.
2479 (Input_arguments::number_of_input_files): New function.
2480 (Input_arguments::file_count_): New data member.
2481 (Command_line::number_of_input_files): Call
2482 Input_arguments::number_of_input_files.
2483 * output.cc (Output_segment_headers::Output_segment_headers):
2485 (Output_section::Input_section::current_data_size): New function.
2486 (Output_section::Output_section): Initialize new data members.
2487 (Output_section::add_input_section): Don't do merge sections for
2488 an incremental link; allocate space from free list for an
2490 (Output_section::add_output_section_data): Allocate space from
2491 free list for an incremental update.
2492 (Output_section::update_data_size): New function.
2493 (Output_section::set_fixed_layout): New function.
2494 (Output_section::reserve): New function.
2495 (Output_segment::set_section_addresses): Remove const.
2496 (Output_segment::set_section_list_addresses): Remove const; allocate
2497 space from free list for an incremental update.
2498 (Output_segment::set_offset): Adjust size of RELRO segment for an
2500 * output.h (Output_data::current_data_size): Move here from
2502 (Output_data::pre_finalize_data_size): New function.
2503 (Output_data::update_data_size): New function.
2504 (Output_section_headers::update_data_size): new function.
2505 (Output_section_data_build::current_data_size): Move to Output_data.
2506 (Output_data_strtab::update_data_size): New function.
2507 (Output_section::current_data_size): Move to Output_data.
2508 (Output_section::set_fixed_layout): New function.
2509 (Output_section::has_fixed_layout): New function.
2510 (Output_section::reserve): New function.
2511 (Output_section::update_data_size): New function.
2512 (Output_section::has_fixed_layout_): New data member.
2513 (Output_section::free_list_): New data member.
2514 (Output_segment::set_section_addresses): Remove const.
2515 (Output_segment::set_section_list_addresses): Remove const.
2516 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
2518 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
2520 * readsyms.cc (Read_symbols::do_read_symbols): Add library
2521 parameter when calling Add_symbols constructor; store argument
2522 serial number for members of a lib group.
2523 (Add_symbols::locks): Allow case where token == NULL.
2524 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
2525 (Read_member::~Read_member): New function.
2526 (Read_member::is_runnable): New function.
2527 (Read_member::locks): New function.
2528 (Read_member::run): New function.
2529 (Check_script::~Check_script): New function.
2530 (Check_script::is_runnable): New function.
2531 (Check_script::locks): New function.
2532 (Check_script::run): New function.
2533 (Check_library::~Check_library): New function.
2534 (Check_library::is_runnable): New function.
2535 (Check_library::locks): New function.
2536 (Check_library::run): New function.
2537 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
2538 (Add_symbols::library_): New data member.
2539 (class Read_member): New class.
2540 (class Check_script): New class.
2541 (class Check_library): New class.
2542 * reloc.cc (Read_relocs::is_runnable): Allow case where
2544 (Read_relocs::locks): Likewise.
2545 (Scan_relocs::locks): Likewise.
2546 (Relocate_task::locks): Likewise.
2547 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
2549 (Sized_relobj::incremental_relocs_scan): Fix comment.
2550 (Sized_relobj::do_relocate): Pass output file offset to
2551 write_local_symbols.
2552 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
2553 from class declaration.
2554 * script.cc (read_input_script): Allocate Script_info; pass
2555 argument serial number to report_script.
2556 * script.h (class Script_info): Move to incremental.h.
2557 * symtab.cc (Symbol_table::add_from_incrobj): New function.
2558 * symtab.h (Symbol_table::add_from_incrobj): New function.
2559 (Symbol_table::set_file_offset): New function.
2561 2011-04-05 Cary Coutant <ccoutant@google.com>
2563 * incremental-dump.cc (dump_incremental_inputs): Change signature
2564 to take a Sized_incremental_binary; change caller. Use readers
2565 in Sized_incremental_binary.
2567 (Sized_incremental_binary::find_incremental_inputs_sections):
2568 Rename do_find_incremental_inputs_sections to this.
2569 (Sized_incremental_binary::setup_readers): New function.
2570 (Sized_incremental_binary::do_check_inputs): Check
2571 has_incremental_info_ flag; move setup code to setup_readers;
2573 (Sized_incremental_binary::do_file_is_unchanged): New function.
2574 (Sized_incremental_binary::do_get_input_reader): New function.
2575 * incremental.h (class Incremental_binary): Move to end of file.
2576 (Incremental_binary::file_is_unchanged): New function.
2577 (Incremental_binary::do_file_is_unchanged): New function.
2578 (Incremental_binary::Input_reader): New class.
2579 (Incremental_binary::get_input_reader): New function.
2580 (class Sized_incremental_binary): Move to end of file.
2581 (Sized_incremental_binary::Sized_incremental_binary): Setup the
2582 input section reader classes.
2583 (Sized_incremental_binary::has_incremental_info): New function.
2584 (Sized_incremental_binary::inputs_reader): New function.
2585 (Sized_incremental_binary::symtab_reader): New function.
2586 (Sized_incremental_binary::relocs_reader): New function.
2587 (Sized_incremental_binary::got_plt_reader): New function.
2588 (Sized_incremental_binary::do_file_is_unchanged): New function.
2589 (Sized_incremental_binary::Sized_input_reader): New class.
2590 (Sized_incremental_binary::get_input_reader): New function.
2591 (Sized_incremental_binary::find_incremental_inputs_sections):
2592 Rename do_find_incremental_inputs_sections to this.
2593 (Sized_incremental_binary::setup_readers): New function.
2594 (Sized_incremental_binary::has_incremental_info_): New data member.
2595 (Sized_incremental_binary::inputs_reader_): New data member.
2596 (Sized_incremental_binary::symtab_reader_): New data member.
2597 (Sized_incremental_binary::relocs_reader_): New data member.
2598 (Sized_incremental_binary::got_plt_reader_): New data member.
2599 (Sized_incremental_binary::current_input_file_): New data member.
2601 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
2604 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
2607 2011-03-30 Cary Coutant <ccoutant@google.com>
2609 * archive.cc (Archive::include_member): Adjust call to report_object.
2610 (Add_archive_symbols::run): Add script_info to call to
2611 report_archive_begin.
2612 (Lib_group::include_member): Adjust call to report_object.
2613 (Add_lib_group_symbols::run): Adjust call to report_object.
2614 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
2615 blocks. Add object count for script input files.
2616 * incremental.cc (Incremental_inputs::report_archive_begin): Add
2617 script_info parameter; change all callers.
2618 (Incremental_inputs::report_object): Add script_info parameter;
2620 (Incremental_inputs::report_script): Store backpointer to
2621 incremental info entry.
2622 (Output_section_incremental_inputs::set_final_data_size): Record
2623 additional information for scripts.
2624 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2625 * incremental.h (Incremental_script_entry::add_object): New function.
2626 (Incremental_script_entry::get_object_count): New function.
2627 (Incremental_script_entry::get_object): New function.
2628 (Incremental_script_entry::objects_): New data member; adjust
2630 (Incremental_inputs::report_archive_begin): Add script_info parameter.
2631 (Incremental_inputs::report_object): Add script_info parameter.
2632 (Incremental_inputs_reader::get_object_count): New function.
2633 (Incremental_inputs_reader::get_object_offset): New function.
2634 * options.cc (Input_arguments::add_file): Return reference to
2636 * options.h (Input_argument::set_script_info): New function.
2637 (Input_argument::script_info): New function.
2638 (Input_argument::script_info_): New data member; adjust all
2640 (Input_file_group::add_file): Return reference to new input argument.
2641 (Input_file_lib::add_file): Likewise.
2642 (Input_arguments::add_file): Likewise.
2643 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
2644 * script.cc (Parser_closure::Parser_closure): Add script_info
2645 parameter; adjust all callers.
2646 (Parser_closure::script_info): New function.
2647 (Parser_closure::script_info_): New data member.
2648 (read_input_script): Report scripts earlier to incremental info.
2649 (script_add_file): Set script_info in Input_argument.
2650 (script_add_library): Likewise.
2651 * script.h (Script_options::Script_info): Rewrite class.
2653 2011-03-29 Cary Coutant <ccoutant@google.com>
2655 * archive.cc (Library_base::should_include_member): Move
2656 method here from class Archive.
2657 (Archive::Archive): Initialize base class.
2658 (Archive::should_include_member): Move to base class.
2659 (Archive::do_for_all_unused_symbols): New function.
2660 (Add_archive_symbols::run): Remove redundant access to
2662 (Lib_group::Lib_group): Initialize base class.
2663 (Lib_group::do_filename): New function.
2664 (Lib_group::include_member): Pass pointer to Lib_group to
2666 (Lib_group::do_for_all_unused_symbols): New function.
2667 (Add_lib_group_symbols::run): Report archive information for
2669 * archive.h (class Library_base): New base class.
2670 (class Archive): Derive from Library_base.
2671 (Archive::filename): Move to base class.
2672 (Archive::set_incremental_info): Likewise.
2673 (Archive::incremental_info): Likewise.
2674 (Archive::Should_include): Likewise.
2675 (Archive::should_include_member): Likewise.
2676 (Archive::Armap_entry): Remove.
2677 (Archive::Unused_symbol_iterator): Remove.
2678 (Archive::unused_symbols_begin): Remove.
2679 (Archive::unused_symbols_end): Remove.
2680 (Archive::do_filename): New function.
2681 (Archive::do_get_mtime): New function.
2682 (Archive::do_for_all_unused_symbols): New function.
2683 (Archive::task_): Move to base class.
2684 (Archive::incremental_info_): Likewise.
2685 (class Lib_group): Derive from Library_base.
2686 (Lib_group::do_filename): New function.
2687 (Lib_group::do_get_mtime): New function.
2688 (Lib_group::do_for_all_unused_symbols): New function.
2689 (Lib_group::task_): Move to base class.
2690 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
2692 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
2694 * incremental.cc (Incremental_inputs::report_archive_begin):
2695 Use Library_base; call library's get_mtime; add incremental inputs
2696 entry before members.
2697 (class Unused_symbol_visitor): New class.
2698 (Incremental_inputs::report_archive_end): Use Library_base; use
2699 visitor class to record unused symbols; don't add incremental inputs
2700 entry after members.
2701 (Incremental_inputs::report_object): Use Library_base.
2703 (Incremental_archive_entry::Incremental_archive_entry): Remove
2704 unused Archive parameter.
2705 (Incremental_inputs::report_archive_begin): Use Library_base.
2706 (Incremental_inputs::report_archive_end): Likewise.
2707 (Incremental_inputs::report_object): Likewise.
2708 * object.cc (Sized_relobj::do_for_all_global_symbols): New
2710 * object.h (Object::for_all_global_symbols): New function.
2711 (Object::do_for_all_global_symbols): New function.
2712 (Sized_relobj::do_for_all_global_symbols): New function.
2713 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
2715 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
2718 2011-03-27 Ian Lance Taylor <iant@google.com>
2720 * archive.cc (Archive::interpret_header): Return -1 if something
2721 goes wrong. Change callers accordingly.
2723 2011-03-25 Cary Coutant <ccoutant@google.com>
2725 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
2726 * testsuite/Makefile.in: Regenerate.
2728 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
2730 * plugin.cc (get_view): New.
2731 (Plugin::load): Pass get_view to the plugin.
2732 (Plugin_manager::get_view): New.
2734 2011-03-21 Ian Lance Taylor <iant@google.com>
2736 * testsuite/final_layout.sh: Rewrite to not use dc.
2737 * testsuite/relro_test.sh: Fail if dc is not present.
2739 2011-03-21 Sriraman Tallam <tmsriram@google.com>
2741 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
2743 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
2744 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
2746 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
2747 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
2749 2011-03-14 Ian Lance Taylor <iant@google.com>
2751 * script-sections.cc (Sort_output_sections::script_compare):
2752 Rename from is_before, change return type.
2753 (Sort_output_sections::operator()): Adjust accordingly.
2755 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
2758 * testsuite/odr_violation2.cc: Add comment to make all error line
2759 numbers double digits.
2760 * testsuite/debug_msg.sh: Adjust expected errors.
2762 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
2764 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
2765 but mark earlier ones as non-canonical
2766 (offset_to_iterator): Update search target and example
2767 (do_addr2line): Return extra lines in a vector*
2768 (format_file_lineno): Extract from do_addr2line
2769 (one_addr2line): Add vector* out-param
2770 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
2771 when a lineno entry appeared last for its instruction
2772 (Dwarf_line_info): Add vector* out-param
2773 * object.cc (Relocate_info): Pass NULL for the vector* out-param
2774 * symtab.cc (Odr_violation_compare): Include the lineno in the
2776 (linenos_from_loc): New. Combine the canonical line for an
2777 address with its other lines.
2778 (True_if_intersect): New. Helper functor to make
2779 std::set_intersection a query.
2780 (detect_odr_violations): Compare sets of lines instead of just
2781 one line for each function. This became less deterministic, but
2782 has fewer false positives.
2783 * symtab.h: Declarations.
2784 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
2785 mix an optimized and non-optimized object in the same binary
2786 (odr_violation2.so): Same.
2787 * testsuite/Makefile.in: Regenerate from Makefile.am.
2788 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
2789 * testsuite/debug_msg.sh: Update line numbers and add
2791 * testsuite/odr_violation1.cc: Use OdrDerived, in a
2792 non-optimized context.
2793 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
2794 isn't inlined, and use OdrDerived in an optimized context.
2795 * testsuite/odr_header1.h: Defines OdrDerived, where
2796 optimization will change the
2797 first-instruction-in-the-destructor's file and line number.
2798 * testsuite/odr_header2.h: Defines OdrBase.
2800 2011-03-09 Ian Lance Taylor <iant@google.com>
2802 * fileread.cc (File_read::clear_views): Don't delete the whole
2805 2011-03-08 Ian Lance Taylor <iant@google.com>
2808 * fileread.cc: #include <climits>.
2809 (GOLD_IOV_MAX): Define.
2810 (File_read::read_multiple): Limit number of entries by iov_max.
2811 * fileread.h (class File_read): Always set max_readv_entries to
2814 2011-03-07 Ian Lance Taylor <iant@google.com>
2817 * options.h (class General_options): Add -dy and -dn.
2819 2011-03-02 Cary Coutant <ccoutant@google.com>
2821 * testsuite/script_test_9.t: Add TLS segment.
2823 2011-03-02 Simon Baldwin <simonb@google.com>
2825 * configure.ac: Add check for gnu_indirect_function support in
2826 the toolchain building binutils.
2827 * configure: Rebuild.
2829 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
2831 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
2832 plugin only symbols.
2833 (Symbol_table::sized_finalize_symbol) Mark symbol only present
2834 in plugin files as not needed in the symbol table.
2836 2011-02-11 Sriraman Tallam <tmsriram@google.com>
2838 * output.cc (Output_section::add_input_section): Delay fill
2839 generation for section ordering.
2841 2011-02-09 Ian Lance Taylor <iant@google.com>
2844 * object.h (class Sized_relobj): Remove clear_local_symbols.
2845 * reloc.cc (Sized_relobj::do_relocate): Don't call
2846 clear_local_symbols.
2848 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
2850 * plugin.cc (is_visible_from_outside): Return true for symbols
2853 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
2855 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
2858 2011-02-02 Sriraman Tallam <tmsriram@google.com>
2860 * icf.h (is_section_foldable_candidate): Change type of parameter
2862 * icf.cc (Icf::find_identical_sections): Change type of local variable
2863 section_name to be std::string.
2864 (is_function_ctor_or_dtor): Change type of parameter to std::string.
2866 2011-01-25 Ian Lance Taylor <iant@google.com>
2868 * script.cc (script_add_extern): Rewrite to use
2869 add_symbol_reference.
2871 2011-01-25 Doug Kwan <dougkwan@google.com>
2873 * icf.cc (get_section_contents): Always lock section's object.
2875 2011-01-24 Ian Lance Taylor <iant@google.com>
2877 * options.h (class General_options): Accept
2878 --no-detect-odr-violations.
2880 2011-01-24 Ian Lance Taylor <iant@google.com>
2882 * version.cc (version_string): Bump to 1.11.
2884 2011-01-24 Ian Lance Taylor <iant@google.com>
2886 * plugin.cc (class Plugin_rescan): Define new class.
2887 (Plugin_manager::claim_file): Set any_claimed_.
2888 (Plugin_manager::save_archive): New function.
2889 (Plugin_manager::save_input_group): New function.
2890 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
2892 (Plugin_manager::new_undefined_symbol): New function.
2893 (Plugin_manager::rescan): New function.
2894 (Plugin_manager::rescannable_defines): New function.
2895 (Plugin_manager::add_input_file): Set any_added_.
2896 * plugin.h (class Plugin_manager): define new fields rescannable_,
2897 undefined_symbols_, any_claimed_, and any_added_. Declare
2898 Plugin_rescan as friend. Declare new functions.
2899 (Plugin_manager::Rescannable): Define type.
2900 (Plugin_manager::Rescannable_list): Define type.
2901 (Plugin_manager::Undefined_symbol_list): Define type.
2902 (Plugin_manager::Plugin_manager): Initialize new fields.
2903 * archive.cc (Archive::defines_symbol): New function.
2904 (Add_archive_symbols::run): Pass archive to plugins if any.
2905 * archive.h (class Archive): Declare defines_symbol.
2906 * readsyms.cc (Input_group::~Input_group): New function.
2907 (Finish_group::run): Pass input_group to plugins if any.
2908 * readsyms.h (class Input_group): Declare destructor.
2909 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
2912 2011-01-10 Ian Lance Taylor <iant@google.com>
2914 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
2916 (Layout::set_segment_offsets): Reset increase_relro before calling
2917 set_section_addresses a second time.
2919 2011-01-04 Cary Coutant <ccoutant@google.com>
2921 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
2922 sections before NOBITS sections.
2924 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
2926 * version.cc (print_version): Update copyright to 2011.
2928 2010-12-23 Cary Coutant <ccoutant@google.com>
2930 * output.h (Output_data_reloc::add_output_section): Pass OD instead
2931 of OS to this->add. Add OD parameter to second form of the function.
2933 2010-12-20 Ian Lance Taylor <iant@google.com>
2935 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
2936 second of two consecutive entries with same offset.
2938 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2940 * testsuite/Makefile.am (ifuncmain2static_LDADD)
2941 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
2942 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
2943 to avoid unneeded links against $(LDADD).
2944 * testsuite/Makefile.in: Regenerate.
2946 2010-12-15 Ian Lance Taylor <iant@google.com>
2949 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
2950 for R_X86_64_32 and R_X86_64_PC32.
2951 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
2952 ver_matching_def_pic.o.
2953 (ver_matching_def_pic.o): New target.
2955 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2957 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
2958 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
2959 Move definition before File_read::View member definitions.
2960 (File_read::View::~View): Initialize and hold lock before
2961 updating current_mapped_bytes.
2963 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2965 * dwarf_reader.cc: Remove outdated comment.
2966 * gold-threads.cc: Fix typo in error message.
2967 * archive.cc: Fix typos in comments.
2968 * archive.h: Likewise.
2969 * arm-reloc-property.cc: Likewise.
2970 * arm-reloc-property.h: Likewise.
2971 * arm-reloc.def: Likewise.
2973 * attributes.h: Likewise.
2974 * cref.cc: Likewise.
2975 * ehframe.cc: Likewise.
2976 * fileread.h: Likewise.
2978 * i386.cc: Likewise.
2980 * incremental.h: Likewise.
2981 * int_encoding.cc: Likewise.
2982 * layout.h: Likewise.
2983 * main.cc: Likewise.
2984 * merge.h: Likewise.
2985 * object.cc: Likewise.
2986 * object.h: Likewise.
2987 * options.cc: Likewise.
2988 * readsyms.cc: Likewise.
2989 * reduced_debug_output.cc: Likewise.
2990 * reloc.cc: Likewise.
2991 * script-sections.cc: Likewise.
2992 * sparc.cc: Likewise.
2993 * symtab.h: Likewise.
2994 * target-reloc.h: Likewise.
2995 * target.cc: Likewise.
2996 * target.h: Likewise.
2997 * timer.cc: Likewise.
2998 * timer.h: Likewise.
2999 * x86_64.cc: Likewise.
3001 2010-12-09 Cary Coutant <ccoutant@google.com>
3003 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
3005 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
3006 parameter; change all callers.
3007 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
3008 * options.h (warn_execstack): New option.
3010 2010-12-07 Doug Kwan <dougkwan@google.com>
3012 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
3013 like function call relocations.
3015 2010-12-07 Ian Lance Taylor <iant@google.com>
3017 * archive.cc (Archive::get_elf_object_for_member): Permit
3018 punconfigured to be NULL.
3019 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
3020 (Archive::include_member): Pass NULL to get_elf_object_for_member
3021 if we searched for the archive and this is the first included
3024 2010-12-01 Ian Lance Taylor <iant@google.com>
3026 * dwarf_reader.h (class Sized_dwarf_line_info): Add
3027 track_relocs_type_ field.
3028 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3029 Set track_relocs_type_.
3030 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
3031 contents when using RELA relocs.
3032 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
3034 * reloc.cc (Track_relocs::next_addend): New function.
3035 * reloc.h (class Track_relocs): Declare next_addend.
3037 2010-12-01 Ian Lance Taylor <iant@google.com>
3039 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
3042 2010-12-01 Ian Lance Taylor <iant@google.com>
3044 * README: Update compilers known to work and fail.
3046 2010-11-23 Matthias Klose <doko@ubuntu.com>
3048 * configure.in: For --enable-gold, handle value `default' instead of
3049 `both*'. Always install ld as ld.bfd, install as ld if gold is
3051 * configure: Regenerate.
3053 2010-11-18 Doug Kwan <dougkwan@google.com>
3055 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
3056 and right_alignment to be zero. Store result alignment only if it is
3057 greater than existing alignment.
3059 2010-11-16 Cary Coutant <ccoutant@google.com>
3062 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3063 Check for ".zdebug_line".
3065 2010-11-16 Doug Kwan <dougkwan@google.com>
3066 Cary Coutant <ccoutant@google.com>
3068 * output.h (Output_segment::set_section_addresses): Pass increase_relro
3069 by reference; adjust all callers.
3070 * output.cc (Output_segment::set_section_addresses): Adjust references
3071 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
3073 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
3074 end at page boundary.
3076 2010-11-16 Cary Coutant <ccoutant@google.com>
3079 * layout.cc (Layout::choose_output_section): Transform names of
3080 compressed sections even when using a script with a SECTIONS clause.
3081 (Layout::output_section_name): Remove code to transform
3082 compressed debug section names.
3083 * output.cc (Output_section::add_input_section): Use uncompressed
3084 section size when tracking input sections.
3086 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
3088 * symtab.h (Symbol::NON_PIC_REF): Remove.
3089 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
3090 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
3091 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
3092 (Symbol::use_plt_offset): Take a flags argument and pass it
3093 directly to needs_dynamic_reloc. Restrict check for undefined
3094 weak symbols to function calls.
3095 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
3096 (Target_arm::Scan::global): Use it.
3097 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
3098 (Target_arm::Relocate::relocate): Likewise.
3099 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
3100 parameter with an r_type parameter. Use get_reference_flags
3102 (Target_arm::Relocate::relocate): Update accordingly.
3103 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
3104 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
3105 (Target_i386::Scan::global): Likewise.
3106 (Target_i386::Relocate::relocate): Likewise.
3107 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
3108 parameter with an r_type parameter. Use get_reference_flags
3110 (Target_i386::Relocate::relocate): Update accordingly.
3111 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
3112 (Target_powerpc::Scan::global): Use it.
3113 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
3114 (Target_powerpc::Relocate::relocate): Likewise.
3115 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
3116 (Target_sparc::Scan::global): Use it.
3117 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
3118 (Target_sparc::Relocate::relocate): Likewise.
3119 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
3120 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
3121 (Target_x86_64::Scan::global): Likewise.
3122 (Target_x86_64::Relocate::relocate): Likewise.
3124 2010-11-08 Doug Kwan <dougkwan@google.com>
3125 Cary Coutant <ccoutant@google.com>
3127 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
3128 (Arm_exidx_merge_section::section_contents_): New data member.
3129 (Arm_input_section::Arm_input_section): Initialize original_contents_.
3130 (Arm_input_section::~Arm_input_section): De-allocate memory.
3131 (Arm_input_section::original_contents_): New data member.
3132 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
3133 in parameters instead of calling Object::section_contents without
3135 (Arm_output_section::group_section): New parameter TASK. Pass it
3136 to callees that need locking objects.
3137 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
3138 to lock EXIDX input sections. Fix a formatting issue. Call
3139 Arm_exidx_merged_section::build_contents to create merged section
3141 (Arm_output_section::create_stub_group): New parameter TASK. Use it
3142 to lock object of stub table owner.
3143 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
3144 TEXT_SIZE to initialize data member TEXT_SIZE_.
3145 (Arm_exidx_input_section::addralign): Fix typo in comment.
3146 (Arm_exidx_input_section::text_size): New method.
3147 (Target_arm::do_relax): New parameter TASK. Pass it to callees
3148 that require locking objects. Lock objects before scanning for stubs
3149 and updating local symbols.
3150 (Arm_input_section<big_endian>::init): Copy contents of original
3152 (Arm_input_section<big_endian>::do_write): Use saved contents of
3153 original input section instead of calling Object::section_contents
3155 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
3156 size without calling Object::section_size().
3157 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
3158 for size. Allocate a buffer for merged EXIDX entries.
3159 (Arm_exidx_merged_section::build_contents): New method.
3160 (Arm_exidx_merged_section::do_write): Move merge section contents
3161 building code to Arm_exidx_merged_section::build_contetns. Write
3162 out contetns in buffer instead of building it on the fly.
3163 (Arm_relobj::make_exidx_input_section): Also pass text section size
3164 to Arm_exidx_input_section constructor.
3165 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
3166 (Arm_dynobj::do_read_symbols): Fix memory leak.
3167 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
3168 * target.h: (class Task): Add forward declaration.
3169 (Target::relax): Add new parameter TASK and pass it to
3171 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
3173 2010-11-05 Cary Coutant <ccoutant@google.com>
3176 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
3177 object when reading from the file.
3178 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
3180 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
3181 when reading section contents.
3182 (get_section_contents): Likewise.
3183 (icf::find_identical_sections): Likewise.
3184 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
3185 object when reading from the file.
3186 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
3187 the object when doing deferred section layout.
3189 2010-11-03 Nick Clifton <nickc@redhat.com>
3192 * script.h (class Symbol_assignment: name): New member. Returns
3193 the name of the symbol.
3194 * scrfipt.cc (Script_options::is_pending_assignment): New member.
3195 Returns true if the given symbol name is on the list of
3196 assignments wating to be processed.
3197 * archive.cc (should_incldue_member): If the symbol is undefined,
3198 check to see if it is on the list of symbols pending assignment.
3200 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
3202 * script-sections.cc (Script_sections::find_memory_region): Check
3203 for a NULL output section pointer.
3205 2010-10-29 Doug Kwan <dougkwan@google.com>
3207 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3208 Output_section::add_relaxed_input_section.
3209 * output.cc (Output_section::add_relaxed_input_section): Add new
3210 arguments LAYOUT and NAME. Set section order index.
3211 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3212 Copy section order index.
3213 * output.h (Output_section::add_relaxed_input_section): Add new
3214 arguments LAYOUT and NAME.
3216 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3218 * testsuite/Makefile.am: Move gcctestdir/ld rule to
3219 NATIVE_OR_CROSS_LINKER.
3220 * testsuite/Makefile.in: Regenerate.
3222 2010-10-20 Doug Kwan <dougkwan@google.com>
3224 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
3225 without SHF_LINK_ORDER flags.
3226 * layout.cc (Layout::choose_output_section): Do not filter
3227 SHF_LINK_ORDER flag in a relocatable link.
3229 2010-10-17 Cary Coutant <ccoutant@google.com>
3231 * output.h (Output_segment::set_section_addresses): Change function
3232 signature. Update all callers.
3233 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
3235 (Output_segment::set_section_addresses): Align after last TLS
3236 section. Add padding before last relro section instead of after.
3238 2010-10-17 Doug Kwan <dougkwan@google.com>
3240 * gold/arm.cc (Target_arm::got_section): Use correct order and set
3241 GOT output section to be writable.
3243 2010-10-14 Cary Coutant <ccoutant@google.com>
3245 * debug.h (DEBUG_INCREMENTAL): New flag.
3246 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3247 * gold.cc (queue_initial_tasks): Check parameters for incremental link
3249 * incremental.cc (report_command_line): Ignore all forms of
3251 * layout.cc (Layout::Layout): Check parameters for incremental link
3253 * options.cc (General_options::parse_incremental): New function.
3254 (General_options::parse_no_incremental): New function.
3255 (General_options::parse_incremental_full): New function.
3256 (General_options::parse_incremental_update): New function.
3257 (General_options::incremental_mode_): New data member.
3258 (General_options::finalize): Check incremental_mode_.
3259 * options.h (General_options): Update help text for --incremental.
3260 Add --no-incremental, --incremental-full, --incremental-update.
3261 (General_options::Incremental_mode): New enum type.
3262 (General_options::incremental_mode): New function.
3263 (General_options::incremental_mode_): New data member.
3264 * parameters.cc (Parameters::incremental_mode_): New data member.
3265 (Parameters::set_options): Set incremental_mode_.
3266 (Parameters::set_incremental_full): New function.
3267 (Parameters::incremental): New function.
3268 (Parameters::incremental_update): New function.
3269 (set_parameters_incremental_full): New function.
3270 * parameters.h (Parameters::set_incremental_full): New function.
3271 (Parameters::incremental): New function.
3272 (Parameters::incremental_update): New function.
3273 (Parameters::incremental_mode_): New data member.
3274 (set_parameters_incremental_full): New function.
3275 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
3276 incremental link mode.
3277 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
3278 (Sized_relobj::do_relocate_sections): Likewise.
3279 * testsuite/Makefile.am (incremental_test): Use --incremental-full
3281 * testsuite/Makefile.in: Regenerate.
3282 * testsuite/incremental_test.sh: Filter all forms of --incremental.
3284 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3286 * script-sections.h (class Script_sections): Make
3287 Sections_elements typedef public.
3288 * script-sections.cc (class Sort_output_sections): Add elements_
3289 field. Add constructor which sets it; change all callers.
3290 (Sort_output_sections::is_before): New function.
3291 (Sort_output_sections::operator()): Call is_before.
3292 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
3294 * testsuite/script_test_10.sh: New test. Test script section
3296 * testsuite/script_test_10.t: Likewise.
3297 * testsuite/script_test_10.s: Likewise.
3298 * testsuite/Makefile.am: Wrap the cross linker tests and the
3299 common tests into NATIVE_OR_CROSS_LINKER.
3300 (check_SCRIPTS): Add script_test_10.sh.
3301 (check_DATA): Add script_test_10.stdout.
3302 (script_test_10.o, script_test_10): New targets.
3303 (script_test_10.stdout): New target.
3304 * configure, testsuite/Makefile.in: Regenerate.
3306 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3308 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
3309 error for the deprecated relocations.
3310 (Target_arm::Scan::global): Likewise.
3311 (Target_arm::Relocate::relocate): Likewise.
3313 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
3315 * fileread.cc (Input_file::find_file): Initialize *found_name
3316 and *namep when using the fallback search for case 4.
3318 2010-10-11 Cary Coutant <ccoutant@google.com>
3320 * options.h (class General_options): Redefine -z lazy as an alias for
3321 the negation of -z now.
3323 2010-10-11 Ian Lance Taylor <iant@google.com>
3325 * resolve.cc (symbol_to_bits): Report the value of the unsupported
3328 2010-10-06 Nick Clifton <nickc@redhat.com>
3330 * script-sections.cc(class Memory_region): Remove
3331 current_lma_offset_ field. Rename current_vma_offset_ to
3332 current_offset_. Add last_section_ field.
3333 (Memory_region::get_current_vma_address): Rename to
3334 get_current_address.
3335 (Memory_region::get_current_lma_address): Delete.
3336 (Memory_region::increment_vma_offset): Rename to
3338 (Memory_region::increment_lma_offset): Delete.
3339 (Memory_region::attributes_compatible): New method. Returns
3340 true if the provided section is compatible with the region.
3341 (Memory_region::get_last_section): New method. Returns the last
3342 section to use the region.
3343 (Memory_region::set_last_section): New method. Stores the last
3344 section to use the region.
3345 (Script_sections::block_in_region): New method. Returns true if
3346 a block of memory is contained within a region.
3347 (Script_sections::find_memory_region): New method. Locates a
3348 memory region to be used to set a VMA or LMA address.
3349 (Output_section_definition::set_section_addresses): Add code to
3350 check for addresses set by memory regions.
3351 (Output_segment::set_section_addresses): Remove memory region
3353 (Script_sections::create_segment): Add a warning if a header
3354 segment is created outside of any region.
3355 * script-sections.h (class Script_sections): Add prototypes for
3356 find_memory_region and block_in_region methods.
3357 * testsuite/memory_test.s: Use .long instead of .word.
3358 * testsuite/memory_test.t: Add some more output sections.
3359 * testsuite/memory_test.sh: Update expected output.
3361 2010-10-02 Doug Kwan <dougkwan@google.com>
3363 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
3364 defintion to symtab.h
3365 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
3366 declaration to defintion.
3368 2010-10-01 Nick Clifton <nickc@redhat.com>
3370 * expression.cc (eval): Replace dummy argument with NULL.
3371 (eval_maybe_dot): Check for a NULL result section pointer.
3372 (Symbol_expression::value): Likewise.
3373 (Dot_expression::value): Likewise.
3374 (BINARY_EXPRESSION): Likewise.
3375 (Max_expression::value): Likewise.
3376 (Min_expression::value): Likewise.
3377 (Absolute_expression::value): Likewise.
3378 (Addr_expression::value_from_output_section): Likewise.
3379 (Loaddddr_expression::value_from_output_section): Likewise.
3380 (Segment_start_expression::value): Likewise.
3381 * script-sections.cc
3382 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
3384 (Sections_elememt_dot_assignment::set_section_addresses):
3386 (Output_data_expression::do_write_to_buffer): Likewise.
3387 (Output_section_definition::finalize_symbols): Likewise.
3388 (Output_section_definition::set_section_addresses): Likewise.
3390 2010-09-30 Doug Kwan <dougkwan@google.com>
3392 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
3394 2010-09-28 Sriraman Tallam <tmsriram@google.com>
3396 * target.h (Target::can_icf_inline_merge_sections): New virtual
3398 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
3400 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
3402 * icf.cc (get_section_contents): Inline merge sections only when
3405 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3407 * configure: Regenerate.
3409 2010-09-17 Ian Lance Taylor <iant@google.com>
3411 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
3412 * testsuite/Makefile.am (memory_test.o): New target.
3413 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
3415 * testsuite/Makefile.in: Rebuild.
3417 2010-09-17 Doug Kwan <dougkwan@google.com>
3419 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
3420 defintion if relocation uses GOT entries of the symbol.
3421 * testsuite/icf_safe_test.sh: Fix test.
3422 * testsuite/icf_safe_so_test.sh: Fix test.
3424 2010-09-16 Cary Coutant <ccoutant@google.com>
3426 * script_sections.cc (class Memory_region): Remove "NULL" from
3427 vector initializations.
3429 2010-09-15 Cary Coutant <ccoutant@google.com>
3431 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
3432 Resolve forwarding symbols.
3434 2010-09-15 Doug Kwan <dougkwan@google.com>
3436 * gold/testsuite/script_test_3.t: Add ARM special sections.
3437 * gold/testsuite/script_test_4.t: Same.
3438 * gold/testsuite/script_test_5.t: Same.
3439 * gold/testsuite/script_test_6.t: Same.
3440 * gold/testsuite/script_test_7.t: Same.
3441 * gold/testsuite/script_test_7.t: Same.
3442 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
3444 2010-09-14 Cary Coutant <ccoutant@google.com>
3446 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
3447 (Target_x86_64::Relocate::relocate_tls): Replace check for
3448 saw_tls_block_reloc_ with test for executable section.
3450 2010-09-12 Cary Coutant <ccoutant@google.com>
3452 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
3453 position-independent executables to shared libraries need dynamic
3455 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
3456 position-independent executables.
3457 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
3458 * testsuite/Makefile.in: Regenerate.
3460 2010-09-10 Nick Clifton <nickc@redhat.com>
3463 * testsuite/memory_test.t: Discard any sections that are not
3466 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
3469 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
3470 "This::" to work around a bug in gcc 4.2.
3472 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
3474 2010-09-09 Rafael Espindola <espindola@google.com>
3476 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
3477 sections with different PF_X flags in the same segment.
3478 (Layout::find_first_load_seg): Search all segments to find the first
3480 * options.h (rosegment): New.
3482 2010-09-08 Rafael Espindola <espindola@google.com>
3484 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
3486 2010-09-08 Doug Kwan <dougkwan@google.com>
3488 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
3489 (Arm_relobj::do_relocate_sections): Add new parameter for output
3490 file to match the parent.
3491 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
3492 of local symbols instead of input values. Update code to track
3493 changes in gold::relocate_section.
3494 * object.cc (Sized_relobj::compute_final_local_value): New methods.
3495 (Sized_relobj::compute_final_local_value_internal): New methods.
3496 (Sized_relobj::do_finalize_local_symbols): Move code from loop
3497 body into private version of Sized_relobj::compute_final_local_value.
3498 Call the inline method.
3499 * object.h (Symbol_value::Symbol_value): Define destructor. Free
3500 merged symbol value if there is one.
3501 (Symbol_value::has_output_value): New method defintiion.
3502 (Sized_relobj::Compute_final_local_value_status): New enum type.
3503 (Sized_relobj::compute_final_local_value): New methods.
3504 (Sized_relobj::compute_final_local_value_internal): New methods.
3505 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
3506 and arm_cortex_a8.sh.
3507 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
3508 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
3510 * Makefile.in: Regenerate.
3511 * testsuite/arm_bl_out_of_range.s: Update test.
3512 * testsuite/thumb_bl_out_of_range.s: Ditto.
3513 * testsuite/thumb_blx_out_of_range.s: Ditto.
3514 * testsuite/arm_branch_out_of_range.sh: New file.
3515 * testsuite/arm_cortex_a8.sh: Ditto.
3516 * testsuite/arm_cortex_a8_b.s: Ditto.
3517 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
3518 * testsuite/arm_cortex_a8_b_local.s: Ditto.
3519 * testsuite/arm_cortex_a8_bl.s: Ditto.
3520 * testsuite/arm_cortex_a8_blx.s: Ditto.
3521 * testsuite/arm_cortex_a8_local.s: Ditto.
3522 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
3523 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
3525 2010-09-08 Rafael Espindola <espindola@google.com>
3527 * Makefile.am (memory_test.stdout): Run readelf with -W.
3528 * Makefile.in: Regenerate.
3529 * testsuite/memory_test.sh: Make the regexps accept both 32 and
3532 2010-09-08 Rafael Espindola <espindola@google.com>
3534 * script-sections.cc (Script_sections::add_memory_region): Convert
3535 field precision to int.
3536 * script.cc (script_set_section_region, script_set_section_region):
3537 Convert field precision to int.
3539 2010-09-08 Rafael Espindola <espindola@google.com>
3541 * arm.cc (do_finalize_sections): Create the __exidx_start and
3542 __exdix_end symbols even when the section is missing.
3544 2010-09-08 Nick Clifton <nickc@redhat.com>
3546 * README: Remove claim that MEMORY is not supported.
3547 * expression.cc (script_exp_function_origin)
3548 (script_exp_function_length): Move from here to ...
3549 * script.cc: ... here.
3550 (script_set_section_region, script_add_memory)
3551 (script_parse_memory_attr, script_include_directive): New
3553 * script-sections.cc
3554 (class Memory_region): New class.
3555 (class Output_section_definition): Add set_memory_region,
3556 set_section_vma, set_section_lma and get_section_name methods.
3557 (class Script_Sections): Add add_memory_region,
3558 find_memory_region, find_memory_region_origin,
3559 find_memory_region_length and set_memory_region methods.
3560 Have set_section_addresses method walk the list of set memory
3562 Extend the print methos to display memory regions.
3563 * script-sections.h: Add prototypes for new methods.
3564 Add enum for MEMORY region attributes.
3565 * yyscript.y: Add support for parsing MEMORY regions.
3566 * script-c.h: Add prototypes for new functions.
3567 * testsuite/Makefile.am: Add test of MEMORY region functionality.
3568 * testsuite/Makefile.in: Regenerate.
3569 * testsuite/memory_test.sh: New script.
3570 * testsuite/memory_test.s: New assembler source file.
3571 * testsuite/memory_test.t: New linker script.
3573 2010-08-27 Doug Kwan <dougkwan@google.com>
3575 * gold/resolve.cc (Symbol_table::should_override): Let a weak
3576 reference override an existing dynamic weak reference.
3577 * testsuite/Makefile.am: Add new test dyn_weak_ref.
3578 * testsuite/Makefile.in: Regenerate.
3579 * testsuite/dyn_weak_ref.sh: New file.
3580 * testsuite/dyn_weak_ref_1.c: Ditto.
3581 * testsuite/dyn_weak_ref_2.c: Ditto.
3583 2010-08-27 Ian Lance Taylor <iant@google.com>
3585 * incremental.h (class Incremental_input_entry): Add virtual
3588 2010-08-27 Ian Lance Taylor <iant@google.com>
3590 * testsuite/start_lib_test_3.c: Mark t3 as used.
3592 2010-08-27 Nick Clifton <nickc@redhat.com>
3594 * options.cc (version_script): Fix small typo in previous
3597 2010-08-25 Nick Clifton <nickc@redhat.com>
3599 * archive.cc: Formatting fixes: Remove whitespace between
3600 typename and following asterisk. Remove whitespace between
3601 function name and opening parenthesis.
3602 * archive.h: Likewise.
3604 * attributes.cc: Likewise.
3605 * attributes.h: Likewise.
3606 * common.cc: Likewise.
3607 * copy-relocs.cc: Likewise.
3608 * dirsearch.h: Likewise.
3609 * dynobj.cc: Likewise.
3610 * ehframe.cc: Likewise.
3611 * ehframe.h: Likewise.
3612 * expression.cc: Likewise.
3613 * fileread.cc: Likewise.
3614 * fileread.h: Likewise.
3616 * gold-threads.cc: Likewise.
3617 * gold.cc: Likewise.
3618 * i386.cc: Likewise.
3620 * incremental-dump.cc: Likewise.
3621 * incremental.cc: Likewise.
3622 * layout.cc: Likewise.
3623 * layout.h: Likewise.
3624 * main.cc: Likewise.
3625 * merge.cc: Likewise.
3626 * merge.h: Likewise.
3627 * object.cc: Likewise.
3628 * object.h: Likewise.
3629 * options.cc: Likewise.
3630 * options.h: Likewise.
3631 * output.cc: Likewise.
3632 * output.h: Likewise.
3633 * plugin.cc: Likewise.
3634 * plugin.h: Likewise.
3635 * powerpc.cc: Likewise.
3636 * reloc.cc: Likewise.
3637 * script-c.h: Likewise.
3638 * script-sections.cc: Likewise.
3639 * script.cc: Likewise.
3640 * stringpool.cc: Likewise.
3641 * symtab.cc: Likewise.
3642 * symtab.h: Likewise.
3643 * target.cc: Likewise.
3644 * timer.cc: Likewise.
3645 * timer.h: Likewise.
3646 * version.cc: Likewise.
3647 * x86_64.cc: Likewise.
3649 2010-08-24 Nick Clifton <nickc@redhat.com>
3652 * layout.cc (segment_precedes): Sort segments by their physical
3653 addresses, if they have been set.
3655 2010-08-23 Cary Coutant <ccoutant@google.com>
3657 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
3659 (Lib_group::include_member): Unlock object after deleting its
3661 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
3664 2010-08-19 Neil Vachharajani <nvachhar@google.com>
3665 Cary Coutant <ccoutant@google.com>
3667 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
3668 constructor, and set_blocker.
3669 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
3671 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
3672 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
3673 * testsuite/Makefile.am (start_lib_test): New test case.
3674 * testsuite/Makefile.in: Regenerate.
3675 * testsuite/start_lib_test_main.c: New file.
3676 * testsuite/start_lib_test_1.c: New file.
3677 * testsuite/start_lib_test_2.c: New file.
3678 * testsuite/start_lib_test_3.c: New file.
3680 2010-08-19 Ian Lance Taylor <iant@google.com>
3682 * Makefile.in: Rebuild with automake 1.11.1.
3683 * aclocal.m4: Likewise.
3684 * testsuite/Makefile.in: Likewise.
3686 2010-08-19 Ian Lance Taylor <iant@google.com>
3689 * i386.cc (class Output_data_plt_i386): Update declarations.
3690 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
3691 local_ifuncs_ fields.
3692 (Target_i386::do_plt_section_for_global): New function.
3693 (Target_i386::do_plt_section_for_local): New function.
3694 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
3695 parameter; change all callers. Initialize global_ifuncs_ and
3696 local_ifuncs_. If doing a static link define __rel_iplt_start and
3698 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
3699 (Output_data_plt_i386::add_local_ifunc_entry): New function.
3700 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
3702 (Target_i386::make_plt_section): New function, broken out of
3703 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
3704 (Target_i386::make_plt_entry): Call make_plt_section.
3705 (Target_i386::make_local_ifunc_plt_entry): New function.
3706 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
3707 (Target_i386::Scan::local): Handle IFUNC symbols. Add
3708 R_386_IRELATIVE to switch.
3709 (Target_i386::Scan::global): Likewise.
3710 (Target_i386::Relocate::relocate): Likewise.
3711 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
3713 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
3714 (Target_x86_64::do_plt_section_for_global): New function.
3715 (Target_x86_64::do_plt_section_for_local): New function.
3716 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
3717 parameter; change all callers. If doing a static link define
3718 __rela_iplt_start and __rela_iplt_end.
3719 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
3720 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
3721 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
3723 (Target_x86_64::make_local_ifunc_plt_entry): New function.
3724 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
3726 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
3727 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
3728 R_X86_64_IRELATIVE to switch.
3729 (Target_x86_64::Scan::global): Likewise.
3730 (Target_x86_64::Relocate::relocate): Likewise.
3731 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
3733 * target.h (class Target): Add plt_section_for_global and
3734 plt_section_for_local functions. Add do_plt_section_for_global
3735 and do_plt_section_for_local virtual functions.
3736 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
3737 clarifying comments.
3738 (Symbol::use_plt_offset): Handle IFUNC symbol.
3739 * object.cc (Sized_relobj::Sized_relobj): Initialize
3741 (Sized_relobj::local_has_plt_offset): New function.
3742 (Sized_relobj::local_plt_offset): New function.
3743 (Sized_relobj::set_local_plt_offset): New function.
3744 (Sized_relobj::do_count): Handle IFUNC symbol.
3745 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
3746 a bit away from input_shndx_ field. Add set_is_func_symbol and
3747 is_ifunc_symbol functions.
3748 (class Sized_relobj): Update declarations. Remove Tls_got_entry
3749 and Local_tls_got_offsets. Define Local_plt_offsets. Add
3750 local_plt_offsets_ field.
3751 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
3752 * output.h (class Output_section_data): Add non-const
3753 output_section function.
3754 (class Output_data_got): Update declarations.
3755 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
3756 Add use_plt_offset parameter to global and local constructors.
3757 Change all callers. Change local_sym_index_ field to 31 bits.
3758 Change GSYM_CODE and CONSTANT_CODE accordingly.
3759 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
3760 doing a static link don't set sh_link field.
3761 (Output_data_got::Got_entry::write): Use PLT offset if
3763 (Output_data_got::add_global_plt): New function.
3764 (Output_data_got::add_local_plt): New function.
3765 * target-reloc.h (relocate_section): Handle IFUNC symbol.
3766 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
3767 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
3768 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
3769 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
3771 * testsuite/ifunc-sel.h: New file.
3772 * testsuite/ifuncmain1.c: New file.
3773 * testsuite/ifuncmain1vis.c: New file.
3774 * testsuite/ifuncmod1.c: New file.
3775 * testsuite/ifuncdep2.c: New file.
3776 * testsuite/ifuncmain2.c: New file.
3777 * testsuite/ifuncmain3.c: New file.
3778 * testsuite/ifuncmod3.c: New file.
3779 * testsuite/ifuncmain4.c: New file.
3780 * testsuite/ifuncmain5.c: New file.
3781 * testsuite/ifuncmod5.c: New file.
3782 * testsuite/ifuncmain6pie.c: New file.
3783 * testsuite/ifuncmod6.c: New file.
3784 * testsuite/ifuncmain7.c: New file.
3785 * configure, testsuite/Makefile.in: Rebuild.
3787 2010-08-18 Ian Lance Taylor <iant@google.com>
3790 (Output_section_incremental_inputs::write_input_files): Add cast
3791 to avoid signed/unsigned comparison warning.
3792 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3794 2010-08-12 Cary Coutant <ccoutant@google.com>
3796 * common.cc (Sort_commons::operator()): Remove unnecessary code.
3798 2010-08-13 Ian Lance Taylor <iant@google.com>
3800 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
3802 2010-08-12 Cary Coutant <ccoutant@google.com>
3803 Doug Kwan <dougkwan@google.com>
3805 * resolve.cc (Symbol_table::should_override): When a weak dynamic
3806 defintion overrides non-weak undef, remember that the original undef
3808 * symtab.cc (Symbol_table::sized_write_global): For undef without
3809 an original weak binding, set binding to global in output.
3810 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
3811 * testsuite/Makefile.in: Regenerate.
3812 * testsuite/strong_ref_weak_def.sh: New file.
3813 * testsuite/strong_ref_weak_def_1.c: Ditto.
3814 * testsuite/strong_ref_weak_def_2.c: Ditto.
3816 2010-08-12 Cary Coutant <ccoutant@google.com>
3818 * testsuite/incremental_test.sh: Rewrite.
3819 * testsuite/incremental_test_1.c: Rewrite.
3820 * testsuite/incremental_test_2.c: Rewrite.
3822 2010-08-12 Cary Coutant <ccoutant@google.com>
3824 * arm.cc (Target_arm::got_size): Add const.
3825 (Target_arm::got_entry_count): New function.
3826 (Target_arm::plt_entry_count): New function.
3827 (Target_arm::first_plt_entry_offset): New function.
3828 (Target_arm::plt_entry_size): New function.
3829 (Output_data_plt_arm::entry_count): New function.
3830 (Output_data_plt_arm::first_plt_entry_offset): New function.
3831 (Output_data_plt_arm::get_plt_entry_size): New function.
3832 * i386.cc (Target_i386::got_size): Add const.
3833 (Target_i386::got_entry_count): New function.
3834 (Target_i386::plt_entry_count): New function.
3835 (Target_i386::first_plt_entry_offset): New function.
3836 (Target_i386::plt_entry_size): New function.
3837 (Output_data_plt_i386::entry_count): New function.
3838 (Output_data_plt_i386::first_plt_entry_offset): New function.
3839 (Output_data_plt_i386::get_plt_entry_size): New function.
3840 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
3841 find_incremental_inputs_sections. Dump incremental_got_plt section.
3842 * incremental.cc: Include target.h.
3843 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
3844 parameter. Adjust all callers. Find incremental_got_plt section.
3845 (Incremental_inputs::create_data_sections): Create incremental_got_plt
3847 (Output_section_incremental_inputs::set_final_data_size): Calculate
3848 size of incremental_got_plt section.
3849 (Output_section_incremental_inputs::do_write): Write the
3850 incremental_got_plt section.
3851 (Got_plt_view_info): New struct.
3852 (Local_got_offset_visitor): New class.
3853 (Global_got_offset_visitor): New class.
3854 (Global_symbol_visitor_got_plt): New class.
3855 (Output_section_incremental_inputs::write_got_plt): New function.
3856 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
3857 Add parameter. Adjust all callers.
3858 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3859 (Incremental_inputs::got_plt_section): New function.
3860 (Incremental_inputs::got_plt_section_): New data member.
3861 (Incremental_got_plt_reader): New class.
3862 * layout.cc (Layout::create_incremental_info_sections): Add the
3863 incremental_got_plt section.
3864 * object.h (Got_offset_list::get_list): New function.
3865 (Got offset_list::for_all_got_offsets): New function.
3866 (Sized_relobj::local_got_offset_list): New function.
3867 * powerpc.cc (Target_powerpc::got_size): Add const.
3868 (Target_powerpc::got_entry_count): New function.
3869 (Target_powerpc::plt_entry_count): New function.
3870 (Target_powerpc::first_plt_entry_offset): New function.
3871 (Target_powerpc::plt_entry_size): New function.
3872 (Output_data_plt_powerpc::entry_count): New function.
3873 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
3874 (Output_data_plt_powerpc::get_plt_entry_size): New function.
3875 * sparc.cc (Target_sparc::got_size): Add const.
3876 (Target_sparc::got_entry_count): New function.
3877 (Target_sparc::plt_entry_count): New function.
3878 (Target_sparc::first_plt_entry_offset): New function.
3879 (Target_sparc::plt_entry_size): New function.
3880 (Output_data_plt_sparc::entry_count): New function.
3881 (Output_data_plt_sparc::first_plt_entry_offset): New function.
3882 (Output_data_plt_sparc::get_plt_entry_size): New function.
3883 * symtab.h (Symbol::got_offset_list): New function.
3884 (Symbol_table::for_all_symbols): New function.
3885 * target.h (Sized_target::got_entry_count): New function.
3886 (Sized_target::plt_entry_count): New function.
3887 (Sized_target::plt_entry_size): New function.
3888 * x86_64.cc (Target_x86_64::got_size): Add const.
3889 (Target_x86_64::got_entry_count): New function.
3890 (Target_x86_64::plt_entry_count): New function.
3891 (Target_x86_64::first_plt_entry_offset): New function.
3892 (Target_x86_64::plt_entry_size): New function.
3893 (Output_data_plt_x86_64::entry_count): New function.
3894 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
3895 (Output_data_plt_x86_64::get_plt_entry_size): New function.
3897 2010-08-12 Cary Coutant <ccoutant@google.com>
3899 * archive.cc: Include incremental.h.
3900 (Archive::Archive): Initialize incremental_info_.
3901 (Archive::include_member): Record archive members in incremental info.
3902 (Add_archive_symbols::run): Record begin and end of an archive in
3904 (Lib_group::include_member): Record objects in incremental info.
3905 * archive.h (Incremental_archive_entry): Forward declaration.
3906 (Archive::set_incremental_info): New member function.
3907 (Archive::incremental_info): New member function.
3908 (Archive::Unused_symbol_iterator): New class.
3909 (Archive::unused_symbols_begin): New member function.
3910 (Archive::unused_symbols_end): New member function.
3911 (Archive::incremental_info_): New data member.
3912 * incremental-dump.cc (find_input_containing_global): New function.
3913 (dump_incremental_inputs): Dump new incremental info sections.
3914 * incremental.cc: Include symtab.h.
3915 (Output_section_incremental_inputs): New class.
3916 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
3917 new incremental info sections.
3918 (Sized_incremental_binary::do_check_inputs): Likewise.
3919 (Incremental_inputs::report_archive): Remove.
3920 (Incremental_inputs::report_archive_begin): New function.
3921 (Incremental_inputs::report_archive_end): New function.
3922 (Incremental_inputs::report_object): New function.
3923 (Incremental_inputs::finalize_inputs): Remove.
3924 (Incremental_inputs::report_input_section): New function.
3925 (Incremental_inputs::report_script): Rewrite.
3926 (Incremental_inputs::finalize): Do nothing but finalize string table.
3927 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3928 (Incremental_inputs::sized_create_inputs_section_data): Remove.
3929 (Incremental_inputs::create_data_sections): New function.
3930 (Incremental_inputs::relocs_entsize): New function.
3931 (Output_section_incremental_inputs::set_final_data_size): New function.
3932 (Output_section_incremental_inputs::do_write): New function.
3933 (Output_section_incremental_inputs::write_header): New function.
3934 (Output_section_incremental_inputs::write_input_files): New function.
3935 (Output_section_incremental_inputs::write_info_blocks): New function.
3936 (Output_section_incremental_inputs::write_symtab): New function.
3937 * incremental.h (Incremental_script_entry): Forward declaration.
3938 (Incremental_object_entry): Forward declaration.
3939 (Incremental_archive_entry): Forward declaration.
3940 (Incremental_inputs): Forward declaration.
3941 (Incremental_inputs_header_data): Remove.
3942 (Incremental_inputs_header): Remove.
3943 (Incremental_inputs_header_write): Remove.
3944 (Incremental_inputs_entry_data): Remove.
3945 (Incremental_inputs_entry): Remove.
3946 (Incremental_inputs_entry_write): Remove.
3947 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
3948 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
3949 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3950 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
3952 (Incremental_input_entry): New class.
3953 (Incremental_script_entry): New class.
3954 (Incremental_object_entry): New class.
3955 (Incremental_archive_entry): New class.
3956 (Incremental_inputs::Incremental_inputs): Initialize new data members.
3957 (Incremental_inputs::report_inputs): Remove.
3958 (Incremental_inputs::report_archive): Remove.
3959 (Incremental_inputs::report_archive_begin): New function.
3960 (Incremental_inputs::report_archive_end): New function.
3961 (Incremental_inputs::report_object): Change prototype.
3962 (Incremental_inputs::report_input_section): New function.
3963 (Incremental_inputs::report_script): Change prototype.
3964 (Incremental_inputs::get_reloc_count): New function.
3965 (Incremental_inputs::set_reloc_count): New function.
3966 (Incremental_inputs::create_data_sections): New function.
3967 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3968 (Incremental_inputs::inputs_section): New function.
3969 (Incremental_inputs::symtab_section): New function.
3970 (Incremental_inputs::relocs_section): New function.
3971 (Incremental_inputs::get_stringpool): Add const.
3972 (Incremental_inputs::command_line): Add const.
3973 (Incremental_inputs::inputs): Remove.
3974 (Incremental_inputs::command_line_key): New function.
3975 (Incremental_inputs::input_file_count): New function.
3976 (Incremental_inputs::input_files): New function.
3977 (Incremental_inputs::relocs_entsize): New function.
3978 (Incremental_inputs::sized_create_inputs_section_data): Remove.
3979 (Incremental_inputs::finalize_inputs): Remove.
3980 (Incremental_inputs::Input_info): Remove.
3981 (Incremental_inputs::lock_): Remove.
3982 (Incremental_inputs::inputs_): Change type.
3983 (Incremental_inputs::inputs_map_): Remove.
3984 (Incremental_inputs::current_object_entry_): New data member.
3985 (Incremental_inputs::inputs_section_): New data member.
3986 (Incremental_inputs::symtab_section_): New data member.
3987 (Incremental_inputs::relocs_section_): New data member.
3988 (Incremental_inputs::reloc_count_): New data member.
3989 (Incremental_inputs_reader): New class.
3990 (Incremental_symtab_reader): New class.
3991 (Incremental_relocs_reader): New class.
3992 * layout.cc (Layout::finalize): Move finalization of incremental info
3993 and creation of incremental info sections to follow finalization of
3994 symbol table. Set offsets for postprocessing sections.
3995 (Layout::create_incremental_info_sections): Call
3996 Incremental_inputs::create_data_sections. Add incremental symtab
3997 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
3998 sections to layout after input sections.
3999 * layout.h (struct Timespec): Forward declaration.
4000 (Layout::incremental_inputs): Add const.
4001 (Layout::create_incremental_info_sections): Add parameter.
4002 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
4003 * object.cc: Include incremental.h.
4004 (Relobj::finalize_incremental_relocs): New function.
4005 (Sized_relobj::do_layout): Record input sections in incremental info.
4006 * object.h (Object::output_section): New function.
4007 (Object::output_section_offset): Moved from Relobj.
4008 (Object::get_incremental_reloc_base): New function.
4009 (Object::get_incremental_reloc_count): New function.
4010 (Object::do_output_section): New function.
4011 (Object::do_output_section_offset): Moved from Relobj.
4012 (Object::do_get_incremental_reloc_base): New function.
4013 (Object::do_get_incremental_reloc_count): New function.
4014 (Object::Object): Initialize new data members.
4015 (Relobj::output_section): Renamed do_output_section and moved to
4017 (Relobj::output_section_offset): Moved to Object.
4018 (Relobj::do_get_incremental_reloc_base): New function.
4019 (Relobj::do_get_incremental_reloc_count): New function.
4020 (Relobj::allocate_incremental_reloc_counts): New function.
4021 (Relobj::count_incremental_reloc): New function.
4022 (Relobj::finalize_incremental_relocs): New function.
4023 (Relobj::next_incremental_reloc_index): New function.
4024 (Relobj::reloc_counts_): New data member.
4025 (Relobj::reloc_bases_): New data member.
4026 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
4027 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
4028 (Sized_relobj::incremental_relocs_scan): New function.
4029 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4030 (Sized_relobj::incremental_relocs_write): New function.
4031 (Sized_relobj::incremental_relocs_write_reltype): New function.
4032 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
4034 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
4035 archives and object files elsewhere.
4036 (Add_symbols::run): Report object files here.
4037 (Finish_group::run): Report end of archive at end of group.
4038 * reloc.cc: Include layout.h, incremental.h.
4039 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
4040 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
4041 (Sized_relobj::incremental_relocs_scan): New function.
4042 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4043 (Sized_relobj::do_relocate_sections): Write incremental relocations.
4044 (Sized_relobj::incremental_relocs_write): New function.
4045 (Sized_relobj::incremental_relocs_write_reltype): New function.
4046 * script.cc (read_input_script): Rewrite test for incremental link.
4047 Change call to Incremental_inputs::report_script.
4048 * symtab.h (Symbol_table::first_global_index): New function.
4049 (Symbol_table::output_count): New function.
4051 2010-08-12 Doug Kwan <dougkwan@google.com>
4053 * arm.cc (Target_arm::merge_object_attributes): Check command line
4054 options --no-wchar-size-warning and --no-enum-size-warning.
4055 * options.h (General_options): Add ld-compatible options
4056 --no-enum-size-warning and --no-wchar-size-warning.
4058 2010-08-04 Ian Lance Taylor <iant@google.com>
4060 * x86_64.cc (Target_x86_64::Scan::local): Use
4061 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
4062 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
4063 (Target_x86_64::Scan::global): Likewise.
4064 (Target_x86_64::Relocate::relocate): Likewise.
4065 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
4068 2010-08-03 Cary Coutant <ccoutant@google.com>
4070 * merge.cc (Output_merge_string::do_add_input_section): Count strings
4071 to reserve space in merged_strings vector. Keep total input size
4073 (Output_merge_string::do_print_merge_stats): Print total input size.
4074 * merge.h (Output_merge_string): Add input_size_ field.
4075 * stringpool.cc (Stringpool_template::string_length): Move
4076 implementations out of Stringpool_template class and place in
4078 * stringpool.h (string_length): Move out of Stringpool_template.
4080 2010-08-03 Ian Lance Taylor <iant@google.com>
4083 * layout.cc (relaxation_loop_body): If address of load segment is
4084 set, adjust address to include headers if possible.
4086 2010-08-03 Ian Lance Taylor <iant@google.com>
4088 * version.cc (version_string): Bump to 1.10.
4090 2010-08-03 Ian Lance Taylor <iant@google.com>
4093 * layout.h (enum Output_section_order): Define.
4094 (class Layout): Update declarations.
4095 * layout.cc (Layout::get_output_section): Add order parameter.
4096 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
4097 is_first_non_relro parameters. Change all callers.
4098 (Layout::choose_output_section): Likewise.
4099 (Layout::add_output_section_data): Likewise.
4100 (Layout::make_output_section): Likewise. Set order.
4101 (Layout::default_section_order): New function.
4102 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
4103 * output.cc (Output_section::Output_section): Initialize order_.
4104 Don't initialize deleted fields.
4105 (Output_segment::Output_segment): Don't initialize deleted
4107 (Output_segment::add_output_section_to_load): New function
4108 replacing add_output_section. Change all callers to call this or
4109 add_output_section_to_nonload.
4110 (Output_segment::add_output_section_to_nonload): New function.
4111 (Output_segment::remove_output_section): Rewrite.
4112 (Output_segment::add_initial_output_data): Likewise.
4113 (Output_segment::has_any_data_sections): Likewise.
4114 (Output_segment::is_first_section_relro): Likewise.
4115 (Output_segment::maximum_alignment): Likewise.
4116 (Output_segment::has_dynamic_reloc): New function replacing
4117 dynamic_reloc_count. Change all callers.
4118 (Output_segment::has_dynamic_reloc_list): New function replacing
4119 dynamic_reloc_count_list. Change all callers.
4120 (Output_segment::set_section_addresses): Rewrite.
4121 (Output_segment::set_offset): Rewrite.
4122 (Output_segment::find_first_and_last_list): Remove.
4123 (Output_segment::set_tls_offsets): Rewrite.
4124 (Output_segment::first_section_load_address): Likewise.
4125 (Output_segment::output_section_count): Likewise.
4126 (Output_segment::section_with_lowest_load_address): Likewise.
4127 (Output_segment::write_section_headers): Likewise.
4128 (Output_segment::print_sections_to_map): Likewise.
4129 * output.h (class Output_data): Remove dynamic_reloc_count_
4130 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
4131 (Output_data::add_dynamic_reloc): Rewrite.
4132 (Output_data::has_dynamic_reloc): New function.
4133 (Output_data::dynamic_reloc_count): Remove.
4134 (class Output_section): Add order_ field. Remvoe is_relro_local_,
4135 is_last_relro_, is_first_non_relro_, is_interp_,
4136 is_dynamic_linker_section_ fields. Add order and set_order
4137 functions. Remove is_relro_local, set_is_relro_local,
4138 is_last_relro, set_is_last_relro, is_first_non_relro,
4139 set_is_first_non_relro functions, is_interp, set_is_interp,
4140 is_dynamic_linker_section, and set_is_dynamic_linker_section
4142 (class Output_segment): Change Output_data_list from std::list to
4143 std:;vector. Add output_lists_ field. Remove output_data_ and
4144 output_bss_ fields. Update declarations.
4146 2010-08-02 Ian Lance Taylor <iant@google.com>
4148 * arm.cc (Target_arm::gc_process_relocs): Use typename.
4149 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
4150 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
4152 2010-08-02 Ian Lance Taylor <iant@google.com>
4155 * script.cc (Script_options::Script_options): Initialize
4156 symbol_definitions_ and symbol_references_.
4157 (Script_options::add_symbol_assignment): Update
4158 symbol_definitions_ and symbol_references_.
4159 (Script_options::add_symbol_reference): New function.
4160 (script_symbol): New function.
4161 * script.h (class Script_options): Add symbol_definitions_ and
4162 symbol_references_ fields.
4163 (Script_options::referenced_const_iterator): New type.
4164 (Script_options::referenced_begin): New function.
4165 (Script_options::referenced_end): New function.
4166 (Script_options::is_referenced): New function.
4167 (Script_options::any_unreferenced): New function.
4168 * script-c.h (script_symbol): Declare.
4169 * yyscript.y (exp): Call script_symbol.
4170 * symtab.cc: Include "script.h".
4171 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
4172 Change all callers. Check symbols referenced by scripts.
4173 (Symbol_table::add_undefined_symbols_from_command_line): Add
4174 layout parameter. Change all callers.
4175 (Symbol_table::do_add_undefined_symbols_from_command_line):
4176 Likewise. Break out loop body. Check symbols referenced by
4178 (Symbol_table::add_undefined_symbol_from_command_line): New
4179 function broken out of
4180 do_add_undefined_symbols_from_command_line.
4181 * symtab.h (class Symbol_table): Update declarations.
4182 * archive.cc: Include "layout.h".
4183 (Archive::should_include_member): Add layout parameter. Change
4184 all callers. Check for symbol mentioned in expression.
4185 * archive.h (class Archive): Update declaration.
4186 * object.cc (Sized_relobj::do_should_include_member): Add layout
4188 * object.h (Object::should_include_member): Add layout parameter.
4190 (Object::do_should_include_member): Add layout parameter.
4191 (class Sized_relobj): Update declaration.
4192 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
4194 * dynobj.h (class Sized_dynobj): Update declaration.
4195 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
4197 * plugin.h (class Sized_pluginobj): Update declaration.
4199 2010-08-02 Ian Lance Taylor <iant@google.com>
4202 * output.cc (Output_segment::set_offset): Search for the first and
4203 last sections rather than assuming that the list is in order.
4204 (Output_segment::find_first_and_last_list): New function.
4205 * output.h (class Output_segment): Update declarations.
4206 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4207 (relro_strip_test_SOURCES): New variable.
4208 (relro_strip_test_DEPENDENCIES): New variable.
4209 (relro_strip_test_LDFLAGS): New variable.
4210 (relro_strip_test_LDADD): New variable.
4211 (relro_strip_test.so): New target.
4213 2010-08-02 Ian Lance Taylor <iant@google.com>
4215 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4216 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4217 (Target_i386::got_tlsdesc_section): New function.
4218 (Target_i386::got_section): Create space for GOT entries for
4219 TLSDESC relocations.
4220 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4222 (Target_i386::Scan::global): Likewise.
4223 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
4225 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
4226 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
4227 (Target_x86_64::got_tlsdesc_section): New function.
4228 (Target_x86_64::got_section): Create space for GOT entries for
4229 TLSDESC relocations.
4230 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
4232 (Target_x86_64::Scan::global): Likewise.
4233 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
4236 2010-08-02 Ian Lance Taylor <iant@google.com>
4238 * testsuite/final_layout.sh: Use dc to convert from hex to
4241 2010-07-29 Sriraman Tallam <tmsriram@google.com>
4243 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4244 paramter to the call to gold::gc_process_relocs.
4245 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4246 paramter to the call to gold::gc_process_relocs.
4247 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4248 parameter to the call to gold::gc_process_relocs.
4249 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4250 template parameter to the call to gold::gc_process_relocs.
4251 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4252 paramter to the call to gold::gc_process_relocs.
4253 * gc.h (get_embedded_addend_size): New function.
4254 (gc_process_relocs): Save the size of the reloc for use by ICF.
4255 * icf.cc (get_section_contents): Get the addend from the text section
4256 for SHT_REL relocation sections.
4257 * icf.h (Icf::Reloc_addend_size_info): New typedef.
4258 (Icf::Reloc_info): Add new member reloc_addend_size_info.
4259 * int_encoding.h (read_from_pointer): New overloaded function.
4260 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
4261 * testsuite/icf_sht_rel_addend_test.sh: New file.
4262 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
4263 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
4265 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4267 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
4268 * Makefile.in: Regenerate.
4269 * testsuite/Makefile.in: Regenerate.
4271 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
4273 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
4274 * gold/testsuite/debug_msg.cc: Likewise.
4275 * gold/testsuite/odr_violation1.cc
4276 * gold/testsuite/odr_violation2.cc
4278 2010-07-21 Cary Coutant <ccoutant@google.com>
4280 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
4281 string, and length fields.
4282 (Output_merge_string::Merged_strings_list): New type.
4283 (Output_merge_string::Merged_strings_lists): New typedef.
4284 (Output_merge_string): Replace merged_strings_ with
4285 merged_strings_lists_.
4286 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
4287 Merged_strings_list per input object and section. Don't store pointer
4288 to the string. Don't store length with each merged string entry.
4289 (Output_merge_string::finalize_merged_data): Loop over list of merged
4290 strings lists. Recompute length of each merged string.
4292 2010-07-15 Cary Coutant <ccoutant@google.com>
4294 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
4297 2010-07-14 Ian Lance Taylor <iant@google.com>
4299 * descriptors.cc (Descriptors::open): Report correct name in error
4302 2010-07-13 Doug Kwan <dougkwan@google.com>
4304 * arm.cc (Arm_input_section::Arm_input_section): For a
4305 SHT_ARM_EXIDX section, always keeps the input sections.
4306 (Arm_input_section::set_exidx_section_link): New method.
4307 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
4308 has_errors_ to false.
4309 (Arm_exidx_input_section::has_errors,
4310 Arm_exidx_input_section::set_has_errors): New methods.
4311 (Arm_exidx_input_section::has_errors_): New data member.
4312 (Arm_relobj::get_exidx_shndx_list): New method.
4313 (Arm_output_section::append_text_sections_to_list): Do not skip
4314 section without SHF_EXECINSTR.
4315 (Arm_output_section::fix_exidx_coverage): Skip input sections with
4317 (Arm_relobj::make_exidx_input_section): Add new parameter for text
4318 section header. Make error messages more verbose. Check for
4319 a non-executable section linked to an EXIDX section.
4320 (Arm_relobj::do_read_symbols): Remove error checking, which has been
4321 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
4322 check that there is no deferred EXIDX section if we exit early.
4323 Instead of not making an EXIDX section in case of an error, make one
4324 and set the has_errors flag of it.
4325 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
4326 in a relocatable link.
4327 (Target_arm::do_relax): Look for the EXIDX output section instead of
4328 assuming that it is called .ARM.exidx.
4329 (Target_arm::fix_exidx_coverage): Add a new parameter for input
4330 section list. Do not check for SHF_EXECINSTR section flags but
4331 skip any input section with errors.
4332 * output.cc (Output_section::Output_section): Initialize
4333 always_keeps_input_sections_ to false.
4334 (Output_section::add_input_section): Check for
4335 always_keeps_input_sections_.
4336 * output.h (Output_section::always_keeps_input_sections,
4337 Output_section::set_always_keeps_input_sections): New methods.
4338 (Output_section::always_keeps_input_sections): New data member.
4340 2010-07-13 Rafael Espindola <espindola@google.com>
4342 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
4343 * fileread.h (Input_file): Add try_extra_search_path and find_file.
4345 2010-07-13 Philip Herron <herron.philip@googlemail.com>
4346 Ian Lance Taylor <iant@google.com>
4348 * output.h (Output_section_lookup_maps::add_merge_section):
4349 Correct check of whether value was inserted.
4350 (Output_section_lookup_maps::add_merge_input_section): Likewise.
4351 (Output_section_lookup_maps::add_relaxed_input_section):
4353 * arm.cc (Target_arm::got_section): Remove used local os.
4354 * i386.cc (Target_i386::got_section): Likewise.
4355 * x86_64.cc (Target_x86_64::got_section): Likewise.
4356 * sparc.cc (Target_sparc::got_section): Likewise.
4357 (Target_sparc::relocate): Remove unused local have_got_offset.
4358 * powerpc.cc (Target_powerpc::relocate): Likewise.
4360 2010-07-13 Ian Lance Taylor <iant@google.com>
4362 * compressed_output.cc (zlib_decompress): Fix signature in
4365 * archive.cc (Archive::include_member): Unlock an external member
4366 of a thin archive. Don't bother to delete an object we know is
4369 2010-07-12 Cary Coutant <ccoutant@google.com>
4371 * compressed_output.cc (zlib_decompress): New function.
4372 (get_uncompressed_size): New function.
4373 (decompress_input_section): New function.
4374 * compressed_output.h (get_uncompressed_size): New function.
4375 (decompress_input_section): New function.
4376 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
4377 Handle compressed debug sections.
4378 * layout.cc (is_compressed_debug_section): New function.
4379 (Layout::output_section_name): Map compressed section names to
4381 * layout.h (is_compressed_debug_section): New function.
4382 (is_debug_info_section): Recognize compressed debug sections.
4383 * merge.cc: Include compressed_output.h.
4384 (Output_merge_data::do_add_input_section): Handle compressed
4386 (Output_merge_string::do_add_input_section): Handle compressed
4388 * object.cc: Include compressed_output.h.
4389 (Sized_relobj::Sized_relobj): Initialize new data members.
4390 (build_compressed_section_map): New function.
4391 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
4392 * object.h (Object::section_is_compressed): New method.
4393 (Object::do_section_is_compressed): New method.
4394 (Sized_relobj::Compressed_section_map): New type.
4395 (Sized_relobj::do_section_is_compressed): New method.
4396 (Sized_relobj::compressed_sections_): New data member.
4397 * output.cc (Output_section::add_input_section): Handle compressed
4399 * reloc.cc: Include compressed_output.h.
4400 (Sized_relobj::write_sections): Handle compressed debug sections.
4402 2010-07-08 Cary Coutant <ccoutant@google.com>
4404 * resolve.cc (Symbol_table::resolve): Remember whether undef was
4405 weak when resolving to a dynamic def.
4406 (Symbol_table::should_override): Add adjust_dyndef flag; set it
4407 for weak undef/dynamic def cases. Adjust callers.
4408 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
4409 undef_binding_weak_.
4410 (Symbol_table::sized_write_globals): Adjust symbol binding.
4411 (Symbol_table::sized_write_symbol): Add binding parameter.
4412 * symtab.h (Symbol::set_undef_binding): New method.
4413 (Symbol::is_undef_binding_weak): New method.
4414 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
4415 (Symbol_table::should_override): Add new parameter.
4416 (Symbol_table::sized_write_symbol): Add new parameter.
4418 * testsuite/weak_undef_file1.cc: Add new test case.
4419 * testsuite/weak_undef_file2.cc: Fix header comment.
4420 * testsuite/weak_undef_test.cc: Add new test case.
4422 2010-06-29 Doug Kwan <dougkwan@google.com>
4424 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
4425 Initialize USE_SYMBOL_.
4426 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
4428 (Arm_reloc_property::uses_symbol_): New data member declaration.
4429 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
4430 uses symbol value and symbol is undefined but not weakly undefined.
4432 2010-06-28 Rafael Espindola <espindola@google.com>
4434 * plugin.cc (Plugin::load): Use dlerror.
4436 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
4438 * symtab.cc (detect_odr_violations): When reporting an ODR
4439 violation, report an object where the symbol is defined.
4441 2010-06-25 Doug Kwan <dougkwan@google.com>
4443 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
4444 (Target_arm::section_may_have_icf_unsafe_pointers): New method
4446 (Target_arm::Scan::local_reloc_may_be_function_pointer,
4447 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
4448 target hook to detect function points.
4449 (Target_arm::Scan::possible_function_pointer_reloc): New method.
4450 * icf.h (Icf::check_section_for_function_pointers): Change type of
4451 parameter SECTION_NAME to const reference to std::string. Use
4452 target hook to determine if section may have unsafe pointers.
4453 * target.h (Target::section_may_have_icf_unsafe_pointers): New
4456 2010-06-21 Rafael Espindola <espindola@google.com>
4458 * fileread.cc (Input_file::find_fie): New
4459 (Input_file::open): Use Input_file::find_fie.
4460 * fileread.h (Input_file::find_fie): New
4461 * plugin.cc (set_extra_library_path): New.
4462 (Plugin::load): Add set_extra_library_path to the transfer vector.
4463 (Plugin_manager::set_extra_library_path): New.
4464 (Plugin_manager::add_input_file): Use the extra search path if set.
4465 (set_extra_library_path(): New.
4466 * plugin.h (Plugin_manager): Add set_extra_library_path and
4469 2010-06-19 Cary Coutant <ccoutant@google.com>
4471 * layout.cc (gdb_sections): Add .debug_types.
4472 (lines_only_debug_sections): Likewise.
4474 2010-06-18 Rafael Espindola <espindola@google.com>
4476 * plugin.cc (add_input_file,add_input_library)
4477 (Plugin_manager::add_input_file): Make filename arguments const.
4478 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
4481 2010-06-16 Doug Kwan <dougkwan@google.com>
4483 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
4484 .ARM.attributes section if we have not merged any input
4485 attributes sections.
4487 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4489 * arm.cc: Allow combining objects with no EABI version
4492 2010-06-15 Rafael Espindola <espindola@google.com>
4494 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
4496 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4498 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
4499 (struct iovec): Correct !HAVE_READV definition.
4501 2010-06-10 Cary Coutant <ccoutant@google.com>
4503 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
4504 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
4506 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
4509 * symtab.h (Symbol::is_placeholder): New member function.
4510 * target-reloc.h (relocate_section): Check for placeholder symbols.
4512 * testsuite/Makefile.am (plugin_test_8): New test.
4513 (plugin_test_9): New test.
4514 * testsuite/Makefile.in: Regenerate.
4516 2010-06-09 Nick Clifton <nickc@redhat.com>
4518 * yyscript.y (input_list_element): Allow strings prefixed with
4519 the '-' character. Treat these as libraries.
4520 * script.cc (script_add_library): New function. Adds a library
4521 specified by "-l<name>" found in an input script.
4522 * script-c.h: Add prototype for script_add_library.
4524 2010-06-07 Doug Kwan <dougkwan@google.com>
4526 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
4527 Restrict stub-group size to be within long conditional branch
4528 range when working around cortex-A8 erratum.
4530 2010-06-07 Damien Diederen <dd@crosstwine.com>
4532 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
4535 2010-06-03 Sriraman Tallam <tmsriram@google.com>
4539 (Output_section::Input_section_sort_entry::compare_section_ordering):
4540 Change to return non-zero correctly.
4541 (Output_section::Input_section_sort_section_order_index_compare
4542 ::operator()): Change to fix ambiguity in comparisons.
4544 2010-06-01 Sriraman Tallam <tmsriram@google.com>
4546 * gold.h (is_wildcard_string): New function.
4547 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
4548 (Layout::layout_eh_frame): Ditto.
4549 (Layout::find_section_order_index): New method.
4550 (Layout::read_layout_from_file): New method.
4551 * layout.h (Layout::find_section_order_index): New method.
4552 (Layout::read_layout_from_file): New method.
4553 (Layout::input_section_position_): New private member.
4554 (Layout::input_section_glob_): New private member.
4555 * main.cc (main): Call read_layout_from_file here.
4556 * options.h (--section-ordering-file): New option.
4557 * output.cc (Output_section::input_section_order_specified_): New
4559 (Output_section::Output_section): Initialize new member.
4560 (Output_section::add_input_section): Add new parameter.
4561 Keep input sections when --section-ordering-file is used.
4562 (Output_section::set_final_data_size): Sort input sections when
4563 section ordering file is specified.
4564 (Output_section::Input_section_sort_entry): Add new parameter.
4566 (Output_section::Input_section_sort_entry::compare_section_ordering):
4568 (Output_section::Input_section_sort_compare::operator()): Change to
4569 consider section_order_index.
4570 (Output_section::Input_section_sort_init_fini_compare::operator()):
4571 Change to consider section_order_index.
4572 (Output_section::Input_section_sort_section_order_index_compare
4573 ::operator()): New method.
4574 (Output_section::sort_attached_input_sections): Change to sort
4575 according to section order when specified.
4576 (Output_section::add_input_section<32, true>): Add new parameter.
4577 (Output_section::add_input_section<64, true>): Add new parameter.
4578 (Output_section::add_input_section<32, false>): Add new parameter.
4579 (Output_section::add_input_section<64, false>): Add new parameter.
4580 * output.h (Output_section::add_input_section): Add new parameter.
4581 (Output_section::input_section_order_specified): New
4583 (Output_section::set_input_section_order_specified): New method.
4584 (Input_section::Input_section): Initialize section_order_index_.
4585 (Input_section::section_order_index): New method.
4586 (Input_section::set_section_order_index): New method.
4587 (Input_section::section_order_index_): New member.
4588 (Input_section::Input_section_sort_section_order_index_compare): New
4590 (Output_section::input_section_order_specified_): New member.
4591 * script-sections.cc (is_wildcard_string): Delete and move modified
4593 (Output_section_element_input::Output_section_element_input): Modify
4594 call to is_wildcard_string.
4595 (Output_section_element_input::Input_section_pattern
4596 ::Input_section_pattern): Ditto.
4597 (Output_section_element_input::Output_section_element_input): Ditto.
4598 * testsuite/Makefile.am (final_layout): New test case.
4599 * testsuite/Makefile.in: Regenerate.
4600 * testsuite/final_layout.cc: New file.
4601 * testsuite/final_layout.sh: New file.
4603 2010-06-01 Rafael Espindola <espindola@google.com>
4605 * plugin.cc (Plugin::load): Pass the output name to the plugin.
4607 2010-06-01 Rafael Espindola <espindola@google.com>
4609 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
4610 visibility of symbols.
4612 2010-05-27 Doug Kwan <dougkwan@google.com>
4614 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
4615 from start of output section instead of address for a local symbol
4616 in a merged or relaxed section when doing a relocatable link.
4618 2010-05-26 Rafael Espindola <espindola@google.com>
4621 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
4622 adding sections the garbage collector removed.
4623 * gold/testsuite/Makefile.am: Add test.
4624 * gold/testsuite/Makefile.in: Regenerate.
4625 * gold/testsuite/plugin_test_7.sh: New.
4626 * gold/testsuite/plugin_test_7_1.c: New.
4627 * gold/testsuite/plugin_test_7_2.c: New.
4629 2010-05-26 Rafael Espindola <espindola@google.com>
4631 * script-sections.cc (Output_section_definition::set_section_addresses):
4632 Check for --section-start.
4634 2010-05-26 Doug Kwan <dougkwan@google.com>
4636 * arm.cc (Arm_scan_relocatable_relocs): New class.
4637 (Target_arm::relocate_special_relocatable): New method.
4638 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
4639 (Arm_relocate_functions::thumb_branch_common): Same.
4640 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
4641 instead of Default_scan_relocatable_relocs.
4642 * target-reloc.h (relocate_for_relocatable): Let target handle
4643 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
4644 * target.h (Sized_target::relocate_special_relocatable): New method.
4646 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4648 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
4650 2010-05-23 Doug Kwan <dougkwan@google.com>
4652 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
4654 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
4655 with a direct branch, not a conditional branch, to a stub.
4656 * merge.cc (Output_merge_base::record_input_section): New method
4658 (Output_merge_data::do_add_input_section): Record input section if
4659 keeps-input-sections flag is set.
4660 (Output_merge_string::do_add_input_section): Ditto.
4661 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
4662 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
4664 (Output_merge_base::keeps_input_sections,
4665 Output_merge_base::set_keeps_input_sections,
4666 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
4668 (Output_merge_base::Input_sections): New type declaration.
4669 (Output_merge_base::input_sections_begin,
4670 Output_merge_base::input_sections_end,
4671 Output_merge_base::do_set_keeps_input_sections): New method definitions.
4672 (Output_merge_base::bool keeps_input_sections_,
4673 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
4674 Output_merge_base::input_sections_): New data members.
4675 (Output_merge_data::do_set_keeps_input_sections): New method
4677 (Output_merge_string::do_set_keeps_input_sections): Ditto.
4678 * output.cc (Output_section::Input_section::relobj): Move method
4679 defintion from class declaration to here and handle merge sections.
4680 (Output_section::Input_section::shndx): Ditto.
4681 (Output_section::Output_section): Remove initializations of removed
4682 data members and initialize new data member LOOKUP_MAPS_.
4683 (Output_section::add_input_section): Set keeps-input-sections flag
4684 for a newly created merge output section as appropriate. Adjust code
4685 to use Output_section_lookup_maps class.
4686 (Output_section::add_relaxed_input_section): Adjst code for lookup
4687 maps code refactoring.
4688 (Output_section::add_merge_input_section): Add a new parameter
4689 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
4690 class. If adding input section to a newly created merge output
4691 section fails, remove the new merge section.
4692 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
4693 Adjust code for use of the Output_section_lookup_maps class.
4694 (Output_section::find_merge_section): Ditto.
4695 (Output_section::build_lookup_maps): New method defintion.
4696 (Output_section::find_relaxed_input_section): Adjust code to use
4697 Output_section_lookup_maps class.
4698 (Output_section::get_input_sections): Export merge sections. Adjust
4699 code to use Output_section_lookup_maps class.
4700 (Output_section:::add_script_input_section): Adjust code to use
4701 Output_section_lookup_maps class. Update lookup maps for merge
4703 (Output_section::discard_states): Use Output_section_lookup_maps.
4704 (Output_section::restore_states): Same.
4705 * output.h (Merge_section_properties): Move class defintion out of
4707 (Output_section_lookup_maps): New class.
4708 (Output_section::Input_section::is_merge_section): New method
4710 (Output_section::Input_section::relobj): Move defintion out of class
4711 defintion. Declare method only.
4712 (Output_section::Input_section::shndx): Ditto.
4713 (Output_section::Input_section::output_merge_base): New method defintion.
4714 (Output_section::Input_section::u2_.pomb): New union field.
4715 (Output_section::Merge_section_by_properties_map,
4716 Output_section::Output_section_data_by_input_section_map,
4717 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
4719 (Output_section::add_merge_input_section): Add new parameter
4720 KEEPS_INPUT_SECTIONS.
4721 (Output_section::build_lookup_maps): New method declaration.
4722 (Output_section::merge_section_map_,
4723 Output_section::merge_section_by_properties_map_,
4724 Output_section::relaxed_input_section_map_,
4725 Output_section::is_relaxed_input_section_map_valid_): Remove data
4727 (Output_section::lookup_maps_): New data member.
4729 2010-05-21 Doug Kwan <dougkwan@google.com>
4732 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
4733 avoid a compilation error.
4735 2010-05-19 Rafael Espindola <espindola@google.com>
4737 * script-sections.cc (Output_section_definition::allocate_to_segment):
4738 Update the phdrs_list even when the output section is NULL.
4739 * testsuite/Makefile.am: Add test.
4740 * testsuite/Makefile.in: Regenerate.
4741 * testsuite/script_test_9.cc: New.
4742 * testsuite/script_test_9.sh: New.
4743 * testsuite/script_test_9.t: New.
4745 2010-05-19 Doug Kwan <dougkwan@google.com>
4747 * arm.cc (Arm_input_section::original_size): New method.
4748 (Arm_input_section::do_addralign): Add a cast.
4749 (Arm_input_section::do_output_offset): Remove static cast.
4750 (Arm_input_section::original_addralign,
4751 Arm_input_section::original_size_): Change type to uint32_t.
4752 (Arm_input_section::init): Add safe casts for section alignment
4754 (Arm_input_section::set_final_data_size): Do not set address and
4755 offset of stub table.
4756 (Arm_output_section::fix_exidx_coverage): Change use of of
4757 Output_section::Simple_input_section to that of
4758 Output_section::Input_section.
4759 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
4760 except for the first pass.
4761 * output.cc (Output_section::get_input_sections): Change type of
4762 input_sections to std::list<Input_section>.
4763 (Output_section::add_script_input_section): Rename from
4764 Output_section::add_simple_input_section. Change type of SIS
4765 parameter from Simple_input_section to Input_section.
4766 * output.h (Output_section::Simple_input_section): Remove class.
4767 (Output_section::Input_section): Change class visibility to public.
4768 (Output_section::Input_section::addralign): Use stored alignments
4769 for special input sections if set.
4770 (Output_section::Input_section::set_addralign): New method.
4771 (Output_section::get_input_sections): Change parameter type from
4772 list of Simple_input_section to list of Input_section.
4773 (Output_section::add_script_input_section): Rename from
4774 Output_section::add_simple_input_section. Change first parameter's
4775 type from Simple_input_section to Input_section and remove the
4776 second and third parameters.
4777 * script-sections.cc (Input_section::Input_section_list): Change
4778 type to list of Output_section::Input_section/
4779 (Input_section_info::Input_section_info): Change parameter type of
4780 INPUT_SECTION to Output_section::Input_section.
4781 (Input_section_info::input_section): Change return type.
4782 (Input_section_info::input_section_): Change type to
4783 Output_section::Input_section.
4784 (Output_section_element_input::set_section_addresses): Adjust code
4785 to use Output_section::Input_section instead of
4786 Output_section::Simple_input_section. Adjust code for renaming
4787 of Output_section::add_simple_input_section.
4788 (Orphan_output_section::set_section_addresses): Ditto.
4790 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4792 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
4793 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
4795 2010-05-18 Rafael Espindola <espindola@google.com>
4797 * options.cc (General_options::finalize): Handle -nostdlib.
4798 * options.h (nostdlib): New option.
4799 * script.cc (script_add_search_dir): Handle -nostdlib.
4801 2010-05-12 Doug Kwan <dougkwan@google.com>
4803 * arm.cc (Target_arm::do_finalize_sections): Create an empty
4804 attributes section only if there no attributes section after merging.
4805 (Target_arm::merge_object_attributes): Move value of
4806 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
4807 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
4808 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
4809 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
4810 and arm_attr_merge_7.stdout.
4811 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
4812 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
4813 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
4814 arm_attr_merge_7b.o): New rules.
4815 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
4817 * testsuite/Makefile.in: Regenerate.
4818 * testsuite/arm_attr_merge.sh: New file.
4819 * testsuite/arm_attr_merge_[67][ab].s: Same.
4821 2010-05-05 Nick Clifton <nickc@redhat.com>
4823 * po/es.po: Updated Spanish translation.
4825 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
4827 * Makefile.am (install-exec-local): Properly install gold as
4828 default cross linker.
4829 * Makefile.in: Regenerated.
4831 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
4832 Nick Clifton <nickc@redhat.com>
4834 * configure.ac (install_as_default): Define and set to false
4835 unless --enable-gold or --enable-gold=both/gold has been
4837 * configure: Regenerate.
4839 * Makefile.am (install-exec-local): Install the executable as
4840 'ld.gold'. If install_as_default is true then also install it as
4842 * Makefile.in: Regenerated.
4844 2010-04-24 Ian Lance Taylor <iant@google.com>
4846 * layout.cc (Layout::layout_reloc): In relocatable link don't
4847 combine reloc sections for grouped sections.
4849 2010-04-23 Sriraman Tallam <tmsriram@google.com>
4851 * gc.h (gc_process_relocs): Pass information on relocs pointing to
4852 sections that are not ordinary to icf.
4853 * icf.cc (get_section_contents): Handle relocation pointing to section
4854 with no object or shndx information.
4855 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
4856 * testsuite/Makefile.in: Regenerate.
4857 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
4858 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
4860 2010-04-22 Ian Lance Taylor <iant@google.com>
4862 * expression.cc (Expression::Expression_eval_info): Add
4863 result_alignment_pointer field.
4864 (Expression::eval_with_dot): Add result_alignment_pointer
4865 parameter. Change all callers.
4866 (Expression::eval_maybe_dot): Likewise.
4867 (class Binary_expression): Add alignment_pointer parameter to
4868 left_value and right_value. Change all callers.
4869 (BINARY_EXPRESSION): Set result alignment.
4870 (class Trinary_expression): Add alignment_pointer parameter to
4871 arg2_value and arg3_value. Change all callers.
4872 (Trinary_cond::value): Set result alignment.
4873 (Max_expression::value, Min_expression::value): Likewise.
4874 (Align_expression::value): Likewise.
4875 * script-sections.cc (class Sections_element): Add dot_alignment
4876 parameter to set_section_addresses virtual function. Update
4878 (class Output_section_element): Likewise.
4879 (Script_sections::create_segments): Add dot_alignment parameter.
4881 (Script_sections::create_segments_from_phdrs_clause): Likewise.
4882 (Script_sections::set_phdrs_clause_addresses): Likewise.
4883 * script-sections.h: Update declarations.
4884 * script.h: Update declarations.
4885 * output.h (Output_segment::set_minimum_p_align): Don't decrease
4887 * testsuite/script_test_3.t: Set large alignment.
4888 * testsuite/script_test_3.sh: Make sure that at least one LOAD
4889 segment has expected alignment.
4891 2010-04-22 Nick Clifton <nickc@redhat.com>
4893 * po/gold.pot: Updated by the Translation project.
4894 * po/vi.po: Updated Vietnamese translation.
4896 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
4898 * testsuite/Makefile.am (check_PROGRAMS): Add
4899 icf_virtual_function_folding_test.
4900 * testsuite/Makefile.in: Regenerated.
4902 2010-04-15 Andrew Haley <aph@redhat.com>
4904 * options.h (merge_exidx_entries): New option.
4905 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
4906 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
4907 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
4908 (Target_arm::merge_exidx_entries): New function.
4909 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
4910 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
4911 to Arm_exidx_fixup constructor.
4912 Add new arg, merge_exidx_entries.
4913 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
4914 Arm_output_section::fix_exidx_coverage.
4916 2010-04-18 Sriraman Tallam <tmsriram@google.com>
4918 * icf.cc (get_section_contents): Check for preemptible functions.
4919 Ignore addend when appropriate.
4920 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
4922 (add_from_relobj): Check for section folded.
4923 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
4924 * symtab.h (should_add_dynsym_entry): Add new parameter.
4925 * target-reloc.h (scan_relocs): Check for section folded.
4926 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
4927 Check reloc types for function pointers in shared objects.
4928 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
4930 (icf_preemptible_functions_test): New test case.
4931 (icf_string_merge_test): New test case.
4932 * testsuite.Makefile.in: Regenerate.
4933 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
4934 bar_glob. Refactor code.
4935 * testsuite/icf_preemptible_functions_test.cc: New file.
4936 * testsuite/icf_preemptible_functions_test.sh: New file.
4937 * testsuite/icf_string_merge_test.cc: New file.
4938 * testsuite/icf_string_merge_test.sh: New file.
4939 * testsuite/icf_virtual_function_folding_test.cc: New file.
4940 * testsuite/icf_virtual_function_folding_test.sh: New file.
4942 2010-04-14 Doug Kwan <dougkwan@google.com>
4944 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
4945 for local symbol recounting if we remove a section due to ICF.
4946 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
4947 there are no regular objects in input.
4949 2010-04-13 Doug Kwan <dougkwan@google.com>
4951 * arm.cc (Arm_input_section::set_final_data_size): Compute
4952 accurate final data size instead of using current data size.
4954 2010-04-09 Doug Kwan <dougkwan@google.com>
4956 * layout.cc (Layout::choose_output_section): Handle script section
4958 (Layout::make_output_section_for_script): Add section type parameter.
4959 Handle script section types.
4960 * layout.h (Layout::make_output_section_for_script): Add section
4962 * output.cc (Output_section::Output_section): Initialize data member
4964 (Output_section::do_reset_address_and_file_offset): Do not set address
4965 to 0 if section is a NOLOAD section.
4966 * output.h (Output_section::is_noload): New method.
4967 (Output_section::set_is_noload): Ditto.
4968 (Output_section::is_noload_): New data member.
4969 * script-c.h (Script_section_type): New enum type.
4970 (struct Parser_output_section_header): Add new file section_type.
4971 * script-sections.cc (Sections_element::output_section_name): Add
4972 parameter for returning script section type.
4973 (Output_section_definition::output_section_name): Ditto.
4974 (Output_section_definition::section_type)P; New method.
4975 (Output_section_definiton::script_section_type_name): Ditto.
4976 (Output_section_definition::script_section_type_): New data member.
4977 (Output_section_definition::Output_section_definition): Initialize
4978 data member Output_section_definition::script_section_type_.
4979 (Output_section_definition::create_sections): Pass script section type
4980 to Layout::make_output_section_for_script.
4981 (Output_section_definition::output_section_name): Return script
4982 section type to caller.
4983 (Output_section_definition::set_section_address): Do not advance
4984 dot value and load address if section type is NOLOAD. Set address
4985 of NOLOAD sections regardless of section flags.
4986 (Output_section_definition::print): Print section type if it is
4987 not SCRIPT_SECTION_TYPE_NONE.
4988 (Output_section_definition::section_type): New method.
4989 (Output_section_definition::script_section_type_name): Ditto.
4990 (Script_sections::output_section_name): Add new parameter
4991 PSECTION_TYPE for returning script section type. Pass it to
4992 section elements. Handle discard sections.
4993 (Sort_output_sections::operator()): Handle NOLOAD sections.
4994 * script-sections.h (Script_sections::Section_type): New enum type.
4995 (Script_sections::output_section_name): Add a new parameter for
4996 returning script section type.
4997 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
4999 * yyscript.y (union): Add new field SECTION_TYPE.
5000 (COPY, DSECT, INFO, NOLOAD): New tokens.
5001 (opt_address_and_section_type): Change type to output_section_header.
5002 (section_type): New non-terminal
5003 (section_header): Handle section type.
5004 (opt_address_and_section_type): Return section type value.
5006 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
5008 * testsuite/plugin_common_test_1.c (foo): Add prototype.
5009 * testsuite/plugin_common_test_2.c (foo): Likewise.
5011 2010-04-08 Doug Kwan <dougkwan@google.com>
5013 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
5015 * output.cc (Output_section::add_merge_input_section): Simplify
5016 code and return status of Output_merge_base::add_input_section.
5017 Update merge section map only if Output_merge_base::add_input_section
5020 2010-04-07 Doug Kwan <dougkwan@google.com>
5022 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
5023 if section is marked as containing instructions but has no mapping
5025 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
5026 correct section index.
5027 (Arm_relobj::find_linked_text_section): Ditto.
5029 2010-04-07 Cary Coutant <ccoutant@google.com>
5031 * archive.cc (include_member): Destroy Read_symbols_data object before
5033 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
5034 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
5035 (Read_symbols_data::~Read_symbols_data) New destructor.
5036 (Section_relocs::Section_relocs) New constructor.
5037 (Section_relocs::~Section_relocs) New destructor.
5038 (Read_relocs_data::Read_relocs_data) New constructor.
5039 (Read_relocs_data::~Read_relocs_data) New destructor.
5040 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
5041 pointers to NULL after deleting.
5043 2010-04-07 Doug Kwan <dougkwan@google.com>
5045 * arm.cc: Replace "endianity" with "endianness" in comments.
5046 (Arm_exidx_cantunwind): Ditto.
5047 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
5048 (Arm_relobj::merge_flags_and_attributes): New method.
5049 (Arm_relobj::merge_flags_and_attributes_): New data member.
5050 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
5051 (Arm_relobj::scan_sections_for_stubs): Ditto.
5052 (Arm_relobj::do_read_symbols): Check to see if we really want to
5053 merge processor-specific flags and attributes. Exit early if
5054 an object is empty except for section names and the undefined symbol.
5055 (Target_arm::do_finalize_sections): Move check for ELF format to
5056 Arm_relobj::do_read_symbols. Merge processor specific flags and
5057 attributes from a regular object only when we have determined that
5058 it is aapropriate. Do not create an .ARM.attributes section in
5059 output if there is no regular input object.
5060 (Target_arm::merge_processor_specific_flags): Check
5061 --warn-mismatch before printing any error.
5062 (Target_arm::merge_object_attributes): Ditto.
5063 * gold.cc (queue_middle_tasks): Handle the case in which there is
5064 no regular object in input.
5065 * options.cc (General_options::parse_EB): New method.
5066 (General_options::parse_EL): Same.
5067 (General_options::General_options): Initialize endianness_.
5068 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
5070 (General_options::Endianness): New enum.
5071 (General_options::endianness): New method.
5072 (General_options::endianness_): New data member.
5073 * parameters.cc (Parameters::set_options): Check target endianness.
5074 (Parameters::set_target_once): Ditto.
5075 (Parameters::check_target_endianness): New method.
5076 (parameters_force_valid_target): If either -EL or -EB is specified,
5077 use it to define endianness of default target.
5078 * parameters.h (Parameters::check_target_endianness): New method
5080 * target.h (class Target): Change "endianity" to "endianness"
5083 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5085 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
5086 * configure: Regenerate.
5087 * Makefile.in: Regenerate.
5088 * testsuite/Makefile.in: Regenerate.
5090 2010-04-06 Cary Coutant <ccoutant@google.com>
5093 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
5094 prevailing definitions of common symbols.
5095 * testsuite/plugin_test_6.sh: New test case.
5096 * testsuite/plugin_common_test_1.c: New test case.
5097 * testsuite/plugin_common_test_2.c: New test case.
5098 * testsuite/Makefile.am (plugin_test_6): New test case.
5099 * testsuite/Makefile.in: Regenerate.
5101 2010-04-06 Nick Clifton <nickc@redhat.com>
5103 * po/vi.po: New Vietnamese translation.
5105 2010-03-30 Doug Kwan <dougkwan@google.com>
5107 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
5109 2010-03-25 Doug Kwan <dougkwan@google.com>
5111 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
5112 to avoid a conversion warning on a 32-bit host.
5114 2010-03-24 Ian Lance Taylor <iant@google.com>
5116 * testsuite/script_test_3.t: Add a TLS segment.
5117 * testsuite/Makefile.am (check_PROGRAMS): Add
5118 tls_phdrs_script_test.
5119 (tls_phdrs_script_test_SOURCES): Define.
5120 (tls_phdrs_script_test_DEPENDENCIES): Define.
5121 (tls_phdrs_script_test_LDFLAGS): Define.
5122 (tls_phdrs_script_test_LDADD): Define.
5123 * testsuite/Makefile.in: Rebuild.
5125 2010-03-23 Cary Coutant <ccoutant@google.com>
5127 * fileread.cc (find_or_make_view): Fix comment.
5129 2010-03-23 Ian Lance Taylor <iant@google.com>
5131 * script-sections.cc (class Orphan_section_placement): Define
5132 PLACE_TLS and PLACE_TLS_BSS.
5133 (Orphan_section_placement::Orphan_section_placement): Initialize
5135 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
5136 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
5137 (tls_script_test_SOURCES): Define.
5138 (tls_script_test_DEPENDENCIES): Define.
5139 (tls_script_test_LDFLAGS): Define.
5140 (tls_script_test_LDADD): Define.
5141 * testsuite/Makefile.in: Rebuild.
5143 2010-03-22 Doug Kwan <dougkwan@google.com>
5145 * arm.cc (Arm_relocate_functions::abs8,
5146 Arm_relocate_functions::abs16): Use correct check for overflow
5147 specified in the ARM ELF specs.
5148 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
5149 target of a BLX instruction specially.
5150 (Reloc_stub::stub_type_for_reloc): Ditto.
5151 (Relocate::relocate): Use symbolic names instead of numeric relocation
5152 codes to report error.
5153 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
5155 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
5156 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
5157 thumb2_blx_out_of_range.stdout
5158 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
5159 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
5160 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
5161 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
5162 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
5163 thumb2_blx_in_range, thumb2_blx_in_range.o,
5164 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
5165 thumb2_blx_out_of_range.o): New rules.
5166 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
5167 thumb2_blx_in_range and thumb2_blx_out_of_range.
5168 * testsuite/Makefile.in: Regenerate.
5169 * arm_branch_in_range.sh: Add tests for THUMB BLX.
5170 * testsuite/thumb_blx_in_range.s: New file.
5171 * testsuite/thumb_blx_out_of_range.s: New file.
5173 2010-03-22 Rafael Espindola <espindola@google.com>
5175 * archive.cc (Should_include): Move to archive.h.
5176 (should_include_member): Make it a member of Archive.
5178 (Add_lib_group_symbols): New.
5179 * archive.h: Include options.h.
5180 (Archive_member): Moved from Archive.
5181 (Should_include): Moved from archive.cc.
5183 (Add_lib_group_symbols): New.
5184 * dynobj.cc (do_should_include_member): New.
5185 * dynobj.h (do_should_include_member): New.
5186 * gold.cc (queue_initial_tasks): Update call to queue.
5187 * main.cc (main): Print lib group stats.
5188 * object.cc (do_should_include_member): New.
5189 * object.h: Include archive.h.
5190 (Object::should_include_member): New.
5191 (Object::do_should_include_member): New.
5192 (Sized_relobj::do_should_include_member): New.
5193 * options.cc (General_options::parse_start_lib): New.
5194 (General_options::parse_end_lib): New.
5195 (Input_arguments::add_file): Handle lib groups.
5196 (Input_arguments::start_group): Check we are not in a lib.
5197 (Input_arguments::start_lib): New.
5198 (Input_arguments::end_lib): New.
5199 * options.h (General_options): Add start_lib and end_lib.
5200 (Input_argument::lib_): New.
5201 (Input_argument::lib): New.
5202 (Input_argument::is_lib): New.
5203 (Input_file_lib): New.
5204 (Input_arguments::in_lib_): New.
5205 (Input_arguments::in_lib): New.
5206 (Input_arguments::start_lib): New.
5207 (Input_arguments::end_lib_): New.
5208 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5209 in unused members as preempted.
5210 (Sized_pluginobj::do_should_include_member): New.
5211 * plugin.h (Sized_pluginobj::do_should_include_member): New.
5212 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5214 (Read_symbols::do_whole_lib_group): New.
5215 (Read_symbols::do_lib_group): New.
5216 (Read_symbols::do_read_symbols): Handle lib groups.
5217 (Read_symbols::get_name): Handle lib groups.
5218 * readsyms.h (Read_symbols): Add an archive member pointer.
5219 (Read_symbols::do_whole_lib_group): New.
5220 (Read_symbols::do_lib_group): New.
5221 (Read_symbols::member_): New.
5222 * script.cc (read_input_script): Update call to queue_soon.
5224 2010-03-19 Doug Kwan <dougkwan@google.com>
5226 * arm.cc (Stub_table::Stub_table): Initialize new data members
5227 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5228 (Stub_table::add_reloc_stub): Assign stub offset and update
5229 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5230 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
5232 (Stub_table::update_data_size_and_addralign): Use
5233 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
5234 instead of going over all reloc stubs.
5235 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
5236 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5237 Stringpool_template::offset_ to size of Stringpool_char.
5238 (Stringpool_template::new_key_offset): Remove code to initialize
5239 Stringpool_template::offset_.
5240 * stringpool.h (Stringpool_template::set_no_zero_null): Set
5241 Stringpool_template::offset_ to zero.
5243 2010-03-15 Doug Kwan <dougkwan@google.com>
5245 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5247 (Stringpool_template::new_key_offset): New method.
5248 (Stringpool_template::add_string): Assign offsets when adding new
5250 (Stringpool_template::set_string_offsets): Do not set string offsets
5251 when not optimizing.
5252 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5254 (Chunked_vector::clear): Clear size_.
5255 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5256 (Chunked_vector::size): Return size_.
5257 (Chunked_vector::push_back): Use size_ to find insert position.
5258 (Chunked_vector::size_): New data member.
5259 (Stringpool_template::set_no_zero_null): Assert string set is empty.
5260 (Stringpool_template::new_key_offset): New method declaration.
5261 (Stringpool_template::offset_): New data member.
5263 2010-03-15 Rafael Espindola <espindola@google.com>
5265 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
5266 Add_symbols' constructor.
5267 * readsyms.h (Add_symbols): Remove the input_group member.
5269 2010-03-10 Ian Lance Taylor <iant@google.com>
5271 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
5272 target to ask whether a reference to a symbol requires a stack
5274 * target.h (Target::is_call_to_non_split): New function.
5275 (Target::do_is_call_to_non_split): Declare virtual function.
5276 * target.cc: Include "symtab.h".
5277 (Target::do_is_call_to_non_split): New function.
5278 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
5280 2010-03-10 Cary Coutant <ccoutant@google.com>
5282 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
5283 (File_read::open[1]): Remove initial mapping of whole_file_view_.
5284 (File_read::open[2]): Add whole_file_view_ to list of views.
5285 (File_read::make_view): Remove test of whole_file_view_.
5286 (File_read::find_or_make_view): Create whole_file_view_ if
5288 (File_read::clear_views): Replace bool parameter with enum;
5289 adjust all callers. Don't delete views with permanent data;
5290 do delete cached views and views from archives if
5291 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
5292 if clearing the corresponding view.
5293 * fileread.h (File_read::Clear_views_mode): New enum.
5294 (File_read::View::is_permanent_view): New method.
5295 (File_read::clear_views): Replace bool parameter
5296 with enum; adjust all callers.
5297 * options.h (General_options): Change keep_files_mapped option;
5298 add map_whole_files.
5299 * readsyms.cc (Add_symbols::run): Delete sd_ object before
5301 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
5304 2010-03-10 David S. Miller <davem@davemloft.net>
5306 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
5308 2010-03-09 Sriraman Tallam <tmsriram@google.com>
5310 * icf.cc (get_section_contents): Add '@' marker after processing the
5313 2010-03-08 Doug Kwan <dougkwan@google.com>
5315 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
5316 due to a conversion warning.
5317 (Arm_relobj::update_output_local_symbol_count): Check for local
5318 symbol with unset output index.
5320 2010-03-05 Ian Lance Taylor <iant@google.com>
5322 * options.h (class General_options): Add --spare-dynamic-tags.
5323 * output.cc (Output_data_dynamic::set_final_data_size): Implement
5324 --spare-dynamic-tags.
5326 2010-03-05 Ian Lance Taylor <iant@google.com>
5328 * incremental.cc: Include "libiberty.h".
5330 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
5332 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
5333 function, is_info_ member.
5334 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
5335 (Versions::Versions): Update caller.
5336 (Versions::define_base_version): Likewise.
5337 (Versions::add_def): Likewise.
5339 2010-03-03 Sriraman Tallam <tmsriram@google.com>
5341 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
5342 (Scan::possible_function_pointer_reloc): New function.
5343 (Scan::local_reloc_may_be_function_pointer): Change to call
5344 possible_function_pointer_reloc.
5345 (Scan::global_reloc_may_be_function_pointer): Ditto.
5346 * icf.h (Icf::check_section_for_function_pointers): Change to reject
5347 relocations in ".data.rel.ro._ZTV" section.
5348 * testsuite/icf_safe_so_test.sh: Change to pass i386.
5349 * testsuite/icf_safe_so_test.cc: Ditto.
5350 * testsuite/icf_safe_test.cc: Ditto.
5351 * testsuite/icf_safe_test.sh: Ditto.
5353 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5354 Ian Lance Taylor <iant@google.com>
5356 * target-reloc.h (relocate_section): Check the symbol table index
5357 for -1U before setting the local symbol index.
5358 (scan_relocatable_relocs): If copying the relocation, record that
5359 the local symbol is required.
5360 * object.h (Symbol_value::is_output_symtab_index_set): New
5362 (Symbol_value::may_be_discarded_from_output_symtab): New
5364 (Symbol_value::has_output_symtab_entry): New function.
5365 (Symbol_value::needs_output_symtab_entry): Remove.
5366 (Symbol_value::output_symtab_index): Make sure the symbol index is
5368 (Symbol_value::set_output_symtab_index): Make sure the symbol
5369 index is not set. Make sure the new index is valid.
5370 (Symbol_value::set_must_have_output_symtab_entry): New function.
5371 (Symbol_value::has_output_dynsym_entry): New function.
5372 (Symbol_value::set_output_dynsym_index): Make sure the new index
5374 (Sized_relobj::set_must_have_output_symtab_entry): New function.
5375 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
5376 local symbol if permitted.
5377 (Sized_relobj::do_finalize_local_symbols): Call
5378 is_output_symtab_index_set rather than needs_output_symtab_entry.
5379 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
5380 rather than needs_output_symtab_entry. Call
5381 has_output_dynsym_entry rather than needs_output_dynsym_entry.
5382 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
5383 is_output_symtab_index_set rather than needs_output_symtab_entry.
5384 * testsuite/discard_locals_relocatable_test.c: New file.
5385 * testsuite/discard_locals_test.sh: Test -r.
5386 * testsuite/Makefile.am (check_DATA): Add
5387 discard_locals_relocatable_test1.syms,
5388 discard_local_relocatable_test2.syms.
5389 (MOSTLYCLEANFILES): Likewise. Also add
5390 discard_locals_relocatable_test1.lout and
5391 discard_locals_relocatable_test2.out.
5392 (discard_locals_relocatable_test1.syms): New target.
5393 (discard_locals_relocatable_test.o): New target.
5394 (discard_locals_relocatable_test1.out): New target.
5395 (discard_locals_relocatable_test2.syms): New target.
5396 (discard_locals_relocatable_test2.out): New target.
5397 (various): Add missing ../ld-new dependencies.
5398 * testsuite/Makefile.in: Rebuild.
5400 2010-03-03 Nick Clifton <nickc@redhat.com>
5402 * po/fi.po: New Finnish translation.
5404 2010-03-01 Doug Kwan <dougkwan@google.com>
5406 * layout.cc (Layout::Layout): Force section types of .init_array*,
5407 .preinit_array* and .fini_array* sections.
5408 * output.cc (Output_section::Input_section_sort_entry::has_priority):
5409 Fix check of return value of std::string::find.().
5410 (Output_section::Input_section_sort_compare::operator()): Remove
5411 comment about .init_array.
5412 (Output_section::Input_section_sort_init_fini_compare::operator()):
5414 (Output_section::sort_attached_input_sections): Handle .init_array
5415 and .fini_array specially.
5416 * output.h (Output_section::Inut_section_sort_compare): Update
5418 (Output_section::Input_section_sort_init_fini_compare): New struct.
5420 2010-02-26 Doug Kwan <dougkwan@google.com>
5422 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
5423 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
5424 * testsuite/debug_msg.sh: Avoid matching source line number for
5425 use of global variable undef_int.
5427 2010-02-26 Doug Kwan <dougkwan@google.com>
5429 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
5430 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
5431 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
5432 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
5433 * options.cc (General_options::General_options): Initialize member
5435 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
5436 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
5437 and rm_no_fix_v4bx.stdout
5438 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
5439 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
5440 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
5441 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
5442 and arm_no_fix_v4bx.
5443 * Makefile.in: Regenerate.
5444 * testsuite/arm_fix_v4bx.s: New file.
5445 * testsuite/arm_fix_v4bx.sh: Ditto.
5447 2010-02-24 Doug Kwan <dougkwan@google.com>
5449 * arm.cc (Target_arm::got_section): Make the .got section the first
5450 non RELRO section in the data segment.
5451 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
5452 suffixes of section names.
5454 2010-02-24 Doug Kwan <dougkwan@google.com>
5456 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
5457 flags and attributes merging if an input file is a binary file.
5458 * fileread.cc (Input_file::open): Record format of original file.
5459 * fileread.h (Input_file::Format): New enum type.
5460 (Input_file::Input_file): Initialize data member format_.
5461 (Input_file::format): New method definition.
5462 (Input_file::format_):: New data member.
5464 2010-02-24 Doug Kwan <dougkwan@google.com>
5466 * arm.cc (Arm_output_data_got): New class.
5467 (ARM_TCB_SIZE): New constant
5468 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
5469 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
5470 If user uses a script with a SECTIONS clause, issue only a warning
5471 for a misplaced EXIDX input section. Otherwise, issue an error.
5472 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
5474 (Target_arm::got_mode_index_entry): Handle static linking.
5475 (Target_arm::Scan::local): Ditto.
5476 (Target_arm::Scan::global): Ditto.
5477 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
5478 all incorrectly implemented relocations.
5479 (Target_arm::fix_exidx_coverage): Pass layout to
5480 Arm_output_section::fix_exidx_coverage.
5481 * layout.cc (Layout::section_name_mapping): Remove trailing dots
5482 from ".ARM.exidx." and ".ARM.extab.".
5484 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5486 * arm.cc (Target_arm::do_finalize_sections): Create attribute
5487 section if it does not already exist.
5488 * attributes.cc (Attributes_section_data::Attributes_section_data):
5489 Don't crash if size is zero.
5491 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5492 Ian Lance Taylor <iant@google.com>
5494 * gold.cc (queue_middle_tasks): If no input files were opened,
5496 * workqueue.h (Task_function::Task_function): Assert that there is
5499 2010-02-22 Doug Kwan <dougkwan@google.com>
5501 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
5502 * icf.cc (get_section_contents): Cast snprintf arguments to long long
5503 types to avoid warnings due to different uint64_t implementations
5506 2010-02-21 Doug Kwan <dougkwan@google.com>
5508 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
5509 handling of the maximum backward branch offset.
5510 (Arm_relocate_functions::thumb_branch_common): Ditto.
5511 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
5512 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
5513 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
5514 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
5515 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
5516 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
5517 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
5518 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
5519 thumb_bl_out_of_range thumb_bl_out_of_range.o,
5520 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
5521 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
5522 thumb2_bl_out_of_range.o): New rules.
5523 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
5524 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
5525 thumb2_bl_out_of_range
5526 * testsuite/Makefile.in: Regenerate.
5527 * testsuite/arm_bl_in_range.s: New file.
5528 * testsuite/arm_bl_out_of_range.s: Ditto.
5529 * testsuite/arm_branch_in_range.sh: Ditto.
5530 * testsuite/arm_branch_range.t: Ditto.
5531 * testsuite/thumb2_branch_range.t: Ditto.
5532 * testsuite/thumb_bl_in_range.s: Ditto.
5533 * testsuite/thumb_bl_out_of_range.s: Ditto.
5534 * testsuite/thumb_branch_range.t: Ditto.
5536 2010-02-20 Sriraman Tallam <tmsriram@google.com>
5538 * gc.h (gc_process_relocs): Change vectors to point to the new list.
5539 Add reloc offset information.
5540 * icf.cc (get_section_contents): Change iterators to point to the new
5541 vectors. Add reloc offset information to the contents.
5542 * icf.h (Icf::Sections_reachable_info): New typedef.
5543 (Icf::Sections_reachable_list): New typedef.
5544 (Icf::Offset_info): New typedef.
5545 (Icf::Reloc_info): New struct typedef.
5546 (Icf::Reloc_info_list): New typedef.
5547 (Icf::symbol_reloc_list): Delete method.
5548 (Icf::addend_reloc_list): Delete method.
5549 (Icf::section_reloc_list): Delete method.
5550 (Icf::reloc_info_list): New method.
5551 (Icf::reloc_info_list_): New member.
5553 2010-02-19 Doug Kwan <dougkwan@google.com>
5555 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
5556 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
5557 * arm.cc (Arm_relocation_functions): New forward declaration.
5558 (Target_arm::Target_arm): Initialize new data members
5559 got_mod_index_offset_ and tls_base_symbol_defined_.
5560 (Target_arm::Relocate::relocate_tls): New method.
5561 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
5562 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
5564 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
5565 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
5566 (Target_arm::got_mod_index_offset_,
5567 Target_arm::tls_base_symbol_defined_): New data members.
5568 (Target_arm::Scan::local, Target::Scan::global,
5569 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
5572 2010-02-18 Doug Kwan <dougkwan@google.com>
5574 * arm.cc (Arm_relobj::find_linked_text_section): New method.
5575 (Arm_relobj::make_exidx_input_section): Pass section index of linked
5576 text section as a parameter becuase some broken tools may not set
5577 the link in section header.
5578 (Target_arm::has_got_section): New method.
5579 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
5580 without any mapping symbol as data only. Remove warning.
5581 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
5582 link in its section header, try to discover the link by inspecting the
5583 REL31 relocation at the beginning of the section.
5584 (Target_arm::Scan::check_non_pic): Report name of offending relocation
5586 (Target_arm::Scan::global): Treat any reference to the symbol
5587 _GLOBAL_OFFSET_TABLE_ as a GOT access.
5589 2010-02-12 Sriraman Tallam <tmsriram@google.com>
5591 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
5592 (Scan::global_reloc_may_be_function_pointer): New function.
5593 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5594 (Scan::global_reloc_may_be_function_pointer): New function.
5595 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5596 (Scan::global_reloc_may_be_function_pointer): New function.
5597 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
5598 (Scan::global_reloc_may_be_function_pointer): New function.
5599 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
5600 (Scan::global_reloc_may_be_function_pointer): New function.
5601 (Scan::possible_function_pointer_reloc): New function.
5602 (Target_x86_64::can_check_for_function_pointers): New function.
5603 * gc.h (gc_process_relocs): Scan relocation types to determine if
5604 function pointers were taken for targets that support it.
5605 * icf.cc (Icf::find_identical_sections): Include functions for
5606 folding in safe ICF whose pointer is not taken.
5607 * icf.h (Secn_fptr_taken_set): New typedef.
5608 (fptr_section_id_): New member.
5609 (section_has_function_pointers): New function.
5610 (set_section_has_function_pointers): New function.
5611 (check_section_for_function_pointers): New function.
5612 * options.h: Fix comment for safe ICF option.
5613 * target.h (can_check_for_function_pointers): New function.
5614 * testsuite/Makefile.am: Add icf_safe_so_test test case.
5615 Modify icf_safe_test for X86-64.
5616 * testsuite/Makefile.in: Regenerate.
5617 * testsuite/icf_safe_so_test.cc: New file.
5618 * testsuite/icf_safe_so_test.sh: New file.
5619 * testsuite/icf_safe_test.cc (kept_func_3): New function.
5620 (main): Change to take pointer to function kept_func_3.
5621 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
5622 folding is done correctly for X86-64.
5624 2010-02-12 David S. Miller <davem@davemloft.net>
5626 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
5627 is_symbolless parameter.
5628 (Output_reloc<SHT_REL>::is_symbolless): New.
5629 (Output_reloc<SHT_REL>::is_symbolless_): New.
5630 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
5631 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
5632 (Output_reloc<SHT_RELA>::is_symbolless): New.
5633 (Output_data_reloc::add_global): Handle is_symbolless.
5634 (Output_data_reloc::add_global_relative): Likewise.
5635 (Output_data_reloc::add_local): Likewise.
5636 (Output_data_reloc::add_local_relative): Likewise.
5637 (Output_data_reloc::add_symbolless_global_addend): New.
5638 (Output_data_reloc::add_symbolless_local_addend): New.
5639 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
5641 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
5642 instead of ->is_relative_
5643 (Output_reloc::write): Likewise.
5644 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
5645 (Output_reloc::write_rel): Simplify.
5647 * sparc.cc (Target_sparc::Scan::local): Use
5648 ->add_symbolless_local_addend as needed.
5649 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
5650 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
5651 based upon relocation offset.
5653 2010-02-11 Doug Kwan <dougkwan@google.com>
5655 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
5656 (Target_arm::Scan::global): Ditto. Also remove a comment before the
5657 beginning of function.
5658 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
5659 and MOVT_ABS relocations. Those are non issued in scanning. Fix
5660 parameter is_32bit in calls to should_apply_static_reloc.
5661 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
5662 (check_DATA): Add arm_abs_global.stdout.
5663 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
5664 arm_abs_global.stdout): New rules.
5665 (MOSTLLYCLEANFILES): Add arm_abs_global
5666 * Makefile.in: Regenerate.
5667 * testsuite/arm_abs_global.s: New file.
5668 * testsuite/arm_abs_global.sh: Ditto.
5669 * testsuite/arm_abs_lib.s: Ditto.
5671 2010-02-11 Ian Lance Taylor <iant@google.com>
5673 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
5675 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
5676 Allocate_commons_task first.
5677 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
5678 task, rather than symtab_lock_.
5679 (Gc_process_relocs::~Gc_process_relocs): New function.
5680 (Gc_process_relocs::is_runnable): Check this_blocker_.
5681 (Gc_process_relocs::locks): Use next_blocker_ rather than
5683 (Scan_relocs::~Scan_relocs): New function.
5684 (Scan_relocs::is_runnable): Check this_blocker_ rather than
5686 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
5688 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
5689 fields. Add this_blocker_ and next_blocker_ fields. Adjust
5690 constructor accordingly.
5691 (class Gc_process_relocs): Likewise.
5692 (class Scan_relocs): Likewise.
5693 * common.h (class Allocate_commons_task): Remove symtab_lock_
5694 field, and corresponding constructor parameter.
5695 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
5697 (Allocate_commons_task::locks): Likewise.
5699 2010-02-11 Ian Lance Taylor <iant@google.com>
5701 * gold-threads.h (class Once): Define.
5702 (class Initialize_lock): Rewrite as child of Once.
5703 * gold-threads.cc (class Once_initialize): Define.
5704 (once_pointer_control): New static variable.
5705 (once_pointer, once_arg): New static variables.
5706 (c_run_once): New static function.
5707 (Once::Once, Once::run_once, Once::internal_run): New functions.
5708 (class Initialize_lock_once): Remove.
5709 (initialize_lock_control): Remove.
5710 (initialize_lock_pointer): Remove.
5711 (initialize_lock_once): Remove.
5712 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
5713 (Initialize_lock::initialize): Rewrite.
5714 (Initialize_lock::do_run_once): New function.
5715 * archive.cc (Archive::interpret_header): Only clear name if it is
5717 * fileread.cc: Include "gold-threads.h"
5718 (file_counts_lock): New static variable.
5719 (file_counts_initialize_lock): Likewise.
5720 (File_read::release): Only increment counts when using --stats.
5721 Use a lock around the increment.
5722 * parameters.cc (class Set_parameters_target_once): Define.
5723 (set_parameters_target_once): New static variable.
5724 (Parameters::Parameters): Move here from parameters.h.
5725 (Parameters::set_target): Rewrite.
5726 (Parameters::set_target_once): New function.
5727 (Parameters::clear_target): Move here and rewrite.
5728 * parameters.h (class Parameters): Update declarations. Add
5729 set_parameters_target_once_ field.
5730 (Parameters::Parameters): Move to parameters.cc.
5731 (Parameters::clear_target): Likewise.
5732 * readsyms.cc (Read_symbols::do_group): Create a Start_group
5734 (Start_group::~Start_group): New function.
5735 (Start_group::is_runnable): New function.
5736 (Start_group::locks, Start_group::run): New functions.
5737 (Finish_group::run): Change saw_undefined to size_t.
5738 * readsyms.h (class Start_group): Define.
5739 (class Finish_group): Change saw_undefined_ field to size_t.
5740 (Finish_group::Finish_group): Remove saw_undefined and
5741 this_blocker parameters. Change all callers.
5742 (Finish_group::set_saw_undefined): New function.
5743 (Finish_group::set_blocker): New function.
5744 * symtab.h (class Symbol_table): Change saw_undefined to return
5745 size_t. Change saw_undefined_ field to size_t.
5746 * target-select.cc (Set_target_once::do_run_once): New function.
5747 (Target_selector::Target_selector): Initialize set_target_once_
5748 field. Don't initialize lock_ and initialize_lock_ fields.
5749 (Target_selector::instantiate_target): Rewrite.
5750 (Target_selector::set_target): New function.
5751 * target-select.h (class Set_target_once): Define.
5752 (class Target_selector): Update declarations. Make
5753 Set_target_once a friend. Remove lock_ and initialize_lock_
5754 fields. Add set_target_once_ field.
5756 2010-02-10 Ian Lance Taylor <iant@google.com>
5758 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
5760 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
5761 (queue_middle_tasks): Add all blockers before queueing any tasks.
5762 (queue_final_tasks): Likewise.
5763 * token.h (Task_token::add_blockers): New function.
5764 * object.h (Input_objects::number_of_relobjs): New function.
5766 2010-02-10 Ian Lance Taylor <iant@google.com>
5768 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
5769 shared, not if not position independent.
5770 * x86_64.cc (Relocate::relocate_tls): Likewise.
5771 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
5772 (tls_pie_pic_test): New target.
5773 * testsuite/Makefile.in: Rebuild.
5775 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
5776 (tls_test_main_pie.o, tls_test_pie.o): New targets.
5777 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
5778 * testsuite/Makefile.in: Rebuild.
5780 2010-02-09 David S. Miller <davem@davemloft.net>
5782 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
5783 R_SPARC_RELATIVE using ->add_local_relative().
5784 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
5786 * output.h (Output_data_dynamic::add_section_size): New method
5787 that takes two Output_data objects.
5788 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
5789 entry param. Handle it in initializers.
5790 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
5791 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
5792 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
5794 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
5795 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
5796 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
5797 for dynrel_includes_plt.
5798 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5799 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5800 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
5802 (Target_sparc::do_finalize_sections): Update to pass true for
5803 dynrel_includes_plt.
5804 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
5805 output before .rela.plt
5806 (Target_powerpc::do_finalize_sections): Update to pass true for
5807 dynrel_includes_plt when 32-bit.
5809 2010-02-08 Doug Kwan <dougkwan@google.com>
5811 * arm.cc (Arm_relobj::simple_input_section_output_address): New
5813 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
5814 Arm_relobj::scan_section_for_cortex_a8_stubs,
5815 Arm_relobj::do_relocation_section): Instead of calling
5816 Output_section::output_address, use faster
5817 Arm_relobj::simple_input_section_output_address.
5819 2010-02-08 David S. Miller <davem@davemloft.net>
5821 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
5822 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
5823 relocation helper function.
5825 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
5826 just like R_SPARC_GOT{10,13,22}.
5827 (Target_sparc::Scan::local): Likewise.
5828 (Target_sparc::Relocate:relocate): Likewise.
5830 2010-02-06 Ian Lance Taylor <iant@google.com>
5832 * configure.ac: Rewrite targetobjs duplicate removal code to use
5833 only shell constructs.
5834 * configure: Rebuild.
5836 2010-02-05 Doug Kwan <dougkwan@google.com>
5839 * arm.cc (Arm_relobj::section_is_scannable): New method.
5840 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
5841 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
5843 2010-02-04 Doug Kwan <dougkwan@google.com>
5846 * arm-reloc-property.cc (cstdio): Include.
5847 * configure.ac (targetobjs): Remove duplicates.
5848 * configure: Regenerate.
5849 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
5850 big and little endian version for a given address size.
5852 2010-02-03 Doug Kwan <dougkwan@google.com>
5854 * arm-reloc-property.cc
5855 (Arm_reloc_property_table::reloc_name_in_error_message): New method
5857 * arm-reloc-property.h
5858 (Arm_reloc_property_table::get_implemented_static_reloc_property):
5859 New method definition.
5860 (Arm_reloc_property_table::reloc_name_in_error_message): New method
5862 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
5864 (GOT_PREL): Change implemented to Y.
5865 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
5866 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
5867 (Arm_relocate_functions::movw_abs_nc): Remove method.
5868 (Arm_relocate_functions::movt_abs): Ditto.
5869 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
5870 (Arm_relocate_functions::thm_movt_abs): Ditto.
5871 (Arm_relocate_functions::movw_rel_nc): Ditto.
5872 (Arm_relocate_functions::movw_rel): Ditto.
5873 (Arm_relocate_functions::movt_rel): Ditto.
5874 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
5875 (Arm_relocate_functions:thm_movw_rel): Ditto.
5876 (Arm_relocate_functions:thm_movt_rel): Ditto.
5877 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
5878 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
5879 New method definitions.
5880 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
5881 (Arm_relocation_functions::arm_grp_ldr): Ditto.
5882 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
5883 (Arm_relocation_functions::arm_grp_ldc): Ditto.
5884 (Target_arm::Relocate::relocate): Check for non-static or
5885 unimplemented relocation code and exit early. Change calls to
5886 Target_arm::reloc_uses_thumb_bit and
5887 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
5888 instead. Refactor code to handle similar relocations to increase
5889 code sharing. Remove check for unsupported relocation code in switch
5891 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
5892 relocation property table to find out size. Change error message to
5893 print out the name of a relocation code instead of the numeric value.
5894 (Target_arm::scan_reloc_for_stub): Use relocation property table
5895 instead of calling Target_arm::reloc_uses_thumb_bit().
5897 2010-02-02 Doug Kwan <dougkwan@google.com>
5899 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
5900 types of relaxed input section.
5902 2010-02-02 Doug Kwan <dougkwan@google.com>
5904 * Makefile.am (HFILES): Add arm-reloc-property.h.
5906 (TARGETSOURCES): Add arm-reloc-property.cc
5907 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
5908 (libgold_a_SOURCES): $(DEFFILES)
5909 * Makefile.in: Regenerate.
5910 * arm-reloc-property.cc: New file.
5911 * arm-reloc-property.h: New file.
5912 * arm-reloc.def: New file.
5913 * arm.cc: Update comments.
5914 (arm-reloc-property.h): New included header.
5915 (arm_reloc_property_table): New global variable.
5916 (Target_arm::do_select_as_default_target): New method definition.
5917 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
5918 arm-reloc-property to targ_extra_obj.
5919 * parameters.cc (set_parameters_target): Call
5920 Target::select_as_default_target().
5921 * target.h (Target::select_as_default_target): New method definition.
5922 (Target::do_select_as_default_target): Same.
5924 2010-02-01 Doug Kwan <dougkwan@google.com>
5926 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
5927 first_output_text_section_.
5928 (Arm_exidx_fixup::first_output_text_section): New method definition.
5929 (Arm_exidx_fixup::first_output_text_section_): New data member.
5930 (Arm_exidx_fixup::process_exidx_section): Record the first text
5931 output section seen.
5932 (Arm_output_section::fix_exidx_coverage): Set correct linked section
5933 and entsize in output section header.
5935 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5937 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
5938 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
5939 (Arm_relocate_functions::thm_alu11): New Method.
5940 (Arm_relocate_functions::thm_pc8): New Method.
5941 (Arm_relocate_functions::thm_pc12): New Method.
5942 (Target_arm::Scan::local): Handle the relocations.
5943 (Target_arm::Scan::global): Likewise.
5944 (Target_arm::Relocate::relocate): Likewise.
5945 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
5947 2010-01-29 Doug Kwan <dougkwan@google.com>
5949 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
5950 of relocation types as ld.
5952 2010-01-29 Doug Kwan <dougkwan@google.com>
5954 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
5956 (Arm_relocate_functions::thumb_branch_common): Ditto.
5957 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
5958 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
5959 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
5960 Arm_relocate_functions::jump24): Remove.
5961 (Target_arm::Relocate::relocate): Adjust code to call
5962 Arm_relocation_functions::arm_branch_common and
5963 Arm_relocation_functions::thumb_branch_common instead of their removed
5964 wrappers. Merge switch-cases together to reduce source code size.
5966 2010-01-29 Doug Kwan <dougkwan@google.com>
5968 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
5969 output_local_symbol_count_needs_update_.
5970 (Arm_relobj::output_local_symbol_count_needs_update,
5971 Arm_relobj::set_output_local_symbol_count_needs_update,
5972 Arm_relobj::update_output_local_symbol_count): New methods.
5973 (Arm_relobj::output_local_symbol_count_needs_update_): New data
5975 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
5976 of pointed function as in a R_ARM_PREL31 relocation.
5977 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
5978 for output local symbol count updating.
5979 (Target_arm::do_relax): Update output local symbol counts in objects
5981 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
5983 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5985 * arm.cc: Added support for the ARM relocations:
5986 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
5987 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
5988 (Arm_relocate_functions::movw_rel_nc): Renamed (was
5990 (Arm_relocate_functions::movw_rel): New method.
5991 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
5992 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
5994 (Arm_relocate_functions::thm_movw_rel): New method.
5995 (Arm_relocate_functions::thm_movt_rel): Renamed (was
5997 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
5999 (Target_arm::Scan::global): Likewise.
6000 (Target_arm::Relocate::relocate): Likewise.
6001 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6004 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6006 * arm.cc: Added support for ARM group relocations.
6007 (Target_arm::reloc_needs_sym_origin): New method.
6008 (Arm_relocate_functions::calc_grp_kn): New method.
6009 (Arm_relocate_functions::calc_grp_residual): New method.
6010 (Arm_relocate_functions::calc_grp_gn): New method.
6011 (Arm_relocate_functions::arm_grp_alu): New Method.
6012 (Arm_relocate_functions::arm_grp_ldr): New Method.
6013 (Arm_relocate_functions::arm_grp_ldrs): New Method.
6014 (Arm_relocate_functions::arm_grp_ldc): New Method.
6015 (Target_arm::Scan::local): Handle the ARM group relocations.
6016 (Target_arm::Scan::global): Likewise.
6017 (Target_arm::Relocate::relocate): Likewise.
6018 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6021 2010-01-26 Doug Kwan <dougkwan@google.com>
6023 * arm.cc (set): Include.
6024 (class Arm_exidx_fixup): Change type of last_input_section_ to const
6026 (Arm_output_section::Text_section_list): New type.
6027 (Arm_output_section::append_text_sections_to_list): New method.
6028 (Arm_output_section::fix_exidx_coverage): Ditto.
6029 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
6030 (Arm_relobj::convert_input_section_to_relaxed_section): Use
6031 Relobj::set_section_offset() instead of
6032 Sized_relobj::invalidate_section_offset().
6033 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
6034 parameter for section headers. Ignore relocation sections for
6035 unallocated sections and EXIDX sections.
6036 (Target_arm::fix_exidx_coverage): New method.
6037 (Target_arm::output_section_address_less_than): New type.
6038 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
6039 linked text section instead of the EXIDX section.
6040 (Arm_output_section::create_stub_group): Add an assertion to check
6041 that this is not an EXIDX output section.
6042 (Arm_output_section::append_text_sections_to_list): New method.
6043 (Arm_output_section::fix_exidx_coverage): Ditto.
6044 (Arm_relobj::scan_sections_for_stubs): Adjust call to
6045 Arm_relobj::section_needs_reloc_stub_scanning.
6046 (Target_arm::do_relax): Fix EXIDX output section coverage in the
6048 (Target_arm::fix_exidx_coverage): New method.
6049 * object.h (Relobj::set_output_section): New method.
6050 (Sized_relobj::invalidate_section_offset): Remove method.
6051 (Sized_relobj::do_invalidate_section_offset): Remove method.
6052 (Sized_relobj::do_set_section_offset): Handle offset value -1.
6054 2010-01-25 Doug Kwan <dougkwan@google.com>
6056 * arm.cc (Arm_exidx_merged_section::do_output_offset):
6057 Fix warning due to signed and unsigned comparison on a 32-bit host.
6059 2010-01-22 Doug Kwan <dougkwan@google.com>
6061 * arm.cc (Target_arm::do_relax): Record an output section for section
6062 offset adjustment it contains any stub table that has changed.
6063 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
6064 offsets in an output section if necessary.
6065 * output.cc (Output_section::Output_section): Initialize
6066 section_offsets_need_adjustments_.
6067 (Output_section::add_input_section_for_script): Renamed to
6068 Output_section::add_simple_input_section.
6069 (Output_section::save_states): Add a comment.
6070 (Output_section::discard_states): New method defintion.
6071 (Output_section::adjust_section_offsets): Same.
6072 * output.h (Output_section::add_input_section_for_script): Renamed to
6073 Output_section::add_simple_input_section.
6074 (Output_section::discard_states): New method declaration.
6075 (Output_section::adjust_section_offsets): Same.
6076 (Output_section::section_offsets_need_adjustment,
6077 Output_section::set_section_offsets_need_adjustment): New method
6079 (Output_section::section_offsets_need_adjustment_): New data member.
6080 * script-sections.cc
6081 (Output_section_element_input::set_section_address): Adjust code for
6082 renaming of Output_section::add_input_section_for_script.
6083 (Orphan_output_section::set_section_address): Same.
6085 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6087 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
6088 Fix_v4bx enum values .
6089 * gold/options.h (General_options): New option definitions.
6090 (General_options::fix_v4bx): New method.
6091 (General_options::Fix_v4bx): New enum.
6092 * gold/options.cc (General_options::parse_fix_v4bx): New method.
6093 (General_options::parse_fix_v4bx_interworking): New method.
6095 2010-01-22 Doug Kwan <dougkwan@google.com>
6097 * arm.cc (Arm_exidx_fixup): New class.
6099 2010-01-21 Doug Kwan <dougkwan@google.com>
6101 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
6103 (Arm_exidx_section_offset_map): New type.
6105 2010-01-21 Doug Kwan <dougkwan@google.com>
6107 * arm.cc (Arm_exidx_input_section): New class.
6108 (Arm_relobj::exidx_input_section_by_link,
6109 Arm_relobj::exidx_input_section_by_shndx,
6110 Arm_relobj::make_exidx_input_section): New methods.
6111 (read_arm_attributes_section): Remove.
6112 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
6113 information about them.
6114 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
6117 2010-01-20 Doug Kwan <dougkwan@google.com>
6119 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
6120 Input_section_specifier to Section_id.
6121 (Target_arm::new_arm_input_section: Adjust code for change of key
6123 (Target_arm::find_arm_input_section): Ditto.
6124 * gc.h (object.h): Include for Section_id nand Section_id_hash.
6125 (Section_id): Remove.
6126 (Garbage_collection::Section_id_hash): Remove.
6127 * icf.h (object.h): Include for Section_id nand Section_id_hash.
6128 (Section_id): Remove.
6129 (Icf::Section_id_hash): Remove.
6130 * object.h (Section_id, Const_section_id, Section_id_hash,
6131 Const_section_id_hash): New type definitions.
6132 * output.cc (Output_section::add_relaxed_input_section): Change to
6133 use Const_section_id instead of Input_section_specifier as key type.
6134 (Output_section::add_merge_input_section): Ditto.
6135 (Output_section::build_relaxation_map): Change to use Section_id
6136 instead of Input_section_specifier as key type.
6137 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6139 (Output_section::convert_input_sections_to_relaxed_sections): Change
6140 to use Const_section_id instead of Input_section_specifier as key type.
6141 (Output_section::find_merge_section): Ditto.
6142 (Output_section::find_relaxed_input_section): Ditto.
6143 * output.h (Input_section_specifier): Remove class.
6144 (Output_section::Output_section_data_by_input_section_map): Change
6145 key type to Const_section_id.
6146 (Output_section::Output_relaxed_input_section_by_input_section_map):
6148 (Output_section::Relaxation_map): Change key type to Section_id.
6150 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6152 * gold/arm.cc: Added support for R_ARM_V4BX relocation
6153 (class Arm_v4bx_stub): New class.
6154 (DEF_STUBS): Updated definition to support v4_veneer_bx.
6155 (Stub_factory::make_arm_v4bx_stub): New method.
6156 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
6157 (Stub_table::empty): Handle v4bx stubs.
6158 (Stub_table::add_arm_v4bx_stub): New method.
6159 (Stub_table::find_arm_v4bx_stub): New method.
6160 (Arm_relocate_functions::v4bx): New method.
6161 (Target_arm::fix_v4bx): New method.
6162 (Target_arm::Target_arm): Handle R_ARM_V4BX.
6163 (Stub_table::relocate_stubs): Likewise.
6164 (Stub_table::do_write): Likewise.
6165 (Stub_table::update_data_size_and_addralign): Likewise.
6166 (Stub_table::finalize_stubs): Likewise.
6167 (Target_arm::Scan::local): Likewise.
6168 (Target_arm::Scan::global): Likewise.
6169 (Target_arm::do_finalize_sections): Likewise.
6170 (Target_arm::Relocate::relocate): Likewise.
6171 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6173 (Target_arm::scan_reloc_for_stub): Likewise.
6174 (Target_arm::scan_reloc_section_for_stubs): Likewise.
6176 2010-01-19 Ian Lance Taylor <iant@google.com>
6178 * output.cc (Output_section_headers::do_sized_write): Write large
6179 segment count to sh_info field.
6180 (Output_file_header::do_sized_write): For large segment count,
6181 write PN_XNUM to e_phnum field.
6183 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6185 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
6186 (Arm_relocate_functions::thm_jump8): New function.
6187 (Arm_relocate_functions::thm_jump11): New function.
6188 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
6190 (Target_arm::Scan::global): Likewise.
6191 (Target_arm::Relocate::relocate): Likewise.
6192 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6195 2010-01-14 Doug Kwan <dougkwan@google.com>
6197 * arm.cc (map, utility): Include headers.
6198 (Target_arm::apply_cortex_a8_workaround): New method.
6199 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
6200 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
6201 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
6202 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
6203 the --[no-]fix-cortex-a8 command line options.
6204 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
6205 (Target_arm::relocate_stub): Use addend in instruction template.
6206 * options.h (DEFINE_bool): Set the user-set flag.
6207 (General_options): Add --[no-]-fix-cortex options.
6208 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
6209 : Update fast look-up map after conversion.
6211 2010-01-14 Sriraman Tallam <tmsriram@google.com>
6213 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6214 in the first pass of do_layout.
6216 2010-01-13 Doug Kwan <dougkwan@google.com>
6218 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6219 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6220 apparent compiler problem of not folding static constant integral
6221 data members of elfcpp::Elf_sizes<32>.
6223 2010-01-13 Doug Kwan <dougkwan@google.com>
6225 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6226 Arm_relobj::section_needs_cortex_a8_stub_scanning,
6227 Arm_relobj::scan_section_for_cortex_a8_erratum,
6228 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
6229 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
6230 sections to scan for relocation stubs into a new method
6231 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
6232 relocation and Cortex-A8 stub scanning.
6233 (Target_arm::do_relax): Force stubs to be after stubbed sections
6234 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
6235 the beginning of a new relaxation pass. Update a comment.
6236 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
6238 2010-01-12 Ian Lance Taylor <iant@google.com>
6240 * target-reloc.h (visibility_error): New inline function.
6241 (relocate_section): Call visibility_error.
6242 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6243 (MOSTLYCLEANFILES): Likewise.
6244 (protected_4_pic.o, protected_3.err): New targets.
6245 * testsuite/protected_4.cc: New file.
6247 2010-01-12 Doug Kwan <dougkwan@google.com>
6249 * arm.cc (Cortex_a8_reloc): New class.
6250 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6251 and cortex_a8_relocs_info_.
6252 (Target_arm::fix_cortex_a8): New method definition.
6253 (Target_arm::Cortex_a8_relocs_info): New type.
6254 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6255 New data member declarations.
6256 (Target_arm::scan_reloc_for_stub): Record information about
6257 relocations for THUMB branches that might be exempted from the
6258 Cortex-A8 workaround.
6259 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
6260 at the beginning of a relaxation pass.
6262 2010-01-12 Doug Kwan <dougkwan@google.com>
6264 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
6265 (Arm_relobj::Mapping_symbol_position,
6266 Arm_reloj::Mapping_symbol_position_less,
6267 Arm_relobj::Mapping_symbols_info): New types.
6268 (Target_arm::is_mapping_symbol_name): New method definition.
6269 (Arm_relobj::do_count_local_symbols): Save information about mapping
6272 2010-01-11 Doug Kwan <dougkwan@google.com>
6274 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
6275 Arm_relocate_functions::thumb32_branch_upper,
6276 Arm_relocate_functions::thumb32_branch_lower,
6277 Arm_relocate_functions::thumb32_cond_branch_offset,
6278 Arm_relocate_functions::thumb32_cond_branch_upper,
6279 Arm_relocate_functions::thumb32_cond_branch_lower,
6280 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
6281 branch offset encoding.
6282 (Arm_relocate_functions::thumb_branch_common): Use new branch
6283 offset encoding methods to avoid code duplication.
6284 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
6285 (Stub_addend_reader::operator()): Use new branch encoding method
6286 to avoid code duplication.
6288 2010-01-11 Doug Kwan <dougkwan@google.com>
6290 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
6291 (Target_arm::do_finalize_sections): Define special EXIDX section
6292 symbols only if referenced.
6293 * gc.h (Garbage_collection::add_reference): New method.
6294 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
6297 2010-01-11 Ian Lance Taylor <iant@google.com>
6299 * script.cc (Version_script_info::build_expression_list_lookup):
6300 Change complaing about duplicate wildcard match from error to
6303 * script.cc (class Lazy_demangler): Recreate--revert part of patch
6305 (Version_script_info::Version_script_info): Initialize globs_,
6306 default_version_, default_is_global_, and exact_. Don't
6307 initialize globals_ or locals_.
6308 (Version_script_info::build_lookup_tables): Build local symbols
6310 (Version_script_info::unquote): New function.
6311 (Version_script_info::add_exact_match): New function.
6312 (Version_script_info::build_expression_list_lookup): Remove lookup
6313 parameter. Add is_global parameter. Change all callers. Handle
6314 wildcard pattern specially. Unquote pattern. Call
6316 (Version_script_info::get_name_to_match): New function.
6317 (Version_script_info::get_symbol_version): New function.
6318 (Version_script_info::get_symbol_version_helper): Remove.
6319 (Version_script_info::check_unmatched_names): Call unquote.
6320 * script.h (class Version_script_info): Change get_symbol_version
6321 to be non-inline and add is_global parameter; change all callers.
6322 Rewrite symbol_is_local. Update declarations. Define struct
6323 Version_tree_match, Exact, Globs. Don't define struct Lookup.
6324 Remove globals_ and locals_ members. Add exact_, globs_,
6325 default_version_, is_global_.
6326 (Version_script_info::Glob): Remove pattern, add expression and
6327 is_global. Update constructor. Change all callers.
6328 * dynobj.cc (Versions::finalize): Mark the version symbol as the
6330 (Versions::symbol_section_contents): If a symbol is undefined, or
6331 defined in a dynamic object, set the version index to
6333 * symtab.cc (Symbol_table::add_from_relobj): Don't call
6335 (Symbol_table::add_from_pluginobj): Likewise.
6336 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
6338 2010-01-11 Doug Kwan <dougkwan@google.com>
6340 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
6341 (incremental_dump_LDADD): Add linking option for libintl.
6342 * Makefile.in: Regenerate.
6344 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
6347 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
6349 * testsuite/Makefile.in: Regenerated.
6351 2010-01-10 Doug Kwan <dougkwan@google.com>
6353 * options.h (DEFINE_var): Use parentheses around argument varname__
6354 in macro body to avoid any unintended subsequent substitutions.
6356 2010-01-10 Ian Lance Taylor <iant@google.com>
6358 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
6359 candidates before doing symbol resolution.
6361 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
6362 ODR candidates if only one is weak.
6364 2010-01-08 Ian Lance Taylor <iant@google.com>
6366 * script.cc (Version_script_info::build_expression_list_lookup):
6367 Don't warn about ambiguous version, just record the ambiguity.
6368 (Version_script_info::get_symbol_version_helper): Give error if
6369 version is ambiguous.
6371 2010-01-08 Doug Kwan <dougkwan@google.com>
6373 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
6374 prev_data_size_ and prev_addralign_. Remove initializer for
6375 deleted data member has_been_changed_.
6376 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
6377 to determine if the table is empty.
6378 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
6380 (Stub_table::add_reloc_stub): Define method in class definition
6381 instead of just declaring it there.
6382 (Stub_table::add_cortex_a8_stub): New method definition.
6383 (Stub_table::update_data_size_and_addralign): Ditto.
6384 (Stub_table::finalize_stubs): Ditto.
6385 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
6386 (Stub_table::do_addralign_): Return address alignment in the
6387 (Stub_table::do_reset_address_and_file_offset): Define method in
6388 class definition instead of declaring it there. Set current data
6389 size to be the data size of the previous pass.
6390 (Stub_table::set_final_data_size): Use current data size as the
6392 (Stub_table::relocate_stub): Change parameter type of stub from
6393 Reloc_stub pointer to Stub pointer.
6394 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
6395 (Stub_table::Cortex_a8_stub_list): New typedef.
6396 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
6397 Stub_table::prev_addralign_): New data member.
6398 (Arm_relobj::Arm_relobj): Initialize data member
6399 section_has_cortex_a8_workaround_.
6400 (Arm_relobj::section_has_cortex_a8_workaround,
6401 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
6403 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
6405 (Target_arm::relocate_stub): Change parameter type of stub from
6406 Reloc_stub pointer to Stub pointer.
6407 (Insn_template::size, Insn_template::alignment): Handle
6408 THUMB16_SPECIAL_TYPE.
6409 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
6410 Stub_table::update_data_size_and_addralign,
6411 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
6413 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
6414 (Stub_table::do_write): Ditto.
6415 (Target_arm::do_relax): Adjust code for changes in Stub_table.
6417 2010-01-08 Ian Lance Taylor <iant@google.com>
6420 * symtab.h (class Symbol): Remove fields is_target_special_ and
6421 has_plt_offset_. Add field is_defined_in_discarded_section_.
6422 (Symbol::is_defined_in_discarded_section): New function.
6423 (Symbol::set_is_defined_in_discarded_section): New function.
6424 (Symbol::has_plt_offset): Rewrite.
6425 (Symbol::set_plt_offset): Verify that new offset is not -1U.
6426 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
6427 Don't initialize is_target_special_ or has_plt_offset_.
6428 Initialize is_defined_in_discarded_section_.
6429 (Symbol_table::add_from_relobj): If appropriate, set
6430 is_defined_in_discarded_section.
6431 * resolve.cc (Symbol::override_base_with_special): Don't test
6432 is_target_special_. Change has_plt_offset_ to has_plt_offset().
6433 * target-reloc.h (relocate_section): Do special handling for
6434 symbols defined in discarded sections for global symbols as well
6437 2010-01-08 Ian Lance Taylor <iant@google.com>
6439 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
6440 the SHT_SYMTAB case.
6442 2010-01-08 Ian Lance Taylor <iant@google.com>
6444 * object.cc (Sized_relobj::do_layout): Don't get confused if
6445 layout_eh_frame returns NULL.
6447 2010-01-08 Ian Lance Taylor <iant@google.com>
6450 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
6451 dynamic symbol table, use the normal symbol table.
6452 (Sized_dynobj::do_read_symbols): Remove assertion about type of
6455 2010-01-08 Ian Lance Taylor <iant@google.com>
6458 * layout.cc (Layout::include_section): Remove .gnu_debuglink
6461 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
6463 * version.cc (print_version): Change to "Copyright 2010".
6465 2010-01-08 Ian Lance Taylor <iant@google.com>
6469 * i386.cc (class Target_i386): Change return type of plt_section
6471 (class Output_data_plt_i386): Add tls_desc_rel_ field.
6472 (Output_data_plt_i386::Output_data_plt_i386): Initialize
6473 tls_desc_rel_ field.
6474 (Output_data_plt_i386::rel_tls_desc): New function.
6475 (Target_i386::rel_tls_desc_section): New function.
6476 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
6477 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
6478 R_386_TLS_DESC reloc in rel_tls_desc_section.
6479 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
6480 Define struct Tlsdesc_info.
6481 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
6482 (Target_x86_64::do_reloc_symbol_index): New function.
6483 (Target_x86_64::add_tlsdesc_info): New function.
6484 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
6485 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
6487 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
6489 (Output_data_plt_x86_64::rela_tlsdesc): New function.
6490 (Target_x86_64::rela_tlsdesc_section): New function.
6491 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
6493 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
6494 (Target_x86_64::do_reloc_addend): New function.
6495 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
6496 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
6497 declarations. Define TARGET_CODE. Add arg field to u1_ union.
6498 (Output_reloc::type): New function.
6499 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
6500 (Output_reloc::is_target_specific): New function.
6501 (Output_reloc::target_arg): New function.
6502 (class Output_reloc) [SHT_RELA]: Add four new constructors for
6503 absolute relocs and target specific relocs.
6504 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
6505 add_target_specific.
6506 (class Output_data_reloc) [SHT_RELA]: Likewise.
6507 * output.cc (Output_reloc::Output_reloc): Add four new versions
6508 for absolute relocs and target specific relocs.
6509 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
6510 (Output_reloc::get_symbol_index): Likewise.
6511 (Output_reloc::local_section_offset): Check that local_sym_index_
6512 is not TARGET_CODE or 0.
6513 (Output_reloc::symbol_value): Likewise.
6514 (Output_reloc::write) [SHT_RELA]: Call target for target specific
6516 * target.h (class Target): Add reloc_symbol_index and reloc_addend
6517 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
6519 * layout.cc (add_target_dynamic_tags): Use output section for
6520 DT_PLTRELSZ and DT_JMPREL.
6522 2010-01-07 Ian Lance Taylor <iant@google.com>
6525 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
6527 (class Output_data_reloc_generic): Define.
6528 (class Output_data_reloc_base): Change base class to
6529 Output_data_reloc_generic. Change add() method to call
6530 bump_relative_reloc_count for a relative reloc. Remove
6532 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
6534 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
6535 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
6537 * layout.h (class Layout): Update declaration.
6539 2010-01-07 Ian Lance Taylor <iant@google.com>
6541 * output.h (class Output_data): Add const version of
6542 output_section and do_output_section.
6543 (class Output_section_data): Add const version of
6545 (class Output_section): Likewise.
6546 * layout.cc (Layout::add_target_dynamic_tags): New function.
6547 * layout.h (class Layout): Update declarations.
6548 * arm.cc (Target_arm::do_finalize_sections): Use
6549 add_target_dynamic_tags.
6550 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6551 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6552 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6553 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6555 2010-01-07 Ian Lance Taylor <iant@google.com>
6558 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
6561 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
6562 Ian Lance Taylor <iant@google.com>
6565 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
6566 Xindex::read_symtab_xindex.
6568 2010-01-07 Doug Kwan <dougkwan@google.com>
6570 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
6571 (Insn_template::thumb16_bcond_insn): New method declaration.
6572 (Insn_template): Fix spelling.
6573 (Stub::thumb16_special): New method declaration.
6574 (Stub::do_write): Define virtual method which was previously pure
6576 (Stub::do_thumb16_special): New method declaration.
6577 (Stub::do_fixed_endian_write): New template member.
6578 (Reloc_stub::do_write): Remove.
6579 (Reloc_stub::do_fixed_endian_write): Remove.
6580 (Cortex_a8_stub): New class definition.
6581 (Stub_factory::make_cortex_a8_stub): New method definition.
6582 (Stub_factory::Stub_factory): Add missing static storage class
6583 qualifier for elf32_arm_stub_a8_veneer_blx.
6585 2010-01-07 Ian Lance Taylor <iant@google.com>
6588 * options.h (class General_options): Add --warn-unresolved-symbols
6589 and --error-unresolved-symbols.
6590 * errors.cc (Errors::undefined_symbol): Implement
6591 --warn-unresolved-symbols.
6593 * options.h (class General_options): Add -z text and -z textoff.
6594 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
6596 2010-01-06 Sriraman Tallam <tmsriram@google.com>
6598 * gc.h (Garbage_collection::Cident_section_map): New typedef.
6599 (Garbage_collection::cident_sections): New function.
6600 (Garbage_collection::add_cident_section): New function.
6601 (Garbage_collection::cident_sections_): New member.
6602 (gc_process_relocs): Add references to sections whose names are C
6604 * gold.h (cident_section_start_prefix): New constant.
6605 (cident_section_stop_prefix): New constant.
6606 (is_cident): New function.
6607 * layout.cc (Layout::define_section_symbols): Replace string constants
6608 with the newly defined constants.
6609 * object.cc (Sized_relobj::do_layout): Track sections whose names are
6611 * testsuite/Makefile.am: Add gc_orphan_section_test.
6612 * testsuite/Makefile.in: Regenerate.
6613 * testsuite/gc_orphan_section_test.cc: New file.
6614 * testsuite/gc_orphan_section_test.sh: New file.
6616 2010-01-06 Ian Lance Taylor <iant@google.com>
6619 * options.h (class General_options): Add --warn-shared-textrel.
6620 * layout.cc (Layout::finish_dynamic_section): Implement
6621 --warn-shared-textrel.
6624 * options.h (class General_options): Add --warn-multiple-gp.
6626 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6628 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
6629 $(THREADSLIB) and $(LIBDL).
6630 * Makefile.in: Rebuild.
6632 2010-01-06 Ian Lance Taylor <iant@google.com>
6635 * options.cc (General_options::parse_section_start): New function.
6636 (General_options::section_start): New function.
6637 (General_options::General_options): Initialize all members.
6638 * options.h: Include <map>
6639 (class General_options): Add --section-start. Add section_starts_
6641 * layout.cc (Layout::attach_allocated_section_to_segment): If
6642 --section-start was used, set the address of the segment. Remove
6643 local sort_sections.
6644 (Layout::relaxation_loop_body): If the address of the load segment
6645 has been set by --section-start, don't use it.
6646 * output.h (Output_segment::update_flags_for_output_section): New
6648 * output.cc (Output_segment::add_output_section): Call
6649 update_flags_for_output_section.
6651 2010-01-05 Ian Lance Taylor <iant@google.com>
6654 * options.h (class General_options): Add --undefined-version.
6655 * script.cc (struct Version_expression): Add was_matched_by_symbol
6657 (Version_script_info::matched_symbol): New function.
6658 (Version_script_info::get_symbol_version_helper): Call
6660 (Version_script_info::check_unmatched_names): New function.
6661 * script.h (class Version_script_info): Update declarations.
6662 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
6664 * options.h (class General_options): Use DEFINE_bool_alias for
6665 allow_multiple_definition.
6666 * resolve.cc (Symbol_table::should_override): Don't test
6667 allow_multiple_definition.
6670 * options.h (class General_options): Add --cref.
6671 * main.cc (main): Print cref table if --cref. Don't close mapfile
6672 until after printing cref table.
6673 * cref.cc: Include "symtab.h".
6674 (class Cref_inputs): Define Cref_table_compare and Cref_table.
6675 (Cref_table_compare::operator()): New function.
6676 (Cref_inputs::gather_cref): New function.
6677 (filecol): New static const.
6678 (Cref_inputs::print_cref): New function.
6679 (Cref::print_cref): New function.
6680 * cref.h: Include <cstdio>.
6681 (class Cref): Update declarations.
6682 * mapfile.h (Mapfile::file): New function.
6683 * object.h (class Object): Define Symbols. Declare virtual
6684 do_get_global_symbols.
6685 (Object::get_global_symbols): New function.
6686 * object.cc (Input_objects::add_object): Pass object to cref_ if
6688 (Input_objects::archive_start): Likewise.
6689 (Input_objects::archive_stop): Likewise.
6690 (Input_objects::print_cref): New function.
6691 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
6692 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
6694 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
6696 * plugin.h (class Sized_pluginobj): Update declarations.
6698 2010-01-05 Ian Lance Taylor <iant@google.com>
6700 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
6701 to is_default_version. Rename insdef to insdefault.
6702 (Symbol_table::add_from_relobj): Rename def to is_default_version
6703 and local to is_forced_local.
6704 (Symbol_table::add_from_pluginobj): Likewise.
6705 (Symbol_table::add_from_dynobj): Likewise.
6706 (Symbol_table::define_special_symbol): Rename insdef to
6709 2010-01-04 Ian Lance Taylor <iant@google.com>
6712 * options.h (class General_options): Add
6713 --allow-multiple-definition and -z muldefs.
6714 * resolve.cc (Symbol_table::should_override): Don't warn about a
6715 multiple symbol definition if --allow-multiple-definition or -z
6719 * options.h (class General_options): Add --add-needed and
6720 --copy-dt-needed-entries. Tweak --as-needed help entry.
6721 * object.cc (Input_objects::check_dynamic_dependencies): Give an
6722 error if --copy-dt-needed-entries aka --add-needed is used and
6723 would cause a change in behaviour.
6726 * options.h (class General_options): Add -G as a short version of
6727 --shared. Add no-op options -assert, -g, and -i.
6729 2010-01-04 Sriraman Tallam <tmsriram@google.com>
6731 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
6732 check for .text or .gnu.linkonce.t sections.
6733 * icf.cc (Icf::find_identical_sections): Ditto.
6734 Change the detection for mangled function name within the section
6736 * icf.h (is_section_foldable_candidate): New function.
6738 2009-12-30 Ian Lance Taylor <iant@google.com>
6741 * options.h (class General_options): Permit two dashes with
6742 --retain-symbols-file.
6744 2009-12-30 Ian Lance Taylor <iant@google.com>
6747 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
6748 don't put the file header and segment headers in the text
6752 * common.cc (Sort_commons::operator()): Stabilize sort when both
6754 (Symbol_table::do_allocate_commons_list): When allocating common
6755 symbols, skip a symbol which is no longer common.
6756 * symtab.h (Symbol::is_common): Test whether the symbol comes from
6757 an object before checking its type.
6758 * testsuite/common_test_2.c: New file.
6759 * testsuite/common_test_3.c: New file.
6760 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
6761 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
6762 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
6763 (common_test_2_pic.o, common_test_2.so): New targets.
6764 (common_test_3_pic.o, common_test_3.so): New targets.
6765 * testsuite/Makefile.in: Rebuild.
6768 * script.cc (read_input_script): If we see a new SECTIONS clause,
6769 and we have added an input section, give an error.
6770 * layout.h (class Layout): Add have_added_input_section function.
6771 Add have_added_input_section_ field.
6772 * layout.cc (Layout::Layout): Initialize
6773 have_added_input_section_.
6774 (Layout::layout): Set have_added_input_section_.
6775 (Layout::layout_eh_frame): Likewise.
6777 2009-12-30 Ian Lance Taylor <iant@google.com>
6780 * options.h (class General_options): Add --sort-common option.
6781 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
6782 * common.cc (Sort_common): Add sort_order parameter to
6783 constructor. Add sort_order_ field.
6784 (Sort_commons::operator): Check sort_order_.
6785 (Symbol_table::allocate_commons): Determine the sort order.
6786 (Symbol_table::do_allocate_commons): Add sort_order parameter.
6788 (Symbol_table::do_allocate_commons_list): Likewise.
6790 2009-12-30 Ian Lance Taylor <iant@google.com>
6793 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
6794 symbols from this object, don't change the visibility of an
6796 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
6798 2009-12-30 Ian Lance Taylor <iant@google.com>
6801 * script.h (class Version_script_info): Define Language enum.
6802 Update declarations. Define Glob, Exact, and Lookup types. Add
6803 new fields globals_, locals_, and is_finalized_.
6804 * script.cc: Various formatting fixes.
6805 (class Parser_closure): Change language_stack_ from a vector of
6806 std::string to one of Version_script_info::Language. Adjust all
6808 (class Lazy_demangler): Remove.
6809 (struct Version_expression): Change language from std::string to
6810 Version_script_info::Language.
6811 (Version_script_info::Version_script_info): New function.
6812 (Version_script_info::~Version_script_info): Don't call clear.
6813 (Version_script_info::finalize): New function.
6814 (Version_script_info::build_lookup_tables): New function.
6815 (Version_script_info::build_expression_list_lookup): New
6817 (Version_script_info::get_symbol_version_helper): Rewrite to use
6819 (Version_script_info::print_expression_list): Adjust to use
6820 Version_script_info::Language.
6821 (script_push_lex_into_version_mode): Check that the version script
6822 has not been finalized.
6823 (version_script_push_lang): Change language string to
6824 Version_script_info::Language.
6825 * options.cc (Command_line::version_script): New function.
6826 * options.h (class General_options): Add finalize_dynamic_list
6827 function. Change version_script from declaration to definition.
6828 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
6829 * testsuite/version_script.map: Remove duplicate def of foo.
6830 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
6832 * testsuite/Makefile.in: Rebuild.
6834 2009-12-30 Ian Lance Taylor <iant@google.com>
6837 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
6838 if the input symbol index is 0, make the output symbol index 0.
6840 2009-12-30 Ian Lance Taylor <iant@google.com>
6843 * options.h (class General_options): Add -x/--discard-all.
6844 * object.cc (Sized_relobj::do_count_local_symbols): Handle
6845 --discard-all. If the local symbol needs a dynamic entry, check
6846 that before handling --discard-locals.
6848 2009-12-30 Ian Lance Taylor <iant@google.com>
6851 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
6853 (Output_segment::add_output_section): Don't change the flags if
6857 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
6858 GNU hash table if they need a dynamic value. Otherwise, don't add
6859 them if they are defined in a dynamic object or are forced local.
6861 2009-12-29 Ian Lance Taylor <iant@google.com>
6864 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
6865 .gnu.hash table for a 32-bit target.
6868 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
6869 regular and a dynamic object only needs a dynamic symbol table
6870 entry if it is externally visible.
6873 * i386.cc (class Target_i386): Initialize global_offset_table_ in
6874 constructor. Add global_offset_table_ field.
6875 (Target_i386::got_section): Set global_offset_table_.
6876 (Target_i386::do_finalize_sections): Set global_offset_table_
6878 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
6879 in constructor. Add global_offset_table_ field.
6880 (Target_x86_64::got_section): Set global_offset_table_.
6881 (Target_x86_64::do_finalize_sections): Set global_offset_table_
6884 * layout.cc (Layout::Layout): Initialize increase_relro_.
6885 (Layout::get_output_section): Add is_relro, is_last_relro, and
6886 is_first_non_relro parameters. Change all callers.
6887 (Layout::choose_output_section): Likewise.
6888 (Layout::add_output_section_data): Likewise.
6889 (Layout::make_output_section): Likewise.
6890 (Layout::set_segment_offsets): Clear increase_relro when using a
6892 * layout.h (class Layout): Add increase_relro method. Add
6893 increase_relro_ field. Update declarations.
6894 * output.cc (Output_section::Output_section): Initialize
6895 is_last_relro_ and is_first_non_relro_.
6896 (Output_segment::add_output_section): Group relro sections is
6897 do_sort is true. Handle is_last_relro and is_first_non_relro.
6898 (Output_segment::maximum_alignment): Remove relro handling.
6899 (Output_segment::set_section_addresses): Add increase_relro
6900 parameter. Change all callers. Add initial alignment to align
6901 relro sections on separate page. Remove old relro handling.
6902 (Output_segment::set_section_list_addresses): Remove in_relro
6903 parameter. Change all callers.
6904 (Output_segment::set_offset): Add increase parameter. Change all
6905 callers. Remove old relro handling.
6906 * output.h (class Output_section): Add new methods: is_last_relro,
6907 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
6908 Add is_last_relro_ and is_first_non_relro_ fields.
6909 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
6910 Create separate .got.plt section. Call increase_relro.
6911 * x86_64.cc (Target_x86_64::got_section): Likewise.
6912 * testsuite/relro_script_test.t: Add .got.plt.
6915 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
6916 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
6917 (Layout::finalize): Call set_dynamic_symbol_size.
6918 (Layout::set_dynamic_symbol_size): New function.
6919 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
6920 set_dynamic_symbol_size.
6923 * output.h (class Output_section): Add is_entsize_zero_ field.
6924 * output.cc (Output_section::Output_section): Initialize
6926 (Output_section::set_entsize): If two different entsizes are
6927 requested, force it to zero.
6928 (Output_section::add_input_section): Set flags for .debug_str
6929 before updating section flags. Set entsize.
6930 (Output_section::update_flags_for_input_section): Set SHF_MERGE
6931 and SHF_STRING if all input sections have those flags.
6933 2009-12-29 Rafael Espindola <espindola@google.com>
6935 * main.cc (main): Fix the sys time reporting.
6936 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
6939 2009-12-29 Sriraman Tallam <tmsriram@google.com>
6941 * options.cc (General_options::parse_version): Allow -v to exit
6942 without an error if there is nothing to link.
6944 2009-12-29 Ian Lance Taylor <iant@google.com>
6946 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
6947 using a version of gcc before 4.1.
6948 * configure: Rebuild.
6950 2009-12-28 Chris Demetriou <cgd@google.com>
6952 * attributes.cc (Output_attributes_section_data::do_write): Use
6953 std::vector::front rather than std::vector::data.
6955 2009-12-28 Ian Lance Taylor <iant@google.com>
6957 * symtab.h (class Symbol_table): Add enum Defined.
6958 * resolve.cc (Symbol_table::should_override): Add defined
6959 parameter. Change all callers. Test whether object is NULL
6960 before calling a method on it.
6961 (Symbol_table::report_resolve_problem): Add defined parameter.
6963 (Symbol_table::should_override_with_special): Likewise.
6964 * symtab.cc (Symbol_table::define_in_output_data): Add defined
6965 parameter. Change all callers.
6966 (Symbol_table::do_define_in_output_data): Likewise.
6967 (Symbol_table::define_in_output_segment): Likewise.
6968 (Symbol_table::do_define_in_output_segment): Likewise.
6969 (Symbol_table::define_as_constant): Likewise.
6970 (Symbol_table::do_define_as_constant): Likewise.
6971 * script.h (class Symbol_assignment): Add is_defsym parameter to
6972 constructor; change all callers.
6973 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
6974 parameter. Change all callers. Add is_defsym_ field.
6975 (class Parser_closure): Add parsing_defsym parameter to
6976 constructor; change all callers. Add parsing_defsym accessor
6977 function. Add parsing_defsym_ field.
6979 2009-12-28 Ian Lance Taylor <iant@google.com>
6981 * gold.cc (queue_middle_tasks): Fix formatting.
6982 * object.cc (Relobj::is_section_name_included): Likewise.
6984 2009-12-23 Ian Lance Taylor <iant@google.com>
6986 * i386.cc (Target_i386::do_calls_non_split): Recognize
6987 -fsplit-stack prologue for a function with a static chain.
6988 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
6989 -fsplit-stack prologue when using %r11.
6991 2009-12-21 Sriraman Tallam <tmsriram@google.com>
6993 * options.cc (General_options::parse_version): Make -v continue and do
6994 the link like GNU ld does.
6996 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
6998 * Makefile.am (CCFILES): Add timer.cc.
6999 (HFILES): Add timer.h.
7000 * configure.ac: Check for sysconf and times.
7001 * main.cc: include timer.h.
7002 (main): Use Timer instead of get_run_time.
7005 * workqueue.cc: include timer.h.
7006 (Workqueue::find_and_run_task):
7007 Report user, sys and wall time.
7008 * Makefile.in: Regenerate.
7009 * config.in: Regenerate.
7010 * configure: Regenerate.
7012 2009-12-16 Doug Kwan <dougkwan@google.com>
7014 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
7016 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
7017 relaxed input sections.
7018 * output.cc (Output_section::find_relaxed_input_section): Change
7019 return type to Output_relaxed_input_section pointer. Adjust code
7020 for new type of relaxed_input_section_map_.
7021 * output.h (Output_section::find_relaxed_input_section): Change
7022 return type to Output_relaxed_input_section pointer.
7023 (Output_section::Output_relaxed_input_section_by_input_section_map):
7025 (Output_section::relaxed_input_section_map_): Change type to
7026 Output_section::Output_relaxed_input_section_by_input_section_map.
7027 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
7030 2009-12-15 Ian Lance Taylor <iant@google.com>
7032 * layout.cc (Layout::create_shstrtab): Only write out after input
7033 sections if we are compressing debug sections.
7035 2009-12-15 Ian Lance Taylor <iant@google.com>
7037 * archive.cc (Archive::add_symbols): Only look up a symbol without
7038 a version if there is, in fact, a version.
7040 2009-12-14 Ian Lance Taylor <iant@google.com>
7042 Revert -Wshadow changes, all changes from:
7043 2009-12-11 Doug Kwan <dougkwan@google.com>
7044 2009-12-11 Nick Clifton <nickc@redhat.com>
7045 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
7047 2009-12-11 Doug Kwan <dougkwan@google.com>
7049 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
7051 * attributes.cc (Object_attribute::size): Ditto.
7052 (Attributes_section_data::size): Ditto.
7053 (Attributes_section_data::Attributes_section_data): Ditto.
7054 (Output_attributes_section_data::do_write): Ditto.
7055 * attributes.h (Object_attribute::set_type): Ditto.
7056 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
7058 2009-12-11 Nick Clifton <nickc@redhat.com>
7060 * archive.cc: Fix shadowed variable warnings.
7062 * compressed_output.cc: Likewise.
7063 * compressed_output.h: Likewise.
7064 * configure: Likewise.
7065 * dwarf_reader.cc: Likewise.
7066 * dynobj.cc: Likewise.
7067 * dynobj.h: Likewise.
7068 * ehframe.cc: Likewise.
7069 * ehframe.h: Likewise.
7070 * errors.cc: Likewise.
7071 * expression.cc: Likewise.
7072 * fileread.cc: Likewise.
7073 * fileread.h: Likewise.
7074 * freebsd.h: Likewise.
7075 * i386.cc: Likewise.
7077 * incremental.h: Likewise.
7078 * layout.cc: Likewise.
7079 * layout.h: Likewise.
7080 * mapfile.cc: Likewise.
7081 * merge.cc: Likewise.
7082 * merge.h: Likewise.
7083 * object.cc: Likewise.
7084 * object.h: Likewise.
7085 * options.h: Likewise.
7086 * output.cc: Likewise.
7087 * output.h: Likewise.
7088 * parameters.cc: Likewise.
7089 * plugin.cc: Likewise.
7090 * powerpc.cc: Likewise.
7091 * reduced_debug_output.cc: Likewise.
7092 * reduced_debug_output.h: Likewise.
7093 * reloc.cc: Likewise.
7094 * reloc.h: Likewise.
7095 * resolve.cc: Likewise.
7096 * script-sections.cc: Likewise.
7097 * script.cc: Likewise.
7098 * script.h: Likewise.
7099 * sparc.cc: Likewise.
7100 * symtab.cc: Likewise.
7101 * symtab.h: Likewise.
7102 * target-select.cc: Likewise.
7103 * target-select.h: Likewise.
7104 * token.h: Likewise.
7105 * workqueue.cc: Likewise.
7106 * workqueue.h: Likewise.
7107 * x86_64.cc: Likewise.
7109 2009-12-10 Doug Kwan <dougkwan@google.com>
7111 * arm.cc (attributes.h): New include.
7112 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
7113 (Arm_relobj::~Arm_relobj): Delete object pointed by
7114 attributes_section_data_.
7115 (Arm_relobj::attributes_section_data): New method definition.
7116 (Arm_relobj::attributes_section_data_): New data member declaration.
7117 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
7118 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
7119 attributes_section_data_.
7120 (Arm_dynobj::attributes_section_data): New method definition.
7121 (Arm_dynobj::attributes_section_data_): New data member declaration.
7122 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
7123 initialization value of may_use_blx_ to false.
7124 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
7125 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
7126 object attributes to compute results instead of hard-coding.
7127 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
7128 Target_arm::get_secondary_compatible_arch,
7129 Target_arm::set_secondary_compatible_arch
7130 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7131 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
7132 New method declarations.
7133 (Target_arm::get_aeabi_object_attribute): New method definition.
7134 (Target_arm::attributes_section_data_): New data member declaration.
7135 (read_arm_attributes_section): New template definition.
7136 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
7137 (Arm_dynobj::do_read_symbols): Ditto.
7138 (Target_arm::do_finalize_sections): Merge attributes sections from
7139 input. Check for BLX use after attributes section merging.
7140 Fix __exidx_start and __exidx_end visibility. Create an
7141 .ARM.attributes section if necessary.
7142 (Target_arm::get_secondary_compatible_arch,
7143 Target_arm::set_secondary_compatible_arch,
7144 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7145 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
7146 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
7147 New method definitions.
7149 2009-12-09 Ian Lance Taylor <iant@google.com>
7151 * plugin.cc (Plugin::load): Don't cast from void* to a function
7154 2009-12-09 Ian Lance Taylor <iant@google.com>
7156 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
7159 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
7161 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
7162 Replace two_file_shared_1.so with two_file_shared_2.so.
7163 * testsuite/Makefile.in: Regenerated.
7165 2009-12-08 Doug Kwan <dougkwan@google.com>
7167 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
7168 (HFILES): Add attributes.h and int_encoding.h.
7169 * Makefile.in: Regenerate.
7170 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
7171 function definitions to int_encoding.cc
7172 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
7173 prototypes to int_encoding.h
7174 * reduced_debug_output.cc (int_encoding.h): New include.
7175 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
7176 function definitions to int_encoding.cc
7177 (insert_into_vector, read_from_pointer): Move template definitions to
7179 * attributes.cc: New file.
7180 * attributes.h: New file.
7181 * int_encoding.cc: New file.
7182 * int_encoding.h: New file.
7184 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
7187 * incremental-dump.cc (dump_incremental_inputs): New.
7188 (main): Use dump_incremental_inputs.
7190 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
7193 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
7194 checking elfcpp::STT_FUNC.
7195 (Target_i386::Relocate::relocate): Likewise.
7196 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
7198 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
7199 symbols from shared libraries into normal FUNC symbols.
7201 * symtab.h (Symbol): Add is_func and use it.
7203 2009-12-05 Doug Kwan <dougkwan@google.com>
7205 * arm.cc (Target_arm::arm_info): Initialize new fields
7206 attributes_section and attributes_vendor.
7207 * i386.cc (Target_i386::i386_info): Same.
7208 * object.cc (Sized_relobj::do_layout): Skip attribute section.
7209 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7210 fields attributes_section and attributes_vendor.
7211 * sparc.cc (Target_sparc::sparc_info): Same.
7212 * target.h (Target::attributes_section, Target::attributes_vendor,
7213 Target::is_attributes_section, Target::attribute_arg_type,
7214 Target::attributes_order): New method definitions.
7215 (Target::Target_info::attributes_section,
7216 Target::Target_info::attributes_vendor): New fields.
7217 (Target::do_attribute_arg_type, Target::do_attributes_order): New
7218 virtual method definitions.
7219 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7220 attributes_section and attributes_vendor.
7221 * testsuite/testfile.cc (Target_test::test_target_info): Same.
7223 2009-12-05 Doug Kwan <dougkwan@google.com>
7225 * arm.cc: Update comments about interworking and stub generation.
7226 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
7227 considered as non-PIC.
7228 (Arm_relocate_functions::base_abs): Fix formatting.
7229 (Arm_relocate_functions::got_prel): Fix comment. Change interface
7230 of function to use GOT entry address instead of offset.
7231 (Target_arm::Scan::global): Issue an error if a symbol would need a
7232 PLT does not get one because it is untyped. Remove code to create
7233 dynamic symbols for relative branches.
7234 (Target_arm::Relocate::relocate: Use 0 instead of false since function
7235 takes unsigned integer instead of boolean.
7237 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
7239 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7240 (two_file_test_LDADD): Likewise.
7241 (common_test_1_LDADD): Likewise.
7242 (exception_test_LDADD) Likewise.
7243 (weak_test_LDADD): Likewise.
7244 (many_sections_test_LDADD): Likewise.
7245 (initpri1_LDADD): Likewise.
7246 (script_test_1_LDADD): Likewise.
7247 (script_test_2_LDADD): Likewise.
7248 (justsyms_LDADD): Likewise.
7249 (binary_test_LDADD): Likewise.
7250 (large_LDADD): Likewise.
7251 * testsuite/Makefile.in: Regenerated.
7253 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
7255 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7256 (Symbol_table::override_with_special): Likewise.
7257 (Symbol_table::add_from_object): Likewise.
7259 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
7261 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7262 Don't set the data_offset twice.
7264 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
7266 * testsuite/Makefile.in: Regenerate.
7268 2009-12-03 Doug Kwan <dougkwan@google.com>
7270 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
7271 (Target_arm::do_finalize_sections): Add parameter for symbol table
7272 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
7273 * i386.cc (Target_i386::do_finalize_sections): Add an additional
7274 parameter for symbol table pointer.
7275 * layout.cc (Layout::finalize): Call Target::finalize_sections with
7276 an additional parameter for a pointer to symbol table.
7277 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
7278 parameter for a symbol table pointer.
7279 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
7280 * target.h (Target::finalize_sections, Target::do_finalize_sections):
7282 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
7283 parameter for a symbol table pointer.
7285 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
7287 * incremental.cc (Incremental_inputs_header)
7288 (Incremental_inputs_header_write, Incremental_inputs_entry)
7289 (Incremental_inputs_entry_write): Move ...
7290 * incremental.h (Incremental_inputs_header)
7291 (Incremental_inputs_header_write, Incremental_inputs_entry)
7292 (Incremental_inputs_entry_write): here.
7294 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7296 * incremental.cc (make_sized_incremental_binary): Set the target.
7297 Error if it is incompatible.
7298 * output.h (Output_file): Add filename method.
7300 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7302 * incremental.cc (Incremental_inputs_entry): Remove unused argument
7303 from the get_* methods.
7305 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7307 * incremental-dump.cc (main): Check that the offeset of a script is 0.
7308 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7309 Write 0 for the data_offset of scripts.
7311 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7313 * testsuite/Makefile.am: Add the incremental_test.sh test.
7314 * testsuite/incremental_test.sh: New.
7315 * testsuite/incremental_test_1.c: New.
7316 * testsuite/incremental_test_2.c: New.
7318 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
7320 * incremental-dump.cc (main): Fix typos.
7322 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
7325 * incremental-dump.cc (main): Use llu to print 64 bit values.
7327 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
7328 H.J. Lu <hongjiu.lu@intel.com>
7330 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
7332 (incremental_dump_LDADD): Likewise.
7333 * Makefile.in: Regenerated.
7335 2009-11-25 Doug Kwan <dougkwan@google.com>
7339 2009-11-25 Doug Kwan <dougkwan@google.com>
7341 * arm.cc (Target_arm::Target_arm): Move method definition
7342 outside of class definition. Add code to handle
7343 --target1-rel, --target1-abs and --target2= options.
7344 (Target_arm::get_reloc_reloc_type): Change method to be
7345 non-static and const.
7346 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
7347 New data member declaration.
7348 (Target_arm::Scan::local, Target_arm::Scan::global,
7349 Target_arm::Relocate::relocate,
7350 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7351 Adjust call to Target_arm::get_real_reloc_type.
7352 (Target_arm::get_real_reloc_type): Use command line options
7353 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7354 * options.h (--target1-rel, --target1-abs, --target2): New
7357 2009-11-25 Doug Kwan <dougkwan@google.com>
7359 * arm.cc (Target_arm::Target_arm): Move method definition outside of
7360 class definition. Add code to handle --target1-rel, --target1-abs
7361 and --target2= options.
7362 (Target_arm::get_reloc_reloc_type): Change method to be non-static
7364 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
7366 (Target_arm::Scan::local, Target_arm::Scan::global,
7367 Target_arm::Relocate::relocate,
7368 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
7369 call to Target_arm::get_real_reloc_type.
7370 (Target_arm::get_real_reloc_type): Use command line options to
7371 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7372 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
7375 2009-11-25 Doug Kwan <dougkwan@google.com>
7377 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
7378 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
7379 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
7381 (Arm_relocate_functions::thm_call): Replace body with a call to
7382 Arm_relocate_functions::thumb_branch_common.
7383 (Arm_relocate_functions::thm_jump24,
7384 Arm_relocate_functions::thm_xpc22): New method definitions.
7385 (Arm_relocate_functions::thumb_branch_common): New method definition.
7386 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
7388 (Target_arm::Relocate::relocate): Adjust call to thm_call.
7389 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
7391 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
7393 * Makefile.am: Build incremental-dump
7394 * Makefile.in: Regenerate.
7395 * incremental-dump.cc: New.
7396 * incremental.cc (Incremental_inputs_header_data,
7397 Incremental_inputs_entry_data): Move to incremental.h
7398 * incremental.h: (Incremental_inputs_header_data,
7399 Incremental_inputs_entry_data): Move from incremental.cc
7401 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
7403 * incremental.cc (Incremental_inputs_header,
7404 Incremental_inputs_header_write, Incremental_inputs_entry,
7405 Incremental_inputs_entry_write): Add a typedef with the data type.
7407 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
7409 * incremental.cc (Incremental_inputs_header,
7410 Incremental_inputs_header_write, Incremental_inputs_entry,
7411 Incremental_inputs_entry_write): Update comment about which
7412 type has the filed descriptions.
7414 2009-11-15 Doug Kwan <dougkwan@google.com>
7416 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
7417 (Arm_relocate_functions::arm_branch_common): Change method defintion
7418 in class definition to a method declaration and update list of formal
7420 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
7421 Arm_relocation_functions::jump24): Adjust call to
7422 Arm_relocate_functions::arm_branch_common. Update list of formal
7424 (Arm_relocate_functions::xpc25): New method definition.
7425 (Arm_relocate_functions::arm_branch_common): Move method defintion
7426 out from class definition. Use stubs for mode-switching and extending
7428 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
7429 specially. Change code to enable use of stubs in ARM branches.
7431 2009-11-10 Doug Kwan <dougkwan@google.com>
7433 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
7434 in method declaration.
7435 (Target_arm::relocate_stub): New method declaration.
7436 (Target_arm::default_target): Change to return a pointer instead of
7438 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
7439 Target_arm::default_target.
7440 (Arm_Relobj::do_relocate_sections): Remove options paramater in
7442 (Target_arm::relocate_section): Adjust view.
7443 (Target_arm::relocate_stub): New method definition.
7445 2009-11-10 Doug Kwan <dougkwan@google.com>
7447 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
7449 * incremental.cc (open_incremental_binary): Initialized local
7450 variables to avoid warnings.
7451 * object.cc (make_elf_object): Ditto.
7452 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
7455 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
7458 * testsuite/plugin_test.c: Include "config.h".
7460 2009-11-09 Doug Kwan <dougkwan@google.com>
7462 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
7463 (arm_symbol_value): Remove.
7464 (Arm_relocate_functions::arm_branch_common,
7465 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
7466 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
7467 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
7468 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
7469 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
7470 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
7471 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
7472 Arm_relocate_functions::thm_mobw_abs_nc,
7473 Arm_relocate_functions::thm_mov_abs,
7474 Arm_relocate_functions::movw_prel_nc,
7475 Arm_relocate_functions::thm_movt_abs,
7476 Arm_relocate_functions::movt_prel,
7477 Arm_relocate_functions::thm_movw_prel_nc,
7478 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
7479 (Target_arm::Relocate::relocate): Only decompose address into two
7480 parts if relocation type uses the thumb-bit and pass the actual
7481 bit instead of a flag indicating that the thumb-bit is used. Adjust
7482 calls to methods in Arm_relocate_functions for this change.
7484 2009-11-08 Ian Lance Taylor <iant@google.com>
7487 * reloc.cc: Instantiate
7488 Sized_relobj::initialize_input_to_output_maps and
7489 Sized_relobj:free_input_to_output_maps.
7491 2009-11-06 Ian Lance Taylor <iant@google.com>
7494 * defstd.cc (in_segment): Set only_if_ref true for "end".
7496 2009-11-06 Doug Kwan <dougkwan@google.com>
7498 * arm.cc (class Reloc_stub): Correct a comment.
7499 (Target_arm::Target_arm): Initialize arm_input_section_map_.
7500 (Target_arm::scan_section_for_stubs): New method declaration.
7501 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
7502 Change methods from private to protected.
7503 (Target_arm::do_may_relax): New method definition.
7504 (Target_arm::do_relax, Target_arm::group_sections,
7505 Target_arm::scan_reloc_for_stub,
7506 Target_arm::scan_reloc_section_for_stubs): New method declarations.
7507 (Target_arm::arm_input_section_map_): New data member declaration.
7508 (Target_arm::scan_reloc_for_stub,
7509 Target_arm::scan_reloc_section_for_stubs,
7510 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
7511 Target_arm::do_relax): New method definitions.
7513 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
7515 * configure.ac: Check for (struct stat)::st_mtim
7516 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
7517 * config.in: Regenerate.
7518 * configure: Regenerate.
7520 2009-11-05 Ian Lance Taylor <iant@google.com>
7523 * output.cc (Output_segment::add_output_section): Add missing
7526 2009-11-04 Ian Lance Taylor <iant@google.com>
7529 * object.h (class Object): Add is_needed and set_is_needed
7530 methods. Add is_needed_ field. Make bool fields into bitfields.
7531 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
7532 defined in a dynamic object and referenced by a regular object,
7533 set is_needed for the dynamic object.
7534 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
7535 if the file is marked with as_needed and it is not needed.
7537 2009-11-04 Ian Lance Taylor <iant@google.com>
7540 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
7541 tags if data is discarded by linker script.
7542 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7543 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7544 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7545 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7547 2009-11-04 Ian Lance Taylor <iant@google.com>
7549 * layout.cc (Layout::get_output_section): Add is_interp and
7550 is_dynamic_linker_section parameters. Change all callers.
7551 (Layout::choose_output_section): Likewise.
7552 (Layout::make_output_section): Likewise.
7553 (Layout::add_output_section_data): Add is_dynamic_linker_section
7554 parameter. Change all callers.
7555 * layout.h (class Layout): Update declarations.
7556 * output.h (class Output_section): Add is_interp, set_is_interp,
7557 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
7558 Add is_interp_, is_dynamic_linker_section_ fields. Change
7559 generate_code_fills_at_write_ to a bitfield.
7560 * output.cc (Output_section::Output_sections): Initialize new
7562 (Output_segment::add_output_section): Add do_sort parameter.
7565 2009-11-03 Ian Lance Taylor <iant@google.com>
7568 * options.h (class General_options): Add --warn-common.
7569 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
7570 merging two common symbols.
7571 (Symbol_table::should_override): Handle --warn-common when merging
7572 a common symbol with a defined symbol. Use report_resolve_problem
7573 for multiple definitions.
7574 (Symbol_table::report_resolve_problem): New function.
7575 * symtab.h (class Symbol_table): Declare report_resolve_problem.
7577 2009-11-03 Doug Kwan <dougkwan@google.com>
7579 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
7581 (Target_arm::stub_factory): New method definition.
7582 (Target_arm::new_arm_input_section,
7583 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
7584 Target_arm::reloc_uses_thumb_bit): New method declarations.
7585 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
7586 New type definitions.
7587 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
7588 member declarations.
7589 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
7590 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
7591 New method definitions.
7593 2009-11-03 Ian Lance Taylor <iant@google.com>
7595 * options.h (class General_options): Add --warn_constructors.
7597 2009-11-03 Ian Lance Taylor <iant@google.com>
7600 * defstd.cc (in_section): Add entries for __rel_iplt_start,
7601 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
7603 2009-11-03 Ian Lance Taylor <iant@google.com>
7606 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
7607 --msgid-bugs-address.
7608 (install-pdf): New target.
7609 (install-data_yes): Look up one directory to find mkinstalldirs.
7611 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
7613 * po/Make-in (.po.gmo): Don't generate .gmo files in source
7616 2009-10-30 Doug Kwan <dougkwan@google.com>
7618 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
7620 2009-10-30 Doug Kwan <dougkwan@google.com>
7622 * arm.cc (Stub_addend_reader): New struct template definition
7623 and partial specializations.
7624 (Stub_addend_reader::operator()): New method definition for a
7625 partially specialized template.
7627 2009-10-30 Doug Kwan <dougkwan@google.com>
7629 * arm.cc (Arm_relobj::processor_specific_flags): New method
7631 (Arm_relobj::do_read_symbols): New method declaration.
7632 (Arm_relobj::processor_specific_flags_): New data member declaration.
7633 (Arm_dynobj): New class definition.
7634 (Target_arm::do_finalize_sections): Add input_objects parameter.
7635 (Target_arm::do_adjust_elf_header): New method declaration.
7636 (Target_arm::are_eabi_versions_compatible,
7637 (Target_arm::merge_processor_specific_flags): New method declaration.
7638 (Target_arm::do_make_elf_object): New overloaded method definitions
7640 (Arm_relobj::do_read_symbols): New method definition.
7641 (Arm_dynobj::do_read_symbols): Ditto.
7642 (Target_arm::do_finalize_sections): Add input_objects parameters.
7643 Merge processor-specific flags from all input objects.
7644 (Target_arm::are_eabi_versions_compatible,
7645 Target_arm::merge_processor_specific_flags,
7646 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
7647 New method definitions.
7648 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
7649 Input_objects pointer type parameter.
7650 * layout.cc (Layout::finalize): Pass input objects to target's.
7651 finalize_sections function.
7652 * output.cc (Output_file_header::do_sized_write): Set ELF file
7653 header's processor-specific flags.
7654 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
7655 Input_objects pointer type parameter.
7656 * sparc.cc (Target_sparc::do_finalize_sections): Same.
7657 * target.h (Input_objects): New forward class declaration.
7658 (Target::processor_specific_flags,
7659 Target::are_processor_specific_flags_sect): New method definitions.
7660 (Target::finalize_sections): Add input_objects parameter.
7661 (Target::Target): Initialize processor_specific_flags_ and
7662 are_processor_specific_flags_set_.
7663 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
7665 (Target::set_processor_specific_flags): New method definition.
7666 (Target::processor_specific_flags_,
7667 Target::are_processor_specific_flags_set_): New data member
7669 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
7670 Input_objects pointer type parameter.
7672 2009-10-30 Doug Kwan <dougkwan@google.com>
7674 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
7676 2009-10-28 Ian Lance Taylor <iant@google.com>
7678 * object.h (class Relobj): Drop options parameter from
7679 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
7680 do_scan_relocs, do_relocate. Change all callers.
7681 (class Sized_relobj): Drop options parameters from
7682 do_gc_process_relocs, do_scan_relocs, do_relocate,
7683 do_relocate_sections, relocate_sections, emit_relocs_scan,
7684 emit_relocs_scan_reltype. Change all callers.
7685 (struct Relocate_info): Remove options field and all references to
7687 * reloc.h (class Read_relocs): Remove options constructor
7688 parameter and options_ field. Change all callers.
7689 (class Gc_process_relocs, class Scan_relocs): Likewise.
7690 (class Relocate_task): Likewise.
7691 * target-reloc.h (scan_relocs): Remove options parameter. Change
7693 (scan_relocatable_relocs): Likewise.
7694 * target.h (class Sized_target): Remove options parameter from
7695 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
7697 * gc.h (gc_process_relocs): Remove options parameter. Change all
7699 * arm.cc: Update functions to remove options parameters.
7700 * i386.cc: Likewise.
7701 * powerpc.cc: Likewise.
7702 * sparc.cc: Likewise.
7703 * x86_64.cc: Likewise.
7704 * testsuite/testfile.cc: Likewise.
7706 2009-10-28 Doug Kwan <dougkwan@google.com>
7708 * arm.cc (Arm_relobj): New class definition.
7709 (Arm_relobj::scan_sections_for_stubs,
7710 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
7711 New method definitions.
7713 2009-10-28 Cary Coutant <ccoutant@google.com>
7715 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
7716 (Plugin::cleanup_done_): New member.
7717 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
7718 (Plugin_manager::cleanup_done_): Remove.
7719 (Plugin_manager::add_input_file): Edit error message.
7720 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
7721 (Plugin_manager::cleanup): Remove use of cleanup_done_.
7723 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
7725 * fileread.cc: (File_read::View::~View): Use the new
7726 data_ownership_ filed.
7727 (File_read::~File_read): Dispose the new whole_file_view_.
7728 (File_read::open): Mmap the whole file if needed.
7729 (File_read::open): Use whole_file_view_ instead of contents_.
7730 (File_read::find_view): Use whole_file_view_ if applicable.
7731 (File_read::do_read): Use whole_file_view_ instead of contents_.
7732 (File_read::make_view): Use whole_file_view_ instead of contents_,
7733 update File_read::View::View call.
7734 (File_read::find_or_make_view): Update File_read::View::View
7736 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
7738 (File_read::View::Data_ownership): New enum.
7739 (File_read::View::View): Replace bool mapped_ with Data_ownership
7741 (File_read::View::mapped_): Remove (replaced by data_ownership_).
7742 (File_read::View::data_ownership_): New field.
7743 (File_read::contents_): Remove (replaced by whole_file_view_).
7744 (File_read::whole_file_view_): New field.
7745 * options.h (class General_options): Add --keep-files-mapped.
7747 2009-10-27 Cary Coutant <ccoutant@google.com>
7749 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
7750 * testsuite/Makefile.am (plugin_test_5): New test case.
7751 * testsuite/Makefile.in: Regenerate.
7753 2009-10-25 Doug Kwan <dougkwan@google.com>
7755 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
7756 from private to protected to allow access by child class.
7757 (Sized_relobj::do_relocate_sections): New method declaration.
7758 (Sized_relobj::relocate_sections): Virtualize.
7759 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
7760 Sized_relobj::relocate_sections. Instantiate template explicitly
7761 for different target sizes and endianity.
7763 2009-10-24 Doug Kwan <dougkwan@google.com>
7765 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
7766 (Arm_input_section::as_arm_input_section): New method.
7767 (Arm_output_section): New class definition.
7768 (Arm_output_section::create_stub_group,
7769 Arm_output_section::group_sections): New method definitions.
7771 2009-10-22 Doug Kwan <dougkwan@google.com>
7773 * arm.cc (Arm_input_section): New class definition.
7774 (Arm_input_section::init, Arm_input_section:do_write,
7775 Arm_input_section::set_final_data_size,
7776 Arm_input_section::do_reset_address_and_file_offset): New method
7779 2009-10-21 Doug Kwan <dougkwan@google.com>
7781 * arm.cc (Stub_table, Arm_input_section): New forward class
7783 (Stub_table): New class defintion.
7784 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
7785 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
7786 New method definition.
7788 2009-10-21 Doug Kwan <dougkwan@google.com>
7790 * arm.cc: Update copyright comments.
7791 (Target_arm): New forward class template declaration.
7792 (Arm_address): New type.
7793 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
7794 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
7795 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
7797 (Insn_template): Same.
7798 (DEF_STUBS): New macro.
7799 (Stub_type): New enum type.
7800 (Stub_template): New class definition.
7803 (Stub_factory): Same.
7804 (Target_arm::Target_arm): Initialize may_use_blx_ and
7805 should_force_pic_veneer_.
7806 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
7807 Target_arm::should_force_pic_veneer,
7808 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
7809 Target_arm::using_thumb_only, Target_arm:;default_target): New
7811 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
7812 New data member declarations.
7813 (Insn_template::size, Insn_template::alignment): New method defintions.
7814 (Stub_template::Stub_template): New method definition.
7815 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
7816 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
7817 (Stub_factory::Stub_factory): New method definition.
7818 * gold.h (string_hash): New template.
7819 * output.h (Input_section_specifier::hash_value): Use
7821 (Input_section_specifier::string_hash): Remove.
7822 * stringpool.cc (Stringpool_template::string_hash): Use
7825 2009-10-20 Doug Kwan <dougkwan@google.com>
7827 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
7828 symbols of relaxed input sections.
7829 * output.h (Output_section::find_relaxed_input_section): Make
7832 2009-10-16 Doug Kwan <dougkwan@google.com>
7834 * dynobj.cc (Versions::Versions): Initialize version_script_.
7835 Only insert base version symbol definition for a shared object
7836 if version script defines any version versions.
7837 (Versions::define_base_version): New method definition.
7838 (Versions::add_def): Check that base version is not needed.
7839 (Versions::add_need): Define base version lazily.
7840 * dynobj.h (Versions::define_base_version): New method declaration.
7841 (Versions::needs_base_version_): New data member declaration.
7842 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
7843 (check_DATA): Add no_version_test.stdout.
7844 (libno_version_test.so, no_version_test.o no_version_test.stdout):
7846 * testsuite/Makefile.in: Regenerate.
7847 * testsuite/no_version_test.c: New file.
7848 * testsuite/no_version_test.sh: Ditto.
7850 2009-10-16 Doug Kwan <dougkwan@google.com>
7852 * expression.cc (class Segment_start_expression): New class definition.
7853 (Segment_start_expression::value): New method definition.
7854 (script_exp_function_segment_start): Return a new
7855 Segment_start_expression.
7856 * gold/script-c.h (script_saw_segment_start_expression): New function
7858 * script-sections.cc (Script_sections::Script_sections): Initialize
7859 SAW_SEGMENT_START_EXPRESSION_ to false.
7860 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
7861 and -Tbbs options to specify section addresses if given in
7862 command line and no SEGMENT_START expression is seen in a script.
7863 * script-sections.h (Script_sections::saw_segment_start_expression,
7864 Script_sections::set_saw_segment_start_expression): New method
7866 (Script_sections::saw_segment_start_expression_): New data member
7868 * script.cc (script_saw_segment_start_expression): New function.
7869 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
7870 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
7871 script_test_7.sh and script_test_8.sh.
7872 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
7873 script_test_8.stdout.
7874 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
7875 (script_test_6, script_test_6.stdout, script_test_7,
7876 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
7877 * Makefile.in: Regenerate.
7878 * testsuite/script_test_6.sh: New file.
7879 * testsuite/script_test_6.t: Same.
7880 * testsuite/script_test_7.sh: Same.
7881 * testsuite/script_test_7.t: Same.
7882 * testsuite/script_test_8.sh: Same.
7884 2009-10-16 Doug Kwan <dougkwan@google.com>
7886 * output.cc (Output_segment::set_section_list_address): Cast
7887 expressions to unsigned long long type to avoid format warnings.
7889 2009-10-15 Ian Lance Taylor <iant@google.com>
7891 * script.cc (Script_options::add_symbol_assignment): Always add a
7892 dot assignment to script_sections_.
7893 * script-sections.cc (Script_sections::add_dot_assignment):
7894 Initialize if necessary.
7896 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
7897 program headers with no load segment if there is a linker script.
7899 * layout.cc (Layout::set_segment_offsets): Align the file offset
7900 to the segment aligment for -N or -n with no load segment.
7901 * output.cc (Output_segment::add_output_section): Don't crash if
7902 the first section is a TLS section.
7903 (Output_segment::set_section_list_addresses): Print an error
7904 message if the address moves backward in a linker script.
7905 * script-sections.cc
7906 (Output_section_element_input::set_section_addresses): Don't
7907 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
7908 (Orphan_output_section::set_section_addresses): Likewise.
7910 2009-10-15 Doug Kwan <dougkwan@google.com>
7912 * layout.cc (Layout::finish_dynamic_section): Generate tags
7913 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
7914 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
7915 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
7917 2009-10-14 Ian Lance Taylor <iant@google.com>
7919 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
7921 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
7922 data_shdr fields of relinfo.
7923 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
7924 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
7925 R_386_TLS_LDO_32, adjust based on section flags.
7926 (Target_i386::Relocate::fix_up_ldo): Remove.
7928 2009-10-13 Ian Lance Taylor <iant@google.com>
7930 Add support for -pie.
7931 * options.h (class General_options): Add -pie and
7933 (General_options::output_is_position_independent): Test -pie.
7934 (General_options::output_is_executable): Return true if not shared
7935 and not relocatable.
7936 (General_options::output_is_pie): Remove.
7937 * options.cc (General_options::finalize): Reject incompatible uses
7939 * gold.cc (queue_middle_tasks): A -pie link is not static.
7940 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
7941 * symtab.cc (Symbol::final_value_is_known): Return false if
7942 output_is_position_independent.
7943 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
7944 output_is_position_independent.
7945 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
7946 output_is_position_independent.
7947 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
7948 output_is_position_independent.
7949 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
7951 (basic_pie_test.o, basic_pie_test): New targets.
7952 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
7953 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
7954 (two_file_pie_test): New target.
7955 * testsuite/Makefile.in: Rebuild.
7956 * README: Remove note saying that -pie is not supported.
7958 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
7960 * options.h (class General_options): Add -init and -fini.
7961 * layout.cc (Layout::finish_dynamic_section): Emit
7962 given init and fini functions.
7964 2009-10-13 Sriraman Tallam <tmsriram@google.com>
7966 * gc.h (gc_process_relocs): Check if icf is enabled using new
7968 * gold.cc (queue_initial_tasks): Likewise.
7969 (queue_middle_tasks): Likewise.
7970 * object.cc (do_layout): Likewise.
7971 * symtab.cc (is_section_folded): Likewise.
7972 * main.cc (main): Likewise.
7973 * reloc.cc (Read_relocs::run): Likewise.
7974 (Sized_relobj::do_scan_relocs): Likewise.
7975 * icf.cc (is_function_ctor_or_dtor): New function.
7976 (Icf::find_identical_sections): Check if function is ctor or dtor when
7978 * options.h (General_options::icf): Change option to be an enum.
7979 (Icf_status): New enum.
7980 (icf_enabled): New method.
7981 (icf_safe_folding): New method.
7982 (set_icf_status): New method.
7983 (icf_status_): New variable.
7984 * (options.cc) (General_options::finalize): Set icf_status_.
7985 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
7986 icf_test and icf_keep_unique_test to use the --icf enum flag.
7987 * testsuite/icf_safe_test.sh: New file.
7988 * testsuite/icf_safe_test.cc: New file.
7990 2009-10-12 Sriraman Tallam <tmsriram@google.com>
7992 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
7993 includes to gc.h and icf.h.
7994 * arm.cc: Include gc.h.
7995 * gold.cc: Likewise.
7996 * i386.cc: Likewise.
7997 * powerpc.cc: Likewise.
7998 * sparc.cc: Likewise.
7999 * x86_64.cc: Likewise.
8000 * gc.h: Include icf.h.
8002 2009-10-11 Ian Lance Taylor <iant@google.com>
8004 * plugin.cc: Include "gold.h" before other header files.
8006 2009-10-10 Chris Demetriou <cgd@google.com>
8008 * options.h (Input_file_argument::Input_file_type): New enum.
8009 (Input_file_argument::is_lib_): Replace with...
8010 (Input_file_argument::type_): New member.
8011 (Input_file_argument::Input_file_argument): Take Input_file_type
8012 'type' rather than boolean 'is_lib' as second argument.
8013 (Input_file_argument::is_lib): Use type_.
8014 (Input_file_argument::is_searched_file): New function.
8015 (Input_file_argument::may_need_search): Handle is_searched_file.
8016 * options.cc (General_options::parse_library): Support -l:filename.
8017 (General_options::parse_just_symbols): Update for Input_file_argument
8019 (Command_line::process): Likewise.
8020 * archive.cc (Archive::get_file_and_offset): Likewise.
8021 * plugin.cc (Plugin_manager::release_input_file): Likewise.
8022 * script.cc (read_script_file, script_add_file): Likewise.
8023 * fileread.cc (Input_file::Input_file): Likewise.
8024 (Input_file::will_search_for): Handle is_searched_file.
8025 (Input_file::open): Likewise.
8026 * readsyms.cc (Read_symbols::get_name): Likewise.
8027 * testsuite/Makefile.am (searched_file_test): New test.
8028 * testsuite/Makefile.in: Regenerate.
8029 * testsuite/searched_file_test.cc: New file.
8030 * testsuite/searched_file_test_lib.cc: New file.
8032 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8033 Ian Lance Taylor <iant@google.com>
8035 * descriptor.cc: Include <cstdio> and "binary-io.h".
8036 (Descriptors::open): Open the files in binary mode always.
8037 * script.cc (Lex::get_token): Treat \r as whitespace.
8039 2009-10-09 Ian Lance Taylor <iant@google.com>
8041 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
8043 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8044 Ian Lance Taylor <iant@google.com>
8046 * configure.ac: Check for readv function also.
8047 * fileread.cc (readv): Define if not HAVE_READV.
8048 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
8050 * config.in: Regenerate.
8051 * configure: Regenerate.
8053 2009-10-09 Doug Kwan <dougkwan@google.com>
8055 * layout.cc (Layout::make_output_section): Call target hook to make
8056 ordinary output section.
8057 (Layout::finalize): Adjust parameter list of call the
8058 Target::may_relax().
8059 * layout.h (class Layout::section_list): New method.
8060 * merge.h (Output_merge_base::entsize): Change visibility to public.
8061 (Output_merge_base::is_string, Output_merge_base::do_is_string):
8063 (Output_merge_string::do_is_string): New method.
8064 * object.cc (Sized_relobj::do_setup): renamed from
8065 Sized_relobj::set_up.
8066 * object.h (Sized_relobj::adjust_shndx,
8067 Sized_relobj::initializ_input_to_output_maps,
8068 Sized_relobj::free_input_to_output_maps): Change visibilities to
8070 (Sized_relobj::setup): Virtualize.
8071 (Sized_relobj::do_setup): New method declaration.
8072 (Sized_relobj::invalidate_section_offset,
8073 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
8074 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
8075 * options.cc (parse_int): New function.
8076 * options.h (parse_int): New declaration.
8077 (DEFINE_int): New macro.
8078 (stub_group_size): New option.
8079 * output.cc (Output_section::Output_section): Initialize memebers
8080 merge_section_map_, merge_section_by_properties_map_,
8081 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
8082 (Output_section::add_input_section): Handled deferred code-fill
8083 generation and remove an old comment.
8084 (Output_section::add_relaxed_input_section): New method definition.
8085 (Output_section::add_merge_input_section): Use merge section by
8086 properties map to speed to search. Update merge section maps
8088 (Output_section::build_relaxation_map): New method definition.
8089 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8091 (Output_section::relax_input_section): Renamed to
8092 Output_section::convert_input_sections_to_relaxed_sections and change
8093 interface to take a vector of pointers to relaxed sections.
8094 (Output_section::find_merge_section,
8095 Output_section::find_relaxed_input_section): New method definitions.
8096 (Output_section::is_input_address_mapped,
8097 Output_section::output_offset, Output_section::output_address):
8098 Use output section data maps to speed up searching.
8099 (Output_section::find_starting_output_address): Add comments.
8100 (Output_section::do_write,
8101 Output_section::write_to_postprocessing_buffer): Do code-fill
8102 generation as appropriate.
8103 (Output_section::get_input_sections): Invalidate relaxed input section
8105 (Output_section::restore_states): Adjust type of checkpoint .
8106 Invalidate relaxed input section map.
8107 * output.h (Output_merge_base): New class declaration.
8108 (Input_section_specifier): New class defintion.
8109 (class Output_relaxed_input_section) Change base class to
8110 Output_section_data_build.
8111 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
8112 base class initializer.
8113 (Output_section::add_relaxed_input_section): New method declaration.
8114 (Output_section::Input_section): Change visibility to protected.
8115 (Output_section::Input_section::relobj,
8116 Output_section::Input_section::shndx): Handle relaxed input sections.
8117 Output_section::input_sections) Change visibility to protected. Also
8118 define overload to return a non-const pointer.
8119 (Output_section::Merge_section_properties): New class defintion.
8120 (Output_section::Merge_section_by_properties_map,
8121 Output_section::Output_section_data_by_input_section_map,
8122 Output_section::Relaxation_map): New types.
8123 (Output_section::relax_input_section): Rename method to
8124 Output_section::convert_input_sections_to_relaxed_sections and change
8125 interface to take a vector of relaxed section pointers.
8126 (Output_section::find_merge_section,
8127 Output_section::find_relaxed_input_section,
8128 Output_section::build_relaxation_map,
8129 Output_section::convert_input_sections_in_list_to_relaxed_sections):
8130 New method declarations.
8131 (Output_section::merge_section_map_
8132 Output_section::merge_section_by_properties_map_,
8133 Output_section::relaxed_input_section_map_,
8134 Output_section::is_relaxed_input_section_map_valid_,
8135 Output_section::generate_code_fills_at_write_): New data members.
8136 * script-sections.cc
8137 (Output_section_element_input::set_section_addresses): Call
8138 current_data_size and addralign methods of relaxed input sections.
8139 (Orphan_output_section::set_section_addresses): Call current_data_size
8140 and addralign methods of relaxed input sections.
8141 * symtab.cc (Symbol_table::compute_final_value): Extract template
8142 from the body of Symbol_table::sized_finalize_symbol.
8143 (Symbol_table::sized_finalized_symbol): Call
8144 Symbol_table::compute_final_value.
8145 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
8146 (Symbol_table::compute_final_value): New templated method declaration.
8147 * target.cc (Target::do_make_output_section): New method defintion.
8148 * target.h (Target::make_output_section): New method declaration.
8149 (Target::relax): Add more parameters for input objects, symbol table
8150 and layout. Adjust call to do_relax.
8151 (Target::do_make_output_section): New method declaration.
8152 (Target::do_relax): Add parameters for input objects, symbol table
8155 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8157 * pread.c: Include stdio.h.
8159 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8161 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
8164 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8166 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8167 Change read_shndx type to unsigned int.
8168 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8170 (Sized_dwarf_line_info::read_line_mappings): Likewise.
8171 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
8172 Change read_shndx type to unsigned int.
8173 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8175 (Sized_dwarf_line_info::read_line_mappings): Likewise.
8176 * layout.cc (Layout::create_symtab_sections): Cast the result of
8177 local_symcount * symsize to off_t in the gold_assert.
8179 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8181 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
8182 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
8184 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
8185 (Arm_relocate_functions::thm_abs5): New function.
8186 (Arm_relocate_functions::abs12): New function.
8187 (Arm_relocate_functions::abs16): New function.
8188 (Arm_relocate_functions::base_abs): New function.
8189 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
8190 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
8191 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
8193 (Scan::global): Likewise.
8194 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
8195 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
8196 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
8197 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
8200 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8202 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
8203 (Arm_relocate_functions::movt_prel): New function.
8204 (Arm_relocate_functions::thm_movw_prel_nc): New function.
8205 (Arm_relocate_functions::thm_movt_prel): New function.
8206 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8207 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8208 (Scan::global, Relocate::relocate): Likewise.
8209 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8211 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8213 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8214 Incremental_checker.
8215 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8217 (class Incremental_inputs_header): New class.
8218 (Incremental_inputs_header_writer): Edit comment.
8219 (Incremental_inputs_entry): New class.
8220 (Incremental_inputs_entry_writer): Edit comment.
8221 (Sized_incremental_binary::do_find_incremental_inputs_section):
8222 Add *strtab_shndx parameter, fill it.
8223 (Sized_incremental_binary::do_check_inputs): New method.
8224 (Incremental_checker::can_incrementally_link_output_file): Use
8225 Sized_incremental_binary::check_inputs.
8226 (Incremental_inputs::report_command_line): Save command line in
8229 (Incremental_binary::find_incremental_inputs_section): New
8231 (Incremental_binary::do_find_incremental_inputs_section): Add
8232 strtab_shndx parameter.
8233 (Incremental_binary::do_check_inputs): New pure virtual method.
8234 (Sized_incremental_binary::do_check_inputs): Declare.
8235 (Incremental_checker::Incremental_checker): Add incremental_inputs
8236 parameter, use it to initialize incremental_inputs_.
8237 (Incremental_checker::incremental_inputs_): New field.
8238 (Incremental_checker::command_line): New method.
8239 (Incremental_checker::inputs): New method.
8240 (Incremental_checker::command_line_): New field.
8242 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8244 * incremental.cc: Include <cstdarg> and "target-select.h".
8245 (vexplain_no_incremental): New function.
8246 (explain_no_incremental): New function.
8247 (Incremental_binary::error): New method.
8248 (Sized_incremental_binary::do_find_incremental_inputs_section): New
8250 (make_sized_incremental_binary): New function.
8251 (open_incremental_binary): New function.
8252 (can_incrementally_link_file): Add checks if output is ELF and has
8254 * incremental.h: Include "elfcpp_file.h" and "output.h".
8255 (Incremental_binary): New class.
8256 (Sized_incremental_binary): New class.
8257 (open_incremental_binary): Declare.
8258 * object.cc (is_elf_object): Use
8259 elfcpp::Elf_recognizer::is_elf_file.
8260 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
8261 * output.h (Output_file::filesize): New method.
8263 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8265 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
8267 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
8268 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
8270 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
8272 (Arm_relocate_functions::movw_abs_nc): New function.
8273 (Arm_relocate_functions::movt_abs): New function.
8274 (Arm_relocate_functions::thm_movw_abs_nc): New function.
8275 (Arm_relocate_functions::thm_movt_abs): New function.
8276 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
8277 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
8278 (Scan::global): Likewise.
8279 (Relocate::relocate): Likewise.
8280 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8282 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8284 * arm.cc (Arm_relocate_functions::got_prel) New function.
8285 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
8286 (Relocate::relocate): Likewise.
8287 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8289 2009-10-06 Ian Lance Taylor <iant@google.com>
8291 * options.h (class General_options): Define
8292 split_stack_adjust_size parameter.
8293 * object.h (class Object): Add uses_split_stack_ and
8294 has_no_split_stack_ fields. Add uses_split_stack and
8295 has_no_split_stack accessor functions. Declare
8296 handle_split_stack_section.
8297 (class Reloc_symbol_changes): Define.
8298 (class Sized_relobj): Define Function_offsets. Declare
8299 split_stack_adjust, split_stack_adjust_reltype, and
8301 * object.cc (Object::handle_split_stack_section): New function.
8302 (Sized_relobj::do_layout): Call handle_split_stack_section.
8303 * dynobj.cc (Sized_dynobj::do_layout): Call
8304 handle_split_stack_section.
8305 * reloc.cc (Sized_relobj::relocate_sections): Call
8306 split_stack_adjust for executable sections in split_stack
8307 objects. Pass reloc_map to relocate_section.
8308 (Sized_relobj::split_stack_adjust): New function.
8309 (Sized_relobj::split_stack_adjust_reltype): New function.
8310 (Sized_relobj::find_functions): New function.
8311 * target-reloc.h: Include "object.h".
8312 (relocate_section): Add reloc_symbol_changes parameter. Change
8314 * target.h (class Target): Add calls_non_split method. Declare
8315 do_calls_non_split virtual method. Declare match_view and
8317 * target.cc: Include "elfcpp.h".
8318 (Target::do_calls_non_split): New function.
8319 (Target::match_view): New function.
8320 (Target::set_view_to_nop): New function.
8321 * gold.cc (queue_middle_tasks): Give an error if mixing
8322 split-stack and non-split-stack objects with -r.
8323 * i386.cc (Target_i386::relocate_section): Add
8324 reloc_symbol_changes parameter.
8325 (Target_i386::do_calls_non_split): New function.
8326 * x86_64.cc (Target_x86_64::relocate_section): Add
8327 reloc_symbol_changes parameter.
8328 (Target_x86_64::do_calls_non_split): New function.
8329 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
8331 * powerpc.cc (Target_powerpc::relocate_section): Add
8332 reloc_symbol_changes parameter.
8333 * sparc.cc (Target_sparc::relocate_section): Add
8334 reloc_symbol_changes parameter.
8335 * configure.ac: Call AM_CONDITIONAL for the default target.
8336 * configure: Rebuild.
8337 * testsuite/Makefile.am (TEST_AS): New variable.
8338 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
8339 (check_DATA): Add split_i386 and split_x86_64 files.
8340 (SPLIT_DEFSYMS): Define.
8341 (split_i386_[1234n].o): New targets.
8342 (split_i386_[124]): New targets.
8343 (split_i386_[1234r].stdout): New targets.
8344 (split_x86_64_[1234n].o): New targets.
8345 (split_x86_64_[124]): New targets.
8346 (split_x86_64_[1234r].stdout): New targets.
8347 (MOSTLYCLEANFILES): Add new executables.
8348 * testsuite/split_i386.sh: New file.
8349 * testsuite/split_x86_64.sh: New file.
8350 * testsuite/split_i386_1.s: New file.
8351 * testsuite/split_i386_2.s: New file.
8352 * testsuite/split_i386_3.s: New file.
8353 * testsuite/split_i386_4.s: New file.
8354 * testsuite/split_i386_n.s: New file.
8355 * testsuite/split_x86_64_1.s: New file.
8356 * testsuite/split_x86_64_2.s: New file.
8357 * testsuite/split_x86_64_3.s: New file.
8358 * testsuite/split_x86_64_4.s: New file.
8359 * testsuite/split_x86_64_n.s: New file.
8360 * testsuite/testfile.cc (Target_test): Update relocation_section
8362 * testsuite/Makefile.in: Rebuild.
8364 2009-10-06 Ian Lance Taylor <iant@google.com>
8366 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
8367 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
8368 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
8369 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
8370 the address on ldo_addrs_.
8371 (Target_i386::Relocate::fix_up_ldo): New function.
8373 2009-10-06 Rafael Espindola <espindola@google.com>
8375 * plugin.cc (add_input_library): New.
8376 (Plugin::load): Add add_input_library to tv.
8377 (Plugin_manager::add_input_file): Add the is_lib argument.
8378 (add_input_file): Update call to Plugin_manager::add_input_file.
8379 (add_input_library): New.
8380 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
8382 2009-09-30 Doug Kwan <dougkwan@google.com>
8384 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
8385 symbol and call Symbol::may_need_copy_reloc to determine if
8386 a copy reloc is needed.
8387 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
8388 nocopyreloc is given in command line.
8389 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
8390 given in command line.
8391 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
8392 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
8393 of the removed Target_i386::may_need_copy_reloc.
8394 * options.h (copyreloc): New option with default value false.
8395 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8396 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
8397 instead of the removed Target_powerpc::may_need_copy_reloc.
8398 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8399 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
8400 instead of the removed Target_sparc::may_need_copy_reloc.
8401 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
8402 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
8403 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
8404 instead of the removed Target_x86_64::may_need_copy_reloc.
8406 2009-09-30 Ian Lance Taylor <iant@google.com>
8408 * object.h (class Object): Remove target_ field, and target,
8409 sized_target, and set_target methods.
8410 (Object::sized_target): Remove.
8411 (class Sized_relobj): Update declarations. Remove sized_target.
8412 * object.cc (Sized_relobj::setup): Remove target parameter.
8414 (Input_objects::add_object): Don't do anything with the target.
8415 (make_elf_sized_object): Add punconfigured parameter. Change all
8416 callers. Set or test parameter target.
8417 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
8419 * parameters.cc (Parameters::set_target): Change parameter type to
8421 (Parameters::default_target): Remove.
8422 (set_parameters_target): Change parameter type to be non-const.
8423 (parameters_force_valid_target): New function.
8424 (parameters_clear_target): New function.
8425 * parameters.h (class Parameters): Update declarations. Remove
8426 default_target method. Add sized_target and clear_target
8427 methods. Change target_ to be non-const.
8428 (set_parameters_target): Update declaration.
8429 (parameters_force_valid_target): Declare.
8430 (parameters_clear_target): Declare.
8431 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
8432 as NULL if we aren't searching.
8433 (Add_symbols::run): Don't check for compatible target.
8434 * fileread.cc (Input_file::open_binary): Call
8435 parameters_force_valid_target.
8436 * gold.cc (queue_middle_tasks): Likewise.
8437 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
8438 set_target on object.
8439 * dynobj.h (class Sized_dynobj): Update declarations.
8440 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
8441 make_elf_object returns NULL.
8442 (Archive::include_member): Don't check whether object target is
8444 * output.cc (Output_section::add_input_section): Get target from
8446 (Output_section::relax_input_section): Likewise.
8447 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
8449 (Sized_relobj::do_scan_relocs): Likewise.
8450 (Sized_relobj::relocate_sections): Likewise.
8451 * resolve.cc (Symbol_table::resolve): Likewise.
8452 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
8453 parameter. Change all callers.
8454 (Symbol_table::add_from_object): Get target from parameters.
8455 (Symbol_table::add_from_relobj): Don't check object target.
8456 (Symbol_table::add_from_dynobj): Likewise.
8457 (Symbol_table::define_special_symbol): Get target from
8459 * symtab.h (class Symbol_table): Update declaration.
8460 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
8461 parameter. Change all callers. Clear parameter target.
8462 (Binary_test): Test target here.
8463 * testsuite/object_unittest.cc (gold_testsuite): Remove
8464 target_test_pointer parameter. Change all callers.
8465 (Object_test): Test target here.
8467 2009-09-26 Ian Lance Taylor <iant@google.com>
8469 * testsuite/initpri1.c: Don't try to use constructor priorities if
8470 compiling with gcc before 4.3.
8472 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
8474 * testsuite/retain_symbols_file_test.sh (check_present): Change
8475 output file name to retain_symbols_file_test.stdout.
8476 (check_absent): Likewise.
8478 2009-09-18 Craig Silverstein <csilvers@google.com>
8480 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
8481 * options.cc: Include <cerrno> and <fstream>.
8482 (General_options::finalize): Parse -retain-symbols-file tag.
8483 * options.h: New flag.
8484 (General_options): New method should_retain_symbol, new
8485 variable symbols_to_retain.
8486 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
8487 should_retain_symbol map.
8488 * testsuite/Makefile.am (retain_symbols_file_test): New test.
8489 * testsuite/Makefile.in: Regenerate.
8490 * testsuite/retain_symbols_file_test.sh: New file.
8492 2009-09-18 Nick Clifton <nickc@redhat.com>
8494 * po/es.po: Updated Spanish translation.
8496 2009-09-17 Doug Kwan <dougkwan@google.com>
8498 * debug.h (DEBUG_RELAXATION): New constant.
8499 (DEBUG_ALL): Add DEBUG_RELAXATION.
8500 (debug_string_to_enum): Add relaxation debug option.
8502 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
8503 Layout::Relaxation_debug_check::read_sections,
8504 Layout::Relaxation_debug_check::read_sections): New method definitions.
8505 (Layout::Layout): Initialize data members
8506 record_output_section_data_from_scrips_,
8507 script_output_section_data_list_ and relaxation_debug_check_.
8508 (Layout::save_segments, Layout::restore_segments,
8509 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8510 Layout::relaxation_loop_body): New method definitions.
8511 (Layout::finalize): Support relaxation. Move section layout code to
8512 Layout::relaxation_loop_body.
8513 (Layout::set_asection_address_from_script): Move code for orphan
8514 section placement out.
8515 (Layout::place_orphan_sections_in_script): New method definition.
8516 * layout.h (Output_segment_headers, Output_file_header):
8517 New forward class declarations.
8518 (Layout::~Layout): Define.
8519 (Layout::new_output_section_data_from_script): New method definition.
8520 (Layout::place_orphan_sections_in_script): New method declaration.
8521 (Layout::Segment_states): New type declaration.
8522 (Layout::save_segments, Layout::restore_segments,
8523 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8524 Layout::relaxation_loop_body): New method declarations.
8525 (Layout::Output_section_data_list): New type declaration.
8526 (Layout::Relaxation_debug_check): New class definition.
8527 (Layout::record_output_section_data_from_script_,
8528 Layout::script_output_section_data_list_, Layout::segment_states_,
8529 Layout::relaxation_debug_check_): New data members.
8530 * output.cc: (Output_section_headers::do_size): New method definition.
8531 (Output_section_headers::Output_section_headers): Move size
8532 computation to Output_section_headers::do_size.
8533 (Output_segment_headers::do_size): New method definition.
8534 (Output_file_header::Output_file_header): Move size computation to
8535 Output_file_header::do_size and call it.
8536 (Output_file_header::do_size): New method definition.
8537 (Output_data_group::Output_data_group): Adjust call to
8538 Output_section_data.
8539 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
8540 (Output_symtab_xindex::do_write): Add array bound check.
8541 (Output_section::Input_section::print_to_mapfile): Handle
8542 RELAXED_INPUT_SECTION_CODE.
8543 (Output_section::Output_section): Initialize data member checkpoint_.
8544 (Output_section::~Output_section): Delete checkpoint object pointed
8546 (Output_section::add_input_section): Always add an Input_section if
8548 (Output_section::add_merge_input_section): Add assert.
8549 (Output_section::relax_input_section): New method definition.
8550 (Output_section::set_final_data_size): Set load address to zero for
8551 an unallocated section.
8552 (Output_section::do_address_and_file_offset_have_reset_values):
8553 New method definition.
8554 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
8555 Handle relaxed input section.
8556 (Output_section::sort_attached_input_sections): Checkpoint input
8557 section list lazily.
8558 (Output_section::get_input_sections): Change type of input_sections to
8559 list of Simple_input_section pointers. Checkpoint input section list
8560 lazily. Also handle relaxed input sections.
8561 (Output_section::add_input_section_for_script): Take a reference to
8562 a Simple_input_section object instead of Relobj pointer and section
8563 index as parameter. Handle relaxed input sections.
8564 (Output_section::save_states, Output_section::restore_states): New
8566 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
8567 (Output_data::is_data_size_fixed): New method definition.
8568 (Output_data::reset_addresss_and_file_offset): Do not reset data size
8570 (Output_data::address_and_file_offset_have_reset_values): New method
8572 (Output_data::do_address_and_file_offset_have_reset_values): New method
8574 (Output_data::set_data_size): Check that data size is not fixed.
8575 (Output_data::fix_data_size): New method definition.
8576 (Output_data::is_data_size_fixed_): New data member.
8577 (Output_section_headers::set_final_data_size): New method definition.
8578 (Output_section_headers::do_size): New method declaration.
8579 (Output_segment_headers::set_final_data_size): New method definition.
8580 (Output_segment_headers::do_size): New method declaration.
8581 (Output_file_header::set_final_data_size)::New method definition.
8582 (Output_file_header::do_size)::New method declaration.
8583 (Output_section_data::Output_section_data): Add new parameter
8584 is_data_size_fixed and use it to fix data size.
8585 (Output_data_const::Output_data_const): Adjust call to base class
8586 constructor and fix data size.
8587 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
8588 base class constructor and fix data size.
8589 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
8590 base class constructor and fix data size.
8591 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
8592 class constructor and fix data size.
8593 (Output_data_group::set_final_data_size): New method definition.
8594 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
8595 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
8596 class constructor and fix data size.
8597 (Output_relaxed_input_section): New class definition.
8598 (Output_section::Simple_input_section): New class definition.
8599 (Output_section::get_input_sections): Adjust parameter list.
8600 (Output_section::add_input_section_for_script): Same.
8601 (Output_section::save_states, Output_section::restore_states,
8602 Output_section::do_address_and_file_offset_have_reset_values,
8603 (Output_section::Input_section::Input_section): Handle
8604 RELAXED_INPUT_SECTION_CODE. Add new overload for
8605 Output_relaxed_input_section.
8606 (Output_section::Input_section::is_input_section,
8607 Output_section::Input_section::set_output_section): Handle relaxed
8609 (Output_section::Input_section::is_relaxed_input_section,
8610 Output_section::Input_section::output_section_data,
8611 Output_section::Input_section::relaxed_input_section): New method
8613 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
8615 (Output_section::Input_section::u1_): Update comments.
8616 (Output_section::Input_section::u2_): Add new union member poris.
8617 (Output_section::Checkpoint_output_section): New classs definition.
8618 (Output_section::relax_input_section): New method declaration.
8619 (Output_section::checkpoint_): New data member.
8620 (Output_segment): Update comments.
8621 (Output_segment::Output_segment): Un-privatize copy constructor.
8622 (Output_segment::operator=): Un-privatize.
8623 * script-sections.cc (Output_section_element::Input_section_list):
8624 Change element type to Output_section::Simple_input_section.
8625 (Output_section_element_dot_assignment::set_section_addresses):
8626 Register output section data for relaxation clean up.
8627 (Output_data_exression::Output_data_expression): Adjust call to base
8628 constructor to fix data size.
8629 (Output_section_element_data::set_section_addresses): Register
8630 Output_data_expression object for relaxation clean up.
8631 (struct Input_section_info): Replace Relobj pointer and section index
8632 pair with Output_section::Simple_input_section and Convert struct to a
8634 (Input_section_sorter::operator()): Adjust access to
8635 Input_section_info data member to use accessors.
8636 (Output_section_element_input::set_section_addresses): Use layout
8637 parameter. Adjust code to use Output_section::Simple_input_section
8638 and Input_secction_info classes. Register filler for relaxation
8640 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
8641 and section index pair with Output_section::Simple_input_section
8642 class. Adjust code accordingly.
8643 (Phdrs_element::release_segment): New method definition.
8644 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
8646 (Script_sections::release_segments): New method definition.
8647 * gold/script-sections.h (Script_sections::release_segments): New
8649 * gold/target.h (Target::may_relax, Target::relax,
8650 Target::do_may_relax, Target::do_relax): New method definitions.
8652 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8654 * arm.cc (has_signed_unsigned_overflow): New function.
8655 (Arm_relocate_functions::abs8): New function.
8656 (Target_arm::Scan::local): Handle R_ARM_ABS8.
8657 (Target_arm::Scan::global): Likewise.
8658 (Target_arm::relocate::relocate): Likewise.
8659 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8662 2009-09-16 Cary Coutant <ccoutant@google.com>
8664 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
8665 * testsuite/Makefile.in: Regenerate.
8667 2009-09-11 Nick Clifton <nickc@redhat.com>
8669 * po/gold.pot: Updated by the Translation project.
8671 2009-09-08 Cary Coutant <ccoutant@google.com>
8673 * output.cc (Output_file::open): Add execute permission to empty file.
8674 * testsuite/Makefile.am (permission_test): New test.
8675 * testsuite/Makefile.in: Regenerate.
8677 2009-09-02 Ian Lance Taylor <iant@google.com>
8679 * output.cc (Output_file::resize): Call map_no_anonymous rather
8682 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
8684 * gold.cc: Include "incremental.h".
8685 (queue_initial_tasks): Call Incremental_checker methods.
8686 * incremental.cc: Include "output.h".
8687 (Incremental_checker::can_incrementally_link_output_file): New
8689 * incremental.h (Incremental_checker): New class.
8691 * output.cc (Output_file::open_for_modification): New method.
8692 (Output_file::map_anonymous): Changed return type to bool. Record
8694 (Output_file::map_no_anonymous): New method, broken out of map.
8695 (Output_file::map): Use map_no_anonymous and map_anonymous.
8696 * output.h (class Output_file): Update declarations.
8698 2009-08-24 Cary Coutant <ccoutant@google.com>
8700 * options.h (Command_line::Pre_options): New class.
8701 (Command_line::pre_options): New member.
8702 * options.cc (gold::options::ready_to_register): New variable.
8703 (One_option::register_option): Do nothing if not registering options.
8704 Assert if same short option registered twice.
8705 (General_options::General_options): Turn off option registration when
8707 (Command_line::Pre_options::Pre_options): New constructor.
8709 2009-08-24 Cary Coutant <ccoutant@google.com>
8711 * options.h (General_options::no_keep_memory): Remove incorrect
8714 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8716 * Makefile.am (am__skiplex, am__skipyacc): New.
8717 * Makefile.in: Regenerate.
8719 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8721 * Makefile.am (AM_CPPFLAGS): Renamed from ...
8722 (INCLUDES): ... this.
8723 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
8724 (AM_CPPFLAGS): Renamed from ...
8725 (INCLUDE): ... this.
8726 * Makefile.in, testsuite/Makefile.in: Regenerate.
8728 * Makefile.in: Regenerate.
8729 * aclocal.m4: Likewise.
8730 * config.in: Likewise.
8731 * configure: Likewise.
8732 * testsuite/Makefile.in: Likewise.
8734 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8735 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8736 * Makefile.in: Regenerate.
8737 * testsuite/Makefile.in: Regenerate.
8739 2009-08-19 Cary Coutant <ccoutant@google.com>
8741 * resolve.cc (Symbol_table::resolve): Don't complain about defined
8742 symbols in shared libraries overridden by hidden or internal symbols
8743 in the main program.
8745 2009-08-19 Chris Demetriou <cgd@google.com>
8747 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
8748 checking source file names in error messages.
8750 2009-08-18 Doug Kwan <dougkwan@google.com>
8752 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
8753 an elcpp::Ehdr as parameter. Adjust call to set_target.
8754 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
8755 an elfcpp::Ehdr as parameter.
8756 * object.cc (Object::set_target): Remove the version that looks up
8757 a target and sets it.
8758 (Sized_relobj::setup): Take a Target object instead of
8759 an elfcpp::Ehdr as parameter. Adjust call to set_target.
8760 (make_elf_sized_object): Find target and ask target to
8762 * object.h: (Object::set_target): Remove the version that looks up
8763 a target and sets it.
8764 (Sized_relobj::setup): Take a Target object instead of
8765 an elfcpp:Ehdr as parameter.
8766 * target.cc: Include dynobj.h.
8767 (Target::do_make_elf_object_implementation): New.
8768 (Target::do_make_elf_object): New.
8769 * target.h (Target::make_elf_object): New template declaration.
8770 (Target::do_make_elf_object): New method declarations.
8771 (Target::do_make_elf_object_implementation): New template declaration.
8773 2009-08-14 Ian Lance Taylor <iant@google.com>
8775 * gold.h (FUNCTION_NAME): Define.
8776 (gold_unreachable): Use FUNCTION_NAME.
8778 2009-08-12 Sriraman Tallam <tmsriram@google.com>
8780 * icf.cc (Icf::find_identical_sections): Issue a warning when a
8781 symbol in the --keep-unique list is not found.
8783 2009-08-12 Sriraman Tallam <tmsriram@google.com>
8785 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
8786 been maked as --keep-unique.
8787 (Icf::unfold_section): New function.
8788 * icf.h (Icf::unfold_section): New function.
8789 * options.h (General_options::keep_unique): New option.
8790 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
8791 * testsuite/Makefile.in: Regenerate.
8792 * testsuite/icf_keep_unique_test.sh: New file.
8793 * testsuite/icf_keep_unique_test.cc: New file.
8795 2009-08-12 Cary Coutant <ccoutant@google.com>
8798 * resolve.cc (Symbol_table::resolve): Check for references from
8799 dynamic objects to hidden and internal symbols.
8800 * testsuite/Makefile.am (hidden_test.sh): New test.
8801 * testsuite/Makefile.in: Regenerate.
8802 * testsuite/hidden_test.sh: New script.
8803 * testsuite/hidden_test_1.c: New test source.
8804 * testsuite/hidden_test_main.c: New test source.
8806 2009-08-11 Doug Kwan <dougkwan@google.com>
8808 * arm.cc: Update comments.
8809 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
8810 segment to locate the .ARM.exidx section if present.
8812 2009-08-09 Doug Kwan <dougkwan@google.com>
8814 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
8817 2009-08-07 Sriraman Tallam <tmsriram@google.com>
8818 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
8821 2009-08-06 Sriraman Tallam <tmsriram@google.com>
8823 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
8824 valid tls_segment only for non-debug-section relocations.
8825 * testsuite/Makefile.am: Add gc_tls_test.
8826 * testsuite/Makefile.in: Regenerate.
8827 * testsuite/gc_tls_test.cc: New file.
8828 * testsuite/gc_tls_test.sh: New file.
8830 2009-08-05 Sriraman Tallam <tmsriram@google.com>
8834 * Makefile.am (CCFILES): Add icf.cc.
8836 * Makefile.in: Regenerate.
8837 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
8838 * gc.h (gc_process_relocs): Populate lists used by icf to contain
8839 section, symbol and addend information for the relocs.
8840 * gold.cc (queue_middle_tasks): Call identical code folding.
8841 * gold.h: Add defines for multimap.
8842 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
8843 to the call of finalize_local_symbols.
8844 * main.cc (main): Create object of class Icf.
8845 * object.cc (Sized_relobj::do_layout): Allow this function to be
8846 called twice during icf.
8847 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
8848 to sections marked as identical by icf.
8849 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
8851 (Sized_relobj::do_section_entsize): New function.
8852 * object.h (Object::section_entsize): New function.
8853 (Object::do_section_entsize): New pure virtual function.
8854 (Relobj::finalize_local_symbols): Add new parameter.
8855 (Relobj::do_section_entsize): New function.
8856 * options.h (General_options::icf): New option.
8857 (General_options::icf_iterations): New option.
8858 (General_options::print_icf_sections): New option.
8859 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
8860 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
8861 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
8863 * symtab.cc (Symbol_table::is_section_folded): New function.
8864 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
8865 to sections marked as identical by icf.
8866 * symtab.h (Symbol_table::set_icf): New function.
8867 (Symbol_table::icf): New function.
8868 (Symbol_table::is_section_folded): New function.
8869 (Symbol_table::icf_): New data member.
8870 * target-reloc.h (relocate_section): Ignore sections folded by icf.
8871 * testsuite/Makefile.am: Add commands to build icf_test.
8872 * testsuite/Makefile.in: Regenerate.
8873 * testsuite/icf_test.sh: New file.
8874 * testsuite/icf_test.cc: New file.
8876 2009-07-24 Chris Demetriou <cgd@google.com>
8878 * layout.cc (is_compressible_debug_section): Fix incorrect
8879 comment about compressed section names.
8881 2009-07-20 Ian Lance Taylor <ian@airs.com>
8884 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
8886 2009-07-16 Ian Lance Taylor <iant@google.com>
8889 * layout.h: #include <map>.
8890 (class Kept_section): Change from struct to class. Add accessors
8891 and setters. Add section size to Comdat_group mapping. Change
8892 Comdat_group to std::map. Add is_comdat_ field. Add
8893 linkonce_size field in union.
8894 (class Layout): Update declaration of find_or_add_kept_section.
8895 Don't declare find_kept_object.
8896 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
8897 parameter. Add object, shndx, is_comdat, and is_group_name
8898 parameters. Change all callers. Adjust for new Kept_section.
8899 (Layout::find_kept_object): Remove.
8900 * object.cc (Sized_relobj::include_section_group): Update use of
8901 Kept_section. Rename secnum to shndx. Only record
8902 Kept_comdat_section if sections are the same size.
8903 (Sized_relobj::include_linkonce_section): Update use of
8904 Kept_section. Only record Kept_comdat_section if sections are the
8905 same size. Set size of linkonce section.
8906 (Sized_relobj::map_to_kept_section): Update call to
8907 get_kept_comdat_section.
8908 * object.h (class Sized_relobj): Rename fields in
8909 Kept_comdat_section to drop trailing underscores; change object
8910 field to Relobj*. Change Kept_comdat_section_table to store
8911 struct rather than pointer.
8912 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
8913 Add kept_object and kept_shndx parameters. Change all callers.
8914 (Sized_relobj::get_kept_comdat_section): Change return type to
8915 bool. Add kept_object and kept_shndx parameters. Change all
8917 * plugin.cc (Pluginobj::include_comdat_group): Update call to
8918 Layout::find_or_add_kept_section.
8920 2009-07-09 Ian Lance Taylor <iant@google.com>
8922 * merge.cc (Object_merge_map::initialize_input_to_output_map):
8923 Reserve space in the hash table.
8925 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
8927 * fileread.cc (File_read::get_mtime): New method.
8928 * fileread.h (Timespec): New structure.
8929 (File_read::get_mtime): New method.
8930 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
8931 Renamed from timestamp_nsec.
8932 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
8934 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
8936 (Incremental_inputs::report_archive): Save mtime; style fix.
8937 (Incremental_inputs::report_obejct): Save mtime; style fix.
8938 (Incremental_inputs::report_script): Save mtime; style fix.
8939 (Incremental_inputs::finalize_inputs): Style fix.
8940 (Incremental_inputs::finalize): Style fix.
8941 (Incremental_inputs::create_input_section_data): Store inputs
8943 * incremental.h (Incremental_inputs::report_script): Add mtime
8945 (Incremental_inputs::Input_info::Input_info): Intialize only one
8947 (Incremental_inputs::Input_info::archive): Move to nameless
8949 (Incremental_inputs::Input_info::obejct): Move to nameless union.
8950 (Incremental_inputs::Input_info::script): Move to nameless union.
8951 (Incremental_inputs::mtime): New field.
8952 * script.cc (read_input_script): Pass file mtime to
8954 * script.h (Script_info::inputs): Style fix.
8956 2009-07-01 Ian Lance Taylor <ian@airs.com>
8958 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
8961 2009-06-24 Ian Lance Taylor <iant@google.com>
8964 * layout.cc (Layout::choose_output_section): If we find an
8965 existing section, update the flags.
8966 (Layout::create_notes): New function, broken out of
8968 (Layout::finalize): Don't create note sections.
8969 (Layout::create_note): Don't crash if linker script discards
8971 (Layout::create_gold_note): Likewise.
8972 (Layout::create_build_id): Likewise. Don't set
8973 after_input_sections on the section.
8974 (Layout::create_executable_stack_info): Remove target parameter.
8976 * layout.h (class Layout): Declare create_notes. Update
8977 declaration of create_executable_stack_info.
8978 * gold.cc (queue_middle_tasks): Call create_notes.
8979 * output.cc (Output_section::update_flags_for_input_section): Move
8980 here from output.h. If SHF_ALLOC flag is newly set, mark address
8982 * output.h (Output_data::mark_address_invalid): New function.
8983 (class Output_section): Only declare, not define,
8984 update_flags_for_input_section. Remove set_flags.
8986 2009-06-24 Ian Lance Taylor <iant@google.com>
8988 * script-sections.cc (Output_section_definition::
8989 set_section_addresses): Rename shadowing local load_address to
8992 2009-06-24 Ian Lance Taylor <iant@google.com>
8995 * reloc.cc (relocate_sections): Skip empty relocation sections.
8997 2009-06-23 Ian Lance Taylor <iant@google.com>
9000 * layout.cc (Layout::create_note): Use choose_output_section
9001 rather than make_output_section.
9003 2009-06-23 Ian Lance Taylor <iant@google.com>
9006 * options.cc (General_options::parse_V): Set printed_version_.
9007 (General_options::General_options): Initialize printed_version_.
9008 * options.h (class General_options): Add printed_version_ field.
9009 * gold.cc (queue_initial_tasks): If there are no input files,
9010 don't give a fatal error if we printed the version information.
9011 (queue_middle_tasks): If using -r with a shared object, give a
9012 fatal error rather than an ordinary error.
9014 2009-06-23 Ian Lance Taylor <iant@google.com>
9017 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
9018 (Layout::make_output_section): Set have_stabstr_section_ if we see
9019 a .stab*str section.
9020 (Layout::finalize): Call link_stabs_sections.
9021 (Layout::link_stabs_sections): New file.
9022 * layout.h (class Layout): Add have_stabstr_section_ field.
9023 Declare link_stabs_sections.
9025 2009-06-23 Doug Kwan <dougkwan@google.com>
9027 * Makefile.am (libgold_a_LIBADD): New.
9028 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
9029 * Makefile.in: Regenerate.
9030 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
9031 * configure: Regenerate.
9032 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
9033 * fileread.cc: Include sys/state.h
9034 * gold.h: Declare memmem and strndup if found missing.
9035 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
9037 2009-06-23 Ian Lance Taylor <iant@google.com>
9039 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
9040 * configure: Rebuild.
9042 2009-06-23 Ian Lance Taylor <iant@google.com>
9045 * object.cc (Object::section_contents): Don't try to get a view if
9046 the section has length zero.
9047 (Object::handle_gnu_warning_section): If the section is empty, use
9048 the name of the section as the warning.
9050 2009-06-23 Ian Lance Taylor <iant@google.com>
9053 * stringpool.h (class Stringpool_template): Add optimize_ field.
9054 (Stringpool_template::set_optimize): New function.
9055 * stringpool.cc (Stringpool_template::Stringpool_template):
9056 Initialize optimize_ field.
9057 (Stringpool_template::set_string_offsets): Test local optimize
9058 fild rather than parameter.
9059 * layout.cc (Layout::Layout): Call set_optimize on the section
9062 2009-06-22 Ian Lance Taylor <iant@google.com>
9065 * yyscript.y: Parse TARGET.
9066 * script.cc (script_set_target): New function.
9067 * script-c.h (script_set_target): Declare.
9068 * options.cc (General_options::string_to_object_format): Rename
9069 from string_to_object_format in anonymous namespace. Change
9071 * options.h (class General_options): Declare
9072 string_to_object_format.
9074 2009-06-22 Ian Lance Taylor <iant@google.com>
9076 * script-sections.cc (Script_sections::create_segments): Don't put
9077 program headers in a PT_LOAD segment if -n or -N.
9079 2009-06-22 Ian Lance Taylor <iant@google.com>
9082 * options.h (class General_options): Add -z lazy and -z now. Sort
9083 -z options into alphabetical order.
9084 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
9086 2009-06-21 Ian Lance Taylor <iant@google.com>
9088 * layout.cc (Layout::make_output_section): Call
9089 Target::new_output_section.
9090 (Layout::attach_allocated_section_to_segment): Put large section
9091 sections in a separate load segment with the large segment flag
9093 (Layout::segment_precedes): Sort large data segments after other
9095 (align_file_offset): New static function.
9096 (Layout::set_segment_offsets): Use align_file_offset.
9097 * output.h (class Output_section): Add is_small_section_ and
9098 is_large_section_ fields.
9099 (Output_section::is_small_section): New function.
9100 (Output_section::set_is_small_section): New function.
9101 (Output_section::is_large_section): New function.
9102 (Output_section::set_is_large_section): New function.
9103 (Output_section::is_large_data_section): New function.
9104 (class Output_segment): Add is_large_data_segment_ field.
9105 (Output_segment::is_large_data_segment): New function.
9106 (Output_segment::set_is_large_data_segment): New function.
9107 * output.cc (Output_section::Output_section): Initialize new
9109 (Output_segment::Output_segment): Likewise.
9110 (Output_segment::add_output_section): Add assertion that large
9111 data sections always go in large data segments. Force small data
9112 sections to the end of the list of data sections. Force small BSS
9113 sections to the start of the list of BSS sections. For large BSS
9114 sections to the end of the list of BSS sections.
9115 * symtab.h (class Symbol): Declare is_common_shndx.
9116 (Symbol::is_defined): Check Symbol::is_common_shndx.
9117 (Symbol::is_common): Likewise.
9118 (class Symbol_table): Define enum Commons_section_type. Update
9119 declarations. Add small_commons_ and large_commons_ fields.
9120 * symtab.cc (Symbol::is_common_shndx): New function.
9121 (Symbol_table::Symbol_table): Initialize new fields.
9122 (Symbol_table::add_from_object): Put small and large common
9123 symbols in the right list.
9124 (Symbol_table::sized_finalized_symbol): Check
9125 Symbol::is_common_shndx.
9126 (Symbol_table::sized_write_globals): Likewise.
9127 * common.cc (Symbol_table::do_allocate_commons): Allocate new
9128 common symbol lists. Don't call do_allocate_commons_list if the
9130 (Symbol_table::do_allocate_commons_list): Remove is_tls
9131 parameter. Add comons_section_type parameter. Change all
9132 callers. Handle small and large common symbols.
9133 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
9134 Symbol::is_common_shndx.
9135 * resolve.cc (symbol_to_bits): Likewise.
9136 * target.h (Target::small_common_shndx): New function.
9137 (Target::small_common_section_flags): New function.
9138 (Target::large_common_shndx): New function.
9139 (Target::large_common_section_flags): New function.
9140 (Target::new_output_section): New function.
9141 (Target::Target_info): Add small_common_shndx, large_common_shndx,
9142 small_common_section_flags, and large_common_section_flags
9144 (Target::do_new_output_section): New virtual function.
9145 * arm.cc (Target_arm::arm_info): Initialize new fields.
9146 * i386.cc (Target_i386::i386_info): Likewise.
9147 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
9149 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
9150 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9151 (Target_x86_64::do_new_output_section): New function.
9152 * configure.ac: Define conditional MCMODEL_MEDIUM.
9153 * testsuite/Makefile.am (check_PROGRAMS): Add large.
9154 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
9155 (large_LDFLAGS): Define.
9156 * testsuite/large.c: New file.
9157 * testsuite/testfile.cc (Target_test::test_target_info):
9158 Initialize new fields.
9159 * configure, testsuite/Makefile.in: Rebuild.
9161 2009-06-05 Doug Kwan <dougkwan@google.com>
9163 * Makefile.am (CCFILES): Add target.cc.
9164 * Makefile.in: Regenerate.
9165 * i386.cc (class Target_i386): Define new virtual method to
9166 override do_is_local_label_name in parent.
9167 * object.cc (Sized_relobj::do_count_local_symbols): Discard
9168 local symbols if --discard-locals or -X is given.
9169 * options.h (class General_options): Declare new options
9170 '--discard-locals' and '-X' for discarding locals.
9171 * target.h (class Target): Define new methods is_local_label_name.
9172 Declare new virtual method do_is_local_label_name.
9173 * target.cc: New file.
9174 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
9175 (check_SCRIPTS): Add discard_locals_test.sh.
9176 (check_DATA): Add discard_local_tests.syms.
9177 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
9178 (discard_local_tests.syms, discard_locals_test.o): New make rules.
9179 * testsuite/Makefile.in: Regenerate.
9180 * testsuite/discard_locals_test.c: New file.
9181 * testsuite/discard_locals_test.sh: Same.
9183 2009-06-05 Doug Kwan <dougkwan@google.com>
9185 * object.cc (Sized_relobj::Sized_relobj): Initialize
9186 discarded_eh_frame_shndx_ to -1U.
9187 (Sized_relobj::do_layout): Record index of a discard .eh_frame
9189 (Sized_relobj::do_count_local_symbols): Skip local symbols in
9190 a discarded .eh_frame section.
9191 (Sized_relobj::do_finalize_local_symbols): Ditto.
9192 * object.h (class Sized_relobj): Declare new member
9193 discarded_eh_frame_shndx_.
9194 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
9195 (local_labels_test.o, local_labels_test): New rules.
9196 * testsuite/Makefile.in: Regenerate.
9198 2009-06-04 Doug Kwan <dougkwan@google.com>
9200 * layout.cc (Layout::section_name_mapping): Add mapping for
9201 special ARM sections.
9203 2009-06-03 Doug Kwan <dougkwan@google.com>
9205 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
9206 (utils::has_overflow): Same.
9208 2009-06-03 Ian Lance Taylor <iant@google.com>
9210 * layout.cc (Layout::section_name_mapping): New array, replacing
9211 Layout::linkonce_mapping.
9212 (Layout::section_name_mapping_count): New variable, replacing
9213 Layout::linkonce_mapping_count.
9214 (Layout::linkonce_output_name): Remove.
9215 (Layout::output_section_name): Rewrite.
9216 * layout.h (class Layout): Rename Linkonce_mapping to
9217 Section_name_mapping, linkonce_mapping to section_name_mapping,
9218 linkonce_mapping_count to section_name_mapping_count. Don't
9219 declare linkonce_output_name.
9221 2009-06-03 Doug Kwan <dougkwan@google.com>
9223 * gold/arm.cc (namespace utils): New.
9224 (Target_arm::reloc_is_non_pic): Define new method.
9225 (class Arm_relocate_functions): New.
9226 (Target_arm::Relocate::relocate): Handle relocation types used by
9229 2009-06-03 Ian Lance Taylor <iant@google.com>
9231 * arm.cc (Target_arm::scan::global): Use || instead of |.
9233 2009-06-02 Doug Kwan <dougkwan@google.com>
9235 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
9236 issued_non_pic_error_.
9237 (class Target_arm::Scan): Declare new method check_non_pic.
9238 Define new method symbol_needs_plt_entry.
9239 Declare new data member issued_non_pic_error_.
9240 (class Target_arm::Relocate): Declare new method
9241 should_apply_static_reloc.
9242 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9243 (Target_arm::Scan::check_non_pic): Define new method.
9244 (Target_arm::Scan::local): Handle a small subset of reloc types used
9246 (Target_arm::Scan::local): Same.
9247 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9249 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
9251 * incremental.cc (Incremental_inputs::report_command_line): Filter
9252 out --incremental-* options.
9254 2009-05-29 Doug Kwan <dougkwan@google.com>
9256 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9258 (class Target_arm): Update comment.
9259 (Target_arm::Target_arm): Initialize new data members GOT_,
9260 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
9261 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
9262 and Target_arm::rel_dyn_section.
9263 Declare new_enum Target_arm::Got_type.
9264 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
9266 Update commments for member do_dynsym_value.
9267 (Target_arm::got_size, Target_arm::plt_section,
9268 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
9269 new methods inside class defintion.
9270 (Target_arm::got_section): Define new method.
9271 (Target_arm::rel_dyn_section): Same.
9272 (Output_data_plt_arm): New template class.
9273 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
9274 (Output_data_plt_arm:do_adjust_output_section): Define new method.
9275 (Output_data_plt_arm::add_entry): Same.
9276 (Output_data_plt_arm::first_plt_entry): Define new
9277 static data member for PLT instruction template.
9278 (Output_data_plt_arm::plt_entry): Same.
9279 (Output_data_plt_arm::do_write): Define new method.
9280 (Target_arm::make_plt_entry): Same.
9281 (Target_arm::do_finalize_sections): Same.
9282 (Target_arm::do_dynsym_value): Same.
9284 2009-05-28 Doug Kwan <dougkwan@google.com>
9286 * Makefile.am (TARGETSOURCES): Add arm.cc.
9287 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
9288 * Makefile.in: Regenerate.
9290 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
9292 2009-05-26 Doug Kwan <dougkwan@google.com>
9294 * options.cc (General_options::parse_exclude_libs). Fix a comment.
9295 (General_options::check_excluded_libs): Strip off directories in
9296 archive name before matching like GNU ld does.
9297 * testsuite/Makefile.am (MOSTLYCLEANFILES,
9298 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
9299 (exclude_libs_test_LDFLAGS): Add linker option
9300 -Wl,--exclude-libs,libexclude_libs_test_3
9301 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
9302 an explicit archive without using -l.
9303 (alt/libexclude_libs_test_3.a): New make rule.
9304 * testsuite/Makefile.in: Regenerate.
9305 * testsuite/exclude_libs_test.c : Declare lib3_default().
9307 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
9308 * exclude_libs_test_3.c: New file.
9310 2009-05-26 Nick Clifton <nickc@redhat.com>
9312 * po/id.po: New Indonesian translation.
9313 * po/gold.pot: Updated template file.
9315 2009-05-22 Sriraman Tallam <tmsriram@google.com>
9317 * testsuite/Makefile.am: Add -ffunction-sections to compile
9318 gc_comdat_test files. Add -Wl,--gc-sections to build
9320 * testsuite/Makefile.in: Regenerate.
9321 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
9323 2009-05-21 Sriraman Tallam <tmsriram@google.com>
9325 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
9326 kept comdat section was garbage collected.
9327 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
9328 * testsuite/Makefile.in: Regenerate.
9329 * testsuite/gc_comdat_test.sh: New file.
9330 * testsuite/gc_comdat_test_1.cc: New file.
9331 * testsuite/gc_comdat_test_2.cc: New file.
9333 2009-05-19 Doug Kwan <dougkwan@google.com>
9335 * archive.cc (Archive::Archive): Move constructor from archive.h
9336 to here. Initialize no_export_.
9337 (Archive::get_elf_object_for_member): Set no_export flag of object.
9338 * archive.h (Archive::Archive): Move constructor body to
9340 (Archive::no_export): New method.
9341 (Archive::no_export_): New field.
9342 * object.h (Object::Object): Initialize no_export_ to false.
9343 (Object::no_export, Object::set_no_export): New methods.
9344 (Object::no_export_): New field.
9345 * options.cc (General_options::parse_exclude_libs): New method.
9346 (General_options::check_excluded_libs) Same.
9347 * options.h (exclude_libs): New option.
9348 (General_options::check_excluded_libs): New method declaration.
9349 (General_options::excluded_libs_): New field.
9350 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
9351 default or protected visibility if an object has no-export flag set.
9352 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
9353 (check_SCRIPTS): Add exclude_libs_test.sh.
9354 (check_DATA): Add exclude_libs_test.syms.
9355 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
9356 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
9357 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
9358 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
9359 (exclude_libs_test.syms, libexclude_libs_test_1.a,
9360 libexclude_libs_test_2.a): New rules.
9361 * testsuite/Makefile.in: Regenerate.
9362 * testsuite/exclude_libs_test.c: New file.
9363 * testsuite/exclude_libs_test.sh: Ditto.
9364 * testsuite/exclude_libs_test_1.c: Ditto.
9365 * testsuite/exclude_libs_test_2.c: Ditto.
9367 2009-05-15 Ian Lance Taylor <iant@google.com>
9369 * configure.ac: Check for declarations for cases where libiberty.h
9370 checks HAVE_DECL_xxx.
9371 * configure, config.in: Rebuild.
9373 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
9375 * gold.h (Incremental_argument_list): Remove (invalid) forward
9377 * incremental.cc (Incremental_inputs::report_achive): New method.
9378 (Incremental_inputs::report_object): New method.
9379 (Incremental_inputs::report_script): New method.
9380 (Incremental_inputs::finalize_inputs): New method.
9381 (Incremental_inputs::finalize): Call finalize_inputs().
9382 (Incremental_inputs::sized_create_incremental_inputs_section_data):
9383 Create inputs entries.
9384 * incremental.h (Incremental_input_type): New enum.
9385 (Incremental_inputs::Incremental_input): Initialize new fields.
9386 (Incremental_inputs::report_inputs): New method.
9387 (Incremental_inputs::report_achive): New method.
9388 (Incremental_inputs::report_object): New method.
9389 (Incremental_inputs::report_script): New method.
9390 (Incremental_inputs::finalize_inputs): New method.
9391 (Incremental_inputs::Input_info): New struct.
9392 (Incremental_inputs::Input_info_map): New typedef.
9393 (Incremental_inputs::lock_): New field.
9394 (Incremental_inputs::Inputs_): New field.
9395 (Incremental_inputs::Inputs_map): New field.
9396 * main.cc (main): Call Incremental_input::report_inputs.
9397 * options.h (Input_argument_list): Typedef moved from
9399 (Input_file_group::Files): Remove, use ::Input_argument_list.
9400 (Input_file_group::Input_argument_list): Remove, use
9401 ::Input_argument_list.
9402 * plugin.cc (Plugin_manager::add_input_file): Add error in
9404 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
9406 * script.cc (read_input_script): Call
9407 Incremental_input::report_script.
9408 * script.h (Script_info): New class.
9410 2009-04-27 Ian Lance Taylor <iant@google.com>
9412 * x86_64.cc (do_adjust_output_section): Set entsize to
9415 2009-04-23 Elliott Hughes <enh@google.com>
9417 * output.cc (Output_file::close): After short writes, continue
9418 writing from the correct offset in the buffer being written.
9420 2009-04-23 Chris Demetriou <cgd@google.com>
9422 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
9423 * configure: Regenerate.
9424 * config.in: Regenerate.
9425 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
9426 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
9428 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
9430 * incremental.cc (Incremental_inputs_header_data): Renamed from
9431 Incremental_input_header_data.
9432 (Incremental_inputs_header_data::data_size): New field.
9433 (Incremental_inputs_header_data::put_input_file_count): Renamed
9434 from input_file_count.
9435 (Incremental_inputs_header_data::put_command_line_offset): Renamed
9436 from command_line_offset.
9437 (Incremental_inputs_header_data::put_reserved): Renamed from
9439 (Incremental_inputs_entry_data): Renamed from
9440 Incremental_input_entry_data.
9441 (Incremental_inputs_entry_data::data_size): New field.
9442 (Incremental_inputs::report_command_line): New method.
9443 (Incremental_inputs::finalize): New method.
9444 (Incremental_inputs::create_incremental_inputs_data): New method.
9445 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
9446 * incremental.h: New file.
9447 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
9448 (Layout::finalize): Create incremental inputs section in
9450 (Layout::create_incremental_info_sections): New method.
9451 * layout.h (Layout::incremental_inputs): New method.
9452 (Layout::create_incremental_info_sections): New method.
9453 (Layout::incremental_inputs_): New field.
9454 * main.cc (main): Notify Incremental_input of the command line.
9456 2009-04-01 Ian Lance Taylor <iant@google.com>
9457 Mikolaj Zalewski <mikolajz@google.com>
9459 * gold.h (reserve_unordered_map): Define, three versions, one for
9460 each version of Unordered_map.
9461 * layout.cc (Layout::Layout): Remove options parameter. Add
9462 number_of_input_files parameter. Don't initialize options_.
9463 Initialize number_of_input_files_ and resized_signatures_. Move
9464 sections_are_attached_.
9465 (Layout::layout_group): Reserve space for group_signatures_.
9466 (Layout::find_or_add_kept_section): Change name parameter to be a
9467 reference. Resize signatures_ map when it gets large enough.
9468 (Layout::layout_eh_frame): Use parameters->options() instead of
9470 (Layout::make_output_section): Likewise.
9471 (Layout::attach_allocated_section_to_segment): Likewise.
9472 (Layout::finalize, Layout::create_executable_stack): Likewise.
9473 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
9474 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
9475 * layout.h (class Layout): Update declarations. Remove options_
9476 field. Add number_of_input_files_ and resized_signatures_
9477 fields. Move sections_are_attached_ field.
9478 * main.cc (main): Pass number of input files to Layout
9479 constructor. Don't pass options.
9481 2009-03-30 Ian Lance Taylor <iant@google.com>
9483 * ffsll.c (ffsll): Correct implementation.
9485 2009-03-27 Ian Lance Taylor <iant@google.com>
9487 * ffsll.c: New file.
9488 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
9489 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
9490 * ftruncate.c (ftruncate): Declare before definition.
9491 * mremap.c (mremap): Likewise.
9492 * pread.c (pread): Likewise.
9493 * configure, Makefile.in, config.in: Rebuild.
9495 * mremap.c: New file.
9496 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
9497 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
9498 (mremap): Declare if HAVE_MREMAP is not defined.
9499 * configure, Makefile.in, config.in: Rebuild.
9501 2009-03-27 Cary Coutant <ccoutant@google.com>
9503 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
9504 position independent.
9505 * sparc.cc (Target_sparc::check_non_pic): Likewise.
9506 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
9508 2009-03-24 Cary Coutant <ccoutant@google.com>
9510 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
9512 (needs_dynamic_reloc): Likewise.
9514 2009-03-24 Ian Lance Taylor <iant@google.com>
9516 * yyscript.y (file_cmd): Recognize EXTERN.
9517 (extern_name_list, extern_name_list_body): New nonterminals.
9518 * script.cc (script_add_extern): Define.
9519 * script-c.h (script_add_extern): Declare.
9521 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
9523 * object.cc (is_elf_object): Define.
9524 * object.h (is_elf_object): Declare.
9525 * archive.cc (Archive::get_elf_object_for_member): Call
9527 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
9529 2009-03-24 Elliott Hughes <enh@google.com>
9531 * output.cc (Output_file::map_anonymous): Define.
9532 (Output_file::map): Use map_anonymous. If the regular mmap fails,
9533 try an anonymous one. Report the size if the mmap fails.
9534 * output.h (class Output_file): Declare map_anonymous.
9536 2009-03-24 Ian Lance Taylor <iant@google.com>
9538 * target-select.cc (instantiate_target): Don't acquire the lock if
9539 the instantiated_target_ field has already been set.
9541 2009-03-23 Ian Lance Taylor <iant@google.com>
9543 * gold-threads.h (class Initialize_lock): Define.
9544 * gold-threads.cc (class Initialize_lock_once): Define.
9545 (initialize_lock_control): New static variable.
9546 (initialize_lock_pointer): New static variable.
9547 (initialize_lock_once): New static function.
9548 (Initialize_lock::Initialize_lock): Define.
9549 (Initialize_lock::initialize): Define.
9550 * target-select.h: Include "gold-threads.h".
9551 (class Target_selector): Add lock_ and initialize_lock_ fields.
9552 Don't define instantiate_target, just declare it.
9553 * target-select.cc (Target_selector::Target_selector): Initialize
9555 (Target_selector::instantiate_target): Define.
9556 * descriptors.h: Include "gold-threads.h".
9557 (class Descriptors): Add initialize_lock_ field.
9558 * descriptors.cc (Descriptors::Descriptors): Initialize new
9560 (Descriptors::open): Use initialize_lock_ field
9561 * errors.h (class Errors): Add initialize_lock_ field.
9562 * errors.cc (Errors::Errors): Initialize new field.
9563 (Errors::initialize_lock): Use initialize_lock_ field.
9564 * powerpc.cc (class Target_selector_powerpc): Remove
9565 instantiated_target_ field. In do_recognize call
9566 instantiate_target rather than do_instantiate_target. In
9567 do_instantiate_target just allocate a new target.
9568 * sparc.cc (class Target_selector_sparc): Likewise.
9570 * freebsd.h: New file.
9571 * i386.cc: Include "freebsd.h".
9572 (Target_i386): Derive from Target_freebsd rather than
9574 (Target_selector_i386): Derive from Target_selector_freebsd rather
9575 than Target_selector.
9576 * x86_64.cc: Include "freebsd.h".
9577 (Target_x86_64): Derive from Target_freebsd rather than
9579 (Target_selector_x86_64): Derive from Target_selector_freebsd
9580 rather than Target_selector.
9581 * target.h (class Target): Add adjust_elf_header and
9582 do_adjust_elf_header.
9583 * output.cc (Output_file_header:: do_sized_write): Call target
9584 adjust_elf_header routine.
9585 * configure.tgt: Set targ_osabi.
9586 * configure.ac: Define GOLD_DEFAULT_OSABI.
9587 * parameters.cc (Parameters::default_target): Pass
9588 GOLD_DEFAULT_OSABI to select_target.
9589 * target-select.h (class Target_selector): Make instantiate_target
9590 protected rather than private.
9591 * Makefile.am (HFILES): Add freebsd.h.
9592 * configure, Makefile.in, config.in: Rebuild.
9594 * merge.cc (do_add_input_section): Correct pend value. Change
9595 message about last entry not being null terminated from error to
9598 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
9600 * incremental.cc: New file.
9601 * Makefile.am (CCFILES): Add incremental.cc.
9602 * Makefile.in: Rebuild.
9604 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
9606 * layout.cc (Layout::output_section_name): Preserve names
9607 of '.note.' sections.
9609 2009-03-19 Ian Lance Taylor <iant@google.com>
9611 * descriptors.cc (Descriptors::open): Check that the options are
9612 valid before using them.
9614 2009-03-18 Ian Lance Taylor <iant@google.com>
9616 * script-sections.h: Include <list>.
9617 (class Script_sections): Change Sections_elements from std::vector
9618 to std::list. Typedef public Elements_iterator. Add
9619 orphan_section_placement_, data_segment_align_start_, and
9620 saw_data_segment_align_ fields. Remove data_segment_align_index_
9622 * script-sections.cc (class Orphan_section_placement): New class.
9623 (class Sections_element): Add virtual functions is_relro and
9624 orphan_section_init. Remove virtual function place_orphan_here.
9625 (class Output_section_definition): Add is_relro and
9626 orphan_section_init. Remove place_orphan_here.
9627 (class Orphan_output_section): Likewise.
9628 (Script_sections::Script_sections): Update for field changes.
9629 (Script_sections::data_segment_align): Set saw_data_segment_align_
9630 and data_segment_align_start_, not data_segment_align_index.
9631 (Script_sections::data_segment_relro_end): Check
9632 saw_data_segment_align_. Use data_segment_align_start_ rather
9633 than data_segment_align_index_.
9634 (Script_sections::place_orphan): Rewrite to use
9635 Orphan_section_placement.
9637 2009-03-17 Ian Lance Taylor <iant@google.com>
9639 * archive.cc (Archive::add_symbols): Check for a version attached
9640 to the symbol name in the archive map.
9641 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
9642 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
9643 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
9644 (ver_test_11.a): New target.
9645 * testsuite/Makefile.in: Rebuild.
9647 * configure.ac: Check for chsize and posix_fallocate. Replace
9649 * ftruncate.c: New file, from gnulib.
9650 * output.cc (posix_fallocate): Define dummy version if not
9651 HAVE_POSIX_FALLOCATE.
9652 (Output_file::map): Call posix_fallocate rather than lseek and
9654 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
9655 * configure, Makefile.in, config.in: Rebuild.
9657 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
9659 * layout.h (Layout::create_note): Add section_name parameter.
9660 * layout.cc (Layout::create_note): Likewise.
9661 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
9663 2009-03-17 Ian Lance Taylor <iant@google.com>
9665 * descriptors.cc: Include "options.h".
9666 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
9667 (Descriptors::open): Always use O_CLOEXEC when opening a new
9668 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
9669 then set FD_CLOEXEC.
9671 * sparc.cc (class Target_sparc): Add has_got_section.
9672 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
9673 make sure we have a GOT section.
9675 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
9676 (Target_sparc::Scan::local): Likewise.
9677 (Target_sparc::Scan::global): Likewise.
9678 (Target_sparc::Relocate::relocate): Likewise.
9679 (Target_sparc::Relocate::relocate_tls): Likewise.
9681 * symtab.cc (Symbol_table::define_default_version): New function,
9682 broken out of add_from_object.
9683 (Symbol_table::add_from_object): Call define_default_version.
9684 (Symbol_table::define_special_symbol): Add resolve_oldsym
9685 parameter. Change all callers. If the version for a symbol comes
9686 from a version script, resolve it with the symbol with the same
9687 name with no version. Also add the symbol without a version if
9689 (do_define_in_output_data): If resolving with oldsym, don't delete
9691 (do_define_in_output_segment): Likewise.
9692 (do_define_as_constant): Likewise.
9693 * symtab.h (class Symbol_table): Update declarations.
9695 2009-03-13 Ian Lance Taylor <iant@google.com>
9697 * readsyms.cc (Read_symbols::incompatible_warning): New function.
9698 (Read_symbols::requeue): New function.
9699 (Read_symbols::do_read_symbols): If make_elf_object fails because
9700 the target type is not configured, and the file was searched for,
9701 issue a warning and retry with the next directory.
9702 (Add_symbols::run): If the file has an incompatible format, and
9703 it was searched for, requeue the Read_symbols task. On error,
9705 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
9706 dirindex parameter to constructor. Change all callers. Declare
9707 incompatible_warning and requeue.
9708 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
9709 input_argument_ and input_group_ fields. Add them to
9710 constructor. Change all callers.
9711 (class Read_script): Add dirindex_ field. Add it to constructor.
9713 * archive.cc (Archive::setup): Remove input_objects parameter.
9715 (Archive::get_file_and_offset): Likewise.
9716 (Archive::read_all_symbols): Likewise.
9717 (Archive::read_symbols): Likewise.
9718 (Archive::get_elf_object_for_member): Remove input_objects
9719 parameter. Add punconfigured parameter. Change all callers.
9720 (Archive::add_symbols): Change return type to bool. Check return
9721 value of include_member.
9722 (Archive::include_all_members): Likewise.
9723 (Archive::include_member): Change return type to bool. Return
9724 false if first included object has incompatible target. Set
9725 included_member_ field.
9726 (Add_archive_symbols::run): If add_symbols returns false, requeue
9728 * archive.h (class Archive): Add included_member_ field.
9729 Initialize it in constructor. Add input_file and searched_for
9730 methods. Update declarations.
9731 (class Add_archive_symbols): Add dirpath_, dirindex_, and
9732 input_argument_ fields. Add them to constructor. Change all
9734 * script.cc: Include "target-select.h".
9735 (class Parser_closure): Add skip_on_incompatible_target_ and
9736 found_incompatible_target_ fields. Add
9737 skip_on_incompatible_target parameter to constructor. Change all
9738 callers. Add methods skip_on_incompatible_target,
9739 clear_skip_on_incompatible_target, found_incompatible_target, and
9740 set_found_incompatible_target.
9741 (read_input_script): Add dirindex parameter. Change all callers.
9742 If parser finds an incompatible target, requeue Read_symbols
9744 (script_set_symbol): Clear skip_on_incompatible_target in
9746 (script_add_assertion, script_parse_option): Likewise.
9747 (script_start_sections, script_add_phdr): Likewise.
9748 (script_check_output_format): New function.
9749 * script.h (read_input_script): Update declaration.
9750 * script-c.h (script_check_output_format): Declare.
9751 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
9752 (ignore_cmd): Remove OUTPUT_FORMAT.
9753 * fileread.cc (Input_file::Input_file): Add explicit this.
9754 (Input_file::will_search_for): New function.
9755 (Input_file::open): Add pindex parameter. Change all callers.
9756 * fileread.h (class Input_file): Add input_file_argument method.
9757 Declare will_search_for. Update declarations.
9758 * object.cc (make_elf_object): Add punconfigured parameter.
9760 * object.h (class Object): Make input_file public. Add
9761 searched_for method.
9762 (make_elf_object): Update declaration.
9763 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
9765 * dirsearch.h (class Dirsearch): Update declaration.
9766 * options.h (class General_options): Add --warn-search-mismatch.
9767 * parameters.cc (Parameters::is_compatible_target): New function.
9768 * parameters.h (class Parameters): Declare is_compatible_target.
9769 * workqueue.cc (Workqueue::add_blocker): New function.
9770 * workqueue.h (class Workqueue): Declare add_blocker.
9772 * fileread.cc (Input_file::open): Remove options parameter.
9774 (Input_file::open_binary): Likewise.
9775 * script.cc (read_input_script): Likewise.
9776 * readsyms.h (class Read_symbols): Remove options_ field. Remove
9777 options parameter from constructor. Change all callers.
9778 (class Read_script): Likewise.
9779 * fileread.h (class Input_file): Update declarations.
9780 * script.h (read_input_script): Update declaration.
9782 2009-03-10 Nick Clifton <nickc@redhat.com>
9784 * po/es.po: New Spanish translation.
9786 2009-03-06 Cary Coutant <ccoutant@google.com>
9788 * options.cc (parse_short_option): Keep dash_z from registering itself.
9790 2009-03-03 Ian Lance Taylor <iant@google.com>
9793 * target-reloc.h (relocate_section): Pass output_section to
9795 * i386.cc (Target_i386::should_apply_static_reloc): Add
9796 output_section parameter. Change all callers.
9797 (Target_i386::Relocate::relocate): Add output_section parameter.
9798 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9799 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
9800 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
9801 * testsuite/two_file_shared.sh: New script.
9802 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
9803 (check_DATA): Add two_file_shared.dbg.
9804 (two_file_shared.dbg): New target.
9805 * testsuite/Makefile.in: Rebuild.
9807 2009-03-01 Ian Lance Taylor <iant@google.com>
9809 * configure.ac: Check for byteswap.h.
9810 * configure: Rebuild.
9811 * config.in: Rebuild.
9813 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
9815 * layout.cc (Layout::find_or_add_kept_section): New function.
9816 (Layout::add_comdat): Removed.
9817 * layout.h (struct Kept_section): Move out of class Layout.
9818 Remove trailing underscores from field names. Add group_sections
9819 field. Rename group_ field to is_group. Change all uses.
9820 (class Layout): Declare find_or_add_kept_section, not add_comdat.
9821 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
9822 comdat_groups_ field.
9823 (Sized_relobj::include_section_group): Use
9824 find_or_add_kept_section and Kept_section::group_sections.
9825 (Sized_relobj::include_linkonce_section): Likewise.
9826 * object.cc (class Sized_relobj): Don't define Comdat_group or
9827 Comdat_group_table. Remove find_comdat_group and
9828 add_comdat_group. Remove comdat_groups_ field.
9829 * plugin.cc (include_comdat_group): Use
9830 Layout::find_or_add_kept_section.
9832 2009-02-28 Ian Lance Taylor <iant@google.com>
9834 * README: --gc-sections and map files are now supported. Document
9835 some build requirements.
9838 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
9839 relocatable link set the value of the section symbol to zero.
9840 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
9841 relocatable link don't include the section address in the local
9844 2009-02-27 Ian Lance Taylor <iant@google.com>
9847 * options.h (class Search_directory): Add is_system_directory.
9848 (class General_options): Declare is_in_system_directory.
9849 * options.cc (get_relative_sysroot): Make static.
9850 (get_default_sysroot): Make static.
9851 (General_optoins::is_in_system_directory): New function.
9852 * fileread.cc (Input_file::is_in_system_directory): New function.
9853 * fileread.h (class Input_file): Declare is_in_system_directory.
9854 * object.h (class Object): Add is_in_system_directory.
9855 (class Input_objects): Remove system_library_directory_ field.
9856 * object.cc (Input_objects::add_object): Don't set
9857 system_library_directory_.
9858 (input_objects::found_in_system_library_directory): Remove.
9859 * symtab.cc (Symbol_table::write_globals): Remove input_objects
9860 parameter. Change all callers.
9861 (Symbol_table::sized_write_globals): Likewise.
9862 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
9863 Call Object::is_in_system_directory.
9864 * symtab.h (class Symbol_table): Update declarations.
9867 * descriptors.h (Open_descriptor): Add is_on_stack field.
9868 * descriptors.cc (Descriptors::open): If the descriptor is on the
9869 top of the stack, remove it. Initialize is_on_stack field.
9870 (Descriptors::release): Only add pod to stack if it is not on the
9872 (Descriptors::close_some_descriptor): Clear stack_next and
9876 * output.cc (Output_section::find_starting_output_address): Rename
9877 from starting_output_address; add PADDR parameter; change return
9879 * output.h (class Output_section): Declare
9880 find_starting_output_address instead of starting_output_address.
9881 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
9882 section symbol for which we can't find a merge section.
9885 * symtab.cc (Symbol_table::add_from_object): If the visibility is
9886 hidden or internal, force the symbol to be local.
9887 * resolve.cc (Symbol::override_visibility): Define.
9888 (Symbol::override_base): Use override_visibility.
9889 (Symbol_table::resolve): Likewise.
9890 (Symbol::override_base_with_special): Likewise.
9891 (Symbol_table::override_with_special): If the visibility is hidden
9892 or internal, force the symbol to be local.
9893 * symtab.h (class Symbol): Add set_visibility and
9894 override_visibility.
9895 * testsuite/ver_test_1.sh: New file.
9896 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
9897 (check_DATA): Add ver_test_1.syms.
9898 (ver_test_1.syms): New target.
9899 * testsuite/Makefile.in: Rebuild.
9901 2009-02-25 Cary Coutant <ccoutant@google.com>
9903 * layout.cc (Layout::choose_output_section): Don't rename sections
9904 when using a linker script that has a SECTIONS clause.
9905 * Makefile.in: Regenerate.
9907 * testsuite/Makefile.am (script_test_5.sh): New test case.
9908 * testsuite/Makefile.in: Regenerate.
9909 * testsuite/script_test_5.cc: New file.
9910 * testsuite/script_test_5.sh: New file.
9911 * testsuite/script_test_5.t: New file.
9913 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
9915 * archive.cc (Archive::include_member): Update calls to add_symbols.
9916 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
9917 the Layout argument.
9918 * dynobj.h (do_add_symbols): Add the Layout argument.
9919 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
9921 * object.h (Object::add_symbols): Add the Layout argument.
9922 (Object::do_add_symbols): Add the Layout argument.
9923 (Sized_relobj::do_add_symbols): Add the Layout argument.
9924 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
9925 Unify the two versions.
9926 (Add_plugin_symbols): Remove.
9927 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
9928 (Sized_pluginobj::do_add_symbols): Unify the two versions.
9929 (Add_plugin_symbols): Remove.
9930 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
9931 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
9932 (Add_symbols::run): Make it work with Pulginobj.
9934 2009-02-06 Ian Lance Taylor <iant@google.com>
9936 * object.cc (Sized_relobj::do_layout): Make info message start
9937 with lower case letter.
9939 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
9941 * binary.cc: Fix file comment.
9943 * options.h (enum Incremental_disposition): Define.
9944 (class General_options): Add new options: --incremental,
9945 --incremental_changed, --incremental_unchanged,
9946 --incremental_unknown. Add incremental_disposition_ and
9947 implicit_incremental_ fields.
9948 (General_options::incremental_disposition): New function.
9949 (class Position_dependent_options): Add incremental_disposition
9951 (Position_dependent_options::copy_from_options): Set incremental
9953 * options.cc (General_options::parse_incremental_changed): New
9955 (General_options::parse_incremental_unchanged): New function.
9956 (General_options::parse_incremental_unknown): New function.
9957 (General_options::General_options): Initialize new fields
9958 incremental_disposition_ and implicit_incremental_.
9959 (General_options::finalize): Check for uasge of --incremental-*
9960 without --incremental.
9962 2009-02-06 Chris Demetriou <cgd@google.com>
9964 * gold.h (gold_undefined_symbol): Change to take only a Symbol
9965 pointer and to report location as the file name associated with
9967 (gold_undefined_symbol_at_location): New function to replace the
9968 old gold_undefined_symbol functionality.
9969 * target-reloc.h (relocate_section): Update to use
9970 gold_undefined_symbol_at_location.
9971 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9972 Call gold_undefined_symbol function rather than gold_error.
9973 * errors.h (Errors::undefined_symbol): Take location as a
9974 string, rather than calculating it from a relocation.
9975 * errors.cc (Errors::fatal): Print "fatal error:" before the
9977 (Errors::error, Errors::error_at_location): Print "error: "
9978 before the formatted message.
9979 (Errors::undefined_symbol): Take location as a string, rather
9980 than calculating it from a relocation.
9981 (gold_undefined_symbol_at_location): New function akin to
9982 old gold_undefined_symbol, calculates location from relocation.
9983 (gold_undefined_symbol): Change to take only a Symbol pointer
9984 and to report location as the file name associated with the symbol.
9985 * testsuite/debug_msg.sh: Update for changed error messages.
9986 * testsuite/undef_symbol.sh: Likewise.
9988 2009-02-04 Duncan Sands <baldrick@free.fr>
9991 * reduced_debug_output.h
9992 (Output_reduced_debug_abbrev_section::failed): Use format for
9994 (Output_reduced_debug_info_section::faild): Likewise.
9996 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
9998 * script.cc (Lazy_demangler): New class.
9999 (Version_script_info::get_symbol_version_helper): Demangle a
10002 2009-01-29 Cary Coutant <ccoutant@google.com>
10004 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
10006 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10008 2009-01-28 Ian Lance Taylor <iant@google.com>
10010 * version.cc (version_string): Bump to 1.9.
10012 * gold.h: Include <cstring> and <stdint.h>.
10013 * version.cc: Include <cstdio>.
10014 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
10016 * reduced_debug_output.cc (insert_into_vector): Rename from
10017 Insert_into_vector; change all callers. Use Swap_unaligned to
10018 avoid aliasing issue; remove union since it is unnecessary.
10020 2009-01-27 Sriraman Tallam <tmsriram@google.com>
10022 * Makefile.am (CCFILES): Add gc.cc.
10023 (HFILES): Add gc.h.
10024 * Makefile.in: Regenerate.
10025 * gold.cc (Gc_runner): New class.
10026 (queue_initial_tasks): Call garbage collection related tasks
10027 when corresponding options are invoked.
10028 (queue_middle_gc_tasks): New function.
10029 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
10030 processed early before laying out sections during garbage collection.
10031 * gold.h (queue_middle_gc_tasks): New function.
10032 (is_prefix_of): Move from "layout.cc".
10033 * i386.cc (Target_i386::gc_process_relocs): New function.
10034 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
10035 * main.cc (main): Create object of class "Garbage_collection".
10036 * object.cc (Relobj::copy_symbols_data): New function.
10037 (Relobj::is_section_name_included): New function.
10038 (Sized_relobj::do_layout): Allow this function to be called twice
10039 during garbage collection and defer layout of section during the
10041 * object.h (Relobj::get_symbols_data): New function.
10042 (Relobj::is_section_name_included): New function.
10043 (Relobj::copy_symbols_data): New function.
10044 (Relobj::set_symbols_data): New function.
10045 (Relobj::get_relocs_data): New function.
10046 (Relobj::set_relocs_data): New function.
10047 (Relobj::is_output_section_offset_invalid): New pure virtual function.
10048 (Relobj::gc_process_relocs): New function.
10049 (Relobj::do_gc_process_relocs): New pure virtual function.
10050 (Relobj::sd_): New data member.
10051 (Sized_relobj::is_output_section_offset_invalid): New function.
10052 (Sized_relobj::do_gc_process_relocs): New function.
10053 * options.h (General_options::gc_sections): Modify to not be a no-op.
10054 (General_options::print_gc_sections): New option.
10055 * plugin.cc (Plugin_finish::run): Remove function call to
10056 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
10057 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
10058 * reloc.cc (Read_relocs::run): Add task to process relocs and
10059 determine unreferenced sections when doing garbage collection.
10060 (Gc_process_relocs): New class.
10061 (Sized_relobj::do_gc_process_relocs): New function.
10062 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
10063 sections that are garbage collected.
10064 * reloc.h (Gc_process_relocs): New class.
10065 * sparc.cc (Target_sparc::gc_process_relocs): New function.
10066 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
10067 symbols whose corresponding sections are garbage collected.
10068 (Symbol_table::Symbol_table): Add new parameter for the garbage
10070 (Symbol_table::gc_mark_undef_symbols): New function.
10071 (Symbol_table::gc_mark_symbol_for_shlib): New function.
10072 (Symbol_table::gc_mark_dyn_syms): New function.
10073 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
10075 (Symbol_table::add_from_object): Likewise.
10076 (Symbol_table::add_from_relobj): When building shared objects, do not
10077 treat externally visible symbols as garbage.
10078 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
10079 table information for static and relocatable links.
10080 * symtab.h (Symbol_table::set_gc): New function.
10081 (Symbol_table::gc): New function.
10082 (Symbol_table::gc_mark_undef_symbols): New function.
10083 (Symbol_table::gc_mark_symbol_for_shlib): New function.
10084 (Symbol_table::gc_mark_dyn_syms): New function.
10085 (Symbol_table::gc_): New data member.
10086 * target.h (Sized_target::gc_process_relocs): New pure virtual
10088 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
10089 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
10091 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
10093 * options.h (General_options::gc_sections): Define as a no-op for now.
10094 (General_options::no_keep_memory): Ditto.
10095 (General_options::Bshareable): Define.
10096 * options.cc (General_options::finalize): Honor -Bshareable.
10098 2009-01-20 Andreas Schwab <schwab@suse.de>
10100 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
10101 read the value in the contents, since we don't use it. Use the
10102 template endianness when writing.
10103 (Relocate::relocate): Use it for R_PPC_REL16_HA.
10105 2009-01-19 Andreas Schwab <schwab@suse.de>
10107 * configure.tgt (powerpc64-*): Fix targ_obj.
10109 2009-01-15 Ian Lance Taylor <iant@google.com>
10111 * object.cc (Sized_relobj::write_local_symbols): Don't write out
10112 local symbols when stripping all symbols.
10114 2009-01-14 Cary Coutant <ccoutant@google.com>
10116 * output.cc (Output_reloc): Add explicit instantiations.
10118 2009-01-14 Cary Coutant <ccoutant@google.com>
10120 * archive.cc (Archive::get_elf_object_for_member): Remove call
10121 to File_read::claim_for_plugin.
10122 * descriptors.cc (Descriptors::open): Remove reference to
10124 (Descriptors::claim_for_plugin): Remove.
10125 * descriptors.h (Descriptors::claim_for_plugin): Remove.
10126 (Descriptors::is_claimed): Remove.
10127 (claim_descriptor_for_plugin): Remove.
10128 * fileread.cc (File_read::claim_for_plugin): Remove.
10129 * fileread.h (File_read::claim_for_plugin): Remove.
10130 (File_read::descriptor): Reopen descriptor if necessary.
10131 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
10132 (Plugin_manager::all_symbols_read): Add task parameter. Change
10134 (Plugin_manager::get_input_file): New function.
10135 (Plugin_manager::release_input_file): New function.
10136 (Pluginobj::Pluginobj): Add filesize parameter and initialize
10137 corresponding data member.
10138 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
10139 and pass to base constructor. Change all callers.
10140 (get_input_file, release_input_file): New functions.
10141 (make_sized_plugin_object): Add filesize parameter. Change all callers.
10142 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
10143 (Plugin_manager::all_symbols_read): Add task parameter.
10144 (Plugin_manager::get_input_file): New function.
10145 (Plugin_manager::release_input_file): New function.
10146 (Plugin_manager::task_): New data member.
10147 (Pluginobj::Pluginobj): Add filesize parameter.
10148 (Pluginobj::filename): New function.
10149 (Pluginobj::descriptor): New function.
10150 (Pluginobj::filesize): New function.
10151 (Pluginobj::filesize_): New data member.
10152 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
10153 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
10154 File_read::claim_for_plugin; use Object::unlock to unlock the file.
10156 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
10157 with archive libraries.
10158 * testsuite/Makefile.in: Regenerate.
10159 * testsuite/plugin_test.c (struct sym_info): New type.
10160 (get_input_file, release_input_file): New static variables.
10161 (onload): Capture new transfer vector entries.
10162 (claim_file_hook): Stop reading at end of file according to filesize.
10163 Factor out parsing of readelf output into separate function.
10164 (all_symbols_read_hook): Exercise get_input_file and release_input_file
10165 APIs and get the source file name from the symbol table. Convert
10166 source file name to corresponding object file name. Print info
10167 message when adding new input files.
10168 (parse_readelf_line): New function.
10169 * testsuite/plugin_test_1.sh: Add checks for new info messages.
10170 * testsuite/plugin_test_2.sh: Likewise.
10171 * testsuite/plugin_test_3.sh: Likewise.
10172 * testsuite/plugin_test_4.sh: New test case.
10174 2009-01-07 Ian Lance Taylor <iant@google.com>
10176 * version.cc (version_string): Bump to 1.8.
10178 2008-12-23 Cary Coutant <ccoutant@google.com>
10180 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
10181 * plugin.cc (Plugin_manager::finish): Rename as
10182 layout_deferred_objects. Move cleanup to separate function.
10183 (Plugin_manager::cleanup): New function.
10184 (Plugin_finish::run): Call layout_deferred_objects and cleanup
10186 * plugin.h (Plugin_manager::finish): Rename as
10187 layout_deferred_objects.
10188 (Plugin_manager::cleanup): New function.
10189 (Plugin_manager::cleanup_done): New field.
10191 2008-12-23 Cary Coutant <ccoutant@google.com>
10193 * plugin.cc (is_visible_from_outside): New function.
10194 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
10195 so we don't return "IR only" status for exported symbols or -r links.
10197 * testsuite/Makefile.am (plugin_test_3): New test case.
10198 * testsuite/Makefile.in: Regenerate.
10199 * testsuite/plugin_test_3.sh: New file.
10201 2008-12-22 Cary Coutant <ccoutant@google.com>
10203 * object.cc (Sized_relobj::layout_section): New function.
10204 (Sized_relobj::do_layout): Defer layout of input sections until after
10205 plugin has provided replacement files.
10206 (Sized_relobj::do_layout_deferred_sections): New function.
10207 * object.h (Relobj::set_section_offset): Remove virtual keyword.
10208 (Relobj::layout_deferred_sections): New function.
10209 (Relobj::do_layout_deferred_sections): New function.
10210 (Sized_relobj::do_layout_deferred_sections): New function.
10211 (Sized_relobj::layout_section): New function.
10212 (Sized_relobj::Deferred_layout): New structure.
10213 (Sized_relobj::deferred_layout_): New field.
10214 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10215 Change all callers. Layout deferred sections.
10216 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
10218 (Plugin_hook::run): Move code from do_plugin_hook inline.
10219 (Plugin_hook::do_plugin_hook): Remove.
10220 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10221 (Plugin_manager::finish): Renamed, was cleanup.
10222 (Plugin_manager::should_defer_layout): New function.
10223 (Plugin_manager::add_deferred_layout_object): New function.
10224 (Plugin_manager::Deferred_layout_list): New type.
10225 (Plugin_manager::deferred_layout_objects_): New field.
10226 (Plugin_hook::do_plugin_hook): Remove.
10228 2008-12-17 Ian Lance Taylor <iant@google.com>
10230 * options.h (class General_options): Add --no case for
10233 2008-12-16 Cary Coutant <ccoutant@google.com>
10235 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
10237 (Plugin_manager::claim_file): Create plugin object even if
10238 plugin did not call the add_symbols callback.
10239 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10240 asking for more symbols than were added.
10241 * testsuite/Makefile.am (plugin_test_1): Add test case with
10243 (empty.syms): New target.
10244 * testsuite/Makefile.in: Regenerate.
10245 * testsuite/plugin_test.c (claim_file_hook): Add new debug
10246 message. Don't call add_symbols if no globals.
10247 (all_symbols_read_hook): Don't provide replacement for empty
10250 2008-12-12 Ian Lance Taylor <iant@google.com>
10252 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10253 r_type == 0 for a local symbol with r_sym == 0.
10254 (scan_relocatable_relocs): Pass r_sym to
10255 local_non_section_strategy.
10256 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10259 * configure.ac: Update test for TLS descriptors: they are
10260 supported as of glibc 2.9.
10261 * configure: Rebuild.
10263 2008-12-11 Ian Lance Taylor <iant@google.com>
10266 * target-reloc.h (Default_scan_relocatable_relocs): For each
10267 function, map r_type == 0 to RELOC_DISCARD.
10269 2008-12-10 Cary Coutant <ccoutant@google.com>
10271 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
10272 object to override a kept COMDAT group from a plugin object.
10274 2008-12-09 Ian Lance Taylor <iant@google.com>
10277 * yyscript.y (file_cmd): Handle INPUT.
10279 * testsuite/initpri1.c: Change all declarations to be full
10280 prototypes by adding void, to avoid compiler warnings.
10282 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
10284 * options.cc (General_options::parse_plugin_opt): New.
10285 (General_options::add_plugin): The argument now is just the filename.
10286 (General_options::add_plugin_option): New.
10287 * options.h (plugin_opt): New.
10288 (add_plugin): Change argument name.
10289 (add_plugin_option): New.
10290 * plugin.cc (Plugin::load): Don't parse the plugin option.
10291 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
10292 (Plugin::add_option): New.
10293 (Plugin::args_): Change type.
10294 (Plugin::filename_): New.
10295 (Plugin_manager::add_plugin_option): New.
10296 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
10297 * testsuite/Makefile.in: Regenerate.
10299 2008-12-05 Cary Coutant <ccoutant@google.com>
10301 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
10302 Handle --strip-lto-sections option.
10303 * options.h (strip_lto_sections): New option.
10305 2008-12-01 Cary Coutant <ccoutant@google.com>
10307 * plugin.cc (ld_plugin_message): Change format parameter to const.
10308 Fix mismatch between new[] and delete.
10310 2008-11-14 Cary Coutant <ccoutant@google.com>
10312 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
10315 2008-11-05 Craig Silverstein <csilvers@google.com>
10317 * options.cc (General_options::parse_dynamic_list): New function.
10318 * options.h (General_options): New flags dynamic_list,
10319 dynamic_list_data, dynamic_list_cpp_new, and
10320 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
10321 (General_options::in_dynamic_list): New function.
10322 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
10323 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
10324 (Lex::can_continue_name): Likewise.
10326 (read_script_file): New parameter script_options.
10327 (read_dynamic_list): New function.
10328 (Script_options::define_dynamic_list): New function.
10329 (dynamic_list_keyword_parsecodes): New variable.
10330 (dynamic_list_keywords): New variable.
10331 * script.h (Script_options::define_dynamic_list): New function
10333 (read_dynamic_list): New function prototype.
10334 * symtab.cc (strprefix): New macro.
10335 (Symbol::should_add_dynsym_entry): Support dynamic_list,
10336 dynamic_list_data, dynamic_list_cpp_new, and
10337 dynamic_list_cpp_typeinfo.
10338 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
10339 (dynamic_list_expr): New rule.
10340 (dynamic_list_nodes): Likewise.
10341 (dynamic_list_node): Likewise.
10342 * testsuite/Makefile.am (dynamic_list): New test.
10343 * testsuite/Makefile.in: Regenerated.
10344 * testsuite/dynamic_list.t: New file.
10345 * testsuite/dynamic_list.sh: New file.
10347 2008-11-05 Craig Silverstein <csilvers@google.com>
10349 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
10350 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
10351 (t11_last): Likewise.
10352 * testsuite/ver_test_6.c (main): Likewise.
10354 2008-10-07 Cary Coutant <ccoutant@google.com>
10356 * options.c (General_options::finalize): Add check for -static and
10358 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
10361 2008-10-02 Cary Coutant <ccoutant@google.com>
10363 * plugin.cc (make_sized_plugin_object): Fix conditional
10364 compilation to work when not all targets are enabled.
10366 2008-09-29 Cary Coutant <ccoutant@google.com>
10368 * archive.cc (Archive::get_file_and_offset): Use filename instead
10369 of name to get library path.
10370 (Archive::include_member): Unlock external member of a thin archive.
10372 * testsuite/Makefile.am (TEST_AR): New variable.
10373 (thin_archive_test_1): New test.
10374 (thin_archive_test_2): New test.
10375 * testsuite/Makefile.in: Regenerate.
10376 * testsuite/thin_archive_main.cc: New file.
10377 * testsuite/thin_archive_test_1.cc: New file.
10378 * testsuite/thin_archive_test_2.cc: New file.
10379 * testsuite/thin_archive_test_3.cc: New file.
10380 * testsuite/thin_archive_test_4.cc: New file.
10382 2008-09-29 Cary Coutant <ccoutant@google.com>
10384 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
10385 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
10387 (Sized_relobj::do_finalize_local_symbols): Likewise.
10388 (Sized_relobj::map_to_kept_section): Likewise.
10389 * object.h (Sized_relobj::invalid_address): New constant.
10390 (Sized_relobj::do_output_section_offset): Check for invalid_address
10392 * output.cc (Output_reloc::local_section_offset): Use constant
10393 invalid_address instead of -1U.
10394 (Output_reloc::get_address): Likewise.
10395 (Output_section::output_address): Change -1U to -1ULL.
10396 * output.h (Output_reloc::invalid_address): New constant.
10397 * reloc.cc (Sized_relobj::write_sections): Use constant
10398 invalid_address instead of -1U.
10399 (Sized_relobj::relocate_sections): Likewise.
10400 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
10401 values for merge sections.
10402 * target-reloc.h (relocate_for_relocatable): Use constant
10403 invalid_address instead of -1U.
10405 2008-09-19 Cary Coutant <ccoutant@google.com>
10407 Add plugin functionality for link-time optimization (LTO).
10408 * configure.ac (plugins): Add --enable-plugins option.
10409 * configure: Regenerate.
10410 * config.in: Regenerate.
10411 * Makefile.am (LIBDL): New variable.
10412 (CCFILES): Add plugin.cc.
10413 (HFILES): Add plugin.h.
10414 (ldadd_var): Add LIBDL.
10415 * Makefile.in: Regenerate.
10417 * archive.cc: Include "plugin.h".
10418 (Archive::setup): Don't preread archive symbols when using a plugin.
10419 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
10420 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
10422 (Archive::include_member): Add symbols from plugin objects.
10423 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
10424 * descriptors.cc (Descriptors::open): Check for file descriptors
10425 abandoned by plugins.
10426 (Descriptors::claim_for_plugin): New function.
10427 * descriptors.h (Descriptors::claim_for_plugin): New function.
10428 (Open_descriptor::is_claimed): New field.
10429 (claim_descriptor_for_plugin): New function.
10430 * fileread.cc (File_read::claim_for_plugin): New function.
10431 * fileread.h (File_read::claim_for_plugin): New function.
10432 (File_read::descriptor): New function.
10433 * gold.cc: Include "plugin.h".
10434 (queue_initial_tasks): Add task to call plugin hooks for generating
10436 * main.cc: Include "plugin.h".
10437 (main): Load plugin libraries.
10438 * object.h (Pluginobj): Declare.
10439 (Object::pluginobj): New function.
10440 (Object::do_pluginobj): New function.
10441 (Object::set_target): New function.
10442 * options.cc: Include "plugin.h".
10443 (General_options::parse_plugin): New function.
10444 (General_options::General_options): Initialize plugins_ field.
10445 (General_options::add_plugin): New function.
10446 * options.h (Plugin_manager): Declare.
10447 (General_options): Add --plugin option.
10448 (General_options::has_plugins): New function.
10449 (General_options::plugins): New function.
10450 (General_options::add_plugin): New function.
10451 (General_options::plugins_): New field.
10452 * plugin.cc: New file.
10453 * plugin.h: New file.
10454 * readsyms.cc: Include "plugin.h".
10455 (Read_symbols::do_read_symbols): Check for archive before checking
10456 for ELF file. Call plugin hooks to claim files.
10457 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
10458 from a real object file; force override when processing replacement
10460 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
10461 (Symbol::init_base_object): Likewise.
10462 (Symbol::init_base_output_data): Likewise.
10463 (Symbol::init_base_output_segment): Likewise.
10464 (Symbol::init_base_constant): Likewise.
10465 (Symbol::init_base_undefined): Likewise.
10466 (Symbol::output_section): Assert that object is not a plugin.
10467 (Symbol_table::add_from_pluginobj): New function.
10468 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
10470 (Symbol_table::sized_write_globals): Likewise.
10471 (Symbol_table::add_from_pluginobj): Instantiate template.
10472 * symtab.h (Sized_pluginobj): Declare.
10473 (Symbol::in_real_elf): New function.
10474 (Symbol::set_in_real_elf): New function.
10475 (Symbol::in_real_elf_): New field.
10476 (Symbol_table::add_from_pluginobj): New function.
10478 * testsuite/Makefile.am (AM_CFLAGS): New variable.
10479 (LIBDL): New variable.
10480 (LDADD): Add LIBDL.
10481 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
10482 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
10483 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
10484 (MOSTLYCLEANFILES): Likewise.
10485 * testsuite/Makefile.in: Regenerate.
10486 * testsuite/plugin_test.c: New file.
10487 * testsuite/plugin_test_1.sh: New file.
10488 * testsuite/plugin_test_2.sh: New file.
10490 2008-09-16 Ian Lance Taylor <iant@google.com>
10492 * target-reloc.h (relocate_section): Check whether a symbol is
10493 defined by the ABI before reporting an undefined symbol error.
10494 * target.h (Target::is_defined_by_abi): Make parameter const.
10495 (Target::do_is_defined_by_abi): Likewise.
10496 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
10497 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
10498 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
10499 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
10500 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
10501 * testsuite/Makefile.in: Rebuild.
10503 * fileread.cc (make_view): Add casts to avoid warning.
10505 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
10507 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
10508 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10510 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
10512 * options.h (General_options::output_is_executable): New.
10513 (General_options::output_is_pie): New.
10514 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
10515 for shared libraries.
10516 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10518 2008-09-11 Chris Demetriou <cgd@google.com>
10520 * options.h (origin): New -z option.
10521 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
10522 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
10525 2008-09-05 Cary Coutant <ccoutant@google.com>
10527 * fileread.cc (File_read::make_view): Add check for attempt to map
10528 beyond end of file.
10530 2008-09-05 Cary Coutant <ccoutant@google.com>
10532 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
10533 explicit instantiations.
10535 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
10538 * options.cc (General_options::finalize): Allow undefined symbols
10539 in shlibs if linking -shared.
10542 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
10543 symbols as not needing a dynsym entry.
10545 2008-08-20 Craig Silverstein <csilvers@google.com>
10547 * fileread.cc (File_read::open): Do not lock the file unless it
10548 was successfully opened.
10550 2008-08-14 Cary Coutant <ccoutant@google.com>
10552 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
10553 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
10554 * testsuite/tls_test.cc (struct int128): 128-bit struct
10555 for testing TLS relocs with non-zero addend.
10556 (v12): New TLS variable.
10558 (t_last): Add check for v12.
10559 * testsuite/tls_test.h (t12): New function.
10560 * testsuite/tls_test_main.cc (thread_routine): Call new test.
10562 2008-08-13 Ian Lance Taylor <iant@google.com>
10564 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
10565 set tls_segment_ or relro_segment_.
10566 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
10568 * output.h (Output_section::clear_is_relro): New function.
10569 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
10570 sections specially even when output_data_ is empty.
10571 (Output_segment::maximum_alignment): When first section is relro,
10572 only force alignment for PT_LOAD segments.
10573 * script.cc (script_data_segment_align): New function.
10574 (script_data_segment_relro_end): New function.
10575 * script-c.h (script_data_segment_align): Declare.
10576 (script_data_segment_relro_end): Declare.
10577 * script-sections.h (class Script_sections): Declare
10578 data_segment_align and data_segment_relro_end. Add fields
10579 segment_align_index_ and saw_relro_end_.
10580 * script-sections.cc (class Sections_element): Add set_is_relro
10581 virtual function. Add new bool* parameter to place_orphan_here.
10582 Add get_output_section virtual function.
10583 (class Output_section_definition): Add set_is_relro. Add new
10584 bool* parameter to place_orphan_here. Add get_output_section.
10585 Add is_relro_ field.
10586 (Output_section_definition::Output_section_definition): Initialize
10587 evaluated_address_, evaluated_load_address, evaluated_addralign_,
10588 and is_relro_ fields.
10589 (Output_section_definition::place_orphan_here): Add is_relro
10591 (Output_section_definition::set_section_addresses): Set relro for
10593 (Output_section_definition::alternate_constraint): Likewise.
10594 (class Orphan_output_section): Add new bool* parameter to
10595 place_orphan_here. Add get_output_section.
10596 (Orphan_output_section::place_orphan_here): Add is_relro
10598 (Script_sections::Script_sections): Initialize
10599 data_segment_align_index_ and saw_relro_end_.
10600 (Script_sections::data_segment_align): New function.
10601 (Script_sections::data_segment_relro_end): New function.
10602 (Script_sections::place_orphan): Set or clear is_relro.
10603 (Script_sections::set_section_addresses): Force alignment of first
10605 * yyscript.y (exp): Call script_data_segment_align and
10606 script_data_segment_relro_end.
10607 * testsuite/relro_script_test.t: New file.
10608 * testsuite/relro_test.cc (using_script): Declare.
10609 (t1, t2): Test using_script.
10610 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
10611 (relro_script_test_SOURCES): Define.
10612 (relro_script_test_DEPENDENCIES): Define.
10613 (relro_script_test_LDFLAGS): Define.
10614 (relro_script_test_LDADD): Define.
10615 (relro_script_test.so): New target.
10616 * testsuite/Makefile.in: Rebuild.
10618 2008-08-06 Cary Coutant <ccoutant@google.com>
10620 * archive.cc (Archive::total_archives, Archive::total_members)
10621 (Archive::total_members_loaded): New variables.
10622 (Archive::setup): Add parameter. Add option to preread
10624 (Archive::read_armap): Add counter.
10625 (Archive::get_file_and_offset): New function.
10626 (Archive::get_elf_object_for_member): New function.
10627 (Archive::read_all_symbols): New function.
10628 (Archive::read_symbols): New function.
10629 (Archive::add_symbols): Add counters.
10630 (Archive::include_all_members): Use armap to find members if it's
10632 (Archive::include_member): Skip reading symbols if already read.
10633 Factored code into Archive::get_file_and_offset and
10634 Archive::get_elf_object_for_member. Changed call to
10635 Mapfile::report_include_archive_member.
10636 (Archive::print_stats): New function.
10637 * archive.h: Declare Object and Read_symbols_data classes.
10638 (Archive::Archive): Add initializers for new members.
10639 (Archive::setup): Add parameter.
10640 (Archive::print_stats): New function.
10641 (Archive::total_archives, Archive::total_members)
10642 (Archive::total_members_loaded): New variables.
10643 (Archive::get_file_and_offset): New function.
10644 (Archive::get_elf_object_for_member): New function.
10645 (Archive::read_all_symbols): New function.
10646 (Archive::read_symbols): New function.
10647 (Archive::Archive_member): New class.
10648 (Archive::members_): New member.
10649 (Archive::num_members_): New member.
10650 * main.cc: Include archive.h.
10651 (main): Call Archive::print_stats.
10652 * mapfile.cc (Mapfile::report_include_archive_member): Delete
10653 archive parameter; member_name is now the fully-decorated name.
10654 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
10655 * options.h: (General_options): Add --preread-archive-symbols option.
10656 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
10659 2008-08-04 Ian Lance Taylor <iant@google.com>
10661 * symtab.h (Symbol::use_plt_offset): New function.
10662 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
10663 * powerpc.cc (Relocate::relocate): Likewise.
10664 * sparc.cc (Relocate::relocate): Likewise.
10665 * x86_64.cc (Relocate::relocate): Likewise.
10666 * testsuite/weak_plt.sh: New test.
10667 * testsuite/weak_plt_main.cc: New test.
10668 * testsuite/weak_plt_shared.cc: New test.
10669 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
10670 (check_PROGRAMS): Add weak_plt.
10671 (check_DATA): Add weak_plt_shared.so.
10672 (weak_plt_main_pic.o, weak_plt): New targets.
10673 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
10674 * testsuite/Makefile.in: Rebuild.
10676 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
10678 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
10679 * testsuite/Makefile.in: Rebuild.
10681 2008-08-04 Alan Modra <amodra@bigpond.net.au>
10683 * Makefile.am (POTFILES.in): Set LC_ALL=C.
10684 * Makefile.in: Regenerate.
10685 * po/POTFILES.in: Regenerate.
10687 2008-07-29 Ian Lance Taylor <iant@google.com>
10689 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
10690 symbols before other symbols.
10691 * testsuite/script_test_2.cc (test_addr): Declare.
10692 (test_addr_alias): Declare.
10693 (main): Check that test_addr and test_addr_alias have the right
10695 * testsuite/script_test_2.t: Define test_addr_alias and
10698 2008-07-24 Ian Lance Taylor <iant@google.com>
10701 * descriptors.cc: New file.
10702 * descriptors.h: New file.
10703 * gold-threads.h (class Hold_optional_lock): New class.
10704 * fileread.cc: Include "descriptors.h".
10705 (File_read::~File_read): Release descriptor rather than closing
10707 (File_read::open) [file]: Call open_descriptor rather than open.
10708 Set is_descriptor_opened_.
10709 (File_read::open) [memory]: Assert that descriptor is not open.
10710 (File_read::reopen_descriptor): New function.
10711 (File_read::release): Release descriptor.
10712 (File_read::do_read): Make non-const. Reopen descriptor.
10713 (File_read::read): Make non-const.
10714 (File_read::make_view): Reopen descriptor.
10715 (File_read::do_readv): Likewise.
10716 * fileread.h (class File_read): Add is_descriptor_opened_ field.
10717 Update declarations.
10718 * layout.cc: Include "descriptors.h".
10719 (Layout::create_build_id): Use open_descriptor rather than open.
10720 * output.cc: Include "descriptors.h".
10721 (Output_file::open): Use open_descriptor rather than open.
10722 * archive.cc (Archive::const_iterator): Change Archive to be
10724 (Archive::begin, Archive::end): Make non-const.
10725 (Archive::count_members): Likewise.
10726 * archive.h (class Archive): Update declarations.
10727 * object.h (Object::read): Make non-const.
10728 * Makefile.am (CCFILES): Add descriptors.cc.
10729 (HFILES): Add descriptors.h.
10730 * Makefile.in: Rebuild.
10733 * gold.h: Always include <clocale>. Add Solaris workarounds
10734 following code in binutils/sysdep.h.
10737 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
10738 this->eh_frame_hdr_ is NULL before using it.
10740 * dynobj.cc (Versions::Versions): Update comment.
10742 * dynobj.cc (Versions::Versions): If there is an soname, use it as
10743 the base version name.
10745 * stringpool.cc (Stringpool_template::add_with_length): Set key to
10746 array size plus one.
10747 (Stringpool_template::set_string_offsets): Subtract one from key
10748 before using it as an array index.
10749 (Stringpool_template::get_offset_with_length): Likewise.
10750 (Stringpool_template::write_to_buffer): Likewise.
10751 * stringpool.h (Stringpool_template::get_offset_from_key):
10754 2008-07-23 Ian Lance Taylor <iant@google.com>
10757 * object.h (Merged_symbol_value::value): Do our best to handle a
10761 * script.cc (Version_script_info::get_versions): Don't add empty
10762 version tag to return value.
10763 (Version_script_info::get_symbol_version_helper): Change return
10764 type to bool. Add pversion parameter. Change all callers.
10765 (script_register_vers_node): Don't require a non-NULL tag.
10766 * script.h (class Version_script_info): Update declarations.
10767 (Version_script_info::get_symbol_version): Change return type to
10768 bool. Add version parameter. Change all callers.
10769 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
10770 handling. Handle an empty version from a version script.
10771 (Symbol_table::define_special_symbol): Likewise.
10772 * testsuite/ver_test_10.script: New file.
10773 * testsuite/ver_test_10.sh: New file.
10774 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
10775 (check_DATA): Add ver_test_10.syms.
10776 (ver_test_10.syms, ver_test_10.so): New target.
10777 * testsuite/Makefile.in: Rebuild.
10779 2008-07-23 Simon Baldwin <simonb@google.com>
10781 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
10782 to zero for undefined symbols from dynamic libraries.
10784 2008-07-23 Ian Lance Taylor <iant@google.com>
10786 * symtab.cc (Symbol_table::resolve): Remove version parameter.
10787 Change all callers.
10788 * symtab.h (class Symbol_table): Update declaration.
10789 * testsuite/ver_test_9.cc: New file.
10790 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
10791 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
10792 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
10793 (ver_test_9.so, ver_test_9.o): New targets.
10794 * testsuite/Makefile.in: Rebuild.
10796 2008-07-22 Ian Lance Taylor <iant@google.com>
10798 * options.h (class General_options): Define --check-sections.
10799 * layout.cc (Layout::set_segment_offsets): Handle
10802 * options.h (class General_options): Define -n/--nmagic and
10804 * options.cc (General_options::finalize): For -n/--nmagic or
10805 -N/--omagic, set -static.
10806 * layout.cc (Layout::attach_allocated_section_to_segment): If
10807 -N/--omagic, don't put read-only and read-write sections in
10808 different segments.
10809 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
10810 finding a read-only segment.
10811 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
10812 don't set the minimum segment alignment to the common page size,
10813 and don't set the file offset to the address modulo the page size.
10814 * script-sections.cc (Script_sections::create_segments): If
10815 -n/--omagic, don't put read-only and read-write sections in
10816 different segments.
10818 * cref.cc: New file.
10819 * cref.h: New file.
10820 * options.h (class General_options): Add --print-symbol-counts.
10821 * main.cc (main): Issue defined symbol report if requested.
10822 * archive.cc (Archive::interpret_header): Make into a const member
10824 (Archive::add_symbols): Call Input_objects::archive_start and
10826 (Archive::const_iterator): Define new class.
10827 (Archive::begin, Archive::end): New functions.
10828 (Archive::include_all_members): Rewrite to use iterator.
10829 (Archive::count_members): New function.
10830 * archive.h (class Archive): Update declarations.
10831 (Archive::filename): New function.
10832 * object.cc: Include "cref.h".
10833 (Sized_relobj::Sized_relobj): Initialize defined_count_.
10834 (Sized_relobj::do_get_global_symbol_counts): New function.
10835 (Input_objects::add_object): Add object to cross-referencer.
10836 (Input_objects::archive_start): New function.
10837 (Input_objects::archive_stop): New function.
10838 (Input_objects::print_symbol_counts): New function.
10839 * object.h: Declare Cref and Archive.
10840 (Object::get_global_symbol_counts): New function.
10841 (Object::do_get_global_symbol_counts): New pure virtual function.
10842 (class Sized_relobj): Add defined_count_ field. Update
10844 (class Input_objects): Add cref_ field. Update constructor.
10845 Update declarations.
10846 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
10848 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
10850 (Sized_dynobj::do_get_global_symbol_counts): New function.
10851 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
10852 defined_count_. Update declarations. Define Symbols typedef.
10853 * symtab.cc (Symbol_table::add_from_relobj): Add defined
10854 parameter. Change all callers.
10855 (Symbol_table::add_from_dynobj): Add sympointers and defined
10856 parameters. Change all callers.
10857 * symtab.h (class Symbol_table): Update declarations.
10858 * Makefile.am (CCFILES): Add cref.cc.
10859 (HFILES): Add cref.h.
10860 * Makefile.in: Rebuild.
10862 2008-07-22 Simon Baldwin <simonb@google.com>
10864 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
10865 to zero when writing undefined symbols.
10867 2008-07-22 Ian Lance Taylor <iant@google.com>
10869 * output.cc (Output_section::add_input_section): Don't try to
10870 merge empty merge sections.
10872 2008-07-21 Craig Silverstein <csilvers@google.com>
10874 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10875 Include symbol version in error message.
10877 2008-07-20 Chris Demetriou <cgd@google.com>
10879 * configure.ac (gold_cv_c_random_seed): New configured variable.
10880 (RANDOM_SEED_CFLAGS): New substituted variable.
10881 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
10882 * configure: Rebuild.
10883 * Makefile.in: Likewise.
10884 * testsuite/Makefile.in: Likewise.
10886 2008-07-18 Ian Lance Taylor <iant@google.com>
10888 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
10889 where we see NAME/NULL and NAME/VERSION as separate symbols.
10890 * testsuite/ver_test_main.cc (main): Call t4.
10891 (t4, t4_2a): Define.
10892 * testsuite/ver_test_2.cc (t4_2): Define.
10893 * testsuite/ver_test_2.script: Put t4_2a in VER2.
10894 * testsuite/ver_test_4.cc (t4_2a): Define.
10895 * testsuite/ver_test_4.script: Put t4_2a in VER2.
10896 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
10898 2008-07-17 Ian Lance Taylor <iant@google.com>
10900 * dynobj.cc (Versions::add_def): If we give an error about a
10901 missing version, go ahead and create the version anyhow.
10903 2008-07-10 Ian Lance Taylor <iant@google.com>
10905 Handle output sections with more than 0x7fffffff bytes.
10906 * object.h (class Relobj): Change map_to_output_ to
10907 output_sections_, and just keep a section pointer. Change all
10908 uses. Move comdat group support to Sized_relobj.
10909 (Relobj::is_section_specially_mapped): Remove.
10910 (Relobj::output_section): Remove poff parameter. Change all
10912 (Relobj::output_section_offset): New function.
10913 (Relobj::set_section_offset): Rewrite.
10914 (Relobj::map_to_output): Remove.
10915 (Relobj::output_sections): New function.
10916 (Relobj::do_output_section_offset): New pure virtual function.
10917 (Relobj::do_set_section_offset): Likewise.
10918 (class Sized_relobj): Add section_offsets_ field. Add comdat
10919 group support from Relobj. Update declarations.
10920 (Sized_relobj::get_output_section_offset): New function.
10921 (Sized_relobj::do_output_section_offset): New function.
10922 (Sized_relobj::do_set_section_offset): New function.
10923 * object.cc (Relobj::output_section_address): Remove.
10924 (Sized_relobj::Sized_relobj): Initialize new fields.
10925 (Sized_relobj::include_section_group): Cast find_kept_object to
10927 (Sized_relobj::include_linkonce_section): Likewise.
10928 (Sized_relobj::do_layout): Use separate arrays for output section
10930 (Sized_relobj::do_count_local_symbols): Change map_to_output to
10932 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
10933 output_sections and section_offsets.
10934 (Sized_relobj::write_local_symbols): Likewise.
10935 (map_to_kept_section): Compute output address directly.
10936 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
10937 output_sections and section_offsets.
10938 (Sized_relobj::write_sections): Likewise.
10939 (Sized_relobj::relocate_sections): Likewise.
10940 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
10941 * output.h (class Output_reloc): Update declarations. Change
10942 u2_.relobj to Sized_relobj*.
10943 (class Output_data_reloc): Change add functions to use
10945 * output.cc (Output_reloc::Output_reloc): Change relobj to
10947 (Output_reloc::local_section_offset): Change return type to
10948 Elf_Addr. Use get_output_section_offset.
10949 (Output_reloc::get_address): Likewise.
10950 (Output_section::is_input_address_mapped): Don't call
10951 is_section_specially_mapped.
10952 (Output_section::output_offset): Likewise.
10953 (Output_section::output_address): Likewise.
10954 (Output_section::starting_output_address): Likewise.
10955 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
10956 parameter to Sized_relobj*.
10957 (Copy_relocs::need_copy_reloc): Likewise.
10958 (Copy_relocs::save): Likewise.
10959 * copy-relocs.h (class Copy_relocs): Update declarations.
10960 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
10961 Sized_relobj*. Change relobj_ field to Sized_relobj*.
10962 * target-reloc.h (relocate_for_relocatable): Change
10963 offset_in_output_section type to Elf_Addr. Change code that uses
10965 * layout.cc (Layout::layout): Always set *off.
10966 * mapfile.cc (Mapfile::print_input_section): Use
10967 output_section_offset.
10968 * i386.cc (Target_i386::copy_reloc): Change object parameter to
10970 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
10971 * sparc.cc (Target_sparc::copy_reloc): Likewise.
10972 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
10974 2008-07-03 Ian Lance Taylor <iant@google.com>
10976 * layout.cc (Layout::include_section): Do not discard unrecognized
10977 SHT_STRTAB sections.
10979 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
10981 * script.cc (Lex::can_continue_name): Make '?' allowable in
10982 version-script names.
10983 * testsuite/version_script.map: Change glob pattern to use '?'
10985 2008-06-30 Manish Singh <yosh@gimp.org>
10988 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
10991 2008-06-30 Ian Lance Taylor <iant@google.com>
10995 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
10996 versions]: Don't try to read the value in the contents, since we
10997 don't use it. Use the template endianness when writing.
10999 2008-06-25 Cary Coutant <ccoutant@google.com>
11001 * fileread.cc (File_read::make_view): Assert on zero-length view.
11002 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
11003 symbol table when there are no symbols to read.
11005 2008-06-23 Craig Silverstein <csilvers@google.com>
11007 * version.cc (version_string): Bump to 1.7
11009 2008-06-18 Craig Silverstein <csilvers@google.com>
11011 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
11012 constant 0xFFFF to type Valtype.
11013 (Powerpc_relocate_functions::rel16_ha): Likewise.
11015 2008-06-17 Ian Lance Taylor <iant@google.com>
11017 * output.h (Output_section::Input_section): Initialize p2align_ to
11018 zero for Output_section_data constructors.
11019 (Output_section::Input_section::addralign): If not an input
11020 section, return the alignment of the Output_section_data.
11021 * testsuite/copy_test.cc: New file.
11022 * testsuite/copy_test_1.cc: New file.
11023 * testsuite/copy_test_2.cc: New file.
11024 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
11025 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
11026 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
11027 (copy_test_1_pic.o, copy_test_1.so): New targets.
11028 (copy_test_2_pic.o, copy_test_2.so): New targets.
11029 * testsuite/Makefile.in: Rebuild.
11031 * script-sections.cc (Script_sections::place_orphan): Initialize
11032 local variable exact.
11034 2008-06-13 David Edelsohn <edelsohn@gnu.org>
11036 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
11038 2008-06-12 David Edelsohn <edelsohn@gnu.org>
11039 David S. Miller <davem@davemloft.net>
11041 * powerpc.cc: New file.
11042 * Makefile.am (TARGETSOURCES): Add powerpc.cc
11043 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
11044 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
11045 * Makefile.in: Rebuild.
11047 2008-06-09 Ian Lance Taylor <iant@google.com>
11049 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
11051 (throwing, orig_terminate): New static variables.
11052 (terminate_handler): New static function.
11053 (t2): Set terminate handler.
11055 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
11058 * binary.cc (Binary_to_elf::sized_convert): Fix .data
11061 2008-05-30 Cary Coutant <ccoutant@google.com>
11063 * archive.cc (Archive::include_all_members) Correct to step
11064 over symbol table and extended name table in thin archives.
11066 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
11069 * target-reloc.h (relocate_for_relocatable): Fix new_offset
11072 2008-05-28 Caleb Howe <cshowe@google.com>
11074 * reduced_debug_output.cc: New file.
11075 * reduced_debug_output.h: New file.
11076 * options.h (class General_options): Add --strip-debug-non-line.
11077 * options.cc (General_options::finalize): Add strip_debug_non_line
11078 to the strip heirarchy.
11079 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
11081 * layout.cc: Include "reduced_debug_output.h".
11082 (Layout::Layout): Initialize new fields.
11083 (line_only_debug_sections): New static array.
11084 (is_lines_only_debug_sections): New static inline function.
11085 (Layout::include_section): Handle --strip-debug-non-line.
11086 (Layout::make_output_section): If --strip-debug-non-line, build
11087 new output sections for .debug_abbrev and .debug_info.
11088 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
11089 gold. Warn about possible overflow.
11090 (read_signed_LEB_128): Likewise.
11091 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
11092 (read_signed_LEB_128): Declare.
11093 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
11094 (HFILES): Add reduced_debug_output.h.
11095 * Makefile.in: Rebuild.
11097 2008-05-21 Ian Lance Taylor <iant@google.com>
11099 * mapfile.cc: New file.
11100 * mapfile.h: New file.
11101 * options.h (class General_options): Add -M/--print-map and -Map.
11102 * options.cc (General_options::finalize): Make -M equivalent to
11104 * main.cc: Include <cstdio> and "mapfile.h".
11105 (main): Open mapfile if requested.
11106 * gold.cc (class Middle_runner): Add mapfile_ field. Update
11107 constructor. Change caller.
11108 (queue_initial_tasks): Add mapfile parameter. Change caller.
11109 (queue_middle_tasks): Likewise.
11110 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
11112 * archive.cc: Include "mapfile.h".
11113 (Archive::add_symbols): Add mapfile parameter. Change all
11114 callers. Pass mapfile, symbol, and reason to include_member.
11115 (Archive::include_all_members): Add mapfile parameter. Change all
11117 (Archive::include_member): Add mapfile, sym, and why parameters.
11118 Change all callers. Report inclusion to map file.
11119 * archive.h: Include "fileread.h".
11120 (class Archive): Update declarations.
11121 (Archive::file): New const method.
11122 (class Add_archive_symbols): Add mapfile_ field. Update
11123 constructor. Change all callers.
11124 * readsyms.h (class Read_symbols): Likewise.
11125 (class Finish_group): Likewise.
11126 (class Read_script): Likewise.
11127 * common.cc: Include "mapfile.h".
11128 (Symbol_table::allocate_commons): Add mapfile parameter. Change
11130 (Symbol_table::do_allocate_commons): Likewise.
11131 (Symbol_table::do_allocate_commons_list): Likewise. Report common
11132 symbol allocation to mapfile.
11133 * common.h (class Allocate_commons_task): Add mapfile_ field.
11134 Update constructor. Change all callers.
11135 * symtab.h (class Symbol_table): Update declarations.
11136 * layout.cc: Include "mapfile.h".
11137 (Layout_task_runner::run): Print information to mapfile.
11138 (Layout::create_gold_note): Change Output_data_fixed_space to
11139 Output_data_zero_fill.
11140 (Layout::create_build_id): Likewise.
11141 (Layout::print_to_mapfile): New function.
11142 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
11143 constructor. Change caller.
11144 (class Layout): Declare print_to_mapfile.
11145 * output.cc (Output_section::Input_section::print_to_mapfile): New
11147 (Output_section::add_input_section): If producing a map, always
11148 add to input_sections_ list.
11149 (Output_section::do_print_to_mapfile): New function.
11150 (Output_segment::print_sections_to_mapfile): New function.
11151 (Output_segment::print_section_list_to_mapfile): New function.
11152 * output.h: Include "mapfile.h".
11153 (Output_data::print_to_mapfile): New function.
11154 (Output_data::do_print_to_mapfile): New virtual function.
11155 (Output_segment_headers::do_print_to_mapfile): New function.
11156 (Output_file_header::do_print_to_mapfile): New function.
11157 (Output_data_const::do_print_to_mapfile): New function.
11158 (class Output_data_const_buffer): Add map_name_ field. Update
11159 constructor. Change all callers. Add do_print_to_mapfile
11161 (class Output_data_fixed_space): Likewise.
11162 (class Output_data_space): Likewise.
11163 (class Output_data_zero_fill): New class.
11164 (Output_data_strtab::do_print_to_mapfile): New function.
11165 (Output_data_reloc_base::do_print_to_mapfile): New function.
11166 (Output_relocatable_relocs::do_print_to_mapfile): New function.
11167 (Output_data_group::do_print_to_mapfile): New function.
11168 (Output_data_got::do_print_to_mapfile): New function.
11169 (Output_data_dynamic::do_print_to_mapfile): New function.
11170 (Output_symtab_xindex::do_print_to_mapfile): New function.
11171 (class Output_section): Declare do_print_to_mapflie. Declare
11172 print_to_mapfile in Input_section.
11173 (class Output_segment): Declare new functions.
11174 * object.h (Sized_relobj::symbol_count): New function.
11175 * script-sections.cc
11176 (Output_section_element_dot_assignment::set_section_addresses):
11177 Change Output_data_fixed_space to Output_data_zero_fill.
11178 (Output_data_expression::do_print_to_mapfile): New function.
11179 * script.cc (read_input_script): Add mapfile parameter. Change
11181 * script.h (read_input_script): Update declaration.
11182 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
11183 (Eh_frame::do_print_to_mapfile): New function.
11184 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
11185 (Output_merge_string::do_print_to_mapfile): New function.
11186 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
11188 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
11190 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
11192 * Makefile.am (CCFILES): Add mapfile.cc.
11193 (HFILES): Add mapfile.h.
11194 * Makefile.in: Rebuild.
11196 2008-05-19 Ian Lance Taylor <iant@google.com>
11198 * options.h (class General_options): Add -z relro.
11199 * layout.cc (Layout::Layout): Initialize relro_segment_.
11200 (Layout::add_output_section_data): Return the output section.
11201 (Layout::make_output_section): Rcognize relro sections and mark
11202 them appropriately.
11203 (Layout::attach_allocated_section_to_segment): Put relro sections
11204 in a PT_GNU_RELRO segment.
11205 (Layout::create_initial_dynamic_sections): Mark the .dynamic
11207 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11209 (Layout::linkonce_mapping): Map d.rel.ro.local to
11210 .data.rel.ro.local.
11211 (Layout::output_section_name): Us .data.rel.ro.local for any
11212 section which begins with that.
11213 * layout.h (class Layout): Update add_output_section_data
11214 declaration. Add relro_segment_ field.
11215 * output.cc (Output_section::Output_section): Initialize is_relro_
11216 and is_relro_local_ fields.
11217 (Output_segment::add_output_section): Group relro sections.
11218 (Output_segment::is_first_section_relro): New function.
11219 (Output_segment::maximum_alignment): If there is a relro section,
11220 align the segment to the common page size.
11221 (Output_segment::set_section_addresses): Track whether we are
11222 looking at relro sections. If the last section is a relro
11223 section, align to the common page size.
11224 (Output_segment::set_section_list_addresses): Add in_relro
11225 parameter. Change all callers. Align to the page size when
11226 moving from relro to non-relro section.
11227 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
11229 * output.h (class Output_section): Add is_relro_ and
11230 is_relro_local_ fields.
11231 (Output_section::is_relro): New function.
11232 (Output_section::set_is_relro): New function.
11233 (Output_section::is_relro_local): New function.
11234 (Output_section::set_is_relro_local): New function.
11235 (class Output_segment): Update declarations.
11236 * i386.cc (Target_i386::got_section): Mark .got section as relro.
11237 * sparc.cc (Target_sparc::got_section): Likewise.
11238 * x86_64.cc (Target_x86_64::got_section): Likewise.
11239 * testsuite/relro_test_main.cc: New file.
11240 * testsuite/relro_test.cc: New file.
11241 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11242 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11243 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11244 (relro_test.so, relro_test_pic.o): New targets.
11245 * testsuite/Makefile.in: Rebuild.
11247 2008-05-16 Ian Lance Taylor <iant@google.com>
11249 * output.cc (Output_segment::add_output_section): Remove front
11251 * output.h (class Output_segment): Remove
11252 add_initial_output_section and overloaded add_output_section.
11253 Update declaration of remaining add_output_section.
11254 * layout.cc (Layout::create_interp): Call add_output_section
11255 rather than add_initial_output_section.
11256 (Layout::finish_dynamic_section): Likewise.
11258 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
11259 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
11260 know the dynamic type.
11261 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
11262 field. Initialize it in constructor.
11263 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
11264 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
11265 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
11268 * output.cc (Output_reloc::get_address): Change return type to
11270 * output.h (class Output_reloc): Update get_address declaration.
11271 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
11272 for section addresses.
11274 2008-05-09 Ian Lance Taylor <iant@google.com>
11277 * gold.cc (gold_nomem): Use return value of write.
11279 2008-05-08 Ian Lance Taylor <iant@google.com>
11281 * symtab.c (Symbol::init_base_output_data): Add version
11282 parameter. Change all callers.
11283 (Symbol::init_base_output_segment): Likewise.
11284 (Symbol::init_base_constant): Likewise.
11285 (Symbol::init_base_undefined): Likewise.
11286 (Sized_symbol::init_output_data): Likewise.
11287 (Sized_symbol::init_output_segment): Likewise.
11288 (Sized_symbol::init_constant): Likewise.
11289 (Sized_symbol::init_undefined): Likewise.
11290 (Symbol_table::do_define_in_output_data): If the new symbol has a
11291 version, mark it as the default.
11292 (Symbol_table::do_define_in_output_segment): Likewise.
11293 (Symbol_table::do_define_as_constant): Likewise.
11294 * symtab.h (class Symbol): Update declarations.
11295 (class Sized_symbol): Likewise.
11296 * resolve.cc (Symbol::override_version): New function.
11297 (Symbol::override_base): Call override_version.
11298 (Symbol::override_base_with_special): Likewise.
11299 * testsuite/ver_script_8.script: New file.
11300 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
11301 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
11302 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
11303 (ver_test_8_1.so, ver_test_8_2.so): New targets.
11305 2008-05-06 Ian Lance Taylor <iant@google.com>
11308 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
11310 (class General_options): Remove existing --undefined, and add
11311 --no-undefined instead. Add new --undefined as synonym for -u.
11312 * archive.cc (Archive::add_symbols): Check whether symbol was
11314 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
11315 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
11316 all uses. Add IS_UNDEFINED. Update declarations to split
11317 different versions of init_base. Declare init_base_undefined.
11318 (Symbol::is_defined): Handle IS_UNDEFINED.
11319 (Symbol::is_undefined): Likewise.
11320 (Symbol::is_weak_undefined): Call is_undefined.
11321 (Symbol::is_absolute): Handle IS_CONSTANT.
11322 (class Sized_symbol): Update declarations to split different
11323 versions of init. Declare init_undefined.
11324 (class Symbol_table): Declare new functions.
11325 * symtab.cc (Symbol::init_base_object): Rename from init_base.
11326 Change all callers.
11327 (Symbol::init_base_output_data): Likewise.
11328 (Symbol::init_base_output_segment): Likewise.
11329 (Symbol::init_base_constant): Likewise.
11330 (Symbol::init_base_undefined): New function.
11331 (Sized_symbol::init_object): Rename from init. Change all
11333 (Sized_symbol::init_output_data): Likewise.
11334 (Sized_symbol::init_output_segment): Likewise.
11335 (Sized_symbol::init_constant): Likewise.
11336 (Sized_symbol::init_undefined): New function.
11337 (Symbol_table::add_undefined_symbols_from_command_line): New
11339 (Symbol_table::do_add_undefined_symbols_from_command_line): New
11341 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
11342 (Symbol::output_section): Likewise.
11343 (Symbol::set_output_section): Likewise.
11344 (Symbol_table::sized_finalize_symbol): Likewise.
11345 (Symbol_table::sized_write_globals): Likewise.
11346 * resolve.cc (Symbol_table::should_override): Likewise.
11347 (Symbol::override_base_with_special): Likewise.
11349 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
11350 symbol, change it to have default visibility.
11351 * testsuite/protected_1.cc: New file.
11352 * testsuite/protected_2.cc: New file.
11353 * testsuite/protected_3.cc: New file.
11354 * testsuite/protected_main_1.cc: New file.
11355 * testsuite/protected_main_2.cc: New file.
11356 * testsuite/protected_main_3.cc: New file.
11357 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
11358 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
11359 (protected_1_LDFLAGS, protected_1_LDADD): Define.
11360 (protected_1.so): New target.
11361 (protected_1_pic.o, protected_2_pic.o): New targets.
11362 (protected_3_pic.o): New target.
11363 (check_PROGRAMS): Add protected_2.
11364 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
11365 (protected_2_LDFLAGS, protected_2_LDADD): Define.
11366 * testsuite/Makefile.in: Rebuild.
11368 * options.h (DEFINE_var): Add set_user_set_##varname__.
11369 (DEFINE_bool_alias): New macro.
11370 (class General_options): Define -Bstatic using DEFINE_bool_alias
11371 rather than DEFINE_special. Add --undefined as an alias for -z
11373 * options.cc (General_options::parse_Bstatic): Remove.
11375 * options.h (class General_options): Add --fatal-warnings.
11376 * main.cc (main): Implement --fatal-warnings.
11377 * errors.h (Errors::warning_count): New function.
11379 * options.h (class General_options): Add -Bsymbolic-functions.
11380 * symtab.h (Symbol::is_preemptible): Check for
11381 -Bsymbolic-functions.
11383 2008-05-05 Ian Lance Taylor <iant@google.com>
11385 * options.h (DEFINE_bool): For DASH_Z, create the negative option
11386 as noVARNAME rather than no-VARNAME.
11387 (class General_options): Add option -z combreloc.
11388 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
11390 (Output_reloc::sort_before) [SHT_REL]: New function.
11391 (Output_reloc::sort_before) [SHT_RELA]: New function.
11392 (class Output_data_reloc_base): Add sort_relocs_ field. Define
11393 Sort_relocs_comparison.
11394 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
11395 parameter. Change all callers.
11396 (Output_data_reloc::Output_data_reloc) [both versions]: Add
11397 sort_relocs parameter. Change all callers.
11398 * output.cc (Output_reloc::get_address): New function, broken out
11400 (Output_reloc::write_rel): Call it.
11401 (Output_reloc::compare): New function.
11402 (Output_data_reloc_base::do_write): Optionally sort relocs.
11404 * configure.ac: If targ_extra_obj is set, link it in.
11405 * configure.tgt: Initialize all variables.
11406 (x86_64*): Set targ_extra_obj and targ_extra_size.
11407 * configure: Rebuild.
11409 * object.cc (Sized_relobj::include_section_group): Adjust section
11410 indexes read from group data. Build vector to pass to
11412 * layout.cc (Layout::layout_group): Add flags and shndxes
11413 parameters. Remove contents parameter. Change caller. Update
11414 explicit instantiations.
11415 * layout.h (class Layout): Update layout_group declaration.
11416 * output.cc (Output_data_group::Output_data_group): Add flags and
11417 input_shndxes parameters. Remove contents parameter. Change
11419 (Output_data_group::do_write): Change input_sections_ to
11421 * output.h (class Output_data_group): Update constructor
11422 declaration. Rename input_sections_ to input_shndxes_.
11423 * testsuite/many_sections_test.cc: Add template.
11425 2008-04-30 Cary Coutant <ccoutant@google.com>
11427 * target-reloc.h (relocate_section): Fix dead-pointer bug.
11429 * layout.cc (Layout::include_section): Refactored check for debug
11431 (Layout::add_comdat): Add new parameters. Change type
11432 of signature parameter. Add object and shndx to signatures table.
11433 (Layout::find_kept_object): New function.
11434 * layout.h: Include <cstring>.
11435 (Layout::is_debug_info_section): New function.
11436 (Layout::add_comdat): Add new parameters.
11437 (Layout::find_kept_object): New function.
11438 (Layout::Kept_section): New struct.
11439 (Layout::Signatures): Change type of map range.
11440 * object.cc (Relobj::output_section_address): New function.
11441 (Sized_relobj::include_section_group): Add new parameters. Change
11442 calls to Layout::add_comdat. Change to build table of kept comdat
11443 groups and table mapping discarded sections to kept sections.
11444 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
11445 (Sized_relobj::do_layout): Change calls to include_section_group and
11446 include_linkonce_section.
11447 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
11448 value to zero when section is discarded.
11449 (Sized_relobj::map_to_kept_section): New function.
11450 * object.h (Relobj::output_section_address): New function.
11451 (Relobj::Comdat_group): New type.
11452 (Relobj::find_comdat_group): New function.
11453 (Relobj::Comdat_group_table): New type.
11454 (Relobj::Kept_comdat_section): New type.
11455 (Relobj::Kept_comdat_section_table): New type.
11456 (Relobj::add_comdat_group): New function.
11457 (Relobj::set_kept_comdat_section): New function.
11458 (Relobj::get_kept_comdat_section): New function.
11459 (Relobj::comdat_groups_): New field.
11460 (Relobj::kept_comdat_sections_): New field.
11461 (Symbol_value::input_value): Update comment.
11462 (Sized_relobj::map_to_kept_section) New function.
11463 (Sized_relobj::include_linkonce_section): Add new parameter.
11464 * target-reloc.h (Comdat_behavior): New type.
11465 (get_comdat_behavior): New function.
11466 (relocate_section): Add code to map a discarded section to the
11467 corresponding kept section when applying a relocation.
11469 2008-04-30 Craig Silverstein <csilvers@google.com>
11471 * dwarf_reader.cc (next_generation_count): New static var.
11472 (Addr2line_cache_entry): New struct.
11473 (addr2line_cache): New static var.
11474 (Dwarf_line_info::one_addr2line): Added caching.
11475 (Dwarf_line_info::clear_addr2line_cache): New function.
11476 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
11477 cache-size parameter.
11478 (Dwarf_line_info::one_addr2line_cache): New function.
11479 * symtab.cc (Symbol_table::detect_odr_violations): Pass
11480 new cache-size argument to one_addr2line(), and clear cache.
11482 2008-04-28 Cary Coutant <ccoutant@google.com>
11484 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
11485 R_386_PC8 relocations.
11487 2008-04-23 Ian Lance Taylor <iant@google.com>
11489 * object.cc (Sized_relobj::include_section_group): Check for
11490 invalid section group.
11492 * object.cc (make_elf_object): Correct test for 64-bit ELF file
11495 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
11496 than read for file header.
11497 * archive.cc (Archive::include_member): Likewise.
11499 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
11501 * aclocal.m4: Regenerate.
11502 * configure: Regenerate.
11504 2008-04-19 Ian Lance Taylor <iant@google.com>
11506 * version.cc (version_string): Bump to 1.6.
11508 * testsuite/Makefile.am (many_sections_r_test): New target.
11509 (many_sections_r_test_SOURCES): Remove.
11510 (many_sections_r_test_DEPENDENCIES): Remove.
11511 (many_sections_r_test_LDFLAGS): Remove.
11512 (many_sections_r_test_LDADD): Remove.
11514 * object.cc (Sized_relobj::do_add_symbols): Always pass
11515 local_symbol_count_ to add_from_relobj.
11517 * testsuite/Makefile.am (many_sections_check.h): Only check one in
11518 every thousand variables.
11519 * testsuite/Makefile.in: Rebuild.
11521 * object.cc (Xindex::initialize_symtab_xindex): New function.
11522 (Xindex::read_symtab_xindex): New function.
11523 (Xindex::sym_xindex_to_shndx): New function.
11524 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
11526 (Sized_relobj::do_initialize_xindex): New function.
11527 (Sized_relobj::do_read_symbols): Adjust section links.
11528 (Sized_relobj::symbol_section_and_value): Add is_ordinary
11529 parameter. Change all callers.
11530 (Sized_relobj::include_section_group): Adjust section links and
11531 symbol section indexes.
11532 (Sized_relobj::do_layout): Adjust section links.
11533 (Sized_relobj::do_count_local_symbols): Adjust section links and
11534 symbol section indexes.
11535 (Sized_relobj::do_finalize_local_symbols): Distinguish between
11536 ordinary and special symbols.
11537 (Sized_relobj::write_local_symbols): Add symtab_xindex and
11538 dynsym_xindex parameters. Change all callers. Adjust section
11539 links. Use SHN_XINDEX when needed.
11540 (Sized_relobj::get_symbol_location_info): Adjust section links.
11541 Don't get fooled by special symbols.
11542 * object.h (class Xindex): Define.
11543 (class Object): Add xindex_ parameter. Declare virtual functoin
11544 do_initialize_xindex.
11545 (Object::adjust_sym_shndx): New function.
11546 (Object::set_xindex): New protected function.
11547 (class Symbol_value): Add is_ordinary_shndx_ field.
11548 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
11549 (Symbol_value::value): Assert ordinary section.
11550 (Symbol_value::initialize_input_to_output_map): Likewise.
11551 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
11552 Change all callers.
11553 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
11555 (class Sized_relobj): Update declarations.
11556 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
11557 parameter. Change all callers.
11558 (Sized_relobj::adjust_shndx): New function.
11559 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
11561 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
11562 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
11563 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
11564 (Sized_dynobj::read_dynsym_section): Adjust section links.
11565 (Sized_dynobj::read_dynamic): Likewise.
11566 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
11568 (Sized_dynobj::do_initialize_xindex): New function.
11569 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
11570 do_initialize_xindex.
11571 (Sized_dynobj::adjust_shndx): New function.
11572 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
11573 dynsym_xindex_ fields.
11574 (Layout::finalize): Add a call to set_section_indexes before
11575 creating the symtab sections.
11576 (Layout::set_section_indexes): Don't do anything if the section
11577 already has a section index.
11578 (Layout::create_symtab_sections): Add shnum parameter. Change
11579 caller. Create .symtab_shndx section if needed.
11580 (Layout::create_shdrs): Add shstrtab_section parameter. Change
11582 (Layout::allocated_output_section_count): New function.
11583 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
11585 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
11586 fields. Update declarations.
11587 (Layout::symtab_xindex): New function.
11588 (Layout::dynsym_xindex): New function.
11589 (class Write_symbols_task): Add layout_ field.
11590 (Write_symbols_task::Write_symbols_task): Add layout parameter.
11592 * output.cc (Output_section_headers::Output_section_headers): Add
11593 shstrtab_section parameter. Change all callers.
11594 (Output_section_headers::do_sized_write): Store overflow values
11595 for section count and section string table section index in
11596 section header zero.
11597 (Output_file_header::do_sized_write): Check for overflow of
11598 section count and section string table section index.
11599 (Output_symtab_xindex::do_write): New function.
11600 (Output_symtab_xindex::endian_do_write): New function.
11601 * output.h (class Output_section_headers): Add shstrtab_section_.
11602 Update declarations.
11603 (class Output_symtab_xindex): Define.
11604 (Output_section::has_out_shndx): New function.
11605 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
11607 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
11608 Change all callers.
11609 (Sized_symbol::init): Likewise.
11610 (Symbol::output_section): Check for ordinary symbol.
11611 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
11612 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
11614 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
11615 Change all callers. Simplify handling of symbols from sections
11616 not included in the link.
11617 (Symbol_table::add_from_dynobj): Handle ordinary symbol
11619 (Weak_alias_sorter::operator()): Assert that symbols are
11621 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
11623 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
11624 parameters. Change all callers.
11625 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
11626 symbol distinction. Use SHN_XINDEX when needed.
11627 (Symbol_table::write_section_symbol): Add symtab_xindex
11628 parameter. Change all callers.
11629 (Symbol_table::sized_write_section_symbol): Likewise. Use
11630 SHN_XINDEX when needed.
11631 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
11633 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
11634 (Symbol::is_defined): Check is_ordinary.
11635 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
11636 (Symbol::is_absolute, Symbol::is_common): Likewise.
11637 (class Sized_symbol): Update declarations.
11638 (class Symbol_table): Update declarations.
11639 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
11640 parameters. Change all callers.
11641 (Sized_symbol::override): Likewise.
11642 (Symbol_table::override): Likewise.
11643 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
11644 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
11645 is_ordinary, and orig_st_shndx parameters. Change all callers.
11646 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
11647 to be in an ordinary section.
11648 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
11649 object and is_ordinary parameters. Change all callers.
11650 (Sized_dwarf_line_info::read_relocs): Add object parameter.
11651 Change all callers. Don't add undefined or non-ordinary symbols
11653 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
11654 Change all callers.
11655 * dwarf_reader.h (class Sized_dwarf_line_info): Update
11657 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
11658 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
11659 (Sized_relobj::relocate_sections): Likewise.
11660 * target-reloc.h (scan_relocs): Adjust section symbol index.
11661 (scan_relocatable_relocs): Likewise.
11662 * i386.cc (Scan::local): Check for ordinary symbols.
11663 * sparc.cc (Scan::local): Likewise.
11664 * x86_64.cc (Scan::local): Likewise.
11665 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
11666 to symbol_section_and_value.
11667 * testsuite/many_sections_test.cc: New file.
11668 * testsuite/Makefile.am (BUILT_SOURCES): Define.
11669 (check_PROGRAMS): Add many_sections_test.
11670 (many_sections_test_SOURCES): Define.
11671 (many_sections_test_DEPENDENCIES): Define.
11672 (many_sections_test_LDFLAGS): Define.
11673 (BUILT_SOURCES): Add many_sections_define.h.
11674 (many_sections_define.h): New target.
11675 (BUILT_SOURCES): Add many_sections_check.h.
11676 (many_sections_check.h): New target.
11677 (check_PROGRAMS): Add many_sections_r_test.
11678 (many_sections_r_test_SOURCES): Define.
11679 (many_sections_r_test_DEPENDENCIES): Define.
11680 (many_sections_r_test_LDFLAGS): Define.
11681 (many_sections_r_test_LDADD): Define.
11682 (many_sections_r_test.o): New target.
11683 * testsuite/Makefile.in: Rebuild.
11685 2008-04-17 Cary Coutant <ccoutant@google.com>
11687 * errors.cc (Errors::info): New function.
11688 (gold_info): New function.
11689 * errors.h (Errors::info): New function.
11690 * gold.h (gold_info): New function.
11691 * object.cc (Input_objects::add_object): Print trace output.
11692 * options.cc (options::parse_set): New function.
11693 (General_options::parse_wrap): Deleted.
11694 (General_options::General_options): Deleted initializer.
11695 * options.h (options::String_set): New typedef.
11696 (options::parse_set): New function.
11697 (DEFINE_set): New macro.
11698 (General_options::wrap): Changed to use DEFINE_set. Changed
11699 callers of any_wrap_symbols and is_wrap_symbol.
11700 (General_options::trace, General_options::trace_symbol):
11702 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
11703 (General_options::wrap_symbols_): Deleted.
11704 * symtab.cc (Symbol_table::add_from_object): Print trace output.
11706 2008-04-17 David S. Miller <davem@davemloft.net>
11708 * options.cc (General_options::parse_V): New function.
11709 * options.h: Add entries for -V and -Qy.
11711 2008-04-17 Ian Lance Taylor <iant@google.com>
11713 * common.cc (Symbol_table::allocate_commons): Remove options
11714 parameter. Change caller.
11715 (Symbol_table::do_allocate_commons): Remove options parameter.
11716 Change caller. Just call do_allocate_commons_list twice.
11717 (Symbol_table::do_allocate_commons_list): New function, broken out
11718 of do_allocate_commons.
11719 * common.h (class Allocate_commons_task): Remove options_ field.
11720 Update constructor.
11721 * symtab.cc (Symbol_table::Symbol_table): Initialize
11723 (Symbol_table::add_from_object): Put TLS common symbols on
11725 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
11726 which are IN_OUTPUT_DATA.
11727 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
11728 allocate_commons and do_allocate_commons declarations. Declare
11729 do_allocate_commons_list.
11730 * gold.cc (queue_middle_tasks): Update creation of
11731 Allocate_commons_task to not pass options.
11732 * testsuite/Makefile.am (INCLUDES): Add -I.. .
11733 (TLS_TEST_C_FLAGS): New variable.
11734 (tls_test_c_pic.o): New target.
11735 (tls_test_shared.so): Link in tls_test_c_pic.o.
11736 (tls_test_c_pic_ie.o): New target.
11737 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
11738 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
11739 (tls_test_c.o): New target.
11740 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
11741 (tls_pic_test_LDADD): Likewise.
11742 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
11743 (tls_shared_gd_to_ie_test_LDADD): Likewise.
11744 (tls_test_c_gnu2.o): New target.
11745 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
11747 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
11748 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
11749 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
11750 * testsuite/tls_test.cc: Include "config.h".
11751 (t_last): Call t11_last.
11752 * testsuite/tls_test.h (t11, t11_last): Declare.
11753 * testsuite/tls_test_c.c: New file.
11754 * testsuite/tls_test_main.cc (thread_routine): Call t11.
11755 * configure.ac: Check for OpenMP support.
11756 * configure, config.in, Makefile.in: Rebuild.
11757 * testsuite/Makefile.in: Rebuild.
11759 2008-04-16 Cary Coutant <ccoutant@google.com>
11761 * i386.cc (Target_i386::define_tls_base_symbol): New function.
11762 (Target_i386::tls_base_symbol_defined_): New field.
11763 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11764 (Target_i386::Scan::global): Likewise.
11765 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
11766 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
11767 (Target_x86_64::tls_base_symbol_defined_): New field.
11768 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11769 (Target_x86_64::Scan::global): Likewise.
11771 2008-04-16 Cary Coutant <ccoutant@google.com>
11773 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
11774 (Symbol::needs_plt_entry): Allow weak undefined symbols.
11775 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
11776 building shared libraries.
11777 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
11778 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
11779 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
11780 * testsuite/Makefile.in: Rebuild.
11781 * testsuite/weak_undef.h: New file.
11782 * testsuite/weak_undef_file1.cc: Add extra test cases.
11783 * testsuite/weak_undef_file2.cc: Likewise.
11784 * testsuite/weak_undef_test.cc: Likewise.
11786 2008-04-16 David S. Miller <davem@davemloft.net>
11788 * sparc.cc (Target_sparc::Scan): Change from struct to class.
11789 Add issued_non_pic_error_ field. Declare check_non_pic.
11790 (Target_sparc::Scan::check_non_pic): New function.
11791 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
11792 (Target_sparc::Scan::global): Likewise.
11794 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
11795 * configure: Rebuild.
11797 * options.h (DEFINE_enable): New macro.
11798 (new_dtags): New enable option.
11799 (initfirst, interpose, loadfltr, nodefaultlib,
11800 nodelete, nodlopen, nodump): New -z options.
11801 * layout.cc (Layout:finish_dynamic_section): If new
11802 dtags enabled, emit DT_RUNPATH. Also, emit a
11803 DT_FLAGS_1 containing any specified -z flags.
11805 2008-04-16 Ian Lance Taylor <iant@google.com>
11807 * copy-relocs.cc: New file.
11808 * copy-relocs.h: New file.
11809 * reloc.cc: Remove Copy_relocs code.
11810 * reloc.h: Likewise.
11811 * reloc-types.h (struct Reloc_types) [both versions]: Add
11812 get_reloc_addend_noerror.
11813 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
11814 variants of add_global which take an addend which must be zero.
11815 * i386.cc: Include "copy-relocs.h".
11816 (class Target_i386): Change type of copy_relocs_ to variable,
11817 update initializer.
11818 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
11819 Change all callers.
11820 (Target_i386::do_finalize_sections): Change handling of
11822 * sparc.cc: Include "copy-relocs.h".
11823 (class Target_sparc): Change type of copy_relocs_ to variable,
11824 update initializer.
11825 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
11826 Change all callers.
11827 (Target_sparc::do_finalize_sections): Change handling of
11829 * x86_64.cc: Include "copy-relocs.h".
11830 (class Target_x86_64): Change type of copy_relocs_ to variable,
11831 update initializer.
11832 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
11833 class. Change all callers.
11834 (Target_x86_64::do_finalize_sections): Change handling of
11836 * Makefile.am (CCFILES): Add copy-relocs.cc.
11837 (HFILES): Add copy-relocs.h.
11839 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
11841 * testsuite/script_test_4.sh: Permit leading zeroes.
11843 2008-04-15 Ian Lance Taylor <iant@google.com>
11845 * script-sections.cc (Script_sections::create_segments): Use
11846 header_size_adjustment even when there is enough room for the
11848 * testsuite/script_test_4.sh: New file.
11849 * testsuite/script_test_4.t: New file.
11850 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
11851 (check_DATA): Add script_test_4.stdout.
11852 (MOSTLYCLEANFILES): Likewise.
11853 (script_test_4): New target.
11854 (script_test_4.stdout): New target.
11855 * testsuite/Makefile.in: Rebuild.
11857 * sparc.cc: Add definitions for Output_data_plt_sparc class
11860 2008-04-14 David S. Miller <davem@davemloft.net>
11862 * sparc.cc: New file.
11863 * Makefile.am (TARGETSOURCES): Add sparc.cc
11864 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
11865 * configure.tgt: Document targ_extra_size and
11866 targ_extra_big_endian. Add entries for sparc-* and
11868 * configure.ac: Handle targ_extra_size and
11869 targ_extra_big_endian.
11870 * Makefile.in: Rebuild.
11871 * configure: Likewise.
11872 * po/POTFILES.in: Likewise.
11873 * po/gold.pot: Likewise.
11875 2008-04-14 Ian Lance Taylor <iant@google.com>
11877 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
11878 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
11879 in the name/type/flags to section mapping. Don't call
11880 allocate_output_section.
11881 (Layout::choose_output_section): Change parameter from adjust_name
11882 to is_input_section. Don't permit input sections after sections
11883 are attached to segments. Don't call allocate_output_section.
11884 (Layout::layout_eh_frame): Call update_flags_for_input_section,
11885 not write_enable_output_section.
11886 (Layout::make_output_section): Don't push to
11887 unattached_section_list_ nor call attach_to_segment. Call
11888 attach_section_to_segment if sections are attached.
11889 (Layout::attach_sections_to_segments): New function.
11890 (Layout::attach_section_to_segment): New function.
11891 (Layout::attach_allocated_section_to_segment): Rename from
11892 attach_to_segment. Remove flags parameter.
11893 (Layout::allocate_output_section): Remove function.
11894 (Layout::write_enable_output_section): Remove function.
11895 * layout.h (class Layout): Update for above changes. Add new
11896 field sections_are_attached_.
11897 * output.h (Output_section::update_flags_for_input_section): New
11899 * output.cc (Output_section::add_input_section): Call
11900 update_flags_for_input_section.
11901 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
11903 2008-04-11 Cary Coutant <ccoutant@google.com>
11905 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
11906 thought unnecessary.
11907 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
11909 2008-04-11 Ian Lance Taylor <iant@google.com>
11911 * output.h (class Output_section_data): Remove inline definition
11913 * output.cc (Output_section_data::set_addralign): New function.
11915 2008-04-11 Cary Coutant <ccoutant@google.com>
11917 Add support for TLS descriptors for i386 and x86_64.
11918 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
11919 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
11920 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
11922 (Target_i386::got_mod_index_entry): Remove unnecessary code.
11923 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
11924 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
11926 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
11927 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
11928 Fix problem with initial-exec relocations.
11929 (Target_i386::Relocate::relocate_tls): Likewise.
11930 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
11932 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
11933 support for section-plus-offset dynamic table entries.
11934 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
11935 (Output_data_dynamic::Dynamic_entry): Add support for
11936 section-plus-offset dynamic table entries.
11937 (Output_data_dynamic::Classification): Likewise.
11938 (Output_data_dynamic::classification_): Renamed offset_.
11939 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
11940 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
11941 (Target_x86_64::make_plt_section): New function.
11942 (Target_x86_64::reserve_tlsdesc_entries): New function.
11943 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
11944 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
11945 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
11946 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
11947 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
11948 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
11949 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
11950 add extra PLT entry for TLS descriptors.
11951 (Output_data_plt_x86_64::got_): New field.
11952 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
11953 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
11955 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
11957 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
11958 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
11959 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
11960 R_386_TLS_DESC_CALL relocations.
11961 (Target_x86_64::Scan::global): Likewise.
11962 (Target_x86_64::do_finalize_sections): Add dynamic table entries
11963 for TLS descriptors.
11964 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
11965 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
11966 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
11967 GD-to-IE relaxation.
11968 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
11969 and TLS_DESCRIPTORS.
11970 * Makefile.in: Rebuild.
11971 * configure: Rebuild.
11972 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
11973 (tls_test_shared2.so): New target.
11974 (tls_shared_gd_to_ie_test_SOURCES): New variable.
11975 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
11976 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
11977 (tls_shared_gd_to_ie_test_LDADD): New variable.
11978 (tls_shared_gnu2_gd_to_ie_test): New target.
11979 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
11981 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
11982 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
11983 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
11984 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
11985 (tls_shared_gnu2_test): New target.
11986 (tls_test_gnu2_shared.so): New target.
11987 (tls_shared_gnu2_test_SOURCES): New variable.
11988 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
11989 (tls_shared_gnu2_test_LDFLAGS): New variable.
11990 (tls_shared_gnu2_test_LDADD): New variable.
11991 * testsuite/Makefile.in: Rebuild.
11992 * testsuite/Makefile.
11994 2008-04-11 Ian Lance Taylor <iant@google.com>
11996 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
11998 * testsuite/Makefile.in: Rebuild.
12000 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
12002 * testsuite/script_test_2.cc (main): Adjust test.
12004 2008-04-11 David S. Miller <davem@davemloft.net>
12005 Ian Lance Taylor <iant@google.com>
12007 * options.h (General_options): Add entries for '-Y' and
12009 * options.cc (General_options:finalize): If -Y was used, add those
12010 entries to the library path instead of the default "/lib" and
12013 2008-04-11 David S. Miller <davem@davemloft.net>
12015 * testsuite/justsyms.t: Start at 0x100.
12016 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
12017 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
12019 * testsuite/script_test_2.cc: Adjust string and section length
12022 2008-04-09 Ian Lance Taylor <iant@google.com>
12025 * script-sections.cc (Sections_element::allocate_to_segment): Add
12027 (Output_section_definition::allocate_to_segment): Likewise.
12028 (Orphan_output_section::allocate_to_segment): Likewise.
12029 (Script_sections::attach_sections_using_phdrs_clause): Don't
12030 propagate non-PT_LOAD segments to orphan sections.
12031 * testsuite/Makefile.am (script_test_3.stdout): Generate using
12032 readelf rather than objdump.
12033 * testsuite/script_test_3.sh: Adjust accordingly. Test that
12034 .interp section and PT_INTERP segment are the same size.
12035 * testsuite/Makefile.in: Rebuild.
12037 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
12038 aliases for symbols defined in the same object.
12039 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
12040 (weak_alias_test_SOURCES): New variable.
12041 (weak_alias_test_DEPENDENCIES): New variable.
12042 (weak_alias_test_LDFLAGS): New variable.
12043 (weak_alias_test_LDADD): New variable.
12044 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
12045 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
12046 (weak_alias_test_3.o): New target.
12047 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
12048 * testsuite/weak_alias_test_main.cc: New file.
12049 * testsuite/weak_alias_test_1.cc: New file.
12050 * testsuite/weak_alias_test_2.cc: New file.
12051 * testsuite/weak_alias_test_3.cc: New file.
12053 2008-04-08 Ian Lance Taylor <iant@google.com>
12055 * options.h (class General_options): Add --noinhibit-exec option.
12056 * main.cc (main): Check --noinhibit-exec.
12058 * options.h (class General_options): Define --wrap as a special
12059 option. Add wrap_symbols_ field.
12060 (General_options::any_wrap_symbols): New function.
12061 (General_options::is_wrap_symbol): New function.
12062 * options.cc (General_options::parse_wrap): New function.
12063 (General_options::General_options): Initialize wrap_symbols_.
12064 * symtab.cc (Symbol_table::wrap_symbol): New function.
12065 (Symbol_table::add_from_object): Handle --wrap.
12066 * symtab.h (class Symbol_table): Declare wrap_symbol.
12067 * target.h (Target::wrap_char): New function.
12068 (Target::Target_info): Add wrap_char field.
12069 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
12070 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12071 * testsuite/testfile.cc (Target_test::test_target_info):
12074 * errors.cc (Errors::undefined_symbol): Mention symbol version if
12077 * layout.h (class Layout): Add added_eh_frame_data_ field.
12078 * layout.cc (Layout::Layout): Initialize new field.
12079 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
12080 output section until we find a section we merged successfully.
12081 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
12082 that the size be non-zero.
12084 * merge.cc (Object_merge_map::get_output_offset): Remove inline
12087 2008-04-08 Craig Silverstein <csilvers@google.com>
12089 * configure.ac: Export new conditional variable HAVE_ZLIB.
12090 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
12092 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
12093 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12095 2008-04-07 Ian Lance Taylor <iant@google.com>
12097 * version.cc (version_string): Set to "1.5".
12099 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
12100 Add issued_non_pic_error_ field. Declare check_non_pic.
12101 (Target_x86_64::Scan::check_non_pic): New function.
12102 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
12103 (Target_x86_64::Scan::global): Likewise.
12105 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
12106 addend parameter. Change caller. Handle merge sections.
12107 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
12108 Address to Addend. Don't add in the result of
12109 local_section_offset, pass down the addend and use the returned
12111 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
12112 Update declarations of local_section_offset and symbol_value.
12113 * testsuite/two_file_test_1.cc (t18): New function.
12114 * testsuite/two_file_test_2.cc (f18): New function.
12115 * testsuite/two_file_test_main.cc (main): Call t18.
12116 * testsuite/two_file_test.h (t18, f18): Declare.
12118 * configure.ac: Don't test for objdump, c++filt, or readelf.
12119 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
12121 (TEST_READELF): New variable.
12122 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
12123 (check_PROGRAMS): Add two_file_strip_test.
12124 (two_file_strip_test): New target.
12125 (check_PROGRAMS): Add two_file_same_shared_strip_test.
12126 (two_file_same_shared_strip_test_SOURCES): New variable.
12127 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
12128 (two_file_same_shared_strip_test_LDFLAGS): New variable.
12129 (two_file_same_shared_strip_test_LDADD): New variable.
12130 (two_file_shared_strip.so): New target.
12131 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
12132 (ver_test_5.syms, ver_test_7.syms): Likewise.
12133 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
12134 (strip_test_3.stdout): Use TEST_OBJDUMP.
12135 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12137 2008-04-04 Cary Coutant <ccoutant@google.com>
12139 * symtab.h (Symbol::is_weak_undefined): New function.
12140 (Symbol::is_strong_undefined): New function.
12141 (Symbol::is_absolute): New function.
12142 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
12143 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
12145 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
12146 (weak_undef_test): New target.
12147 * testsuite/Makefile.in: Rebuild.
12148 * testsuite/weak_undef_file1.cc: New file.
12149 * testsuite/weak_undef_file2.cc: New file.
12150 * testsuite/weak_undef_test.cc: New file.
12152 2008-04-03 Craig Silverstein <csilvers@google.com>
12154 * compressed_output.h (class Output_compressed_section): Use
12156 * compressed_output.cc (zlib_compress): Use unsigned buffers,
12158 (zlib_compressed_suffix): Removed.
12159 (Output_compressed_section::set_final_data_size): Use unsigned
12161 * testsuite/Makefile.am (flagstest_compress_debug_sections):
12162 Fix linker invocation.
12163 (flagstest_o_specialfile_and_compress_debug_sections):
12165 * testsuite/Makefile.in: Regenerated.
12167 2008-04-02 David S. Miller <davem@davemloft.net>
12169 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
12170 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
12172 2008-04-02 Craig Silverstein <csilvers@google.com>
12176 2008-04-02 Ian Lance Taylor <iant@google.com>
12178 * fileread.cc (File_read::find_view): Add byteshift and vshifted
12179 parameters. Update for new key type to views_. Change all
12181 (File_read::read): Adjust for byteshift in returned view.
12182 (File_read::add_view): New function, broken out of
12183 find_and_make_view.
12184 (File_read::make_view): New function, broken out of
12185 find_and_make_view.
12186 (File_read::find_or_make_view): Add offset and aligned
12187 parameters. Rewrite accordingly. Change all callers.
12188 (File_read::get_view): Add offset and aligned parameters. Adjust
12189 for byteshift in return value.
12190 (File_read::get_lasting_view): Likewise.
12191 * fileread.h (class File_read): Update declarations.
12192 (class File_read::View): Add byteshift_ field. Add byteshift to
12193 constructor. Add byteshift method.
12194 * archive.h (Archive::clear_uncached_views): New function.
12195 (Archive::get_view): Add aligned parameter. Change all callers.
12196 * object.h (Object::get_view): Add aligned parameter. Change all
12198 (Object::get_lasting_view): Likewise.
12200 * fileread.cc (File_read::release): Don't call clear_views if
12201 there are multiple objects.
12202 * fileread.h (File_read::clear_uncached_views): New function.
12203 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
12206 2008-03-31 Cary Coutant <ccoutant@google.com>
12208 Add thin archive support.
12209 * archive.cc (Archive::armagt): New const.
12210 (Archive::setup): Remove task parameter and calls to unlock.
12211 (Archive::unlock_nested_archives): New function.
12212 (Archive::read_header): Add nested_off parameter. Change
12214 (Archive::interpret_header): Likewise.
12215 (Archive::include_all_members): Change to handle thin
12217 (Archive::include_member): Likewise.
12218 * archive.h (Archive::Archive): Add new parameters and
12220 (Archive::armagt): New const.
12221 (Archive::setup): Remove task parameter.
12222 (Archive::unlock_nested_archives): New function.
12223 (Archive::read_header): Add nested_off parameter.
12224 (Archive::interpret_header): Likewise.
12225 (Archive::Nested_archive_table): New typedef.
12226 (Archive::is_thin_archive_): New field.
12227 (Archive::nested_archives_): New field.
12228 (Archive::options_): New field.
12229 (Archive::dirpath_): New field.
12230 (Archive::task_): New field.
12231 * readsyms.cc (Read_symbols::do_read_symbols): Add check
12232 for thin archives. Pass additional parameters to
12233 Archive::Archive. Unlock the archive file after calling
12236 2008-03-29 Ian Lance Taylor <iant@google.com>
12238 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12239 version symbol to be local.
12240 * testsuite/ver_test_4.sh: New file.
12241 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12242 (check_DATA): Add ver_test_4.syms.
12243 (ver_test_4.syms): New target.
12244 * testsuite/Makefile.in: Rebuild.
12247 (Output_section::Input_section_sort_entry::has_priority): New
12249 (Output_section::Input_section_sort_entry::match_file_name): New
12251 (Output_section::Input_section_sort_entry::match_section_name):
12253 (Output_section::Input_section_sort_entry::match_section_name_prefix):
12255 (Output_section::Input_section_sort_entry::match_section_file):
12257 (Output_section::Input_section_sort_compare::operator()): Rewrite
12258 using new Input_section_sort_entry functions. Sort crtbegin and
12259 crtend first. Sort sections with no priority before sections with
12261 * testsuite/initpri1.c (d3): Check j != 4.
12262 (cd5): New constructor/destructor function.
12263 (main): Check j != 2.
12265 * symtab.cc (Symbol_table::add_from_object): If we don't use the
12266 new symbol when resolving, don't call set_is_default.
12267 * testsuite/ver_test_7.cc: New file.
12268 * testsuite/ver_test_7.sh: New file.
12269 * testsuite/Makefile.am (ver_test_7.so): New target.
12270 (ver_test_7.o): New target.
12271 (check_SCRIPTS): Add ver_test_7.sh.
12272 (check_DATA): Add ver_test_7.syms.
12273 (ver_test_7.syms): New target.
12275 2008-03-28 Ian Lance Taylor <iant@google.com>
12277 * layout.cc (Layout::layout): If we see an input section with a
12278 name that needs sorting, set the must_sort flag for the output
12280 (Layout::make_output_section): If the name of the output section
12281 indicates that it might require sorting, set the may_sort flag.
12282 * output.h (Output_section::may_sort_attached_input_sections): New
12284 (Output_section::set_may_sort_attached_input_sections): New
12286 (Output_section::must_sort_attached_input_sections): New
12288 (Output_section::set_must_sort_attached_input_sections): New
12290 (class Output_section): Declare Input_section_sort_entry. Define
12291 Input_section_sort_compare. Declare
12292 sort_attached_input_sections. Add new fields:
12293 may_sort_attached_input_sections_,
12294 must_sort_attached_input_sections_,
12295 attached_input_sections_are_sorted_.
12296 * output.cc (Output_section::Output_section): Initialize new
12298 (Output_section::add_input_section): Add an entry to
12299 input_sections_ if may_sort or must_sort are true.
12300 (Output_section::set_final_data_size): Call
12301 sort_attached_input_sections if necessary.
12302 (Output_section::Input_section_sort_entry): Define new class.
12303 (Output_section::Input_section_sort_compare::operator()): New
12305 (Output_section::sort_attached_input_sections): New function.
12306 * configure.ac: Check whether the compiler supports constructor
12307 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
12308 * testsuite/initpri1.c: New file.
12309 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
12310 CONSTRUCTOR_PRIORITY.
12311 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
12312 (initpri1_LDFLAGS): New variable.
12313 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12315 2008-03-27 Ian Lance Taylor <iant@google.com>
12317 * common.cc (Sort_commons::operator): Correct sorting algorithm.
12318 * testsuite/common_test_1.c: New file.
12319 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
12320 (common_test_1_SOURCES): New variable.
12321 (common_test_1_DEPENDENCIES): New variable.
12322 (common_test_1_LDFLAGS): New variable.
12324 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
12325 and commons_ correctly when NAME/VERSION does not override
12327 * testsuite/ver_test_6.c: New file.
12328 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
12329 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
12330 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
12332 2008-03-26 Ian Lance Taylor <iant@google.com>
12334 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
12335 of an undefined symbol from a version script.
12336 * testsuite/Makefile.am (ver_test_5.so): New target.
12337 (ver_test_5.o): New target.
12338 (check_SCRIPTS): Add ver_test_5.sh.
12339 (check_DATA): Add ver_test_5.syms.
12340 (ver_test_5.syms): New target.
12341 * testsuite/ver_test_5.cc: New file.
12342 * testsuite/ver_test_5.script: New file.
12343 * testsuite/ver_test_5.sh: New file.
12344 * Makefile.in, testsuite/Makefile.in: Rebuild.
12347 Fix problems building gold with gcc 4.3.0.
12348 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
12349 (gold_error_at_location, gold_warning_at_location): Use it.
12350 * configure.ac: Check whether we can compile and use a template
12351 function with a printf attribute.
12352 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
12353 when jumping over bytes.
12354 * object.cc: Instantiate Object::read_section_data.
12355 * debug.h: Include <cstring>
12356 * dwarf_reader.cc: Include <algorithm>
12357 * main.cc: Include <cstring>.
12358 * options.cc: Include <cstring>.
12359 * output.cc: Include <cstring>.
12360 * script.cc: Include <cstring>.
12361 * script.h: Include <string>.
12362 * symtab.cc: Include <cstring> and <algorithm>.
12363 * target-select.cc: Include <cstring>.
12364 * version.cc: Include <string>.
12365 * testsuite/testmain.cc: Include <cstdlib>.
12366 * configure, config.in: Rebuild.
12368 2008-03-25 Ian Lance Taylor <iant@google.com>
12370 * options.cc: Include "../bfd/bfdver.h".
12371 (options::help): Print bug reporting address.
12373 * version.cc (print_version): Adjust output for current value of
12374 BFD_VERSION_STRING.
12378 * options.cc (options::help): Print list of supported targets.
12379 * target-select.h: Include <vector>.
12380 (class Target_selector): Make machine_, size_, and is_big_endian_
12381 fields const. Add bfd_name_ and instantiated_target_ fields.
12382 (Target_selector::Target_selector): Add bfd_name parameter.
12383 (Target_selector::recognize): Make non-virtual, call
12385 (Target_selector::recognize_by_name): Make non-virtual, call
12386 do_recognize_by_name.
12387 (Target_selector::supported_names): New function.
12388 (Target_selector::bfd_name): New function.
12389 (Target_selector::do_instantiate_target): New pure virtual
12391 (Target_selector::do_recognize): New virtual function.
12392 (Target_selector::do_recognize_by_name): New virtual function.
12393 (Target_selector::instantiate_target): New private function.
12394 (supported_target_names): Declare.
12395 * target-select.cc (Target_selector::Target_selector): Update for
12396 new parameter and fields.
12397 (select_target_by_name): Check that the name matches before
12398 calling recognize_by_name.
12399 (supported_target_names): New function.
12400 * i386.cc (class Target_selector_i386): Update Target_selector
12401 constructor call. Remove recognize and recognize_by_name. Add
12402 do_instantiate_target.
12403 * x86_64.cc (class Target_selector_x86_64): Likewise.
12404 * testsuite/testfile.cc (class Target_selector_test): Update for
12405 changes to Target_selector.
12407 * README: Rewrite, with some notes on unsupported features.
12409 2008-03-24 Cary Coutant <ccoutant@google.com>
12411 * i386.cc (Target_i386::Got_type): New enum declaration.
12412 (Target_i386::Scan::local): Updated callers of Output_data_got
12414 (Target_i386::Scan::global): Likewise.
12415 (Target_i386::Relocate::relocate): Likewise.
12416 (Target_i386::Relocate::relocate_tls): Likewise.
12417 * object.h (Got_offset_list): New class.
12418 (Sized_relobj::local_has_got_offset): Added got_type parameter.
12419 (Sized_relobj::local_got_offset): Likewise.
12420 (Sized_relobj::set_local_got_offset): Likewise.
12421 (Sized_relobj::local_has_tls_got_offset): Removed.
12422 (Sized_relobj::local_tls_got_offset): Removed.
12423 (Sized_relobj::set_local_tls_got_offset): Removed.
12424 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
12425 * output.cc (Output_data_got::add_global): Added got_type parameter.
12426 (Output_data_got::add_global_with_rel): Likewise.
12427 (Output_data_got::add_global_with_rela): Likewise.
12428 (Output_data_got::add_global_pair_with_rel): New function.
12429 (Output_data_got::add_global_pair_with_rela): New function.
12430 (Output_data_got::add_local): Added got_type parameter.
12431 (Output_data_got::add_local_with_rel): Likewise.
12432 (Output_data_got::add_local_with_rela): Likewise.
12433 (Output_data_got::add_local_pair_with_rel): New function.
12434 (Output_data_got::add_local_pair_with_rela): New function.
12435 (Output_data_got::add_global_tls): Removed.
12436 (Output_data_got::add_global_tls_with_rel): Removed.
12437 (Output_data_got::add_global_tls_with_rela): Removed.
12438 (Output_data_got::add_local_tls): Removed.
12439 (Output_data_got::add_local_tls_with_rel): Removed.
12440 (Output_data_got::add_local_tls_with_rela): Removed.
12441 * output.h (Output_data_got::add_global): Added got_type parameter.
12442 (Output_data_got::add_global_with_rel): Likewise.
12443 (Output_data_got::add_global_with_rela): Likewise.
12444 (Output_data_got::add_global_pair_with_rel): New function.
12445 (Output_data_got::add_global_pair_with_rela): New function.
12446 (Output_data_got::add_local): Added got_type parameter.
12447 (Output_data_got::add_local_with_rel): Likewise.
12448 (Output_data_got::add_local_with_rela): Likewise.
12449 (Output_data_got::add_local_pair_with_rel): New function.
12450 (Output_data_got::add_local_pair_with_rela): New function.
12451 (Output_data_got::add_global_tls): Removed.
12452 (Output_data_got::add_global_tls_with_rel): Removed.
12453 (Output_data_got::add_global_tls_with_rela): Removed.
12454 (Output_data_got::add_local_tls): Removed.
12455 (Output_data_got::add_local_tls_with_rel): Removed.
12456 (Output_data_got::add_local_tls_with_rela): Removed.
12457 * resolve.cc (Symbol::override_base_with_special): Removed
12458 reference to has_got_offset_ field.
12459 * symtab.cc (Symbol::init_fields): Replaced initialization
12460 of got_offset_ with got_offsets_. Removed initialization
12462 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
12463 (Symbol::got_offset): Likewise.
12464 (Symbol::set_got_offset): Likewise.
12465 (Symbol::has_tls_got_offset): Removed.
12466 (Symbol::tls_got_offset): Removed.
12467 (Symbol::set_tls_got_offset): Removed.
12468 (Symbol::got_offset_): Removed.
12469 (Symbol::tls_mod_got_offset_): Removed.
12470 (Symbol::tls_pair_got_offset_): Removed.
12471 (Symbol::got_offsets_): New field.
12472 (Symbol::has_got_offset): Removed.
12473 (Symbol::has_tls_mod_got_offset): Removed.
12474 (Symbol::has_tls_pair_got_offset): Removed.
12475 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
12476 (Target_x86_64::Scan::local): Updated callers of Output_data_got
12478 (Target_x86_64::Scan::global): Likewise.
12479 (Target_x86_64::Relocate::relocate): Likewise.
12480 (Target_x86_64::Relocate::relocate_tls): Likewise.
12482 2008-03-25 Ben Elliston <bje@au.ibm.com>
12484 * yyscript.y: Fix spelling error in comment.
12486 2008-03-24 Ian Lance Taylor <iant@google.com>
12488 * options.h (class General_options): Define build_id option.
12489 * layout.h (class Layout): Declare write_build_id, create_note,
12490 create_build_id. Add build_id_note_ member.
12491 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
12492 "libiberty.h", "md5.h", "sha1.h".
12493 (Layout::Layout): Initialize eh_frame_data_,
12494 eh_frame_hdr_section_, and build_id_note_.
12495 (Layout::finalize): Call create_build_id.
12496 (Layout::create_note): New function, broken out of
12497 Layout::create_gold_note.
12498 (Layout::create_gold_note): Call create_note.
12499 (Layout::create_build_id): New function.
12500 (Layout::write_build_id): New function.
12501 (Close_task_runner::run): Call write_build_id.
12503 * x86_64.cc: Correct license to GPLv3.
12505 2008-03-23 Ian Lance Taylor <iant@google.com>
12507 * options.cc: Include "demangle.h".
12508 (parse_optional_string): New function.
12509 (parse_long_option): Handle takes_optional_argument.
12510 (parse_short_option): Update dash_z initializer. Handle
12511 takes_optional_argument.
12512 (General_options::General_options): Initialize do_demangle_.
12513 (General_options::finalize): Set do_demangle_. Handle demangling
12515 * options.h (parse_optional_string): Declare.
12516 (struct One_option): Add optional_arg field. Update constructor.
12517 Update call constructor calls. Add takes_optional_argument
12519 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
12520 (DEFINE_optional_string): Define.
12521 (General_options::demangle): Change from DEFINE_bool to
12522 DEFINE_optional_string.
12523 (General_options::no_demangle): New function.
12524 (General_options::do_demangle): New function.
12525 (General_options::set_do_demangle): New function.
12526 (General_options::execstack_status_): Move definition to end of
12528 (General_options::static_): Likewise.
12529 (General_options::do_demangle_): New field.
12530 * object.cc (big_endian>::get_symbol_location_info): Call
12531 Options::do_demangle, not Options::demangle.
12532 * symtab.cc (demangle): Likewise.
12534 2008-03-22 Ian Lance Taylor <iant@google.com>
12536 * gold.h: Include <cstddef> and <sys/types.h>
12537 * options.h: Include <cstring>.
12539 2008-03-21 Ian Lance Taylor <iant@google.com>
12541 * Added source code to GNU binutils.