1 2012-02-29 Cary Coutant <ccoutant@google.com>
3 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
5 2012-02-29 Cary Coutant <ccoutant@google.com>
7 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8 Call Object::decompressed_section_contents.
9 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
11 (Sized_dwarf_line_info::buffer_start_): New data member.
12 * merge.cc (Output_merge_data::do_add_input_section): Call
13 Object::decompressed_section_contents.
14 (Output_merge_string::do_add_input_section): Likewise.
15 * object.cc (need_decompressed_section): New function.
16 (build_compressed_section_map): Decompress sections needed later.
17 (Sized_relobj_file::do_decompressed_section_contents): New function.
18 (Sized_relobj_file::do_discard_decompressed_sections): New function.
19 * object.h (Object::decompressed_section_contents): New function.
20 (Object::discard_decompressed_sections): New function.
21 (Object::do_decompressed_section_contents): New function.
22 (Object::do_discard_decompressed_sections): New function.
23 (Compressed_section_info): New type.
24 (Compressed_section_map): Include decompressed section contents.
25 (Sized_relobj_file::do_decompressed_section_contents): New function.
26 (Sized_relobj_file::do_discard_decompressed_sections): New function.
28 2012-02-16 Cary Coutant <ccoutant@google.com>
30 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
31 * testsuite/Makefile.in: Regenerate.
33 2012-02-14 Cary Coutant <ccoutant@google.com>
35 * options.cc (General_options::finalize): Disallow -pie and -static.
37 2012-02-03 Doug Kwan <dougkwan@google.com>
39 * arm.cc (Arm_relocate_functions::abs8,
40 Arm_relocate_functions::abs16): Use
41 Bits::has_signed_unsigned_overflow32.
42 (Arm_relocate_functions::thm_abs8): Correct range of
44 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
47 2012-02-02 Doug Kwan <dougkwan@google.com>
49 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
50 position independent outputs, not just shared objects.
52 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
54 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
55 * configure: Regenerated.
57 2012-01-27 Ian Lance Taylor <iant@google.com>
59 * reloc.h (Bits): New class with static functions, copied from
60 namespace utils in arm.cc.
61 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
64 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
66 * incremental.cc (write_info_blocks): Correct relocation offset.
68 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
70 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
71 (Relocate::tls_gd_to_le): Likewise.
73 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
75 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
77 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
79 * configure.ac: Check if -mcmodel=medium works.
80 * configure: Regenerated.
82 2012-01-24 Cary Coutant <ccoutant@google.com>
84 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
86 (read_unsigned_LEB_128_x): ... this new function.
87 (read_signed_LEB_128): Replaced with inline definition and ...
88 (read_signed_LEB_128_x): ... this new function.
89 * int_encoding.h (read_unsigned_LEB_128_x): New function.
90 (read_unsigned_LEB_128): Add inline definition.
91 (read_signed_LEB_128_x): New function.
92 (read_signed_LEB_128): Add inline definition.
93 * testsuite/Makefile.am (leb128_unittest): New unit test.
94 * testsuite/Makefile.in: Regenerate.
95 * testsuite/leb128_unittest.cc: New unit test.
97 2012-01-23 Ian Lance Taylor <iant@google.com>
100 * i386.cc (Target_i386::do_code_fill): When using a jmp
101 instruction, pad with nop instructions.
102 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
104 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
106 * x86_64.cc (gc_process_relocs): Add typename on types used in
108 (scan_relocs): Likewise.
109 (relocate_section): Likewise.
110 (apply_relocation): Likewise.
112 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
114 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
115 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
118 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
120 * x86_64.cc: Initial support for x32.
122 2012-01-03 Cary Coutant <ccoutant@google.com>
124 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
125 Use abstract base class for GOT.
126 * gold/output.h (class Output_data_got_base): New abstract base class.
127 (class Output_data_got): Derive from new base class, adjust ctors.
128 (Output_data_got::reserve_slot): Make virtual; rename to
129 do_reserve_slot; Adjust callers.
130 * gold/target.h (Sized_target::init_got_plt_for_update): Return
131 pointer to abstract base class.
132 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
134 2011-12-18 Ian Lance Taylor <iant@google.com>
136 * object.h (Relobj::local_symbol_value): New function.
137 (Relobj::local_plt_offset): New function.
138 (Relobj::local_has_got_offset): New function.
139 (Relobj::local_got_offset): New function.
140 (Relobj::set_local_got_offset): New function.
141 (Relobj::do_local_symbol_value): New pure virtual function.
142 (Relobj::do_local_plt_offset): Likewise.
143 (Relobj::do_local_has_got_offset): Likewise.
144 (Relobj::do_local_got_offset): Likewise.
145 (Relobj::do_set_local_got_offset): Likewise.
146 (Sized_relobj::do_local_has_got_offset): Rename from
147 local_has_got_offset.
148 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
149 (Sized_relobj::do_set_local_got_offset): Rename from
150 set_local_got_offset.
151 (Sized_relobj_file::do_local_plt_offset): Rename from
153 (Sized_relobj_file::do_local_symbol_value): New function.
154 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
156 * output.cc (Output_data_got::Got_entry::write): Change object to
157 Relobj. Use local_symbol_value.
158 (Output_data_got::add_global_with_rel): Change rel_dyn to
159 Output_data_reloc_generic*. Use add_global_generic.
160 (Output_data_got::add_global_with_rela): Remove. Change all
161 callers to use add_global_with_rel.
162 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
163 Output_data_reloc_generic*. Use add_global_generic.
164 (Output_data_got::add_global_pair_with_rela): Remove. Change all
165 callers to use add_global_pair_with_rel.
166 (Output_data_got::add_local): Change object to Relobj*.
167 (Output_data_got::add_local_plt): Likewise.
168 (Output_data_got::add_local_with_rel): Change object to Relobj*,
169 change rel_dyn to Output_data_reloc_generic*. Use
171 (Output_data_got::add_local_with_rela): Remove. Change all
172 callers to use all_local_with_rel.
173 (Output_data_got::add_local_pair_with_rel): Change object to
174 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
175 add_output_section_generic.
176 (Output_data_got::add_local_pair_with_rela): Remove. Change all
177 callers to use add_local_pair_with_rel.
178 (Output_data_got::reserve_local): Change object to Relobj*.
179 * output.h: (class Output_data_reloc_generic): Add pure virtual
180 declarations for add_global_generic, add_local_generic,
181 add_output_section_generic.
182 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
183 functions for Output_data_reloc_generic. Update declarations for
184 changes listed in output.cc.
185 (class Output_data_got): Change template parameter to got_size.
186 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
187 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
189 (Sized_relobj_incr::do_local_plt_offset): New function.
190 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
193 2011-12-17 Cary Coutant <ccoutant@google.com>
195 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
196 * resolve.cc (Symbol_table::resolve): Likewise.
197 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
199 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
201 2011-12-16 Ian Lance Taylor <iant@google.com>
203 * output.h (Output_data_reloc_generic::add): Only call
204 add_dynamic_reloc if this is a dynamic reloc section.
206 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
209 * target-reloc.h (apply_relocation): Replace <64, false> with
212 2011-11-25 Nick Clifton <nickc@redhat.com>
214 * po/it.po: New Italian translation.
216 2011-11-17 Sterling Augustine <saugustine@google.com>
218 * script.cc (script_include_directive): Implement.
219 (read_script_file): New local variables name and search_path. Update
220 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
221 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
222 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
224 2011-11-11 Sterling Augustine <saugustine@google.com>
226 * yyscript.y (section_cmd): Add support for INCLUDE directive.
227 (file_or_sections_cmd): Likewise.
229 2011-11-11 Doug Kwan <dougkwan@google.com>
231 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
232 if --just-symbols is given.
234 2011-11-10 Doug Kwan <dougkwan@google.com>
237 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
238 when processing data relocs.
239 * reloc.h (Relocate_functions::rel_unaligned): New method.
240 (Relocate_functions::pcrel_unaligned): Ditto.
241 (Relocate_functions::rel32_unaligned): Ditto.
242 (Relocate_functions::pcrel32_unaligned): Ditto.
244 2011-11-09 Doug Kwan <dougkwan@google.com>
247 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
248 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
249 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
250 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
251 (Relocate_functions::rel_unaligned): New.
252 (Relocate_functions::rel32_unaligned): New.
253 * target-reloc.h (relocate_for_relocatable): Add code to handle
254 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
255 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
256 arm_unaligned_reloc_r): New targets.
257 * testsuite/Makefile.in: Regenerate.
258 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
261 2011-11-02 Ian Lance Taylor <iant@google.com>
263 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
265 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
266 * options.cc (General_options::finalize): Use library search path
267 from configure script if specified. If not native and no sysroot,
268 only search TOOLLIBDIR.
269 * options.h (Search_directory::Search_directory): Change name to
271 (General_options::add_to_library_path_with_sysroot): Change arg to
273 * configure, Makefile.in, config.in: Rebuild.
275 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
277 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
278 we are working around the ARM1176 Erratum.
279 * options.h (General_options::fix_arm1176): Add option.
280 * testsuite/Makefile.am: Add testcases, and keep current ones
282 * testsuite/Makefile.in: Regenerate.
283 * testsuite/arm_fix_1176.s: New file.
284 * testsuite/arm_fix_1176.sh: Likewise.
286 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
288 * arm.cc (Target_arm::Target_arm): Remove initialisation of
290 (Target_arm::may_use_blx): Remove method.
291 (Target_arm::set_may_use_blx): Likewise.
292 (Target_arm::may_use_v4t_interworking): New method.
293 (Target_arm::may_use_v5t_interworking): Likewise.
294 (Target_arm::may_use_blx_): Remove member variable.
295 (Arm_relocate_functions::arm_branch_common): Check for v5T
297 (Arm_relocate_functions::thumb_branch_common): Likewise.
298 (Reloc_stub::stub_type_for_reloc): Likewise.
299 (Target_arm::do_finalize_sections): Correct interworking checks.
300 * testsuite/Makefile.am: Add new tests.
301 * testsuite/Makefile.in: Regenerate.
302 * testsuite/arm_farcall_arm_arm.s: New test.
303 * testsuite/arm_farcall_arm_arm.sh: Likewise.
304 * testsuite/arm_farcall_arm_thumb.s: Likewise.
305 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
306 * testsuite/arm_farcall_thumb_arm.s: Likewise.
307 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
308 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
309 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
311 2011-10-31 Cary Coutant <ccoutant@google.com>
314 * expression.cc (Expression::eval_with_dot): Add
315 is_section_dot_assignment parameter.
316 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
317 absolute and assigning to dot within a section.
319 (Output_section_element_assignment::set_section_addresses): Pass
320 dot_section to set_if_absolute.
321 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
322 as is_section_dot_assignment flag to eval_with_dot.
323 (Output_section_element_dot_assignment::set_section_addresses):
325 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
326 parameter. Also set value if relative to dot_section; set the
327 symbol's output_section.
328 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
329 parameter. Adjust all callers.
330 (Expression::eval_maybe_dot): Likewise.
331 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
333 * testsuite/script_test_2.t: Test assignment of an absolute value
334 to dot within an output section element.
336 2011-10-31 Cary Coutant <ccoutant@google.com>
338 * options.h (class General_options): Add --[no-]gnu-unique options.
339 * symtab.cc (Symbol_table::sized_write_globals): Convert
340 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
342 2011-10-31 Cary Coutant <ccoutant@google.com>
345 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
346 unnecessary assertion.
347 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
349 2011-10-31 Sriraman Tallam <tmsriram@google.com>
351 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
353 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
355 Change to just keep the section associated with symbol.
356 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
357 they are externally visible and --export-dynamic is turned on.
358 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
360 2011-10-19 Ian Lance Taylor <iant@google.com>
364 (Output_section_element_dot_assignment::needs_output_section): New
367 2011-10-19 Ian Lance Taylor <iant@google.com>
370 * layout.cc (Layout::segment_precedes): Don't assert failure if a
371 --section-start option was seen.
372 * options.h (General_options::any_section_start): New function.
374 2011-10-18 David S. Miller <davem@davemloft.net>
377 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
378 member to track relocation locations that have moved during TLS
380 (Target_sparc::Relocate::Relocate): Initialize to NULL.
381 (Target_sparc::Relocate::relocate): Adjust view down by 4
382 bytes if it matches reloc_adjust_addr_.
383 (Target_sparc::Relocate::relocate_tls): Always move the
384 __tls_get_addr call delay slot instruction forward 4 bytes when
385 performing relaxation.
387 2011-10-18 Cary Coutant <ccoutant@google.com>
389 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
390 (Output_file::map_no_anonymous): Check for non-zero
391 return code from posix_fallocate.
393 2011-10-17 Cary Coutant <ccoutant@google.com>
396 * plugin.cc (is_visible_from_outside): Check for symbols
397 referenced from dynamic objects.
398 * resolve.cc (Symbol_table::resolve): Don't count references
399 from dynamic objects as references from real ELF files.
400 * testsuite/plugin_test_2.sh: Adjust expected result.
402 2011-10-17 Cary Coutant <ccoutant@google.com>
404 * gold.cc: Include timer.h.
405 (queue_middle_tasks): Stamp time.
406 (queue_final_tasks): Likewise.
407 * main.cc (main): Store timer in parameters. Print timers
409 * parameters.cc (Parameters::Parameters): Initialize timer_.
410 (Parameters::set_timer): New function.
411 (set_parameters_timer): New function.
412 * parameters.h (Parameters::set_timer): New function.
413 (Parameters::timer): New function.
414 (Parameters::timer_): New data member.
415 (set_parameters_timer): New function.
416 * timer.cc (Timer::stamp): New function.
417 (Timer::get_pass_time): New function.
418 * timer.h (Timer::stamp): New function.
419 (Timer::get_pass_time): New function.
420 (Timer::pass_times_): New data member.
422 2011-10-17 Cary Coutant <ccoutant@google.com>
424 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
425 task for members of lib groups.
427 2011-10-17 Cary Coutant <ccoutant@google.com>
430 * fileread.cc (File_read::find_view): Add assert.
431 (File_read::make_view): Move bounds check (replace with assert)...
432 (File_read::find_or_make_view): ... to here.
434 2011-10-12 Cary Coutant <ccoutant@google.com>
436 * output.cc (Output_file::open_base_file): Handle case where
437 ::read returns less than requested size.
439 2011-10-10 Cary Coutant <ccoutant@google.com>
441 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
442 Initialize defined_count_.
443 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
444 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
445 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
446 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
447 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
448 * incremental.h (Sized_relobj_incr::defined_count_): New data
450 (Sized_incr_dynobj::defined_count_): New data member.
451 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
452 Return zeroes instead of internal error.
454 2011-10-10 Cary Coutant <ccoutant@google.com>
457 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
458 (Output_reloc::symbol_value): Return PLT offset if flag is set.
459 * output.h (class Output_reloc): Add use_plt_offset flag.
460 (Output_reloc::type_): Adjust size of bit field.
461 (Output_reloc::use_plt_offset_): New bit field.
462 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
463 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
464 flag. Adjust all callers.
465 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
466 creating RELATIVE relocations.
468 2011-10-10 Nick Clifton <nickc@redhat.com>
470 * po/es.po: Updated Spanish translation.
471 * po/fi.po: Updated Finnish translation.
473 2011-10-03 Diego Novillo <dnovillo@google.com>
475 * options.cc (parse_uint): Fix dereference of RETVAL.
477 2011-09-29 Sriraman Tallam <tmsriram@google.com>
479 * layout.h (section_order_map_): New member.
480 (get_section_order_map): New member function.
481 * output.cc (Output_section::add_input_section): Check for patterns
482 only when --section-ordering-file is specified.
483 * gold.cc (queue_middle_tasks): Delay updating order of sections till
484 output_sections have been formed.
485 * layout.cc (Layout_Layout): Initialize section_order_map_.
486 * plugin.cc (update_section_order): Store order in order_map. Do not
488 * testsuite/Makefile.am: Add test case for plugin_final_layout.
489 * testsuite/Makefile.in: Regenerate.
490 * testsuite/plugin_section_order.c: New file.
491 * testsuite/plugin_final_layout.cc: New file.
492 * testsuite/plugin_final_layout.sh: New file.
494 2011-09-29 Cary Coutant <ccoutant@google.com>
496 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
498 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
499 symbols during incremental update.
500 (Symbol_table::add_from_dynobj): Likewise.
502 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
503 Ian Lance Taylor <iant@google.com>
505 * symtab.cc (Symbol_table::define_special_symbol): Always
506 canonicalize version string.
508 2011-09-26 Cary Coutant <ccoutant@google.com>
510 * gold.cc (queue_initial_tasks): Move option checks ...
511 * options.cc (General_options::finalize): ... to here. Disable
512 some options; make others fatal.
514 2011-09-26 Cary Coutant <ccoutant@google.com>
517 * plugin.cc (get_symbols_v2): New function.
518 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
519 (is_referenced_from_outside): New function.
520 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
521 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
522 (get_symbols): Pass version parameter.
523 (get_symbols_v2): New function.
524 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
526 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
527 (onload): Add LDPT_GET_SYMBOLS_V2.
528 (all_symbols_read_hook): Use get_symbols_v2; check for
529 LDPR_PREVAILING_DEF_IRONLY_EXP.
530 * testsuite/plugin_test_3.sh: Update expected results.
532 2011-09-23 Simon Baldwin <simonb@google.com>
534 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
535 configuration options.
536 * configure: Regenerate.
537 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
538 * Makefile.in: Regenerate.
539 * testsuite/Makefile.in: Regenerate.
541 2011-09-19 Sriraman Tallam <tmsriram@google.com>
543 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
545 2011-09-19 Cary Coutant <ccoutant@google.com>
547 * incremental.cc (can_incremental_update): Fix typo in comment.
548 * incremental.h (can_incremental_update): Likewise.
550 2011-09-18 Cary Coutant <ccoutant@google.com>
552 * incremental.cc (can_incremental_update): New function.
553 * incremental.h (can_incremental_update): New function.
554 * layout.cc (Layout::init_fixed_output_section): Call it.
555 (Layout::make_output_section): Don't allow patch space in .eh_frame.
556 * object.cc (Sized_relobj_file::do_layout): Call
557 can_incremental_update.
559 2011-09-13 Cary Coutant <ccoutant@google.com>
561 * configure.ac: Check for glibc support for gnu_indirect_function
562 support with static linking, setting automake conditional
564 * Makefile.in: Regenerate.
565 * configure: Regenerate.
567 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
568 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
570 * testsuite/Makefile.in: Regenerate.
572 2011-09-13 Cary Coutant <ccoutant@google.com>
574 * incremental.cc (Sized_relobj_incr::do_layout): Call
575 report_comdat_group for kept comdat sections.
576 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
577 * testsuite/Makefile.in: Regenerate.
578 * testsuite/incr_comdat_test_1.cc: New source file.
579 * testsuite/incr_comdat_test_2_v1.cc: New source file.
580 * testsuite/incr_comdat_test_2_v2.cc: New source file.
581 * testsuite/incr_comdat_test_2_v3.cc: New source file.
583 2011-09-13 Ian Lance Taylor <iant@google.com>
585 * object.cc (Sized_relobj_file::do_layout): Remove unused local
586 variable external_symbols_offset.
588 2011-09-12 Ian Lance Taylor <iant@google.com>
590 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
591 triggered if object has no symbols.
593 2011-09-09 David S. Miller <davem@davemloft.net>
595 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
596 (Output_fill_debug_line::do_write): Likewise.
598 2011-08-29 Cary Coutant <ccoutant@google.com>
600 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
601 casts to match formatting specs.
602 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
604 2011-08-26 Cary Coutant <ccoutant@google.com>
606 * layout.cc (Free_list::allocate): Provide guarantee of minimum
607 remaining hole size when allocating.
608 (Layout::make_output_section): Set fill methods for debug sections.
609 * layout.h (Free_list::Free_list_node): Move from private to
611 (Free_list::set_min_hole_size): New function.
612 (Free_list::begin, Free_list::end): New functions.
613 (Free_list::min_hole_): New data member.
614 * output.cc: Include dwarf.h.
615 (Output_fill_debug_info::do_minimum_hole_size): New function.
616 (Output_fill_debug_info::do_write): New function.
617 (Output_fill_debug_line::do_minimum_hole_size): New function.
618 (Output_fill_debug_line::do_write): New function.
619 (Output_section::Output_section): Initialize new data member.
620 (Output_section::set_final_data_size): Ensure patch space is larger
621 than minimum hole size.
622 (Output_section::do_write): Fill holes in debug sections.
623 * output.h (Output_fill): New class.
624 (Output_fill_debug_info): New class.
625 (Output_fill_debug_line): New class.
626 (Output_section::set_free_space_fill): New function.
627 (Output_section::free_space_fill_): New data member.
628 * testsuite/Makefile.am (incremental_test_3): Add
629 --incremental-patch option.
630 (incremental_test_4): Likewise.
631 (incremental_test_5): Likewise.
632 (incremental_test_6): Likewise.
633 (incremental_copy_test): Likewise.
634 (incremental_common_test_1): Likewise.
635 * testsuite/Makefile.in: Regenerate.
637 2011-08-26 Nick Clifton <nickc@redhat.com>
639 * po/es.po: Updated Spanish translation.
641 2011-08-01 Cary Coutant <ccoutant@google.com>
643 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
644 * gold/testsuite/Makefile.in: Regenerate.
645 * gold/testsuite/justsyms_exec.c: New source file.
646 * gold/testsuite/justsyms_lib.c: New source file.
648 2011-08-01 Cary Coutant <ccoutant@google.com>
650 * layout.cc (Layout::set_segment_offsets): Don't realign text
651 segment if -Ttext was specified.
652 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
654 * object.h (Sized_relobj_file::e_type): New function.
655 (Sized_relobj_file::e_type_): New data member.
656 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
657 base address for ET_EXEC files.
658 * target.cc (Target::do_make_elf_object_implementation): Allow
659 ET_EXEC files with --just-symbols option.
661 2011-07-28 Cary Coutant <ccoutant@google.com>
663 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
664 Add thread_number parameter.
665 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
666 * workqueue-threads.cc
667 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
668 current thread if its thread number is greater than desired thread
670 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
671 Add thread_number parameter.
672 (Workqueue::should_cancel_thread): Likewise.
673 (Workqueue::find_runnable_or_wait): Pass thread_number to
674 should_cancel_thread.
675 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
678 2011-07-22 Sriraman Tallam <tmsriram@google.com>
680 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
681 only after checking if it cannot be forced local.
682 * symtab.h (is_externally_visible): Check if the symbol is not forced
685 2011-07-15 Ian Lance Taylor <iant@google.com>
687 * options.h (class General_options): Add --print-output-format.
688 Move -EL next to -EB, for better --help output.
689 * target-select.cc: Include <cstdio>, "options.h", and
691 (Target_selector::do_target_bfd_name): New function.
692 (print_output_format): New function.
693 * target-select.h (class Target_selector): Update declarations.
694 (Target_selector::target_bfd_name): New function.
695 (print_output_format): Declare.
696 * main.cc: Include "target-select.h".
697 (main): Handle --print-output-format.
698 * gold.cc: Include "target-select.h".
699 (queue_initial_tasks): Handle --print-output-format when there are
701 * parameters.cc (parameters_force_valid_target): Give a better
702 error message if -EB/-EL does not match target.
703 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
706 2011-07-15 Ian Lance Taylor <iant@google.com>
708 * i386.cc (class Output_data_plt_i386): Add layout_ field.
709 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
710 (Output_data_plt_i386::do_write): Write address of .dynamic
711 section to first entry in .got.plt section.
712 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
713 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
715 (Output_data_plt_x86_64::do_write): Write address of .dynamic
716 section to first entry in .got.plt section.
717 * layout.h (Layout::dynamic_section): New function.
719 2011-07-13 Sriraman Tallam <tmsriram@google.com>
721 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
723 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
724 input_section_position_, and input_section_glob_.
725 (read_layout_from_file): Call function section_ordering_specified.
726 * layout.h (is_section_ordering_specified): New function.
727 (section_ordering_specified): New function.
728 (section_ordering_specified_): New boolean member.
729 * main.cc(main): Call load_plugins after layout object is defined.
730 * output.cc (Output_section::add_input_section): Use
731 function section_ordering_specified to check if section ordering is
733 * output.cc (Output_section::add_relaxed_input_section): Use
734 function section_ordering_specified to check if section ordering is
736 (Output_section::update_section_layout): New function.
737 (Output_section::sort_attached_input_sections): Check if input section
739 * output.h (Output_section::update_section_layout): New function.
740 * plugin.cc (get_section_count): New function.
741 (get_section_type): New function.
742 (get_section_name): New function.
743 (get_section_contents): New function.
744 (update_section_order): New function.
745 (allow_section_ordering): New function.
746 (Plugin::load): Add the new interfaces to the transfer vector.
747 (Plugin_manager::load_plugins): New parameter.
748 (Plugin_manager::all_symbols_read): New parameter.
749 (Plugin_manager::claim_file): New parameter. Save the elf object for
751 (Plugin_manager::get_elf_object): New function.
752 (Plugin_manager::get_view): Change to directly use the bool to check
753 if get_view is called from claim_file_hook.
754 * plugin.h (input_objects): New function
755 (Plugin__manager::load_plugins): New parameter.
756 (Plugin_manager::claim_file): New parameter.
757 (Plugin_manager::get_elf_object): New function.
758 (Plugin_manager::in_claim_file_handler): New function.
759 (Plugin_manager::in_claim_file_handler_): New member.
760 (layout): New function.
761 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
762 handler with an extra parameter. Make the elf object before calling
764 * testsuite/plugin_test.c (get_section_count): New function pointer.
765 (get_section_type): New function pointer.
766 (get_section_name): New function pointer.
767 (get_section_contents): New function pointer.
768 (update_section_order): New function pointer.
769 (allow_section_ordering): New function pointer.
770 (onload): Check if the new interfaces exist.
772 2011-07-13 Ian Lance Taylor <iant@google.com>
774 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
776 * x86_64.cc (Target_x86_64::got_section): Likewise.
777 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
778 (relro_now_test_SOURCES): New variable.
779 (relro_now_test_DEPENDENCIES): New variable.
780 (relro_now_test_LDFLAGS): New variable.
781 (relro_now_test_LDADD): New variable.
782 (relro_now_test.so): New target.
783 * testsuite/Makefile.in: Rebuild.
785 2011-07-12 Ian Lance Taylor <iant@google.com>
788 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
789 GLOB_DAT relocation rather than a RELATIVE relocation for a
790 protected symbol when creating a shared library.
791 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
792 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
793 * testsuite/protected_main_1.cc (main): Test that protected
794 function has same address.
796 2011-07-11 Ian Lance Taylor <iant@google.com>
799 * options.h (class General_options): Add -Bgroup.
800 * options.cc (General_options::finalize): If -Bgroup is set,
801 default to --unresolved-symbols=report-all.
802 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
803 * target-reloc.h (issue_undefined_symbol_error): Handle
804 --unresolved-symbols=report-all.
806 2011-07-08 Ian Lance Taylor <iant@google.com>
809 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
810 if linker script discards key sections.
811 (Layout::create_dynamic_symtab): Likewise.
812 (Layout::assign_local_dynsym_offsets): Likewise.
813 (Layout::sized_create_version_sections): Likewise.
814 (Layout::create_interp): Likewise.
815 (Layout::finish_dynamic_section): Likewise.
816 (Layout::set_dynamic_symbol_size): Likewise.
818 2011-07-08 Ian Lance Taylor <iant@google.com>
821 * options.h (class General_options): Add --unresolved-symbols.
822 * target-reloc.h (issue_undefined_symbol_error): Check
823 --unresolved-symbols. Add comments.
825 2011-07-08 Ian Lance Taylor <iant@google.com>
827 * testsuite/odr_violation2.cc (Ordering::operator()): Make
828 expression more complex.
830 2011-07-08 Ian Lance Taylor <iant@google.com>
833 * target-reloc.h (issue_undefined_symbol_error): New inline
834 function, broken out of relocate_section.
835 (relocate_section): Call issue_undefined_symbol_error.
836 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
837 there is no TLS segment if we are about to issue an undefined
839 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
841 2011-07-08 Ian Lance Taylor <iant@google.com>
844 * resolve.cc (Symbol_table::should_override): Add fromtype
845 parameter. Change all callers. Give error when linking together
846 TLS and non-TLS symbol.
847 (Symbol_table::should_override_with_special): Add fromtype
848 parameter. Change all callers.
849 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
850 there is no TLS segment if we have reported some errors.
851 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
853 2011-07-08 Ian Lance Taylor <iant@google.com>
856 * target.h (Target::plt_address_for_global): New function.
857 (Target::plt_address_for_local): New function.
858 (Target::plt_section_for_global): Remove.
859 (Target::plt_section_for_local): Remove.
860 (Target::do_plt_address_for_global): New virtual function.
861 (Target::do_plt_address_for_local): New virtual function.
862 (Target::do_plt_section_for_global): Remove.
863 (Target::do_plt_section_for_local): Remove.
864 (Target::register_global_plt_entry): Add Symbol_table and Layout
866 * output.cc (Output_data_got::Got_entry::write): Use
867 plt_address_for_global and plt_address_for_local.
868 * layout.cc (Layout::add_target_dynamic_tags): Use size and
869 address of output section.
870 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
871 got_irelative_, and irelative_count_ fields. Update
873 (Output_data_plt_i386::has_irelative_section): New function.
874 (Output_data_plt_i386::entry_count): Add irelative_count_.
875 (Output_data_plt_i386::set_final_data_size): Likewise.
876 (class Target_i386): Add got_irelative_ and rel_irelative_
877 fields. Update declarations.
878 (Target_i386::Target_i386): Initialize new fields.
879 (Target_i386::do_plt_address_for_global): New function replacing
880 do_plt_section_for_global.
881 (Target_i386::do_plt_address_for_local): New function replacing
882 do_plt_section_for_local.
883 (Target_i386::got_section): Create got_irelative_.
884 (Target_i386::rel_irelative_section): New function.
885 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
886 fields. Don't define __rel_iplt_{start,end}.
887 (Output_data_plt_i386::add_entry): Add symtab and layout
888 parameters. Change all callers. Use different PLT and GOT for
890 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
891 layout parameters. Change all callers. Use different PLT and
893 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
894 (Output_data_plt_i386::rel_irelative): New function.
895 (Output_data_plt_i386::address_for_global): New function.
896 (Output_data_plt_i386::address_for_local): New function.
897 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
898 IRELATIVE GOT when changing IFUNC GOT entries.
899 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
901 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
902 if we didn't create an IRELATIVE GOT.
903 (Target_i386::Relocate::relocate): Use plt_address_for_global and
904 plt_address_for_local.
905 (Target_i386::do_dynsym_value): Use plt_address_for_global.
906 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
907 got_irelative_, and irelative_count_ fields. Update
909 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
910 Initialize new fields. Remove symtab parameter. Change all
912 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
914 (Output_data_plt_x86_64::has_irelative_section): New function.
915 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
916 (class Target_x86_64): Add got_irelative_ and rel_irelative_
917 fields. Update declarations.
918 (Target_x86_64::Target_x86_64): Initialize new fields.
919 (Target_x86_64::do_plt_address_for_global): New function replacing
920 do_plt_section_for_global.
921 (Target_x86_64::do_plt_address_for_local): New function replacing
922 do_plt_section_for_local.
923 (Target_x86_64::got_section): Create got_irelative_.
924 (Target_x86_64::rela_irelative_section): New function.
925 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
926 all callers. Don't create __rel_iplt_{start,end}.
927 (Output_data_plt_x86_64::add_entry): Add symtab and layout
928 parameters. Change all callers. Use different PLT and GOT for
930 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
931 layout parameters. Change all callers. Use different PLT and
933 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
934 parameters. Change all callers. Use different PLT and GOT for
936 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
937 (Output_data_plt_x86_64::rela_irelative): New function.
938 (Output_data_plt_x86_64::address_for_global): New function.
939 (Output_data_plt_x86_64::address_for_local): New function.
940 (Output_data_plt_x86_64::set_final_data_size): Likewise.
941 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
942 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
943 (Target_x86_64::register_global_plt_entry): Add symtab and layout
945 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
947 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
948 symbols if we didn't create an IRELATIVE GOT.
949 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
950 plt_address_for_local.
951 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
952 * testsuite/ifuncvar1.c: New test file.
953 * testsuite/ifuncvar2.c: New test file.
954 * testsuite/ifuncvar3.c: New test file.
955 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
956 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
957 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
958 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
959 * testsuite/Makefile.in: Rebuild.
961 2011-07-07 Cary Coutant <ccoutant@google.com>
963 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
964 (two_file_test_1_ndebug.o): Likewise.
965 (two_file_test_1b_ndebug.o): Likewise.
966 (two_file_test_2_ndebug.o): Likewise.
967 (two_file_test_main_ndebug.o): Likewise.
968 (incremental_test_2): Link with no-debug versions.
970 2011-07-06 Cary Coutant <ccoutant@google.com>
972 * gold/incremental.cc
973 (Output_section_incremental_inputs::write_info_blocks): Check for
974 hidden and internal symbols.
976 2011-07-06 Cary Coutant <ccoutant@google.com>
978 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
979 Check disposition for startup file.
980 (Incremental_inputs::report_command_line): Ignore
981 --incremental-startup-unchanged option.
982 * options.cc (General_options::parse_incremental_startup_unchanged):
984 (General_options::General_options): Initialize new data member.
985 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
986 (General_options): Add --incremental-startup-unchanged option.
987 (General_options::incremental_startup_disposition): New function.
988 (General_options::incremental_startup_disposition_): New data member.
990 2011-07-06 Cary Coutant <ccoutant@google.com>
992 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
993 input file index to Script_info ctor.
994 (Sized_incremental_binary::do_file_has_changed): Find the
995 command-line argument for files named in scripts.
996 * incremental.h (Script_info::Script_info): New ctor
997 with input file index.
998 (Script_info::input_file_index): New function.
999 (Script_info::input_file_index_): New data member.
1000 (Incremental_binary::get_library): Add const.
1001 (Incremental_binary::get_script_info): Add const.
1002 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
1003 * testsuite/Makefile.am (incremental_test_5): New test case.
1004 (incremental_test_6): New test case.
1005 * testsuite/Makefile.in: Regenerate.
1007 2011-07-06 Cary Coutant <ccoutant@google.com>
1009 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
1010 debug output when command lines differ.
1012 2011-07-06 Cary Coutant <ccoutant@google.com>
1014 * incremental.cc (Incremental_inputs::report_command_line): Ignore
1015 --incremental-patch option.
1016 * layout.cc (Free_list::allocate): Extend allocation beyond original
1018 (Layout::make_output_section): Mark sections that should get
1020 * options.cc (parse_percent): New function.
1021 * options.h (parse_percent): New function.
1022 (DEFINE_percent): New macro.
1023 (General_options): Add --incremental-patch option.
1024 * output.cc (Output_section::Output_section): Initialize new data
1026 (Output_section::add_input_section): Print section name when out
1028 (Output_section::add_output_section_data): Likewise.
1029 (Output_section::set_final_data_size): Add patch space when
1030 doing --incremental-full.
1031 (Output_section::do_reset_address_and_file_offset): Remove patch
1033 (Output_segment::set_section_list_addresses): Print debug output
1034 only if --incremental-update.
1035 * output.h (Output_section::set_is_patch_space_allowed): New function.
1036 (Output_section::is_patch_space_allowed_): New data member.
1037 (Output_section::patch_space_): New data member.
1038 * parameters.cc (Parameters::incremental_full): New function.
1039 * parameters.h (Parameters::incremental_full): New function
1040 * testsuite/Makefile.am (incremental_test_2): Add test for
1041 --incremental-patch option.
1042 * testsuite/Makefile.in: Regenerate.
1043 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
1044 (t18): Remove function body.
1046 2011-07-05 Doug Kwan <dougkwan@google.com>
1049 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
1050 Arm_Address type for relocation result.
1051 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
1053 (Arm_relocate_functions::abs32): Use unaligned access.
1054 (Arm_relocate_functions::rel32): Ditto.
1055 (Arm_relocate_functions::prel31): Ditto.
1056 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
1057 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
1058 static data relocations.
1059 * testsuite/Makefile.in: Regnerate.
1060 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
1062 2011-07-05 Ian Lance Taylor <iant@google.com>
1065 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
1066 symbols if necessary.
1067 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1069 2011-07-05 Ian Lance Taylor <iant@google.com>
1072 * resolve.cc (Symbol::override_base_with_special): Simply override
1073 version with special symbol version, ignoring previous version.
1075 2011-07-05 Ian Lance Taylor <iant@google.com>
1077 * object.cc (Sized_relobj_file::include_section_group): Add
1078 information to comment about signature location.
1080 2011-07-02 Ian Lance Taylor <iant@google.com>
1083 * options.h (class General_options): Add -f and -F.
1084 * options.cc (General_options::finalize): Fatal error if -f/-F
1085 are used without -shared.
1086 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
1088 2011-07-02 Ian Lance Taylor <iant@google.com>
1090 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
1092 2011-07-01 Ian Lance Taylor <iant@google.com>
1096 * resolve.cc (Symbol::override_base_with_special): Don't override
1097 the version if the overriding symbol has a different name.
1098 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
1099 all callers. If we give an error about an undefined version,
1100 define the base version if necessary.
1101 * dynobj.h (class Versions): Update declaration.
1102 * testsuite/weak_alias_test_5.cc: New file.
1103 * testsuite/weak_alias_test.script: New file.
1104 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
1105 and versioned_alias have the right value, and call t2.
1106 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
1107 weak_alias_test_5.so.
1108 (weak_alias_test_LDADD): Likewise.
1109 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
1110 * testsuite/Makefile.in: Rebuild.
1112 2011-07-01 Ian Lance Taylor <iant@google.com>
1115 * options.h (class General_options): Support -z notext.
1116 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
1118 (two_file_shared_nonpic.so): Likewise.
1119 (two_file_shared_mixed.so): Likewise.
1120 (two_file_shared_mixed_1.so): Likewise.
1121 (weak_undef_lib_nonpic.so): Likewise.
1122 (alt/weak_undef_lib_nonpic.so): Likewise.
1123 (tls_test_shared_nonpic.so): Likewise.
1124 * testsuite/Makefile.in: Rebuild.
1126 2011-07-01 Ian Lance Taylor <iant@google.com>
1129 * configure.ac: Test whether static linking works, setting
1130 the automake conditional HAVE_STATIC.
1131 * testsuite/Makefile.am: Disable tests using -static if
1132 HAVE_STATIC is not true.
1133 * configure, testsuite/Makefile.in: Rebuild.
1135 2011-07-01 Ian Lance Taylor <iant@google.com>
1138 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
1139 Assert if we see DW_EH_PE_indirect.
1140 * target.h (Target::ehframe_datarel_base): New function.
1141 (Target::do_ehframe_datarel_base): New target function.
1142 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
1143 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
1146 2011-07-01 Ian Lance Taylor <iant@google.com>
1149 * options.h (class General_options): Add
1150 --ld-generated-unwind-info.
1151 * ehframe.cc (Fde::write): Add address parameter. Change all
1152 callers. If associated with PLT, fill in address and size.
1153 (Cie::set_output_offset): Only add merge mapping if there is an
1155 (Cie::write): Add address parameter. Change all callers.
1156 (Eh_frame::add_ehframe_for_plt): New function.
1157 * ehframe.h (class Fde): Update declarations. Move shndx_ and
1158 input_offset_ fields into union u_, with new plt field.
1159 (Fde::Fde): Adjust for new union field.
1160 (Fde::Fde) [Output_data version]: New constructor.
1161 (Fde::add_mapping): Only add merge mapping if there is an object.
1162 (class Cie): Update declarations.
1163 (class Eh_frame): Declare add_ehframe_for_plt.
1164 * layout.cc (Layout::layout_eh_frame): Break out code into
1165 make_eh_frame_section, and call it.
1166 (Layout::make_eh_frame_section): New function.
1167 (Layout::add_eh_frame_for_plt): New function.
1168 * layout.h (class Layout): Update declarations.
1169 * merge.cc (Merge_map::add_mapping): Add assertion.
1170 * i386.cc: Include "dwarf.h".
1171 (class Output_data_plt_i386): Make first_plt_entry,
1172 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
1173 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1174 and plt_eh_frame_fde.
1175 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
1176 boundary. Call add_eh_frame_for_plt if appropriate.
1177 * x86_64.cc: Include "dwarf.h".
1178 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
1179 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
1180 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1181 and plt_eh_frame_fde.
1182 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
1185 2011-06-29 Ian Lance Taylor <iant@google.com>
1188 * object.cc (Sized_relobj_file::layout_section): Change shdr
1189 parameter to be const.
1190 (Sized_relobj_file::layout_eh_frame_section): New function, broken
1192 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
1193 appropriate. Call layout_eh_frame_section.
1194 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
1196 * object.h (class Sized_relobj_file): Update declarations.
1198 2011-06-29 Ian Lance Taylor <iant@google.com>
1201 * script.cc (Token::integer_value): Accept trailing M/m/K/k
1203 (Lex::gather_token): Accept trailing M/m/K/k for integers.
1205 2011-06-29 Ian Lance Taylor <iant@google.com>
1208 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
1210 * layout.cc (Layout::layout_eh_frame): Likewise.
1212 2011-06-29 Ian Lance Taylor <iant@google.com>
1215 * layout.cc (Layout::symtab_section_shndx): New function.
1216 * layout.h (class Layout): Declare symtab_section_shndx.
1217 * output.cc (Output_section::write_header): Call it.
1219 2011-06-29 Ian Lance Taylor <iant@google.com>
1222 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
1223 symbols which are not used in a relocation.
1225 2011-06-28 Ian Lance Taylor <iant@google.com>
1228 * layout.cc (Layout::segment_precedes): Don't crash if a linker
1229 script create indistinguishable segments.
1230 (Layout::set_segment_offsets): Use stable_sort when sorting
1231 segments. Pass this to Compare_segments constructor.
1232 * layout.h (class Layout): Make segment_precedes non-static.
1233 (class Compare_segments): Change from struct to class. Add
1234 layout_ field. Add constructor.
1235 * script-sections.cc
1236 (Script_sections::attach_sections_using_phdrs_clause): Rename
1237 local orphan to is_orphan. Don't report failure to put empty
1238 section in segment. On attachment failure, report name of
1239 section, and attach to first PT_LOAD segment.
1241 2011-06-28 Ian Lance Taylor <iant@google.com>
1244 * target-select.cc (Target_selector::Target_selector): Add
1245 emulation parameter. Change all callers.
1246 (select_target_by_bfd_name): Rename from select_target_by_name.
1248 (select_target_by_emulation): New function.
1249 (supported_emulation_names): New function.
1250 * target-select.h (class Target_selector): Add emulation_ field.
1251 Update declarations.
1252 (Target_selector::recognize_by_bfd_name): Rename from
1253 recognize_by_name. Change all callers.
1254 (Target_selector::supported_bfd_names): Rename from
1255 supported_names. Change all callers.
1256 (Target_selector::recognize_by_emulation): New function.
1257 (Target_selector::supported_emulations): New function.
1258 (Target_selector::emulation): New function.
1259 (Target_selector::do_recognize_by_bfd_name): Rename from
1260 do_recognize_by_name. Change all callers.
1261 (Target_selector::do_supported_bfd_names): Rename from
1262 do_supported_names. Change all callers.
1263 (Target_selector::do_recognize_by_emulation): New function.
1264 (Target_selector::do_supported_emulations): New function.
1265 (select_target_by_bfd_name): Change name in declaration.
1266 (select_target_by_emulation): Declare.
1267 (supported_emulation_names): Declare.
1268 * parameters.cc (parameters_force_valid_target): Try to find
1269 target based on emulation from -m option.
1270 * options.h (class General_options): Change doc string for -m.
1271 * options.cc (help): Print emulations.
1272 (General_options::parse_V): Likewise.
1273 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1274 Add emulation parameter. Change all callers.
1276 2011-06-28 Ian Lance Taylor <iant@google.com>
1278 * target.h (class Target): Add osabi_ field.
1279 (Target::osabi): New function.
1280 (Target::set_osabi): New function.
1281 (Target::Target): Initialize osabi_.
1282 (Target::do_adjust_elf_header): Make pure virtual.
1283 (Sized_target::do_adjust_elf_header): Declare.
1284 * target.cc (Sized_target::do_adjust_elf_header): New function.
1285 (class Sized_target): Instantiate all versions.
1286 * freebsd.h (class Target_freebsd): Remove.
1287 (Target_selector_freebsd::do_recognize): Call set_osabi on
1289 (Target_selector_freebsd::do_recognize_by_name): Likewise.
1290 (Target_selector_freebsd::set_osabi): Remove.
1291 * i386.cc (class Target_i386): Inherit from Sized_target rather
1292 than Target_freebsd.
1293 * x86_64.cc (class Target_x86_64): Likewise.
1295 2011-06-28 Ian Lance Taylor <iant@google.com>
1297 * target.h (Target::can_check_for_function_pointers): Rewrite.
1299 (Target::can_icf_inline_merge_sections): Likewise.
1300 (Target::section_may_have_icf_unsafe_poineters): Likewise.
1301 (Target::Target_info): Add can_icf_inline_merge_sections field.
1302 (Target::do_can_check_for_function_pointers): New virtual
1304 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
1305 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
1306 from can_check_for_function_pointers, move in file.
1307 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
1308 section_may_have_icf_unsafe_poineters, move in file.
1309 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
1310 * i386.cc (Target_i386::do_can_check_for_function_pointers):
1311 Rename from can_check_for_function_pointers, move in file.
1312 (Target_i386::can_icf_inline_merge_sections): Remove.
1313 (Target_i386::i386_info): Initialize
1314 can_icf_inline_merge_sections.
1315 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1316 Initialize can_icf_inline_merge_sections.
1317 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
1318 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
1319 Rename from can_check_for_function_pointers, move in file.
1320 (Target_x86_64::can_icf_inline_merge_sections): Remove.
1321 (Target_x86_64::x86_64_info): Initialize
1322 can_icf_inline_merge_sections.
1323 * testsuite/testfile.cc (Target_test::test_target_info):
1325 * icf.cc (get_section_contents): Correct formatting.
1327 2011-06-27 Ian Lance Taylor <iant@google.com>
1329 * symtab.cc (Symbol::versioned_name): New function.
1330 (Symbol_table::add_to_final_symtab): Use versioned_name when
1332 (Symbol_table::sized_write_symbol): Likewise.
1333 * symtab.h (class Symbol): Declare versioned_name.
1334 * stringpool.h (class Stringpool_template): Add variant of add
1335 which takes a std::basic_string.
1336 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
1337 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
1338 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
1339 (ver_test_12.o): New target.
1340 * testsuite/Makefile.in: Rebuild.
1342 2011-06-27 Doug Kwan <dougkwan@google.com>
1344 * arm.cc (Arm_relocate_functions::thm_jump8,
1345 Arm_relocate_functions::thm_jump11): Use a wider signed
1346 type to compute offset.
1347 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
1349 * testsuite/Makefile.in: Regenerate.
1350 * testsuite/arm_branch_in_range.sh: Check test results of
1351 arm_thm_jump11 and arm_thm_jump8.
1352 * testsuite/arm_thm_jump11.s: New test source file.
1353 * testsuite/arm_thm_jump11.t: New linker script.
1354 * testsuite/arm_thm_jump8.s: New test source file.
1355 * testsuite/arm_thm_jump8.t: New linker script.
1357 2011-06-24 Ian Lance Taylor <iant@google.com>
1359 * layout.cc: Include "object.h".
1360 (ctors_sections_in_init_array): New static variable.
1361 (Layout::is_ctors_in_init_array): New function.
1362 (Layout::layout): Add entry to ctors_sections_in_init_array if
1364 * layout.h (class Layout): Declare is_ctors_in_init_array.
1365 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
1366 is_ctors_reverse_view is set.
1367 (Sized_relobj_file::write_sections): Add layout parameter. Change
1368 all callers. Set is_ctors_reverse_view field of View_size.
1369 (Sized_relobj_file::reverse_words): New function.
1370 * object.h (Sized_relobj_file::View_size): Add
1371 is_ctors_reverse_view field.
1372 (class Sized_relobj_file): Update declarations.
1373 * testsuite/initpri3.c: New test.
1374 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
1376 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
1377 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
1378 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
1379 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
1380 * testsuite/Makefile.in: Rebuild.
1382 2011-06-24 Cary Coutant <ccoutant@google.com>
1384 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
1385 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
1386 (debug_msg_cdebug.err): New targets.
1387 * testsuite/Makefile.in: Regenerate.
1388 * testsuite/debug_msg.sh: Check output of link with compressed debug.
1389 Fix checks for link with shared library.
1391 2011-06-24 Doug Kwan <dougkwan@google.com>
1393 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
1394 skip empty text sections.
1395 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
1397 2011-06-22 Ian Lance Taylor <iant@google.com>
1400 * options.h (class General_options): Add --ctors-in-init-array.
1401 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
1402 friends as SHT_PROGBITS for merging sections.
1403 (Layout::layout): Remove special handling of .init_array and
1404 friends. Don't sort if doing relocatable link. Sort for .ctors
1405 and .dtors if ctors_in_init_array.
1406 (Layout::make_output_section): Force correct section types for
1407 .init_array and friends. Don't sort if doing relocatable link,
1408 Don't sort .ctors and .dtors if ctors_in_init_array.
1409 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
1410 (Layout::output_section_name): Add relobj parameter. Change all
1411 callers. Handle .ctors. and .dtors. in code rather than table.
1412 Handle .ctors and .dtors if ctors_in_init_array.
1413 (Layout::match_file_name): New function, moved from output.cc.
1414 * layout.h (class Layout): Update declarations.
1415 * output.cc: Include "layout.h".
1416 (Input_section_sort_entry::get_priority): New function.
1417 (Input_section_sort_entry::match_file_name): Just call
1418 Layout::match_file_name.
1419 (Output_section::Input_section_sort_init_fini_compare::operator()):
1420 Handle .ctors and .dtors. Sort by explicit priority rather than
1422 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
1423 * testsuite/initpri2.c: New test.
1424 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
1425 (check_PROGRAMS): Add initpri2.
1426 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
1427 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
1428 * configure, testsuite/Makefile.in: Rebuild.
1430 2011-06-19 Ian Lance Taylor <iant@google.com>
1433 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
1434 .interp section to a PT_INTERP segment even if we have seen a
1435 --dynamic-linker option. Don't do it if we have seen a PHDRS
1436 clause in a linker script.
1437 (Layout::finalize): Don't create a .interp section if we've
1438 already create a PT_INTERP segment.
1439 (Layout::create_interp): Always call choose_output_section (revert
1440 patch of 2011-06-17). Don't create PT_INTERP segment.
1441 * script-sections.cc
1442 (Script_sections::create_note_and_tls_segments): Add a .interp
1443 section to a PT_INTERP segment even if we have seen a
1444 --dynamic-linker option.
1446 2011-06-18 Ian Lance Taylor <iant@google.com>
1448 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
1449 merely because a non-PT_LOAD segment has a dynamic reloc.
1451 2011-06-18 Ian Lance Taylor <iant@google.com>
1453 * layout.cc (Layout::finish_dynamic_section): Don't create
1454 DT_FLAGS entry if not needed.
1456 2011-06-18 Ian Lance Taylor <iant@google.com>
1459 * layout.cc (Layout::layout_eh_frame): Correct handling of
1460 writable .eh_frame section.
1462 2011-06-17 Ian Lance Taylor <iant@google.com>
1465 * resolve.cc (Symbol_table::resolve): Don't give an error if a
1466 symbol is redefined with the exact same object and value.
1468 2011-06-17 Ian Lance Taylor <iant@google.com>
1471 * layout.h (class Layout): Add interp_segment_ field.
1472 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
1473 (Layout::attach_allocated_section_to_segment): If making shared
1474 library, put .interp section in PT_INTERP segment.
1475 (Layout::finalize): Also call create_interp if -dynamic-linker
1477 (Layout::create_interp): Assert that there is no PT_INTERP
1478 segment. If not using a SECTIONS clause, use make_output_section.
1479 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
1480 * script-sections.cc
1481 (Script_sections::create_note_and_tls_segments): If making shared
1482 library, put .interp section in PT_INTERP segment.
1484 2011-06-17 Ian Lance Taylor <iant@google.com>
1486 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
1487 when making a shared library.
1489 2011-06-17 Ian Lance Taylor <iant@google.com>
1491 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
1492 parameter. Change all callers. Don't issue warning about PC32
1493 against locally defined symbol.
1495 2011-06-16 Ian Lance Taylor <iant@google.com>
1497 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
1498 occurs in same object.
1500 2011-06-14 Alan Modra <amodra@gmail.com>
1502 * po/POTFILES.in: Regenerate.
1504 2011-06-09 Ian Lance Taylor <iant@google.com>
1506 * script-sections.cc
1507 (Orphan_output_section::set_section_addresses): For a relocatable
1508 link set address to 0.
1510 2011-06-09 Cary Coutant <ccoutant@google.com>
1513 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
1514 used with --compress-debug-sections.
1515 * gold/object.cc (Sized_relobj_file::do_layout): Report
1516 uncompressed size of compressed input sections.
1518 2011-06-08 Cary Coutant <ccoutant@google.com>
1521 * testsuite/two_file_test_2_v1.cc: Change initialization of
1522 v2 to keep it in .data.
1524 2011-06-07 Cary Coutant <ccoutant@google.com>
1526 * common.cc (Symbol_table::do_allocate_commons_list): Call
1528 * errors.cc (Errors::fatal): Adjust call to gold_exit.
1529 (Errors::fallback): New function.
1530 (gold_fallback): New function.
1531 * errors.h (Errors::fallback): New function.
1532 * gold.cc (gold_exit): Change status parameter to enum; adjust
1534 (queue_initial_tasks): Call gold_fallback.
1535 * gold.h: Include cstdlib.
1536 (Exit_status): New enum type.
1537 (gold_exit): Change status parameter to enum.
1538 (gold_fallback): New function.
1539 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
1540 (Layout::create_symtab_sections): Likewise.
1541 (Layout::create_shdrs): Likewise.
1542 * main.cc (main): Adjust call to gold_exit.
1543 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
1544 (Output_data_got::add_got_entry_pair): Likewise.
1545 (Output_section::add_input_section): Likewise.
1546 (Output_section::add_output_section_data): Likewise.
1547 (Output_segment::set_section_list_addresses): Likewise.
1548 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
1550 2011-06-07 Cary Coutant <ccoutant@google.com>
1552 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
1553 for incremental links.
1554 * output.cc (Output_segment::set_section_list_addresses): Remove
1555 FIXME and test for TLS or BSS.
1557 2011-06-07 Cary Coutant <ccoutant@google.com>
1559 * testsuite/Makefile.am: Add incremental_copy_test,
1560 incremental_common_test_1.
1561 * testsuite/Makefile.in: Regenerate.
1562 * testsuite/common_test_1_v1.c: New source file.
1563 * testsuite/common_test_1_v2.c: New source file.
1564 * testsuite/copy_test_v1.cc: New source file.
1566 2011-06-07 Cary Coutant <ccoutant@google.com>
1568 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
1569 update, allocate common from bss section's free list.
1570 * incremental-dump.cc (dump_incremental_inputs): Print flag for
1571 linker-defined symbols.
1572 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1573 Skip GOT and PLT entries that are no longer referenced.
1574 (Output_section_incremental_inputs::write_info_blocks): Mark
1575 linker-defined symbols.
1576 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
1577 * output.cc (Output_section::allocate): New function.
1578 * output.h (Output_section::allocate): New function.
1579 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
1580 linker-defined symbols.
1581 (Symbol::override_base_with_special): Copy is_predefined_ flag.
1582 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
1583 (Symbol::init_base_output_data): Likewise.
1584 (Symbol::init_base_output_segment): Likewise.
1585 (Symbol::init_base_constant): Likewise.
1586 (Sized_symbol::init_output_data): Likewise.
1587 (Sized_symbol::init_output_segment): Likewise.
1588 (Sized_symbol::init_constant): Likewise.
1589 (Symbol_table::do_define_in_output_data): Likewise.
1590 (Symbol_table::do_define_in_output_segment): Likewise.
1591 (Symbol_table::do_define_as_constant): Likewise.
1592 * symtab.h (Symbol::is_predefined): New function.
1593 (Symbol::init_base_output_data): Add is_predefined parameter.
1594 (Symbol::init_base_output_segment): Likewise.
1595 (Symbol::init_base_constant): Likewise.
1596 (Symbol::is_predefined_): New data member.
1597 (Sized_symbol::init_output_data): Add is_predefined parameter.
1598 (Sized_symbol::init_output_segment): Likewise.
1599 (Sized_symbol::init_constant): Likewise.
1600 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
1602 2011-06-07 Cary Coutant <ccoutant@google.com>
1604 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
1605 instead of emit_copy_reloc.
1606 (Copy_relocs::emit_copy_reloc): Refactor.
1607 (Copy_relocs::make_copy_reloc): New function.
1608 (Copy_relocs::add_copy_reloc): Remove.
1609 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
1611 (Copy_relocs::make_copy_reloc): New function.
1612 (Copy_relocs::add_copy_reloc): Remove.
1613 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
1614 unchanged input files.
1615 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
1616 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
1617 Reserve BSS space for COPY relocations.
1618 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1619 (Output_section_incremental_inputs::write_info_blocks): Record
1620 whether a symbol is copied from a shared object.
1621 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
1622 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
1623 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
1624 (Incremental_input_entry_reader::get_output_symbol_index): Add
1626 (Incremental_binary::emit_copy_relocs): New function.
1627 (Incremental_binary::do_emit_copy_relocs): New function.
1628 (Sized_incremental_binary::Sized_incremental_binary): Initialize
1630 (Sized_incremental_binary::add_copy_reloc): New function.
1631 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1632 (Sized_incremental_binary::Copy_reloc): New struct.
1633 (Sized_incremental_binary::Copy_relocs): New typedef.
1634 (Sized_incremental_binary::copy_relocs_): New data member.
1635 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
1636 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
1637 * target.h (Sized_target::emit_copy_reloc): New function.
1638 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
1640 2011-06-02 Cary Coutant <ccoutant@google.com>
1643 * gold/archive.cc (Archive::Archive): Initialize new data member.
1644 (Archive::include_all_members): Return if archive has already been
1646 * gold/archive.h (Archive::include_all_members_): New data member.
1648 2011-06-02 Nick Clifton <nickc@redhat.com>
1650 * dynobj.h: Fix spelling mistake in comment.
1651 * output.cc: Likewise.
1653 2011-05-31 Doug Kwan <dougkwan@google.com>
1657 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
1658 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
1659 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
1660 redundant arm_exidx_test.so.
1661 * testsuite/Makefile.in: Regenerate.
1662 (check_SCRIPTS): Add pr12826.sh
1663 (check_DATA): Add pr12826.stdout
1664 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
1665 * testsuite/pr12826.sh: New file.
1666 * testsuite/pr12826_1.s: Ditto.
1667 * testsuite/pr12826_1.s: Ditto.
1669 2011-05-30 Ian Lance Taylor <iant@google.com>
1671 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
1674 2011-05-29 Ian Lance Taylor <iant@google.com>
1677 * testsuite/Makefile.am: Use different file name for two_file_test
1678 temporary file for each incremental test.
1679 * testsuite/Makefile.in: Rebuild.
1681 2011-05-29 Ian Lance Taylor <iant@google.com>
1683 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
1684 binary input file is empty.
1686 2011-05-27 Ian Lance Taylor <iant@google.com>
1688 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
1689 (ver_test_9.so): Likewise.
1690 * testsuite/Makefile.in: Rebuild.
1692 2011-05-26 Cary Coutant <ccoutant@google.com>
1694 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
1695 * incremental.cc (Incremental_inputs::report_input_section): Fix
1696 comment, indentation.
1697 (Incremental_inputs::report_comdat_group): New function.
1698 (Output_section_incremental_inputs::set_final_data_size): Adjust size
1699 of data for incremental input file entry.
1700 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
1701 group count, COMDAT group signatures.
1702 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
1703 an unchanged input file.
1704 * incremental.h (Incremental_object_entry::Incremental_object_entry):
1705 Initialize new data member.
1706 (Incremental_object_entry::add_comdat_group): New function.
1707 (Incremental_object_entry::get_comdat_group_count): New function.
1708 (Incremental_object_entry::get_comdat_signature_key): New function.
1709 (Incremental_object_entry::groups_): New data member.
1710 (Incremental_inputs::report_comdat_group): New function.
1711 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
1712 data for incremental input file entry.
1713 (Incremental_input_entry_reader::get_comdat_group_count): New function.
1714 (Incremental_input_entry_reader::get_input_section): Adjust size of
1715 data for incremental input file entry.
1716 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
1717 (Incremental_input_entry_reader::get_comdat_group_signature): New
1719 * object.cc (Sized_relobj::include_section_group): Report kept
1720 COMDAT groups for incremental links.
1722 2011-05-24 David Meyer <pdox@google.com>
1724 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
1725 with name parameter. Add found_name parameter.
1726 * fileread.cc (Input_file::find_file): Adjust code accordingly.
1727 * dirsearch.h (class Dirsearch): Update declaration.
1729 2011-05-24 Ian Lance Taylor <iant@google.com>
1731 * archive.cc (Library_base::should_include_member): Pull in object
1732 from archive if it defines the entry symbol.
1733 * parameters.cc (Parameters::entry): New function.
1734 * parameters.h (class Parameters): Declare entry.
1735 * output.h (class Output_file_header): Remove entry_ field.
1736 * output.cc (Output_file_header::Output_file_header): Remove entry
1737 parameter. Change all callers.
1738 (Output_file_header::entry): Use parameters->entry.
1739 * gold.cc (queue_middle_tasks): Likewise.
1740 * plugin.cc (Plugin_hook::run): Likewise.
1742 2011-05-24 Cary Coutant <ccoutant@google.com>
1744 * gold.cc (queue_initial_tasks): Pass incremental base filename
1745 to Output_file::open_base_file; don't print error message.
1746 * incremental-dump.cc (main): Adjust call to
1747 Output_file::open_for_modification.
1748 * incremental-dump.cc (main): Likewise.
1749 * incremental.cc (Incremental_inputs::report_command_line):
1750 Ignore --incremental-base option when comparing command lines.
1751 Ignore parameter when given as separate argument.
1752 * options.h (class General_options): Add --incremental-base.
1753 * output.cc (Output_file::Output_file):
1754 (Output_file::open_base_file): Add base_name and writable parameters;
1755 read base file into new file; print error message here.
1756 (Output_file::map_no_anonymous): Add writable parameter; adjust all
1758 * output.h (Output_file::open_for_modification): Rename to...
1759 (Output_file::open_base_file): ...this; add base_name and
1760 writable parameters; adjust all callers.
1761 (Output_file::map_no_anonymous): Add writable parameter; adjust all
1763 * testsuite/Makefile.am (incremental_test_4): Test
1765 * testsuite/Makefile.in: Regenerate.
1767 2011-05-24 Cary Coutant <ccoutant@google.com>
1769 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
1771 * testsuite/Makefile.in: Regenerate.
1772 * testsuite/two_file_test_1_v1.cc: New test source file.
1773 * testsuite/two_file_test_1b_v1.cc: New test source file.
1774 * testsuite/two_file_test_2_v1.cc: New test source file.
1776 2011-05-24 Cary Coutant <ccoutant@google.com>
1778 * dynobj.h (Dynobj::do_dynobj): New function.
1779 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
1780 flag and soname for shared objects.
1781 * incremental.cc (Incremental_inputs::report_object): Make
1782 either Incremental_object_entry or Incremental_dynobj_entry; add
1783 soname to string table.
1784 (Incremental_inputs::report_input_section): Add assertion.
1785 (Output_section_incremental_inputs::set_final_data_size): Adjust
1786 type of input file entry for shared libraries; adjust size of
1787 shared library info entry.
1788 (Output_section_incremental_inputs::write_input_files): Write
1789 as_needed flag for shared libraries.
1790 (Output_section_incremental_inputs::write_info_blocks): Adjust type
1791 of input file entry for shared libraries; write soname.
1792 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
1793 soname from incremental info.
1794 * incremental.h (enum Incremental_input_flags): Add
1795 INCREMENTAL_INPUT_AS_NEEDED.
1796 (Incremental_input_entry::Incremental_input_entry): Initialize new
1798 (Incremental_input_entry::set_as_needed): New function.
1799 (Incremental_input_entry::as_needed): New function.
1800 (Incremental_input_entry::do_dynobj_entry): New function.
1801 (Incremental_input_entry::as_needed_): New data member.
1802 (Incremental_object_entry::Incremental_object_entry): Don't check
1804 (Incremental_object_entry::do_type): Likewise.
1805 (class Incremental_dynobj_entry): New class.
1806 (Incremental_input_entry_reader::as_needed): New function.
1807 (Incremental_input_entry_reader::get_soname): New function.
1808 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
1809 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
1810 size of shared library info entry.
1811 * layout.cc (Layout::finish_dynamic_section): Don't test for
1812 incremental link when adding DT_NEEDED entries.
1813 * object.h (Object::Object): Initialize new data member.
1814 (Object::dynobj): New function.
1815 (Object::set_as_needed): New function.
1816 (Object::as_needed): New function.
1817 (Object::do_dynobj): New function.
1818 (Object::as_needed_): New data member.
1820 2011-05-24 Cary Coutant <ccoutant@google.com>
1822 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
1823 info; adjust display of GOT entries.
1824 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1825 vector of input objects; remove file_status_.
1826 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
1827 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
1828 got_plt reader; call target hooks to reserve GOT entries.
1829 (Output_section_incremental_inputs::set_final_data_size): Adjust size
1830 of input file info header and GOT info entry.
1831 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
1833 (Got_plt_view_info::got_descriptor): Remove.
1834 (Got_plt_view_info::sym_index): New data member.
1835 (Got_plt_view_info::input_index): New data member.
1836 (Local_got_offset_visitor::visit): Write input file index.
1837 (Global_got_offset_visitor::visit): Write 0 for input file index.
1838 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
1839 with sym_index and input_index.
1840 (Output_section_incremental_inputs::write_got_plt): Adjust size of
1841 incremental info GOT entry; replace got_descriptor with input_index.
1842 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
1843 map from input file index to object.
1844 (Sized_relobj_incr::do_layout): Replace direct data member reference
1845 with accessor function.
1846 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
1847 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
1848 Adjust size of input file info header.
1849 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
1850 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
1851 (Incremental_input_entry_reader::get_input_section): Adjust size of
1852 input file info header.
1853 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
1854 of incremental info GOT entry.
1855 (Incremental_got_plt_reader::get_got_desc): Remove.
1856 (Incremental_got_plt_reader::get_got_symndx): New function.
1857 (Incremental_got_plt_reader::get_got_input_index): New function.
1858 (Sized_incremental_binary::Sized_incremental_binary): Remove
1859 file_status_; add input_objects_.
1860 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
1861 (Sized_incremental_binary::set_file_is_unchanged): Remove.
1862 (Sized_incremental_binary::file_is_unchanged): Remove.
1863 (Sized_incremental_binary::set_input_object): New function.
1864 (Sized_incremental_binary::input_object): New function.
1865 (Sized_incremental_binary::file_status_): Remove.
1866 (Sized_incremental_binary::input_objects_): New data member.
1867 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
1869 (Sized_relobj_incr::invalid_address): Move to base class.
1870 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
1872 (Sized_relobj_incr::do_output_section_offset): Likewise.
1873 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
1874 (Sized_relobj_incr::section_offsets_): Likewise.
1875 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
1877 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
1878 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
1879 with accessor function.
1880 (Sized_relobj_file::do_layout): Likewise.
1881 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
1882 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
1883 (Sized_relobj_file::compute_final_local_value): Replace refs to
1884 section_offsets_ with accessor function.
1885 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
1886 * object.h (Relobj::Relobj): Initialize new data members.
1887 (Relobj::add_dyn_reloc): New function.
1888 (Relobj::first_dyn_reloc): New function.
1889 (Relobj::dyn_reloc_count): New function.
1890 (Relobj::first_dyn_reloc_): New data member.
1891 (Relobj::dyn_reloc_count_): New data member.
1892 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
1894 (Sized_relobj::Address): New typedef.
1895 (Sized_relobj::invalid_address): Move here from child class.
1896 (Sized_relobj::Sized_relobj): Initialize new data members.
1897 (Sized_relobj::sized_relobj): New function.
1898 (Sized_relobj::is_output_section_offset_invalid): Move here from
1900 (Sized_relobj::get_output_section_offset): Likewise.
1901 (Sized_relobj::local_has_got_offset): Likewise.
1902 (Sized_relobj::local_got_offset): Likewise.
1903 (Sized_relobj::set_local_got_offset): Likewise.
1904 (Sized_relobj::do_for_all_local_got_entries): Likewise.
1905 (Sized_relobj::clear_got_offsets): New function.
1906 (Sized_relobj::section_offsets): Move here from child class.
1907 (Sized_relobj::do_output_section_offset): Likewise.
1908 (Sized_relobj::do_set_section_offset): Likewise.
1909 (Sized_relobj::Local_got_offsets): Likewise.
1910 (Sized_relobj::local_got_offsets_): Likewise.
1911 (Sized_relobj::section_offsets_): Likewise.
1912 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
1914 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
1916 (Sized_relobj_file::sized_relobj): New function
1917 (Sized_relobj_file::local_has_got_offset): Move to base class.
1918 (Sized_relobj_file::local_got_offset): Likewise.
1919 (Sized_relobj_file::set_local_got_offset): Likewise.
1920 (Sized_relobj_file::get_output_section_offset): Likewise.
1921 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
1922 (Sized_relobj_file::do_output_section_offset): Likewise.
1923 (Sized_relobj_file::do_set_section_offset): Likewise.
1924 (Sized_relobj_file::Local_got_offsets): Likewise.
1925 (Sized_relobj_file::local_got_offsets_): Likewise.
1926 (Sized_relobj_file::section_offsets_): Likewise.
1927 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
1929 (set_needs_dynsym_index): Convert relobj to derived class pointer.
1930 (Output_reloc::get_symbol_index): Likewise.
1931 (Output_reloc::local_section_offset): Likewise.
1932 (Output_reloc::get_address): Likewise.
1933 (Output_reloc::symbol_value): Likewise.
1934 (Output_data_got::reserve_slot): Move to class definition.
1935 (Output_data_got::reserve_local): New function.
1936 (Output_data_got::reserve_slot_for_global): Remove.
1937 (Output_data_got::reserve_global): New function.
1938 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
1939 (all constructors, two instantiations).
1940 (Output_reloc::get_relobj): New function (two instantiations).
1941 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
1942 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
1943 (Output_data_reloc::add_global): Adjust type of relobj.
1944 (Output_data_reloc::add_global_relative): Likewise.
1945 (Output_data_reloc::add_symbolless_global_addend): Likewise.
1946 (Output_data_reloc::add_local): Likewise.
1947 (Output_data_reloc::add_local_relative): Likewise.
1948 (Output_data_reloc::add_symbolless_local_addend): Likewise.
1949 (Output_data_reloc::add_local_section): Likewise.
1950 (Output_data_reloc::add_output_section): Likewise.
1951 (Output_data_reloc::add_absolute): Likewise.
1952 (Output_data_reloc::add_target_specific): Likewise.
1953 (Output_data_got::reserve_slot): Move definition here.
1954 (Output_data_got::reserve_local): New function.
1955 (Output_data_got::reserve_global): New function.
1956 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
1957 section_offsets_ with accessor function.
1958 (Sized_relobj_file::write_sections): Likewise.
1959 (Sized_relobj_file::do_relocate_sections): Likewise.
1960 * target.h (Sized_target::reserve_local_got_entry): New function.
1961 (Sized_target::reserve_global_got_entry): New function.
1962 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
1963 (Target_x86_64::reserve_global_got_entry): New function.
1964 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
1966 2011-05-23 Cary Coutant <ccoutant@google.com>
1968 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
1969 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
1970 bit when checking got_type.
1971 * incremental.cc (Sized_incremental_binary::setup_readers):
1972 Store symbol table and string table locations; initialize bit vector
1973 of file status flags.
1974 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
1976 (Sized_incremental_binary::do_process_got_plt): New function.
1977 (Sized_incremental_binary::get_symtab_view): Use stored locations.
1978 (Output_section_incremental_inputs::set_final_data_size): Record
1979 file index for each input file.
1980 (Output_section_incremental_inputs::write_got_plt): Store file index
1981 instead of input entry offset for each GOT entry.
1983 (Incremental_input_entry::Incremental_input_entry): Initialize new
1985 (Incremental_input_entry::set_offset): Store file index.
1986 (Incremental_input_entry::get_file_index): New function.
1987 (Incremental_input_entry::file_index_): New data member.
1988 (Incremental_binary::process_got_plt): New function.
1989 (Incremental_binary::do_process_got_plt): New function.
1990 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1992 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
1993 (Sized_incremental_binary::set_file_is_unchanged): New function.
1994 (Sized_incremental_binary::file_is_unchanged): New function.
1995 (Sized_incremental_binary::do_process_got_plt): New function.
1996 (Sized_incremental_binary::file_status_): New data member.
1997 (Sized_incremental_binary::main_symtab_loc_): New data member.
1998 (Sized_incremental_binary::main_strtab_loc_): New data member.
1999 * output.cc (Output_data_got::Got_entry::write): Add case
2001 (Output_data_got::add_global): Call add_got_entry.
2002 (Output_data_got::add_global_plt): Likewise.
2003 (Output_data_got::add_global_with_rel): Likewise.
2004 (Output_data_got::add_global_with_rela): Likewise.
2005 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
2006 (Output_data_got::add_global_pair_with_rela): Likewise.
2007 (Output_data_got::add_local): Call add_got_entry.
2008 (Output_data_got::add_local_plt): Likewise.
2009 (Output_data_got::add_local_with_rel): Likewise.
2010 (Output_data_got::add_local_with_rela): Likewise.
2011 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
2012 (Output_data_got::add_local_pair_with_rela): Likewise.
2013 (Output_data_got::reserve_slot): New function.
2014 (Output_data_got::reserve_slot_for_global): New function.
2015 (Output_data_got::add_got_entry): New function.
2016 (Output_data_got::add_got_entry_pair): New function.
2017 (Output_section::add_output_section_data): Edit FIXME.
2019 (Output_section_data_build::Output_section_data_build): New
2020 constructor with size parameter.
2021 (Output_data_space::Output_data_space): Likewise.
2022 (Output_data_got::Output_data_got): Initialize new data member; new
2023 constructor with size parameter.
2024 (Output_data_got::add_constant): Call add_got_entry.
2025 (Output_data_got::reserve_slot): New function.
2026 (Output_data_got::reserve_slot_for_global): New function.
2027 (class Output_data_got::Got_entry): Add RESERVED_CODE.
2028 (Output_data_got::add_got_entry): New function.
2029 (Output_data_got::add_got_entry_pair): New function.
2030 (Output_data_got::free_list_): New data member.
2031 * target.h (Sized_target::init_got_plt_for_update): New function.
2032 (Sized_target::register_global_plt_entry): New function.
2033 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2034 Initialize new data member; call init; add constructor with PLT count.
2035 (Output_data_plt_x86_64::init): New function.
2036 (Output_data_plt_x86_64::add_relocation): New function.
2037 (Output_data_plt_x86_64::reserve_slot): New function.
2038 (Output_data_plt_x86_64::free_list_): New data member.
2039 (Target_x86_64::init_got_plt_for_update): New function.
2040 (Target_x86_64::register_global_plt_entry): New function.
2041 (Output_data_plt_x86_64::add_entry): Allocate from free list for
2042 incremental updates.
2043 (Output_data_plt_x86_64::add_relocation): New function.
2044 * testsuite/object_unittest.cc (Object_test): Set default options.
2046 2011-05-16 Ian Lance Taylor <iant@google.com>
2048 * options.h (class General_options): Make -i a synonym for -r.
2050 2011-05-16 Ian Lance Taylor <iant@google.com>
2052 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
2054 2011-05-10 Cary Coutant <ccoutant@google.com>
2056 * object.cc (Sized_relobj::do_count_local_symbols): Check for
2059 2011-05-06 Ian Lance Taylor <iant@google.com>
2061 * layout.cc (Layout::layout): If the output section flags change,
2062 update the ordering.
2064 2011-04-25 Cary Coutant <ccoutant@google.com>
2066 * incremental-dump.cc (dump_incremental_inputs): Print local
2067 symbol info for each input file.
2069 (Output_section_incremental_inputs::set_final_data_size): Add local
2070 symbol info to input file entries in incremental info.
2071 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2072 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
2073 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
2074 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
2076 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
2077 (Sized_incr_relobj::do_relocate): Write the local symbols.
2078 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
2079 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
2080 Adjust size of input file header.
2081 (Incremental_inputs_reader::get_local_symbol_offset): New function.
2082 (Incremental_inputs_reader::get_local_symbol_count): New function.
2083 (Incremental_inputs_reader::get_input_section): Adjust size of input
2085 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
2086 (Sized_incr_relobj::This): New typedef.
2087 (Sized_incr_relobj::sym_size): New const data member.
2088 (Sized_incr_relobj::Local_symbol): New struct.
2089 (Sized_incr_relobj::do_output_local_symbol_count): New function.
2090 (Sized_incr_relobj::do_local_symbol_offset): New function.
2091 (Sized_incr_relobj::local_symbol_count_): New data member.
2092 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
2093 (Sized_incr_relobj::local_symbol_index_): New data member.
2094 (Sized_incr_relobj::local_symbol_offset_): New data member.
2095 (Sized_incr_relobj::local_dynsym_offset_): New data member.
2096 (Sized_incr_relobj::local_symbols_): New data member.
2097 * object.h (Relobj::output_local_symbol_count): New function.
2098 (Relobj::local_symbol_offset): New function.
2099 (Relobj::do_output_local_symbol_count): New function.
2100 (Relobj::do_local_symbol_offset): New function.
2101 (Sized_relobj::do_output_local_symbol_count): New function.
2102 (Sized_relobj::do_local_symbol_offset): New function.
2104 2011-04-22 Vladimir Simonov <sv@sw.ru>
2106 * descriptors.cc (set_close_on_exec): New function.
2107 (Descriptors::open): Use set_close_on_exec.
2108 * output.cc (S_ISLNK): Define if not defined.
2110 2011-04-22 Cary Coutant <ccoutant@google.com>
2112 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2114 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2115 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
2116 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
2118 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
2119 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
2120 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
2122 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
2124 (Incremental_binary::apply_incremental_relocs): New function.
2125 (Incremental_binary::do_apply_incremental_relocs): New function.
2126 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2128 (Sized_incremental_binary::add_global_symbol): New function.
2129 (Sized_incremental_binary::global_symbol): New function.
2130 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2131 (Sized_incremental_binary::symbol_map_): New data member.
2132 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
2133 * target.h (Sized_target::apply_relocation): New function.
2134 * target-reloc.h (apply_relocation): New function.
2135 * x86_64.cc (Target_x86_64::apply_relocation): New function.
2137 2011-04-22 Doug Kwan <dougkwan@google.com>
2139 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
2140 flag of a SHT_ARM_EXIDX section.
2141 * testsuite/Makefile.am (arm_exidx_test): New test rules.
2142 * testsuite/Makefile.in: Regenerate.
2143 * testsuite/arm_exidx_test.s: New file.
2144 * testsuite/arm_exidx_test.sh: Same.
2146 2011-04-20 Cary Coutant <ccoutant@google.com>
2149 * archive.h (Incremental_archive_entry::Archive_member):
2150 Initialize arg_serial_ (second constructor).
2152 2011-04-17 Ian Lance Taylor <iant@google.com>
2154 * object.cc (Relocate_info::location): Simplify location string.
2155 * errors.cc (Errors::error_at_location): Don't print program
2157 (Errors::warning_at_location): Likewise.
2158 (Errors::undefined_symbol): Likewise.
2159 * testsuite/debug_msg.sh: Update accordingly.
2161 2011-04-14 Cary Coutant <ccoutant@google.com>
2163 * gold/layout.cc (Layout::symtab_section_offset): New function.
2164 * gold/layout.h (Layout::symtab_section_offset): New function.
2165 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
2167 2011-04-12 Ian Lance Taylor <iant@google.com>
2169 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
2170 with MREMAP_MAYMOVE.
2171 * output.h (class Output_file): Add map_is_allocated_ field.
2172 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
2173 not available, provide stubs. If mremap is not available, #define
2175 (MREMAP_MAYMOVE): Define if not defined.
2176 (Output_file::Output_file): Initialize map_is_allocated_.
2177 (Output_file::resize): Check map_is_allocated_.
2178 (Output_file::map_anonymous): If mmap fails, use malloc.
2179 (Output_file::unmap): Don't do anything for an anonymous map.
2180 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
2181 is not available, provide stubs.
2182 (File_read::View::~View): Use free rather than delete[].
2183 (File_read::make_view): Use malloc rather than new[]. If mmap
2185 (File_read::find_or_make_view): Use malloc rather than new[].
2186 * gold.h: Remove HAVE_REMAP code.
2187 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
2188 exists. Rename mremap to gold_mremap. If mmap is not available
2190 * configure, config.in: Rebuild.
2192 2011-04-11 Ian Lance Taylor <iant@google.com>
2194 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
2195 initialize local variable v.
2197 2011-04-11 Cary Coutant <ccoutant@google.com>
2199 * archive.cc (Archive::include_member): Adjust call to
2201 (Add_archive_symbols::run): Track argument serial numbers.
2202 (Lib_group::include_member): Likewise.
2203 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
2204 * archive.h (Incremental_archive_entry::Archive_member):
2205 Initialize arg_serial_.
2206 (Archive_member::arg_serial_): New data member.
2207 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
2208 (Sized_dynobj::do_add_symbols): Track symbols when doing an
2210 (Sized_dynobj::do_for_all_local_got_entries): New function.
2211 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
2213 * fileread.cc (get_mtime): New function.
2214 * fileread.h (get_mtime): New function.
2215 * gold.cc (queue_initial_tasks): Check for incremental update.
2216 (process_incremental_input): New function.
2217 (queue_middle_tasks): Don't force valid target for incremental
2219 * incremental-dump.cc (find_input_containing_global): Adjust
2220 size of symbol info entry.
2221 (dump_incremental_inputs): Dump argument serial number and
2222 in_system_directory flag; bias shndx by 1; print symbol names
2223 when dumping per-file symbol lists; use new symbol info readers.
2225 (Output_section_incremental_inputs:update_data_size): New function.
2226 (Sized_incremental_binary::setup_readers): Setup input readers
2227 for each input file; build maps for files added from libraries
2229 (Sized_incremental_binary::check_input_args): New function.
2230 (Sized_incremental_binary::do_check_inputs): Build map of argument
2231 serial numbers to input arguments.
2232 (Sized_incremental_binary::do_file_has_changed): Rename
2233 do_file_is_unchanged to this; compare file modification times.
2234 (Sized_incremental_binary::do_init_layout): New function.
2235 (Sized_incremental_binary::do_reserve_layout): New function.
2236 (Sized_incremental_binary::do_get_input_reader): Remove.
2237 (Sized_incremental_binary::get_symtab_view): New function.
2238 (Incremental_checker::can_incrementally_link_output_file): Remove.
2239 (Incremental_inputs::report_command_line): Exclude --debug options.
2240 (Incremental_inputs::report_archive_begin): Add parameter; track
2241 argument serial numbers; don't put input file entry for archive
2242 before archive members.
2243 (Incremental_inputs::report_archive_end): Put input file entry
2244 for archive after archive members.
2245 (Incremental_inputs::report_object): Add parameter; track argument
2246 serial numbers and in_system_directory flag.
2247 (Incremental_inputs::report_script): Add parameter; track argument
2249 (Output_section_incremental_inputs::set_final_data_size): Adjust
2250 size of symbol info entry; check for forwarding symbols.
2251 (Output_section_incremental_inputs::write_input_files): Write
2252 in_system_directory flag and argument serial number.
2253 (Output_section_incremental_inputs::write_info_blocks): Map section
2254 indices between incremental info and original input file; store
2255 input section index for each symbol.
2256 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2257 change operator() to visit().
2258 (class Global_got_offset_visitor): Likewise.
2259 (class Global_symbol_visitor_got_plt):
2260 (Output_section_incremental_inputs::write_got_plt): Use new visitor
2262 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
2263 (Sized_incr_relobj::do_read_symbols): New function.
2264 (Sized_incr_relobj::do_layout): New function.
2265 (Sized_incr_relobj::do_layout_deferred_sections): New function.
2266 (Sized_incr_relobj::do_add_symbols): New function.
2267 (Sized_incr_relobj::do_should_include_member): New function.
2268 (Sized_incr_relobj::do_for_all_global_symbols): New function.
2269 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
2270 (Sized_incr_relobj::do_section_size): New function.
2271 (Sized_incr_relobj::do_section_name): New function.
2272 (Sized_incr_relobj::do_section_contents): New function.
2273 (Sized_incr_relobj::do_section_flags): New function.
2274 (Sized_incr_relobj::do_section_entsize): New function.
2275 (Sized_incr_relobj::do_section_address): New function.
2276 (Sized_incr_relobj::do_section_type): New function.
2277 (Sized_incr_relobj::do_section_link): New function.
2278 (Sized_incr_relobj::do_section_info): New function.
2279 (Sized_incr_relobj::do_section_addralign): New function.
2280 (Sized_incr_relobj::do_initialize_xindex): New function.
2281 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2282 (Sized_incr_relobj::do_read_relocs): New function.
2283 (Sized_incr_relobj::do_gc_process_relocs): New function.
2284 (Sized_incr_relobj::do_scan_relocs): New function.
2285 (Sized_incr_relobj::do_count_local_symbols): New function.
2286 (Sized_incr_relobj::do_finalize_local_symbols): New function.
2287 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2288 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2289 (Sized_incr_relobj::do_relocate): New function.
2290 (Sized_incr_relobj::do_set_section_offset): New function.
2291 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2292 (Sized_incr_dynobj::do_read_symbols): New function.
2293 (Sized_incr_dynobj::do_layout): New function.
2294 (Sized_incr_dynobj::do_add_symbols): New function.
2295 (Sized_incr_dynobj::do_should_include_member): New function.
2296 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
2297 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
2298 (Sized_incr_dynobj::do_section_size): New function.
2299 (Sized_incr_dynobj::do_section_name): New function.
2300 (Sized_incr_dynobj::do_section_contents): New function.
2301 (Sized_incr_dynobj::do_section_flags): New function.
2302 (Sized_incr_dynobj::do_section_entsize): New function.
2303 (Sized_incr_dynobj::do_section_address): New function.
2304 (Sized_incr_dynobj::do_section_type): New function.
2305 (Sized_incr_dynobj::do_section_link): New function.
2306 (Sized_incr_dynobj::do_section_info): New function.
2307 (Sized_incr_dynobj::do_section_addralign): New function.
2308 (Sized_incr_dynobj::do_initialize_xindex): New function.
2309 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
2310 (make_sized_incremental_object): New function.
2311 (Incremental_library::copy_unused_symbols): New function.
2312 (Incremental_library::do_for_all_unused_symbols): New function.
2313 * incremental.h (enum Incremental_input_flags): New type.
2314 (class Incremental_checker): Remove.
2315 (Incremental_input_entry::Incremental_input_entry): Add argument
2317 (Incremental_input_entry::arg_serial): New function.
2318 (Incremental_input_entry::set_is_in_system_directory): New function.
2319 (Incremental_input_entry::is_in_system_directory): New function.
2320 (Incremental_input_entry::arg_serial_): New data member.
2321 (Incremental_input_entry::is_in_system_directory_): New data member.
2322 (class Script_info): Move here from script.h.
2323 (Script_info::Script_info): Add filename parameter.
2324 (Script_info::filename): New function.
2325 (Script_info::filename_): New data member.
2326 (Incremental_script_entry::Incremental_script_entry): Add argument
2328 (Incremental_object_entry::Incremental_object_entry): Likewise.
2329 (Incremental_object_entry::add_input_section): Build list of input
2330 sections with map to original shndx.
2331 (Incremental_object_entry::get_input_section_index): New function.
2332 (Incremental_object_entry::shndx_): New data member.
2333 (Incremental_object_entry::name_key_): Rename; adjust all refs.
2334 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
2335 (Incremental_archive_entry::Incremental_archive_entry): Add argument
2337 (Incremental_inputs::report_archive_begin): Likewise.
2338 (Incremental_inputs::report_object): Likewise.
2339 (Incremental_inputs::report_script): Likewise.
2340 (class Incremental_global_symbol_reader): New class.
2341 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
2342 and store flags and input file type.
2343 (Incremental_input_entry_reader::arg_serial): New function.
2344 (Incremental_input_entry_reader::type): Extract type from flags.
2345 (Incremental_input_entry_reader::is_in_system_directory): New function.
2346 (Incremental_input_entry_reader::get_input_section_count): Call
2347 accessor function for type.
2348 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
2349 function for type; adjust size of global symbol entry.
2350 (Incremental_input_entry_reader::get_global_symbol_count): Call
2351 accessor function for type.
2352 (Incremental_input_entry_reader::get_object_count): Likewise.
2353 (Incremental_input_entry_reader::get_object_offset): Likewise.
2354 (Incremental_input_entry_reader::get_member_count): Likewise.
2355 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
2356 (Incremental_input_entry_reader::get_member_offset): Likewise.
2357 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
2358 (Incremental_input_entry_reader::Global_symbol_info): Remove.
2359 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
2360 (Incremental_input_entry_reader::get_global_symbol_reader): New
2362 (Incremental_input_entry_reader::get_output_symbol_index): New
2364 (Incremental_input_entry_reader::type_): Remove.
2365 (Incremental_input_entry_reader::flags_): New data member.
2366 (Incremental_inputs_reader::input_file_offset): New function.
2367 (Incremental_inputs_reader::input_file_index): New function.
2368 (Incremental_inputs_reader::input_file): Call input_file_offset.
2369 (Incremental_inputs_reader::input_file_at_offset): New function.
2370 (Incremental_relocs_reader::get_r_type): Reformat.
2371 (Incremental_relocs_reader::get_r_shndx): Reformat.
2372 (Incremental_relocs_reader::get_r_offset): Reformat.
2373 (Incremental_relocs_reader::data): New function.
2374 (Incremental_binary::Incremental_binary): Initialize new data members.
2375 (Incremental_binary::check_inputs): Add cmdline parameter.
2376 (Incremental_binary::file_is_unchanged): Remove.
2377 (Input_reader::arg_serial): New function.
2378 (Input_reader::get_unused_symbol_count): New function.
2379 (Input_reader::get_unused_symbol): New function.
2380 (Input_reader::do_arg_serial): New function.
2381 (Input_reader::do_get_unused_symbol_count): New function.
2382 (Input_reader::do_get_unused_symbol): New function.
2383 (Incremental_binary::input_file_count): New function.
2384 (Incremental_binary::get_input_reader): Change signature to use
2385 index instead of filename.
2386 (Incremental_binary::file_has_changed): New function.
2387 (Incremental_binary::get_input_argument): New function.
2388 (Incremental_binary::get_library): New function.
2389 (Incremental_binary::get_script_info): New function.
2390 (Incremental_binary::init_layout): New function.
2391 (Incremental_binary::reserve_layout): New function.
2392 (Incremental_binary::output_file): New function.
2393 (Incremental_binary::do_check_inputs): New function.
2394 (Incremental_binary::do_file_is_unchanged): Remove.
2395 (Incremental_binary::do_file_has_changed): New function.
2396 (Incremental_binary::do_init_layout): New function.
2397 (Incremental_binary::do_reserve_layout): New function.
2398 (Incremental_binary::do_input_file_count): New function.
2399 (Incremental_binary::do_get_input_reader): Change signature.
2400 (Incremental_binary::input_args_map_): New data member.
2401 (Incremental_binary::library_map_): New data member.
2402 (Incremental_binary::script_map_): New data member.
2403 (Sized_incremental_binary::Sized_incremental_binary): Initialize
2405 (Sized_incremental_binary::output_section): New function.
2406 (Sized_incremental_binary::inputs_reader): Add const.
2407 (Sized_incremental_binary::symtab_reader): Add const.
2408 (Sized_incremental_binary::relocs_reader): Add const.
2409 (Sized_incremental_binary::got_plt_reader): Add const.
2410 (Sized_incremental_binary::get_symtab_view): New function.
2411 (Sized_incremental_binary::Inputs_reader): New typedef.
2412 (Sized_incremental_binary::Input_entry_reader): New typedef.
2413 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
2414 (Sized_incremental_binary::do_file_is_unchanged): Remove.
2415 (Sized_incremental_binary::do_file_has_changed): New function.
2416 (Sized_incremental_binary::do_init_layout): New function.
2417 (Sized_incremental_binary::do_reserve_layout): New function.
2418 (Sized_input_reader::Inputs_reader): Remove.
2419 (Sized_input_reader::Input_entry_reader): Remove.
2420 (Sized_input_reader::do_arg_serial): New function.
2421 (Sized_input_reader::do_get_unused_symbol_count): New function.
2422 (Sized_input_reader::do_get_unused_symbol): New function.
2423 (Sized_incremental_binary::do_input_file_count): New function.
2424 (Sized_incremental_binary::do_get_input_reader): Change signature;
2425 use index instead of filename.
2426 (Sized_incremental_binary::section_map_): New data member.
2427 (Sized_incremental_binary::input_entry_readers_): New data member.
2428 (class Sized_incr_relobj): New class.
2429 (class Sized_incr_dynobj): New class.
2430 (make_sized_incremental_object): New function.
2431 (class Incremental_library): New class.
2432 * layout.cc (Free_list::num_lists): New static data member.
2433 (Free_list::num_nodes): New static data member.
2434 (Free_list::num_removes): New static data member.
2435 (Free_list::num_remove_visits): New static data member.
2436 (Free_list::num_allocates): New static data member.
2437 (Free_list::num_allocate_visits): New static data member.
2438 (Free_list::init): New function.
2439 (Free_list::remove): New function.
2440 (Free_list::allocate): New function.
2441 (Free_list::dump): New function.
2442 (Free_list::print_stats): New function.
2443 (Layout_task_runner::run): Resize output file for incremental updates.
2444 (Layout::Layout): Initialize new data members.
2445 (Layout::set_incremental_base): New function.
2446 (Layout::init_fixed_output_section): New function.
2447 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
2448 incremental updates.
2449 (Layout::create_gold_note): Do not create gold note section for
2450 incremental updates.
2451 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
2452 for incremental updates.
2453 (Layout::set_section_offsets): For incremental updates, allocate space
2455 (Layout::create_symtab_sections): Layout with offsets relative to
2456 start of section; for incremental updates, allocate space from free
2458 (Layout::create_shdrs): For incremental updates, allocate space from
2460 (Layout::finish_dynamic_section): For incremental updates, do not
2461 check --as-needed (fixed in subsequent patch).
2462 * layout.h (class Free_list): New class.
2463 (Layout::set_incremental_base): New function.
2464 (Layout::incremental_base): New function.
2465 (Layout::init_fixed_output_section): New function.
2466 (Layout::allocate): New function.
2467 (Layout::incremental_base_): New data member.
2468 (Layout::free_list_): New data member.
2469 * main.cc (main): Print Free_list statistics.
2470 * object.cc (Relobj::finalize_incremental_relocs): Add
2471 clear_counts parameter; clear counts only when clear_counts is set.
2472 (Sized_relobj::Sized_relobj): Initialize new base class.
2473 (Sized_relobj::do_layout): Don't report special sections.
2474 (Sized_relobj::do_for_all_local_got_entries): New function.
2475 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
2476 symtab_off to all symbol table offsets.
2477 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
2478 * object.h (class Got_offset_list): Move to top of file.
2479 (Object::Object): Allow case where input_file == NULL.
2480 (Object::~Object): Likewise.
2481 (Object::input_file): Assert that input_file != NULL.
2482 (Object::lock): Allow case where input_file == NULL.
2483 (Object::unlock): Likewise.
2484 (Object::is_locked): Likewise.
2485 (Object::token): Likewise.
2486 (Object::release): Likewise.
2487 (Object::is_incremental): New function.
2488 (Object::get_mtime): New function.
2489 (Object::for_all_local_got_entries): New function.
2490 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
2491 (Object::set_is_in_system_directory): New function.
2492 (Object::is_in_system_directory): New function.
2493 (Object::do_is_incremental): New function.
2494 (Object::do_get_mtime): New function.
2495 (Object::do_for_all_local_got_entries): New function.
2496 (Object::is_in_system_directory_): New data member.
2497 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
2498 (class Sized_relobj_base): New class.
2499 (class Sized_relobj): Derive from Sized_relobj_base.
2500 (class Sized_relobj::Symbols): Redeclare from base class.
2501 (class Sized_relobj::local_got_offset_list): Remove.
2502 (class Sized_relobj::Output_sections): Redeclare from base class.
2503 (class Sized_relobj::do_for_all_local_got_entries): New function.
2504 (class Sized_relobj::write_local_symbols): Add offset parameter.
2505 (class Sized_relobj::local_symbol_offset_): Update comment.
2506 (class Sized_relobj::local_dynsym_offset_): Update comment.
2507 * options.cc (Input_arguments::add_file): Remove const.
2508 * options.h (Input_file_argument::Input_file_argument):
2509 Initialize arg_serial_ (all constructors).
2510 (Input_file_argument::set_arg_serial): New function.
2511 (Input_file_argument::arg_serial): New function.
2512 (Input_file_argument::arg_serial_): New data member.
2513 (Input_arguments::Input_arguments): Initialize file_count_.
2514 (Input_arguments::add_file): Remove const.
2515 (Input_arguments::number_of_input_files): New function.
2516 (Input_arguments::file_count_): New data member.
2517 (Command_line::number_of_input_files): Call
2518 Input_arguments::number_of_input_files.
2519 * output.cc (Output_segment_headers::Output_segment_headers):
2521 (Output_section::Input_section::current_data_size): New function.
2522 (Output_section::Output_section): Initialize new data members.
2523 (Output_section::add_input_section): Don't do merge sections for
2524 an incremental link; allocate space from free list for an
2526 (Output_section::add_output_section_data): Allocate space from
2527 free list for an incremental update.
2528 (Output_section::update_data_size): New function.
2529 (Output_section::set_fixed_layout): New function.
2530 (Output_section::reserve): New function.
2531 (Output_segment::set_section_addresses): Remove const.
2532 (Output_segment::set_section_list_addresses): Remove const; allocate
2533 space from free list for an incremental update.
2534 (Output_segment::set_offset): Adjust size of RELRO segment for an
2536 * output.h (Output_data::current_data_size): Move here from
2538 (Output_data::pre_finalize_data_size): New function.
2539 (Output_data::update_data_size): New function.
2540 (Output_section_headers::update_data_size): new function.
2541 (Output_section_data_build::current_data_size): Move to Output_data.
2542 (Output_data_strtab::update_data_size): New function.
2543 (Output_section::current_data_size): Move to Output_data.
2544 (Output_section::set_fixed_layout): New function.
2545 (Output_section::has_fixed_layout): New function.
2546 (Output_section::reserve): New function.
2547 (Output_section::update_data_size): New function.
2548 (Output_section::has_fixed_layout_): New data member.
2549 (Output_section::free_list_): New data member.
2550 (Output_segment::set_section_addresses): Remove const.
2551 (Output_segment::set_section_list_addresses): Remove const.
2552 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
2554 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
2556 * readsyms.cc (Read_symbols::do_read_symbols): Add library
2557 parameter when calling Add_symbols constructor; store argument
2558 serial number for members of a lib group.
2559 (Add_symbols::locks): Allow case where token == NULL.
2560 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
2561 (Read_member::~Read_member): New function.
2562 (Read_member::is_runnable): New function.
2563 (Read_member::locks): New function.
2564 (Read_member::run): New function.
2565 (Check_script::~Check_script): New function.
2566 (Check_script::is_runnable): New function.
2567 (Check_script::locks): New function.
2568 (Check_script::run): New function.
2569 (Check_library::~Check_library): New function.
2570 (Check_library::is_runnable): New function.
2571 (Check_library::locks): New function.
2572 (Check_library::run): New function.
2573 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
2574 (Add_symbols::library_): New data member.
2575 (class Read_member): New class.
2576 (class Check_script): New class.
2577 (class Check_library): New class.
2578 * reloc.cc (Read_relocs::is_runnable): Allow case where
2580 (Read_relocs::locks): Likewise.
2581 (Scan_relocs::locks): Likewise.
2582 (Relocate_task::locks): Likewise.
2583 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
2585 (Sized_relobj::incremental_relocs_scan): Fix comment.
2586 (Sized_relobj::do_relocate): Pass output file offset to
2587 write_local_symbols.
2588 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
2589 from class declaration.
2590 * script.cc (read_input_script): Allocate Script_info; pass
2591 argument serial number to report_script.
2592 * script.h (class Script_info): Move to incremental.h.
2593 * symtab.cc (Symbol_table::add_from_incrobj): New function.
2594 * symtab.h (Symbol_table::add_from_incrobj): New function.
2595 (Symbol_table::set_file_offset): New function.
2597 2011-04-05 Cary Coutant <ccoutant@google.com>
2599 * incremental-dump.cc (dump_incremental_inputs): Change signature
2600 to take a Sized_incremental_binary; change caller. Use readers
2601 in Sized_incremental_binary.
2603 (Sized_incremental_binary::find_incremental_inputs_sections):
2604 Rename do_find_incremental_inputs_sections to this.
2605 (Sized_incremental_binary::setup_readers): New function.
2606 (Sized_incremental_binary::do_check_inputs): Check
2607 has_incremental_info_ flag; move setup code to setup_readers;
2609 (Sized_incremental_binary::do_file_is_unchanged): New function.
2610 (Sized_incremental_binary::do_get_input_reader): New function.
2611 * incremental.h (class Incremental_binary): Move to end of file.
2612 (Incremental_binary::file_is_unchanged): New function.
2613 (Incremental_binary::do_file_is_unchanged): New function.
2614 (Incremental_binary::Input_reader): New class.
2615 (Incremental_binary::get_input_reader): New function.
2616 (class Sized_incremental_binary): Move to end of file.
2617 (Sized_incremental_binary::Sized_incremental_binary): Setup the
2618 input section reader classes.
2619 (Sized_incremental_binary::has_incremental_info): New function.
2620 (Sized_incremental_binary::inputs_reader): New function.
2621 (Sized_incremental_binary::symtab_reader): New function.
2622 (Sized_incremental_binary::relocs_reader): New function.
2623 (Sized_incremental_binary::got_plt_reader): New function.
2624 (Sized_incremental_binary::do_file_is_unchanged): New function.
2625 (Sized_incremental_binary::Sized_input_reader): New class.
2626 (Sized_incremental_binary::get_input_reader): New function.
2627 (Sized_incremental_binary::find_incremental_inputs_sections):
2628 Rename do_find_incremental_inputs_sections to this.
2629 (Sized_incremental_binary::setup_readers): New function.
2630 (Sized_incremental_binary::has_incremental_info_): New data member.
2631 (Sized_incremental_binary::inputs_reader_): New data member.
2632 (Sized_incremental_binary::symtab_reader_): New data member.
2633 (Sized_incremental_binary::relocs_reader_): New data member.
2634 (Sized_incremental_binary::got_plt_reader_): New data member.
2635 (Sized_incremental_binary::current_input_file_): New data member.
2637 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
2640 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
2643 2011-03-30 Cary Coutant <ccoutant@google.com>
2645 * archive.cc (Archive::include_member): Adjust call to report_object.
2646 (Add_archive_symbols::run): Add script_info to call to
2647 report_archive_begin.
2648 (Lib_group::include_member): Adjust call to report_object.
2649 (Add_lib_group_symbols::run): Adjust call to report_object.
2650 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
2651 blocks. Add object count for script input files.
2652 * incremental.cc (Incremental_inputs::report_archive_begin): Add
2653 script_info parameter; change all callers.
2654 (Incremental_inputs::report_object): Add script_info parameter;
2656 (Incremental_inputs::report_script): Store backpointer to
2657 incremental info entry.
2658 (Output_section_incremental_inputs::set_final_data_size): Record
2659 additional information for scripts.
2660 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2661 * incremental.h (Incremental_script_entry::add_object): New function.
2662 (Incremental_script_entry::get_object_count): New function.
2663 (Incremental_script_entry::get_object): New function.
2664 (Incremental_script_entry::objects_): New data member; adjust
2666 (Incremental_inputs::report_archive_begin): Add script_info parameter.
2667 (Incremental_inputs::report_object): Add script_info parameter.
2668 (Incremental_inputs_reader::get_object_count): New function.
2669 (Incremental_inputs_reader::get_object_offset): New function.
2670 * options.cc (Input_arguments::add_file): Return reference to
2672 * options.h (Input_argument::set_script_info): New function.
2673 (Input_argument::script_info): New function.
2674 (Input_argument::script_info_): New data member; adjust all
2676 (Input_file_group::add_file): Return reference to new input argument.
2677 (Input_file_lib::add_file): Likewise.
2678 (Input_arguments::add_file): Likewise.
2679 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
2680 * script.cc (Parser_closure::Parser_closure): Add script_info
2681 parameter; adjust all callers.
2682 (Parser_closure::script_info): New function.
2683 (Parser_closure::script_info_): New data member.
2684 (read_input_script): Report scripts earlier to incremental info.
2685 (script_add_file): Set script_info in Input_argument.
2686 (script_add_library): Likewise.
2687 * script.h (Script_options::Script_info): Rewrite class.
2689 2011-03-29 Cary Coutant <ccoutant@google.com>
2691 * archive.cc (Library_base::should_include_member): Move
2692 method here from class Archive.
2693 (Archive::Archive): Initialize base class.
2694 (Archive::should_include_member): Move to base class.
2695 (Archive::do_for_all_unused_symbols): New function.
2696 (Add_archive_symbols::run): Remove redundant access to
2698 (Lib_group::Lib_group): Initialize base class.
2699 (Lib_group::do_filename): New function.
2700 (Lib_group::include_member): Pass pointer to Lib_group to
2702 (Lib_group::do_for_all_unused_symbols): New function.
2703 (Add_lib_group_symbols::run): Report archive information for
2705 * archive.h (class Library_base): New base class.
2706 (class Archive): Derive from Library_base.
2707 (Archive::filename): Move to base class.
2708 (Archive::set_incremental_info): Likewise.
2709 (Archive::incremental_info): Likewise.
2710 (Archive::Should_include): Likewise.
2711 (Archive::should_include_member): Likewise.
2712 (Archive::Armap_entry): Remove.
2713 (Archive::Unused_symbol_iterator): Remove.
2714 (Archive::unused_symbols_begin): Remove.
2715 (Archive::unused_symbols_end): Remove.
2716 (Archive::do_filename): New function.
2717 (Archive::do_get_mtime): New function.
2718 (Archive::do_for_all_unused_symbols): New function.
2719 (Archive::task_): Move to base class.
2720 (Archive::incremental_info_): Likewise.
2721 (class Lib_group): Derive from Library_base.
2722 (Lib_group::do_filename): New function.
2723 (Lib_group::do_get_mtime): New function.
2724 (Lib_group::do_for_all_unused_symbols): New function.
2725 (Lib_group::task_): Move to base class.
2726 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
2728 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
2730 * incremental.cc (Incremental_inputs::report_archive_begin):
2731 Use Library_base; call library's get_mtime; add incremental inputs
2732 entry before members.
2733 (class Unused_symbol_visitor): New class.
2734 (Incremental_inputs::report_archive_end): Use Library_base; use
2735 visitor class to record unused symbols; don't add incremental inputs
2736 entry after members.
2737 (Incremental_inputs::report_object): Use Library_base.
2739 (Incremental_archive_entry::Incremental_archive_entry): Remove
2740 unused Archive parameter.
2741 (Incremental_inputs::report_archive_begin): Use Library_base.
2742 (Incremental_inputs::report_archive_end): Likewise.
2743 (Incremental_inputs::report_object): Likewise.
2744 * object.cc (Sized_relobj::do_for_all_global_symbols): New
2746 * object.h (Object::for_all_global_symbols): New function.
2747 (Object::do_for_all_global_symbols): New function.
2748 (Sized_relobj::do_for_all_global_symbols): New function.
2749 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
2751 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
2754 2011-03-27 Ian Lance Taylor <iant@google.com>
2756 * archive.cc (Archive::interpret_header): Return -1 if something
2757 goes wrong. Change callers accordingly.
2759 2011-03-25 Cary Coutant <ccoutant@google.com>
2761 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
2762 * testsuite/Makefile.in: Regenerate.
2764 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
2766 * plugin.cc (get_view): New.
2767 (Plugin::load): Pass get_view to the plugin.
2768 (Plugin_manager::get_view): New.
2770 2011-03-21 Ian Lance Taylor <iant@google.com>
2772 * testsuite/final_layout.sh: Rewrite to not use dc.
2773 * testsuite/relro_test.sh: Fail if dc is not present.
2775 2011-03-21 Sriraman Tallam <tmsriram@google.com>
2777 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
2779 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
2780 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
2782 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
2783 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
2785 2011-03-14 Ian Lance Taylor <iant@google.com>
2787 * script-sections.cc (Sort_output_sections::script_compare):
2788 Rename from is_before, change return type.
2789 (Sort_output_sections::operator()): Adjust accordingly.
2791 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
2794 * testsuite/odr_violation2.cc: Add comment to make all error line
2795 numbers double digits.
2796 * testsuite/debug_msg.sh: Adjust expected errors.
2798 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
2800 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
2801 but mark earlier ones as non-canonical
2802 (offset_to_iterator): Update search target and example
2803 (do_addr2line): Return extra lines in a vector*
2804 (format_file_lineno): Extract from do_addr2line
2805 (one_addr2line): Add vector* out-param
2806 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
2807 when a lineno entry appeared last for its instruction
2808 (Dwarf_line_info): Add vector* out-param
2809 * object.cc (Relocate_info): Pass NULL for the vector* out-param
2810 * symtab.cc (Odr_violation_compare): Include the lineno in the
2812 (linenos_from_loc): New. Combine the canonical line for an
2813 address with its other lines.
2814 (True_if_intersect): New. Helper functor to make
2815 std::set_intersection a query.
2816 (detect_odr_violations): Compare sets of lines instead of just
2817 one line for each function. This became less deterministic, but
2818 has fewer false positives.
2819 * symtab.h: Declarations.
2820 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
2821 mix an optimized and non-optimized object in the same binary
2822 (odr_violation2.so): Same.
2823 * testsuite/Makefile.in: Regenerate from Makefile.am.
2824 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
2825 * testsuite/debug_msg.sh: Update line numbers and add
2827 * testsuite/odr_violation1.cc: Use OdrDerived, in a
2828 non-optimized context.
2829 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
2830 isn't inlined, and use OdrDerived in an optimized context.
2831 * testsuite/odr_header1.h: Defines OdrDerived, where
2832 optimization will change the
2833 first-instruction-in-the-destructor's file and line number.
2834 * testsuite/odr_header2.h: Defines OdrBase.
2836 2011-03-09 Ian Lance Taylor <iant@google.com>
2838 * fileread.cc (File_read::clear_views): Don't delete the whole
2841 2011-03-08 Ian Lance Taylor <iant@google.com>
2844 * fileread.cc: #include <climits>.
2845 (GOLD_IOV_MAX): Define.
2846 (File_read::read_multiple): Limit number of entries by iov_max.
2847 * fileread.h (class File_read): Always set max_readv_entries to
2850 2011-03-07 Ian Lance Taylor <iant@google.com>
2853 * options.h (class General_options): Add -dy and -dn.
2855 2011-03-02 Cary Coutant <ccoutant@google.com>
2857 * testsuite/script_test_9.t: Add TLS segment.
2859 2011-03-02 Simon Baldwin <simonb@google.com>
2861 * configure.ac: Add check for gnu_indirect_function support in
2862 the toolchain building binutils.
2863 * configure: Rebuild.
2865 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
2867 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
2868 plugin only symbols.
2869 (Symbol_table::sized_finalize_symbol) Mark symbol only present
2870 in plugin files as not needed in the symbol table.
2872 2011-02-11 Sriraman Tallam <tmsriram@google.com>
2874 * output.cc (Output_section::add_input_section): Delay fill
2875 generation for section ordering.
2877 2011-02-09 Ian Lance Taylor <iant@google.com>
2880 * object.h (class Sized_relobj): Remove clear_local_symbols.
2881 * reloc.cc (Sized_relobj::do_relocate): Don't call
2882 clear_local_symbols.
2884 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
2886 * plugin.cc (is_visible_from_outside): Return true for symbols
2889 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
2891 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
2894 2011-02-02 Sriraman Tallam <tmsriram@google.com>
2896 * icf.h (is_section_foldable_candidate): Change type of parameter
2898 * icf.cc (Icf::find_identical_sections): Change type of local variable
2899 section_name to be std::string.
2900 (is_function_ctor_or_dtor): Change type of parameter to std::string.
2902 2011-01-25 Ian Lance Taylor <iant@google.com>
2904 * script.cc (script_add_extern): Rewrite to use
2905 add_symbol_reference.
2907 2011-01-25 Doug Kwan <dougkwan@google.com>
2909 * icf.cc (get_section_contents): Always lock section's object.
2911 2011-01-24 Ian Lance Taylor <iant@google.com>
2913 * options.h (class General_options): Accept
2914 --no-detect-odr-violations.
2916 2011-01-24 Ian Lance Taylor <iant@google.com>
2918 * version.cc (version_string): Bump to 1.11.
2920 2011-01-24 Ian Lance Taylor <iant@google.com>
2922 * plugin.cc (class Plugin_rescan): Define new class.
2923 (Plugin_manager::claim_file): Set any_claimed_.
2924 (Plugin_manager::save_archive): New function.
2925 (Plugin_manager::save_input_group): New function.
2926 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
2928 (Plugin_manager::new_undefined_symbol): New function.
2929 (Plugin_manager::rescan): New function.
2930 (Plugin_manager::rescannable_defines): New function.
2931 (Plugin_manager::add_input_file): Set any_added_.
2932 * plugin.h (class Plugin_manager): define new fields rescannable_,
2933 undefined_symbols_, any_claimed_, and any_added_. Declare
2934 Plugin_rescan as friend. Declare new functions.
2935 (Plugin_manager::Rescannable): Define type.
2936 (Plugin_manager::Rescannable_list): Define type.
2937 (Plugin_manager::Undefined_symbol_list): Define type.
2938 (Plugin_manager::Plugin_manager): Initialize new fields.
2939 * archive.cc (Archive::defines_symbol): New function.
2940 (Add_archive_symbols::run): Pass archive to plugins if any.
2941 * archive.h (class Archive): Declare defines_symbol.
2942 * readsyms.cc (Input_group::~Input_group): New function.
2943 (Finish_group::run): Pass input_group to plugins if any.
2944 * readsyms.h (class Input_group): Declare destructor.
2945 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
2948 2011-01-10 Ian Lance Taylor <iant@google.com>
2950 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
2952 (Layout::set_segment_offsets): Reset increase_relro before calling
2953 set_section_addresses a second time.
2955 2011-01-04 Cary Coutant <ccoutant@google.com>
2957 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
2958 sections before NOBITS sections.
2960 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
2962 * version.cc (print_version): Update copyright to 2011.
2964 2010-12-23 Cary Coutant <ccoutant@google.com>
2966 * output.h (Output_data_reloc::add_output_section): Pass OD instead
2967 of OS to this->add. Add OD parameter to second form of the function.
2969 2010-12-20 Ian Lance Taylor <iant@google.com>
2971 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
2972 second of two consecutive entries with same offset.
2974 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2976 * testsuite/Makefile.am (ifuncmain2static_LDADD)
2977 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
2978 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
2979 to avoid unneeded links against $(LDADD).
2980 * testsuite/Makefile.in: Regenerate.
2982 2010-12-15 Ian Lance Taylor <iant@google.com>
2985 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
2986 for R_X86_64_32 and R_X86_64_PC32.
2987 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
2988 ver_matching_def_pic.o.
2989 (ver_matching_def_pic.o): New target.
2991 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2993 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
2994 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
2995 Move definition before File_read::View member definitions.
2996 (File_read::View::~View): Initialize and hold lock before
2997 updating current_mapped_bytes.
2999 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3001 * dwarf_reader.cc: Remove outdated comment.
3002 * gold-threads.cc: Fix typo in error message.
3003 * archive.cc: Fix typos in comments.
3004 * archive.h: Likewise.
3005 * arm-reloc-property.cc: Likewise.
3006 * arm-reloc-property.h: Likewise.
3007 * arm-reloc.def: Likewise.
3009 * attributes.h: Likewise.
3010 * cref.cc: Likewise.
3011 * ehframe.cc: Likewise.
3012 * fileread.h: Likewise.
3014 * i386.cc: Likewise.
3016 * incremental.h: Likewise.
3017 * int_encoding.cc: Likewise.
3018 * layout.h: Likewise.
3019 * main.cc: Likewise.
3020 * merge.h: Likewise.
3021 * object.cc: Likewise.
3022 * object.h: Likewise.
3023 * options.cc: Likewise.
3024 * readsyms.cc: Likewise.
3025 * reduced_debug_output.cc: Likewise.
3026 * reloc.cc: Likewise.
3027 * script-sections.cc: Likewise.
3028 * sparc.cc: Likewise.
3029 * symtab.h: Likewise.
3030 * target-reloc.h: Likewise.
3031 * target.cc: Likewise.
3032 * target.h: Likewise.
3033 * timer.cc: Likewise.
3034 * timer.h: Likewise.
3035 * x86_64.cc: Likewise.
3037 2010-12-09 Cary Coutant <ccoutant@google.com>
3039 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
3041 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
3042 parameter; change all callers.
3043 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
3044 * options.h (warn_execstack): New option.
3046 2010-12-07 Doug Kwan <dougkwan@google.com>
3048 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
3049 like function call relocations.
3051 2010-12-07 Ian Lance Taylor <iant@google.com>
3053 * archive.cc (Archive::get_elf_object_for_member): Permit
3054 punconfigured to be NULL.
3055 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
3056 (Archive::include_member): Pass NULL to get_elf_object_for_member
3057 if we searched for the archive and this is the first included
3060 2010-12-01 Ian Lance Taylor <iant@google.com>
3062 * dwarf_reader.h (class Sized_dwarf_line_info): Add
3063 track_relocs_type_ field.
3064 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3065 Set track_relocs_type_.
3066 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
3067 contents when using RELA relocs.
3068 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
3070 * reloc.cc (Track_relocs::next_addend): New function.
3071 * reloc.h (class Track_relocs): Declare next_addend.
3073 2010-12-01 Ian Lance Taylor <iant@google.com>
3075 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
3078 2010-12-01 Ian Lance Taylor <iant@google.com>
3080 * README: Update compilers known to work and fail.
3082 2010-11-23 Matthias Klose <doko@ubuntu.com>
3084 * configure.in: For --enable-gold, handle value `default' instead of
3085 `both*'. Always install ld as ld.bfd, install as ld if gold is
3087 * configure: Regenerate.
3089 2010-11-18 Doug Kwan <dougkwan@google.com>
3091 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
3092 and right_alignment to be zero. Store result alignment only if it is
3093 greater than existing alignment.
3095 2010-11-16 Cary Coutant <ccoutant@google.com>
3098 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3099 Check for ".zdebug_line".
3101 2010-11-16 Doug Kwan <dougkwan@google.com>
3102 Cary Coutant <ccoutant@google.com>
3104 * output.h (Output_segment::set_section_addresses): Pass increase_relro
3105 by reference; adjust all callers.
3106 * output.cc (Output_segment::set_section_addresses): Adjust references
3107 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
3109 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
3110 end at page boundary.
3112 2010-11-16 Cary Coutant <ccoutant@google.com>
3115 * layout.cc (Layout::choose_output_section): Transform names of
3116 compressed sections even when using a script with a SECTIONS clause.
3117 (Layout::output_section_name): Remove code to transform
3118 compressed debug section names.
3119 * output.cc (Output_section::add_input_section): Use uncompressed
3120 section size when tracking input sections.
3122 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
3124 * symtab.h (Symbol::NON_PIC_REF): Remove.
3125 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
3126 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
3127 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
3128 (Symbol::use_plt_offset): Take a flags argument and pass it
3129 directly to needs_dynamic_reloc. Restrict check for undefined
3130 weak symbols to function calls.
3131 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
3132 (Target_arm::Scan::global): Use it.
3133 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
3134 (Target_arm::Relocate::relocate): Likewise.
3135 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
3136 parameter with an r_type parameter. Use get_reference_flags
3138 (Target_arm::Relocate::relocate): Update accordingly.
3139 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
3140 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
3141 (Target_i386::Scan::global): Likewise.
3142 (Target_i386::Relocate::relocate): Likewise.
3143 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
3144 parameter with an r_type parameter. Use get_reference_flags
3146 (Target_i386::Relocate::relocate): Update accordingly.
3147 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
3148 (Target_powerpc::Scan::global): Use it.
3149 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
3150 (Target_powerpc::Relocate::relocate): Likewise.
3151 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
3152 (Target_sparc::Scan::global): Use it.
3153 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
3154 (Target_sparc::Relocate::relocate): Likewise.
3155 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
3156 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
3157 (Target_x86_64::Scan::global): Likewise.
3158 (Target_x86_64::Relocate::relocate): Likewise.
3160 2010-11-08 Doug Kwan <dougkwan@google.com>
3161 Cary Coutant <ccoutant@google.com>
3163 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
3164 (Arm_exidx_merge_section::section_contents_): New data member.
3165 (Arm_input_section::Arm_input_section): Initialize original_contents_.
3166 (Arm_input_section::~Arm_input_section): De-allocate memory.
3167 (Arm_input_section::original_contents_): New data member.
3168 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
3169 in parameters instead of calling Object::section_contents without
3171 (Arm_output_section::group_section): New parameter TASK. Pass it
3172 to callees that need locking objects.
3173 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
3174 to lock EXIDX input sections. Fix a formatting issue. Call
3175 Arm_exidx_merged_section::build_contents to create merged section
3177 (Arm_output_section::create_stub_group): New parameter TASK. Use it
3178 to lock object of stub table owner.
3179 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
3180 TEXT_SIZE to initialize data member TEXT_SIZE_.
3181 (Arm_exidx_input_section::addralign): Fix typo in comment.
3182 (Arm_exidx_input_section::text_size): New method.
3183 (Target_arm::do_relax): New parameter TASK. Pass it to callees
3184 that require locking objects. Lock objects before scanning for stubs
3185 and updating local symbols.
3186 (Arm_input_section<big_endian>::init): Copy contents of original
3188 (Arm_input_section<big_endian>::do_write): Use saved contents of
3189 original input section instead of calling Object::section_contents
3191 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
3192 size without calling Object::section_size().
3193 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
3194 for size. Allocate a buffer for merged EXIDX entries.
3195 (Arm_exidx_merged_section::build_contents): New method.
3196 (Arm_exidx_merged_section::do_write): Move merge section contents
3197 building code to Arm_exidx_merged_section::build_contetns. Write
3198 out contetns in buffer instead of building it on the fly.
3199 (Arm_relobj::make_exidx_input_section): Also pass text section size
3200 to Arm_exidx_input_section constructor.
3201 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
3202 (Arm_dynobj::do_read_symbols): Fix memory leak.
3203 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
3204 * target.h: (class Task): Add forward declaration.
3205 (Target::relax): Add new parameter TASK and pass it to
3207 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
3209 2010-11-05 Cary Coutant <ccoutant@google.com>
3212 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
3213 object when reading from the file.
3214 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
3216 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
3217 when reading section contents.
3218 (get_section_contents): Likewise.
3219 (icf::find_identical_sections): Likewise.
3220 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
3221 object when reading from the file.
3222 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
3223 the object when doing deferred section layout.
3225 2010-11-03 Nick Clifton <nickc@redhat.com>
3228 * script.h (class Symbol_assignment: name): New member. Returns
3229 the name of the symbol.
3230 * scrfipt.cc (Script_options::is_pending_assignment): New member.
3231 Returns true if the given symbol name is on the list of
3232 assignments wating to be processed.
3233 * archive.cc (should_incldue_member): If the symbol is undefined,
3234 check to see if it is on the list of symbols pending assignment.
3236 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
3238 * script-sections.cc (Script_sections::find_memory_region): Check
3239 for a NULL output section pointer.
3241 2010-10-29 Doug Kwan <dougkwan@google.com>
3243 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3244 Output_section::add_relaxed_input_section.
3245 * output.cc (Output_section::add_relaxed_input_section): Add new
3246 arguments LAYOUT and NAME. Set section order index.
3247 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3248 Copy section order index.
3249 * output.h (Output_section::add_relaxed_input_section): Add new
3250 arguments LAYOUT and NAME.
3252 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3254 * testsuite/Makefile.am: Move gcctestdir/ld rule to
3255 NATIVE_OR_CROSS_LINKER.
3256 * testsuite/Makefile.in: Regenerate.
3258 2010-10-20 Doug Kwan <dougkwan@google.com>
3260 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
3261 without SHF_LINK_ORDER flags.
3262 * layout.cc (Layout::choose_output_section): Do not filter
3263 SHF_LINK_ORDER flag in a relocatable link.
3265 2010-10-17 Cary Coutant <ccoutant@google.com>
3267 * output.h (Output_segment::set_section_addresses): Change function
3268 signature. Update all callers.
3269 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
3271 (Output_segment::set_section_addresses): Align after last TLS
3272 section. Add padding before last relro section instead of after.
3274 2010-10-17 Doug Kwan <dougkwan@google.com>
3276 * gold/arm.cc (Target_arm::got_section): Use correct order and set
3277 GOT output section to be writable.
3279 2010-10-14 Cary Coutant <ccoutant@google.com>
3281 * debug.h (DEBUG_INCREMENTAL): New flag.
3282 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3283 * gold.cc (queue_initial_tasks): Check parameters for incremental link
3285 * incremental.cc (report_command_line): Ignore all forms of
3287 * layout.cc (Layout::Layout): Check parameters for incremental link
3289 * options.cc (General_options::parse_incremental): New function.
3290 (General_options::parse_no_incremental): New function.
3291 (General_options::parse_incremental_full): New function.
3292 (General_options::parse_incremental_update): New function.
3293 (General_options::incremental_mode_): New data member.
3294 (General_options::finalize): Check incremental_mode_.
3295 * options.h (General_options): Update help text for --incremental.
3296 Add --no-incremental, --incremental-full, --incremental-update.
3297 (General_options::Incremental_mode): New enum type.
3298 (General_options::incremental_mode): New function.
3299 (General_options::incremental_mode_): New data member.
3300 * parameters.cc (Parameters::incremental_mode_): New data member.
3301 (Parameters::set_options): Set incremental_mode_.
3302 (Parameters::set_incremental_full): New function.
3303 (Parameters::incremental): New function.
3304 (Parameters::incremental_update): New function.
3305 (set_parameters_incremental_full): New function.
3306 * parameters.h (Parameters::set_incremental_full): New function.
3307 (Parameters::incremental): New function.
3308 (Parameters::incremental_update): New function.
3309 (Parameters::incremental_mode_): New data member.
3310 (set_parameters_incremental_full): New function.
3311 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
3312 incremental link mode.
3313 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
3314 (Sized_relobj::do_relocate_sections): Likewise.
3315 * testsuite/Makefile.am (incremental_test): Use --incremental-full
3317 * testsuite/Makefile.in: Regenerate.
3318 * testsuite/incremental_test.sh: Filter all forms of --incremental.
3320 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3322 * script-sections.h (class Script_sections): Make
3323 Sections_elements typedef public.
3324 * script-sections.cc (class Sort_output_sections): Add elements_
3325 field. Add constructor which sets it; change all callers.
3326 (Sort_output_sections::is_before): New function.
3327 (Sort_output_sections::operator()): Call is_before.
3328 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
3330 * testsuite/script_test_10.sh: New test. Test script section
3332 * testsuite/script_test_10.t: Likewise.
3333 * testsuite/script_test_10.s: Likewise.
3334 * testsuite/Makefile.am: Wrap the cross linker tests and the
3335 common tests into NATIVE_OR_CROSS_LINKER.
3336 (check_SCRIPTS): Add script_test_10.sh.
3337 (check_DATA): Add script_test_10.stdout.
3338 (script_test_10.o, script_test_10): New targets.
3339 (script_test_10.stdout): New target.
3340 * configure, testsuite/Makefile.in: Regenerate.
3342 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3344 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
3345 error for the deprecated relocations.
3346 (Target_arm::Scan::global): Likewise.
3347 (Target_arm::Relocate::relocate): Likewise.
3349 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
3351 * fileread.cc (Input_file::find_file): Initialize *found_name
3352 and *namep when using the fallback search for case 4.
3354 2010-10-11 Cary Coutant <ccoutant@google.com>
3356 * options.h (class General_options): Redefine -z lazy as an alias for
3357 the negation of -z now.
3359 2010-10-11 Ian Lance Taylor <iant@google.com>
3361 * resolve.cc (symbol_to_bits): Report the value of the unsupported
3364 2010-10-06 Nick Clifton <nickc@redhat.com>
3366 * script-sections.cc(class Memory_region): Remove
3367 current_lma_offset_ field. Rename current_vma_offset_ to
3368 current_offset_. Add last_section_ field.
3369 (Memory_region::get_current_vma_address): Rename to
3370 get_current_address.
3371 (Memory_region::get_current_lma_address): Delete.
3372 (Memory_region::increment_vma_offset): Rename to
3374 (Memory_region::increment_lma_offset): Delete.
3375 (Memory_region::attributes_compatible): New method. Returns
3376 true if the provided section is compatible with the region.
3377 (Memory_region::get_last_section): New method. Returns the last
3378 section to use the region.
3379 (Memory_region::set_last_section): New method. Stores the last
3380 section to use the region.
3381 (Script_sections::block_in_region): New method. Returns true if
3382 a block of memory is contained within a region.
3383 (Script_sections::find_memory_region): New method. Locates a
3384 memory region to be used to set a VMA or LMA address.
3385 (Output_section_definition::set_section_addresses): Add code to
3386 check for addresses set by memory regions.
3387 (Output_segment::set_section_addresses): Remove memory region
3389 (Script_sections::create_segment): Add a warning if a header
3390 segment is created outside of any region.
3391 * script-sections.h (class Script_sections): Add prototypes for
3392 find_memory_region and block_in_region methods.
3393 * testsuite/memory_test.s: Use .long instead of .word.
3394 * testsuite/memory_test.t: Add some more output sections.
3395 * testsuite/memory_test.sh: Update expected output.
3397 2010-10-02 Doug Kwan <dougkwan@google.com>
3399 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
3400 defintion to symtab.h
3401 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
3402 declaration to defintion.
3404 2010-10-01 Nick Clifton <nickc@redhat.com>
3406 * expression.cc (eval): Replace dummy argument with NULL.
3407 (eval_maybe_dot): Check for a NULL result section pointer.
3408 (Symbol_expression::value): Likewise.
3409 (Dot_expression::value): Likewise.
3410 (BINARY_EXPRESSION): Likewise.
3411 (Max_expression::value): Likewise.
3412 (Min_expression::value): Likewise.
3413 (Absolute_expression::value): Likewise.
3414 (Addr_expression::value_from_output_section): Likewise.
3415 (Loaddddr_expression::value_from_output_section): Likewise.
3416 (Segment_start_expression::value): Likewise.
3417 * script-sections.cc
3418 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
3420 (Sections_elememt_dot_assignment::set_section_addresses):
3422 (Output_data_expression::do_write_to_buffer): Likewise.
3423 (Output_section_definition::finalize_symbols): Likewise.
3424 (Output_section_definition::set_section_addresses): Likewise.
3426 2010-09-30 Doug Kwan <dougkwan@google.com>
3428 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
3430 2010-09-28 Sriraman Tallam <tmsriram@google.com>
3432 * target.h (Target::can_icf_inline_merge_sections): New virtual
3434 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
3436 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
3438 * icf.cc (get_section_contents): Inline merge sections only when
3441 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3443 * configure: Regenerate.
3445 2010-09-17 Ian Lance Taylor <iant@google.com>
3447 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
3448 * testsuite/Makefile.am (memory_test.o): New target.
3449 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
3451 * testsuite/Makefile.in: Rebuild.
3453 2010-09-17 Doug Kwan <dougkwan@google.com>
3455 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
3456 defintion if relocation uses GOT entries of the symbol.
3457 * testsuite/icf_safe_test.sh: Fix test.
3458 * testsuite/icf_safe_so_test.sh: Fix test.
3460 2010-09-16 Cary Coutant <ccoutant@google.com>
3462 * script_sections.cc (class Memory_region): Remove "NULL" from
3463 vector initializations.
3465 2010-09-15 Cary Coutant <ccoutant@google.com>
3467 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
3468 Resolve forwarding symbols.
3470 2010-09-15 Doug Kwan <dougkwan@google.com>
3472 * gold/testsuite/script_test_3.t: Add ARM special sections.
3473 * gold/testsuite/script_test_4.t: Same.
3474 * gold/testsuite/script_test_5.t: Same.
3475 * gold/testsuite/script_test_6.t: Same.
3476 * gold/testsuite/script_test_7.t: Same.
3477 * gold/testsuite/script_test_7.t: Same.
3478 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
3480 2010-09-14 Cary Coutant <ccoutant@google.com>
3482 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
3483 (Target_x86_64::Relocate::relocate_tls): Replace check for
3484 saw_tls_block_reloc_ with test for executable section.
3486 2010-09-12 Cary Coutant <ccoutant@google.com>
3488 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
3489 position-independent executables to shared libraries need dynamic
3491 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
3492 position-independent executables.
3493 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
3494 * testsuite/Makefile.in: Regenerate.
3496 2010-09-10 Nick Clifton <nickc@redhat.com>
3499 * testsuite/memory_test.t: Discard any sections that are not
3502 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
3505 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
3506 "This::" to work around a bug in gcc 4.2.
3508 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
3510 2010-09-09 Rafael Espindola <espindola@google.com>
3512 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
3513 sections with different PF_X flags in the same segment.
3514 (Layout::find_first_load_seg): Search all segments to find the first
3516 * options.h (rosegment): New.
3518 2010-09-08 Rafael Espindola <espindola@google.com>
3520 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
3522 2010-09-08 Doug Kwan <dougkwan@google.com>
3524 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
3525 (Arm_relobj::do_relocate_sections): Add new parameter for output
3526 file to match the parent.
3527 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
3528 of local symbols instead of input values. Update code to track
3529 changes in gold::relocate_section.
3530 * object.cc (Sized_relobj::compute_final_local_value): New methods.
3531 (Sized_relobj::compute_final_local_value_internal): New methods.
3532 (Sized_relobj::do_finalize_local_symbols): Move code from loop
3533 body into private version of Sized_relobj::compute_final_local_value.
3534 Call the inline method.
3535 * object.h (Symbol_value::Symbol_value): Define destructor. Free
3536 merged symbol value if there is one.
3537 (Symbol_value::has_output_value): New method defintiion.
3538 (Sized_relobj::Compute_final_local_value_status): New enum type.
3539 (Sized_relobj::compute_final_local_value): New methods.
3540 (Sized_relobj::compute_final_local_value_internal): New methods.
3541 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
3542 and arm_cortex_a8.sh.
3543 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
3544 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
3546 * Makefile.in: Regenerate.
3547 * testsuite/arm_bl_out_of_range.s: Update test.
3548 * testsuite/thumb_bl_out_of_range.s: Ditto.
3549 * testsuite/thumb_blx_out_of_range.s: Ditto.
3550 * testsuite/arm_branch_out_of_range.sh: New file.
3551 * testsuite/arm_cortex_a8.sh: Ditto.
3552 * testsuite/arm_cortex_a8_b.s: Ditto.
3553 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
3554 * testsuite/arm_cortex_a8_b_local.s: Ditto.
3555 * testsuite/arm_cortex_a8_bl.s: Ditto.
3556 * testsuite/arm_cortex_a8_blx.s: Ditto.
3557 * testsuite/arm_cortex_a8_local.s: Ditto.
3558 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
3559 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
3561 2010-09-08 Rafael Espindola <espindola@google.com>
3563 * Makefile.am (memory_test.stdout): Run readelf with -W.
3564 * Makefile.in: Regenerate.
3565 * testsuite/memory_test.sh: Make the regexps accept both 32 and
3568 2010-09-08 Rafael Espindola <espindola@google.com>
3570 * script-sections.cc (Script_sections::add_memory_region): Convert
3571 field precision to int.
3572 * script.cc (script_set_section_region, script_set_section_region):
3573 Convert field precision to int.
3575 2010-09-08 Rafael Espindola <espindola@google.com>
3577 * arm.cc (do_finalize_sections): Create the __exidx_start and
3578 __exdix_end symbols even when the section is missing.
3580 2010-09-08 Nick Clifton <nickc@redhat.com>
3582 * README: Remove claim that MEMORY is not supported.
3583 * expression.cc (script_exp_function_origin)
3584 (script_exp_function_length): Move from here to ...
3585 * script.cc: ... here.
3586 (script_set_section_region, script_add_memory)
3587 (script_parse_memory_attr, script_include_directive): New
3589 * script-sections.cc
3590 (class Memory_region): New class.
3591 (class Output_section_definition): Add set_memory_region,
3592 set_section_vma, set_section_lma and get_section_name methods.
3593 (class Script_Sections): Add add_memory_region,
3594 find_memory_region, find_memory_region_origin,
3595 find_memory_region_length and set_memory_region methods.
3596 Have set_section_addresses method walk the list of set memory
3598 Extend the print methos to display memory regions.
3599 * script-sections.h: Add prototypes for new methods.
3600 Add enum for MEMORY region attributes.
3601 * yyscript.y: Add support for parsing MEMORY regions.
3602 * script-c.h: Add prototypes for new functions.
3603 * testsuite/Makefile.am: Add test of MEMORY region functionality.
3604 * testsuite/Makefile.in: Regenerate.
3605 * testsuite/memory_test.sh: New script.
3606 * testsuite/memory_test.s: New assembler source file.
3607 * testsuite/memory_test.t: New linker script.
3609 2010-08-27 Doug Kwan <dougkwan@google.com>
3611 * gold/resolve.cc (Symbol_table::should_override): Let a weak
3612 reference override an existing dynamic weak reference.
3613 * testsuite/Makefile.am: Add new test dyn_weak_ref.
3614 * testsuite/Makefile.in: Regenerate.
3615 * testsuite/dyn_weak_ref.sh: New file.
3616 * testsuite/dyn_weak_ref_1.c: Ditto.
3617 * testsuite/dyn_weak_ref_2.c: Ditto.
3619 2010-08-27 Ian Lance Taylor <iant@google.com>
3621 * incremental.h (class Incremental_input_entry): Add virtual
3624 2010-08-27 Ian Lance Taylor <iant@google.com>
3626 * testsuite/start_lib_test_3.c: Mark t3 as used.
3628 2010-08-27 Nick Clifton <nickc@redhat.com>
3630 * options.cc (version_script): Fix small typo in previous
3633 2010-08-25 Nick Clifton <nickc@redhat.com>
3635 * archive.cc: Formatting fixes: Remove whitespace between
3636 typename and following asterisk. Remove whitespace between
3637 function name and opening parenthesis.
3638 * archive.h: Likewise.
3640 * attributes.cc: Likewise.
3641 * attributes.h: Likewise.
3642 * common.cc: Likewise.
3643 * copy-relocs.cc: Likewise.
3644 * dirsearch.h: Likewise.
3645 * dynobj.cc: Likewise.
3646 * ehframe.cc: Likewise.
3647 * ehframe.h: Likewise.
3648 * expression.cc: Likewise.
3649 * fileread.cc: Likewise.
3650 * fileread.h: Likewise.
3652 * gold-threads.cc: Likewise.
3653 * gold.cc: Likewise.
3654 * i386.cc: Likewise.
3656 * incremental-dump.cc: Likewise.
3657 * incremental.cc: Likewise.
3658 * layout.cc: Likewise.
3659 * layout.h: Likewise.
3660 * main.cc: Likewise.
3661 * merge.cc: Likewise.
3662 * merge.h: Likewise.
3663 * object.cc: Likewise.
3664 * object.h: Likewise.
3665 * options.cc: Likewise.
3666 * options.h: Likewise.
3667 * output.cc: Likewise.
3668 * output.h: Likewise.
3669 * plugin.cc: Likewise.
3670 * plugin.h: Likewise.
3671 * powerpc.cc: Likewise.
3672 * reloc.cc: Likewise.
3673 * script-c.h: Likewise.
3674 * script-sections.cc: Likewise.
3675 * script.cc: Likewise.
3676 * stringpool.cc: Likewise.
3677 * symtab.cc: Likewise.
3678 * symtab.h: Likewise.
3679 * target.cc: Likewise.
3680 * timer.cc: Likewise.
3681 * timer.h: Likewise.
3682 * version.cc: Likewise.
3683 * x86_64.cc: Likewise.
3685 2010-08-24 Nick Clifton <nickc@redhat.com>
3688 * layout.cc (segment_precedes): Sort segments by their physical
3689 addresses, if they have been set.
3691 2010-08-23 Cary Coutant <ccoutant@google.com>
3693 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
3695 (Lib_group::include_member): Unlock object after deleting its
3697 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
3700 2010-08-19 Neil Vachharajani <nvachhar@google.com>
3701 Cary Coutant <ccoutant@google.com>
3703 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
3704 constructor, and set_blocker.
3705 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
3707 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
3708 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
3709 * testsuite/Makefile.am (start_lib_test): New test case.
3710 * testsuite/Makefile.in: Regenerate.
3711 * testsuite/start_lib_test_main.c: New file.
3712 * testsuite/start_lib_test_1.c: New file.
3713 * testsuite/start_lib_test_2.c: New file.
3714 * testsuite/start_lib_test_3.c: New file.
3716 2010-08-19 Ian Lance Taylor <iant@google.com>
3718 * Makefile.in: Rebuild with automake 1.11.1.
3719 * aclocal.m4: Likewise.
3720 * testsuite/Makefile.in: Likewise.
3722 2010-08-19 Ian Lance Taylor <iant@google.com>
3725 * i386.cc (class Output_data_plt_i386): Update declarations.
3726 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
3727 local_ifuncs_ fields.
3728 (Target_i386::do_plt_section_for_global): New function.
3729 (Target_i386::do_plt_section_for_local): New function.
3730 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
3731 parameter; change all callers. Initialize global_ifuncs_ and
3732 local_ifuncs_. If doing a static link define __rel_iplt_start and
3734 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
3735 (Output_data_plt_i386::add_local_ifunc_entry): New function.
3736 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
3738 (Target_i386::make_plt_section): New function, broken out of
3739 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
3740 (Target_i386::make_plt_entry): Call make_plt_section.
3741 (Target_i386::make_local_ifunc_plt_entry): New function.
3742 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
3743 (Target_i386::Scan::local): Handle IFUNC symbols. Add
3744 R_386_IRELATIVE to switch.
3745 (Target_i386::Scan::global): Likewise.
3746 (Target_i386::Relocate::relocate): Likewise.
3747 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
3749 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
3750 (Target_x86_64::do_plt_section_for_global): New function.
3751 (Target_x86_64::do_plt_section_for_local): New function.
3752 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
3753 parameter; change all callers. If doing a static link define
3754 __rela_iplt_start and __rela_iplt_end.
3755 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
3756 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
3757 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
3759 (Target_x86_64::make_local_ifunc_plt_entry): New function.
3760 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
3762 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
3763 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
3764 R_X86_64_IRELATIVE to switch.
3765 (Target_x86_64::Scan::global): Likewise.
3766 (Target_x86_64::Relocate::relocate): Likewise.
3767 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
3769 * target.h (class Target): Add plt_section_for_global and
3770 plt_section_for_local functions. Add do_plt_section_for_global
3771 and do_plt_section_for_local virtual functions.
3772 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
3773 clarifying comments.
3774 (Symbol::use_plt_offset): Handle IFUNC symbol.
3775 * object.cc (Sized_relobj::Sized_relobj): Initialize
3777 (Sized_relobj::local_has_plt_offset): New function.
3778 (Sized_relobj::local_plt_offset): New function.
3779 (Sized_relobj::set_local_plt_offset): New function.
3780 (Sized_relobj::do_count): Handle IFUNC symbol.
3781 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
3782 a bit away from input_shndx_ field. Add set_is_func_symbol and
3783 is_ifunc_symbol functions.
3784 (class Sized_relobj): Update declarations. Remove Tls_got_entry
3785 and Local_tls_got_offsets. Define Local_plt_offsets. Add
3786 local_plt_offsets_ field.
3787 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
3788 * output.h (class Output_section_data): Add non-const
3789 output_section function.
3790 (class Output_data_got): Update declarations.
3791 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
3792 Add use_plt_offset parameter to global and local constructors.
3793 Change all callers. Change local_sym_index_ field to 31 bits.
3794 Change GSYM_CODE and CONSTANT_CODE accordingly.
3795 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
3796 doing a static link don't set sh_link field.
3797 (Output_data_got::Got_entry::write): Use PLT offset if
3799 (Output_data_got::add_global_plt): New function.
3800 (Output_data_got::add_local_plt): New function.
3801 * target-reloc.h (relocate_section): Handle IFUNC symbol.
3802 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
3803 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
3804 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
3805 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
3807 * testsuite/ifunc-sel.h: New file.
3808 * testsuite/ifuncmain1.c: New file.
3809 * testsuite/ifuncmain1vis.c: New file.
3810 * testsuite/ifuncmod1.c: New file.
3811 * testsuite/ifuncdep2.c: New file.
3812 * testsuite/ifuncmain2.c: New file.
3813 * testsuite/ifuncmain3.c: New file.
3814 * testsuite/ifuncmod3.c: New file.
3815 * testsuite/ifuncmain4.c: New file.
3816 * testsuite/ifuncmain5.c: New file.
3817 * testsuite/ifuncmod5.c: New file.
3818 * testsuite/ifuncmain6pie.c: New file.
3819 * testsuite/ifuncmod6.c: New file.
3820 * testsuite/ifuncmain7.c: New file.
3821 * configure, testsuite/Makefile.in: Rebuild.
3823 2010-08-18 Ian Lance Taylor <iant@google.com>
3826 (Output_section_incremental_inputs::write_input_files): Add cast
3827 to avoid signed/unsigned comparison warning.
3828 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3830 2010-08-12 Cary Coutant <ccoutant@google.com>
3832 * common.cc (Sort_commons::operator()): Remove unnecessary code.
3834 2010-08-13 Ian Lance Taylor <iant@google.com>
3836 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
3838 2010-08-12 Cary Coutant <ccoutant@google.com>
3839 Doug Kwan <dougkwan@google.com>
3841 * resolve.cc (Symbol_table::should_override): When a weak dynamic
3842 defintion overrides non-weak undef, remember that the original undef
3844 * symtab.cc (Symbol_table::sized_write_global): For undef without
3845 an original weak binding, set binding to global in output.
3846 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
3847 * testsuite/Makefile.in: Regenerate.
3848 * testsuite/strong_ref_weak_def.sh: New file.
3849 * testsuite/strong_ref_weak_def_1.c: Ditto.
3850 * testsuite/strong_ref_weak_def_2.c: Ditto.
3852 2010-08-12 Cary Coutant <ccoutant@google.com>
3854 * testsuite/incremental_test.sh: Rewrite.
3855 * testsuite/incremental_test_1.c: Rewrite.
3856 * testsuite/incremental_test_2.c: Rewrite.
3858 2010-08-12 Cary Coutant <ccoutant@google.com>
3860 * arm.cc (Target_arm::got_size): Add const.
3861 (Target_arm::got_entry_count): New function.
3862 (Target_arm::plt_entry_count): New function.
3863 (Target_arm::first_plt_entry_offset): New function.
3864 (Target_arm::plt_entry_size): New function.
3865 (Output_data_plt_arm::entry_count): New function.
3866 (Output_data_plt_arm::first_plt_entry_offset): New function.
3867 (Output_data_plt_arm::get_plt_entry_size): New function.
3868 * i386.cc (Target_i386::got_size): Add const.
3869 (Target_i386::got_entry_count): New function.
3870 (Target_i386::plt_entry_count): New function.
3871 (Target_i386::first_plt_entry_offset): New function.
3872 (Target_i386::plt_entry_size): New function.
3873 (Output_data_plt_i386::entry_count): New function.
3874 (Output_data_plt_i386::first_plt_entry_offset): New function.
3875 (Output_data_plt_i386::get_plt_entry_size): New function.
3876 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
3877 find_incremental_inputs_sections. Dump incremental_got_plt section.
3878 * incremental.cc: Include target.h.
3879 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
3880 parameter. Adjust all callers. Find incremental_got_plt section.
3881 (Incremental_inputs::create_data_sections): Create incremental_got_plt
3883 (Output_section_incremental_inputs::set_final_data_size): Calculate
3884 size of incremental_got_plt section.
3885 (Output_section_incremental_inputs::do_write): Write the
3886 incremental_got_plt section.
3887 (Got_plt_view_info): New struct.
3888 (Local_got_offset_visitor): New class.
3889 (Global_got_offset_visitor): New class.
3890 (Global_symbol_visitor_got_plt): New class.
3891 (Output_section_incremental_inputs::write_got_plt): New function.
3892 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
3893 Add parameter. Adjust all callers.
3894 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3895 (Incremental_inputs::got_plt_section): New function.
3896 (Incremental_inputs::got_plt_section_): New data member.
3897 (Incremental_got_plt_reader): New class.
3898 * layout.cc (Layout::create_incremental_info_sections): Add the
3899 incremental_got_plt section.
3900 * object.h (Got_offset_list::get_list): New function.
3901 (Got offset_list::for_all_got_offsets): New function.
3902 (Sized_relobj::local_got_offset_list): New function.
3903 * powerpc.cc (Target_powerpc::got_size): Add const.
3904 (Target_powerpc::got_entry_count): New function.
3905 (Target_powerpc::plt_entry_count): New function.
3906 (Target_powerpc::first_plt_entry_offset): New function.
3907 (Target_powerpc::plt_entry_size): New function.
3908 (Output_data_plt_powerpc::entry_count): New function.
3909 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
3910 (Output_data_plt_powerpc::get_plt_entry_size): New function.
3911 * sparc.cc (Target_sparc::got_size): Add const.
3912 (Target_sparc::got_entry_count): New function.
3913 (Target_sparc::plt_entry_count): New function.
3914 (Target_sparc::first_plt_entry_offset): New function.
3915 (Target_sparc::plt_entry_size): New function.
3916 (Output_data_plt_sparc::entry_count): New function.
3917 (Output_data_plt_sparc::first_plt_entry_offset): New function.
3918 (Output_data_plt_sparc::get_plt_entry_size): New function.
3919 * symtab.h (Symbol::got_offset_list): New function.
3920 (Symbol_table::for_all_symbols): New function.
3921 * target.h (Sized_target::got_entry_count): New function.
3922 (Sized_target::plt_entry_count): New function.
3923 (Sized_target::plt_entry_size): New function.
3924 * x86_64.cc (Target_x86_64::got_size): Add const.
3925 (Target_x86_64::got_entry_count): New function.
3926 (Target_x86_64::plt_entry_count): New function.
3927 (Target_x86_64::first_plt_entry_offset): New function.
3928 (Target_x86_64::plt_entry_size): New function.
3929 (Output_data_plt_x86_64::entry_count): New function.
3930 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
3931 (Output_data_plt_x86_64::get_plt_entry_size): New function.
3933 2010-08-12 Cary Coutant <ccoutant@google.com>
3935 * archive.cc: Include incremental.h.
3936 (Archive::Archive): Initialize incremental_info_.
3937 (Archive::include_member): Record archive members in incremental info.
3938 (Add_archive_symbols::run): Record begin and end of an archive in
3940 (Lib_group::include_member): Record objects in incremental info.
3941 * archive.h (Incremental_archive_entry): Forward declaration.
3942 (Archive::set_incremental_info): New member function.
3943 (Archive::incremental_info): New member function.
3944 (Archive::Unused_symbol_iterator): New class.
3945 (Archive::unused_symbols_begin): New member function.
3946 (Archive::unused_symbols_end): New member function.
3947 (Archive::incremental_info_): New data member.
3948 * incremental-dump.cc (find_input_containing_global): New function.
3949 (dump_incremental_inputs): Dump new incremental info sections.
3950 * incremental.cc: Include symtab.h.
3951 (Output_section_incremental_inputs): New class.
3952 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
3953 new incremental info sections.
3954 (Sized_incremental_binary::do_check_inputs): Likewise.
3955 (Incremental_inputs::report_archive): Remove.
3956 (Incremental_inputs::report_archive_begin): New function.
3957 (Incremental_inputs::report_archive_end): New function.
3958 (Incremental_inputs::report_object): New function.
3959 (Incremental_inputs::finalize_inputs): Remove.
3960 (Incremental_inputs::report_input_section): New function.
3961 (Incremental_inputs::report_script): Rewrite.
3962 (Incremental_inputs::finalize): Do nothing but finalize string table.
3963 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3964 (Incremental_inputs::sized_create_inputs_section_data): Remove.
3965 (Incremental_inputs::create_data_sections): New function.
3966 (Incremental_inputs::relocs_entsize): New function.
3967 (Output_section_incremental_inputs::set_final_data_size): New function.
3968 (Output_section_incremental_inputs::do_write): New function.
3969 (Output_section_incremental_inputs::write_header): New function.
3970 (Output_section_incremental_inputs::write_input_files): New function.
3971 (Output_section_incremental_inputs::write_info_blocks): New function.
3972 (Output_section_incremental_inputs::write_symtab): New function.
3973 * incremental.h (Incremental_script_entry): Forward declaration.
3974 (Incremental_object_entry): Forward declaration.
3975 (Incremental_archive_entry): Forward declaration.
3976 (Incremental_inputs): Forward declaration.
3977 (Incremental_inputs_header_data): Remove.
3978 (Incremental_inputs_header): Remove.
3979 (Incremental_inputs_header_write): Remove.
3980 (Incremental_inputs_entry_data): Remove.
3981 (Incremental_inputs_entry): Remove.
3982 (Incremental_inputs_entry_write): Remove.
3983 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
3984 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
3985 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3986 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
3988 (Incremental_input_entry): New class.
3989 (Incremental_script_entry): New class.
3990 (Incremental_object_entry): New class.
3991 (Incremental_archive_entry): New class.
3992 (Incremental_inputs::Incremental_inputs): Initialize new data members.
3993 (Incremental_inputs::report_inputs): Remove.
3994 (Incremental_inputs::report_archive): Remove.
3995 (Incremental_inputs::report_archive_begin): New function.
3996 (Incremental_inputs::report_archive_end): New function.
3997 (Incremental_inputs::report_object): Change prototype.
3998 (Incremental_inputs::report_input_section): New function.
3999 (Incremental_inputs::report_script): Change prototype.
4000 (Incremental_inputs::get_reloc_count): New function.
4001 (Incremental_inputs::set_reloc_count): New function.
4002 (Incremental_inputs::create_data_sections): New function.
4003 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4004 (Incremental_inputs::inputs_section): New function.
4005 (Incremental_inputs::symtab_section): New function.
4006 (Incremental_inputs::relocs_section): New function.
4007 (Incremental_inputs::get_stringpool): Add const.
4008 (Incremental_inputs::command_line): Add const.
4009 (Incremental_inputs::inputs): Remove.
4010 (Incremental_inputs::command_line_key): New function.
4011 (Incremental_inputs::input_file_count): New function.
4012 (Incremental_inputs::input_files): New function.
4013 (Incremental_inputs::relocs_entsize): New function.
4014 (Incremental_inputs::sized_create_inputs_section_data): Remove.
4015 (Incremental_inputs::finalize_inputs): Remove.
4016 (Incremental_inputs::Input_info): Remove.
4017 (Incremental_inputs::lock_): Remove.
4018 (Incremental_inputs::inputs_): Change type.
4019 (Incremental_inputs::inputs_map_): Remove.
4020 (Incremental_inputs::current_object_entry_): New data member.
4021 (Incremental_inputs::inputs_section_): New data member.
4022 (Incremental_inputs::symtab_section_): New data member.
4023 (Incremental_inputs::relocs_section_): New data member.
4024 (Incremental_inputs::reloc_count_): New data member.
4025 (Incremental_inputs_reader): New class.
4026 (Incremental_symtab_reader): New class.
4027 (Incremental_relocs_reader): New class.
4028 * layout.cc (Layout::finalize): Move finalization of incremental info
4029 and creation of incremental info sections to follow finalization of
4030 symbol table. Set offsets for postprocessing sections.
4031 (Layout::create_incremental_info_sections): Call
4032 Incremental_inputs::create_data_sections. Add incremental symtab
4033 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
4034 sections to layout after input sections.
4035 * layout.h (struct Timespec): Forward declaration.
4036 (Layout::incremental_inputs): Add const.
4037 (Layout::create_incremental_info_sections): Add parameter.
4038 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
4039 * object.cc: Include incremental.h.
4040 (Relobj::finalize_incremental_relocs): New function.
4041 (Sized_relobj::do_layout): Record input sections in incremental info.
4042 * object.h (Object::output_section): New function.
4043 (Object::output_section_offset): Moved from Relobj.
4044 (Object::get_incremental_reloc_base): New function.
4045 (Object::get_incremental_reloc_count): New function.
4046 (Object::do_output_section): New function.
4047 (Object::do_output_section_offset): Moved from Relobj.
4048 (Object::do_get_incremental_reloc_base): New function.
4049 (Object::do_get_incremental_reloc_count): New function.
4050 (Object::Object): Initialize new data members.
4051 (Relobj::output_section): Renamed do_output_section and moved to
4053 (Relobj::output_section_offset): Moved to Object.
4054 (Relobj::do_get_incremental_reloc_base): New function.
4055 (Relobj::do_get_incremental_reloc_count): New function.
4056 (Relobj::allocate_incremental_reloc_counts): New function.
4057 (Relobj::count_incremental_reloc): New function.
4058 (Relobj::finalize_incremental_relocs): New function.
4059 (Relobj::next_incremental_reloc_index): New function.
4060 (Relobj::reloc_counts_): New data member.
4061 (Relobj::reloc_bases_): New data member.
4062 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
4063 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
4064 (Sized_relobj::incremental_relocs_scan): New function.
4065 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4066 (Sized_relobj::incremental_relocs_write): New function.
4067 (Sized_relobj::incremental_relocs_write_reltype): New function.
4068 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
4070 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
4071 archives and object files elsewhere.
4072 (Add_symbols::run): Report object files here.
4073 (Finish_group::run): Report end of archive at end of group.
4074 * reloc.cc: Include layout.h, incremental.h.
4075 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
4076 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
4077 (Sized_relobj::incremental_relocs_scan): New function.
4078 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4079 (Sized_relobj::do_relocate_sections): Write incremental relocations.
4080 (Sized_relobj::incremental_relocs_write): New function.
4081 (Sized_relobj::incremental_relocs_write_reltype): New function.
4082 * script.cc (read_input_script): Rewrite test for incremental link.
4083 Change call to Incremental_inputs::report_script.
4084 * symtab.h (Symbol_table::first_global_index): New function.
4085 (Symbol_table::output_count): New function.
4087 2010-08-12 Doug Kwan <dougkwan@google.com>
4089 * arm.cc (Target_arm::merge_object_attributes): Check command line
4090 options --no-wchar-size-warning and --no-enum-size-warning.
4091 * options.h (General_options): Add ld-compatible options
4092 --no-enum-size-warning and --no-wchar-size-warning.
4094 2010-08-04 Ian Lance Taylor <iant@google.com>
4096 * x86_64.cc (Target_x86_64::Scan::local): Use
4097 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
4098 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
4099 (Target_x86_64::Scan::global): Likewise.
4100 (Target_x86_64::Relocate::relocate): Likewise.
4101 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
4104 2010-08-03 Cary Coutant <ccoutant@google.com>
4106 * merge.cc (Output_merge_string::do_add_input_section): Count strings
4107 to reserve space in merged_strings vector. Keep total input size
4109 (Output_merge_string::do_print_merge_stats): Print total input size.
4110 * merge.h (Output_merge_string): Add input_size_ field.
4111 * stringpool.cc (Stringpool_template::string_length): Move
4112 implementations out of Stringpool_template class and place in
4114 * stringpool.h (string_length): Move out of Stringpool_template.
4116 2010-08-03 Ian Lance Taylor <iant@google.com>
4119 * layout.cc (relaxation_loop_body): If address of load segment is
4120 set, adjust address to include headers if possible.
4122 2010-08-03 Ian Lance Taylor <iant@google.com>
4124 * version.cc (version_string): Bump to 1.10.
4126 2010-08-03 Ian Lance Taylor <iant@google.com>
4129 * layout.h (enum Output_section_order): Define.
4130 (class Layout): Update declarations.
4131 * layout.cc (Layout::get_output_section): Add order parameter.
4132 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
4133 is_first_non_relro parameters. Change all callers.
4134 (Layout::choose_output_section): Likewise.
4135 (Layout::add_output_section_data): Likewise.
4136 (Layout::make_output_section): Likewise. Set order.
4137 (Layout::default_section_order): New function.
4138 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
4139 * output.cc (Output_section::Output_section): Initialize order_.
4140 Don't initialize deleted fields.
4141 (Output_segment::Output_segment): Don't initialize deleted
4143 (Output_segment::add_output_section_to_load): New function
4144 replacing add_output_section. Change all callers to call this or
4145 add_output_section_to_nonload.
4146 (Output_segment::add_output_section_to_nonload): New function.
4147 (Output_segment::remove_output_section): Rewrite.
4148 (Output_segment::add_initial_output_data): Likewise.
4149 (Output_segment::has_any_data_sections): Likewise.
4150 (Output_segment::is_first_section_relro): Likewise.
4151 (Output_segment::maximum_alignment): Likewise.
4152 (Output_segment::has_dynamic_reloc): New function replacing
4153 dynamic_reloc_count. Change all callers.
4154 (Output_segment::has_dynamic_reloc_list): New function replacing
4155 dynamic_reloc_count_list. Change all callers.
4156 (Output_segment::set_section_addresses): Rewrite.
4157 (Output_segment::set_offset): Rewrite.
4158 (Output_segment::find_first_and_last_list): Remove.
4159 (Output_segment::set_tls_offsets): Rewrite.
4160 (Output_segment::first_section_load_address): Likewise.
4161 (Output_segment::output_section_count): Likewise.
4162 (Output_segment::section_with_lowest_load_address): Likewise.
4163 (Output_segment::write_section_headers): Likewise.
4164 (Output_segment::print_sections_to_map): Likewise.
4165 * output.h (class Output_data): Remove dynamic_reloc_count_
4166 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
4167 (Output_data::add_dynamic_reloc): Rewrite.
4168 (Output_data::has_dynamic_reloc): New function.
4169 (Output_data::dynamic_reloc_count): Remove.
4170 (class Output_section): Add order_ field. Remvoe is_relro_local_,
4171 is_last_relro_, is_first_non_relro_, is_interp_,
4172 is_dynamic_linker_section_ fields. Add order and set_order
4173 functions. Remove is_relro_local, set_is_relro_local,
4174 is_last_relro, set_is_last_relro, is_first_non_relro,
4175 set_is_first_non_relro functions, is_interp, set_is_interp,
4176 is_dynamic_linker_section, and set_is_dynamic_linker_section
4178 (class Output_segment): Change Output_data_list from std::list to
4179 std:;vector. Add output_lists_ field. Remove output_data_ and
4180 output_bss_ fields. Update declarations.
4182 2010-08-02 Ian Lance Taylor <iant@google.com>
4184 * arm.cc (Target_arm::gc_process_relocs): Use typename.
4185 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
4186 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
4188 2010-08-02 Ian Lance Taylor <iant@google.com>
4191 * script.cc (Script_options::Script_options): Initialize
4192 symbol_definitions_ and symbol_references_.
4193 (Script_options::add_symbol_assignment): Update
4194 symbol_definitions_ and symbol_references_.
4195 (Script_options::add_symbol_reference): New function.
4196 (script_symbol): New function.
4197 * script.h (class Script_options): Add symbol_definitions_ and
4198 symbol_references_ fields.
4199 (Script_options::referenced_const_iterator): New type.
4200 (Script_options::referenced_begin): New function.
4201 (Script_options::referenced_end): New function.
4202 (Script_options::is_referenced): New function.
4203 (Script_options::any_unreferenced): New function.
4204 * script-c.h (script_symbol): Declare.
4205 * yyscript.y (exp): Call script_symbol.
4206 * symtab.cc: Include "script.h".
4207 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
4208 Change all callers. Check symbols referenced by scripts.
4209 (Symbol_table::add_undefined_symbols_from_command_line): Add
4210 layout parameter. Change all callers.
4211 (Symbol_table::do_add_undefined_symbols_from_command_line):
4212 Likewise. Break out loop body. Check symbols referenced by
4214 (Symbol_table::add_undefined_symbol_from_command_line): New
4215 function broken out of
4216 do_add_undefined_symbols_from_command_line.
4217 * symtab.h (class Symbol_table): Update declarations.
4218 * archive.cc: Include "layout.h".
4219 (Archive::should_include_member): Add layout parameter. Change
4220 all callers. Check for symbol mentioned in expression.
4221 * archive.h (class Archive): Update declaration.
4222 * object.cc (Sized_relobj::do_should_include_member): Add layout
4224 * object.h (Object::should_include_member): Add layout parameter.
4226 (Object::do_should_include_member): Add layout parameter.
4227 (class Sized_relobj): Update declaration.
4228 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
4230 * dynobj.h (class Sized_dynobj): Update declaration.
4231 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
4233 * plugin.h (class Sized_pluginobj): Update declaration.
4235 2010-08-02 Ian Lance Taylor <iant@google.com>
4238 * output.cc (Output_segment::set_offset): Search for the first and
4239 last sections rather than assuming that the list is in order.
4240 (Output_segment::find_first_and_last_list): New function.
4241 * output.h (class Output_segment): Update declarations.
4242 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4243 (relro_strip_test_SOURCES): New variable.
4244 (relro_strip_test_DEPENDENCIES): New variable.
4245 (relro_strip_test_LDFLAGS): New variable.
4246 (relro_strip_test_LDADD): New variable.
4247 (relro_strip_test.so): New target.
4249 2010-08-02 Ian Lance Taylor <iant@google.com>
4251 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4252 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4253 (Target_i386::got_tlsdesc_section): New function.
4254 (Target_i386::got_section): Create space for GOT entries for
4255 TLSDESC relocations.
4256 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4258 (Target_i386::Scan::global): Likewise.
4259 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
4261 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
4262 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
4263 (Target_x86_64::got_tlsdesc_section): New function.
4264 (Target_x86_64::got_section): Create space for GOT entries for
4265 TLSDESC relocations.
4266 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
4268 (Target_x86_64::Scan::global): Likewise.
4269 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
4272 2010-08-02 Ian Lance Taylor <iant@google.com>
4274 * testsuite/final_layout.sh: Use dc to convert from hex to
4277 2010-07-29 Sriraman Tallam <tmsriram@google.com>
4279 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4280 paramter to the call to gold::gc_process_relocs.
4281 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4282 paramter to the call to gold::gc_process_relocs.
4283 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4284 parameter to the call to gold::gc_process_relocs.
4285 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4286 template parameter to the call to gold::gc_process_relocs.
4287 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4288 paramter to the call to gold::gc_process_relocs.
4289 * gc.h (get_embedded_addend_size): New function.
4290 (gc_process_relocs): Save the size of the reloc for use by ICF.
4291 * icf.cc (get_section_contents): Get the addend from the text section
4292 for SHT_REL relocation sections.
4293 * icf.h (Icf::Reloc_addend_size_info): New typedef.
4294 (Icf::Reloc_info): Add new member reloc_addend_size_info.
4295 * int_encoding.h (read_from_pointer): New overloaded function.
4296 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
4297 * testsuite/icf_sht_rel_addend_test.sh: New file.
4298 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
4299 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
4301 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4303 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
4304 * Makefile.in: Regenerate.
4305 * testsuite/Makefile.in: Regenerate.
4307 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
4309 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
4310 * gold/testsuite/debug_msg.cc: Likewise.
4311 * gold/testsuite/odr_violation1.cc
4312 * gold/testsuite/odr_violation2.cc
4314 2010-07-21 Cary Coutant <ccoutant@google.com>
4316 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
4317 string, and length fields.
4318 (Output_merge_string::Merged_strings_list): New type.
4319 (Output_merge_string::Merged_strings_lists): New typedef.
4320 (Output_merge_string): Replace merged_strings_ with
4321 merged_strings_lists_.
4322 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
4323 Merged_strings_list per input object and section. Don't store pointer
4324 to the string. Don't store length with each merged string entry.
4325 (Output_merge_string::finalize_merged_data): Loop over list of merged
4326 strings lists. Recompute length of each merged string.
4328 2010-07-15 Cary Coutant <ccoutant@google.com>
4330 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
4333 2010-07-14 Ian Lance Taylor <iant@google.com>
4335 * descriptors.cc (Descriptors::open): Report correct name in error
4338 2010-07-13 Doug Kwan <dougkwan@google.com>
4340 * arm.cc (Arm_input_section::Arm_input_section): For a
4341 SHT_ARM_EXIDX section, always keeps the input sections.
4342 (Arm_input_section::set_exidx_section_link): New method.
4343 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
4344 has_errors_ to false.
4345 (Arm_exidx_input_section::has_errors,
4346 Arm_exidx_input_section::set_has_errors): New methods.
4347 (Arm_exidx_input_section::has_errors_): New data member.
4348 (Arm_relobj::get_exidx_shndx_list): New method.
4349 (Arm_output_section::append_text_sections_to_list): Do not skip
4350 section without SHF_EXECINSTR.
4351 (Arm_output_section::fix_exidx_coverage): Skip input sections with
4353 (Arm_relobj::make_exidx_input_section): Add new parameter for text
4354 section header. Make error messages more verbose. Check for
4355 a non-executable section linked to an EXIDX section.
4356 (Arm_relobj::do_read_symbols): Remove error checking, which has been
4357 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
4358 check that there is no deferred EXIDX section if we exit early.
4359 Instead of not making an EXIDX section in case of an error, make one
4360 and set the has_errors flag of it.
4361 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
4362 in a relocatable link.
4363 (Target_arm::do_relax): Look for the EXIDX output section instead of
4364 assuming that it is called .ARM.exidx.
4365 (Target_arm::fix_exidx_coverage): Add a new parameter for input
4366 section list. Do not check for SHF_EXECINSTR section flags but
4367 skip any input section with errors.
4368 * output.cc (Output_section::Output_section): Initialize
4369 always_keeps_input_sections_ to false.
4370 (Output_section::add_input_section): Check for
4371 always_keeps_input_sections_.
4372 * output.h (Output_section::always_keeps_input_sections,
4373 Output_section::set_always_keeps_input_sections): New methods.
4374 (Output_section::always_keeps_input_sections): New data member.
4376 2010-07-13 Rafael Espindola <espindola@google.com>
4378 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
4379 * fileread.h (Input_file): Add try_extra_search_path and find_file.
4381 2010-07-13 Philip Herron <herron.philip@googlemail.com>
4382 Ian Lance Taylor <iant@google.com>
4384 * output.h (Output_section_lookup_maps::add_merge_section):
4385 Correct check of whether value was inserted.
4386 (Output_section_lookup_maps::add_merge_input_section): Likewise.
4387 (Output_section_lookup_maps::add_relaxed_input_section):
4389 * arm.cc (Target_arm::got_section): Remove used local os.
4390 * i386.cc (Target_i386::got_section): Likewise.
4391 * x86_64.cc (Target_x86_64::got_section): Likewise.
4392 * sparc.cc (Target_sparc::got_section): Likewise.
4393 (Target_sparc::relocate): Remove unused local have_got_offset.
4394 * powerpc.cc (Target_powerpc::relocate): Likewise.
4396 2010-07-13 Ian Lance Taylor <iant@google.com>
4398 * compressed_output.cc (zlib_decompress): Fix signature in
4401 * archive.cc (Archive::include_member): Unlock an external member
4402 of a thin archive. Don't bother to delete an object we know is
4405 2010-07-12 Cary Coutant <ccoutant@google.com>
4407 * compressed_output.cc (zlib_decompress): New function.
4408 (get_uncompressed_size): New function.
4409 (decompress_input_section): New function.
4410 * compressed_output.h (get_uncompressed_size): New function.
4411 (decompress_input_section): New function.
4412 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
4413 Handle compressed debug sections.
4414 * layout.cc (is_compressed_debug_section): New function.
4415 (Layout::output_section_name): Map compressed section names to
4417 * layout.h (is_compressed_debug_section): New function.
4418 (is_debug_info_section): Recognize compressed debug sections.
4419 * merge.cc: Include compressed_output.h.
4420 (Output_merge_data::do_add_input_section): Handle compressed
4422 (Output_merge_string::do_add_input_section): Handle compressed
4424 * object.cc: Include compressed_output.h.
4425 (Sized_relobj::Sized_relobj): Initialize new data members.
4426 (build_compressed_section_map): New function.
4427 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
4428 * object.h (Object::section_is_compressed): New method.
4429 (Object::do_section_is_compressed): New method.
4430 (Sized_relobj::Compressed_section_map): New type.
4431 (Sized_relobj::do_section_is_compressed): New method.
4432 (Sized_relobj::compressed_sections_): New data member.
4433 * output.cc (Output_section::add_input_section): Handle compressed
4435 * reloc.cc: Include compressed_output.h.
4436 (Sized_relobj::write_sections): Handle compressed debug sections.
4438 2010-07-08 Cary Coutant <ccoutant@google.com>
4440 * resolve.cc (Symbol_table::resolve): Remember whether undef was
4441 weak when resolving to a dynamic def.
4442 (Symbol_table::should_override): Add adjust_dyndef flag; set it
4443 for weak undef/dynamic def cases. Adjust callers.
4444 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
4445 undef_binding_weak_.
4446 (Symbol_table::sized_write_globals): Adjust symbol binding.
4447 (Symbol_table::sized_write_symbol): Add binding parameter.
4448 * symtab.h (Symbol::set_undef_binding): New method.
4449 (Symbol::is_undef_binding_weak): New method.
4450 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
4451 (Symbol_table::should_override): Add new parameter.
4452 (Symbol_table::sized_write_symbol): Add new parameter.
4454 * testsuite/weak_undef_file1.cc: Add new test case.
4455 * testsuite/weak_undef_file2.cc: Fix header comment.
4456 * testsuite/weak_undef_test.cc: Add new test case.
4458 2010-06-29 Doug Kwan <dougkwan@google.com>
4460 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
4461 Initialize USE_SYMBOL_.
4462 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
4464 (Arm_reloc_property::uses_symbol_): New data member declaration.
4465 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
4466 uses symbol value and symbol is undefined but not weakly undefined.
4468 2010-06-28 Rafael Espindola <espindola@google.com>
4470 * plugin.cc (Plugin::load): Use dlerror.
4472 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
4474 * symtab.cc (detect_odr_violations): When reporting an ODR
4475 violation, report an object where the symbol is defined.
4477 2010-06-25 Doug Kwan <dougkwan@google.com>
4479 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
4480 (Target_arm::section_may_have_icf_unsafe_pointers): New method
4482 (Target_arm::Scan::local_reloc_may_be_function_pointer,
4483 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
4484 target hook to detect function points.
4485 (Target_arm::Scan::possible_function_pointer_reloc): New method.
4486 * icf.h (Icf::check_section_for_function_pointers): Change type of
4487 parameter SECTION_NAME to const reference to std::string. Use
4488 target hook to determine if section may have unsafe pointers.
4489 * target.h (Target::section_may_have_icf_unsafe_pointers): New
4492 2010-06-21 Rafael Espindola <espindola@google.com>
4494 * fileread.cc (Input_file::find_fie): New
4495 (Input_file::open): Use Input_file::find_fie.
4496 * fileread.h (Input_file::find_fie): New
4497 * plugin.cc (set_extra_library_path): New.
4498 (Plugin::load): Add set_extra_library_path to the transfer vector.
4499 (Plugin_manager::set_extra_library_path): New.
4500 (Plugin_manager::add_input_file): Use the extra search path if set.
4501 (set_extra_library_path(): New.
4502 * plugin.h (Plugin_manager): Add set_extra_library_path and
4505 2010-06-19 Cary Coutant <ccoutant@google.com>
4507 * layout.cc (gdb_sections): Add .debug_types.
4508 (lines_only_debug_sections): Likewise.
4510 2010-06-18 Rafael Espindola <espindola@google.com>
4512 * plugin.cc (add_input_file,add_input_library)
4513 (Plugin_manager::add_input_file): Make filename arguments const.
4514 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
4517 2010-06-16 Doug Kwan <dougkwan@google.com>
4519 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
4520 .ARM.attributes section if we have not merged any input
4521 attributes sections.
4523 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4525 * arm.cc: Allow combining objects with no EABI version
4528 2010-06-15 Rafael Espindola <espindola@google.com>
4530 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
4532 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4534 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
4535 (struct iovec): Correct !HAVE_READV definition.
4537 2010-06-10 Cary Coutant <ccoutant@google.com>
4539 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
4540 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
4542 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
4545 * symtab.h (Symbol::is_placeholder): New member function.
4546 * target-reloc.h (relocate_section): Check for placeholder symbols.
4548 * testsuite/Makefile.am (plugin_test_8): New test.
4549 (plugin_test_9): New test.
4550 * testsuite/Makefile.in: Regenerate.
4552 2010-06-09 Nick Clifton <nickc@redhat.com>
4554 * yyscript.y (input_list_element): Allow strings prefixed with
4555 the '-' character. Treat these as libraries.
4556 * script.cc (script_add_library): New function. Adds a library
4557 specified by "-l<name>" found in an input script.
4558 * script-c.h: Add prototype for script_add_library.
4560 2010-06-07 Doug Kwan <dougkwan@google.com>
4562 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
4563 Restrict stub-group size to be within long conditional branch
4564 range when working around cortex-A8 erratum.
4566 2010-06-07 Damien Diederen <dd@crosstwine.com>
4568 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
4571 2010-06-03 Sriraman Tallam <tmsriram@google.com>
4575 (Output_section::Input_section_sort_entry::compare_section_ordering):
4576 Change to return non-zero correctly.
4577 (Output_section::Input_section_sort_section_order_index_compare
4578 ::operator()): Change to fix ambiguity in comparisons.
4580 2010-06-01 Sriraman Tallam <tmsriram@google.com>
4582 * gold.h (is_wildcard_string): New function.
4583 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
4584 (Layout::layout_eh_frame): Ditto.
4585 (Layout::find_section_order_index): New method.
4586 (Layout::read_layout_from_file): New method.
4587 * layout.h (Layout::find_section_order_index): New method.
4588 (Layout::read_layout_from_file): New method.
4589 (Layout::input_section_position_): New private member.
4590 (Layout::input_section_glob_): New private member.
4591 * main.cc (main): Call read_layout_from_file here.
4592 * options.h (--section-ordering-file): New option.
4593 * output.cc (Output_section::input_section_order_specified_): New
4595 (Output_section::Output_section): Initialize new member.
4596 (Output_section::add_input_section): Add new parameter.
4597 Keep input sections when --section-ordering-file is used.
4598 (Output_section::set_final_data_size): Sort input sections when
4599 section ordering file is specified.
4600 (Output_section::Input_section_sort_entry): Add new parameter.
4602 (Output_section::Input_section_sort_entry::compare_section_ordering):
4604 (Output_section::Input_section_sort_compare::operator()): Change to
4605 consider section_order_index.
4606 (Output_section::Input_section_sort_init_fini_compare::operator()):
4607 Change to consider section_order_index.
4608 (Output_section::Input_section_sort_section_order_index_compare
4609 ::operator()): New method.
4610 (Output_section::sort_attached_input_sections): Change to sort
4611 according to section order when specified.
4612 (Output_section::add_input_section<32, true>): Add new parameter.
4613 (Output_section::add_input_section<64, true>): Add new parameter.
4614 (Output_section::add_input_section<32, false>): Add new parameter.
4615 (Output_section::add_input_section<64, false>): Add new parameter.
4616 * output.h (Output_section::add_input_section): Add new parameter.
4617 (Output_section::input_section_order_specified): New
4619 (Output_section::set_input_section_order_specified): New method.
4620 (Input_section::Input_section): Initialize section_order_index_.
4621 (Input_section::section_order_index): New method.
4622 (Input_section::set_section_order_index): New method.
4623 (Input_section::section_order_index_): New member.
4624 (Input_section::Input_section_sort_section_order_index_compare): New
4626 (Output_section::input_section_order_specified_): New member.
4627 * script-sections.cc (is_wildcard_string): Delete and move modified
4629 (Output_section_element_input::Output_section_element_input): Modify
4630 call to is_wildcard_string.
4631 (Output_section_element_input::Input_section_pattern
4632 ::Input_section_pattern): Ditto.
4633 (Output_section_element_input::Output_section_element_input): Ditto.
4634 * testsuite/Makefile.am (final_layout): New test case.
4635 * testsuite/Makefile.in: Regenerate.
4636 * testsuite/final_layout.cc: New file.
4637 * testsuite/final_layout.sh: New file.
4639 2010-06-01 Rafael Espindola <espindola@google.com>
4641 * plugin.cc (Plugin::load): Pass the output name to the plugin.
4643 2010-06-01 Rafael Espindola <espindola@google.com>
4645 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
4646 visibility of symbols.
4648 2010-05-27 Doug Kwan <dougkwan@google.com>
4650 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
4651 from start of output section instead of address for a local symbol
4652 in a merged or relaxed section when doing a relocatable link.
4654 2010-05-26 Rafael Espindola <espindola@google.com>
4657 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
4658 adding sections the garbage collector removed.
4659 * gold/testsuite/Makefile.am: Add test.
4660 * gold/testsuite/Makefile.in: Regenerate.
4661 * gold/testsuite/plugin_test_7.sh: New.
4662 * gold/testsuite/plugin_test_7_1.c: New.
4663 * gold/testsuite/plugin_test_7_2.c: New.
4665 2010-05-26 Rafael Espindola <espindola@google.com>
4667 * script-sections.cc (Output_section_definition::set_section_addresses):
4668 Check for --section-start.
4670 2010-05-26 Doug Kwan <dougkwan@google.com>
4672 * arm.cc (Arm_scan_relocatable_relocs): New class.
4673 (Target_arm::relocate_special_relocatable): New method.
4674 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
4675 (Arm_relocate_functions::thumb_branch_common): Same.
4676 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
4677 instead of Default_scan_relocatable_relocs.
4678 * target-reloc.h (relocate_for_relocatable): Let target handle
4679 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
4680 * target.h (Sized_target::relocate_special_relocatable): New method.
4682 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4684 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
4686 2010-05-23 Doug Kwan <dougkwan@google.com>
4688 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
4690 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
4691 with a direct branch, not a conditional branch, to a stub.
4692 * merge.cc (Output_merge_base::record_input_section): New method
4694 (Output_merge_data::do_add_input_section): Record input section if
4695 keeps-input-sections flag is set.
4696 (Output_merge_string::do_add_input_section): Ditto.
4697 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
4698 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
4700 (Output_merge_base::keeps_input_sections,
4701 Output_merge_base::set_keeps_input_sections,
4702 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
4704 (Output_merge_base::Input_sections): New type declaration.
4705 (Output_merge_base::input_sections_begin,
4706 Output_merge_base::input_sections_end,
4707 Output_merge_base::do_set_keeps_input_sections): New method definitions.
4708 (Output_merge_base::bool keeps_input_sections_,
4709 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
4710 Output_merge_base::input_sections_): New data members.
4711 (Output_merge_data::do_set_keeps_input_sections): New method
4713 (Output_merge_string::do_set_keeps_input_sections): Ditto.
4714 * output.cc (Output_section::Input_section::relobj): Move method
4715 defintion from class declaration to here and handle merge sections.
4716 (Output_section::Input_section::shndx): Ditto.
4717 (Output_section::Output_section): Remove initializations of removed
4718 data members and initialize new data member LOOKUP_MAPS_.
4719 (Output_section::add_input_section): Set keeps-input-sections flag
4720 for a newly created merge output section as appropriate. Adjust code
4721 to use Output_section_lookup_maps class.
4722 (Output_section::add_relaxed_input_section): Adjst code for lookup
4723 maps code refactoring.
4724 (Output_section::add_merge_input_section): Add a new parameter
4725 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
4726 class. If adding input section to a newly created merge output
4727 section fails, remove the new merge section.
4728 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
4729 Adjust code for use of the Output_section_lookup_maps class.
4730 (Output_section::find_merge_section): Ditto.
4731 (Output_section::build_lookup_maps): New method defintion.
4732 (Output_section::find_relaxed_input_section): Adjust code to use
4733 Output_section_lookup_maps class.
4734 (Output_section::get_input_sections): Export merge sections. Adjust
4735 code to use Output_section_lookup_maps class.
4736 (Output_section:::add_script_input_section): Adjust code to use
4737 Output_section_lookup_maps class. Update lookup maps for merge
4739 (Output_section::discard_states): Use Output_section_lookup_maps.
4740 (Output_section::restore_states): Same.
4741 * output.h (Merge_section_properties): Move class defintion out of
4743 (Output_section_lookup_maps): New class.
4744 (Output_section::Input_section::is_merge_section): New method
4746 (Output_section::Input_section::relobj): Move defintion out of class
4747 defintion. Declare method only.
4748 (Output_section::Input_section::shndx): Ditto.
4749 (Output_section::Input_section::output_merge_base): New method defintion.
4750 (Output_section::Input_section::u2_.pomb): New union field.
4751 (Output_section::Merge_section_by_properties_map,
4752 Output_section::Output_section_data_by_input_section_map,
4753 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
4755 (Output_section::add_merge_input_section): Add new parameter
4756 KEEPS_INPUT_SECTIONS.
4757 (Output_section::build_lookup_maps): New method declaration.
4758 (Output_section::merge_section_map_,
4759 Output_section::merge_section_by_properties_map_,
4760 Output_section::relaxed_input_section_map_,
4761 Output_section::is_relaxed_input_section_map_valid_): Remove data
4763 (Output_section::lookup_maps_): New data member.
4765 2010-05-21 Doug Kwan <dougkwan@google.com>
4768 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
4769 avoid a compilation error.
4771 2010-05-19 Rafael Espindola <espindola@google.com>
4773 * script-sections.cc (Output_section_definition::allocate_to_segment):
4774 Update the phdrs_list even when the output section is NULL.
4775 * testsuite/Makefile.am: Add test.
4776 * testsuite/Makefile.in: Regenerate.
4777 * testsuite/script_test_9.cc: New.
4778 * testsuite/script_test_9.sh: New.
4779 * testsuite/script_test_9.t: New.
4781 2010-05-19 Doug Kwan <dougkwan@google.com>
4783 * arm.cc (Arm_input_section::original_size): New method.
4784 (Arm_input_section::do_addralign): Add a cast.
4785 (Arm_input_section::do_output_offset): Remove static cast.
4786 (Arm_input_section::original_addralign,
4787 Arm_input_section::original_size_): Change type to uint32_t.
4788 (Arm_input_section::init): Add safe casts for section alignment
4790 (Arm_input_section::set_final_data_size): Do not set address and
4791 offset of stub table.
4792 (Arm_output_section::fix_exidx_coverage): Change use of of
4793 Output_section::Simple_input_section to that of
4794 Output_section::Input_section.
4795 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
4796 except for the first pass.
4797 * output.cc (Output_section::get_input_sections): Change type of
4798 input_sections to std::list<Input_section>.
4799 (Output_section::add_script_input_section): Rename from
4800 Output_section::add_simple_input_section. Change type of SIS
4801 parameter from Simple_input_section to Input_section.
4802 * output.h (Output_section::Simple_input_section): Remove class.
4803 (Output_section::Input_section): Change class visibility to public.
4804 (Output_section::Input_section::addralign): Use stored alignments
4805 for special input sections if set.
4806 (Output_section::Input_section::set_addralign): New method.
4807 (Output_section::get_input_sections): Change parameter type from
4808 list of Simple_input_section to list of Input_section.
4809 (Output_section::add_script_input_section): Rename from
4810 Output_section::add_simple_input_section. Change first parameter's
4811 type from Simple_input_section to Input_section and remove the
4812 second and third parameters.
4813 * script-sections.cc (Input_section::Input_section_list): Change
4814 type to list of Output_section::Input_section/
4815 (Input_section_info::Input_section_info): Change parameter type of
4816 INPUT_SECTION to Output_section::Input_section.
4817 (Input_section_info::input_section): Change return type.
4818 (Input_section_info::input_section_): Change type to
4819 Output_section::Input_section.
4820 (Output_section_element_input::set_section_addresses): Adjust code
4821 to use Output_section::Input_section instead of
4822 Output_section::Simple_input_section. Adjust code for renaming
4823 of Output_section::add_simple_input_section.
4824 (Orphan_output_section::set_section_addresses): Ditto.
4826 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4828 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
4829 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
4831 2010-05-18 Rafael Espindola <espindola@google.com>
4833 * options.cc (General_options::finalize): Handle -nostdlib.
4834 * options.h (nostdlib): New option.
4835 * script.cc (script_add_search_dir): Handle -nostdlib.
4837 2010-05-12 Doug Kwan <dougkwan@google.com>
4839 * arm.cc (Target_arm::do_finalize_sections): Create an empty
4840 attributes section only if there no attributes section after merging.
4841 (Target_arm::merge_object_attributes): Move value of
4842 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
4843 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
4844 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
4845 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
4846 and arm_attr_merge_7.stdout.
4847 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
4848 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
4849 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
4850 arm_attr_merge_7b.o): New rules.
4851 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
4853 * testsuite/Makefile.in: Regenerate.
4854 * testsuite/arm_attr_merge.sh: New file.
4855 * testsuite/arm_attr_merge_[67][ab].s: Same.
4857 2010-05-05 Nick Clifton <nickc@redhat.com>
4859 * po/es.po: Updated Spanish translation.
4861 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
4863 * Makefile.am (install-exec-local): Properly install gold as
4864 default cross linker.
4865 * Makefile.in: Regenerated.
4867 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
4868 Nick Clifton <nickc@redhat.com>
4870 * configure.ac (install_as_default): Define and set to false
4871 unless --enable-gold or --enable-gold=both/gold has been
4873 * configure: Regenerate.
4875 * Makefile.am (install-exec-local): Install the executable as
4876 'ld.gold'. If install_as_default is true then also install it as
4878 * Makefile.in: Regenerated.
4880 2010-04-24 Ian Lance Taylor <iant@google.com>
4882 * layout.cc (Layout::layout_reloc): In relocatable link don't
4883 combine reloc sections for grouped sections.
4885 2010-04-23 Sriraman Tallam <tmsriram@google.com>
4887 * gc.h (gc_process_relocs): Pass information on relocs pointing to
4888 sections that are not ordinary to icf.
4889 * icf.cc (get_section_contents): Handle relocation pointing to section
4890 with no object or shndx information.
4891 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
4892 * testsuite/Makefile.in: Regenerate.
4893 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
4894 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
4896 2010-04-22 Ian Lance Taylor <iant@google.com>
4898 * expression.cc (Expression::Expression_eval_info): Add
4899 result_alignment_pointer field.
4900 (Expression::eval_with_dot): Add result_alignment_pointer
4901 parameter. Change all callers.
4902 (Expression::eval_maybe_dot): Likewise.
4903 (class Binary_expression): Add alignment_pointer parameter to
4904 left_value and right_value. Change all callers.
4905 (BINARY_EXPRESSION): Set result alignment.
4906 (class Trinary_expression): Add alignment_pointer parameter to
4907 arg2_value and arg3_value. Change all callers.
4908 (Trinary_cond::value): Set result alignment.
4909 (Max_expression::value, Min_expression::value): Likewise.
4910 (Align_expression::value): Likewise.
4911 * script-sections.cc (class Sections_element): Add dot_alignment
4912 parameter to set_section_addresses virtual function. Update
4914 (class Output_section_element): Likewise.
4915 (Script_sections::create_segments): Add dot_alignment parameter.
4917 (Script_sections::create_segments_from_phdrs_clause): Likewise.
4918 (Script_sections::set_phdrs_clause_addresses): Likewise.
4919 * script-sections.h: Update declarations.
4920 * script.h: Update declarations.
4921 * output.h (Output_segment::set_minimum_p_align): Don't decrease
4923 * testsuite/script_test_3.t: Set large alignment.
4924 * testsuite/script_test_3.sh: Make sure that at least one LOAD
4925 segment has expected alignment.
4927 2010-04-22 Nick Clifton <nickc@redhat.com>
4929 * po/gold.pot: Updated by the Translation project.
4930 * po/vi.po: Updated Vietnamese translation.
4932 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
4934 * testsuite/Makefile.am (check_PROGRAMS): Add
4935 icf_virtual_function_folding_test.
4936 * testsuite/Makefile.in: Regenerated.
4938 2010-04-15 Andrew Haley <aph@redhat.com>
4940 * options.h (merge_exidx_entries): New option.
4941 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
4942 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
4943 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
4944 (Target_arm::merge_exidx_entries): New function.
4945 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
4946 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
4947 to Arm_exidx_fixup constructor.
4948 Add new arg, merge_exidx_entries.
4949 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
4950 Arm_output_section::fix_exidx_coverage.
4952 2010-04-18 Sriraman Tallam <tmsriram@google.com>
4954 * icf.cc (get_section_contents): Check for preemptible functions.
4955 Ignore addend when appropriate.
4956 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
4958 (add_from_relobj): Check for section folded.
4959 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
4960 * symtab.h (should_add_dynsym_entry): Add new parameter.
4961 * target-reloc.h (scan_relocs): Check for section folded.
4962 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
4963 Check reloc types for function pointers in shared objects.
4964 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
4966 (icf_preemptible_functions_test): New test case.
4967 (icf_string_merge_test): New test case.
4968 * testsuite.Makefile.in: Regenerate.
4969 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
4970 bar_glob. Refactor code.
4971 * testsuite/icf_preemptible_functions_test.cc: New file.
4972 * testsuite/icf_preemptible_functions_test.sh: New file.
4973 * testsuite/icf_string_merge_test.cc: New file.
4974 * testsuite/icf_string_merge_test.sh: New file.
4975 * testsuite/icf_virtual_function_folding_test.cc: New file.
4976 * testsuite/icf_virtual_function_folding_test.sh: New file.
4978 2010-04-14 Doug Kwan <dougkwan@google.com>
4980 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
4981 for local symbol recounting if we remove a section due to ICF.
4982 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
4983 there are no regular objects in input.
4985 2010-04-13 Doug Kwan <dougkwan@google.com>
4987 * arm.cc (Arm_input_section::set_final_data_size): Compute
4988 accurate final data size instead of using current data size.
4990 2010-04-09 Doug Kwan <dougkwan@google.com>
4992 * layout.cc (Layout::choose_output_section): Handle script section
4994 (Layout::make_output_section_for_script): Add section type parameter.
4995 Handle script section types.
4996 * layout.h (Layout::make_output_section_for_script): Add section
4998 * output.cc (Output_section::Output_section): Initialize data member
5000 (Output_section::do_reset_address_and_file_offset): Do not set address
5001 to 0 if section is a NOLOAD section.
5002 * output.h (Output_section::is_noload): New method.
5003 (Output_section::set_is_noload): Ditto.
5004 (Output_section::is_noload_): New data member.
5005 * script-c.h (Script_section_type): New enum type.
5006 (struct Parser_output_section_header): Add new file section_type.
5007 * script-sections.cc (Sections_element::output_section_name): Add
5008 parameter for returning script section type.
5009 (Output_section_definition::output_section_name): Ditto.
5010 (Output_section_definition::section_type)P; New method.
5011 (Output_section_definiton::script_section_type_name): Ditto.
5012 (Output_section_definition::script_section_type_): New data member.
5013 (Output_section_definition::Output_section_definition): Initialize
5014 data member Output_section_definition::script_section_type_.
5015 (Output_section_definition::create_sections): Pass script section type
5016 to Layout::make_output_section_for_script.
5017 (Output_section_definition::output_section_name): Return script
5018 section type to caller.
5019 (Output_section_definition::set_section_address): Do not advance
5020 dot value and load address if section type is NOLOAD. Set address
5021 of NOLOAD sections regardless of section flags.
5022 (Output_section_definition::print): Print section type if it is
5023 not SCRIPT_SECTION_TYPE_NONE.
5024 (Output_section_definition::section_type): New method.
5025 (Output_section_definition::script_section_type_name): Ditto.
5026 (Script_sections::output_section_name): Add new parameter
5027 PSECTION_TYPE for returning script section type. Pass it to
5028 section elements. Handle discard sections.
5029 (Sort_output_sections::operator()): Handle NOLOAD sections.
5030 * script-sections.h (Script_sections::Section_type): New enum type.
5031 (Script_sections::output_section_name): Add a new parameter for
5032 returning script section type.
5033 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
5035 * yyscript.y (union): Add new field SECTION_TYPE.
5036 (COPY, DSECT, INFO, NOLOAD): New tokens.
5037 (opt_address_and_section_type): Change type to output_section_header.
5038 (section_type): New non-terminal
5039 (section_header): Handle section type.
5040 (opt_address_and_section_type): Return section type value.
5042 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
5044 * testsuite/plugin_common_test_1.c (foo): Add prototype.
5045 * testsuite/plugin_common_test_2.c (foo): Likewise.
5047 2010-04-08 Doug Kwan <dougkwan@google.com>
5049 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
5051 * output.cc (Output_section::add_merge_input_section): Simplify
5052 code and return status of Output_merge_base::add_input_section.
5053 Update merge section map only if Output_merge_base::add_input_section
5056 2010-04-07 Doug Kwan <dougkwan@google.com>
5058 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
5059 if section is marked as containing instructions but has no mapping
5061 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
5062 correct section index.
5063 (Arm_relobj::find_linked_text_section): Ditto.
5065 2010-04-07 Cary Coutant <ccoutant@google.com>
5067 * archive.cc (include_member): Destroy Read_symbols_data object before
5069 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
5070 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
5071 (Read_symbols_data::~Read_symbols_data) New destructor.
5072 (Section_relocs::Section_relocs) New constructor.
5073 (Section_relocs::~Section_relocs) New destructor.
5074 (Read_relocs_data::Read_relocs_data) New constructor.
5075 (Read_relocs_data::~Read_relocs_data) New destructor.
5076 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
5077 pointers to NULL after deleting.
5079 2010-04-07 Doug Kwan <dougkwan@google.com>
5081 * arm.cc: Replace "endianity" with "endianness" in comments.
5082 (Arm_exidx_cantunwind): Ditto.
5083 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
5084 (Arm_relobj::merge_flags_and_attributes): New method.
5085 (Arm_relobj::merge_flags_and_attributes_): New data member.
5086 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
5087 (Arm_relobj::scan_sections_for_stubs): Ditto.
5088 (Arm_relobj::do_read_symbols): Check to see if we really want to
5089 merge processor-specific flags and attributes. Exit early if
5090 an object is empty except for section names and the undefined symbol.
5091 (Target_arm::do_finalize_sections): Move check for ELF format to
5092 Arm_relobj::do_read_symbols. Merge processor specific flags and
5093 attributes from a regular object only when we have determined that
5094 it is aapropriate. Do not create an .ARM.attributes section in
5095 output if there is no regular input object.
5096 (Target_arm::merge_processor_specific_flags): Check
5097 --warn-mismatch before printing any error.
5098 (Target_arm::merge_object_attributes): Ditto.
5099 * gold.cc (queue_middle_tasks): Handle the case in which there is
5100 no regular object in input.
5101 * options.cc (General_options::parse_EB): New method.
5102 (General_options::parse_EL): Same.
5103 (General_options::General_options): Initialize endianness_.
5104 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
5106 (General_options::Endianness): New enum.
5107 (General_options::endianness): New method.
5108 (General_options::endianness_): New data member.
5109 * parameters.cc (Parameters::set_options): Check target endianness.
5110 (Parameters::set_target_once): Ditto.
5111 (Parameters::check_target_endianness): New method.
5112 (parameters_force_valid_target): If either -EL or -EB is specified,
5113 use it to define endianness of default target.
5114 * parameters.h (Parameters::check_target_endianness): New method
5116 * target.h (class Target): Change "endianity" to "endianness"
5119 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5121 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
5122 * configure: Regenerate.
5123 * Makefile.in: Regenerate.
5124 * testsuite/Makefile.in: Regenerate.
5126 2010-04-06 Cary Coutant <ccoutant@google.com>
5129 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
5130 prevailing definitions of common symbols.
5131 * testsuite/plugin_test_6.sh: New test case.
5132 * testsuite/plugin_common_test_1.c: New test case.
5133 * testsuite/plugin_common_test_2.c: New test case.
5134 * testsuite/Makefile.am (plugin_test_6): New test case.
5135 * testsuite/Makefile.in: Regenerate.
5137 2010-04-06 Nick Clifton <nickc@redhat.com>
5139 * po/vi.po: New Vietnamese translation.
5141 2010-03-30 Doug Kwan <dougkwan@google.com>
5143 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
5145 2010-03-25 Doug Kwan <dougkwan@google.com>
5147 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
5148 to avoid a conversion warning on a 32-bit host.
5150 2010-03-24 Ian Lance Taylor <iant@google.com>
5152 * testsuite/script_test_3.t: Add a TLS segment.
5153 * testsuite/Makefile.am (check_PROGRAMS): Add
5154 tls_phdrs_script_test.
5155 (tls_phdrs_script_test_SOURCES): Define.
5156 (tls_phdrs_script_test_DEPENDENCIES): Define.
5157 (tls_phdrs_script_test_LDFLAGS): Define.
5158 (tls_phdrs_script_test_LDADD): Define.
5159 * testsuite/Makefile.in: Rebuild.
5161 2010-03-23 Cary Coutant <ccoutant@google.com>
5163 * fileread.cc (find_or_make_view): Fix comment.
5165 2010-03-23 Ian Lance Taylor <iant@google.com>
5167 * script-sections.cc (class Orphan_section_placement): Define
5168 PLACE_TLS and PLACE_TLS_BSS.
5169 (Orphan_section_placement::Orphan_section_placement): Initialize
5171 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
5172 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
5173 (tls_script_test_SOURCES): Define.
5174 (tls_script_test_DEPENDENCIES): Define.
5175 (tls_script_test_LDFLAGS): Define.
5176 (tls_script_test_LDADD): Define.
5177 * testsuite/Makefile.in: Rebuild.
5179 2010-03-22 Doug Kwan <dougkwan@google.com>
5181 * arm.cc (Arm_relocate_functions::abs8,
5182 Arm_relocate_functions::abs16): Use correct check for overflow
5183 specified in the ARM ELF specs.
5184 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
5185 target of a BLX instruction specially.
5186 (Reloc_stub::stub_type_for_reloc): Ditto.
5187 (Relocate::relocate): Use symbolic names instead of numeric relocation
5188 codes to report error.
5189 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
5191 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
5192 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
5193 thumb2_blx_out_of_range.stdout
5194 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
5195 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
5196 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
5197 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
5198 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
5199 thumb2_blx_in_range, thumb2_blx_in_range.o,
5200 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
5201 thumb2_blx_out_of_range.o): New rules.
5202 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
5203 thumb2_blx_in_range and thumb2_blx_out_of_range.
5204 * testsuite/Makefile.in: Regenerate.
5205 * arm_branch_in_range.sh: Add tests for THUMB BLX.
5206 * testsuite/thumb_blx_in_range.s: New file.
5207 * testsuite/thumb_blx_out_of_range.s: New file.
5209 2010-03-22 Rafael Espindola <espindola@google.com>
5211 * archive.cc (Should_include): Move to archive.h.
5212 (should_include_member): Make it a member of Archive.
5214 (Add_lib_group_symbols): New.
5215 * archive.h: Include options.h.
5216 (Archive_member): Moved from Archive.
5217 (Should_include): Moved from archive.cc.
5219 (Add_lib_group_symbols): New.
5220 * dynobj.cc (do_should_include_member): New.
5221 * dynobj.h (do_should_include_member): New.
5222 * gold.cc (queue_initial_tasks): Update call to queue.
5223 * main.cc (main): Print lib group stats.
5224 * object.cc (do_should_include_member): New.
5225 * object.h: Include archive.h.
5226 (Object::should_include_member): New.
5227 (Object::do_should_include_member): New.
5228 (Sized_relobj::do_should_include_member): New.
5229 * options.cc (General_options::parse_start_lib): New.
5230 (General_options::parse_end_lib): New.
5231 (Input_arguments::add_file): Handle lib groups.
5232 (Input_arguments::start_group): Check we are not in a lib.
5233 (Input_arguments::start_lib): New.
5234 (Input_arguments::end_lib): New.
5235 * options.h (General_options): Add start_lib and end_lib.
5236 (Input_argument::lib_): New.
5237 (Input_argument::lib): New.
5238 (Input_argument::is_lib): New.
5239 (Input_file_lib): New.
5240 (Input_arguments::in_lib_): New.
5241 (Input_arguments::in_lib): New.
5242 (Input_arguments::start_lib): New.
5243 (Input_arguments::end_lib_): New.
5244 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5245 in unused members as preempted.
5246 (Sized_pluginobj::do_should_include_member): New.
5247 * plugin.h (Sized_pluginobj::do_should_include_member): New.
5248 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5250 (Read_symbols::do_whole_lib_group): New.
5251 (Read_symbols::do_lib_group): New.
5252 (Read_symbols::do_read_symbols): Handle lib groups.
5253 (Read_symbols::get_name): Handle lib groups.
5254 * readsyms.h (Read_symbols): Add an archive member pointer.
5255 (Read_symbols::do_whole_lib_group): New.
5256 (Read_symbols::do_lib_group): New.
5257 (Read_symbols::member_): New.
5258 * script.cc (read_input_script): Update call to queue_soon.
5260 2010-03-19 Doug Kwan <dougkwan@google.com>
5262 * arm.cc (Stub_table::Stub_table): Initialize new data members
5263 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5264 (Stub_table::add_reloc_stub): Assign stub offset and update
5265 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5266 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
5268 (Stub_table::update_data_size_and_addralign): Use
5269 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
5270 instead of going over all reloc stubs.
5271 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
5272 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5273 Stringpool_template::offset_ to size of Stringpool_char.
5274 (Stringpool_template::new_key_offset): Remove code to initialize
5275 Stringpool_template::offset_.
5276 * stringpool.h (Stringpool_template::set_no_zero_null): Set
5277 Stringpool_template::offset_ to zero.
5279 2010-03-15 Doug Kwan <dougkwan@google.com>
5281 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5283 (Stringpool_template::new_key_offset): New method.
5284 (Stringpool_template::add_string): Assign offsets when adding new
5286 (Stringpool_template::set_string_offsets): Do not set string offsets
5287 when not optimizing.
5288 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5290 (Chunked_vector::clear): Clear size_.
5291 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5292 (Chunked_vector::size): Return size_.
5293 (Chunked_vector::push_back): Use size_ to find insert position.
5294 (Chunked_vector::size_): New data member.
5295 (Stringpool_template::set_no_zero_null): Assert string set is empty.
5296 (Stringpool_template::new_key_offset): New method declaration.
5297 (Stringpool_template::offset_): New data member.
5299 2010-03-15 Rafael Espindola <espindola@google.com>
5301 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
5302 Add_symbols' constructor.
5303 * readsyms.h (Add_symbols): Remove the input_group member.
5305 2010-03-10 Ian Lance Taylor <iant@google.com>
5307 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
5308 target to ask whether a reference to a symbol requires a stack
5310 * target.h (Target::is_call_to_non_split): New function.
5311 (Target::do_is_call_to_non_split): Declare virtual function.
5312 * target.cc: Include "symtab.h".
5313 (Target::do_is_call_to_non_split): New function.
5314 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
5316 2010-03-10 Cary Coutant <ccoutant@google.com>
5318 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
5319 (File_read::open[1]): Remove initial mapping of whole_file_view_.
5320 (File_read::open[2]): Add whole_file_view_ to list of views.
5321 (File_read::make_view): Remove test of whole_file_view_.
5322 (File_read::find_or_make_view): Create whole_file_view_ if
5324 (File_read::clear_views): Replace bool parameter with enum;
5325 adjust all callers. Don't delete views with permanent data;
5326 do delete cached views and views from archives if
5327 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
5328 if clearing the corresponding view.
5329 * fileread.h (File_read::Clear_views_mode): New enum.
5330 (File_read::View::is_permanent_view): New method.
5331 (File_read::clear_views): Replace bool parameter
5332 with enum; adjust all callers.
5333 * options.h (General_options): Change keep_files_mapped option;
5334 add map_whole_files.
5335 * readsyms.cc (Add_symbols::run): Delete sd_ object before
5337 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
5340 2010-03-10 David S. Miller <davem@davemloft.net>
5342 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
5344 2010-03-09 Sriraman Tallam <tmsriram@google.com>
5346 * icf.cc (get_section_contents): Add '@' marker after processing the
5349 2010-03-08 Doug Kwan <dougkwan@google.com>
5351 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
5352 due to a conversion warning.
5353 (Arm_relobj::update_output_local_symbol_count): Check for local
5354 symbol with unset output index.
5356 2010-03-05 Ian Lance Taylor <iant@google.com>
5358 * options.h (class General_options): Add --spare-dynamic-tags.
5359 * output.cc (Output_data_dynamic::set_final_data_size): Implement
5360 --spare-dynamic-tags.
5362 2010-03-05 Ian Lance Taylor <iant@google.com>
5364 * incremental.cc: Include "libiberty.h".
5366 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
5368 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
5369 function, is_info_ member.
5370 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
5371 (Versions::Versions): Update caller.
5372 (Versions::define_base_version): Likewise.
5373 (Versions::add_def): Likewise.
5375 2010-03-03 Sriraman Tallam <tmsriram@google.com>
5377 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
5378 (Scan::possible_function_pointer_reloc): New function.
5379 (Scan::local_reloc_may_be_function_pointer): Change to call
5380 possible_function_pointer_reloc.
5381 (Scan::global_reloc_may_be_function_pointer): Ditto.
5382 * icf.h (Icf::check_section_for_function_pointers): Change to reject
5383 relocations in ".data.rel.ro._ZTV" section.
5384 * testsuite/icf_safe_so_test.sh: Change to pass i386.
5385 * testsuite/icf_safe_so_test.cc: Ditto.
5386 * testsuite/icf_safe_test.cc: Ditto.
5387 * testsuite/icf_safe_test.sh: Ditto.
5389 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5390 Ian Lance Taylor <iant@google.com>
5392 * target-reloc.h (relocate_section): Check the symbol table index
5393 for -1U before setting the local symbol index.
5394 (scan_relocatable_relocs): If copying the relocation, record that
5395 the local symbol is required.
5396 * object.h (Symbol_value::is_output_symtab_index_set): New
5398 (Symbol_value::may_be_discarded_from_output_symtab): New
5400 (Symbol_value::has_output_symtab_entry): New function.
5401 (Symbol_value::needs_output_symtab_entry): Remove.
5402 (Symbol_value::output_symtab_index): Make sure the symbol index is
5404 (Symbol_value::set_output_symtab_index): Make sure the symbol
5405 index is not set. Make sure the new index is valid.
5406 (Symbol_value::set_must_have_output_symtab_entry): New function.
5407 (Symbol_value::has_output_dynsym_entry): New function.
5408 (Symbol_value::set_output_dynsym_index): Make sure the new index
5410 (Sized_relobj::set_must_have_output_symtab_entry): New function.
5411 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
5412 local symbol if permitted.
5413 (Sized_relobj::do_finalize_local_symbols): Call
5414 is_output_symtab_index_set rather than needs_output_symtab_entry.
5415 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
5416 rather than needs_output_symtab_entry. Call
5417 has_output_dynsym_entry rather than needs_output_dynsym_entry.
5418 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
5419 is_output_symtab_index_set rather than needs_output_symtab_entry.
5420 * testsuite/discard_locals_relocatable_test.c: New file.
5421 * testsuite/discard_locals_test.sh: Test -r.
5422 * testsuite/Makefile.am (check_DATA): Add
5423 discard_locals_relocatable_test1.syms,
5424 discard_local_relocatable_test2.syms.
5425 (MOSTLYCLEANFILES): Likewise. Also add
5426 discard_locals_relocatable_test1.lout and
5427 discard_locals_relocatable_test2.out.
5428 (discard_locals_relocatable_test1.syms): New target.
5429 (discard_locals_relocatable_test.o): New target.
5430 (discard_locals_relocatable_test1.out): New target.
5431 (discard_locals_relocatable_test2.syms): New target.
5432 (discard_locals_relocatable_test2.out): New target.
5433 (various): Add missing ../ld-new dependencies.
5434 * testsuite/Makefile.in: Rebuild.
5436 2010-03-03 Nick Clifton <nickc@redhat.com>
5438 * po/fi.po: New Finnish translation.
5440 2010-03-01 Doug Kwan <dougkwan@google.com>
5442 * layout.cc (Layout::Layout): Force section types of .init_array*,
5443 .preinit_array* and .fini_array* sections.
5444 * output.cc (Output_section::Input_section_sort_entry::has_priority):
5445 Fix check of return value of std::string::find.().
5446 (Output_section::Input_section_sort_compare::operator()): Remove
5447 comment about .init_array.
5448 (Output_section::Input_section_sort_init_fini_compare::operator()):
5450 (Output_section::sort_attached_input_sections): Handle .init_array
5451 and .fini_array specially.
5452 * output.h (Output_section::Inut_section_sort_compare): Update
5454 (Output_section::Input_section_sort_init_fini_compare): New struct.
5456 2010-02-26 Doug Kwan <dougkwan@google.com>
5458 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
5459 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
5460 * testsuite/debug_msg.sh: Avoid matching source line number for
5461 use of global variable undef_int.
5463 2010-02-26 Doug Kwan <dougkwan@google.com>
5465 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
5466 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
5467 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
5468 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
5469 * options.cc (General_options::General_options): Initialize member
5471 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
5472 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
5473 and rm_no_fix_v4bx.stdout
5474 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
5475 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
5476 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
5477 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
5478 and arm_no_fix_v4bx.
5479 * Makefile.in: Regenerate.
5480 * testsuite/arm_fix_v4bx.s: New file.
5481 * testsuite/arm_fix_v4bx.sh: Ditto.
5483 2010-02-24 Doug Kwan <dougkwan@google.com>
5485 * arm.cc (Target_arm::got_section): Make the .got section the first
5486 non RELRO section in the data segment.
5487 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
5488 suffixes of section names.
5490 2010-02-24 Doug Kwan <dougkwan@google.com>
5492 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
5493 flags and attributes merging if an input file is a binary file.
5494 * fileread.cc (Input_file::open): Record format of original file.
5495 * fileread.h (Input_file::Format): New enum type.
5496 (Input_file::Input_file): Initialize data member format_.
5497 (Input_file::format): New method definition.
5498 (Input_file::format_):: New data member.
5500 2010-02-24 Doug Kwan <dougkwan@google.com>
5502 * arm.cc (Arm_output_data_got): New class.
5503 (ARM_TCB_SIZE): New constant
5504 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
5505 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
5506 If user uses a script with a SECTIONS clause, issue only a warning
5507 for a misplaced EXIDX input section. Otherwise, issue an error.
5508 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
5510 (Target_arm::got_mode_index_entry): Handle static linking.
5511 (Target_arm::Scan::local): Ditto.
5512 (Target_arm::Scan::global): Ditto.
5513 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
5514 all incorrectly implemented relocations.
5515 (Target_arm::fix_exidx_coverage): Pass layout to
5516 Arm_output_section::fix_exidx_coverage.
5517 * layout.cc (Layout::section_name_mapping): Remove trailing dots
5518 from ".ARM.exidx." and ".ARM.extab.".
5520 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5522 * arm.cc (Target_arm::do_finalize_sections): Create attribute
5523 section if it does not already exist.
5524 * attributes.cc (Attributes_section_data::Attributes_section_data):
5525 Don't crash if size is zero.
5527 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5528 Ian Lance Taylor <iant@google.com>
5530 * gold.cc (queue_middle_tasks): If no input files were opened,
5532 * workqueue.h (Task_function::Task_function): Assert that there is
5535 2010-02-22 Doug Kwan <dougkwan@google.com>
5537 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
5538 * icf.cc (get_section_contents): Cast snprintf arguments to long long
5539 types to avoid warnings due to different uint64_t implementations
5542 2010-02-21 Doug Kwan <dougkwan@google.com>
5544 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
5545 handling of the maximum backward branch offset.
5546 (Arm_relocate_functions::thumb_branch_common): Ditto.
5547 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
5548 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
5549 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
5550 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
5551 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
5552 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
5553 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
5554 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
5555 thumb_bl_out_of_range thumb_bl_out_of_range.o,
5556 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
5557 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
5558 thumb2_bl_out_of_range.o): New rules.
5559 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
5560 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
5561 thumb2_bl_out_of_range
5562 * testsuite/Makefile.in: Regenerate.
5563 * testsuite/arm_bl_in_range.s: New file.
5564 * testsuite/arm_bl_out_of_range.s: Ditto.
5565 * testsuite/arm_branch_in_range.sh: Ditto.
5566 * testsuite/arm_branch_range.t: Ditto.
5567 * testsuite/thumb2_branch_range.t: Ditto.
5568 * testsuite/thumb_bl_in_range.s: Ditto.
5569 * testsuite/thumb_bl_out_of_range.s: Ditto.
5570 * testsuite/thumb_branch_range.t: Ditto.
5572 2010-02-20 Sriraman Tallam <tmsriram@google.com>
5574 * gc.h (gc_process_relocs): Change vectors to point to the new list.
5575 Add reloc offset information.
5576 * icf.cc (get_section_contents): Change iterators to point to the new
5577 vectors. Add reloc offset information to the contents.
5578 * icf.h (Icf::Sections_reachable_info): New typedef.
5579 (Icf::Sections_reachable_list): New typedef.
5580 (Icf::Offset_info): New typedef.
5581 (Icf::Reloc_info): New struct typedef.
5582 (Icf::Reloc_info_list): New typedef.
5583 (Icf::symbol_reloc_list): Delete method.
5584 (Icf::addend_reloc_list): Delete method.
5585 (Icf::section_reloc_list): Delete method.
5586 (Icf::reloc_info_list): New method.
5587 (Icf::reloc_info_list_): New member.
5589 2010-02-19 Doug Kwan <dougkwan@google.com>
5591 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
5592 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
5593 * arm.cc (Arm_relocation_functions): New forward declaration.
5594 (Target_arm::Target_arm): Initialize new data members
5595 got_mod_index_offset_ and tls_base_symbol_defined_.
5596 (Target_arm::Relocate::relocate_tls): New method.
5597 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
5598 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
5600 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
5601 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
5602 (Target_arm::got_mod_index_offset_,
5603 Target_arm::tls_base_symbol_defined_): New data members.
5604 (Target_arm::Scan::local, Target::Scan::global,
5605 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
5608 2010-02-18 Doug Kwan <dougkwan@google.com>
5610 * arm.cc (Arm_relobj::find_linked_text_section): New method.
5611 (Arm_relobj::make_exidx_input_section): Pass section index of linked
5612 text section as a parameter becuase some broken tools may not set
5613 the link in section header.
5614 (Target_arm::has_got_section): New method.
5615 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
5616 without any mapping symbol as data only. Remove warning.
5617 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
5618 link in its section header, try to discover the link by inspecting the
5619 REL31 relocation at the beginning of the section.
5620 (Target_arm::Scan::check_non_pic): Report name of offending relocation
5622 (Target_arm::Scan::global): Treat any reference to the symbol
5623 _GLOBAL_OFFSET_TABLE_ as a GOT access.
5625 2010-02-12 Sriraman Tallam <tmsriram@google.com>
5627 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
5628 (Scan::global_reloc_may_be_function_pointer): New function.
5629 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5630 (Scan::global_reloc_may_be_function_pointer): New function.
5631 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5632 (Scan::global_reloc_may_be_function_pointer): New function.
5633 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
5634 (Scan::global_reloc_may_be_function_pointer): New function.
5635 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
5636 (Scan::global_reloc_may_be_function_pointer): New function.
5637 (Scan::possible_function_pointer_reloc): New function.
5638 (Target_x86_64::can_check_for_function_pointers): New function.
5639 * gc.h (gc_process_relocs): Scan relocation types to determine if
5640 function pointers were taken for targets that support it.
5641 * icf.cc (Icf::find_identical_sections): Include functions for
5642 folding in safe ICF whose pointer is not taken.
5643 * icf.h (Secn_fptr_taken_set): New typedef.
5644 (fptr_section_id_): New member.
5645 (section_has_function_pointers): New function.
5646 (set_section_has_function_pointers): New function.
5647 (check_section_for_function_pointers): New function.
5648 * options.h: Fix comment for safe ICF option.
5649 * target.h (can_check_for_function_pointers): New function.
5650 * testsuite/Makefile.am: Add icf_safe_so_test test case.
5651 Modify icf_safe_test for X86-64.
5652 * testsuite/Makefile.in: Regenerate.
5653 * testsuite/icf_safe_so_test.cc: New file.
5654 * testsuite/icf_safe_so_test.sh: New file.
5655 * testsuite/icf_safe_test.cc (kept_func_3): New function.
5656 (main): Change to take pointer to function kept_func_3.
5657 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
5658 folding is done correctly for X86-64.
5660 2010-02-12 David S. Miller <davem@davemloft.net>
5662 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
5663 is_symbolless parameter.
5664 (Output_reloc<SHT_REL>::is_symbolless): New.
5665 (Output_reloc<SHT_REL>::is_symbolless_): New.
5666 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
5667 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
5668 (Output_reloc<SHT_RELA>::is_symbolless): New.
5669 (Output_data_reloc::add_global): Handle is_symbolless.
5670 (Output_data_reloc::add_global_relative): Likewise.
5671 (Output_data_reloc::add_local): Likewise.
5672 (Output_data_reloc::add_local_relative): Likewise.
5673 (Output_data_reloc::add_symbolless_global_addend): New.
5674 (Output_data_reloc::add_symbolless_local_addend): New.
5675 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
5677 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
5678 instead of ->is_relative_
5679 (Output_reloc::write): Likewise.
5680 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
5681 (Output_reloc::write_rel): Simplify.
5683 * sparc.cc (Target_sparc::Scan::local): Use
5684 ->add_symbolless_local_addend as needed.
5685 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
5686 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
5687 based upon relocation offset.
5689 2010-02-11 Doug Kwan <dougkwan@google.com>
5691 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
5692 (Target_arm::Scan::global): Ditto. Also remove a comment before the
5693 beginning of function.
5694 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
5695 and MOVT_ABS relocations. Those are non issued in scanning. Fix
5696 parameter is_32bit in calls to should_apply_static_reloc.
5697 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
5698 (check_DATA): Add arm_abs_global.stdout.
5699 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
5700 arm_abs_global.stdout): New rules.
5701 (MOSTLLYCLEANFILES): Add arm_abs_global
5702 * Makefile.in: Regenerate.
5703 * testsuite/arm_abs_global.s: New file.
5704 * testsuite/arm_abs_global.sh: Ditto.
5705 * testsuite/arm_abs_lib.s: Ditto.
5707 2010-02-11 Ian Lance Taylor <iant@google.com>
5709 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
5711 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
5712 Allocate_commons_task first.
5713 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
5714 task, rather than symtab_lock_.
5715 (Gc_process_relocs::~Gc_process_relocs): New function.
5716 (Gc_process_relocs::is_runnable): Check this_blocker_.
5717 (Gc_process_relocs::locks): Use next_blocker_ rather than
5719 (Scan_relocs::~Scan_relocs): New function.
5720 (Scan_relocs::is_runnable): Check this_blocker_ rather than
5722 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
5724 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
5725 fields. Add this_blocker_ and next_blocker_ fields. Adjust
5726 constructor accordingly.
5727 (class Gc_process_relocs): Likewise.
5728 (class Scan_relocs): Likewise.
5729 * common.h (class Allocate_commons_task): Remove symtab_lock_
5730 field, and corresponding constructor parameter.
5731 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
5733 (Allocate_commons_task::locks): Likewise.
5735 2010-02-11 Ian Lance Taylor <iant@google.com>
5737 * gold-threads.h (class Once): Define.
5738 (class Initialize_lock): Rewrite as child of Once.
5739 * gold-threads.cc (class Once_initialize): Define.
5740 (once_pointer_control): New static variable.
5741 (once_pointer, once_arg): New static variables.
5742 (c_run_once): New static function.
5743 (Once::Once, Once::run_once, Once::internal_run): New functions.
5744 (class Initialize_lock_once): Remove.
5745 (initialize_lock_control): Remove.
5746 (initialize_lock_pointer): Remove.
5747 (initialize_lock_once): Remove.
5748 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
5749 (Initialize_lock::initialize): Rewrite.
5750 (Initialize_lock::do_run_once): New function.
5751 * archive.cc (Archive::interpret_header): Only clear name if it is
5753 * fileread.cc: Include "gold-threads.h"
5754 (file_counts_lock): New static variable.
5755 (file_counts_initialize_lock): Likewise.
5756 (File_read::release): Only increment counts when using --stats.
5757 Use a lock around the increment.
5758 * parameters.cc (class Set_parameters_target_once): Define.
5759 (set_parameters_target_once): New static variable.
5760 (Parameters::Parameters): Move here from parameters.h.
5761 (Parameters::set_target): Rewrite.
5762 (Parameters::set_target_once): New function.
5763 (Parameters::clear_target): Move here and rewrite.
5764 * parameters.h (class Parameters): Update declarations. Add
5765 set_parameters_target_once_ field.
5766 (Parameters::Parameters): Move to parameters.cc.
5767 (Parameters::clear_target): Likewise.
5768 * readsyms.cc (Read_symbols::do_group): Create a Start_group
5770 (Start_group::~Start_group): New function.
5771 (Start_group::is_runnable): New function.
5772 (Start_group::locks, Start_group::run): New functions.
5773 (Finish_group::run): Change saw_undefined to size_t.
5774 * readsyms.h (class Start_group): Define.
5775 (class Finish_group): Change saw_undefined_ field to size_t.
5776 (Finish_group::Finish_group): Remove saw_undefined and
5777 this_blocker parameters. Change all callers.
5778 (Finish_group::set_saw_undefined): New function.
5779 (Finish_group::set_blocker): New function.
5780 * symtab.h (class Symbol_table): Change saw_undefined to return
5781 size_t. Change saw_undefined_ field to size_t.
5782 * target-select.cc (Set_target_once::do_run_once): New function.
5783 (Target_selector::Target_selector): Initialize set_target_once_
5784 field. Don't initialize lock_ and initialize_lock_ fields.
5785 (Target_selector::instantiate_target): Rewrite.
5786 (Target_selector::set_target): New function.
5787 * target-select.h (class Set_target_once): Define.
5788 (class Target_selector): Update declarations. Make
5789 Set_target_once a friend. Remove lock_ and initialize_lock_
5790 fields. Add set_target_once_ field.
5792 2010-02-10 Ian Lance Taylor <iant@google.com>
5794 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
5796 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
5797 (queue_middle_tasks): Add all blockers before queueing any tasks.
5798 (queue_final_tasks): Likewise.
5799 * token.h (Task_token::add_blockers): New function.
5800 * object.h (Input_objects::number_of_relobjs): New function.
5802 2010-02-10 Ian Lance Taylor <iant@google.com>
5804 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
5805 shared, not if not position independent.
5806 * x86_64.cc (Relocate::relocate_tls): Likewise.
5807 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
5808 (tls_pie_pic_test): New target.
5809 * testsuite/Makefile.in: Rebuild.
5811 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
5812 (tls_test_main_pie.o, tls_test_pie.o): New targets.
5813 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
5814 * testsuite/Makefile.in: Rebuild.
5816 2010-02-09 David S. Miller <davem@davemloft.net>
5818 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
5819 R_SPARC_RELATIVE using ->add_local_relative().
5820 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
5822 * output.h (Output_data_dynamic::add_section_size): New method
5823 that takes two Output_data objects.
5824 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
5825 entry param. Handle it in initializers.
5826 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
5827 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
5828 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
5830 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
5831 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
5832 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
5833 for dynrel_includes_plt.
5834 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5835 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5836 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
5838 (Target_sparc::do_finalize_sections): Update to pass true for
5839 dynrel_includes_plt.
5840 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
5841 output before .rela.plt
5842 (Target_powerpc::do_finalize_sections): Update to pass true for
5843 dynrel_includes_plt when 32-bit.
5845 2010-02-08 Doug Kwan <dougkwan@google.com>
5847 * arm.cc (Arm_relobj::simple_input_section_output_address): New
5849 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
5850 Arm_relobj::scan_section_for_cortex_a8_stubs,
5851 Arm_relobj::do_relocation_section): Instead of calling
5852 Output_section::output_address, use faster
5853 Arm_relobj::simple_input_section_output_address.
5855 2010-02-08 David S. Miller <davem@davemloft.net>
5857 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
5858 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
5859 relocation helper function.
5861 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
5862 just like R_SPARC_GOT{10,13,22}.
5863 (Target_sparc::Scan::local): Likewise.
5864 (Target_sparc::Relocate:relocate): Likewise.
5866 2010-02-06 Ian Lance Taylor <iant@google.com>
5868 * configure.ac: Rewrite targetobjs duplicate removal code to use
5869 only shell constructs.
5870 * configure: Rebuild.
5872 2010-02-05 Doug Kwan <dougkwan@google.com>
5875 * arm.cc (Arm_relobj::section_is_scannable): New method.
5876 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
5877 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
5879 2010-02-04 Doug Kwan <dougkwan@google.com>
5882 * arm-reloc-property.cc (cstdio): Include.
5883 * configure.ac (targetobjs): Remove duplicates.
5884 * configure: Regenerate.
5885 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
5886 big and little endian version for a given address size.
5888 2010-02-03 Doug Kwan <dougkwan@google.com>
5890 * arm-reloc-property.cc
5891 (Arm_reloc_property_table::reloc_name_in_error_message): New method
5893 * arm-reloc-property.h
5894 (Arm_reloc_property_table::get_implemented_static_reloc_property):
5895 New method definition.
5896 (Arm_reloc_property_table::reloc_name_in_error_message): New method
5898 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
5900 (GOT_PREL): Change implemented to Y.
5901 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
5902 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
5903 (Arm_relocate_functions::movw_abs_nc): Remove method.
5904 (Arm_relocate_functions::movt_abs): Ditto.
5905 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
5906 (Arm_relocate_functions::thm_movt_abs): Ditto.
5907 (Arm_relocate_functions::movw_rel_nc): Ditto.
5908 (Arm_relocate_functions::movw_rel): Ditto.
5909 (Arm_relocate_functions::movt_rel): Ditto.
5910 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
5911 (Arm_relocate_functions:thm_movw_rel): Ditto.
5912 (Arm_relocate_functions:thm_movt_rel): Ditto.
5913 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
5914 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
5915 New method definitions.
5916 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
5917 (Arm_relocation_functions::arm_grp_ldr): Ditto.
5918 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
5919 (Arm_relocation_functions::arm_grp_ldc): Ditto.
5920 (Target_arm::Relocate::relocate): Check for non-static or
5921 unimplemented relocation code and exit early. Change calls to
5922 Target_arm::reloc_uses_thumb_bit and
5923 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
5924 instead. Refactor code to handle similar relocations to increase
5925 code sharing. Remove check for unsupported relocation code in switch
5927 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
5928 relocation property table to find out size. Change error message to
5929 print out the name of a relocation code instead of the numeric value.
5930 (Target_arm::scan_reloc_for_stub): Use relocation property table
5931 instead of calling Target_arm::reloc_uses_thumb_bit().
5933 2010-02-02 Doug Kwan <dougkwan@google.com>
5935 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
5936 types of relaxed input section.
5938 2010-02-02 Doug Kwan <dougkwan@google.com>
5940 * Makefile.am (HFILES): Add arm-reloc-property.h.
5942 (TARGETSOURCES): Add arm-reloc-property.cc
5943 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
5944 (libgold_a_SOURCES): $(DEFFILES)
5945 * Makefile.in: Regenerate.
5946 * arm-reloc-property.cc: New file.
5947 * arm-reloc-property.h: New file.
5948 * arm-reloc.def: New file.
5949 * arm.cc: Update comments.
5950 (arm-reloc-property.h): New included header.
5951 (arm_reloc_property_table): New global variable.
5952 (Target_arm::do_select_as_default_target): New method definition.
5953 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
5954 arm-reloc-property to targ_extra_obj.
5955 * parameters.cc (set_parameters_target): Call
5956 Target::select_as_default_target().
5957 * target.h (Target::select_as_default_target): New method definition.
5958 (Target::do_select_as_default_target): Same.
5960 2010-02-01 Doug Kwan <dougkwan@google.com>
5962 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
5963 first_output_text_section_.
5964 (Arm_exidx_fixup::first_output_text_section): New method definition.
5965 (Arm_exidx_fixup::first_output_text_section_): New data member.
5966 (Arm_exidx_fixup::process_exidx_section): Record the first text
5967 output section seen.
5968 (Arm_output_section::fix_exidx_coverage): Set correct linked section
5969 and entsize in output section header.
5971 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5973 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
5974 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
5975 (Arm_relocate_functions::thm_alu11): New Method.
5976 (Arm_relocate_functions::thm_pc8): New Method.
5977 (Arm_relocate_functions::thm_pc12): New Method.
5978 (Target_arm::Scan::local): Handle the relocations.
5979 (Target_arm::Scan::global): Likewise.
5980 (Target_arm::Relocate::relocate): Likewise.
5981 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
5983 2010-01-29 Doug Kwan <dougkwan@google.com>
5985 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
5986 of relocation types as ld.
5988 2010-01-29 Doug Kwan <dougkwan@google.com>
5990 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
5992 (Arm_relocate_functions::thumb_branch_common): Ditto.
5993 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
5994 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
5995 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
5996 Arm_relocate_functions::jump24): Remove.
5997 (Target_arm::Relocate::relocate): Adjust code to call
5998 Arm_relocation_functions::arm_branch_common and
5999 Arm_relocation_functions::thumb_branch_common instead of their removed
6000 wrappers. Merge switch-cases together to reduce source code size.
6002 2010-01-29 Doug Kwan <dougkwan@google.com>
6004 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
6005 output_local_symbol_count_needs_update_.
6006 (Arm_relobj::output_local_symbol_count_needs_update,
6007 Arm_relobj::set_output_local_symbol_count_needs_update,
6008 Arm_relobj::update_output_local_symbol_count): New methods.
6009 (Arm_relobj::output_local_symbol_count_needs_update_): New data
6011 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
6012 of pointed function as in a R_ARM_PREL31 relocation.
6013 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
6014 for output local symbol count updating.
6015 (Target_arm::do_relax): Update output local symbol counts in objects
6017 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
6019 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6021 * arm.cc: Added support for the ARM relocations:
6022 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
6023 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
6024 (Arm_relocate_functions::movw_rel_nc): Renamed (was
6026 (Arm_relocate_functions::movw_rel): New method.
6027 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
6028 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
6030 (Arm_relocate_functions::thm_movw_rel): New method.
6031 (Arm_relocate_functions::thm_movt_rel): Renamed (was
6033 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
6035 (Target_arm::Scan::global): Likewise.
6036 (Target_arm::Relocate::relocate): Likewise.
6037 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6040 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6042 * arm.cc: Added support for ARM group relocations.
6043 (Target_arm::reloc_needs_sym_origin): New method.
6044 (Arm_relocate_functions::calc_grp_kn): New method.
6045 (Arm_relocate_functions::calc_grp_residual): New method.
6046 (Arm_relocate_functions::calc_grp_gn): New method.
6047 (Arm_relocate_functions::arm_grp_alu): New Method.
6048 (Arm_relocate_functions::arm_grp_ldr): New Method.
6049 (Arm_relocate_functions::arm_grp_ldrs): New Method.
6050 (Arm_relocate_functions::arm_grp_ldc): New Method.
6051 (Target_arm::Scan::local): Handle the ARM group relocations.
6052 (Target_arm::Scan::global): Likewise.
6053 (Target_arm::Relocate::relocate): Likewise.
6054 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6057 2010-01-26 Doug Kwan <dougkwan@google.com>
6059 * arm.cc (set): Include.
6060 (class Arm_exidx_fixup): Change type of last_input_section_ to const
6062 (Arm_output_section::Text_section_list): New type.
6063 (Arm_output_section::append_text_sections_to_list): New method.
6064 (Arm_output_section::fix_exidx_coverage): Ditto.
6065 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
6066 (Arm_relobj::convert_input_section_to_relaxed_section): Use
6067 Relobj::set_section_offset() instead of
6068 Sized_relobj::invalidate_section_offset().
6069 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
6070 parameter for section headers. Ignore relocation sections for
6071 unallocated sections and EXIDX sections.
6072 (Target_arm::fix_exidx_coverage): New method.
6073 (Target_arm::output_section_address_less_than): New type.
6074 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
6075 linked text section instead of the EXIDX section.
6076 (Arm_output_section::create_stub_group): Add an assertion to check
6077 that this is not an EXIDX output section.
6078 (Arm_output_section::append_text_sections_to_list): New method.
6079 (Arm_output_section::fix_exidx_coverage): Ditto.
6080 (Arm_relobj::scan_sections_for_stubs): Adjust call to
6081 Arm_relobj::section_needs_reloc_stub_scanning.
6082 (Target_arm::do_relax): Fix EXIDX output section coverage in the
6084 (Target_arm::fix_exidx_coverage): New method.
6085 * object.h (Relobj::set_output_section): New method.
6086 (Sized_relobj::invalidate_section_offset): Remove method.
6087 (Sized_relobj::do_invalidate_section_offset): Remove method.
6088 (Sized_relobj::do_set_section_offset): Handle offset value -1.
6090 2010-01-25 Doug Kwan <dougkwan@google.com>
6092 * arm.cc (Arm_exidx_merged_section::do_output_offset):
6093 Fix warning due to signed and unsigned comparison on a 32-bit host.
6095 2010-01-22 Doug Kwan <dougkwan@google.com>
6097 * arm.cc (Target_arm::do_relax): Record an output section for section
6098 offset adjustment it contains any stub table that has changed.
6099 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
6100 offsets in an output section if necessary.
6101 * output.cc (Output_section::Output_section): Initialize
6102 section_offsets_need_adjustments_.
6103 (Output_section::add_input_section_for_script): Renamed to
6104 Output_section::add_simple_input_section.
6105 (Output_section::save_states): Add a comment.
6106 (Output_section::discard_states): New method defintion.
6107 (Output_section::adjust_section_offsets): Same.
6108 * output.h (Output_section::add_input_section_for_script): Renamed to
6109 Output_section::add_simple_input_section.
6110 (Output_section::discard_states): New method declaration.
6111 (Output_section::adjust_section_offsets): Same.
6112 (Output_section::section_offsets_need_adjustment,
6113 Output_section::set_section_offsets_need_adjustment): New method
6115 (Output_section::section_offsets_need_adjustment_): New data member.
6116 * script-sections.cc
6117 (Output_section_element_input::set_section_address): Adjust code for
6118 renaming of Output_section::add_input_section_for_script.
6119 (Orphan_output_section::set_section_address): Same.
6121 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6123 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
6124 Fix_v4bx enum values .
6125 * gold/options.h (General_options): New option definitions.
6126 (General_options::fix_v4bx): New method.
6127 (General_options::Fix_v4bx): New enum.
6128 * gold/options.cc (General_options::parse_fix_v4bx): New method.
6129 (General_options::parse_fix_v4bx_interworking): New method.
6131 2010-01-22 Doug Kwan <dougkwan@google.com>
6133 * arm.cc (Arm_exidx_fixup): New class.
6135 2010-01-21 Doug Kwan <dougkwan@google.com>
6137 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
6139 (Arm_exidx_section_offset_map): New type.
6141 2010-01-21 Doug Kwan <dougkwan@google.com>
6143 * arm.cc (Arm_exidx_input_section): New class.
6144 (Arm_relobj::exidx_input_section_by_link,
6145 Arm_relobj::exidx_input_section_by_shndx,
6146 Arm_relobj::make_exidx_input_section): New methods.
6147 (read_arm_attributes_section): Remove.
6148 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
6149 information about them.
6150 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
6153 2010-01-20 Doug Kwan <dougkwan@google.com>
6155 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
6156 Input_section_specifier to Section_id.
6157 (Target_arm::new_arm_input_section: Adjust code for change of key
6159 (Target_arm::find_arm_input_section): Ditto.
6160 * gc.h (object.h): Include for Section_id nand Section_id_hash.
6161 (Section_id): Remove.
6162 (Garbage_collection::Section_id_hash): Remove.
6163 * icf.h (object.h): Include for Section_id nand Section_id_hash.
6164 (Section_id): Remove.
6165 (Icf::Section_id_hash): Remove.
6166 * object.h (Section_id, Const_section_id, Section_id_hash,
6167 Const_section_id_hash): New type definitions.
6168 * output.cc (Output_section::add_relaxed_input_section): Change to
6169 use Const_section_id instead of Input_section_specifier as key type.
6170 (Output_section::add_merge_input_section): Ditto.
6171 (Output_section::build_relaxation_map): Change to use Section_id
6172 instead of Input_section_specifier as key type.
6173 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6175 (Output_section::convert_input_sections_to_relaxed_sections): Change
6176 to use Const_section_id instead of Input_section_specifier as key type.
6177 (Output_section::find_merge_section): Ditto.
6178 (Output_section::find_relaxed_input_section): Ditto.
6179 * output.h (Input_section_specifier): Remove class.
6180 (Output_section::Output_section_data_by_input_section_map): Change
6181 key type to Const_section_id.
6182 (Output_section::Output_relaxed_input_section_by_input_section_map):
6184 (Output_section::Relaxation_map): Change key type to Section_id.
6186 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6188 * gold/arm.cc: Added support for R_ARM_V4BX relocation
6189 (class Arm_v4bx_stub): New class.
6190 (DEF_STUBS): Updated definition to support v4_veneer_bx.
6191 (Stub_factory::make_arm_v4bx_stub): New method.
6192 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
6193 (Stub_table::empty): Handle v4bx stubs.
6194 (Stub_table::add_arm_v4bx_stub): New method.
6195 (Stub_table::find_arm_v4bx_stub): New method.
6196 (Arm_relocate_functions::v4bx): New method.
6197 (Target_arm::fix_v4bx): New method.
6198 (Target_arm::Target_arm): Handle R_ARM_V4BX.
6199 (Stub_table::relocate_stubs): Likewise.
6200 (Stub_table::do_write): Likewise.
6201 (Stub_table::update_data_size_and_addralign): Likewise.
6202 (Stub_table::finalize_stubs): Likewise.
6203 (Target_arm::Scan::local): Likewise.
6204 (Target_arm::Scan::global): Likewise.
6205 (Target_arm::do_finalize_sections): Likewise.
6206 (Target_arm::Relocate::relocate): Likewise.
6207 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6209 (Target_arm::scan_reloc_for_stub): Likewise.
6210 (Target_arm::scan_reloc_section_for_stubs): Likewise.
6212 2010-01-19 Ian Lance Taylor <iant@google.com>
6214 * output.cc (Output_section_headers::do_sized_write): Write large
6215 segment count to sh_info field.
6216 (Output_file_header::do_sized_write): For large segment count,
6217 write PN_XNUM to e_phnum field.
6219 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6221 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
6222 (Arm_relocate_functions::thm_jump8): New function.
6223 (Arm_relocate_functions::thm_jump11): New function.
6224 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
6226 (Target_arm::Scan::global): Likewise.
6227 (Target_arm::Relocate::relocate): Likewise.
6228 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6231 2010-01-14 Doug Kwan <dougkwan@google.com>
6233 * arm.cc (map, utility): Include headers.
6234 (Target_arm::apply_cortex_a8_workaround): New method.
6235 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
6236 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
6237 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
6238 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
6239 the --[no-]fix-cortex-a8 command line options.
6240 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
6241 (Target_arm::relocate_stub): Use addend in instruction template.
6242 * options.h (DEFINE_bool): Set the user-set flag.
6243 (General_options): Add --[no-]-fix-cortex options.
6244 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
6245 : Update fast look-up map after conversion.
6247 2010-01-14 Sriraman Tallam <tmsriram@google.com>
6249 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6250 in the first pass of do_layout.
6252 2010-01-13 Doug Kwan <dougkwan@google.com>
6254 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6255 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6256 apparent compiler problem of not folding static constant integral
6257 data members of elfcpp::Elf_sizes<32>.
6259 2010-01-13 Doug Kwan <dougkwan@google.com>
6261 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6262 Arm_relobj::section_needs_cortex_a8_stub_scanning,
6263 Arm_relobj::scan_section_for_cortex_a8_erratum,
6264 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
6265 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
6266 sections to scan for relocation stubs into a new method
6267 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
6268 relocation and Cortex-A8 stub scanning.
6269 (Target_arm::do_relax): Force stubs to be after stubbed sections
6270 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
6271 the beginning of a new relaxation pass. Update a comment.
6272 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
6274 2010-01-12 Ian Lance Taylor <iant@google.com>
6276 * target-reloc.h (visibility_error): New inline function.
6277 (relocate_section): Call visibility_error.
6278 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6279 (MOSTLYCLEANFILES): Likewise.
6280 (protected_4_pic.o, protected_3.err): New targets.
6281 * testsuite/protected_4.cc: New file.
6283 2010-01-12 Doug Kwan <dougkwan@google.com>
6285 * arm.cc (Cortex_a8_reloc): New class.
6286 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6287 and cortex_a8_relocs_info_.
6288 (Target_arm::fix_cortex_a8): New method definition.
6289 (Target_arm::Cortex_a8_relocs_info): New type.
6290 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6291 New data member declarations.
6292 (Target_arm::scan_reloc_for_stub): Record information about
6293 relocations for THUMB branches that might be exempted from the
6294 Cortex-A8 workaround.
6295 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
6296 at the beginning of a relaxation pass.
6298 2010-01-12 Doug Kwan <dougkwan@google.com>
6300 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
6301 (Arm_relobj::Mapping_symbol_position,
6302 Arm_reloj::Mapping_symbol_position_less,
6303 Arm_relobj::Mapping_symbols_info): New types.
6304 (Target_arm::is_mapping_symbol_name): New method definition.
6305 (Arm_relobj::do_count_local_symbols): Save information about mapping
6308 2010-01-11 Doug Kwan <dougkwan@google.com>
6310 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
6311 Arm_relocate_functions::thumb32_branch_upper,
6312 Arm_relocate_functions::thumb32_branch_lower,
6313 Arm_relocate_functions::thumb32_cond_branch_offset,
6314 Arm_relocate_functions::thumb32_cond_branch_upper,
6315 Arm_relocate_functions::thumb32_cond_branch_lower,
6316 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
6317 branch offset encoding.
6318 (Arm_relocate_functions::thumb_branch_common): Use new branch
6319 offset encoding methods to avoid code duplication.
6320 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
6321 (Stub_addend_reader::operator()): Use new branch encoding method
6322 to avoid code duplication.
6324 2010-01-11 Doug Kwan <dougkwan@google.com>
6326 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
6327 (Target_arm::do_finalize_sections): Define special EXIDX section
6328 symbols only if referenced.
6329 * gc.h (Garbage_collection::add_reference): New method.
6330 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
6333 2010-01-11 Ian Lance Taylor <iant@google.com>
6335 * script.cc (Version_script_info::build_expression_list_lookup):
6336 Change complaing about duplicate wildcard match from error to
6339 * script.cc (class Lazy_demangler): Recreate--revert part of patch
6341 (Version_script_info::Version_script_info): Initialize globs_,
6342 default_version_, default_is_global_, and exact_. Don't
6343 initialize globals_ or locals_.
6344 (Version_script_info::build_lookup_tables): Build local symbols
6346 (Version_script_info::unquote): New function.
6347 (Version_script_info::add_exact_match): New function.
6348 (Version_script_info::build_expression_list_lookup): Remove lookup
6349 parameter. Add is_global parameter. Change all callers. Handle
6350 wildcard pattern specially. Unquote pattern. Call
6352 (Version_script_info::get_name_to_match): New function.
6353 (Version_script_info::get_symbol_version): New function.
6354 (Version_script_info::get_symbol_version_helper): Remove.
6355 (Version_script_info::check_unmatched_names): Call unquote.
6356 * script.h (class Version_script_info): Change get_symbol_version
6357 to be non-inline and add is_global parameter; change all callers.
6358 Rewrite symbol_is_local. Update declarations. Define struct
6359 Version_tree_match, Exact, Globs. Don't define struct Lookup.
6360 Remove globals_ and locals_ members. Add exact_, globs_,
6361 default_version_, is_global_.
6362 (Version_script_info::Glob): Remove pattern, add expression and
6363 is_global. Update constructor. Change all callers.
6364 * dynobj.cc (Versions::finalize): Mark the version symbol as the
6366 (Versions::symbol_section_contents): If a symbol is undefined, or
6367 defined in a dynamic object, set the version index to
6369 * symtab.cc (Symbol_table::add_from_relobj): Don't call
6371 (Symbol_table::add_from_pluginobj): Likewise.
6372 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
6374 2010-01-11 Doug Kwan <dougkwan@google.com>
6376 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
6377 (incremental_dump_LDADD): Add linking option for libintl.
6378 * Makefile.in: Regenerate.
6380 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
6383 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
6385 * testsuite/Makefile.in: Regenerated.
6387 2010-01-10 Doug Kwan <dougkwan@google.com>
6389 * options.h (DEFINE_var): Use parentheses around argument varname__
6390 in macro body to avoid any unintended subsequent substitutions.
6392 2010-01-10 Ian Lance Taylor <iant@google.com>
6394 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
6395 candidates before doing symbol resolution.
6397 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
6398 ODR candidates if only one is weak.
6400 2010-01-08 Ian Lance Taylor <iant@google.com>
6402 * script.cc (Version_script_info::build_expression_list_lookup):
6403 Don't warn about ambiguous version, just record the ambiguity.
6404 (Version_script_info::get_symbol_version_helper): Give error if
6405 version is ambiguous.
6407 2010-01-08 Doug Kwan <dougkwan@google.com>
6409 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
6410 prev_data_size_ and prev_addralign_. Remove initializer for
6411 deleted data member has_been_changed_.
6412 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
6413 to determine if the table is empty.
6414 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
6416 (Stub_table::add_reloc_stub): Define method in class definition
6417 instead of just declaring it there.
6418 (Stub_table::add_cortex_a8_stub): New method definition.
6419 (Stub_table::update_data_size_and_addralign): Ditto.
6420 (Stub_table::finalize_stubs): Ditto.
6421 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
6422 (Stub_table::do_addralign_): Return address alignment in the
6423 (Stub_table::do_reset_address_and_file_offset): Define method in
6424 class definition instead of declaring it there. Set current data
6425 size to be the data size of the previous pass.
6426 (Stub_table::set_final_data_size): Use current data size as the
6428 (Stub_table::relocate_stub): Change parameter type of stub from
6429 Reloc_stub pointer to Stub pointer.
6430 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
6431 (Stub_table::Cortex_a8_stub_list): New typedef.
6432 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
6433 Stub_table::prev_addralign_): New data member.
6434 (Arm_relobj::Arm_relobj): Initialize data member
6435 section_has_cortex_a8_workaround_.
6436 (Arm_relobj::section_has_cortex_a8_workaround,
6437 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
6439 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
6441 (Target_arm::relocate_stub): Change parameter type of stub from
6442 Reloc_stub pointer to Stub pointer.
6443 (Insn_template::size, Insn_template::alignment): Handle
6444 THUMB16_SPECIAL_TYPE.
6445 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
6446 Stub_table::update_data_size_and_addralign,
6447 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
6449 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
6450 (Stub_table::do_write): Ditto.
6451 (Target_arm::do_relax): Adjust code for changes in Stub_table.
6453 2010-01-08 Ian Lance Taylor <iant@google.com>
6456 * symtab.h (class Symbol): Remove fields is_target_special_ and
6457 has_plt_offset_. Add field is_defined_in_discarded_section_.
6458 (Symbol::is_defined_in_discarded_section): New function.
6459 (Symbol::set_is_defined_in_discarded_section): New function.
6460 (Symbol::has_plt_offset): Rewrite.
6461 (Symbol::set_plt_offset): Verify that new offset is not -1U.
6462 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
6463 Don't initialize is_target_special_ or has_plt_offset_.
6464 Initialize is_defined_in_discarded_section_.
6465 (Symbol_table::add_from_relobj): If appropriate, set
6466 is_defined_in_discarded_section.
6467 * resolve.cc (Symbol::override_base_with_special): Don't test
6468 is_target_special_. Change has_plt_offset_ to has_plt_offset().
6469 * target-reloc.h (relocate_section): Do special handling for
6470 symbols defined in discarded sections for global symbols as well
6473 2010-01-08 Ian Lance Taylor <iant@google.com>
6475 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
6476 the SHT_SYMTAB case.
6478 2010-01-08 Ian Lance Taylor <iant@google.com>
6480 * object.cc (Sized_relobj::do_layout): Don't get confused if
6481 layout_eh_frame returns NULL.
6483 2010-01-08 Ian Lance Taylor <iant@google.com>
6486 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
6487 dynamic symbol table, use the normal symbol table.
6488 (Sized_dynobj::do_read_symbols): Remove assertion about type of
6491 2010-01-08 Ian Lance Taylor <iant@google.com>
6494 * layout.cc (Layout::include_section): Remove .gnu_debuglink
6497 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
6499 * version.cc (print_version): Change to "Copyright 2010".
6501 2010-01-08 Ian Lance Taylor <iant@google.com>
6505 * i386.cc (class Target_i386): Change return type of plt_section
6507 (class Output_data_plt_i386): Add tls_desc_rel_ field.
6508 (Output_data_plt_i386::Output_data_plt_i386): Initialize
6509 tls_desc_rel_ field.
6510 (Output_data_plt_i386::rel_tls_desc): New function.
6511 (Target_i386::rel_tls_desc_section): New function.
6512 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
6513 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
6514 R_386_TLS_DESC reloc in rel_tls_desc_section.
6515 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
6516 Define struct Tlsdesc_info.
6517 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
6518 (Target_x86_64::do_reloc_symbol_index): New function.
6519 (Target_x86_64::add_tlsdesc_info): New function.
6520 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
6521 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
6523 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
6525 (Output_data_plt_x86_64::rela_tlsdesc): New function.
6526 (Target_x86_64::rela_tlsdesc_section): New function.
6527 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
6529 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
6530 (Target_x86_64::do_reloc_addend): New function.
6531 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
6532 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
6533 declarations. Define TARGET_CODE. Add arg field to u1_ union.
6534 (Output_reloc::type): New function.
6535 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
6536 (Output_reloc::is_target_specific): New function.
6537 (Output_reloc::target_arg): New function.
6538 (class Output_reloc) [SHT_RELA]: Add four new constructors for
6539 absolute relocs and target specific relocs.
6540 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
6541 add_target_specific.
6542 (class Output_data_reloc) [SHT_RELA]: Likewise.
6543 * output.cc (Output_reloc::Output_reloc): Add four new versions
6544 for absolute relocs and target specific relocs.
6545 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
6546 (Output_reloc::get_symbol_index): Likewise.
6547 (Output_reloc::local_section_offset): Check that local_sym_index_
6548 is not TARGET_CODE or 0.
6549 (Output_reloc::symbol_value): Likewise.
6550 (Output_reloc::write) [SHT_RELA]: Call target for target specific
6552 * target.h (class Target): Add reloc_symbol_index and reloc_addend
6553 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
6555 * layout.cc (add_target_dynamic_tags): Use output section for
6556 DT_PLTRELSZ and DT_JMPREL.
6558 2010-01-07 Ian Lance Taylor <iant@google.com>
6561 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
6563 (class Output_data_reloc_generic): Define.
6564 (class Output_data_reloc_base): Change base class to
6565 Output_data_reloc_generic. Change add() method to call
6566 bump_relative_reloc_count for a relative reloc. Remove
6568 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
6570 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
6571 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
6573 * layout.h (class Layout): Update declaration.
6575 2010-01-07 Ian Lance Taylor <iant@google.com>
6577 * output.h (class Output_data): Add const version of
6578 output_section and do_output_section.
6579 (class Output_section_data): Add const version of
6581 (class Output_section): Likewise.
6582 * layout.cc (Layout::add_target_dynamic_tags): New function.
6583 * layout.h (class Layout): Update declarations.
6584 * arm.cc (Target_arm::do_finalize_sections): Use
6585 add_target_dynamic_tags.
6586 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6587 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6588 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6589 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6591 2010-01-07 Ian Lance Taylor <iant@google.com>
6594 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
6597 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
6598 Ian Lance Taylor <iant@google.com>
6601 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
6602 Xindex::read_symtab_xindex.
6604 2010-01-07 Doug Kwan <dougkwan@google.com>
6606 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
6607 (Insn_template::thumb16_bcond_insn): New method declaration.
6608 (Insn_template): Fix spelling.
6609 (Stub::thumb16_special): New method declaration.
6610 (Stub::do_write): Define virtual method which was previously pure
6612 (Stub::do_thumb16_special): New method declaration.
6613 (Stub::do_fixed_endian_write): New template member.
6614 (Reloc_stub::do_write): Remove.
6615 (Reloc_stub::do_fixed_endian_write): Remove.
6616 (Cortex_a8_stub): New class definition.
6617 (Stub_factory::make_cortex_a8_stub): New method definition.
6618 (Stub_factory::Stub_factory): Add missing static storage class
6619 qualifier for elf32_arm_stub_a8_veneer_blx.
6621 2010-01-07 Ian Lance Taylor <iant@google.com>
6624 * options.h (class General_options): Add --warn-unresolved-symbols
6625 and --error-unresolved-symbols.
6626 * errors.cc (Errors::undefined_symbol): Implement
6627 --warn-unresolved-symbols.
6629 * options.h (class General_options): Add -z text and -z textoff.
6630 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
6632 2010-01-06 Sriraman Tallam <tmsriram@google.com>
6634 * gc.h (Garbage_collection::Cident_section_map): New typedef.
6635 (Garbage_collection::cident_sections): New function.
6636 (Garbage_collection::add_cident_section): New function.
6637 (Garbage_collection::cident_sections_): New member.
6638 (gc_process_relocs): Add references to sections whose names are C
6640 * gold.h (cident_section_start_prefix): New constant.
6641 (cident_section_stop_prefix): New constant.
6642 (is_cident): New function.
6643 * layout.cc (Layout::define_section_symbols): Replace string constants
6644 with the newly defined constants.
6645 * object.cc (Sized_relobj::do_layout): Track sections whose names are
6647 * testsuite/Makefile.am: Add gc_orphan_section_test.
6648 * testsuite/Makefile.in: Regenerate.
6649 * testsuite/gc_orphan_section_test.cc: New file.
6650 * testsuite/gc_orphan_section_test.sh: New file.
6652 2010-01-06 Ian Lance Taylor <iant@google.com>
6655 * options.h (class General_options): Add --warn-shared-textrel.
6656 * layout.cc (Layout::finish_dynamic_section): Implement
6657 --warn-shared-textrel.
6660 * options.h (class General_options): Add --warn-multiple-gp.
6662 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6664 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
6665 $(THREADSLIB) and $(LIBDL).
6666 * Makefile.in: Rebuild.
6668 2010-01-06 Ian Lance Taylor <iant@google.com>
6671 * options.cc (General_options::parse_section_start): New function.
6672 (General_options::section_start): New function.
6673 (General_options::General_options): Initialize all members.
6674 * options.h: Include <map>
6675 (class General_options): Add --section-start. Add section_starts_
6677 * layout.cc (Layout::attach_allocated_section_to_segment): If
6678 --section-start was used, set the address of the segment. Remove
6679 local sort_sections.
6680 (Layout::relaxation_loop_body): If the address of the load segment
6681 has been set by --section-start, don't use it.
6682 * output.h (Output_segment::update_flags_for_output_section): New
6684 * output.cc (Output_segment::add_output_section): Call
6685 update_flags_for_output_section.
6687 2010-01-05 Ian Lance Taylor <iant@google.com>
6690 * options.h (class General_options): Add --undefined-version.
6691 * script.cc (struct Version_expression): Add was_matched_by_symbol
6693 (Version_script_info::matched_symbol): New function.
6694 (Version_script_info::get_symbol_version_helper): Call
6696 (Version_script_info::check_unmatched_names): New function.
6697 * script.h (class Version_script_info): Update declarations.
6698 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
6700 * options.h (class General_options): Use DEFINE_bool_alias for
6701 allow_multiple_definition.
6702 * resolve.cc (Symbol_table::should_override): Don't test
6703 allow_multiple_definition.
6706 * options.h (class General_options): Add --cref.
6707 * main.cc (main): Print cref table if --cref. Don't close mapfile
6708 until after printing cref table.
6709 * cref.cc: Include "symtab.h".
6710 (class Cref_inputs): Define Cref_table_compare and Cref_table.
6711 (Cref_table_compare::operator()): New function.
6712 (Cref_inputs::gather_cref): New function.
6713 (filecol): New static const.
6714 (Cref_inputs::print_cref): New function.
6715 (Cref::print_cref): New function.
6716 * cref.h: Include <cstdio>.
6717 (class Cref): Update declarations.
6718 * mapfile.h (Mapfile::file): New function.
6719 * object.h (class Object): Define Symbols. Declare virtual
6720 do_get_global_symbols.
6721 (Object::get_global_symbols): New function.
6722 * object.cc (Input_objects::add_object): Pass object to cref_ if
6724 (Input_objects::archive_start): Likewise.
6725 (Input_objects::archive_stop): Likewise.
6726 (Input_objects::print_cref): New function.
6727 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
6728 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
6730 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
6732 * plugin.h (class Sized_pluginobj): Update declarations.
6734 2010-01-05 Ian Lance Taylor <iant@google.com>
6736 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
6737 to is_default_version. Rename insdef to insdefault.
6738 (Symbol_table::add_from_relobj): Rename def to is_default_version
6739 and local to is_forced_local.
6740 (Symbol_table::add_from_pluginobj): Likewise.
6741 (Symbol_table::add_from_dynobj): Likewise.
6742 (Symbol_table::define_special_symbol): Rename insdef to
6745 2010-01-04 Ian Lance Taylor <iant@google.com>
6748 * options.h (class General_options): Add
6749 --allow-multiple-definition and -z muldefs.
6750 * resolve.cc (Symbol_table::should_override): Don't warn about a
6751 multiple symbol definition if --allow-multiple-definition or -z
6755 * options.h (class General_options): Add --add-needed and
6756 --copy-dt-needed-entries. Tweak --as-needed help entry.
6757 * object.cc (Input_objects::check_dynamic_dependencies): Give an
6758 error if --copy-dt-needed-entries aka --add-needed is used and
6759 would cause a change in behaviour.
6762 * options.h (class General_options): Add -G as a short version of
6763 --shared. Add no-op options -assert, -g, and -i.
6765 2010-01-04 Sriraman Tallam <tmsriram@google.com>
6767 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
6768 check for .text or .gnu.linkonce.t sections.
6769 * icf.cc (Icf::find_identical_sections): Ditto.
6770 Change the detection for mangled function name within the section
6772 * icf.h (is_section_foldable_candidate): New function.
6774 2009-12-30 Ian Lance Taylor <iant@google.com>
6777 * options.h (class General_options): Permit two dashes with
6778 --retain-symbols-file.
6780 2009-12-30 Ian Lance Taylor <iant@google.com>
6783 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
6784 don't put the file header and segment headers in the text
6788 * common.cc (Sort_commons::operator()): Stabilize sort when both
6790 (Symbol_table::do_allocate_commons_list): When allocating common
6791 symbols, skip a symbol which is no longer common.
6792 * symtab.h (Symbol::is_common): Test whether the symbol comes from
6793 an object before checking its type.
6794 * testsuite/common_test_2.c: New file.
6795 * testsuite/common_test_3.c: New file.
6796 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
6797 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
6798 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
6799 (common_test_2_pic.o, common_test_2.so): New targets.
6800 (common_test_3_pic.o, common_test_3.so): New targets.
6801 * testsuite/Makefile.in: Rebuild.
6804 * script.cc (read_input_script): If we see a new SECTIONS clause,
6805 and we have added an input section, give an error.
6806 * layout.h (class Layout): Add have_added_input_section function.
6807 Add have_added_input_section_ field.
6808 * layout.cc (Layout::Layout): Initialize
6809 have_added_input_section_.
6810 (Layout::layout): Set have_added_input_section_.
6811 (Layout::layout_eh_frame): Likewise.
6813 2009-12-30 Ian Lance Taylor <iant@google.com>
6816 * options.h (class General_options): Add --sort-common option.
6817 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
6818 * common.cc (Sort_common): Add sort_order parameter to
6819 constructor. Add sort_order_ field.
6820 (Sort_commons::operator): Check sort_order_.
6821 (Symbol_table::allocate_commons): Determine the sort order.
6822 (Symbol_table::do_allocate_commons): Add sort_order parameter.
6824 (Symbol_table::do_allocate_commons_list): Likewise.
6826 2009-12-30 Ian Lance Taylor <iant@google.com>
6829 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
6830 symbols from this object, don't change the visibility of an
6832 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
6834 2009-12-30 Ian Lance Taylor <iant@google.com>
6837 * script.h (class Version_script_info): Define Language enum.
6838 Update declarations. Define Glob, Exact, and Lookup types. Add
6839 new fields globals_, locals_, and is_finalized_.
6840 * script.cc: Various formatting fixes.
6841 (class Parser_closure): Change language_stack_ from a vector of
6842 std::string to one of Version_script_info::Language. Adjust all
6844 (class Lazy_demangler): Remove.
6845 (struct Version_expression): Change language from std::string to
6846 Version_script_info::Language.
6847 (Version_script_info::Version_script_info): New function.
6848 (Version_script_info::~Version_script_info): Don't call clear.
6849 (Version_script_info::finalize): New function.
6850 (Version_script_info::build_lookup_tables): New function.
6851 (Version_script_info::build_expression_list_lookup): New
6853 (Version_script_info::get_symbol_version_helper): Rewrite to use
6855 (Version_script_info::print_expression_list): Adjust to use
6856 Version_script_info::Language.
6857 (script_push_lex_into_version_mode): Check that the version script
6858 has not been finalized.
6859 (version_script_push_lang): Change language string to
6860 Version_script_info::Language.
6861 * options.cc (Command_line::version_script): New function.
6862 * options.h (class General_options): Add finalize_dynamic_list
6863 function. Change version_script from declaration to definition.
6864 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
6865 * testsuite/version_script.map: Remove duplicate def of foo.
6866 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
6868 * testsuite/Makefile.in: Rebuild.
6870 2009-12-30 Ian Lance Taylor <iant@google.com>
6873 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
6874 if the input symbol index is 0, make the output symbol index 0.
6876 2009-12-30 Ian Lance Taylor <iant@google.com>
6879 * options.h (class General_options): Add -x/--discard-all.
6880 * object.cc (Sized_relobj::do_count_local_symbols): Handle
6881 --discard-all. If the local symbol needs a dynamic entry, check
6882 that before handling --discard-locals.
6884 2009-12-30 Ian Lance Taylor <iant@google.com>
6887 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
6889 (Output_segment::add_output_section): Don't change the flags if
6893 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
6894 GNU hash table if they need a dynamic value. Otherwise, don't add
6895 them if they are defined in a dynamic object or are forced local.
6897 2009-12-29 Ian Lance Taylor <iant@google.com>
6900 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
6901 .gnu.hash table for a 32-bit target.
6904 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
6905 regular and a dynamic object only needs a dynamic symbol table
6906 entry if it is externally visible.
6909 * i386.cc (class Target_i386): Initialize global_offset_table_ in
6910 constructor. Add global_offset_table_ field.
6911 (Target_i386::got_section): Set global_offset_table_.
6912 (Target_i386::do_finalize_sections): Set global_offset_table_
6914 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
6915 in constructor. Add global_offset_table_ field.
6916 (Target_x86_64::got_section): Set global_offset_table_.
6917 (Target_x86_64::do_finalize_sections): Set global_offset_table_
6920 * layout.cc (Layout::Layout): Initialize increase_relro_.
6921 (Layout::get_output_section): Add is_relro, is_last_relro, and
6922 is_first_non_relro parameters. Change all callers.
6923 (Layout::choose_output_section): Likewise.
6924 (Layout::add_output_section_data): Likewise.
6925 (Layout::make_output_section): Likewise.
6926 (Layout::set_segment_offsets): Clear increase_relro when using a
6928 * layout.h (class Layout): Add increase_relro method. Add
6929 increase_relro_ field. Update declarations.
6930 * output.cc (Output_section::Output_section): Initialize
6931 is_last_relro_ and is_first_non_relro_.
6932 (Output_segment::add_output_section): Group relro sections is
6933 do_sort is true. Handle is_last_relro and is_first_non_relro.
6934 (Output_segment::maximum_alignment): Remove relro handling.
6935 (Output_segment::set_section_addresses): Add increase_relro
6936 parameter. Change all callers. Add initial alignment to align
6937 relro sections on separate page. Remove old relro handling.
6938 (Output_segment::set_section_list_addresses): Remove in_relro
6939 parameter. Change all callers.
6940 (Output_segment::set_offset): Add increase parameter. Change all
6941 callers. Remove old relro handling.
6942 * output.h (class Output_section): Add new methods: is_last_relro,
6943 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
6944 Add is_last_relro_ and is_first_non_relro_ fields.
6945 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
6946 Create separate .got.plt section. Call increase_relro.
6947 * x86_64.cc (Target_x86_64::got_section): Likewise.
6948 * testsuite/relro_script_test.t: Add .got.plt.
6951 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
6952 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
6953 (Layout::finalize): Call set_dynamic_symbol_size.
6954 (Layout::set_dynamic_symbol_size): New function.
6955 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
6956 set_dynamic_symbol_size.
6959 * output.h (class Output_section): Add is_entsize_zero_ field.
6960 * output.cc (Output_section::Output_section): Initialize
6962 (Output_section::set_entsize): If two different entsizes are
6963 requested, force it to zero.
6964 (Output_section::add_input_section): Set flags for .debug_str
6965 before updating section flags. Set entsize.
6966 (Output_section::update_flags_for_input_section): Set SHF_MERGE
6967 and SHF_STRING if all input sections have those flags.
6969 2009-12-29 Rafael Espindola <espindola@google.com>
6971 * main.cc (main): Fix the sys time reporting.
6972 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
6975 2009-12-29 Sriraman Tallam <tmsriram@google.com>
6977 * options.cc (General_options::parse_version): Allow -v to exit
6978 without an error if there is nothing to link.
6980 2009-12-29 Ian Lance Taylor <iant@google.com>
6982 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
6983 using a version of gcc before 4.1.
6984 * configure: Rebuild.
6986 2009-12-28 Chris Demetriou <cgd@google.com>
6988 * attributes.cc (Output_attributes_section_data::do_write): Use
6989 std::vector::front rather than std::vector::data.
6991 2009-12-28 Ian Lance Taylor <iant@google.com>
6993 * symtab.h (class Symbol_table): Add enum Defined.
6994 * resolve.cc (Symbol_table::should_override): Add defined
6995 parameter. Change all callers. Test whether object is NULL
6996 before calling a method on it.
6997 (Symbol_table::report_resolve_problem): Add defined parameter.
6999 (Symbol_table::should_override_with_special): Likewise.
7000 * symtab.cc (Symbol_table::define_in_output_data): Add defined
7001 parameter. Change all callers.
7002 (Symbol_table::do_define_in_output_data): Likewise.
7003 (Symbol_table::define_in_output_segment): Likewise.
7004 (Symbol_table::do_define_in_output_segment): Likewise.
7005 (Symbol_table::define_as_constant): Likewise.
7006 (Symbol_table::do_define_as_constant): Likewise.
7007 * script.h (class Symbol_assignment): Add is_defsym parameter to
7008 constructor; change all callers.
7009 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
7010 parameter. Change all callers. Add is_defsym_ field.
7011 (class Parser_closure): Add parsing_defsym parameter to
7012 constructor; change all callers. Add parsing_defsym accessor
7013 function. Add parsing_defsym_ field.
7015 2009-12-28 Ian Lance Taylor <iant@google.com>
7017 * gold.cc (queue_middle_tasks): Fix formatting.
7018 * object.cc (Relobj::is_section_name_included): Likewise.
7020 2009-12-23 Ian Lance Taylor <iant@google.com>
7022 * i386.cc (Target_i386::do_calls_non_split): Recognize
7023 -fsplit-stack prologue for a function with a static chain.
7024 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
7025 -fsplit-stack prologue when using %r11.
7027 2009-12-21 Sriraman Tallam <tmsriram@google.com>
7029 * options.cc (General_options::parse_version): Make -v continue and do
7030 the link like GNU ld does.
7032 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
7034 * Makefile.am (CCFILES): Add timer.cc.
7035 (HFILES): Add timer.h.
7036 * configure.ac: Check for sysconf and times.
7037 * main.cc: include timer.h.
7038 (main): Use Timer instead of get_run_time.
7041 * workqueue.cc: include timer.h.
7042 (Workqueue::find_and_run_task):
7043 Report user, sys and wall time.
7044 * Makefile.in: Regenerate.
7045 * config.in: Regenerate.
7046 * configure: Regenerate.
7048 2009-12-16 Doug Kwan <dougkwan@google.com>
7050 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
7052 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
7053 relaxed input sections.
7054 * output.cc (Output_section::find_relaxed_input_section): Change
7055 return type to Output_relaxed_input_section pointer. Adjust code
7056 for new type of relaxed_input_section_map_.
7057 * output.h (Output_section::find_relaxed_input_section): Change
7058 return type to Output_relaxed_input_section pointer.
7059 (Output_section::Output_relaxed_input_section_by_input_section_map):
7061 (Output_section::relaxed_input_section_map_): Change type to
7062 Output_section::Output_relaxed_input_section_by_input_section_map.
7063 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
7066 2009-12-15 Ian Lance Taylor <iant@google.com>
7068 * layout.cc (Layout::create_shstrtab): Only write out after input
7069 sections if we are compressing debug sections.
7071 2009-12-15 Ian Lance Taylor <iant@google.com>
7073 * archive.cc (Archive::add_symbols): Only look up a symbol without
7074 a version if there is, in fact, a version.
7076 2009-12-14 Ian Lance Taylor <iant@google.com>
7078 Revert -Wshadow changes, all changes from:
7079 2009-12-11 Doug Kwan <dougkwan@google.com>
7080 2009-12-11 Nick Clifton <nickc@redhat.com>
7081 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
7083 2009-12-11 Doug Kwan <dougkwan@google.com>
7085 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
7087 * attributes.cc (Object_attribute::size): Ditto.
7088 (Attributes_section_data::size): Ditto.
7089 (Attributes_section_data::Attributes_section_data): Ditto.
7090 (Output_attributes_section_data::do_write): Ditto.
7091 * attributes.h (Object_attribute::set_type): Ditto.
7092 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
7094 2009-12-11 Nick Clifton <nickc@redhat.com>
7096 * archive.cc: Fix shadowed variable warnings.
7098 * compressed_output.cc: Likewise.
7099 * compressed_output.h: Likewise.
7100 * configure: Likewise.
7101 * dwarf_reader.cc: Likewise.
7102 * dynobj.cc: Likewise.
7103 * dynobj.h: Likewise.
7104 * ehframe.cc: Likewise.
7105 * ehframe.h: Likewise.
7106 * errors.cc: Likewise.
7107 * expression.cc: Likewise.
7108 * fileread.cc: Likewise.
7109 * fileread.h: Likewise.
7110 * freebsd.h: Likewise.
7111 * i386.cc: Likewise.
7113 * incremental.h: Likewise.
7114 * layout.cc: Likewise.
7115 * layout.h: Likewise.
7116 * mapfile.cc: Likewise.
7117 * merge.cc: Likewise.
7118 * merge.h: Likewise.
7119 * object.cc: Likewise.
7120 * object.h: Likewise.
7121 * options.h: Likewise.
7122 * output.cc: Likewise.
7123 * output.h: Likewise.
7124 * parameters.cc: Likewise.
7125 * plugin.cc: Likewise.
7126 * powerpc.cc: Likewise.
7127 * reduced_debug_output.cc: Likewise.
7128 * reduced_debug_output.h: Likewise.
7129 * reloc.cc: Likewise.
7130 * reloc.h: Likewise.
7131 * resolve.cc: Likewise.
7132 * script-sections.cc: Likewise.
7133 * script.cc: Likewise.
7134 * script.h: Likewise.
7135 * sparc.cc: Likewise.
7136 * symtab.cc: Likewise.
7137 * symtab.h: Likewise.
7138 * target-select.cc: Likewise.
7139 * target-select.h: Likewise.
7140 * token.h: Likewise.
7141 * workqueue.cc: Likewise.
7142 * workqueue.h: Likewise.
7143 * x86_64.cc: Likewise.
7145 2009-12-10 Doug Kwan <dougkwan@google.com>
7147 * arm.cc (attributes.h): New include.
7148 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
7149 (Arm_relobj::~Arm_relobj): Delete object pointed by
7150 attributes_section_data_.
7151 (Arm_relobj::attributes_section_data): New method definition.
7152 (Arm_relobj::attributes_section_data_): New data member declaration.
7153 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
7154 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
7155 attributes_section_data_.
7156 (Arm_dynobj::attributes_section_data): New method definition.
7157 (Arm_dynobj::attributes_section_data_): New data member declaration.
7158 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
7159 initialization value of may_use_blx_ to false.
7160 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
7161 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
7162 object attributes to compute results instead of hard-coding.
7163 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
7164 Target_arm::get_secondary_compatible_arch,
7165 Target_arm::set_secondary_compatible_arch
7166 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7167 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
7168 New method declarations.
7169 (Target_arm::get_aeabi_object_attribute): New method definition.
7170 (Target_arm::attributes_section_data_): New data member declaration.
7171 (read_arm_attributes_section): New template definition.
7172 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
7173 (Arm_dynobj::do_read_symbols): Ditto.
7174 (Target_arm::do_finalize_sections): Merge attributes sections from
7175 input. Check for BLX use after attributes section merging.
7176 Fix __exidx_start and __exidx_end visibility. Create an
7177 .ARM.attributes section if necessary.
7178 (Target_arm::get_secondary_compatible_arch,
7179 Target_arm::set_secondary_compatible_arch,
7180 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7181 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
7182 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
7183 New method definitions.
7185 2009-12-09 Ian Lance Taylor <iant@google.com>
7187 * plugin.cc (Plugin::load): Don't cast from void* to a function
7190 2009-12-09 Ian Lance Taylor <iant@google.com>
7192 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
7195 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
7197 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
7198 Replace two_file_shared_1.so with two_file_shared_2.so.
7199 * testsuite/Makefile.in: Regenerated.
7201 2009-12-08 Doug Kwan <dougkwan@google.com>
7203 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
7204 (HFILES): Add attributes.h and int_encoding.h.
7205 * Makefile.in: Regenerate.
7206 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
7207 function definitions to int_encoding.cc
7208 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
7209 prototypes to int_encoding.h
7210 * reduced_debug_output.cc (int_encoding.h): New include.
7211 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
7212 function definitions to int_encoding.cc
7213 (insert_into_vector, read_from_pointer): Move template definitions to
7215 * attributes.cc: New file.
7216 * attributes.h: New file.
7217 * int_encoding.cc: New file.
7218 * int_encoding.h: New file.
7220 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
7223 * incremental-dump.cc (dump_incremental_inputs): New.
7224 (main): Use dump_incremental_inputs.
7226 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
7229 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
7230 checking elfcpp::STT_FUNC.
7231 (Target_i386::Relocate::relocate): Likewise.
7232 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
7234 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
7235 symbols from shared libraries into normal FUNC symbols.
7237 * symtab.h (Symbol): Add is_func and use it.
7239 2009-12-05 Doug Kwan <dougkwan@google.com>
7241 * arm.cc (Target_arm::arm_info): Initialize new fields
7242 attributes_section and attributes_vendor.
7243 * i386.cc (Target_i386::i386_info): Same.
7244 * object.cc (Sized_relobj::do_layout): Skip attribute section.
7245 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7246 fields attributes_section and attributes_vendor.
7247 * sparc.cc (Target_sparc::sparc_info): Same.
7248 * target.h (Target::attributes_section, Target::attributes_vendor,
7249 Target::is_attributes_section, Target::attribute_arg_type,
7250 Target::attributes_order): New method definitions.
7251 (Target::Target_info::attributes_section,
7252 Target::Target_info::attributes_vendor): New fields.
7253 (Target::do_attribute_arg_type, Target::do_attributes_order): New
7254 virtual method definitions.
7255 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7256 attributes_section and attributes_vendor.
7257 * testsuite/testfile.cc (Target_test::test_target_info): Same.
7259 2009-12-05 Doug Kwan <dougkwan@google.com>
7261 * arm.cc: Update comments about interworking and stub generation.
7262 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
7263 considered as non-PIC.
7264 (Arm_relocate_functions::base_abs): Fix formatting.
7265 (Arm_relocate_functions::got_prel): Fix comment. Change interface
7266 of function to use GOT entry address instead of offset.
7267 (Target_arm::Scan::global): Issue an error if a symbol would need a
7268 PLT does not get one because it is untyped. Remove code to create
7269 dynamic symbols for relative branches.
7270 (Target_arm::Relocate::relocate: Use 0 instead of false since function
7271 takes unsigned integer instead of boolean.
7273 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
7275 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7276 (two_file_test_LDADD): Likewise.
7277 (common_test_1_LDADD): Likewise.
7278 (exception_test_LDADD) Likewise.
7279 (weak_test_LDADD): Likewise.
7280 (many_sections_test_LDADD): Likewise.
7281 (initpri1_LDADD): Likewise.
7282 (script_test_1_LDADD): Likewise.
7283 (script_test_2_LDADD): Likewise.
7284 (justsyms_LDADD): Likewise.
7285 (binary_test_LDADD): Likewise.
7286 (large_LDADD): Likewise.
7287 * testsuite/Makefile.in: Regenerated.
7289 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
7291 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7292 (Symbol_table::override_with_special): Likewise.
7293 (Symbol_table::add_from_object): Likewise.
7295 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
7297 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7298 Don't set the data_offset twice.
7300 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
7302 * testsuite/Makefile.in: Regenerate.
7304 2009-12-03 Doug Kwan <dougkwan@google.com>
7306 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
7307 (Target_arm::do_finalize_sections): Add parameter for symbol table
7308 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
7309 * i386.cc (Target_i386::do_finalize_sections): Add an additional
7310 parameter for symbol table pointer.
7311 * layout.cc (Layout::finalize): Call Target::finalize_sections with
7312 an additional parameter for a pointer to symbol table.
7313 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
7314 parameter for a symbol table pointer.
7315 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
7316 * target.h (Target::finalize_sections, Target::do_finalize_sections):
7318 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
7319 parameter for a symbol table pointer.
7321 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
7323 * incremental.cc (Incremental_inputs_header)
7324 (Incremental_inputs_header_write, Incremental_inputs_entry)
7325 (Incremental_inputs_entry_write): Move ...
7326 * incremental.h (Incremental_inputs_header)
7327 (Incremental_inputs_header_write, Incremental_inputs_entry)
7328 (Incremental_inputs_entry_write): here.
7330 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7332 * incremental.cc (make_sized_incremental_binary): Set the target.
7333 Error if it is incompatible.
7334 * output.h (Output_file): Add filename method.
7336 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7338 * incremental.cc (Incremental_inputs_entry): Remove unused argument
7339 from the get_* methods.
7341 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7343 * incremental-dump.cc (main): Check that the offeset of a script is 0.
7344 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7345 Write 0 for the data_offset of scripts.
7347 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7349 * testsuite/Makefile.am: Add the incremental_test.sh test.
7350 * testsuite/incremental_test.sh: New.
7351 * testsuite/incremental_test_1.c: New.
7352 * testsuite/incremental_test_2.c: New.
7354 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
7356 * incremental-dump.cc (main): Fix typos.
7358 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
7361 * incremental-dump.cc (main): Use llu to print 64 bit values.
7363 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
7364 H.J. Lu <hongjiu.lu@intel.com>
7366 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
7368 (incremental_dump_LDADD): Likewise.
7369 * Makefile.in: Regenerated.
7371 2009-11-25 Doug Kwan <dougkwan@google.com>
7375 2009-11-25 Doug Kwan <dougkwan@google.com>
7377 * arm.cc (Target_arm::Target_arm): Move method definition
7378 outside of class definition. Add code to handle
7379 --target1-rel, --target1-abs and --target2= options.
7380 (Target_arm::get_reloc_reloc_type): Change method to be
7381 non-static and const.
7382 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
7383 New data member declaration.
7384 (Target_arm::Scan::local, Target_arm::Scan::global,
7385 Target_arm::Relocate::relocate,
7386 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7387 Adjust call to Target_arm::get_real_reloc_type.
7388 (Target_arm::get_real_reloc_type): Use command line options
7389 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7390 * options.h (--target1-rel, --target1-abs, --target2): New
7393 2009-11-25 Doug Kwan <dougkwan@google.com>
7395 * arm.cc (Target_arm::Target_arm): Move method definition outside of
7396 class definition. Add code to handle --target1-rel, --target1-abs
7397 and --target2= options.
7398 (Target_arm::get_reloc_reloc_type): Change method to be non-static
7400 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
7402 (Target_arm::Scan::local, Target_arm::Scan::global,
7403 Target_arm::Relocate::relocate,
7404 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
7405 call to Target_arm::get_real_reloc_type.
7406 (Target_arm::get_real_reloc_type): Use command line options to
7407 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7408 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
7411 2009-11-25 Doug Kwan <dougkwan@google.com>
7413 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
7414 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
7415 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
7417 (Arm_relocate_functions::thm_call): Replace body with a call to
7418 Arm_relocate_functions::thumb_branch_common.
7419 (Arm_relocate_functions::thm_jump24,
7420 Arm_relocate_functions::thm_xpc22): New method definitions.
7421 (Arm_relocate_functions::thumb_branch_common): New method definition.
7422 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
7424 (Target_arm::Relocate::relocate): Adjust call to thm_call.
7425 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
7427 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
7429 * Makefile.am: Build incremental-dump
7430 * Makefile.in: Regenerate.
7431 * incremental-dump.cc: New.
7432 * incremental.cc (Incremental_inputs_header_data,
7433 Incremental_inputs_entry_data): Move to incremental.h
7434 * incremental.h: (Incremental_inputs_header_data,
7435 Incremental_inputs_entry_data): Move from incremental.cc
7437 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
7439 * incremental.cc (Incremental_inputs_header,
7440 Incremental_inputs_header_write, Incremental_inputs_entry,
7441 Incremental_inputs_entry_write): Add a typedef with the data type.
7443 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
7445 * incremental.cc (Incremental_inputs_header,
7446 Incremental_inputs_header_write, Incremental_inputs_entry,
7447 Incremental_inputs_entry_write): Update comment about which
7448 type has the filed descriptions.
7450 2009-11-15 Doug Kwan <dougkwan@google.com>
7452 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
7453 (Arm_relocate_functions::arm_branch_common): Change method defintion
7454 in class definition to a method declaration and update list of formal
7456 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
7457 Arm_relocation_functions::jump24): Adjust call to
7458 Arm_relocate_functions::arm_branch_common. Update list of formal
7460 (Arm_relocate_functions::xpc25): New method definition.
7461 (Arm_relocate_functions::arm_branch_common): Move method defintion
7462 out from class definition. Use stubs for mode-switching and extending
7464 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
7465 specially. Change code to enable use of stubs in ARM branches.
7467 2009-11-10 Doug Kwan <dougkwan@google.com>
7469 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
7470 in method declaration.
7471 (Target_arm::relocate_stub): New method declaration.
7472 (Target_arm::default_target): Change to return a pointer instead of
7474 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
7475 Target_arm::default_target.
7476 (Arm_Relobj::do_relocate_sections): Remove options paramater in
7478 (Target_arm::relocate_section): Adjust view.
7479 (Target_arm::relocate_stub): New method definition.
7481 2009-11-10 Doug Kwan <dougkwan@google.com>
7483 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
7485 * incremental.cc (open_incremental_binary): Initialized local
7486 variables to avoid warnings.
7487 * object.cc (make_elf_object): Ditto.
7488 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
7491 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
7494 * testsuite/plugin_test.c: Include "config.h".
7496 2009-11-09 Doug Kwan <dougkwan@google.com>
7498 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
7499 (arm_symbol_value): Remove.
7500 (Arm_relocate_functions::arm_branch_common,
7501 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
7502 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
7503 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
7504 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
7505 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
7506 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
7507 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
7508 Arm_relocate_functions::thm_mobw_abs_nc,
7509 Arm_relocate_functions::thm_mov_abs,
7510 Arm_relocate_functions::movw_prel_nc,
7511 Arm_relocate_functions::thm_movt_abs,
7512 Arm_relocate_functions::movt_prel,
7513 Arm_relocate_functions::thm_movw_prel_nc,
7514 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
7515 (Target_arm::Relocate::relocate): Only decompose address into two
7516 parts if relocation type uses the thumb-bit and pass the actual
7517 bit instead of a flag indicating that the thumb-bit is used. Adjust
7518 calls to methods in Arm_relocate_functions for this change.
7520 2009-11-08 Ian Lance Taylor <iant@google.com>
7523 * reloc.cc: Instantiate
7524 Sized_relobj::initialize_input_to_output_maps and
7525 Sized_relobj:free_input_to_output_maps.
7527 2009-11-06 Ian Lance Taylor <iant@google.com>
7530 * defstd.cc (in_segment): Set only_if_ref true for "end".
7532 2009-11-06 Doug Kwan <dougkwan@google.com>
7534 * arm.cc (class Reloc_stub): Correct a comment.
7535 (Target_arm::Target_arm): Initialize arm_input_section_map_.
7536 (Target_arm::scan_section_for_stubs): New method declaration.
7537 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
7538 Change methods from private to protected.
7539 (Target_arm::do_may_relax): New method definition.
7540 (Target_arm::do_relax, Target_arm::group_sections,
7541 Target_arm::scan_reloc_for_stub,
7542 Target_arm::scan_reloc_section_for_stubs): New method declarations.
7543 (Target_arm::arm_input_section_map_): New data member declaration.
7544 (Target_arm::scan_reloc_for_stub,
7545 Target_arm::scan_reloc_section_for_stubs,
7546 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
7547 Target_arm::do_relax): New method definitions.
7549 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
7551 * configure.ac: Check for (struct stat)::st_mtim
7552 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
7553 * config.in: Regenerate.
7554 * configure: Regenerate.
7556 2009-11-05 Ian Lance Taylor <iant@google.com>
7559 * output.cc (Output_segment::add_output_section): Add missing
7562 2009-11-04 Ian Lance Taylor <iant@google.com>
7565 * object.h (class Object): Add is_needed and set_is_needed
7566 methods. Add is_needed_ field. Make bool fields into bitfields.
7567 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
7568 defined in a dynamic object and referenced by a regular object,
7569 set is_needed for the dynamic object.
7570 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
7571 if the file is marked with as_needed and it is not needed.
7573 2009-11-04 Ian Lance Taylor <iant@google.com>
7576 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
7577 tags if data is discarded by linker script.
7578 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7579 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7580 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7581 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7583 2009-11-04 Ian Lance Taylor <iant@google.com>
7585 * layout.cc (Layout::get_output_section): Add is_interp and
7586 is_dynamic_linker_section parameters. Change all callers.
7587 (Layout::choose_output_section): Likewise.
7588 (Layout::make_output_section): Likewise.
7589 (Layout::add_output_section_data): Add is_dynamic_linker_section
7590 parameter. Change all callers.
7591 * layout.h (class Layout): Update declarations.
7592 * output.h (class Output_section): Add is_interp, set_is_interp,
7593 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
7594 Add is_interp_, is_dynamic_linker_section_ fields. Change
7595 generate_code_fills_at_write_ to a bitfield.
7596 * output.cc (Output_section::Output_sections): Initialize new
7598 (Output_segment::add_output_section): Add do_sort parameter.
7601 2009-11-03 Ian Lance Taylor <iant@google.com>
7604 * options.h (class General_options): Add --warn-common.
7605 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
7606 merging two common symbols.
7607 (Symbol_table::should_override): Handle --warn-common when merging
7608 a common symbol with a defined symbol. Use report_resolve_problem
7609 for multiple definitions.
7610 (Symbol_table::report_resolve_problem): New function.
7611 * symtab.h (class Symbol_table): Declare report_resolve_problem.
7613 2009-11-03 Doug Kwan <dougkwan@google.com>
7615 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
7617 (Target_arm::stub_factory): New method definition.
7618 (Target_arm::new_arm_input_section,
7619 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
7620 Target_arm::reloc_uses_thumb_bit): New method declarations.
7621 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
7622 New type definitions.
7623 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
7624 member declarations.
7625 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
7626 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
7627 New method definitions.
7629 2009-11-03 Ian Lance Taylor <iant@google.com>
7631 * options.h (class General_options): Add --warn_constructors.
7633 2009-11-03 Ian Lance Taylor <iant@google.com>
7636 * defstd.cc (in_section): Add entries for __rel_iplt_start,
7637 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
7639 2009-11-03 Ian Lance Taylor <iant@google.com>
7642 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
7643 --msgid-bugs-address.
7644 (install-pdf): New target.
7645 (install-data_yes): Look up one directory to find mkinstalldirs.
7647 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
7649 * po/Make-in (.po.gmo): Don't generate .gmo files in source
7652 2009-10-30 Doug Kwan <dougkwan@google.com>
7654 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
7656 2009-10-30 Doug Kwan <dougkwan@google.com>
7658 * arm.cc (Stub_addend_reader): New struct template definition
7659 and partial specializations.
7660 (Stub_addend_reader::operator()): New method definition for a
7661 partially specialized template.
7663 2009-10-30 Doug Kwan <dougkwan@google.com>
7665 * arm.cc (Arm_relobj::processor_specific_flags): New method
7667 (Arm_relobj::do_read_symbols): New method declaration.
7668 (Arm_relobj::processor_specific_flags_): New data member declaration.
7669 (Arm_dynobj): New class definition.
7670 (Target_arm::do_finalize_sections): Add input_objects parameter.
7671 (Target_arm::do_adjust_elf_header): New method declaration.
7672 (Target_arm::are_eabi_versions_compatible,
7673 (Target_arm::merge_processor_specific_flags): New method declaration.
7674 (Target_arm::do_make_elf_object): New overloaded method definitions
7676 (Arm_relobj::do_read_symbols): New method definition.
7677 (Arm_dynobj::do_read_symbols): Ditto.
7678 (Target_arm::do_finalize_sections): Add input_objects parameters.
7679 Merge processor-specific flags from all input objects.
7680 (Target_arm::are_eabi_versions_compatible,
7681 Target_arm::merge_processor_specific_flags,
7682 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
7683 New method definitions.
7684 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
7685 Input_objects pointer type parameter.
7686 * layout.cc (Layout::finalize): Pass input objects to target's.
7687 finalize_sections function.
7688 * output.cc (Output_file_header::do_sized_write): Set ELF file
7689 header's processor-specific flags.
7690 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
7691 Input_objects pointer type parameter.
7692 * sparc.cc (Target_sparc::do_finalize_sections): Same.
7693 * target.h (Input_objects): New forward class declaration.
7694 (Target::processor_specific_flags,
7695 Target::are_processor_specific_flags_sect): New method definitions.
7696 (Target::finalize_sections): Add input_objects parameter.
7697 (Target::Target): Initialize processor_specific_flags_ and
7698 are_processor_specific_flags_set_.
7699 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
7701 (Target::set_processor_specific_flags): New method definition.
7702 (Target::processor_specific_flags_,
7703 Target::are_processor_specific_flags_set_): New data member
7705 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
7706 Input_objects pointer type parameter.
7708 2009-10-30 Doug Kwan <dougkwan@google.com>
7710 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
7712 2009-10-28 Ian Lance Taylor <iant@google.com>
7714 * object.h (class Relobj): Drop options parameter from
7715 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
7716 do_scan_relocs, do_relocate. Change all callers.
7717 (class Sized_relobj): Drop options parameters from
7718 do_gc_process_relocs, do_scan_relocs, do_relocate,
7719 do_relocate_sections, relocate_sections, emit_relocs_scan,
7720 emit_relocs_scan_reltype. Change all callers.
7721 (struct Relocate_info): Remove options field and all references to
7723 * reloc.h (class Read_relocs): Remove options constructor
7724 parameter and options_ field. Change all callers.
7725 (class Gc_process_relocs, class Scan_relocs): Likewise.
7726 (class Relocate_task): Likewise.
7727 * target-reloc.h (scan_relocs): Remove options parameter. Change
7729 (scan_relocatable_relocs): Likewise.
7730 * target.h (class Sized_target): Remove options parameter from
7731 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
7733 * gc.h (gc_process_relocs): Remove options parameter. Change all
7735 * arm.cc: Update functions to remove options parameters.
7736 * i386.cc: Likewise.
7737 * powerpc.cc: Likewise.
7738 * sparc.cc: Likewise.
7739 * x86_64.cc: Likewise.
7740 * testsuite/testfile.cc: Likewise.
7742 2009-10-28 Doug Kwan <dougkwan@google.com>
7744 * arm.cc (Arm_relobj): New class definition.
7745 (Arm_relobj::scan_sections_for_stubs,
7746 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
7747 New method definitions.
7749 2009-10-28 Cary Coutant <ccoutant@google.com>
7751 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
7752 (Plugin::cleanup_done_): New member.
7753 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
7754 (Plugin_manager::cleanup_done_): Remove.
7755 (Plugin_manager::add_input_file): Edit error message.
7756 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
7757 (Plugin_manager::cleanup): Remove use of cleanup_done_.
7759 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
7761 * fileread.cc: (File_read::View::~View): Use the new
7762 data_ownership_ filed.
7763 (File_read::~File_read): Dispose the new whole_file_view_.
7764 (File_read::open): Mmap the whole file if needed.
7765 (File_read::open): Use whole_file_view_ instead of contents_.
7766 (File_read::find_view): Use whole_file_view_ if applicable.
7767 (File_read::do_read): Use whole_file_view_ instead of contents_.
7768 (File_read::make_view): Use whole_file_view_ instead of contents_,
7769 update File_read::View::View call.
7770 (File_read::find_or_make_view): Update File_read::View::View
7772 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
7774 (File_read::View::Data_ownership): New enum.
7775 (File_read::View::View): Replace bool mapped_ with Data_ownership
7777 (File_read::View::mapped_): Remove (replaced by data_ownership_).
7778 (File_read::View::data_ownership_): New field.
7779 (File_read::contents_): Remove (replaced by whole_file_view_).
7780 (File_read::whole_file_view_): New field.
7781 * options.h (class General_options): Add --keep-files-mapped.
7783 2009-10-27 Cary Coutant <ccoutant@google.com>
7785 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
7786 * testsuite/Makefile.am (plugin_test_5): New test case.
7787 * testsuite/Makefile.in: Regenerate.
7789 2009-10-25 Doug Kwan <dougkwan@google.com>
7791 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
7792 from private to protected to allow access by child class.
7793 (Sized_relobj::do_relocate_sections): New method declaration.
7794 (Sized_relobj::relocate_sections): Virtualize.
7795 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
7796 Sized_relobj::relocate_sections. Instantiate template explicitly
7797 for different target sizes and endianity.
7799 2009-10-24 Doug Kwan <dougkwan@google.com>
7801 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
7802 (Arm_input_section::as_arm_input_section): New method.
7803 (Arm_output_section): New class definition.
7804 (Arm_output_section::create_stub_group,
7805 Arm_output_section::group_sections): New method definitions.
7807 2009-10-22 Doug Kwan <dougkwan@google.com>
7809 * arm.cc (Arm_input_section): New class definition.
7810 (Arm_input_section::init, Arm_input_section:do_write,
7811 Arm_input_section::set_final_data_size,
7812 Arm_input_section::do_reset_address_and_file_offset): New method
7815 2009-10-21 Doug Kwan <dougkwan@google.com>
7817 * arm.cc (Stub_table, Arm_input_section): New forward class
7819 (Stub_table): New class defintion.
7820 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
7821 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
7822 New method definition.
7824 2009-10-21 Doug Kwan <dougkwan@google.com>
7826 * arm.cc: Update copyright comments.
7827 (Target_arm): New forward class template declaration.
7828 (Arm_address): New type.
7829 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
7830 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
7831 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
7833 (Insn_template): Same.
7834 (DEF_STUBS): New macro.
7835 (Stub_type): New enum type.
7836 (Stub_template): New class definition.
7839 (Stub_factory): Same.
7840 (Target_arm::Target_arm): Initialize may_use_blx_ and
7841 should_force_pic_veneer_.
7842 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
7843 Target_arm::should_force_pic_veneer,
7844 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
7845 Target_arm::using_thumb_only, Target_arm:;default_target): New
7847 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
7848 New data member declarations.
7849 (Insn_template::size, Insn_template::alignment): New method defintions.
7850 (Stub_template::Stub_template): New method definition.
7851 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
7852 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
7853 (Stub_factory::Stub_factory): New method definition.
7854 * gold.h (string_hash): New template.
7855 * output.h (Input_section_specifier::hash_value): Use
7857 (Input_section_specifier::string_hash): Remove.
7858 * stringpool.cc (Stringpool_template::string_hash): Use
7861 2009-10-20 Doug Kwan <dougkwan@google.com>
7863 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
7864 symbols of relaxed input sections.
7865 * output.h (Output_section::find_relaxed_input_section): Make
7868 2009-10-16 Doug Kwan <dougkwan@google.com>
7870 * dynobj.cc (Versions::Versions): Initialize version_script_.
7871 Only insert base version symbol definition for a shared object
7872 if version script defines any version versions.
7873 (Versions::define_base_version): New method definition.
7874 (Versions::add_def): Check that base version is not needed.
7875 (Versions::add_need): Define base version lazily.
7876 * dynobj.h (Versions::define_base_version): New method declaration.
7877 (Versions::needs_base_version_): New data member declaration.
7878 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
7879 (check_DATA): Add no_version_test.stdout.
7880 (libno_version_test.so, no_version_test.o no_version_test.stdout):
7882 * testsuite/Makefile.in: Regenerate.
7883 * testsuite/no_version_test.c: New file.
7884 * testsuite/no_version_test.sh: Ditto.
7886 2009-10-16 Doug Kwan <dougkwan@google.com>
7888 * expression.cc (class Segment_start_expression): New class definition.
7889 (Segment_start_expression::value): New method definition.
7890 (script_exp_function_segment_start): Return a new
7891 Segment_start_expression.
7892 * gold/script-c.h (script_saw_segment_start_expression): New function
7894 * script-sections.cc (Script_sections::Script_sections): Initialize
7895 SAW_SEGMENT_START_EXPRESSION_ to false.
7896 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
7897 and -Tbbs options to specify section addresses if given in
7898 command line and no SEGMENT_START expression is seen in a script.
7899 * script-sections.h (Script_sections::saw_segment_start_expression,
7900 Script_sections::set_saw_segment_start_expression): New method
7902 (Script_sections::saw_segment_start_expression_): New data member
7904 * script.cc (script_saw_segment_start_expression): New function.
7905 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
7906 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
7907 script_test_7.sh and script_test_8.sh.
7908 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
7909 script_test_8.stdout.
7910 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
7911 (script_test_6, script_test_6.stdout, script_test_7,
7912 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
7913 * Makefile.in: Regenerate.
7914 * testsuite/script_test_6.sh: New file.
7915 * testsuite/script_test_6.t: Same.
7916 * testsuite/script_test_7.sh: Same.
7917 * testsuite/script_test_7.t: Same.
7918 * testsuite/script_test_8.sh: Same.
7920 2009-10-16 Doug Kwan <dougkwan@google.com>
7922 * output.cc (Output_segment::set_section_list_address): Cast
7923 expressions to unsigned long long type to avoid format warnings.
7925 2009-10-15 Ian Lance Taylor <iant@google.com>
7927 * script.cc (Script_options::add_symbol_assignment): Always add a
7928 dot assignment to script_sections_.
7929 * script-sections.cc (Script_sections::add_dot_assignment):
7930 Initialize if necessary.
7932 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
7933 program headers with no load segment if there is a linker script.
7935 * layout.cc (Layout::set_segment_offsets): Align the file offset
7936 to the segment aligment for -N or -n with no load segment.
7937 * output.cc (Output_segment::add_output_section): Don't crash if
7938 the first section is a TLS section.
7939 (Output_segment::set_section_list_addresses): Print an error
7940 message if the address moves backward in a linker script.
7941 * script-sections.cc
7942 (Output_section_element_input::set_section_addresses): Don't
7943 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
7944 (Orphan_output_section::set_section_addresses): Likewise.
7946 2009-10-15 Doug Kwan <dougkwan@google.com>
7948 * layout.cc (Layout::finish_dynamic_section): Generate tags
7949 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
7950 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
7951 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
7953 2009-10-14 Ian Lance Taylor <iant@google.com>
7955 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
7957 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
7958 data_shdr fields of relinfo.
7959 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
7960 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
7961 R_386_TLS_LDO_32, adjust based on section flags.
7962 (Target_i386::Relocate::fix_up_ldo): Remove.
7964 2009-10-13 Ian Lance Taylor <iant@google.com>
7966 Add support for -pie.
7967 * options.h (class General_options): Add -pie and
7969 (General_options::output_is_position_independent): Test -pie.
7970 (General_options::output_is_executable): Return true if not shared
7971 and not relocatable.
7972 (General_options::output_is_pie): Remove.
7973 * options.cc (General_options::finalize): Reject incompatible uses
7975 * gold.cc (queue_middle_tasks): A -pie link is not static.
7976 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
7977 * symtab.cc (Symbol::final_value_is_known): Return false if
7978 output_is_position_independent.
7979 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
7980 output_is_position_independent.
7981 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
7982 output_is_position_independent.
7983 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
7984 output_is_position_independent.
7985 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
7987 (basic_pie_test.o, basic_pie_test): New targets.
7988 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
7989 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
7990 (two_file_pie_test): New target.
7991 * testsuite/Makefile.in: Rebuild.
7992 * README: Remove note saying that -pie is not supported.
7994 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
7996 * options.h (class General_options): Add -init and -fini.
7997 * layout.cc (Layout::finish_dynamic_section): Emit
7998 given init and fini functions.
8000 2009-10-13 Sriraman Tallam <tmsriram@google.com>
8002 * gc.h (gc_process_relocs): Check if icf is enabled using new
8004 * gold.cc (queue_initial_tasks): Likewise.
8005 (queue_middle_tasks): Likewise.
8006 * object.cc (do_layout): Likewise.
8007 * symtab.cc (is_section_folded): Likewise.
8008 * main.cc (main): Likewise.
8009 * reloc.cc (Read_relocs::run): Likewise.
8010 (Sized_relobj::do_scan_relocs): Likewise.
8011 * icf.cc (is_function_ctor_or_dtor): New function.
8012 (Icf::find_identical_sections): Check if function is ctor or dtor when
8014 * options.h (General_options::icf): Change option to be an enum.
8015 (Icf_status): New enum.
8016 (icf_enabled): New method.
8017 (icf_safe_folding): New method.
8018 (set_icf_status): New method.
8019 (icf_status_): New variable.
8020 * (options.cc) (General_options::finalize): Set icf_status_.
8021 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
8022 icf_test and icf_keep_unique_test to use the --icf enum flag.
8023 * testsuite/icf_safe_test.sh: New file.
8024 * testsuite/icf_safe_test.cc: New file.
8026 2009-10-12 Sriraman Tallam <tmsriram@google.com>
8028 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
8029 includes to gc.h and icf.h.
8030 * arm.cc: Include gc.h.
8031 * gold.cc: Likewise.
8032 * i386.cc: Likewise.
8033 * powerpc.cc: Likewise.
8034 * sparc.cc: Likewise.
8035 * x86_64.cc: Likewise.
8036 * gc.h: Include icf.h.
8038 2009-10-11 Ian Lance Taylor <iant@google.com>
8040 * plugin.cc: Include "gold.h" before other header files.
8042 2009-10-10 Chris Demetriou <cgd@google.com>
8044 * options.h (Input_file_argument::Input_file_type): New enum.
8045 (Input_file_argument::is_lib_): Replace with...
8046 (Input_file_argument::type_): New member.
8047 (Input_file_argument::Input_file_argument): Take Input_file_type
8048 'type' rather than boolean 'is_lib' as second argument.
8049 (Input_file_argument::is_lib): Use type_.
8050 (Input_file_argument::is_searched_file): New function.
8051 (Input_file_argument::may_need_search): Handle is_searched_file.
8052 * options.cc (General_options::parse_library): Support -l:filename.
8053 (General_options::parse_just_symbols): Update for Input_file_argument
8055 (Command_line::process): Likewise.
8056 * archive.cc (Archive::get_file_and_offset): Likewise.
8057 * plugin.cc (Plugin_manager::release_input_file): Likewise.
8058 * script.cc (read_script_file, script_add_file): Likewise.
8059 * fileread.cc (Input_file::Input_file): Likewise.
8060 (Input_file::will_search_for): Handle is_searched_file.
8061 (Input_file::open): Likewise.
8062 * readsyms.cc (Read_symbols::get_name): Likewise.
8063 * testsuite/Makefile.am (searched_file_test): New test.
8064 * testsuite/Makefile.in: Regenerate.
8065 * testsuite/searched_file_test.cc: New file.
8066 * testsuite/searched_file_test_lib.cc: New file.
8068 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8069 Ian Lance Taylor <iant@google.com>
8071 * descriptor.cc: Include <cstdio> and "binary-io.h".
8072 (Descriptors::open): Open the files in binary mode always.
8073 * script.cc (Lex::get_token): Treat \r as whitespace.
8075 2009-10-09 Ian Lance Taylor <iant@google.com>
8077 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
8079 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8080 Ian Lance Taylor <iant@google.com>
8082 * configure.ac: Check for readv function also.
8083 * fileread.cc (readv): Define if not HAVE_READV.
8084 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
8086 * config.in: Regenerate.
8087 * configure: Regenerate.
8089 2009-10-09 Doug Kwan <dougkwan@google.com>
8091 * layout.cc (Layout::make_output_section): Call target hook to make
8092 ordinary output section.
8093 (Layout::finalize): Adjust parameter list of call the
8094 Target::may_relax().
8095 * layout.h (class Layout::section_list): New method.
8096 * merge.h (Output_merge_base::entsize): Change visibility to public.
8097 (Output_merge_base::is_string, Output_merge_base::do_is_string):
8099 (Output_merge_string::do_is_string): New method.
8100 * object.cc (Sized_relobj::do_setup): renamed from
8101 Sized_relobj::set_up.
8102 * object.h (Sized_relobj::adjust_shndx,
8103 Sized_relobj::initializ_input_to_output_maps,
8104 Sized_relobj::free_input_to_output_maps): Change visibilities to
8106 (Sized_relobj::setup): Virtualize.
8107 (Sized_relobj::do_setup): New method declaration.
8108 (Sized_relobj::invalidate_section_offset,
8109 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
8110 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
8111 * options.cc (parse_int): New function.
8112 * options.h (parse_int): New declaration.
8113 (DEFINE_int): New macro.
8114 (stub_group_size): New option.
8115 * output.cc (Output_section::Output_section): Initialize memebers
8116 merge_section_map_, merge_section_by_properties_map_,
8117 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
8118 (Output_section::add_input_section): Handled deferred code-fill
8119 generation and remove an old comment.
8120 (Output_section::add_relaxed_input_section): New method definition.
8121 (Output_section::add_merge_input_section): Use merge section by
8122 properties map to speed to search. Update merge section maps
8124 (Output_section::build_relaxation_map): New method definition.
8125 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8127 (Output_section::relax_input_section): Renamed to
8128 Output_section::convert_input_sections_to_relaxed_sections and change
8129 interface to take a vector of pointers to relaxed sections.
8130 (Output_section::find_merge_section,
8131 Output_section::find_relaxed_input_section): New method definitions.
8132 (Output_section::is_input_address_mapped,
8133 Output_section::output_offset, Output_section::output_address):
8134 Use output section data maps to speed up searching.
8135 (Output_section::find_starting_output_address): Add comments.
8136 (Output_section::do_write,
8137 Output_section::write_to_postprocessing_buffer): Do code-fill
8138 generation as appropriate.
8139 (Output_section::get_input_sections): Invalidate relaxed input section
8141 (Output_section::restore_states): Adjust type of checkpoint .
8142 Invalidate relaxed input section map.
8143 * output.h (Output_merge_base): New class declaration.
8144 (Input_section_specifier): New class defintion.
8145 (class Output_relaxed_input_section) Change base class to
8146 Output_section_data_build.
8147 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
8148 base class initializer.
8149 (Output_section::add_relaxed_input_section): New method declaration.
8150 (Output_section::Input_section): Change visibility to protected.
8151 (Output_section::Input_section::relobj,
8152 Output_section::Input_section::shndx): Handle relaxed input sections.
8153 Output_section::input_sections) Change visibility to protected. Also
8154 define overload to return a non-const pointer.
8155 (Output_section::Merge_section_properties): New class defintion.
8156 (Output_section::Merge_section_by_properties_map,
8157 Output_section::Output_section_data_by_input_section_map,
8158 Output_section::Relaxation_map): New types.
8159 (Output_section::relax_input_section): Rename method to
8160 Output_section::convert_input_sections_to_relaxed_sections and change
8161 interface to take a vector of relaxed section pointers.
8162 (Output_section::find_merge_section,
8163 Output_section::find_relaxed_input_section,
8164 Output_section::build_relaxation_map,
8165 Output_section::convert_input_sections_in_list_to_relaxed_sections):
8166 New method declarations.
8167 (Output_section::merge_section_map_
8168 Output_section::merge_section_by_properties_map_,
8169 Output_section::relaxed_input_section_map_,
8170 Output_section::is_relaxed_input_section_map_valid_,
8171 Output_section::generate_code_fills_at_write_): New data members.
8172 * script-sections.cc
8173 (Output_section_element_input::set_section_addresses): Call
8174 current_data_size and addralign methods of relaxed input sections.
8175 (Orphan_output_section::set_section_addresses): Call current_data_size
8176 and addralign methods of relaxed input sections.
8177 * symtab.cc (Symbol_table::compute_final_value): Extract template
8178 from the body of Symbol_table::sized_finalize_symbol.
8179 (Symbol_table::sized_finalized_symbol): Call
8180 Symbol_table::compute_final_value.
8181 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
8182 (Symbol_table::compute_final_value): New templated method declaration.
8183 * target.cc (Target::do_make_output_section): New method defintion.
8184 * target.h (Target::make_output_section): New method declaration.
8185 (Target::relax): Add more parameters for input objects, symbol table
8186 and layout. Adjust call to do_relax.
8187 (Target::do_make_output_section): New method declaration.
8188 (Target::do_relax): Add parameters for input objects, symbol table
8191 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8193 * pread.c: Include stdio.h.
8195 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8197 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
8200 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8202 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8203 Change read_shndx type to unsigned int.
8204 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8206 (Sized_dwarf_line_info::read_line_mappings): Likewise.
8207 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
8208 Change read_shndx type to unsigned int.
8209 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8211 (Sized_dwarf_line_info::read_line_mappings): Likewise.
8212 * layout.cc (Layout::create_symtab_sections): Cast the result of
8213 local_symcount * symsize to off_t in the gold_assert.
8215 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8217 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
8218 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
8220 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
8221 (Arm_relocate_functions::thm_abs5): New function.
8222 (Arm_relocate_functions::abs12): New function.
8223 (Arm_relocate_functions::abs16): New function.
8224 (Arm_relocate_functions::base_abs): New function.
8225 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
8226 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
8227 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
8229 (Scan::global): Likewise.
8230 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
8231 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
8232 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
8233 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
8236 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8238 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
8239 (Arm_relocate_functions::movt_prel): New function.
8240 (Arm_relocate_functions::thm_movw_prel_nc): New function.
8241 (Arm_relocate_functions::thm_movt_prel): New function.
8242 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8243 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8244 (Scan::global, Relocate::relocate): Likewise.
8245 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8247 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8249 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8250 Incremental_checker.
8251 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8253 (class Incremental_inputs_header): New class.
8254 (Incremental_inputs_header_writer): Edit comment.
8255 (Incremental_inputs_entry): New class.
8256 (Incremental_inputs_entry_writer): Edit comment.
8257 (Sized_incremental_binary::do_find_incremental_inputs_section):
8258 Add *strtab_shndx parameter, fill it.
8259 (Sized_incremental_binary::do_check_inputs): New method.
8260 (Incremental_checker::can_incrementally_link_output_file): Use
8261 Sized_incremental_binary::check_inputs.
8262 (Incremental_inputs::report_command_line): Save command line in
8265 (Incremental_binary::find_incremental_inputs_section): New
8267 (Incremental_binary::do_find_incremental_inputs_section): Add
8268 strtab_shndx parameter.
8269 (Incremental_binary::do_check_inputs): New pure virtual method.
8270 (Sized_incremental_binary::do_check_inputs): Declare.
8271 (Incremental_checker::Incremental_checker): Add incremental_inputs
8272 parameter, use it to initialize incremental_inputs_.
8273 (Incremental_checker::incremental_inputs_): New field.
8274 (Incremental_checker::command_line): New method.
8275 (Incremental_checker::inputs): New method.
8276 (Incremental_checker::command_line_): New field.
8278 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8280 * incremental.cc: Include <cstdarg> and "target-select.h".
8281 (vexplain_no_incremental): New function.
8282 (explain_no_incremental): New function.
8283 (Incremental_binary::error): New method.
8284 (Sized_incremental_binary::do_find_incremental_inputs_section): New
8286 (make_sized_incremental_binary): New function.
8287 (open_incremental_binary): New function.
8288 (can_incrementally_link_file): Add checks if output is ELF and has
8290 * incremental.h: Include "elfcpp_file.h" and "output.h".
8291 (Incremental_binary): New class.
8292 (Sized_incremental_binary): New class.
8293 (open_incremental_binary): Declare.
8294 * object.cc (is_elf_object): Use
8295 elfcpp::Elf_recognizer::is_elf_file.
8296 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
8297 * output.h (Output_file::filesize): New method.
8299 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8301 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
8303 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
8304 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
8306 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
8308 (Arm_relocate_functions::movw_abs_nc): New function.
8309 (Arm_relocate_functions::movt_abs): New function.
8310 (Arm_relocate_functions::thm_movw_abs_nc): New function.
8311 (Arm_relocate_functions::thm_movt_abs): New function.
8312 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
8313 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
8314 (Scan::global): Likewise.
8315 (Relocate::relocate): Likewise.
8316 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8318 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8320 * arm.cc (Arm_relocate_functions::got_prel) New function.
8321 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
8322 (Relocate::relocate): Likewise.
8323 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8325 2009-10-06 Ian Lance Taylor <iant@google.com>
8327 * options.h (class General_options): Define
8328 split_stack_adjust_size parameter.
8329 * object.h (class Object): Add uses_split_stack_ and
8330 has_no_split_stack_ fields. Add uses_split_stack and
8331 has_no_split_stack accessor functions. Declare
8332 handle_split_stack_section.
8333 (class Reloc_symbol_changes): Define.
8334 (class Sized_relobj): Define Function_offsets. Declare
8335 split_stack_adjust, split_stack_adjust_reltype, and
8337 * object.cc (Object::handle_split_stack_section): New function.
8338 (Sized_relobj::do_layout): Call handle_split_stack_section.
8339 * dynobj.cc (Sized_dynobj::do_layout): Call
8340 handle_split_stack_section.
8341 * reloc.cc (Sized_relobj::relocate_sections): Call
8342 split_stack_adjust for executable sections in split_stack
8343 objects. Pass reloc_map to relocate_section.
8344 (Sized_relobj::split_stack_adjust): New function.
8345 (Sized_relobj::split_stack_adjust_reltype): New function.
8346 (Sized_relobj::find_functions): New function.
8347 * target-reloc.h: Include "object.h".
8348 (relocate_section): Add reloc_symbol_changes parameter. Change
8350 * target.h (class Target): Add calls_non_split method. Declare
8351 do_calls_non_split virtual method. Declare match_view and
8353 * target.cc: Include "elfcpp.h".
8354 (Target::do_calls_non_split): New function.
8355 (Target::match_view): New function.
8356 (Target::set_view_to_nop): New function.
8357 * gold.cc (queue_middle_tasks): Give an error if mixing
8358 split-stack and non-split-stack objects with -r.
8359 * i386.cc (Target_i386::relocate_section): Add
8360 reloc_symbol_changes parameter.
8361 (Target_i386::do_calls_non_split): New function.
8362 * x86_64.cc (Target_x86_64::relocate_section): Add
8363 reloc_symbol_changes parameter.
8364 (Target_x86_64::do_calls_non_split): New function.
8365 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
8367 * powerpc.cc (Target_powerpc::relocate_section): Add
8368 reloc_symbol_changes parameter.
8369 * sparc.cc (Target_sparc::relocate_section): Add
8370 reloc_symbol_changes parameter.
8371 * configure.ac: Call AM_CONDITIONAL for the default target.
8372 * configure: Rebuild.
8373 * testsuite/Makefile.am (TEST_AS): New variable.
8374 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
8375 (check_DATA): Add split_i386 and split_x86_64 files.
8376 (SPLIT_DEFSYMS): Define.
8377 (split_i386_[1234n].o): New targets.
8378 (split_i386_[124]): New targets.
8379 (split_i386_[1234r].stdout): New targets.
8380 (split_x86_64_[1234n].o): New targets.
8381 (split_x86_64_[124]): New targets.
8382 (split_x86_64_[1234r].stdout): New targets.
8383 (MOSTLYCLEANFILES): Add new executables.
8384 * testsuite/split_i386.sh: New file.
8385 * testsuite/split_x86_64.sh: New file.
8386 * testsuite/split_i386_1.s: New file.
8387 * testsuite/split_i386_2.s: New file.
8388 * testsuite/split_i386_3.s: New file.
8389 * testsuite/split_i386_4.s: New file.
8390 * testsuite/split_i386_n.s: New file.
8391 * testsuite/split_x86_64_1.s: New file.
8392 * testsuite/split_x86_64_2.s: New file.
8393 * testsuite/split_x86_64_3.s: New file.
8394 * testsuite/split_x86_64_4.s: New file.
8395 * testsuite/split_x86_64_n.s: New file.
8396 * testsuite/testfile.cc (Target_test): Update relocation_section
8398 * testsuite/Makefile.in: Rebuild.
8400 2009-10-06 Ian Lance Taylor <iant@google.com>
8402 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
8403 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
8404 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
8405 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
8406 the address on ldo_addrs_.
8407 (Target_i386::Relocate::fix_up_ldo): New function.
8409 2009-10-06 Rafael Espindola <espindola@google.com>
8411 * plugin.cc (add_input_library): New.
8412 (Plugin::load): Add add_input_library to tv.
8413 (Plugin_manager::add_input_file): Add the is_lib argument.
8414 (add_input_file): Update call to Plugin_manager::add_input_file.
8415 (add_input_library): New.
8416 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
8418 2009-09-30 Doug Kwan <dougkwan@google.com>
8420 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
8421 symbol and call Symbol::may_need_copy_reloc to determine if
8422 a copy reloc is needed.
8423 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
8424 nocopyreloc is given in command line.
8425 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
8426 given in command line.
8427 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
8428 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
8429 of the removed Target_i386::may_need_copy_reloc.
8430 * options.h (copyreloc): New option with default value false.
8431 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8432 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
8433 instead of the removed Target_powerpc::may_need_copy_reloc.
8434 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8435 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
8436 instead of the removed Target_sparc::may_need_copy_reloc.
8437 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
8438 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
8439 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
8440 instead of the removed Target_x86_64::may_need_copy_reloc.
8442 2009-09-30 Ian Lance Taylor <iant@google.com>
8444 * object.h (class Object): Remove target_ field, and target,
8445 sized_target, and set_target methods.
8446 (Object::sized_target): Remove.
8447 (class Sized_relobj): Update declarations. Remove sized_target.
8448 * object.cc (Sized_relobj::setup): Remove target parameter.
8450 (Input_objects::add_object): Don't do anything with the target.
8451 (make_elf_sized_object): Add punconfigured parameter. Change all
8452 callers. Set or test parameter target.
8453 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
8455 * parameters.cc (Parameters::set_target): Change parameter type to
8457 (Parameters::default_target): Remove.
8458 (set_parameters_target): Change parameter type to be non-const.
8459 (parameters_force_valid_target): New function.
8460 (parameters_clear_target): New function.
8461 * parameters.h (class Parameters): Update declarations. Remove
8462 default_target method. Add sized_target and clear_target
8463 methods. Change target_ to be non-const.
8464 (set_parameters_target): Update declaration.
8465 (parameters_force_valid_target): Declare.
8466 (parameters_clear_target): Declare.
8467 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
8468 as NULL if we aren't searching.
8469 (Add_symbols::run): Don't check for compatible target.
8470 * fileread.cc (Input_file::open_binary): Call
8471 parameters_force_valid_target.
8472 * gold.cc (queue_middle_tasks): Likewise.
8473 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
8474 set_target on object.
8475 * dynobj.h (class Sized_dynobj): Update declarations.
8476 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
8477 make_elf_object returns NULL.
8478 (Archive::include_member): Don't check whether object target is
8480 * output.cc (Output_section::add_input_section): Get target from
8482 (Output_section::relax_input_section): Likewise.
8483 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
8485 (Sized_relobj::do_scan_relocs): Likewise.
8486 (Sized_relobj::relocate_sections): Likewise.
8487 * resolve.cc (Symbol_table::resolve): Likewise.
8488 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
8489 parameter. Change all callers.
8490 (Symbol_table::add_from_object): Get target from parameters.
8491 (Symbol_table::add_from_relobj): Don't check object target.
8492 (Symbol_table::add_from_dynobj): Likewise.
8493 (Symbol_table::define_special_symbol): Get target from
8495 * symtab.h (class Symbol_table): Update declaration.
8496 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
8497 parameter. Change all callers. Clear parameter target.
8498 (Binary_test): Test target here.
8499 * testsuite/object_unittest.cc (gold_testsuite): Remove
8500 target_test_pointer parameter. Change all callers.
8501 (Object_test): Test target here.
8503 2009-09-26 Ian Lance Taylor <iant@google.com>
8505 * testsuite/initpri1.c: Don't try to use constructor priorities if
8506 compiling with gcc before 4.3.
8508 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
8510 * testsuite/retain_symbols_file_test.sh (check_present): Change
8511 output file name to retain_symbols_file_test.stdout.
8512 (check_absent): Likewise.
8514 2009-09-18 Craig Silverstein <csilvers@google.com>
8516 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
8517 * options.cc: Include <cerrno> and <fstream>.
8518 (General_options::finalize): Parse -retain-symbols-file tag.
8519 * options.h: New flag.
8520 (General_options): New method should_retain_symbol, new
8521 variable symbols_to_retain.
8522 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
8523 should_retain_symbol map.
8524 * testsuite/Makefile.am (retain_symbols_file_test): New test.
8525 * testsuite/Makefile.in: Regenerate.
8526 * testsuite/retain_symbols_file_test.sh: New file.
8528 2009-09-18 Nick Clifton <nickc@redhat.com>
8530 * po/es.po: Updated Spanish translation.
8532 2009-09-17 Doug Kwan <dougkwan@google.com>
8534 * debug.h (DEBUG_RELAXATION): New constant.
8535 (DEBUG_ALL): Add DEBUG_RELAXATION.
8536 (debug_string_to_enum): Add relaxation debug option.
8538 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
8539 Layout::Relaxation_debug_check::read_sections,
8540 Layout::Relaxation_debug_check::read_sections): New method definitions.
8541 (Layout::Layout): Initialize data members
8542 record_output_section_data_from_scrips_,
8543 script_output_section_data_list_ and relaxation_debug_check_.
8544 (Layout::save_segments, Layout::restore_segments,
8545 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8546 Layout::relaxation_loop_body): New method definitions.
8547 (Layout::finalize): Support relaxation. Move section layout code to
8548 Layout::relaxation_loop_body.
8549 (Layout::set_asection_address_from_script): Move code for orphan
8550 section placement out.
8551 (Layout::place_orphan_sections_in_script): New method definition.
8552 * layout.h (Output_segment_headers, Output_file_header):
8553 New forward class declarations.
8554 (Layout::~Layout): Define.
8555 (Layout::new_output_section_data_from_script): New method definition.
8556 (Layout::place_orphan_sections_in_script): New method declaration.
8557 (Layout::Segment_states): New type declaration.
8558 (Layout::save_segments, Layout::restore_segments,
8559 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8560 Layout::relaxation_loop_body): New method declarations.
8561 (Layout::Output_section_data_list): New type declaration.
8562 (Layout::Relaxation_debug_check): New class definition.
8563 (Layout::record_output_section_data_from_script_,
8564 Layout::script_output_section_data_list_, Layout::segment_states_,
8565 Layout::relaxation_debug_check_): New data members.
8566 * output.cc: (Output_section_headers::do_size): New method definition.
8567 (Output_section_headers::Output_section_headers): Move size
8568 computation to Output_section_headers::do_size.
8569 (Output_segment_headers::do_size): New method definition.
8570 (Output_file_header::Output_file_header): Move size computation to
8571 Output_file_header::do_size and call it.
8572 (Output_file_header::do_size): New method definition.
8573 (Output_data_group::Output_data_group): Adjust call to
8574 Output_section_data.
8575 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
8576 (Output_symtab_xindex::do_write): Add array bound check.
8577 (Output_section::Input_section::print_to_mapfile): Handle
8578 RELAXED_INPUT_SECTION_CODE.
8579 (Output_section::Output_section): Initialize data member checkpoint_.
8580 (Output_section::~Output_section): Delete checkpoint object pointed
8582 (Output_section::add_input_section): Always add an Input_section if
8584 (Output_section::add_merge_input_section): Add assert.
8585 (Output_section::relax_input_section): New method definition.
8586 (Output_section::set_final_data_size): Set load address to zero for
8587 an unallocated section.
8588 (Output_section::do_address_and_file_offset_have_reset_values):
8589 New method definition.
8590 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
8591 Handle relaxed input section.
8592 (Output_section::sort_attached_input_sections): Checkpoint input
8593 section list lazily.
8594 (Output_section::get_input_sections): Change type of input_sections to
8595 list of Simple_input_section pointers. Checkpoint input section list
8596 lazily. Also handle relaxed input sections.
8597 (Output_section::add_input_section_for_script): Take a reference to
8598 a Simple_input_section object instead of Relobj pointer and section
8599 index as parameter. Handle relaxed input sections.
8600 (Output_section::save_states, Output_section::restore_states): New
8602 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
8603 (Output_data::is_data_size_fixed): New method definition.
8604 (Output_data::reset_addresss_and_file_offset): Do not reset data size
8606 (Output_data::address_and_file_offset_have_reset_values): New method
8608 (Output_data::do_address_and_file_offset_have_reset_values): New method
8610 (Output_data::set_data_size): Check that data size is not fixed.
8611 (Output_data::fix_data_size): New method definition.
8612 (Output_data::is_data_size_fixed_): New data member.
8613 (Output_section_headers::set_final_data_size): New method definition.
8614 (Output_section_headers::do_size): New method declaration.
8615 (Output_segment_headers::set_final_data_size): New method definition.
8616 (Output_segment_headers::do_size): New method declaration.
8617 (Output_file_header::set_final_data_size)::New method definition.
8618 (Output_file_header::do_size)::New method declaration.
8619 (Output_section_data::Output_section_data): Add new parameter
8620 is_data_size_fixed and use it to fix data size.
8621 (Output_data_const::Output_data_const): Adjust call to base class
8622 constructor and fix data size.
8623 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
8624 base class constructor and fix data size.
8625 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
8626 base class constructor and fix data size.
8627 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
8628 class constructor and fix data size.
8629 (Output_data_group::set_final_data_size): New method definition.
8630 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
8631 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
8632 class constructor and fix data size.
8633 (Output_relaxed_input_section): New class definition.
8634 (Output_section::Simple_input_section): New class definition.
8635 (Output_section::get_input_sections): Adjust parameter list.
8636 (Output_section::add_input_section_for_script): Same.
8637 (Output_section::save_states, Output_section::restore_states,
8638 Output_section::do_address_and_file_offset_have_reset_values,
8639 (Output_section::Input_section::Input_section): Handle
8640 RELAXED_INPUT_SECTION_CODE. Add new overload for
8641 Output_relaxed_input_section.
8642 (Output_section::Input_section::is_input_section,
8643 Output_section::Input_section::set_output_section): Handle relaxed
8645 (Output_section::Input_section::is_relaxed_input_section,
8646 Output_section::Input_section::output_section_data,
8647 Output_section::Input_section::relaxed_input_section): New method
8649 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
8651 (Output_section::Input_section::u1_): Update comments.
8652 (Output_section::Input_section::u2_): Add new union member poris.
8653 (Output_section::Checkpoint_output_section): New classs definition.
8654 (Output_section::relax_input_section): New method declaration.
8655 (Output_section::checkpoint_): New data member.
8656 (Output_segment): Update comments.
8657 (Output_segment::Output_segment): Un-privatize copy constructor.
8658 (Output_segment::operator=): Un-privatize.
8659 * script-sections.cc (Output_section_element::Input_section_list):
8660 Change element type to Output_section::Simple_input_section.
8661 (Output_section_element_dot_assignment::set_section_addresses):
8662 Register output section data for relaxation clean up.
8663 (Output_data_exression::Output_data_expression): Adjust call to base
8664 constructor to fix data size.
8665 (Output_section_element_data::set_section_addresses): Register
8666 Output_data_expression object for relaxation clean up.
8667 (struct Input_section_info): Replace Relobj pointer and section index
8668 pair with Output_section::Simple_input_section and Convert struct to a
8670 (Input_section_sorter::operator()): Adjust access to
8671 Input_section_info data member to use accessors.
8672 (Output_section_element_input::set_section_addresses): Use layout
8673 parameter. Adjust code to use Output_section::Simple_input_section
8674 and Input_secction_info classes. Register filler for relaxation
8676 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
8677 and section index pair with Output_section::Simple_input_section
8678 class. Adjust code accordingly.
8679 (Phdrs_element::release_segment): New method definition.
8680 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
8682 (Script_sections::release_segments): New method definition.
8683 * gold/script-sections.h (Script_sections::release_segments): New
8685 * gold/target.h (Target::may_relax, Target::relax,
8686 Target::do_may_relax, Target::do_relax): New method definitions.
8688 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8690 * arm.cc (has_signed_unsigned_overflow): New function.
8691 (Arm_relocate_functions::abs8): New function.
8692 (Target_arm::Scan::local): Handle R_ARM_ABS8.
8693 (Target_arm::Scan::global): Likewise.
8694 (Target_arm::relocate::relocate): Likewise.
8695 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8698 2009-09-16 Cary Coutant <ccoutant@google.com>
8700 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
8701 * testsuite/Makefile.in: Regenerate.
8703 2009-09-11 Nick Clifton <nickc@redhat.com>
8705 * po/gold.pot: Updated by the Translation project.
8707 2009-09-08 Cary Coutant <ccoutant@google.com>
8709 * output.cc (Output_file::open): Add execute permission to empty file.
8710 * testsuite/Makefile.am (permission_test): New test.
8711 * testsuite/Makefile.in: Regenerate.
8713 2009-09-02 Ian Lance Taylor <iant@google.com>
8715 * output.cc (Output_file::resize): Call map_no_anonymous rather
8718 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
8720 * gold.cc: Include "incremental.h".
8721 (queue_initial_tasks): Call Incremental_checker methods.
8722 * incremental.cc: Include "output.h".
8723 (Incremental_checker::can_incrementally_link_output_file): New
8725 * incremental.h (Incremental_checker): New class.
8727 * output.cc (Output_file::open_for_modification): New method.
8728 (Output_file::map_anonymous): Changed return type to bool. Record
8730 (Output_file::map_no_anonymous): New method, broken out of map.
8731 (Output_file::map): Use map_no_anonymous and map_anonymous.
8732 * output.h (class Output_file): Update declarations.
8734 2009-08-24 Cary Coutant <ccoutant@google.com>
8736 * options.h (Command_line::Pre_options): New class.
8737 (Command_line::pre_options): New member.
8738 * options.cc (gold::options::ready_to_register): New variable.
8739 (One_option::register_option): Do nothing if not registering options.
8740 Assert if same short option registered twice.
8741 (General_options::General_options): Turn off option registration when
8743 (Command_line::Pre_options::Pre_options): New constructor.
8745 2009-08-24 Cary Coutant <ccoutant@google.com>
8747 * options.h (General_options::no_keep_memory): Remove incorrect
8750 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8752 * Makefile.am (am__skiplex, am__skipyacc): New.
8753 * Makefile.in: Regenerate.
8755 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8757 * Makefile.am (AM_CPPFLAGS): Renamed from ...
8758 (INCLUDES): ... this.
8759 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
8760 (AM_CPPFLAGS): Renamed from ...
8761 (INCLUDE): ... this.
8762 * Makefile.in, testsuite/Makefile.in: Regenerate.
8764 * Makefile.in: Regenerate.
8765 * aclocal.m4: Likewise.
8766 * config.in: Likewise.
8767 * configure: Likewise.
8768 * testsuite/Makefile.in: Likewise.
8770 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8771 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8772 * Makefile.in: Regenerate.
8773 * testsuite/Makefile.in: Regenerate.
8775 2009-08-19 Cary Coutant <ccoutant@google.com>
8777 * resolve.cc (Symbol_table::resolve): Don't complain about defined
8778 symbols in shared libraries overridden by hidden or internal symbols
8779 in the main program.
8781 2009-08-19 Chris Demetriou <cgd@google.com>
8783 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
8784 checking source file names in error messages.
8786 2009-08-18 Doug Kwan <dougkwan@google.com>
8788 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
8789 an elcpp::Ehdr as parameter. Adjust call to set_target.
8790 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
8791 an elfcpp::Ehdr as parameter.
8792 * object.cc (Object::set_target): Remove the version that looks up
8793 a target and sets it.
8794 (Sized_relobj::setup): Take a Target object instead of
8795 an elfcpp::Ehdr as parameter. Adjust call to set_target.
8796 (make_elf_sized_object): Find target and ask target to
8798 * object.h: (Object::set_target): Remove the version that looks up
8799 a target and sets it.
8800 (Sized_relobj::setup): Take a Target object instead of
8801 an elfcpp:Ehdr as parameter.
8802 * target.cc: Include dynobj.h.
8803 (Target::do_make_elf_object_implementation): New.
8804 (Target::do_make_elf_object): New.
8805 * target.h (Target::make_elf_object): New template declaration.
8806 (Target::do_make_elf_object): New method declarations.
8807 (Target::do_make_elf_object_implementation): New template declaration.
8809 2009-08-14 Ian Lance Taylor <iant@google.com>
8811 * gold.h (FUNCTION_NAME): Define.
8812 (gold_unreachable): Use FUNCTION_NAME.
8814 2009-08-12 Sriraman Tallam <tmsriram@google.com>
8816 * icf.cc (Icf::find_identical_sections): Issue a warning when a
8817 symbol in the --keep-unique list is not found.
8819 2009-08-12 Sriraman Tallam <tmsriram@google.com>
8821 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
8822 been maked as --keep-unique.
8823 (Icf::unfold_section): New function.
8824 * icf.h (Icf::unfold_section): New function.
8825 * options.h (General_options::keep_unique): New option.
8826 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
8827 * testsuite/Makefile.in: Regenerate.
8828 * testsuite/icf_keep_unique_test.sh: New file.
8829 * testsuite/icf_keep_unique_test.cc: New file.
8831 2009-08-12 Cary Coutant <ccoutant@google.com>
8834 * resolve.cc (Symbol_table::resolve): Check for references from
8835 dynamic objects to hidden and internal symbols.
8836 * testsuite/Makefile.am (hidden_test.sh): New test.
8837 * testsuite/Makefile.in: Regenerate.
8838 * testsuite/hidden_test.sh: New script.
8839 * testsuite/hidden_test_1.c: New test source.
8840 * testsuite/hidden_test_main.c: New test source.
8842 2009-08-11 Doug Kwan <dougkwan@google.com>
8844 * arm.cc: Update comments.
8845 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
8846 segment to locate the .ARM.exidx section if present.
8848 2009-08-09 Doug Kwan <dougkwan@google.com>
8850 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
8853 2009-08-07 Sriraman Tallam <tmsriram@google.com>
8854 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
8857 2009-08-06 Sriraman Tallam <tmsriram@google.com>
8859 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
8860 valid tls_segment only for non-debug-section relocations.
8861 * testsuite/Makefile.am: Add gc_tls_test.
8862 * testsuite/Makefile.in: Regenerate.
8863 * testsuite/gc_tls_test.cc: New file.
8864 * testsuite/gc_tls_test.sh: New file.
8866 2009-08-05 Sriraman Tallam <tmsriram@google.com>
8870 * Makefile.am (CCFILES): Add icf.cc.
8872 * Makefile.in: Regenerate.
8873 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
8874 * gc.h (gc_process_relocs): Populate lists used by icf to contain
8875 section, symbol and addend information for the relocs.
8876 * gold.cc (queue_middle_tasks): Call identical code folding.
8877 * gold.h: Add defines for multimap.
8878 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
8879 to the call of finalize_local_symbols.
8880 * main.cc (main): Create object of class Icf.
8881 * object.cc (Sized_relobj::do_layout): Allow this function to be
8882 called twice during icf.
8883 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
8884 to sections marked as identical by icf.
8885 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
8887 (Sized_relobj::do_section_entsize): New function.
8888 * object.h (Object::section_entsize): New function.
8889 (Object::do_section_entsize): New pure virtual function.
8890 (Relobj::finalize_local_symbols): Add new parameter.
8891 (Relobj::do_section_entsize): New function.
8892 * options.h (General_options::icf): New option.
8893 (General_options::icf_iterations): New option.
8894 (General_options::print_icf_sections): New option.
8895 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
8896 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
8897 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
8899 * symtab.cc (Symbol_table::is_section_folded): New function.
8900 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
8901 to sections marked as identical by icf.
8902 * symtab.h (Symbol_table::set_icf): New function.
8903 (Symbol_table::icf): New function.
8904 (Symbol_table::is_section_folded): New function.
8905 (Symbol_table::icf_): New data member.
8906 * target-reloc.h (relocate_section): Ignore sections folded by icf.
8907 * testsuite/Makefile.am: Add commands to build icf_test.
8908 * testsuite/Makefile.in: Regenerate.
8909 * testsuite/icf_test.sh: New file.
8910 * testsuite/icf_test.cc: New file.
8912 2009-07-24 Chris Demetriou <cgd@google.com>
8914 * layout.cc (is_compressible_debug_section): Fix incorrect
8915 comment about compressed section names.
8917 2009-07-20 Ian Lance Taylor <ian@airs.com>
8920 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
8922 2009-07-16 Ian Lance Taylor <iant@google.com>
8925 * layout.h: #include <map>.
8926 (class Kept_section): Change from struct to class. Add accessors
8927 and setters. Add section size to Comdat_group mapping. Change
8928 Comdat_group to std::map. Add is_comdat_ field. Add
8929 linkonce_size field in union.
8930 (class Layout): Update declaration of find_or_add_kept_section.
8931 Don't declare find_kept_object.
8932 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
8933 parameter. Add object, shndx, is_comdat, and is_group_name
8934 parameters. Change all callers. Adjust for new Kept_section.
8935 (Layout::find_kept_object): Remove.
8936 * object.cc (Sized_relobj::include_section_group): Update use of
8937 Kept_section. Rename secnum to shndx. Only record
8938 Kept_comdat_section if sections are the same size.
8939 (Sized_relobj::include_linkonce_section): Update use of
8940 Kept_section. Only record Kept_comdat_section if sections are the
8941 same size. Set size of linkonce section.
8942 (Sized_relobj::map_to_kept_section): Update call to
8943 get_kept_comdat_section.
8944 * object.h (class Sized_relobj): Rename fields in
8945 Kept_comdat_section to drop trailing underscores; change object
8946 field to Relobj*. Change Kept_comdat_section_table to store
8947 struct rather than pointer.
8948 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
8949 Add kept_object and kept_shndx parameters. Change all callers.
8950 (Sized_relobj::get_kept_comdat_section): Change return type to
8951 bool. Add kept_object and kept_shndx parameters. Change all
8953 * plugin.cc (Pluginobj::include_comdat_group): Update call to
8954 Layout::find_or_add_kept_section.
8956 2009-07-09 Ian Lance Taylor <iant@google.com>
8958 * merge.cc (Object_merge_map::initialize_input_to_output_map):
8959 Reserve space in the hash table.
8961 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
8963 * fileread.cc (File_read::get_mtime): New method.
8964 * fileread.h (Timespec): New structure.
8965 (File_read::get_mtime): New method.
8966 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
8967 Renamed from timestamp_nsec.
8968 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
8970 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
8972 (Incremental_inputs::report_archive): Save mtime; style fix.
8973 (Incremental_inputs::report_obejct): Save mtime; style fix.
8974 (Incremental_inputs::report_script): Save mtime; style fix.
8975 (Incremental_inputs::finalize_inputs): Style fix.
8976 (Incremental_inputs::finalize): Style fix.
8977 (Incremental_inputs::create_input_section_data): Store inputs
8979 * incremental.h (Incremental_inputs::report_script): Add mtime
8981 (Incremental_inputs::Input_info::Input_info): Intialize only one
8983 (Incremental_inputs::Input_info::archive): Move to nameless
8985 (Incremental_inputs::Input_info::obejct): Move to nameless union.
8986 (Incremental_inputs::Input_info::script): Move to nameless union.
8987 (Incremental_inputs::mtime): New field.
8988 * script.cc (read_input_script): Pass file mtime to
8990 * script.h (Script_info::inputs): Style fix.
8992 2009-07-01 Ian Lance Taylor <ian@airs.com>
8994 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
8997 2009-06-24 Ian Lance Taylor <iant@google.com>
9000 * layout.cc (Layout::choose_output_section): If we find an
9001 existing section, update the flags.
9002 (Layout::create_notes): New function, broken out of
9004 (Layout::finalize): Don't create note sections.
9005 (Layout::create_note): Don't crash if linker script discards
9007 (Layout::create_gold_note): Likewise.
9008 (Layout::create_build_id): Likewise. Don't set
9009 after_input_sections on the section.
9010 (Layout::create_executable_stack_info): Remove target parameter.
9012 * layout.h (class Layout): Declare create_notes. Update
9013 declaration of create_executable_stack_info.
9014 * gold.cc (queue_middle_tasks): Call create_notes.
9015 * output.cc (Output_section::update_flags_for_input_section): Move
9016 here from output.h. If SHF_ALLOC flag is newly set, mark address
9018 * output.h (Output_data::mark_address_invalid): New function.
9019 (class Output_section): Only declare, not define,
9020 update_flags_for_input_section. Remove set_flags.
9022 2009-06-24 Ian Lance Taylor <iant@google.com>
9024 * script-sections.cc (Output_section_definition::
9025 set_section_addresses): Rename shadowing local load_address to
9028 2009-06-24 Ian Lance Taylor <iant@google.com>
9031 * reloc.cc (relocate_sections): Skip empty relocation sections.
9033 2009-06-23 Ian Lance Taylor <iant@google.com>
9036 * layout.cc (Layout::create_note): Use choose_output_section
9037 rather than make_output_section.
9039 2009-06-23 Ian Lance Taylor <iant@google.com>
9042 * options.cc (General_options::parse_V): Set printed_version_.
9043 (General_options::General_options): Initialize printed_version_.
9044 * options.h (class General_options): Add printed_version_ field.
9045 * gold.cc (queue_initial_tasks): If there are no input files,
9046 don't give a fatal error if we printed the version information.
9047 (queue_middle_tasks): If using -r with a shared object, give a
9048 fatal error rather than an ordinary error.
9050 2009-06-23 Ian Lance Taylor <iant@google.com>
9053 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
9054 (Layout::make_output_section): Set have_stabstr_section_ if we see
9055 a .stab*str section.
9056 (Layout::finalize): Call link_stabs_sections.
9057 (Layout::link_stabs_sections): New file.
9058 * layout.h (class Layout): Add have_stabstr_section_ field.
9059 Declare link_stabs_sections.
9061 2009-06-23 Doug Kwan <dougkwan@google.com>
9063 * Makefile.am (libgold_a_LIBADD): New.
9064 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
9065 * Makefile.in: Regenerate.
9066 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
9067 * configure: Regenerate.
9068 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
9069 * fileread.cc: Include sys/state.h
9070 * gold.h: Declare memmem and strndup if found missing.
9071 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
9073 2009-06-23 Ian Lance Taylor <iant@google.com>
9075 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
9076 * configure: Rebuild.
9078 2009-06-23 Ian Lance Taylor <iant@google.com>
9081 * object.cc (Object::section_contents): Don't try to get a view if
9082 the section has length zero.
9083 (Object::handle_gnu_warning_section): If the section is empty, use
9084 the name of the section as the warning.
9086 2009-06-23 Ian Lance Taylor <iant@google.com>
9089 * stringpool.h (class Stringpool_template): Add optimize_ field.
9090 (Stringpool_template::set_optimize): New function.
9091 * stringpool.cc (Stringpool_template::Stringpool_template):
9092 Initialize optimize_ field.
9093 (Stringpool_template::set_string_offsets): Test local optimize
9094 fild rather than parameter.
9095 * layout.cc (Layout::Layout): Call set_optimize on the section
9098 2009-06-22 Ian Lance Taylor <iant@google.com>
9101 * yyscript.y: Parse TARGET.
9102 * script.cc (script_set_target): New function.
9103 * script-c.h (script_set_target): Declare.
9104 * options.cc (General_options::string_to_object_format): Rename
9105 from string_to_object_format in anonymous namespace. Change
9107 * options.h (class General_options): Declare
9108 string_to_object_format.
9110 2009-06-22 Ian Lance Taylor <iant@google.com>
9112 * script-sections.cc (Script_sections::create_segments): Don't put
9113 program headers in a PT_LOAD segment if -n or -N.
9115 2009-06-22 Ian Lance Taylor <iant@google.com>
9118 * options.h (class General_options): Add -z lazy and -z now. Sort
9119 -z options into alphabetical order.
9120 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
9122 2009-06-21 Ian Lance Taylor <iant@google.com>
9124 * layout.cc (Layout::make_output_section): Call
9125 Target::new_output_section.
9126 (Layout::attach_allocated_section_to_segment): Put large section
9127 sections in a separate load segment with the large segment flag
9129 (Layout::segment_precedes): Sort large data segments after other
9131 (align_file_offset): New static function.
9132 (Layout::set_segment_offsets): Use align_file_offset.
9133 * output.h (class Output_section): Add is_small_section_ and
9134 is_large_section_ fields.
9135 (Output_section::is_small_section): New function.
9136 (Output_section::set_is_small_section): New function.
9137 (Output_section::is_large_section): New function.
9138 (Output_section::set_is_large_section): New function.
9139 (Output_section::is_large_data_section): New function.
9140 (class Output_segment): Add is_large_data_segment_ field.
9141 (Output_segment::is_large_data_segment): New function.
9142 (Output_segment::set_is_large_data_segment): New function.
9143 * output.cc (Output_section::Output_section): Initialize new
9145 (Output_segment::Output_segment): Likewise.
9146 (Output_segment::add_output_section): Add assertion that large
9147 data sections always go in large data segments. Force small data
9148 sections to the end of the list of data sections. Force small BSS
9149 sections to the start of the list of BSS sections. For large BSS
9150 sections to the end of the list of BSS sections.
9151 * symtab.h (class Symbol): Declare is_common_shndx.
9152 (Symbol::is_defined): Check Symbol::is_common_shndx.
9153 (Symbol::is_common): Likewise.
9154 (class Symbol_table): Define enum Commons_section_type. Update
9155 declarations. Add small_commons_ and large_commons_ fields.
9156 * symtab.cc (Symbol::is_common_shndx): New function.
9157 (Symbol_table::Symbol_table): Initialize new fields.
9158 (Symbol_table::add_from_object): Put small and large common
9159 symbols in the right list.
9160 (Symbol_table::sized_finalized_symbol): Check
9161 Symbol::is_common_shndx.
9162 (Symbol_table::sized_write_globals): Likewise.
9163 * common.cc (Symbol_table::do_allocate_commons): Allocate new
9164 common symbol lists. Don't call do_allocate_commons_list if the
9166 (Symbol_table::do_allocate_commons_list): Remove is_tls
9167 parameter. Add comons_section_type parameter. Change all
9168 callers. Handle small and large common symbols.
9169 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
9170 Symbol::is_common_shndx.
9171 * resolve.cc (symbol_to_bits): Likewise.
9172 * target.h (Target::small_common_shndx): New function.
9173 (Target::small_common_section_flags): New function.
9174 (Target::large_common_shndx): New function.
9175 (Target::large_common_section_flags): New function.
9176 (Target::new_output_section): New function.
9177 (Target::Target_info): Add small_common_shndx, large_common_shndx,
9178 small_common_section_flags, and large_common_section_flags
9180 (Target::do_new_output_section): New virtual function.
9181 * arm.cc (Target_arm::arm_info): Initialize new fields.
9182 * i386.cc (Target_i386::i386_info): Likewise.
9183 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
9185 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
9186 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9187 (Target_x86_64::do_new_output_section): New function.
9188 * configure.ac: Define conditional MCMODEL_MEDIUM.
9189 * testsuite/Makefile.am (check_PROGRAMS): Add large.
9190 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
9191 (large_LDFLAGS): Define.
9192 * testsuite/large.c: New file.
9193 * testsuite/testfile.cc (Target_test::test_target_info):
9194 Initialize new fields.
9195 * configure, testsuite/Makefile.in: Rebuild.
9197 2009-06-05 Doug Kwan <dougkwan@google.com>
9199 * Makefile.am (CCFILES): Add target.cc.
9200 * Makefile.in: Regenerate.
9201 * i386.cc (class Target_i386): Define new virtual method to
9202 override do_is_local_label_name in parent.
9203 * object.cc (Sized_relobj::do_count_local_symbols): Discard
9204 local symbols if --discard-locals or -X is given.
9205 * options.h (class General_options): Declare new options
9206 '--discard-locals' and '-X' for discarding locals.
9207 * target.h (class Target): Define new methods is_local_label_name.
9208 Declare new virtual method do_is_local_label_name.
9209 * target.cc: New file.
9210 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
9211 (check_SCRIPTS): Add discard_locals_test.sh.
9212 (check_DATA): Add discard_local_tests.syms.
9213 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
9214 (discard_local_tests.syms, discard_locals_test.o): New make rules.
9215 * testsuite/Makefile.in: Regenerate.
9216 * testsuite/discard_locals_test.c: New file.
9217 * testsuite/discard_locals_test.sh: Same.
9219 2009-06-05 Doug Kwan <dougkwan@google.com>
9221 * object.cc (Sized_relobj::Sized_relobj): Initialize
9222 discarded_eh_frame_shndx_ to -1U.
9223 (Sized_relobj::do_layout): Record index of a discard .eh_frame
9225 (Sized_relobj::do_count_local_symbols): Skip local symbols in
9226 a discarded .eh_frame section.
9227 (Sized_relobj::do_finalize_local_symbols): Ditto.
9228 * object.h (class Sized_relobj): Declare new member
9229 discarded_eh_frame_shndx_.
9230 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
9231 (local_labels_test.o, local_labels_test): New rules.
9232 * testsuite/Makefile.in: Regenerate.
9234 2009-06-04 Doug Kwan <dougkwan@google.com>
9236 * layout.cc (Layout::section_name_mapping): Add mapping for
9237 special ARM sections.
9239 2009-06-03 Doug Kwan <dougkwan@google.com>
9241 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
9242 (utils::has_overflow): Same.
9244 2009-06-03 Ian Lance Taylor <iant@google.com>
9246 * layout.cc (Layout::section_name_mapping): New array, replacing
9247 Layout::linkonce_mapping.
9248 (Layout::section_name_mapping_count): New variable, replacing
9249 Layout::linkonce_mapping_count.
9250 (Layout::linkonce_output_name): Remove.
9251 (Layout::output_section_name): Rewrite.
9252 * layout.h (class Layout): Rename Linkonce_mapping to
9253 Section_name_mapping, linkonce_mapping to section_name_mapping,
9254 linkonce_mapping_count to section_name_mapping_count. Don't
9255 declare linkonce_output_name.
9257 2009-06-03 Doug Kwan <dougkwan@google.com>
9259 * gold/arm.cc (namespace utils): New.
9260 (Target_arm::reloc_is_non_pic): Define new method.
9261 (class Arm_relocate_functions): New.
9262 (Target_arm::Relocate::relocate): Handle relocation types used by
9265 2009-06-03 Ian Lance Taylor <iant@google.com>
9267 * arm.cc (Target_arm::scan::global): Use || instead of |.
9269 2009-06-02 Doug Kwan <dougkwan@google.com>
9271 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
9272 issued_non_pic_error_.
9273 (class Target_arm::Scan): Declare new method check_non_pic.
9274 Define new method symbol_needs_plt_entry.
9275 Declare new data member issued_non_pic_error_.
9276 (class Target_arm::Relocate): Declare new method
9277 should_apply_static_reloc.
9278 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9279 (Target_arm::Scan::check_non_pic): Define new method.
9280 (Target_arm::Scan::local): Handle a small subset of reloc types used
9282 (Target_arm::Scan::local): Same.
9283 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9285 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
9287 * incremental.cc (Incremental_inputs::report_command_line): Filter
9288 out --incremental-* options.
9290 2009-05-29 Doug Kwan <dougkwan@google.com>
9292 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9294 (class Target_arm): Update comment.
9295 (Target_arm::Target_arm): Initialize new data members GOT_,
9296 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
9297 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
9298 and Target_arm::rel_dyn_section.
9299 Declare new_enum Target_arm::Got_type.
9300 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
9302 Update commments for member do_dynsym_value.
9303 (Target_arm::got_size, Target_arm::plt_section,
9304 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
9305 new methods inside class defintion.
9306 (Target_arm::got_section): Define new method.
9307 (Target_arm::rel_dyn_section): Same.
9308 (Output_data_plt_arm): New template class.
9309 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
9310 (Output_data_plt_arm:do_adjust_output_section): Define new method.
9311 (Output_data_plt_arm::add_entry): Same.
9312 (Output_data_plt_arm::first_plt_entry): Define new
9313 static data member for PLT instruction template.
9314 (Output_data_plt_arm::plt_entry): Same.
9315 (Output_data_plt_arm::do_write): Define new method.
9316 (Target_arm::make_plt_entry): Same.
9317 (Target_arm::do_finalize_sections): Same.
9318 (Target_arm::do_dynsym_value): Same.
9320 2009-05-28 Doug Kwan <dougkwan@google.com>
9322 * Makefile.am (TARGETSOURCES): Add arm.cc.
9323 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
9324 * Makefile.in: Regenerate.
9326 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
9328 2009-05-26 Doug Kwan <dougkwan@google.com>
9330 * options.cc (General_options::parse_exclude_libs). Fix a comment.
9331 (General_options::check_excluded_libs): Strip off directories in
9332 archive name before matching like GNU ld does.
9333 * testsuite/Makefile.am (MOSTLYCLEANFILES,
9334 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
9335 (exclude_libs_test_LDFLAGS): Add linker option
9336 -Wl,--exclude-libs,libexclude_libs_test_3
9337 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
9338 an explicit archive without using -l.
9339 (alt/libexclude_libs_test_3.a): New make rule.
9340 * testsuite/Makefile.in: Regenerate.
9341 * testsuite/exclude_libs_test.c : Declare lib3_default().
9343 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
9344 * exclude_libs_test_3.c: New file.
9346 2009-05-26 Nick Clifton <nickc@redhat.com>
9348 * po/id.po: New Indonesian translation.
9349 * po/gold.pot: Updated template file.
9351 2009-05-22 Sriraman Tallam <tmsriram@google.com>
9353 * testsuite/Makefile.am: Add -ffunction-sections to compile
9354 gc_comdat_test files. Add -Wl,--gc-sections to build
9356 * testsuite/Makefile.in: Regenerate.
9357 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
9359 2009-05-21 Sriraman Tallam <tmsriram@google.com>
9361 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
9362 kept comdat section was garbage collected.
9363 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
9364 * testsuite/Makefile.in: Regenerate.
9365 * testsuite/gc_comdat_test.sh: New file.
9366 * testsuite/gc_comdat_test_1.cc: New file.
9367 * testsuite/gc_comdat_test_2.cc: New file.
9369 2009-05-19 Doug Kwan <dougkwan@google.com>
9371 * archive.cc (Archive::Archive): Move constructor from archive.h
9372 to here. Initialize no_export_.
9373 (Archive::get_elf_object_for_member): Set no_export flag of object.
9374 * archive.h (Archive::Archive): Move constructor body to
9376 (Archive::no_export): New method.
9377 (Archive::no_export_): New field.
9378 * object.h (Object::Object): Initialize no_export_ to false.
9379 (Object::no_export, Object::set_no_export): New methods.
9380 (Object::no_export_): New field.
9381 * options.cc (General_options::parse_exclude_libs): New method.
9382 (General_options::check_excluded_libs) Same.
9383 * options.h (exclude_libs): New option.
9384 (General_options::check_excluded_libs): New method declaration.
9385 (General_options::excluded_libs_): New field.
9386 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
9387 default or protected visibility if an object has no-export flag set.
9388 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
9389 (check_SCRIPTS): Add exclude_libs_test.sh.
9390 (check_DATA): Add exclude_libs_test.syms.
9391 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
9392 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
9393 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
9394 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
9395 (exclude_libs_test.syms, libexclude_libs_test_1.a,
9396 libexclude_libs_test_2.a): New rules.
9397 * testsuite/Makefile.in: Regenerate.
9398 * testsuite/exclude_libs_test.c: New file.
9399 * testsuite/exclude_libs_test.sh: Ditto.
9400 * testsuite/exclude_libs_test_1.c: Ditto.
9401 * testsuite/exclude_libs_test_2.c: Ditto.
9403 2009-05-15 Ian Lance Taylor <iant@google.com>
9405 * configure.ac: Check for declarations for cases where libiberty.h
9406 checks HAVE_DECL_xxx.
9407 * configure, config.in: Rebuild.
9409 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
9411 * gold.h (Incremental_argument_list): Remove (invalid) forward
9413 * incremental.cc (Incremental_inputs::report_achive): New method.
9414 (Incremental_inputs::report_object): New method.
9415 (Incremental_inputs::report_script): New method.
9416 (Incremental_inputs::finalize_inputs): New method.
9417 (Incremental_inputs::finalize): Call finalize_inputs().
9418 (Incremental_inputs::sized_create_incremental_inputs_section_data):
9419 Create inputs entries.
9420 * incremental.h (Incremental_input_type): New enum.
9421 (Incremental_inputs::Incremental_input): Initialize new fields.
9422 (Incremental_inputs::report_inputs): New method.
9423 (Incremental_inputs::report_achive): New method.
9424 (Incremental_inputs::report_object): New method.
9425 (Incremental_inputs::report_script): New method.
9426 (Incremental_inputs::finalize_inputs): New method.
9427 (Incremental_inputs::Input_info): New struct.
9428 (Incremental_inputs::Input_info_map): New typedef.
9429 (Incremental_inputs::lock_): New field.
9430 (Incremental_inputs::Inputs_): New field.
9431 (Incremental_inputs::Inputs_map): New field.
9432 * main.cc (main): Call Incremental_input::report_inputs.
9433 * options.h (Input_argument_list): Typedef moved from
9435 (Input_file_group::Files): Remove, use ::Input_argument_list.
9436 (Input_file_group::Input_argument_list): Remove, use
9437 ::Input_argument_list.
9438 * plugin.cc (Plugin_manager::add_input_file): Add error in
9440 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
9442 * script.cc (read_input_script): Call
9443 Incremental_input::report_script.
9444 * script.h (Script_info): New class.
9446 2009-04-27 Ian Lance Taylor <iant@google.com>
9448 * x86_64.cc (do_adjust_output_section): Set entsize to
9451 2009-04-23 Elliott Hughes <enh@google.com>
9453 * output.cc (Output_file::close): After short writes, continue
9454 writing from the correct offset in the buffer being written.
9456 2009-04-23 Chris Demetriou <cgd@google.com>
9458 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
9459 * configure: Regenerate.
9460 * config.in: Regenerate.
9461 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
9462 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
9464 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
9466 * incremental.cc (Incremental_inputs_header_data): Renamed from
9467 Incremental_input_header_data.
9468 (Incremental_inputs_header_data::data_size): New field.
9469 (Incremental_inputs_header_data::put_input_file_count): Renamed
9470 from input_file_count.
9471 (Incremental_inputs_header_data::put_command_line_offset): Renamed
9472 from command_line_offset.
9473 (Incremental_inputs_header_data::put_reserved): Renamed from
9475 (Incremental_inputs_entry_data): Renamed from
9476 Incremental_input_entry_data.
9477 (Incremental_inputs_entry_data::data_size): New field.
9478 (Incremental_inputs::report_command_line): New method.
9479 (Incremental_inputs::finalize): New method.
9480 (Incremental_inputs::create_incremental_inputs_data): New method.
9481 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
9482 * incremental.h: New file.
9483 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
9484 (Layout::finalize): Create incremental inputs section in
9486 (Layout::create_incremental_info_sections): New method.
9487 * layout.h (Layout::incremental_inputs): New method.
9488 (Layout::create_incremental_info_sections): New method.
9489 (Layout::incremental_inputs_): New field.
9490 * main.cc (main): Notify Incremental_input of the command line.
9492 2009-04-01 Ian Lance Taylor <iant@google.com>
9493 Mikolaj Zalewski <mikolajz@google.com>
9495 * gold.h (reserve_unordered_map): Define, three versions, one for
9496 each version of Unordered_map.
9497 * layout.cc (Layout::Layout): Remove options parameter. Add
9498 number_of_input_files parameter. Don't initialize options_.
9499 Initialize number_of_input_files_ and resized_signatures_. Move
9500 sections_are_attached_.
9501 (Layout::layout_group): Reserve space for group_signatures_.
9502 (Layout::find_or_add_kept_section): Change name parameter to be a
9503 reference. Resize signatures_ map when it gets large enough.
9504 (Layout::layout_eh_frame): Use parameters->options() instead of
9506 (Layout::make_output_section): Likewise.
9507 (Layout::attach_allocated_section_to_segment): Likewise.
9508 (Layout::finalize, Layout::create_executable_stack): Likewise.
9509 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
9510 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
9511 * layout.h (class Layout): Update declarations. Remove options_
9512 field. Add number_of_input_files_ and resized_signatures_
9513 fields. Move sections_are_attached_ field.
9514 * main.cc (main): Pass number of input files to Layout
9515 constructor. Don't pass options.
9517 2009-03-30 Ian Lance Taylor <iant@google.com>
9519 * ffsll.c (ffsll): Correct implementation.
9521 2009-03-27 Ian Lance Taylor <iant@google.com>
9523 * ffsll.c: New file.
9524 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
9525 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
9526 * ftruncate.c (ftruncate): Declare before definition.
9527 * mremap.c (mremap): Likewise.
9528 * pread.c (pread): Likewise.
9529 * configure, Makefile.in, config.in: Rebuild.
9531 * mremap.c: New file.
9532 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
9533 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
9534 (mremap): Declare if HAVE_MREMAP is not defined.
9535 * configure, Makefile.in, config.in: Rebuild.
9537 2009-03-27 Cary Coutant <ccoutant@google.com>
9539 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
9540 position independent.
9541 * sparc.cc (Target_sparc::check_non_pic): Likewise.
9542 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
9544 2009-03-24 Cary Coutant <ccoutant@google.com>
9546 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
9548 (needs_dynamic_reloc): Likewise.
9550 2009-03-24 Ian Lance Taylor <iant@google.com>
9552 * yyscript.y (file_cmd): Recognize EXTERN.
9553 (extern_name_list, extern_name_list_body): New nonterminals.
9554 * script.cc (script_add_extern): Define.
9555 * script-c.h (script_add_extern): Declare.
9557 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
9559 * object.cc (is_elf_object): Define.
9560 * object.h (is_elf_object): Declare.
9561 * archive.cc (Archive::get_elf_object_for_member): Call
9563 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
9565 2009-03-24 Elliott Hughes <enh@google.com>
9567 * output.cc (Output_file::map_anonymous): Define.
9568 (Output_file::map): Use map_anonymous. If the regular mmap fails,
9569 try an anonymous one. Report the size if the mmap fails.
9570 * output.h (class Output_file): Declare map_anonymous.
9572 2009-03-24 Ian Lance Taylor <iant@google.com>
9574 * target-select.cc (instantiate_target): Don't acquire the lock if
9575 the instantiated_target_ field has already been set.
9577 2009-03-23 Ian Lance Taylor <iant@google.com>
9579 * gold-threads.h (class Initialize_lock): Define.
9580 * gold-threads.cc (class Initialize_lock_once): Define.
9581 (initialize_lock_control): New static variable.
9582 (initialize_lock_pointer): New static variable.
9583 (initialize_lock_once): New static function.
9584 (Initialize_lock::Initialize_lock): Define.
9585 (Initialize_lock::initialize): Define.
9586 * target-select.h: Include "gold-threads.h".
9587 (class Target_selector): Add lock_ and initialize_lock_ fields.
9588 Don't define instantiate_target, just declare it.
9589 * target-select.cc (Target_selector::Target_selector): Initialize
9591 (Target_selector::instantiate_target): Define.
9592 * descriptors.h: Include "gold-threads.h".
9593 (class Descriptors): Add initialize_lock_ field.
9594 * descriptors.cc (Descriptors::Descriptors): Initialize new
9596 (Descriptors::open): Use initialize_lock_ field
9597 * errors.h (class Errors): Add initialize_lock_ field.
9598 * errors.cc (Errors::Errors): Initialize new field.
9599 (Errors::initialize_lock): Use initialize_lock_ field.
9600 * powerpc.cc (class Target_selector_powerpc): Remove
9601 instantiated_target_ field. In do_recognize call
9602 instantiate_target rather than do_instantiate_target. In
9603 do_instantiate_target just allocate a new target.
9604 * sparc.cc (class Target_selector_sparc): Likewise.
9606 * freebsd.h: New file.
9607 * i386.cc: Include "freebsd.h".
9608 (Target_i386): Derive from Target_freebsd rather than
9610 (Target_selector_i386): Derive from Target_selector_freebsd rather
9611 than Target_selector.
9612 * x86_64.cc: Include "freebsd.h".
9613 (Target_x86_64): Derive from Target_freebsd rather than
9615 (Target_selector_x86_64): Derive from Target_selector_freebsd
9616 rather than Target_selector.
9617 * target.h (class Target): Add adjust_elf_header and
9618 do_adjust_elf_header.
9619 * output.cc (Output_file_header:: do_sized_write): Call target
9620 adjust_elf_header routine.
9621 * configure.tgt: Set targ_osabi.
9622 * configure.ac: Define GOLD_DEFAULT_OSABI.
9623 * parameters.cc (Parameters::default_target): Pass
9624 GOLD_DEFAULT_OSABI to select_target.
9625 * target-select.h (class Target_selector): Make instantiate_target
9626 protected rather than private.
9627 * Makefile.am (HFILES): Add freebsd.h.
9628 * configure, Makefile.in, config.in: Rebuild.
9630 * merge.cc (do_add_input_section): Correct pend value. Change
9631 message about last entry not being null terminated from error to
9634 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
9636 * incremental.cc: New file.
9637 * Makefile.am (CCFILES): Add incremental.cc.
9638 * Makefile.in: Rebuild.
9640 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
9642 * layout.cc (Layout::output_section_name): Preserve names
9643 of '.note.' sections.
9645 2009-03-19 Ian Lance Taylor <iant@google.com>
9647 * descriptors.cc (Descriptors::open): Check that the options are
9648 valid before using them.
9650 2009-03-18 Ian Lance Taylor <iant@google.com>
9652 * script-sections.h: Include <list>.
9653 (class Script_sections): Change Sections_elements from std::vector
9654 to std::list. Typedef public Elements_iterator. Add
9655 orphan_section_placement_, data_segment_align_start_, and
9656 saw_data_segment_align_ fields. Remove data_segment_align_index_
9658 * script-sections.cc (class Orphan_section_placement): New class.
9659 (class Sections_element): Add virtual functions is_relro and
9660 orphan_section_init. Remove virtual function place_orphan_here.
9661 (class Output_section_definition): Add is_relro and
9662 orphan_section_init. Remove place_orphan_here.
9663 (class Orphan_output_section): Likewise.
9664 (Script_sections::Script_sections): Update for field changes.
9665 (Script_sections::data_segment_align): Set saw_data_segment_align_
9666 and data_segment_align_start_, not data_segment_align_index.
9667 (Script_sections::data_segment_relro_end): Check
9668 saw_data_segment_align_. Use data_segment_align_start_ rather
9669 than data_segment_align_index_.
9670 (Script_sections::place_orphan): Rewrite to use
9671 Orphan_section_placement.
9673 2009-03-17 Ian Lance Taylor <iant@google.com>
9675 * archive.cc (Archive::add_symbols): Check for a version attached
9676 to the symbol name in the archive map.
9677 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
9678 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
9679 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
9680 (ver_test_11.a): New target.
9681 * testsuite/Makefile.in: Rebuild.
9683 * configure.ac: Check for chsize and posix_fallocate. Replace
9685 * ftruncate.c: New file, from gnulib.
9686 * output.cc (posix_fallocate): Define dummy version if not
9687 HAVE_POSIX_FALLOCATE.
9688 (Output_file::map): Call posix_fallocate rather than lseek and
9690 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
9691 * configure, Makefile.in, config.in: Rebuild.
9693 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
9695 * layout.h (Layout::create_note): Add section_name parameter.
9696 * layout.cc (Layout::create_note): Likewise.
9697 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
9699 2009-03-17 Ian Lance Taylor <iant@google.com>
9701 * descriptors.cc: Include "options.h".
9702 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
9703 (Descriptors::open): Always use O_CLOEXEC when opening a new
9704 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
9705 then set FD_CLOEXEC.
9707 * sparc.cc (class Target_sparc): Add has_got_section.
9708 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
9709 make sure we have a GOT section.
9711 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
9712 (Target_sparc::Scan::local): Likewise.
9713 (Target_sparc::Scan::global): Likewise.
9714 (Target_sparc::Relocate::relocate): Likewise.
9715 (Target_sparc::Relocate::relocate_tls): Likewise.
9717 * symtab.cc (Symbol_table::define_default_version): New function,
9718 broken out of add_from_object.
9719 (Symbol_table::add_from_object): Call define_default_version.
9720 (Symbol_table::define_special_symbol): Add resolve_oldsym
9721 parameter. Change all callers. If the version for a symbol comes
9722 from a version script, resolve it with the symbol with the same
9723 name with no version. Also add the symbol without a version if
9725 (do_define_in_output_data): If resolving with oldsym, don't delete
9727 (do_define_in_output_segment): Likewise.
9728 (do_define_as_constant): Likewise.
9729 * symtab.h (class Symbol_table): Update declarations.
9731 2009-03-13 Ian Lance Taylor <iant@google.com>
9733 * readsyms.cc (Read_symbols::incompatible_warning): New function.
9734 (Read_symbols::requeue): New function.
9735 (Read_symbols::do_read_symbols): If make_elf_object fails because
9736 the target type is not configured, and the file was searched for,
9737 issue a warning and retry with the next directory.
9738 (Add_symbols::run): If the file has an incompatible format, and
9739 it was searched for, requeue the Read_symbols task. On error,
9741 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
9742 dirindex parameter to constructor. Change all callers. Declare
9743 incompatible_warning and requeue.
9744 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
9745 input_argument_ and input_group_ fields. Add them to
9746 constructor. Change all callers.
9747 (class Read_script): Add dirindex_ field. Add it to constructor.
9749 * archive.cc (Archive::setup): Remove input_objects parameter.
9751 (Archive::get_file_and_offset): Likewise.
9752 (Archive::read_all_symbols): Likewise.
9753 (Archive::read_symbols): Likewise.
9754 (Archive::get_elf_object_for_member): Remove input_objects
9755 parameter. Add punconfigured parameter. Change all callers.
9756 (Archive::add_symbols): Change return type to bool. Check return
9757 value of include_member.
9758 (Archive::include_all_members): Likewise.
9759 (Archive::include_member): Change return type to bool. Return
9760 false if first included object has incompatible target. Set
9761 included_member_ field.
9762 (Add_archive_symbols::run): If add_symbols returns false, requeue
9764 * archive.h (class Archive): Add included_member_ field.
9765 Initialize it in constructor. Add input_file and searched_for
9766 methods. Update declarations.
9767 (class Add_archive_symbols): Add dirpath_, dirindex_, and
9768 input_argument_ fields. Add them to constructor. Change all
9770 * script.cc: Include "target-select.h".
9771 (class Parser_closure): Add skip_on_incompatible_target_ and
9772 found_incompatible_target_ fields. Add
9773 skip_on_incompatible_target parameter to constructor. Change all
9774 callers. Add methods skip_on_incompatible_target,
9775 clear_skip_on_incompatible_target, found_incompatible_target, and
9776 set_found_incompatible_target.
9777 (read_input_script): Add dirindex parameter. Change all callers.
9778 If parser finds an incompatible target, requeue Read_symbols
9780 (script_set_symbol): Clear skip_on_incompatible_target in
9782 (script_add_assertion, script_parse_option): Likewise.
9783 (script_start_sections, script_add_phdr): Likewise.
9784 (script_check_output_format): New function.
9785 * script.h (read_input_script): Update declaration.
9786 * script-c.h (script_check_output_format): Declare.
9787 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
9788 (ignore_cmd): Remove OUTPUT_FORMAT.
9789 * fileread.cc (Input_file::Input_file): Add explicit this.
9790 (Input_file::will_search_for): New function.
9791 (Input_file::open): Add pindex parameter. Change all callers.
9792 * fileread.h (class Input_file): Add input_file_argument method.
9793 Declare will_search_for. Update declarations.
9794 * object.cc (make_elf_object): Add punconfigured parameter.
9796 * object.h (class Object): Make input_file public. Add
9797 searched_for method.
9798 (make_elf_object): Update declaration.
9799 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
9801 * dirsearch.h (class Dirsearch): Update declaration.
9802 * options.h (class General_options): Add --warn-search-mismatch.
9803 * parameters.cc (Parameters::is_compatible_target): New function.
9804 * parameters.h (class Parameters): Declare is_compatible_target.
9805 * workqueue.cc (Workqueue::add_blocker): New function.
9806 * workqueue.h (class Workqueue): Declare add_blocker.
9808 * fileread.cc (Input_file::open): Remove options parameter.
9810 (Input_file::open_binary): Likewise.
9811 * script.cc (read_input_script): Likewise.
9812 * readsyms.h (class Read_symbols): Remove options_ field. Remove
9813 options parameter from constructor. Change all callers.
9814 (class Read_script): Likewise.
9815 * fileread.h (class Input_file): Update declarations.
9816 * script.h (read_input_script): Update declaration.
9818 2009-03-10 Nick Clifton <nickc@redhat.com>
9820 * po/es.po: New Spanish translation.
9822 2009-03-06 Cary Coutant <ccoutant@google.com>
9824 * options.cc (parse_short_option): Keep dash_z from registering itself.
9826 2009-03-03 Ian Lance Taylor <iant@google.com>
9829 * target-reloc.h (relocate_section): Pass output_section to
9831 * i386.cc (Target_i386::should_apply_static_reloc): Add
9832 output_section parameter. Change all callers.
9833 (Target_i386::Relocate::relocate): Add output_section parameter.
9834 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9835 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
9836 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
9837 * testsuite/two_file_shared.sh: New script.
9838 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
9839 (check_DATA): Add two_file_shared.dbg.
9840 (two_file_shared.dbg): New target.
9841 * testsuite/Makefile.in: Rebuild.
9843 2009-03-01 Ian Lance Taylor <iant@google.com>
9845 * configure.ac: Check for byteswap.h.
9846 * configure: Rebuild.
9847 * config.in: Rebuild.
9849 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
9851 * layout.cc (Layout::find_or_add_kept_section): New function.
9852 (Layout::add_comdat): Removed.
9853 * layout.h (struct Kept_section): Move out of class Layout.
9854 Remove trailing underscores from field names. Add group_sections
9855 field. Rename group_ field to is_group. Change all uses.
9856 (class Layout): Declare find_or_add_kept_section, not add_comdat.
9857 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
9858 comdat_groups_ field.
9859 (Sized_relobj::include_section_group): Use
9860 find_or_add_kept_section and Kept_section::group_sections.
9861 (Sized_relobj::include_linkonce_section): Likewise.
9862 * object.cc (class Sized_relobj): Don't define Comdat_group or
9863 Comdat_group_table. Remove find_comdat_group and
9864 add_comdat_group. Remove comdat_groups_ field.
9865 * plugin.cc (include_comdat_group): Use
9866 Layout::find_or_add_kept_section.
9868 2009-02-28 Ian Lance Taylor <iant@google.com>
9870 * README: --gc-sections and map files are now supported. Document
9871 some build requirements.
9874 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
9875 relocatable link set the value of the section symbol to zero.
9876 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
9877 relocatable link don't include the section address in the local
9880 2009-02-27 Ian Lance Taylor <iant@google.com>
9883 * options.h (class Search_directory): Add is_system_directory.
9884 (class General_options): Declare is_in_system_directory.
9885 * options.cc (get_relative_sysroot): Make static.
9886 (get_default_sysroot): Make static.
9887 (General_optoins::is_in_system_directory): New function.
9888 * fileread.cc (Input_file::is_in_system_directory): New function.
9889 * fileread.h (class Input_file): Declare is_in_system_directory.
9890 * object.h (class Object): Add is_in_system_directory.
9891 (class Input_objects): Remove system_library_directory_ field.
9892 * object.cc (Input_objects::add_object): Don't set
9893 system_library_directory_.
9894 (input_objects::found_in_system_library_directory): Remove.
9895 * symtab.cc (Symbol_table::write_globals): Remove input_objects
9896 parameter. Change all callers.
9897 (Symbol_table::sized_write_globals): Likewise.
9898 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
9899 Call Object::is_in_system_directory.
9900 * symtab.h (class Symbol_table): Update declarations.
9903 * descriptors.h (Open_descriptor): Add is_on_stack field.
9904 * descriptors.cc (Descriptors::open): If the descriptor is on the
9905 top of the stack, remove it. Initialize is_on_stack field.
9906 (Descriptors::release): Only add pod to stack if it is not on the
9908 (Descriptors::close_some_descriptor): Clear stack_next and
9912 * output.cc (Output_section::find_starting_output_address): Rename
9913 from starting_output_address; add PADDR parameter; change return
9915 * output.h (class Output_section): Declare
9916 find_starting_output_address instead of starting_output_address.
9917 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
9918 section symbol for which we can't find a merge section.
9921 * symtab.cc (Symbol_table::add_from_object): If the visibility is
9922 hidden or internal, force the symbol to be local.
9923 * resolve.cc (Symbol::override_visibility): Define.
9924 (Symbol::override_base): Use override_visibility.
9925 (Symbol_table::resolve): Likewise.
9926 (Symbol::override_base_with_special): Likewise.
9927 (Symbol_table::override_with_special): If the visibility is hidden
9928 or internal, force the symbol to be local.
9929 * symtab.h (class Symbol): Add set_visibility and
9930 override_visibility.
9931 * testsuite/ver_test_1.sh: New file.
9932 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
9933 (check_DATA): Add ver_test_1.syms.
9934 (ver_test_1.syms): New target.
9935 * testsuite/Makefile.in: Rebuild.
9937 2009-02-25 Cary Coutant <ccoutant@google.com>
9939 * layout.cc (Layout::choose_output_section): Don't rename sections
9940 when using a linker script that has a SECTIONS clause.
9941 * Makefile.in: Regenerate.
9943 * testsuite/Makefile.am (script_test_5.sh): New test case.
9944 * testsuite/Makefile.in: Regenerate.
9945 * testsuite/script_test_5.cc: New file.
9946 * testsuite/script_test_5.sh: New file.
9947 * testsuite/script_test_5.t: New file.
9949 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
9951 * archive.cc (Archive::include_member): Update calls to add_symbols.
9952 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
9953 the Layout argument.
9954 * dynobj.h (do_add_symbols): Add the Layout argument.
9955 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
9957 * object.h (Object::add_symbols): Add the Layout argument.
9958 (Object::do_add_symbols): Add the Layout argument.
9959 (Sized_relobj::do_add_symbols): Add the Layout argument.
9960 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
9961 Unify the two versions.
9962 (Add_plugin_symbols): Remove.
9963 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
9964 (Sized_pluginobj::do_add_symbols): Unify the two versions.
9965 (Add_plugin_symbols): Remove.
9966 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
9967 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
9968 (Add_symbols::run): Make it work with Pulginobj.
9970 2009-02-06 Ian Lance Taylor <iant@google.com>
9972 * object.cc (Sized_relobj::do_layout): Make info message start
9973 with lower case letter.
9975 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
9977 * binary.cc: Fix file comment.
9979 * options.h (enum Incremental_disposition): Define.
9980 (class General_options): Add new options: --incremental,
9981 --incremental_changed, --incremental_unchanged,
9982 --incremental_unknown. Add incremental_disposition_ and
9983 implicit_incremental_ fields.
9984 (General_options::incremental_disposition): New function.
9985 (class Position_dependent_options): Add incremental_disposition
9987 (Position_dependent_options::copy_from_options): Set incremental
9989 * options.cc (General_options::parse_incremental_changed): New
9991 (General_options::parse_incremental_unchanged): New function.
9992 (General_options::parse_incremental_unknown): New function.
9993 (General_options::General_options): Initialize new fields
9994 incremental_disposition_ and implicit_incremental_.
9995 (General_options::finalize): Check for uasge of --incremental-*
9996 without --incremental.
9998 2009-02-06 Chris Demetriou <cgd@google.com>
10000 * gold.h (gold_undefined_symbol): Change to take only a Symbol
10001 pointer and to report location as the file name associated with
10003 (gold_undefined_symbol_at_location): New function to replace the
10004 old gold_undefined_symbol functionality.
10005 * target-reloc.h (relocate_section): Update to use
10006 gold_undefined_symbol_at_location.
10007 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10008 Call gold_undefined_symbol function rather than gold_error.
10009 * errors.h (Errors::undefined_symbol): Take location as a
10010 string, rather than calculating it from a relocation.
10011 * errors.cc (Errors::fatal): Print "fatal error:" before the
10013 (Errors::error, Errors::error_at_location): Print "error: "
10014 before the formatted message.
10015 (Errors::undefined_symbol): Take location as a string, rather
10016 than calculating it from a relocation.
10017 (gold_undefined_symbol_at_location): New function akin to
10018 old gold_undefined_symbol, calculates location from relocation.
10019 (gold_undefined_symbol): Change to take only a Symbol pointer
10020 and to report location as the file name associated with the symbol.
10021 * testsuite/debug_msg.sh: Update for changed error messages.
10022 * testsuite/undef_symbol.sh: Likewise.
10024 2009-02-04 Duncan Sands <baldrick@free.fr>
10027 * reduced_debug_output.h
10028 (Output_reduced_debug_abbrev_section::failed): Use format for
10030 (Output_reduced_debug_info_section::faild): Likewise.
10032 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
10034 * script.cc (Lazy_demangler): New class.
10035 (Version_script_info::get_symbol_version_helper): Demangle a
10038 2009-01-29 Cary Coutant <ccoutant@google.com>
10040 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
10042 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10044 2009-01-28 Ian Lance Taylor <iant@google.com>
10046 * version.cc (version_string): Bump to 1.9.
10048 * gold.h: Include <cstring> and <stdint.h>.
10049 * version.cc: Include <cstdio>.
10050 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
10052 * reduced_debug_output.cc (insert_into_vector): Rename from
10053 Insert_into_vector; change all callers. Use Swap_unaligned to
10054 avoid aliasing issue; remove union since it is unnecessary.
10056 2009-01-27 Sriraman Tallam <tmsriram@google.com>
10058 * Makefile.am (CCFILES): Add gc.cc.
10059 (HFILES): Add gc.h.
10060 * Makefile.in: Regenerate.
10061 * gold.cc (Gc_runner): New class.
10062 (queue_initial_tasks): Call garbage collection related tasks
10063 when corresponding options are invoked.
10064 (queue_middle_gc_tasks): New function.
10065 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
10066 processed early before laying out sections during garbage collection.
10067 * gold.h (queue_middle_gc_tasks): New function.
10068 (is_prefix_of): Move from "layout.cc".
10069 * i386.cc (Target_i386::gc_process_relocs): New function.
10070 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
10071 * main.cc (main): Create object of class "Garbage_collection".
10072 * object.cc (Relobj::copy_symbols_data): New function.
10073 (Relobj::is_section_name_included): New function.
10074 (Sized_relobj::do_layout): Allow this function to be called twice
10075 during garbage collection and defer layout of section during the
10077 * object.h (Relobj::get_symbols_data): New function.
10078 (Relobj::is_section_name_included): New function.
10079 (Relobj::copy_symbols_data): New function.
10080 (Relobj::set_symbols_data): New function.
10081 (Relobj::get_relocs_data): New function.
10082 (Relobj::set_relocs_data): New function.
10083 (Relobj::is_output_section_offset_invalid): New pure virtual function.
10084 (Relobj::gc_process_relocs): New function.
10085 (Relobj::do_gc_process_relocs): New pure virtual function.
10086 (Relobj::sd_): New data member.
10087 (Sized_relobj::is_output_section_offset_invalid): New function.
10088 (Sized_relobj::do_gc_process_relocs): New function.
10089 * options.h (General_options::gc_sections): Modify to not be a no-op.
10090 (General_options::print_gc_sections): New option.
10091 * plugin.cc (Plugin_finish::run): Remove function call to
10092 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
10093 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
10094 * reloc.cc (Read_relocs::run): Add task to process relocs and
10095 determine unreferenced sections when doing garbage collection.
10096 (Gc_process_relocs): New class.
10097 (Sized_relobj::do_gc_process_relocs): New function.
10098 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
10099 sections that are garbage collected.
10100 * reloc.h (Gc_process_relocs): New class.
10101 * sparc.cc (Target_sparc::gc_process_relocs): New function.
10102 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
10103 symbols whose corresponding sections are garbage collected.
10104 (Symbol_table::Symbol_table): Add new parameter for the garbage
10106 (Symbol_table::gc_mark_undef_symbols): New function.
10107 (Symbol_table::gc_mark_symbol_for_shlib): New function.
10108 (Symbol_table::gc_mark_dyn_syms): New function.
10109 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
10111 (Symbol_table::add_from_object): Likewise.
10112 (Symbol_table::add_from_relobj): When building shared objects, do not
10113 treat externally visible symbols as garbage.
10114 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
10115 table information for static and relocatable links.
10116 * symtab.h (Symbol_table::set_gc): New function.
10117 (Symbol_table::gc): New function.
10118 (Symbol_table::gc_mark_undef_symbols): New function.
10119 (Symbol_table::gc_mark_symbol_for_shlib): New function.
10120 (Symbol_table::gc_mark_dyn_syms): New function.
10121 (Symbol_table::gc_): New data member.
10122 * target.h (Sized_target::gc_process_relocs): New pure virtual
10124 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
10125 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
10127 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
10129 * options.h (General_options::gc_sections): Define as a no-op for now.
10130 (General_options::no_keep_memory): Ditto.
10131 (General_options::Bshareable): Define.
10132 * options.cc (General_options::finalize): Honor -Bshareable.
10134 2009-01-20 Andreas Schwab <schwab@suse.de>
10136 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
10137 read the value in the contents, since we don't use it. Use the
10138 template endianness when writing.
10139 (Relocate::relocate): Use it for R_PPC_REL16_HA.
10141 2009-01-19 Andreas Schwab <schwab@suse.de>
10143 * configure.tgt (powerpc64-*): Fix targ_obj.
10145 2009-01-15 Ian Lance Taylor <iant@google.com>
10147 * object.cc (Sized_relobj::write_local_symbols): Don't write out
10148 local symbols when stripping all symbols.
10150 2009-01-14 Cary Coutant <ccoutant@google.com>
10152 * output.cc (Output_reloc): Add explicit instantiations.
10154 2009-01-14 Cary Coutant <ccoutant@google.com>
10156 * archive.cc (Archive::get_elf_object_for_member): Remove call
10157 to File_read::claim_for_plugin.
10158 * descriptors.cc (Descriptors::open): Remove reference to
10160 (Descriptors::claim_for_plugin): Remove.
10161 * descriptors.h (Descriptors::claim_for_plugin): Remove.
10162 (Descriptors::is_claimed): Remove.
10163 (claim_descriptor_for_plugin): Remove.
10164 * fileread.cc (File_read::claim_for_plugin): Remove.
10165 * fileread.h (File_read::claim_for_plugin): Remove.
10166 (File_read::descriptor): Reopen descriptor if necessary.
10167 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
10168 (Plugin_manager::all_symbols_read): Add task parameter. Change
10170 (Plugin_manager::get_input_file): New function.
10171 (Plugin_manager::release_input_file): New function.
10172 (Pluginobj::Pluginobj): Add filesize parameter and initialize
10173 corresponding data member.
10174 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
10175 and pass to base constructor. Change all callers.
10176 (get_input_file, release_input_file): New functions.
10177 (make_sized_plugin_object): Add filesize parameter. Change all callers.
10178 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
10179 (Plugin_manager::all_symbols_read): Add task parameter.
10180 (Plugin_manager::get_input_file): New function.
10181 (Plugin_manager::release_input_file): New function.
10182 (Plugin_manager::task_): New data member.
10183 (Pluginobj::Pluginobj): Add filesize parameter.
10184 (Pluginobj::filename): New function.
10185 (Pluginobj::descriptor): New function.
10186 (Pluginobj::filesize): New function.
10187 (Pluginobj::filesize_): New data member.
10188 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
10189 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
10190 File_read::claim_for_plugin; use Object::unlock to unlock the file.
10192 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
10193 with archive libraries.
10194 * testsuite/Makefile.in: Regenerate.
10195 * testsuite/plugin_test.c (struct sym_info): New type.
10196 (get_input_file, release_input_file): New static variables.
10197 (onload): Capture new transfer vector entries.
10198 (claim_file_hook): Stop reading at end of file according to filesize.
10199 Factor out parsing of readelf output into separate function.
10200 (all_symbols_read_hook): Exercise get_input_file and release_input_file
10201 APIs and get the source file name from the symbol table. Convert
10202 source file name to corresponding object file name. Print info
10203 message when adding new input files.
10204 (parse_readelf_line): New function.
10205 * testsuite/plugin_test_1.sh: Add checks for new info messages.
10206 * testsuite/plugin_test_2.sh: Likewise.
10207 * testsuite/plugin_test_3.sh: Likewise.
10208 * testsuite/plugin_test_4.sh: New test case.
10210 2009-01-07 Ian Lance Taylor <iant@google.com>
10212 * version.cc (version_string): Bump to 1.8.
10214 2008-12-23 Cary Coutant <ccoutant@google.com>
10216 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
10217 * plugin.cc (Plugin_manager::finish): Rename as
10218 layout_deferred_objects. Move cleanup to separate function.
10219 (Plugin_manager::cleanup): New function.
10220 (Plugin_finish::run): Call layout_deferred_objects and cleanup
10222 * plugin.h (Plugin_manager::finish): Rename as
10223 layout_deferred_objects.
10224 (Plugin_manager::cleanup): New function.
10225 (Plugin_manager::cleanup_done): New field.
10227 2008-12-23 Cary Coutant <ccoutant@google.com>
10229 * plugin.cc (is_visible_from_outside): New function.
10230 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
10231 so we don't return "IR only" status for exported symbols or -r links.
10233 * testsuite/Makefile.am (plugin_test_3): New test case.
10234 * testsuite/Makefile.in: Regenerate.
10235 * testsuite/plugin_test_3.sh: New file.
10237 2008-12-22 Cary Coutant <ccoutant@google.com>
10239 * object.cc (Sized_relobj::layout_section): New function.
10240 (Sized_relobj::do_layout): Defer layout of input sections until after
10241 plugin has provided replacement files.
10242 (Sized_relobj::do_layout_deferred_sections): New function.
10243 * object.h (Relobj::set_section_offset): Remove virtual keyword.
10244 (Relobj::layout_deferred_sections): New function.
10245 (Relobj::do_layout_deferred_sections): New function.
10246 (Sized_relobj::do_layout_deferred_sections): New function.
10247 (Sized_relobj::layout_section): New function.
10248 (Sized_relobj::Deferred_layout): New structure.
10249 (Sized_relobj::deferred_layout_): New field.
10250 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10251 Change all callers. Layout deferred sections.
10252 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
10254 (Plugin_hook::run): Move code from do_plugin_hook inline.
10255 (Plugin_hook::do_plugin_hook): Remove.
10256 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10257 (Plugin_manager::finish): Renamed, was cleanup.
10258 (Plugin_manager::should_defer_layout): New function.
10259 (Plugin_manager::add_deferred_layout_object): New function.
10260 (Plugin_manager::Deferred_layout_list): New type.
10261 (Plugin_manager::deferred_layout_objects_): New field.
10262 (Plugin_hook::do_plugin_hook): Remove.
10264 2008-12-17 Ian Lance Taylor <iant@google.com>
10266 * options.h (class General_options): Add --no case for
10269 2008-12-16 Cary Coutant <ccoutant@google.com>
10271 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
10273 (Plugin_manager::claim_file): Create plugin object even if
10274 plugin did not call the add_symbols callback.
10275 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10276 asking for more symbols than were added.
10277 * testsuite/Makefile.am (plugin_test_1): Add test case with
10279 (empty.syms): New target.
10280 * testsuite/Makefile.in: Regenerate.
10281 * testsuite/plugin_test.c (claim_file_hook): Add new debug
10282 message. Don't call add_symbols if no globals.
10283 (all_symbols_read_hook): Don't provide replacement for empty
10286 2008-12-12 Ian Lance Taylor <iant@google.com>
10288 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10289 r_type == 0 for a local symbol with r_sym == 0.
10290 (scan_relocatable_relocs): Pass r_sym to
10291 local_non_section_strategy.
10292 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10295 * configure.ac: Update test for TLS descriptors: they are
10296 supported as of glibc 2.9.
10297 * configure: Rebuild.
10299 2008-12-11 Ian Lance Taylor <iant@google.com>
10302 * target-reloc.h (Default_scan_relocatable_relocs): For each
10303 function, map r_type == 0 to RELOC_DISCARD.
10305 2008-12-10 Cary Coutant <ccoutant@google.com>
10307 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
10308 object to override a kept COMDAT group from a plugin object.
10310 2008-12-09 Ian Lance Taylor <iant@google.com>
10313 * yyscript.y (file_cmd): Handle INPUT.
10315 * testsuite/initpri1.c: Change all declarations to be full
10316 prototypes by adding void, to avoid compiler warnings.
10318 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
10320 * options.cc (General_options::parse_plugin_opt): New.
10321 (General_options::add_plugin): The argument now is just the filename.
10322 (General_options::add_plugin_option): New.
10323 * options.h (plugin_opt): New.
10324 (add_plugin): Change argument name.
10325 (add_plugin_option): New.
10326 * plugin.cc (Plugin::load): Don't parse the plugin option.
10327 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
10328 (Plugin::add_option): New.
10329 (Plugin::args_): Change type.
10330 (Plugin::filename_): New.
10331 (Plugin_manager::add_plugin_option): New.
10332 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
10333 * testsuite/Makefile.in: Regenerate.
10335 2008-12-05 Cary Coutant <ccoutant@google.com>
10337 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
10338 Handle --strip-lto-sections option.
10339 * options.h (strip_lto_sections): New option.
10341 2008-12-01 Cary Coutant <ccoutant@google.com>
10343 * plugin.cc (ld_plugin_message): Change format parameter to const.
10344 Fix mismatch between new[] and delete.
10346 2008-11-14 Cary Coutant <ccoutant@google.com>
10348 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
10351 2008-11-05 Craig Silverstein <csilvers@google.com>
10353 * options.cc (General_options::parse_dynamic_list): New function.
10354 * options.h (General_options): New flags dynamic_list,
10355 dynamic_list_data, dynamic_list_cpp_new, and
10356 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
10357 (General_options::in_dynamic_list): New function.
10358 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
10359 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
10360 (Lex::can_continue_name): Likewise.
10362 (read_script_file): New parameter script_options.
10363 (read_dynamic_list): New function.
10364 (Script_options::define_dynamic_list): New function.
10365 (dynamic_list_keyword_parsecodes): New variable.
10366 (dynamic_list_keywords): New variable.
10367 * script.h (Script_options::define_dynamic_list): New function
10369 (read_dynamic_list): New function prototype.
10370 * symtab.cc (strprefix): New macro.
10371 (Symbol::should_add_dynsym_entry): Support dynamic_list,
10372 dynamic_list_data, dynamic_list_cpp_new, and
10373 dynamic_list_cpp_typeinfo.
10374 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
10375 (dynamic_list_expr): New rule.
10376 (dynamic_list_nodes): Likewise.
10377 (dynamic_list_node): Likewise.
10378 * testsuite/Makefile.am (dynamic_list): New test.
10379 * testsuite/Makefile.in: Regenerated.
10380 * testsuite/dynamic_list.t: New file.
10381 * testsuite/dynamic_list.sh: New file.
10383 2008-11-05 Craig Silverstein <csilvers@google.com>
10385 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
10386 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
10387 (t11_last): Likewise.
10388 * testsuite/ver_test_6.c (main): Likewise.
10390 2008-10-07 Cary Coutant <ccoutant@google.com>
10392 * options.c (General_options::finalize): Add check for -static and
10394 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
10397 2008-10-02 Cary Coutant <ccoutant@google.com>
10399 * plugin.cc (make_sized_plugin_object): Fix conditional
10400 compilation to work when not all targets are enabled.
10402 2008-09-29 Cary Coutant <ccoutant@google.com>
10404 * archive.cc (Archive::get_file_and_offset): Use filename instead
10405 of name to get library path.
10406 (Archive::include_member): Unlock external member of a thin archive.
10408 * testsuite/Makefile.am (TEST_AR): New variable.
10409 (thin_archive_test_1): New test.
10410 (thin_archive_test_2): New test.
10411 * testsuite/Makefile.in: Regenerate.
10412 * testsuite/thin_archive_main.cc: New file.
10413 * testsuite/thin_archive_test_1.cc: New file.
10414 * testsuite/thin_archive_test_2.cc: New file.
10415 * testsuite/thin_archive_test_3.cc: New file.
10416 * testsuite/thin_archive_test_4.cc: New file.
10418 2008-09-29 Cary Coutant <ccoutant@google.com>
10420 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
10421 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
10423 (Sized_relobj::do_finalize_local_symbols): Likewise.
10424 (Sized_relobj::map_to_kept_section): Likewise.
10425 * object.h (Sized_relobj::invalid_address): New constant.
10426 (Sized_relobj::do_output_section_offset): Check for invalid_address
10428 * output.cc (Output_reloc::local_section_offset): Use constant
10429 invalid_address instead of -1U.
10430 (Output_reloc::get_address): Likewise.
10431 (Output_section::output_address): Change -1U to -1ULL.
10432 * output.h (Output_reloc::invalid_address): New constant.
10433 * reloc.cc (Sized_relobj::write_sections): Use constant
10434 invalid_address instead of -1U.
10435 (Sized_relobj::relocate_sections): Likewise.
10436 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
10437 values for merge sections.
10438 * target-reloc.h (relocate_for_relocatable): Use constant
10439 invalid_address instead of -1U.
10441 2008-09-19 Cary Coutant <ccoutant@google.com>
10443 Add plugin functionality for link-time optimization (LTO).
10444 * configure.ac (plugins): Add --enable-plugins option.
10445 * configure: Regenerate.
10446 * config.in: Regenerate.
10447 * Makefile.am (LIBDL): New variable.
10448 (CCFILES): Add plugin.cc.
10449 (HFILES): Add plugin.h.
10450 (ldadd_var): Add LIBDL.
10451 * Makefile.in: Regenerate.
10453 * archive.cc: Include "plugin.h".
10454 (Archive::setup): Don't preread archive symbols when using a plugin.
10455 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
10456 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
10458 (Archive::include_member): Add symbols from plugin objects.
10459 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
10460 * descriptors.cc (Descriptors::open): Check for file descriptors
10461 abandoned by plugins.
10462 (Descriptors::claim_for_plugin): New function.
10463 * descriptors.h (Descriptors::claim_for_plugin): New function.
10464 (Open_descriptor::is_claimed): New field.
10465 (claim_descriptor_for_plugin): New function.
10466 * fileread.cc (File_read::claim_for_plugin): New function.
10467 * fileread.h (File_read::claim_for_plugin): New function.
10468 (File_read::descriptor): New function.
10469 * gold.cc: Include "plugin.h".
10470 (queue_initial_tasks): Add task to call plugin hooks for generating
10472 * main.cc: Include "plugin.h".
10473 (main): Load plugin libraries.
10474 * object.h (Pluginobj): Declare.
10475 (Object::pluginobj): New function.
10476 (Object::do_pluginobj): New function.
10477 (Object::set_target): New function.
10478 * options.cc: Include "plugin.h".
10479 (General_options::parse_plugin): New function.
10480 (General_options::General_options): Initialize plugins_ field.
10481 (General_options::add_plugin): New function.
10482 * options.h (Plugin_manager): Declare.
10483 (General_options): Add --plugin option.
10484 (General_options::has_plugins): New function.
10485 (General_options::plugins): New function.
10486 (General_options::add_plugin): New function.
10487 (General_options::plugins_): New field.
10488 * plugin.cc: New file.
10489 * plugin.h: New file.
10490 * readsyms.cc: Include "plugin.h".
10491 (Read_symbols::do_read_symbols): Check for archive before checking
10492 for ELF file. Call plugin hooks to claim files.
10493 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
10494 from a real object file; force override when processing replacement
10496 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
10497 (Symbol::init_base_object): Likewise.
10498 (Symbol::init_base_output_data): Likewise.
10499 (Symbol::init_base_output_segment): Likewise.
10500 (Symbol::init_base_constant): Likewise.
10501 (Symbol::init_base_undefined): Likewise.
10502 (Symbol::output_section): Assert that object is not a plugin.
10503 (Symbol_table::add_from_pluginobj): New function.
10504 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
10506 (Symbol_table::sized_write_globals): Likewise.
10507 (Symbol_table::add_from_pluginobj): Instantiate template.
10508 * symtab.h (Sized_pluginobj): Declare.
10509 (Symbol::in_real_elf): New function.
10510 (Symbol::set_in_real_elf): New function.
10511 (Symbol::in_real_elf_): New field.
10512 (Symbol_table::add_from_pluginobj): New function.
10514 * testsuite/Makefile.am (AM_CFLAGS): New variable.
10515 (LIBDL): New variable.
10516 (LDADD): Add LIBDL.
10517 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
10518 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
10519 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
10520 (MOSTLYCLEANFILES): Likewise.
10521 * testsuite/Makefile.in: Regenerate.
10522 * testsuite/plugin_test.c: New file.
10523 * testsuite/plugin_test_1.sh: New file.
10524 * testsuite/plugin_test_2.sh: New file.
10526 2008-09-16 Ian Lance Taylor <iant@google.com>
10528 * target-reloc.h (relocate_section): Check whether a symbol is
10529 defined by the ABI before reporting an undefined symbol error.
10530 * target.h (Target::is_defined_by_abi): Make parameter const.
10531 (Target::do_is_defined_by_abi): Likewise.
10532 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
10533 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
10534 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
10535 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
10536 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
10537 * testsuite/Makefile.in: Rebuild.
10539 * fileread.cc (make_view): Add casts to avoid warning.
10541 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
10543 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
10544 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10546 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
10548 * options.h (General_options::output_is_executable): New.
10549 (General_options::output_is_pie): New.
10550 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
10551 for shared libraries.
10552 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10554 2008-09-11 Chris Demetriou <cgd@google.com>
10556 * options.h (origin): New -z option.
10557 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
10558 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
10561 2008-09-05 Cary Coutant <ccoutant@google.com>
10563 * fileread.cc (File_read::make_view): Add check for attempt to map
10564 beyond end of file.
10566 2008-09-05 Cary Coutant <ccoutant@google.com>
10568 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
10569 explicit instantiations.
10571 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
10574 * options.cc (General_options::finalize): Allow undefined symbols
10575 in shlibs if linking -shared.
10578 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
10579 symbols as not needing a dynsym entry.
10581 2008-08-20 Craig Silverstein <csilvers@google.com>
10583 * fileread.cc (File_read::open): Do not lock the file unless it
10584 was successfully opened.
10586 2008-08-14 Cary Coutant <ccoutant@google.com>
10588 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
10589 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
10590 * testsuite/tls_test.cc (struct int128): 128-bit struct
10591 for testing TLS relocs with non-zero addend.
10592 (v12): New TLS variable.
10594 (t_last): Add check for v12.
10595 * testsuite/tls_test.h (t12): New function.
10596 * testsuite/tls_test_main.cc (thread_routine): Call new test.
10598 2008-08-13 Ian Lance Taylor <iant@google.com>
10600 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
10601 set tls_segment_ or relro_segment_.
10602 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
10604 * output.h (Output_section::clear_is_relro): New function.
10605 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
10606 sections specially even when output_data_ is empty.
10607 (Output_segment::maximum_alignment): When first section is relro,
10608 only force alignment for PT_LOAD segments.
10609 * script.cc (script_data_segment_align): New function.
10610 (script_data_segment_relro_end): New function.
10611 * script-c.h (script_data_segment_align): Declare.
10612 (script_data_segment_relro_end): Declare.
10613 * script-sections.h (class Script_sections): Declare
10614 data_segment_align and data_segment_relro_end. Add fields
10615 segment_align_index_ and saw_relro_end_.
10616 * script-sections.cc (class Sections_element): Add set_is_relro
10617 virtual function. Add new bool* parameter to place_orphan_here.
10618 Add get_output_section virtual function.
10619 (class Output_section_definition): Add set_is_relro. Add new
10620 bool* parameter to place_orphan_here. Add get_output_section.
10621 Add is_relro_ field.
10622 (Output_section_definition::Output_section_definition): Initialize
10623 evaluated_address_, evaluated_load_address, evaluated_addralign_,
10624 and is_relro_ fields.
10625 (Output_section_definition::place_orphan_here): Add is_relro
10627 (Output_section_definition::set_section_addresses): Set relro for
10629 (Output_section_definition::alternate_constraint): Likewise.
10630 (class Orphan_output_section): Add new bool* parameter to
10631 place_orphan_here. Add get_output_section.
10632 (Orphan_output_section::place_orphan_here): Add is_relro
10634 (Script_sections::Script_sections): Initialize
10635 data_segment_align_index_ and saw_relro_end_.
10636 (Script_sections::data_segment_align): New function.
10637 (Script_sections::data_segment_relro_end): New function.
10638 (Script_sections::place_orphan): Set or clear is_relro.
10639 (Script_sections::set_section_addresses): Force alignment of first
10641 * yyscript.y (exp): Call script_data_segment_align and
10642 script_data_segment_relro_end.
10643 * testsuite/relro_script_test.t: New file.
10644 * testsuite/relro_test.cc (using_script): Declare.
10645 (t1, t2): Test using_script.
10646 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
10647 (relro_script_test_SOURCES): Define.
10648 (relro_script_test_DEPENDENCIES): Define.
10649 (relro_script_test_LDFLAGS): Define.
10650 (relro_script_test_LDADD): Define.
10651 (relro_script_test.so): New target.
10652 * testsuite/Makefile.in: Rebuild.
10654 2008-08-06 Cary Coutant <ccoutant@google.com>
10656 * archive.cc (Archive::total_archives, Archive::total_members)
10657 (Archive::total_members_loaded): New variables.
10658 (Archive::setup): Add parameter. Add option to preread
10660 (Archive::read_armap): Add counter.
10661 (Archive::get_file_and_offset): New function.
10662 (Archive::get_elf_object_for_member): New function.
10663 (Archive::read_all_symbols): New function.
10664 (Archive::read_symbols): New function.
10665 (Archive::add_symbols): Add counters.
10666 (Archive::include_all_members): Use armap to find members if it's
10668 (Archive::include_member): Skip reading symbols if already read.
10669 Factored code into Archive::get_file_and_offset and
10670 Archive::get_elf_object_for_member. Changed call to
10671 Mapfile::report_include_archive_member.
10672 (Archive::print_stats): New function.
10673 * archive.h: Declare Object and Read_symbols_data classes.
10674 (Archive::Archive): Add initializers for new members.
10675 (Archive::setup): Add parameter.
10676 (Archive::print_stats): New function.
10677 (Archive::total_archives, Archive::total_members)
10678 (Archive::total_members_loaded): New variables.
10679 (Archive::get_file_and_offset): New function.
10680 (Archive::get_elf_object_for_member): New function.
10681 (Archive::read_all_symbols): New function.
10682 (Archive::read_symbols): New function.
10683 (Archive::Archive_member): New class.
10684 (Archive::members_): New member.
10685 (Archive::num_members_): New member.
10686 * main.cc: Include archive.h.
10687 (main): Call Archive::print_stats.
10688 * mapfile.cc (Mapfile::report_include_archive_member): Delete
10689 archive parameter; member_name is now the fully-decorated name.
10690 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
10691 * options.h: (General_options): Add --preread-archive-symbols option.
10692 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
10695 2008-08-04 Ian Lance Taylor <iant@google.com>
10697 * symtab.h (Symbol::use_plt_offset): New function.
10698 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
10699 * powerpc.cc (Relocate::relocate): Likewise.
10700 * sparc.cc (Relocate::relocate): Likewise.
10701 * x86_64.cc (Relocate::relocate): Likewise.
10702 * testsuite/weak_plt.sh: New test.
10703 * testsuite/weak_plt_main.cc: New test.
10704 * testsuite/weak_plt_shared.cc: New test.
10705 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
10706 (check_PROGRAMS): Add weak_plt.
10707 (check_DATA): Add weak_plt_shared.so.
10708 (weak_plt_main_pic.o, weak_plt): New targets.
10709 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
10710 * testsuite/Makefile.in: Rebuild.
10712 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
10714 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
10715 * testsuite/Makefile.in: Rebuild.
10717 2008-08-04 Alan Modra <amodra@bigpond.net.au>
10719 * Makefile.am (POTFILES.in): Set LC_ALL=C.
10720 * Makefile.in: Regenerate.
10721 * po/POTFILES.in: Regenerate.
10723 2008-07-29 Ian Lance Taylor <iant@google.com>
10725 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
10726 symbols before other symbols.
10727 * testsuite/script_test_2.cc (test_addr): Declare.
10728 (test_addr_alias): Declare.
10729 (main): Check that test_addr and test_addr_alias have the right
10731 * testsuite/script_test_2.t: Define test_addr_alias and
10734 2008-07-24 Ian Lance Taylor <iant@google.com>
10737 * descriptors.cc: New file.
10738 * descriptors.h: New file.
10739 * gold-threads.h (class Hold_optional_lock): New class.
10740 * fileread.cc: Include "descriptors.h".
10741 (File_read::~File_read): Release descriptor rather than closing
10743 (File_read::open) [file]: Call open_descriptor rather than open.
10744 Set is_descriptor_opened_.
10745 (File_read::open) [memory]: Assert that descriptor is not open.
10746 (File_read::reopen_descriptor): New function.
10747 (File_read::release): Release descriptor.
10748 (File_read::do_read): Make non-const. Reopen descriptor.
10749 (File_read::read): Make non-const.
10750 (File_read::make_view): Reopen descriptor.
10751 (File_read::do_readv): Likewise.
10752 * fileread.h (class File_read): Add is_descriptor_opened_ field.
10753 Update declarations.
10754 * layout.cc: Include "descriptors.h".
10755 (Layout::create_build_id): Use open_descriptor rather than open.
10756 * output.cc: Include "descriptors.h".
10757 (Output_file::open): Use open_descriptor rather than open.
10758 * archive.cc (Archive::const_iterator): Change Archive to be
10760 (Archive::begin, Archive::end): Make non-const.
10761 (Archive::count_members): Likewise.
10762 * archive.h (class Archive): Update declarations.
10763 * object.h (Object::read): Make non-const.
10764 * Makefile.am (CCFILES): Add descriptors.cc.
10765 (HFILES): Add descriptors.h.
10766 * Makefile.in: Rebuild.
10769 * gold.h: Always include <clocale>. Add Solaris workarounds
10770 following code in binutils/sysdep.h.
10773 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
10774 this->eh_frame_hdr_ is NULL before using it.
10776 * dynobj.cc (Versions::Versions): Update comment.
10778 * dynobj.cc (Versions::Versions): If there is an soname, use it as
10779 the base version name.
10781 * stringpool.cc (Stringpool_template::add_with_length): Set key to
10782 array size plus one.
10783 (Stringpool_template::set_string_offsets): Subtract one from key
10784 before using it as an array index.
10785 (Stringpool_template::get_offset_with_length): Likewise.
10786 (Stringpool_template::write_to_buffer): Likewise.
10787 * stringpool.h (Stringpool_template::get_offset_from_key):
10790 2008-07-23 Ian Lance Taylor <iant@google.com>
10793 * object.h (Merged_symbol_value::value): Do our best to handle a
10797 * script.cc (Version_script_info::get_versions): Don't add empty
10798 version tag to return value.
10799 (Version_script_info::get_symbol_version_helper): Change return
10800 type to bool. Add pversion parameter. Change all callers.
10801 (script_register_vers_node): Don't require a non-NULL tag.
10802 * script.h (class Version_script_info): Update declarations.
10803 (Version_script_info::get_symbol_version): Change return type to
10804 bool. Add version parameter. Change all callers.
10805 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
10806 handling. Handle an empty version from a version script.
10807 (Symbol_table::define_special_symbol): Likewise.
10808 * testsuite/ver_test_10.script: New file.
10809 * testsuite/ver_test_10.sh: New file.
10810 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
10811 (check_DATA): Add ver_test_10.syms.
10812 (ver_test_10.syms, ver_test_10.so): New target.
10813 * testsuite/Makefile.in: Rebuild.
10815 2008-07-23 Simon Baldwin <simonb@google.com>
10817 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
10818 to zero for undefined symbols from dynamic libraries.
10820 2008-07-23 Ian Lance Taylor <iant@google.com>
10822 * symtab.cc (Symbol_table::resolve): Remove version parameter.
10823 Change all callers.
10824 * symtab.h (class Symbol_table): Update declaration.
10825 * testsuite/ver_test_9.cc: New file.
10826 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
10827 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
10828 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
10829 (ver_test_9.so, ver_test_9.o): New targets.
10830 * testsuite/Makefile.in: Rebuild.
10832 2008-07-22 Ian Lance Taylor <iant@google.com>
10834 * options.h (class General_options): Define --check-sections.
10835 * layout.cc (Layout::set_segment_offsets): Handle
10838 * options.h (class General_options): Define -n/--nmagic and
10840 * options.cc (General_options::finalize): For -n/--nmagic or
10841 -N/--omagic, set -static.
10842 * layout.cc (Layout::attach_allocated_section_to_segment): If
10843 -N/--omagic, don't put read-only and read-write sections in
10844 different segments.
10845 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
10846 finding a read-only segment.
10847 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
10848 don't set the minimum segment alignment to the common page size,
10849 and don't set the file offset to the address modulo the page size.
10850 * script-sections.cc (Script_sections::create_segments): If
10851 -n/--omagic, don't put read-only and read-write sections in
10852 different segments.
10854 * cref.cc: New file.
10855 * cref.h: New file.
10856 * options.h (class General_options): Add --print-symbol-counts.
10857 * main.cc (main): Issue defined symbol report if requested.
10858 * archive.cc (Archive::interpret_header): Make into a const member
10860 (Archive::add_symbols): Call Input_objects::archive_start and
10862 (Archive::const_iterator): Define new class.
10863 (Archive::begin, Archive::end): New functions.
10864 (Archive::include_all_members): Rewrite to use iterator.
10865 (Archive::count_members): New function.
10866 * archive.h (class Archive): Update declarations.
10867 (Archive::filename): New function.
10868 * object.cc: Include "cref.h".
10869 (Sized_relobj::Sized_relobj): Initialize defined_count_.
10870 (Sized_relobj::do_get_global_symbol_counts): New function.
10871 (Input_objects::add_object): Add object to cross-referencer.
10872 (Input_objects::archive_start): New function.
10873 (Input_objects::archive_stop): New function.
10874 (Input_objects::print_symbol_counts): New function.
10875 * object.h: Declare Cref and Archive.
10876 (Object::get_global_symbol_counts): New function.
10877 (Object::do_get_global_symbol_counts): New pure virtual function.
10878 (class Sized_relobj): Add defined_count_ field. Update
10880 (class Input_objects): Add cref_ field. Update constructor.
10881 Update declarations.
10882 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
10884 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
10886 (Sized_dynobj::do_get_global_symbol_counts): New function.
10887 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
10888 defined_count_. Update declarations. Define Symbols typedef.
10889 * symtab.cc (Symbol_table::add_from_relobj): Add defined
10890 parameter. Change all callers.
10891 (Symbol_table::add_from_dynobj): Add sympointers and defined
10892 parameters. Change all callers.
10893 * symtab.h (class Symbol_table): Update declarations.
10894 * Makefile.am (CCFILES): Add cref.cc.
10895 (HFILES): Add cref.h.
10896 * Makefile.in: Rebuild.
10898 2008-07-22 Simon Baldwin <simonb@google.com>
10900 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
10901 to zero when writing undefined symbols.
10903 2008-07-22 Ian Lance Taylor <iant@google.com>
10905 * output.cc (Output_section::add_input_section): Don't try to
10906 merge empty merge sections.
10908 2008-07-21 Craig Silverstein <csilvers@google.com>
10910 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10911 Include symbol version in error message.
10913 2008-07-20 Chris Demetriou <cgd@google.com>
10915 * configure.ac (gold_cv_c_random_seed): New configured variable.
10916 (RANDOM_SEED_CFLAGS): New substituted variable.
10917 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
10918 * configure: Rebuild.
10919 * Makefile.in: Likewise.
10920 * testsuite/Makefile.in: Likewise.
10922 2008-07-18 Ian Lance Taylor <iant@google.com>
10924 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
10925 where we see NAME/NULL and NAME/VERSION as separate symbols.
10926 * testsuite/ver_test_main.cc (main): Call t4.
10927 (t4, t4_2a): Define.
10928 * testsuite/ver_test_2.cc (t4_2): Define.
10929 * testsuite/ver_test_2.script: Put t4_2a in VER2.
10930 * testsuite/ver_test_4.cc (t4_2a): Define.
10931 * testsuite/ver_test_4.script: Put t4_2a in VER2.
10932 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
10934 2008-07-17 Ian Lance Taylor <iant@google.com>
10936 * dynobj.cc (Versions::add_def): If we give an error about a
10937 missing version, go ahead and create the version anyhow.
10939 2008-07-10 Ian Lance Taylor <iant@google.com>
10941 Handle output sections with more than 0x7fffffff bytes.
10942 * object.h (class Relobj): Change map_to_output_ to
10943 output_sections_, and just keep a section pointer. Change all
10944 uses. Move comdat group support to Sized_relobj.
10945 (Relobj::is_section_specially_mapped): Remove.
10946 (Relobj::output_section): Remove poff parameter. Change all
10948 (Relobj::output_section_offset): New function.
10949 (Relobj::set_section_offset): Rewrite.
10950 (Relobj::map_to_output): Remove.
10951 (Relobj::output_sections): New function.
10952 (Relobj::do_output_section_offset): New pure virtual function.
10953 (Relobj::do_set_section_offset): Likewise.
10954 (class Sized_relobj): Add section_offsets_ field. Add comdat
10955 group support from Relobj. Update declarations.
10956 (Sized_relobj::get_output_section_offset): New function.
10957 (Sized_relobj::do_output_section_offset): New function.
10958 (Sized_relobj::do_set_section_offset): New function.
10959 * object.cc (Relobj::output_section_address): Remove.
10960 (Sized_relobj::Sized_relobj): Initialize new fields.
10961 (Sized_relobj::include_section_group): Cast find_kept_object to
10963 (Sized_relobj::include_linkonce_section): Likewise.
10964 (Sized_relobj::do_layout): Use separate arrays for output section
10966 (Sized_relobj::do_count_local_symbols): Change map_to_output to
10968 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
10969 output_sections and section_offsets.
10970 (Sized_relobj::write_local_symbols): Likewise.
10971 (map_to_kept_section): Compute output address directly.
10972 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
10973 output_sections and section_offsets.
10974 (Sized_relobj::write_sections): Likewise.
10975 (Sized_relobj::relocate_sections): Likewise.
10976 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
10977 * output.h (class Output_reloc): Update declarations. Change
10978 u2_.relobj to Sized_relobj*.
10979 (class Output_data_reloc): Change add functions to use
10981 * output.cc (Output_reloc::Output_reloc): Change relobj to
10983 (Output_reloc::local_section_offset): Change return type to
10984 Elf_Addr. Use get_output_section_offset.
10985 (Output_reloc::get_address): Likewise.
10986 (Output_section::is_input_address_mapped): Don't call
10987 is_section_specially_mapped.
10988 (Output_section::output_offset): Likewise.
10989 (Output_section::output_address): Likewise.
10990 (Output_section::starting_output_address): Likewise.
10991 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
10992 parameter to Sized_relobj*.
10993 (Copy_relocs::need_copy_reloc): Likewise.
10994 (Copy_relocs::save): Likewise.
10995 * copy-relocs.h (class Copy_relocs): Update declarations.
10996 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
10997 Sized_relobj*. Change relobj_ field to Sized_relobj*.
10998 * target-reloc.h (relocate_for_relocatable): Change
10999 offset_in_output_section type to Elf_Addr. Change code that uses
11001 * layout.cc (Layout::layout): Always set *off.
11002 * mapfile.cc (Mapfile::print_input_section): Use
11003 output_section_offset.
11004 * i386.cc (Target_i386::copy_reloc): Change object parameter to
11006 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
11007 * sparc.cc (Target_sparc::copy_reloc): Likewise.
11008 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
11010 2008-07-03 Ian Lance Taylor <iant@google.com>
11012 * layout.cc (Layout::include_section): Do not discard unrecognized
11013 SHT_STRTAB sections.
11015 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
11017 * script.cc (Lex::can_continue_name): Make '?' allowable in
11018 version-script names.
11019 * testsuite/version_script.map: Change glob pattern to use '?'
11021 2008-06-30 Manish Singh <yosh@gimp.org>
11024 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
11027 2008-06-30 Ian Lance Taylor <iant@google.com>
11031 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
11032 versions]: Don't try to read the value in the contents, since we
11033 don't use it. Use the template endianness when writing.
11035 2008-06-25 Cary Coutant <ccoutant@google.com>
11037 * fileread.cc (File_read::make_view): Assert on zero-length view.
11038 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
11039 symbol table when there are no symbols to read.
11041 2008-06-23 Craig Silverstein <csilvers@google.com>
11043 * version.cc (version_string): Bump to 1.7
11045 2008-06-18 Craig Silverstein <csilvers@google.com>
11047 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
11048 constant 0xFFFF to type Valtype.
11049 (Powerpc_relocate_functions::rel16_ha): Likewise.
11051 2008-06-17 Ian Lance Taylor <iant@google.com>
11053 * output.h (Output_section::Input_section): Initialize p2align_ to
11054 zero for Output_section_data constructors.
11055 (Output_section::Input_section::addralign): If not an input
11056 section, return the alignment of the Output_section_data.
11057 * testsuite/copy_test.cc: New file.
11058 * testsuite/copy_test_1.cc: New file.
11059 * testsuite/copy_test_2.cc: New file.
11060 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
11061 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
11062 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
11063 (copy_test_1_pic.o, copy_test_1.so): New targets.
11064 (copy_test_2_pic.o, copy_test_2.so): New targets.
11065 * testsuite/Makefile.in: Rebuild.
11067 * script-sections.cc (Script_sections::place_orphan): Initialize
11068 local variable exact.
11070 2008-06-13 David Edelsohn <edelsohn@gnu.org>
11072 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
11074 2008-06-12 David Edelsohn <edelsohn@gnu.org>
11075 David S. Miller <davem@davemloft.net>
11077 * powerpc.cc: New file.
11078 * Makefile.am (TARGETSOURCES): Add powerpc.cc
11079 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
11080 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
11081 * Makefile.in: Rebuild.
11083 2008-06-09 Ian Lance Taylor <iant@google.com>
11085 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
11087 (throwing, orig_terminate): New static variables.
11088 (terminate_handler): New static function.
11089 (t2): Set terminate handler.
11091 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
11094 * binary.cc (Binary_to_elf::sized_convert): Fix .data
11097 2008-05-30 Cary Coutant <ccoutant@google.com>
11099 * archive.cc (Archive::include_all_members) Correct to step
11100 over symbol table and extended name table in thin archives.
11102 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
11105 * target-reloc.h (relocate_for_relocatable): Fix new_offset
11108 2008-05-28 Caleb Howe <cshowe@google.com>
11110 * reduced_debug_output.cc: New file.
11111 * reduced_debug_output.h: New file.
11112 * options.h (class General_options): Add --strip-debug-non-line.
11113 * options.cc (General_options::finalize): Add strip_debug_non_line
11114 to the strip heirarchy.
11115 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
11117 * layout.cc: Include "reduced_debug_output.h".
11118 (Layout::Layout): Initialize new fields.
11119 (line_only_debug_sections): New static array.
11120 (is_lines_only_debug_sections): New static inline function.
11121 (Layout::include_section): Handle --strip-debug-non-line.
11122 (Layout::make_output_section): If --strip-debug-non-line, build
11123 new output sections for .debug_abbrev and .debug_info.
11124 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
11125 gold. Warn about possible overflow.
11126 (read_signed_LEB_128): Likewise.
11127 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
11128 (read_signed_LEB_128): Declare.
11129 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
11130 (HFILES): Add reduced_debug_output.h.
11131 * Makefile.in: Rebuild.
11133 2008-05-21 Ian Lance Taylor <iant@google.com>
11135 * mapfile.cc: New file.
11136 * mapfile.h: New file.
11137 * options.h (class General_options): Add -M/--print-map and -Map.
11138 * options.cc (General_options::finalize): Make -M equivalent to
11140 * main.cc: Include <cstdio> and "mapfile.h".
11141 (main): Open mapfile if requested.
11142 * gold.cc (class Middle_runner): Add mapfile_ field. Update
11143 constructor. Change caller.
11144 (queue_initial_tasks): Add mapfile parameter. Change caller.
11145 (queue_middle_tasks): Likewise.
11146 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
11148 * archive.cc: Include "mapfile.h".
11149 (Archive::add_symbols): Add mapfile parameter. Change all
11150 callers. Pass mapfile, symbol, and reason to include_member.
11151 (Archive::include_all_members): Add mapfile parameter. Change all
11153 (Archive::include_member): Add mapfile, sym, and why parameters.
11154 Change all callers. Report inclusion to map file.
11155 * archive.h: Include "fileread.h".
11156 (class Archive): Update declarations.
11157 (Archive::file): New const method.
11158 (class Add_archive_symbols): Add mapfile_ field. Update
11159 constructor. Change all callers.
11160 * readsyms.h (class Read_symbols): Likewise.
11161 (class Finish_group): Likewise.
11162 (class Read_script): Likewise.
11163 * common.cc: Include "mapfile.h".
11164 (Symbol_table::allocate_commons): Add mapfile parameter. Change
11166 (Symbol_table::do_allocate_commons): Likewise.
11167 (Symbol_table::do_allocate_commons_list): Likewise. Report common
11168 symbol allocation to mapfile.
11169 * common.h (class Allocate_commons_task): Add mapfile_ field.
11170 Update constructor. Change all callers.
11171 * symtab.h (class Symbol_table): Update declarations.
11172 * layout.cc: Include "mapfile.h".
11173 (Layout_task_runner::run): Print information to mapfile.
11174 (Layout::create_gold_note): Change Output_data_fixed_space to
11175 Output_data_zero_fill.
11176 (Layout::create_build_id): Likewise.
11177 (Layout::print_to_mapfile): New function.
11178 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
11179 constructor. Change caller.
11180 (class Layout): Declare print_to_mapfile.
11181 * output.cc (Output_section::Input_section::print_to_mapfile): New
11183 (Output_section::add_input_section): If producing a map, always
11184 add to input_sections_ list.
11185 (Output_section::do_print_to_mapfile): New function.
11186 (Output_segment::print_sections_to_mapfile): New function.
11187 (Output_segment::print_section_list_to_mapfile): New function.
11188 * output.h: Include "mapfile.h".
11189 (Output_data::print_to_mapfile): New function.
11190 (Output_data::do_print_to_mapfile): New virtual function.
11191 (Output_segment_headers::do_print_to_mapfile): New function.
11192 (Output_file_header::do_print_to_mapfile): New function.
11193 (Output_data_const::do_print_to_mapfile): New function.
11194 (class Output_data_const_buffer): Add map_name_ field. Update
11195 constructor. Change all callers. Add do_print_to_mapfile
11197 (class Output_data_fixed_space): Likewise.
11198 (class Output_data_space): Likewise.
11199 (class Output_data_zero_fill): New class.
11200 (Output_data_strtab::do_print_to_mapfile): New function.
11201 (Output_data_reloc_base::do_print_to_mapfile): New function.
11202 (Output_relocatable_relocs::do_print_to_mapfile): New function.
11203 (Output_data_group::do_print_to_mapfile): New function.
11204 (Output_data_got::do_print_to_mapfile): New function.
11205 (Output_data_dynamic::do_print_to_mapfile): New function.
11206 (Output_symtab_xindex::do_print_to_mapfile): New function.
11207 (class Output_section): Declare do_print_to_mapflie. Declare
11208 print_to_mapfile in Input_section.
11209 (class Output_segment): Declare new functions.
11210 * object.h (Sized_relobj::symbol_count): New function.
11211 * script-sections.cc
11212 (Output_section_element_dot_assignment::set_section_addresses):
11213 Change Output_data_fixed_space to Output_data_zero_fill.
11214 (Output_data_expression::do_print_to_mapfile): New function.
11215 * script.cc (read_input_script): Add mapfile parameter. Change
11217 * script.h (read_input_script): Update declaration.
11218 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
11219 (Eh_frame::do_print_to_mapfile): New function.
11220 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
11221 (Output_merge_string::do_print_to_mapfile): New function.
11222 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
11224 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
11226 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
11228 * Makefile.am (CCFILES): Add mapfile.cc.
11229 (HFILES): Add mapfile.h.
11230 * Makefile.in: Rebuild.
11232 2008-05-19 Ian Lance Taylor <iant@google.com>
11234 * options.h (class General_options): Add -z relro.
11235 * layout.cc (Layout::Layout): Initialize relro_segment_.
11236 (Layout::add_output_section_data): Return the output section.
11237 (Layout::make_output_section): Rcognize relro sections and mark
11238 them appropriately.
11239 (Layout::attach_allocated_section_to_segment): Put relro sections
11240 in a PT_GNU_RELRO segment.
11241 (Layout::create_initial_dynamic_sections): Mark the .dynamic
11243 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11245 (Layout::linkonce_mapping): Map d.rel.ro.local to
11246 .data.rel.ro.local.
11247 (Layout::output_section_name): Us .data.rel.ro.local for any
11248 section which begins with that.
11249 * layout.h (class Layout): Update add_output_section_data
11250 declaration. Add relro_segment_ field.
11251 * output.cc (Output_section::Output_section): Initialize is_relro_
11252 and is_relro_local_ fields.
11253 (Output_segment::add_output_section): Group relro sections.
11254 (Output_segment::is_first_section_relro): New function.
11255 (Output_segment::maximum_alignment): If there is a relro section,
11256 align the segment to the common page size.
11257 (Output_segment::set_section_addresses): Track whether we are
11258 looking at relro sections. If the last section is a relro
11259 section, align to the common page size.
11260 (Output_segment::set_section_list_addresses): Add in_relro
11261 parameter. Change all callers. Align to the page size when
11262 moving from relro to non-relro section.
11263 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
11265 * output.h (class Output_section): Add is_relro_ and
11266 is_relro_local_ fields.
11267 (Output_section::is_relro): New function.
11268 (Output_section::set_is_relro): New function.
11269 (Output_section::is_relro_local): New function.
11270 (Output_section::set_is_relro_local): New function.
11271 (class Output_segment): Update declarations.
11272 * i386.cc (Target_i386::got_section): Mark .got section as relro.
11273 * sparc.cc (Target_sparc::got_section): Likewise.
11274 * x86_64.cc (Target_x86_64::got_section): Likewise.
11275 * testsuite/relro_test_main.cc: New file.
11276 * testsuite/relro_test.cc: New file.
11277 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11278 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11279 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11280 (relro_test.so, relro_test_pic.o): New targets.
11281 * testsuite/Makefile.in: Rebuild.
11283 2008-05-16 Ian Lance Taylor <iant@google.com>
11285 * output.cc (Output_segment::add_output_section): Remove front
11287 * output.h (class Output_segment): Remove
11288 add_initial_output_section and overloaded add_output_section.
11289 Update declaration of remaining add_output_section.
11290 * layout.cc (Layout::create_interp): Call add_output_section
11291 rather than add_initial_output_section.
11292 (Layout::finish_dynamic_section): Likewise.
11294 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
11295 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
11296 know the dynamic type.
11297 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
11298 field. Initialize it in constructor.
11299 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
11300 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
11301 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
11304 * output.cc (Output_reloc::get_address): Change return type to
11306 * output.h (class Output_reloc): Update get_address declaration.
11307 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
11308 for section addresses.
11310 2008-05-09 Ian Lance Taylor <iant@google.com>
11313 * gold.cc (gold_nomem): Use return value of write.
11315 2008-05-08 Ian Lance Taylor <iant@google.com>
11317 * symtab.c (Symbol::init_base_output_data): Add version
11318 parameter. Change all callers.
11319 (Symbol::init_base_output_segment): Likewise.
11320 (Symbol::init_base_constant): Likewise.
11321 (Symbol::init_base_undefined): Likewise.
11322 (Sized_symbol::init_output_data): Likewise.
11323 (Sized_symbol::init_output_segment): Likewise.
11324 (Sized_symbol::init_constant): Likewise.
11325 (Sized_symbol::init_undefined): Likewise.
11326 (Symbol_table::do_define_in_output_data): If the new symbol has a
11327 version, mark it as the default.
11328 (Symbol_table::do_define_in_output_segment): Likewise.
11329 (Symbol_table::do_define_as_constant): Likewise.
11330 * symtab.h (class Symbol): Update declarations.
11331 (class Sized_symbol): Likewise.
11332 * resolve.cc (Symbol::override_version): New function.
11333 (Symbol::override_base): Call override_version.
11334 (Symbol::override_base_with_special): Likewise.
11335 * testsuite/ver_script_8.script: New file.
11336 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
11337 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
11338 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
11339 (ver_test_8_1.so, ver_test_8_2.so): New targets.
11341 2008-05-06 Ian Lance Taylor <iant@google.com>
11344 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
11346 (class General_options): Remove existing --undefined, and add
11347 --no-undefined instead. Add new --undefined as synonym for -u.
11348 * archive.cc (Archive::add_symbols): Check whether symbol was
11350 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
11351 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
11352 all uses. Add IS_UNDEFINED. Update declarations to split
11353 different versions of init_base. Declare init_base_undefined.
11354 (Symbol::is_defined): Handle IS_UNDEFINED.
11355 (Symbol::is_undefined): Likewise.
11356 (Symbol::is_weak_undefined): Call is_undefined.
11357 (Symbol::is_absolute): Handle IS_CONSTANT.
11358 (class Sized_symbol): Update declarations to split different
11359 versions of init. Declare init_undefined.
11360 (class Symbol_table): Declare new functions.
11361 * symtab.cc (Symbol::init_base_object): Rename from init_base.
11362 Change all callers.
11363 (Symbol::init_base_output_data): Likewise.
11364 (Symbol::init_base_output_segment): Likewise.
11365 (Symbol::init_base_constant): Likewise.
11366 (Symbol::init_base_undefined): New function.
11367 (Sized_symbol::init_object): Rename from init. Change all
11369 (Sized_symbol::init_output_data): Likewise.
11370 (Sized_symbol::init_output_segment): Likewise.
11371 (Sized_symbol::init_constant): Likewise.
11372 (Sized_symbol::init_undefined): New function.
11373 (Symbol_table::add_undefined_symbols_from_command_line): New
11375 (Symbol_table::do_add_undefined_symbols_from_command_line): New
11377 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
11378 (Symbol::output_section): Likewise.
11379 (Symbol::set_output_section): Likewise.
11380 (Symbol_table::sized_finalize_symbol): Likewise.
11381 (Symbol_table::sized_write_globals): Likewise.
11382 * resolve.cc (Symbol_table::should_override): Likewise.
11383 (Symbol::override_base_with_special): Likewise.
11385 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
11386 symbol, change it to have default visibility.
11387 * testsuite/protected_1.cc: New file.
11388 * testsuite/protected_2.cc: New file.
11389 * testsuite/protected_3.cc: New file.
11390 * testsuite/protected_main_1.cc: New file.
11391 * testsuite/protected_main_2.cc: New file.
11392 * testsuite/protected_main_3.cc: New file.
11393 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
11394 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
11395 (protected_1_LDFLAGS, protected_1_LDADD): Define.
11396 (protected_1.so): New target.
11397 (protected_1_pic.o, protected_2_pic.o): New targets.
11398 (protected_3_pic.o): New target.
11399 (check_PROGRAMS): Add protected_2.
11400 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
11401 (protected_2_LDFLAGS, protected_2_LDADD): Define.
11402 * testsuite/Makefile.in: Rebuild.
11404 * options.h (DEFINE_var): Add set_user_set_##varname__.
11405 (DEFINE_bool_alias): New macro.
11406 (class General_options): Define -Bstatic using DEFINE_bool_alias
11407 rather than DEFINE_special. Add --undefined as an alias for -z
11409 * options.cc (General_options::parse_Bstatic): Remove.
11411 * options.h (class General_options): Add --fatal-warnings.
11412 * main.cc (main): Implement --fatal-warnings.
11413 * errors.h (Errors::warning_count): New function.
11415 * options.h (class General_options): Add -Bsymbolic-functions.
11416 * symtab.h (Symbol::is_preemptible): Check for
11417 -Bsymbolic-functions.
11419 2008-05-05 Ian Lance Taylor <iant@google.com>
11421 * options.h (DEFINE_bool): For DASH_Z, create the negative option
11422 as noVARNAME rather than no-VARNAME.
11423 (class General_options): Add option -z combreloc.
11424 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
11426 (Output_reloc::sort_before) [SHT_REL]: New function.
11427 (Output_reloc::sort_before) [SHT_RELA]: New function.
11428 (class Output_data_reloc_base): Add sort_relocs_ field. Define
11429 Sort_relocs_comparison.
11430 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
11431 parameter. Change all callers.
11432 (Output_data_reloc::Output_data_reloc) [both versions]: Add
11433 sort_relocs parameter. Change all callers.
11434 * output.cc (Output_reloc::get_address): New function, broken out
11436 (Output_reloc::write_rel): Call it.
11437 (Output_reloc::compare): New function.
11438 (Output_data_reloc_base::do_write): Optionally sort relocs.
11440 * configure.ac: If targ_extra_obj is set, link it in.
11441 * configure.tgt: Initialize all variables.
11442 (x86_64*): Set targ_extra_obj and targ_extra_size.
11443 * configure: Rebuild.
11445 * object.cc (Sized_relobj::include_section_group): Adjust section
11446 indexes read from group data. Build vector to pass to
11448 * layout.cc (Layout::layout_group): Add flags and shndxes
11449 parameters. Remove contents parameter. Change caller. Update
11450 explicit instantiations.
11451 * layout.h (class Layout): Update layout_group declaration.
11452 * output.cc (Output_data_group::Output_data_group): Add flags and
11453 input_shndxes parameters. Remove contents parameter. Change
11455 (Output_data_group::do_write): Change input_sections_ to
11457 * output.h (class Output_data_group): Update constructor
11458 declaration. Rename input_sections_ to input_shndxes_.
11459 * testsuite/many_sections_test.cc: Add template.
11461 2008-04-30 Cary Coutant <ccoutant@google.com>
11463 * target-reloc.h (relocate_section): Fix dead-pointer bug.
11465 * layout.cc (Layout::include_section): Refactored check for debug
11467 (Layout::add_comdat): Add new parameters. Change type
11468 of signature parameter. Add object and shndx to signatures table.
11469 (Layout::find_kept_object): New function.
11470 * layout.h: Include <cstring>.
11471 (Layout::is_debug_info_section): New function.
11472 (Layout::add_comdat): Add new parameters.
11473 (Layout::find_kept_object): New function.
11474 (Layout::Kept_section): New struct.
11475 (Layout::Signatures): Change type of map range.
11476 * object.cc (Relobj::output_section_address): New function.
11477 (Sized_relobj::include_section_group): Add new parameters. Change
11478 calls to Layout::add_comdat. Change to build table of kept comdat
11479 groups and table mapping discarded sections to kept sections.
11480 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
11481 (Sized_relobj::do_layout): Change calls to include_section_group and
11482 include_linkonce_section.
11483 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
11484 value to zero when section is discarded.
11485 (Sized_relobj::map_to_kept_section): New function.
11486 * object.h (Relobj::output_section_address): New function.
11487 (Relobj::Comdat_group): New type.
11488 (Relobj::find_comdat_group): New function.
11489 (Relobj::Comdat_group_table): New type.
11490 (Relobj::Kept_comdat_section): New type.
11491 (Relobj::Kept_comdat_section_table): New type.
11492 (Relobj::add_comdat_group): New function.
11493 (Relobj::set_kept_comdat_section): New function.
11494 (Relobj::get_kept_comdat_section): New function.
11495 (Relobj::comdat_groups_): New field.
11496 (Relobj::kept_comdat_sections_): New field.
11497 (Symbol_value::input_value): Update comment.
11498 (Sized_relobj::map_to_kept_section) New function.
11499 (Sized_relobj::include_linkonce_section): Add new parameter.
11500 * target-reloc.h (Comdat_behavior): New type.
11501 (get_comdat_behavior): New function.
11502 (relocate_section): Add code to map a discarded section to the
11503 corresponding kept section when applying a relocation.
11505 2008-04-30 Craig Silverstein <csilvers@google.com>
11507 * dwarf_reader.cc (next_generation_count): New static var.
11508 (Addr2line_cache_entry): New struct.
11509 (addr2line_cache): New static var.
11510 (Dwarf_line_info::one_addr2line): Added caching.
11511 (Dwarf_line_info::clear_addr2line_cache): New function.
11512 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
11513 cache-size parameter.
11514 (Dwarf_line_info::one_addr2line_cache): New function.
11515 * symtab.cc (Symbol_table::detect_odr_violations): Pass
11516 new cache-size argument to one_addr2line(), and clear cache.
11518 2008-04-28 Cary Coutant <ccoutant@google.com>
11520 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
11521 R_386_PC8 relocations.
11523 2008-04-23 Ian Lance Taylor <iant@google.com>
11525 * object.cc (Sized_relobj::include_section_group): Check for
11526 invalid section group.
11528 * object.cc (make_elf_object): Correct test for 64-bit ELF file
11531 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
11532 than read for file header.
11533 * archive.cc (Archive::include_member): Likewise.
11535 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
11537 * aclocal.m4: Regenerate.
11538 * configure: Regenerate.
11540 2008-04-19 Ian Lance Taylor <iant@google.com>
11542 * version.cc (version_string): Bump to 1.6.
11544 * testsuite/Makefile.am (many_sections_r_test): New target.
11545 (many_sections_r_test_SOURCES): Remove.
11546 (many_sections_r_test_DEPENDENCIES): Remove.
11547 (many_sections_r_test_LDFLAGS): Remove.
11548 (many_sections_r_test_LDADD): Remove.
11550 * object.cc (Sized_relobj::do_add_symbols): Always pass
11551 local_symbol_count_ to add_from_relobj.
11553 * testsuite/Makefile.am (many_sections_check.h): Only check one in
11554 every thousand variables.
11555 * testsuite/Makefile.in: Rebuild.
11557 * object.cc (Xindex::initialize_symtab_xindex): New function.
11558 (Xindex::read_symtab_xindex): New function.
11559 (Xindex::sym_xindex_to_shndx): New function.
11560 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
11562 (Sized_relobj::do_initialize_xindex): New function.
11563 (Sized_relobj::do_read_symbols): Adjust section links.
11564 (Sized_relobj::symbol_section_and_value): Add is_ordinary
11565 parameter. Change all callers.
11566 (Sized_relobj::include_section_group): Adjust section links and
11567 symbol section indexes.
11568 (Sized_relobj::do_layout): Adjust section links.
11569 (Sized_relobj::do_count_local_symbols): Adjust section links and
11570 symbol section indexes.
11571 (Sized_relobj::do_finalize_local_symbols): Distinguish between
11572 ordinary and special symbols.
11573 (Sized_relobj::write_local_symbols): Add symtab_xindex and
11574 dynsym_xindex parameters. Change all callers. Adjust section
11575 links. Use SHN_XINDEX when needed.
11576 (Sized_relobj::get_symbol_location_info): Adjust section links.
11577 Don't get fooled by special symbols.
11578 * object.h (class Xindex): Define.
11579 (class Object): Add xindex_ parameter. Declare virtual functoin
11580 do_initialize_xindex.
11581 (Object::adjust_sym_shndx): New function.
11582 (Object::set_xindex): New protected function.
11583 (class Symbol_value): Add is_ordinary_shndx_ field.
11584 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
11585 (Symbol_value::value): Assert ordinary section.
11586 (Symbol_value::initialize_input_to_output_map): Likewise.
11587 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
11588 Change all callers.
11589 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
11591 (class Sized_relobj): Update declarations.
11592 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
11593 parameter. Change all callers.
11594 (Sized_relobj::adjust_shndx): New function.
11595 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
11597 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
11598 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
11599 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
11600 (Sized_dynobj::read_dynsym_section): Adjust section links.
11601 (Sized_dynobj::read_dynamic): Likewise.
11602 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
11604 (Sized_dynobj::do_initialize_xindex): New function.
11605 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
11606 do_initialize_xindex.
11607 (Sized_dynobj::adjust_shndx): New function.
11608 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
11609 dynsym_xindex_ fields.
11610 (Layout::finalize): Add a call to set_section_indexes before
11611 creating the symtab sections.
11612 (Layout::set_section_indexes): Don't do anything if the section
11613 already has a section index.
11614 (Layout::create_symtab_sections): Add shnum parameter. Change
11615 caller. Create .symtab_shndx section if needed.
11616 (Layout::create_shdrs): Add shstrtab_section parameter. Change
11618 (Layout::allocated_output_section_count): New function.
11619 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
11621 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
11622 fields. Update declarations.
11623 (Layout::symtab_xindex): New function.
11624 (Layout::dynsym_xindex): New function.
11625 (class Write_symbols_task): Add layout_ field.
11626 (Write_symbols_task::Write_symbols_task): Add layout parameter.
11628 * output.cc (Output_section_headers::Output_section_headers): Add
11629 shstrtab_section parameter. Change all callers.
11630 (Output_section_headers::do_sized_write): Store overflow values
11631 for section count and section string table section index in
11632 section header zero.
11633 (Output_file_header::do_sized_write): Check for overflow of
11634 section count and section string table section index.
11635 (Output_symtab_xindex::do_write): New function.
11636 (Output_symtab_xindex::endian_do_write): New function.
11637 * output.h (class Output_section_headers): Add shstrtab_section_.
11638 Update declarations.
11639 (class Output_symtab_xindex): Define.
11640 (Output_section::has_out_shndx): New function.
11641 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
11643 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
11644 Change all callers.
11645 (Sized_symbol::init): Likewise.
11646 (Symbol::output_section): Check for ordinary symbol.
11647 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
11648 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
11650 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
11651 Change all callers. Simplify handling of symbols from sections
11652 not included in the link.
11653 (Symbol_table::add_from_dynobj): Handle ordinary symbol
11655 (Weak_alias_sorter::operator()): Assert that symbols are
11657 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
11659 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
11660 parameters. Change all callers.
11661 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
11662 symbol distinction. Use SHN_XINDEX when needed.
11663 (Symbol_table::write_section_symbol): Add symtab_xindex
11664 parameter. Change all callers.
11665 (Symbol_table::sized_write_section_symbol): Likewise. Use
11666 SHN_XINDEX when needed.
11667 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
11669 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
11670 (Symbol::is_defined): Check is_ordinary.
11671 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
11672 (Symbol::is_absolute, Symbol::is_common): Likewise.
11673 (class Sized_symbol): Update declarations.
11674 (class Symbol_table): Update declarations.
11675 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
11676 parameters. Change all callers.
11677 (Sized_symbol::override): Likewise.
11678 (Symbol_table::override): Likewise.
11679 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
11680 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
11681 is_ordinary, and orig_st_shndx parameters. Change all callers.
11682 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
11683 to be in an ordinary section.
11684 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
11685 object and is_ordinary parameters. Change all callers.
11686 (Sized_dwarf_line_info::read_relocs): Add object parameter.
11687 Change all callers. Don't add undefined or non-ordinary symbols
11689 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
11690 Change all callers.
11691 * dwarf_reader.h (class Sized_dwarf_line_info): Update
11693 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
11694 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
11695 (Sized_relobj::relocate_sections): Likewise.
11696 * target-reloc.h (scan_relocs): Adjust section symbol index.
11697 (scan_relocatable_relocs): Likewise.
11698 * i386.cc (Scan::local): Check for ordinary symbols.
11699 * sparc.cc (Scan::local): Likewise.
11700 * x86_64.cc (Scan::local): Likewise.
11701 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
11702 to symbol_section_and_value.
11703 * testsuite/many_sections_test.cc: New file.
11704 * testsuite/Makefile.am (BUILT_SOURCES): Define.
11705 (check_PROGRAMS): Add many_sections_test.
11706 (many_sections_test_SOURCES): Define.
11707 (many_sections_test_DEPENDENCIES): Define.
11708 (many_sections_test_LDFLAGS): Define.
11709 (BUILT_SOURCES): Add many_sections_define.h.
11710 (many_sections_define.h): New target.
11711 (BUILT_SOURCES): Add many_sections_check.h.
11712 (many_sections_check.h): New target.
11713 (check_PROGRAMS): Add many_sections_r_test.
11714 (many_sections_r_test_SOURCES): Define.
11715 (many_sections_r_test_DEPENDENCIES): Define.
11716 (many_sections_r_test_LDFLAGS): Define.
11717 (many_sections_r_test_LDADD): Define.
11718 (many_sections_r_test.o): New target.
11719 * testsuite/Makefile.in: Rebuild.
11721 2008-04-17 Cary Coutant <ccoutant@google.com>
11723 * errors.cc (Errors::info): New function.
11724 (gold_info): New function.
11725 * errors.h (Errors::info): New function.
11726 * gold.h (gold_info): New function.
11727 * object.cc (Input_objects::add_object): Print trace output.
11728 * options.cc (options::parse_set): New function.
11729 (General_options::parse_wrap): Deleted.
11730 (General_options::General_options): Deleted initializer.
11731 * options.h (options::String_set): New typedef.
11732 (options::parse_set): New function.
11733 (DEFINE_set): New macro.
11734 (General_options::wrap): Changed to use DEFINE_set. Changed
11735 callers of any_wrap_symbols and is_wrap_symbol.
11736 (General_options::trace, General_options::trace_symbol):
11738 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
11739 (General_options::wrap_symbols_): Deleted.
11740 * symtab.cc (Symbol_table::add_from_object): Print trace output.
11742 2008-04-17 David S. Miller <davem@davemloft.net>
11744 * options.cc (General_options::parse_V): New function.
11745 * options.h: Add entries for -V and -Qy.
11747 2008-04-17 Ian Lance Taylor <iant@google.com>
11749 * common.cc (Symbol_table::allocate_commons): Remove options
11750 parameter. Change caller.
11751 (Symbol_table::do_allocate_commons): Remove options parameter.
11752 Change caller. Just call do_allocate_commons_list twice.
11753 (Symbol_table::do_allocate_commons_list): New function, broken out
11754 of do_allocate_commons.
11755 * common.h (class Allocate_commons_task): Remove options_ field.
11756 Update constructor.
11757 * symtab.cc (Symbol_table::Symbol_table): Initialize
11759 (Symbol_table::add_from_object): Put TLS common symbols on
11761 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
11762 which are IN_OUTPUT_DATA.
11763 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
11764 allocate_commons and do_allocate_commons declarations. Declare
11765 do_allocate_commons_list.
11766 * gold.cc (queue_middle_tasks): Update creation of
11767 Allocate_commons_task to not pass options.
11768 * testsuite/Makefile.am (INCLUDES): Add -I.. .
11769 (TLS_TEST_C_FLAGS): New variable.
11770 (tls_test_c_pic.o): New target.
11771 (tls_test_shared.so): Link in tls_test_c_pic.o.
11772 (tls_test_c_pic_ie.o): New target.
11773 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
11774 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
11775 (tls_test_c.o): New target.
11776 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
11777 (tls_pic_test_LDADD): Likewise.
11778 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
11779 (tls_shared_gd_to_ie_test_LDADD): Likewise.
11780 (tls_test_c_gnu2.o): New target.
11781 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
11783 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
11784 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
11785 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
11786 * testsuite/tls_test.cc: Include "config.h".
11787 (t_last): Call t11_last.
11788 * testsuite/tls_test.h (t11, t11_last): Declare.
11789 * testsuite/tls_test_c.c: New file.
11790 * testsuite/tls_test_main.cc (thread_routine): Call t11.
11791 * configure.ac: Check for OpenMP support.
11792 * configure, config.in, Makefile.in: Rebuild.
11793 * testsuite/Makefile.in: Rebuild.
11795 2008-04-16 Cary Coutant <ccoutant@google.com>
11797 * i386.cc (Target_i386::define_tls_base_symbol): New function.
11798 (Target_i386::tls_base_symbol_defined_): New field.
11799 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11800 (Target_i386::Scan::global): Likewise.
11801 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
11802 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
11803 (Target_x86_64::tls_base_symbol_defined_): New field.
11804 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11805 (Target_x86_64::Scan::global): Likewise.
11807 2008-04-16 Cary Coutant <ccoutant@google.com>
11809 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
11810 (Symbol::needs_plt_entry): Allow weak undefined symbols.
11811 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
11812 building shared libraries.
11813 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
11814 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
11815 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
11816 * testsuite/Makefile.in: Rebuild.
11817 * testsuite/weak_undef.h: New file.
11818 * testsuite/weak_undef_file1.cc: Add extra test cases.
11819 * testsuite/weak_undef_file2.cc: Likewise.
11820 * testsuite/weak_undef_test.cc: Likewise.
11822 2008-04-16 David S. Miller <davem@davemloft.net>
11824 * sparc.cc (Target_sparc::Scan): Change from struct to class.
11825 Add issued_non_pic_error_ field. Declare check_non_pic.
11826 (Target_sparc::Scan::check_non_pic): New function.
11827 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
11828 (Target_sparc::Scan::global): Likewise.
11830 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
11831 * configure: Rebuild.
11833 * options.h (DEFINE_enable): New macro.
11834 (new_dtags): New enable option.
11835 (initfirst, interpose, loadfltr, nodefaultlib,
11836 nodelete, nodlopen, nodump): New -z options.
11837 * layout.cc (Layout:finish_dynamic_section): If new
11838 dtags enabled, emit DT_RUNPATH. Also, emit a
11839 DT_FLAGS_1 containing any specified -z flags.
11841 2008-04-16 Ian Lance Taylor <iant@google.com>
11843 * copy-relocs.cc: New file.
11844 * copy-relocs.h: New file.
11845 * reloc.cc: Remove Copy_relocs code.
11846 * reloc.h: Likewise.
11847 * reloc-types.h (struct Reloc_types) [both versions]: Add
11848 get_reloc_addend_noerror.
11849 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
11850 variants of add_global which take an addend which must be zero.
11851 * i386.cc: Include "copy-relocs.h".
11852 (class Target_i386): Change type of copy_relocs_ to variable,
11853 update initializer.
11854 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
11855 Change all callers.
11856 (Target_i386::do_finalize_sections): Change handling of
11858 * sparc.cc: Include "copy-relocs.h".
11859 (class Target_sparc): Change type of copy_relocs_ to variable,
11860 update initializer.
11861 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
11862 Change all callers.
11863 (Target_sparc::do_finalize_sections): Change handling of
11865 * x86_64.cc: Include "copy-relocs.h".
11866 (class Target_x86_64): Change type of copy_relocs_ to variable,
11867 update initializer.
11868 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
11869 class. Change all callers.
11870 (Target_x86_64::do_finalize_sections): Change handling of
11872 * Makefile.am (CCFILES): Add copy-relocs.cc.
11873 (HFILES): Add copy-relocs.h.
11875 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
11877 * testsuite/script_test_4.sh: Permit leading zeroes.
11879 2008-04-15 Ian Lance Taylor <iant@google.com>
11881 * script-sections.cc (Script_sections::create_segments): Use
11882 header_size_adjustment even when there is enough room for the
11884 * testsuite/script_test_4.sh: New file.
11885 * testsuite/script_test_4.t: New file.
11886 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
11887 (check_DATA): Add script_test_4.stdout.
11888 (MOSTLYCLEANFILES): Likewise.
11889 (script_test_4): New target.
11890 (script_test_4.stdout): New target.
11891 * testsuite/Makefile.in: Rebuild.
11893 * sparc.cc: Add definitions for Output_data_plt_sparc class
11896 2008-04-14 David S. Miller <davem@davemloft.net>
11898 * sparc.cc: New file.
11899 * Makefile.am (TARGETSOURCES): Add sparc.cc
11900 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
11901 * configure.tgt: Document targ_extra_size and
11902 targ_extra_big_endian. Add entries for sparc-* and
11904 * configure.ac: Handle targ_extra_size and
11905 targ_extra_big_endian.
11906 * Makefile.in: Rebuild.
11907 * configure: Likewise.
11908 * po/POTFILES.in: Likewise.
11909 * po/gold.pot: Likewise.
11911 2008-04-14 Ian Lance Taylor <iant@google.com>
11913 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
11914 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
11915 in the name/type/flags to section mapping. Don't call
11916 allocate_output_section.
11917 (Layout::choose_output_section): Change parameter from adjust_name
11918 to is_input_section. Don't permit input sections after sections
11919 are attached to segments. Don't call allocate_output_section.
11920 (Layout::layout_eh_frame): Call update_flags_for_input_section,
11921 not write_enable_output_section.
11922 (Layout::make_output_section): Don't push to
11923 unattached_section_list_ nor call attach_to_segment. Call
11924 attach_section_to_segment if sections are attached.
11925 (Layout::attach_sections_to_segments): New function.
11926 (Layout::attach_section_to_segment): New function.
11927 (Layout::attach_allocated_section_to_segment): Rename from
11928 attach_to_segment. Remove flags parameter.
11929 (Layout::allocate_output_section): Remove function.
11930 (Layout::write_enable_output_section): Remove function.
11931 * layout.h (class Layout): Update for above changes. Add new
11932 field sections_are_attached_.
11933 * output.h (Output_section::update_flags_for_input_section): New
11935 * output.cc (Output_section::add_input_section): Call
11936 update_flags_for_input_section.
11937 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
11939 2008-04-11 Cary Coutant <ccoutant@google.com>
11941 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
11942 thought unnecessary.
11943 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
11945 2008-04-11 Ian Lance Taylor <iant@google.com>
11947 * output.h (class Output_section_data): Remove inline definition
11949 * output.cc (Output_section_data::set_addralign): New function.
11951 2008-04-11 Cary Coutant <ccoutant@google.com>
11953 Add support for TLS descriptors for i386 and x86_64.
11954 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
11955 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
11956 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
11958 (Target_i386::got_mod_index_entry): Remove unnecessary code.
11959 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
11960 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
11962 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
11963 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
11964 Fix problem with initial-exec relocations.
11965 (Target_i386::Relocate::relocate_tls): Likewise.
11966 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
11968 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
11969 support for section-plus-offset dynamic table entries.
11970 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
11971 (Output_data_dynamic::Dynamic_entry): Add support for
11972 section-plus-offset dynamic table entries.
11973 (Output_data_dynamic::Classification): Likewise.
11974 (Output_data_dynamic::classification_): Renamed offset_.
11975 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
11976 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
11977 (Target_x86_64::make_plt_section): New function.
11978 (Target_x86_64::reserve_tlsdesc_entries): New function.
11979 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
11980 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
11981 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
11982 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
11983 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
11984 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
11985 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
11986 add extra PLT entry for TLS descriptors.
11987 (Output_data_plt_x86_64::got_): New field.
11988 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
11989 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
11991 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
11993 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
11994 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
11995 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
11996 R_386_TLS_DESC_CALL relocations.
11997 (Target_x86_64::Scan::global): Likewise.
11998 (Target_x86_64::do_finalize_sections): Add dynamic table entries
11999 for TLS descriptors.
12000 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
12001 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
12002 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
12003 GD-to-IE relaxation.
12004 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
12005 and TLS_DESCRIPTORS.
12006 * Makefile.in: Rebuild.
12007 * configure: Rebuild.
12008 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
12009 (tls_test_shared2.so): New target.
12010 (tls_shared_gd_to_ie_test_SOURCES): New variable.
12011 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
12012 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
12013 (tls_shared_gd_to_ie_test_LDADD): New variable.
12014 (tls_shared_gnu2_gd_to_ie_test): New target.
12015 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
12017 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
12018 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
12019 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
12020 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
12021 (tls_shared_gnu2_test): New target.
12022 (tls_test_gnu2_shared.so): New target.
12023 (tls_shared_gnu2_test_SOURCES): New variable.
12024 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
12025 (tls_shared_gnu2_test_LDFLAGS): New variable.
12026 (tls_shared_gnu2_test_LDADD): New variable.
12027 * testsuite/Makefile.in: Rebuild.
12028 * testsuite/Makefile.
12030 2008-04-11 Ian Lance Taylor <iant@google.com>
12032 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
12034 * testsuite/Makefile.in: Rebuild.
12036 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
12038 * testsuite/script_test_2.cc (main): Adjust test.
12040 2008-04-11 David S. Miller <davem@davemloft.net>
12041 Ian Lance Taylor <iant@google.com>
12043 * options.h (General_options): Add entries for '-Y' and
12045 * options.cc (General_options:finalize): If -Y was used, add those
12046 entries to the library path instead of the default "/lib" and
12049 2008-04-11 David S. Miller <davem@davemloft.net>
12051 * testsuite/justsyms.t: Start at 0x100.
12052 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
12053 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
12055 * testsuite/script_test_2.cc: Adjust string and section length
12058 2008-04-09 Ian Lance Taylor <iant@google.com>
12061 * script-sections.cc (Sections_element::allocate_to_segment): Add
12063 (Output_section_definition::allocate_to_segment): Likewise.
12064 (Orphan_output_section::allocate_to_segment): Likewise.
12065 (Script_sections::attach_sections_using_phdrs_clause): Don't
12066 propagate non-PT_LOAD segments to orphan sections.
12067 * testsuite/Makefile.am (script_test_3.stdout): Generate using
12068 readelf rather than objdump.
12069 * testsuite/script_test_3.sh: Adjust accordingly. Test that
12070 .interp section and PT_INTERP segment are the same size.
12071 * testsuite/Makefile.in: Rebuild.
12073 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
12074 aliases for symbols defined in the same object.
12075 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
12076 (weak_alias_test_SOURCES): New variable.
12077 (weak_alias_test_DEPENDENCIES): New variable.
12078 (weak_alias_test_LDFLAGS): New variable.
12079 (weak_alias_test_LDADD): New variable.
12080 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
12081 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
12082 (weak_alias_test_3.o): New target.
12083 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
12084 * testsuite/weak_alias_test_main.cc: New file.
12085 * testsuite/weak_alias_test_1.cc: New file.
12086 * testsuite/weak_alias_test_2.cc: New file.
12087 * testsuite/weak_alias_test_3.cc: New file.
12089 2008-04-08 Ian Lance Taylor <iant@google.com>
12091 * options.h (class General_options): Add --noinhibit-exec option.
12092 * main.cc (main): Check --noinhibit-exec.
12094 * options.h (class General_options): Define --wrap as a special
12095 option. Add wrap_symbols_ field.
12096 (General_options::any_wrap_symbols): New function.
12097 (General_options::is_wrap_symbol): New function.
12098 * options.cc (General_options::parse_wrap): New function.
12099 (General_options::General_options): Initialize wrap_symbols_.
12100 * symtab.cc (Symbol_table::wrap_symbol): New function.
12101 (Symbol_table::add_from_object): Handle --wrap.
12102 * symtab.h (class Symbol_table): Declare wrap_symbol.
12103 * target.h (Target::wrap_char): New function.
12104 (Target::Target_info): Add wrap_char field.
12105 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
12106 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12107 * testsuite/testfile.cc (Target_test::test_target_info):
12110 * errors.cc (Errors::undefined_symbol): Mention symbol version if
12113 * layout.h (class Layout): Add added_eh_frame_data_ field.
12114 * layout.cc (Layout::Layout): Initialize new field.
12115 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
12116 output section until we find a section we merged successfully.
12117 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
12118 that the size be non-zero.
12120 * merge.cc (Object_merge_map::get_output_offset): Remove inline
12123 2008-04-08 Craig Silverstein <csilvers@google.com>
12125 * configure.ac: Export new conditional variable HAVE_ZLIB.
12126 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
12128 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
12129 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12131 2008-04-07 Ian Lance Taylor <iant@google.com>
12133 * version.cc (version_string): Set to "1.5".
12135 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
12136 Add issued_non_pic_error_ field. Declare check_non_pic.
12137 (Target_x86_64::Scan::check_non_pic): New function.
12138 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
12139 (Target_x86_64::Scan::global): Likewise.
12141 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
12142 addend parameter. Change caller. Handle merge sections.
12143 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
12144 Address to Addend. Don't add in the result of
12145 local_section_offset, pass down the addend and use the returned
12147 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
12148 Update declarations of local_section_offset and symbol_value.
12149 * testsuite/two_file_test_1.cc (t18): New function.
12150 * testsuite/two_file_test_2.cc (f18): New function.
12151 * testsuite/two_file_test_main.cc (main): Call t18.
12152 * testsuite/two_file_test.h (t18, f18): Declare.
12154 * configure.ac: Don't test for objdump, c++filt, or readelf.
12155 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
12157 (TEST_READELF): New variable.
12158 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
12159 (check_PROGRAMS): Add two_file_strip_test.
12160 (two_file_strip_test): New target.
12161 (check_PROGRAMS): Add two_file_same_shared_strip_test.
12162 (two_file_same_shared_strip_test_SOURCES): New variable.
12163 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
12164 (two_file_same_shared_strip_test_LDFLAGS): New variable.
12165 (two_file_same_shared_strip_test_LDADD): New variable.
12166 (two_file_shared_strip.so): New target.
12167 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
12168 (ver_test_5.syms, ver_test_7.syms): Likewise.
12169 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
12170 (strip_test_3.stdout): Use TEST_OBJDUMP.
12171 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12173 2008-04-04 Cary Coutant <ccoutant@google.com>
12175 * symtab.h (Symbol::is_weak_undefined): New function.
12176 (Symbol::is_strong_undefined): New function.
12177 (Symbol::is_absolute): New function.
12178 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
12179 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
12181 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
12182 (weak_undef_test): New target.
12183 * testsuite/Makefile.in: Rebuild.
12184 * testsuite/weak_undef_file1.cc: New file.
12185 * testsuite/weak_undef_file2.cc: New file.
12186 * testsuite/weak_undef_test.cc: New file.
12188 2008-04-03 Craig Silverstein <csilvers@google.com>
12190 * compressed_output.h (class Output_compressed_section): Use
12192 * compressed_output.cc (zlib_compress): Use unsigned buffers,
12194 (zlib_compressed_suffix): Removed.
12195 (Output_compressed_section::set_final_data_size): Use unsigned
12197 * testsuite/Makefile.am (flagstest_compress_debug_sections):
12198 Fix linker invocation.
12199 (flagstest_o_specialfile_and_compress_debug_sections):
12201 * testsuite/Makefile.in: Regenerated.
12203 2008-04-02 David S. Miller <davem@davemloft.net>
12205 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
12206 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
12208 2008-04-02 Craig Silverstein <csilvers@google.com>
12212 2008-04-02 Ian Lance Taylor <iant@google.com>
12214 * fileread.cc (File_read::find_view): Add byteshift and vshifted
12215 parameters. Update for new key type to views_. Change all
12217 (File_read::read): Adjust for byteshift in returned view.
12218 (File_read::add_view): New function, broken out of
12219 find_and_make_view.
12220 (File_read::make_view): New function, broken out of
12221 find_and_make_view.
12222 (File_read::find_or_make_view): Add offset and aligned
12223 parameters. Rewrite accordingly. Change all callers.
12224 (File_read::get_view): Add offset and aligned parameters. Adjust
12225 for byteshift in return value.
12226 (File_read::get_lasting_view): Likewise.
12227 * fileread.h (class File_read): Update declarations.
12228 (class File_read::View): Add byteshift_ field. Add byteshift to
12229 constructor. Add byteshift method.
12230 * archive.h (Archive::clear_uncached_views): New function.
12231 (Archive::get_view): Add aligned parameter. Change all callers.
12232 * object.h (Object::get_view): Add aligned parameter. Change all
12234 (Object::get_lasting_view): Likewise.
12236 * fileread.cc (File_read::release): Don't call clear_views if
12237 there are multiple objects.
12238 * fileread.h (File_read::clear_uncached_views): New function.
12239 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
12242 2008-03-31 Cary Coutant <ccoutant@google.com>
12244 Add thin archive support.
12245 * archive.cc (Archive::armagt): New const.
12246 (Archive::setup): Remove task parameter and calls to unlock.
12247 (Archive::unlock_nested_archives): New function.
12248 (Archive::read_header): Add nested_off parameter. Change
12250 (Archive::interpret_header): Likewise.
12251 (Archive::include_all_members): Change to handle thin
12253 (Archive::include_member): Likewise.
12254 * archive.h (Archive::Archive): Add new parameters and
12256 (Archive::armagt): New const.
12257 (Archive::setup): Remove task parameter.
12258 (Archive::unlock_nested_archives): New function.
12259 (Archive::read_header): Add nested_off parameter.
12260 (Archive::interpret_header): Likewise.
12261 (Archive::Nested_archive_table): New typedef.
12262 (Archive::is_thin_archive_): New field.
12263 (Archive::nested_archives_): New field.
12264 (Archive::options_): New field.
12265 (Archive::dirpath_): New field.
12266 (Archive::task_): New field.
12267 * readsyms.cc (Read_symbols::do_read_symbols): Add check
12268 for thin archives. Pass additional parameters to
12269 Archive::Archive. Unlock the archive file after calling
12272 2008-03-29 Ian Lance Taylor <iant@google.com>
12274 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12275 version symbol to be local.
12276 * testsuite/ver_test_4.sh: New file.
12277 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12278 (check_DATA): Add ver_test_4.syms.
12279 (ver_test_4.syms): New target.
12280 * testsuite/Makefile.in: Rebuild.
12283 (Output_section::Input_section_sort_entry::has_priority): New
12285 (Output_section::Input_section_sort_entry::match_file_name): New
12287 (Output_section::Input_section_sort_entry::match_section_name):
12289 (Output_section::Input_section_sort_entry::match_section_name_prefix):
12291 (Output_section::Input_section_sort_entry::match_section_file):
12293 (Output_section::Input_section_sort_compare::operator()): Rewrite
12294 using new Input_section_sort_entry functions. Sort crtbegin and
12295 crtend first. Sort sections with no priority before sections with
12297 * testsuite/initpri1.c (d3): Check j != 4.
12298 (cd5): New constructor/destructor function.
12299 (main): Check j != 2.
12301 * symtab.cc (Symbol_table::add_from_object): If we don't use the
12302 new symbol when resolving, don't call set_is_default.
12303 * testsuite/ver_test_7.cc: New file.
12304 * testsuite/ver_test_7.sh: New file.
12305 * testsuite/Makefile.am (ver_test_7.so): New target.
12306 (ver_test_7.o): New target.
12307 (check_SCRIPTS): Add ver_test_7.sh.
12308 (check_DATA): Add ver_test_7.syms.
12309 (ver_test_7.syms): New target.
12311 2008-03-28 Ian Lance Taylor <iant@google.com>
12313 * layout.cc (Layout::layout): If we see an input section with a
12314 name that needs sorting, set the must_sort flag for the output
12316 (Layout::make_output_section): If the name of the output section
12317 indicates that it might require sorting, set the may_sort flag.
12318 * output.h (Output_section::may_sort_attached_input_sections): New
12320 (Output_section::set_may_sort_attached_input_sections): New
12322 (Output_section::must_sort_attached_input_sections): New
12324 (Output_section::set_must_sort_attached_input_sections): New
12326 (class Output_section): Declare Input_section_sort_entry. Define
12327 Input_section_sort_compare. Declare
12328 sort_attached_input_sections. Add new fields:
12329 may_sort_attached_input_sections_,
12330 must_sort_attached_input_sections_,
12331 attached_input_sections_are_sorted_.
12332 * output.cc (Output_section::Output_section): Initialize new
12334 (Output_section::add_input_section): Add an entry to
12335 input_sections_ if may_sort or must_sort are true.
12336 (Output_section::set_final_data_size): Call
12337 sort_attached_input_sections if necessary.
12338 (Output_section::Input_section_sort_entry): Define new class.
12339 (Output_section::Input_section_sort_compare::operator()): New
12341 (Output_section::sort_attached_input_sections): New function.
12342 * configure.ac: Check whether the compiler supports constructor
12343 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
12344 * testsuite/initpri1.c: New file.
12345 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
12346 CONSTRUCTOR_PRIORITY.
12347 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
12348 (initpri1_LDFLAGS): New variable.
12349 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12351 2008-03-27 Ian Lance Taylor <iant@google.com>
12353 * common.cc (Sort_commons::operator): Correct sorting algorithm.
12354 * testsuite/common_test_1.c: New file.
12355 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
12356 (common_test_1_SOURCES): New variable.
12357 (common_test_1_DEPENDENCIES): New variable.
12358 (common_test_1_LDFLAGS): New variable.
12360 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
12361 and commons_ correctly when NAME/VERSION does not override
12363 * testsuite/ver_test_6.c: New file.
12364 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
12365 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
12366 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
12368 2008-03-26 Ian Lance Taylor <iant@google.com>
12370 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
12371 of an undefined symbol from a version script.
12372 * testsuite/Makefile.am (ver_test_5.so): New target.
12373 (ver_test_5.o): New target.
12374 (check_SCRIPTS): Add ver_test_5.sh.
12375 (check_DATA): Add ver_test_5.syms.
12376 (ver_test_5.syms): New target.
12377 * testsuite/ver_test_5.cc: New file.
12378 * testsuite/ver_test_5.script: New file.
12379 * testsuite/ver_test_5.sh: New file.
12380 * Makefile.in, testsuite/Makefile.in: Rebuild.
12383 Fix problems building gold with gcc 4.3.0.
12384 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
12385 (gold_error_at_location, gold_warning_at_location): Use it.
12386 * configure.ac: Check whether we can compile and use a template
12387 function with a printf attribute.
12388 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
12389 when jumping over bytes.
12390 * object.cc: Instantiate Object::read_section_data.
12391 * debug.h: Include <cstring>
12392 * dwarf_reader.cc: Include <algorithm>
12393 * main.cc: Include <cstring>.
12394 * options.cc: Include <cstring>.
12395 * output.cc: Include <cstring>.
12396 * script.cc: Include <cstring>.
12397 * script.h: Include <string>.
12398 * symtab.cc: Include <cstring> and <algorithm>.
12399 * target-select.cc: Include <cstring>.
12400 * version.cc: Include <string>.
12401 * testsuite/testmain.cc: Include <cstdlib>.
12402 * configure, config.in: Rebuild.
12404 2008-03-25 Ian Lance Taylor <iant@google.com>
12406 * options.cc: Include "../bfd/bfdver.h".
12407 (options::help): Print bug reporting address.
12409 * version.cc (print_version): Adjust output for current value of
12410 BFD_VERSION_STRING.
12414 * options.cc (options::help): Print list of supported targets.
12415 * target-select.h: Include <vector>.
12416 (class Target_selector): Make machine_, size_, and is_big_endian_
12417 fields const. Add bfd_name_ and instantiated_target_ fields.
12418 (Target_selector::Target_selector): Add bfd_name parameter.
12419 (Target_selector::recognize): Make non-virtual, call
12421 (Target_selector::recognize_by_name): Make non-virtual, call
12422 do_recognize_by_name.
12423 (Target_selector::supported_names): New function.
12424 (Target_selector::bfd_name): New function.
12425 (Target_selector::do_instantiate_target): New pure virtual
12427 (Target_selector::do_recognize): New virtual function.
12428 (Target_selector::do_recognize_by_name): New virtual function.
12429 (Target_selector::instantiate_target): New private function.
12430 (supported_target_names): Declare.
12431 * target-select.cc (Target_selector::Target_selector): Update for
12432 new parameter and fields.
12433 (select_target_by_name): Check that the name matches before
12434 calling recognize_by_name.
12435 (supported_target_names): New function.
12436 * i386.cc (class Target_selector_i386): Update Target_selector
12437 constructor call. Remove recognize and recognize_by_name. Add
12438 do_instantiate_target.
12439 * x86_64.cc (class Target_selector_x86_64): Likewise.
12440 * testsuite/testfile.cc (class Target_selector_test): Update for
12441 changes to Target_selector.
12443 * README: Rewrite, with some notes on unsupported features.
12445 2008-03-24 Cary Coutant <ccoutant@google.com>
12447 * i386.cc (Target_i386::Got_type): New enum declaration.
12448 (Target_i386::Scan::local): Updated callers of Output_data_got
12450 (Target_i386::Scan::global): Likewise.
12451 (Target_i386::Relocate::relocate): Likewise.
12452 (Target_i386::Relocate::relocate_tls): Likewise.
12453 * object.h (Got_offset_list): New class.
12454 (Sized_relobj::local_has_got_offset): Added got_type parameter.
12455 (Sized_relobj::local_got_offset): Likewise.
12456 (Sized_relobj::set_local_got_offset): Likewise.
12457 (Sized_relobj::local_has_tls_got_offset): Removed.
12458 (Sized_relobj::local_tls_got_offset): Removed.
12459 (Sized_relobj::set_local_tls_got_offset): Removed.
12460 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
12461 * output.cc (Output_data_got::add_global): Added got_type parameter.
12462 (Output_data_got::add_global_with_rel): Likewise.
12463 (Output_data_got::add_global_with_rela): Likewise.
12464 (Output_data_got::add_global_pair_with_rel): New function.
12465 (Output_data_got::add_global_pair_with_rela): New function.
12466 (Output_data_got::add_local): Added got_type parameter.
12467 (Output_data_got::add_local_with_rel): Likewise.
12468 (Output_data_got::add_local_with_rela): Likewise.
12469 (Output_data_got::add_local_pair_with_rel): New function.
12470 (Output_data_got::add_local_pair_with_rela): New function.
12471 (Output_data_got::add_global_tls): Removed.
12472 (Output_data_got::add_global_tls_with_rel): Removed.
12473 (Output_data_got::add_global_tls_with_rela): Removed.
12474 (Output_data_got::add_local_tls): Removed.
12475 (Output_data_got::add_local_tls_with_rel): Removed.
12476 (Output_data_got::add_local_tls_with_rela): Removed.
12477 * output.h (Output_data_got::add_global): Added got_type parameter.
12478 (Output_data_got::add_global_with_rel): Likewise.
12479 (Output_data_got::add_global_with_rela): Likewise.
12480 (Output_data_got::add_global_pair_with_rel): New function.
12481 (Output_data_got::add_global_pair_with_rela): New function.
12482 (Output_data_got::add_local): Added got_type parameter.
12483 (Output_data_got::add_local_with_rel): Likewise.
12484 (Output_data_got::add_local_with_rela): Likewise.
12485 (Output_data_got::add_local_pair_with_rel): New function.
12486 (Output_data_got::add_local_pair_with_rela): New function.
12487 (Output_data_got::add_global_tls): Removed.
12488 (Output_data_got::add_global_tls_with_rel): Removed.
12489 (Output_data_got::add_global_tls_with_rela): Removed.
12490 (Output_data_got::add_local_tls): Removed.
12491 (Output_data_got::add_local_tls_with_rel): Removed.
12492 (Output_data_got::add_local_tls_with_rela): Removed.
12493 * resolve.cc (Symbol::override_base_with_special): Removed
12494 reference to has_got_offset_ field.
12495 * symtab.cc (Symbol::init_fields): Replaced initialization
12496 of got_offset_ with got_offsets_. Removed initialization
12498 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
12499 (Symbol::got_offset): Likewise.
12500 (Symbol::set_got_offset): Likewise.
12501 (Symbol::has_tls_got_offset): Removed.
12502 (Symbol::tls_got_offset): Removed.
12503 (Symbol::set_tls_got_offset): Removed.
12504 (Symbol::got_offset_): Removed.
12505 (Symbol::tls_mod_got_offset_): Removed.
12506 (Symbol::tls_pair_got_offset_): Removed.
12507 (Symbol::got_offsets_): New field.
12508 (Symbol::has_got_offset): Removed.
12509 (Symbol::has_tls_mod_got_offset): Removed.
12510 (Symbol::has_tls_pair_got_offset): Removed.
12511 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
12512 (Target_x86_64::Scan::local): Updated callers of Output_data_got
12514 (Target_x86_64::Scan::global): Likewise.
12515 (Target_x86_64::Relocate::relocate): Likewise.
12516 (Target_x86_64::Relocate::relocate_tls): Likewise.
12518 2008-03-25 Ben Elliston <bje@au.ibm.com>
12520 * yyscript.y: Fix spelling error in comment.
12522 2008-03-24 Ian Lance Taylor <iant@google.com>
12524 * options.h (class General_options): Define build_id option.
12525 * layout.h (class Layout): Declare write_build_id, create_note,
12526 create_build_id. Add build_id_note_ member.
12527 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
12528 "libiberty.h", "md5.h", "sha1.h".
12529 (Layout::Layout): Initialize eh_frame_data_,
12530 eh_frame_hdr_section_, and build_id_note_.
12531 (Layout::finalize): Call create_build_id.
12532 (Layout::create_note): New function, broken out of
12533 Layout::create_gold_note.
12534 (Layout::create_gold_note): Call create_note.
12535 (Layout::create_build_id): New function.
12536 (Layout::write_build_id): New function.
12537 (Close_task_runner::run): Call write_build_id.
12539 * x86_64.cc: Correct license to GPLv3.
12541 2008-03-23 Ian Lance Taylor <iant@google.com>
12543 * options.cc: Include "demangle.h".
12544 (parse_optional_string): New function.
12545 (parse_long_option): Handle takes_optional_argument.
12546 (parse_short_option): Update dash_z initializer. Handle
12547 takes_optional_argument.
12548 (General_options::General_options): Initialize do_demangle_.
12549 (General_options::finalize): Set do_demangle_. Handle demangling
12551 * options.h (parse_optional_string): Declare.
12552 (struct One_option): Add optional_arg field. Update constructor.
12553 Update call constructor calls. Add takes_optional_argument
12555 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
12556 (DEFINE_optional_string): Define.
12557 (General_options::demangle): Change from DEFINE_bool to
12558 DEFINE_optional_string.
12559 (General_options::no_demangle): New function.
12560 (General_options::do_demangle): New function.
12561 (General_options::set_do_demangle): New function.
12562 (General_options::execstack_status_): Move definition to end of
12564 (General_options::static_): Likewise.
12565 (General_options::do_demangle_): New field.
12566 * object.cc (big_endian>::get_symbol_location_info): Call
12567 Options::do_demangle, not Options::demangle.
12568 * symtab.cc (demangle): Likewise.
12570 2008-03-22 Ian Lance Taylor <iant@google.com>
12572 * gold.h: Include <cstddef> and <sys/types.h>
12573 * options.h: Include <cstring>.
12575 2008-03-21 Ian Lance Taylor <iant@google.com>
12577 * Added source code to GNU binutils.