1 2012-04-16 David S. Miller <davem@davemloft.net>
3 * sparc.cc (Target_sparc::got_address): New function.
4 (Sparc_relocate_functions::gdop_hix22): New function.
5 (Sparc_relocate_functions::gdop_lox10): New function.
6 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
8 (Target_sparc::Scan::local): Likewise if the global symbol is not
9 preemptible and is not IFUNC.
10 (Target_sparc::Relocate::relocate): Perform GOTDATA code
11 transformations for local and non-preemptible non-IFUNC global
14 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
15 writing out 64-bit part of ranges.
17 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
18 -fpic and -fpie respectively.
19 * Makefile.in: Regenerate.
21 * sparc.cc (class Target_sparc): Add rela_ifunc_.
22 (Target_sparc::Target_sparc): Initialize new field.
23 (Target_sparc::do_plt_section_for_global): New function.
24 (Target_sparc::do_plt_section_for_local): New function.
25 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
26 (Target_sparc::make_plt_section): New function, broken out of
27 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
28 (Target_sparc::make_plt_entry): Call make_plt_section.
29 (Target_sparc::make_local_ifunc_plt_entry): New function.
30 (Target_sparc::rela_ifunc_section): New function.
31 (Target_sparc::plt_section): Remove const.
32 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
33 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
34 and ifunc_count_ fields.
35 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
36 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
37 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
38 (Output_data_plt_sparc::rela_ifunc): New function.
39 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
40 (Output_data_plt_sparc::has_ifunc_section): New function.
41 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
42 (Output_data_plt_sparc::address_for_global): New function.
43 (Output_data_plt_sparc::address_for_local): New function.
44 (Output_data_plt_sparc::plt_index_to_offset): New function.
45 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
47 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
49 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
50 R_SPARC_JMP_IREL to switch.
51 (Target_sparc::Scan::check_non_pic): Likewise.
52 (Target_sparc::Scan::local): Handle IFUNC symbols.
53 (Target_sparc::Scan::local): Likewise.
54 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
55 and plt_address_for_local.
56 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
57 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
59 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
60 (class Output_data_reloc): Adjust calls to Output_reloc_type.
61 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
62 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
64 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
65 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
67 * sparc.cc (Target_sparc::Scan::global): Likewise.
68 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
70 2012-04-16 Cary Coutant <ccoutant@google.com>
72 * archive.cc (Library_base::should_include_member): Check for
73 --export-dynamic-symbol.
74 * options.h (class General_options): Add --export-dynamic-symbol.
75 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
76 --export-dynamic-symbol.
77 (Symbol_table::gc_mark_undef_symbols): Likewise.
78 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
80 2012-04-12 David S. Miller <davem@davemloft.net>
82 * sparc.cc (Reloc::wdisp10): New relocation method.
83 (Reloc::h34): Likewise.
84 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
85 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
87 (Target_sparc::Scan::local): Likewise.
88 (Target_sparc::Scan::global): Likewise.
89 (Target_sparc::Relocate::relocate): Likewise.
91 2012-04-09 Cary Coutant <ccoutant@google.com>
93 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
96 2012-04-06 Ian Lance Taylor <iant@google.com>
98 * timer.cc: #include <unistd.h>.
100 2012-04-06 Roland McGrath <mcgrathr@google.com>
102 * configure.in (AC_CHECK_HEADERS): Add locale.h.
103 * config.in: Regenerate.
104 * configure: Regenerate.
106 2012-04-05 Nick Clifton <nickc@redhat.com>
108 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
109 (AM_LC_MESSAGES): Add.
110 * aclocal.m4: Regenerate.
111 * config.in: Regenerate.
112 * configure: Regenerate.
114 2012-03-21 Cary Coutant <ccoutant@google.com>
116 * Makefile.am: Add gdb-index.cc, gdb-index.h.
117 * Makefile.in: Regenerate.
118 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
119 (Sized_elf_reloc_mapper::symbol_section): New function.
120 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
121 (make_elf_reloc_mapper): New function.
122 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
123 (Dwarf_abbrev_table::do_read_abbrevs): New function.
124 (Dwarf_abbrev_table::do_get_abbrev): New function.
125 (Dwarf_ranges_table::read_ranges_table): New function.
126 (Dwarf_ranges_table::read_range_list): New function.
127 (Dwarf_pubnames_table::read_section): New function.
128 (Dwarf_pubnames_table::read_header): New function.
129 (Dwarf_pubnames_table::next_name): New function.
130 (Dwarf_die::Dwarf_die): New function.
131 (Dwarf_die::read_attributes): New function.
132 (Dwarf_die::skip_attributes): New function.
133 (Dwarf_die::set_name): New function.
134 (Dwarf_die::set_linkage_name): New function.
135 (Dwarf_die::attribute): New function.
136 (Dwarf_die::string_attribute): New function.
137 (Dwarf_die::int_attribute): New function.
138 (Dwarf_die::uint_attribute): New function.
139 (Dwarf_die::ref_attribute): New function.
140 (Dwarf_die::child_offset): New function.
141 (Dwarf_die::sibling_offset): New function.
142 (Dwarf_info_reader::check_buffer): New function.
143 (Dwarf_info_reader::parse): New function.
144 (Dwarf_info_reader::do_parse): New function.
145 (Dwarf_info_reader::do_read_string_table): New function.
146 (Dwarf_info_reader::lookup_reloc): New function.
147 (Dwarf_info_reader::get_string): New function.
148 (Dwarf_info_reader::visit_compilation_unit): New function.
149 (Dwarf_info_reader::visit_type_unit): New function.
150 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
151 Sized_elf_reloc_mapper.
152 (Sized_dwarf_line_info::symbol_section): Remove function.
153 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
154 (Sized_dwarf_line_info::read_line_mappings): Remove object
155 parameter, adjust callers.
156 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
157 * dwarf_reader.h: Include <sys/types.h>.
158 (class Track_relocs): Remove forward declaration.
159 (class Elf_reloc_mapper): New class.
160 (class Sized_elf_reloc_mapper): New class.
161 (class Dwarf_abbrev_table): New class.
162 (class Dwarf_range_list): New class.
163 (class Dwarf_ranges_table): New class.
164 (class Dwarf_pubnames_table): New class.
165 (class Dwarf_die): New class.
166 (class Dwarf_info_reader): New class.
167 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
168 (Sized_dwarf_line_info::symbol_section): Remove member function.
169 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
171 * gdb-index.cc: New source file.
172 * gdb-index.h: New source file.
173 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
174 and .debug_types sections, call Layout::add_to_gdb_index.
175 (Sized_relobj_incr::do_section_name): Implement.
176 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
177 return type; Implement.
178 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
180 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
181 parameter list and return type.
182 (Sized_incr_dynobj::do_section_contents): Likewise.
183 * layout.cc: Include gdb-index.h.
184 (Layout::Layout): Initialize gdb_index_data_.
185 (Layout::init_fixed_output_section): Check for .gdb_index section.
186 (Layout::add_to_gdb_index): New function. Instantiate.
187 * layout.h: Add forward declaration for class Gdb_index.
188 (Layout::add_to_gdb_index): New member function.
189 (Layout::gdb_index_data_): New data member.
190 * main.cc: Include gdb-index.h.
191 (main): Print statistics for gdb index.
192 * object.cc (Object::section_contents): Move code into
194 (need_decompressed_section): Check for sections needed when building
196 (build_compressed_section_map): Likewise.
197 (Sized_relobj_file::do_read_symbols): Need local symbols when building
199 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
200 sections; call Layout::add_to_gdb_index.
201 (Sized_relobj_file::do_decompressed_section_contents): Call
202 do_section_contents directly.
203 * object.h (Object::do_section_contents): Adjust parameter list and
205 (Object::do_decompressed_section_contents): Call do_section_contents
207 (Sized_relobj_file::do_section_contents): Adjust parameter list and
209 * options.h (class General_options): Add --gdb-index option.
210 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
211 list and return type.
212 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
213 * reloc.h (Track_relocs::checkpoint): New function.
214 (Track_relocs::reset): New function.
216 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
218 * testsuite/Makefile.in: Regenerate.
219 * testsuite/gdb_index_test.cc: New test source file.
220 * testsuite/gdb_index_test_1.sh: New test source file.
221 * testsuite/gdb_index_test_2.sh: New test source file.
223 2012-03-19 Doug Kwan <dougkwan@google.com>
225 * arm.cc (Target_arm::do_define_standard_symbols): New method.
226 (Target_arm::do_finalize_sections): Remove code which defines
227 __exidx_start and __exidx_end. Make symbol table parameter
228 anonymous as it is not used.
229 * gold.cc (queue_middle_tasks): Call target hook to define any
230 target-specific symbols.
231 * target.h (Target::define_standard_symbols): New method.
232 (Target::do_define_standard_symbols): Same.
233 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
234 * testsuite/Makefile.in: Regenerate.
235 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
237 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
238 relocations are generated for __exidx_start and __exidx_end.
240 2012-03-16 Doug Kwan <dougkwan@google.com>
242 * testsuite/Makefile.am: Disable test initpri3b.
243 * testsuite/Makefile.in: Regenerate.
245 2012-03-15 Doug Kwan <dougkwan@google.com>
247 * arm.cc (Target_arm::got_section): Make .got section read-only
250 2012-03-15 Ian Lance Taylor <iant@google.com>
253 * layout.cc (Layout::make_output_section): Correctly mark
254 SHT_INIT_ARRAY, et. al., as relro.
256 2012-03-14 Doug Kwan <dougkwan@google.com>
258 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
259 dynamic relocations for protected symbols in shared objects.
261 2012-03-13 Ian Lance Taylor <iant@google.com>
263 * resolve.cc (Symbol_table::resolve): When merging common symbols,
264 keep the larger alignment.
266 2012-03-12 Cary Coutant <ccoutant@google.com>
268 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
269 handling of DW_LNE_define_file.
271 2012-03-12 Cary Coutant <ccoutant@google.com>
273 * reduced_debug_output.cc
274 (Output_reduced_debug_info_section::get_die_end): Add new FORM
277 2012-02-29 Cary Coutant <ccoutant@google.com>
279 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
281 2012-02-29 Cary Coutant <ccoutant@google.com>
283 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
284 Call Object::decompressed_section_contents.
285 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
287 (Sized_dwarf_line_info::buffer_start_): New data member.
288 * merge.cc (Output_merge_data::do_add_input_section): Call
289 Object::decompressed_section_contents.
290 (Output_merge_string::do_add_input_section): Likewise.
291 * object.cc (need_decompressed_section): New function.
292 (build_compressed_section_map): Decompress sections needed later.
293 (Sized_relobj_file::do_decompressed_section_contents): New function.
294 (Sized_relobj_file::do_discard_decompressed_sections): New function.
295 * object.h (Object::decompressed_section_contents): New function.
296 (Object::discard_decompressed_sections): New function.
297 (Object::do_decompressed_section_contents): New function.
298 (Object::do_discard_decompressed_sections): New function.
299 (Compressed_section_info): New type.
300 (Compressed_section_map): Include decompressed section contents.
301 (Sized_relobj_file::do_decompressed_section_contents): New function.
302 (Sized_relobj_file::do_discard_decompressed_sections): New function.
304 2012-02-16 Cary Coutant <ccoutant@google.com>
306 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
307 * testsuite/Makefile.in: Regenerate.
309 2012-02-14 Cary Coutant <ccoutant@google.com>
311 * options.cc (General_options::finalize): Disallow -pie and -static.
313 2012-02-03 Doug Kwan <dougkwan@google.com>
315 * arm.cc (Arm_relocate_functions::abs8,
316 Arm_relocate_functions::abs16): Use
317 Bits::has_signed_unsigned_overflow32.
318 (Arm_relocate_functions::thm_abs8): Correct range of
320 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
323 2012-02-02 Doug Kwan <dougkwan@google.com>
325 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
326 position independent outputs, not just shared objects.
328 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
330 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
331 * configure: Regenerated.
333 2012-01-27 Ian Lance Taylor <iant@google.com>
335 * reloc.h (Bits): New class with static functions, copied from
336 namespace utils in arm.cc.
337 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
340 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
342 * incremental.cc (write_info_blocks): Correct relocation offset.
344 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
346 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
347 (Relocate::tls_gd_to_le): Likewise.
349 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
351 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
353 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
355 * configure.ac: Check if -mcmodel=medium works.
356 * configure: Regenerated.
358 2012-01-24 Cary Coutant <ccoutant@google.com>
360 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
362 (read_unsigned_LEB_128_x): ... this new function.
363 (read_signed_LEB_128): Replaced with inline definition and ...
364 (read_signed_LEB_128_x): ... this new function.
365 * int_encoding.h (read_unsigned_LEB_128_x): New function.
366 (read_unsigned_LEB_128): Add inline definition.
367 (read_signed_LEB_128_x): New function.
368 (read_signed_LEB_128): Add inline definition.
369 * testsuite/Makefile.am (leb128_unittest): New unit test.
370 * testsuite/Makefile.in: Regenerate.
371 * testsuite/leb128_unittest.cc: New unit test.
373 2012-01-23 Ian Lance Taylor <iant@google.com>
376 * i386.cc (Target_i386::do_code_fill): When using a jmp
377 instruction, pad with nop instructions.
378 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
380 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
382 * x86_64.cc (gc_process_relocs): Add typename on types used in
384 (scan_relocs): Likewise.
385 (relocate_section): Likewise.
386 (apply_relocation): Likewise.
388 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
390 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
391 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
394 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
396 * x86_64.cc: Initial support for x32.
398 2012-01-03 Cary Coutant <ccoutant@google.com>
400 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
401 Use abstract base class for GOT.
402 * gold/output.h (class Output_data_got_base): New abstract base class.
403 (class Output_data_got): Derive from new base class, adjust ctors.
404 (Output_data_got::reserve_slot): Make virtual; rename to
405 do_reserve_slot; Adjust callers.
406 * gold/target.h (Sized_target::init_got_plt_for_update): Return
407 pointer to abstract base class.
408 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
410 2011-12-18 Ian Lance Taylor <iant@google.com>
412 * object.h (Relobj::local_symbol_value): New function.
413 (Relobj::local_plt_offset): New function.
414 (Relobj::local_has_got_offset): New function.
415 (Relobj::local_got_offset): New function.
416 (Relobj::set_local_got_offset): New function.
417 (Relobj::do_local_symbol_value): New pure virtual function.
418 (Relobj::do_local_plt_offset): Likewise.
419 (Relobj::do_local_has_got_offset): Likewise.
420 (Relobj::do_local_got_offset): Likewise.
421 (Relobj::do_set_local_got_offset): Likewise.
422 (Sized_relobj::do_local_has_got_offset): Rename from
423 local_has_got_offset.
424 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
425 (Sized_relobj::do_set_local_got_offset): Rename from
426 set_local_got_offset.
427 (Sized_relobj_file::do_local_plt_offset): Rename from
429 (Sized_relobj_file::do_local_symbol_value): New function.
430 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
432 * output.cc (Output_data_got::Got_entry::write): Change object to
433 Relobj. Use local_symbol_value.
434 (Output_data_got::add_global_with_rel): Change rel_dyn to
435 Output_data_reloc_generic*. Use add_global_generic.
436 (Output_data_got::add_global_with_rela): Remove. Change all
437 callers to use add_global_with_rel.
438 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
439 Output_data_reloc_generic*. Use add_global_generic.
440 (Output_data_got::add_global_pair_with_rela): Remove. Change all
441 callers to use add_global_pair_with_rel.
442 (Output_data_got::add_local): Change object to Relobj*.
443 (Output_data_got::add_local_plt): Likewise.
444 (Output_data_got::add_local_with_rel): Change object to Relobj*,
445 change rel_dyn to Output_data_reloc_generic*. Use
447 (Output_data_got::add_local_with_rela): Remove. Change all
448 callers to use all_local_with_rel.
449 (Output_data_got::add_local_pair_with_rel): Change object to
450 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
451 add_output_section_generic.
452 (Output_data_got::add_local_pair_with_rela): Remove. Change all
453 callers to use add_local_pair_with_rel.
454 (Output_data_got::reserve_local): Change object to Relobj*.
455 * output.h: (class Output_data_reloc_generic): Add pure virtual
456 declarations for add_global_generic, add_local_generic,
457 add_output_section_generic.
458 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
459 functions for Output_data_reloc_generic. Update declarations for
460 changes listed in output.cc.
461 (class Output_data_got): Change template parameter to got_size.
462 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
463 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
465 (Sized_relobj_incr::do_local_plt_offset): New function.
466 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
469 2011-12-17 Cary Coutant <ccoutant@google.com>
471 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
472 * resolve.cc (Symbol_table::resolve): Likewise.
473 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
475 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
477 2011-12-16 Ian Lance Taylor <iant@google.com>
479 * output.h (Output_data_reloc_generic::add): Only call
480 add_dynamic_reloc if this is a dynamic reloc section.
482 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
485 * target-reloc.h (apply_relocation): Replace <64, false> with
488 2011-11-25 Nick Clifton <nickc@redhat.com>
490 * po/it.po: New Italian translation.
492 2011-11-17 Sterling Augustine <saugustine@google.com>
494 * script.cc (script_include_directive): Implement.
495 (read_script_file): New local variables name and search_path. Update
496 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
497 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
498 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
500 2011-11-11 Sterling Augustine <saugustine@google.com>
502 * yyscript.y (section_cmd): Add support for INCLUDE directive.
503 (file_or_sections_cmd): Likewise.
505 2011-11-11 Doug Kwan <dougkwan@google.com>
507 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
508 if --just-symbols is given.
510 2011-11-10 Doug Kwan <dougkwan@google.com>
513 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
514 when processing data relocs.
515 * reloc.h (Relocate_functions::rel_unaligned): New method.
516 (Relocate_functions::pcrel_unaligned): Ditto.
517 (Relocate_functions::rel32_unaligned): Ditto.
518 (Relocate_functions::pcrel32_unaligned): Ditto.
520 2011-11-09 Doug Kwan <dougkwan@google.com>
523 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
524 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
525 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
526 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
527 (Relocate_functions::rel_unaligned): New.
528 (Relocate_functions::rel32_unaligned): New.
529 * target-reloc.h (relocate_for_relocatable): Add code to handle
530 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
531 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
532 arm_unaligned_reloc_r): New targets.
533 * testsuite/Makefile.in: Regenerate.
534 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
537 2011-11-02 Ian Lance Taylor <iant@google.com>
539 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
541 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
542 * options.cc (General_options::finalize): Use library search path
543 from configure script if specified. If not native and no sysroot,
544 only search TOOLLIBDIR.
545 * options.h (Search_directory::Search_directory): Change name to
547 (General_options::add_to_library_path_with_sysroot): Change arg to
549 * configure, Makefile.in, config.in: Rebuild.
551 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
553 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
554 we are working around the ARM1176 Erratum.
555 * options.h (General_options::fix_arm1176): Add option.
556 * testsuite/Makefile.am: Add testcases, and keep current ones
558 * testsuite/Makefile.in: Regenerate.
559 * testsuite/arm_fix_1176.s: New file.
560 * testsuite/arm_fix_1176.sh: Likewise.
562 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
564 * arm.cc (Target_arm::Target_arm): Remove initialisation of
566 (Target_arm::may_use_blx): Remove method.
567 (Target_arm::set_may_use_blx): Likewise.
568 (Target_arm::may_use_v4t_interworking): New method.
569 (Target_arm::may_use_v5t_interworking): Likewise.
570 (Target_arm::may_use_blx_): Remove member variable.
571 (Arm_relocate_functions::arm_branch_common): Check for v5T
573 (Arm_relocate_functions::thumb_branch_common): Likewise.
574 (Reloc_stub::stub_type_for_reloc): Likewise.
575 (Target_arm::do_finalize_sections): Correct interworking checks.
576 * testsuite/Makefile.am: Add new tests.
577 * testsuite/Makefile.in: Regenerate.
578 * testsuite/arm_farcall_arm_arm.s: New test.
579 * testsuite/arm_farcall_arm_arm.sh: Likewise.
580 * testsuite/arm_farcall_arm_thumb.s: Likewise.
581 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
582 * testsuite/arm_farcall_thumb_arm.s: Likewise.
583 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
584 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
585 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
587 2011-10-31 Cary Coutant <ccoutant@google.com>
590 * expression.cc (Expression::eval_with_dot): Add
591 is_section_dot_assignment parameter.
592 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
593 absolute and assigning to dot within a section.
595 (Output_section_element_assignment::set_section_addresses): Pass
596 dot_section to set_if_absolute.
597 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
598 as is_section_dot_assignment flag to eval_with_dot.
599 (Output_section_element_dot_assignment::set_section_addresses):
601 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
602 parameter. Also set value if relative to dot_section; set the
603 symbol's output_section.
604 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
605 parameter. Adjust all callers.
606 (Expression::eval_maybe_dot): Likewise.
607 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
609 * testsuite/script_test_2.t: Test assignment of an absolute value
610 to dot within an output section element.
612 2011-10-31 Cary Coutant <ccoutant@google.com>
614 * options.h (class General_options): Add --[no-]gnu-unique options.
615 * symtab.cc (Symbol_table::sized_write_globals): Convert
616 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
618 2011-10-31 Cary Coutant <ccoutant@google.com>
621 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
622 unnecessary assertion.
623 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
625 2011-10-31 Sriraman Tallam <tmsriram@google.com>
627 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
629 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
631 Change to just keep the section associated with symbol.
632 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
633 they are externally visible and --export-dynamic is turned on.
634 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
636 2011-10-19 Ian Lance Taylor <iant@google.com>
640 (Output_section_element_dot_assignment::needs_output_section): New
643 2011-10-19 Ian Lance Taylor <iant@google.com>
646 * layout.cc (Layout::segment_precedes): Don't assert failure if a
647 --section-start option was seen.
648 * options.h (General_options::any_section_start): New function.
650 2011-10-18 David S. Miller <davem@davemloft.net>
653 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
654 member to track relocation locations that have moved during TLS
656 (Target_sparc::Relocate::Relocate): Initialize to NULL.
657 (Target_sparc::Relocate::relocate): Adjust view down by 4
658 bytes if it matches reloc_adjust_addr_.
659 (Target_sparc::Relocate::relocate_tls): Always move the
660 __tls_get_addr call delay slot instruction forward 4 bytes when
661 performing relaxation.
663 2011-10-18 Cary Coutant <ccoutant@google.com>
665 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
666 (Output_file::map_no_anonymous): Check for non-zero
667 return code from posix_fallocate.
669 2011-10-17 Cary Coutant <ccoutant@google.com>
672 * plugin.cc (is_visible_from_outside): Check for symbols
673 referenced from dynamic objects.
674 * resolve.cc (Symbol_table::resolve): Don't count references
675 from dynamic objects as references from real ELF files.
676 * testsuite/plugin_test_2.sh: Adjust expected result.
678 2011-10-17 Cary Coutant <ccoutant@google.com>
680 * gold.cc: Include timer.h.
681 (queue_middle_tasks): Stamp time.
682 (queue_final_tasks): Likewise.
683 * main.cc (main): Store timer in parameters. Print timers
685 * parameters.cc (Parameters::Parameters): Initialize timer_.
686 (Parameters::set_timer): New function.
687 (set_parameters_timer): New function.
688 * parameters.h (Parameters::set_timer): New function.
689 (Parameters::timer): New function.
690 (Parameters::timer_): New data member.
691 (set_parameters_timer): New function.
692 * timer.cc (Timer::stamp): New function.
693 (Timer::get_pass_time): New function.
694 * timer.h (Timer::stamp): New function.
695 (Timer::get_pass_time): New function.
696 (Timer::pass_times_): New data member.
698 2011-10-17 Cary Coutant <ccoutant@google.com>
700 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
701 task for members of lib groups.
703 2011-10-17 Cary Coutant <ccoutant@google.com>
706 * fileread.cc (File_read::find_view): Add assert.
707 (File_read::make_view): Move bounds check (replace with assert)...
708 (File_read::find_or_make_view): ... to here.
710 2011-10-12 Cary Coutant <ccoutant@google.com>
712 * output.cc (Output_file::open_base_file): Handle case where
713 ::read returns less than requested size.
715 2011-10-10 Cary Coutant <ccoutant@google.com>
717 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
718 Initialize defined_count_.
719 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
720 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
721 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
722 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
723 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
724 * incremental.h (Sized_relobj_incr::defined_count_): New data
726 (Sized_incr_dynobj::defined_count_): New data member.
727 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
728 Return zeroes instead of internal error.
730 2011-10-10 Cary Coutant <ccoutant@google.com>
733 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
734 (Output_reloc::symbol_value): Return PLT offset if flag is set.
735 * output.h (class Output_reloc): Add use_plt_offset flag.
736 (Output_reloc::type_): Adjust size of bit field.
737 (Output_reloc::use_plt_offset_): New bit field.
738 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
739 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
740 flag. Adjust all callers.
741 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
742 creating RELATIVE relocations.
744 2011-10-10 Nick Clifton <nickc@redhat.com>
746 * po/es.po: Updated Spanish translation.
747 * po/fi.po: Updated Finnish translation.
749 2011-10-03 Diego Novillo <dnovillo@google.com>
751 * options.cc (parse_uint): Fix dereference of RETVAL.
753 2011-09-29 Sriraman Tallam <tmsriram@google.com>
755 * layout.h (section_order_map_): New member.
756 (get_section_order_map): New member function.
757 * output.cc (Output_section::add_input_section): Check for patterns
758 only when --section-ordering-file is specified.
759 * gold.cc (queue_middle_tasks): Delay updating order of sections till
760 output_sections have been formed.
761 * layout.cc (Layout_Layout): Initialize section_order_map_.
762 * plugin.cc (update_section_order): Store order in order_map. Do not
764 * testsuite/Makefile.am: Add test case for plugin_final_layout.
765 * testsuite/Makefile.in: Regenerate.
766 * testsuite/plugin_section_order.c: New file.
767 * testsuite/plugin_final_layout.cc: New file.
768 * testsuite/plugin_final_layout.sh: New file.
770 2011-09-29 Cary Coutant <ccoutant@google.com>
772 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
774 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
775 symbols during incremental update.
776 (Symbol_table::add_from_dynobj): Likewise.
778 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
779 Ian Lance Taylor <iant@google.com>
781 * symtab.cc (Symbol_table::define_special_symbol): Always
782 canonicalize version string.
784 2011-09-26 Cary Coutant <ccoutant@google.com>
786 * gold.cc (queue_initial_tasks): Move option checks ...
787 * options.cc (General_options::finalize): ... to here. Disable
788 some options; make others fatal.
790 2011-09-26 Cary Coutant <ccoutant@google.com>
793 * plugin.cc (get_symbols_v2): New function.
794 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
795 (is_referenced_from_outside): New function.
796 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
797 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
798 (get_symbols): Pass version parameter.
799 (get_symbols_v2): New function.
800 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
802 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
803 (onload): Add LDPT_GET_SYMBOLS_V2.
804 (all_symbols_read_hook): Use get_symbols_v2; check for
805 LDPR_PREVAILING_DEF_IRONLY_EXP.
806 * testsuite/plugin_test_3.sh: Update expected results.
808 2011-09-23 Simon Baldwin <simonb@google.com>
810 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
811 configuration options.
812 * configure: Regenerate.
813 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
814 * Makefile.in: Regenerate.
815 * testsuite/Makefile.in: Regenerate.
817 2011-09-19 Sriraman Tallam <tmsriram@google.com>
819 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
821 2011-09-19 Cary Coutant <ccoutant@google.com>
823 * incremental.cc (can_incremental_update): Fix typo in comment.
824 * incremental.h (can_incremental_update): Likewise.
826 2011-09-18 Cary Coutant <ccoutant@google.com>
828 * incremental.cc (can_incremental_update): New function.
829 * incremental.h (can_incremental_update): New function.
830 * layout.cc (Layout::init_fixed_output_section): Call it.
831 (Layout::make_output_section): Don't allow patch space in .eh_frame.
832 * object.cc (Sized_relobj_file::do_layout): Call
833 can_incremental_update.
835 2011-09-13 Cary Coutant <ccoutant@google.com>
837 * configure.ac: Check for glibc support for gnu_indirect_function
838 support with static linking, setting automake conditional
840 * Makefile.in: Regenerate.
841 * configure: Regenerate.
843 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
844 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
846 * testsuite/Makefile.in: Regenerate.
848 2011-09-13 Cary Coutant <ccoutant@google.com>
850 * incremental.cc (Sized_relobj_incr::do_layout): Call
851 report_comdat_group for kept comdat sections.
852 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
853 * testsuite/Makefile.in: Regenerate.
854 * testsuite/incr_comdat_test_1.cc: New source file.
855 * testsuite/incr_comdat_test_2_v1.cc: New source file.
856 * testsuite/incr_comdat_test_2_v2.cc: New source file.
857 * testsuite/incr_comdat_test_2_v3.cc: New source file.
859 2011-09-13 Ian Lance Taylor <iant@google.com>
861 * object.cc (Sized_relobj_file::do_layout): Remove unused local
862 variable external_symbols_offset.
864 2011-09-12 Ian Lance Taylor <iant@google.com>
866 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
867 triggered if object has no symbols.
869 2011-09-09 David S. Miller <davem@davemloft.net>
871 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
872 (Output_fill_debug_line::do_write): Likewise.
874 2011-08-29 Cary Coutant <ccoutant@google.com>
876 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
877 casts to match formatting specs.
878 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
880 2011-08-26 Cary Coutant <ccoutant@google.com>
882 * layout.cc (Free_list::allocate): Provide guarantee of minimum
883 remaining hole size when allocating.
884 (Layout::make_output_section): Set fill methods for debug sections.
885 * layout.h (Free_list::Free_list_node): Move from private to
887 (Free_list::set_min_hole_size): New function.
888 (Free_list::begin, Free_list::end): New functions.
889 (Free_list::min_hole_): New data member.
890 * output.cc: Include dwarf.h.
891 (Output_fill_debug_info::do_minimum_hole_size): New function.
892 (Output_fill_debug_info::do_write): New function.
893 (Output_fill_debug_line::do_minimum_hole_size): New function.
894 (Output_fill_debug_line::do_write): New function.
895 (Output_section::Output_section): Initialize new data member.
896 (Output_section::set_final_data_size): Ensure patch space is larger
897 than minimum hole size.
898 (Output_section::do_write): Fill holes in debug sections.
899 * output.h (Output_fill): New class.
900 (Output_fill_debug_info): New class.
901 (Output_fill_debug_line): New class.
902 (Output_section::set_free_space_fill): New function.
903 (Output_section::free_space_fill_): New data member.
904 * testsuite/Makefile.am (incremental_test_3): Add
905 --incremental-patch option.
906 (incremental_test_4): Likewise.
907 (incremental_test_5): Likewise.
908 (incremental_test_6): Likewise.
909 (incremental_copy_test): Likewise.
910 (incremental_common_test_1): Likewise.
911 * testsuite/Makefile.in: Regenerate.
913 2011-08-26 Nick Clifton <nickc@redhat.com>
915 * po/es.po: Updated Spanish translation.
917 2011-08-01 Cary Coutant <ccoutant@google.com>
919 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
920 * gold/testsuite/Makefile.in: Regenerate.
921 * gold/testsuite/justsyms_exec.c: New source file.
922 * gold/testsuite/justsyms_lib.c: New source file.
924 2011-08-01 Cary Coutant <ccoutant@google.com>
926 * layout.cc (Layout::set_segment_offsets): Don't realign text
927 segment if -Ttext was specified.
928 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
930 * object.h (Sized_relobj_file::e_type): New function.
931 (Sized_relobj_file::e_type_): New data member.
932 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
933 base address for ET_EXEC files.
934 * target.cc (Target::do_make_elf_object_implementation): Allow
935 ET_EXEC files with --just-symbols option.
937 2011-07-28 Cary Coutant <ccoutant@google.com>
939 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
940 Add thread_number parameter.
941 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
942 * workqueue-threads.cc
943 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
944 current thread if its thread number is greater than desired thread
946 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
947 Add thread_number parameter.
948 (Workqueue::should_cancel_thread): Likewise.
949 (Workqueue::find_runnable_or_wait): Pass thread_number to
950 should_cancel_thread.
951 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
954 2011-07-22 Sriraman Tallam <tmsriram@google.com>
956 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
957 only after checking if it cannot be forced local.
958 * symtab.h (is_externally_visible): Check if the symbol is not forced
961 2011-07-15 Ian Lance Taylor <iant@google.com>
963 * options.h (class General_options): Add --print-output-format.
964 Move -EL next to -EB, for better --help output.
965 * target-select.cc: Include <cstdio>, "options.h", and
967 (Target_selector::do_target_bfd_name): New function.
968 (print_output_format): New function.
969 * target-select.h (class Target_selector): Update declarations.
970 (Target_selector::target_bfd_name): New function.
971 (print_output_format): Declare.
972 * main.cc: Include "target-select.h".
973 (main): Handle --print-output-format.
974 * gold.cc: Include "target-select.h".
975 (queue_initial_tasks): Handle --print-output-format when there are
977 * parameters.cc (parameters_force_valid_target): Give a better
978 error message if -EB/-EL does not match target.
979 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
982 2011-07-15 Ian Lance Taylor <iant@google.com>
984 * i386.cc (class Output_data_plt_i386): Add layout_ field.
985 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
986 (Output_data_plt_i386::do_write): Write address of .dynamic
987 section to first entry in .got.plt section.
988 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
989 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
991 (Output_data_plt_x86_64::do_write): Write address of .dynamic
992 section to first entry in .got.plt section.
993 * layout.h (Layout::dynamic_section): New function.
995 2011-07-13 Sriraman Tallam <tmsriram@google.com>
997 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
999 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
1000 input_section_position_, and input_section_glob_.
1001 (read_layout_from_file): Call function section_ordering_specified.
1002 * layout.h (is_section_ordering_specified): New function.
1003 (section_ordering_specified): New function.
1004 (section_ordering_specified_): New boolean member.
1005 * main.cc(main): Call load_plugins after layout object is defined.
1006 * output.cc (Output_section::add_input_section): Use
1007 function section_ordering_specified to check if section ordering is
1009 * output.cc (Output_section::add_relaxed_input_section): Use
1010 function section_ordering_specified to check if section ordering is
1012 (Output_section::update_section_layout): New function.
1013 (Output_section::sort_attached_input_sections): Check if input section
1015 * output.h (Output_section::update_section_layout): New function.
1016 * plugin.cc (get_section_count): New function.
1017 (get_section_type): New function.
1018 (get_section_name): New function.
1019 (get_section_contents): New function.
1020 (update_section_order): New function.
1021 (allow_section_ordering): New function.
1022 (Plugin::load): Add the new interfaces to the transfer vector.
1023 (Plugin_manager::load_plugins): New parameter.
1024 (Plugin_manager::all_symbols_read): New parameter.
1025 (Plugin_manager::claim_file): New parameter. Save the elf object for
1027 (Plugin_manager::get_elf_object): New function.
1028 (Plugin_manager::get_view): Change to directly use the bool to check
1029 if get_view is called from claim_file_hook.
1030 * plugin.h (input_objects): New function
1031 (Plugin__manager::load_plugins): New parameter.
1032 (Plugin_manager::claim_file): New parameter.
1033 (Plugin_manager::get_elf_object): New function.
1034 (Plugin_manager::in_claim_file_handler): New function.
1035 (Plugin_manager::in_claim_file_handler_): New member.
1036 (layout): New function.
1037 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
1038 handler with an extra parameter. Make the elf object before calling
1040 * testsuite/plugin_test.c (get_section_count): New function pointer.
1041 (get_section_type): New function pointer.
1042 (get_section_name): New function pointer.
1043 (get_section_contents): New function pointer.
1044 (update_section_order): New function pointer.
1045 (allow_section_ordering): New function pointer.
1046 (onload): Check if the new interfaces exist.
1048 2011-07-13 Ian Lance Taylor <iant@google.com>
1050 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
1052 * x86_64.cc (Target_x86_64::got_section): Likewise.
1053 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
1054 (relro_now_test_SOURCES): New variable.
1055 (relro_now_test_DEPENDENCIES): New variable.
1056 (relro_now_test_LDFLAGS): New variable.
1057 (relro_now_test_LDADD): New variable.
1058 (relro_now_test.so): New target.
1059 * testsuite/Makefile.in: Rebuild.
1061 2011-07-12 Ian Lance Taylor <iant@google.com>
1064 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
1065 GLOB_DAT relocation rather than a RELATIVE relocation for a
1066 protected symbol when creating a shared library.
1067 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1068 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
1069 * testsuite/protected_main_1.cc (main): Test that protected
1070 function has same address.
1072 2011-07-11 Ian Lance Taylor <iant@google.com>
1075 * options.h (class General_options): Add -Bgroup.
1076 * options.cc (General_options::finalize): If -Bgroup is set,
1077 default to --unresolved-symbols=report-all.
1078 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
1079 * target-reloc.h (issue_undefined_symbol_error): Handle
1080 --unresolved-symbols=report-all.
1082 2011-07-08 Ian Lance Taylor <iant@google.com>
1085 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
1086 if linker script discards key sections.
1087 (Layout::create_dynamic_symtab): Likewise.
1088 (Layout::assign_local_dynsym_offsets): Likewise.
1089 (Layout::sized_create_version_sections): Likewise.
1090 (Layout::create_interp): Likewise.
1091 (Layout::finish_dynamic_section): Likewise.
1092 (Layout::set_dynamic_symbol_size): Likewise.
1094 2011-07-08 Ian Lance Taylor <iant@google.com>
1097 * options.h (class General_options): Add --unresolved-symbols.
1098 * target-reloc.h (issue_undefined_symbol_error): Check
1099 --unresolved-symbols. Add comments.
1101 2011-07-08 Ian Lance Taylor <iant@google.com>
1103 * testsuite/odr_violation2.cc (Ordering::operator()): Make
1104 expression more complex.
1106 2011-07-08 Ian Lance Taylor <iant@google.com>
1109 * target-reloc.h (issue_undefined_symbol_error): New inline
1110 function, broken out of relocate_section.
1111 (relocate_section): Call issue_undefined_symbol_error.
1112 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1113 there is no TLS segment if we are about to issue an undefined
1115 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1117 2011-07-08 Ian Lance Taylor <iant@google.com>
1120 * resolve.cc (Symbol_table::should_override): Add fromtype
1121 parameter. Change all callers. Give error when linking together
1122 TLS and non-TLS symbol.
1123 (Symbol_table::should_override_with_special): Add fromtype
1124 parameter. Change all callers.
1125 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1126 there is no TLS segment if we have reported some errors.
1127 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1129 2011-07-08 Ian Lance Taylor <iant@google.com>
1132 * target.h (Target::plt_address_for_global): New function.
1133 (Target::plt_address_for_local): New function.
1134 (Target::plt_section_for_global): Remove.
1135 (Target::plt_section_for_local): Remove.
1136 (Target::do_plt_address_for_global): New virtual function.
1137 (Target::do_plt_address_for_local): New virtual function.
1138 (Target::do_plt_section_for_global): Remove.
1139 (Target::do_plt_section_for_local): Remove.
1140 (Target::register_global_plt_entry): Add Symbol_table and Layout
1142 * output.cc (Output_data_got::Got_entry::write): Use
1143 plt_address_for_global and plt_address_for_local.
1144 * layout.cc (Layout::add_target_dynamic_tags): Use size and
1145 address of output section.
1146 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
1147 got_irelative_, and irelative_count_ fields. Update
1149 (Output_data_plt_i386::has_irelative_section): New function.
1150 (Output_data_plt_i386::entry_count): Add irelative_count_.
1151 (Output_data_plt_i386::set_final_data_size): Likewise.
1152 (class Target_i386): Add got_irelative_ and rel_irelative_
1153 fields. Update declarations.
1154 (Target_i386::Target_i386): Initialize new fields.
1155 (Target_i386::do_plt_address_for_global): New function replacing
1156 do_plt_section_for_global.
1157 (Target_i386::do_plt_address_for_local): New function replacing
1158 do_plt_section_for_local.
1159 (Target_i386::got_section): Create got_irelative_.
1160 (Target_i386::rel_irelative_section): New function.
1161 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
1162 fields. Don't define __rel_iplt_{start,end}.
1163 (Output_data_plt_i386::add_entry): Add symtab and layout
1164 parameters. Change all callers. Use different PLT and GOT for
1166 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
1167 layout parameters. Change all callers. Use different PLT and
1169 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
1170 (Output_data_plt_i386::rel_irelative): New function.
1171 (Output_data_plt_i386::address_for_global): New function.
1172 (Output_data_plt_i386::address_for_local): New function.
1173 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
1174 IRELATIVE GOT when changing IFUNC GOT entries.
1175 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
1177 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
1178 if we didn't create an IRELATIVE GOT.
1179 (Target_i386::Relocate::relocate): Use plt_address_for_global and
1180 plt_address_for_local.
1181 (Target_i386::do_dynsym_value): Use plt_address_for_global.
1182 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
1183 got_irelative_, and irelative_count_ fields. Update
1185 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1186 Initialize new fields. Remove symtab parameter. Change all
1188 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
1190 (Output_data_plt_x86_64::has_irelative_section): New function.
1191 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
1192 (class Target_x86_64): Add got_irelative_ and rel_irelative_
1193 fields. Update declarations.
1194 (Target_x86_64::Target_x86_64): Initialize new fields.
1195 (Target_x86_64::do_plt_address_for_global): New function replacing
1196 do_plt_section_for_global.
1197 (Target_x86_64::do_plt_address_for_local): New function replacing
1198 do_plt_section_for_local.
1199 (Target_x86_64::got_section): Create got_irelative_.
1200 (Target_x86_64::rela_irelative_section): New function.
1201 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
1202 all callers. Don't create __rel_iplt_{start,end}.
1203 (Output_data_plt_x86_64::add_entry): Add symtab and layout
1204 parameters. Change all callers. Use different PLT and GOT for
1206 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
1207 layout parameters. Change all callers. Use different PLT and
1209 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
1210 parameters. Change all callers. Use different PLT and GOT for
1212 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
1213 (Output_data_plt_x86_64::rela_irelative): New function.
1214 (Output_data_plt_x86_64::address_for_global): New function.
1215 (Output_data_plt_x86_64::address_for_local): New function.
1216 (Output_data_plt_x86_64::set_final_data_size): Likewise.
1217 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
1218 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
1219 (Target_x86_64::register_global_plt_entry): Add symtab and layout
1221 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
1223 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
1224 symbols if we didn't create an IRELATIVE GOT.
1225 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
1226 plt_address_for_local.
1227 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
1228 * testsuite/ifuncvar1.c: New test file.
1229 * testsuite/ifuncvar2.c: New test file.
1230 * testsuite/ifuncvar3.c: New test file.
1231 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
1232 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
1233 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
1234 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
1235 * testsuite/Makefile.in: Rebuild.
1237 2011-07-07 Cary Coutant <ccoutant@google.com>
1239 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
1240 (two_file_test_1_ndebug.o): Likewise.
1241 (two_file_test_1b_ndebug.o): Likewise.
1242 (two_file_test_2_ndebug.o): Likewise.
1243 (two_file_test_main_ndebug.o): Likewise.
1244 (incremental_test_2): Link with no-debug versions.
1246 2011-07-06 Cary Coutant <ccoutant@google.com>
1248 * gold/incremental.cc
1249 (Output_section_incremental_inputs::write_info_blocks): Check for
1250 hidden and internal symbols.
1252 2011-07-06 Cary Coutant <ccoutant@google.com>
1254 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
1255 Check disposition for startup file.
1256 (Incremental_inputs::report_command_line): Ignore
1257 --incremental-startup-unchanged option.
1258 * options.cc (General_options::parse_incremental_startup_unchanged):
1260 (General_options::General_options): Initialize new data member.
1261 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
1262 (General_options): Add --incremental-startup-unchanged option.
1263 (General_options::incremental_startup_disposition): New function.
1264 (General_options::incremental_startup_disposition_): New data member.
1266 2011-07-06 Cary Coutant <ccoutant@google.com>
1268 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
1269 input file index to Script_info ctor.
1270 (Sized_incremental_binary::do_file_has_changed): Find the
1271 command-line argument for files named in scripts.
1272 * incremental.h (Script_info::Script_info): New ctor
1273 with input file index.
1274 (Script_info::input_file_index): New function.
1275 (Script_info::input_file_index_): New data member.
1276 (Incremental_binary::get_library): Add const.
1277 (Incremental_binary::get_script_info): Add const.
1278 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
1279 * testsuite/Makefile.am (incremental_test_5): New test case.
1280 (incremental_test_6): New test case.
1281 * testsuite/Makefile.in: Regenerate.
1283 2011-07-06 Cary Coutant <ccoutant@google.com>
1285 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
1286 debug output when command lines differ.
1288 2011-07-06 Cary Coutant <ccoutant@google.com>
1290 * incremental.cc (Incremental_inputs::report_command_line): Ignore
1291 --incremental-patch option.
1292 * layout.cc (Free_list::allocate): Extend allocation beyond original
1294 (Layout::make_output_section): Mark sections that should get
1296 * options.cc (parse_percent): New function.
1297 * options.h (parse_percent): New function.
1298 (DEFINE_percent): New macro.
1299 (General_options): Add --incremental-patch option.
1300 * output.cc (Output_section::Output_section): Initialize new data
1302 (Output_section::add_input_section): Print section name when out
1304 (Output_section::add_output_section_data): Likewise.
1305 (Output_section::set_final_data_size): Add patch space when
1306 doing --incremental-full.
1307 (Output_section::do_reset_address_and_file_offset): Remove patch
1309 (Output_segment::set_section_list_addresses): Print debug output
1310 only if --incremental-update.
1311 * output.h (Output_section::set_is_patch_space_allowed): New function.
1312 (Output_section::is_patch_space_allowed_): New data member.
1313 (Output_section::patch_space_): New data member.
1314 * parameters.cc (Parameters::incremental_full): New function.
1315 * parameters.h (Parameters::incremental_full): New function
1316 * testsuite/Makefile.am (incremental_test_2): Add test for
1317 --incremental-patch option.
1318 * testsuite/Makefile.in: Regenerate.
1319 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
1320 (t18): Remove function body.
1322 2011-07-05 Doug Kwan <dougkwan@google.com>
1325 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
1326 Arm_Address type for relocation result.
1327 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
1329 (Arm_relocate_functions::abs32): Use unaligned access.
1330 (Arm_relocate_functions::rel32): Ditto.
1331 (Arm_relocate_functions::prel31): Ditto.
1332 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
1333 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
1334 static data relocations.
1335 * testsuite/Makefile.in: Regnerate.
1336 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
1338 2011-07-05 Ian Lance Taylor <iant@google.com>
1341 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
1342 symbols if necessary.
1343 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1345 2011-07-05 Ian Lance Taylor <iant@google.com>
1348 * resolve.cc (Symbol::override_base_with_special): Simply override
1349 version with special symbol version, ignoring previous version.
1351 2011-07-05 Ian Lance Taylor <iant@google.com>
1353 * object.cc (Sized_relobj_file::include_section_group): Add
1354 information to comment about signature location.
1356 2011-07-02 Ian Lance Taylor <iant@google.com>
1359 * options.h (class General_options): Add -f and -F.
1360 * options.cc (General_options::finalize): Fatal error if -f/-F
1361 are used without -shared.
1362 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
1364 2011-07-02 Ian Lance Taylor <iant@google.com>
1366 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
1368 2011-07-01 Ian Lance Taylor <iant@google.com>
1372 * resolve.cc (Symbol::override_base_with_special): Don't override
1373 the version if the overriding symbol has a different name.
1374 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
1375 all callers. If we give an error about an undefined version,
1376 define the base version if necessary.
1377 * dynobj.h (class Versions): Update declaration.
1378 * testsuite/weak_alias_test_5.cc: New file.
1379 * testsuite/weak_alias_test.script: New file.
1380 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
1381 and versioned_alias have the right value, and call t2.
1382 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
1383 weak_alias_test_5.so.
1384 (weak_alias_test_LDADD): Likewise.
1385 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
1386 * testsuite/Makefile.in: Rebuild.
1388 2011-07-01 Ian Lance Taylor <iant@google.com>
1391 * options.h (class General_options): Support -z notext.
1392 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
1394 (two_file_shared_nonpic.so): Likewise.
1395 (two_file_shared_mixed.so): Likewise.
1396 (two_file_shared_mixed_1.so): Likewise.
1397 (weak_undef_lib_nonpic.so): Likewise.
1398 (alt/weak_undef_lib_nonpic.so): Likewise.
1399 (tls_test_shared_nonpic.so): Likewise.
1400 * testsuite/Makefile.in: Rebuild.
1402 2011-07-01 Ian Lance Taylor <iant@google.com>
1405 * configure.ac: Test whether static linking works, setting
1406 the automake conditional HAVE_STATIC.
1407 * testsuite/Makefile.am: Disable tests using -static if
1408 HAVE_STATIC is not true.
1409 * configure, testsuite/Makefile.in: Rebuild.
1411 2011-07-01 Ian Lance Taylor <iant@google.com>
1414 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
1415 Assert if we see DW_EH_PE_indirect.
1416 * target.h (Target::ehframe_datarel_base): New function.
1417 (Target::do_ehframe_datarel_base): New target function.
1418 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
1419 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
1422 2011-07-01 Ian Lance Taylor <iant@google.com>
1425 * options.h (class General_options): Add
1426 --ld-generated-unwind-info.
1427 * ehframe.cc (Fde::write): Add address parameter. Change all
1428 callers. If associated with PLT, fill in address and size.
1429 (Cie::set_output_offset): Only add merge mapping if there is an
1431 (Cie::write): Add address parameter. Change all callers.
1432 (Eh_frame::add_ehframe_for_plt): New function.
1433 * ehframe.h (class Fde): Update declarations. Move shndx_ and
1434 input_offset_ fields into union u_, with new plt field.
1435 (Fde::Fde): Adjust for new union field.
1436 (Fde::Fde) [Output_data version]: New constructor.
1437 (Fde::add_mapping): Only add merge mapping if there is an object.
1438 (class Cie): Update declarations.
1439 (class Eh_frame): Declare add_ehframe_for_plt.
1440 * layout.cc (Layout::layout_eh_frame): Break out code into
1441 make_eh_frame_section, and call it.
1442 (Layout::make_eh_frame_section): New function.
1443 (Layout::add_eh_frame_for_plt): New function.
1444 * layout.h (class Layout): Update declarations.
1445 * merge.cc (Merge_map::add_mapping): Add assertion.
1446 * i386.cc: Include "dwarf.h".
1447 (class Output_data_plt_i386): Make first_plt_entry,
1448 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
1449 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1450 and plt_eh_frame_fde.
1451 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
1452 boundary. Call add_eh_frame_for_plt if appropriate.
1453 * x86_64.cc: Include "dwarf.h".
1454 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
1455 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
1456 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1457 and plt_eh_frame_fde.
1458 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
1461 2011-06-29 Ian Lance Taylor <iant@google.com>
1464 * object.cc (Sized_relobj_file::layout_section): Change shdr
1465 parameter to be const.
1466 (Sized_relobj_file::layout_eh_frame_section): New function, broken
1468 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
1469 appropriate. Call layout_eh_frame_section.
1470 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
1472 * object.h (class Sized_relobj_file): Update declarations.
1474 2011-06-29 Ian Lance Taylor <iant@google.com>
1477 * script.cc (Token::integer_value): Accept trailing M/m/K/k
1479 (Lex::gather_token): Accept trailing M/m/K/k for integers.
1481 2011-06-29 Ian Lance Taylor <iant@google.com>
1484 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
1486 * layout.cc (Layout::layout_eh_frame): Likewise.
1488 2011-06-29 Ian Lance Taylor <iant@google.com>
1491 * layout.cc (Layout::symtab_section_shndx): New function.
1492 * layout.h (class Layout): Declare symtab_section_shndx.
1493 * output.cc (Output_section::write_header): Call it.
1495 2011-06-29 Ian Lance Taylor <iant@google.com>
1498 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
1499 symbols which are not used in a relocation.
1501 2011-06-28 Ian Lance Taylor <iant@google.com>
1504 * layout.cc (Layout::segment_precedes): Don't crash if a linker
1505 script create indistinguishable segments.
1506 (Layout::set_segment_offsets): Use stable_sort when sorting
1507 segments. Pass this to Compare_segments constructor.
1508 * layout.h (class Layout): Make segment_precedes non-static.
1509 (class Compare_segments): Change from struct to class. Add
1510 layout_ field. Add constructor.
1511 * script-sections.cc
1512 (Script_sections::attach_sections_using_phdrs_clause): Rename
1513 local orphan to is_orphan. Don't report failure to put empty
1514 section in segment. On attachment failure, report name of
1515 section, and attach to first PT_LOAD segment.
1517 2011-06-28 Ian Lance Taylor <iant@google.com>
1520 * target-select.cc (Target_selector::Target_selector): Add
1521 emulation parameter. Change all callers.
1522 (select_target_by_bfd_name): Rename from select_target_by_name.
1524 (select_target_by_emulation): New function.
1525 (supported_emulation_names): New function.
1526 * target-select.h (class Target_selector): Add emulation_ field.
1527 Update declarations.
1528 (Target_selector::recognize_by_bfd_name): Rename from
1529 recognize_by_name. Change all callers.
1530 (Target_selector::supported_bfd_names): Rename from
1531 supported_names. Change all callers.
1532 (Target_selector::recognize_by_emulation): New function.
1533 (Target_selector::supported_emulations): New function.
1534 (Target_selector::emulation): New function.
1535 (Target_selector::do_recognize_by_bfd_name): Rename from
1536 do_recognize_by_name. Change all callers.
1537 (Target_selector::do_supported_bfd_names): Rename from
1538 do_supported_names. Change all callers.
1539 (Target_selector::do_recognize_by_emulation): New function.
1540 (Target_selector::do_supported_emulations): New function.
1541 (select_target_by_bfd_name): Change name in declaration.
1542 (select_target_by_emulation): Declare.
1543 (supported_emulation_names): Declare.
1544 * parameters.cc (parameters_force_valid_target): Try to find
1545 target based on emulation from -m option.
1546 * options.h (class General_options): Change doc string for -m.
1547 * options.cc (help): Print emulations.
1548 (General_options::parse_V): Likewise.
1549 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1550 Add emulation parameter. Change all callers.
1552 2011-06-28 Ian Lance Taylor <iant@google.com>
1554 * target.h (class Target): Add osabi_ field.
1555 (Target::osabi): New function.
1556 (Target::set_osabi): New function.
1557 (Target::Target): Initialize osabi_.
1558 (Target::do_adjust_elf_header): Make pure virtual.
1559 (Sized_target::do_adjust_elf_header): Declare.
1560 * target.cc (Sized_target::do_adjust_elf_header): New function.
1561 (class Sized_target): Instantiate all versions.
1562 * freebsd.h (class Target_freebsd): Remove.
1563 (Target_selector_freebsd::do_recognize): Call set_osabi on
1565 (Target_selector_freebsd::do_recognize_by_name): Likewise.
1566 (Target_selector_freebsd::set_osabi): Remove.
1567 * i386.cc (class Target_i386): Inherit from Sized_target rather
1568 than Target_freebsd.
1569 * x86_64.cc (class Target_x86_64): Likewise.
1571 2011-06-28 Ian Lance Taylor <iant@google.com>
1573 * target.h (Target::can_check_for_function_pointers): Rewrite.
1575 (Target::can_icf_inline_merge_sections): Likewise.
1576 (Target::section_may_have_icf_unsafe_poineters): Likewise.
1577 (Target::Target_info): Add can_icf_inline_merge_sections field.
1578 (Target::do_can_check_for_function_pointers): New virtual
1580 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
1581 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
1582 from can_check_for_function_pointers, move in file.
1583 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
1584 section_may_have_icf_unsafe_poineters, move in file.
1585 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
1586 * i386.cc (Target_i386::do_can_check_for_function_pointers):
1587 Rename from can_check_for_function_pointers, move in file.
1588 (Target_i386::can_icf_inline_merge_sections): Remove.
1589 (Target_i386::i386_info): Initialize
1590 can_icf_inline_merge_sections.
1591 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1592 Initialize can_icf_inline_merge_sections.
1593 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
1594 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
1595 Rename from can_check_for_function_pointers, move in file.
1596 (Target_x86_64::can_icf_inline_merge_sections): Remove.
1597 (Target_x86_64::x86_64_info): Initialize
1598 can_icf_inline_merge_sections.
1599 * testsuite/testfile.cc (Target_test::test_target_info):
1601 * icf.cc (get_section_contents): Correct formatting.
1603 2011-06-27 Ian Lance Taylor <iant@google.com>
1605 * symtab.cc (Symbol::versioned_name): New function.
1606 (Symbol_table::add_to_final_symtab): Use versioned_name when
1608 (Symbol_table::sized_write_symbol): Likewise.
1609 * symtab.h (class Symbol): Declare versioned_name.
1610 * stringpool.h (class Stringpool_template): Add variant of add
1611 which takes a std::basic_string.
1612 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
1613 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
1614 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
1615 (ver_test_12.o): New target.
1616 * testsuite/Makefile.in: Rebuild.
1618 2011-06-27 Doug Kwan <dougkwan@google.com>
1620 * arm.cc (Arm_relocate_functions::thm_jump8,
1621 Arm_relocate_functions::thm_jump11): Use a wider signed
1622 type to compute offset.
1623 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
1625 * testsuite/Makefile.in: Regenerate.
1626 * testsuite/arm_branch_in_range.sh: Check test results of
1627 arm_thm_jump11 and arm_thm_jump8.
1628 * testsuite/arm_thm_jump11.s: New test source file.
1629 * testsuite/arm_thm_jump11.t: New linker script.
1630 * testsuite/arm_thm_jump8.s: New test source file.
1631 * testsuite/arm_thm_jump8.t: New linker script.
1633 2011-06-24 Ian Lance Taylor <iant@google.com>
1635 * layout.cc: Include "object.h".
1636 (ctors_sections_in_init_array): New static variable.
1637 (Layout::is_ctors_in_init_array): New function.
1638 (Layout::layout): Add entry to ctors_sections_in_init_array if
1640 * layout.h (class Layout): Declare is_ctors_in_init_array.
1641 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
1642 is_ctors_reverse_view is set.
1643 (Sized_relobj_file::write_sections): Add layout parameter. Change
1644 all callers. Set is_ctors_reverse_view field of View_size.
1645 (Sized_relobj_file::reverse_words): New function.
1646 * object.h (Sized_relobj_file::View_size): Add
1647 is_ctors_reverse_view field.
1648 (class Sized_relobj_file): Update declarations.
1649 * testsuite/initpri3.c: New test.
1650 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
1652 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
1653 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
1654 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
1655 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
1656 * testsuite/Makefile.in: Rebuild.
1658 2011-06-24 Cary Coutant <ccoutant@google.com>
1660 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
1661 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
1662 (debug_msg_cdebug.err): New targets.
1663 * testsuite/Makefile.in: Regenerate.
1664 * testsuite/debug_msg.sh: Check output of link with compressed debug.
1665 Fix checks for link with shared library.
1667 2011-06-24 Doug Kwan <dougkwan@google.com>
1669 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
1670 skip empty text sections.
1671 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
1673 2011-06-22 Ian Lance Taylor <iant@google.com>
1676 * options.h (class General_options): Add --ctors-in-init-array.
1677 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
1678 friends as SHT_PROGBITS for merging sections.
1679 (Layout::layout): Remove special handling of .init_array and
1680 friends. Don't sort if doing relocatable link. Sort for .ctors
1681 and .dtors if ctors_in_init_array.
1682 (Layout::make_output_section): Force correct section types for
1683 .init_array and friends. Don't sort if doing relocatable link,
1684 Don't sort .ctors and .dtors if ctors_in_init_array.
1685 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
1686 (Layout::output_section_name): Add relobj parameter. Change all
1687 callers. Handle .ctors. and .dtors. in code rather than table.
1688 Handle .ctors and .dtors if ctors_in_init_array.
1689 (Layout::match_file_name): New function, moved from output.cc.
1690 * layout.h (class Layout): Update declarations.
1691 * output.cc: Include "layout.h".
1692 (Input_section_sort_entry::get_priority): New function.
1693 (Input_section_sort_entry::match_file_name): Just call
1694 Layout::match_file_name.
1695 (Output_section::Input_section_sort_init_fini_compare::operator()):
1696 Handle .ctors and .dtors. Sort by explicit priority rather than
1698 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
1699 * testsuite/initpri2.c: New test.
1700 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
1701 (check_PROGRAMS): Add initpri2.
1702 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
1703 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
1704 * configure, testsuite/Makefile.in: Rebuild.
1706 2011-06-19 Ian Lance Taylor <iant@google.com>
1709 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
1710 .interp section to a PT_INTERP segment even if we have seen a
1711 --dynamic-linker option. Don't do it if we have seen a PHDRS
1712 clause in a linker script.
1713 (Layout::finalize): Don't create a .interp section if we've
1714 already create a PT_INTERP segment.
1715 (Layout::create_interp): Always call choose_output_section (revert
1716 patch of 2011-06-17). Don't create PT_INTERP segment.
1717 * script-sections.cc
1718 (Script_sections::create_note_and_tls_segments): Add a .interp
1719 section to a PT_INTERP segment even if we have seen a
1720 --dynamic-linker option.
1722 2011-06-18 Ian Lance Taylor <iant@google.com>
1724 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
1725 merely because a non-PT_LOAD segment has a dynamic reloc.
1727 2011-06-18 Ian Lance Taylor <iant@google.com>
1729 * layout.cc (Layout::finish_dynamic_section): Don't create
1730 DT_FLAGS entry if not needed.
1732 2011-06-18 Ian Lance Taylor <iant@google.com>
1735 * layout.cc (Layout::layout_eh_frame): Correct handling of
1736 writable .eh_frame section.
1738 2011-06-17 Ian Lance Taylor <iant@google.com>
1741 * resolve.cc (Symbol_table::resolve): Don't give an error if a
1742 symbol is redefined with the exact same object and value.
1744 2011-06-17 Ian Lance Taylor <iant@google.com>
1747 * layout.h (class Layout): Add interp_segment_ field.
1748 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
1749 (Layout::attach_allocated_section_to_segment): If making shared
1750 library, put .interp section in PT_INTERP segment.
1751 (Layout::finalize): Also call create_interp if -dynamic-linker
1753 (Layout::create_interp): Assert that there is no PT_INTERP
1754 segment. If not using a SECTIONS clause, use make_output_section.
1755 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
1756 * script-sections.cc
1757 (Script_sections::create_note_and_tls_segments): If making shared
1758 library, put .interp section in PT_INTERP segment.
1760 2011-06-17 Ian Lance Taylor <iant@google.com>
1762 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
1763 when making a shared library.
1765 2011-06-17 Ian Lance Taylor <iant@google.com>
1767 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
1768 parameter. Change all callers. Don't issue warning about PC32
1769 against locally defined symbol.
1771 2011-06-16 Ian Lance Taylor <iant@google.com>
1773 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
1774 occurs in same object.
1776 2011-06-14 Alan Modra <amodra@gmail.com>
1778 * po/POTFILES.in: Regenerate.
1780 2011-06-09 Ian Lance Taylor <iant@google.com>
1782 * script-sections.cc
1783 (Orphan_output_section::set_section_addresses): For a relocatable
1784 link set address to 0.
1786 2011-06-09 Cary Coutant <ccoutant@google.com>
1789 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
1790 used with --compress-debug-sections.
1791 * gold/object.cc (Sized_relobj_file::do_layout): Report
1792 uncompressed size of compressed input sections.
1794 2011-06-08 Cary Coutant <ccoutant@google.com>
1797 * testsuite/two_file_test_2_v1.cc: Change initialization of
1798 v2 to keep it in .data.
1800 2011-06-07 Cary Coutant <ccoutant@google.com>
1802 * common.cc (Symbol_table::do_allocate_commons_list): Call
1804 * errors.cc (Errors::fatal): Adjust call to gold_exit.
1805 (Errors::fallback): New function.
1806 (gold_fallback): New function.
1807 * errors.h (Errors::fallback): New function.
1808 * gold.cc (gold_exit): Change status parameter to enum; adjust
1810 (queue_initial_tasks): Call gold_fallback.
1811 * gold.h: Include cstdlib.
1812 (Exit_status): New enum type.
1813 (gold_exit): Change status parameter to enum.
1814 (gold_fallback): New function.
1815 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
1816 (Layout::create_symtab_sections): Likewise.
1817 (Layout::create_shdrs): Likewise.
1818 * main.cc (main): Adjust call to gold_exit.
1819 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
1820 (Output_data_got::add_got_entry_pair): Likewise.
1821 (Output_section::add_input_section): Likewise.
1822 (Output_section::add_output_section_data): Likewise.
1823 (Output_segment::set_section_list_addresses): Likewise.
1824 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
1826 2011-06-07 Cary Coutant <ccoutant@google.com>
1828 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
1829 for incremental links.
1830 * output.cc (Output_segment::set_section_list_addresses): Remove
1831 FIXME and test for TLS or BSS.
1833 2011-06-07 Cary Coutant <ccoutant@google.com>
1835 * testsuite/Makefile.am: Add incremental_copy_test,
1836 incremental_common_test_1.
1837 * testsuite/Makefile.in: Regenerate.
1838 * testsuite/common_test_1_v1.c: New source file.
1839 * testsuite/common_test_1_v2.c: New source file.
1840 * testsuite/copy_test_v1.cc: New source file.
1842 2011-06-07 Cary Coutant <ccoutant@google.com>
1844 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
1845 update, allocate common from bss section's free list.
1846 * incremental-dump.cc (dump_incremental_inputs): Print flag for
1847 linker-defined symbols.
1848 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1849 Skip GOT and PLT entries that are no longer referenced.
1850 (Output_section_incremental_inputs::write_info_blocks): Mark
1851 linker-defined symbols.
1852 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
1853 * output.cc (Output_section::allocate): New function.
1854 * output.h (Output_section::allocate): New function.
1855 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
1856 linker-defined symbols.
1857 (Symbol::override_base_with_special): Copy is_predefined_ flag.
1858 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
1859 (Symbol::init_base_output_data): Likewise.
1860 (Symbol::init_base_output_segment): Likewise.
1861 (Symbol::init_base_constant): Likewise.
1862 (Sized_symbol::init_output_data): Likewise.
1863 (Sized_symbol::init_output_segment): Likewise.
1864 (Sized_symbol::init_constant): Likewise.
1865 (Symbol_table::do_define_in_output_data): Likewise.
1866 (Symbol_table::do_define_in_output_segment): Likewise.
1867 (Symbol_table::do_define_as_constant): Likewise.
1868 * symtab.h (Symbol::is_predefined): New function.
1869 (Symbol::init_base_output_data): Add is_predefined parameter.
1870 (Symbol::init_base_output_segment): Likewise.
1871 (Symbol::init_base_constant): Likewise.
1872 (Symbol::is_predefined_): New data member.
1873 (Sized_symbol::init_output_data): Add is_predefined parameter.
1874 (Sized_symbol::init_output_segment): Likewise.
1875 (Sized_symbol::init_constant): Likewise.
1876 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
1878 2011-06-07 Cary Coutant <ccoutant@google.com>
1880 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
1881 instead of emit_copy_reloc.
1882 (Copy_relocs::emit_copy_reloc): Refactor.
1883 (Copy_relocs::make_copy_reloc): New function.
1884 (Copy_relocs::add_copy_reloc): Remove.
1885 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
1887 (Copy_relocs::make_copy_reloc): New function.
1888 (Copy_relocs::add_copy_reloc): Remove.
1889 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
1890 unchanged input files.
1891 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
1892 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
1893 Reserve BSS space for COPY relocations.
1894 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1895 (Output_section_incremental_inputs::write_info_blocks): Record
1896 whether a symbol is copied from a shared object.
1897 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
1898 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
1899 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
1900 (Incremental_input_entry_reader::get_output_symbol_index): Add
1902 (Incremental_binary::emit_copy_relocs): New function.
1903 (Incremental_binary::do_emit_copy_relocs): New function.
1904 (Sized_incremental_binary::Sized_incremental_binary): Initialize
1906 (Sized_incremental_binary::add_copy_reloc): New function.
1907 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1908 (Sized_incremental_binary::Copy_reloc): New struct.
1909 (Sized_incremental_binary::Copy_relocs): New typedef.
1910 (Sized_incremental_binary::copy_relocs_): New data member.
1911 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
1912 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
1913 * target.h (Sized_target::emit_copy_reloc): New function.
1914 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
1916 2011-06-02 Cary Coutant <ccoutant@google.com>
1919 * gold/archive.cc (Archive::Archive): Initialize new data member.
1920 (Archive::include_all_members): Return if archive has already been
1922 * gold/archive.h (Archive::include_all_members_): New data member.
1924 2011-06-02 Nick Clifton <nickc@redhat.com>
1926 * dynobj.h: Fix spelling mistake in comment.
1927 * output.cc: Likewise.
1929 2011-05-31 Doug Kwan <dougkwan@google.com>
1933 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
1934 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
1935 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
1936 redundant arm_exidx_test.so.
1937 * testsuite/Makefile.in: Regenerate.
1938 (check_SCRIPTS): Add pr12826.sh
1939 (check_DATA): Add pr12826.stdout
1940 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
1941 * testsuite/pr12826.sh: New file.
1942 * testsuite/pr12826_1.s: Ditto.
1943 * testsuite/pr12826_1.s: Ditto.
1945 2011-05-30 Ian Lance Taylor <iant@google.com>
1947 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
1950 2011-05-29 Ian Lance Taylor <iant@google.com>
1953 * testsuite/Makefile.am: Use different file name for two_file_test
1954 temporary file for each incremental test.
1955 * testsuite/Makefile.in: Rebuild.
1957 2011-05-29 Ian Lance Taylor <iant@google.com>
1959 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
1960 binary input file is empty.
1962 2011-05-27 Ian Lance Taylor <iant@google.com>
1964 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
1965 (ver_test_9.so): Likewise.
1966 * testsuite/Makefile.in: Rebuild.
1968 2011-05-26 Cary Coutant <ccoutant@google.com>
1970 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
1971 * incremental.cc (Incremental_inputs::report_input_section): Fix
1972 comment, indentation.
1973 (Incremental_inputs::report_comdat_group): New function.
1974 (Output_section_incremental_inputs::set_final_data_size): Adjust size
1975 of data for incremental input file entry.
1976 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
1977 group count, COMDAT group signatures.
1978 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
1979 an unchanged input file.
1980 * incremental.h (Incremental_object_entry::Incremental_object_entry):
1981 Initialize new data member.
1982 (Incremental_object_entry::add_comdat_group): New function.
1983 (Incremental_object_entry::get_comdat_group_count): New function.
1984 (Incremental_object_entry::get_comdat_signature_key): New function.
1985 (Incremental_object_entry::groups_): New data member.
1986 (Incremental_inputs::report_comdat_group): New function.
1987 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
1988 data for incremental input file entry.
1989 (Incremental_input_entry_reader::get_comdat_group_count): New function.
1990 (Incremental_input_entry_reader::get_input_section): Adjust size of
1991 data for incremental input file entry.
1992 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
1993 (Incremental_input_entry_reader::get_comdat_group_signature): New
1995 * object.cc (Sized_relobj::include_section_group): Report kept
1996 COMDAT groups for incremental links.
1998 2011-05-24 David Meyer <pdox@google.com>
2000 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
2001 with name parameter. Add found_name parameter.
2002 * fileread.cc (Input_file::find_file): Adjust code accordingly.
2003 * dirsearch.h (class Dirsearch): Update declaration.
2005 2011-05-24 Ian Lance Taylor <iant@google.com>
2007 * archive.cc (Library_base::should_include_member): Pull in object
2008 from archive if it defines the entry symbol.
2009 * parameters.cc (Parameters::entry): New function.
2010 * parameters.h (class Parameters): Declare entry.
2011 * output.h (class Output_file_header): Remove entry_ field.
2012 * output.cc (Output_file_header::Output_file_header): Remove entry
2013 parameter. Change all callers.
2014 (Output_file_header::entry): Use parameters->entry.
2015 * gold.cc (queue_middle_tasks): Likewise.
2016 * plugin.cc (Plugin_hook::run): Likewise.
2018 2011-05-24 Cary Coutant <ccoutant@google.com>
2020 * gold.cc (queue_initial_tasks): Pass incremental base filename
2021 to Output_file::open_base_file; don't print error message.
2022 * incremental-dump.cc (main): Adjust call to
2023 Output_file::open_for_modification.
2024 * incremental-dump.cc (main): Likewise.
2025 * incremental.cc (Incremental_inputs::report_command_line):
2026 Ignore --incremental-base option when comparing command lines.
2027 Ignore parameter when given as separate argument.
2028 * options.h (class General_options): Add --incremental-base.
2029 * output.cc (Output_file::Output_file):
2030 (Output_file::open_base_file): Add base_name and writable parameters;
2031 read base file into new file; print error message here.
2032 (Output_file::map_no_anonymous): Add writable parameter; adjust all
2034 * output.h (Output_file::open_for_modification): Rename to...
2035 (Output_file::open_base_file): ...this; add base_name and
2036 writable parameters; adjust all callers.
2037 (Output_file::map_no_anonymous): Add writable parameter; adjust all
2039 * testsuite/Makefile.am (incremental_test_4): Test
2041 * testsuite/Makefile.in: Regenerate.
2043 2011-05-24 Cary Coutant <ccoutant@google.com>
2045 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
2047 * testsuite/Makefile.in: Regenerate.
2048 * testsuite/two_file_test_1_v1.cc: New test source file.
2049 * testsuite/two_file_test_1b_v1.cc: New test source file.
2050 * testsuite/two_file_test_2_v1.cc: New test source file.
2052 2011-05-24 Cary Coutant <ccoutant@google.com>
2054 * dynobj.h (Dynobj::do_dynobj): New function.
2055 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
2056 flag and soname for shared objects.
2057 * incremental.cc (Incremental_inputs::report_object): Make
2058 either Incremental_object_entry or Incremental_dynobj_entry; add
2059 soname to string table.
2060 (Incremental_inputs::report_input_section): Add assertion.
2061 (Output_section_incremental_inputs::set_final_data_size): Adjust
2062 type of input file entry for shared libraries; adjust size of
2063 shared library info entry.
2064 (Output_section_incremental_inputs::write_input_files): Write
2065 as_needed flag for shared libraries.
2066 (Output_section_incremental_inputs::write_info_blocks): Adjust type
2067 of input file entry for shared libraries; write soname.
2068 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
2069 soname from incremental info.
2070 * incremental.h (enum Incremental_input_flags): Add
2071 INCREMENTAL_INPUT_AS_NEEDED.
2072 (Incremental_input_entry::Incremental_input_entry): Initialize new
2074 (Incremental_input_entry::set_as_needed): New function.
2075 (Incremental_input_entry::as_needed): New function.
2076 (Incremental_input_entry::do_dynobj_entry): New function.
2077 (Incremental_input_entry::as_needed_): New data member.
2078 (Incremental_object_entry::Incremental_object_entry): Don't check
2080 (Incremental_object_entry::do_type): Likewise.
2081 (class Incremental_dynobj_entry): New class.
2082 (Incremental_input_entry_reader::as_needed): New function.
2083 (Incremental_input_entry_reader::get_soname): New function.
2084 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
2085 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
2086 size of shared library info entry.
2087 * layout.cc (Layout::finish_dynamic_section): Don't test for
2088 incremental link when adding DT_NEEDED entries.
2089 * object.h (Object::Object): Initialize new data member.
2090 (Object::dynobj): New function.
2091 (Object::set_as_needed): New function.
2092 (Object::as_needed): New function.
2093 (Object::do_dynobj): New function.
2094 (Object::as_needed_): New data member.
2096 2011-05-24 Cary Coutant <ccoutant@google.com>
2098 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
2099 info; adjust display of GOT entries.
2100 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2101 vector of input objects; remove file_status_.
2102 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
2103 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
2104 got_plt reader; call target hooks to reserve GOT entries.
2105 (Output_section_incremental_inputs::set_final_data_size): Adjust size
2106 of input file info header and GOT info entry.
2107 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
2109 (Got_plt_view_info::got_descriptor): Remove.
2110 (Got_plt_view_info::sym_index): New data member.
2111 (Got_plt_view_info::input_index): New data member.
2112 (Local_got_offset_visitor::visit): Write input file index.
2113 (Global_got_offset_visitor::visit): Write 0 for input file index.
2114 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
2115 with sym_index and input_index.
2116 (Output_section_incremental_inputs::write_got_plt): Adjust size of
2117 incremental info GOT entry; replace got_descriptor with input_index.
2118 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
2119 map from input file index to object.
2120 (Sized_relobj_incr::do_layout): Replace direct data member reference
2121 with accessor function.
2122 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
2123 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
2124 Adjust size of input file info header.
2125 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
2126 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
2127 (Incremental_input_entry_reader::get_input_section): Adjust size of
2128 input file info header.
2129 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
2130 of incremental info GOT entry.
2131 (Incremental_got_plt_reader::get_got_desc): Remove.
2132 (Incremental_got_plt_reader::get_got_symndx): New function.
2133 (Incremental_got_plt_reader::get_got_input_index): New function.
2134 (Sized_incremental_binary::Sized_incremental_binary): Remove
2135 file_status_; add input_objects_.
2136 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
2137 (Sized_incremental_binary::set_file_is_unchanged): Remove.
2138 (Sized_incremental_binary::file_is_unchanged): Remove.
2139 (Sized_incremental_binary::set_input_object): New function.
2140 (Sized_incremental_binary::input_object): New function.
2141 (Sized_incremental_binary::file_status_): Remove.
2142 (Sized_incremental_binary::input_objects_): New data member.
2143 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
2145 (Sized_relobj_incr::invalid_address): Move to base class.
2146 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
2148 (Sized_relobj_incr::do_output_section_offset): Likewise.
2149 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
2150 (Sized_relobj_incr::section_offsets_): Likewise.
2151 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
2153 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
2154 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
2155 with accessor function.
2156 (Sized_relobj_file::do_layout): Likewise.
2157 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
2158 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
2159 (Sized_relobj_file::compute_final_local_value): Replace refs to
2160 section_offsets_ with accessor function.
2161 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
2162 * object.h (Relobj::Relobj): Initialize new data members.
2163 (Relobj::add_dyn_reloc): New function.
2164 (Relobj::first_dyn_reloc): New function.
2165 (Relobj::dyn_reloc_count): New function.
2166 (Relobj::first_dyn_reloc_): New data member.
2167 (Relobj::dyn_reloc_count_): New data member.
2168 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
2170 (Sized_relobj::Address): New typedef.
2171 (Sized_relobj::invalid_address): Move here from child class.
2172 (Sized_relobj::Sized_relobj): Initialize new data members.
2173 (Sized_relobj::sized_relobj): New function.
2174 (Sized_relobj::is_output_section_offset_invalid): Move here from
2176 (Sized_relobj::get_output_section_offset): Likewise.
2177 (Sized_relobj::local_has_got_offset): Likewise.
2178 (Sized_relobj::local_got_offset): Likewise.
2179 (Sized_relobj::set_local_got_offset): Likewise.
2180 (Sized_relobj::do_for_all_local_got_entries): Likewise.
2181 (Sized_relobj::clear_got_offsets): New function.
2182 (Sized_relobj::section_offsets): Move here from child class.
2183 (Sized_relobj::do_output_section_offset): Likewise.
2184 (Sized_relobj::do_set_section_offset): Likewise.
2185 (Sized_relobj::Local_got_offsets): Likewise.
2186 (Sized_relobj::local_got_offsets_): Likewise.
2187 (Sized_relobj::section_offsets_): Likewise.
2188 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
2190 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
2192 (Sized_relobj_file::sized_relobj): New function
2193 (Sized_relobj_file::local_has_got_offset): Move to base class.
2194 (Sized_relobj_file::local_got_offset): Likewise.
2195 (Sized_relobj_file::set_local_got_offset): Likewise.
2196 (Sized_relobj_file::get_output_section_offset): Likewise.
2197 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
2198 (Sized_relobj_file::do_output_section_offset): Likewise.
2199 (Sized_relobj_file::do_set_section_offset): Likewise.
2200 (Sized_relobj_file::Local_got_offsets): Likewise.
2201 (Sized_relobj_file::local_got_offsets_): Likewise.
2202 (Sized_relobj_file::section_offsets_): Likewise.
2203 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
2205 (set_needs_dynsym_index): Convert relobj to derived class pointer.
2206 (Output_reloc::get_symbol_index): Likewise.
2207 (Output_reloc::local_section_offset): Likewise.
2208 (Output_reloc::get_address): Likewise.
2209 (Output_reloc::symbol_value): Likewise.
2210 (Output_data_got::reserve_slot): Move to class definition.
2211 (Output_data_got::reserve_local): New function.
2212 (Output_data_got::reserve_slot_for_global): Remove.
2213 (Output_data_got::reserve_global): New function.
2214 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
2215 (all constructors, two instantiations).
2216 (Output_reloc::get_relobj): New function (two instantiations).
2217 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
2218 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
2219 (Output_data_reloc::add_global): Adjust type of relobj.
2220 (Output_data_reloc::add_global_relative): Likewise.
2221 (Output_data_reloc::add_symbolless_global_addend): Likewise.
2222 (Output_data_reloc::add_local): Likewise.
2223 (Output_data_reloc::add_local_relative): Likewise.
2224 (Output_data_reloc::add_symbolless_local_addend): Likewise.
2225 (Output_data_reloc::add_local_section): Likewise.
2226 (Output_data_reloc::add_output_section): Likewise.
2227 (Output_data_reloc::add_absolute): Likewise.
2228 (Output_data_reloc::add_target_specific): Likewise.
2229 (Output_data_got::reserve_slot): Move definition here.
2230 (Output_data_got::reserve_local): New function.
2231 (Output_data_got::reserve_global): New function.
2232 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
2233 section_offsets_ with accessor function.
2234 (Sized_relobj_file::write_sections): Likewise.
2235 (Sized_relobj_file::do_relocate_sections): Likewise.
2236 * target.h (Sized_target::reserve_local_got_entry): New function.
2237 (Sized_target::reserve_global_got_entry): New function.
2238 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
2239 (Target_x86_64::reserve_global_got_entry): New function.
2240 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
2242 2011-05-23 Cary Coutant <ccoutant@google.com>
2244 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
2245 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
2246 bit when checking got_type.
2247 * incremental.cc (Sized_incremental_binary::setup_readers):
2248 Store symbol table and string table locations; initialize bit vector
2249 of file status flags.
2250 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
2252 (Sized_incremental_binary::do_process_got_plt): New function.
2253 (Sized_incremental_binary::get_symtab_view): Use stored locations.
2254 (Output_section_incremental_inputs::set_final_data_size): Record
2255 file index for each input file.
2256 (Output_section_incremental_inputs::write_got_plt): Store file index
2257 instead of input entry offset for each GOT entry.
2259 (Incremental_input_entry::Incremental_input_entry): Initialize new
2261 (Incremental_input_entry::set_offset): Store file index.
2262 (Incremental_input_entry::get_file_index): New function.
2263 (Incremental_input_entry::file_index_): New data member.
2264 (Incremental_binary::process_got_plt): New function.
2265 (Incremental_binary::do_process_got_plt): New function.
2266 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2268 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
2269 (Sized_incremental_binary::set_file_is_unchanged): New function.
2270 (Sized_incremental_binary::file_is_unchanged): New function.
2271 (Sized_incremental_binary::do_process_got_plt): New function.
2272 (Sized_incremental_binary::file_status_): New data member.
2273 (Sized_incremental_binary::main_symtab_loc_): New data member.
2274 (Sized_incremental_binary::main_strtab_loc_): New data member.
2275 * output.cc (Output_data_got::Got_entry::write): Add case
2277 (Output_data_got::add_global): Call add_got_entry.
2278 (Output_data_got::add_global_plt): Likewise.
2279 (Output_data_got::add_global_with_rel): Likewise.
2280 (Output_data_got::add_global_with_rela): Likewise.
2281 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
2282 (Output_data_got::add_global_pair_with_rela): Likewise.
2283 (Output_data_got::add_local): Call add_got_entry.
2284 (Output_data_got::add_local_plt): Likewise.
2285 (Output_data_got::add_local_with_rel): Likewise.
2286 (Output_data_got::add_local_with_rela): Likewise.
2287 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
2288 (Output_data_got::add_local_pair_with_rela): Likewise.
2289 (Output_data_got::reserve_slot): New function.
2290 (Output_data_got::reserve_slot_for_global): New function.
2291 (Output_data_got::add_got_entry): New function.
2292 (Output_data_got::add_got_entry_pair): New function.
2293 (Output_section::add_output_section_data): Edit FIXME.
2295 (Output_section_data_build::Output_section_data_build): New
2296 constructor with size parameter.
2297 (Output_data_space::Output_data_space): Likewise.
2298 (Output_data_got::Output_data_got): Initialize new data member; new
2299 constructor with size parameter.
2300 (Output_data_got::add_constant): Call add_got_entry.
2301 (Output_data_got::reserve_slot): New function.
2302 (Output_data_got::reserve_slot_for_global): New function.
2303 (class Output_data_got::Got_entry): Add RESERVED_CODE.
2304 (Output_data_got::add_got_entry): New function.
2305 (Output_data_got::add_got_entry_pair): New function.
2306 (Output_data_got::free_list_): New data member.
2307 * target.h (Sized_target::init_got_plt_for_update): New function.
2308 (Sized_target::register_global_plt_entry): New function.
2309 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2310 Initialize new data member; call init; add constructor with PLT count.
2311 (Output_data_plt_x86_64::init): New function.
2312 (Output_data_plt_x86_64::add_relocation): New function.
2313 (Output_data_plt_x86_64::reserve_slot): New function.
2314 (Output_data_plt_x86_64::free_list_): New data member.
2315 (Target_x86_64::init_got_plt_for_update): New function.
2316 (Target_x86_64::register_global_plt_entry): New function.
2317 (Output_data_plt_x86_64::add_entry): Allocate from free list for
2318 incremental updates.
2319 (Output_data_plt_x86_64::add_relocation): New function.
2320 * testsuite/object_unittest.cc (Object_test): Set default options.
2322 2011-05-16 Ian Lance Taylor <iant@google.com>
2324 * options.h (class General_options): Make -i a synonym for -r.
2326 2011-05-16 Ian Lance Taylor <iant@google.com>
2328 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
2330 2011-05-10 Cary Coutant <ccoutant@google.com>
2332 * object.cc (Sized_relobj::do_count_local_symbols): Check for
2335 2011-05-06 Ian Lance Taylor <iant@google.com>
2337 * layout.cc (Layout::layout): If the output section flags change,
2338 update the ordering.
2340 2011-04-25 Cary Coutant <ccoutant@google.com>
2342 * incremental-dump.cc (dump_incremental_inputs): Print local
2343 symbol info for each input file.
2345 (Output_section_incremental_inputs::set_final_data_size): Add local
2346 symbol info to input file entries in incremental info.
2347 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2348 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
2349 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
2350 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
2352 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
2353 (Sized_incr_relobj::do_relocate): Write the local symbols.
2354 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
2355 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
2356 Adjust size of input file header.
2357 (Incremental_inputs_reader::get_local_symbol_offset): New function.
2358 (Incremental_inputs_reader::get_local_symbol_count): New function.
2359 (Incremental_inputs_reader::get_input_section): Adjust size of input
2361 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
2362 (Sized_incr_relobj::This): New typedef.
2363 (Sized_incr_relobj::sym_size): New const data member.
2364 (Sized_incr_relobj::Local_symbol): New struct.
2365 (Sized_incr_relobj::do_output_local_symbol_count): New function.
2366 (Sized_incr_relobj::do_local_symbol_offset): New function.
2367 (Sized_incr_relobj::local_symbol_count_): New data member.
2368 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
2369 (Sized_incr_relobj::local_symbol_index_): New data member.
2370 (Sized_incr_relobj::local_symbol_offset_): New data member.
2371 (Sized_incr_relobj::local_dynsym_offset_): New data member.
2372 (Sized_incr_relobj::local_symbols_): New data member.
2373 * object.h (Relobj::output_local_symbol_count): New function.
2374 (Relobj::local_symbol_offset): New function.
2375 (Relobj::do_output_local_symbol_count): New function.
2376 (Relobj::do_local_symbol_offset): New function.
2377 (Sized_relobj::do_output_local_symbol_count): New function.
2378 (Sized_relobj::do_local_symbol_offset): New function.
2380 2011-04-22 Vladimir Simonov <sv@sw.ru>
2382 * descriptors.cc (set_close_on_exec): New function.
2383 (Descriptors::open): Use set_close_on_exec.
2384 * output.cc (S_ISLNK): Define if not defined.
2386 2011-04-22 Cary Coutant <ccoutant@google.com>
2388 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2390 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2391 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
2392 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
2394 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
2395 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
2396 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
2398 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
2400 (Incremental_binary::apply_incremental_relocs): New function.
2401 (Incremental_binary::do_apply_incremental_relocs): New function.
2402 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2404 (Sized_incremental_binary::add_global_symbol): New function.
2405 (Sized_incremental_binary::global_symbol): New function.
2406 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2407 (Sized_incremental_binary::symbol_map_): New data member.
2408 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
2409 * target.h (Sized_target::apply_relocation): New function.
2410 * target-reloc.h (apply_relocation): New function.
2411 * x86_64.cc (Target_x86_64::apply_relocation): New function.
2413 2011-04-22 Doug Kwan <dougkwan@google.com>
2415 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
2416 flag of a SHT_ARM_EXIDX section.
2417 * testsuite/Makefile.am (arm_exidx_test): New test rules.
2418 * testsuite/Makefile.in: Regenerate.
2419 * testsuite/arm_exidx_test.s: New file.
2420 * testsuite/arm_exidx_test.sh: Same.
2422 2011-04-20 Cary Coutant <ccoutant@google.com>
2425 * archive.h (Incremental_archive_entry::Archive_member):
2426 Initialize arg_serial_ (second constructor).
2428 2011-04-17 Ian Lance Taylor <iant@google.com>
2430 * object.cc (Relocate_info::location): Simplify location string.
2431 * errors.cc (Errors::error_at_location): Don't print program
2433 (Errors::warning_at_location): Likewise.
2434 (Errors::undefined_symbol): Likewise.
2435 * testsuite/debug_msg.sh: Update accordingly.
2437 2011-04-14 Cary Coutant <ccoutant@google.com>
2439 * gold/layout.cc (Layout::symtab_section_offset): New function.
2440 * gold/layout.h (Layout::symtab_section_offset): New function.
2441 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
2443 2011-04-12 Ian Lance Taylor <iant@google.com>
2445 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
2446 with MREMAP_MAYMOVE.
2447 * output.h (class Output_file): Add map_is_allocated_ field.
2448 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
2449 not available, provide stubs. If mremap is not available, #define
2451 (MREMAP_MAYMOVE): Define if not defined.
2452 (Output_file::Output_file): Initialize map_is_allocated_.
2453 (Output_file::resize): Check map_is_allocated_.
2454 (Output_file::map_anonymous): If mmap fails, use malloc.
2455 (Output_file::unmap): Don't do anything for an anonymous map.
2456 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
2457 is not available, provide stubs.
2458 (File_read::View::~View): Use free rather than delete[].
2459 (File_read::make_view): Use malloc rather than new[]. If mmap
2461 (File_read::find_or_make_view): Use malloc rather than new[].
2462 * gold.h: Remove HAVE_REMAP code.
2463 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
2464 exists. Rename mremap to gold_mremap. If mmap is not available
2466 * configure, config.in: Rebuild.
2468 2011-04-11 Ian Lance Taylor <iant@google.com>
2470 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
2471 initialize local variable v.
2473 2011-04-11 Cary Coutant <ccoutant@google.com>
2475 * archive.cc (Archive::include_member): Adjust call to
2477 (Add_archive_symbols::run): Track argument serial numbers.
2478 (Lib_group::include_member): Likewise.
2479 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
2480 * archive.h (Incremental_archive_entry::Archive_member):
2481 Initialize arg_serial_.
2482 (Archive_member::arg_serial_): New data member.
2483 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
2484 (Sized_dynobj::do_add_symbols): Track symbols when doing an
2486 (Sized_dynobj::do_for_all_local_got_entries): New function.
2487 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
2489 * fileread.cc (get_mtime): New function.
2490 * fileread.h (get_mtime): New function.
2491 * gold.cc (queue_initial_tasks): Check for incremental update.
2492 (process_incremental_input): New function.
2493 (queue_middle_tasks): Don't force valid target for incremental
2495 * incremental-dump.cc (find_input_containing_global): Adjust
2496 size of symbol info entry.
2497 (dump_incremental_inputs): Dump argument serial number and
2498 in_system_directory flag; bias shndx by 1; print symbol names
2499 when dumping per-file symbol lists; use new symbol info readers.
2501 (Output_section_incremental_inputs:update_data_size): New function.
2502 (Sized_incremental_binary::setup_readers): Setup input readers
2503 for each input file; build maps for files added from libraries
2505 (Sized_incremental_binary::check_input_args): New function.
2506 (Sized_incremental_binary::do_check_inputs): Build map of argument
2507 serial numbers to input arguments.
2508 (Sized_incremental_binary::do_file_has_changed): Rename
2509 do_file_is_unchanged to this; compare file modification times.
2510 (Sized_incremental_binary::do_init_layout): New function.
2511 (Sized_incremental_binary::do_reserve_layout): New function.
2512 (Sized_incremental_binary::do_get_input_reader): Remove.
2513 (Sized_incremental_binary::get_symtab_view): New function.
2514 (Incremental_checker::can_incrementally_link_output_file): Remove.
2515 (Incremental_inputs::report_command_line): Exclude --debug options.
2516 (Incremental_inputs::report_archive_begin): Add parameter; track
2517 argument serial numbers; don't put input file entry for archive
2518 before archive members.
2519 (Incremental_inputs::report_archive_end): Put input file entry
2520 for archive after archive members.
2521 (Incremental_inputs::report_object): Add parameter; track argument
2522 serial numbers and in_system_directory flag.
2523 (Incremental_inputs::report_script): Add parameter; track argument
2525 (Output_section_incremental_inputs::set_final_data_size): Adjust
2526 size of symbol info entry; check for forwarding symbols.
2527 (Output_section_incremental_inputs::write_input_files): Write
2528 in_system_directory flag and argument serial number.
2529 (Output_section_incremental_inputs::write_info_blocks): Map section
2530 indices between incremental info and original input file; store
2531 input section index for each symbol.
2532 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2533 change operator() to visit().
2534 (class Global_got_offset_visitor): Likewise.
2535 (class Global_symbol_visitor_got_plt):
2536 (Output_section_incremental_inputs::write_got_plt): Use new visitor
2538 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
2539 (Sized_incr_relobj::do_read_symbols): New function.
2540 (Sized_incr_relobj::do_layout): New function.
2541 (Sized_incr_relobj::do_layout_deferred_sections): New function.
2542 (Sized_incr_relobj::do_add_symbols): New function.
2543 (Sized_incr_relobj::do_should_include_member): New function.
2544 (Sized_incr_relobj::do_for_all_global_symbols): New function.
2545 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
2546 (Sized_incr_relobj::do_section_size): New function.
2547 (Sized_incr_relobj::do_section_name): New function.
2548 (Sized_incr_relobj::do_section_contents): New function.
2549 (Sized_incr_relobj::do_section_flags): New function.
2550 (Sized_incr_relobj::do_section_entsize): New function.
2551 (Sized_incr_relobj::do_section_address): New function.
2552 (Sized_incr_relobj::do_section_type): New function.
2553 (Sized_incr_relobj::do_section_link): New function.
2554 (Sized_incr_relobj::do_section_info): New function.
2555 (Sized_incr_relobj::do_section_addralign): New function.
2556 (Sized_incr_relobj::do_initialize_xindex): New function.
2557 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2558 (Sized_incr_relobj::do_read_relocs): New function.
2559 (Sized_incr_relobj::do_gc_process_relocs): New function.
2560 (Sized_incr_relobj::do_scan_relocs): New function.
2561 (Sized_incr_relobj::do_count_local_symbols): New function.
2562 (Sized_incr_relobj::do_finalize_local_symbols): New function.
2563 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2564 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2565 (Sized_incr_relobj::do_relocate): New function.
2566 (Sized_incr_relobj::do_set_section_offset): New function.
2567 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2568 (Sized_incr_dynobj::do_read_symbols): New function.
2569 (Sized_incr_dynobj::do_layout): New function.
2570 (Sized_incr_dynobj::do_add_symbols): New function.
2571 (Sized_incr_dynobj::do_should_include_member): New function.
2572 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
2573 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
2574 (Sized_incr_dynobj::do_section_size): New function.
2575 (Sized_incr_dynobj::do_section_name): New function.
2576 (Sized_incr_dynobj::do_section_contents): New function.
2577 (Sized_incr_dynobj::do_section_flags): New function.
2578 (Sized_incr_dynobj::do_section_entsize): New function.
2579 (Sized_incr_dynobj::do_section_address): New function.
2580 (Sized_incr_dynobj::do_section_type): New function.
2581 (Sized_incr_dynobj::do_section_link): New function.
2582 (Sized_incr_dynobj::do_section_info): New function.
2583 (Sized_incr_dynobj::do_section_addralign): New function.
2584 (Sized_incr_dynobj::do_initialize_xindex): New function.
2585 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
2586 (make_sized_incremental_object): New function.
2587 (Incremental_library::copy_unused_symbols): New function.
2588 (Incremental_library::do_for_all_unused_symbols): New function.
2589 * incremental.h (enum Incremental_input_flags): New type.
2590 (class Incremental_checker): Remove.
2591 (Incremental_input_entry::Incremental_input_entry): Add argument
2593 (Incremental_input_entry::arg_serial): New function.
2594 (Incremental_input_entry::set_is_in_system_directory): New function.
2595 (Incremental_input_entry::is_in_system_directory): New function.
2596 (Incremental_input_entry::arg_serial_): New data member.
2597 (Incremental_input_entry::is_in_system_directory_): New data member.
2598 (class Script_info): Move here from script.h.
2599 (Script_info::Script_info): Add filename parameter.
2600 (Script_info::filename): New function.
2601 (Script_info::filename_): New data member.
2602 (Incremental_script_entry::Incremental_script_entry): Add argument
2604 (Incremental_object_entry::Incremental_object_entry): Likewise.
2605 (Incremental_object_entry::add_input_section): Build list of input
2606 sections with map to original shndx.
2607 (Incremental_object_entry::get_input_section_index): New function.
2608 (Incremental_object_entry::shndx_): New data member.
2609 (Incremental_object_entry::name_key_): Rename; adjust all refs.
2610 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
2611 (Incremental_archive_entry::Incremental_archive_entry): Add argument
2613 (Incremental_inputs::report_archive_begin): Likewise.
2614 (Incremental_inputs::report_object): Likewise.
2615 (Incremental_inputs::report_script): Likewise.
2616 (class Incremental_global_symbol_reader): New class.
2617 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
2618 and store flags and input file type.
2619 (Incremental_input_entry_reader::arg_serial): New function.
2620 (Incremental_input_entry_reader::type): Extract type from flags.
2621 (Incremental_input_entry_reader::is_in_system_directory): New function.
2622 (Incremental_input_entry_reader::get_input_section_count): Call
2623 accessor function for type.
2624 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
2625 function for type; adjust size of global symbol entry.
2626 (Incremental_input_entry_reader::get_global_symbol_count): Call
2627 accessor function for type.
2628 (Incremental_input_entry_reader::get_object_count): Likewise.
2629 (Incremental_input_entry_reader::get_object_offset): Likewise.
2630 (Incremental_input_entry_reader::get_member_count): Likewise.
2631 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
2632 (Incremental_input_entry_reader::get_member_offset): Likewise.
2633 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
2634 (Incremental_input_entry_reader::Global_symbol_info): Remove.
2635 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
2636 (Incremental_input_entry_reader::get_global_symbol_reader): New
2638 (Incremental_input_entry_reader::get_output_symbol_index): New
2640 (Incremental_input_entry_reader::type_): Remove.
2641 (Incremental_input_entry_reader::flags_): New data member.
2642 (Incremental_inputs_reader::input_file_offset): New function.
2643 (Incremental_inputs_reader::input_file_index): New function.
2644 (Incremental_inputs_reader::input_file): Call input_file_offset.
2645 (Incremental_inputs_reader::input_file_at_offset): New function.
2646 (Incremental_relocs_reader::get_r_type): Reformat.
2647 (Incremental_relocs_reader::get_r_shndx): Reformat.
2648 (Incremental_relocs_reader::get_r_offset): Reformat.
2649 (Incremental_relocs_reader::data): New function.
2650 (Incremental_binary::Incremental_binary): Initialize new data members.
2651 (Incremental_binary::check_inputs): Add cmdline parameter.
2652 (Incremental_binary::file_is_unchanged): Remove.
2653 (Input_reader::arg_serial): New function.
2654 (Input_reader::get_unused_symbol_count): New function.
2655 (Input_reader::get_unused_symbol): New function.
2656 (Input_reader::do_arg_serial): New function.
2657 (Input_reader::do_get_unused_symbol_count): New function.
2658 (Input_reader::do_get_unused_symbol): New function.
2659 (Incremental_binary::input_file_count): New function.
2660 (Incremental_binary::get_input_reader): Change signature to use
2661 index instead of filename.
2662 (Incremental_binary::file_has_changed): New function.
2663 (Incremental_binary::get_input_argument): New function.
2664 (Incremental_binary::get_library): New function.
2665 (Incremental_binary::get_script_info): New function.
2666 (Incremental_binary::init_layout): New function.
2667 (Incremental_binary::reserve_layout): New function.
2668 (Incremental_binary::output_file): New function.
2669 (Incremental_binary::do_check_inputs): New function.
2670 (Incremental_binary::do_file_is_unchanged): Remove.
2671 (Incremental_binary::do_file_has_changed): New function.
2672 (Incremental_binary::do_init_layout): New function.
2673 (Incremental_binary::do_reserve_layout): New function.
2674 (Incremental_binary::do_input_file_count): New function.
2675 (Incremental_binary::do_get_input_reader): Change signature.
2676 (Incremental_binary::input_args_map_): New data member.
2677 (Incremental_binary::library_map_): New data member.
2678 (Incremental_binary::script_map_): New data member.
2679 (Sized_incremental_binary::Sized_incremental_binary): Initialize
2681 (Sized_incremental_binary::output_section): New function.
2682 (Sized_incremental_binary::inputs_reader): Add const.
2683 (Sized_incremental_binary::symtab_reader): Add const.
2684 (Sized_incremental_binary::relocs_reader): Add const.
2685 (Sized_incremental_binary::got_plt_reader): Add const.
2686 (Sized_incremental_binary::get_symtab_view): New function.
2687 (Sized_incremental_binary::Inputs_reader): New typedef.
2688 (Sized_incremental_binary::Input_entry_reader): New typedef.
2689 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
2690 (Sized_incremental_binary::do_file_is_unchanged): Remove.
2691 (Sized_incremental_binary::do_file_has_changed): New function.
2692 (Sized_incremental_binary::do_init_layout): New function.
2693 (Sized_incremental_binary::do_reserve_layout): New function.
2694 (Sized_input_reader::Inputs_reader): Remove.
2695 (Sized_input_reader::Input_entry_reader): Remove.
2696 (Sized_input_reader::do_arg_serial): New function.
2697 (Sized_input_reader::do_get_unused_symbol_count): New function.
2698 (Sized_input_reader::do_get_unused_symbol): New function.
2699 (Sized_incremental_binary::do_input_file_count): New function.
2700 (Sized_incremental_binary::do_get_input_reader): Change signature;
2701 use index instead of filename.
2702 (Sized_incremental_binary::section_map_): New data member.
2703 (Sized_incremental_binary::input_entry_readers_): New data member.
2704 (class Sized_incr_relobj): New class.
2705 (class Sized_incr_dynobj): New class.
2706 (make_sized_incremental_object): New function.
2707 (class Incremental_library): New class.
2708 * layout.cc (Free_list::num_lists): New static data member.
2709 (Free_list::num_nodes): New static data member.
2710 (Free_list::num_removes): New static data member.
2711 (Free_list::num_remove_visits): New static data member.
2712 (Free_list::num_allocates): New static data member.
2713 (Free_list::num_allocate_visits): New static data member.
2714 (Free_list::init): New function.
2715 (Free_list::remove): New function.
2716 (Free_list::allocate): New function.
2717 (Free_list::dump): New function.
2718 (Free_list::print_stats): New function.
2719 (Layout_task_runner::run): Resize output file for incremental updates.
2720 (Layout::Layout): Initialize new data members.
2721 (Layout::set_incremental_base): New function.
2722 (Layout::init_fixed_output_section): New function.
2723 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
2724 incremental updates.
2725 (Layout::create_gold_note): Do not create gold note section for
2726 incremental updates.
2727 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
2728 for incremental updates.
2729 (Layout::set_section_offsets): For incremental updates, allocate space
2731 (Layout::create_symtab_sections): Layout with offsets relative to
2732 start of section; for incremental updates, allocate space from free
2734 (Layout::create_shdrs): For incremental updates, allocate space from
2736 (Layout::finish_dynamic_section): For incremental updates, do not
2737 check --as-needed (fixed in subsequent patch).
2738 * layout.h (class Free_list): New class.
2739 (Layout::set_incremental_base): New function.
2740 (Layout::incremental_base): New function.
2741 (Layout::init_fixed_output_section): New function.
2742 (Layout::allocate): New function.
2743 (Layout::incremental_base_): New data member.
2744 (Layout::free_list_): New data member.
2745 * main.cc (main): Print Free_list statistics.
2746 * object.cc (Relobj::finalize_incremental_relocs): Add
2747 clear_counts parameter; clear counts only when clear_counts is set.
2748 (Sized_relobj::Sized_relobj): Initialize new base class.
2749 (Sized_relobj::do_layout): Don't report special sections.
2750 (Sized_relobj::do_for_all_local_got_entries): New function.
2751 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
2752 symtab_off to all symbol table offsets.
2753 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
2754 * object.h (class Got_offset_list): Move to top of file.
2755 (Object::Object): Allow case where input_file == NULL.
2756 (Object::~Object): Likewise.
2757 (Object::input_file): Assert that input_file != NULL.
2758 (Object::lock): Allow case where input_file == NULL.
2759 (Object::unlock): Likewise.
2760 (Object::is_locked): Likewise.
2761 (Object::token): Likewise.
2762 (Object::release): Likewise.
2763 (Object::is_incremental): New function.
2764 (Object::get_mtime): New function.
2765 (Object::for_all_local_got_entries): New function.
2766 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
2767 (Object::set_is_in_system_directory): New function.
2768 (Object::is_in_system_directory): New function.
2769 (Object::do_is_incremental): New function.
2770 (Object::do_get_mtime): New function.
2771 (Object::do_for_all_local_got_entries): New function.
2772 (Object::is_in_system_directory_): New data member.
2773 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
2774 (class Sized_relobj_base): New class.
2775 (class Sized_relobj): Derive from Sized_relobj_base.
2776 (class Sized_relobj::Symbols): Redeclare from base class.
2777 (class Sized_relobj::local_got_offset_list): Remove.
2778 (class Sized_relobj::Output_sections): Redeclare from base class.
2779 (class Sized_relobj::do_for_all_local_got_entries): New function.
2780 (class Sized_relobj::write_local_symbols): Add offset parameter.
2781 (class Sized_relobj::local_symbol_offset_): Update comment.
2782 (class Sized_relobj::local_dynsym_offset_): Update comment.
2783 * options.cc (Input_arguments::add_file): Remove const.
2784 * options.h (Input_file_argument::Input_file_argument):
2785 Initialize arg_serial_ (all constructors).
2786 (Input_file_argument::set_arg_serial): New function.
2787 (Input_file_argument::arg_serial): New function.
2788 (Input_file_argument::arg_serial_): New data member.
2789 (Input_arguments::Input_arguments): Initialize file_count_.
2790 (Input_arguments::add_file): Remove const.
2791 (Input_arguments::number_of_input_files): New function.
2792 (Input_arguments::file_count_): New data member.
2793 (Command_line::number_of_input_files): Call
2794 Input_arguments::number_of_input_files.
2795 * output.cc (Output_segment_headers::Output_segment_headers):
2797 (Output_section::Input_section::current_data_size): New function.
2798 (Output_section::Output_section): Initialize new data members.
2799 (Output_section::add_input_section): Don't do merge sections for
2800 an incremental link; allocate space from free list for an
2802 (Output_section::add_output_section_data): Allocate space from
2803 free list for an incremental update.
2804 (Output_section::update_data_size): New function.
2805 (Output_section::set_fixed_layout): New function.
2806 (Output_section::reserve): New function.
2807 (Output_segment::set_section_addresses): Remove const.
2808 (Output_segment::set_section_list_addresses): Remove const; allocate
2809 space from free list for an incremental update.
2810 (Output_segment::set_offset): Adjust size of RELRO segment for an
2812 * output.h (Output_data::current_data_size): Move here from
2814 (Output_data::pre_finalize_data_size): New function.
2815 (Output_data::update_data_size): New function.
2816 (Output_section_headers::update_data_size): new function.
2817 (Output_section_data_build::current_data_size): Move to Output_data.
2818 (Output_data_strtab::update_data_size): New function.
2819 (Output_section::current_data_size): Move to Output_data.
2820 (Output_section::set_fixed_layout): New function.
2821 (Output_section::has_fixed_layout): New function.
2822 (Output_section::reserve): New function.
2823 (Output_section::update_data_size): New function.
2824 (Output_section::has_fixed_layout_): New data member.
2825 (Output_section::free_list_): New data member.
2826 (Output_segment::set_section_addresses): Remove const.
2827 (Output_segment::set_section_list_addresses): Remove const.
2828 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
2830 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
2832 * readsyms.cc (Read_symbols::do_read_symbols): Add library
2833 parameter when calling Add_symbols constructor; store argument
2834 serial number for members of a lib group.
2835 (Add_symbols::locks): Allow case where token == NULL.
2836 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
2837 (Read_member::~Read_member): New function.
2838 (Read_member::is_runnable): New function.
2839 (Read_member::locks): New function.
2840 (Read_member::run): New function.
2841 (Check_script::~Check_script): New function.
2842 (Check_script::is_runnable): New function.
2843 (Check_script::locks): New function.
2844 (Check_script::run): New function.
2845 (Check_library::~Check_library): New function.
2846 (Check_library::is_runnable): New function.
2847 (Check_library::locks): New function.
2848 (Check_library::run): New function.
2849 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
2850 (Add_symbols::library_): New data member.
2851 (class Read_member): New class.
2852 (class Check_script): New class.
2853 (class Check_library): New class.
2854 * reloc.cc (Read_relocs::is_runnable): Allow case where
2856 (Read_relocs::locks): Likewise.
2857 (Scan_relocs::locks): Likewise.
2858 (Relocate_task::locks): Likewise.
2859 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
2861 (Sized_relobj::incremental_relocs_scan): Fix comment.
2862 (Sized_relobj::do_relocate): Pass output file offset to
2863 write_local_symbols.
2864 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
2865 from class declaration.
2866 * script.cc (read_input_script): Allocate Script_info; pass
2867 argument serial number to report_script.
2868 * script.h (class Script_info): Move to incremental.h.
2869 * symtab.cc (Symbol_table::add_from_incrobj): New function.
2870 * symtab.h (Symbol_table::add_from_incrobj): New function.
2871 (Symbol_table::set_file_offset): New function.
2873 2011-04-05 Cary Coutant <ccoutant@google.com>
2875 * incremental-dump.cc (dump_incremental_inputs): Change signature
2876 to take a Sized_incremental_binary; change caller. Use readers
2877 in Sized_incremental_binary.
2879 (Sized_incremental_binary::find_incremental_inputs_sections):
2880 Rename do_find_incremental_inputs_sections to this.
2881 (Sized_incremental_binary::setup_readers): New function.
2882 (Sized_incremental_binary::do_check_inputs): Check
2883 has_incremental_info_ flag; move setup code to setup_readers;
2885 (Sized_incremental_binary::do_file_is_unchanged): New function.
2886 (Sized_incremental_binary::do_get_input_reader): New function.
2887 * incremental.h (class Incremental_binary): Move to end of file.
2888 (Incremental_binary::file_is_unchanged): New function.
2889 (Incremental_binary::do_file_is_unchanged): New function.
2890 (Incremental_binary::Input_reader): New class.
2891 (Incremental_binary::get_input_reader): New function.
2892 (class Sized_incremental_binary): Move to end of file.
2893 (Sized_incremental_binary::Sized_incremental_binary): Setup the
2894 input section reader classes.
2895 (Sized_incremental_binary::has_incremental_info): New function.
2896 (Sized_incremental_binary::inputs_reader): New function.
2897 (Sized_incremental_binary::symtab_reader): New function.
2898 (Sized_incremental_binary::relocs_reader): New function.
2899 (Sized_incremental_binary::got_plt_reader): New function.
2900 (Sized_incremental_binary::do_file_is_unchanged): New function.
2901 (Sized_incremental_binary::Sized_input_reader): New class.
2902 (Sized_incremental_binary::get_input_reader): New function.
2903 (Sized_incremental_binary::find_incremental_inputs_sections):
2904 Rename do_find_incremental_inputs_sections to this.
2905 (Sized_incremental_binary::setup_readers): New function.
2906 (Sized_incremental_binary::has_incremental_info_): New data member.
2907 (Sized_incremental_binary::inputs_reader_): New data member.
2908 (Sized_incremental_binary::symtab_reader_): New data member.
2909 (Sized_incremental_binary::relocs_reader_): New data member.
2910 (Sized_incremental_binary::got_plt_reader_): New data member.
2911 (Sized_incremental_binary::current_input_file_): New data member.
2913 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
2916 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
2919 2011-03-30 Cary Coutant <ccoutant@google.com>
2921 * archive.cc (Archive::include_member): Adjust call to report_object.
2922 (Add_archive_symbols::run): Add script_info to call to
2923 report_archive_begin.
2924 (Lib_group::include_member): Adjust call to report_object.
2925 (Add_lib_group_symbols::run): Adjust call to report_object.
2926 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
2927 blocks. Add object count for script input files.
2928 * incremental.cc (Incremental_inputs::report_archive_begin): Add
2929 script_info parameter; change all callers.
2930 (Incremental_inputs::report_object): Add script_info parameter;
2932 (Incremental_inputs::report_script): Store backpointer to
2933 incremental info entry.
2934 (Output_section_incremental_inputs::set_final_data_size): Record
2935 additional information for scripts.
2936 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2937 * incremental.h (Incremental_script_entry::add_object): New function.
2938 (Incremental_script_entry::get_object_count): New function.
2939 (Incremental_script_entry::get_object): New function.
2940 (Incremental_script_entry::objects_): New data member; adjust
2942 (Incremental_inputs::report_archive_begin): Add script_info parameter.
2943 (Incremental_inputs::report_object): Add script_info parameter.
2944 (Incremental_inputs_reader::get_object_count): New function.
2945 (Incremental_inputs_reader::get_object_offset): New function.
2946 * options.cc (Input_arguments::add_file): Return reference to
2948 * options.h (Input_argument::set_script_info): New function.
2949 (Input_argument::script_info): New function.
2950 (Input_argument::script_info_): New data member; adjust all
2952 (Input_file_group::add_file): Return reference to new input argument.
2953 (Input_file_lib::add_file): Likewise.
2954 (Input_arguments::add_file): Likewise.
2955 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
2956 * script.cc (Parser_closure::Parser_closure): Add script_info
2957 parameter; adjust all callers.
2958 (Parser_closure::script_info): New function.
2959 (Parser_closure::script_info_): New data member.
2960 (read_input_script): Report scripts earlier to incremental info.
2961 (script_add_file): Set script_info in Input_argument.
2962 (script_add_library): Likewise.
2963 * script.h (Script_options::Script_info): Rewrite class.
2965 2011-03-29 Cary Coutant <ccoutant@google.com>
2967 * archive.cc (Library_base::should_include_member): Move
2968 method here from class Archive.
2969 (Archive::Archive): Initialize base class.
2970 (Archive::should_include_member): Move to base class.
2971 (Archive::do_for_all_unused_symbols): New function.
2972 (Add_archive_symbols::run): Remove redundant access to
2974 (Lib_group::Lib_group): Initialize base class.
2975 (Lib_group::do_filename): New function.
2976 (Lib_group::include_member): Pass pointer to Lib_group to
2978 (Lib_group::do_for_all_unused_symbols): New function.
2979 (Add_lib_group_symbols::run): Report archive information for
2981 * archive.h (class Library_base): New base class.
2982 (class Archive): Derive from Library_base.
2983 (Archive::filename): Move to base class.
2984 (Archive::set_incremental_info): Likewise.
2985 (Archive::incremental_info): Likewise.
2986 (Archive::Should_include): Likewise.
2987 (Archive::should_include_member): Likewise.
2988 (Archive::Armap_entry): Remove.
2989 (Archive::Unused_symbol_iterator): Remove.
2990 (Archive::unused_symbols_begin): Remove.
2991 (Archive::unused_symbols_end): Remove.
2992 (Archive::do_filename): New function.
2993 (Archive::do_get_mtime): New function.
2994 (Archive::do_for_all_unused_symbols): New function.
2995 (Archive::task_): Move to base class.
2996 (Archive::incremental_info_): Likewise.
2997 (class Lib_group): Derive from Library_base.
2998 (Lib_group::do_filename): New function.
2999 (Lib_group::do_get_mtime): New function.
3000 (Lib_group::do_for_all_unused_symbols): New function.
3001 (Lib_group::task_): Move to base class.
3002 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
3004 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
3006 * incremental.cc (Incremental_inputs::report_archive_begin):
3007 Use Library_base; call library's get_mtime; add incremental inputs
3008 entry before members.
3009 (class Unused_symbol_visitor): New class.
3010 (Incremental_inputs::report_archive_end): Use Library_base; use
3011 visitor class to record unused symbols; don't add incremental inputs
3012 entry after members.
3013 (Incremental_inputs::report_object): Use Library_base.
3015 (Incremental_archive_entry::Incremental_archive_entry): Remove
3016 unused Archive parameter.
3017 (Incremental_inputs::report_archive_begin): Use Library_base.
3018 (Incremental_inputs::report_archive_end): Likewise.
3019 (Incremental_inputs::report_object): Likewise.
3020 * object.cc (Sized_relobj::do_for_all_global_symbols): New
3022 * object.h (Object::for_all_global_symbols): New function.
3023 (Object::do_for_all_global_symbols): New function.
3024 (Sized_relobj::do_for_all_global_symbols): New function.
3025 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
3027 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
3030 2011-03-27 Ian Lance Taylor <iant@google.com>
3032 * archive.cc (Archive::interpret_header): Return -1 if something
3033 goes wrong. Change callers accordingly.
3035 2011-03-25 Cary Coutant <ccoutant@google.com>
3037 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
3038 * testsuite/Makefile.in: Regenerate.
3040 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
3042 * plugin.cc (get_view): New.
3043 (Plugin::load): Pass get_view to the plugin.
3044 (Plugin_manager::get_view): New.
3046 2011-03-21 Ian Lance Taylor <iant@google.com>
3048 * testsuite/final_layout.sh: Rewrite to not use dc.
3049 * testsuite/relro_test.sh: Fail if dc is not present.
3051 2011-03-21 Sriraman Tallam <tmsriram@google.com>
3053 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
3055 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
3056 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
3058 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
3059 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
3061 2011-03-14 Ian Lance Taylor <iant@google.com>
3063 * script-sections.cc (Sort_output_sections::script_compare):
3064 Rename from is_before, change return type.
3065 (Sort_output_sections::operator()): Adjust accordingly.
3067 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
3070 * testsuite/odr_violation2.cc: Add comment to make all error line
3071 numbers double digits.
3072 * testsuite/debug_msg.sh: Adjust expected errors.
3074 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
3076 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
3077 but mark earlier ones as non-canonical
3078 (offset_to_iterator): Update search target and example
3079 (do_addr2line): Return extra lines in a vector*
3080 (format_file_lineno): Extract from do_addr2line
3081 (one_addr2line): Add vector* out-param
3082 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
3083 when a lineno entry appeared last for its instruction
3084 (Dwarf_line_info): Add vector* out-param
3085 * object.cc (Relocate_info): Pass NULL for the vector* out-param
3086 * symtab.cc (Odr_violation_compare): Include the lineno in the
3088 (linenos_from_loc): New. Combine the canonical line for an
3089 address with its other lines.
3090 (True_if_intersect): New. Helper functor to make
3091 std::set_intersection a query.
3092 (detect_odr_violations): Compare sets of lines instead of just
3093 one line for each function. This became less deterministic, but
3094 has fewer false positives.
3095 * symtab.h: Declarations.
3096 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
3097 mix an optimized and non-optimized object in the same binary
3098 (odr_violation2.so): Same.
3099 * testsuite/Makefile.in: Regenerate from Makefile.am.
3100 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
3101 * testsuite/debug_msg.sh: Update line numbers and add
3103 * testsuite/odr_violation1.cc: Use OdrDerived, in a
3104 non-optimized context.
3105 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
3106 isn't inlined, and use OdrDerived in an optimized context.
3107 * testsuite/odr_header1.h: Defines OdrDerived, where
3108 optimization will change the
3109 first-instruction-in-the-destructor's file and line number.
3110 * testsuite/odr_header2.h: Defines OdrBase.
3112 2011-03-09 Ian Lance Taylor <iant@google.com>
3114 * fileread.cc (File_read::clear_views): Don't delete the whole
3117 2011-03-08 Ian Lance Taylor <iant@google.com>
3120 * fileread.cc: #include <climits>.
3121 (GOLD_IOV_MAX): Define.
3122 (File_read::read_multiple): Limit number of entries by iov_max.
3123 * fileread.h (class File_read): Always set max_readv_entries to
3126 2011-03-07 Ian Lance Taylor <iant@google.com>
3129 * options.h (class General_options): Add -dy and -dn.
3131 2011-03-02 Cary Coutant <ccoutant@google.com>
3133 * testsuite/script_test_9.t: Add TLS segment.
3135 2011-03-02 Simon Baldwin <simonb@google.com>
3137 * configure.ac: Add check for gnu_indirect_function support in
3138 the toolchain building binutils.
3139 * configure: Rebuild.
3141 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
3143 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
3144 plugin only symbols.
3145 (Symbol_table::sized_finalize_symbol) Mark symbol only present
3146 in plugin files as not needed in the symbol table.
3148 2011-02-11 Sriraman Tallam <tmsriram@google.com>
3150 * output.cc (Output_section::add_input_section): Delay fill
3151 generation for section ordering.
3153 2011-02-09 Ian Lance Taylor <iant@google.com>
3156 * object.h (class Sized_relobj): Remove clear_local_symbols.
3157 * reloc.cc (Sized_relobj::do_relocate): Don't call
3158 clear_local_symbols.
3160 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
3162 * plugin.cc (is_visible_from_outside): Return true for symbols
3165 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
3167 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
3170 2011-02-02 Sriraman Tallam <tmsriram@google.com>
3172 * icf.h (is_section_foldable_candidate): Change type of parameter
3174 * icf.cc (Icf::find_identical_sections): Change type of local variable
3175 section_name to be std::string.
3176 (is_function_ctor_or_dtor): Change type of parameter to std::string.
3178 2011-01-25 Ian Lance Taylor <iant@google.com>
3180 * script.cc (script_add_extern): Rewrite to use
3181 add_symbol_reference.
3183 2011-01-25 Doug Kwan <dougkwan@google.com>
3185 * icf.cc (get_section_contents): Always lock section's object.
3187 2011-01-24 Ian Lance Taylor <iant@google.com>
3189 * options.h (class General_options): Accept
3190 --no-detect-odr-violations.
3192 2011-01-24 Ian Lance Taylor <iant@google.com>
3194 * version.cc (version_string): Bump to 1.11.
3196 2011-01-24 Ian Lance Taylor <iant@google.com>
3198 * plugin.cc (class Plugin_rescan): Define new class.
3199 (Plugin_manager::claim_file): Set any_claimed_.
3200 (Plugin_manager::save_archive): New function.
3201 (Plugin_manager::save_input_group): New function.
3202 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
3204 (Plugin_manager::new_undefined_symbol): New function.
3205 (Plugin_manager::rescan): New function.
3206 (Plugin_manager::rescannable_defines): New function.
3207 (Plugin_manager::add_input_file): Set any_added_.
3208 * plugin.h (class Plugin_manager): define new fields rescannable_,
3209 undefined_symbols_, any_claimed_, and any_added_. Declare
3210 Plugin_rescan as friend. Declare new functions.
3211 (Plugin_manager::Rescannable): Define type.
3212 (Plugin_manager::Rescannable_list): Define type.
3213 (Plugin_manager::Undefined_symbol_list): Define type.
3214 (Plugin_manager::Plugin_manager): Initialize new fields.
3215 * archive.cc (Archive::defines_symbol): New function.
3216 (Add_archive_symbols::run): Pass archive to plugins if any.
3217 * archive.h (class Archive): Declare defines_symbol.
3218 * readsyms.cc (Input_group::~Input_group): New function.
3219 (Finish_group::run): Pass input_group to plugins if any.
3220 * readsyms.h (class Input_group): Declare destructor.
3221 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
3224 2011-01-10 Ian Lance Taylor <iant@google.com>
3226 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
3228 (Layout::set_segment_offsets): Reset increase_relro before calling
3229 set_section_addresses a second time.
3231 2011-01-04 Cary Coutant <ccoutant@google.com>
3233 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
3234 sections before NOBITS sections.
3236 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
3238 * version.cc (print_version): Update copyright to 2011.
3240 2010-12-23 Cary Coutant <ccoutant@google.com>
3242 * output.h (Output_data_reloc::add_output_section): Pass OD instead
3243 of OS to this->add. Add OD parameter to second form of the function.
3245 2010-12-20 Ian Lance Taylor <iant@google.com>
3247 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
3248 second of two consecutive entries with same offset.
3250 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3252 * testsuite/Makefile.am (ifuncmain2static_LDADD)
3253 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
3254 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
3255 to avoid unneeded links against $(LDADD).
3256 * testsuite/Makefile.in: Regenerate.
3258 2010-12-15 Ian Lance Taylor <iant@google.com>
3261 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
3262 for R_X86_64_32 and R_X86_64_PC32.
3263 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
3264 ver_matching_def_pic.o.
3265 (ver_matching_def_pic.o): New target.
3267 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3269 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
3270 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
3271 Move definition before File_read::View member definitions.
3272 (File_read::View::~View): Initialize and hold lock before
3273 updating current_mapped_bytes.
3275 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3277 * dwarf_reader.cc: Remove outdated comment.
3278 * gold-threads.cc: Fix typo in error message.
3279 * archive.cc: Fix typos in comments.
3280 * archive.h: Likewise.
3281 * arm-reloc-property.cc: Likewise.
3282 * arm-reloc-property.h: Likewise.
3283 * arm-reloc.def: Likewise.
3285 * attributes.h: Likewise.
3286 * cref.cc: Likewise.
3287 * ehframe.cc: Likewise.
3288 * fileread.h: Likewise.
3290 * i386.cc: Likewise.
3292 * incremental.h: Likewise.
3293 * int_encoding.cc: Likewise.
3294 * layout.h: Likewise.
3295 * main.cc: Likewise.
3296 * merge.h: Likewise.
3297 * object.cc: Likewise.
3298 * object.h: Likewise.
3299 * options.cc: Likewise.
3300 * readsyms.cc: Likewise.
3301 * reduced_debug_output.cc: Likewise.
3302 * reloc.cc: Likewise.
3303 * script-sections.cc: Likewise.
3304 * sparc.cc: Likewise.
3305 * symtab.h: Likewise.
3306 * target-reloc.h: Likewise.
3307 * target.cc: Likewise.
3308 * target.h: Likewise.
3309 * timer.cc: Likewise.
3310 * timer.h: Likewise.
3311 * x86_64.cc: Likewise.
3313 2010-12-09 Cary Coutant <ccoutant@google.com>
3315 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
3317 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
3318 parameter; change all callers.
3319 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
3320 * options.h (warn_execstack): New option.
3322 2010-12-07 Doug Kwan <dougkwan@google.com>
3324 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
3325 like function call relocations.
3327 2010-12-07 Ian Lance Taylor <iant@google.com>
3329 * archive.cc (Archive::get_elf_object_for_member): Permit
3330 punconfigured to be NULL.
3331 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
3332 (Archive::include_member): Pass NULL to get_elf_object_for_member
3333 if we searched for the archive and this is the first included
3336 2010-12-01 Ian Lance Taylor <iant@google.com>
3338 * dwarf_reader.h (class Sized_dwarf_line_info): Add
3339 track_relocs_type_ field.
3340 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3341 Set track_relocs_type_.
3342 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
3343 contents when using RELA relocs.
3344 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
3346 * reloc.cc (Track_relocs::next_addend): New function.
3347 * reloc.h (class Track_relocs): Declare next_addend.
3349 2010-12-01 Ian Lance Taylor <iant@google.com>
3351 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
3354 2010-12-01 Ian Lance Taylor <iant@google.com>
3356 * README: Update compilers known to work and fail.
3358 2010-11-23 Matthias Klose <doko@ubuntu.com>
3360 * configure.in: For --enable-gold, handle value `default' instead of
3361 `both*'. Always install ld as ld.bfd, install as ld if gold is
3363 * configure: Regenerate.
3365 2010-11-18 Doug Kwan <dougkwan@google.com>
3367 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
3368 and right_alignment to be zero. Store result alignment only if it is
3369 greater than existing alignment.
3371 2010-11-16 Cary Coutant <ccoutant@google.com>
3374 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3375 Check for ".zdebug_line".
3377 2010-11-16 Doug Kwan <dougkwan@google.com>
3378 Cary Coutant <ccoutant@google.com>
3380 * output.h (Output_segment::set_section_addresses): Pass increase_relro
3381 by reference; adjust all callers.
3382 * output.cc (Output_segment::set_section_addresses): Adjust references
3383 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
3385 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
3386 end at page boundary.
3388 2010-11-16 Cary Coutant <ccoutant@google.com>
3391 * layout.cc (Layout::choose_output_section): Transform names of
3392 compressed sections even when using a script with a SECTIONS clause.
3393 (Layout::output_section_name): Remove code to transform
3394 compressed debug section names.
3395 * output.cc (Output_section::add_input_section): Use uncompressed
3396 section size when tracking input sections.
3398 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
3400 * symtab.h (Symbol::NON_PIC_REF): Remove.
3401 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
3402 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
3403 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
3404 (Symbol::use_plt_offset): Take a flags argument and pass it
3405 directly to needs_dynamic_reloc. Restrict check for undefined
3406 weak symbols to function calls.
3407 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
3408 (Target_arm::Scan::global): Use it.
3409 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
3410 (Target_arm::Relocate::relocate): Likewise.
3411 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
3412 parameter with an r_type parameter. Use get_reference_flags
3414 (Target_arm::Relocate::relocate): Update accordingly.
3415 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
3416 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
3417 (Target_i386::Scan::global): Likewise.
3418 (Target_i386::Relocate::relocate): Likewise.
3419 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
3420 parameter with an r_type parameter. Use get_reference_flags
3422 (Target_i386::Relocate::relocate): Update accordingly.
3423 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
3424 (Target_powerpc::Scan::global): Use it.
3425 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
3426 (Target_powerpc::Relocate::relocate): Likewise.
3427 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
3428 (Target_sparc::Scan::global): Use it.
3429 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
3430 (Target_sparc::Relocate::relocate): Likewise.
3431 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
3432 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
3433 (Target_x86_64::Scan::global): Likewise.
3434 (Target_x86_64::Relocate::relocate): Likewise.
3436 2010-11-08 Doug Kwan <dougkwan@google.com>
3437 Cary Coutant <ccoutant@google.com>
3439 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
3440 (Arm_exidx_merge_section::section_contents_): New data member.
3441 (Arm_input_section::Arm_input_section): Initialize original_contents_.
3442 (Arm_input_section::~Arm_input_section): De-allocate memory.
3443 (Arm_input_section::original_contents_): New data member.
3444 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
3445 in parameters instead of calling Object::section_contents without
3447 (Arm_output_section::group_section): New parameter TASK. Pass it
3448 to callees that need locking objects.
3449 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
3450 to lock EXIDX input sections. Fix a formatting issue. Call
3451 Arm_exidx_merged_section::build_contents to create merged section
3453 (Arm_output_section::create_stub_group): New parameter TASK. Use it
3454 to lock object of stub table owner.
3455 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
3456 TEXT_SIZE to initialize data member TEXT_SIZE_.
3457 (Arm_exidx_input_section::addralign): Fix typo in comment.
3458 (Arm_exidx_input_section::text_size): New method.
3459 (Target_arm::do_relax): New parameter TASK. Pass it to callees
3460 that require locking objects. Lock objects before scanning for stubs
3461 and updating local symbols.
3462 (Arm_input_section<big_endian>::init): Copy contents of original
3464 (Arm_input_section<big_endian>::do_write): Use saved contents of
3465 original input section instead of calling Object::section_contents
3467 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
3468 size without calling Object::section_size().
3469 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
3470 for size. Allocate a buffer for merged EXIDX entries.
3471 (Arm_exidx_merged_section::build_contents): New method.
3472 (Arm_exidx_merged_section::do_write): Move merge section contents
3473 building code to Arm_exidx_merged_section::build_contetns. Write
3474 out contetns in buffer instead of building it on the fly.
3475 (Arm_relobj::make_exidx_input_section): Also pass text section size
3476 to Arm_exidx_input_section constructor.
3477 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
3478 (Arm_dynobj::do_read_symbols): Fix memory leak.
3479 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
3480 * target.h: (class Task): Add forward declaration.
3481 (Target::relax): Add new parameter TASK and pass it to
3483 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
3485 2010-11-05 Cary Coutant <ccoutant@google.com>
3488 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
3489 object when reading from the file.
3490 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
3492 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
3493 when reading section contents.
3494 (get_section_contents): Likewise.
3495 (icf::find_identical_sections): Likewise.
3496 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
3497 object when reading from the file.
3498 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
3499 the object when doing deferred section layout.
3501 2010-11-03 Nick Clifton <nickc@redhat.com>
3504 * script.h (class Symbol_assignment: name): New member. Returns
3505 the name of the symbol.
3506 * scrfipt.cc (Script_options::is_pending_assignment): New member.
3507 Returns true if the given symbol name is on the list of
3508 assignments wating to be processed.
3509 * archive.cc (should_incldue_member): If the symbol is undefined,
3510 check to see if it is on the list of symbols pending assignment.
3512 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
3514 * script-sections.cc (Script_sections::find_memory_region): Check
3515 for a NULL output section pointer.
3517 2010-10-29 Doug Kwan <dougkwan@google.com>
3519 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3520 Output_section::add_relaxed_input_section.
3521 * output.cc (Output_section::add_relaxed_input_section): Add new
3522 arguments LAYOUT and NAME. Set section order index.
3523 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3524 Copy section order index.
3525 * output.h (Output_section::add_relaxed_input_section): Add new
3526 arguments LAYOUT and NAME.
3528 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3530 * testsuite/Makefile.am: Move gcctestdir/ld rule to
3531 NATIVE_OR_CROSS_LINKER.
3532 * testsuite/Makefile.in: Regenerate.
3534 2010-10-20 Doug Kwan <dougkwan@google.com>
3536 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
3537 without SHF_LINK_ORDER flags.
3538 * layout.cc (Layout::choose_output_section): Do not filter
3539 SHF_LINK_ORDER flag in a relocatable link.
3541 2010-10-17 Cary Coutant <ccoutant@google.com>
3543 * output.h (Output_segment::set_section_addresses): Change function
3544 signature. Update all callers.
3545 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
3547 (Output_segment::set_section_addresses): Align after last TLS
3548 section. Add padding before last relro section instead of after.
3550 2010-10-17 Doug Kwan <dougkwan@google.com>
3552 * gold/arm.cc (Target_arm::got_section): Use correct order and set
3553 GOT output section to be writable.
3555 2010-10-14 Cary Coutant <ccoutant@google.com>
3557 * debug.h (DEBUG_INCREMENTAL): New flag.
3558 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3559 * gold.cc (queue_initial_tasks): Check parameters for incremental link
3561 * incremental.cc (report_command_line): Ignore all forms of
3563 * layout.cc (Layout::Layout): Check parameters for incremental link
3565 * options.cc (General_options::parse_incremental): New function.
3566 (General_options::parse_no_incremental): New function.
3567 (General_options::parse_incremental_full): New function.
3568 (General_options::parse_incremental_update): New function.
3569 (General_options::incremental_mode_): New data member.
3570 (General_options::finalize): Check incremental_mode_.
3571 * options.h (General_options): Update help text for --incremental.
3572 Add --no-incremental, --incremental-full, --incremental-update.
3573 (General_options::Incremental_mode): New enum type.
3574 (General_options::incremental_mode): New function.
3575 (General_options::incremental_mode_): New data member.
3576 * parameters.cc (Parameters::incremental_mode_): New data member.
3577 (Parameters::set_options): Set incremental_mode_.
3578 (Parameters::set_incremental_full): New function.
3579 (Parameters::incremental): New function.
3580 (Parameters::incremental_update): New function.
3581 (set_parameters_incremental_full): New function.
3582 * parameters.h (Parameters::set_incremental_full): New function.
3583 (Parameters::incremental): New function.
3584 (Parameters::incremental_update): New function.
3585 (Parameters::incremental_mode_): New data member.
3586 (set_parameters_incremental_full): New function.
3587 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
3588 incremental link mode.
3589 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
3590 (Sized_relobj::do_relocate_sections): Likewise.
3591 * testsuite/Makefile.am (incremental_test): Use --incremental-full
3593 * testsuite/Makefile.in: Regenerate.
3594 * testsuite/incremental_test.sh: Filter all forms of --incremental.
3596 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3598 * script-sections.h (class Script_sections): Make
3599 Sections_elements typedef public.
3600 * script-sections.cc (class Sort_output_sections): Add elements_
3601 field. Add constructor which sets it; change all callers.
3602 (Sort_output_sections::is_before): New function.
3603 (Sort_output_sections::operator()): Call is_before.
3604 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
3606 * testsuite/script_test_10.sh: New test. Test script section
3608 * testsuite/script_test_10.t: Likewise.
3609 * testsuite/script_test_10.s: Likewise.
3610 * testsuite/Makefile.am: Wrap the cross linker tests and the
3611 common tests into NATIVE_OR_CROSS_LINKER.
3612 (check_SCRIPTS): Add script_test_10.sh.
3613 (check_DATA): Add script_test_10.stdout.
3614 (script_test_10.o, script_test_10): New targets.
3615 (script_test_10.stdout): New target.
3616 * configure, testsuite/Makefile.in: Regenerate.
3618 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3620 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
3621 error for the deprecated relocations.
3622 (Target_arm::Scan::global): Likewise.
3623 (Target_arm::Relocate::relocate): Likewise.
3625 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
3627 * fileread.cc (Input_file::find_file): Initialize *found_name
3628 and *namep when using the fallback search for case 4.
3630 2010-10-11 Cary Coutant <ccoutant@google.com>
3632 * options.h (class General_options): Redefine -z lazy as an alias for
3633 the negation of -z now.
3635 2010-10-11 Ian Lance Taylor <iant@google.com>
3637 * resolve.cc (symbol_to_bits): Report the value of the unsupported
3640 2010-10-06 Nick Clifton <nickc@redhat.com>
3642 * script-sections.cc(class Memory_region): Remove
3643 current_lma_offset_ field. Rename current_vma_offset_ to
3644 current_offset_. Add last_section_ field.
3645 (Memory_region::get_current_vma_address): Rename to
3646 get_current_address.
3647 (Memory_region::get_current_lma_address): Delete.
3648 (Memory_region::increment_vma_offset): Rename to
3650 (Memory_region::increment_lma_offset): Delete.
3651 (Memory_region::attributes_compatible): New method. Returns
3652 true if the provided section is compatible with the region.
3653 (Memory_region::get_last_section): New method. Returns the last
3654 section to use the region.
3655 (Memory_region::set_last_section): New method. Stores the last
3656 section to use the region.
3657 (Script_sections::block_in_region): New method. Returns true if
3658 a block of memory is contained within a region.
3659 (Script_sections::find_memory_region): New method. Locates a
3660 memory region to be used to set a VMA or LMA address.
3661 (Output_section_definition::set_section_addresses): Add code to
3662 check for addresses set by memory regions.
3663 (Output_segment::set_section_addresses): Remove memory region
3665 (Script_sections::create_segment): Add a warning if a header
3666 segment is created outside of any region.
3667 * script-sections.h (class Script_sections): Add prototypes for
3668 find_memory_region and block_in_region methods.
3669 * testsuite/memory_test.s: Use .long instead of .word.
3670 * testsuite/memory_test.t: Add some more output sections.
3671 * testsuite/memory_test.sh: Update expected output.
3673 2010-10-02 Doug Kwan <dougkwan@google.com>
3675 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
3676 defintion to symtab.h
3677 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
3678 declaration to defintion.
3680 2010-10-01 Nick Clifton <nickc@redhat.com>
3682 * expression.cc (eval): Replace dummy argument with NULL.
3683 (eval_maybe_dot): Check for a NULL result section pointer.
3684 (Symbol_expression::value): Likewise.
3685 (Dot_expression::value): Likewise.
3686 (BINARY_EXPRESSION): Likewise.
3687 (Max_expression::value): Likewise.
3688 (Min_expression::value): Likewise.
3689 (Absolute_expression::value): Likewise.
3690 (Addr_expression::value_from_output_section): Likewise.
3691 (Loaddddr_expression::value_from_output_section): Likewise.
3692 (Segment_start_expression::value): Likewise.
3693 * script-sections.cc
3694 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
3696 (Sections_elememt_dot_assignment::set_section_addresses):
3698 (Output_data_expression::do_write_to_buffer): Likewise.
3699 (Output_section_definition::finalize_symbols): Likewise.
3700 (Output_section_definition::set_section_addresses): Likewise.
3702 2010-09-30 Doug Kwan <dougkwan@google.com>
3704 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
3706 2010-09-28 Sriraman Tallam <tmsriram@google.com>
3708 * target.h (Target::can_icf_inline_merge_sections): New virtual
3710 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
3712 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
3714 * icf.cc (get_section_contents): Inline merge sections only when
3717 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3719 * configure: Regenerate.
3721 2010-09-17 Ian Lance Taylor <iant@google.com>
3723 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
3724 * testsuite/Makefile.am (memory_test.o): New target.
3725 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
3727 * testsuite/Makefile.in: Rebuild.
3729 2010-09-17 Doug Kwan <dougkwan@google.com>
3731 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
3732 defintion if relocation uses GOT entries of the symbol.
3733 * testsuite/icf_safe_test.sh: Fix test.
3734 * testsuite/icf_safe_so_test.sh: Fix test.
3736 2010-09-16 Cary Coutant <ccoutant@google.com>
3738 * script_sections.cc (class Memory_region): Remove "NULL" from
3739 vector initializations.
3741 2010-09-15 Cary Coutant <ccoutant@google.com>
3743 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
3744 Resolve forwarding symbols.
3746 2010-09-15 Doug Kwan <dougkwan@google.com>
3748 * gold/testsuite/script_test_3.t: Add ARM special sections.
3749 * gold/testsuite/script_test_4.t: Same.
3750 * gold/testsuite/script_test_5.t: Same.
3751 * gold/testsuite/script_test_6.t: Same.
3752 * gold/testsuite/script_test_7.t: Same.
3753 * gold/testsuite/script_test_7.t: Same.
3754 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
3756 2010-09-14 Cary Coutant <ccoutant@google.com>
3758 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
3759 (Target_x86_64::Relocate::relocate_tls): Replace check for
3760 saw_tls_block_reloc_ with test for executable section.
3762 2010-09-12 Cary Coutant <ccoutant@google.com>
3764 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
3765 position-independent executables to shared libraries need dynamic
3767 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
3768 position-independent executables.
3769 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
3770 * testsuite/Makefile.in: Regenerate.
3772 2010-09-10 Nick Clifton <nickc@redhat.com>
3775 * testsuite/memory_test.t: Discard any sections that are not
3778 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
3781 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
3782 "This::" to work around a bug in gcc 4.2.
3784 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
3786 2010-09-09 Rafael Espindola <espindola@google.com>
3788 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
3789 sections with different PF_X flags in the same segment.
3790 (Layout::find_first_load_seg): Search all segments to find the first
3792 * options.h (rosegment): New.
3794 2010-09-08 Rafael Espindola <espindola@google.com>
3796 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
3798 2010-09-08 Doug Kwan <dougkwan@google.com>
3800 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
3801 (Arm_relobj::do_relocate_sections): Add new parameter for output
3802 file to match the parent.
3803 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
3804 of local symbols instead of input values. Update code to track
3805 changes in gold::relocate_section.
3806 * object.cc (Sized_relobj::compute_final_local_value): New methods.
3807 (Sized_relobj::compute_final_local_value_internal): New methods.
3808 (Sized_relobj::do_finalize_local_symbols): Move code from loop
3809 body into private version of Sized_relobj::compute_final_local_value.
3810 Call the inline method.
3811 * object.h (Symbol_value::Symbol_value): Define destructor. Free
3812 merged symbol value if there is one.
3813 (Symbol_value::has_output_value): New method defintiion.
3814 (Sized_relobj::Compute_final_local_value_status): New enum type.
3815 (Sized_relobj::compute_final_local_value): New methods.
3816 (Sized_relobj::compute_final_local_value_internal): New methods.
3817 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
3818 and arm_cortex_a8.sh.
3819 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
3820 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
3822 * Makefile.in: Regenerate.
3823 * testsuite/arm_bl_out_of_range.s: Update test.
3824 * testsuite/thumb_bl_out_of_range.s: Ditto.
3825 * testsuite/thumb_blx_out_of_range.s: Ditto.
3826 * testsuite/arm_branch_out_of_range.sh: New file.
3827 * testsuite/arm_cortex_a8.sh: Ditto.
3828 * testsuite/arm_cortex_a8_b.s: Ditto.
3829 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
3830 * testsuite/arm_cortex_a8_b_local.s: Ditto.
3831 * testsuite/arm_cortex_a8_bl.s: Ditto.
3832 * testsuite/arm_cortex_a8_blx.s: Ditto.
3833 * testsuite/arm_cortex_a8_local.s: Ditto.
3834 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
3835 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
3837 2010-09-08 Rafael Espindola <espindola@google.com>
3839 * Makefile.am (memory_test.stdout): Run readelf with -W.
3840 * Makefile.in: Regenerate.
3841 * testsuite/memory_test.sh: Make the regexps accept both 32 and
3844 2010-09-08 Rafael Espindola <espindola@google.com>
3846 * script-sections.cc (Script_sections::add_memory_region): Convert
3847 field precision to int.
3848 * script.cc (script_set_section_region, script_set_section_region):
3849 Convert field precision to int.
3851 2010-09-08 Rafael Espindola <espindola@google.com>
3853 * arm.cc (do_finalize_sections): Create the __exidx_start and
3854 __exdix_end symbols even when the section is missing.
3856 2010-09-08 Nick Clifton <nickc@redhat.com>
3858 * README: Remove claim that MEMORY is not supported.
3859 * expression.cc (script_exp_function_origin)
3860 (script_exp_function_length): Move from here to ...
3861 * script.cc: ... here.
3862 (script_set_section_region, script_add_memory)
3863 (script_parse_memory_attr, script_include_directive): New
3865 * script-sections.cc
3866 (class Memory_region): New class.
3867 (class Output_section_definition): Add set_memory_region,
3868 set_section_vma, set_section_lma and get_section_name methods.
3869 (class Script_Sections): Add add_memory_region,
3870 find_memory_region, find_memory_region_origin,
3871 find_memory_region_length and set_memory_region methods.
3872 Have set_section_addresses method walk the list of set memory
3874 Extend the print methos to display memory regions.
3875 * script-sections.h: Add prototypes for new methods.
3876 Add enum for MEMORY region attributes.
3877 * yyscript.y: Add support for parsing MEMORY regions.
3878 * script-c.h: Add prototypes for new functions.
3879 * testsuite/Makefile.am: Add test of MEMORY region functionality.
3880 * testsuite/Makefile.in: Regenerate.
3881 * testsuite/memory_test.sh: New script.
3882 * testsuite/memory_test.s: New assembler source file.
3883 * testsuite/memory_test.t: New linker script.
3885 2010-08-27 Doug Kwan <dougkwan@google.com>
3887 * gold/resolve.cc (Symbol_table::should_override): Let a weak
3888 reference override an existing dynamic weak reference.
3889 * testsuite/Makefile.am: Add new test dyn_weak_ref.
3890 * testsuite/Makefile.in: Regenerate.
3891 * testsuite/dyn_weak_ref.sh: New file.
3892 * testsuite/dyn_weak_ref_1.c: Ditto.
3893 * testsuite/dyn_weak_ref_2.c: Ditto.
3895 2010-08-27 Ian Lance Taylor <iant@google.com>
3897 * incremental.h (class Incremental_input_entry): Add virtual
3900 2010-08-27 Ian Lance Taylor <iant@google.com>
3902 * testsuite/start_lib_test_3.c: Mark t3 as used.
3904 2010-08-27 Nick Clifton <nickc@redhat.com>
3906 * options.cc (version_script): Fix small typo in previous
3909 2010-08-25 Nick Clifton <nickc@redhat.com>
3911 * archive.cc: Formatting fixes: Remove whitespace between
3912 typename and following asterisk. Remove whitespace between
3913 function name and opening parenthesis.
3914 * archive.h: Likewise.
3916 * attributes.cc: Likewise.
3917 * attributes.h: Likewise.
3918 * common.cc: Likewise.
3919 * copy-relocs.cc: Likewise.
3920 * dirsearch.h: Likewise.
3921 * dynobj.cc: Likewise.
3922 * ehframe.cc: Likewise.
3923 * ehframe.h: Likewise.
3924 * expression.cc: Likewise.
3925 * fileread.cc: Likewise.
3926 * fileread.h: Likewise.
3928 * gold-threads.cc: Likewise.
3929 * gold.cc: Likewise.
3930 * i386.cc: Likewise.
3932 * incremental-dump.cc: Likewise.
3933 * incremental.cc: Likewise.
3934 * layout.cc: Likewise.
3935 * layout.h: Likewise.
3936 * main.cc: Likewise.
3937 * merge.cc: Likewise.
3938 * merge.h: Likewise.
3939 * object.cc: Likewise.
3940 * object.h: Likewise.
3941 * options.cc: Likewise.
3942 * options.h: Likewise.
3943 * output.cc: Likewise.
3944 * output.h: Likewise.
3945 * plugin.cc: Likewise.
3946 * plugin.h: Likewise.
3947 * powerpc.cc: Likewise.
3948 * reloc.cc: Likewise.
3949 * script-c.h: Likewise.
3950 * script-sections.cc: Likewise.
3951 * script.cc: Likewise.
3952 * stringpool.cc: Likewise.
3953 * symtab.cc: Likewise.
3954 * symtab.h: Likewise.
3955 * target.cc: Likewise.
3956 * timer.cc: Likewise.
3957 * timer.h: Likewise.
3958 * version.cc: Likewise.
3959 * x86_64.cc: Likewise.
3961 2010-08-24 Nick Clifton <nickc@redhat.com>
3964 * layout.cc (segment_precedes): Sort segments by their physical
3965 addresses, if they have been set.
3967 2010-08-23 Cary Coutant <ccoutant@google.com>
3969 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
3971 (Lib_group::include_member): Unlock object after deleting its
3973 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
3976 2010-08-19 Neil Vachharajani <nvachhar@google.com>
3977 Cary Coutant <ccoutant@google.com>
3979 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
3980 constructor, and set_blocker.
3981 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
3983 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
3984 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
3985 * testsuite/Makefile.am (start_lib_test): New test case.
3986 * testsuite/Makefile.in: Regenerate.
3987 * testsuite/start_lib_test_main.c: New file.
3988 * testsuite/start_lib_test_1.c: New file.
3989 * testsuite/start_lib_test_2.c: New file.
3990 * testsuite/start_lib_test_3.c: New file.
3992 2010-08-19 Ian Lance Taylor <iant@google.com>
3994 * Makefile.in: Rebuild with automake 1.11.1.
3995 * aclocal.m4: Likewise.
3996 * testsuite/Makefile.in: Likewise.
3998 2010-08-19 Ian Lance Taylor <iant@google.com>
4001 * i386.cc (class Output_data_plt_i386): Update declarations.
4002 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
4003 local_ifuncs_ fields.
4004 (Target_i386::do_plt_section_for_global): New function.
4005 (Target_i386::do_plt_section_for_local): New function.
4006 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
4007 parameter; change all callers. Initialize global_ifuncs_ and
4008 local_ifuncs_. If doing a static link define __rel_iplt_start and
4010 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
4011 (Output_data_plt_i386::add_local_ifunc_entry): New function.
4012 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
4014 (Target_i386::make_plt_section): New function, broken out of
4015 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
4016 (Target_i386::make_plt_entry): Call make_plt_section.
4017 (Target_i386::make_local_ifunc_plt_entry): New function.
4018 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
4019 (Target_i386::Scan::local): Handle IFUNC symbols. Add
4020 R_386_IRELATIVE to switch.
4021 (Target_i386::Scan::global): Likewise.
4022 (Target_i386::Relocate::relocate): Likewise.
4023 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
4025 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
4026 (Target_x86_64::do_plt_section_for_global): New function.
4027 (Target_x86_64::do_plt_section_for_local): New function.
4028 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
4029 parameter; change all callers. If doing a static link define
4030 __rela_iplt_start and __rela_iplt_end.
4031 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
4032 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
4033 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
4035 (Target_x86_64::make_local_ifunc_plt_entry): New function.
4036 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
4038 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
4039 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
4040 R_X86_64_IRELATIVE to switch.
4041 (Target_x86_64::Scan::global): Likewise.
4042 (Target_x86_64::Relocate::relocate): Likewise.
4043 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
4045 * target.h (class Target): Add plt_section_for_global and
4046 plt_section_for_local functions. Add do_plt_section_for_global
4047 and do_plt_section_for_local virtual functions.
4048 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
4049 clarifying comments.
4050 (Symbol::use_plt_offset): Handle IFUNC symbol.
4051 * object.cc (Sized_relobj::Sized_relobj): Initialize
4053 (Sized_relobj::local_has_plt_offset): New function.
4054 (Sized_relobj::local_plt_offset): New function.
4055 (Sized_relobj::set_local_plt_offset): New function.
4056 (Sized_relobj::do_count): Handle IFUNC symbol.
4057 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
4058 a bit away from input_shndx_ field. Add set_is_func_symbol and
4059 is_ifunc_symbol functions.
4060 (class Sized_relobj): Update declarations. Remove Tls_got_entry
4061 and Local_tls_got_offsets. Define Local_plt_offsets. Add
4062 local_plt_offsets_ field.
4063 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
4064 * output.h (class Output_section_data): Add non-const
4065 output_section function.
4066 (class Output_data_got): Update declarations.
4067 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
4068 Add use_plt_offset parameter to global and local constructors.
4069 Change all callers. Change local_sym_index_ field to 31 bits.
4070 Change GSYM_CODE and CONSTANT_CODE accordingly.
4071 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
4072 doing a static link don't set sh_link field.
4073 (Output_data_got::Got_entry::write): Use PLT offset if
4075 (Output_data_got::add_global_plt): New function.
4076 (Output_data_got::add_local_plt): New function.
4077 * target-reloc.h (relocate_section): Handle IFUNC symbol.
4078 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
4079 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
4080 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
4081 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
4083 * testsuite/ifunc-sel.h: New file.
4084 * testsuite/ifuncmain1.c: New file.
4085 * testsuite/ifuncmain1vis.c: New file.
4086 * testsuite/ifuncmod1.c: New file.
4087 * testsuite/ifuncdep2.c: New file.
4088 * testsuite/ifuncmain2.c: New file.
4089 * testsuite/ifuncmain3.c: New file.
4090 * testsuite/ifuncmod3.c: New file.
4091 * testsuite/ifuncmain4.c: New file.
4092 * testsuite/ifuncmain5.c: New file.
4093 * testsuite/ifuncmod5.c: New file.
4094 * testsuite/ifuncmain6pie.c: New file.
4095 * testsuite/ifuncmod6.c: New file.
4096 * testsuite/ifuncmain7.c: New file.
4097 * configure, testsuite/Makefile.in: Rebuild.
4099 2010-08-18 Ian Lance Taylor <iant@google.com>
4102 (Output_section_incremental_inputs::write_input_files): Add cast
4103 to avoid signed/unsigned comparison warning.
4104 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4106 2010-08-12 Cary Coutant <ccoutant@google.com>
4108 * common.cc (Sort_commons::operator()): Remove unnecessary code.
4110 2010-08-13 Ian Lance Taylor <iant@google.com>
4112 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
4114 2010-08-12 Cary Coutant <ccoutant@google.com>
4115 Doug Kwan <dougkwan@google.com>
4117 * resolve.cc (Symbol_table::should_override): When a weak dynamic
4118 defintion overrides non-weak undef, remember that the original undef
4120 * symtab.cc (Symbol_table::sized_write_global): For undef without
4121 an original weak binding, set binding to global in output.
4122 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
4123 * testsuite/Makefile.in: Regenerate.
4124 * testsuite/strong_ref_weak_def.sh: New file.
4125 * testsuite/strong_ref_weak_def_1.c: Ditto.
4126 * testsuite/strong_ref_weak_def_2.c: Ditto.
4128 2010-08-12 Cary Coutant <ccoutant@google.com>
4130 * testsuite/incremental_test.sh: Rewrite.
4131 * testsuite/incremental_test_1.c: Rewrite.
4132 * testsuite/incremental_test_2.c: Rewrite.
4134 2010-08-12 Cary Coutant <ccoutant@google.com>
4136 * arm.cc (Target_arm::got_size): Add const.
4137 (Target_arm::got_entry_count): New function.
4138 (Target_arm::plt_entry_count): New function.
4139 (Target_arm::first_plt_entry_offset): New function.
4140 (Target_arm::plt_entry_size): New function.
4141 (Output_data_plt_arm::entry_count): New function.
4142 (Output_data_plt_arm::first_plt_entry_offset): New function.
4143 (Output_data_plt_arm::get_plt_entry_size): New function.
4144 * i386.cc (Target_i386::got_size): Add const.
4145 (Target_i386::got_entry_count): New function.
4146 (Target_i386::plt_entry_count): New function.
4147 (Target_i386::first_plt_entry_offset): New function.
4148 (Target_i386::plt_entry_size): New function.
4149 (Output_data_plt_i386::entry_count): New function.
4150 (Output_data_plt_i386::first_plt_entry_offset): New function.
4151 (Output_data_plt_i386::get_plt_entry_size): New function.
4152 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
4153 find_incremental_inputs_sections. Dump incremental_got_plt section.
4154 * incremental.cc: Include target.h.
4155 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
4156 parameter. Adjust all callers. Find incremental_got_plt section.
4157 (Incremental_inputs::create_data_sections): Create incremental_got_plt
4159 (Output_section_incremental_inputs::set_final_data_size): Calculate
4160 size of incremental_got_plt section.
4161 (Output_section_incremental_inputs::do_write): Write the
4162 incremental_got_plt section.
4163 (Got_plt_view_info): New struct.
4164 (Local_got_offset_visitor): New class.
4165 (Global_got_offset_visitor): New class.
4166 (Global_symbol_visitor_got_plt): New class.
4167 (Output_section_incremental_inputs::write_got_plt): New function.
4168 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
4169 Add parameter. Adjust all callers.
4170 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4171 (Incremental_inputs::got_plt_section): New function.
4172 (Incremental_inputs::got_plt_section_): New data member.
4173 (Incremental_got_plt_reader): New class.
4174 * layout.cc (Layout::create_incremental_info_sections): Add the
4175 incremental_got_plt section.
4176 * object.h (Got_offset_list::get_list): New function.
4177 (Got offset_list::for_all_got_offsets): New function.
4178 (Sized_relobj::local_got_offset_list): New function.
4179 * powerpc.cc (Target_powerpc::got_size): Add const.
4180 (Target_powerpc::got_entry_count): New function.
4181 (Target_powerpc::plt_entry_count): New function.
4182 (Target_powerpc::first_plt_entry_offset): New function.
4183 (Target_powerpc::plt_entry_size): New function.
4184 (Output_data_plt_powerpc::entry_count): New function.
4185 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
4186 (Output_data_plt_powerpc::get_plt_entry_size): New function.
4187 * sparc.cc (Target_sparc::got_size): Add const.
4188 (Target_sparc::got_entry_count): New function.
4189 (Target_sparc::plt_entry_count): New function.
4190 (Target_sparc::first_plt_entry_offset): New function.
4191 (Target_sparc::plt_entry_size): New function.
4192 (Output_data_plt_sparc::entry_count): New function.
4193 (Output_data_plt_sparc::first_plt_entry_offset): New function.
4194 (Output_data_plt_sparc::get_plt_entry_size): New function.
4195 * symtab.h (Symbol::got_offset_list): New function.
4196 (Symbol_table::for_all_symbols): New function.
4197 * target.h (Sized_target::got_entry_count): New function.
4198 (Sized_target::plt_entry_count): New function.
4199 (Sized_target::plt_entry_size): New function.
4200 * x86_64.cc (Target_x86_64::got_size): Add const.
4201 (Target_x86_64::got_entry_count): New function.
4202 (Target_x86_64::plt_entry_count): New function.
4203 (Target_x86_64::first_plt_entry_offset): New function.
4204 (Target_x86_64::plt_entry_size): New function.
4205 (Output_data_plt_x86_64::entry_count): New function.
4206 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
4207 (Output_data_plt_x86_64::get_plt_entry_size): New function.
4209 2010-08-12 Cary Coutant <ccoutant@google.com>
4211 * archive.cc: Include incremental.h.
4212 (Archive::Archive): Initialize incremental_info_.
4213 (Archive::include_member): Record archive members in incremental info.
4214 (Add_archive_symbols::run): Record begin and end of an archive in
4216 (Lib_group::include_member): Record objects in incremental info.
4217 * archive.h (Incremental_archive_entry): Forward declaration.
4218 (Archive::set_incremental_info): New member function.
4219 (Archive::incremental_info): New member function.
4220 (Archive::Unused_symbol_iterator): New class.
4221 (Archive::unused_symbols_begin): New member function.
4222 (Archive::unused_symbols_end): New member function.
4223 (Archive::incremental_info_): New data member.
4224 * incremental-dump.cc (find_input_containing_global): New function.
4225 (dump_incremental_inputs): Dump new incremental info sections.
4226 * incremental.cc: Include symtab.h.
4227 (Output_section_incremental_inputs): New class.
4228 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
4229 new incremental info sections.
4230 (Sized_incremental_binary::do_check_inputs): Likewise.
4231 (Incremental_inputs::report_archive): Remove.
4232 (Incremental_inputs::report_archive_begin): New function.
4233 (Incremental_inputs::report_archive_end): New function.
4234 (Incremental_inputs::report_object): New function.
4235 (Incremental_inputs::finalize_inputs): Remove.
4236 (Incremental_inputs::report_input_section): New function.
4237 (Incremental_inputs::report_script): Rewrite.
4238 (Incremental_inputs::finalize): Do nothing but finalize string table.
4239 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4240 (Incremental_inputs::sized_create_inputs_section_data): Remove.
4241 (Incremental_inputs::create_data_sections): New function.
4242 (Incremental_inputs::relocs_entsize): New function.
4243 (Output_section_incremental_inputs::set_final_data_size): New function.
4244 (Output_section_incremental_inputs::do_write): New function.
4245 (Output_section_incremental_inputs::write_header): New function.
4246 (Output_section_incremental_inputs::write_input_files): New function.
4247 (Output_section_incremental_inputs::write_info_blocks): New function.
4248 (Output_section_incremental_inputs::write_symtab): New function.
4249 * incremental.h (Incremental_script_entry): Forward declaration.
4250 (Incremental_object_entry): Forward declaration.
4251 (Incremental_archive_entry): Forward declaration.
4252 (Incremental_inputs): Forward declaration.
4253 (Incremental_inputs_header_data): Remove.
4254 (Incremental_inputs_header): Remove.
4255 (Incremental_inputs_header_write): Remove.
4256 (Incremental_inputs_entry_data): Remove.
4257 (Incremental_inputs_entry): Remove.
4258 (Incremental_inputs_entry_write): Remove.
4259 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
4260 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
4261 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4262 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
4264 (Incremental_input_entry): New class.
4265 (Incremental_script_entry): New class.
4266 (Incremental_object_entry): New class.
4267 (Incremental_archive_entry): New class.
4268 (Incremental_inputs::Incremental_inputs): Initialize new data members.
4269 (Incremental_inputs::report_inputs): Remove.
4270 (Incremental_inputs::report_archive): Remove.
4271 (Incremental_inputs::report_archive_begin): New function.
4272 (Incremental_inputs::report_archive_end): New function.
4273 (Incremental_inputs::report_object): Change prototype.
4274 (Incremental_inputs::report_input_section): New function.
4275 (Incremental_inputs::report_script): Change prototype.
4276 (Incremental_inputs::get_reloc_count): New function.
4277 (Incremental_inputs::set_reloc_count): New function.
4278 (Incremental_inputs::create_data_sections): New function.
4279 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4280 (Incremental_inputs::inputs_section): New function.
4281 (Incremental_inputs::symtab_section): New function.
4282 (Incremental_inputs::relocs_section): New function.
4283 (Incremental_inputs::get_stringpool): Add const.
4284 (Incremental_inputs::command_line): Add const.
4285 (Incremental_inputs::inputs): Remove.
4286 (Incremental_inputs::command_line_key): New function.
4287 (Incremental_inputs::input_file_count): New function.
4288 (Incremental_inputs::input_files): New function.
4289 (Incremental_inputs::relocs_entsize): New function.
4290 (Incremental_inputs::sized_create_inputs_section_data): Remove.
4291 (Incremental_inputs::finalize_inputs): Remove.
4292 (Incremental_inputs::Input_info): Remove.
4293 (Incremental_inputs::lock_): Remove.
4294 (Incremental_inputs::inputs_): Change type.
4295 (Incremental_inputs::inputs_map_): Remove.
4296 (Incremental_inputs::current_object_entry_): New data member.
4297 (Incremental_inputs::inputs_section_): New data member.
4298 (Incremental_inputs::symtab_section_): New data member.
4299 (Incremental_inputs::relocs_section_): New data member.
4300 (Incremental_inputs::reloc_count_): New data member.
4301 (Incremental_inputs_reader): New class.
4302 (Incremental_symtab_reader): New class.
4303 (Incremental_relocs_reader): New class.
4304 * layout.cc (Layout::finalize): Move finalization of incremental info
4305 and creation of incremental info sections to follow finalization of
4306 symbol table. Set offsets for postprocessing sections.
4307 (Layout::create_incremental_info_sections): Call
4308 Incremental_inputs::create_data_sections. Add incremental symtab
4309 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
4310 sections to layout after input sections.
4311 * layout.h (struct Timespec): Forward declaration.
4312 (Layout::incremental_inputs): Add const.
4313 (Layout::create_incremental_info_sections): Add parameter.
4314 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
4315 * object.cc: Include incremental.h.
4316 (Relobj::finalize_incremental_relocs): New function.
4317 (Sized_relobj::do_layout): Record input sections in incremental info.
4318 * object.h (Object::output_section): New function.
4319 (Object::output_section_offset): Moved from Relobj.
4320 (Object::get_incremental_reloc_base): New function.
4321 (Object::get_incremental_reloc_count): New function.
4322 (Object::do_output_section): New function.
4323 (Object::do_output_section_offset): Moved from Relobj.
4324 (Object::do_get_incremental_reloc_base): New function.
4325 (Object::do_get_incremental_reloc_count): New function.
4326 (Object::Object): Initialize new data members.
4327 (Relobj::output_section): Renamed do_output_section and moved to
4329 (Relobj::output_section_offset): Moved to Object.
4330 (Relobj::do_get_incremental_reloc_base): New function.
4331 (Relobj::do_get_incremental_reloc_count): New function.
4332 (Relobj::allocate_incremental_reloc_counts): New function.
4333 (Relobj::count_incremental_reloc): New function.
4334 (Relobj::finalize_incremental_relocs): New function.
4335 (Relobj::next_incremental_reloc_index): New function.
4336 (Relobj::reloc_counts_): New data member.
4337 (Relobj::reloc_bases_): New data member.
4338 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
4339 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
4340 (Sized_relobj::incremental_relocs_scan): New function.
4341 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4342 (Sized_relobj::incremental_relocs_write): New function.
4343 (Sized_relobj::incremental_relocs_write_reltype): New function.
4344 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
4346 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
4347 archives and object files elsewhere.
4348 (Add_symbols::run): Report object files here.
4349 (Finish_group::run): Report end of archive at end of group.
4350 * reloc.cc: Include layout.h, incremental.h.
4351 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
4352 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
4353 (Sized_relobj::incremental_relocs_scan): New function.
4354 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4355 (Sized_relobj::do_relocate_sections): Write incremental relocations.
4356 (Sized_relobj::incremental_relocs_write): New function.
4357 (Sized_relobj::incremental_relocs_write_reltype): New function.
4358 * script.cc (read_input_script): Rewrite test for incremental link.
4359 Change call to Incremental_inputs::report_script.
4360 * symtab.h (Symbol_table::first_global_index): New function.
4361 (Symbol_table::output_count): New function.
4363 2010-08-12 Doug Kwan <dougkwan@google.com>
4365 * arm.cc (Target_arm::merge_object_attributes): Check command line
4366 options --no-wchar-size-warning and --no-enum-size-warning.
4367 * options.h (General_options): Add ld-compatible options
4368 --no-enum-size-warning and --no-wchar-size-warning.
4370 2010-08-04 Ian Lance Taylor <iant@google.com>
4372 * x86_64.cc (Target_x86_64::Scan::local): Use
4373 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
4374 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
4375 (Target_x86_64::Scan::global): Likewise.
4376 (Target_x86_64::Relocate::relocate): Likewise.
4377 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
4380 2010-08-03 Cary Coutant <ccoutant@google.com>
4382 * merge.cc (Output_merge_string::do_add_input_section): Count strings
4383 to reserve space in merged_strings vector. Keep total input size
4385 (Output_merge_string::do_print_merge_stats): Print total input size.
4386 * merge.h (Output_merge_string): Add input_size_ field.
4387 * stringpool.cc (Stringpool_template::string_length): Move
4388 implementations out of Stringpool_template class and place in
4390 * stringpool.h (string_length): Move out of Stringpool_template.
4392 2010-08-03 Ian Lance Taylor <iant@google.com>
4395 * layout.cc (relaxation_loop_body): If address of load segment is
4396 set, adjust address to include headers if possible.
4398 2010-08-03 Ian Lance Taylor <iant@google.com>
4400 * version.cc (version_string): Bump to 1.10.
4402 2010-08-03 Ian Lance Taylor <iant@google.com>
4405 * layout.h (enum Output_section_order): Define.
4406 (class Layout): Update declarations.
4407 * layout.cc (Layout::get_output_section): Add order parameter.
4408 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
4409 is_first_non_relro parameters. Change all callers.
4410 (Layout::choose_output_section): Likewise.
4411 (Layout::add_output_section_data): Likewise.
4412 (Layout::make_output_section): Likewise. Set order.
4413 (Layout::default_section_order): New function.
4414 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
4415 * output.cc (Output_section::Output_section): Initialize order_.
4416 Don't initialize deleted fields.
4417 (Output_segment::Output_segment): Don't initialize deleted
4419 (Output_segment::add_output_section_to_load): New function
4420 replacing add_output_section. Change all callers to call this or
4421 add_output_section_to_nonload.
4422 (Output_segment::add_output_section_to_nonload): New function.
4423 (Output_segment::remove_output_section): Rewrite.
4424 (Output_segment::add_initial_output_data): Likewise.
4425 (Output_segment::has_any_data_sections): Likewise.
4426 (Output_segment::is_first_section_relro): Likewise.
4427 (Output_segment::maximum_alignment): Likewise.
4428 (Output_segment::has_dynamic_reloc): New function replacing
4429 dynamic_reloc_count. Change all callers.
4430 (Output_segment::has_dynamic_reloc_list): New function replacing
4431 dynamic_reloc_count_list. Change all callers.
4432 (Output_segment::set_section_addresses): Rewrite.
4433 (Output_segment::set_offset): Rewrite.
4434 (Output_segment::find_first_and_last_list): Remove.
4435 (Output_segment::set_tls_offsets): Rewrite.
4436 (Output_segment::first_section_load_address): Likewise.
4437 (Output_segment::output_section_count): Likewise.
4438 (Output_segment::section_with_lowest_load_address): Likewise.
4439 (Output_segment::write_section_headers): Likewise.
4440 (Output_segment::print_sections_to_map): Likewise.
4441 * output.h (class Output_data): Remove dynamic_reloc_count_
4442 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
4443 (Output_data::add_dynamic_reloc): Rewrite.
4444 (Output_data::has_dynamic_reloc): New function.
4445 (Output_data::dynamic_reloc_count): Remove.
4446 (class Output_section): Add order_ field. Remvoe is_relro_local_,
4447 is_last_relro_, is_first_non_relro_, is_interp_,
4448 is_dynamic_linker_section_ fields. Add order and set_order
4449 functions. Remove is_relro_local, set_is_relro_local,
4450 is_last_relro, set_is_last_relro, is_first_non_relro,
4451 set_is_first_non_relro functions, is_interp, set_is_interp,
4452 is_dynamic_linker_section, and set_is_dynamic_linker_section
4454 (class Output_segment): Change Output_data_list from std::list to
4455 std:;vector. Add output_lists_ field. Remove output_data_ and
4456 output_bss_ fields. Update declarations.
4458 2010-08-02 Ian Lance Taylor <iant@google.com>
4460 * arm.cc (Target_arm::gc_process_relocs): Use typename.
4461 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
4462 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
4464 2010-08-02 Ian Lance Taylor <iant@google.com>
4467 * script.cc (Script_options::Script_options): Initialize
4468 symbol_definitions_ and symbol_references_.
4469 (Script_options::add_symbol_assignment): Update
4470 symbol_definitions_ and symbol_references_.
4471 (Script_options::add_symbol_reference): New function.
4472 (script_symbol): New function.
4473 * script.h (class Script_options): Add symbol_definitions_ and
4474 symbol_references_ fields.
4475 (Script_options::referenced_const_iterator): New type.
4476 (Script_options::referenced_begin): New function.
4477 (Script_options::referenced_end): New function.
4478 (Script_options::is_referenced): New function.
4479 (Script_options::any_unreferenced): New function.
4480 * script-c.h (script_symbol): Declare.
4481 * yyscript.y (exp): Call script_symbol.
4482 * symtab.cc: Include "script.h".
4483 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
4484 Change all callers. Check symbols referenced by scripts.
4485 (Symbol_table::add_undefined_symbols_from_command_line): Add
4486 layout parameter. Change all callers.
4487 (Symbol_table::do_add_undefined_symbols_from_command_line):
4488 Likewise. Break out loop body. Check symbols referenced by
4490 (Symbol_table::add_undefined_symbol_from_command_line): New
4491 function broken out of
4492 do_add_undefined_symbols_from_command_line.
4493 * symtab.h (class Symbol_table): Update declarations.
4494 * archive.cc: Include "layout.h".
4495 (Archive::should_include_member): Add layout parameter. Change
4496 all callers. Check for symbol mentioned in expression.
4497 * archive.h (class Archive): Update declaration.
4498 * object.cc (Sized_relobj::do_should_include_member): Add layout
4500 * object.h (Object::should_include_member): Add layout parameter.
4502 (Object::do_should_include_member): Add layout parameter.
4503 (class Sized_relobj): Update declaration.
4504 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
4506 * dynobj.h (class Sized_dynobj): Update declaration.
4507 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
4509 * plugin.h (class Sized_pluginobj): Update declaration.
4511 2010-08-02 Ian Lance Taylor <iant@google.com>
4514 * output.cc (Output_segment::set_offset): Search for the first and
4515 last sections rather than assuming that the list is in order.
4516 (Output_segment::find_first_and_last_list): New function.
4517 * output.h (class Output_segment): Update declarations.
4518 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4519 (relro_strip_test_SOURCES): New variable.
4520 (relro_strip_test_DEPENDENCIES): New variable.
4521 (relro_strip_test_LDFLAGS): New variable.
4522 (relro_strip_test_LDADD): New variable.
4523 (relro_strip_test.so): New target.
4525 2010-08-02 Ian Lance Taylor <iant@google.com>
4527 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4528 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4529 (Target_i386::got_tlsdesc_section): New function.
4530 (Target_i386::got_section): Create space for GOT entries for
4531 TLSDESC relocations.
4532 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4534 (Target_i386::Scan::global): Likewise.
4535 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
4537 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
4538 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
4539 (Target_x86_64::got_tlsdesc_section): New function.
4540 (Target_x86_64::got_section): Create space for GOT entries for
4541 TLSDESC relocations.
4542 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
4544 (Target_x86_64::Scan::global): Likewise.
4545 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
4548 2010-08-02 Ian Lance Taylor <iant@google.com>
4550 * testsuite/final_layout.sh: Use dc to convert from hex to
4553 2010-07-29 Sriraman Tallam <tmsriram@google.com>
4555 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4556 paramter to the call to gold::gc_process_relocs.
4557 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4558 paramter to the call to gold::gc_process_relocs.
4559 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4560 parameter to the call to gold::gc_process_relocs.
4561 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4562 template parameter to the call to gold::gc_process_relocs.
4563 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4564 paramter to the call to gold::gc_process_relocs.
4565 * gc.h (get_embedded_addend_size): New function.
4566 (gc_process_relocs): Save the size of the reloc for use by ICF.
4567 * icf.cc (get_section_contents): Get the addend from the text section
4568 for SHT_REL relocation sections.
4569 * icf.h (Icf::Reloc_addend_size_info): New typedef.
4570 (Icf::Reloc_info): Add new member reloc_addend_size_info.
4571 * int_encoding.h (read_from_pointer): New overloaded function.
4572 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
4573 * testsuite/icf_sht_rel_addend_test.sh: New file.
4574 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
4575 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
4577 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4579 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
4580 * Makefile.in: Regenerate.
4581 * testsuite/Makefile.in: Regenerate.
4583 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
4585 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
4586 * gold/testsuite/debug_msg.cc: Likewise.
4587 * gold/testsuite/odr_violation1.cc
4588 * gold/testsuite/odr_violation2.cc
4590 2010-07-21 Cary Coutant <ccoutant@google.com>
4592 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
4593 string, and length fields.
4594 (Output_merge_string::Merged_strings_list): New type.
4595 (Output_merge_string::Merged_strings_lists): New typedef.
4596 (Output_merge_string): Replace merged_strings_ with
4597 merged_strings_lists_.
4598 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
4599 Merged_strings_list per input object and section. Don't store pointer
4600 to the string. Don't store length with each merged string entry.
4601 (Output_merge_string::finalize_merged_data): Loop over list of merged
4602 strings lists. Recompute length of each merged string.
4604 2010-07-15 Cary Coutant <ccoutant@google.com>
4606 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
4609 2010-07-14 Ian Lance Taylor <iant@google.com>
4611 * descriptors.cc (Descriptors::open): Report correct name in error
4614 2010-07-13 Doug Kwan <dougkwan@google.com>
4616 * arm.cc (Arm_input_section::Arm_input_section): For a
4617 SHT_ARM_EXIDX section, always keeps the input sections.
4618 (Arm_input_section::set_exidx_section_link): New method.
4619 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
4620 has_errors_ to false.
4621 (Arm_exidx_input_section::has_errors,
4622 Arm_exidx_input_section::set_has_errors): New methods.
4623 (Arm_exidx_input_section::has_errors_): New data member.
4624 (Arm_relobj::get_exidx_shndx_list): New method.
4625 (Arm_output_section::append_text_sections_to_list): Do not skip
4626 section without SHF_EXECINSTR.
4627 (Arm_output_section::fix_exidx_coverage): Skip input sections with
4629 (Arm_relobj::make_exidx_input_section): Add new parameter for text
4630 section header. Make error messages more verbose. Check for
4631 a non-executable section linked to an EXIDX section.
4632 (Arm_relobj::do_read_symbols): Remove error checking, which has been
4633 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
4634 check that there is no deferred EXIDX section if we exit early.
4635 Instead of not making an EXIDX section in case of an error, make one
4636 and set the has_errors flag of it.
4637 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
4638 in a relocatable link.
4639 (Target_arm::do_relax): Look for the EXIDX output section instead of
4640 assuming that it is called .ARM.exidx.
4641 (Target_arm::fix_exidx_coverage): Add a new parameter for input
4642 section list. Do not check for SHF_EXECINSTR section flags but
4643 skip any input section with errors.
4644 * output.cc (Output_section::Output_section): Initialize
4645 always_keeps_input_sections_ to false.
4646 (Output_section::add_input_section): Check for
4647 always_keeps_input_sections_.
4648 * output.h (Output_section::always_keeps_input_sections,
4649 Output_section::set_always_keeps_input_sections): New methods.
4650 (Output_section::always_keeps_input_sections): New data member.
4652 2010-07-13 Rafael Espindola <espindola@google.com>
4654 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
4655 * fileread.h (Input_file): Add try_extra_search_path and find_file.
4657 2010-07-13 Philip Herron <herron.philip@googlemail.com>
4658 Ian Lance Taylor <iant@google.com>
4660 * output.h (Output_section_lookup_maps::add_merge_section):
4661 Correct check of whether value was inserted.
4662 (Output_section_lookup_maps::add_merge_input_section): Likewise.
4663 (Output_section_lookup_maps::add_relaxed_input_section):
4665 * arm.cc (Target_arm::got_section): Remove used local os.
4666 * i386.cc (Target_i386::got_section): Likewise.
4667 * x86_64.cc (Target_x86_64::got_section): Likewise.
4668 * sparc.cc (Target_sparc::got_section): Likewise.
4669 (Target_sparc::relocate): Remove unused local have_got_offset.
4670 * powerpc.cc (Target_powerpc::relocate): Likewise.
4672 2010-07-13 Ian Lance Taylor <iant@google.com>
4674 * compressed_output.cc (zlib_decompress): Fix signature in
4677 * archive.cc (Archive::include_member): Unlock an external member
4678 of a thin archive. Don't bother to delete an object we know is
4681 2010-07-12 Cary Coutant <ccoutant@google.com>
4683 * compressed_output.cc (zlib_decompress): New function.
4684 (get_uncompressed_size): New function.
4685 (decompress_input_section): New function.
4686 * compressed_output.h (get_uncompressed_size): New function.
4687 (decompress_input_section): New function.
4688 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
4689 Handle compressed debug sections.
4690 * layout.cc (is_compressed_debug_section): New function.
4691 (Layout::output_section_name): Map compressed section names to
4693 * layout.h (is_compressed_debug_section): New function.
4694 (is_debug_info_section): Recognize compressed debug sections.
4695 * merge.cc: Include compressed_output.h.
4696 (Output_merge_data::do_add_input_section): Handle compressed
4698 (Output_merge_string::do_add_input_section): Handle compressed
4700 * object.cc: Include compressed_output.h.
4701 (Sized_relobj::Sized_relobj): Initialize new data members.
4702 (build_compressed_section_map): New function.
4703 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
4704 * object.h (Object::section_is_compressed): New method.
4705 (Object::do_section_is_compressed): New method.
4706 (Sized_relobj::Compressed_section_map): New type.
4707 (Sized_relobj::do_section_is_compressed): New method.
4708 (Sized_relobj::compressed_sections_): New data member.
4709 * output.cc (Output_section::add_input_section): Handle compressed
4711 * reloc.cc: Include compressed_output.h.
4712 (Sized_relobj::write_sections): Handle compressed debug sections.
4714 2010-07-08 Cary Coutant <ccoutant@google.com>
4716 * resolve.cc (Symbol_table::resolve): Remember whether undef was
4717 weak when resolving to a dynamic def.
4718 (Symbol_table::should_override): Add adjust_dyndef flag; set it
4719 for weak undef/dynamic def cases. Adjust callers.
4720 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
4721 undef_binding_weak_.
4722 (Symbol_table::sized_write_globals): Adjust symbol binding.
4723 (Symbol_table::sized_write_symbol): Add binding parameter.
4724 * symtab.h (Symbol::set_undef_binding): New method.
4725 (Symbol::is_undef_binding_weak): New method.
4726 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
4727 (Symbol_table::should_override): Add new parameter.
4728 (Symbol_table::sized_write_symbol): Add new parameter.
4730 * testsuite/weak_undef_file1.cc: Add new test case.
4731 * testsuite/weak_undef_file2.cc: Fix header comment.
4732 * testsuite/weak_undef_test.cc: Add new test case.
4734 2010-06-29 Doug Kwan <dougkwan@google.com>
4736 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
4737 Initialize USE_SYMBOL_.
4738 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
4740 (Arm_reloc_property::uses_symbol_): New data member declaration.
4741 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
4742 uses symbol value and symbol is undefined but not weakly undefined.
4744 2010-06-28 Rafael Espindola <espindola@google.com>
4746 * plugin.cc (Plugin::load): Use dlerror.
4748 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
4750 * symtab.cc (detect_odr_violations): When reporting an ODR
4751 violation, report an object where the symbol is defined.
4753 2010-06-25 Doug Kwan <dougkwan@google.com>
4755 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
4756 (Target_arm::section_may_have_icf_unsafe_pointers): New method
4758 (Target_arm::Scan::local_reloc_may_be_function_pointer,
4759 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
4760 target hook to detect function points.
4761 (Target_arm::Scan::possible_function_pointer_reloc): New method.
4762 * icf.h (Icf::check_section_for_function_pointers): Change type of
4763 parameter SECTION_NAME to const reference to std::string. Use
4764 target hook to determine if section may have unsafe pointers.
4765 * target.h (Target::section_may_have_icf_unsafe_pointers): New
4768 2010-06-21 Rafael Espindola <espindola@google.com>
4770 * fileread.cc (Input_file::find_fie): New
4771 (Input_file::open): Use Input_file::find_fie.
4772 * fileread.h (Input_file::find_fie): New
4773 * plugin.cc (set_extra_library_path): New.
4774 (Plugin::load): Add set_extra_library_path to the transfer vector.
4775 (Plugin_manager::set_extra_library_path): New.
4776 (Plugin_manager::add_input_file): Use the extra search path if set.
4777 (set_extra_library_path(): New.
4778 * plugin.h (Plugin_manager): Add set_extra_library_path and
4781 2010-06-19 Cary Coutant <ccoutant@google.com>
4783 * layout.cc (gdb_sections): Add .debug_types.
4784 (lines_only_debug_sections): Likewise.
4786 2010-06-18 Rafael Espindola <espindola@google.com>
4788 * plugin.cc (add_input_file,add_input_library)
4789 (Plugin_manager::add_input_file): Make filename arguments const.
4790 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
4793 2010-06-16 Doug Kwan <dougkwan@google.com>
4795 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
4796 .ARM.attributes section if we have not merged any input
4797 attributes sections.
4799 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4801 * arm.cc: Allow combining objects with no EABI version
4804 2010-06-15 Rafael Espindola <espindola@google.com>
4806 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
4808 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4810 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
4811 (struct iovec): Correct !HAVE_READV definition.
4813 2010-06-10 Cary Coutant <ccoutant@google.com>
4815 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
4816 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
4818 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
4821 * symtab.h (Symbol::is_placeholder): New member function.
4822 * target-reloc.h (relocate_section): Check for placeholder symbols.
4824 * testsuite/Makefile.am (plugin_test_8): New test.
4825 (plugin_test_9): New test.
4826 * testsuite/Makefile.in: Regenerate.
4828 2010-06-09 Nick Clifton <nickc@redhat.com>
4830 * yyscript.y (input_list_element): Allow strings prefixed with
4831 the '-' character. Treat these as libraries.
4832 * script.cc (script_add_library): New function. Adds a library
4833 specified by "-l<name>" found in an input script.
4834 * script-c.h: Add prototype for script_add_library.
4836 2010-06-07 Doug Kwan <dougkwan@google.com>
4838 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
4839 Restrict stub-group size to be within long conditional branch
4840 range when working around cortex-A8 erratum.
4842 2010-06-07 Damien Diederen <dd@crosstwine.com>
4844 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
4847 2010-06-03 Sriraman Tallam <tmsriram@google.com>
4851 (Output_section::Input_section_sort_entry::compare_section_ordering):
4852 Change to return non-zero correctly.
4853 (Output_section::Input_section_sort_section_order_index_compare
4854 ::operator()): Change to fix ambiguity in comparisons.
4856 2010-06-01 Sriraman Tallam <tmsriram@google.com>
4858 * gold.h (is_wildcard_string): New function.
4859 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
4860 (Layout::layout_eh_frame): Ditto.
4861 (Layout::find_section_order_index): New method.
4862 (Layout::read_layout_from_file): New method.
4863 * layout.h (Layout::find_section_order_index): New method.
4864 (Layout::read_layout_from_file): New method.
4865 (Layout::input_section_position_): New private member.
4866 (Layout::input_section_glob_): New private member.
4867 * main.cc (main): Call read_layout_from_file here.
4868 * options.h (--section-ordering-file): New option.
4869 * output.cc (Output_section::input_section_order_specified_): New
4871 (Output_section::Output_section): Initialize new member.
4872 (Output_section::add_input_section): Add new parameter.
4873 Keep input sections when --section-ordering-file is used.
4874 (Output_section::set_final_data_size): Sort input sections when
4875 section ordering file is specified.
4876 (Output_section::Input_section_sort_entry): Add new parameter.
4878 (Output_section::Input_section_sort_entry::compare_section_ordering):
4880 (Output_section::Input_section_sort_compare::operator()): Change to
4881 consider section_order_index.
4882 (Output_section::Input_section_sort_init_fini_compare::operator()):
4883 Change to consider section_order_index.
4884 (Output_section::Input_section_sort_section_order_index_compare
4885 ::operator()): New method.
4886 (Output_section::sort_attached_input_sections): Change to sort
4887 according to section order when specified.
4888 (Output_section::add_input_section<32, true>): Add new parameter.
4889 (Output_section::add_input_section<64, true>): Add new parameter.
4890 (Output_section::add_input_section<32, false>): Add new parameter.
4891 (Output_section::add_input_section<64, false>): Add new parameter.
4892 * output.h (Output_section::add_input_section): Add new parameter.
4893 (Output_section::input_section_order_specified): New
4895 (Output_section::set_input_section_order_specified): New method.
4896 (Input_section::Input_section): Initialize section_order_index_.
4897 (Input_section::section_order_index): New method.
4898 (Input_section::set_section_order_index): New method.
4899 (Input_section::section_order_index_): New member.
4900 (Input_section::Input_section_sort_section_order_index_compare): New
4902 (Output_section::input_section_order_specified_): New member.
4903 * script-sections.cc (is_wildcard_string): Delete and move modified
4905 (Output_section_element_input::Output_section_element_input): Modify
4906 call to is_wildcard_string.
4907 (Output_section_element_input::Input_section_pattern
4908 ::Input_section_pattern): Ditto.
4909 (Output_section_element_input::Output_section_element_input): Ditto.
4910 * testsuite/Makefile.am (final_layout): New test case.
4911 * testsuite/Makefile.in: Regenerate.
4912 * testsuite/final_layout.cc: New file.
4913 * testsuite/final_layout.sh: New file.
4915 2010-06-01 Rafael Espindola <espindola@google.com>
4917 * plugin.cc (Plugin::load): Pass the output name to the plugin.
4919 2010-06-01 Rafael Espindola <espindola@google.com>
4921 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
4922 visibility of symbols.
4924 2010-05-27 Doug Kwan <dougkwan@google.com>
4926 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
4927 from start of output section instead of address for a local symbol
4928 in a merged or relaxed section when doing a relocatable link.
4930 2010-05-26 Rafael Espindola <espindola@google.com>
4933 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
4934 adding sections the garbage collector removed.
4935 * gold/testsuite/Makefile.am: Add test.
4936 * gold/testsuite/Makefile.in: Regenerate.
4937 * gold/testsuite/plugin_test_7.sh: New.
4938 * gold/testsuite/plugin_test_7_1.c: New.
4939 * gold/testsuite/plugin_test_7_2.c: New.
4941 2010-05-26 Rafael Espindola <espindola@google.com>
4943 * script-sections.cc (Output_section_definition::set_section_addresses):
4944 Check for --section-start.
4946 2010-05-26 Doug Kwan <dougkwan@google.com>
4948 * arm.cc (Arm_scan_relocatable_relocs): New class.
4949 (Target_arm::relocate_special_relocatable): New method.
4950 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
4951 (Arm_relocate_functions::thumb_branch_common): Same.
4952 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
4953 instead of Default_scan_relocatable_relocs.
4954 * target-reloc.h (relocate_for_relocatable): Let target handle
4955 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
4956 * target.h (Sized_target::relocate_special_relocatable): New method.
4958 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4960 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
4962 2010-05-23 Doug Kwan <dougkwan@google.com>
4964 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
4966 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
4967 with a direct branch, not a conditional branch, to a stub.
4968 * merge.cc (Output_merge_base::record_input_section): New method
4970 (Output_merge_data::do_add_input_section): Record input section if
4971 keeps-input-sections flag is set.
4972 (Output_merge_string::do_add_input_section): Ditto.
4973 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
4974 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
4976 (Output_merge_base::keeps_input_sections,
4977 Output_merge_base::set_keeps_input_sections,
4978 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
4980 (Output_merge_base::Input_sections): New type declaration.
4981 (Output_merge_base::input_sections_begin,
4982 Output_merge_base::input_sections_end,
4983 Output_merge_base::do_set_keeps_input_sections): New method definitions.
4984 (Output_merge_base::bool keeps_input_sections_,
4985 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
4986 Output_merge_base::input_sections_): New data members.
4987 (Output_merge_data::do_set_keeps_input_sections): New method
4989 (Output_merge_string::do_set_keeps_input_sections): Ditto.
4990 * output.cc (Output_section::Input_section::relobj): Move method
4991 defintion from class declaration to here and handle merge sections.
4992 (Output_section::Input_section::shndx): Ditto.
4993 (Output_section::Output_section): Remove initializations of removed
4994 data members and initialize new data member LOOKUP_MAPS_.
4995 (Output_section::add_input_section): Set keeps-input-sections flag
4996 for a newly created merge output section as appropriate. Adjust code
4997 to use Output_section_lookup_maps class.
4998 (Output_section::add_relaxed_input_section): Adjst code for lookup
4999 maps code refactoring.
5000 (Output_section::add_merge_input_section): Add a new parameter
5001 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
5002 class. If adding input section to a newly created merge output
5003 section fails, remove the new merge section.
5004 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
5005 Adjust code for use of the Output_section_lookup_maps class.
5006 (Output_section::find_merge_section): Ditto.
5007 (Output_section::build_lookup_maps): New method defintion.
5008 (Output_section::find_relaxed_input_section): Adjust code to use
5009 Output_section_lookup_maps class.
5010 (Output_section::get_input_sections): Export merge sections. Adjust
5011 code to use Output_section_lookup_maps class.
5012 (Output_section:::add_script_input_section): Adjust code to use
5013 Output_section_lookup_maps class. Update lookup maps for merge
5015 (Output_section::discard_states): Use Output_section_lookup_maps.
5016 (Output_section::restore_states): Same.
5017 * output.h (Merge_section_properties): Move class defintion out of
5019 (Output_section_lookup_maps): New class.
5020 (Output_section::Input_section::is_merge_section): New method
5022 (Output_section::Input_section::relobj): Move defintion out of class
5023 defintion. Declare method only.
5024 (Output_section::Input_section::shndx): Ditto.
5025 (Output_section::Input_section::output_merge_base): New method defintion.
5026 (Output_section::Input_section::u2_.pomb): New union field.
5027 (Output_section::Merge_section_by_properties_map,
5028 Output_section::Output_section_data_by_input_section_map,
5029 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
5031 (Output_section::add_merge_input_section): Add new parameter
5032 KEEPS_INPUT_SECTIONS.
5033 (Output_section::build_lookup_maps): New method declaration.
5034 (Output_section::merge_section_map_,
5035 Output_section::merge_section_by_properties_map_,
5036 Output_section::relaxed_input_section_map_,
5037 Output_section::is_relaxed_input_section_map_valid_): Remove data
5039 (Output_section::lookup_maps_): New data member.
5041 2010-05-21 Doug Kwan <dougkwan@google.com>
5044 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
5045 avoid a compilation error.
5047 2010-05-19 Rafael Espindola <espindola@google.com>
5049 * script-sections.cc (Output_section_definition::allocate_to_segment):
5050 Update the phdrs_list even when the output section is NULL.
5051 * testsuite/Makefile.am: Add test.
5052 * testsuite/Makefile.in: Regenerate.
5053 * testsuite/script_test_9.cc: New.
5054 * testsuite/script_test_9.sh: New.
5055 * testsuite/script_test_9.t: New.
5057 2010-05-19 Doug Kwan <dougkwan@google.com>
5059 * arm.cc (Arm_input_section::original_size): New method.
5060 (Arm_input_section::do_addralign): Add a cast.
5061 (Arm_input_section::do_output_offset): Remove static cast.
5062 (Arm_input_section::original_addralign,
5063 Arm_input_section::original_size_): Change type to uint32_t.
5064 (Arm_input_section::init): Add safe casts for section alignment
5066 (Arm_input_section::set_final_data_size): Do not set address and
5067 offset of stub table.
5068 (Arm_output_section::fix_exidx_coverage): Change use of of
5069 Output_section::Simple_input_section to that of
5070 Output_section::Input_section.
5071 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
5072 except for the first pass.
5073 * output.cc (Output_section::get_input_sections): Change type of
5074 input_sections to std::list<Input_section>.
5075 (Output_section::add_script_input_section): Rename from
5076 Output_section::add_simple_input_section. Change type of SIS
5077 parameter from Simple_input_section to Input_section.
5078 * output.h (Output_section::Simple_input_section): Remove class.
5079 (Output_section::Input_section): Change class visibility to public.
5080 (Output_section::Input_section::addralign): Use stored alignments
5081 for special input sections if set.
5082 (Output_section::Input_section::set_addralign): New method.
5083 (Output_section::get_input_sections): Change parameter type from
5084 list of Simple_input_section to list of Input_section.
5085 (Output_section::add_script_input_section): Rename from
5086 Output_section::add_simple_input_section. Change first parameter's
5087 type from Simple_input_section to Input_section and remove the
5088 second and third parameters.
5089 * script-sections.cc (Input_section::Input_section_list): Change
5090 type to list of Output_section::Input_section/
5091 (Input_section_info::Input_section_info): Change parameter type of
5092 INPUT_SECTION to Output_section::Input_section.
5093 (Input_section_info::input_section): Change return type.
5094 (Input_section_info::input_section_): Change type to
5095 Output_section::Input_section.
5096 (Output_section_element_input::set_section_addresses): Adjust code
5097 to use Output_section::Input_section instead of
5098 Output_section::Simple_input_section. Adjust code for renaming
5099 of Output_section::add_simple_input_section.
5100 (Orphan_output_section::set_section_addresses): Ditto.
5102 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5104 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
5105 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
5107 2010-05-18 Rafael Espindola <espindola@google.com>
5109 * options.cc (General_options::finalize): Handle -nostdlib.
5110 * options.h (nostdlib): New option.
5111 * script.cc (script_add_search_dir): Handle -nostdlib.
5113 2010-05-12 Doug Kwan <dougkwan@google.com>
5115 * arm.cc (Target_arm::do_finalize_sections): Create an empty
5116 attributes section only if there no attributes section after merging.
5117 (Target_arm::merge_object_attributes): Move value of
5118 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
5119 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
5120 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
5121 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
5122 and arm_attr_merge_7.stdout.
5123 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
5124 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
5125 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
5126 arm_attr_merge_7b.o): New rules.
5127 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
5129 * testsuite/Makefile.in: Regenerate.
5130 * testsuite/arm_attr_merge.sh: New file.
5131 * testsuite/arm_attr_merge_[67][ab].s: Same.
5133 2010-05-05 Nick Clifton <nickc@redhat.com>
5135 * po/es.po: Updated Spanish translation.
5137 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
5139 * Makefile.am (install-exec-local): Properly install gold as
5140 default cross linker.
5141 * Makefile.in: Regenerated.
5143 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
5144 Nick Clifton <nickc@redhat.com>
5146 * configure.ac (install_as_default): Define and set to false
5147 unless --enable-gold or --enable-gold=both/gold has been
5149 * configure: Regenerate.
5151 * Makefile.am (install-exec-local): Install the executable as
5152 'ld.gold'. If install_as_default is true then also install it as
5154 * Makefile.in: Regenerated.
5156 2010-04-24 Ian Lance Taylor <iant@google.com>
5158 * layout.cc (Layout::layout_reloc): In relocatable link don't
5159 combine reloc sections for grouped sections.
5161 2010-04-23 Sriraman Tallam <tmsriram@google.com>
5163 * gc.h (gc_process_relocs): Pass information on relocs pointing to
5164 sections that are not ordinary to icf.
5165 * icf.cc (get_section_contents): Handle relocation pointing to section
5166 with no object or shndx information.
5167 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
5168 * testsuite/Makefile.in: Regenerate.
5169 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
5170 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
5172 2010-04-22 Ian Lance Taylor <iant@google.com>
5174 * expression.cc (Expression::Expression_eval_info): Add
5175 result_alignment_pointer field.
5176 (Expression::eval_with_dot): Add result_alignment_pointer
5177 parameter. Change all callers.
5178 (Expression::eval_maybe_dot): Likewise.
5179 (class Binary_expression): Add alignment_pointer parameter to
5180 left_value and right_value. Change all callers.
5181 (BINARY_EXPRESSION): Set result alignment.
5182 (class Trinary_expression): Add alignment_pointer parameter to
5183 arg2_value and arg3_value. Change all callers.
5184 (Trinary_cond::value): Set result alignment.
5185 (Max_expression::value, Min_expression::value): Likewise.
5186 (Align_expression::value): Likewise.
5187 * script-sections.cc (class Sections_element): Add dot_alignment
5188 parameter to set_section_addresses virtual function. Update
5190 (class Output_section_element): Likewise.
5191 (Script_sections::create_segments): Add dot_alignment parameter.
5193 (Script_sections::create_segments_from_phdrs_clause): Likewise.
5194 (Script_sections::set_phdrs_clause_addresses): Likewise.
5195 * script-sections.h: Update declarations.
5196 * script.h: Update declarations.
5197 * output.h (Output_segment::set_minimum_p_align): Don't decrease
5199 * testsuite/script_test_3.t: Set large alignment.
5200 * testsuite/script_test_3.sh: Make sure that at least one LOAD
5201 segment has expected alignment.
5203 2010-04-22 Nick Clifton <nickc@redhat.com>
5205 * po/gold.pot: Updated by the Translation project.
5206 * po/vi.po: Updated Vietnamese translation.
5208 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
5210 * testsuite/Makefile.am (check_PROGRAMS): Add
5211 icf_virtual_function_folding_test.
5212 * testsuite/Makefile.in: Regenerated.
5214 2010-04-15 Andrew Haley <aph@redhat.com>
5216 * options.h (merge_exidx_entries): New option.
5217 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
5218 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
5219 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
5220 (Target_arm::merge_exidx_entries): New function.
5221 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
5222 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
5223 to Arm_exidx_fixup constructor.
5224 Add new arg, merge_exidx_entries.
5225 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
5226 Arm_output_section::fix_exidx_coverage.
5228 2010-04-18 Sriraman Tallam <tmsriram@google.com>
5230 * icf.cc (get_section_contents): Check for preemptible functions.
5231 Ignore addend when appropriate.
5232 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
5234 (add_from_relobj): Check for section folded.
5235 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
5236 * symtab.h (should_add_dynsym_entry): Add new parameter.
5237 * target-reloc.h (scan_relocs): Check for section folded.
5238 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
5239 Check reloc types for function pointers in shared objects.
5240 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
5242 (icf_preemptible_functions_test): New test case.
5243 (icf_string_merge_test): New test case.
5244 * testsuite.Makefile.in: Regenerate.
5245 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
5246 bar_glob. Refactor code.
5247 * testsuite/icf_preemptible_functions_test.cc: New file.
5248 * testsuite/icf_preemptible_functions_test.sh: New file.
5249 * testsuite/icf_string_merge_test.cc: New file.
5250 * testsuite/icf_string_merge_test.sh: New file.
5251 * testsuite/icf_virtual_function_folding_test.cc: New file.
5252 * testsuite/icf_virtual_function_folding_test.sh: New file.
5254 2010-04-14 Doug Kwan <dougkwan@google.com>
5256 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
5257 for local symbol recounting if we remove a section due to ICF.
5258 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
5259 there are no regular objects in input.
5261 2010-04-13 Doug Kwan <dougkwan@google.com>
5263 * arm.cc (Arm_input_section::set_final_data_size): Compute
5264 accurate final data size instead of using current data size.
5266 2010-04-09 Doug Kwan <dougkwan@google.com>
5268 * layout.cc (Layout::choose_output_section): Handle script section
5270 (Layout::make_output_section_for_script): Add section type parameter.
5271 Handle script section types.
5272 * layout.h (Layout::make_output_section_for_script): Add section
5274 * output.cc (Output_section::Output_section): Initialize data member
5276 (Output_section::do_reset_address_and_file_offset): Do not set address
5277 to 0 if section is a NOLOAD section.
5278 * output.h (Output_section::is_noload): New method.
5279 (Output_section::set_is_noload): Ditto.
5280 (Output_section::is_noload_): New data member.
5281 * script-c.h (Script_section_type): New enum type.
5282 (struct Parser_output_section_header): Add new file section_type.
5283 * script-sections.cc (Sections_element::output_section_name): Add
5284 parameter for returning script section type.
5285 (Output_section_definition::output_section_name): Ditto.
5286 (Output_section_definition::section_type)P; New method.
5287 (Output_section_definiton::script_section_type_name): Ditto.
5288 (Output_section_definition::script_section_type_): New data member.
5289 (Output_section_definition::Output_section_definition): Initialize
5290 data member Output_section_definition::script_section_type_.
5291 (Output_section_definition::create_sections): Pass script section type
5292 to Layout::make_output_section_for_script.
5293 (Output_section_definition::output_section_name): Return script
5294 section type to caller.
5295 (Output_section_definition::set_section_address): Do not advance
5296 dot value and load address if section type is NOLOAD. Set address
5297 of NOLOAD sections regardless of section flags.
5298 (Output_section_definition::print): Print section type if it is
5299 not SCRIPT_SECTION_TYPE_NONE.
5300 (Output_section_definition::section_type): New method.
5301 (Output_section_definition::script_section_type_name): Ditto.
5302 (Script_sections::output_section_name): Add new parameter
5303 PSECTION_TYPE for returning script section type. Pass it to
5304 section elements. Handle discard sections.
5305 (Sort_output_sections::operator()): Handle NOLOAD sections.
5306 * script-sections.h (Script_sections::Section_type): New enum type.
5307 (Script_sections::output_section_name): Add a new parameter for
5308 returning script section type.
5309 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
5311 * yyscript.y (union): Add new field SECTION_TYPE.
5312 (COPY, DSECT, INFO, NOLOAD): New tokens.
5313 (opt_address_and_section_type): Change type to output_section_header.
5314 (section_type): New non-terminal
5315 (section_header): Handle section type.
5316 (opt_address_and_section_type): Return section type value.
5318 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
5320 * testsuite/plugin_common_test_1.c (foo): Add prototype.
5321 * testsuite/plugin_common_test_2.c (foo): Likewise.
5323 2010-04-08 Doug Kwan <dougkwan@google.com>
5325 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
5327 * output.cc (Output_section::add_merge_input_section): Simplify
5328 code and return status of Output_merge_base::add_input_section.
5329 Update merge section map only if Output_merge_base::add_input_section
5332 2010-04-07 Doug Kwan <dougkwan@google.com>
5334 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
5335 if section is marked as containing instructions but has no mapping
5337 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
5338 correct section index.
5339 (Arm_relobj::find_linked_text_section): Ditto.
5341 2010-04-07 Cary Coutant <ccoutant@google.com>
5343 * archive.cc (include_member): Destroy Read_symbols_data object before
5345 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
5346 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
5347 (Read_symbols_data::~Read_symbols_data) New destructor.
5348 (Section_relocs::Section_relocs) New constructor.
5349 (Section_relocs::~Section_relocs) New destructor.
5350 (Read_relocs_data::Read_relocs_data) New constructor.
5351 (Read_relocs_data::~Read_relocs_data) New destructor.
5352 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
5353 pointers to NULL after deleting.
5355 2010-04-07 Doug Kwan <dougkwan@google.com>
5357 * arm.cc: Replace "endianity" with "endianness" in comments.
5358 (Arm_exidx_cantunwind): Ditto.
5359 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
5360 (Arm_relobj::merge_flags_and_attributes): New method.
5361 (Arm_relobj::merge_flags_and_attributes_): New data member.
5362 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
5363 (Arm_relobj::scan_sections_for_stubs): Ditto.
5364 (Arm_relobj::do_read_symbols): Check to see if we really want to
5365 merge processor-specific flags and attributes. Exit early if
5366 an object is empty except for section names and the undefined symbol.
5367 (Target_arm::do_finalize_sections): Move check for ELF format to
5368 Arm_relobj::do_read_symbols. Merge processor specific flags and
5369 attributes from a regular object only when we have determined that
5370 it is aapropriate. Do not create an .ARM.attributes section in
5371 output if there is no regular input object.
5372 (Target_arm::merge_processor_specific_flags): Check
5373 --warn-mismatch before printing any error.
5374 (Target_arm::merge_object_attributes): Ditto.
5375 * gold.cc (queue_middle_tasks): Handle the case in which there is
5376 no regular object in input.
5377 * options.cc (General_options::parse_EB): New method.
5378 (General_options::parse_EL): Same.
5379 (General_options::General_options): Initialize endianness_.
5380 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
5382 (General_options::Endianness): New enum.
5383 (General_options::endianness): New method.
5384 (General_options::endianness_): New data member.
5385 * parameters.cc (Parameters::set_options): Check target endianness.
5386 (Parameters::set_target_once): Ditto.
5387 (Parameters::check_target_endianness): New method.
5388 (parameters_force_valid_target): If either -EL or -EB is specified,
5389 use it to define endianness of default target.
5390 * parameters.h (Parameters::check_target_endianness): New method
5392 * target.h (class Target): Change "endianity" to "endianness"
5395 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5397 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
5398 * configure: Regenerate.
5399 * Makefile.in: Regenerate.
5400 * testsuite/Makefile.in: Regenerate.
5402 2010-04-06 Cary Coutant <ccoutant@google.com>
5405 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
5406 prevailing definitions of common symbols.
5407 * testsuite/plugin_test_6.sh: New test case.
5408 * testsuite/plugin_common_test_1.c: New test case.
5409 * testsuite/plugin_common_test_2.c: New test case.
5410 * testsuite/Makefile.am (plugin_test_6): New test case.
5411 * testsuite/Makefile.in: Regenerate.
5413 2010-04-06 Nick Clifton <nickc@redhat.com>
5415 * po/vi.po: New Vietnamese translation.
5417 2010-03-30 Doug Kwan <dougkwan@google.com>
5419 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
5421 2010-03-25 Doug Kwan <dougkwan@google.com>
5423 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
5424 to avoid a conversion warning on a 32-bit host.
5426 2010-03-24 Ian Lance Taylor <iant@google.com>
5428 * testsuite/script_test_3.t: Add a TLS segment.
5429 * testsuite/Makefile.am (check_PROGRAMS): Add
5430 tls_phdrs_script_test.
5431 (tls_phdrs_script_test_SOURCES): Define.
5432 (tls_phdrs_script_test_DEPENDENCIES): Define.
5433 (tls_phdrs_script_test_LDFLAGS): Define.
5434 (tls_phdrs_script_test_LDADD): Define.
5435 * testsuite/Makefile.in: Rebuild.
5437 2010-03-23 Cary Coutant <ccoutant@google.com>
5439 * fileread.cc (find_or_make_view): Fix comment.
5441 2010-03-23 Ian Lance Taylor <iant@google.com>
5443 * script-sections.cc (class Orphan_section_placement): Define
5444 PLACE_TLS and PLACE_TLS_BSS.
5445 (Orphan_section_placement::Orphan_section_placement): Initialize
5447 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
5448 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
5449 (tls_script_test_SOURCES): Define.
5450 (tls_script_test_DEPENDENCIES): Define.
5451 (tls_script_test_LDFLAGS): Define.
5452 (tls_script_test_LDADD): Define.
5453 * testsuite/Makefile.in: Rebuild.
5455 2010-03-22 Doug Kwan <dougkwan@google.com>
5457 * arm.cc (Arm_relocate_functions::abs8,
5458 Arm_relocate_functions::abs16): Use correct check for overflow
5459 specified in the ARM ELF specs.
5460 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
5461 target of a BLX instruction specially.
5462 (Reloc_stub::stub_type_for_reloc): Ditto.
5463 (Relocate::relocate): Use symbolic names instead of numeric relocation
5464 codes to report error.
5465 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
5467 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
5468 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
5469 thumb2_blx_out_of_range.stdout
5470 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
5471 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
5472 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
5473 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
5474 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
5475 thumb2_blx_in_range, thumb2_blx_in_range.o,
5476 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
5477 thumb2_blx_out_of_range.o): New rules.
5478 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
5479 thumb2_blx_in_range and thumb2_blx_out_of_range.
5480 * testsuite/Makefile.in: Regenerate.
5481 * arm_branch_in_range.sh: Add tests for THUMB BLX.
5482 * testsuite/thumb_blx_in_range.s: New file.
5483 * testsuite/thumb_blx_out_of_range.s: New file.
5485 2010-03-22 Rafael Espindola <espindola@google.com>
5487 * archive.cc (Should_include): Move to archive.h.
5488 (should_include_member): Make it a member of Archive.
5490 (Add_lib_group_symbols): New.
5491 * archive.h: Include options.h.
5492 (Archive_member): Moved from Archive.
5493 (Should_include): Moved from archive.cc.
5495 (Add_lib_group_symbols): New.
5496 * dynobj.cc (do_should_include_member): New.
5497 * dynobj.h (do_should_include_member): New.
5498 * gold.cc (queue_initial_tasks): Update call to queue.
5499 * main.cc (main): Print lib group stats.
5500 * object.cc (do_should_include_member): New.
5501 * object.h: Include archive.h.
5502 (Object::should_include_member): New.
5503 (Object::do_should_include_member): New.
5504 (Sized_relobj::do_should_include_member): New.
5505 * options.cc (General_options::parse_start_lib): New.
5506 (General_options::parse_end_lib): New.
5507 (Input_arguments::add_file): Handle lib groups.
5508 (Input_arguments::start_group): Check we are not in a lib.
5509 (Input_arguments::start_lib): New.
5510 (Input_arguments::end_lib): New.
5511 * options.h (General_options): Add start_lib and end_lib.
5512 (Input_argument::lib_): New.
5513 (Input_argument::lib): New.
5514 (Input_argument::is_lib): New.
5515 (Input_file_lib): New.
5516 (Input_arguments::in_lib_): New.
5517 (Input_arguments::in_lib): New.
5518 (Input_arguments::start_lib): New.
5519 (Input_arguments::end_lib_): New.
5520 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5521 in unused members as preempted.
5522 (Sized_pluginobj::do_should_include_member): New.
5523 * plugin.h (Sized_pluginobj::do_should_include_member): New.
5524 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5526 (Read_symbols::do_whole_lib_group): New.
5527 (Read_symbols::do_lib_group): New.
5528 (Read_symbols::do_read_symbols): Handle lib groups.
5529 (Read_symbols::get_name): Handle lib groups.
5530 * readsyms.h (Read_symbols): Add an archive member pointer.
5531 (Read_symbols::do_whole_lib_group): New.
5532 (Read_symbols::do_lib_group): New.
5533 (Read_symbols::member_): New.
5534 * script.cc (read_input_script): Update call to queue_soon.
5536 2010-03-19 Doug Kwan <dougkwan@google.com>
5538 * arm.cc (Stub_table::Stub_table): Initialize new data members
5539 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5540 (Stub_table::add_reloc_stub): Assign stub offset and update
5541 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5542 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
5544 (Stub_table::update_data_size_and_addralign): Use
5545 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
5546 instead of going over all reloc stubs.
5547 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
5548 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5549 Stringpool_template::offset_ to size of Stringpool_char.
5550 (Stringpool_template::new_key_offset): Remove code to initialize
5551 Stringpool_template::offset_.
5552 * stringpool.h (Stringpool_template::set_no_zero_null): Set
5553 Stringpool_template::offset_ to zero.
5555 2010-03-15 Doug Kwan <dougkwan@google.com>
5557 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5559 (Stringpool_template::new_key_offset): New method.
5560 (Stringpool_template::add_string): Assign offsets when adding new
5562 (Stringpool_template::set_string_offsets): Do not set string offsets
5563 when not optimizing.
5564 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5566 (Chunked_vector::clear): Clear size_.
5567 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5568 (Chunked_vector::size): Return size_.
5569 (Chunked_vector::push_back): Use size_ to find insert position.
5570 (Chunked_vector::size_): New data member.
5571 (Stringpool_template::set_no_zero_null): Assert string set is empty.
5572 (Stringpool_template::new_key_offset): New method declaration.
5573 (Stringpool_template::offset_): New data member.
5575 2010-03-15 Rafael Espindola <espindola@google.com>
5577 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
5578 Add_symbols' constructor.
5579 * readsyms.h (Add_symbols): Remove the input_group member.
5581 2010-03-10 Ian Lance Taylor <iant@google.com>
5583 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
5584 target to ask whether a reference to a symbol requires a stack
5586 * target.h (Target::is_call_to_non_split): New function.
5587 (Target::do_is_call_to_non_split): Declare virtual function.
5588 * target.cc: Include "symtab.h".
5589 (Target::do_is_call_to_non_split): New function.
5590 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
5592 2010-03-10 Cary Coutant <ccoutant@google.com>
5594 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
5595 (File_read::open[1]): Remove initial mapping of whole_file_view_.
5596 (File_read::open[2]): Add whole_file_view_ to list of views.
5597 (File_read::make_view): Remove test of whole_file_view_.
5598 (File_read::find_or_make_view): Create whole_file_view_ if
5600 (File_read::clear_views): Replace bool parameter with enum;
5601 adjust all callers. Don't delete views with permanent data;
5602 do delete cached views and views from archives if
5603 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
5604 if clearing the corresponding view.
5605 * fileread.h (File_read::Clear_views_mode): New enum.
5606 (File_read::View::is_permanent_view): New method.
5607 (File_read::clear_views): Replace bool parameter
5608 with enum; adjust all callers.
5609 * options.h (General_options): Change keep_files_mapped option;
5610 add map_whole_files.
5611 * readsyms.cc (Add_symbols::run): Delete sd_ object before
5613 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
5616 2010-03-10 David S. Miller <davem@davemloft.net>
5618 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
5620 2010-03-09 Sriraman Tallam <tmsriram@google.com>
5622 * icf.cc (get_section_contents): Add '@' marker after processing the
5625 2010-03-08 Doug Kwan <dougkwan@google.com>
5627 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
5628 due to a conversion warning.
5629 (Arm_relobj::update_output_local_symbol_count): Check for local
5630 symbol with unset output index.
5632 2010-03-05 Ian Lance Taylor <iant@google.com>
5634 * options.h (class General_options): Add --spare-dynamic-tags.
5635 * output.cc (Output_data_dynamic::set_final_data_size): Implement
5636 --spare-dynamic-tags.
5638 2010-03-05 Ian Lance Taylor <iant@google.com>
5640 * incremental.cc: Include "libiberty.h".
5642 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
5644 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
5645 function, is_info_ member.
5646 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
5647 (Versions::Versions): Update caller.
5648 (Versions::define_base_version): Likewise.
5649 (Versions::add_def): Likewise.
5651 2010-03-03 Sriraman Tallam <tmsriram@google.com>
5653 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
5654 (Scan::possible_function_pointer_reloc): New function.
5655 (Scan::local_reloc_may_be_function_pointer): Change to call
5656 possible_function_pointer_reloc.
5657 (Scan::global_reloc_may_be_function_pointer): Ditto.
5658 * icf.h (Icf::check_section_for_function_pointers): Change to reject
5659 relocations in ".data.rel.ro._ZTV" section.
5660 * testsuite/icf_safe_so_test.sh: Change to pass i386.
5661 * testsuite/icf_safe_so_test.cc: Ditto.
5662 * testsuite/icf_safe_test.cc: Ditto.
5663 * testsuite/icf_safe_test.sh: Ditto.
5665 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5666 Ian Lance Taylor <iant@google.com>
5668 * target-reloc.h (relocate_section): Check the symbol table index
5669 for -1U before setting the local symbol index.
5670 (scan_relocatable_relocs): If copying the relocation, record that
5671 the local symbol is required.
5672 * object.h (Symbol_value::is_output_symtab_index_set): New
5674 (Symbol_value::may_be_discarded_from_output_symtab): New
5676 (Symbol_value::has_output_symtab_entry): New function.
5677 (Symbol_value::needs_output_symtab_entry): Remove.
5678 (Symbol_value::output_symtab_index): Make sure the symbol index is
5680 (Symbol_value::set_output_symtab_index): Make sure the symbol
5681 index is not set. Make sure the new index is valid.
5682 (Symbol_value::set_must_have_output_symtab_entry): New function.
5683 (Symbol_value::has_output_dynsym_entry): New function.
5684 (Symbol_value::set_output_dynsym_index): Make sure the new index
5686 (Sized_relobj::set_must_have_output_symtab_entry): New function.
5687 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
5688 local symbol if permitted.
5689 (Sized_relobj::do_finalize_local_symbols): Call
5690 is_output_symtab_index_set rather than needs_output_symtab_entry.
5691 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
5692 rather than needs_output_symtab_entry. Call
5693 has_output_dynsym_entry rather than needs_output_dynsym_entry.
5694 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
5695 is_output_symtab_index_set rather than needs_output_symtab_entry.
5696 * testsuite/discard_locals_relocatable_test.c: New file.
5697 * testsuite/discard_locals_test.sh: Test -r.
5698 * testsuite/Makefile.am (check_DATA): Add
5699 discard_locals_relocatable_test1.syms,
5700 discard_local_relocatable_test2.syms.
5701 (MOSTLYCLEANFILES): Likewise. Also add
5702 discard_locals_relocatable_test1.lout and
5703 discard_locals_relocatable_test2.out.
5704 (discard_locals_relocatable_test1.syms): New target.
5705 (discard_locals_relocatable_test.o): New target.
5706 (discard_locals_relocatable_test1.out): New target.
5707 (discard_locals_relocatable_test2.syms): New target.
5708 (discard_locals_relocatable_test2.out): New target.
5709 (various): Add missing ../ld-new dependencies.
5710 * testsuite/Makefile.in: Rebuild.
5712 2010-03-03 Nick Clifton <nickc@redhat.com>
5714 * po/fi.po: New Finnish translation.
5716 2010-03-01 Doug Kwan <dougkwan@google.com>
5718 * layout.cc (Layout::Layout): Force section types of .init_array*,
5719 .preinit_array* and .fini_array* sections.
5720 * output.cc (Output_section::Input_section_sort_entry::has_priority):
5721 Fix check of return value of std::string::find.().
5722 (Output_section::Input_section_sort_compare::operator()): Remove
5723 comment about .init_array.
5724 (Output_section::Input_section_sort_init_fini_compare::operator()):
5726 (Output_section::sort_attached_input_sections): Handle .init_array
5727 and .fini_array specially.
5728 * output.h (Output_section::Inut_section_sort_compare): Update
5730 (Output_section::Input_section_sort_init_fini_compare): New struct.
5732 2010-02-26 Doug Kwan <dougkwan@google.com>
5734 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
5735 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
5736 * testsuite/debug_msg.sh: Avoid matching source line number for
5737 use of global variable undef_int.
5739 2010-02-26 Doug Kwan <dougkwan@google.com>
5741 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
5742 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
5743 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
5744 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
5745 * options.cc (General_options::General_options): Initialize member
5747 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
5748 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
5749 and rm_no_fix_v4bx.stdout
5750 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
5751 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
5752 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
5753 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
5754 and arm_no_fix_v4bx.
5755 * Makefile.in: Regenerate.
5756 * testsuite/arm_fix_v4bx.s: New file.
5757 * testsuite/arm_fix_v4bx.sh: Ditto.
5759 2010-02-24 Doug Kwan <dougkwan@google.com>
5761 * arm.cc (Target_arm::got_section): Make the .got section the first
5762 non RELRO section in the data segment.
5763 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
5764 suffixes of section names.
5766 2010-02-24 Doug Kwan <dougkwan@google.com>
5768 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
5769 flags and attributes merging if an input file is a binary file.
5770 * fileread.cc (Input_file::open): Record format of original file.
5771 * fileread.h (Input_file::Format): New enum type.
5772 (Input_file::Input_file): Initialize data member format_.
5773 (Input_file::format): New method definition.
5774 (Input_file::format_):: New data member.
5776 2010-02-24 Doug Kwan <dougkwan@google.com>
5778 * arm.cc (Arm_output_data_got): New class.
5779 (ARM_TCB_SIZE): New constant
5780 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
5781 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
5782 If user uses a script with a SECTIONS clause, issue only a warning
5783 for a misplaced EXIDX input section. Otherwise, issue an error.
5784 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
5786 (Target_arm::got_mode_index_entry): Handle static linking.
5787 (Target_arm::Scan::local): Ditto.
5788 (Target_arm::Scan::global): Ditto.
5789 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
5790 all incorrectly implemented relocations.
5791 (Target_arm::fix_exidx_coverage): Pass layout to
5792 Arm_output_section::fix_exidx_coverage.
5793 * layout.cc (Layout::section_name_mapping): Remove trailing dots
5794 from ".ARM.exidx." and ".ARM.extab.".
5796 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5798 * arm.cc (Target_arm::do_finalize_sections): Create attribute
5799 section if it does not already exist.
5800 * attributes.cc (Attributes_section_data::Attributes_section_data):
5801 Don't crash if size is zero.
5803 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5804 Ian Lance Taylor <iant@google.com>
5806 * gold.cc (queue_middle_tasks): If no input files were opened,
5808 * workqueue.h (Task_function::Task_function): Assert that there is
5811 2010-02-22 Doug Kwan <dougkwan@google.com>
5813 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
5814 * icf.cc (get_section_contents): Cast snprintf arguments to long long
5815 types to avoid warnings due to different uint64_t implementations
5818 2010-02-21 Doug Kwan <dougkwan@google.com>
5820 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
5821 handling of the maximum backward branch offset.
5822 (Arm_relocate_functions::thumb_branch_common): Ditto.
5823 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
5824 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
5825 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
5826 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
5827 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
5828 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
5829 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
5830 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
5831 thumb_bl_out_of_range thumb_bl_out_of_range.o,
5832 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
5833 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
5834 thumb2_bl_out_of_range.o): New rules.
5835 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
5836 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
5837 thumb2_bl_out_of_range
5838 * testsuite/Makefile.in: Regenerate.
5839 * testsuite/arm_bl_in_range.s: New file.
5840 * testsuite/arm_bl_out_of_range.s: Ditto.
5841 * testsuite/arm_branch_in_range.sh: Ditto.
5842 * testsuite/arm_branch_range.t: Ditto.
5843 * testsuite/thumb2_branch_range.t: Ditto.
5844 * testsuite/thumb_bl_in_range.s: Ditto.
5845 * testsuite/thumb_bl_out_of_range.s: Ditto.
5846 * testsuite/thumb_branch_range.t: Ditto.
5848 2010-02-20 Sriraman Tallam <tmsriram@google.com>
5850 * gc.h (gc_process_relocs): Change vectors to point to the new list.
5851 Add reloc offset information.
5852 * icf.cc (get_section_contents): Change iterators to point to the new
5853 vectors. Add reloc offset information to the contents.
5854 * icf.h (Icf::Sections_reachable_info): New typedef.
5855 (Icf::Sections_reachable_list): New typedef.
5856 (Icf::Offset_info): New typedef.
5857 (Icf::Reloc_info): New struct typedef.
5858 (Icf::Reloc_info_list): New typedef.
5859 (Icf::symbol_reloc_list): Delete method.
5860 (Icf::addend_reloc_list): Delete method.
5861 (Icf::section_reloc_list): Delete method.
5862 (Icf::reloc_info_list): New method.
5863 (Icf::reloc_info_list_): New member.
5865 2010-02-19 Doug Kwan <dougkwan@google.com>
5867 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
5868 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
5869 * arm.cc (Arm_relocation_functions): New forward declaration.
5870 (Target_arm::Target_arm): Initialize new data members
5871 got_mod_index_offset_ and tls_base_symbol_defined_.
5872 (Target_arm::Relocate::relocate_tls): New method.
5873 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
5874 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
5876 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
5877 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
5878 (Target_arm::got_mod_index_offset_,
5879 Target_arm::tls_base_symbol_defined_): New data members.
5880 (Target_arm::Scan::local, Target::Scan::global,
5881 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
5884 2010-02-18 Doug Kwan <dougkwan@google.com>
5886 * arm.cc (Arm_relobj::find_linked_text_section): New method.
5887 (Arm_relobj::make_exidx_input_section): Pass section index of linked
5888 text section as a parameter becuase some broken tools may not set
5889 the link in section header.
5890 (Target_arm::has_got_section): New method.
5891 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
5892 without any mapping symbol as data only. Remove warning.
5893 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
5894 link in its section header, try to discover the link by inspecting the
5895 REL31 relocation at the beginning of the section.
5896 (Target_arm::Scan::check_non_pic): Report name of offending relocation
5898 (Target_arm::Scan::global): Treat any reference to the symbol
5899 _GLOBAL_OFFSET_TABLE_ as a GOT access.
5901 2010-02-12 Sriraman Tallam <tmsriram@google.com>
5903 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
5904 (Scan::global_reloc_may_be_function_pointer): New function.
5905 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5906 (Scan::global_reloc_may_be_function_pointer): New function.
5907 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5908 (Scan::global_reloc_may_be_function_pointer): New function.
5909 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
5910 (Scan::global_reloc_may_be_function_pointer): New function.
5911 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
5912 (Scan::global_reloc_may_be_function_pointer): New function.
5913 (Scan::possible_function_pointer_reloc): New function.
5914 (Target_x86_64::can_check_for_function_pointers): New function.
5915 * gc.h (gc_process_relocs): Scan relocation types to determine if
5916 function pointers were taken for targets that support it.
5917 * icf.cc (Icf::find_identical_sections): Include functions for
5918 folding in safe ICF whose pointer is not taken.
5919 * icf.h (Secn_fptr_taken_set): New typedef.
5920 (fptr_section_id_): New member.
5921 (section_has_function_pointers): New function.
5922 (set_section_has_function_pointers): New function.
5923 (check_section_for_function_pointers): New function.
5924 * options.h: Fix comment for safe ICF option.
5925 * target.h (can_check_for_function_pointers): New function.
5926 * testsuite/Makefile.am: Add icf_safe_so_test test case.
5927 Modify icf_safe_test for X86-64.
5928 * testsuite/Makefile.in: Regenerate.
5929 * testsuite/icf_safe_so_test.cc: New file.
5930 * testsuite/icf_safe_so_test.sh: New file.
5931 * testsuite/icf_safe_test.cc (kept_func_3): New function.
5932 (main): Change to take pointer to function kept_func_3.
5933 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
5934 folding is done correctly for X86-64.
5936 2010-02-12 David S. Miller <davem@davemloft.net>
5938 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
5939 is_symbolless parameter.
5940 (Output_reloc<SHT_REL>::is_symbolless): New.
5941 (Output_reloc<SHT_REL>::is_symbolless_): New.
5942 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
5943 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
5944 (Output_reloc<SHT_RELA>::is_symbolless): New.
5945 (Output_data_reloc::add_global): Handle is_symbolless.
5946 (Output_data_reloc::add_global_relative): Likewise.
5947 (Output_data_reloc::add_local): Likewise.
5948 (Output_data_reloc::add_local_relative): Likewise.
5949 (Output_data_reloc::add_symbolless_global_addend): New.
5950 (Output_data_reloc::add_symbolless_local_addend): New.
5951 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
5953 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
5954 instead of ->is_relative_
5955 (Output_reloc::write): Likewise.
5956 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
5957 (Output_reloc::write_rel): Simplify.
5959 * sparc.cc (Target_sparc::Scan::local): Use
5960 ->add_symbolless_local_addend as needed.
5961 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
5962 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
5963 based upon relocation offset.
5965 2010-02-11 Doug Kwan <dougkwan@google.com>
5967 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
5968 (Target_arm::Scan::global): Ditto. Also remove a comment before the
5969 beginning of function.
5970 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
5971 and MOVT_ABS relocations. Those are non issued in scanning. Fix
5972 parameter is_32bit in calls to should_apply_static_reloc.
5973 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
5974 (check_DATA): Add arm_abs_global.stdout.
5975 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
5976 arm_abs_global.stdout): New rules.
5977 (MOSTLLYCLEANFILES): Add arm_abs_global
5978 * Makefile.in: Regenerate.
5979 * testsuite/arm_abs_global.s: New file.
5980 * testsuite/arm_abs_global.sh: Ditto.
5981 * testsuite/arm_abs_lib.s: Ditto.
5983 2010-02-11 Ian Lance Taylor <iant@google.com>
5985 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
5987 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
5988 Allocate_commons_task first.
5989 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
5990 task, rather than symtab_lock_.
5991 (Gc_process_relocs::~Gc_process_relocs): New function.
5992 (Gc_process_relocs::is_runnable): Check this_blocker_.
5993 (Gc_process_relocs::locks): Use next_blocker_ rather than
5995 (Scan_relocs::~Scan_relocs): New function.
5996 (Scan_relocs::is_runnable): Check this_blocker_ rather than
5998 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
6000 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
6001 fields. Add this_blocker_ and next_blocker_ fields. Adjust
6002 constructor accordingly.
6003 (class Gc_process_relocs): Likewise.
6004 (class Scan_relocs): Likewise.
6005 * common.h (class Allocate_commons_task): Remove symtab_lock_
6006 field, and corresponding constructor parameter.
6007 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
6009 (Allocate_commons_task::locks): Likewise.
6011 2010-02-11 Ian Lance Taylor <iant@google.com>
6013 * gold-threads.h (class Once): Define.
6014 (class Initialize_lock): Rewrite as child of Once.
6015 * gold-threads.cc (class Once_initialize): Define.
6016 (once_pointer_control): New static variable.
6017 (once_pointer, once_arg): New static variables.
6018 (c_run_once): New static function.
6019 (Once::Once, Once::run_once, Once::internal_run): New functions.
6020 (class Initialize_lock_once): Remove.
6021 (initialize_lock_control): Remove.
6022 (initialize_lock_pointer): Remove.
6023 (initialize_lock_once): Remove.
6024 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
6025 (Initialize_lock::initialize): Rewrite.
6026 (Initialize_lock::do_run_once): New function.
6027 * archive.cc (Archive::interpret_header): Only clear name if it is
6029 * fileread.cc: Include "gold-threads.h"
6030 (file_counts_lock): New static variable.
6031 (file_counts_initialize_lock): Likewise.
6032 (File_read::release): Only increment counts when using --stats.
6033 Use a lock around the increment.
6034 * parameters.cc (class Set_parameters_target_once): Define.
6035 (set_parameters_target_once): New static variable.
6036 (Parameters::Parameters): Move here from parameters.h.
6037 (Parameters::set_target): Rewrite.
6038 (Parameters::set_target_once): New function.
6039 (Parameters::clear_target): Move here and rewrite.
6040 * parameters.h (class Parameters): Update declarations. Add
6041 set_parameters_target_once_ field.
6042 (Parameters::Parameters): Move to parameters.cc.
6043 (Parameters::clear_target): Likewise.
6044 * readsyms.cc (Read_symbols::do_group): Create a Start_group
6046 (Start_group::~Start_group): New function.
6047 (Start_group::is_runnable): New function.
6048 (Start_group::locks, Start_group::run): New functions.
6049 (Finish_group::run): Change saw_undefined to size_t.
6050 * readsyms.h (class Start_group): Define.
6051 (class Finish_group): Change saw_undefined_ field to size_t.
6052 (Finish_group::Finish_group): Remove saw_undefined and
6053 this_blocker parameters. Change all callers.
6054 (Finish_group::set_saw_undefined): New function.
6055 (Finish_group::set_blocker): New function.
6056 * symtab.h (class Symbol_table): Change saw_undefined to return
6057 size_t. Change saw_undefined_ field to size_t.
6058 * target-select.cc (Set_target_once::do_run_once): New function.
6059 (Target_selector::Target_selector): Initialize set_target_once_
6060 field. Don't initialize lock_ and initialize_lock_ fields.
6061 (Target_selector::instantiate_target): Rewrite.
6062 (Target_selector::set_target): New function.
6063 * target-select.h (class Set_target_once): Define.
6064 (class Target_selector): Update declarations. Make
6065 Set_target_once a friend. Remove lock_ and initialize_lock_
6066 fields. Add set_target_once_ field.
6068 2010-02-10 Ian Lance Taylor <iant@google.com>
6070 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
6072 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
6073 (queue_middle_tasks): Add all blockers before queueing any tasks.
6074 (queue_final_tasks): Likewise.
6075 * token.h (Task_token::add_blockers): New function.
6076 * object.h (Input_objects::number_of_relobjs): New function.
6078 2010-02-10 Ian Lance Taylor <iant@google.com>
6080 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
6081 shared, not if not position independent.
6082 * x86_64.cc (Relocate::relocate_tls): Likewise.
6083 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
6084 (tls_pie_pic_test): New target.
6085 * testsuite/Makefile.in: Rebuild.
6087 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
6088 (tls_test_main_pie.o, tls_test_pie.o): New targets.
6089 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
6090 * testsuite/Makefile.in: Rebuild.
6092 2010-02-09 David S. Miller <davem@davemloft.net>
6094 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
6095 R_SPARC_RELATIVE using ->add_local_relative().
6096 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
6098 * output.h (Output_data_dynamic::add_section_size): New method
6099 that takes two Output_data objects.
6100 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
6101 entry param. Handle it in initializers.
6102 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
6103 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
6104 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
6106 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
6107 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
6108 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
6109 for dynrel_includes_plt.
6110 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6111 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6112 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
6114 (Target_sparc::do_finalize_sections): Update to pass true for
6115 dynrel_includes_plt.
6116 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
6117 output before .rela.plt
6118 (Target_powerpc::do_finalize_sections): Update to pass true for
6119 dynrel_includes_plt when 32-bit.
6121 2010-02-08 Doug Kwan <dougkwan@google.com>
6123 * arm.cc (Arm_relobj::simple_input_section_output_address): New
6125 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
6126 Arm_relobj::scan_section_for_cortex_a8_stubs,
6127 Arm_relobj::do_relocation_section): Instead of calling
6128 Output_section::output_address, use faster
6129 Arm_relobj::simple_input_section_output_address.
6131 2010-02-08 David S. Miller <davem@davemloft.net>
6133 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
6134 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
6135 relocation helper function.
6137 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
6138 just like R_SPARC_GOT{10,13,22}.
6139 (Target_sparc::Scan::local): Likewise.
6140 (Target_sparc::Relocate:relocate): Likewise.
6142 2010-02-06 Ian Lance Taylor <iant@google.com>
6144 * configure.ac: Rewrite targetobjs duplicate removal code to use
6145 only shell constructs.
6146 * configure: Rebuild.
6148 2010-02-05 Doug Kwan <dougkwan@google.com>
6151 * arm.cc (Arm_relobj::section_is_scannable): New method.
6152 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
6153 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
6155 2010-02-04 Doug Kwan <dougkwan@google.com>
6158 * arm-reloc-property.cc (cstdio): Include.
6159 * configure.ac (targetobjs): Remove duplicates.
6160 * configure: Regenerate.
6161 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
6162 big and little endian version for a given address size.
6164 2010-02-03 Doug Kwan <dougkwan@google.com>
6166 * arm-reloc-property.cc
6167 (Arm_reloc_property_table::reloc_name_in_error_message): New method
6169 * arm-reloc-property.h
6170 (Arm_reloc_property_table::get_implemented_static_reloc_property):
6171 New method definition.
6172 (Arm_reloc_property_table::reloc_name_in_error_message): New method
6174 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
6176 (GOT_PREL): Change implemented to Y.
6177 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
6178 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
6179 (Arm_relocate_functions::movw_abs_nc): Remove method.
6180 (Arm_relocate_functions::movt_abs): Ditto.
6181 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
6182 (Arm_relocate_functions::thm_movt_abs): Ditto.
6183 (Arm_relocate_functions::movw_rel_nc): Ditto.
6184 (Arm_relocate_functions::movw_rel): Ditto.
6185 (Arm_relocate_functions::movt_rel): Ditto.
6186 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
6187 (Arm_relocate_functions:thm_movw_rel): Ditto.
6188 (Arm_relocate_functions:thm_movt_rel): Ditto.
6189 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
6190 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
6191 New method definitions.
6192 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
6193 (Arm_relocation_functions::arm_grp_ldr): Ditto.
6194 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
6195 (Arm_relocation_functions::arm_grp_ldc): Ditto.
6196 (Target_arm::Relocate::relocate): Check for non-static or
6197 unimplemented relocation code and exit early. Change calls to
6198 Target_arm::reloc_uses_thumb_bit and
6199 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
6200 instead. Refactor code to handle similar relocations to increase
6201 code sharing. Remove check for unsupported relocation code in switch
6203 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
6204 relocation property table to find out size. Change error message to
6205 print out the name of a relocation code instead of the numeric value.
6206 (Target_arm::scan_reloc_for_stub): Use relocation property table
6207 instead of calling Target_arm::reloc_uses_thumb_bit().
6209 2010-02-02 Doug Kwan <dougkwan@google.com>
6211 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
6212 types of relaxed input section.
6214 2010-02-02 Doug Kwan <dougkwan@google.com>
6216 * Makefile.am (HFILES): Add arm-reloc-property.h.
6218 (TARGETSOURCES): Add arm-reloc-property.cc
6219 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
6220 (libgold_a_SOURCES): $(DEFFILES)
6221 * Makefile.in: Regenerate.
6222 * arm-reloc-property.cc: New file.
6223 * arm-reloc-property.h: New file.
6224 * arm-reloc.def: New file.
6225 * arm.cc: Update comments.
6226 (arm-reloc-property.h): New included header.
6227 (arm_reloc_property_table): New global variable.
6228 (Target_arm::do_select_as_default_target): New method definition.
6229 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
6230 arm-reloc-property to targ_extra_obj.
6231 * parameters.cc (set_parameters_target): Call
6232 Target::select_as_default_target().
6233 * target.h (Target::select_as_default_target): New method definition.
6234 (Target::do_select_as_default_target): Same.
6236 2010-02-01 Doug Kwan <dougkwan@google.com>
6238 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
6239 first_output_text_section_.
6240 (Arm_exidx_fixup::first_output_text_section): New method definition.
6241 (Arm_exidx_fixup::first_output_text_section_): New data member.
6242 (Arm_exidx_fixup::process_exidx_section): Record the first text
6243 output section seen.
6244 (Arm_output_section::fix_exidx_coverage): Set correct linked section
6245 and entsize in output section header.
6247 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6249 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
6250 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
6251 (Arm_relocate_functions::thm_alu11): New Method.
6252 (Arm_relocate_functions::thm_pc8): New Method.
6253 (Arm_relocate_functions::thm_pc12): New Method.
6254 (Target_arm::Scan::local): Handle the relocations.
6255 (Target_arm::Scan::global): Likewise.
6256 (Target_arm::Relocate::relocate): Likewise.
6257 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6259 2010-01-29 Doug Kwan <dougkwan@google.com>
6261 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
6262 of relocation types as ld.
6264 2010-01-29 Doug Kwan <dougkwan@google.com>
6266 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
6268 (Arm_relocate_functions::thumb_branch_common): Ditto.
6269 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
6270 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
6271 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
6272 Arm_relocate_functions::jump24): Remove.
6273 (Target_arm::Relocate::relocate): Adjust code to call
6274 Arm_relocation_functions::arm_branch_common and
6275 Arm_relocation_functions::thumb_branch_common instead of their removed
6276 wrappers. Merge switch-cases together to reduce source code size.
6278 2010-01-29 Doug Kwan <dougkwan@google.com>
6280 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
6281 output_local_symbol_count_needs_update_.
6282 (Arm_relobj::output_local_symbol_count_needs_update,
6283 Arm_relobj::set_output_local_symbol_count_needs_update,
6284 Arm_relobj::update_output_local_symbol_count): New methods.
6285 (Arm_relobj::output_local_symbol_count_needs_update_): New data
6287 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
6288 of pointed function as in a R_ARM_PREL31 relocation.
6289 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
6290 for output local symbol count updating.
6291 (Target_arm::do_relax): Update output local symbol counts in objects
6293 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
6295 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6297 * arm.cc: Added support for the ARM relocations:
6298 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
6299 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
6300 (Arm_relocate_functions::movw_rel_nc): Renamed (was
6302 (Arm_relocate_functions::movw_rel): New method.
6303 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
6304 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
6306 (Arm_relocate_functions::thm_movw_rel): New method.
6307 (Arm_relocate_functions::thm_movt_rel): Renamed (was
6309 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
6311 (Target_arm::Scan::global): Likewise.
6312 (Target_arm::Relocate::relocate): Likewise.
6313 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6316 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6318 * arm.cc: Added support for ARM group relocations.
6319 (Target_arm::reloc_needs_sym_origin): New method.
6320 (Arm_relocate_functions::calc_grp_kn): New method.
6321 (Arm_relocate_functions::calc_grp_residual): New method.
6322 (Arm_relocate_functions::calc_grp_gn): New method.
6323 (Arm_relocate_functions::arm_grp_alu): New Method.
6324 (Arm_relocate_functions::arm_grp_ldr): New Method.
6325 (Arm_relocate_functions::arm_grp_ldrs): New Method.
6326 (Arm_relocate_functions::arm_grp_ldc): New Method.
6327 (Target_arm::Scan::local): Handle the ARM group relocations.
6328 (Target_arm::Scan::global): Likewise.
6329 (Target_arm::Relocate::relocate): Likewise.
6330 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6333 2010-01-26 Doug Kwan <dougkwan@google.com>
6335 * arm.cc (set): Include.
6336 (class Arm_exidx_fixup): Change type of last_input_section_ to const
6338 (Arm_output_section::Text_section_list): New type.
6339 (Arm_output_section::append_text_sections_to_list): New method.
6340 (Arm_output_section::fix_exidx_coverage): Ditto.
6341 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
6342 (Arm_relobj::convert_input_section_to_relaxed_section): Use
6343 Relobj::set_section_offset() instead of
6344 Sized_relobj::invalidate_section_offset().
6345 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
6346 parameter for section headers. Ignore relocation sections for
6347 unallocated sections and EXIDX sections.
6348 (Target_arm::fix_exidx_coverage): New method.
6349 (Target_arm::output_section_address_less_than): New type.
6350 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
6351 linked text section instead of the EXIDX section.
6352 (Arm_output_section::create_stub_group): Add an assertion to check
6353 that this is not an EXIDX output section.
6354 (Arm_output_section::append_text_sections_to_list): New method.
6355 (Arm_output_section::fix_exidx_coverage): Ditto.
6356 (Arm_relobj::scan_sections_for_stubs): Adjust call to
6357 Arm_relobj::section_needs_reloc_stub_scanning.
6358 (Target_arm::do_relax): Fix EXIDX output section coverage in the
6360 (Target_arm::fix_exidx_coverage): New method.
6361 * object.h (Relobj::set_output_section): New method.
6362 (Sized_relobj::invalidate_section_offset): Remove method.
6363 (Sized_relobj::do_invalidate_section_offset): Remove method.
6364 (Sized_relobj::do_set_section_offset): Handle offset value -1.
6366 2010-01-25 Doug Kwan <dougkwan@google.com>
6368 * arm.cc (Arm_exidx_merged_section::do_output_offset):
6369 Fix warning due to signed and unsigned comparison on a 32-bit host.
6371 2010-01-22 Doug Kwan <dougkwan@google.com>
6373 * arm.cc (Target_arm::do_relax): Record an output section for section
6374 offset adjustment it contains any stub table that has changed.
6375 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
6376 offsets in an output section if necessary.
6377 * output.cc (Output_section::Output_section): Initialize
6378 section_offsets_need_adjustments_.
6379 (Output_section::add_input_section_for_script): Renamed to
6380 Output_section::add_simple_input_section.
6381 (Output_section::save_states): Add a comment.
6382 (Output_section::discard_states): New method defintion.
6383 (Output_section::adjust_section_offsets): Same.
6384 * output.h (Output_section::add_input_section_for_script): Renamed to
6385 Output_section::add_simple_input_section.
6386 (Output_section::discard_states): New method declaration.
6387 (Output_section::adjust_section_offsets): Same.
6388 (Output_section::section_offsets_need_adjustment,
6389 Output_section::set_section_offsets_need_adjustment): New method
6391 (Output_section::section_offsets_need_adjustment_): New data member.
6392 * script-sections.cc
6393 (Output_section_element_input::set_section_address): Adjust code for
6394 renaming of Output_section::add_input_section_for_script.
6395 (Orphan_output_section::set_section_address): Same.
6397 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6399 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
6400 Fix_v4bx enum values .
6401 * gold/options.h (General_options): New option definitions.
6402 (General_options::fix_v4bx): New method.
6403 (General_options::Fix_v4bx): New enum.
6404 * gold/options.cc (General_options::parse_fix_v4bx): New method.
6405 (General_options::parse_fix_v4bx_interworking): New method.
6407 2010-01-22 Doug Kwan <dougkwan@google.com>
6409 * arm.cc (Arm_exidx_fixup): New class.
6411 2010-01-21 Doug Kwan <dougkwan@google.com>
6413 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
6415 (Arm_exidx_section_offset_map): New type.
6417 2010-01-21 Doug Kwan <dougkwan@google.com>
6419 * arm.cc (Arm_exidx_input_section): New class.
6420 (Arm_relobj::exidx_input_section_by_link,
6421 Arm_relobj::exidx_input_section_by_shndx,
6422 Arm_relobj::make_exidx_input_section): New methods.
6423 (read_arm_attributes_section): Remove.
6424 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
6425 information about them.
6426 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
6429 2010-01-20 Doug Kwan <dougkwan@google.com>
6431 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
6432 Input_section_specifier to Section_id.
6433 (Target_arm::new_arm_input_section: Adjust code for change of key
6435 (Target_arm::find_arm_input_section): Ditto.
6436 * gc.h (object.h): Include for Section_id nand Section_id_hash.
6437 (Section_id): Remove.
6438 (Garbage_collection::Section_id_hash): Remove.
6439 * icf.h (object.h): Include for Section_id nand Section_id_hash.
6440 (Section_id): Remove.
6441 (Icf::Section_id_hash): Remove.
6442 * object.h (Section_id, Const_section_id, Section_id_hash,
6443 Const_section_id_hash): New type definitions.
6444 * output.cc (Output_section::add_relaxed_input_section): Change to
6445 use Const_section_id instead of Input_section_specifier as key type.
6446 (Output_section::add_merge_input_section): Ditto.
6447 (Output_section::build_relaxation_map): Change to use Section_id
6448 instead of Input_section_specifier as key type.
6449 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6451 (Output_section::convert_input_sections_to_relaxed_sections): Change
6452 to use Const_section_id instead of Input_section_specifier as key type.
6453 (Output_section::find_merge_section): Ditto.
6454 (Output_section::find_relaxed_input_section): Ditto.
6455 * output.h (Input_section_specifier): Remove class.
6456 (Output_section::Output_section_data_by_input_section_map): Change
6457 key type to Const_section_id.
6458 (Output_section::Output_relaxed_input_section_by_input_section_map):
6460 (Output_section::Relaxation_map): Change key type to Section_id.
6462 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6464 * gold/arm.cc: Added support for R_ARM_V4BX relocation
6465 (class Arm_v4bx_stub): New class.
6466 (DEF_STUBS): Updated definition to support v4_veneer_bx.
6467 (Stub_factory::make_arm_v4bx_stub): New method.
6468 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
6469 (Stub_table::empty): Handle v4bx stubs.
6470 (Stub_table::add_arm_v4bx_stub): New method.
6471 (Stub_table::find_arm_v4bx_stub): New method.
6472 (Arm_relocate_functions::v4bx): New method.
6473 (Target_arm::fix_v4bx): New method.
6474 (Target_arm::Target_arm): Handle R_ARM_V4BX.
6475 (Stub_table::relocate_stubs): Likewise.
6476 (Stub_table::do_write): Likewise.
6477 (Stub_table::update_data_size_and_addralign): Likewise.
6478 (Stub_table::finalize_stubs): Likewise.
6479 (Target_arm::Scan::local): Likewise.
6480 (Target_arm::Scan::global): Likewise.
6481 (Target_arm::do_finalize_sections): Likewise.
6482 (Target_arm::Relocate::relocate): Likewise.
6483 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6485 (Target_arm::scan_reloc_for_stub): Likewise.
6486 (Target_arm::scan_reloc_section_for_stubs): Likewise.
6488 2010-01-19 Ian Lance Taylor <iant@google.com>
6490 * output.cc (Output_section_headers::do_sized_write): Write large
6491 segment count to sh_info field.
6492 (Output_file_header::do_sized_write): For large segment count,
6493 write PN_XNUM to e_phnum field.
6495 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6497 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
6498 (Arm_relocate_functions::thm_jump8): New function.
6499 (Arm_relocate_functions::thm_jump11): New function.
6500 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
6502 (Target_arm::Scan::global): Likewise.
6503 (Target_arm::Relocate::relocate): Likewise.
6504 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6507 2010-01-14 Doug Kwan <dougkwan@google.com>
6509 * arm.cc (map, utility): Include headers.
6510 (Target_arm::apply_cortex_a8_workaround): New method.
6511 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
6512 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
6513 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
6514 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
6515 the --[no-]fix-cortex-a8 command line options.
6516 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
6517 (Target_arm::relocate_stub): Use addend in instruction template.
6518 * options.h (DEFINE_bool): Set the user-set flag.
6519 (General_options): Add --[no-]-fix-cortex options.
6520 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
6521 : Update fast look-up map after conversion.
6523 2010-01-14 Sriraman Tallam <tmsriram@google.com>
6525 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6526 in the first pass of do_layout.
6528 2010-01-13 Doug Kwan <dougkwan@google.com>
6530 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6531 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6532 apparent compiler problem of not folding static constant integral
6533 data members of elfcpp::Elf_sizes<32>.
6535 2010-01-13 Doug Kwan <dougkwan@google.com>
6537 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6538 Arm_relobj::section_needs_cortex_a8_stub_scanning,
6539 Arm_relobj::scan_section_for_cortex_a8_erratum,
6540 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
6541 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
6542 sections to scan for relocation stubs into a new method
6543 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
6544 relocation and Cortex-A8 stub scanning.
6545 (Target_arm::do_relax): Force stubs to be after stubbed sections
6546 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
6547 the beginning of a new relaxation pass. Update a comment.
6548 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
6550 2010-01-12 Ian Lance Taylor <iant@google.com>
6552 * target-reloc.h (visibility_error): New inline function.
6553 (relocate_section): Call visibility_error.
6554 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6555 (MOSTLYCLEANFILES): Likewise.
6556 (protected_4_pic.o, protected_3.err): New targets.
6557 * testsuite/protected_4.cc: New file.
6559 2010-01-12 Doug Kwan <dougkwan@google.com>
6561 * arm.cc (Cortex_a8_reloc): New class.
6562 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6563 and cortex_a8_relocs_info_.
6564 (Target_arm::fix_cortex_a8): New method definition.
6565 (Target_arm::Cortex_a8_relocs_info): New type.
6566 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6567 New data member declarations.
6568 (Target_arm::scan_reloc_for_stub): Record information about
6569 relocations for THUMB branches that might be exempted from the
6570 Cortex-A8 workaround.
6571 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
6572 at the beginning of a relaxation pass.
6574 2010-01-12 Doug Kwan <dougkwan@google.com>
6576 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
6577 (Arm_relobj::Mapping_symbol_position,
6578 Arm_reloj::Mapping_symbol_position_less,
6579 Arm_relobj::Mapping_symbols_info): New types.
6580 (Target_arm::is_mapping_symbol_name): New method definition.
6581 (Arm_relobj::do_count_local_symbols): Save information about mapping
6584 2010-01-11 Doug Kwan <dougkwan@google.com>
6586 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
6587 Arm_relocate_functions::thumb32_branch_upper,
6588 Arm_relocate_functions::thumb32_branch_lower,
6589 Arm_relocate_functions::thumb32_cond_branch_offset,
6590 Arm_relocate_functions::thumb32_cond_branch_upper,
6591 Arm_relocate_functions::thumb32_cond_branch_lower,
6592 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
6593 branch offset encoding.
6594 (Arm_relocate_functions::thumb_branch_common): Use new branch
6595 offset encoding methods to avoid code duplication.
6596 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
6597 (Stub_addend_reader::operator()): Use new branch encoding method
6598 to avoid code duplication.
6600 2010-01-11 Doug Kwan <dougkwan@google.com>
6602 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
6603 (Target_arm::do_finalize_sections): Define special EXIDX section
6604 symbols only if referenced.
6605 * gc.h (Garbage_collection::add_reference): New method.
6606 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
6609 2010-01-11 Ian Lance Taylor <iant@google.com>
6611 * script.cc (Version_script_info::build_expression_list_lookup):
6612 Change complaing about duplicate wildcard match from error to
6615 * script.cc (class Lazy_demangler): Recreate--revert part of patch
6617 (Version_script_info::Version_script_info): Initialize globs_,
6618 default_version_, default_is_global_, and exact_. Don't
6619 initialize globals_ or locals_.
6620 (Version_script_info::build_lookup_tables): Build local symbols
6622 (Version_script_info::unquote): New function.
6623 (Version_script_info::add_exact_match): New function.
6624 (Version_script_info::build_expression_list_lookup): Remove lookup
6625 parameter. Add is_global parameter. Change all callers. Handle
6626 wildcard pattern specially. Unquote pattern. Call
6628 (Version_script_info::get_name_to_match): New function.
6629 (Version_script_info::get_symbol_version): New function.
6630 (Version_script_info::get_symbol_version_helper): Remove.
6631 (Version_script_info::check_unmatched_names): Call unquote.
6632 * script.h (class Version_script_info): Change get_symbol_version
6633 to be non-inline and add is_global parameter; change all callers.
6634 Rewrite symbol_is_local. Update declarations. Define struct
6635 Version_tree_match, Exact, Globs. Don't define struct Lookup.
6636 Remove globals_ and locals_ members. Add exact_, globs_,
6637 default_version_, is_global_.
6638 (Version_script_info::Glob): Remove pattern, add expression and
6639 is_global. Update constructor. Change all callers.
6640 * dynobj.cc (Versions::finalize): Mark the version symbol as the
6642 (Versions::symbol_section_contents): If a symbol is undefined, or
6643 defined in a dynamic object, set the version index to
6645 * symtab.cc (Symbol_table::add_from_relobj): Don't call
6647 (Symbol_table::add_from_pluginobj): Likewise.
6648 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
6650 2010-01-11 Doug Kwan <dougkwan@google.com>
6652 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
6653 (incremental_dump_LDADD): Add linking option for libintl.
6654 * Makefile.in: Regenerate.
6656 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
6659 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
6661 * testsuite/Makefile.in: Regenerated.
6663 2010-01-10 Doug Kwan <dougkwan@google.com>
6665 * options.h (DEFINE_var): Use parentheses around argument varname__
6666 in macro body to avoid any unintended subsequent substitutions.
6668 2010-01-10 Ian Lance Taylor <iant@google.com>
6670 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
6671 candidates before doing symbol resolution.
6673 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
6674 ODR candidates if only one is weak.
6676 2010-01-08 Ian Lance Taylor <iant@google.com>
6678 * script.cc (Version_script_info::build_expression_list_lookup):
6679 Don't warn about ambiguous version, just record the ambiguity.
6680 (Version_script_info::get_symbol_version_helper): Give error if
6681 version is ambiguous.
6683 2010-01-08 Doug Kwan <dougkwan@google.com>
6685 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
6686 prev_data_size_ and prev_addralign_. Remove initializer for
6687 deleted data member has_been_changed_.
6688 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
6689 to determine if the table is empty.
6690 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
6692 (Stub_table::add_reloc_stub): Define method in class definition
6693 instead of just declaring it there.
6694 (Stub_table::add_cortex_a8_stub): New method definition.
6695 (Stub_table::update_data_size_and_addralign): Ditto.
6696 (Stub_table::finalize_stubs): Ditto.
6697 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
6698 (Stub_table::do_addralign_): Return address alignment in the
6699 (Stub_table::do_reset_address_and_file_offset): Define method in
6700 class definition instead of declaring it there. Set current data
6701 size to be the data size of the previous pass.
6702 (Stub_table::set_final_data_size): Use current data size as the
6704 (Stub_table::relocate_stub): Change parameter type of stub from
6705 Reloc_stub pointer to Stub pointer.
6706 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
6707 (Stub_table::Cortex_a8_stub_list): New typedef.
6708 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
6709 Stub_table::prev_addralign_): New data member.
6710 (Arm_relobj::Arm_relobj): Initialize data member
6711 section_has_cortex_a8_workaround_.
6712 (Arm_relobj::section_has_cortex_a8_workaround,
6713 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
6715 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
6717 (Target_arm::relocate_stub): Change parameter type of stub from
6718 Reloc_stub pointer to Stub pointer.
6719 (Insn_template::size, Insn_template::alignment): Handle
6720 THUMB16_SPECIAL_TYPE.
6721 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
6722 Stub_table::update_data_size_and_addralign,
6723 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
6725 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
6726 (Stub_table::do_write): Ditto.
6727 (Target_arm::do_relax): Adjust code for changes in Stub_table.
6729 2010-01-08 Ian Lance Taylor <iant@google.com>
6732 * symtab.h (class Symbol): Remove fields is_target_special_ and
6733 has_plt_offset_. Add field is_defined_in_discarded_section_.
6734 (Symbol::is_defined_in_discarded_section): New function.
6735 (Symbol::set_is_defined_in_discarded_section): New function.
6736 (Symbol::has_plt_offset): Rewrite.
6737 (Symbol::set_plt_offset): Verify that new offset is not -1U.
6738 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
6739 Don't initialize is_target_special_ or has_plt_offset_.
6740 Initialize is_defined_in_discarded_section_.
6741 (Symbol_table::add_from_relobj): If appropriate, set
6742 is_defined_in_discarded_section.
6743 * resolve.cc (Symbol::override_base_with_special): Don't test
6744 is_target_special_. Change has_plt_offset_ to has_plt_offset().
6745 * target-reloc.h (relocate_section): Do special handling for
6746 symbols defined in discarded sections for global symbols as well
6749 2010-01-08 Ian Lance Taylor <iant@google.com>
6751 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
6752 the SHT_SYMTAB case.
6754 2010-01-08 Ian Lance Taylor <iant@google.com>
6756 * object.cc (Sized_relobj::do_layout): Don't get confused if
6757 layout_eh_frame returns NULL.
6759 2010-01-08 Ian Lance Taylor <iant@google.com>
6762 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
6763 dynamic symbol table, use the normal symbol table.
6764 (Sized_dynobj::do_read_symbols): Remove assertion about type of
6767 2010-01-08 Ian Lance Taylor <iant@google.com>
6770 * layout.cc (Layout::include_section): Remove .gnu_debuglink
6773 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
6775 * version.cc (print_version): Change to "Copyright 2010".
6777 2010-01-08 Ian Lance Taylor <iant@google.com>
6781 * i386.cc (class Target_i386): Change return type of plt_section
6783 (class Output_data_plt_i386): Add tls_desc_rel_ field.
6784 (Output_data_plt_i386::Output_data_plt_i386): Initialize
6785 tls_desc_rel_ field.
6786 (Output_data_plt_i386::rel_tls_desc): New function.
6787 (Target_i386::rel_tls_desc_section): New function.
6788 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
6789 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
6790 R_386_TLS_DESC reloc in rel_tls_desc_section.
6791 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
6792 Define struct Tlsdesc_info.
6793 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
6794 (Target_x86_64::do_reloc_symbol_index): New function.
6795 (Target_x86_64::add_tlsdesc_info): New function.
6796 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
6797 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
6799 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
6801 (Output_data_plt_x86_64::rela_tlsdesc): New function.
6802 (Target_x86_64::rela_tlsdesc_section): New function.
6803 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
6805 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
6806 (Target_x86_64::do_reloc_addend): New function.
6807 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
6808 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
6809 declarations. Define TARGET_CODE. Add arg field to u1_ union.
6810 (Output_reloc::type): New function.
6811 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
6812 (Output_reloc::is_target_specific): New function.
6813 (Output_reloc::target_arg): New function.
6814 (class Output_reloc) [SHT_RELA]: Add four new constructors for
6815 absolute relocs and target specific relocs.
6816 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
6817 add_target_specific.
6818 (class Output_data_reloc) [SHT_RELA]: Likewise.
6819 * output.cc (Output_reloc::Output_reloc): Add four new versions
6820 for absolute relocs and target specific relocs.
6821 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
6822 (Output_reloc::get_symbol_index): Likewise.
6823 (Output_reloc::local_section_offset): Check that local_sym_index_
6824 is not TARGET_CODE or 0.
6825 (Output_reloc::symbol_value): Likewise.
6826 (Output_reloc::write) [SHT_RELA]: Call target for target specific
6828 * target.h (class Target): Add reloc_symbol_index and reloc_addend
6829 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
6831 * layout.cc (add_target_dynamic_tags): Use output section for
6832 DT_PLTRELSZ and DT_JMPREL.
6834 2010-01-07 Ian Lance Taylor <iant@google.com>
6837 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
6839 (class Output_data_reloc_generic): Define.
6840 (class Output_data_reloc_base): Change base class to
6841 Output_data_reloc_generic. Change add() method to call
6842 bump_relative_reloc_count for a relative reloc. Remove
6844 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
6846 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
6847 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
6849 * layout.h (class Layout): Update declaration.
6851 2010-01-07 Ian Lance Taylor <iant@google.com>
6853 * output.h (class Output_data): Add const version of
6854 output_section and do_output_section.
6855 (class Output_section_data): Add const version of
6857 (class Output_section): Likewise.
6858 * layout.cc (Layout::add_target_dynamic_tags): New function.
6859 * layout.h (class Layout): Update declarations.
6860 * arm.cc (Target_arm::do_finalize_sections): Use
6861 add_target_dynamic_tags.
6862 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6863 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6864 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6865 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6867 2010-01-07 Ian Lance Taylor <iant@google.com>
6870 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
6873 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
6874 Ian Lance Taylor <iant@google.com>
6877 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
6878 Xindex::read_symtab_xindex.
6880 2010-01-07 Doug Kwan <dougkwan@google.com>
6882 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
6883 (Insn_template::thumb16_bcond_insn): New method declaration.
6884 (Insn_template): Fix spelling.
6885 (Stub::thumb16_special): New method declaration.
6886 (Stub::do_write): Define virtual method which was previously pure
6888 (Stub::do_thumb16_special): New method declaration.
6889 (Stub::do_fixed_endian_write): New template member.
6890 (Reloc_stub::do_write): Remove.
6891 (Reloc_stub::do_fixed_endian_write): Remove.
6892 (Cortex_a8_stub): New class definition.
6893 (Stub_factory::make_cortex_a8_stub): New method definition.
6894 (Stub_factory::Stub_factory): Add missing static storage class
6895 qualifier for elf32_arm_stub_a8_veneer_blx.
6897 2010-01-07 Ian Lance Taylor <iant@google.com>
6900 * options.h (class General_options): Add --warn-unresolved-symbols
6901 and --error-unresolved-symbols.
6902 * errors.cc (Errors::undefined_symbol): Implement
6903 --warn-unresolved-symbols.
6905 * options.h (class General_options): Add -z text and -z textoff.
6906 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
6908 2010-01-06 Sriraman Tallam <tmsriram@google.com>
6910 * gc.h (Garbage_collection::Cident_section_map): New typedef.
6911 (Garbage_collection::cident_sections): New function.
6912 (Garbage_collection::add_cident_section): New function.
6913 (Garbage_collection::cident_sections_): New member.
6914 (gc_process_relocs): Add references to sections whose names are C
6916 * gold.h (cident_section_start_prefix): New constant.
6917 (cident_section_stop_prefix): New constant.
6918 (is_cident): New function.
6919 * layout.cc (Layout::define_section_symbols): Replace string constants
6920 with the newly defined constants.
6921 * object.cc (Sized_relobj::do_layout): Track sections whose names are
6923 * testsuite/Makefile.am: Add gc_orphan_section_test.
6924 * testsuite/Makefile.in: Regenerate.
6925 * testsuite/gc_orphan_section_test.cc: New file.
6926 * testsuite/gc_orphan_section_test.sh: New file.
6928 2010-01-06 Ian Lance Taylor <iant@google.com>
6931 * options.h (class General_options): Add --warn-shared-textrel.
6932 * layout.cc (Layout::finish_dynamic_section): Implement
6933 --warn-shared-textrel.
6936 * options.h (class General_options): Add --warn-multiple-gp.
6938 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6940 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
6941 $(THREADSLIB) and $(LIBDL).
6942 * Makefile.in: Rebuild.
6944 2010-01-06 Ian Lance Taylor <iant@google.com>
6947 * options.cc (General_options::parse_section_start): New function.
6948 (General_options::section_start): New function.
6949 (General_options::General_options): Initialize all members.
6950 * options.h: Include <map>
6951 (class General_options): Add --section-start. Add section_starts_
6953 * layout.cc (Layout::attach_allocated_section_to_segment): If
6954 --section-start was used, set the address of the segment. Remove
6955 local sort_sections.
6956 (Layout::relaxation_loop_body): If the address of the load segment
6957 has been set by --section-start, don't use it.
6958 * output.h (Output_segment::update_flags_for_output_section): New
6960 * output.cc (Output_segment::add_output_section): Call
6961 update_flags_for_output_section.
6963 2010-01-05 Ian Lance Taylor <iant@google.com>
6966 * options.h (class General_options): Add --undefined-version.
6967 * script.cc (struct Version_expression): Add was_matched_by_symbol
6969 (Version_script_info::matched_symbol): New function.
6970 (Version_script_info::get_symbol_version_helper): Call
6972 (Version_script_info::check_unmatched_names): New function.
6973 * script.h (class Version_script_info): Update declarations.
6974 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
6976 * options.h (class General_options): Use DEFINE_bool_alias for
6977 allow_multiple_definition.
6978 * resolve.cc (Symbol_table::should_override): Don't test
6979 allow_multiple_definition.
6982 * options.h (class General_options): Add --cref.
6983 * main.cc (main): Print cref table if --cref. Don't close mapfile
6984 until after printing cref table.
6985 * cref.cc: Include "symtab.h".
6986 (class Cref_inputs): Define Cref_table_compare and Cref_table.
6987 (Cref_table_compare::operator()): New function.
6988 (Cref_inputs::gather_cref): New function.
6989 (filecol): New static const.
6990 (Cref_inputs::print_cref): New function.
6991 (Cref::print_cref): New function.
6992 * cref.h: Include <cstdio>.
6993 (class Cref): Update declarations.
6994 * mapfile.h (Mapfile::file): New function.
6995 * object.h (class Object): Define Symbols. Declare virtual
6996 do_get_global_symbols.
6997 (Object::get_global_symbols): New function.
6998 * object.cc (Input_objects::add_object): Pass object to cref_ if
7000 (Input_objects::archive_start): Likewise.
7001 (Input_objects::archive_stop): Likewise.
7002 (Input_objects::print_cref): New function.
7003 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
7004 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
7006 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
7008 * plugin.h (class Sized_pluginobj): Update declarations.
7010 2010-01-05 Ian Lance Taylor <iant@google.com>
7012 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
7013 to is_default_version. Rename insdef to insdefault.
7014 (Symbol_table::add_from_relobj): Rename def to is_default_version
7015 and local to is_forced_local.
7016 (Symbol_table::add_from_pluginobj): Likewise.
7017 (Symbol_table::add_from_dynobj): Likewise.
7018 (Symbol_table::define_special_symbol): Rename insdef to
7021 2010-01-04 Ian Lance Taylor <iant@google.com>
7024 * options.h (class General_options): Add
7025 --allow-multiple-definition and -z muldefs.
7026 * resolve.cc (Symbol_table::should_override): Don't warn about a
7027 multiple symbol definition if --allow-multiple-definition or -z
7031 * options.h (class General_options): Add --add-needed and
7032 --copy-dt-needed-entries. Tweak --as-needed help entry.
7033 * object.cc (Input_objects::check_dynamic_dependencies): Give an
7034 error if --copy-dt-needed-entries aka --add-needed is used and
7035 would cause a change in behaviour.
7038 * options.h (class General_options): Add -G as a short version of
7039 --shared. Add no-op options -assert, -g, and -i.
7041 2010-01-04 Sriraman Tallam <tmsriram@google.com>
7043 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
7044 check for .text or .gnu.linkonce.t sections.
7045 * icf.cc (Icf::find_identical_sections): Ditto.
7046 Change the detection for mangled function name within the section
7048 * icf.h (is_section_foldable_candidate): New function.
7050 2009-12-30 Ian Lance Taylor <iant@google.com>
7053 * options.h (class General_options): Permit two dashes with
7054 --retain-symbols-file.
7056 2009-12-30 Ian Lance Taylor <iant@google.com>
7059 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
7060 don't put the file header and segment headers in the text
7064 * common.cc (Sort_commons::operator()): Stabilize sort when both
7066 (Symbol_table::do_allocate_commons_list): When allocating common
7067 symbols, skip a symbol which is no longer common.
7068 * symtab.h (Symbol::is_common): Test whether the symbol comes from
7069 an object before checking its type.
7070 * testsuite/common_test_2.c: New file.
7071 * testsuite/common_test_3.c: New file.
7072 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
7073 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
7074 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
7075 (common_test_2_pic.o, common_test_2.so): New targets.
7076 (common_test_3_pic.o, common_test_3.so): New targets.
7077 * testsuite/Makefile.in: Rebuild.
7080 * script.cc (read_input_script): If we see a new SECTIONS clause,
7081 and we have added an input section, give an error.
7082 * layout.h (class Layout): Add have_added_input_section function.
7083 Add have_added_input_section_ field.
7084 * layout.cc (Layout::Layout): Initialize
7085 have_added_input_section_.
7086 (Layout::layout): Set have_added_input_section_.
7087 (Layout::layout_eh_frame): Likewise.
7089 2009-12-30 Ian Lance Taylor <iant@google.com>
7092 * options.h (class General_options): Add --sort-common option.
7093 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
7094 * common.cc (Sort_common): Add sort_order parameter to
7095 constructor. Add sort_order_ field.
7096 (Sort_commons::operator): Check sort_order_.
7097 (Symbol_table::allocate_commons): Determine the sort order.
7098 (Symbol_table::do_allocate_commons): Add sort_order parameter.
7100 (Symbol_table::do_allocate_commons_list): Likewise.
7102 2009-12-30 Ian Lance Taylor <iant@google.com>
7105 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
7106 symbols from this object, don't change the visibility of an
7108 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
7110 2009-12-30 Ian Lance Taylor <iant@google.com>
7113 * script.h (class Version_script_info): Define Language enum.
7114 Update declarations. Define Glob, Exact, and Lookup types. Add
7115 new fields globals_, locals_, and is_finalized_.
7116 * script.cc: Various formatting fixes.
7117 (class Parser_closure): Change language_stack_ from a vector of
7118 std::string to one of Version_script_info::Language. Adjust all
7120 (class Lazy_demangler): Remove.
7121 (struct Version_expression): Change language from std::string to
7122 Version_script_info::Language.
7123 (Version_script_info::Version_script_info): New function.
7124 (Version_script_info::~Version_script_info): Don't call clear.
7125 (Version_script_info::finalize): New function.
7126 (Version_script_info::build_lookup_tables): New function.
7127 (Version_script_info::build_expression_list_lookup): New
7129 (Version_script_info::get_symbol_version_helper): Rewrite to use
7131 (Version_script_info::print_expression_list): Adjust to use
7132 Version_script_info::Language.
7133 (script_push_lex_into_version_mode): Check that the version script
7134 has not been finalized.
7135 (version_script_push_lang): Change language string to
7136 Version_script_info::Language.
7137 * options.cc (Command_line::version_script): New function.
7138 * options.h (class General_options): Add finalize_dynamic_list
7139 function. Change version_script from declaration to definition.
7140 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
7141 * testsuite/version_script.map: Remove duplicate def of foo.
7142 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
7144 * testsuite/Makefile.in: Rebuild.
7146 2009-12-30 Ian Lance Taylor <iant@google.com>
7149 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
7150 if the input symbol index is 0, make the output symbol index 0.
7152 2009-12-30 Ian Lance Taylor <iant@google.com>
7155 * options.h (class General_options): Add -x/--discard-all.
7156 * object.cc (Sized_relobj::do_count_local_symbols): Handle
7157 --discard-all. If the local symbol needs a dynamic entry, check
7158 that before handling --discard-locals.
7160 2009-12-30 Ian Lance Taylor <iant@google.com>
7163 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
7165 (Output_segment::add_output_section): Don't change the flags if
7169 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
7170 GNU hash table if they need a dynamic value. Otherwise, don't add
7171 them if they are defined in a dynamic object or are forced local.
7173 2009-12-29 Ian Lance Taylor <iant@google.com>
7176 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
7177 .gnu.hash table for a 32-bit target.
7180 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
7181 regular and a dynamic object only needs a dynamic symbol table
7182 entry if it is externally visible.
7185 * i386.cc (class Target_i386): Initialize global_offset_table_ in
7186 constructor. Add global_offset_table_ field.
7187 (Target_i386::got_section): Set global_offset_table_.
7188 (Target_i386::do_finalize_sections): Set global_offset_table_
7190 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
7191 in constructor. Add global_offset_table_ field.
7192 (Target_x86_64::got_section): Set global_offset_table_.
7193 (Target_x86_64::do_finalize_sections): Set global_offset_table_
7196 * layout.cc (Layout::Layout): Initialize increase_relro_.
7197 (Layout::get_output_section): Add is_relro, is_last_relro, and
7198 is_first_non_relro parameters. Change all callers.
7199 (Layout::choose_output_section): Likewise.
7200 (Layout::add_output_section_data): Likewise.
7201 (Layout::make_output_section): Likewise.
7202 (Layout::set_segment_offsets): Clear increase_relro when using a
7204 * layout.h (class Layout): Add increase_relro method. Add
7205 increase_relro_ field. Update declarations.
7206 * output.cc (Output_section::Output_section): Initialize
7207 is_last_relro_ and is_first_non_relro_.
7208 (Output_segment::add_output_section): Group relro sections is
7209 do_sort is true. Handle is_last_relro and is_first_non_relro.
7210 (Output_segment::maximum_alignment): Remove relro handling.
7211 (Output_segment::set_section_addresses): Add increase_relro
7212 parameter. Change all callers. Add initial alignment to align
7213 relro sections on separate page. Remove old relro handling.
7214 (Output_segment::set_section_list_addresses): Remove in_relro
7215 parameter. Change all callers.
7216 (Output_segment::set_offset): Add increase parameter. Change all
7217 callers. Remove old relro handling.
7218 * output.h (class Output_section): Add new methods: is_last_relro,
7219 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
7220 Add is_last_relro_ and is_first_non_relro_ fields.
7221 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
7222 Create separate .got.plt section. Call increase_relro.
7223 * x86_64.cc (Target_x86_64::got_section): Likewise.
7224 * testsuite/relro_script_test.t: Add .got.plt.
7227 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
7228 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
7229 (Layout::finalize): Call set_dynamic_symbol_size.
7230 (Layout::set_dynamic_symbol_size): New function.
7231 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
7232 set_dynamic_symbol_size.
7235 * output.h (class Output_section): Add is_entsize_zero_ field.
7236 * output.cc (Output_section::Output_section): Initialize
7238 (Output_section::set_entsize): If two different entsizes are
7239 requested, force it to zero.
7240 (Output_section::add_input_section): Set flags for .debug_str
7241 before updating section flags. Set entsize.
7242 (Output_section::update_flags_for_input_section): Set SHF_MERGE
7243 and SHF_STRING if all input sections have those flags.
7245 2009-12-29 Rafael Espindola <espindola@google.com>
7247 * main.cc (main): Fix the sys time reporting.
7248 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
7251 2009-12-29 Sriraman Tallam <tmsriram@google.com>
7253 * options.cc (General_options::parse_version): Allow -v to exit
7254 without an error if there is nothing to link.
7256 2009-12-29 Ian Lance Taylor <iant@google.com>
7258 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
7259 using a version of gcc before 4.1.
7260 * configure: Rebuild.
7262 2009-12-28 Chris Demetriou <cgd@google.com>
7264 * attributes.cc (Output_attributes_section_data::do_write): Use
7265 std::vector::front rather than std::vector::data.
7267 2009-12-28 Ian Lance Taylor <iant@google.com>
7269 * symtab.h (class Symbol_table): Add enum Defined.
7270 * resolve.cc (Symbol_table::should_override): Add defined
7271 parameter. Change all callers. Test whether object is NULL
7272 before calling a method on it.
7273 (Symbol_table::report_resolve_problem): Add defined parameter.
7275 (Symbol_table::should_override_with_special): Likewise.
7276 * symtab.cc (Symbol_table::define_in_output_data): Add defined
7277 parameter. Change all callers.
7278 (Symbol_table::do_define_in_output_data): Likewise.
7279 (Symbol_table::define_in_output_segment): Likewise.
7280 (Symbol_table::do_define_in_output_segment): Likewise.
7281 (Symbol_table::define_as_constant): Likewise.
7282 (Symbol_table::do_define_as_constant): Likewise.
7283 * script.h (class Symbol_assignment): Add is_defsym parameter to
7284 constructor; change all callers.
7285 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
7286 parameter. Change all callers. Add is_defsym_ field.
7287 (class Parser_closure): Add parsing_defsym parameter to
7288 constructor; change all callers. Add parsing_defsym accessor
7289 function. Add parsing_defsym_ field.
7291 2009-12-28 Ian Lance Taylor <iant@google.com>
7293 * gold.cc (queue_middle_tasks): Fix formatting.
7294 * object.cc (Relobj::is_section_name_included): Likewise.
7296 2009-12-23 Ian Lance Taylor <iant@google.com>
7298 * i386.cc (Target_i386::do_calls_non_split): Recognize
7299 -fsplit-stack prologue for a function with a static chain.
7300 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
7301 -fsplit-stack prologue when using %r11.
7303 2009-12-21 Sriraman Tallam <tmsriram@google.com>
7305 * options.cc (General_options::parse_version): Make -v continue and do
7306 the link like GNU ld does.
7308 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
7310 * Makefile.am (CCFILES): Add timer.cc.
7311 (HFILES): Add timer.h.
7312 * configure.ac: Check for sysconf and times.
7313 * main.cc: include timer.h.
7314 (main): Use Timer instead of get_run_time.
7317 * workqueue.cc: include timer.h.
7318 (Workqueue::find_and_run_task):
7319 Report user, sys and wall time.
7320 * Makefile.in: Regenerate.
7321 * config.in: Regenerate.
7322 * configure: Regenerate.
7324 2009-12-16 Doug Kwan <dougkwan@google.com>
7326 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
7328 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
7329 relaxed input sections.
7330 * output.cc (Output_section::find_relaxed_input_section): Change
7331 return type to Output_relaxed_input_section pointer. Adjust code
7332 for new type of relaxed_input_section_map_.
7333 * output.h (Output_section::find_relaxed_input_section): Change
7334 return type to Output_relaxed_input_section pointer.
7335 (Output_section::Output_relaxed_input_section_by_input_section_map):
7337 (Output_section::relaxed_input_section_map_): Change type to
7338 Output_section::Output_relaxed_input_section_by_input_section_map.
7339 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
7342 2009-12-15 Ian Lance Taylor <iant@google.com>
7344 * layout.cc (Layout::create_shstrtab): Only write out after input
7345 sections if we are compressing debug sections.
7347 2009-12-15 Ian Lance Taylor <iant@google.com>
7349 * archive.cc (Archive::add_symbols): Only look up a symbol without
7350 a version if there is, in fact, a version.
7352 2009-12-14 Ian Lance Taylor <iant@google.com>
7354 Revert -Wshadow changes, all changes from:
7355 2009-12-11 Doug Kwan <dougkwan@google.com>
7356 2009-12-11 Nick Clifton <nickc@redhat.com>
7357 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
7359 2009-12-11 Doug Kwan <dougkwan@google.com>
7361 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
7363 * attributes.cc (Object_attribute::size): Ditto.
7364 (Attributes_section_data::size): Ditto.
7365 (Attributes_section_data::Attributes_section_data): Ditto.
7366 (Output_attributes_section_data::do_write): Ditto.
7367 * attributes.h (Object_attribute::set_type): Ditto.
7368 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
7370 2009-12-11 Nick Clifton <nickc@redhat.com>
7372 * archive.cc: Fix shadowed variable warnings.
7374 * compressed_output.cc: Likewise.
7375 * compressed_output.h: Likewise.
7376 * configure: Likewise.
7377 * dwarf_reader.cc: Likewise.
7378 * dynobj.cc: Likewise.
7379 * dynobj.h: Likewise.
7380 * ehframe.cc: Likewise.
7381 * ehframe.h: Likewise.
7382 * errors.cc: Likewise.
7383 * expression.cc: Likewise.
7384 * fileread.cc: Likewise.
7385 * fileread.h: Likewise.
7386 * freebsd.h: Likewise.
7387 * i386.cc: Likewise.
7389 * incremental.h: Likewise.
7390 * layout.cc: Likewise.
7391 * layout.h: Likewise.
7392 * mapfile.cc: Likewise.
7393 * merge.cc: Likewise.
7394 * merge.h: Likewise.
7395 * object.cc: Likewise.
7396 * object.h: Likewise.
7397 * options.h: Likewise.
7398 * output.cc: Likewise.
7399 * output.h: Likewise.
7400 * parameters.cc: Likewise.
7401 * plugin.cc: Likewise.
7402 * powerpc.cc: Likewise.
7403 * reduced_debug_output.cc: Likewise.
7404 * reduced_debug_output.h: Likewise.
7405 * reloc.cc: Likewise.
7406 * reloc.h: Likewise.
7407 * resolve.cc: Likewise.
7408 * script-sections.cc: Likewise.
7409 * script.cc: Likewise.
7410 * script.h: Likewise.
7411 * sparc.cc: Likewise.
7412 * symtab.cc: Likewise.
7413 * symtab.h: Likewise.
7414 * target-select.cc: Likewise.
7415 * target-select.h: Likewise.
7416 * token.h: Likewise.
7417 * workqueue.cc: Likewise.
7418 * workqueue.h: Likewise.
7419 * x86_64.cc: Likewise.
7421 2009-12-10 Doug Kwan <dougkwan@google.com>
7423 * arm.cc (attributes.h): New include.
7424 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
7425 (Arm_relobj::~Arm_relobj): Delete object pointed by
7426 attributes_section_data_.
7427 (Arm_relobj::attributes_section_data): New method definition.
7428 (Arm_relobj::attributes_section_data_): New data member declaration.
7429 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
7430 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
7431 attributes_section_data_.
7432 (Arm_dynobj::attributes_section_data): New method definition.
7433 (Arm_dynobj::attributes_section_data_): New data member declaration.
7434 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
7435 initialization value of may_use_blx_ to false.
7436 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
7437 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
7438 object attributes to compute results instead of hard-coding.
7439 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
7440 Target_arm::get_secondary_compatible_arch,
7441 Target_arm::set_secondary_compatible_arch
7442 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7443 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
7444 New method declarations.
7445 (Target_arm::get_aeabi_object_attribute): New method definition.
7446 (Target_arm::attributes_section_data_): New data member declaration.
7447 (read_arm_attributes_section): New template definition.
7448 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
7449 (Arm_dynobj::do_read_symbols): Ditto.
7450 (Target_arm::do_finalize_sections): Merge attributes sections from
7451 input. Check for BLX use after attributes section merging.
7452 Fix __exidx_start and __exidx_end visibility. Create an
7453 .ARM.attributes section if necessary.
7454 (Target_arm::get_secondary_compatible_arch,
7455 Target_arm::set_secondary_compatible_arch,
7456 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7457 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
7458 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
7459 New method definitions.
7461 2009-12-09 Ian Lance Taylor <iant@google.com>
7463 * plugin.cc (Plugin::load): Don't cast from void* to a function
7466 2009-12-09 Ian Lance Taylor <iant@google.com>
7468 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
7471 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
7473 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
7474 Replace two_file_shared_1.so with two_file_shared_2.so.
7475 * testsuite/Makefile.in: Regenerated.
7477 2009-12-08 Doug Kwan <dougkwan@google.com>
7479 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
7480 (HFILES): Add attributes.h and int_encoding.h.
7481 * Makefile.in: Regenerate.
7482 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
7483 function definitions to int_encoding.cc
7484 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
7485 prototypes to int_encoding.h
7486 * reduced_debug_output.cc (int_encoding.h): New include.
7487 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
7488 function definitions to int_encoding.cc
7489 (insert_into_vector, read_from_pointer): Move template definitions to
7491 * attributes.cc: New file.
7492 * attributes.h: New file.
7493 * int_encoding.cc: New file.
7494 * int_encoding.h: New file.
7496 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
7499 * incremental-dump.cc (dump_incremental_inputs): New.
7500 (main): Use dump_incremental_inputs.
7502 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
7505 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
7506 checking elfcpp::STT_FUNC.
7507 (Target_i386::Relocate::relocate): Likewise.
7508 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
7510 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
7511 symbols from shared libraries into normal FUNC symbols.
7513 * symtab.h (Symbol): Add is_func and use it.
7515 2009-12-05 Doug Kwan <dougkwan@google.com>
7517 * arm.cc (Target_arm::arm_info): Initialize new fields
7518 attributes_section and attributes_vendor.
7519 * i386.cc (Target_i386::i386_info): Same.
7520 * object.cc (Sized_relobj::do_layout): Skip attribute section.
7521 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7522 fields attributes_section and attributes_vendor.
7523 * sparc.cc (Target_sparc::sparc_info): Same.
7524 * target.h (Target::attributes_section, Target::attributes_vendor,
7525 Target::is_attributes_section, Target::attribute_arg_type,
7526 Target::attributes_order): New method definitions.
7527 (Target::Target_info::attributes_section,
7528 Target::Target_info::attributes_vendor): New fields.
7529 (Target::do_attribute_arg_type, Target::do_attributes_order): New
7530 virtual method definitions.
7531 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7532 attributes_section and attributes_vendor.
7533 * testsuite/testfile.cc (Target_test::test_target_info): Same.
7535 2009-12-05 Doug Kwan <dougkwan@google.com>
7537 * arm.cc: Update comments about interworking and stub generation.
7538 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
7539 considered as non-PIC.
7540 (Arm_relocate_functions::base_abs): Fix formatting.
7541 (Arm_relocate_functions::got_prel): Fix comment. Change interface
7542 of function to use GOT entry address instead of offset.
7543 (Target_arm::Scan::global): Issue an error if a symbol would need a
7544 PLT does not get one because it is untyped. Remove code to create
7545 dynamic symbols for relative branches.
7546 (Target_arm::Relocate::relocate: Use 0 instead of false since function
7547 takes unsigned integer instead of boolean.
7549 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
7551 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7552 (two_file_test_LDADD): Likewise.
7553 (common_test_1_LDADD): Likewise.
7554 (exception_test_LDADD) Likewise.
7555 (weak_test_LDADD): Likewise.
7556 (many_sections_test_LDADD): Likewise.
7557 (initpri1_LDADD): Likewise.
7558 (script_test_1_LDADD): Likewise.
7559 (script_test_2_LDADD): Likewise.
7560 (justsyms_LDADD): Likewise.
7561 (binary_test_LDADD): Likewise.
7562 (large_LDADD): Likewise.
7563 * testsuite/Makefile.in: Regenerated.
7565 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
7567 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7568 (Symbol_table::override_with_special): Likewise.
7569 (Symbol_table::add_from_object): Likewise.
7571 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
7573 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7574 Don't set the data_offset twice.
7576 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
7578 * testsuite/Makefile.in: Regenerate.
7580 2009-12-03 Doug Kwan <dougkwan@google.com>
7582 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
7583 (Target_arm::do_finalize_sections): Add parameter for symbol table
7584 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
7585 * i386.cc (Target_i386::do_finalize_sections): Add an additional
7586 parameter for symbol table pointer.
7587 * layout.cc (Layout::finalize): Call Target::finalize_sections with
7588 an additional parameter for a pointer to symbol table.
7589 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
7590 parameter for a symbol table pointer.
7591 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
7592 * target.h (Target::finalize_sections, Target::do_finalize_sections):
7594 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
7595 parameter for a symbol table pointer.
7597 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
7599 * incremental.cc (Incremental_inputs_header)
7600 (Incremental_inputs_header_write, Incremental_inputs_entry)
7601 (Incremental_inputs_entry_write): Move ...
7602 * incremental.h (Incremental_inputs_header)
7603 (Incremental_inputs_header_write, Incremental_inputs_entry)
7604 (Incremental_inputs_entry_write): here.
7606 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7608 * incremental.cc (make_sized_incremental_binary): Set the target.
7609 Error if it is incompatible.
7610 * output.h (Output_file): Add filename method.
7612 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7614 * incremental.cc (Incremental_inputs_entry): Remove unused argument
7615 from the get_* methods.
7617 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7619 * incremental-dump.cc (main): Check that the offeset of a script is 0.
7620 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7621 Write 0 for the data_offset of scripts.
7623 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7625 * testsuite/Makefile.am: Add the incremental_test.sh test.
7626 * testsuite/incremental_test.sh: New.
7627 * testsuite/incremental_test_1.c: New.
7628 * testsuite/incremental_test_2.c: New.
7630 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
7632 * incremental-dump.cc (main): Fix typos.
7634 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
7637 * incremental-dump.cc (main): Use llu to print 64 bit values.
7639 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
7640 H.J. Lu <hongjiu.lu@intel.com>
7642 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
7644 (incremental_dump_LDADD): Likewise.
7645 * Makefile.in: Regenerated.
7647 2009-11-25 Doug Kwan <dougkwan@google.com>
7651 2009-11-25 Doug Kwan <dougkwan@google.com>
7653 * arm.cc (Target_arm::Target_arm): Move method definition
7654 outside of class definition. Add code to handle
7655 --target1-rel, --target1-abs and --target2= options.
7656 (Target_arm::get_reloc_reloc_type): Change method to be
7657 non-static and const.
7658 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
7659 New data member declaration.
7660 (Target_arm::Scan::local, Target_arm::Scan::global,
7661 Target_arm::Relocate::relocate,
7662 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7663 Adjust call to Target_arm::get_real_reloc_type.
7664 (Target_arm::get_real_reloc_type): Use command line options
7665 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7666 * options.h (--target1-rel, --target1-abs, --target2): New
7669 2009-11-25 Doug Kwan <dougkwan@google.com>
7671 * arm.cc (Target_arm::Target_arm): Move method definition outside of
7672 class definition. Add code to handle --target1-rel, --target1-abs
7673 and --target2= options.
7674 (Target_arm::get_reloc_reloc_type): Change method to be non-static
7676 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
7678 (Target_arm::Scan::local, Target_arm::Scan::global,
7679 Target_arm::Relocate::relocate,
7680 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
7681 call to Target_arm::get_real_reloc_type.
7682 (Target_arm::get_real_reloc_type): Use command line options to
7683 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7684 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
7687 2009-11-25 Doug Kwan <dougkwan@google.com>
7689 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
7690 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
7691 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
7693 (Arm_relocate_functions::thm_call): Replace body with a call to
7694 Arm_relocate_functions::thumb_branch_common.
7695 (Arm_relocate_functions::thm_jump24,
7696 Arm_relocate_functions::thm_xpc22): New method definitions.
7697 (Arm_relocate_functions::thumb_branch_common): New method definition.
7698 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
7700 (Target_arm::Relocate::relocate): Adjust call to thm_call.
7701 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
7703 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
7705 * Makefile.am: Build incremental-dump
7706 * Makefile.in: Regenerate.
7707 * incremental-dump.cc: New.
7708 * incremental.cc (Incremental_inputs_header_data,
7709 Incremental_inputs_entry_data): Move to incremental.h
7710 * incremental.h: (Incremental_inputs_header_data,
7711 Incremental_inputs_entry_data): Move from incremental.cc
7713 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
7715 * incremental.cc (Incremental_inputs_header,
7716 Incremental_inputs_header_write, Incremental_inputs_entry,
7717 Incremental_inputs_entry_write): Add a typedef with the data type.
7719 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
7721 * incremental.cc (Incremental_inputs_header,
7722 Incremental_inputs_header_write, Incremental_inputs_entry,
7723 Incremental_inputs_entry_write): Update comment about which
7724 type has the filed descriptions.
7726 2009-11-15 Doug Kwan <dougkwan@google.com>
7728 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
7729 (Arm_relocate_functions::arm_branch_common): Change method defintion
7730 in class definition to a method declaration and update list of formal
7732 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
7733 Arm_relocation_functions::jump24): Adjust call to
7734 Arm_relocate_functions::arm_branch_common. Update list of formal
7736 (Arm_relocate_functions::xpc25): New method definition.
7737 (Arm_relocate_functions::arm_branch_common): Move method defintion
7738 out from class definition. Use stubs for mode-switching and extending
7740 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
7741 specially. Change code to enable use of stubs in ARM branches.
7743 2009-11-10 Doug Kwan <dougkwan@google.com>
7745 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
7746 in method declaration.
7747 (Target_arm::relocate_stub): New method declaration.
7748 (Target_arm::default_target): Change to return a pointer instead of
7750 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
7751 Target_arm::default_target.
7752 (Arm_Relobj::do_relocate_sections): Remove options paramater in
7754 (Target_arm::relocate_section): Adjust view.
7755 (Target_arm::relocate_stub): New method definition.
7757 2009-11-10 Doug Kwan <dougkwan@google.com>
7759 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
7761 * incremental.cc (open_incremental_binary): Initialized local
7762 variables to avoid warnings.
7763 * object.cc (make_elf_object): Ditto.
7764 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
7767 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
7770 * testsuite/plugin_test.c: Include "config.h".
7772 2009-11-09 Doug Kwan <dougkwan@google.com>
7774 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
7775 (arm_symbol_value): Remove.
7776 (Arm_relocate_functions::arm_branch_common,
7777 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
7778 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
7779 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
7780 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
7781 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
7782 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
7783 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
7784 Arm_relocate_functions::thm_mobw_abs_nc,
7785 Arm_relocate_functions::thm_mov_abs,
7786 Arm_relocate_functions::movw_prel_nc,
7787 Arm_relocate_functions::thm_movt_abs,
7788 Arm_relocate_functions::movt_prel,
7789 Arm_relocate_functions::thm_movw_prel_nc,
7790 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
7791 (Target_arm::Relocate::relocate): Only decompose address into two
7792 parts if relocation type uses the thumb-bit and pass the actual
7793 bit instead of a flag indicating that the thumb-bit is used. Adjust
7794 calls to methods in Arm_relocate_functions for this change.
7796 2009-11-08 Ian Lance Taylor <iant@google.com>
7799 * reloc.cc: Instantiate
7800 Sized_relobj::initialize_input_to_output_maps and
7801 Sized_relobj:free_input_to_output_maps.
7803 2009-11-06 Ian Lance Taylor <iant@google.com>
7806 * defstd.cc (in_segment): Set only_if_ref true for "end".
7808 2009-11-06 Doug Kwan <dougkwan@google.com>
7810 * arm.cc (class Reloc_stub): Correct a comment.
7811 (Target_arm::Target_arm): Initialize arm_input_section_map_.
7812 (Target_arm::scan_section_for_stubs): New method declaration.
7813 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
7814 Change methods from private to protected.
7815 (Target_arm::do_may_relax): New method definition.
7816 (Target_arm::do_relax, Target_arm::group_sections,
7817 Target_arm::scan_reloc_for_stub,
7818 Target_arm::scan_reloc_section_for_stubs): New method declarations.
7819 (Target_arm::arm_input_section_map_): New data member declaration.
7820 (Target_arm::scan_reloc_for_stub,
7821 Target_arm::scan_reloc_section_for_stubs,
7822 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
7823 Target_arm::do_relax): New method definitions.
7825 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
7827 * configure.ac: Check for (struct stat)::st_mtim
7828 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
7829 * config.in: Regenerate.
7830 * configure: Regenerate.
7832 2009-11-05 Ian Lance Taylor <iant@google.com>
7835 * output.cc (Output_segment::add_output_section): Add missing
7838 2009-11-04 Ian Lance Taylor <iant@google.com>
7841 * object.h (class Object): Add is_needed and set_is_needed
7842 methods. Add is_needed_ field. Make bool fields into bitfields.
7843 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
7844 defined in a dynamic object and referenced by a regular object,
7845 set is_needed for the dynamic object.
7846 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
7847 if the file is marked with as_needed and it is not needed.
7849 2009-11-04 Ian Lance Taylor <iant@google.com>
7852 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
7853 tags if data is discarded by linker script.
7854 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7855 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7856 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7857 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7859 2009-11-04 Ian Lance Taylor <iant@google.com>
7861 * layout.cc (Layout::get_output_section): Add is_interp and
7862 is_dynamic_linker_section parameters. Change all callers.
7863 (Layout::choose_output_section): Likewise.
7864 (Layout::make_output_section): Likewise.
7865 (Layout::add_output_section_data): Add is_dynamic_linker_section
7866 parameter. Change all callers.
7867 * layout.h (class Layout): Update declarations.
7868 * output.h (class Output_section): Add is_interp, set_is_interp,
7869 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
7870 Add is_interp_, is_dynamic_linker_section_ fields. Change
7871 generate_code_fills_at_write_ to a bitfield.
7872 * output.cc (Output_section::Output_sections): Initialize new
7874 (Output_segment::add_output_section): Add do_sort parameter.
7877 2009-11-03 Ian Lance Taylor <iant@google.com>
7880 * options.h (class General_options): Add --warn-common.
7881 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
7882 merging two common symbols.
7883 (Symbol_table::should_override): Handle --warn-common when merging
7884 a common symbol with a defined symbol. Use report_resolve_problem
7885 for multiple definitions.
7886 (Symbol_table::report_resolve_problem): New function.
7887 * symtab.h (class Symbol_table): Declare report_resolve_problem.
7889 2009-11-03 Doug Kwan <dougkwan@google.com>
7891 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
7893 (Target_arm::stub_factory): New method definition.
7894 (Target_arm::new_arm_input_section,
7895 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
7896 Target_arm::reloc_uses_thumb_bit): New method declarations.
7897 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
7898 New type definitions.
7899 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
7900 member declarations.
7901 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
7902 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
7903 New method definitions.
7905 2009-11-03 Ian Lance Taylor <iant@google.com>
7907 * options.h (class General_options): Add --warn_constructors.
7909 2009-11-03 Ian Lance Taylor <iant@google.com>
7912 * defstd.cc (in_section): Add entries for __rel_iplt_start,
7913 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
7915 2009-11-03 Ian Lance Taylor <iant@google.com>
7918 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
7919 --msgid-bugs-address.
7920 (install-pdf): New target.
7921 (install-data_yes): Look up one directory to find mkinstalldirs.
7923 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
7925 * po/Make-in (.po.gmo): Don't generate .gmo files in source
7928 2009-10-30 Doug Kwan <dougkwan@google.com>
7930 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
7932 2009-10-30 Doug Kwan <dougkwan@google.com>
7934 * arm.cc (Stub_addend_reader): New struct template definition
7935 and partial specializations.
7936 (Stub_addend_reader::operator()): New method definition for a
7937 partially specialized template.
7939 2009-10-30 Doug Kwan <dougkwan@google.com>
7941 * arm.cc (Arm_relobj::processor_specific_flags): New method
7943 (Arm_relobj::do_read_symbols): New method declaration.
7944 (Arm_relobj::processor_specific_flags_): New data member declaration.
7945 (Arm_dynobj): New class definition.
7946 (Target_arm::do_finalize_sections): Add input_objects parameter.
7947 (Target_arm::do_adjust_elf_header): New method declaration.
7948 (Target_arm::are_eabi_versions_compatible,
7949 (Target_arm::merge_processor_specific_flags): New method declaration.
7950 (Target_arm::do_make_elf_object): New overloaded method definitions
7952 (Arm_relobj::do_read_symbols): New method definition.
7953 (Arm_dynobj::do_read_symbols): Ditto.
7954 (Target_arm::do_finalize_sections): Add input_objects parameters.
7955 Merge processor-specific flags from all input objects.
7956 (Target_arm::are_eabi_versions_compatible,
7957 Target_arm::merge_processor_specific_flags,
7958 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
7959 New method definitions.
7960 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
7961 Input_objects pointer type parameter.
7962 * layout.cc (Layout::finalize): Pass input objects to target's.
7963 finalize_sections function.
7964 * output.cc (Output_file_header::do_sized_write): Set ELF file
7965 header's processor-specific flags.
7966 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
7967 Input_objects pointer type parameter.
7968 * sparc.cc (Target_sparc::do_finalize_sections): Same.
7969 * target.h (Input_objects): New forward class declaration.
7970 (Target::processor_specific_flags,
7971 Target::are_processor_specific_flags_sect): New method definitions.
7972 (Target::finalize_sections): Add input_objects parameter.
7973 (Target::Target): Initialize processor_specific_flags_ and
7974 are_processor_specific_flags_set_.
7975 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
7977 (Target::set_processor_specific_flags): New method definition.
7978 (Target::processor_specific_flags_,
7979 Target::are_processor_specific_flags_set_): New data member
7981 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
7982 Input_objects pointer type parameter.
7984 2009-10-30 Doug Kwan <dougkwan@google.com>
7986 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
7988 2009-10-28 Ian Lance Taylor <iant@google.com>
7990 * object.h (class Relobj): Drop options parameter from
7991 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
7992 do_scan_relocs, do_relocate. Change all callers.
7993 (class Sized_relobj): Drop options parameters from
7994 do_gc_process_relocs, do_scan_relocs, do_relocate,
7995 do_relocate_sections, relocate_sections, emit_relocs_scan,
7996 emit_relocs_scan_reltype. Change all callers.
7997 (struct Relocate_info): Remove options field and all references to
7999 * reloc.h (class Read_relocs): Remove options constructor
8000 parameter and options_ field. Change all callers.
8001 (class Gc_process_relocs, class Scan_relocs): Likewise.
8002 (class Relocate_task): Likewise.
8003 * target-reloc.h (scan_relocs): Remove options parameter. Change
8005 (scan_relocatable_relocs): Likewise.
8006 * target.h (class Sized_target): Remove options parameter from
8007 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
8009 * gc.h (gc_process_relocs): Remove options parameter. Change all
8011 * arm.cc: Update functions to remove options parameters.
8012 * i386.cc: Likewise.
8013 * powerpc.cc: Likewise.
8014 * sparc.cc: Likewise.
8015 * x86_64.cc: Likewise.
8016 * testsuite/testfile.cc: Likewise.
8018 2009-10-28 Doug Kwan <dougkwan@google.com>
8020 * arm.cc (Arm_relobj): New class definition.
8021 (Arm_relobj::scan_sections_for_stubs,
8022 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
8023 New method definitions.
8025 2009-10-28 Cary Coutant <ccoutant@google.com>
8027 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
8028 (Plugin::cleanup_done_): New member.
8029 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
8030 (Plugin_manager::cleanup_done_): Remove.
8031 (Plugin_manager::add_input_file): Edit error message.
8032 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
8033 (Plugin_manager::cleanup): Remove use of cleanup_done_.
8035 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
8037 * fileread.cc: (File_read::View::~View): Use the new
8038 data_ownership_ filed.
8039 (File_read::~File_read): Dispose the new whole_file_view_.
8040 (File_read::open): Mmap the whole file if needed.
8041 (File_read::open): Use whole_file_view_ instead of contents_.
8042 (File_read::find_view): Use whole_file_view_ if applicable.
8043 (File_read::do_read): Use whole_file_view_ instead of contents_.
8044 (File_read::make_view): Use whole_file_view_ instead of contents_,
8045 update File_read::View::View call.
8046 (File_read::find_or_make_view): Update File_read::View::View
8048 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
8050 (File_read::View::Data_ownership): New enum.
8051 (File_read::View::View): Replace bool mapped_ with Data_ownership
8053 (File_read::View::mapped_): Remove (replaced by data_ownership_).
8054 (File_read::View::data_ownership_): New field.
8055 (File_read::contents_): Remove (replaced by whole_file_view_).
8056 (File_read::whole_file_view_): New field.
8057 * options.h (class General_options): Add --keep-files-mapped.
8059 2009-10-27 Cary Coutant <ccoutant@google.com>
8061 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
8062 * testsuite/Makefile.am (plugin_test_5): New test case.
8063 * testsuite/Makefile.in: Regenerate.
8065 2009-10-25 Doug Kwan <dougkwan@google.com>
8067 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
8068 from private to protected to allow access by child class.
8069 (Sized_relobj::do_relocate_sections): New method declaration.
8070 (Sized_relobj::relocate_sections): Virtualize.
8071 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
8072 Sized_relobj::relocate_sections. Instantiate template explicitly
8073 for different target sizes and endianity.
8075 2009-10-24 Doug Kwan <dougkwan@google.com>
8077 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
8078 (Arm_input_section::as_arm_input_section): New method.
8079 (Arm_output_section): New class definition.
8080 (Arm_output_section::create_stub_group,
8081 Arm_output_section::group_sections): New method definitions.
8083 2009-10-22 Doug Kwan <dougkwan@google.com>
8085 * arm.cc (Arm_input_section): New class definition.
8086 (Arm_input_section::init, Arm_input_section:do_write,
8087 Arm_input_section::set_final_data_size,
8088 Arm_input_section::do_reset_address_and_file_offset): New method
8091 2009-10-21 Doug Kwan <dougkwan@google.com>
8093 * arm.cc (Stub_table, Arm_input_section): New forward class
8095 (Stub_table): New class defintion.
8096 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
8097 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
8098 New method definition.
8100 2009-10-21 Doug Kwan <dougkwan@google.com>
8102 * arm.cc: Update copyright comments.
8103 (Target_arm): New forward class template declaration.
8104 (Arm_address): New type.
8105 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
8106 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
8107 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
8109 (Insn_template): Same.
8110 (DEF_STUBS): New macro.
8111 (Stub_type): New enum type.
8112 (Stub_template): New class definition.
8115 (Stub_factory): Same.
8116 (Target_arm::Target_arm): Initialize may_use_blx_ and
8117 should_force_pic_veneer_.
8118 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
8119 Target_arm::should_force_pic_veneer,
8120 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
8121 Target_arm::using_thumb_only, Target_arm:;default_target): New
8123 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
8124 New data member declarations.
8125 (Insn_template::size, Insn_template::alignment): New method defintions.
8126 (Stub_template::Stub_template): New method definition.
8127 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
8128 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
8129 (Stub_factory::Stub_factory): New method definition.
8130 * gold.h (string_hash): New template.
8131 * output.h (Input_section_specifier::hash_value): Use
8133 (Input_section_specifier::string_hash): Remove.
8134 * stringpool.cc (Stringpool_template::string_hash): Use
8137 2009-10-20 Doug Kwan <dougkwan@google.com>
8139 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
8140 symbols of relaxed input sections.
8141 * output.h (Output_section::find_relaxed_input_section): Make
8144 2009-10-16 Doug Kwan <dougkwan@google.com>
8146 * dynobj.cc (Versions::Versions): Initialize version_script_.
8147 Only insert base version symbol definition for a shared object
8148 if version script defines any version versions.
8149 (Versions::define_base_version): New method definition.
8150 (Versions::add_def): Check that base version is not needed.
8151 (Versions::add_need): Define base version lazily.
8152 * dynobj.h (Versions::define_base_version): New method declaration.
8153 (Versions::needs_base_version_): New data member declaration.
8154 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
8155 (check_DATA): Add no_version_test.stdout.
8156 (libno_version_test.so, no_version_test.o no_version_test.stdout):
8158 * testsuite/Makefile.in: Regenerate.
8159 * testsuite/no_version_test.c: New file.
8160 * testsuite/no_version_test.sh: Ditto.
8162 2009-10-16 Doug Kwan <dougkwan@google.com>
8164 * expression.cc (class Segment_start_expression): New class definition.
8165 (Segment_start_expression::value): New method definition.
8166 (script_exp_function_segment_start): Return a new
8167 Segment_start_expression.
8168 * gold/script-c.h (script_saw_segment_start_expression): New function
8170 * script-sections.cc (Script_sections::Script_sections): Initialize
8171 SAW_SEGMENT_START_EXPRESSION_ to false.
8172 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
8173 and -Tbbs options to specify section addresses if given in
8174 command line and no SEGMENT_START expression is seen in a script.
8175 * script-sections.h (Script_sections::saw_segment_start_expression,
8176 Script_sections::set_saw_segment_start_expression): New method
8178 (Script_sections::saw_segment_start_expression_): New data member
8180 * script.cc (script_saw_segment_start_expression): New function.
8181 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
8182 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
8183 script_test_7.sh and script_test_8.sh.
8184 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
8185 script_test_8.stdout.
8186 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
8187 (script_test_6, script_test_6.stdout, script_test_7,
8188 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
8189 * Makefile.in: Regenerate.
8190 * testsuite/script_test_6.sh: New file.
8191 * testsuite/script_test_6.t: Same.
8192 * testsuite/script_test_7.sh: Same.
8193 * testsuite/script_test_7.t: Same.
8194 * testsuite/script_test_8.sh: Same.
8196 2009-10-16 Doug Kwan <dougkwan@google.com>
8198 * output.cc (Output_segment::set_section_list_address): Cast
8199 expressions to unsigned long long type to avoid format warnings.
8201 2009-10-15 Ian Lance Taylor <iant@google.com>
8203 * script.cc (Script_options::add_symbol_assignment): Always add a
8204 dot assignment to script_sections_.
8205 * script-sections.cc (Script_sections::add_dot_assignment):
8206 Initialize if necessary.
8208 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
8209 program headers with no load segment if there is a linker script.
8211 * layout.cc (Layout::set_segment_offsets): Align the file offset
8212 to the segment aligment for -N or -n with no load segment.
8213 * output.cc (Output_segment::add_output_section): Don't crash if
8214 the first section is a TLS section.
8215 (Output_segment::set_section_list_addresses): Print an error
8216 message if the address moves backward in a linker script.
8217 * script-sections.cc
8218 (Output_section_element_input::set_section_addresses): Don't
8219 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
8220 (Orphan_output_section::set_section_addresses): Likewise.
8222 2009-10-15 Doug Kwan <dougkwan@google.com>
8224 * layout.cc (Layout::finish_dynamic_section): Generate tags
8225 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
8226 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
8227 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
8229 2009-10-14 Ian Lance Taylor <iant@google.com>
8231 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
8233 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
8234 data_shdr fields of relinfo.
8235 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
8236 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
8237 R_386_TLS_LDO_32, adjust based on section flags.
8238 (Target_i386::Relocate::fix_up_ldo): Remove.
8240 2009-10-13 Ian Lance Taylor <iant@google.com>
8242 Add support for -pie.
8243 * options.h (class General_options): Add -pie and
8245 (General_options::output_is_position_independent): Test -pie.
8246 (General_options::output_is_executable): Return true if not shared
8247 and not relocatable.
8248 (General_options::output_is_pie): Remove.
8249 * options.cc (General_options::finalize): Reject incompatible uses
8251 * gold.cc (queue_middle_tasks): A -pie link is not static.
8252 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
8253 * symtab.cc (Symbol::final_value_is_known): Return false if
8254 output_is_position_independent.
8255 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
8256 output_is_position_independent.
8257 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
8258 output_is_position_independent.
8259 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
8260 output_is_position_independent.
8261 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
8263 (basic_pie_test.o, basic_pie_test): New targets.
8264 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
8265 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
8266 (two_file_pie_test): New target.
8267 * testsuite/Makefile.in: Rebuild.
8268 * README: Remove note saying that -pie is not supported.
8270 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
8272 * options.h (class General_options): Add -init and -fini.
8273 * layout.cc (Layout::finish_dynamic_section): Emit
8274 given init and fini functions.
8276 2009-10-13 Sriraman Tallam <tmsriram@google.com>
8278 * gc.h (gc_process_relocs): Check if icf is enabled using new
8280 * gold.cc (queue_initial_tasks): Likewise.
8281 (queue_middle_tasks): Likewise.
8282 * object.cc (do_layout): Likewise.
8283 * symtab.cc (is_section_folded): Likewise.
8284 * main.cc (main): Likewise.
8285 * reloc.cc (Read_relocs::run): Likewise.
8286 (Sized_relobj::do_scan_relocs): Likewise.
8287 * icf.cc (is_function_ctor_or_dtor): New function.
8288 (Icf::find_identical_sections): Check if function is ctor or dtor when
8290 * options.h (General_options::icf): Change option to be an enum.
8291 (Icf_status): New enum.
8292 (icf_enabled): New method.
8293 (icf_safe_folding): New method.
8294 (set_icf_status): New method.
8295 (icf_status_): New variable.
8296 * (options.cc) (General_options::finalize): Set icf_status_.
8297 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
8298 icf_test and icf_keep_unique_test to use the --icf enum flag.
8299 * testsuite/icf_safe_test.sh: New file.
8300 * testsuite/icf_safe_test.cc: New file.
8302 2009-10-12 Sriraman Tallam <tmsriram@google.com>
8304 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
8305 includes to gc.h and icf.h.
8306 * arm.cc: Include gc.h.
8307 * gold.cc: Likewise.
8308 * i386.cc: Likewise.
8309 * powerpc.cc: Likewise.
8310 * sparc.cc: Likewise.
8311 * x86_64.cc: Likewise.
8312 * gc.h: Include icf.h.
8314 2009-10-11 Ian Lance Taylor <iant@google.com>
8316 * plugin.cc: Include "gold.h" before other header files.
8318 2009-10-10 Chris Demetriou <cgd@google.com>
8320 * options.h (Input_file_argument::Input_file_type): New enum.
8321 (Input_file_argument::is_lib_): Replace with...
8322 (Input_file_argument::type_): New member.
8323 (Input_file_argument::Input_file_argument): Take Input_file_type
8324 'type' rather than boolean 'is_lib' as second argument.
8325 (Input_file_argument::is_lib): Use type_.
8326 (Input_file_argument::is_searched_file): New function.
8327 (Input_file_argument::may_need_search): Handle is_searched_file.
8328 * options.cc (General_options::parse_library): Support -l:filename.
8329 (General_options::parse_just_symbols): Update for Input_file_argument
8331 (Command_line::process): Likewise.
8332 * archive.cc (Archive::get_file_and_offset): Likewise.
8333 * plugin.cc (Plugin_manager::release_input_file): Likewise.
8334 * script.cc (read_script_file, script_add_file): Likewise.
8335 * fileread.cc (Input_file::Input_file): Likewise.
8336 (Input_file::will_search_for): Handle is_searched_file.
8337 (Input_file::open): Likewise.
8338 * readsyms.cc (Read_symbols::get_name): Likewise.
8339 * testsuite/Makefile.am (searched_file_test): New test.
8340 * testsuite/Makefile.in: Regenerate.
8341 * testsuite/searched_file_test.cc: New file.
8342 * testsuite/searched_file_test_lib.cc: New file.
8344 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8345 Ian Lance Taylor <iant@google.com>
8347 * descriptor.cc: Include <cstdio> and "binary-io.h".
8348 (Descriptors::open): Open the files in binary mode always.
8349 * script.cc (Lex::get_token): Treat \r as whitespace.
8351 2009-10-09 Ian Lance Taylor <iant@google.com>
8353 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
8355 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8356 Ian Lance Taylor <iant@google.com>
8358 * configure.ac: Check for readv function also.
8359 * fileread.cc (readv): Define if not HAVE_READV.
8360 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
8362 * config.in: Regenerate.
8363 * configure: Regenerate.
8365 2009-10-09 Doug Kwan <dougkwan@google.com>
8367 * layout.cc (Layout::make_output_section): Call target hook to make
8368 ordinary output section.
8369 (Layout::finalize): Adjust parameter list of call the
8370 Target::may_relax().
8371 * layout.h (class Layout::section_list): New method.
8372 * merge.h (Output_merge_base::entsize): Change visibility to public.
8373 (Output_merge_base::is_string, Output_merge_base::do_is_string):
8375 (Output_merge_string::do_is_string): New method.
8376 * object.cc (Sized_relobj::do_setup): renamed from
8377 Sized_relobj::set_up.
8378 * object.h (Sized_relobj::adjust_shndx,
8379 Sized_relobj::initializ_input_to_output_maps,
8380 Sized_relobj::free_input_to_output_maps): Change visibilities to
8382 (Sized_relobj::setup): Virtualize.
8383 (Sized_relobj::do_setup): New method declaration.
8384 (Sized_relobj::invalidate_section_offset,
8385 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
8386 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
8387 * options.cc (parse_int): New function.
8388 * options.h (parse_int): New declaration.
8389 (DEFINE_int): New macro.
8390 (stub_group_size): New option.
8391 * output.cc (Output_section::Output_section): Initialize memebers
8392 merge_section_map_, merge_section_by_properties_map_,
8393 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
8394 (Output_section::add_input_section): Handled deferred code-fill
8395 generation and remove an old comment.
8396 (Output_section::add_relaxed_input_section): New method definition.
8397 (Output_section::add_merge_input_section): Use merge section by
8398 properties map to speed to search. Update merge section maps
8400 (Output_section::build_relaxation_map): New method definition.
8401 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8403 (Output_section::relax_input_section): Renamed to
8404 Output_section::convert_input_sections_to_relaxed_sections and change
8405 interface to take a vector of pointers to relaxed sections.
8406 (Output_section::find_merge_section,
8407 Output_section::find_relaxed_input_section): New method definitions.
8408 (Output_section::is_input_address_mapped,
8409 Output_section::output_offset, Output_section::output_address):
8410 Use output section data maps to speed up searching.
8411 (Output_section::find_starting_output_address): Add comments.
8412 (Output_section::do_write,
8413 Output_section::write_to_postprocessing_buffer): Do code-fill
8414 generation as appropriate.
8415 (Output_section::get_input_sections): Invalidate relaxed input section
8417 (Output_section::restore_states): Adjust type of checkpoint .
8418 Invalidate relaxed input section map.
8419 * output.h (Output_merge_base): New class declaration.
8420 (Input_section_specifier): New class defintion.
8421 (class Output_relaxed_input_section) Change base class to
8422 Output_section_data_build.
8423 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
8424 base class initializer.
8425 (Output_section::add_relaxed_input_section): New method declaration.
8426 (Output_section::Input_section): Change visibility to protected.
8427 (Output_section::Input_section::relobj,
8428 Output_section::Input_section::shndx): Handle relaxed input sections.
8429 Output_section::input_sections) Change visibility to protected. Also
8430 define overload to return a non-const pointer.
8431 (Output_section::Merge_section_properties): New class defintion.
8432 (Output_section::Merge_section_by_properties_map,
8433 Output_section::Output_section_data_by_input_section_map,
8434 Output_section::Relaxation_map): New types.
8435 (Output_section::relax_input_section): Rename method to
8436 Output_section::convert_input_sections_to_relaxed_sections and change
8437 interface to take a vector of relaxed section pointers.
8438 (Output_section::find_merge_section,
8439 Output_section::find_relaxed_input_section,
8440 Output_section::build_relaxation_map,
8441 Output_section::convert_input_sections_in_list_to_relaxed_sections):
8442 New method declarations.
8443 (Output_section::merge_section_map_
8444 Output_section::merge_section_by_properties_map_,
8445 Output_section::relaxed_input_section_map_,
8446 Output_section::is_relaxed_input_section_map_valid_,
8447 Output_section::generate_code_fills_at_write_): New data members.
8448 * script-sections.cc
8449 (Output_section_element_input::set_section_addresses): Call
8450 current_data_size and addralign methods of relaxed input sections.
8451 (Orphan_output_section::set_section_addresses): Call current_data_size
8452 and addralign methods of relaxed input sections.
8453 * symtab.cc (Symbol_table::compute_final_value): Extract template
8454 from the body of Symbol_table::sized_finalize_symbol.
8455 (Symbol_table::sized_finalized_symbol): Call
8456 Symbol_table::compute_final_value.
8457 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
8458 (Symbol_table::compute_final_value): New templated method declaration.
8459 * target.cc (Target::do_make_output_section): New method defintion.
8460 * target.h (Target::make_output_section): New method declaration.
8461 (Target::relax): Add more parameters for input objects, symbol table
8462 and layout. Adjust call to do_relax.
8463 (Target::do_make_output_section): New method declaration.
8464 (Target::do_relax): Add parameters for input objects, symbol table
8467 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8469 * pread.c: Include stdio.h.
8471 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8473 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
8476 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8478 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8479 Change read_shndx type to unsigned int.
8480 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8482 (Sized_dwarf_line_info::read_line_mappings): Likewise.
8483 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
8484 Change read_shndx type to unsigned int.
8485 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8487 (Sized_dwarf_line_info::read_line_mappings): Likewise.
8488 * layout.cc (Layout::create_symtab_sections): Cast the result of
8489 local_symcount * symsize to off_t in the gold_assert.
8491 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8493 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
8494 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
8496 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
8497 (Arm_relocate_functions::thm_abs5): New function.
8498 (Arm_relocate_functions::abs12): New function.
8499 (Arm_relocate_functions::abs16): New function.
8500 (Arm_relocate_functions::base_abs): New function.
8501 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
8502 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
8503 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
8505 (Scan::global): Likewise.
8506 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
8507 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
8508 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
8509 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
8512 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8514 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
8515 (Arm_relocate_functions::movt_prel): New function.
8516 (Arm_relocate_functions::thm_movw_prel_nc): New function.
8517 (Arm_relocate_functions::thm_movt_prel): New function.
8518 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8519 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8520 (Scan::global, Relocate::relocate): Likewise.
8521 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8523 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8525 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8526 Incremental_checker.
8527 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8529 (class Incremental_inputs_header): New class.
8530 (Incremental_inputs_header_writer): Edit comment.
8531 (Incremental_inputs_entry): New class.
8532 (Incremental_inputs_entry_writer): Edit comment.
8533 (Sized_incremental_binary::do_find_incremental_inputs_section):
8534 Add *strtab_shndx parameter, fill it.
8535 (Sized_incremental_binary::do_check_inputs): New method.
8536 (Incremental_checker::can_incrementally_link_output_file): Use
8537 Sized_incremental_binary::check_inputs.
8538 (Incremental_inputs::report_command_line): Save command line in
8541 (Incremental_binary::find_incremental_inputs_section): New
8543 (Incremental_binary::do_find_incremental_inputs_section): Add
8544 strtab_shndx parameter.
8545 (Incremental_binary::do_check_inputs): New pure virtual method.
8546 (Sized_incremental_binary::do_check_inputs): Declare.
8547 (Incremental_checker::Incremental_checker): Add incremental_inputs
8548 parameter, use it to initialize incremental_inputs_.
8549 (Incremental_checker::incremental_inputs_): New field.
8550 (Incremental_checker::command_line): New method.
8551 (Incremental_checker::inputs): New method.
8552 (Incremental_checker::command_line_): New field.
8554 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8556 * incremental.cc: Include <cstdarg> and "target-select.h".
8557 (vexplain_no_incremental): New function.
8558 (explain_no_incremental): New function.
8559 (Incremental_binary::error): New method.
8560 (Sized_incremental_binary::do_find_incremental_inputs_section): New
8562 (make_sized_incremental_binary): New function.
8563 (open_incremental_binary): New function.
8564 (can_incrementally_link_file): Add checks if output is ELF and has
8566 * incremental.h: Include "elfcpp_file.h" and "output.h".
8567 (Incremental_binary): New class.
8568 (Sized_incremental_binary): New class.
8569 (open_incremental_binary): Declare.
8570 * object.cc (is_elf_object): Use
8571 elfcpp::Elf_recognizer::is_elf_file.
8572 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
8573 * output.h (Output_file::filesize): New method.
8575 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8577 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
8579 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
8580 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
8582 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
8584 (Arm_relocate_functions::movw_abs_nc): New function.
8585 (Arm_relocate_functions::movt_abs): New function.
8586 (Arm_relocate_functions::thm_movw_abs_nc): New function.
8587 (Arm_relocate_functions::thm_movt_abs): New function.
8588 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
8589 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
8590 (Scan::global): Likewise.
8591 (Relocate::relocate): Likewise.
8592 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8594 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8596 * arm.cc (Arm_relocate_functions::got_prel) New function.
8597 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
8598 (Relocate::relocate): Likewise.
8599 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8601 2009-10-06 Ian Lance Taylor <iant@google.com>
8603 * options.h (class General_options): Define
8604 split_stack_adjust_size parameter.
8605 * object.h (class Object): Add uses_split_stack_ and
8606 has_no_split_stack_ fields. Add uses_split_stack and
8607 has_no_split_stack accessor functions. Declare
8608 handle_split_stack_section.
8609 (class Reloc_symbol_changes): Define.
8610 (class Sized_relobj): Define Function_offsets. Declare
8611 split_stack_adjust, split_stack_adjust_reltype, and
8613 * object.cc (Object::handle_split_stack_section): New function.
8614 (Sized_relobj::do_layout): Call handle_split_stack_section.
8615 * dynobj.cc (Sized_dynobj::do_layout): Call
8616 handle_split_stack_section.
8617 * reloc.cc (Sized_relobj::relocate_sections): Call
8618 split_stack_adjust for executable sections in split_stack
8619 objects. Pass reloc_map to relocate_section.
8620 (Sized_relobj::split_stack_adjust): New function.
8621 (Sized_relobj::split_stack_adjust_reltype): New function.
8622 (Sized_relobj::find_functions): New function.
8623 * target-reloc.h: Include "object.h".
8624 (relocate_section): Add reloc_symbol_changes parameter. Change
8626 * target.h (class Target): Add calls_non_split method. Declare
8627 do_calls_non_split virtual method. Declare match_view and
8629 * target.cc: Include "elfcpp.h".
8630 (Target::do_calls_non_split): New function.
8631 (Target::match_view): New function.
8632 (Target::set_view_to_nop): New function.
8633 * gold.cc (queue_middle_tasks): Give an error if mixing
8634 split-stack and non-split-stack objects with -r.
8635 * i386.cc (Target_i386::relocate_section): Add
8636 reloc_symbol_changes parameter.
8637 (Target_i386::do_calls_non_split): New function.
8638 * x86_64.cc (Target_x86_64::relocate_section): Add
8639 reloc_symbol_changes parameter.
8640 (Target_x86_64::do_calls_non_split): New function.
8641 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
8643 * powerpc.cc (Target_powerpc::relocate_section): Add
8644 reloc_symbol_changes parameter.
8645 * sparc.cc (Target_sparc::relocate_section): Add
8646 reloc_symbol_changes parameter.
8647 * configure.ac: Call AM_CONDITIONAL for the default target.
8648 * configure: Rebuild.
8649 * testsuite/Makefile.am (TEST_AS): New variable.
8650 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
8651 (check_DATA): Add split_i386 and split_x86_64 files.
8652 (SPLIT_DEFSYMS): Define.
8653 (split_i386_[1234n].o): New targets.
8654 (split_i386_[124]): New targets.
8655 (split_i386_[1234r].stdout): New targets.
8656 (split_x86_64_[1234n].o): New targets.
8657 (split_x86_64_[124]): New targets.
8658 (split_x86_64_[1234r].stdout): New targets.
8659 (MOSTLYCLEANFILES): Add new executables.
8660 * testsuite/split_i386.sh: New file.
8661 * testsuite/split_x86_64.sh: New file.
8662 * testsuite/split_i386_1.s: New file.
8663 * testsuite/split_i386_2.s: New file.
8664 * testsuite/split_i386_3.s: New file.
8665 * testsuite/split_i386_4.s: New file.
8666 * testsuite/split_i386_n.s: New file.
8667 * testsuite/split_x86_64_1.s: New file.
8668 * testsuite/split_x86_64_2.s: New file.
8669 * testsuite/split_x86_64_3.s: New file.
8670 * testsuite/split_x86_64_4.s: New file.
8671 * testsuite/split_x86_64_n.s: New file.
8672 * testsuite/testfile.cc (Target_test): Update relocation_section
8674 * testsuite/Makefile.in: Rebuild.
8676 2009-10-06 Ian Lance Taylor <iant@google.com>
8678 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
8679 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
8680 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
8681 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
8682 the address on ldo_addrs_.
8683 (Target_i386::Relocate::fix_up_ldo): New function.
8685 2009-10-06 Rafael Espindola <espindola@google.com>
8687 * plugin.cc (add_input_library): New.
8688 (Plugin::load): Add add_input_library to tv.
8689 (Plugin_manager::add_input_file): Add the is_lib argument.
8690 (add_input_file): Update call to Plugin_manager::add_input_file.
8691 (add_input_library): New.
8692 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
8694 2009-09-30 Doug Kwan <dougkwan@google.com>
8696 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
8697 symbol and call Symbol::may_need_copy_reloc to determine if
8698 a copy reloc is needed.
8699 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
8700 nocopyreloc is given in command line.
8701 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
8702 given in command line.
8703 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
8704 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
8705 of the removed Target_i386::may_need_copy_reloc.
8706 * options.h (copyreloc): New option with default value false.
8707 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8708 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
8709 instead of the removed Target_powerpc::may_need_copy_reloc.
8710 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8711 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
8712 instead of the removed Target_sparc::may_need_copy_reloc.
8713 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
8714 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
8715 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
8716 instead of the removed Target_x86_64::may_need_copy_reloc.
8718 2009-09-30 Ian Lance Taylor <iant@google.com>
8720 * object.h (class Object): Remove target_ field, and target,
8721 sized_target, and set_target methods.
8722 (Object::sized_target): Remove.
8723 (class Sized_relobj): Update declarations. Remove sized_target.
8724 * object.cc (Sized_relobj::setup): Remove target parameter.
8726 (Input_objects::add_object): Don't do anything with the target.
8727 (make_elf_sized_object): Add punconfigured parameter. Change all
8728 callers. Set or test parameter target.
8729 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
8731 * parameters.cc (Parameters::set_target): Change parameter type to
8733 (Parameters::default_target): Remove.
8734 (set_parameters_target): Change parameter type to be non-const.
8735 (parameters_force_valid_target): New function.
8736 (parameters_clear_target): New function.
8737 * parameters.h (class Parameters): Update declarations. Remove
8738 default_target method. Add sized_target and clear_target
8739 methods. Change target_ to be non-const.
8740 (set_parameters_target): Update declaration.
8741 (parameters_force_valid_target): Declare.
8742 (parameters_clear_target): Declare.
8743 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
8744 as NULL if we aren't searching.
8745 (Add_symbols::run): Don't check for compatible target.
8746 * fileread.cc (Input_file::open_binary): Call
8747 parameters_force_valid_target.
8748 * gold.cc (queue_middle_tasks): Likewise.
8749 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
8750 set_target on object.
8751 * dynobj.h (class Sized_dynobj): Update declarations.
8752 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
8753 make_elf_object returns NULL.
8754 (Archive::include_member): Don't check whether object target is
8756 * output.cc (Output_section::add_input_section): Get target from
8758 (Output_section::relax_input_section): Likewise.
8759 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
8761 (Sized_relobj::do_scan_relocs): Likewise.
8762 (Sized_relobj::relocate_sections): Likewise.
8763 * resolve.cc (Symbol_table::resolve): Likewise.
8764 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
8765 parameter. Change all callers.
8766 (Symbol_table::add_from_object): Get target from parameters.
8767 (Symbol_table::add_from_relobj): Don't check object target.
8768 (Symbol_table::add_from_dynobj): Likewise.
8769 (Symbol_table::define_special_symbol): Get target from
8771 * symtab.h (class Symbol_table): Update declaration.
8772 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
8773 parameter. Change all callers. Clear parameter target.
8774 (Binary_test): Test target here.
8775 * testsuite/object_unittest.cc (gold_testsuite): Remove
8776 target_test_pointer parameter. Change all callers.
8777 (Object_test): Test target here.
8779 2009-09-26 Ian Lance Taylor <iant@google.com>
8781 * testsuite/initpri1.c: Don't try to use constructor priorities if
8782 compiling with gcc before 4.3.
8784 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
8786 * testsuite/retain_symbols_file_test.sh (check_present): Change
8787 output file name to retain_symbols_file_test.stdout.
8788 (check_absent): Likewise.
8790 2009-09-18 Craig Silverstein <csilvers@google.com>
8792 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
8793 * options.cc: Include <cerrno> and <fstream>.
8794 (General_options::finalize): Parse -retain-symbols-file tag.
8795 * options.h: New flag.
8796 (General_options): New method should_retain_symbol, new
8797 variable symbols_to_retain.
8798 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
8799 should_retain_symbol map.
8800 * testsuite/Makefile.am (retain_symbols_file_test): New test.
8801 * testsuite/Makefile.in: Regenerate.
8802 * testsuite/retain_symbols_file_test.sh: New file.
8804 2009-09-18 Nick Clifton <nickc@redhat.com>
8806 * po/es.po: Updated Spanish translation.
8808 2009-09-17 Doug Kwan <dougkwan@google.com>
8810 * debug.h (DEBUG_RELAXATION): New constant.
8811 (DEBUG_ALL): Add DEBUG_RELAXATION.
8812 (debug_string_to_enum): Add relaxation debug option.
8814 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
8815 Layout::Relaxation_debug_check::read_sections,
8816 Layout::Relaxation_debug_check::read_sections): New method definitions.
8817 (Layout::Layout): Initialize data members
8818 record_output_section_data_from_scrips_,
8819 script_output_section_data_list_ and relaxation_debug_check_.
8820 (Layout::save_segments, Layout::restore_segments,
8821 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8822 Layout::relaxation_loop_body): New method definitions.
8823 (Layout::finalize): Support relaxation. Move section layout code to
8824 Layout::relaxation_loop_body.
8825 (Layout::set_asection_address_from_script): Move code for orphan
8826 section placement out.
8827 (Layout::place_orphan_sections_in_script): New method definition.
8828 * layout.h (Output_segment_headers, Output_file_header):
8829 New forward class declarations.
8830 (Layout::~Layout): Define.
8831 (Layout::new_output_section_data_from_script): New method definition.
8832 (Layout::place_orphan_sections_in_script): New method declaration.
8833 (Layout::Segment_states): New type declaration.
8834 (Layout::save_segments, Layout::restore_segments,
8835 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8836 Layout::relaxation_loop_body): New method declarations.
8837 (Layout::Output_section_data_list): New type declaration.
8838 (Layout::Relaxation_debug_check): New class definition.
8839 (Layout::record_output_section_data_from_script_,
8840 Layout::script_output_section_data_list_, Layout::segment_states_,
8841 Layout::relaxation_debug_check_): New data members.
8842 * output.cc: (Output_section_headers::do_size): New method definition.
8843 (Output_section_headers::Output_section_headers): Move size
8844 computation to Output_section_headers::do_size.
8845 (Output_segment_headers::do_size): New method definition.
8846 (Output_file_header::Output_file_header): Move size computation to
8847 Output_file_header::do_size and call it.
8848 (Output_file_header::do_size): New method definition.
8849 (Output_data_group::Output_data_group): Adjust call to
8850 Output_section_data.
8851 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
8852 (Output_symtab_xindex::do_write): Add array bound check.
8853 (Output_section::Input_section::print_to_mapfile): Handle
8854 RELAXED_INPUT_SECTION_CODE.
8855 (Output_section::Output_section): Initialize data member checkpoint_.
8856 (Output_section::~Output_section): Delete checkpoint object pointed
8858 (Output_section::add_input_section): Always add an Input_section if
8860 (Output_section::add_merge_input_section): Add assert.
8861 (Output_section::relax_input_section): New method definition.
8862 (Output_section::set_final_data_size): Set load address to zero for
8863 an unallocated section.
8864 (Output_section::do_address_and_file_offset_have_reset_values):
8865 New method definition.
8866 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
8867 Handle relaxed input section.
8868 (Output_section::sort_attached_input_sections): Checkpoint input
8869 section list lazily.
8870 (Output_section::get_input_sections): Change type of input_sections to
8871 list of Simple_input_section pointers. Checkpoint input section list
8872 lazily. Also handle relaxed input sections.
8873 (Output_section::add_input_section_for_script): Take a reference to
8874 a Simple_input_section object instead of Relobj pointer and section
8875 index as parameter. Handle relaxed input sections.
8876 (Output_section::save_states, Output_section::restore_states): New
8878 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
8879 (Output_data::is_data_size_fixed): New method definition.
8880 (Output_data::reset_addresss_and_file_offset): Do not reset data size
8882 (Output_data::address_and_file_offset_have_reset_values): New method
8884 (Output_data::do_address_and_file_offset_have_reset_values): New method
8886 (Output_data::set_data_size): Check that data size is not fixed.
8887 (Output_data::fix_data_size): New method definition.
8888 (Output_data::is_data_size_fixed_): New data member.
8889 (Output_section_headers::set_final_data_size): New method definition.
8890 (Output_section_headers::do_size): New method declaration.
8891 (Output_segment_headers::set_final_data_size): New method definition.
8892 (Output_segment_headers::do_size): New method declaration.
8893 (Output_file_header::set_final_data_size)::New method definition.
8894 (Output_file_header::do_size)::New method declaration.
8895 (Output_section_data::Output_section_data): Add new parameter
8896 is_data_size_fixed and use it to fix data size.
8897 (Output_data_const::Output_data_const): Adjust call to base class
8898 constructor and fix data size.
8899 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
8900 base class constructor and fix data size.
8901 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
8902 base class constructor and fix data size.
8903 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
8904 class constructor and fix data size.
8905 (Output_data_group::set_final_data_size): New method definition.
8906 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
8907 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
8908 class constructor and fix data size.
8909 (Output_relaxed_input_section): New class definition.
8910 (Output_section::Simple_input_section): New class definition.
8911 (Output_section::get_input_sections): Adjust parameter list.
8912 (Output_section::add_input_section_for_script): Same.
8913 (Output_section::save_states, Output_section::restore_states,
8914 Output_section::do_address_and_file_offset_have_reset_values,
8915 (Output_section::Input_section::Input_section): Handle
8916 RELAXED_INPUT_SECTION_CODE. Add new overload for
8917 Output_relaxed_input_section.
8918 (Output_section::Input_section::is_input_section,
8919 Output_section::Input_section::set_output_section): Handle relaxed
8921 (Output_section::Input_section::is_relaxed_input_section,
8922 Output_section::Input_section::output_section_data,
8923 Output_section::Input_section::relaxed_input_section): New method
8925 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
8927 (Output_section::Input_section::u1_): Update comments.
8928 (Output_section::Input_section::u2_): Add new union member poris.
8929 (Output_section::Checkpoint_output_section): New classs definition.
8930 (Output_section::relax_input_section): New method declaration.
8931 (Output_section::checkpoint_): New data member.
8932 (Output_segment): Update comments.
8933 (Output_segment::Output_segment): Un-privatize copy constructor.
8934 (Output_segment::operator=): Un-privatize.
8935 * script-sections.cc (Output_section_element::Input_section_list):
8936 Change element type to Output_section::Simple_input_section.
8937 (Output_section_element_dot_assignment::set_section_addresses):
8938 Register output section data for relaxation clean up.
8939 (Output_data_exression::Output_data_expression): Adjust call to base
8940 constructor to fix data size.
8941 (Output_section_element_data::set_section_addresses): Register
8942 Output_data_expression object for relaxation clean up.
8943 (struct Input_section_info): Replace Relobj pointer and section index
8944 pair with Output_section::Simple_input_section and Convert struct to a
8946 (Input_section_sorter::operator()): Adjust access to
8947 Input_section_info data member to use accessors.
8948 (Output_section_element_input::set_section_addresses): Use layout
8949 parameter. Adjust code to use Output_section::Simple_input_section
8950 and Input_secction_info classes. Register filler for relaxation
8952 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
8953 and section index pair with Output_section::Simple_input_section
8954 class. Adjust code accordingly.
8955 (Phdrs_element::release_segment): New method definition.
8956 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
8958 (Script_sections::release_segments): New method definition.
8959 * gold/script-sections.h (Script_sections::release_segments): New
8961 * gold/target.h (Target::may_relax, Target::relax,
8962 Target::do_may_relax, Target::do_relax): New method definitions.
8964 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8966 * arm.cc (has_signed_unsigned_overflow): New function.
8967 (Arm_relocate_functions::abs8): New function.
8968 (Target_arm::Scan::local): Handle R_ARM_ABS8.
8969 (Target_arm::Scan::global): Likewise.
8970 (Target_arm::relocate::relocate): Likewise.
8971 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8974 2009-09-16 Cary Coutant <ccoutant@google.com>
8976 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
8977 * testsuite/Makefile.in: Regenerate.
8979 2009-09-11 Nick Clifton <nickc@redhat.com>
8981 * po/gold.pot: Updated by the Translation project.
8983 2009-09-08 Cary Coutant <ccoutant@google.com>
8985 * output.cc (Output_file::open): Add execute permission to empty file.
8986 * testsuite/Makefile.am (permission_test): New test.
8987 * testsuite/Makefile.in: Regenerate.
8989 2009-09-02 Ian Lance Taylor <iant@google.com>
8991 * output.cc (Output_file::resize): Call map_no_anonymous rather
8994 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
8996 * gold.cc: Include "incremental.h".
8997 (queue_initial_tasks): Call Incremental_checker methods.
8998 * incremental.cc: Include "output.h".
8999 (Incremental_checker::can_incrementally_link_output_file): New
9001 * incremental.h (Incremental_checker): New class.
9003 * output.cc (Output_file::open_for_modification): New method.
9004 (Output_file::map_anonymous): Changed return type to bool. Record
9006 (Output_file::map_no_anonymous): New method, broken out of map.
9007 (Output_file::map): Use map_no_anonymous and map_anonymous.
9008 * output.h (class Output_file): Update declarations.
9010 2009-08-24 Cary Coutant <ccoutant@google.com>
9012 * options.h (Command_line::Pre_options): New class.
9013 (Command_line::pre_options): New member.
9014 * options.cc (gold::options::ready_to_register): New variable.
9015 (One_option::register_option): Do nothing if not registering options.
9016 Assert if same short option registered twice.
9017 (General_options::General_options): Turn off option registration when
9019 (Command_line::Pre_options::Pre_options): New constructor.
9021 2009-08-24 Cary Coutant <ccoutant@google.com>
9023 * options.h (General_options::no_keep_memory): Remove incorrect
9026 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9028 * Makefile.am (am__skiplex, am__skipyacc): New.
9029 * Makefile.in: Regenerate.
9031 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9033 * Makefile.am (AM_CPPFLAGS): Renamed from ...
9034 (INCLUDES): ... this.
9035 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
9036 (AM_CPPFLAGS): Renamed from ...
9037 (INCLUDE): ... this.
9038 * Makefile.in, testsuite/Makefile.in: Regenerate.
9040 * Makefile.in: Regenerate.
9041 * aclocal.m4: Likewise.
9042 * config.in: Likewise.
9043 * configure: Likewise.
9044 * testsuite/Makefile.in: Likewise.
9046 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9047 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9048 * Makefile.in: Regenerate.
9049 * testsuite/Makefile.in: Regenerate.
9051 2009-08-19 Cary Coutant <ccoutant@google.com>
9053 * resolve.cc (Symbol_table::resolve): Don't complain about defined
9054 symbols in shared libraries overridden by hidden or internal symbols
9055 in the main program.
9057 2009-08-19 Chris Demetriou <cgd@google.com>
9059 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
9060 checking source file names in error messages.
9062 2009-08-18 Doug Kwan <dougkwan@google.com>
9064 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
9065 an elcpp::Ehdr as parameter. Adjust call to set_target.
9066 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
9067 an elfcpp::Ehdr as parameter.
9068 * object.cc (Object::set_target): Remove the version that looks up
9069 a target and sets it.
9070 (Sized_relobj::setup): Take a Target object instead of
9071 an elfcpp::Ehdr as parameter. Adjust call to set_target.
9072 (make_elf_sized_object): Find target and ask target to
9074 * object.h: (Object::set_target): Remove the version that looks up
9075 a target and sets it.
9076 (Sized_relobj::setup): Take a Target object instead of
9077 an elfcpp:Ehdr as parameter.
9078 * target.cc: Include dynobj.h.
9079 (Target::do_make_elf_object_implementation): New.
9080 (Target::do_make_elf_object): New.
9081 * target.h (Target::make_elf_object): New template declaration.
9082 (Target::do_make_elf_object): New method declarations.
9083 (Target::do_make_elf_object_implementation): New template declaration.
9085 2009-08-14 Ian Lance Taylor <iant@google.com>
9087 * gold.h (FUNCTION_NAME): Define.
9088 (gold_unreachable): Use FUNCTION_NAME.
9090 2009-08-12 Sriraman Tallam <tmsriram@google.com>
9092 * icf.cc (Icf::find_identical_sections): Issue a warning when a
9093 symbol in the --keep-unique list is not found.
9095 2009-08-12 Sriraman Tallam <tmsriram@google.com>
9097 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
9098 been maked as --keep-unique.
9099 (Icf::unfold_section): New function.
9100 * icf.h (Icf::unfold_section): New function.
9101 * options.h (General_options::keep_unique): New option.
9102 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
9103 * testsuite/Makefile.in: Regenerate.
9104 * testsuite/icf_keep_unique_test.sh: New file.
9105 * testsuite/icf_keep_unique_test.cc: New file.
9107 2009-08-12 Cary Coutant <ccoutant@google.com>
9110 * resolve.cc (Symbol_table::resolve): Check for references from
9111 dynamic objects to hidden and internal symbols.
9112 * testsuite/Makefile.am (hidden_test.sh): New test.
9113 * testsuite/Makefile.in: Regenerate.
9114 * testsuite/hidden_test.sh: New script.
9115 * testsuite/hidden_test_1.c: New test source.
9116 * testsuite/hidden_test_main.c: New test source.
9118 2009-08-11 Doug Kwan <dougkwan@google.com>
9120 * arm.cc: Update comments.
9121 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
9122 segment to locate the .ARM.exidx section if present.
9124 2009-08-09 Doug Kwan <dougkwan@google.com>
9126 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
9129 2009-08-07 Sriraman Tallam <tmsriram@google.com>
9130 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
9133 2009-08-06 Sriraman Tallam <tmsriram@google.com>
9135 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
9136 valid tls_segment only for non-debug-section relocations.
9137 * testsuite/Makefile.am: Add gc_tls_test.
9138 * testsuite/Makefile.in: Regenerate.
9139 * testsuite/gc_tls_test.cc: New file.
9140 * testsuite/gc_tls_test.sh: New file.
9142 2009-08-05 Sriraman Tallam <tmsriram@google.com>
9146 * Makefile.am (CCFILES): Add icf.cc.
9148 * Makefile.in: Regenerate.
9149 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
9150 * gc.h (gc_process_relocs): Populate lists used by icf to contain
9151 section, symbol and addend information for the relocs.
9152 * gold.cc (queue_middle_tasks): Call identical code folding.
9153 * gold.h: Add defines for multimap.
9154 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
9155 to the call of finalize_local_symbols.
9156 * main.cc (main): Create object of class Icf.
9157 * object.cc (Sized_relobj::do_layout): Allow this function to be
9158 called twice during icf.
9159 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
9160 to sections marked as identical by icf.
9161 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
9163 (Sized_relobj::do_section_entsize): New function.
9164 * object.h (Object::section_entsize): New function.
9165 (Object::do_section_entsize): New pure virtual function.
9166 (Relobj::finalize_local_symbols): Add new parameter.
9167 (Relobj::do_section_entsize): New function.
9168 * options.h (General_options::icf): New option.
9169 (General_options::icf_iterations): New option.
9170 (General_options::print_icf_sections): New option.
9171 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
9172 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
9173 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
9175 * symtab.cc (Symbol_table::is_section_folded): New function.
9176 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
9177 to sections marked as identical by icf.
9178 * symtab.h (Symbol_table::set_icf): New function.
9179 (Symbol_table::icf): New function.
9180 (Symbol_table::is_section_folded): New function.
9181 (Symbol_table::icf_): New data member.
9182 * target-reloc.h (relocate_section): Ignore sections folded by icf.
9183 * testsuite/Makefile.am: Add commands to build icf_test.
9184 * testsuite/Makefile.in: Regenerate.
9185 * testsuite/icf_test.sh: New file.
9186 * testsuite/icf_test.cc: New file.
9188 2009-07-24 Chris Demetriou <cgd@google.com>
9190 * layout.cc (is_compressible_debug_section): Fix incorrect
9191 comment about compressed section names.
9193 2009-07-20 Ian Lance Taylor <ian@airs.com>
9196 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
9198 2009-07-16 Ian Lance Taylor <iant@google.com>
9201 * layout.h: #include <map>.
9202 (class Kept_section): Change from struct to class. Add accessors
9203 and setters. Add section size to Comdat_group mapping. Change
9204 Comdat_group to std::map. Add is_comdat_ field. Add
9205 linkonce_size field in union.
9206 (class Layout): Update declaration of find_or_add_kept_section.
9207 Don't declare find_kept_object.
9208 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
9209 parameter. Add object, shndx, is_comdat, and is_group_name
9210 parameters. Change all callers. Adjust for new Kept_section.
9211 (Layout::find_kept_object): Remove.
9212 * object.cc (Sized_relobj::include_section_group): Update use of
9213 Kept_section. Rename secnum to shndx. Only record
9214 Kept_comdat_section if sections are the same size.
9215 (Sized_relobj::include_linkonce_section): Update use of
9216 Kept_section. Only record Kept_comdat_section if sections are the
9217 same size. Set size of linkonce section.
9218 (Sized_relobj::map_to_kept_section): Update call to
9219 get_kept_comdat_section.
9220 * object.h (class Sized_relobj): Rename fields in
9221 Kept_comdat_section to drop trailing underscores; change object
9222 field to Relobj*. Change Kept_comdat_section_table to store
9223 struct rather than pointer.
9224 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
9225 Add kept_object and kept_shndx parameters. Change all callers.
9226 (Sized_relobj::get_kept_comdat_section): Change return type to
9227 bool. Add kept_object and kept_shndx parameters. Change all
9229 * plugin.cc (Pluginobj::include_comdat_group): Update call to
9230 Layout::find_or_add_kept_section.
9232 2009-07-09 Ian Lance Taylor <iant@google.com>
9234 * merge.cc (Object_merge_map::initialize_input_to_output_map):
9235 Reserve space in the hash table.
9237 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
9239 * fileread.cc (File_read::get_mtime): New method.
9240 * fileread.h (Timespec): New structure.
9241 (File_read::get_mtime): New method.
9242 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
9243 Renamed from timestamp_nsec.
9244 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
9246 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
9248 (Incremental_inputs::report_archive): Save mtime; style fix.
9249 (Incremental_inputs::report_obejct): Save mtime; style fix.
9250 (Incremental_inputs::report_script): Save mtime; style fix.
9251 (Incremental_inputs::finalize_inputs): Style fix.
9252 (Incremental_inputs::finalize): Style fix.
9253 (Incremental_inputs::create_input_section_data): Store inputs
9255 * incremental.h (Incremental_inputs::report_script): Add mtime
9257 (Incremental_inputs::Input_info::Input_info): Intialize only one
9259 (Incremental_inputs::Input_info::archive): Move to nameless
9261 (Incremental_inputs::Input_info::obejct): Move to nameless union.
9262 (Incremental_inputs::Input_info::script): Move to nameless union.
9263 (Incremental_inputs::mtime): New field.
9264 * script.cc (read_input_script): Pass file mtime to
9266 * script.h (Script_info::inputs): Style fix.
9268 2009-07-01 Ian Lance Taylor <ian@airs.com>
9270 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
9273 2009-06-24 Ian Lance Taylor <iant@google.com>
9276 * layout.cc (Layout::choose_output_section): If we find an
9277 existing section, update the flags.
9278 (Layout::create_notes): New function, broken out of
9280 (Layout::finalize): Don't create note sections.
9281 (Layout::create_note): Don't crash if linker script discards
9283 (Layout::create_gold_note): Likewise.
9284 (Layout::create_build_id): Likewise. Don't set
9285 after_input_sections on the section.
9286 (Layout::create_executable_stack_info): Remove target parameter.
9288 * layout.h (class Layout): Declare create_notes. Update
9289 declaration of create_executable_stack_info.
9290 * gold.cc (queue_middle_tasks): Call create_notes.
9291 * output.cc (Output_section::update_flags_for_input_section): Move
9292 here from output.h. If SHF_ALLOC flag is newly set, mark address
9294 * output.h (Output_data::mark_address_invalid): New function.
9295 (class Output_section): Only declare, not define,
9296 update_flags_for_input_section. Remove set_flags.
9298 2009-06-24 Ian Lance Taylor <iant@google.com>
9300 * script-sections.cc (Output_section_definition::
9301 set_section_addresses): Rename shadowing local load_address to
9304 2009-06-24 Ian Lance Taylor <iant@google.com>
9307 * reloc.cc (relocate_sections): Skip empty relocation sections.
9309 2009-06-23 Ian Lance Taylor <iant@google.com>
9312 * layout.cc (Layout::create_note): Use choose_output_section
9313 rather than make_output_section.
9315 2009-06-23 Ian Lance Taylor <iant@google.com>
9318 * options.cc (General_options::parse_V): Set printed_version_.
9319 (General_options::General_options): Initialize printed_version_.
9320 * options.h (class General_options): Add printed_version_ field.
9321 * gold.cc (queue_initial_tasks): If there are no input files,
9322 don't give a fatal error if we printed the version information.
9323 (queue_middle_tasks): If using -r with a shared object, give a
9324 fatal error rather than an ordinary error.
9326 2009-06-23 Ian Lance Taylor <iant@google.com>
9329 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
9330 (Layout::make_output_section): Set have_stabstr_section_ if we see
9331 a .stab*str section.
9332 (Layout::finalize): Call link_stabs_sections.
9333 (Layout::link_stabs_sections): New file.
9334 * layout.h (class Layout): Add have_stabstr_section_ field.
9335 Declare link_stabs_sections.
9337 2009-06-23 Doug Kwan <dougkwan@google.com>
9339 * Makefile.am (libgold_a_LIBADD): New.
9340 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
9341 * Makefile.in: Regenerate.
9342 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
9343 * configure: Regenerate.
9344 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
9345 * fileread.cc: Include sys/state.h
9346 * gold.h: Declare memmem and strndup if found missing.
9347 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
9349 2009-06-23 Ian Lance Taylor <iant@google.com>
9351 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
9352 * configure: Rebuild.
9354 2009-06-23 Ian Lance Taylor <iant@google.com>
9357 * object.cc (Object::section_contents): Don't try to get a view if
9358 the section has length zero.
9359 (Object::handle_gnu_warning_section): If the section is empty, use
9360 the name of the section as the warning.
9362 2009-06-23 Ian Lance Taylor <iant@google.com>
9365 * stringpool.h (class Stringpool_template): Add optimize_ field.
9366 (Stringpool_template::set_optimize): New function.
9367 * stringpool.cc (Stringpool_template::Stringpool_template):
9368 Initialize optimize_ field.
9369 (Stringpool_template::set_string_offsets): Test local optimize
9370 fild rather than parameter.
9371 * layout.cc (Layout::Layout): Call set_optimize on the section
9374 2009-06-22 Ian Lance Taylor <iant@google.com>
9377 * yyscript.y: Parse TARGET.
9378 * script.cc (script_set_target): New function.
9379 * script-c.h (script_set_target): Declare.
9380 * options.cc (General_options::string_to_object_format): Rename
9381 from string_to_object_format in anonymous namespace. Change
9383 * options.h (class General_options): Declare
9384 string_to_object_format.
9386 2009-06-22 Ian Lance Taylor <iant@google.com>
9388 * script-sections.cc (Script_sections::create_segments): Don't put
9389 program headers in a PT_LOAD segment if -n or -N.
9391 2009-06-22 Ian Lance Taylor <iant@google.com>
9394 * options.h (class General_options): Add -z lazy and -z now. Sort
9395 -z options into alphabetical order.
9396 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
9398 2009-06-21 Ian Lance Taylor <iant@google.com>
9400 * layout.cc (Layout::make_output_section): Call
9401 Target::new_output_section.
9402 (Layout::attach_allocated_section_to_segment): Put large section
9403 sections in a separate load segment with the large segment flag
9405 (Layout::segment_precedes): Sort large data segments after other
9407 (align_file_offset): New static function.
9408 (Layout::set_segment_offsets): Use align_file_offset.
9409 * output.h (class Output_section): Add is_small_section_ and
9410 is_large_section_ fields.
9411 (Output_section::is_small_section): New function.
9412 (Output_section::set_is_small_section): New function.
9413 (Output_section::is_large_section): New function.
9414 (Output_section::set_is_large_section): New function.
9415 (Output_section::is_large_data_section): New function.
9416 (class Output_segment): Add is_large_data_segment_ field.
9417 (Output_segment::is_large_data_segment): New function.
9418 (Output_segment::set_is_large_data_segment): New function.
9419 * output.cc (Output_section::Output_section): Initialize new
9421 (Output_segment::Output_segment): Likewise.
9422 (Output_segment::add_output_section): Add assertion that large
9423 data sections always go in large data segments. Force small data
9424 sections to the end of the list of data sections. Force small BSS
9425 sections to the start of the list of BSS sections. For large BSS
9426 sections to the end of the list of BSS sections.
9427 * symtab.h (class Symbol): Declare is_common_shndx.
9428 (Symbol::is_defined): Check Symbol::is_common_shndx.
9429 (Symbol::is_common): Likewise.
9430 (class Symbol_table): Define enum Commons_section_type. Update
9431 declarations. Add small_commons_ and large_commons_ fields.
9432 * symtab.cc (Symbol::is_common_shndx): New function.
9433 (Symbol_table::Symbol_table): Initialize new fields.
9434 (Symbol_table::add_from_object): Put small and large common
9435 symbols in the right list.
9436 (Symbol_table::sized_finalized_symbol): Check
9437 Symbol::is_common_shndx.
9438 (Symbol_table::sized_write_globals): Likewise.
9439 * common.cc (Symbol_table::do_allocate_commons): Allocate new
9440 common symbol lists. Don't call do_allocate_commons_list if the
9442 (Symbol_table::do_allocate_commons_list): Remove is_tls
9443 parameter. Add comons_section_type parameter. Change all
9444 callers. Handle small and large common symbols.
9445 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
9446 Symbol::is_common_shndx.
9447 * resolve.cc (symbol_to_bits): Likewise.
9448 * target.h (Target::small_common_shndx): New function.
9449 (Target::small_common_section_flags): New function.
9450 (Target::large_common_shndx): New function.
9451 (Target::large_common_section_flags): New function.
9452 (Target::new_output_section): New function.
9453 (Target::Target_info): Add small_common_shndx, large_common_shndx,
9454 small_common_section_flags, and large_common_section_flags
9456 (Target::do_new_output_section): New virtual function.
9457 * arm.cc (Target_arm::arm_info): Initialize new fields.
9458 * i386.cc (Target_i386::i386_info): Likewise.
9459 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
9461 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
9462 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9463 (Target_x86_64::do_new_output_section): New function.
9464 * configure.ac: Define conditional MCMODEL_MEDIUM.
9465 * testsuite/Makefile.am (check_PROGRAMS): Add large.
9466 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
9467 (large_LDFLAGS): Define.
9468 * testsuite/large.c: New file.
9469 * testsuite/testfile.cc (Target_test::test_target_info):
9470 Initialize new fields.
9471 * configure, testsuite/Makefile.in: Rebuild.
9473 2009-06-05 Doug Kwan <dougkwan@google.com>
9475 * Makefile.am (CCFILES): Add target.cc.
9476 * Makefile.in: Regenerate.
9477 * i386.cc (class Target_i386): Define new virtual method to
9478 override do_is_local_label_name in parent.
9479 * object.cc (Sized_relobj::do_count_local_symbols): Discard
9480 local symbols if --discard-locals or -X is given.
9481 * options.h (class General_options): Declare new options
9482 '--discard-locals' and '-X' for discarding locals.
9483 * target.h (class Target): Define new methods is_local_label_name.
9484 Declare new virtual method do_is_local_label_name.
9485 * target.cc: New file.
9486 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
9487 (check_SCRIPTS): Add discard_locals_test.sh.
9488 (check_DATA): Add discard_local_tests.syms.
9489 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
9490 (discard_local_tests.syms, discard_locals_test.o): New make rules.
9491 * testsuite/Makefile.in: Regenerate.
9492 * testsuite/discard_locals_test.c: New file.
9493 * testsuite/discard_locals_test.sh: Same.
9495 2009-06-05 Doug Kwan <dougkwan@google.com>
9497 * object.cc (Sized_relobj::Sized_relobj): Initialize
9498 discarded_eh_frame_shndx_ to -1U.
9499 (Sized_relobj::do_layout): Record index of a discard .eh_frame
9501 (Sized_relobj::do_count_local_symbols): Skip local symbols in
9502 a discarded .eh_frame section.
9503 (Sized_relobj::do_finalize_local_symbols): Ditto.
9504 * object.h (class Sized_relobj): Declare new member
9505 discarded_eh_frame_shndx_.
9506 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
9507 (local_labels_test.o, local_labels_test): New rules.
9508 * testsuite/Makefile.in: Regenerate.
9510 2009-06-04 Doug Kwan <dougkwan@google.com>
9512 * layout.cc (Layout::section_name_mapping): Add mapping for
9513 special ARM sections.
9515 2009-06-03 Doug Kwan <dougkwan@google.com>
9517 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
9518 (utils::has_overflow): Same.
9520 2009-06-03 Ian Lance Taylor <iant@google.com>
9522 * layout.cc (Layout::section_name_mapping): New array, replacing
9523 Layout::linkonce_mapping.
9524 (Layout::section_name_mapping_count): New variable, replacing
9525 Layout::linkonce_mapping_count.
9526 (Layout::linkonce_output_name): Remove.
9527 (Layout::output_section_name): Rewrite.
9528 * layout.h (class Layout): Rename Linkonce_mapping to
9529 Section_name_mapping, linkonce_mapping to section_name_mapping,
9530 linkonce_mapping_count to section_name_mapping_count. Don't
9531 declare linkonce_output_name.
9533 2009-06-03 Doug Kwan <dougkwan@google.com>
9535 * gold/arm.cc (namespace utils): New.
9536 (Target_arm::reloc_is_non_pic): Define new method.
9537 (class Arm_relocate_functions): New.
9538 (Target_arm::Relocate::relocate): Handle relocation types used by
9541 2009-06-03 Ian Lance Taylor <iant@google.com>
9543 * arm.cc (Target_arm::scan::global): Use || instead of |.
9545 2009-06-02 Doug Kwan <dougkwan@google.com>
9547 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
9548 issued_non_pic_error_.
9549 (class Target_arm::Scan): Declare new method check_non_pic.
9550 Define new method symbol_needs_plt_entry.
9551 Declare new data member issued_non_pic_error_.
9552 (class Target_arm::Relocate): Declare new method
9553 should_apply_static_reloc.
9554 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9555 (Target_arm::Scan::check_non_pic): Define new method.
9556 (Target_arm::Scan::local): Handle a small subset of reloc types used
9558 (Target_arm::Scan::local): Same.
9559 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9561 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
9563 * incremental.cc (Incremental_inputs::report_command_line): Filter
9564 out --incremental-* options.
9566 2009-05-29 Doug Kwan <dougkwan@google.com>
9568 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9570 (class Target_arm): Update comment.
9571 (Target_arm::Target_arm): Initialize new data members GOT_,
9572 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
9573 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
9574 and Target_arm::rel_dyn_section.
9575 Declare new_enum Target_arm::Got_type.
9576 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
9578 Update commments for member do_dynsym_value.
9579 (Target_arm::got_size, Target_arm::plt_section,
9580 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
9581 new methods inside class defintion.
9582 (Target_arm::got_section): Define new method.
9583 (Target_arm::rel_dyn_section): Same.
9584 (Output_data_plt_arm): New template class.
9585 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
9586 (Output_data_plt_arm:do_adjust_output_section): Define new method.
9587 (Output_data_plt_arm::add_entry): Same.
9588 (Output_data_plt_arm::first_plt_entry): Define new
9589 static data member for PLT instruction template.
9590 (Output_data_plt_arm::plt_entry): Same.
9591 (Output_data_plt_arm::do_write): Define new method.
9592 (Target_arm::make_plt_entry): Same.
9593 (Target_arm::do_finalize_sections): Same.
9594 (Target_arm::do_dynsym_value): Same.
9596 2009-05-28 Doug Kwan <dougkwan@google.com>
9598 * Makefile.am (TARGETSOURCES): Add arm.cc.
9599 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
9600 * Makefile.in: Regenerate.
9602 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
9604 2009-05-26 Doug Kwan <dougkwan@google.com>
9606 * options.cc (General_options::parse_exclude_libs). Fix a comment.
9607 (General_options::check_excluded_libs): Strip off directories in
9608 archive name before matching like GNU ld does.
9609 * testsuite/Makefile.am (MOSTLYCLEANFILES,
9610 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
9611 (exclude_libs_test_LDFLAGS): Add linker option
9612 -Wl,--exclude-libs,libexclude_libs_test_3
9613 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
9614 an explicit archive without using -l.
9615 (alt/libexclude_libs_test_3.a): New make rule.
9616 * testsuite/Makefile.in: Regenerate.
9617 * testsuite/exclude_libs_test.c : Declare lib3_default().
9619 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
9620 * exclude_libs_test_3.c: New file.
9622 2009-05-26 Nick Clifton <nickc@redhat.com>
9624 * po/id.po: New Indonesian translation.
9625 * po/gold.pot: Updated template file.
9627 2009-05-22 Sriraman Tallam <tmsriram@google.com>
9629 * testsuite/Makefile.am: Add -ffunction-sections to compile
9630 gc_comdat_test files. Add -Wl,--gc-sections to build
9632 * testsuite/Makefile.in: Regenerate.
9633 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
9635 2009-05-21 Sriraman Tallam <tmsriram@google.com>
9637 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
9638 kept comdat section was garbage collected.
9639 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
9640 * testsuite/Makefile.in: Regenerate.
9641 * testsuite/gc_comdat_test.sh: New file.
9642 * testsuite/gc_comdat_test_1.cc: New file.
9643 * testsuite/gc_comdat_test_2.cc: New file.
9645 2009-05-19 Doug Kwan <dougkwan@google.com>
9647 * archive.cc (Archive::Archive): Move constructor from archive.h
9648 to here. Initialize no_export_.
9649 (Archive::get_elf_object_for_member): Set no_export flag of object.
9650 * archive.h (Archive::Archive): Move constructor body to
9652 (Archive::no_export): New method.
9653 (Archive::no_export_): New field.
9654 * object.h (Object::Object): Initialize no_export_ to false.
9655 (Object::no_export, Object::set_no_export): New methods.
9656 (Object::no_export_): New field.
9657 * options.cc (General_options::parse_exclude_libs): New method.
9658 (General_options::check_excluded_libs) Same.
9659 * options.h (exclude_libs): New option.
9660 (General_options::check_excluded_libs): New method declaration.
9661 (General_options::excluded_libs_): New field.
9662 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
9663 default or protected visibility if an object has no-export flag set.
9664 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
9665 (check_SCRIPTS): Add exclude_libs_test.sh.
9666 (check_DATA): Add exclude_libs_test.syms.
9667 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
9668 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
9669 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
9670 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
9671 (exclude_libs_test.syms, libexclude_libs_test_1.a,
9672 libexclude_libs_test_2.a): New rules.
9673 * testsuite/Makefile.in: Regenerate.
9674 * testsuite/exclude_libs_test.c: New file.
9675 * testsuite/exclude_libs_test.sh: Ditto.
9676 * testsuite/exclude_libs_test_1.c: Ditto.
9677 * testsuite/exclude_libs_test_2.c: Ditto.
9679 2009-05-15 Ian Lance Taylor <iant@google.com>
9681 * configure.ac: Check for declarations for cases where libiberty.h
9682 checks HAVE_DECL_xxx.
9683 * configure, config.in: Rebuild.
9685 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
9687 * gold.h (Incremental_argument_list): Remove (invalid) forward
9689 * incremental.cc (Incremental_inputs::report_achive): New method.
9690 (Incremental_inputs::report_object): New method.
9691 (Incremental_inputs::report_script): New method.
9692 (Incremental_inputs::finalize_inputs): New method.
9693 (Incremental_inputs::finalize): Call finalize_inputs().
9694 (Incremental_inputs::sized_create_incremental_inputs_section_data):
9695 Create inputs entries.
9696 * incremental.h (Incremental_input_type): New enum.
9697 (Incremental_inputs::Incremental_input): Initialize new fields.
9698 (Incremental_inputs::report_inputs): New method.
9699 (Incremental_inputs::report_achive): New method.
9700 (Incremental_inputs::report_object): New method.
9701 (Incremental_inputs::report_script): New method.
9702 (Incremental_inputs::finalize_inputs): New method.
9703 (Incremental_inputs::Input_info): New struct.
9704 (Incremental_inputs::Input_info_map): New typedef.
9705 (Incremental_inputs::lock_): New field.
9706 (Incremental_inputs::Inputs_): New field.
9707 (Incremental_inputs::Inputs_map): New field.
9708 * main.cc (main): Call Incremental_input::report_inputs.
9709 * options.h (Input_argument_list): Typedef moved from
9711 (Input_file_group::Files): Remove, use ::Input_argument_list.
9712 (Input_file_group::Input_argument_list): Remove, use
9713 ::Input_argument_list.
9714 * plugin.cc (Plugin_manager::add_input_file): Add error in
9716 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
9718 * script.cc (read_input_script): Call
9719 Incremental_input::report_script.
9720 * script.h (Script_info): New class.
9722 2009-04-27 Ian Lance Taylor <iant@google.com>
9724 * x86_64.cc (do_adjust_output_section): Set entsize to
9727 2009-04-23 Elliott Hughes <enh@google.com>
9729 * output.cc (Output_file::close): After short writes, continue
9730 writing from the correct offset in the buffer being written.
9732 2009-04-23 Chris Demetriou <cgd@google.com>
9734 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
9735 * configure: Regenerate.
9736 * config.in: Regenerate.
9737 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
9738 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
9740 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
9742 * incremental.cc (Incremental_inputs_header_data): Renamed from
9743 Incremental_input_header_data.
9744 (Incremental_inputs_header_data::data_size): New field.
9745 (Incremental_inputs_header_data::put_input_file_count): Renamed
9746 from input_file_count.
9747 (Incremental_inputs_header_data::put_command_line_offset): Renamed
9748 from command_line_offset.
9749 (Incremental_inputs_header_data::put_reserved): Renamed from
9751 (Incremental_inputs_entry_data): Renamed from
9752 Incremental_input_entry_data.
9753 (Incremental_inputs_entry_data::data_size): New field.
9754 (Incremental_inputs::report_command_line): New method.
9755 (Incremental_inputs::finalize): New method.
9756 (Incremental_inputs::create_incremental_inputs_data): New method.
9757 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
9758 * incremental.h: New file.
9759 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
9760 (Layout::finalize): Create incremental inputs section in
9762 (Layout::create_incremental_info_sections): New method.
9763 * layout.h (Layout::incremental_inputs): New method.
9764 (Layout::create_incremental_info_sections): New method.
9765 (Layout::incremental_inputs_): New field.
9766 * main.cc (main): Notify Incremental_input of the command line.
9768 2009-04-01 Ian Lance Taylor <iant@google.com>
9769 Mikolaj Zalewski <mikolajz@google.com>
9771 * gold.h (reserve_unordered_map): Define, three versions, one for
9772 each version of Unordered_map.
9773 * layout.cc (Layout::Layout): Remove options parameter. Add
9774 number_of_input_files parameter. Don't initialize options_.
9775 Initialize number_of_input_files_ and resized_signatures_. Move
9776 sections_are_attached_.
9777 (Layout::layout_group): Reserve space for group_signatures_.
9778 (Layout::find_or_add_kept_section): Change name parameter to be a
9779 reference. Resize signatures_ map when it gets large enough.
9780 (Layout::layout_eh_frame): Use parameters->options() instead of
9782 (Layout::make_output_section): Likewise.
9783 (Layout::attach_allocated_section_to_segment): Likewise.
9784 (Layout::finalize, Layout::create_executable_stack): Likewise.
9785 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
9786 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
9787 * layout.h (class Layout): Update declarations. Remove options_
9788 field. Add number_of_input_files_ and resized_signatures_
9789 fields. Move sections_are_attached_ field.
9790 * main.cc (main): Pass number of input files to Layout
9791 constructor. Don't pass options.
9793 2009-03-30 Ian Lance Taylor <iant@google.com>
9795 * ffsll.c (ffsll): Correct implementation.
9797 2009-03-27 Ian Lance Taylor <iant@google.com>
9799 * ffsll.c: New file.
9800 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
9801 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
9802 * ftruncate.c (ftruncate): Declare before definition.
9803 * mremap.c (mremap): Likewise.
9804 * pread.c (pread): Likewise.
9805 * configure, Makefile.in, config.in: Rebuild.
9807 * mremap.c: New file.
9808 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
9809 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
9810 (mremap): Declare if HAVE_MREMAP is not defined.
9811 * configure, Makefile.in, config.in: Rebuild.
9813 2009-03-27 Cary Coutant <ccoutant@google.com>
9815 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
9816 position independent.
9817 * sparc.cc (Target_sparc::check_non_pic): Likewise.
9818 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
9820 2009-03-24 Cary Coutant <ccoutant@google.com>
9822 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
9824 (needs_dynamic_reloc): Likewise.
9826 2009-03-24 Ian Lance Taylor <iant@google.com>
9828 * yyscript.y (file_cmd): Recognize EXTERN.
9829 (extern_name_list, extern_name_list_body): New nonterminals.
9830 * script.cc (script_add_extern): Define.
9831 * script-c.h (script_add_extern): Declare.
9833 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
9835 * object.cc (is_elf_object): Define.
9836 * object.h (is_elf_object): Declare.
9837 * archive.cc (Archive::get_elf_object_for_member): Call
9839 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
9841 2009-03-24 Elliott Hughes <enh@google.com>
9843 * output.cc (Output_file::map_anonymous): Define.
9844 (Output_file::map): Use map_anonymous. If the regular mmap fails,
9845 try an anonymous one. Report the size if the mmap fails.
9846 * output.h (class Output_file): Declare map_anonymous.
9848 2009-03-24 Ian Lance Taylor <iant@google.com>
9850 * target-select.cc (instantiate_target): Don't acquire the lock if
9851 the instantiated_target_ field has already been set.
9853 2009-03-23 Ian Lance Taylor <iant@google.com>
9855 * gold-threads.h (class Initialize_lock): Define.
9856 * gold-threads.cc (class Initialize_lock_once): Define.
9857 (initialize_lock_control): New static variable.
9858 (initialize_lock_pointer): New static variable.
9859 (initialize_lock_once): New static function.
9860 (Initialize_lock::Initialize_lock): Define.
9861 (Initialize_lock::initialize): Define.
9862 * target-select.h: Include "gold-threads.h".
9863 (class Target_selector): Add lock_ and initialize_lock_ fields.
9864 Don't define instantiate_target, just declare it.
9865 * target-select.cc (Target_selector::Target_selector): Initialize
9867 (Target_selector::instantiate_target): Define.
9868 * descriptors.h: Include "gold-threads.h".
9869 (class Descriptors): Add initialize_lock_ field.
9870 * descriptors.cc (Descriptors::Descriptors): Initialize new
9872 (Descriptors::open): Use initialize_lock_ field
9873 * errors.h (class Errors): Add initialize_lock_ field.
9874 * errors.cc (Errors::Errors): Initialize new field.
9875 (Errors::initialize_lock): Use initialize_lock_ field.
9876 * powerpc.cc (class Target_selector_powerpc): Remove
9877 instantiated_target_ field. In do_recognize call
9878 instantiate_target rather than do_instantiate_target. In
9879 do_instantiate_target just allocate a new target.
9880 * sparc.cc (class Target_selector_sparc): Likewise.
9882 * freebsd.h: New file.
9883 * i386.cc: Include "freebsd.h".
9884 (Target_i386): Derive from Target_freebsd rather than
9886 (Target_selector_i386): Derive from Target_selector_freebsd rather
9887 than Target_selector.
9888 * x86_64.cc: Include "freebsd.h".
9889 (Target_x86_64): Derive from Target_freebsd rather than
9891 (Target_selector_x86_64): Derive from Target_selector_freebsd
9892 rather than Target_selector.
9893 * target.h (class Target): Add adjust_elf_header and
9894 do_adjust_elf_header.
9895 * output.cc (Output_file_header:: do_sized_write): Call target
9896 adjust_elf_header routine.
9897 * configure.tgt: Set targ_osabi.
9898 * configure.ac: Define GOLD_DEFAULT_OSABI.
9899 * parameters.cc (Parameters::default_target): Pass
9900 GOLD_DEFAULT_OSABI to select_target.
9901 * target-select.h (class Target_selector): Make instantiate_target
9902 protected rather than private.
9903 * Makefile.am (HFILES): Add freebsd.h.
9904 * configure, Makefile.in, config.in: Rebuild.
9906 * merge.cc (do_add_input_section): Correct pend value. Change
9907 message about last entry not being null terminated from error to
9910 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
9912 * incremental.cc: New file.
9913 * Makefile.am (CCFILES): Add incremental.cc.
9914 * Makefile.in: Rebuild.
9916 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
9918 * layout.cc (Layout::output_section_name): Preserve names
9919 of '.note.' sections.
9921 2009-03-19 Ian Lance Taylor <iant@google.com>
9923 * descriptors.cc (Descriptors::open): Check that the options are
9924 valid before using them.
9926 2009-03-18 Ian Lance Taylor <iant@google.com>
9928 * script-sections.h: Include <list>.
9929 (class Script_sections): Change Sections_elements from std::vector
9930 to std::list. Typedef public Elements_iterator. Add
9931 orphan_section_placement_, data_segment_align_start_, and
9932 saw_data_segment_align_ fields. Remove data_segment_align_index_
9934 * script-sections.cc (class Orphan_section_placement): New class.
9935 (class Sections_element): Add virtual functions is_relro and
9936 orphan_section_init. Remove virtual function place_orphan_here.
9937 (class Output_section_definition): Add is_relro and
9938 orphan_section_init. Remove place_orphan_here.
9939 (class Orphan_output_section): Likewise.
9940 (Script_sections::Script_sections): Update for field changes.
9941 (Script_sections::data_segment_align): Set saw_data_segment_align_
9942 and data_segment_align_start_, not data_segment_align_index.
9943 (Script_sections::data_segment_relro_end): Check
9944 saw_data_segment_align_. Use data_segment_align_start_ rather
9945 than data_segment_align_index_.
9946 (Script_sections::place_orphan): Rewrite to use
9947 Orphan_section_placement.
9949 2009-03-17 Ian Lance Taylor <iant@google.com>
9951 * archive.cc (Archive::add_symbols): Check for a version attached
9952 to the symbol name in the archive map.
9953 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
9954 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
9955 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
9956 (ver_test_11.a): New target.
9957 * testsuite/Makefile.in: Rebuild.
9959 * configure.ac: Check for chsize and posix_fallocate. Replace
9961 * ftruncate.c: New file, from gnulib.
9962 * output.cc (posix_fallocate): Define dummy version if not
9963 HAVE_POSIX_FALLOCATE.
9964 (Output_file::map): Call posix_fallocate rather than lseek and
9966 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
9967 * configure, Makefile.in, config.in: Rebuild.
9969 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
9971 * layout.h (Layout::create_note): Add section_name parameter.
9972 * layout.cc (Layout::create_note): Likewise.
9973 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
9975 2009-03-17 Ian Lance Taylor <iant@google.com>
9977 * descriptors.cc: Include "options.h".
9978 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
9979 (Descriptors::open): Always use O_CLOEXEC when opening a new
9980 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
9981 then set FD_CLOEXEC.
9983 * sparc.cc (class Target_sparc): Add has_got_section.
9984 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
9985 make sure we have a GOT section.
9987 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
9988 (Target_sparc::Scan::local): Likewise.
9989 (Target_sparc::Scan::global): Likewise.
9990 (Target_sparc::Relocate::relocate): Likewise.
9991 (Target_sparc::Relocate::relocate_tls): Likewise.
9993 * symtab.cc (Symbol_table::define_default_version): New function,
9994 broken out of add_from_object.
9995 (Symbol_table::add_from_object): Call define_default_version.
9996 (Symbol_table::define_special_symbol): Add resolve_oldsym
9997 parameter. Change all callers. If the version for a symbol comes
9998 from a version script, resolve it with the symbol with the same
9999 name with no version. Also add the symbol without a version if
10001 (do_define_in_output_data): If resolving with oldsym, don't delete
10003 (do_define_in_output_segment): Likewise.
10004 (do_define_as_constant): Likewise.
10005 * symtab.h (class Symbol_table): Update declarations.
10007 2009-03-13 Ian Lance Taylor <iant@google.com>
10009 * readsyms.cc (Read_symbols::incompatible_warning): New function.
10010 (Read_symbols::requeue): New function.
10011 (Read_symbols::do_read_symbols): If make_elf_object fails because
10012 the target type is not configured, and the file was searched for,
10013 issue a warning and retry with the next directory.
10014 (Add_symbols::run): If the file has an incompatible format, and
10015 it was searched for, requeue the Read_symbols task. On error,
10016 release the object.
10017 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
10018 dirindex parameter to constructor. Change all callers. Declare
10019 incompatible_warning and requeue.
10020 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
10021 input_argument_ and input_group_ fields. Add them to
10022 constructor. Change all callers.
10023 (class Read_script): Add dirindex_ field. Add it to constructor.
10024 Change all callers.
10025 * archive.cc (Archive::setup): Remove input_objects parameter.
10026 Change all callers.
10027 (Archive::get_file_and_offset): Likewise.
10028 (Archive::read_all_symbols): Likewise.
10029 (Archive::read_symbols): Likewise.
10030 (Archive::get_elf_object_for_member): Remove input_objects
10031 parameter. Add punconfigured parameter. Change all callers.
10032 (Archive::add_symbols): Change return type to bool. Check return
10033 value of include_member.
10034 (Archive::include_all_members): Likewise.
10035 (Archive::include_member): Change return type to bool. Return
10036 false if first included object has incompatible target. Set
10037 included_member_ field.
10038 (Add_archive_symbols::run): If add_symbols returns false, requeue
10040 * archive.h (class Archive): Add included_member_ field.
10041 Initialize it in constructor. Add input_file and searched_for
10042 methods. Update declarations.
10043 (class Add_archive_symbols): Add dirpath_, dirindex_, and
10044 input_argument_ fields. Add them to constructor. Change all
10046 * script.cc: Include "target-select.h".
10047 (class Parser_closure): Add skip_on_incompatible_target_ and
10048 found_incompatible_target_ fields. Add
10049 skip_on_incompatible_target parameter to constructor. Change all
10050 callers. Add methods skip_on_incompatible_target,
10051 clear_skip_on_incompatible_target, found_incompatible_target, and
10052 set_found_incompatible_target.
10053 (read_input_script): Add dirindex parameter. Change all callers.
10054 If parser finds an incompatible target, requeue Read_symbols
10056 (script_set_symbol): Clear skip_on_incompatible_target in
10058 (script_add_assertion, script_parse_option): Likewise.
10059 (script_start_sections, script_add_phdr): Likewise.
10060 (script_check_output_format): New function.
10061 * script.h (read_input_script): Update declaration.
10062 * script-c.h (script_check_output_format): Declare.
10063 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
10064 (ignore_cmd): Remove OUTPUT_FORMAT.
10065 * fileread.cc (Input_file::Input_file): Add explicit this.
10066 (Input_file::will_search_for): New function.
10067 (Input_file::open): Add pindex parameter. Change all callers.
10068 * fileread.h (class Input_file): Add input_file_argument method.
10069 Declare will_search_for. Update declarations.
10070 * object.cc (make_elf_object): Add punconfigured parameter.
10071 Change all callers.
10072 * object.h (class Object): Make input_file public. Add
10073 searched_for method.
10074 (make_elf_object): Update declaration.
10075 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
10077 * dirsearch.h (class Dirsearch): Update declaration.
10078 * options.h (class General_options): Add --warn-search-mismatch.
10079 * parameters.cc (Parameters::is_compatible_target): New function.
10080 * parameters.h (class Parameters): Declare is_compatible_target.
10081 * workqueue.cc (Workqueue::add_blocker): New function.
10082 * workqueue.h (class Workqueue): Declare add_blocker.
10084 * fileread.cc (Input_file::open): Remove options parameter.
10085 Change all callers.
10086 (Input_file::open_binary): Likewise.
10087 * script.cc (read_input_script): Likewise.
10088 * readsyms.h (class Read_symbols): Remove options_ field. Remove
10089 options parameter from constructor. Change all callers.
10090 (class Read_script): Likewise.
10091 * fileread.h (class Input_file): Update declarations.
10092 * script.h (read_input_script): Update declaration.
10094 2009-03-10 Nick Clifton <nickc@redhat.com>
10096 * po/es.po: New Spanish translation.
10098 2009-03-06 Cary Coutant <ccoutant@google.com>
10100 * options.cc (parse_short_option): Keep dash_z from registering itself.
10102 2009-03-03 Ian Lance Taylor <iant@google.com>
10105 * target-reloc.h (relocate_section): Pass output_section to
10107 * i386.cc (Target_i386::should_apply_static_reloc): Add
10108 output_section parameter. Change all callers.
10109 (Target_i386::Relocate::relocate): Add output_section parameter.
10110 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10111 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
10112 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
10113 * testsuite/two_file_shared.sh: New script.
10114 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
10115 (check_DATA): Add two_file_shared.dbg.
10116 (two_file_shared.dbg): New target.
10117 * testsuite/Makefile.in: Rebuild.
10119 2009-03-01 Ian Lance Taylor <iant@google.com>
10121 * configure.ac: Check for byteswap.h.
10122 * configure: Rebuild.
10123 * config.in: Rebuild.
10125 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
10127 * layout.cc (Layout::find_or_add_kept_section): New function.
10128 (Layout::add_comdat): Removed.
10129 * layout.h (struct Kept_section): Move out of class Layout.
10130 Remove trailing underscores from field names. Add group_sections
10131 field. Rename group_ field to is_group. Change all uses.
10132 (class Layout): Declare find_or_add_kept_section, not add_comdat.
10133 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
10134 comdat_groups_ field.
10135 (Sized_relobj::include_section_group): Use
10136 find_or_add_kept_section and Kept_section::group_sections.
10137 (Sized_relobj::include_linkonce_section): Likewise.
10138 * object.cc (class Sized_relobj): Don't define Comdat_group or
10139 Comdat_group_table. Remove find_comdat_group and
10140 add_comdat_group. Remove comdat_groups_ field.
10141 * plugin.cc (include_comdat_group): Use
10142 Layout::find_or_add_kept_section.
10144 2009-02-28 Ian Lance Taylor <iant@google.com>
10146 * README: --gc-sections and map files are now supported. Document
10147 some build requirements.
10150 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
10151 relocatable link set the value of the section symbol to zero.
10152 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
10153 relocatable link don't include the section address in the local
10156 2009-02-27 Ian Lance Taylor <iant@google.com>
10159 * options.h (class Search_directory): Add is_system_directory.
10160 (class General_options): Declare is_in_system_directory.
10161 * options.cc (get_relative_sysroot): Make static.
10162 (get_default_sysroot): Make static.
10163 (General_optoins::is_in_system_directory): New function.
10164 * fileread.cc (Input_file::is_in_system_directory): New function.
10165 * fileread.h (class Input_file): Declare is_in_system_directory.
10166 * object.h (class Object): Add is_in_system_directory.
10167 (class Input_objects): Remove system_library_directory_ field.
10168 * object.cc (Input_objects::add_object): Don't set
10169 system_library_directory_.
10170 (input_objects::found_in_system_library_directory): Remove.
10171 * symtab.cc (Symbol_table::write_globals): Remove input_objects
10172 parameter. Change all callers.
10173 (Symbol_table::sized_write_globals): Likewise.
10174 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
10175 Call Object::is_in_system_directory.
10176 * symtab.h (class Symbol_table): Update declarations.
10179 * descriptors.h (Open_descriptor): Add is_on_stack field.
10180 * descriptors.cc (Descriptors::open): If the descriptor is on the
10181 top of the stack, remove it. Initialize is_on_stack field.
10182 (Descriptors::release): Only add pod to stack if it is not on the
10184 (Descriptors::close_some_descriptor): Clear stack_next and
10185 is_on_stack fields.
10188 * output.cc (Output_section::find_starting_output_address): Rename
10189 from starting_output_address; add PADDR parameter; change return
10191 * output.h (class Output_section): Declare
10192 find_starting_output_address instead of starting_output_address.
10193 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
10194 section symbol for which we can't find a merge section.
10197 * symtab.cc (Symbol_table::add_from_object): If the visibility is
10198 hidden or internal, force the symbol to be local.
10199 * resolve.cc (Symbol::override_visibility): Define.
10200 (Symbol::override_base): Use override_visibility.
10201 (Symbol_table::resolve): Likewise.
10202 (Symbol::override_base_with_special): Likewise.
10203 (Symbol_table::override_with_special): If the visibility is hidden
10204 or internal, force the symbol to be local.
10205 * symtab.h (class Symbol): Add set_visibility and
10206 override_visibility.
10207 * testsuite/ver_test_1.sh: New file.
10208 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
10209 (check_DATA): Add ver_test_1.syms.
10210 (ver_test_1.syms): New target.
10211 * testsuite/Makefile.in: Rebuild.
10213 2009-02-25 Cary Coutant <ccoutant@google.com>
10215 * layout.cc (Layout::choose_output_section): Don't rename sections
10216 when using a linker script that has a SECTIONS clause.
10217 * Makefile.in: Regenerate.
10219 * testsuite/Makefile.am (script_test_5.sh): New test case.
10220 * testsuite/Makefile.in: Regenerate.
10221 * testsuite/script_test_5.cc: New file.
10222 * testsuite/script_test_5.sh: New file.
10223 * testsuite/script_test_5.t: New file.
10225 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
10227 * archive.cc (Archive::include_member): Update calls to add_symbols.
10228 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
10229 the Layout argument.
10230 * dynobj.h (do_add_symbols): Add the Layout argument.
10231 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
10233 * object.h (Object::add_symbols): Add the Layout argument.
10234 (Object::do_add_symbols): Add the Layout argument.
10235 (Sized_relobj::do_add_symbols): Add the Layout argument.
10236 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
10237 Unify the two versions.
10238 (Add_plugin_symbols): Remove.
10239 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
10240 (Sized_pluginobj::do_add_symbols): Unify the two versions.
10241 (Add_plugin_symbols): Remove.
10242 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
10243 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
10244 (Add_symbols::run): Make it work with Pulginobj.
10246 2009-02-06 Ian Lance Taylor <iant@google.com>
10248 * object.cc (Sized_relobj::do_layout): Make info message start
10249 with lower case letter.
10251 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
10253 * binary.cc: Fix file comment.
10255 * options.h (enum Incremental_disposition): Define.
10256 (class General_options): Add new options: --incremental,
10257 --incremental_changed, --incremental_unchanged,
10258 --incremental_unknown. Add incremental_disposition_ and
10259 implicit_incremental_ fields.
10260 (General_options::incremental_disposition): New function.
10261 (class Position_dependent_options): Add incremental_disposition
10263 (Position_dependent_options::copy_from_options): Set incremental
10265 * options.cc (General_options::parse_incremental_changed): New
10267 (General_options::parse_incremental_unchanged): New function.
10268 (General_options::parse_incremental_unknown): New function.
10269 (General_options::General_options): Initialize new fields
10270 incremental_disposition_ and implicit_incremental_.
10271 (General_options::finalize): Check for uasge of --incremental-*
10272 without --incremental.
10274 2009-02-06 Chris Demetriou <cgd@google.com>
10276 * gold.h (gold_undefined_symbol): Change to take only a Symbol
10277 pointer and to report location as the file name associated with
10279 (gold_undefined_symbol_at_location): New function to replace the
10280 old gold_undefined_symbol functionality.
10281 * target-reloc.h (relocate_section): Update to use
10282 gold_undefined_symbol_at_location.
10283 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10284 Call gold_undefined_symbol function rather than gold_error.
10285 * errors.h (Errors::undefined_symbol): Take location as a
10286 string, rather than calculating it from a relocation.
10287 * errors.cc (Errors::fatal): Print "fatal error:" before the
10289 (Errors::error, Errors::error_at_location): Print "error: "
10290 before the formatted message.
10291 (Errors::undefined_symbol): Take location as a string, rather
10292 than calculating it from a relocation.
10293 (gold_undefined_symbol_at_location): New function akin to
10294 old gold_undefined_symbol, calculates location from relocation.
10295 (gold_undefined_symbol): Change to take only a Symbol pointer
10296 and to report location as the file name associated with the symbol.
10297 * testsuite/debug_msg.sh: Update for changed error messages.
10298 * testsuite/undef_symbol.sh: Likewise.
10300 2009-02-04 Duncan Sands <baldrick@free.fr>
10303 * reduced_debug_output.h
10304 (Output_reduced_debug_abbrev_section::failed): Use format for
10306 (Output_reduced_debug_info_section::faild): Likewise.
10308 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
10310 * script.cc (Lazy_demangler): New class.
10311 (Version_script_info::get_symbol_version_helper): Demangle a
10314 2009-01-29 Cary Coutant <ccoutant@google.com>
10316 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
10318 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10320 2009-01-28 Ian Lance Taylor <iant@google.com>
10322 * version.cc (version_string): Bump to 1.9.
10324 * gold.h: Include <cstring> and <stdint.h>.
10325 * version.cc: Include <cstdio>.
10326 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
10328 * reduced_debug_output.cc (insert_into_vector): Rename from
10329 Insert_into_vector; change all callers. Use Swap_unaligned to
10330 avoid aliasing issue; remove union since it is unnecessary.
10332 2009-01-27 Sriraman Tallam <tmsriram@google.com>
10334 * Makefile.am (CCFILES): Add gc.cc.
10335 (HFILES): Add gc.h.
10336 * Makefile.in: Regenerate.
10337 * gold.cc (Gc_runner): New class.
10338 (queue_initial_tasks): Call garbage collection related tasks
10339 when corresponding options are invoked.
10340 (queue_middle_gc_tasks): New function.
10341 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
10342 processed early before laying out sections during garbage collection.
10343 * gold.h (queue_middle_gc_tasks): New function.
10344 (is_prefix_of): Move from "layout.cc".
10345 * i386.cc (Target_i386::gc_process_relocs): New function.
10346 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
10347 * main.cc (main): Create object of class "Garbage_collection".
10348 * object.cc (Relobj::copy_symbols_data): New function.
10349 (Relobj::is_section_name_included): New function.
10350 (Sized_relobj::do_layout): Allow this function to be called twice
10351 during garbage collection and defer layout of section during the
10353 * object.h (Relobj::get_symbols_data): New function.
10354 (Relobj::is_section_name_included): New function.
10355 (Relobj::copy_symbols_data): New function.
10356 (Relobj::set_symbols_data): New function.
10357 (Relobj::get_relocs_data): New function.
10358 (Relobj::set_relocs_data): New function.
10359 (Relobj::is_output_section_offset_invalid): New pure virtual function.
10360 (Relobj::gc_process_relocs): New function.
10361 (Relobj::do_gc_process_relocs): New pure virtual function.
10362 (Relobj::sd_): New data member.
10363 (Sized_relobj::is_output_section_offset_invalid): New function.
10364 (Sized_relobj::do_gc_process_relocs): New function.
10365 * options.h (General_options::gc_sections): Modify to not be a no-op.
10366 (General_options::print_gc_sections): New option.
10367 * plugin.cc (Plugin_finish::run): Remove function call to
10368 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
10369 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
10370 * reloc.cc (Read_relocs::run): Add task to process relocs and
10371 determine unreferenced sections when doing garbage collection.
10372 (Gc_process_relocs): New class.
10373 (Sized_relobj::do_gc_process_relocs): New function.
10374 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
10375 sections that are garbage collected.
10376 * reloc.h (Gc_process_relocs): New class.
10377 * sparc.cc (Target_sparc::gc_process_relocs): New function.
10378 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
10379 symbols whose corresponding sections are garbage collected.
10380 (Symbol_table::Symbol_table): Add new parameter for the garbage
10382 (Symbol_table::gc_mark_undef_symbols): New function.
10383 (Symbol_table::gc_mark_symbol_for_shlib): New function.
10384 (Symbol_table::gc_mark_dyn_syms): New function.
10385 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
10387 (Symbol_table::add_from_object): Likewise.
10388 (Symbol_table::add_from_relobj): When building shared objects, do not
10389 treat externally visible symbols as garbage.
10390 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
10391 table information for static and relocatable links.
10392 * symtab.h (Symbol_table::set_gc): New function.
10393 (Symbol_table::gc): New function.
10394 (Symbol_table::gc_mark_undef_symbols): New function.
10395 (Symbol_table::gc_mark_symbol_for_shlib): New function.
10396 (Symbol_table::gc_mark_dyn_syms): New function.
10397 (Symbol_table::gc_): New data member.
10398 * target.h (Sized_target::gc_process_relocs): New pure virtual
10400 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
10401 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
10403 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
10405 * options.h (General_options::gc_sections): Define as a no-op for now.
10406 (General_options::no_keep_memory): Ditto.
10407 (General_options::Bshareable): Define.
10408 * options.cc (General_options::finalize): Honor -Bshareable.
10410 2009-01-20 Andreas Schwab <schwab@suse.de>
10412 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
10413 read the value in the contents, since we don't use it. Use the
10414 template endianness when writing.
10415 (Relocate::relocate): Use it for R_PPC_REL16_HA.
10417 2009-01-19 Andreas Schwab <schwab@suse.de>
10419 * configure.tgt (powerpc64-*): Fix targ_obj.
10421 2009-01-15 Ian Lance Taylor <iant@google.com>
10423 * object.cc (Sized_relobj::write_local_symbols): Don't write out
10424 local symbols when stripping all symbols.
10426 2009-01-14 Cary Coutant <ccoutant@google.com>
10428 * output.cc (Output_reloc): Add explicit instantiations.
10430 2009-01-14 Cary Coutant <ccoutant@google.com>
10432 * archive.cc (Archive::get_elf_object_for_member): Remove call
10433 to File_read::claim_for_plugin.
10434 * descriptors.cc (Descriptors::open): Remove reference to
10436 (Descriptors::claim_for_plugin): Remove.
10437 * descriptors.h (Descriptors::claim_for_plugin): Remove.
10438 (Descriptors::is_claimed): Remove.
10439 (claim_descriptor_for_plugin): Remove.
10440 * fileread.cc (File_read::claim_for_plugin): Remove.
10441 * fileread.h (File_read::claim_for_plugin): Remove.
10442 (File_read::descriptor): Reopen descriptor if necessary.
10443 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
10444 (Plugin_manager::all_symbols_read): Add task parameter. Change
10446 (Plugin_manager::get_input_file): New function.
10447 (Plugin_manager::release_input_file): New function.
10448 (Pluginobj::Pluginobj): Add filesize parameter and initialize
10449 corresponding data member.
10450 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
10451 and pass to base constructor. Change all callers.
10452 (get_input_file, release_input_file): New functions.
10453 (make_sized_plugin_object): Add filesize parameter. Change all callers.
10454 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
10455 (Plugin_manager::all_symbols_read): Add task parameter.
10456 (Plugin_manager::get_input_file): New function.
10457 (Plugin_manager::release_input_file): New function.
10458 (Plugin_manager::task_): New data member.
10459 (Pluginobj::Pluginobj): Add filesize parameter.
10460 (Pluginobj::filename): New function.
10461 (Pluginobj::descriptor): New function.
10462 (Pluginobj::filesize): New function.
10463 (Pluginobj::filesize_): New data member.
10464 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
10465 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
10466 File_read::claim_for_plugin; use Object::unlock to unlock the file.
10468 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
10469 with archive libraries.
10470 * testsuite/Makefile.in: Regenerate.
10471 * testsuite/plugin_test.c (struct sym_info): New type.
10472 (get_input_file, release_input_file): New static variables.
10473 (onload): Capture new transfer vector entries.
10474 (claim_file_hook): Stop reading at end of file according to filesize.
10475 Factor out parsing of readelf output into separate function.
10476 (all_symbols_read_hook): Exercise get_input_file and release_input_file
10477 APIs and get the source file name from the symbol table. Convert
10478 source file name to corresponding object file name. Print info
10479 message when adding new input files.
10480 (parse_readelf_line): New function.
10481 * testsuite/plugin_test_1.sh: Add checks for new info messages.
10482 * testsuite/plugin_test_2.sh: Likewise.
10483 * testsuite/plugin_test_3.sh: Likewise.
10484 * testsuite/plugin_test_4.sh: New test case.
10486 2009-01-07 Ian Lance Taylor <iant@google.com>
10488 * version.cc (version_string): Bump to 1.8.
10490 2008-12-23 Cary Coutant <ccoutant@google.com>
10492 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
10493 * plugin.cc (Plugin_manager::finish): Rename as
10494 layout_deferred_objects. Move cleanup to separate function.
10495 (Plugin_manager::cleanup): New function.
10496 (Plugin_finish::run): Call layout_deferred_objects and cleanup
10498 * plugin.h (Plugin_manager::finish): Rename as
10499 layout_deferred_objects.
10500 (Plugin_manager::cleanup): New function.
10501 (Plugin_manager::cleanup_done): New field.
10503 2008-12-23 Cary Coutant <ccoutant@google.com>
10505 * plugin.cc (is_visible_from_outside): New function.
10506 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
10507 so we don't return "IR only" status for exported symbols or -r links.
10509 * testsuite/Makefile.am (plugin_test_3): New test case.
10510 * testsuite/Makefile.in: Regenerate.
10511 * testsuite/plugin_test_3.sh: New file.
10513 2008-12-22 Cary Coutant <ccoutant@google.com>
10515 * object.cc (Sized_relobj::layout_section): New function.
10516 (Sized_relobj::do_layout): Defer layout of input sections until after
10517 plugin has provided replacement files.
10518 (Sized_relobj::do_layout_deferred_sections): New function.
10519 * object.h (Relobj::set_section_offset): Remove virtual keyword.
10520 (Relobj::layout_deferred_sections): New function.
10521 (Relobj::do_layout_deferred_sections): New function.
10522 (Sized_relobj::do_layout_deferred_sections): New function.
10523 (Sized_relobj::layout_section): New function.
10524 (Sized_relobj::Deferred_layout): New structure.
10525 (Sized_relobj::deferred_layout_): New field.
10526 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10527 Change all callers. Layout deferred sections.
10528 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
10530 (Plugin_hook::run): Move code from do_plugin_hook inline.
10531 (Plugin_hook::do_plugin_hook): Remove.
10532 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10533 (Plugin_manager::finish): Renamed, was cleanup.
10534 (Plugin_manager::should_defer_layout): New function.
10535 (Plugin_manager::add_deferred_layout_object): New function.
10536 (Plugin_manager::Deferred_layout_list): New type.
10537 (Plugin_manager::deferred_layout_objects_): New field.
10538 (Plugin_hook::do_plugin_hook): Remove.
10540 2008-12-17 Ian Lance Taylor <iant@google.com>
10542 * options.h (class General_options): Add --no case for
10545 2008-12-16 Cary Coutant <ccoutant@google.com>
10547 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
10549 (Plugin_manager::claim_file): Create plugin object even if
10550 plugin did not call the add_symbols callback.
10551 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10552 asking for more symbols than were added.
10553 * testsuite/Makefile.am (plugin_test_1): Add test case with
10555 (empty.syms): New target.
10556 * testsuite/Makefile.in: Regenerate.
10557 * testsuite/plugin_test.c (claim_file_hook): Add new debug
10558 message. Don't call add_symbols if no globals.
10559 (all_symbols_read_hook): Don't provide replacement for empty
10562 2008-12-12 Ian Lance Taylor <iant@google.com>
10564 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10565 r_type == 0 for a local symbol with r_sym == 0.
10566 (scan_relocatable_relocs): Pass r_sym to
10567 local_non_section_strategy.
10568 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10571 * configure.ac: Update test for TLS descriptors: they are
10572 supported as of glibc 2.9.
10573 * configure: Rebuild.
10575 2008-12-11 Ian Lance Taylor <iant@google.com>
10578 * target-reloc.h (Default_scan_relocatable_relocs): For each
10579 function, map r_type == 0 to RELOC_DISCARD.
10581 2008-12-10 Cary Coutant <ccoutant@google.com>
10583 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
10584 object to override a kept COMDAT group from a plugin object.
10586 2008-12-09 Ian Lance Taylor <iant@google.com>
10589 * yyscript.y (file_cmd): Handle INPUT.
10591 * testsuite/initpri1.c: Change all declarations to be full
10592 prototypes by adding void, to avoid compiler warnings.
10594 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
10596 * options.cc (General_options::parse_plugin_opt): New.
10597 (General_options::add_plugin): The argument now is just the filename.
10598 (General_options::add_plugin_option): New.
10599 * options.h (plugin_opt): New.
10600 (add_plugin): Change argument name.
10601 (add_plugin_option): New.
10602 * plugin.cc (Plugin::load): Don't parse the plugin option.
10603 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
10604 (Plugin::add_option): New.
10605 (Plugin::args_): Change type.
10606 (Plugin::filename_): New.
10607 (Plugin_manager::add_plugin_option): New.
10608 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
10609 * testsuite/Makefile.in: Regenerate.
10611 2008-12-05 Cary Coutant <ccoutant@google.com>
10613 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
10614 Handle --strip-lto-sections option.
10615 * options.h (strip_lto_sections): New option.
10617 2008-12-01 Cary Coutant <ccoutant@google.com>
10619 * plugin.cc (ld_plugin_message): Change format parameter to const.
10620 Fix mismatch between new[] and delete.
10622 2008-11-14 Cary Coutant <ccoutant@google.com>
10624 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
10627 2008-11-05 Craig Silverstein <csilvers@google.com>
10629 * options.cc (General_options::parse_dynamic_list): New function.
10630 * options.h (General_options): New flags dynamic_list,
10631 dynamic_list_data, dynamic_list_cpp_new, and
10632 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
10633 (General_options::in_dynamic_list): New function.
10634 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
10635 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
10636 (Lex::can_continue_name): Likewise.
10638 (read_script_file): New parameter script_options.
10639 (read_dynamic_list): New function.
10640 (Script_options::define_dynamic_list): New function.
10641 (dynamic_list_keyword_parsecodes): New variable.
10642 (dynamic_list_keywords): New variable.
10643 * script.h (Script_options::define_dynamic_list): New function
10645 (read_dynamic_list): New function prototype.
10646 * symtab.cc (strprefix): New macro.
10647 (Symbol::should_add_dynsym_entry): Support dynamic_list,
10648 dynamic_list_data, dynamic_list_cpp_new, and
10649 dynamic_list_cpp_typeinfo.
10650 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
10651 (dynamic_list_expr): New rule.
10652 (dynamic_list_nodes): Likewise.
10653 (dynamic_list_node): Likewise.
10654 * testsuite/Makefile.am (dynamic_list): New test.
10655 * testsuite/Makefile.in: Regenerated.
10656 * testsuite/dynamic_list.t: New file.
10657 * testsuite/dynamic_list.sh: New file.
10659 2008-11-05 Craig Silverstein <csilvers@google.com>
10661 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
10662 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
10663 (t11_last): Likewise.
10664 * testsuite/ver_test_6.c (main): Likewise.
10666 2008-10-07 Cary Coutant <ccoutant@google.com>
10668 * options.c (General_options::finalize): Add check for -static and
10670 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
10673 2008-10-02 Cary Coutant <ccoutant@google.com>
10675 * plugin.cc (make_sized_plugin_object): Fix conditional
10676 compilation to work when not all targets are enabled.
10678 2008-09-29 Cary Coutant <ccoutant@google.com>
10680 * archive.cc (Archive::get_file_and_offset): Use filename instead
10681 of name to get library path.
10682 (Archive::include_member): Unlock external member of a thin archive.
10684 * testsuite/Makefile.am (TEST_AR): New variable.
10685 (thin_archive_test_1): New test.
10686 (thin_archive_test_2): New test.
10687 * testsuite/Makefile.in: Regenerate.
10688 * testsuite/thin_archive_main.cc: New file.
10689 * testsuite/thin_archive_test_1.cc: New file.
10690 * testsuite/thin_archive_test_2.cc: New file.
10691 * testsuite/thin_archive_test_3.cc: New file.
10692 * testsuite/thin_archive_test_4.cc: New file.
10694 2008-09-29 Cary Coutant <ccoutant@google.com>
10696 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
10697 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
10699 (Sized_relobj::do_finalize_local_symbols): Likewise.
10700 (Sized_relobj::map_to_kept_section): Likewise.
10701 * object.h (Sized_relobj::invalid_address): New constant.
10702 (Sized_relobj::do_output_section_offset): Check for invalid_address
10704 * output.cc (Output_reloc::local_section_offset): Use constant
10705 invalid_address instead of -1U.
10706 (Output_reloc::get_address): Likewise.
10707 (Output_section::output_address): Change -1U to -1ULL.
10708 * output.h (Output_reloc::invalid_address): New constant.
10709 * reloc.cc (Sized_relobj::write_sections): Use constant
10710 invalid_address instead of -1U.
10711 (Sized_relobj::relocate_sections): Likewise.
10712 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
10713 values for merge sections.
10714 * target-reloc.h (relocate_for_relocatable): Use constant
10715 invalid_address instead of -1U.
10717 2008-09-19 Cary Coutant <ccoutant@google.com>
10719 Add plugin functionality for link-time optimization (LTO).
10720 * configure.ac (plugins): Add --enable-plugins option.
10721 * configure: Regenerate.
10722 * config.in: Regenerate.
10723 * Makefile.am (LIBDL): New variable.
10724 (CCFILES): Add plugin.cc.
10725 (HFILES): Add plugin.h.
10726 (ldadd_var): Add LIBDL.
10727 * Makefile.in: Regenerate.
10729 * archive.cc: Include "plugin.h".
10730 (Archive::setup): Don't preread archive symbols when using a plugin.
10731 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
10732 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
10734 (Archive::include_member): Add symbols from plugin objects.
10735 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
10736 * descriptors.cc (Descriptors::open): Check for file descriptors
10737 abandoned by plugins.
10738 (Descriptors::claim_for_plugin): New function.
10739 * descriptors.h (Descriptors::claim_for_plugin): New function.
10740 (Open_descriptor::is_claimed): New field.
10741 (claim_descriptor_for_plugin): New function.
10742 * fileread.cc (File_read::claim_for_plugin): New function.
10743 * fileread.h (File_read::claim_for_plugin): New function.
10744 (File_read::descriptor): New function.
10745 * gold.cc: Include "plugin.h".
10746 (queue_initial_tasks): Add task to call plugin hooks for generating
10748 * main.cc: Include "plugin.h".
10749 (main): Load plugin libraries.
10750 * object.h (Pluginobj): Declare.
10751 (Object::pluginobj): New function.
10752 (Object::do_pluginobj): New function.
10753 (Object::set_target): New function.
10754 * options.cc: Include "plugin.h".
10755 (General_options::parse_plugin): New function.
10756 (General_options::General_options): Initialize plugins_ field.
10757 (General_options::add_plugin): New function.
10758 * options.h (Plugin_manager): Declare.
10759 (General_options): Add --plugin option.
10760 (General_options::has_plugins): New function.
10761 (General_options::plugins): New function.
10762 (General_options::add_plugin): New function.
10763 (General_options::plugins_): New field.
10764 * plugin.cc: New file.
10765 * plugin.h: New file.
10766 * readsyms.cc: Include "plugin.h".
10767 (Read_symbols::do_read_symbols): Check for archive before checking
10768 for ELF file. Call plugin hooks to claim files.
10769 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
10770 from a real object file; force override when processing replacement
10772 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
10773 (Symbol::init_base_object): Likewise.
10774 (Symbol::init_base_output_data): Likewise.
10775 (Symbol::init_base_output_segment): Likewise.
10776 (Symbol::init_base_constant): Likewise.
10777 (Symbol::init_base_undefined): Likewise.
10778 (Symbol::output_section): Assert that object is not a plugin.
10779 (Symbol_table::add_from_pluginobj): New function.
10780 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
10782 (Symbol_table::sized_write_globals): Likewise.
10783 (Symbol_table::add_from_pluginobj): Instantiate template.
10784 * symtab.h (Sized_pluginobj): Declare.
10785 (Symbol::in_real_elf): New function.
10786 (Symbol::set_in_real_elf): New function.
10787 (Symbol::in_real_elf_): New field.
10788 (Symbol_table::add_from_pluginobj): New function.
10790 * testsuite/Makefile.am (AM_CFLAGS): New variable.
10791 (LIBDL): New variable.
10792 (LDADD): Add LIBDL.
10793 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
10794 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
10795 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
10796 (MOSTLYCLEANFILES): Likewise.
10797 * testsuite/Makefile.in: Regenerate.
10798 * testsuite/plugin_test.c: New file.
10799 * testsuite/plugin_test_1.sh: New file.
10800 * testsuite/plugin_test_2.sh: New file.
10802 2008-09-16 Ian Lance Taylor <iant@google.com>
10804 * target-reloc.h (relocate_section): Check whether a symbol is
10805 defined by the ABI before reporting an undefined symbol error.
10806 * target.h (Target::is_defined_by_abi): Make parameter const.
10807 (Target::do_is_defined_by_abi): Likewise.
10808 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
10809 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
10810 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
10811 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
10812 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
10813 * testsuite/Makefile.in: Rebuild.
10815 * fileread.cc (make_view): Add casts to avoid warning.
10817 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
10819 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
10820 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10822 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
10824 * options.h (General_options::output_is_executable): New.
10825 (General_options::output_is_pie): New.
10826 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
10827 for shared libraries.
10828 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10830 2008-09-11 Chris Demetriou <cgd@google.com>
10832 * options.h (origin): New -z option.
10833 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
10834 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
10837 2008-09-05 Cary Coutant <ccoutant@google.com>
10839 * fileread.cc (File_read::make_view): Add check for attempt to map
10840 beyond end of file.
10842 2008-09-05 Cary Coutant <ccoutant@google.com>
10844 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
10845 explicit instantiations.
10847 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
10850 * options.cc (General_options::finalize): Allow undefined symbols
10851 in shlibs if linking -shared.
10854 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
10855 symbols as not needing a dynsym entry.
10857 2008-08-20 Craig Silverstein <csilvers@google.com>
10859 * fileread.cc (File_read::open): Do not lock the file unless it
10860 was successfully opened.
10862 2008-08-14 Cary Coutant <ccoutant@google.com>
10864 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
10865 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
10866 * testsuite/tls_test.cc (struct int128): 128-bit struct
10867 for testing TLS relocs with non-zero addend.
10868 (v12): New TLS variable.
10870 (t_last): Add check for v12.
10871 * testsuite/tls_test.h (t12): New function.
10872 * testsuite/tls_test_main.cc (thread_routine): Call new test.
10874 2008-08-13 Ian Lance Taylor <iant@google.com>
10876 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
10877 set tls_segment_ or relro_segment_.
10878 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
10880 * output.h (Output_section::clear_is_relro): New function.
10881 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
10882 sections specially even when output_data_ is empty.
10883 (Output_segment::maximum_alignment): When first section is relro,
10884 only force alignment for PT_LOAD segments.
10885 * script.cc (script_data_segment_align): New function.
10886 (script_data_segment_relro_end): New function.
10887 * script-c.h (script_data_segment_align): Declare.
10888 (script_data_segment_relro_end): Declare.
10889 * script-sections.h (class Script_sections): Declare
10890 data_segment_align and data_segment_relro_end. Add fields
10891 segment_align_index_ and saw_relro_end_.
10892 * script-sections.cc (class Sections_element): Add set_is_relro
10893 virtual function. Add new bool* parameter to place_orphan_here.
10894 Add get_output_section virtual function.
10895 (class Output_section_definition): Add set_is_relro. Add new
10896 bool* parameter to place_orphan_here. Add get_output_section.
10897 Add is_relro_ field.
10898 (Output_section_definition::Output_section_definition): Initialize
10899 evaluated_address_, evaluated_load_address, evaluated_addralign_,
10900 and is_relro_ fields.
10901 (Output_section_definition::place_orphan_here): Add is_relro
10903 (Output_section_definition::set_section_addresses): Set relro for
10905 (Output_section_definition::alternate_constraint): Likewise.
10906 (class Orphan_output_section): Add new bool* parameter to
10907 place_orphan_here. Add get_output_section.
10908 (Orphan_output_section::place_orphan_here): Add is_relro
10910 (Script_sections::Script_sections): Initialize
10911 data_segment_align_index_ and saw_relro_end_.
10912 (Script_sections::data_segment_align): New function.
10913 (Script_sections::data_segment_relro_end): New function.
10914 (Script_sections::place_orphan): Set or clear is_relro.
10915 (Script_sections::set_section_addresses): Force alignment of first
10917 * yyscript.y (exp): Call script_data_segment_align and
10918 script_data_segment_relro_end.
10919 * testsuite/relro_script_test.t: New file.
10920 * testsuite/relro_test.cc (using_script): Declare.
10921 (t1, t2): Test using_script.
10922 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
10923 (relro_script_test_SOURCES): Define.
10924 (relro_script_test_DEPENDENCIES): Define.
10925 (relro_script_test_LDFLAGS): Define.
10926 (relro_script_test_LDADD): Define.
10927 (relro_script_test.so): New target.
10928 * testsuite/Makefile.in: Rebuild.
10930 2008-08-06 Cary Coutant <ccoutant@google.com>
10932 * archive.cc (Archive::total_archives, Archive::total_members)
10933 (Archive::total_members_loaded): New variables.
10934 (Archive::setup): Add parameter. Add option to preread
10936 (Archive::read_armap): Add counter.
10937 (Archive::get_file_and_offset): New function.
10938 (Archive::get_elf_object_for_member): New function.
10939 (Archive::read_all_symbols): New function.
10940 (Archive::read_symbols): New function.
10941 (Archive::add_symbols): Add counters.
10942 (Archive::include_all_members): Use armap to find members if it's
10944 (Archive::include_member): Skip reading symbols if already read.
10945 Factored code into Archive::get_file_and_offset and
10946 Archive::get_elf_object_for_member. Changed call to
10947 Mapfile::report_include_archive_member.
10948 (Archive::print_stats): New function.
10949 * archive.h: Declare Object and Read_symbols_data classes.
10950 (Archive::Archive): Add initializers for new members.
10951 (Archive::setup): Add parameter.
10952 (Archive::print_stats): New function.
10953 (Archive::total_archives, Archive::total_members)
10954 (Archive::total_members_loaded): New variables.
10955 (Archive::get_file_and_offset): New function.
10956 (Archive::get_elf_object_for_member): New function.
10957 (Archive::read_all_symbols): New function.
10958 (Archive::read_symbols): New function.
10959 (Archive::Archive_member): New class.
10960 (Archive::members_): New member.
10961 (Archive::num_members_): New member.
10962 * main.cc: Include archive.h.
10963 (main): Call Archive::print_stats.
10964 * mapfile.cc (Mapfile::report_include_archive_member): Delete
10965 archive parameter; member_name is now the fully-decorated name.
10966 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
10967 * options.h: (General_options): Add --preread-archive-symbols option.
10968 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
10971 2008-08-04 Ian Lance Taylor <iant@google.com>
10973 * symtab.h (Symbol::use_plt_offset): New function.
10974 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
10975 * powerpc.cc (Relocate::relocate): Likewise.
10976 * sparc.cc (Relocate::relocate): Likewise.
10977 * x86_64.cc (Relocate::relocate): Likewise.
10978 * testsuite/weak_plt.sh: New test.
10979 * testsuite/weak_plt_main.cc: New test.
10980 * testsuite/weak_plt_shared.cc: New test.
10981 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
10982 (check_PROGRAMS): Add weak_plt.
10983 (check_DATA): Add weak_plt_shared.so.
10984 (weak_plt_main_pic.o, weak_plt): New targets.
10985 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
10986 * testsuite/Makefile.in: Rebuild.
10988 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
10990 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
10991 * testsuite/Makefile.in: Rebuild.
10993 2008-08-04 Alan Modra <amodra@bigpond.net.au>
10995 * Makefile.am (POTFILES.in): Set LC_ALL=C.
10996 * Makefile.in: Regenerate.
10997 * po/POTFILES.in: Regenerate.
10999 2008-07-29 Ian Lance Taylor <iant@google.com>
11001 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
11002 symbols before other symbols.
11003 * testsuite/script_test_2.cc (test_addr): Declare.
11004 (test_addr_alias): Declare.
11005 (main): Check that test_addr and test_addr_alias have the right
11007 * testsuite/script_test_2.t: Define test_addr_alias and
11010 2008-07-24 Ian Lance Taylor <iant@google.com>
11013 * descriptors.cc: New file.
11014 * descriptors.h: New file.
11015 * gold-threads.h (class Hold_optional_lock): New class.
11016 * fileread.cc: Include "descriptors.h".
11017 (File_read::~File_read): Release descriptor rather than closing
11019 (File_read::open) [file]: Call open_descriptor rather than open.
11020 Set is_descriptor_opened_.
11021 (File_read::open) [memory]: Assert that descriptor is not open.
11022 (File_read::reopen_descriptor): New function.
11023 (File_read::release): Release descriptor.
11024 (File_read::do_read): Make non-const. Reopen descriptor.
11025 (File_read::read): Make non-const.
11026 (File_read::make_view): Reopen descriptor.
11027 (File_read::do_readv): Likewise.
11028 * fileread.h (class File_read): Add is_descriptor_opened_ field.
11029 Update declarations.
11030 * layout.cc: Include "descriptors.h".
11031 (Layout::create_build_id): Use open_descriptor rather than open.
11032 * output.cc: Include "descriptors.h".
11033 (Output_file::open): Use open_descriptor rather than open.
11034 * archive.cc (Archive::const_iterator): Change Archive to be
11036 (Archive::begin, Archive::end): Make non-const.
11037 (Archive::count_members): Likewise.
11038 * archive.h (class Archive): Update declarations.
11039 * object.h (Object::read): Make non-const.
11040 * Makefile.am (CCFILES): Add descriptors.cc.
11041 (HFILES): Add descriptors.h.
11042 * Makefile.in: Rebuild.
11045 * gold.h: Always include <clocale>. Add Solaris workarounds
11046 following code in binutils/sysdep.h.
11049 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
11050 this->eh_frame_hdr_ is NULL before using it.
11052 * dynobj.cc (Versions::Versions): Update comment.
11054 * dynobj.cc (Versions::Versions): If there is an soname, use it as
11055 the base version name.
11057 * stringpool.cc (Stringpool_template::add_with_length): Set key to
11058 array size plus one.
11059 (Stringpool_template::set_string_offsets): Subtract one from key
11060 before using it as an array index.
11061 (Stringpool_template::get_offset_with_length): Likewise.
11062 (Stringpool_template::write_to_buffer): Likewise.
11063 * stringpool.h (Stringpool_template::get_offset_from_key):
11066 2008-07-23 Ian Lance Taylor <iant@google.com>
11069 * object.h (Merged_symbol_value::value): Do our best to handle a
11073 * script.cc (Version_script_info::get_versions): Don't add empty
11074 version tag to return value.
11075 (Version_script_info::get_symbol_version_helper): Change return
11076 type to bool. Add pversion parameter. Change all callers.
11077 (script_register_vers_node): Don't require a non-NULL tag.
11078 * script.h (class Version_script_info): Update declarations.
11079 (Version_script_info::get_symbol_version): Change return type to
11080 bool. Add version parameter. Change all callers.
11081 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
11082 handling. Handle an empty version from a version script.
11083 (Symbol_table::define_special_symbol): Likewise.
11084 * testsuite/ver_test_10.script: New file.
11085 * testsuite/ver_test_10.sh: New file.
11086 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
11087 (check_DATA): Add ver_test_10.syms.
11088 (ver_test_10.syms, ver_test_10.so): New target.
11089 * testsuite/Makefile.in: Rebuild.
11091 2008-07-23 Simon Baldwin <simonb@google.com>
11093 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
11094 to zero for undefined symbols from dynamic libraries.
11096 2008-07-23 Ian Lance Taylor <iant@google.com>
11098 * symtab.cc (Symbol_table::resolve): Remove version parameter.
11099 Change all callers.
11100 * symtab.h (class Symbol_table): Update declaration.
11101 * testsuite/ver_test_9.cc: New file.
11102 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
11103 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
11104 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
11105 (ver_test_9.so, ver_test_9.o): New targets.
11106 * testsuite/Makefile.in: Rebuild.
11108 2008-07-22 Ian Lance Taylor <iant@google.com>
11110 * options.h (class General_options): Define --check-sections.
11111 * layout.cc (Layout::set_segment_offsets): Handle
11114 * options.h (class General_options): Define -n/--nmagic and
11116 * options.cc (General_options::finalize): For -n/--nmagic or
11117 -N/--omagic, set -static.
11118 * layout.cc (Layout::attach_allocated_section_to_segment): If
11119 -N/--omagic, don't put read-only and read-write sections in
11120 different segments.
11121 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
11122 finding a read-only segment.
11123 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
11124 don't set the minimum segment alignment to the common page size,
11125 and don't set the file offset to the address modulo the page size.
11126 * script-sections.cc (Script_sections::create_segments): If
11127 -n/--omagic, don't put read-only and read-write sections in
11128 different segments.
11130 * cref.cc: New file.
11131 * cref.h: New file.
11132 * options.h (class General_options): Add --print-symbol-counts.
11133 * main.cc (main): Issue defined symbol report if requested.
11134 * archive.cc (Archive::interpret_header): Make into a const member
11136 (Archive::add_symbols): Call Input_objects::archive_start and
11138 (Archive::const_iterator): Define new class.
11139 (Archive::begin, Archive::end): New functions.
11140 (Archive::include_all_members): Rewrite to use iterator.
11141 (Archive::count_members): New function.
11142 * archive.h (class Archive): Update declarations.
11143 (Archive::filename): New function.
11144 * object.cc: Include "cref.h".
11145 (Sized_relobj::Sized_relobj): Initialize defined_count_.
11146 (Sized_relobj::do_get_global_symbol_counts): New function.
11147 (Input_objects::add_object): Add object to cross-referencer.
11148 (Input_objects::archive_start): New function.
11149 (Input_objects::archive_stop): New function.
11150 (Input_objects::print_symbol_counts): New function.
11151 * object.h: Declare Cref and Archive.
11152 (Object::get_global_symbol_counts): New function.
11153 (Object::do_get_global_symbol_counts): New pure virtual function.
11154 (class Sized_relobj): Add defined_count_ field. Update
11156 (class Input_objects): Add cref_ field. Update constructor.
11157 Update declarations.
11158 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
11160 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
11162 (Sized_dynobj::do_get_global_symbol_counts): New function.
11163 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
11164 defined_count_. Update declarations. Define Symbols typedef.
11165 * symtab.cc (Symbol_table::add_from_relobj): Add defined
11166 parameter. Change all callers.
11167 (Symbol_table::add_from_dynobj): Add sympointers and defined
11168 parameters. Change all callers.
11169 * symtab.h (class Symbol_table): Update declarations.
11170 * Makefile.am (CCFILES): Add cref.cc.
11171 (HFILES): Add cref.h.
11172 * Makefile.in: Rebuild.
11174 2008-07-22 Simon Baldwin <simonb@google.com>
11176 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
11177 to zero when writing undefined symbols.
11179 2008-07-22 Ian Lance Taylor <iant@google.com>
11181 * output.cc (Output_section::add_input_section): Don't try to
11182 merge empty merge sections.
11184 2008-07-21 Craig Silverstein <csilvers@google.com>
11186 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11187 Include symbol version in error message.
11189 2008-07-20 Chris Demetriou <cgd@google.com>
11191 * configure.ac (gold_cv_c_random_seed): New configured variable.
11192 (RANDOM_SEED_CFLAGS): New substituted variable.
11193 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
11194 * configure: Rebuild.
11195 * Makefile.in: Likewise.
11196 * testsuite/Makefile.in: Likewise.
11198 2008-07-18 Ian Lance Taylor <iant@google.com>
11200 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
11201 where we see NAME/NULL and NAME/VERSION as separate symbols.
11202 * testsuite/ver_test_main.cc (main): Call t4.
11203 (t4, t4_2a): Define.
11204 * testsuite/ver_test_2.cc (t4_2): Define.
11205 * testsuite/ver_test_2.script: Put t4_2a in VER2.
11206 * testsuite/ver_test_4.cc (t4_2a): Define.
11207 * testsuite/ver_test_4.script: Put t4_2a in VER2.
11208 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
11210 2008-07-17 Ian Lance Taylor <iant@google.com>
11212 * dynobj.cc (Versions::add_def): If we give an error about a
11213 missing version, go ahead and create the version anyhow.
11215 2008-07-10 Ian Lance Taylor <iant@google.com>
11217 Handle output sections with more than 0x7fffffff bytes.
11218 * object.h (class Relobj): Change map_to_output_ to
11219 output_sections_, and just keep a section pointer. Change all
11220 uses. Move comdat group support to Sized_relobj.
11221 (Relobj::is_section_specially_mapped): Remove.
11222 (Relobj::output_section): Remove poff parameter. Change all
11224 (Relobj::output_section_offset): New function.
11225 (Relobj::set_section_offset): Rewrite.
11226 (Relobj::map_to_output): Remove.
11227 (Relobj::output_sections): New function.
11228 (Relobj::do_output_section_offset): New pure virtual function.
11229 (Relobj::do_set_section_offset): Likewise.
11230 (class Sized_relobj): Add section_offsets_ field. Add comdat
11231 group support from Relobj. Update declarations.
11232 (Sized_relobj::get_output_section_offset): New function.
11233 (Sized_relobj::do_output_section_offset): New function.
11234 (Sized_relobj::do_set_section_offset): New function.
11235 * object.cc (Relobj::output_section_address): Remove.
11236 (Sized_relobj::Sized_relobj): Initialize new fields.
11237 (Sized_relobj::include_section_group): Cast find_kept_object to
11239 (Sized_relobj::include_linkonce_section): Likewise.
11240 (Sized_relobj::do_layout): Use separate arrays for output section
11242 (Sized_relobj::do_count_local_symbols): Change map_to_output to
11244 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
11245 output_sections and section_offsets.
11246 (Sized_relobj::write_local_symbols): Likewise.
11247 (map_to_kept_section): Compute output address directly.
11248 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
11249 output_sections and section_offsets.
11250 (Sized_relobj::write_sections): Likewise.
11251 (Sized_relobj::relocate_sections): Likewise.
11252 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
11253 * output.h (class Output_reloc): Update declarations. Change
11254 u2_.relobj to Sized_relobj*.
11255 (class Output_data_reloc): Change add functions to use
11257 * output.cc (Output_reloc::Output_reloc): Change relobj to
11259 (Output_reloc::local_section_offset): Change return type to
11260 Elf_Addr. Use get_output_section_offset.
11261 (Output_reloc::get_address): Likewise.
11262 (Output_section::is_input_address_mapped): Don't call
11263 is_section_specially_mapped.
11264 (Output_section::output_offset): Likewise.
11265 (Output_section::output_address): Likewise.
11266 (Output_section::starting_output_address): Likewise.
11267 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
11268 parameter to Sized_relobj*.
11269 (Copy_relocs::need_copy_reloc): Likewise.
11270 (Copy_relocs::save): Likewise.
11271 * copy-relocs.h (class Copy_relocs): Update declarations.
11272 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
11273 Sized_relobj*. Change relobj_ field to Sized_relobj*.
11274 * target-reloc.h (relocate_for_relocatable): Change
11275 offset_in_output_section type to Elf_Addr. Change code that uses
11277 * layout.cc (Layout::layout): Always set *off.
11278 * mapfile.cc (Mapfile::print_input_section): Use
11279 output_section_offset.
11280 * i386.cc (Target_i386::copy_reloc): Change object parameter to
11282 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
11283 * sparc.cc (Target_sparc::copy_reloc): Likewise.
11284 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
11286 2008-07-03 Ian Lance Taylor <iant@google.com>
11288 * layout.cc (Layout::include_section): Do not discard unrecognized
11289 SHT_STRTAB sections.
11291 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
11293 * script.cc (Lex::can_continue_name): Make '?' allowable in
11294 version-script names.
11295 * testsuite/version_script.map: Change glob pattern to use '?'
11297 2008-06-30 Manish Singh <yosh@gimp.org>
11300 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
11303 2008-06-30 Ian Lance Taylor <iant@google.com>
11307 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
11308 versions]: Don't try to read the value in the contents, since we
11309 don't use it. Use the template endianness when writing.
11311 2008-06-25 Cary Coutant <ccoutant@google.com>
11313 * fileread.cc (File_read::make_view): Assert on zero-length view.
11314 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
11315 symbol table when there are no symbols to read.
11317 2008-06-23 Craig Silverstein <csilvers@google.com>
11319 * version.cc (version_string): Bump to 1.7
11321 2008-06-18 Craig Silverstein <csilvers@google.com>
11323 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
11324 constant 0xFFFF to type Valtype.
11325 (Powerpc_relocate_functions::rel16_ha): Likewise.
11327 2008-06-17 Ian Lance Taylor <iant@google.com>
11329 * output.h (Output_section::Input_section): Initialize p2align_ to
11330 zero for Output_section_data constructors.
11331 (Output_section::Input_section::addralign): If not an input
11332 section, return the alignment of the Output_section_data.
11333 * testsuite/copy_test.cc: New file.
11334 * testsuite/copy_test_1.cc: New file.
11335 * testsuite/copy_test_2.cc: New file.
11336 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
11337 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
11338 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
11339 (copy_test_1_pic.o, copy_test_1.so): New targets.
11340 (copy_test_2_pic.o, copy_test_2.so): New targets.
11341 * testsuite/Makefile.in: Rebuild.
11343 * script-sections.cc (Script_sections::place_orphan): Initialize
11344 local variable exact.
11346 2008-06-13 David Edelsohn <edelsohn@gnu.org>
11348 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
11350 2008-06-12 David Edelsohn <edelsohn@gnu.org>
11351 David S. Miller <davem@davemloft.net>
11353 * powerpc.cc: New file.
11354 * Makefile.am (TARGETSOURCES): Add powerpc.cc
11355 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
11356 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
11357 * Makefile.in: Rebuild.
11359 2008-06-09 Ian Lance Taylor <iant@google.com>
11361 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
11363 (throwing, orig_terminate): New static variables.
11364 (terminate_handler): New static function.
11365 (t2): Set terminate handler.
11367 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
11370 * binary.cc (Binary_to_elf::sized_convert): Fix .data
11373 2008-05-30 Cary Coutant <ccoutant@google.com>
11375 * archive.cc (Archive::include_all_members) Correct to step
11376 over symbol table and extended name table in thin archives.
11378 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
11381 * target-reloc.h (relocate_for_relocatable): Fix new_offset
11384 2008-05-28 Caleb Howe <cshowe@google.com>
11386 * reduced_debug_output.cc: New file.
11387 * reduced_debug_output.h: New file.
11388 * options.h (class General_options): Add --strip-debug-non-line.
11389 * options.cc (General_options::finalize): Add strip_debug_non_line
11390 to the strip heirarchy.
11391 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
11393 * layout.cc: Include "reduced_debug_output.h".
11394 (Layout::Layout): Initialize new fields.
11395 (line_only_debug_sections): New static array.
11396 (is_lines_only_debug_sections): New static inline function.
11397 (Layout::include_section): Handle --strip-debug-non-line.
11398 (Layout::make_output_section): If --strip-debug-non-line, build
11399 new output sections for .debug_abbrev and .debug_info.
11400 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
11401 gold. Warn about possible overflow.
11402 (read_signed_LEB_128): Likewise.
11403 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
11404 (read_signed_LEB_128): Declare.
11405 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
11406 (HFILES): Add reduced_debug_output.h.
11407 * Makefile.in: Rebuild.
11409 2008-05-21 Ian Lance Taylor <iant@google.com>
11411 * mapfile.cc: New file.
11412 * mapfile.h: New file.
11413 * options.h (class General_options): Add -M/--print-map and -Map.
11414 * options.cc (General_options::finalize): Make -M equivalent to
11416 * main.cc: Include <cstdio> and "mapfile.h".
11417 (main): Open mapfile if requested.
11418 * gold.cc (class Middle_runner): Add mapfile_ field. Update
11419 constructor. Change caller.
11420 (queue_initial_tasks): Add mapfile parameter. Change caller.
11421 (queue_middle_tasks): Likewise.
11422 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
11424 * archive.cc: Include "mapfile.h".
11425 (Archive::add_symbols): Add mapfile parameter. Change all
11426 callers. Pass mapfile, symbol, and reason to include_member.
11427 (Archive::include_all_members): Add mapfile parameter. Change all
11429 (Archive::include_member): Add mapfile, sym, and why parameters.
11430 Change all callers. Report inclusion to map file.
11431 * archive.h: Include "fileread.h".
11432 (class Archive): Update declarations.
11433 (Archive::file): New const method.
11434 (class Add_archive_symbols): Add mapfile_ field. Update
11435 constructor. Change all callers.
11436 * readsyms.h (class Read_symbols): Likewise.
11437 (class Finish_group): Likewise.
11438 (class Read_script): Likewise.
11439 * common.cc: Include "mapfile.h".
11440 (Symbol_table::allocate_commons): Add mapfile parameter. Change
11442 (Symbol_table::do_allocate_commons): Likewise.
11443 (Symbol_table::do_allocate_commons_list): Likewise. Report common
11444 symbol allocation to mapfile.
11445 * common.h (class Allocate_commons_task): Add mapfile_ field.
11446 Update constructor. Change all callers.
11447 * symtab.h (class Symbol_table): Update declarations.
11448 * layout.cc: Include "mapfile.h".
11449 (Layout_task_runner::run): Print information to mapfile.
11450 (Layout::create_gold_note): Change Output_data_fixed_space to
11451 Output_data_zero_fill.
11452 (Layout::create_build_id): Likewise.
11453 (Layout::print_to_mapfile): New function.
11454 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
11455 constructor. Change caller.
11456 (class Layout): Declare print_to_mapfile.
11457 * output.cc (Output_section::Input_section::print_to_mapfile): New
11459 (Output_section::add_input_section): If producing a map, always
11460 add to input_sections_ list.
11461 (Output_section::do_print_to_mapfile): New function.
11462 (Output_segment::print_sections_to_mapfile): New function.
11463 (Output_segment::print_section_list_to_mapfile): New function.
11464 * output.h: Include "mapfile.h".
11465 (Output_data::print_to_mapfile): New function.
11466 (Output_data::do_print_to_mapfile): New virtual function.
11467 (Output_segment_headers::do_print_to_mapfile): New function.
11468 (Output_file_header::do_print_to_mapfile): New function.
11469 (Output_data_const::do_print_to_mapfile): New function.
11470 (class Output_data_const_buffer): Add map_name_ field. Update
11471 constructor. Change all callers. Add do_print_to_mapfile
11473 (class Output_data_fixed_space): Likewise.
11474 (class Output_data_space): Likewise.
11475 (class Output_data_zero_fill): New class.
11476 (Output_data_strtab::do_print_to_mapfile): New function.
11477 (Output_data_reloc_base::do_print_to_mapfile): New function.
11478 (Output_relocatable_relocs::do_print_to_mapfile): New function.
11479 (Output_data_group::do_print_to_mapfile): New function.
11480 (Output_data_got::do_print_to_mapfile): New function.
11481 (Output_data_dynamic::do_print_to_mapfile): New function.
11482 (Output_symtab_xindex::do_print_to_mapfile): New function.
11483 (class Output_section): Declare do_print_to_mapflie. Declare
11484 print_to_mapfile in Input_section.
11485 (class Output_segment): Declare new functions.
11486 * object.h (Sized_relobj::symbol_count): New function.
11487 * script-sections.cc
11488 (Output_section_element_dot_assignment::set_section_addresses):
11489 Change Output_data_fixed_space to Output_data_zero_fill.
11490 (Output_data_expression::do_print_to_mapfile): New function.
11491 * script.cc (read_input_script): Add mapfile parameter. Change
11493 * script.h (read_input_script): Update declaration.
11494 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
11495 (Eh_frame::do_print_to_mapfile): New function.
11496 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
11497 (Output_merge_string::do_print_to_mapfile): New function.
11498 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
11500 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
11502 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
11504 * Makefile.am (CCFILES): Add mapfile.cc.
11505 (HFILES): Add mapfile.h.
11506 * Makefile.in: Rebuild.
11508 2008-05-19 Ian Lance Taylor <iant@google.com>
11510 * options.h (class General_options): Add -z relro.
11511 * layout.cc (Layout::Layout): Initialize relro_segment_.
11512 (Layout::add_output_section_data): Return the output section.
11513 (Layout::make_output_section): Rcognize relro sections and mark
11514 them appropriately.
11515 (Layout::attach_allocated_section_to_segment): Put relro sections
11516 in a PT_GNU_RELRO segment.
11517 (Layout::create_initial_dynamic_sections): Mark the .dynamic
11519 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11521 (Layout::linkonce_mapping): Map d.rel.ro.local to
11522 .data.rel.ro.local.
11523 (Layout::output_section_name): Us .data.rel.ro.local for any
11524 section which begins with that.
11525 * layout.h (class Layout): Update add_output_section_data
11526 declaration. Add relro_segment_ field.
11527 * output.cc (Output_section::Output_section): Initialize is_relro_
11528 and is_relro_local_ fields.
11529 (Output_segment::add_output_section): Group relro sections.
11530 (Output_segment::is_first_section_relro): New function.
11531 (Output_segment::maximum_alignment): If there is a relro section,
11532 align the segment to the common page size.
11533 (Output_segment::set_section_addresses): Track whether we are
11534 looking at relro sections. If the last section is a relro
11535 section, align to the common page size.
11536 (Output_segment::set_section_list_addresses): Add in_relro
11537 parameter. Change all callers. Align to the page size when
11538 moving from relro to non-relro section.
11539 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
11541 * output.h (class Output_section): Add is_relro_ and
11542 is_relro_local_ fields.
11543 (Output_section::is_relro): New function.
11544 (Output_section::set_is_relro): New function.
11545 (Output_section::is_relro_local): New function.
11546 (Output_section::set_is_relro_local): New function.
11547 (class Output_segment): Update declarations.
11548 * i386.cc (Target_i386::got_section): Mark .got section as relro.
11549 * sparc.cc (Target_sparc::got_section): Likewise.
11550 * x86_64.cc (Target_x86_64::got_section): Likewise.
11551 * testsuite/relro_test_main.cc: New file.
11552 * testsuite/relro_test.cc: New file.
11553 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11554 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11555 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11556 (relro_test.so, relro_test_pic.o): New targets.
11557 * testsuite/Makefile.in: Rebuild.
11559 2008-05-16 Ian Lance Taylor <iant@google.com>
11561 * output.cc (Output_segment::add_output_section): Remove front
11563 * output.h (class Output_segment): Remove
11564 add_initial_output_section and overloaded add_output_section.
11565 Update declaration of remaining add_output_section.
11566 * layout.cc (Layout::create_interp): Call add_output_section
11567 rather than add_initial_output_section.
11568 (Layout::finish_dynamic_section): Likewise.
11570 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
11571 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
11572 know the dynamic type.
11573 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
11574 field. Initialize it in constructor.
11575 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
11576 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
11577 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
11580 * output.cc (Output_reloc::get_address): Change return type to
11582 * output.h (class Output_reloc): Update get_address declaration.
11583 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
11584 for section addresses.
11586 2008-05-09 Ian Lance Taylor <iant@google.com>
11589 * gold.cc (gold_nomem): Use return value of write.
11591 2008-05-08 Ian Lance Taylor <iant@google.com>
11593 * symtab.c (Symbol::init_base_output_data): Add version
11594 parameter. Change all callers.
11595 (Symbol::init_base_output_segment): Likewise.
11596 (Symbol::init_base_constant): Likewise.
11597 (Symbol::init_base_undefined): Likewise.
11598 (Sized_symbol::init_output_data): Likewise.
11599 (Sized_symbol::init_output_segment): Likewise.
11600 (Sized_symbol::init_constant): Likewise.
11601 (Sized_symbol::init_undefined): Likewise.
11602 (Symbol_table::do_define_in_output_data): If the new symbol has a
11603 version, mark it as the default.
11604 (Symbol_table::do_define_in_output_segment): Likewise.
11605 (Symbol_table::do_define_as_constant): Likewise.
11606 * symtab.h (class Symbol): Update declarations.
11607 (class Sized_symbol): Likewise.
11608 * resolve.cc (Symbol::override_version): New function.
11609 (Symbol::override_base): Call override_version.
11610 (Symbol::override_base_with_special): Likewise.
11611 * testsuite/ver_script_8.script: New file.
11612 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
11613 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
11614 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
11615 (ver_test_8_1.so, ver_test_8_2.so): New targets.
11617 2008-05-06 Ian Lance Taylor <iant@google.com>
11620 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
11622 (class General_options): Remove existing --undefined, and add
11623 --no-undefined instead. Add new --undefined as synonym for -u.
11624 * archive.cc (Archive::add_symbols): Check whether symbol was
11626 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
11627 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
11628 all uses. Add IS_UNDEFINED. Update declarations to split
11629 different versions of init_base. Declare init_base_undefined.
11630 (Symbol::is_defined): Handle IS_UNDEFINED.
11631 (Symbol::is_undefined): Likewise.
11632 (Symbol::is_weak_undefined): Call is_undefined.
11633 (Symbol::is_absolute): Handle IS_CONSTANT.
11634 (class Sized_symbol): Update declarations to split different
11635 versions of init. Declare init_undefined.
11636 (class Symbol_table): Declare new functions.
11637 * symtab.cc (Symbol::init_base_object): Rename from init_base.
11638 Change all callers.
11639 (Symbol::init_base_output_data): Likewise.
11640 (Symbol::init_base_output_segment): Likewise.
11641 (Symbol::init_base_constant): Likewise.
11642 (Symbol::init_base_undefined): New function.
11643 (Sized_symbol::init_object): Rename from init. Change all
11645 (Sized_symbol::init_output_data): Likewise.
11646 (Sized_symbol::init_output_segment): Likewise.
11647 (Sized_symbol::init_constant): Likewise.
11648 (Sized_symbol::init_undefined): New function.
11649 (Symbol_table::add_undefined_symbols_from_command_line): New
11651 (Symbol_table::do_add_undefined_symbols_from_command_line): New
11653 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
11654 (Symbol::output_section): Likewise.
11655 (Symbol::set_output_section): Likewise.
11656 (Symbol_table::sized_finalize_symbol): Likewise.
11657 (Symbol_table::sized_write_globals): Likewise.
11658 * resolve.cc (Symbol_table::should_override): Likewise.
11659 (Symbol::override_base_with_special): Likewise.
11661 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
11662 symbol, change it to have default visibility.
11663 * testsuite/protected_1.cc: New file.
11664 * testsuite/protected_2.cc: New file.
11665 * testsuite/protected_3.cc: New file.
11666 * testsuite/protected_main_1.cc: New file.
11667 * testsuite/protected_main_2.cc: New file.
11668 * testsuite/protected_main_3.cc: New file.
11669 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
11670 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
11671 (protected_1_LDFLAGS, protected_1_LDADD): Define.
11672 (protected_1.so): New target.
11673 (protected_1_pic.o, protected_2_pic.o): New targets.
11674 (protected_3_pic.o): New target.
11675 (check_PROGRAMS): Add protected_2.
11676 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
11677 (protected_2_LDFLAGS, protected_2_LDADD): Define.
11678 * testsuite/Makefile.in: Rebuild.
11680 * options.h (DEFINE_var): Add set_user_set_##varname__.
11681 (DEFINE_bool_alias): New macro.
11682 (class General_options): Define -Bstatic using DEFINE_bool_alias
11683 rather than DEFINE_special. Add --undefined as an alias for -z
11685 * options.cc (General_options::parse_Bstatic): Remove.
11687 * options.h (class General_options): Add --fatal-warnings.
11688 * main.cc (main): Implement --fatal-warnings.
11689 * errors.h (Errors::warning_count): New function.
11691 * options.h (class General_options): Add -Bsymbolic-functions.
11692 * symtab.h (Symbol::is_preemptible): Check for
11693 -Bsymbolic-functions.
11695 2008-05-05 Ian Lance Taylor <iant@google.com>
11697 * options.h (DEFINE_bool): For DASH_Z, create the negative option
11698 as noVARNAME rather than no-VARNAME.
11699 (class General_options): Add option -z combreloc.
11700 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
11702 (Output_reloc::sort_before) [SHT_REL]: New function.
11703 (Output_reloc::sort_before) [SHT_RELA]: New function.
11704 (class Output_data_reloc_base): Add sort_relocs_ field. Define
11705 Sort_relocs_comparison.
11706 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
11707 parameter. Change all callers.
11708 (Output_data_reloc::Output_data_reloc) [both versions]: Add
11709 sort_relocs parameter. Change all callers.
11710 * output.cc (Output_reloc::get_address): New function, broken out
11712 (Output_reloc::write_rel): Call it.
11713 (Output_reloc::compare): New function.
11714 (Output_data_reloc_base::do_write): Optionally sort relocs.
11716 * configure.ac: If targ_extra_obj is set, link it in.
11717 * configure.tgt: Initialize all variables.
11718 (x86_64*): Set targ_extra_obj and targ_extra_size.
11719 * configure: Rebuild.
11721 * object.cc (Sized_relobj::include_section_group): Adjust section
11722 indexes read from group data. Build vector to pass to
11724 * layout.cc (Layout::layout_group): Add flags and shndxes
11725 parameters. Remove contents parameter. Change caller. Update
11726 explicit instantiations.
11727 * layout.h (class Layout): Update layout_group declaration.
11728 * output.cc (Output_data_group::Output_data_group): Add flags and
11729 input_shndxes parameters. Remove contents parameter. Change
11731 (Output_data_group::do_write): Change input_sections_ to
11733 * output.h (class Output_data_group): Update constructor
11734 declaration. Rename input_sections_ to input_shndxes_.
11735 * testsuite/many_sections_test.cc: Add template.
11737 2008-04-30 Cary Coutant <ccoutant@google.com>
11739 * target-reloc.h (relocate_section): Fix dead-pointer bug.
11741 * layout.cc (Layout::include_section): Refactored check for debug
11743 (Layout::add_comdat): Add new parameters. Change type
11744 of signature parameter. Add object and shndx to signatures table.
11745 (Layout::find_kept_object): New function.
11746 * layout.h: Include <cstring>.
11747 (Layout::is_debug_info_section): New function.
11748 (Layout::add_comdat): Add new parameters.
11749 (Layout::find_kept_object): New function.
11750 (Layout::Kept_section): New struct.
11751 (Layout::Signatures): Change type of map range.
11752 * object.cc (Relobj::output_section_address): New function.
11753 (Sized_relobj::include_section_group): Add new parameters. Change
11754 calls to Layout::add_comdat. Change to build table of kept comdat
11755 groups and table mapping discarded sections to kept sections.
11756 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
11757 (Sized_relobj::do_layout): Change calls to include_section_group and
11758 include_linkonce_section.
11759 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
11760 value to zero when section is discarded.
11761 (Sized_relobj::map_to_kept_section): New function.
11762 * object.h (Relobj::output_section_address): New function.
11763 (Relobj::Comdat_group): New type.
11764 (Relobj::find_comdat_group): New function.
11765 (Relobj::Comdat_group_table): New type.
11766 (Relobj::Kept_comdat_section): New type.
11767 (Relobj::Kept_comdat_section_table): New type.
11768 (Relobj::add_comdat_group): New function.
11769 (Relobj::set_kept_comdat_section): New function.
11770 (Relobj::get_kept_comdat_section): New function.
11771 (Relobj::comdat_groups_): New field.
11772 (Relobj::kept_comdat_sections_): New field.
11773 (Symbol_value::input_value): Update comment.
11774 (Sized_relobj::map_to_kept_section) New function.
11775 (Sized_relobj::include_linkonce_section): Add new parameter.
11776 * target-reloc.h (Comdat_behavior): New type.
11777 (get_comdat_behavior): New function.
11778 (relocate_section): Add code to map a discarded section to the
11779 corresponding kept section when applying a relocation.
11781 2008-04-30 Craig Silverstein <csilvers@google.com>
11783 * dwarf_reader.cc (next_generation_count): New static var.
11784 (Addr2line_cache_entry): New struct.
11785 (addr2line_cache): New static var.
11786 (Dwarf_line_info::one_addr2line): Added caching.
11787 (Dwarf_line_info::clear_addr2line_cache): New function.
11788 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
11789 cache-size parameter.
11790 (Dwarf_line_info::one_addr2line_cache): New function.
11791 * symtab.cc (Symbol_table::detect_odr_violations): Pass
11792 new cache-size argument to one_addr2line(), and clear cache.
11794 2008-04-28 Cary Coutant <ccoutant@google.com>
11796 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
11797 R_386_PC8 relocations.
11799 2008-04-23 Ian Lance Taylor <iant@google.com>
11801 * object.cc (Sized_relobj::include_section_group): Check for
11802 invalid section group.
11804 * object.cc (make_elf_object): Correct test for 64-bit ELF file
11807 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
11808 than read for file header.
11809 * archive.cc (Archive::include_member): Likewise.
11811 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
11813 * aclocal.m4: Regenerate.
11814 * configure: Regenerate.
11816 2008-04-19 Ian Lance Taylor <iant@google.com>
11818 * version.cc (version_string): Bump to 1.6.
11820 * testsuite/Makefile.am (many_sections_r_test): New target.
11821 (many_sections_r_test_SOURCES): Remove.
11822 (many_sections_r_test_DEPENDENCIES): Remove.
11823 (many_sections_r_test_LDFLAGS): Remove.
11824 (many_sections_r_test_LDADD): Remove.
11826 * object.cc (Sized_relobj::do_add_symbols): Always pass
11827 local_symbol_count_ to add_from_relobj.
11829 * testsuite/Makefile.am (many_sections_check.h): Only check one in
11830 every thousand variables.
11831 * testsuite/Makefile.in: Rebuild.
11833 * object.cc (Xindex::initialize_symtab_xindex): New function.
11834 (Xindex::read_symtab_xindex): New function.
11835 (Xindex::sym_xindex_to_shndx): New function.
11836 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
11838 (Sized_relobj::do_initialize_xindex): New function.
11839 (Sized_relobj::do_read_symbols): Adjust section links.
11840 (Sized_relobj::symbol_section_and_value): Add is_ordinary
11841 parameter. Change all callers.
11842 (Sized_relobj::include_section_group): Adjust section links and
11843 symbol section indexes.
11844 (Sized_relobj::do_layout): Adjust section links.
11845 (Sized_relobj::do_count_local_symbols): Adjust section links and
11846 symbol section indexes.
11847 (Sized_relobj::do_finalize_local_symbols): Distinguish between
11848 ordinary and special symbols.
11849 (Sized_relobj::write_local_symbols): Add symtab_xindex and
11850 dynsym_xindex parameters. Change all callers. Adjust section
11851 links. Use SHN_XINDEX when needed.
11852 (Sized_relobj::get_symbol_location_info): Adjust section links.
11853 Don't get fooled by special symbols.
11854 * object.h (class Xindex): Define.
11855 (class Object): Add xindex_ parameter. Declare virtual functoin
11856 do_initialize_xindex.
11857 (Object::adjust_sym_shndx): New function.
11858 (Object::set_xindex): New protected function.
11859 (class Symbol_value): Add is_ordinary_shndx_ field.
11860 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
11861 (Symbol_value::value): Assert ordinary section.
11862 (Symbol_value::initialize_input_to_output_map): Likewise.
11863 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
11864 Change all callers.
11865 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
11867 (class Sized_relobj): Update declarations.
11868 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
11869 parameter. Change all callers.
11870 (Sized_relobj::adjust_shndx): New function.
11871 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
11873 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
11874 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
11875 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
11876 (Sized_dynobj::read_dynsym_section): Adjust section links.
11877 (Sized_dynobj::read_dynamic): Likewise.
11878 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
11880 (Sized_dynobj::do_initialize_xindex): New function.
11881 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
11882 do_initialize_xindex.
11883 (Sized_dynobj::adjust_shndx): New function.
11884 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
11885 dynsym_xindex_ fields.
11886 (Layout::finalize): Add a call to set_section_indexes before
11887 creating the symtab sections.
11888 (Layout::set_section_indexes): Don't do anything if the section
11889 already has a section index.
11890 (Layout::create_symtab_sections): Add shnum parameter. Change
11891 caller. Create .symtab_shndx section if needed.
11892 (Layout::create_shdrs): Add shstrtab_section parameter. Change
11894 (Layout::allocated_output_section_count): New function.
11895 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
11897 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
11898 fields. Update declarations.
11899 (Layout::symtab_xindex): New function.
11900 (Layout::dynsym_xindex): New function.
11901 (class Write_symbols_task): Add layout_ field.
11902 (Write_symbols_task::Write_symbols_task): Add layout parameter.
11904 * output.cc (Output_section_headers::Output_section_headers): Add
11905 shstrtab_section parameter. Change all callers.
11906 (Output_section_headers::do_sized_write): Store overflow values
11907 for section count and section string table section index in
11908 section header zero.
11909 (Output_file_header::do_sized_write): Check for overflow of
11910 section count and section string table section index.
11911 (Output_symtab_xindex::do_write): New function.
11912 (Output_symtab_xindex::endian_do_write): New function.
11913 * output.h (class Output_section_headers): Add shstrtab_section_.
11914 Update declarations.
11915 (class Output_symtab_xindex): Define.
11916 (Output_section::has_out_shndx): New function.
11917 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
11919 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
11920 Change all callers.
11921 (Sized_symbol::init): Likewise.
11922 (Symbol::output_section): Check for ordinary symbol.
11923 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
11924 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
11926 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
11927 Change all callers. Simplify handling of symbols from sections
11928 not included in the link.
11929 (Symbol_table::add_from_dynobj): Handle ordinary symbol
11931 (Weak_alias_sorter::operator()): Assert that symbols are
11933 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
11935 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
11936 parameters. Change all callers.
11937 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
11938 symbol distinction. Use SHN_XINDEX when needed.
11939 (Symbol_table::write_section_symbol): Add symtab_xindex
11940 parameter. Change all callers.
11941 (Symbol_table::sized_write_section_symbol): Likewise. Use
11942 SHN_XINDEX when needed.
11943 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
11945 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
11946 (Symbol::is_defined): Check is_ordinary.
11947 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
11948 (Symbol::is_absolute, Symbol::is_common): Likewise.
11949 (class Sized_symbol): Update declarations.
11950 (class Symbol_table): Update declarations.
11951 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
11952 parameters. Change all callers.
11953 (Sized_symbol::override): Likewise.
11954 (Symbol_table::override): Likewise.
11955 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
11956 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
11957 is_ordinary, and orig_st_shndx parameters. Change all callers.
11958 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
11959 to be in an ordinary section.
11960 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
11961 object and is_ordinary parameters. Change all callers.
11962 (Sized_dwarf_line_info::read_relocs): Add object parameter.
11963 Change all callers. Don't add undefined or non-ordinary symbols
11965 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
11966 Change all callers.
11967 * dwarf_reader.h (class Sized_dwarf_line_info): Update
11969 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
11970 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
11971 (Sized_relobj::relocate_sections): Likewise.
11972 * target-reloc.h (scan_relocs): Adjust section symbol index.
11973 (scan_relocatable_relocs): Likewise.
11974 * i386.cc (Scan::local): Check for ordinary symbols.
11975 * sparc.cc (Scan::local): Likewise.
11976 * x86_64.cc (Scan::local): Likewise.
11977 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
11978 to symbol_section_and_value.
11979 * testsuite/many_sections_test.cc: New file.
11980 * testsuite/Makefile.am (BUILT_SOURCES): Define.
11981 (check_PROGRAMS): Add many_sections_test.
11982 (many_sections_test_SOURCES): Define.
11983 (many_sections_test_DEPENDENCIES): Define.
11984 (many_sections_test_LDFLAGS): Define.
11985 (BUILT_SOURCES): Add many_sections_define.h.
11986 (many_sections_define.h): New target.
11987 (BUILT_SOURCES): Add many_sections_check.h.
11988 (many_sections_check.h): New target.
11989 (check_PROGRAMS): Add many_sections_r_test.
11990 (many_sections_r_test_SOURCES): Define.
11991 (many_sections_r_test_DEPENDENCIES): Define.
11992 (many_sections_r_test_LDFLAGS): Define.
11993 (many_sections_r_test_LDADD): Define.
11994 (many_sections_r_test.o): New target.
11995 * testsuite/Makefile.in: Rebuild.
11997 2008-04-17 Cary Coutant <ccoutant@google.com>
11999 * errors.cc (Errors::info): New function.
12000 (gold_info): New function.
12001 * errors.h (Errors::info): New function.
12002 * gold.h (gold_info): New function.
12003 * object.cc (Input_objects::add_object): Print trace output.
12004 * options.cc (options::parse_set): New function.
12005 (General_options::parse_wrap): Deleted.
12006 (General_options::General_options): Deleted initializer.
12007 * options.h (options::String_set): New typedef.
12008 (options::parse_set): New function.
12009 (DEFINE_set): New macro.
12010 (General_options::wrap): Changed to use DEFINE_set. Changed
12011 callers of any_wrap_symbols and is_wrap_symbol.
12012 (General_options::trace, General_options::trace_symbol):
12014 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
12015 (General_options::wrap_symbols_): Deleted.
12016 * symtab.cc (Symbol_table::add_from_object): Print trace output.
12018 2008-04-17 David S. Miller <davem@davemloft.net>
12020 * options.cc (General_options::parse_V): New function.
12021 * options.h: Add entries for -V and -Qy.
12023 2008-04-17 Ian Lance Taylor <iant@google.com>
12025 * common.cc (Symbol_table::allocate_commons): Remove options
12026 parameter. Change caller.
12027 (Symbol_table::do_allocate_commons): Remove options parameter.
12028 Change caller. Just call do_allocate_commons_list twice.
12029 (Symbol_table::do_allocate_commons_list): New function, broken out
12030 of do_allocate_commons.
12031 * common.h (class Allocate_commons_task): Remove options_ field.
12032 Update constructor.
12033 * symtab.cc (Symbol_table::Symbol_table): Initialize
12035 (Symbol_table::add_from_object): Put TLS common symbols on
12037 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
12038 which are IN_OUTPUT_DATA.
12039 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
12040 allocate_commons and do_allocate_commons declarations. Declare
12041 do_allocate_commons_list.
12042 * gold.cc (queue_middle_tasks): Update creation of
12043 Allocate_commons_task to not pass options.
12044 * testsuite/Makefile.am (INCLUDES): Add -I.. .
12045 (TLS_TEST_C_FLAGS): New variable.
12046 (tls_test_c_pic.o): New target.
12047 (tls_test_shared.so): Link in tls_test_c_pic.o.
12048 (tls_test_c_pic_ie.o): New target.
12049 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
12050 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
12051 (tls_test_c.o): New target.
12052 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
12053 (tls_pic_test_LDADD): Likewise.
12054 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
12055 (tls_shared_gd_to_ie_test_LDADD): Likewise.
12056 (tls_test_c_gnu2.o): New target.
12057 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
12059 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
12060 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
12061 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
12062 * testsuite/tls_test.cc: Include "config.h".
12063 (t_last): Call t11_last.
12064 * testsuite/tls_test.h (t11, t11_last): Declare.
12065 * testsuite/tls_test_c.c: New file.
12066 * testsuite/tls_test_main.cc (thread_routine): Call t11.
12067 * configure.ac: Check for OpenMP support.
12068 * configure, config.in, Makefile.in: Rebuild.
12069 * testsuite/Makefile.in: Rebuild.
12071 2008-04-16 Cary Coutant <ccoutant@google.com>
12073 * i386.cc (Target_i386::define_tls_base_symbol): New function.
12074 (Target_i386::tls_base_symbol_defined_): New field.
12075 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12076 (Target_i386::Scan::global): Likewise.
12077 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
12078 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
12079 (Target_x86_64::tls_base_symbol_defined_): New field.
12080 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12081 (Target_x86_64::Scan::global): Likewise.
12083 2008-04-16 Cary Coutant <ccoutant@google.com>
12085 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
12086 (Symbol::needs_plt_entry): Allow weak undefined symbols.
12087 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
12088 building shared libraries.
12089 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
12090 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
12091 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
12092 * testsuite/Makefile.in: Rebuild.
12093 * testsuite/weak_undef.h: New file.
12094 * testsuite/weak_undef_file1.cc: Add extra test cases.
12095 * testsuite/weak_undef_file2.cc: Likewise.
12096 * testsuite/weak_undef_test.cc: Likewise.
12098 2008-04-16 David S. Miller <davem@davemloft.net>
12100 * sparc.cc (Target_sparc::Scan): Change from struct to class.
12101 Add issued_non_pic_error_ field. Declare check_non_pic.
12102 (Target_sparc::Scan::check_non_pic): New function.
12103 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
12104 (Target_sparc::Scan::global): Likewise.
12106 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
12107 * configure: Rebuild.
12109 * options.h (DEFINE_enable): New macro.
12110 (new_dtags): New enable option.
12111 (initfirst, interpose, loadfltr, nodefaultlib,
12112 nodelete, nodlopen, nodump): New -z options.
12113 * layout.cc (Layout:finish_dynamic_section): If new
12114 dtags enabled, emit DT_RUNPATH. Also, emit a
12115 DT_FLAGS_1 containing any specified -z flags.
12117 2008-04-16 Ian Lance Taylor <iant@google.com>
12119 * copy-relocs.cc: New file.
12120 * copy-relocs.h: New file.
12121 * reloc.cc: Remove Copy_relocs code.
12122 * reloc.h: Likewise.
12123 * reloc-types.h (struct Reloc_types) [both versions]: Add
12124 get_reloc_addend_noerror.
12125 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
12126 variants of add_global which take an addend which must be zero.
12127 * i386.cc: Include "copy-relocs.h".
12128 (class Target_i386): Change type of copy_relocs_ to variable,
12129 update initializer.
12130 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
12131 Change all callers.
12132 (Target_i386::do_finalize_sections): Change handling of
12134 * sparc.cc: Include "copy-relocs.h".
12135 (class Target_sparc): Change type of copy_relocs_ to variable,
12136 update initializer.
12137 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
12138 Change all callers.
12139 (Target_sparc::do_finalize_sections): Change handling of
12141 * x86_64.cc: Include "copy-relocs.h".
12142 (class Target_x86_64): Change type of copy_relocs_ to variable,
12143 update initializer.
12144 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
12145 class. Change all callers.
12146 (Target_x86_64::do_finalize_sections): Change handling of
12148 * Makefile.am (CCFILES): Add copy-relocs.cc.
12149 (HFILES): Add copy-relocs.h.
12151 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
12153 * testsuite/script_test_4.sh: Permit leading zeroes.
12155 2008-04-15 Ian Lance Taylor <iant@google.com>
12157 * script-sections.cc (Script_sections::create_segments): Use
12158 header_size_adjustment even when there is enough room for the
12160 * testsuite/script_test_4.sh: New file.
12161 * testsuite/script_test_4.t: New file.
12162 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
12163 (check_DATA): Add script_test_4.stdout.
12164 (MOSTLYCLEANFILES): Likewise.
12165 (script_test_4): New target.
12166 (script_test_4.stdout): New target.
12167 * testsuite/Makefile.in: Rebuild.
12169 * sparc.cc: Add definitions for Output_data_plt_sparc class
12172 2008-04-14 David S. Miller <davem@davemloft.net>
12174 * sparc.cc: New file.
12175 * Makefile.am (TARGETSOURCES): Add sparc.cc
12176 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
12177 * configure.tgt: Document targ_extra_size and
12178 targ_extra_big_endian. Add entries for sparc-* and
12180 * configure.ac: Handle targ_extra_size and
12181 targ_extra_big_endian.
12182 * Makefile.in: Rebuild.
12183 * configure: Likewise.
12184 * po/POTFILES.in: Likewise.
12185 * po/gold.pot: Likewise.
12187 2008-04-14 Ian Lance Taylor <iant@google.com>
12189 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
12190 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
12191 in the name/type/flags to section mapping. Don't call
12192 allocate_output_section.
12193 (Layout::choose_output_section): Change parameter from adjust_name
12194 to is_input_section. Don't permit input sections after sections
12195 are attached to segments. Don't call allocate_output_section.
12196 (Layout::layout_eh_frame): Call update_flags_for_input_section,
12197 not write_enable_output_section.
12198 (Layout::make_output_section): Don't push to
12199 unattached_section_list_ nor call attach_to_segment. Call
12200 attach_section_to_segment if sections are attached.
12201 (Layout::attach_sections_to_segments): New function.
12202 (Layout::attach_section_to_segment): New function.
12203 (Layout::attach_allocated_section_to_segment): Rename from
12204 attach_to_segment. Remove flags parameter.
12205 (Layout::allocate_output_section): Remove function.
12206 (Layout::write_enable_output_section): Remove function.
12207 * layout.h (class Layout): Update for above changes. Add new
12208 field sections_are_attached_.
12209 * output.h (Output_section::update_flags_for_input_section): New
12211 * output.cc (Output_section::add_input_section): Call
12212 update_flags_for_input_section.
12213 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
12215 2008-04-11 Cary Coutant <ccoutant@google.com>
12217 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
12218 thought unnecessary.
12219 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
12221 2008-04-11 Ian Lance Taylor <iant@google.com>
12223 * output.h (class Output_section_data): Remove inline definition
12225 * output.cc (Output_section_data::set_addralign): New function.
12227 2008-04-11 Cary Coutant <ccoutant@google.com>
12229 Add support for TLS descriptors for i386 and x86_64.
12230 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
12231 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
12232 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
12234 (Target_i386::got_mod_index_entry): Remove unnecessary code.
12235 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
12236 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
12238 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
12239 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
12240 Fix problem with initial-exec relocations.
12241 (Target_i386::Relocate::relocate_tls): Likewise.
12242 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
12244 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
12245 support for section-plus-offset dynamic table entries.
12246 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
12247 (Output_data_dynamic::Dynamic_entry): Add support for
12248 section-plus-offset dynamic table entries.
12249 (Output_data_dynamic::Classification): Likewise.
12250 (Output_data_dynamic::classification_): Renamed offset_.
12251 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
12252 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
12253 (Target_x86_64::make_plt_section): New function.
12254 (Target_x86_64::reserve_tlsdesc_entries): New function.
12255 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
12256 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
12257 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
12258 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
12259 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
12260 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
12261 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
12262 add extra PLT entry for TLS descriptors.
12263 (Output_data_plt_x86_64::got_): New field.
12264 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
12265 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
12267 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
12269 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
12270 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
12271 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
12272 R_386_TLS_DESC_CALL relocations.
12273 (Target_x86_64::Scan::global): Likewise.
12274 (Target_x86_64::do_finalize_sections): Add dynamic table entries
12275 for TLS descriptors.
12276 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
12277 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
12278 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
12279 GD-to-IE relaxation.
12280 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
12281 and TLS_DESCRIPTORS.
12282 * Makefile.in: Rebuild.
12283 * configure: Rebuild.
12284 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
12285 (tls_test_shared2.so): New target.
12286 (tls_shared_gd_to_ie_test_SOURCES): New variable.
12287 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
12288 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
12289 (tls_shared_gd_to_ie_test_LDADD): New variable.
12290 (tls_shared_gnu2_gd_to_ie_test): New target.
12291 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
12293 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
12294 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
12295 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
12296 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
12297 (tls_shared_gnu2_test): New target.
12298 (tls_test_gnu2_shared.so): New target.
12299 (tls_shared_gnu2_test_SOURCES): New variable.
12300 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
12301 (tls_shared_gnu2_test_LDFLAGS): New variable.
12302 (tls_shared_gnu2_test_LDADD): New variable.
12303 * testsuite/Makefile.in: Rebuild.
12304 * testsuite/Makefile.
12306 2008-04-11 Ian Lance Taylor <iant@google.com>
12308 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
12310 * testsuite/Makefile.in: Rebuild.
12312 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
12314 * testsuite/script_test_2.cc (main): Adjust test.
12316 2008-04-11 David S. Miller <davem@davemloft.net>
12317 Ian Lance Taylor <iant@google.com>
12319 * options.h (General_options): Add entries for '-Y' and
12321 * options.cc (General_options:finalize): If -Y was used, add those
12322 entries to the library path instead of the default "/lib" and
12325 2008-04-11 David S. Miller <davem@davemloft.net>
12327 * testsuite/justsyms.t: Start at 0x100.
12328 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
12329 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
12331 * testsuite/script_test_2.cc: Adjust string and section length
12334 2008-04-09 Ian Lance Taylor <iant@google.com>
12337 * script-sections.cc (Sections_element::allocate_to_segment): Add
12339 (Output_section_definition::allocate_to_segment): Likewise.
12340 (Orphan_output_section::allocate_to_segment): Likewise.
12341 (Script_sections::attach_sections_using_phdrs_clause): Don't
12342 propagate non-PT_LOAD segments to orphan sections.
12343 * testsuite/Makefile.am (script_test_3.stdout): Generate using
12344 readelf rather than objdump.
12345 * testsuite/script_test_3.sh: Adjust accordingly. Test that
12346 .interp section and PT_INTERP segment are the same size.
12347 * testsuite/Makefile.in: Rebuild.
12349 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
12350 aliases for symbols defined in the same object.
12351 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
12352 (weak_alias_test_SOURCES): New variable.
12353 (weak_alias_test_DEPENDENCIES): New variable.
12354 (weak_alias_test_LDFLAGS): New variable.
12355 (weak_alias_test_LDADD): New variable.
12356 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
12357 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
12358 (weak_alias_test_3.o): New target.
12359 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
12360 * testsuite/weak_alias_test_main.cc: New file.
12361 * testsuite/weak_alias_test_1.cc: New file.
12362 * testsuite/weak_alias_test_2.cc: New file.
12363 * testsuite/weak_alias_test_3.cc: New file.
12365 2008-04-08 Ian Lance Taylor <iant@google.com>
12367 * options.h (class General_options): Add --noinhibit-exec option.
12368 * main.cc (main): Check --noinhibit-exec.
12370 * options.h (class General_options): Define --wrap as a special
12371 option. Add wrap_symbols_ field.
12372 (General_options::any_wrap_symbols): New function.
12373 (General_options::is_wrap_symbol): New function.
12374 * options.cc (General_options::parse_wrap): New function.
12375 (General_options::General_options): Initialize wrap_symbols_.
12376 * symtab.cc (Symbol_table::wrap_symbol): New function.
12377 (Symbol_table::add_from_object): Handle --wrap.
12378 * symtab.h (class Symbol_table): Declare wrap_symbol.
12379 * target.h (Target::wrap_char): New function.
12380 (Target::Target_info): Add wrap_char field.
12381 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
12382 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12383 * testsuite/testfile.cc (Target_test::test_target_info):
12386 * errors.cc (Errors::undefined_symbol): Mention symbol version if
12389 * layout.h (class Layout): Add added_eh_frame_data_ field.
12390 * layout.cc (Layout::Layout): Initialize new field.
12391 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
12392 output section until we find a section we merged successfully.
12393 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
12394 that the size be non-zero.
12396 * merge.cc (Object_merge_map::get_output_offset): Remove inline
12399 2008-04-08 Craig Silverstein <csilvers@google.com>
12401 * configure.ac: Export new conditional variable HAVE_ZLIB.
12402 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
12404 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
12405 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12407 2008-04-07 Ian Lance Taylor <iant@google.com>
12409 * version.cc (version_string): Set to "1.5".
12411 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
12412 Add issued_non_pic_error_ field. Declare check_non_pic.
12413 (Target_x86_64::Scan::check_non_pic): New function.
12414 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
12415 (Target_x86_64::Scan::global): Likewise.
12417 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
12418 addend parameter. Change caller. Handle merge sections.
12419 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
12420 Address to Addend. Don't add in the result of
12421 local_section_offset, pass down the addend and use the returned
12423 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
12424 Update declarations of local_section_offset and symbol_value.
12425 * testsuite/two_file_test_1.cc (t18): New function.
12426 * testsuite/two_file_test_2.cc (f18): New function.
12427 * testsuite/two_file_test_main.cc (main): Call t18.
12428 * testsuite/two_file_test.h (t18, f18): Declare.
12430 * configure.ac: Don't test for objdump, c++filt, or readelf.
12431 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
12433 (TEST_READELF): New variable.
12434 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
12435 (check_PROGRAMS): Add two_file_strip_test.
12436 (two_file_strip_test): New target.
12437 (check_PROGRAMS): Add two_file_same_shared_strip_test.
12438 (two_file_same_shared_strip_test_SOURCES): New variable.
12439 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
12440 (two_file_same_shared_strip_test_LDFLAGS): New variable.
12441 (two_file_same_shared_strip_test_LDADD): New variable.
12442 (two_file_shared_strip.so): New target.
12443 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
12444 (ver_test_5.syms, ver_test_7.syms): Likewise.
12445 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
12446 (strip_test_3.stdout): Use TEST_OBJDUMP.
12447 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12449 2008-04-04 Cary Coutant <ccoutant@google.com>
12451 * symtab.h (Symbol::is_weak_undefined): New function.
12452 (Symbol::is_strong_undefined): New function.
12453 (Symbol::is_absolute): New function.
12454 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
12455 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
12457 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
12458 (weak_undef_test): New target.
12459 * testsuite/Makefile.in: Rebuild.
12460 * testsuite/weak_undef_file1.cc: New file.
12461 * testsuite/weak_undef_file2.cc: New file.
12462 * testsuite/weak_undef_test.cc: New file.
12464 2008-04-03 Craig Silverstein <csilvers@google.com>
12466 * compressed_output.h (class Output_compressed_section): Use
12468 * compressed_output.cc (zlib_compress): Use unsigned buffers,
12470 (zlib_compressed_suffix): Removed.
12471 (Output_compressed_section::set_final_data_size): Use unsigned
12473 * testsuite/Makefile.am (flagstest_compress_debug_sections):
12474 Fix linker invocation.
12475 (flagstest_o_specialfile_and_compress_debug_sections):
12477 * testsuite/Makefile.in: Regenerated.
12479 2008-04-02 David S. Miller <davem@davemloft.net>
12481 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
12482 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
12484 2008-04-02 Craig Silverstein <csilvers@google.com>
12488 2008-04-02 Ian Lance Taylor <iant@google.com>
12490 * fileread.cc (File_read::find_view): Add byteshift and vshifted
12491 parameters. Update for new key type to views_. Change all
12493 (File_read::read): Adjust for byteshift in returned view.
12494 (File_read::add_view): New function, broken out of
12495 find_and_make_view.
12496 (File_read::make_view): New function, broken out of
12497 find_and_make_view.
12498 (File_read::find_or_make_view): Add offset and aligned
12499 parameters. Rewrite accordingly. Change all callers.
12500 (File_read::get_view): Add offset and aligned parameters. Adjust
12501 for byteshift in return value.
12502 (File_read::get_lasting_view): Likewise.
12503 * fileread.h (class File_read): Update declarations.
12504 (class File_read::View): Add byteshift_ field. Add byteshift to
12505 constructor. Add byteshift method.
12506 * archive.h (Archive::clear_uncached_views): New function.
12507 (Archive::get_view): Add aligned parameter. Change all callers.
12508 * object.h (Object::get_view): Add aligned parameter. Change all
12510 (Object::get_lasting_view): Likewise.
12512 * fileread.cc (File_read::release): Don't call clear_views if
12513 there are multiple objects.
12514 * fileread.h (File_read::clear_uncached_views): New function.
12515 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
12518 2008-03-31 Cary Coutant <ccoutant@google.com>
12520 Add thin archive support.
12521 * archive.cc (Archive::armagt): New const.
12522 (Archive::setup): Remove task parameter and calls to unlock.
12523 (Archive::unlock_nested_archives): New function.
12524 (Archive::read_header): Add nested_off parameter. Change
12526 (Archive::interpret_header): Likewise.
12527 (Archive::include_all_members): Change to handle thin
12529 (Archive::include_member): Likewise.
12530 * archive.h (Archive::Archive): Add new parameters and
12532 (Archive::armagt): New const.
12533 (Archive::setup): Remove task parameter.
12534 (Archive::unlock_nested_archives): New function.
12535 (Archive::read_header): Add nested_off parameter.
12536 (Archive::interpret_header): Likewise.
12537 (Archive::Nested_archive_table): New typedef.
12538 (Archive::is_thin_archive_): New field.
12539 (Archive::nested_archives_): New field.
12540 (Archive::options_): New field.
12541 (Archive::dirpath_): New field.
12542 (Archive::task_): New field.
12543 * readsyms.cc (Read_symbols::do_read_symbols): Add check
12544 for thin archives. Pass additional parameters to
12545 Archive::Archive. Unlock the archive file after calling
12548 2008-03-29 Ian Lance Taylor <iant@google.com>
12550 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12551 version symbol to be local.
12552 * testsuite/ver_test_4.sh: New file.
12553 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12554 (check_DATA): Add ver_test_4.syms.
12555 (ver_test_4.syms): New target.
12556 * testsuite/Makefile.in: Rebuild.
12559 (Output_section::Input_section_sort_entry::has_priority): New
12561 (Output_section::Input_section_sort_entry::match_file_name): New
12563 (Output_section::Input_section_sort_entry::match_section_name):
12565 (Output_section::Input_section_sort_entry::match_section_name_prefix):
12567 (Output_section::Input_section_sort_entry::match_section_file):
12569 (Output_section::Input_section_sort_compare::operator()): Rewrite
12570 using new Input_section_sort_entry functions. Sort crtbegin and
12571 crtend first. Sort sections with no priority before sections with
12573 * testsuite/initpri1.c (d3): Check j != 4.
12574 (cd5): New constructor/destructor function.
12575 (main): Check j != 2.
12577 * symtab.cc (Symbol_table::add_from_object): If we don't use the
12578 new symbol when resolving, don't call set_is_default.
12579 * testsuite/ver_test_7.cc: New file.
12580 * testsuite/ver_test_7.sh: New file.
12581 * testsuite/Makefile.am (ver_test_7.so): New target.
12582 (ver_test_7.o): New target.
12583 (check_SCRIPTS): Add ver_test_7.sh.
12584 (check_DATA): Add ver_test_7.syms.
12585 (ver_test_7.syms): New target.
12587 2008-03-28 Ian Lance Taylor <iant@google.com>
12589 * layout.cc (Layout::layout): If we see an input section with a
12590 name that needs sorting, set the must_sort flag for the output
12592 (Layout::make_output_section): If the name of the output section
12593 indicates that it might require sorting, set the may_sort flag.
12594 * output.h (Output_section::may_sort_attached_input_sections): New
12596 (Output_section::set_may_sort_attached_input_sections): New
12598 (Output_section::must_sort_attached_input_sections): New
12600 (Output_section::set_must_sort_attached_input_sections): New
12602 (class Output_section): Declare Input_section_sort_entry. Define
12603 Input_section_sort_compare. Declare
12604 sort_attached_input_sections. Add new fields:
12605 may_sort_attached_input_sections_,
12606 must_sort_attached_input_sections_,
12607 attached_input_sections_are_sorted_.
12608 * output.cc (Output_section::Output_section): Initialize new
12610 (Output_section::add_input_section): Add an entry to
12611 input_sections_ if may_sort or must_sort are true.
12612 (Output_section::set_final_data_size): Call
12613 sort_attached_input_sections if necessary.
12614 (Output_section::Input_section_sort_entry): Define new class.
12615 (Output_section::Input_section_sort_compare::operator()): New
12617 (Output_section::sort_attached_input_sections): New function.
12618 * configure.ac: Check whether the compiler supports constructor
12619 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
12620 * testsuite/initpri1.c: New file.
12621 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
12622 CONSTRUCTOR_PRIORITY.
12623 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
12624 (initpri1_LDFLAGS): New variable.
12625 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12627 2008-03-27 Ian Lance Taylor <iant@google.com>
12629 * common.cc (Sort_commons::operator): Correct sorting algorithm.
12630 * testsuite/common_test_1.c: New file.
12631 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
12632 (common_test_1_SOURCES): New variable.
12633 (common_test_1_DEPENDENCIES): New variable.
12634 (common_test_1_LDFLAGS): New variable.
12636 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
12637 and commons_ correctly when NAME/VERSION does not override
12639 * testsuite/ver_test_6.c: New file.
12640 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
12641 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
12642 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
12644 2008-03-26 Ian Lance Taylor <iant@google.com>
12646 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
12647 of an undefined symbol from a version script.
12648 * testsuite/Makefile.am (ver_test_5.so): New target.
12649 (ver_test_5.o): New target.
12650 (check_SCRIPTS): Add ver_test_5.sh.
12651 (check_DATA): Add ver_test_5.syms.
12652 (ver_test_5.syms): New target.
12653 * testsuite/ver_test_5.cc: New file.
12654 * testsuite/ver_test_5.script: New file.
12655 * testsuite/ver_test_5.sh: New file.
12656 * Makefile.in, testsuite/Makefile.in: Rebuild.
12659 Fix problems building gold with gcc 4.3.0.
12660 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
12661 (gold_error_at_location, gold_warning_at_location): Use it.
12662 * configure.ac: Check whether we can compile and use a template
12663 function with a printf attribute.
12664 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
12665 when jumping over bytes.
12666 * object.cc: Instantiate Object::read_section_data.
12667 * debug.h: Include <cstring>
12668 * dwarf_reader.cc: Include <algorithm>
12669 * main.cc: Include <cstring>.
12670 * options.cc: Include <cstring>.
12671 * output.cc: Include <cstring>.
12672 * script.cc: Include <cstring>.
12673 * script.h: Include <string>.
12674 * symtab.cc: Include <cstring> and <algorithm>.
12675 * target-select.cc: Include <cstring>.
12676 * version.cc: Include <string>.
12677 * testsuite/testmain.cc: Include <cstdlib>.
12678 * configure, config.in: Rebuild.
12680 2008-03-25 Ian Lance Taylor <iant@google.com>
12682 * options.cc: Include "../bfd/bfdver.h".
12683 (options::help): Print bug reporting address.
12685 * version.cc (print_version): Adjust output for current value of
12686 BFD_VERSION_STRING.
12690 * options.cc (options::help): Print list of supported targets.
12691 * target-select.h: Include <vector>.
12692 (class Target_selector): Make machine_, size_, and is_big_endian_
12693 fields const. Add bfd_name_ and instantiated_target_ fields.
12694 (Target_selector::Target_selector): Add bfd_name parameter.
12695 (Target_selector::recognize): Make non-virtual, call
12697 (Target_selector::recognize_by_name): Make non-virtual, call
12698 do_recognize_by_name.
12699 (Target_selector::supported_names): New function.
12700 (Target_selector::bfd_name): New function.
12701 (Target_selector::do_instantiate_target): New pure virtual
12703 (Target_selector::do_recognize): New virtual function.
12704 (Target_selector::do_recognize_by_name): New virtual function.
12705 (Target_selector::instantiate_target): New private function.
12706 (supported_target_names): Declare.
12707 * target-select.cc (Target_selector::Target_selector): Update for
12708 new parameter and fields.
12709 (select_target_by_name): Check that the name matches before
12710 calling recognize_by_name.
12711 (supported_target_names): New function.
12712 * i386.cc (class Target_selector_i386): Update Target_selector
12713 constructor call. Remove recognize and recognize_by_name. Add
12714 do_instantiate_target.
12715 * x86_64.cc (class Target_selector_x86_64): Likewise.
12716 * testsuite/testfile.cc (class Target_selector_test): Update for
12717 changes to Target_selector.
12719 * README: Rewrite, with some notes on unsupported features.
12721 2008-03-24 Cary Coutant <ccoutant@google.com>
12723 * i386.cc (Target_i386::Got_type): New enum declaration.
12724 (Target_i386::Scan::local): Updated callers of Output_data_got
12726 (Target_i386::Scan::global): Likewise.
12727 (Target_i386::Relocate::relocate): Likewise.
12728 (Target_i386::Relocate::relocate_tls): Likewise.
12729 * object.h (Got_offset_list): New class.
12730 (Sized_relobj::local_has_got_offset): Added got_type parameter.
12731 (Sized_relobj::local_got_offset): Likewise.
12732 (Sized_relobj::set_local_got_offset): Likewise.
12733 (Sized_relobj::local_has_tls_got_offset): Removed.
12734 (Sized_relobj::local_tls_got_offset): Removed.
12735 (Sized_relobj::set_local_tls_got_offset): Removed.
12736 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
12737 * output.cc (Output_data_got::add_global): Added got_type parameter.
12738 (Output_data_got::add_global_with_rel): Likewise.
12739 (Output_data_got::add_global_with_rela): Likewise.
12740 (Output_data_got::add_global_pair_with_rel): New function.
12741 (Output_data_got::add_global_pair_with_rela): New function.
12742 (Output_data_got::add_local): Added got_type parameter.
12743 (Output_data_got::add_local_with_rel): Likewise.
12744 (Output_data_got::add_local_with_rela): Likewise.
12745 (Output_data_got::add_local_pair_with_rel): New function.
12746 (Output_data_got::add_local_pair_with_rela): New function.
12747 (Output_data_got::add_global_tls): Removed.
12748 (Output_data_got::add_global_tls_with_rel): Removed.
12749 (Output_data_got::add_global_tls_with_rela): Removed.
12750 (Output_data_got::add_local_tls): Removed.
12751 (Output_data_got::add_local_tls_with_rel): Removed.
12752 (Output_data_got::add_local_tls_with_rela): Removed.
12753 * output.h (Output_data_got::add_global): Added got_type parameter.
12754 (Output_data_got::add_global_with_rel): Likewise.
12755 (Output_data_got::add_global_with_rela): Likewise.
12756 (Output_data_got::add_global_pair_with_rel): New function.
12757 (Output_data_got::add_global_pair_with_rela): New function.
12758 (Output_data_got::add_local): Added got_type parameter.
12759 (Output_data_got::add_local_with_rel): Likewise.
12760 (Output_data_got::add_local_with_rela): Likewise.
12761 (Output_data_got::add_local_pair_with_rel): New function.
12762 (Output_data_got::add_local_pair_with_rela): New function.
12763 (Output_data_got::add_global_tls): Removed.
12764 (Output_data_got::add_global_tls_with_rel): Removed.
12765 (Output_data_got::add_global_tls_with_rela): Removed.
12766 (Output_data_got::add_local_tls): Removed.
12767 (Output_data_got::add_local_tls_with_rel): Removed.
12768 (Output_data_got::add_local_tls_with_rela): Removed.
12769 * resolve.cc (Symbol::override_base_with_special): Removed
12770 reference to has_got_offset_ field.
12771 * symtab.cc (Symbol::init_fields): Replaced initialization
12772 of got_offset_ with got_offsets_. Removed initialization
12774 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
12775 (Symbol::got_offset): Likewise.
12776 (Symbol::set_got_offset): Likewise.
12777 (Symbol::has_tls_got_offset): Removed.
12778 (Symbol::tls_got_offset): Removed.
12779 (Symbol::set_tls_got_offset): Removed.
12780 (Symbol::got_offset_): Removed.
12781 (Symbol::tls_mod_got_offset_): Removed.
12782 (Symbol::tls_pair_got_offset_): Removed.
12783 (Symbol::got_offsets_): New field.
12784 (Symbol::has_got_offset): Removed.
12785 (Symbol::has_tls_mod_got_offset): Removed.
12786 (Symbol::has_tls_pair_got_offset): Removed.
12787 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
12788 (Target_x86_64::Scan::local): Updated callers of Output_data_got
12790 (Target_x86_64::Scan::global): Likewise.
12791 (Target_x86_64::Relocate::relocate): Likewise.
12792 (Target_x86_64::Relocate::relocate_tls): Likewise.
12794 2008-03-25 Ben Elliston <bje@au.ibm.com>
12796 * yyscript.y: Fix spelling error in comment.
12798 2008-03-24 Ian Lance Taylor <iant@google.com>
12800 * options.h (class General_options): Define build_id option.
12801 * layout.h (class Layout): Declare write_build_id, create_note,
12802 create_build_id. Add build_id_note_ member.
12803 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
12804 "libiberty.h", "md5.h", "sha1.h".
12805 (Layout::Layout): Initialize eh_frame_data_,
12806 eh_frame_hdr_section_, and build_id_note_.
12807 (Layout::finalize): Call create_build_id.
12808 (Layout::create_note): New function, broken out of
12809 Layout::create_gold_note.
12810 (Layout::create_gold_note): Call create_note.
12811 (Layout::create_build_id): New function.
12812 (Layout::write_build_id): New function.
12813 (Close_task_runner::run): Call write_build_id.
12815 * x86_64.cc: Correct license to GPLv3.
12817 2008-03-23 Ian Lance Taylor <iant@google.com>
12819 * options.cc: Include "demangle.h".
12820 (parse_optional_string): New function.
12821 (parse_long_option): Handle takes_optional_argument.
12822 (parse_short_option): Update dash_z initializer. Handle
12823 takes_optional_argument.
12824 (General_options::General_options): Initialize do_demangle_.
12825 (General_options::finalize): Set do_demangle_. Handle demangling
12827 * options.h (parse_optional_string): Declare.
12828 (struct One_option): Add optional_arg field. Update constructor.
12829 Update call constructor calls. Add takes_optional_argument
12831 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
12832 (DEFINE_optional_string): Define.
12833 (General_options::demangle): Change from DEFINE_bool to
12834 DEFINE_optional_string.
12835 (General_options::no_demangle): New function.
12836 (General_options::do_demangle): New function.
12837 (General_options::set_do_demangle): New function.
12838 (General_options::execstack_status_): Move definition to end of
12840 (General_options::static_): Likewise.
12841 (General_options::do_demangle_): New field.
12842 * object.cc (big_endian>::get_symbol_location_info): Call
12843 Options::do_demangle, not Options::demangle.
12844 * symtab.cc (demangle): Likewise.
12846 2008-03-22 Ian Lance Taylor <iant@google.com>
12848 * gold.h: Include <cstddef> and <sys/types.h>
12849 * options.h: Include <cstring>.
12851 2008-03-21 Ian Lance Taylor <iant@google.com>
12853 * Added source code to GNU binutils.