1 2012-03-16 Doug Kwan <dougkwan@google.com>
3 * testsuite/Makefile.am: Disable test initpri3b.
4 * testsuite/Makefile.in: Regenerate.
6 2012-03-15 Doug Kwan <dougkwan@google.com>
8 * arm.cc (Target_arm::got_section): Make .got section read-only
11 2012-03-15 Ian Lance Taylor <iant@google.com>
14 * layout.cc (Layout::make_output_section): Correctly mark
15 SHT_INIT_ARRAY, et. al., as relro.
17 2012-03-14 Doug Kwan <dougkwan@google.com>
19 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
20 dynamic relocations for protected symbols in shared objects.
22 2012-03-13 Ian Lance Taylor <iant@google.com>
24 * resolve.cc (Symbol_table::resolve): When merging common symbols,
25 keep the larger alignment.
27 2012-03-12 Cary Coutant <ccoutant@google.com>
29 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
30 handling of DW_LNE_define_file.
32 2012-03-12 Cary Coutant <ccoutant@google.com>
34 * reduced_debug_output.cc
35 (Output_reduced_debug_info_section::get_die_end): Add new FORM
38 2012-02-29 Cary Coutant <ccoutant@google.com>
40 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
42 2012-02-29 Cary Coutant <ccoutant@google.com>
44 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
45 Call Object::decompressed_section_contents.
46 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
48 (Sized_dwarf_line_info::buffer_start_): New data member.
49 * merge.cc (Output_merge_data::do_add_input_section): Call
50 Object::decompressed_section_contents.
51 (Output_merge_string::do_add_input_section): Likewise.
52 * object.cc (need_decompressed_section): New function.
53 (build_compressed_section_map): Decompress sections needed later.
54 (Sized_relobj_file::do_decompressed_section_contents): New function.
55 (Sized_relobj_file::do_discard_decompressed_sections): New function.
56 * object.h (Object::decompressed_section_contents): New function.
57 (Object::discard_decompressed_sections): New function.
58 (Object::do_decompressed_section_contents): New function.
59 (Object::do_discard_decompressed_sections): New function.
60 (Compressed_section_info): New type.
61 (Compressed_section_map): Include decompressed section contents.
62 (Sized_relobj_file::do_decompressed_section_contents): New function.
63 (Sized_relobj_file::do_discard_decompressed_sections): New function.
65 2012-02-16 Cary Coutant <ccoutant@google.com>
67 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
68 * testsuite/Makefile.in: Regenerate.
70 2012-02-14 Cary Coutant <ccoutant@google.com>
72 * options.cc (General_options::finalize): Disallow -pie and -static.
74 2012-02-03 Doug Kwan <dougkwan@google.com>
76 * arm.cc (Arm_relocate_functions::abs8,
77 Arm_relocate_functions::abs16): Use
78 Bits::has_signed_unsigned_overflow32.
79 (Arm_relocate_functions::thm_abs8): Correct range of
81 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
84 2012-02-02 Doug Kwan <dougkwan@google.com>
86 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
87 position independent outputs, not just shared objects.
89 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
91 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
92 * configure: Regenerated.
94 2012-01-27 Ian Lance Taylor <iant@google.com>
96 * reloc.h (Bits): New class with static functions, copied from
97 namespace utils in arm.cc.
98 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
101 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
103 * incremental.cc (write_info_blocks): Correct relocation offset.
105 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
107 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
108 (Relocate::tls_gd_to_le): Likewise.
110 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
112 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
114 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
116 * configure.ac: Check if -mcmodel=medium works.
117 * configure: Regenerated.
119 2012-01-24 Cary Coutant <ccoutant@google.com>
121 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
123 (read_unsigned_LEB_128_x): ... this new function.
124 (read_signed_LEB_128): Replaced with inline definition and ...
125 (read_signed_LEB_128_x): ... this new function.
126 * int_encoding.h (read_unsigned_LEB_128_x): New function.
127 (read_unsigned_LEB_128): Add inline definition.
128 (read_signed_LEB_128_x): New function.
129 (read_signed_LEB_128): Add inline definition.
130 * testsuite/Makefile.am (leb128_unittest): New unit test.
131 * testsuite/Makefile.in: Regenerate.
132 * testsuite/leb128_unittest.cc: New unit test.
134 2012-01-23 Ian Lance Taylor <iant@google.com>
137 * i386.cc (Target_i386::do_code_fill): When using a jmp
138 instruction, pad with nop instructions.
139 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
141 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
143 * x86_64.cc (gc_process_relocs): Add typename on types used in
145 (scan_relocs): Likewise.
146 (relocate_section): Likewise.
147 (apply_relocation): Likewise.
149 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
151 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
152 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
155 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
157 * x86_64.cc: Initial support for x32.
159 2012-01-03 Cary Coutant <ccoutant@google.com>
161 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
162 Use abstract base class for GOT.
163 * gold/output.h (class Output_data_got_base): New abstract base class.
164 (class Output_data_got): Derive from new base class, adjust ctors.
165 (Output_data_got::reserve_slot): Make virtual; rename to
166 do_reserve_slot; Adjust callers.
167 * gold/target.h (Sized_target::init_got_plt_for_update): Return
168 pointer to abstract base class.
169 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
171 2011-12-18 Ian Lance Taylor <iant@google.com>
173 * object.h (Relobj::local_symbol_value): New function.
174 (Relobj::local_plt_offset): New function.
175 (Relobj::local_has_got_offset): New function.
176 (Relobj::local_got_offset): New function.
177 (Relobj::set_local_got_offset): New function.
178 (Relobj::do_local_symbol_value): New pure virtual function.
179 (Relobj::do_local_plt_offset): Likewise.
180 (Relobj::do_local_has_got_offset): Likewise.
181 (Relobj::do_local_got_offset): Likewise.
182 (Relobj::do_set_local_got_offset): Likewise.
183 (Sized_relobj::do_local_has_got_offset): Rename from
184 local_has_got_offset.
185 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
186 (Sized_relobj::do_set_local_got_offset): Rename from
187 set_local_got_offset.
188 (Sized_relobj_file::do_local_plt_offset): Rename from
190 (Sized_relobj_file::do_local_symbol_value): New function.
191 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
193 * output.cc (Output_data_got::Got_entry::write): Change object to
194 Relobj. Use local_symbol_value.
195 (Output_data_got::add_global_with_rel): Change rel_dyn to
196 Output_data_reloc_generic*. Use add_global_generic.
197 (Output_data_got::add_global_with_rela): Remove. Change all
198 callers to use add_global_with_rel.
199 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
200 Output_data_reloc_generic*. Use add_global_generic.
201 (Output_data_got::add_global_pair_with_rela): Remove. Change all
202 callers to use add_global_pair_with_rel.
203 (Output_data_got::add_local): Change object to Relobj*.
204 (Output_data_got::add_local_plt): Likewise.
205 (Output_data_got::add_local_with_rel): Change object to Relobj*,
206 change rel_dyn to Output_data_reloc_generic*. Use
208 (Output_data_got::add_local_with_rela): Remove. Change all
209 callers to use all_local_with_rel.
210 (Output_data_got::add_local_pair_with_rel): Change object to
211 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
212 add_output_section_generic.
213 (Output_data_got::add_local_pair_with_rela): Remove. Change all
214 callers to use add_local_pair_with_rel.
215 (Output_data_got::reserve_local): Change object to Relobj*.
216 * output.h: (class Output_data_reloc_generic): Add pure virtual
217 declarations for add_global_generic, add_local_generic,
218 add_output_section_generic.
219 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
220 functions for Output_data_reloc_generic. Update declarations for
221 changes listed in output.cc.
222 (class Output_data_got): Change template parameter to got_size.
223 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
224 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
226 (Sized_relobj_incr::do_local_plt_offset): New function.
227 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
230 2011-12-17 Cary Coutant <ccoutant@google.com>
232 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
233 * resolve.cc (Symbol_table::resolve): Likewise.
234 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
236 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
238 2011-12-16 Ian Lance Taylor <iant@google.com>
240 * output.h (Output_data_reloc_generic::add): Only call
241 add_dynamic_reloc if this is a dynamic reloc section.
243 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
246 * target-reloc.h (apply_relocation): Replace <64, false> with
249 2011-11-25 Nick Clifton <nickc@redhat.com>
251 * po/it.po: New Italian translation.
253 2011-11-17 Sterling Augustine <saugustine@google.com>
255 * script.cc (script_include_directive): Implement.
256 (read_script_file): New local variables name and search_path. Update
257 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
258 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
259 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
261 2011-11-11 Sterling Augustine <saugustine@google.com>
263 * yyscript.y (section_cmd): Add support for INCLUDE directive.
264 (file_or_sections_cmd): Likewise.
266 2011-11-11 Doug Kwan <dougkwan@google.com>
268 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
269 if --just-symbols is given.
271 2011-11-10 Doug Kwan <dougkwan@google.com>
274 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
275 when processing data relocs.
276 * reloc.h (Relocate_functions::rel_unaligned): New method.
277 (Relocate_functions::pcrel_unaligned): Ditto.
278 (Relocate_functions::rel32_unaligned): Ditto.
279 (Relocate_functions::pcrel32_unaligned): Ditto.
281 2011-11-09 Doug Kwan <dougkwan@google.com>
284 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
285 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
286 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
287 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
288 (Relocate_functions::rel_unaligned): New.
289 (Relocate_functions::rel32_unaligned): New.
290 * target-reloc.h (relocate_for_relocatable): Add code to handle
291 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
292 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
293 arm_unaligned_reloc_r): New targets.
294 * testsuite/Makefile.in: Regenerate.
295 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
298 2011-11-02 Ian Lance Taylor <iant@google.com>
300 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
302 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
303 * options.cc (General_options::finalize): Use library search path
304 from configure script if specified. If not native and no sysroot,
305 only search TOOLLIBDIR.
306 * options.h (Search_directory::Search_directory): Change name to
308 (General_options::add_to_library_path_with_sysroot): Change arg to
310 * configure, Makefile.in, config.in: Rebuild.
312 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
314 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
315 we are working around the ARM1176 Erratum.
316 * options.h (General_options::fix_arm1176): Add option.
317 * testsuite/Makefile.am: Add testcases, and keep current ones
319 * testsuite/Makefile.in: Regenerate.
320 * testsuite/arm_fix_1176.s: New file.
321 * testsuite/arm_fix_1176.sh: Likewise.
323 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
325 * arm.cc (Target_arm::Target_arm): Remove initialisation of
327 (Target_arm::may_use_blx): Remove method.
328 (Target_arm::set_may_use_blx): Likewise.
329 (Target_arm::may_use_v4t_interworking): New method.
330 (Target_arm::may_use_v5t_interworking): Likewise.
331 (Target_arm::may_use_blx_): Remove member variable.
332 (Arm_relocate_functions::arm_branch_common): Check for v5T
334 (Arm_relocate_functions::thumb_branch_common): Likewise.
335 (Reloc_stub::stub_type_for_reloc): Likewise.
336 (Target_arm::do_finalize_sections): Correct interworking checks.
337 * testsuite/Makefile.am: Add new tests.
338 * testsuite/Makefile.in: Regenerate.
339 * testsuite/arm_farcall_arm_arm.s: New test.
340 * testsuite/arm_farcall_arm_arm.sh: Likewise.
341 * testsuite/arm_farcall_arm_thumb.s: Likewise.
342 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
343 * testsuite/arm_farcall_thumb_arm.s: Likewise.
344 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
345 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
346 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
348 2011-10-31 Cary Coutant <ccoutant@google.com>
351 * expression.cc (Expression::eval_with_dot): Add
352 is_section_dot_assignment parameter.
353 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
354 absolute and assigning to dot within a section.
356 (Output_section_element_assignment::set_section_addresses): Pass
357 dot_section to set_if_absolute.
358 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
359 as is_section_dot_assignment flag to eval_with_dot.
360 (Output_section_element_dot_assignment::set_section_addresses):
362 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
363 parameter. Also set value if relative to dot_section; set the
364 symbol's output_section.
365 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
366 parameter. Adjust all callers.
367 (Expression::eval_maybe_dot): Likewise.
368 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
370 * testsuite/script_test_2.t: Test assignment of an absolute value
371 to dot within an output section element.
373 2011-10-31 Cary Coutant <ccoutant@google.com>
375 * options.h (class General_options): Add --[no-]gnu-unique options.
376 * symtab.cc (Symbol_table::sized_write_globals): Convert
377 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
379 2011-10-31 Cary Coutant <ccoutant@google.com>
382 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
383 unnecessary assertion.
384 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
386 2011-10-31 Sriraman Tallam <tmsriram@google.com>
388 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
390 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
392 Change to just keep the section associated with symbol.
393 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
394 they are externally visible and --export-dynamic is turned on.
395 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
397 2011-10-19 Ian Lance Taylor <iant@google.com>
401 (Output_section_element_dot_assignment::needs_output_section): New
404 2011-10-19 Ian Lance Taylor <iant@google.com>
407 * layout.cc (Layout::segment_precedes): Don't assert failure if a
408 --section-start option was seen.
409 * options.h (General_options::any_section_start): New function.
411 2011-10-18 David S. Miller <davem@davemloft.net>
414 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
415 member to track relocation locations that have moved during TLS
417 (Target_sparc::Relocate::Relocate): Initialize to NULL.
418 (Target_sparc::Relocate::relocate): Adjust view down by 4
419 bytes if it matches reloc_adjust_addr_.
420 (Target_sparc::Relocate::relocate_tls): Always move the
421 __tls_get_addr call delay slot instruction forward 4 bytes when
422 performing relaxation.
424 2011-10-18 Cary Coutant <ccoutant@google.com>
426 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
427 (Output_file::map_no_anonymous): Check for non-zero
428 return code from posix_fallocate.
430 2011-10-17 Cary Coutant <ccoutant@google.com>
433 * plugin.cc (is_visible_from_outside): Check for symbols
434 referenced from dynamic objects.
435 * resolve.cc (Symbol_table::resolve): Don't count references
436 from dynamic objects as references from real ELF files.
437 * testsuite/plugin_test_2.sh: Adjust expected result.
439 2011-10-17 Cary Coutant <ccoutant@google.com>
441 * gold.cc: Include timer.h.
442 (queue_middle_tasks): Stamp time.
443 (queue_final_tasks): Likewise.
444 * main.cc (main): Store timer in parameters. Print timers
446 * parameters.cc (Parameters::Parameters): Initialize timer_.
447 (Parameters::set_timer): New function.
448 (set_parameters_timer): New function.
449 * parameters.h (Parameters::set_timer): New function.
450 (Parameters::timer): New function.
451 (Parameters::timer_): New data member.
452 (set_parameters_timer): New function.
453 * timer.cc (Timer::stamp): New function.
454 (Timer::get_pass_time): New function.
455 * timer.h (Timer::stamp): New function.
456 (Timer::get_pass_time): New function.
457 (Timer::pass_times_): New data member.
459 2011-10-17 Cary Coutant <ccoutant@google.com>
461 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
462 task for members of lib groups.
464 2011-10-17 Cary Coutant <ccoutant@google.com>
467 * fileread.cc (File_read::find_view): Add assert.
468 (File_read::make_view): Move bounds check (replace with assert)...
469 (File_read::find_or_make_view): ... to here.
471 2011-10-12 Cary Coutant <ccoutant@google.com>
473 * output.cc (Output_file::open_base_file): Handle case where
474 ::read returns less than requested size.
476 2011-10-10 Cary Coutant <ccoutant@google.com>
478 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
479 Initialize defined_count_.
480 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
481 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
482 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
483 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
484 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
485 * incremental.h (Sized_relobj_incr::defined_count_): New data
487 (Sized_incr_dynobj::defined_count_): New data member.
488 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
489 Return zeroes instead of internal error.
491 2011-10-10 Cary Coutant <ccoutant@google.com>
494 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
495 (Output_reloc::symbol_value): Return PLT offset if flag is set.
496 * output.h (class Output_reloc): Add use_plt_offset flag.
497 (Output_reloc::type_): Adjust size of bit field.
498 (Output_reloc::use_plt_offset_): New bit field.
499 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
500 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
501 flag. Adjust all callers.
502 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
503 creating RELATIVE relocations.
505 2011-10-10 Nick Clifton <nickc@redhat.com>
507 * po/es.po: Updated Spanish translation.
508 * po/fi.po: Updated Finnish translation.
510 2011-10-03 Diego Novillo <dnovillo@google.com>
512 * options.cc (parse_uint): Fix dereference of RETVAL.
514 2011-09-29 Sriraman Tallam <tmsriram@google.com>
516 * layout.h (section_order_map_): New member.
517 (get_section_order_map): New member function.
518 * output.cc (Output_section::add_input_section): Check for patterns
519 only when --section-ordering-file is specified.
520 * gold.cc (queue_middle_tasks): Delay updating order of sections till
521 output_sections have been formed.
522 * layout.cc (Layout_Layout): Initialize section_order_map_.
523 * plugin.cc (update_section_order): Store order in order_map. Do not
525 * testsuite/Makefile.am: Add test case for plugin_final_layout.
526 * testsuite/Makefile.in: Regenerate.
527 * testsuite/plugin_section_order.c: New file.
528 * testsuite/plugin_final_layout.cc: New file.
529 * testsuite/plugin_final_layout.sh: New file.
531 2011-09-29 Cary Coutant <ccoutant@google.com>
533 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
535 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
536 symbols during incremental update.
537 (Symbol_table::add_from_dynobj): Likewise.
539 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
540 Ian Lance Taylor <iant@google.com>
542 * symtab.cc (Symbol_table::define_special_symbol): Always
543 canonicalize version string.
545 2011-09-26 Cary Coutant <ccoutant@google.com>
547 * gold.cc (queue_initial_tasks): Move option checks ...
548 * options.cc (General_options::finalize): ... to here. Disable
549 some options; make others fatal.
551 2011-09-26 Cary Coutant <ccoutant@google.com>
554 * plugin.cc (get_symbols_v2): New function.
555 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
556 (is_referenced_from_outside): New function.
557 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
558 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
559 (get_symbols): Pass version parameter.
560 (get_symbols_v2): New function.
561 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
563 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
564 (onload): Add LDPT_GET_SYMBOLS_V2.
565 (all_symbols_read_hook): Use get_symbols_v2; check for
566 LDPR_PREVAILING_DEF_IRONLY_EXP.
567 * testsuite/plugin_test_3.sh: Update expected results.
569 2011-09-23 Simon Baldwin <simonb@google.com>
571 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
572 configuration options.
573 * configure: Regenerate.
574 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
575 * Makefile.in: Regenerate.
576 * testsuite/Makefile.in: Regenerate.
578 2011-09-19 Sriraman Tallam <tmsriram@google.com>
580 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
582 2011-09-19 Cary Coutant <ccoutant@google.com>
584 * incremental.cc (can_incremental_update): Fix typo in comment.
585 * incremental.h (can_incremental_update): Likewise.
587 2011-09-18 Cary Coutant <ccoutant@google.com>
589 * incremental.cc (can_incremental_update): New function.
590 * incremental.h (can_incremental_update): New function.
591 * layout.cc (Layout::init_fixed_output_section): Call it.
592 (Layout::make_output_section): Don't allow patch space in .eh_frame.
593 * object.cc (Sized_relobj_file::do_layout): Call
594 can_incremental_update.
596 2011-09-13 Cary Coutant <ccoutant@google.com>
598 * configure.ac: Check for glibc support for gnu_indirect_function
599 support with static linking, setting automake conditional
601 * Makefile.in: Regenerate.
602 * configure: Regenerate.
604 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
605 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
607 * testsuite/Makefile.in: Regenerate.
609 2011-09-13 Cary Coutant <ccoutant@google.com>
611 * incremental.cc (Sized_relobj_incr::do_layout): Call
612 report_comdat_group for kept comdat sections.
613 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
614 * testsuite/Makefile.in: Regenerate.
615 * testsuite/incr_comdat_test_1.cc: New source file.
616 * testsuite/incr_comdat_test_2_v1.cc: New source file.
617 * testsuite/incr_comdat_test_2_v2.cc: New source file.
618 * testsuite/incr_comdat_test_2_v3.cc: New source file.
620 2011-09-13 Ian Lance Taylor <iant@google.com>
622 * object.cc (Sized_relobj_file::do_layout): Remove unused local
623 variable external_symbols_offset.
625 2011-09-12 Ian Lance Taylor <iant@google.com>
627 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
628 triggered if object has no symbols.
630 2011-09-09 David S. Miller <davem@davemloft.net>
632 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
633 (Output_fill_debug_line::do_write): Likewise.
635 2011-08-29 Cary Coutant <ccoutant@google.com>
637 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
638 casts to match formatting specs.
639 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
641 2011-08-26 Cary Coutant <ccoutant@google.com>
643 * layout.cc (Free_list::allocate): Provide guarantee of minimum
644 remaining hole size when allocating.
645 (Layout::make_output_section): Set fill methods for debug sections.
646 * layout.h (Free_list::Free_list_node): Move from private to
648 (Free_list::set_min_hole_size): New function.
649 (Free_list::begin, Free_list::end): New functions.
650 (Free_list::min_hole_): New data member.
651 * output.cc: Include dwarf.h.
652 (Output_fill_debug_info::do_minimum_hole_size): New function.
653 (Output_fill_debug_info::do_write): New function.
654 (Output_fill_debug_line::do_minimum_hole_size): New function.
655 (Output_fill_debug_line::do_write): New function.
656 (Output_section::Output_section): Initialize new data member.
657 (Output_section::set_final_data_size): Ensure patch space is larger
658 than minimum hole size.
659 (Output_section::do_write): Fill holes in debug sections.
660 * output.h (Output_fill): New class.
661 (Output_fill_debug_info): New class.
662 (Output_fill_debug_line): New class.
663 (Output_section::set_free_space_fill): New function.
664 (Output_section::free_space_fill_): New data member.
665 * testsuite/Makefile.am (incremental_test_3): Add
666 --incremental-patch option.
667 (incremental_test_4): Likewise.
668 (incremental_test_5): Likewise.
669 (incremental_test_6): Likewise.
670 (incremental_copy_test): Likewise.
671 (incremental_common_test_1): Likewise.
672 * testsuite/Makefile.in: Regenerate.
674 2011-08-26 Nick Clifton <nickc@redhat.com>
676 * po/es.po: Updated Spanish translation.
678 2011-08-01 Cary Coutant <ccoutant@google.com>
680 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
681 * gold/testsuite/Makefile.in: Regenerate.
682 * gold/testsuite/justsyms_exec.c: New source file.
683 * gold/testsuite/justsyms_lib.c: New source file.
685 2011-08-01 Cary Coutant <ccoutant@google.com>
687 * layout.cc (Layout::set_segment_offsets): Don't realign text
688 segment if -Ttext was specified.
689 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
691 * object.h (Sized_relobj_file::e_type): New function.
692 (Sized_relobj_file::e_type_): New data member.
693 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
694 base address for ET_EXEC files.
695 * target.cc (Target::do_make_elf_object_implementation): Allow
696 ET_EXEC files with --just-symbols option.
698 2011-07-28 Cary Coutant <ccoutant@google.com>
700 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
701 Add thread_number parameter.
702 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
703 * workqueue-threads.cc
704 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
705 current thread if its thread number is greater than desired thread
707 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
708 Add thread_number parameter.
709 (Workqueue::should_cancel_thread): Likewise.
710 (Workqueue::find_runnable_or_wait): Pass thread_number to
711 should_cancel_thread.
712 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
715 2011-07-22 Sriraman Tallam <tmsriram@google.com>
717 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
718 only after checking if it cannot be forced local.
719 * symtab.h (is_externally_visible): Check if the symbol is not forced
722 2011-07-15 Ian Lance Taylor <iant@google.com>
724 * options.h (class General_options): Add --print-output-format.
725 Move -EL next to -EB, for better --help output.
726 * target-select.cc: Include <cstdio>, "options.h", and
728 (Target_selector::do_target_bfd_name): New function.
729 (print_output_format): New function.
730 * target-select.h (class Target_selector): Update declarations.
731 (Target_selector::target_bfd_name): New function.
732 (print_output_format): Declare.
733 * main.cc: Include "target-select.h".
734 (main): Handle --print-output-format.
735 * gold.cc: Include "target-select.h".
736 (queue_initial_tasks): Handle --print-output-format when there are
738 * parameters.cc (parameters_force_valid_target): Give a better
739 error message if -EB/-EL does not match target.
740 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
743 2011-07-15 Ian Lance Taylor <iant@google.com>
745 * i386.cc (class Output_data_plt_i386): Add layout_ field.
746 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
747 (Output_data_plt_i386::do_write): Write address of .dynamic
748 section to first entry in .got.plt section.
749 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
750 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
752 (Output_data_plt_x86_64::do_write): Write address of .dynamic
753 section to first entry in .got.plt section.
754 * layout.h (Layout::dynamic_section): New function.
756 2011-07-13 Sriraman Tallam <tmsriram@google.com>
758 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
760 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
761 input_section_position_, and input_section_glob_.
762 (read_layout_from_file): Call function section_ordering_specified.
763 * layout.h (is_section_ordering_specified): New function.
764 (section_ordering_specified): New function.
765 (section_ordering_specified_): New boolean member.
766 * main.cc(main): Call load_plugins after layout object is defined.
767 * output.cc (Output_section::add_input_section): Use
768 function section_ordering_specified to check if section ordering is
770 * output.cc (Output_section::add_relaxed_input_section): Use
771 function section_ordering_specified to check if section ordering is
773 (Output_section::update_section_layout): New function.
774 (Output_section::sort_attached_input_sections): Check if input section
776 * output.h (Output_section::update_section_layout): New function.
777 * plugin.cc (get_section_count): New function.
778 (get_section_type): New function.
779 (get_section_name): New function.
780 (get_section_contents): New function.
781 (update_section_order): New function.
782 (allow_section_ordering): New function.
783 (Plugin::load): Add the new interfaces to the transfer vector.
784 (Plugin_manager::load_plugins): New parameter.
785 (Plugin_manager::all_symbols_read): New parameter.
786 (Plugin_manager::claim_file): New parameter. Save the elf object for
788 (Plugin_manager::get_elf_object): New function.
789 (Plugin_manager::get_view): Change to directly use the bool to check
790 if get_view is called from claim_file_hook.
791 * plugin.h (input_objects): New function
792 (Plugin__manager::load_plugins): New parameter.
793 (Plugin_manager::claim_file): New parameter.
794 (Plugin_manager::get_elf_object): New function.
795 (Plugin_manager::in_claim_file_handler): New function.
796 (Plugin_manager::in_claim_file_handler_): New member.
797 (layout): New function.
798 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
799 handler with an extra parameter. Make the elf object before calling
801 * testsuite/plugin_test.c (get_section_count): New function pointer.
802 (get_section_type): New function pointer.
803 (get_section_name): New function pointer.
804 (get_section_contents): New function pointer.
805 (update_section_order): New function pointer.
806 (allow_section_ordering): New function pointer.
807 (onload): Check if the new interfaces exist.
809 2011-07-13 Ian Lance Taylor <iant@google.com>
811 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
813 * x86_64.cc (Target_x86_64::got_section): Likewise.
814 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
815 (relro_now_test_SOURCES): New variable.
816 (relro_now_test_DEPENDENCIES): New variable.
817 (relro_now_test_LDFLAGS): New variable.
818 (relro_now_test_LDADD): New variable.
819 (relro_now_test.so): New target.
820 * testsuite/Makefile.in: Rebuild.
822 2011-07-12 Ian Lance Taylor <iant@google.com>
825 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
826 GLOB_DAT relocation rather than a RELATIVE relocation for a
827 protected symbol when creating a shared library.
828 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
829 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
830 * testsuite/protected_main_1.cc (main): Test that protected
831 function has same address.
833 2011-07-11 Ian Lance Taylor <iant@google.com>
836 * options.h (class General_options): Add -Bgroup.
837 * options.cc (General_options::finalize): If -Bgroup is set,
838 default to --unresolved-symbols=report-all.
839 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
840 * target-reloc.h (issue_undefined_symbol_error): Handle
841 --unresolved-symbols=report-all.
843 2011-07-08 Ian Lance Taylor <iant@google.com>
846 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
847 if linker script discards key sections.
848 (Layout::create_dynamic_symtab): Likewise.
849 (Layout::assign_local_dynsym_offsets): Likewise.
850 (Layout::sized_create_version_sections): Likewise.
851 (Layout::create_interp): Likewise.
852 (Layout::finish_dynamic_section): Likewise.
853 (Layout::set_dynamic_symbol_size): Likewise.
855 2011-07-08 Ian Lance Taylor <iant@google.com>
858 * options.h (class General_options): Add --unresolved-symbols.
859 * target-reloc.h (issue_undefined_symbol_error): Check
860 --unresolved-symbols. Add comments.
862 2011-07-08 Ian Lance Taylor <iant@google.com>
864 * testsuite/odr_violation2.cc (Ordering::operator()): Make
865 expression more complex.
867 2011-07-08 Ian Lance Taylor <iant@google.com>
870 * target-reloc.h (issue_undefined_symbol_error): New inline
871 function, broken out of relocate_section.
872 (relocate_section): Call issue_undefined_symbol_error.
873 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
874 there is no TLS segment if we are about to issue an undefined
876 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
878 2011-07-08 Ian Lance Taylor <iant@google.com>
881 * resolve.cc (Symbol_table::should_override): Add fromtype
882 parameter. Change all callers. Give error when linking together
883 TLS and non-TLS symbol.
884 (Symbol_table::should_override_with_special): Add fromtype
885 parameter. Change all callers.
886 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
887 there is no TLS segment if we have reported some errors.
888 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
890 2011-07-08 Ian Lance Taylor <iant@google.com>
893 * target.h (Target::plt_address_for_global): New function.
894 (Target::plt_address_for_local): New function.
895 (Target::plt_section_for_global): Remove.
896 (Target::plt_section_for_local): Remove.
897 (Target::do_plt_address_for_global): New virtual function.
898 (Target::do_plt_address_for_local): New virtual function.
899 (Target::do_plt_section_for_global): Remove.
900 (Target::do_plt_section_for_local): Remove.
901 (Target::register_global_plt_entry): Add Symbol_table and Layout
903 * output.cc (Output_data_got::Got_entry::write): Use
904 plt_address_for_global and plt_address_for_local.
905 * layout.cc (Layout::add_target_dynamic_tags): Use size and
906 address of output section.
907 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
908 got_irelative_, and irelative_count_ fields. Update
910 (Output_data_plt_i386::has_irelative_section): New function.
911 (Output_data_plt_i386::entry_count): Add irelative_count_.
912 (Output_data_plt_i386::set_final_data_size): Likewise.
913 (class Target_i386): Add got_irelative_ and rel_irelative_
914 fields. Update declarations.
915 (Target_i386::Target_i386): Initialize new fields.
916 (Target_i386::do_plt_address_for_global): New function replacing
917 do_plt_section_for_global.
918 (Target_i386::do_plt_address_for_local): New function replacing
919 do_plt_section_for_local.
920 (Target_i386::got_section): Create got_irelative_.
921 (Target_i386::rel_irelative_section): New function.
922 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
923 fields. Don't define __rel_iplt_{start,end}.
924 (Output_data_plt_i386::add_entry): Add symtab and layout
925 parameters. Change all callers. Use different PLT and GOT for
927 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
928 layout parameters. Change all callers. Use different PLT and
930 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
931 (Output_data_plt_i386::rel_irelative): New function.
932 (Output_data_plt_i386::address_for_global): New function.
933 (Output_data_plt_i386::address_for_local): New function.
934 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
935 IRELATIVE GOT when changing IFUNC GOT entries.
936 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
938 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
939 if we didn't create an IRELATIVE GOT.
940 (Target_i386::Relocate::relocate): Use plt_address_for_global and
941 plt_address_for_local.
942 (Target_i386::do_dynsym_value): Use plt_address_for_global.
943 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
944 got_irelative_, and irelative_count_ fields. Update
946 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
947 Initialize new fields. Remove symtab parameter. Change all
949 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
951 (Output_data_plt_x86_64::has_irelative_section): New function.
952 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
953 (class Target_x86_64): Add got_irelative_ and rel_irelative_
954 fields. Update declarations.
955 (Target_x86_64::Target_x86_64): Initialize new fields.
956 (Target_x86_64::do_plt_address_for_global): New function replacing
957 do_plt_section_for_global.
958 (Target_x86_64::do_plt_address_for_local): New function replacing
959 do_plt_section_for_local.
960 (Target_x86_64::got_section): Create got_irelative_.
961 (Target_x86_64::rela_irelative_section): New function.
962 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
963 all callers. Don't create __rel_iplt_{start,end}.
964 (Output_data_plt_x86_64::add_entry): Add symtab and layout
965 parameters. Change all callers. Use different PLT and GOT for
967 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
968 layout parameters. Change all callers. Use different PLT and
970 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
971 parameters. Change all callers. Use different PLT and GOT for
973 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
974 (Output_data_plt_x86_64::rela_irelative): New function.
975 (Output_data_plt_x86_64::address_for_global): New function.
976 (Output_data_plt_x86_64::address_for_local): New function.
977 (Output_data_plt_x86_64::set_final_data_size): Likewise.
978 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
979 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
980 (Target_x86_64::register_global_plt_entry): Add symtab and layout
982 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
984 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
985 symbols if we didn't create an IRELATIVE GOT.
986 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
987 plt_address_for_local.
988 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
989 * testsuite/ifuncvar1.c: New test file.
990 * testsuite/ifuncvar2.c: New test file.
991 * testsuite/ifuncvar3.c: New test file.
992 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
993 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
994 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
995 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
996 * testsuite/Makefile.in: Rebuild.
998 2011-07-07 Cary Coutant <ccoutant@google.com>
1000 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
1001 (two_file_test_1_ndebug.o): Likewise.
1002 (two_file_test_1b_ndebug.o): Likewise.
1003 (two_file_test_2_ndebug.o): Likewise.
1004 (two_file_test_main_ndebug.o): Likewise.
1005 (incremental_test_2): Link with no-debug versions.
1007 2011-07-06 Cary Coutant <ccoutant@google.com>
1009 * gold/incremental.cc
1010 (Output_section_incremental_inputs::write_info_blocks): Check for
1011 hidden and internal symbols.
1013 2011-07-06 Cary Coutant <ccoutant@google.com>
1015 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
1016 Check disposition for startup file.
1017 (Incremental_inputs::report_command_line): Ignore
1018 --incremental-startup-unchanged option.
1019 * options.cc (General_options::parse_incremental_startup_unchanged):
1021 (General_options::General_options): Initialize new data member.
1022 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
1023 (General_options): Add --incremental-startup-unchanged option.
1024 (General_options::incremental_startup_disposition): New function.
1025 (General_options::incremental_startup_disposition_): New data member.
1027 2011-07-06 Cary Coutant <ccoutant@google.com>
1029 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
1030 input file index to Script_info ctor.
1031 (Sized_incremental_binary::do_file_has_changed): Find the
1032 command-line argument for files named in scripts.
1033 * incremental.h (Script_info::Script_info): New ctor
1034 with input file index.
1035 (Script_info::input_file_index): New function.
1036 (Script_info::input_file_index_): New data member.
1037 (Incremental_binary::get_library): Add const.
1038 (Incremental_binary::get_script_info): Add const.
1039 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
1040 * testsuite/Makefile.am (incremental_test_5): New test case.
1041 (incremental_test_6): New test case.
1042 * testsuite/Makefile.in: Regenerate.
1044 2011-07-06 Cary Coutant <ccoutant@google.com>
1046 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
1047 debug output when command lines differ.
1049 2011-07-06 Cary Coutant <ccoutant@google.com>
1051 * incremental.cc (Incremental_inputs::report_command_line): Ignore
1052 --incremental-patch option.
1053 * layout.cc (Free_list::allocate): Extend allocation beyond original
1055 (Layout::make_output_section): Mark sections that should get
1057 * options.cc (parse_percent): New function.
1058 * options.h (parse_percent): New function.
1059 (DEFINE_percent): New macro.
1060 (General_options): Add --incremental-patch option.
1061 * output.cc (Output_section::Output_section): Initialize new data
1063 (Output_section::add_input_section): Print section name when out
1065 (Output_section::add_output_section_data): Likewise.
1066 (Output_section::set_final_data_size): Add patch space when
1067 doing --incremental-full.
1068 (Output_section::do_reset_address_and_file_offset): Remove patch
1070 (Output_segment::set_section_list_addresses): Print debug output
1071 only if --incremental-update.
1072 * output.h (Output_section::set_is_patch_space_allowed): New function.
1073 (Output_section::is_patch_space_allowed_): New data member.
1074 (Output_section::patch_space_): New data member.
1075 * parameters.cc (Parameters::incremental_full): New function.
1076 * parameters.h (Parameters::incremental_full): New function
1077 * testsuite/Makefile.am (incremental_test_2): Add test for
1078 --incremental-patch option.
1079 * testsuite/Makefile.in: Regenerate.
1080 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
1081 (t18): Remove function body.
1083 2011-07-05 Doug Kwan <dougkwan@google.com>
1086 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
1087 Arm_Address type for relocation result.
1088 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
1090 (Arm_relocate_functions::abs32): Use unaligned access.
1091 (Arm_relocate_functions::rel32): Ditto.
1092 (Arm_relocate_functions::prel31): Ditto.
1093 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
1094 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
1095 static data relocations.
1096 * testsuite/Makefile.in: Regnerate.
1097 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
1099 2011-07-05 Ian Lance Taylor <iant@google.com>
1102 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
1103 symbols if necessary.
1104 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1106 2011-07-05 Ian Lance Taylor <iant@google.com>
1109 * resolve.cc (Symbol::override_base_with_special): Simply override
1110 version with special symbol version, ignoring previous version.
1112 2011-07-05 Ian Lance Taylor <iant@google.com>
1114 * object.cc (Sized_relobj_file::include_section_group): Add
1115 information to comment about signature location.
1117 2011-07-02 Ian Lance Taylor <iant@google.com>
1120 * options.h (class General_options): Add -f and -F.
1121 * options.cc (General_options::finalize): Fatal error if -f/-F
1122 are used without -shared.
1123 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
1125 2011-07-02 Ian Lance Taylor <iant@google.com>
1127 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
1129 2011-07-01 Ian Lance Taylor <iant@google.com>
1133 * resolve.cc (Symbol::override_base_with_special): Don't override
1134 the version if the overriding symbol has a different name.
1135 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
1136 all callers. If we give an error about an undefined version,
1137 define the base version if necessary.
1138 * dynobj.h (class Versions): Update declaration.
1139 * testsuite/weak_alias_test_5.cc: New file.
1140 * testsuite/weak_alias_test.script: New file.
1141 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
1142 and versioned_alias have the right value, and call t2.
1143 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
1144 weak_alias_test_5.so.
1145 (weak_alias_test_LDADD): Likewise.
1146 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
1147 * testsuite/Makefile.in: Rebuild.
1149 2011-07-01 Ian Lance Taylor <iant@google.com>
1152 * options.h (class General_options): Support -z notext.
1153 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
1155 (two_file_shared_nonpic.so): Likewise.
1156 (two_file_shared_mixed.so): Likewise.
1157 (two_file_shared_mixed_1.so): Likewise.
1158 (weak_undef_lib_nonpic.so): Likewise.
1159 (alt/weak_undef_lib_nonpic.so): Likewise.
1160 (tls_test_shared_nonpic.so): Likewise.
1161 * testsuite/Makefile.in: Rebuild.
1163 2011-07-01 Ian Lance Taylor <iant@google.com>
1166 * configure.ac: Test whether static linking works, setting
1167 the automake conditional HAVE_STATIC.
1168 * testsuite/Makefile.am: Disable tests using -static if
1169 HAVE_STATIC is not true.
1170 * configure, testsuite/Makefile.in: Rebuild.
1172 2011-07-01 Ian Lance Taylor <iant@google.com>
1175 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
1176 Assert if we see DW_EH_PE_indirect.
1177 * target.h (Target::ehframe_datarel_base): New function.
1178 (Target::do_ehframe_datarel_base): New target function.
1179 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
1180 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
1183 2011-07-01 Ian Lance Taylor <iant@google.com>
1186 * options.h (class General_options): Add
1187 --ld-generated-unwind-info.
1188 * ehframe.cc (Fde::write): Add address parameter. Change all
1189 callers. If associated with PLT, fill in address and size.
1190 (Cie::set_output_offset): Only add merge mapping if there is an
1192 (Cie::write): Add address parameter. Change all callers.
1193 (Eh_frame::add_ehframe_for_plt): New function.
1194 * ehframe.h (class Fde): Update declarations. Move shndx_ and
1195 input_offset_ fields into union u_, with new plt field.
1196 (Fde::Fde): Adjust for new union field.
1197 (Fde::Fde) [Output_data version]: New constructor.
1198 (Fde::add_mapping): Only add merge mapping if there is an object.
1199 (class Cie): Update declarations.
1200 (class Eh_frame): Declare add_ehframe_for_plt.
1201 * layout.cc (Layout::layout_eh_frame): Break out code into
1202 make_eh_frame_section, and call it.
1203 (Layout::make_eh_frame_section): New function.
1204 (Layout::add_eh_frame_for_plt): New function.
1205 * layout.h (class Layout): Update declarations.
1206 * merge.cc (Merge_map::add_mapping): Add assertion.
1207 * i386.cc: Include "dwarf.h".
1208 (class Output_data_plt_i386): Make first_plt_entry,
1209 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
1210 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1211 and plt_eh_frame_fde.
1212 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
1213 boundary. Call add_eh_frame_for_plt if appropriate.
1214 * x86_64.cc: Include "dwarf.h".
1215 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
1216 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
1217 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1218 and plt_eh_frame_fde.
1219 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
1222 2011-06-29 Ian Lance Taylor <iant@google.com>
1225 * object.cc (Sized_relobj_file::layout_section): Change shdr
1226 parameter to be const.
1227 (Sized_relobj_file::layout_eh_frame_section): New function, broken
1229 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
1230 appropriate. Call layout_eh_frame_section.
1231 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
1233 * object.h (class Sized_relobj_file): Update declarations.
1235 2011-06-29 Ian Lance Taylor <iant@google.com>
1238 * script.cc (Token::integer_value): Accept trailing M/m/K/k
1240 (Lex::gather_token): Accept trailing M/m/K/k for integers.
1242 2011-06-29 Ian Lance Taylor <iant@google.com>
1245 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
1247 * layout.cc (Layout::layout_eh_frame): Likewise.
1249 2011-06-29 Ian Lance Taylor <iant@google.com>
1252 * layout.cc (Layout::symtab_section_shndx): New function.
1253 * layout.h (class Layout): Declare symtab_section_shndx.
1254 * output.cc (Output_section::write_header): Call it.
1256 2011-06-29 Ian Lance Taylor <iant@google.com>
1259 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
1260 symbols which are not used in a relocation.
1262 2011-06-28 Ian Lance Taylor <iant@google.com>
1265 * layout.cc (Layout::segment_precedes): Don't crash if a linker
1266 script create indistinguishable segments.
1267 (Layout::set_segment_offsets): Use stable_sort when sorting
1268 segments. Pass this to Compare_segments constructor.
1269 * layout.h (class Layout): Make segment_precedes non-static.
1270 (class Compare_segments): Change from struct to class. Add
1271 layout_ field. Add constructor.
1272 * script-sections.cc
1273 (Script_sections::attach_sections_using_phdrs_clause): Rename
1274 local orphan to is_orphan. Don't report failure to put empty
1275 section in segment. On attachment failure, report name of
1276 section, and attach to first PT_LOAD segment.
1278 2011-06-28 Ian Lance Taylor <iant@google.com>
1281 * target-select.cc (Target_selector::Target_selector): Add
1282 emulation parameter. Change all callers.
1283 (select_target_by_bfd_name): Rename from select_target_by_name.
1285 (select_target_by_emulation): New function.
1286 (supported_emulation_names): New function.
1287 * target-select.h (class Target_selector): Add emulation_ field.
1288 Update declarations.
1289 (Target_selector::recognize_by_bfd_name): Rename from
1290 recognize_by_name. Change all callers.
1291 (Target_selector::supported_bfd_names): Rename from
1292 supported_names. Change all callers.
1293 (Target_selector::recognize_by_emulation): New function.
1294 (Target_selector::supported_emulations): New function.
1295 (Target_selector::emulation): New function.
1296 (Target_selector::do_recognize_by_bfd_name): Rename from
1297 do_recognize_by_name. Change all callers.
1298 (Target_selector::do_supported_bfd_names): Rename from
1299 do_supported_names. Change all callers.
1300 (Target_selector::do_recognize_by_emulation): New function.
1301 (Target_selector::do_supported_emulations): New function.
1302 (select_target_by_bfd_name): Change name in declaration.
1303 (select_target_by_emulation): Declare.
1304 (supported_emulation_names): Declare.
1305 * parameters.cc (parameters_force_valid_target): Try to find
1306 target based on emulation from -m option.
1307 * options.h (class General_options): Change doc string for -m.
1308 * options.cc (help): Print emulations.
1309 (General_options::parse_V): Likewise.
1310 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1311 Add emulation parameter. Change all callers.
1313 2011-06-28 Ian Lance Taylor <iant@google.com>
1315 * target.h (class Target): Add osabi_ field.
1316 (Target::osabi): New function.
1317 (Target::set_osabi): New function.
1318 (Target::Target): Initialize osabi_.
1319 (Target::do_adjust_elf_header): Make pure virtual.
1320 (Sized_target::do_adjust_elf_header): Declare.
1321 * target.cc (Sized_target::do_adjust_elf_header): New function.
1322 (class Sized_target): Instantiate all versions.
1323 * freebsd.h (class Target_freebsd): Remove.
1324 (Target_selector_freebsd::do_recognize): Call set_osabi on
1326 (Target_selector_freebsd::do_recognize_by_name): Likewise.
1327 (Target_selector_freebsd::set_osabi): Remove.
1328 * i386.cc (class Target_i386): Inherit from Sized_target rather
1329 than Target_freebsd.
1330 * x86_64.cc (class Target_x86_64): Likewise.
1332 2011-06-28 Ian Lance Taylor <iant@google.com>
1334 * target.h (Target::can_check_for_function_pointers): Rewrite.
1336 (Target::can_icf_inline_merge_sections): Likewise.
1337 (Target::section_may_have_icf_unsafe_poineters): Likewise.
1338 (Target::Target_info): Add can_icf_inline_merge_sections field.
1339 (Target::do_can_check_for_function_pointers): New virtual
1341 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
1342 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
1343 from can_check_for_function_pointers, move in file.
1344 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
1345 section_may_have_icf_unsafe_poineters, move in file.
1346 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
1347 * i386.cc (Target_i386::do_can_check_for_function_pointers):
1348 Rename from can_check_for_function_pointers, move in file.
1349 (Target_i386::can_icf_inline_merge_sections): Remove.
1350 (Target_i386::i386_info): Initialize
1351 can_icf_inline_merge_sections.
1352 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1353 Initialize can_icf_inline_merge_sections.
1354 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
1355 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
1356 Rename from can_check_for_function_pointers, move in file.
1357 (Target_x86_64::can_icf_inline_merge_sections): Remove.
1358 (Target_x86_64::x86_64_info): Initialize
1359 can_icf_inline_merge_sections.
1360 * testsuite/testfile.cc (Target_test::test_target_info):
1362 * icf.cc (get_section_contents): Correct formatting.
1364 2011-06-27 Ian Lance Taylor <iant@google.com>
1366 * symtab.cc (Symbol::versioned_name): New function.
1367 (Symbol_table::add_to_final_symtab): Use versioned_name when
1369 (Symbol_table::sized_write_symbol): Likewise.
1370 * symtab.h (class Symbol): Declare versioned_name.
1371 * stringpool.h (class Stringpool_template): Add variant of add
1372 which takes a std::basic_string.
1373 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
1374 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
1375 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
1376 (ver_test_12.o): New target.
1377 * testsuite/Makefile.in: Rebuild.
1379 2011-06-27 Doug Kwan <dougkwan@google.com>
1381 * arm.cc (Arm_relocate_functions::thm_jump8,
1382 Arm_relocate_functions::thm_jump11): Use a wider signed
1383 type to compute offset.
1384 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
1386 * testsuite/Makefile.in: Regenerate.
1387 * testsuite/arm_branch_in_range.sh: Check test results of
1388 arm_thm_jump11 and arm_thm_jump8.
1389 * testsuite/arm_thm_jump11.s: New test source file.
1390 * testsuite/arm_thm_jump11.t: New linker script.
1391 * testsuite/arm_thm_jump8.s: New test source file.
1392 * testsuite/arm_thm_jump8.t: New linker script.
1394 2011-06-24 Ian Lance Taylor <iant@google.com>
1396 * layout.cc: Include "object.h".
1397 (ctors_sections_in_init_array): New static variable.
1398 (Layout::is_ctors_in_init_array): New function.
1399 (Layout::layout): Add entry to ctors_sections_in_init_array if
1401 * layout.h (class Layout): Declare is_ctors_in_init_array.
1402 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
1403 is_ctors_reverse_view is set.
1404 (Sized_relobj_file::write_sections): Add layout parameter. Change
1405 all callers. Set is_ctors_reverse_view field of View_size.
1406 (Sized_relobj_file::reverse_words): New function.
1407 * object.h (Sized_relobj_file::View_size): Add
1408 is_ctors_reverse_view field.
1409 (class Sized_relobj_file): Update declarations.
1410 * testsuite/initpri3.c: New test.
1411 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
1413 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
1414 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
1415 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
1416 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
1417 * testsuite/Makefile.in: Rebuild.
1419 2011-06-24 Cary Coutant <ccoutant@google.com>
1421 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
1422 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
1423 (debug_msg_cdebug.err): New targets.
1424 * testsuite/Makefile.in: Regenerate.
1425 * testsuite/debug_msg.sh: Check output of link with compressed debug.
1426 Fix checks for link with shared library.
1428 2011-06-24 Doug Kwan <dougkwan@google.com>
1430 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
1431 skip empty text sections.
1432 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
1434 2011-06-22 Ian Lance Taylor <iant@google.com>
1437 * options.h (class General_options): Add --ctors-in-init-array.
1438 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
1439 friends as SHT_PROGBITS for merging sections.
1440 (Layout::layout): Remove special handling of .init_array and
1441 friends. Don't sort if doing relocatable link. Sort for .ctors
1442 and .dtors if ctors_in_init_array.
1443 (Layout::make_output_section): Force correct section types for
1444 .init_array and friends. Don't sort if doing relocatable link,
1445 Don't sort .ctors and .dtors if ctors_in_init_array.
1446 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
1447 (Layout::output_section_name): Add relobj parameter. Change all
1448 callers. Handle .ctors. and .dtors. in code rather than table.
1449 Handle .ctors and .dtors if ctors_in_init_array.
1450 (Layout::match_file_name): New function, moved from output.cc.
1451 * layout.h (class Layout): Update declarations.
1452 * output.cc: Include "layout.h".
1453 (Input_section_sort_entry::get_priority): New function.
1454 (Input_section_sort_entry::match_file_name): Just call
1455 Layout::match_file_name.
1456 (Output_section::Input_section_sort_init_fini_compare::operator()):
1457 Handle .ctors and .dtors. Sort by explicit priority rather than
1459 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
1460 * testsuite/initpri2.c: New test.
1461 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
1462 (check_PROGRAMS): Add initpri2.
1463 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
1464 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
1465 * configure, testsuite/Makefile.in: Rebuild.
1467 2011-06-19 Ian Lance Taylor <iant@google.com>
1470 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
1471 .interp section to a PT_INTERP segment even if we have seen a
1472 --dynamic-linker option. Don't do it if we have seen a PHDRS
1473 clause in a linker script.
1474 (Layout::finalize): Don't create a .interp section if we've
1475 already create a PT_INTERP segment.
1476 (Layout::create_interp): Always call choose_output_section (revert
1477 patch of 2011-06-17). Don't create PT_INTERP segment.
1478 * script-sections.cc
1479 (Script_sections::create_note_and_tls_segments): Add a .interp
1480 section to a PT_INTERP segment even if we have seen a
1481 --dynamic-linker option.
1483 2011-06-18 Ian Lance Taylor <iant@google.com>
1485 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
1486 merely because a non-PT_LOAD segment has a dynamic reloc.
1488 2011-06-18 Ian Lance Taylor <iant@google.com>
1490 * layout.cc (Layout::finish_dynamic_section): Don't create
1491 DT_FLAGS entry if not needed.
1493 2011-06-18 Ian Lance Taylor <iant@google.com>
1496 * layout.cc (Layout::layout_eh_frame): Correct handling of
1497 writable .eh_frame section.
1499 2011-06-17 Ian Lance Taylor <iant@google.com>
1502 * resolve.cc (Symbol_table::resolve): Don't give an error if a
1503 symbol is redefined with the exact same object and value.
1505 2011-06-17 Ian Lance Taylor <iant@google.com>
1508 * layout.h (class Layout): Add interp_segment_ field.
1509 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
1510 (Layout::attach_allocated_section_to_segment): If making shared
1511 library, put .interp section in PT_INTERP segment.
1512 (Layout::finalize): Also call create_interp if -dynamic-linker
1514 (Layout::create_interp): Assert that there is no PT_INTERP
1515 segment. If not using a SECTIONS clause, use make_output_section.
1516 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
1517 * script-sections.cc
1518 (Script_sections::create_note_and_tls_segments): If making shared
1519 library, put .interp section in PT_INTERP segment.
1521 2011-06-17 Ian Lance Taylor <iant@google.com>
1523 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
1524 when making a shared library.
1526 2011-06-17 Ian Lance Taylor <iant@google.com>
1528 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
1529 parameter. Change all callers. Don't issue warning about PC32
1530 against locally defined symbol.
1532 2011-06-16 Ian Lance Taylor <iant@google.com>
1534 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
1535 occurs in same object.
1537 2011-06-14 Alan Modra <amodra@gmail.com>
1539 * po/POTFILES.in: Regenerate.
1541 2011-06-09 Ian Lance Taylor <iant@google.com>
1543 * script-sections.cc
1544 (Orphan_output_section::set_section_addresses): For a relocatable
1545 link set address to 0.
1547 2011-06-09 Cary Coutant <ccoutant@google.com>
1550 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
1551 used with --compress-debug-sections.
1552 * gold/object.cc (Sized_relobj_file::do_layout): Report
1553 uncompressed size of compressed input sections.
1555 2011-06-08 Cary Coutant <ccoutant@google.com>
1558 * testsuite/two_file_test_2_v1.cc: Change initialization of
1559 v2 to keep it in .data.
1561 2011-06-07 Cary Coutant <ccoutant@google.com>
1563 * common.cc (Symbol_table::do_allocate_commons_list): Call
1565 * errors.cc (Errors::fatal): Adjust call to gold_exit.
1566 (Errors::fallback): New function.
1567 (gold_fallback): New function.
1568 * errors.h (Errors::fallback): New function.
1569 * gold.cc (gold_exit): Change status parameter to enum; adjust
1571 (queue_initial_tasks): Call gold_fallback.
1572 * gold.h: Include cstdlib.
1573 (Exit_status): New enum type.
1574 (gold_exit): Change status parameter to enum.
1575 (gold_fallback): New function.
1576 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
1577 (Layout::create_symtab_sections): Likewise.
1578 (Layout::create_shdrs): Likewise.
1579 * main.cc (main): Adjust call to gold_exit.
1580 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
1581 (Output_data_got::add_got_entry_pair): Likewise.
1582 (Output_section::add_input_section): Likewise.
1583 (Output_section::add_output_section_data): Likewise.
1584 (Output_segment::set_section_list_addresses): Likewise.
1585 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
1587 2011-06-07 Cary Coutant <ccoutant@google.com>
1589 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
1590 for incremental links.
1591 * output.cc (Output_segment::set_section_list_addresses): Remove
1592 FIXME and test for TLS or BSS.
1594 2011-06-07 Cary Coutant <ccoutant@google.com>
1596 * testsuite/Makefile.am: Add incremental_copy_test,
1597 incremental_common_test_1.
1598 * testsuite/Makefile.in: Regenerate.
1599 * testsuite/common_test_1_v1.c: New source file.
1600 * testsuite/common_test_1_v2.c: New source file.
1601 * testsuite/copy_test_v1.cc: New source file.
1603 2011-06-07 Cary Coutant <ccoutant@google.com>
1605 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
1606 update, allocate common from bss section's free list.
1607 * incremental-dump.cc (dump_incremental_inputs): Print flag for
1608 linker-defined symbols.
1609 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1610 Skip GOT and PLT entries that are no longer referenced.
1611 (Output_section_incremental_inputs::write_info_blocks): Mark
1612 linker-defined symbols.
1613 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
1614 * output.cc (Output_section::allocate): New function.
1615 * output.h (Output_section::allocate): New function.
1616 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
1617 linker-defined symbols.
1618 (Symbol::override_base_with_special): Copy is_predefined_ flag.
1619 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
1620 (Symbol::init_base_output_data): Likewise.
1621 (Symbol::init_base_output_segment): Likewise.
1622 (Symbol::init_base_constant): Likewise.
1623 (Sized_symbol::init_output_data): Likewise.
1624 (Sized_symbol::init_output_segment): Likewise.
1625 (Sized_symbol::init_constant): Likewise.
1626 (Symbol_table::do_define_in_output_data): Likewise.
1627 (Symbol_table::do_define_in_output_segment): Likewise.
1628 (Symbol_table::do_define_as_constant): Likewise.
1629 * symtab.h (Symbol::is_predefined): New function.
1630 (Symbol::init_base_output_data): Add is_predefined parameter.
1631 (Symbol::init_base_output_segment): Likewise.
1632 (Symbol::init_base_constant): Likewise.
1633 (Symbol::is_predefined_): New data member.
1634 (Sized_symbol::init_output_data): Add is_predefined parameter.
1635 (Sized_symbol::init_output_segment): Likewise.
1636 (Sized_symbol::init_constant): Likewise.
1637 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
1639 2011-06-07 Cary Coutant <ccoutant@google.com>
1641 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
1642 instead of emit_copy_reloc.
1643 (Copy_relocs::emit_copy_reloc): Refactor.
1644 (Copy_relocs::make_copy_reloc): New function.
1645 (Copy_relocs::add_copy_reloc): Remove.
1646 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
1648 (Copy_relocs::make_copy_reloc): New function.
1649 (Copy_relocs::add_copy_reloc): Remove.
1650 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
1651 unchanged input files.
1652 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
1653 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
1654 Reserve BSS space for COPY relocations.
1655 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1656 (Output_section_incremental_inputs::write_info_blocks): Record
1657 whether a symbol is copied from a shared object.
1658 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
1659 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
1660 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
1661 (Incremental_input_entry_reader::get_output_symbol_index): Add
1663 (Incremental_binary::emit_copy_relocs): New function.
1664 (Incremental_binary::do_emit_copy_relocs): New function.
1665 (Sized_incremental_binary::Sized_incremental_binary): Initialize
1667 (Sized_incremental_binary::add_copy_reloc): New function.
1668 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1669 (Sized_incremental_binary::Copy_reloc): New struct.
1670 (Sized_incremental_binary::Copy_relocs): New typedef.
1671 (Sized_incremental_binary::copy_relocs_): New data member.
1672 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
1673 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
1674 * target.h (Sized_target::emit_copy_reloc): New function.
1675 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
1677 2011-06-02 Cary Coutant <ccoutant@google.com>
1680 * gold/archive.cc (Archive::Archive): Initialize new data member.
1681 (Archive::include_all_members): Return if archive has already been
1683 * gold/archive.h (Archive::include_all_members_): New data member.
1685 2011-06-02 Nick Clifton <nickc@redhat.com>
1687 * dynobj.h: Fix spelling mistake in comment.
1688 * output.cc: Likewise.
1690 2011-05-31 Doug Kwan <dougkwan@google.com>
1694 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
1695 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
1696 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
1697 redundant arm_exidx_test.so.
1698 * testsuite/Makefile.in: Regenerate.
1699 (check_SCRIPTS): Add pr12826.sh
1700 (check_DATA): Add pr12826.stdout
1701 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
1702 * testsuite/pr12826.sh: New file.
1703 * testsuite/pr12826_1.s: Ditto.
1704 * testsuite/pr12826_1.s: Ditto.
1706 2011-05-30 Ian Lance Taylor <iant@google.com>
1708 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
1711 2011-05-29 Ian Lance Taylor <iant@google.com>
1714 * testsuite/Makefile.am: Use different file name for two_file_test
1715 temporary file for each incremental test.
1716 * testsuite/Makefile.in: Rebuild.
1718 2011-05-29 Ian Lance Taylor <iant@google.com>
1720 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
1721 binary input file is empty.
1723 2011-05-27 Ian Lance Taylor <iant@google.com>
1725 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
1726 (ver_test_9.so): Likewise.
1727 * testsuite/Makefile.in: Rebuild.
1729 2011-05-26 Cary Coutant <ccoutant@google.com>
1731 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
1732 * incremental.cc (Incremental_inputs::report_input_section): Fix
1733 comment, indentation.
1734 (Incremental_inputs::report_comdat_group): New function.
1735 (Output_section_incremental_inputs::set_final_data_size): Adjust size
1736 of data for incremental input file entry.
1737 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
1738 group count, COMDAT group signatures.
1739 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
1740 an unchanged input file.
1741 * incremental.h (Incremental_object_entry::Incremental_object_entry):
1742 Initialize new data member.
1743 (Incremental_object_entry::add_comdat_group): New function.
1744 (Incremental_object_entry::get_comdat_group_count): New function.
1745 (Incremental_object_entry::get_comdat_signature_key): New function.
1746 (Incremental_object_entry::groups_): New data member.
1747 (Incremental_inputs::report_comdat_group): New function.
1748 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
1749 data for incremental input file entry.
1750 (Incremental_input_entry_reader::get_comdat_group_count): New function.
1751 (Incremental_input_entry_reader::get_input_section): Adjust size of
1752 data for incremental input file entry.
1753 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
1754 (Incremental_input_entry_reader::get_comdat_group_signature): New
1756 * object.cc (Sized_relobj::include_section_group): Report kept
1757 COMDAT groups for incremental links.
1759 2011-05-24 David Meyer <pdox@google.com>
1761 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
1762 with name parameter. Add found_name parameter.
1763 * fileread.cc (Input_file::find_file): Adjust code accordingly.
1764 * dirsearch.h (class Dirsearch): Update declaration.
1766 2011-05-24 Ian Lance Taylor <iant@google.com>
1768 * archive.cc (Library_base::should_include_member): Pull in object
1769 from archive if it defines the entry symbol.
1770 * parameters.cc (Parameters::entry): New function.
1771 * parameters.h (class Parameters): Declare entry.
1772 * output.h (class Output_file_header): Remove entry_ field.
1773 * output.cc (Output_file_header::Output_file_header): Remove entry
1774 parameter. Change all callers.
1775 (Output_file_header::entry): Use parameters->entry.
1776 * gold.cc (queue_middle_tasks): Likewise.
1777 * plugin.cc (Plugin_hook::run): Likewise.
1779 2011-05-24 Cary Coutant <ccoutant@google.com>
1781 * gold.cc (queue_initial_tasks): Pass incremental base filename
1782 to Output_file::open_base_file; don't print error message.
1783 * incremental-dump.cc (main): Adjust call to
1784 Output_file::open_for_modification.
1785 * incremental-dump.cc (main): Likewise.
1786 * incremental.cc (Incremental_inputs::report_command_line):
1787 Ignore --incremental-base option when comparing command lines.
1788 Ignore parameter when given as separate argument.
1789 * options.h (class General_options): Add --incremental-base.
1790 * output.cc (Output_file::Output_file):
1791 (Output_file::open_base_file): Add base_name and writable parameters;
1792 read base file into new file; print error message here.
1793 (Output_file::map_no_anonymous): Add writable parameter; adjust all
1795 * output.h (Output_file::open_for_modification): Rename to...
1796 (Output_file::open_base_file): ...this; add base_name and
1797 writable parameters; adjust all callers.
1798 (Output_file::map_no_anonymous): Add writable parameter; adjust all
1800 * testsuite/Makefile.am (incremental_test_4): Test
1802 * testsuite/Makefile.in: Regenerate.
1804 2011-05-24 Cary Coutant <ccoutant@google.com>
1806 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
1808 * testsuite/Makefile.in: Regenerate.
1809 * testsuite/two_file_test_1_v1.cc: New test source file.
1810 * testsuite/two_file_test_1b_v1.cc: New test source file.
1811 * testsuite/two_file_test_2_v1.cc: New test source file.
1813 2011-05-24 Cary Coutant <ccoutant@google.com>
1815 * dynobj.h (Dynobj::do_dynobj): New function.
1816 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
1817 flag and soname for shared objects.
1818 * incremental.cc (Incremental_inputs::report_object): Make
1819 either Incremental_object_entry or Incremental_dynobj_entry; add
1820 soname to string table.
1821 (Incremental_inputs::report_input_section): Add assertion.
1822 (Output_section_incremental_inputs::set_final_data_size): Adjust
1823 type of input file entry for shared libraries; adjust size of
1824 shared library info entry.
1825 (Output_section_incremental_inputs::write_input_files): Write
1826 as_needed flag for shared libraries.
1827 (Output_section_incremental_inputs::write_info_blocks): Adjust type
1828 of input file entry for shared libraries; write soname.
1829 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
1830 soname from incremental info.
1831 * incremental.h (enum Incremental_input_flags): Add
1832 INCREMENTAL_INPUT_AS_NEEDED.
1833 (Incremental_input_entry::Incremental_input_entry): Initialize new
1835 (Incremental_input_entry::set_as_needed): New function.
1836 (Incremental_input_entry::as_needed): New function.
1837 (Incremental_input_entry::do_dynobj_entry): New function.
1838 (Incremental_input_entry::as_needed_): New data member.
1839 (Incremental_object_entry::Incremental_object_entry): Don't check
1841 (Incremental_object_entry::do_type): Likewise.
1842 (class Incremental_dynobj_entry): New class.
1843 (Incremental_input_entry_reader::as_needed): New function.
1844 (Incremental_input_entry_reader::get_soname): New function.
1845 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
1846 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
1847 size of shared library info entry.
1848 * layout.cc (Layout::finish_dynamic_section): Don't test for
1849 incremental link when adding DT_NEEDED entries.
1850 * object.h (Object::Object): Initialize new data member.
1851 (Object::dynobj): New function.
1852 (Object::set_as_needed): New function.
1853 (Object::as_needed): New function.
1854 (Object::do_dynobj): New function.
1855 (Object::as_needed_): New data member.
1857 2011-05-24 Cary Coutant <ccoutant@google.com>
1859 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
1860 info; adjust display of GOT entries.
1861 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1862 vector of input objects; remove file_status_.
1863 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
1864 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
1865 got_plt reader; call target hooks to reserve GOT entries.
1866 (Output_section_incremental_inputs::set_final_data_size): Adjust size
1867 of input file info header and GOT info entry.
1868 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
1870 (Got_plt_view_info::got_descriptor): Remove.
1871 (Got_plt_view_info::sym_index): New data member.
1872 (Got_plt_view_info::input_index): New data member.
1873 (Local_got_offset_visitor::visit): Write input file index.
1874 (Global_got_offset_visitor::visit): Write 0 for input file index.
1875 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
1876 with sym_index and input_index.
1877 (Output_section_incremental_inputs::write_got_plt): Adjust size of
1878 incremental info GOT entry; replace got_descriptor with input_index.
1879 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
1880 map from input file index to object.
1881 (Sized_relobj_incr::do_layout): Replace direct data member reference
1882 with accessor function.
1883 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
1884 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
1885 Adjust size of input file info header.
1886 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
1887 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
1888 (Incremental_input_entry_reader::get_input_section): Adjust size of
1889 input file info header.
1890 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
1891 of incremental info GOT entry.
1892 (Incremental_got_plt_reader::get_got_desc): Remove.
1893 (Incremental_got_plt_reader::get_got_symndx): New function.
1894 (Incremental_got_plt_reader::get_got_input_index): New function.
1895 (Sized_incremental_binary::Sized_incremental_binary): Remove
1896 file_status_; add input_objects_.
1897 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
1898 (Sized_incremental_binary::set_file_is_unchanged): Remove.
1899 (Sized_incremental_binary::file_is_unchanged): Remove.
1900 (Sized_incremental_binary::set_input_object): New function.
1901 (Sized_incremental_binary::input_object): New function.
1902 (Sized_incremental_binary::file_status_): Remove.
1903 (Sized_incremental_binary::input_objects_): New data member.
1904 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
1906 (Sized_relobj_incr::invalid_address): Move to base class.
1907 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
1909 (Sized_relobj_incr::do_output_section_offset): Likewise.
1910 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
1911 (Sized_relobj_incr::section_offsets_): Likewise.
1912 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
1914 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
1915 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
1916 with accessor function.
1917 (Sized_relobj_file::do_layout): Likewise.
1918 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
1919 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
1920 (Sized_relobj_file::compute_final_local_value): Replace refs to
1921 section_offsets_ with accessor function.
1922 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
1923 * object.h (Relobj::Relobj): Initialize new data members.
1924 (Relobj::add_dyn_reloc): New function.
1925 (Relobj::first_dyn_reloc): New function.
1926 (Relobj::dyn_reloc_count): New function.
1927 (Relobj::first_dyn_reloc_): New data member.
1928 (Relobj::dyn_reloc_count_): New data member.
1929 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
1931 (Sized_relobj::Address): New typedef.
1932 (Sized_relobj::invalid_address): Move here from child class.
1933 (Sized_relobj::Sized_relobj): Initialize new data members.
1934 (Sized_relobj::sized_relobj): New function.
1935 (Sized_relobj::is_output_section_offset_invalid): Move here from
1937 (Sized_relobj::get_output_section_offset): Likewise.
1938 (Sized_relobj::local_has_got_offset): Likewise.
1939 (Sized_relobj::local_got_offset): Likewise.
1940 (Sized_relobj::set_local_got_offset): Likewise.
1941 (Sized_relobj::do_for_all_local_got_entries): Likewise.
1942 (Sized_relobj::clear_got_offsets): New function.
1943 (Sized_relobj::section_offsets): Move here from child class.
1944 (Sized_relobj::do_output_section_offset): Likewise.
1945 (Sized_relobj::do_set_section_offset): Likewise.
1946 (Sized_relobj::Local_got_offsets): Likewise.
1947 (Sized_relobj::local_got_offsets_): Likewise.
1948 (Sized_relobj::section_offsets_): Likewise.
1949 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
1951 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
1953 (Sized_relobj_file::sized_relobj): New function
1954 (Sized_relobj_file::local_has_got_offset): Move to base class.
1955 (Sized_relobj_file::local_got_offset): Likewise.
1956 (Sized_relobj_file::set_local_got_offset): Likewise.
1957 (Sized_relobj_file::get_output_section_offset): Likewise.
1958 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
1959 (Sized_relobj_file::do_output_section_offset): Likewise.
1960 (Sized_relobj_file::do_set_section_offset): Likewise.
1961 (Sized_relobj_file::Local_got_offsets): Likewise.
1962 (Sized_relobj_file::local_got_offsets_): Likewise.
1963 (Sized_relobj_file::section_offsets_): Likewise.
1964 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
1966 (set_needs_dynsym_index): Convert relobj to derived class pointer.
1967 (Output_reloc::get_symbol_index): Likewise.
1968 (Output_reloc::local_section_offset): Likewise.
1969 (Output_reloc::get_address): Likewise.
1970 (Output_reloc::symbol_value): Likewise.
1971 (Output_data_got::reserve_slot): Move to class definition.
1972 (Output_data_got::reserve_local): New function.
1973 (Output_data_got::reserve_slot_for_global): Remove.
1974 (Output_data_got::reserve_global): New function.
1975 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
1976 (all constructors, two instantiations).
1977 (Output_reloc::get_relobj): New function (two instantiations).
1978 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
1979 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
1980 (Output_data_reloc::add_global): Adjust type of relobj.
1981 (Output_data_reloc::add_global_relative): Likewise.
1982 (Output_data_reloc::add_symbolless_global_addend): Likewise.
1983 (Output_data_reloc::add_local): Likewise.
1984 (Output_data_reloc::add_local_relative): Likewise.
1985 (Output_data_reloc::add_symbolless_local_addend): Likewise.
1986 (Output_data_reloc::add_local_section): Likewise.
1987 (Output_data_reloc::add_output_section): Likewise.
1988 (Output_data_reloc::add_absolute): Likewise.
1989 (Output_data_reloc::add_target_specific): Likewise.
1990 (Output_data_got::reserve_slot): Move definition here.
1991 (Output_data_got::reserve_local): New function.
1992 (Output_data_got::reserve_global): New function.
1993 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
1994 section_offsets_ with accessor function.
1995 (Sized_relobj_file::write_sections): Likewise.
1996 (Sized_relobj_file::do_relocate_sections): Likewise.
1997 * target.h (Sized_target::reserve_local_got_entry): New function.
1998 (Sized_target::reserve_global_got_entry): New function.
1999 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
2000 (Target_x86_64::reserve_global_got_entry): New function.
2001 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
2003 2011-05-23 Cary Coutant <ccoutant@google.com>
2005 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
2006 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
2007 bit when checking got_type.
2008 * incremental.cc (Sized_incremental_binary::setup_readers):
2009 Store symbol table and string table locations; initialize bit vector
2010 of file status flags.
2011 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
2013 (Sized_incremental_binary::do_process_got_plt): New function.
2014 (Sized_incremental_binary::get_symtab_view): Use stored locations.
2015 (Output_section_incremental_inputs::set_final_data_size): Record
2016 file index for each input file.
2017 (Output_section_incremental_inputs::write_got_plt): Store file index
2018 instead of input entry offset for each GOT entry.
2020 (Incremental_input_entry::Incremental_input_entry): Initialize new
2022 (Incremental_input_entry::set_offset): Store file index.
2023 (Incremental_input_entry::get_file_index): New function.
2024 (Incremental_input_entry::file_index_): New data member.
2025 (Incremental_binary::process_got_plt): New function.
2026 (Incremental_binary::do_process_got_plt): New function.
2027 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2029 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
2030 (Sized_incremental_binary::set_file_is_unchanged): New function.
2031 (Sized_incremental_binary::file_is_unchanged): New function.
2032 (Sized_incremental_binary::do_process_got_plt): New function.
2033 (Sized_incremental_binary::file_status_): New data member.
2034 (Sized_incremental_binary::main_symtab_loc_): New data member.
2035 (Sized_incremental_binary::main_strtab_loc_): New data member.
2036 * output.cc (Output_data_got::Got_entry::write): Add case
2038 (Output_data_got::add_global): Call add_got_entry.
2039 (Output_data_got::add_global_plt): Likewise.
2040 (Output_data_got::add_global_with_rel): Likewise.
2041 (Output_data_got::add_global_with_rela): Likewise.
2042 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
2043 (Output_data_got::add_global_pair_with_rela): Likewise.
2044 (Output_data_got::add_local): Call add_got_entry.
2045 (Output_data_got::add_local_plt): Likewise.
2046 (Output_data_got::add_local_with_rel): Likewise.
2047 (Output_data_got::add_local_with_rela): Likewise.
2048 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
2049 (Output_data_got::add_local_pair_with_rela): Likewise.
2050 (Output_data_got::reserve_slot): New function.
2051 (Output_data_got::reserve_slot_for_global): New function.
2052 (Output_data_got::add_got_entry): New function.
2053 (Output_data_got::add_got_entry_pair): New function.
2054 (Output_section::add_output_section_data): Edit FIXME.
2056 (Output_section_data_build::Output_section_data_build): New
2057 constructor with size parameter.
2058 (Output_data_space::Output_data_space): Likewise.
2059 (Output_data_got::Output_data_got): Initialize new data member; new
2060 constructor with size parameter.
2061 (Output_data_got::add_constant): Call add_got_entry.
2062 (Output_data_got::reserve_slot): New function.
2063 (Output_data_got::reserve_slot_for_global): New function.
2064 (class Output_data_got::Got_entry): Add RESERVED_CODE.
2065 (Output_data_got::add_got_entry): New function.
2066 (Output_data_got::add_got_entry_pair): New function.
2067 (Output_data_got::free_list_): New data member.
2068 * target.h (Sized_target::init_got_plt_for_update): New function.
2069 (Sized_target::register_global_plt_entry): New function.
2070 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2071 Initialize new data member; call init; add constructor with PLT count.
2072 (Output_data_plt_x86_64::init): New function.
2073 (Output_data_plt_x86_64::add_relocation): New function.
2074 (Output_data_plt_x86_64::reserve_slot): New function.
2075 (Output_data_plt_x86_64::free_list_): New data member.
2076 (Target_x86_64::init_got_plt_for_update): New function.
2077 (Target_x86_64::register_global_plt_entry): New function.
2078 (Output_data_plt_x86_64::add_entry): Allocate from free list for
2079 incremental updates.
2080 (Output_data_plt_x86_64::add_relocation): New function.
2081 * testsuite/object_unittest.cc (Object_test): Set default options.
2083 2011-05-16 Ian Lance Taylor <iant@google.com>
2085 * options.h (class General_options): Make -i a synonym for -r.
2087 2011-05-16 Ian Lance Taylor <iant@google.com>
2089 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
2091 2011-05-10 Cary Coutant <ccoutant@google.com>
2093 * object.cc (Sized_relobj::do_count_local_symbols): Check for
2096 2011-05-06 Ian Lance Taylor <iant@google.com>
2098 * layout.cc (Layout::layout): If the output section flags change,
2099 update the ordering.
2101 2011-04-25 Cary Coutant <ccoutant@google.com>
2103 * incremental-dump.cc (dump_incremental_inputs): Print local
2104 symbol info for each input file.
2106 (Output_section_incremental_inputs::set_final_data_size): Add local
2107 symbol info to input file entries in incremental info.
2108 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2109 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
2110 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
2111 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
2113 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
2114 (Sized_incr_relobj::do_relocate): Write the local symbols.
2115 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
2116 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
2117 Adjust size of input file header.
2118 (Incremental_inputs_reader::get_local_symbol_offset): New function.
2119 (Incremental_inputs_reader::get_local_symbol_count): New function.
2120 (Incremental_inputs_reader::get_input_section): Adjust size of input
2122 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
2123 (Sized_incr_relobj::This): New typedef.
2124 (Sized_incr_relobj::sym_size): New const data member.
2125 (Sized_incr_relobj::Local_symbol): New struct.
2126 (Sized_incr_relobj::do_output_local_symbol_count): New function.
2127 (Sized_incr_relobj::do_local_symbol_offset): New function.
2128 (Sized_incr_relobj::local_symbol_count_): New data member.
2129 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
2130 (Sized_incr_relobj::local_symbol_index_): New data member.
2131 (Sized_incr_relobj::local_symbol_offset_): New data member.
2132 (Sized_incr_relobj::local_dynsym_offset_): New data member.
2133 (Sized_incr_relobj::local_symbols_): New data member.
2134 * object.h (Relobj::output_local_symbol_count): New function.
2135 (Relobj::local_symbol_offset): New function.
2136 (Relobj::do_output_local_symbol_count): New function.
2137 (Relobj::do_local_symbol_offset): New function.
2138 (Sized_relobj::do_output_local_symbol_count): New function.
2139 (Sized_relobj::do_local_symbol_offset): New function.
2141 2011-04-22 Vladimir Simonov <sv@sw.ru>
2143 * descriptors.cc (set_close_on_exec): New function.
2144 (Descriptors::open): Use set_close_on_exec.
2145 * output.cc (S_ISLNK): Define if not defined.
2147 2011-04-22 Cary Coutant <ccoutant@google.com>
2149 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2151 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2152 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
2153 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
2155 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
2156 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
2157 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
2159 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
2161 (Incremental_binary::apply_incremental_relocs): New function.
2162 (Incremental_binary::do_apply_incremental_relocs): New function.
2163 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2165 (Sized_incremental_binary::add_global_symbol): New function.
2166 (Sized_incremental_binary::global_symbol): New function.
2167 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2168 (Sized_incremental_binary::symbol_map_): New data member.
2169 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
2170 * target.h (Sized_target::apply_relocation): New function.
2171 * target-reloc.h (apply_relocation): New function.
2172 * x86_64.cc (Target_x86_64::apply_relocation): New function.
2174 2011-04-22 Doug Kwan <dougkwan@google.com>
2176 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
2177 flag of a SHT_ARM_EXIDX section.
2178 * testsuite/Makefile.am (arm_exidx_test): New test rules.
2179 * testsuite/Makefile.in: Regenerate.
2180 * testsuite/arm_exidx_test.s: New file.
2181 * testsuite/arm_exidx_test.sh: Same.
2183 2011-04-20 Cary Coutant <ccoutant@google.com>
2186 * archive.h (Incremental_archive_entry::Archive_member):
2187 Initialize arg_serial_ (second constructor).
2189 2011-04-17 Ian Lance Taylor <iant@google.com>
2191 * object.cc (Relocate_info::location): Simplify location string.
2192 * errors.cc (Errors::error_at_location): Don't print program
2194 (Errors::warning_at_location): Likewise.
2195 (Errors::undefined_symbol): Likewise.
2196 * testsuite/debug_msg.sh: Update accordingly.
2198 2011-04-14 Cary Coutant <ccoutant@google.com>
2200 * gold/layout.cc (Layout::symtab_section_offset): New function.
2201 * gold/layout.h (Layout::symtab_section_offset): New function.
2202 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
2204 2011-04-12 Ian Lance Taylor <iant@google.com>
2206 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
2207 with MREMAP_MAYMOVE.
2208 * output.h (class Output_file): Add map_is_allocated_ field.
2209 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
2210 not available, provide stubs. If mremap is not available, #define
2212 (MREMAP_MAYMOVE): Define if not defined.
2213 (Output_file::Output_file): Initialize map_is_allocated_.
2214 (Output_file::resize): Check map_is_allocated_.
2215 (Output_file::map_anonymous): If mmap fails, use malloc.
2216 (Output_file::unmap): Don't do anything for an anonymous map.
2217 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
2218 is not available, provide stubs.
2219 (File_read::View::~View): Use free rather than delete[].
2220 (File_read::make_view): Use malloc rather than new[]. If mmap
2222 (File_read::find_or_make_view): Use malloc rather than new[].
2223 * gold.h: Remove HAVE_REMAP code.
2224 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
2225 exists. Rename mremap to gold_mremap. If mmap is not available
2227 * configure, config.in: Rebuild.
2229 2011-04-11 Ian Lance Taylor <iant@google.com>
2231 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
2232 initialize local variable v.
2234 2011-04-11 Cary Coutant <ccoutant@google.com>
2236 * archive.cc (Archive::include_member): Adjust call to
2238 (Add_archive_symbols::run): Track argument serial numbers.
2239 (Lib_group::include_member): Likewise.
2240 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
2241 * archive.h (Incremental_archive_entry::Archive_member):
2242 Initialize arg_serial_.
2243 (Archive_member::arg_serial_): New data member.
2244 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
2245 (Sized_dynobj::do_add_symbols): Track symbols when doing an
2247 (Sized_dynobj::do_for_all_local_got_entries): New function.
2248 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
2250 * fileread.cc (get_mtime): New function.
2251 * fileread.h (get_mtime): New function.
2252 * gold.cc (queue_initial_tasks): Check for incremental update.
2253 (process_incremental_input): New function.
2254 (queue_middle_tasks): Don't force valid target for incremental
2256 * incremental-dump.cc (find_input_containing_global): Adjust
2257 size of symbol info entry.
2258 (dump_incremental_inputs): Dump argument serial number and
2259 in_system_directory flag; bias shndx by 1; print symbol names
2260 when dumping per-file symbol lists; use new symbol info readers.
2262 (Output_section_incremental_inputs:update_data_size): New function.
2263 (Sized_incremental_binary::setup_readers): Setup input readers
2264 for each input file; build maps for files added from libraries
2266 (Sized_incremental_binary::check_input_args): New function.
2267 (Sized_incremental_binary::do_check_inputs): Build map of argument
2268 serial numbers to input arguments.
2269 (Sized_incremental_binary::do_file_has_changed): Rename
2270 do_file_is_unchanged to this; compare file modification times.
2271 (Sized_incremental_binary::do_init_layout): New function.
2272 (Sized_incremental_binary::do_reserve_layout): New function.
2273 (Sized_incremental_binary::do_get_input_reader): Remove.
2274 (Sized_incremental_binary::get_symtab_view): New function.
2275 (Incremental_checker::can_incrementally_link_output_file): Remove.
2276 (Incremental_inputs::report_command_line): Exclude --debug options.
2277 (Incremental_inputs::report_archive_begin): Add parameter; track
2278 argument serial numbers; don't put input file entry for archive
2279 before archive members.
2280 (Incremental_inputs::report_archive_end): Put input file entry
2281 for archive after archive members.
2282 (Incremental_inputs::report_object): Add parameter; track argument
2283 serial numbers and in_system_directory flag.
2284 (Incremental_inputs::report_script): Add parameter; track argument
2286 (Output_section_incremental_inputs::set_final_data_size): Adjust
2287 size of symbol info entry; check for forwarding symbols.
2288 (Output_section_incremental_inputs::write_input_files): Write
2289 in_system_directory flag and argument serial number.
2290 (Output_section_incremental_inputs::write_info_blocks): Map section
2291 indices between incremental info and original input file; store
2292 input section index for each symbol.
2293 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2294 change operator() to visit().
2295 (class Global_got_offset_visitor): Likewise.
2296 (class Global_symbol_visitor_got_plt):
2297 (Output_section_incremental_inputs::write_got_plt): Use new visitor
2299 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
2300 (Sized_incr_relobj::do_read_symbols): New function.
2301 (Sized_incr_relobj::do_layout): New function.
2302 (Sized_incr_relobj::do_layout_deferred_sections): New function.
2303 (Sized_incr_relobj::do_add_symbols): New function.
2304 (Sized_incr_relobj::do_should_include_member): New function.
2305 (Sized_incr_relobj::do_for_all_global_symbols): New function.
2306 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
2307 (Sized_incr_relobj::do_section_size): New function.
2308 (Sized_incr_relobj::do_section_name): New function.
2309 (Sized_incr_relobj::do_section_contents): New function.
2310 (Sized_incr_relobj::do_section_flags): New function.
2311 (Sized_incr_relobj::do_section_entsize): New function.
2312 (Sized_incr_relobj::do_section_address): New function.
2313 (Sized_incr_relobj::do_section_type): New function.
2314 (Sized_incr_relobj::do_section_link): New function.
2315 (Sized_incr_relobj::do_section_info): New function.
2316 (Sized_incr_relobj::do_section_addralign): New function.
2317 (Sized_incr_relobj::do_initialize_xindex): New function.
2318 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2319 (Sized_incr_relobj::do_read_relocs): New function.
2320 (Sized_incr_relobj::do_gc_process_relocs): New function.
2321 (Sized_incr_relobj::do_scan_relocs): New function.
2322 (Sized_incr_relobj::do_count_local_symbols): New function.
2323 (Sized_incr_relobj::do_finalize_local_symbols): New function.
2324 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2325 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2326 (Sized_incr_relobj::do_relocate): New function.
2327 (Sized_incr_relobj::do_set_section_offset): New function.
2328 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2329 (Sized_incr_dynobj::do_read_symbols): New function.
2330 (Sized_incr_dynobj::do_layout): New function.
2331 (Sized_incr_dynobj::do_add_symbols): New function.
2332 (Sized_incr_dynobj::do_should_include_member): New function.
2333 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
2334 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
2335 (Sized_incr_dynobj::do_section_size): New function.
2336 (Sized_incr_dynobj::do_section_name): New function.
2337 (Sized_incr_dynobj::do_section_contents): New function.
2338 (Sized_incr_dynobj::do_section_flags): New function.
2339 (Sized_incr_dynobj::do_section_entsize): New function.
2340 (Sized_incr_dynobj::do_section_address): New function.
2341 (Sized_incr_dynobj::do_section_type): New function.
2342 (Sized_incr_dynobj::do_section_link): New function.
2343 (Sized_incr_dynobj::do_section_info): New function.
2344 (Sized_incr_dynobj::do_section_addralign): New function.
2345 (Sized_incr_dynobj::do_initialize_xindex): New function.
2346 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
2347 (make_sized_incremental_object): New function.
2348 (Incremental_library::copy_unused_symbols): New function.
2349 (Incremental_library::do_for_all_unused_symbols): New function.
2350 * incremental.h (enum Incremental_input_flags): New type.
2351 (class Incremental_checker): Remove.
2352 (Incremental_input_entry::Incremental_input_entry): Add argument
2354 (Incremental_input_entry::arg_serial): New function.
2355 (Incremental_input_entry::set_is_in_system_directory): New function.
2356 (Incremental_input_entry::is_in_system_directory): New function.
2357 (Incremental_input_entry::arg_serial_): New data member.
2358 (Incremental_input_entry::is_in_system_directory_): New data member.
2359 (class Script_info): Move here from script.h.
2360 (Script_info::Script_info): Add filename parameter.
2361 (Script_info::filename): New function.
2362 (Script_info::filename_): New data member.
2363 (Incremental_script_entry::Incremental_script_entry): Add argument
2365 (Incremental_object_entry::Incremental_object_entry): Likewise.
2366 (Incremental_object_entry::add_input_section): Build list of input
2367 sections with map to original shndx.
2368 (Incremental_object_entry::get_input_section_index): New function.
2369 (Incremental_object_entry::shndx_): New data member.
2370 (Incremental_object_entry::name_key_): Rename; adjust all refs.
2371 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
2372 (Incremental_archive_entry::Incremental_archive_entry): Add argument
2374 (Incremental_inputs::report_archive_begin): Likewise.
2375 (Incremental_inputs::report_object): Likewise.
2376 (Incremental_inputs::report_script): Likewise.
2377 (class Incremental_global_symbol_reader): New class.
2378 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
2379 and store flags and input file type.
2380 (Incremental_input_entry_reader::arg_serial): New function.
2381 (Incremental_input_entry_reader::type): Extract type from flags.
2382 (Incremental_input_entry_reader::is_in_system_directory): New function.
2383 (Incremental_input_entry_reader::get_input_section_count): Call
2384 accessor function for type.
2385 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
2386 function for type; adjust size of global symbol entry.
2387 (Incremental_input_entry_reader::get_global_symbol_count): Call
2388 accessor function for type.
2389 (Incremental_input_entry_reader::get_object_count): Likewise.
2390 (Incremental_input_entry_reader::get_object_offset): Likewise.
2391 (Incremental_input_entry_reader::get_member_count): Likewise.
2392 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
2393 (Incremental_input_entry_reader::get_member_offset): Likewise.
2394 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
2395 (Incremental_input_entry_reader::Global_symbol_info): Remove.
2396 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
2397 (Incremental_input_entry_reader::get_global_symbol_reader): New
2399 (Incremental_input_entry_reader::get_output_symbol_index): New
2401 (Incremental_input_entry_reader::type_): Remove.
2402 (Incremental_input_entry_reader::flags_): New data member.
2403 (Incremental_inputs_reader::input_file_offset): New function.
2404 (Incremental_inputs_reader::input_file_index): New function.
2405 (Incremental_inputs_reader::input_file): Call input_file_offset.
2406 (Incremental_inputs_reader::input_file_at_offset): New function.
2407 (Incremental_relocs_reader::get_r_type): Reformat.
2408 (Incremental_relocs_reader::get_r_shndx): Reformat.
2409 (Incremental_relocs_reader::get_r_offset): Reformat.
2410 (Incremental_relocs_reader::data): New function.
2411 (Incremental_binary::Incremental_binary): Initialize new data members.
2412 (Incremental_binary::check_inputs): Add cmdline parameter.
2413 (Incremental_binary::file_is_unchanged): Remove.
2414 (Input_reader::arg_serial): New function.
2415 (Input_reader::get_unused_symbol_count): New function.
2416 (Input_reader::get_unused_symbol): New function.
2417 (Input_reader::do_arg_serial): New function.
2418 (Input_reader::do_get_unused_symbol_count): New function.
2419 (Input_reader::do_get_unused_symbol): New function.
2420 (Incremental_binary::input_file_count): New function.
2421 (Incremental_binary::get_input_reader): Change signature to use
2422 index instead of filename.
2423 (Incremental_binary::file_has_changed): New function.
2424 (Incremental_binary::get_input_argument): New function.
2425 (Incremental_binary::get_library): New function.
2426 (Incremental_binary::get_script_info): New function.
2427 (Incremental_binary::init_layout): New function.
2428 (Incremental_binary::reserve_layout): New function.
2429 (Incremental_binary::output_file): New function.
2430 (Incremental_binary::do_check_inputs): New function.
2431 (Incremental_binary::do_file_is_unchanged): Remove.
2432 (Incremental_binary::do_file_has_changed): New function.
2433 (Incremental_binary::do_init_layout): New function.
2434 (Incremental_binary::do_reserve_layout): New function.
2435 (Incremental_binary::do_input_file_count): New function.
2436 (Incremental_binary::do_get_input_reader): Change signature.
2437 (Incremental_binary::input_args_map_): New data member.
2438 (Incremental_binary::library_map_): New data member.
2439 (Incremental_binary::script_map_): New data member.
2440 (Sized_incremental_binary::Sized_incremental_binary): Initialize
2442 (Sized_incremental_binary::output_section): New function.
2443 (Sized_incremental_binary::inputs_reader): Add const.
2444 (Sized_incremental_binary::symtab_reader): Add const.
2445 (Sized_incremental_binary::relocs_reader): Add const.
2446 (Sized_incremental_binary::got_plt_reader): Add const.
2447 (Sized_incremental_binary::get_symtab_view): New function.
2448 (Sized_incremental_binary::Inputs_reader): New typedef.
2449 (Sized_incremental_binary::Input_entry_reader): New typedef.
2450 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
2451 (Sized_incremental_binary::do_file_is_unchanged): Remove.
2452 (Sized_incremental_binary::do_file_has_changed): New function.
2453 (Sized_incremental_binary::do_init_layout): New function.
2454 (Sized_incremental_binary::do_reserve_layout): New function.
2455 (Sized_input_reader::Inputs_reader): Remove.
2456 (Sized_input_reader::Input_entry_reader): Remove.
2457 (Sized_input_reader::do_arg_serial): New function.
2458 (Sized_input_reader::do_get_unused_symbol_count): New function.
2459 (Sized_input_reader::do_get_unused_symbol): New function.
2460 (Sized_incremental_binary::do_input_file_count): New function.
2461 (Sized_incremental_binary::do_get_input_reader): Change signature;
2462 use index instead of filename.
2463 (Sized_incremental_binary::section_map_): New data member.
2464 (Sized_incremental_binary::input_entry_readers_): New data member.
2465 (class Sized_incr_relobj): New class.
2466 (class Sized_incr_dynobj): New class.
2467 (make_sized_incremental_object): New function.
2468 (class Incremental_library): New class.
2469 * layout.cc (Free_list::num_lists): New static data member.
2470 (Free_list::num_nodes): New static data member.
2471 (Free_list::num_removes): New static data member.
2472 (Free_list::num_remove_visits): New static data member.
2473 (Free_list::num_allocates): New static data member.
2474 (Free_list::num_allocate_visits): New static data member.
2475 (Free_list::init): New function.
2476 (Free_list::remove): New function.
2477 (Free_list::allocate): New function.
2478 (Free_list::dump): New function.
2479 (Free_list::print_stats): New function.
2480 (Layout_task_runner::run): Resize output file for incremental updates.
2481 (Layout::Layout): Initialize new data members.
2482 (Layout::set_incremental_base): New function.
2483 (Layout::init_fixed_output_section): New function.
2484 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
2485 incremental updates.
2486 (Layout::create_gold_note): Do not create gold note section for
2487 incremental updates.
2488 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
2489 for incremental updates.
2490 (Layout::set_section_offsets): For incremental updates, allocate space
2492 (Layout::create_symtab_sections): Layout with offsets relative to
2493 start of section; for incremental updates, allocate space from free
2495 (Layout::create_shdrs): For incremental updates, allocate space from
2497 (Layout::finish_dynamic_section): For incremental updates, do not
2498 check --as-needed (fixed in subsequent patch).
2499 * layout.h (class Free_list): New class.
2500 (Layout::set_incremental_base): New function.
2501 (Layout::incremental_base): New function.
2502 (Layout::init_fixed_output_section): New function.
2503 (Layout::allocate): New function.
2504 (Layout::incremental_base_): New data member.
2505 (Layout::free_list_): New data member.
2506 * main.cc (main): Print Free_list statistics.
2507 * object.cc (Relobj::finalize_incremental_relocs): Add
2508 clear_counts parameter; clear counts only when clear_counts is set.
2509 (Sized_relobj::Sized_relobj): Initialize new base class.
2510 (Sized_relobj::do_layout): Don't report special sections.
2511 (Sized_relobj::do_for_all_local_got_entries): New function.
2512 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
2513 symtab_off to all symbol table offsets.
2514 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
2515 * object.h (class Got_offset_list): Move to top of file.
2516 (Object::Object): Allow case where input_file == NULL.
2517 (Object::~Object): Likewise.
2518 (Object::input_file): Assert that input_file != NULL.
2519 (Object::lock): Allow case where input_file == NULL.
2520 (Object::unlock): Likewise.
2521 (Object::is_locked): Likewise.
2522 (Object::token): Likewise.
2523 (Object::release): Likewise.
2524 (Object::is_incremental): New function.
2525 (Object::get_mtime): New function.
2526 (Object::for_all_local_got_entries): New function.
2527 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
2528 (Object::set_is_in_system_directory): New function.
2529 (Object::is_in_system_directory): New function.
2530 (Object::do_is_incremental): New function.
2531 (Object::do_get_mtime): New function.
2532 (Object::do_for_all_local_got_entries): New function.
2533 (Object::is_in_system_directory_): New data member.
2534 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
2535 (class Sized_relobj_base): New class.
2536 (class Sized_relobj): Derive from Sized_relobj_base.
2537 (class Sized_relobj::Symbols): Redeclare from base class.
2538 (class Sized_relobj::local_got_offset_list): Remove.
2539 (class Sized_relobj::Output_sections): Redeclare from base class.
2540 (class Sized_relobj::do_for_all_local_got_entries): New function.
2541 (class Sized_relobj::write_local_symbols): Add offset parameter.
2542 (class Sized_relobj::local_symbol_offset_): Update comment.
2543 (class Sized_relobj::local_dynsym_offset_): Update comment.
2544 * options.cc (Input_arguments::add_file): Remove const.
2545 * options.h (Input_file_argument::Input_file_argument):
2546 Initialize arg_serial_ (all constructors).
2547 (Input_file_argument::set_arg_serial): New function.
2548 (Input_file_argument::arg_serial): New function.
2549 (Input_file_argument::arg_serial_): New data member.
2550 (Input_arguments::Input_arguments): Initialize file_count_.
2551 (Input_arguments::add_file): Remove const.
2552 (Input_arguments::number_of_input_files): New function.
2553 (Input_arguments::file_count_): New data member.
2554 (Command_line::number_of_input_files): Call
2555 Input_arguments::number_of_input_files.
2556 * output.cc (Output_segment_headers::Output_segment_headers):
2558 (Output_section::Input_section::current_data_size): New function.
2559 (Output_section::Output_section): Initialize new data members.
2560 (Output_section::add_input_section): Don't do merge sections for
2561 an incremental link; allocate space from free list for an
2563 (Output_section::add_output_section_data): Allocate space from
2564 free list for an incremental update.
2565 (Output_section::update_data_size): New function.
2566 (Output_section::set_fixed_layout): New function.
2567 (Output_section::reserve): New function.
2568 (Output_segment::set_section_addresses): Remove const.
2569 (Output_segment::set_section_list_addresses): Remove const; allocate
2570 space from free list for an incremental update.
2571 (Output_segment::set_offset): Adjust size of RELRO segment for an
2573 * output.h (Output_data::current_data_size): Move here from
2575 (Output_data::pre_finalize_data_size): New function.
2576 (Output_data::update_data_size): New function.
2577 (Output_section_headers::update_data_size): new function.
2578 (Output_section_data_build::current_data_size): Move to Output_data.
2579 (Output_data_strtab::update_data_size): New function.
2580 (Output_section::current_data_size): Move to Output_data.
2581 (Output_section::set_fixed_layout): New function.
2582 (Output_section::has_fixed_layout): New function.
2583 (Output_section::reserve): New function.
2584 (Output_section::update_data_size): New function.
2585 (Output_section::has_fixed_layout_): New data member.
2586 (Output_section::free_list_): New data member.
2587 (Output_segment::set_section_addresses): Remove const.
2588 (Output_segment::set_section_list_addresses): Remove const.
2589 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
2591 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
2593 * readsyms.cc (Read_symbols::do_read_symbols): Add library
2594 parameter when calling Add_symbols constructor; store argument
2595 serial number for members of a lib group.
2596 (Add_symbols::locks): Allow case where token == NULL.
2597 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
2598 (Read_member::~Read_member): New function.
2599 (Read_member::is_runnable): New function.
2600 (Read_member::locks): New function.
2601 (Read_member::run): New function.
2602 (Check_script::~Check_script): New function.
2603 (Check_script::is_runnable): New function.
2604 (Check_script::locks): New function.
2605 (Check_script::run): New function.
2606 (Check_library::~Check_library): New function.
2607 (Check_library::is_runnable): New function.
2608 (Check_library::locks): New function.
2609 (Check_library::run): New function.
2610 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
2611 (Add_symbols::library_): New data member.
2612 (class Read_member): New class.
2613 (class Check_script): New class.
2614 (class Check_library): New class.
2615 * reloc.cc (Read_relocs::is_runnable): Allow case where
2617 (Read_relocs::locks): Likewise.
2618 (Scan_relocs::locks): Likewise.
2619 (Relocate_task::locks): Likewise.
2620 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
2622 (Sized_relobj::incremental_relocs_scan): Fix comment.
2623 (Sized_relobj::do_relocate): Pass output file offset to
2624 write_local_symbols.
2625 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
2626 from class declaration.
2627 * script.cc (read_input_script): Allocate Script_info; pass
2628 argument serial number to report_script.
2629 * script.h (class Script_info): Move to incremental.h.
2630 * symtab.cc (Symbol_table::add_from_incrobj): New function.
2631 * symtab.h (Symbol_table::add_from_incrobj): New function.
2632 (Symbol_table::set_file_offset): New function.
2634 2011-04-05 Cary Coutant <ccoutant@google.com>
2636 * incremental-dump.cc (dump_incremental_inputs): Change signature
2637 to take a Sized_incremental_binary; change caller. Use readers
2638 in Sized_incremental_binary.
2640 (Sized_incremental_binary::find_incremental_inputs_sections):
2641 Rename do_find_incremental_inputs_sections to this.
2642 (Sized_incremental_binary::setup_readers): New function.
2643 (Sized_incremental_binary::do_check_inputs): Check
2644 has_incremental_info_ flag; move setup code to setup_readers;
2646 (Sized_incremental_binary::do_file_is_unchanged): New function.
2647 (Sized_incremental_binary::do_get_input_reader): New function.
2648 * incremental.h (class Incremental_binary): Move to end of file.
2649 (Incremental_binary::file_is_unchanged): New function.
2650 (Incremental_binary::do_file_is_unchanged): New function.
2651 (Incremental_binary::Input_reader): New class.
2652 (Incremental_binary::get_input_reader): New function.
2653 (class Sized_incremental_binary): Move to end of file.
2654 (Sized_incremental_binary::Sized_incremental_binary): Setup the
2655 input section reader classes.
2656 (Sized_incremental_binary::has_incremental_info): New function.
2657 (Sized_incremental_binary::inputs_reader): New function.
2658 (Sized_incremental_binary::symtab_reader): New function.
2659 (Sized_incremental_binary::relocs_reader): New function.
2660 (Sized_incremental_binary::got_plt_reader): New function.
2661 (Sized_incremental_binary::do_file_is_unchanged): New function.
2662 (Sized_incremental_binary::Sized_input_reader): New class.
2663 (Sized_incremental_binary::get_input_reader): New function.
2664 (Sized_incremental_binary::find_incremental_inputs_sections):
2665 Rename do_find_incremental_inputs_sections to this.
2666 (Sized_incremental_binary::setup_readers): New function.
2667 (Sized_incremental_binary::has_incremental_info_): New data member.
2668 (Sized_incremental_binary::inputs_reader_): New data member.
2669 (Sized_incremental_binary::symtab_reader_): New data member.
2670 (Sized_incremental_binary::relocs_reader_): New data member.
2671 (Sized_incremental_binary::got_plt_reader_): New data member.
2672 (Sized_incremental_binary::current_input_file_): New data member.
2674 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
2677 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
2680 2011-03-30 Cary Coutant <ccoutant@google.com>
2682 * archive.cc (Archive::include_member): Adjust call to report_object.
2683 (Add_archive_symbols::run): Add script_info to call to
2684 report_archive_begin.
2685 (Lib_group::include_member): Adjust call to report_object.
2686 (Add_lib_group_symbols::run): Adjust call to report_object.
2687 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
2688 blocks. Add object count for script input files.
2689 * incremental.cc (Incremental_inputs::report_archive_begin): Add
2690 script_info parameter; change all callers.
2691 (Incremental_inputs::report_object): Add script_info parameter;
2693 (Incremental_inputs::report_script): Store backpointer to
2694 incremental info entry.
2695 (Output_section_incremental_inputs::set_final_data_size): Record
2696 additional information for scripts.
2697 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2698 * incremental.h (Incremental_script_entry::add_object): New function.
2699 (Incremental_script_entry::get_object_count): New function.
2700 (Incremental_script_entry::get_object): New function.
2701 (Incremental_script_entry::objects_): New data member; adjust
2703 (Incremental_inputs::report_archive_begin): Add script_info parameter.
2704 (Incremental_inputs::report_object): Add script_info parameter.
2705 (Incremental_inputs_reader::get_object_count): New function.
2706 (Incremental_inputs_reader::get_object_offset): New function.
2707 * options.cc (Input_arguments::add_file): Return reference to
2709 * options.h (Input_argument::set_script_info): New function.
2710 (Input_argument::script_info): New function.
2711 (Input_argument::script_info_): New data member; adjust all
2713 (Input_file_group::add_file): Return reference to new input argument.
2714 (Input_file_lib::add_file): Likewise.
2715 (Input_arguments::add_file): Likewise.
2716 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
2717 * script.cc (Parser_closure::Parser_closure): Add script_info
2718 parameter; adjust all callers.
2719 (Parser_closure::script_info): New function.
2720 (Parser_closure::script_info_): New data member.
2721 (read_input_script): Report scripts earlier to incremental info.
2722 (script_add_file): Set script_info in Input_argument.
2723 (script_add_library): Likewise.
2724 * script.h (Script_options::Script_info): Rewrite class.
2726 2011-03-29 Cary Coutant <ccoutant@google.com>
2728 * archive.cc (Library_base::should_include_member): Move
2729 method here from class Archive.
2730 (Archive::Archive): Initialize base class.
2731 (Archive::should_include_member): Move to base class.
2732 (Archive::do_for_all_unused_symbols): New function.
2733 (Add_archive_symbols::run): Remove redundant access to
2735 (Lib_group::Lib_group): Initialize base class.
2736 (Lib_group::do_filename): New function.
2737 (Lib_group::include_member): Pass pointer to Lib_group to
2739 (Lib_group::do_for_all_unused_symbols): New function.
2740 (Add_lib_group_symbols::run): Report archive information for
2742 * archive.h (class Library_base): New base class.
2743 (class Archive): Derive from Library_base.
2744 (Archive::filename): Move to base class.
2745 (Archive::set_incremental_info): Likewise.
2746 (Archive::incremental_info): Likewise.
2747 (Archive::Should_include): Likewise.
2748 (Archive::should_include_member): Likewise.
2749 (Archive::Armap_entry): Remove.
2750 (Archive::Unused_symbol_iterator): Remove.
2751 (Archive::unused_symbols_begin): Remove.
2752 (Archive::unused_symbols_end): Remove.
2753 (Archive::do_filename): New function.
2754 (Archive::do_get_mtime): New function.
2755 (Archive::do_for_all_unused_symbols): New function.
2756 (Archive::task_): Move to base class.
2757 (Archive::incremental_info_): Likewise.
2758 (class Lib_group): Derive from Library_base.
2759 (Lib_group::do_filename): New function.
2760 (Lib_group::do_get_mtime): New function.
2761 (Lib_group::do_for_all_unused_symbols): New function.
2762 (Lib_group::task_): Move to base class.
2763 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
2765 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
2767 * incremental.cc (Incremental_inputs::report_archive_begin):
2768 Use Library_base; call library's get_mtime; add incremental inputs
2769 entry before members.
2770 (class Unused_symbol_visitor): New class.
2771 (Incremental_inputs::report_archive_end): Use Library_base; use
2772 visitor class to record unused symbols; don't add incremental inputs
2773 entry after members.
2774 (Incremental_inputs::report_object): Use Library_base.
2776 (Incremental_archive_entry::Incremental_archive_entry): Remove
2777 unused Archive parameter.
2778 (Incremental_inputs::report_archive_begin): Use Library_base.
2779 (Incremental_inputs::report_archive_end): Likewise.
2780 (Incremental_inputs::report_object): Likewise.
2781 * object.cc (Sized_relobj::do_for_all_global_symbols): New
2783 * object.h (Object::for_all_global_symbols): New function.
2784 (Object::do_for_all_global_symbols): New function.
2785 (Sized_relobj::do_for_all_global_symbols): New function.
2786 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
2788 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
2791 2011-03-27 Ian Lance Taylor <iant@google.com>
2793 * archive.cc (Archive::interpret_header): Return -1 if something
2794 goes wrong. Change callers accordingly.
2796 2011-03-25 Cary Coutant <ccoutant@google.com>
2798 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
2799 * testsuite/Makefile.in: Regenerate.
2801 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
2803 * plugin.cc (get_view): New.
2804 (Plugin::load): Pass get_view to the plugin.
2805 (Plugin_manager::get_view): New.
2807 2011-03-21 Ian Lance Taylor <iant@google.com>
2809 * testsuite/final_layout.sh: Rewrite to not use dc.
2810 * testsuite/relro_test.sh: Fail if dc is not present.
2812 2011-03-21 Sriraman Tallam <tmsriram@google.com>
2814 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
2816 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
2817 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
2819 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
2820 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
2822 2011-03-14 Ian Lance Taylor <iant@google.com>
2824 * script-sections.cc (Sort_output_sections::script_compare):
2825 Rename from is_before, change return type.
2826 (Sort_output_sections::operator()): Adjust accordingly.
2828 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
2831 * testsuite/odr_violation2.cc: Add comment to make all error line
2832 numbers double digits.
2833 * testsuite/debug_msg.sh: Adjust expected errors.
2835 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
2837 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
2838 but mark earlier ones as non-canonical
2839 (offset_to_iterator): Update search target and example
2840 (do_addr2line): Return extra lines in a vector*
2841 (format_file_lineno): Extract from do_addr2line
2842 (one_addr2line): Add vector* out-param
2843 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
2844 when a lineno entry appeared last for its instruction
2845 (Dwarf_line_info): Add vector* out-param
2846 * object.cc (Relocate_info): Pass NULL for the vector* out-param
2847 * symtab.cc (Odr_violation_compare): Include the lineno in the
2849 (linenos_from_loc): New. Combine the canonical line for an
2850 address with its other lines.
2851 (True_if_intersect): New. Helper functor to make
2852 std::set_intersection a query.
2853 (detect_odr_violations): Compare sets of lines instead of just
2854 one line for each function. This became less deterministic, but
2855 has fewer false positives.
2856 * symtab.h: Declarations.
2857 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
2858 mix an optimized and non-optimized object in the same binary
2859 (odr_violation2.so): Same.
2860 * testsuite/Makefile.in: Regenerate from Makefile.am.
2861 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
2862 * testsuite/debug_msg.sh: Update line numbers and add
2864 * testsuite/odr_violation1.cc: Use OdrDerived, in a
2865 non-optimized context.
2866 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
2867 isn't inlined, and use OdrDerived in an optimized context.
2868 * testsuite/odr_header1.h: Defines OdrDerived, where
2869 optimization will change the
2870 first-instruction-in-the-destructor's file and line number.
2871 * testsuite/odr_header2.h: Defines OdrBase.
2873 2011-03-09 Ian Lance Taylor <iant@google.com>
2875 * fileread.cc (File_read::clear_views): Don't delete the whole
2878 2011-03-08 Ian Lance Taylor <iant@google.com>
2881 * fileread.cc: #include <climits>.
2882 (GOLD_IOV_MAX): Define.
2883 (File_read::read_multiple): Limit number of entries by iov_max.
2884 * fileread.h (class File_read): Always set max_readv_entries to
2887 2011-03-07 Ian Lance Taylor <iant@google.com>
2890 * options.h (class General_options): Add -dy and -dn.
2892 2011-03-02 Cary Coutant <ccoutant@google.com>
2894 * testsuite/script_test_9.t: Add TLS segment.
2896 2011-03-02 Simon Baldwin <simonb@google.com>
2898 * configure.ac: Add check for gnu_indirect_function support in
2899 the toolchain building binutils.
2900 * configure: Rebuild.
2902 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
2904 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
2905 plugin only symbols.
2906 (Symbol_table::sized_finalize_symbol) Mark symbol only present
2907 in plugin files as not needed in the symbol table.
2909 2011-02-11 Sriraman Tallam <tmsriram@google.com>
2911 * output.cc (Output_section::add_input_section): Delay fill
2912 generation for section ordering.
2914 2011-02-09 Ian Lance Taylor <iant@google.com>
2917 * object.h (class Sized_relobj): Remove clear_local_symbols.
2918 * reloc.cc (Sized_relobj::do_relocate): Don't call
2919 clear_local_symbols.
2921 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
2923 * plugin.cc (is_visible_from_outside): Return true for symbols
2926 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
2928 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
2931 2011-02-02 Sriraman Tallam <tmsriram@google.com>
2933 * icf.h (is_section_foldable_candidate): Change type of parameter
2935 * icf.cc (Icf::find_identical_sections): Change type of local variable
2936 section_name to be std::string.
2937 (is_function_ctor_or_dtor): Change type of parameter to std::string.
2939 2011-01-25 Ian Lance Taylor <iant@google.com>
2941 * script.cc (script_add_extern): Rewrite to use
2942 add_symbol_reference.
2944 2011-01-25 Doug Kwan <dougkwan@google.com>
2946 * icf.cc (get_section_contents): Always lock section's object.
2948 2011-01-24 Ian Lance Taylor <iant@google.com>
2950 * options.h (class General_options): Accept
2951 --no-detect-odr-violations.
2953 2011-01-24 Ian Lance Taylor <iant@google.com>
2955 * version.cc (version_string): Bump to 1.11.
2957 2011-01-24 Ian Lance Taylor <iant@google.com>
2959 * plugin.cc (class Plugin_rescan): Define new class.
2960 (Plugin_manager::claim_file): Set any_claimed_.
2961 (Plugin_manager::save_archive): New function.
2962 (Plugin_manager::save_input_group): New function.
2963 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
2965 (Plugin_manager::new_undefined_symbol): New function.
2966 (Plugin_manager::rescan): New function.
2967 (Plugin_manager::rescannable_defines): New function.
2968 (Plugin_manager::add_input_file): Set any_added_.
2969 * plugin.h (class Plugin_manager): define new fields rescannable_,
2970 undefined_symbols_, any_claimed_, and any_added_. Declare
2971 Plugin_rescan as friend. Declare new functions.
2972 (Plugin_manager::Rescannable): Define type.
2973 (Plugin_manager::Rescannable_list): Define type.
2974 (Plugin_manager::Undefined_symbol_list): Define type.
2975 (Plugin_manager::Plugin_manager): Initialize new fields.
2976 * archive.cc (Archive::defines_symbol): New function.
2977 (Add_archive_symbols::run): Pass archive to plugins if any.
2978 * archive.h (class Archive): Declare defines_symbol.
2979 * readsyms.cc (Input_group::~Input_group): New function.
2980 (Finish_group::run): Pass input_group to plugins if any.
2981 * readsyms.h (class Input_group): Declare destructor.
2982 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
2985 2011-01-10 Ian Lance Taylor <iant@google.com>
2987 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
2989 (Layout::set_segment_offsets): Reset increase_relro before calling
2990 set_section_addresses a second time.
2992 2011-01-04 Cary Coutant <ccoutant@google.com>
2994 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
2995 sections before NOBITS sections.
2997 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
2999 * version.cc (print_version): Update copyright to 2011.
3001 2010-12-23 Cary Coutant <ccoutant@google.com>
3003 * output.h (Output_data_reloc::add_output_section): Pass OD instead
3004 of OS to this->add. Add OD parameter to second form of the function.
3006 2010-12-20 Ian Lance Taylor <iant@google.com>
3008 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
3009 second of two consecutive entries with same offset.
3011 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3013 * testsuite/Makefile.am (ifuncmain2static_LDADD)
3014 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
3015 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
3016 to avoid unneeded links against $(LDADD).
3017 * testsuite/Makefile.in: Regenerate.
3019 2010-12-15 Ian Lance Taylor <iant@google.com>
3022 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
3023 for R_X86_64_32 and R_X86_64_PC32.
3024 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
3025 ver_matching_def_pic.o.
3026 (ver_matching_def_pic.o): New target.
3028 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3030 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
3031 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
3032 Move definition before File_read::View member definitions.
3033 (File_read::View::~View): Initialize and hold lock before
3034 updating current_mapped_bytes.
3036 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3038 * dwarf_reader.cc: Remove outdated comment.
3039 * gold-threads.cc: Fix typo in error message.
3040 * archive.cc: Fix typos in comments.
3041 * archive.h: Likewise.
3042 * arm-reloc-property.cc: Likewise.
3043 * arm-reloc-property.h: Likewise.
3044 * arm-reloc.def: Likewise.
3046 * attributes.h: Likewise.
3047 * cref.cc: Likewise.
3048 * ehframe.cc: Likewise.
3049 * fileread.h: Likewise.
3051 * i386.cc: Likewise.
3053 * incremental.h: Likewise.
3054 * int_encoding.cc: Likewise.
3055 * layout.h: Likewise.
3056 * main.cc: Likewise.
3057 * merge.h: Likewise.
3058 * object.cc: Likewise.
3059 * object.h: Likewise.
3060 * options.cc: Likewise.
3061 * readsyms.cc: Likewise.
3062 * reduced_debug_output.cc: Likewise.
3063 * reloc.cc: Likewise.
3064 * script-sections.cc: Likewise.
3065 * sparc.cc: Likewise.
3066 * symtab.h: Likewise.
3067 * target-reloc.h: Likewise.
3068 * target.cc: Likewise.
3069 * target.h: Likewise.
3070 * timer.cc: Likewise.
3071 * timer.h: Likewise.
3072 * x86_64.cc: Likewise.
3074 2010-12-09 Cary Coutant <ccoutant@google.com>
3076 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
3078 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
3079 parameter; change all callers.
3080 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
3081 * options.h (warn_execstack): New option.
3083 2010-12-07 Doug Kwan <dougkwan@google.com>
3085 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
3086 like function call relocations.
3088 2010-12-07 Ian Lance Taylor <iant@google.com>
3090 * archive.cc (Archive::get_elf_object_for_member): Permit
3091 punconfigured to be NULL.
3092 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
3093 (Archive::include_member): Pass NULL to get_elf_object_for_member
3094 if we searched for the archive and this is the first included
3097 2010-12-01 Ian Lance Taylor <iant@google.com>
3099 * dwarf_reader.h (class Sized_dwarf_line_info): Add
3100 track_relocs_type_ field.
3101 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3102 Set track_relocs_type_.
3103 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
3104 contents when using RELA relocs.
3105 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
3107 * reloc.cc (Track_relocs::next_addend): New function.
3108 * reloc.h (class Track_relocs): Declare next_addend.
3110 2010-12-01 Ian Lance Taylor <iant@google.com>
3112 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
3115 2010-12-01 Ian Lance Taylor <iant@google.com>
3117 * README: Update compilers known to work and fail.
3119 2010-11-23 Matthias Klose <doko@ubuntu.com>
3121 * configure.in: For --enable-gold, handle value `default' instead of
3122 `both*'. Always install ld as ld.bfd, install as ld if gold is
3124 * configure: Regenerate.
3126 2010-11-18 Doug Kwan <dougkwan@google.com>
3128 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
3129 and right_alignment to be zero. Store result alignment only if it is
3130 greater than existing alignment.
3132 2010-11-16 Cary Coutant <ccoutant@google.com>
3135 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3136 Check for ".zdebug_line".
3138 2010-11-16 Doug Kwan <dougkwan@google.com>
3139 Cary Coutant <ccoutant@google.com>
3141 * output.h (Output_segment::set_section_addresses): Pass increase_relro
3142 by reference; adjust all callers.
3143 * output.cc (Output_segment::set_section_addresses): Adjust references
3144 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
3146 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
3147 end at page boundary.
3149 2010-11-16 Cary Coutant <ccoutant@google.com>
3152 * layout.cc (Layout::choose_output_section): Transform names of
3153 compressed sections even when using a script with a SECTIONS clause.
3154 (Layout::output_section_name): Remove code to transform
3155 compressed debug section names.
3156 * output.cc (Output_section::add_input_section): Use uncompressed
3157 section size when tracking input sections.
3159 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
3161 * symtab.h (Symbol::NON_PIC_REF): Remove.
3162 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
3163 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
3164 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
3165 (Symbol::use_plt_offset): Take a flags argument and pass it
3166 directly to needs_dynamic_reloc. Restrict check for undefined
3167 weak symbols to function calls.
3168 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
3169 (Target_arm::Scan::global): Use it.
3170 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
3171 (Target_arm::Relocate::relocate): Likewise.
3172 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
3173 parameter with an r_type parameter. Use get_reference_flags
3175 (Target_arm::Relocate::relocate): Update accordingly.
3176 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
3177 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
3178 (Target_i386::Scan::global): Likewise.
3179 (Target_i386::Relocate::relocate): Likewise.
3180 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
3181 parameter with an r_type parameter. Use get_reference_flags
3183 (Target_i386::Relocate::relocate): Update accordingly.
3184 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
3185 (Target_powerpc::Scan::global): Use it.
3186 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
3187 (Target_powerpc::Relocate::relocate): Likewise.
3188 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
3189 (Target_sparc::Scan::global): Use it.
3190 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
3191 (Target_sparc::Relocate::relocate): Likewise.
3192 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
3193 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
3194 (Target_x86_64::Scan::global): Likewise.
3195 (Target_x86_64::Relocate::relocate): Likewise.
3197 2010-11-08 Doug Kwan <dougkwan@google.com>
3198 Cary Coutant <ccoutant@google.com>
3200 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
3201 (Arm_exidx_merge_section::section_contents_): New data member.
3202 (Arm_input_section::Arm_input_section): Initialize original_contents_.
3203 (Arm_input_section::~Arm_input_section): De-allocate memory.
3204 (Arm_input_section::original_contents_): New data member.
3205 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
3206 in parameters instead of calling Object::section_contents without
3208 (Arm_output_section::group_section): New parameter TASK. Pass it
3209 to callees that need locking objects.
3210 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
3211 to lock EXIDX input sections. Fix a formatting issue. Call
3212 Arm_exidx_merged_section::build_contents to create merged section
3214 (Arm_output_section::create_stub_group): New parameter TASK. Use it
3215 to lock object of stub table owner.
3216 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
3217 TEXT_SIZE to initialize data member TEXT_SIZE_.
3218 (Arm_exidx_input_section::addralign): Fix typo in comment.
3219 (Arm_exidx_input_section::text_size): New method.
3220 (Target_arm::do_relax): New parameter TASK. Pass it to callees
3221 that require locking objects. Lock objects before scanning for stubs
3222 and updating local symbols.
3223 (Arm_input_section<big_endian>::init): Copy contents of original
3225 (Arm_input_section<big_endian>::do_write): Use saved contents of
3226 original input section instead of calling Object::section_contents
3228 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
3229 size without calling Object::section_size().
3230 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
3231 for size. Allocate a buffer for merged EXIDX entries.
3232 (Arm_exidx_merged_section::build_contents): New method.
3233 (Arm_exidx_merged_section::do_write): Move merge section contents
3234 building code to Arm_exidx_merged_section::build_contetns. Write
3235 out contetns in buffer instead of building it on the fly.
3236 (Arm_relobj::make_exidx_input_section): Also pass text section size
3237 to Arm_exidx_input_section constructor.
3238 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
3239 (Arm_dynobj::do_read_symbols): Fix memory leak.
3240 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
3241 * target.h: (class Task): Add forward declaration.
3242 (Target::relax): Add new parameter TASK and pass it to
3244 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
3246 2010-11-05 Cary Coutant <ccoutant@google.com>
3249 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
3250 object when reading from the file.
3251 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
3253 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
3254 when reading section contents.
3255 (get_section_contents): Likewise.
3256 (icf::find_identical_sections): Likewise.
3257 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
3258 object when reading from the file.
3259 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
3260 the object when doing deferred section layout.
3262 2010-11-03 Nick Clifton <nickc@redhat.com>
3265 * script.h (class Symbol_assignment: name): New member. Returns
3266 the name of the symbol.
3267 * scrfipt.cc (Script_options::is_pending_assignment): New member.
3268 Returns true if the given symbol name is on the list of
3269 assignments wating to be processed.
3270 * archive.cc (should_incldue_member): If the symbol is undefined,
3271 check to see if it is on the list of symbols pending assignment.
3273 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
3275 * script-sections.cc (Script_sections::find_memory_region): Check
3276 for a NULL output section pointer.
3278 2010-10-29 Doug Kwan <dougkwan@google.com>
3280 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3281 Output_section::add_relaxed_input_section.
3282 * output.cc (Output_section::add_relaxed_input_section): Add new
3283 arguments LAYOUT and NAME. Set section order index.
3284 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3285 Copy section order index.
3286 * output.h (Output_section::add_relaxed_input_section): Add new
3287 arguments LAYOUT and NAME.
3289 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3291 * testsuite/Makefile.am: Move gcctestdir/ld rule to
3292 NATIVE_OR_CROSS_LINKER.
3293 * testsuite/Makefile.in: Regenerate.
3295 2010-10-20 Doug Kwan <dougkwan@google.com>
3297 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
3298 without SHF_LINK_ORDER flags.
3299 * layout.cc (Layout::choose_output_section): Do not filter
3300 SHF_LINK_ORDER flag in a relocatable link.
3302 2010-10-17 Cary Coutant <ccoutant@google.com>
3304 * output.h (Output_segment::set_section_addresses): Change function
3305 signature. Update all callers.
3306 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
3308 (Output_segment::set_section_addresses): Align after last TLS
3309 section. Add padding before last relro section instead of after.
3311 2010-10-17 Doug Kwan <dougkwan@google.com>
3313 * gold/arm.cc (Target_arm::got_section): Use correct order and set
3314 GOT output section to be writable.
3316 2010-10-14 Cary Coutant <ccoutant@google.com>
3318 * debug.h (DEBUG_INCREMENTAL): New flag.
3319 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3320 * gold.cc (queue_initial_tasks): Check parameters for incremental link
3322 * incremental.cc (report_command_line): Ignore all forms of
3324 * layout.cc (Layout::Layout): Check parameters for incremental link
3326 * options.cc (General_options::parse_incremental): New function.
3327 (General_options::parse_no_incremental): New function.
3328 (General_options::parse_incremental_full): New function.
3329 (General_options::parse_incremental_update): New function.
3330 (General_options::incremental_mode_): New data member.
3331 (General_options::finalize): Check incremental_mode_.
3332 * options.h (General_options): Update help text for --incremental.
3333 Add --no-incremental, --incremental-full, --incremental-update.
3334 (General_options::Incremental_mode): New enum type.
3335 (General_options::incremental_mode): New function.
3336 (General_options::incremental_mode_): New data member.
3337 * parameters.cc (Parameters::incremental_mode_): New data member.
3338 (Parameters::set_options): Set incremental_mode_.
3339 (Parameters::set_incremental_full): New function.
3340 (Parameters::incremental): New function.
3341 (Parameters::incremental_update): New function.
3342 (set_parameters_incremental_full): New function.
3343 * parameters.h (Parameters::set_incremental_full): New function.
3344 (Parameters::incremental): New function.
3345 (Parameters::incremental_update): New function.
3346 (Parameters::incremental_mode_): New data member.
3347 (set_parameters_incremental_full): New function.
3348 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
3349 incremental link mode.
3350 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
3351 (Sized_relobj::do_relocate_sections): Likewise.
3352 * testsuite/Makefile.am (incremental_test): Use --incremental-full
3354 * testsuite/Makefile.in: Regenerate.
3355 * testsuite/incremental_test.sh: Filter all forms of --incremental.
3357 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3359 * script-sections.h (class Script_sections): Make
3360 Sections_elements typedef public.
3361 * script-sections.cc (class Sort_output_sections): Add elements_
3362 field. Add constructor which sets it; change all callers.
3363 (Sort_output_sections::is_before): New function.
3364 (Sort_output_sections::operator()): Call is_before.
3365 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
3367 * testsuite/script_test_10.sh: New test. Test script section
3369 * testsuite/script_test_10.t: Likewise.
3370 * testsuite/script_test_10.s: Likewise.
3371 * testsuite/Makefile.am: Wrap the cross linker tests and the
3372 common tests into NATIVE_OR_CROSS_LINKER.
3373 (check_SCRIPTS): Add script_test_10.sh.
3374 (check_DATA): Add script_test_10.stdout.
3375 (script_test_10.o, script_test_10): New targets.
3376 (script_test_10.stdout): New target.
3377 * configure, testsuite/Makefile.in: Regenerate.
3379 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3381 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
3382 error for the deprecated relocations.
3383 (Target_arm::Scan::global): Likewise.
3384 (Target_arm::Relocate::relocate): Likewise.
3386 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
3388 * fileread.cc (Input_file::find_file): Initialize *found_name
3389 and *namep when using the fallback search for case 4.
3391 2010-10-11 Cary Coutant <ccoutant@google.com>
3393 * options.h (class General_options): Redefine -z lazy as an alias for
3394 the negation of -z now.
3396 2010-10-11 Ian Lance Taylor <iant@google.com>
3398 * resolve.cc (symbol_to_bits): Report the value of the unsupported
3401 2010-10-06 Nick Clifton <nickc@redhat.com>
3403 * script-sections.cc(class Memory_region): Remove
3404 current_lma_offset_ field. Rename current_vma_offset_ to
3405 current_offset_. Add last_section_ field.
3406 (Memory_region::get_current_vma_address): Rename to
3407 get_current_address.
3408 (Memory_region::get_current_lma_address): Delete.
3409 (Memory_region::increment_vma_offset): Rename to
3411 (Memory_region::increment_lma_offset): Delete.
3412 (Memory_region::attributes_compatible): New method. Returns
3413 true if the provided section is compatible with the region.
3414 (Memory_region::get_last_section): New method. Returns the last
3415 section to use the region.
3416 (Memory_region::set_last_section): New method. Stores the last
3417 section to use the region.
3418 (Script_sections::block_in_region): New method. Returns true if
3419 a block of memory is contained within a region.
3420 (Script_sections::find_memory_region): New method. Locates a
3421 memory region to be used to set a VMA or LMA address.
3422 (Output_section_definition::set_section_addresses): Add code to
3423 check for addresses set by memory regions.
3424 (Output_segment::set_section_addresses): Remove memory region
3426 (Script_sections::create_segment): Add a warning if a header
3427 segment is created outside of any region.
3428 * script-sections.h (class Script_sections): Add prototypes for
3429 find_memory_region and block_in_region methods.
3430 * testsuite/memory_test.s: Use .long instead of .word.
3431 * testsuite/memory_test.t: Add some more output sections.
3432 * testsuite/memory_test.sh: Update expected output.
3434 2010-10-02 Doug Kwan <dougkwan@google.com>
3436 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
3437 defintion to symtab.h
3438 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
3439 declaration to defintion.
3441 2010-10-01 Nick Clifton <nickc@redhat.com>
3443 * expression.cc (eval): Replace dummy argument with NULL.
3444 (eval_maybe_dot): Check for a NULL result section pointer.
3445 (Symbol_expression::value): Likewise.
3446 (Dot_expression::value): Likewise.
3447 (BINARY_EXPRESSION): Likewise.
3448 (Max_expression::value): Likewise.
3449 (Min_expression::value): Likewise.
3450 (Absolute_expression::value): Likewise.
3451 (Addr_expression::value_from_output_section): Likewise.
3452 (Loaddddr_expression::value_from_output_section): Likewise.
3453 (Segment_start_expression::value): Likewise.
3454 * script-sections.cc
3455 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
3457 (Sections_elememt_dot_assignment::set_section_addresses):
3459 (Output_data_expression::do_write_to_buffer): Likewise.
3460 (Output_section_definition::finalize_symbols): Likewise.
3461 (Output_section_definition::set_section_addresses): Likewise.
3463 2010-09-30 Doug Kwan <dougkwan@google.com>
3465 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
3467 2010-09-28 Sriraman Tallam <tmsriram@google.com>
3469 * target.h (Target::can_icf_inline_merge_sections): New virtual
3471 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
3473 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
3475 * icf.cc (get_section_contents): Inline merge sections only when
3478 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3480 * configure: Regenerate.
3482 2010-09-17 Ian Lance Taylor <iant@google.com>
3484 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
3485 * testsuite/Makefile.am (memory_test.o): New target.
3486 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
3488 * testsuite/Makefile.in: Rebuild.
3490 2010-09-17 Doug Kwan <dougkwan@google.com>
3492 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
3493 defintion if relocation uses GOT entries of the symbol.
3494 * testsuite/icf_safe_test.sh: Fix test.
3495 * testsuite/icf_safe_so_test.sh: Fix test.
3497 2010-09-16 Cary Coutant <ccoutant@google.com>
3499 * script_sections.cc (class Memory_region): Remove "NULL" from
3500 vector initializations.
3502 2010-09-15 Cary Coutant <ccoutant@google.com>
3504 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
3505 Resolve forwarding symbols.
3507 2010-09-15 Doug Kwan <dougkwan@google.com>
3509 * gold/testsuite/script_test_3.t: Add ARM special sections.
3510 * gold/testsuite/script_test_4.t: Same.
3511 * gold/testsuite/script_test_5.t: Same.
3512 * gold/testsuite/script_test_6.t: Same.
3513 * gold/testsuite/script_test_7.t: Same.
3514 * gold/testsuite/script_test_7.t: Same.
3515 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
3517 2010-09-14 Cary Coutant <ccoutant@google.com>
3519 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
3520 (Target_x86_64::Relocate::relocate_tls): Replace check for
3521 saw_tls_block_reloc_ with test for executable section.
3523 2010-09-12 Cary Coutant <ccoutant@google.com>
3525 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
3526 position-independent executables to shared libraries need dynamic
3528 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
3529 position-independent executables.
3530 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
3531 * testsuite/Makefile.in: Regenerate.
3533 2010-09-10 Nick Clifton <nickc@redhat.com>
3536 * testsuite/memory_test.t: Discard any sections that are not
3539 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
3542 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
3543 "This::" to work around a bug in gcc 4.2.
3545 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
3547 2010-09-09 Rafael Espindola <espindola@google.com>
3549 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
3550 sections with different PF_X flags in the same segment.
3551 (Layout::find_first_load_seg): Search all segments to find the first
3553 * options.h (rosegment): New.
3555 2010-09-08 Rafael Espindola <espindola@google.com>
3557 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
3559 2010-09-08 Doug Kwan <dougkwan@google.com>
3561 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
3562 (Arm_relobj::do_relocate_sections): Add new parameter for output
3563 file to match the parent.
3564 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
3565 of local symbols instead of input values. Update code to track
3566 changes in gold::relocate_section.
3567 * object.cc (Sized_relobj::compute_final_local_value): New methods.
3568 (Sized_relobj::compute_final_local_value_internal): New methods.
3569 (Sized_relobj::do_finalize_local_symbols): Move code from loop
3570 body into private version of Sized_relobj::compute_final_local_value.
3571 Call the inline method.
3572 * object.h (Symbol_value::Symbol_value): Define destructor. Free
3573 merged symbol value if there is one.
3574 (Symbol_value::has_output_value): New method defintiion.
3575 (Sized_relobj::Compute_final_local_value_status): New enum type.
3576 (Sized_relobj::compute_final_local_value): New methods.
3577 (Sized_relobj::compute_final_local_value_internal): New methods.
3578 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
3579 and arm_cortex_a8.sh.
3580 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
3581 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
3583 * Makefile.in: Regenerate.
3584 * testsuite/arm_bl_out_of_range.s: Update test.
3585 * testsuite/thumb_bl_out_of_range.s: Ditto.
3586 * testsuite/thumb_blx_out_of_range.s: Ditto.
3587 * testsuite/arm_branch_out_of_range.sh: New file.
3588 * testsuite/arm_cortex_a8.sh: Ditto.
3589 * testsuite/arm_cortex_a8_b.s: Ditto.
3590 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
3591 * testsuite/arm_cortex_a8_b_local.s: Ditto.
3592 * testsuite/arm_cortex_a8_bl.s: Ditto.
3593 * testsuite/arm_cortex_a8_blx.s: Ditto.
3594 * testsuite/arm_cortex_a8_local.s: Ditto.
3595 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
3596 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
3598 2010-09-08 Rafael Espindola <espindola@google.com>
3600 * Makefile.am (memory_test.stdout): Run readelf with -W.
3601 * Makefile.in: Regenerate.
3602 * testsuite/memory_test.sh: Make the regexps accept both 32 and
3605 2010-09-08 Rafael Espindola <espindola@google.com>
3607 * script-sections.cc (Script_sections::add_memory_region): Convert
3608 field precision to int.
3609 * script.cc (script_set_section_region, script_set_section_region):
3610 Convert field precision to int.
3612 2010-09-08 Rafael Espindola <espindola@google.com>
3614 * arm.cc (do_finalize_sections): Create the __exidx_start and
3615 __exdix_end symbols even when the section is missing.
3617 2010-09-08 Nick Clifton <nickc@redhat.com>
3619 * README: Remove claim that MEMORY is not supported.
3620 * expression.cc (script_exp_function_origin)
3621 (script_exp_function_length): Move from here to ...
3622 * script.cc: ... here.
3623 (script_set_section_region, script_add_memory)
3624 (script_parse_memory_attr, script_include_directive): New
3626 * script-sections.cc
3627 (class Memory_region): New class.
3628 (class Output_section_definition): Add set_memory_region,
3629 set_section_vma, set_section_lma and get_section_name methods.
3630 (class Script_Sections): Add add_memory_region,
3631 find_memory_region, find_memory_region_origin,
3632 find_memory_region_length and set_memory_region methods.
3633 Have set_section_addresses method walk the list of set memory
3635 Extend the print methos to display memory regions.
3636 * script-sections.h: Add prototypes for new methods.
3637 Add enum for MEMORY region attributes.
3638 * yyscript.y: Add support for parsing MEMORY regions.
3639 * script-c.h: Add prototypes for new functions.
3640 * testsuite/Makefile.am: Add test of MEMORY region functionality.
3641 * testsuite/Makefile.in: Regenerate.
3642 * testsuite/memory_test.sh: New script.
3643 * testsuite/memory_test.s: New assembler source file.
3644 * testsuite/memory_test.t: New linker script.
3646 2010-08-27 Doug Kwan <dougkwan@google.com>
3648 * gold/resolve.cc (Symbol_table::should_override): Let a weak
3649 reference override an existing dynamic weak reference.
3650 * testsuite/Makefile.am: Add new test dyn_weak_ref.
3651 * testsuite/Makefile.in: Regenerate.
3652 * testsuite/dyn_weak_ref.sh: New file.
3653 * testsuite/dyn_weak_ref_1.c: Ditto.
3654 * testsuite/dyn_weak_ref_2.c: Ditto.
3656 2010-08-27 Ian Lance Taylor <iant@google.com>
3658 * incremental.h (class Incremental_input_entry): Add virtual
3661 2010-08-27 Ian Lance Taylor <iant@google.com>
3663 * testsuite/start_lib_test_3.c: Mark t3 as used.
3665 2010-08-27 Nick Clifton <nickc@redhat.com>
3667 * options.cc (version_script): Fix small typo in previous
3670 2010-08-25 Nick Clifton <nickc@redhat.com>
3672 * archive.cc: Formatting fixes: Remove whitespace between
3673 typename and following asterisk. Remove whitespace between
3674 function name and opening parenthesis.
3675 * archive.h: Likewise.
3677 * attributes.cc: Likewise.
3678 * attributes.h: Likewise.
3679 * common.cc: Likewise.
3680 * copy-relocs.cc: Likewise.
3681 * dirsearch.h: Likewise.
3682 * dynobj.cc: Likewise.
3683 * ehframe.cc: Likewise.
3684 * ehframe.h: Likewise.
3685 * expression.cc: Likewise.
3686 * fileread.cc: Likewise.
3687 * fileread.h: Likewise.
3689 * gold-threads.cc: Likewise.
3690 * gold.cc: Likewise.
3691 * i386.cc: Likewise.
3693 * incremental-dump.cc: Likewise.
3694 * incremental.cc: Likewise.
3695 * layout.cc: Likewise.
3696 * layout.h: Likewise.
3697 * main.cc: Likewise.
3698 * merge.cc: Likewise.
3699 * merge.h: Likewise.
3700 * object.cc: Likewise.
3701 * object.h: Likewise.
3702 * options.cc: Likewise.
3703 * options.h: Likewise.
3704 * output.cc: Likewise.
3705 * output.h: Likewise.
3706 * plugin.cc: Likewise.
3707 * plugin.h: Likewise.
3708 * powerpc.cc: Likewise.
3709 * reloc.cc: Likewise.
3710 * script-c.h: Likewise.
3711 * script-sections.cc: Likewise.
3712 * script.cc: Likewise.
3713 * stringpool.cc: Likewise.
3714 * symtab.cc: Likewise.
3715 * symtab.h: Likewise.
3716 * target.cc: Likewise.
3717 * timer.cc: Likewise.
3718 * timer.h: Likewise.
3719 * version.cc: Likewise.
3720 * x86_64.cc: Likewise.
3722 2010-08-24 Nick Clifton <nickc@redhat.com>
3725 * layout.cc (segment_precedes): Sort segments by their physical
3726 addresses, if they have been set.
3728 2010-08-23 Cary Coutant <ccoutant@google.com>
3730 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
3732 (Lib_group::include_member): Unlock object after deleting its
3734 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
3737 2010-08-19 Neil Vachharajani <nvachhar@google.com>
3738 Cary Coutant <ccoutant@google.com>
3740 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
3741 constructor, and set_blocker.
3742 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
3744 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
3745 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
3746 * testsuite/Makefile.am (start_lib_test): New test case.
3747 * testsuite/Makefile.in: Regenerate.
3748 * testsuite/start_lib_test_main.c: New file.
3749 * testsuite/start_lib_test_1.c: New file.
3750 * testsuite/start_lib_test_2.c: New file.
3751 * testsuite/start_lib_test_3.c: New file.
3753 2010-08-19 Ian Lance Taylor <iant@google.com>
3755 * Makefile.in: Rebuild with automake 1.11.1.
3756 * aclocal.m4: Likewise.
3757 * testsuite/Makefile.in: Likewise.
3759 2010-08-19 Ian Lance Taylor <iant@google.com>
3762 * i386.cc (class Output_data_plt_i386): Update declarations.
3763 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
3764 local_ifuncs_ fields.
3765 (Target_i386::do_plt_section_for_global): New function.
3766 (Target_i386::do_plt_section_for_local): New function.
3767 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
3768 parameter; change all callers. Initialize global_ifuncs_ and
3769 local_ifuncs_. If doing a static link define __rel_iplt_start and
3771 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
3772 (Output_data_plt_i386::add_local_ifunc_entry): New function.
3773 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
3775 (Target_i386::make_plt_section): New function, broken out of
3776 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
3777 (Target_i386::make_plt_entry): Call make_plt_section.
3778 (Target_i386::make_local_ifunc_plt_entry): New function.
3779 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
3780 (Target_i386::Scan::local): Handle IFUNC symbols. Add
3781 R_386_IRELATIVE to switch.
3782 (Target_i386::Scan::global): Likewise.
3783 (Target_i386::Relocate::relocate): Likewise.
3784 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
3786 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
3787 (Target_x86_64::do_plt_section_for_global): New function.
3788 (Target_x86_64::do_plt_section_for_local): New function.
3789 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
3790 parameter; change all callers. If doing a static link define
3791 __rela_iplt_start and __rela_iplt_end.
3792 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
3793 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
3794 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
3796 (Target_x86_64::make_local_ifunc_plt_entry): New function.
3797 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
3799 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
3800 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
3801 R_X86_64_IRELATIVE to switch.
3802 (Target_x86_64::Scan::global): Likewise.
3803 (Target_x86_64::Relocate::relocate): Likewise.
3804 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
3806 * target.h (class Target): Add plt_section_for_global and
3807 plt_section_for_local functions. Add do_plt_section_for_global
3808 and do_plt_section_for_local virtual functions.
3809 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
3810 clarifying comments.
3811 (Symbol::use_plt_offset): Handle IFUNC symbol.
3812 * object.cc (Sized_relobj::Sized_relobj): Initialize
3814 (Sized_relobj::local_has_plt_offset): New function.
3815 (Sized_relobj::local_plt_offset): New function.
3816 (Sized_relobj::set_local_plt_offset): New function.
3817 (Sized_relobj::do_count): Handle IFUNC symbol.
3818 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
3819 a bit away from input_shndx_ field. Add set_is_func_symbol and
3820 is_ifunc_symbol functions.
3821 (class Sized_relobj): Update declarations. Remove Tls_got_entry
3822 and Local_tls_got_offsets. Define Local_plt_offsets. Add
3823 local_plt_offsets_ field.
3824 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
3825 * output.h (class Output_section_data): Add non-const
3826 output_section function.
3827 (class Output_data_got): Update declarations.
3828 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
3829 Add use_plt_offset parameter to global and local constructors.
3830 Change all callers. Change local_sym_index_ field to 31 bits.
3831 Change GSYM_CODE and CONSTANT_CODE accordingly.
3832 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
3833 doing a static link don't set sh_link field.
3834 (Output_data_got::Got_entry::write): Use PLT offset if
3836 (Output_data_got::add_global_plt): New function.
3837 (Output_data_got::add_local_plt): New function.
3838 * target-reloc.h (relocate_section): Handle IFUNC symbol.
3839 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
3840 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
3841 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
3842 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
3844 * testsuite/ifunc-sel.h: New file.
3845 * testsuite/ifuncmain1.c: New file.
3846 * testsuite/ifuncmain1vis.c: New file.
3847 * testsuite/ifuncmod1.c: New file.
3848 * testsuite/ifuncdep2.c: New file.
3849 * testsuite/ifuncmain2.c: New file.
3850 * testsuite/ifuncmain3.c: New file.
3851 * testsuite/ifuncmod3.c: New file.
3852 * testsuite/ifuncmain4.c: New file.
3853 * testsuite/ifuncmain5.c: New file.
3854 * testsuite/ifuncmod5.c: New file.
3855 * testsuite/ifuncmain6pie.c: New file.
3856 * testsuite/ifuncmod6.c: New file.
3857 * testsuite/ifuncmain7.c: New file.
3858 * configure, testsuite/Makefile.in: Rebuild.
3860 2010-08-18 Ian Lance Taylor <iant@google.com>
3863 (Output_section_incremental_inputs::write_input_files): Add cast
3864 to avoid signed/unsigned comparison warning.
3865 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3867 2010-08-12 Cary Coutant <ccoutant@google.com>
3869 * common.cc (Sort_commons::operator()): Remove unnecessary code.
3871 2010-08-13 Ian Lance Taylor <iant@google.com>
3873 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
3875 2010-08-12 Cary Coutant <ccoutant@google.com>
3876 Doug Kwan <dougkwan@google.com>
3878 * resolve.cc (Symbol_table::should_override): When a weak dynamic
3879 defintion overrides non-weak undef, remember that the original undef
3881 * symtab.cc (Symbol_table::sized_write_global): For undef without
3882 an original weak binding, set binding to global in output.
3883 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
3884 * testsuite/Makefile.in: Regenerate.
3885 * testsuite/strong_ref_weak_def.sh: New file.
3886 * testsuite/strong_ref_weak_def_1.c: Ditto.
3887 * testsuite/strong_ref_weak_def_2.c: Ditto.
3889 2010-08-12 Cary Coutant <ccoutant@google.com>
3891 * testsuite/incremental_test.sh: Rewrite.
3892 * testsuite/incremental_test_1.c: Rewrite.
3893 * testsuite/incremental_test_2.c: Rewrite.
3895 2010-08-12 Cary Coutant <ccoutant@google.com>
3897 * arm.cc (Target_arm::got_size): Add const.
3898 (Target_arm::got_entry_count): New function.
3899 (Target_arm::plt_entry_count): New function.
3900 (Target_arm::first_plt_entry_offset): New function.
3901 (Target_arm::plt_entry_size): New function.
3902 (Output_data_plt_arm::entry_count): New function.
3903 (Output_data_plt_arm::first_plt_entry_offset): New function.
3904 (Output_data_plt_arm::get_plt_entry_size): New function.
3905 * i386.cc (Target_i386::got_size): Add const.
3906 (Target_i386::got_entry_count): New function.
3907 (Target_i386::plt_entry_count): New function.
3908 (Target_i386::first_plt_entry_offset): New function.
3909 (Target_i386::plt_entry_size): New function.
3910 (Output_data_plt_i386::entry_count): New function.
3911 (Output_data_plt_i386::first_plt_entry_offset): New function.
3912 (Output_data_plt_i386::get_plt_entry_size): New function.
3913 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
3914 find_incremental_inputs_sections. Dump incremental_got_plt section.
3915 * incremental.cc: Include target.h.
3916 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
3917 parameter. Adjust all callers. Find incremental_got_plt section.
3918 (Incremental_inputs::create_data_sections): Create incremental_got_plt
3920 (Output_section_incremental_inputs::set_final_data_size): Calculate
3921 size of incremental_got_plt section.
3922 (Output_section_incremental_inputs::do_write): Write the
3923 incremental_got_plt section.
3924 (Got_plt_view_info): New struct.
3925 (Local_got_offset_visitor): New class.
3926 (Global_got_offset_visitor): New class.
3927 (Global_symbol_visitor_got_plt): New class.
3928 (Output_section_incremental_inputs::write_got_plt): New function.
3929 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
3930 Add parameter. Adjust all callers.
3931 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3932 (Incremental_inputs::got_plt_section): New function.
3933 (Incremental_inputs::got_plt_section_): New data member.
3934 (Incremental_got_plt_reader): New class.
3935 * layout.cc (Layout::create_incremental_info_sections): Add the
3936 incremental_got_plt section.
3937 * object.h (Got_offset_list::get_list): New function.
3938 (Got offset_list::for_all_got_offsets): New function.
3939 (Sized_relobj::local_got_offset_list): New function.
3940 * powerpc.cc (Target_powerpc::got_size): Add const.
3941 (Target_powerpc::got_entry_count): New function.
3942 (Target_powerpc::plt_entry_count): New function.
3943 (Target_powerpc::first_plt_entry_offset): New function.
3944 (Target_powerpc::plt_entry_size): New function.
3945 (Output_data_plt_powerpc::entry_count): New function.
3946 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
3947 (Output_data_plt_powerpc::get_plt_entry_size): New function.
3948 * sparc.cc (Target_sparc::got_size): Add const.
3949 (Target_sparc::got_entry_count): New function.
3950 (Target_sparc::plt_entry_count): New function.
3951 (Target_sparc::first_plt_entry_offset): New function.
3952 (Target_sparc::plt_entry_size): New function.
3953 (Output_data_plt_sparc::entry_count): New function.
3954 (Output_data_plt_sparc::first_plt_entry_offset): New function.
3955 (Output_data_plt_sparc::get_plt_entry_size): New function.
3956 * symtab.h (Symbol::got_offset_list): New function.
3957 (Symbol_table::for_all_symbols): New function.
3958 * target.h (Sized_target::got_entry_count): New function.
3959 (Sized_target::plt_entry_count): New function.
3960 (Sized_target::plt_entry_size): New function.
3961 * x86_64.cc (Target_x86_64::got_size): Add const.
3962 (Target_x86_64::got_entry_count): New function.
3963 (Target_x86_64::plt_entry_count): New function.
3964 (Target_x86_64::first_plt_entry_offset): New function.
3965 (Target_x86_64::plt_entry_size): New function.
3966 (Output_data_plt_x86_64::entry_count): New function.
3967 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
3968 (Output_data_plt_x86_64::get_plt_entry_size): New function.
3970 2010-08-12 Cary Coutant <ccoutant@google.com>
3972 * archive.cc: Include incremental.h.
3973 (Archive::Archive): Initialize incremental_info_.
3974 (Archive::include_member): Record archive members in incremental info.
3975 (Add_archive_symbols::run): Record begin and end of an archive in
3977 (Lib_group::include_member): Record objects in incremental info.
3978 * archive.h (Incremental_archive_entry): Forward declaration.
3979 (Archive::set_incremental_info): New member function.
3980 (Archive::incremental_info): New member function.
3981 (Archive::Unused_symbol_iterator): New class.
3982 (Archive::unused_symbols_begin): New member function.
3983 (Archive::unused_symbols_end): New member function.
3984 (Archive::incremental_info_): New data member.
3985 * incremental-dump.cc (find_input_containing_global): New function.
3986 (dump_incremental_inputs): Dump new incremental info sections.
3987 * incremental.cc: Include symtab.h.
3988 (Output_section_incremental_inputs): New class.
3989 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
3990 new incremental info sections.
3991 (Sized_incremental_binary::do_check_inputs): Likewise.
3992 (Incremental_inputs::report_archive): Remove.
3993 (Incremental_inputs::report_archive_begin): New function.
3994 (Incremental_inputs::report_archive_end): New function.
3995 (Incremental_inputs::report_object): New function.
3996 (Incremental_inputs::finalize_inputs): Remove.
3997 (Incremental_inputs::report_input_section): New function.
3998 (Incremental_inputs::report_script): Rewrite.
3999 (Incremental_inputs::finalize): Do nothing but finalize string table.
4000 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4001 (Incremental_inputs::sized_create_inputs_section_data): Remove.
4002 (Incremental_inputs::create_data_sections): New function.
4003 (Incremental_inputs::relocs_entsize): New function.
4004 (Output_section_incremental_inputs::set_final_data_size): New function.
4005 (Output_section_incremental_inputs::do_write): New function.
4006 (Output_section_incremental_inputs::write_header): New function.
4007 (Output_section_incremental_inputs::write_input_files): New function.
4008 (Output_section_incremental_inputs::write_info_blocks): New function.
4009 (Output_section_incremental_inputs::write_symtab): New function.
4010 * incremental.h (Incremental_script_entry): Forward declaration.
4011 (Incremental_object_entry): Forward declaration.
4012 (Incremental_archive_entry): Forward declaration.
4013 (Incremental_inputs): Forward declaration.
4014 (Incremental_inputs_header_data): Remove.
4015 (Incremental_inputs_header): Remove.
4016 (Incremental_inputs_header_write): Remove.
4017 (Incremental_inputs_entry_data): Remove.
4018 (Incremental_inputs_entry): Remove.
4019 (Incremental_inputs_entry_write): Remove.
4020 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
4021 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
4022 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4023 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
4025 (Incremental_input_entry): New class.
4026 (Incremental_script_entry): New class.
4027 (Incremental_object_entry): New class.
4028 (Incremental_archive_entry): New class.
4029 (Incremental_inputs::Incremental_inputs): Initialize new data members.
4030 (Incremental_inputs::report_inputs): Remove.
4031 (Incremental_inputs::report_archive): Remove.
4032 (Incremental_inputs::report_archive_begin): New function.
4033 (Incremental_inputs::report_archive_end): New function.
4034 (Incremental_inputs::report_object): Change prototype.
4035 (Incremental_inputs::report_input_section): New function.
4036 (Incremental_inputs::report_script): Change prototype.
4037 (Incremental_inputs::get_reloc_count): New function.
4038 (Incremental_inputs::set_reloc_count): New function.
4039 (Incremental_inputs::create_data_sections): New function.
4040 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4041 (Incremental_inputs::inputs_section): New function.
4042 (Incremental_inputs::symtab_section): New function.
4043 (Incremental_inputs::relocs_section): New function.
4044 (Incremental_inputs::get_stringpool): Add const.
4045 (Incremental_inputs::command_line): Add const.
4046 (Incremental_inputs::inputs): Remove.
4047 (Incremental_inputs::command_line_key): New function.
4048 (Incremental_inputs::input_file_count): New function.
4049 (Incremental_inputs::input_files): New function.
4050 (Incremental_inputs::relocs_entsize): New function.
4051 (Incremental_inputs::sized_create_inputs_section_data): Remove.
4052 (Incremental_inputs::finalize_inputs): Remove.
4053 (Incremental_inputs::Input_info): Remove.
4054 (Incremental_inputs::lock_): Remove.
4055 (Incremental_inputs::inputs_): Change type.
4056 (Incremental_inputs::inputs_map_): Remove.
4057 (Incremental_inputs::current_object_entry_): New data member.
4058 (Incremental_inputs::inputs_section_): New data member.
4059 (Incremental_inputs::symtab_section_): New data member.
4060 (Incremental_inputs::relocs_section_): New data member.
4061 (Incremental_inputs::reloc_count_): New data member.
4062 (Incremental_inputs_reader): New class.
4063 (Incremental_symtab_reader): New class.
4064 (Incremental_relocs_reader): New class.
4065 * layout.cc (Layout::finalize): Move finalization of incremental info
4066 and creation of incremental info sections to follow finalization of
4067 symbol table. Set offsets for postprocessing sections.
4068 (Layout::create_incremental_info_sections): Call
4069 Incremental_inputs::create_data_sections. Add incremental symtab
4070 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
4071 sections to layout after input sections.
4072 * layout.h (struct Timespec): Forward declaration.
4073 (Layout::incremental_inputs): Add const.
4074 (Layout::create_incremental_info_sections): Add parameter.
4075 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
4076 * object.cc: Include incremental.h.
4077 (Relobj::finalize_incremental_relocs): New function.
4078 (Sized_relobj::do_layout): Record input sections in incremental info.
4079 * object.h (Object::output_section): New function.
4080 (Object::output_section_offset): Moved from Relobj.
4081 (Object::get_incremental_reloc_base): New function.
4082 (Object::get_incremental_reloc_count): New function.
4083 (Object::do_output_section): New function.
4084 (Object::do_output_section_offset): Moved from Relobj.
4085 (Object::do_get_incremental_reloc_base): New function.
4086 (Object::do_get_incremental_reloc_count): New function.
4087 (Object::Object): Initialize new data members.
4088 (Relobj::output_section): Renamed do_output_section and moved to
4090 (Relobj::output_section_offset): Moved to Object.
4091 (Relobj::do_get_incremental_reloc_base): New function.
4092 (Relobj::do_get_incremental_reloc_count): New function.
4093 (Relobj::allocate_incremental_reloc_counts): New function.
4094 (Relobj::count_incremental_reloc): New function.
4095 (Relobj::finalize_incremental_relocs): New function.
4096 (Relobj::next_incremental_reloc_index): New function.
4097 (Relobj::reloc_counts_): New data member.
4098 (Relobj::reloc_bases_): New data member.
4099 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
4100 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
4101 (Sized_relobj::incremental_relocs_scan): New function.
4102 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4103 (Sized_relobj::incremental_relocs_write): New function.
4104 (Sized_relobj::incremental_relocs_write_reltype): New function.
4105 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
4107 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
4108 archives and object files elsewhere.
4109 (Add_symbols::run): Report object files here.
4110 (Finish_group::run): Report end of archive at end of group.
4111 * reloc.cc: Include layout.h, incremental.h.
4112 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
4113 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
4114 (Sized_relobj::incremental_relocs_scan): New function.
4115 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4116 (Sized_relobj::do_relocate_sections): Write incremental relocations.
4117 (Sized_relobj::incremental_relocs_write): New function.
4118 (Sized_relobj::incremental_relocs_write_reltype): New function.
4119 * script.cc (read_input_script): Rewrite test for incremental link.
4120 Change call to Incremental_inputs::report_script.
4121 * symtab.h (Symbol_table::first_global_index): New function.
4122 (Symbol_table::output_count): New function.
4124 2010-08-12 Doug Kwan <dougkwan@google.com>
4126 * arm.cc (Target_arm::merge_object_attributes): Check command line
4127 options --no-wchar-size-warning and --no-enum-size-warning.
4128 * options.h (General_options): Add ld-compatible options
4129 --no-enum-size-warning and --no-wchar-size-warning.
4131 2010-08-04 Ian Lance Taylor <iant@google.com>
4133 * x86_64.cc (Target_x86_64::Scan::local): Use
4134 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
4135 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
4136 (Target_x86_64::Scan::global): Likewise.
4137 (Target_x86_64::Relocate::relocate): Likewise.
4138 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
4141 2010-08-03 Cary Coutant <ccoutant@google.com>
4143 * merge.cc (Output_merge_string::do_add_input_section): Count strings
4144 to reserve space in merged_strings vector. Keep total input size
4146 (Output_merge_string::do_print_merge_stats): Print total input size.
4147 * merge.h (Output_merge_string): Add input_size_ field.
4148 * stringpool.cc (Stringpool_template::string_length): Move
4149 implementations out of Stringpool_template class and place in
4151 * stringpool.h (string_length): Move out of Stringpool_template.
4153 2010-08-03 Ian Lance Taylor <iant@google.com>
4156 * layout.cc (relaxation_loop_body): If address of load segment is
4157 set, adjust address to include headers if possible.
4159 2010-08-03 Ian Lance Taylor <iant@google.com>
4161 * version.cc (version_string): Bump to 1.10.
4163 2010-08-03 Ian Lance Taylor <iant@google.com>
4166 * layout.h (enum Output_section_order): Define.
4167 (class Layout): Update declarations.
4168 * layout.cc (Layout::get_output_section): Add order parameter.
4169 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
4170 is_first_non_relro parameters. Change all callers.
4171 (Layout::choose_output_section): Likewise.
4172 (Layout::add_output_section_data): Likewise.
4173 (Layout::make_output_section): Likewise. Set order.
4174 (Layout::default_section_order): New function.
4175 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
4176 * output.cc (Output_section::Output_section): Initialize order_.
4177 Don't initialize deleted fields.
4178 (Output_segment::Output_segment): Don't initialize deleted
4180 (Output_segment::add_output_section_to_load): New function
4181 replacing add_output_section. Change all callers to call this or
4182 add_output_section_to_nonload.
4183 (Output_segment::add_output_section_to_nonload): New function.
4184 (Output_segment::remove_output_section): Rewrite.
4185 (Output_segment::add_initial_output_data): Likewise.
4186 (Output_segment::has_any_data_sections): Likewise.
4187 (Output_segment::is_first_section_relro): Likewise.
4188 (Output_segment::maximum_alignment): Likewise.
4189 (Output_segment::has_dynamic_reloc): New function replacing
4190 dynamic_reloc_count. Change all callers.
4191 (Output_segment::has_dynamic_reloc_list): New function replacing
4192 dynamic_reloc_count_list. Change all callers.
4193 (Output_segment::set_section_addresses): Rewrite.
4194 (Output_segment::set_offset): Rewrite.
4195 (Output_segment::find_first_and_last_list): Remove.
4196 (Output_segment::set_tls_offsets): Rewrite.
4197 (Output_segment::first_section_load_address): Likewise.
4198 (Output_segment::output_section_count): Likewise.
4199 (Output_segment::section_with_lowest_load_address): Likewise.
4200 (Output_segment::write_section_headers): Likewise.
4201 (Output_segment::print_sections_to_map): Likewise.
4202 * output.h (class Output_data): Remove dynamic_reloc_count_
4203 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
4204 (Output_data::add_dynamic_reloc): Rewrite.
4205 (Output_data::has_dynamic_reloc): New function.
4206 (Output_data::dynamic_reloc_count): Remove.
4207 (class Output_section): Add order_ field. Remvoe is_relro_local_,
4208 is_last_relro_, is_first_non_relro_, is_interp_,
4209 is_dynamic_linker_section_ fields. Add order and set_order
4210 functions. Remove is_relro_local, set_is_relro_local,
4211 is_last_relro, set_is_last_relro, is_first_non_relro,
4212 set_is_first_non_relro functions, is_interp, set_is_interp,
4213 is_dynamic_linker_section, and set_is_dynamic_linker_section
4215 (class Output_segment): Change Output_data_list from std::list to
4216 std:;vector. Add output_lists_ field. Remove output_data_ and
4217 output_bss_ fields. Update declarations.
4219 2010-08-02 Ian Lance Taylor <iant@google.com>
4221 * arm.cc (Target_arm::gc_process_relocs): Use typename.
4222 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
4223 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
4225 2010-08-02 Ian Lance Taylor <iant@google.com>
4228 * script.cc (Script_options::Script_options): Initialize
4229 symbol_definitions_ and symbol_references_.
4230 (Script_options::add_symbol_assignment): Update
4231 symbol_definitions_ and symbol_references_.
4232 (Script_options::add_symbol_reference): New function.
4233 (script_symbol): New function.
4234 * script.h (class Script_options): Add symbol_definitions_ and
4235 symbol_references_ fields.
4236 (Script_options::referenced_const_iterator): New type.
4237 (Script_options::referenced_begin): New function.
4238 (Script_options::referenced_end): New function.
4239 (Script_options::is_referenced): New function.
4240 (Script_options::any_unreferenced): New function.
4241 * script-c.h (script_symbol): Declare.
4242 * yyscript.y (exp): Call script_symbol.
4243 * symtab.cc: Include "script.h".
4244 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
4245 Change all callers. Check symbols referenced by scripts.
4246 (Symbol_table::add_undefined_symbols_from_command_line): Add
4247 layout parameter. Change all callers.
4248 (Symbol_table::do_add_undefined_symbols_from_command_line):
4249 Likewise. Break out loop body. Check symbols referenced by
4251 (Symbol_table::add_undefined_symbol_from_command_line): New
4252 function broken out of
4253 do_add_undefined_symbols_from_command_line.
4254 * symtab.h (class Symbol_table): Update declarations.
4255 * archive.cc: Include "layout.h".
4256 (Archive::should_include_member): Add layout parameter. Change
4257 all callers. Check for symbol mentioned in expression.
4258 * archive.h (class Archive): Update declaration.
4259 * object.cc (Sized_relobj::do_should_include_member): Add layout
4261 * object.h (Object::should_include_member): Add layout parameter.
4263 (Object::do_should_include_member): Add layout parameter.
4264 (class Sized_relobj): Update declaration.
4265 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
4267 * dynobj.h (class Sized_dynobj): Update declaration.
4268 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
4270 * plugin.h (class Sized_pluginobj): Update declaration.
4272 2010-08-02 Ian Lance Taylor <iant@google.com>
4275 * output.cc (Output_segment::set_offset): Search for the first and
4276 last sections rather than assuming that the list is in order.
4277 (Output_segment::find_first_and_last_list): New function.
4278 * output.h (class Output_segment): Update declarations.
4279 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4280 (relro_strip_test_SOURCES): New variable.
4281 (relro_strip_test_DEPENDENCIES): New variable.
4282 (relro_strip_test_LDFLAGS): New variable.
4283 (relro_strip_test_LDADD): New variable.
4284 (relro_strip_test.so): New target.
4286 2010-08-02 Ian Lance Taylor <iant@google.com>
4288 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4289 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4290 (Target_i386::got_tlsdesc_section): New function.
4291 (Target_i386::got_section): Create space for GOT entries for
4292 TLSDESC relocations.
4293 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4295 (Target_i386::Scan::global): Likewise.
4296 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
4298 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
4299 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
4300 (Target_x86_64::got_tlsdesc_section): New function.
4301 (Target_x86_64::got_section): Create space for GOT entries for
4302 TLSDESC relocations.
4303 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
4305 (Target_x86_64::Scan::global): Likewise.
4306 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
4309 2010-08-02 Ian Lance Taylor <iant@google.com>
4311 * testsuite/final_layout.sh: Use dc to convert from hex to
4314 2010-07-29 Sriraman Tallam <tmsriram@google.com>
4316 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4317 paramter to the call to gold::gc_process_relocs.
4318 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4319 paramter to the call to gold::gc_process_relocs.
4320 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4321 parameter to the call to gold::gc_process_relocs.
4322 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4323 template parameter to the call to gold::gc_process_relocs.
4324 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4325 paramter to the call to gold::gc_process_relocs.
4326 * gc.h (get_embedded_addend_size): New function.
4327 (gc_process_relocs): Save the size of the reloc for use by ICF.
4328 * icf.cc (get_section_contents): Get the addend from the text section
4329 for SHT_REL relocation sections.
4330 * icf.h (Icf::Reloc_addend_size_info): New typedef.
4331 (Icf::Reloc_info): Add new member reloc_addend_size_info.
4332 * int_encoding.h (read_from_pointer): New overloaded function.
4333 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
4334 * testsuite/icf_sht_rel_addend_test.sh: New file.
4335 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
4336 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
4338 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4340 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
4341 * Makefile.in: Regenerate.
4342 * testsuite/Makefile.in: Regenerate.
4344 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
4346 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
4347 * gold/testsuite/debug_msg.cc: Likewise.
4348 * gold/testsuite/odr_violation1.cc
4349 * gold/testsuite/odr_violation2.cc
4351 2010-07-21 Cary Coutant <ccoutant@google.com>
4353 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
4354 string, and length fields.
4355 (Output_merge_string::Merged_strings_list): New type.
4356 (Output_merge_string::Merged_strings_lists): New typedef.
4357 (Output_merge_string): Replace merged_strings_ with
4358 merged_strings_lists_.
4359 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
4360 Merged_strings_list per input object and section. Don't store pointer
4361 to the string. Don't store length with each merged string entry.
4362 (Output_merge_string::finalize_merged_data): Loop over list of merged
4363 strings lists. Recompute length of each merged string.
4365 2010-07-15 Cary Coutant <ccoutant@google.com>
4367 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
4370 2010-07-14 Ian Lance Taylor <iant@google.com>
4372 * descriptors.cc (Descriptors::open): Report correct name in error
4375 2010-07-13 Doug Kwan <dougkwan@google.com>
4377 * arm.cc (Arm_input_section::Arm_input_section): For a
4378 SHT_ARM_EXIDX section, always keeps the input sections.
4379 (Arm_input_section::set_exidx_section_link): New method.
4380 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
4381 has_errors_ to false.
4382 (Arm_exidx_input_section::has_errors,
4383 Arm_exidx_input_section::set_has_errors): New methods.
4384 (Arm_exidx_input_section::has_errors_): New data member.
4385 (Arm_relobj::get_exidx_shndx_list): New method.
4386 (Arm_output_section::append_text_sections_to_list): Do not skip
4387 section without SHF_EXECINSTR.
4388 (Arm_output_section::fix_exidx_coverage): Skip input sections with
4390 (Arm_relobj::make_exidx_input_section): Add new parameter for text
4391 section header. Make error messages more verbose. Check for
4392 a non-executable section linked to an EXIDX section.
4393 (Arm_relobj::do_read_symbols): Remove error checking, which has been
4394 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
4395 check that there is no deferred EXIDX section if we exit early.
4396 Instead of not making an EXIDX section in case of an error, make one
4397 and set the has_errors flag of it.
4398 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
4399 in a relocatable link.
4400 (Target_arm::do_relax): Look for the EXIDX output section instead of
4401 assuming that it is called .ARM.exidx.
4402 (Target_arm::fix_exidx_coverage): Add a new parameter for input
4403 section list. Do not check for SHF_EXECINSTR section flags but
4404 skip any input section with errors.
4405 * output.cc (Output_section::Output_section): Initialize
4406 always_keeps_input_sections_ to false.
4407 (Output_section::add_input_section): Check for
4408 always_keeps_input_sections_.
4409 * output.h (Output_section::always_keeps_input_sections,
4410 Output_section::set_always_keeps_input_sections): New methods.
4411 (Output_section::always_keeps_input_sections): New data member.
4413 2010-07-13 Rafael Espindola <espindola@google.com>
4415 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
4416 * fileread.h (Input_file): Add try_extra_search_path and find_file.
4418 2010-07-13 Philip Herron <herron.philip@googlemail.com>
4419 Ian Lance Taylor <iant@google.com>
4421 * output.h (Output_section_lookup_maps::add_merge_section):
4422 Correct check of whether value was inserted.
4423 (Output_section_lookup_maps::add_merge_input_section): Likewise.
4424 (Output_section_lookup_maps::add_relaxed_input_section):
4426 * arm.cc (Target_arm::got_section): Remove used local os.
4427 * i386.cc (Target_i386::got_section): Likewise.
4428 * x86_64.cc (Target_x86_64::got_section): Likewise.
4429 * sparc.cc (Target_sparc::got_section): Likewise.
4430 (Target_sparc::relocate): Remove unused local have_got_offset.
4431 * powerpc.cc (Target_powerpc::relocate): Likewise.
4433 2010-07-13 Ian Lance Taylor <iant@google.com>
4435 * compressed_output.cc (zlib_decompress): Fix signature in
4438 * archive.cc (Archive::include_member): Unlock an external member
4439 of a thin archive. Don't bother to delete an object we know is
4442 2010-07-12 Cary Coutant <ccoutant@google.com>
4444 * compressed_output.cc (zlib_decompress): New function.
4445 (get_uncompressed_size): New function.
4446 (decompress_input_section): New function.
4447 * compressed_output.h (get_uncompressed_size): New function.
4448 (decompress_input_section): New function.
4449 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
4450 Handle compressed debug sections.
4451 * layout.cc (is_compressed_debug_section): New function.
4452 (Layout::output_section_name): Map compressed section names to
4454 * layout.h (is_compressed_debug_section): New function.
4455 (is_debug_info_section): Recognize compressed debug sections.
4456 * merge.cc: Include compressed_output.h.
4457 (Output_merge_data::do_add_input_section): Handle compressed
4459 (Output_merge_string::do_add_input_section): Handle compressed
4461 * object.cc: Include compressed_output.h.
4462 (Sized_relobj::Sized_relobj): Initialize new data members.
4463 (build_compressed_section_map): New function.
4464 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
4465 * object.h (Object::section_is_compressed): New method.
4466 (Object::do_section_is_compressed): New method.
4467 (Sized_relobj::Compressed_section_map): New type.
4468 (Sized_relobj::do_section_is_compressed): New method.
4469 (Sized_relobj::compressed_sections_): New data member.
4470 * output.cc (Output_section::add_input_section): Handle compressed
4472 * reloc.cc: Include compressed_output.h.
4473 (Sized_relobj::write_sections): Handle compressed debug sections.
4475 2010-07-08 Cary Coutant <ccoutant@google.com>
4477 * resolve.cc (Symbol_table::resolve): Remember whether undef was
4478 weak when resolving to a dynamic def.
4479 (Symbol_table::should_override): Add adjust_dyndef flag; set it
4480 for weak undef/dynamic def cases. Adjust callers.
4481 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
4482 undef_binding_weak_.
4483 (Symbol_table::sized_write_globals): Adjust symbol binding.
4484 (Symbol_table::sized_write_symbol): Add binding parameter.
4485 * symtab.h (Symbol::set_undef_binding): New method.
4486 (Symbol::is_undef_binding_weak): New method.
4487 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
4488 (Symbol_table::should_override): Add new parameter.
4489 (Symbol_table::sized_write_symbol): Add new parameter.
4491 * testsuite/weak_undef_file1.cc: Add new test case.
4492 * testsuite/weak_undef_file2.cc: Fix header comment.
4493 * testsuite/weak_undef_test.cc: Add new test case.
4495 2010-06-29 Doug Kwan <dougkwan@google.com>
4497 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
4498 Initialize USE_SYMBOL_.
4499 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
4501 (Arm_reloc_property::uses_symbol_): New data member declaration.
4502 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
4503 uses symbol value and symbol is undefined but not weakly undefined.
4505 2010-06-28 Rafael Espindola <espindola@google.com>
4507 * plugin.cc (Plugin::load): Use dlerror.
4509 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
4511 * symtab.cc (detect_odr_violations): When reporting an ODR
4512 violation, report an object where the symbol is defined.
4514 2010-06-25 Doug Kwan <dougkwan@google.com>
4516 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
4517 (Target_arm::section_may_have_icf_unsafe_pointers): New method
4519 (Target_arm::Scan::local_reloc_may_be_function_pointer,
4520 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
4521 target hook to detect function points.
4522 (Target_arm::Scan::possible_function_pointer_reloc): New method.
4523 * icf.h (Icf::check_section_for_function_pointers): Change type of
4524 parameter SECTION_NAME to const reference to std::string. Use
4525 target hook to determine if section may have unsafe pointers.
4526 * target.h (Target::section_may_have_icf_unsafe_pointers): New
4529 2010-06-21 Rafael Espindola <espindola@google.com>
4531 * fileread.cc (Input_file::find_fie): New
4532 (Input_file::open): Use Input_file::find_fie.
4533 * fileread.h (Input_file::find_fie): New
4534 * plugin.cc (set_extra_library_path): New.
4535 (Plugin::load): Add set_extra_library_path to the transfer vector.
4536 (Plugin_manager::set_extra_library_path): New.
4537 (Plugin_manager::add_input_file): Use the extra search path if set.
4538 (set_extra_library_path(): New.
4539 * plugin.h (Plugin_manager): Add set_extra_library_path and
4542 2010-06-19 Cary Coutant <ccoutant@google.com>
4544 * layout.cc (gdb_sections): Add .debug_types.
4545 (lines_only_debug_sections): Likewise.
4547 2010-06-18 Rafael Espindola <espindola@google.com>
4549 * plugin.cc (add_input_file,add_input_library)
4550 (Plugin_manager::add_input_file): Make filename arguments const.
4551 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
4554 2010-06-16 Doug Kwan <dougkwan@google.com>
4556 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
4557 .ARM.attributes section if we have not merged any input
4558 attributes sections.
4560 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4562 * arm.cc: Allow combining objects with no EABI version
4565 2010-06-15 Rafael Espindola <espindola@google.com>
4567 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
4569 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4571 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
4572 (struct iovec): Correct !HAVE_READV definition.
4574 2010-06-10 Cary Coutant <ccoutant@google.com>
4576 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
4577 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
4579 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
4582 * symtab.h (Symbol::is_placeholder): New member function.
4583 * target-reloc.h (relocate_section): Check for placeholder symbols.
4585 * testsuite/Makefile.am (plugin_test_8): New test.
4586 (plugin_test_9): New test.
4587 * testsuite/Makefile.in: Regenerate.
4589 2010-06-09 Nick Clifton <nickc@redhat.com>
4591 * yyscript.y (input_list_element): Allow strings prefixed with
4592 the '-' character. Treat these as libraries.
4593 * script.cc (script_add_library): New function. Adds a library
4594 specified by "-l<name>" found in an input script.
4595 * script-c.h: Add prototype for script_add_library.
4597 2010-06-07 Doug Kwan <dougkwan@google.com>
4599 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
4600 Restrict stub-group size to be within long conditional branch
4601 range when working around cortex-A8 erratum.
4603 2010-06-07 Damien Diederen <dd@crosstwine.com>
4605 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
4608 2010-06-03 Sriraman Tallam <tmsriram@google.com>
4612 (Output_section::Input_section_sort_entry::compare_section_ordering):
4613 Change to return non-zero correctly.
4614 (Output_section::Input_section_sort_section_order_index_compare
4615 ::operator()): Change to fix ambiguity in comparisons.
4617 2010-06-01 Sriraman Tallam <tmsriram@google.com>
4619 * gold.h (is_wildcard_string): New function.
4620 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
4621 (Layout::layout_eh_frame): Ditto.
4622 (Layout::find_section_order_index): New method.
4623 (Layout::read_layout_from_file): New method.
4624 * layout.h (Layout::find_section_order_index): New method.
4625 (Layout::read_layout_from_file): New method.
4626 (Layout::input_section_position_): New private member.
4627 (Layout::input_section_glob_): New private member.
4628 * main.cc (main): Call read_layout_from_file here.
4629 * options.h (--section-ordering-file): New option.
4630 * output.cc (Output_section::input_section_order_specified_): New
4632 (Output_section::Output_section): Initialize new member.
4633 (Output_section::add_input_section): Add new parameter.
4634 Keep input sections when --section-ordering-file is used.
4635 (Output_section::set_final_data_size): Sort input sections when
4636 section ordering file is specified.
4637 (Output_section::Input_section_sort_entry): Add new parameter.
4639 (Output_section::Input_section_sort_entry::compare_section_ordering):
4641 (Output_section::Input_section_sort_compare::operator()): Change to
4642 consider section_order_index.
4643 (Output_section::Input_section_sort_init_fini_compare::operator()):
4644 Change to consider section_order_index.
4645 (Output_section::Input_section_sort_section_order_index_compare
4646 ::operator()): New method.
4647 (Output_section::sort_attached_input_sections): Change to sort
4648 according to section order when specified.
4649 (Output_section::add_input_section<32, true>): Add new parameter.
4650 (Output_section::add_input_section<64, true>): Add new parameter.
4651 (Output_section::add_input_section<32, false>): Add new parameter.
4652 (Output_section::add_input_section<64, false>): Add new parameter.
4653 * output.h (Output_section::add_input_section): Add new parameter.
4654 (Output_section::input_section_order_specified): New
4656 (Output_section::set_input_section_order_specified): New method.
4657 (Input_section::Input_section): Initialize section_order_index_.
4658 (Input_section::section_order_index): New method.
4659 (Input_section::set_section_order_index): New method.
4660 (Input_section::section_order_index_): New member.
4661 (Input_section::Input_section_sort_section_order_index_compare): New
4663 (Output_section::input_section_order_specified_): New member.
4664 * script-sections.cc (is_wildcard_string): Delete and move modified
4666 (Output_section_element_input::Output_section_element_input): Modify
4667 call to is_wildcard_string.
4668 (Output_section_element_input::Input_section_pattern
4669 ::Input_section_pattern): Ditto.
4670 (Output_section_element_input::Output_section_element_input): Ditto.
4671 * testsuite/Makefile.am (final_layout): New test case.
4672 * testsuite/Makefile.in: Regenerate.
4673 * testsuite/final_layout.cc: New file.
4674 * testsuite/final_layout.sh: New file.
4676 2010-06-01 Rafael Espindola <espindola@google.com>
4678 * plugin.cc (Plugin::load): Pass the output name to the plugin.
4680 2010-06-01 Rafael Espindola <espindola@google.com>
4682 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
4683 visibility of symbols.
4685 2010-05-27 Doug Kwan <dougkwan@google.com>
4687 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
4688 from start of output section instead of address for a local symbol
4689 in a merged or relaxed section when doing a relocatable link.
4691 2010-05-26 Rafael Espindola <espindola@google.com>
4694 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
4695 adding sections the garbage collector removed.
4696 * gold/testsuite/Makefile.am: Add test.
4697 * gold/testsuite/Makefile.in: Regenerate.
4698 * gold/testsuite/plugin_test_7.sh: New.
4699 * gold/testsuite/plugin_test_7_1.c: New.
4700 * gold/testsuite/plugin_test_7_2.c: New.
4702 2010-05-26 Rafael Espindola <espindola@google.com>
4704 * script-sections.cc (Output_section_definition::set_section_addresses):
4705 Check for --section-start.
4707 2010-05-26 Doug Kwan <dougkwan@google.com>
4709 * arm.cc (Arm_scan_relocatable_relocs): New class.
4710 (Target_arm::relocate_special_relocatable): New method.
4711 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
4712 (Arm_relocate_functions::thumb_branch_common): Same.
4713 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
4714 instead of Default_scan_relocatable_relocs.
4715 * target-reloc.h (relocate_for_relocatable): Let target handle
4716 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
4717 * target.h (Sized_target::relocate_special_relocatable): New method.
4719 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4721 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
4723 2010-05-23 Doug Kwan <dougkwan@google.com>
4725 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
4727 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
4728 with a direct branch, not a conditional branch, to a stub.
4729 * merge.cc (Output_merge_base::record_input_section): New method
4731 (Output_merge_data::do_add_input_section): Record input section if
4732 keeps-input-sections flag is set.
4733 (Output_merge_string::do_add_input_section): Ditto.
4734 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
4735 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
4737 (Output_merge_base::keeps_input_sections,
4738 Output_merge_base::set_keeps_input_sections,
4739 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
4741 (Output_merge_base::Input_sections): New type declaration.
4742 (Output_merge_base::input_sections_begin,
4743 Output_merge_base::input_sections_end,
4744 Output_merge_base::do_set_keeps_input_sections): New method definitions.
4745 (Output_merge_base::bool keeps_input_sections_,
4746 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
4747 Output_merge_base::input_sections_): New data members.
4748 (Output_merge_data::do_set_keeps_input_sections): New method
4750 (Output_merge_string::do_set_keeps_input_sections): Ditto.
4751 * output.cc (Output_section::Input_section::relobj): Move method
4752 defintion from class declaration to here and handle merge sections.
4753 (Output_section::Input_section::shndx): Ditto.
4754 (Output_section::Output_section): Remove initializations of removed
4755 data members and initialize new data member LOOKUP_MAPS_.
4756 (Output_section::add_input_section): Set keeps-input-sections flag
4757 for a newly created merge output section as appropriate. Adjust code
4758 to use Output_section_lookup_maps class.
4759 (Output_section::add_relaxed_input_section): Adjst code for lookup
4760 maps code refactoring.
4761 (Output_section::add_merge_input_section): Add a new parameter
4762 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
4763 class. If adding input section to a newly created merge output
4764 section fails, remove the new merge section.
4765 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
4766 Adjust code for use of the Output_section_lookup_maps class.
4767 (Output_section::find_merge_section): Ditto.
4768 (Output_section::build_lookup_maps): New method defintion.
4769 (Output_section::find_relaxed_input_section): Adjust code to use
4770 Output_section_lookup_maps class.
4771 (Output_section::get_input_sections): Export merge sections. Adjust
4772 code to use Output_section_lookup_maps class.
4773 (Output_section:::add_script_input_section): Adjust code to use
4774 Output_section_lookup_maps class. Update lookup maps for merge
4776 (Output_section::discard_states): Use Output_section_lookup_maps.
4777 (Output_section::restore_states): Same.
4778 * output.h (Merge_section_properties): Move class defintion out of
4780 (Output_section_lookup_maps): New class.
4781 (Output_section::Input_section::is_merge_section): New method
4783 (Output_section::Input_section::relobj): Move defintion out of class
4784 defintion. Declare method only.
4785 (Output_section::Input_section::shndx): Ditto.
4786 (Output_section::Input_section::output_merge_base): New method defintion.
4787 (Output_section::Input_section::u2_.pomb): New union field.
4788 (Output_section::Merge_section_by_properties_map,
4789 Output_section::Output_section_data_by_input_section_map,
4790 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
4792 (Output_section::add_merge_input_section): Add new parameter
4793 KEEPS_INPUT_SECTIONS.
4794 (Output_section::build_lookup_maps): New method declaration.
4795 (Output_section::merge_section_map_,
4796 Output_section::merge_section_by_properties_map_,
4797 Output_section::relaxed_input_section_map_,
4798 Output_section::is_relaxed_input_section_map_valid_): Remove data
4800 (Output_section::lookup_maps_): New data member.
4802 2010-05-21 Doug Kwan <dougkwan@google.com>
4805 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
4806 avoid a compilation error.
4808 2010-05-19 Rafael Espindola <espindola@google.com>
4810 * script-sections.cc (Output_section_definition::allocate_to_segment):
4811 Update the phdrs_list even when the output section is NULL.
4812 * testsuite/Makefile.am: Add test.
4813 * testsuite/Makefile.in: Regenerate.
4814 * testsuite/script_test_9.cc: New.
4815 * testsuite/script_test_9.sh: New.
4816 * testsuite/script_test_9.t: New.
4818 2010-05-19 Doug Kwan <dougkwan@google.com>
4820 * arm.cc (Arm_input_section::original_size): New method.
4821 (Arm_input_section::do_addralign): Add a cast.
4822 (Arm_input_section::do_output_offset): Remove static cast.
4823 (Arm_input_section::original_addralign,
4824 Arm_input_section::original_size_): Change type to uint32_t.
4825 (Arm_input_section::init): Add safe casts for section alignment
4827 (Arm_input_section::set_final_data_size): Do not set address and
4828 offset of stub table.
4829 (Arm_output_section::fix_exidx_coverage): Change use of of
4830 Output_section::Simple_input_section to that of
4831 Output_section::Input_section.
4832 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
4833 except for the first pass.
4834 * output.cc (Output_section::get_input_sections): Change type of
4835 input_sections to std::list<Input_section>.
4836 (Output_section::add_script_input_section): Rename from
4837 Output_section::add_simple_input_section. Change type of SIS
4838 parameter from Simple_input_section to Input_section.
4839 * output.h (Output_section::Simple_input_section): Remove class.
4840 (Output_section::Input_section): Change class visibility to public.
4841 (Output_section::Input_section::addralign): Use stored alignments
4842 for special input sections if set.
4843 (Output_section::Input_section::set_addralign): New method.
4844 (Output_section::get_input_sections): Change parameter type from
4845 list of Simple_input_section to list of Input_section.
4846 (Output_section::add_script_input_section): Rename from
4847 Output_section::add_simple_input_section. Change first parameter's
4848 type from Simple_input_section to Input_section and remove the
4849 second and third parameters.
4850 * script-sections.cc (Input_section::Input_section_list): Change
4851 type to list of Output_section::Input_section/
4852 (Input_section_info::Input_section_info): Change parameter type of
4853 INPUT_SECTION to Output_section::Input_section.
4854 (Input_section_info::input_section): Change return type.
4855 (Input_section_info::input_section_): Change type to
4856 Output_section::Input_section.
4857 (Output_section_element_input::set_section_addresses): Adjust code
4858 to use Output_section::Input_section instead of
4859 Output_section::Simple_input_section. Adjust code for renaming
4860 of Output_section::add_simple_input_section.
4861 (Orphan_output_section::set_section_addresses): Ditto.
4863 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4865 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
4866 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
4868 2010-05-18 Rafael Espindola <espindola@google.com>
4870 * options.cc (General_options::finalize): Handle -nostdlib.
4871 * options.h (nostdlib): New option.
4872 * script.cc (script_add_search_dir): Handle -nostdlib.
4874 2010-05-12 Doug Kwan <dougkwan@google.com>
4876 * arm.cc (Target_arm::do_finalize_sections): Create an empty
4877 attributes section only if there no attributes section after merging.
4878 (Target_arm::merge_object_attributes): Move value of
4879 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
4880 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
4881 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
4882 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
4883 and arm_attr_merge_7.stdout.
4884 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
4885 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
4886 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
4887 arm_attr_merge_7b.o): New rules.
4888 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
4890 * testsuite/Makefile.in: Regenerate.
4891 * testsuite/arm_attr_merge.sh: New file.
4892 * testsuite/arm_attr_merge_[67][ab].s: Same.
4894 2010-05-05 Nick Clifton <nickc@redhat.com>
4896 * po/es.po: Updated Spanish translation.
4898 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
4900 * Makefile.am (install-exec-local): Properly install gold as
4901 default cross linker.
4902 * Makefile.in: Regenerated.
4904 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
4905 Nick Clifton <nickc@redhat.com>
4907 * configure.ac (install_as_default): Define and set to false
4908 unless --enable-gold or --enable-gold=both/gold has been
4910 * configure: Regenerate.
4912 * Makefile.am (install-exec-local): Install the executable as
4913 'ld.gold'. If install_as_default is true then also install it as
4915 * Makefile.in: Regenerated.
4917 2010-04-24 Ian Lance Taylor <iant@google.com>
4919 * layout.cc (Layout::layout_reloc): In relocatable link don't
4920 combine reloc sections for grouped sections.
4922 2010-04-23 Sriraman Tallam <tmsriram@google.com>
4924 * gc.h (gc_process_relocs): Pass information on relocs pointing to
4925 sections that are not ordinary to icf.
4926 * icf.cc (get_section_contents): Handle relocation pointing to section
4927 with no object or shndx information.
4928 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
4929 * testsuite/Makefile.in: Regenerate.
4930 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
4931 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
4933 2010-04-22 Ian Lance Taylor <iant@google.com>
4935 * expression.cc (Expression::Expression_eval_info): Add
4936 result_alignment_pointer field.
4937 (Expression::eval_with_dot): Add result_alignment_pointer
4938 parameter. Change all callers.
4939 (Expression::eval_maybe_dot): Likewise.
4940 (class Binary_expression): Add alignment_pointer parameter to
4941 left_value and right_value. Change all callers.
4942 (BINARY_EXPRESSION): Set result alignment.
4943 (class Trinary_expression): Add alignment_pointer parameter to
4944 arg2_value and arg3_value. Change all callers.
4945 (Trinary_cond::value): Set result alignment.
4946 (Max_expression::value, Min_expression::value): Likewise.
4947 (Align_expression::value): Likewise.
4948 * script-sections.cc (class Sections_element): Add dot_alignment
4949 parameter to set_section_addresses virtual function. Update
4951 (class Output_section_element): Likewise.
4952 (Script_sections::create_segments): Add dot_alignment parameter.
4954 (Script_sections::create_segments_from_phdrs_clause): Likewise.
4955 (Script_sections::set_phdrs_clause_addresses): Likewise.
4956 * script-sections.h: Update declarations.
4957 * script.h: Update declarations.
4958 * output.h (Output_segment::set_minimum_p_align): Don't decrease
4960 * testsuite/script_test_3.t: Set large alignment.
4961 * testsuite/script_test_3.sh: Make sure that at least one LOAD
4962 segment has expected alignment.
4964 2010-04-22 Nick Clifton <nickc@redhat.com>
4966 * po/gold.pot: Updated by the Translation project.
4967 * po/vi.po: Updated Vietnamese translation.
4969 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
4971 * testsuite/Makefile.am (check_PROGRAMS): Add
4972 icf_virtual_function_folding_test.
4973 * testsuite/Makefile.in: Regenerated.
4975 2010-04-15 Andrew Haley <aph@redhat.com>
4977 * options.h (merge_exidx_entries): New option.
4978 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
4979 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
4980 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
4981 (Target_arm::merge_exidx_entries): New function.
4982 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
4983 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
4984 to Arm_exidx_fixup constructor.
4985 Add new arg, merge_exidx_entries.
4986 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
4987 Arm_output_section::fix_exidx_coverage.
4989 2010-04-18 Sriraman Tallam <tmsriram@google.com>
4991 * icf.cc (get_section_contents): Check for preemptible functions.
4992 Ignore addend when appropriate.
4993 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
4995 (add_from_relobj): Check for section folded.
4996 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
4997 * symtab.h (should_add_dynsym_entry): Add new parameter.
4998 * target-reloc.h (scan_relocs): Check for section folded.
4999 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
5000 Check reloc types for function pointers in shared objects.
5001 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
5003 (icf_preemptible_functions_test): New test case.
5004 (icf_string_merge_test): New test case.
5005 * testsuite.Makefile.in: Regenerate.
5006 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
5007 bar_glob. Refactor code.
5008 * testsuite/icf_preemptible_functions_test.cc: New file.
5009 * testsuite/icf_preemptible_functions_test.sh: New file.
5010 * testsuite/icf_string_merge_test.cc: New file.
5011 * testsuite/icf_string_merge_test.sh: New file.
5012 * testsuite/icf_virtual_function_folding_test.cc: New file.
5013 * testsuite/icf_virtual_function_folding_test.sh: New file.
5015 2010-04-14 Doug Kwan <dougkwan@google.com>
5017 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
5018 for local symbol recounting if we remove a section due to ICF.
5019 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
5020 there are no regular objects in input.
5022 2010-04-13 Doug Kwan <dougkwan@google.com>
5024 * arm.cc (Arm_input_section::set_final_data_size): Compute
5025 accurate final data size instead of using current data size.
5027 2010-04-09 Doug Kwan <dougkwan@google.com>
5029 * layout.cc (Layout::choose_output_section): Handle script section
5031 (Layout::make_output_section_for_script): Add section type parameter.
5032 Handle script section types.
5033 * layout.h (Layout::make_output_section_for_script): Add section
5035 * output.cc (Output_section::Output_section): Initialize data member
5037 (Output_section::do_reset_address_and_file_offset): Do not set address
5038 to 0 if section is a NOLOAD section.
5039 * output.h (Output_section::is_noload): New method.
5040 (Output_section::set_is_noload): Ditto.
5041 (Output_section::is_noload_): New data member.
5042 * script-c.h (Script_section_type): New enum type.
5043 (struct Parser_output_section_header): Add new file section_type.
5044 * script-sections.cc (Sections_element::output_section_name): Add
5045 parameter for returning script section type.
5046 (Output_section_definition::output_section_name): Ditto.
5047 (Output_section_definition::section_type)P; New method.
5048 (Output_section_definiton::script_section_type_name): Ditto.
5049 (Output_section_definition::script_section_type_): New data member.
5050 (Output_section_definition::Output_section_definition): Initialize
5051 data member Output_section_definition::script_section_type_.
5052 (Output_section_definition::create_sections): Pass script section type
5053 to Layout::make_output_section_for_script.
5054 (Output_section_definition::output_section_name): Return script
5055 section type to caller.
5056 (Output_section_definition::set_section_address): Do not advance
5057 dot value and load address if section type is NOLOAD. Set address
5058 of NOLOAD sections regardless of section flags.
5059 (Output_section_definition::print): Print section type if it is
5060 not SCRIPT_SECTION_TYPE_NONE.
5061 (Output_section_definition::section_type): New method.
5062 (Output_section_definition::script_section_type_name): Ditto.
5063 (Script_sections::output_section_name): Add new parameter
5064 PSECTION_TYPE for returning script section type. Pass it to
5065 section elements. Handle discard sections.
5066 (Sort_output_sections::operator()): Handle NOLOAD sections.
5067 * script-sections.h (Script_sections::Section_type): New enum type.
5068 (Script_sections::output_section_name): Add a new parameter for
5069 returning script section type.
5070 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
5072 * yyscript.y (union): Add new field SECTION_TYPE.
5073 (COPY, DSECT, INFO, NOLOAD): New tokens.
5074 (opt_address_and_section_type): Change type to output_section_header.
5075 (section_type): New non-terminal
5076 (section_header): Handle section type.
5077 (opt_address_and_section_type): Return section type value.
5079 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
5081 * testsuite/plugin_common_test_1.c (foo): Add prototype.
5082 * testsuite/plugin_common_test_2.c (foo): Likewise.
5084 2010-04-08 Doug Kwan <dougkwan@google.com>
5086 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
5088 * output.cc (Output_section::add_merge_input_section): Simplify
5089 code and return status of Output_merge_base::add_input_section.
5090 Update merge section map only if Output_merge_base::add_input_section
5093 2010-04-07 Doug Kwan <dougkwan@google.com>
5095 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
5096 if section is marked as containing instructions but has no mapping
5098 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
5099 correct section index.
5100 (Arm_relobj::find_linked_text_section): Ditto.
5102 2010-04-07 Cary Coutant <ccoutant@google.com>
5104 * archive.cc (include_member): Destroy Read_symbols_data object before
5106 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
5107 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
5108 (Read_symbols_data::~Read_symbols_data) New destructor.
5109 (Section_relocs::Section_relocs) New constructor.
5110 (Section_relocs::~Section_relocs) New destructor.
5111 (Read_relocs_data::Read_relocs_data) New constructor.
5112 (Read_relocs_data::~Read_relocs_data) New destructor.
5113 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
5114 pointers to NULL after deleting.
5116 2010-04-07 Doug Kwan <dougkwan@google.com>
5118 * arm.cc: Replace "endianity" with "endianness" in comments.
5119 (Arm_exidx_cantunwind): Ditto.
5120 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
5121 (Arm_relobj::merge_flags_and_attributes): New method.
5122 (Arm_relobj::merge_flags_and_attributes_): New data member.
5123 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
5124 (Arm_relobj::scan_sections_for_stubs): Ditto.
5125 (Arm_relobj::do_read_symbols): Check to see if we really want to
5126 merge processor-specific flags and attributes. Exit early if
5127 an object is empty except for section names and the undefined symbol.
5128 (Target_arm::do_finalize_sections): Move check for ELF format to
5129 Arm_relobj::do_read_symbols. Merge processor specific flags and
5130 attributes from a regular object only when we have determined that
5131 it is aapropriate. Do not create an .ARM.attributes section in
5132 output if there is no regular input object.
5133 (Target_arm::merge_processor_specific_flags): Check
5134 --warn-mismatch before printing any error.
5135 (Target_arm::merge_object_attributes): Ditto.
5136 * gold.cc (queue_middle_tasks): Handle the case in which there is
5137 no regular object in input.
5138 * options.cc (General_options::parse_EB): New method.
5139 (General_options::parse_EL): Same.
5140 (General_options::General_options): Initialize endianness_.
5141 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
5143 (General_options::Endianness): New enum.
5144 (General_options::endianness): New method.
5145 (General_options::endianness_): New data member.
5146 * parameters.cc (Parameters::set_options): Check target endianness.
5147 (Parameters::set_target_once): Ditto.
5148 (Parameters::check_target_endianness): New method.
5149 (parameters_force_valid_target): If either -EL or -EB is specified,
5150 use it to define endianness of default target.
5151 * parameters.h (Parameters::check_target_endianness): New method
5153 * target.h (class Target): Change "endianity" to "endianness"
5156 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5158 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
5159 * configure: Regenerate.
5160 * Makefile.in: Regenerate.
5161 * testsuite/Makefile.in: Regenerate.
5163 2010-04-06 Cary Coutant <ccoutant@google.com>
5166 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
5167 prevailing definitions of common symbols.
5168 * testsuite/plugin_test_6.sh: New test case.
5169 * testsuite/plugin_common_test_1.c: New test case.
5170 * testsuite/plugin_common_test_2.c: New test case.
5171 * testsuite/Makefile.am (plugin_test_6): New test case.
5172 * testsuite/Makefile.in: Regenerate.
5174 2010-04-06 Nick Clifton <nickc@redhat.com>
5176 * po/vi.po: New Vietnamese translation.
5178 2010-03-30 Doug Kwan <dougkwan@google.com>
5180 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
5182 2010-03-25 Doug Kwan <dougkwan@google.com>
5184 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
5185 to avoid a conversion warning on a 32-bit host.
5187 2010-03-24 Ian Lance Taylor <iant@google.com>
5189 * testsuite/script_test_3.t: Add a TLS segment.
5190 * testsuite/Makefile.am (check_PROGRAMS): Add
5191 tls_phdrs_script_test.
5192 (tls_phdrs_script_test_SOURCES): Define.
5193 (tls_phdrs_script_test_DEPENDENCIES): Define.
5194 (tls_phdrs_script_test_LDFLAGS): Define.
5195 (tls_phdrs_script_test_LDADD): Define.
5196 * testsuite/Makefile.in: Rebuild.
5198 2010-03-23 Cary Coutant <ccoutant@google.com>
5200 * fileread.cc (find_or_make_view): Fix comment.
5202 2010-03-23 Ian Lance Taylor <iant@google.com>
5204 * script-sections.cc (class Orphan_section_placement): Define
5205 PLACE_TLS and PLACE_TLS_BSS.
5206 (Orphan_section_placement::Orphan_section_placement): Initialize
5208 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
5209 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
5210 (tls_script_test_SOURCES): Define.
5211 (tls_script_test_DEPENDENCIES): Define.
5212 (tls_script_test_LDFLAGS): Define.
5213 (tls_script_test_LDADD): Define.
5214 * testsuite/Makefile.in: Rebuild.
5216 2010-03-22 Doug Kwan <dougkwan@google.com>
5218 * arm.cc (Arm_relocate_functions::abs8,
5219 Arm_relocate_functions::abs16): Use correct check for overflow
5220 specified in the ARM ELF specs.
5221 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
5222 target of a BLX instruction specially.
5223 (Reloc_stub::stub_type_for_reloc): Ditto.
5224 (Relocate::relocate): Use symbolic names instead of numeric relocation
5225 codes to report error.
5226 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
5228 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
5229 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
5230 thumb2_blx_out_of_range.stdout
5231 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
5232 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
5233 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
5234 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
5235 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
5236 thumb2_blx_in_range, thumb2_blx_in_range.o,
5237 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
5238 thumb2_blx_out_of_range.o): New rules.
5239 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
5240 thumb2_blx_in_range and thumb2_blx_out_of_range.
5241 * testsuite/Makefile.in: Regenerate.
5242 * arm_branch_in_range.sh: Add tests for THUMB BLX.
5243 * testsuite/thumb_blx_in_range.s: New file.
5244 * testsuite/thumb_blx_out_of_range.s: New file.
5246 2010-03-22 Rafael Espindola <espindola@google.com>
5248 * archive.cc (Should_include): Move to archive.h.
5249 (should_include_member): Make it a member of Archive.
5251 (Add_lib_group_symbols): New.
5252 * archive.h: Include options.h.
5253 (Archive_member): Moved from Archive.
5254 (Should_include): Moved from archive.cc.
5256 (Add_lib_group_symbols): New.
5257 * dynobj.cc (do_should_include_member): New.
5258 * dynobj.h (do_should_include_member): New.
5259 * gold.cc (queue_initial_tasks): Update call to queue.
5260 * main.cc (main): Print lib group stats.
5261 * object.cc (do_should_include_member): New.
5262 * object.h: Include archive.h.
5263 (Object::should_include_member): New.
5264 (Object::do_should_include_member): New.
5265 (Sized_relobj::do_should_include_member): New.
5266 * options.cc (General_options::parse_start_lib): New.
5267 (General_options::parse_end_lib): New.
5268 (Input_arguments::add_file): Handle lib groups.
5269 (Input_arguments::start_group): Check we are not in a lib.
5270 (Input_arguments::start_lib): New.
5271 (Input_arguments::end_lib): New.
5272 * options.h (General_options): Add start_lib and end_lib.
5273 (Input_argument::lib_): New.
5274 (Input_argument::lib): New.
5275 (Input_argument::is_lib): New.
5276 (Input_file_lib): New.
5277 (Input_arguments::in_lib_): New.
5278 (Input_arguments::in_lib): New.
5279 (Input_arguments::start_lib): New.
5280 (Input_arguments::end_lib_): New.
5281 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5282 in unused members as preempted.
5283 (Sized_pluginobj::do_should_include_member): New.
5284 * plugin.h (Sized_pluginobj::do_should_include_member): New.
5285 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5287 (Read_symbols::do_whole_lib_group): New.
5288 (Read_symbols::do_lib_group): New.
5289 (Read_symbols::do_read_symbols): Handle lib groups.
5290 (Read_symbols::get_name): Handle lib groups.
5291 * readsyms.h (Read_symbols): Add an archive member pointer.
5292 (Read_symbols::do_whole_lib_group): New.
5293 (Read_symbols::do_lib_group): New.
5294 (Read_symbols::member_): New.
5295 * script.cc (read_input_script): Update call to queue_soon.
5297 2010-03-19 Doug Kwan <dougkwan@google.com>
5299 * arm.cc (Stub_table::Stub_table): Initialize new data members
5300 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5301 (Stub_table::add_reloc_stub): Assign stub offset and update
5302 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5303 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
5305 (Stub_table::update_data_size_and_addralign): Use
5306 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
5307 instead of going over all reloc stubs.
5308 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
5309 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5310 Stringpool_template::offset_ to size of Stringpool_char.
5311 (Stringpool_template::new_key_offset): Remove code to initialize
5312 Stringpool_template::offset_.
5313 * stringpool.h (Stringpool_template::set_no_zero_null): Set
5314 Stringpool_template::offset_ to zero.
5316 2010-03-15 Doug Kwan <dougkwan@google.com>
5318 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5320 (Stringpool_template::new_key_offset): New method.
5321 (Stringpool_template::add_string): Assign offsets when adding new
5323 (Stringpool_template::set_string_offsets): Do not set string offsets
5324 when not optimizing.
5325 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5327 (Chunked_vector::clear): Clear size_.
5328 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5329 (Chunked_vector::size): Return size_.
5330 (Chunked_vector::push_back): Use size_ to find insert position.
5331 (Chunked_vector::size_): New data member.
5332 (Stringpool_template::set_no_zero_null): Assert string set is empty.
5333 (Stringpool_template::new_key_offset): New method declaration.
5334 (Stringpool_template::offset_): New data member.
5336 2010-03-15 Rafael Espindola <espindola@google.com>
5338 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
5339 Add_symbols' constructor.
5340 * readsyms.h (Add_symbols): Remove the input_group member.
5342 2010-03-10 Ian Lance Taylor <iant@google.com>
5344 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
5345 target to ask whether a reference to a symbol requires a stack
5347 * target.h (Target::is_call_to_non_split): New function.
5348 (Target::do_is_call_to_non_split): Declare virtual function.
5349 * target.cc: Include "symtab.h".
5350 (Target::do_is_call_to_non_split): New function.
5351 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
5353 2010-03-10 Cary Coutant <ccoutant@google.com>
5355 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
5356 (File_read::open[1]): Remove initial mapping of whole_file_view_.
5357 (File_read::open[2]): Add whole_file_view_ to list of views.
5358 (File_read::make_view): Remove test of whole_file_view_.
5359 (File_read::find_or_make_view): Create whole_file_view_ if
5361 (File_read::clear_views): Replace bool parameter with enum;
5362 adjust all callers. Don't delete views with permanent data;
5363 do delete cached views and views from archives if
5364 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
5365 if clearing the corresponding view.
5366 * fileread.h (File_read::Clear_views_mode): New enum.
5367 (File_read::View::is_permanent_view): New method.
5368 (File_read::clear_views): Replace bool parameter
5369 with enum; adjust all callers.
5370 * options.h (General_options): Change keep_files_mapped option;
5371 add map_whole_files.
5372 * readsyms.cc (Add_symbols::run): Delete sd_ object before
5374 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
5377 2010-03-10 David S. Miller <davem@davemloft.net>
5379 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
5381 2010-03-09 Sriraman Tallam <tmsriram@google.com>
5383 * icf.cc (get_section_contents): Add '@' marker after processing the
5386 2010-03-08 Doug Kwan <dougkwan@google.com>
5388 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
5389 due to a conversion warning.
5390 (Arm_relobj::update_output_local_symbol_count): Check for local
5391 symbol with unset output index.
5393 2010-03-05 Ian Lance Taylor <iant@google.com>
5395 * options.h (class General_options): Add --spare-dynamic-tags.
5396 * output.cc (Output_data_dynamic::set_final_data_size): Implement
5397 --spare-dynamic-tags.
5399 2010-03-05 Ian Lance Taylor <iant@google.com>
5401 * incremental.cc: Include "libiberty.h".
5403 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
5405 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
5406 function, is_info_ member.
5407 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
5408 (Versions::Versions): Update caller.
5409 (Versions::define_base_version): Likewise.
5410 (Versions::add_def): Likewise.
5412 2010-03-03 Sriraman Tallam <tmsriram@google.com>
5414 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
5415 (Scan::possible_function_pointer_reloc): New function.
5416 (Scan::local_reloc_may_be_function_pointer): Change to call
5417 possible_function_pointer_reloc.
5418 (Scan::global_reloc_may_be_function_pointer): Ditto.
5419 * icf.h (Icf::check_section_for_function_pointers): Change to reject
5420 relocations in ".data.rel.ro._ZTV" section.
5421 * testsuite/icf_safe_so_test.sh: Change to pass i386.
5422 * testsuite/icf_safe_so_test.cc: Ditto.
5423 * testsuite/icf_safe_test.cc: Ditto.
5424 * testsuite/icf_safe_test.sh: Ditto.
5426 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5427 Ian Lance Taylor <iant@google.com>
5429 * target-reloc.h (relocate_section): Check the symbol table index
5430 for -1U before setting the local symbol index.
5431 (scan_relocatable_relocs): If copying the relocation, record that
5432 the local symbol is required.
5433 * object.h (Symbol_value::is_output_symtab_index_set): New
5435 (Symbol_value::may_be_discarded_from_output_symtab): New
5437 (Symbol_value::has_output_symtab_entry): New function.
5438 (Symbol_value::needs_output_symtab_entry): Remove.
5439 (Symbol_value::output_symtab_index): Make sure the symbol index is
5441 (Symbol_value::set_output_symtab_index): Make sure the symbol
5442 index is not set. Make sure the new index is valid.
5443 (Symbol_value::set_must_have_output_symtab_entry): New function.
5444 (Symbol_value::has_output_dynsym_entry): New function.
5445 (Symbol_value::set_output_dynsym_index): Make sure the new index
5447 (Sized_relobj::set_must_have_output_symtab_entry): New function.
5448 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
5449 local symbol if permitted.
5450 (Sized_relobj::do_finalize_local_symbols): Call
5451 is_output_symtab_index_set rather than needs_output_symtab_entry.
5452 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
5453 rather than needs_output_symtab_entry. Call
5454 has_output_dynsym_entry rather than needs_output_dynsym_entry.
5455 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
5456 is_output_symtab_index_set rather than needs_output_symtab_entry.
5457 * testsuite/discard_locals_relocatable_test.c: New file.
5458 * testsuite/discard_locals_test.sh: Test -r.
5459 * testsuite/Makefile.am (check_DATA): Add
5460 discard_locals_relocatable_test1.syms,
5461 discard_local_relocatable_test2.syms.
5462 (MOSTLYCLEANFILES): Likewise. Also add
5463 discard_locals_relocatable_test1.lout and
5464 discard_locals_relocatable_test2.out.
5465 (discard_locals_relocatable_test1.syms): New target.
5466 (discard_locals_relocatable_test.o): New target.
5467 (discard_locals_relocatable_test1.out): New target.
5468 (discard_locals_relocatable_test2.syms): New target.
5469 (discard_locals_relocatable_test2.out): New target.
5470 (various): Add missing ../ld-new dependencies.
5471 * testsuite/Makefile.in: Rebuild.
5473 2010-03-03 Nick Clifton <nickc@redhat.com>
5475 * po/fi.po: New Finnish translation.
5477 2010-03-01 Doug Kwan <dougkwan@google.com>
5479 * layout.cc (Layout::Layout): Force section types of .init_array*,
5480 .preinit_array* and .fini_array* sections.
5481 * output.cc (Output_section::Input_section_sort_entry::has_priority):
5482 Fix check of return value of std::string::find.().
5483 (Output_section::Input_section_sort_compare::operator()): Remove
5484 comment about .init_array.
5485 (Output_section::Input_section_sort_init_fini_compare::operator()):
5487 (Output_section::sort_attached_input_sections): Handle .init_array
5488 and .fini_array specially.
5489 * output.h (Output_section::Inut_section_sort_compare): Update
5491 (Output_section::Input_section_sort_init_fini_compare): New struct.
5493 2010-02-26 Doug Kwan <dougkwan@google.com>
5495 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
5496 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
5497 * testsuite/debug_msg.sh: Avoid matching source line number for
5498 use of global variable undef_int.
5500 2010-02-26 Doug Kwan <dougkwan@google.com>
5502 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
5503 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
5504 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
5505 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
5506 * options.cc (General_options::General_options): Initialize member
5508 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
5509 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
5510 and rm_no_fix_v4bx.stdout
5511 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
5512 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
5513 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
5514 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
5515 and arm_no_fix_v4bx.
5516 * Makefile.in: Regenerate.
5517 * testsuite/arm_fix_v4bx.s: New file.
5518 * testsuite/arm_fix_v4bx.sh: Ditto.
5520 2010-02-24 Doug Kwan <dougkwan@google.com>
5522 * arm.cc (Target_arm::got_section): Make the .got section the first
5523 non RELRO section in the data segment.
5524 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
5525 suffixes of section names.
5527 2010-02-24 Doug Kwan <dougkwan@google.com>
5529 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
5530 flags and attributes merging if an input file is a binary file.
5531 * fileread.cc (Input_file::open): Record format of original file.
5532 * fileread.h (Input_file::Format): New enum type.
5533 (Input_file::Input_file): Initialize data member format_.
5534 (Input_file::format): New method definition.
5535 (Input_file::format_):: New data member.
5537 2010-02-24 Doug Kwan <dougkwan@google.com>
5539 * arm.cc (Arm_output_data_got): New class.
5540 (ARM_TCB_SIZE): New constant
5541 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
5542 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
5543 If user uses a script with a SECTIONS clause, issue only a warning
5544 for a misplaced EXIDX input section. Otherwise, issue an error.
5545 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
5547 (Target_arm::got_mode_index_entry): Handle static linking.
5548 (Target_arm::Scan::local): Ditto.
5549 (Target_arm::Scan::global): Ditto.
5550 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
5551 all incorrectly implemented relocations.
5552 (Target_arm::fix_exidx_coverage): Pass layout to
5553 Arm_output_section::fix_exidx_coverage.
5554 * layout.cc (Layout::section_name_mapping): Remove trailing dots
5555 from ".ARM.exidx." and ".ARM.extab.".
5557 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5559 * arm.cc (Target_arm::do_finalize_sections): Create attribute
5560 section if it does not already exist.
5561 * attributes.cc (Attributes_section_data::Attributes_section_data):
5562 Don't crash if size is zero.
5564 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5565 Ian Lance Taylor <iant@google.com>
5567 * gold.cc (queue_middle_tasks): If no input files were opened,
5569 * workqueue.h (Task_function::Task_function): Assert that there is
5572 2010-02-22 Doug Kwan <dougkwan@google.com>
5574 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
5575 * icf.cc (get_section_contents): Cast snprintf arguments to long long
5576 types to avoid warnings due to different uint64_t implementations
5579 2010-02-21 Doug Kwan <dougkwan@google.com>
5581 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
5582 handling of the maximum backward branch offset.
5583 (Arm_relocate_functions::thumb_branch_common): Ditto.
5584 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
5585 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
5586 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
5587 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
5588 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
5589 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
5590 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
5591 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
5592 thumb_bl_out_of_range thumb_bl_out_of_range.o,
5593 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
5594 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
5595 thumb2_bl_out_of_range.o): New rules.
5596 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
5597 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
5598 thumb2_bl_out_of_range
5599 * testsuite/Makefile.in: Regenerate.
5600 * testsuite/arm_bl_in_range.s: New file.
5601 * testsuite/arm_bl_out_of_range.s: Ditto.
5602 * testsuite/arm_branch_in_range.sh: Ditto.
5603 * testsuite/arm_branch_range.t: Ditto.
5604 * testsuite/thumb2_branch_range.t: Ditto.
5605 * testsuite/thumb_bl_in_range.s: Ditto.
5606 * testsuite/thumb_bl_out_of_range.s: Ditto.
5607 * testsuite/thumb_branch_range.t: Ditto.
5609 2010-02-20 Sriraman Tallam <tmsriram@google.com>
5611 * gc.h (gc_process_relocs): Change vectors to point to the new list.
5612 Add reloc offset information.
5613 * icf.cc (get_section_contents): Change iterators to point to the new
5614 vectors. Add reloc offset information to the contents.
5615 * icf.h (Icf::Sections_reachable_info): New typedef.
5616 (Icf::Sections_reachable_list): New typedef.
5617 (Icf::Offset_info): New typedef.
5618 (Icf::Reloc_info): New struct typedef.
5619 (Icf::Reloc_info_list): New typedef.
5620 (Icf::symbol_reloc_list): Delete method.
5621 (Icf::addend_reloc_list): Delete method.
5622 (Icf::section_reloc_list): Delete method.
5623 (Icf::reloc_info_list): New method.
5624 (Icf::reloc_info_list_): New member.
5626 2010-02-19 Doug Kwan <dougkwan@google.com>
5628 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
5629 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
5630 * arm.cc (Arm_relocation_functions): New forward declaration.
5631 (Target_arm::Target_arm): Initialize new data members
5632 got_mod_index_offset_ and tls_base_symbol_defined_.
5633 (Target_arm::Relocate::relocate_tls): New method.
5634 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
5635 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
5637 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
5638 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
5639 (Target_arm::got_mod_index_offset_,
5640 Target_arm::tls_base_symbol_defined_): New data members.
5641 (Target_arm::Scan::local, Target::Scan::global,
5642 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
5645 2010-02-18 Doug Kwan <dougkwan@google.com>
5647 * arm.cc (Arm_relobj::find_linked_text_section): New method.
5648 (Arm_relobj::make_exidx_input_section): Pass section index of linked
5649 text section as a parameter becuase some broken tools may not set
5650 the link in section header.
5651 (Target_arm::has_got_section): New method.
5652 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
5653 without any mapping symbol as data only. Remove warning.
5654 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
5655 link in its section header, try to discover the link by inspecting the
5656 REL31 relocation at the beginning of the section.
5657 (Target_arm::Scan::check_non_pic): Report name of offending relocation
5659 (Target_arm::Scan::global): Treat any reference to the symbol
5660 _GLOBAL_OFFSET_TABLE_ as a GOT access.
5662 2010-02-12 Sriraman Tallam <tmsriram@google.com>
5664 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
5665 (Scan::global_reloc_may_be_function_pointer): New function.
5666 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5667 (Scan::global_reloc_may_be_function_pointer): New function.
5668 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5669 (Scan::global_reloc_may_be_function_pointer): New function.
5670 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
5671 (Scan::global_reloc_may_be_function_pointer): New function.
5672 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
5673 (Scan::global_reloc_may_be_function_pointer): New function.
5674 (Scan::possible_function_pointer_reloc): New function.
5675 (Target_x86_64::can_check_for_function_pointers): New function.
5676 * gc.h (gc_process_relocs): Scan relocation types to determine if
5677 function pointers were taken for targets that support it.
5678 * icf.cc (Icf::find_identical_sections): Include functions for
5679 folding in safe ICF whose pointer is not taken.
5680 * icf.h (Secn_fptr_taken_set): New typedef.
5681 (fptr_section_id_): New member.
5682 (section_has_function_pointers): New function.
5683 (set_section_has_function_pointers): New function.
5684 (check_section_for_function_pointers): New function.
5685 * options.h: Fix comment for safe ICF option.
5686 * target.h (can_check_for_function_pointers): New function.
5687 * testsuite/Makefile.am: Add icf_safe_so_test test case.
5688 Modify icf_safe_test for X86-64.
5689 * testsuite/Makefile.in: Regenerate.
5690 * testsuite/icf_safe_so_test.cc: New file.
5691 * testsuite/icf_safe_so_test.sh: New file.
5692 * testsuite/icf_safe_test.cc (kept_func_3): New function.
5693 (main): Change to take pointer to function kept_func_3.
5694 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
5695 folding is done correctly for X86-64.
5697 2010-02-12 David S. Miller <davem@davemloft.net>
5699 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
5700 is_symbolless parameter.
5701 (Output_reloc<SHT_REL>::is_symbolless): New.
5702 (Output_reloc<SHT_REL>::is_symbolless_): New.
5703 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
5704 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
5705 (Output_reloc<SHT_RELA>::is_symbolless): New.
5706 (Output_data_reloc::add_global): Handle is_symbolless.
5707 (Output_data_reloc::add_global_relative): Likewise.
5708 (Output_data_reloc::add_local): Likewise.
5709 (Output_data_reloc::add_local_relative): Likewise.
5710 (Output_data_reloc::add_symbolless_global_addend): New.
5711 (Output_data_reloc::add_symbolless_local_addend): New.
5712 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
5714 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
5715 instead of ->is_relative_
5716 (Output_reloc::write): Likewise.
5717 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
5718 (Output_reloc::write_rel): Simplify.
5720 * sparc.cc (Target_sparc::Scan::local): Use
5721 ->add_symbolless_local_addend as needed.
5722 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
5723 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
5724 based upon relocation offset.
5726 2010-02-11 Doug Kwan <dougkwan@google.com>
5728 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
5729 (Target_arm::Scan::global): Ditto. Also remove a comment before the
5730 beginning of function.
5731 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
5732 and MOVT_ABS relocations. Those are non issued in scanning. Fix
5733 parameter is_32bit in calls to should_apply_static_reloc.
5734 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
5735 (check_DATA): Add arm_abs_global.stdout.
5736 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
5737 arm_abs_global.stdout): New rules.
5738 (MOSTLLYCLEANFILES): Add arm_abs_global
5739 * Makefile.in: Regenerate.
5740 * testsuite/arm_abs_global.s: New file.
5741 * testsuite/arm_abs_global.sh: Ditto.
5742 * testsuite/arm_abs_lib.s: Ditto.
5744 2010-02-11 Ian Lance Taylor <iant@google.com>
5746 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
5748 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
5749 Allocate_commons_task first.
5750 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
5751 task, rather than symtab_lock_.
5752 (Gc_process_relocs::~Gc_process_relocs): New function.
5753 (Gc_process_relocs::is_runnable): Check this_blocker_.
5754 (Gc_process_relocs::locks): Use next_blocker_ rather than
5756 (Scan_relocs::~Scan_relocs): New function.
5757 (Scan_relocs::is_runnable): Check this_blocker_ rather than
5759 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
5761 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
5762 fields. Add this_blocker_ and next_blocker_ fields. Adjust
5763 constructor accordingly.
5764 (class Gc_process_relocs): Likewise.
5765 (class Scan_relocs): Likewise.
5766 * common.h (class Allocate_commons_task): Remove symtab_lock_
5767 field, and corresponding constructor parameter.
5768 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
5770 (Allocate_commons_task::locks): Likewise.
5772 2010-02-11 Ian Lance Taylor <iant@google.com>
5774 * gold-threads.h (class Once): Define.
5775 (class Initialize_lock): Rewrite as child of Once.
5776 * gold-threads.cc (class Once_initialize): Define.
5777 (once_pointer_control): New static variable.
5778 (once_pointer, once_arg): New static variables.
5779 (c_run_once): New static function.
5780 (Once::Once, Once::run_once, Once::internal_run): New functions.
5781 (class Initialize_lock_once): Remove.
5782 (initialize_lock_control): Remove.
5783 (initialize_lock_pointer): Remove.
5784 (initialize_lock_once): Remove.
5785 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
5786 (Initialize_lock::initialize): Rewrite.
5787 (Initialize_lock::do_run_once): New function.
5788 * archive.cc (Archive::interpret_header): Only clear name if it is
5790 * fileread.cc: Include "gold-threads.h"
5791 (file_counts_lock): New static variable.
5792 (file_counts_initialize_lock): Likewise.
5793 (File_read::release): Only increment counts when using --stats.
5794 Use a lock around the increment.
5795 * parameters.cc (class Set_parameters_target_once): Define.
5796 (set_parameters_target_once): New static variable.
5797 (Parameters::Parameters): Move here from parameters.h.
5798 (Parameters::set_target): Rewrite.
5799 (Parameters::set_target_once): New function.
5800 (Parameters::clear_target): Move here and rewrite.
5801 * parameters.h (class Parameters): Update declarations. Add
5802 set_parameters_target_once_ field.
5803 (Parameters::Parameters): Move to parameters.cc.
5804 (Parameters::clear_target): Likewise.
5805 * readsyms.cc (Read_symbols::do_group): Create a Start_group
5807 (Start_group::~Start_group): New function.
5808 (Start_group::is_runnable): New function.
5809 (Start_group::locks, Start_group::run): New functions.
5810 (Finish_group::run): Change saw_undefined to size_t.
5811 * readsyms.h (class Start_group): Define.
5812 (class Finish_group): Change saw_undefined_ field to size_t.
5813 (Finish_group::Finish_group): Remove saw_undefined and
5814 this_blocker parameters. Change all callers.
5815 (Finish_group::set_saw_undefined): New function.
5816 (Finish_group::set_blocker): New function.
5817 * symtab.h (class Symbol_table): Change saw_undefined to return
5818 size_t. Change saw_undefined_ field to size_t.
5819 * target-select.cc (Set_target_once::do_run_once): New function.
5820 (Target_selector::Target_selector): Initialize set_target_once_
5821 field. Don't initialize lock_ and initialize_lock_ fields.
5822 (Target_selector::instantiate_target): Rewrite.
5823 (Target_selector::set_target): New function.
5824 * target-select.h (class Set_target_once): Define.
5825 (class Target_selector): Update declarations. Make
5826 Set_target_once a friend. Remove lock_ and initialize_lock_
5827 fields. Add set_target_once_ field.
5829 2010-02-10 Ian Lance Taylor <iant@google.com>
5831 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
5833 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
5834 (queue_middle_tasks): Add all blockers before queueing any tasks.
5835 (queue_final_tasks): Likewise.
5836 * token.h (Task_token::add_blockers): New function.
5837 * object.h (Input_objects::number_of_relobjs): New function.
5839 2010-02-10 Ian Lance Taylor <iant@google.com>
5841 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
5842 shared, not if not position independent.
5843 * x86_64.cc (Relocate::relocate_tls): Likewise.
5844 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
5845 (tls_pie_pic_test): New target.
5846 * testsuite/Makefile.in: Rebuild.
5848 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
5849 (tls_test_main_pie.o, tls_test_pie.o): New targets.
5850 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
5851 * testsuite/Makefile.in: Rebuild.
5853 2010-02-09 David S. Miller <davem@davemloft.net>
5855 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
5856 R_SPARC_RELATIVE using ->add_local_relative().
5857 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
5859 * output.h (Output_data_dynamic::add_section_size): New method
5860 that takes two Output_data objects.
5861 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
5862 entry param. Handle it in initializers.
5863 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
5864 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
5865 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
5867 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
5868 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
5869 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
5870 for dynrel_includes_plt.
5871 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5872 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5873 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
5875 (Target_sparc::do_finalize_sections): Update to pass true for
5876 dynrel_includes_plt.
5877 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
5878 output before .rela.plt
5879 (Target_powerpc::do_finalize_sections): Update to pass true for
5880 dynrel_includes_plt when 32-bit.
5882 2010-02-08 Doug Kwan <dougkwan@google.com>
5884 * arm.cc (Arm_relobj::simple_input_section_output_address): New
5886 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
5887 Arm_relobj::scan_section_for_cortex_a8_stubs,
5888 Arm_relobj::do_relocation_section): Instead of calling
5889 Output_section::output_address, use faster
5890 Arm_relobj::simple_input_section_output_address.
5892 2010-02-08 David S. Miller <davem@davemloft.net>
5894 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
5895 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
5896 relocation helper function.
5898 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
5899 just like R_SPARC_GOT{10,13,22}.
5900 (Target_sparc::Scan::local): Likewise.
5901 (Target_sparc::Relocate:relocate): Likewise.
5903 2010-02-06 Ian Lance Taylor <iant@google.com>
5905 * configure.ac: Rewrite targetobjs duplicate removal code to use
5906 only shell constructs.
5907 * configure: Rebuild.
5909 2010-02-05 Doug Kwan <dougkwan@google.com>
5912 * arm.cc (Arm_relobj::section_is_scannable): New method.
5913 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
5914 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
5916 2010-02-04 Doug Kwan <dougkwan@google.com>
5919 * arm-reloc-property.cc (cstdio): Include.
5920 * configure.ac (targetobjs): Remove duplicates.
5921 * configure: Regenerate.
5922 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
5923 big and little endian version for a given address size.
5925 2010-02-03 Doug Kwan <dougkwan@google.com>
5927 * arm-reloc-property.cc
5928 (Arm_reloc_property_table::reloc_name_in_error_message): New method
5930 * arm-reloc-property.h
5931 (Arm_reloc_property_table::get_implemented_static_reloc_property):
5932 New method definition.
5933 (Arm_reloc_property_table::reloc_name_in_error_message): New method
5935 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
5937 (GOT_PREL): Change implemented to Y.
5938 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
5939 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
5940 (Arm_relocate_functions::movw_abs_nc): Remove method.
5941 (Arm_relocate_functions::movt_abs): Ditto.
5942 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
5943 (Arm_relocate_functions::thm_movt_abs): Ditto.
5944 (Arm_relocate_functions::movw_rel_nc): Ditto.
5945 (Arm_relocate_functions::movw_rel): Ditto.
5946 (Arm_relocate_functions::movt_rel): Ditto.
5947 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
5948 (Arm_relocate_functions:thm_movw_rel): Ditto.
5949 (Arm_relocate_functions:thm_movt_rel): Ditto.
5950 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
5951 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
5952 New method definitions.
5953 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
5954 (Arm_relocation_functions::arm_grp_ldr): Ditto.
5955 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
5956 (Arm_relocation_functions::arm_grp_ldc): Ditto.
5957 (Target_arm::Relocate::relocate): Check for non-static or
5958 unimplemented relocation code and exit early. Change calls to
5959 Target_arm::reloc_uses_thumb_bit and
5960 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
5961 instead. Refactor code to handle similar relocations to increase
5962 code sharing. Remove check for unsupported relocation code in switch
5964 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
5965 relocation property table to find out size. Change error message to
5966 print out the name of a relocation code instead of the numeric value.
5967 (Target_arm::scan_reloc_for_stub): Use relocation property table
5968 instead of calling Target_arm::reloc_uses_thumb_bit().
5970 2010-02-02 Doug Kwan <dougkwan@google.com>
5972 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
5973 types of relaxed input section.
5975 2010-02-02 Doug Kwan <dougkwan@google.com>
5977 * Makefile.am (HFILES): Add arm-reloc-property.h.
5979 (TARGETSOURCES): Add arm-reloc-property.cc
5980 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
5981 (libgold_a_SOURCES): $(DEFFILES)
5982 * Makefile.in: Regenerate.
5983 * arm-reloc-property.cc: New file.
5984 * arm-reloc-property.h: New file.
5985 * arm-reloc.def: New file.
5986 * arm.cc: Update comments.
5987 (arm-reloc-property.h): New included header.
5988 (arm_reloc_property_table): New global variable.
5989 (Target_arm::do_select_as_default_target): New method definition.
5990 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
5991 arm-reloc-property to targ_extra_obj.
5992 * parameters.cc (set_parameters_target): Call
5993 Target::select_as_default_target().
5994 * target.h (Target::select_as_default_target): New method definition.
5995 (Target::do_select_as_default_target): Same.
5997 2010-02-01 Doug Kwan <dougkwan@google.com>
5999 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
6000 first_output_text_section_.
6001 (Arm_exidx_fixup::first_output_text_section): New method definition.
6002 (Arm_exidx_fixup::first_output_text_section_): New data member.
6003 (Arm_exidx_fixup::process_exidx_section): Record the first text
6004 output section seen.
6005 (Arm_output_section::fix_exidx_coverage): Set correct linked section
6006 and entsize in output section header.
6008 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6010 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
6011 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
6012 (Arm_relocate_functions::thm_alu11): New Method.
6013 (Arm_relocate_functions::thm_pc8): New Method.
6014 (Arm_relocate_functions::thm_pc12): New Method.
6015 (Target_arm::Scan::local): Handle the relocations.
6016 (Target_arm::Scan::global): Likewise.
6017 (Target_arm::Relocate::relocate): Likewise.
6018 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6020 2010-01-29 Doug Kwan <dougkwan@google.com>
6022 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
6023 of relocation types as ld.
6025 2010-01-29 Doug Kwan <dougkwan@google.com>
6027 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
6029 (Arm_relocate_functions::thumb_branch_common): Ditto.
6030 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
6031 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
6032 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
6033 Arm_relocate_functions::jump24): Remove.
6034 (Target_arm::Relocate::relocate): Adjust code to call
6035 Arm_relocation_functions::arm_branch_common and
6036 Arm_relocation_functions::thumb_branch_common instead of their removed
6037 wrappers. Merge switch-cases together to reduce source code size.
6039 2010-01-29 Doug Kwan <dougkwan@google.com>
6041 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
6042 output_local_symbol_count_needs_update_.
6043 (Arm_relobj::output_local_symbol_count_needs_update,
6044 Arm_relobj::set_output_local_symbol_count_needs_update,
6045 Arm_relobj::update_output_local_symbol_count): New methods.
6046 (Arm_relobj::output_local_symbol_count_needs_update_): New data
6048 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
6049 of pointed function as in a R_ARM_PREL31 relocation.
6050 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
6051 for output local symbol count updating.
6052 (Target_arm::do_relax): Update output local symbol counts in objects
6054 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
6056 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6058 * arm.cc: Added support for the ARM relocations:
6059 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
6060 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
6061 (Arm_relocate_functions::movw_rel_nc): Renamed (was
6063 (Arm_relocate_functions::movw_rel): New method.
6064 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
6065 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
6067 (Arm_relocate_functions::thm_movw_rel): New method.
6068 (Arm_relocate_functions::thm_movt_rel): Renamed (was
6070 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
6072 (Target_arm::Scan::global): Likewise.
6073 (Target_arm::Relocate::relocate): Likewise.
6074 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6077 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6079 * arm.cc: Added support for ARM group relocations.
6080 (Target_arm::reloc_needs_sym_origin): New method.
6081 (Arm_relocate_functions::calc_grp_kn): New method.
6082 (Arm_relocate_functions::calc_grp_residual): New method.
6083 (Arm_relocate_functions::calc_grp_gn): New method.
6084 (Arm_relocate_functions::arm_grp_alu): New Method.
6085 (Arm_relocate_functions::arm_grp_ldr): New Method.
6086 (Arm_relocate_functions::arm_grp_ldrs): New Method.
6087 (Arm_relocate_functions::arm_grp_ldc): New Method.
6088 (Target_arm::Scan::local): Handle the ARM group relocations.
6089 (Target_arm::Scan::global): Likewise.
6090 (Target_arm::Relocate::relocate): Likewise.
6091 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6094 2010-01-26 Doug Kwan <dougkwan@google.com>
6096 * arm.cc (set): Include.
6097 (class Arm_exidx_fixup): Change type of last_input_section_ to const
6099 (Arm_output_section::Text_section_list): New type.
6100 (Arm_output_section::append_text_sections_to_list): New method.
6101 (Arm_output_section::fix_exidx_coverage): Ditto.
6102 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
6103 (Arm_relobj::convert_input_section_to_relaxed_section): Use
6104 Relobj::set_section_offset() instead of
6105 Sized_relobj::invalidate_section_offset().
6106 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
6107 parameter for section headers. Ignore relocation sections for
6108 unallocated sections and EXIDX sections.
6109 (Target_arm::fix_exidx_coverage): New method.
6110 (Target_arm::output_section_address_less_than): New type.
6111 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
6112 linked text section instead of the EXIDX section.
6113 (Arm_output_section::create_stub_group): Add an assertion to check
6114 that this is not an EXIDX output section.
6115 (Arm_output_section::append_text_sections_to_list): New method.
6116 (Arm_output_section::fix_exidx_coverage): Ditto.
6117 (Arm_relobj::scan_sections_for_stubs): Adjust call to
6118 Arm_relobj::section_needs_reloc_stub_scanning.
6119 (Target_arm::do_relax): Fix EXIDX output section coverage in the
6121 (Target_arm::fix_exidx_coverage): New method.
6122 * object.h (Relobj::set_output_section): New method.
6123 (Sized_relobj::invalidate_section_offset): Remove method.
6124 (Sized_relobj::do_invalidate_section_offset): Remove method.
6125 (Sized_relobj::do_set_section_offset): Handle offset value -1.
6127 2010-01-25 Doug Kwan <dougkwan@google.com>
6129 * arm.cc (Arm_exidx_merged_section::do_output_offset):
6130 Fix warning due to signed and unsigned comparison on a 32-bit host.
6132 2010-01-22 Doug Kwan <dougkwan@google.com>
6134 * arm.cc (Target_arm::do_relax): Record an output section for section
6135 offset adjustment it contains any stub table that has changed.
6136 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
6137 offsets in an output section if necessary.
6138 * output.cc (Output_section::Output_section): Initialize
6139 section_offsets_need_adjustments_.
6140 (Output_section::add_input_section_for_script): Renamed to
6141 Output_section::add_simple_input_section.
6142 (Output_section::save_states): Add a comment.
6143 (Output_section::discard_states): New method defintion.
6144 (Output_section::adjust_section_offsets): Same.
6145 * output.h (Output_section::add_input_section_for_script): Renamed to
6146 Output_section::add_simple_input_section.
6147 (Output_section::discard_states): New method declaration.
6148 (Output_section::adjust_section_offsets): Same.
6149 (Output_section::section_offsets_need_adjustment,
6150 Output_section::set_section_offsets_need_adjustment): New method
6152 (Output_section::section_offsets_need_adjustment_): New data member.
6153 * script-sections.cc
6154 (Output_section_element_input::set_section_address): Adjust code for
6155 renaming of Output_section::add_input_section_for_script.
6156 (Orphan_output_section::set_section_address): Same.
6158 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6160 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
6161 Fix_v4bx enum values .
6162 * gold/options.h (General_options): New option definitions.
6163 (General_options::fix_v4bx): New method.
6164 (General_options::Fix_v4bx): New enum.
6165 * gold/options.cc (General_options::parse_fix_v4bx): New method.
6166 (General_options::parse_fix_v4bx_interworking): New method.
6168 2010-01-22 Doug Kwan <dougkwan@google.com>
6170 * arm.cc (Arm_exidx_fixup): New class.
6172 2010-01-21 Doug Kwan <dougkwan@google.com>
6174 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
6176 (Arm_exidx_section_offset_map): New type.
6178 2010-01-21 Doug Kwan <dougkwan@google.com>
6180 * arm.cc (Arm_exidx_input_section): New class.
6181 (Arm_relobj::exidx_input_section_by_link,
6182 Arm_relobj::exidx_input_section_by_shndx,
6183 Arm_relobj::make_exidx_input_section): New methods.
6184 (read_arm_attributes_section): Remove.
6185 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
6186 information about them.
6187 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
6190 2010-01-20 Doug Kwan <dougkwan@google.com>
6192 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
6193 Input_section_specifier to Section_id.
6194 (Target_arm::new_arm_input_section: Adjust code for change of key
6196 (Target_arm::find_arm_input_section): Ditto.
6197 * gc.h (object.h): Include for Section_id nand Section_id_hash.
6198 (Section_id): Remove.
6199 (Garbage_collection::Section_id_hash): Remove.
6200 * icf.h (object.h): Include for Section_id nand Section_id_hash.
6201 (Section_id): Remove.
6202 (Icf::Section_id_hash): Remove.
6203 * object.h (Section_id, Const_section_id, Section_id_hash,
6204 Const_section_id_hash): New type definitions.
6205 * output.cc (Output_section::add_relaxed_input_section): Change to
6206 use Const_section_id instead of Input_section_specifier as key type.
6207 (Output_section::add_merge_input_section): Ditto.
6208 (Output_section::build_relaxation_map): Change to use Section_id
6209 instead of Input_section_specifier as key type.
6210 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6212 (Output_section::convert_input_sections_to_relaxed_sections): Change
6213 to use Const_section_id instead of Input_section_specifier as key type.
6214 (Output_section::find_merge_section): Ditto.
6215 (Output_section::find_relaxed_input_section): Ditto.
6216 * output.h (Input_section_specifier): Remove class.
6217 (Output_section::Output_section_data_by_input_section_map): Change
6218 key type to Const_section_id.
6219 (Output_section::Output_relaxed_input_section_by_input_section_map):
6221 (Output_section::Relaxation_map): Change key type to Section_id.
6223 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6225 * gold/arm.cc: Added support for R_ARM_V4BX relocation
6226 (class Arm_v4bx_stub): New class.
6227 (DEF_STUBS): Updated definition to support v4_veneer_bx.
6228 (Stub_factory::make_arm_v4bx_stub): New method.
6229 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
6230 (Stub_table::empty): Handle v4bx stubs.
6231 (Stub_table::add_arm_v4bx_stub): New method.
6232 (Stub_table::find_arm_v4bx_stub): New method.
6233 (Arm_relocate_functions::v4bx): New method.
6234 (Target_arm::fix_v4bx): New method.
6235 (Target_arm::Target_arm): Handle R_ARM_V4BX.
6236 (Stub_table::relocate_stubs): Likewise.
6237 (Stub_table::do_write): Likewise.
6238 (Stub_table::update_data_size_and_addralign): Likewise.
6239 (Stub_table::finalize_stubs): Likewise.
6240 (Target_arm::Scan::local): Likewise.
6241 (Target_arm::Scan::global): Likewise.
6242 (Target_arm::do_finalize_sections): Likewise.
6243 (Target_arm::Relocate::relocate): Likewise.
6244 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6246 (Target_arm::scan_reloc_for_stub): Likewise.
6247 (Target_arm::scan_reloc_section_for_stubs): Likewise.
6249 2010-01-19 Ian Lance Taylor <iant@google.com>
6251 * output.cc (Output_section_headers::do_sized_write): Write large
6252 segment count to sh_info field.
6253 (Output_file_header::do_sized_write): For large segment count,
6254 write PN_XNUM to e_phnum field.
6256 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6258 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
6259 (Arm_relocate_functions::thm_jump8): New function.
6260 (Arm_relocate_functions::thm_jump11): New function.
6261 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
6263 (Target_arm::Scan::global): Likewise.
6264 (Target_arm::Relocate::relocate): Likewise.
6265 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6268 2010-01-14 Doug Kwan <dougkwan@google.com>
6270 * arm.cc (map, utility): Include headers.
6271 (Target_arm::apply_cortex_a8_workaround): New method.
6272 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
6273 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
6274 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
6275 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
6276 the --[no-]fix-cortex-a8 command line options.
6277 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
6278 (Target_arm::relocate_stub): Use addend in instruction template.
6279 * options.h (DEFINE_bool): Set the user-set flag.
6280 (General_options): Add --[no-]-fix-cortex options.
6281 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
6282 : Update fast look-up map after conversion.
6284 2010-01-14 Sriraman Tallam <tmsriram@google.com>
6286 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6287 in the first pass of do_layout.
6289 2010-01-13 Doug Kwan <dougkwan@google.com>
6291 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6292 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6293 apparent compiler problem of not folding static constant integral
6294 data members of elfcpp::Elf_sizes<32>.
6296 2010-01-13 Doug Kwan <dougkwan@google.com>
6298 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6299 Arm_relobj::section_needs_cortex_a8_stub_scanning,
6300 Arm_relobj::scan_section_for_cortex_a8_erratum,
6301 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
6302 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
6303 sections to scan for relocation stubs into a new method
6304 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
6305 relocation and Cortex-A8 stub scanning.
6306 (Target_arm::do_relax): Force stubs to be after stubbed sections
6307 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
6308 the beginning of a new relaxation pass. Update a comment.
6309 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
6311 2010-01-12 Ian Lance Taylor <iant@google.com>
6313 * target-reloc.h (visibility_error): New inline function.
6314 (relocate_section): Call visibility_error.
6315 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6316 (MOSTLYCLEANFILES): Likewise.
6317 (protected_4_pic.o, protected_3.err): New targets.
6318 * testsuite/protected_4.cc: New file.
6320 2010-01-12 Doug Kwan <dougkwan@google.com>
6322 * arm.cc (Cortex_a8_reloc): New class.
6323 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6324 and cortex_a8_relocs_info_.
6325 (Target_arm::fix_cortex_a8): New method definition.
6326 (Target_arm::Cortex_a8_relocs_info): New type.
6327 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6328 New data member declarations.
6329 (Target_arm::scan_reloc_for_stub): Record information about
6330 relocations for THUMB branches that might be exempted from the
6331 Cortex-A8 workaround.
6332 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
6333 at the beginning of a relaxation pass.
6335 2010-01-12 Doug Kwan <dougkwan@google.com>
6337 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
6338 (Arm_relobj::Mapping_symbol_position,
6339 Arm_reloj::Mapping_symbol_position_less,
6340 Arm_relobj::Mapping_symbols_info): New types.
6341 (Target_arm::is_mapping_symbol_name): New method definition.
6342 (Arm_relobj::do_count_local_symbols): Save information about mapping
6345 2010-01-11 Doug Kwan <dougkwan@google.com>
6347 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
6348 Arm_relocate_functions::thumb32_branch_upper,
6349 Arm_relocate_functions::thumb32_branch_lower,
6350 Arm_relocate_functions::thumb32_cond_branch_offset,
6351 Arm_relocate_functions::thumb32_cond_branch_upper,
6352 Arm_relocate_functions::thumb32_cond_branch_lower,
6353 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
6354 branch offset encoding.
6355 (Arm_relocate_functions::thumb_branch_common): Use new branch
6356 offset encoding methods to avoid code duplication.
6357 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
6358 (Stub_addend_reader::operator()): Use new branch encoding method
6359 to avoid code duplication.
6361 2010-01-11 Doug Kwan <dougkwan@google.com>
6363 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
6364 (Target_arm::do_finalize_sections): Define special EXIDX section
6365 symbols only if referenced.
6366 * gc.h (Garbage_collection::add_reference): New method.
6367 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
6370 2010-01-11 Ian Lance Taylor <iant@google.com>
6372 * script.cc (Version_script_info::build_expression_list_lookup):
6373 Change complaing about duplicate wildcard match from error to
6376 * script.cc (class Lazy_demangler): Recreate--revert part of patch
6378 (Version_script_info::Version_script_info): Initialize globs_,
6379 default_version_, default_is_global_, and exact_. Don't
6380 initialize globals_ or locals_.
6381 (Version_script_info::build_lookup_tables): Build local symbols
6383 (Version_script_info::unquote): New function.
6384 (Version_script_info::add_exact_match): New function.
6385 (Version_script_info::build_expression_list_lookup): Remove lookup
6386 parameter. Add is_global parameter. Change all callers. Handle
6387 wildcard pattern specially. Unquote pattern. Call
6389 (Version_script_info::get_name_to_match): New function.
6390 (Version_script_info::get_symbol_version): New function.
6391 (Version_script_info::get_symbol_version_helper): Remove.
6392 (Version_script_info::check_unmatched_names): Call unquote.
6393 * script.h (class Version_script_info): Change get_symbol_version
6394 to be non-inline and add is_global parameter; change all callers.
6395 Rewrite symbol_is_local. Update declarations. Define struct
6396 Version_tree_match, Exact, Globs. Don't define struct Lookup.
6397 Remove globals_ and locals_ members. Add exact_, globs_,
6398 default_version_, is_global_.
6399 (Version_script_info::Glob): Remove pattern, add expression and
6400 is_global. Update constructor. Change all callers.
6401 * dynobj.cc (Versions::finalize): Mark the version symbol as the
6403 (Versions::symbol_section_contents): If a symbol is undefined, or
6404 defined in a dynamic object, set the version index to
6406 * symtab.cc (Symbol_table::add_from_relobj): Don't call
6408 (Symbol_table::add_from_pluginobj): Likewise.
6409 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
6411 2010-01-11 Doug Kwan <dougkwan@google.com>
6413 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
6414 (incremental_dump_LDADD): Add linking option for libintl.
6415 * Makefile.in: Regenerate.
6417 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
6420 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
6422 * testsuite/Makefile.in: Regenerated.
6424 2010-01-10 Doug Kwan <dougkwan@google.com>
6426 * options.h (DEFINE_var): Use parentheses around argument varname__
6427 in macro body to avoid any unintended subsequent substitutions.
6429 2010-01-10 Ian Lance Taylor <iant@google.com>
6431 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
6432 candidates before doing symbol resolution.
6434 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
6435 ODR candidates if only one is weak.
6437 2010-01-08 Ian Lance Taylor <iant@google.com>
6439 * script.cc (Version_script_info::build_expression_list_lookup):
6440 Don't warn about ambiguous version, just record the ambiguity.
6441 (Version_script_info::get_symbol_version_helper): Give error if
6442 version is ambiguous.
6444 2010-01-08 Doug Kwan <dougkwan@google.com>
6446 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
6447 prev_data_size_ and prev_addralign_. Remove initializer for
6448 deleted data member has_been_changed_.
6449 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
6450 to determine if the table is empty.
6451 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
6453 (Stub_table::add_reloc_stub): Define method in class definition
6454 instead of just declaring it there.
6455 (Stub_table::add_cortex_a8_stub): New method definition.
6456 (Stub_table::update_data_size_and_addralign): Ditto.
6457 (Stub_table::finalize_stubs): Ditto.
6458 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
6459 (Stub_table::do_addralign_): Return address alignment in the
6460 (Stub_table::do_reset_address_and_file_offset): Define method in
6461 class definition instead of declaring it there. Set current data
6462 size to be the data size of the previous pass.
6463 (Stub_table::set_final_data_size): Use current data size as the
6465 (Stub_table::relocate_stub): Change parameter type of stub from
6466 Reloc_stub pointer to Stub pointer.
6467 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
6468 (Stub_table::Cortex_a8_stub_list): New typedef.
6469 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
6470 Stub_table::prev_addralign_): New data member.
6471 (Arm_relobj::Arm_relobj): Initialize data member
6472 section_has_cortex_a8_workaround_.
6473 (Arm_relobj::section_has_cortex_a8_workaround,
6474 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
6476 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
6478 (Target_arm::relocate_stub): Change parameter type of stub from
6479 Reloc_stub pointer to Stub pointer.
6480 (Insn_template::size, Insn_template::alignment): Handle
6481 THUMB16_SPECIAL_TYPE.
6482 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
6483 Stub_table::update_data_size_and_addralign,
6484 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
6486 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
6487 (Stub_table::do_write): Ditto.
6488 (Target_arm::do_relax): Adjust code for changes in Stub_table.
6490 2010-01-08 Ian Lance Taylor <iant@google.com>
6493 * symtab.h (class Symbol): Remove fields is_target_special_ and
6494 has_plt_offset_. Add field is_defined_in_discarded_section_.
6495 (Symbol::is_defined_in_discarded_section): New function.
6496 (Symbol::set_is_defined_in_discarded_section): New function.
6497 (Symbol::has_plt_offset): Rewrite.
6498 (Symbol::set_plt_offset): Verify that new offset is not -1U.
6499 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
6500 Don't initialize is_target_special_ or has_plt_offset_.
6501 Initialize is_defined_in_discarded_section_.
6502 (Symbol_table::add_from_relobj): If appropriate, set
6503 is_defined_in_discarded_section.
6504 * resolve.cc (Symbol::override_base_with_special): Don't test
6505 is_target_special_. Change has_plt_offset_ to has_plt_offset().
6506 * target-reloc.h (relocate_section): Do special handling for
6507 symbols defined in discarded sections for global symbols as well
6510 2010-01-08 Ian Lance Taylor <iant@google.com>
6512 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
6513 the SHT_SYMTAB case.
6515 2010-01-08 Ian Lance Taylor <iant@google.com>
6517 * object.cc (Sized_relobj::do_layout): Don't get confused if
6518 layout_eh_frame returns NULL.
6520 2010-01-08 Ian Lance Taylor <iant@google.com>
6523 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
6524 dynamic symbol table, use the normal symbol table.
6525 (Sized_dynobj::do_read_symbols): Remove assertion about type of
6528 2010-01-08 Ian Lance Taylor <iant@google.com>
6531 * layout.cc (Layout::include_section): Remove .gnu_debuglink
6534 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
6536 * version.cc (print_version): Change to "Copyright 2010".
6538 2010-01-08 Ian Lance Taylor <iant@google.com>
6542 * i386.cc (class Target_i386): Change return type of plt_section
6544 (class Output_data_plt_i386): Add tls_desc_rel_ field.
6545 (Output_data_plt_i386::Output_data_plt_i386): Initialize
6546 tls_desc_rel_ field.
6547 (Output_data_plt_i386::rel_tls_desc): New function.
6548 (Target_i386::rel_tls_desc_section): New function.
6549 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
6550 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
6551 R_386_TLS_DESC reloc in rel_tls_desc_section.
6552 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
6553 Define struct Tlsdesc_info.
6554 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
6555 (Target_x86_64::do_reloc_symbol_index): New function.
6556 (Target_x86_64::add_tlsdesc_info): New function.
6557 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
6558 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
6560 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
6562 (Output_data_plt_x86_64::rela_tlsdesc): New function.
6563 (Target_x86_64::rela_tlsdesc_section): New function.
6564 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
6566 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
6567 (Target_x86_64::do_reloc_addend): New function.
6568 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
6569 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
6570 declarations. Define TARGET_CODE. Add arg field to u1_ union.
6571 (Output_reloc::type): New function.
6572 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
6573 (Output_reloc::is_target_specific): New function.
6574 (Output_reloc::target_arg): New function.
6575 (class Output_reloc) [SHT_RELA]: Add four new constructors for
6576 absolute relocs and target specific relocs.
6577 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
6578 add_target_specific.
6579 (class Output_data_reloc) [SHT_RELA]: Likewise.
6580 * output.cc (Output_reloc::Output_reloc): Add four new versions
6581 for absolute relocs and target specific relocs.
6582 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
6583 (Output_reloc::get_symbol_index): Likewise.
6584 (Output_reloc::local_section_offset): Check that local_sym_index_
6585 is not TARGET_CODE or 0.
6586 (Output_reloc::symbol_value): Likewise.
6587 (Output_reloc::write) [SHT_RELA]: Call target for target specific
6589 * target.h (class Target): Add reloc_symbol_index and reloc_addend
6590 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
6592 * layout.cc (add_target_dynamic_tags): Use output section for
6593 DT_PLTRELSZ and DT_JMPREL.
6595 2010-01-07 Ian Lance Taylor <iant@google.com>
6598 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
6600 (class Output_data_reloc_generic): Define.
6601 (class Output_data_reloc_base): Change base class to
6602 Output_data_reloc_generic. Change add() method to call
6603 bump_relative_reloc_count for a relative reloc. Remove
6605 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
6607 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
6608 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
6610 * layout.h (class Layout): Update declaration.
6612 2010-01-07 Ian Lance Taylor <iant@google.com>
6614 * output.h (class Output_data): Add const version of
6615 output_section and do_output_section.
6616 (class Output_section_data): Add const version of
6618 (class Output_section): Likewise.
6619 * layout.cc (Layout::add_target_dynamic_tags): New function.
6620 * layout.h (class Layout): Update declarations.
6621 * arm.cc (Target_arm::do_finalize_sections): Use
6622 add_target_dynamic_tags.
6623 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6624 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6625 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6626 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6628 2010-01-07 Ian Lance Taylor <iant@google.com>
6631 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
6634 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
6635 Ian Lance Taylor <iant@google.com>
6638 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
6639 Xindex::read_symtab_xindex.
6641 2010-01-07 Doug Kwan <dougkwan@google.com>
6643 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
6644 (Insn_template::thumb16_bcond_insn): New method declaration.
6645 (Insn_template): Fix spelling.
6646 (Stub::thumb16_special): New method declaration.
6647 (Stub::do_write): Define virtual method which was previously pure
6649 (Stub::do_thumb16_special): New method declaration.
6650 (Stub::do_fixed_endian_write): New template member.
6651 (Reloc_stub::do_write): Remove.
6652 (Reloc_stub::do_fixed_endian_write): Remove.
6653 (Cortex_a8_stub): New class definition.
6654 (Stub_factory::make_cortex_a8_stub): New method definition.
6655 (Stub_factory::Stub_factory): Add missing static storage class
6656 qualifier for elf32_arm_stub_a8_veneer_blx.
6658 2010-01-07 Ian Lance Taylor <iant@google.com>
6661 * options.h (class General_options): Add --warn-unresolved-symbols
6662 and --error-unresolved-symbols.
6663 * errors.cc (Errors::undefined_symbol): Implement
6664 --warn-unresolved-symbols.
6666 * options.h (class General_options): Add -z text and -z textoff.
6667 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
6669 2010-01-06 Sriraman Tallam <tmsriram@google.com>
6671 * gc.h (Garbage_collection::Cident_section_map): New typedef.
6672 (Garbage_collection::cident_sections): New function.
6673 (Garbage_collection::add_cident_section): New function.
6674 (Garbage_collection::cident_sections_): New member.
6675 (gc_process_relocs): Add references to sections whose names are C
6677 * gold.h (cident_section_start_prefix): New constant.
6678 (cident_section_stop_prefix): New constant.
6679 (is_cident): New function.
6680 * layout.cc (Layout::define_section_symbols): Replace string constants
6681 with the newly defined constants.
6682 * object.cc (Sized_relobj::do_layout): Track sections whose names are
6684 * testsuite/Makefile.am: Add gc_orphan_section_test.
6685 * testsuite/Makefile.in: Regenerate.
6686 * testsuite/gc_orphan_section_test.cc: New file.
6687 * testsuite/gc_orphan_section_test.sh: New file.
6689 2010-01-06 Ian Lance Taylor <iant@google.com>
6692 * options.h (class General_options): Add --warn-shared-textrel.
6693 * layout.cc (Layout::finish_dynamic_section): Implement
6694 --warn-shared-textrel.
6697 * options.h (class General_options): Add --warn-multiple-gp.
6699 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6701 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
6702 $(THREADSLIB) and $(LIBDL).
6703 * Makefile.in: Rebuild.
6705 2010-01-06 Ian Lance Taylor <iant@google.com>
6708 * options.cc (General_options::parse_section_start): New function.
6709 (General_options::section_start): New function.
6710 (General_options::General_options): Initialize all members.
6711 * options.h: Include <map>
6712 (class General_options): Add --section-start. Add section_starts_
6714 * layout.cc (Layout::attach_allocated_section_to_segment): If
6715 --section-start was used, set the address of the segment. Remove
6716 local sort_sections.
6717 (Layout::relaxation_loop_body): If the address of the load segment
6718 has been set by --section-start, don't use it.
6719 * output.h (Output_segment::update_flags_for_output_section): New
6721 * output.cc (Output_segment::add_output_section): Call
6722 update_flags_for_output_section.
6724 2010-01-05 Ian Lance Taylor <iant@google.com>
6727 * options.h (class General_options): Add --undefined-version.
6728 * script.cc (struct Version_expression): Add was_matched_by_symbol
6730 (Version_script_info::matched_symbol): New function.
6731 (Version_script_info::get_symbol_version_helper): Call
6733 (Version_script_info::check_unmatched_names): New function.
6734 * script.h (class Version_script_info): Update declarations.
6735 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
6737 * options.h (class General_options): Use DEFINE_bool_alias for
6738 allow_multiple_definition.
6739 * resolve.cc (Symbol_table::should_override): Don't test
6740 allow_multiple_definition.
6743 * options.h (class General_options): Add --cref.
6744 * main.cc (main): Print cref table if --cref. Don't close mapfile
6745 until after printing cref table.
6746 * cref.cc: Include "symtab.h".
6747 (class Cref_inputs): Define Cref_table_compare and Cref_table.
6748 (Cref_table_compare::operator()): New function.
6749 (Cref_inputs::gather_cref): New function.
6750 (filecol): New static const.
6751 (Cref_inputs::print_cref): New function.
6752 (Cref::print_cref): New function.
6753 * cref.h: Include <cstdio>.
6754 (class Cref): Update declarations.
6755 * mapfile.h (Mapfile::file): New function.
6756 * object.h (class Object): Define Symbols. Declare virtual
6757 do_get_global_symbols.
6758 (Object::get_global_symbols): New function.
6759 * object.cc (Input_objects::add_object): Pass object to cref_ if
6761 (Input_objects::archive_start): Likewise.
6762 (Input_objects::archive_stop): Likewise.
6763 (Input_objects::print_cref): New function.
6764 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
6765 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
6767 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
6769 * plugin.h (class Sized_pluginobj): Update declarations.
6771 2010-01-05 Ian Lance Taylor <iant@google.com>
6773 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
6774 to is_default_version. Rename insdef to insdefault.
6775 (Symbol_table::add_from_relobj): Rename def to is_default_version
6776 and local to is_forced_local.
6777 (Symbol_table::add_from_pluginobj): Likewise.
6778 (Symbol_table::add_from_dynobj): Likewise.
6779 (Symbol_table::define_special_symbol): Rename insdef to
6782 2010-01-04 Ian Lance Taylor <iant@google.com>
6785 * options.h (class General_options): Add
6786 --allow-multiple-definition and -z muldefs.
6787 * resolve.cc (Symbol_table::should_override): Don't warn about a
6788 multiple symbol definition if --allow-multiple-definition or -z
6792 * options.h (class General_options): Add --add-needed and
6793 --copy-dt-needed-entries. Tweak --as-needed help entry.
6794 * object.cc (Input_objects::check_dynamic_dependencies): Give an
6795 error if --copy-dt-needed-entries aka --add-needed is used and
6796 would cause a change in behaviour.
6799 * options.h (class General_options): Add -G as a short version of
6800 --shared. Add no-op options -assert, -g, and -i.
6802 2010-01-04 Sriraman Tallam <tmsriram@google.com>
6804 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
6805 check for .text or .gnu.linkonce.t sections.
6806 * icf.cc (Icf::find_identical_sections): Ditto.
6807 Change the detection for mangled function name within the section
6809 * icf.h (is_section_foldable_candidate): New function.
6811 2009-12-30 Ian Lance Taylor <iant@google.com>
6814 * options.h (class General_options): Permit two dashes with
6815 --retain-symbols-file.
6817 2009-12-30 Ian Lance Taylor <iant@google.com>
6820 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
6821 don't put the file header and segment headers in the text
6825 * common.cc (Sort_commons::operator()): Stabilize sort when both
6827 (Symbol_table::do_allocate_commons_list): When allocating common
6828 symbols, skip a symbol which is no longer common.
6829 * symtab.h (Symbol::is_common): Test whether the symbol comes from
6830 an object before checking its type.
6831 * testsuite/common_test_2.c: New file.
6832 * testsuite/common_test_3.c: New file.
6833 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
6834 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
6835 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
6836 (common_test_2_pic.o, common_test_2.so): New targets.
6837 (common_test_3_pic.o, common_test_3.so): New targets.
6838 * testsuite/Makefile.in: Rebuild.
6841 * script.cc (read_input_script): If we see a new SECTIONS clause,
6842 and we have added an input section, give an error.
6843 * layout.h (class Layout): Add have_added_input_section function.
6844 Add have_added_input_section_ field.
6845 * layout.cc (Layout::Layout): Initialize
6846 have_added_input_section_.
6847 (Layout::layout): Set have_added_input_section_.
6848 (Layout::layout_eh_frame): Likewise.
6850 2009-12-30 Ian Lance Taylor <iant@google.com>
6853 * options.h (class General_options): Add --sort-common option.
6854 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
6855 * common.cc (Sort_common): Add sort_order parameter to
6856 constructor. Add sort_order_ field.
6857 (Sort_commons::operator): Check sort_order_.
6858 (Symbol_table::allocate_commons): Determine the sort order.
6859 (Symbol_table::do_allocate_commons): Add sort_order parameter.
6861 (Symbol_table::do_allocate_commons_list): Likewise.
6863 2009-12-30 Ian Lance Taylor <iant@google.com>
6866 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
6867 symbols from this object, don't change the visibility of an
6869 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
6871 2009-12-30 Ian Lance Taylor <iant@google.com>
6874 * script.h (class Version_script_info): Define Language enum.
6875 Update declarations. Define Glob, Exact, and Lookup types. Add
6876 new fields globals_, locals_, and is_finalized_.
6877 * script.cc: Various formatting fixes.
6878 (class Parser_closure): Change language_stack_ from a vector of
6879 std::string to one of Version_script_info::Language. Adjust all
6881 (class Lazy_demangler): Remove.
6882 (struct Version_expression): Change language from std::string to
6883 Version_script_info::Language.
6884 (Version_script_info::Version_script_info): New function.
6885 (Version_script_info::~Version_script_info): Don't call clear.
6886 (Version_script_info::finalize): New function.
6887 (Version_script_info::build_lookup_tables): New function.
6888 (Version_script_info::build_expression_list_lookup): New
6890 (Version_script_info::get_symbol_version_helper): Rewrite to use
6892 (Version_script_info::print_expression_list): Adjust to use
6893 Version_script_info::Language.
6894 (script_push_lex_into_version_mode): Check that the version script
6895 has not been finalized.
6896 (version_script_push_lang): Change language string to
6897 Version_script_info::Language.
6898 * options.cc (Command_line::version_script): New function.
6899 * options.h (class General_options): Add finalize_dynamic_list
6900 function. Change version_script from declaration to definition.
6901 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
6902 * testsuite/version_script.map: Remove duplicate def of foo.
6903 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
6905 * testsuite/Makefile.in: Rebuild.
6907 2009-12-30 Ian Lance Taylor <iant@google.com>
6910 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
6911 if the input symbol index is 0, make the output symbol index 0.
6913 2009-12-30 Ian Lance Taylor <iant@google.com>
6916 * options.h (class General_options): Add -x/--discard-all.
6917 * object.cc (Sized_relobj::do_count_local_symbols): Handle
6918 --discard-all. If the local symbol needs a dynamic entry, check
6919 that before handling --discard-locals.
6921 2009-12-30 Ian Lance Taylor <iant@google.com>
6924 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
6926 (Output_segment::add_output_section): Don't change the flags if
6930 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
6931 GNU hash table if they need a dynamic value. Otherwise, don't add
6932 them if they are defined in a dynamic object or are forced local.
6934 2009-12-29 Ian Lance Taylor <iant@google.com>
6937 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
6938 .gnu.hash table for a 32-bit target.
6941 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
6942 regular and a dynamic object only needs a dynamic symbol table
6943 entry if it is externally visible.
6946 * i386.cc (class Target_i386): Initialize global_offset_table_ in
6947 constructor. Add global_offset_table_ field.
6948 (Target_i386::got_section): Set global_offset_table_.
6949 (Target_i386::do_finalize_sections): Set global_offset_table_
6951 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
6952 in constructor. Add global_offset_table_ field.
6953 (Target_x86_64::got_section): Set global_offset_table_.
6954 (Target_x86_64::do_finalize_sections): Set global_offset_table_
6957 * layout.cc (Layout::Layout): Initialize increase_relro_.
6958 (Layout::get_output_section): Add is_relro, is_last_relro, and
6959 is_first_non_relro parameters. Change all callers.
6960 (Layout::choose_output_section): Likewise.
6961 (Layout::add_output_section_data): Likewise.
6962 (Layout::make_output_section): Likewise.
6963 (Layout::set_segment_offsets): Clear increase_relro when using a
6965 * layout.h (class Layout): Add increase_relro method. Add
6966 increase_relro_ field. Update declarations.
6967 * output.cc (Output_section::Output_section): Initialize
6968 is_last_relro_ and is_first_non_relro_.
6969 (Output_segment::add_output_section): Group relro sections is
6970 do_sort is true. Handle is_last_relro and is_first_non_relro.
6971 (Output_segment::maximum_alignment): Remove relro handling.
6972 (Output_segment::set_section_addresses): Add increase_relro
6973 parameter. Change all callers. Add initial alignment to align
6974 relro sections on separate page. Remove old relro handling.
6975 (Output_segment::set_section_list_addresses): Remove in_relro
6976 parameter. Change all callers.
6977 (Output_segment::set_offset): Add increase parameter. Change all
6978 callers. Remove old relro handling.
6979 * output.h (class Output_section): Add new methods: is_last_relro,
6980 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
6981 Add is_last_relro_ and is_first_non_relro_ fields.
6982 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
6983 Create separate .got.plt section. Call increase_relro.
6984 * x86_64.cc (Target_x86_64::got_section): Likewise.
6985 * testsuite/relro_script_test.t: Add .got.plt.
6988 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
6989 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
6990 (Layout::finalize): Call set_dynamic_symbol_size.
6991 (Layout::set_dynamic_symbol_size): New function.
6992 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
6993 set_dynamic_symbol_size.
6996 * output.h (class Output_section): Add is_entsize_zero_ field.
6997 * output.cc (Output_section::Output_section): Initialize
6999 (Output_section::set_entsize): If two different entsizes are
7000 requested, force it to zero.
7001 (Output_section::add_input_section): Set flags for .debug_str
7002 before updating section flags. Set entsize.
7003 (Output_section::update_flags_for_input_section): Set SHF_MERGE
7004 and SHF_STRING if all input sections have those flags.
7006 2009-12-29 Rafael Espindola <espindola@google.com>
7008 * main.cc (main): Fix the sys time reporting.
7009 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
7012 2009-12-29 Sriraman Tallam <tmsriram@google.com>
7014 * options.cc (General_options::parse_version): Allow -v to exit
7015 without an error if there is nothing to link.
7017 2009-12-29 Ian Lance Taylor <iant@google.com>
7019 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
7020 using a version of gcc before 4.1.
7021 * configure: Rebuild.
7023 2009-12-28 Chris Demetriou <cgd@google.com>
7025 * attributes.cc (Output_attributes_section_data::do_write): Use
7026 std::vector::front rather than std::vector::data.
7028 2009-12-28 Ian Lance Taylor <iant@google.com>
7030 * symtab.h (class Symbol_table): Add enum Defined.
7031 * resolve.cc (Symbol_table::should_override): Add defined
7032 parameter. Change all callers. Test whether object is NULL
7033 before calling a method on it.
7034 (Symbol_table::report_resolve_problem): Add defined parameter.
7036 (Symbol_table::should_override_with_special): Likewise.
7037 * symtab.cc (Symbol_table::define_in_output_data): Add defined
7038 parameter. Change all callers.
7039 (Symbol_table::do_define_in_output_data): Likewise.
7040 (Symbol_table::define_in_output_segment): Likewise.
7041 (Symbol_table::do_define_in_output_segment): Likewise.
7042 (Symbol_table::define_as_constant): Likewise.
7043 (Symbol_table::do_define_as_constant): Likewise.
7044 * script.h (class Symbol_assignment): Add is_defsym parameter to
7045 constructor; change all callers.
7046 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
7047 parameter. Change all callers. Add is_defsym_ field.
7048 (class Parser_closure): Add parsing_defsym parameter to
7049 constructor; change all callers. Add parsing_defsym accessor
7050 function. Add parsing_defsym_ field.
7052 2009-12-28 Ian Lance Taylor <iant@google.com>
7054 * gold.cc (queue_middle_tasks): Fix formatting.
7055 * object.cc (Relobj::is_section_name_included): Likewise.
7057 2009-12-23 Ian Lance Taylor <iant@google.com>
7059 * i386.cc (Target_i386::do_calls_non_split): Recognize
7060 -fsplit-stack prologue for a function with a static chain.
7061 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
7062 -fsplit-stack prologue when using %r11.
7064 2009-12-21 Sriraman Tallam <tmsriram@google.com>
7066 * options.cc (General_options::parse_version): Make -v continue and do
7067 the link like GNU ld does.
7069 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
7071 * Makefile.am (CCFILES): Add timer.cc.
7072 (HFILES): Add timer.h.
7073 * configure.ac: Check for sysconf and times.
7074 * main.cc: include timer.h.
7075 (main): Use Timer instead of get_run_time.
7078 * workqueue.cc: include timer.h.
7079 (Workqueue::find_and_run_task):
7080 Report user, sys and wall time.
7081 * Makefile.in: Regenerate.
7082 * config.in: Regenerate.
7083 * configure: Regenerate.
7085 2009-12-16 Doug Kwan <dougkwan@google.com>
7087 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
7089 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
7090 relaxed input sections.
7091 * output.cc (Output_section::find_relaxed_input_section): Change
7092 return type to Output_relaxed_input_section pointer. Adjust code
7093 for new type of relaxed_input_section_map_.
7094 * output.h (Output_section::find_relaxed_input_section): Change
7095 return type to Output_relaxed_input_section pointer.
7096 (Output_section::Output_relaxed_input_section_by_input_section_map):
7098 (Output_section::relaxed_input_section_map_): Change type to
7099 Output_section::Output_relaxed_input_section_by_input_section_map.
7100 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
7103 2009-12-15 Ian Lance Taylor <iant@google.com>
7105 * layout.cc (Layout::create_shstrtab): Only write out after input
7106 sections if we are compressing debug sections.
7108 2009-12-15 Ian Lance Taylor <iant@google.com>
7110 * archive.cc (Archive::add_symbols): Only look up a symbol without
7111 a version if there is, in fact, a version.
7113 2009-12-14 Ian Lance Taylor <iant@google.com>
7115 Revert -Wshadow changes, all changes from:
7116 2009-12-11 Doug Kwan <dougkwan@google.com>
7117 2009-12-11 Nick Clifton <nickc@redhat.com>
7118 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
7120 2009-12-11 Doug Kwan <dougkwan@google.com>
7122 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
7124 * attributes.cc (Object_attribute::size): Ditto.
7125 (Attributes_section_data::size): Ditto.
7126 (Attributes_section_data::Attributes_section_data): Ditto.
7127 (Output_attributes_section_data::do_write): Ditto.
7128 * attributes.h (Object_attribute::set_type): Ditto.
7129 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
7131 2009-12-11 Nick Clifton <nickc@redhat.com>
7133 * archive.cc: Fix shadowed variable warnings.
7135 * compressed_output.cc: Likewise.
7136 * compressed_output.h: Likewise.
7137 * configure: Likewise.
7138 * dwarf_reader.cc: Likewise.
7139 * dynobj.cc: Likewise.
7140 * dynobj.h: Likewise.
7141 * ehframe.cc: Likewise.
7142 * ehframe.h: Likewise.
7143 * errors.cc: Likewise.
7144 * expression.cc: Likewise.
7145 * fileread.cc: Likewise.
7146 * fileread.h: Likewise.
7147 * freebsd.h: Likewise.
7148 * i386.cc: Likewise.
7150 * incremental.h: Likewise.
7151 * layout.cc: Likewise.
7152 * layout.h: Likewise.
7153 * mapfile.cc: Likewise.
7154 * merge.cc: Likewise.
7155 * merge.h: Likewise.
7156 * object.cc: Likewise.
7157 * object.h: Likewise.
7158 * options.h: Likewise.
7159 * output.cc: Likewise.
7160 * output.h: Likewise.
7161 * parameters.cc: Likewise.
7162 * plugin.cc: Likewise.
7163 * powerpc.cc: Likewise.
7164 * reduced_debug_output.cc: Likewise.
7165 * reduced_debug_output.h: Likewise.
7166 * reloc.cc: Likewise.
7167 * reloc.h: Likewise.
7168 * resolve.cc: Likewise.
7169 * script-sections.cc: Likewise.
7170 * script.cc: Likewise.
7171 * script.h: Likewise.
7172 * sparc.cc: Likewise.
7173 * symtab.cc: Likewise.
7174 * symtab.h: Likewise.
7175 * target-select.cc: Likewise.
7176 * target-select.h: Likewise.
7177 * token.h: Likewise.
7178 * workqueue.cc: Likewise.
7179 * workqueue.h: Likewise.
7180 * x86_64.cc: Likewise.
7182 2009-12-10 Doug Kwan <dougkwan@google.com>
7184 * arm.cc (attributes.h): New include.
7185 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
7186 (Arm_relobj::~Arm_relobj): Delete object pointed by
7187 attributes_section_data_.
7188 (Arm_relobj::attributes_section_data): New method definition.
7189 (Arm_relobj::attributes_section_data_): New data member declaration.
7190 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
7191 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
7192 attributes_section_data_.
7193 (Arm_dynobj::attributes_section_data): New method definition.
7194 (Arm_dynobj::attributes_section_data_): New data member declaration.
7195 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
7196 initialization value of may_use_blx_ to false.
7197 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
7198 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
7199 object attributes to compute results instead of hard-coding.
7200 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
7201 Target_arm::get_secondary_compatible_arch,
7202 Target_arm::set_secondary_compatible_arch
7203 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7204 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
7205 New method declarations.
7206 (Target_arm::get_aeabi_object_attribute): New method definition.
7207 (Target_arm::attributes_section_data_): New data member declaration.
7208 (read_arm_attributes_section): New template definition.
7209 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
7210 (Arm_dynobj::do_read_symbols): Ditto.
7211 (Target_arm::do_finalize_sections): Merge attributes sections from
7212 input. Check for BLX use after attributes section merging.
7213 Fix __exidx_start and __exidx_end visibility. Create an
7214 .ARM.attributes section if necessary.
7215 (Target_arm::get_secondary_compatible_arch,
7216 Target_arm::set_secondary_compatible_arch,
7217 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7218 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
7219 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
7220 New method definitions.
7222 2009-12-09 Ian Lance Taylor <iant@google.com>
7224 * plugin.cc (Plugin::load): Don't cast from void* to a function
7227 2009-12-09 Ian Lance Taylor <iant@google.com>
7229 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
7232 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
7234 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
7235 Replace two_file_shared_1.so with two_file_shared_2.so.
7236 * testsuite/Makefile.in: Regenerated.
7238 2009-12-08 Doug Kwan <dougkwan@google.com>
7240 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
7241 (HFILES): Add attributes.h and int_encoding.h.
7242 * Makefile.in: Regenerate.
7243 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
7244 function definitions to int_encoding.cc
7245 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
7246 prototypes to int_encoding.h
7247 * reduced_debug_output.cc (int_encoding.h): New include.
7248 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
7249 function definitions to int_encoding.cc
7250 (insert_into_vector, read_from_pointer): Move template definitions to
7252 * attributes.cc: New file.
7253 * attributes.h: New file.
7254 * int_encoding.cc: New file.
7255 * int_encoding.h: New file.
7257 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
7260 * incremental-dump.cc (dump_incremental_inputs): New.
7261 (main): Use dump_incremental_inputs.
7263 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
7266 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
7267 checking elfcpp::STT_FUNC.
7268 (Target_i386::Relocate::relocate): Likewise.
7269 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
7271 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
7272 symbols from shared libraries into normal FUNC symbols.
7274 * symtab.h (Symbol): Add is_func and use it.
7276 2009-12-05 Doug Kwan <dougkwan@google.com>
7278 * arm.cc (Target_arm::arm_info): Initialize new fields
7279 attributes_section and attributes_vendor.
7280 * i386.cc (Target_i386::i386_info): Same.
7281 * object.cc (Sized_relobj::do_layout): Skip attribute section.
7282 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7283 fields attributes_section and attributes_vendor.
7284 * sparc.cc (Target_sparc::sparc_info): Same.
7285 * target.h (Target::attributes_section, Target::attributes_vendor,
7286 Target::is_attributes_section, Target::attribute_arg_type,
7287 Target::attributes_order): New method definitions.
7288 (Target::Target_info::attributes_section,
7289 Target::Target_info::attributes_vendor): New fields.
7290 (Target::do_attribute_arg_type, Target::do_attributes_order): New
7291 virtual method definitions.
7292 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7293 attributes_section and attributes_vendor.
7294 * testsuite/testfile.cc (Target_test::test_target_info): Same.
7296 2009-12-05 Doug Kwan <dougkwan@google.com>
7298 * arm.cc: Update comments about interworking and stub generation.
7299 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
7300 considered as non-PIC.
7301 (Arm_relocate_functions::base_abs): Fix formatting.
7302 (Arm_relocate_functions::got_prel): Fix comment. Change interface
7303 of function to use GOT entry address instead of offset.
7304 (Target_arm::Scan::global): Issue an error if a symbol would need a
7305 PLT does not get one because it is untyped. Remove code to create
7306 dynamic symbols for relative branches.
7307 (Target_arm::Relocate::relocate: Use 0 instead of false since function
7308 takes unsigned integer instead of boolean.
7310 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
7312 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7313 (two_file_test_LDADD): Likewise.
7314 (common_test_1_LDADD): Likewise.
7315 (exception_test_LDADD) Likewise.
7316 (weak_test_LDADD): Likewise.
7317 (many_sections_test_LDADD): Likewise.
7318 (initpri1_LDADD): Likewise.
7319 (script_test_1_LDADD): Likewise.
7320 (script_test_2_LDADD): Likewise.
7321 (justsyms_LDADD): Likewise.
7322 (binary_test_LDADD): Likewise.
7323 (large_LDADD): Likewise.
7324 * testsuite/Makefile.in: Regenerated.
7326 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
7328 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7329 (Symbol_table::override_with_special): Likewise.
7330 (Symbol_table::add_from_object): Likewise.
7332 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
7334 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7335 Don't set the data_offset twice.
7337 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
7339 * testsuite/Makefile.in: Regenerate.
7341 2009-12-03 Doug Kwan <dougkwan@google.com>
7343 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
7344 (Target_arm::do_finalize_sections): Add parameter for symbol table
7345 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
7346 * i386.cc (Target_i386::do_finalize_sections): Add an additional
7347 parameter for symbol table pointer.
7348 * layout.cc (Layout::finalize): Call Target::finalize_sections with
7349 an additional parameter for a pointer to symbol table.
7350 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
7351 parameter for a symbol table pointer.
7352 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
7353 * target.h (Target::finalize_sections, Target::do_finalize_sections):
7355 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
7356 parameter for a symbol table pointer.
7358 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
7360 * incremental.cc (Incremental_inputs_header)
7361 (Incremental_inputs_header_write, Incremental_inputs_entry)
7362 (Incremental_inputs_entry_write): Move ...
7363 * incremental.h (Incremental_inputs_header)
7364 (Incremental_inputs_header_write, Incremental_inputs_entry)
7365 (Incremental_inputs_entry_write): here.
7367 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7369 * incremental.cc (make_sized_incremental_binary): Set the target.
7370 Error if it is incompatible.
7371 * output.h (Output_file): Add filename method.
7373 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7375 * incremental.cc (Incremental_inputs_entry): Remove unused argument
7376 from the get_* methods.
7378 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7380 * incremental-dump.cc (main): Check that the offeset of a script is 0.
7381 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7382 Write 0 for the data_offset of scripts.
7384 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7386 * testsuite/Makefile.am: Add the incremental_test.sh test.
7387 * testsuite/incremental_test.sh: New.
7388 * testsuite/incremental_test_1.c: New.
7389 * testsuite/incremental_test_2.c: New.
7391 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
7393 * incremental-dump.cc (main): Fix typos.
7395 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
7398 * incremental-dump.cc (main): Use llu to print 64 bit values.
7400 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
7401 H.J. Lu <hongjiu.lu@intel.com>
7403 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
7405 (incremental_dump_LDADD): Likewise.
7406 * Makefile.in: Regenerated.
7408 2009-11-25 Doug Kwan <dougkwan@google.com>
7412 2009-11-25 Doug Kwan <dougkwan@google.com>
7414 * arm.cc (Target_arm::Target_arm): Move method definition
7415 outside of class definition. Add code to handle
7416 --target1-rel, --target1-abs and --target2= options.
7417 (Target_arm::get_reloc_reloc_type): Change method to be
7418 non-static and const.
7419 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
7420 New data member declaration.
7421 (Target_arm::Scan::local, Target_arm::Scan::global,
7422 Target_arm::Relocate::relocate,
7423 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7424 Adjust call to Target_arm::get_real_reloc_type.
7425 (Target_arm::get_real_reloc_type): Use command line options
7426 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7427 * options.h (--target1-rel, --target1-abs, --target2): New
7430 2009-11-25 Doug Kwan <dougkwan@google.com>
7432 * arm.cc (Target_arm::Target_arm): Move method definition outside of
7433 class definition. Add code to handle --target1-rel, --target1-abs
7434 and --target2= options.
7435 (Target_arm::get_reloc_reloc_type): Change method to be non-static
7437 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
7439 (Target_arm::Scan::local, Target_arm::Scan::global,
7440 Target_arm::Relocate::relocate,
7441 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
7442 call to Target_arm::get_real_reloc_type.
7443 (Target_arm::get_real_reloc_type): Use command line options to
7444 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7445 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
7448 2009-11-25 Doug Kwan <dougkwan@google.com>
7450 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
7451 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
7452 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
7454 (Arm_relocate_functions::thm_call): Replace body with a call to
7455 Arm_relocate_functions::thumb_branch_common.
7456 (Arm_relocate_functions::thm_jump24,
7457 Arm_relocate_functions::thm_xpc22): New method definitions.
7458 (Arm_relocate_functions::thumb_branch_common): New method definition.
7459 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
7461 (Target_arm::Relocate::relocate): Adjust call to thm_call.
7462 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
7464 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
7466 * Makefile.am: Build incremental-dump
7467 * Makefile.in: Regenerate.
7468 * incremental-dump.cc: New.
7469 * incremental.cc (Incremental_inputs_header_data,
7470 Incremental_inputs_entry_data): Move to incremental.h
7471 * incremental.h: (Incremental_inputs_header_data,
7472 Incremental_inputs_entry_data): Move from incremental.cc
7474 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
7476 * incremental.cc (Incremental_inputs_header,
7477 Incremental_inputs_header_write, Incremental_inputs_entry,
7478 Incremental_inputs_entry_write): Add a typedef with the data type.
7480 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
7482 * incremental.cc (Incremental_inputs_header,
7483 Incremental_inputs_header_write, Incremental_inputs_entry,
7484 Incremental_inputs_entry_write): Update comment about which
7485 type has the filed descriptions.
7487 2009-11-15 Doug Kwan <dougkwan@google.com>
7489 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
7490 (Arm_relocate_functions::arm_branch_common): Change method defintion
7491 in class definition to a method declaration and update list of formal
7493 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
7494 Arm_relocation_functions::jump24): Adjust call to
7495 Arm_relocate_functions::arm_branch_common. Update list of formal
7497 (Arm_relocate_functions::xpc25): New method definition.
7498 (Arm_relocate_functions::arm_branch_common): Move method defintion
7499 out from class definition. Use stubs for mode-switching and extending
7501 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
7502 specially. Change code to enable use of stubs in ARM branches.
7504 2009-11-10 Doug Kwan <dougkwan@google.com>
7506 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
7507 in method declaration.
7508 (Target_arm::relocate_stub): New method declaration.
7509 (Target_arm::default_target): Change to return a pointer instead of
7511 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
7512 Target_arm::default_target.
7513 (Arm_Relobj::do_relocate_sections): Remove options paramater in
7515 (Target_arm::relocate_section): Adjust view.
7516 (Target_arm::relocate_stub): New method definition.
7518 2009-11-10 Doug Kwan <dougkwan@google.com>
7520 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
7522 * incremental.cc (open_incremental_binary): Initialized local
7523 variables to avoid warnings.
7524 * object.cc (make_elf_object): Ditto.
7525 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
7528 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
7531 * testsuite/plugin_test.c: Include "config.h".
7533 2009-11-09 Doug Kwan <dougkwan@google.com>
7535 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
7536 (arm_symbol_value): Remove.
7537 (Arm_relocate_functions::arm_branch_common,
7538 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
7539 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
7540 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
7541 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
7542 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
7543 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
7544 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
7545 Arm_relocate_functions::thm_mobw_abs_nc,
7546 Arm_relocate_functions::thm_mov_abs,
7547 Arm_relocate_functions::movw_prel_nc,
7548 Arm_relocate_functions::thm_movt_abs,
7549 Arm_relocate_functions::movt_prel,
7550 Arm_relocate_functions::thm_movw_prel_nc,
7551 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
7552 (Target_arm::Relocate::relocate): Only decompose address into two
7553 parts if relocation type uses the thumb-bit and pass the actual
7554 bit instead of a flag indicating that the thumb-bit is used. Adjust
7555 calls to methods in Arm_relocate_functions for this change.
7557 2009-11-08 Ian Lance Taylor <iant@google.com>
7560 * reloc.cc: Instantiate
7561 Sized_relobj::initialize_input_to_output_maps and
7562 Sized_relobj:free_input_to_output_maps.
7564 2009-11-06 Ian Lance Taylor <iant@google.com>
7567 * defstd.cc (in_segment): Set only_if_ref true for "end".
7569 2009-11-06 Doug Kwan <dougkwan@google.com>
7571 * arm.cc (class Reloc_stub): Correct a comment.
7572 (Target_arm::Target_arm): Initialize arm_input_section_map_.
7573 (Target_arm::scan_section_for_stubs): New method declaration.
7574 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
7575 Change methods from private to protected.
7576 (Target_arm::do_may_relax): New method definition.
7577 (Target_arm::do_relax, Target_arm::group_sections,
7578 Target_arm::scan_reloc_for_stub,
7579 Target_arm::scan_reloc_section_for_stubs): New method declarations.
7580 (Target_arm::arm_input_section_map_): New data member declaration.
7581 (Target_arm::scan_reloc_for_stub,
7582 Target_arm::scan_reloc_section_for_stubs,
7583 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
7584 Target_arm::do_relax): New method definitions.
7586 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
7588 * configure.ac: Check for (struct stat)::st_mtim
7589 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
7590 * config.in: Regenerate.
7591 * configure: Regenerate.
7593 2009-11-05 Ian Lance Taylor <iant@google.com>
7596 * output.cc (Output_segment::add_output_section): Add missing
7599 2009-11-04 Ian Lance Taylor <iant@google.com>
7602 * object.h (class Object): Add is_needed and set_is_needed
7603 methods. Add is_needed_ field. Make bool fields into bitfields.
7604 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
7605 defined in a dynamic object and referenced by a regular object,
7606 set is_needed for the dynamic object.
7607 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
7608 if the file is marked with as_needed and it is not needed.
7610 2009-11-04 Ian Lance Taylor <iant@google.com>
7613 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
7614 tags if data is discarded by linker script.
7615 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7616 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7617 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7618 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7620 2009-11-04 Ian Lance Taylor <iant@google.com>
7622 * layout.cc (Layout::get_output_section): Add is_interp and
7623 is_dynamic_linker_section parameters. Change all callers.
7624 (Layout::choose_output_section): Likewise.
7625 (Layout::make_output_section): Likewise.
7626 (Layout::add_output_section_data): Add is_dynamic_linker_section
7627 parameter. Change all callers.
7628 * layout.h (class Layout): Update declarations.
7629 * output.h (class Output_section): Add is_interp, set_is_interp,
7630 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
7631 Add is_interp_, is_dynamic_linker_section_ fields. Change
7632 generate_code_fills_at_write_ to a bitfield.
7633 * output.cc (Output_section::Output_sections): Initialize new
7635 (Output_segment::add_output_section): Add do_sort parameter.
7638 2009-11-03 Ian Lance Taylor <iant@google.com>
7641 * options.h (class General_options): Add --warn-common.
7642 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
7643 merging two common symbols.
7644 (Symbol_table::should_override): Handle --warn-common when merging
7645 a common symbol with a defined symbol. Use report_resolve_problem
7646 for multiple definitions.
7647 (Symbol_table::report_resolve_problem): New function.
7648 * symtab.h (class Symbol_table): Declare report_resolve_problem.
7650 2009-11-03 Doug Kwan <dougkwan@google.com>
7652 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
7654 (Target_arm::stub_factory): New method definition.
7655 (Target_arm::new_arm_input_section,
7656 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
7657 Target_arm::reloc_uses_thumb_bit): New method declarations.
7658 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
7659 New type definitions.
7660 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
7661 member declarations.
7662 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
7663 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
7664 New method definitions.
7666 2009-11-03 Ian Lance Taylor <iant@google.com>
7668 * options.h (class General_options): Add --warn_constructors.
7670 2009-11-03 Ian Lance Taylor <iant@google.com>
7673 * defstd.cc (in_section): Add entries for __rel_iplt_start,
7674 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
7676 2009-11-03 Ian Lance Taylor <iant@google.com>
7679 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
7680 --msgid-bugs-address.
7681 (install-pdf): New target.
7682 (install-data_yes): Look up one directory to find mkinstalldirs.
7684 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
7686 * po/Make-in (.po.gmo): Don't generate .gmo files in source
7689 2009-10-30 Doug Kwan <dougkwan@google.com>
7691 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
7693 2009-10-30 Doug Kwan <dougkwan@google.com>
7695 * arm.cc (Stub_addend_reader): New struct template definition
7696 and partial specializations.
7697 (Stub_addend_reader::operator()): New method definition for a
7698 partially specialized template.
7700 2009-10-30 Doug Kwan <dougkwan@google.com>
7702 * arm.cc (Arm_relobj::processor_specific_flags): New method
7704 (Arm_relobj::do_read_symbols): New method declaration.
7705 (Arm_relobj::processor_specific_flags_): New data member declaration.
7706 (Arm_dynobj): New class definition.
7707 (Target_arm::do_finalize_sections): Add input_objects parameter.
7708 (Target_arm::do_adjust_elf_header): New method declaration.
7709 (Target_arm::are_eabi_versions_compatible,
7710 (Target_arm::merge_processor_specific_flags): New method declaration.
7711 (Target_arm::do_make_elf_object): New overloaded method definitions
7713 (Arm_relobj::do_read_symbols): New method definition.
7714 (Arm_dynobj::do_read_symbols): Ditto.
7715 (Target_arm::do_finalize_sections): Add input_objects parameters.
7716 Merge processor-specific flags from all input objects.
7717 (Target_arm::are_eabi_versions_compatible,
7718 Target_arm::merge_processor_specific_flags,
7719 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
7720 New method definitions.
7721 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
7722 Input_objects pointer type parameter.
7723 * layout.cc (Layout::finalize): Pass input objects to target's.
7724 finalize_sections function.
7725 * output.cc (Output_file_header::do_sized_write): Set ELF file
7726 header's processor-specific flags.
7727 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
7728 Input_objects pointer type parameter.
7729 * sparc.cc (Target_sparc::do_finalize_sections): Same.
7730 * target.h (Input_objects): New forward class declaration.
7731 (Target::processor_specific_flags,
7732 Target::are_processor_specific_flags_sect): New method definitions.
7733 (Target::finalize_sections): Add input_objects parameter.
7734 (Target::Target): Initialize processor_specific_flags_ and
7735 are_processor_specific_flags_set_.
7736 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
7738 (Target::set_processor_specific_flags): New method definition.
7739 (Target::processor_specific_flags_,
7740 Target::are_processor_specific_flags_set_): New data member
7742 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
7743 Input_objects pointer type parameter.
7745 2009-10-30 Doug Kwan <dougkwan@google.com>
7747 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
7749 2009-10-28 Ian Lance Taylor <iant@google.com>
7751 * object.h (class Relobj): Drop options parameter from
7752 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
7753 do_scan_relocs, do_relocate. Change all callers.
7754 (class Sized_relobj): Drop options parameters from
7755 do_gc_process_relocs, do_scan_relocs, do_relocate,
7756 do_relocate_sections, relocate_sections, emit_relocs_scan,
7757 emit_relocs_scan_reltype. Change all callers.
7758 (struct Relocate_info): Remove options field and all references to
7760 * reloc.h (class Read_relocs): Remove options constructor
7761 parameter and options_ field. Change all callers.
7762 (class Gc_process_relocs, class Scan_relocs): Likewise.
7763 (class Relocate_task): Likewise.
7764 * target-reloc.h (scan_relocs): Remove options parameter. Change
7766 (scan_relocatable_relocs): Likewise.
7767 * target.h (class Sized_target): Remove options parameter from
7768 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
7770 * gc.h (gc_process_relocs): Remove options parameter. Change all
7772 * arm.cc: Update functions to remove options parameters.
7773 * i386.cc: Likewise.
7774 * powerpc.cc: Likewise.
7775 * sparc.cc: Likewise.
7776 * x86_64.cc: Likewise.
7777 * testsuite/testfile.cc: Likewise.
7779 2009-10-28 Doug Kwan <dougkwan@google.com>
7781 * arm.cc (Arm_relobj): New class definition.
7782 (Arm_relobj::scan_sections_for_stubs,
7783 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
7784 New method definitions.
7786 2009-10-28 Cary Coutant <ccoutant@google.com>
7788 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
7789 (Plugin::cleanup_done_): New member.
7790 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
7791 (Plugin_manager::cleanup_done_): Remove.
7792 (Plugin_manager::add_input_file): Edit error message.
7793 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
7794 (Plugin_manager::cleanup): Remove use of cleanup_done_.
7796 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
7798 * fileread.cc: (File_read::View::~View): Use the new
7799 data_ownership_ filed.
7800 (File_read::~File_read): Dispose the new whole_file_view_.
7801 (File_read::open): Mmap the whole file if needed.
7802 (File_read::open): Use whole_file_view_ instead of contents_.
7803 (File_read::find_view): Use whole_file_view_ if applicable.
7804 (File_read::do_read): Use whole_file_view_ instead of contents_.
7805 (File_read::make_view): Use whole_file_view_ instead of contents_,
7806 update File_read::View::View call.
7807 (File_read::find_or_make_view): Update File_read::View::View
7809 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
7811 (File_read::View::Data_ownership): New enum.
7812 (File_read::View::View): Replace bool mapped_ with Data_ownership
7814 (File_read::View::mapped_): Remove (replaced by data_ownership_).
7815 (File_read::View::data_ownership_): New field.
7816 (File_read::contents_): Remove (replaced by whole_file_view_).
7817 (File_read::whole_file_view_): New field.
7818 * options.h (class General_options): Add --keep-files-mapped.
7820 2009-10-27 Cary Coutant <ccoutant@google.com>
7822 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
7823 * testsuite/Makefile.am (plugin_test_5): New test case.
7824 * testsuite/Makefile.in: Regenerate.
7826 2009-10-25 Doug Kwan <dougkwan@google.com>
7828 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
7829 from private to protected to allow access by child class.
7830 (Sized_relobj::do_relocate_sections): New method declaration.
7831 (Sized_relobj::relocate_sections): Virtualize.
7832 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
7833 Sized_relobj::relocate_sections. Instantiate template explicitly
7834 for different target sizes and endianity.
7836 2009-10-24 Doug Kwan <dougkwan@google.com>
7838 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
7839 (Arm_input_section::as_arm_input_section): New method.
7840 (Arm_output_section): New class definition.
7841 (Arm_output_section::create_stub_group,
7842 Arm_output_section::group_sections): New method definitions.
7844 2009-10-22 Doug Kwan <dougkwan@google.com>
7846 * arm.cc (Arm_input_section): New class definition.
7847 (Arm_input_section::init, Arm_input_section:do_write,
7848 Arm_input_section::set_final_data_size,
7849 Arm_input_section::do_reset_address_and_file_offset): New method
7852 2009-10-21 Doug Kwan <dougkwan@google.com>
7854 * arm.cc (Stub_table, Arm_input_section): New forward class
7856 (Stub_table): New class defintion.
7857 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
7858 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
7859 New method definition.
7861 2009-10-21 Doug Kwan <dougkwan@google.com>
7863 * arm.cc: Update copyright comments.
7864 (Target_arm): New forward class template declaration.
7865 (Arm_address): New type.
7866 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
7867 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
7868 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
7870 (Insn_template): Same.
7871 (DEF_STUBS): New macro.
7872 (Stub_type): New enum type.
7873 (Stub_template): New class definition.
7876 (Stub_factory): Same.
7877 (Target_arm::Target_arm): Initialize may_use_blx_ and
7878 should_force_pic_veneer_.
7879 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
7880 Target_arm::should_force_pic_veneer,
7881 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
7882 Target_arm::using_thumb_only, Target_arm:;default_target): New
7884 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
7885 New data member declarations.
7886 (Insn_template::size, Insn_template::alignment): New method defintions.
7887 (Stub_template::Stub_template): New method definition.
7888 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
7889 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
7890 (Stub_factory::Stub_factory): New method definition.
7891 * gold.h (string_hash): New template.
7892 * output.h (Input_section_specifier::hash_value): Use
7894 (Input_section_specifier::string_hash): Remove.
7895 * stringpool.cc (Stringpool_template::string_hash): Use
7898 2009-10-20 Doug Kwan <dougkwan@google.com>
7900 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
7901 symbols of relaxed input sections.
7902 * output.h (Output_section::find_relaxed_input_section): Make
7905 2009-10-16 Doug Kwan <dougkwan@google.com>
7907 * dynobj.cc (Versions::Versions): Initialize version_script_.
7908 Only insert base version symbol definition for a shared object
7909 if version script defines any version versions.
7910 (Versions::define_base_version): New method definition.
7911 (Versions::add_def): Check that base version is not needed.
7912 (Versions::add_need): Define base version lazily.
7913 * dynobj.h (Versions::define_base_version): New method declaration.
7914 (Versions::needs_base_version_): New data member declaration.
7915 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
7916 (check_DATA): Add no_version_test.stdout.
7917 (libno_version_test.so, no_version_test.o no_version_test.stdout):
7919 * testsuite/Makefile.in: Regenerate.
7920 * testsuite/no_version_test.c: New file.
7921 * testsuite/no_version_test.sh: Ditto.
7923 2009-10-16 Doug Kwan <dougkwan@google.com>
7925 * expression.cc (class Segment_start_expression): New class definition.
7926 (Segment_start_expression::value): New method definition.
7927 (script_exp_function_segment_start): Return a new
7928 Segment_start_expression.
7929 * gold/script-c.h (script_saw_segment_start_expression): New function
7931 * script-sections.cc (Script_sections::Script_sections): Initialize
7932 SAW_SEGMENT_START_EXPRESSION_ to false.
7933 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
7934 and -Tbbs options to specify section addresses if given in
7935 command line and no SEGMENT_START expression is seen in a script.
7936 * script-sections.h (Script_sections::saw_segment_start_expression,
7937 Script_sections::set_saw_segment_start_expression): New method
7939 (Script_sections::saw_segment_start_expression_): New data member
7941 * script.cc (script_saw_segment_start_expression): New function.
7942 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
7943 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
7944 script_test_7.sh and script_test_8.sh.
7945 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
7946 script_test_8.stdout.
7947 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
7948 (script_test_6, script_test_6.stdout, script_test_7,
7949 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
7950 * Makefile.in: Regenerate.
7951 * testsuite/script_test_6.sh: New file.
7952 * testsuite/script_test_6.t: Same.
7953 * testsuite/script_test_7.sh: Same.
7954 * testsuite/script_test_7.t: Same.
7955 * testsuite/script_test_8.sh: Same.
7957 2009-10-16 Doug Kwan <dougkwan@google.com>
7959 * output.cc (Output_segment::set_section_list_address): Cast
7960 expressions to unsigned long long type to avoid format warnings.
7962 2009-10-15 Ian Lance Taylor <iant@google.com>
7964 * script.cc (Script_options::add_symbol_assignment): Always add a
7965 dot assignment to script_sections_.
7966 * script-sections.cc (Script_sections::add_dot_assignment):
7967 Initialize if necessary.
7969 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
7970 program headers with no load segment if there is a linker script.
7972 * layout.cc (Layout::set_segment_offsets): Align the file offset
7973 to the segment aligment for -N or -n with no load segment.
7974 * output.cc (Output_segment::add_output_section): Don't crash if
7975 the first section is a TLS section.
7976 (Output_segment::set_section_list_addresses): Print an error
7977 message if the address moves backward in a linker script.
7978 * script-sections.cc
7979 (Output_section_element_input::set_section_addresses): Don't
7980 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
7981 (Orphan_output_section::set_section_addresses): Likewise.
7983 2009-10-15 Doug Kwan <dougkwan@google.com>
7985 * layout.cc (Layout::finish_dynamic_section): Generate tags
7986 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
7987 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
7988 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
7990 2009-10-14 Ian Lance Taylor <iant@google.com>
7992 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
7994 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
7995 data_shdr fields of relinfo.
7996 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
7997 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
7998 R_386_TLS_LDO_32, adjust based on section flags.
7999 (Target_i386::Relocate::fix_up_ldo): Remove.
8001 2009-10-13 Ian Lance Taylor <iant@google.com>
8003 Add support for -pie.
8004 * options.h (class General_options): Add -pie and
8006 (General_options::output_is_position_independent): Test -pie.
8007 (General_options::output_is_executable): Return true if not shared
8008 and not relocatable.
8009 (General_options::output_is_pie): Remove.
8010 * options.cc (General_options::finalize): Reject incompatible uses
8012 * gold.cc (queue_middle_tasks): A -pie link is not static.
8013 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
8014 * symtab.cc (Symbol::final_value_is_known): Return false if
8015 output_is_position_independent.
8016 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
8017 output_is_position_independent.
8018 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
8019 output_is_position_independent.
8020 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
8021 output_is_position_independent.
8022 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
8024 (basic_pie_test.o, basic_pie_test): New targets.
8025 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
8026 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
8027 (two_file_pie_test): New target.
8028 * testsuite/Makefile.in: Rebuild.
8029 * README: Remove note saying that -pie is not supported.
8031 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
8033 * options.h (class General_options): Add -init and -fini.
8034 * layout.cc (Layout::finish_dynamic_section): Emit
8035 given init and fini functions.
8037 2009-10-13 Sriraman Tallam <tmsriram@google.com>
8039 * gc.h (gc_process_relocs): Check if icf is enabled using new
8041 * gold.cc (queue_initial_tasks): Likewise.
8042 (queue_middle_tasks): Likewise.
8043 * object.cc (do_layout): Likewise.
8044 * symtab.cc (is_section_folded): Likewise.
8045 * main.cc (main): Likewise.
8046 * reloc.cc (Read_relocs::run): Likewise.
8047 (Sized_relobj::do_scan_relocs): Likewise.
8048 * icf.cc (is_function_ctor_or_dtor): New function.
8049 (Icf::find_identical_sections): Check if function is ctor or dtor when
8051 * options.h (General_options::icf): Change option to be an enum.
8052 (Icf_status): New enum.
8053 (icf_enabled): New method.
8054 (icf_safe_folding): New method.
8055 (set_icf_status): New method.
8056 (icf_status_): New variable.
8057 * (options.cc) (General_options::finalize): Set icf_status_.
8058 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
8059 icf_test and icf_keep_unique_test to use the --icf enum flag.
8060 * testsuite/icf_safe_test.sh: New file.
8061 * testsuite/icf_safe_test.cc: New file.
8063 2009-10-12 Sriraman Tallam <tmsriram@google.com>
8065 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
8066 includes to gc.h and icf.h.
8067 * arm.cc: Include gc.h.
8068 * gold.cc: Likewise.
8069 * i386.cc: Likewise.
8070 * powerpc.cc: Likewise.
8071 * sparc.cc: Likewise.
8072 * x86_64.cc: Likewise.
8073 * gc.h: Include icf.h.
8075 2009-10-11 Ian Lance Taylor <iant@google.com>
8077 * plugin.cc: Include "gold.h" before other header files.
8079 2009-10-10 Chris Demetriou <cgd@google.com>
8081 * options.h (Input_file_argument::Input_file_type): New enum.
8082 (Input_file_argument::is_lib_): Replace with...
8083 (Input_file_argument::type_): New member.
8084 (Input_file_argument::Input_file_argument): Take Input_file_type
8085 'type' rather than boolean 'is_lib' as second argument.
8086 (Input_file_argument::is_lib): Use type_.
8087 (Input_file_argument::is_searched_file): New function.
8088 (Input_file_argument::may_need_search): Handle is_searched_file.
8089 * options.cc (General_options::parse_library): Support -l:filename.
8090 (General_options::parse_just_symbols): Update for Input_file_argument
8092 (Command_line::process): Likewise.
8093 * archive.cc (Archive::get_file_and_offset): Likewise.
8094 * plugin.cc (Plugin_manager::release_input_file): Likewise.
8095 * script.cc (read_script_file, script_add_file): Likewise.
8096 * fileread.cc (Input_file::Input_file): Likewise.
8097 (Input_file::will_search_for): Handle is_searched_file.
8098 (Input_file::open): Likewise.
8099 * readsyms.cc (Read_symbols::get_name): Likewise.
8100 * testsuite/Makefile.am (searched_file_test): New test.
8101 * testsuite/Makefile.in: Regenerate.
8102 * testsuite/searched_file_test.cc: New file.
8103 * testsuite/searched_file_test_lib.cc: New file.
8105 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8106 Ian Lance Taylor <iant@google.com>
8108 * descriptor.cc: Include <cstdio> and "binary-io.h".
8109 (Descriptors::open): Open the files in binary mode always.
8110 * script.cc (Lex::get_token): Treat \r as whitespace.
8112 2009-10-09 Ian Lance Taylor <iant@google.com>
8114 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
8116 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8117 Ian Lance Taylor <iant@google.com>
8119 * configure.ac: Check for readv function also.
8120 * fileread.cc (readv): Define if not HAVE_READV.
8121 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
8123 * config.in: Regenerate.
8124 * configure: Regenerate.
8126 2009-10-09 Doug Kwan <dougkwan@google.com>
8128 * layout.cc (Layout::make_output_section): Call target hook to make
8129 ordinary output section.
8130 (Layout::finalize): Adjust parameter list of call the
8131 Target::may_relax().
8132 * layout.h (class Layout::section_list): New method.
8133 * merge.h (Output_merge_base::entsize): Change visibility to public.
8134 (Output_merge_base::is_string, Output_merge_base::do_is_string):
8136 (Output_merge_string::do_is_string): New method.
8137 * object.cc (Sized_relobj::do_setup): renamed from
8138 Sized_relobj::set_up.
8139 * object.h (Sized_relobj::adjust_shndx,
8140 Sized_relobj::initializ_input_to_output_maps,
8141 Sized_relobj::free_input_to_output_maps): Change visibilities to
8143 (Sized_relobj::setup): Virtualize.
8144 (Sized_relobj::do_setup): New method declaration.
8145 (Sized_relobj::invalidate_section_offset,
8146 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
8147 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
8148 * options.cc (parse_int): New function.
8149 * options.h (parse_int): New declaration.
8150 (DEFINE_int): New macro.
8151 (stub_group_size): New option.
8152 * output.cc (Output_section::Output_section): Initialize memebers
8153 merge_section_map_, merge_section_by_properties_map_,
8154 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
8155 (Output_section::add_input_section): Handled deferred code-fill
8156 generation and remove an old comment.
8157 (Output_section::add_relaxed_input_section): New method definition.
8158 (Output_section::add_merge_input_section): Use merge section by
8159 properties map to speed to search. Update merge section maps
8161 (Output_section::build_relaxation_map): New method definition.
8162 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8164 (Output_section::relax_input_section): Renamed to
8165 Output_section::convert_input_sections_to_relaxed_sections and change
8166 interface to take a vector of pointers to relaxed sections.
8167 (Output_section::find_merge_section,
8168 Output_section::find_relaxed_input_section): New method definitions.
8169 (Output_section::is_input_address_mapped,
8170 Output_section::output_offset, Output_section::output_address):
8171 Use output section data maps to speed up searching.
8172 (Output_section::find_starting_output_address): Add comments.
8173 (Output_section::do_write,
8174 Output_section::write_to_postprocessing_buffer): Do code-fill
8175 generation as appropriate.
8176 (Output_section::get_input_sections): Invalidate relaxed input section
8178 (Output_section::restore_states): Adjust type of checkpoint .
8179 Invalidate relaxed input section map.
8180 * output.h (Output_merge_base): New class declaration.
8181 (Input_section_specifier): New class defintion.
8182 (class Output_relaxed_input_section) Change base class to
8183 Output_section_data_build.
8184 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
8185 base class initializer.
8186 (Output_section::add_relaxed_input_section): New method declaration.
8187 (Output_section::Input_section): Change visibility to protected.
8188 (Output_section::Input_section::relobj,
8189 Output_section::Input_section::shndx): Handle relaxed input sections.
8190 Output_section::input_sections) Change visibility to protected. Also
8191 define overload to return a non-const pointer.
8192 (Output_section::Merge_section_properties): New class defintion.
8193 (Output_section::Merge_section_by_properties_map,
8194 Output_section::Output_section_data_by_input_section_map,
8195 Output_section::Relaxation_map): New types.
8196 (Output_section::relax_input_section): Rename method to
8197 Output_section::convert_input_sections_to_relaxed_sections and change
8198 interface to take a vector of relaxed section pointers.
8199 (Output_section::find_merge_section,
8200 Output_section::find_relaxed_input_section,
8201 Output_section::build_relaxation_map,
8202 Output_section::convert_input_sections_in_list_to_relaxed_sections):
8203 New method declarations.
8204 (Output_section::merge_section_map_
8205 Output_section::merge_section_by_properties_map_,
8206 Output_section::relaxed_input_section_map_,
8207 Output_section::is_relaxed_input_section_map_valid_,
8208 Output_section::generate_code_fills_at_write_): New data members.
8209 * script-sections.cc
8210 (Output_section_element_input::set_section_addresses): Call
8211 current_data_size and addralign methods of relaxed input sections.
8212 (Orphan_output_section::set_section_addresses): Call current_data_size
8213 and addralign methods of relaxed input sections.
8214 * symtab.cc (Symbol_table::compute_final_value): Extract template
8215 from the body of Symbol_table::sized_finalize_symbol.
8216 (Symbol_table::sized_finalized_symbol): Call
8217 Symbol_table::compute_final_value.
8218 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
8219 (Symbol_table::compute_final_value): New templated method declaration.
8220 * target.cc (Target::do_make_output_section): New method defintion.
8221 * target.h (Target::make_output_section): New method declaration.
8222 (Target::relax): Add more parameters for input objects, symbol table
8223 and layout. Adjust call to do_relax.
8224 (Target::do_make_output_section): New method declaration.
8225 (Target::do_relax): Add parameters for input objects, symbol table
8228 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8230 * pread.c: Include stdio.h.
8232 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8234 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
8237 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8239 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8240 Change read_shndx type to unsigned int.
8241 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8243 (Sized_dwarf_line_info::read_line_mappings): Likewise.
8244 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
8245 Change read_shndx type to unsigned int.
8246 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8248 (Sized_dwarf_line_info::read_line_mappings): Likewise.
8249 * layout.cc (Layout::create_symtab_sections): Cast the result of
8250 local_symcount * symsize to off_t in the gold_assert.
8252 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8254 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
8255 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
8257 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
8258 (Arm_relocate_functions::thm_abs5): New function.
8259 (Arm_relocate_functions::abs12): New function.
8260 (Arm_relocate_functions::abs16): New function.
8261 (Arm_relocate_functions::base_abs): New function.
8262 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
8263 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
8264 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
8266 (Scan::global): Likewise.
8267 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
8268 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
8269 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
8270 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
8273 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8275 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
8276 (Arm_relocate_functions::movt_prel): New function.
8277 (Arm_relocate_functions::thm_movw_prel_nc): New function.
8278 (Arm_relocate_functions::thm_movt_prel): New function.
8279 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8280 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8281 (Scan::global, Relocate::relocate): Likewise.
8282 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8284 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8286 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8287 Incremental_checker.
8288 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8290 (class Incremental_inputs_header): New class.
8291 (Incremental_inputs_header_writer): Edit comment.
8292 (Incremental_inputs_entry): New class.
8293 (Incremental_inputs_entry_writer): Edit comment.
8294 (Sized_incremental_binary::do_find_incremental_inputs_section):
8295 Add *strtab_shndx parameter, fill it.
8296 (Sized_incremental_binary::do_check_inputs): New method.
8297 (Incremental_checker::can_incrementally_link_output_file): Use
8298 Sized_incremental_binary::check_inputs.
8299 (Incremental_inputs::report_command_line): Save command line in
8302 (Incremental_binary::find_incremental_inputs_section): New
8304 (Incremental_binary::do_find_incremental_inputs_section): Add
8305 strtab_shndx parameter.
8306 (Incremental_binary::do_check_inputs): New pure virtual method.
8307 (Sized_incremental_binary::do_check_inputs): Declare.
8308 (Incremental_checker::Incremental_checker): Add incremental_inputs
8309 parameter, use it to initialize incremental_inputs_.
8310 (Incremental_checker::incremental_inputs_): New field.
8311 (Incremental_checker::command_line): New method.
8312 (Incremental_checker::inputs): New method.
8313 (Incremental_checker::command_line_): New field.
8315 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8317 * incremental.cc: Include <cstdarg> and "target-select.h".
8318 (vexplain_no_incremental): New function.
8319 (explain_no_incremental): New function.
8320 (Incremental_binary::error): New method.
8321 (Sized_incremental_binary::do_find_incremental_inputs_section): New
8323 (make_sized_incremental_binary): New function.
8324 (open_incremental_binary): New function.
8325 (can_incrementally_link_file): Add checks if output is ELF and has
8327 * incremental.h: Include "elfcpp_file.h" and "output.h".
8328 (Incremental_binary): New class.
8329 (Sized_incremental_binary): New class.
8330 (open_incremental_binary): Declare.
8331 * object.cc (is_elf_object): Use
8332 elfcpp::Elf_recognizer::is_elf_file.
8333 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
8334 * output.h (Output_file::filesize): New method.
8336 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8338 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
8340 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
8341 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
8343 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
8345 (Arm_relocate_functions::movw_abs_nc): New function.
8346 (Arm_relocate_functions::movt_abs): New function.
8347 (Arm_relocate_functions::thm_movw_abs_nc): New function.
8348 (Arm_relocate_functions::thm_movt_abs): New function.
8349 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
8350 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
8351 (Scan::global): Likewise.
8352 (Relocate::relocate): Likewise.
8353 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8355 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8357 * arm.cc (Arm_relocate_functions::got_prel) New function.
8358 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
8359 (Relocate::relocate): Likewise.
8360 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8362 2009-10-06 Ian Lance Taylor <iant@google.com>
8364 * options.h (class General_options): Define
8365 split_stack_adjust_size parameter.
8366 * object.h (class Object): Add uses_split_stack_ and
8367 has_no_split_stack_ fields. Add uses_split_stack and
8368 has_no_split_stack accessor functions. Declare
8369 handle_split_stack_section.
8370 (class Reloc_symbol_changes): Define.
8371 (class Sized_relobj): Define Function_offsets. Declare
8372 split_stack_adjust, split_stack_adjust_reltype, and
8374 * object.cc (Object::handle_split_stack_section): New function.
8375 (Sized_relobj::do_layout): Call handle_split_stack_section.
8376 * dynobj.cc (Sized_dynobj::do_layout): Call
8377 handle_split_stack_section.
8378 * reloc.cc (Sized_relobj::relocate_sections): Call
8379 split_stack_adjust for executable sections in split_stack
8380 objects. Pass reloc_map to relocate_section.
8381 (Sized_relobj::split_stack_adjust): New function.
8382 (Sized_relobj::split_stack_adjust_reltype): New function.
8383 (Sized_relobj::find_functions): New function.
8384 * target-reloc.h: Include "object.h".
8385 (relocate_section): Add reloc_symbol_changes parameter. Change
8387 * target.h (class Target): Add calls_non_split method. Declare
8388 do_calls_non_split virtual method. Declare match_view and
8390 * target.cc: Include "elfcpp.h".
8391 (Target::do_calls_non_split): New function.
8392 (Target::match_view): New function.
8393 (Target::set_view_to_nop): New function.
8394 * gold.cc (queue_middle_tasks): Give an error if mixing
8395 split-stack and non-split-stack objects with -r.
8396 * i386.cc (Target_i386::relocate_section): Add
8397 reloc_symbol_changes parameter.
8398 (Target_i386::do_calls_non_split): New function.
8399 * x86_64.cc (Target_x86_64::relocate_section): Add
8400 reloc_symbol_changes parameter.
8401 (Target_x86_64::do_calls_non_split): New function.
8402 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
8404 * powerpc.cc (Target_powerpc::relocate_section): Add
8405 reloc_symbol_changes parameter.
8406 * sparc.cc (Target_sparc::relocate_section): Add
8407 reloc_symbol_changes parameter.
8408 * configure.ac: Call AM_CONDITIONAL for the default target.
8409 * configure: Rebuild.
8410 * testsuite/Makefile.am (TEST_AS): New variable.
8411 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
8412 (check_DATA): Add split_i386 and split_x86_64 files.
8413 (SPLIT_DEFSYMS): Define.
8414 (split_i386_[1234n].o): New targets.
8415 (split_i386_[124]): New targets.
8416 (split_i386_[1234r].stdout): New targets.
8417 (split_x86_64_[1234n].o): New targets.
8418 (split_x86_64_[124]): New targets.
8419 (split_x86_64_[1234r].stdout): New targets.
8420 (MOSTLYCLEANFILES): Add new executables.
8421 * testsuite/split_i386.sh: New file.
8422 * testsuite/split_x86_64.sh: New file.
8423 * testsuite/split_i386_1.s: New file.
8424 * testsuite/split_i386_2.s: New file.
8425 * testsuite/split_i386_3.s: New file.
8426 * testsuite/split_i386_4.s: New file.
8427 * testsuite/split_i386_n.s: New file.
8428 * testsuite/split_x86_64_1.s: New file.
8429 * testsuite/split_x86_64_2.s: New file.
8430 * testsuite/split_x86_64_3.s: New file.
8431 * testsuite/split_x86_64_4.s: New file.
8432 * testsuite/split_x86_64_n.s: New file.
8433 * testsuite/testfile.cc (Target_test): Update relocation_section
8435 * testsuite/Makefile.in: Rebuild.
8437 2009-10-06 Ian Lance Taylor <iant@google.com>
8439 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
8440 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
8441 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
8442 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
8443 the address on ldo_addrs_.
8444 (Target_i386::Relocate::fix_up_ldo): New function.
8446 2009-10-06 Rafael Espindola <espindola@google.com>
8448 * plugin.cc (add_input_library): New.
8449 (Plugin::load): Add add_input_library to tv.
8450 (Plugin_manager::add_input_file): Add the is_lib argument.
8451 (add_input_file): Update call to Plugin_manager::add_input_file.
8452 (add_input_library): New.
8453 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
8455 2009-09-30 Doug Kwan <dougkwan@google.com>
8457 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
8458 symbol and call Symbol::may_need_copy_reloc to determine if
8459 a copy reloc is needed.
8460 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
8461 nocopyreloc is given in command line.
8462 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
8463 given in command line.
8464 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
8465 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
8466 of the removed Target_i386::may_need_copy_reloc.
8467 * options.h (copyreloc): New option with default value false.
8468 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8469 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
8470 instead of the removed Target_powerpc::may_need_copy_reloc.
8471 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8472 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
8473 instead of the removed Target_sparc::may_need_copy_reloc.
8474 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
8475 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
8476 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
8477 instead of the removed Target_x86_64::may_need_copy_reloc.
8479 2009-09-30 Ian Lance Taylor <iant@google.com>
8481 * object.h (class Object): Remove target_ field, and target,
8482 sized_target, and set_target methods.
8483 (Object::sized_target): Remove.
8484 (class Sized_relobj): Update declarations. Remove sized_target.
8485 * object.cc (Sized_relobj::setup): Remove target parameter.
8487 (Input_objects::add_object): Don't do anything with the target.
8488 (make_elf_sized_object): Add punconfigured parameter. Change all
8489 callers. Set or test parameter target.
8490 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
8492 * parameters.cc (Parameters::set_target): Change parameter type to
8494 (Parameters::default_target): Remove.
8495 (set_parameters_target): Change parameter type to be non-const.
8496 (parameters_force_valid_target): New function.
8497 (parameters_clear_target): New function.
8498 * parameters.h (class Parameters): Update declarations. Remove
8499 default_target method. Add sized_target and clear_target
8500 methods. Change target_ to be non-const.
8501 (set_parameters_target): Update declaration.
8502 (parameters_force_valid_target): Declare.
8503 (parameters_clear_target): Declare.
8504 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
8505 as NULL if we aren't searching.
8506 (Add_symbols::run): Don't check for compatible target.
8507 * fileread.cc (Input_file::open_binary): Call
8508 parameters_force_valid_target.
8509 * gold.cc (queue_middle_tasks): Likewise.
8510 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
8511 set_target on object.
8512 * dynobj.h (class Sized_dynobj): Update declarations.
8513 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
8514 make_elf_object returns NULL.
8515 (Archive::include_member): Don't check whether object target is
8517 * output.cc (Output_section::add_input_section): Get target from
8519 (Output_section::relax_input_section): Likewise.
8520 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
8522 (Sized_relobj::do_scan_relocs): Likewise.
8523 (Sized_relobj::relocate_sections): Likewise.
8524 * resolve.cc (Symbol_table::resolve): Likewise.
8525 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
8526 parameter. Change all callers.
8527 (Symbol_table::add_from_object): Get target from parameters.
8528 (Symbol_table::add_from_relobj): Don't check object target.
8529 (Symbol_table::add_from_dynobj): Likewise.
8530 (Symbol_table::define_special_symbol): Get target from
8532 * symtab.h (class Symbol_table): Update declaration.
8533 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
8534 parameter. Change all callers. Clear parameter target.
8535 (Binary_test): Test target here.
8536 * testsuite/object_unittest.cc (gold_testsuite): Remove
8537 target_test_pointer parameter. Change all callers.
8538 (Object_test): Test target here.
8540 2009-09-26 Ian Lance Taylor <iant@google.com>
8542 * testsuite/initpri1.c: Don't try to use constructor priorities if
8543 compiling with gcc before 4.3.
8545 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
8547 * testsuite/retain_symbols_file_test.sh (check_present): Change
8548 output file name to retain_symbols_file_test.stdout.
8549 (check_absent): Likewise.
8551 2009-09-18 Craig Silverstein <csilvers@google.com>
8553 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
8554 * options.cc: Include <cerrno> and <fstream>.
8555 (General_options::finalize): Parse -retain-symbols-file tag.
8556 * options.h: New flag.
8557 (General_options): New method should_retain_symbol, new
8558 variable symbols_to_retain.
8559 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
8560 should_retain_symbol map.
8561 * testsuite/Makefile.am (retain_symbols_file_test): New test.
8562 * testsuite/Makefile.in: Regenerate.
8563 * testsuite/retain_symbols_file_test.sh: New file.
8565 2009-09-18 Nick Clifton <nickc@redhat.com>
8567 * po/es.po: Updated Spanish translation.
8569 2009-09-17 Doug Kwan <dougkwan@google.com>
8571 * debug.h (DEBUG_RELAXATION): New constant.
8572 (DEBUG_ALL): Add DEBUG_RELAXATION.
8573 (debug_string_to_enum): Add relaxation debug option.
8575 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
8576 Layout::Relaxation_debug_check::read_sections,
8577 Layout::Relaxation_debug_check::read_sections): New method definitions.
8578 (Layout::Layout): Initialize data members
8579 record_output_section_data_from_scrips_,
8580 script_output_section_data_list_ and relaxation_debug_check_.
8581 (Layout::save_segments, Layout::restore_segments,
8582 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8583 Layout::relaxation_loop_body): New method definitions.
8584 (Layout::finalize): Support relaxation. Move section layout code to
8585 Layout::relaxation_loop_body.
8586 (Layout::set_asection_address_from_script): Move code for orphan
8587 section placement out.
8588 (Layout::place_orphan_sections_in_script): New method definition.
8589 * layout.h (Output_segment_headers, Output_file_header):
8590 New forward class declarations.
8591 (Layout::~Layout): Define.
8592 (Layout::new_output_section_data_from_script): New method definition.
8593 (Layout::place_orphan_sections_in_script): New method declaration.
8594 (Layout::Segment_states): New type declaration.
8595 (Layout::save_segments, Layout::restore_segments,
8596 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8597 Layout::relaxation_loop_body): New method declarations.
8598 (Layout::Output_section_data_list): New type declaration.
8599 (Layout::Relaxation_debug_check): New class definition.
8600 (Layout::record_output_section_data_from_script_,
8601 Layout::script_output_section_data_list_, Layout::segment_states_,
8602 Layout::relaxation_debug_check_): New data members.
8603 * output.cc: (Output_section_headers::do_size): New method definition.
8604 (Output_section_headers::Output_section_headers): Move size
8605 computation to Output_section_headers::do_size.
8606 (Output_segment_headers::do_size): New method definition.
8607 (Output_file_header::Output_file_header): Move size computation to
8608 Output_file_header::do_size and call it.
8609 (Output_file_header::do_size): New method definition.
8610 (Output_data_group::Output_data_group): Adjust call to
8611 Output_section_data.
8612 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
8613 (Output_symtab_xindex::do_write): Add array bound check.
8614 (Output_section::Input_section::print_to_mapfile): Handle
8615 RELAXED_INPUT_SECTION_CODE.
8616 (Output_section::Output_section): Initialize data member checkpoint_.
8617 (Output_section::~Output_section): Delete checkpoint object pointed
8619 (Output_section::add_input_section): Always add an Input_section if
8621 (Output_section::add_merge_input_section): Add assert.
8622 (Output_section::relax_input_section): New method definition.
8623 (Output_section::set_final_data_size): Set load address to zero for
8624 an unallocated section.
8625 (Output_section::do_address_and_file_offset_have_reset_values):
8626 New method definition.
8627 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
8628 Handle relaxed input section.
8629 (Output_section::sort_attached_input_sections): Checkpoint input
8630 section list lazily.
8631 (Output_section::get_input_sections): Change type of input_sections to
8632 list of Simple_input_section pointers. Checkpoint input section list
8633 lazily. Also handle relaxed input sections.
8634 (Output_section::add_input_section_for_script): Take a reference to
8635 a Simple_input_section object instead of Relobj pointer and section
8636 index as parameter. Handle relaxed input sections.
8637 (Output_section::save_states, Output_section::restore_states): New
8639 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
8640 (Output_data::is_data_size_fixed): New method definition.
8641 (Output_data::reset_addresss_and_file_offset): Do not reset data size
8643 (Output_data::address_and_file_offset_have_reset_values): New method
8645 (Output_data::do_address_and_file_offset_have_reset_values): New method
8647 (Output_data::set_data_size): Check that data size is not fixed.
8648 (Output_data::fix_data_size): New method definition.
8649 (Output_data::is_data_size_fixed_): New data member.
8650 (Output_section_headers::set_final_data_size): New method definition.
8651 (Output_section_headers::do_size): New method declaration.
8652 (Output_segment_headers::set_final_data_size): New method definition.
8653 (Output_segment_headers::do_size): New method declaration.
8654 (Output_file_header::set_final_data_size)::New method definition.
8655 (Output_file_header::do_size)::New method declaration.
8656 (Output_section_data::Output_section_data): Add new parameter
8657 is_data_size_fixed and use it to fix data size.
8658 (Output_data_const::Output_data_const): Adjust call to base class
8659 constructor and fix data size.
8660 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
8661 base class constructor and fix data size.
8662 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
8663 base class constructor and fix data size.
8664 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
8665 class constructor and fix data size.
8666 (Output_data_group::set_final_data_size): New method definition.
8667 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
8668 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
8669 class constructor and fix data size.
8670 (Output_relaxed_input_section): New class definition.
8671 (Output_section::Simple_input_section): New class definition.
8672 (Output_section::get_input_sections): Adjust parameter list.
8673 (Output_section::add_input_section_for_script): Same.
8674 (Output_section::save_states, Output_section::restore_states,
8675 Output_section::do_address_and_file_offset_have_reset_values,
8676 (Output_section::Input_section::Input_section): Handle
8677 RELAXED_INPUT_SECTION_CODE. Add new overload for
8678 Output_relaxed_input_section.
8679 (Output_section::Input_section::is_input_section,
8680 Output_section::Input_section::set_output_section): Handle relaxed
8682 (Output_section::Input_section::is_relaxed_input_section,
8683 Output_section::Input_section::output_section_data,
8684 Output_section::Input_section::relaxed_input_section): New method
8686 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
8688 (Output_section::Input_section::u1_): Update comments.
8689 (Output_section::Input_section::u2_): Add new union member poris.
8690 (Output_section::Checkpoint_output_section): New classs definition.
8691 (Output_section::relax_input_section): New method declaration.
8692 (Output_section::checkpoint_): New data member.
8693 (Output_segment): Update comments.
8694 (Output_segment::Output_segment): Un-privatize copy constructor.
8695 (Output_segment::operator=): Un-privatize.
8696 * script-sections.cc (Output_section_element::Input_section_list):
8697 Change element type to Output_section::Simple_input_section.
8698 (Output_section_element_dot_assignment::set_section_addresses):
8699 Register output section data for relaxation clean up.
8700 (Output_data_exression::Output_data_expression): Adjust call to base
8701 constructor to fix data size.
8702 (Output_section_element_data::set_section_addresses): Register
8703 Output_data_expression object for relaxation clean up.
8704 (struct Input_section_info): Replace Relobj pointer and section index
8705 pair with Output_section::Simple_input_section and Convert struct to a
8707 (Input_section_sorter::operator()): Adjust access to
8708 Input_section_info data member to use accessors.
8709 (Output_section_element_input::set_section_addresses): Use layout
8710 parameter. Adjust code to use Output_section::Simple_input_section
8711 and Input_secction_info classes. Register filler for relaxation
8713 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
8714 and section index pair with Output_section::Simple_input_section
8715 class. Adjust code accordingly.
8716 (Phdrs_element::release_segment): New method definition.
8717 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
8719 (Script_sections::release_segments): New method definition.
8720 * gold/script-sections.h (Script_sections::release_segments): New
8722 * gold/target.h (Target::may_relax, Target::relax,
8723 Target::do_may_relax, Target::do_relax): New method definitions.
8725 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8727 * arm.cc (has_signed_unsigned_overflow): New function.
8728 (Arm_relocate_functions::abs8): New function.
8729 (Target_arm::Scan::local): Handle R_ARM_ABS8.
8730 (Target_arm::Scan::global): Likewise.
8731 (Target_arm::relocate::relocate): Likewise.
8732 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8735 2009-09-16 Cary Coutant <ccoutant@google.com>
8737 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
8738 * testsuite/Makefile.in: Regenerate.
8740 2009-09-11 Nick Clifton <nickc@redhat.com>
8742 * po/gold.pot: Updated by the Translation project.
8744 2009-09-08 Cary Coutant <ccoutant@google.com>
8746 * output.cc (Output_file::open): Add execute permission to empty file.
8747 * testsuite/Makefile.am (permission_test): New test.
8748 * testsuite/Makefile.in: Regenerate.
8750 2009-09-02 Ian Lance Taylor <iant@google.com>
8752 * output.cc (Output_file::resize): Call map_no_anonymous rather
8755 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
8757 * gold.cc: Include "incremental.h".
8758 (queue_initial_tasks): Call Incremental_checker methods.
8759 * incremental.cc: Include "output.h".
8760 (Incremental_checker::can_incrementally_link_output_file): New
8762 * incremental.h (Incremental_checker): New class.
8764 * output.cc (Output_file::open_for_modification): New method.
8765 (Output_file::map_anonymous): Changed return type to bool. Record
8767 (Output_file::map_no_anonymous): New method, broken out of map.
8768 (Output_file::map): Use map_no_anonymous and map_anonymous.
8769 * output.h (class Output_file): Update declarations.
8771 2009-08-24 Cary Coutant <ccoutant@google.com>
8773 * options.h (Command_line::Pre_options): New class.
8774 (Command_line::pre_options): New member.
8775 * options.cc (gold::options::ready_to_register): New variable.
8776 (One_option::register_option): Do nothing if not registering options.
8777 Assert if same short option registered twice.
8778 (General_options::General_options): Turn off option registration when
8780 (Command_line::Pre_options::Pre_options): New constructor.
8782 2009-08-24 Cary Coutant <ccoutant@google.com>
8784 * options.h (General_options::no_keep_memory): Remove incorrect
8787 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8789 * Makefile.am (am__skiplex, am__skipyacc): New.
8790 * Makefile.in: Regenerate.
8792 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8794 * Makefile.am (AM_CPPFLAGS): Renamed from ...
8795 (INCLUDES): ... this.
8796 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
8797 (AM_CPPFLAGS): Renamed from ...
8798 (INCLUDE): ... this.
8799 * Makefile.in, testsuite/Makefile.in: Regenerate.
8801 * Makefile.in: Regenerate.
8802 * aclocal.m4: Likewise.
8803 * config.in: Likewise.
8804 * configure: Likewise.
8805 * testsuite/Makefile.in: Likewise.
8807 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8808 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8809 * Makefile.in: Regenerate.
8810 * testsuite/Makefile.in: Regenerate.
8812 2009-08-19 Cary Coutant <ccoutant@google.com>
8814 * resolve.cc (Symbol_table::resolve): Don't complain about defined
8815 symbols in shared libraries overridden by hidden or internal symbols
8816 in the main program.
8818 2009-08-19 Chris Demetriou <cgd@google.com>
8820 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
8821 checking source file names in error messages.
8823 2009-08-18 Doug Kwan <dougkwan@google.com>
8825 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
8826 an elcpp::Ehdr as parameter. Adjust call to set_target.
8827 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
8828 an elfcpp::Ehdr as parameter.
8829 * object.cc (Object::set_target): Remove the version that looks up
8830 a target and sets it.
8831 (Sized_relobj::setup): Take a Target object instead of
8832 an elfcpp::Ehdr as parameter. Adjust call to set_target.
8833 (make_elf_sized_object): Find target and ask target to
8835 * object.h: (Object::set_target): Remove the version that looks up
8836 a target and sets it.
8837 (Sized_relobj::setup): Take a Target object instead of
8838 an elfcpp:Ehdr as parameter.
8839 * target.cc: Include dynobj.h.
8840 (Target::do_make_elf_object_implementation): New.
8841 (Target::do_make_elf_object): New.
8842 * target.h (Target::make_elf_object): New template declaration.
8843 (Target::do_make_elf_object): New method declarations.
8844 (Target::do_make_elf_object_implementation): New template declaration.
8846 2009-08-14 Ian Lance Taylor <iant@google.com>
8848 * gold.h (FUNCTION_NAME): Define.
8849 (gold_unreachable): Use FUNCTION_NAME.
8851 2009-08-12 Sriraman Tallam <tmsriram@google.com>
8853 * icf.cc (Icf::find_identical_sections): Issue a warning when a
8854 symbol in the --keep-unique list is not found.
8856 2009-08-12 Sriraman Tallam <tmsriram@google.com>
8858 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
8859 been maked as --keep-unique.
8860 (Icf::unfold_section): New function.
8861 * icf.h (Icf::unfold_section): New function.
8862 * options.h (General_options::keep_unique): New option.
8863 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
8864 * testsuite/Makefile.in: Regenerate.
8865 * testsuite/icf_keep_unique_test.sh: New file.
8866 * testsuite/icf_keep_unique_test.cc: New file.
8868 2009-08-12 Cary Coutant <ccoutant@google.com>
8871 * resolve.cc (Symbol_table::resolve): Check for references from
8872 dynamic objects to hidden and internal symbols.
8873 * testsuite/Makefile.am (hidden_test.sh): New test.
8874 * testsuite/Makefile.in: Regenerate.
8875 * testsuite/hidden_test.sh: New script.
8876 * testsuite/hidden_test_1.c: New test source.
8877 * testsuite/hidden_test_main.c: New test source.
8879 2009-08-11 Doug Kwan <dougkwan@google.com>
8881 * arm.cc: Update comments.
8882 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
8883 segment to locate the .ARM.exidx section if present.
8885 2009-08-09 Doug Kwan <dougkwan@google.com>
8887 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
8890 2009-08-07 Sriraman Tallam <tmsriram@google.com>
8891 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
8894 2009-08-06 Sriraman Tallam <tmsriram@google.com>
8896 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
8897 valid tls_segment only for non-debug-section relocations.
8898 * testsuite/Makefile.am: Add gc_tls_test.
8899 * testsuite/Makefile.in: Regenerate.
8900 * testsuite/gc_tls_test.cc: New file.
8901 * testsuite/gc_tls_test.sh: New file.
8903 2009-08-05 Sriraman Tallam <tmsriram@google.com>
8907 * Makefile.am (CCFILES): Add icf.cc.
8909 * Makefile.in: Regenerate.
8910 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
8911 * gc.h (gc_process_relocs): Populate lists used by icf to contain
8912 section, symbol and addend information for the relocs.
8913 * gold.cc (queue_middle_tasks): Call identical code folding.
8914 * gold.h: Add defines for multimap.
8915 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
8916 to the call of finalize_local_symbols.
8917 * main.cc (main): Create object of class Icf.
8918 * object.cc (Sized_relobj::do_layout): Allow this function to be
8919 called twice during icf.
8920 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
8921 to sections marked as identical by icf.
8922 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
8924 (Sized_relobj::do_section_entsize): New function.
8925 * object.h (Object::section_entsize): New function.
8926 (Object::do_section_entsize): New pure virtual function.
8927 (Relobj::finalize_local_symbols): Add new parameter.
8928 (Relobj::do_section_entsize): New function.
8929 * options.h (General_options::icf): New option.
8930 (General_options::icf_iterations): New option.
8931 (General_options::print_icf_sections): New option.
8932 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
8933 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
8934 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
8936 * symtab.cc (Symbol_table::is_section_folded): New function.
8937 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
8938 to sections marked as identical by icf.
8939 * symtab.h (Symbol_table::set_icf): New function.
8940 (Symbol_table::icf): New function.
8941 (Symbol_table::is_section_folded): New function.
8942 (Symbol_table::icf_): New data member.
8943 * target-reloc.h (relocate_section): Ignore sections folded by icf.
8944 * testsuite/Makefile.am: Add commands to build icf_test.
8945 * testsuite/Makefile.in: Regenerate.
8946 * testsuite/icf_test.sh: New file.
8947 * testsuite/icf_test.cc: New file.
8949 2009-07-24 Chris Demetriou <cgd@google.com>
8951 * layout.cc (is_compressible_debug_section): Fix incorrect
8952 comment about compressed section names.
8954 2009-07-20 Ian Lance Taylor <ian@airs.com>
8957 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
8959 2009-07-16 Ian Lance Taylor <iant@google.com>
8962 * layout.h: #include <map>.
8963 (class Kept_section): Change from struct to class. Add accessors
8964 and setters. Add section size to Comdat_group mapping. Change
8965 Comdat_group to std::map. Add is_comdat_ field. Add
8966 linkonce_size field in union.
8967 (class Layout): Update declaration of find_or_add_kept_section.
8968 Don't declare find_kept_object.
8969 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
8970 parameter. Add object, shndx, is_comdat, and is_group_name
8971 parameters. Change all callers. Adjust for new Kept_section.
8972 (Layout::find_kept_object): Remove.
8973 * object.cc (Sized_relobj::include_section_group): Update use of
8974 Kept_section. Rename secnum to shndx. Only record
8975 Kept_comdat_section if sections are the same size.
8976 (Sized_relobj::include_linkonce_section): Update use of
8977 Kept_section. Only record Kept_comdat_section if sections are the
8978 same size. Set size of linkonce section.
8979 (Sized_relobj::map_to_kept_section): Update call to
8980 get_kept_comdat_section.
8981 * object.h (class Sized_relobj): Rename fields in
8982 Kept_comdat_section to drop trailing underscores; change object
8983 field to Relobj*. Change Kept_comdat_section_table to store
8984 struct rather than pointer.
8985 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
8986 Add kept_object and kept_shndx parameters. Change all callers.
8987 (Sized_relobj::get_kept_comdat_section): Change return type to
8988 bool. Add kept_object and kept_shndx parameters. Change all
8990 * plugin.cc (Pluginobj::include_comdat_group): Update call to
8991 Layout::find_or_add_kept_section.
8993 2009-07-09 Ian Lance Taylor <iant@google.com>
8995 * merge.cc (Object_merge_map::initialize_input_to_output_map):
8996 Reserve space in the hash table.
8998 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
9000 * fileread.cc (File_read::get_mtime): New method.
9001 * fileread.h (Timespec): New structure.
9002 (File_read::get_mtime): New method.
9003 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
9004 Renamed from timestamp_nsec.
9005 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
9007 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
9009 (Incremental_inputs::report_archive): Save mtime; style fix.
9010 (Incremental_inputs::report_obejct): Save mtime; style fix.
9011 (Incremental_inputs::report_script): Save mtime; style fix.
9012 (Incremental_inputs::finalize_inputs): Style fix.
9013 (Incremental_inputs::finalize): Style fix.
9014 (Incremental_inputs::create_input_section_data): Store inputs
9016 * incremental.h (Incremental_inputs::report_script): Add mtime
9018 (Incremental_inputs::Input_info::Input_info): Intialize only one
9020 (Incremental_inputs::Input_info::archive): Move to nameless
9022 (Incremental_inputs::Input_info::obejct): Move to nameless union.
9023 (Incremental_inputs::Input_info::script): Move to nameless union.
9024 (Incremental_inputs::mtime): New field.
9025 * script.cc (read_input_script): Pass file mtime to
9027 * script.h (Script_info::inputs): Style fix.
9029 2009-07-01 Ian Lance Taylor <ian@airs.com>
9031 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
9034 2009-06-24 Ian Lance Taylor <iant@google.com>
9037 * layout.cc (Layout::choose_output_section): If we find an
9038 existing section, update the flags.
9039 (Layout::create_notes): New function, broken out of
9041 (Layout::finalize): Don't create note sections.
9042 (Layout::create_note): Don't crash if linker script discards
9044 (Layout::create_gold_note): Likewise.
9045 (Layout::create_build_id): Likewise. Don't set
9046 after_input_sections on the section.
9047 (Layout::create_executable_stack_info): Remove target parameter.
9049 * layout.h (class Layout): Declare create_notes. Update
9050 declaration of create_executable_stack_info.
9051 * gold.cc (queue_middle_tasks): Call create_notes.
9052 * output.cc (Output_section::update_flags_for_input_section): Move
9053 here from output.h. If SHF_ALLOC flag is newly set, mark address
9055 * output.h (Output_data::mark_address_invalid): New function.
9056 (class Output_section): Only declare, not define,
9057 update_flags_for_input_section. Remove set_flags.
9059 2009-06-24 Ian Lance Taylor <iant@google.com>
9061 * script-sections.cc (Output_section_definition::
9062 set_section_addresses): Rename shadowing local load_address to
9065 2009-06-24 Ian Lance Taylor <iant@google.com>
9068 * reloc.cc (relocate_sections): Skip empty relocation sections.
9070 2009-06-23 Ian Lance Taylor <iant@google.com>
9073 * layout.cc (Layout::create_note): Use choose_output_section
9074 rather than make_output_section.
9076 2009-06-23 Ian Lance Taylor <iant@google.com>
9079 * options.cc (General_options::parse_V): Set printed_version_.
9080 (General_options::General_options): Initialize printed_version_.
9081 * options.h (class General_options): Add printed_version_ field.
9082 * gold.cc (queue_initial_tasks): If there are no input files,
9083 don't give a fatal error if we printed the version information.
9084 (queue_middle_tasks): If using -r with a shared object, give a
9085 fatal error rather than an ordinary error.
9087 2009-06-23 Ian Lance Taylor <iant@google.com>
9090 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
9091 (Layout::make_output_section): Set have_stabstr_section_ if we see
9092 a .stab*str section.
9093 (Layout::finalize): Call link_stabs_sections.
9094 (Layout::link_stabs_sections): New file.
9095 * layout.h (class Layout): Add have_stabstr_section_ field.
9096 Declare link_stabs_sections.
9098 2009-06-23 Doug Kwan <dougkwan@google.com>
9100 * Makefile.am (libgold_a_LIBADD): New.
9101 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
9102 * Makefile.in: Regenerate.
9103 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
9104 * configure: Regenerate.
9105 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
9106 * fileread.cc: Include sys/state.h
9107 * gold.h: Declare memmem and strndup if found missing.
9108 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
9110 2009-06-23 Ian Lance Taylor <iant@google.com>
9112 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
9113 * configure: Rebuild.
9115 2009-06-23 Ian Lance Taylor <iant@google.com>
9118 * object.cc (Object::section_contents): Don't try to get a view if
9119 the section has length zero.
9120 (Object::handle_gnu_warning_section): If the section is empty, use
9121 the name of the section as the warning.
9123 2009-06-23 Ian Lance Taylor <iant@google.com>
9126 * stringpool.h (class Stringpool_template): Add optimize_ field.
9127 (Stringpool_template::set_optimize): New function.
9128 * stringpool.cc (Stringpool_template::Stringpool_template):
9129 Initialize optimize_ field.
9130 (Stringpool_template::set_string_offsets): Test local optimize
9131 fild rather than parameter.
9132 * layout.cc (Layout::Layout): Call set_optimize on the section
9135 2009-06-22 Ian Lance Taylor <iant@google.com>
9138 * yyscript.y: Parse TARGET.
9139 * script.cc (script_set_target): New function.
9140 * script-c.h (script_set_target): Declare.
9141 * options.cc (General_options::string_to_object_format): Rename
9142 from string_to_object_format in anonymous namespace. Change
9144 * options.h (class General_options): Declare
9145 string_to_object_format.
9147 2009-06-22 Ian Lance Taylor <iant@google.com>
9149 * script-sections.cc (Script_sections::create_segments): Don't put
9150 program headers in a PT_LOAD segment if -n or -N.
9152 2009-06-22 Ian Lance Taylor <iant@google.com>
9155 * options.h (class General_options): Add -z lazy and -z now. Sort
9156 -z options into alphabetical order.
9157 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
9159 2009-06-21 Ian Lance Taylor <iant@google.com>
9161 * layout.cc (Layout::make_output_section): Call
9162 Target::new_output_section.
9163 (Layout::attach_allocated_section_to_segment): Put large section
9164 sections in a separate load segment with the large segment flag
9166 (Layout::segment_precedes): Sort large data segments after other
9168 (align_file_offset): New static function.
9169 (Layout::set_segment_offsets): Use align_file_offset.
9170 * output.h (class Output_section): Add is_small_section_ and
9171 is_large_section_ fields.
9172 (Output_section::is_small_section): New function.
9173 (Output_section::set_is_small_section): New function.
9174 (Output_section::is_large_section): New function.
9175 (Output_section::set_is_large_section): New function.
9176 (Output_section::is_large_data_section): New function.
9177 (class Output_segment): Add is_large_data_segment_ field.
9178 (Output_segment::is_large_data_segment): New function.
9179 (Output_segment::set_is_large_data_segment): New function.
9180 * output.cc (Output_section::Output_section): Initialize new
9182 (Output_segment::Output_segment): Likewise.
9183 (Output_segment::add_output_section): Add assertion that large
9184 data sections always go in large data segments. Force small data
9185 sections to the end of the list of data sections. Force small BSS
9186 sections to the start of the list of BSS sections. For large BSS
9187 sections to the end of the list of BSS sections.
9188 * symtab.h (class Symbol): Declare is_common_shndx.
9189 (Symbol::is_defined): Check Symbol::is_common_shndx.
9190 (Symbol::is_common): Likewise.
9191 (class Symbol_table): Define enum Commons_section_type. Update
9192 declarations. Add small_commons_ and large_commons_ fields.
9193 * symtab.cc (Symbol::is_common_shndx): New function.
9194 (Symbol_table::Symbol_table): Initialize new fields.
9195 (Symbol_table::add_from_object): Put small and large common
9196 symbols in the right list.
9197 (Symbol_table::sized_finalized_symbol): Check
9198 Symbol::is_common_shndx.
9199 (Symbol_table::sized_write_globals): Likewise.
9200 * common.cc (Symbol_table::do_allocate_commons): Allocate new
9201 common symbol lists. Don't call do_allocate_commons_list if the
9203 (Symbol_table::do_allocate_commons_list): Remove is_tls
9204 parameter. Add comons_section_type parameter. Change all
9205 callers. Handle small and large common symbols.
9206 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
9207 Symbol::is_common_shndx.
9208 * resolve.cc (symbol_to_bits): Likewise.
9209 * target.h (Target::small_common_shndx): New function.
9210 (Target::small_common_section_flags): New function.
9211 (Target::large_common_shndx): New function.
9212 (Target::large_common_section_flags): New function.
9213 (Target::new_output_section): New function.
9214 (Target::Target_info): Add small_common_shndx, large_common_shndx,
9215 small_common_section_flags, and large_common_section_flags
9217 (Target::do_new_output_section): New virtual function.
9218 * arm.cc (Target_arm::arm_info): Initialize new fields.
9219 * i386.cc (Target_i386::i386_info): Likewise.
9220 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
9222 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
9223 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9224 (Target_x86_64::do_new_output_section): New function.
9225 * configure.ac: Define conditional MCMODEL_MEDIUM.
9226 * testsuite/Makefile.am (check_PROGRAMS): Add large.
9227 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
9228 (large_LDFLAGS): Define.
9229 * testsuite/large.c: New file.
9230 * testsuite/testfile.cc (Target_test::test_target_info):
9231 Initialize new fields.
9232 * configure, testsuite/Makefile.in: Rebuild.
9234 2009-06-05 Doug Kwan <dougkwan@google.com>
9236 * Makefile.am (CCFILES): Add target.cc.
9237 * Makefile.in: Regenerate.
9238 * i386.cc (class Target_i386): Define new virtual method to
9239 override do_is_local_label_name in parent.
9240 * object.cc (Sized_relobj::do_count_local_symbols): Discard
9241 local symbols if --discard-locals or -X is given.
9242 * options.h (class General_options): Declare new options
9243 '--discard-locals' and '-X' for discarding locals.
9244 * target.h (class Target): Define new methods is_local_label_name.
9245 Declare new virtual method do_is_local_label_name.
9246 * target.cc: New file.
9247 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
9248 (check_SCRIPTS): Add discard_locals_test.sh.
9249 (check_DATA): Add discard_local_tests.syms.
9250 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
9251 (discard_local_tests.syms, discard_locals_test.o): New make rules.
9252 * testsuite/Makefile.in: Regenerate.
9253 * testsuite/discard_locals_test.c: New file.
9254 * testsuite/discard_locals_test.sh: Same.
9256 2009-06-05 Doug Kwan <dougkwan@google.com>
9258 * object.cc (Sized_relobj::Sized_relobj): Initialize
9259 discarded_eh_frame_shndx_ to -1U.
9260 (Sized_relobj::do_layout): Record index of a discard .eh_frame
9262 (Sized_relobj::do_count_local_symbols): Skip local symbols in
9263 a discarded .eh_frame section.
9264 (Sized_relobj::do_finalize_local_symbols): Ditto.
9265 * object.h (class Sized_relobj): Declare new member
9266 discarded_eh_frame_shndx_.
9267 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
9268 (local_labels_test.o, local_labels_test): New rules.
9269 * testsuite/Makefile.in: Regenerate.
9271 2009-06-04 Doug Kwan <dougkwan@google.com>
9273 * layout.cc (Layout::section_name_mapping): Add mapping for
9274 special ARM sections.
9276 2009-06-03 Doug Kwan <dougkwan@google.com>
9278 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
9279 (utils::has_overflow): Same.
9281 2009-06-03 Ian Lance Taylor <iant@google.com>
9283 * layout.cc (Layout::section_name_mapping): New array, replacing
9284 Layout::linkonce_mapping.
9285 (Layout::section_name_mapping_count): New variable, replacing
9286 Layout::linkonce_mapping_count.
9287 (Layout::linkonce_output_name): Remove.
9288 (Layout::output_section_name): Rewrite.
9289 * layout.h (class Layout): Rename Linkonce_mapping to
9290 Section_name_mapping, linkonce_mapping to section_name_mapping,
9291 linkonce_mapping_count to section_name_mapping_count. Don't
9292 declare linkonce_output_name.
9294 2009-06-03 Doug Kwan <dougkwan@google.com>
9296 * gold/arm.cc (namespace utils): New.
9297 (Target_arm::reloc_is_non_pic): Define new method.
9298 (class Arm_relocate_functions): New.
9299 (Target_arm::Relocate::relocate): Handle relocation types used by
9302 2009-06-03 Ian Lance Taylor <iant@google.com>
9304 * arm.cc (Target_arm::scan::global): Use || instead of |.
9306 2009-06-02 Doug Kwan <dougkwan@google.com>
9308 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
9309 issued_non_pic_error_.
9310 (class Target_arm::Scan): Declare new method check_non_pic.
9311 Define new method symbol_needs_plt_entry.
9312 Declare new data member issued_non_pic_error_.
9313 (class Target_arm::Relocate): Declare new method
9314 should_apply_static_reloc.
9315 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9316 (Target_arm::Scan::check_non_pic): Define new method.
9317 (Target_arm::Scan::local): Handle a small subset of reloc types used
9319 (Target_arm::Scan::local): Same.
9320 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9322 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
9324 * incremental.cc (Incremental_inputs::report_command_line): Filter
9325 out --incremental-* options.
9327 2009-05-29 Doug Kwan <dougkwan@google.com>
9329 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9331 (class Target_arm): Update comment.
9332 (Target_arm::Target_arm): Initialize new data members GOT_,
9333 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
9334 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
9335 and Target_arm::rel_dyn_section.
9336 Declare new_enum Target_arm::Got_type.
9337 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
9339 Update commments for member do_dynsym_value.
9340 (Target_arm::got_size, Target_arm::plt_section,
9341 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
9342 new methods inside class defintion.
9343 (Target_arm::got_section): Define new method.
9344 (Target_arm::rel_dyn_section): Same.
9345 (Output_data_plt_arm): New template class.
9346 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
9347 (Output_data_plt_arm:do_adjust_output_section): Define new method.
9348 (Output_data_plt_arm::add_entry): Same.
9349 (Output_data_plt_arm::first_plt_entry): Define new
9350 static data member for PLT instruction template.
9351 (Output_data_plt_arm::plt_entry): Same.
9352 (Output_data_plt_arm::do_write): Define new method.
9353 (Target_arm::make_plt_entry): Same.
9354 (Target_arm::do_finalize_sections): Same.
9355 (Target_arm::do_dynsym_value): Same.
9357 2009-05-28 Doug Kwan <dougkwan@google.com>
9359 * Makefile.am (TARGETSOURCES): Add arm.cc.
9360 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
9361 * Makefile.in: Regenerate.
9363 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
9365 2009-05-26 Doug Kwan <dougkwan@google.com>
9367 * options.cc (General_options::parse_exclude_libs). Fix a comment.
9368 (General_options::check_excluded_libs): Strip off directories in
9369 archive name before matching like GNU ld does.
9370 * testsuite/Makefile.am (MOSTLYCLEANFILES,
9371 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
9372 (exclude_libs_test_LDFLAGS): Add linker option
9373 -Wl,--exclude-libs,libexclude_libs_test_3
9374 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
9375 an explicit archive without using -l.
9376 (alt/libexclude_libs_test_3.a): New make rule.
9377 * testsuite/Makefile.in: Regenerate.
9378 * testsuite/exclude_libs_test.c : Declare lib3_default().
9380 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
9381 * exclude_libs_test_3.c: New file.
9383 2009-05-26 Nick Clifton <nickc@redhat.com>
9385 * po/id.po: New Indonesian translation.
9386 * po/gold.pot: Updated template file.
9388 2009-05-22 Sriraman Tallam <tmsriram@google.com>
9390 * testsuite/Makefile.am: Add -ffunction-sections to compile
9391 gc_comdat_test files. Add -Wl,--gc-sections to build
9393 * testsuite/Makefile.in: Regenerate.
9394 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
9396 2009-05-21 Sriraman Tallam <tmsriram@google.com>
9398 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
9399 kept comdat section was garbage collected.
9400 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
9401 * testsuite/Makefile.in: Regenerate.
9402 * testsuite/gc_comdat_test.sh: New file.
9403 * testsuite/gc_comdat_test_1.cc: New file.
9404 * testsuite/gc_comdat_test_2.cc: New file.
9406 2009-05-19 Doug Kwan <dougkwan@google.com>
9408 * archive.cc (Archive::Archive): Move constructor from archive.h
9409 to here. Initialize no_export_.
9410 (Archive::get_elf_object_for_member): Set no_export flag of object.
9411 * archive.h (Archive::Archive): Move constructor body to
9413 (Archive::no_export): New method.
9414 (Archive::no_export_): New field.
9415 * object.h (Object::Object): Initialize no_export_ to false.
9416 (Object::no_export, Object::set_no_export): New methods.
9417 (Object::no_export_): New field.
9418 * options.cc (General_options::parse_exclude_libs): New method.
9419 (General_options::check_excluded_libs) Same.
9420 * options.h (exclude_libs): New option.
9421 (General_options::check_excluded_libs): New method declaration.
9422 (General_options::excluded_libs_): New field.
9423 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
9424 default or protected visibility if an object has no-export flag set.
9425 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
9426 (check_SCRIPTS): Add exclude_libs_test.sh.
9427 (check_DATA): Add exclude_libs_test.syms.
9428 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
9429 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
9430 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
9431 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
9432 (exclude_libs_test.syms, libexclude_libs_test_1.a,
9433 libexclude_libs_test_2.a): New rules.
9434 * testsuite/Makefile.in: Regenerate.
9435 * testsuite/exclude_libs_test.c: New file.
9436 * testsuite/exclude_libs_test.sh: Ditto.
9437 * testsuite/exclude_libs_test_1.c: Ditto.
9438 * testsuite/exclude_libs_test_2.c: Ditto.
9440 2009-05-15 Ian Lance Taylor <iant@google.com>
9442 * configure.ac: Check for declarations for cases where libiberty.h
9443 checks HAVE_DECL_xxx.
9444 * configure, config.in: Rebuild.
9446 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
9448 * gold.h (Incremental_argument_list): Remove (invalid) forward
9450 * incremental.cc (Incremental_inputs::report_achive): New method.
9451 (Incremental_inputs::report_object): New method.
9452 (Incremental_inputs::report_script): New method.
9453 (Incremental_inputs::finalize_inputs): New method.
9454 (Incremental_inputs::finalize): Call finalize_inputs().
9455 (Incremental_inputs::sized_create_incremental_inputs_section_data):
9456 Create inputs entries.
9457 * incremental.h (Incremental_input_type): New enum.
9458 (Incremental_inputs::Incremental_input): Initialize new fields.
9459 (Incremental_inputs::report_inputs): New method.
9460 (Incremental_inputs::report_achive): New method.
9461 (Incremental_inputs::report_object): New method.
9462 (Incremental_inputs::report_script): New method.
9463 (Incremental_inputs::finalize_inputs): New method.
9464 (Incremental_inputs::Input_info): New struct.
9465 (Incremental_inputs::Input_info_map): New typedef.
9466 (Incremental_inputs::lock_): New field.
9467 (Incremental_inputs::Inputs_): New field.
9468 (Incremental_inputs::Inputs_map): New field.
9469 * main.cc (main): Call Incremental_input::report_inputs.
9470 * options.h (Input_argument_list): Typedef moved from
9472 (Input_file_group::Files): Remove, use ::Input_argument_list.
9473 (Input_file_group::Input_argument_list): Remove, use
9474 ::Input_argument_list.
9475 * plugin.cc (Plugin_manager::add_input_file): Add error in
9477 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
9479 * script.cc (read_input_script): Call
9480 Incremental_input::report_script.
9481 * script.h (Script_info): New class.
9483 2009-04-27 Ian Lance Taylor <iant@google.com>
9485 * x86_64.cc (do_adjust_output_section): Set entsize to
9488 2009-04-23 Elliott Hughes <enh@google.com>
9490 * output.cc (Output_file::close): After short writes, continue
9491 writing from the correct offset in the buffer being written.
9493 2009-04-23 Chris Demetriou <cgd@google.com>
9495 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
9496 * configure: Regenerate.
9497 * config.in: Regenerate.
9498 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
9499 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
9501 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
9503 * incremental.cc (Incremental_inputs_header_data): Renamed from
9504 Incremental_input_header_data.
9505 (Incremental_inputs_header_data::data_size): New field.
9506 (Incremental_inputs_header_data::put_input_file_count): Renamed
9507 from input_file_count.
9508 (Incremental_inputs_header_data::put_command_line_offset): Renamed
9509 from command_line_offset.
9510 (Incremental_inputs_header_data::put_reserved): Renamed from
9512 (Incremental_inputs_entry_data): Renamed from
9513 Incremental_input_entry_data.
9514 (Incremental_inputs_entry_data::data_size): New field.
9515 (Incremental_inputs::report_command_line): New method.
9516 (Incremental_inputs::finalize): New method.
9517 (Incremental_inputs::create_incremental_inputs_data): New method.
9518 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
9519 * incremental.h: New file.
9520 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
9521 (Layout::finalize): Create incremental inputs section in
9523 (Layout::create_incremental_info_sections): New method.
9524 * layout.h (Layout::incremental_inputs): New method.
9525 (Layout::create_incremental_info_sections): New method.
9526 (Layout::incremental_inputs_): New field.
9527 * main.cc (main): Notify Incremental_input of the command line.
9529 2009-04-01 Ian Lance Taylor <iant@google.com>
9530 Mikolaj Zalewski <mikolajz@google.com>
9532 * gold.h (reserve_unordered_map): Define, three versions, one for
9533 each version of Unordered_map.
9534 * layout.cc (Layout::Layout): Remove options parameter. Add
9535 number_of_input_files parameter. Don't initialize options_.
9536 Initialize number_of_input_files_ and resized_signatures_. Move
9537 sections_are_attached_.
9538 (Layout::layout_group): Reserve space for group_signatures_.
9539 (Layout::find_or_add_kept_section): Change name parameter to be a
9540 reference. Resize signatures_ map when it gets large enough.
9541 (Layout::layout_eh_frame): Use parameters->options() instead of
9543 (Layout::make_output_section): Likewise.
9544 (Layout::attach_allocated_section_to_segment): Likewise.
9545 (Layout::finalize, Layout::create_executable_stack): Likewise.
9546 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
9547 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
9548 * layout.h (class Layout): Update declarations. Remove options_
9549 field. Add number_of_input_files_ and resized_signatures_
9550 fields. Move sections_are_attached_ field.
9551 * main.cc (main): Pass number of input files to Layout
9552 constructor. Don't pass options.
9554 2009-03-30 Ian Lance Taylor <iant@google.com>
9556 * ffsll.c (ffsll): Correct implementation.
9558 2009-03-27 Ian Lance Taylor <iant@google.com>
9560 * ffsll.c: New file.
9561 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
9562 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
9563 * ftruncate.c (ftruncate): Declare before definition.
9564 * mremap.c (mremap): Likewise.
9565 * pread.c (pread): Likewise.
9566 * configure, Makefile.in, config.in: Rebuild.
9568 * mremap.c: New file.
9569 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
9570 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
9571 (mremap): Declare if HAVE_MREMAP is not defined.
9572 * configure, Makefile.in, config.in: Rebuild.
9574 2009-03-27 Cary Coutant <ccoutant@google.com>
9576 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
9577 position independent.
9578 * sparc.cc (Target_sparc::check_non_pic): Likewise.
9579 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
9581 2009-03-24 Cary Coutant <ccoutant@google.com>
9583 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
9585 (needs_dynamic_reloc): Likewise.
9587 2009-03-24 Ian Lance Taylor <iant@google.com>
9589 * yyscript.y (file_cmd): Recognize EXTERN.
9590 (extern_name_list, extern_name_list_body): New nonterminals.
9591 * script.cc (script_add_extern): Define.
9592 * script-c.h (script_add_extern): Declare.
9594 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
9596 * object.cc (is_elf_object): Define.
9597 * object.h (is_elf_object): Declare.
9598 * archive.cc (Archive::get_elf_object_for_member): Call
9600 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
9602 2009-03-24 Elliott Hughes <enh@google.com>
9604 * output.cc (Output_file::map_anonymous): Define.
9605 (Output_file::map): Use map_anonymous. If the regular mmap fails,
9606 try an anonymous one. Report the size if the mmap fails.
9607 * output.h (class Output_file): Declare map_anonymous.
9609 2009-03-24 Ian Lance Taylor <iant@google.com>
9611 * target-select.cc (instantiate_target): Don't acquire the lock if
9612 the instantiated_target_ field has already been set.
9614 2009-03-23 Ian Lance Taylor <iant@google.com>
9616 * gold-threads.h (class Initialize_lock): Define.
9617 * gold-threads.cc (class Initialize_lock_once): Define.
9618 (initialize_lock_control): New static variable.
9619 (initialize_lock_pointer): New static variable.
9620 (initialize_lock_once): New static function.
9621 (Initialize_lock::Initialize_lock): Define.
9622 (Initialize_lock::initialize): Define.
9623 * target-select.h: Include "gold-threads.h".
9624 (class Target_selector): Add lock_ and initialize_lock_ fields.
9625 Don't define instantiate_target, just declare it.
9626 * target-select.cc (Target_selector::Target_selector): Initialize
9628 (Target_selector::instantiate_target): Define.
9629 * descriptors.h: Include "gold-threads.h".
9630 (class Descriptors): Add initialize_lock_ field.
9631 * descriptors.cc (Descriptors::Descriptors): Initialize new
9633 (Descriptors::open): Use initialize_lock_ field
9634 * errors.h (class Errors): Add initialize_lock_ field.
9635 * errors.cc (Errors::Errors): Initialize new field.
9636 (Errors::initialize_lock): Use initialize_lock_ field.
9637 * powerpc.cc (class Target_selector_powerpc): Remove
9638 instantiated_target_ field. In do_recognize call
9639 instantiate_target rather than do_instantiate_target. In
9640 do_instantiate_target just allocate a new target.
9641 * sparc.cc (class Target_selector_sparc): Likewise.
9643 * freebsd.h: New file.
9644 * i386.cc: Include "freebsd.h".
9645 (Target_i386): Derive from Target_freebsd rather than
9647 (Target_selector_i386): Derive from Target_selector_freebsd rather
9648 than Target_selector.
9649 * x86_64.cc: Include "freebsd.h".
9650 (Target_x86_64): Derive from Target_freebsd rather than
9652 (Target_selector_x86_64): Derive from Target_selector_freebsd
9653 rather than Target_selector.
9654 * target.h (class Target): Add adjust_elf_header and
9655 do_adjust_elf_header.
9656 * output.cc (Output_file_header:: do_sized_write): Call target
9657 adjust_elf_header routine.
9658 * configure.tgt: Set targ_osabi.
9659 * configure.ac: Define GOLD_DEFAULT_OSABI.
9660 * parameters.cc (Parameters::default_target): Pass
9661 GOLD_DEFAULT_OSABI to select_target.
9662 * target-select.h (class Target_selector): Make instantiate_target
9663 protected rather than private.
9664 * Makefile.am (HFILES): Add freebsd.h.
9665 * configure, Makefile.in, config.in: Rebuild.
9667 * merge.cc (do_add_input_section): Correct pend value. Change
9668 message about last entry not being null terminated from error to
9671 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
9673 * incremental.cc: New file.
9674 * Makefile.am (CCFILES): Add incremental.cc.
9675 * Makefile.in: Rebuild.
9677 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
9679 * layout.cc (Layout::output_section_name): Preserve names
9680 of '.note.' sections.
9682 2009-03-19 Ian Lance Taylor <iant@google.com>
9684 * descriptors.cc (Descriptors::open): Check that the options are
9685 valid before using them.
9687 2009-03-18 Ian Lance Taylor <iant@google.com>
9689 * script-sections.h: Include <list>.
9690 (class Script_sections): Change Sections_elements from std::vector
9691 to std::list. Typedef public Elements_iterator. Add
9692 orphan_section_placement_, data_segment_align_start_, and
9693 saw_data_segment_align_ fields. Remove data_segment_align_index_
9695 * script-sections.cc (class Orphan_section_placement): New class.
9696 (class Sections_element): Add virtual functions is_relro and
9697 orphan_section_init. Remove virtual function place_orphan_here.
9698 (class Output_section_definition): Add is_relro and
9699 orphan_section_init. Remove place_orphan_here.
9700 (class Orphan_output_section): Likewise.
9701 (Script_sections::Script_sections): Update for field changes.
9702 (Script_sections::data_segment_align): Set saw_data_segment_align_
9703 and data_segment_align_start_, not data_segment_align_index.
9704 (Script_sections::data_segment_relro_end): Check
9705 saw_data_segment_align_. Use data_segment_align_start_ rather
9706 than data_segment_align_index_.
9707 (Script_sections::place_orphan): Rewrite to use
9708 Orphan_section_placement.
9710 2009-03-17 Ian Lance Taylor <iant@google.com>
9712 * archive.cc (Archive::add_symbols): Check for a version attached
9713 to the symbol name in the archive map.
9714 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
9715 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
9716 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
9717 (ver_test_11.a): New target.
9718 * testsuite/Makefile.in: Rebuild.
9720 * configure.ac: Check for chsize and posix_fallocate. Replace
9722 * ftruncate.c: New file, from gnulib.
9723 * output.cc (posix_fallocate): Define dummy version if not
9724 HAVE_POSIX_FALLOCATE.
9725 (Output_file::map): Call posix_fallocate rather than lseek and
9727 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
9728 * configure, Makefile.in, config.in: Rebuild.
9730 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
9732 * layout.h (Layout::create_note): Add section_name parameter.
9733 * layout.cc (Layout::create_note): Likewise.
9734 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
9736 2009-03-17 Ian Lance Taylor <iant@google.com>
9738 * descriptors.cc: Include "options.h".
9739 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
9740 (Descriptors::open): Always use O_CLOEXEC when opening a new
9741 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
9742 then set FD_CLOEXEC.
9744 * sparc.cc (class Target_sparc): Add has_got_section.
9745 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
9746 make sure we have a GOT section.
9748 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
9749 (Target_sparc::Scan::local): Likewise.
9750 (Target_sparc::Scan::global): Likewise.
9751 (Target_sparc::Relocate::relocate): Likewise.
9752 (Target_sparc::Relocate::relocate_tls): Likewise.
9754 * symtab.cc (Symbol_table::define_default_version): New function,
9755 broken out of add_from_object.
9756 (Symbol_table::add_from_object): Call define_default_version.
9757 (Symbol_table::define_special_symbol): Add resolve_oldsym
9758 parameter. Change all callers. If the version for a symbol comes
9759 from a version script, resolve it with the symbol with the same
9760 name with no version. Also add the symbol without a version if
9762 (do_define_in_output_data): If resolving with oldsym, don't delete
9764 (do_define_in_output_segment): Likewise.
9765 (do_define_as_constant): Likewise.
9766 * symtab.h (class Symbol_table): Update declarations.
9768 2009-03-13 Ian Lance Taylor <iant@google.com>
9770 * readsyms.cc (Read_symbols::incompatible_warning): New function.
9771 (Read_symbols::requeue): New function.
9772 (Read_symbols::do_read_symbols): If make_elf_object fails because
9773 the target type is not configured, and the file was searched for,
9774 issue a warning and retry with the next directory.
9775 (Add_symbols::run): If the file has an incompatible format, and
9776 it was searched for, requeue the Read_symbols task. On error,
9778 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
9779 dirindex parameter to constructor. Change all callers. Declare
9780 incompatible_warning and requeue.
9781 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
9782 input_argument_ and input_group_ fields. Add them to
9783 constructor. Change all callers.
9784 (class Read_script): Add dirindex_ field. Add it to constructor.
9786 * archive.cc (Archive::setup): Remove input_objects parameter.
9788 (Archive::get_file_and_offset): Likewise.
9789 (Archive::read_all_symbols): Likewise.
9790 (Archive::read_symbols): Likewise.
9791 (Archive::get_elf_object_for_member): Remove input_objects
9792 parameter. Add punconfigured parameter. Change all callers.
9793 (Archive::add_symbols): Change return type to bool. Check return
9794 value of include_member.
9795 (Archive::include_all_members): Likewise.
9796 (Archive::include_member): Change return type to bool. Return
9797 false if first included object has incompatible target. Set
9798 included_member_ field.
9799 (Add_archive_symbols::run): If add_symbols returns false, requeue
9801 * archive.h (class Archive): Add included_member_ field.
9802 Initialize it in constructor. Add input_file and searched_for
9803 methods. Update declarations.
9804 (class Add_archive_symbols): Add dirpath_, dirindex_, and
9805 input_argument_ fields. Add them to constructor. Change all
9807 * script.cc: Include "target-select.h".
9808 (class Parser_closure): Add skip_on_incompatible_target_ and
9809 found_incompatible_target_ fields. Add
9810 skip_on_incompatible_target parameter to constructor. Change all
9811 callers. Add methods skip_on_incompatible_target,
9812 clear_skip_on_incompatible_target, found_incompatible_target, and
9813 set_found_incompatible_target.
9814 (read_input_script): Add dirindex parameter. Change all callers.
9815 If parser finds an incompatible target, requeue Read_symbols
9817 (script_set_symbol): Clear skip_on_incompatible_target in
9819 (script_add_assertion, script_parse_option): Likewise.
9820 (script_start_sections, script_add_phdr): Likewise.
9821 (script_check_output_format): New function.
9822 * script.h (read_input_script): Update declaration.
9823 * script-c.h (script_check_output_format): Declare.
9824 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
9825 (ignore_cmd): Remove OUTPUT_FORMAT.
9826 * fileread.cc (Input_file::Input_file): Add explicit this.
9827 (Input_file::will_search_for): New function.
9828 (Input_file::open): Add pindex parameter. Change all callers.
9829 * fileread.h (class Input_file): Add input_file_argument method.
9830 Declare will_search_for. Update declarations.
9831 * object.cc (make_elf_object): Add punconfigured parameter.
9833 * object.h (class Object): Make input_file public. Add
9834 searched_for method.
9835 (make_elf_object): Update declaration.
9836 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
9838 * dirsearch.h (class Dirsearch): Update declaration.
9839 * options.h (class General_options): Add --warn-search-mismatch.
9840 * parameters.cc (Parameters::is_compatible_target): New function.
9841 * parameters.h (class Parameters): Declare is_compatible_target.
9842 * workqueue.cc (Workqueue::add_blocker): New function.
9843 * workqueue.h (class Workqueue): Declare add_blocker.
9845 * fileread.cc (Input_file::open): Remove options parameter.
9847 (Input_file::open_binary): Likewise.
9848 * script.cc (read_input_script): Likewise.
9849 * readsyms.h (class Read_symbols): Remove options_ field. Remove
9850 options parameter from constructor. Change all callers.
9851 (class Read_script): Likewise.
9852 * fileread.h (class Input_file): Update declarations.
9853 * script.h (read_input_script): Update declaration.
9855 2009-03-10 Nick Clifton <nickc@redhat.com>
9857 * po/es.po: New Spanish translation.
9859 2009-03-06 Cary Coutant <ccoutant@google.com>
9861 * options.cc (parse_short_option): Keep dash_z from registering itself.
9863 2009-03-03 Ian Lance Taylor <iant@google.com>
9866 * target-reloc.h (relocate_section): Pass output_section to
9868 * i386.cc (Target_i386::should_apply_static_reloc): Add
9869 output_section parameter. Change all callers.
9870 (Target_i386::Relocate::relocate): Add output_section parameter.
9871 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9872 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
9873 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
9874 * testsuite/two_file_shared.sh: New script.
9875 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
9876 (check_DATA): Add two_file_shared.dbg.
9877 (two_file_shared.dbg): New target.
9878 * testsuite/Makefile.in: Rebuild.
9880 2009-03-01 Ian Lance Taylor <iant@google.com>
9882 * configure.ac: Check for byteswap.h.
9883 * configure: Rebuild.
9884 * config.in: Rebuild.
9886 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
9888 * layout.cc (Layout::find_or_add_kept_section): New function.
9889 (Layout::add_comdat): Removed.
9890 * layout.h (struct Kept_section): Move out of class Layout.
9891 Remove trailing underscores from field names. Add group_sections
9892 field. Rename group_ field to is_group. Change all uses.
9893 (class Layout): Declare find_or_add_kept_section, not add_comdat.
9894 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
9895 comdat_groups_ field.
9896 (Sized_relobj::include_section_group): Use
9897 find_or_add_kept_section and Kept_section::group_sections.
9898 (Sized_relobj::include_linkonce_section): Likewise.
9899 * object.cc (class Sized_relobj): Don't define Comdat_group or
9900 Comdat_group_table. Remove find_comdat_group and
9901 add_comdat_group. Remove comdat_groups_ field.
9902 * plugin.cc (include_comdat_group): Use
9903 Layout::find_or_add_kept_section.
9905 2009-02-28 Ian Lance Taylor <iant@google.com>
9907 * README: --gc-sections and map files are now supported. Document
9908 some build requirements.
9911 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
9912 relocatable link set the value of the section symbol to zero.
9913 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
9914 relocatable link don't include the section address in the local
9917 2009-02-27 Ian Lance Taylor <iant@google.com>
9920 * options.h (class Search_directory): Add is_system_directory.
9921 (class General_options): Declare is_in_system_directory.
9922 * options.cc (get_relative_sysroot): Make static.
9923 (get_default_sysroot): Make static.
9924 (General_optoins::is_in_system_directory): New function.
9925 * fileread.cc (Input_file::is_in_system_directory): New function.
9926 * fileread.h (class Input_file): Declare is_in_system_directory.
9927 * object.h (class Object): Add is_in_system_directory.
9928 (class Input_objects): Remove system_library_directory_ field.
9929 * object.cc (Input_objects::add_object): Don't set
9930 system_library_directory_.
9931 (input_objects::found_in_system_library_directory): Remove.
9932 * symtab.cc (Symbol_table::write_globals): Remove input_objects
9933 parameter. Change all callers.
9934 (Symbol_table::sized_write_globals): Likewise.
9935 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
9936 Call Object::is_in_system_directory.
9937 * symtab.h (class Symbol_table): Update declarations.
9940 * descriptors.h (Open_descriptor): Add is_on_stack field.
9941 * descriptors.cc (Descriptors::open): If the descriptor is on the
9942 top of the stack, remove it. Initialize is_on_stack field.
9943 (Descriptors::release): Only add pod to stack if it is not on the
9945 (Descriptors::close_some_descriptor): Clear stack_next and
9949 * output.cc (Output_section::find_starting_output_address): Rename
9950 from starting_output_address; add PADDR parameter; change return
9952 * output.h (class Output_section): Declare
9953 find_starting_output_address instead of starting_output_address.
9954 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
9955 section symbol for which we can't find a merge section.
9958 * symtab.cc (Symbol_table::add_from_object): If the visibility is
9959 hidden or internal, force the symbol to be local.
9960 * resolve.cc (Symbol::override_visibility): Define.
9961 (Symbol::override_base): Use override_visibility.
9962 (Symbol_table::resolve): Likewise.
9963 (Symbol::override_base_with_special): Likewise.
9964 (Symbol_table::override_with_special): If the visibility is hidden
9965 or internal, force the symbol to be local.
9966 * symtab.h (class Symbol): Add set_visibility and
9967 override_visibility.
9968 * testsuite/ver_test_1.sh: New file.
9969 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
9970 (check_DATA): Add ver_test_1.syms.
9971 (ver_test_1.syms): New target.
9972 * testsuite/Makefile.in: Rebuild.
9974 2009-02-25 Cary Coutant <ccoutant@google.com>
9976 * layout.cc (Layout::choose_output_section): Don't rename sections
9977 when using a linker script that has a SECTIONS clause.
9978 * Makefile.in: Regenerate.
9980 * testsuite/Makefile.am (script_test_5.sh): New test case.
9981 * testsuite/Makefile.in: Regenerate.
9982 * testsuite/script_test_5.cc: New file.
9983 * testsuite/script_test_5.sh: New file.
9984 * testsuite/script_test_5.t: New file.
9986 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
9988 * archive.cc (Archive::include_member): Update calls to add_symbols.
9989 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
9990 the Layout argument.
9991 * dynobj.h (do_add_symbols): Add the Layout argument.
9992 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
9994 * object.h (Object::add_symbols): Add the Layout argument.
9995 (Object::do_add_symbols): Add the Layout argument.
9996 (Sized_relobj::do_add_symbols): Add the Layout argument.
9997 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
9998 Unify the two versions.
9999 (Add_plugin_symbols): Remove.
10000 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
10001 (Sized_pluginobj::do_add_symbols): Unify the two versions.
10002 (Add_plugin_symbols): Remove.
10003 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
10004 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
10005 (Add_symbols::run): Make it work with Pulginobj.
10007 2009-02-06 Ian Lance Taylor <iant@google.com>
10009 * object.cc (Sized_relobj::do_layout): Make info message start
10010 with lower case letter.
10012 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
10014 * binary.cc: Fix file comment.
10016 * options.h (enum Incremental_disposition): Define.
10017 (class General_options): Add new options: --incremental,
10018 --incremental_changed, --incremental_unchanged,
10019 --incremental_unknown. Add incremental_disposition_ and
10020 implicit_incremental_ fields.
10021 (General_options::incremental_disposition): New function.
10022 (class Position_dependent_options): Add incremental_disposition
10024 (Position_dependent_options::copy_from_options): Set incremental
10026 * options.cc (General_options::parse_incremental_changed): New
10028 (General_options::parse_incremental_unchanged): New function.
10029 (General_options::parse_incremental_unknown): New function.
10030 (General_options::General_options): Initialize new fields
10031 incremental_disposition_ and implicit_incremental_.
10032 (General_options::finalize): Check for uasge of --incremental-*
10033 without --incremental.
10035 2009-02-06 Chris Demetriou <cgd@google.com>
10037 * gold.h (gold_undefined_symbol): Change to take only a Symbol
10038 pointer and to report location as the file name associated with
10040 (gold_undefined_symbol_at_location): New function to replace the
10041 old gold_undefined_symbol functionality.
10042 * target-reloc.h (relocate_section): Update to use
10043 gold_undefined_symbol_at_location.
10044 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10045 Call gold_undefined_symbol function rather than gold_error.
10046 * errors.h (Errors::undefined_symbol): Take location as a
10047 string, rather than calculating it from a relocation.
10048 * errors.cc (Errors::fatal): Print "fatal error:" before the
10050 (Errors::error, Errors::error_at_location): Print "error: "
10051 before the formatted message.
10052 (Errors::undefined_symbol): Take location as a string, rather
10053 than calculating it from a relocation.
10054 (gold_undefined_symbol_at_location): New function akin to
10055 old gold_undefined_symbol, calculates location from relocation.
10056 (gold_undefined_symbol): Change to take only a Symbol pointer
10057 and to report location as the file name associated with the symbol.
10058 * testsuite/debug_msg.sh: Update for changed error messages.
10059 * testsuite/undef_symbol.sh: Likewise.
10061 2009-02-04 Duncan Sands <baldrick@free.fr>
10064 * reduced_debug_output.h
10065 (Output_reduced_debug_abbrev_section::failed): Use format for
10067 (Output_reduced_debug_info_section::faild): Likewise.
10069 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
10071 * script.cc (Lazy_demangler): New class.
10072 (Version_script_info::get_symbol_version_helper): Demangle a
10075 2009-01-29 Cary Coutant <ccoutant@google.com>
10077 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
10079 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10081 2009-01-28 Ian Lance Taylor <iant@google.com>
10083 * version.cc (version_string): Bump to 1.9.
10085 * gold.h: Include <cstring> and <stdint.h>.
10086 * version.cc: Include <cstdio>.
10087 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
10089 * reduced_debug_output.cc (insert_into_vector): Rename from
10090 Insert_into_vector; change all callers. Use Swap_unaligned to
10091 avoid aliasing issue; remove union since it is unnecessary.
10093 2009-01-27 Sriraman Tallam <tmsriram@google.com>
10095 * Makefile.am (CCFILES): Add gc.cc.
10096 (HFILES): Add gc.h.
10097 * Makefile.in: Regenerate.
10098 * gold.cc (Gc_runner): New class.
10099 (queue_initial_tasks): Call garbage collection related tasks
10100 when corresponding options are invoked.
10101 (queue_middle_gc_tasks): New function.
10102 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
10103 processed early before laying out sections during garbage collection.
10104 * gold.h (queue_middle_gc_tasks): New function.
10105 (is_prefix_of): Move from "layout.cc".
10106 * i386.cc (Target_i386::gc_process_relocs): New function.
10107 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
10108 * main.cc (main): Create object of class "Garbage_collection".
10109 * object.cc (Relobj::copy_symbols_data): New function.
10110 (Relobj::is_section_name_included): New function.
10111 (Sized_relobj::do_layout): Allow this function to be called twice
10112 during garbage collection and defer layout of section during the
10114 * object.h (Relobj::get_symbols_data): New function.
10115 (Relobj::is_section_name_included): New function.
10116 (Relobj::copy_symbols_data): New function.
10117 (Relobj::set_symbols_data): New function.
10118 (Relobj::get_relocs_data): New function.
10119 (Relobj::set_relocs_data): New function.
10120 (Relobj::is_output_section_offset_invalid): New pure virtual function.
10121 (Relobj::gc_process_relocs): New function.
10122 (Relobj::do_gc_process_relocs): New pure virtual function.
10123 (Relobj::sd_): New data member.
10124 (Sized_relobj::is_output_section_offset_invalid): New function.
10125 (Sized_relobj::do_gc_process_relocs): New function.
10126 * options.h (General_options::gc_sections): Modify to not be a no-op.
10127 (General_options::print_gc_sections): New option.
10128 * plugin.cc (Plugin_finish::run): Remove function call to
10129 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
10130 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
10131 * reloc.cc (Read_relocs::run): Add task to process relocs and
10132 determine unreferenced sections when doing garbage collection.
10133 (Gc_process_relocs): New class.
10134 (Sized_relobj::do_gc_process_relocs): New function.
10135 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
10136 sections that are garbage collected.
10137 * reloc.h (Gc_process_relocs): New class.
10138 * sparc.cc (Target_sparc::gc_process_relocs): New function.
10139 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
10140 symbols whose corresponding sections are garbage collected.
10141 (Symbol_table::Symbol_table): Add new parameter for the garbage
10143 (Symbol_table::gc_mark_undef_symbols): New function.
10144 (Symbol_table::gc_mark_symbol_for_shlib): New function.
10145 (Symbol_table::gc_mark_dyn_syms): New function.
10146 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
10148 (Symbol_table::add_from_object): Likewise.
10149 (Symbol_table::add_from_relobj): When building shared objects, do not
10150 treat externally visible symbols as garbage.
10151 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
10152 table information for static and relocatable links.
10153 * symtab.h (Symbol_table::set_gc): New function.
10154 (Symbol_table::gc): New function.
10155 (Symbol_table::gc_mark_undef_symbols): New function.
10156 (Symbol_table::gc_mark_symbol_for_shlib): New function.
10157 (Symbol_table::gc_mark_dyn_syms): New function.
10158 (Symbol_table::gc_): New data member.
10159 * target.h (Sized_target::gc_process_relocs): New pure virtual
10161 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
10162 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
10164 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
10166 * options.h (General_options::gc_sections): Define as a no-op for now.
10167 (General_options::no_keep_memory): Ditto.
10168 (General_options::Bshareable): Define.
10169 * options.cc (General_options::finalize): Honor -Bshareable.
10171 2009-01-20 Andreas Schwab <schwab@suse.de>
10173 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
10174 read the value in the contents, since we don't use it. Use the
10175 template endianness when writing.
10176 (Relocate::relocate): Use it for R_PPC_REL16_HA.
10178 2009-01-19 Andreas Schwab <schwab@suse.de>
10180 * configure.tgt (powerpc64-*): Fix targ_obj.
10182 2009-01-15 Ian Lance Taylor <iant@google.com>
10184 * object.cc (Sized_relobj::write_local_symbols): Don't write out
10185 local symbols when stripping all symbols.
10187 2009-01-14 Cary Coutant <ccoutant@google.com>
10189 * output.cc (Output_reloc): Add explicit instantiations.
10191 2009-01-14 Cary Coutant <ccoutant@google.com>
10193 * archive.cc (Archive::get_elf_object_for_member): Remove call
10194 to File_read::claim_for_plugin.
10195 * descriptors.cc (Descriptors::open): Remove reference to
10197 (Descriptors::claim_for_plugin): Remove.
10198 * descriptors.h (Descriptors::claim_for_plugin): Remove.
10199 (Descriptors::is_claimed): Remove.
10200 (claim_descriptor_for_plugin): Remove.
10201 * fileread.cc (File_read::claim_for_plugin): Remove.
10202 * fileread.h (File_read::claim_for_plugin): Remove.
10203 (File_read::descriptor): Reopen descriptor if necessary.
10204 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
10205 (Plugin_manager::all_symbols_read): Add task parameter. Change
10207 (Plugin_manager::get_input_file): New function.
10208 (Plugin_manager::release_input_file): New function.
10209 (Pluginobj::Pluginobj): Add filesize parameter and initialize
10210 corresponding data member.
10211 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
10212 and pass to base constructor. Change all callers.
10213 (get_input_file, release_input_file): New functions.
10214 (make_sized_plugin_object): Add filesize parameter. Change all callers.
10215 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
10216 (Plugin_manager::all_symbols_read): Add task parameter.
10217 (Plugin_manager::get_input_file): New function.
10218 (Plugin_manager::release_input_file): New function.
10219 (Plugin_manager::task_): New data member.
10220 (Pluginobj::Pluginobj): Add filesize parameter.
10221 (Pluginobj::filename): New function.
10222 (Pluginobj::descriptor): New function.
10223 (Pluginobj::filesize): New function.
10224 (Pluginobj::filesize_): New data member.
10225 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
10226 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
10227 File_read::claim_for_plugin; use Object::unlock to unlock the file.
10229 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
10230 with archive libraries.
10231 * testsuite/Makefile.in: Regenerate.
10232 * testsuite/plugin_test.c (struct sym_info): New type.
10233 (get_input_file, release_input_file): New static variables.
10234 (onload): Capture new transfer vector entries.
10235 (claim_file_hook): Stop reading at end of file according to filesize.
10236 Factor out parsing of readelf output into separate function.
10237 (all_symbols_read_hook): Exercise get_input_file and release_input_file
10238 APIs and get the source file name from the symbol table. Convert
10239 source file name to corresponding object file name. Print info
10240 message when adding new input files.
10241 (parse_readelf_line): New function.
10242 * testsuite/plugin_test_1.sh: Add checks for new info messages.
10243 * testsuite/plugin_test_2.sh: Likewise.
10244 * testsuite/plugin_test_3.sh: Likewise.
10245 * testsuite/plugin_test_4.sh: New test case.
10247 2009-01-07 Ian Lance Taylor <iant@google.com>
10249 * version.cc (version_string): Bump to 1.8.
10251 2008-12-23 Cary Coutant <ccoutant@google.com>
10253 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
10254 * plugin.cc (Plugin_manager::finish): Rename as
10255 layout_deferred_objects. Move cleanup to separate function.
10256 (Plugin_manager::cleanup): New function.
10257 (Plugin_finish::run): Call layout_deferred_objects and cleanup
10259 * plugin.h (Plugin_manager::finish): Rename as
10260 layout_deferred_objects.
10261 (Plugin_manager::cleanup): New function.
10262 (Plugin_manager::cleanup_done): New field.
10264 2008-12-23 Cary Coutant <ccoutant@google.com>
10266 * plugin.cc (is_visible_from_outside): New function.
10267 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
10268 so we don't return "IR only" status for exported symbols or -r links.
10270 * testsuite/Makefile.am (plugin_test_3): New test case.
10271 * testsuite/Makefile.in: Regenerate.
10272 * testsuite/plugin_test_3.sh: New file.
10274 2008-12-22 Cary Coutant <ccoutant@google.com>
10276 * object.cc (Sized_relobj::layout_section): New function.
10277 (Sized_relobj::do_layout): Defer layout of input sections until after
10278 plugin has provided replacement files.
10279 (Sized_relobj::do_layout_deferred_sections): New function.
10280 * object.h (Relobj::set_section_offset): Remove virtual keyword.
10281 (Relobj::layout_deferred_sections): New function.
10282 (Relobj::do_layout_deferred_sections): New function.
10283 (Sized_relobj::do_layout_deferred_sections): New function.
10284 (Sized_relobj::layout_section): New function.
10285 (Sized_relobj::Deferred_layout): New structure.
10286 (Sized_relobj::deferred_layout_): New field.
10287 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10288 Change all callers. Layout deferred sections.
10289 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
10291 (Plugin_hook::run): Move code from do_plugin_hook inline.
10292 (Plugin_hook::do_plugin_hook): Remove.
10293 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10294 (Plugin_manager::finish): Renamed, was cleanup.
10295 (Plugin_manager::should_defer_layout): New function.
10296 (Plugin_manager::add_deferred_layout_object): New function.
10297 (Plugin_manager::Deferred_layout_list): New type.
10298 (Plugin_manager::deferred_layout_objects_): New field.
10299 (Plugin_hook::do_plugin_hook): Remove.
10301 2008-12-17 Ian Lance Taylor <iant@google.com>
10303 * options.h (class General_options): Add --no case for
10306 2008-12-16 Cary Coutant <ccoutant@google.com>
10308 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
10310 (Plugin_manager::claim_file): Create plugin object even if
10311 plugin did not call the add_symbols callback.
10312 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10313 asking for more symbols than were added.
10314 * testsuite/Makefile.am (plugin_test_1): Add test case with
10316 (empty.syms): New target.
10317 * testsuite/Makefile.in: Regenerate.
10318 * testsuite/plugin_test.c (claim_file_hook): Add new debug
10319 message. Don't call add_symbols if no globals.
10320 (all_symbols_read_hook): Don't provide replacement for empty
10323 2008-12-12 Ian Lance Taylor <iant@google.com>
10325 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10326 r_type == 0 for a local symbol with r_sym == 0.
10327 (scan_relocatable_relocs): Pass r_sym to
10328 local_non_section_strategy.
10329 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10332 * configure.ac: Update test for TLS descriptors: they are
10333 supported as of glibc 2.9.
10334 * configure: Rebuild.
10336 2008-12-11 Ian Lance Taylor <iant@google.com>
10339 * target-reloc.h (Default_scan_relocatable_relocs): For each
10340 function, map r_type == 0 to RELOC_DISCARD.
10342 2008-12-10 Cary Coutant <ccoutant@google.com>
10344 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
10345 object to override a kept COMDAT group from a plugin object.
10347 2008-12-09 Ian Lance Taylor <iant@google.com>
10350 * yyscript.y (file_cmd): Handle INPUT.
10352 * testsuite/initpri1.c: Change all declarations to be full
10353 prototypes by adding void, to avoid compiler warnings.
10355 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
10357 * options.cc (General_options::parse_plugin_opt): New.
10358 (General_options::add_plugin): The argument now is just the filename.
10359 (General_options::add_plugin_option): New.
10360 * options.h (plugin_opt): New.
10361 (add_plugin): Change argument name.
10362 (add_plugin_option): New.
10363 * plugin.cc (Plugin::load): Don't parse the plugin option.
10364 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
10365 (Plugin::add_option): New.
10366 (Plugin::args_): Change type.
10367 (Plugin::filename_): New.
10368 (Plugin_manager::add_plugin_option): New.
10369 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
10370 * testsuite/Makefile.in: Regenerate.
10372 2008-12-05 Cary Coutant <ccoutant@google.com>
10374 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
10375 Handle --strip-lto-sections option.
10376 * options.h (strip_lto_sections): New option.
10378 2008-12-01 Cary Coutant <ccoutant@google.com>
10380 * plugin.cc (ld_plugin_message): Change format parameter to const.
10381 Fix mismatch between new[] and delete.
10383 2008-11-14 Cary Coutant <ccoutant@google.com>
10385 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
10388 2008-11-05 Craig Silverstein <csilvers@google.com>
10390 * options.cc (General_options::parse_dynamic_list): New function.
10391 * options.h (General_options): New flags dynamic_list,
10392 dynamic_list_data, dynamic_list_cpp_new, and
10393 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
10394 (General_options::in_dynamic_list): New function.
10395 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
10396 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
10397 (Lex::can_continue_name): Likewise.
10399 (read_script_file): New parameter script_options.
10400 (read_dynamic_list): New function.
10401 (Script_options::define_dynamic_list): New function.
10402 (dynamic_list_keyword_parsecodes): New variable.
10403 (dynamic_list_keywords): New variable.
10404 * script.h (Script_options::define_dynamic_list): New function
10406 (read_dynamic_list): New function prototype.
10407 * symtab.cc (strprefix): New macro.
10408 (Symbol::should_add_dynsym_entry): Support dynamic_list,
10409 dynamic_list_data, dynamic_list_cpp_new, and
10410 dynamic_list_cpp_typeinfo.
10411 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
10412 (dynamic_list_expr): New rule.
10413 (dynamic_list_nodes): Likewise.
10414 (dynamic_list_node): Likewise.
10415 * testsuite/Makefile.am (dynamic_list): New test.
10416 * testsuite/Makefile.in: Regenerated.
10417 * testsuite/dynamic_list.t: New file.
10418 * testsuite/dynamic_list.sh: New file.
10420 2008-11-05 Craig Silverstein <csilvers@google.com>
10422 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
10423 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
10424 (t11_last): Likewise.
10425 * testsuite/ver_test_6.c (main): Likewise.
10427 2008-10-07 Cary Coutant <ccoutant@google.com>
10429 * options.c (General_options::finalize): Add check for -static and
10431 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
10434 2008-10-02 Cary Coutant <ccoutant@google.com>
10436 * plugin.cc (make_sized_plugin_object): Fix conditional
10437 compilation to work when not all targets are enabled.
10439 2008-09-29 Cary Coutant <ccoutant@google.com>
10441 * archive.cc (Archive::get_file_and_offset): Use filename instead
10442 of name to get library path.
10443 (Archive::include_member): Unlock external member of a thin archive.
10445 * testsuite/Makefile.am (TEST_AR): New variable.
10446 (thin_archive_test_1): New test.
10447 (thin_archive_test_2): New test.
10448 * testsuite/Makefile.in: Regenerate.
10449 * testsuite/thin_archive_main.cc: New file.
10450 * testsuite/thin_archive_test_1.cc: New file.
10451 * testsuite/thin_archive_test_2.cc: New file.
10452 * testsuite/thin_archive_test_3.cc: New file.
10453 * testsuite/thin_archive_test_4.cc: New file.
10455 2008-09-29 Cary Coutant <ccoutant@google.com>
10457 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
10458 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
10460 (Sized_relobj::do_finalize_local_symbols): Likewise.
10461 (Sized_relobj::map_to_kept_section): Likewise.
10462 * object.h (Sized_relobj::invalid_address): New constant.
10463 (Sized_relobj::do_output_section_offset): Check for invalid_address
10465 * output.cc (Output_reloc::local_section_offset): Use constant
10466 invalid_address instead of -1U.
10467 (Output_reloc::get_address): Likewise.
10468 (Output_section::output_address): Change -1U to -1ULL.
10469 * output.h (Output_reloc::invalid_address): New constant.
10470 * reloc.cc (Sized_relobj::write_sections): Use constant
10471 invalid_address instead of -1U.
10472 (Sized_relobj::relocate_sections): Likewise.
10473 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
10474 values for merge sections.
10475 * target-reloc.h (relocate_for_relocatable): Use constant
10476 invalid_address instead of -1U.
10478 2008-09-19 Cary Coutant <ccoutant@google.com>
10480 Add plugin functionality for link-time optimization (LTO).
10481 * configure.ac (plugins): Add --enable-plugins option.
10482 * configure: Regenerate.
10483 * config.in: Regenerate.
10484 * Makefile.am (LIBDL): New variable.
10485 (CCFILES): Add plugin.cc.
10486 (HFILES): Add plugin.h.
10487 (ldadd_var): Add LIBDL.
10488 * Makefile.in: Regenerate.
10490 * archive.cc: Include "plugin.h".
10491 (Archive::setup): Don't preread archive symbols when using a plugin.
10492 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
10493 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
10495 (Archive::include_member): Add symbols from plugin objects.
10496 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
10497 * descriptors.cc (Descriptors::open): Check for file descriptors
10498 abandoned by plugins.
10499 (Descriptors::claim_for_plugin): New function.
10500 * descriptors.h (Descriptors::claim_for_plugin): New function.
10501 (Open_descriptor::is_claimed): New field.
10502 (claim_descriptor_for_plugin): New function.
10503 * fileread.cc (File_read::claim_for_plugin): New function.
10504 * fileread.h (File_read::claim_for_plugin): New function.
10505 (File_read::descriptor): New function.
10506 * gold.cc: Include "plugin.h".
10507 (queue_initial_tasks): Add task to call plugin hooks for generating
10509 * main.cc: Include "plugin.h".
10510 (main): Load plugin libraries.
10511 * object.h (Pluginobj): Declare.
10512 (Object::pluginobj): New function.
10513 (Object::do_pluginobj): New function.
10514 (Object::set_target): New function.
10515 * options.cc: Include "plugin.h".
10516 (General_options::parse_plugin): New function.
10517 (General_options::General_options): Initialize plugins_ field.
10518 (General_options::add_plugin): New function.
10519 * options.h (Plugin_manager): Declare.
10520 (General_options): Add --plugin option.
10521 (General_options::has_plugins): New function.
10522 (General_options::plugins): New function.
10523 (General_options::add_plugin): New function.
10524 (General_options::plugins_): New field.
10525 * plugin.cc: New file.
10526 * plugin.h: New file.
10527 * readsyms.cc: Include "plugin.h".
10528 (Read_symbols::do_read_symbols): Check for archive before checking
10529 for ELF file. Call plugin hooks to claim files.
10530 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
10531 from a real object file; force override when processing replacement
10533 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
10534 (Symbol::init_base_object): Likewise.
10535 (Symbol::init_base_output_data): Likewise.
10536 (Symbol::init_base_output_segment): Likewise.
10537 (Symbol::init_base_constant): Likewise.
10538 (Symbol::init_base_undefined): Likewise.
10539 (Symbol::output_section): Assert that object is not a plugin.
10540 (Symbol_table::add_from_pluginobj): New function.
10541 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
10543 (Symbol_table::sized_write_globals): Likewise.
10544 (Symbol_table::add_from_pluginobj): Instantiate template.
10545 * symtab.h (Sized_pluginobj): Declare.
10546 (Symbol::in_real_elf): New function.
10547 (Symbol::set_in_real_elf): New function.
10548 (Symbol::in_real_elf_): New field.
10549 (Symbol_table::add_from_pluginobj): New function.
10551 * testsuite/Makefile.am (AM_CFLAGS): New variable.
10552 (LIBDL): New variable.
10553 (LDADD): Add LIBDL.
10554 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
10555 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
10556 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
10557 (MOSTLYCLEANFILES): Likewise.
10558 * testsuite/Makefile.in: Regenerate.
10559 * testsuite/plugin_test.c: New file.
10560 * testsuite/plugin_test_1.sh: New file.
10561 * testsuite/plugin_test_2.sh: New file.
10563 2008-09-16 Ian Lance Taylor <iant@google.com>
10565 * target-reloc.h (relocate_section): Check whether a symbol is
10566 defined by the ABI before reporting an undefined symbol error.
10567 * target.h (Target::is_defined_by_abi): Make parameter const.
10568 (Target::do_is_defined_by_abi): Likewise.
10569 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
10570 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
10571 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
10572 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
10573 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
10574 * testsuite/Makefile.in: Rebuild.
10576 * fileread.cc (make_view): Add casts to avoid warning.
10578 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
10580 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
10581 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10583 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
10585 * options.h (General_options::output_is_executable): New.
10586 (General_options::output_is_pie): New.
10587 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
10588 for shared libraries.
10589 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10591 2008-09-11 Chris Demetriou <cgd@google.com>
10593 * options.h (origin): New -z option.
10594 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
10595 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
10598 2008-09-05 Cary Coutant <ccoutant@google.com>
10600 * fileread.cc (File_read::make_view): Add check for attempt to map
10601 beyond end of file.
10603 2008-09-05 Cary Coutant <ccoutant@google.com>
10605 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
10606 explicit instantiations.
10608 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
10611 * options.cc (General_options::finalize): Allow undefined symbols
10612 in shlibs if linking -shared.
10615 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
10616 symbols as not needing a dynsym entry.
10618 2008-08-20 Craig Silverstein <csilvers@google.com>
10620 * fileread.cc (File_read::open): Do not lock the file unless it
10621 was successfully opened.
10623 2008-08-14 Cary Coutant <ccoutant@google.com>
10625 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
10626 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
10627 * testsuite/tls_test.cc (struct int128): 128-bit struct
10628 for testing TLS relocs with non-zero addend.
10629 (v12): New TLS variable.
10631 (t_last): Add check for v12.
10632 * testsuite/tls_test.h (t12): New function.
10633 * testsuite/tls_test_main.cc (thread_routine): Call new test.
10635 2008-08-13 Ian Lance Taylor <iant@google.com>
10637 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
10638 set tls_segment_ or relro_segment_.
10639 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
10641 * output.h (Output_section::clear_is_relro): New function.
10642 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
10643 sections specially even when output_data_ is empty.
10644 (Output_segment::maximum_alignment): When first section is relro,
10645 only force alignment for PT_LOAD segments.
10646 * script.cc (script_data_segment_align): New function.
10647 (script_data_segment_relro_end): New function.
10648 * script-c.h (script_data_segment_align): Declare.
10649 (script_data_segment_relro_end): Declare.
10650 * script-sections.h (class Script_sections): Declare
10651 data_segment_align and data_segment_relro_end. Add fields
10652 segment_align_index_ and saw_relro_end_.
10653 * script-sections.cc (class Sections_element): Add set_is_relro
10654 virtual function. Add new bool* parameter to place_orphan_here.
10655 Add get_output_section virtual function.
10656 (class Output_section_definition): Add set_is_relro. Add new
10657 bool* parameter to place_orphan_here. Add get_output_section.
10658 Add is_relro_ field.
10659 (Output_section_definition::Output_section_definition): Initialize
10660 evaluated_address_, evaluated_load_address, evaluated_addralign_,
10661 and is_relro_ fields.
10662 (Output_section_definition::place_orphan_here): Add is_relro
10664 (Output_section_definition::set_section_addresses): Set relro for
10666 (Output_section_definition::alternate_constraint): Likewise.
10667 (class Orphan_output_section): Add new bool* parameter to
10668 place_orphan_here. Add get_output_section.
10669 (Orphan_output_section::place_orphan_here): Add is_relro
10671 (Script_sections::Script_sections): Initialize
10672 data_segment_align_index_ and saw_relro_end_.
10673 (Script_sections::data_segment_align): New function.
10674 (Script_sections::data_segment_relro_end): New function.
10675 (Script_sections::place_orphan): Set or clear is_relro.
10676 (Script_sections::set_section_addresses): Force alignment of first
10678 * yyscript.y (exp): Call script_data_segment_align and
10679 script_data_segment_relro_end.
10680 * testsuite/relro_script_test.t: New file.
10681 * testsuite/relro_test.cc (using_script): Declare.
10682 (t1, t2): Test using_script.
10683 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
10684 (relro_script_test_SOURCES): Define.
10685 (relro_script_test_DEPENDENCIES): Define.
10686 (relro_script_test_LDFLAGS): Define.
10687 (relro_script_test_LDADD): Define.
10688 (relro_script_test.so): New target.
10689 * testsuite/Makefile.in: Rebuild.
10691 2008-08-06 Cary Coutant <ccoutant@google.com>
10693 * archive.cc (Archive::total_archives, Archive::total_members)
10694 (Archive::total_members_loaded): New variables.
10695 (Archive::setup): Add parameter. Add option to preread
10697 (Archive::read_armap): Add counter.
10698 (Archive::get_file_and_offset): New function.
10699 (Archive::get_elf_object_for_member): New function.
10700 (Archive::read_all_symbols): New function.
10701 (Archive::read_symbols): New function.
10702 (Archive::add_symbols): Add counters.
10703 (Archive::include_all_members): Use armap to find members if it's
10705 (Archive::include_member): Skip reading symbols if already read.
10706 Factored code into Archive::get_file_and_offset and
10707 Archive::get_elf_object_for_member. Changed call to
10708 Mapfile::report_include_archive_member.
10709 (Archive::print_stats): New function.
10710 * archive.h: Declare Object and Read_symbols_data classes.
10711 (Archive::Archive): Add initializers for new members.
10712 (Archive::setup): Add parameter.
10713 (Archive::print_stats): New function.
10714 (Archive::total_archives, Archive::total_members)
10715 (Archive::total_members_loaded): New variables.
10716 (Archive::get_file_and_offset): New function.
10717 (Archive::get_elf_object_for_member): New function.
10718 (Archive::read_all_symbols): New function.
10719 (Archive::read_symbols): New function.
10720 (Archive::Archive_member): New class.
10721 (Archive::members_): New member.
10722 (Archive::num_members_): New member.
10723 * main.cc: Include archive.h.
10724 (main): Call Archive::print_stats.
10725 * mapfile.cc (Mapfile::report_include_archive_member): Delete
10726 archive parameter; member_name is now the fully-decorated name.
10727 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
10728 * options.h: (General_options): Add --preread-archive-symbols option.
10729 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
10732 2008-08-04 Ian Lance Taylor <iant@google.com>
10734 * symtab.h (Symbol::use_plt_offset): New function.
10735 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
10736 * powerpc.cc (Relocate::relocate): Likewise.
10737 * sparc.cc (Relocate::relocate): Likewise.
10738 * x86_64.cc (Relocate::relocate): Likewise.
10739 * testsuite/weak_plt.sh: New test.
10740 * testsuite/weak_plt_main.cc: New test.
10741 * testsuite/weak_plt_shared.cc: New test.
10742 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
10743 (check_PROGRAMS): Add weak_plt.
10744 (check_DATA): Add weak_plt_shared.so.
10745 (weak_plt_main_pic.o, weak_plt): New targets.
10746 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
10747 * testsuite/Makefile.in: Rebuild.
10749 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
10751 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
10752 * testsuite/Makefile.in: Rebuild.
10754 2008-08-04 Alan Modra <amodra@bigpond.net.au>
10756 * Makefile.am (POTFILES.in): Set LC_ALL=C.
10757 * Makefile.in: Regenerate.
10758 * po/POTFILES.in: Regenerate.
10760 2008-07-29 Ian Lance Taylor <iant@google.com>
10762 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
10763 symbols before other symbols.
10764 * testsuite/script_test_2.cc (test_addr): Declare.
10765 (test_addr_alias): Declare.
10766 (main): Check that test_addr and test_addr_alias have the right
10768 * testsuite/script_test_2.t: Define test_addr_alias and
10771 2008-07-24 Ian Lance Taylor <iant@google.com>
10774 * descriptors.cc: New file.
10775 * descriptors.h: New file.
10776 * gold-threads.h (class Hold_optional_lock): New class.
10777 * fileread.cc: Include "descriptors.h".
10778 (File_read::~File_read): Release descriptor rather than closing
10780 (File_read::open) [file]: Call open_descriptor rather than open.
10781 Set is_descriptor_opened_.
10782 (File_read::open) [memory]: Assert that descriptor is not open.
10783 (File_read::reopen_descriptor): New function.
10784 (File_read::release): Release descriptor.
10785 (File_read::do_read): Make non-const. Reopen descriptor.
10786 (File_read::read): Make non-const.
10787 (File_read::make_view): Reopen descriptor.
10788 (File_read::do_readv): Likewise.
10789 * fileread.h (class File_read): Add is_descriptor_opened_ field.
10790 Update declarations.
10791 * layout.cc: Include "descriptors.h".
10792 (Layout::create_build_id): Use open_descriptor rather than open.
10793 * output.cc: Include "descriptors.h".
10794 (Output_file::open): Use open_descriptor rather than open.
10795 * archive.cc (Archive::const_iterator): Change Archive to be
10797 (Archive::begin, Archive::end): Make non-const.
10798 (Archive::count_members): Likewise.
10799 * archive.h (class Archive): Update declarations.
10800 * object.h (Object::read): Make non-const.
10801 * Makefile.am (CCFILES): Add descriptors.cc.
10802 (HFILES): Add descriptors.h.
10803 * Makefile.in: Rebuild.
10806 * gold.h: Always include <clocale>. Add Solaris workarounds
10807 following code in binutils/sysdep.h.
10810 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
10811 this->eh_frame_hdr_ is NULL before using it.
10813 * dynobj.cc (Versions::Versions): Update comment.
10815 * dynobj.cc (Versions::Versions): If there is an soname, use it as
10816 the base version name.
10818 * stringpool.cc (Stringpool_template::add_with_length): Set key to
10819 array size plus one.
10820 (Stringpool_template::set_string_offsets): Subtract one from key
10821 before using it as an array index.
10822 (Stringpool_template::get_offset_with_length): Likewise.
10823 (Stringpool_template::write_to_buffer): Likewise.
10824 * stringpool.h (Stringpool_template::get_offset_from_key):
10827 2008-07-23 Ian Lance Taylor <iant@google.com>
10830 * object.h (Merged_symbol_value::value): Do our best to handle a
10834 * script.cc (Version_script_info::get_versions): Don't add empty
10835 version tag to return value.
10836 (Version_script_info::get_symbol_version_helper): Change return
10837 type to bool. Add pversion parameter. Change all callers.
10838 (script_register_vers_node): Don't require a non-NULL tag.
10839 * script.h (class Version_script_info): Update declarations.
10840 (Version_script_info::get_symbol_version): Change return type to
10841 bool. Add version parameter. Change all callers.
10842 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
10843 handling. Handle an empty version from a version script.
10844 (Symbol_table::define_special_symbol): Likewise.
10845 * testsuite/ver_test_10.script: New file.
10846 * testsuite/ver_test_10.sh: New file.
10847 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
10848 (check_DATA): Add ver_test_10.syms.
10849 (ver_test_10.syms, ver_test_10.so): New target.
10850 * testsuite/Makefile.in: Rebuild.
10852 2008-07-23 Simon Baldwin <simonb@google.com>
10854 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
10855 to zero for undefined symbols from dynamic libraries.
10857 2008-07-23 Ian Lance Taylor <iant@google.com>
10859 * symtab.cc (Symbol_table::resolve): Remove version parameter.
10860 Change all callers.
10861 * symtab.h (class Symbol_table): Update declaration.
10862 * testsuite/ver_test_9.cc: New file.
10863 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
10864 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
10865 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
10866 (ver_test_9.so, ver_test_9.o): New targets.
10867 * testsuite/Makefile.in: Rebuild.
10869 2008-07-22 Ian Lance Taylor <iant@google.com>
10871 * options.h (class General_options): Define --check-sections.
10872 * layout.cc (Layout::set_segment_offsets): Handle
10875 * options.h (class General_options): Define -n/--nmagic and
10877 * options.cc (General_options::finalize): For -n/--nmagic or
10878 -N/--omagic, set -static.
10879 * layout.cc (Layout::attach_allocated_section_to_segment): If
10880 -N/--omagic, don't put read-only and read-write sections in
10881 different segments.
10882 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
10883 finding a read-only segment.
10884 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
10885 don't set the minimum segment alignment to the common page size,
10886 and don't set the file offset to the address modulo the page size.
10887 * script-sections.cc (Script_sections::create_segments): If
10888 -n/--omagic, don't put read-only and read-write sections in
10889 different segments.
10891 * cref.cc: New file.
10892 * cref.h: New file.
10893 * options.h (class General_options): Add --print-symbol-counts.
10894 * main.cc (main): Issue defined symbol report if requested.
10895 * archive.cc (Archive::interpret_header): Make into a const member
10897 (Archive::add_symbols): Call Input_objects::archive_start and
10899 (Archive::const_iterator): Define new class.
10900 (Archive::begin, Archive::end): New functions.
10901 (Archive::include_all_members): Rewrite to use iterator.
10902 (Archive::count_members): New function.
10903 * archive.h (class Archive): Update declarations.
10904 (Archive::filename): New function.
10905 * object.cc: Include "cref.h".
10906 (Sized_relobj::Sized_relobj): Initialize defined_count_.
10907 (Sized_relobj::do_get_global_symbol_counts): New function.
10908 (Input_objects::add_object): Add object to cross-referencer.
10909 (Input_objects::archive_start): New function.
10910 (Input_objects::archive_stop): New function.
10911 (Input_objects::print_symbol_counts): New function.
10912 * object.h: Declare Cref and Archive.
10913 (Object::get_global_symbol_counts): New function.
10914 (Object::do_get_global_symbol_counts): New pure virtual function.
10915 (class Sized_relobj): Add defined_count_ field. Update
10917 (class Input_objects): Add cref_ field. Update constructor.
10918 Update declarations.
10919 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
10921 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
10923 (Sized_dynobj::do_get_global_symbol_counts): New function.
10924 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
10925 defined_count_. Update declarations. Define Symbols typedef.
10926 * symtab.cc (Symbol_table::add_from_relobj): Add defined
10927 parameter. Change all callers.
10928 (Symbol_table::add_from_dynobj): Add sympointers and defined
10929 parameters. Change all callers.
10930 * symtab.h (class Symbol_table): Update declarations.
10931 * Makefile.am (CCFILES): Add cref.cc.
10932 (HFILES): Add cref.h.
10933 * Makefile.in: Rebuild.
10935 2008-07-22 Simon Baldwin <simonb@google.com>
10937 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
10938 to zero when writing undefined symbols.
10940 2008-07-22 Ian Lance Taylor <iant@google.com>
10942 * output.cc (Output_section::add_input_section): Don't try to
10943 merge empty merge sections.
10945 2008-07-21 Craig Silverstein <csilvers@google.com>
10947 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10948 Include symbol version in error message.
10950 2008-07-20 Chris Demetriou <cgd@google.com>
10952 * configure.ac (gold_cv_c_random_seed): New configured variable.
10953 (RANDOM_SEED_CFLAGS): New substituted variable.
10954 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
10955 * configure: Rebuild.
10956 * Makefile.in: Likewise.
10957 * testsuite/Makefile.in: Likewise.
10959 2008-07-18 Ian Lance Taylor <iant@google.com>
10961 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
10962 where we see NAME/NULL and NAME/VERSION as separate symbols.
10963 * testsuite/ver_test_main.cc (main): Call t4.
10964 (t4, t4_2a): Define.
10965 * testsuite/ver_test_2.cc (t4_2): Define.
10966 * testsuite/ver_test_2.script: Put t4_2a in VER2.
10967 * testsuite/ver_test_4.cc (t4_2a): Define.
10968 * testsuite/ver_test_4.script: Put t4_2a in VER2.
10969 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
10971 2008-07-17 Ian Lance Taylor <iant@google.com>
10973 * dynobj.cc (Versions::add_def): If we give an error about a
10974 missing version, go ahead and create the version anyhow.
10976 2008-07-10 Ian Lance Taylor <iant@google.com>
10978 Handle output sections with more than 0x7fffffff bytes.
10979 * object.h (class Relobj): Change map_to_output_ to
10980 output_sections_, and just keep a section pointer. Change all
10981 uses. Move comdat group support to Sized_relobj.
10982 (Relobj::is_section_specially_mapped): Remove.
10983 (Relobj::output_section): Remove poff parameter. Change all
10985 (Relobj::output_section_offset): New function.
10986 (Relobj::set_section_offset): Rewrite.
10987 (Relobj::map_to_output): Remove.
10988 (Relobj::output_sections): New function.
10989 (Relobj::do_output_section_offset): New pure virtual function.
10990 (Relobj::do_set_section_offset): Likewise.
10991 (class Sized_relobj): Add section_offsets_ field. Add comdat
10992 group support from Relobj. Update declarations.
10993 (Sized_relobj::get_output_section_offset): New function.
10994 (Sized_relobj::do_output_section_offset): New function.
10995 (Sized_relobj::do_set_section_offset): New function.
10996 * object.cc (Relobj::output_section_address): Remove.
10997 (Sized_relobj::Sized_relobj): Initialize new fields.
10998 (Sized_relobj::include_section_group): Cast find_kept_object to
11000 (Sized_relobj::include_linkonce_section): Likewise.
11001 (Sized_relobj::do_layout): Use separate arrays for output section
11003 (Sized_relobj::do_count_local_symbols): Change map_to_output to
11005 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
11006 output_sections and section_offsets.
11007 (Sized_relobj::write_local_symbols): Likewise.
11008 (map_to_kept_section): Compute output address directly.
11009 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
11010 output_sections and section_offsets.
11011 (Sized_relobj::write_sections): Likewise.
11012 (Sized_relobj::relocate_sections): Likewise.
11013 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
11014 * output.h (class Output_reloc): Update declarations. Change
11015 u2_.relobj to Sized_relobj*.
11016 (class Output_data_reloc): Change add functions to use
11018 * output.cc (Output_reloc::Output_reloc): Change relobj to
11020 (Output_reloc::local_section_offset): Change return type to
11021 Elf_Addr. Use get_output_section_offset.
11022 (Output_reloc::get_address): Likewise.
11023 (Output_section::is_input_address_mapped): Don't call
11024 is_section_specially_mapped.
11025 (Output_section::output_offset): Likewise.
11026 (Output_section::output_address): Likewise.
11027 (Output_section::starting_output_address): Likewise.
11028 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
11029 parameter to Sized_relobj*.
11030 (Copy_relocs::need_copy_reloc): Likewise.
11031 (Copy_relocs::save): Likewise.
11032 * copy-relocs.h (class Copy_relocs): Update declarations.
11033 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
11034 Sized_relobj*. Change relobj_ field to Sized_relobj*.
11035 * target-reloc.h (relocate_for_relocatable): Change
11036 offset_in_output_section type to Elf_Addr. Change code that uses
11038 * layout.cc (Layout::layout): Always set *off.
11039 * mapfile.cc (Mapfile::print_input_section): Use
11040 output_section_offset.
11041 * i386.cc (Target_i386::copy_reloc): Change object parameter to
11043 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
11044 * sparc.cc (Target_sparc::copy_reloc): Likewise.
11045 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
11047 2008-07-03 Ian Lance Taylor <iant@google.com>
11049 * layout.cc (Layout::include_section): Do not discard unrecognized
11050 SHT_STRTAB sections.
11052 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
11054 * script.cc (Lex::can_continue_name): Make '?' allowable in
11055 version-script names.
11056 * testsuite/version_script.map: Change glob pattern to use '?'
11058 2008-06-30 Manish Singh <yosh@gimp.org>
11061 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
11064 2008-06-30 Ian Lance Taylor <iant@google.com>
11068 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
11069 versions]: Don't try to read the value in the contents, since we
11070 don't use it. Use the template endianness when writing.
11072 2008-06-25 Cary Coutant <ccoutant@google.com>
11074 * fileread.cc (File_read::make_view): Assert on zero-length view.
11075 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
11076 symbol table when there are no symbols to read.
11078 2008-06-23 Craig Silverstein <csilvers@google.com>
11080 * version.cc (version_string): Bump to 1.7
11082 2008-06-18 Craig Silverstein <csilvers@google.com>
11084 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
11085 constant 0xFFFF to type Valtype.
11086 (Powerpc_relocate_functions::rel16_ha): Likewise.
11088 2008-06-17 Ian Lance Taylor <iant@google.com>
11090 * output.h (Output_section::Input_section): Initialize p2align_ to
11091 zero for Output_section_data constructors.
11092 (Output_section::Input_section::addralign): If not an input
11093 section, return the alignment of the Output_section_data.
11094 * testsuite/copy_test.cc: New file.
11095 * testsuite/copy_test_1.cc: New file.
11096 * testsuite/copy_test_2.cc: New file.
11097 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
11098 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
11099 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
11100 (copy_test_1_pic.o, copy_test_1.so): New targets.
11101 (copy_test_2_pic.o, copy_test_2.so): New targets.
11102 * testsuite/Makefile.in: Rebuild.
11104 * script-sections.cc (Script_sections::place_orphan): Initialize
11105 local variable exact.
11107 2008-06-13 David Edelsohn <edelsohn@gnu.org>
11109 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
11111 2008-06-12 David Edelsohn <edelsohn@gnu.org>
11112 David S. Miller <davem@davemloft.net>
11114 * powerpc.cc: New file.
11115 * Makefile.am (TARGETSOURCES): Add powerpc.cc
11116 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
11117 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
11118 * Makefile.in: Rebuild.
11120 2008-06-09 Ian Lance Taylor <iant@google.com>
11122 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
11124 (throwing, orig_terminate): New static variables.
11125 (terminate_handler): New static function.
11126 (t2): Set terminate handler.
11128 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
11131 * binary.cc (Binary_to_elf::sized_convert): Fix .data
11134 2008-05-30 Cary Coutant <ccoutant@google.com>
11136 * archive.cc (Archive::include_all_members) Correct to step
11137 over symbol table and extended name table in thin archives.
11139 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
11142 * target-reloc.h (relocate_for_relocatable): Fix new_offset
11145 2008-05-28 Caleb Howe <cshowe@google.com>
11147 * reduced_debug_output.cc: New file.
11148 * reduced_debug_output.h: New file.
11149 * options.h (class General_options): Add --strip-debug-non-line.
11150 * options.cc (General_options::finalize): Add strip_debug_non_line
11151 to the strip heirarchy.
11152 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
11154 * layout.cc: Include "reduced_debug_output.h".
11155 (Layout::Layout): Initialize new fields.
11156 (line_only_debug_sections): New static array.
11157 (is_lines_only_debug_sections): New static inline function.
11158 (Layout::include_section): Handle --strip-debug-non-line.
11159 (Layout::make_output_section): If --strip-debug-non-line, build
11160 new output sections for .debug_abbrev and .debug_info.
11161 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
11162 gold. Warn about possible overflow.
11163 (read_signed_LEB_128): Likewise.
11164 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
11165 (read_signed_LEB_128): Declare.
11166 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
11167 (HFILES): Add reduced_debug_output.h.
11168 * Makefile.in: Rebuild.
11170 2008-05-21 Ian Lance Taylor <iant@google.com>
11172 * mapfile.cc: New file.
11173 * mapfile.h: New file.
11174 * options.h (class General_options): Add -M/--print-map and -Map.
11175 * options.cc (General_options::finalize): Make -M equivalent to
11177 * main.cc: Include <cstdio> and "mapfile.h".
11178 (main): Open mapfile if requested.
11179 * gold.cc (class Middle_runner): Add mapfile_ field. Update
11180 constructor. Change caller.
11181 (queue_initial_tasks): Add mapfile parameter. Change caller.
11182 (queue_middle_tasks): Likewise.
11183 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
11185 * archive.cc: Include "mapfile.h".
11186 (Archive::add_symbols): Add mapfile parameter. Change all
11187 callers. Pass mapfile, symbol, and reason to include_member.
11188 (Archive::include_all_members): Add mapfile parameter. Change all
11190 (Archive::include_member): Add mapfile, sym, and why parameters.
11191 Change all callers. Report inclusion to map file.
11192 * archive.h: Include "fileread.h".
11193 (class Archive): Update declarations.
11194 (Archive::file): New const method.
11195 (class Add_archive_symbols): Add mapfile_ field. Update
11196 constructor. Change all callers.
11197 * readsyms.h (class Read_symbols): Likewise.
11198 (class Finish_group): Likewise.
11199 (class Read_script): Likewise.
11200 * common.cc: Include "mapfile.h".
11201 (Symbol_table::allocate_commons): Add mapfile parameter. Change
11203 (Symbol_table::do_allocate_commons): Likewise.
11204 (Symbol_table::do_allocate_commons_list): Likewise. Report common
11205 symbol allocation to mapfile.
11206 * common.h (class Allocate_commons_task): Add mapfile_ field.
11207 Update constructor. Change all callers.
11208 * symtab.h (class Symbol_table): Update declarations.
11209 * layout.cc: Include "mapfile.h".
11210 (Layout_task_runner::run): Print information to mapfile.
11211 (Layout::create_gold_note): Change Output_data_fixed_space to
11212 Output_data_zero_fill.
11213 (Layout::create_build_id): Likewise.
11214 (Layout::print_to_mapfile): New function.
11215 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
11216 constructor. Change caller.
11217 (class Layout): Declare print_to_mapfile.
11218 * output.cc (Output_section::Input_section::print_to_mapfile): New
11220 (Output_section::add_input_section): If producing a map, always
11221 add to input_sections_ list.
11222 (Output_section::do_print_to_mapfile): New function.
11223 (Output_segment::print_sections_to_mapfile): New function.
11224 (Output_segment::print_section_list_to_mapfile): New function.
11225 * output.h: Include "mapfile.h".
11226 (Output_data::print_to_mapfile): New function.
11227 (Output_data::do_print_to_mapfile): New virtual function.
11228 (Output_segment_headers::do_print_to_mapfile): New function.
11229 (Output_file_header::do_print_to_mapfile): New function.
11230 (Output_data_const::do_print_to_mapfile): New function.
11231 (class Output_data_const_buffer): Add map_name_ field. Update
11232 constructor. Change all callers. Add do_print_to_mapfile
11234 (class Output_data_fixed_space): Likewise.
11235 (class Output_data_space): Likewise.
11236 (class Output_data_zero_fill): New class.
11237 (Output_data_strtab::do_print_to_mapfile): New function.
11238 (Output_data_reloc_base::do_print_to_mapfile): New function.
11239 (Output_relocatable_relocs::do_print_to_mapfile): New function.
11240 (Output_data_group::do_print_to_mapfile): New function.
11241 (Output_data_got::do_print_to_mapfile): New function.
11242 (Output_data_dynamic::do_print_to_mapfile): New function.
11243 (Output_symtab_xindex::do_print_to_mapfile): New function.
11244 (class Output_section): Declare do_print_to_mapflie. Declare
11245 print_to_mapfile in Input_section.
11246 (class Output_segment): Declare new functions.
11247 * object.h (Sized_relobj::symbol_count): New function.
11248 * script-sections.cc
11249 (Output_section_element_dot_assignment::set_section_addresses):
11250 Change Output_data_fixed_space to Output_data_zero_fill.
11251 (Output_data_expression::do_print_to_mapfile): New function.
11252 * script.cc (read_input_script): Add mapfile parameter. Change
11254 * script.h (read_input_script): Update declaration.
11255 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
11256 (Eh_frame::do_print_to_mapfile): New function.
11257 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
11258 (Output_merge_string::do_print_to_mapfile): New function.
11259 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
11261 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
11263 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
11265 * Makefile.am (CCFILES): Add mapfile.cc.
11266 (HFILES): Add mapfile.h.
11267 * Makefile.in: Rebuild.
11269 2008-05-19 Ian Lance Taylor <iant@google.com>
11271 * options.h (class General_options): Add -z relro.
11272 * layout.cc (Layout::Layout): Initialize relro_segment_.
11273 (Layout::add_output_section_data): Return the output section.
11274 (Layout::make_output_section): Rcognize relro sections and mark
11275 them appropriately.
11276 (Layout::attach_allocated_section_to_segment): Put relro sections
11277 in a PT_GNU_RELRO segment.
11278 (Layout::create_initial_dynamic_sections): Mark the .dynamic
11280 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11282 (Layout::linkonce_mapping): Map d.rel.ro.local to
11283 .data.rel.ro.local.
11284 (Layout::output_section_name): Us .data.rel.ro.local for any
11285 section which begins with that.
11286 * layout.h (class Layout): Update add_output_section_data
11287 declaration. Add relro_segment_ field.
11288 * output.cc (Output_section::Output_section): Initialize is_relro_
11289 and is_relro_local_ fields.
11290 (Output_segment::add_output_section): Group relro sections.
11291 (Output_segment::is_first_section_relro): New function.
11292 (Output_segment::maximum_alignment): If there is a relro section,
11293 align the segment to the common page size.
11294 (Output_segment::set_section_addresses): Track whether we are
11295 looking at relro sections. If the last section is a relro
11296 section, align to the common page size.
11297 (Output_segment::set_section_list_addresses): Add in_relro
11298 parameter. Change all callers. Align to the page size when
11299 moving from relro to non-relro section.
11300 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
11302 * output.h (class Output_section): Add is_relro_ and
11303 is_relro_local_ fields.
11304 (Output_section::is_relro): New function.
11305 (Output_section::set_is_relro): New function.
11306 (Output_section::is_relro_local): New function.
11307 (Output_section::set_is_relro_local): New function.
11308 (class Output_segment): Update declarations.
11309 * i386.cc (Target_i386::got_section): Mark .got section as relro.
11310 * sparc.cc (Target_sparc::got_section): Likewise.
11311 * x86_64.cc (Target_x86_64::got_section): Likewise.
11312 * testsuite/relro_test_main.cc: New file.
11313 * testsuite/relro_test.cc: New file.
11314 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11315 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11316 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11317 (relro_test.so, relro_test_pic.o): New targets.
11318 * testsuite/Makefile.in: Rebuild.
11320 2008-05-16 Ian Lance Taylor <iant@google.com>
11322 * output.cc (Output_segment::add_output_section): Remove front
11324 * output.h (class Output_segment): Remove
11325 add_initial_output_section and overloaded add_output_section.
11326 Update declaration of remaining add_output_section.
11327 * layout.cc (Layout::create_interp): Call add_output_section
11328 rather than add_initial_output_section.
11329 (Layout::finish_dynamic_section): Likewise.
11331 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
11332 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
11333 know the dynamic type.
11334 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
11335 field. Initialize it in constructor.
11336 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
11337 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
11338 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
11341 * output.cc (Output_reloc::get_address): Change return type to
11343 * output.h (class Output_reloc): Update get_address declaration.
11344 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
11345 for section addresses.
11347 2008-05-09 Ian Lance Taylor <iant@google.com>
11350 * gold.cc (gold_nomem): Use return value of write.
11352 2008-05-08 Ian Lance Taylor <iant@google.com>
11354 * symtab.c (Symbol::init_base_output_data): Add version
11355 parameter. Change all callers.
11356 (Symbol::init_base_output_segment): Likewise.
11357 (Symbol::init_base_constant): Likewise.
11358 (Symbol::init_base_undefined): Likewise.
11359 (Sized_symbol::init_output_data): Likewise.
11360 (Sized_symbol::init_output_segment): Likewise.
11361 (Sized_symbol::init_constant): Likewise.
11362 (Sized_symbol::init_undefined): Likewise.
11363 (Symbol_table::do_define_in_output_data): If the new symbol has a
11364 version, mark it as the default.
11365 (Symbol_table::do_define_in_output_segment): Likewise.
11366 (Symbol_table::do_define_as_constant): Likewise.
11367 * symtab.h (class Symbol): Update declarations.
11368 (class Sized_symbol): Likewise.
11369 * resolve.cc (Symbol::override_version): New function.
11370 (Symbol::override_base): Call override_version.
11371 (Symbol::override_base_with_special): Likewise.
11372 * testsuite/ver_script_8.script: New file.
11373 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
11374 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
11375 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
11376 (ver_test_8_1.so, ver_test_8_2.so): New targets.
11378 2008-05-06 Ian Lance Taylor <iant@google.com>
11381 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
11383 (class General_options): Remove existing --undefined, and add
11384 --no-undefined instead. Add new --undefined as synonym for -u.
11385 * archive.cc (Archive::add_symbols): Check whether symbol was
11387 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
11388 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
11389 all uses. Add IS_UNDEFINED. Update declarations to split
11390 different versions of init_base. Declare init_base_undefined.
11391 (Symbol::is_defined): Handle IS_UNDEFINED.
11392 (Symbol::is_undefined): Likewise.
11393 (Symbol::is_weak_undefined): Call is_undefined.
11394 (Symbol::is_absolute): Handle IS_CONSTANT.
11395 (class Sized_symbol): Update declarations to split different
11396 versions of init. Declare init_undefined.
11397 (class Symbol_table): Declare new functions.
11398 * symtab.cc (Symbol::init_base_object): Rename from init_base.
11399 Change all callers.
11400 (Symbol::init_base_output_data): Likewise.
11401 (Symbol::init_base_output_segment): Likewise.
11402 (Symbol::init_base_constant): Likewise.
11403 (Symbol::init_base_undefined): New function.
11404 (Sized_symbol::init_object): Rename from init. Change all
11406 (Sized_symbol::init_output_data): Likewise.
11407 (Sized_symbol::init_output_segment): Likewise.
11408 (Sized_symbol::init_constant): Likewise.
11409 (Sized_symbol::init_undefined): New function.
11410 (Symbol_table::add_undefined_symbols_from_command_line): New
11412 (Symbol_table::do_add_undefined_symbols_from_command_line): New
11414 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
11415 (Symbol::output_section): Likewise.
11416 (Symbol::set_output_section): Likewise.
11417 (Symbol_table::sized_finalize_symbol): Likewise.
11418 (Symbol_table::sized_write_globals): Likewise.
11419 * resolve.cc (Symbol_table::should_override): Likewise.
11420 (Symbol::override_base_with_special): Likewise.
11422 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
11423 symbol, change it to have default visibility.
11424 * testsuite/protected_1.cc: New file.
11425 * testsuite/protected_2.cc: New file.
11426 * testsuite/protected_3.cc: New file.
11427 * testsuite/protected_main_1.cc: New file.
11428 * testsuite/protected_main_2.cc: New file.
11429 * testsuite/protected_main_3.cc: New file.
11430 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
11431 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
11432 (protected_1_LDFLAGS, protected_1_LDADD): Define.
11433 (protected_1.so): New target.
11434 (protected_1_pic.o, protected_2_pic.o): New targets.
11435 (protected_3_pic.o): New target.
11436 (check_PROGRAMS): Add protected_2.
11437 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
11438 (protected_2_LDFLAGS, protected_2_LDADD): Define.
11439 * testsuite/Makefile.in: Rebuild.
11441 * options.h (DEFINE_var): Add set_user_set_##varname__.
11442 (DEFINE_bool_alias): New macro.
11443 (class General_options): Define -Bstatic using DEFINE_bool_alias
11444 rather than DEFINE_special. Add --undefined as an alias for -z
11446 * options.cc (General_options::parse_Bstatic): Remove.
11448 * options.h (class General_options): Add --fatal-warnings.
11449 * main.cc (main): Implement --fatal-warnings.
11450 * errors.h (Errors::warning_count): New function.
11452 * options.h (class General_options): Add -Bsymbolic-functions.
11453 * symtab.h (Symbol::is_preemptible): Check for
11454 -Bsymbolic-functions.
11456 2008-05-05 Ian Lance Taylor <iant@google.com>
11458 * options.h (DEFINE_bool): For DASH_Z, create the negative option
11459 as noVARNAME rather than no-VARNAME.
11460 (class General_options): Add option -z combreloc.
11461 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
11463 (Output_reloc::sort_before) [SHT_REL]: New function.
11464 (Output_reloc::sort_before) [SHT_RELA]: New function.
11465 (class Output_data_reloc_base): Add sort_relocs_ field. Define
11466 Sort_relocs_comparison.
11467 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
11468 parameter. Change all callers.
11469 (Output_data_reloc::Output_data_reloc) [both versions]: Add
11470 sort_relocs parameter. Change all callers.
11471 * output.cc (Output_reloc::get_address): New function, broken out
11473 (Output_reloc::write_rel): Call it.
11474 (Output_reloc::compare): New function.
11475 (Output_data_reloc_base::do_write): Optionally sort relocs.
11477 * configure.ac: If targ_extra_obj is set, link it in.
11478 * configure.tgt: Initialize all variables.
11479 (x86_64*): Set targ_extra_obj and targ_extra_size.
11480 * configure: Rebuild.
11482 * object.cc (Sized_relobj::include_section_group): Adjust section
11483 indexes read from group data. Build vector to pass to
11485 * layout.cc (Layout::layout_group): Add flags and shndxes
11486 parameters. Remove contents parameter. Change caller. Update
11487 explicit instantiations.
11488 * layout.h (class Layout): Update layout_group declaration.
11489 * output.cc (Output_data_group::Output_data_group): Add flags and
11490 input_shndxes parameters. Remove contents parameter. Change
11492 (Output_data_group::do_write): Change input_sections_ to
11494 * output.h (class Output_data_group): Update constructor
11495 declaration. Rename input_sections_ to input_shndxes_.
11496 * testsuite/many_sections_test.cc: Add template.
11498 2008-04-30 Cary Coutant <ccoutant@google.com>
11500 * target-reloc.h (relocate_section): Fix dead-pointer bug.
11502 * layout.cc (Layout::include_section): Refactored check for debug
11504 (Layout::add_comdat): Add new parameters. Change type
11505 of signature parameter. Add object and shndx to signatures table.
11506 (Layout::find_kept_object): New function.
11507 * layout.h: Include <cstring>.
11508 (Layout::is_debug_info_section): New function.
11509 (Layout::add_comdat): Add new parameters.
11510 (Layout::find_kept_object): New function.
11511 (Layout::Kept_section): New struct.
11512 (Layout::Signatures): Change type of map range.
11513 * object.cc (Relobj::output_section_address): New function.
11514 (Sized_relobj::include_section_group): Add new parameters. Change
11515 calls to Layout::add_comdat. Change to build table of kept comdat
11516 groups and table mapping discarded sections to kept sections.
11517 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
11518 (Sized_relobj::do_layout): Change calls to include_section_group and
11519 include_linkonce_section.
11520 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
11521 value to zero when section is discarded.
11522 (Sized_relobj::map_to_kept_section): New function.
11523 * object.h (Relobj::output_section_address): New function.
11524 (Relobj::Comdat_group): New type.
11525 (Relobj::find_comdat_group): New function.
11526 (Relobj::Comdat_group_table): New type.
11527 (Relobj::Kept_comdat_section): New type.
11528 (Relobj::Kept_comdat_section_table): New type.
11529 (Relobj::add_comdat_group): New function.
11530 (Relobj::set_kept_comdat_section): New function.
11531 (Relobj::get_kept_comdat_section): New function.
11532 (Relobj::comdat_groups_): New field.
11533 (Relobj::kept_comdat_sections_): New field.
11534 (Symbol_value::input_value): Update comment.
11535 (Sized_relobj::map_to_kept_section) New function.
11536 (Sized_relobj::include_linkonce_section): Add new parameter.
11537 * target-reloc.h (Comdat_behavior): New type.
11538 (get_comdat_behavior): New function.
11539 (relocate_section): Add code to map a discarded section to the
11540 corresponding kept section when applying a relocation.
11542 2008-04-30 Craig Silverstein <csilvers@google.com>
11544 * dwarf_reader.cc (next_generation_count): New static var.
11545 (Addr2line_cache_entry): New struct.
11546 (addr2line_cache): New static var.
11547 (Dwarf_line_info::one_addr2line): Added caching.
11548 (Dwarf_line_info::clear_addr2line_cache): New function.
11549 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
11550 cache-size parameter.
11551 (Dwarf_line_info::one_addr2line_cache): New function.
11552 * symtab.cc (Symbol_table::detect_odr_violations): Pass
11553 new cache-size argument to one_addr2line(), and clear cache.
11555 2008-04-28 Cary Coutant <ccoutant@google.com>
11557 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
11558 R_386_PC8 relocations.
11560 2008-04-23 Ian Lance Taylor <iant@google.com>
11562 * object.cc (Sized_relobj::include_section_group): Check for
11563 invalid section group.
11565 * object.cc (make_elf_object): Correct test for 64-bit ELF file
11568 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
11569 than read for file header.
11570 * archive.cc (Archive::include_member): Likewise.
11572 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
11574 * aclocal.m4: Regenerate.
11575 * configure: Regenerate.
11577 2008-04-19 Ian Lance Taylor <iant@google.com>
11579 * version.cc (version_string): Bump to 1.6.
11581 * testsuite/Makefile.am (many_sections_r_test): New target.
11582 (many_sections_r_test_SOURCES): Remove.
11583 (many_sections_r_test_DEPENDENCIES): Remove.
11584 (many_sections_r_test_LDFLAGS): Remove.
11585 (many_sections_r_test_LDADD): Remove.
11587 * object.cc (Sized_relobj::do_add_symbols): Always pass
11588 local_symbol_count_ to add_from_relobj.
11590 * testsuite/Makefile.am (many_sections_check.h): Only check one in
11591 every thousand variables.
11592 * testsuite/Makefile.in: Rebuild.
11594 * object.cc (Xindex::initialize_symtab_xindex): New function.
11595 (Xindex::read_symtab_xindex): New function.
11596 (Xindex::sym_xindex_to_shndx): New function.
11597 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
11599 (Sized_relobj::do_initialize_xindex): New function.
11600 (Sized_relobj::do_read_symbols): Adjust section links.
11601 (Sized_relobj::symbol_section_and_value): Add is_ordinary
11602 parameter. Change all callers.
11603 (Sized_relobj::include_section_group): Adjust section links and
11604 symbol section indexes.
11605 (Sized_relobj::do_layout): Adjust section links.
11606 (Sized_relobj::do_count_local_symbols): Adjust section links and
11607 symbol section indexes.
11608 (Sized_relobj::do_finalize_local_symbols): Distinguish between
11609 ordinary and special symbols.
11610 (Sized_relobj::write_local_symbols): Add symtab_xindex and
11611 dynsym_xindex parameters. Change all callers. Adjust section
11612 links. Use SHN_XINDEX when needed.
11613 (Sized_relobj::get_symbol_location_info): Adjust section links.
11614 Don't get fooled by special symbols.
11615 * object.h (class Xindex): Define.
11616 (class Object): Add xindex_ parameter. Declare virtual functoin
11617 do_initialize_xindex.
11618 (Object::adjust_sym_shndx): New function.
11619 (Object::set_xindex): New protected function.
11620 (class Symbol_value): Add is_ordinary_shndx_ field.
11621 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
11622 (Symbol_value::value): Assert ordinary section.
11623 (Symbol_value::initialize_input_to_output_map): Likewise.
11624 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
11625 Change all callers.
11626 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
11628 (class Sized_relobj): Update declarations.
11629 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
11630 parameter. Change all callers.
11631 (Sized_relobj::adjust_shndx): New function.
11632 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
11634 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
11635 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
11636 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
11637 (Sized_dynobj::read_dynsym_section): Adjust section links.
11638 (Sized_dynobj::read_dynamic): Likewise.
11639 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
11641 (Sized_dynobj::do_initialize_xindex): New function.
11642 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
11643 do_initialize_xindex.
11644 (Sized_dynobj::adjust_shndx): New function.
11645 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
11646 dynsym_xindex_ fields.
11647 (Layout::finalize): Add a call to set_section_indexes before
11648 creating the symtab sections.
11649 (Layout::set_section_indexes): Don't do anything if the section
11650 already has a section index.
11651 (Layout::create_symtab_sections): Add shnum parameter. Change
11652 caller. Create .symtab_shndx section if needed.
11653 (Layout::create_shdrs): Add shstrtab_section parameter. Change
11655 (Layout::allocated_output_section_count): New function.
11656 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
11658 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
11659 fields. Update declarations.
11660 (Layout::symtab_xindex): New function.
11661 (Layout::dynsym_xindex): New function.
11662 (class Write_symbols_task): Add layout_ field.
11663 (Write_symbols_task::Write_symbols_task): Add layout parameter.
11665 * output.cc (Output_section_headers::Output_section_headers): Add
11666 shstrtab_section parameter. Change all callers.
11667 (Output_section_headers::do_sized_write): Store overflow values
11668 for section count and section string table section index in
11669 section header zero.
11670 (Output_file_header::do_sized_write): Check for overflow of
11671 section count and section string table section index.
11672 (Output_symtab_xindex::do_write): New function.
11673 (Output_symtab_xindex::endian_do_write): New function.
11674 * output.h (class Output_section_headers): Add shstrtab_section_.
11675 Update declarations.
11676 (class Output_symtab_xindex): Define.
11677 (Output_section::has_out_shndx): New function.
11678 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
11680 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
11681 Change all callers.
11682 (Sized_symbol::init): Likewise.
11683 (Symbol::output_section): Check for ordinary symbol.
11684 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
11685 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
11687 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
11688 Change all callers. Simplify handling of symbols from sections
11689 not included in the link.
11690 (Symbol_table::add_from_dynobj): Handle ordinary symbol
11692 (Weak_alias_sorter::operator()): Assert that symbols are
11694 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
11696 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
11697 parameters. Change all callers.
11698 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
11699 symbol distinction. Use SHN_XINDEX when needed.
11700 (Symbol_table::write_section_symbol): Add symtab_xindex
11701 parameter. Change all callers.
11702 (Symbol_table::sized_write_section_symbol): Likewise. Use
11703 SHN_XINDEX when needed.
11704 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
11706 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
11707 (Symbol::is_defined): Check is_ordinary.
11708 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
11709 (Symbol::is_absolute, Symbol::is_common): Likewise.
11710 (class Sized_symbol): Update declarations.
11711 (class Symbol_table): Update declarations.
11712 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
11713 parameters. Change all callers.
11714 (Sized_symbol::override): Likewise.
11715 (Symbol_table::override): Likewise.
11716 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
11717 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
11718 is_ordinary, and orig_st_shndx parameters. Change all callers.
11719 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
11720 to be in an ordinary section.
11721 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
11722 object and is_ordinary parameters. Change all callers.
11723 (Sized_dwarf_line_info::read_relocs): Add object parameter.
11724 Change all callers. Don't add undefined or non-ordinary symbols
11726 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
11727 Change all callers.
11728 * dwarf_reader.h (class Sized_dwarf_line_info): Update
11730 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
11731 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
11732 (Sized_relobj::relocate_sections): Likewise.
11733 * target-reloc.h (scan_relocs): Adjust section symbol index.
11734 (scan_relocatable_relocs): Likewise.
11735 * i386.cc (Scan::local): Check for ordinary symbols.
11736 * sparc.cc (Scan::local): Likewise.
11737 * x86_64.cc (Scan::local): Likewise.
11738 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
11739 to symbol_section_and_value.
11740 * testsuite/many_sections_test.cc: New file.
11741 * testsuite/Makefile.am (BUILT_SOURCES): Define.
11742 (check_PROGRAMS): Add many_sections_test.
11743 (many_sections_test_SOURCES): Define.
11744 (many_sections_test_DEPENDENCIES): Define.
11745 (many_sections_test_LDFLAGS): Define.
11746 (BUILT_SOURCES): Add many_sections_define.h.
11747 (many_sections_define.h): New target.
11748 (BUILT_SOURCES): Add many_sections_check.h.
11749 (many_sections_check.h): New target.
11750 (check_PROGRAMS): Add many_sections_r_test.
11751 (many_sections_r_test_SOURCES): Define.
11752 (many_sections_r_test_DEPENDENCIES): Define.
11753 (many_sections_r_test_LDFLAGS): Define.
11754 (many_sections_r_test_LDADD): Define.
11755 (many_sections_r_test.o): New target.
11756 * testsuite/Makefile.in: Rebuild.
11758 2008-04-17 Cary Coutant <ccoutant@google.com>
11760 * errors.cc (Errors::info): New function.
11761 (gold_info): New function.
11762 * errors.h (Errors::info): New function.
11763 * gold.h (gold_info): New function.
11764 * object.cc (Input_objects::add_object): Print trace output.
11765 * options.cc (options::parse_set): New function.
11766 (General_options::parse_wrap): Deleted.
11767 (General_options::General_options): Deleted initializer.
11768 * options.h (options::String_set): New typedef.
11769 (options::parse_set): New function.
11770 (DEFINE_set): New macro.
11771 (General_options::wrap): Changed to use DEFINE_set. Changed
11772 callers of any_wrap_symbols and is_wrap_symbol.
11773 (General_options::trace, General_options::trace_symbol):
11775 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
11776 (General_options::wrap_symbols_): Deleted.
11777 * symtab.cc (Symbol_table::add_from_object): Print trace output.
11779 2008-04-17 David S. Miller <davem@davemloft.net>
11781 * options.cc (General_options::parse_V): New function.
11782 * options.h: Add entries for -V and -Qy.
11784 2008-04-17 Ian Lance Taylor <iant@google.com>
11786 * common.cc (Symbol_table::allocate_commons): Remove options
11787 parameter. Change caller.
11788 (Symbol_table::do_allocate_commons): Remove options parameter.
11789 Change caller. Just call do_allocate_commons_list twice.
11790 (Symbol_table::do_allocate_commons_list): New function, broken out
11791 of do_allocate_commons.
11792 * common.h (class Allocate_commons_task): Remove options_ field.
11793 Update constructor.
11794 * symtab.cc (Symbol_table::Symbol_table): Initialize
11796 (Symbol_table::add_from_object): Put TLS common symbols on
11798 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
11799 which are IN_OUTPUT_DATA.
11800 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
11801 allocate_commons and do_allocate_commons declarations. Declare
11802 do_allocate_commons_list.
11803 * gold.cc (queue_middle_tasks): Update creation of
11804 Allocate_commons_task to not pass options.
11805 * testsuite/Makefile.am (INCLUDES): Add -I.. .
11806 (TLS_TEST_C_FLAGS): New variable.
11807 (tls_test_c_pic.o): New target.
11808 (tls_test_shared.so): Link in tls_test_c_pic.o.
11809 (tls_test_c_pic_ie.o): New target.
11810 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
11811 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
11812 (tls_test_c.o): New target.
11813 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
11814 (tls_pic_test_LDADD): Likewise.
11815 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
11816 (tls_shared_gd_to_ie_test_LDADD): Likewise.
11817 (tls_test_c_gnu2.o): New target.
11818 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
11820 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
11821 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
11822 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
11823 * testsuite/tls_test.cc: Include "config.h".
11824 (t_last): Call t11_last.
11825 * testsuite/tls_test.h (t11, t11_last): Declare.
11826 * testsuite/tls_test_c.c: New file.
11827 * testsuite/tls_test_main.cc (thread_routine): Call t11.
11828 * configure.ac: Check for OpenMP support.
11829 * configure, config.in, Makefile.in: Rebuild.
11830 * testsuite/Makefile.in: Rebuild.
11832 2008-04-16 Cary Coutant <ccoutant@google.com>
11834 * i386.cc (Target_i386::define_tls_base_symbol): New function.
11835 (Target_i386::tls_base_symbol_defined_): New field.
11836 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11837 (Target_i386::Scan::global): Likewise.
11838 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
11839 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
11840 (Target_x86_64::tls_base_symbol_defined_): New field.
11841 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11842 (Target_x86_64::Scan::global): Likewise.
11844 2008-04-16 Cary Coutant <ccoutant@google.com>
11846 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
11847 (Symbol::needs_plt_entry): Allow weak undefined symbols.
11848 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
11849 building shared libraries.
11850 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
11851 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
11852 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
11853 * testsuite/Makefile.in: Rebuild.
11854 * testsuite/weak_undef.h: New file.
11855 * testsuite/weak_undef_file1.cc: Add extra test cases.
11856 * testsuite/weak_undef_file2.cc: Likewise.
11857 * testsuite/weak_undef_test.cc: Likewise.
11859 2008-04-16 David S. Miller <davem@davemloft.net>
11861 * sparc.cc (Target_sparc::Scan): Change from struct to class.
11862 Add issued_non_pic_error_ field. Declare check_non_pic.
11863 (Target_sparc::Scan::check_non_pic): New function.
11864 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
11865 (Target_sparc::Scan::global): Likewise.
11867 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
11868 * configure: Rebuild.
11870 * options.h (DEFINE_enable): New macro.
11871 (new_dtags): New enable option.
11872 (initfirst, interpose, loadfltr, nodefaultlib,
11873 nodelete, nodlopen, nodump): New -z options.
11874 * layout.cc (Layout:finish_dynamic_section): If new
11875 dtags enabled, emit DT_RUNPATH. Also, emit a
11876 DT_FLAGS_1 containing any specified -z flags.
11878 2008-04-16 Ian Lance Taylor <iant@google.com>
11880 * copy-relocs.cc: New file.
11881 * copy-relocs.h: New file.
11882 * reloc.cc: Remove Copy_relocs code.
11883 * reloc.h: Likewise.
11884 * reloc-types.h (struct Reloc_types) [both versions]: Add
11885 get_reloc_addend_noerror.
11886 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
11887 variants of add_global which take an addend which must be zero.
11888 * i386.cc: Include "copy-relocs.h".
11889 (class Target_i386): Change type of copy_relocs_ to variable,
11890 update initializer.
11891 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
11892 Change all callers.
11893 (Target_i386::do_finalize_sections): Change handling of
11895 * sparc.cc: Include "copy-relocs.h".
11896 (class Target_sparc): Change type of copy_relocs_ to variable,
11897 update initializer.
11898 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
11899 Change all callers.
11900 (Target_sparc::do_finalize_sections): Change handling of
11902 * x86_64.cc: Include "copy-relocs.h".
11903 (class Target_x86_64): Change type of copy_relocs_ to variable,
11904 update initializer.
11905 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
11906 class. Change all callers.
11907 (Target_x86_64::do_finalize_sections): Change handling of
11909 * Makefile.am (CCFILES): Add copy-relocs.cc.
11910 (HFILES): Add copy-relocs.h.
11912 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
11914 * testsuite/script_test_4.sh: Permit leading zeroes.
11916 2008-04-15 Ian Lance Taylor <iant@google.com>
11918 * script-sections.cc (Script_sections::create_segments): Use
11919 header_size_adjustment even when there is enough room for the
11921 * testsuite/script_test_4.sh: New file.
11922 * testsuite/script_test_4.t: New file.
11923 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
11924 (check_DATA): Add script_test_4.stdout.
11925 (MOSTLYCLEANFILES): Likewise.
11926 (script_test_4): New target.
11927 (script_test_4.stdout): New target.
11928 * testsuite/Makefile.in: Rebuild.
11930 * sparc.cc: Add definitions for Output_data_plt_sparc class
11933 2008-04-14 David S. Miller <davem@davemloft.net>
11935 * sparc.cc: New file.
11936 * Makefile.am (TARGETSOURCES): Add sparc.cc
11937 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
11938 * configure.tgt: Document targ_extra_size and
11939 targ_extra_big_endian. Add entries for sparc-* and
11941 * configure.ac: Handle targ_extra_size and
11942 targ_extra_big_endian.
11943 * Makefile.in: Rebuild.
11944 * configure: Likewise.
11945 * po/POTFILES.in: Likewise.
11946 * po/gold.pot: Likewise.
11948 2008-04-14 Ian Lance Taylor <iant@google.com>
11950 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
11951 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
11952 in the name/type/flags to section mapping. Don't call
11953 allocate_output_section.
11954 (Layout::choose_output_section): Change parameter from adjust_name
11955 to is_input_section. Don't permit input sections after sections
11956 are attached to segments. Don't call allocate_output_section.
11957 (Layout::layout_eh_frame): Call update_flags_for_input_section,
11958 not write_enable_output_section.
11959 (Layout::make_output_section): Don't push to
11960 unattached_section_list_ nor call attach_to_segment. Call
11961 attach_section_to_segment if sections are attached.
11962 (Layout::attach_sections_to_segments): New function.
11963 (Layout::attach_section_to_segment): New function.
11964 (Layout::attach_allocated_section_to_segment): Rename from
11965 attach_to_segment. Remove flags parameter.
11966 (Layout::allocate_output_section): Remove function.
11967 (Layout::write_enable_output_section): Remove function.
11968 * layout.h (class Layout): Update for above changes. Add new
11969 field sections_are_attached_.
11970 * output.h (Output_section::update_flags_for_input_section): New
11972 * output.cc (Output_section::add_input_section): Call
11973 update_flags_for_input_section.
11974 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
11976 2008-04-11 Cary Coutant <ccoutant@google.com>
11978 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
11979 thought unnecessary.
11980 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
11982 2008-04-11 Ian Lance Taylor <iant@google.com>
11984 * output.h (class Output_section_data): Remove inline definition
11986 * output.cc (Output_section_data::set_addralign): New function.
11988 2008-04-11 Cary Coutant <ccoutant@google.com>
11990 Add support for TLS descriptors for i386 and x86_64.
11991 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
11992 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
11993 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
11995 (Target_i386::got_mod_index_entry): Remove unnecessary code.
11996 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
11997 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
11999 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
12000 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
12001 Fix problem with initial-exec relocations.
12002 (Target_i386::Relocate::relocate_tls): Likewise.
12003 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
12005 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
12006 support for section-plus-offset dynamic table entries.
12007 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
12008 (Output_data_dynamic::Dynamic_entry): Add support for
12009 section-plus-offset dynamic table entries.
12010 (Output_data_dynamic::Classification): Likewise.
12011 (Output_data_dynamic::classification_): Renamed offset_.
12012 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
12013 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
12014 (Target_x86_64::make_plt_section): New function.
12015 (Target_x86_64::reserve_tlsdesc_entries): New function.
12016 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
12017 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
12018 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
12019 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
12020 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
12021 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
12022 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
12023 add extra PLT entry for TLS descriptors.
12024 (Output_data_plt_x86_64::got_): New field.
12025 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
12026 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
12028 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
12030 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
12031 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
12032 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
12033 R_386_TLS_DESC_CALL relocations.
12034 (Target_x86_64::Scan::global): Likewise.
12035 (Target_x86_64::do_finalize_sections): Add dynamic table entries
12036 for TLS descriptors.
12037 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
12038 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
12039 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
12040 GD-to-IE relaxation.
12041 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
12042 and TLS_DESCRIPTORS.
12043 * Makefile.in: Rebuild.
12044 * configure: Rebuild.
12045 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
12046 (tls_test_shared2.so): New target.
12047 (tls_shared_gd_to_ie_test_SOURCES): New variable.
12048 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
12049 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
12050 (tls_shared_gd_to_ie_test_LDADD): New variable.
12051 (tls_shared_gnu2_gd_to_ie_test): New target.
12052 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
12054 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
12055 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
12056 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
12057 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
12058 (tls_shared_gnu2_test): New target.
12059 (tls_test_gnu2_shared.so): New target.
12060 (tls_shared_gnu2_test_SOURCES): New variable.
12061 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
12062 (tls_shared_gnu2_test_LDFLAGS): New variable.
12063 (tls_shared_gnu2_test_LDADD): New variable.
12064 * testsuite/Makefile.in: Rebuild.
12065 * testsuite/Makefile.
12067 2008-04-11 Ian Lance Taylor <iant@google.com>
12069 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
12071 * testsuite/Makefile.in: Rebuild.
12073 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
12075 * testsuite/script_test_2.cc (main): Adjust test.
12077 2008-04-11 David S. Miller <davem@davemloft.net>
12078 Ian Lance Taylor <iant@google.com>
12080 * options.h (General_options): Add entries for '-Y' and
12082 * options.cc (General_options:finalize): If -Y was used, add those
12083 entries to the library path instead of the default "/lib" and
12086 2008-04-11 David S. Miller <davem@davemloft.net>
12088 * testsuite/justsyms.t: Start at 0x100.
12089 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
12090 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
12092 * testsuite/script_test_2.cc: Adjust string and section length
12095 2008-04-09 Ian Lance Taylor <iant@google.com>
12098 * script-sections.cc (Sections_element::allocate_to_segment): Add
12100 (Output_section_definition::allocate_to_segment): Likewise.
12101 (Orphan_output_section::allocate_to_segment): Likewise.
12102 (Script_sections::attach_sections_using_phdrs_clause): Don't
12103 propagate non-PT_LOAD segments to orphan sections.
12104 * testsuite/Makefile.am (script_test_3.stdout): Generate using
12105 readelf rather than objdump.
12106 * testsuite/script_test_3.sh: Adjust accordingly. Test that
12107 .interp section and PT_INTERP segment are the same size.
12108 * testsuite/Makefile.in: Rebuild.
12110 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
12111 aliases for symbols defined in the same object.
12112 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
12113 (weak_alias_test_SOURCES): New variable.
12114 (weak_alias_test_DEPENDENCIES): New variable.
12115 (weak_alias_test_LDFLAGS): New variable.
12116 (weak_alias_test_LDADD): New variable.
12117 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
12118 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
12119 (weak_alias_test_3.o): New target.
12120 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
12121 * testsuite/weak_alias_test_main.cc: New file.
12122 * testsuite/weak_alias_test_1.cc: New file.
12123 * testsuite/weak_alias_test_2.cc: New file.
12124 * testsuite/weak_alias_test_3.cc: New file.
12126 2008-04-08 Ian Lance Taylor <iant@google.com>
12128 * options.h (class General_options): Add --noinhibit-exec option.
12129 * main.cc (main): Check --noinhibit-exec.
12131 * options.h (class General_options): Define --wrap as a special
12132 option. Add wrap_symbols_ field.
12133 (General_options::any_wrap_symbols): New function.
12134 (General_options::is_wrap_symbol): New function.
12135 * options.cc (General_options::parse_wrap): New function.
12136 (General_options::General_options): Initialize wrap_symbols_.
12137 * symtab.cc (Symbol_table::wrap_symbol): New function.
12138 (Symbol_table::add_from_object): Handle --wrap.
12139 * symtab.h (class Symbol_table): Declare wrap_symbol.
12140 * target.h (Target::wrap_char): New function.
12141 (Target::Target_info): Add wrap_char field.
12142 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
12143 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12144 * testsuite/testfile.cc (Target_test::test_target_info):
12147 * errors.cc (Errors::undefined_symbol): Mention symbol version if
12150 * layout.h (class Layout): Add added_eh_frame_data_ field.
12151 * layout.cc (Layout::Layout): Initialize new field.
12152 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
12153 output section until we find a section we merged successfully.
12154 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
12155 that the size be non-zero.
12157 * merge.cc (Object_merge_map::get_output_offset): Remove inline
12160 2008-04-08 Craig Silverstein <csilvers@google.com>
12162 * configure.ac: Export new conditional variable HAVE_ZLIB.
12163 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
12165 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
12166 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12168 2008-04-07 Ian Lance Taylor <iant@google.com>
12170 * version.cc (version_string): Set to "1.5".
12172 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
12173 Add issued_non_pic_error_ field. Declare check_non_pic.
12174 (Target_x86_64::Scan::check_non_pic): New function.
12175 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
12176 (Target_x86_64::Scan::global): Likewise.
12178 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
12179 addend parameter. Change caller. Handle merge sections.
12180 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
12181 Address to Addend. Don't add in the result of
12182 local_section_offset, pass down the addend and use the returned
12184 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
12185 Update declarations of local_section_offset and symbol_value.
12186 * testsuite/two_file_test_1.cc (t18): New function.
12187 * testsuite/two_file_test_2.cc (f18): New function.
12188 * testsuite/two_file_test_main.cc (main): Call t18.
12189 * testsuite/two_file_test.h (t18, f18): Declare.
12191 * configure.ac: Don't test for objdump, c++filt, or readelf.
12192 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
12194 (TEST_READELF): New variable.
12195 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
12196 (check_PROGRAMS): Add two_file_strip_test.
12197 (two_file_strip_test): New target.
12198 (check_PROGRAMS): Add two_file_same_shared_strip_test.
12199 (two_file_same_shared_strip_test_SOURCES): New variable.
12200 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
12201 (two_file_same_shared_strip_test_LDFLAGS): New variable.
12202 (two_file_same_shared_strip_test_LDADD): New variable.
12203 (two_file_shared_strip.so): New target.
12204 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
12205 (ver_test_5.syms, ver_test_7.syms): Likewise.
12206 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
12207 (strip_test_3.stdout): Use TEST_OBJDUMP.
12208 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12210 2008-04-04 Cary Coutant <ccoutant@google.com>
12212 * symtab.h (Symbol::is_weak_undefined): New function.
12213 (Symbol::is_strong_undefined): New function.
12214 (Symbol::is_absolute): New function.
12215 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
12216 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
12218 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
12219 (weak_undef_test): New target.
12220 * testsuite/Makefile.in: Rebuild.
12221 * testsuite/weak_undef_file1.cc: New file.
12222 * testsuite/weak_undef_file2.cc: New file.
12223 * testsuite/weak_undef_test.cc: New file.
12225 2008-04-03 Craig Silverstein <csilvers@google.com>
12227 * compressed_output.h (class Output_compressed_section): Use
12229 * compressed_output.cc (zlib_compress): Use unsigned buffers,
12231 (zlib_compressed_suffix): Removed.
12232 (Output_compressed_section::set_final_data_size): Use unsigned
12234 * testsuite/Makefile.am (flagstest_compress_debug_sections):
12235 Fix linker invocation.
12236 (flagstest_o_specialfile_and_compress_debug_sections):
12238 * testsuite/Makefile.in: Regenerated.
12240 2008-04-02 David S. Miller <davem@davemloft.net>
12242 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
12243 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
12245 2008-04-02 Craig Silverstein <csilvers@google.com>
12249 2008-04-02 Ian Lance Taylor <iant@google.com>
12251 * fileread.cc (File_read::find_view): Add byteshift and vshifted
12252 parameters. Update for new key type to views_. Change all
12254 (File_read::read): Adjust for byteshift in returned view.
12255 (File_read::add_view): New function, broken out of
12256 find_and_make_view.
12257 (File_read::make_view): New function, broken out of
12258 find_and_make_view.
12259 (File_read::find_or_make_view): Add offset and aligned
12260 parameters. Rewrite accordingly. Change all callers.
12261 (File_read::get_view): Add offset and aligned parameters. Adjust
12262 for byteshift in return value.
12263 (File_read::get_lasting_view): Likewise.
12264 * fileread.h (class File_read): Update declarations.
12265 (class File_read::View): Add byteshift_ field. Add byteshift to
12266 constructor. Add byteshift method.
12267 * archive.h (Archive::clear_uncached_views): New function.
12268 (Archive::get_view): Add aligned parameter. Change all callers.
12269 * object.h (Object::get_view): Add aligned parameter. Change all
12271 (Object::get_lasting_view): Likewise.
12273 * fileread.cc (File_read::release): Don't call clear_views if
12274 there are multiple objects.
12275 * fileread.h (File_read::clear_uncached_views): New function.
12276 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
12279 2008-03-31 Cary Coutant <ccoutant@google.com>
12281 Add thin archive support.
12282 * archive.cc (Archive::armagt): New const.
12283 (Archive::setup): Remove task parameter and calls to unlock.
12284 (Archive::unlock_nested_archives): New function.
12285 (Archive::read_header): Add nested_off parameter. Change
12287 (Archive::interpret_header): Likewise.
12288 (Archive::include_all_members): Change to handle thin
12290 (Archive::include_member): Likewise.
12291 * archive.h (Archive::Archive): Add new parameters and
12293 (Archive::armagt): New const.
12294 (Archive::setup): Remove task parameter.
12295 (Archive::unlock_nested_archives): New function.
12296 (Archive::read_header): Add nested_off parameter.
12297 (Archive::interpret_header): Likewise.
12298 (Archive::Nested_archive_table): New typedef.
12299 (Archive::is_thin_archive_): New field.
12300 (Archive::nested_archives_): New field.
12301 (Archive::options_): New field.
12302 (Archive::dirpath_): New field.
12303 (Archive::task_): New field.
12304 * readsyms.cc (Read_symbols::do_read_symbols): Add check
12305 for thin archives. Pass additional parameters to
12306 Archive::Archive. Unlock the archive file after calling
12309 2008-03-29 Ian Lance Taylor <iant@google.com>
12311 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12312 version symbol to be local.
12313 * testsuite/ver_test_4.sh: New file.
12314 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12315 (check_DATA): Add ver_test_4.syms.
12316 (ver_test_4.syms): New target.
12317 * testsuite/Makefile.in: Rebuild.
12320 (Output_section::Input_section_sort_entry::has_priority): New
12322 (Output_section::Input_section_sort_entry::match_file_name): New
12324 (Output_section::Input_section_sort_entry::match_section_name):
12326 (Output_section::Input_section_sort_entry::match_section_name_prefix):
12328 (Output_section::Input_section_sort_entry::match_section_file):
12330 (Output_section::Input_section_sort_compare::operator()): Rewrite
12331 using new Input_section_sort_entry functions. Sort crtbegin and
12332 crtend first. Sort sections with no priority before sections with
12334 * testsuite/initpri1.c (d3): Check j != 4.
12335 (cd5): New constructor/destructor function.
12336 (main): Check j != 2.
12338 * symtab.cc (Symbol_table::add_from_object): If we don't use the
12339 new symbol when resolving, don't call set_is_default.
12340 * testsuite/ver_test_7.cc: New file.
12341 * testsuite/ver_test_7.sh: New file.
12342 * testsuite/Makefile.am (ver_test_7.so): New target.
12343 (ver_test_7.o): New target.
12344 (check_SCRIPTS): Add ver_test_7.sh.
12345 (check_DATA): Add ver_test_7.syms.
12346 (ver_test_7.syms): New target.
12348 2008-03-28 Ian Lance Taylor <iant@google.com>
12350 * layout.cc (Layout::layout): If we see an input section with a
12351 name that needs sorting, set the must_sort flag for the output
12353 (Layout::make_output_section): If the name of the output section
12354 indicates that it might require sorting, set the may_sort flag.
12355 * output.h (Output_section::may_sort_attached_input_sections): New
12357 (Output_section::set_may_sort_attached_input_sections): New
12359 (Output_section::must_sort_attached_input_sections): New
12361 (Output_section::set_must_sort_attached_input_sections): New
12363 (class Output_section): Declare Input_section_sort_entry. Define
12364 Input_section_sort_compare. Declare
12365 sort_attached_input_sections. Add new fields:
12366 may_sort_attached_input_sections_,
12367 must_sort_attached_input_sections_,
12368 attached_input_sections_are_sorted_.
12369 * output.cc (Output_section::Output_section): Initialize new
12371 (Output_section::add_input_section): Add an entry to
12372 input_sections_ if may_sort or must_sort are true.
12373 (Output_section::set_final_data_size): Call
12374 sort_attached_input_sections if necessary.
12375 (Output_section::Input_section_sort_entry): Define new class.
12376 (Output_section::Input_section_sort_compare::operator()): New
12378 (Output_section::sort_attached_input_sections): New function.
12379 * configure.ac: Check whether the compiler supports constructor
12380 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
12381 * testsuite/initpri1.c: New file.
12382 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
12383 CONSTRUCTOR_PRIORITY.
12384 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
12385 (initpri1_LDFLAGS): New variable.
12386 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12388 2008-03-27 Ian Lance Taylor <iant@google.com>
12390 * common.cc (Sort_commons::operator): Correct sorting algorithm.
12391 * testsuite/common_test_1.c: New file.
12392 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
12393 (common_test_1_SOURCES): New variable.
12394 (common_test_1_DEPENDENCIES): New variable.
12395 (common_test_1_LDFLAGS): New variable.
12397 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
12398 and commons_ correctly when NAME/VERSION does not override
12400 * testsuite/ver_test_6.c: New file.
12401 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
12402 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
12403 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
12405 2008-03-26 Ian Lance Taylor <iant@google.com>
12407 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
12408 of an undefined symbol from a version script.
12409 * testsuite/Makefile.am (ver_test_5.so): New target.
12410 (ver_test_5.o): New target.
12411 (check_SCRIPTS): Add ver_test_5.sh.
12412 (check_DATA): Add ver_test_5.syms.
12413 (ver_test_5.syms): New target.
12414 * testsuite/ver_test_5.cc: New file.
12415 * testsuite/ver_test_5.script: New file.
12416 * testsuite/ver_test_5.sh: New file.
12417 * Makefile.in, testsuite/Makefile.in: Rebuild.
12420 Fix problems building gold with gcc 4.3.0.
12421 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
12422 (gold_error_at_location, gold_warning_at_location): Use it.
12423 * configure.ac: Check whether we can compile and use a template
12424 function with a printf attribute.
12425 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
12426 when jumping over bytes.
12427 * object.cc: Instantiate Object::read_section_data.
12428 * debug.h: Include <cstring>
12429 * dwarf_reader.cc: Include <algorithm>
12430 * main.cc: Include <cstring>.
12431 * options.cc: Include <cstring>.
12432 * output.cc: Include <cstring>.
12433 * script.cc: Include <cstring>.
12434 * script.h: Include <string>.
12435 * symtab.cc: Include <cstring> and <algorithm>.
12436 * target-select.cc: Include <cstring>.
12437 * version.cc: Include <string>.
12438 * testsuite/testmain.cc: Include <cstdlib>.
12439 * configure, config.in: Rebuild.
12441 2008-03-25 Ian Lance Taylor <iant@google.com>
12443 * options.cc: Include "../bfd/bfdver.h".
12444 (options::help): Print bug reporting address.
12446 * version.cc (print_version): Adjust output for current value of
12447 BFD_VERSION_STRING.
12451 * options.cc (options::help): Print list of supported targets.
12452 * target-select.h: Include <vector>.
12453 (class Target_selector): Make machine_, size_, and is_big_endian_
12454 fields const. Add bfd_name_ and instantiated_target_ fields.
12455 (Target_selector::Target_selector): Add bfd_name parameter.
12456 (Target_selector::recognize): Make non-virtual, call
12458 (Target_selector::recognize_by_name): Make non-virtual, call
12459 do_recognize_by_name.
12460 (Target_selector::supported_names): New function.
12461 (Target_selector::bfd_name): New function.
12462 (Target_selector::do_instantiate_target): New pure virtual
12464 (Target_selector::do_recognize): New virtual function.
12465 (Target_selector::do_recognize_by_name): New virtual function.
12466 (Target_selector::instantiate_target): New private function.
12467 (supported_target_names): Declare.
12468 * target-select.cc (Target_selector::Target_selector): Update for
12469 new parameter and fields.
12470 (select_target_by_name): Check that the name matches before
12471 calling recognize_by_name.
12472 (supported_target_names): New function.
12473 * i386.cc (class Target_selector_i386): Update Target_selector
12474 constructor call. Remove recognize and recognize_by_name. Add
12475 do_instantiate_target.
12476 * x86_64.cc (class Target_selector_x86_64): Likewise.
12477 * testsuite/testfile.cc (class Target_selector_test): Update for
12478 changes to Target_selector.
12480 * README: Rewrite, with some notes on unsupported features.
12482 2008-03-24 Cary Coutant <ccoutant@google.com>
12484 * i386.cc (Target_i386::Got_type): New enum declaration.
12485 (Target_i386::Scan::local): Updated callers of Output_data_got
12487 (Target_i386::Scan::global): Likewise.
12488 (Target_i386::Relocate::relocate): Likewise.
12489 (Target_i386::Relocate::relocate_tls): Likewise.
12490 * object.h (Got_offset_list): New class.
12491 (Sized_relobj::local_has_got_offset): Added got_type parameter.
12492 (Sized_relobj::local_got_offset): Likewise.
12493 (Sized_relobj::set_local_got_offset): Likewise.
12494 (Sized_relobj::local_has_tls_got_offset): Removed.
12495 (Sized_relobj::local_tls_got_offset): Removed.
12496 (Sized_relobj::set_local_tls_got_offset): Removed.
12497 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
12498 * output.cc (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 * output.h (Output_data_got::add_global): Added got_type parameter.
12515 (Output_data_got::add_global_with_rel): Likewise.
12516 (Output_data_got::add_global_with_rela): Likewise.
12517 (Output_data_got::add_global_pair_with_rel): New function.
12518 (Output_data_got::add_global_pair_with_rela): New function.
12519 (Output_data_got::add_local): Added got_type parameter.
12520 (Output_data_got::add_local_with_rel): Likewise.
12521 (Output_data_got::add_local_with_rela): Likewise.
12522 (Output_data_got::add_local_pair_with_rel): New function.
12523 (Output_data_got::add_local_pair_with_rela): New function.
12524 (Output_data_got::add_global_tls): Removed.
12525 (Output_data_got::add_global_tls_with_rel): Removed.
12526 (Output_data_got::add_global_tls_with_rela): Removed.
12527 (Output_data_got::add_local_tls): Removed.
12528 (Output_data_got::add_local_tls_with_rel): Removed.
12529 (Output_data_got::add_local_tls_with_rela): Removed.
12530 * resolve.cc (Symbol::override_base_with_special): Removed
12531 reference to has_got_offset_ field.
12532 * symtab.cc (Symbol::init_fields): Replaced initialization
12533 of got_offset_ with got_offsets_. Removed initialization
12535 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
12536 (Symbol::got_offset): Likewise.
12537 (Symbol::set_got_offset): Likewise.
12538 (Symbol::has_tls_got_offset): Removed.
12539 (Symbol::tls_got_offset): Removed.
12540 (Symbol::set_tls_got_offset): Removed.
12541 (Symbol::got_offset_): Removed.
12542 (Symbol::tls_mod_got_offset_): Removed.
12543 (Symbol::tls_pair_got_offset_): Removed.
12544 (Symbol::got_offsets_): New field.
12545 (Symbol::has_got_offset): Removed.
12546 (Symbol::has_tls_mod_got_offset): Removed.
12547 (Symbol::has_tls_pair_got_offset): Removed.
12548 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
12549 (Target_x86_64::Scan::local): Updated callers of Output_data_got
12551 (Target_x86_64::Scan::global): Likewise.
12552 (Target_x86_64::Relocate::relocate): Likewise.
12553 (Target_x86_64::Relocate::relocate_tls): Likewise.
12555 2008-03-25 Ben Elliston <bje@au.ibm.com>
12557 * yyscript.y: Fix spelling error in comment.
12559 2008-03-24 Ian Lance Taylor <iant@google.com>
12561 * options.h (class General_options): Define build_id option.
12562 * layout.h (class Layout): Declare write_build_id, create_note,
12563 create_build_id. Add build_id_note_ member.
12564 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
12565 "libiberty.h", "md5.h", "sha1.h".
12566 (Layout::Layout): Initialize eh_frame_data_,
12567 eh_frame_hdr_section_, and build_id_note_.
12568 (Layout::finalize): Call create_build_id.
12569 (Layout::create_note): New function, broken out of
12570 Layout::create_gold_note.
12571 (Layout::create_gold_note): Call create_note.
12572 (Layout::create_build_id): New function.
12573 (Layout::write_build_id): New function.
12574 (Close_task_runner::run): Call write_build_id.
12576 * x86_64.cc: Correct license to GPLv3.
12578 2008-03-23 Ian Lance Taylor <iant@google.com>
12580 * options.cc: Include "demangle.h".
12581 (parse_optional_string): New function.
12582 (parse_long_option): Handle takes_optional_argument.
12583 (parse_short_option): Update dash_z initializer. Handle
12584 takes_optional_argument.
12585 (General_options::General_options): Initialize do_demangle_.
12586 (General_options::finalize): Set do_demangle_. Handle demangling
12588 * options.h (parse_optional_string): Declare.
12589 (struct One_option): Add optional_arg field. Update constructor.
12590 Update call constructor calls. Add takes_optional_argument
12592 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
12593 (DEFINE_optional_string): Define.
12594 (General_options::demangle): Change from DEFINE_bool to
12595 DEFINE_optional_string.
12596 (General_options::no_demangle): New function.
12597 (General_options::do_demangle): New function.
12598 (General_options::set_do_demangle): New function.
12599 (General_options::execstack_status_): Move definition to end of
12601 (General_options::static_): Likewise.
12602 (General_options::do_demangle_): New field.
12603 * object.cc (big_endian>::get_symbol_location_info): Call
12604 Options::do_demangle, not Options::demangle.
12605 * symtab.cc (demangle): Likewise.
12607 2008-03-22 Ian Lance Taylor <iant@google.com>
12609 * gold.h: Include <cstddef> and <sys/types.h>
12610 * options.h: Include <cstring>.
12612 2008-03-21 Ian Lance Taylor <iant@google.com>
12614 * Added source code to GNU binutils.