1 2012-03-14 Doug Kwan <dougkwan@google.com>
3 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
4 dynamic relocations for protected symbols in shared objects.
6 2012-03-13 Ian Lance Taylor <iant@google.com>
8 * resolve.cc (Symbol_table::resolve): When merging common symbols,
9 keep the larger alignment.
11 2012-03-12 Cary Coutant <ccoutant@google.com>
13 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
14 handling of DW_LNE_define_file.
16 2012-03-12 Cary Coutant <ccoutant@google.com>
18 * reduced_debug_output.cc
19 (Output_reduced_debug_info_section::get_die_end): Add new FORM
22 2012-02-29 Cary Coutant <ccoutant@google.com>
24 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
26 2012-02-29 Cary Coutant <ccoutant@google.com>
28 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
29 Call Object::decompressed_section_contents.
30 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
32 (Sized_dwarf_line_info::buffer_start_): New data member.
33 * merge.cc (Output_merge_data::do_add_input_section): Call
34 Object::decompressed_section_contents.
35 (Output_merge_string::do_add_input_section): Likewise.
36 * object.cc (need_decompressed_section): New function.
37 (build_compressed_section_map): Decompress sections needed later.
38 (Sized_relobj_file::do_decompressed_section_contents): New function.
39 (Sized_relobj_file::do_discard_decompressed_sections): New function.
40 * object.h (Object::decompressed_section_contents): New function.
41 (Object::discard_decompressed_sections): New function.
42 (Object::do_decompressed_section_contents): New function.
43 (Object::do_discard_decompressed_sections): New function.
44 (Compressed_section_info): New type.
45 (Compressed_section_map): Include decompressed section contents.
46 (Sized_relobj_file::do_decompressed_section_contents): New function.
47 (Sized_relobj_file::do_discard_decompressed_sections): New function.
49 2012-02-16 Cary Coutant <ccoutant@google.com>
51 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
52 * testsuite/Makefile.in: Regenerate.
54 2012-02-14 Cary Coutant <ccoutant@google.com>
56 * options.cc (General_options::finalize): Disallow -pie and -static.
58 2012-02-03 Doug Kwan <dougkwan@google.com>
60 * arm.cc (Arm_relocate_functions::abs8,
61 Arm_relocate_functions::abs16): Use
62 Bits::has_signed_unsigned_overflow32.
63 (Arm_relocate_functions::thm_abs8): Correct range of
65 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
68 2012-02-02 Doug Kwan <dougkwan@google.com>
70 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
71 position independent outputs, not just shared objects.
73 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
75 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
76 * configure: Regenerated.
78 2012-01-27 Ian Lance Taylor <iant@google.com>
80 * reloc.h (Bits): New class with static functions, copied from
81 namespace utils in arm.cc.
82 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
85 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
87 * incremental.cc (write_info_blocks): Correct relocation offset.
89 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
91 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
92 (Relocate::tls_gd_to_le): Likewise.
94 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
96 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
98 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
100 * configure.ac: Check if -mcmodel=medium works.
101 * configure: Regenerated.
103 2012-01-24 Cary Coutant <ccoutant@google.com>
105 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
107 (read_unsigned_LEB_128_x): ... this new function.
108 (read_signed_LEB_128): Replaced with inline definition and ...
109 (read_signed_LEB_128_x): ... this new function.
110 * int_encoding.h (read_unsigned_LEB_128_x): New function.
111 (read_unsigned_LEB_128): Add inline definition.
112 (read_signed_LEB_128_x): New function.
113 (read_signed_LEB_128): Add inline definition.
114 * testsuite/Makefile.am (leb128_unittest): New unit test.
115 * testsuite/Makefile.in: Regenerate.
116 * testsuite/leb128_unittest.cc: New unit test.
118 2012-01-23 Ian Lance Taylor <iant@google.com>
121 * i386.cc (Target_i386::do_code_fill): When using a jmp
122 instruction, pad with nop instructions.
123 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
125 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
127 * x86_64.cc (gc_process_relocs): Add typename on types used in
129 (scan_relocs): Likewise.
130 (relocate_section): Likewise.
131 (apply_relocation): Likewise.
133 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
135 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
136 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
139 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
141 * x86_64.cc: Initial support for x32.
143 2012-01-03 Cary Coutant <ccoutant@google.com>
145 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
146 Use abstract base class for GOT.
147 * gold/output.h (class Output_data_got_base): New abstract base class.
148 (class Output_data_got): Derive from new base class, adjust ctors.
149 (Output_data_got::reserve_slot): Make virtual; rename to
150 do_reserve_slot; Adjust callers.
151 * gold/target.h (Sized_target::init_got_plt_for_update): Return
152 pointer to abstract base class.
153 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
155 2011-12-18 Ian Lance Taylor <iant@google.com>
157 * object.h (Relobj::local_symbol_value): New function.
158 (Relobj::local_plt_offset): New function.
159 (Relobj::local_has_got_offset): New function.
160 (Relobj::local_got_offset): New function.
161 (Relobj::set_local_got_offset): New function.
162 (Relobj::do_local_symbol_value): New pure virtual function.
163 (Relobj::do_local_plt_offset): Likewise.
164 (Relobj::do_local_has_got_offset): Likewise.
165 (Relobj::do_local_got_offset): Likewise.
166 (Relobj::do_set_local_got_offset): Likewise.
167 (Sized_relobj::do_local_has_got_offset): Rename from
168 local_has_got_offset.
169 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
170 (Sized_relobj::do_set_local_got_offset): Rename from
171 set_local_got_offset.
172 (Sized_relobj_file::do_local_plt_offset): Rename from
174 (Sized_relobj_file::do_local_symbol_value): New function.
175 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
177 * output.cc (Output_data_got::Got_entry::write): Change object to
178 Relobj. Use local_symbol_value.
179 (Output_data_got::add_global_with_rel): Change rel_dyn to
180 Output_data_reloc_generic*. Use add_global_generic.
181 (Output_data_got::add_global_with_rela): Remove. Change all
182 callers to use add_global_with_rel.
183 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
184 Output_data_reloc_generic*. Use add_global_generic.
185 (Output_data_got::add_global_pair_with_rela): Remove. Change all
186 callers to use add_global_pair_with_rel.
187 (Output_data_got::add_local): Change object to Relobj*.
188 (Output_data_got::add_local_plt): Likewise.
189 (Output_data_got::add_local_with_rel): Change object to Relobj*,
190 change rel_dyn to Output_data_reloc_generic*. Use
192 (Output_data_got::add_local_with_rela): Remove. Change all
193 callers to use all_local_with_rel.
194 (Output_data_got::add_local_pair_with_rel): Change object to
195 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
196 add_output_section_generic.
197 (Output_data_got::add_local_pair_with_rela): Remove. Change all
198 callers to use add_local_pair_with_rel.
199 (Output_data_got::reserve_local): Change object to Relobj*.
200 * output.h: (class Output_data_reloc_generic): Add pure virtual
201 declarations for add_global_generic, add_local_generic,
202 add_output_section_generic.
203 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
204 functions for Output_data_reloc_generic. Update declarations for
205 changes listed in output.cc.
206 (class Output_data_got): Change template parameter to got_size.
207 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
208 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
210 (Sized_relobj_incr::do_local_plt_offset): New function.
211 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
214 2011-12-17 Cary Coutant <ccoutant@google.com>
216 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
217 * resolve.cc (Symbol_table::resolve): Likewise.
218 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
220 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
222 2011-12-16 Ian Lance Taylor <iant@google.com>
224 * output.h (Output_data_reloc_generic::add): Only call
225 add_dynamic_reloc if this is a dynamic reloc section.
227 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
230 * target-reloc.h (apply_relocation): Replace <64, false> with
233 2011-11-25 Nick Clifton <nickc@redhat.com>
235 * po/it.po: New Italian translation.
237 2011-11-17 Sterling Augustine <saugustine@google.com>
239 * script.cc (script_include_directive): Implement.
240 (read_script_file): New local variables name and search_path. Update
241 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
242 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
243 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
245 2011-11-11 Sterling Augustine <saugustine@google.com>
247 * yyscript.y (section_cmd): Add support for INCLUDE directive.
248 (file_or_sections_cmd): Likewise.
250 2011-11-11 Doug Kwan <dougkwan@google.com>
252 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
253 if --just-symbols is given.
255 2011-11-10 Doug Kwan <dougkwan@google.com>
258 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
259 when processing data relocs.
260 * reloc.h (Relocate_functions::rel_unaligned): New method.
261 (Relocate_functions::pcrel_unaligned): Ditto.
262 (Relocate_functions::rel32_unaligned): Ditto.
263 (Relocate_functions::pcrel32_unaligned): Ditto.
265 2011-11-09 Doug Kwan <dougkwan@google.com>
268 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
269 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
270 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
271 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
272 (Relocate_functions::rel_unaligned): New.
273 (Relocate_functions::rel32_unaligned): New.
274 * target-reloc.h (relocate_for_relocatable): Add code to handle
275 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
276 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
277 arm_unaligned_reloc_r): New targets.
278 * testsuite/Makefile.in: Regenerate.
279 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
282 2011-11-02 Ian Lance Taylor <iant@google.com>
284 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
286 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
287 * options.cc (General_options::finalize): Use library search path
288 from configure script if specified. If not native and no sysroot,
289 only search TOOLLIBDIR.
290 * options.h (Search_directory::Search_directory): Change name to
292 (General_options::add_to_library_path_with_sysroot): Change arg to
294 * configure, Makefile.in, config.in: Rebuild.
296 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
298 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
299 we are working around the ARM1176 Erratum.
300 * options.h (General_options::fix_arm1176): Add option.
301 * testsuite/Makefile.am: Add testcases, and keep current ones
303 * testsuite/Makefile.in: Regenerate.
304 * testsuite/arm_fix_1176.s: New file.
305 * testsuite/arm_fix_1176.sh: Likewise.
307 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
309 * arm.cc (Target_arm::Target_arm): Remove initialisation of
311 (Target_arm::may_use_blx): Remove method.
312 (Target_arm::set_may_use_blx): Likewise.
313 (Target_arm::may_use_v4t_interworking): New method.
314 (Target_arm::may_use_v5t_interworking): Likewise.
315 (Target_arm::may_use_blx_): Remove member variable.
316 (Arm_relocate_functions::arm_branch_common): Check for v5T
318 (Arm_relocate_functions::thumb_branch_common): Likewise.
319 (Reloc_stub::stub_type_for_reloc): Likewise.
320 (Target_arm::do_finalize_sections): Correct interworking checks.
321 * testsuite/Makefile.am: Add new tests.
322 * testsuite/Makefile.in: Regenerate.
323 * testsuite/arm_farcall_arm_arm.s: New test.
324 * testsuite/arm_farcall_arm_arm.sh: Likewise.
325 * testsuite/arm_farcall_arm_thumb.s: Likewise.
326 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
327 * testsuite/arm_farcall_thumb_arm.s: Likewise.
328 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
329 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
330 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
332 2011-10-31 Cary Coutant <ccoutant@google.com>
335 * expression.cc (Expression::eval_with_dot): Add
336 is_section_dot_assignment parameter.
337 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
338 absolute and assigning to dot within a section.
340 (Output_section_element_assignment::set_section_addresses): Pass
341 dot_section to set_if_absolute.
342 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
343 as is_section_dot_assignment flag to eval_with_dot.
344 (Output_section_element_dot_assignment::set_section_addresses):
346 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
347 parameter. Also set value if relative to dot_section; set the
348 symbol's output_section.
349 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
350 parameter. Adjust all callers.
351 (Expression::eval_maybe_dot): Likewise.
352 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
354 * testsuite/script_test_2.t: Test assignment of an absolute value
355 to dot within an output section element.
357 2011-10-31 Cary Coutant <ccoutant@google.com>
359 * options.h (class General_options): Add --[no-]gnu-unique options.
360 * symtab.cc (Symbol_table::sized_write_globals): Convert
361 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
363 2011-10-31 Cary Coutant <ccoutant@google.com>
366 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
367 unnecessary assertion.
368 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
370 2011-10-31 Sriraman Tallam <tmsriram@google.com>
372 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
374 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
376 Change to just keep the section associated with symbol.
377 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
378 they are externally visible and --export-dynamic is turned on.
379 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
381 2011-10-19 Ian Lance Taylor <iant@google.com>
385 (Output_section_element_dot_assignment::needs_output_section): New
388 2011-10-19 Ian Lance Taylor <iant@google.com>
391 * layout.cc (Layout::segment_precedes): Don't assert failure if a
392 --section-start option was seen.
393 * options.h (General_options::any_section_start): New function.
395 2011-10-18 David S. Miller <davem@davemloft.net>
398 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
399 member to track relocation locations that have moved during TLS
401 (Target_sparc::Relocate::Relocate): Initialize to NULL.
402 (Target_sparc::Relocate::relocate): Adjust view down by 4
403 bytes if it matches reloc_adjust_addr_.
404 (Target_sparc::Relocate::relocate_tls): Always move the
405 __tls_get_addr call delay slot instruction forward 4 bytes when
406 performing relaxation.
408 2011-10-18 Cary Coutant <ccoutant@google.com>
410 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
411 (Output_file::map_no_anonymous): Check for non-zero
412 return code from posix_fallocate.
414 2011-10-17 Cary Coutant <ccoutant@google.com>
417 * plugin.cc (is_visible_from_outside): Check for symbols
418 referenced from dynamic objects.
419 * resolve.cc (Symbol_table::resolve): Don't count references
420 from dynamic objects as references from real ELF files.
421 * testsuite/plugin_test_2.sh: Adjust expected result.
423 2011-10-17 Cary Coutant <ccoutant@google.com>
425 * gold.cc: Include timer.h.
426 (queue_middle_tasks): Stamp time.
427 (queue_final_tasks): Likewise.
428 * main.cc (main): Store timer in parameters. Print timers
430 * parameters.cc (Parameters::Parameters): Initialize timer_.
431 (Parameters::set_timer): New function.
432 (set_parameters_timer): New function.
433 * parameters.h (Parameters::set_timer): New function.
434 (Parameters::timer): New function.
435 (Parameters::timer_): New data member.
436 (set_parameters_timer): New function.
437 * timer.cc (Timer::stamp): New function.
438 (Timer::get_pass_time): New function.
439 * timer.h (Timer::stamp): New function.
440 (Timer::get_pass_time): New function.
441 (Timer::pass_times_): New data member.
443 2011-10-17 Cary Coutant <ccoutant@google.com>
445 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
446 task for members of lib groups.
448 2011-10-17 Cary Coutant <ccoutant@google.com>
451 * fileread.cc (File_read::find_view): Add assert.
452 (File_read::make_view): Move bounds check (replace with assert)...
453 (File_read::find_or_make_view): ... to here.
455 2011-10-12 Cary Coutant <ccoutant@google.com>
457 * output.cc (Output_file::open_base_file): Handle case where
458 ::read returns less than requested size.
460 2011-10-10 Cary Coutant <ccoutant@google.com>
462 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
463 Initialize defined_count_.
464 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
465 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
466 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
467 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
468 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
469 * incremental.h (Sized_relobj_incr::defined_count_): New data
471 (Sized_incr_dynobj::defined_count_): New data member.
472 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
473 Return zeroes instead of internal error.
475 2011-10-10 Cary Coutant <ccoutant@google.com>
478 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
479 (Output_reloc::symbol_value): Return PLT offset if flag is set.
480 * output.h (class Output_reloc): Add use_plt_offset flag.
481 (Output_reloc::type_): Adjust size of bit field.
482 (Output_reloc::use_plt_offset_): New bit field.
483 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
484 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
485 flag. Adjust all callers.
486 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
487 creating RELATIVE relocations.
489 2011-10-10 Nick Clifton <nickc@redhat.com>
491 * po/es.po: Updated Spanish translation.
492 * po/fi.po: Updated Finnish translation.
494 2011-10-03 Diego Novillo <dnovillo@google.com>
496 * options.cc (parse_uint): Fix dereference of RETVAL.
498 2011-09-29 Sriraman Tallam <tmsriram@google.com>
500 * layout.h (section_order_map_): New member.
501 (get_section_order_map): New member function.
502 * output.cc (Output_section::add_input_section): Check for patterns
503 only when --section-ordering-file is specified.
504 * gold.cc (queue_middle_tasks): Delay updating order of sections till
505 output_sections have been formed.
506 * layout.cc (Layout_Layout): Initialize section_order_map_.
507 * plugin.cc (update_section_order): Store order in order_map. Do not
509 * testsuite/Makefile.am: Add test case for plugin_final_layout.
510 * testsuite/Makefile.in: Regenerate.
511 * testsuite/plugin_section_order.c: New file.
512 * testsuite/plugin_final_layout.cc: New file.
513 * testsuite/plugin_final_layout.sh: New file.
515 2011-09-29 Cary Coutant <ccoutant@google.com>
517 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
519 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
520 symbols during incremental update.
521 (Symbol_table::add_from_dynobj): Likewise.
523 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
524 Ian Lance Taylor <iant@google.com>
526 * symtab.cc (Symbol_table::define_special_symbol): Always
527 canonicalize version string.
529 2011-09-26 Cary Coutant <ccoutant@google.com>
531 * gold.cc (queue_initial_tasks): Move option checks ...
532 * options.cc (General_options::finalize): ... to here. Disable
533 some options; make others fatal.
535 2011-09-26 Cary Coutant <ccoutant@google.com>
538 * plugin.cc (get_symbols_v2): New function.
539 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
540 (is_referenced_from_outside): New function.
541 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
542 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
543 (get_symbols): Pass version parameter.
544 (get_symbols_v2): New function.
545 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
547 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
548 (onload): Add LDPT_GET_SYMBOLS_V2.
549 (all_symbols_read_hook): Use get_symbols_v2; check for
550 LDPR_PREVAILING_DEF_IRONLY_EXP.
551 * testsuite/plugin_test_3.sh: Update expected results.
553 2011-09-23 Simon Baldwin <simonb@google.com>
555 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
556 configuration options.
557 * configure: Regenerate.
558 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
559 * Makefile.in: Regenerate.
560 * testsuite/Makefile.in: Regenerate.
562 2011-09-19 Sriraman Tallam <tmsriram@google.com>
564 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
566 2011-09-19 Cary Coutant <ccoutant@google.com>
568 * incremental.cc (can_incremental_update): Fix typo in comment.
569 * incremental.h (can_incremental_update): Likewise.
571 2011-09-18 Cary Coutant <ccoutant@google.com>
573 * incremental.cc (can_incremental_update): New function.
574 * incremental.h (can_incremental_update): New function.
575 * layout.cc (Layout::init_fixed_output_section): Call it.
576 (Layout::make_output_section): Don't allow patch space in .eh_frame.
577 * object.cc (Sized_relobj_file::do_layout): Call
578 can_incremental_update.
580 2011-09-13 Cary Coutant <ccoutant@google.com>
582 * configure.ac: Check for glibc support for gnu_indirect_function
583 support with static linking, setting automake conditional
585 * Makefile.in: Regenerate.
586 * configure: Regenerate.
588 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
589 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
591 * testsuite/Makefile.in: Regenerate.
593 2011-09-13 Cary Coutant <ccoutant@google.com>
595 * incremental.cc (Sized_relobj_incr::do_layout): Call
596 report_comdat_group for kept comdat sections.
597 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
598 * testsuite/Makefile.in: Regenerate.
599 * testsuite/incr_comdat_test_1.cc: New source file.
600 * testsuite/incr_comdat_test_2_v1.cc: New source file.
601 * testsuite/incr_comdat_test_2_v2.cc: New source file.
602 * testsuite/incr_comdat_test_2_v3.cc: New source file.
604 2011-09-13 Ian Lance Taylor <iant@google.com>
606 * object.cc (Sized_relobj_file::do_layout): Remove unused local
607 variable external_symbols_offset.
609 2011-09-12 Ian Lance Taylor <iant@google.com>
611 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
612 triggered if object has no symbols.
614 2011-09-09 David S. Miller <davem@davemloft.net>
616 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
617 (Output_fill_debug_line::do_write): Likewise.
619 2011-08-29 Cary Coutant <ccoutant@google.com>
621 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
622 casts to match formatting specs.
623 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
625 2011-08-26 Cary Coutant <ccoutant@google.com>
627 * layout.cc (Free_list::allocate): Provide guarantee of minimum
628 remaining hole size when allocating.
629 (Layout::make_output_section): Set fill methods for debug sections.
630 * layout.h (Free_list::Free_list_node): Move from private to
632 (Free_list::set_min_hole_size): New function.
633 (Free_list::begin, Free_list::end): New functions.
634 (Free_list::min_hole_): New data member.
635 * output.cc: Include dwarf.h.
636 (Output_fill_debug_info::do_minimum_hole_size): New function.
637 (Output_fill_debug_info::do_write): New function.
638 (Output_fill_debug_line::do_minimum_hole_size): New function.
639 (Output_fill_debug_line::do_write): New function.
640 (Output_section::Output_section): Initialize new data member.
641 (Output_section::set_final_data_size): Ensure patch space is larger
642 than minimum hole size.
643 (Output_section::do_write): Fill holes in debug sections.
644 * output.h (Output_fill): New class.
645 (Output_fill_debug_info): New class.
646 (Output_fill_debug_line): New class.
647 (Output_section::set_free_space_fill): New function.
648 (Output_section::free_space_fill_): New data member.
649 * testsuite/Makefile.am (incremental_test_3): Add
650 --incremental-patch option.
651 (incremental_test_4): Likewise.
652 (incremental_test_5): Likewise.
653 (incremental_test_6): Likewise.
654 (incremental_copy_test): Likewise.
655 (incremental_common_test_1): Likewise.
656 * testsuite/Makefile.in: Regenerate.
658 2011-08-26 Nick Clifton <nickc@redhat.com>
660 * po/es.po: Updated Spanish translation.
662 2011-08-01 Cary Coutant <ccoutant@google.com>
664 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
665 * gold/testsuite/Makefile.in: Regenerate.
666 * gold/testsuite/justsyms_exec.c: New source file.
667 * gold/testsuite/justsyms_lib.c: New source file.
669 2011-08-01 Cary Coutant <ccoutant@google.com>
671 * layout.cc (Layout::set_segment_offsets): Don't realign text
672 segment if -Ttext was specified.
673 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
675 * object.h (Sized_relobj_file::e_type): New function.
676 (Sized_relobj_file::e_type_): New data member.
677 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
678 base address for ET_EXEC files.
679 * target.cc (Target::do_make_elf_object_implementation): Allow
680 ET_EXEC files with --just-symbols option.
682 2011-07-28 Cary Coutant <ccoutant@google.com>
684 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
685 Add thread_number parameter.
686 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
687 * workqueue-threads.cc
688 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
689 current thread if its thread number is greater than desired thread
691 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
692 Add thread_number parameter.
693 (Workqueue::should_cancel_thread): Likewise.
694 (Workqueue::find_runnable_or_wait): Pass thread_number to
695 should_cancel_thread.
696 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
699 2011-07-22 Sriraman Tallam <tmsriram@google.com>
701 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
702 only after checking if it cannot be forced local.
703 * symtab.h (is_externally_visible): Check if the symbol is not forced
706 2011-07-15 Ian Lance Taylor <iant@google.com>
708 * options.h (class General_options): Add --print-output-format.
709 Move -EL next to -EB, for better --help output.
710 * target-select.cc: Include <cstdio>, "options.h", and
712 (Target_selector::do_target_bfd_name): New function.
713 (print_output_format): New function.
714 * target-select.h (class Target_selector): Update declarations.
715 (Target_selector::target_bfd_name): New function.
716 (print_output_format): Declare.
717 * main.cc: Include "target-select.h".
718 (main): Handle --print-output-format.
719 * gold.cc: Include "target-select.h".
720 (queue_initial_tasks): Handle --print-output-format when there are
722 * parameters.cc (parameters_force_valid_target): Give a better
723 error message if -EB/-EL does not match target.
724 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
727 2011-07-15 Ian Lance Taylor <iant@google.com>
729 * i386.cc (class Output_data_plt_i386): Add layout_ field.
730 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
731 (Output_data_plt_i386::do_write): Write address of .dynamic
732 section to first entry in .got.plt section.
733 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
734 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
736 (Output_data_plt_x86_64::do_write): Write address of .dynamic
737 section to first entry in .got.plt section.
738 * layout.h (Layout::dynamic_section): New function.
740 2011-07-13 Sriraman Tallam <tmsriram@google.com>
742 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
744 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
745 input_section_position_, and input_section_glob_.
746 (read_layout_from_file): Call function section_ordering_specified.
747 * layout.h (is_section_ordering_specified): New function.
748 (section_ordering_specified): New function.
749 (section_ordering_specified_): New boolean member.
750 * main.cc(main): Call load_plugins after layout object is defined.
751 * output.cc (Output_section::add_input_section): Use
752 function section_ordering_specified to check if section ordering is
754 * output.cc (Output_section::add_relaxed_input_section): Use
755 function section_ordering_specified to check if section ordering is
757 (Output_section::update_section_layout): New function.
758 (Output_section::sort_attached_input_sections): Check if input section
760 * output.h (Output_section::update_section_layout): New function.
761 * plugin.cc (get_section_count): New function.
762 (get_section_type): New function.
763 (get_section_name): New function.
764 (get_section_contents): New function.
765 (update_section_order): New function.
766 (allow_section_ordering): New function.
767 (Plugin::load): Add the new interfaces to the transfer vector.
768 (Plugin_manager::load_plugins): New parameter.
769 (Plugin_manager::all_symbols_read): New parameter.
770 (Plugin_manager::claim_file): New parameter. Save the elf object for
772 (Plugin_manager::get_elf_object): New function.
773 (Plugin_manager::get_view): Change to directly use the bool to check
774 if get_view is called from claim_file_hook.
775 * plugin.h (input_objects): New function
776 (Plugin__manager::load_plugins): New parameter.
777 (Plugin_manager::claim_file): New parameter.
778 (Plugin_manager::get_elf_object): New function.
779 (Plugin_manager::in_claim_file_handler): New function.
780 (Plugin_manager::in_claim_file_handler_): New member.
781 (layout): New function.
782 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
783 handler with an extra parameter. Make the elf object before calling
785 * testsuite/plugin_test.c (get_section_count): New function pointer.
786 (get_section_type): New function pointer.
787 (get_section_name): New function pointer.
788 (get_section_contents): New function pointer.
789 (update_section_order): New function pointer.
790 (allow_section_ordering): New function pointer.
791 (onload): Check if the new interfaces exist.
793 2011-07-13 Ian Lance Taylor <iant@google.com>
795 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
797 * x86_64.cc (Target_x86_64::got_section): Likewise.
798 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
799 (relro_now_test_SOURCES): New variable.
800 (relro_now_test_DEPENDENCIES): New variable.
801 (relro_now_test_LDFLAGS): New variable.
802 (relro_now_test_LDADD): New variable.
803 (relro_now_test.so): New target.
804 * testsuite/Makefile.in: Rebuild.
806 2011-07-12 Ian Lance Taylor <iant@google.com>
809 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
810 GLOB_DAT relocation rather than a RELATIVE relocation for a
811 protected symbol when creating a shared library.
812 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
813 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
814 * testsuite/protected_main_1.cc (main): Test that protected
815 function has same address.
817 2011-07-11 Ian Lance Taylor <iant@google.com>
820 * options.h (class General_options): Add -Bgroup.
821 * options.cc (General_options::finalize): If -Bgroup is set,
822 default to --unresolved-symbols=report-all.
823 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
824 * target-reloc.h (issue_undefined_symbol_error): Handle
825 --unresolved-symbols=report-all.
827 2011-07-08 Ian Lance Taylor <iant@google.com>
830 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
831 if linker script discards key sections.
832 (Layout::create_dynamic_symtab): Likewise.
833 (Layout::assign_local_dynsym_offsets): Likewise.
834 (Layout::sized_create_version_sections): Likewise.
835 (Layout::create_interp): Likewise.
836 (Layout::finish_dynamic_section): Likewise.
837 (Layout::set_dynamic_symbol_size): Likewise.
839 2011-07-08 Ian Lance Taylor <iant@google.com>
842 * options.h (class General_options): Add --unresolved-symbols.
843 * target-reloc.h (issue_undefined_symbol_error): Check
844 --unresolved-symbols. Add comments.
846 2011-07-08 Ian Lance Taylor <iant@google.com>
848 * testsuite/odr_violation2.cc (Ordering::operator()): Make
849 expression more complex.
851 2011-07-08 Ian Lance Taylor <iant@google.com>
854 * target-reloc.h (issue_undefined_symbol_error): New inline
855 function, broken out of relocate_section.
856 (relocate_section): Call issue_undefined_symbol_error.
857 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
858 there is no TLS segment if we are about to issue an undefined
860 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
862 2011-07-08 Ian Lance Taylor <iant@google.com>
865 * resolve.cc (Symbol_table::should_override): Add fromtype
866 parameter. Change all callers. Give error when linking together
867 TLS and non-TLS symbol.
868 (Symbol_table::should_override_with_special): Add fromtype
869 parameter. Change all callers.
870 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
871 there is no TLS segment if we have reported some errors.
872 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
874 2011-07-08 Ian Lance Taylor <iant@google.com>
877 * target.h (Target::plt_address_for_global): New function.
878 (Target::plt_address_for_local): New function.
879 (Target::plt_section_for_global): Remove.
880 (Target::plt_section_for_local): Remove.
881 (Target::do_plt_address_for_global): New virtual function.
882 (Target::do_plt_address_for_local): New virtual function.
883 (Target::do_plt_section_for_global): Remove.
884 (Target::do_plt_section_for_local): Remove.
885 (Target::register_global_plt_entry): Add Symbol_table and Layout
887 * output.cc (Output_data_got::Got_entry::write): Use
888 plt_address_for_global and plt_address_for_local.
889 * layout.cc (Layout::add_target_dynamic_tags): Use size and
890 address of output section.
891 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
892 got_irelative_, and irelative_count_ fields. Update
894 (Output_data_plt_i386::has_irelative_section): New function.
895 (Output_data_plt_i386::entry_count): Add irelative_count_.
896 (Output_data_plt_i386::set_final_data_size): Likewise.
897 (class Target_i386): Add got_irelative_ and rel_irelative_
898 fields. Update declarations.
899 (Target_i386::Target_i386): Initialize new fields.
900 (Target_i386::do_plt_address_for_global): New function replacing
901 do_plt_section_for_global.
902 (Target_i386::do_plt_address_for_local): New function replacing
903 do_plt_section_for_local.
904 (Target_i386::got_section): Create got_irelative_.
905 (Target_i386::rel_irelative_section): New function.
906 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
907 fields. Don't define __rel_iplt_{start,end}.
908 (Output_data_plt_i386::add_entry): Add symtab and layout
909 parameters. Change all callers. Use different PLT and GOT for
911 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
912 layout parameters. Change all callers. Use different PLT and
914 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
915 (Output_data_plt_i386::rel_irelative): New function.
916 (Output_data_plt_i386::address_for_global): New function.
917 (Output_data_plt_i386::address_for_local): New function.
918 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
919 IRELATIVE GOT when changing IFUNC GOT entries.
920 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
922 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
923 if we didn't create an IRELATIVE GOT.
924 (Target_i386::Relocate::relocate): Use plt_address_for_global and
925 plt_address_for_local.
926 (Target_i386::do_dynsym_value): Use plt_address_for_global.
927 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
928 got_irelative_, and irelative_count_ fields. Update
930 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
931 Initialize new fields. Remove symtab parameter. Change all
933 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
935 (Output_data_plt_x86_64::has_irelative_section): New function.
936 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
937 (class Target_x86_64): Add got_irelative_ and rel_irelative_
938 fields. Update declarations.
939 (Target_x86_64::Target_x86_64): Initialize new fields.
940 (Target_x86_64::do_plt_address_for_global): New function replacing
941 do_plt_section_for_global.
942 (Target_x86_64::do_plt_address_for_local): New function replacing
943 do_plt_section_for_local.
944 (Target_x86_64::got_section): Create got_irelative_.
945 (Target_x86_64::rela_irelative_section): New function.
946 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
947 all callers. Don't create __rel_iplt_{start,end}.
948 (Output_data_plt_x86_64::add_entry): Add symtab and layout
949 parameters. Change all callers. Use different PLT and GOT for
951 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
952 layout parameters. Change all callers. Use different PLT and
954 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
955 parameters. Change all callers. Use different PLT and GOT for
957 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
958 (Output_data_plt_x86_64::rela_irelative): New function.
959 (Output_data_plt_x86_64::address_for_global): New function.
960 (Output_data_plt_x86_64::address_for_local): New function.
961 (Output_data_plt_x86_64::set_final_data_size): Likewise.
962 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
963 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
964 (Target_x86_64::register_global_plt_entry): Add symtab and layout
966 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
968 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
969 symbols if we didn't create an IRELATIVE GOT.
970 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
971 plt_address_for_local.
972 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
973 * testsuite/ifuncvar1.c: New test file.
974 * testsuite/ifuncvar2.c: New test file.
975 * testsuite/ifuncvar3.c: New test file.
976 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
977 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
978 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
979 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
980 * testsuite/Makefile.in: Rebuild.
982 2011-07-07 Cary Coutant <ccoutant@google.com>
984 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
985 (two_file_test_1_ndebug.o): Likewise.
986 (two_file_test_1b_ndebug.o): Likewise.
987 (two_file_test_2_ndebug.o): Likewise.
988 (two_file_test_main_ndebug.o): Likewise.
989 (incremental_test_2): Link with no-debug versions.
991 2011-07-06 Cary Coutant <ccoutant@google.com>
993 * gold/incremental.cc
994 (Output_section_incremental_inputs::write_info_blocks): Check for
995 hidden and internal symbols.
997 2011-07-06 Cary Coutant <ccoutant@google.com>
999 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
1000 Check disposition for startup file.
1001 (Incremental_inputs::report_command_line): Ignore
1002 --incremental-startup-unchanged option.
1003 * options.cc (General_options::parse_incremental_startup_unchanged):
1005 (General_options::General_options): Initialize new data member.
1006 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
1007 (General_options): Add --incremental-startup-unchanged option.
1008 (General_options::incremental_startup_disposition): New function.
1009 (General_options::incremental_startup_disposition_): New data member.
1011 2011-07-06 Cary Coutant <ccoutant@google.com>
1013 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
1014 input file index to Script_info ctor.
1015 (Sized_incremental_binary::do_file_has_changed): Find the
1016 command-line argument for files named in scripts.
1017 * incremental.h (Script_info::Script_info): New ctor
1018 with input file index.
1019 (Script_info::input_file_index): New function.
1020 (Script_info::input_file_index_): New data member.
1021 (Incremental_binary::get_library): Add const.
1022 (Incremental_binary::get_script_info): Add const.
1023 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
1024 * testsuite/Makefile.am (incremental_test_5): New test case.
1025 (incremental_test_6): New test case.
1026 * testsuite/Makefile.in: Regenerate.
1028 2011-07-06 Cary Coutant <ccoutant@google.com>
1030 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
1031 debug output when command lines differ.
1033 2011-07-06 Cary Coutant <ccoutant@google.com>
1035 * incremental.cc (Incremental_inputs::report_command_line): Ignore
1036 --incremental-patch option.
1037 * layout.cc (Free_list::allocate): Extend allocation beyond original
1039 (Layout::make_output_section): Mark sections that should get
1041 * options.cc (parse_percent): New function.
1042 * options.h (parse_percent): New function.
1043 (DEFINE_percent): New macro.
1044 (General_options): Add --incremental-patch option.
1045 * output.cc (Output_section::Output_section): Initialize new data
1047 (Output_section::add_input_section): Print section name when out
1049 (Output_section::add_output_section_data): Likewise.
1050 (Output_section::set_final_data_size): Add patch space when
1051 doing --incremental-full.
1052 (Output_section::do_reset_address_and_file_offset): Remove patch
1054 (Output_segment::set_section_list_addresses): Print debug output
1055 only if --incremental-update.
1056 * output.h (Output_section::set_is_patch_space_allowed): New function.
1057 (Output_section::is_patch_space_allowed_): New data member.
1058 (Output_section::patch_space_): New data member.
1059 * parameters.cc (Parameters::incremental_full): New function.
1060 * parameters.h (Parameters::incremental_full): New function
1061 * testsuite/Makefile.am (incremental_test_2): Add test for
1062 --incremental-patch option.
1063 * testsuite/Makefile.in: Regenerate.
1064 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
1065 (t18): Remove function body.
1067 2011-07-05 Doug Kwan <dougkwan@google.com>
1070 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
1071 Arm_Address type for relocation result.
1072 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
1074 (Arm_relocate_functions::abs32): Use unaligned access.
1075 (Arm_relocate_functions::rel32): Ditto.
1076 (Arm_relocate_functions::prel31): Ditto.
1077 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
1078 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
1079 static data relocations.
1080 * testsuite/Makefile.in: Regnerate.
1081 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
1083 2011-07-05 Ian Lance Taylor <iant@google.com>
1086 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
1087 symbols if necessary.
1088 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1090 2011-07-05 Ian Lance Taylor <iant@google.com>
1093 * resolve.cc (Symbol::override_base_with_special): Simply override
1094 version with special symbol version, ignoring previous version.
1096 2011-07-05 Ian Lance Taylor <iant@google.com>
1098 * object.cc (Sized_relobj_file::include_section_group): Add
1099 information to comment about signature location.
1101 2011-07-02 Ian Lance Taylor <iant@google.com>
1104 * options.h (class General_options): Add -f and -F.
1105 * options.cc (General_options::finalize): Fatal error if -f/-F
1106 are used without -shared.
1107 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
1109 2011-07-02 Ian Lance Taylor <iant@google.com>
1111 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
1113 2011-07-01 Ian Lance Taylor <iant@google.com>
1117 * resolve.cc (Symbol::override_base_with_special): Don't override
1118 the version if the overriding symbol has a different name.
1119 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
1120 all callers. If we give an error about an undefined version,
1121 define the base version if necessary.
1122 * dynobj.h (class Versions): Update declaration.
1123 * testsuite/weak_alias_test_5.cc: New file.
1124 * testsuite/weak_alias_test.script: New file.
1125 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
1126 and versioned_alias have the right value, and call t2.
1127 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
1128 weak_alias_test_5.so.
1129 (weak_alias_test_LDADD): Likewise.
1130 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
1131 * testsuite/Makefile.in: Rebuild.
1133 2011-07-01 Ian Lance Taylor <iant@google.com>
1136 * options.h (class General_options): Support -z notext.
1137 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
1139 (two_file_shared_nonpic.so): Likewise.
1140 (two_file_shared_mixed.so): Likewise.
1141 (two_file_shared_mixed_1.so): Likewise.
1142 (weak_undef_lib_nonpic.so): Likewise.
1143 (alt/weak_undef_lib_nonpic.so): Likewise.
1144 (tls_test_shared_nonpic.so): Likewise.
1145 * testsuite/Makefile.in: Rebuild.
1147 2011-07-01 Ian Lance Taylor <iant@google.com>
1150 * configure.ac: Test whether static linking works, setting
1151 the automake conditional HAVE_STATIC.
1152 * testsuite/Makefile.am: Disable tests using -static if
1153 HAVE_STATIC is not true.
1154 * configure, testsuite/Makefile.in: Rebuild.
1156 2011-07-01 Ian Lance Taylor <iant@google.com>
1159 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
1160 Assert if we see DW_EH_PE_indirect.
1161 * target.h (Target::ehframe_datarel_base): New function.
1162 (Target::do_ehframe_datarel_base): New target function.
1163 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
1164 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
1167 2011-07-01 Ian Lance Taylor <iant@google.com>
1170 * options.h (class General_options): Add
1171 --ld-generated-unwind-info.
1172 * ehframe.cc (Fde::write): Add address parameter. Change all
1173 callers. If associated with PLT, fill in address and size.
1174 (Cie::set_output_offset): Only add merge mapping if there is an
1176 (Cie::write): Add address parameter. Change all callers.
1177 (Eh_frame::add_ehframe_for_plt): New function.
1178 * ehframe.h (class Fde): Update declarations. Move shndx_ and
1179 input_offset_ fields into union u_, with new plt field.
1180 (Fde::Fde): Adjust for new union field.
1181 (Fde::Fde) [Output_data version]: New constructor.
1182 (Fde::add_mapping): Only add merge mapping if there is an object.
1183 (class Cie): Update declarations.
1184 (class Eh_frame): Declare add_ehframe_for_plt.
1185 * layout.cc (Layout::layout_eh_frame): Break out code into
1186 make_eh_frame_section, and call it.
1187 (Layout::make_eh_frame_section): New function.
1188 (Layout::add_eh_frame_for_plt): New function.
1189 * layout.h (class Layout): Update declarations.
1190 * merge.cc (Merge_map::add_mapping): Add assertion.
1191 * i386.cc: Include "dwarf.h".
1192 (class Output_data_plt_i386): Make first_plt_entry,
1193 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
1194 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1195 and plt_eh_frame_fde.
1196 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
1197 boundary. Call add_eh_frame_for_plt if appropriate.
1198 * x86_64.cc: Include "dwarf.h".
1199 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
1200 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
1201 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1202 and plt_eh_frame_fde.
1203 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
1206 2011-06-29 Ian Lance Taylor <iant@google.com>
1209 * object.cc (Sized_relobj_file::layout_section): Change shdr
1210 parameter to be const.
1211 (Sized_relobj_file::layout_eh_frame_section): New function, broken
1213 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
1214 appropriate. Call layout_eh_frame_section.
1215 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
1217 * object.h (class Sized_relobj_file): Update declarations.
1219 2011-06-29 Ian Lance Taylor <iant@google.com>
1222 * script.cc (Token::integer_value): Accept trailing M/m/K/k
1224 (Lex::gather_token): Accept trailing M/m/K/k for integers.
1226 2011-06-29 Ian Lance Taylor <iant@google.com>
1229 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
1231 * layout.cc (Layout::layout_eh_frame): Likewise.
1233 2011-06-29 Ian Lance Taylor <iant@google.com>
1236 * layout.cc (Layout::symtab_section_shndx): New function.
1237 * layout.h (class Layout): Declare symtab_section_shndx.
1238 * output.cc (Output_section::write_header): Call it.
1240 2011-06-29 Ian Lance Taylor <iant@google.com>
1243 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
1244 symbols which are not used in a relocation.
1246 2011-06-28 Ian Lance Taylor <iant@google.com>
1249 * layout.cc (Layout::segment_precedes): Don't crash if a linker
1250 script create indistinguishable segments.
1251 (Layout::set_segment_offsets): Use stable_sort when sorting
1252 segments. Pass this to Compare_segments constructor.
1253 * layout.h (class Layout): Make segment_precedes non-static.
1254 (class Compare_segments): Change from struct to class. Add
1255 layout_ field. Add constructor.
1256 * script-sections.cc
1257 (Script_sections::attach_sections_using_phdrs_clause): Rename
1258 local orphan to is_orphan. Don't report failure to put empty
1259 section in segment. On attachment failure, report name of
1260 section, and attach to first PT_LOAD segment.
1262 2011-06-28 Ian Lance Taylor <iant@google.com>
1265 * target-select.cc (Target_selector::Target_selector): Add
1266 emulation parameter. Change all callers.
1267 (select_target_by_bfd_name): Rename from select_target_by_name.
1269 (select_target_by_emulation): New function.
1270 (supported_emulation_names): New function.
1271 * target-select.h (class Target_selector): Add emulation_ field.
1272 Update declarations.
1273 (Target_selector::recognize_by_bfd_name): Rename from
1274 recognize_by_name. Change all callers.
1275 (Target_selector::supported_bfd_names): Rename from
1276 supported_names. Change all callers.
1277 (Target_selector::recognize_by_emulation): New function.
1278 (Target_selector::supported_emulations): New function.
1279 (Target_selector::emulation): New function.
1280 (Target_selector::do_recognize_by_bfd_name): Rename from
1281 do_recognize_by_name. Change all callers.
1282 (Target_selector::do_supported_bfd_names): Rename from
1283 do_supported_names. Change all callers.
1284 (Target_selector::do_recognize_by_emulation): New function.
1285 (Target_selector::do_supported_emulations): New function.
1286 (select_target_by_bfd_name): Change name in declaration.
1287 (select_target_by_emulation): Declare.
1288 (supported_emulation_names): Declare.
1289 * parameters.cc (parameters_force_valid_target): Try to find
1290 target based on emulation from -m option.
1291 * options.h (class General_options): Change doc string for -m.
1292 * options.cc (help): Print emulations.
1293 (General_options::parse_V): Likewise.
1294 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1295 Add emulation parameter. Change all callers.
1297 2011-06-28 Ian Lance Taylor <iant@google.com>
1299 * target.h (class Target): Add osabi_ field.
1300 (Target::osabi): New function.
1301 (Target::set_osabi): New function.
1302 (Target::Target): Initialize osabi_.
1303 (Target::do_adjust_elf_header): Make pure virtual.
1304 (Sized_target::do_adjust_elf_header): Declare.
1305 * target.cc (Sized_target::do_adjust_elf_header): New function.
1306 (class Sized_target): Instantiate all versions.
1307 * freebsd.h (class Target_freebsd): Remove.
1308 (Target_selector_freebsd::do_recognize): Call set_osabi on
1310 (Target_selector_freebsd::do_recognize_by_name): Likewise.
1311 (Target_selector_freebsd::set_osabi): Remove.
1312 * i386.cc (class Target_i386): Inherit from Sized_target rather
1313 than Target_freebsd.
1314 * x86_64.cc (class Target_x86_64): Likewise.
1316 2011-06-28 Ian Lance Taylor <iant@google.com>
1318 * target.h (Target::can_check_for_function_pointers): Rewrite.
1320 (Target::can_icf_inline_merge_sections): Likewise.
1321 (Target::section_may_have_icf_unsafe_poineters): Likewise.
1322 (Target::Target_info): Add can_icf_inline_merge_sections field.
1323 (Target::do_can_check_for_function_pointers): New virtual
1325 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
1326 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
1327 from can_check_for_function_pointers, move in file.
1328 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
1329 section_may_have_icf_unsafe_poineters, move in file.
1330 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
1331 * i386.cc (Target_i386::do_can_check_for_function_pointers):
1332 Rename from can_check_for_function_pointers, move in file.
1333 (Target_i386::can_icf_inline_merge_sections): Remove.
1334 (Target_i386::i386_info): Initialize
1335 can_icf_inline_merge_sections.
1336 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1337 Initialize can_icf_inline_merge_sections.
1338 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
1339 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
1340 Rename from can_check_for_function_pointers, move in file.
1341 (Target_x86_64::can_icf_inline_merge_sections): Remove.
1342 (Target_x86_64::x86_64_info): Initialize
1343 can_icf_inline_merge_sections.
1344 * testsuite/testfile.cc (Target_test::test_target_info):
1346 * icf.cc (get_section_contents): Correct formatting.
1348 2011-06-27 Ian Lance Taylor <iant@google.com>
1350 * symtab.cc (Symbol::versioned_name): New function.
1351 (Symbol_table::add_to_final_symtab): Use versioned_name when
1353 (Symbol_table::sized_write_symbol): Likewise.
1354 * symtab.h (class Symbol): Declare versioned_name.
1355 * stringpool.h (class Stringpool_template): Add variant of add
1356 which takes a std::basic_string.
1357 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
1358 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
1359 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
1360 (ver_test_12.o): New target.
1361 * testsuite/Makefile.in: Rebuild.
1363 2011-06-27 Doug Kwan <dougkwan@google.com>
1365 * arm.cc (Arm_relocate_functions::thm_jump8,
1366 Arm_relocate_functions::thm_jump11): Use a wider signed
1367 type to compute offset.
1368 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
1370 * testsuite/Makefile.in: Regenerate.
1371 * testsuite/arm_branch_in_range.sh: Check test results of
1372 arm_thm_jump11 and arm_thm_jump8.
1373 * testsuite/arm_thm_jump11.s: New test source file.
1374 * testsuite/arm_thm_jump11.t: New linker script.
1375 * testsuite/arm_thm_jump8.s: New test source file.
1376 * testsuite/arm_thm_jump8.t: New linker script.
1378 2011-06-24 Ian Lance Taylor <iant@google.com>
1380 * layout.cc: Include "object.h".
1381 (ctors_sections_in_init_array): New static variable.
1382 (Layout::is_ctors_in_init_array): New function.
1383 (Layout::layout): Add entry to ctors_sections_in_init_array if
1385 * layout.h (class Layout): Declare is_ctors_in_init_array.
1386 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
1387 is_ctors_reverse_view is set.
1388 (Sized_relobj_file::write_sections): Add layout parameter. Change
1389 all callers. Set is_ctors_reverse_view field of View_size.
1390 (Sized_relobj_file::reverse_words): New function.
1391 * object.h (Sized_relobj_file::View_size): Add
1392 is_ctors_reverse_view field.
1393 (class Sized_relobj_file): Update declarations.
1394 * testsuite/initpri3.c: New test.
1395 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
1397 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
1398 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
1399 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
1400 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
1401 * testsuite/Makefile.in: Rebuild.
1403 2011-06-24 Cary Coutant <ccoutant@google.com>
1405 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
1406 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
1407 (debug_msg_cdebug.err): New targets.
1408 * testsuite/Makefile.in: Regenerate.
1409 * testsuite/debug_msg.sh: Check output of link with compressed debug.
1410 Fix checks for link with shared library.
1412 2011-06-24 Doug Kwan <dougkwan@google.com>
1414 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
1415 skip empty text sections.
1416 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
1418 2011-06-22 Ian Lance Taylor <iant@google.com>
1421 * options.h (class General_options): Add --ctors-in-init-array.
1422 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
1423 friends as SHT_PROGBITS for merging sections.
1424 (Layout::layout): Remove special handling of .init_array and
1425 friends. Don't sort if doing relocatable link. Sort for .ctors
1426 and .dtors if ctors_in_init_array.
1427 (Layout::make_output_section): Force correct section types for
1428 .init_array and friends. Don't sort if doing relocatable link,
1429 Don't sort .ctors and .dtors if ctors_in_init_array.
1430 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
1431 (Layout::output_section_name): Add relobj parameter. Change all
1432 callers. Handle .ctors. and .dtors. in code rather than table.
1433 Handle .ctors and .dtors if ctors_in_init_array.
1434 (Layout::match_file_name): New function, moved from output.cc.
1435 * layout.h (class Layout): Update declarations.
1436 * output.cc: Include "layout.h".
1437 (Input_section_sort_entry::get_priority): New function.
1438 (Input_section_sort_entry::match_file_name): Just call
1439 Layout::match_file_name.
1440 (Output_section::Input_section_sort_init_fini_compare::operator()):
1441 Handle .ctors and .dtors. Sort by explicit priority rather than
1443 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
1444 * testsuite/initpri2.c: New test.
1445 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
1446 (check_PROGRAMS): Add initpri2.
1447 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
1448 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
1449 * configure, testsuite/Makefile.in: Rebuild.
1451 2011-06-19 Ian Lance Taylor <iant@google.com>
1454 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
1455 .interp section to a PT_INTERP segment even if we have seen a
1456 --dynamic-linker option. Don't do it if we have seen a PHDRS
1457 clause in a linker script.
1458 (Layout::finalize): Don't create a .interp section if we've
1459 already create a PT_INTERP segment.
1460 (Layout::create_interp): Always call choose_output_section (revert
1461 patch of 2011-06-17). Don't create PT_INTERP segment.
1462 * script-sections.cc
1463 (Script_sections::create_note_and_tls_segments): Add a .interp
1464 section to a PT_INTERP segment even if we have seen a
1465 --dynamic-linker option.
1467 2011-06-18 Ian Lance Taylor <iant@google.com>
1469 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
1470 merely because a non-PT_LOAD segment has a dynamic reloc.
1472 2011-06-18 Ian Lance Taylor <iant@google.com>
1474 * layout.cc (Layout::finish_dynamic_section): Don't create
1475 DT_FLAGS entry if not needed.
1477 2011-06-18 Ian Lance Taylor <iant@google.com>
1480 * layout.cc (Layout::layout_eh_frame): Correct handling of
1481 writable .eh_frame section.
1483 2011-06-17 Ian Lance Taylor <iant@google.com>
1486 * resolve.cc (Symbol_table::resolve): Don't give an error if a
1487 symbol is redefined with the exact same object and value.
1489 2011-06-17 Ian Lance Taylor <iant@google.com>
1492 * layout.h (class Layout): Add interp_segment_ field.
1493 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
1494 (Layout::attach_allocated_section_to_segment): If making shared
1495 library, put .interp section in PT_INTERP segment.
1496 (Layout::finalize): Also call create_interp if -dynamic-linker
1498 (Layout::create_interp): Assert that there is no PT_INTERP
1499 segment. If not using a SECTIONS clause, use make_output_section.
1500 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
1501 * script-sections.cc
1502 (Script_sections::create_note_and_tls_segments): If making shared
1503 library, put .interp section in PT_INTERP segment.
1505 2011-06-17 Ian Lance Taylor <iant@google.com>
1507 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
1508 when making a shared library.
1510 2011-06-17 Ian Lance Taylor <iant@google.com>
1512 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
1513 parameter. Change all callers. Don't issue warning about PC32
1514 against locally defined symbol.
1516 2011-06-16 Ian Lance Taylor <iant@google.com>
1518 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
1519 occurs in same object.
1521 2011-06-14 Alan Modra <amodra@gmail.com>
1523 * po/POTFILES.in: Regenerate.
1525 2011-06-09 Ian Lance Taylor <iant@google.com>
1527 * script-sections.cc
1528 (Orphan_output_section::set_section_addresses): For a relocatable
1529 link set address to 0.
1531 2011-06-09 Cary Coutant <ccoutant@google.com>
1534 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
1535 used with --compress-debug-sections.
1536 * gold/object.cc (Sized_relobj_file::do_layout): Report
1537 uncompressed size of compressed input sections.
1539 2011-06-08 Cary Coutant <ccoutant@google.com>
1542 * testsuite/two_file_test_2_v1.cc: Change initialization of
1543 v2 to keep it in .data.
1545 2011-06-07 Cary Coutant <ccoutant@google.com>
1547 * common.cc (Symbol_table::do_allocate_commons_list): Call
1549 * errors.cc (Errors::fatal): Adjust call to gold_exit.
1550 (Errors::fallback): New function.
1551 (gold_fallback): New function.
1552 * errors.h (Errors::fallback): New function.
1553 * gold.cc (gold_exit): Change status parameter to enum; adjust
1555 (queue_initial_tasks): Call gold_fallback.
1556 * gold.h: Include cstdlib.
1557 (Exit_status): New enum type.
1558 (gold_exit): Change status parameter to enum.
1559 (gold_fallback): New function.
1560 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
1561 (Layout::create_symtab_sections): Likewise.
1562 (Layout::create_shdrs): Likewise.
1563 * main.cc (main): Adjust call to gold_exit.
1564 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
1565 (Output_data_got::add_got_entry_pair): Likewise.
1566 (Output_section::add_input_section): Likewise.
1567 (Output_section::add_output_section_data): Likewise.
1568 (Output_segment::set_section_list_addresses): Likewise.
1569 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
1571 2011-06-07 Cary Coutant <ccoutant@google.com>
1573 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
1574 for incremental links.
1575 * output.cc (Output_segment::set_section_list_addresses): Remove
1576 FIXME and test for TLS or BSS.
1578 2011-06-07 Cary Coutant <ccoutant@google.com>
1580 * testsuite/Makefile.am: Add incremental_copy_test,
1581 incremental_common_test_1.
1582 * testsuite/Makefile.in: Regenerate.
1583 * testsuite/common_test_1_v1.c: New source file.
1584 * testsuite/common_test_1_v2.c: New source file.
1585 * testsuite/copy_test_v1.cc: New source file.
1587 2011-06-07 Cary Coutant <ccoutant@google.com>
1589 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
1590 update, allocate common from bss section's free list.
1591 * incremental-dump.cc (dump_incremental_inputs): Print flag for
1592 linker-defined symbols.
1593 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1594 Skip GOT and PLT entries that are no longer referenced.
1595 (Output_section_incremental_inputs::write_info_blocks): Mark
1596 linker-defined symbols.
1597 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
1598 * output.cc (Output_section::allocate): New function.
1599 * output.h (Output_section::allocate): New function.
1600 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
1601 linker-defined symbols.
1602 (Symbol::override_base_with_special): Copy is_predefined_ flag.
1603 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
1604 (Symbol::init_base_output_data): Likewise.
1605 (Symbol::init_base_output_segment): Likewise.
1606 (Symbol::init_base_constant): Likewise.
1607 (Sized_symbol::init_output_data): Likewise.
1608 (Sized_symbol::init_output_segment): Likewise.
1609 (Sized_symbol::init_constant): Likewise.
1610 (Symbol_table::do_define_in_output_data): Likewise.
1611 (Symbol_table::do_define_in_output_segment): Likewise.
1612 (Symbol_table::do_define_as_constant): Likewise.
1613 * symtab.h (Symbol::is_predefined): New function.
1614 (Symbol::init_base_output_data): Add is_predefined parameter.
1615 (Symbol::init_base_output_segment): Likewise.
1616 (Symbol::init_base_constant): Likewise.
1617 (Symbol::is_predefined_): New data member.
1618 (Sized_symbol::init_output_data): Add is_predefined parameter.
1619 (Sized_symbol::init_output_segment): Likewise.
1620 (Sized_symbol::init_constant): Likewise.
1621 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
1623 2011-06-07 Cary Coutant <ccoutant@google.com>
1625 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
1626 instead of emit_copy_reloc.
1627 (Copy_relocs::emit_copy_reloc): Refactor.
1628 (Copy_relocs::make_copy_reloc): New function.
1629 (Copy_relocs::add_copy_reloc): Remove.
1630 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
1632 (Copy_relocs::make_copy_reloc): New function.
1633 (Copy_relocs::add_copy_reloc): Remove.
1634 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
1635 unchanged input files.
1636 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
1637 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
1638 Reserve BSS space for COPY relocations.
1639 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1640 (Output_section_incremental_inputs::write_info_blocks): Record
1641 whether a symbol is copied from a shared object.
1642 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
1643 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
1644 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
1645 (Incremental_input_entry_reader::get_output_symbol_index): Add
1647 (Incremental_binary::emit_copy_relocs): New function.
1648 (Incremental_binary::do_emit_copy_relocs): New function.
1649 (Sized_incremental_binary::Sized_incremental_binary): Initialize
1651 (Sized_incremental_binary::add_copy_reloc): New function.
1652 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1653 (Sized_incremental_binary::Copy_reloc): New struct.
1654 (Sized_incremental_binary::Copy_relocs): New typedef.
1655 (Sized_incremental_binary::copy_relocs_): New data member.
1656 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
1657 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
1658 * target.h (Sized_target::emit_copy_reloc): New function.
1659 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
1661 2011-06-02 Cary Coutant <ccoutant@google.com>
1664 * gold/archive.cc (Archive::Archive): Initialize new data member.
1665 (Archive::include_all_members): Return if archive has already been
1667 * gold/archive.h (Archive::include_all_members_): New data member.
1669 2011-06-02 Nick Clifton <nickc@redhat.com>
1671 * dynobj.h: Fix spelling mistake in comment.
1672 * output.cc: Likewise.
1674 2011-05-31 Doug Kwan <dougkwan@google.com>
1678 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
1679 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
1680 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
1681 redundant arm_exidx_test.so.
1682 * testsuite/Makefile.in: Regenerate.
1683 (check_SCRIPTS): Add pr12826.sh
1684 (check_DATA): Add pr12826.stdout
1685 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
1686 * testsuite/pr12826.sh: New file.
1687 * testsuite/pr12826_1.s: Ditto.
1688 * testsuite/pr12826_1.s: Ditto.
1690 2011-05-30 Ian Lance Taylor <iant@google.com>
1692 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
1695 2011-05-29 Ian Lance Taylor <iant@google.com>
1698 * testsuite/Makefile.am: Use different file name for two_file_test
1699 temporary file for each incremental test.
1700 * testsuite/Makefile.in: Rebuild.
1702 2011-05-29 Ian Lance Taylor <iant@google.com>
1704 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
1705 binary input file is empty.
1707 2011-05-27 Ian Lance Taylor <iant@google.com>
1709 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
1710 (ver_test_9.so): Likewise.
1711 * testsuite/Makefile.in: Rebuild.
1713 2011-05-26 Cary Coutant <ccoutant@google.com>
1715 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
1716 * incremental.cc (Incremental_inputs::report_input_section): Fix
1717 comment, indentation.
1718 (Incremental_inputs::report_comdat_group): New function.
1719 (Output_section_incremental_inputs::set_final_data_size): Adjust size
1720 of data for incremental input file entry.
1721 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
1722 group count, COMDAT group signatures.
1723 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
1724 an unchanged input file.
1725 * incremental.h (Incremental_object_entry::Incremental_object_entry):
1726 Initialize new data member.
1727 (Incremental_object_entry::add_comdat_group): New function.
1728 (Incremental_object_entry::get_comdat_group_count): New function.
1729 (Incremental_object_entry::get_comdat_signature_key): New function.
1730 (Incremental_object_entry::groups_): New data member.
1731 (Incremental_inputs::report_comdat_group): New function.
1732 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
1733 data for incremental input file entry.
1734 (Incremental_input_entry_reader::get_comdat_group_count): New function.
1735 (Incremental_input_entry_reader::get_input_section): Adjust size of
1736 data for incremental input file entry.
1737 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
1738 (Incremental_input_entry_reader::get_comdat_group_signature): New
1740 * object.cc (Sized_relobj::include_section_group): Report kept
1741 COMDAT groups for incremental links.
1743 2011-05-24 David Meyer <pdox@google.com>
1745 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
1746 with name parameter. Add found_name parameter.
1747 * fileread.cc (Input_file::find_file): Adjust code accordingly.
1748 * dirsearch.h (class Dirsearch): Update declaration.
1750 2011-05-24 Ian Lance Taylor <iant@google.com>
1752 * archive.cc (Library_base::should_include_member): Pull in object
1753 from archive if it defines the entry symbol.
1754 * parameters.cc (Parameters::entry): New function.
1755 * parameters.h (class Parameters): Declare entry.
1756 * output.h (class Output_file_header): Remove entry_ field.
1757 * output.cc (Output_file_header::Output_file_header): Remove entry
1758 parameter. Change all callers.
1759 (Output_file_header::entry): Use parameters->entry.
1760 * gold.cc (queue_middle_tasks): Likewise.
1761 * plugin.cc (Plugin_hook::run): Likewise.
1763 2011-05-24 Cary Coutant <ccoutant@google.com>
1765 * gold.cc (queue_initial_tasks): Pass incremental base filename
1766 to Output_file::open_base_file; don't print error message.
1767 * incremental-dump.cc (main): Adjust call to
1768 Output_file::open_for_modification.
1769 * incremental-dump.cc (main): Likewise.
1770 * incremental.cc (Incremental_inputs::report_command_line):
1771 Ignore --incremental-base option when comparing command lines.
1772 Ignore parameter when given as separate argument.
1773 * options.h (class General_options): Add --incremental-base.
1774 * output.cc (Output_file::Output_file):
1775 (Output_file::open_base_file): Add base_name and writable parameters;
1776 read base file into new file; print error message here.
1777 (Output_file::map_no_anonymous): Add writable parameter; adjust all
1779 * output.h (Output_file::open_for_modification): Rename to...
1780 (Output_file::open_base_file): ...this; add base_name and
1781 writable parameters; adjust all callers.
1782 (Output_file::map_no_anonymous): Add writable parameter; adjust all
1784 * testsuite/Makefile.am (incremental_test_4): Test
1786 * testsuite/Makefile.in: Regenerate.
1788 2011-05-24 Cary Coutant <ccoutant@google.com>
1790 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
1792 * testsuite/Makefile.in: Regenerate.
1793 * testsuite/two_file_test_1_v1.cc: New test source file.
1794 * testsuite/two_file_test_1b_v1.cc: New test source file.
1795 * testsuite/two_file_test_2_v1.cc: New test source file.
1797 2011-05-24 Cary Coutant <ccoutant@google.com>
1799 * dynobj.h (Dynobj::do_dynobj): New function.
1800 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
1801 flag and soname for shared objects.
1802 * incremental.cc (Incremental_inputs::report_object): Make
1803 either Incremental_object_entry or Incremental_dynobj_entry; add
1804 soname to string table.
1805 (Incremental_inputs::report_input_section): Add assertion.
1806 (Output_section_incremental_inputs::set_final_data_size): Adjust
1807 type of input file entry for shared libraries; adjust size of
1808 shared library info entry.
1809 (Output_section_incremental_inputs::write_input_files): Write
1810 as_needed flag for shared libraries.
1811 (Output_section_incremental_inputs::write_info_blocks): Adjust type
1812 of input file entry for shared libraries; write soname.
1813 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
1814 soname from incremental info.
1815 * incremental.h (enum Incremental_input_flags): Add
1816 INCREMENTAL_INPUT_AS_NEEDED.
1817 (Incremental_input_entry::Incremental_input_entry): Initialize new
1819 (Incremental_input_entry::set_as_needed): New function.
1820 (Incremental_input_entry::as_needed): New function.
1821 (Incremental_input_entry::do_dynobj_entry): New function.
1822 (Incremental_input_entry::as_needed_): New data member.
1823 (Incremental_object_entry::Incremental_object_entry): Don't check
1825 (Incremental_object_entry::do_type): Likewise.
1826 (class Incremental_dynobj_entry): New class.
1827 (Incremental_input_entry_reader::as_needed): New function.
1828 (Incremental_input_entry_reader::get_soname): New function.
1829 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
1830 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
1831 size of shared library info entry.
1832 * layout.cc (Layout::finish_dynamic_section): Don't test for
1833 incremental link when adding DT_NEEDED entries.
1834 * object.h (Object::Object): Initialize new data member.
1835 (Object::dynobj): New function.
1836 (Object::set_as_needed): New function.
1837 (Object::as_needed): New function.
1838 (Object::do_dynobj): New function.
1839 (Object::as_needed_): New data member.
1841 2011-05-24 Cary Coutant <ccoutant@google.com>
1843 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
1844 info; adjust display of GOT entries.
1845 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1846 vector of input objects; remove file_status_.
1847 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
1848 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
1849 got_plt reader; call target hooks to reserve GOT entries.
1850 (Output_section_incremental_inputs::set_final_data_size): Adjust size
1851 of input file info header and GOT info entry.
1852 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
1854 (Got_plt_view_info::got_descriptor): Remove.
1855 (Got_plt_view_info::sym_index): New data member.
1856 (Got_plt_view_info::input_index): New data member.
1857 (Local_got_offset_visitor::visit): Write input file index.
1858 (Global_got_offset_visitor::visit): Write 0 for input file index.
1859 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
1860 with sym_index and input_index.
1861 (Output_section_incremental_inputs::write_got_plt): Adjust size of
1862 incremental info GOT entry; replace got_descriptor with input_index.
1863 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
1864 map from input file index to object.
1865 (Sized_relobj_incr::do_layout): Replace direct data member reference
1866 with accessor function.
1867 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
1868 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
1869 Adjust size of input file info header.
1870 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
1871 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
1872 (Incremental_input_entry_reader::get_input_section): Adjust size of
1873 input file info header.
1874 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
1875 of incremental info GOT entry.
1876 (Incremental_got_plt_reader::get_got_desc): Remove.
1877 (Incremental_got_plt_reader::get_got_symndx): New function.
1878 (Incremental_got_plt_reader::get_got_input_index): New function.
1879 (Sized_incremental_binary::Sized_incremental_binary): Remove
1880 file_status_; add input_objects_.
1881 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
1882 (Sized_incremental_binary::set_file_is_unchanged): Remove.
1883 (Sized_incremental_binary::file_is_unchanged): Remove.
1884 (Sized_incremental_binary::set_input_object): New function.
1885 (Sized_incremental_binary::input_object): New function.
1886 (Sized_incremental_binary::file_status_): Remove.
1887 (Sized_incremental_binary::input_objects_): New data member.
1888 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
1890 (Sized_relobj_incr::invalid_address): Move to base class.
1891 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
1893 (Sized_relobj_incr::do_output_section_offset): Likewise.
1894 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
1895 (Sized_relobj_incr::section_offsets_): Likewise.
1896 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
1898 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
1899 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
1900 with accessor function.
1901 (Sized_relobj_file::do_layout): Likewise.
1902 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
1903 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
1904 (Sized_relobj_file::compute_final_local_value): Replace refs to
1905 section_offsets_ with accessor function.
1906 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
1907 * object.h (Relobj::Relobj): Initialize new data members.
1908 (Relobj::add_dyn_reloc): New function.
1909 (Relobj::first_dyn_reloc): New function.
1910 (Relobj::dyn_reloc_count): New function.
1911 (Relobj::first_dyn_reloc_): New data member.
1912 (Relobj::dyn_reloc_count_): New data member.
1913 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
1915 (Sized_relobj::Address): New typedef.
1916 (Sized_relobj::invalid_address): Move here from child class.
1917 (Sized_relobj::Sized_relobj): Initialize new data members.
1918 (Sized_relobj::sized_relobj): New function.
1919 (Sized_relobj::is_output_section_offset_invalid): Move here from
1921 (Sized_relobj::get_output_section_offset): Likewise.
1922 (Sized_relobj::local_has_got_offset): Likewise.
1923 (Sized_relobj::local_got_offset): Likewise.
1924 (Sized_relobj::set_local_got_offset): Likewise.
1925 (Sized_relobj::do_for_all_local_got_entries): Likewise.
1926 (Sized_relobj::clear_got_offsets): New function.
1927 (Sized_relobj::section_offsets): Move here from child class.
1928 (Sized_relobj::do_output_section_offset): Likewise.
1929 (Sized_relobj::do_set_section_offset): Likewise.
1930 (Sized_relobj::Local_got_offsets): Likewise.
1931 (Sized_relobj::local_got_offsets_): Likewise.
1932 (Sized_relobj::section_offsets_): Likewise.
1933 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
1935 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
1937 (Sized_relobj_file::sized_relobj): New function
1938 (Sized_relobj_file::local_has_got_offset): Move to base class.
1939 (Sized_relobj_file::local_got_offset): Likewise.
1940 (Sized_relobj_file::set_local_got_offset): Likewise.
1941 (Sized_relobj_file::get_output_section_offset): Likewise.
1942 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
1943 (Sized_relobj_file::do_output_section_offset): Likewise.
1944 (Sized_relobj_file::do_set_section_offset): Likewise.
1945 (Sized_relobj_file::Local_got_offsets): Likewise.
1946 (Sized_relobj_file::local_got_offsets_): Likewise.
1947 (Sized_relobj_file::section_offsets_): Likewise.
1948 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
1950 (set_needs_dynsym_index): Convert relobj to derived class pointer.
1951 (Output_reloc::get_symbol_index): Likewise.
1952 (Output_reloc::local_section_offset): Likewise.
1953 (Output_reloc::get_address): Likewise.
1954 (Output_reloc::symbol_value): Likewise.
1955 (Output_data_got::reserve_slot): Move to class definition.
1956 (Output_data_got::reserve_local): New function.
1957 (Output_data_got::reserve_slot_for_global): Remove.
1958 (Output_data_got::reserve_global): New function.
1959 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
1960 (all constructors, two instantiations).
1961 (Output_reloc::get_relobj): New function (two instantiations).
1962 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
1963 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
1964 (Output_data_reloc::add_global): Adjust type of relobj.
1965 (Output_data_reloc::add_global_relative): Likewise.
1966 (Output_data_reloc::add_symbolless_global_addend): Likewise.
1967 (Output_data_reloc::add_local): Likewise.
1968 (Output_data_reloc::add_local_relative): Likewise.
1969 (Output_data_reloc::add_symbolless_local_addend): Likewise.
1970 (Output_data_reloc::add_local_section): Likewise.
1971 (Output_data_reloc::add_output_section): Likewise.
1972 (Output_data_reloc::add_absolute): Likewise.
1973 (Output_data_reloc::add_target_specific): Likewise.
1974 (Output_data_got::reserve_slot): Move definition here.
1975 (Output_data_got::reserve_local): New function.
1976 (Output_data_got::reserve_global): New function.
1977 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
1978 section_offsets_ with accessor function.
1979 (Sized_relobj_file::write_sections): Likewise.
1980 (Sized_relobj_file::do_relocate_sections): Likewise.
1981 * target.h (Sized_target::reserve_local_got_entry): New function.
1982 (Sized_target::reserve_global_got_entry): New function.
1983 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
1984 (Target_x86_64::reserve_global_got_entry): New function.
1985 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
1987 2011-05-23 Cary Coutant <ccoutant@google.com>
1989 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
1990 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
1991 bit when checking got_type.
1992 * incremental.cc (Sized_incremental_binary::setup_readers):
1993 Store symbol table and string table locations; initialize bit vector
1994 of file status flags.
1995 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
1997 (Sized_incremental_binary::do_process_got_plt): New function.
1998 (Sized_incremental_binary::get_symtab_view): Use stored locations.
1999 (Output_section_incremental_inputs::set_final_data_size): Record
2000 file index for each input file.
2001 (Output_section_incremental_inputs::write_got_plt): Store file index
2002 instead of input entry offset for each GOT entry.
2004 (Incremental_input_entry::Incremental_input_entry): Initialize new
2006 (Incremental_input_entry::set_offset): Store file index.
2007 (Incremental_input_entry::get_file_index): New function.
2008 (Incremental_input_entry::file_index_): New data member.
2009 (Incremental_binary::process_got_plt): New function.
2010 (Incremental_binary::do_process_got_plt): New function.
2011 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2013 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
2014 (Sized_incremental_binary::set_file_is_unchanged): New function.
2015 (Sized_incremental_binary::file_is_unchanged): New function.
2016 (Sized_incremental_binary::do_process_got_plt): New function.
2017 (Sized_incremental_binary::file_status_): New data member.
2018 (Sized_incremental_binary::main_symtab_loc_): New data member.
2019 (Sized_incremental_binary::main_strtab_loc_): New data member.
2020 * output.cc (Output_data_got::Got_entry::write): Add case
2022 (Output_data_got::add_global): Call add_got_entry.
2023 (Output_data_got::add_global_plt): Likewise.
2024 (Output_data_got::add_global_with_rel): Likewise.
2025 (Output_data_got::add_global_with_rela): Likewise.
2026 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
2027 (Output_data_got::add_global_pair_with_rela): Likewise.
2028 (Output_data_got::add_local): Call add_got_entry.
2029 (Output_data_got::add_local_plt): Likewise.
2030 (Output_data_got::add_local_with_rel): Likewise.
2031 (Output_data_got::add_local_with_rela): Likewise.
2032 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
2033 (Output_data_got::add_local_pair_with_rela): Likewise.
2034 (Output_data_got::reserve_slot): New function.
2035 (Output_data_got::reserve_slot_for_global): New function.
2036 (Output_data_got::add_got_entry): New function.
2037 (Output_data_got::add_got_entry_pair): New function.
2038 (Output_section::add_output_section_data): Edit FIXME.
2040 (Output_section_data_build::Output_section_data_build): New
2041 constructor with size parameter.
2042 (Output_data_space::Output_data_space): Likewise.
2043 (Output_data_got::Output_data_got): Initialize new data member; new
2044 constructor with size parameter.
2045 (Output_data_got::add_constant): Call add_got_entry.
2046 (Output_data_got::reserve_slot): New function.
2047 (Output_data_got::reserve_slot_for_global): New function.
2048 (class Output_data_got::Got_entry): Add RESERVED_CODE.
2049 (Output_data_got::add_got_entry): New function.
2050 (Output_data_got::add_got_entry_pair): New function.
2051 (Output_data_got::free_list_): New data member.
2052 * target.h (Sized_target::init_got_plt_for_update): New function.
2053 (Sized_target::register_global_plt_entry): New function.
2054 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2055 Initialize new data member; call init; add constructor with PLT count.
2056 (Output_data_plt_x86_64::init): New function.
2057 (Output_data_plt_x86_64::add_relocation): New function.
2058 (Output_data_plt_x86_64::reserve_slot): New function.
2059 (Output_data_plt_x86_64::free_list_): New data member.
2060 (Target_x86_64::init_got_plt_for_update): New function.
2061 (Target_x86_64::register_global_plt_entry): New function.
2062 (Output_data_plt_x86_64::add_entry): Allocate from free list for
2063 incremental updates.
2064 (Output_data_plt_x86_64::add_relocation): New function.
2065 * testsuite/object_unittest.cc (Object_test): Set default options.
2067 2011-05-16 Ian Lance Taylor <iant@google.com>
2069 * options.h (class General_options): Make -i a synonym for -r.
2071 2011-05-16 Ian Lance Taylor <iant@google.com>
2073 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
2075 2011-05-10 Cary Coutant <ccoutant@google.com>
2077 * object.cc (Sized_relobj::do_count_local_symbols): Check for
2080 2011-05-06 Ian Lance Taylor <iant@google.com>
2082 * layout.cc (Layout::layout): If the output section flags change,
2083 update the ordering.
2085 2011-04-25 Cary Coutant <ccoutant@google.com>
2087 * incremental-dump.cc (dump_incremental_inputs): Print local
2088 symbol info for each input file.
2090 (Output_section_incremental_inputs::set_final_data_size): Add local
2091 symbol info to input file entries in incremental info.
2092 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2093 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
2094 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
2095 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
2097 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
2098 (Sized_incr_relobj::do_relocate): Write the local symbols.
2099 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
2100 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
2101 Adjust size of input file header.
2102 (Incremental_inputs_reader::get_local_symbol_offset): New function.
2103 (Incremental_inputs_reader::get_local_symbol_count): New function.
2104 (Incremental_inputs_reader::get_input_section): Adjust size of input
2106 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
2107 (Sized_incr_relobj::This): New typedef.
2108 (Sized_incr_relobj::sym_size): New const data member.
2109 (Sized_incr_relobj::Local_symbol): New struct.
2110 (Sized_incr_relobj::do_output_local_symbol_count): New function.
2111 (Sized_incr_relobj::do_local_symbol_offset): New function.
2112 (Sized_incr_relobj::local_symbol_count_): New data member.
2113 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
2114 (Sized_incr_relobj::local_symbol_index_): New data member.
2115 (Sized_incr_relobj::local_symbol_offset_): New data member.
2116 (Sized_incr_relobj::local_dynsym_offset_): New data member.
2117 (Sized_incr_relobj::local_symbols_): New data member.
2118 * object.h (Relobj::output_local_symbol_count): New function.
2119 (Relobj::local_symbol_offset): New function.
2120 (Relobj::do_output_local_symbol_count): New function.
2121 (Relobj::do_local_symbol_offset): New function.
2122 (Sized_relobj::do_output_local_symbol_count): New function.
2123 (Sized_relobj::do_local_symbol_offset): New function.
2125 2011-04-22 Vladimir Simonov <sv@sw.ru>
2127 * descriptors.cc (set_close_on_exec): New function.
2128 (Descriptors::open): Use set_close_on_exec.
2129 * output.cc (S_ISLNK): Define if not defined.
2131 2011-04-22 Cary Coutant <ccoutant@google.com>
2133 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2135 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2136 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
2137 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
2139 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
2140 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
2141 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
2143 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
2145 (Incremental_binary::apply_incremental_relocs): New function.
2146 (Incremental_binary::do_apply_incremental_relocs): New function.
2147 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2149 (Sized_incremental_binary::add_global_symbol): New function.
2150 (Sized_incremental_binary::global_symbol): New function.
2151 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2152 (Sized_incremental_binary::symbol_map_): New data member.
2153 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
2154 * target.h (Sized_target::apply_relocation): New function.
2155 * target-reloc.h (apply_relocation): New function.
2156 * x86_64.cc (Target_x86_64::apply_relocation): New function.
2158 2011-04-22 Doug Kwan <dougkwan@google.com>
2160 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
2161 flag of a SHT_ARM_EXIDX section.
2162 * testsuite/Makefile.am (arm_exidx_test): New test rules.
2163 * testsuite/Makefile.in: Regenerate.
2164 * testsuite/arm_exidx_test.s: New file.
2165 * testsuite/arm_exidx_test.sh: Same.
2167 2011-04-20 Cary Coutant <ccoutant@google.com>
2170 * archive.h (Incremental_archive_entry::Archive_member):
2171 Initialize arg_serial_ (second constructor).
2173 2011-04-17 Ian Lance Taylor <iant@google.com>
2175 * object.cc (Relocate_info::location): Simplify location string.
2176 * errors.cc (Errors::error_at_location): Don't print program
2178 (Errors::warning_at_location): Likewise.
2179 (Errors::undefined_symbol): Likewise.
2180 * testsuite/debug_msg.sh: Update accordingly.
2182 2011-04-14 Cary Coutant <ccoutant@google.com>
2184 * gold/layout.cc (Layout::symtab_section_offset): New function.
2185 * gold/layout.h (Layout::symtab_section_offset): New function.
2186 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
2188 2011-04-12 Ian Lance Taylor <iant@google.com>
2190 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
2191 with MREMAP_MAYMOVE.
2192 * output.h (class Output_file): Add map_is_allocated_ field.
2193 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
2194 not available, provide stubs. If mremap is not available, #define
2196 (MREMAP_MAYMOVE): Define if not defined.
2197 (Output_file::Output_file): Initialize map_is_allocated_.
2198 (Output_file::resize): Check map_is_allocated_.
2199 (Output_file::map_anonymous): If mmap fails, use malloc.
2200 (Output_file::unmap): Don't do anything for an anonymous map.
2201 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
2202 is not available, provide stubs.
2203 (File_read::View::~View): Use free rather than delete[].
2204 (File_read::make_view): Use malloc rather than new[]. If mmap
2206 (File_read::find_or_make_view): Use malloc rather than new[].
2207 * gold.h: Remove HAVE_REMAP code.
2208 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
2209 exists. Rename mremap to gold_mremap. If mmap is not available
2211 * configure, config.in: Rebuild.
2213 2011-04-11 Ian Lance Taylor <iant@google.com>
2215 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
2216 initialize local variable v.
2218 2011-04-11 Cary Coutant <ccoutant@google.com>
2220 * archive.cc (Archive::include_member): Adjust call to
2222 (Add_archive_symbols::run): Track argument serial numbers.
2223 (Lib_group::include_member): Likewise.
2224 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
2225 * archive.h (Incremental_archive_entry::Archive_member):
2226 Initialize arg_serial_.
2227 (Archive_member::arg_serial_): New data member.
2228 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
2229 (Sized_dynobj::do_add_symbols): Track symbols when doing an
2231 (Sized_dynobj::do_for_all_local_got_entries): New function.
2232 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
2234 * fileread.cc (get_mtime): New function.
2235 * fileread.h (get_mtime): New function.
2236 * gold.cc (queue_initial_tasks): Check for incremental update.
2237 (process_incremental_input): New function.
2238 (queue_middle_tasks): Don't force valid target for incremental
2240 * incremental-dump.cc (find_input_containing_global): Adjust
2241 size of symbol info entry.
2242 (dump_incremental_inputs): Dump argument serial number and
2243 in_system_directory flag; bias shndx by 1; print symbol names
2244 when dumping per-file symbol lists; use new symbol info readers.
2246 (Output_section_incremental_inputs:update_data_size): New function.
2247 (Sized_incremental_binary::setup_readers): Setup input readers
2248 for each input file; build maps for files added from libraries
2250 (Sized_incremental_binary::check_input_args): New function.
2251 (Sized_incremental_binary::do_check_inputs): Build map of argument
2252 serial numbers to input arguments.
2253 (Sized_incremental_binary::do_file_has_changed): Rename
2254 do_file_is_unchanged to this; compare file modification times.
2255 (Sized_incremental_binary::do_init_layout): New function.
2256 (Sized_incremental_binary::do_reserve_layout): New function.
2257 (Sized_incremental_binary::do_get_input_reader): Remove.
2258 (Sized_incremental_binary::get_symtab_view): New function.
2259 (Incremental_checker::can_incrementally_link_output_file): Remove.
2260 (Incremental_inputs::report_command_line): Exclude --debug options.
2261 (Incremental_inputs::report_archive_begin): Add parameter; track
2262 argument serial numbers; don't put input file entry for archive
2263 before archive members.
2264 (Incremental_inputs::report_archive_end): Put input file entry
2265 for archive after archive members.
2266 (Incremental_inputs::report_object): Add parameter; track argument
2267 serial numbers and in_system_directory flag.
2268 (Incremental_inputs::report_script): Add parameter; track argument
2270 (Output_section_incremental_inputs::set_final_data_size): Adjust
2271 size of symbol info entry; check for forwarding symbols.
2272 (Output_section_incremental_inputs::write_input_files): Write
2273 in_system_directory flag and argument serial number.
2274 (Output_section_incremental_inputs::write_info_blocks): Map section
2275 indices between incremental info and original input file; store
2276 input section index for each symbol.
2277 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2278 change operator() to visit().
2279 (class Global_got_offset_visitor): Likewise.
2280 (class Global_symbol_visitor_got_plt):
2281 (Output_section_incremental_inputs::write_got_plt): Use new visitor
2283 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
2284 (Sized_incr_relobj::do_read_symbols): New function.
2285 (Sized_incr_relobj::do_layout): New function.
2286 (Sized_incr_relobj::do_layout_deferred_sections): New function.
2287 (Sized_incr_relobj::do_add_symbols): New function.
2288 (Sized_incr_relobj::do_should_include_member): New function.
2289 (Sized_incr_relobj::do_for_all_global_symbols): New function.
2290 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
2291 (Sized_incr_relobj::do_section_size): New function.
2292 (Sized_incr_relobj::do_section_name): New function.
2293 (Sized_incr_relobj::do_section_contents): New function.
2294 (Sized_incr_relobj::do_section_flags): New function.
2295 (Sized_incr_relobj::do_section_entsize): New function.
2296 (Sized_incr_relobj::do_section_address): New function.
2297 (Sized_incr_relobj::do_section_type): New function.
2298 (Sized_incr_relobj::do_section_link): New function.
2299 (Sized_incr_relobj::do_section_info): New function.
2300 (Sized_incr_relobj::do_section_addralign): New function.
2301 (Sized_incr_relobj::do_initialize_xindex): New function.
2302 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2303 (Sized_incr_relobj::do_read_relocs): New function.
2304 (Sized_incr_relobj::do_gc_process_relocs): New function.
2305 (Sized_incr_relobj::do_scan_relocs): New function.
2306 (Sized_incr_relobj::do_count_local_symbols): New function.
2307 (Sized_incr_relobj::do_finalize_local_symbols): New function.
2308 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2309 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2310 (Sized_incr_relobj::do_relocate): New function.
2311 (Sized_incr_relobj::do_set_section_offset): New function.
2312 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2313 (Sized_incr_dynobj::do_read_symbols): New function.
2314 (Sized_incr_dynobj::do_layout): New function.
2315 (Sized_incr_dynobj::do_add_symbols): New function.
2316 (Sized_incr_dynobj::do_should_include_member): New function.
2317 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
2318 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
2319 (Sized_incr_dynobj::do_section_size): New function.
2320 (Sized_incr_dynobj::do_section_name): New function.
2321 (Sized_incr_dynobj::do_section_contents): New function.
2322 (Sized_incr_dynobj::do_section_flags): New function.
2323 (Sized_incr_dynobj::do_section_entsize): New function.
2324 (Sized_incr_dynobj::do_section_address): New function.
2325 (Sized_incr_dynobj::do_section_type): New function.
2326 (Sized_incr_dynobj::do_section_link): New function.
2327 (Sized_incr_dynobj::do_section_info): New function.
2328 (Sized_incr_dynobj::do_section_addralign): New function.
2329 (Sized_incr_dynobj::do_initialize_xindex): New function.
2330 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
2331 (make_sized_incremental_object): New function.
2332 (Incremental_library::copy_unused_symbols): New function.
2333 (Incremental_library::do_for_all_unused_symbols): New function.
2334 * incremental.h (enum Incremental_input_flags): New type.
2335 (class Incremental_checker): Remove.
2336 (Incremental_input_entry::Incremental_input_entry): Add argument
2338 (Incremental_input_entry::arg_serial): New function.
2339 (Incremental_input_entry::set_is_in_system_directory): New function.
2340 (Incremental_input_entry::is_in_system_directory): New function.
2341 (Incremental_input_entry::arg_serial_): New data member.
2342 (Incremental_input_entry::is_in_system_directory_): New data member.
2343 (class Script_info): Move here from script.h.
2344 (Script_info::Script_info): Add filename parameter.
2345 (Script_info::filename): New function.
2346 (Script_info::filename_): New data member.
2347 (Incremental_script_entry::Incremental_script_entry): Add argument
2349 (Incremental_object_entry::Incremental_object_entry): Likewise.
2350 (Incremental_object_entry::add_input_section): Build list of input
2351 sections with map to original shndx.
2352 (Incremental_object_entry::get_input_section_index): New function.
2353 (Incremental_object_entry::shndx_): New data member.
2354 (Incremental_object_entry::name_key_): Rename; adjust all refs.
2355 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
2356 (Incremental_archive_entry::Incremental_archive_entry): Add argument
2358 (Incremental_inputs::report_archive_begin): Likewise.
2359 (Incremental_inputs::report_object): Likewise.
2360 (Incremental_inputs::report_script): Likewise.
2361 (class Incremental_global_symbol_reader): New class.
2362 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
2363 and store flags and input file type.
2364 (Incremental_input_entry_reader::arg_serial): New function.
2365 (Incremental_input_entry_reader::type): Extract type from flags.
2366 (Incremental_input_entry_reader::is_in_system_directory): New function.
2367 (Incremental_input_entry_reader::get_input_section_count): Call
2368 accessor function for type.
2369 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
2370 function for type; adjust size of global symbol entry.
2371 (Incremental_input_entry_reader::get_global_symbol_count): Call
2372 accessor function for type.
2373 (Incremental_input_entry_reader::get_object_count): Likewise.
2374 (Incremental_input_entry_reader::get_object_offset): Likewise.
2375 (Incremental_input_entry_reader::get_member_count): Likewise.
2376 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
2377 (Incremental_input_entry_reader::get_member_offset): Likewise.
2378 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
2379 (Incremental_input_entry_reader::Global_symbol_info): Remove.
2380 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
2381 (Incremental_input_entry_reader::get_global_symbol_reader): New
2383 (Incremental_input_entry_reader::get_output_symbol_index): New
2385 (Incremental_input_entry_reader::type_): Remove.
2386 (Incremental_input_entry_reader::flags_): New data member.
2387 (Incremental_inputs_reader::input_file_offset): New function.
2388 (Incremental_inputs_reader::input_file_index): New function.
2389 (Incremental_inputs_reader::input_file): Call input_file_offset.
2390 (Incremental_inputs_reader::input_file_at_offset): New function.
2391 (Incremental_relocs_reader::get_r_type): Reformat.
2392 (Incremental_relocs_reader::get_r_shndx): Reformat.
2393 (Incremental_relocs_reader::get_r_offset): Reformat.
2394 (Incremental_relocs_reader::data): New function.
2395 (Incremental_binary::Incremental_binary): Initialize new data members.
2396 (Incremental_binary::check_inputs): Add cmdline parameter.
2397 (Incremental_binary::file_is_unchanged): Remove.
2398 (Input_reader::arg_serial): New function.
2399 (Input_reader::get_unused_symbol_count): New function.
2400 (Input_reader::get_unused_symbol): New function.
2401 (Input_reader::do_arg_serial): New function.
2402 (Input_reader::do_get_unused_symbol_count): New function.
2403 (Input_reader::do_get_unused_symbol): New function.
2404 (Incremental_binary::input_file_count): New function.
2405 (Incremental_binary::get_input_reader): Change signature to use
2406 index instead of filename.
2407 (Incremental_binary::file_has_changed): New function.
2408 (Incremental_binary::get_input_argument): New function.
2409 (Incremental_binary::get_library): New function.
2410 (Incremental_binary::get_script_info): New function.
2411 (Incremental_binary::init_layout): New function.
2412 (Incremental_binary::reserve_layout): New function.
2413 (Incremental_binary::output_file): New function.
2414 (Incremental_binary::do_check_inputs): New function.
2415 (Incremental_binary::do_file_is_unchanged): Remove.
2416 (Incremental_binary::do_file_has_changed): New function.
2417 (Incremental_binary::do_init_layout): New function.
2418 (Incremental_binary::do_reserve_layout): New function.
2419 (Incremental_binary::do_input_file_count): New function.
2420 (Incremental_binary::do_get_input_reader): Change signature.
2421 (Incremental_binary::input_args_map_): New data member.
2422 (Incremental_binary::library_map_): New data member.
2423 (Incremental_binary::script_map_): New data member.
2424 (Sized_incremental_binary::Sized_incremental_binary): Initialize
2426 (Sized_incremental_binary::output_section): New function.
2427 (Sized_incremental_binary::inputs_reader): Add const.
2428 (Sized_incremental_binary::symtab_reader): Add const.
2429 (Sized_incremental_binary::relocs_reader): Add const.
2430 (Sized_incremental_binary::got_plt_reader): Add const.
2431 (Sized_incremental_binary::get_symtab_view): New function.
2432 (Sized_incremental_binary::Inputs_reader): New typedef.
2433 (Sized_incremental_binary::Input_entry_reader): New typedef.
2434 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
2435 (Sized_incremental_binary::do_file_is_unchanged): Remove.
2436 (Sized_incremental_binary::do_file_has_changed): New function.
2437 (Sized_incremental_binary::do_init_layout): New function.
2438 (Sized_incremental_binary::do_reserve_layout): New function.
2439 (Sized_input_reader::Inputs_reader): Remove.
2440 (Sized_input_reader::Input_entry_reader): Remove.
2441 (Sized_input_reader::do_arg_serial): New function.
2442 (Sized_input_reader::do_get_unused_symbol_count): New function.
2443 (Sized_input_reader::do_get_unused_symbol): New function.
2444 (Sized_incremental_binary::do_input_file_count): New function.
2445 (Sized_incremental_binary::do_get_input_reader): Change signature;
2446 use index instead of filename.
2447 (Sized_incremental_binary::section_map_): New data member.
2448 (Sized_incremental_binary::input_entry_readers_): New data member.
2449 (class Sized_incr_relobj): New class.
2450 (class Sized_incr_dynobj): New class.
2451 (make_sized_incremental_object): New function.
2452 (class Incremental_library): New class.
2453 * layout.cc (Free_list::num_lists): New static data member.
2454 (Free_list::num_nodes): New static data member.
2455 (Free_list::num_removes): New static data member.
2456 (Free_list::num_remove_visits): New static data member.
2457 (Free_list::num_allocates): New static data member.
2458 (Free_list::num_allocate_visits): New static data member.
2459 (Free_list::init): New function.
2460 (Free_list::remove): New function.
2461 (Free_list::allocate): New function.
2462 (Free_list::dump): New function.
2463 (Free_list::print_stats): New function.
2464 (Layout_task_runner::run): Resize output file for incremental updates.
2465 (Layout::Layout): Initialize new data members.
2466 (Layout::set_incremental_base): New function.
2467 (Layout::init_fixed_output_section): New function.
2468 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
2469 incremental updates.
2470 (Layout::create_gold_note): Do not create gold note section for
2471 incremental updates.
2472 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
2473 for incremental updates.
2474 (Layout::set_section_offsets): For incremental updates, allocate space
2476 (Layout::create_symtab_sections): Layout with offsets relative to
2477 start of section; for incremental updates, allocate space from free
2479 (Layout::create_shdrs): For incremental updates, allocate space from
2481 (Layout::finish_dynamic_section): For incremental updates, do not
2482 check --as-needed (fixed in subsequent patch).
2483 * layout.h (class Free_list): New class.
2484 (Layout::set_incremental_base): New function.
2485 (Layout::incremental_base): New function.
2486 (Layout::init_fixed_output_section): New function.
2487 (Layout::allocate): New function.
2488 (Layout::incremental_base_): New data member.
2489 (Layout::free_list_): New data member.
2490 * main.cc (main): Print Free_list statistics.
2491 * object.cc (Relobj::finalize_incremental_relocs): Add
2492 clear_counts parameter; clear counts only when clear_counts is set.
2493 (Sized_relobj::Sized_relobj): Initialize new base class.
2494 (Sized_relobj::do_layout): Don't report special sections.
2495 (Sized_relobj::do_for_all_local_got_entries): New function.
2496 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
2497 symtab_off to all symbol table offsets.
2498 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
2499 * object.h (class Got_offset_list): Move to top of file.
2500 (Object::Object): Allow case where input_file == NULL.
2501 (Object::~Object): Likewise.
2502 (Object::input_file): Assert that input_file != NULL.
2503 (Object::lock): Allow case where input_file == NULL.
2504 (Object::unlock): Likewise.
2505 (Object::is_locked): Likewise.
2506 (Object::token): Likewise.
2507 (Object::release): Likewise.
2508 (Object::is_incremental): New function.
2509 (Object::get_mtime): New function.
2510 (Object::for_all_local_got_entries): New function.
2511 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
2512 (Object::set_is_in_system_directory): New function.
2513 (Object::is_in_system_directory): New function.
2514 (Object::do_is_incremental): New function.
2515 (Object::do_get_mtime): New function.
2516 (Object::do_for_all_local_got_entries): New function.
2517 (Object::is_in_system_directory_): New data member.
2518 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
2519 (class Sized_relobj_base): New class.
2520 (class Sized_relobj): Derive from Sized_relobj_base.
2521 (class Sized_relobj::Symbols): Redeclare from base class.
2522 (class Sized_relobj::local_got_offset_list): Remove.
2523 (class Sized_relobj::Output_sections): Redeclare from base class.
2524 (class Sized_relobj::do_for_all_local_got_entries): New function.
2525 (class Sized_relobj::write_local_symbols): Add offset parameter.
2526 (class Sized_relobj::local_symbol_offset_): Update comment.
2527 (class Sized_relobj::local_dynsym_offset_): Update comment.
2528 * options.cc (Input_arguments::add_file): Remove const.
2529 * options.h (Input_file_argument::Input_file_argument):
2530 Initialize arg_serial_ (all constructors).
2531 (Input_file_argument::set_arg_serial): New function.
2532 (Input_file_argument::arg_serial): New function.
2533 (Input_file_argument::arg_serial_): New data member.
2534 (Input_arguments::Input_arguments): Initialize file_count_.
2535 (Input_arguments::add_file): Remove const.
2536 (Input_arguments::number_of_input_files): New function.
2537 (Input_arguments::file_count_): New data member.
2538 (Command_line::number_of_input_files): Call
2539 Input_arguments::number_of_input_files.
2540 * output.cc (Output_segment_headers::Output_segment_headers):
2542 (Output_section::Input_section::current_data_size): New function.
2543 (Output_section::Output_section): Initialize new data members.
2544 (Output_section::add_input_section): Don't do merge sections for
2545 an incremental link; allocate space from free list for an
2547 (Output_section::add_output_section_data): Allocate space from
2548 free list for an incremental update.
2549 (Output_section::update_data_size): New function.
2550 (Output_section::set_fixed_layout): New function.
2551 (Output_section::reserve): New function.
2552 (Output_segment::set_section_addresses): Remove const.
2553 (Output_segment::set_section_list_addresses): Remove const; allocate
2554 space from free list for an incremental update.
2555 (Output_segment::set_offset): Adjust size of RELRO segment for an
2557 * output.h (Output_data::current_data_size): Move here from
2559 (Output_data::pre_finalize_data_size): New function.
2560 (Output_data::update_data_size): New function.
2561 (Output_section_headers::update_data_size): new function.
2562 (Output_section_data_build::current_data_size): Move to Output_data.
2563 (Output_data_strtab::update_data_size): New function.
2564 (Output_section::current_data_size): Move to Output_data.
2565 (Output_section::set_fixed_layout): New function.
2566 (Output_section::has_fixed_layout): New function.
2567 (Output_section::reserve): New function.
2568 (Output_section::update_data_size): New function.
2569 (Output_section::has_fixed_layout_): New data member.
2570 (Output_section::free_list_): New data member.
2571 (Output_segment::set_section_addresses): Remove const.
2572 (Output_segment::set_section_list_addresses): Remove const.
2573 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
2575 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
2577 * readsyms.cc (Read_symbols::do_read_symbols): Add library
2578 parameter when calling Add_symbols constructor; store argument
2579 serial number for members of a lib group.
2580 (Add_symbols::locks): Allow case where token == NULL.
2581 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
2582 (Read_member::~Read_member): New function.
2583 (Read_member::is_runnable): New function.
2584 (Read_member::locks): New function.
2585 (Read_member::run): New function.
2586 (Check_script::~Check_script): New function.
2587 (Check_script::is_runnable): New function.
2588 (Check_script::locks): New function.
2589 (Check_script::run): New function.
2590 (Check_library::~Check_library): New function.
2591 (Check_library::is_runnable): New function.
2592 (Check_library::locks): New function.
2593 (Check_library::run): New function.
2594 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
2595 (Add_symbols::library_): New data member.
2596 (class Read_member): New class.
2597 (class Check_script): New class.
2598 (class Check_library): New class.
2599 * reloc.cc (Read_relocs::is_runnable): Allow case where
2601 (Read_relocs::locks): Likewise.
2602 (Scan_relocs::locks): Likewise.
2603 (Relocate_task::locks): Likewise.
2604 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
2606 (Sized_relobj::incremental_relocs_scan): Fix comment.
2607 (Sized_relobj::do_relocate): Pass output file offset to
2608 write_local_symbols.
2609 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
2610 from class declaration.
2611 * script.cc (read_input_script): Allocate Script_info; pass
2612 argument serial number to report_script.
2613 * script.h (class Script_info): Move to incremental.h.
2614 * symtab.cc (Symbol_table::add_from_incrobj): New function.
2615 * symtab.h (Symbol_table::add_from_incrobj): New function.
2616 (Symbol_table::set_file_offset): New function.
2618 2011-04-05 Cary Coutant <ccoutant@google.com>
2620 * incremental-dump.cc (dump_incremental_inputs): Change signature
2621 to take a Sized_incremental_binary; change caller. Use readers
2622 in Sized_incremental_binary.
2624 (Sized_incremental_binary::find_incremental_inputs_sections):
2625 Rename do_find_incremental_inputs_sections to this.
2626 (Sized_incremental_binary::setup_readers): New function.
2627 (Sized_incremental_binary::do_check_inputs): Check
2628 has_incremental_info_ flag; move setup code to setup_readers;
2630 (Sized_incremental_binary::do_file_is_unchanged): New function.
2631 (Sized_incremental_binary::do_get_input_reader): New function.
2632 * incremental.h (class Incremental_binary): Move to end of file.
2633 (Incremental_binary::file_is_unchanged): New function.
2634 (Incremental_binary::do_file_is_unchanged): New function.
2635 (Incremental_binary::Input_reader): New class.
2636 (Incremental_binary::get_input_reader): New function.
2637 (class Sized_incremental_binary): Move to end of file.
2638 (Sized_incremental_binary::Sized_incremental_binary): Setup the
2639 input section reader classes.
2640 (Sized_incremental_binary::has_incremental_info): New function.
2641 (Sized_incremental_binary::inputs_reader): New function.
2642 (Sized_incremental_binary::symtab_reader): New function.
2643 (Sized_incremental_binary::relocs_reader): New function.
2644 (Sized_incremental_binary::got_plt_reader): New function.
2645 (Sized_incremental_binary::do_file_is_unchanged): New function.
2646 (Sized_incremental_binary::Sized_input_reader): New class.
2647 (Sized_incremental_binary::get_input_reader): New function.
2648 (Sized_incremental_binary::find_incremental_inputs_sections):
2649 Rename do_find_incremental_inputs_sections to this.
2650 (Sized_incremental_binary::setup_readers): New function.
2651 (Sized_incremental_binary::has_incremental_info_): New data member.
2652 (Sized_incremental_binary::inputs_reader_): New data member.
2653 (Sized_incremental_binary::symtab_reader_): New data member.
2654 (Sized_incremental_binary::relocs_reader_): New data member.
2655 (Sized_incremental_binary::got_plt_reader_): New data member.
2656 (Sized_incremental_binary::current_input_file_): New data member.
2658 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
2661 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
2664 2011-03-30 Cary Coutant <ccoutant@google.com>
2666 * archive.cc (Archive::include_member): Adjust call to report_object.
2667 (Add_archive_symbols::run): Add script_info to call to
2668 report_archive_begin.
2669 (Lib_group::include_member): Adjust call to report_object.
2670 (Add_lib_group_symbols::run): Adjust call to report_object.
2671 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
2672 blocks. Add object count for script input files.
2673 * incremental.cc (Incremental_inputs::report_archive_begin): Add
2674 script_info parameter; change all callers.
2675 (Incremental_inputs::report_object): Add script_info parameter;
2677 (Incremental_inputs::report_script): Store backpointer to
2678 incremental info entry.
2679 (Output_section_incremental_inputs::set_final_data_size): Record
2680 additional information for scripts.
2681 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2682 * incremental.h (Incremental_script_entry::add_object): New function.
2683 (Incremental_script_entry::get_object_count): New function.
2684 (Incremental_script_entry::get_object): New function.
2685 (Incremental_script_entry::objects_): New data member; adjust
2687 (Incremental_inputs::report_archive_begin): Add script_info parameter.
2688 (Incremental_inputs::report_object): Add script_info parameter.
2689 (Incremental_inputs_reader::get_object_count): New function.
2690 (Incremental_inputs_reader::get_object_offset): New function.
2691 * options.cc (Input_arguments::add_file): Return reference to
2693 * options.h (Input_argument::set_script_info): New function.
2694 (Input_argument::script_info): New function.
2695 (Input_argument::script_info_): New data member; adjust all
2697 (Input_file_group::add_file): Return reference to new input argument.
2698 (Input_file_lib::add_file): Likewise.
2699 (Input_arguments::add_file): Likewise.
2700 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
2701 * script.cc (Parser_closure::Parser_closure): Add script_info
2702 parameter; adjust all callers.
2703 (Parser_closure::script_info): New function.
2704 (Parser_closure::script_info_): New data member.
2705 (read_input_script): Report scripts earlier to incremental info.
2706 (script_add_file): Set script_info in Input_argument.
2707 (script_add_library): Likewise.
2708 * script.h (Script_options::Script_info): Rewrite class.
2710 2011-03-29 Cary Coutant <ccoutant@google.com>
2712 * archive.cc (Library_base::should_include_member): Move
2713 method here from class Archive.
2714 (Archive::Archive): Initialize base class.
2715 (Archive::should_include_member): Move to base class.
2716 (Archive::do_for_all_unused_symbols): New function.
2717 (Add_archive_symbols::run): Remove redundant access to
2719 (Lib_group::Lib_group): Initialize base class.
2720 (Lib_group::do_filename): New function.
2721 (Lib_group::include_member): Pass pointer to Lib_group to
2723 (Lib_group::do_for_all_unused_symbols): New function.
2724 (Add_lib_group_symbols::run): Report archive information for
2726 * archive.h (class Library_base): New base class.
2727 (class Archive): Derive from Library_base.
2728 (Archive::filename): Move to base class.
2729 (Archive::set_incremental_info): Likewise.
2730 (Archive::incremental_info): Likewise.
2731 (Archive::Should_include): Likewise.
2732 (Archive::should_include_member): Likewise.
2733 (Archive::Armap_entry): Remove.
2734 (Archive::Unused_symbol_iterator): Remove.
2735 (Archive::unused_symbols_begin): Remove.
2736 (Archive::unused_symbols_end): Remove.
2737 (Archive::do_filename): New function.
2738 (Archive::do_get_mtime): New function.
2739 (Archive::do_for_all_unused_symbols): New function.
2740 (Archive::task_): Move to base class.
2741 (Archive::incremental_info_): Likewise.
2742 (class Lib_group): Derive from Library_base.
2743 (Lib_group::do_filename): New function.
2744 (Lib_group::do_get_mtime): New function.
2745 (Lib_group::do_for_all_unused_symbols): New function.
2746 (Lib_group::task_): Move to base class.
2747 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
2749 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
2751 * incremental.cc (Incremental_inputs::report_archive_begin):
2752 Use Library_base; call library's get_mtime; add incremental inputs
2753 entry before members.
2754 (class Unused_symbol_visitor): New class.
2755 (Incremental_inputs::report_archive_end): Use Library_base; use
2756 visitor class to record unused symbols; don't add incremental inputs
2757 entry after members.
2758 (Incremental_inputs::report_object): Use Library_base.
2760 (Incremental_archive_entry::Incremental_archive_entry): Remove
2761 unused Archive parameter.
2762 (Incremental_inputs::report_archive_begin): Use Library_base.
2763 (Incremental_inputs::report_archive_end): Likewise.
2764 (Incremental_inputs::report_object): Likewise.
2765 * object.cc (Sized_relobj::do_for_all_global_symbols): New
2767 * object.h (Object::for_all_global_symbols): New function.
2768 (Object::do_for_all_global_symbols): New function.
2769 (Sized_relobj::do_for_all_global_symbols): New function.
2770 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
2772 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
2775 2011-03-27 Ian Lance Taylor <iant@google.com>
2777 * archive.cc (Archive::interpret_header): Return -1 if something
2778 goes wrong. Change callers accordingly.
2780 2011-03-25 Cary Coutant <ccoutant@google.com>
2782 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
2783 * testsuite/Makefile.in: Regenerate.
2785 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
2787 * plugin.cc (get_view): New.
2788 (Plugin::load): Pass get_view to the plugin.
2789 (Plugin_manager::get_view): New.
2791 2011-03-21 Ian Lance Taylor <iant@google.com>
2793 * testsuite/final_layout.sh: Rewrite to not use dc.
2794 * testsuite/relro_test.sh: Fail if dc is not present.
2796 2011-03-21 Sriraman Tallam <tmsriram@google.com>
2798 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
2800 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
2801 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
2803 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
2804 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
2806 2011-03-14 Ian Lance Taylor <iant@google.com>
2808 * script-sections.cc (Sort_output_sections::script_compare):
2809 Rename from is_before, change return type.
2810 (Sort_output_sections::operator()): Adjust accordingly.
2812 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
2815 * testsuite/odr_violation2.cc: Add comment to make all error line
2816 numbers double digits.
2817 * testsuite/debug_msg.sh: Adjust expected errors.
2819 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
2821 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
2822 but mark earlier ones as non-canonical
2823 (offset_to_iterator): Update search target and example
2824 (do_addr2line): Return extra lines in a vector*
2825 (format_file_lineno): Extract from do_addr2line
2826 (one_addr2line): Add vector* out-param
2827 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
2828 when a lineno entry appeared last for its instruction
2829 (Dwarf_line_info): Add vector* out-param
2830 * object.cc (Relocate_info): Pass NULL for the vector* out-param
2831 * symtab.cc (Odr_violation_compare): Include the lineno in the
2833 (linenos_from_loc): New. Combine the canonical line for an
2834 address with its other lines.
2835 (True_if_intersect): New. Helper functor to make
2836 std::set_intersection a query.
2837 (detect_odr_violations): Compare sets of lines instead of just
2838 one line for each function. This became less deterministic, but
2839 has fewer false positives.
2840 * symtab.h: Declarations.
2841 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
2842 mix an optimized and non-optimized object in the same binary
2843 (odr_violation2.so): Same.
2844 * testsuite/Makefile.in: Regenerate from Makefile.am.
2845 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
2846 * testsuite/debug_msg.sh: Update line numbers and add
2848 * testsuite/odr_violation1.cc: Use OdrDerived, in a
2849 non-optimized context.
2850 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
2851 isn't inlined, and use OdrDerived in an optimized context.
2852 * testsuite/odr_header1.h: Defines OdrDerived, where
2853 optimization will change the
2854 first-instruction-in-the-destructor's file and line number.
2855 * testsuite/odr_header2.h: Defines OdrBase.
2857 2011-03-09 Ian Lance Taylor <iant@google.com>
2859 * fileread.cc (File_read::clear_views): Don't delete the whole
2862 2011-03-08 Ian Lance Taylor <iant@google.com>
2865 * fileread.cc: #include <climits>.
2866 (GOLD_IOV_MAX): Define.
2867 (File_read::read_multiple): Limit number of entries by iov_max.
2868 * fileread.h (class File_read): Always set max_readv_entries to
2871 2011-03-07 Ian Lance Taylor <iant@google.com>
2874 * options.h (class General_options): Add -dy and -dn.
2876 2011-03-02 Cary Coutant <ccoutant@google.com>
2878 * testsuite/script_test_9.t: Add TLS segment.
2880 2011-03-02 Simon Baldwin <simonb@google.com>
2882 * configure.ac: Add check for gnu_indirect_function support in
2883 the toolchain building binutils.
2884 * configure: Rebuild.
2886 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
2888 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
2889 plugin only symbols.
2890 (Symbol_table::sized_finalize_symbol) Mark symbol only present
2891 in plugin files as not needed in the symbol table.
2893 2011-02-11 Sriraman Tallam <tmsriram@google.com>
2895 * output.cc (Output_section::add_input_section): Delay fill
2896 generation for section ordering.
2898 2011-02-09 Ian Lance Taylor <iant@google.com>
2901 * object.h (class Sized_relobj): Remove clear_local_symbols.
2902 * reloc.cc (Sized_relobj::do_relocate): Don't call
2903 clear_local_symbols.
2905 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
2907 * plugin.cc (is_visible_from_outside): Return true for symbols
2910 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
2912 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
2915 2011-02-02 Sriraman Tallam <tmsriram@google.com>
2917 * icf.h (is_section_foldable_candidate): Change type of parameter
2919 * icf.cc (Icf::find_identical_sections): Change type of local variable
2920 section_name to be std::string.
2921 (is_function_ctor_or_dtor): Change type of parameter to std::string.
2923 2011-01-25 Ian Lance Taylor <iant@google.com>
2925 * script.cc (script_add_extern): Rewrite to use
2926 add_symbol_reference.
2928 2011-01-25 Doug Kwan <dougkwan@google.com>
2930 * icf.cc (get_section_contents): Always lock section's object.
2932 2011-01-24 Ian Lance Taylor <iant@google.com>
2934 * options.h (class General_options): Accept
2935 --no-detect-odr-violations.
2937 2011-01-24 Ian Lance Taylor <iant@google.com>
2939 * version.cc (version_string): Bump to 1.11.
2941 2011-01-24 Ian Lance Taylor <iant@google.com>
2943 * plugin.cc (class Plugin_rescan): Define new class.
2944 (Plugin_manager::claim_file): Set any_claimed_.
2945 (Plugin_manager::save_archive): New function.
2946 (Plugin_manager::save_input_group): New function.
2947 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
2949 (Plugin_manager::new_undefined_symbol): New function.
2950 (Plugin_manager::rescan): New function.
2951 (Plugin_manager::rescannable_defines): New function.
2952 (Plugin_manager::add_input_file): Set any_added_.
2953 * plugin.h (class Plugin_manager): define new fields rescannable_,
2954 undefined_symbols_, any_claimed_, and any_added_. Declare
2955 Plugin_rescan as friend. Declare new functions.
2956 (Plugin_manager::Rescannable): Define type.
2957 (Plugin_manager::Rescannable_list): Define type.
2958 (Plugin_manager::Undefined_symbol_list): Define type.
2959 (Plugin_manager::Plugin_manager): Initialize new fields.
2960 * archive.cc (Archive::defines_symbol): New function.
2961 (Add_archive_symbols::run): Pass archive to plugins if any.
2962 * archive.h (class Archive): Declare defines_symbol.
2963 * readsyms.cc (Input_group::~Input_group): New function.
2964 (Finish_group::run): Pass input_group to plugins if any.
2965 * readsyms.h (class Input_group): Declare destructor.
2966 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
2969 2011-01-10 Ian Lance Taylor <iant@google.com>
2971 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
2973 (Layout::set_segment_offsets): Reset increase_relro before calling
2974 set_section_addresses a second time.
2976 2011-01-04 Cary Coutant <ccoutant@google.com>
2978 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
2979 sections before NOBITS sections.
2981 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
2983 * version.cc (print_version): Update copyright to 2011.
2985 2010-12-23 Cary Coutant <ccoutant@google.com>
2987 * output.h (Output_data_reloc::add_output_section): Pass OD instead
2988 of OS to this->add. Add OD parameter to second form of the function.
2990 2010-12-20 Ian Lance Taylor <iant@google.com>
2992 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
2993 second of two consecutive entries with same offset.
2995 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2997 * testsuite/Makefile.am (ifuncmain2static_LDADD)
2998 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
2999 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
3000 to avoid unneeded links against $(LDADD).
3001 * testsuite/Makefile.in: Regenerate.
3003 2010-12-15 Ian Lance Taylor <iant@google.com>
3006 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
3007 for R_X86_64_32 and R_X86_64_PC32.
3008 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
3009 ver_matching_def_pic.o.
3010 (ver_matching_def_pic.o): New target.
3012 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3014 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
3015 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
3016 Move definition before File_read::View member definitions.
3017 (File_read::View::~View): Initialize and hold lock before
3018 updating current_mapped_bytes.
3020 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3022 * dwarf_reader.cc: Remove outdated comment.
3023 * gold-threads.cc: Fix typo in error message.
3024 * archive.cc: Fix typos in comments.
3025 * archive.h: Likewise.
3026 * arm-reloc-property.cc: Likewise.
3027 * arm-reloc-property.h: Likewise.
3028 * arm-reloc.def: Likewise.
3030 * attributes.h: Likewise.
3031 * cref.cc: Likewise.
3032 * ehframe.cc: Likewise.
3033 * fileread.h: Likewise.
3035 * i386.cc: Likewise.
3037 * incremental.h: Likewise.
3038 * int_encoding.cc: Likewise.
3039 * layout.h: Likewise.
3040 * main.cc: Likewise.
3041 * merge.h: Likewise.
3042 * object.cc: Likewise.
3043 * object.h: Likewise.
3044 * options.cc: Likewise.
3045 * readsyms.cc: Likewise.
3046 * reduced_debug_output.cc: Likewise.
3047 * reloc.cc: Likewise.
3048 * script-sections.cc: Likewise.
3049 * sparc.cc: Likewise.
3050 * symtab.h: Likewise.
3051 * target-reloc.h: Likewise.
3052 * target.cc: Likewise.
3053 * target.h: Likewise.
3054 * timer.cc: Likewise.
3055 * timer.h: Likewise.
3056 * x86_64.cc: Likewise.
3058 2010-12-09 Cary Coutant <ccoutant@google.com>
3060 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
3062 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
3063 parameter; change all callers.
3064 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
3065 * options.h (warn_execstack): New option.
3067 2010-12-07 Doug Kwan <dougkwan@google.com>
3069 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
3070 like function call relocations.
3072 2010-12-07 Ian Lance Taylor <iant@google.com>
3074 * archive.cc (Archive::get_elf_object_for_member): Permit
3075 punconfigured to be NULL.
3076 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
3077 (Archive::include_member): Pass NULL to get_elf_object_for_member
3078 if we searched for the archive and this is the first included
3081 2010-12-01 Ian Lance Taylor <iant@google.com>
3083 * dwarf_reader.h (class Sized_dwarf_line_info): Add
3084 track_relocs_type_ field.
3085 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3086 Set track_relocs_type_.
3087 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
3088 contents when using RELA relocs.
3089 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
3091 * reloc.cc (Track_relocs::next_addend): New function.
3092 * reloc.h (class Track_relocs): Declare next_addend.
3094 2010-12-01 Ian Lance Taylor <iant@google.com>
3096 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
3099 2010-12-01 Ian Lance Taylor <iant@google.com>
3101 * README: Update compilers known to work and fail.
3103 2010-11-23 Matthias Klose <doko@ubuntu.com>
3105 * configure.in: For --enable-gold, handle value `default' instead of
3106 `both*'. Always install ld as ld.bfd, install as ld if gold is
3108 * configure: Regenerate.
3110 2010-11-18 Doug Kwan <dougkwan@google.com>
3112 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
3113 and right_alignment to be zero. Store result alignment only if it is
3114 greater than existing alignment.
3116 2010-11-16 Cary Coutant <ccoutant@google.com>
3119 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3120 Check for ".zdebug_line".
3122 2010-11-16 Doug Kwan <dougkwan@google.com>
3123 Cary Coutant <ccoutant@google.com>
3125 * output.h (Output_segment::set_section_addresses): Pass increase_relro
3126 by reference; adjust all callers.
3127 * output.cc (Output_segment::set_section_addresses): Adjust references
3128 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
3130 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
3131 end at page boundary.
3133 2010-11-16 Cary Coutant <ccoutant@google.com>
3136 * layout.cc (Layout::choose_output_section): Transform names of
3137 compressed sections even when using a script with a SECTIONS clause.
3138 (Layout::output_section_name): Remove code to transform
3139 compressed debug section names.
3140 * output.cc (Output_section::add_input_section): Use uncompressed
3141 section size when tracking input sections.
3143 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
3145 * symtab.h (Symbol::NON_PIC_REF): Remove.
3146 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
3147 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
3148 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
3149 (Symbol::use_plt_offset): Take a flags argument and pass it
3150 directly to needs_dynamic_reloc. Restrict check for undefined
3151 weak symbols to function calls.
3152 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
3153 (Target_arm::Scan::global): Use it.
3154 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
3155 (Target_arm::Relocate::relocate): Likewise.
3156 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
3157 parameter with an r_type parameter. Use get_reference_flags
3159 (Target_arm::Relocate::relocate): Update accordingly.
3160 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
3161 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
3162 (Target_i386::Scan::global): Likewise.
3163 (Target_i386::Relocate::relocate): Likewise.
3164 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
3165 parameter with an r_type parameter. Use get_reference_flags
3167 (Target_i386::Relocate::relocate): Update accordingly.
3168 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
3169 (Target_powerpc::Scan::global): Use it.
3170 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
3171 (Target_powerpc::Relocate::relocate): Likewise.
3172 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
3173 (Target_sparc::Scan::global): Use it.
3174 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
3175 (Target_sparc::Relocate::relocate): Likewise.
3176 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
3177 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
3178 (Target_x86_64::Scan::global): Likewise.
3179 (Target_x86_64::Relocate::relocate): Likewise.
3181 2010-11-08 Doug Kwan <dougkwan@google.com>
3182 Cary Coutant <ccoutant@google.com>
3184 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
3185 (Arm_exidx_merge_section::section_contents_): New data member.
3186 (Arm_input_section::Arm_input_section): Initialize original_contents_.
3187 (Arm_input_section::~Arm_input_section): De-allocate memory.
3188 (Arm_input_section::original_contents_): New data member.
3189 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
3190 in parameters instead of calling Object::section_contents without
3192 (Arm_output_section::group_section): New parameter TASK. Pass it
3193 to callees that need locking objects.
3194 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
3195 to lock EXIDX input sections. Fix a formatting issue. Call
3196 Arm_exidx_merged_section::build_contents to create merged section
3198 (Arm_output_section::create_stub_group): New parameter TASK. Use it
3199 to lock object of stub table owner.
3200 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
3201 TEXT_SIZE to initialize data member TEXT_SIZE_.
3202 (Arm_exidx_input_section::addralign): Fix typo in comment.
3203 (Arm_exidx_input_section::text_size): New method.
3204 (Target_arm::do_relax): New parameter TASK. Pass it to callees
3205 that require locking objects. Lock objects before scanning for stubs
3206 and updating local symbols.
3207 (Arm_input_section<big_endian>::init): Copy contents of original
3209 (Arm_input_section<big_endian>::do_write): Use saved contents of
3210 original input section instead of calling Object::section_contents
3212 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
3213 size without calling Object::section_size().
3214 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
3215 for size. Allocate a buffer for merged EXIDX entries.
3216 (Arm_exidx_merged_section::build_contents): New method.
3217 (Arm_exidx_merged_section::do_write): Move merge section contents
3218 building code to Arm_exidx_merged_section::build_contetns. Write
3219 out contetns in buffer instead of building it on the fly.
3220 (Arm_relobj::make_exidx_input_section): Also pass text section size
3221 to Arm_exidx_input_section constructor.
3222 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
3223 (Arm_dynobj::do_read_symbols): Fix memory leak.
3224 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
3225 * target.h: (class Task): Add forward declaration.
3226 (Target::relax): Add new parameter TASK and pass it to
3228 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
3230 2010-11-05 Cary Coutant <ccoutant@google.com>
3233 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
3234 object when reading from the file.
3235 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
3237 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
3238 when reading section contents.
3239 (get_section_contents): Likewise.
3240 (icf::find_identical_sections): Likewise.
3241 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
3242 object when reading from the file.
3243 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
3244 the object when doing deferred section layout.
3246 2010-11-03 Nick Clifton <nickc@redhat.com>
3249 * script.h (class Symbol_assignment: name): New member. Returns
3250 the name of the symbol.
3251 * scrfipt.cc (Script_options::is_pending_assignment): New member.
3252 Returns true if the given symbol name is on the list of
3253 assignments wating to be processed.
3254 * archive.cc (should_incldue_member): If the symbol is undefined,
3255 check to see if it is on the list of symbols pending assignment.
3257 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
3259 * script-sections.cc (Script_sections::find_memory_region): Check
3260 for a NULL output section pointer.
3262 2010-10-29 Doug Kwan <dougkwan@google.com>
3264 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3265 Output_section::add_relaxed_input_section.
3266 * output.cc (Output_section::add_relaxed_input_section): Add new
3267 arguments LAYOUT and NAME. Set section order index.
3268 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3269 Copy section order index.
3270 * output.h (Output_section::add_relaxed_input_section): Add new
3271 arguments LAYOUT and NAME.
3273 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3275 * testsuite/Makefile.am: Move gcctestdir/ld rule to
3276 NATIVE_OR_CROSS_LINKER.
3277 * testsuite/Makefile.in: Regenerate.
3279 2010-10-20 Doug Kwan <dougkwan@google.com>
3281 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
3282 without SHF_LINK_ORDER flags.
3283 * layout.cc (Layout::choose_output_section): Do not filter
3284 SHF_LINK_ORDER flag in a relocatable link.
3286 2010-10-17 Cary Coutant <ccoutant@google.com>
3288 * output.h (Output_segment::set_section_addresses): Change function
3289 signature. Update all callers.
3290 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
3292 (Output_segment::set_section_addresses): Align after last TLS
3293 section. Add padding before last relro section instead of after.
3295 2010-10-17 Doug Kwan <dougkwan@google.com>
3297 * gold/arm.cc (Target_arm::got_section): Use correct order and set
3298 GOT output section to be writable.
3300 2010-10-14 Cary Coutant <ccoutant@google.com>
3302 * debug.h (DEBUG_INCREMENTAL): New flag.
3303 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3304 * gold.cc (queue_initial_tasks): Check parameters for incremental link
3306 * incremental.cc (report_command_line): Ignore all forms of
3308 * layout.cc (Layout::Layout): Check parameters for incremental link
3310 * options.cc (General_options::parse_incremental): New function.
3311 (General_options::parse_no_incremental): New function.
3312 (General_options::parse_incremental_full): New function.
3313 (General_options::parse_incremental_update): New function.
3314 (General_options::incremental_mode_): New data member.
3315 (General_options::finalize): Check incremental_mode_.
3316 * options.h (General_options): Update help text for --incremental.
3317 Add --no-incremental, --incremental-full, --incremental-update.
3318 (General_options::Incremental_mode): New enum type.
3319 (General_options::incremental_mode): New function.
3320 (General_options::incremental_mode_): New data member.
3321 * parameters.cc (Parameters::incremental_mode_): New data member.
3322 (Parameters::set_options): Set incremental_mode_.
3323 (Parameters::set_incremental_full): New function.
3324 (Parameters::incremental): New function.
3325 (Parameters::incremental_update): New function.
3326 (set_parameters_incremental_full): New function.
3327 * parameters.h (Parameters::set_incremental_full): New function.
3328 (Parameters::incremental): New function.
3329 (Parameters::incremental_update): New function.
3330 (Parameters::incremental_mode_): New data member.
3331 (set_parameters_incremental_full): New function.
3332 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
3333 incremental link mode.
3334 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
3335 (Sized_relobj::do_relocate_sections): Likewise.
3336 * testsuite/Makefile.am (incremental_test): Use --incremental-full
3338 * testsuite/Makefile.in: Regenerate.
3339 * testsuite/incremental_test.sh: Filter all forms of --incremental.
3341 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3343 * script-sections.h (class Script_sections): Make
3344 Sections_elements typedef public.
3345 * script-sections.cc (class Sort_output_sections): Add elements_
3346 field. Add constructor which sets it; change all callers.
3347 (Sort_output_sections::is_before): New function.
3348 (Sort_output_sections::operator()): Call is_before.
3349 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
3351 * testsuite/script_test_10.sh: New test. Test script section
3353 * testsuite/script_test_10.t: Likewise.
3354 * testsuite/script_test_10.s: Likewise.
3355 * testsuite/Makefile.am: Wrap the cross linker tests and the
3356 common tests into NATIVE_OR_CROSS_LINKER.
3357 (check_SCRIPTS): Add script_test_10.sh.
3358 (check_DATA): Add script_test_10.stdout.
3359 (script_test_10.o, script_test_10): New targets.
3360 (script_test_10.stdout): New target.
3361 * configure, testsuite/Makefile.in: Regenerate.
3363 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3365 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
3366 error for the deprecated relocations.
3367 (Target_arm::Scan::global): Likewise.
3368 (Target_arm::Relocate::relocate): Likewise.
3370 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
3372 * fileread.cc (Input_file::find_file): Initialize *found_name
3373 and *namep when using the fallback search for case 4.
3375 2010-10-11 Cary Coutant <ccoutant@google.com>
3377 * options.h (class General_options): Redefine -z lazy as an alias for
3378 the negation of -z now.
3380 2010-10-11 Ian Lance Taylor <iant@google.com>
3382 * resolve.cc (symbol_to_bits): Report the value of the unsupported
3385 2010-10-06 Nick Clifton <nickc@redhat.com>
3387 * script-sections.cc(class Memory_region): Remove
3388 current_lma_offset_ field. Rename current_vma_offset_ to
3389 current_offset_. Add last_section_ field.
3390 (Memory_region::get_current_vma_address): Rename to
3391 get_current_address.
3392 (Memory_region::get_current_lma_address): Delete.
3393 (Memory_region::increment_vma_offset): Rename to
3395 (Memory_region::increment_lma_offset): Delete.
3396 (Memory_region::attributes_compatible): New method. Returns
3397 true if the provided section is compatible with the region.
3398 (Memory_region::get_last_section): New method. Returns the last
3399 section to use the region.
3400 (Memory_region::set_last_section): New method. Stores the last
3401 section to use the region.
3402 (Script_sections::block_in_region): New method. Returns true if
3403 a block of memory is contained within a region.
3404 (Script_sections::find_memory_region): New method. Locates a
3405 memory region to be used to set a VMA or LMA address.
3406 (Output_section_definition::set_section_addresses): Add code to
3407 check for addresses set by memory regions.
3408 (Output_segment::set_section_addresses): Remove memory region
3410 (Script_sections::create_segment): Add a warning if a header
3411 segment is created outside of any region.
3412 * script-sections.h (class Script_sections): Add prototypes for
3413 find_memory_region and block_in_region methods.
3414 * testsuite/memory_test.s: Use .long instead of .word.
3415 * testsuite/memory_test.t: Add some more output sections.
3416 * testsuite/memory_test.sh: Update expected output.
3418 2010-10-02 Doug Kwan <dougkwan@google.com>
3420 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
3421 defintion to symtab.h
3422 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
3423 declaration to defintion.
3425 2010-10-01 Nick Clifton <nickc@redhat.com>
3427 * expression.cc (eval): Replace dummy argument with NULL.
3428 (eval_maybe_dot): Check for a NULL result section pointer.
3429 (Symbol_expression::value): Likewise.
3430 (Dot_expression::value): Likewise.
3431 (BINARY_EXPRESSION): Likewise.
3432 (Max_expression::value): Likewise.
3433 (Min_expression::value): Likewise.
3434 (Absolute_expression::value): Likewise.
3435 (Addr_expression::value_from_output_section): Likewise.
3436 (Loaddddr_expression::value_from_output_section): Likewise.
3437 (Segment_start_expression::value): Likewise.
3438 * script-sections.cc
3439 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
3441 (Sections_elememt_dot_assignment::set_section_addresses):
3443 (Output_data_expression::do_write_to_buffer): Likewise.
3444 (Output_section_definition::finalize_symbols): Likewise.
3445 (Output_section_definition::set_section_addresses): Likewise.
3447 2010-09-30 Doug Kwan <dougkwan@google.com>
3449 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
3451 2010-09-28 Sriraman Tallam <tmsriram@google.com>
3453 * target.h (Target::can_icf_inline_merge_sections): New virtual
3455 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
3457 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
3459 * icf.cc (get_section_contents): Inline merge sections only when
3462 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3464 * configure: Regenerate.
3466 2010-09-17 Ian Lance Taylor <iant@google.com>
3468 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
3469 * testsuite/Makefile.am (memory_test.o): New target.
3470 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
3472 * testsuite/Makefile.in: Rebuild.
3474 2010-09-17 Doug Kwan <dougkwan@google.com>
3476 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
3477 defintion if relocation uses GOT entries of the symbol.
3478 * testsuite/icf_safe_test.sh: Fix test.
3479 * testsuite/icf_safe_so_test.sh: Fix test.
3481 2010-09-16 Cary Coutant <ccoutant@google.com>
3483 * script_sections.cc (class Memory_region): Remove "NULL" from
3484 vector initializations.
3486 2010-09-15 Cary Coutant <ccoutant@google.com>
3488 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
3489 Resolve forwarding symbols.
3491 2010-09-15 Doug Kwan <dougkwan@google.com>
3493 * gold/testsuite/script_test_3.t: Add ARM special sections.
3494 * gold/testsuite/script_test_4.t: Same.
3495 * gold/testsuite/script_test_5.t: Same.
3496 * gold/testsuite/script_test_6.t: Same.
3497 * gold/testsuite/script_test_7.t: Same.
3498 * gold/testsuite/script_test_7.t: Same.
3499 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
3501 2010-09-14 Cary Coutant <ccoutant@google.com>
3503 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
3504 (Target_x86_64::Relocate::relocate_tls): Replace check for
3505 saw_tls_block_reloc_ with test for executable section.
3507 2010-09-12 Cary Coutant <ccoutant@google.com>
3509 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
3510 position-independent executables to shared libraries need dynamic
3512 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
3513 position-independent executables.
3514 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
3515 * testsuite/Makefile.in: Regenerate.
3517 2010-09-10 Nick Clifton <nickc@redhat.com>
3520 * testsuite/memory_test.t: Discard any sections that are not
3523 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
3526 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
3527 "This::" to work around a bug in gcc 4.2.
3529 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
3531 2010-09-09 Rafael Espindola <espindola@google.com>
3533 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
3534 sections with different PF_X flags in the same segment.
3535 (Layout::find_first_load_seg): Search all segments to find the first
3537 * options.h (rosegment): New.
3539 2010-09-08 Rafael Espindola <espindola@google.com>
3541 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
3543 2010-09-08 Doug Kwan <dougkwan@google.com>
3545 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
3546 (Arm_relobj::do_relocate_sections): Add new parameter for output
3547 file to match the parent.
3548 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
3549 of local symbols instead of input values. Update code to track
3550 changes in gold::relocate_section.
3551 * object.cc (Sized_relobj::compute_final_local_value): New methods.
3552 (Sized_relobj::compute_final_local_value_internal): New methods.
3553 (Sized_relobj::do_finalize_local_symbols): Move code from loop
3554 body into private version of Sized_relobj::compute_final_local_value.
3555 Call the inline method.
3556 * object.h (Symbol_value::Symbol_value): Define destructor. Free
3557 merged symbol value if there is one.
3558 (Symbol_value::has_output_value): New method defintiion.
3559 (Sized_relobj::Compute_final_local_value_status): New enum type.
3560 (Sized_relobj::compute_final_local_value): New methods.
3561 (Sized_relobj::compute_final_local_value_internal): New methods.
3562 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
3563 and arm_cortex_a8.sh.
3564 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
3565 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
3567 * Makefile.in: Regenerate.
3568 * testsuite/arm_bl_out_of_range.s: Update test.
3569 * testsuite/thumb_bl_out_of_range.s: Ditto.
3570 * testsuite/thumb_blx_out_of_range.s: Ditto.
3571 * testsuite/arm_branch_out_of_range.sh: New file.
3572 * testsuite/arm_cortex_a8.sh: Ditto.
3573 * testsuite/arm_cortex_a8_b.s: Ditto.
3574 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
3575 * testsuite/arm_cortex_a8_b_local.s: Ditto.
3576 * testsuite/arm_cortex_a8_bl.s: Ditto.
3577 * testsuite/arm_cortex_a8_blx.s: Ditto.
3578 * testsuite/arm_cortex_a8_local.s: Ditto.
3579 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
3580 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
3582 2010-09-08 Rafael Espindola <espindola@google.com>
3584 * Makefile.am (memory_test.stdout): Run readelf with -W.
3585 * Makefile.in: Regenerate.
3586 * testsuite/memory_test.sh: Make the regexps accept both 32 and
3589 2010-09-08 Rafael Espindola <espindola@google.com>
3591 * script-sections.cc (Script_sections::add_memory_region): Convert
3592 field precision to int.
3593 * script.cc (script_set_section_region, script_set_section_region):
3594 Convert field precision to int.
3596 2010-09-08 Rafael Espindola <espindola@google.com>
3598 * arm.cc (do_finalize_sections): Create the __exidx_start and
3599 __exdix_end symbols even when the section is missing.
3601 2010-09-08 Nick Clifton <nickc@redhat.com>
3603 * README: Remove claim that MEMORY is not supported.
3604 * expression.cc (script_exp_function_origin)
3605 (script_exp_function_length): Move from here to ...
3606 * script.cc: ... here.
3607 (script_set_section_region, script_add_memory)
3608 (script_parse_memory_attr, script_include_directive): New
3610 * script-sections.cc
3611 (class Memory_region): New class.
3612 (class Output_section_definition): Add set_memory_region,
3613 set_section_vma, set_section_lma and get_section_name methods.
3614 (class Script_Sections): Add add_memory_region,
3615 find_memory_region, find_memory_region_origin,
3616 find_memory_region_length and set_memory_region methods.
3617 Have set_section_addresses method walk the list of set memory
3619 Extend the print methos to display memory regions.
3620 * script-sections.h: Add prototypes for new methods.
3621 Add enum for MEMORY region attributes.
3622 * yyscript.y: Add support for parsing MEMORY regions.
3623 * script-c.h: Add prototypes for new functions.
3624 * testsuite/Makefile.am: Add test of MEMORY region functionality.
3625 * testsuite/Makefile.in: Regenerate.
3626 * testsuite/memory_test.sh: New script.
3627 * testsuite/memory_test.s: New assembler source file.
3628 * testsuite/memory_test.t: New linker script.
3630 2010-08-27 Doug Kwan <dougkwan@google.com>
3632 * gold/resolve.cc (Symbol_table::should_override): Let a weak
3633 reference override an existing dynamic weak reference.
3634 * testsuite/Makefile.am: Add new test dyn_weak_ref.
3635 * testsuite/Makefile.in: Regenerate.
3636 * testsuite/dyn_weak_ref.sh: New file.
3637 * testsuite/dyn_weak_ref_1.c: Ditto.
3638 * testsuite/dyn_weak_ref_2.c: Ditto.
3640 2010-08-27 Ian Lance Taylor <iant@google.com>
3642 * incremental.h (class Incremental_input_entry): Add virtual
3645 2010-08-27 Ian Lance Taylor <iant@google.com>
3647 * testsuite/start_lib_test_3.c: Mark t3 as used.
3649 2010-08-27 Nick Clifton <nickc@redhat.com>
3651 * options.cc (version_script): Fix small typo in previous
3654 2010-08-25 Nick Clifton <nickc@redhat.com>
3656 * archive.cc: Formatting fixes: Remove whitespace between
3657 typename and following asterisk. Remove whitespace between
3658 function name and opening parenthesis.
3659 * archive.h: Likewise.
3661 * attributes.cc: Likewise.
3662 * attributes.h: Likewise.
3663 * common.cc: Likewise.
3664 * copy-relocs.cc: Likewise.
3665 * dirsearch.h: Likewise.
3666 * dynobj.cc: Likewise.
3667 * ehframe.cc: Likewise.
3668 * ehframe.h: Likewise.
3669 * expression.cc: Likewise.
3670 * fileread.cc: Likewise.
3671 * fileread.h: Likewise.
3673 * gold-threads.cc: Likewise.
3674 * gold.cc: Likewise.
3675 * i386.cc: Likewise.
3677 * incremental-dump.cc: Likewise.
3678 * incremental.cc: Likewise.
3679 * layout.cc: Likewise.
3680 * layout.h: Likewise.
3681 * main.cc: Likewise.
3682 * merge.cc: Likewise.
3683 * merge.h: Likewise.
3684 * object.cc: Likewise.
3685 * object.h: Likewise.
3686 * options.cc: Likewise.
3687 * options.h: Likewise.
3688 * output.cc: Likewise.
3689 * output.h: Likewise.
3690 * plugin.cc: Likewise.
3691 * plugin.h: Likewise.
3692 * powerpc.cc: Likewise.
3693 * reloc.cc: Likewise.
3694 * script-c.h: Likewise.
3695 * script-sections.cc: Likewise.
3696 * script.cc: Likewise.
3697 * stringpool.cc: Likewise.
3698 * symtab.cc: Likewise.
3699 * symtab.h: Likewise.
3700 * target.cc: Likewise.
3701 * timer.cc: Likewise.
3702 * timer.h: Likewise.
3703 * version.cc: Likewise.
3704 * x86_64.cc: Likewise.
3706 2010-08-24 Nick Clifton <nickc@redhat.com>
3709 * layout.cc (segment_precedes): Sort segments by their physical
3710 addresses, if they have been set.
3712 2010-08-23 Cary Coutant <ccoutant@google.com>
3714 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
3716 (Lib_group::include_member): Unlock object after deleting its
3718 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
3721 2010-08-19 Neil Vachharajani <nvachhar@google.com>
3722 Cary Coutant <ccoutant@google.com>
3724 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
3725 constructor, and set_blocker.
3726 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
3728 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
3729 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
3730 * testsuite/Makefile.am (start_lib_test): New test case.
3731 * testsuite/Makefile.in: Regenerate.
3732 * testsuite/start_lib_test_main.c: New file.
3733 * testsuite/start_lib_test_1.c: New file.
3734 * testsuite/start_lib_test_2.c: New file.
3735 * testsuite/start_lib_test_3.c: New file.
3737 2010-08-19 Ian Lance Taylor <iant@google.com>
3739 * Makefile.in: Rebuild with automake 1.11.1.
3740 * aclocal.m4: Likewise.
3741 * testsuite/Makefile.in: Likewise.
3743 2010-08-19 Ian Lance Taylor <iant@google.com>
3746 * i386.cc (class Output_data_plt_i386): Update declarations.
3747 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
3748 local_ifuncs_ fields.
3749 (Target_i386::do_plt_section_for_global): New function.
3750 (Target_i386::do_plt_section_for_local): New function.
3751 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
3752 parameter; change all callers. Initialize global_ifuncs_ and
3753 local_ifuncs_. If doing a static link define __rel_iplt_start and
3755 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
3756 (Output_data_plt_i386::add_local_ifunc_entry): New function.
3757 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
3759 (Target_i386::make_plt_section): New function, broken out of
3760 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
3761 (Target_i386::make_plt_entry): Call make_plt_section.
3762 (Target_i386::make_local_ifunc_plt_entry): New function.
3763 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
3764 (Target_i386::Scan::local): Handle IFUNC symbols. Add
3765 R_386_IRELATIVE to switch.
3766 (Target_i386::Scan::global): Likewise.
3767 (Target_i386::Relocate::relocate): Likewise.
3768 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
3770 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
3771 (Target_x86_64::do_plt_section_for_global): New function.
3772 (Target_x86_64::do_plt_section_for_local): New function.
3773 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
3774 parameter; change all callers. If doing a static link define
3775 __rela_iplt_start and __rela_iplt_end.
3776 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
3777 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
3778 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
3780 (Target_x86_64::make_local_ifunc_plt_entry): New function.
3781 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
3783 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
3784 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
3785 R_X86_64_IRELATIVE to switch.
3786 (Target_x86_64::Scan::global): Likewise.
3787 (Target_x86_64::Relocate::relocate): Likewise.
3788 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
3790 * target.h (class Target): Add plt_section_for_global and
3791 plt_section_for_local functions. Add do_plt_section_for_global
3792 and do_plt_section_for_local virtual functions.
3793 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
3794 clarifying comments.
3795 (Symbol::use_plt_offset): Handle IFUNC symbol.
3796 * object.cc (Sized_relobj::Sized_relobj): Initialize
3798 (Sized_relobj::local_has_plt_offset): New function.
3799 (Sized_relobj::local_plt_offset): New function.
3800 (Sized_relobj::set_local_plt_offset): New function.
3801 (Sized_relobj::do_count): Handle IFUNC symbol.
3802 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
3803 a bit away from input_shndx_ field. Add set_is_func_symbol and
3804 is_ifunc_symbol functions.
3805 (class Sized_relobj): Update declarations. Remove Tls_got_entry
3806 and Local_tls_got_offsets. Define Local_plt_offsets. Add
3807 local_plt_offsets_ field.
3808 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
3809 * output.h (class Output_section_data): Add non-const
3810 output_section function.
3811 (class Output_data_got): Update declarations.
3812 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
3813 Add use_plt_offset parameter to global and local constructors.
3814 Change all callers. Change local_sym_index_ field to 31 bits.
3815 Change GSYM_CODE and CONSTANT_CODE accordingly.
3816 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
3817 doing a static link don't set sh_link field.
3818 (Output_data_got::Got_entry::write): Use PLT offset if
3820 (Output_data_got::add_global_plt): New function.
3821 (Output_data_got::add_local_plt): New function.
3822 * target-reloc.h (relocate_section): Handle IFUNC symbol.
3823 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
3824 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
3825 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
3826 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
3828 * testsuite/ifunc-sel.h: New file.
3829 * testsuite/ifuncmain1.c: New file.
3830 * testsuite/ifuncmain1vis.c: New file.
3831 * testsuite/ifuncmod1.c: New file.
3832 * testsuite/ifuncdep2.c: New file.
3833 * testsuite/ifuncmain2.c: New file.
3834 * testsuite/ifuncmain3.c: New file.
3835 * testsuite/ifuncmod3.c: New file.
3836 * testsuite/ifuncmain4.c: New file.
3837 * testsuite/ifuncmain5.c: New file.
3838 * testsuite/ifuncmod5.c: New file.
3839 * testsuite/ifuncmain6pie.c: New file.
3840 * testsuite/ifuncmod6.c: New file.
3841 * testsuite/ifuncmain7.c: New file.
3842 * configure, testsuite/Makefile.in: Rebuild.
3844 2010-08-18 Ian Lance Taylor <iant@google.com>
3847 (Output_section_incremental_inputs::write_input_files): Add cast
3848 to avoid signed/unsigned comparison warning.
3849 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3851 2010-08-12 Cary Coutant <ccoutant@google.com>
3853 * common.cc (Sort_commons::operator()): Remove unnecessary code.
3855 2010-08-13 Ian Lance Taylor <iant@google.com>
3857 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
3859 2010-08-12 Cary Coutant <ccoutant@google.com>
3860 Doug Kwan <dougkwan@google.com>
3862 * resolve.cc (Symbol_table::should_override): When a weak dynamic
3863 defintion overrides non-weak undef, remember that the original undef
3865 * symtab.cc (Symbol_table::sized_write_global): For undef without
3866 an original weak binding, set binding to global in output.
3867 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
3868 * testsuite/Makefile.in: Regenerate.
3869 * testsuite/strong_ref_weak_def.sh: New file.
3870 * testsuite/strong_ref_weak_def_1.c: Ditto.
3871 * testsuite/strong_ref_weak_def_2.c: Ditto.
3873 2010-08-12 Cary Coutant <ccoutant@google.com>
3875 * testsuite/incremental_test.sh: Rewrite.
3876 * testsuite/incremental_test_1.c: Rewrite.
3877 * testsuite/incremental_test_2.c: Rewrite.
3879 2010-08-12 Cary Coutant <ccoutant@google.com>
3881 * arm.cc (Target_arm::got_size): Add const.
3882 (Target_arm::got_entry_count): New function.
3883 (Target_arm::plt_entry_count): New function.
3884 (Target_arm::first_plt_entry_offset): New function.
3885 (Target_arm::plt_entry_size): New function.
3886 (Output_data_plt_arm::entry_count): New function.
3887 (Output_data_plt_arm::first_plt_entry_offset): New function.
3888 (Output_data_plt_arm::get_plt_entry_size): New function.
3889 * i386.cc (Target_i386::got_size): Add const.
3890 (Target_i386::got_entry_count): New function.
3891 (Target_i386::plt_entry_count): New function.
3892 (Target_i386::first_plt_entry_offset): New function.
3893 (Target_i386::plt_entry_size): New function.
3894 (Output_data_plt_i386::entry_count): New function.
3895 (Output_data_plt_i386::first_plt_entry_offset): New function.
3896 (Output_data_plt_i386::get_plt_entry_size): New function.
3897 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
3898 find_incremental_inputs_sections. Dump incremental_got_plt section.
3899 * incremental.cc: Include target.h.
3900 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
3901 parameter. Adjust all callers. Find incremental_got_plt section.
3902 (Incremental_inputs::create_data_sections): Create incremental_got_plt
3904 (Output_section_incremental_inputs::set_final_data_size): Calculate
3905 size of incremental_got_plt section.
3906 (Output_section_incremental_inputs::do_write): Write the
3907 incremental_got_plt section.
3908 (Got_plt_view_info): New struct.
3909 (Local_got_offset_visitor): New class.
3910 (Global_got_offset_visitor): New class.
3911 (Global_symbol_visitor_got_plt): New class.
3912 (Output_section_incremental_inputs::write_got_plt): New function.
3913 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
3914 Add parameter. Adjust all callers.
3915 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3916 (Incremental_inputs::got_plt_section): New function.
3917 (Incremental_inputs::got_plt_section_): New data member.
3918 (Incremental_got_plt_reader): New class.
3919 * layout.cc (Layout::create_incremental_info_sections): Add the
3920 incremental_got_plt section.
3921 * object.h (Got_offset_list::get_list): New function.
3922 (Got offset_list::for_all_got_offsets): New function.
3923 (Sized_relobj::local_got_offset_list): New function.
3924 * powerpc.cc (Target_powerpc::got_size): Add const.
3925 (Target_powerpc::got_entry_count): New function.
3926 (Target_powerpc::plt_entry_count): New function.
3927 (Target_powerpc::first_plt_entry_offset): New function.
3928 (Target_powerpc::plt_entry_size): New function.
3929 (Output_data_plt_powerpc::entry_count): New function.
3930 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
3931 (Output_data_plt_powerpc::get_plt_entry_size): New function.
3932 * sparc.cc (Target_sparc::got_size): Add const.
3933 (Target_sparc::got_entry_count): New function.
3934 (Target_sparc::plt_entry_count): New function.
3935 (Target_sparc::first_plt_entry_offset): New function.
3936 (Target_sparc::plt_entry_size): New function.
3937 (Output_data_plt_sparc::entry_count): New function.
3938 (Output_data_plt_sparc::first_plt_entry_offset): New function.
3939 (Output_data_plt_sparc::get_plt_entry_size): New function.
3940 * symtab.h (Symbol::got_offset_list): New function.
3941 (Symbol_table::for_all_symbols): New function.
3942 * target.h (Sized_target::got_entry_count): New function.
3943 (Sized_target::plt_entry_count): New function.
3944 (Sized_target::plt_entry_size): New function.
3945 * x86_64.cc (Target_x86_64::got_size): Add const.
3946 (Target_x86_64::got_entry_count): New function.
3947 (Target_x86_64::plt_entry_count): New function.
3948 (Target_x86_64::first_plt_entry_offset): New function.
3949 (Target_x86_64::plt_entry_size): New function.
3950 (Output_data_plt_x86_64::entry_count): New function.
3951 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
3952 (Output_data_plt_x86_64::get_plt_entry_size): New function.
3954 2010-08-12 Cary Coutant <ccoutant@google.com>
3956 * archive.cc: Include incremental.h.
3957 (Archive::Archive): Initialize incremental_info_.
3958 (Archive::include_member): Record archive members in incremental info.
3959 (Add_archive_symbols::run): Record begin and end of an archive in
3961 (Lib_group::include_member): Record objects in incremental info.
3962 * archive.h (Incremental_archive_entry): Forward declaration.
3963 (Archive::set_incremental_info): New member function.
3964 (Archive::incremental_info): New member function.
3965 (Archive::Unused_symbol_iterator): New class.
3966 (Archive::unused_symbols_begin): New member function.
3967 (Archive::unused_symbols_end): New member function.
3968 (Archive::incremental_info_): New data member.
3969 * incremental-dump.cc (find_input_containing_global): New function.
3970 (dump_incremental_inputs): Dump new incremental info sections.
3971 * incremental.cc: Include symtab.h.
3972 (Output_section_incremental_inputs): New class.
3973 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
3974 new incremental info sections.
3975 (Sized_incremental_binary::do_check_inputs): Likewise.
3976 (Incremental_inputs::report_archive): Remove.
3977 (Incremental_inputs::report_archive_begin): New function.
3978 (Incremental_inputs::report_archive_end): New function.
3979 (Incremental_inputs::report_object): New function.
3980 (Incremental_inputs::finalize_inputs): Remove.
3981 (Incremental_inputs::report_input_section): New function.
3982 (Incremental_inputs::report_script): Rewrite.
3983 (Incremental_inputs::finalize): Do nothing but finalize string table.
3984 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3985 (Incremental_inputs::sized_create_inputs_section_data): Remove.
3986 (Incremental_inputs::create_data_sections): New function.
3987 (Incremental_inputs::relocs_entsize): New function.
3988 (Output_section_incremental_inputs::set_final_data_size): New function.
3989 (Output_section_incremental_inputs::do_write): New function.
3990 (Output_section_incremental_inputs::write_header): New function.
3991 (Output_section_incremental_inputs::write_input_files): New function.
3992 (Output_section_incremental_inputs::write_info_blocks): New function.
3993 (Output_section_incremental_inputs::write_symtab): New function.
3994 * incremental.h (Incremental_script_entry): Forward declaration.
3995 (Incremental_object_entry): Forward declaration.
3996 (Incremental_archive_entry): Forward declaration.
3997 (Incremental_inputs): Forward declaration.
3998 (Incremental_inputs_header_data): Remove.
3999 (Incremental_inputs_header): Remove.
4000 (Incremental_inputs_header_write): Remove.
4001 (Incremental_inputs_entry_data): Remove.
4002 (Incremental_inputs_entry): Remove.
4003 (Incremental_inputs_entry_write): Remove.
4004 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
4005 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
4006 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4007 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
4009 (Incremental_input_entry): New class.
4010 (Incremental_script_entry): New class.
4011 (Incremental_object_entry): New class.
4012 (Incremental_archive_entry): New class.
4013 (Incremental_inputs::Incremental_inputs): Initialize new data members.
4014 (Incremental_inputs::report_inputs): Remove.
4015 (Incremental_inputs::report_archive): Remove.
4016 (Incremental_inputs::report_archive_begin): New function.
4017 (Incremental_inputs::report_archive_end): New function.
4018 (Incremental_inputs::report_object): Change prototype.
4019 (Incremental_inputs::report_input_section): New function.
4020 (Incremental_inputs::report_script): Change prototype.
4021 (Incremental_inputs::get_reloc_count): New function.
4022 (Incremental_inputs::set_reloc_count): New function.
4023 (Incremental_inputs::create_data_sections): New function.
4024 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4025 (Incremental_inputs::inputs_section): New function.
4026 (Incremental_inputs::symtab_section): New function.
4027 (Incremental_inputs::relocs_section): New function.
4028 (Incremental_inputs::get_stringpool): Add const.
4029 (Incremental_inputs::command_line): Add const.
4030 (Incremental_inputs::inputs): Remove.
4031 (Incremental_inputs::command_line_key): New function.
4032 (Incremental_inputs::input_file_count): New function.
4033 (Incremental_inputs::input_files): New function.
4034 (Incremental_inputs::relocs_entsize): New function.
4035 (Incremental_inputs::sized_create_inputs_section_data): Remove.
4036 (Incremental_inputs::finalize_inputs): Remove.
4037 (Incremental_inputs::Input_info): Remove.
4038 (Incremental_inputs::lock_): Remove.
4039 (Incremental_inputs::inputs_): Change type.
4040 (Incremental_inputs::inputs_map_): Remove.
4041 (Incremental_inputs::current_object_entry_): New data member.
4042 (Incremental_inputs::inputs_section_): New data member.
4043 (Incremental_inputs::symtab_section_): New data member.
4044 (Incremental_inputs::relocs_section_): New data member.
4045 (Incremental_inputs::reloc_count_): New data member.
4046 (Incremental_inputs_reader): New class.
4047 (Incremental_symtab_reader): New class.
4048 (Incremental_relocs_reader): New class.
4049 * layout.cc (Layout::finalize): Move finalization of incremental info
4050 and creation of incremental info sections to follow finalization of
4051 symbol table. Set offsets for postprocessing sections.
4052 (Layout::create_incremental_info_sections): Call
4053 Incremental_inputs::create_data_sections. Add incremental symtab
4054 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
4055 sections to layout after input sections.
4056 * layout.h (struct Timespec): Forward declaration.
4057 (Layout::incremental_inputs): Add const.
4058 (Layout::create_incremental_info_sections): Add parameter.
4059 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
4060 * object.cc: Include incremental.h.
4061 (Relobj::finalize_incremental_relocs): New function.
4062 (Sized_relobj::do_layout): Record input sections in incremental info.
4063 * object.h (Object::output_section): New function.
4064 (Object::output_section_offset): Moved from Relobj.
4065 (Object::get_incremental_reloc_base): New function.
4066 (Object::get_incremental_reloc_count): New function.
4067 (Object::do_output_section): New function.
4068 (Object::do_output_section_offset): Moved from Relobj.
4069 (Object::do_get_incremental_reloc_base): New function.
4070 (Object::do_get_incremental_reloc_count): New function.
4071 (Object::Object): Initialize new data members.
4072 (Relobj::output_section): Renamed do_output_section and moved to
4074 (Relobj::output_section_offset): Moved to Object.
4075 (Relobj::do_get_incremental_reloc_base): New function.
4076 (Relobj::do_get_incremental_reloc_count): New function.
4077 (Relobj::allocate_incremental_reloc_counts): New function.
4078 (Relobj::count_incremental_reloc): New function.
4079 (Relobj::finalize_incremental_relocs): New function.
4080 (Relobj::next_incremental_reloc_index): New function.
4081 (Relobj::reloc_counts_): New data member.
4082 (Relobj::reloc_bases_): New data member.
4083 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
4084 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
4085 (Sized_relobj::incremental_relocs_scan): New function.
4086 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4087 (Sized_relobj::incremental_relocs_write): New function.
4088 (Sized_relobj::incremental_relocs_write_reltype): New function.
4089 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
4091 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
4092 archives and object files elsewhere.
4093 (Add_symbols::run): Report object files here.
4094 (Finish_group::run): Report end of archive at end of group.
4095 * reloc.cc: Include layout.h, incremental.h.
4096 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
4097 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
4098 (Sized_relobj::incremental_relocs_scan): New function.
4099 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4100 (Sized_relobj::do_relocate_sections): Write incremental relocations.
4101 (Sized_relobj::incremental_relocs_write): New function.
4102 (Sized_relobj::incremental_relocs_write_reltype): New function.
4103 * script.cc (read_input_script): Rewrite test for incremental link.
4104 Change call to Incremental_inputs::report_script.
4105 * symtab.h (Symbol_table::first_global_index): New function.
4106 (Symbol_table::output_count): New function.
4108 2010-08-12 Doug Kwan <dougkwan@google.com>
4110 * arm.cc (Target_arm::merge_object_attributes): Check command line
4111 options --no-wchar-size-warning and --no-enum-size-warning.
4112 * options.h (General_options): Add ld-compatible options
4113 --no-enum-size-warning and --no-wchar-size-warning.
4115 2010-08-04 Ian Lance Taylor <iant@google.com>
4117 * x86_64.cc (Target_x86_64::Scan::local): Use
4118 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
4119 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
4120 (Target_x86_64::Scan::global): Likewise.
4121 (Target_x86_64::Relocate::relocate): Likewise.
4122 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
4125 2010-08-03 Cary Coutant <ccoutant@google.com>
4127 * merge.cc (Output_merge_string::do_add_input_section): Count strings
4128 to reserve space in merged_strings vector. Keep total input size
4130 (Output_merge_string::do_print_merge_stats): Print total input size.
4131 * merge.h (Output_merge_string): Add input_size_ field.
4132 * stringpool.cc (Stringpool_template::string_length): Move
4133 implementations out of Stringpool_template class and place in
4135 * stringpool.h (string_length): Move out of Stringpool_template.
4137 2010-08-03 Ian Lance Taylor <iant@google.com>
4140 * layout.cc (relaxation_loop_body): If address of load segment is
4141 set, adjust address to include headers if possible.
4143 2010-08-03 Ian Lance Taylor <iant@google.com>
4145 * version.cc (version_string): Bump to 1.10.
4147 2010-08-03 Ian Lance Taylor <iant@google.com>
4150 * layout.h (enum Output_section_order): Define.
4151 (class Layout): Update declarations.
4152 * layout.cc (Layout::get_output_section): Add order parameter.
4153 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
4154 is_first_non_relro parameters. Change all callers.
4155 (Layout::choose_output_section): Likewise.
4156 (Layout::add_output_section_data): Likewise.
4157 (Layout::make_output_section): Likewise. Set order.
4158 (Layout::default_section_order): New function.
4159 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
4160 * output.cc (Output_section::Output_section): Initialize order_.
4161 Don't initialize deleted fields.
4162 (Output_segment::Output_segment): Don't initialize deleted
4164 (Output_segment::add_output_section_to_load): New function
4165 replacing add_output_section. Change all callers to call this or
4166 add_output_section_to_nonload.
4167 (Output_segment::add_output_section_to_nonload): New function.
4168 (Output_segment::remove_output_section): Rewrite.
4169 (Output_segment::add_initial_output_data): Likewise.
4170 (Output_segment::has_any_data_sections): Likewise.
4171 (Output_segment::is_first_section_relro): Likewise.
4172 (Output_segment::maximum_alignment): Likewise.
4173 (Output_segment::has_dynamic_reloc): New function replacing
4174 dynamic_reloc_count. Change all callers.
4175 (Output_segment::has_dynamic_reloc_list): New function replacing
4176 dynamic_reloc_count_list. Change all callers.
4177 (Output_segment::set_section_addresses): Rewrite.
4178 (Output_segment::set_offset): Rewrite.
4179 (Output_segment::find_first_and_last_list): Remove.
4180 (Output_segment::set_tls_offsets): Rewrite.
4181 (Output_segment::first_section_load_address): Likewise.
4182 (Output_segment::output_section_count): Likewise.
4183 (Output_segment::section_with_lowest_load_address): Likewise.
4184 (Output_segment::write_section_headers): Likewise.
4185 (Output_segment::print_sections_to_map): Likewise.
4186 * output.h (class Output_data): Remove dynamic_reloc_count_
4187 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
4188 (Output_data::add_dynamic_reloc): Rewrite.
4189 (Output_data::has_dynamic_reloc): New function.
4190 (Output_data::dynamic_reloc_count): Remove.
4191 (class Output_section): Add order_ field. Remvoe is_relro_local_,
4192 is_last_relro_, is_first_non_relro_, is_interp_,
4193 is_dynamic_linker_section_ fields. Add order and set_order
4194 functions. Remove is_relro_local, set_is_relro_local,
4195 is_last_relro, set_is_last_relro, is_first_non_relro,
4196 set_is_first_non_relro functions, is_interp, set_is_interp,
4197 is_dynamic_linker_section, and set_is_dynamic_linker_section
4199 (class Output_segment): Change Output_data_list from std::list to
4200 std:;vector. Add output_lists_ field. Remove output_data_ and
4201 output_bss_ fields. Update declarations.
4203 2010-08-02 Ian Lance Taylor <iant@google.com>
4205 * arm.cc (Target_arm::gc_process_relocs): Use typename.
4206 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
4207 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
4209 2010-08-02 Ian Lance Taylor <iant@google.com>
4212 * script.cc (Script_options::Script_options): Initialize
4213 symbol_definitions_ and symbol_references_.
4214 (Script_options::add_symbol_assignment): Update
4215 symbol_definitions_ and symbol_references_.
4216 (Script_options::add_symbol_reference): New function.
4217 (script_symbol): New function.
4218 * script.h (class Script_options): Add symbol_definitions_ and
4219 symbol_references_ fields.
4220 (Script_options::referenced_const_iterator): New type.
4221 (Script_options::referenced_begin): New function.
4222 (Script_options::referenced_end): New function.
4223 (Script_options::is_referenced): New function.
4224 (Script_options::any_unreferenced): New function.
4225 * script-c.h (script_symbol): Declare.
4226 * yyscript.y (exp): Call script_symbol.
4227 * symtab.cc: Include "script.h".
4228 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
4229 Change all callers. Check symbols referenced by scripts.
4230 (Symbol_table::add_undefined_symbols_from_command_line): Add
4231 layout parameter. Change all callers.
4232 (Symbol_table::do_add_undefined_symbols_from_command_line):
4233 Likewise. Break out loop body. Check symbols referenced by
4235 (Symbol_table::add_undefined_symbol_from_command_line): New
4236 function broken out of
4237 do_add_undefined_symbols_from_command_line.
4238 * symtab.h (class Symbol_table): Update declarations.
4239 * archive.cc: Include "layout.h".
4240 (Archive::should_include_member): Add layout parameter. Change
4241 all callers. Check for symbol mentioned in expression.
4242 * archive.h (class Archive): Update declaration.
4243 * object.cc (Sized_relobj::do_should_include_member): Add layout
4245 * object.h (Object::should_include_member): Add layout parameter.
4247 (Object::do_should_include_member): Add layout parameter.
4248 (class Sized_relobj): Update declaration.
4249 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
4251 * dynobj.h (class Sized_dynobj): Update declaration.
4252 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
4254 * plugin.h (class Sized_pluginobj): Update declaration.
4256 2010-08-02 Ian Lance Taylor <iant@google.com>
4259 * output.cc (Output_segment::set_offset): Search for the first and
4260 last sections rather than assuming that the list is in order.
4261 (Output_segment::find_first_and_last_list): New function.
4262 * output.h (class Output_segment): Update declarations.
4263 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4264 (relro_strip_test_SOURCES): New variable.
4265 (relro_strip_test_DEPENDENCIES): New variable.
4266 (relro_strip_test_LDFLAGS): New variable.
4267 (relro_strip_test_LDADD): New variable.
4268 (relro_strip_test.so): New target.
4270 2010-08-02 Ian Lance Taylor <iant@google.com>
4272 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4273 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4274 (Target_i386::got_tlsdesc_section): New function.
4275 (Target_i386::got_section): Create space for GOT entries for
4276 TLSDESC relocations.
4277 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4279 (Target_i386::Scan::global): Likewise.
4280 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
4282 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
4283 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
4284 (Target_x86_64::got_tlsdesc_section): New function.
4285 (Target_x86_64::got_section): Create space for GOT entries for
4286 TLSDESC relocations.
4287 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
4289 (Target_x86_64::Scan::global): Likewise.
4290 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
4293 2010-08-02 Ian Lance Taylor <iant@google.com>
4295 * testsuite/final_layout.sh: Use dc to convert from hex to
4298 2010-07-29 Sriraman Tallam <tmsriram@google.com>
4300 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4301 paramter to the call to gold::gc_process_relocs.
4302 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4303 paramter to the call to gold::gc_process_relocs.
4304 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4305 parameter to the call to gold::gc_process_relocs.
4306 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4307 template parameter to the call to gold::gc_process_relocs.
4308 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4309 paramter to the call to gold::gc_process_relocs.
4310 * gc.h (get_embedded_addend_size): New function.
4311 (gc_process_relocs): Save the size of the reloc for use by ICF.
4312 * icf.cc (get_section_contents): Get the addend from the text section
4313 for SHT_REL relocation sections.
4314 * icf.h (Icf::Reloc_addend_size_info): New typedef.
4315 (Icf::Reloc_info): Add new member reloc_addend_size_info.
4316 * int_encoding.h (read_from_pointer): New overloaded function.
4317 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
4318 * testsuite/icf_sht_rel_addend_test.sh: New file.
4319 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
4320 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
4322 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4324 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
4325 * Makefile.in: Regenerate.
4326 * testsuite/Makefile.in: Regenerate.
4328 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
4330 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
4331 * gold/testsuite/debug_msg.cc: Likewise.
4332 * gold/testsuite/odr_violation1.cc
4333 * gold/testsuite/odr_violation2.cc
4335 2010-07-21 Cary Coutant <ccoutant@google.com>
4337 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
4338 string, and length fields.
4339 (Output_merge_string::Merged_strings_list): New type.
4340 (Output_merge_string::Merged_strings_lists): New typedef.
4341 (Output_merge_string): Replace merged_strings_ with
4342 merged_strings_lists_.
4343 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
4344 Merged_strings_list per input object and section. Don't store pointer
4345 to the string. Don't store length with each merged string entry.
4346 (Output_merge_string::finalize_merged_data): Loop over list of merged
4347 strings lists. Recompute length of each merged string.
4349 2010-07-15 Cary Coutant <ccoutant@google.com>
4351 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
4354 2010-07-14 Ian Lance Taylor <iant@google.com>
4356 * descriptors.cc (Descriptors::open): Report correct name in error
4359 2010-07-13 Doug Kwan <dougkwan@google.com>
4361 * arm.cc (Arm_input_section::Arm_input_section): For a
4362 SHT_ARM_EXIDX section, always keeps the input sections.
4363 (Arm_input_section::set_exidx_section_link): New method.
4364 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
4365 has_errors_ to false.
4366 (Arm_exidx_input_section::has_errors,
4367 Arm_exidx_input_section::set_has_errors): New methods.
4368 (Arm_exidx_input_section::has_errors_): New data member.
4369 (Arm_relobj::get_exidx_shndx_list): New method.
4370 (Arm_output_section::append_text_sections_to_list): Do not skip
4371 section without SHF_EXECINSTR.
4372 (Arm_output_section::fix_exidx_coverage): Skip input sections with
4374 (Arm_relobj::make_exidx_input_section): Add new parameter for text
4375 section header. Make error messages more verbose. Check for
4376 a non-executable section linked to an EXIDX section.
4377 (Arm_relobj::do_read_symbols): Remove error checking, which has been
4378 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
4379 check that there is no deferred EXIDX section if we exit early.
4380 Instead of not making an EXIDX section in case of an error, make one
4381 and set the has_errors flag of it.
4382 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
4383 in a relocatable link.
4384 (Target_arm::do_relax): Look for the EXIDX output section instead of
4385 assuming that it is called .ARM.exidx.
4386 (Target_arm::fix_exidx_coverage): Add a new parameter for input
4387 section list. Do not check for SHF_EXECINSTR section flags but
4388 skip any input section with errors.
4389 * output.cc (Output_section::Output_section): Initialize
4390 always_keeps_input_sections_ to false.
4391 (Output_section::add_input_section): Check for
4392 always_keeps_input_sections_.
4393 * output.h (Output_section::always_keeps_input_sections,
4394 Output_section::set_always_keeps_input_sections): New methods.
4395 (Output_section::always_keeps_input_sections): New data member.
4397 2010-07-13 Rafael Espindola <espindola@google.com>
4399 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
4400 * fileread.h (Input_file): Add try_extra_search_path and find_file.
4402 2010-07-13 Philip Herron <herron.philip@googlemail.com>
4403 Ian Lance Taylor <iant@google.com>
4405 * output.h (Output_section_lookup_maps::add_merge_section):
4406 Correct check of whether value was inserted.
4407 (Output_section_lookup_maps::add_merge_input_section): Likewise.
4408 (Output_section_lookup_maps::add_relaxed_input_section):
4410 * arm.cc (Target_arm::got_section): Remove used local os.
4411 * i386.cc (Target_i386::got_section): Likewise.
4412 * x86_64.cc (Target_x86_64::got_section): Likewise.
4413 * sparc.cc (Target_sparc::got_section): Likewise.
4414 (Target_sparc::relocate): Remove unused local have_got_offset.
4415 * powerpc.cc (Target_powerpc::relocate): Likewise.
4417 2010-07-13 Ian Lance Taylor <iant@google.com>
4419 * compressed_output.cc (zlib_decompress): Fix signature in
4422 * archive.cc (Archive::include_member): Unlock an external member
4423 of a thin archive. Don't bother to delete an object we know is
4426 2010-07-12 Cary Coutant <ccoutant@google.com>
4428 * compressed_output.cc (zlib_decompress): New function.
4429 (get_uncompressed_size): New function.
4430 (decompress_input_section): New function.
4431 * compressed_output.h (get_uncompressed_size): New function.
4432 (decompress_input_section): New function.
4433 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
4434 Handle compressed debug sections.
4435 * layout.cc (is_compressed_debug_section): New function.
4436 (Layout::output_section_name): Map compressed section names to
4438 * layout.h (is_compressed_debug_section): New function.
4439 (is_debug_info_section): Recognize compressed debug sections.
4440 * merge.cc: Include compressed_output.h.
4441 (Output_merge_data::do_add_input_section): Handle compressed
4443 (Output_merge_string::do_add_input_section): Handle compressed
4445 * object.cc: Include compressed_output.h.
4446 (Sized_relobj::Sized_relobj): Initialize new data members.
4447 (build_compressed_section_map): New function.
4448 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
4449 * object.h (Object::section_is_compressed): New method.
4450 (Object::do_section_is_compressed): New method.
4451 (Sized_relobj::Compressed_section_map): New type.
4452 (Sized_relobj::do_section_is_compressed): New method.
4453 (Sized_relobj::compressed_sections_): New data member.
4454 * output.cc (Output_section::add_input_section): Handle compressed
4456 * reloc.cc: Include compressed_output.h.
4457 (Sized_relobj::write_sections): Handle compressed debug sections.
4459 2010-07-08 Cary Coutant <ccoutant@google.com>
4461 * resolve.cc (Symbol_table::resolve): Remember whether undef was
4462 weak when resolving to a dynamic def.
4463 (Symbol_table::should_override): Add adjust_dyndef flag; set it
4464 for weak undef/dynamic def cases. Adjust callers.
4465 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
4466 undef_binding_weak_.
4467 (Symbol_table::sized_write_globals): Adjust symbol binding.
4468 (Symbol_table::sized_write_symbol): Add binding parameter.
4469 * symtab.h (Symbol::set_undef_binding): New method.
4470 (Symbol::is_undef_binding_weak): New method.
4471 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
4472 (Symbol_table::should_override): Add new parameter.
4473 (Symbol_table::sized_write_symbol): Add new parameter.
4475 * testsuite/weak_undef_file1.cc: Add new test case.
4476 * testsuite/weak_undef_file2.cc: Fix header comment.
4477 * testsuite/weak_undef_test.cc: Add new test case.
4479 2010-06-29 Doug Kwan <dougkwan@google.com>
4481 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
4482 Initialize USE_SYMBOL_.
4483 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
4485 (Arm_reloc_property::uses_symbol_): New data member declaration.
4486 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
4487 uses symbol value and symbol is undefined but not weakly undefined.
4489 2010-06-28 Rafael Espindola <espindola@google.com>
4491 * plugin.cc (Plugin::load): Use dlerror.
4493 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
4495 * symtab.cc (detect_odr_violations): When reporting an ODR
4496 violation, report an object where the symbol is defined.
4498 2010-06-25 Doug Kwan <dougkwan@google.com>
4500 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
4501 (Target_arm::section_may_have_icf_unsafe_pointers): New method
4503 (Target_arm::Scan::local_reloc_may_be_function_pointer,
4504 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
4505 target hook to detect function points.
4506 (Target_arm::Scan::possible_function_pointer_reloc): New method.
4507 * icf.h (Icf::check_section_for_function_pointers): Change type of
4508 parameter SECTION_NAME to const reference to std::string. Use
4509 target hook to determine if section may have unsafe pointers.
4510 * target.h (Target::section_may_have_icf_unsafe_pointers): New
4513 2010-06-21 Rafael Espindola <espindola@google.com>
4515 * fileread.cc (Input_file::find_fie): New
4516 (Input_file::open): Use Input_file::find_fie.
4517 * fileread.h (Input_file::find_fie): New
4518 * plugin.cc (set_extra_library_path): New.
4519 (Plugin::load): Add set_extra_library_path to the transfer vector.
4520 (Plugin_manager::set_extra_library_path): New.
4521 (Plugin_manager::add_input_file): Use the extra search path if set.
4522 (set_extra_library_path(): New.
4523 * plugin.h (Plugin_manager): Add set_extra_library_path and
4526 2010-06-19 Cary Coutant <ccoutant@google.com>
4528 * layout.cc (gdb_sections): Add .debug_types.
4529 (lines_only_debug_sections): Likewise.
4531 2010-06-18 Rafael Espindola <espindola@google.com>
4533 * plugin.cc (add_input_file,add_input_library)
4534 (Plugin_manager::add_input_file): Make filename arguments const.
4535 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
4538 2010-06-16 Doug Kwan <dougkwan@google.com>
4540 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
4541 .ARM.attributes section if we have not merged any input
4542 attributes sections.
4544 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4546 * arm.cc: Allow combining objects with no EABI version
4549 2010-06-15 Rafael Espindola <espindola@google.com>
4551 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
4553 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4555 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
4556 (struct iovec): Correct !HAVE_READV definition.
4558 2010-06-10 Cary Coutant <ccoutant@google.com>
4560 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
4561 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
4563 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
4566 * symtab.h (Symbol::is_placeholder): New member function.
4567 * target-reloc.h (relocate_section): Check for placeholder symbols.
4569 * testsuite/Makefile.am (plugin_test_8): New test.
4570 (plugin_test_9): New test.
4571 * testsuite/Makefile.in: Regenerate.
4573 2010-06-09 Nick Clifton <nickc@redhat.com>
4575 * yyscript.y (input_list_element): Allow strings prefixed with
4576 the '-' character. Treat these as libraries.
4577 * script.cc (script_add_library): New function. Adds a library
4578 specified by "-l<name>" found in an input script.
4579 * script-c.h: Add prototype for script_add_library.
4581 2010-06-07 Doug Kwan <dougkwan@google.com>
4583 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
4584 Restrict stub-group size to be within long conditional branch
4585 range when working around cortex-A8 erratum.
4587 2010-06-07 Damien Diederen <dd@crosstwine.com>
4589 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
4592 2010-06-03 Sriraman Tallam <tmsriram@google.com>
4596 (Output_section::Input_section_sort_entry::compare_section_ordering):
4597 Change to return non-zero correctly.
4598 (Output_section::Input_section_sort_section_order_index_compare
4599 ::operator()): Change to fix ambiguity in comparisons.
4601 2010-06-01 Sriraman Tallam <tmsriram@google.com>
4603 * gold.h (is_wildcard_string): New function.
4604 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
4605 (Layout::layout_eh_frame): Ditto.
4606 (Layout::find_section_order_index): New method.
4607 (Layout::read_layout_from_file): New method.
4608 * layout.h (Layout::find_section_order_index): New method.
4609 (Layout::read_layout_from_file): New method.
4610 (Layout::input_section_position_): New private member.
4611 (Layout::input_section_glob_): New private member.
4612 * main.cc (main): Call read_layout_from_file here.
4613 * options.h (--section-ordering-file): New option.
4614 * output.cc (Output_section::input_section_order_specified_): New
4616 (Output_section::Output_section): Initialize new member.
4617 (Output_section::add_input_section): Add new parameter.
4618 Keep input sections when --section-ordering-file is used.
4619 (Output_section::set_final_data_size): Sort input sections when
4620 section ordering file is specified.
4621 (Output_section::Input_section_sort_entry): Add new parameter.
4623 (Output_section::Input_section_sort_entry::compare_section_ordering):
4625 (Output_section::Input_section_sort_compare::operator()): Change to
4626 consider section_order_index.
4627 (Output_section::Input_section_sort_init_fini_compare::operator()):
4628 Change to consider section_order_index.
4629 (Output_section::Input_section_sort_section_order_index_compare
4630 ::operator()): New method.
4631 (Output_section::sort_attached_input_sections): Change to sort
4632 according to section order when specified.
4633 (Output_section::add_input_section<32, true>): Add new parameter.
4634 (Output_section::add_input_section<64, true>): Add new parameter.
4635 (Output_section::add_input_section<32, false>): Add new parameter.
4636 (Output_section::add_input_section<64, false>): Add new parameter.
4637 * output.h (Output_section::add_input_section): Add new parameter.
4638 (Output_section::input_section_order_specified): New
4640 (Output_section::set_input_section_order_specified): New method.
4641 (Input_section::Input_section): Initialize section_order_index_.
4642 (Input_section::section_order_index): New method.
4643 (Input_section::set_section_order_index): New method.
4644 (Input_section::section_order_index_): New member.
4645 (Input_section::Input_section_sort_section_order_index_compare): New
4647 (Output_section::input_section_order_specified_): New member.
4648 * script-sections.cc (is_wildcard_string): Delete and move modified
4650 (Output_section_element_input::Output_section_element_input): Modify
4651 call to is_wildcard_string.
4652 (Output_section_element_input::Input_section_pattern
4653 ::Input_section_pattern): Ditto.
4654 (Output_section_element_input::Output_section_element_input): Ditto.
4655 * testsuite/Makefile.am (final_layout): New test case.
4656 * testsuite/Makefile.in: Regenerate.
4657 * testsuite/final_layout.cc: New file.
4658 * testsuite/final_layout.sh: New file.
4660 2010-06-01 Rafael Espindola <espindola@google.com>
4662 * plugin.cc (Plugin::load): Pass the output name to the plugin.
4664 2010-06-01 Rafael Espindola <espindola@google.com>
4666 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
4667 visibility of symbols.
4669 2010-05-27 Doug Kwan <dougkwan@google.com>
4671 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
4672 from start of output section instead of address for a local symbol
4673 in a merged or relaxed section when doing a relocatable link.
4675 2010-05-26 Rafael Espindola <espindola@google.com>
4678 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
4679 adding sections the garbage collector removed.
4680 * gold/testsuite/Makefile.am: Add test.
4681 * gold/testsuite/Makefile.in: Regenerate.
4682 * gold/testsuite/plugin_test_7.sh: New.
4683 * gold/testsuite/plugin_test_7_1.c: New.
4684 * gold/testsuite/plugin_test_7_2.c: New.
4686 2010-05-26 Rafael Espindola <espindola@google.com>
4688 * script-sections.cc (Output_section_definition::set_section_addresses):
4689 Check for --section-start.
4691 2010-05-26 Doug Kwan <dougkwan@google.com>
4693 * arm.cc (Arm_scan_relocatable_relocs): New class.
4694 (Target_arm::relocate_special_relocatable): New method.
4695 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
4696 (Arm_relocate_functions::thumb_branch_common): Same.
4697 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
4698 instead of Default_scan_relocatable_relocs.
4699 * target-reloc.h (relocate_for_relocatable): Let target handle
4700 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
4701 * target.h (Sized_target::relocate_special_relocatable): New method.
4703 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4705 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
4707 2010-05-23 Doug Kwan <dougkwan@google.com>
4709 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
4711 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
4712 with a direct branch, not a conditional branch, to a stub.
4713 * merge.cc (Output_merge_base::record_input_section): New method
4715 (Output_merge_data::do_add_input_section): Record input section if
4716 keeps-input-sections flag is set.
4717 (Output_merge_string::do_add_input_section): Ditto.
4718 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
4719 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
4721 (Output_merge_base::keeps_input_sections,
4722 Output_merge_base::set_keeps_input_sections,
4723 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
4725 (Output_merge_base::Input_sections): New type declaration.
4726 (Output_merge_base::input_sections_begin,
4727 Output_merge_base::input_sections_end,
4728 Output_merge_base::do_set_keeps_input_sections): New method definitions.
4729 (Output_merge_base::bool keeps_input_sections_,
4730 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
4731 Output_merge_base::input_sections_): New data members.
4732 (Output_merge_data::do_set_keeps_input_sections): New method
4734 (Output_merge_string::do_set_keeps_input_sections): Ditto.
4735 * output.cc (Output_section::Input_section::relobj): Move method
4736 defintion from class declaration to here and handle merge sections.
4737 (Output_section::Input_section::shndx): Ditto.
4738 (Output_section::Output_section): Remove initializations of removed
4739 data members and initialize new data member LOOKUP_MAPS_.
4740 (Output_section::add_input_section): Set keeps-input-sections flag
4741 for a newly created merge output section as appropriate. Adjust code
4742 to use Output_section_lookup_maps class.
4743 (Output_section::add_relaxed_input_section): Adjst code for lookup
4744 maps code refactoring.
4745 (Output_section::add_merge_input_section): Add a new parameter
4746 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
4747 class. If adding input section to a newly created merge output
4748 section fails, remove the new merge section.
4749 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
4750 Adjust code for use of the Output_section_lookup_maps class.
4751 (Output_section::find_merge_section): Ditto.
4752 (Output_section::build_lookup_maps): New method defintion.
4753 (Output_section::find_relaxed_input_section): Adjust code to use
4754 Output_section_lookup_maps class.
4755 (Output_section::get_input_sections): Export merge sections. Adjust
4756 code to use Output_section_lookup_maps class.
4757 (Output_section:::add_script_input_section): Adjust code to use
4758 Output_section_lookup_maps class. Update lookup maps for merge
4760 (Output_section::discard_states): Use Output_section_lookup_maps.
4761 (Output_section::restore_states): Same.
4762 * output.h (Merge_section_properties): Move class defintion out of
4764 (Output_section_lookup_maps): New class.
4765 (Output_section::Input_section::is_merge_section): New method
4767 (Output_section::Input_section::relobj): Move defintion out of class
4768 defintion. Declare method only.
4769 (Output_section::Input_section::shndx): Ditto.
4770 (Output_section::Input_section::output_merge_base): New method defintion.
4771 (Output_section::Input_section::u2_.pomb): New union field.
4772 (Output_section::Merge_section_by_properties_map,
4773 Output_section::Output_section_data_by_input_section_map,
4774 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
4776 (Output_section::add_merge_input_section): Add new parameter
4777 KEEPS_INPUT_SECTIONS.
4778 (Output_section::build_lookup_maps): New method declaration.
4779 (Output_section::merge_section_map_,
4780 Output_section::merge_section_by_properties_map_,
4781 Output_section::relaxed_input_section_map_,
4782 Output_section::is_relaxed_input_section_map_valid_): Remove data
4784 (Output_section::lookup_maps_): New data member.
4786 2010-05-21 Doug Kwan <dougkwan@google.com>
4789 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
4790 avoid a compilation error.
4792 2010-05-19 Rafael Espindola <espindola@google.com>
4794 * script-sections.cc (Output_section_definition::allocate_to_segment):
4795 Update the phdrs_list even when the output section is NULL.
4796 * testsuite/Makefile.am: Add test.
4797 * testsuite/Makefile.in: Regenerate.
4798 * testsuite/script_test_9.cc: New.
4799 * testsuite/script_test_9.sh: New.
4800 * testsuite/script_test_9.t: New.
4802 2010-05-19 Doug Kwan <dougkwan@google.com>
4804 * arm.cc (Arm_input_section::original_size): New method.
4805 (Arm_input_section::do_addralign): Add a cast.
4806 (Arm_input_section::do_output_offset): Remove static cast.
4807 (Arm_input_section::original_addralign,
4808 Arm_input_section::original_size_): Change type to uint32_t.
4809 (Arm_input_section::init): Add safe casts for section alignment
4811 (Arm_input_section::set_final_data_size): Do not set address and
4812 offset of stub table.
4813 (Arm_output_section::fix_exidx_coverage): Change use of of
4814 Output_section::Simple_input_section to that of
4815 Output_section::Input_section.
4816 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
4817 except for the first pass.
4818 * output.cc (Output_section::get_input_sections): Change type of
4819 input_sections to std::list<Input_section>.
4820 (Output_section::add_script_input_section): Rename from
4821 Output_section::add_simple_input_section. Change type of SIS
4822 parameter from Simple_input_section to Input_section.
4823 * output.h (Output_section::Simple_input_section): Remove class.
4824 (Output_section::Input_section): Change class visibility to public.
4825 (Output_section::Input_section::addralign): Use stored alignments
4826 for special input sections if set.
4827 (Output_section::Input_section::set_addralign): New method.
4828 (Output_section::get_input_sections): Change parameter type from
4829 list of Simple_input_section to list of Input_section.
4830 (Output_section::add_script_input_section): Rename from
4831 Output_section::add_simple_input_section. Change first parameter's
4832 type from Simple_input_section to Input_section and remove the
4833 second and third parameters.
4834 * script-sections.cc (Input_section::Input_section_list): Change
4835 type to list of Output_section::Input_section/
4836 (Input_section_info::Input_section_info): Change parameter type of
4837 INPUT_SECTION to Output_section::Input_section.
4838 (Input_section_info::input_section): Change return type.
4839 (Input_section_info::input_section_): Change type to
4840 Output_section::Input_section.
4841 (Output_section_element_input::set_section_addresses): Adjust code
4842 to use Output_section::Input_section instead of
4843 Output_section::Simple_input_section. Adjust code for renaming
4844 of Output_section::add_simple_input_section.
4845 (Orphan_output_section::set_section_addresses): Ditto.
4847 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4849 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
4850 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
4852 2010-05-18 Rafael Espindola <espindola@google.com>
4854 * options.cc (General_options::finalize): Handle -nostdlib.
4855 * options.h (nostdlib): New option.
4856 * script.cc (script_add_search_dir): Handle -nostdlib.
4858 2010-05-12 Doug Kwan <dougkwan@google.com>
4860 * arm.cc (Target_arm::do_finalize_sections): Create an empty
4861 attributes section only if there no attributes section after merging.
4862 (Target_arm::merge_object_attributes): Move value of
4863 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
4864 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
4865 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
4866 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
4867 and arm_attr_merge_7.stdout.
4868 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
4869 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
4870 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
4871 arm_attr_merge_7b.o): New rules.
4872 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
4874 * testsuite/Makefile.in: Regenerate.
4875 * testsuite/arm_attr_merge.sh: New file.
4876 * testsuite/arm_attr_merge_[67][ab].s: Same.
4878 2010-05-05 Nick Clifton <nickc@redhat.com>
4880 * po/es.po: Updated Spanish translation.
4882 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
4884 * Makefile.am (install-exec-local): Properly install gold as
4885 default cross linker.
4886 * Makefile.in: Regenerated.
4888 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
4889 Nick Clifton <nickc@redhat.com>
4891 * configure.ac (install_as_default): Define and set to false
4892 unless --enable-gold or --enable-gold=both/gold has been
4894 * configure: Regenerate.
4896 * Makefile.am (install-exec-local): Install the executable as
4897 'ld.gold'. If install_as_default is true then also install it as
4899 * Makefile.in: Regenerated.
4901 2010-04-24 Ian Lance Taylor <iant@google.com>
4903 * layout.cc (Layout::layout_reloc): In relocatable link don't
4904 combine reloc sections for grouped sections.
4906 2010-04-23 Sriraman Tallam <tmsriram@google.com>
4908 * gc.h (gc_process_relocs): Pass information on relocs pointing to
4909 sections that are not ordinary to icf.
4910 * icf.cc (get_section_contents): Handle relocation pointing to section
4911 with no object or shndx information.
4912 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
4913 * testsuite/Makefile.in: Regenerate.
4914 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
4915 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
4917 2010-04-22 Ian Lance Taylor <iant@google.com>
4919 * expression.cc (Expression::Expression_eval_info): Add
4920 result_alignment_pointer field.
4921 (Expression::eval_with_dot): Add result_alignment_pointer
4922 parameter. Change all callers.
4923 (Expression::eval_maybe_dot): Likewise.
4924 (class Binary_expression): Add alignment_pointer parameter to
4925 left_value and right_value. Change all callers.
4926 (BINARY_EXPRESSION): Set result alignment.
4927 (class Trinary_expression): Add alignment_pointer parameter to
4928 arg2_value and arg3_value. Change all callers.
4929 (Trinary_cond::value): Set result alignment.
4930 (Max_expression::value, Min_expression::value): Likewise.
4931 (Align_expression::value): Likewise.
4932 * script-sections.cc (class Sections_element): Add dot_alignment
4933 parameter to set_section_addresses virtual function. Update
4935 (class Output_section_element): Likewise.
4936 (Script_sections::create_segments): Add dot_alignment parameter.
4938 (Script_sections::create_segments_from_phdrs_clause): Likewise.
4939 (Script_sections::set_phdrs_clause_addresses): Likewise.
4940 * script-sections.h: Update declarations.
4941 * script.h: Update declarations.
4942 * output.h (Output_segment::set_minimum_p_align): Don't decrease
4944 * testsuite/script_test_3.t: Set large alignment.
4945 * testsuite/script_test_3.sh: Make sure that at least one LOAD
4946 segment has expected alignment.
4948 2010-04-22 Nick Clifton <nickc@redhat.com>
4950 * po/gold.pot: Updated by the Translation project.
4951 * po/vi.po: Updated Vietnamese translation.
4953 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
4955 * testsuite/Makefile.am (check_PROGRAMS): Add
4956 icf_virtual_function_folding_test.
4957 * testsuite/Makefile.in: Regenerated.
4959 2010-04-15 Andrew Haley <aph@redhat.com>
4961 * options.h (merge_exidx_entries): New option.
4962 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
4963 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
4964 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
4965 (Target_arm::merge_exidx_entries): New function.
4966 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
4967 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
4968 to Arm_exidx_fixup constructor.
4969 Add new arg, merge_exidx_entries.
4970 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
4971 Arm_output_section::fix_exidx_coverage.
4973 2010-04-18 Sriraman Tallam <tmsriram@google.com>
4975 * icf.cc (get_section_contents): Check for preemptible functions.
4976 Ignore addend when appropriate.
4977 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
4979 (add_from_relobj): Check for section folded.
4980 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
4981 * symtab.h (should_add_dynsym_entry): Add new parameter.
4982 * target-reloc.h (scan_relocs): Check for section folded.
4983 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
4984 Check reloc types for function pointers in shared objects.
4985 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
4987 (icf_preemptible_functions_test): New test case.
4988 (icf_string_merge_test): New test case.
4989 * testsuite.Makefile.in: Regenerate.
4990 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
4991 bar_glob. Refactor code.
4992 * testsuite/icf_preemptible_functions_test.cc: New file.
4993 * testsuite/icf_preemptible_functions_test.sh: New file.
4994 * testsuite/icf_string_merge_test.cc: New file.
4995 * testsuite/icf_string_merge_test.sh: New file.
4996 * testsuite/icf_virtual_function_folding_test.cc: New file.
4997 * testsuite/icf_virtual_function_folding_test.sh: New file.
4999 2010-04-14 Doug Kwan <dougkwan@google.com>
5001 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
5002 for local symbol recounting if we remove a section due to ICF.
5003 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
5004 there are no regular objects in input.
5006 2010-04-13 Doug Kwan <dougkwan@google.com>
5008 * arm.cc (Arm_input_section::set_final_data_size): Compute
5009 accurate final data size instead of using current data size.
5011 2010-04-09 Doug Kwan <dougkwan@google.com>
5013 * layout.cc (Layout::choose_output_section): Handle script section
5015 (Layout::make_output_section_for_script): Add section type parameter.
5016 Handle script section types.
5017 * layout.h (Layout::make_output_section_for_script): Add section
5019 * output.cc (Output_section::Output_section): Initialize data member
5021 (Output_section::do_reset_address_and_file_offset): Do not set address
5022 to 0 if section is a NOLOAD section.
5023 * output.h (Output_section::is_noload): New method.
5024 (Output_section::set_is_noload): Ditto.
5025 (Output_section::is_noload_): New data member.
5026 * script-c.h (Script_section_type): New enum type.
5027 (struct Parser_output_section_header): Add new file section_type.
5028 * script-sections.cc (Sections_element::output_section_name): Add
5029 parameter for returning script section type.
5030 (Output_section_definition::output_section_name): Ditto.
5031 (Output_section_definition::section_type)P; New method.
5032 (Output_section_definiton::script_section_type_name): Ditto.
5033 (Output_section_definition::script_section_type_): New data member.
5034 (Output_section_definition::Output_section_definition): Initialize
5035 data member Output_section_definition::script_section_type_.
5036 (Output_section_definition::create_sections): Pass script section type
5037 to Layout::make_output_section_for_script.
5038 (Output_section_definition::output_section_name): Return script
5039 section type to caller.
5040 (Output_section_definition::set_section_address): Do not advance
5041 dot value and load address if section type is NOLOAD. Set address
5042 of NOLOAD sections regardless of section flags.
5043 (Output_section_definition::print): Print section type if it is
5044 not SCRIPT_SECTION_TYPE_NONE.
5045 (Output_section_definition::section_type): New method.
5046 (Output_section_definition::script_section_type_name): Ditto.
5047 (Script_sections::output_section_name): Add new parameter
5048 PSECTION_TYPE for returning script section type. Pass it to
5049 section elements. Handle discard sections.
5050 (Sort_output_sections::operator()): Handle NOLOAD sections.
5051 * script-sections.h (Script_sections::Section_type): New enum type.
5052 (Script_sections::output_section_name): Add a new parameter for
5053 returning script section type.
5054 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
5056 * yyscript.y (union): Add new field SECTION_TYPE.
5057 (COPY, DSECT, INFO, NOLOAD): New tokens.
5058 (opt_address_and_section_type): Change type to output_section_header.
5059 (section_type): New non-terminal
5060 (section_header): Handle section type.
5061 (opt_address_and_section_type): Return section type value.
5063 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
5065 * testsuite/plugin_common_test_1.c (foo): Add prototype.
5066 * testsuite/plugin_common_test_2.c (foo): Likewise.
5068 2010-04-08 Doug Kwan <dougkwan@google.com>
5070 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
5072 * output.cc (Output_section::add_merge_input_section): Simplify
5073 code and return status of Output_merge_base::add_input_section.
5074 Update merge section map only if Output_merge_base::add_input_section
5077 2010-04-07 Doug Kwan <dougkwan@google.com>
5079 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
5080 if section is marked as containing instructions but has no mapping
5082 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
5083 correct section index.
5084 (Arm_relobj::find_linked_text_section): Ditto.
5086 2010-04-07 Cary Coutant <ccoutant@google.com>
5088 * archive.cc (include_member): Destroy Read_symbols_data object before
5090 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
5091 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
5092 (Read_symbols_data::~Read_symbols_data) New destructor.
5093 (Section_relocs::Section_relocs) New constructor.
5094 (Section_relocs::~Section_relocs) New destructor.
5095 (Read_relocs_data::Read_relocs_data) New constructor.
5096 (Read_relocs_data::~Read_relocs_data) New destructor.
5097 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
5098 pointers to NULL after deleting.
5100 2010-04-07 Doug Kwan <dougkwan@google.com>
5102 * arm.cc: Replace "endianity" with "endianness" in comments.
5103 (Arm_exidx_cantunwind): Ditto.
5104 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
5105 (Arm_relobj::merge_flags_and_attributes): New method.
5106 (Arm_relobj::merge_flags_and_attributes_): New data member.
5107 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
5108 (Arm_relobj::scan_sections_for_stubs): Ditto.
5109 (Arm_relobj::do_read_symbols): Check to see if we really want to
5110 merge processor-specific flags and attributes. Exit early if
5111 an object is empty except for section names and the undefined symbol.
5112 (Target_arm::do_finalize_sections): Move check for ELF format to
5113 Arm_relobj::do_read_symbols. Merge processor specific flags and
5114 attributes from a regular object only when we have determined that
5115 it is aapropriate. Do not create an .ARM.attributes section in
5116 output if there is no regular input object.
5117 (Target_arm::merge_processor_specific_flags): Check
5118 --warn-mismatch before printing any error.
5119 (Target_arm::merge_object_attributes): Ditto.
5120 * gold.cc (queue_middle_tasks): Handle the case in which there is
5121 no regular object in input.
5122 * options.cc (General_options::parse_EB): New method.
5123 (General_options::parse_EL): Same.
5124 (General_options::General_options): Initialize endianness_.
5125 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
5127 (General_options::Endianness): New enum.
5128 (General_options::endianness): New method.
5129 (General_options::endianness_): New data member.
5130 * parameters.cc (Parameters::set_options): Check target endianness.
5131 (Parameters::set_target_once): Ditto.
5132 (Parameters::check_target_endianness): New method.
5133 (parameters_force_valid_target): If either -EL or -EB is specified,
5134 use it to define endianness of default target.
5135 * parameters.h (Parameters::check_target_endianness): New method
5137 * target.h (class Target): Change "endianity" to "endianness"
5140 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5142 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
5143 * configure: Regenerate.
5144 * Makefile.in: Regenerate.
5145 * testsuite/Makefile.in: Regenerate.
5147 2010-04-06 Cary Coutant <ccoutant@google.com>
5150 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
5151 prevailing definitions of common symbols.
5152 * testsuite/plugin_test_6.sh: New test case.
5153 * testsuite/plugin_common_test_1.c: New test case.
5154 * testsuite/plugin_common_test_2.c: New test case.
5155 * testsuite/Makefile.am (plugin_test_6): New test case.
5156 * testsuite/Makefile.in: Regenerate.
5158 2010-04-06 Nick Clifton <nickc@redhat.com>
5160 * po/vi.po: New Vietnamese translation.
5162 2010-03-30 Doug Kwan <dougkwan@google.com>
5164 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
5166 2010-03-25 Doug Kwan <dougkwan@google.com>
5168 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
5169 to avoid a conversion warning on a 32-bit host.
5171 2010-03-24 Ian Lance Taylor <iant@google.com>
5173 * testsuite/script_test_3.t: Add a TLS segment.
5174 * testsuite/Makefile.am (check_PROGRAMS): Add
5175 tls_phdrs_script_test.
5176 (tls_phdrs_script_test_SOURCES): Define.
5177 (tls_phdrs_script_test_DEPENDENCIES): Define.
5178 (tls_phdrs_script_test_LDFLAGS): Define.
5179 (tls_phdrs_script_test_LDADD): Define.
5180 * testsuite/Makefile.in: Rebuild.
5182 2010-03-23 Cary Coutant <ccoutant@google.com>
5184 * fileread.cc (find_or_make_view): Fix comment.
5186 2010-03-23 Ian Lance Taylor <iant@google.com>
5188 * script-sections.cc (class Orphan_section_placement): Define
5189 PLACE_TLS and PLACE_TLS_BSS.
5190 (Orphan_section_placement::Orphan_section_placement): Initialize
5192 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
5193 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
5194 (tls_script_test_SOURCES): Define.
5195 (tls_script_test_DEPENDENCIES): Define.
5196 (tls_script_test_LDFLAGS): Define.
5197 (tls_script_test_LDADD): Define.
5198 * testsuite/Makefile.in: Rebuild.
5200 2010-03-22 Doug Kwan <dougkwan@google.com>
5202 * arm.cc (Arm_relocate_functions::abs8,
5203 Arm_relocate_functions::abs16): Use correct check for overflow
5204 specified in the ARM ELF specs.
5205 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
5206 target of a BLX instruction specially.
5207 (Reloc_stub::stub_type_for_reloc): Ditto.
5208 (Relocate::relocate): Use symbolic names instead of numeric relocation
5209 codes to report error.
5210 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
5212 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
5213 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
5214 thumb2_blx_out_of_range.stdout
5215 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
5216 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
5217 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
5218 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
5219 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
5220 thumb2_blx_in_range, thumb2_blx_in_range.o,
5221 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
5222 thumb2_blx_out_of_range.o): New rules.
5223 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
5224 thumb2_blx_in_range and thumb2_blx_out_of_range.
5225 * testsuite/Makefile.in: Regenerate.
5226 * arm_branch_in_range.sh: Add tests for THUMB BLX.
5227 * testsuite/thumb_blx_in_range.s: New file.
5228 * testsuite/thumb_blx_out_of_range.s: New file.
5230 2010-03-22 Rafael Espindola <espindola@google.com>
5232 * archive.cc (Should_include): Move to archive.h.
5233 (should_include_member): Make it a member of Archive.
5235 (Add_lib_group_symbols): New.
5236 * archive.h: Include options.h.
5237 (Archive_member): Moved from Archive.
5238 (Should_include): Moved from archive.cc.
5240 (Add_lib_group_symbols): New.
5241 * dynobj.cc (do_should_include_member): New.
5242 * dynobj.h (do_should_include_member): New.
5243 * gold.cc (queue_initial_tasks): Update call to queue.
5244 * main.cc (main): Print lib group stats.
5245 * object.cc (do_should_include_member): New.
5246 * object.h: Include archive.h.
5247 (Object::should_include_member): New.
5248 (Object::do_should_include_member): New.
5249 (Sized_relobj::do_should_include_member): New.
5250 * options.cc (General_options::parse_start_lib): New.
5251 (General_options::parse_end_lib): New.
5252 (Input_arguments::add_file): Handle lib groups.
5253 (Input_arguments::start_group): Check we are not in a lib.
5254 (Input_arguments::start_lib): New.
5255 (Input_arguments::end_lib): New.
5256 * options.h (General_options): Add start_lib and end_lib.
5257 (Input_argument::lib_): New.
5258 (Input_argument::lib): New.
5259 (Input_argument::is_lib): New.
5260 (Input_file_lib): New.
5261 (Input_arguments::in_lib_): New.
5262 (Input_arguments::in_lib): New.
5263 (Input_arguments::start_lib): New.
5264 (Input_arguments::end_lib_): New.
5265 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5266 in unused members as preempted.
5267 (Sized_pluginobj::do_should_include_member): New.
5268 * plugin.h (Sized_pluginobj::do_should_include_member): New.
5269 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5271 (Read_symbols::do_whole_lib_group): New.
5272 (Read_symbols::do_lib_group): New.
5273 (Read_symbols::do_read_symbols): Handle lib groups.
5274 (Read_symbols::get_name): Handle lib groups.
5275 * readsyms.h (Read_symbols): Add an archive member pointer.
5276 (Read_symbols::do_whole_lib_group): New.
5277 (Read_symbols::do_lib_group): New.
5278 (Read_symbols::member_): New.
5279 * script.cc (read_input_script): Update call to queue_soon.
5281 2010-03-19 Doug Kwan <dougkwan@google.com>
5283 * arm.cc (Stub_table::Stub_table): Initialize new data members
5284 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5285 (Stub_table::add_reloc_stub): Assign stub offset and update
5286 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5287 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
5289 (Stub_table::update_data_size_and_addralign): Use
5290 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
5291 instead of going over all reloc stubs.
5292 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
5293 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5294 Stringpool_template::offset_ to size of Stringpool_char.
5295 (Stringpool_template::new_key_offset): Remove code to initialize
5296 Stringpool_template::offset_.
5297 * stringpool.h (Stringpool_template::set_no_zero_null): Set
5298 Stringpool_template::offset_ to zero.
5300 2010-03-15 Doug Kwan <dougkwan@google.com>
5302 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5304 (Stringpool_template::new_key_offset): New method.
5305 (Stringpool_template::add_string): Assign offsets when adding new
5307 (Stringpool_template::set_string_offsets): Do not set string offsets
5308 when not optimizing.
5309 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5311 (Chunked_vector::clear): Clear size_.
5312 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5313 (Chunked_vector::size): Return size_.
5314 (Chunked_vector::push_back): Use size_ to find insert position.
5315 (Chunked_vector::size_): New data member.
5316 (Stringpool_template::set_no_zero_null): Assert string set is empty.
5317 (Stringpool_template::new_key_offset): New method declaration.
5318 (Stringpool_template::offset_): New data member.
5320 2010-03-15 Rafael Espindola <espindola@google.com>
5322 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
5323 Add_symbols' constructor.
5324 * readsyms.h (Add_symbols): Remove the input_group member.
5326 2010-03-10 Ian Lance Taylor <iant@google.com>
5328 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
5329 target to ask whether a reference to a symbol requires a stack
5331 * target.h (Target::is_call_to_non_split): New function.
5332 (Target::do_is_call_to_non_split): Declare virtual function.
5333 * target.cc: Include "symtab.h".
5334 (Target::do_is_call_to_non_split): New function.
5335 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
5337 2010-03-10 Cary Coutant <ccoutant@google.com>
5339 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
5340 (File_read::open[1]): Remove initial mapping of whole_file_view_.
5341 (File_read::open[2]): Add whole_file_view_ to list of views.
5342 (File_read::make_view): Remove test of whole_file_view_.
5343 (File_read::find_or_make_view): Create whole_file_view_ if
5345 (File_read::clear_views): Replace bool parameter with enum;
5346 adjust all callers. Don't delete views with permanent data;
5347 do delete cached views and views from archives if
5348 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
5349 if clearing the corresponding view.
5350 * fileread.h (File_read::Clear_views_mode): New enum.
5351 (File_read::View::is_permanent_view): New method.
5352 (File_read::clear_views): Replace bool parameter
5353 with enum; adjust all callers.
5354 * options.h (General_options): Change keep_files_mapped option;
5355 add map_whole_files.
5356 * readsyms.cc (Add_symbols::run): Delete sd_ object before
5358 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
5361 2010-03-10 David S. Miller <davem@davemloft.net>
5363 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
5365 2010-03-09 Sriraman Tallam <tmsriram@google.com>
5367 * icf.cc (get_section_contents): Add '@' marker after processing the
5370 2010-03-08 Doug Kwan <dougkwan@google.com>
5372 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
5373 due to a conversion warning.
5374 (Arm_relobj::update_output_local_symbol_count): Check for local
5375 symbol with unset output index.
5377 2010-03-05 Ian Lance Taylor <iant@google.com>
5379 * options.h (class General_options): Add --spare-dynamic-tags.
5380 * output.cc (Output_data_dynamic::set_final_data_size): Implement
5381 --spare-dynamic-tags.
5383 2010-03-05 Ian Lance Taylor <iant@google.com>
5385 * incremental.cc: Include "libiberty.h".
5387 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
5389 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
5390 function, is_info_ member.
5391 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
5392 (Versions::Versions): Update caller.
5393 (Versions::define_base_version): Likewise.
5394 (Versions::add_def): Likewise.
5396 2010-03-03 Sriraman Tallam <tmsriram@google.com>
5398 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
5399 (Scan::possible_function_pointer_reloc): New function.
5400 (Scan::local_reloc_may_be_function_pointer): Change to call
5401 possible_function_pointer_reloc.
5402 (Scan::global_reloc_may_be_function_pointer): Ditto.
5403 * icf.h (Icf::check_section_for_function_pointers): Change to reject
5404 relocations in ".data.rel.ro._ZTV" section.
5405 * testsuite/icf_safe_so_test.sh: Change to pass i386.
5406 * testsuite/icf_safe_so_test.cc: Ditto.
5407 * testsuite/icf_safe_test.cc: Ditto.
5408 * testsuite/icf_safe_test.sh: Ditto.
5410 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5411 Ian Lance Taylor <iant@google.com>
5413 * target-reloc.h (relocate_section): Check the symbol table index
5414 for -1U before setting the local symbol index.
5415 (scan_relocatable_relocs): If copying the relocation, record that
5416 the local symbol is required.
5417 * object.h (Symbol_value::is_output_symtab_index_set): New
5419 (Symbol_value::may_be_discarded_from_output_symtab): New
5421 (Symbol_value::has_output_symtab_entry): New function.
5422 (Symbol_value::needs_output_symtab_entry): Remove.
5423 (Symbol_value::output_symtab_index): Make sure the symbol index is
5425 (Symbol_value::set_output_symtab_index): Make sure the symbol
5426 index is not set. Make sure the new index is valid.
5427 (Symbol_value::set_must_have_output_symtab_entry): New function.
5428 (Symbol_value::has_output_dynsym_entry): New function.
5429 (Symbol_value::set_output_dynsym_index): Make sure the new index
5431 (Sized_relobj::set_must_have_output_symtab_entry): New function.
5432 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
5433 local symbol if permitted.
5434 (Sized_relobj::do_finalize_local_symbols): Call
5435 is_output_symtab_index_set rather than needs_output_symtab_entry.
5436 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
5437 rather than needs_output_symtab_entry. Call
5438 has_output_dynsym_entry rather than needs_output_dynsym_entry.
5439 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
5440 is_output_symtab_index_set rather than needs_output_symtab_entry.
5441 * testsuite/discard_locals_relocatable_test.c: New file.
5442 * testsuite/discard_locals_test.sh: Test -r.
5443 * testsuite/Makefile.am (check_DATA): Add
5444 discard_locals_relocatable_test1.syms,
5445 discard_local_relocatable_test2.syms.
5446 (MOSTLYCLEANFILES): Likewise. Also add
5447 discard_locals_relocatable_test1.lout and
5448 discard_locals_relocatable_test2.out.
5449 (discard_locals_relocatable_test1.syms): New target.
5450 (discard_locals_relocatable_test.o): New target.
5451 (discard_locals_relocatable_test1.out): New target.
5452 (discard_locals_relocatable_test2.syms): New target.
5453 (discard_locals_relocatable_test2.out): New target.
5454 (various): Add missing ../ld-new dependencies.
5455 * testsuite/Makefile.in: Rebuild.
5457 2010-03-03 Nick Clifton <nickc@redhat.com>
5459 * po/fi.po: New Finnish translation.
5461 2010-03-01 Doug Kwan <dougkwan@google.com>
5463 * layout.cc (Layout::Layout): Force section types of .init_array*,
5464 .preinit_array* and .fini_array* sections.
5465 * output.cc (Output_section::Input_section_sort_entry::has_priority):
5466 Fix check of return value of std::string::find.().
5467 (Output_section::Input_section_sort_compare::operator()): Remove
5468 comment about .init_array.
5469 (Output_section::Input_section_sort_init_fini_compare::operator()):
5471 (Output_section::sort_attached_input_sections): Handle .init_array
5472 and .fini_array specially.
5473 * output.h (Output_section::Inut_section_sort_compare): Update
5475 (Output_section::Input_section_sort_init_fini_compare): New struct.
5477 2010-02-26 Doug Kwan <dougkwan@google.com>
5479 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
5480 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
5481 * testsuite/debug_msg.sh: Avoid matching source line number for
5482 use of global variable undef_int.
5484 2010-02-26 Doug Kwan <dougkwan@google.com>
5486 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
5487 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
5488 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
5489 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
5490 * options.cc (General_options::General_options): Initialize member
5492 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
5493 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
5494 and rm_no_fix_v4bx.stdout
5495 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
5496 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
5497 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
5498 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
5499 and arm_no_fix_v4bx.
5500 * Makefile.in: Regenerate.
5501 * testsuite/arm_fix_v4bx.s: New file.
5502 * testsuite/arm_fix_v4bx.sh: Ditto.
5504 2010-02-24 Doug Kwan <dougkwan@google.com>
5506 * arm.cc (Target_arm::got_section): Make the .got section the first
5507 non RELRO section in the data segment.
5508 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
5509 suffixes of section names.
5511 2010-02-24 Doug Kwan <dougkwan@google.com>
5513 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
5514 flags and attributes merging if an input file is a binary file.
5515 * fileread.cc (Input_file::open): Record format of original file.
5516 * fileread.h (Input_file::Format): New enum type.
5517 (Input_file::Input_file): Initialize data member format_.
5518 (Input_file::format): New method definition.
5519 (Input_file::format_):: New data member.
5521 2010-02-24 Doug Kwan <dougkwan@google.com>
5523 * arm.cc (Arm_output_data_got): New class.
5524 (ARM_TCB_SIZE): New constant
5525 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
5526 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
5527 If user uses a script with a SECTIONS clause, issue only a warning
5528 for a misplaced EXIDX input section. Otherwise, issue an error.
5529 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
5531 (Target_arm::got_mode_index_entry): Handle static linking.
5532 (Target_arm::Scan::local): Ditto.
5533 (Target_arm::Scan::global): Ditto.
5534 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
5535 all incorrectly implemented relocations.
5536 (Target_arm::fix_exidx_coverage): Pass layout to
5537 Arm_output_section::fix_exidx_coverage.
5538 * layout.cc (Layout::section_name_mapping): Remove trailing dots
5539 from ".ARM.exidx." and ".ARM.extab.".
5541 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5543 * arm.cc (Target_arm::do_finalize_sections): Create attribute
5544 section if it does not already exist.
5545 * attributes.cc (Attributes_section_data::Attributes_section_data):
5546 Don't crash if size is zero.
5548 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5549 Ian Lance Taylor <iant@google.com>
5551 * gold.cc (queue_middle_tasks): If no input files were opened,
5553 * workqueue.h (Task_function::Task_function): Assert that there is
5556 2010-02-22 Doug Kwan <dougkwan@google.com>
5558 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
5559 * icf.cc (get_section_contents): Cast snprintf arguments to long long
5560 types to avoid warnings due to different uint64_t implementations
5563 2010-02-21 Doug Kwan <dougkwan@google.com>
5565 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
5566 handling of the maximum backward branch offset.
5567 (Arm_relocate_functions::thumb_branch_common): Ditto.
5568 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
5569 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
5570 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
5571 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
5572 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
5573 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
5574 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
5575 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
5576 thumb_bl_out_of_range thumb_bl_out_of_range.o,
5577 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
5578 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
5579 thumb2_bl_out_of_range.o): New rules.
5580 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
5581 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
5582 thumb2_bl_out_of_range
5583 * testsuite/Makefile.in: Regenerate.
5584 * testsuite/arm_bl_in_range.s: New file.
5585 * testsuite/arm_bl_out_of_range.s: Ditto.
5586 * testsuite/arm_branch_in_range.sh: Ditto.
5587 * testsuite/arm_branch_range.t: Ditto.
5588 * testsuite/thumb2_branch_range.t: Ditto.
5589 * testsuite/thumb_bl_in_range.s: Ditto.
5590 * testsuite/thumb_bl_out_of_range.s: Ditto.
5591 * testsuite/thumb_branch_range.t: Ditto.
5593 2010-02-20 Sriraman Tallam <tmsriram@google.com>
5595 * gc.h (gc_process_relocs): Change vectors to point to the new list.
5596 Add reloc offset information.
5597 * icf.cc (get_section_contents): Change iterators to point to the new
5598 vectors. Add reloc offset information to the contents.
5599 * icf.h (Icf::Sections_reachable_info): New typedef.
5600 (Icf::Sections_reachable_list): New typedef.
5601 (Icf::Offset_info): New typedef.
5602 (Icf::Reloc_info): New struct typedef.
5603 (Icf::Reloc_info_list): New typedef.
5604 (Icf::symbol_reloc_list): Delete method.
5605 (Icf::addend_reloc_list): Delete method.
5606 (Icf::section_reloc_list): Delete method.
5607 (Icf::reloc_info_list): New method.
5608 (Icf::reloc_info_list_): New member.
5610 2010-02-19 Doug Kwan <dougkwan@google.com>
5612 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
5613 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
5614 * arm.cc (Arm_relocation_functions): New forward declaration.
5615 (Target_arm::Target_arm): Initialize new data members
5616 got_mod_index_offset_ and tls_base_symbol_defined_.
5617 (Target_arm::Relocate::relocate_tls): New method.
5618 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
5619 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
5621 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
5622 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
5623 (Target_arm::got_mod_index_offset_,
5624 Target_arm::tls_base_symbol_defined_): New data members.
5625 (Target_arm::Scan::local, Target::Scan::global,
5626 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
5629 2010-02-18 Doug Kwan <dougkwan@google.com>
5631 * arm.cc (Arm_relobj::find_linked_text_section): New method.
5632 (Arm_relobj::make_exidx_input_section): Pass section index of linked
5633 text section as a parameter becuase some broken tools may not set
5634 the link in section header.
5635 (Target_arm::has_got_section): New method.
5636 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
5637 without any mapping symbol as data only. Remove warning.
5638 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
5639 link in its section header, try to discover the link by inspecting the
5640 REL31 relocation at the beginning of the section.
5641 (Target_arm::Scan::check_non_pic): Report name of offending relocation
5643 (Target_arm::Scan::global): Treat any reference to the symbol
5644 _GLOBAL_OFFSET_TABLE_ as a GOT access.
5646 2010-02-12 Sriraman Tallam <tmsriram@google.com>
5648 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
5649 (Scan::global_reloc_may_be_function_pointer): New function.
5650 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5651 (Scan::global_reloc_may_be_function_pointer): New function.
5652 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5653 (Scan::global_reloc_may_be_function_pointer): New function.
5654 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
5655 (Scan::global_reloc_may_be_function_pointer): New function.
5656 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
5657 (Scan::global_reloc_may_be_function_pointer): New function.
5658 (Scan::possible_function_pointer_reloc): New function.
5659 (Target_x86_64::can_check_for_function_pointers): New function.
5660 * gc.h (gc_process_relocs): Scan relocation types to determine if
5661 function pointers were taken for targets that support it.
5662 * icf.cc (Icf::find_identical_sections): Include functions for
5663 folding in safe ICF whose pointer is not taken.
5664 * icf.h (Secn_fptr_taken_set): New typedef.
5665 (fptr_section_id_): New member.
5666 (section_has_function_pointers): New function.
5667 (set_section_has_function_pointers): New function.
5668 (check_section_for_function_pointers): New function.
5669 * options.h: Fix comment for safe ICF option.
5670 * target.h (can_check_for_function_pointers): New function.
5671 * testsuite/Makefile.am: Add icf_safe_so_test test case.
5672 Modify icf_safe_test for X86-64.
5673 * testsuite/Makefile.in: Regenerate.
5674 * testsuite/icf_safe_so_test.cc: New file.
5675 * testsuite/icf_safe_so_test.sh: New file.
5676 * testsuite/icf_safe_test.cc (kept_func_3): New function.
5677 (main): Change to take pointer to function kept_func_3.
5678 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
5679 folding is done correctly for X86-64.
5681 2010-02-12 David S. Miller <davem@davemloft.net>
5683 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
5684 is_symbolless parameter.
5685 (Output_reloc<SHT_REL>::is_symbolless): New.
5686 (Output_reloc<SHT_REL>::is_symbolless_): New.
5687 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
5688 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
5689 (Output_reloc<SHT_RELA>::is_symbolless): New.
5690 (Output_data_reloc::add_global): Handle is_symbolless.
5691 (Output_data_reloc::add_global_relative): Likewise.
5692 (Output_data_reloc::add_local): Likewise.
5693 (Output_data_reloc::add_local_relative): Likewise.
5694 (Output_data_reloc::add_symbolless_global_addend): New.
5695 (Output_data_reloc::add_symbolless_local_addend): New.
5696 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
5698 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
5699 instead of ->is_relative_
5700 (Output_reloc::write): Likewise.
5701 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
5702 (Output_reloc::write_rel): Simplify.
5704 * sparc.cc (Target_sparc::Scan::local): Use
5705 ->add_symbolless_local_addend as needed.
5706 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
5707 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
5708 based upon relocation offset.
5710 2010-02-11 Doug Kwan <dougkwan@google.com>
5712 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
5713 (Target_arm::Scan::global): Ditto. Also remove a comment before the
5714 beginning of function.
5715 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
5716 and MOVT_ABS relocations. Those are non issued in scanning. Fix
5717 parameter is_32bit in calls to should_apply_static_reloc.
5718 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
5719 (check_DATA): Add arm_abs_global.stdout.
5720 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
5721 arm_abs_global.stdout): New rules.
5722 (MOSTLLYCLEANFILES): Add arm_abs_global
5723 * Makefile.in: Regenerate.
5724 * testsuite/arm_abs_global.s: New file.
5725 * testsuite/arm_abs_global.sh: Ditto.
5726 * testsuite/arm_abs_lib.s: Ditto.
5728 2010-02-11 Ian Lance Taylor <iant@google.com>
5730 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
5732 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
5733 Allocate_commons_task first.
5734 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
5735 task, rather than symtab_lock_.
5736 (Gc_process_relocs::~Gc_process_relocs): New function.
5737 (Gc_process_relocs::is_runnable): Check this_blocker_.
5738 (Gc_process_relocs::locks): Use next_blocker_ rather than
5740 (Scan_relocs::~Scan_relocs): New function.
5741 (Scan_relocs::is_runnable): Check this_blocker_ rather than
5743 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
5745 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
5746 fields. Add this_blocker_ and next_blocker_ fields. Adjust
5747 constructor accordingly.
5748 (class Gc_process_relocs): Likewise.
5749 (class Scan_relocs): Likewise.
5750 * common.h (class Allocate_commons_task): Remove symtab_lock_
5751 field, and corresponding constructor parameter.
5752 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
5754 (Allocate_commons_task::locks): Likewise.
5756 2010-02-11 Ian Lance Taylor <iant@google.com>
5758 * gold-threads.h (class Once): Define.
5759 (class Initialize_lock): Rewrite as child of Once.
5760 * gold-threads.cc (class Once_initialize): Define.
5761 (once_pointer_control): New static variable.
5762 (once_pointer, once_arg): New static variables.
5763 (c_run_once): New static function.
5764 (Once::Once, Once::run_once, Once::internal_run): New functions.
5765 (class Initialize_lock_once): Remove.
5766 (initialize_lock_control): Remove.
5767 (initialize_lock_pointer): Remove.
5768 (initialize_lock_once): Remove.
5769 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
5770 (Initialize_lock::initialize): Rewrite.
5771 (Initialize_lock::do_run_once): New function.
5772 * archive.cc (Archive::interpret_header): Only clear name if it is
5774 * fileread.cc: Include "gold-threads.h"
5775 (file_counts_lock): New static variable.
5776 (file_counts_initialize_lock): Likewise.
5777 (File_read::release): Only increment counts when using --stats.
5778 Use a lock around the increment.
5779 * parameters.cc (class Set_parameters_target_once): Define.
5780 (set_parameters_target_once): New static variable.
5781 (Parameters::Parameters): Move here from parameters.h.
5782 (Parameters::set_target): Rewrite.
5783 (Parameters::set_target_once): New function.
5784 (Parameters::clear_target): Move here and rewrite.
5785 * parameters.h (class Parameters): Update declarations. Add
5786 set_parameters_target_once_ field.
5787 (Parameters::Parameters): Move to parameters.cc.
5788 (Parameters::clear_target): Likewise.
5789 * readsyms.cc (Read_symbols::do_group): Create a Start_group
5791 (Start_group::~Start_group): New function.
5792 (Start_group::is_runnable): New function.
5793 (Start_group::locks, Start_group::run): New functions.
5794 (Finish_group::run): Change saw_undefined to size_t.
5795 * readsyms.h (class Start_group): Define.
5796 (class Finish_group): Change saw_undefined_ field to size_t.
5797 (Finish_group::Finish_group): Remove saw_undefined and
5798 this_blocker parameters. Change all callers.
5799 (Finish_group::set_saw_undefined): New function.
5800 (Finish_group::set_blocker): New function.
5801 * symtab.h (class Symbol_table): Change saw_undefined to return
5802 size_t. Change saw_undefined_ field to size_t.
5803 * target-select.cc (Set_target_once::do_run_once): New function.
5804 (Target_selector::Target_selector): Initialize set_target_once_
5805 field. Don't initialize lock_ and initialize_lock_ fields.
5806 (Target_selector::instantiate_target): Rewrite.
5807 (Target_selector::set_target): New function.
5808 * target-select.h (class Set_target_once): Define.
5809 (class Target_selector): Update declarations. Make
5810 Set_target_once a friend. Remove lock_ and initialize_lock_
5811 fields. Add set_target_once_ field.
5813 2010-02-10 Ian Lance Taylor <iant@google.com>
5815 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
5817 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
5818 (queue_middle_tasks): Add all blockers before queueing any tasks.
5819 (queue_final_tasks): Likewise.
5820 * token.h (Task_token::add_blockers): New function.
5821 * object.h (Input_objects::number_of_relobjs): New function.
5823 2010-02-10 Ian Lance Taylor <iant@google.com>
5825 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
5826 shared, not if not position independent.
5827 * x86_64.cc (Relocate::relocate_tls): Likewise.
5828 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
5829 (tls_pie_pic_test): New target.
5830 * testsuite/Makefile.in: Rebuild.
5832 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
5833 (tls_test_main_pie.o, tls_test_pie.o): New targets.
5834 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
5835 * testsuite/Makefile.in: Rebuild.
5837 2010-02-09 David S. Miller <davem@davemloft.net>
5839 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
5840 R_SPARC_RELATIVE using ->add_local_relative().
5841 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
5843 * output.h (Output_data_dynamic::add_section_size): New method
5844 that takes two Output_data objects.
5845 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
5846 entry param. Handle it in initializers.
5847 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
5848 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
5849 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
5851 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
5852 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
5853 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
5854 for dynrel_includes_plt.
5855 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5856 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5857 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
5859 (Target_sparc::do_finalize_sections): Update to pass true for
5860 dynrel_includes_plt.
5861 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
5862 output before .rela.plt
5863 (Target_powerpc::do_finalize_sections): Update to pass true for
5864 dynrel_includes_plt when 32-bit.
5866 2010-02-08 Doug Kwan <dougkwan@google.com>
5868 * arm.cc (Arm_relobj::simple_input_section_output_address): New
5870 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
5871 Arm_relobj::scan_section_for_cortex_a8_stubs,
5872 Arm_relobj::do_relocation_section): Instead of calling
5873 Output_section::output_address, use faster
5874 Arm_relobj::simple_input_section_output_address.
5876 2010-02-08 David S. Miller <davem@davemloft.net>
5878 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
5879 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
5880 relocation helper function.
5882 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
5883 just like R_SPARC_GOT{10,13,22}.
5884 (Target_sparc::Scan::local): Likewise.
5885 (Target_sparc::Relocate:relocate): Likewise.
5887 2010-02-06 Ian Lance Taylor <iant@google.com>
5889 * configure.ac: Rewrite targetobjs duplicate removal code to use
5890 only shell constructs.
5891 * configure: Rebuild.
5893 2010-02-05 Doug Kwan <dougkwan@google.com>
5896 * arm.cc (Arm_relobj::section_is_scannable): New method.
5897 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
5898 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
5900 2010-02-04 Doug Kwan <dougkwan@google.com>
5903 * arm-reloc-property.cc (cstdio): Include.
5904 * configure.ac (targetobjs): Remove duplicates.
5905 * configure: Regenerate.
5906 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
5907 big and little endian version for a given address size.
5909 2010-02-03 Doug Kwan <dougkwan@google.com>
5911 * arm-reloc-property.cc
5912 (Arm_reloc_property_table::reloc_name_in_error_message): New method
5914 * arm-reloc-property.h
5915 (Arm_reloc_property_table::get_implemented_static_reloc_property):
5916 New method definition.
5917 (Arm_reloc_property_table::reloc_name_in_error_message): New method
5919 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
5921 (GOT_PREL): Change implemented to Y.
5922 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
5923 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
5924 (Arm_relocate_functions::movw_abs_nc): Remove method.
5925 (Arm_relocate_functions::movt_abs): Ditto.
5926 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
5927 (Arm_relocate_functions::thm_movt_abs): Ditto.
5928 (Arm_relocate_functions::movw_rel_nc): Ditto.
5929 (Arm_relocate_functions::movw_rel): Ditto.
5930 (Arm_relocate_functions::movt_rel): Ditto.
5931 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
5932 (Arm_relocate_functions:thm_movw_rel): Ditto.
5933 (Arm_relocate_functions:thm_movt_rel): Ditto.
5934 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
5935 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
5936 New method definitions.
5937 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
5938 (Arm_relocation_functions::arm_grp_ldr): Ditto.
5939 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
5940 (Arm_relocation_functions::arm_grp_ldc): Ditto.
5941 (Target_arm::Relocate::relocate): Check for non-static or
5942 unimplemented relocation code and exit early. Change calls to
5943 Target_arm::reloc_uses_thumb_bit and
5944 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
5945 instead. Refactor code to handle similar relocations to increase
5946 code sharing. Remove check for unsupported relocation code in switch
5948 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
5949 relocation property table to find out size. Change error message to
5950 print out the name of a relocation code instead of the numeric value.
5951 (Target_arm::scan_reloc_for_stub): Use relocation property table
5952 instead of calling Target_arm::reloc_uses_thumb_bit().
5954 2010-02-02 Doug Kwan <dougkwan@google.com>
5956 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
5957 types of relaxed input section.
5959 2010-02-02 Doug Kwan <dougkwan@google.com>
5961 * Makefile.am (HFILES): Add arm-reloc-property.h.
5963 (TARGETSOURCES): Add arm-reloc-property.cc
5964 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
5965 (libgold_a_SOURCES): $(DEFFILES)
5966 * Makefile.in: Regenerate.
5967 * arm-reloc-property.cc: New file.
5968 * arm-reloc-property.h: New file.
5969 * arm-reloc.def: New file.
5970 * arm.cc: Update comments.
5971 (arm-reloc-property.h): New included header.
5972 (arm_reloc_property_table): New global variable.
5973 (Target_arm::do_select_as_default_target): New method definition.
5974 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
5975 arm-reloc-property to targ_extra_obj.
5976 * parameters.cc (set_parameters_target): Call
5977 Target::select_as_default_target().
5978 * target.h (Target::select_as_default_target): New method definition.
5979 (Target::do_select_as_default_target): Same.
5981 2010-02-01 Doug Kwan <dougkwan@google.com>
5983 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
5984 first_output_text_section_.
5985 (Arm_exidx_fixup::first_output_text_section): New method definition.
5986 (Arm_exidx_fixup::first_output_text_section_): New data member.
5987 (Arm_exidx_fixup::process_exidx_section): Record the first text
5988 output section seen.
5989 (Arm_output_section::fix_exidx_coverage): Set correct linked section
5990 and entsize in output section header.
5992 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5994 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
5995 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
5996 (Arm_relocate_functions::thm_alu11): New Method.
5997 (Arm_relocate_functions::thm_pc8): New Method.
5998 (Arm_relocate_functions::thm_pc12): New Method.
5999 (Target_arm::Scan::local): Handle the relocations.
6000 (Target_arm::Scan::global): Likewise.
6001 (Target_arm::Relocate::relocate): Likewise.
6002 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6004 2010-01-29 Doug Kwan <dougkwan@google.com>
6006 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
6007 of relocation types as ld.
6009 2010-01-29 Doug Kwan <dougkwan@google.com>
6011 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
6013 (Arm_relocate_functions::thumb_branch_common): Ditto.
6014 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
6015 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
6016 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
6017 Arm_relocate_functions::jump24): Remove.
6018 (Target_arm::Relocate::relocate): Adjust code to call
6019 Arm_relocation_functions::arm_branch_common and
6020 Arm_relocation_functions::thumb_branch_common instead of their removed
6021 wrappers. Merge switch-cases together to reduce source code size.
6023 2010-01-29 Doug Kwan <dougkwan@google.com>
6025 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
6026 output_local_symbol_count_needs_update_.
6027 (Arm_relobj::output_local_symbol_count_needs_update,
6028 Arm_relobj::set_output_local_symbol_count_needs_update,
6029 Arm_relobj::update_output_local_symbol_count): New methods.
6030 (Arm_relobj::output_local_symbol_count_needs_update_): New data
6032 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
6033 of pointed function as in a R_ARM_PREL31 relocation.
6034 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
6035 for output local symbol count updating.
6036 (Target_arm::do_relax): Update output local symbol counts in objects
6038 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
6040 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6042 * arm.cc: Added support for the ARM relocations:
6043 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
6044 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
6045 (Arm_relocate_functions::movw_rel_nc): Renamed (was
6047 (Arm_relocate_functions::movw_rel): New method.
6048 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
6049 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
6051 (Arm_relocate_functions::thm_movw_rel): New method.
6052 (Arm_relocate_functions::thm_movt_rel): Renamed (was
6054 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
6056 (Target_arm::Scan::global): Likewise.
6057 (Target_arm::Relocate::relocate): Likewise.
6058 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6061 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6063 * arm.cc: Added support for ARM group relocations.
6064 (Target_arm::reloc_needs_sym_origin): New method.
6065 (Arm_relocate_functions::calc_grp_kn): New method.
6066 (Arm_relocate_functions::calc_grp_residual): New method.
6067 (Arm_relocate_functions::calc_grp_gn): New method.
6068 (Arm_relocate_functions::arm_grp_alu): New Method.
6069 (Arm_relocate_functions::arm_grp_ldr): New Method.
6070 (Arm_relocate_functions::arm_grp_ldrs): New Method.
6071 (Arm_relocate_functions::arm_grp_ldc): New Method.
6072 (Target_arm::Scan::local): Handle the ARM group relocations.
6073 (Target_arm::Scan::global): Likewise.
6074 (Target_arm::Relocate::relocate): Likewise.
6075 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6078 2010-01-26 Doug Kwan <dougkwan@google.com>
6080 * arm.cc (set): Include.
6081 (class Arm_exidx_fixup): Change type of last_input_section_ to const
6083 (Arm_output_section::Text_section_list): New type.
6084 (Arm_output_section::append_text_sections_to_list): New method.
6085 (Arm_output_section::fix_exidx_coverage): Ditto.
6086 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
6087 (Arm_relobj::convert_input_section_to_relaxed_section): Use
6088 Relobj::set_section_offset() instead of
6089 Sized_relobj::invalidate_section_offset().
6090 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
6091 parameter for section headers. Ignore relocation sections for
6092 unallocated sections and EXIDX sections.
6093 (Target_arm::fix_exidx_coverage): New method.
6094 (Target_arm::output_section_address_less_than): New type.
6095 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
6096 linked text section instead of the EXIDX section.
6097 (Arm_output_section::create_stub_group): Add an assertion to check
6098 that this is not an EXIDX output section.
6099 (Arm_output_section::append_text_sections_to_list): New method.
6100 (Arm_output_section::fix_exidx_coverage): Ditto.
6101 (Arm_relobj::scan_sections_for_stubs): Adjust call to
6102 Arm_relobj::section_needs_reloc_stub_scanning.
6103 (Target_arm::do_relax): Fix EXIDX output section coverage in the
6105 (Target_arm::fix_exidx_coverage): New method.
6106 * object.h (Relobj::set_output_section): New method.
6107 (Sized_relobj::invalidate_section_offset): Remove method.
6108 (Sized_relobj::do_invalidate_section_offset): Remove method.
6109 (Sized_relobj::do_set_section_offset): Handle offset value -1.
6111 2010-01-25 Doug Kwan <dougkwan@google.com>
6113 * arm.cc (Arm_exidx_merged_section::do_output_offset):
6114 Fix warning due to signed and unsigned comparison on a 32-bit host.
6116 2010-01-22 Doug Kwan <dougkwan@google.com>
6118 * arm.cc (Target_arm::do_relax): Record an output section for section
6119 offset adjustment it contains any stub table that has changed.
6120 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
6121 offsets in an output section if necessary.
6122 * output.cc (Output_section::Output_section): Initialize
6123 section_offsets_need_adjustments_.
6124 (Output_section::add_input_section_for_script): Renamed to
6125 Output_section::add_simple_input_section.
6126 (Output_section::save_states): Add a comment.
6127 (Output_section::discard_states): New method defintion.
6128 (Output_section::adjust_section_offsets): Same.
6129 * output.h (Output_section::add_input_section_for_script): Renamed to
6130 Output_section::add_simple_input_section.
6131 (Output_section::discard_states): New method declaration.
6132 (Output_section::adjust_section_offsets): Same.
6133 (Output_section::section_offsets_need_adjustment,
6134 Output_section::set_section_offsets_need_adjustment): New method
6136 (Output_section::section_offsets_need_adjustment_): New data member.
6137 * script-sections.cc
6138 (Output_section_element_input::set_section_address): Adjust code for
6139 renaming of Output_section::add_input_section_for_script.
6140 (Orphan_output_section::set_section_address): Same.
6142 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6144 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
6145 Fix_v4bx enum values .
6146 * gold/options.h (General_options): New option definitions.
6147 (General_options::fix_v4bx): New method.
6148 (General_options::Fix_v4bx): New enum.
6149 * gold/options.cc (General_options::parse_fix_v4bx): New method.
6150 (General_options::parse_fix_v4bx_interworking): New method.
6152 2010-01-22 Doug Kwan <dougkwan@google.com>
6154 * arm.cc (Arm_exidx_fixup): New class.
6156 2010-01-21 Doug Kwan <dougkwan@google.com>
6158 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
6160 (Arm_exidx_section_offset_map): New type.
6162 2010-01-21 Doug Kwan <dougkwan@google.com>
6164 * arm.cc (Arm_exidx_input_section): New class.
6165 (Arm_relobj::exidx_input_section_by_link,
6166 Arm_relobj::exidx_input_section_by_shndx,
6167 Arm_relobj::make_exidx_input_section): New methods.
6168 (read_arm_attributes_section): Remove.
6169 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
6170 information about them.
6171 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
6174 2010-01-20 Doug Kwan <dougkwan@google.com>
6176 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
6177 Input_section_specifier to Section_id.
6178 (Target_arm::new_arm_input_section: Adjust code for change of key
6180 (Target_arm::find_arm_input_section): Ditto.
6181 * gc.h (object.h): Include for Section_id nand Section_id_hash.
6182 (Section_id): Remove.
6183 (Garbage_collection::Section_id_hash): Remove.
6184 * icf.h (object.h): Include for Section_id nand Section_id_hash.
6185 (Section_id): Remove.
6186 (Icf::Section_id_hash): Remove.
6187 * object.h (Section_id, Const_section_id, Section_id_hash,
6188 Const_section_id_hash): New type definitions.
6189 * output.cc (Output_section::add_relaxed_input_section): Change to
6190 use Const_section_id instead of Input_section_specifier as key type.
6191 (Output_section::add_merge_input_section): Ditto.
6192 (Output_section::build_relaxation_map): Change to use Section_id
6193 instead of Input_section_specifier as key type.
6194 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6196 (Output_section::convert_input_sections_to_relaxed_sections): Change
6197 to use Const_section_id instead of Input_section_specifier as key type.
6198 (Output_section::find_merge_section): Ditto.
6199 (Output_section::find_relaxed_input_section): Ditto.
6200 * output.h (Input_section_specifier): Remove class.
6201 (Output_section::Output_section_data_by_input_section_map): Change
6202 key type to Const_section_id.
6203 (Output_section::Output_relaxed_input_section_by_input_section_map):
6205 (Output_section::Relaxation_map): Change key type to Section_id.
6207 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6209 * gold/arm.cc: Added support for R_ARM_V4BX relocation
6210 (class Arm_v4bx_stub): New class.
6211 (DEF_STUBS): Updated definition to support v4_veneer_bx.
6212 (Stub_factory::make_arm_v4bx_stub): New method.
6213 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
6214 (Stub_table::empty): Handle v4bx stubs.
6215 (Stub_table::add_arm_v4bx_stub): New method.
6216 (Stub_table::find_arm_v4bx_stub): New method.
6217 (Arm_relocate_functions::v4bx): New method.
6218 (Target_arm::fix_v4bx): New method.
6219 (Target_arm::Target_arm): Handle R_ARM_V4BX.
6220 (Stub_table::relocate_stubs): Likewise.
6221 (Stub_table::do_write): Likewise.
6222 (Stub_table::update_data_size_and_addralign): Likewise.
6223 (Stub_table::finalize_stubs): Likewise.
6224 (Target_arm::Scan::local): Likewise.
6225 (Target_arm::Scan::global): Likewise.
6226 (Target_arm::do_finalize_sections): Likewise.
6227 (Target_arm::Relocate::relocate): Likewise.
6228 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6230 (Target_arm::scan_reloc_for_stub): Likewise.
6231 (Target_arm::scan_reloc_section_for_stubs): Likewise.
6233 2010-01-19 Ian Lance Taylor <iant@google.com>
6235 * output.cc (Output_section_headers::do_sized_write): Write large
6236 segment count to sh_info field.
6237 (Output_file_header::do_sized_write): For large segment count,
6238 write PN_XNUM to e_phnum field.
6240 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6242 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
6243 (Arm_relocate_functions::thm_jump8): New function.
6244 (Arm_relocate_functions::thm_jump11): New function.
6245 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
6247 (Target_arm::Scan::global): Likewise.
6248 (Target_arm::Relocate::relocate): Likewise.
6249 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6252 2010-01-14 Doug Kwan <dougkwan@google.com>
6254 * arm.cc (map, utility): Include headers.
6255 (Target_arm::apply_cortex_a8_workaround): New method.
6256 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
6257 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
6258 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
6259 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
6260 the --[no-]fix-cortex-a8 command line options.
6261 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
6262 (Target_arm::relocate_stub): Use addend in instruction template.
6263 * options.h (DEFINE_bool): Set the user-set flag.
6264 (General_options): Add --[no-]-fix-cortex options.
6265 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
6266 : Update fast look-up map after conversion.
6268 2010-01-14 Sriraman Tallam <tmsriram@google.com>
6270 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6271 in the first pass of do_layout.
6273 2010-01-13 Doug Kwan <dougkwan@google.com>
6275 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6276 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6277 apparent compiler problem of not folding static constant integral
6278 data members of elfcpp::Elf_sizes<32>.
6280 2010-01-13 Doug Kwan <dougkwan@google.com>
6282 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6283 Arm_relobj::section_needs_cortex_a8_stub_scanning,
6284 Arm_relobj::scan_section_for_cortex_a8_erratum,
6285 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
6286 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
6287 sections to scan for relocation stubs into a new method
6288 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
6289 relocation and Cortex-A8 stub scanning.
6290 (Target_arm::do_relax): Force stubs to be after stubbed sections
6291 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
6292 the beginning of a new relaxation pass. Update a comment.
6293 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
6295 2010-01-12 Ian Lance Taylor <iant@google.com>
6297 * target-reloc.h (visibility_error): New inline function.
6298 (relocate_section): Call visibility_error.
6299 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6300 (MOSTLYCLEANFILES): Likewise.
6301 (protected_4_pic.o, protected_3.err): New targets.
6302 * testsuite/protected_4.cc: New file.
6304 2010-01-12 Doug Kwan <dougkwan@google.com>
6306 * arm.cc (Cortex_a8_reloc): New class.
6307 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6308 and cortex_a8_relocs_info_.
6309 (Target_arm::fix_cortex_a8): New method definition.
6310 (Target_arm::Cortex_a8_relocs_info): New type.
6311 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6312 New data member declarations.
6313 (Target_arm::scan_reloc_for_stub): Record information about
6314 relocations for THUMB branches that might be exempted from the
6315 Cortex-A8 workaround.
6316 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
6317 at the beginning of a relaxation pass.
6319 2010-01-12 Doug Kwan <dougkwan@google.com>
6321 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
6322 (Arm_relobj::Mapping_symbol_position,
6323 Arm_reloj::Mapping_symbol_position_less,
6324 Arm_relobj::Mapping_symbols_info): New types.
6325 (Target_arm::is_mapping_symbol_name): New method definition.
6326 (Arm_relobj::do_count_local_symbols): Save information about mapping
6329 2010-01-11 Doug Kwan <dougkwan@google.com>
6331 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
6332 Arm_relocate_functions::thumb32_branch_upper,
6333 Arm_relocate_functions::thumb32_branch_lower,
6334 Arm_relocate_functions::thumb32_cond_branch_offset,
6335 Arm_relocate_functions::thumb32_cond_branch_upper,
6336 Arm_relocate_functions::thumb32_cond_branch_lower,
6337 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
6338 branch offset encoding.
6339 (Arm_relocate_functions::thumb_branch_common): Use new branch
6340 offset encoding methods to avoid code duplication.
6341 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
6342 (Stub_addend_reader::operator()): Use new branch encoding method
6343 to avoid code duplication.
6345 2010-01-11 Doug Kwan <dougkwan@google.com>
6347 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
6348 (Target_arm::do_finalize_sections): Define special EXIDX section
6349 symbols only if referenced.
6350 * gc.h (Garbage_collection::add_reference): New method.
6351 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
6354 2010-01-11 Ian Lance Taylor <iant@google.com>
6356 * script.cc (Version_script_info::build_expression_list_lookup):
6357 Change complaing about duplicate wildcard match from error to
6360 * script.cc (class Lazy_demangler): Recreate--revert part of patch
6362 (Version_script_info::Version_script_info): Initialize globs_,
6363 default_version_, default_is_global_, and exact_. Don't
6364 initialize globals_ or locals_.
6365 (Version_script_info::build_lookup_tables): Build local symbols
6367 (Version_script_info::unquote): New function.
6368 (Version_script_info::add_exact_match): New function.
6369 (Version_script_info::build_expression_list_lookup): Remove lookup
6370 parameter. Add is_global parameter. Change all callers. Handle
6371 wildcard pattern specially. Unquote pattern. Call
6373 (Version_script_info::get_name_to_match): New function.
6374 (Version_script_info::get_symbol_version): New function.
6375 (Version_script_info::get_symbol_version_helper): Remove.
6376 (Version_script_info::check_unmatched_names): Call unquote.
6377 * script.h (class Version_script_info): Change get_symbol_version
6378 to be non-inline and add is_global parameter; change all callers.
6379 Rewrite symbol_is_local. Update declarations. Define struct
6380 Version_tree_match, Exact, Globs. Don't define struct Lookup.
6381 Remove globals_ and locals_ members. Add exact_, globs_,
6382 default_version_, is_global_.
6383 (Version_script_info::Glob): Remove pattern, add expression and
6384 is_global. Update constructor. Change all callers.
6385 * dynobj.cc (Versions::finalize): Mark the version symbol as the
6387 (Versions::symbol_section_contents): If a symbol is undefined, or
6388 defined in a dynamic object, set the version index to
6390 * symtab.cc (Symbol_table::add_from_relobj): Don't call
6392 (Symbol_table::add_from_pluginobj): Likewise.
6393 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
6395 2010-01-11 Doug Kwan <dougkwan@google.com>
6397 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
6398 (incremental_dump_LDADD): Add linking option for libintl.
6399 * Makefile.in: Regenerate.
6401 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
6404 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
6406 * testsuite/Makefile.in: Regenerated.
6408 2010-01-10 Doug Kwan <dougkwan@google.com>
6410 * options.h (DEFINE_var): Use parentheses around argument varname__
6411 in macro body to avoid any unintended subsequent substitutions.
6413 2010-01-10 Ian Lance Taylor <iant@google.com>
6415 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
6416 candidates before doing symbol resolution.
6418 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
6419 ODR candidates if only one is weak.
6421 2010-01-08 Ian Lance Taylor <iant@google.com>
6423 * script.cc (Version_script_info::build_expression_list_lookup):
6424 Don't warn about ambiguous version, just record the ambiguity.
6425 (Version_script_info::get_symbol_version_helper): Give error if
6426 version is ambiguous.
6428 2010-01-08 Doug Kwan <dougkwan@google.com>
6430 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
6431 prev_data_size_ and prev_addralign_. Remove initializer for
6432 deleted data member has_been_changed_.
6433 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
6434 to determine if the table is empty.
6435 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
6437 (Stub_table::add_reloc_stub): Define method in class definition
6438 instead of just declaring it there.
6439 (Stub_table::add_cortex_a8_stub): New method definition.
6440 (Stub_table::update_data_size_and_addralign): Ditto.
6441 (Stub_table::finalize_stubs): Ditto.
6442 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
6443 (Stub_table::do_addralign_): Return address alignment in the
6444 (Stub_table::do_reset_address_and_file_offset): Define method in
6445 class definition instead of declaring it there. Set current data
6446 size to be the data size of the previous pass.
6447 (Stub_table::set_final_data_size): Use current data size as the
6449 (Stub_table::relocate_stub): Change parameter type of stub from
6450 Reloc_stub pointer to Stub pointer.
6451 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
6452 (Stub_table::Cortex_a8_stub_list): New typedef.
6453 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
6454 Stub_table::prev_addralign_): New data member.
6455 (Arm_relobj::Arm_relobj): Initialize data member
6456 section_has_cortex_a8_workaround_.
6457 (Arm_relobj::section_has_cortex_a8_workaround,
6458 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
6460 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
6462 (Target_arm::relocate_stub): Change parameter type of stub from
6463 Reloc_stub pointer to Stub pointer.
6464 (Insn_template::size, Insn_template::alignment): Handle
6465 THUMB16_SPECIAL_TYPE.
6466 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
6467 Stub_table::update_data_size_and_addralign,
6468 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
6470 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
6471 (Stub_table::do_write): Ditto.
6472 (Target_arm::do_relax): Adjust code for changes in Stub_table.
6474 2010-01-08 Ian Lance Taylor <iant@google.com>
6477 * symtab.h (class Symbol): Remove fields is_target_special_ and
6478 has_plt_offset_. Add field is_defined_in_discarded_section_.
6479 (Symbol::is_defined_in_discarded_section): New function.
6480 (Symbol::set_is_defined_in_discarded_section): New function.
6481 (Symbol::has_plt_offset): Rewrite.
6482 (Symbol::set_plt_offset): Verify that new offset is not -1U.
6483 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
6484 Don't initialize is_target_special_ or has_plt_offset_.
6485 Initialize is_defined_in_discarded_section_.
6486 (Symbol_table::add_from_relobj): If appropriate, set
6487 is_defined_in_discarded_section.
6488 * resolve.cc (Symbol::override_base_with_special): Don't test
6489 is_target_special_. Change has_plt_offset_ to has_plt_offset().
6490 * target-reloc.h (relocate_section): Do special handling for
6491 symbols defined in discarded sections for global symbols as well
6494 2010-01-08 Ian Lance Taylor <iant@google.com>
6496 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
6497 the SHT_SYMTAB case.
6499 2010-01-08 Ian Lance Taylor <iant@google.com>
6501 * object.cc (Sized_relobj::do_layout): Don't get confused if
6502 layout_eh_frame returns NULL.
6504 2010-01-08 Ian Lance Taylor <iant@google.com>
6507 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
6508 dynamic symbol table, use the normal symbol table.
6509 (Sized_dynobj::do_read_symbols): Remove assertion about type of
6512 2010-01-08 Ian Lance Taylor <iant@google.com>
6515 * layout.cc (Layout::include_section): Remove .gnu_debuglink
6518 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
6520 * version.cc (print_version): Change to "Copyright 2010".
6522 2010-01-08 Ian Lance Taylor <iant@google.com>
6526 * i386.cc (class Target_i386): Change return type of plt_section
6528 (class Output_data_plt_i386): Add tls_desc_rel_ field.
6529 (Output_data_plt_i386::Output_data_plt_i386): Initialize
6530 tls_desc_rel_ field.
6531 (Output_data_plt_i386::rel_tls_desc): New function.
6532 (Target_i386::rel_tls_desc_section): New function.
6533 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
6534 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
6535 R_386_TLS_DESC reloc in rel_tls_desc_section.
6536 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
6537 Define struct Tlsdesc_info.
6538 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
6539 (Target_x86_64::do_reloc_symbol_index): New function.
6540 (Target_x86_64::add_tlsdesc_info): New function.
6541 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
6542 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
6544 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
6546 (Output_data_plt_x86_64::rela_tlsdesc): New function.
6547 (Target_x86_64::rela_tlsdesc_section): New function.
6548 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
6550 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
6551 (Target_x86_64::do_reloc_addend): New function.
6552 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
6553 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
6554 declarations. Define TARGET_CODE. Add arg field to u1_ union.
6555 (Output_reloc::type): New function.
6556 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
6557 (Output_reloc::is_target_specific): New function.
6558 (Output_reloc::target_arg): New function.
6559 (class Output_reloc) [SHT_RELA]: Add four new constructors for
6560 absolute relocs and target specific relocs.
6561 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
6562 add_target_specific.
6563 (class Output_data_reloc) [SHT_RELA]: Likewise.
6564 * output.cc (Output_reloc::Output_reloc): Add four new versions
6565 for absolute relocs and target specific relocs.
6566 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
6567 (Output_reloc::get_symbol_index): Likewise.
6568 (Output_reloc::local_section_offset): Check that local_sym_index_
6569 is not TARGET_CODE or 0.
6570 (Output_reloc::symbol_value): Likewise.
6571 (Output_reloc::write) [SHT_RELA]: Call target for target specific
6573 * target.h (class Target): Add reloc_symbol_index and reloc_addend
6574 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
6576 * layout.cc (add_target_dynamic_tags): Use output section for
6577 DT_PLTRELSZ and DT_JMPREL.
6579 2010-01-07 Ian Lance Taylor <iant@google.com>
6582 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
6584 (class Output_data_reloc_generic): Define.
6585 (class Output_data_reloc_base): Change base class to
6586 Output_data_reloc_generic. Change add() method to call
6587 bump_relative_reloc_count for a relative reloc. Remove
6589 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
6591 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
6592 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
6594 * layout.h (class Layout): Update declaration.
6596 2010-01-07 Ian Lance Taylor <iant@google.com>
6598 * output.h (class Output_data): Add const version of
6599 output_section and do_output_section.
6600 (class Output_section_data): Add const version of
6602 (class Output_section): Likewise.
6603 * layout.cc (Layout::add_target_dynamic_tags): New function.
6604 * layout.h (class Layout): Update declarations.
6605 * arm.cc (Target_arm::do_finalize_sections): Use
6606 add_target_dynamic_tags.
6607 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6608 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6609 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6610 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6612 2010-01-07 Ian Lance Taylor <iant@google.com>
6615 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
6618 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
6619 Ian Lance Taylor <iant@google.com>
6622 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
6623 Xindex::read_symtab_xindex.
6625 2010-01-07 Doug Kwan <dougkwan@google.com>
6627 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
6628 (Insn_template::thumb16_bcond_insn): New method declaration.
6629 (Insn_template): Fix spelling.
6630 (Stub::thumb16_special): New method declaration.
6631 (Stub::do_write): Define virtual method which was previously pure
6633 (Stub::do_thumb16_special): New method declaration.
6634 (Stub::do_fixed_endian_write): New template member.
6635 (Reloc_stub::do_write): Remove.
6636 (Reloc_stub::do_fixed_endian_write): Remove.
6637 (Cortex_a8_stub): New class definition.
6638 (Stub_factory::make_cortex_a8_stub): New method definition.
6639 (Stub_factory::Stub_factory): Add missing static storage class
6640 qualifier for elf32_arm_stub_a8_veneer_blx.
6642 2010-01-07 Ian Lance Taylor <iant@google.com>
6645 * options.h (class General_options): Add --warn-unresolved-symbols
6646 and --error-unresolved-symbols.
6647 * errors.cc (Errors::undefined_symbol): Implement
6648 --warn-unresolved-symbols.
6650 * options.h (class General_options): Add -z text and -z textoff.
6651 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
6653 2010-01-06 Sriraman Tallam <tmsriram@google.com>
6655 * gc.h (Garbage_collection::Cident_section_map): New typedef.
6656 (Garbage_collection::cident_sections): New function.
6657 (Garbage_collection::add_cident_section): New function.
6658 (Garbage_collection::cident_sections_): New member.
6659 (gc_process_relocs): Add references to sections whose names are C
6661 * gold.h (cident_section_start_prefix): New constant.
6662 (cident_section_stop_prefix): New constant.
6663 (is_cident): New function.
6664 * layout.cc (Layout::define_section_symbols): Replace string constants
6665 with the newly defined constants.
6666 * object.cc (Sized_relobj::do_layout): Track sections whose names are
6668 * testsuite/Makefile.am: Add gc_orphan_section_test.
6669 * testsuite/Makefile.in: Regenerate.
6670 * testsuite/gc_orphan_section_test.cc: New file.
6671 * testsuite/gc_orphan_section_test.sh: New file.
6673 2010-01-06 Ian Lance Taylor <iant@google.com>
6676 * options.h (class General_options): Add --warn-shared-textrel.
6677 * layout.cc (Layout::finish_dynamic_section): Implement
6678 --warn-shared-textrel.
6681 * options.h (class General_options): Add --warn-multiple-gp.
6683 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6685 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
6686 $(THREADSLIB) and $(LIBDL).
6687 * Makefile.in: Rebuild.
6689 2010-01-06 Ian Lance Taylor <iant@google.com>
6692 * options.cc (General_options::parse_section_start): New function.
6693 (General_options::section_start): New function.
6694 (General_options::General_options): Initialize all members.
6695 * options.h: Include <map>
6696 (class General_options): Add --section-start. Add section_starts_
6698 * layout.cc (Layout::attach_allocated_section_to_segment): If
6699 --section-start was used, set the address of the segment. Remove
6700 local sort_sections.
6701 (Layout::relaxation_loop_body): If the address of the load segment
6702 has been set by --section-start, don't use it.
6703 * output.h (Output_segment::update_flags_for_output_section): New
6705 * output.cc (Output_segment::add_output_section): Call
6706 update_flags_for_output_section.
6708 2010-01-05 Ian Lance Taylor <iant@google.com>
6711 * options.h (class General_options): Add --undefined-version.
6712 * script.cc (struct Version_expression): Add was_matched_by_symbol
6714 (Version_script_info::matched_symbol): New function.
6715 (Version_script_info::get_symbol_version_helper): Call
6717 (Version_script_info::check_unmatched_names): New function.
6718 * script.h (class Version_script_info): Update declarations.
6719 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
6721 * options.h (class General_options): Use DEFINE_bool_alias for
6722 allow_multiple_definition.
6723 * resolve.cc (Symbol_table::should_override): Don't test
6724 allow_multiple_definition.
6727 * options.h (class General_options): Add --cref.
6728 * main.cc (main): Print cref table if --cref. Don't close mapfile
6729 until after printing cref table.
6730 * cref.cc: Include "symtab.h".
6731 (class Cref_inputs): Define Cref_table_compare and Cref_table.
6732 (Cref_table_compare::operator()): New function.
6733 (Cref_inputs::gather_cref): New function.
6734 (filecol): New static const.
6735 (Cref_inputs::print_cref): New function.
6736 (Cref::print_cref): New function.
6737 * cref.h: Include <cstdio>.
6738 (class Cref): Update declarations.
6739 * mapfile.h (Mapfile::file): New function.
6740 * object.h (class Object): Define Symbols. Declare virtual
6741 do_get_global_symbols.
6742 (Object::get_global_symbols): New function.
6743 * object.cc (Input_objects::add_object): Pass object to cref_ if
6745 (Input_objects::archive_start): Likewise.
6746 (Input_objects::archive_stop): Likewise.
6747 (Input_objects::print_cref): New function.
6748 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
6749 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
6751 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
6753 * plugin.h (class Sized_pluginobj): Update declarations.
6755 2010-01-05 Ian Lance Taylor <iant@google.com>
6757 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
6758 to is_default_version. Rename insdef to insdefault.
6759 (Symbol_table::add_from_relobj): Rename def to is_default_version
6760 and local to is_forced_local.
6761 (Symbol_table::add_from_pluginobj): Likewise.
6762 (Symbol_table::add_from_dynobj): Likewise.
6763 (Symbol_table::define_special_symbol): Rename insdef to
6766 2010-01-04 Ian Lance Taylor <iant@google.com>
6769 * options.h (class General_options): Add
6770 --allow-multiple-definition and -z muldefs.
6771 * resolve.cc (Symbol_table::should_override): Don't warn about a
6772 multiple symbol definition if --allow-multiple-definition or -z
6776 * options.h (class General_options): Add --add-needed and
6777 --copy-dt-needed-entries. Tweak --as-needed help entry.
6778 * object.cc (Input_objects::check_dynamic_dependencies): Give an
6779 error if --copy-dt-needed-entries aka --add-needed is used and
6780 would cause a change in behaviour.
6783 * options.h (class General_options): Add -G as a short version of
6784 --shared. Add no-op options -assert, -g, and -i.
6786 2010-01-04 Sriraman Tallam <tmsriram@google.com>
6788 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
6789 check for .text or .gnu.linkonce.t sections.
6790 * icf.cc (Icf::find_identical_sections): Ditto.
6791 Change the detection for mangled function name within the section
6793 * icf.h (is_section_foldable_candidate): New function.
6795 2009-12-30 Ian Lance Taylor <iant@google.com>
6798 * options.h (class General_options): Permit two dashes with
6799 --retain-symbols-file.
6801 2009-12-30 Ian Lance Taylor <iant@google.com>
6804 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
6805 don't put the file header and segment headers in the text
6809 * common.cc (Sort_commons::operator()): Stabilize sort when both
6811 (Symbol_table::do_allocate_commons_list): When allocating common
6812 symbols, skip a symbol which is no longer common.
6813 * symtab.h (Symbol::is_common): Test whether the symbol comes from
6814 an object before checking its type.
6815 * testsuite/common_test_2.c: New file.
6816 * testsuite/common_test_3.c: New file.
6817 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
6818 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
6819 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
6820 (common_test_2_pic.o, common_test_2.so): New targets.
6821 (common_test_3_pic.o, common_test_3.so): New targets.
6822 * testsuite/Makefile.in: Rebuild.
6825 * script.cc (read_input_script): If we see a new SECTIONS clause,
6826 and we have added an input section, give an error.
6827 * layout.h (class Layout): Add have_added_input_section function.
6828 Add have_added_input_section_ field.
6829 * layout.cc (Layout::Layout): Initialize
6830 have_added_input_section_.
6831 (Layout::layout): Set have_added_input_section_.
6832 (Layout::layout_eh_frame): Likewise.
6834 2009-12-30 Ian Lance Taylor <iant@google.com>
6837 * options.h (class General_options): Add --sort-common option.
6838 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
6839 * common.cc (Sort_common): Add sort_order parameter to
6840 constructor. Add sort_order_ field.
6841 (Sort_commons::operator): Check sort_order_.
6842 (Symbol_table::allocate_commons): Determine the sort order.
6843 (Symbol_table::do_allocate_commons): Add sort_order parameter.
6845 (Symbol_table::do_allocate_commons_list): Likewise.
6847 2009-12-30 Ian Lance Taylor <iant@google.com>
6850 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
6851 symbols from this object, don't change the visibility of an
6853 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
6855 2009-12-30 Ian Lance Taylor <iant@google.com>
6858 * script.h (class Version_script_info): Define Language enum.
6859 Update declarations. Define Glob, Exact, and Lookup types. Add
6860 new fields globals_, locals_, and is_finalized_.
6861 * script.cc: Various formatting fixes.
6862 (class Parser_closure): Change language_stack_ from a vector of
6863 std::string to one of Version_script_info::Language. Adjust all
6865 (class Lazy_demangler): Remove.
6866 (struct Version_expression): Change language from std::string to
6867 Version_script_info::Language.
6868 (Version_script_info::Version_script_info): New function.
6869 (Version_script_info::~Version_script_info): Don't call clear.
6870 (Version_script_info::finalize): New function.
6871 (Version_script_info::build_lookup_tables): New function.
6872 (Version_script_info::build_expression_list_lookup): New
6874 (Version_script_info::get_symbol_version_helper): Rewrite to use
6876 (Version_script_info::print_expression_list): Adjust to use
6877 Version_script_info::Language.
6878 (script_push_lex_into_version_mode): Check that the version script
6879 has not been finalized.
6880 (version_script_push_lang): Change language string to
6881 Version_script_info::Language.
6882 * options.cc (Command_line::version_script): New function.
6883 * options.h (class General_options): Add finalize_dynamic_list
6884 function. Change version_script from declaration to definition.
6885 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
6886 * testsuite/version_script.map: Remove duplicate def of foo.
6887 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
6889 * testsuite/Makefile.in: Rebuild.
6891 2009-12-30 Ian Lance Taylor <iant@google.com>
6894 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
6895 if the input symbol index is 0, make the output symbol index 0.
6897 2009-12-30 Ian Lance Taylor <iant@google.com>
6900 * options.h (class General_options): Add -x/--discard-all.
6901 * object.cc (Sized_relobj::do_count_local_symbols): Handle
6902 --discard-all. If the local symbol needs a dynamic entry, check
6903 that before handling --discard-locals.
6905 2009-12-30 Ian Lance Taylor <iant@google.com>
6908 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
6910 (Output_segment::add_output_section): Don't change the flags if
6914 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
6915 GNU hash table if they need a dynamic value. Otherwise, don't add
6916 them if they are defined in a dynamic object or are forced local.
6918 2009-12-29 Ian Lance Taylor <iant@google.com>
6921 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
6922 .gnu.hash table for a 32-bit target.
6925 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
6926 regular and a dynamic object only needs a dynamic symbol table
6927 entry if it is externally visible.
6930 * i386.cc (class Target_i386): Initialize global_offset_table_ in
6931 constructor. Add global_offset_table_ field.
6932 (Target_i386::got_section): Set global_offset_table_.
6933 (Target_i386::do_finalize_sections): Set global_offset_table_
6935 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
6936 in constructor. Add global_offset_table_ field.
6937 (Target_x86_64::got_section): Set global_offset_table_.
6938 (Target_x86_64::do_finalize_sections): Set global_offset_table_
6941 * layout.cc (Layout::Layout): Initialize increase_relro_.
6942 (Layout::get_output_section): Add is_relro, is_last_relro, and
6943 is_first_non_relro parameters. Change all callers.
6944 (Layout::choose_output_section): Likewise.
6945 (Layout::add_output_section_data): Likewise.
6946 (Layout::make_output_section): Likewise.
6947 (Layout::set_segment_offsets): Clear increase_relro when using a
6949 * layout.h (class Layout): Add increase_relro method. Add
6950 increase_relro_ field. Update declarations.
6951 * output.cc (Output_section::Output_section): Initialize
6952 is_last_relro_ and is_first_non_relro_.
6953 (Output_segment::add_output_section): Group relro sections is
6954 do_sort is true. Handle is_last_relro and is_first_non_relro.
6955 (Output_segment::maximum_alignment): Remove relro handling.
6956 (Output_segment::set_section_addresses): Add increase_relro
6957 parameter. Change all callers. Add initial alignment to align
6958 relro sections on separate page. Remove old relro handling.
6959 (Output_segment::set_section_list_addresses): Remove in_relro
6960 parameter. Change all callers.
6961 (Output_segment::set_offset): Add increase parameter. Change all
6962 callers. Remove old relro handling.
6963 * output.h (class Output_section): Add new methods: is_last_relro,
6964 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
6965 Add is_last_relro_ and is_first_non_relro_ fields.
6966 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
6967 Create separate .got.plt section. Call increase_relro.
6968 * x86_64.cc (Target_x86_64::got_section): Likewise.
6969 * testsuite/relro_script_test.t: Add .got.plt.
6972 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
6973 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
6974 (Layout::finalize): Call set_dynamic_symbol_size.
6975 (Layout::set_dynamic_symbol_size): New function.
6976 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
6977 set_dynamic_symbol_size.
6980 * output.h (class Output_section): Add is_entsize_zero_ field.
6981 * output.cc (Output_section::Output_section): Initialize
6983 (Output_section::set_entsize): If two different entsizes are
6984 requested, force it to zero.
6985 (Output_section::add_input_section): Set flags for .debug_str
6986 before updating section flags. Set entsize.
6987 (Output_section::update_flags_for_input_section): Set SHF_MERGE
6988 and SHF_STRING if all input sections have those flags.
6990 2009-12-29 Rafael Espindola <espindola@google.com>
6992 * main.cc (main): Fix the sys time reporting.
6993 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
6996 2009-12-29 Sriraman Tallam <tmsriram@google.com>
6998 * options.cc (General_options::parse_version): Allow -v to exit
6999 without an error if there is nothing to link.
7001 2009-12-29 Ian Lance Taylor <iant@google.com>
7003 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
7004 using a version of gcc before 4.1.
7005 * configure: Rebuild.
7007 2009-12-28 Chris Demetriou <cgd@google.com>
7009 * attributes.cc (Output_attributes_section_data::do_write): Use
7010 std::vector::front rather than std::vector::data.
7012 2009-12-28 Ian Lance Taylor <iant@google.com>
7014 * symtab.h (class Symbol_table): Add enum Defined.
7015 * resolve.cc (Symbol_table::should_override): Add defined
7016 parameter. Change all callers. Test whether object is NULL
7017 before calling a method on it.
7018 (Symbol_table::report_resolve_problem): Add defined parameter.
7020 (Symbol_table::should_override_with_special): Likewise.
7021 * symtab.cc (Symbol_table::define_in_output_data): Add defined
7022 parameter. Change all callers.
7023 (Symbol_table::do_define_in_output_data): Likewise.
7024 (Symbol_table::define_in_output_segment): Likewise.
7025 (Symbol_table::do_define_in_output_segment): Likewise.
7026 (Symbol_table::define_as_constant): Likewise.
7027 (Symbol_table::do_define_as_constant): Likewise.
7028 * script.h (class Symbol_assignment): Add is_defsym parameter to
7029 constructor; change all callers.
7030 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
7031 parameter. Change all callers. Add is_defsym_ field.
7032 (class Parser_closure): Add parsing_defsym parameter to
7033 constructor; change all callers. Add parsing_defsym accessor
7034 function. Add parsing_defsym_ field.
7036 2009-12-28 Ian Lance Taylor <iant@google.com>
7038 * gold.cc (queue_middle_tasks): Fix formatting.
7039 * object.cc (Relobj::is_section_name_included): Likewise.
7041 2009-12-23 Ian Lance Taylor <iant@google.com>
7043 * i386.cc (Target_i386::do_calls_non_split): Recognize
7044 -fsplit-stack prologue for a function with a static chain.
7045 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
7046 -fsplit-stack prologue when using %r11.
7048 2009-12-21 Sriraman Tallam <tmsriram@google.com>
7050 * options.cc (General_options::parse_version): Make -v continue and do
7051 the link like GNU ld does.
7053 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
7055 * Makefile.am (CCFILES): Add timer.cc.
7056 (HFILES): Add timer.h.
7057 * configure.ac: Check for sysconf and times.
7058 * main.cc: include timer.h.
7059 (main): Use Timer instead of get_run_time.
7062 * workqueue.cc: include timer.h.
7063 (Workqueue::find_and_run_task):
7064 Report user, sys and wall time.
7065 * Makefile.in: Regenerate.
7066 * config.in: Regenerate.
7067 * configure: Regenerate.
7069 2009-12-16 Doug Kwan <dougkwan@google.com>
7071 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
7073 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
7074 relaxed input sections.
7075 * output.cc (Output_section::find_relaxed_input_section): Change
7076 return type to Output_relaxed_input_section pointer. Adjust code
7077 for new type of relaxed_input_section_map_.
7078 * output.h (Output_section::find_relaxed_input_section): Change
7079 return type to Output_relaxed_input_section pointer.
7080 (Output_section::Output_relaxed_input_section_by_input_section_map):
7082 (Output_section::relaxed_input_section_map_): Change type to
7083 Output_section::Output_relaxed_input_section_by_input_section_map.
7084 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
7087 2009-12-15 Ian Lance Taylor <iant@google.com>
7089 * layout.cc (Layout::create_shstrtab): Only write out after input
7090 sections if we are compressing debug sections.
7092 2009-12-15 Ian Lance Taylor <iant@google.com>
7094 * archive.cc (Archive::add_symbols): Only look up a symbol without
7095 a version if there is, in fact, a version.
7097 2009-12-14 Ian Lance Taylor <iant@google.com>
7099 Revert -Wshadow changes, all changes from:
7100 2009-12-11 Doug Kwan <dougkwan@google.com>
7101 2009-12-11 Nick Clifton <nickc@redhat.com>
7102 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
7104 2009-12-11 Doug Kwan <dougkwan@google.com>
7106 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
7108 * attributes.cc (Object_attribute::size): Ditto.
7109 (Attributes_section_data::size): Ditto.
7110 (Attributes_section_data::Attributes_section_data): Ditto.
7111 (Output_attributes_section_data::do_write): Ditto.
7112 * attributes.h (Object_attribute::set_type): Ditto.
7113 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
7115 2009-12-11 Nick Clifton <nickc@redhat.com>
7117 * archive.cc: Fix shadowed variable warnings.
7119 * compressed_output.cc: Likewise.
7120 * compressed_output.h: Likewise.
7121 * configure: Likewise.
7122 * dwarf_reader.cc: Likewise.
7123 * dynobj.cc: Likewise.
7124 * dynobj.h: Likewise.
7125 * ehframe.cc: Likewise.
7126 * ehframe.h: Likewise.
7127 * errors.cc: Likewise.
7128 * expression.cc: Likewise.
7129 * fileread.cc: Likewise.
7130 * fileread.h: Likewise.
7131 * freebsd.h: Likewise.
7132 * i386.cc: Likewise.
7134 * incremental.h: Likewise.
7135 * layout.cc: Likewise.
7136 * layout.h: Likewise.
7137 * mapfile.cc: Likewise.
7138 * merge.cc: Likewise.
7139 * merge.h: Likewise.
7140 * object.cc: Likewise.
7141 * object.h: Likewise.
7142 * options.h: Likewise.
7143 * output.cc: Likewise.
7144 * output.h: Likewise.
7145 * parameters.cc: Likewise.
7146 * plugin.cc: Likewise.
7147 * powerpc.cc: Likewise.
7148 * reduced_debug_output.cc: Likewise.
7149 * reduced_debug_output.h: Likewise.
7150 * reloc.cc: Likewise.
7151 * reloc.h: Likewise.
7152 * resolve.cc: Likewise.
7153 * script-sections.cc: Likewise.
7154 * script.cc: Likewise.
7155 * script.h: Likewise.
7156 * sparc.cc: Likewise.
7157 * symtab.cc: Likewise.
7158 * symtab.h: Likewise.
7159 * target-select.cc: Likewise.
7160 * target-select.h: Likewise.
7161 * token.h: Likewise.
7162 * workqueue.cc: Likewise.
7163 * workqueue.h: Likewise.
7164 * x86_64.cc: Likewise.
7166 2009-12-10 Doug Kwan <dougkwan@google.com>
7168 * arm.cc (attributes.h): New include.
7169 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
7170 (Arm_relobj::~Arm_relobj): Delete object pointed by
7171 attributes_section_data_.
7172 (Arm_relobj::attributes_section_data): New method definition.
7173 (Arm_relobj::attributes_section_data_): New data member declaration.
7174 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
7175 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
7176 attributes_section_data_.
7177 (Arm_dynobj::attributes_section_data): New method definition.
7178 (Arm_dynobj::attributes_section_data_): New data member declaration.
7179 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
7180 initialization value of may_use_blx_ to false.
7181 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
7182 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
7183 object attributes to compute results instead of hard-coding.
7184 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
7185 Target_arm::get_secondary_compatible_arch,
7186 Target_arm::set_secondary_compatible_arch
7187 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7188 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
7189 New method declarations.
7190 (Target_arm::get_aeabi_object_attribute): New method definition.
7191 (Target_arm::attributes_section_data_): New data member declaration.
7192 (read_arm_attributes_section): New template definition.
7193 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
7194 (Arm_dynobj::do_read_symbols): Ditto.
7195 (Target_arm::do_finalize_sections): Merge attributes sections from
7196 input. Check for BLX use after attributes section merging.
7197 Fix __exidx_start and __exidx_end visibility. Create an
7198 .ARM.attributes section if necessary.
7199 (Target_arm::get_secondary_compatible_arch,
7200 Target_arm::set_secondary_compatible_arch,
7201 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7202 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
7203 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
7204 New method definitions.
7206 2009-12-09 Ian Lance Taylor <iant@google.com>
7208 * plugin.cc (Plugin::load): Don't cast from void* to a function
7211 2009-12-09 Ian Lance Taylor <iant@google.com>
7213 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
7216 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
7218 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
7219 Replace two_file_shared_1.so with two_file_shared_2.so.
7220 * testsuite/Makefile.in: Regenerated.
7222 2009-12-08 Doug Kwan <dougkwan@google.com>
7224 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
7225 (HFILES): Add attributes.h and int_encoding.h.
7226 * Makefile.in: Regenerate.
7227 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
7228 function definitions to int_encoding.cc
7229 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
7230 prototypes to int_encoding.h
7231 * reduced_debug_output.cc (int_encoding.h): New include.
7232 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
7233 function definitions to int_encoding.cc
7234 (insert_into_vector, read_from_pointer): Move template definitions to
7236 * attributes.cc: New file.
7237 * attributes.h: New file.
7238 * int_encoding.cc: New file.
7239 * int_encoding.h: New file.
7241 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
7244 * incremental-dump.cc (dump_incremental_inputs): New.
7245 (main): Use dump_incremental_inputs.
7247 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
7250 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
7251 checking elfcpp::STT_FUNC.
7252 (Target_i386::Relocate::relocate): Likewise.
7253 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
7255 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
7256 symbols from shared libraries into normal FUNC symbols.
7258 * symtab.h (Symbol): Add is_func and use it.
7260 2009-12-05 Doug Kwan <dougkwan@google.com>
7262 * arm.cc (Target_arm::arm_info): Initialize new fields
7263 attributes_section and attributes_vendor.
7264 * i386.cc (Target_i386::i386_info): Same.
7265 * object.cc (Sized_relobj::do_layout): Skip attribute section.
7266 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7267 fields attributes_section and attributes_vendor.
7268 * sparc.cc (Target_sparc::sparc_info): Same.
7269 * target.h (Target::attributes_section, Target::attributes_vendor,
7270 Target::is_attributes_section, Target::attribute_arg_type,
7271 Target::attributes_order): New method definitions.
7272 (Target::Target_info::attributes_section,
7273 Target::Target_info::attributes_vendor): New fields.
7274 (Target::do_attribute_arg_type, Target::do_attributes_order): New
7275 virtual method definitions.
7276 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7277 attributes_section and attributes_vendor.
7278 * testsuite/testfile.cc (Target_test::test_target_info): Same.
7280 2009-12-05 Doug Kwan <dougkwan@google.com>
7282 * arm.cc: Update comments about interworking and stub generation.
7283 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
7284 considered as non-PIC.
7285 (Arm_relocate_functions::base_abs): Fix formatting.
7286 (Arm_relocate_functions::got_prel): Fix comment. Change interface
7287 of function to use GOT entry address instead of offset.
7288 (Target_arm::Scan::global): Issue an error if a symbol would need a
7289 PLT does not get one because it is untyped. Remove code to create
7290 dynamic symbols for relative branches.
7291 (Target_arm::Relocate::relocate: Use 0 instead of false since function
7292 takes unsigned integer instead of boolean.
7294 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
7296 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7297 (two_file_test_LDADD): Likewise.
7298 (common_test_1_LDADD): Likewise.
7299 (exception_test_LDADD) Likewise.
7300 (weak_test_LDADD): Likewise.
7301 (many_sections_test_LDADD): Likewise.
7302 (initpri1_LDADD): Likewise.
7303 (script_test_1_LDADD): Likewise.
7304 (script_test_2_LDADD): Likewise.
7305 (justsyms_LDADD): Likewise.
7306 (binary_test_LDADD): Likewise.
7307 (large_LDADD): Likewise.
7308 * testsuite/Makefile.in: Regenerated.
7310 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
7312 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7313 (Symbol_table::override_with_special): Likewise.
7314 (Symbol_table::add_from_object): Likewise.
7316 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
7318 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7319 Don't set the data_offset twice.
7321 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
7323 * testsuite/Makefile.in: Regenerate.
7325 2009-12-03 Doug Kwan <dougkwan@google.com>
7327 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
7328 (Target_arm::do_finalize_sections): Add parameter for symbol table
7329 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
7330 * i386.cc (Target_i386::do_finalize_sections): Add an additional
7331 parameter for symbol table pointer.
7332 * layout.cc (Layout::finalize): Call Target::finalize_sections with
7333 an additional parameter for a pointer to symbol table.
7334 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
7335 parameter for a symbol table pointer.
7336 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
7337 * target.h (Target::finalize_sections, Target::do_finalize_sections):
7339 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
7340 parameter for a symbol table pointer.
7342 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
7344 * incremental.cc (Incremental_inputs_header)
7345 (Incremental_inputs_header_write, Incremental_inputs_entry)
7346 (Incremental_inputs_entry_write): Move ...
7347 * incremental.h (Incremental_inputs_header)
7348 (Incremental_inputs_header_write, Incremental_inputs_entry)
7349 (Incremental_inputs_entry_write): here.
7351 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7353 * incremental.cc (make_sized_incremental_binary): Set the target.
7354 Error if it is incompatible.
7355 * output.h (Output_file): Add filename method.
7357 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7359 * incremental.cc (Incremental_inputs_entry): Remove unused argument
7360 from the get_* methods.
7362 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7364 * incremental-dump.cc (main): Check that the offeset of a script is 0.
7365 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7366 Write 0 for the data_offset of scripts.
7368 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7370 * testsuite/Makefile.am: Add the incremental_test.sh test.
7371 * testsuite/incremental_test.sh: New.
7372 * testsuite/incremental_test_1.c: New.
7373 * testsuite/incremental_test_2.c: New.
7375 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
7377 * incremental-dump.cc (main): Fix typos.
7379 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
7382 * incremental-dump.cc (main): Use llu to print 64 bit values.
7384 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
7385 H.J. Lu <hongjiu.lu@intel.com>
7387 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
7389 (incremental_dump_LDADD): Likewise.
7390 * Makefile.in: Regenerated.
7392 2009-11-25 Doug Kwan <dougkwan@google.com>
7396 2009-11-25 Doug Kwan <dougkwan@google.com>
7398 * arm.cc (Target_arm::Target_arm): Move method definition
7399 outside of class definition. Add code to handle
7400 --target1-rel, --target1-abs and --target2= options.
7401 (Target_arm::get_reloc_reloc_type): Change method to be
7402 non-static and const.
7403 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
7404 New data member declaration.
7405 (Target_arm::Scan::local, Target_arm::Scan::global,
7406 Target_arm::Relocate::relocate,
7407 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7408 Adjust call to Target_arm::get_real_reloc_type.
7409 (Target_arm::get_real_reloc_type): Use command line options
7410 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7411 * options.h (--target1-rel, --target1-abs, --target2): New
7414 2009-11-25 Doug Kwan <dougkwan@google.com>
7416 * arm.cc (Target_arm::Target_arm): Move method definition outside of
7417 class definition. Add code to handle --target1-rel, --target1-abs
7418 and --target2= options.
7419 (Target_arm::get_reloc_reloc_type): Change method to be non-static
7421 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
7423 (Target_arm::Scan::local, Target_arm::Scan::global,
7424 Target_arm::Relocate::relocate,
7425 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
7426 call to Target_arm::get_real_reloc_type.
7427 (Target_arm::get_real_reloc_type): Use command line options to
7428 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7429 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
7432 2009-11-25 Doug Kwan <dougkwan@google.com>
7434 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
7435 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
7436 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
7438 (Arm_relocate_functions::thm_call): Replace body with a call to
7439 Arm_relocate_functions::thumb_branch_common.
7440 (Arm_relocate_functions::thm_jump24,
7441 Arm_relocate_functions::thm_xpc22): New method definitions.
7442 (Arm_relocate_functions::thumb_branch_common): New method definition.
7443 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
7445 (Target_arm::Relocate::relocate): Adjust call to thm_call.
7446 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
7448 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
7450 * Makefile.am: Build incremental-dump
7451 * Makefile.in: Regenerate.
7452 * incremental-dump.cc: New.
7453 * incremental.cc (Incremental_inputs_header_data,
7454 Incremental_inputs_entry_data): Move to incremental.h
7455 * incremental.h: (Incremental_inputs_header_data,
7456 Incremental_inputs_entry_data): Move from incremental.cc
7458 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
7460 * incremental.cc (Incremental_inputs_header,
7461 Incremental_inputs_header_write, Incremental_inputs_entry,
7462 Incremental_inputs_entry_write): Add a typedef with the data type.
7464 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
7466 * incremental.cc (Incremental_inputs_header,
7467 Incremental_inputs_header_write, Incremental_inputs_entry,
7468 Incremental_inputs_entry_write): Update comment about which
7469 type has the filed descriptions.
7471 2009-11-15 Doug Kwan <dougkwan@google.com>
7473 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
7474 (Arm_relocate_functions::arm_branch_common): Change method defintion
7475 in class definition to a method declaration and update list of formal
7477 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
7478 Arm_relocation_functions::jump24): Adjust call to
7479 Arm_relocate_functions::arm_branch_common. Update list of formal
7481 (Arm_relocate_functions::xpc25): New method definition.
7482 (Arm_relocate_functions::arm_branch_common): Move method defintion
7483 out from class definition. Use stubs for mode-switching and extending
7485 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
7486 specially. Change code to enable use of stubs in ARM branches.
7488 2009-11-10 Doug Kwan <dougkwan@google.com>
7490 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
7491 in method declaration.
7492 (Target_arm::relocate_stub): New method declaration.
7493 (Target_arm::default_target): Change to return a pointer instead of
7495 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
7496 Target_arm::default_target.
7497 (Arm_Relobj::do_relocate_sections): Remove options paramater in
7499 (Target_arm::relocate_section): Adjust view.
7500 (Target_arm::relocate_stub): New method definition.
7502 2009-11-10 Doug Kwan <dougkwan@google.com>
7504 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
7506 * incremental.cc (open_incremental_binary): Initialized local
7507 variables to avoid warnings.
7508 * object.cc (make_elf_object): Ditto.
7509 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
7512 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
7515 * testsuite/plugin_test.c: Include "config.h".
7517 2009-11-09 Doug Kwan <dougkwan@google.com>
7519 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
7520 (arm_symbol_value): Remove.
7521 (Arm_relocate_functions::arm_branch_common,
7522 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
7523 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
7524 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
7525 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
7526 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
7527 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
7528 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
7529 Arm_relocate_functions::thm_mobw_abs_nc,
7530 Arm_relocate_functions::thm_mov_abs,
7531 Arm_relocate_functions::movw_prel_nc,
7532 Arm_relocate_functions::thm_movt_abs,
7533 Arm_relocate_functions::movt_prel,
7534 Arm_relocate_functions::thm_movw_prel_nc,
7535 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
7536 (Target_arm::Relocate::relocate): Only decompose address into two
7537 parts if relocation type uses the thumb-bit and pass the actual
7538 bit instead of a flag indicating that the thumb-bit is used. Adjust
7539 calls to methods in Arm_relocate_functions for this change.
7541 2009-11-08 Ian Lance Taylor <iant@google.com>
7544 * reloc.cc: Instantiate
7545 Sized_relobj::initialize_input_to_output_maps and
7546 Sized_relobj:free_input_to_output_maps.
7548 2009-11-06 Ian Lance Taylor <iant@google.com>
7551 * defstd.cc (in_segment): Set only_if_ref true for "end".
7553 2009-11-06 Doug Kwan <dougkwan@google.com>
7555 * arm.cc (class Reloc_stub): Correct a comment.
7556 (Target_arm::Target_arm): Initialize arm_input_section_map_.
7557 (Target_arm::scan_section_for_stubs): New method declaration.
7558 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
7559 Change methods from private to protected.
7560 (Target_arm::do_may_relax): New method definition.
7561 (Target_arm::do_relax, Target_arm::group_sections,
7562 Target_arm::scan_reloc_for_stub,
7563 Target_arm::scan_reloc_section_for_stubs): New method declarations.
7564 (Target_arm::arm_input_section_map_): New data member declaration.
7565 (Target_arm::scan_reloc_for_stub,
7566 Target_arm::scan_reloc_section_for_stubs,
7567 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
7568 Target_arm::do_relax): New method definitions.
7570 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
7572 * configure.ac: Check for (struct stat)::st_mtim
7573 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
7574 * config.in: Regenerate.
7575 * configure: Regenerate.
7577 2009-11-05 Ian Lance Taylor <iant@google.com>
7580 * output.cc (Output_segment::add_output_section): Add missing
7583 2009-11-04 Ian Lance Taylor <iant@google.com>
7586 * object.h (class Object): Add is_needed and set_is_needed
7587 methods. Add is_needed_ field. Make bool fields into bitfields.
7588 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
7589 defined in a dynamic object and referenced by a regular object,
7590 set is_needed for the dynamic object.
7591 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
7592 if the file is marked with as_needed and it is not needed.
7594 2009-11-04 Ian Lance Taylor <iant@google.com>
7597 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
7598 tags if data is discarded by linker script.
7599 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7600 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7601 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7602 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7604 2009-11-04 Ian Lance Taylor <iant@google.com>
7606 * layout.cc (Layout::get_output_section): Add is_interp and
7607 is_dynamic_linker_section parameters. Change all callers.
7608 (Layout::choose_output_section): Likewise.
7609 (Layout::make_output_section): Likewise.
7610 (Layout::add_output_section_data): Add is_dynamic_linker_section
7611 parameter. Change all callers.
7612 * layout.h (class Layout): Update declarations.
7613 * output.h (class Output_section): Add is_interp, set_is_interp,
7614 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
7615 Add is_interp_, is_dynamic_linker_section_ fields. Change
7616 generate_code_fills_at_write_ to a bitfield.
7617 * output.cc (Output_section::Output_sections): Initialize new
7619 (Output_segment::add_output_section): Add do_sort parameter.
7622 2009-11-03 Ian Lance Taylor <iant@google.com>
7625 * options.h (class General_options): Add --warn-common.
7626 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
7627 merging two common symbols.
7628 (Symbol_table::should_override): Handle --warn-common when merging
7629 a common symbol with a defined symbol. Use report_resolve_problem
7630 for multiple definitions.
7631 (Symbol_table::report_resolve_problem): New function.
7632 * symtab.h (class Symbol_table): Declare report_resolve_problem.
7634 2009-11-03 Doug Kwan <dougkwan@google.com>
7636 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
7638 (Target_arm::stub_factory): New method definition.
7639 (Target_arm::new_arm_input_section,
7640 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
7641 Target_arm::reloc_uses_thumb_bit): New method declarations.
7642 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
7643 New type definitions.
7644 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
7645 member declarations.
7646 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
7647 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
7648 New method definitions.
7650 2009-11-03 Ian Lance Taylor <iant@google.com>
7652 * options.h (class General_options): Add --warn_constructors.
7654 2009-11-03 Ian Lance Taylor <iant@google.com>
7657 * defstd.cc (in_section): Add entries for __rel_iplt_start,
7658 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
7660 2009-11-03 Ian Lance Taylor <iant@google.com>
7663 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
7664 --msgid-bugs-address.
7665 (install-pdf): New target.
7666 (install-data_yes): Look up one directory to find mkinstalldirs.
7668 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
7670 * po/Make-in (.po.gmo): Don't generate .gmo files in source
7673 2009-10-30 Doug Kwan <dougkwan@google.com>
7675 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
7677 2009-10-30 Doug Kwan <dougkwan@google.com>
7679 * arm.cc (Stub_addend_reader): New struct template definition
7680 and partial specializations.
7681 (Stub_addend_reader::operator()): New method definition for a
7682 partially specialized template.
7684 2009-10-30 Doug Kwan <dougkwan@google.com>
7686 * arm.cc (Arm_relobj::processor_specific_flags): New method
7688 (Arm_relobj::do_read_symbols): New method declaration.
7689 (Arm_relobj::processor_specific_flags_): New data member declaration.
7690 (Arm_dynobj): New class definition.
7691 (Target_arm::do_finalize_sections): Add input_objects parameter.
7692 (Target_arm::do_adjust_elf_header): New method declaration.
7693 (Target_arm::are_eabi_versions_compatible,
7694 (Target_arm::merge_processor_specific_flags): New method declaration.
7695 (Target_arm::do_make_elf_object): New overloaded method definitions
7697 (Arm_relobj::do_read_symbols): New method definition.
7698 (Arm_dynobj::do_read_symbols): Ditto.
7699 (Target_arm::do_finalize_sections): Add input_objects parameters.
7700 Merge processor-specific flags from all input objects.
7701 (Target_arm::are_eabi_versions_compatible,
7702 Target_arm::merge_processor_specific_flags,
7703 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
7704 New method definitions.
7705 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
7706 Input_objects pointer type parameter.
7707 * layout.cc (Layout::finalize): Pass input objects to target's.
7708 finalize_sections function.
7709 * output.cc (Output_file_header::do_sized_write): Set ELF file
7710 header's processor-specific flags.
7711 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
7712 Input_objects pointer type parameter.
7713 * sparc.cc (Target_sparc::do_finalize_sections): Same.
7714 * target.h (Input_objects): New forward class declaration.
7715 (Target::processor_specific_flags,
7716 Target::are_processor_specific_flags_sect): New method definitions.
7717 (Target::finalize_sections): Add input_objects parameter.
7718 (Target::Target): Initialize processor_specific_flags_ and
7719 are_processor_specific_flags_set_.
7720 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
7722 (Target::set_processor_specific_flags): New method definition.
7723 (Target::processor_specific_flags_,
7724 Target::are_processor_specific_flags_set_): New data member
7726 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
7727 Input_objects pointer type parameter.
7729 2009-10-30 Doug Kwan <dougkwan@google.com>
7731 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
7733 2009-10-28 Ian Lance Taylor <iant@google.com>
7735 * object.h (class Relobj): Drop options parameter from
7736 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
7737 do_scan_relocs, do_relocate. Change all callers.
7738 (class Sized_relobj): Drop options parameters from
7739 do_gc_process_relocs, do_scan_relocs, do_relocate,
7740 do_relocate_sections, relocate_sections, emit_relocs_scan,
7741 emit_relocs_scan_reltype. Change all callers.
7742 (struct Relocate_info): Remove options field and all references to
7744 * reloc.h (class Read_relocs): Remove options constructor
7745 parameter and options_ field. Change all callers.
7746 (class Gc_process_relocs, class Scan_relocs): Likewise.
7747 (class Relocate_task): Likewise.
7748 * target-reloc.h (scan_relocs): Remove options parameter. Change
7750 (scan_relocatable_relocs): Likewise.
7751 * target.h (class Sized_target): Remove options parameter from
7752 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
7754 * gc.h (gc_process_relocs): Remove options parameter. Change all
7756 * arm.cc: Update functions to remove options parameters.
7757 * i386.cc: Likewise.
7758 * powerpc.cc: Likewise.
7759 * sparc.cc: Likewise.
7760 * x86_64.cc: Likewise.
7761 * testsuite/testfile.cc: Likewise.
7763 2009-10-28 Doug Kwan <dougkwan@google.com>
7765 * arm.cc (Arm_relobj): New class definition.
7766 (Arm_relobj::scan_sections_for_stubs,
7767 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
7768 New method definitions.
7770 2009-10-28 Cary Coutant <ccoutant@google.com>
7772 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
7773 (Plugin::cleanup_done_): New member.
7774 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
7775 (Plugin_manager::cleanup_done_): Remove.
7776 (Plugin_manager::add_input_file): Edit error message.
7777 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
7778 (Plugin_manager::cleanup): Remove use of cleanup_done_.
7780 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
7782 * fileread.cc: (File_read::View::~View): Use the new
7783 data_ownership_ filed.
7784 (File_read::~File_read): Dispose the new whole_file_view_.
7785 (File_read::open): Mmap the whole file if needed.
7786 (File_read::open): Use whole_file_view_ instead of contents_.
7787 (File_read::find_view): Use whole_file_view_ if applicable.
7788 (File_read::do_read): Use whole_file_view_ instead of contents_.
7789 (File_read::make_view): Use whole_file_view_ instead of contents_,
7790 update File_read::View::View call.
7791 (File_read::find_or_make_view): Update File_read::View::View
7793 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
7795 (File_read::View::Data_ownership): New enum.
7796 (File_read::View::View): Replace bool mapped_ with Data_ownership
7798 (File_read::View::mapped_): Remove (replaced by data_ownership_).
7799 (File_read::View::data_ownership_): New field.
7800 (File_read::contents_): Remove (replaced by whole_file_view_).
7801 (File_read::whole_file_view_): New field.
7802 * options.h (class General_options): Add --keep-files-mapped.
7804 2009-10-27 Cary Coutant <ccoutant@google.com>
7806 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
7807 * testsuite/Makefile.am (plugin_test_5): New test case.
7808 * testsuite/Makefile.in: Regenerate.
7810 2009-10-25 Doug Kwan <dougkwan@google.com>
7812 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
7813 from private to protected to allow access by child class.
7814 (Sized_relobj::do_relocate_sections): New method declaration.
7815 (Sized_relobj::relocate_sections): Virtualize.
7816 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
7817 Sized_relobj::relocate_sections. Instantiate template explicitly
7818 for different target sizes and endianity.
7820 2009-10-24 Doug Kwan <dougkwan@google.com>
7822 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
7823 (Arm_input_section::as_arm_input_section): New method.
7824 (Arm_output_section): New class definition.
7825 (Arm_output_section::create_stub_group,
7826 Arm_output_section::group_sections): New method definitions.
7828 2009-10-22 Doug Kwan <dougkwan@google.com>
7830 * arm.cc (Arm_input_section): New class definition.
7831 (Arm_input_section::init, Arm_input_section:do_write,
7832 Arm_input_section::set_final_data_size,
7833 Arm_input_section::do_reset_address_and_file_offset): New method
7836 2009-10-21 Doug Kwan <dougkwan@google.com>
7838 * arm.cc (Stub_table, Arm_input_section): New forward class
7840 (Stub_table): New class defintion.
7841 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
7842 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
7843 New method definition.
7845 2009-10-21 Doug Kwan <dougkwan@google.com>
7847 * arm.cc: Update copyright comments.
7848 (Target_arm): New forward class template declaration.
7849 (Arm_address): New type.
7850 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
7851 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
7852 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
7854 (Insn_template): Same.
7855 (DEF_STUBS): New macro.
7856 (Stub_type): New enum type.
7857 (Stub_template): New class definition.
7860 (Stub_factory): Same.
7861 (Target_arm::Target_arm): Initialize may_use_blx_ and
7862 should_force_pic_veneer_.
7863 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
7864 Target_arm::should_force_pic_veneer,
7865 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
7866 Target_arm::using_thumb_only, Target_arm:;default_target): New
7868 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
7869 New data member declarations.
7870 (Insn_template::size, Insn_template::alignment): New method defintions.
7871 (Stub_template::Stub_template): New method definition.
7872 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
7873 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
7874 (Stub_factory::Stub_factory): New method definition.
7875 * gold.h (string_hash): New template.
7876 * output.h (Input_section_specifier::hash_value): Use
7878 (Input_section_specifier::string_hash): Remove.
7879 * stringpool.cc (Stringpool_template::string_hash): Use
7882 2009-10-20 Doug Kwan <dougkwan@google.com>
7884 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
7885 symbols of relaxed input sections.
7886 * output.h (Output_section::find_relaxed_input_section): Make
7889 2009-10-16 Doug Kwan <dougkwan@google.com>
7891 * dynobj.cc (Versions::Versions): Initialize version_script_.
7892 Only insert base version symbol definition for a shared object
7893 if version script defines any version versions.
7894 (Versions::define_base_version): New method definition.
7895 (Versions::add_def): Check that base version is not needed.
7896 (Versions::add_need): Define base version lazily.
7897 * dynobj.h (Versions::define_base_version): New method declaration.
7898 (Versions::needs_base_version_): New data member declaration.
7899 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
7900 (check_DATA): Add no_version_test.stdout.
7901 (libno_version_test.so, no_version_test.o no_version_test.stdout):
7903 * testsuite/Makefile.in: Regenerate.
7904 * testsuite/no_version_test.c: New file.
7905 * testsuite/no_version_test.sh: Ditto.
7907 2009-10-16 Doug Kwan <dougkwan@google.com>
7909 * expression.cc (class Segment_start_expression): New class definition.
7910 (Segment_start_expression::value): New method definition.
7911 (script_exp_function_segment_start): Return a new
7912 Segment_start_expression.
7913 * gold/script-c.h (script_saw_segment_start_expression): New function
7915 * script-sections.cc (Script_sections::Script_sections): Initialize
7916 SAW_SEGMENT_START_EXPRESSION_ to false.
7917 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
7918 and -Tbbs options to specify section addresses if given in
7919 command line and no SEGMENT_START expression is seen in a script.
7920 * script-sections.h (Script_sections::saw_segment_start_expression,
7921 Script_sections::set_saw_segment_start_expression): New method
7923 (Script_sections::saw_segment_start_expression_): New data member
7925 * script.cc (script_saw_segment_start_expression): New function.
7926 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
7927 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
7928 script_test_7.sh and script_test_8.sh.
7929 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
7930 script_test_8.stdout.
7931 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
7932 (script_test_6, script_test_6.stdout, script_test_7,
7933 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
7934 * Makefile.in: Regenerate.
7935 * testsuite/script_test_6.sh: New file.
7936 * testsuite/script_test_6.t: Same.
7937 * testsuite/script_test_7.sh: Same.
7938 * testsuite/script_test_7.t: Same.
7939 * testsuite/script_test_8.sh: Same.
7941 2009-10-16 Doug Kwan <dougkwan@google.com>
7943 * output.cc (Output_segment::set_section_list_address): Cast
7944 expressions to unsigned long long type to avoid format warnings.
7946 2009-10-15 Ian Lance Taylor <iant@google.com>
7948 * script.cc (Script_options::add_symbol_assignment): Always add a
7949 dot assignment to script_sections_.
7950 * script-sections.cc (Script_sections::add_dot_assignment):
7951 Initialize if necessary.
7953 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
7954 program headers with no load segment if there is a linker script.
7956 * layout.cc (Layout::set_segment_offsets): Align the file offset
7957 to the segment aligment for -N or -n with no load segment.
7958 * output.cc (Output_segment::add_output_section): Don't crash if
7959 the first section is a TLS section.
7960 (Output_segment::set_section_list_addresses): Print an error
7961 message if the address moves backward in a linker script.
7962 * script-sections.cc
7963 (Output_section_element_input::set_section_addresses): Don't
7964 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
7965 (Orphan_output_section::set_section_addresses): Likewise.
7967 2009-10-15 Doug Kwan <dougkwan@google.com>
7969 * layout.cc (Layout::finish_dynamic_section): Generate tags
7970 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
7971 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
7972 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
7974 2009-10-14 Ian Lance Taylor <iant@google.com>
7976 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
7978 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
7979 data_shdr fields of relinfo.
7980 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
7981 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
7982 R_386_TLS_LDO_32, adjust based on section flags.
7983 (Target_i386::Relocate::fix_up_ldo): Remove.
7985 2009-10-13 Ian Lance Taylor <iant@google.com>
7987 Add support for -pie.
7988 * options.h (class General_options): Add -pie and
7990 (General_options::output_is_position_independent): Test -pie.
7991 (General_options::output_is_executable): Return true if not shared
7992 and not relocatable.
7993 (General_options::output_is_pie): Remove.
7994 * options.cc (General_options::finalize): Reject incompatible uses
7996 * gold.cc (queue_middle_tasks): A -pie link is not static.
7997 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
7998 * symtab.cc (Symbol::final_value_is_known): Return false if
7999 output_is_position_independent.
8000 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
8001 output_is_position_independent.
8002 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
8003 output_is_position_independent.
8004 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
8005 output_is_position_independent.
8006 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
8008 (basic_pie_test.o, basic_pie_test): New targets.
8009 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
8010 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
8011 (two_file_pie_test): New target.
8012 * testsuite/Makefile.in: Rebuild.
8013 * README: Remove note saying that -pie is not supported.
8015 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
8017 * options.h (class General_options): Add -init and -fini.
8018 * layout.cc (Layout::finish_dynamic_section): Emit
8019 given init and fini functions.
8021 2009-10-13 Sriraman Tallam <tmsriram@google.com>
8023 * gc.h (gc_process_relocs): Check if icf is enabled using new
8025 * gold.cc (queue_initial_tasks): Likewise.
8026 (queue_middle_tasks): Likewise.
8027 * object.cc (do_layout): Likewise.
8028 * symtab.cc (is_section_folded): Likewise.
8029 * main.cc (main): Likewise.
8030 * reloc.cc (Read_relocs::run): Likewise.
8031 (Sized_relobj::do_scan_relocs): Likewise.
8032 * icf.cc (is_function_ctor_or_dtor): New function.
8033 (Icf::find_identical_sections): Check if function is ctor or dtor when
8035 * options.h (General_options::icf): Change option to be an enum.
8036 (Icf_status): New enum.
8037 (icf_enabled): New method.
8038 (icf_safe_folding): New method.
8039 (set_icf_status): New method.
8040 (icf_status_): New variable.
8041 * (options.cc) (General_options::finalize): Set icf_status_.
8042 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
8043 icf_test and icf_keep_unique_test to use the --icf enum flag.
8044 * testsuite/icf_safe_test.sh: New file.
8045 * testsuite/icf_safe_test.cc: New file.
8047 2009-10-12 Sriraman Tallam <tmsriram@google.com>
8049 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
8050 includes to gc.h and icf.h.
8051 * arm.cc: Include gc.h.
8052 * gold.cc: Likewise.
8053 * i386.cc: Likewise.
8054 * powerpc.cc: Likewise.
8055 * sparc.cc: Likewise.
8056 * x86_64.cc: Likewise.
8057 * gc.h: Include icf.h.
8059 2009-10-11 Ian Lance Taylor <iant@google.com>
8061 * plugin.cc: Include "gold.h" before other header files.
8063 2009-10-10 Chris Demetriou <cgd@google.com>
8065 * options.h (Input_file_argument::Input_file_type): New enum.
8066 (Input_file_argument::is_lib_): Replace with...
8067 (Input_file_argument::type_): New member.
8068 (Input_file_argument::Input_file_argument): Take Input_file_type
8069 'type' rather than boolean 'is_lib' as second argument.
8070 (Input_file_argument::is_lib): Use type_.
8071 (Input_file_argument::is_searched_file): New function.
8072 (Input_file_argument::may_need_search): Handle is_searched_file.
8073 * options.cc (General_options::parse_library): Support -l:filename.
8074 (General_options::parse_just_symbols): Update for Input_file_argument
8076 (Command_line::process): Likewise.
8077 * archive.cc (Archive::get_file_and_offset): Likewise.
8078 * plugin.cc (Plugin_manager::release_input_file): Likewise.
8079 * script.cc (read_script_file, script_add_file): Likewise.
8080 * fileread.cc (Input_file::Input_file): Likewise.
8081 (Input_file::will_search_for): Handle is_searched_file.
8082 (Input_file::open): Likewise.
8083 * readsyms.cc (Read_symbols::get_name): Likewise.
8084 * testsuite/Makefile.am (searched_file_test): New test.
8085 * testsuite/Makefile.in: Regenerate.
8086 * testsuite/searched_file_test.cc: New file.
8087 * testsuite/searched_file_test_lib.cc: New file.
8089 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8090 Ian Lance Taylor <iant@google.com>
8092 * descriptor.cc: Include <cstdio> and "binary-io.h".
8093 (Descriptors::open): Open the files in binary mode always.
8094 * script.cc (Lex::get_token): Treat \r as whitespace.
8096 2009-10-09 Ian Lance Taylor <iant@google.com>
8098 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
8100 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8101 Ian Lance Taylor <iant@google.com>
8103 * configure.ac: Check for readv function also.
8104 * fileread.cc (readv): Define if not HAVE_READV.
8105 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
8107 * config.in: Regenerate.
8108 * configure: Regenerate.
8110 2009-10-09 Doug Kwan <dougkwan@google.com>
8112 * layout.cc (Layout::make_output_section): Call target hook to make
8113 ordinary output section.
8114 (Layout::finalize): Adjust parameter list of call the
8115 Target::may_relax().
8116 * layout.h (class Layout::section_list): New method.
8117 * merge.h (Output_merge_base::entsize): Change visibility to public.
8118 (Output_merge_base::is_string, Output_merge_base::do_is_string):
8120 (Output_merge_string::do_is_string): New method.
8121 * object.cc (Sized_relobj::do_setup): renamed from
8122 Sized_relobj::set_up.
8123 * object.h (Sized_relobj::adjust_shndx,
8124 Sized_relobj::initializ_input_to_output_maps,
8125 Sized_relobj::free_input_to_output_maps): Change visibilities to
8127 (Sized_relobj::setup): Virtualize.
8128 (Sized_relobj::do_setup): New method declaration.
8129 (Sized_relobj::invalidate_section_offset,
8130 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
8131 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
8132 * options.cc (parse_int): New function.
8133 * options.h (parse_int): New declaration.
8134 (DEFINE_int): New macro.
8135 (stub_group_size): New option.
8136 * output.cc (Output_section::Output_section): Initialize memebers
8137 merge_section_map_, merge_section_by_properties_map_,
8138 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
8139 (Output_section::add_input_section): Handled deferred code-fill
8140 generation and remove an old comment.
8141 (Output_section::add_relaxed_input_section): New method definition.
8142 (Output_section::add_merge_input_section): Use merge section by
8143 properties map to speed to search. Update merge section maps
8145 (Output_section::build_relaxation_map): New method definition.
8146 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8148 (Output_section::relax_input_section): Renamed to
8149 Output_section::convert_input_sections_to_relaxed_sections and change
8150 interface to take a vector of pointers to relaxed sections.
8151 (Output_section::find_merge_section,
8152 Output_section::find_relaxed_input_section): New method definitions.
8153 (Output_section::is_input_address_mapped,
8154 Output_section::output_offset, Output_section::output_address):
8155 Use output section data maps to speed up searching.
8156 (Output_section::find_starting_output_address): Add comments.
8157 (Output_section::do_write,
8158 Output_section::write_to_postprocessing_buffer): Do code-fill
8159 generation as appropriate.
8160 (Output_section::get_input_sections): Invalidate relaxed input section
8162 (Output_section::restore_states): Adjust type of checkpoint .
8163 Invalidate relaxed input section map.
8164 * output.h (Output_merge_base): New class declaration.
8165 (Input_section_specifier): New class defintion.
8166 (class Output_relaxed_input_section) Change base class to
8167 Output_section_data_build.
8168 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
8169 base class initializer.
8170 (Output_section::add_relaxed_input_section): New method declaration.
8171 (Output_section::Input_section): Change visibility to protected.
8172 (Output_section::Input_section::relobj,
8173 Output_section::Input_section::shndx): Handle relaxed input sections.
8174 Output_section::input_sections) Change visibility to protected. Also
8175 define overload to return a non-const pointer.
8176 (Output_section::Merge_section_properties): New class defintion.
8177 (Output_section::Merge_section_by_properties_map,
8178 Output_section::Output_section_data_by_input_section_map,
8179 Output_section::Relaxation_map): New types.
8180 (Output_section::relax_input_section): Rename method to
8181 Output_section::convert_input_sections_to_relaxed_sections and change
8182 interface to take a vector of relaxed section pointers.
8183 (Output_section::find_merge_section,
8184 Output_section::find_relaxed_input_section,
8185 Output_section::build_relaxation_map,
8186 Output_section::convert_input_sections_in_list_to_relaxed_sections):
8187 New method declarations.
8188 (Output_section::merge_section_map_
8189 Output_section::merge_section_by_properties_map_,
8190 Output_section::relaxed_input_section_map_,
8191 Output_section::is_relaxed_input_section_map_valid_,
8192 Output_section::generate_code_fills_at_write_): New data members.
8193 * script-sections.cc
8194 (Output_section_element_input::set_section_addresses): Call
8195 current_data_size and addralign methods of relaxed input sections.
8196 (Orphan_output_section::set_section_addresses): Call current_data_size
8197 and addralign methods of relaxed input sections.
8198 * symtab.cc (Symbol_table::compute_final_value): Extract template
8199 from the body of Symbol_table::sized_finalize_symbol.
8200 (Symbol_table::sized_finalized_symbol): Call
8201 Symbol_table::compute_final_value.
8202 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
8203 (Symbol_table::compute_final_value): New templated method declaration.
8204 * target.cc (Target::do_make_output_section): New method defintion.
8205 * target.h (Target::make_output_section): New method declaration.
8206 (Target::relax): Add more parameters for input objects, symbol table
8207 and layout. Adjust call to do_relax.
8208 (Target::do_make_output_section): New method declaration.
8209 (Target::do_relax): Add parameters for input objects, symbol table
8212 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8214 * pread.c: Include stdio.h.
8216 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8218 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
8221 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8223 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8224 Change read_shndx type to unsigned int.
8225 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8227 (Sized_dwarf_line_info::read_line_mappings): Likewise.
8228 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
8229 Change read_shndx type to unsigned int.
8230 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8232 (Sized_dwarf_line_info::read_line_mappings): Likewise.
8233 * layout.cc (Layout::create_symtab_sections): Cast the result of
8234 local_symcount * symsize to off_t in the gold_assert.
8236 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8238 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
8239 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
8241 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
8242 (Arm_relocate_functions::thm_abs5): New function.
8243 (Arm_relocate_functions::abs12): New function.
8244 (Arm_relocate_functions::abs16): New function.
8245 (Arm_relocate_functions::base_abs): New function.
8246 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
8247 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
8248 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
8250 (Scan::global): Likewise.
8251 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
8252 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
8253 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
8254 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
8257 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8259 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
8260 (Arm_relocate_functions::movt_prel): New function.
8261 (Arm_relocate_functions::thm_movw_prel_nc): New function.
8262 (Arm_relocate_functions::thm_movt_prel): New function.
8263 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8264 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8265 (Scan::global, Relocate::relocate): Likewise.
8266 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8268 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8270 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8271 Incremental_checker.
8272 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8274 (class Incremental_inputs_header): New class.
8275 (Incremental_inputs_header_writer): Edit comment.
8276 (Incremental_inputs_entry): New class.
8277 (Incremental_inputs_entry_writer): Edit comment.
8278 (Sized_incremental_binary::do_find_incremental_inputs_section):
8279 Add *strtab_shndx parameter, fill it.
8280 (Sized_incremental_binary::do_check_inputs): New method.
8281 (Incremental_checker::can_incrementally_link_output_file): Use
8282 Sized_incremental_binary::check_inputs.
8283 (Incremental_inputs::report_command_line): Save command line in
8286 (Incremental_binary::find_incremental_inputs_section): New
8288 (Incremental_binary::do_find_incremental_inputs_section): Add
8289 strtab_shndx parameter.
8290 (Incremental_binary::do_check_inputs): New pure virtual method.
8291 (Sized_incremental_binary::do_check_inputs): Declare.
8292 (Incremental_checker::Incremental_checker): Add incremental_inputs
8293 parameter, use it to initialize incremental_inputs_.
8294 (Incremental_checker::incremental_inputs_): New field.
8295 (Incremental_checker::command_line): New method.
8296 (Incremental_checker::inputs): New method.
8297 (Incremental_checker::command_line_): New field.
8299 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8301 * incremental.cc: Include <cstdarg> and "target-select.h".
8302 (vexplain_no_incremental): New function.
8303 (explain_no_incremental): New function.
8304 (Incremental_binary::error): New method.
8305 (Sized_incremental_binary::do_find_incremental_inputs_section): New
8307 (make_sized_incremental_binary): New function.
8308 (open_incremental_binary): New function.
8309 (can_incrementally_link_file): Add checks if output is ELF and has
8311 * incremental.h: Include "elfcpp_file.h" and "output.h".
8312 (Incremental_binary): New class.
8313 (Sized_incremental_binary): New class.
8314 (open_incremental_binary): Declare.
8315 * object.cc (is_elf_object): Use
8316 elfcpp::Elf_recognizer::is_elf_file.
8317 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
8318 * output.h (Output_file::filesize): New method.
8320 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8322 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
8324 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
8325 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
8327 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
8329 (Arm_relocate_functions::movw_abs_nc): New function.
8330 (Arm_relocate_functions::movt_abs): New function.
8331 (Arm_relocate_functions::thm_movw_abs_nc): New function.
8332 (Arm_relocate_functions::thm_movt_abs): New function.
8333 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
8334 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
8335 (Scan::global): Likewise.
8336 (Relocate::relocate): Likewise.
8337 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8339 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8341 * arm.cc (Arm_relocate_functions::got_prel) New function.
8342 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
8343 (Relocate::relocate): Likewise.
8344 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8346 2009-10-06 Ian Lance Taylor <iant@google.com>
8348 * options.h (class General_options): Define
8349 split_stack_adjust_size parameter.
8350 * object.h (class Object): Add uses_split_stack_ and
8351 has_no_split_stack_ fields. Add uses_split_stack and
8352 has_no_split_stack accessor functions. Declare
8353 handle_split_stack_section.
8354 (class Reloc_symbol_changes): Define.
8355 (class Sized_relobj): Define Function_offsets. Declare
8356 split_stack_adjust, split_stack_adjust_reltype, and
8358 * object.cc (Object::handle_split_stack_section): New function.
8359 (Sized_relobj::do_layout): Call handle_split_stack_section.
8360 * dynobj.cc (Sized_dynobj::do_layout): Call
8361 handle_split_stack_section.
8362 * reloc.cc (Sized_relobj::relocate_sections): Call
8363 split_stack_adjust for executable sections in split_stack
8364 objects. Pass reloc_map to relocate_section.
8365 (Sized_relobj::split_stack_adjust): New function.
8366 (Sized_relobj::split_stack_adjust_reltype): New function.
8367 (Sized_relobj::find_functions): New function.
8368 * target-reloc.h: Include "object.h".
8369 (relocate_section): Add reloc_symbol_changes parameter. Change
8371 * target.h (class Target): Add calls_non_split method. Declare
8372 do_calls_non_split virtual method. Declare match_view and
8374 * target.cc: Include "elfcpp.h".
8375 (Target::do_calls_non_split): New function.
8376 (Target::match_view): New function.
8377 (Target::set_view_to_nop): New function.
8378 * gold.cc (queue_middle_tasks): Give an error if mixing
8379 split-stack and non-split-stack objects with -r.
8380 * i386.cc (Target_i386::relocate_section): Add
8381 reloc_symbol_changes parameter.
8382 (Target_i386::do_calls_non_split): New function.
8383 * x86_64.cc (Target_x86_64::relocate_section): Add
8384 reloc_symbol_changes parameter.
8385 (Target_x86_64::do_calls_non_split): New function.
8386 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
8388 * powerpc.cc (Target_powerpc::relocate_section): Add
8389 reloc_symbol_changes parameter.
8390 * sparc.cc (Target_sparc::relocate_section): Add
8391 reloc_symbol_changes parameter.
8392 * configure.ac: Call AM_CONDITIONAL for the default target.
8393 * configure: Rebuild.
8394 * testsuite/Makefile.am (TEST_AS): New variable.
8395 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
8396 (check_DATA): Add split_i386 and split_x86_64 files.
8397 (SPLIT_DEFSYMS): Define.
8398 (split_i386_[1234n].o): New targets.
8399 (split_i386_[124]): New targets.
8400 (split_i386_[1234r].stdout): New targets.
8401 (split_x86_64_[1234n].o): New targets.
8402 (split_x86_64_[124]): New targets.
8403 (split_x86_64_[1234r].stdout): New targets.
8404 (MOSTLYCLEANFILES): Add new executables.
8405 * testsuite/split_i386.sh: New file.
8406 * testsuite/split_x86_64.sh: New file.
8407 * testsuite/split_i386_1.s: New file.
8408 * testsuite/split_i386_2.s: New file.
8409 * testsuite/split_i386_3.s: New file.
8410 * testsuite/split_i386_4.s: New file.
8411 * testsuite/split_i386_n.s: New file.
8412 * testsuite/split_x86_64_1.s: New file.
8413 * testsuite/split_x86_64_2.s: New file.
8414 * testsuite/split_x86_64_3.s: New file.
8415 * testsuite/split_x86_64_4.s: New file.
8416 * testsuite/split_x86_64_n.s: New file.
8417 * testsuite/testfile.cc (Target_test): Update relocation_section
8419 * testsuite/Makefile.in: Rebuild.
8421 2009-10-06 Ian Lance Taylor <iant@google.com>
8423 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
8424 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
8425 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
8426 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
8427 the address on ldo_addrs_.
8428 (Target_i386::Relocate::fix_up_ldo): New function.
8430 2009-10-06 Rafael Espindola <espindola@google.com>
8432 * plugin.cc (add_input_library): New.
8433 (Plugin::load): Add add_input_library to tv.
8434 (Plugin_manager::add_input_file): Add the is_lib argument.
8435 (add_input_file): Update call to Plugin_manager::add_input_file.
8436 (add_input_library): New.
8437 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
8439 2009-09-30 Doug Kwan <dougkwan@google.com>
8441 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
8442 symbol and call Symbol::may_need_copy_reloc to determine if
8443 a copy reloc is needed.
8444 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
8445 nocopyreloc is given in command line.
8446 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
8447 given in command line.
8448 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
8449 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
8450 of the removed Target_i386::may_need_copy_reloc.
8451 * options.h (copyreloc): New option with default value false.
8452 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8453 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
8454 instead of the removed Target_powerpc::may_need_copy_reloc.
8455 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8456 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
8457 instead of the removed Target_sparc::may_need_copy_reloc.
8458 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
8459 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
8460 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
8461 instead of the removed Target_x86_64::may_need_copy_reloc.
8463 2009-09-30 Ian Lance Taylor <iant@google.com>
8465 * object.h (class Object): Remove target_ field, and target,
8466 sized_target, and set_target methods.
8467 (Object::sized_target): Remove.
8468 (class Sized_relobj): Update declarations. Remove sized_target.
8469 * object.cc (Sized_relobj::setup): Remove target parameter.
8471 (Input_objects::add_object): Don't do anything with the target.
8472 (make_elf_sized_object): Add punconfigured parameter. Change all
8473 callers. Set or test parameter target.
8474 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
8476 * parameters.cc (Parameters::set_target): Change parameter type to
8478 (Parameters::default_target): Remove.
8479 (set_parameters_target): Change parameter type to be non-const.
8480 (parameters_force_valid_target): New function.
8481 (parameters_clear_target): New function.
8482 * parameters.h (class Parameters): Update declarations. Remove
8483 default_target method. Add sized_target and clear_target
8484 methods. Change target_ to be non-const.
8485 (set_parameters_target): Update declaration.
8486 (parameters_force_valid_target): Declare.
8487 (parameters_clear_target): Declare.
8488 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
8489 as NULL if we aren't searching.
8490 (Add_symbols::run): Don't check for compatible target.
8491 * fileread.cc (Input_file::open_binary): Call
8492 parameters_force_valid_target.
8493 * gold.cc (queue_middle_tasks): Likewise.
8494 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
8495 set_target on object.
8496 * dynobj.h (class Sized_dynobj): Update declarations.
8497 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
8498 make_elf_object returns NULL.
8499 (Archive::include_member): Don't check whether object target is
8501 * output.cc (Output_section::add_input_section): Get target from
8503 (Output_section::relax_input_section): Likewise.
8504 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
8506 (Sized_relobj::do_scan_relocs): Likewise.
8507 (Sized_relobj::relocate_sections): Likewise.
8508 * resolve.cc (Symbol_table::resolve): Likewise.
8509 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
8510 parameter. Change all callers.
8511 (Symbol_table::add_from_object): Get target from parameters.
8512 (Symbol_table::add_from_relobj): Don't check object target.
8513 (Symbol_table::add_from_dynobj): Likewise.
8514 (Symbol_table::define_special_symbol): Get target from
8516 * symtab.h (class Symbol_table): Update declaration.
8517 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
8518 parameter. Change all callers. Clear parameter target.
8519 (Binary_test): Test target here.
8520 * testsuite/object_unittest.cc (gold_testsuite): Remove
8521 target_test_pointer parameter. Change all callers.
8522 (Object_test): Test target here.
8524 2009-09-26 Ian Lance Taylor <iant@google.com>
8526 * testsuite/initpri1.c: Don't try to use constructor priorities if
8527 compiling with gcc before 4.3.
8529 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
8531 * testsuite/retain_symbols_file_test.sh (check_present): Change
8532 output file name to retain_symbols_file_test.stdout.
8533 (check_absent): Likewise.
8535 2009-09-18 Craig Silverstein <csilvers@google.com>
8537 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
8538 * options.cc: Include <cerrno> and <fstream>.
8539 (General_options::finalize): Parse -retain-symbols-file tag.
8540 * options.h: New flag.
8541 (General_options): New method should_retain_symbol, new
8542 variable symbols_to_retain.
8543 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
8544 should_retain_symbol map.
8545 * testsuite/Makefile.am (retain_symbols_file_test): New test.
8546 * testsuite/Makefile.in: Regenerate.
8547 * testsuite/retain_symbols_file_test.sh: New file.
8549 2009-09-18 Nick Clifton <nickc@redhat.com>
8551 * po/es.po: Updated Spanish translation.
8553 2009-09-17 Doug Kwan <dougkwan@google.com>
8555 * debug.h (DEBUG_RELAXATION): New constant.
8556 (DEBUG_ALL): Add DEBUG_RELAXATION.
8557 (debug_string_to_enum): Add relaxation debug option.
8559 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
8560 Layout::Relaxation_debug_check::read_sections,
8561 Layout::Relaxation_debug_check::read_sections): New method definitions.
8562 (Layout::Layout): Initialize data members
8563 record_output_section_data_from_scrips_,
8564 script_output_section_data_list_ and relaxation_debug_check_.
8565 (Layout::save_segments, Layout::restore_segments,
8566 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8567 Layout::relaxation_loop_body): New method definitions.
8568 (Layout::finalize): Support relaxation. Move section layout code to
8569 Layout::relaxation_loop_body.
8570 (Layout::set_asection_address_from_script): Move code for orphan
8571 section placement out.
8572 (Layout::place_orphan_sections_in_script): New method definition.
8573 * layout.h (Output_segment_headers, Output_file_header):
8574 New forward class declarations.
8575 (Layout::~Layout): Define.
8576 (Layout::new_output_section_data_from_script): New method definition.
8577 (Layout::place_orphan_sections_in_script): New method declaration.
8578 (Layout::Segment_states): New type declaration.
8579 (Layout::save_segments, Layout::restore_segments,
8580 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8581 Layout::relaxation_loop_body): New method declarations.
8582 (Layout::Output_section_data_list): New type declaration.
8583 (Layout::Relaxation_debug_check): New class definition.
8584 (Layout::record_output_section_data_from_script_,
8585 Layout::script_output_section_data_list_, Layout::segment_states_,
8586 Layout::relaxation_debug_check_): New data members.
8587 * output.cc: (Output_section_headers::do_size): New method definition.
8588 (Output_section_headers::Output_section_headers): Move size
8589 computation to Output_section_headers::do_size.
8590 (Output_segment_headers::do_size): New method definition.
8591 (Output_file_header::Output_file_header): Move size computation to
8592 Output_file_header::do_size and call it.
8593 (Output_file_header::do_size): New method definition.
8594 (Output_data_group::Output_data_group): Adjust call to
8595 Output_section_data.
8596 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
8597 (Output_symtab_xindex::do_write): Add array bound check.
8598 (Output_section::Input_section::print_to_mapfile): Handle
8599 RELAXED_INPUT_SECTION_CODE.
8600 (Output_section::Output_section): Initialize data member checkpoint_.
8601 (Output_section::~Output_section): Delete checkpoint object pointed
8603 (Output_section::add_input_section): Always add an Input_section if
8605 (Output_section::add_merge_input_section): Add assert.
8606 (Output_section::relax_input_section): New method definition.
8607 (Output_section::set_final_data_size): Set load address to zero for
8608 an unallocated section.
8609 (Output_section::do_address_and_file_offset_have_reset_values):
8610 New method definition.
8611 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
8612 Handle relaxed input section.
8613 (Output_section::sort_attached_input_sections): Checkpoint input
8614 section list lazily.
8615 (Output_section::get_input_sections): Change type of input_sections to
8616 list of Simple_input_section pointers. Checkpoint input section list
8617 lazily. Also handle relaxed input sections.
8618 (Output_section::add_input_section_for_script): Take a reference to
8619 a Simple_input_section object instead of Relobj pointer and section
8620 index as parameter. Handle relaxed input sections.
8621 (Output_section::save_states, Output_section::restore_states): New
8623 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
8624 (Output_data::is_data_size_fixed): New method definition.
8625 (Output_data::reset_addresss_and_file_offset): Do not reset data size
8627 (Output_data::address_and_file_offset_have_reset_values): New method
8629 (Output_data::do_address_and_file_offset_have_reset_values): New method
8631 (Output_data::set_data_size): Check that data size is not fixed.
8632 (Output_data::fix_data_size): New method definition.
8633 (Output_data::is_data_size_fixed_): New data member.
8634 (Output_section_headers::set_final_data_size): New method definition.
8635 (Output_section_headers::do_size): New method declaration.
8636 (Output_segment_headers::set_final_data_size): New method definition.
8637 (Output_segment_headers::do_size): New method declaration.
8638 (Output_file_header::set_final_data_size)::New method definition.
8639 (Output_file_header::do_size)::New method declaration.
8640 (Output_section_data::Output_section_data): Add new parameter
8641 is_data_size_fixed and use it to fix data size.
8642 (Output_data_const::Output_data_const): Adjust call to base class
8643 constructor and fix data size.
8644 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
8645 base class constructor and fix data size.
8646 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
8647 base class constructor and fix data size.
8648 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
8649 class constructor and fix data size.
8650 (Output_data_group::set_final_data_size): New method definition.
8651 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
8652 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
8653 class constructor and fix data size.
8654 (Output_relaxed_input_section): New class definition.
8655 (Output_section::Simple_input_section): New class definition.
8656 (Output_section::get_input_sections): Adjust parameter list.
8657 (Output_section::add_input_section_for_script): Same.
8658 (Output_section::save_states, Output_section::restore_states,
8659 Output_section::do_address_and_file_offset_have_reset_values,
8660 (Output_section::Input_section::Input_section): Handle
8661 RELAXED_INPUT_SECTION_CODE. Add new overload for
8662 Output_relaxed_input_section.
8663 (Output_section::Input_section::is_input_section,
8664 Output_section::Input_section::set_output_section): Handle relaxed
8666 (Output_section::Input_section::is_relaxed_input_section,
8667 Output_section::Input_section::output_section_data,
8668 Output_section::Input_section::relaxed_input_section): New method
8670 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
8672 (Output_section::Input_section::u1_): Update comments.
8673 (Output_section::Input_section::u2_): Add new union member poris.
8674 (Output_section::Checkpoint_output_section): New classs definition.
8675 (Output_section::relax_input_section): New method declaration.
8676 (Output_section::checkpoint_): New data member.
8677 (Output_segment): Update comments.
8678 (Output_segment::Output_segment): Un-privatize copy constructor.
8679 (Output_segment::operator=): Un-privatize.
8680 * script-sections.cc (Output_section_element::Input_section_list):
8681 Change element type to Output_section::Simple_input_section.
8682 (Output_section_element_dot_assignment::set_section_addresses):
8683 Register output section data for relaxation clean up.
8684 (Output_data_exression::Output_data_expression): Adjust call to base
8685 constructor to fix data size.
8686 (Output_section_element_data::set_section_addresses): Register
8687 Output_data_expression object for relaxation clean up.
8688 (struct Input_section_info): Replace Relobj pointer and section index
8689 pair with Output_section::Simple_input_section and Convert struct to a
8691 (Input_section_sorter::operator()): Adjust access to
8692 Input_section_info data member to use accessors.
8693 (Output_section_element_input::set_section_addresses): Use layout
8694 parameter. Adjust code to use Output_section::Simple_input_section
8695 and Input_secction_info classes. Register filler for relaxation
8697 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
8698 and section index pair with Output_section::Simple_input_section
8699 class. Adjust code accordingly.
8700 (Phdrs_element::release_segment): New method definition.
8701 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
8703 (Script_sections::release_segments): New method definition.
8704 * gold/script-sections.h (Script_sections::release_segments): New
8706 * gold/target.h (Target::may_relax, Target::relax,
8707 Target::do_may_relax, Target::do_relax): New method definitions.
8709 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8711 * arm.cc (has_signed_unsigned_overflow): New function.
8712 (Arm_relocate_functions::abs8): New function.
8713 (Target_arm::Scan::local): Handle R_ARM_ABS8.
8714 (Target_arm::Scan::global): Likewise.
8715 (Target_arm::relocate::relocate): Likewise.
8716 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8719 2009-09-16 Cary Coutant <ccoutant@google.com>
8721 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
8722 * testsuite/Makefile.in: Regenerate.
8724 2009-09-11 Nick Clifton <nickc@redhat.com>
8726 * po/gold.pot: Updated by the Translation project.
8728 2009-09-08 Cary Coutant <ccoutant@google.com>
8730 * output.cc (Output_file::open): Add execute permission to empty file.
8731 * testsuite/Makefile.am (permission_test): New test.
8732 * testsuite/Makefile.in: Regenerate.
8734 2009-09-02 Ian Lance Taylor <iant@google.com>
8736 * output.cc (Output_file::resize): Call map_no_anonymous rather
8739 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
8741 * gold.cc: Include "incremental.h".
8742 (queue_initial_tasks): Call Incremental_checker methods.
8743 * incremental.cc: Include "output.h".
8744 (Incremental_checker::can_incrementally_link_output_file): New
8746 * incremental.h (Incremental_checker): New class.
8748 * output.cc (Output_file::open_for_modification): New method.
8749 (Output_file::map_anonymous): Changed return type to bool. Record
8751 (Output_file::map_no_anonymous): New method, broken out of map.
8752 (Output_file::map): Use map_no_anonymous and map_anonymous.
8753 * output.h (class Output_file): Update declarations.
8755 2009-08-24 Cary Coutant <ccoutant@google.com>
8757 * options.h (Command_line::Pre_options): New class.
8758 (Command_line::pre_options): New member.
8759 * options.cc (gold::options::ready_to_register): New variable.
8760 (One_option::register_option): Do nothing if not registering options.
8761 Assert if same short option registered twice.
8762 (General_options::General_options): Turn off option registration when
8764 (Command_line::Pre_options::Pre_options): New constructor.
8766 2009-08-24 Cary Coutant <ccoutant@google.com>
8768 * options.h (General_options::no_keep_memory): Remove incorrect
8771 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8773 * Makefile.am (am__skiplex, am__skipyacc): New.
8774 * Makefile.in: Regenerate.
8776 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8778 * Makefile.am (AM_CPPFLAGS): Renamed from ...
8779 (INCLUDES): ... this.
8780 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
8781 (AM_CPPFLAGS): Renamed from ...
8782 (INCLUDE): ... this.
8783 * Makefile.in, testsuite/Makefile.in: Regenerate.
8785 * Makefile.in: Regenerate.
8786 * aclocal.m4: Likewise.
8787 * config.in: Likewise.
8788 * configure: Likewise.
8789 * testsuite/Makefile.in: Likewise.
8791 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8792 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8793 * Makefile.in: Regenerate.
8794 * testsuite/Makefile.in: Regenerate.
8796 2009-08-19 Cary Coutant <ccoutant@google.com>
8798 * resolve.cc (Symbol_table::resolve): Don't complain about defined
8799 symbols in shared libraries overridden by hidden or internal symbols
8800 in the main program.
8802 2009-08-19 Chris Demetriou <cgd@google.com>
8804 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
8805 checking source file names in error messages.
8807 2009-08-18 Doug Kwan <dougkwan@google.com>
8809 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
8810 an elcpp::Ehdr as parameter. Adjust call to set_target.
8811 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
8812 an elfcpp::Ehdr as parameter.
8813 * object.cc (Object::set_target): Remove the version that looks up
8814 a target and sets it.
8815 (Sized_relobj::setup): Take a Target object instead of
8816 an elfcpp::Ehdr as parameter. Adjust call to set_target.
8817 (make_elf_sized_object): Find target and ask target to
8819 * object.h: (Object::set_target): Remove the version that looks up
8820 a target and sets it.
8821 (Sized_relobj::setup): Take a Target object instead of
8822 an elfcpp:Ehdr as parameter.
8823 * target.cc: Include dynobj.h.
8824 (Target::do_make_elf_object_implementation): New.
8825 (Target::do_make_elf_object): New.
8826 * target.h (Target::make_elf_object): New template declaration.
8827 (Target::do_make_elf_object): New method declarations.
8828 (Target::do_make_elf_object_implementation): New template declaration.
8830 2009-08-14 Ian Lance Taylor <iant@google.com>
8832 * gold.h (FUNCTION_NAME): Define.
8833 (gold_unreachable): Use FUNCTION_NAME.
8835 2009-08-12 Sriraman Tallam <tmsriram@google.com>
8837 * icf.cc (Icf::find_identical_sections): Issue a warning when a
8838 symbol in the --keep-unique list is not found.
8840 2009-08-12 Sriraman Tallam <tmsriram@google.com>
8842 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
8843 been maked as --keep-unique.
8844 (Icf::unfold_section): New function.
8845 * icf.h (Icf::unfold_section): New function.
8846 * options.h (General_options::keep_unique): New option.
8847 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
8848 * testsuite/Makefile.in: Regenerate.
8849 * testsuite/icf_keep_unique_test.sh: New file.
8850 * testsuite/icf_keep_unique_test.cc: New file.
8852 2009-08-12 Cary Coutant <ccoutant@google.com>
8855 * resolve.cc (Symbol_table::resolve): Check for references from
8856 dynamic objects to hidden and internal symbols.
8857 * testsuite/Makefile.am (hidden_test.sh): New test.
8858 * testsuite/Makefile.in: Regenerate.
8859 * testsuite/hidden_test.sh: New script.
8860 * testsuite/hidden_test_1.c: New test source.
8861 * testsuite/hidden_test_main.c: New test source.
8863 2009-08-11 Doug Kwan <dougkwan@google.com>
8865 * arm.cc: Update comments.
8866 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
8867 segment to locate the .ARM.exidx section if present.
8869 2009-08-09 Doug Kwan <dougkwan@google.com>
8871 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
8874 2009-08-07 Sriraman Tallam <tmsriram@google.com>
8875 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
8878 2009-08-06 Sriraman Tallam <tmsriram@google.com>
8880 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
8881 valid tls_segment only for non-debug-section relocations.
8882 * testsuite/Makefile.am: Add gc_tls_test.
8883 * testsuite/Makefile.in: Regenerate.
8884 * testsuite/gc_tls_test.cc: New file.
8885 * testsuite/gc_tls_test.sh: New file.
8887 2009-08-05 Sriraman Tallam <tmsriram@google.com>
8891 * Makefile.am (CCFILES): Add icf.cc.
8893 * Makefile.in: Regenerate.
8894 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
8895 * gc.h (gc_process_relocs): Populate lists used by icf to contain
8896 section, symbol and addend information for the relocs.
8897 * gold.cc (queue_middle_tasks): Call identical code folding.
8898 * gold.h: Add defines for multimap.
8899 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
8900 to the call of finalize_local_symbols.
8901 * main.cc (main): Create object of class Icf.
8902 * object.cc (Sized_relobj::do_layout): Allow this function to be
8903 called twice during icf.
8904 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
8905 to sections marked as identical by icf.
8906 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
8908 (Sized_relobj::do_section_entsize): New function.
8909 * object.h (Object::section_entsize): New function.
8910 (Object::do_section_entsize): New pure virtual function.
8911 (Relobj::finalize_local_symbols): Add new parameter.
8912 (Relobj::do_section_entsize): New function.
8913 * options.h (General_options::icf): New option.
8914 (General_options::icf_iterations): New option.
8915 (General_options::print_icf_sections): New option.
8916 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
8917 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
8918 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
8920 * symtab.cc (Symbol_table::is_section_folded): New function.
8921 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
8922 to sections marked as identical by icf.
8923 * symtab.h (Symbol_table::set_icf): New function.
8924 (Symbol_table::icf): New function.
8925 (Symbol_table::is_section_folded): New function.
8926 (Symbol_table::icf_): New data member.
8927 * target-reloc.h (relocate_section): Ignore sections folded by icf.
8928 * testsuite/Makefile.am: Add commands to build icf_test.
8929 * testsuite/Makefile.in: Regenerate.
8930 * testsuite/icf_test.sh: New file.
8931 * testsuite/icf_test.cc: New file.
8933 2009-07-24 Chris Demetriou <cgd@google.com>
8935 * layout.cc (is_compressible_debug_section): Fix incorrect
8936 comment about compressed section names.
8938 2009-07-20 Ian Lance Taylor <ian@airs.com>
8941 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
8943 2009-07-16 Ian Lance Taylor <iant@google.com>
8946 * layout.h: #include <map>.
8947 (class Kept_section): Change from struct to class. Add accessors
8948 and setters. Add section size to Comdat_group mapping. Change
8949 Comdat_group to std::map. Add is_comdat_ field. Add
8950 linkonce_size field in union.
8951 (class Layout): Update declaration of find_or_add_kept_section.
8952 Don't declare find_kept_object.
8953 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
8954 parameter. Add object, shndx, is_comdat, and is_group_name
8955 parameters. Change all callers. Adjust for new Kept_section.
8956 (Layout::find_kept_object): Remove.
8957 * object.cc (Sized_relobj::include_section_group): Update use of
8958 Kept_section. Rename secnum to shndx. Only record
8959 Kept_comdat_section if sections are the same size.
8960 (Sized_relobj::include_linkonce_section): Update use of
8961 Kept_section. Only record Kept_comdat_section if sections are the
8962 same size. Set size of linkonce section.
8963 (Sized_relobj::map_to_kept_section): Update call to
8964 get_kept_comdat_section.
8965 * object.h (class Sized_relobj): Rename fields in
8966 Kept_comdat_section to drop trailing underscores; change object
8967 field to Relobj*. Change Kept_comdat_section_table to store
8968 struct rather than pointer.
8969 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
8970 Add kept_object and kept_shndx parameters. Change all callers.
8971 (Sized_relobj::get_kept_comdat_section): Change return type to
8972 bool. Add kept_object and kept_shndx parameters. Change all
8974 * plugin.cc (Pluginobj::include_comdat_group): Update call to
8975 Layout::find_or_add_kept_section.
8977 2009-07-09 Ian Lance Taylor <iant@google.com>
8979 * merge.cc (Object_merge_map::initialize_input_to_output_map):
8980 Reserve space in the hash table.
8982 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
8984 * fileread.cc (File_read::get_mtime): New method.
8985 * fileread.h (Timespec): New structure.
8986 (File_read::get_mtime): New method.
8987 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
8988 Renamed from timestamp_nsec.
8989 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
8991 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
8993 (Incremental_inputs::report_archive): Save mtime; style fix.
8994 (Incremental_inputs::report_obejct): Save mtime; style fix.
8995 (Incremental_inputs::report_script): Save mtime; style fix.
8996 (Incremental_inputs::finalize_inputs): Style fix.
8997 (Incremental_inputs::finalize): Style fix.
8998 (Incremental_inputs::create_input_section_data): Store inputs
9000 * incremental.h (Incremental_inputs::report_script): Add mtime
9002 (Incremental_inputs::Input_info::Input_info): Intialize only one
9004 (Incremental_inputs::Input_info::archive): Move to nameless
9006 (Incremental_inputs::Input_info::obejct): Move to nameless union.
9007 (Incremental_inputs::Input_info::script): Move to nameless union.
9008 (Incremental_inputs::mtime): New field.
9009 * script.cc (read_input_script): Pass file mtime to
9011 * script.h (Script_info::inputs): Style fix.
9013 2009-07-01 Ian Lance Taylor <ian@airs.com>
9015 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
9018 2009-06-24 Ian Lance Taylor <iant@google.com>
9021 * layout.cc (Layout::choose_output_section): If we find an
9022 existing section, update the flags.
9023 (Layout::create_notes): New function, broken out of
9025 (Layout::finalize): Don't create note sections.
9026 (Layout::create_note): Don't crash if linker script discards
9028 (Layout::create_gold_note): Likewise.
9029 (Layout::create_build_id): Likewise. Don't set
9030 after_input_sections on the section.
9031 (Layout::create_executable_stack_info): Remove target parameter.
9033 * layout.h (class Layout): Declare create_notes. Update
9034 declaration of create_executable_stack_info.
9035 * gold.cc (queue_middle_tasks): Call create_notes.
9036 * output.cc (Output_section::update_flags_for_input_section): Move
9037 here from output.h. If SHF_ALLOC flag is newly set, mark address
9039 * output.h (Output_data::mark_address_invalid): New function.
9040 (class Output_section): Only declare, not define,
9041 update_flags_for_input_section. Remove set_flags.
9043 2009-06-24 Ian Lance Taylor <iant@google.com>
9045 * script-sections.cc (Output_section_definition::
9046 set_section_addresses): Rename shadowing local load_address to
9049 2009-06-24 Ian Lance Taylor <iant@google.com>
9052 * reloc.cc (relocate_sections): Skip empty relocation sections.
9054 2009-06-23 Ian Lance Taylor <iant@google.com>
9057 * layout.cc (Layout::create_note): Use choose_output_section
9058 rather than make_output_section.
9060 2009-06-23 Ian Lance Taylor <iant@google.com>
9063 * options.cc (General_options::parse_V): Set printed_version_.
9064 (General_options::General_options): Initialize printed_version_.
9065 * options.h (class General_options): Add printed_version_ field.
9066 * gold.cc (queue_initial_tasks): If there are no input files,
9067 don't give a fatal error if we printed the version information.
9068 (queue_middle_tasks): If using -r with a shared object, give a
9069 fatal error rather than an ordinary error.
9071 2009-06-23 Ian Lance Taylor <iant@google.com>
9074 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
9075 (Layout::make_output_section): Set have_stabstr_section_ if we see
9076 a .stab*str section.
9077 (Layout::finalize): Call link_stabs_sections.
9078 (Layout::link_stabs_sections): New file.
9079 * layout.h (class Layout): Add have_stabstr_section_ field.
9080 Declare link_stabs_sections.
9082 2009-06-23 Doug Kwan <dougkwan@google.com>
9084 * Makefile.am (libgold_a_LIBADD): New.
9085 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
9086 * Makefile.in: Regenerate.
9087 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
9088 * configure: Regenerate.
9089 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
9090 * fileread.cc: Include sys/state.h
9091 * gold.h: Declare memmem and strndup if found missing.
9092 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
9094 2009-06-23 Ian Lance Taylor <iant@google.com>
9096 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
9097 * configure: Rebuild.
9099 2009-06-23 Ian Lance Taylor <iant@google.com>
9102 * object.cc (Object::section_contents): Don't try to get a view if
9103 the section has length zero.
9104 (Object::handle_gnu_warning_section): If the section is empty, use
9105 the name of the section as the warning.
9107 2009-06-23 Ian Lance Taylor <iant@google.com>
9110 * stringpool.h (class Stringpool_template): Add optimize_ field.
9111 (Stringpool_template::set_optimize): New function.
9112 * stringpool.cc (Stringpool_template::Stringpool_template):
9113 Initialize optimize_ field.
9114 (Stringpool_template::set_string_offsets): Test local optimize
9115 fild rather than parameter.
9116 * layout.cc (Layout::Layout): Call set_optimize on the section
9119 2009-06-22 Ian Lance Taylor <iant@google.com>
9122 * yyscript.y: Parse TARGET.
9123 * script.cc (script_set_target): New function.
9124 * script-c.h (script_set_target): Declare.
9125 * options.cc (General_options::string_to_object_format): Rename
9126 from string_to_object_format in anonymous namespace. Change
9128 * options.h (class General_options): Declare
9129 string_to_object_format.
9131 2009-06-22 Ian Lance Taylor <iant@google.com>
9133 * script-sections.cc (Script_sections::create_segments): Don't put
9134 program headers in a PT_LOAD segment if -n or -N.
9136 2009-06-22 Ian Lance Taylor <iant@google.com>
9139 * options.h (class General_options): Add -z lazy and -z now. Sort
9140 -z options into alphabetical order.
9141 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
9143 2009-06-21 Ian Lance Taylor <iant@google.com>
9145 * layout.cc (Layout::make_output_section): Call
9146 Target::new_output_section.
9147 (Layout::attach_allocated_section_to_segment): Put large section
9148 sections in a separate load segment with the large segment flag
9150 (Layout::segment_precedes): Sort large data segments after other
9152 (align_file_offset): New static function.
9153 (Layout::set_segment_offsets): Use align_file_offset.
9154 * output.h (class Output_section): Add is_small_section_ and
9155 is_large_section_ fields.
9156 (Output_section::is_small_section): New function.
9157 (Output_section::set_is_small_section): New function.
9158 (Output_section::is_large_section): New function.
9159 (Output_section::set_is_large_section): New function.
9160 (Output_section::is_large_data_section): New function.
9161 (class Output_segment): Add is_large_data_segment_ field.
9162 (Output_segment::is_large_data_segment): New function.
9163 (Output_segment::set_is_large_data_segment): New function.
9164 * output.cc (Output_section::Output_section): Initialize new
9166 (Output_segment::Output_segment): Likewise.
9167 (Output_segment::add_output_section): Add assertion that large
9168 data sections always go in large data segments. Force small data
9169 sections to the end of the list of data sections. Force small BSS
9170 sections to the start of the list of BSS sections. For large BSS
9171 sections to the end of the list of BSS sections.
9172 * symtab.h (class Symbol): Declare is_common_shndx.
9173 (Symbol::is_defined): Check Symbol::is_common_shndx.
9174 (Symbol::is_common): Likewise.
9175 (class Symbol_table): Define enum Commons_section_type. Update
9176 declarations. Add small_commons_ and large_commons_ fields.
9177 * symtab.cc (Symbol::is_common_shndx): New function.
9178 (Symbol_table::Symbol_table): Initialize new fields.
9179 (Symbol_table::add_from_object): Put small and large common
9180 symbols in the right list.
9181 (Symbol_table::sized_finalized_symbol): Check
9182 Symbol::is_common_shndx.
9183 (Symbol_table::sized_write_globals): Likewise.
9184 * common.cc (Symbol_table::do_allocate_commons): Allocate new
9185 common symbol lists. Don't call do_allocate_commons_list if the
9187 (Symbol_table::do_allocate_commons_list): Remove is_tls
9188 parameter. Add comons_section_type parameter. Change all
9189 callers. Handle small and large common symbols.
9190 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
9191 Symbol::is_common_shndx.
9192 * resolve.cc (symbol_to_bits): Likewise.
9193 * target.h (Target::small_common_shndx): New function.
9194 (Target::small_common_section_flags): New function.
9195 (Target::large_common_shndx): New function.
9196 (Target::large_common_section_flags): New function.
9197 (Target::new_output_section): New function.
9198 (Target::Target_info): Add small_common_shndx, large_common_shndx,
9199 small_common_section_flags, and large_common_section_flags
9201 (Target::do_new_output_section): New virtual function.
9202 * arm.cc (Target_arm::arm_info): Initialize new fields.
9203 * i386.cc (Target_i386::i386_info): Likewise.
9204 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
9206 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
9207 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9208 (Target_x86_64::do_new_output_section): New function.
9209 * configure.ac: Define conditional MCMODEL_MEDIUM.
9210 * testsuite/Makefile.am (check_PROGRAMS): Add large.
9211 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
9212 (large_LDFLAGS): Define.
9213 * testsuite/large.c: New file.
9214 * testsuite/testfile.cc (Target_test::test_target_info):
9215 Initialize new fields.
9216 * configure, testsuite/Makefile.in: Rebuild.
9218 2009-06-05 Doug Kwan <dougkwan@google.com>
9220 * Makefile.am (CCFILES): Add target.cc.
9221 * Makefile.in: Regenerate.
9222 * i386.cc (class Target_i386): Define new virtual method to
9223 override do_is_local_label_name in parent.
9224 * object.cc (Sized_relobj::do_count_local_symbols): Discard
9225 local symbols if --discard-locals or -X is given.
9226 * options.h (class General_options): Declare new options
9227 '--discard-locals' and '-X' for discarding locals.
9228 * target.h (class Target): Define new methods is_local_label_name.
9229 Declare new virtual method do_is_local_label_name.
9230 * target.cc: New file.
9231 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
9232 (check_SCRIPTS): Add discard_locals_test.sh.
9233 (check_DATA): Add discard_local_tests.syms.
9234 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
9235 (discard_local_tests.syms, discard_locals_test.o): New make rules.
9236 * testsuite/Makefile.in: Regenerate.
9237 * testsuite/discard_locals_test.c: New file.
9238 * testsuite/discard_locals_test.sh: Same.
9240 2009-06-05 Doug Kwan <dougkwan@google.com>
9242 * object.cc (Sized_relobj::Sized_relobj): Initialize
9243 discarded_eh_frame_shndx_ to -1U.
9244 (Sized_relobj::do_layout): Record index of a discard .eh_frame
9246 (Sized_relobj::do_count_local_symbols): Skip local symbols in
9247 a discarded .eh_frame section.
9248 (Sized_relobj::do_finalize_local_symbols): Ditto.
9249 * object.h (class Sized_relobj): Declare new member
9250 discarded_eh_frame_shndx_.
9251 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
9252 (local_labels_test.o, local_labels_test): New rules.
9253 * testsuite/Makefile.in: Regenerate.
9255 2009-06-04 Doug Kwan <dougkwan@google.com>
9257 * layout.cc (Layout::section_name_mapping): Add mapping for
9258 special ARM sections.
9260 2009-06-03 Doug Kwan <dougkwan@google.com>
9262 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
9263 (utils::has_overflow): Same.
9265 2009-06-03 Ian Lance Taylor <iant@google.com>
9267 * layout.cc (Layout::section_name_mapping): New array, replacing
9268 Layout::linkonce_mapping.
9269 (Layout::section_name_mapping_count): New variable, replacing
9270 Layout::linkonce_mapping_count.
9271 (Layout::linkonce_output_name): Remove.
9272 (Layout::output_section_name): Rewrite.
9273 * layout.h (class Layout): Rename Linkonce_mapping to
9274 Section_name_mapping, linkonce_mapping to section_name_mapping,
9275 linkonce_mapping_count to section_name_mapping_count. Don't
9276 declare linkonce_output_name.
9278 2009-06-03 Doug Kwan <dougkwan@google.com>
9280 * gold/arm.cc (namespace utils): New.
9281 (Target_arm::reloc_is_non_pic): Define new method.
9282 (class Arm_relocate_functions): New.
9283 (Target_arm::Relocate::relocate): Handle relocation types used by
9286 2009-06-03 Ian Lance Taylor <iant@google.com>
9288 * arm.cc (Target_arm::scan::global): Use || instead of |.
9290 2009-06-02 Doug Kwan <dougkwan@google.com>
9292 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
9293 issued_non_pic_error_.
9294 (class Target_arm::Scan): Declare new method check_non_pic.
9295 Define new method symbol_needs_plt_entry.
9296 Declare new data member issued_non_pic_error_.
9297 (class Target_arm::Relocate): Declare new method
9298 should_apply_static_reloc.
9299 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9300 (Target_arm::Scan::check_non_pic): Define new method.
9301 (Target_arm::Scan::local): Handle a small subset of reloc types used
9303 (Target_arm::Scan::local): Same.
9304 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9306 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
9308 * incremental.cc (Incremental_inputs::report_command_line): Filter
9309 out --incremental-* options.
9311 2009-05-29 Doug Kwan <dougkwan@google.com>
9313 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9315 (class Target_arm): Update comment.
9316 (Target_arm::Target_arm): Initialize new data members GOT_,
9317 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
9318 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
9319 and Target_arm::rel_dyn_section.
9320 Declare new_enum Target_arm::Got_type.
9321 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
9323 Update commments for member do_dynsym_value.
9324 (Target_arm::got_size, Target_arm::plt_section,
9325 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
9326 new methods inside class defintion.
9327 (Target_arm::got_section): Define new method.
9328 (Target_arm::rel_dyn_section): Same.
9329 (Output_data_plt_arm): New template class.
9330 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
9331 (Output_data_plt_arm:do_adjust_output_section): Define new method.
9332 (Output_data_plt_arm::add_entry): Same.
9333 (Output_data_plt_arm::first_plt_entry): Define new
9334 static data member for PLT instruction template.
9335 (Output_data_plt_arm::plt_entry): Same.
9336 (Output_data_plt_arm::do_write): Define new method.
9337 (Target_arm::make_plt_entry): Same.
9338 (Target_arm::do_finalize_sections): Same.
9339 (Target_arm::do_dynsym_value): Same.
9341 2009-05-28 Doug Kwan <dougkwan@google.com>
9343 * Makefile.am (TARGETSOURCES): Add arm.cc.
9344 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
9345 * Makefile.in: Regenerate.
9347 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
9349 2009-05-26 Doug Kwan <dougkwan@google.com>
9351 * options.cc (General_options::parse_exclude_libs). Fix a comment.
9352 (General_options::check_excluded_libs): Strip off directories in
9353 archive name before matching like GNU ld does.
9354 * testsuite/Makefile.am (MOSTLYCLEANFILES,
9355 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
9356 (exclude_libs_test_LDFLAGS): Add linker option
9357 -Wl,--exclude-libs,libexclude_libs_test_3
9358 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
9359 an explicit archive without using -l.
9360 (alt/libexclude_libs_test_3.a): New make rule.
9361 * testsuite/Makefile.in: Regenerate.
9362 * testsuite/exclude_libs_test.c : Declare lib3_default().
9364 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
9365 * exclude_libs_test_3.c: New file.
9367 2009-05-26 Nick Clifton <nickc@redhat.com>
9369 * po/id.po: New Indonesian translation.
9370 * po/gold.pot: Updated template file.
9372 2009-05-22 Sriraman Tallam <tmsriram@google.com>
9374 * testsuite/Makefile.am: Add -ffunction-sections to compile
9375 gc_comdat_test files. Add -Wl,--gc-sections to build
9377 * testsuite/Makefile.in: Regenerate.
9378 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
9380 2009-05-21 Sriraman Tallam <tmsriram@google.com>
9382 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
9383 kept comdat section was garbage collected.
9384 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
9385 * testsuite/Makefile.in: Regenerate.
9386 * testsuite/gc_comdat_test.sh: New file.
9387 * testsuite/gc_comdat_test_1.cc: New file.
9388 * testsuite/gc_comdat_test_2.cc: New file.
9390 2009-05-19 Doug Kwan <dougkwan@google.com>
9392 * archive.cc (Archive::Archive): Move constructor from archive.h
9393 to here. Initialize no_export_.
9394 (Archive::get_elf_object_for_member): Set no_export flag of object.
9395 * archive.h (Archive::Archive): Move constructor body to
9397 (Archive::no_export): New method.
9398 (Archive::no_export_): New field.
9399 * object.h (Object::Object): Initialize no_export_ to false.
9400 (Object::no_export, Object::set_no_export): New methods.
9401 (Object::no_export_): New field.
9402 * options.cc (General_options::parse_exclude_libs): New method.
9403 (General_options::check_excluded_libs) Same.
9404 * options.h (exclude_libs): New option.
9405 (General_options::check_excluded_libs): New method declaration.
9406 (General_options::excluded_libs_): New field.
9407 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
9408 default or protected visibility if an object has no-export flag set.
9409 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
9410 (check_SCRIPTS): Add exclude_libs_test.sh.
9411 (check_DATA): Add exclude_libs_test.syms.
9412 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
9413 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
9414 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
9415 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
9416 (exclude_libs_test.syms, libexclude_libs_test_1.a,
9417 libexclude_libs_test_2.a): New rules.
9418 * testsuite/Makefile.in: Regenerate.
9419 * testsuite/exclude_libs_test.c: New file.
9420 * testsuite/exclude_libs_test.sh: Ditto.
9421 * testsuite/exclude_libs_test_1.c: Ditto.
9422 * testsuite/exclude_libs_test_2.c: Ditto.
9424 2009-05-15 Ian Lance Taylor <iant@google.com>
9426 * configure.ac: Check for declarations for cases where libiberty.h
9427 checks HAVE_DECL_xxx.
9428 * configure, config.in: Rebuild.
9430 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
9432 * gold.h (Incremental_argument_list): Remove (invalid) forward
9434 * incremental.cc (Incremental_inputs::report_achive): New method.
9435 (Incremental_inputs::report_object): New method.
9436 (Incremental_inputs::report_script): New method.
9437 (Incremental_inputs::finalize_inputs): New method.
9438 (Incremental_inputs::finalize): Call finalize_inputs().
9439 (Incremental_inputs::sized_create_incremental_inputs_section_data):
9440 Create inputs entries.
9441 * incremental.h (Incremental_input_type): New enum.
9442 (Incremental_inputs::Incremental_input): Initialize new fields.
9443 (Incremental_inputs::report_inputs): New method.
9444 (Incremental_inputs::report_achive): New method.
9445 (Incremental_inputs::report_object): New method.
9446 (Incremental_inputs::report_script): New method.
9447 (Incremental_inputs::finalize_inputs): New method.
9448 (Incremental_inputs::Input_info): New struct.
9449 (Incremental_inputs::Input_info_map): New typedef.
9450 (Incremental_inputs::lock_): New field.
9451 (Incremental_inputs::Inputs_): New field.
9452 (Incremental_inputs::Inputs_map): New field.
9453 * main.cc (main): Call Incremental_input::report_inputs.
9454 * options.h (Input_argument_list): Typedef moved from
9456 (Input_file_group::Files): Remove, use ::Input_argument_list.
9457 (Input_file_group::Input_argument_list): Remove, use
9458 ::Input_argument_list.
9459 * plugin.cc (Plugin_manager::add_input_file): Add error in
9461 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
9463 * script.cc (read_input_script): Call
9464 Incremental_input::report_script.
9465 * script.h (Script_info): New class.
9467 2009-04-27 Ian Lance Taylor <iant@google.com>
9469 * x86_64.cc (do_adjust_output_section): Set entsize to
9472 2009-04-23 Elliott Hughes <enh@google.com>
9474 * output.cc (Output_file::close): After short writes, continue
9475 writing from the correct offset in the buffer being written.
9477 2009-04-23 Chris Demetriou <cgd@google.com>
9479 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
9480 * configure: Regenerate.
9481 * config.in: Regenerate.
9482 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
9483 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
9485 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
9487 * incremental.cc (Incremental_inputs_header_data): Renamed from
9488 Incremental_input_header_data.
9489 (Incremental_inputs_header_data::data_size): New field.
9490 (Incremental_inputs_header_data::put_input_file_count): Renamed
9491 from input_file_count.
9492 (Incremental_inputs_header_data::put_command_line_offset): Renamed
9493 from command_line_offset.
9494 (Incremental_inputs_header_data::put_reserved): Renamed from
9496 (Incremental_inputs_entry_data): Renamed from
9497 Incremental_input_entry_data.
9498 (Incremental_inputs_entry_data::data_size): New field.
9499 (Incremental_inputs::report_command_line): New method.
9500 (Incremental_inputs::finalize): New method.
9501 (Incremental_inputs::create_incremental_inputs_data): New method.
9502 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
9503 * incremental.h: New file.
9504 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
9505 (Layout::finalize): Create incremental inputs section in
9507 (Layout::create_incremental_info_sections): New method.
9508 * layout.h (Layout::incremental_inputs): New method.
9509 (Layout::create_incremental_info_sections): New method.
9510 (Layout::incremental_inputs_): New field.
9511 * main.cc (main): Notify Incremental_input of the command line.
9513 2009-04-01 Ian Lance Taylor <iant@google.com>
9514 Mikolaj Zalewski <mikolajz@google.com>
9516 * gold.h (reserve_unordered_map): Define, three versions, one for
9517 each version of Unordered_map.
9518 * layout.cc (Layout::Layout): Remove options parameter. Add
9519 number_of_input_files parameter. Don't initialize options_.
9520 Initialize number_of_input_files_ and resized_signatures_. Move
9521 sections_are_attached_.
9522 (Layout::layout_group): Reserve space for group_signatures_.
9523 (Layout::find_or_add_kept_section): Change name parameter to be a
9524 reference. Resize signatures_ map when it gets large enough.
9525 (Layout::layout_eh_frame): Use parameters->options() instead of
9527 (Layout::make_output_section): Likewise.
9528 (Layout::attach_allocated_section_to_segment): Likewise.
9529 (Layout::finalize, Layout::create_executable_stack): Likewise.
9530 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
9531 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
9532 * layout.h (class Layout): Update declarations. Remove options_
9533 field. Add number_of_input_files_ and resized_signatures_
9534 fields. Move sections_are_attached_ field.
9535 * main.cc (main): Pass number of input files to Layout
9536 constructor. Don't pass options.
9538 2009-03-30 Ian Lance Taylor <iant@google.com>
9540 * ffsll.c (ffsll): Correct implementation.
9542 2009-03-27 Ian Lance Taylor <iant@google.com>
9544 * ffsll.c: New file.
9545 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
9546 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
9547 * ftruncate.c (ftruncate): Declare before definition.
9548 * mremap.c (mremap): Likewise.
9549 * pread.c (pread): Likewise.
9550 * configure, Makefile.in, config.in: Rebuild.
9552 * mremap.c: New file.
9553 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
9554 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
9555 (mremap): Declare if HAVE_MREMAP is not defined.
9556 * configure, Makefile.in, config.in: Rebuild.
9558 2009-03-27 Cary Coutant <ccoutant@google.com>
9560 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
9561 position independent.
9562 * sparc.cc (Target_sparc::check_non_pic): Likewise.
9563 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
9565 2009-03-24 Cary Coutant <ccoutant@google.com>
9567 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
9569 (needs_dynamic_reloc): Likewise.
9571 2009-03-24 Ian Lance Taylor <iant@google.com>
9573 * yyscript.y (file_cmd): Recognize EXTERN.
9574 (extern_name_list, extern_name_list_body): New nonterminals.
9575 * script.cc (script_add_extern): Define.
9576 * script-c.h (script_add_extern): Declare.
9578 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
9580 * object.cc (is_elf_object): Define.
9581 * object.h (is_elf_object): Declare.
9582 * archive.cc (Archive::get_elf_object_for_member): Call
9584 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
9586 2009-03-24 Elliott Hughes <enh@google.com>
9588 * output.cc (Output_file::map_anonymous): Define.
9589 (Output_file::map): Use map_anonymous. If the regular mmap fails,
9590 try an anonymous one. Report the size if the mmap fails.
9591 * output.h (class Output_file): Declare map_anonymous.
9593 2009-03-24 Ian Lance Taylor <iant@google.com>
9595 * target-select.cc (instantiate_target): Don't acquire the lock if
9596 the instantiated_target_ field has already been set.
9598 2009-03-23 Ian Lance Taylor <iant@google.com>
9600 * gold-threads.h (class Initialize_lock): Define.
9601 * gold-threads.cc (class Initialize_lock_once): Define.
9602 (initialize_lock_control): New static variable.
9603 (initialize_lock_pointer): New static variable.
9604 (initialize_lock_once): New static function.
9605 (Initialize_lock::Initialize_lock): Define.
9606 (Initialize_lock::initialize): Define.
9607 * target-select.h: Include "gold-threads.h".
9608 (class Target_selector): Add lock_ and initialize_lock_ fields.
9609 Don't define instantiate_target, just declare it.
9610 * target-select.cc (Target_selector::Target_selector): Initialize
9612 (Target_selector::instantiate_target): Define.
9613 * descriptors.h: Include "gold-threads.h".
9614 (class Descriptors): Add initialize_lock_ field.
9615 * descriptors.cc (Descriptors::Descriptors): Initialize new
9617 (Descriptors::open): Use initialize_lock_ field
9618 * errors.h (class Errors): Add initialize_lock_ field.
9619 * errors.cc (Errors::Errors): Initialize new field.
9620 (Errors::initialize_lock): Use initialize_lock_ field.
9621 * powerpc.cc (class Target_selector_powerpc): Remove
9622 instantiated_target_ field. In do_recognize call
9623 instantiate_target rather than do_instantiate_target. In
9624 do_instantiate_target just allocate a new target.
9625 * sparc.cc (class Target_selector_sparc): Likewise.
9627 * freebsd.h: New file.
9628 * i386.cc: Include "freebsd.h".
9629 (Target_i386): Derive from Target_freebsd rather than
9631 (Target_selector_i386): Derive from Target_selector_freebsd rather
9632 than Target_selector.
9633 * x86_64.cc: Include "freebsd.h".
9634 (Target_x86_64): Derive from Target_freebsd rather than
9636 (Target_selector_x86_64): Derive from Target_selector_freebsd
9637 rather than Target_selector.
9638 * target.h (class Target): Add adjust_elf_header and
9639 do_adjust_elf_header.
9640 * output.cc (Output_file_header:: do_sized_write): Call target
9641 adjust_elf_header routine.
9642 * configure.tgt: Set targ_osabi.
9643 * configure.ac: Define GOLD_DEFAULT_OSABI.
9644 * parameters.cc (Parameters::default_target): Pass
9645 GOLD_DEFAULT_OSABI to select_target.
9646 * target-select.h (class Target_selector): Make instantiate_target
9647 protected rather than private.
9648 * Makefile.am (HFILES): Add freebsd.h.
9649 * configure, Makefile.in, config.in: Rebuild.
9651 * merge.cc (do_add_input_section): Correct pend value. Change
9652 message about last entry not being null terminated from error to
9655 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
9657 * incremental.cc: New file.
9658 * Makefile.am (CCFILES): Add incremental.cc.
9659 * Makefile.in: Rebuild.
9661 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
9663 * layout.cc (Layout::output_section_name): Preserve names
9664 of '.note.' sections.
9666 2009-03-19 Ian Lance Taylor <iant@google.com>
9668 * descriptors.cc (Descriptors::open): Check that the options are
9669 valid before using them.
9671 2009-03-18 Ian Lance Taylor <iant@google.com>
9673 * script-sections.h: Include <list>.
9674 (class Script_sections): Change Sections_elements from std::vector
9675 to std::list. Typedef public Elements_iterator. Add
9676 orphan_section_placement_, data_segment_align_start_, and
9677 saw_data_segment_align_ fields. Remove data_segment_align_index_
9679 * script-sections.cc (class Orphan_section_placement): New class.
9680 (class Sections_element): Add virtual functions is_relro and
9681 orphan_section_init. Remove virtual function place_orphan_here.
9682 (class Output_section_definition): Add is_relro and
9683 orphan_section_init. Remove place_orphan_here.
9684 (class Orphan_output_section): Likewise.
9685 (Script_sections::Script_sections): Update for field changes.
9686 (Script_sections::data_segment_align): Set saw_data_segment_align_
9687 and data_segment_align_start_, not data_segment_align_index.
9688 (Script_sections::data_segment_relro_end): Check
9689 saw_data_segment_align_. Use data_segment_align_start_ rather
9690 than data_segment_align_index_.
9691 (Script_sections::place_orphan): Rewrite to use
9692 Orphan_section_placement.
9694 2009-03-17 Ian Lance Taylor <iant@google.com>
9696 * archive.cc (Archive::add_symbols): Check for a version attached
9697 to the symbol name in the archive map.
9698 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
9699 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
9700 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
9701 (ver_test_11.a): New target.
9702 * testsuite/Makefile.in: Rebuild.
9704 * configure.ac: Check for chsize and posix_fallocate. Replace
9706 * ftruncate.c: New file, from gnulib.
9707 * output.cc (posix_fallocate): Define dummy version if not
9708 HAVE_POSIX_FALLOCATE.
9709 (Output_file::map): Call posix_fallocate rather than lseek and
9711 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
9712 * configure, Makefile.in, config.in: Rebuild.
9714 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
9716 * layout.h (Layout::create_note): Add section_name parameter.
9717 * layout.cc (Layout::create_note): Likewise.
9718 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
9720 2009-03-17 Ian Lance Taylor <iant@google.com>
9722 * descriptors.cc: Include "options.h".
9723 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
9724 (Descriptors::open): Always use O_CLOEXEC when opening a new
9725 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
9726 then set FD_CLOEXEC.
9728 * sparc.cc (class Target_sparc): Add has_got_section.
9729 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
9730 make sure we have a GOT section.
9732 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
9733 (Target_sparc::Scan::local): Likewise.
9734 (Target_sparc::Scan::global): Likewise.
9735 (Target_sparc::Relocate::relocate): Likewise.
9736 (Target_sparc::Relocate::relocate_tls): Likewise.
9738 * symtab.cc (Symbol_table::define_default_version): New function,
9739 broken out of add_from_object.
9740 (Symbol_table::add_from_object): Call define_default_version.
9741 (Symbol_table::define_special_symbol): Add resolve_oldsym
9742 parameter. Change all callers. If the version for a symbol comes
9743 from a version script, resolve it with the symbol with the same
9744 name with no version. Also add the symbol without a version if
9746 (do_define_in_output_data): If resolving with oldsym, don't delete
9748 (do_define_in_output_segment): Likewise.
9749 (do_define_as_constant): Likewise.
9750 * symtab.h (class Symbol_table): Update declarations.
9752 2009-03-13 Ian Lance Taylor <iant@google.com>
9754 * readsyms.cc (Read_symbols::incompatible_warning): New function.
9755 (Read_symbols::requeue): New function.
9756 (Read_symbols::do_read_symbols): If make_elf_object fails because
9757 the target type is not configured, and the file was searched for,
9758 issue a warning and retry with the next directory.
9759 (Add_symbols::run): If the file has an incompatible format, and
9760 it was searched for, requeue the Read_symbols task. On error,
9762 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
9763 dirindex parameter to constructor. Change all callers. Declare
9764 incompatible_warning and requeue.
9765 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
9766 input_argument_ and input_group_ fields. Add them to
9767 constructor. Change all callers.
9768 (class Read_script): Add dirindex_ field. Add it to constructor.
9770 * archive.cc (Archive::setup): Remove input_objects parameter.
9772 (Archive::get_file_and_offset): Likewise.
9773 (Archive::read_all_symbols): Likewise.
9774 (Archive::read_symbols): Likewise.
9775 (Archive::get_elf_object_for_member): Remove input_objects
9776 parameter. Add punconfigured parameter. Change all callers.
9777 (Archive::add_symbols): Change return type to bool. Check return
9778 value of include_member.
9779 (Archive::include_all_members): Likewise.
9780 (Archive::include_member): Change return type to bool. Return
9781 false if first included object has incompatible target. Set
9782 included_member_ field.
9783 (Add_archive_symbols::run): If add_symbols returns false, requeue
9785 * archive.h (class Archive): Add included_member_ field.
9786 Initialize it in constructor. Add input_file and searched_for
9787 methods. Update declarations.
9788 (class Add_archive_symbols): Add dirpath_, dirindex_, and
9789 input_argument_ fields. Add them to constructor. Change all
9791 * script.cc: Include "target-select.h".
9792 (class Parser_closure): Add skip_on_incompatible_target_ and
9793 found_incompatible_target_ fields. Add
9794 skip_on_incompatible_target parameter to constructor. Change all
9795 callers. Add methods skip_on_incompatible_target,
9796 clear_skip_on_incompatible_target, found_incompatible_target, and
9797 set_found_incompatible_target.
9798 (read_input_script): Add dirindex parameter. Change all callers.
9799 If parser finds an incompatible target, requeue Read_symbols
9801 (script_set_symbol): Clear skip_on_incompatible_target in
9803 (script_add_assertion, script_parse_option): Likewise.
9804 (script_start_sections, script_add_phdr): Likewise.
9805 (script_check_output_format): New function.
9806 * script.h (read_input_script): Update declaration.
9807 * script-c.h (script_check_output_format): Declare.
9808 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
9809 (ignore_cmd): Remove OUTPUT_FORMAT.
9810 * fileread.cc (Input_file::Input_file): Add explicit this.
9811 (Input_file::will_search_for): New function.
9812 (Input_file::open): Add pindex parameter. Change all callers.
9813 * fileread.h (class Input_file): Add input_file_argument method.
9814 Declare will_search_for. Update declarations.
9815 * object.cc (make_elf_object): Add punconfigured parameter.
9817 * object.h (class Object): Make input_file public. Add
9818 searched_for method.
9819 (make_elf_object): Update declaration.
9820 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
9822 * dirsearch.h (class Dirsearch): Update declaration.
9823 * options.h (class General_options): Add --warn-search-mismatch.
9824 * parameters.cc (Parameters::is_compatible_target): New function.
9825 * parameters.h (class Parameters): Declare is_compatible_target.
9826 * workqueue.cc (Workqueue::add_blocker): New function.
9827 * workqueue.h (class Workqueue): Declare add_blocker.
9829 * fileread.cc (Input_file::open): Remove options parameter.
9831 (Input_file::open_binary): Likewise.
9832 * script.cc (read_input_script): Likewise.
9833 * readsyms.h (class Read_symbols): Remove options_ field. Remove
9834 options parameter from constructor. Change all callers.
9835 (class Read_script): Likewise.
9836 * fileread.h (class Input_file): Update declarations.
9837 * script.h (read_input_script): Update declaration.
9839 2009-03-10 Nick Clifton <nickc@redhat.com>
9841 * po/es.po: New Spanish translation.
9843 2009-03-06 Cary Coutant <ccoutant@google.com>
9845 * options.cc (parse_short_option): Keep dash_z from registering itself.
9847 2009-03-03 Ian Lance Taylor <iant@google.com>
9850 * target-reloc.h (relocate_section): Pass output_section to
9852 * i386.cc (Target_i386::should_apply_static_reloc): Add
9853 output_section parameter. Change all callers.
9854 (Target_i386::Relocate::relocate): Add output_section parameter.
9855 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9856 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
9857 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
9858 * testsuite/two_file_shared.sh: New script.
9859 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
9860 (check_DATA): Add two_file_shared.dbg.
9861 (two_file_shared.dbg): New target.
9862 * testsuite/Makefile.in: Rebuild.
9864 2009-03-01 Ian Lance Taylor <iant@google.com>
9866 * configure.ac: Check for byteswap.h.
9867 * configure: Rebuild.
9868 * config.in: Rebuild.
9870 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
9872 * layout.cc (Layout::find_or_add_kept_section): New function.
9873 (Layout::add_comdat): Removed.
9874 * layout.h (struct Kept_section): Move out of class Layout.
9875 Remove trailing underscores from field names. Add group_sections
9876 field. Rename group_ field to is_group. Change all uses.
9877 (class Layout): Declare find_or_add_kept_section, not add_comdat.
9878 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
9879 comdat_groups_ field.
9880 (Sized_relobj::include_section_group): Use
9881 find_or_add_kept_section and Kept_section::group_sections.
9882 (Sized_relobj::include_linkonce_section): Likewise.
9883 * object.cc (class Sized_relobj): Don't define Comdat_group or
9884 Comdat_group_table. Remove find_comdat_group and
9885 add_comdat_group. Remove comdat_groups_ field.
9886 * plugin.cc (include_comdat_group): Use
9887 Layout::find_or_add_kept_section.
9889 2009-02-28 Ian Lance Taylor <iant@google.com>
9891 * README: --gc-sections and map files are now supported. Document
9892 some build requirements.
9895 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
9896 relocatable link set the value of the section symbol to zero.
9897 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
9898 relocatable link don't include the section address in the local
9901 2009-02-27 Ian Lance Taylor <iant@google.com>
9904 * options.h (class Search_directory): Add is_system_directory.
9905 (class General_options): Declare is_in_system_directory.
9906 * options.cc (get_relative_sysroot): Make static.
9907 (get_default_sysroot): Make static.
9908 (General_optoins::is_in_system_directory): New function.
9909 * fileread.cc (Input_file::is_in_system_directory): New function.
9910 * fileread.h (class Input_file): Declare is_in_system_directory.
9911 * object.h (class Object): Add is_in_system_directory.
9912 (class Input_objects): Remove system_library_directory_ field.
9913 * object.cc (Input_objects::add_object): Don't set
9914 system_library_directory_.
9915 (input_objects::found_in_system_library_directory): Remove.
9916 * symtab.cc (Symbol_table::write_globals): Remove input_objects
9917 parameter. Change all callers.
9918 (Symbol_table::sized_write_globals): Likewise.
9919 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
9920 Call Object::is_in_system_directory.
9921 * symtab.h (class Symbol_table): Update declarations.
9924 * descriptors.h (Open_descriptor): Add is_on_stack field.
9925 * descriptors.cc (Descriptors::open): If the descriptor is on the
9926 top of the stack, remove it. Initialize is_on_stack field.
9927 (Descriptors::release): Only add pod to stack if it is not on the
9929 (Descriptors::close_some_descriptor): Clear stack_next and
9933 * output.cc (Output_section::find_starting_output_address): Rename
9934 from starting_output_address; add PADDR parameter; change return
9936 * output.h (class Output_section): Declare
9937 find_starting_output_address instead of starting_output_address.
9938 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
9939 section symbol for which we can't find a merge section.
9942 * symtab.cc (Symbol_table::add_from_object): If the visibility is
9943 hidden or internal, force the symbol to be local.
9944 * resolve.cc (Symbol::override_visibility): Define.
9945 (Symbol::override_base): Use override_visibility.
9946 (Symbol_table::resolve): Likewise.
9947 (Symbol::override_base_with_special): Likewise.
9948 (Symbol_table::override_with_special): If the visibility is hidden
9949 or internal, force the symbol to be local.
9950 * symtab.h (class Symbol): Add set_visibility and
9951 override_visibility.
9952 * testsuite/ver_test_1.sh: New file.
9953 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
9954 (check_DATA): Add ver_test_1.syms.
9955 (ver_test_1.syms): New target.
9956 * testsuite/Makefile.in: Rebuild.
9958 2009-02-25 Cary Coutant <ccoutant@google.com>
9960 * layout.cc (Layout::choose_output_section): Don't rename sections
9961 when using a linker script that has a SECTIONS clause.
9962 * Makefile.in: Regenerate.
9964 * testsuite/Makefile.am (script_test_5.sh): New test case.
9965 * testsuite/Makefile.in: Regenerate.
9966 * testsuite/script_test_5.cc: New file.
9967 * testsuite/script_test_5.sh: New file.
9968 * testsuite/script_test_5.t: New file.
9970 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
9972 * archive.cc (Archive::include_member): Update calls to add_symbols.
9973 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
9974 the Layout argument.
9975 * dynobj.h (do_add_symbols): Add the Layout argument.
9976 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
9978 * object.h (Object::add_symbols): Add the Layout argument.
9979 (Object::do_add_symbols): Add the Layout argument.
9980 (Sized_relobj::do_add_symbols): Add the Layout argument.
9981 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
9982 Unify the two versions.
9983 (Add_plugin_symbols): Remove.
9984 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
9985 (Sized_pluginobj::do_add_symbols): Unify the two versions.
9986 (Add_plugin_symbols): Remove.
9987 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
9988 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
9989 (Add_symbols::run): Make it work with Pulginobj.
9991 2009-02-06 Ian Lance Taylor <iant@google.com>
9993 * object.cc (Sized_relobj::do_layout): Make info message start
9994 with lower case letter.
9996 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
9998 * binary.cc: Fix file comment.
10000 * options.h (enum Incremental_disposition): Define.
10001 (class General_options): Add new options: --incremental,
10002 --incremental_changed, --incremental_unchanged,
10003 --incremental_unknown. Add incremental_disposition_ and
10004 implicit_incremental_ fields.
10005 (General_options::incremental_disposition): New function.
10006 (class Position_dependent_options): Add incremental_disposition
10008 (Position_dependent_options::copy_from_options): Set incremental
10010 * options.cc (General_options::parse_incremental_changed): New
10012 (General_options::parse_incremental_unchanged): New function.
10013 (General_options::parse_incremental_unknown): New function.
10014 (General_options::General_options): Initialize new fields
10015 incremental_disposition_ and implicit_incremental_.
10016 (General_options::finalize): Check for uasge of --incremental-*
10017 without --incremental.
10019 2009-02-06 Chris Demetriou <cgd@google.com>
10021 * gold.h (gold_undefined_symbol): Change to take only a Symbol
10022 pointer and to report location as the file name associated with
10024 (gold_undefined_symbol_at_location): New function to replace the
10025 old gold_undefined_symbol functionality.
10026 * target-reloc.h (relocate_section): Update to use
10027 gold_undefined_symbol_at_location.
10028 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10029 Call gold_undefined_symbol function rather than gold_error.
10030 * errors.h (Errors::undefined_symbol): Take location as a
10031 string, rather than calculating it from a relocation.
10032 * errors.cc (Errors::fatal): Print "fatal error:" before the
10034 (Errors::error, Errors::error_at_location): Print "error: "
10035 before the formatted message.
10036 (Errors::undefined_symbol): Take location as a string, rather
10037 than calculating it from a relocation.
10038 (gold_undefined_symbol_at_location): New function akin to
10039 old gold_undefined_symbol, calculates location from relocation.
10040 (gold_undefined_symbol): Change to take only a Symbol pointer
10041 and to report location as the file name associated with the symbol.
10042 * testsuite/debug_msg.sh: Update for changed error messages.
10043 * testsuite/undef_symbol.sh: Likewise.
10045 2009-02-04 Duncan Sands <baldrick@free.fr>
10048 * reduced_debug_output.h
10049 (Output_reduced_debug_abbrev_section::failed): Use format for
10051 (Output_reduced_debug_info_section::faild): Likewise.
10053 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
10055 * script.cc (Lazy_demangler): New class.
10056 (Version_script_info::get_symbol_version_helper): Demangle a
10059 2009-01-29 Cary Coutant <ccoutant@google.com>
10061 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
10063 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10065 2009-01-28 Ian Lance Taylor <iant@google.com>
10067 * version.cc (version_string): Bump to 1.9.
10069 * gold.h: Include <cstring> and <stdint.h>.
10070 * version.cc: Include <cstdio>.
10071 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
10073 * reduced_debug_output.cc (insert_into_vector): Rename from
10074 Insert_into_vector; change all callers. Use Swap_unaligned to
10075 avoid aliasing issue; remove union since it is unnecessary.
10077 2009-01-27 Sriraman Tallam <tmsriram@google.com>
10079 * Makefile.am (CCFILES): Add gc.cc.
10080 (HFILES): Add gc.h.
10081 * Makefile.in: Regenerate.
10082 * gold.cc (Gc_runner): New class.
10083 (queue_initial_tasks): Call garbage collection related tasks
10084 when corresponding options are invoked.
10085 (queue_middle_gc_tasks): New function.
10086 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
10087 processed early before laying out sections during garbage collection.
10088 * gold.h (queue_middle_gc_tasks): New function.
10089 (is_prefix_of): Move from "layout.cc".
10090 * i386.cc (Target_i386::gc_process_relocs): New function.
10091 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
10092 * main.cc (main): Create object of class "Garbage_collection".
10093 * object.cc (Relobj::copy_symbols_data): New function.
10094 (Relobj::is_section_name_included): New function.
10095 (Sized_relobj::do_layout): Allow this function to be called twice
10096 during garbage collection and defer layout of section during the
10098 * object.h (Relobj::get_symbols_data): New function.
10099 (Relobj::is_section_name_included): New function.
10100 (Relobj::copy_symbols_data): New function.
10101 (Relobj::set_symbols_data): New function.
10102 (Relobj::get_relocs_data): New function.
10103 (Relobj::set_relocs_data): New function.
10104 (Relobj::is_output_section_offset_invalid): New pure virtual function.
10105 (Relobj::gc_process_relocs): New function.
10106 (Relobj::do_gc_process_relocs): New pure virtual function.
10107 (Relobj::sd_): New data member.
10108 (Sized_relobj::is_output_section_offset_invalid): New function.
10109 (Sized_relobj::do_gc_process_relocs): New function.
10110 * options.h (General_options::gc_sections): Modify to not be a no-op.
10111 (General_options::print_gc_sections): New option.
10112 * plugin.cc (Plugin_finish::run): Remove function call to
10113 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
10114 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
10115 * reloc.cc (Read_relocs::run): Add task to process relocs and
10116 determine unreferenced sections when doing garbage collection.
10117 (Gc_process_relocs): New class.
10118 (Sized_relobj::do_gc_process_relocs): New function.
10119 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
10120 sections that are garbage collected.
10121 * reloc.h (Gc_process_relocs): New class.
10122 * sparc.cc (Target_sparc::gc_process_relocs): New function.
10123 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
10124 symbols whose corresponding sections are garbage collected.
10125 (Symbol_table::Symbol_table): Add new parameter for the garbage
10127 (Symbol_table::gc_mark_undef_symbols): New function.
10128 (Symbol_table::gc_mark_symbol_for_shlib): New function.
10129 (Symbol_table::gc_mark_dyn_syms): New function.
10130 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
10132 (Symbol_table::add_from_object): Likewise.
10133 (Symbol_table::add_from_relobj): When building shared objects, do not
10134 treat externally visible symbols as garbage.
10135 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
10136 table information for static and relocatable links.
10137 * symtab.h (Symbol_table::set_gc): New function.
10138 (Symbol_table::gc): New function.
10139 (Symbol_table::gc_mark_undef_symbols): New function.
10140 (Symbol_table::gc_mark_symbol_for_shlib): New function.
10141 (Symbol_table::gc_mark_dyn_syms): New function.
10142 (Symbol_table::gc_): New data member.
10143 * target.h (Sized_target::gc_process_relocs): New pure virtual
10145 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
10146 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
10148 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
10150 * options.h (General_options::gc_sections): Define as a no-op for now.
10151 (General_options::no_keep_memory): Ditto.
10152 (General_options::Bshareable): Define.
10153 * options.cc (General_options::finalize): Honor -Bshareable.
10155 2009-01-20 Andreas Schwab <schwab@suse.de>
10157 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
10158 read the value in the contents, since we don't use it. Use the
10159 template endianness when writing.
10160 (Relocate::relocate): Use it for R_PPC_REL16_HA.
10162 2009-01-19 Andreas Schwab <schwab@suse.de>
10164 * configure.tgt (powerpc64-*): Fix targ_obj.
10166 2009-01-15 Ian Lance Taylor <iant@google.com>
10168 * object.cc (Sized_relobj::write_local_symbols): Don't write out
10169 local symbols when stripping all symbols.
10171 2009-01-14 Cary Coutant <ccoutant@google.com>
10173 * output.cc (Output_reloc): Add explicit instantiations.
10175 2009-01-14 Cary Coutant <ccoutant@google.com>
10177 * archive.cc (Archive::get_elf_object_for_member): Remove call
10178 to File_read::claim_for_plugin.
10179 * descriptors.cc (Descriptors::open): Remove reference to
10181 (Descriptors::claim_for_plugin): Remove.
10182 * descriptors.h (Descriptors::claim_for_plugin): Remove.
10183 (Descriptors::is_claimed): Remove.
10184 (claim_descriptor_for_plugin): Remove.
10185 * fileread.cc (File_read::claim_for_plugin): Remove.
10186 * fileread.h (File_read::claim_for_plugin): Remove.
10187 (File_read::descriptor): Reopen descriptor if necessary.
10188 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
10189 (Plugin_manager::all_symbols_read): Add task parameter. Change
10191 (Plugin_manager::get_input_file): New function.
10192 (Plugin_manager::release_input_file): New function.
10193 (Pluginobj::Pluginobj): Add filesize parameter and initialize
10194 corresponding data member.
10195 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
10196 and pass to base constructor. Change all callers.
10197 (get_input_file, release_input_file): New functions.
10198 (make_sized_plugin_object): Add filesize parameter. Change all callers.
10199 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
10200 (Plugin_manager::all_symbols_read): Add task parameter.
10201 (Plugin_manager::get_input_file): New function.
10202 (Plugin_manager::release_input_file): New function.
10203 (Plugin_manager::task_): New data member.
10204 (Pluginobj::Pluginobj): Add filesize parameter.
10205 (Pluginobj::filename): New function.
10206 (Pluginobj::descriptor): New function.
10207 (Pluginobj::filesize): New function.
10208 (Pluginobj::filesize_): New data member.
10209 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
10210 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
10211 File_read::claim_for_plugin; use Object::unlock to unlock the file.
10213 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
10214 with archive libraries.
10215 * testsuite/Makefile.in: Regenerate.
10216 * testsuite/plugin_test.c (struct sym_info): New type.
10217 (get_input_file, release_input_file): New static variables.
10218 (onload): Capture new transfer vector entries.
10219 (claim_file_hook): Stop reading at end of file according to filesize.
10220 Factor out parsing of readelf output into separate function.
10221 (all_symbols_read_hook): Exercise get_input_file and release_input_file
10222 APIs and get the source file name from the symbol table. Convert
10223 source file name to corresponding object file name. Print info
10224 message when adding new input files.
10225 (parse_readelf_line): New function.
10226 * testsuite/plugin_test_1.sh: Add checks for new info messages.
10227 * testsuite/plugin_test_2.sh: Likewise.
10228 * testsuite/plugin_test_3.sh: Likewise.
10229 * testsuite/plugin_test_4.sh: New test case.
10231 2009-01-07 Ian Lance Taylor <iant@google.com>
10233 * version.cc (version_string): Bump to 1.8.
10235 2008-12-23 Cary Coutant <ccoutant@google.com>
10237 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
10238 * plugin.cc (Plugin_manager::finish): Rename as
10239 layout_deferred_objects. Move cleanup to separate function.
10240 (Plugin_manager::cleanup): New function.
10241 (Plugin_finish::run): Call layout_deferred_objects and cleanup
10243 * plugin.h (Plugin_manager::finish): Rename as
10244 layout_deferred_objects.
10245 (Plugin_manager::cleanup): New function.
10246 (Plugin_manager::cleanup_done): New field.
10248 2008-12-23 Cary Coutant <ccoutant@google.com>
10250 * plugin.cc (is_visible_from_outside): New function.
10251 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
10252 so we don't return "IR only" status for exported symbols or -r links.
10254 * testsuite/Makefile.am (plugin_test_3): New test case.
10255 * testsuite/Makefile.in: Regenerate.
10256 * testsuite/plugin_test_3.sh: New file.
10258 2008-12-22 Cary Coutant <ccoutant@google.com>
10260 * object.cc (Sized_relobj::layout_section): New function.
10261 (Sized_relobj::do_layout): Defer layout of input sections until after
10262 plugin has provided replacement files.
10263 (Sized_relobj::do_layout_deferred_sections): New function.
10264 * object.h (Relobj::set_section_offset): Remove virtual keyword.
10265 (Relobj::layout_deferred_sections): New function.
10266 (Relobj::do_layout_deferred_sections): New function.
10267 (Sized_relobj::do_layout_deferred_sections): New function.
10268 (Sized_relobj::layout_section): New function.
10269 (Sized_relobj::Deferred_layout): New structure.
10270 (Sized_relobj::deferred_layout_): New field.
10271 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10272 Change all callers. Layout deferred sections.
10273 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
10275 (Plugin_hook::run): Move code from do_plugin_hook inline.
10276 (Plugin_hook::do_plugin_hook): Remove.
10277 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10278 (Plugin_manager::finish): Renamed, was cleanup.
10279 (Plugin_manager::should_defer_layout): New function.
10280 (Plugin_manager::add_deferred_layout_object): New function.
10281 (Plugin_manager::Deferred_layout_list): New type.
10282 (Plugin_manager::deferred_layout_objects_): New field.
10283 (Plugin_hook::do_plugin_hook): Remove.
10285 2008-12-17 Ian Lance Taylor <iant@google.com>
10287 * options.h (class General_options): Add --no case for
10290 2008-12-16 Cary Coutant <ccoutant@google.com>
10292 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
10294 (Plugin_manager::claim_file): Create plugin object even if
10295 plugin did not call the add_symbols callback.
10296 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10297 asking for more symbols than were added.
10298 * testsuite/Makefile.am (plugin_test_1): Add test case with
10300 (empty.syms): New target.
10301 * testsuite/Makefile.in: Regenerate.
10302 * testsuite/plugin_test.c (claim_file_hook): Add new debug
10303 message. Don't call add_symbols if no globals.
10304 (all_symbols_read_hook): Don't provide replacement for empty
10307 2008-12-12 Ian Lance Taylor <iant@google.com>
10309 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10310 r_type == 0 for a local symbol with r_sym == 0.
10311 (scan_relocatable_relocs): Pass r_sym to
10312 local_non_section_strategy.
10313 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10316 * configure.ac: Update test for TLS descriptors: they are
10317 supported as of glibc 2.9.
10318 * configure: Rebuild.
10320 2008-12-11 Ian Lance Taylor <iant@google.com>
10323 * target-reloc.h (Default_scan_relocatable_relocs): For each
10324 function, map r_type == 0 to RELOC_DISCARD.
10326 2008-12-10 Cary Coutant <ccoutant@google.com>
10328 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
10329 object to override a kept COMDAT group from a plugin object.
10331 2008-12-09 Ian Lance Taylor <iant@google.com>
10334 * yyscript.y (file_cmd): Handle INPUT.
10336 * testsuite/initpri1.c: Change all declarations to be full
10337 prototypes by adding void, to avoid compiler warnings.
10339 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
10341 * options.cc (General_options::parse_plugin_opt): New.
10342 (General_options::add_plugin): The argument now is just the filename.
10343 (General_options::add_plugin_option): New.
10344 * options.h (plugin_opt): New.
10345 (add_plugin): Change argument name.
10346 (add_plugin_option): New.
10347 * plugin.cc (Plugin::load): Don't parse the plugin option.
10348 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
10349 (Plugin::add_option): New.
10350 (Plugin::args_): Change type.
10351 (Plugin::filename_): New.
10352 (Plugin_manager::add_plugin_option): New.
10353 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
10354 * testsuite/Makefile.in: Regenerate.
10356 2008-12-05 Cary Coutant <ccoutant@google.com>
10358 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
10359 Handle --strip-lto-sections option.
10360 * options.h (strip_lto_sections): New option.
10362 2008-12-01 Cary Coutant <ccoutant@google.com>
10364 * plugin.cc (ld_plugin_message): Change format parameter to const.
10365 Fix mismatch between new[] and delete.
10367 2008-11-14 Cary Coutant <ccoutant@google.com>
10369 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
10372 2008-11-05 Craig Silverstein <csilvers@google.com>
10374 * options.cc (General_options::parse_dynamic_list): New function.
10375 * options.h (General_options): New flags dynamic_list,
10376 dynamic_list_data, dynamic_list_cpp_new, and
10377 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
10378 (General_options::in_dynamic_list): New function.
10379 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
10380 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
10381 (Lex::can_continue_name): Likewise.
10383 (read_script_file): New parameter script_options.
10384 (read_dynamic_list): New function.
10385 (Script_options::define_dynamic_list): New function.
10386 (dynamic_list_keyword_parsecodes): New variable.
10387 (dynamic_list_keywords): New variable.
10388 * script.h (Script_options::define_dynamic_list): New function
10390 (read_dynamic_list): New function prototype.
10391 * symtab.cc (strprefix): New macro.
10392 (Symbol::should_add_dynsym_entry): Support dynamic_list,
10393 dynamic_list_data, dynamic_list_cpp_new, and
10394 dynamic_list_cpp_typeinfo.
10395 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
10396 (dynamic_list_expr): New rule.
10397 (dynamic_list_nodes): Likewise.
10398 (dynamic_list_node): Likewise.
10399 * testsuite/Makefile.am (dynamic_list): New test.
10400 * testsuite/Makefile.in: Regenerated.
10401 * testsuite/dynamic_list.t: New file.
10402 * testsuite/dynamic_list.sh: New file.
10404 2008-11-05 Craig Silverstein <csilvers@google.com>
10406 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
10407 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
10408 (t11_last): Likewise.
10409 * testsuite/ver_test_6.c (main): Likewise.
10411 2008-10-07 Cary Coutant <ccoutant@google.com>
10413 * options.c (General_options::finalize): Add check for -static and
10415 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
10418 2008-10-02 Cary Coutant <ccoutant@google.com>
10420 * plugin.cc (make_sized_plugin_object): Fix conditional
10421 compilation to work when not all targets are enabled.
10423 2008-09-29 Cary Coutant <ccoutant@google.com>
10425 * archive.cc (Archive::get_file_and_offset): Use filename instead
10426 of name to get library path.
10427 (Archive::include_member): Unlock external member of a thin archive.
10429 * testsuite/Makefile.am (TEST_AR): New variable.
10430 (thin_archive_test_1): New test.
10431 (thin_archive_test_2): New test.
10432 * testsuite/Makefile.in: Regenerate.
10433 * testsuite/thin_archive_main.cc: New file.
10434 * testsuite/thin_archive_test_1.cc: New file.
10435 * testsuite/thin_archive_test_2.cc: New file.
10436 * testsuite/thin_archive_test_3.cc: New file.
10437 * testsuite/thin_archive_test_4.cc: New file.
10439 2008-09-29 Cary Coutant <ccoutant@google.com>
10441 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
10442 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
10444 (Sized_relobj::do_finalize_local_symbols): Likewise.
10445 (Sized_relobj::map_to_kept_section): Likewise.
10446 * object.h (Sized_relobj::invalid_address): New constant.
10447 (Sized_relobj::do_output_section_offset): Check for invalid_address
10449 * output.cc (Output_reloc::local_section_offset): Use constant
10450 invalid_address instead of -1U.
10451 (Output_reloc::get_address): Likewise.
10452 (Output_section::output_address): Change -1U to -1ULL.
10453 * output.h (Output_reloc::invalid_address): New constant.
10454 * reloc.cc (Sized_relobj::write_sections): Use constant
10455 invalid_address instead of -1U.
10456 (Sized_relobj::relocate_sections): Likewise.
10457 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
10458 values for merge sections.
10459 * target-reloc.h (relocate_for_relocatable): Use constant
10460 invalid_address instead of -1U.
10462 2008-09-19 Cary Coutant <ccoutant@google.com>
10464 Add plugin functionality for link-time optimization (LTO).
10465 * configure.ac (plugins): Add --enable-plugins option.
10466 * configure: Regenerate.
10467 * config.in: Regenerate.
10468 * Makefile.am (LIBDL): New variable.
10469 (CCFILES): Add plugin.cc.
10470 (HFILES): Add plugin.h.
10471 (ldadd_var): Add LIBDL.
10472 * Makefile.in: Regenerate.
10474 * archive.cc: Include "plugin.h".
10475 (Archive::setup): Don't preread archive symbols when using a plugin.
10476 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
10477 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
10479 (Archive::include_member): Add symbols from plugin objects.
10480 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
10481 * descriptors.cc (Descriptors::open): Check for file descriptors
10482 abandoned by plugins.
10483 (Descriptors::claim_for_plugin): New function.
10484 * descriptors.h (Descriptors::claim_for_plugin): New function.
10485 (Open_descriptor::is_claimed): New field.
10486 (claim_descriptor_for_plugin): New function.
10487 * fileread.cc (File_read::claim_for_plugin): New function.
10488 * fileread.h (File_read::claim_for_plugin): New function.
10489 (File_read::descriptor): New function.
10490 * gold.cc: Include "plugin.h".
10491 (queue_initial_tasks): Add task to call plugin hooks for generating
10493 * main.cc: Include "plugin.h".
10494 (main): Load plugin libraries.
10495 * object.h (Pluginobj): Declare.
10496 (Object::pluginobj): New function.
10497 (Object::do_pluginobj): New function.
10498 (Object::set_target): New function.
10499 * options.cc: Include "plugin.h".
10500 (General_options::parse_plugin): New function.
10501 (General_options::General_options): Initialize plugins_ field.
10502 (General_options::add_plugin): New function.
10503 * options.h (Plugin_manager): Declare.
10504 (General_options): Add --plugin option.
10505 (General_options::has_plugins): New function.
10506 (General_options::plugins): New function.
10507 (General_options::add_plugin): New function.
10508 (General_options::plugins_): New field.
10509 * plugin.cc: New file.
10510 * plugin.h: New file.
10511 * readsyms.cc: Include "plugin.h".
10512 (Read_symbols::do_read_symbols): Check for archive before checking
10513 for ELF file. Call plugin hooks to claim files.
10514 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
10515 from a real object file; force override when processing replacement
10517 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
10518 (Symbol::init_base_object): Likewise.
10519 (Symbol::init_base_output_data): Likewise.
10520 (Symbol::init_base_output_segment): Likewise.
10521 (Symbol::init_base_constant): Likewise.
10522 (Symbol::init_base_undefined): Likewise.
10523 (Symbol::output_section): Assert that object is not a plugin.
10524 (Symbol_table::add_from_pluginobj): New function.
10525 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
10527 (Symbol_table::sized_write_globals): Likewise.
10528 (Symbol_table::add_from_pluginobj): Instantiate template.
10529 * symtab.h (Sized_pluginobj): Declare.
10530 (Symbol::in_real_elf): New function.
10531 (Symbol::set_in_real_elf): New function.
10532 (Symbol::in_real_elf_): New field.
10533 (Symbol_table::add_from_pluginobj): New function.
10535 * testsuite/Makefile.am (AM_CFLAGS): New variable.
10536 (LIBDL): New variable.
10537 (LDADD): Add LIBDL.
10538 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
10539 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
10540 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
10541 (MOSTLYCLEANFILES): Likewise.
10542 * testsuite/Makefile.in: Regenerate.
10543 * testsuite/plugin_test.c: New file.
10544 * testsuite/plugin_test_1.sh: New file.
10545 * testsuite/plugin_test_2.sh: New file.
10547 2008-09-16 Ian Lance Taylor <iant@google.com>
10549 * target-reloc.h (relocate_section): Check whether a symbol is
10550 defined by the ABI before reporting an undefined symbol error.
10551 * target.h (Target::is_defined_by_abi): Make parameter const.
10552 (Target::do_is_defined_by_abi): Likewise.
10553 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
10554 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
10555 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
10556 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
10557 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
10558 * testsuite/Makefile.in: Rebuild.
10560 * fileread.cc (make_view): Add casts to avoid warning.
10562 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
10564 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
10565 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10567 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
10569 * options.h (General_options::output_is_executable): New.
10570 (General_options::output_is_pie): New.
10571 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
10572 for shared libraries.
10573 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10575 2008-09-11 Chris Demetriou <cgd@google.com>
10577 * options.h (origin): New -z option.
10578 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
10579 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
10582 2008-09-05 Cary Coutant <ccoutant@google.com>
10584 * fileread.cc (File_read::make_view): Add check for attempt to map
10585 beyond end of file.
10587 2008-09-05 Cary Coutant <ccoutant@google.com>
10589 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
10590 explicit instantiations.
10592 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
10595 * options.cc (General_options::finalize): Allow undefined symbols
10596 in shlibs if linking -shared.
10599 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
10600 symbols as not needing a dynsym entry.
10602 2008-08-20 Craig Silverstein <csilvers@google.com>
10604 * fileread.cc (File_read::open): Do not lock the file unless it
10605 was successfully opened.
10607 2008-08-14 Cary Coutant <ccoutant@google.com>
10609 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
10610 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
10611 * testsuite/tls_test.cc (struct int128): 128-bit struct
10612 for testing TLS relocs with non-zero addend.
10613 (v12): New TLS variable.
10615 (t_last): Add check for v12.
10616 * testsuite/tls_test.h (t12): New function.
10617 * testsuite/tls_test_main.cc (thread_routine): Call new test.
10619 2008-08-13 Ian Lance Taylor <iant@google.com>
10621 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
10622 set tls_segment_ or relro_segment_.
10623 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
10625 * output.h (Output_section::clear_is_relro): New function.
10626 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
10627 sections specially even when output_data_ is empty.
10628 (Output_segment::maximum_alignment): When first section is relro,
10629 only force alignment for PT_LOAD segments.
10630 * script.cc (script_data_segment_align): New function.
10631 (script_data_segment_relro_end): New function.
10632 * script-c.h (script_data_segment_align): Declare.
10633 (script_data_segment_relro_end): Declare.
10634 * script-sections.h (class Script_sections): Declare
10635 data_segment_align and data_segment_relro_end. Add fields
10636 segment_align_index_ and saw_relro_end_.
10637 * script-sections.cc (class Sections_element): Add set_is_relro
10638 virtual function. Add new bool* parameter to place_orphan_here.
10639 Add get_output_section virtual function.
10640 (class Output_section_definition): Add set_is_relro. Add new
10641 bool* parameter to place_orphan_here. Add get_output_section.
10642 Add is_relro_ field.
10643 (Output_section_definition::Output_section_definition): Initialize
10644 evaluated_address_, evaluated_load_address, evaluated_addralign_,
10645 and is_relro_ fields.
10646 (Output_section_definition::place_orphan_here): Add is_relro
10648 (Output_section_definition::set_section_addresses): Set relro for
10650 (Output_section_definition::alternate_constraint): Likewise.
10651 (class Orphan_output_section): Add new bool* parameter to
10652 place_orphan_here. Add get_output_section.
10653 (Orphan_output_section::place_orphan_here): Add is_relro
10655 (Script_sections::Script_sections): Initialize
10656 data_segment_align_index_ and saw_relro_end_.
10657 (Script_sections::data_segment_align): New function.
10658 (Script_sections::data_segment_relro_end): New function.
10659 (Script_sections::place_orphan): Set or clear is_relro.
10660 (Script_sections::set_section_addresses): Force alignment of first
10662 * yyscript.y (exp): Call script_data_segment_align and
10663 script_data_segment_relro_end.
10664 * testsuite/relro_script_test.t: New file.
10665 * testsuite/relro_test.cc (using_script): Declare.
10666 (t1, t2): Test using_script.
10667 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
10668 (relro_script_test_SOURCES): Define.
10669 (relro_script_test_DEPENDENCIES): Define.
10670 (relro_script_test_LDFLAGS): Define.
10671 (relro_script_test_LDADD): Define.
10672 (relro_script_test.so): New target.
10673 * testsuite/Makefile.in: Rebuild.
10675 2008-08-06 Cary Coutant <ccoutant@google.com>
10677 * archive.cc (Archive::total_archives, Archive::total_members)
10678 (Archive::total_members_loaded): New variables.
10679 (Archive::setup): Add parameter. Add option to preread
10681 (Archive::read_armap): Add counter.
10682 (Archive::get_file_and_offset): New function.
10683 (Archive::get_elf_object_for_member): New function.
10684 (Archive::read_all_symbols): New function.
10685 (Archive::read_symbols): New function.
10686 (Archive::add_symbols): Add counters.
10687 (Archive::include_all_members): Use armap to find members if it's
10689 (Archive::include_member): Skip reading symbols if already read.
10690 Factored code into Archive::get_file_and_offset and
10691 Archive::get_elf_object_for_member. Changed call to
10692 Mapfile::report_include_archive_member.
10693 (Archive::print_stats): New function.
10694 * archive.h: Declare Object and Read_symbols_data classes.
10695 (Archive::Archive): Add initializers for new members.
10696 (Archive::setup): Add parameter.
10697 (Archive::print_stats): New function.
10698 (Archive::total_archives, Archive::total_members)
10699 (Archive::total_members_loaded): New variables.
10700 (Archive::get_file_and_offset): New function.
10701 (Archive::get_elf_object_for_member): New function.
10702 (Archive::read_all_symbols): New function.
10703 (Archive::read_symbols): New function.
10704 (Archive::Archive_member): New class.
10705 (Archive::members_): New member.
10706 (Archive::num_members_): New member.
10707 * main.cc: Include archive.h.
10708 (main): Call Archive::print_stats.
10709 * mapfile.cc (Mapfile::report_include_archive_member): Delete
10710 archive parameter; member_name is now the fully-decorated name.
10711 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
10712 * options.h: (General_options): Add --preread-archive-symbols option.
10713 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
10716 2008-08-04 Ian Lance Taylor <iant@google.com>
10718 * symtab.h (Symbol::use_plt_offset): New function.
10719 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
10720 * powerpc.cc (Relocate::relocate): Likewise.
10721 * sparc.cc (Relocate::relocate): Likewise.
10722 * x86_64.cc (Relocate::relocate): Likewise.
10723 * testsuite/weak_plt.sh: New test.
10724 * testsuite/weak_plt_main.cc: New test.
10725 * testsuite/weak_plt_shared.cc: New test.
10726 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
10727 (check_PROGRAMS): Add weak_plt.
10728 (check_DATA): Add weak_plt_shared.so.
10729 (weak_plt_main_pic.o, weak_plt): New targets.
10730 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
10731 * testsuite/Makefile.in: Rebuild.
10733 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
10735 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
10736 * testsuite/Makefile.in: Rebuild.
10738 2008-08-04 Alan Modra <amodra@bigpond.net.au>
10740 * Makefile.am (POTFILES.in): Set LC_ALL=C.
10741 * Makefile.in: Regenerate.
10742 * po/POTFILES.in: Regenerate.
10744 2008-07-29 Ian Lance Taylor <iant@google.com>
10746 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
10747 symbols before other symbols.
10748 * testsuite/script_test_2.cc (test_addr): Declare.
10749 (test_addr_alias): Declare.
10750 (main): Check that test_addr and test_addr_alias have the right
10752 * testsuite/script_test_2.t: Define test_addr_alias and
10755 2008-07-24 Ian Lance Taylor <iant@google.com>
10758 * descriptors.cc: New file.
10759 * descriptors.h: New file.
10760 * gold-threads.h (class Hold_optional_lock): New class.
10761 * fileread.cc: Include "descriptors.h".
10762 (File_read::~File_read): Release descriptor rather than closing
10764 (File_read::open) [file]: Call open_descriptor rather than open.
10765 Set is_descriptor_opened_.
10766 (File_read::open) [memory]: Assert that descriptor is not open.
10767 (File_read::reopen_descriptor): New function.
10768 (File_read::release): Release descriptor.
10769 (File_read::do_read): Make non-const. Reopen descriptor.
10770 (File_read::read): Make non-const.
10771 (File_read::make_view): Reopen descriptor.
10772 (File_read::do_readv): Likewise.
10773 * fileread.h (class File_read): Add is_descriptor_opened_ field.
10774 Update declarations.
10775 * layout.cc: Include "descriptors.h".
10776 (Layout::create_build_id): Use open_descriptor rather than open.
10777 * output.cc: Include "descriptors.h".
10778 (Output_file::open): Use open_descriptor rather than open.
10779 * archive.cc (Archive::const_iterator): Change Archive to be
10781 (Archive::begin, Archive::end): Make non-const.
10782 (Archive::count_members): Likewise.
10783 * archive.h (class Archive): Update declarations.
10784 * object.h (Object::read): Make non-const.
10785 * Makefile.am (CCFILES): Add descriptors.cc.
10786 (HFILES): Add descriptors.h.
10787 * Makefile.in: Rebuild.
10790 * gold.h: Always include <clocale>. Add Solaris workarounds
10791 following code in binutils/sysdep.h.
10794 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
10795 this->eh_frame_hdr_ is NULL before using it.
10797 * dynobj.cc (Versions::Versions): Update comment.
10799 * dynobj.cc (Versions::Versions): If there is an soname, use it as
10800 the base version name.
10802 * stringpool.cc (Stringpool_template::add_with_length): Set key to
10803 array size plus one.
10804 (Stringpool_template::set_string_offsets): Subtract one from key
10805 before using it as an array index.
10806 (Stringpool_template::get_offset_with_length): Likewise.
10807 (Stringpool_template::write_to_buffer): Likewise.
10808 * stringpool.h (Stringpool_template::get_offset_from_key):
10811 2008-07-23 Ian Lance Taylor <iant@google.com>
10814 * object.h (Merged_symbol_value::value): Do our best to handle a
10818 * script.cc (Version_script_info::get_versions): Don't add empty
10819 version tag to return value.
10820 (Version_script_info::get_symbol_version_helper): Change return
10821 type to bool. Add pversion parameter. Change all callers.
10822 (script_register_vers_node): Don't require a non-NULL tag.
10823 * script.h (class Version_script_info): Update declarations.
10824 (Version_script_info::get_symbol_version): Change return type to
10825 bool. Add version parameter. Change all callers.
10826 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
10827 handling. Handle an empty version from a version script.
10828 (Symbol_table::define_special_symbol): Likewise.
10829 * testsuite/ver_test_10.script: New file.
10830 * testsuite/ver_test_10.sh: New file.
10831 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
10832 (check_DATA): Add ver_test_10.syms.
10833 (ver_test_10.syms, ver_test_10.so): New target.
10834 * testsuite/Makefile.in: Rebuild.
10836 2008-07-23 Simon Baldwin <simonb@google.com>
10838 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
10839 to zero for undefined symbols from dynamic libraries.
10841 2008-07-23 Ian Lance Taylor <iant@google.com>
10843 * symtab.cc (Symbol_table::resolve): Remove version parameter.
10844 Change all callers.
10845 * symtab.h (class Symbol_table): Update declaration.
10846 * testsuite/ver_test_9.cc: New file.
10847 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
10848 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
10849 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
10850 (ver_test_9.so, ver_test_9.o): New targets.
10851 * testsuite/Makefile.in: Rebuild.
10853 2008-07-22 Ian Lance Taylor <iant@google.com>
10855 * options.h (class General_options): Define --check-sections.
10856 * layout.cc (Layout::set_segment_offsets): Handle
10859 * options.h (class General_options): Define -n/--nmagic and
10861 * options.cc (General_options::finalize): For -n/--nmagic or
10862 -N/--omagic, set -static.
10863 * layout.cc (Layout::attach_allocated_section_to_segment): If
10864 -N/--omagic, don't put read-only and read-write sections in
10865 different segments.
10866 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
10867 finding a read-only segment.
10868 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
10869 don't set the minimum segment alignment to the common page size,
10870 and don't set the file offset to the address modulo the page size.
10871 * script-sections.cc (Script_sections::create_segments): If
10872 -n/--omagic, don't put read-only and read-write sections in
10873 different segments.
10875 * cref.cc: New file.
10876 * cref.h: New file.
10877 * options.h (class General_options): Add --print-symbol-counts.
10878 * main.cc (main): Issue defined symbol report if requested.
10879 * archive.cc (Archive::interpret_header): Make into a const member
10881 (Archive::add_symbols): Call Input_objects::archive_start and
10883 (Archive::const_iterator): Define new class.
10884 (Archive::begin, Archive::end): New functions.
10885 (Archive::include_all_members): Rewrite to use iterator.
10886 (Archive::count_members): New function.
10887 * archive.h (class Archive): Update declarations.
10888 (Archive::filename): New function.
10889 * object.cc: Include "cref.h".
10890 (Sized_relobj::Sized_relobj): Initialize defined_count_.
10891 (Sized_relobj::do_get_global_symbol_counts): New function.
10892 (Input_objects::add_object): Add object to cross-referencer.
10893 (Input_objects::archive_start): New function.
10894 (Input_objects::archive_stop): New function.
10895 (Input_objects::print_symbol_counts): New function.
10896 * object.h: Declare Cref and Archive.
10897 (Object::get_global_symbol_counts): New function.
10898 (Object::do_get_global_symbol_counts): New pure virtual function.
10899 (class Sized_relobj): Add defined_count_ field. Update
10901 (class Input_objects): Add cref_ field. Update constructor.
10902 Update declarations.
10903 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
10905 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
10907 (Sized_dynobj::do_get_global_symbol_counts): New function.
10908 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
10909 defined_count_. Update declarations. Define Symbols typedef.
10910 * symtab.cc (Symbol_table::add_from_relobj): Add defined
10911 parameter. Change all callers.
10912 (Symbol_table::add_from_dynobj): Add sympointers and defined
10913 parameters. Change all callers.
10914 * symtab.h (class Symbol_table): Update declarations.
10915 * Makefile.am (CCFILES): Add cref.cc.
10916 (HFILES): Add cref.h.
10917 * Makefile.in: Rebuild.
10919 2008-07-22 Simon Baldwin <simonb@google.com>
10921 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
10922 to zero when writing undefined symbols.
10924 2008-07-22 Ian Lance Taylor <iant@google.com>
10926 * output.cc (Output_section::add_input_section): Don't try to
10927 merge empty merge sections.
10929 2008-07-21 Craig Silverstein <csilvers@google.com>
10931 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10932 Include symbol version in error message.
10934 2008-07-20 Chris Demetriou <cgd@google.com>
10936 * configure.ac (gold_cv_c_random_seed): New configured variable.
10937 (RANDOM_SEED_CFLAGS): New substituted variable.
10938 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
10939 * configure: Rebuild.
10940 * Makefile.in: Likewise.
10941 * testsuite/Makefile.in: Likewise.
10943 2008-07-18 Ian Lance Taylor <iant@google.com>
10945 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
10946 where we see NAME/NULL and NAME/VERSION as separate symbols.
10947 * testsuite/ver_test_main.cc (main): Call t4.
10948 (t4, t4_2a): Define.
10949 * testsuite/ver_test_2.cc (t4_2): Define.
10950 * testsuite/ver_test_2.script: Put t4_2a in VER2.
10951 * testsuite/ver_test_4.cc (t4_2a): Define.
10952 * testsuite/ver_test_4.script: Put t4_2a in VER2.
10953 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
10955 2008-07-17 Ian Lance Taylor <iant@google.com>
10957 * dynobj.cc (Versions::add_def): If we give an error about a
10958 missing version, go ahead and create the version anyhow.
10960 2008-07-10 Ian Lance Taylor <iant@google.com>
10962 Handle output sections with more than 0x7fffffff bytes.
10963 * object.h (class Relobj): Change map_to_output_ to
10964 output_sections_, and just keep a section pointer. Change all
10965 uses. Move comdat group support to Sized_relobj.
10966 (Relobj::is_section_specially_mapped): Remove.
10967 (Relobj::output_section): Remove poff parameter. Change all
10969 (Relobj::output_section_offset): New function.
10970 (Relobj::set_section_offset): Rewrite.
10971 (Relobj::map_to_output): Remove.
10972 (Relobj::output_sections): New function.
10973 (Relobj::do_output_section_offset): New pure virtual function.
10974 (Relobj::do_set_section_offset): Likewise.
10975 (class Sized_relobj): Add section_offsets_ field. Add comdat
10976 group support from Relobj. Update declarations.
10977 (Sized_relobj::get_output_section_offset): New function.
10978 (Sized_relobj::do_output_section_offset): New function.
10979 (Sized_relobj::do_set_section_offset): New function.
10980 * object.cc (Relobj::output_section_address): Remove.
10981 (Sized_relobj::Sized_relobj): Initialize new fields.
10982 (Sized_relobj::include_section_group): Cast find_kept_object to
10984 (Sized_relobj::include_linkonce_section): Likewise.
10985 (Sized_relobj::do_layout): Use separate arrays for output section
10987 (Sized_relobj::do_count_local_symbols): Change map_to_output to
10989 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
10990 output_sections and section_offsets.
10991 (Sized_relobj::write_local_symbols): Likewise.
10992 (map_to_kept_section): Compute output address directly.
10993 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
10994 output_sections and section_offsets.
10995 (Sized_relobj::write_sections): Likewise.
10996 (Sized_relobj::relocate_sections): Likewise.
10997 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
10998 * output.h (class Output_reloc): Update declarations. Change
10999 u2_.relobj to Sized_relobj*.
11000 (class Output_data_reloc): Change add functions to use
11002 * output.cc (Output_reloc::Output_reloc): Change relobj to
11004 (Output_reloc::local_section_offset): Change return type to
11005 Elf_Addr. Use get_output_section_offset.
11006 (Output_reloc::get_address): Likewise.
11007 (Output_section::is_input_address_mapped): Don't call
11008 is_section_specially_mapped.
11009 (Output_section::output_offset): Likewise.
11010 (Output_section::output_address): Likewise.
11011 (Output_section::starting_output_address): Likewise.
11012 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
11013 parameter to Sized_relobj*.
11014 (Copy_relocs::need_copy_reloc): Likewise.
11015 (Copy_relocs::save): Likewise.
11016 * copy-relocs.h (class Copy_relocs): Update declarations.
11017 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
11018 Sized_relobj*. Change relobj_ field to Sized_relobj*.
11019 * target-reloc.h (relocate_for_relocatable): Change
11020 offset_in_output_section type to Elf_Addr. Change code that uses
11022 * layout.cc (Layout::layout): Always set *off.
11023 * mapfile.cc (Mapfile::print_input_section): Use
11024 output_section_offset.
11025 * i386.cc (Target_i386::copy_reloc): Change object parameter to
11027 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
11028 * sparc.cc (Target_sparc::copy_reloc): Likewise.
11029 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
11031 2008-07-03 Ian Lance Taylor <iant@google.com>
11033 * layout.cc (Layout::include_section): Do not discard unrecognized
11034 SHT_STRTAB sections.
11036 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
11038 * script.cc (Lex::can_continue_name): Make '?' allowable in
11039 version-script names.
11040 * testsuite/version_script.map: Change glob pattern to use '?'
11042 2008-06-30 Manish Singh <yosh@gimp.org>
11045 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
11048 2008-06-30 Ian Lance Taylor <iant@google.com>
11052 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
11053 versions]: Don't try to read the value in the contents, since we
11054 don't use it. Use the template endianness when writing.
11056 2008-06-25 Cary Coutant <ccoutant@google.com>
11058 * fileread.cc (File_read::make_view): Assert on zero-length view.
11059 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
11060 symbol table when there are no symbols to read.
11062 2008-06-23 Craig Silverstein <csilvers@google.com>
11064 * version.cc (version_string): Bump to 1.7
11066 2008-06-18 Craig Silverstein <csilvers@google.com>
11068 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
11069 constant 0xFFFF to type Valtype.
11070 (Powerpc_relocate_functions::rel16_ha): Likewise.
11072 2008-06-17 Ian Lance Taylor <iant@google.com>
11074 * output.h (Output_section::Input_section): Initialize p2align_ to
11075 zero for Output_section_data constructors.
11076 (Output_section::Input_section::addralign): If not an input
11077 section, return the alignment of the Output_section_data.
11078 * testsuite/copy_test.cc: New file.
11079 * testsuite/copy_test_1.cc: New file.
11080 * testsuite/copy_test_2.cc: New file.
11081 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
11082 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
11083 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
11084 (copy_test_1_pic.o, copy_test_1.so): New targets.
11085 (copy_test_2_pic.o, copy_test_2.so): New targets.
11086 * testsuite/Makefile.in: Rebuild.
11088 * script-sections.cc (Script_sections::place_orphan): Initialize
11089 local variable exact.
11091 2008-06-13 David Edelsohn <edelsohn@gnu.org>
11093 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
11095 2008-06-12 David Edelsohn <edelsohn@gnu.org>
11096 David S. Miller <davem@davemloft.net>
11098 * powerpc.cc: New file.
11099 * Makefile.am (TARGETSOURCES): Add powerpc.cc
11100 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
11101 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
11102 * Makefile.in: Rebuild.
11104 2008-06-09 Ian Lance Taylor <iant@google.com>
11106 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
11108 (throwing, orig_terminate): New static variables.
11109 (terminate_handler): New static function.
11110 (t2): Set terminate handler.
11112 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
11115 * binary.cc (Binary_to_elf::sized_convert): Fix .data
11118 2008-05-30 Cary Coutant <ccoutant@google.com>
11120 * archive.cc (Archive::include_all_members) Correct to step
11121 over symbol table and extended name table in thin archives.
11123 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
11126 * target-reloc.h (relocate_for_relocatable): Fix new_offset
11129 2008-05-28 Caleb Howe <cshowe@google.com>
11131 * reduced_debug_output.cc: New file.
11132 * reduced_debug_output.h: New file.
11133 * options.h (class General_options): Add --strip-debug-non-line.
11134 * options.cc (General_options::finalize): Add strip_debug_non_line
11135 to the strip heirarchy.
11136 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
11138 * layout.cc: Include "reduced_debug_output.h".
11139 (Layout::Layout): Initialize new fields.
11140 (line_only_debug_sections): New static array.
11141 (is_lines_only_debug_sections): New static inline function.
11142 (Layout::include_section): Handle --strip-debug-non-line.
11143 (Layout::make_output_section): If --strip-debug-non-line, build
11144 new output sections for .debug_abbrev and .debug_info.
11145 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
11146 gold. Warn about possible overflow.
11147 (read_signed_LEB_128): Likewise.
11148 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
11149 (read_signed_LEB_128): Declare.
11150 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
11151 (HFILES): Add reduced_debug_output.h.
11152 * Makefile.in: Rebuild.
11154 2008-05-21 Ian Lance Taylor <iant@google.com>
11156 * mapfile.cc: New file.
11157 * mapfile.h: New file.
11158 * options.h (class General_options): Add -M/--print-map and -Map.
11159 * options.cc (General_options::finalize): Make -M equivalent to
11161 * main.cc: Include <cstdio> and "mapfile.h".
11162 (main): Open mapfile if requested.
11163 * gold.cc (class Middle_runner): Add mapfile_ field. Update
11164 constructor. Change caller.
11165 (queue_initial_tasks): Add mapfile parameter. Change caller.
11166 (queue_middle_tasks): Likewise.
11167 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
11169 * archive.cc: Include "mapfile.h".
11170 (Archive::add_symbols): Add mapfile parameter. Change all
11171 callers. Pass mapfile, symbol, and reason to include_member.
11172 (Archive::include_all_members): Add mapfile parameter. Change all
11174 (Archive::include_member): Add mapfile, sym, and why parameters.
11175 Change all callers. Report inclusion to map file.
11176 * archive.h: Include "fileread.h".
11177 (class Archive): Update declarations.
11178 (Archive::file): New const method.
11179 (class Add_archive_symbols): Add mapfile_ field. Update
11180 constructor. Change all callers.
11181 * readsyms.h (class Read_symbols): Likewise.
11182 (class Finish_group): Likewise.
11183 (class Read_script): Likewise.
11184 * common.cc: Include "mapfile.h".
11185 (Symbol_table::allocate_commons): Add mapfile parameter. Change
11187 (Symbol_table::do_allocate_commons): Likewise.
11188 (Symbol_table::do_allocate_commons_list): Likewise. Report common
11189 symbol allocation to mapfile.
11190 * common.h (class Allocate_commons_task): Add mapfile_ field.
11191 Update constructor. Change all callers.
11192 * symtab.h (class Symbol_table): Update declarations.
11193 * layout.cc: Include "mapfile.h".
11194 (Layout_task_runner::run): Print information to mapfile.
11195 (Layout::create_gold_note): Change Output_data_fixed_space to
11196 Output_data_zero_fill.
11197 (Layout::create_build_id): Likewise.
11198 (Layout::print_to_mapfile): New function.
11199 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
11200 constructor. Change caller.
11201 (class Layout): Declare print_to_mapfile.
11202 * output.cc (Output_section::Input_section::print_to_mapfile): New
11204 (Output_section::add_input_section): If producing a map, always
11205 add to input_sections_ list.
11206 (Output_section::do_print_to_mapfile): New function.
11207 (Output_segment::print_sections_to_mapfile): New function.
11208 (Output_segment::print_section_list_to_mapfile): New function.
11209 * output.h: Include "mapfile.h".
11210 (Output_data::print_to_mapfile): New function.
11211 (Output_data::do_print_to_mapfile): New virtual function.
11212 (Output_segment_headers::do_print_to_mapfile): New function.
11213 (Output_file_header::do_print_to_mapfile): New function.
11214 (Output_data_const::do_print_to_mapfile): New function.
11215 (class Output_data_const_buffer): Add map_name_ field. Update
11216 constructor. Change all callers. Add do_print_to_mapfile
11218 (class Output_data_fixed_space): Likewise.
11219 (class Output_data_space): Likewise.
11220 (class Output_data_zero_fill): New class.
11221 (Output_data_strtab::do_print_to_mapfile): New function.
11222 (Output_data_reloc_base::do_print_to_mapfile): New function.
11223 (Output_relocatable_relocs::do_print_to_mapfile): New function.
11224 (Output_data_group::do_print_to_mapfile): New function.
11225 (Output_data_got::do_print_to_mapfile): New function.
11226 (Output_data_dynamic::do_print_to_mapfile): New function.
11227 (Output_symtab_xindex::do_print_to_mapfile): New function.
11228 (class Output_section): Declare do_print_to_mapflie. Declare
11229 print_to_mapfile in Input_section.
11230 (class Output_segment): Declare new functions.
11231 * object.h (Sized_relobj::symbol_count): New function.
11232 * script-sections.cc
11233 (Output_section_element_dot_assignment::set_section_addresses):
11234 Change Output_data_fixed_space to Output_data_zero_fill.
11235 (Output_data_expression::do_print_to_mapfile): New function.
11236 * script.cc (read_input_script): Add mapfile parameter. Change
11238 * script.h (read_input_script): Update declaration.
11239 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
11240 (Eh_frame::do_print_to_mapfile): New function.
11241 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
11242 (Output_merge_string::do_print_to_mapfile): New function.
11243 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
11245 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
11247 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
11249 * Makefile.am (CCFILES): Add mapfile.cc.
11250 (HFILES): Add mapfile.h.
11251 * Makefile.in: Rebuild.
11253 2008-05-19 Ian Lance Taylor <iant@google.com>
11255 * options.h (class General_options): Add -z relro.
11256 * layout.cc (Layout::Layout): Initialize relro_segment_.
11257 (Layout::add_output_section_data): Return the output section.
11258 (Layout::make_output_section): Rcognize relro sections and mark
11259 them appropriately.
11260 (Layout::attach_allocated_section_to_segment): Put relro sections
11261 in a PT_GNU_RELRO segment.
11262 (Layout::create_initial_dynamic_sections): Mark the .dynamic
11264 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11266 (Layout::linkonce_mapping): Map d.rel.ro.local to
11267 .data.rel.ro.local.
11268 (Layout::output_section_name): Us .data.rel.ro.local for any
11269 section which begins with that.
11270 * layout.h (class Layout): Update add_output_section_data
11271 declaration. Add relro_segment_ field.
11272 * output.cc (Output_section::Output_section): Initialize is_relro_
11273 and is_relro_local_ fields.
11274 (Output_segment::add_output_section): Group relro sections.
11275 (Output_segment::is_first_section_relro): New function.
11276 (Output_segment::maximum_alignment): If there is a relro section,
11277 align the segment to the common page size.
11278 (Output_segment::set_section_addresses): Track whether we are
11279 looking at relro sections. If the last section is a relro
11280 section, align to the common page size.
11281 (Output_segment::set_section_list_addresses): Add in_relro
11282 parameter. Change all callers. Align to the page size when
11283 moving from relro to non-relro section.
11284 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
11286 * output.h (class Output_section): Add is_relro_ and
11287 is_relro_local_ fields.
11288 (Output_section::is_relro): New function.
11289 (Output_section::set_is_relro): New function.
11290 (Output_section::is_relro_local): New function.
11291 (Output_section::set_is_relro_local): New function.
11292 (class Output_segment): Update declarations.
11293 * i386.cc (Target_i386::got_section): Mark .got section as relro.
11294 * sparc.cc (Target_sparc::got_section): Likewise.
11295 * x86_64.cc (Target_x86_64::got_section): Likewise.
11296 * testsuite/relro_test_main.cc: New file.
11297 * testsuite/relro_test.cc: New file.
11298 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11299 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11300 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11301 (relro_test.so, relro_test_pic.o): New targets.
11302 * testsuite/Makefile.in: Rebuild.
11304 2008-05-16 Ian Lance Taylor <iant@google.com>
11306 * output.cc (Output_segment::add_output_section): Remove front
11308 * output.h (class Output_segment): Remove
11309 add_initial_output_section and overloaded add_output_section.
11310 Update declaration of remaining add_output_section.
11311 * layout.cc (Layout::create_interp): Call add_output_section
11312 rather than add_initial_output_section.
11313 (Layout::finish_dynamic_section): Likewise.
11315 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
11316 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
11317 know the dynamic type.
11318 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
11319 field. Initialize it in constructor.
11320 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
11321 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
11322 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
11325 * output.cc (Output_reloc::get_address): Change return type to
11327 * output.h (class Output_reloc): Update get_address declaration.
11328 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
11329 for section addresses.
11331 2008-05-09 Ian Lance Taylor <iant@google.com>
11334 * gold.cc (gold_nomem): Use return value of write.
11336 2008-05-08 Ian Lance Taylor <iant@google.com>
11338 * symtab.c (Symbol::init_base_output_data): Add version
11339 parameter. Change all callers.
11340 (Symbol::init_base_output_segment): Likewise.
11341 (Symbol::init_base_constant): Likewise.
11342 (Symbol::init_base_undefined): Likewise.
11343 (Sized_symbol::init_output_data): Likewise.
11344 (Sized_symbol::init_output_segment): Likewise.
11345 (Sized_symbol::init_constant): Likewise.
11346 (Sized_symbol::init_undefined): Likewise.
11347 (Symbol_table::do_define_in_output_data): If the new symbol has a
11348 version, mark it as the default.
11349 (Symbol_table::do_define_in_output_segment): Likewise.
11350 (Symbol_table::do_define_as_constant): Likewise.
11351 * symtab.h (class Symbol): Update declarations.
11352 (class Sized_symbol): Likewise.
11353 * resolve.cc (Symbol::override_version): New function.
11354 (Symbol::override_base): Call override_version.
11355 (Symbol::override_base_with_special): Likewise.
11356 * testsuite/ver_script_8.script: New file.
11357 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
11358 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
11359 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
11360 (ver_test_8_1.so, ver_test_8_2.so): New targets.
11362 2008-05-06 Ian Lance Taylor <iant@google.com>
11365 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
11367 (class General_options): Remove existing --undefined, and add
11368 --no-undefined instead. Add new --undefined as synonym for -u.
11369 * archive.cc (Archive::add_symbols): Check whether symbol was
11371 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
11372 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
11373 all uses. Add IS_UNDEFINED. Update declarations to split
11374 different versions of init_base. Declare init_base_undefined.
11375 (Symbol::is_defined): Handle IS_UNDEFINED.
11376 (Symbol::is_undefined): Likewise.
11377 (Symbol::is_weak_undefined): Call is_undefined.
11378 (Symbol::is_absolute): Handle IS_CONSTANT.
11379 (class Sized_symbol): Update declarations to split different
11380 versions of init. Declare init_undefined.
11381 (class Symbol_table): Declare new functions.
11382 * symtab.cc (Symbol::init_base_object): Rename from init_base.
11383 Change all callers.
11384 (Symbol::init_base_output_data): Likewise.
11385 (Symbol::init_base_output_segment): Likewise.
11386 (Symbol::init_base_constant): Likewise.
11387 (Symbol::init_base_undefined): New function.
11388 (Sized_symbol::init_object): Rename from init. Change all
11390 (Sized_symbol::init_output_data): Likewise.
11391 (Sized_symbol::init_output_segment): Likewise.
11392 (Sized_symbol::init_constant): Likewise.
11393 (Sized_symbol::init_undefined): New function.
11394 (Symbol_table::add_undefined_symbols_from_command_line): New
11396 (Symbol_table::do_add_undefined_symbols_from_command_line): New
11398 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
11399 (Symbol::output_section): Likewise.
11400 (Symbol::set_output_section): Likewise.
11401 (Symbol_table::sized_finalize_symbol): Likewise.
11402 (Symbol_table::sized_write_globals): Likewise.
11403 * resolve.cc (Symbol_table::should_override): Likewise.
11404 (Symbol::override_base_with_special): Likewise.
11406 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
11407 symbol, change it to have default visibility.
11408 * testsuite/protected_1.cc: New file.
11409 * testsuite/protected_2.cc: New file.
11410 * testsuite/protected_3.cc: New file.
11411 * testsuite/protected_main_1.cc: New file.
11412 * testsuite/protected_main_2.cc: New file.
11413 * testsuite/protected_main_3.cc: New file.
11414 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
11415 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
11416 (protected_1_LDFLAGS, protected_1_LDADD): Define.
11417 (protected_1.so): New target.
11418 (protected_1_pic.o, protected_2_pic.o): New targets.
11419 (protected_3_pic.o): New target.
11420 (check_PROGRAMS): Add protected_2.
11421 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
11422 (protected_2_LDFLAGS, protected_2_LDADD): Define.
11423 * testsuite/Makefile.in: Rebuild.
11425 * options.h (DEFINE_var): Add set_user_set_##varname__.
11426 (DEFINE_bool_alias): New macro.
11427 (class General_options): Define -Bstatic using DEFINE_bool_alias
11428 rather than DEFINE_special. Add --undefined as an alias for -z
11430 * options.cc (General_options::parse_Bstatic): Remove.
11432 * options.h (class General_options): Add --fatal-warnings.
11433 * main.cc (main): Implement --fatal-warnings.
11434 * errors.h (Errors::warning_count): New function.
11436 * options.h (class General_options): Add -Bsymbolic-functions.
11437 * symtab.h (Symbol::is_preemptible): Check for
11438 -Bsymbolic-functions.
11440 2008-05-05 Ian Lance Taylor <iant@google.com>
11442 * options.h (DEFINE_bool): For DASH_Z, create the negative option
11443 as noVARNAME rather than no-VARNAME.
11444 (class General_options): Add option -z combreloc.
11445 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
11447 (Output_reloc::sort_before) [SHT_REL]: New function.
11448 (Output_reloc::sort_before) [SHT_RELA]: New function.
11449 (class Output_data_reloc_base): Add sort_relocs_ field. Define
11450 Sort_relocs_comparison.
11451 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
11452 parameter. Change all callers.
11453 (Output_data_reloc::Output_data_reloc) [both versions]: Add
11454 sort_relocs parameter. Change all callers.
11455 * output.cc (Output_reloc::get_address): New function, broken out
11457 (Output_reloc::write_rel): Call it.
11458 (Output_reloc::compare): New function.
11459 (Output_data_reloc_base::do_write): Optionally sort relocs.
11461 * configure.ac: If targ_extra_obj is set, link it in.
11462 * configure.tgt: Initialize all variables.
11463 (x86_64*): Set targ_extra_obj and targ_extra_size.
11464 * configure: Rebuild.
11466 * object.cc (Sized_relobj::include_section_group): Adjust section
11467 indexes read from group data. Build vector to pass to
11469 * layout.cc (Layout::layout_group): Add flags and shndxes
11470 parameters. Remove contents parameter. Change caller. Update
11471 explicit instantiations.
11472 * layout.h (class Layout): Update layout_group declaration.
11473 * output.cc (Output_data_group::Output_data_group): Add flags and
11474 input_shndxes parameters. Remove contents parameter. Change
11476 (Output_data_group::do_write): Change input_sections_ to
11478 * output.h (class Output_data_group): Update constructor
11479 declaration. Rename input_sections_ to input_shndxes_.
11480 * testsuite/many_sections_test.cc: Add template.
11482 2008-04-30 Cary Coutant <ccoutant@google.com>
11484 * target-reloc.h (relocate_section): Fix dead-pointer bug.
11486 * layout.cc (Layout::include_section): Refactored check for debug
11488 (Layout::add_comdat): Add new parameters. Change type
11489 of signature parameter. Add object and shndx to signatures table.
11490 (Layout::find_kept_object): New function.
11491 * layout.h: Include <cstring>.
11492 (Layout::is_debug_info_section): New function.
11493 (Layout::add_comdat): Add new parameters.
11494 (Layout::find_kept_object): New function.
11495 (Layout::Kept_section): New struct.
11496 (Layout::Signatures): Change type of map range.
11497 * object.cc (Relobj::output_section_address): New function.
11498 (Sized_relobj::include_section_group): Add new parameters. Change
11499 calls to Layout::add_comdat. Change to build table of kept comdat
11500 groups and table mapping discarded sections to kept sections.
11501 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
11502 (Sized_relobj::do_layout): Change calls to include_section_group and
11503 include_linkonce_section.
11504 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
11505 value to zero when section is discarded.
11506 (Sized_relobj::map_to_kept_section): New function.
11507 * object.h (Relobj::output_section_address): New function.
11508 (Relobj::Comdat_group): New type.
11509 (Relobj::find_comdat_group): New function.
11510 (Relobj::Comdat_group_table): New type.
11511 (Relobj::Kept_comdat_section): New type.
11512 (Relobj::Kept_comdat_section_table): New type.
11513 (Relobj::add_comdat_group): New function.
11514 (Relobj::set_kept_comdat_section): New function.
11515 (Relobj::get_kept_comdat_section): New function.
11516 (Relobj::comdat_groups_): New field.
11517 (Relobj::kept_comdat_sections_): New field.
11518 (Symbol_value::input_value): Update comment.
11519 (Sized_relobj::map_to_kept_section) New function.
11520 (Sized_relobj::include_linkonce_section): Add new parameter.
11521 * target-reloc.h (Comdat_behavior): New type.
11522 (get_comdat_behavior): New function.
11523 (relocate_section): Add code to map a discarded section to the
11524 corresponding kept section when applying a relocation.
11526 2008-04-30 Craig Silverstein <csilvers@google.com>
11528 * dwarf_reader.cc (next_generation_count): New static var.
11529 (Addr2line_cache_entry): New struct.
11530 (addr2line_cache): New static var.
11531 (Dwarf_line_info::one_addr2line): Added caching.
11532 (Dwarf_line_info::clear_addr2line_cache): New function.
11533 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
11534 cache-size parameter.
11535 (Dwarf_line_info::one_addr2line_cache): New function.
11536 * symtab.cc (Symbol_table::detect_odr_violations): Pass
11537 new cache-size argument to one_addr2line(), and clear cache.
11539 2008-04-28 Cary Coutant <ccoutant@google.com>
11541 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
11542 R_386_PC8 relocations.
11544 2008-04-23 Ian Lance Taylor <iant@google.com>
11546 * object.cc (Sized_relobj::include_section_group): Check for
11547 invalid section group.
11549 * object.cc (make_elf_object): Correct test for 64-bit ELF file
11552 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
11553 than read for file header.
11554 * archive.cc (Archive::include_member): Likewise.
11556 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
11558 * aclocal.m4: Regenerate.
11559 * configure: Regenerate.
11561 2008-04-19 Ian Lance Taylor <iant@google.com>
11563 * version.cc (version_string): Bump to 1.6.
11565 * testsuite/Makefile.am (many_sections_r_test): New target.
11566 (many_sections_r_test_SOURCES): Remove.
11567 (many_sections_r_test_DEPENDENCIES): Remove.
11568 (many_sections_r_test_LDFLAGS): Remove.
11569 (many_sections_r_test_LDADD): Remove.
11571 * object.cc (Sized_relobj::do_add_symbols): Always pass
11572 local_symbol_count_ to add_from_relobj.
11574 * testsuite/Makefile.am (many_sections_check.h): Only check one in
11575 every thousand variables.
11576 * testsuite/Makefile.in: Rebuild.
11578 * object.cc (Xindex::initialize_symtab_xindex): New function.
11579 (Xindex::read_symtab_xindex): New function.
11580 (Xindex::sym_xindex_to_shndx): New function.
11581 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
11583 (Sized_relobj::do_initialize_xindex): New function.
11584 (Sized_relobj::do_read_symbols): Adjust section links.
11585 (Sized_relobj::symbol_section_and_value): Add is_ordinary
11586 parameter. Change all callers.
11587 (Sized_relobj::include_section_group): Adjust section links and
11588 symbol section indexes.
11589 (Sized_relobj::do_layout): Adjust section links.
11590 (Sized_relobj::do_count_local_symbols): Adjust section links and
11591 symbol section indexes.
11592 (Sized_relobj::do_finalize_local_symbols): Distinguish between
11593 ordinary and special symbols.
11594 (Sized_relobj::write_local_symbols): Add symtab_xindex and
11595 dynsym_xindex parameters. Change all callers. Adjust section
11596 links. Use SHN_XINDEX when needed.
11597 (Sized_relobj::get_symbol_location_info): Adjust section links.
11598 Don't get fooled by special symbols.
11599 * object.h (class Xindex): Define.
11600 (class Object): Add xindex_ parameter. Declare virtual functoin
11601 do_initialize_xindex.
11602 (Object::adjust_sym_shndx): New function.
11603 (Object::set_xindex): New protected function.
11604 (class Symbol_value): Add is_ordinary_shndx_ field.
11605 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
11606 (Symbol_value::value): Assert ordinary section.
11607 (Symbol_value::initialize_input_to_output_map): Likewise.
11608 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
11609 Change all callers.
11610 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
11612 (class Sized_relobj): Update declarations.
11613 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
11614 parameter. Change all callers.
11615 (Sized_relobj::adjust_shndx): New function.
11616 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
11618 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
11619 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
11620 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
11621 (Sized_dynobj::read_dynsym_section): Adjust section links.
11622 (Sized_dynobj::read_dynamic): Likewise.
11623 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
11625 (Sized_dynobj::do_initialize_xindex): New function.
11626 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
11627 do_initialize_xindex.
11628 (Sized_dynobj::adjust_shndx): New function.
11629 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
11630 dynsym_xindex_ fields.
11631 (Layout::finalize): Add a call to set_section_indexes before
11632 creating the symtab sections.
11633 (Layout::set_section_indexes): Don't do anything if the section
11634 already has a section index.
11635 (Layout::create_symtab_sections): Add shnum parameter. Change
11636 caller. Create .symtab_shndx section if needed.
11637 (Layout::create_shdrs): Add shstrtab_section parameter. Change
11639 (Layout::allocated_output_section_count): New function.
11640 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
11642 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
11643 fields. Update declarations.
11644 (Layout::symtab_xindex): New function.
11645 (Layout::dynsym_xindex): New function.
11646 (class Write_symbols_task): Add layout_ field.
11647 (Write_symbols_task::Write_symbols_task): Add layout parameter.
11649 * output.cc (Output_section_headers::Output_section_headers): Add
11650 shstrtab_section parameter. Change all callers.
11651 (Output_section_headers::do_sized_write): Store overflow values
11652 for section count and section string table section index in
11653 section header zero.
11654 (Output_file_header::do_sized_write): Check for overflow of
11655 section count and section string table section index.
11656 (Output_symtab_xindex::do_write): New function.
11657 (Output_symtab_xindex::endian_do_write): New function.
11658 * output.h (class Output_section_headers): Add shstrtab_section_.
11659 Update declarations.
11660 (class Output_symtab_xindex): Define.
11661 (Output_section::has_out_shndx): New function.
11662 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
11664 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
11665 Change all callers.
11666 (Sized_symbol::init): Likewise.
11667 (Symbol::output_section): Check for ordinary symbol.
11668 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
11669 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
11671 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
11672 Change all callers. Simplify handling of symbols from sections
11673 not included in the link.
11674 (Symbol_table::add_from_dynobj): Handle ordinary symbol
11676 (Weak_alias_sorter::operator()): Assert that symbols are
11678 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
11680 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
11681 parameters. Change all callers.
11682 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
11683 symbol distinction. Use SHN_XINDEX when needed.
11684 (Symbol_table::write_section_symbol): Add symtab_xindex
11685 parameter. Change all callers.
11686 (Symbol_table::sized_write_section_symbol): Likewise. Use
11687 SHN_XINDEX when needed.
11688 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
11690 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
11691 (Symbol::is_defined): Check is_ordinary.
11692 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
11693 (Symbol::is_absolute, Symbol::is_common): Likewise.
11694 (class Sized_symbol): Update declarations.
11695 (class Symbol_table): Update declarations.
11696 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
11697 parameters. Change all callers.
11698 (Sized_symbol::override): Likewise.
11699 (Symbol_table::override): Likewise.
11700 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
11701 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
11702 is_ordinary, and orig_st_shndx parameters. Change all callers.
11703 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
11704 to be in an ordinary section.
11705 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
11706 object and is_ordinary parameters. Change all callers.
11707 (Sized_dwarf_line_info::read_relocs): Add object parameter.
11708 Change all callers. Don't add undefined or non-ordinary symbols
11710 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
11711 Change all callers.
11712 * dwarf_reader.h (class Sized_dwarf_line_info): Update
11714 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
11715 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
11716 (Sized_relobj::relocate_sections): Likewise.
11717 * target-reloc.h (scan_relocs): Adjust section symbol index.
11718 (scan_relocatable_relocs): Likewise.
11719 * i386.cc (Scan::local): Check for ordinary symbols.
11720 * sparc.cc (Scan::local): Likewise.
11721 * x86_64.cc (Scan::local): Likewise.
11722 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
11723 to symbol_section_and_value.
11724 * testsuite/many_sections_test.cc: New file.
11725 * testsuite/Makefile.am (BUILT_SOURCES): Define.
11726 (check_PROGRAMS): Add many_sections_test.
11727 (many_sections_test_SOURCES): Define.
11728 (many_sections_test_DEPENDENCIES): Define.
11729 (many_sections_test_LDFLAGS): Define.
11730 (BUILT_SOURCES): Add many_sections_define.h.
11731 (many_sections_define.h): New target.
11732 (BUILT_SOURCES): Add many_sections_check.h.
11733 (many_sections_check.h): New target.
11734 (check_PROGRAMS): Add many_sections_r_test.
11735 (many_sections_r_test_SOURCES): Define.
11736 (many_sections_r_test_DEPENDENCIES): Define.
11737 (many_sections_r_test_LDFLAGS): Define.
11738 (many_sections_r_test_LDADD): Define.
11739 (many_sections_r_test.o): New target.
11740 * testsuite/Makefile.in: Rebuild.
11742 2008-04-17 Cary Coutant <ccoutant@google.com>
11744 * errors.cc (Errors::info): New function.
11745 (gold_info): New function.
11746 * errors.h (Errors::info): New function.
11747 * gold.h (gold_info): New function.
11748 * object.cc (Input_objects::add_object): Print trace output.
11749 * options.cc (options::parse_set): New function.
11750 (General_options::parse_wrap): Deleted.
11751 (General_options::General_options): Deleted initializer.
11752 * options.h (options::String_set): New typedef.
11753 (options::parse_set): New function.
11754 (DEFINE_set): New macro.
11755 (General_options::wrap): Changed to use DEFINE_set. Changed
11756 callers of any_wrap_symbols and is_wrap_symbol.
11757 (General_options::trace, General_options::trace_symbol):
11759 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
11760 (General_options::wrap_symbols_): Deleted.
11761 * symtab.cc (Symbol_table::add_from_object): Print trace output.
11763 2008-04-17 David S. Miller <davem@davemloft.net>
11765 * options.cc (General_options::parse_V): New function.
11766 * options.h: Add entries for -V and -Qy.
11768 2008-04-17 Ian Lance Taylor <iant@google.com>
11770 * common.cc (Symbol_table::allocate_commons): Remove options
11771 parameter. Change caller.
11772 (Symbol_table::do_allocate_commons): Remove options parameter.
11773 Change caller. Just call do_allocate_commons_list twice.
11774 (Symbol_table::do_allocate_commons_list): New function, broken out
11775 of do_allocate_commons.
11776 * common.h (class Allocate_commons_task): Remove options_ field.
11777 Update constructor.
11778 * symtab.cc (Symbol_table::Symbol_table): Initialize
11780 (Symbol_table::add_from_object): Put TLS common symbols on
11782 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
11783 which are IN_OUTPUT_DATA.
11784 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
11785 allocate_commons and do_allocate_commons declarations. Declare
11786 do_allocate_commons_list.
11787 * gold.cc (queue_middle_tasks): Update creation of
11788 Allocate_commons_task to not pass options.
11789 * testsuite/Makefile.am (INCLUDES): Add -I.. .
11790 (TLS_TEST_C_FLAGS): New variable.
11791 (tls_test_c_pic.o): New target.
11792 (tls_test_shared.so): Link in tls_test_c_pic.o.
11793 (tls_test_c_pic_ie.o): New target.
11794 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
11795 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
11796 (tls_test_c.o): New target.
11797 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
11798 (tls_pic_test_LDADD): Likewise.
11799 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
11800 (tls_shared_gd_to_ie_test_LDADD): Likewise.
11801 (tls_test_c_gnu2.o): New target.
11802 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
11804 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
11805 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
11806 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
11807 * testsuite/tls_test.cc: Include "config.h".
11808 (t_last): Call t11_last.
11809 * testsuite/tls_test.h (t11, t11_last): Declare.
11810 * testsuite/tls_test_c.c: New file.
11811 * testsuite/tls_test_main.cc (thread_routine): Call t11.
11812 * configure.ac: Check for OpenMP support.
11813 * configure, config.in, Makefile.in: Rebuild.
11814 * testsuite/Makefile.in: Rebuild.
11816 2008-04-16 Cary Coutant <ccoutant@google.com>
11818 * i386.cc (Target_i386::define_tls_base_symbol): New function.
11819 (Target_i386::tls_base_symbol_defined_): New field.
11820 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11821 (Target_i386::Scan::global): Likewise.
11822 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
11823 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
11824 (Target_x86_64::tls_base_symbol_defined_): New field.
11825 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11826 (Target_x86_64::Scan::global): Likewise.
11828 2008-04-16 Cary Coutant <ccoutant@google.com>
11830 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
11831 (Symbol::needs_plt_entry): Allow weak undefined symbols.
11832 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
11833 building shared libraries.
11834 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
11835 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
11836 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
11837 * testsuite/Makefile.in: Rebuild.
11838 * testsuite/weak_undef.h: New file.
11839 * testsuite/weak_undef_file1.cc: Add extra test cases.
11840 * testsuite/weak_undef_file2.cc: Likewise.
11841 * testsuite/weak_undef_test.cc: Likewise.
11843 2008-04-16 David S. Miller <davem@davemloft.net>
11845 * sparc.cc (Target_sparc::Scan): Change from struct to class.
11846 Add issued_non_pic_error_ field. Declare check_non_pic.
11847 (Target_sparc::Scan::check_non_pic): New function.
11848 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
11849 (Target_sparc::Scan::global): Likewise.
11851 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
11852 * configure: Rebuild.
11854 * options.h (DEFINE_enable): New macro.
11855 (new_dtags): New enable option.
11856 (initfirst, interpose, loadfltr, nodefaultlib,
11857 nodelete, nodlopen, nodump): New -z options.
11858 * layout.cc (Layout:finish_dynamic_section): If new
11859 dtags enabled, emit DT_RUNPATH. Also, emit a
11860 DT_FLAGS_1 containing any specified -z flags.
11862 2008-04-16 Ian Lance Taylor <iant@google.com>
11864 * copy-relocs.cc: New file.
11865 * copy-relocs.h: New file.
11866 * reloc.cc: Remove Copy_relocs code.
11867 * reloc.h: Likewise.
11868 * reloc-types.h (struct Reloc_types) [both versions]: Add
11869 get_reloc_addend_noerror.
11870 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
11871 variants of add_global which take an addend which must be zero.
11872 * i386.cc: Include "copy-relocs.h".
11873 (class Target_i386): Change type of copy_relocs_ to variable,
11874 update initializer.
11875 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
11876 Change all callers.
11877 (Target_i386::do_finalize_sections): Change handling of
11879 * sparc.cc: Include "copy-relocs.h".
11880 (class Target_sparc): Change type of copy_relocs_ to variable,
11881 update initializer.
11882 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
11883 Change all callers.
11884 (Target_sparc::do_finalize_sections): Change handling of
11886 * x86_64.cc: Include "copy-relocs.h".
11887 (class Target_x86_64): Change type of copy_relocs_ to variable,
11888 update initializer.
11889 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
11890 class. Change all callers.
11891 (Target_x86_64::do_finalize_sections): Change handling of
11893 * Makefile.am (CCFILES): Add copy-relocs.cc.
11894 (HFILES): Add copy-relocs.h.
11896 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
11898 * testsuite/script_test_4.sh: Permit leading zeroes.
11900 2008-04-15 Ian Lance Taylor <iant@google.com>
11902 * script-sections.cc (Script_sections::create_segments): Use
11903 header_size_adjustment even when there is enough room for the
11905 * testsuite/script_test_4.sh: New file.
11906 * testsuite/script_test_4.t: New file.
11907 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
11908 (check_DATA): Add script_test_4.stdout.
11909 (MOSTLYCLEANFILES): Likewise.
11910 (script_test_4): New target.
11911 (script_test_4.stdout): New target.
11912 * testsuite/Makefile.in: Rebuild.
11914 * sparc.cc: Add definitions for Output_data_plt_sparc class
11917 2008-04-14 David S. Miller <davem@davemloft.net>
11919 * sparc.cc: New file.
11920 * Makefile.am (TARGETSOURCES): Add sparc.cc
11921 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
11922 * configure.tgt: Document targ_extra_size and
11923 targ_extra_big_endian. Add entries for sparc-* and
11925 * configure.ac: Handle targ_extra_size and
11926 targ_extra_big_endian.
11927 * Makefile.in: Rebuild.
11928 * configure: Likewise.
11929 * po/POTFILES.in: Likewise.
11930 * po/gold.pot: Likewise.
11932 2008-04-14 Ian Lance Taylor <iant@google.com>
11934 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
11935 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
11936 in the name/type/flags to section mapping. Don't call
11937 allocate_output_section.
11938 (Layout::choose_output_section): Change parameter from adjust_name
11939 to is_input_section. Don't permit input sections after sections
11940 are attached to segments. Don't call allocate_output_section.
11941 (Layout::layout_eh_frame): Call update_flags_for_input_section,
11942 not write_enable_output_section.
11943 (Layout::make_output_section): Don't push to
11944 unattached_section_list_ nor call attach_to_segment. Call
11945 attach_section_to_segment if sections are attached.
11946 (Layout::attach_sections_to_segments): New function.
11947 (Layout::attach_section_to_segment): New function.
11948 (Layout::attach_allocated_section_to_segment): Rename from
11949 attach_to_segment. Remove flags parameter.
11950 (Layout::allocate_output_section): Remove function.
11951 (Layout::write_enable_output_section): Remove function.
11952 * layout.h (class Layout): Update for above changes. Add new
11953 field sections_are_attached_.
11954 * output.h (Output_section::update_flags_for_input_section): New
11956 * output.cc (Output_section::add_input_section): Call
11957 update_flags_for_input_section.
11958 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
11960 2008-04-11 Cary Coutant <ccoutant@google.com>
11962 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
11963 thought unnecessary.
11964 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
11966 2008-04-11 Ian Lance Taylor <iant@google.com>
11968 * output.h (class Output_section_data): Remove inline definition
11970 * output.cc (Output_section_data::set_addralign): New function.
11972 2008-04-11 Cary Coutant <ccoutant@google.com>
11974 Add support for TLS descriptors for i386 and x86_64.
11975 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
11976 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
11977 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
11979 (Target_i386::got_mod_index_entry): Remove unnecessary code.
11980 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
11981 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
11983 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
11984 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
11985 Fix problem with initial-exec relocations.
11986 (Target_i386::Relocate::relocate_tls): Likewise.
11987 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
11989 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
11990 support for section-plus-offset dynamic table entries.
11991 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
11992 (Output_data_dynamic::Dynamic_entry): Add support for
11993 section-plus-offset dynamic table entries.
11994 (Output_data_dynamic::Classification): Likewise.
11995 (Output_data_dynamic::classification_): Renamed offset_.
11996 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
11997 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
11998 (Target_x86_64::make_plt_section): New function.
11999 (Target_x86_64::reserve_tlsdesc_entries): New function.
12000 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
12001 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
12002 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
12003 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
12004 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
12005 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
12006 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
12007 add extra PLT entry for TLS descriptors.
12008 (Output_data_plt_x86_64::got_): New field.
12009 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
12010 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
12012 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
12014 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
12015 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
12016 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
12017 R_386_TLS_DESC_CALL relocations.
12018 (Target_x86_64::Scan::global): Likewise.
12019 (Target_x86_64::do_finalize_sections): Add dynamic table entries
12020 for TLS descriptors.
12021 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
12022 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
12023 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
12024 GD-to-IE relaxation.
12025 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
12026 and TLS_DESCRIPTORS.
12027 * Makefile.in: Rebuild.
12028 * configure: Rebuild.
12029 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
12030 (tls_test_shared2.so): New target.
12031 (tls_shared_gd_to_ie_test_SOURCES): New variable.
12032 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
12033 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
12034 (tls_shared_gd_to_ie_test_LDADD): New variable.
12035 (tls_shared_gnu2_gd_to_ie_test): New target.
12036 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
12038 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
12039 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
12040 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
12041 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
12042 (tls_shared_gnu2_test): New target.
12043 (tls_test_gnu2_shared.so): New target.
12044 (tls_shared_gnu2_test_SOURCES): New variable.
12045 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
12046 (tls_shared_gnu2_test_LDFLAGS): New variable.
12047 (tls_shared_gnu2_test_LDADD): New variable.
12048 * testsuite/Makefile.in: Rebuild.
12049 * testsuite/Makefile.
12051 2008-04-11 Ian Lance Taylor <iant@google.com>
12053 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
12055 * testsuite/Makefile.in: Rebuild.
12057 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
12059 * testsuite/script_test_2.cc (main): Adjust test.
12061 2008-04-11 David S. Miller <davem@davemloft.net>
12062 Ian Lance Taylor <iant@google.com>
12064 * options.h (General_options): Add entries for '-Y' and
12066 * options.cc (General_options:finalize): If -Y was used, add those
12067 entries to the library path instead of the default "/lib" and
12070 2008-04-11 David S. Miller <davem@davemloft.net>
12072 * testsuite/justsyms.t: Start at 0x100.
12073 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
12074 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
12076 * testsuite/script_test_2.cc: Adjust string and section length
12079 2008-04-09 Ian Lance Taylor <iant@google.com>
12082 * script-sections.cc (Sections_element::allocate_to_segment): Add
12084 (Output_section_definition::allocate_to_segment): Likewise.
12085 (Orphan_output_section::allocate_to_segment): Likewise.
12086 (Script_sections::attach_sections_using_phdrs_clause): Don't
12087 propagate non-PT_LOAD segments to orphan sections.
12088 * testsuite/Makefile.am (script_test_3.stdout): Generate using
12089 readelf rather than objdump.
12090 * testsuite/script_test_3.sh: Adjust accordingly. Test that
12091 .interp section and PT_INTERP segment are the same size.
12092 * testsuite/Makefile.in: Rebuild.
12094 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
12095 aliases for symbols defined in the same object.
12096 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
12097 (weak_alias_test_SOURCES): New variable.
12098 (weak_alias_test_DEPENDENCIES): New variable.
12099 (weak_alias_test_LDFLAGS): New variable.
12100 (weak_alias_test_LDADD): New variable.
12101 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
12102 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
12103 (weak_alias_test_3.o): New target.
12104 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
12105 * testsuite/weak_alias_test_main.cc: New file.
12106 * testsuite/weak_alias_test_1.cc: New file.
12107 * testsuite/weak_alias_test_2.cc: New file.
12108 * testsuite/weak_alias_test_3.cc: New file.
12110 2008-04-08 Ian Lance Taylor <iant@google.com>
12112 * options.h (class General_options): Add --noinhibit-exec option.
12113 * main.cc (main): Check --noinhibit-exec.
12115 * options.h (class General_options): Define --wrap as a special
12116 option. Add wrap_symbols_ field.
12117 (General_options::any_wrap_symbols): New function.
12118 (General_options::is_wrap_symbol): New function.
12119 * options.cc (General_options::parse_wrap): New function.
12120 (General_options::General_options): Initialize wrap_symbols_.
12121 * symtab.cc (Symbol_table::wrap_symbol): New function.
12122 (Symbol_table::add_from_object): Handle --wrap.
12123 * symtab.h (class Symbol_table): Declare wrap_symbol.
12124 * target.h (Target::wrap_char): New function.
12125 (Target::Target_info): Add wrap_char field.
12126 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
12127 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12128 * testsuite/testfile.cc (Target_test::test_target_info):
12131 * errors.cc (Errors::undefined_symbol): Mention symbol version if
12134 * layout.h (class Layout): Add added_eh_frame_data_ field.
12135 * layout.cc (Layout::Layout): Initialize new field.
12136 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
12137 output section until we find a section we merged successfully.
12138 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
12139 that the size be non-zero.
12141 * merge.cc (Object_merge_map::get_output_offset): Remove inline
12144 2008-04-08 Craig Silverstein <csilvers@google.com>
12146 * configure.ac: Export new conditional variable HAVE_ZLIB.
12147 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
12149 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
12150 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12152 2008-04-07 Ian Lance Taylor <iant@google.com>
12154 * version.cc (version_string): Set to "1.5".
12156 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
12157 Add issued_non_pic_error_ field. Declare check_non_pic.
12158 (Target_x86_64::Scan::check_non_pic): New function.
12159 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
12160 (Target_x86_64::Scan::global): Likewise.
12162 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
12163 addend parameter. Change caller. Handle merge sections.
12164 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
12165 Address to Addend. Don't add in the result of
12166 local_section_offset, pass down the addend and use the returned
12168 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
12169 Update declarations of local_section_offset and symbol_value.
12170 * testsuite/two_file_test_1.cc (t18): New function.
12171 * testsuite/two_file_test_2.cc (f18): New function.
12172 * testsuite/two_file_test_main.cc (main): Call t18.
12173 * testsuite/two_file_test.h (t18, f18): Declare.
12175 * configure.ac: Don't test for objdump, c++filt, or readelf.
12176 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
12178 (TEST_READELF): New variable.
12179 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
12180 (check_PROGRAMS): Add two_file_strip_test.
12181 (two_file_strip_test): New target.
12182 (check_PROGRAMS): Add two_file_same_shared_strip_test.
12183 (two_file_same_shared_strip_test_SOURCES): New variable.
12184 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
12185 (two_file_same_shared_strip_test_LDFLAGS): New variable.
12186 (two_file_same_shared_strip_test_LDADD): New variable.
12187 (two_file_shared_strip.so): New target.
12188 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
12189 (ver_test_5.syms, ver_test_7.syms): Likewise.
12190 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
12191 (strip_test_3.stdout): Use TEST_OBJDUMP.
12192 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12194 2008-04-04 Cary Coutant <ccoutant@google.com>
12196 * symtab.h (Symbol::is_weak_undefined): New function.
12197 (Symbol::is_strong_undefined): New function.
12198 (Symbol::is_absolute): New function.
12199 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
12200 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
12202 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
12203 (weak_undef_test): New target.
12204 * testsuite/Makefile.in: Rebuild.
12205 * testsuite/weak_undef_file1.cc: New file.
12206 * testsuite/weak_undef_file2.cc: New file.
12207 * testsuite/weak_undef_test.cc: New file.
12209 2008-04-03 Craig Silverstein <csilvers@google.com>
12211 * compressed_output.h (class Output_compressed_section): Use
12213 * compressed_output.cc (zlib_compress): Use unsigned buffers,
12215 (zlib_compressed_suffix): Removed.
12216 (Output_compressed_section::set_final_data_size): Use unsigned
12218 * testsuite/Makefile.am (flagstest_compress_debug_sections):
12219 Fix linker invocation.
12220 (flagstest_o_specialfile_and_compress_debug_sections):
12222 * testsuite/Makefile.in: Regenerated.
12224 2008-04-02 David S. Miller <davem@davemloft.net>
12226 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
12227 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
12229 2008-04-02 Craig Silverstein <csilvers@google.com>
12233 2008-04-02 Ian Lance Taylor <iant@google.com>
12235 * fileread.cc (File_read::find_view): Add byteshift and vshifted
12236 parameters. Update for new key type to views_. Change all
12238 (File_read::read): Adjust for byteshift in returned view.
12239 (File_read::add_view): New function, broken out of
12240 find_and_make_view.
12241 (File_read::make_view): New function, broken out of
12242 find_and_make_view.
12243 (File_read::find_or_make_view): Add offset and aligned
12244 parameters. Rewrite accordingly. Change all callers.
12245 (File_read::get_view): Add offset and aligned parameters. Adjust
12246 for byteshift in return value.
12247 (File_read::get_lasting_view): Likewise.
12248 * fileread.h (class File_read): Update declarations.
12249 (class File_read::View): Add byteshift_ field. Add byteshift to
12250 constructor. Add byteshift method.
12251 * archive.h (Archive::clear_uncached_views): New function.
12252 (Archive::get_view): Add aligned parameter. Change all callers.
12253 * object.h (Object::get_view): Add aligned parameter. Change all
12255 (Object::get_lasting_view): Likewise.
12257 * fileread.cc (File_read::release): Don't call clear_views if
12258 there are multiple objects.
12259 * fileread.h (File_read::clear_uncached_views): New function.
12260 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
12263 2008-03-31 Cary Coutant <ccoutant@google.com>
12265 Add thin archive support.
12266 * archive.cc (Archive::armagt): New const.
12267 (Archive::setup): Remove task parameter and calls to unlock.
12268 (Archive::unlock_nested_archives): New function.
12269 (Archive::read_header): Add nested_off parameter. Change
12271 (Archive::interpret_header): Likewise.
12272 (Archive::include_all_members): Change to handle thin
12274 (Archive::include_member): Likewise.
12275 * archive.h (Archive::Archive): Add new parameters and
12277 (Archive::armagt): New const.
12278 (Archive::setup): Remove task parameter.
12279 (Archive::unlock_nested_archives): New function.
12280 (Archive::read_header): Add nested_off parameter.
12281 (Archive::interpret_header): Likewise.
12282 (Archive::Nested_archive_table): New typedef.
12283 (Archive::is_thin_archive_): New field.
12284 (Archive::nested_archives_): New field.
12285 (Archive::options_): New field.
12286 (Archive::dirpath_): New field.
12287 (Archive::task_): New field.
12288 * readsyms.cc (Read_symbols::do_read_symbols): Add check
12289 for thin archives. Pass additional parameters to
12290 Archive::Archive. Unlock the archive file after calling
12293 2008-03-29 Ian Lance Taylor <iant@google.com>
12295 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12296 version symbol to be local.
12297 * testsuite/ver_test_4.sh: New file.
12298 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12299 (check_DATA): Add ver_test_4.syms.
12300 (ver_test_4.syms): New target.
12301 * testsuite/Makefile.in: Rebuild.
12304 (Output_section::Input_section_sort_entry::has_priority): New
12306 (Output_section::Input_section_sort_entry::match_file_name): New
12308 (Output_section::Input_section_sort_entry::match_section_name):
12310 (Output_section::Input_section_sort_entry::match_section_name_prefix):
12312 (Output_section::Input_section_sort_entry::match_section_file):
12314 (Output_section::Input_section_sort_compare::operator()): Rewrite
12315 using new Input_section_sort_entry functions. Sort crtbegin and
12316 crtend first. Sort sections with no priority before sections with
12318 * testsuite/initpri1.c (d3): Check j != 4.
12319 (cd5): New constructor/destructor function.
12320 (main): Check j != 2.
12322 * symtab.cc (Symbol_table::add_from_object): If we don't use the
12323 new symbol when resolving, don't call set_is_default.
12324 * testsuite/ver_test_7.cc: New file.
12325 * testsuite/ver_test_7.sh: New file.
12326 * testsuite/Makefile.am (ver_test_7.so): New target.
12327 (ver_test_7.o): New target.
12328 (check_SCRIPTS): Add ver_test_7.sh.
12329 (check_DATA): Add ver_test_7.syms.
12330 (ver_test_7.syms): New target.
12332 2008-03-28 Ian Lance Taylor <iant@google.com>
12334 * layout.cc (Layout::layout): If we see an input section with a
12335 name that needs sorting, set the must_sort flag for the output
12337 (Layout::make_output_section): If the name of the output section
12338 indicates that it might require sorting, set the may_sort flag.
12339 * output.h (Output_section::may_sort_attached_input_sections): New
12341 (Output_section::set_may_sort_attached_input_sections): New
12343 (Output_section::must_sort_attached_input_sections): New
12345 (Output_section::set_must_sort_attached_input_sections): New
12347 (class Output_section): Declare Input_section_sort_entry. Define
12348 Input_section_sort_compare. Declare
12349 sort_attached_input_sections. Add new fields:
12350 may_sort_attached_input_sections_,
12351 must_sort_attached_input_sections_,
12352 attached_input_sections_are_sorted_.
12353 * output.cc (Output_section::Output_section): Initialize new
12355 (Output_section::add_input_section): Add an entry to
12356 input_sections_ if may_sort or must_sort are true.
12357 (Output_section::set_final_data_size): Call
12358 sort_attached_input_sections if necessary.
12359 (Output_section::Input_section_sort_entry): Define new class.
12360 (Output_section::Input_section_sort_compare::operator()): New
12362 (Output_section::sort_attached_input_sections): New function.
12363 * configure.ac: Check whether the compiler supports constructor
12364 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
12365 * testsuite/initpri1.c: New file.
12366 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
12367 CONSTRUCTOR_PRIORITY.
12368 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
12369 (initpri1_LDFLAGS): New variable.
12370 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12372 2008-03-27 Ian Lance Taylor <iant@google.com>
12374 * common.cc (Sort_commons::operator): Correct sorting algorithm.
12375 * testsuite/common_test_1.c: New file.
12376 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
12377 (common_test_1_SOURCES): New variable.
12378 (common_test_1_DEPENDENCIES): New variable.
12379 (common_test_1_LDFLAGS): New variable.
12381 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
12382 and commons_ correctly when NAME/VERSION does not override
12384 * testsuite/ver_test_6.c: New file.
12385 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
12386 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
12387 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
12389 2008-03-26 Ian Lance Taylor <iant@google.com>
12391 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
12392 of an undefined symbol from a version script.
12393 * testsuite/Makefile.am (ver_test_5.so): New target.
12394 (ver_test_5.o): New target.
12395 (check_SCRIPTS): Add ver_test_5.sh.
12396 (check_DATA): Add ver_test_5.syms.
12397 (ver_test_5.syms): New target.
12398 * testsuite/ver_test_5.cc: New file.
12399 * testsuite/ver_test_5.script: New file.
12400 * testsuite/ver_test_5.sh: New file.
12401 * Makefile.in, testsuite/Makefile.in: Rebuild.
12404 Fix problems building gold with gcc 4.3.0.
12405 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
12406 (gold_error_at_location, gold_warning_at_location): Use it.
12407 * configure.ac: Check whether we can compile and use a template
12408 function with a printf attribute.
12409 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
12410 when jumping over bytes.
12411 * object.cc: Instantiate Object::read_section_data.
12412 * debug.h: Include <cstring>
12413 * dwarf_reader.cc: Include <algorithm>
12414 * main.cc: Include <cstring>.
12415 * options.cc: Include <cstring>.
12416 * output.cc: Include <cstring>.
12417 * script.cc: Include <cstring>.
12418 * script.h: Include <string>.
12419 * symtab.cc: Include <cstring> and <algorithm>.
12420 * target-select.cc: Include <cstring>.
12421 * version.cc: Include <string>.
12422 * testsuite/testmain.cc: Include <cstdlib>.
12423 * configure, config.in: Rebuild.
12425 2008-03-25 Ian Lance Taylor <iant@google.com>
12427 * options.cc: Include "../bfd/bfdver.h".
12428 (options::help): Print bug reporting address.
12430 * version.cc (print_version): Adjust output for current value of
12431 BFD_VERSION_STRING.
12435 * options.cc (options::help): Print list of supported targets.
12436 * target-select.h: Include <vector>.
12437 (class Target_selector): Make machine_, size_, and is_big_endian_
12438 fields const. Add bfd_name_ and instantiated_target_ fields.
12439 (Target_selector::Target_selector): Add bfd_name parameter.
12440 (Target_selector::recognize): Make non-virtual, call
12442 (Target_selector::recognize_by_name): Make non-virtual, call
12443 do_recognize_by_name.
12444 (Target_selector::supported_names): New function.
12445 (Target_selector::bfd_name): New function.
12446 (Target_selector::do_instantiate_target): New pure virtual
12448 (Target_selector::do_recognize): New virtual function.
12449 (Target_selector::do_recognize_by_name): New virtual function.
12450 (Target_selector::instantiate_target): New private function.
12451 (supported_target_names): Declare.
12452 * target-select.cc (Target_selector::Target_selector): Update for
12453 new parameter and fields.
12454 (select_target_by_name): Check that the name matches before
12455 calling recognize_by_name.
12456 (supported_target_names): New function.
12457 * i386.cc (class Target_selector_i386): Update Target_selector
12458 constructor call. Remove recognize and recognize_by_name. Add
12459 do_instantiate_target.
12460 * x86_64.cc (class Target_selector_x86_64): Likewise.
12461 * testsuite/testfile.cc (class Target_selector_test): Update for
12462 changes to Target_selector.
12464 * README: Rewrite, with some notes on unsupported features.
12466 2008-03-24 Cary Coutant <ccoutant@google.com>
12468 * i386.cc (Target_i386::Got_type): New enum declaration.
12469 (Target_i386::Scan::local): Updated callers of Output_data_got
12471 (Target_i386::Scan::global): Likewise.
12472 (Target_i386::Relocate::relocate): Likewise.
12473 (Target_i386::Relocate::relocate_tls): Likewise.
12474 * object.h (Got_offset_list): New class.
12475 (Sized_relobj::local_has_got_offset): Added got_type parameter.
12476 (Sized_relobj::local_got_offset): Likewise.
12477 (Sized_relobj::set_local_got_offset): Likewise.
12478 (Sized_relobj::local_has_tls_got_offset): Removed.
12479 (Sized_relobj::local_tls_got_offset): Removed.
12480 (Sized_relobj::set_local_tls_got_offset): Removed.
12481 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
12482 * output.cc (Output_data_got::add_global): Added got_type parameter.
12483 (Output_data_got::add_global_with_rel): Likewise.
12484 (Output_data_got::add_global_with_rela): Likewise.
12485 (Output_data_got::add_global_pair_with_rel): New function.
12486 (Output_data_got::add_global_pair_with_rela): New function.
12487 (Output_data_got::add_local): Added got_type parameter.
12488 (Output_data_got::add_local_with_rel): Likewise.
12489 (Output_data_got::add_local_with_rela): Likewise.
12490 (Output_data_got::add_local_pair_with_rel): New function.
12491 (Output_data_got::add_local_pair_with_rela): New function.
12492 (Output_data_got::add_global_tls): Removed.
12493 (Output_data_got::add_global_tls_with_rel): Removed.
12494 (Output_data_got::add_global_tls_with_rela): Removed.
12495 (Output_data_got::add_local_tls): Removed.
12496 (Output_data_got::add_local_tls_with_rel): Removed.
12497 (Output_data_got::add_local_tls_with_rela): Removed.
12498 * output.h (Output_data_got::add_global): Added got_type parameter.
12499 (Output_data_got::add_global_with_rel): Likewise.
12500 (Output_data_got::add_global_with_rela): Likewise.
12501 (Output_data_got::add_global_pair_with_rel): New function.
12502 (Output_data_got::add_global_pair_with_rela): New function.
12503 (Output_data_got::add_local): Added got_type parameter.
12504 (Output_data_got::add_local_with_rel): Likewise.
12505 (Output_data_got::add_local_with_rela): Likewise.
12506 (Output_data_got::add_local_pair_with_rel): New function.
12507 (Output_data_got::add_local_pair_with_rela): New function.
12508 (Output_data_got::add_global_tls): Removed.
12509 (Output_data_got::add_global_tls_with_rel): Removed.
12510 (Output_data_got::add_global_tls_with_rela): Removed.
12511 (Output_data_got::add_local_tls): Removed.
12512 (Output_data_got::add_local_tls_with_rel): Removed.
12513 (Output_data_got::add_local_tls_with_rela): Removed.
12514 * resolve.cc (Symbol::override_base_with_special): Removed
12515 reference to has_got_offset_ field.
12516 * symtab.cc (Symbol::init_fields): Replaced initialization
12517 of got_offset_ with got_offsets_. Removed initialization
12519 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
12520 (Symbol::got_offset): Likewise.
12521 (Symbol::set_got_offset): Likewise.
12522 (Symbol::has_tls_got_offset): Removed.
12523 (Symbol::tls_got_offset): Removed.
12524 (Symbol::set_tls_got_offset): Removed.
12525 (Symbol::got_offset_): Removed.
12526 (Symbol::tls_mod_got_offset_): Removed.
12527 (Symbol::tls_pair_got_offset_): Removed.
12528 (Symbol::got_offsets_): New field.
12529 (Symbol::has_got_offset): Removed.
12530 (Symbol::has_tls_mod_got_offset): Removed.
12531 (Symbol::has_tls_pair_got_offset): Removed.
12532 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
12533 (Target_x86_64::Scan::local): Updated callers of Output_data_got
12535 (Target_x86_64::Scan::global): Likewise.
12536 (Target_x86_64::Relocate::relocate): Likewise.
12537 (Target_x86_64::Relocate::relocate_tls): Likewise.
12539 2008-03-25 Ben Elliston <bje@au.ibm.com>
12541 * yyscript.y: Fix spelling error in comment.
12543 2008-03-24 Ian Lance Taylor <iant@google.com>
12545 * options.h (class General_options): Define build_id option.
12546 * layout.h (class Layout): Declare write_build_id, create_note,
12547 create_build_id. Add build_id_note_ member.
12548 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
12549 "libiberty.h", "md5.h", "sha1.h".
12550 (Layout::Layout): Initialize eh_frame_data_,
12551 eh_frame_hdr_section_, and build_id_note_.
12552 (Layout::finalize): Call create_build_id.
12553 (Layout::create_note): New function, broken out of
12554 Layout::create_gold_note.
12555 (Layout::create_gold_note): Call create_note.
12556 (Layout::create_build_id): New function.
12557 (Layout::write_build_id): New function.
12558 (Close_task_runner::run): Call write_build_id.
12560 * x86_64.cc: Correct license to GPLv3.
12562 2008-03-23 Ian Lance Taylor <iant@google.com>
12564 * options.cc: Include "demangle.h".
12565 (parse_optional_string): New function.
12566 (parse_long_option): Handle takes_optional_argument.
12567 (parse_short_option): Update dash_z initializer. Handle
12568 takes_optional_argument.
12569 (General_options::General_options): Initialize do_demangle_.
12570 (General_options::finalize): Set do_demangle_. Handle demangling
12572 * options.h (parse_optional_string): Declare.
12573 (struct One_option): Add optional_arg field. Update constructor.
12574 Update call constructor calls. Add takes_optional_argument
12576 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
12577 (DEFINE_optional_string): Define.
12578 (General_options::demangle): Change from DEFINE_bool to
12579 DEFINE_optional_string.
12580 (General_options::no_demangle): New function.
12581 (General_options::do_demangle): New function.
12582 (General_options::set_do_demangle): New function.
12583 (General_options::execstack_status_): Move definition to end of
12585 (General_options::static_): Likewise.
12586 (General_options::do_demangle_): New field.
12587 * object.cc (big_endian>::get_symbol_location_info): Call
12588 Options::do_demangle, not Options::demangle.
12589 * symtab.cc (demangle): Likewise.
12591 2008-03-22 Ian Lance Taylor <iant@google.com>
12593 * gold.h: Include <cstddef> and <sys/types.h>
12594 * options.h: Include <cstring>.
12596 2008-03-21 Ian Lance Taylor <iant@google.com>
12598 * Added source code to GNU binutils.