1 2012-04-23 David S. Miller <davem@davemloft.net>
3 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
5 (Target_sparc::Target_sparc): Initialize new fields.
6 (Target_sparc::do_make_elf_object): New function.
7 (Target_sparc::do_adjust_elf_header): New function.
9 2012-04-23 Cary Coutant <ccoutant@google.com>
11 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
12 CU range table of gdb index.
14 2012-04-20 David S. Miller <davem@davemloft.net>
16 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
19 2012-04-16 David S. Miller <davem@davemloft.net>
21 * sparc.cc (Target_sparc::got_address): New function.
22 (Sparc_relocate_functions::gdop_hix22): New function.
23 (Sparc_relocate_functions::gdop_lox10): New function.
24 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
26 (Target_sparc::Scan::local): Likewise if the global symbol is not
27 preemptible and is not IFUNC.
28 (Target_sparc::Relocate::relocate): Perform GOTDATA code
29 transformations for local and non-preemptible non-IFUNC global
32 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
33 writing out 64-bit part of ranges.
35 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
36 -fpic and -fpie respectively.
37 * Makefile.in: Regenerate.
39 * sparc.cc (class Target_sparc): Add rela_ifunc_.
40 (Target_sparc::Target_sparc): Initialize new field.
41 (Target_sparc::do_plt_section_for_global): New function.
42 (Target_sparc::do_plt_section_for_local): New function.
43 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
44 (Target_sparc::make_plt_section): New function, broken out of
45 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
46 (Target_sparc::make_plt_entry): Call make_plt_section.
47 (Target_sparc::make_local_ifunc_plt_entry): New function.
48 (Target_sparc::rela_ifunc_section): New function.
49 (Target_sparc::plt_section): Remove const.
50 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
51 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
52 and ifunc_count_ fields.
53 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
54 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
55 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
56 (Output_data_plt_sparc::rela_ifunc): New function.
57 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
58 (Output_data_plt_sparc::has_ifunc_section): New function.
59 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
60 (Output_data_plt_sparc::address_for_global): New function.
61 (Output_data_plt_sparc::address_for_local): New function.
62 (Output_data_plt_sparc::plt_index_to_offset): New function.
63 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
65 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
67 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
68 R_SPARC_JMP_IREL to switch.
69 (Target_sparc::Scan::check_non_pic): Likewise.
70 (Target_sparc::Scan::local): Handle IFUNC symbols.
71 (Target_sparc::Scan::local): Likewise.
72 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
73 and plt_address_for_local.
74 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
75 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
77 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
78 (class Output_data_reloc): Adjust calls to Output_reloc_type.
79 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
80 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
82 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
83 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
85 * sparc.cc (Target_sparc::Scan::global): Likewise.
86 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
88 2012-04-16 Cary Coutant <ccoutant@google.com>
90 * archive.cc (Library_base::should_include_member): Check for
91 --export-dynamic-symbol.
92 * options.h (class General_options): Add --export-dynamic-symbol.
93 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
94 --export-dynamic-symbol.
95 (Symbol_table::gc_mark_undef_symbols): Likewise.
96 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
98 2012-04-12 David S. Miller <davem@davemloft.net>
100 * sparc.cc (Reloc::wdisp10): New relocation method.
101 (Reloc::h34): Likewise.
102 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
103 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
105 (Target_sparc::Scan::local): Likewise.
106 (Target_sparc::Scan::global): Likewise.
107 (Target_sparc::Relocate::relocate): Likewise.
109 2012-04-09 Cary Coutant <ccoutant@google.com>
111 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
114 2012-04-06 Ian Lance Taylor <iant@google.com>
116 * timer.cc: #include <unistd.h>.
118 2012-04-06 Roland McGrath <mcgrathr@google.com>
120 * configure.in (AC_CHECK_HEADERS): Add locale.h.
121 * config.in: Regenerate.
122 * configure: Regenerate.
124 2012-04-05 Nick Clifton <nickc@redhat.com>
126 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
127 (AM_LC_MESSAGES): Add.
128 * aclocal.m4: Regenerate.
129 * config.in: Regenerate.
130 * configure: Regenerate.
132 2012-03-21 Cary Coutant <ccoutant@google.com>
134 * Makefile.am: Add gdb-index.cc, gdb-index.h.
135 * Makefile.in: Regenerate.
136 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
137 (Sized_elf_reloc_mapper::symbol_section): New function.
138 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
139 (make_elf_reloc_mapper): New function.
140 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
141 (Dwarf_abbrev_table::do_read_abbrevs): New function.
142 (Dwarf_abbrev_table::do_get_abbrev): New function.
143 (Dwarf_ranges_table::read_ranges_table): New function.
144 (Dwarf_ranges_table::read_range_list): New function.
145 (Dwarf_pubnames_table::read_section): New function.
146 (Dwarf_pubnames_table::read_header): New function.
147 (Dwarf_pubnames_table::next_name): New function.
148 (Dwarf_die::Dwarf_die): New function.
149 (Dwarf_die::read_attributes): New function.
150 (Dwarf_die::skip_attributes): New function.
151 (Dwarf_die::set_name): New function.
152 (Dwarf_die::set_linkage_name): New function.
153 (Dwarf_die::attribute): New function.
154 (Dwarf_die::string_attribute): New function.
155 (Dwarf_die::int_attribute): New function.
156 (Dwarf_die::uint_attribute): New function.
157 (Dwarf_die::ref_attribute): New function.
158 (Dwarf_die::child_offset): New function.
159 (Dwarf_die::sibling_offset): New function.
160 (Dwarf_info_reader::check_buffer): New function.
161 (Dwarf_info_reader::parse): New function.
162 (Dwarf_info_reader::do_parse): New function.
163 (Dwarf_info_reader::do_read_string_table): New function.
164 (Dwarf_info_reader::lookup_reloc): New function.
165 (Dwarf_info_reader::get_string): New function.
166 (Dwarf_info_reader::visit_compilation_unit): New function.
167 (Dwarf_info_reader::visit_type_unit): New function.
168 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
169 Sized_elf_reloc_mapper.
170 (Sized_dwarf_line_info::symbol_section): Remove function.
171 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
172 (Sized_dwarf_line_info::read_line_mappings): Remove object
173 parameter, adjust callers.
174 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
175 * dwarf_reader.h: Include <sys/types.h>.
176 (class Track_relocs): Remove forward declaration.
177 (class Elf_reloc_mapper): New class.
178 (class Sized_elf_reloc_mapper): New class.
179 (class Dwarf_abbrev_table): New class.
180 (class Dwarf_range_list): New class.
181 (class Dwarf_ranges_table): New class.
182 (class Dwarf_pubnames_table): New class.
183 (class Dwarf_die): New class.
184 (class Dwarf_info_reader): New class.
185 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
186 (Sized_dwarf_line_info::symbol_section): Remove member function.
187 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
189 * gdb-index.cc: New source file.
190 * gdb-index.h: New source file.
191 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
192 and .debug_types sections, call Layout::add_to_gdb_index.
193 (Sized_relobj_incr::do_section_name): Implement.
194 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
195 return type; Implement.
196 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
198 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
199 parameter list and return type.
200 (Sized_incr_dynobj::do_section_contents): Likewise.
201 * layout.cc: Include gdb-index.h.
202 (Layout::Layout): Initialize gdb_index_data_.
203 (Layout::init_fixed_output_section): Check for .gdb_index section.
204 (Layout::add_to_gdb_index): New function. Instantiate.
205 * layout.h: Add forward declaration for class Gdb_index.
206 (Layout::add_to_gdb_index): New member function.
207 (Layout::gdb_index_data_): New data member.
208 * main.cc: Include gdb-index.h.
209 (main): Print statistics for gdb index.
210 * object.cc (Object::section_contents): Move code into
212 (need_decompressed_section): Check for sections needed when building
214 (build_compressed_section_map): Likewise.
215 (Sized_relobj_file::do_read_symbols): Need local symbols when building
217 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
218 sections; call Layout::add_to_gdb_index.
219 (Sized_relobj_file::do_decompressed_section_contents): Call
220 do_section_contents directly.
221 * object.h (Object::do_section_contents): Adjust parameter list and
223 (Object::do_decompressed_section_contents): Call do_section_contents
225 (Sized_relobj_file::do_section_contents): Adjust parameter list and
227 * options.h (class General_options): Add --gdb-index option.
228 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
229 list and return type.
230 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
231 * reloc.h (Track_relocs::checkpoint): New function.
232 (Track_relocs::reset): New function.
234 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
236 * testsuite/Makefile.in: Regenerate.
237 * testsuite/gdb_index_test.cc: New test source file.
238 * testsuite/gdb_index_test_1.sh: New test source file.
239 * testsuite/gdb_index_test_2.sh: New test source file.
241 2012-03-19 Doug Kwan <dougkwan@google.com>
243 * arm.cc (Target_arm::do_define_standard_symbols): New method.
244 (Target_arm::do_finalize_sections): Remove code which defines
245 __exidx_start and __exidx_end. Make symbol table parameter
246 anonymous as it is not used.
247 * gold.cc (queue_middle_tasks): Call target hook to define any
248 target-specific symbols.
249 * target.h (Target::define_standard_symbols): New method.
250 (Target::do_define_standard_symbols): Same.
251 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
252 * testsuite/Makefile.in: Regenerate.
253 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
255 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
256 relocations are generated for __exidx_start and __exidx_end.
258 2012-03-16 Doug Kwan <dougkwan@google.com>
260 * testsuite/Makefile.am: Disable test initpri3b.
261 * testsuite/Makefile.in: Regenerate.
263 2012-03-15 Doug Kwan <dougkwan@google.com>
265 * arm.cc (Target_arm::got_section): Make .got section read-only
268 2012-03-15 Ian Lance Taylor <iant@google.com>
271 * layout.cc (Layout::make_output_section): Correctly mark
272 SHT_INIT_ARRAY, et. al., as relro.
274 2012-03-14 Doug Kwan <dougkwan@google.com>
276 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
277 dynamic relocations for protected symbols in shared objects.
279 2012-03-13 Ian Lance Taylor <iant@google.com>
281 * resolve.cc (Symbol_table::resolve): When merging common symbols,
282 keep the larger alignment.
284 2012-03-12 Cary Coutant <ccoutant@google.com>
286 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
287 handling of DW_LNE_define_file.
289 2012-03-12 Cary Coutant <ccoutant@google.com>
291 * reduced_debug_output.cc
292 (Output_reduced_debug_info_section::get_die_end): Add new FORM
295 2012-02-29 Cary Coutant <ccoutant@google.com>
297 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
299 2012-02-29 Cary Coutant <ccoutant@google.com>
301 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
302 Call Object::decompressed_section_contents.
303 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
305 (Sized_dwarf_line_info::buffer_start_): New data member.
306 * merge.cc (Output_merge_data::do_add_input_section): Call
307 Object::decompressed_section_contents.
308 (Output_merge_string::do_add_input_section): Likewise.
309 * object.cc (need_decompressed_section): New function.
310 (build_compressed_section_map): Decompress sections needed later.
311 (Sized_relobj_file::do_decompressed_section_contents): New function.
312 (Sized_relobj_file::do_discard_decompressed_sections): New function.
313 * object.h (Object::decompressed_section_contents): New function.
314 (Object::discard_decompressed_sections): New function.
315 (Object::do_decompressed_section_contents): New function.
316 (Object::do_discard_decompressed_sections): New function.
317 (Compressed_section_info): New type.
318 (Compressed_section_map): Include decompressed section contents.
319 (Sized_relobj_file::do_decompressed_section_contents): New function.
320 (Sized_relobj_file::do_discard_decompressed_sections): New function.
322 2012-02-16 Cary Coutant <ccoutant@google.com>
324 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
325 * testsuite/Makefile.in: Regenerate.
327 2012-02-14 Cary Coutant <ccoutant@google.com>
329 * options.cc (General_options::finalize): Disallow -pie and -static.
331 2012-02-03 Doug Kwan <dougkwan@google.com>
333 * arm.cc (Arm_relocate_functions::abs8,
334 Arm_relocate_functions::abs16): Use
335 Bits::has_signed_unsigned_overflow32.
336 (Arm_relocate_functions::thm_abs8): Correct range of
338 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
341 2012-02-02 Doug Kwan <dougkwan@google.com>
343 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
344 position independent outputs, not just shared objects.
346 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
348 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
349 * configure: Regenerated.
351 2012-01-27 Ian Lance Taylor <iant@google.com>
353 * reloc.h (Bits): New class with static functions, copied from
354 namespace utils in arm.cc.
355 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
358 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
360 * incremental.cc (write_info_blocks): Correct relocation offset.
362 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
364 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
365 (Relocate::tls_gd_to_le): Likewise.
367 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
369 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
371 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
373 * configure.ac: Check if -mcmodel=medium works.
374 * configure: Regenerated.
376 2012-01-24 Cary Coutant <ccoutant@google.com>
378 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
380 (read_unsigned_LEB_128_x): ... this new function.
381 (read_signed_LEB_128): Replaced with inline definition and ...
382 (read_signed_LEB_128_x): ... this new function.
383 * int_encoding.h (read_unsigned_LEB_128_x): New function.
384 (read_unsigned_LEB_128): Add inline definition.
385 (read_signed_LEB_128_x): New function.
386 (read_signed_LEB_128): Add inline definition.
387 * testsuite/Makefile.am (leb128_unittest): New unit test.
388 * testsuite/Makefile.in: Regenerate.
389 * testsuite/leb128_unittest.cc: New unit test.
391 2012-01-23 Ian Lance Taylor <iant@google.com>
394 * i386.cc (Target_i386::do_code_fill): When using a jmp
395 instruction, pad with nop instructions.
396 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
398 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
400 * x86_64.cc (gc_process_relocs): Add typename on types used in
402 (scan_relocs): Likewise.
403 (relocate_section): Likewise.
404 (apply_relocation): Likewise.
406 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
408 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
409 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
412 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
414 * x86_64.cc: Initial support for x32.
416 2012-01-03 Cary Coutant <ccoutant@google.com>
418 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
419 Use abstract base class for GOT.
420 * gold/output.h (class Output_data_got_base): New abstract base class.
421 (class Output_data_got): Derive from new base class, adjust ctors.
422 (Output_data_got::reserve_slot): Make virtual; rename to
423 do_reserve_slot; Adjust callers.
424 * gold/target.h (Sized_target::init_got_plt_for_update): Return
425 pointer to abstract base class.
426 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
428 2011-12-18 Ian Lance Taylor <iant@google.com>
430 * object.h (Relobj::local_symbol_value): New function.
431 (Relobj::local_plt_offset): New function.
432 (Relobj::local_has_got_offset): New function.
433 (Relobj::local_got_offset): New function.
434 (Relobj::set_local_got_offset): New function.
435 (Relobj::do_local_symbol_value): New pure virtual function.
436 (Relobj::do_local_plt_offset): Likewise.
437 (Relobj::do_local_has_got_offset): Likewise.
438 (Relobj::do_local_got_offset): Likewise.
439 (Relobj::do_set_local_got_offset): Likewise.
440 (Sized_relobj::do_local_has_got_offset): Rename from
441 local_has_got_offset.
442 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
443 (Sized_relobj::do_set_local_got_offset): Rename from
444 set_local_got_offset.
445 (Sized_relobj_file::do_local_plt_offset): Rename from
447 (Sized_relobj_file::do_local_symbol_value): New function.
448 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
450 * output.cc (Output_data_got::Got_entry::write): Change object to
451 Relobj. Use local_symbol_value.
452 (Output_data_got::add_global_with_rel): Change rel_dyn to
453 Output_data_reloc_generic*. Use add_global_generic.
454 (Output_data_got::add_global_with_rela): Remove. Change all
455 callers to use add_global_with_rel.
456 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
457 Output_data_reloc_generic*. Use add_global_generic.
458 (Output_data_got::add_global_pair_with_rela): Remove. Change all
459 callers to use add_global_pair_with_rel.
460 (Output_data_got::add_local): Change object to Relobj*.
461 (Output_data_got::add_local_plt): Likewise.
462 (Output_data_got::add_local_with_rel): Change object to Relobj*,
463 change rel_dyn to Output_data_reloc_generic*. Use
465 (Output_data_got::add_local_with_rela): Remove. Change all
466 callers to use all_local_with_rel.
467 (Output_data_got::add_local_pair_with_rel): Change object to
468 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
469 add_output_section_generic.
470 (Output_data_got::add_local_pair_with_rela): Remove. Change all
471 callers to use add_local_pair_with_rel.
472 (Output_data_got::reserve_local): Change object to Relobj*.
473 * output.h: (class Output_data_reloc_generic): Add pure virtual
474 declarations for add_global_generic, add_local_generic,
475 add_output_section_generic.
476 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
477 functions for Output_data_reloc_generic. Update declarations for
478 changes listed in output.cc.
479 (class Output_data_got): Change template parameter to got_size.
480 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
481 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
483 (Sized_relobj_incr::do_local_plt_offset): New function.
484 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
487 2011-12-17 Cary Coutant <ccoutant@google.com>
489 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
490 * resolve.cc (Symbol_table::resolve): Likewise.
491 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
493 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
495 2011-12-16 Ian Lance Taylor <iant@google.com>
497 * output.h (Output_data_reloc_generic::add): Only call
498 add_dynamic_reloc if this is a dynamic reloc section.
500 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
503 * target-reloc.h (apply_relocation): Replace <64, false> with
506 2011-11-25 Nick Clifton <nickc@redhat.com>
508 * po/it.po: New Italian translation.
510 2011-11-17 Sterling Augustine <saugustine@google.com>
512 * script.cc (script_include_directive): Implement.
513 (read_script_file): New local variables name and search_path. Update
514 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
515 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
516 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
518 2011-11-11 Sterling Augustine <saugustine@google.com>
520 * yyscript.y (section_cmd): Add support for INCLUDE directive.
521 (file_or_sections_cmd): Likewise.
523 2011-11-11 Doug Kwan <dougkwan@google.com>
525 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
526 if --just-symbols is given.
528 2011-11-10 Doug Kwan <dougkwan@google.com>
531 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
532 when processing data relocs.
533 * reloc.h (Relocate_functions::rel_unaligned): New method.
534 (Relocate_functions::pcrel_unaligned): Ditto.
535 (Relocate_functions::rel32_unaligned): Ditto.
536 (Relocate_functions::pcrel32_unaligned): Ditto.
538 2011-11-09 Doug Kwan <dougkwan@google.com>
541 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
542 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
543 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
544 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
545 (Relocate_functions::rel_unaligned): New.
546 (Relocate_functions::rel32_unaligned): New.
547 * target-reloc.h (relocate_for_relocatable): Add code to handle
548 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
549 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
550 arm_unaligned_reloc_r): New targets.
551 * testsuite/Makefile.in: Regenerate.
552 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
555 2011-11-02 Ian Lance Taylor <iant@google.com>
557 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
559 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
560 * options.cc (General_options::finalize): Use library search path
561 from configure script if specified. If not native and no sysroot,
562 only search TOOLLIBDIR.
563 * options.h (Search_directory::Search_directory): Change name to
565 (General_options::add_to_library_path_with_sysroot): Change arg to
567 * configure, Makefile.in, config.in: Rebuild.
569 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
571 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
572 we are working around the ARM1176 Erratum.
573 * options.h (General_options::fix_arm1176): Add option.
574 * testsuite/Makefile.am: Add testcases, and keep current ones
576 * testsuite/Makefile.in: Regenerate.
577 * testsuite/arm_fix_1176.s: New file.
578 * testsuite/arm_fix_1176.sh: Likewise.
580 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
582 * arm.cc (Target_arm::Target_arm): Remove initialisation of
584 (Target_arm::may_use_blx): Remove method.
585 (Target_arm::set_may_use_blx): Likewise.
586 (Target_arm::may_use_v4t_interworking): New method.
587 (Target_arm::may_use_v5t_interworking): Likewise.
588 (Target_arm::may_use_blx_): Remove member variable.
589 (Arm_relocate_functions::arm_branch_common): Check for v5T
591 (Arm_relocate_functions::thumb_branch_common): Likewise.
592 (Reloc_stub::stub_type_for_reloc): Likewise.
593 (Target_arm::do_finalize_sections): Correct interworking checks.
594 * testsuite/Makefile.am: Add new tests.
595 * testsuite/Makefile.in: Regenerate.
596 * testsuite/arm_farcall_arm_arm.s: New test.
597 * testsuite/arm_farcall_arm_arm.sh: Likewise.
598 * testsuite/arm_farcall_arm_thumb.s: Likewise.
599 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
600 * testsuite/arm_farcall_thumb_arm.s: Likewise.
601 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
602 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
603 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
605 2011-10-31 Cary Coutant <ccoutant@google.com>
608 * expression.cc (Expression::eval_with_dot): Add
609 is_section_dot_assignment parameter.
610 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
611 absolute and assigning to dot within a section.
613 (Output_section_element_assignment::set_section_addresses): Pass
614 dot_section to set_if_absolute.
615 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
616 as is_section_dot_assignment flag to eval_with_dot.
617 (Output_section_element_dot_assignment::set_section_addresses):
619 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
620 parameter. Also set value if relative to dot_section; set the
621 symbol's output_section.
622 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
623 parameter. Adjust all callers.
624 (Expression::eval_maybe_dot): Likewise.
625 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
627 * testsuite/script_test_2.t: Test assignment of an absolute value
628 to dot within an output section element.
630 2011-10-31 Cary Coutant <ccoutant@google.com>
632 * options.h (class General_options): Add --[no-]gnu-unique options.
633 * symtab.cc (Symbol_table::sized_write_globals): Convert
634 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
636 2011-10-31 Cary Coutant <ccoutant@google.com>
639 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
640 unnecessary assertion.
641 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
643 2011-10-31 Sriraman Tallam <tmsriram@google.com>
645 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
647 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
649 Change to just keep the section associated with symbol.
650 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
651 they are externally visible and --export-dynamic is turned on.
652 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
654 2011-10-19 Ian Lance Taylor <iant@google.com>
658 (Output_section_element_dot_assignment::needs_output_section): New
661 2011-10-19 Ian Lance Taylor <iant@google.com>
664 * layout.cc (Layout::segment_precedes): Don't assert failure if a
665 --section-start option was seen.
666 * options.h (General_options::any_section_start): New function.
668 2011-10-18 David S. Miller <davem@davemloft.net>
671 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
672 member to track relocation locations that have moved during TLS
674 (Target_sparc::Relocate::Relocate): Initialize to NULL.
675 (Target_sparc::Relocate::relocate): Adjust view down by 4
676 bytes if it matches reloc_adjust_addr_.
677 (Target_sparc::Relocate::relocate_tls): Always move the
678 __tls_get_addr call delay slot instruction forward 4 bytes when
679 performing relaxation.
681 2011-10-18 Cary Coutant <ccoutant@google.com>
683 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
684 (Output_file::map_no_anonymous): Check for non-zero
685 return code from posix_fallocate.
687 2011-10-17 Cary Coutant <ccoutant@google.com>
690 * plugin.cc (is_visible_from_outside): Check for symbols
691 referenced from dynamic objects.
692 * resolve.cc (Symbol_table::resolve): Don't count references
693 from dynamic objects as references from real ELF files.
694 * testsuite/plugin_test_2.sh: Adjust expected result.
696 2011-10-17 Cary Coutant <ccoutant@google.com>
698 * gold.cc: Include timer.h.
699 (queue_middle_tasks): Stamp time.
700 (queue_final_tasks): Likewise.
701 * main.cc (main): Store timer in parameters. Print timers
703 * parameters.cc (Parameters::Parameters): Initialize timer_.
704 (Parameters::set_timer): New function.
705 (set_parameters_timer): New function.
706 * parameters.h (Parameters::set_timer): New function.
707 (Parameters::timer): New function.
708 (Parameters::timer_): New data member.
709 (set_parameters_timer): New function.
710 * timer.cc (Timer::stamp): New function.
711 (Timer::get_pass_time): New function.
712 * timer.h (Timer::stamp): New function.
713 (Timer::get_pass_time): New function.
714 (Timer::pass_times_): New data member.
716 2011-10-17 Cary Coutant <ccoutant@google.com>
718 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
719 task for members of lib groups.
721 2011-10-17 Cary Coutant <ccoutant@google.com>
724 * fileread.cc (File_read::find_view): Add assert.
725 (File_read::make_view): Move bounds check (replace with assert)...
726 (File_read::find_or_make_view): ... to here.
728 2011-10-12 Cary Coutant <ccoutant@google.com>
730 * output.cc (Output_file::open_base_file): Handle case where
731 ::read returns less than requested size.
733 2011-10-10 Cary Coutant <ccoutant@google.com>
735 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
736 Initialize defined_count_.
737 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
738 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
739 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
740 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
741 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
742 * incremental.h (Sized_relobj_incr::defined_count_): New data
744 (Sized_incr_dynobj::defined_count_): New data member.
745 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
746 Return zeroes instead of internal error.
748 2011-10-10 Cary Coutant <ccoutant@google.com>
751 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
752 (Output_reloc::symbol_value): Return PLT offset if flag is set.
753 * output.h (class Output_reloc): Add use_plt_offset flag.
754 (Output_reloc::type_): Adjust size of bit field.
755 (Output_reloc::use_plt_offset_): New bit field.
756 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
757 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
758 flag. Adjust all callers.
759 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
760 creating RELATIVE relocations.
762 2011-10-10 Nick Clifton <nickc@redhat.com>
764 * po/es.po: Updated Spanish translation.
765 * po/fi.po: Updated Finnish translation.
767 2011-10-03 Diego Novillo <dnovillo@google.com>
769 * options.cc (parse_uint): Fix dereference of RETVAL.
771 2011-09-29 Sriraman Tallam <tmsriram@google.com>
773 * layout.h (section_order_map_): New member.
774 (get_section_order_map): New member function.
775 * output.cc (Output_section::add_input_section): Check for patterns
776 only when --section-ordering-file is specified.
777 * gold.cc (queue_middle_tasks): Delay updating order of sections till
778 output_sections have been formed.
779 * layout.cc (Layout_Layout): Initialize section_order_map_.
780 * plugin.cc (update_section_order): Store order in order_map. Do not
782 * testsuite/Makefile.am: Add test case for plugin_final_layout.
783 * testsuite/Makefile.in: Regenerate.
784 * testsuite/plugin_section_order.c: New file.
785 * testsuite/plugin_final_layout.cc: New file.
786 * testsuite/plugin_final_layout.sh: New file.
788 2011-09-29 Cary Coutant <ccoutant@google.com>
790 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
792 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
793 symbols during incremental update.
794 (Symbol_table::add_from_dynobj): Likewise.
796 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
797 Ian Lance Taylor <iant@google.com>
799 * symtab.cc (Symbol_table::define_special_symbol): Always
800 canonicalize version string.
802 2011-09-26 Cary Coutant <ccoutant@google.com>
804 * gold.cc (queue_initial_tasks): Move option checks ...
805 * options.cc (General_options::finalize): ... to here. Disable
806 some options; make others fatal.
808 2011-09-26 Cary Coutant <ccoutant@google.com>
811 * plugin.cc (get_symbols_v2): New function.
812 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
813 (is_referenced_from_outside): New function.
814 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
815 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
816 (get_symbols): Pass version parameter.
817 (get_symbols_v2): New function.
818 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
820 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
821 (onload): Add LDPT_GET_SYMBOLS_V2.
822 (all_symbols_read_hook): Use get_symbols_v2; check for
823 LDPR_PREVAILING_DEF_IRONLY_EXP.
824 * testsuite/plugin_test_3.sh: Update expected results.
826 2011-09-23 Simon Baldwin <simonb@google.com>
828 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
829 configuration options.
830 * configure: Regenerate.
831 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
832 * Makefile.in: Regenerate.
833 * testsuite/Makefile.in: Regenerate.
835 2011-09-19 Sriraman Tallam <tmsriram@google.com>
837 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
839 2011-09-19 Cary Coutant <ccoutant@google.com>
841 * incremental.cc (can_incremental_update): Fix typo in comment.
842 * incremental.h (can_incremental_update): Likewise.
844 2011-09-18 Cary Coutant <ccoutant@google.com>
846 * incremental.cc (can_incremental_update): New function.
847 * incremental.h (can_incremental_update): New function.
848 * layout.cc (Layout::init_fixed_output_section): Call it.
849 (Layout::make_output_section): Don't allow patch space in .eh_frame.
850 * object.cc (Sized_relobj_file::do_layout): Call
851 can_incremental_update.
853 2011-09-13 Cary Coutant <ccoutant@google.com>
855 * configure.ac: Check for glibc support for gnu_indirect_function
856 support with static linking, setting automake conditional
858 * Makefile.in: Regenerate.
859 * configure: Regenerate.
861 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
862 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
864 * testsuite/Makefile.in: Regenerate.
866 2011-09-13 Cary Coutant <ccoutant@google.com>
868 * incremental.cc (Sized_relobj_incr::do_layout): Call
869 report_comdat_group for kept comdat sections.
870 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
871 * testsuite/Makefile.in: Regenerate.
872 * testsuite/incr_comdat_test_1.cc: New source file.
873 * testsuite/incr_comdat_test_2_v1.cc: New source file.
874 * testsuite/incr_comdat_test_2_v2.cc: New source file.
875 * testsuite/incr_comdat_test_2_v3.cc: New source file.
877 2011-09-13 Ian Lance Taylor <iant@google.com>
879 * object.cc (Sized_relobj_file::do_layout): Remove unused local
880 variable external_symbols_offset.
882 2011-09-12 Ian Lance Taylor <iant@google.com>
884 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
885 triggered if object has no symbols.
887 2011-09-09 David S. Miller <davem@davemloft.net>
889 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
890 (Output_fill_debug_line::do_write): Likewise.
892 2011-08-29 Cary Coutant <ccoutant@google.com>
894 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
895 casts to match formatting specs.
896 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
898 2011-08-26 Cary Coutant <ccoutant@google.com>
900 * layout.cc (Free_list::allocate): Provide guarantee of minimum
901 remaining hole size when allocating.
902 (Layout::make_output_section): Set fill methods for debug sections.
903 * layout.h (Free_list::Free_list_node): Move from private to
905 (Free_list::set_min_hole_size): New function.
906 (Free_list::begin, Free_list::end): New functions.
907 (Free_list::min_hole_): New data member.
908 * output.cc: Include dwarf.h.
909 (Output_fill_debug_info::do_minimum_hole_size): New function.
910 (Output_fill_debug_info::do_write): New function.
911 (Output_fill_debug_line::do_minimum_hole_size): New function.
912 (Output_fill_debug_line::do_write): New function.
913 (Output_section::Output_section): Initialize new data member.
914 (Output_section::set_final_data_size): Ensure patch space is larger
915 than minimum hole size.
916 (Output_section::do_write): Fill holes in debug sections.
917 * output.h (Output_fill): New class.
918 (Output_fill_debug_info): New class.
919 (Output_fill_debug_line): New class.
920 (Output_section::set_free_space_fill): New function.
921 (Output_section::free_space_fill_): New data member.
922 * testsuite/Makefile.am (incremental_test_3): Add
923 --incremental-patch option.
924 (incremental_test_4): Likewise.
925 (incremental_test_5): Likewise.
926 (incremental_test_6): Likewise.
927 (incremental_copy_test): Likewise.
928 (incremental_common_test_1): Likewise.
929 * testsuite/Makefile.in: Regenerate.
931 2011-08-26 Nick Clifton <nickc@redhat.com>
933 * po/es.po: Updated Spanish translation.
935 2011-08-01 Cary Coutant <ccoutant@google.com>
937 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
938 * gold/testsuite/Makefile.in: Regenerate.
939 * gold/testsuite/justsyms_exec.c: New source file.
940 * gold/testsuite/justsyms_lib.c: New source file.
942 2011-08-01 Cary Coutant <ccoutant@google.com>
944 * layout.cc (Layout::set_segment_offsets): Don't realign text
945 segment if -Ttext was specified.
946 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
948 * object.h (Sized_relobj_file::e_type): New function.
949 (Sized_relobj_file::e_type_): New data member.
950 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
951 base address for ET_EXEC files.
952 * target.cc (Target::do_make_elf_object_implementation): Allow
953 ET_EXEC files with --just-symbols option.
955 2011-07-28 Cary Coutant <ccoutant@google.com>
957 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
958 Add thread_number parameter.
959 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
960 * workqueue-threads.cc
961 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
962 current thread if its thread number is greater than desired thread
964 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
965 Add thread_number parameter.
966 (Workqueue::should_cancel_thread): Likewise.
967 (Workqueue::find_runnable_or_wait): Pass thread_number to
968 should_cancel_thread.
969 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
972 2011-07-22 Sriraman Tallam <tmsriram@google.com>
974 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
975 only after checking if it cannot be forced local.
976 * symtab.h (is_externally_visible): Check if the symbol is not forced
979 2011-07-15 Ian Lance Taylor <iant@google.com>
981 * options.h (class General_options): Add --print-output-format.
982 Move -EL next to -EB, for better --help output.
983 * target-select.cc: Include <cstdio>, "options.h", and
985 (Target_selector::do_target_bfd_name): New function.
986 (print_output_format): New function.
987 * target-select.h (class Target_selector): Update declarations.
988 (Target_selector::target_bfd_name): New function.
989 (print_output_format): Declare.
990 * main.cc: Include "target-select.h".
991 (main): Handle --print-output-format.
992 * gold.cc: Include "target-select.h".
993 (queue_initial_tasks): Handle --print-output-format when there are
995 * parameters.cc (parameters_force_valid_target): Give a better
996 error message if -EB/-EL does not match target.
997 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
1000 2011-07-15 Ian Lance Taylor <iant@google.com>
1002 * i386.cc (class Output_data_plt_i386): Add layout_ field.
1003 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
1004 (Output_data_plt_i386::do_write): Write address of .dynamic
1005 section to first entry in .got.plt section.
1006 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
1007 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1009 (Output_data_plt_x86_64::do_write): Write address of .dynamic
1010 section to first entry in .got.plt section.
1011 * layout.h (Layout::dynamic_section): New function.
1013 2011-07-13 Sriraman Tallam <tmsriram@google.com>
1015 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
1017 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
1018 input_section_position_, and input_section_glob_.
1019 (read_layout_from_file): Call function section_ordering_specified.
1020 * layout.h (is_section_ordering_specified): New function.
1021 (section_ordering_specified): New function.
1022 (section_ordering_specified_): New boolean member.
1023 * main.cc(main): Call load_plugins after layout object is defined.
1024 * output.cc (Output_section::add_input_section): Use
1025 function section_ordering_specified to check if section ordering is
1027 * output.cc (Output_section::add_relaxed_input_section): Use
1028 function section_ordering_specified to check if section ordering is
1030 (Output_section::update_section_layout): New function.
1031 (Output_section::sort_attached_input_sections): Check if input section
1033 * output.h (Output_section::update_section_layout): New function.
1034 * plugin.cc (get_section_count): New function.
1035 (get_section_type): New function.
1036 (get_section_name): New function.
1037 (get_section_contents): New function.
1038 (update_section_order): New function.
1039 (allow_section_ordering): New function.
1040 (Plugin::load): Add the new interfaces to the transfer vector.
1041 (Plugin_manager::load_plugins): New parameter.
1042 (Plugin_manager::all_symbols_read): New parameter.
1043 (Plugin_manager::claim_file): New parameter. Save the elf object for
1045 (Plugin_manager::get_elf_object): New function.
1046 (Plugin_manager::get_view): Change to directly use the bool to check
1047 if get_view is called from claim_file_hook.
1048 * plugin.h (input_objects): New function
1049 (Plugin__manager::load_plugins): New parameter.
1050 (Plugin_manager::claim_file): New parameter.
1051 (Plugin_manager::get_elf_object): New function.
1052 (Plugin_manager::in_claim_file_handler): New function.
1053 (Plugin_manager::in_claim_file_handler_): New member.
1054 (layout): New function.
1055 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
1056 handler with an extra parameter. Make the elf object before calling
1058 * testsuite/plugin_test.c (get_section_count): New function pointer.
1059 (get_section_type): New function pointer.
1060 (get_section_name): New function pointer.
1061 (get_section_contents): New function pointer.
1062 (update_section_order): New function pointer.
1063 (allow_section_ordering): New function pointer.
1064 (onload): Check if the new interfaces exist.
1066 2011-07-13 Ian Lance Taylor <iant@google.com>
1068 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
1070 * x86_64.cc (Target_x86_64::got_section): Likewise.
1071 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
1072 (relro_now_test_SOURCES): New variable.
1073 (relro_now_test_DEPENDENCIES): New variable.
1074 (relro_now_test_LDFLAGS): New variable.
1075 (relro_now_test_LDADD): New variable.
1076 (relro_now_test.so): New target.
1077 * testsuite/Makefile.in: Rebuild.
1079 2011-07-12 Ian Lance Taylor <iant@google.com>
1082 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
1083 GLOB_DAT relocation rather than a RELATIVE relocation for a
1084 protected symbol when creating a shared library.
1085 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1086 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
1087 * testsuite/protected_main_1.cc (main): Test that protected
1088 function has same address.
1090 2011-07-11 Ian Lance Taylor <iant@google.com>
1093 * options.h (class General_options): Add -Bgroup.
1094 * options.cc (General_options::finalize): If -Bgroup is set,
1095 default to --unresolved-symbols=report-all.
1096 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
1097 * target-reloc.h (issue_undefined_symbol_error): Handle
1098 --unresolved-symbols=report-all.
1100 2011-07-08 Ian Lance Taylor <iant@google.com>
1103 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
1104 if linker script discards key sections.
1105 (Layout::create_dynamic_symtab): Likewise.
1106 (Layout::assign_local_dynsym_offsets): Likewise.
1107 (Layout::sized_create_version_sections): Likewise.
1108 (Layout::create_interp): Likewise.
1109 (Layout::finish_dynamic_section): Likewise.
1110 (Layout::set_dynamic_symbol_size): Likewise.
1112 2011-07-08 Ian Lance Taylor <iant@google.com>
1115 * options.h (class General_options): Add --unresolved-symbols.
1116 * target-reloc.h (issue_undefined_symbol_error): Check
1117 --unresolved-symbols. Add comments.
1119 2011-07-08 Ian Lance Taylor <iant@google.com>
1121 * testsuite/odr_violation2.cc (Ordering::operator()): Make
1122 expression more complex.
1124 2011-07-08 Ian Lance Taylor <iant@google.com>
1127 * target-reloc.h (issue_undefined_symbol_error): New inline
1128 function, broken out of relocate_section.
1129 (relocate_section): Call issue_undefined_symbol_error.
1130 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1131 there is no TLS segment if we are about to issue an undefined
1133 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1135 2011-07-08 Ian Lance Taylor <iant@google.com>
1138 * resolve.cc (Symbol_table::should_override): Add fromtype
1139 parameter. Change all callers. Give error when linking together
1140 TLS and non-TLS symbol.
1141 (Symbol_table::should_override_with_special): Add fromtype
1142 parameter. Change all callers.
1143 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1144 there is no TLS segment if we have reported some errors.
1145 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1147 2011-07-08 Ian Lance Taylor <iant@google.com>
1150 * target.h (Target::plt_address_for_global): New function.
1151 (Target::plt_address_for_local): New function.
1152 (Target::plt_section_for_global): Remove.
1153 (Target::plt_section_for_local): Remove.
1154 (Target::do_plt_address_for_global): New virtual function.
1155 (Target::do_plt_address_for_local): New virtual function.
1156 (Target::do_plt_section_for_global): Remove.
1157 (Target::do_plt_section_for_local): Remove.
1158 (Target::register_global_plt_entry): Add Symbol_table and Layout
1160 * output.cc (Output_data_got::Got_entry::write): Use
1161 plt_address_for_global and plt_address_for_local.
1162 * layout.cc (Layout::add_target_dynamic_tags): Use size and
1163 address of output section.
1164 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
1165 got_irelative_, and irelative_count_ fields. Update
1167 (Output_data_plt_i386::has_irelative_section): New function.
1168 (Output_data_plt_i386::entry_count): Add irelative_count_.
1169 (Output_data_plt_i386::set_final_data_size): Likewise.
1170 (class Target_i386): Add got_irelative_ and rel_irelative_
1171 fields. Update declarations.
1172 (Target_i386::Target_i386): Initialize new fields.
1173 (Target_i386::do_plt_address_for_global): New function replacing
1174 do_plt_section_for_global.
1175 (Target_i386::do_plt_address_for_local): New function replacing
1176 do_plt_section_for_local.
1177 (Target_i386::got_section): Create got_irelative_.
1178 (Target_i386::rel_irelative_section): New function.
1179 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
1180 fields. Don't define __rel_iplt_{start,end}.
1181 (Output_data_plt_i386::add_entry): Add symtab and layout
1182 parameters. Change all callers. Use different PLT and GOT for
1184 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
1185 layout parameters. Change all callers. Use different PLT and
1187 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
1188 (Output_data_plt_i386::rel_irelative): New function.
1189 (Output_data_plt_i386::address_for_global): New function.
1190 (Output_data_plt_i386::address_for_local): New function.
1191 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
1192 IRELATIVE GOT when changing IFUNC GOT entries.
1193 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
1195 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
1196 if we didn't create an IRELATIVE GOT.
1197 (Target_i386::Relocate::relocate): Use plt_address_for_global and
1198 plt_address_for_local.
1199 (Target_i386::do_dynsym_value): Use plt_address_for_global.
1200 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
1201 got_irelative_, and irelative_count_ fields. Update
1203 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1204 Initialize new fields. Remove symtab parameter. Change all
1206 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
1208 (Output_data_plt_x86_64::has_irelative_section): New function.
1209 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
1210 (class Target_x86_64): Add got_irelative_ and rel_irelative_
1211 fields. Update declarations.
1212 (Target_x86_64::Target_x86_64): Initialize new fields.
1213 (Target_x86_64::do_plt_address_for_global): New function replacing
1214 do_plt_section_for_global.
1215 (Target_x86_64::do_plt_address_for_local): New function replacing
1216 do_plt_section_for_local.
1217 (Target_x86_64::got_section): Create got_irelative_.
1218 (Target_x86_64::rela_irelative_section): New function.
1219 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
1220 all callers. Don't create __rel_iplt_{start,end}.
1221 (Output_data_plt_x86_64::add_entry): Add symtab and layout
1222 parameters. Change all callers. Use different PLT and GOT for
1224 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
1225 layout parameters. Change all callers. Use different PLT and
1227 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
1228 parameters. Change all callers. Use different PLT and GOT for
1230 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
1231 (Output_data_plt_x86_64::rela_irelative): New function.
1232 (Output_data_plt_x86_64::address_for_global): New function.
1233 (Output_data_plt_x86_64::address_for_local): New function.
1234 (Output_data_plt_x86_64::set_final_data_size): Likewise.
1235 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
1236 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
1237 (Target_x86_64::register_global_plt_entry): Add symtab and layout
1239 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
1241 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
1242 symbols if we didn't create an IRELATIVE GOT.
1243 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
1244 plt_address_for_local.
1245 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
1246 * testsuite/ifuncvar1.c: New test file.
1247 * testsuite/ifuncvar2.c: New test file.
1248 * testsuite/ifuncvar3.c: New test file.
1249 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
1250 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
1251 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
1252 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
1253 * testsuite/Makefile.in: Rebuild.
1255 2011-07-07 Cary Coutant <ccoutant@google.com>
1257 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
1258 (two_file_test_1_ndebug.o): Likewise.
1259 (two_file_test_1b_ndebug.o): Likewise.
1260 (two_file_test_2_ndebug.o): Likewise.
1261 (two_file_test_main_ndebug.o): Likewise.
1262 (incremental_test_2): Link with no-debug versions.
1264 2011-07-06 Cary Coutant <ccoutant@google.com>
1266 * gold/incremental.cc
1267 (Output_section_incremental_inputs::write_info_blocks): Check for
1268 hidden and internal symbols.
1270 2011-07-06 Cary Coutant <ccoutant@google.com>
1272 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
1273 Check disposition for startup file.
1274 (Incremental_inputs::report_command_line): Ignore
1275 --incremental-startup-unchanged option.
1276 * options.cc (General_options::parse_incremental_startup_unchanged):
1278 (General_options::General_options): Initialize new data member.
1279 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
1280 (General_options): Add --incremental-startup-unchanged option.
1281 (General_options::incremental_startup_disposition): New function.
1282 (General_options::incremental_startup_disposition_): New data member.
1284 2011-07-06 Cary Coutant <ccoutant@google.com>
1286 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
1287 input file index to Script_info ctor.
1288 (Sized_incremental_binary::do_file_has_changed): Find the
1289 command-line argument for files named in scripts.
1290 * incremental.h (Script_info::Script_info): New ctor
1291 with input file index.
1292 (Script_info::input_file_index): New function.
1293 (Script_info::input_file_index_): New data member.
1294 (Incremental_binary::get_library): Add const.
1295 (Incremental_binary::get_script_info): Add const.
1296 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
1297 * testsuite/Makefile.am (incremental_test_5): New test case.
1298 (incremental_test_6): New test case.
1299 * testsuite/Makefile.in: Regenerate.
1301 2011-07-06 Cary Coutant <ccoutant@google.com>
1303 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
1304 debug output when command lines differ.
1306 2011-07-06 Cary Coutant <ccoutant@google.com>
1308 * incremental.cc (Incremental_inputs::report_command_line): Ignore
1309 --incremental-patch option.
1310 * layout.cc (Free_list::allocate): Extend allocation beyond original
1312 (Layout::make_output_section): Mark sections that should get
1314 * options.cc (parse_percent): New function.
1315 * options.h (parse_percent): New function.
1316 (DEFINE_percent): New macro.
1317 (General_options): Add --incremental-patch option.
1318 * output.cc (Output_section::Output_section): Initialize new data
1320 (Output_section::add_input_section): Print section name when out
1322 (Output_section::add_output_section_data): Likewise.
1323 (Output_section::set_final_data_size): Add patch space when
1324 doing --incremental-full.
1325 (Output_section::do_reset_address_and_file_offset): Remove patch
1327 (Output_segment::set_section_list_addresses): Print debug output
1328 only if --incremental-update.
1329 * output.h (Output_section::set_is_patch_space_allowed): New function.
1330 (Output_section::is_patch_space_allowed_): New data member.
1331 (Output_section::patch_space_): New data member.
1332 * parameters.cc (Parameters::incremental_full): New function.
1333 * parameters.h (Parameters::incremental_full): New function
1334 * testsuite/Makefile.am (incremental_test_2): Add test for
1335 --incremental-patch option.
1336 * testsuite/Makefile.in: Regenerate.
1337 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
1338 (t18): Remove function body.
1340 2011-07-05 Doug Kwan <dougkwan@google.com>
1343 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
1344 Arm_Address type for relocation result.
1345 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
1347 (Arm_relocate_functions::abs32): Use unaligned access.
1348 (Arm_relocate_functions::rel32): Ditto.
1349 (Arm_relocate_functions::prel31): Ditto.
1350 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
1351 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
1352 static data relocations.
1353 * testsuite/Makefile.in: Regnerate.
1354 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
1356 2011-07-05 Ian Lance Taylor <iant@google.com>
1359 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
1360 symbols if necessary.
1361 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1363 2011-07-05 Ian Lance Taylor <iant@google.com>
1366 * resolve.cc (Symbol::override_base_with_special): Simply override
1367 version with special symbol version, ignoring previous version.
1369 2011-07-05 Ian Lance Taylor <iant@google.com>
1371 * object.cc (Sized_relobj_file::include_section_group): Add
1372 information to comment about signature location.
1374 2011-07-02 Ian Lance Taylor <iant@google.com>
1377 * options.h (class General_options): Add -f and -F.
1378 * options.cc (General_options::finalize): Fatal error if -f/-F
1379 are used without -shared.
1380 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
1382 2011-07-02 Ian Lance Taylor <iant@google.com>
1384 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
1386 2011-07-01 Ian Lance Taylor <iant@google.com>
1390 * resolve.cc (Symbol::override_base_with_special): Don't override
1391 the version if the overriding symbol has a different name.
1392 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
1393 all callers. If we give an error about an undefined version,
1394 define the base version if necessary.
1395 * dynobj.h (class Versions): Update declaration.
1396 * testsuite/weak_alias_test_5.cc: New file.
1397 * testsuite/weak_alias_test.script: New file.
1398 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
1399 and versioned_alias have the right value, and call t2.
1400 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
1401 weak_alias_test_5.so.
1402 (weak_alias_test_LDADD): Likewise.
1403 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
1404 * testsuite/Makefile.in: Rebuild.
1406 2011-07-01 Ian Lance Taylor <iant@google.com>
1409 * options.h (class General_options): Support -z notext.
1410 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
1412 (two_file_shared_nonpic.so): Likewise.
1413 (two_file_shared_mixed.so): Likewise.
1414 (two_file_shared_mixed_1.so): Likewise.
1415 (weak_undef_lib_nonpic.so): Likewise.
1416 (alt/weak_undef_lib_nonpic.so): Likewise.
1417 (tls_test_shared_nonpic.so): Likewise.
1418 * testsuite/Makefile.in: Rebuild.
1420 2011-07-01 Ian Lance Taylor <iant@google.com>
1423 * configure.ac: Test whether static linking works, setting
1424 the automake conditional HAVE_STATIC.
1425 * testsuite/Makefile.am: Disable tests using -static if
1426 HAVE_STATIC is not true.
1427 * configure, testsuite/Makefile.in: Rebuild.
1429 2011-07-01 Ian Lance Taylor <iant@google.com>
1432 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
1433 Assert if we see DW_EH_PE_indirect.
1434 * target.h (Target::ehframe_datarel_base): New function.
1435 (Target::do_ehframe_datarel_base): New target function.
1436 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
1437 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
1440 2011-07-01 Ian Lance Taylor <iant@google.com>
1443 * options.h (class General_options): Add
1444 --ld-generated-unwind-info.
1445 * ehframe.cc (Fde::write): Add address parameter. Change all
1446 callers. If associated with PLT, fill in address and size.
1447 (Cie::set_output_offset): Only add merge mapping if there is an
1449 (Cie::write): Add address parameter. Change all callers.
1450 (Eh_frame::add_ehframe_for_plt): New function.
1451 * ehframe.h (class Fde): Update declarations. Move shndx_ and
1452 input_offset_ fields into union u_, with new plt field.
1453 (Fde::Fde): Adjust for new union field.
1454 (Fde::Fde) [Output_data version]: New constructor.
1455 (Fde::add_mapping): Only add merge mapping if there is an object.
1456 (class Cie): Update declarations.
1457 (class Eh_frame): Declare add_ehframe_for_plt.
1458 * layout.cc (Layout::layout_eh_frame): Break out code into
1459 make_eh_frame_section, and call it.
1460 (Layout::make_eh_frame_section): New function.
1461 (Layout::add_eh_frame_for_plt): New function.
1462 * layout.h (class Layout): Update declarations.
1463 * merge.cc (Merge_map::add_mapping): Add assertion.
1464 * i386.cc: Include "dwarf.h".
1465 (class Output_data_plt_i386): Make first_plt_entry,
1466 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
1467 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1468 and plt_eh_frame_fde.
1469 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
1470 boundary. Call add_eh_frame_for_plt if appropriate.
1471 * x86_64.cc: Include "dwarf.h".
1472 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
1473 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
1474 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1475 and plt_eh_frame_fde.
1476 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
1479 2011-06-29 Ian Lance Taylor <iant@google.com>
1482 * object.cc (Sized_relobj_file::layout_section): Change shdr
1483 parameter to be const.
1484 (Sized_relobj_file::layout_eh_frame_section): New function, broken
1486 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
1487 appropriate. Call layout_eh_frame_section.
1488 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
1490 * object.h (class Sized_relobj_file): Update declarations.
1492 2011-06-29 Ian Lance Taylor <iant@google.com>
1495 * script.cc (Token::integer_value): Accept trailing M/m/K/k
1497 (Lex::gather_token): Accept trailing M/m/K/k for integers.
1499 2011-06-29 Ian Lance Taylor <iant@google.com>
1502 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
1504 * layout.cc (Layout::layout_eh_frame): Likewise.
1506 2011-06-29 Ian Lance Taylor <iant@google.com>
1509 * layout.cc (Layout::symtab_section_shndx): New function.
1510 * layout.h (class Layout): Declare symtab_section_shndx.
1511 * output.cc (Output_section::write_header): Call it.
1513 2011-06-29 Ian Lance Taylor <iant@google.com>
1516 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
1517 symbols which are not used in a relocation.
1519 2011-06-28 Ian Lance Taylor <iant@google.com>
1522 * layout.cc (Layout::segment_precedes): Don't crash if a linker
1523 script create indistinguishable segments.
1524 (Layout::set_segment_offsets): Use stable_sort when sorting
1525 segments. Pass this to Compare_segments constructor.
1526 * layout.h (class Layout): Make segment_precedes non-static.
1527 (class Compare_segments): Change from struct to class. Add
1528 layout_ field. Add constructor.
1529 * script-sections.cc
1530 (Script_sections::attach_sections_using_phdrs_clause): Rename
1531 local orphan to is_orphan. Don't report failure to put empty
1532 section in segment. On attachment failure, report name of
1533 section, and attach to first PT_LOAD segment.
1535 2011-06-28 Ian Lance Taylor <iant@google.com>
1538 * target-select.cc (Target_selector::Target_selector): Add
1539 emulation parameter. Change all callers.
1540 (select_target_by_bfd_name): Rename from select_target_by_name.
1542 (select_target_by_emulation): New function.
1543 (supported_emulation_names): New function.
1544 * target-select.h (class Target_selector): Add emulation_ field.
1545 Update declarations.
1546 (Target_selector::recognize_by_bfd_name): Rename from
1547 recognize_by_name. Change all callers.
1548 (Target_selector::supported_bfd_names): Rename from
1549 supported_names. Change all callers.
1550 (Target_selector::recognize_by_emulation): New function.
1551 (Target_selector::supported_emulations): New function.
1552 (Target_selector::emulation): New function.
1553 (Target_selector::do_recognize_by_bfd_name): Rename from
1554 do_recognize_by_name. Change all callers.
1555 (Target_selector::do_supported_bfd_names): Rename from
1556 do_supported_names. Change all callers.
1557 (Target_selector::do_recognize_by_emulation): New function.
1558 (Target_selector::do_supported_emulations): New function.
1559 (select_target_by_bfd_name): Change name in declaration.
1560 (select_target_by_emulation): Declare.
1561 (supported_emulation_names): Declare.
1562 * parameters.cc (parameters_force_valid_target): Try to find
1563 target based on emulation from -m option.
1564 * options.h (class General_options): Change doc string for -m.
1565 * options.cc (help): Print emulations.
1566 (General_options::parse_V): Likewise.
1567 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1568 Add emulation parameter. Change all callers.
1570 2011-06-28 Ian Lance Taylor <iant@google.com>
1572 * target.h (class Target): Add osabi_ field.
1573 (Target::osabi): New function.
1574 (Target::set_osabi): New function.
1575 (Target::Target): Initialize osabi_.
1576 (Target::do_adjust_elf_header): Make pure virtual.
1577 (Sized_target::do_adjust_elf_header): Declare.
1578 * target.cc (Sized_target::do_adjust_elf_header): New function.
1579 (class Sized_target): Instantiate all versions.
1580 * freebsd.h (class Target_freebsd): Remove.
1581 (Target_selector_freebsd::do_recognize): Call set_osabi on
1583 (Target_selector_freebsd::do_recognize_by_name): Likewise.
1584 (Target_selector_freebsd::set_osabi): Remove.
1585 * i386.cc (class Target_i386): Inherit from Sized_target rather
1586 than Target_freebsd.
1587 * x86_64.cc (class Target_x86_64): Likewise.
1589 2011-06-28 Ian Lance Taylor <iant@google.com>
1591 * target.h (Target::can_check_for_function_pointers): Rewrite.
1593 (Target::can_icf_inline_merge_sections): Likewise.
1594 (Target::section_may_have_icf_unsafe_poineters): Likewise.
1595 (Target::Target_info): Add can_icf_inline_merge_sections field.
1596 (Target::do_can_check_for_function_pointers): New virtual
1598 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
1599 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
1600 from can_check_for_function_pointers, move in file.
1601 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
1602 section_may_have_icf_unsafe_poineters, move in file.
1603 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
1604 * i386.cc (Target_i386::do_can_check_for_function_pointers):
1605 Rename from can_check_for_function_pointers, move in file.
1606 (Target_i386::can_icf_inline_merge_sections): Remove.
1607 (Target_i386::i386_info): Initialize
1608 can_icf_inline_merge_sections.
1609 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1610 Initialize can_icf_inline_merge_sections.
1611 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
1612 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
1613 Rename from can_check_for_function_pointers, move in file.
1614 (Target_x86_64::can_icf_inline_merge_sections): Remove.
1615 (Target_x86_64::x86_64_info): Initialize
1616 can_icf_inline_merge_sections.
1617 * testsuite/testfile.cc (Target_test::test_target_info):
1619 * icf.cc (get_section_contents): Correct formatting.
1621 2011-06-27 Ian Lance Taylor <iant@google.com>
1623 * symtab.cc (Symbol::versioned_name): New function.
1624 (Symbol_table::add_to_final_symtab): Use versioned_name when
1626 (Symbol_table::sized_write_symbol): Likewise.
1627 * symtab.h (class Symbol): Declare versioned_name.
1628 * stringpool.h (class Stringpool_template): Add variant of add
1629 which takes a std::basic_string.
1630 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
1631 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
1632 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
1633 (ver_test_12.o): New target.
1634 * testsuite/Makefile.in: Rebuild.
1636 2011-06-27 Doug Kwan <dougkwan@google.com>
1638 * arm.cc (Arm_relocate_functions::thm_jump8,
1639 Arm_relocate_functions::thm_jump11): Use a wider signed
1640 type to compute offset.
1641 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
1643 * testsuite/Makefile.in: Regenerate.
1644 * testsuite/arm_branch_in_range.sh: Check test results of
1645 arm_thm_jump11 and arm_thm_jump8.
1646 * testsuite/arm_thm_jump11.s: New test source file.
1647 * testsuite/arm_thm_jump11.t: New linker script.
1648 * testsuite/arm_thm_jump8.s: New test source file.
1649 * testsuite/arm_thm_jump8.t: New linker script.
1651 2011-06-24 Ian Lance Taylor <iant@google.com>
1653 * layout.cc: Include "object.h".
1654 (ctors_sections_in_init_array): New static variable.
1655 (Layout::is_ctors_in_init_array): New function.
1656 (Layout::layout): Add entry to ctors_sections_in_init_array if
1658 * layout.h (class Layout): Declare is_ctors_in_init_array.
1659 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
1660 is_ctors_reverse_view is set.
1661 (Sized_relobj_file::write_sections): Add layout parameter. Change
1662 all callers. Set is_ctors_reverse_view field of View_size.
1663 (Sized_relobj_file::reverse_words): New function.
1664 * object.h (Sized_relobj_file::View_size): Add
1665 is_ctors_reverse_view field.
1666 (class Sized_relobj_file): Update declarations.
1667 * testsuite/initpri3.c: New test.
1668 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
1670 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
1671 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
1672 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
1673 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
1674 * testsuite/Makefile.in: Rebuild.
1676 2011-06-24 Cary Coutant <ccoutant@google.com>
1678 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
1679 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
1680 (debug_msg_cdebug.err): New targets.
1681 * testsuite/Makefile.in: Regenerate.
1682 * testsuite/debug_msg.sh: Check output of link with compressed debug.
1683 Fix checks for link with shared library.
1685 2011-06-24 Doug Kwan <dougkwan@google.com>
1687 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
1688 skip empty text sections.
1689 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
1691 2011-06-22 Ian Lance Taylor <iant@google.com>
1694 * options.h (class General_options): Add --ctors-in-init-array.
1695 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
1696 friends as SHT_PROGBITS for merging sections.
1697 (Layout::layout): Remove special handling of .init_array and
1698 friends. Don't sort if doing relocatable link. Sort for .ctors
1699 and .dtors if ctors_in_init_array.
1700 (Layout::make_output_section): Force correct section types for
1701 .init_array and friends. Don't sort if doing relocatable link,
1702 Don't sort .ctors and .dtors if ctors_in_init_array.
1703 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
1704 (Layout::output_section_name): Add relobj parameter. Change all
1705 callers. Handle .ctors. and .dtors. in code rather than table.
1706 Handle .ctors and .dtors if ctors_in_init_array.
1707 (Layout::match_file_name): New function, moved from output.cc.
1708 * layout.h (class Layout): Update declarations.
1709 * output.cc: Include "layout.h".
1710 (Input_section_sort_entry::get_priority): New function.
1711 (Input_section_sort_entry::match_file_name): Just call
1712 Layout::match_file_name.
1713 (Output_section::Input_section_sort_init_fini_compare::operator()):
1714 Handle .ctors and .dtors. Sort by explicit priority rather than
1716 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
1717 * testsuite/initpri2.c: New test.
1718 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
1719 (check_PROGRAMS): Add initpri2.
1720 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
1721 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
1722 * configure, testsuite/Makefile.in: Rebuild.
1724 2011-06-19 Ian Lance Taylor <iant@google.com>
1727 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
1728 .interp section to a PT_INTERP segment even if we have seen a
1729 --dynamic-linker option. Don't do it if we have seen a PHDRS
1730 clause in a linker script.
1731 (Layout::finalize): Don't create a .interp section if we've
1732 already create a PT_INTERP segment.
1733 (Layout::create_interp): Always call choose_output_section (revert
1734 patch of 2011-06-17). Don't create PT_INTERP segment.
1735 * script-sections.cc
1736 (Script_sections::create_note_and_tls_segments): Add a .interp
1737 section to a PT_INTERP segment even if we have seen a
1738 --dynamic-linker option.
1740 2011-06-18 Ian Lance Taylor <iant@google.com>
1742 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
1743 merely because a non-PT_LOAD segment has a dynamic reloc.
1745 2011-06-18 Ian Lance Taylor <iant@google.com>
1747 * layout.cc (Layout::finish_dynamic_section): Don't create
1748 DT_FLAGS entry if not needed.
1750 2011-06-18 Ian Lance Taylor <iant@google.com>
1753 * layout.cc (Layout::layout_eh_frame): Correct handling of
1754 writable .eh_frame section.
1756 2011-06-17 Ian Lance Taylor <iant@google.com>
1759 * resolve.cc (Symbol_table::resolve): Don't give an error if a
1760 symbol is redefined with the exact same object and value.
1762 2011-06-17 Ian Lance Taylor <iant@google.com>
1765 * layout.h (class Layout): Add interp_segment_ field.
1766 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
1767 (Layout::attach_allocated_section_to_segment): If making shared
1768 library, put .interp section in PT_INTERP segment.
1769 (Layout::finalize): Also call create_interp if -dynamic-linker
1771 (Layout::create_interp): Assert that there is no PT_INTERP
1772 segment. If not using a SECTIONS clause, use make_output_section.
1773 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
1774 * script-sections.cc
1775 (Script_sections::create_note_and_tls_segments): If making shared
1776 library, put .interp section in PT_INTERP segment.
1778 2011-06-17 Ian Lance Taylor <iant@google.com>
1780 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
1781 when making a shared library.
1783 2011-06-17 Ian Lance Taylor <iant@google.com>
1785 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
1786 parameter. Change all callers. Don't issue warning about PC32
1787 against locally defined symbol.
1789 2011-06-16 Ian Lance Taylor <iant@google.com>
1791 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
1792 occurs in same object.
1794 2011-06-14 Alan Modra <amodra@gmail.com>
1796 * po/POTFILES.in: Regenerate.
1798 2011-06-09 Ian Lance Taylor <iant@google.com>
1800 * script-sections.cc
1801 (Orphan_output_section::set_section_addresses): For a relocatable
1802 link set address to 0.
1804 2011-06-09 Cary Coutant <ccoutant@google.com>
1807 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
1808 used with --compress-debug-sections.
1809 * gold/object.cc (Sized_relobj_file::do_layout): Report
1810 uncompressed size of compressed input sections.
1812 2011-06-08 Cary Coutant <ccoutant@google.com>
1815 * testsuite/two_file_test_2_v1.cc: Change initialization of
1816 v2 to keep it in .data.
1818 2011-06-07 Cary Coutant <ccoutant@google.com>
1820 * common.cc (Symbol_table::do_allocate_commons_list): Call
1822 * errors.cc (Errors::fatal): Adjust call to gold_exit.
1823 (Errors::fallback): New function.
1824 (gold_fallback): New function.
1825 * errors.h (Errors::fallback): New function.
1826 * gold.cc (gold_exit): Change status parameter to enum; adjust
1828 (queue_initial_tasks): Call gold_fallback.
1829 * gold.h: Include cstdlib.
1830 (Exit_status): New enum type.
1831 (gold_exit): Change status parameter to enum.
1832 (gold_fallback): New function.
1833 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
1834 (Layout::create_symtab_sections): Likewise.
1835 (Layout::create_shdrs): Likewise.
1836 * main.cc (main): Adjust call to gold_exit.
1837 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
1838 (Output_data_got::add_got_entry_pair): Likewise.
1839 (Output_section::add_input_section): Likewise.
1840 (Output_section::add_output_section_data): Likewise.
1841 (Output_segment::set_section_list_addresses): Likewise.
1842 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
1844 2011-06-07 Cary Coutant <ccoutant@google.com>
1846 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
1847 for incremental links.
1848 * output.cc (Output_segment::set_section_list_addresses): Remove
1849 FIXME and test for TLS or BSS.
1851 2011-06-07 Cary Coutant <ccoutant@google.com>
1853 * testsuite/Makefile.am: Add incremental_copy_test,
1854 incremental_common_test_1.
1855 * testsuite/Makefile.in: Regenerate.
1856 * testsuite/common_test_1_v1.c: New source file.
1857 * testsuite/common_test_1_v2.c: New source file.
1858 * testsuite/copy_test_v1.cc: New source file.
1860 2011-06-07 Cary Coutant <ccoutant@google.com>
1862 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
1863 update, allocate common from bss section's free list.
1864 * incremental-dump.cc (dump_incremental_inputs): Print flag for
1865 linker-defined symbols.
1866 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1867 Skip GOT and PLT entries that are no longer referenced.
1868 (Output_section_incremental_inputs::write_info_blocks): Mark
1869 linker-defined symbols.
1870 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
1871 * output.cc (Output_section::allocate): New function.
1872 * output.h (Output_section::allocate): New function.
1873 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
1874 linker-defined symbols.
1875 (Symbol::override_base_with_special): Copy is_predefined_ flag.
1876 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
1877 (Symbol::init_base_output_data): Likewise.
1878 (Symbol::init_base_output_segment): Likewise.
1879 (Symbol::init_base_constant): Likewise.
1880 (Sized_symbol::init_output_data): Likewise.
1881 (Sized_symbol::init_output_segment): Likewise.
1882 (Sized_symbol::init_constant): Likewise.
1883 (Symbol_table::do_define_in_output_data): Likewise.
1884 (Symbol_table::do_define_in_output_segment): Likewise.
1885 (Symbol_table::do_define_as_constant): Likewise.
1886 * symtab.h (Symbol::is_predefined): New function.
1887 (Symbol::init_base_output_data): Add is_predefined parameter.
1888 (Symbol::init_base_output_segment): Likewise.
1889 (Symbol::init_base_constant): Likewise.
1890 (Symbol::is_predefined_): New data member.
1891 (Sized_symbol::init_output_data): Add is_predefined parameter.
1892 (Sized_symbol::init_output_segment): Likewise.
1893 (Sized_symbol::init_constant): Likewise.
1894 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
1896 2011-06-07 Cary Coutant <ccoutant@google.com>
1898 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
1899 instead of emit_copy_reloc.
1900 (Copy_relocs::emit_copy_reloc): Refactor.
1901 (Copy_relocs::make_copy_reloc): New function.
1902 (Copy_relocs::add_copy_reloc): Remove.
1903 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
1905 (Copy_relocs::make_copy_reloc): New function.
1906 (Copy_relocs::add_copy_reloc): Remove.
1907 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
1908 unchanged input files.
1909 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
1910 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
1911 Reserve BSS space for COPY relocations.
1912 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1913 (Output_section_incremental_inputs::write_info_blocks): Record
1914 whether a symbol is copied from a shared object.
1915 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
1916 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
1917 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
1918 (Incremental_input_entry_reader::get_output_symbol_index): Add
1920 (Incremental_binary::emit_copy_relocs): New function.
1921 (Incremental_binary::do_emit_copy_relocs): New function.
1922 (Sized_incremental_binary::Sized_incremental_binary): Initialize
1924 (Sized_incremental_binary::add_copy_reloc): New function.
1925 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1926 (Sized_incremental_binary::Copy_reloc): New struct.
1927 (Sized_incremental_binary::Copy_relocs): New typedef.
1928 (Sized_incremental_binary::copy_relocs_): New data member.
1929 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
1930 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
1931 * target.h (Sized_target::emit_copy_reloc): New function.
1932 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
1934 2011-06-02 Cary Coutant <ccoutant@google.com>
1937 * gold/archive.cc (Archive::Archive): Initialize new data member.
1938 (Archive::include_all_members): Return if archive has already been
1940 * gold/archive.h (Archive::include_all_members_): New data member.
1942 2011-06-02 Nick Clifton <nickc@redhat.com>
1944 * dynobj.h: Fix spelling mistake in comment.
1945 * output.cc: Likewise.
1947 2011-05-31 Doug Kwan <dougkwan@google.com>
1951 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
1952 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
1953 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
1954 redundant arm_exidx_test.so.
1955 * testsuite/Makefile.in: Regenerate.
1956 (check_SCRIPTS): Add pr12826.sh
1957 (check_DATA): Add pr12826.stdout
1958 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
1959 * testsuite/pr12826.sh: New file.
1960 * testsuite/pr12826_1.s: Ditto.
1961 * testsuite/pr12826_1.s: Ditto.
1963 2011-05-30 Ian Lance Taylor <iant@google.com>
1965 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
1968 2011-05-29 Ian Lance Taylor <iant@google.com>
1971 * testsuite/Makefile.am: Use different file name for two_file_test
1972 temporary file for each incremental test.
1973 * testsuite/Makefile.in: Rebuild.
1975 2011-05-29 Ian Lance Taylor <iant@google.com>
1977 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
1978 binary input file is empty.
1980 2011-05-27 Ian Lance Taylor <iant@google.com>
1982 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
1983 (ver_test_9.so): Likewise.
1984 * testsuite/Makefile.in: Rebuild.
1986 2011-05-26 Cary Coutant <ccoutant@google.com>
1988 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
1989 * incremental.cc (Incremental_inputs::report_input_section): Fix
1990 comment, indentation.
1991 (Incremental_inputs::report_comdat_group): New function.
1992 (Output_section_incremental_inputs::set_final_data_size): Adjust size
1993 of data for incremental input file entry.
1994 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
1995 group count, COMDAT group signatures.
1996 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
1997 an unchanged input file.
1998 * incremental.h (Incremental_object_entry::Incremental_object_entry):
1999 Initialize new data member.
2000 (Incremental_object_entry::add_comdat_group): New function.
2001 (Incremental_object_entry::get_comdat_group_count): New function.
2002 (Incremental_object_entry::get_comdat_signature_key): New function.
2003 (Incremental_object_entry::groups_): New data member.
2004 (Incremental_inputs::report_comdat_group): New function.
2005 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
2006 data for incremental input file entry.
2007 (Incremental_input_entry_reader::get_comdat_group_count): New function.
2008 (Incremental_input_entry_reader::get_input_section): Adjust size of
2009 data for incremental input file entry.
2010 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
2011 (Incremental_input_entry_reader::get_comdat_group_signature): New
2013 * object.cc (Sized_relobj::include_section_group): Report kept
2014 COMDAT groups for incremental links.
2016 2011-05-24 David Meyer <pdox@google.com>
2018 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
2019 with name parameter. Add found_name parameter.
2020 * fileread.cc (Input_file::find_file): Adjust code accordingly.
2021 * dirsearch.h (class Dirsearch): Update declaration.
2023 2011-05-24 Ian Lance Taylor <iant@google.com>
2025 * archive.cc (Library_base::should_include_member): Pull in object
2026 from archive if it defines the entry symbol.
2027 * parameters.cc (Parameters::entry): New function.
2028 * parameters.h (class Parameters): Declare entry.
2029 * output.h (class Output_file_header): Remove entry_ field.
2030 * output.cc (Output_file_header::Output_file_header): Remove entry
2031 parameter. Change all callers.
2032 (Output_file_header::entry): Use parameters->entry.
2033 * gold.cc (queue_middle_tasks): Likewise.
2034 * plugin.cc (Plugin_hook::run): Likewise.
2036 2011-05-24 Cary Coutant <ccoutant@google.com>
2038 * gold.cc (queue_initial_tasks): Pass incremental base filename
2039 to Output_file::open_base_file; don't print error message.
2040 * incremental-dump.cc (main): Adjust call to
2041 Output_file::open_for_modification.
2042 * incremental-dump.cc (main): Likewise.
2043 * incremental.cc (Incremental_inputs::report_command_line):
2044 Ignore --incremental-base option when comparing command lines.
2045 Ignore parameter when given as separate argument.
2046 * options.h (class General_options): Add --incremental-base.
2047 * output.cc (Output_file::Output_file):
2048 (Output_file::open_base_file): Add base_name and writable parameters;
2049 read base file into new file; print error message here.
2050 (Output_file::map_no_anonymous): Add writable parameter; adjust all
2052 * output.h (Output_file::open_for_modification): Rename to...
2053 (Output_file::open_base_file): ...this; add base_name and
2054 writable parameters; adjust all callers.
2055 (Output_file::map_no_anonymous): Add writable parameter; adjust all
2057 * testsuite/Makefile.am (incremental_test_4): Test
2059 * testsuite/Makefile.in: Regenerate.
2061 2011-05-24 Cary Coutant <ccoutant@google.com>
2063 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
2065 * testsuite/Makefile.in: Regenerate.
2066 * testsuite/two_file_test_1_v1.cc: New test source file.
2067 * testsuite/two_file_test_1b_v1.cc: New test source file.
2068 * testsuite/two_file_test_2_v1.cc: New test source file.
2070 2011-05-24 Cary Coutant <ccoutant@google.com>
2072 * dynobj.h (Dynobj::do_dynobj): New function.
2073 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
2074 flag and soname for shared objects.
2075 * incremental.cc (Incremental_inputs::report_object): Make
2076 either Incremental_object_entry or Incremental_dynobj_entry; add
2077 soname to string table.
2078 (Incremental_inputs::report_input_section): Add assertion.
2079 (Output_section_incremental_inputs::set_final_data_size): Adjust
2080 type of input file entry for shared libraries; adjust size of
2081 shared library info entry.
2082 (Output_section_incremental_inputs::write_input_files): Write
2083 as_needed flag for shared libraries.
2084 (Output_section_incremental_inputs::write_info_blocks): Adjust type
2085 of input file entry for shared libraries; write soname.
2086 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
2087 soname from incremental info.
2088 * incremental.h (enum Incremental_input_flags): Add
2089 INCREMENTAL_INPUT_AS_NEEDED.
2090 (Incremental_input_entry::Incremental_input_entry): Initialize new
2092 (Incremental_input_entry::set_as_needed): New function.
2093 (Incremental_input_entry::as_needed): New function.
2094 (Incremental_input_entry::do_dynobj_entry): New function.
2095 (Incremental_input_entry::as_needed_): New data member.
2096 (Incremental_object_entry::Incremental_object_entry): Don't check
2098 (Incremental_object_entry::do_type): Likewise.
2099 (class Incremental_dynobj_entry): New class.
2100 (Incremental_input_entry_reader::as_needed): New function.
2101 (Incremental_input_entry_reader::get_soname): New function.
2102 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
2103 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
2104 size of shared library info entry.
2105 * layout.cc (Layout::finish_dynamic_section): Don't test for
2106 incremental link when adding DT_NEEDED entries.
2107 * object.h (Object::Object): Initialize new data member.
2108 (Object::dynobj): New function.
2109 (Object::set_as_needed): New function.
2110 (Object::as_needed): New function.
2111 (Object::do_dynobj): New function.
2112 (Object::as_needed_): New data member.
2114 2011-05-24 Cary Coutant <ccoutant@google.com>
2116 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
2117 info; adjust display of GOT entries.
2118 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2119 vector of input objects; remove file_status_.
2120 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
2121 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
2122 got_plt reader; call target hooks to reserve GOT entries.
2123 (Output_section_incremental_inputs::set_final_data_size): Adjust size
2124 of input file info header and GOT info entry.
2125 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
2127 (Got_plt_view_info::got_descriptor): Remove.
2128 (Got_plt_view_info::sym_index): New data member.
2129 (Got_plt_view_info::input_index): New data member.
2130 (Local_got_offset_visitor::visit): Write input file index.
2131 (Global_got_offset_visitor::visit): Write 0 for input file index.
2132 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
2133 with sym_index and input_index.
2134 (Output_section_incremental_inputs::write_got_plt): Adjust size of
2135 incremental info GOT entry; replace got_descriptor with input_index.
2136 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
2137 map from input file index to object.
2138 (Sized_relobj_incr::do_layout): Replace direct data member reference
2139 with accessor function.
2140 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
2141 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
2142 Adjust size of input file info header.
2143 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
2144 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
2145 (Incremental_input_entry_reader::get_input_section): Adjust size of
2146 input file info header.
2147 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
2148 of incremental info GOT entry.
2149 (Incremental_got_plt_reader::get_got_desc): Remove.
2150 (Incremental_got_plt_reader::get_got_symndx): New function.
2151 (Incremental_got_plt_reader::get_got_input_index): New function.
2152 (Sized_incremental_binary::Sized_incremental_binary): Remove
2153 file_status_; add input_objects_.
2154 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
2155 (Sized_incremental_binary::set_file_is_unchanged): Remove.
2156 (Sized_incremental_binary::file_is_unchanged): Remove.
2157 (Sized_incremental_binary::set_input_object): New function.
2158 (Sized_incremental_binary::input_object): New function.
2159 (Sized_incremental_binary::file_status_): Remove.
2160 (Sized_incremental_binary::input_objects_): New data member.
2161 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
2163 (Sized_relobj_incr::invalid_address): Move to base class.
2164 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
2166 (Sized_relobj_incr::do_output_section_offset): Likewise.
2167 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
2168 (Sized_relobj_incr::section_offsets_): Likewise.
2169 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
2171 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
2172 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
2173 with accessor function.
2174 (Sized_relobj_file::do_layout): Likewise.
2175 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
2176 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
2177 (Sized_relobj_file::compute_final_local_value): Replace refs to
2178 section_offsets_ with accessor function.
2179 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
2180 * object.h (Relobj::Relobj): Initialize new data members.
2181 (Relobj::add_dyn_reloc): New function.
2182 (Relobj::first_dyn_reloc): New function.
2183 (Relobj::dyn_reloc_count): New function.
2184 (Relobj::first_dyn_reloc_): New data member.
2185 (Relobj::dyn_reloc_count_): New data member.
2186 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
2188 (Sized_relobj::Address): New typedef.
2189 (Sized_relobj::invalid_address): Move here from child class.
2190 (Sized_relobj::Sized_relobj): Initialize new data members.
2191 (Sized_relobj::sized_relobj): New function.
2192 (Sized_relobj::is_output_section_offset_invalid): Move here from
2194 (Sized_relobj::get_output_section_offset): Likewise.
2195 (Sized_relobj::local_has_got_offset): Likewise.
2196 (Sized_relobj::local_got_offset): Likewise.
2197 (Sized_relobj::set_local_got_offset): Likewise.
2198 (Sized_relobj::do_for_all_local_got_entries): Likewise.
2199 (Sized_relobj::clear_got_offsets): New function.
2200 (Sized_relobj::section_offsets): Move here from child class.
2201 (Sized_relobj::do_output_section_offset): Likewise.
2202 (Sized_relobj::do_set_section_offset): Likewise.
2203 (Sized_relobj::Local_got_offsets): Likewise.
2204 (Sized_relobj::local_got_offsets_): Likewise.
2205 (Sized_relobj::section_offsets_): Likewise.
2206 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
2208 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
2210 (Sized_relobj_file::sized_relobj): New function
2211 (Sized_relobj_file::local_has_got_offset): Move to base class.
2212 (Sized_relobj_file::local_got_offset): Likewise.
2213 (Sized_relobj_file::set_local_got_offset): Likewise.
2214 (Sized_relobj_file::get_output_section_offset): Likewise.
2215 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
2216 (Sized_relobj_file::do_output_section_offset): Likewise.
2217 (Sized_relobj_file::do_set_section_offset): Likewise.
2218 (Sized_relobj_file::Local_got_offsets): Likewise.
2219 (Sized_relobj_file::local_got_offsets_): Likewise.
2220 (Sized_relobj_file::section_offsets_): Likewise.
2221 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
2223 (set_needs_dynsym_index): Convert relobj to derived class pointer.
2224 (Output_reloc::get_symbol_index): Likewise.
2225 (Output_reloc::local_section_offset): Likewise.
2226 (Output_reloc::get_address): Likewise.
2227 (Output_reloc::symbol_value): Likewise.
2228 (Output_data_got::reserve_slot): Move to class definition.
2229 (Output_data_got::reserve_local): New function.
2230 (Output_data_got::reserve_slot_for_global): Remove.
2231 (Output_data_got::reserve_global): New function.
2232 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
2233 (all constructors, two instantiations).
2234 (Output_reloc::get_relobj): New function (two instantiations).
2235 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
2236 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
2237 (Output_data_reloc::add_global): Adjust type of relobj.
2238 (Output_data_reloc::add_global_relative): Likewise.
2239 (Output_data_reloc::add_symbolless_global_addend): Likewise.
2240 (Output_data_reloc::add_local): Likewise.
2241 (Output_data_reloc::add_local_relative): Likewise.
2242 (Output_data_reloc::add_symbolless_local_addend): Likewise.
2243 (Output_data_reloc::add_local_section): Likewise.
2244 (Output_data_reloc::add_output_section): Likewise.
2245 (Output_data_reloc::add_absolute): Likewise.
2246 (Output_data_reloc::add_target_specific): Likewise.
2247 (Output_data_got::reserve_slot): Move definition here.
2248 (Output_data_got::reserve_local): New function.
2249 (Output_data_got::reserve_global): New function.
2250 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
2251 section_offsets_ with accessor function.
2252 (Sized_relobj_file::write_sections): Likewise.
2253 (Sized_relobj_file::do_relocate_sections): Likewise.
2254 * target.h (Sized_target::reserve_local_got_entry): New function.
2255 (Sized_target::reserve_global_got_entry): New function.
2256 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
2257 (Target_x86_64::reserve_global_got_entry): New function.
2258 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
2260 2011-05-23 Cary Coutant <ccoutant@google.com>
2262 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
2263 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
2264 bit when checking got_type.
2265 * incremental.cc (Sized_incremental_binary::setup_readers):
2266 Store symbol table and string table locations; initialize bit vector
2267 of file status flags.
2268 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
2270 (Sized_incremental_binary::do_process_got_plt): New function.
2271 (Sized_incremental_binary::get_symtab_view): Use stored locations.
2272 (Output_section_incremental_inputs::set_final_data_size): Record
2273 file index for each input file.
2274 (Output_section_incremental_inputs::write_got_plt): Store file index
2275 instead of input entry offset for each GOT entry.
2277 (Incremental_input_entry::Incremental_input_entry): Initialize new
2279 (Incremental_input_entry::set_offset): Store file index.
2280 (Incremental_input_entry::get_file_index): New function.
2281 (Incremental_input_entry::file_index_): New data member.
2282 (Incremental_binary::process_got_plt): New function.
2283 (Incremental_binary::do_process_got_plt): New function.
2284 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2286 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
2287 (Sized_incremental_binary::set_file_is_unchanged): New function.
2288 (Sized_incremental_binary::file_is_unchanged): New function.
2289 (Sized_incremental_binary::do_process_got_plt): New function.
2290 (Sized_incremental_binary::file_status_): New data member.
2291 (Sized_incremental_binary::main_symtab_loc_): New data member.
2292 (Sized_incremental_binary::main_strtab_loc_): New data member.
2293 * output.cc (Output_data_got::Got_entry::write): Add case
2295 (Output_data_got::add_global): Call add_got_entry.
2296 (Output_data_got::add_global_plt): Likewise.
2297 (Output_data_got::add_global_with_rel): Likewise.
2298 (Output_data_got::add_global_with_rela): Likewise.
2299 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
2300 (Output_data_got::add_global_pair_with_rela): Likewise.
2301 (Output_data_got::add_local): Call add_got_entry.
2302 (Output_data_got::add_local_plt): Likewise.
2303 (Output_data_got::add_local_with_rel): Likewise.
2304 (Output_data_got::add_local_with_rela): Likewise.
2305 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
2306 (Output_data_got::add_local_pair_with_rela): Likewise.
2307 (Output_data_got::reserve_slot): New function.
2308 (Output_data_got::reserve_slot_for_global): New function.
2309 (Output_data_got::add_got_entry): New function.
2310 (Output_data_got::add_got_entry_pair): New function.
2311 (Output_section::add_output_section_data): Edit FIXME.
2313 (Output_section_data_build::Output_section_data_build): New
2314 constructor with size parameter.
2315 (Output_data_space::Output_data_space): Likewise.
2316 (Output_data_got::Output_data_got): Initialize new data member; new
2317 constructor with size parameter.
2318 (Output_data_got::add_constant): Call add_got_entry.
2319 (Output_data_got::reserve_slot): New function.
2320 (Output_data_got::reserve_slot_for_global): New function.
2321 (class Output_data_got::Got_entry): Add RESERVED_CODE.
2322 (Output_data_got::add_got_entry): New function.
2323 (Output_data_got::add_got_entry_pair): New function.
2324 (Output_data_got::free_list_): New data member.
2325 * target.h (Sized_target::init_got_plt_for_update): New function.
2326 (Sized_target::register_global_plt_entry): New function.
2327 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2328 Initialize new data member; call init; add constructor with PLT count.
2329 (Output_data_plt_x86_64::init): New function.
2330 (Output_data_plt_x86_64::add_relocation): New function.
2331 (Output_data_plt_x86_64::reserve_slot): New function.
2332 (Output_data_plt_x86_64::free_list_): New data member.
2333 (Target_x86_64::init_got_plt_for_update): New function.
2334 (Target_x86_64::register_global_plt_entry): New function.
2335 (Output_data_plt_x86_64::add_entry): Allocate from free list for
2336 incremental updates.
2337 (Output_data_plt_x86_64::add_relocation): New function.
2338 * testsuite/object_unittest.cc (Object_test): Set default options.
2340 2011-05-16 Ian Lance Taylor <iant@google.com>
2342 * options.h (class General_options): Make -i a synonym for -r.
2344 2011-05-16 Ian Lance Taylor <iant@google.com>
2346 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
2348 2011-05-10 Cary Coutant <ccoutant@google.com>
2350 * object.cc (Sized_relobj::do_count_local_symbols): Check for
2353 2011-05-06 Ian Lance Taylor <iant@google.com>
2355 * layout.cc (Layout::layout): If the output section flags change,
2356 update the ordering.
2358 2011-04-25 Cary Coutant <ccoutant@google.com>
2360 * incremental-dump.cc (dump_incremental_inputs): Print local
2361 symbol info for each input file.
2363 (Output_section_incremental_inputs::set_final_data_size): Add local
2364 symbol info to input file entries in incremental info.
2365 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2366 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
2367 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
2368 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
2370 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
2371 (Sized_incr_relobj::do_relocate): Write the local symbols.
2372 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
2373 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
2374 Adjust size of input file header.
2375 (Incremental_inputs_reader::get_local_symbol_offset): New function.
2376 (Incremental_inputs_reader::get_local_symbol_count): New function.
2377 (Incremental_inputs_reader::get_input_section): Adjust size of input
2379 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
2380 (Sized_incr_relobj::This): New typedef.
2381 (Sized_incr_relobj::sym_size): New const data member.
2382 (Sized_incr_relobj::Local_symbol): New struct.
2383 (Sized_incr_relobj::do_output_local_symbol_count): New function.
2384 (Sized_incr_relobj::do_local_symbol_offset): New function.
2385 (Sized_incr_relobj::local_symbol_count_): New data member.
2386 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
2387 (Sized_incr_relobj::local_symbol_index_): New data member.
2388 (Sized_incr_relobj::local_symbol_offset_): New data member.
2389 (Sized_incr_relobj::local_dynsym_offset_): New data member.
2390 (Sized_incr_relobj::local_symbols_): New data member.
2391 * object.h (Relobj::output_local_symbol_count): New function.
2392 (Relobj::local_symbol_offset): New function.
2393 (Relobj::do_output_local_symbol_count): New function.
2394 (Relobj::do_local_symbol_offset): New function.
2395 (Sized_relobj::do_output_local_symbol_count): New function.
2396 (Sized_relobj::do_local_symbol_offset): New function.
2398 2011-04-22 Vladimir Simonov <sv@sw.ru>
2400 * descriptors.cc (set_close_on_exec): New function.
2401 (Descriptors::open): Use set_close_on_exec.
2402 * output.cc (S_ISLNK): Define if not defined.
2404 2011-04-22 Cary Coutant <ccoutant@google.com>
2406 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2408 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2409 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
2410 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
2412 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
2413 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
2414 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
2416 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
2418 (Incremental_binary::apply_incremental_relocs): New function.
2419 (Incremental_binary::do_apply_incremental_relocs): New function.
2420 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2422 (Sized_incremental_binary::add_global_symbol): New function.
2423 (Sized_incremental_binary::global_symbol): New function.
2424 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2425 (Sized_incremental_binary::symbol_map_): New data member.
2426 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
2427 * target.h (Sized_target::apply_relocation): New function.
2428 * target-reloc.h (apply_relocation): New function.
2429 * x86_64.cc (Target_x86_64::apply_relocation): New function.
2431 2011-04-22 Doug Kwan <dougkwan@google.com>
2433 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
2434 flag of a SHT_ARM_EXIDX section.
2435 * testsuite/Makefile.am (arm_exidx_test): New test rules.
2436 * testsuite/Makefile.in: Regenerate.
2437 * testsuite/arm_exidx_test.s: New file.
2438 * testsuite/arm_exidx_test.sh: Same.
2440 2011-04-20 Cary Coutant <ccoutant@google.com>
2443 * archive.h (Incremental_archive_entry::Archive_member):
2444 Initialize arg_serial_ (second constructor).
2446 2011-04-17 Ian Lance Taylor <iant@google.com>
2448 * object.cc (Relocate_info::location): Simplify location string.
2449 * errors.cc (Errors::error_at_location): Don't print program
2451 (Errors::warning_at_location): Likewise.
2452 (Errors::undefined_symbol): Likewise.
2453 * testsuite/debug_msg.sh: Update accordingly.
2455 2011-04-14 Cary Coutant <ccoutant@google.com>
2457 * gold/layout.cc (Layout::symtab_section_offset): New function.
2458 * gold/layout.h (Layout::symtab_section_offset): New function.
2459 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
2461 2011-04-12 Ian Lance Taylor <iant@google.com>
2463 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
2464 with MREMAP_MAYMOVE.
2465 * output.h (class Output_file): Add map_is_allocated_ field.
2466 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
2467 not available, provide stubs. If mremap is not available, #define
2469 (MREMAP_MAYMOVE): Define if not defined.
2470 (Output_file::Output_file): Initialize map_is_allocated_.
2471 (Output_file::resize): Check map_is_allocated_.
2472 (Output_file::map_anonymous): If mmap fails, use malloc.
2473 (Output_file::unmap): Don't do anything for an anonymous map.
2474 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
2475 is not available, provide stubs.
2476 (File_read::View::~View): Use free rather than delete[].
2477 (File_read::make_view): Use malloc rather than new[]. If mmap
2479 (File_read::find_or_make_view): Use malloc rather than new[].
2480 * gold.h: Remove HAVE_REMAP code.
2481 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
2482 exists. Rename mremap to gold_mremap. If mmap is not available
2484 * configure, config.in: Rebuild.
2486 2011-04-11 Ian Lance Taylor <iant@google.com>
2488 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
2489 initialize local variable v.
2491 2011-04-11 Cary Coutant <ccoutant@google.com>
2493 * archive.cc (Archive::include_member): Adjust call to
2495 (Add_archive_symbols::run): Track argument serial numbers.
2496 (Lib_group::include_member): Likewise.
2497 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
2498 * archive.h (Incremental_archive_entry::Archive_member):
2499 Initialize arg_serial_.
2500 (Archive_member::arg_serial_): New data member.
2501 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
2502 (Sized_dynobj::do_add_symbols): Track symbols when doing an
2504 (Sized_dynobj::do_for_all_local_got_entries): New function.
2505 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
2507 * fileread.cc (get_mtime): New function.
2508 * fileread.h (get_mtime): New function.
2509 * gold.cc (queue_initial_tasks): Check for incremental update.
2510 (process_incremental_input): New function.
2511 (queue_middle_tasks): Don't force valid target for incremental
2513 * incremental-dump.cc (find_input_containing_global): Adjust
2514 size of symbol info entry.
2515 (dump_incremental_inputs): Dump argument serial number and
2516 in_system_directory flag; bias shndx by 1; print symbol names
2517 when dumping per-file symbol lists; use new symbol info readers.
2519 (Output_section_incremental_inputs:update_data_size): New function.
2520 (Sized_incremental_binary::setup_readers): Setup input readers
2521 for each input file; build maps for files added from libraries
2523 (Sized_incremental_binary::check_input_args): New function.
2524 (Sized_incremental_binary::do_check_inputs): Build map of argument
2525 serial numbers to input arguments.
2526 (Sized_incremental_binary::do_file_has_changed): Rename
2527 do_file_is_unchanged to this; compare file modification times.
2528 (Sized_incremental_binary::do_init_layout): New function.
2529 (Sized_incremental_binary::do_reserve_layout): New function.
2530 (Sized_incremental_binary::do_get_input_reader): Remove.
2531 (Sized_incremental_binary::get_symtab_view): New function.
2532 (Incremental_checker::can_incrementally_link_output_file): Remove.
2533 (Incremental_inputs::report_command_line): Exclude --debug options.
2534 (Incremental_inputs::report_archive_begin): Add parameter; track
2535 argument serial numbers; don't put input file entry for archive
2536 before archive members.
2537 (Incremental_inputs::report_archive_end): Put input file entry
2538 for archive after archive members.
2539 (Incremental_inputs::report_object): Add parameter; track argument
2540 serial numbers and in_system_directory flag.
2541 (Incremental_inputs::report_script): Add parameter; track argument
2543 (Output_section_incremental_inputs::set_final_data_size): Adjust
2544 size of symbol info entry; check for forwarding symbols.
2545 (Output_section_incremental_inputs::write_input_files): Write
2546 in_system_directory flag and argument serial number.
2547 (Output_section_incremental_inputs::write_info_blocks): Map section
2548 indices between incremental info and original input file; store
2549 input section index for each symbol.
2550 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2551 change operator() to visit().
2552 (class Global_got_offset_visitor): Likewise.
2553 (class Global_symbol_visitor_got_plt):
2554 (Output_section_incremental_inputs::write_got_plt): Use new visitor
2556 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
2557 (Sized_incr_relobj::do_read_symbols): New function.
2558 (Sized_incr_relobj::do_layout): New function.
2559 (Sized_incr_relobj::do_layout_deferred_sections): New function.
2560 (Sized_incr_relobj::do_add_symbols): New function.
2561 (Sized_incr_relobj::do_should_include_member): New function.
2562 (Sized_incr_relobj::do_for_all_global_symbols): New function.
2563 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
2564 (Sized_incr_relobj::do_section_size): New function.
2565 (Sized_incr_relobj::do_section_name): New function.
2566 (Sized_incr_relobj::do_section_contents): New function.
2567 (Sized_incr_relobj::do_section_flags): New function.
2568 (Sized_incr_relobj::do_section_entsize): New function.
2569 (Sized_incr_relobj::do_section_address): New function.
2570 (Sized_incr_relobj::do_section_type): New function.
2571 (Sized_incr_relobj::do_section_link): New function.
2572 (Sized_incr_relobj::do_section_info): New function.
2573 (Sized_incr_relobj::do_section_addralign): New function.
2574 (Sized_incr_relobj::do_initialize_xindex): New function.
2575 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2576 (Sized_incr_relobj::do_read_relocs): New function.
2577 (Sized_incr_relobj::do_gc_process_relocs): New function.
2578 (Sized_incr_relobj::do_scan_relocs): New function.
2579 (Sized_incr_relobj::do_count_local_symbols): New function.
2580 (Sized_incr_relobj::do_finalize_local_symbols): New function.
2581 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2582 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2583 (Sized_incr_relobj::do_relocate): New function.
2584 (Sized_incr_relobj::do_set_section_offset): New function.
2585 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2586 (Sized_incr_dynobj::do_read_symbols): New function.
2587 (Sized_incr_dynobj::do_layout): New function.
2588 (Sized_incr_dynobj::do_add_symbols): New function.
2589 (Sized_incr_dynobj::do_should_include_member): New function.
2590 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
2591 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
2592 (Sized_incr_dynobj::do_section_size): New function.
2593 (Sized_incr_dynobj::do_section_name): New function.
2594 (Sized_incr_dynobj::do_section_contents): New function.
2595 (Sized_incr_dynobj::do_section_flags): New function.
2596 (Sized_incr_dynobj::do_section_entsize): New function.
2597 (Sized_incr_dynobj::do_section_address): New function.
2598 (Sized_incr_dynobj::do_section_type): New function.
2599 (Sized_incr_dynobj::do_section_link): New function.
2600 (Sized_incr_dynobj::do_section_info): New function.
2601 (Sized_incr_dynobj::do_section_addralign): New function.
2602 (Sized_incr_dynobj::do_initialize_xindex): New function.
2603 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
2604 (make_sized_incremental_object): New function.
2605 (Incremental_library::copy_unused_symbols): New function.
2606 (Incremental_library::do_for_all_unused_symbols): New function.
2607 * incremental.h (enum Incremental_input_flags): New type.
2608 (class Incremental_checker): Remove.
2609 (Incremental_input_entry::Incremental_input_entry): Add argument
2611 (Incremental_input_entry::arg_serial): New function.
2612 (Incremental_input_entry::set_is_in_system_directory): New function.
2613 (Incremental_input_entry::is_in_system_directory): New function.
2614 (Incremental_input_entry::arg_serial_): New data member.
2615 (Incremental_input_entry::is_in_system_directory_): New data member.
2616 (class Script_info): Move here from script.h.
2617 (Script_info::Script_info): Add filename parameter.
2618 (Script_info::filename): New function.
2619 (Script_info::filename_): New data member.
2620 (Incremental_script_entry::Incremental_script_entry): Add argument
2622 (Incremental_object_entry::Incremental_object_entry): Likewise.
2623 (Incremental_object_entry::add_input_section): Build list of input
2624 sections with map to original shndx.
2625 (Incremental_object_entry::get_input_section_index): New function.
2626 (Incremental_object_entry::shndx_): New data member.
2627 (Incremental_object_entry::name_key_): Rename; adjust all refs.
2628 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
2629 (Incremental_archive_entry::Incremental_archive_entry): Add argument
2631 (Incremental_inputs::report_archive_begin): Likewise.
2632 (Incremental_inputs::report_object): Likewise.
2633 (Incremental_inputs::report_script): Likewise.
2634 (class Incremental_global_symbol_reader): New class.
2635 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
2636 and store flags and input file type.
2637 (Incremental_input_entry_reader::arg_serial): New function.
2638 (Incremental_input_entry_reader::type): Extract type from flags.
2639 (Incremental_input_entry_reader::is_in_system_directory): New function.
2640 (Incremental_input_entry_reader::get_input_section_count): Call
2641 accessor function for type.
2642 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
2643 function for type; adjust size of global symbol entry.
2644 (Incremental_input_entry_reader::get_global_symbol_count): Call
2645 accessor function for type.
2646 (Incremental_input_entry_reader::get_object_count): Likewise.
2647 (Incremental_input_entry_reader::get_object_offset): Likewise.
2648 (Incremental_input_entry_reader::get_member_count): Likewise.
2649 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
2650 (Incremental_input_entry_reader::get_member_offset): Likewise.
2651 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
2652 (Incremental_input_entry_reader::Global_symbol_info): Remove.
2653 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
2654 (Incremental_input_entry_reader::get_global_symbol_reader): New
2656 (Incremental_input_entry_reader::get_output_symbol_index): New
2658 (Incremental_input_entry_reader::type_): Remove.
2659 (Incremental_input_entry_reader::flags_): New data member.
2660 (Incremental_inputs_reader::input_file_offset): New function.
2661 (Incremental_inputs_reader::input_file_index): New function.
2662 (Incremental_inputs_reader::input_file): Call input_file_offset.
2663 (Incremental_inputs_reader::input_file_at_offset): New function.
2664 (Incremental_relocs_reader::get_r_type): Reformat.
2665 (Incremental_relocs_reader::get_r_shndx): Reformat.
2666 (Incremental_relocs_reader::get_r_offset): Reformat.
2667 (Incremental_relocs_reader::data): New function.
2668 (Incremental_binary::Incremental_binary): Initialize new data members.
2669 (Incremental_binary::check_inputs): Add cmdline parameter.
2670 (Incremental_binary::file_is_unchanged): Remove.
2671 (Input_reader::arg_serial): New function.
2672 (Input_reader::get_unused_symbol_count): New function.
2673 (Input_reader::get_unused_symbol): New function.
2674 (Input_reader::do_arg_serial): New function.
2675 (Input_reader::do_get_unused_symbol_count): New function.
2676 (Input_reader::do_get_unused_symbol): New function.
2677 (Incremental_binary::input_file_count): New function.
2678 (Incremental_binary::get_input_reader): Change signature to use
2679 index instead of filename.
2680 (Incremental_binary::file_has_changed): New function.
2681 (Incremental_binary::get_input_argument): New function.
2682 (Incremental_binary::get_library): New function.
2683 (Incremental_binary::get_script_info): New function.
2684 (Incremental_binary::init_layout): New function.
2685 (Incremental_binary::reserve_layout): New function.
2686 (Incremental_binary::output_file): New function.
2687 (Incremental_binary::do_check_inputs): New function.
2688 (Incremental_binary::do_file_is_unchanged): Remove.
2689 (Incremental_binary::do_file_has_changed): New function.
2690 (Incremental_binary::do_init_layout): New function.
2691 (Incremental_binary::do_reserve_layout): New function.
2692 (Incremental_binary::do_input_file_count): New function.
2693 (Incremental_binary::do_get_input_reader): Change signature.
2694 (Incremental_binary::input_args_map_): New data member.
2695 (Incremental_binary::library_map_): New data member.
2696 (Incremental_binary::script_map_): New data member.
2697 (Sized_incremental_binary::Sized_incremental_binary): Initialize
2699 (Sized_incremental_binary::output_section): New function.
2700 (Sized_incremental_binary::inputs_reader): Add const.
2701 (Sized_incremental_binary::symtab_reader): Add const.
2702 (Sized_incremental_binary::relocs_reader): Add const.
2703 (Sized_incremental_binary::got_plt_reader): Add const.
2704 (Sized_incremental_binary::get_symtab_view): New function.
2705 (Sized_incremental_binary::Inputs_reader): New typedef.
2706 (Sized_incremental_binary::Input_entry_reader): New typedef.
2707 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
2708 (Sized_incremental_binary::do_file_is_unchanged): Remove.
2709 (Sized_incremental_binary::do_file_has_changed): New function.
2710 (Sized_incremental_binary::do_init_layout): New function.
2711 (Sized_incremental_binary::do_reserve_layout): New function.
2712 (Sized_input_reader::Inputs_reader): Remove.
2713 (Sized_input_reader::Input_entry_reader): Remove.
2714 (Sized_input_reader::do_arg_serial): New function.
2715 (Sized_input_reader::do_get_unused_symbol_count): New function.
2716 (Sized_input_reader::do_get_unused_symbol): New function.
2717 (Sized_incremental_binary::do_input_file_count): New function.
2718 (Sized_incremental_binary::do_get_input_reader): Change signature;
2719 use index instead of filename.
2720 (Sized_incremental_binary::section_map_): New data member.
2721 (Sized_incremental_binary::input_entry_readers_): New data member.
2722 (class Sized_incr_relobj): New class.
2723 (class Sized_incr_dynobj): New class.
2724 (make_sized_incremental_object): New function.
2725 (class Incremental_library): New class.
2726 * layout.cc (Free_list::num_lists): New static data member.
2727 (Free_list::num_nodes): New static data member.
2728 (Free_list::num_removes): New static data member.
2729 (Free_list::num_remove_visits): New static data member.
2730 (Free_list::num_allocates): New static data member.
2731 (Free_list::num_allocate_visits): New static data member.
2732 (Free_list::init): New function.
2733 (Free_list::remove): New function.
2734 (Free_list::allocate): New function.
2735 (Free_list::dump): New function.
2736 (Free_list::print_stats): New function.
2737 (Layout_task_runner::run): Resize output file for incremental updates.
2738 (Layout::Layout): Initialize new data members.
2739 (Layout::set_incremental_base): New function.
2740 (Layout::init_fixed_output_section): New function.
2741 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
2742 incremental updates.
2743 (Layout::create_gold_note): Do not create gold note section for
2744 incremental updates.
2745 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
2746 for incremental updates.
2747 (Layout::set_section_offsets): For incremental updates, allocate space
2749 (Layout::create_symtab_sections): Layout with offsets relative to
2750 start of section; for incremental updates, allocate space from free
2752 (Layout::create_shdrs): For incremental updates, allocate space from
2754 (Layout::finish_dynamic_section): For incremental updates, do not
2755 check --as-needed (fixed in subsequent patch).
2756 * layout.h (class Free_list): New class.
2757 (Layout::set_incremental_base): New function.
2758 (Layout::incremental_base): New function.
2759 (Layout::init_fixed_output_section): New function.
2760 (Layout::allocate): New function.
2761 (Layout::incremental_base_): New data member.
2762 (Layout::free_list_): New data member.
2763 * main.cc (main): Print Free_list statistics.
2764 * object.cc (Relobj::finalize_incremental_relocs): Add
2765 clear_counts parameter; clear counts only when clear_counts is set.
2766 (Sized_relobj::Sized_relobj): Initialize new base class.
2767 (Sized_relobj::do_layout): Don't report special sections.
2768 (Sized_relobj::do_for_all_local_got_entries): New function.
2769 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
2770 symtab_off to all symbol table offsets.
2771 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
2772 * object.h (class Got_offset_list): Move to top of file.
2773 (Object::Object): Allow case where input_file == NULL.
2774 (Object::~Object): Likewise.
2775 (Object::input_file): Assert that input_file != NULL.
2776 (Object::lock): Allow case where input_file == NULL.
2777 (Object::unlock): Likewise.
2778 (Object::is_locked): Likewise.
2779 (Object::token): Likewise.
2780 (Object::release): Likewise.
2781 (Object::is_incremental): New function.
2782 (Object::get_mtime): New function.
2783 (Object::for_all_local_got_entries): New function.
2784 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
2785 (Object::set_is_in_system_directory): New function.
2786 (Object::is_in_system_directory): New function.
2787 (Object::do_is_incremental): New function.
2788 (Object::do_get_mtime): New function.
2789 (Object::do_for_all_local_got_entries): New function.
2790 (Object::is_in_system_directory_): New data member.
2791 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
2792 (class Sized_relobj_base): New class.
2793 (class Sized_relobj): Derive from Sized_relobj_base.
2794 (class Sized_relobj::Symbols): Redeclare from base class.
2795 (class Sized_relobj::local_got_offset_list): Remove.
2796 (class Sized_relobj::Output_sections): Redeclare from base class.
2797 (class Sized_relobj::do_for_all_local_got_entries): New function.
2798 (class Sized_relobj::write_local_symbols): Add offset parameter.
2799 (class Sized_relobj::local_symbol_offset_): Update comment.
2800 (class Sized_relobj::local_dynsym_offset_): Update comment.
2801 * options.cc (Input_arguments::add_file): Remove const.
2802 * options.h (Input_file_argument::Input_file_argument):
2803 Initialize arg_serial_ (all constructors).
2804 (Input_file_argument::set_arg_serial): New function.
2805 (Input_file_argument::arg_serial): New function.
2806 (Input_file_argument::arg_serial_): New data member.
2807 (Input_arguments::Input_arguments): Initialize file_count_.
2808 (Input_arguments::add_file): Remove const.
2809 (Input_arguments::number_of_input_files): New function.
2810 (Input_arguments::file_count_): New data member.
2811 (Command_line::number_of_input_files): Call
2812 Input_arguments::number_of_input_files.
2813 * output.cc (Output_segment_headers::Output_segment_headers):
2815 (Output_section::Input_section::current_data_size): New function.
2816 (Output_section::Output_section): Initialize new data members.
2817 (Output_section::add_input_section): Don't do merge sections for
2818 an incremental link; allocate space from free list for an
2820 (Output_section::add_output_section_data): Allocate space from
2821 free list for an incremental update.
2822 (Output_section::update_data_size): New function.
2823 (Output_section::set_fixed_layout): New function.
2824 (Output_section::reserve): New function.
2825 (Output_segment::set_section_addresses): Remove const.
2826 (Output_segment::set_section_list_addresses): Remove const; allocate
2827 space from free list for an incremental update.
2828 (Output_segment::set_offset): Adjust size of RELRO segment for an
2830 * output.h (Output_data::current_data_size): Move here from
2832 (Output_data::pre_finalize_data_size): New function.
2833 (Output_data::update_data_size): New function.
2834 (Output_section_headers::update_data_size): new function.
2835 (Output_section_data_build::current_data_size): Move to Output_data.
2836 (Output_data_strtab::update_data_size): New function.
2837 (Output_section::current_data_size): Move to Output_data.
2838 (Output_section::set_fixed_layout): New function.
2839 (Output_section::has_fixed_layout): New function.
2840 (Output_section::reserve): New function.
2841 (Output_section::update_data_size): New function.
2842 (Output_section::has_fixed_layout_): New data member.
2843 (Output_section::free_list_): New data member.
2844 (Output_segment::set_section_addresses): Remove const.
2845 (Output_segment::set_section_list_addresses): Remove const.
2846 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
2848 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
2850 * readsyms.cc (Read_symbols::do_read_symbols): Add library
2851 parameter when calling Add_symbols constructor; store argument
2852 serial number for members of a lib group.
2853 (Add_symbols::locks): Allow case where token == NULL.
2854 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
2855 (Read_member::~Read_member): New function.
2856 (Read_member::is_runnable): New function.
2857 (Read_member::locks): New function.
2858 (Read_member::run): New function.
2859 (Check_script::~Check_script): New function.
2860 (Check_script::is_runnable): New function.
2861 (Check_script::locks): New function.
2862 (Check_script::run): New function.
2863 (Check_library::~Check_library): New function.
2864 (Check_library::is_runnable): New function.
2865 (Check_library::locks): New function.
2866 (Check_library::run): New function.
2867 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
2868 (Add_symbols::library_): New data member.
2869 (class Read_member): New class.
2870 (class Check_script): New class.
2871 (class Check_library): New class.
2872 * reloc.cc (Read_relocs::is_runnable): Allow case where
2874 (Read_relocs::locks): Likewise.
2875 (Scan_relocs::locks): Likewise.
2876 (Relocate_task::locks): Likewise.
2877 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
2879 (Sized_relobj::incremental_relocs_scan): Fix comment.
2880 (Sized_relobj::do_relocate): Pass output file offset to
2881 write_local_symbols.
2882 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
2883 from class declaration.
2884 * script.cc (read_input_script): Allocate Script_info; pass
2885 argument serial number to report_script.
2886 * script.h (class Script_info): Move to incremental.h.
2887 * symtab.cc (Symbol_table::add_from_incrobj): New function.
2888 * symtab.h (Symbol_table::add_from_incrobj): New function.
2889 (Symbol_table::set_file_offset): New function.
2891 2011-04-05 Cary Coutant <ccoutant@google.com>
2893 * incremental-dump.cc (dump_incremental_inputs): Change signature
2894 to take a Sized_incremental_binary; change caller. Use readers
2895 in Sized_incremental_binary.
2897 (Sized_incremental_binary::find_incremental_inputs_sections):
2898 Rename do_find_incremental_inputs_sections to this.
2899 (Sized_incremental_binary::setup_readers): New function.
2900 (Sized_incremental_binary::do_check_inputs): Check
2901 has_incremental_info_ flag; move setup code to setup_readers;
2903 (Sized_incremental_binary::do_file_is_unchanged): New function.
2904 (Sized_incremental_binary::do_get_input_reader): New function.
2905 * incremental.h (class Incremental_binary): Move to end of file.
2906 (Incremental_binary::file_is_unchanged): New function.
2907 (Incremental_binary::do_file_is_unchanged): New function.
2908 (Incremental_binary::Input_reader): New class.
2909 (Incremental_binary::get_input_reader): New function.
2910 (class Sized_incremental_binary): Move to end of file.
2911 (Sized_incremental_binary::Sized_incremental_binary): Setup the
2912 input section reader classes.
2913 (Sized_incremental_binary::has_incremental_info): New function.
2914 (Sized_incremental_binary::inputs_reader): New function.
2915 (Sized_incremental_binary::symtab_reader): New function.
2916 (Sized_incremental_binary::relocs_reader): New function.
2917 (Sized_incremental_binary::got_plt_reader): New function.
2918 (Sized_incremental_binary::do_file_is_unchanged): New function.
2919 (Sized_incremental_binary::Sized_input_reader): New class.
2920 (Sized_incremental_binary::get_input_reader): New function.
2921 (Sized_incremental_binary::find_incremental_inputs_sections):
2922 Rename do_find_incremental_inputs_sections to this.
2923 (Sized_incremental_binary::setup_readers): New function.
2924 (Sized_incremental_binary::has_incremental_info_): New data member.
2925 (Sized_incremental_binary::inputs_reader_): New data member.
2926 (Sized_incremental_binary::symtab_reader_): New data member.
2927 (Sized_incremental_binary::relocs_reader_): New data member.
2928 (Sized_incremental_binary::got_plt_reader_): New data member.
2929 (Sized_incremental_binary::current_input_file_): New data member.
2931 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
2934 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
2937 2011-03-30 Cary Coutant <ccoutant@google.com>
2939 * archive.cc (Archive::include_member): Adjust call to report_object.
2940 (Add_archive_symbols::run): Add script_info to call to
2941 report_archive_begin.
2942 (Lib_group::include_member): Adjust call to report_object.
2943 (Add_lib_group_symbols::run): Adjust call to report_object.
2944 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
2945 blocks. Add object count for script input files.
2946 * incremental.cc (Incremental_inputs::report_archive_begin): Add
2947 script_info parameter; change all callers.
2948 (Incremental_inputs::report_object): Add script_info parameter;
2950 (Incremental_inputs::report_script): Store backpointer to
2951 incremental info entry.
2952 (Output_section_incremental_inputs::set_final_data_size): Record
2953 additional information for scripts.
2954 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2955 * incremental.h (Incremental_script_entry::add_object): New function.
2956 (Incremental_script_entry::get_object_count): New function.
2957 (Incremental_script_entry::get_object): New function.
2958 (Incremental_script_entry::objects_): New data member; adjust
2960 (Incremental_inputs::report_archive_begin): Add script_info parameter.
2961 (Incremental_inputs::report_object): Add script_info parameter.
2962 (Incremental_inputs_reader::get_object_count): New function.
2963 (Incremental_inputs_reader::get_object_offset): New function.
2964 * options.cc (Input_arguments::add_file): Return reference to
2966 * options.h (Input_argument::set_script_info): New function.
2967 (Input_argument::script_info): New function.
2968 (Input_argument::script_info_): New data member; adjust all
2970 (Input_file_group::add_file): Return reference to new input argument.
2971 (Input_file_lib::add_file): Likewise.
2972 (Input_arguments::add_file): Likewise.
2973 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
2974 * script.cc (Parser_closure::Parser_closure): Add script_info
2975 parameter; adjust all callers.
2976 (Parser_closure::script_info): New function.
2977 (Parser_closure::script_info_): New data member.
2978 (read_input_script): Report scripts earlier to incremental info.
2979 (script_add_file): Set script_info in Input_argument.
2980 (script_add_library): Likewise.
2981 * script.h (Script_options::Script_info): Rewrite class.
2983 2011-03-29 Cary Coutant <ccoutant@google.com>
2985 * archive.cc (Library_base::should_include_member): Move
2986 method here from class Archive.
2987 (Archive::Archive): Initialize base class.
2988 (Archive::should_include_member): Move to base class.
2989 (Archive::do_for_all_unused_symbols): New function.
2990 (Add_archive_symbols::run): Remove redundant access to
2992 (Lib_group::Lib_group): Initialize base class.
2993 (Lib_group::do_filename): New function.
2994 (Lib_group::include_member): Pass pointer to Lib_group to
2996 (Lib_group::do_for_all_unused_symbols): New function.
2997 (Add_lib_group_symbols::run): Report archive information for
2999 * archive.h (class Library_base): New base class.
3000 (class Archive): Derive from Library_base.
3001 (Archive::filename): Move to base class.
3002 (Archive::set_incremental_info): Likewise.
3003 (Archive::incremental_info): Likewise.
3004 (Archive::Should_include): Likewise.
3005 (Archive::should_include_member): Likewise.
3006 (Archive::Armap_entry): Remove.
3007 (Archive::Unused_symbol_iterator): Remove.
3008 (Archive::unused_symbols_begin): Remove.
3009 (Archive::unused_symbols_end): Remove.
3010 (Archive::do_filename): New function.
3011 (Archive::do_get_mtime): New function.
3012 (Archive::do_for_all_unused_symbols): New function.
3013 (Archive::task_): Move to base class.
3014 (Archive::incremental_info_): Likewise.
3015 (class Lib_group): Derive from Library_base.
3016 (Lib_group::do_filename): New function.
3017 (Lib_group::do_get_mtime): New function.
3018 (Lib_group::do_for_all_unused_symbols): New function.
3019 (Lib_group::task_): Move to base class.
3020 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
3022 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
3024 * incremental.cc (Incremental_inputs::report_archive_begin):
3025 Use Library_base; call library's get_mtime; add incremental inputs
3026 entry before members.
3027 (class Unused_symbol_visitor): New class.
3028 (Incremental_inputs::report_archive_end): Use Library_base; use
3029 visitor class to record unused symbols; don't add incremental inputs
3030 entry after members.
3031 (Incremental_inputs::report_object): Use Library_base.
3033 (Incremental_archive_entry::Incremental_archive_entry): Remove
3034 unused Archive parameter.
3035 (Incremental_inputs::report_archive_begin): Use Library_base.
3036 (Incremental_inputs::report_archive_end): Likewise.
3037 (Incremental_inputs::report_object): Likewise.
3038 * object.cc (Sized_relobj::do_for_all_global_symbols): New
3040 * object.h (Object::for_all_global_symbols): New function.
3041 (Object::do_for_all_global_symbols): New function.
3042 (Sized_relobj::do_for_all_global_symbols): New function.
3043 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
3045 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
3048 2011-03-27 Ian Lance Taylor <iant@google.com>
3050 * archive.cc (Archive::interpret_header): Return -1 if something
3051 goes wrong. Change callers accordingly.
3053 2011-03-25 Cary Coutant <ccoutant@google.com>
3055 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
3056 * testsuite/Makefile.in: Regenerate.
3058 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
3060 * plugin.cc (get_view): New.
3061 (Plugin::load): Pass get_view to the plugin.
3062 (Plugin_manager::get_view): New.
3064 2011-03-21 Ian Lance Taylor <iant@google.com>
3066 * testsuite/final_layout.sh: Rewrite to not use dc.
3067 * testsuite/relro_test.sh: Fail if dc is not present.
3069 2011-03-21 Sriraman Tallam <tmsriram@google.com>
3071 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
3073 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
3074 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
3076 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
3077 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
3079 2011-03-14 Ian Lance Taylor <iant@google.com>
3081 * script-sections.cc (Sort_output_sections::script_compare):
3082 Rename from is_before, change return type.
3083 (Sort_output_sections::operator()): Adjust accordingly.
3085 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
3088 * testsuite/odr_violation2.cc: Add comment to make all error line
3089 numbers double digits.
3090 * testsuite/debug_msg.sh: Adjust expected errors.
3092 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
3094 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
3095 but mark earlier ones as non-canonical
3096 (offset_to_iterator): Update search target and example
3097 (do_addr2line): Return extra lines in a vector*
3098 (format_file_lineno): Extract from do_addr2line
3099 (one_addr2line): Add vector* out-param
3100 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
3101 when a lineno entry appeared last for its instruction
3102 (Dwarf_line_info): Add vector* out-param
3103 * object.cc (Relocate_info): Pass NULL for the vector* out-param
3104 * symtab.cc (Odr_violation_compare): Include the lineno in the
3106 (linenos_from_loc): New. Combine the canonical line for an
3107 address with its other lines.
3108 (True_if_intersect): New. Helper functor to make
3109 std::set_intersection a query.
3110 (detect_odr_violations): Compare sets of lines instead of just
3111 one line for each function. This became less deterministic, but
3112 has fewer false positives.
3113 * symtab.h: Declarations.
3114 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
3115 mix an optimized and non-optimized object in the same binary
3116 (odr_violation2.so): Same.
3117 * testsuite/Makefile.in: Regenerate from Makefile.am.
3118 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
3119 * testsuite/debug_msg.sh: Update line numbers and add
3121 * testsuite/odr_violation1.cc: Use OdrDerived, in a
3122 non-optimized context.
3123 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
3124 isn't inlined, and use OdrDerived in an optimized context.
3125 * testsuite/odr_header1.h: Defines OdrDerived, where
3126 optimization will change the
3127 first-instruction-in-the-destructor's file and line number.
3128 * testsuite/odr_header2.h: Defines OdrBase.
3130 2011-03-09 Ian Lance Taylor <iant@google.com>
3132 * fileread.cc (File_read::clear_views): Don't delete the whole
3135 2011-03-08 Ian Lance Taylor <iant@google.com>
3138 * fileread.cc: #include <climits>.
3139 (GOLD_IOV_MAX): Define.
3140 (File_read::read_multiple): Limit number of entries by iov_max.
3141 * fileread.h (class File_read): Always set max_readv_entries to
3144 2011-03-07 Ian Lance Taylor <iant@google.com>
3147 * options.h (class General_options): Add -dy and -dn.
3149 2011-03-02 Cary Coutant <ccoutant@google.com>
3151 * testsuite/script_test_9.t: Add TLS segment.
3153 2011-03-02 Simon Baldwin <simonb@google.com>
3155 * configure.ac: Add check for gnu_indirect_function support in
3156 the toolchain building binutils.
3157 * configure: Rebuild.
3159 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
3161 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
3162 plugin only symbols.
3163 (Symbol_table::sized_finalize_symbol) Mark symbol only present
3164 in plugin files as not needed in the symbol table.
3166 2011-02-11 Sriraman Tallam <tmsriram@google.com>
3168 * output.cc (Output_section::add_input_section): Delay fill
3169 generation for section ordering.
3171 2011-02-09 Ian Lance Taylor <iant@google.com>
3174 * object.h (class Sized_relobj): Remove clear_local_symbols.
3175 * reloc.cc (Sized_relobj::do_relocate): Don't call
3176 clear_local_symbols.
3178 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
3180 * plugin.cc (is_visible_from_outside): Return true for symbols
3183 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
3185 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
3188 2011-02-02 Sriraman Tallam <tmsriram@google.com>
3190 * icf.h (is_section_foldable_candidate): Change type of parameter
3192 * icf.cc (Icf::find_identical_sections): Change type of local variable
3193 section_name to be std::string.
3194 (is_function_ctor_or_dtor): Change type of parameter to std::string.
3196 2011-01-25 Ian Lance Taylor <iant@google.com>
3198 * script.cc (script_add_extern): Rewrite to use
3199 add_symbol_reference.
3201 2011-01-25 Doug Kwan <dougkwan@google.com>
3203 * icf.cc (get_section_contents): Always lock section's object.
3205 2011-01-24 Ian Lance Taylor <iant@google.com>
3207 * options.h (class General_options): Accept
3208 --no-detect-odr-violations.
3210 2011-01-24 Ian Lance Taylor <iant@google.com>
3212 * version.cc (version_string): Bump to 1.11.
3214 2011-01-24 Ian Lance Taylor <iant@google.com>
3216 * plugin.cc (class Plugin_rescan): Define new class.
3217 (Plugin_manager::claim_file): Set any_claimed_.
3218 (Plugin_manager::save_archive): New function.
3219 (Plugin_manager::save_input_group): New function.
3220 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
3222 (Plugin_manager::new_undefined_symbol): New function.
3223 (Plugin_manager::rescan): New function.
3224 (Plugin_manager::rescannable_defines): New function.
3225 (Plugin_manager::add_input_file): Set any_added_.
3226 * plugin.h (class Plugin_manager): define new fields rescannable_,
3227 undefined_symbols_, any_claimed_, and any_added_. Declare
3228 Plugin_rescan as friend. Declare new functions.
3229 (Plugin_manager::Rescannable): Define type.
3230 (Plugin_manager::Rescannable_list): Define type.
3231 (Plugin_manager::Undefined_symbol_list): Define type.
3232 (Plugin_manager::Plugin_manager): Initialize new fields.
3233 * archive.cc (Archive::defines_symbol): New function.
3234 (Add_archive_symbols::run): Pass archive to plugins if any.
3235 * archive.h (class Archive): Declare defines_symbol.
3236 * readsyms.cc (Input_group::~Input_group): New function.
3237 (Finish_group::run): Pass input_group to plugins if any.
3238 * readsyms.h (class Input_group): Declare destructor.
3239 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
3242 2011-01-10 Ian Lance Taylor <iant@google.com>
3244 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
3246 (Layout::set_segment_offsets): Reset increase_relro before calling
3247 set_section_addresses a second time.
3249 2011-01-04 Cary Coutant <ccoutant@google.com>
3251 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
3252 sections before NOBITS sections.
3254 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
3256 * version.cc (print_version): Update copyright to 2011.
3258 2010-12-23 Cary Coutant <ccoutant@google.com>
3260 * output.h (Output_data_reloc::add_output_section): Pass OD instead
3261 of OS to this->add. Add OD parameter to second form of the function.
3263 2010-12-20 Ian Lance Taylor <iant@google.com>
3265 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
3266 second of two consecutive entries with same offset.
3268 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3270 * testsuite/Makefile.am (ifuncmain2static_LDADD)
3271 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
3272 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
3273 to avoid unneeded links against $(LDADD).
3274 * testsuite/Makefile.in: Regenerate.
3276 2010-12-15 Ian Lance Taylor <iant@google.com>
3279 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
3280 for R_X86_64_32 and R_X86_64_PC32.
3281 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
3282 ver_matching_def_pic.o.
3283 (ver_matching_def_pic.o): New target.
3285 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3287 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
3288 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
3289 Move definition before File_read::View member definitions.
3290 (File_read::View::~View): Initialize and hold lock before
3291 updating current_mapped_bytes.
3293 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3295 * dwarf_reader.cc: Remove outdated comment.
3296 * gold-threads.cc: Fix typo in error message.
3297 * archive.cc: Fix typos in comments.
3298 * archive.h: Likewise.
3299 * arm-reloc-property.cc: Likewise.
3300 * arm-reloc-property.h: Likewise.
3301 * arm-reloc.def: Likewise.
3303 * attributes.h: Likewise.
3304 * cref.cc: Likewise.
3305 * ehframe.cc: Likewise.
3306 * fileread.h: Likewise.
3308 * i386.cc: Likewise.
3310 * incremental.h: Likewise.
3311 * int_encoding.cc: Likewise.
3312 * layout.h: Likewise.
3313 * main.cc: Likewise.
3314 * merge.h: Likewise.
3315 * object.cc: Likewise.
3316 * object.h: Likewise.
3317 * options.cc: Likewise.
3318 * readsyms.cc: Likewise.
3319 * reduced_debug_output.cc: Likewise.
3320 * reloc.cc: Likewise.
3321 * script-sections.cc: Likewise.
3322 * sparc.cc: Likewise.
3323 * symtab.h: Likewise.
3324 * target-reloc.h: Likewise.
3325 * target.cc: Likewise.
3326 * target.h: Likewise.
3327 * timer.cc: Likewise.
3328 * timer.h: Likewise.
3329 * x86_64.cc: Likewise.
3331 2010-12-09 Cary Coutant <ccoutant@google.com>
3333 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
3335 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
3336 parameter; change all callers.
3337 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
3338 * options.h (warn_execstack): New option.
3340 2010-12-07 Doug Kwan <dougkwan@google.com>
3342 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
3343 like function call relocations.
3345 2010-12-07 Ian Lance Taylor <iant@google.com>
3347 * archive.cc (Archive::get_elf_object_for_member): Permit
3348 punconfigured to be NULL.
3349 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
3350 (Archive::include_member): Pass NULL to get_elf_object_for_member
3351 if we searched for the archive and this is the first included
3354 2010-12-01 Ian Lance Taylor <iant@google.com>
3356 * dwarf_reader.h (class Sized_dwarf_line_info): Add
3357 track_relocs_type_ field.
3358 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3359 Set track_relocs_type_.
3360 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
3361 contents when using RELA relocs.
3362 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
3364 * reloc.cc (Track_relocs::next_addend): New function.
3365 * reloc.h (class Track_relocs): Declare next_addend.
3367 2010-12-01 Ian Lance Taylor <iant@google.com>
3369 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
3372 2010-12-01 Ian Lance Taylor <iant@google.com>
3374 * README: Update compilers known to work and fail.
3376 2010-11-23 Matthias Klose <doko@ubuntu.com>
3378 * configure.in: For --enable-gold, handle value `default' instead of
3379 `both*'. Always install ld as ld.bfd, install as ld if gold is
3381 * configure: Regenerate.
3383 2010-11-18 Doug Kwan <dougkwan@google.com>
3385 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
3386 and right_alignment to be zero. Store result alignment only if it is
3387 greater than existing alignment.
3389 2010-11-16 Cary Coutant <ccoutant@google.com>
3392 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3393 Check for ".zdebug_line".
3395 2010-11-16 Doug Kwan <dougkwan@google.com>
3396 Cary Coutant <ccoutant@google.com>
3398 * output.h (Output_segment::set_section_addresses): Pass increase_relro
3399 by reference; adjust all callers.
3400 * output.cc (Output_segment::set_section_addresses): Adjust references
3401 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
3403 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
3404 end at page boundary.
3406 2010-11-16 Cary Coutant <ccoutant@google.com>
3409 * layout.cc (Layout::choose_output_section): Transform names of
3410 compressed sections even when using a script with a SECTIONS clause.
3411 (Layout::output_section_name): Remove code to transform
3412 compressed debug section names.
3413 * output.cc (Output_section::add_input_section): Use uncompressed
3414 section size when tracking input sections.
3416 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
3418 * symtab.h (Symbol::NON_PIC_REF): Remove.
3419 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
3420 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
3421 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
3422 (Symbol::use_plt_offset): Take a flags argument and pass it
3423 directly to needs_dynamic_reloc. Restrict check for undefined
3424 weak symbols to function calls.
3425 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
3426 (Target_arm::Scan::global): Use it.
3427 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
3428 (Target_arm::Relocate::relocate): Likewise.
3429 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
3430 parameter with an r_type parameter. Use get_reference_flags
3432 (Target_arm::Relocate::relocate): Update accordingly.
3433 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
3434 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
3435 (Target_i386::Scan::global): Likewise.
3436 (Target_i386::Relocate::relocate): Likewise.
3437 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
3438 parameter with an r_type parameter. Use get_reference_flags
3440 (Target_i386::Relocate::relocate): Update accordingly.
3441 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
3442 (Target_powerpc::Scan::global): Use it.
3443 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
3444 (Target_powerpc::Relocate::relocate): Likewise.
3445 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
3446 (Target_sparc::Scan::global): Use it.
3447 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
3448 (Target_sparc::Relocate::relocate): Likewise.
3449 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
3450 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
3451 (Target_x86_64::Scan::global): Likewise.
3452 (Target_x86_64::Relocate::relocate): Likewise.
3454 2010-11-08 Doug Kwan <dougkwan@google.com>
3455 Cary Coutant <ccoutant@google.com>
3457 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
3458 (Arm_exidx_merge_section::section_contents_): New data member.
3459 (Arm_input_section::Arm_input_section): Initialize original_contents_.
3460 (Arm_input_section::~Arm_input_section): De-allocate memory.
3461 (Arm_input_section::original_contents_): New data member.
3462 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
3463 in parameters instead of calling Object::section_contents without
3465 (Arm_output_section::group_section): New parameter TASK. Pass it
3466 to callees that need locking objects.
3467 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
3468 to lock EXIDX input sections. Fix a formatting issue. Call
3469 Arm_exidx_merged_section::build_contents to create merged section
3471 (Arm_output_section::create_stub_group): New parameter TASK. Use it
3472 to lock object of stub table owner.
3473 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
3474 TEXT_SIZE to initialize data member TEXT_SIZE_.
3475 (Arm_exidx_input_section::addralign): Fix typo in comment.
3476 (Arm_exidx_input_section::text_size): New method.
3477 (Target_arm::do_relax): New parameter TASK. Pass it to callees
3478 that require locking objects. Lock objects before scanning for stubs
3479 and updating local symbols.
3480 (Arm_input_section<big_endian>::init): Copy contents of original
3482 (Arm_input_section<big_endian>::do_write): Use saved contents of
3483 original input section instead of calling Object::section_contents
3485 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
3486 size without calling Object::section_size().
3487 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
3488 for size. Allocate a buffer for merged EXIDX entries.
3489 (Arm_exidx_merged_section::build_contents): New method.
3490 (Arm_exidx_merged_section::do_write): Move merge section contents
3491 building code to Arm_exidx_merged_section::build_contetns. Write
3492 out contetns in buffer instead of building it on the fly.
3493 (Arm_relobj::make_exidx_input_section): Also pass text section size
3494 to Arm_exidx_input_section constructor.
3495 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
3496 (Arm_dynobj::do_read_symbols): Fix memory leak.
3497 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
3498 * target.h: (class Task): Add forward declaration.
3499 (Target::relax): Add new parameter TASK and pass it to
3501 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
3503 2010-11-05 Cary Coutant <ccoutant@google.com>
3506 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
3507 object when reading from the file.
3508 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
3510 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
3511 when reading section contents.
3512 (get_section_contents): Likewise.
3513 (icf::find_identical_sections): Likewise.
3514 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
3515 object when reading from the file.
3516 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
3517 the object when doing deferred section layout.
3519 2010-11-03 Nick Clifton <nickc@redhat.com>
3522 * script.h (class Symbol_assignment: name): New member. Returns
3523 the name of the symbol.
3524 * scrfipt.cc (Script_options::is_pending_assignment): New member.
3525 Returns true if the given symbol name is on the list of
3526 assignments wating to be processed.
3527 * archive.cc (should_incldue_member): If the symbol is undefined,
3528 check to see if it is on the list of symbols pending assignment.
3530 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
3532 * script-sections.cc (Script_sections::find_memory_region): Check
3533 for a NULL output section pointer.
3535 2010-10-29 Doug Kwan <dougkwan@google.com>
3537 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3538 Output_section::add_relaxed_input_section.
3539 * output.cc (Output_section::add_relaxed_input_section): Add new
3540 arguments LAYOUT and NAME. Set section order index.
3541 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3542 Copy section order index.
3543 * output.h (Output_section::add_relaxed_input_section): Add new
3544 arguments LAYOUT and NAME.
3546 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3548 * testsuite/Makefile.am: Move gcctestdir/ld rule to
3549 NATIVE_OR_CROSS_LINKER.
3550 * testsuite/Makefile.in: Regenerate.
3552 2010-10-20 Doug Kwan <dougkwan@google.com>
3554 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
3555 without SHF_LINK_ORDER flags.
3556 * layout.cc (Layout::choose_output_section): Do not filter
3557 SHF_LINK_ORDER flag in a relocatable link.
3559 2010-10-17 Cary Coutant <ccoutant@google.com>
3561 * output.h (Output_segment::set_section_addresses): Change function
3562 signature. Update all callers.
3563 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
3565 (Output_segment::set_section_addresses): Align after last TLS
3566 section. Add padding before last relro section instead of after.
3568 2010-10-17 Doug Kwan <dougkwan@google.com>
3570 * gold/arm.cc (Target_arm::got_section): Use correct order and set
3571 GOT output section to be writable.
3573 2010-10-14 Cary Coutant <ccoutant@google.com>
3575 * debug.h (DEBUG_INCREMENTAL): New flag.
3576 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3577 * gold.cc (queue_initial_tasks): Check parameters for incremental link
3579 * incremental.cc (report_command_line): Ignore all forms of
3581 * layout.cc (Layout::Layout): Check parameters for incremental link
3583 * options.cc (General_options::parse_incremental): New function.
3584 (General_options::parse_no_incremental): New function.
3585 (General_options::parse_incremental_full): New function.
3586 (General_options::parse_incremental_update): New function.
3587 (General_options::incremental_mode_): New data member.
3588 (General_options::finalize): Check incremental_mode_.
3589 * options.h (General_options): Update help text for --incremental.
3590 Add --no-incremental, --incremental-full, --incremental-update.
3591 (General_options::Incremental_mode): New enum type.
3592 (General_options::incremental_mode): New function.
3593 (General_options::incremental_mode_): New data member.
3594 * parameters.cc (Parameters::incremental_mode_): New data member.
3595 (Parameters::set_options): Set incremental_mode_.
3596 (Parameters::set_incremental_full): New function.
3597 (Parameters::incremental): New function.
3598 (Parameters::incremental_update): New function.
3599 (set_parameters_incremental_full): New function.
3600 * parameters.h (Parameters::set_incremental_full): New function.
3601 (Parameters::incremental): New function.
3602 (Parameters::incremental_update): New function.
3603 (Parameters::incremental_mode_): New data member.
3604 (set_parameters_incremental_full): New function.
3605 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
3606 incremental link mode.
3607 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
3608 (Sized_relobj::do_relocate_sections): Likewise.
3609 * testsuite/Makefile.am (incremental_test): Use --incremental-full
3611 * testsuite/Makefile.in: Regenerate.
3612 * testsuite/incremental_test.sh: Filter all forms of --incremental.
3614 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3616 * script-sections.h (class Script_sections): Make
3617 Sections_elements typedef public.
3618 * script-sections.cc (class Sort_output_sections): Add elements_
3619 field. Add constructor which sets it; change all callers.
3620 (Sort_output_sections::is_before): New function.
3621 (Sort_output_sections::operator()): Call is_before.
3622 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
3624 * testsuite/script_test_10.sh: New test. Test script section
3626 * testsuite/script_test_10.t: Likewise.
3627 * testsuite/script_test_10.s: Likewise.
3628 * testsuite/Makefile.am: Wrap the cross linker tests and the
3629 common tests into NATIVE_OR_CROSS_LINKER.
3630 (check_SCRIPTS): Add script_test_10.sh.
3631 (check_DATA): Add script_test_10.stdout.
3632 (script_test_10.o, script_test_10): New targets.
3633 (script_test_10.stdout): New target.
3634 * configure, testsuite/Makefile.in: Regenerate.
3636 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3638 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
3639 error for the deprecated relocations.
3640 (Target_arm::Scan::global): Likewise.
3641 (Target_arm::Relocate::relocate): Likewise.
3643 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
3645 * fileread.cc (Input_file::find_file): Initialize *found_name
3646 and *namep when using the fallback search for case 4.
3648 2010-10-11 Cary Coutant <ccoutant@google.com>
3650 * options.h (class General_options): Redefine -z lazy as an alias for
3651 the negation of -z now.
3653 2010-10-11 Ian Lance Taylor <iant@google.com>
3655 * resolve.cc (symbol_to_bits): Report the value of the unsupported
3658 2010-10-06 Nick Clifton <nickc@redhat.com>
3660 * script-sections.cc(class Memory_region): Remove
3661 current_lma_offset_ field. Rename current_vma_offset_ to
3662 current_offset_. Add last_section_ field.
3663 (Memory_region::get_current_vma_address): Rename to
3664 get_current_address.
3665 (Memory_region::get_current_lma_address): Delete.
3666 (Memory_region::increment_vma_offset): Rename to
3668 (Memory_region::increment_lma_offset): Delete.
3669 (Memory_region::attributes_compatible): New method. Returns
3670 true if the provided section is compatible with the region.
3671 (Memory_region::get_last_section): New method. Returns the last
3672 section to use the region.
3673 (Memory_region::set_last_section): New method. Stores the last
3674 section to use the region.
3675 (Script_sections::block_in_region): New method. Returns true if
3676 a block of memory is contained within a region.
3677 (Script_sections::find_memory_region): New method. Locates a
3678 memory region to be used to set a VMA or LMA address.
3679 (Output_section_definition::set_section_addresses): Add code to
3680 check for addresses set by memory regions.
3681 (Output_segment::set_section_addresses): Remove memory region
3683 (Script_sections::create_segment): Add a warning if a header
3684 segment is created outside of any region.
3685 * script-sections.h (class Script_sections): Add prototypes for
3686 find_memory_region and block_in_region methods.
3687 * testsuite/memory_test.s: Use .long instead of .word.
3688 * testsuite/memory_test.t: Add some more output sections.
3689 * testsuite/memory_test.sh: Update expected output.
3691 2010-10-02 Doug Kwan <dougkwan@google.com>
3693 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
3694 defintion to symtab.h
3695 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
3696 declaration to defintion.
3698 2010-10-01 Nick Clifton <nickc@redhat.com>
3700 * expression.cc (eval): Replace dummy argument with NULL.
3701 (eval_maybe_dot): Check for a NULL result section pointer.
3702 (Symbol_expression::value): Likewise.
3703 (Dot_expression::value): Likewise.
3704 (BINARY_EXPRESSION): Likewise.
3705 (Max_expression::value): Likewise.
3706 (Min_expression::value): Likewise.
3707 (Absolute_expression::value): Likewise.
3708 (Addr_expression::value_from_output_section): Likewise.
3709 (Loaddddr_expression::value_from_output_section): Likewise.
3710 (Segment_start_expression::value): Likewise.
3711 * script-sections.cc
3712 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
3714 (Sections_elememt_dot_assignment::set_section_addresses):
3716 (Output_data_expression::do_write_to_buffer): Likewise.
3717 (Output_section_definition::finalize_symbols): Likewise.
3718 (Output_section_definition::set_section_addresses): Likewise.
3720 2010-09-30 Doug Kwan <dougkwan@google.com>
3722 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
3724 2010-09-28 Sriraman Tallam <tmsriram@google.com>
3726 * target.h (Target::can_icf_inline_merge_sections): New virtual
3728 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
3730 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
3732 * icf.cc (get_section_contents): Inline merge sections only when
3735 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3737 * configure: Regenerate.
3739 2010-09-17 Ian Lance Taylor <iant@google.com>
3741 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
3742 * testsuite/Makefile.am (memory_test.o): New target.
3743 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
3745 * testsuite/Makefile.in: Rebuild.
3747 2010-09-17 Doug Kwan <dougkwan@google.com>
3749 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
3750 defintion if relocation uses GOT entries of the symbol.
3751 * testsuite/icf_safe_test.sh: Fix test.
3752 * testsuite/icf_safe_so_test.sh: Fix test.
3754 2010-09-16 Cary Coutant <ccoutant@google.com>
3756 * script_sections.cc (class Memory_region): Remove "NULL" from
3757 vector initializations.
3759 2010-09-15 Cary Coutant <ccoutant@google.com>
3761 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
3762 Resolve forwarding symbols.
3764 2010-09-15 Doug Kwan <dougkwan@google.com>
3766 * gold/testsuite/script_test_3.t: Add ARM special sections.
3767 * gold/testsuite/script_test_4.t: Same.
3768 * gold/testsuite/script_test_5.t: Same.
3769 * gold/testsuite/script_test_6.t: Same.
3770 * gold/testsuite/script_test_7.t: Same.
3771 * gold/testsuite/script_test_7.t: Same.
3772 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
3774 2010-09-14 Cary Coutant <ccoutant@google.com>
3776 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
3777 (Target_x86_64::Relocate::relocate_tls): Replace check for
3778 saw_tls_block_reloc_ with test for executable section.
3780 2010-09-12 Cary Coutant <ccoutant@google.com>
3782 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
3783 position-independent executables to shared libraries need dynamic
3785 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
3786 position-independent executables.
3787 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
3788 * testsuite/Makefile.in: Regenerate.
3790 2010-09-10 Nick Clifton <nickc@redhat.com>
3793 * testsuite/memory_test.t: Discard any sections that are not
3796 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
3799 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
3800 "This::" to work around a bug in gcc 4.2.
3802 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
3804 2010-09-09 Rafael Espindola <espindola@google.com>
3806 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
3807 sections with different PF_X flags in the same segment.
3808 (Layout::find_first_load_seg): Search all segments to find the first
3810 * options.h (rosegment): New.
3812 2010-09-08 Rafael Espindola <espindola@google.com>
3814 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
3816 2010-09-08 Doug Kwan <dougkwan@google.com>
3818 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
3819 (Arm_relobj::do_relocate_sections): Add new parameter for output
3820 file to match the parent.
3821 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
3822 of local symbols instead of input values. Update code to track
3823 changes in gold::relocate_section.
3824 * object.cc (Sized_relobj::compute_final_local_value): New methods.
3825 (Sized_relobj::compute_final_local_value_internal): New methods.
3826 (Sized_relobj::do_finalize_local_symbols): Move code from loop
3827 body into private version of Sized_relobj::compute_final_local_value.
3828 Call the inline method.
3829 * object.h (Symbol_value::Symbol_value): Define destructor. Free
3830 merged symbol value if there is one.
3831 (Symbol_value::has_output_value): New method defintiion.
3832 (Sized_relobj::Compute_final_local_value_status): New enum type.
3833 (Sized_relobj::compute_final_local_value): New methods.
3834 (Sized_relobj::compute_final_local_value_internal): New methods.
3835 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
3836 and arm_cortex_a8.sh.
3837 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
3838 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
3840 * Makefile.in: Regenerate.
3841 * testsuite/arm_bl_out_of_range.s: Update test.
3842 * testsuite/thumb_bl_out_of_range.s: Ditto.
3843 * testsuite/thumb_blx_out_of_range.s: Ditto.
3844 * testsuite/arm_branch_out_of_range.sh: New file.
3845 * testsuite/arm_cortex_a8.sh: Ditto.
3846 * testsuite/arm_cortex_a8_b.s: Ditto.
3847 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
3848 * testsuite/arm_cortex_a8_b_local.s: Ditto.
3849 * testsuite/arm_cortex_a8_bl.s: Ditto.
3850 * testsuite/arm_cortex_a8_blx.s: Ditto.
3851 * testsuite/arm_cortex_a8_local.s: Ditto.
3852 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
3853 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
3855 2010-09-08 Rafael Espindola <espindola@google.com>
3857 * Makefile.am (memory_test.stdout): Run readelf with -W.
3858 * Makefile.in: Regenerate.
3859 * testsuite/memory_test.sh: Make the regexps accept both 32 and
3862 2010-09-08 Rafael Espindola <espindola@google.com>
3864 * script-sections.cc (Script_sections::add_memory_region): Convert
3865 field precision to int.
3866 * script.cc (script_set_section_region, script_set_section_region):
3867 Convert field precision to int.
3869 2010-09-08 Rafael Espindola <espindola@google.com>
3871 * arm.cc (do_finalize_sections): Create the __exidx_start and
3872 __exdix_end symbols even when the section is missing.
3874 2010-09-08 Nick Clifton <nickc@redhat.com>
3876 * README: Remove claim that MEMORY is not supported.
3877 * expression.cc (script_exp_function_origin)
3878 (script_exp_function_length): Move from here to ...
3879 * script.cc: ... here.
3880 (script_set_section_region, script_add_memory)
3881 (script_parse_memory_attr, script_include_directive): New
3883 * script-sections.cc
3884 (class Memory_region): New class.
3885 (class Output_section_definition): Add set_memory_region,
3886 set_section_vma, set_section_lma and get_section_name methods.
3887 (class Script_Sections): Add add_memory_region,
3888 find_memory_region, find_memory_region_origin,
3889 find_memory_region_length and set_memory_region methods.
3890 Have set_section_addresses method walk the list of set memory
3892 Extend the print methos to display memory regions.
3893 * script-sections.h: Add prototypes for new methods.
3894 Add enum for MEMORY region attributes.
3895 * yyscript.y: Add support for parsing MEMORY regions.
3896 * script-c.h: Add prototypes for new functions.
3897 * testsuite/Makefile.am: Add test of MEMORY region functionality.
3898 * testsuite/Makefile.in: Regenerate.
3899 * testsuite/memory_test.sh: New script.
3900 * testsuite/memory_test.s: New assembler source file.
3901 * testsuite/memory_test.t: New linker script.
3903 2010-08-27 Doug Kwan <dougkwan@google.com>
3905 * gold/resolve.cc (Symbol_table::should_override): Let a weak
3906 reference override an existing dynamic weak reference.
3907 * testsuite/Makefile.am: Add new test dyn_weak_ref.
3908 * testsuite/Makefile.in: Regenerate.
3909 * testsuite/dyn_weak_ref.sh: New file.
3910 * testsuite/dyn_weak_ref_1.c: Ditto.
3911 * testsuite/dyn_weak_ref_2.c: Ditto.
3913 2010-08-27 Ian Lance Taylor <iant@google.com>
3915 * incremental.h (class Incremental_input_entry): Add virtual
3918 2010-08-27 Ian Lance Taylor <iant@google.com>
3920 * testsuite/start_lib_test_3.c: Mark t3 as used.
3922 2010-08-27 Nick Clifton <nickc@redhat.com>
3924 * options.cc (version_script): Fix small typo in previous
3927 2010-08-25 Nick Clifton <nickc@redhat.com>
3929 * archive.cc: Formatting fixes: Remove whitespace between
3930 typename and following asterisk. Remove whitespace between
3931 function name and opening parenthesis.
3932 * archive.h: Likewise.
3934 * attributes.cc: Likewise.
3935 * attributes.h: Likewise.
3936 * common.cc: Likewise.
3937 * copy-relocs.cc: Likewise.
3938 * dirsearch.h: Likewise.
3939 * dynobj.cc: Likewise.
3940 * ehframe.cc: Likewise.
3941 * ehframe.h: Likewise.
3942 * expression.cc: Likewise.
3943 * fileread.cc: Likewise.
3944 * fileread.h: Likewise.
3946 * gold-threads.cc: Likewise.
3947 * gold.cc: Likewise.
3948 * i386.cc: Likewise.
3950 * incremental-dump.cc: Likewise.
3951 * incremental.cc: Likewise.
3952 * layout.cc: Likewise.
3953 * layout.h: Likewise.
3954 * main.cc: Likewise.
3955 * merge.cc: Likewise.
3956 * merge.h: Likewise.
3957 * object.cc: Likewise.
3958 * object.h: Likewise.
3959 * options.cc: Likewise.
3960 * options.h: Likewise.
3961 * output.cc: Likewise.
3962 * output.h: Likewise.
3963 * plugin.cc: Likewise.
3964 * plugin.h: Likewise.
3965 * powerpc.cc: Likewise.
3966 * reloc.cc: Likewise.
3967 * script-c.h: Likewise.
3968 * script-sections.cc: Likewise.
3969 * script.cc: Likewise.
3970 * stringpool.cc: Likewise.
3971 * symtab.cc: Likewise.
3972 * symtab.h: Likewise.
3973 * target.cc: Likewise.
3974 * timer.cc: Likewise.
3975 * timer.h: Likewise.
3976 * version.cc: Likewise.
3977 * x86_64.cc: Likewise.
3979 2010-08-24 Nick Clifton <nickc@redhat.com>
3982 * layout.cc (segment_precedes): Sort segments by their physical
3983 addresses, if they have been set.
3985 2010-08-23 Cary Coutant <ccoutant@google.com>
3987 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
3989 (Lib_group::include_member): Unlock object after deleting its
3991 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
3994 2010-08-19 Neil Vachharajani <nvachhar@google.com>
3995 Cary Coutant <ccoutant@google.com>
3997 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
3998 constructor, and set_blocker.
3999 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
4001 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
4002 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
4003 * testsuite/Makefile.am (start_lib_test): New test case.
4004 * testsuite/Makefile.in: Regenerate.
4005 * testsuite/start_lib_test_main.c: New file.
4006 * testsuite/start_lib_test_1.c: New file.
4007 * testsuite/start_lib_test_2.c: New file.
4008 * testsuite/start_lib_test_3.c: New file.
4010 2010-08-19 Ian Lance Taylor <iant@google.com>
4012 * Makefile.in: Rebuild with automake 1.11.1.
4013 * aclocal.m4: Likewise.
4014 * testsuite/Makefile.in: Likewise.
4016 2010-08-19 Ian Lance Taylor <iant@google.com>
4019 * i386.cc (class Output_data_plt_i386): Update declarations.
4020 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
4021 local_ifuncs_ fields.
4022 (Target_i386::do_plt_section_for_global): New function.
4023 (Target_i386::do_plt_section_for_local): New function.
4024 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
4025 parameter; change all callers. Initialize global_ifuncs_ and
4026 local_ifuncs_. If doing a static link define __rel_iplt_start and
4028 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
4029 (Output_data_plt_i386::add_local_ifunc_entry): New function.
4030 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
4032 (Target_i386::make_plt_section): New function, broken out of
4033 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
4034 (Target_i386::make_plt_entry): Call make_plt_section.
4035 (Target_i386::make_local_ifunc_plt_entry): New function.
4036 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
4037 (Target_i386::Scan::local): Handle IFUNC symbols. Add
4038 R_386_IRELATIVE to switch.
4039 (Target_i386::Scan::global): Likewise.
4040 (Target_i386::Relocate::relocate): Likewise.
4041 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
4043 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
4044 (Target_x86_64::do_plt_section_for_global): New function.
4045 (Target_x86_64::do_plt_section_for_local): New function.
4046 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
4047 parameter; change all callers. If doing a static link define
4048 __rela_iplt_start and __rela_iplt_end.
4049 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
4050 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
4051 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
4053 (Target_x86_64::make_local_ifunc_plt_entry): New function.
4054 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
4056 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
4057 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
4058 R_X86_64_IRELATIVE to switch.
4059 (Target_x86_64::Scan::global): Likewise.
4060 (Target_x86_64::Relocate::relocate): Likewise.
4061 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
4063 * target.h (class Target): Add plt_section_for_global and
4064 plt_section_for_local functions. Add do_plt_section_for_global
4065 and do_plt_section_for_local virtual functions.
4066 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
4067 clarifying comments.
4068 (Symbol::use_plt_offset): Handle IFUNC symbol.
4069 * object.cc (Sized_relobj::Sized_relobj): Initialize
4071 (Sized_relobj::local_has_plt_offset): New function.
4072 (Sized_relobj::local_plt_offset): New function.
4073 (Sized_relobj::set_local_plt_offset): New function.
4074 (Sized_relobj::do_count): Handle IFUNC symbol.
4075 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
4076 a bit away from input_shndx_ field. Add set_is_func_symbol and
4077 is_ifunc_symbol functions.
4078 (class Sized_relobj): Update declarations. Remove Tls_got_entry
4079 and Local_tls_got_offsets. Define Local_plt_offsets. Add
4080 local_plt_offsets_ field.
4081 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
4082 * output.h (class Output_section_data): Add non-const
4083 output_section function.
4084 (class Output_data_got): Update declarations.
4085 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
4086 Add use_plt_offset parameter to global and local constructors.
4087 Change all callers. Change local_sym_index_ field to 31 bits.
4088 Change GSYM_CODE and CONSTANT_CODE accordingly.
4089 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
4090 doing a static link don't set sh_link field.
4091 (Output_data_got::Got_entry::write): Use PLT offset if
4093 (Output_data_got::add_global_plt): New function.
4094 (Output_data_got::add_local_plt): New function.
4095 * target-reloc.h (relocate_section): Handle IFUNC symbol.
4096 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
4097 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
4098 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
4099 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
4101 * testsuite/ifunc-sel.h: New file.
4102 * testsuite/ifuncmain1.c: New file.
4103 * testsuite/ifuncmain1vis.c: New file.
4104 * testsuite/ifuncmod1.c: New file.
4105 * testsuite/ifuncdep2.c: New file.
4106 * testsuite/ifuncmain2.c: New file.
4107 * testsuite/ifuncmain3.c: New file.
4108 * testsuite/ifuncmod3.c: New file.
4109 * testsuite/ifuncmain4.c: New file.
4110 * testsuite/ifuncmain5.c: New file.
4111 * testsuite/ifuncmod5.c: New file.
4112 * testsuite/ifuncmain6pie.c: New file.
4113 * testsuite/ifuncmod6.c: New file.
4114 * testsuite/ifuncmain7.c: New file.
4115 * configure, testsuite/Makefile.in: Rebuild.
4117 2010-08-18 Ian Lance Taylor <iant@google.com>
4120 (Output_section_incremental_inputs::write_input_files): Add cast
4121 to avoid signed/unsigned comparison warning.
4122 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4124 2010-08-12 Cary Coutant <ccoutant@google.com>
4126 * common.cc (Sort_commons::operator()): Remove unnecessary code.
4128 2010-08-13 Ian Lance Taylor <iant@google.com>
4130 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
4132 2010-08-12 Cary Coutant <ccoutant@google.com>
4133 Doug Kwan <dougkwan@google.com>
4135 * resolve.cc (Symbol_table::should_override): When a weak dynamic
4136 defintion overrides non-weak undef, remember that the original undef
4138 * symtab.cc (Symbol_table::sized_write_global): For undef without
4139 an original weak binding, set binding to global in output.
4140 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
4141 * testsuite/Makefile.in: Regenerate.
4142 * testsuite/strong_ref_weak_def.sh: New file.
4143 * testsuite/strong_ref_weak_def_1.c: Ditto.
4144 * testsuite/strong_ref_weak_def_2.c: Ditto.
4146 2010-08-12 Cary Coutant <ccoutant@google.com>
4148 * testsuite/incremental_test.sh: Rewrite.
4149 * testsuite/incremental_test_1.c: Rewrite.
4150 * testsuite/incremental_test_2.c: Rewrite.
4152 2010-08-12 Cary Coutant <ccoutant@google.com>
4154 * arm.cc (Target_arm::got_size): Add const.
4155 (Target_arm::got_entry_count): New function.
4156 (Target_arm::plt_entry_count): New function.
4157 (Target_arm::first_plt_entry_offset): New function.
4158 (Target_arm::plt_entry_size): New function.
4159 (Output_data_plt_arm::entry_count): New function.
4160 (Output_data_plt_arm::first_plt_entry_offset): New function.
4161 (Output_data_plt_arm::get_plt_entry_size): New function.
4162 * i386.cc (Target_i386::got_size): Add const.
4163 (Target_i386::got_entry_count): New function.
4164 (Target_i386::plt_entry_count): New function.
4165 (Target_i386::first_plt_entry_offset): New function.
4166 (Target_i386::plt_entry_size): New function.
4167 (Output_data_plt_i386::entry_count): New function.
4168 (Output_data_plt_i386::first_plt_entry_offset): New function.
4169 (Output_data_plt_i386::get_plt_entry_size): New function.
4170 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
4171 find_incremental_inputs_sections. Dump incremental_got_plt section.
4172 * incremental.cc: Include target.h.
4173 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
4174 parameter. Adjust all callers. Find incremental_got_plt section.
4175 (Incremental_inputs::create_data_sections): Create incremental_got_plt
4177 (Output_section_incremental_inputs::set_final_data_size): Calculate
4178 size of incremental_got_plt section.
4179 (Output_section_incremental_inputs::do_write): Write the
4180 incremental_got_plt section.
4181 (Got_plt_view_info): New struct.
4182 (Local_got_offset_visitor): New class.
4183 (Global_got_offset_visitor): New class.
4184 (Global_symbol_visitor_got_plt): New class.
4185 (Output_section_incremental_inputs::write_got_plt): New function.
4186 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
4187 Add parameter. Adjust all callers.
4188 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4189 (Incremental_inputs::got_plt_section): New function.
4190 (Incremental_inputs::got_plt_section_): New data member.
4191 (Incremental_got_plt_reader): New class.
4192 * layout.cc (Layout::create_incremental_info_sections): Add the
4193 incremental_got_plt section.
4194 * object.h (Got_offset_list::get_list): New function.
4195 (Got offset_list::for_all_got_offsets): New function.
4196 (Sized_relobj::local_got_offset_list): New function.
4197 * powerpc.cc (Target_powerpc::got_size): Add const.
4198 (Target_powerpc::got_entry_count): New function.
4199 (Target_powerpc::plt_entry_count): New function.
4200 (Target_powerpc::first_plt_entry_offset): New function.
4201 (Target_powerpc::plt_entry_size): New function.
4202 (Output_data_plt_powerpc::entry_count): New function.
4203 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
4204 (Output_data_plt_powerpc::get_plt_entry_size): New function.
4205 * sparc.cc (Target_sparc::got_size): Add const.
4206 (Target_sparc::got_entry_count): New function.
4207 (Target_sparc::plt_entry_count): New function.
4208 (Target_sparc::first_plt_entry_offset): New function.
4209 (Target_sparc::plt_entry_size): New function.
4210 (Output_data_plt_sparc::entry_count): New function.
4211 (Output_data_plt_sparc::first_plt_entry_offset): New function.
4212 (Output_data_plt_sparc::get_plt_entry_size): New function.
4213 * symtab.h (Symbol::got_offset_list): New function.
4214 (Symbol_table::for_all_symbols): New function.
4215 * target.h (Sized_target::got_entry_count): New function.
4216 (Sized_target::plt_entry_count): New function.
4217 (Sized_target::plt_entry_size): New function.
4218 * x86_64.cc (Target_x86_64::got_size): Add const.
4219 (Target_x86_64::got_entry_count): New function.
4220 (Target_x86_64::plt_entry_count): New function.
4221 (Target_x86_64::first_plt_entry_offset): New function.
4222 (Target_x86_64::plt_entry_size): New function.
4223 (Output_data_plt_x86_64::entry_count): New function.
4224 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
4225 (Output_data_plt_x86_64::get_plt_entry_size): New function.
4227 2010-08-12 Cary Coutant <ccoutant@google.com>
4229 * archive.cc: Include incremental.h.
4230 (Archive::Archive): Initialize incremental_info_.
4231 (Archive::include_member): Record archive members in incremental info.
4232 (Add_archive_symbols::run): Record begin and end of an archive in
4234 (Lib_group::include_member): Record objects in incremental info.
4235 * archive.h (Incremental_archive_entry): Forward declaration.
4236 (Archive::set_incremental_info): New member function.
4237 (Archive::incremental_info): New member function.
4238 (Archive::Unused_symbol_iterator): New class.
4239 (Archive::unused_symbols_begin): New member function.
4240 (Archive::unused_symbols_end): New member function.
4241 (Archive::incremental_info_): New data member.
4242 * incremental-dump.cc (find_input_containing_global): New function.
4243 (dump_incremental_inputs): Dump new incremental info sections.
4244 * incremental.cc: Include symtab.h.
4245 (Output_section_incremental_inputs): New class.
4246 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
4247 new incremental info sections.
4248 (Sized_incremental_binary::do_check_inputs): Likewise.
4249 (Incremental_inputs::report_archive): Remove.
4250 (Incremental_inputs::report_archive_begin): New function.
4251 (Incremental_inputs::report_archive_end): New function.
4252 (Incremental_inputs::report_object): New function.
4253 (Incremental_inputs::finalize_inputs): Remove.
4254 (Incremental_inputs::report_input_section): New function.
4255 (Incremental_inputs::report_script): Rewrite.
4256 (Incremental_inputs::finalize): Do nothing but finalize string table.
4257 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4258 (Incremental_inputs::sized_create_inputs_section_data): Remove.
4259 (Incremental_inputs::create_data_sections): New function.
4260 (Incremental_inputs::relocs_entsize): New function.
4261 (Output_section_incremental_inputs::set_final_data_size): New function.
4262 (Output_section_incremental_inputs::do_write): New function.
4263 (Output_section_incremental_inputs::write_header): New function.
4264 (Output_section_incremental_inputs::write_input_files): New function.
4265 (Output_section_incremental_inputs::write_info_blocks): New function.
4266 (Output_section_incremental_inputs::write_symtab): New function.
4267 * incremental.h (Incremental_script_entry): Forward declaration.
4268 (Incremental_object_entry): Forward declaration.
4269 (Incremental_archive_entry): Forward declaration.
4270 (Incremental_inputs): Forward declaration.
4271 (Incremental_inputs_header_data): Remove.
4272 (Incremental_inputs_header): Remove.
4273 (Incremental_inputs_header_write): Remove.
4274 (Incremental_inputs_entry_data): Remove.
4275 (Incremental_inputs_entry): Remove.
4276 (Incremental_inputs_entry_write): Remove.
4277 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
4278 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
4279 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4280 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
4282 (Incremental_input_entry): New class.
4283 (Incremental_script_entry): New class.
4284 (Incremental_object_entry): New class.
4285 (Incremental_archive_entry): New class.
4286 (Incremental_inputs::Incremental_inputs): Initialize new data members.
4287 (Incremental_inputs::report_inputs): Remove.
4288 (Incremental_inputs::report_archive): Remove.
4289 (Incremental_inputs::report_archive_begin): New function.
4290 (Incremental_inputs::report_archive_end): New function.
4291 (Incremental_inputs::report_object): Change prototype.
4292 (Incremental_inputs::report_input_section): New function.
4293 (Incremental_inputs::report_script): Change prototype.
4294 (Incremental_inputs::get_reloc_count): New function.
4295 (Incremental_inputs::set_reloc_count): New function.
4296 (Incremental_inputs::create_data_sections): New function.
4297 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4298 (Incremental_inputs::inputs_section): New function.
4299 (Incremental_inputs::symtab_section): New function.
4300 (Incremental_inputs::relocs_section): New function.
4301 (Incremental_inputs::get_stringpool): Add const.
4302 (Incremental_inputs::command_line): Add const.
4303 (Incremental_inputs::inputs): Remove.
4304 (Incremental_inputs::command_line_key): New function.
4305 (Incremental_inputs::input_file_count): New function.
4306 (Incremental_inputs::input_files): New function.
4307 (Incremental_inputs::relocs_entsize): New function.
4308 (Incremental_inputs::sized_create_inputs_section_data): Remove.
4309 (Incremental_inputs::finalize_inputs): Remove.
4310 (Incremental_inputs::Input_info): Remove.
4311 (Incremental_inputs::lock_): Remove.
4312 (Incremental_inputs::inputs_): Change type.
4313 (Incremental_inputs::inputs_map_): Remove.
4314 (Incremental_inputs::current_object_entry_): New data member.
4315 (Incremental_inputs::inputs_section_): New data member.
4316 (Incremental_inputs::symtab_section_): New data member.
4317 (Incremental_inputs::relocs_section_): New data member.
4318 (Incremental_inputs::reloc_count_): New data member.
4319 (Incremental_inputs_reader): New class.
4320 (Incremental_symtab_reader): New class.
4321 (Incremental_relocs_reader): New class.
4322 * layout.cc (Layout::finalize): Move finalization of incremental info
4323 and creation of incremental info sections to follow finalization of
4324 symbol table. Set offsets for postprocessing sections.
4325 (Layout::create_incremental_info_sections): Call
4326 Incremental_inputs::create_data_sections. Add incremental symtab
4327 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
4328 sections to layout after input sections.
4329 * layout.h (struct Timespec): Forward declaration.
4330 (Layout::incremental_inputs): Add const.
4331 (Layout::create_incremental_info_sections): Add parameter.
4332 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
4333 * object.cc: Include incremental.h.
4334 (Relobj::finalize_incremental_relocs): New function.
4335 (Sized_relobj::do_layout): Record input sections in incremental info.
4336 * object.h (Object::output_section): New function.
4337 (Object::output_section_offset): Moved from Relobj.
4338 (Object::get_incremental_reloc_base): New function.
4339 (Object::get_incremental_reloc_count): New function.
4340 (Object::do_output_section): New function.
4341 (Object::do_output_section_offset): Moved from Relobj.
4342 (Object::do_get_incremental_reloc_base): New function.
4343 (Object::do_get_incremental_reloc_count): New function.
4344 (Object::Object): Initialize new data members.
4345 (Relobj::output_section): Renamed do_output_section and moved to
4347 (Relobj::output_section_offset): Moved to Object.
4348 (Relobj::do_get_incremental_reloc_base): New function.
4349 (Relobj::do_get_incremental_reloc_count): New function.
4350 (Relobj::allocate_incremental_reloc_counts): New function.
4351 (Relobj::count_incremental_reloc): New function.
4352 (Relobj::finalize_incremental_relocs): New function.
4353 (Relobj::next_incremental_reloc_index): New function.
4354 (Relobj::reloc_counts_): New data member.
4355 (Relobj::reloc_bases_): New data member.
4356 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
4357 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
4358 (Sized_relobj::incremental_relocs_scan): New function.
4359 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4360 (Sized_relobj::incremental_relocs_write): New function.
4361 (Sized_relobj::incremental_relocs_write_reltype): New function.
4362 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
4364 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
4365 archives and object files elsewhere.
4366 (Add_symbols::run): Report object files here.
4367 (Finish_group::run): Report end of archive at end of group.
4368 * reloc.cc: Include layout.h, incremental.h.
4369 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
4370 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
4371 (Sized_relobj::incremental_relocs_scan): New function.
4372 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4373 (Sized_relobj::do_relocate_sections): Write incremental relocations.
4374 (Sized_relobj::incremental_relocs_write): New function.
4375 (Sized_relobj::incremental_relocs_write_reltype): New function.
4376 * script.cc (read_input_script): Rewrite test for incremental link.
4377 Change call to Incremental_inputs::report_script.
4378 * symtab.h (Symbol_table::first_global_index): New function.
4379 (Symbol_table::output_count): New function.
4381 2010-08-12 Doug Kwan <dougkwan@google.com>
4383 * arm.cc (Target_arm::merge_object_attributes): Check command line
4384 options --no-wchar-size-warning and --no-enum-size-warning.
4385 * options.h (General_options): Add ld-compatible options
4386 --no-enum-size-warning and --no-wchar-size-warning.
4388 2010-08-04 Ian Lance Taylor <iant@google.com>
4390 * x86_64.cc (Target_x86_64::Scan::local): Use
4391 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
4392 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
4393 (Target_x86_64::Scan::global): Likewise.
4394 (Target_x86_64::Relocate::relocate): Likewise.
4395 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
4398 2010-08-03 Cary Coutant <ccoutant@google.com>
4400 * merge.cc (Output_merge_string::do_add_input_section): Count strings
4401 to reserve space in merged_strings vector. Keep total input size
4403 (Output_merge_string::do_print_merge_stats): Print total input size.
4404 * merge.h (Output_merge_string): Add input_size_ field.
4405 * stringpool.cc (Stringpool_template::string_length): Move
4406 implementations out of Stringpool_template class and place in
4408 * stringpool.h (string_length): Move out of Stringpool_template.
4410 2010-08-03 Ian Lance Taylor <iant@google.com>
4413 * layout.cc (relaxation_loop_body): If address of load segment is
4414 set, adjust address to include headers if possible.
4416 2010-08-03 Ian Lance Taylor <iant@google.com>
4418 * version.cc (version_string): Bump to 1.10.
4420 2010-08-03 Ian Lance Taylor <iant@google.com>
4423 * layout.h (enum Output_section_order): Define.
4424 (class Layout): Update declarations.
4425 * layout.cc (Layout::get_output_section): Add order parameter.
4426 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
4427 is_first_non_relro parameters. Change all callers.
4428 (Layout::choose_output_section): Likewise.
4429 (Layout::add_output_section_data): Likewise.
4430 (Layout::make_output_section): Likewise. Set order.
4431 (Layout::default_section_order): New function.
4432 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
4433 * output.cc (Output_section::Output_section): Initialize order_.
4434 Don't initialize deleted fields.
4435 (Output_segment::Output_segment): Don't initialize deleted
4437 (Output_segment::add_output_section_to_load): New function
4438 replacing add_output_section. Change all callers to call this or
4439 add_output_section_to_nonload.
4440 (Output_segment::add_output_section_to_nonload): New function.
4441 (Output_segment::remove_output_section): Rewrite.
4442 (Output_segment::add_initial_output_data): Likewise.
4443 (Output_segment::has_any_data_sections): Likewise.
4444 (Output_segment::is_first_section_relro): Likewise.
4445 (Output_segment::maximum_alignment): Likewise.
4446 (Output_segment::has_dynamic_reloc): New function replacing
4447 dynamic_reloc_count. Change all callers.
4448 (Output_segment::has_dynamic_reloc_list): New function replacing
4449 dynamic_reloc_count_list. Change all callers.
4450 (Output_segment::set_section_addresses): Rewrite.
4451 (Output_segment::set_offset): Rewrite.
4452 (Output_segment::find_first_and_last_list): Remove.
4453 (Output_segment::set_tls_offsets): Rewrite.
4454 (Output_segment::first_section_load_address): Likewise.
4455 (Output_segment::output_section_count): Likewise.
4456 (Output_segment::section_with_lowest_load_address): Likewise.
4457 (Output_segment::write_section_headers): Likewise.
4458 (Output_segment::print_sections_to_map): Likewise.
4459 * output.h (class Output_data): Remove dynamic_reloc_count_
4460 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
4461 (Output_data::add_dynamic_reloc): Rewrite.
4462 (Output_data::has_dynamic_reloc): New function.
4463 (Output_data::dynamic_reloc_count): Remove.
4464 (class Output_section): Add order_ field. Remvoe is_relro_local_,
4465 is_last_relro_, is_first_non_relro_, is_interp_,
4466 is_dynamic_linker_section_ fields. Add order and set_order
4467 functions. Remove is_relro_local, set_is_relro_local,
4468 is_last_relro, set_is_last_relro, is_first_non_relro,
4469 set_is_first_non_relro functions, is_interp, set_is_interp,
4470 is_dynamic_linker_section, and set_is_dynamic_linker_section
4472 (class Output_segment): Change Output_data_list from std::list to
4473 std:;vector. Add output_lists_ field. Remove output_data_ and
4474 output_bss_ fields. Update declarations.
4476 2010-08-02 Ian Lance Taylor <iant@google.com>
4478 * arm.cc (Target_arm::gc_process_relocs): Use typename.
4479 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
4480 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
4482 2010-08-02 Ian Lance Taylor <iant@google.com>
4485 * script.cc (Script_options::Script_options): Initialize
4486 symbol_definitions_ and symbol_references_.
4487 (Script_options::add_symbol_assignment): Update
4488 symbol_definitions_ and symbol_references_.
4489 (Script_options::add_symbol_reference): New function.
4490 (script_symbol): New function.
4491 * script.h (class Script_options): Add symbol_definitions_ and
4492 symbol_references_ fields.
4493 (Script_options::referenced_const_iterator): New type.
4494 (Script_options::referenced_begin): New function.
4495 (Script_options::referenced_end): New function.
4496 (Script_options::is_referenced): New function.
4497 (Script_options::any_unreferenced): New function.
4498 * script-c.h (script_symbol): Declare.
4499 * yyscript.y (exp): Call script_symbol.
4500 * symtab.cc: Include "script.h".
4501 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
4502 Change all callers. Check symbols referenced by scripts.
4503 (Symbol_table::add_undefined_symbols_from_command_line): Add
4504 layout parameter. Change all callers.
4505 (Symbol_table::do_add_undefined_symbols_from_command_line):
4506 Likewise. Break out loop body. Check symbols referenced by
4508 (Symbol_table::add_undefined_symbol_from_command_line): New
4509 function broken out of
4510 do_add_undefined_symbols_from_command_line.
4511 * symtab.h (class Symbol_table): Update declarations.
4512 * archive.cc: Include "layout.h".
4513 (Archive::should_include_member): Add layout parameter. Change
4514 all callers. Check for symbol mentioned in expression.
4515 * archive.h (class Archive): Update declaration.
4516 * object.cc (Sized_relobj::do_should_include_member): Add layout
4518 * object.h (Object::should_include_member): Add layout parameter.
4520 (Object::do_should_include_member): Add layout parameter.
4521 (class Sized_relobj): Update declaration.
4522 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
4524 * dynobj.h (class Sized_dynobj): Update declaration.
4525 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
4527 * plugin.h (class Sized_pluginobj): Update declaration.
4529 2010-08-02 Ian Lance Taylor <iant@google.com>
4532 * output.cc (Output_segment::set_offset): Search for the first and
4533 last sections rather than assuming that the list is in order.
4534 (Output_segment::find_first_and_last_list): New function.
4535 * output.h (class Output_segment): Update declarations.
4536 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4537 (relro_strip_test_SOURCES): New variable.
4538 (relro_strip_test_DEPENDENCIES): New variable.
4539 (relro_strip_test_LDFLAGS): New variable.
4540 (relro_strip_test_LDADD): New variable.
4541 (relro_strip_test.so): New target.
4543 2010-08-02 Ian Lance Taylor <iant@google.com>
4545 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4546 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4547 (Target_i386::got_tlsdesc_section): New function.
4548 (Target_i386::got_section): Create space for GOT entries for
4549 TLSDESC relocations.
4550 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4552 (Target_i386::Scan::global): Likewise.
4553 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
4555 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
4556 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
4557 (Target_x86_64::got_tlsdesc_section): New function.
4558 (Target_x86_64::got_section): Create space for GOT entries for
4559 TLSDESC relocations.
4560 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
4562 (Target_x86_64::Scan::global): Likewise.
4563 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
4566 2010-08-02 Ian Lance Taylor <iant@google.com>
4568 * testsuite/final_layout.sh: Use dc to convert from hex to
4571 2010-07-29 Sriraman Tallam <tmsriram@google.com>
4573 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4574 paramter to the call to gold::gc_process_relocs.
4575 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4576 paramter to the call to gold::gc_process_relocs.
4577 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4578 parameter to the call to gold::gc_process_relocs.
4579 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4580 template parameter to the call to gold::gc_process_relocs.
4581 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4582 paramter to the call to gold::gc_process_relocs.
4583 * gc.h (get_embedded_addend_size): New function.
4584 (gc_process_relocs): Save the size of the reloc for use by ICF.
4585 * icf.cc (get_section_contents): Get the addend from the text section
4586 for SHT_REL relocation sections.
4587 * icf.h (Icf::Reloc_addend_size_info): New typedef.
4588 (Icf::Reloc_info): Add new member reloc_addend_size_info.
4589 * int_encoding.h (read_from_pointer): New overloaded function.
4590 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
4591 * testsuite/icf_sht_rel_addend_test.sh: New file.
4592 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
4593 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
4595 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4597 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
4598 * Makefile.in: Regenerate.
4599 * testsuite/Makefile.in: Regenerate.
4601 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
4603 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
4604 * gold/testsuite/debug_msg.cc: Likewise.
4605 * gold/testsuite/odr_violation1.cc
4606 * gold/testsuite/odr_violation2.cc
4608 2010-07-21 Cary Coutant <ccoutant@google.com>
4610 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
4611 string, and length fields.
4612 (Output_merge_string::Merged_strings_list): New type.
4613 (Output_merge_string::Merged_strings_lists): New typedef.
4614 (Output_merge_string): Replace merged_strings_ with
4615 merged_strings_lists_.
4616 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
4617 Merged_strings_list per input object and section. Don't store pointer
4618 to the string. Don't store length with each merged string entry.
4619 (Output_merge_string::finalize_merged_data): Loop over list of merged
4620 strings lists. Recompute length of each merged string.
4622 2010-07-15 Cary Coutant <ccoutant@google.com>
4624 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
4627 2010-07-14 Ian Lance Taylor <iant@google.com>
4629 * descriptors.cc (Descriptors::open): Report correct name in error
4632 2010-07-13 Doug Kwan <dougkwan@google.com>
4634 * arm.cc (Arm_input_section::Arm_input_section): For a
4635 SHT_ARM_EXIDX section, always keeps the input sections.
4636 (Arm_input_section::set_exidx_section_link): New method.
4637 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
4638 has_errors_ to false.
4639 (Arm_exidx_input_section::has_errors,
4640 Arm_exidx_input_section::set_has_errors): New methods.
4641 (Arm_exidx_input_section::has_errors_): New data member.
4642 (Arm_relobj::get_exidx_shndx_list): New method.
4643 (Arm_output_section::append_text_sections_to_list): Do not skip
4644 section without SHF_EXECINSTR.
4645 (Arm_output_section::fix_exidx_coverage): Skip input sections with
4647 (Arm_relobj::make_exidx_input_section): Add new parameter for text
4648 section header. Make error messages more verbose. Check for
4649 a non-executable section linked to an EXIDX section.
4650 (Arm_relobj::do_read_symbols): Remove error checking, which has been
4651 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
4652 check that there is no deferred EXIDX section if we exit early.
4653 Instead of not making an EXIDX section in case of an error, make one
4654 and set the has_errors flag of it.
4655 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
4656 in a relocatable link.
4657 (Target_arm::do_relax): Look for the EXIDX output section instead of
4658 assuming that it is called .ARM.exidx.
4659 (Target_arm::fix_exidx_coverage): Add a new parameter for input
4660 section list. Do not check for SHF_EXECINSTR section flags but
4661 skip any input section with errors.
4662 * output.cc (Output_section::Output_section): Initialize
4663 always_keeps_input_sections_ to false.
4664 (Output_section::add_input_section): Check for
4665 always_keeps_input_sections_.
4666 * output.h (Output_section::always_keeps_input_sections,
4667 Output_section::set_always_keeps_input_sections): New methods.
4668 (Output_section::always_keeps_input_sections): New data member.
4670 2010-07-13 Rafael Espindola <espindola@google.com>
4672 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
4673 * fileread.h (Input_file): Add try_extra_search_path and find_file.
4675 2010-07-13 Philip Herron <herron.philip@googlemail.com>
4676 Ian Lance Taylor <iant@google.com>
4678 * output.h (Output_section_lookup_maps::add_merge_section):
4679 Correct check of whether value was inserted.
4680 (Output_section_lookup_maps::add_merge_input_section): Likewise.
4681 (Output_section_lookup_maps::add_relaxed_input_section):
4683 * arm.cc (Target_arm::got_section): Remove used local os.
4684 * i386.cc (Target_i386::got_section): Likewise.
4685 * x86_64.cc (Target_x86_64::got_section): Likewise.
4686 * sparc.cc (Target_sparc::got_section): Likewise.
4687 (Target_sparc::relocate): Remove unused local have_got_offset.
4688 * powerpc.cc (Target_powerpc::relocate): Likewise.
4690 2010-07-13 Ian Lance Taylor <iant@google.com>
4692 * compressed_output.cc (zlib_decompress): Fix signature in
4695 * archive.cc (Archive::include_member): Unlock an external member
4696 of a thin archive. Don't bother to delete an object we know is
4699 2010-07-12 Cary Coutant <ccoutant@google.com>
4701 * compressed_output.cc (zlib_decompress): New function.
4702 (get_uncompressed_size): New function.
4703 (decompress_input_section): New function.
4704 * compressed_output.h (get_uncompressed_size): New function.
4705 (decompress_input_section): New function.
4706 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
4707 Handle compressed debug sections.
4708 * layout.cc (is_compressed_debug_section): New function.
4709 (Layout::output_section_name): Map compressed section names to
4711 * layout.h (is_compressed_debug_section): New function.
4712 (is_debug_info_section): Recognize compressed debug sections.
4713 * merge.cc: Include compressed_output.h.
4714 (Output_merge_data::do_add_input_section): Handle compressed
4716 (Output_merge_string::do_add_input_section): Handle compressed
4718 * object.cc: Include compressed_output.h.
4719 (Sized_relobj::Sized_relobj): Initialize new data members.
4720 (build_compressed_section_map): New function.
4721 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
4722 * object.h (Object::section_is_compressed): New method.
4723 (Object::do_section_is_compressed): New method.
4724 (Sized_relobj::Compressed_section_map): New type.
4725 (Sized_relobj::do_section_is_compressed): New method.
4726 (Sized_relobj::compressed_sections_): New data member.
4727 * output.cc (Output_section::add_input_section): Handle compressed
4729 * reloc.cc: Include compressed_output.h.
4730 (Sized_relobj::write_sections): Handle compressed debug sections.
4732 2010-07-08 Cary Coutant <ccoutant@google.com>
4734 * resolve.cc (Symbol_table::resolve): Remember whether undef was
4735 weak when resolving to a dynamic def.
4736 (Symbol_table::should_override): Add adjust_dyndef flag; set it
4737 for weak undef/dynamic def cases. Adjust callers.
4738 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
4739 undef_binding_weak_.
4740 (Symbol_table::sized_write_globals): Adjust symbol binding.
4741 (Symbol_table::sized_write_symbol): Add binding parameter.
4742 * symtab.h (Symbol::set_undef_binding): New method.
4743 (Symbol::is_undef_binding_weak): New method.
4744 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
4745 (Symbol_table::should_override): Add new parameter.
4746 (Symbol_table::sized_write_symbol): Add new parameter.
4748 * testsuite/weak_undef_file1.cc: Add new test case.
4749 * testsuite/weak_undef_file2.cc: Fix header comment.
4750 * testsuite/weak_undef_test.cc: Add new test case.
4752 2010-06-29 Doug Kwan <dougkwan@google.com>
4754 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
4755 Initialize USE_SYMBOL_.
4756 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
4758 (Arm_reloc_property::uses_symbol_): New data member declaration.
4759 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
4760 uses symbol value and symbol is undefined but not weakly undefined.
4762 2010-06-28 Rafael Espindola <espindola@google.com>
4764 * plugin.cc (Plugin::load): Use dlerror.
4766 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
4768 * symtab.cc (detect_odr_violations): When reporting an ODR
4769 violation, report an object where the symbol is defined.
4771 2010-06-25 Doug Kwan <dougkwan@google.com>
4773 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
4774 (Target_arm::section_may_have_icf_unsafe_pointers): New method
4776 (Target_arm::Scan::local_reloc_may_be_function_pointer,
4777 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
4778 target hook to detect function points.
4779 (Target_arm::Scan::possible_function_pointer_reloc): New method.
4780 * icf.h (Icf::check_section_for_function_pointers): Change type of
4781 parameter SECTION_NAME to const reference to std::string. Use
4782 target hook to determine if section may have unsafe pointers.
4783 * target.h (Target::section_may_have_icf_unsafe_pointers): New
4786 2010-06-21 Rafael Espindola <espindola@google.com>
4788 * fileread.cc (Input_file::find_fie): New
4789 (Input_file::open): Use Input_file::find_fie.
4790 * fileread.h (Input_file::find_fie): New
4791 * plugin.cc (set_extra_library_path): New.
4792 (Plugin::load): Add set_extra_library_path to the transfer vector.
4793 (Plugin_manager::set_extra_library_path): New.
4794 (Plugin_manager::add_input_file): Use the extra search path if set.
4795 (set_extra_library_path(): New.
4796 * plugin.h (Plugin_manager): Add set_extra_library_path and
4799 2010-06-19 Cary Coutant <ccoutant@google.com>
4801 * layout.cc (gdb_sections): Add .debug_types.
4802 (lines_only_debug_sections): Likewise.
4804 2010-06-18 Rafael Espindola <espindola@google.com>
4806 * plugin.cc (add_input_file,add_input_library)
4807 (Plugin_manager::add_input_file): Make filename arguments const.
4808 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
4811 2010-06-16 Doug Kwan <dougkwan@google.com>
4813 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
4814 .ARM.attributes section if we have not merged any input
4815 attributes sections.
4817 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4819 * arm.cc: Allow combining objects with no EABI version
4822 2010-06-15 Rafael Espindola <espindola@google.com>
4824 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
4826 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4828 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
4829 (struct iovec): Correct !HAVE_READV definition.
4831 2010-06-10 Cary Coutant <ccoutant@google.com>
4833 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
4834 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
4836 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
4839 * symtab.h (Symbol::is_placeholder): New member function.
4840 * target-reloc.h (relocate_section): Check for placeholder symbols.
4842 * testsuite/Makefile.am (plugin_test_8): New test.
4843 (plugin_test_9): New test.
4844 * testsuite/Makefile.in: Regenerate.
4846 2010-06-09 Nick Clifton <nickc@redhat.com>
4848 * yyscript.y (input_list_element): Allow strings prefixed with
4849 the '-' character. Treat these as libraries.
4850 * script.cc (script_add_library): New function. Adds a library
4851 specified by "-l<name>" found in an input script.
4852 * script-c.h: Add prototype for script_add_library.
4854 2010-06-07 Doug Kwan <dougkwan@google.com>
4856 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
4857 Restrict stub-group size to be within long conditional branch
4858 range when working around cortex-A8 erratum.
4860 2010-06-07 Damien Diederen <dd@crosstwine.com>
4862 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
4865 2010-06-03 Sriraman Tallam <tmsriram@google.com>
4869 (Output_section::Input_section_sort_entry::compare_section_ordering):
4870 Change to return non-zero correctly.
4871 (Output_section::Input_section_sort_section_order_index_compare
4872 ::operator()): Change to fix ambiguity in comparisons.
4874 2010-06-01 Sriraman Tallam <tmsriram@google.com>
4876 * gold.h (is_wildcard_string): New function.
4877 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
4878 (Layout::layout_eh_frame): Ditto.
4879 (Layout::find_section_order_index): New method.
4880 (Layout::read_layout_from_file): New method.
4881 * layout.h (Layout::find_section_order_index): New method.
4882 (Layout::read_layout_from_file): New method.
4883 (Layout::input_section_position_): New private member.
4884 (Layout::input_section_glob_): New private member.
4885 * main.cc (main): Call read_layout_from_file here.
4886 * options.h (--section-ordering-file): New option.
4887 * output.cc (Output_section::input_section_order_specified_): New
4889 (Output_section::Output_section): Initialize new member.
4890 (Output_section::add_input_section): Add new parameter.
4891 Keep input sections when --section-ordering-file is used.
4892 (Output_section::set_final_data_size): Sort input sections when
4893 section ordering file is specified.
4894 (Output_section::Input_section_sort_entry): Add new parameter.
4896 (Output_section::Input_section_sort_entry::compare_section_ordering):
4898 (Output_section::Input_section_sort_compare::operator()): Change to
4899 consider section_order_index.
4900 (Output_section::Input_section_sort_init_fini_compare::operator()):
4901 Change to consider section_order_index.
4902 (Output_section::Input_section_sort_section_order_index_compare
4903 ::operator()): New method.
4904 (Output_section::sort_attached_input_sections): Change to sort
4905 according to section order when specified.
4906 (Output_section::add_input_section<32, true>): Add new parameter.
4907 (Output_section::add_input_section<64, true>): Add new parameter.
4908 (Output_section::add_input_section<32, false>): Add new parameter.
4909 (Output_section::add_input_section<64, false>): Add new parameter.
4910 * output.h (Output_section::add_input_section): Add new parameter.
4911 (Output_section::input_section_order_specified): New
4913 (Output_section::set_input_section_order_specified): New method.
4914 (Input_section::Input_section): Initialize section_order_index_.
4915 (Input_section::section_order_index): New method.
4916 (Input_section::set_section_order_index): New method.
4917 (Input_section::section_order_index_): New member.
4918 (Input_section::Input_section_sort_section_order_index_compare): New
4920 (Output_section::input_section_order_specified_): New member.
4921 * script-sections.cc (is_wildcard_string): Delete and move modified
4923 (Output_section_element_input::Output_section_element_input): Modify
4924 call to is_wildcard_string.
4925 (Output_section_element_input::Input_section_pattern
4926 ::Input_section_pattern): Ditto.
4927 (Output_section_element_input::Output_section_element_input): Ditto.
4928 * testsuite/Makefile.am (final_layout): New test case.
4929 * testsuite/Makefile.in: Regenerate.
4930 * testsuite/final_layout.cc: New file.
4931 * testsuite/final_layout.sh: New file.
4933 2010-06-01 Rafael Espindola <espindola@google.com>
4935 * plugin.cc (Plugin::load): Pass the output name to the plugin.
4937 2010-06-01 Rafael Espindola <espindola@google.com>
4939 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
4940 visibility of symbols.
4942 2010-05-27 Doug Kwan <dougkwan@google.com>
4944 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
4945 from start of output section instead of address for a local symbol
4946 in a merged or relaxed section when doing a relocatable link.
4948 2010-05-26 Rafael Espindola <espindola@google.com>
4951 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
4952 adding sections the garbage collector removed.
4953 * gold/testsuite/Makefile.am: Add test.
4954 * gold/testsuite/Makefile.in: Regenerate.
4955 * gold/testsuite/plugin_test_7.sh: New.
4956 * gold/testsuite/plugin_test_7_1.c: New.
4957 * gold/testsuite/plugin_test_7_2.c: New.
4959 2010-05-26 Rafael Espindola <espindola@google.com>
4961 * script-sections.cc (Output_section_definition::set_section_addresses):
4962 Check for --section-start.
4964 2010-05-26 Doug Kwan <dougkwan@google.com>
4966 * arm.cc (Arm_scan_relocatable_relocs): New class.
4967 (Target_arm::relocate_special_relocatable): New method.
4968 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
4969 (Arm_relocate_functions::thumb_branch_common): Same.
4970 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
4971 instead of Default_scan_relocatable_relocs.
4972 * target-reloc.h (relocate_for_relocatable): Let target handle
4973 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
4974 * target.h (Sized_target::relocate_special_relocatable): New method.
4976 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4978 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
4980 2010-05-23 Doug Kwan <dougkwan@google.com>
4982 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
4984 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
4985 with a direct branch, not a conditional branch, to a stub.
4986 * merge.cc (Output_merge_base::record_input_section): New method
4988 (Output_merge_data::do_add_input_section): Record input section if
4989 keeps-input-sections flag is set.
4990 (Output_merge_string::do_add_input_section): Ditto.
4991 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
4992 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
4994 (Output_merge_base::keeps_input_sections,
4995 Output_merge_base::set_keeps_input_sections,
4996 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
4998 (Output_merge_base::Input_sections): New type declaration.
4999 (Output_merge_base::input_sections_begin,
5000 Output_merge_base::input_sections_end,
5001 Output_merge_base::do_set_keeps_input_sections): New method definitions.
5002 (Output_merge_base::bool keeps_input_sections_,
5003 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
5004 Output_merge_base::input_sections_): New data members.
5005 (Output_merge_data::do_set_keeps_input_sections): New method
5007 (Output_merge_string::do_set_keeps_input_sections): Ditto.
5008 * output.cc (Output_section::Input_section::relobj): Move method
5009 defintion from class declaration to here and handle merge sections.
5010 (Output_section::Input_section::shndx): Ditto.
5011 (Output_section::Output_section): Remove initializations of removed
5012 data members and initialize new data member LOOKUP_MAPS_.
5013 (Output_section::add_input_section): Set keeps-input-sections flag
5014 for a newly created merge output section as appropriate. Adjust code
5015 to use Output_section_lookup_maps class.
5016 (Output_section::add_relaxed_input_section): Adjst code for lookup
5017 maps code refactoring.
5018 (Output_section::add_merge_input_section): Add a new parameter
5019 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
5020 class. If adding input section to a newly created merge output
5021 section fails, remove the new merge section.
5022 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
5023 Adjust code for use of the Output_section_lookup_maps class.
5024 (Output_section::find_merge_section): Ditto.
5025 (Output_section::build_lookup_maps): New method defintion.
5026 (Output_section::find_relaxed_input_section): Adjust code to use
5027 Output_section_lookup_maps class.
5028 (Output_section::get_input_sections): Export merge sections. Adjust
5029 code to use Output_section_lookup_maps class.
5030 (Output_section:::add_script_input_section): Adjust code to use
5031 Output_section_lookup_maps class. Update lookup maps for merge
5033 (Output_section::discard_states): Use Output_section_lookup_maps.
5034 (Output_section::restore_states): Same.
5035 * output.h (Merge_section_properties): Move class defintion out of
5037 (Output_section_lookup_maps): New class.
5038 (Output_section::Input_section::is_merge_section): New method
5040 (Output_section::Input_section::relobj): Move defintion out of class
5041 defintion. Declare method only.
5042 (Output_section::Input_section::shndx): Ditto.
5043 (Output_section::Input_section::output_merge_base): New method defintion.
5044 (Output_section::Input_section::u2_.pomb): New union field.
5045 (Output_section::Merge_section_by_properties_map,
5046 Output_section::Output_section_data_by_input_section_map,
5047 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
5049 (Output_section::add_merge_input_section): Add new parameter
5050 KEEPS_INPUT_SECTIONS.
5051 (Output_section::build_lookup_maps): New method declaration.
5052 (Output_section::merge_section_map_,
5053 Output_section::merge_section_by_properties_map_,
5054 Output_section::relaxed_input_section_map_,
5055 Output_section::is_relaxed_input_section_map_valid_): Remove data
5057 (Output_section::lookup_maps_): New data member.
5059 2010-05-21 Doug Kwan <dougkwan@google.com>
5062 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
5063 avoid a compilation error.
5065 2010-05-19 Rafael Espindola <espindola@google.com>
5067 * script-sections.cc (Output_section_definition::allocate_to_segment):
5068 Update the phdrs_list even when the output section is NULL.
5069 * testsuite/Makefile.am: Add test.
5070 * testsuite/Makefile.in: Regenerate.
5071 * testsuite/script_test_9.cc: New.
5072 * testsuite/script_test_9.sh: New.
5073 * testsuite/script_test_9.t: New.
5075 2010-05-19 Doug Kwan <dougkwan@google.com>
5077 * arm.cc (Arm_input_section::original_size): New method.
5078 (Arm_input_section::do_addralign): Add a cast.
5079 (Arm_input_section::do_output_offset): Remove static cast.
5080 (Arm_input_section::original_addralign,
5081 Arm_input_section::original_size_): Change type to uint32_t.
5082 (Arm_input_section::init): Add safe casts for section alignment
5084 (Arm_input_section::set_final_data_size): Do not set address and
5085 offset of stub table.
5086 (Arm_output_section::fix_exidx_coverage): Change use of of
5087 Output_section::Simple_input_section to that of
5088 Output_section::Input_section.
5089 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
5090 except for the first pass.
5091 * output.cc (Output_section::get_input_sections): Change type of
5092 input_sections to std::list<Input_section>.
5093 (Output_section::add_script_input_section): Rename from
5094 Output_section::add_simple_input_section. Change type of SIS
5095 parameter from Simple_input_section to Input_section.
5096 * output.h (Output_section::Simple_input_section): Remove class.
5097 (Output_section::Input_section): Change class visibility to public.
5098 (Output_section::Input_section::addralign): Use stored alignments
5099 for special input sections if set.
5100 (Output_section::Input_section::set_addralign): New method.
5101 (Output_section::get_input_sections): Change parameter type from
5102 list of Simple_input_section to list of Input_section.
5103 (Output_section::add_script_input_section): Rename from
5104 Output_section::add_simple_input_section. Change first parameter's
5105 type from Simple_input_section to Input_section and remove the
5106 second and third parameters.
5107 * script-sections.cc (Input_section::Input_section_list): Change
5108 type to list of Output_section::Input_section/
5109 (Input_section_info::Input_section_info): Change parameter type of
5110 INPUT_SECTION to Output_section::Input_section.
5111 (Input_section_info::input_section): Change return type.
5112 (Input_section_info::input_section_): Change type to
5113 Output_section::Input_section.
5114 (Output_section_element_input::set_section_addresses): Adjust code
5115 to use Output_section::Input_section instead of
5116 Output_section::Simple_input_section. Adjust code for renaming
5117 of Output_section::add_simple_input_section.
5118 (Orphan_output_section::set_section_addresses): Ditto.
5120 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5122 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
5123 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
5125 2010-05-18 Rafael Espindola <espindola@google.com>
5127 * options.cc (General_options::finalize): Handle -nostdlib.
5128 * options.h (nostdlib): New option.
5129 * script.cc (script_add_search_dir): Handle -nostdlib.
5131 2010-05-12 Doug Kwan <dougkwan@google.com>
5133 * arm.cc (Target_arm::do_finalize_sections): Create an empty
5134 attributes section only if there no attributes section after merging.
5135 (Target_arm::merge_object_attributes): Move value of
5136 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
5137 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
5138 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
5139 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
5140 and arm_attr_merge_7.stdout.
5141 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
5142 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
5143 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
5144 arm_attr_merge_7b.o): New rules.
5145 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
5147 * testsuite/Makefile.in: Regenerate.
5148 * testsuite/arm_attr_merge.sh: New file.
5149 * testsuite/arm_attr_merge_[67][ab].s: Same.
5151 2010-05-05 Nick Clifton <nickc@redhat.com>
5153 * po/es.po: Updated Spanish translation.
5155 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
5157 * Makefile.am (install-exec-local): Properly install gold as
5158 default cross linker.
5159 * Makefile.in: Regenerated.
5161 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
5162 Nick Clifton <nickc@redhat.com>
5164 * configure.ac (install_as_default): Define and set to false
5165 unless --enable-gold or --enable-gold=both/gold has been
5167 * configure: Regenerate.
5169 * Makefile.am (install-exec-local): Install the executable as
5170 'ld.gold'. If install_as_default is true then also install it as
5172 * Makefile.in: Regenerated.
5174 2010-04-24 Ian Lance Taylor <iant@google.com>
5176 * layout.cc (Layout::layout_reloc): In relocatable link don't
5177 combine reloc sections for grouped sections.
5179 2010-04-23 Sriraman Tallam <tmsriram@google.com>
5181 * gc.h (gc_process_relocs): Pass information on relocs pointing to
5182 sections that are not ordinary to icf.
5183 * icf.cc (get_section_contents): Handle relocation pointing to section
5184 with no object or shndx information.
5185 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
5186 * testsuite/Makefile.in: Regenerate.
5187 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
5188 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
5190 2010-04-22 Ian Lance Taylor <iant@google.com>
5192 * expression.cc (Expression::Expression_eval_info): Add
5193 result_alignment_pointer field.
5194 (Expression::eval_with_dot): Add result_alignment_pointer
5195 parameter. Change all callers.
5196 (Expression::eval_maybe_dot): Likewise.
5197 (class Binary_expression): Add alignment_pointer parameter to
5198 left_value and right_value. Change all callers.
5199 (BINARY_EXPRESSION): Set result alignment.
5200 (class Trinary_expression): Add alignment_pointer parameter to
5201 arg2_value and arg3_value. Change all callers.
5202 (Trinary_cond::value): Set result alignment.
5203 (Max_expression::value, Min_expression::value): Likewise.
5204 (Align_expression::value): Likewise.
5205 * script-sections.cc (class Sections_element): Add dot_alignment
5206 parameter to set_section_addresses virtual function. Update
5208 (class Output_section_element): Likewise.
5209 (Script_sections::create_segments): Add dot_alignment parameter.
5211 (Script_sections::create_segments_from_phdrs_clause): Likewise.
5212 (Script_sections::set_phdrs_clause_addresses): Likewise.
5213 * script-sections.h: Update declarations.
5214 * script.h: Update declarations.
5215 * output.h (Output_segment::set_minimum_p_align): Don't decrease
5217 * testsuite/script_test_3.t: Set large alignment.
5218 * testsuite/script_test_3.sh: Make sure that at least one LOAD
5219 segment has expected alignment.
5221 2010-04-22 Nick Clifton <nickc@redhat.com>
5223 * po/gold.pot: Updated by the Translation project.
5224 * po/vi.po: Updated Vietnamese translation.
5226 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
5228 * testsuite/Makefile.am (check_PROGRAMS): Add
5229 icf_virtual_function_folding_test.
5230 * testsuite/Makefile.in: Regenerated.
5232 2010-04-15 Andrew Haley <aph@redhat.com>
5234 * options.h (merge_exidx_entries): New option.
5235 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
5236 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
5237 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
5238 (Target_arm::merge_exidx_entries): New function.
5239 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
5240 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
5241 to Arm_exidx_fixup constructor.
5242 Add new arg, merge_exidx_entries.
5243 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
5244 Arm_output_section::fix_exidx_coverage.
5246 2010-04-18 Sriraman Tallam <tmsriram@google.com>
5248 * icf.cc (get_section_contents): Check for preemptible functions.
5249 Ignore addend when appropriate.
5250 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
5252 (add_from_relobj): Check for section folded.
5253 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
5254 * symtab.h (should_add_dynsym_entry): Add new parameter.
5255 * target-reloc.h (scan_relocs): Check for section folded.
5256 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
5257 Check reloc types for function pointers in shared objects.
5258 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
5260 (icf_preemptible_functions_test): New test case.
5261 (icf_string_merge_test): New test case.
5262 * testsuite.Makefile.in: Regenerate.
5263 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
5264 bar_glob. Refactor code.
5265 * testsuite/icf_preemptible_functions_test.cc: New file.
5266 * testsuite/icf_preemptible_functions_test.sh: New file.
5267 * testsuite/icf_string_merge_test.cc: New file.
5268 * testsuite/icf_string_merge_test.sh: New file.
5269 * testsuite/icf_virtual_function_folding_test.cc: New file.
5270 * testsuite/icf_virtual_function_folding_test.sh: New file.
5272 2010-04-14 Doug Kwan <dougkwan@google.com>
5274 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
5275 for local symbol recounting if we remove a section due to ICF.
5276 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
5277 there are no regular objects in input.
5279 2010-04-13 Doug Kwan <dougkwan@google.com>
5281 * arm.cc (Arm_input_section::set_final_data_size): Compute
5282 accurate final data size instead of using current data size.
5284 2010-04-09 Doug Kwan <dougkwan@google.com>
5286 * layout.cc (Layout::choose_output_section): Handle script section
5288 (Layout::make_output_section_for_script): Add section type parameter.
5289 Handle script section types.
5290 * layout.h (Layout::make_output_section_for_script): Add section
5292 * output.cc (Output_section::Output_section): Initialize data member
5294 (Output_section::do_reset_address_and_file_offset): Do not set address
5295 to 0 if section is a NOLOAD section.
5296 * output.h (Output_section::is_noload): New method.
5297 (Output_section::set_is_noload): Ditto.
5298 (Output_section::is_noload_): New data member.
5299 * script-c.h (Script_section_type): New enum type.
5300 (struct Parser_output_section_header): Add new file section_type.
5301 * script-sections.cc (Sections_element::output_section_name): Add
5302 parameter for returning script section type.
5303 (Output_section_definition::output_section_name): Ditto.
5304 (Output_section_definition::section_type)P; New method.
5305 (Output_section_definiton::script_section_type_name): Ditto.
5306 (Output_section_definition::script_section_type_): New data member.
5307 (Output_section_definition::Output_section_definition): Initialize
5308 data member Output_section_definition::script_section_type_.
5309 (Output_section_definition::create_sections): Pass script section type
5310 to Layout::make_output_section_for_script.
5311 (Output_section_definition::output_section_name): Return script
5312 section type to caller.
5313 (Output_section_definition::set_section_address): Do not advance
5314 dot value and load address if section type is NOLOAD. Set address
5315 of NOLOAD sections regardless of section flags.
5316 (Output_section_definition::print): Print section type if it is
5317 not SCRIPT_SECTION_TYPE_NONE.
5318 (Output_section_definition::section_type): New method.
5319 (Output_section_definition::script_section_type_name): Ditto.
5320 (Script_sections::output_section_name): Add new parameter
5321 PSECTION_TYPE for returning script section type. Pass it to
5322 section elements. Handle discard sections.
5323 (Sort_output_sections::operator()): Handle NOLOAD sections.
5324 * script-sections.h (Script_sections::Section_type): New enum type.
5325 (Script_sections::output_section_name): Add a new parameter for
5326 returning script section type.
5327 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
5329 * yyscript.y (union): Add new field SECTION_TYPE.
5330 (COPY, DSECT, INFO, NOLOAD): New tokens.
5331 (opt_address_and_section_type): Change type to output_section_header.
5332 (section_type): New non-terminal
5333 (section_header): Handle section type.
5334 (opt_address_and_section_type): Return section type value.
5336 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
5338 * testsuite/plugin_common_test_1.c (foo): Add prototype.
5339 * testsuite/plugin_common_test_2.c (foo): Likewise.
5341 2010-04-08 Doug Kwan <dougkwan@google.com>
5343 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
5345 * output.cc (Output_section::add_merge_input_section): Simplify
5346 code and return status of Output_merge_base::add_input_section.
5347 Update merge section map only if Output_merge_base::add_input_section
5350 2010-04-07 Doug Kwan <dougkwan@google.com>
5352 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
5353 if section is marked as containing instructions but has no mapping
5355 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
5356 correct section index.
5357 (Arm_relobj::find_linked_text_section): Ditto.
5359 2010-04-07 Cary Coutant <ccoutant@google.com>
5361 * archive.cc (include_member): Destroy Read_symbols_data object before
5363 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
5364 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
5365 (Read_symbols_data::~Read_symbols_data) New destructor.
5366 (Section_relocs::Section_relocs) New constructor.
5367 (Section_relocs::~Section_relocs) New destructor.
5368 (Read_relocs_data::Read_relocs_data) New constructor.
5369 (Read_relocs_data::~Read_relocs_data) New destructor.
5370 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
5371 pointers to NULL after deleting.
5373 2010-04-07 Doug Kwan <dougkwan@google.com>
5375 * arm.cc: Replace "endianity" with "endianness" in comments.
5376 (Arm_exidx_cantunwind): Ditto.
5377 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
5378 (Arm_relobj::merge_flags_and_attributes): New method.
5379 (Arm_relobj::merge_flags_and_attributes_): New data member.
5380 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
5381 (Arm_relobj::scan_sections_for_stubs): Ditto.
5382 (Arm_relobj::do_read_symbols): Check to see if we really want to
5383 merge processor-specific flags and attributes. Exit early if
5384 an object is empty except for section names and the undefined symbol.
5385 (Target_arm::do_finalize_sections): Move check for ELF format to
5386 Arm_relobj::do_read_symbols. Merge processor specific flags and
5387 attributes from a regular object only when we have determined that
5388 it is aapropriate. Do not create an .ARM.attributes section in
5389 output if there is no regular input object.
5390 (Target_arm::merge_processor_specific_flags): Check
5391 --warn-mismatch before printing any error.
5392 (Target_arm::merge_object_attributes): Ditto.
5393 * gold.cc (queue_middle_tasks): Handle the case in which there is
5394 no regular object in input.
5395 * options.cc (General_options::parse_EB): New method.
5396 (General_options::parse_EL): Same.
5397 (General_options::General_options): Initialize endianness_.
5398 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
5400 (General_options::Endianness): New enum.
5401 (General_options::endianness): New method.
5402 (General_options::endianness_): New data member.
5403 * parameters.cc (Parameters::set_options): Check target endianness.
5404 (Parameters::set_target_once): Ditto.
5405 (Parameters::check_target_endianness): New method.
5406 (parameters_force_valid_target): If either -EL or -EB is specified,
5407 use it to define endianness of default target.
5408 * parameters.h (Parameters::check_target_endianness): New method
5410 * target.h (class Target): Change "endianity" to "endianness"
5413 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5415 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
5416 * configure: Regenerate.
5417 * Makefile.in: Regenerate.
5418 * testsuite/Makefile.in: Regenerate.
5420 2010-04-06 Cary Coutant <ccoutant@google.com>
5423 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
5424 prevailing definitions of common symbols.
5425 * testsuite/plugin_test_6.sh: New test case.
5426 * testsuite/plugin_common_test_1.c: New test case.
5427 * testsuite/plugin_common_test_2.c: New test case.
5428 * testsuite/Makefile.am (plugin_test_6): New test case.
5429 * testsuite/Makefile.in: Regenerate.
5431 2010-04-06 Nick Clifton <nickc@redhat.com>
5433 * po/vi.po: New Vietnamese translation.
5435 2010-03-30 Doug Kwan <dougkwan@google.com>
5437 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
5439 2010-03-25 Doug Kwan <dougkwan@google.com>
5441 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
5442 to avoid a conversion warning on a 32-bit host.
5444 2010-03-24 Ian Lance Taylor <iant@google.com>
5446 * testsuite/script_test_3.t: Add a TLS segment.
5447 * testsuite/Makefile.am (check_PROGRAMS): Add
5448 tls_phdrs_script_test.
5449 (tls_phdrs_script_test_SOURCES): Define.
5450 (tls_phdrs_script_test_DEPENDENCIES): Define.
5451 (tls_phdrs_script_test_LDFLAGS): Define.
5452 (tls_phdrs_script_test_LDADD): Define.
5453 * testsuite/Makefile.in: Rebuild.
5455 2010-03-23 Cary Coutant <ccoutant@google.com>
5457 * fileread.cc (find_or_make_view): Fix comment.
5459 2010-03-23 Ian Lance Taylor <iant@google.com>
5461 * script-sections.cc (class Orphan_section_placement): Define
5462 PLACE_TLS and PLACE_TLS_BSS.
5463 (Orphan_section_placement::Orphan_section_placement): Initialize
5465 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
5466 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
5467 (tls_script_test_SOURCES): Define.
5468 (tls_script_test_DEPENDENCIES): Define.
5469 (tls_script_test_LDFLAGS): Define.
5470 (tls_script_test_LDADD): Define.
5471 * testsuite/Makefile.in: Rebuild.
5473 2010-03-22 Doug Kwan <dougkwan@google.com>
5475 * arm.cc (Arm_relocate_functions::abs8,
5476 Arm_relocate_functions::abs16): Use correct check for overflow
5477 specified in the ARM ELF specs.
5478 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
5479 target of a BLX instruction specially.
5480 (Reloc_stub::stub_type_for_reloc): Ditto.
5481 (Relocate::relocate): Use symbolic names instead of numeric relocation
5482 codes to report error.
5483 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
5485 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
5486 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
5487 thumb2_blx_out_of_range.stdout
5488 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
5489 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
5490 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
5491 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
5492 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
5493 thumb2_blx_in_range, thumb2_blx_in_range.o,
5494 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
5495 thumb2_blx_out_of_range.o): New rules.
5496 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
5497 thumb2_blx_in_range and thumb2_blx_out_of_range.
5498 * testsuite/Makefile.in: Regenerate.
5499 * arm_branch_in_range.sh: Add tests for THUMB BLX.
5500 * testsuite/thumb_blx_in_range.s: New file.
5501 * testsuite/thumb_blx_out_of_range.s: New file.
5503 2010-03-22 Rafael Espindola <espindola@google.com>
5505 * archive.cc (Should_include): Move to archive.h.
5506 (should_include_member): Make it a member of Archive.
5508 (Add_lib_group_symbols): New.
5509 * archive.h: Include options.h.
5510 (Archive_member): Moved from Archive.
5511 (Should_include): Moved from archive.cc.
5513 (Add_lib_group_symbols): New.
5514 * dynobj.cc (do_should_include_member): New.
5515 * dynobj.h (do_should_include_member): New.
5516 * gold.cc (queue_initial_tasks): Update call to queue.
5517 * main.cc (main): Print lib group stats.
5518 * object.cc (do_should_include_member): New.
5519 * object.h: Include archive.h.
5520 (Object::should_include_member): New.
5521 (Object::do_should_include_member): New.
5522 (Sized_relobj::do_should_include_member): New.
5523 * options.cc (General_options::parse_start_lib): New.
5524 (General_options::parse_end_lib): New.
5525 (Input_arguments::add_file): Handle lib groups.
5526 (Input_arguments::start_group): Check we are not in a lib.
5527 (Input_arguments::start_lib): New.
5528 (Input_arguments::end_lib): New.
5529 * options.h (General_options): Add start_lib and end_lib.
5530 (Input_argument::lib_): New.
5531 (Input_argument::lib): New.
5532 (Input_argument::is_lib): New.
5533 (Input_file_lib): New.
5534 (Input_arguments::in_lib_): New.
5535 (Input_arguments::in_lib): New.
5536 (Input_arguments::start_lib): New.
5537 (Input_arguments::end_lib_): New.
5538 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5539 in unused members as preempted.
5540 (Sized_pluginobj::do_should_include_member): New.
5541 * plugin.h (Sized_pluginobj::do_should_include_member): New.
5542 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5544 (Read_symbols::do_whole_lib_group): New.
5545 (Read_symbols::do_lib_group): New.
5546 (Read_symbols::do_read_symbols): Handle lib groups.
5547 (Read_symbols::get_name): Handle lib groups.
5548 * readsyms.h (Read_symbols): Add an archive member pointer.
5549 (Read_symbols::do_whole_lib_group): New.
5550 (Read_symbols::do_lib_group): New.
5551 (Read_symbols::member_): New.
5552 * script.cc (read_input_script): Update call to queue_soon.
5554 2010-03-19 Doug Kwan <dougkwan@google.com>
5556 * arm.cc (Stub_table::Stub_table): Initialize new data members
5557 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5558 (Stub_table::add_reloc_stub): Assign stub offset and update
5559 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5560 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
5562 (Stub_table::update_data_size_and_addralign): Use
5563 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
5564 instead of going over all reloc stubs.
5565 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
5566 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5567 Stringpool_template::offset_ to size of Stringpool_char.
5568 (Stringpool_template::new_key_offset): Remove code to initialize
5569 Stringpool_template::offset_.
5570 * stringpool.h (Stringpool_template::set_no_zero_null): Set
5571 Stringpool_template::offset_ to zero.
5573 2010-03-15 Doug Kwan <dougkwan@google.com>
5575 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5577 (Stringpool_template::new_key_offset): New method.
5578 (Stringpool_template::add_string): Assign offsets when adding new
5580 (Stringpool_template::set_string_offsets): Do not set string offsets
5581 when not optimizing.
5582 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5584 (Chunked_vector::clear): Clear size_.
5585 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5586 (Chunked_vector::size): Return size_.
5587 (Chunked_vector::push_back): Use size_ to find insert position.
5588 (Chunked_vector::size_): New data member.
5589 (Stringpool_template::set_no_zero_null): Assert string set is empty.
5590 (Stringpool_template::new_key_offset): New method declaration.
5591 (Stringpool_template::offset_): New data member.
5593 2010-03-15 Rafael Espindola <espindola@google.com>
5595 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
5596 Add_symbols' constructor.
5597 * readsyms.h (Add_symbols): Remove the input_group member.
5599 2010-03-10 Ian Lance Taylor <iant@google.com>
5601 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
5602 target to ask whether a reference to a symbol requires a stack
5604 * target.h (Target::is_call_to_non_split): New function.
5605 (Target::do_is_call_to_non_split): Declare virtual function.
5606 * target.cc: Include "symtab.h".
5607 (Target::do_is_call_to_non_split): New function.
5608 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
5610 2010-03-10 Cary Coutant <ccoutant@google.com>
5612 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
5613 (File_read::open[1]): Remove initial mapping of whole_file_view_.
5614 (File_read::open[2]): Add whole_file_view_ to list of views.
5615 (File_read::make_view): Remove test of whole_file_view_.
5616 (File_read::find_or_make_view): Create whole_file_view_ if
5618 (File_read::clear_views): Replace bool parameter with enum;
5619 adjust all callers. Don't delete views with permanent data;
5620 do delete cached views and views from archives if
5621 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
5622 if clearing the corresponding view.
5623 * fileread.h (File_read::Clear_views_mode): New enum.
5624 (File_read::View::is_permanent_view): New method.
5625 (File_read::clear_views): Replace bool parameter
5626 with enum; adjust all callers.
5627 * options.h (General_options): Change keep_files_mapped option;
5628 add map_whole_files.
5629 * readsyms.cc (Add_symbols::run): Delete sd_ object before
5631 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
5634 2010-03-10 David S. Miller <davem@davemloft.net>
5636 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
5638 2010-03-09 Sriraman Tallam <tmsriram@google.com>
5640 * icf.cc (get_section_contents): Add '@' marker after processing the
5643 2010-03-08 Doug Kwan <dougkwan@google.com>
5645 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
5646 due to a conversion warning.
5647 (Arm_relobj::update_output_local_symbol_count): Check for local
5648 symbol with unset output index.
5650 2010-03-05 Ian Lance Taylor <iant@google.com>
5652 * options.h (class General_options): Add --spare-dynamic-tags.
5653 * output.cc (Output_data_dynamic::set_final_data_size): Implement
5654 --spare-dynamic-tags.
5656 2010-03-05 Ian Lance Taylor <iant@google.com>
5658 * incremental.cc: Include "libiberty.h".
5660 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
5662 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
5663 function, is_info_ member.
5664 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
5665 (Versions::Versions): Update caller.
5666 (Versions::define_base_version): Likewise.
5667 (Versions::add_def): Likewise.
5669 2010-03-03 Sriraman Tallam <tmsriram@google.com>
5671 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
5672 (Scan::possible_function_pointer_reloc): New function.
5673 (Scan::local_reloc_may_be_function_pointer): Change to call
5674 possible_function_pointer_reloc.
5675 (Scan::global_reloc_may_be_function_pointer): Ditto.
5676 * icf.h (Icf::check_section_for_function_pointers): Change to reject
5677 relocations in ".data.rel.ro._ZTV" section.
5678 * testsuite/icf_safe_so_test.sh: Change to pass i386.
5679 * testsuite/icf_safe_so_test.cc: Ditto.
5680 * testsuite/icf_safe_test.cc: Ditto.
5681 * testsuite/icf_safe_test.sh: Ditto.
5683 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5684 Ian Lance Taylor <iant@google.com>
5686 * target-reloc.h (relocate_section): Check the symbol table index
5687 for -1U before setting the local symbol index.
5688 (scan_relocatable_relocs): If copying the relocation, record that
5689 the local symbol is required.
5690 * object.h (Symbol_value::is_output_symtab_index_set): New
5692 (Symbol_value::may_be_discarded_from_output_symtab): New
5694 (Symbol_value::has_output_symtab_entry): New function.
5695 (Symbol_value::needs_output_symtab_entry): Remove.
5696 (Symbol_value::output_symtab_index): Make sure the symbol index is
5698 (Symbol_value::set_output_symtab_index): Make sure the symbol
5699 index is not set. Make sure the new index is valid.
5700 (Symbol_value::set_must_have_output_symtab_entry): New function.
5701 (Symbol_value::has_output_dynsym_entry): New function.
5702 (Symbol_value::set_output_dynsym_index): Make sure the new index
5704 (Sized_relobj::set_must_have_output_symtab_entry): New function.
5705 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
5706 local symbol if permitted.
5707 (Sized_relobj::do_finalize_local_symbols): Call
5708 is_output_symtab_index_set rather than needs_output_symtab_entry.
5709 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
5710 rather than needs_output_symtab_entry. Call
5711 has_output_dynsym_entry rather than needs_output_dynsym_entry.
5712 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
5713 is_output_symtab_index_set rather than needs_output_symtab_entry.
5714 * testsuite/discard_locals_relocatable_test.c: New file.
5715 * testsuite/discard_locals_test.sh: Test -r.
5716 * testsuite/Makefile.am (check_DATA): Add
5717 discard_locals_relocatable_test1.syms,
5718 discard_local_relocatable_test2.syms.
5719 (MOSTLYCLEANFILES): Likewise. Also add
5720 discard_locals_relocatable_test1.lout and
5721 discard_locals_relocatable_test2.out.
5722 (discard_locals_relocatable_test1.syms): New target.
5723 (discard_locals_relocatable_test.o): New target.
5724 (discard_locals_relocatable_test1.out): New target.
5725 (discard_locals_relocatable_test2.syms): New target.
5726 (discard_locals_relocatable_test2.out): New target.
5727 (various): Add missing ../ld-new dependencies.
5728 * testsuite/Makefile.in: Rebuild.
5730 2010-03-03 Nick Clifton <nickc@redhat.com>
5732 * po/fi.po: New Finnish translation.
5734 2010-03-01 Doug Kwan <dougkwan@google.com>
5736 * layout.cc (Layout::Layout): Force section types of .init_array*,
5737 .preinit_array* and .fini_array* sections.
5738 * output.cc (Output_section::Input_section_sort_entry::has_priority):
5739 Fix check of return value of std::string::find.().
5740 (Output_section::Input_section_sort_compare::operator()): Remove
5741 comment about .init_array.
5742 (Output_section::Input_section_sort_init_fini_compare::operator()):
5744 (Output_section::sort_attached_input_sections): Handle .init_array
5745 and .fini_array specially.
5746 * output.h (Output_section::Inut_section_sort_compare): Update
5748 (Output_section::Input_section_sort_init_fini_compare): New struct.
5750 2010-02-26 Doug Kwan <dougkwan@google.com>
5752 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
5753 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
5754 * testsuite/debug_msg.sh: Avoid matching source line number for
5755 use of global variable undef_int.
5757 2010-02-26 Doug Kwan <dougkwan@google.com>
5759 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
5760 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
5761 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
5762 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
5763 * options.cc (General_options::General_options): Initialize member
5765 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
5766 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
5767 and rm_no_fix_v4bx.stdout
5768 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
5769 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
5770 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
5771 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
5772 and arm_no_fix_v4bx.
5773 * Makefile.in: Regenerate.
5774 * testsuite/arm_fix_v4bx.s: New file.
5775 * testsuite/arm_fix_v4bx.sh: Ditto.
5777 2010-02-24 Doug Kwan <dougkwan@google.com>
5779 * arm.cc (Target_arm::got_section): Make the .got section the first
5780 non RELRO section in the data segment.
5781 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
5782 suffixes of section names.
5784 2010-02-24 Doug Kwan <dougkwan@google.com>
5786 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
5787 flags and attributes merging if an input file is a binary file.
5788 * fileread.cc (Input_file::open): Record format of original file.
5789 * fileread.h (Input_file::Format): New enum type.
5790 (Input_file::Input_file): Initialize data member format_.
5791 (Input_file::format): New method definition.
5792 (Input_file::format_):: New data member.
5794 2010-02-24 Doug Kwan <dougkwan@google.com>
5796 * arm.cc (Arm_output_data_got): New class.
5797 (ARM_TCB_SIZE): New constant
5798 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
5799 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
5800 If user uses a script with a SECTIONS clause, issue only a warning
5801 for a misplaced EXIDX input section. Otherwise, issue an error.
5802 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
5804 (Target_arm::got_mode_index_entry): Handle static linking.
5805 (Target_arm::Scan::local): Ditto.
5806 (Target_arm::Scan::global): Ditto.
5807 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
5808 all incorrectly implemented relocations.
5809 (Target_arm::fix_exidx_coverage): Pass layout to
5810 Arm_output_section::fix_exidx_coverage.
5811 * layout.cc (Layout::section_name_mapping): Remove trailing dots
5812 from ".ARM.exidx." and ".ARM.extab.".
5814 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5816 * arm.cc (Target_arm::do_finalize_sections): Create attribute
5817 section if it does not already exist.
5818 * attributes.cc (Attributes_section_data::Attributes_section_data):
5819 Don't crash if size is zero.
5821 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5822 Ian Lance Taylor <iant@google.com>
5824 * gold.cc (queue_middle_tasks): If no input files were opened,
5826 * workqueue.h (Task_function::Task_function): Assert that there is
5829 2010-02-22 Doug Kwan <dougkwan@google.com>
5831 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
5832 * icf.cc (get_section_contents): Cast snprintf arguments to long long
5833 types to avoid warnings due to different uint64_t implementations
5836 2010-02-21 Doug Kwan <dougkwan@google.com>
5838 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
5839 handling of the maximum backward branch offset.
5840 (Arm_relocate_functions::thumb_branch_common): Ditto.
5841 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
5842 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
5843 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
5844 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
5845 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
5846 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
5847 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
5848 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
5849 thumb_bl_out_of_range thumb_bl_out_of_range.o,
5850 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
5851 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
5852 thumb2_bl_out_of_range.o): New rules.
5853 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
5854 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
5855 thumb2_bl_out_of_range
5856 * testsuite/Makefile.in: Regenerate.
5857 * testsuite/arm_bl_in_range.s: New file.
5858 * testsuite/arm_bl_out_of_range.s: Ditto.
5859 * testsuite/arm_branch_in_range.sh: Ditto.
5860 * testsuite/arm_branch_range.t: Ditto.
5861 * testsuite/thumb2_branch_range.t: Ditto.
5862 * testsuite/thumb_bl_in_range.s: Ditto.
5863 * testsuite/thumb_bl_out_of_range.s: Ditto.
5864 * testsuite/thumb_branch_range.t: Ditto.
5866 2010-02-20 Sriraman Tallam <tmsriram@google.com>
5868 * gc.h (gc_process_relocs): Change vectors to point to the new list.
5869 Add reloc offset information.
5870 * icf.cc (get_section_contents): Change iterators to point to the new
5871 vectors. Add reloc offset information to the contents.
5872 * icf.h (Icf::Sections_reachable_info): New typedef.
5873 (Icf::Sections_reachable_list): New typedef.
5874 (Icf::Offset_info): New typedef.
5875 (Icf::Reloc_info): New struct typedef.
5876 (Icf::Reloc_info_list): New typedef.
5877 (Icf::symbol_reloc_list): Delete method.
5878 (Icf::addend_reloc_list): Delete method.
5879 (Icf::section_reloc_list): Delete method.
5880 (Icf::reloc_info_list): New method.
5881 (Icf::reloc_info_list_): New member.
5883 2010-02-19 Doug Kwan <dougkwan@google.com>
5885 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
5886 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
5887 * arm.cc (Arm_relocation_functions): New forward declaration.
5888 (Target_arm::Target_arm): Initialize new data members
5889 got_mod_index_offset_ and tls_base_symbol_defined_.
5890 (Target_arm::Relocate::relocate_tls): New method.
5891 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
5892 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
5894 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
5895 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
5896 (Target_arm::got_mod_index_offset_,
5897 Target_arm::tls_base_symbol_defined_): New data members.
5898 (Target_arm::Scan::local, Target::Scan::global,
5899 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
5902 2010-02-18 Doug Kwan <dougkwan@google.com>
5904 * arm.cc (Arm_relobj::find_linked_text_section): New method.
5905 (Arm_relobj::make_exidx_input_section): Pass section index of linked
5906 text section as a parameter becuase some broken tools may not set
5907 the link in section header.
5908 (Target_arm::has_got_section): New method.
5909 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
5910 without any mapping symbol as data only. Remove warning.
5911 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
5912 link in its section header, try to discover the link by inspecting the
5913 REL31 relocation at the beginning of the section.
5914 (Target_arm::Scan::check_non_pic): Report name of offending relocation
5916 (Target_arm::Scan::global): Treat any reference to the symbol
5917 _GLOBAL_OFFSET_TABLE_ as a GOT access.
5919 2010-02-12 Sriraman Tallam <tmsriram@google.com>
5921 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
5922 (Scan::global_reloc_may_be_function_pointer): New function.
5923 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5924 (Scan::global_reloc_may_be_function_pointer): New function.
5925 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5926 (Scan::global_reloc_may_be_function_pointer): New function.
5927 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
5928 (Scan::global_reloc_may_be_function_pointer): New function.
5929 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
5930 (Scan::global_reloc_may_be_function_pointer): New function.
5931 (Scan::possible_function_pointer_reloc): New function.
5932 (Target_x86_64::can_check_for_function_pointers): New function.
5933 * gc.h (gc_process_relocs): Scan relocation types to determine if
5934 function pointers were taken for targets that support it.
5935 * icf.cc (Icf::find_identical_sections): Include functions for
5936 folding in safe ICF whose pointer is not taken.
5937 * icf.h (Secn_fptr_taken_set): New typedef.
5938 (fptr_section_id_): New member.
5939 (section_has_function_pointers): New function.
5940 (set_section_has_function_pointers): New function.
5941 (check_section_for_function_pointers): New function.
5942 * options.h: Fix comment for safe ICF option.
5943 * target.h (can_check_for_function_pointers): New function.
5944 * testsuite/Makefile.am: Add icf_safe_so_test test case.
5945 Modify icf_safe_test for X86-64.
5946 * testsuite/Makefile.in: Regenerate.
5947 * testsuite/icf_safe_so_test.cc: New file.
5948 * testsuite/icf_safe_so_test.sh: New file.
5949 * testsuite/icf_safe_test.cc (kept_func_3): New function.
5950 (main): Change to take pointer to function kept_func_3.
5951 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
5952 folding is done correctly for X86-64.
5954 2010-02-12 David S. Miller <davem@davemloft.net>
5956 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
5957 is_symbolless parameter.
5958 (Output_reloc<SHT_REL>::is_symbolless): New.
5959 (Output_reloc<SHT_REL>::is_symbolless_): New.
5960 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
5961 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
5962 (Output_reloc<SHT_RELA>::is_symbolless): New.
5963 (Output_data_reloc::add_global): Handle is_symbolless.
5964 (Output_data_reloc::add_global_relative): Likewise.
5965 (Output_data_reloc::add_local): Likewise.
5966 (Output_data_reloc::add_local_relative): Likewise.
5967 (Output_data_reloc::add_symbolless_global_addend): New.
5968 (Output_data_reloc::add_symbolless_local_addend): New.
5969 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
5971 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
5972 instead of ->is_relative_
5973 (Output_reloc::write): Likewise.
5974 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
5975 (Output_reloc::write_rel): Simplify.
5977 * sparc.cc (Target_sparc::Scan::local): Use
5978 ->add_symbolless_local_addend as needed.
5979 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
5980 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
5981 based upon relocation offset.
5983 2010-02-11 Doug Kwan <dougkwan@google.com>
5985 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
5986 (Target_arm::Scan::global): Ditto. Also remove a comment before the
5987 beginning of function.
5988 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
5989 and MOVT_ABS relocations. Those are non issued in scanning. Fix
5990 parameter is_32bit in calls to should_apply_static_reloc.
5991 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
5992 (check_DATA): Add arm_abs_global.stdout.
5993 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
5994 arm_abs_global.stdout): New rules.
5995 (MOSTLLYCLEANFILES): Add arm_abs_global
5996 * Makefile.in: Regenerate.
5997 * testsuite/arm_abs_global.s: New file.
5998 * testsuite/arm_abs_global.sh: Ditto.
5999 * testsuite/arm_abs_lib.s: Ditto.
6001 2010-02-11 Ian Lance Taylor <iant@google.com>
6003 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
6005 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
6006 Allocate_commons_task first.
6007 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
6008 task, rather than symtab_lock_.
6009 (Gc_process_relocs::~Gc_process_relocs): New function.
6010 (Gc_process_relocs::is_runnable): Check this_blocker_.
6011 (Gc_process_relocs::locks): Use next_blocker_ rather than
6013 (Scan_relocs::~Scan_relocs): New function.
6014 (Scan_relocs::is_runnable): Check this_blocker_ rather than
6016 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
6018 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
6019 fields. Add this_blocker_ and next_blocker_ fields. Adjust
6020 constructor accordingly.
6021 (class Gc_process_relocs): Likewise.
6022 (class Scan_relocs): Likewise.
6023 * common.h (class Allocate_commons_task): Remove symtab_lock_
6024 field, and corresponding constructor parameter.
6025 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
6027 (Allocate_commons_task::locks): Likewise.
6029 2010-02-11 Ian Lance Taylor <iant@google.com>
6031 * gold-threads.h (class Once): Define.
6032 (class Initialize_lock): Rewrite as child of Once.
6033 * gold-threads.cc (class Once_initialize): Define.
6034 (once_pointer_control): New static variable.
6035 (once_pointer, once_arg): New static variables.
6036 (c_run_once): New static function.
6037 (Once::Once, Once::run_once, Once::internal_run): New functions.
6038 (class Initialize_lock_once): Remove.
6039 (initialize_lock_control): Remove.
6040 (initialize_lock_pointer): Remove.
6041 (initialize_lock_once): Remove.
6042 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
6043 (Initialize_lock::initialize): Rewrite.
6044 (Initialize_lock::do_run_once): New function.
6045 * archive.cc (Archive::interpret_header): Only clear name if it is
6047 * fileread.cc: Include "gold-threads.h"
6048 (file_counts_lock): New static variable.
6049 (file_counts_initialize_lock): Likewise.
6050 (File_read::release): Only increment counts when using --stats.
6051 Use a lock around the increment.
6052 * parameters.cc (class Set_parameters_target_once): Define.
6053 (set_parameters_target_once): New static variable.
6054 (Parameters::Parameters): Move here from parameters.h.
6055 (Parameters::set_target): Rewrite.
6056 (Parameters::set_target_once): New function.
6057 (Parameters::clear_target): Move here and rewrite.
6058 * parameters.h (class Parameters): Update declarations. Add
6059 set_parameters_target_once_ field.
6060 (Parameters::Parameters): Move to parameters.cc.
6061 (Parameters::clear_target): Likewise.
6062 * readsyms.cc (Read_symbols::do_group): Create a Start_group
6064 (Start_group::~Start_group): New function.
6065 (Start_group::is_runnable): New function.
6066 (Start_group::locks, Start_group::run): New functions.
6067 (Finish_group::run): Change saw_undefined to size_t.
6068 * readsyms.h (class Start_group): Define.
6069 (class Finish_group): Change saw_undefined_ field to size_t.
6070 (Finish_group::Finish_group): Remove saw_undefined and
6071 this_blocker parameters. Change all callers.
6072 (Finish_group::set_saw_undefined): New function.
6073 (Finish_group::set_blocker): New function.
6074 * symtab.h (class Symbol_table): Change saw_undefined to return
6075 size_t. Change saw_undefined_ field to size_t.
6076 * target-select.cc (Set_target_once::do_run_once): New function.
6077 (Target_selector::Target_selector): Initialize set_target_once_
6078 field. Don't initialize lock_ and initialize_lock_ fields.
6079 (Target_selector::instantiate_target): Rewrite.
6080 (Target_selector::set_target): New function.
6081 * target-select.h (class Set_target_once): Define.
6082 (class Target_selector): Update declarations. Make
6083 Set_target_once a friend. Remove lock_ and initialize_lock_
6084 fields. Add set_target_once_ field.
6086 2010-02-10 Ian Lance Taylor <iant@google.com>
6088 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
6090 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
6091 (queue_middle_tasks): Add all blockers before queueing any tasks.
6092 (queue_final_tasks): Likewise.
6093 * token.h (Task_token::add_blockers): New function.
6094 * object.h (Input_objects::number_of_relobjs): New function.
6096 2010-02-10 Ian Lance Taylor <iant@google.com>
6098 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
6099 shared, not if not position independent.
6100 * x86_64.cc (Relocate::relocate_tls): Likewise.
6101 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
6102 (tls_pie_pic_test): New target.
6103 * testsuite/Makefile.in: Rebuild.
6105 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
6106 (tls_test_main_pie.o, tls_test_pie.o): New targets.
6107 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
6108 * testsuite/Makefile.in: Rebuild.
6110 2010-02-09 David S. Miller <davem@davemloft.net>
6112 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
6113 R_SPARC_RELATIVE using ->add_local_relative().
6114 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
6116 * output.h (Output_data_dynamic::add_section_size): New method
6117 that takes two Output_data objects.
6118 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
6119 entry param. Handle it in initializers.
6120 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
6121 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
6122 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
6124 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
6125 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
6126 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
6127 for dynrel_includes_plt.
6128 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6129 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6130 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
6132 (Target_sparc::do_finalize_sections): Update to pass true for
6133 dynrel_includes_plt.
6134 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
6135 output before .rela.plt
6136 (Target_powerpc::do_finalize_sections): Update to pass true for
6137 dynrel_includes_plt when 32-bit.
6139 2010-02-08 Doug Kwan <dougkwan@google.com>
6141 * arm.cc (Arm_relobj::simple_input_section_output_address): New
6143 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
6144 Arm_relobj::scan_section_for_cortex_a8_stubs,
6145 Arm_relobj::do_relocation_section): Instead of calling
6146 Output_section::output_address, use faster
6147 Arm_relobj::simple_input_section_output_address.
6149 2010-02-08 David S. Miller <davem@davemloft.net>
6151 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
6152 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
6153 relocation helper function.
6155 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
6156 just like R_SPARC_GOT{10,13,22}.
6157 (Target_sparc::Scan::local): Likewise.
6158 (Target_sparc::Relocate:relocate): Likewise.
6160 2010-02-06 Ian Lance Taylor <iant@google.com>
6162 * configure.ac: Rewrite targetobjs duplicate removal code to use
6163 only shell constructs.
6164 * configure: Rebuild.
6166 2010-02-05 Doug Kwan <dougkwan@google.com>
6169 * arm.cc (Arm_relobj::section_is_scannable): New method.
6170 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
6171 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
6173 2010-02-04 Doug Kwan <dougkwan@google.com>
6176 * arm-reloc-property.cc (cstdio): Include.
6177 * configure.ac (targetobjs): Remove duplicates.
6178 * configure: Regenerate.
6179 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
6180 big and little endian version for a given address size.
6182 2010-02-03 Doug Kwan <dougkwan@google.com>
6184 * arm-reloc-property.cc
6185 (Arm_reloc_property_table::reloc_name_in_error_message): New method
6187 * arm-reloc-property.h
6188 (Arm_reloc_property_table::get_implemented_static_reloc_property):
6189 New method definition.
6190 (Arm_reloc_property_table::reloc_name_in_error_message): New method
6192 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
6194 (GOT_PREL): Change implemented to Y.
6195 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
6196 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
6197 (Arm_relocate_functions::movw_abs_nc): Remove method.
6198 (Arm_relocate_functions::movt_abs): Ditto.
6199 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
6200 (Arm_relocate_functions::thm_movt_abs): Ditto.
6201 (Arm_relocate_functions::movw_rel_nc): Ditto.
6202 (Arm_relocate_functions::movw_rel): Ditto.
6203 (Arm_relocate_functions::movt_rel): Ditto.
6204 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
6205 (Arm_relocate_functions:thm_movw_rel): Ditto.
6206 (Arm_relocate_functions:thm_movt_rel): Ditto.
6207 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
6208 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
6209 New method definitions.
6210 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
6211 (Arm_relocation_functions::arm_grp_ldr): Ditto.
6212 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
6213 (Arm_relocation_functions::arm_grp_ldc): Ditto.
6214 (Target_arm::Relocate::relocate): Check for non-static or
6215 unimplemented relocation code and exit early. Change calls to
6216 Target_arm::reloc_uses_thumb_bit and
6217 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
6218 instead. Refactor code to handle similar relocations to increase
6219 code sharing. Remove check for unsupported relocation code in switch
6221 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
6222 relocation property table to find out size. Change error message to
6223 print out the name of a relocation code instead of the numeric value.
6224 (Target_arm::scan_reloc_for_stub): Use relocation property table
6225 instead of calling Target_arm::reloc_uses_thumb_bit().
6227 2010-02-02 Doug Kwan <dougkwan@google.com>
6229 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
6230 types of relaxed input section.
6232 2010-02-02 Doug Kwan <dougkwan@google.com>
6234 * Makefile.am (HFILES): Add arm-reloc-property.h.
6236 (TARGETSOURCES): Add arm-reloc-property.cc
6237 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
6238 (libgold_a_SOURCES): $(DEFFILES)
6239 * Makefile.in: Regenerate.
6240 * arm-reloc-property.cc: New file.
6241 * arm-reloc-property.h: New file.
6242 * arm-reloc.def: New file.
6243 * arm.cc: Update comments.
6244 (arm-reloc-property.h): New included header.
6245 (arm_reloc_property_table): New global variable.
6246 (Target_arm::do_select_as_default_target): New method definition.
6247 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
6248 arm-reloc-property to targ_extra_obj.
6249 * parameters.cc (set_parameters_target): Call
6250 Target::select_as_default_target().
6251 * target.h (Target::select_as_default_target): New method definition.
6252 (Target::do_select_as_default_target): Same.
6254 2010-02-01 Doug Kwan <dougkwan@google.com>
6256 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
6257 first_output_text_section_.
6258 (Arm_exidx_fixup::first_output_text_section): New method definition.
6259 (Arm_exidx_fixup::first_output_text_section_): New data member.
6260 (Arm_exidx_fixup::process_exidx_section): Record the first text
6261 output section seen.
6262 (Arm_output_section::fix_exidx_coverage): Set correct linked section
6263 and entsize in output section header.
6265 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6267 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
6268 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
6269 (Arm_relocate_functions::thm_alu11): New Method.
6270 (Arm_relocate_functions::thm_pc8): New Method.
6271 (Arm_relocate_functions::thm_pc12): New Method.
6272 (Target_arm::Scan::local): Handle the relocations.
6273 (Target_arm::Scan::global): Likewise.
6274 (Target_arm::Relocate::relocate): Likewise.
6275 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6277 2010-01-29 Doug Kwan <dougkwan@google.com>
6279 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
6280 of relocation types as ld.
6282 2010-01-29 Doug Kwan <dougkwan@google.com>
6284 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
6286 (Arm_relocate_functions::thumb_branch_common): Ditto.
6287 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
6288 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
6289 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
6290 Arm_relocate_functions::jump24): Remove.
6291 (Target_arm::Relocate::relocate): Adjust code to call
6292 Arm_relocation_functions::arm_branch_common and
6293 Arm_relocation_functions::thumb_branch_common instead of their removed
6294 wrappers. Merge switch-cases together to reduce source code size.
6296 2010-01-29 Doug Kwan <dougkwan@google.com>
6298 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
6299 output_local_symbol_count_needs_update_.
6300 (Arm_relobj::output_local_symbol_count_needs_update,
6301 Arm_relobj::set_output_local_symbol_count_needs_update,
6302 Arm_relobj::update_output_local_symbol_count): New methods.
6303 (Arm_relobj::output_local_symbol_count_needs_update_): New data
6305 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
6306 of pointed function as in a R_ARM_PREL31 relocation.
6307 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
6308 for output local symbol count updating.
6309 (Target_arm::do_relax): Update output local symbol counts in objects
6311 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
6313 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6315 * arm.cc: Added support for the ARM relocations:
6316 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
6317 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
6318 (Arm_relocate_functions::movw_rel_nc): Renamed (was
6320 (Arm_relocate_functions::movw_rel): New method.
6321 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
6322 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
6324 (Arm_relocate_functions::thm_movw_rel): New method.
6325 (Arm_relocate_functions::thm_movt_rel): Renamed (was
6327 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
6329 (Target_arm::Scan::global): Likewise.
6330 (Target_arm::Relocate::relocate): Likewise.
6331 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6334 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6336 * arm.cc: Added support for ARM group relocations.
6337 (Target_arm::reloc_needs_sym_origin): New method.
6338 (Arm_relocate_functions::calc_grp_kn): New method.
6339 (Arm_relocate_functions::calc_grp_residual): New method.
6340 (Arm_relocate_functions::calc_grp_gn): New method.
6341 (Arm_relocate_functions::arm_grp_alu): New Method.
6342 (Arm_relocate_functions::arm_grp_ldr): New Method.
6343 (Arm_relocate_functions::arm_grp_ldrs): New Method.
6344 (Arm_relocate_functions::arm_grp_ldc): New Method.
6345 (Target_arm::Scan::local): Handle the ARM group relocations.
6346 (Target_arm::Scan::global): Likewise.
6347 (Target_arm::Relocate::relocate): Likewise.
6348 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6351 2010-01-26 Doug Kwan <dougkwan@google.com>
6353 * arm.cc (set): Include.
6354 (class Arm_exidx_fixup): Change type of last_input_section_ to const
6356 (Arm_output_section::Text_section_list): New type.
6357 (Arm_output_section::append_text_sections_to_list): New method.
6358 (Arm_output_section::fix_exidx_coverage): Ditto.
6359 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
6360 (Arm_relobj::convert_input_section_to_relaxed_section): Use
6361 Relobj::set_section_offset() instead of
6362 Sized_relobj::invalidate_section_offset().
6363 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
6364 parameter for section headers. Ignore relocation sections for
6365 unallocated sections and EXIDX sections.
6366 (Target_arm::fix_exidx_coverage): New method.
6367 (Target_arm::output_section_address_less_than): New type.
6368 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
6369 linked text section instead of the EXIDX section.
6370 (Arm_output_section::create_stub_group): Add an assertion to check
6371 that this is not an EXIDX output section.
6372 (Arm_output_section::append_text_sections_to_list): New method.
6373 (Arm_output_section::fix_exidx_coverage): Ditto.
6374 (Arm_relobj::scan_sections_for_stubs): Adjust call to
6375 Arm_relobj::section_needs_reloc_stub_scanning.
6376 (Target_arm::do_relax): Fix EXIDX output section coverage in the
6378 (Target_arm::fix_exidx_coverage): New method.
6379 * object.h (Relobj::set_output_section): New method.
6380 (Sized_relobj::invalidate_section_offset): Remove method.
6381 (Sized_relobj::do_invalidate_section_offset): Remove method.
6382 (Sized_relobj::do_set_section_offset): Handle offset value -1.
6384 2010-01-25 Doug Kwan <dougkwan@google.com>
6386 * arm.cc (Arm_exidx_merged_section::do_output_offset):
6387 Fix warning due to signed and unsigned comparison on a 32-bit host.
6389 2010-01-22 Doug Kwan <dougkwan@google.com>
6391 * arm.cc (Target_arm::do_relax): Record an output section for section
6392 offset adjustment it contains any stub table that has changed.
6393 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
6394 offsets in an output section if necessary.
6395 * output.cc (Output_section::Output_section): Initialize
6396 section_offsets_need_adjustments_.
6397 (Output_section::add_input_section_for_script): Renamed to
6398 Output_section::add_simple_input_section.
6399 (Output_section::save_states): Add a comment.
6400 (Output_section::discard_states): New method defintion.
6401 (Output_section::adjust_section_offsets): Same.
6402 * output.h (Output_section::add_input_section_for_script): Renamed to
6403 Output_section::add_simple_input_section.
6404 (Output_section::discard_states): New method declaration.
6405 (Output_section::adjust_section_offsets): Same.
6406 (Output_section::section_offsets_need_adjustment,
6407 Output_section::set_section_offsets_need_adjustment): New method
6409 (Output_section::section_offsets_need_adjustment_): New data member.
6410 * script-sections.cc
6411 (Output_section_element_input::set_section_address): Adjust code for
6412 renaming of Output_section::add_input_section_for_script.
6413 (Orphan_output_section::set_section_address): Same.
6415 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6417 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
6418 Fix_v4bx enum values .
6419 * gold/options.h (General_options): New option definitions.
6420 (General_options::fix_v4bx): New method.
6421 (General_options::Fix_v4bx): New enum.
6422 * gold/options.cc (General_options::parse_fix_v4bx): New method.
6423 (General_options::parse_fix_v4bx_interworking): New method.
6425 2010-01-22 Doug Kwan <dougkwan@google.com>
6427 * arm.cc (Arm_exidx_fixup): New class.
6429 2010-01-21 Doug Kwan <dougkwan@google.com>
6431 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
6433 (Arm_exidx_section_offset_map): New type.
6435 2010-01-21 Doug Kwan <dougkwan@google.com>
6437 * arm.cc (Arm_exidx_input_section): New class.
6438 (Arm_relobj::exidx_input_section_by_link,
6439 Arm_relobj::exidx_input_section_by_shndx,
6440 Arm_relobj::make_exidx_input_section): New methods.
6441 (read_arm_attributes_section): Remove.
6442 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
6443 information about them.
6444 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
6447 2010-01-20 Doug Kwan <dougkwan@google.com>
6449 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
6450 Input_section_specifier to Section_id.
6451 (Target_arm::new_arm_input_section: Adjust code for change of key
6453 (Target_arm::find_arm_input_section): Ditto.
6454 * gc.h (object.h): Include for Section_id nand Section_id_hash.
6455 (Section_id): Remove.
6456 (Garbage_collection::Section_id_hash): Remove.
6457 * icf.h (object.h): Include for Section_id nand Section_id_hash.
6458 (Section_id): Remove.
6459 (Icf::Section_id_hash): Remove.
6460 * object.h (Section_id, Const_section_id, Section_id_hash,
6461 Const_section_id_hash): New type definitions.
6462 * output.cc (Output_section::add_relaxed_input_section): Change to
6463 use Const_section_id instead of Input_section_specifier as key type.
6464 (Output_section::add_merge_input_section): Ditto.
6465 (Output_section::build_relaxation_map): Change to use Section_id
6466 instead of Input_section_specifier as key type.
6467 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6469 (Output_section::convert_input_sections_to_relaxed_sections): Change
6470 to use Const_section_id instead of Input_section_specifier as key type.
6471 (Output_section::find_merge_section): Ditto.
6472 (Output_section::find_relaxed_input_section): Ditto.
6473 * output.h (Input_section_specifier): Remove class.
6474 (Output_section::Output_section_data_by_input_section_map): Change
6475 key type to Const_section_id.
6476 (Output_section::Output_relaxed_input_section_by_input_section_map):
6478 (Output_section::Relaxation_map): Change key type to Section_id.
6480 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6482 * gold/arm.cc: Added support for R_ARM_V4BX relocation
6483 (class Arm_v4bx_stub): New class.
6484 (DEF_STUBS): Updated definition to support v4_veneer_bx.
6485 (Stub_factory::make_arm_v4bx_stub): New method.
6486 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
6487 (Stub_table::empty): Handle v4bx stubs.
6488 (Stub_table::add_arm_v4bx_stub): New method.
6489 (Stub_table::find_arm_v4bx_stub): New method.
6490 (Arm_relocate_functions::v4bx): New method.
6491 (Target_arm::fix_v4bx): New method.
6492 (Target_arm::Target_arm): Handle R_ARM_V4BX.
6493 (Stub_table::relocate_stubs): Likewise.
6494 (Stub_table::do_write): Likewise.
6495 (Stub_table::update_data_size_and_addralign): Likewise.
6496 (Stub_table::finalize_stubs): Likewise.
6497 (Target_arm::Scan::local): Likewise.
6498 (Target_arm::Scan::global): Likewise.
6499 (Target_arm::do_finalize_sections): Likewise.
6500 (Target_arm::Relocate::relocate): Likewise.
6501 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6503 (Target_arm::scan_reloc_for_stub): Likewise.
6504 (Target_arm::scan_reloc_section_for_stubs): Likewise.
6506 2010-01-19 Ian Lance Taylor <iant@google.com>
6508 * output.cc (Output_section_headers::do_sized_write): Write large
6509 segment count to sh_info field.
6510 (Output_file_header::do_sized_write): For large segment count,
6511 write PN_XNUM to e_phnum field.
6513 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6515 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
6516 (Arm_relocate_functions::thm_jump8): New function.
6517 (Arm_relocate_functions::thm_jump11): New function.
6518 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
6520 (Target_arm::Scan::global): Likewise.
6521 (Target_arm::Relocate::relocate): Likewise.
6522 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6525 2010-01-14 Doug Kwan <dougkwan@google.com>
6527 * arm.cc (map, utility): Include headers.
6528 (Target_arm::apply_cortex_a8_workaround): New method.
6529 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
6530 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
6531 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
6532 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
6533 the --[no-]fix-cortex-a8 command line options.
6534 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
6535 (Target_arm::relocate_stub): Use addend in instruction template.
6536 * options.h (DEFINE_bool): Set the user-set flag.
6537 (General_options): Add --[no-]-fix-cortex options.
6538 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
6539 : Update fast look-up map after conversion.
6541 2010-01-14 Sriraman Tallam <tmsriram@google.com>
6543 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6544 in the first pass of do_layout.
6546 2010-01-13 Doug Kwan <dougkwan@google.com>
6548 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6549 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6550 apparent compiler problem of not folding static constant integral
6551 data members of elfcpp::Elf_sizes<32>.
6553 2010-01-13 Doug Kwan <dougkwan@google.com>
6555 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6556 Arm_relobj::section_needs_cortex_a8_stub_scanning,
6557 Arm_relobj::scan_section_for_cortex_a8_erratum,
6558 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
6559 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
6560 sections to scan for relocation stubs into a new method
6561 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
6562 relocation and Cortex-A8 stub scanning.
6563 (Target_arm::do_relax): Force stubs to be after stubbed sections
6564 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
6565 the beginning of a new relaxation pass. Update a comment.
6566 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
6568 2010-01-12 Ian Lance Taylor <iant@google.com>
6570 * target-reloc.h (visibility_error): New inline function.
6571 (relocate_section): Call visibility_error.
6572 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6573 (MOSTLYCLEANFILES): Likewise.
6574 (protected_4_pic.o, protected_3.err): New targets.
6575 * testsuite/protected_4.cc: New file.
6577 2010-01-12 Doug Kwan <dougkwan@google.com>
6579 * arm.cc (Cortex_a8_reloc): New class.
6580 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6581 and cortex_a8_relocs_info_.
6582 (Target_arm::fix_cortex_a8): New method definition.
6583 (Target_arm::Cortex_a8_relocs_info): New type.
6584 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6585 New data member declarations.
6586 (Target_arm::scan_reloc_for_stub): Record information about
6587 relocations for THUMB branches that might be exempted from the
6588 Cortex-A8 workaround.
6589 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
6590 at the beginning of a relaxation pass.
6592 2010-01-12 Doug Kwan <dougkwan@google.com>
6594 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
6595 (Arm_relobj::Mapping_symbol_position,
6596 Arm_reloj::Mapping_symbol_position_less,
6597 Arm_relobj::Mapping_symbols_info): New types.
6598 (Target_arm::is_mapping_symbol_name): New method definition.
6599 (Arm_relobj::do_count_local_symbols): Save information about mapping
6602 2010-01-11 Doug Kwan <dougkwan@google.com>
6604 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
6605 Arm_relocate_functions::thumb32_branch_upper,
6606 Arm_relocate_functions::thumb32_branch_lower,
6607 Arm_relocate_functions::thumb32_cond_branch_offset,
6608 Arm_relocate_functions::thumb32_cond_branch_upper,
6609 Arm_relocate_functions::thumb32_cond_branch_lower,
6610 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
6611 branch offset encoding.
6612 (Arm_relocate_functions::thumb_branch_common): Use new branch
6613 offset encoding methods to avoid code duplication.
6614 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
6615 (Stub_addend_reader::operator()): Use new branch encoding method
6616 to avoid code duplication.
6618 2010-01-11 Doug Kwan <dougkwan@google.com>
6620 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
6621 (Target_arm::do_finalize_sections): Define special EXIDX section
6622 symbols only if referenced.
6623 * gc.h (Garbage_collection::add_reference): New method.
6624 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
6627 2010-01-11 Ian Lance Taylor <iant@google.com>
6629 * script.cc (Version_script_info::build_expression_list_lookup):
6630 Change complaing about duplicate wildcard match from error to
6633 * script.cc (class Lazy_demangler): Recreate--revert part of patch
6635 (Version_script_info::Version_script_info): Initialize globs_,
6636 default_version_, default_is_global_, and exact_. Don't
6637 initialize globals_ or locals_.
6638 (Version_script_info::build_lookup_tables): Build local symbols
6640 (Version_script_info::unquote): New function.
6641 (Version_script_info::add_exact_match): New function.
6642 (Version_script_info::build_expression_list_lookup): Remove lookup
6643 parameter. Add is_global parameter. Change all callers. Handle
6644 wildcard pattern specially. Unquote pattern. Call
6646 (Version_script_info::get_name_to_match): New function.
6647 (Version_script_info::get_symbol_version): New function.
6648 (Version_script_info::get_symbol_version_helper): Remove.
6649 (Version_script_info::check_unmatched_names): Call unquote.
6650 * script.h (class Version_script_info): Change get_symbol_version
6651 to be non-inline and add is_global parameter; change all callers.
6652 Rewrite symbol_is_local. Update declarations. Define struct
6653 Version_tree_match, Exact, Globs. Don't define struct Lookup.
6654 Remove globals_ and locals_ members. Add exact_, globs_,
6655 default_version_, is_global_.
6656 (Version_script_info::Glob): Remove pattern, add expression and
6657 is_global. Update constructor. Change all callers.
6658 * dynobj.cc (Versions::finalize): Mark the version symbol as the
6660 (Versions::symbol_section_contents): If a symbol is undefined, or
6661 defined in a dynamic object, set the version index to
6663 * symtab.cc (Symbol_table::add_from_relobj): Don't call
6665 (Symbol_table::add_from_pluginobj): Likewise.
6666 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
6668 2010-01-11 Doug Kwan <dougkwan@google.com>
6670 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
6671 (incremental_dump_LDADD): Add linking option for libintl.
6672 * Makefile.in: Regenerate.
6674 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
6677 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
6679 * testsuite/Makefile.in: Regenerated.
6681 2010-01-10 Doug Kwan <dougkwan@google.com>
6683 * options.h (DEFINE_var): Use parentheses around argument varname__
6684 in macro body to avoid any unintended subsequent substitutions.
6686 2010-01-10 Ian Lance Taylor <iant@google.com>
6688 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
6689 candidates before doing symbol resolution.
6691 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
6692 ODR candidates if only one is weak.
6694 2010-01-08 Ian Lance Taylor <iant@google.com>
6696 * script.cc (Version_script_info::build_expression_list_lookup):
6697 Don't warn about ambiguous version, just record the ambiguity.
6698 (Version_script_info::get_symbol_version_helper): Give error if
6699 version is ambiguous.
6701 2010-01-08 Doug Kwan <dougkwan@google.com>
6703 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
6704 prev_data_size_ and prev_addralign_. Remove initializer for
6705 deleted data member has_been_changed_.
6706 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
6707 to determine if the table is empty.
6708 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
6710 (Stub_table::add_reloc_stub): Define method in class definition
6711 instead of just declaring it there.
6712 (Stub_table::add_cortex_a8_stub): New method definition.
6713 (Stub_table::update_data_size_and_addralign): Ditto.
6714 (Stub_table::finalize_stubs): Ditto.
6715 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
6716 (Stub_table::do_addralign_): Return address alignment in the
6717 (Stub_table::do_reset_address_and_file_offset): Define method in
6718 class definition instead of declaring it there. Set current data
6719 size to be the data size of the previous pass.
6720 (Stub_table::set_final_data_size): Use current data size as the
6722 (Stub_table::relocate_stub): Change parameter type of stub from
6723 Reloc_stub pointer to Stub pointer.
6724 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
6725 (Stub_table::Cortex_a8_stub_list): New typedef.
6726 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
6727 Stub_table::prev_addralign_): New data member.
6728 (Arm_relobj::Arm_relobj): Initialize data member
6729 section_has_cortex_a8_workaround_.
6730 (Arm_relobj::section_has_cortex_a8_workaround,
6731 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
6733 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
6735 (Target_arm::relocate_stub): Change parameter type of stub from
6736 Reloc_stub pointer to Stub pointer.
6737 (Insn_template::size, Insn_template::alignment): Handle
6738 THUMB16_SPECIAL_TYPE.
6739 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
6740 Stub_table::update_data_size_and_addralign,
6741 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
6743 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
6744 (Stub_table::do_write): Ditto.
6745 (Target_arm::do_relax): Adjust code for changes in Stub_table.
6747 2010-01-08 Ian Lance Taylor <iant@google.com>
6750 * symtab.h (class Symbol): Remove fields is_target_special_ and
6751 has_plt_offset_. Add field is_defined_in_discarded_section_.
6752 (Symbol::is_defined_in_discarded_section): New function.
6753 (Symbol::set_is_defined_in_discarded_section): New function.
6754 (Symbol::has_plt_offset): Rewrite.
6755 (Symbol::set_plt_offset): Verify that new offset is not -1U.
6756 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
6757 Don't initialize is_target_special_ or has_plt_offset_.
6758 Initialize is_defined_in_discarded_section_.
6759 (Symbol_table::add_from_relobj): If appropriate, set
6760 is_defined_in_discarded_section.
6761 * resolve.cc (Symbol::override_base_with_special): Don't test
6762 is_target_special_. Change has_plt_offset_ to has_plt_offset().
6763 * target-reloc.h (relocate_section): Do special handling for
6764 symbols defined in discarded sections for global symbols as well
6767 2010-01-08 Ian Lance Taylor <iant@google.com>
6769 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
6770 the SHT_SYMTAB case.
6772 2010-01-08 Ian Lance Taylor <iant@google.com>
6774 * object.cc (Sized_relobj::do_layout): Don't get confused if
6775 layout_eh_frame returns NULL.
6777 2010-01-08 Ian Lance Taylor <iant@google.com>
6780 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
6781 dynamic symbol table, use the normal symbol table.
6782 (Sized_dynobj::do_read_symbols): Remove assertion about type of
6785 2010-01-08 Ian Lance Taylor <iant@google.com>
6788 * layout.cc (Layout::include_section): Remove .gnu_debuglink
6791 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
6793 * version.cc (print_version): Change to "Copyright 2010".
6795 2010-01-08 Ian Lance Taylor <iant@google.com>
6799 * i386.cc (class Target_i386): Change return type of plt_section
6801 (class Output_data_plt_i386): Add tls_desc_rel_ field.
6802 (Output_data_plt_i386::Output_data_plt_i386): Initialize
6803 tls_desc_rel_ field.
6804 (Output_data_plt_i386::rel_tls_desc): New function.
6805 (Target_i386::rel_tls_desc_section): New function.
6806 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
6807 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
6808 R_386_TLS_DESC reloc in rel_tls_desc_section.
6809 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
6810 Define struct Tlsdesc_info.
6811 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
6812 (Target_x86_64::do_reloc_symbol_index): New function.
6813 (Target_x86_64::add_tlsdesc_info): New function.
6814 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
6815 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
6817 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
6819 (Output_data_plt_x86_64::rela_tlsdesc): New function.
6820 (Target_x86_64::rela_tlsdesc_section): New function.
6821 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
6823 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
6824 (Target_x86_64::do_reloc_addend): New function.
6825 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
6826 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
6827 declarations. Define TARGET_CODE. Add arg field to u1_ union.
6828 (Output_reloc::type): New function.
6829 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
6830 (Output_reloc::is_target_specific): New function.
6831 (Output_reloc::target_arg): New function.
6832 (class Output_reloc) [SHT_RELA]: Add four new constructors for
6833 absolute relocs and target specific relocs.
6834 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
6835 add_target_specific.
6836 (class Output_data_reloc) [SHT_RELA]: Likewise.
6837 * output.cc (Output_reloc::Output_reloc): Add four new versions
6838 for absolute relocs and target specific relocs.
6839 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
6840 (Output_reloc::get_symbol_index): Likewise.
6841 (Output_reloc::local_section_offset): Check that local_sym_index_
6842 is not TARGET_CODE or 0.
6843 (Output_reloc::symbol_value): Likewise.
6844 (Output_reloc::write) [SHT_RELA]: Call target for target specific
6846 * target.h (class Target): Add reloc_symbol_index and reloc_addend
6847 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
6849 * layout.cc (add_target_dynamic_tags): Use output section for
6850 DT_PLTRELSZ and DT_JMPREL.
6852 2010-01-07 Ian Lance Taylor <iant@google.com>
6855 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
6857 (class Output_data_reloc_generic): Define.
6858 (class Output_data_reloc_base): Change base class to
6859 Output_data_reloc_generic. Change add() method to call
6860 bump_relative_reloc_count for a relative reloc. Remove
6862 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
6864 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
6865 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
6867 * layout.h (class Layout): Update declaration.
6869 2010-01-07 Ian Lance Taylor <iant@google.com>
6871 * output.h (class Output_data): Add const version of
6872 output_section and do_output_section.
6873 (class Output_section_data): Add const version of
6875 (class Output_section): Likewise.
6876 * layout.cc (Layout::add_target_dynamic_tags): New function.
6877 * layout.h (class Layout): Update declarations.
6878 * arm.cc (Target_arm::do_finalize_sections): Use
6879 add_target_dynamic_tags.
6880 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6881 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6882 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6883 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6885 2010-01-07 Ian Lance Taylor <iant@google.com>
6888 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
6891 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
6892 Ian Lance Taylor <iant@google.com>
6895 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
6896 Xindex::read_symtab_xindex.
6898 2010-01-07 Doug Kwan <dougkwan@google.com>
6900 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
6901 (Insn_template::thumb16_bcond_insn): New method declaration.
6902 (Insn_template): Fix spelling.
6903 (Stub::thumb16_special): New method declaration.
6904 (Stub::do_write): Define virtual method which was previously pure
6906 (Stub::do_thumb16_special): New method declaration.
6907 (Stub::do_fixed_endian_write): New template member.
6908 (Reloc_stub::do_write): Remove.
6909 (Reloc_stub::do_fixed_endian_write): Remove.
6910 (Cortex_a8_stub): New class definition.
6911 (Stub_factory::make_cortex_a8_stub): New method definition.
6912 (Stub_factory::Stub_factory): Add missing static storage class
6913 qualifier for elf32_arm_stub_a8_veneer_blx.
6915 2010-01-07 Ian Lance Taylor <iant@google.com>
6918 * options.h (class General_options): Add --warn-unresolved-symbols
6919 and --error-unresolved-symbols.
6920 * errors.cc (Errors::undefined_symbol): Implement
6921 --warn-unresolved-symbols.
6923 * options.h (class General_options): Add -z text and -z textoff.
6924 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
6926 2010-01-06 Sriraman Tallam <tmsriram@google.com>
6928 * gc.h (Garbage_collection::Cident_section_map): New typedef.
6929 (Garbage_collection::cident_sections): New function.
6930 (Garbage_collection::add_cident_section): New function.
6931 (Garbage_collection::cident_sections_): New member.
6932 (gc_process_relocs): Add references to sections whose names are C
6934 * gold.h (cident_section_start_prefix): New constant.
6935 (cident_section_stop_prefix): New constant.
6936 (is_cident): New function.
6937 * layout.cc (Layout::define_section_symbols): Replace string constants
6938 with the newly defined constants.
6939 * object.cc (Sized_relobj::do_layout): Track sections whose names are
6941 * testsuite/Makefile.am: Add gc_orphan_section_test.
6942 * testsuite/Makefile.in: Regenerate.
6943 * testsuite/gc_orphan_section_test.cc: New file.
6944 * testsuite/gc_orphan_section_test.sh: New file.
6946 2010-01-06 Ian Lance Taylor <iant@google.com>
6949 * options.h (class General_options): Add --warn-shared-textrel.
6950 * layout.cc (Layout::finish_dynamic_section): Implement
6951 --warn-shared-textrel.
6954 * options.h (class General_options): Add --warn-multiple-gp.
6956 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6958 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
6959 $(THREADSLIB) and $(LIBDL).
6960 * Makefile.in: Rebuild.
6962 2010-01-06 Ian Lance Taylor <iant@google.com>
6965 * options.cc (General_options::parse_section_start): New function.
6966 (General_options::section_start): New function.
6967 (General_options::General_options): Initialize all members.
6968 * options.h: Include <map>
6969 (class General_options): Add --section-start. Add section_starts_
6971 * layout.cc (Layout::attach_allocated_section_to_segment): If
6972 --section-start was used, set the address of the segment. Remove
6973 local sort_sections.
6974 (Layout::relaxation_loop_body): If the address of the load segment
6975 has been set by --section-start, don't use it.
6976 * output.h (Output_segment::update_flags_for_output_section): New
6978 * output.cc (Output_segment::add_output_section): Call
6979 update_flags_for_output_section.
6981 2010-01-05 Ian Lance Taylor <iant@google.com>
6984 * options.h (class General_options): Add --undefined-version.
6985 * script.cc (struct Version_expression): Add was_matched_by_symbol
6987 (Version_script_info::matched_symbol): New function.
6988 (Version_script_info::get_symbol_version_helper): Call
6990 (Version_script_info::check_unmatched_names): New function.
6991 * script.h (class Version_script_info): Update declarations.
6992 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
6994 * options.h (class General_options): Use DEFINE_bool_alias for
6995 allow_multiple_definition.
6996 * resolve.cc (Symbol_table::should_override): Don't test
6997 allow_multiple_definition.
7000 * options.h (class General_options): Add --cref.
7001 * main.cc (main): Print cref table if --cref. Don't close mapfile
7002 until after printing cref table.
7003 * cref.cc: Include "symtab.h".
7004 (class Cref_inputs): Define Cref_table_compare and Cref_table.
7005 (Cref_table_compare::operator()): New function.
7006 (Cref_inputs::gather_cref): New function.
7007 (filecol): New static const.
7008 (Cref_inputs::print_cref): New function.
7009 (Cref::print_cref): New function.
7010 * cref.h: Include <cstdio>.
7011 (class Cref): Update declarations.
7012 * mapfile.h (Mapfile::file): New function.
7013 * object.h (class Object): Define Symbols. Declare virtual
7014 do_get_global_symbols.
7015 (Object::get_global_symbols): New function.
7016 * object.cc (Input_objects::add_object): Pass object to cref_ if
7018 (Input_objects::archive_start): Likewise.
7019 (Input_objects::archive_stop): Likewise.
7020 (Input_objects::print_cref): New function.
7021 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
7022 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
7024 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
7026 * plugin.h (class Sized_pluginobj): Update declarations.
7028 2010-01-05 Ian Lance Taylor <iant@google.com>
7030 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
7031 to is_default_version. Rename insdef to insdefault.
7032 (Symbol_table::add_from_relobj): Rename def to is_default_version
7033 and local to is_forced_local.
7034 (Symbol_table::add_from_pluginobj): Likewise.
7035 (Symbol_table::add_from_dynobj): Likewise.
7036 (Symbol_table::define_special_symbol): Rename insdef to
7039 2010-01-04 Ian Lance Taylor <iant@google.com>
7042 * options.h (class General_options): Add
7043 --allow-multiple-definition and -z muldefs.
7044 * resolve.cc (Symbol_table::should_override): Don't warn about a
7045 multiple symbol definition if --allow-multiple-definition or -z
7049 * options.h (class General_options): Add --add-needed and
7050 --copy-dt-needed-entries. Tweak --as-needed help entry.
7051 * object.cc (Input_objects::check_dynamic_dependencies): Give an
7052 error if --copy-dt-needed-entries aka --add-needed is used and
7053 would cause a change in behaviour.
7056 * options.h (class General_options): Add -G as a short version of
7057 --shared. Add no-op options -assert, -g, and -i.
7059 2010-01-04 Sriraman Tallam <tmsriram@google.com>
7061 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
7062 check for .text or .gnu.linkonce.t sections.
7063 * icf.cc (Icf::find_identical_sections): Ditto.
7064 Change the detection for mangled function name within the section
7066 * icf.h (is_section_foldable_candidate): New function.
7068 2009-12-30 Ian Lance Taylor <iant@google.com>
7071 * options.h (class General_options): Permit two dashes with
7072 --retain-symbols-file.
7074 2009-12-30 Ian Lance Taylor <iant@google.com>
7077 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
7078 don't put the file header and segment headers in the text
7082 * common.cc (Sort_commons::operator()): Stabilize sort when both
7084 (Symbol_table::do_allocate_commons_list): When allocating common
7085 symbols, skip a symbol which is no longer common.
7086 * symtab.h (Symbol::is_common): Test whether the symbol comes from
7087 an object before checking its type.
7088 * testsuite/common_test_2.c: New file.
7089 * testsuite/common_test_3.c: New file.
7090 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
7091 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
7092 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
7093 (common_test_2_pic.o, common_test_2.so): New targets.
7094 (common_test_3_pic.o, common_test_3.so): New targets.
7095 * testsuite/Makefile.in: Rebuild.
7098 * script.cc (read_input_script): If we see a new SECTIONS clause,
7099 and we have added an input section, give an error.
7100 * layout.h (class Layout): Add have_added_input_section function.
7101 Add have_added_input_section_ field.
7102 * layout.cc (Layout::Layout): Initialize
7103 have_added_input_section_.
7104 (Layout::layout): Set have_added_input_section_.
7105 (Layout::layout_eh_frame): Likewise.
7107 2009-12-30 Ian Lance Taylor <iant@google.com>
7110 * options.h (class General_options): Add --sort-common option.
7111 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
7112 * common.cc (Sort_common): Add sort_order parameter to
7113 constructor. Add sort_order_ field.
7114 (Sort_commons::operator): Check sort_order_.
7115 (Symbol_table::allocate_commons): Determine the sort order.
7116 (Symbol_table::do_allocate_commons): Add sort_order parameter.
7118 (Symbol_table::do_allocate_commons_list): Likewise.
7120 2009-12-30 Ian Lance Taylor <iant@google.com>
7123 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
7124 symbols from this object, don't change the visibility of an
7126 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
7128 2009-12-30 Ian Lance Taylor <iant@google.com>
7131 * script.h (class Version_script_info): Define Language enum.
7132 Update declarations. Define Glob, Exact, and Lookup types. Add
7133 new fields globals_, locals_, and is_finalized_.
7134 * script.cc: Various formatting fixes.
7135 (class Parser_closure): Change language_stack_ from a vector of
7136 std::string to one of Version_script_info::Language. Adjust all
7138 (class Lazy_demangler): Remove.
7139 (struct Version_expression): Change language from std::string to
7140 Version_script_info::Language.
7141 (Version_script_info::Version_script_info): New function.
7142 (Version_script_info::~Version_script_info): Don't call clear.
7143 (Version_script_info::finalize): New function.
7144 (Version_script_info::build_lookup_tables): New function.
7145 (Version_script_info::build_expression_list_lookup): New
7147 (Version_script_info::get_symbol_version_helper): Rewrite to use
7149 (Version_script_info::print_expression_list): Adjust to use
7150 Version_script_info::Language.
7151 (script_push_lex_into_version_mode): Check that the version script
7152 has not been finalized.
7153 (version_script_push_lang): Change language string to
7154 Version_script_info::Language.
7155 * options.cc (Command_line::version_script): New function.
7156 * options.h (class General_options): Add finalize_dynamic_list
7157 function. Change version_script from declaration to definition.
7158 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
7159 * testsuite/version_script.map: Remove duplicate def of foo.
7160 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
7162 * testsuite/Makefile.in: Rebuild.
7164 2009-12-30 Ian Lance Taylor <iant@google.com>
7167 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
7168 if the input symbol index is 0, make the output symbol index 0.
7170 2009-12-30 Ian Lance Taylor <iant@google.com>
7173 * options.h (class General_options): Add -x/--discard-all.
7174 * object.cc (Sized_relobj::do_count_local_symbols): Handle
7175 --discard-all. If the local symbol needs a dynamic entry, check
7176 that before handling --discard-locals.
7178 2009-12-30 Ian Lance Taylor <iant@google.com>
7181 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
7183 (Output_segment::add_output_section): Don't change the flags if
7187 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
7188 GNU hash table if they need a dynamic value. Otherwise, don't add
7189 them if they are defined in a dynamic object or are forced local.
7191 2009-12-29 Ian Lance Taylor <iant@google.com>
7194 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
7195 .gnu.hash table for a 32-bit target.
7198 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
7199 regular and a dynamic object only needs a dynamic symbol table
7200 entry if it is externally visible.
7203 * i386.cc (class Target_i386): Initialize global_offset_table_ in
7204 constructor. Add global_offset_table_ field.
7205 (Target_i386::got_section): Set global_offset_table_.
7206 (Target_i386::do_finalize_sections): Set global_offset_table_
7208 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
7209 in constructor. Add global_offset_table_ field.
7210 (Target_x86_64::got_section): Set global_offset_table_.
7211 (Target_x86_64::do_finalize_sections): Set global_offset_table_
7214 * layout.cc (Layout::Layout): Initialize increase_relro_.
7215 (Layout::get_output_section): Add is_relro, is_last_relro, and
7216 is_first_non_relro parameters. Change all callers.
7217 (Layout::choose_output_section): Likewise.
7218 (Layout::add_output_section_data): Likewise.
7219 (Layout::make_output_section): Likewise.
7220 (Layout::set_segment_offsets): Clear increase_relro when using a
7222 * layout.h (class Layout): Add increase_relro method. Add
7223 increase_relro_ field. Update declarations.
7224 * output.cc (Output_section::Output_section): Initialize
7225 is_last_relro_ and is_first_non_relro_.
7226 (Output_segment::add_output_section): Group relro sections is
7227 do_sort is true. Handle is_last_relro and is_first_non_relro.
7228 (Output_segment::maximum_alignment): Remove relro handling.
7229 (Output_segment::set_section_addresses): Add increase_relro
7230 parameter. Change all callers. Add initial alignment to align
7231 relro sections on separate page. Remove old relro handling.
7232 (Output_segment::set_section_list_addresses): Remove in_relro
7233 parameter. Change all callers.
7234 (Output_segment::set_offset): Add increase parameter. Change all
7235 callers. Remove old relro handling.
7236 * output.h (class Output_section): Add new methods: is_last_relro,
7237 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
7238 Add is_last_relro_ and is_first_non_relro_ fields.
7239 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
7240 Create separate .got.plt section. Call increase_relro.
7241 * x86_64.cc (Target_x86_64::got_section): Likewise.
7242 * testsuite/relro_script_test.t: Add .got.plt.
7245 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
7246 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
7247 (Layout::finalize): Call set_dynamic_symbol_size.
7248 (Layout::set_dynamic_symbol_size): New function.
7249 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
7250 set_dynamic_symbol_size.
7253 * output.h (class Output_section): Add is_entsize_zero_ field.
7254 * output.cc (Output_section::Output_section): Initialize
7256 (Output_section::set_entsize): If two different entsizes are
7257 requested, force it to zero.
7258 (Output_section::add_input_section): Set flags for .debug_str
7259 before updating section flags. Set entsize.
7260 (Output_section::update_flags_for_input_section): Set SHF_MERGE
7261 and SHF_STRING if all input sections have those flags.
7263 2009-12-29 Rafael Espindola <espindola@google.com>
7265 * main.cc (main): Fix the sys time reporting.
7266 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
7269 2009-12-29 Sriraman Tallam <tmsriram@google.com>
7271 * options.cc (General_options::parse_version): Allow -v to exit
7272 without an error if there is nothing to link.
7274 2009-12-29 Ian Lance Taylor <iant@google.com>
7276 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
7277 using a version of gcc before 4.1.
7278 * configure: Rebuild.
7280 2009-12-28 Chris Demetriou <cgd@google.com>
7282 * attributes.cc (Output_attributes_section_data::do_write): Use
7283 std::vector::front rather than std::vector::data.
7285 2009-12-28 Ian Lance Taylor <iant@google.com>
7287 * symtab.h (class Symbol_table): Add enum Defined.
7288 * resolve.cc (Symbol_table::should_override): Add defined
7289 parameter. Change all callers. Test whether object is NULL
7290 before calling a method on it.
7291 (Symbol_table::report_resolve_problem): Add defined parameter.
7293 (Symbol_table::should_override_with_special): Likewise.
7294 * symtab.cc (Symbol_table::define_in_output_data): Add defined
7295 parameter. Change all callers.
7296 (Symbol_table::do_define_in_output_data): Likewise.
7297 (Symbol_table::define_in_output_segment): Likewise.
7298 (Symbol_table::do_define_in_output_segment): Likewise.
7299 (Symbol_table::define_as_constant): Likewise.
7300 (Symbol_table::do_define_as_constant): Likewise.
7301 * script.h (class Symbol_assignment): Add is_defsym parameter to
7302 constructor; change all callers.
7303 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
7304 parameter. Change all callers. Add is_defsym_ field.
7305 (class Parser_closure): Add parsing_defsym parameter to
7306 constructor; change all callers. Add parsing_defsym accessor
7307 function. Add parsing_defsym_ field.
7309 2009-12-28 Ian Lance Taylor <iant@google.com>
7311 * gold.cc (queue_middle_tasks): Fix formatting.
7312 * object.cc (Relobj::is_section_name_included): Likewise.
7314 2009-12-23 Ian Lance Taylor <iant@google.com>
7316 * i386.cc (Target_i386::do_calls_non_split): Recognize
7317 -fsplit-stack prologue for a function with a static chain.
7318 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
7319 -fsplit-stack prologue when using %r11.
7321 2009-12-21 Sriraman Tallam <tmsriram@google.com>
7323 * options.cc (General_options::parse_version): Make -v continue and do
7324 the link like GNU ld does.
7326 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
7328 * Makefile.am (CCFILES): Add timer.cc.
7329 (HFILES): Add timer.h.
7330 * configure.ac: Check for sysconf and times.
7331 * main.cc: include timer.h.
7332 (main): Use Timer instead of get_run_time.
7335 * workqueue.cc: include timer.h.
7336 (Workqueue::find_and_run_task):
7337 Report user, sys and wall time.
7338 * Makefile.in: Regenerate.
7339 * config.in: Regenerate.
7340 * configure: Regenerate.
7342 2009-12-16 Doug Kwan <dougkwan@google.com>
7344 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
7346 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
7347 relaxed input sections.
7348 * output.cc (Output_section::find_relaxed_input_section): Change
7349 return type to Output_relaxed_input_section pointer. Adjust code
7350 for new type of relaxed_input_section_map_.
7351 * output.h (Output_section::find_relaxed_input_section): Change
7352 return type to Output_relaxed_input_section pointer.
7353 (Output_section::Output_relaxed_input_section_by_input_section_map):
7355 (Output_section::relaxed_input_section_map_): Change type to
7356 Output_section::Output_relaxed_input_section_by_input_section_map.
7357 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
7360 2009-12-15 Ian Lance Taylor <iant@google.com>
7362 * layout.cc (Layout::create_shstrtab): Only write out after input
7363 sections if we are compressing debug sections.
7365 2009-12-15 Ian Lance Taylor <iant@google.com>
7367 * archive.cc (Archive::add_symbols): Only look up a symbol without
7368 a version if there is, in fact, a version.
7370 2009-12-14 Ian Lance Taylor <iant@google.com>
7372 Revert -Wshadow changes, all changes from:
7373 2009-12-11 Doug Kwan <dougkwan@google.com>
7374 2009-12-11 Nick Clifton <nickc@redhat.com>
7375 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
7377 2009-12-11 Doug Kwan <dougkwan@google.com>
7379 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
7381 * attributes.cc (Object_attribute::size): Ditto.
7382 (Attributes_section_data::size): Ditto.
7383 (Attributes_section_data::Attributes_section_data): Ditto.
7384 (Output_attributes_section_data::do_write): Ditto.
7385 * attributes.h (Object_attribute::set_type): Ditto.
7386 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
7388 2009-12-11 Nick Clifton <nickc@redhat.com>
7390 * archive.cc: Fix shadowed variable warnings.
7392 * compressed_output.cc: Likewise.
7393 * compressed_output.h: Likewise.
7394 * configure: Likewise.
7395 * dwarf_reader.cc: Likewise.
7396 * dynobj.cc: Likewise.
7397 * dynobj.h: Likewise.
7398 * ehframe.cc: Likewise.
7399 * ehframe.h: Likewise.
7400 * errors.cc: Likewise.
7401 * expression.cc: Likewise.
7402 * fileread.cc: Likewise.
7403 * fileread.h: Likewise.
7404 * freebsd.h: Likewise.
7405 * i386.cc: Likewise.
7407 * incremental.h: Likewise.
7408 * layout.cc: Likewise.
7409 * layout.h: Likewise.
7410 * mapfile.cc: Likewise.
7411 * merge.cc: Likewise.
7412 * merge.h: Likewise.
7413 * object.cc: Likewise.
7414 * object.h: Likewise.
7415 * options.h: Likewise.
7416 * output.cc: Likewise.
7417 * output.h: Likewise.
7418 * parameters.cc: Likewise.
7419 * plugin.cc: Likewise.
7420 * powerpc.cc: Likewise.
7421 * reduced_debug_output.cc: Likewise.
7422 * reduced_debug_output.h: Likewise.
7423 * reloc.cc: Likewise.
7424 * reloc.h: Likewise.
7425 * resolve.cc: Likewise.
7426 * script-sections.cc: Likewise.
7427 * script.cc: Likewise.
7428 * script.h: Likewise.
7429 * sparc.cc: Likewise.
7430 * symtab.cc: Likewise.
7431 * symtab.h: Likewise.
7432 * target-select.cc: Likewise.
7433 * target-select.h: Likewise.
7434 * token.h: Likewise.
7435 * workqueue.cc: Likewise.
7436 * workqueue.h: Likewise.
7437 * x86_64.cc: Likewise.
7439 2009-12-10 Doug Kwan <dougkwan@google.com>
7441 * arm.cc (attributes.h): New include.
7442 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
7443 (Arm_relobj::~Arm_relobj): Delete object pointed by
7444 attributes_section_data_.
7445 (Arm_relobj::attributes_section_data): New method definition.
7446 (Arm_relobj::attributes_section_data_): New data member declaration.
7447 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
7448 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
7449 attributes_section_data_.
7450 (Arm_dynobj::attributes_section_data): New method definition.
7451 (Arm_dynobj::attributes_section_data_): New data member declaration.
7452 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
7453 initialization value of may_use_blx_ to false.
7454 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
7455 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
7456 object attributes to compute results instead of hard-coding.
7457 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
7458 Target_arm::get_secondary_compatible_arch,
7459 Target_arm::set_secondary_compatible_arch
7460 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7461 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
7462 New method declarations.
7463 (Target_arm::get_aeabi_object_attribute): New method definition.
7464 (Target_arm::attributes_section_data_): New data member declaration.
7465 (read_arm_attributes_section): New template definition.
7466 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
7467 (Arm_dynobj::do_read_symbols): Ditto.
7468 (Target_arm::do_finalize_sections): Merge attributes sections from
7469 input. Check for BLX use after attributes section merging.
7470 Fix __exidx_start and __exidx_end visibility. Create an
7471 .ARM.attributes section if necessary.
7472 (Target_arm::get_secondary_compatible_arch,
7473 Target_arm::set_secondary_compatible_arch,
7474 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7475 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
7476 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
7477 New method definitions.
7479 2009-12-09 Ian Lance Taylor <iant@google.com>
7481 * plugin.cc (Plugin::load): Don't cast from void* to a function
7484 2009-12-09 Ian Lance Taylor <iant@google.com>
7486 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
7489 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
7491 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
7492 Replace two_file_shared_1.so with two_file_shared_2.so.
7493 * testsuite/Makefile.in: Regenerated.
7495 2009-12-08 Doug Kwan <dougkwan@google.com>
7497 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
7498 (HFILES): Add attributes.h and int_encoding.h.
7499 * Makefile.in: Regenerate.
7500 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
7501 function definitions to int_encoding.cc
7502 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
7503 prototypes to int_encoding.h
7504 * reduced_debug_output.cc (int_encoding.h): New include.
7505 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
7506 function definitions to int_encoding.cc
7507 (insert_into_vector, read_from_pointer): Move template definitions to
7509 * attributes.cc: New file.
7510 * attributes.h: New file.
7511 * int_encoding.cc: New file.
7512 * int_encoding.h: New file.
7514 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
7517 * incremental-dump.cc (dump_incremental_inputs): New.
7518 (main): Use dump_incremental_inputs.
7520 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
7523 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
7524 checking elfcpp::STT_FUNC.
7525 (Target_i386::Relocate::relocate): Likewise.
7526 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
7528 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
7529 symbols from shared libraries into normal FUNC symbols.
7531 * symtab.h (Symbol): Add is_func and use it.
7533 2009-12-05 Doug Kwan <dougkwan@google.com>
7535 * arm.cc (Target_arm::arm_info): Initialize new fields
7536 attributes_section and attributes_vendor.
7537 * i386.cc (Target_i386::i386_info): Same.
7538 * object.cc (Sized_relobj::do_layout): Skip attribute section.
7539 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7540 fields attributes_section and attributes_vendor.
7541 * sparc.cc (Target_sparc::sparc_info): Same.
7542 * target.h (Target::attributes_section, Target::attributes_vendor,
7543 Target::is_attributes_section, Target::attribute_arg_type,
7544 Target::attributes_order): New method definitions.
7545 (Target::Target_info::attributes_section,
7546 Target::Target_info::attributes_vendor): New fields.
7547 (Target::do_attribute_arg_type, Target::do_attributes_order): New
7548 virtual method definitions.
7549 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7550 attributes_section and attributes_vendor.
7551 * testsuite/testfile.cc (Target_test::test_target_info): Same.
7553 2009-12-05 Doug Kwan <dougkwan@google.com>
7555 * arm.cc: Update comments about interworking and stub generation.
7556 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
7557 considered as non-PIC.
7558 (Arm_relocate_functions::base_abs): Fix formatting.
7559 (Arm_relocate_functions::got_prel): Fix comment. Change interface
7560 of function to use GOT entry address instead of offset.
7561 (Target_arm::Scan::global): Issue an error if a symbol would need a
7562 PLT does not get one because it is untyped. Remove code to create
7563 dynamic symbols for relative branches.
7564 (Target_arm::Relocate::relocate: Use 0 instead of false since function
7565 takes unsigned integer instead of boolean.
7567 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
7569 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7570 (two_file_test_LDADD): Likewise.
7571 (common_test_1_LDADD): Likewise.
7572 (exception_test_LDADD) Likewise.
7573 (weak_test_LDADD): Likewise.
7574 (many_sections_test_LDADD): Likewise.
7575 (initpri1_LDADD): Likewise.
7576 (script_test_1_LDADD): Likewise.
7577 (script_test_2_LDADD): Likewise.
7578 (justsyms_LDADD): Likewise.
7579 (binary_test_LDADD): Likewise.
7580 (large_LDADD): Likewise.
7581 * testsuite/Makefile.in: Regenerated.
7583 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
7585 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7586 (Symbol_table::override_with_special): Likewise.
7587 (Symbol_table::add_from_object): Likewise.
7589 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
7591 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7592 Don't set the data_offset twice.
7594 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
7596 * testsuite/Makefile.in: Regenerate.
7598 2009-12-03 Doug Kwan <dougkwan@google.com>
7600 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
7601 (Target_arm::do_finalize_sections): Add parameter for symbol table
7602 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
7603 * i386.cc (Target_i386::do_finalize_sections): Add an additional
7604 parameter for symbol table pointer.
7605 * layout.cc (Layout::finalize): Call Target::finalize_sections with
7606 an additional parameter for a pointer to symbol table.
7607 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
7608 parameter for a symbol table pointer.
7609 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
7610 * target.h (Target::finalize_sections, Target::do_finalize_sections):
7612 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
7613 parameter for a symbol table pointer.
7615 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
7617 * incremental.cc (Incremental_inputs_header)
7618 (Incremental_inputs_header_write, Incremental_inputs_entry)
7619 (Incremental_inputs_entry_write): Move ...
7620 * incremental.h (Incremental_inputs_header)
7621 (Incremental_inputs_header_write, Incremental_inputs_entry)
7622 (Incremental_inputs_entry_write): here.
7624 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7626 * incremental.cc (make_sized_incremental_binary): Set the target.
7627 Error if it is incompatible.
7628 * output.h (Output_file): Add filename method.
7630 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7632 * incremental.cc (Incremental_inputs_entry): Remove unused argument
7633 from the get_* methods.
7635 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7637 * incremental-dump.cc (main): Check that the offeset of a script is 0.
7638 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7639 Write 0 for the data_offset of scripts.
7641 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7643 * testsuite/Makefile.am: Add the incremental_test.sh test.
7644 * testsuite/incremental_test.sh: New.
7645 * testsuite/incremental_test_1.c: New.
7646 * testsuite/incremental_test_2.c: New.
7648 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
7650 * incremental-dump.cc (main): Fix typos.
7652 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
7655 * incremental-dump.cc (main): Use llu to print 64 bit values.
7657 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
7658 H.J. Lu <hongjiu.lu@intel.com>
7660 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
7662 (incremental_dump_LDADD): Likewise.
7663 * Makefile.in: Regenerated.
7665 2009-11-25 Doug Kwan <dougkwan@google.com>
7669 2009-11-25 Doug Kwan <dougkwan@google.com>
7671 * arm.cc (Target_arm::Target_arm): Move method definition
7672 outside of class definition. Add code to handle
7673 --target1-rel, --target1-abs and --target2= options.
7674 (Target_arm::get_reloc_reloc_type): Change method to be
7675 non-static and const.
7676 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
7677 New data member declaration.
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):
7681 Adjust call to Target_arm::get_real_reloc_type.
7682 (Target_arm::get_real_reloc_type): Use command line options
7683 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7684 * options.h (--target1-rel, --target1-abs, --target2): New
7687 2009-11-25 Doug Kwan <dougkwan@google.com>
7689 * arm.cc (Target_arm::Target_arm): Move method definition outside of
7690 class definition. Add code to handle --target1-rel, --target1-abs
7691 and --target2= options.
7692 (Target_arm::get_reloc_reloc_type): Change method to be non-static
7694 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
7696 (Target_arm::Scan::local, Target_arm::Scan::global,
7697 Target_arm::Relocate::relocate,
7698 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
7699 call to Target_arm::get_real_reloc_type.
7700 (Target_arm::get_real_reloc_type): Use command line options to
7701 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7702 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
7705 2009-11-25 Doug Kwan <dougkwan@google.com>
7707 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
7708 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
7709 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
7711 (Arm_relocate_functions::thm_call): Replace body with a call to
7712 Arm_relocate_functions::thumb_branch_common.
7713 (Arm_relocate_functions::thm_jump24,
7714 Arm_relocate_functions::thm_xpc22): New method definitions.
7715 (Arm_relocate_functions::thumb_branch_common): New method definition.
7716 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
7718 (Target_arm::Relocate::relocate): Adjust call to thm_call.
7719 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
7721 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
7723 * Makefile.am: Build incremental-dump
7724 * Makefile.in: Regenerate.
7725 * incremental-dump.cc: New.
7726 * incremental.cc (Incremental_inputs_header_data,
7727 Incremental_inputs_entry_data): Move to incremental.h
7728 * incremental.h: (Incremental_inputs_header_data,
7729 Incremental_inputs_entry_data): Move from incremental.cc
7731 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
7733 * incremental.cc (Incremental_inputs_header,
7734 Incremental_inputs_header_write, Incremental_inputs_entry,
7735 Incremental_inputs_entry_write): Add a typedef with the data type.
7737 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
7739 * incremental.cc (Incremental_inputs_header,
7740 Incremental_inputs_header_write, Incremental_inputs_entry,
7741 Incremental_inputs_entry_write): Update comment about which
7742 type has the filed descriptions.
7744 2009-11-15 Doug Kwan <dougkwan@google.com>
7746 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
7747 (Arm_relocate_functions::arm_branch_common): Change method defintion
7748 in class definition to a method declaration and update list of formal
7750 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
7751 Arm_relocation_functions::jump24): Adjust call to
7752 Arm_relocate_functions::arm_branch_common. Update list of formal
7754 (Arm_relocate_functions::xpc25): New method definition.
7755 (Arm_relocate_functions::arm_branch_common): Move method defintion
7756 out from class definition. Use stubs for mode-switching and extending
7758 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
7759 specially. Change code to enable use of stubs in ARM branches.
7761 2009-11-10 Doug Kwan <dougkwan@google.com>
7763 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
7764 in method declaration.
7765 (Target_arm::relocate_stub): New method declaration.
7766 (Target_arm::default_target): Change to return a pointer instead of
7768 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
7769 Target_arm::default_target.
7770 (Arm_Relobj::do_relocate_sections): Remove options paramater in
7772 (Target_arm::relocate_section): Adjust view.
7773 (Target_arm::relocate_stub): New method definition.
7775 2009-11-10 Doug Kwan <dougkwan@google.com>
7777 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
7779 * incremental.cc (open_incremental_binary): Initialized local
7780 variables to avoid warnings.
7781 * object.cc (make_elf_object): Ditto.
7782 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
7785 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
7788 * testsuite/plugin_test.c: Include "config.h".
7790 2009-11-09 Doug Kwan <dougkwan@google.com>
7792 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
7793 (arm_symbol_value): Remove.
7794 (Arm_relocate_functions::arm_branch_common,
7795 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
7796 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
7797 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
7798 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
7799 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
7800 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
7801 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
7802 Arm_relocate_functions::thm_mobw_abs_nc,
7803 Arm_relocate_functions::thm_mov_abs,
7804 Arm_relocate_functions::movw_prel_nc,
7805 Arm_relocate_functions::thm_movt_abs,
7806 Arm_relocate_functions::movt_prel,
7807 Arm_relocate_functions::thm_movw_prel_nc,
7808 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
7809 (Target_arm::Relocate::relocate): Only decompose address into two
7810 parts if relocation type uses the thumb-bit and pass the actual
7811 bit instead of a flag indicating that the thumb-bit is used. Adjust
7812 calls to methods in Arm_relocate_functions for this change.
7814 2009-11-08 Ian Lance Taylor <iant@google.com>
7817 * reloc.cc: Instantiate
7818 Sized_relobj::initialize_input_to_output_maps and
7819 Sized_relobj:free_input_to_output_maps.
7821 2009-11-06 Ian Lance Taylor <iant@google.com>
7824 * defstd.cc (in_segment): Set only_if_ref true for "end".
7826 2009-11-06 Doug Kwan <dougkwan@google.com>
7828 * arm.cc (class Reloc_stub): Correct a comment.
7829 (Target_arm::Target_arm): Initialize arm_input_section_map_.
7830 (Target_arm::scan_section_for_stubs): New method declaration.
7831 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
7832 Change methods from private to protected.
7833 (Target_arm::do_may_relax): New method definition.
7834 (Target_arm::do_relax, Target_arm::group_sections,
7835 Target_arm::scan_reloc_for_stub,
7836 Target_arm::scan_reloc_section_for_stubs): New method declarations.
7837 (Target_arm::arm_input_section_map_): New data member declaration.
7838 (Target_arm::scan_reloc_for_stub,
7839 Target_arm::scan_reloc_section_for_stubs,
7840 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
7841 Target_arm::do_relax): New method definitions.
7843 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
7845 * configure.ac: Check for (struct stat)::st_mtim
7846 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
7847 * config.in: Regenerate.
7848 * configure: Regenerate.
7850 2009-11-05 Ian Lance Taylor <iant@google.com>
7853 * output.cc (Output_segment::add_output_section): Add missing
7856 2009-11-04 Ian Lance Taylor <iant@google.com>
7859 * object.h (class Object): Add is_needed and set_is_needed
7860 methods. Add is_needed_ field. Make bool fields into bitfields.
7861 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
7862 defined in a dynamic object and referenced by a regular object,
7863 set is_needed for the dynamic object.
7864 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
7865 if the file is marked with as_needed and it is not needed.
7867 2009-11-04 Ian Lance Taylor <iant@google.com>
7870 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
7871 tags if data is discarded by linker script.
7872 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7873 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7874 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7875 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7877 2009-11-04 Ian Lance Taylor <iant@google.com>
7879 * layout.cc (Layout::get_output_section): Add is_interp and
7880 is_dynamic_linker_section parameters. Change all callers.
7881 (Layout::choose_output_section): Likewise.
7882 (Layout::make_output_section): Likewise.
7883 (Layout::add_output_section_data): Add is_dynamic_linker_section
7884 parameter. Change all callers.
7885 * layout.h (class Layout): Update declarations.
7886 * output.h (class Output_section): Add is_interp, set_is_interp,
7887 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
7888 Add is_interp_, is_dynamic_linker_section_ fields. Change
7889 generate_code_fills_at_write_ to a bitfield.
7890 * output.cc (Output_section::Output_sections): Initialize new
7892 (Output_segment::add_output_section): Add do_sort parameter.
7895 2009-11-03 Ian Lance Taylor <iant@google.com>
7898 * options.h (class General_options): Add --warn-common.
7899 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
7900 merging two common symbols.
7901 (Symbol_table::should_override): Handle --warn-common when merging
7902 a common symbol with a defined symbol. Use report_resolve_problem
7903 for multiple definitions.
7904 (Symbol_table::report_resolve_problem): New function.
7905 * symtab.h (class Symbol_table): Declare report_resolve_problem.
7907 2009-11-03 Doug Kwan <dougkwan@google.com>
7909 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
7911 (Target_arm::stub_factory): New method definition.
7912 (Target_arm::new_arm_input_section,
7913 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
7914 Target_arm::reloc_uses_thumb_bit): New method declarations.
7915 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
7916 New type definitions.
7917 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
7918 member declarations.
7919 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
7920 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
7921 New method definitions.
7923 2009-11-03 Ian Lance Taylor <iant@google.com>
7925 * options.h (class General_options): Add --warn_constructors.
7927 2009-11-03 Ian Lance Taylor <iant@google.com>
7930 * defstd.cc (in_section): Add entries for __rel_iplt_start,
7931 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
7933 2009-11-03 Ian Lance Taylor <iant@google.com>
7936 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
7937 --msgid-bugs-address.
7938 (install-pdf): New target.
7939 (install-data_yes): Look up one directory to find mkinstalldirs.
7941 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
7943 * po/Make-in (.po.gmo): Don't generate .gmo files in source
7946 2009-10-30 Doug Kwan <dougkwan@google.com>
7948 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
7950 2009-10-30 Doug Kwan <dougkwan@google.com>
7952 * arm.cc (Stub_addend_reader): New struct template definition
7953 and partial specializations.
7954 (Stub_addend_reader::operator()): New method definition for a
7955 partially specialized template.
7957 2009-10-30 Doug Kwan <dougkwan@google.com>
7959 * arm.cc (Arm_relobj::processor_specific_flags): New method
7961 (Arm_relobj::do_read_symbols): New method declaration.
7962 (Arm_relobj::processor_specific_flags_): New data member declaration.
7963 (Arm_dynobj): New class definition.
7964 (Target_arm::do_finalize_sections): Add input_objects parameter.
7965 (Target_arm::do_adjust_elf_header): New method declaration.
7966 (Target_arm::are_eabi_versions_compatible,
7967 (Target_arm::merge_processor_specific_flags): New method declaration.
7968 (Target_arm::do_make_elf_object): New overloaded method definitions
7970 (Arm_relobj::do_read_symbols): New method definition.
7971 (Arm_dynobj::do_read_symbols): Ditto.
7972 (Target_arm::do_finalize_sections): Add input_objects parameters.
7973 Merge processor-specific flags from all input objects.
7974 (Target_arm::are_eabi_versions_compatible,
7975 Target_arm::merge_processor_specific_flags,
7976 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
7977 New method definitions.
7978 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
7979 Input_objects pointer type parameter.
7980 * layout.cc (Layout::finalize): Pass input objects to target's.
7981 finalize_sections function.
7982 * output.cc (Output_file_header::do_sized_write): Set ELF file
7983 header's processor-specific flags.
7984 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
7985 Input_objects pointer type parameter.
7986 * sparc.cc (Target_sparc::do_finalize_sections): Same.
7987 * target.h (Input_objects): New forward class declaration.
7988 (Target::processor_specific_flags,
7989 Target::are_processor_specific_flags_sect): New method definitions.
7990 (Target::finalize_sections): Add input_objects parameter.
7991 (Target::Target): Initialize processor_specific_flags_ and
7992 are_processor_specific_flags_set_.
7993 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
7995 (Target::set_processor_specific_flags): New method definition.
7996 (Target::processor_specific_flags_,
7997 Target::are_processor_specific_flags_set_): New data member
7999 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
8000 Input_objects pointer type parameter.
8002 2009-10-30 Doug Kwan <dougkwan@google.com>
8004 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
8006 2009-10-28 Ian Lance Taylor <iant@google.com>
8008 * object.h (class Relobj): Drop options parameter from
8009 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
8010 do_scan_relocs, do_relocate. Change all callers.
8011 (class Sized_relobj): Drop options parameters from
8012 do_gc_process_relocs, do_scan_relocs, do_relocate,
8013 do_relocate_sections, relocate_sections, emit_relocs_scan,
8014 emit_relocs_scan_reltype. Change all callers.
8015 (struct Relocate_info): Remove options field and all references to
8017 * reloc.h (class Read_relocs): Remove options constructor
8018 parameter and options_ field. Change all callers.
8019 (class Gc_process_relocs, class Scan_relocs): Likewise.
8020 (class Relocate_task): Likewise.
8021 * target-reloc.h (scan_relocs): Remove options parameter. Change
8023 (scan_relocatable_relocs): Likewise.
8024 * target.h (class Sized_target): Remove options parameter from
8025 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
8027 * gc.h (gc_process_relocs): Remove options parameter. Change all
8029 * arm.cc: Update functions to remove options parameters.
8030 * i386.cc: Likewise.
8031 * powerpc.cc: Likewise.
8032 * sparc.cc: Likewise.
8033 * x86_64.cc: Likewise.
8034 * testsuite/testfile.cc: Likewise.
8036 2009-10-28 Doug Kwan <dougkwan@google.com>
8038 * arm.cc (Arm_relobj): New class definition.
8039 (Arm_relobj::scan_sections_for_stubs,
8040 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
8041 New method definitions.
8043 2009-10-28 Cary Coutant <ccoutant@google.com>
8045 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
8046 (Plugin::cleanup_done_): New member.
8047 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
8048 (Plugin_manager::cleanup_done_): Remove.
8049 (Plugin_manager::add_input_file): Edit error message.
8050 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
8051 (Plugin_manager::cleanup): Remove use of cleanup_done_.
8053 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
8055 * fileread.cc: (File_read::View::~View): Use the new
8056 data_ownership_ filed.
8057 (File_read::~File_read): Dispose the new whole_file_view_.
8058 (File_read::open): Mmap the whole file if needed.
8059 (File_read::open): Use whole_file_view_ instead of contents_.
8060 (File_read::find_view): Use whole_file_view_ if applicable.
8061 (File_read::do_read): Use whole_file_view_ instead of contents_.
8062 (File_read::make_view): Use whole_file_view_ instead of contents_,
8063 update File_read::View::View call.
8064 (File_read::find_or_make_view): Update File_read::View::View
8066 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
8068 (File_read::View::Data_ownership): New enum.
8069 (File_read::View::View): Replace bool mapped_ with Data_ownership
8071 (File_read::View::mapped_): Remove (replaced by data_ownership_).
8072 (File_read::View::data_ownership_): New field.
8073 (File_read::contents_): Remove (replaced by whole_file_view_).
8074 (File_read::whole_file_view_): New field.
8075 * options.h (class General_options): Add --keep-files-mapped.
8077 2009-10-27 Cary Coutant <ccoutant@google.com>
8079 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
8080 * testsuite/Makefile.am (plugin_test_5): New test case.
8081 * testsuite/Makefile.in: Regenerate.
8083 2009-10-25 Doug Kwan <dougkwan@google.com>
8085 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
8086 from private to protected to allow access by child class.
8087 (Sized_relobj::do_relocate_sections): New method declaration.
8088 (Sized_relobj::relocate_sections): Virtualize.
8089 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
8090 Sized_relobj::relocate_sections. Instantiate template explicitly
8091 for different target sizes and endianity.
8093 2009-10-24 Doug Kwan <dougkwan@google.com>
8095 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
8096 (Arm_input_section::as_arm_input_section): New method.
8097 (Arm_output_section): New class definition.
8098 (Arm_output_section::create_stub_group,
8099 Arm_output_section::group_sections): New method definitions.
8101 2009-10-22 Doug Kwan <dougkwan@google.com>
8103 * arm.cc (Arm_input_section): New class definition.
8104 (Arm_input_section::init, Arm_input_section:do_write,
8105 Arm_input_section::set_final_data_size,
8106 Arm_input_section::do_reset_address_and_file_offset): New method
8109 2009-10-21 Doug Kwan <dougkwan@google.com>
8111 * arm.cc (Stub_table, Arm_input_section): New forward class
8113 (Stub_table): New class defintion.
8114 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
8115 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
8116 New method definition.
8118 2009-10-21 Doug Kwan <dougkwan@google.com>
8120 * arm.cc: Update copyright comments.
8121 (Target_arm): New forward class template declaration.
8122 (Arm_address): New type.
8123 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
8124 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
8125 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
8127 (Insn_template): Same.
8128 (DEF_STUBS): New macro.
8129 (Stub_type): New enum type.
8130 (Stub_template): New class definition.
8133 (Stub_factory): Same.
8134 (Target_arm::Target_arm): Initialize may_use_blx_ and
8135 should_force_pic_veneer_.
8136 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
8137 Target_arm::should_force_pic_veneer,
8138 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
8139 Target_arm::using_thumb_only, Target_arm:;default_target): New
8141 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
8142 New data member declarations.
8143 (Insn_template::size, Insn_template::alignment): New method defintions.
8144 (Stub_template::Stub_template): New method definition.
8145 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
8146 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
8147 (Stub_factory::Stub_factory): New method definition.
8148 * gold.h (string_hash): New template.
8149 * output.h (Input_section_specifier::hash_value): Use
8151 (Input_section_specifier::string_hash): Remove.
8152 * stringpool.cc (Stringpool_template::string_hash): Use
8155 2009-10-20 Doug Kwan <dougkwan@google.com>
8157 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
8158 symbols of relaxed input sections.
8159 * output.h (Output_section::find_relaxed_input_section): Make
8162 2009-10-16 Doug Kwan <dougkwan@google.com>
8164 * dynobj.cc (Versions::Versions): Initialize version_script_.
8165 Only insert base version symbol definition for a shared object
8166 if version script defines any version versions.
8167 (Versions::define_base_version): New method definition.
8168 (Versions::add_def): Check that base version is not needed.
8169 (Versions::add_need): Define base version lazily.
8170 * dynobj.h (Versions::define_base_version): New method declaration.
8171 (Versions::needs_base_version_): New data member declaration.
8172 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
8173 (check_DATA): Add no_version_test.stdout.
8174 (libno_version_test.so, no_version_test.o no_version_test.stdout):
8176 * testsuite/Makefile.in: Regenerate.
8177 * testsuite/no_version_test.c: New file.
8178 * testsuite/no_version_test.sh: Ditto.
8180 2009-10-16 Doug Kwan <dougkwan@google.com>
8182 * expression.cc (class Segment_start_expression): New class definition.
8183 (Segment_start_expression::value): New method definition.
8184 (script_exp_function_segment_start): Return a new
8185 Segment_start_expression.
8186 * gold/script-c.h (script_saw_segment_start_expression): New function
8188 * script-sections.cc (Script_sections::Script_sections): Initialize
8189 SAW_SEGMENT_START_EXPRESSION_ to false.
8190 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
8191 and -Tbbs options to specify section addresses if given in
8192 command line and no SEGMENT_START expression is seen in a script.
8193 * script-sections.h (Script_sections::saw_segment_start_expression,
8194 Script_sections::set_saw_segment_start_expression): New method
8196 (Script_sections::saw_segment_start_expression_): New data member
8198 * script.cc (script_saw_segment_start_expression): New function.
8199 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
8200 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
8201 script_test_7.sh and script_test_8.sh.
8202 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
8203 script_test_8.stdout.
8204 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
8205 (script_test_6, script_test_6.stdout, script_test_7,
8206 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
8207 * Makefile.in: Regenerate.
8208 * testsuite/script_test_6.sh: New file.
8209 * testsuite/script_test_6.t: Same.
8210 * testsuite/script_test_7.sh: Same.
8211 * testsuite/script_test_7.t: Same.
8212 * testsuite/script_test_8.sh: Same.
8214 2009-10-16 Doug Kwan <dougkwan@google.com>
8216 * output.cc (Output_segment::set_section_list_address): Cast
8217 expressions to unsigned long long type to avoid format warnings.
8219 2009-10-15 Ian Lance Taylor <iant@google.com>
8221 * script.cc (Script_options::add_symbol_assignment): Always add a
8222 dot assignment to script_sections_.
8223 * script-sections.cc (Script_sections::add_dot_assignment):
8224 Initialize if necessary.
8226 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
8227 program headers with no load segment if there is a linker script.
8229 * layout.cc (Layout::set_segment_offsets): Align the file offset
8230 to the segment aligment for -N or -n with no load segment.
8231 * output.cc (Output_segment::add_output_section): Don't crash if
8232 the first section is a TLS section.
8233 (Output_segment::set_section_list_addresses): Print an error
8234 message if the address moves backward in a linker script.
8235 * script-sections.cc
8236 (Output_section_element_input::set_section_addresses): Don't
8237 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
8238 (Orphan_output_section::set_section_addresses): Likewise.
8240 2009-10-15 Doug Kwan <dougkwan@google.com>
8242 * layout.cc (Layout::finish_dynamic_section): Generate tags
8243 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
8244 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
8245 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
8247 2009-10-14 Ian Lance Taylor <iant@google.com>
8249 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
8251 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
8252 data_shdr fields of relinfo.
8253 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
8254 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
8255 R_386_TLS_LDO_32, adjust based on section flags.
8256 (Target_i386::Relocate::fix_up_ldo): Remove.
8258 2009-10-13 Ian Lance Taylor <iant@google.com>
8260 Add support for -pie.
8261 * options.h (class General_options): Add -pie and
8263 (General_options::output_is_position_independent): Test -pie.
8264 (General_options::output_is_executable): Return true if not shared
8265 and not relocatable.
8266 (General_options::output_is_pie): Remove.
8267 * options.cc (General_options::finalize): Reject incompatible uses
8269 * gold.cc (queue_middle_tasks): A -pie link is not static.
8270 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
8271 * symtab.cc (Symbol::final_value_is_known): Return false if
8272 output_is_position_independent.
8273 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
8274 output_is_position_independent.
8275 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
8276 output_is_position_independent.
8277 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
8278 output_is_position_independent.
8279 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
8281 (basic_pie_test.o, basic_pie_test): New targets.
8282 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
8283 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
8284 (two_file_pie_test): New target.
8285 * testsuite/Makefile.in: Rebuild.
8286 * README: Remove note saying that -pie is not supported.
8288 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
8290 * options.h (class General_options): Add -init and -fini.
8291 * layout.cc (Layout::finish_dynamic_section): Emit
8292 given init and fini functions.
8294 2009-10-13 Sriraman Tallam <tmsriram@google.com>
8296 * gc.h (gc_process_relocs): Check if icf is enabled using new
8298 * gold.cc (queue_initial_tasks): Likewise.
8299 (queue_middle_tasks): Likewise.
8300 * object.cc (do_layout): Likewise.
8301 * symtab.cc (is_section_folded): Likewise.
8302 * main.cc (main): Likewise.
8303 * reloc.cc (Read_relocs::run): Likewise.
8304 (Sized_relobj::do_scan_relocs): Likewise.
8305 * icf.cc (is_function_ctor_or_dtor): New function.
8306 (Icf::find_identical_sections): Check if function is ctor or dtor when
8308 * options.h (General_options::icf): Change option to be an enum.
8309 (Icf_status): New enum.
8310 (icf_enabled): New method.
8311 (icf_safe_folding): New method.
8312 (set_icf_status): New method.
8313 (icf_status_): New variable.
8314 * (options.cc) (General_options::finalize): Set icf_status_.
8315 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
8316 icf_test and icf_keep_unique_test to use the --icf enum flag.
8317 * testsuite/icf_safe_test.sh: New file.
8318 * testsuite/icf_safe_test.cc: New file.
8320 2009-10-12 Sriraman Tallam <tmsriram@google.com>
8322 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
8323 includes to gc.h and icf.h.
8324 * arm.cc: Include gc.h.
8325 * gold.cc: Likewise.
8326 * i386.cc: Likewise.
8327 * powerpc.cc: Likewise.
8328 * sparc.cc: Likewise.
8329 * x86_64.cc: Likewise.
8330 * gc.h: Include icf.h.
8332 2009-10-11 Ian Lance Taylor <iant@google.com>
8334 * plugin.cc: Include "gold.h" before other header files.
8336 2009-10-10 Chris Demetriou <cgd@google.com>
8338 * options.h (Input_file_argument::Input_file_type): New enum.
8339 (Input_file_argument::is_lib_): Replace with...
8340 (Input_file_argument::type_): New member.
8341 (Input_file_argument::Input_file_argument): Take Input_file_type
8342 'type' rather than boolean 'is_lib' as second argument.
8343 (Input_file_argument::is_lib): Use type_.
8344 (Input_file_argument::is_searched_file): New function.
8345 (Input_file_argument::may_need_search): Handle is_searched_file.
8346 * options.cc (General_options::parse_library): Support -l:filename.
8347 (General_options::parse_just_symbols): Update for Input_file_argument
8349 (Command_line::process): Likewise.
8350 * archive.cc (Archive::get_file_and_offset): Likewise.
8351 * plugin.cc (Plugin_manager::release_input_file): Likewise.
8352 * script.cc (read_script_file, script_add_file): Likewise.
8353 * fileread.cc (Input_file::Input_file): Likewise.
8354 (Input_file::will_search_for): Handle is_searched_file.
8355 (Input_file::open): Likewise.
8356 * readsyms.cc (Read_symbols::get_name): Likewise.
8357 * testsuite/Makefile.am (searched_file_test): New test.
8358 * testsuite/Makefile.in: Regenerate.
8359 * testsuite/searched_file_test.cc: New file.
8360 * testsuite/searched_file_test_lib.cc: New file.
8362 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8363 Ian Lance Taylor <iant@google.com>
8365 * descriptor.cc: Include <cstdio> and "binary-io.h".
8366 (Descriptors::open): Open the files in binary mode always.
8367 * script.cc (Lex::get_token): Treat \r as whitespace.
8369 2009-10-09 Ian Lance Taylor <iant@google.com>
8371 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
8373 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8374 Ian Lance Taylor <iant@google.com>
8376 * configure.ac: Check for readv function also.
8377 * fileread.cc (readv): Define if not HAVE_READV.
8378 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
8380 * config.in: Regenerate.
8381 * configure: Regenerate.
8383 2009-10-09 Doug Kwan <dougkwan@google.com>
8385 * layout.cc (Layout::make_output_section): Call target hook to make
8386 ordinary output section.
8387 (Layout::finalize): Adjust parameter list of call the
8388 Target::may_relax().
8389 * layout.h (class Layout::section_list): New method.
8390 * merge.h (Output_merge_base::entsize): Change visibility to public.
8391 (Output_merge_base::is_string, Output_merge_base::do_is_string):
8393 (Output_merge_string::do_is_string): New method.
8394 * object.cc (Sized_relobj::do_setup): renamed from
8395 Sized_relobj::set_up.
8396 * object.h (Sized_relobj::adjust_shndx,
8397 Sized_relobj::initializ_input_to_output_maps,
8398 Sized_relobj::free_input_to_output_maps): Change visibilities to
8400 (Sized_relobj::setup): Virtualize.
8401 (Sized_relobj::do_setup): New method declaration.
8402 (Sized_relobj::invalidate_section_offset,
8403 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
8404 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
8405 * options.cc (parse_int): New function.
8406 * options.h (parse_int): New declaration.
8407 (DEFINE_int): New macro.
8408 (stub_group_size): New option.
8409 * output.cc (Output_section::Output_section): Initialize memebers
8410 merge_section_map_, merge_section_by_properties_map_,
8411 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
8412 (Output_section::add_input_section): Handled deferred code-fill
8413 generation and remove an old comment.
8414 (Output_section::add_relaxed_input_section): New method definition.
8415 (Output_section::add_merge_input_section): Use merge section by
8416 properties map to speed to search. Update merge section maps
8418 (Output_section::build_relaxation_map): New method definition.
8419 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8421 (Output_section::relax_input_section): Renamed to
8422 Output_section::convert_input_sections_to_relaxed_sections and change
8423 interface to take a vector of pointers to relaxed sections.
8424 (Output_section::find_merge_section,
8425 Output_section::find_relaxed_input_section): New method definitions.
8426 (Output_section::is_input_address_mapped,
8427 Output_section::output_offset, Output_section::output_address):
8428 Use output section data maps to speed up searching.
8429 (Output_section::find_starting_output_address): Add comments.
8430 (Output_section::do_write,
8431 Output_section::write_to_postprocessing_buffer): Do code-fill
8432 generation as appropriate.
8433 (Output_section::get_input_sections): Invalidate relaxed input section
8435 (Output_section::restore_states): Adjust type of checkpoint .
8436 Invalidate relaxed input section map.
8437 * output.h (Output_merge_base): New class declaration.
8438 (Input_section_specifier): New class defintion.
8439 (class Output_relaxed_input_section) Change base class to
8440 Output_section_data_build.
8441 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
8442 base class initializer.
8443 (Output_section::add_relaxed_input_section): New method declaration.
8444 (Output_section::Input_section): Change visibility to protected.
8445 (Output_section::Input_section::relobj,
8446 Output_section::Input_section::shndx): Handle relaxed input sections.
8447 Output_section::input_sections) Change visibility to protected. Also
8448 define overload to return a non-const pointer.
8449 (Output_section::Merge_section_properties): New class defintion.
8450 (Output_section::Merge_section_by_properties_map,
8451 Output_section::Output_section_data_by_input_section_map,
8452 Output_section::Relaxation_map): New types.
8453 (Output_section::relax_input_section): Rename method to
8454 Output_section::convert_input_sections_to_relaxed_sections and change
8455 interface to take a vector of relaxed section pointers.
8456 (Output_section::find_merge_section,
8457 Output_section::find_relaxed_input_section,
8458 Output_section::build_relaxation_map,
8459 Output_section::convert_input_sections_in_list_to_relaxed_sections):
8460 New method declarations.
8461 (Output_section::merge_section_map_
8462 Output_section::merge_section_by_properties_map_,
8463 Output_section::relaxed_input_section_map_,
8464 Output_section::is_relaxed_input_section_map_valid_,
8465 Output_section::generate_code_fills_at_write_): New data members.
8466 * script-sections.cc
8467 (Output_section_element_input::set_section_addresses): Call
8468 current_data_size and addralign methods of relaxed input sections.
8469 (Orphan_output_section::set_section_addresses): Call current_data_size
8470 and addralign methods of relaxed input sections.
8471 * symtab.cc (Symbol_table::compute_final_value): Extract template
8472 from the body of Symbol_table::sized_finalize_symbol.
8473 (Symbol_table::sized_finalized_symbol): Call
8474 Symbol_table::compute_final_value.
8475 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
8476 (Symbol_table::compute_final_value): New templated method declaration.
8477 * target.cc (Target::do_make_output_section): New method defintion.
8478 * target.h (Target::make_output_section): New method declaration.
8479 (Target::relax): Add more parameters for input objects, symbol table
8480 and layout. Adjust call to do_relax.
8481 (Target::do_make_output_section): New method declaration.
8482 (Target::do_relax): Add parameters for input objects, symbol table
8485 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8487 * pread.c: Include stdio.h.
8489 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8491 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
8494 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8496 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8497 Change read_shndx type to unsigned int.
8498 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8500 (Sized_dwarf_line_info::read_line_mappings): Likewise.
8501 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
8502 Change read_shndx type to unsigned int.
8503 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8505 (Sized_dwarf_line_info::read_line_mappings): Likewise.
8506 * layout.cc (Layout::create_symtab_sections): Cast the result of
8507 local_symcount * symsize to off_t in the gold_assert.
8509 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8511 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
8512 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
8514 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
8515 (Arm_relocate_functions::thm_abs5): New function.
8516 (Arm_relocate_functions::abs12): New function.
8517 (Arm_relocate_functions::abs16): New function.
8518 (Arm_relocate_functions::base_abs): New function.
8519 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
8520 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
8521 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
8523 (Scan::global): Likewise.
8524 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
8525 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
8526 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
8527 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
8530 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8532 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
8533 (Arm_relocate_functions::movt_prel): New function.
8534 (Arm_relocate_functions::thm_movw_prel_nc): New function.
8535 (Arm_relocate_functions::thm_movt_prel): New function.
8536 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8537 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8538 (Scan::global, Relocate::relocate): Likewise.
8539 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8541 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8543 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8544 Incremental_checker.
8545 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8547 (class Incremental_inputs_header): New class.
8548 (Incremental_inputs_header_writer): Edit comment.
8549 (Incremental_inputs_entry): New class.
8550 (Incremental_inputs_entry_writer): Edit comment.
8551 (Sized_incremental_binary::do_find_incremental_inputs_section):
8552 Add *strtab_shndx parameter, fill it.
8553 (Sized_incremental_binary::do_check_inputs): New method.
8554 (Incremental_checker::can_incrementally_link_output_file): Use
8555 Sized_incremental_binary::check_inputs.
8556 (Incremental_inputs::report_command_line): Save command line in
8559 (Incremental_binary::find_incremental_inputs_section): New
8561 (Incremental_binary::do_find_incremental_inputs_section): Add
8562 strtab_shndx parameter.
8563 (Incremental_binary::do_check_inputs): New pure virtual method.
8564 (Sized_incremental_binary::do_check_inputs): Declare.
8565 (Incremental_checker::Incremental_checker): Add incremental_inputs
8566 parameter, use it to initialize incremental_inputs_.
8567 (Incremental_checker::incremental_inputs_): New field.
8568 (Incremental_checker::command_line): New method.
8569 (Incremental_checker::inputs): New method.
8570 (Incremental_checker::command_line_): New field.
8572 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8574 * incremental.cc: Include <cstdarg> and "target-select.h".
8575 (vexplain_no_incremental): New function.
8576 (explain_no_incremental): New function.
8577 (Incremental_binary::error): New method.
8578 (Sized_incremental_binary::do_find_incremental_inputs_section): New
8580 (make_sized_incremental_binary): New function.
8581 (open_incremental_binary): New function.
8582 (can_incrementally_link_file): Add checks if output is ELF and has
8584 * incremental.h: Include "elfcpp_file.h" and "output.h".
8585 (Incremental_binary): New class.
8586 (Sized_incremental_binary): New class.
8587 (open_incremental_binary): Declare.
8588 * object.cc (is_elf_object): Use
8589 elfcpp::Elf_recognizer::is_elf_file.
8590 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
8591 * output.h (Output_file::filesize): New method.
8593 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8595 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
8597 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
8598 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
8600 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
8602 (Arm_relocate_functions::movw_abs_nc): New function.
8603 (Arm_relocate_functions::movt_abs): New function.
8604 (Arm_relocate_functions::thm_movw_abs_nc): New function.
8605 (Arm_relocate_functions::thm_movt_abs): New function.
8606 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
8607 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
8608 (Scan::global): Likewise.
8609 (Relocate::relocate): Likewise.
8610 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8612 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8614 * arm.cc (Arm_relocate_functions::got_prel) New function.
8615 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
8616 (Relocate::relocate): Likewise.
8617 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8619 2009-10-06 Ian Lance Taylor <iant@google.com>
8621 * options.h (class General_options): Define
8622 split_stack_adjust_size parameter.
8623 * object.h (class Object): Add uses_split_stack_ and
8624 has_no_split_stack_ fields. Add uses_split_stack and
8625 has_no_split_stack accessor functions. Declare
8626 handle_split_stack_section.
8627 (class Reloc_symbol_changes): Define.
8628 (class Sized_relobj): Define Function_offsets. Declare
8629 split_stack_adjust, split_stack_adjust_reltype, and
8631 * object.cc (Object::handle_split_stack_section): New function.
8632 (Sized_relobj::do_layout): Call handle_split_stack_section.
8633 * dynobj.cc (Sized_dynobj::do_layout): Call
8634 handle_split_stack_section.
8635 * reloc.cc (Sized_relobj::relocate_sections): Call
8636 split_stack_adjust for executable sections in split_stack
8637 objects. Pass reloc_map to relocate_section.
8638 (Sized_relobj::split_stack_adjust): New function.
8639 (Sized_relobj::split_stack_adjust_reltype): New function.
8640 (Sized_relobj::find_functions): New function.
8641 * target-reloc.h: Include "object.h".
8642 (relocate_section): Add reloc_symbol_changes parameter. Change
8644 * target.h (class Target): Add calls_non_split method. Declare
8645 do_calls_non_split virtual method. Declare match_view and
8647 * target.cc: Include "elfcpp.h".
8648 (Target::do_calls_non_split): New function.
8649 (Target::match_view): New function.
8650 (Target::set_view_to_nop): New function.
8651 * gold.cc (queue_middle_tasks): Give an error if mixing
8652 split-stack and non-split-stack objects with -r.
8653 * i386.cc (Target_i386::relocate_section): Add
8654 reloc_symbol_changes parameter.
8655 (Target_i386::do_calls_non_split): New function.
8656 * x86_64.cc (Target_x86_64::relocate_section): Add
8657 reloc_symbol_changes parameter.
8658 (Target_x86_64::do_calls_non_split): New function.
8659 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
8661 * powerpc.cc (Target_powerpc::relocate_section): Add
8662 reloc_symbol_changes parameter.
8663 * sparc.cc (Target_sparc::relocate_section): Add
8664 reloc_symbol_changes parameter.
8665 * configure.ac: Call AM_CONDITIONAL for the default target.
8666 * configure: Rebuild.
8667 * testsuite/Makefile.am (TEST_AS): New variable.
8668 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
8669 (check_DATA): Add split_i386 and split_x86_64 files.
8670 (SPLIT_DEFSYMS): Define.
8671 (split_i386_[1234n].o): New targets.
8672 (split_i386_[124]): New targets.
8673 (split_i386_[1234r].stdout): New targets.
8674 (split_x86_64_[1234n].o): New targets.
8675 (split_x86_64_[124]): New targets.
8676 (split_x86_64_[1234r].stdout): New targets.
8677 (MOSTLYCLEANFILES): Add new executables.
8678 * testsuite/split_i386.sh: New file.
8679 * testsuite/split_x86_64.sh: New file.
8680 * testsuite/split_i386_1.s: New file.
8681 * testsuite/split_i386_2.s: New file.
8682 * testsuite/split_i386_3.s: New file.
8683 * testsuite/split_i386_4.s: New file.
8684 * testsuite/split_i386_n.s: New file.
8685 * testsuite/split_x86_64_1.s: New file.
8686 * testsuite/split_x86_64_2.s: New file.
8687 * testsuite/split_x86_64_3.s: New file.
8688 * testsuite/split_x86_64_4.s: New file.
8689 * testsuite/split_x86_64_n.s: New file.
8690 * testsuite/testfile.cc (Target_test): Update relocation_section
8692 * testsuite/Makefile.in: Rebuild.
8694 2009-10-06 Ian Lance Taylor <iant@google.com>
8696 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
8697 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
8698 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
8699 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
8700 the address on ldo_addrs_.
8701 (Target_i386::Relocate::fix_up_ldo): New function.
8703 2009-10-06 Rafael Espindola <espindola@google.com>
8705 * plugin.cc (add_input_library): New.
8706 (Plugin::load): Add add_input_library to tv.
8707 (Plugin_manager::add_input_file): Add the is_lib argument.
8708 (add_input_file): Update call to Plugin_manager::add_input_file.
8709 (add_input_library): New.
8710 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
8712 2009-09-30 Doug Kwan <dougkwan@google.com>
8714 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
8715 symbol and call Symbol::may_need_copy_reloc to determine if
8716 a copy reloc is needed.
8717 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
8718 nocopyreloc is given in command line.
8719 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
8720 given in command line.
8721 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
8722 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
8723 of the removed Target_i386::may_need_copy_reloc.
8724 * options.h (copyreloc): New option with default value false.
8725 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8726 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
8727 instead of the removed Target_powerpc::may_need_copy_reloc.
8728 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8729 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
8730 instead of the removed Target_sparc::may_need_copy_reloc.
8731 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
8732 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
8733 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
8734 instead of the removed Target_x86_64::may_need_copy_reloc.
8736 2009-09-30 Ian Lance Taylor <iant@google.com>
8738 * object.h (class Object): Remove target_ field, and target,
8739 sized_target, and set_target methods.
8740 (Object::sized_target): Remove.
8741 (class Sized_relobj): Update declarations. Remove sized_target.
8742 * object.cc (Sized_relobj::setup): Remove target parameter.
8744 (Input_objects::add_object): Don't do anything with the target.
8745 (make_elf_sized_object): Add punconfigured parameter. Change all
8746 callers. Set or test parameter target.
8747 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
8749 * parameters.cc (Parameters::set_target): Change parameter type to
8751 (Parameters::default_target): Remove.
8752 (set_parameters_target): Change parameter type to be non-const.
8753 (parameters_force_valid_target): New function.
8754 (parameters_clear_target): New function.
8755 * parameters.h (class Parameters): Update declarations. Remove
8756 default_target method. Add sized_target and clear_target
8757 methods. Change target_ to be non-const.
8758 (set_parameters_target): Update declaration.
8759 (parameters_force_valid_target): Declare.
8760 (parameters_clear_target): Declare.
8761 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
8762 as NULL if we aren't searching.
8763 (Add_symbols::run): Don't check for compatible target.
8764 * fileread.cc (Input_file::open_binary): Call
8765 parameters_force_valid_target.
8766 * gold.cc (queue_middle_tasks): Likewise.
8767 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
8768 set_target on object.
8769 * dynobj.h (class Sized_dynobj): Update declarations.
8770 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
8771 make_elf_object returns NULL.
8772 (Archive::include_member): Don't check whether object target is
8774 * output.cc (Output_section::add_input_section): Get target from
8776 (Output_section::relax_input_section): Likewise.
8777 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
8779 (Sized_relobj::do_scan_relocs): Likewise.
8780 (Sized_relobj::relocate_sections): Likewise.
8781 * resolve.cc (Symbol_table::resolve): Likewise.
8782 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
8783 parameter. Change all callers.
8784 (Symbol_table::add_from_object): Get target from parameters.
8785 (Symbol_table::add_from_relobj): Don't check object target.
8786 (Symbol_table::add_from_dynobj): Likewise.
8787 (Symbol_table::define_special_symbol): Get target from
8789 * symtab.h (class Symbol_table): Update declaration.
8790 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
8791 parameter. Change all callers. Clear parameter target.
8792 (Binary_test): Test target here.
8793 * testsuite/object_unittest.cc (gold_testsuite): Remove
8794 target_test_pointer parameter. Change all callers.
8795 (Object_test): Test target here.
8797 2009-09-26 Ian Lance Taylor <iant@google.com>
8799 * testsuite/initpri1.c: Don't try to use constructor priorities if
8800 compiling with gcc before 4.3.
8802 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
8804 * testsuite/retain_symbols_file_test.sh (check_present): Change
8805 output file name to retain_symbols_file_test.stdout.
8806 (check_absent): Likewise.
8808 2009-09-18 Craig Silverstein <csilvers@google.com>
8810 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
8811 * options.cc: Include <cerrno> and <fstream>.
8812 (General_options::finalize): Parse -retain-symbols-file tag.
8813 * options.h: New flag.
8814 (General_options): New method should_retain_symbol, new
8815 variable symbols_to_retain.
8816 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
8817 should_retain_symbol map.
8818 * testsuite/Makefile.am (retain_symbols_file_test): New test.
8819 * testsuite/Makefile.in: Regenerate.
8820 * testsuite/retain_symbols_file_test.sh: New file.
8822 2009-09-18 Nick Clifton <nickc@redhat.com>
8824 * po/es.po: Updated Spanish translation.
8826 2009-09-17 Doug Kwan <dougkwan@google.com>
8828 * debug.h (DEBUG_RELAXATION): New constant.
8829 (DEBUG_ALL): Add DEBUG_RELAXATION.
8830 (debug_string_to_enum): Add relaxation debug option.
8832 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
8833 Layout::Relaxation_debug_check::read_sections,
8834 Layout::Relaxation_debug_check::read_sections): New method definitions.
8835 (Layout::Layout): Initialize data members
8836 record_output_section_data_from_scrips_,
8837 script_output_section_data_list_ and relaxation_debug_check_.
8838 (Layout::save_segments, Layout::restore_segments,
8839 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8840 Layout::relaxation_loop_body): New method definitions.
8841 (Layout::finalize): Support relaxation. Move section layout code to
8842 Layout::relaxation_loop_body.
8843 (Layout::set_asection_address_from_script): Move code for orphan
8844 section placement out.
8845 (Layout::place_orphan_sections_in_script): New method definition.
8846 * layout.h (Output_segment_headers, Output_file_header):
8847 New forward class declarations.
8848 (Layout::~Layout): Define.
8849 (Layout::new_output_section_data_from_script): New method definition.
8850 (Layout::place_orphan_sections_in_script): New method declaration.
8851 (Layout::Segment_states): New type declaration.
8852 (Layout::save_segments, Layout::restore_segments,
8853 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8854 Layout::relaxation_loop_body): New method declarations.
8855 (Layout::Output_section_data_list): New type declaration.
8856 (Layout::Relaxation_debug_check): New class definition.
8857 (Layout::record_output_section_data_from_script_,
8858 Layout::script_output_section_data_list_, Layout::segment_states_,
8859 Layout::relaxation_debug_check_): New data members.
8860 * output.cc: (Output_section_headers::do_size): New method definition.
8861 (Output_section_headers::Output_section_headers): Move size
8862 computation to Output_section_headers::do_size.
8863 (Output_segment_headers::do_size): New method definition.
8864 (Output_file_header::Output_file_header): Move size computation to
8865 Output_file_header::do_size and call it.
8866 (Output_file_header::do_size): New method definition.
8867 (Output_data_group::Output_data_group): Adjust call to
8868 Output_section_data.
8869 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
8870 (Output_symtab_xindex::do_write): Add array bound check.
8871 (Output_section::Input_section::print_to_mapfile): Handle
8872 RELAXED_INPUT_SECTION_CODE.
8873 (Output_section::Output_section): Initialize data member checkpoint_.
8874 (Output_section::~Output_section): Delete checkpoint object pointed
8876 (Output_section::add_input_section): Always add an Input_section if
8878 (Output_section::add_merge_input_section): Add assert.
8879 (Output_section::relax_input_section): New method definition.
8880 (Output_section::set_final_data_size): Set load address to zero for
8881 an unallocated section.
8882 (Output_section::do_address_and_file_offset_have_reset_values):
8883 New method definition.
8884 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
8885 Handle relaxed input section.
8886 (Output_section::sort_attached_input_sections): Checkpoint input
8887 section list lazily.
8888 (Output_section::get_input_sections): Change type of input_sections to
8889 list of Simple_input_section pointers. Checkpoint input section list
8890 lazily. Also handle relaxed input sections.
8891 (Output_section::add_input_section_for_script): Take a reference to
8892 a Simple_input_section object instead of Relobj pointer and section
8893 index as parameter. Handle relaxed input sections.
8894 (Output_section::save_states, Output_section::restore_states): New
8896 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
8897 (Output_data::is_data_size_fixed): New method definition.
8898 (Output_data::reset_addresss_and_file_offset): Do not reset data size
8900 (Output_data::address_and_file_offset_have_reset_values): New method
8902 (Output_data::do_address_and_file_offset_have_reset_values): New method
8904 (Output_data::set_data_size): Check that data size is not fixed.
8905 (Output_data::fix_data_size): New method definition.
8906 (Output_data::is_data_size_fixed_): New data member.
8907 (Output_section_headers::set_final_data_size): New method definition.
8908 (Output_section_headers::do_size): New method declaration.
8909 (Output_segment_headers::set_final_data_size): New method definition.
8910 (Output_segment_headers::do_size): New method declaration.
8911 (Output_file_header::set_final_data_size)::New method definition.
8912 (Output_file_header::do_size)::New method declaration.
8913 (Output_section_data::Output_section_data): Add new parameter
8914 is_data_size_fixed and use it to fix data size.
8915 (Output_data_const::Output_data_const): Adjust call to base class
8916 constructor and fix data size.
8917 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
8918 base class constructor and fix data size.
8919 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
8920 base class constructor and fix data size.
8921 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
8922 class constructor and fix data size.
8923 (Output_data_group::set_final_data_size): New method definition.
8924 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
8925 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
8926 class constructor and fix data size.
8927 (Output_relaxed_input_section): New class definition.
8928 (Output_section::Simple_input_section): New class definition.
8929 (Output_section::get_input_sections): Adjust parameter list.
8930 (Output_section::add_input_section_for_script): Same.
8931 (Output_section::save_states, Output_section::restore_states,
8932 Output_section::do_address_and_file_offset_have_reset_values,
8933 (Output_section::Input_section::Input_section): Handle
8934 RELAXED_INPUT_SECTION_CODE. Add new overload for
8935 Output_relaxed_input_section.
8936 (Output_section::Input_section::is_input_section,
8937 Output_section::Input_section::set_output_section): Handle relaxed
8939 (Output_section::Input_section::is_relaxed_input_section,
8940 Output_section::Input_section::output_section_data,
8941 Output_section::Input_section::relaxed_input_section): New method
8943 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
8945 (Output_section::Input_section::u1_): Update comments.
8946 (Output_section::Input_section::u2_): Add new union member poris.
8947 (Output_section::Checkpoint_output_section): New classs definition.
8948 (Output_section::relax_input_section): New method declaration.
8949 (Output_section::checkpoint_): New data member.
8950 (Output_segment): Update comments.
8951 (Output_segment::Output_segment): Un-privatize copy constructor.
8952 (Output_segment::operator=): Un-privatize.
8953 * script-sections.cc (Output_section_element::Input_section_list):
8954 Change element type to Output_section::Simple_input_section.
8955 (Output_section_element_dot_assignment::set_section_addresses):
8956 Register output section data for relaxation clean up.
8957 (Output_data_exression::Output_data_expression): Adjust call to base
8958 constructor to fix data size.
8959 (Output_section_element_data::set_section_addresses): Register
8960 Output_data_expression object for relaxation clean up.
8961 (struct Input_section_info): Replace Relobj pointer and section index
8962 pair with Output_section::Simple_input_section and Convert struct to a
8964 (Input_section_sorter::operator()): Adjust access to
8965 Input_section_info data member to use accessors.
8966 (Output_section_element_input::set_section_addresses): Use layout
8967 parameter. Adjust code to use Output_section::Simple_input_section
8968 and Input_secction_info classes. Register filler for relaxation
8970 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
8971 and section index pair with Output_section::Simple_input_section
8972 class. Adjust code accordingly.
8973 (Phdrs_element::release_segment): New method definition.
8974 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
8976 (Script_sections::release_segments): New method definition.
8977 * gold/script-sections.h (Script_sections::release_segments): New
8979 * gold/target.h (Target::may_relax, Target::relax,
8980 Target::do_may_relax, Target::do_relax): New method definitions.
8982 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8984 * arm.cc (has_signed_unsigned_overflow): New function.
8985 (Arm_relocate_functions::abs8): New function.
8986 (Target_arm::Scan::local): Handle R_ARM_ABS8.
8987 (Target_arm::Scan::global): Likewise.
8988 (Target_arm::relocate::relocate): Likewise.
8989 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8992 2009-09-16 Cary Coutant <ccoutant@google.com>
8994 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
8995 * testsuite/Makefile.in: Regenerate.
8997 2009-09-11 Nick Clifton <nickc@redhat.com>
8999 * po/gold.pot: Updated by the Translation project.
9001 2009-09-08 Cary Coutant <ccoutant@google.com>
9003 * output.cc (Output_file::open): Add execute permission to empty file.
9004 * testsuite/Makefile.am (permission_test): New test.
9005 * testsuite/Makefile.in: Regenerate.
9007 2009-09-02 Ian Lance Taylor <iant@google.com>
9009 * output.cc (Output_file::resize): Call map_no_anonymous rather
9012 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
9014 * gold.cc: Include "incremental.h".
9015 (queue_initial_tasks): Call Incremental_checker methods.
9016 * incremental.cc: Include "output.h".
9017 (Incremental_checker::can_incrementally_link_output_file): New
9019 * incremental.h (Incremental_checker): New class.
9021 * output.cc (Output_file::open_for_modification): New method.
9022 (Output_file::map_anonymous): Changed return type to bool. Record
9024 (Output_file::map_no_anonymous): New method, broken out of map.
9025 (Output_file::map): Use map_no_anonymous and map_anonymous.
9026 * output.h (class Output_file): Update declarations.
9028 2009-08-24 Cary Coutant <ccoutant@google.com>
9030 * options.h (Command_line::Pre_options): New class.
9031 (Command_line::pre_options): New member.
9032 * options.cc (gold::options::ready_to_register): New variable.
9033 (One_option::register_option): Do nothing if not registering options.
9034 Assert if same short option registered twice.
9035 (General_options::General_options): Turn off option registration when
9037 (Command_line::Pre_options::Pre_options): New constructor.
9039 2009-08-24 Cary Coutant <ccoutant@google.com>
9041 * options.h (General_options::no_keep_memory): Remove incorrect
9044 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9046 * Makefile.am (am__skiplex, am__skipyacc): New.
9047 * Makefile.in: Regenerate.
9049 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9051 * Makefile.am (AM_CPPFLAGS): Renamed from ...
9052 (INCLUDES): ... this.
9053 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
9054 (AM_CPPFLAGS): Renamed from ...
9055 (INCLUDE): ... this.
9056 * Makefile.in, testsuite/Makefile.in: Regenerate.
9058 * Makefile.in: Regenerate.
9059 * aclocal.m4: Likewise.
9060 * config.in: Likewise.
9061 * configure: Likewise.
9062 * testsuite/Makefile.in: Likewise.
9064 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9065 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9066 * Makefile.in: Regenerate.
9067 * testsuite/Makefile.in: Regenerate.
9069 2009-08-19 Cary Coutant <ccoutant@google.com>
9071 * resolve.cc (Symbol_table::resolve): Don't complain about defined
9072 symbols in shared libraries overridden by hidden or internal symbols
9073 in the main program.
9075 2009-08-19 Chris Demetriou <cgd@google.com>
9077 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
9078 checking source file names in error messages.
9080 2009-08-18 Doug Kwan <dougkwan@google.com>
9082 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
9083 an elcpp::Ehdr as parameter. Adjust call to set_target.
9084 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
9085 an elfcpp::Ehdr as parameter.
9086 * object.cc (Object::set_target): Remove the version that looks up
9087 a target and sets it.
9088 (Sized_relobj::setup): Take a Target object instead of
9089 an elfcpp::Ehdr as parameter. Adjust call to set_target.
9090 (make_elf_sized_object): Find target and ask target to
9092 * object.h: (Object::set_target): Remove the version that looks up
9093 a target and sets it.
9094 (Sized_relobj::setup): Take a Target object instead of
9095 an elfcpp:Ehdr as parameter.
9096 * target.cc: Include dynobj.h.
9097 (Target::do_make_elf_object_implementation): New.
9098 (Target::do_make_elf_object): New.
9099 * target.h (Target::make_elf_object): New template declaration.
9100 (Target::do_make_elf_object): New method declarations.
9101 (Target::do_make_elf_object_implementation): New template declaration.
9103 2009-08-14 Ian Lance Taylor <iant@google.com>
9105 * gold.h (FUNCTION_NAME): Define.
9106 (gold_unreachable): Use FUNCTION_NAME.
9108 2009-08-12 Sriraman Tallam <tmsriram@google.com>
9110 * icf.cc (Icf::find_identical_sections): Issue a warning when a
9111 symbol in the --keep-unique list is not found.
9113 2009-08-12 Sriraman Tallam <tmsriram@google.com>
9115 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
9116 been maked as --keep-unique.
9117 (Icf::unfold_section): New function.
9118 * icf.h (Icf::unfold_section): New function.
9119 * options.h (General_options::keep_unique): New option.
9120 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
9121 * testsuite/Makefile.in: Regenerate.
9122 * testsuite/icf_keep_unique_test.sh: New file.
9123 * testsuite/icf_keep_unique_test.cc: New file.
9125 2009-08-12 Cary Coutant <ccoutant@google.com>
9128 * resolve.cc (Symbol_table::resolve): Check for references from
9129 dynamic objects to hidden and internal symbols.
9130 * testsuite/Makefile.am (hidden_test.sh): New test.
9131 * testsuite/Makefile.in: Regenerate.
9132 * testsuite/hidden_test.sh: New script.
9133 * testsuite/hidden_test_1.c: New test source.
9134 * testsuite/hidden_test_main.c: New test source.
9136 2009-08-11 Doug Kwan <dougkwan@google.com>
9138 * arm.cc: Update comments.
9139 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
9140 segment to locate the .ARM.exidx section if present.
9142 2009-08-09 Doug Kwan <dougkwan@google.com>
9144 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
9147 2009-08-07 Sriraman Tallam <tmsriram@google.com>
9148 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
9151 2009-08-06 Sriraman Tallam <tmsriram@google.com>
9153 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
9154 valid tls_segment only for non-debug-section relocations.
9155 * testsuite/Makefile.am: Add gc_tls_test.
9156 * testsuite/Makefile.in: Regenerate.
9157 * testsuite/gc_tls_test.cc: New file.
9158 * testsuite/gc_tls_test.sh: New file.
9160 2009-08-05 Sriraman Tallam <tmsriram@google.com>
9164 * Makefile.am (CCFILES): Add icf.cc.
9166 * Makefile.in: Regenerate.
9167 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
9168 * gc.h (gc_process_relocs): Populate lists used by icf to contain
9169 section, symbol and addend information for the relocs.
9170 * gold.cc (queue_middle_tasks): Call identical code folding.
9171 * gold.h: Add defines for multimap.
9172 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
9173 to the call of finalize_local_symbols.
9174 * main.cc (main): Create object of class Icf.
9175 * object.cc (Sized_relobj::do_layout): Allow this function to be
9176 called twice during icf.
9177 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
9178 to sections marked as identical by icf.
9179 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
9181 (Sized_relobj::do_section_entsize): New function.
9182 * object.h (Object::section_entsize): New function.
9183 (Object::do_section_entsize): New pure virtual function.
9184 (Relobj::finalize_local_symbols): Add new parameter.
9185 (Relobj::do_section_entsize): New function.
9186 * options.h (General_options::icf): New option.
9187 (General_options::icf_iterations): New option.
9188 (General_options::print_icf_sections): New option.
9189 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
9190 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
9191 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
9193 * symtab.cc (Symbol_table::is_section_folded): New function.
9194 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
9195 to sections marked as identical by icf.
9196 * symtab.h (Symbol_table::set_icf): New function.
9197 (Symbol_table::icf): New function.
9198 (Symbol_table::is_section_folded): New function.
9199 (Symbol_table::icf_): New data member.
9200 * target-reloc.h (relocate_section): Ignore sections folded by icf.
9201 * testsuite/Makefile.am: Add commands to build icf_test.
9202 * testsuite/Makefile.in: Regenerate.
9203 * testsuite/icf_test.sh: New file.
9204 * testsuite/icf_test.cc: New file.
9206 2009-07-24 Chris Demetriou <cgd@google.com>
9208 * layout.cc (is_compressible_debug_section): Fix incorrect
9209 comment about compressed section names.
9211 2009-07-20 Ian Lance Taylor <ian@airs.com>
9214 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
9216 2009-07-16 Ian Lance Taylor <iant@google.com>
9219 * layout.h: #include <map>.
9220 (class Kept_section): Change from struct to class. Add accessors
9221 and setters. Add section size to Comdat_group mapping. Change
9222 Comdat_group to std::map. Add is_comdat_ field. Add
9223 linkonce_size field in union.
9224 (class Layout): Update declaration of find_or_add_kept_section.
9225 Don't declare find_kept_object.
9226 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
9227 parameter. Add object, shndx, is_comdat, and is_group_name
9228 parameters. Change all callers. Adjust for new Kept_section.
9229 (Layout::find_kept_object): Remove.
9230 * object.cc (Sized_relobj::include_section_group): Update use of
9231 Kept_section. Rename secnum to shndx. Only record
9232 Kept_comdat_section if sections are the same size.
9233 (Sized_relobj::include_linkonce_section): Update use of
9234 Kept_section. Only record Kept_comdat_section if sections are the
9235 same size. Set size of linkonce section.
9236 (Sized_relobj::map_to_kept_section): Update call to
9237 get_kept_comdat_section.
9238 * object.h (class Sized_relobj): Rename fields in
9239 Kept_comdat_section to drop trailing underscores; change object
9240 field to Relobj*. Change Kept_comdat_section_table to store
9241 struct rather than pointer.
9242 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
9243 Add kept_object and kept_shndx parameters. Change all callers.
9244 (Sized_relobj::get_kept_comdat_section): Change return type to
9245 bool. Add kept_object and kept_shndx parameters. Change all
9247 * plugin.cc (Pluginobj::include_comdat_group): Update call to
9248 Layout::find_or_add_kept_section.
9250 2009-07-09 Ian Lance Taylor <iant@google.com>
9252 * merge.cc (Object_merge_map::initialize_input_to_output_map):
9253 Reserve space in the hash table.
9255 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
9257 * fileread.cc (File_read::get_mtime): New method.
9258 * fileread.h (Timespec): New structure.
9259 (File_read::get_mtime): New method.
9260 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
9261 Renamed from timestamp_nsec.
9262 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
9264 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
9266 (Incremental_inputs::report_archive): Save mtime; style fix.
9267 (Incremental_inputs::report_obejct): Save mtime; style fix.
9268 (Incremental_inputs::report_script): Save mtime; style fix.
9269 (Incremental_inputs::finalize_inputs): Style fix.
9270 (Incremental_inputs::finalize): Style fix.
9271 (Incremental_inputs::create_input_section_data): Store inputs
9273 * incremental.h (Incremental_inputs::report_script): Add mtime
9275 (Incremental_inputs::Input_info::Input_info): Intialize only one
9277 (Incremental_inputs::Input_info::archive): Move to nameless
9279 (Incremental_inputs::Input_info::obejct): Move to nameless union.
9280 (Incremental_inputs::Input_info::script): Move to nameless union.
9281 (Incremental_inputs::mtime): New field.
9282 * script.cc (read_input_script): Pass file mtime to
9284 * script.h (Script_info::inputs): Style fix.
9286 2009-07-01 Ian Lance Taylor <ian@airs.com>
9288 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
9291 2009-06-24 Ian Lance Taylor <iant@google.com>
9294 * layout.cc (Layout::choose_output_section): If we find an
9295 existing section, update the flags.
9296 (Layout::create_notes): New function, broken out of
9298 (Layout::finalize): Don't create note sections.
9299 (Layout::create_note): Don't crash if linker script discards
9301 (Layout::create_gold_note): Likewise.
9302 (Layout::create_build_id): Likewise. Don't set
9303 after_input_sections on the section.
9304 (Layout::create_executable_stack_info): Remove target parameter.
9306 * layout.h (class Layout): Declare create_notes. Update
9307 declaration of create_executable_stack_info.
9308 * gold.cc (queue_middle_tasks): Call create_notes.
9309 * output.cc (Output_section::update_flags_for_input_section): Move
9310 here from output.h. If SHF_ALLOC flag is newly set, mark address
9312 * output.h (Output_data::mark_address_invalid): New function.
9313 (class Output_section): Only declare, not define,
9314 update_flags_for_input_section. Remove set_flags.
9316 2009-06-24 Ian Lance Taylor <iant@google.com>
9318 * script-sections.cc (Output_section_definition::
9319 set_section_addresses): Rename shadowing local load_address to
9322 2009-06-24 Ian Lance Taylor <iant@google.com>
9325 * reloc.cc (relocate_sections): Skip empty relocation sections.
9327 2009-06-23 Ian Lance Taylor <iant@google.com>
9330 * layout.cc (Layout::create_note): Use choose_output_section
9331 rather than make_output_section.
9333 2009-06-23 Ian Lance Taylor <iant@google.com>
9336 * options.cc (General_options::parse_V): Set printed_version_.
9337 (General_options::General_options): Initialize printed_version_.
9338 * options.h (class General_options): Add printed_version_ field.
9339 * gold.cc (queue_initial_tasks): If there are no input files,
9340 don't give a fatal error if we printed the version information.
9341 (queue_middle_tasks): If using -r with a shared object, give a
9342 fatal error rather than an ordinary error.
9344 2009-06-23 Ian Lance Taylor <iant@google.com>
9347 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
9348 (Layout::make_output_section): Set have_stabstr_section_ if we see
9349 a .stab*str section.
9350 (Layout::finalize): Call link_stabs_sections.
9351 (Layout::link_stabs_sections): New file.
9352 * layout.h (class Layout): Add have_stabstr_section_ field.
9353 Declare link_stabs_sections.
9355 2009-06-23 Doug Kwan <dougkwan@google.com>
9357 * Makefile.am (libgold_a_LIBADD): New.
9358 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
9359 * Makefile.in: Regenerate.
9360 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
9361 * configure: Regenerate.
9362 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
9363 * fileread.cc: Include sys/state.h
9364 * gold.h: Declare memmem and strndup if found missing.
9365 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
9367 2009-06-23 Ian Lance Taylor <iant@google.com>
9369 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
9370 * configure: Rebuild.
9372 2009-06-23 Ian Lance Taylor <iant@google.com>
9375 * object.cc (Object::section_contents): Don't try to get a view if
9376 the section has length zero.
9377 (Object::handle_gnu_warning_section): If the section is empty, use
9378 the name of the section as the warning.
9380 2009-06-23 Ian Lance Taylor <iant@google.com>
9383 * stringpool.h (class Stringpool_template): Add optimize_ field.
9384 (Stringpool_template::set_optimize): New function.
9385 * stringpool.cc (Stringpool_template::Stringpool_template):
9386 Initialize optimize_ field.
9387 (Stringpool_template::set_string_offsets): Test local optimize
9388 fild rather than parameter.
9389 * layout.cc (Layout::Layout): Call set_optimize on the section
9392 2009-06-22 Ian Lance Taylor <iant@google.com>
9395 * yyscript.y: Parse TARGET.
9396 * script.cc (script_set_target): New function.
9397 * script-c.h (script_set_target): Declare.
9398 * options.cc (General_options::string_to_object_format): Rename
9399 from string_to_object_format in anonymous namespace. Change
9401 * options.h (class General_options): Declare
9402 string_to_object_format.
9404 2009-06-22 Ian Lance Taylor <iant@google.com>
9406 * script-sections.cc (Script_sections::create_segments): Don't put
9407 program headers in a PT_LOAD segment if -n or -N.
9409 2009-06-22 Ian Lance Taylor <iant@google.com>
9412 * options.h (class General_options): Add -z lazy and -z now. Sort
9413 -z options into alphabetical order.
9414 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
9416 2009-06-21 Ian Lance Taylor <iant@google.com>
9418 * layout.cc (Layout::make_output_section): Call
9419 Target::new_output_section.
9420 (Layout::attach_allocated_section_to_segment): Put large section
9421 sections in a separate load segment with the large segment flag
9423 (Layout::segment_precedes): Sort large data segments after other
9425 (align_file_offset): New static function.
9426 (Layout::set_segment_offsets): Use align_file_offset.
9427 * output.h (class Output_section): Add is_small_section_ and
9428 is_large_section_ fields.
9429 (Output_section::is_small_section): New function.
9430 (Output_section::set_is_small_section): New function.
9431 (Output_section::is_large_section): New function.
9432 (Output_section::set_is_large_section): New function.
9433 (Output_section::is_large_data_section): New function.
9434 (class Output_segment): Add is_large_data_segment_ field.
9435 (Output_segment::is_large_data_segment): New function.
9436 (Output_segment::set_is_large_data_segment): New function.
9437 * output.cc (Output_section::Output_section): Initialize new
9439 (Output_segment::Output_segment): Likewise.
9440 (Output_segment::add_output_section): Add assertion that large
9441 data sections always go in large data segments. Force small data
9442 sections to the end of the list of data sections. Force small BSS
9443 sections to the start of the list of BSS sections. For large BSS
9444 sections to the end of the list of BSS sections.
9445 * symtab.h (class Symbol): Declare is_common_shndx.
9446 (Symbol::is_defined): Check Symbol::is_common_shndx.
9447 (Symbol::is_common): Likewise.
9448 (class Symbol_table): Define enum Commons_section_type. Update
9449 declarations. Add small_commons_ and large_commons_ fields.
9450 * symtab.cc (Symbol::is_common_shndx): New function.
9451 (Symbol_table::Symbol_table): Initialize new fields.
9452 (Symbol_table::add_from_object): Put small and large common
9453 symbols in the right list.
9454 (Symbol_table::sized_finalized_symbol): Check
9455 Symbol::is_common_shndx.
9456 (Symbol_table::sized_write_globals): Likewise.
9457 * common.cc (Symbol_table::do_allocate_commons): Allocate new
9458 common symbol lists. Don't call do_allocate_commons_list if the
9460 (Symbol_table::do_allocate_commons_list): Remove is_tls
9461 parameter. Add comons_section_type parameter. Change all
9462 callers. Handle small and large common symbols.
9463 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
9464 Symbol::is_common_shndx.
9465 * resolve.cc (symbol_to_bits): Likewise.
9466 * target.h (Target::small_common_shndx): New function.
9467 (Target::small_common_section_flags): New function.
9468 (Target::large_common_shndx): New function.
9469 (Target::large_common_section_flags): New function.
9470 (Target::new_output_section): New function.
9471 (Target::Target_info): Add small_common_shndx, large_common_shndx,
9472 small_common_section_flags, and large_common_section_flags
9474 (Target::do_new_output_section): New virtual function.
9475 * arm.cc (Target_arm::arm_info): Initialize new fields.
9476 * i386.cc (Target_i386::i386_info): Likewise.
9477 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
9479 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
9480 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9481 (Target_x86_64::do_new_output_section): New function.
9482 * configure.ac: Define conditional MCMODEL_MEDIUM.
9483 * testsuite/Makefile.am (check_PROGRAMS): Add large.
9484 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
9485 (large_LDFLAGS): Define.
9486 * testsuite/large.c: New file.
9487 * testsuite/testfile.cc (Target_test::test_target_info):
9488 Initialize new fields.
9489 * configure, testsuite/Makefile.in: Rebuild.
9491 2009-06-05 Doug Kwan <dougkwan@google.com>
9493 * Makefile.am (CCFILES): Add target.cc.
9494 * Makefile.in: Regenerate.
9495 * i386.cc (class Target_i386): Define new virtual method to
9496 override do_is_local_label_name in parent.
9497 * object.cc (Sized_relobj::do_count_local_symbols): Discard
9498 local symbols if --discard-locals or -X is given.
9499 * options.h (class General_options): Declare new options
9500 '--discard-locals' and '-X' for discarding locals.
9501 * target.h (class Target): Define new methods is_local_label_name.
9502 Declare new virtual method do_is_local_label_name.
9503 * target.cc: New file.
9504 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
9505 (check_SCRIPTS): Add discard_locals_test.sh.
9506 (check_DATA): Add discard_local_tests.syms.
9507 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
9508 (discard_local_tests.syms, discard_locals_test.o): New make rules.
9509 * testsuite/Makefile.in: Regenerate.
9510 * testsuite/discard_locals_test.c: New file.
9511 * testsuite/discard_locals_test.sh: Same.
9513 2009-06-05 Doug Kwan <dougkwan@google.com>
9515 * object.cc (Sized_relobj::Sized_relobj): Initialize
9516 discarded_eh_frame_shndx_ to -1U.
9517 (Sized_relobj::do_layout): Record index of a discard .eh_frame
9519 (Sized_relobj::do_count_local_symbols): Skip local symbols in
9520 a discarded .eh_frame section.
9521 (Sized_relobj::do_finalize_local_symbols): Ditto.
9522 * object.h (class Sized_relobj): Declare new member
9523 discarded_eh_frame_shndx_.
9524 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
9525 (local_labels_test.o, local_labels_test): New rules.
9526 * testsuite/Makefile.in: Regenerate.
9528 2009-06-04 Doug Kwan <dougkwan@google.com>
9530 * layout.cc (Layout::section_name_mapping): Add mapping for
9531 special ARM sections.
9533 2009-06-03 Doug Kwan <dougkwan@google.com>
9535 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
9536 (utils::has_overflow): Same.
9538 2009-06-03 Ian Lance Taylor <iant@google.com>
9540 * layout.cc (Layout::section_name_mapping): New array, replacing
9541 Layout::linkonce_mapping.
9542 (Layout::section_name_mapping_count): New variable, replacing
9543 Layout::linkonce_mapping_count.
9544 (Layout::linkonce_output_name): Remove.
9545 (Layout::output_section_name): Rewrite.
9546 * layout.h (class Layout): Rename Linkonce_mapping to
9547 Section_name_mapping, linkonce_mapping to section_name_mapping,
9548 linkonce_mapping_count to section_name_mapping_count. Don't
9549 declare linkonce_output_name.
9551 2009-06-03 Doug Kwan <dougkwan@google.com>
9553 * gold/arm.cc (namespace utils): New.
9554 (Target_arm::reloc_is_non_pic): Define new method.
9555 (class Arm_relocate_functions): New.
9556 (Target_arm::Relocate::relocate): Handle relocation types used by
9559 2009-06-03 Ian Lance Taylor <iant@google.com>
9561 * arm.cc (Target_arm::scan::global): Use || instead of |.
9563 2009-06-02 Doug Kwan <dougkwan@google.com>
9565 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
9566 issued_non_pic_error_.
9567 (class Target_arm::Scan): Declare new method check_non_pic.
9568 Define new method symbol_needs_plt_entry.
9569 Declare new data member issued_non_pic_error_.
9570 (class Target_arm::Relocate): Declare new method
9571 should_apply_static_reloc.
9572 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9573 (Target_arm::Scan::check_non_pic): Define new method.
9574 (Target_arm::Scan::local): Handle a small subset of reloc types used
9576 (Target_arm::Scan::local): Same.
9577 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9579 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
9581 * incremental.cc (Incremental_inputs::report_command_line): Filter
9582 out --incremental-* options.
9584 2009-05-29 Doug Kwan <dougkwan@google.com>
9586 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9588 (class Target_arm): Update comment.
9589 (Target_arm::Target_arm): Initialize new data members GOT_,
9590 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
9591 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
9592 and Target_arm::rel_dyn_section.
9593 Declare new_enum Target_arm::Got_type.
9594 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
9596 Update commments for member do_dynsym_value.
9597 (Target_arm::got_size, Target_arm::plt_section,
9598 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
9599 new methods inside class defintion.
9600 (Target_arm::got_section): Define new method.
9601 (Target_arm::rel_dyn_section): Same.
9602 (Output_data_plt_arm): New template class.
9603 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
9604 (Output_data_plt_arm:do_adjust_output_section): Define new method.
9605 (Output_data_plt_arm::add_entry): Same.
9606 (Output_data_plt_arm::first_plt_entry): Define new
9607 static data member for PLT instruction template.
9608 (Output_data_plt_arm::plt_entry): Same.
9609 (Output_data_plt_arm::do_write): Define new method.
9610 (Target_arm::make_plt_entry): Same.
9611 (Target_arm::do_finalize_sections): Same.
9612 (Target_arm::do_dynsym_value): Same.
9614 2009-05-28 Doug Kwan <dougkwan@google.com>
9616 * Makefile.am (TARGETSOURCES): Add arm.cc.
9617 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
9618 * Makefile.in: Regenerate.
9620 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
9622 2009-05-26 Doug Kwan <dougkwan@google.com>
9624 * options.cc (General_options::parse_exclude_libs). Fix a comment.
9625 (General_options::check_excluded_libs): Strip off directories in
9626 archive name before matching like GNU ld does.
9627 * testsuite/Makefile.am (MOSTLYCLEANFILES,
9628 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
9629 (exclude_libs_test_LDFLAGS): Add linker option
9630 -Wl,--exclude-libs,libexclude_libs_test_3
9631 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
9632 an explicit archive without using -l.
9633 (alt/libexclude_libs_test_3.a): New make rule.
9634 * testsuite/Makefile.in: Regenerate.
9635 * testsuite/exclude_libs_test.c : Declare lib3_default().
9637 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
9638 * exclude_libs_test_3.c: New file.
9640 2009-05-26 Nick Clifton <nickc@redhat.com>
9642 * po/id.po: New Indonesian translation.
9643 * po/gold.pot: Updated template file.
9645 2009-05-22 Sriraman Tallam <tmsriram@google.com>
9647 * testsuite/Makefile.am: Add -ffunction-sections to compile
9648 gc_comdat_test files. Add -Wl,--gc-sections to build
9650 * testsuite/Makefile.in: Regenerate.
9651 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
9653 2009-05-21 Sriraman Tallam <tmsriram@google.com>
9655 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
9656 kept comdat section was garbage collected.
9657 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
9658 * testsuite/Makefile.in: Regenerate.
9659 * testsuite/gc_comdat_test.sh: New file.
9660 * testsuite/gc_comdat_test_1.cc: New file.
9661 * testsuite/gc_comdat_test_2.cc: New file.
9663 2009-05-19 Doug Kwan <dougkwan@google.com>
9665 * archive.cc (Archive::Archive): Move constructor from archive.h
9666 to here. Initialize no_export_.
9667 (Archive::get_elf_object_for_member): Set no_export flag of object.
9668 * archive.h (Archive::Archive): Move constructor body to
9670 (Archive::no_export): New method.
9671 (Archive::no_export_): New field.
9672 * object.h (Object::Object): Initialize no_export_ to false.
9673 (Object::no_export, Object::set_no_export): New methods.
9674 (Object::no_export_): New field.
9675 * options.cc (General_options::parse_exclude_libs): New method.
9676 (General_options::check_excluded_libs) Same.
9677 * options.h (exclude_libs): New option.
9678 (General_options::check_excluded_libs): New method declaration.
9679 (General_options::excluded_libs_): New field.
9680 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
9681 default or protected visibility if an object has no-export flag set.
9682 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
9683 (check_SCRIPTS): Add exclude_libs_test.sh.
9684 (check_DATA): Add exclude_libs_test.syms.
9685 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
9686 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
9687 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
9688 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
9689 (exclude_libs_test.syms, libexclude_libs_test_1.a,
9690 libexclude_libs_test_2.a): New rules.
9691 * testsuite/Makefile.in: Regenerate.
9692 * testsuite/exclude_libs_test.c: New file.
9693 * testsuite/exclude_libs_test.sh: Ditto.
9694 * testsuite/exclude_libs_test_1.c: Ditto.
9695 * testsuite/exclude_libs_test_2.c: Ditto.
9697 2009-05-15 Ian Lance Taylor <iant@google.com>
9699 * configure.ac: Check for declarations for cases where libiberty.h
9700 checks HAVE_DECL_xxx.
9701 * configure, config.in: Rebuild.
9703 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
9705 * gold.h (Incremental_argument_list): Remove (invalid) forward
9707 * incremental.cc (Incremental_inputs::report_achive): New method.
9708 (Incremental_inputs::report_object): New method.
9709 (Incremental_inputs::report_script): New method.
9710 (Incremental_inputs::finalize_inputs): New method.
9711 (Incremental_inputs::finalize): Call finalize_inputs().
9712 (Incremental_inputs::sized_create_incremental_inputs_section_data):
9713 Create inputs entries.
9714 * incremental.h (Incremental_input_type): New enum.
9715 (Incremental_inputs::Incremental_input): Initialize new fields.
9716 (Incremental_inputs::report_inputs): New method.
9717 (Incremental_inputs::report_achive): New method.
9718 (Incremental_inputs::report_object): New method.
9719 (Incremental_inputs::report_script): New method.
9720 (Incremental_inputs::finalize_inputs): New method.
9721 (Incremental_inputs::Input_info): New struct.
9722 (Incremental_inputs::Input_info_map): New typedef.
9723 (Incremental_inputs::lock_): New field.
9724 (Incremental_inputs::Inputs_): New field.
9725 (Incremental_inputs::Inputs_map): New field.
9726 * main.cc (main): Call Incremental_input::report_inputs.
9727 * options.h (Input_argument_list): Typedef moved from
9729 (Input_file_group::Files): Remove, use ::Input_argument_list.
9730 (Input_file_group::Input_argument_list): Remove, use
9731 ::Input_argument_list.
9732 * plugin.cc (Plugin_manager::add_input_file): Add error in
9734 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
9736 * script.cc (read_input_script): Call
9737 Incremental_input::report_script.
9738 * script.h (Script_info): New class.
9740 2009-04-27 Ian Lance Taylor <iant@google.com>
9742 * x86_64.cc (do_adjust_output_section): Set entsize to
9745 2009-04-23 Elliott Hughes <enh@google.com>
9747 * output.cc (Output_file::close): After short writes, continue
9748 writing from the correct offset in the buffer being written.
9750 2009-04-23 Chris Demetriou <cgd@google.com>
9752 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
9753 * configure: Regenerate.
9754 * config.in: Regenerate.
9755 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
9756 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
9758 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
9760 * incremental.cc (Incremental_inputs_header_data): Renamed from
9761 Incremental_input_header_data.
9762 (Incremental_inputs_header_data::data_size): New field.
9763 (Incremental_inputs_header_data::put_input_file_count): Renamed
9764 from input_file_count.
9765 (Incremental_inputs_header_data::put_command_line_offset): Renamed
9766 from command_line_offset.
9767 (Incremental_inputs_header_data::put_reserved): Renamed from
9769 (Incremental_inputs_entry_data): Renamed from
9770 Incremental_input_entry_data.
9771 (Incremental_inputs_entry_data::data_size): New field.
9772 (Incremental_inputs::report_command_line): New method.
9773 (Incremental_inputs::finalize): New method.
9774 (Incremental_inputs::create_incremental_inputs_data): New method.
9775 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
9776 * incremental.h: New file.
9777 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
9778 (Layout::finalize): Create incremental inputs section in
9780 (Layout::create_incremental_info_sections): New method.
9781 * layout.h (Layout::incremental_inputs): New method.
9782 (Layout::create_incremental_info_sections): New method.
9783 (Layout::incremental_inputs_): New field.
9784 * main.cc (main): Notify Incremental_input of the command line.
9786 2009-04-01 Ian Lance Taylor <iant@google.com>
9787 Mikolaj Zalewski <mikolajz@google.com>
9789 * gold.h (reserve_unordered_map): Define, three versions, one for
9790 each version of Unordered_map.
9791 * layout.cc (Layout::Layout): Remove options parameter. Add
9792 number_of_input_files parameter. Don't initialize options_.
9793 Initialize number_of_input_files_ and resized_signatures_. Move
9794 sections_are_attached_.
9795 (Layout::layout_group): Reserve space for group_signatures_.
9796 (Layout::find_or_add_kept_section): Change name parameter to be a
9797 reference. Resize signatures_ map when it gets large enough.
9798 (Layout::layout_eh_frame): Use parameters->options() instead of
9800 (Layout::make_output_section): Likewise.
9801 (Layout::attach_allocated_section_to_segment): Likewise.
9802 (Layout::finalize, Layout::create_executable_stack): Likewise.
9803 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
9804 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
9805 * layout.h (class Layout): Update declarations. Remove options_
9806 field. Add number_of_input_files_ and resized_signatures_
9807 fields. Move sections_are_attached_ field.
9808 * main.cc (main): Pass number of input files to Layout
9809 constructor. Don't pass options.
9811 2009-03-30 Ian Lance Taylor <iant@google.com>
9813 * ffsll.c (ffsll): Correct implementation.
9815 2009-03-27 Ian Lance Taylor <iant@google.com>
9817 * ffsll.c: New file.
9818 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
9819 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
9820 * ftruncate.c (ftruncate): Declare before definition.
9821 * mremap.c (mremap): Likewise.
9822 * pread.c (pread): Likewise.
9823 * configure, Makefile.in, config.in: Rebuild.
9825 * mremap.c: New file.
9826 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
9827 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
9828 (mremap): Declare if HAVE_MREMAP is not defined.
9829 * configure, Makefile.in, config.in: Rebuild.
9831 2009-03-27 Cary Coutant <ccoutant@google.com>
9833 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
9834 position independent.
9835 * sparc.cc (Target_sparc::check_non_pic): Likewise.
9836 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
9838 2009-03-24 Cary Coutant <ccoutant@google.com>
9840 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
9842 (needs_dynamic_reloc): Likewise.
9844 2009-03-24 Ian Lance Taylor <iant@google.com>
9846 * yyscript.y (file_cmd): Recognize EXTERN.
9847 (extern_name_list, extern_name_list_body): New nonterminals.
9848 * script.cc (script_add_extern): Define.
9849 * script-c.h (script_add_extern): Declare.
9851 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
9853 * object.cc (is_elf_object): Define.
9854 * object.h (is_elf_object): Declare.
9855 * archive.cc (Archive::get_elf_object_for_member): Call
9857 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
9859 2009-03-24 Elliott Hughes <enh@google.com>
9861 * output.cc (Output_file::map_anonymous): Define.
9862 (Output_file::map): Use map_anonymous. If the regular mmap fails,
9863 try an anonymous one. Report the size if the mmap fails.
9864 * output.h (class Output_file): Declare map_anonymous.
9866 2009-03-24 Ian Lance Taylor <iant@google.com>
9868 * target-select.cc (instantiate_target): Don't acquire the lock if
9869 the instantiated_target_ field has already been set.
9871 2009-03-23 Ian Lance Taylor <iant@google.com>
9873 * gold-threads.h (class Initialize_lock): Define.
9874 * gold-threads.cc (class Initialize_lock_once): Define.
9875 (initialize_lock_control): New static variable.
9876 (initialize_lock_pointer): New static variable.
9877 (initialize_lock_once): New static function.
9878 (Initialize_lock::Initialize_lock): Define.
9879 (Initialize_lock::initialize): Define.
9880 * target-select.h: Include "gold-threads.h".
9881 (class Target_selector): Add lock_ and initialize_lock_ fields.
9882 Don't define instantiate_target, just declare it.
9883 * target-select.cc (Target_selector::Target_selector): Initialize
9885 (Target_selector::instantiate_target): Define.
9886 * descriptors.h: Include "gold-threads.h".
9887 (class Descriptors): Add initialize_lock_ field.
9888 * descriptors.cc (Descriptors::Descriptors): Initialize new
9890 (Descriptors::open): Use initialize_lock_ field
9891 * errors.h (class Errors): Add initialize_lock_ field.
9892 * errors.cc (Errors::Errors): Initialize new field.
9893 (Errors::initialize_lock): Use initialize_lock_ field.
9894 * powerpc.cc (class Target_selector_powerpc): Remove
9895 instantiated_target_ field. In do_recognize call
9896 instantiate_target rather than do_instantiate_target. In
9897 do_instantiate_target just allocate a new target.
9898 * sparc.cc (class Target_selector_sparc): Likewise.
9900 * freebsd.h: New file.
9901 * i386.cc: Include "freebsd.h".
9902 (Target_i386): Derive from Target_freebsd rather than
9904 (Target_selector_i386): Derive from Target_selector_freebsd rather
9905 than Target_selector.
9906 * x86_64.cc: Include "freebsd.h".
9907 (Target_x86_64): Derive from Target_freebsd rather than
9909 (Target_selector_x86_64): Derive from Target_selector_freebsd
9910 rather than Target_selector.
9911 * target.h (class Target): Add adjust_elf_header and
9912 do_adjust_elf_header.
9913 * output.cc (Output_file_header:: do_sized_write): Call target
9914 adjust_elf_header routine.
9915 * configure.tgt: Set targ_osabi.
9916 * configure.ac: Define GOLD_DEFAULT_OSABI.
9917 * parameters.cc (Parameters::default_target): Pass
9918 GOLD_DEFAULT_OSABI to select_target.
9919 * target-select.h (class Target_selector): Make instantiate_target
9920 protected rather than private.
9921 * Makefile.am (HFILES): Add freebsd.h.
9922 * configure, Makefile.in, config.in: Rebuild.
9924 * merge.cc (do_add_input_section): Correct pend value. Change
9925 message about last entry not being null terminated from error to
9928 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
9930 * incremental.cc: New file.
9931 * Makefile.am (CCFILES): Add incremental.cc.
9932 * Makefile.in: Rebuild.
9934 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
9936 * layout.cc (Layout::output_section_name): Preserve names
9937 of '.note.' sections.
9939 2009-03-19 Ian Lance Taylor <iant@google.com>
9941 * descriptors.cc (Descriptors::open): Check that the options are
9942 valid before using them.
9944 2009-03-18 Ian Lance Taylor <iant@google.com>
9946 * script-sections.h: Include <list>.
9947 (class Script_sections): Change Sections_elements from std::vector
9948 to std::list. Typedef public Elements_iterator. Add
9949 orphan_section_placement_, data_segment_align_start_, and
9950 saw_data_segment_align_ fields. Remove data_segment_align_index_
9952 * script-sections.cc (class Orphan_section_placement): New class.
9953 (class Sections_element): Add virtual functions is_relro and
9954 orphan_section_init. Remove virtual function place_orphan_here.
9955 (class Output_section_definition): Add is_relro and
9956 orphan_section_init. Remove place_orphan_here.
9957 (class Orphan_output_section): Likewise.
9958 (Script_sections::Script_sections): Update for field changes.
9959 (Script_sections::data_segment_align): Set saw_data_segment_align_
9960 and data_segment_align_start_, not data_segment_align_index.
9961 (Script_sections::data_segment_relro_end): Check
9962 saw_data_segment_align_. Use data_segment_align_start_ rather
9963 than data_segment_align_index_.
9964 (Script_sections::place_orphan): Rewrite to use
9965 Orphan_section_placement.
9967 2009-03-17 Ian Lance Taylor <iant@google.com>
9969 * archive.cc (Archive::add_symbols): Check for a version attached
9970 to the symbol name in the archive map.
9971 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
9972 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
9973 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
9974 (ver_test_11.a): New target.
9975 * testsuite/Makefile.in: Rebuild.
9977 * configure.ac: Check for chsize and posix_fallocate. Replace
9979 * ftruncate.c: New file, from gnulib.
9980 * output.cc (posix_fallocate): Define dummy version if not
9981 HAVE_POSIX_FALLOCATE.
9982 (Output_file::map): Call posix_fallocate rather than lseek and
9984 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
9985 * configure, Makefile.in, config.in: Rebuild.
9987 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
9989 * layout.h (Layout::create_note): Add section_name parameter.
9990 * layout.cc (Layout::create_note): Likewise.
9991 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
9993 2009-03-17 Ian Lance Taylor <iant@google.com>
9995 * descriptors.cc: Include "options.h".
9996 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
9997 (Descriptors::open): Always use O_CLOEXEC when opening a new
9998 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
9999 then set FD_CLOEXEC.
10001 * sparc.cc (class Target_sparc): Add has_got_section.
10002 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
10003 make sure we have a GOT section.
10005 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
10006 (Target_sparc::Scan::local): Likewise.
10007 (Target_sparc::Scan::global): Likewise.
10008 (Target_sparc::Relocate::relocate): Likewise.
10009 (Target_sparc::Relocate::relocate_tls): Likewise.
10011 * symtab.cc (Symbol_table::define_default_version): New function,
10012 broken out of add_from_object.
10013 (Symbol_table::add_from_object): Call define_default_version.
10014 (Symbol_table::define_special_symbol): Add resolve_oldsym
10015 parameter. Change all callers. If the version for a symbol comes
10016 from a version script, resolve it with the symbol with the same
10017 name with no version. Also add the symbol without a version if
10019 (do_define_in_output_data): If resolving with oldsym, don't delete
10021 (do_define_in_output_segment): Likewise.
10022 (do_define_as_constant): Likewise.
10023 * symtab.h (class Symbol_table): Update declarations.
10025 2009-03-13 Ian Lance Taylor <iant@google.com>
10027 * readsyms.cc (Read_symbols::incompatible_warning): New function.
10028 (Read_symbols::requeue): New function.
10029 (Read_symbols::do_read_symbols): If make_elf_object fails because
10030 the target type is not configured, and the file was searched for,
10031 issue a warning and retry with the next directory.
10032 (Add_symbols::run): If the file has an incompatible format, and
10033 it was searched for, requeue the Read_symbols task. On error,
10034 release the object.
10035 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
10036 dirindex parameter to constructor. Change all callers. Declare
10037 incompatible_warning and requeue.
10038 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
10039 input_argument_ and input_group_ fields. Add them to
10040 constructor. Change all callers.
10041 (class Read_script): Add dirindex_ field. Add it to constructor.
10042 Change all callers.
10043 * archive.cc (Archive::setup): Remove input_objects parameter.
10044 Change all callers.
10045 (Archive::get_file_and_offset): Likewise.
10046 (Archive::read_all_symbols): Likewise.
10047 (Archive::read_symbols): Likewise.
10048 (Archive::get_elf_object_for_member): Remove input_objects
10049 parameter. Add punconfigured parameter. Change all callers.
10050 (Archive::add_symbols): Change return type to bool. Check return
10051 value of include_member.
10052 (Archive::include_all_members): Likewise.
10053 (Archive::include_member): Change return type to bool. Return
10054 false if first included object has incompatible target. Set
10055 included_member_ field.
10056 (Add_archive_symbols::run): If add_symbols returns false, requeue
10058 * archive.h (class Archive): Add included_member_ field.
10059 Initialize it in constructor. Add input_file and searched_for
10060 methods. Update declarations.
10061 (class Add_archive_symbols): Add dirpath_, dirindex_, and
10062 input_argument_ fields. Add them to constructor. Change all
10064 * script.cc: Include "target-select.h".
10065 (class Parser_closure): Add skip_on_incompatible_target_ and
10066 found_incompatible_target_ fields. Add
10067 skip_on_incompatible_target parameter to constructor. Change all
10068 callers. Add methods skip_on_incompatible_target,
10069 clear_skip_on_incompatible_target, found_incompatible_target, and
10070 set_found_incompatible_target.
10071 (read_input_script): Add dirindex parameter. Change all callers.
10072 If parser finds an incompatible target, requeue Read_symbols
10074 (script_set_symbol): Clear skip_on_incompatible_target in
10076 (script_add_assertion, script_parse_option): Likewise.
10077 (script_start_sections, script_add_phdr): Likewise.
10078 (script_check_output_format): New function.
10079 * script.h (read_input_script): Update declaration.
10080 * script-c.h (script_check_output_format): Declare.
10081 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
10082 (ignore_cmd): Remove OUTPUT_FORMAT.
10083 * fileread.cc (Input_file::Input_file): Add explicit this.
10084 (Input_file::will_search_for): New function.
10085 (Input_file::open): Add pindex parameter. Change all callers.
10086 * fileread.h (class Input_file): Add input_file_argument method.
10087 Declare will_search_for. Update declarations.
10088 * object.cc (make_elf_object): Add punconfigured parameter.
10089 Change all callers.
10090 * object.h (class Object): Make input_file public. Add
10091 searched_for method.
10092 (make_elf_object): Update declaration.
10093 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
10095 * dirsearch.h (class Dirsearch): Update declaration.
10096 * options.h (class General_options): Add --warn-search-mismatch.
10097 * parameters.cc (Parameters::is_compatible_target): New function.
10098 * parameters.h (class Parameters): Declare is_compatible_target.
10099 * workqueue.cc (Workqueue::add_blocker): New function.
10100 * workqueue.h (class Workqueue): Declare add_blocker.
10102 * fileread.cc (Input_file::open): Remove options parameter.
10103 Change all callers.
10104 (Input_file::open_binary): Likewise.
10105 * script.cc (read_input_script): Likewise.
10106 * readsyms.h (class Read_symbols): Remove options_ field. Remove
10107 options parameter from constructor. Change all callers.
10108 (class Read_script): Likewise.
10109 * fileread.h (class Input_file): Update declarations.
10110 * script.h (read_input_script): Update declaration.
10112 2009-03-10 Nick Clifton <nickc@redhat.com>
10114 * po/es.po: New Spanish translation.
10116 2009-03-06 Cary Coutant <ccoutant@google.com>
10118 * options.cc (parse_short_option): Keep dash_z from registering itself.
10120 2009-03-03 Ian Lance Taylor <iant@google.com>
10123 * target-reloc.h (relocate_section): Pass output_section to
10125 * i386.cc (Target_i386::should_apply_static_reloc): Add
10126 output_section parameter. Change all callers.
10127 (Target_i386::Relocate::relocate): Add output_section parameter.
10128 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10129 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
10130 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
10131 * testsuite/two_file_shared.sh: New script.
10132 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
10133 (check_DATA): Add two_file_shared.dbg.
10134 (two_file_shared.dbg): New target.
10135 * testsuite/Makefile.in: Rebuild.
10137 2009-03-01 Ian Lance Taylor <iant@google.com>
10139 * configure.ac: Check for byteswap.h.
10140 * configure: Rebuild.
10141 * config.in: Rebuild.
10143 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
10145 * layout.cc (Layout::find_or_add_kept_section): New function.
10146 (Layout::add_comdat): Removed.
10147 * layout.h (struct Kept_section): Move out of class Layout.
10148 Remove trailing underscores from field names. Add group_sections
10149 field. Rename group_ field to is_group. Change all uses.
10150 (class Layout): Declare find_or_add_kept_section, not add_comdat.
10151 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
10152 comdat_groups_ field.
10153 (Sized_relobj::include_section_group): Use
10154 find_or_add_kept_section and Kept_section::group_sections.
10155 (Sized_relobj::include_linkonce_section): Likewise.
10156 * object.cc (class Sized_relobj): Don't define Comdat_group or
10157 Comdat_group_table. Remove find_comdat_group and
10158 add_comdat_group. Remove comdat_groups_ field.
10159 * plugin.cc (include_comdat_group): Use
10160 Layout::find_or_add_kept_section.
10162 2009-02-28 Ian Lance Taylor <iant@google.com>
10164 * README: --gc-sections and map files are now supported. Document
10165 some build requirements.
10168 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
10169 relocatable link set the value of the section symbol to zero.
10170 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
10171 relocatable link don't include the section address in the local
10174 2009-02-27 Ian Lance Taylor <iant@google.com>
10177 * options.h (class Search_directory): Add is_system_directory.
10178 (class General_options): Declare is_in_system_directory.
10179 * options.cc (get_relative_sysroot): Make static.
10180 (get_default_sysroot): Make static.
10181 (General_optoins::is_in_system_directory): New function.
10182 * fileread.cc (Input_file::is_in_system_directory): New function.
10183 * fileread.h (class Input_file): Declare is_in_system_directory.
10184 * object.h (class Object): Add is_in_system_directory.
10185 (class Input_objects): Remove system_library_directory_ field.
10186 * object.cc (Input_objects::add_object): Don't set
10187 system_library_directory_.
10188 (input_objects::found_in_system_library_directory): Remove.
10189 * symtab.cc (Symbol_table::write_globals): Remove input_objects
10190 parameter. Change all callers.
10191 (Symbol_table::sized_write_globals): Likewise.
10192 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
10193 Call Object::is_in_system_directory.
10194 * symtab.h (class Symbol_table): Update declarations.
10197 * descriptors.h (Open_descriptor): Add is_on_stack field.
10198 * descriptors.cc (Descriptors::open): If the descriptor is on the
10199 top of the stack, remove it. Initialize is_on_stack field.
10200 (Descriptors::release): Only add pod to stack if it is not on the
10202 (Descriptors::close_some_descriptor): Clear stack_next and
10203 is_on_stack fields.
10206 * output.cc (Output_section::find_starting_output_address): Rename
10207 from starting_output_address; add PADDR parameter; change return
10209 * output.h (class Output_section): Declare
10210 find_starting_output_address instead of starting_output_address.
10211 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
10212 section symbol for which we can't find a merge section.
10215 * symtab.cc (Symbol_table::add_from_object): If the visibility is
10216 hidden or internal, force the symbol to be local.
10217 * resolve.cc (Symbol::override_visibility): Define.
10218 (Symbol::override_base): Use override_visibility.
10219 (Symbol_table::resolve): Likewise.
10220 (Symbol::override_base_with_special): Likewise.
10221 (Symbol_table::override_with_special): If the visibility is hidden
10222 or internal, force the symbol to be local.
10223 * symtab.h (class Symbol): Add set_visibility and
10224 override_visibility.
10225 * testsuite/ver_test_1.sh: New file.
10226 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
10227 (check_DATA): Add ver_test_1.syms.
10228 (ver_test_1.syms): New target.
10229 * testsuite/Makefile.in: Rebuild.
10231 2009-02-25 Cary Coutant <ccoutant@google.com>
10233 * layout.cc (Layout::choose_output_section): Don't rename sections
10234 when using a linker script that has a SECTIONS clause.
10235 * Makefile.in: Regenerate.
10237 * testsuite/Makefile.am (script_test_5.sh): New test case.
10238 * testsuite/Makefile.in: Regenerate.
10239 * testsuite/script_test_5.cc: New file.
10240 * testsuite/script_test_5.sh: New file.
10241 * testsuite/script_test_5.t: New file.
10243 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
10245 * archive.cc (Archive::include_member): Update calls to add_symbols.
10246 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
10247 the Layout argument.
10248 * dynobj.h (do_add_symbols): Add the Layout argument.
10249 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
10251 * object.h (Object::add_symbols): Add the Layout argument.
10252 (Object::do_add_symbols): Add the Layout argument.
10253 (Sized_relobj::do_add_symbols): Add the Layout argument.
10254 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
10255 Unify the two versions.
10256 (Add_plugin_symbols): Remove.
10257 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
10258 (Sized_pluginobj::do_add_symbols): Unify the two versions.
10259 (Add_plugin_symbols): Remove.
10260 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
10261 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
10262 (Add_symbols::run): Make it work with Pulginobj.
10264 2009-02-06 Ian Lance Taylor <iant@google.com>
10266 * object.cc (Sized_relobj::do_layout): Make info message start
10267 with lower case letter.
10269 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
10271 * binary.cc: Fix file comment.
10273 * options.h (enum Incremental_disposition): Define.
10274 (class General_options): Add new options: --incremental,
10275 --incremental_changed, --incremental_unchanged,
10276 --incremental_unknown. Add incremental_disposition_ and
10277 implicit_incremental_ fields.
10278 (General_options::incremental_disposition): New function.
10279 (class Position_dependent_options): Add incremental_disposition
10281 (Position_dependent_options::copy_from_options): Set incremental
10283 * options.cc (General_options::parse_incremental_changed): New
10285 (General_options::parse_incremental_unchanged): New function.
10286 (General_options::parse_incremental_unknown): New function.
10287 (General_options::General_options): Initialize new fields
10288 incremental_disposition_ and implicit_incremental_.
10289 (General_options::finalize): Check for uasge of --incremental-*
10290 without --incremental.
10292 2009-02-06 Chris Demetriou <cgd@google.com>
10294 * gold.h (gold_undefined_symbol): Change to take only a Symbol
10295 pointer and to report location as the file name associated with
10297 (gold_undefined_symbol_at_location): New function to replace the
10298 old gold_undefined_symbol functionality.
10299 * target-reloc.h (relocate_section): Update to use
10300 gold_undefined_symbol_at_location.
10301 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10302 Call gold_undefined_symbol function rather than gold_error.
10303 * errors.h (Errors::undefined_symbol): Take location as a
10304 string, rather than calculating it from a relocation.
10305 * errors.cc (Errors::fatal): Print "fatal error:" before the
10307 (Errors::error, Errors::error_at_location): Print "error: "
10308 before the formatted message.
10309 (Errors::undefined_symbol): Take location as a string, rather
10310 than calculating it from a relocation.
10311 (gold_undefined_symbol_at_location): New function akin to
10312 old gold_undefined_symbol, calculates location from relocation.
10313 (gold_undefined_symbol): Change to take only a Symbol pointer
10314 and to report location as the file name associated with the symbol.
10315 * testsuite/debug_msg.sh: Update for changed error messages.
10316 * testsuite/undef_symbol.sh: Likewise.
10318 2009-02-04 Duncan Sands <baldrick@free.fr>
10321 * reduced_debug_output.h
10322 (Output_reduced_debug_abbrev_section::failed): Use format for
10324 (Output_reduced_debug_info_section::faild): Likewise.
10326 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
10328 * script.cc (Lazy_demangler): New class.
10329 (Version_script_info::get_symbol_version_helper): Demangle a
10332 2009-01-29 Cary Coutant <ccoutant@google.com>
10334 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
10336 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10338 2009-01-28 Ian Lance Taylor <iant@google.com>
10340 * version.cc (version_string): Bump to 1.9.
10342 * gold.h: Include <cstring> and <stdint.h>.
10343 * version.cc: Include <cstdio>.
10344 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
10346 * reduced_debug_output.cc (insert_into_vector): Rename from
10347 Insert_into_vector; change all callers. Use Swap_unaligned to
10348 avoid aliasing issue; remove union since it is unnecessary.
10350 2009-01-27 Sriraman Tallam <tmsriram@google.com>
10352 * Makefile.am (CCFILES): Add gc.cc.
10353 (HFILES): Add gc.h.
10354 * Makefile.in: Regenerate.
10355 * gold.cc (Gc_runner): New class.
10356 (queue_initial_tasks): Call garbage collection related tasks
10357 when corresponding options are invoked.
10358 (queue_middle_gc_tasks): New function.
10359 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
10360 processed early before laying out sections during garbage collection.
10361 * gold.h (queue_middle_gc_tasks): New function.
10362 (is_prefix_of): Move from "layout.cc".
10363 * i386.cc (Target_i386::gc_process_relocs): New function.
10364 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
10365 * main.cc (main): Create object of class "Garbage_collection".
10366 * object.cc (Relobj::copy_symbols_data): New function.
10367 (Relobj::is_section_name_included): New function.
10368 (Sized_relobj::do_layout): Allow this function to be called twice
10369 during garbage collection and defer layout of section during the
10371 * object.h (Relobj::get_symbols_data): New function.
10372 (Relobj::is_section_name_included): New function.
10373 (Relobj::copy_symbols_data): New function.
10374 (Relobj::set_symbols_data): New function.
10375 (Relobj::get_relocs_data): New function.
10376 (Relobj::set_relocs_data): New function.
10377 (Relobj::is_output_section_offset_invalid): New pure virtual function.
10378 (Relobj::gc_process_relocs): New function.
10379 (Relobj::do_gc_process_relocs): New pure virtual function.
10380 (Relobj::sd_): New data member.
10381 (Sized_relobj::is_output_section_offset_invalid): New function.
10382 (Sized_relobj::do_gc_process_relocs): New function.
10383 * options.h (General_options::gc_sections): Modify to not be a no-op.
10384 (General_options::print_gc_sections): New option.
10385 * plugin.cc (Plugin_finish::run): Remove function call to
10386 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
10387 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
10388 * reloc.cc (Read_relocs::run): Add task to process relocs and
10389 determine unreferenced sections when doing garbage collection.
10390 (Gc_process_relocs): New class.
10391 (Sized_relobj::do_gc_process_relocs): New function.
10392 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
10393 sections that are garbage collected.
10394 * reloc.h (Gc_process_relocs): New class.
10395 * sparc.cc (Target_sparc::gc_process_relocs): New function.
10396 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
10397 symbols whose corresponding sections are garbage collected.
10398 (Symbol_table::Symbol_table): Add new parameter for the garbage
10400 (Symbol_table::gc_mark_undef_symbols): New function.
10401 (Symbol_table::gc_mark_symbol_for_shlib): New function.
10402 (Symbol_table::gc_mark_dyn_syms): New function.
10403 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
10405 (Symbol_table::add_from_object): Likewise.
10406 (Symbol_table::add_from_relobj): When building shared objects, do not
10407 treat externally visible symbols as garbage.
10408 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
10409 table information for static and relocatable links.
10410 * symtab.h (Symbol_table::set_gc): New function.
10411 (Symbol_table::gc): New function.
10412 (Symbol_table::gc_mark_undef_symbols): New function.
10413 (Symbol_table::gc_mark_symbol_for_shlib): New function.
10414 (Symbol_table::gc_mark_dyn_syms): New function.
10415 (Symbol_table::gc_): New data member.
10416 * target.h (Sized_target::gc_process_relocs): New pure virtual
10418 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
10419 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
10421 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
10423 * options.h (General_options::gc_sections): Define as a no-op for now.
10424 (General_options::no_keep_memory): Ditto.
10425 (General_options::Bshareable): Define.
10426 * options.cc (General_options::finalize): Honor -Bshareable.
10428 2009-01-20 Andreas Schwab <schwab@suse.de>
10430 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
10431 read the value in the contents, since we don't use it. Use the
10432 template endianness when writing.
10433 (Relocate::relocate): Use it for R_PPC_REL16_HA.
10435 2009-01-19 Andreas Schwab <schwab@suse.de>
10437 * configure.tgt (powerpc64-*): Fix targ_obj.
10439 2009-01-15 Ian Lance Taylor <iant@google.com>
10441 * object.cc (Sized_relobj::write_local_symbols): Don't write out
10442 local symbols when stripping all symbols.
10444 2009-01-14 Cary Coutant <ccoutant@google.com>
10446 * output.cc (Output_reloc): Add explicit instantiations.
10448 2009-01-14 Cary Coutant <ccoutant@google.com>
10450 * archive.cc (Archive::get_elf_object_for_member): Remove call
10451 to File_read::claim_for_plugin.
10452 * descriptors.cc (Descriptors::open): Remove reference to
10454 (Descriptors::claim_for_plugin): Remove.
10455 * descriptors.h (Descriptors::claim_for_plugin): Remove.
10456 (Descriptors::is_claimed): Remove.
10457 (claim_descriptor_for_plugin): Remove.
10458 * fileread.cc (File_read::claim_for_plugin): Remove.
10459 * fileread.h (File_read::claim_for_plugin): Remove.
10460 (File_read::descriptor): Reopen descriptor if necessary.
10461 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
10462 (Plugin_manager::all_symbols_read): Add task parameter. Change
10464 (Plugin_manager::get_input_file): New function.
10465 (Plugin_manager::release_input_file): New function.
10466 (Pluginobj::Pluginobj): Add filesize parameter and initialize
10467 corresponding data member.
10468 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
10469 and pass to base constructor. Change all callers.
10470 (get_input_file, release_input_file): New functions.
10471 (make_sized_plugin_object): Add filesize parameter. Change all callers.
10472 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
10473 (Plugin_manager::all_symbols_read): Add task parameter.
10474 (Plugin_manager::get_input_file): New function.
10475 (Plugin_manager::release_input_file): New function.
10476 (Plugin_manager::task_): New data member.
10477 (Pluginobj::Pluginobj): Add filesize parameter.
10478 (Pluginobj::filename): New function.
10479 (Pluginobj::descriptor): New function.
10480 (Pluginobj::filesize): New function.
10481 (Pluginobj::filesize_): New data member.
10482 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
10483 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
10484 File_read::claim_for_plugin; use Object::unlock to unlock the file.
10486 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
10487 with archive libraries.
10488 * testsuite/Makefile.in: Regenerate.
10489 * testsuite/plugin_test.c (struct sym_info): New type.
10490 (get_input_file, release_input_file): New static variables.
10491 (onload): Capture new transfer vector entries.
10492 (claim_file_hook): Stop reading at end of file according to filesize.
10493 Factor out parsing of readelf output into separate function.
10494 (all_symbols_read_hook): Exercise get_input_file and release_input_file
10495 APIs and get the source file name from the symbol table. Convert
10496 source file name to corresponding object file name. Print info
10497 message when adding new input files.
10498 (parse_readelf_line): New function.
10499 * testsuite/plugin_test_1.sh: Add checks for new info messages.
10500 * testsuite/plugin_test_2.sh: Likewise.
10501 * testsuite/plugin_test_3.sh: Likewise.
10502 * testsuite/plugin_test_4.sh: New test case.
10504 2009-01-07 Ian Lance Taylor <iant@google.com>
10506 * version.cc (version_string): Bump to 1.8.
10508 2008-12-23 Cary Coutant <ccoutant@google.com>
10510 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
10511 * plugin.cc (Plugin_manager::finish): Rename as
10512 layout_deferred_objects. Move cleanup to separate function.
10513 (Plugin_manager::cleanup): New function.
10514 (Plugin_finish::run): Call layout_deferred_objects and cleanup
10516 * plugin.h (Plugin_manager::finish): Rename as
10517 layout_deferred_objects.
10518 (Plugin_manager::cleanup): New function.
10519 (Plugin_manager::cleanup_done): New field.
10521 2008-12-23 Cary Coutant <ccoutant@google.com>
10523 * plugin.cc (is_visible_from_outside): New function.
10524 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
10525 so we don't return "IR only" status for exported symbols or -r links.
10527 * testsuite/Makefile.am (plugin_test_3): New test case.
10528 * testsuite/Makefile.in: Regenerate.
10529 * testsuite/plugin_test_3.sh: New file.
10531 2008-12-22 Cary Coutant <ccoutant@google.com>
10533 * object.cc (Sized_relobj::layout_section): New function.
10534 (Sized_relobj::do_layout): Defer layout of input sections until after
10535 plugin has provided replacement files.
10536 (Sized_relobj::do_layout_deferred_sections): New function.
10537 * object.h (Relobj::set_section_offset): Remove virtual keyword.
10538 (Relobj::layout_deferred_sections): New function.
10539 (Relobj::do_layout_deferred_sections): New function.
10540 (Sized_relobj::do_layout_deferred_sections): New function.
10541 (Sized_relobj::layout_section): New function.
10542 (Sized_relobj::Deferred_layout): New structure.
10543 (Sized_relobj::deferred_layout_): New field.
10544 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10545 Change all callers. Layout deferred sections.
10546 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
10548 (Plugin_hook::run): Move code from do_plugin_hook inline.
10549 (Plugin_hook::do_plugin_hook): Remove.
10550 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10551 (Plugin_manager::finish): Renamed, was cleanup.
10552 (Plugin_manager::should_defer_layout): New function.
10553 (Plugin_manager::add_deferred_layout_object): New function.
10554 (Plugin_manager::Deferred_layout_list): New type.
10555 (Plugin_manager::deferred_layout_objects_): New field.
10556 (Plugin_hook::do_plugin_hook): Remove.
10558 2008-12-17 Ian Lance Taylor <iant@google.com>
10560 * options.h (class General_options): Add --no case for
10563 2008-12-16 Cary Coutant <ccoutant@google.com>
10565 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
10567 (Plugin_manager::claim_file): Create plugin object even if
10568 plugin did not call the add_symbols callback.
10569 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10570 asking for more symbols than were added.
10571 * testsuite/Makefile.am (plugin_test_1): Add test case with
10573 (empty.syms): New target.
10574 * testsuite/Makefile.in: Regenerate.
10575 * testsuite/plugin_test.c (claim_file_hook): Add new debug
10576 message. Don't call add_symbols if no globals.
10577 (all_symbols_read_hook): Don't provide replacement for empty
10580 2008-12-12 Ian Lance Taylor <iant@google.com>
10582 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10583 r_type == 0 for a local symbol with r_sym == 0.
10584 (scan_relocatable_relocs): Pass r_sym to
10585 local_non_section_strategy.
10586 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10589 * configure.ac: Update test for TLS descriptors: they are
10590 supported as of glibc 2.9.
10591 * configure: Rebuild.
10593 2008-12-11 Ian Lance Taylor <iant@google.com>
10596 * target-reloc.h (Default_scan_relocatable_relocs): For each
10597 function, map r_type == 0 to RELOC_DISCARD.
10599 2008-12-10 Cary Coutant <ccoutant@google.com>
10601 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
10602 object to override a kept COMDAT group from a plugin object.
10604 2008-12-09 Ian Lance Taylor <iant@google.com>
10607 * yyscript.y (file_cmd): Handle INPUT.
10609 * testsuite/initpri1.c: Change all declarations to be full
10610 prototypes by adding void, to avoid compiler warnings.
10612 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
10614 * options.cc (General_options::parse_plugin_opt): New.
10615 (General_options::add_plugin): The argument now is just the filename.
10616 (General_options::add_plugin_option): New.
10617 * options.h (plugin_opt): New.
10618 (add_plugin): Change argument name.
10619 (add_plugin_option): New.
10620 * plugin.cc (Plugin::load): Don't parse the plugin option.
10621 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
10622 (Plugin::add_option): New.
10623 (Plugin::args_): Change type.
10624 (Plugin::filename_): New.
10625 (Plugin_manager::add_plugin_option): New.
10626 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
10627 * testsuite/Makefile.in: Regenerate.
10629 2008-12-05 Cary Coutant <ccoutant@google.com>
10631 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
10632 Handle --strip-lto-sections option.
10633 * options.h (strip_lto_sections): New option.
10635 2008-12-01 Cary Coutant <ccoutant@google.com>
10637 * plugin.cc (ld_plugin_message): Change format parameter to const.
10638 Fix mismatch between new[] and delete.
10640 2008-11-14 Cary Coutant <ccoutant@google.com>
10642 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
10645 2008-11-05 Craig Silverstein <csilvers@google.com>
10647 * options.cc (General_options::parse_dynamic_list): New function.
10648 * options.h (General_options): New flags dynamic_list,
10649 dynamic_list_data, dynamic_list_cpp_new, and
10650 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
10651 (General_options::in_dynamic_list): New function.
10652 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
10653 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
10654 (Lex::can_continue_name): Likewise.
10656 (read_script_file): New parameter script_options.
10657 (read_dynamic_list): New function.
10658 (Script_options::define_dynamic_list): New function.
10659 (dynamic_list_keyword_parsecodes): New variable.
10660 (dynamic_list_keywords): New variable.
10661 * script.h (Script_options::define_dynamic_list): New function
10663 (read_dynamic_list): New function prototype.
10664 * symtab.cc (strprefix): New macro.
10665 (Symbol::should_add_dynsym_entry): Support dynamic_list,
10666 dynamic_list_data, dynamic_list_cpp_new, and
10667 dynamic_list_cpp_typeinfo.
10668 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
10669 (dynamic_list_expr): New rule.
10670 (dynamic_list_nodes): Likewise.
10671 (dynamic_list_node): Likewise.
10672 * testsuite/Makefile.am (dynamic_list): New test.
10673 * testsuite/Makefile.in: Regenerated.
10674 * testsuite/dynamic_list.t: New file.
10675 * testsuite/dynamic_list.sh: New file.
10677 2008-11-05 Craig Silverstein <csilvers@google.com>
10679 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
10680 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
10681 (t11_last): Likewise.
10682 * testsuite/ver_test_6.c (main): Likewise.
10684 2008-10-07 Cary Coutant <ccoutant@google.com>
10686 * options.c (General_options::finalize): Add check for -static and
10688 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
10691 2008-10-02 Cary Coutant <ccoutant@google.com>
10693 * plugin.cc (make_sized_plugin_object): Fix conditional
10694 compilation to work when not all targets are enabled.
10696 2008-09-29 Cary Coutant <ccoutant@google.com>
10698 * archive.cc (Archive::get_file_and_offset): Use filename instead
10699 of name to get library path.
10700 (Archive::include_member): Unlock external member of a thin archive.
10702 * testsuite/Makefile.am (TEST_AR): New variable.
10703 (thin_archive_test_1): New test.
10704 (thin_archive_test_2): New test.
10705 * testsuite/Makefile.in: Regenerate.
10706 * testsuite/thin_archive_main.cc: New file.
10707 * testsuite/thin_archive_test_1.cc: New file.
10708 * testsuite/thin_archive_test_2.cc: New file.
10709 * testsuite/thin_archive_test_3.cc: New file.
10710 * testsuite/thin_archive_test_4.cc: New file.
10712 2008-09-29 Cary Coutant <ccoutant@google.com>
10714 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
10715 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
10717 (Sized_relobj::do_finalize_local_symbols): Likewise.
10718 (Sized_relobj::map_to_kept_section): Likewise.
10719 * object.h (Sized_relobj::invalid_address): New constant.
10720 (Sized_relobj::do_output_section_offset): Check for invalid_address
10722 * output.cc (Output_reloc::local_section_offset): Use constant
10723 invalid_address instead of -1U.
10724 (Output_reloc::get_address): Likewise.
10725 (Output_section::output_address): Change -1U to -1ULL.
10726 * output.h (Output_reloc::invalid_address): New constant.
10727 * reloc.cc (Sized_relobj::write_sections): Use constant
10728 invalid_address instead of -1U.
10729 (Sized_relobj::relocate_sections): Likewise.
10730 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
10731 values for merge sections.
10732 * target-reloc.h (relocate_for_relocatable): Use constant
10733 invalid_address instead of -1U.
10735 2008-09-19 Cary Coutant <ccoutant@google.com>
10737 Add plugin functionality for link-time optimization (LTO).
10738 * configure.ac (plugins): Add --enable-plugins option.
10739 * configure: Regenerate.
10740 * config.in: Regenerate.
10741 * Makefile.am (LIBDL): New variable.
10742 (CCFILES): Add plugin.cc.
10743 (HFILES): Add plugin.h.
10744 (ldadd_var): Add LIBDL.
10745 * Makefile.in: Regenerate.
10747 * archive.cc: Include "plugin.h".
10748 (Archive::setup): Don't preread archive symbols when using a plugin.
10749 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
10750 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
10752 (Archive::include_member): Add symbols from plugin objects.
10753 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
10754 * descriptors.cc (Descriptors::open): Check for file descriptors
10755 abandoned by plugins.
10756 (Descriptors::claim_for_plugin): New function.
10757 * descriptors.h (Descriptors::claim_for_plugin): New function.
10758 (Open_descriptor::is_claimed): New field.
10759 (claim_descriptor_for_plugin): New function.
10760 * fileread.cc (File_read::claim_for_plugin): New function.
10761 * fileread.h (File_read::claim_for_plugin): New function.
10762 (File_read::descriptor): New function.
10763 * gold.cc: Include "plugin.h".
10764 (queue_initial_tasks): Add task to call plugin hooks for generating
10766 * main.cc: Include "plugin.h".
10767 (main): Load plugin libraries.
10768 * object.h (Pluginobj): Declare.
10769 (Object::pluginobj): New function.
10770 (Object::do_pluginobj): New function.
10771 (Object::set_target): New function.
10772 * options.cc: Include "plugin.h".
10773 (General_options::parse_plugin): New function.
10774 (General_options::General_options): Initialize plugins_ field.
10775 (General_options::add_plugin): New function.
10776 * options.h (Plugin_manager): Declare.
10777 (General_options): Add --plugin option.
10778 (General_options::has_plugins): New function.
10779 (General_options::plugins): New function.
10780 (General_options::add_plugin): New function.
10781 (General_options::plugins_): New field.
10782 * plugin.cc: New file.
10783 * plugin.h: New file.
10784 * readsyms.cc: Include "plugin.h".
10785 (Read_symbols::do_read_symbols): Check for archive before checking
10786 for ELF file. Call plugin hooks to claim files.
10787 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
10788 from a real object file; force override when processing replacement
10790 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
10791 (Symbol::init_base_object): Likewise.
10792 (Symbol::init_base_output_data): Likewise.
10793 (Symbol::init_base_output_segment): Likewise.
10794 (Symbol::init_base_constant): Likewise.
10795 (Symbol::init_base_undefined): Likewise.
10796 (Symbol::output_section): Assert that object is not a plugin.
10797 (Symbol_table::add_from_pluginobj): New function.
10798 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
10800 (Symbol_table::sized_write_globals): Likewise.
10801 (Symbol_table::add_from_pluginobj): Instantiate template.
10802 * symtab.h (Sized_pluginobj): Declare.
10803 (Symbol::in_real_elf): New function.
10804 (Symbol::set_in_real_elf): New function.
10805 (Symbol::in_real_elf_): New field.
10806 (Symbol_table::add_from_pluginobj): New function.
10808 * testsuite/Makefile.am (AM_CFLAGS): New variable.
10809 (LIBDL): New variable.
10810 (LDADD): Add LIBDL.
10811 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
10812 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
10813 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
10814 (MOSTLYCLEANFILES): Likewise.
10815 * testsuite/Makefile.in: Regenerate.
10816 * testsuite/plugin_test.c: New file.
10817 * testsuite/plugin_test_1.sh: New file.
10818 * testsuite/plugin_test_2.sh: New file.
10820 2008-09-16 Ian Lance Taylor <iant@google.com>
10822 * target-reloc.h (relocate_section): Check whether a symbol is
10823 defined by the ABI before reporting an undefined symbol error.
10824 * target.h (Target::is_defined_by_abi): Make parameter const.
10825 (Target::do_is_defined_by_abi): Likewise.
10826 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
10827 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
10828 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
10829 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
10830 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
10831 * testsuite/Makefile.in: Rebuild.
10833 * fileread.cc (make_view): Add casts to avoid warning.
10835 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
10837 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
10838 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10840 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
10842 * options.h (General_options::output_is_executable): New.
10843 (General_options::output_is_pie): New.
10844 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
10845 for shared libraries.
10846 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10848 2008-09-11 Chris Demetriou <cgd@google.com>
10850 * options.h (origin): New -z option.
10851 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
10852 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
10855 2008-09-05 Cary Coutant <ccoutant@google.com>
10857 * fileread.cc (File_read::make_view): Add check for attempt to map
10858 beyond end of file.
10860 2008-09-05 Cary Coutant <ccoutant@google.com>
10862 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
10863 explicit instantiations.
10865 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
10868 * options.cc (General_options::finalize): Allow undefined symbols
10869 in shlibs if linking -shared.
10872 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
10873 symbols as not needing a dynsym entry.
10875 2008-08-20 Craig Silverstein <csilvers@google.com>
10877 * fileread.cc (File_read::open): Do not lock the file unless it
10878 was successfully opened.
10880 2008-08-14 Cary Coutant <ccoutant@google.com>
10882 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
10883 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
10884 * testsuite/tls_test.cc (struct int128): 128-bit struct
10885 for testing TLS relocs with non-zero addend.
10886 (v12): New TLS variable.
10888 (t_last): Add check for v12.
10889 * testsuite/tls_test.h (t12): New function.
10890 * testsuite/tls_test_main.cc (thread_routine): Call new test.
10892 2008-08-13 Ian Lance Taylor <iant@google.com>
10894 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
10895 set tls_segment_ or relro_segment_.
10896 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
10898 * output.h (Output_section::clear_is_relro): New function.
10899 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
10900 sections specially even when output_data_ is empty.
10901 (Output_segment::maximum_alignment): When first section is relro,
10902 only force alignment for PT_LOAD segments.
10903 * script.cc (script_data_segment_align): New function.
10904 (script_data_segment_relro_end): New function.
10905 * script-c.h (script_data_segment_align): Declare.
10906 (script_data_segment_relro_end): Declare.
10907 * script-sections.h (class Script_sections): Declare
10908 data_segment_align and data_segment_relro_end. Add fields
10909 segment_align_index_ and saw_relro_end_.
10910 * script-sections.cc (class Sections_element): Add set_is_relro
10911 virtual function. Add new bool* parameter to place_orphan_here.
10912 Add get_output_section virtual function.
10913 (class Output_section_definition): Add set_is_relro. Add new
10914 bool* parameter to place_orphan_here. Add get_output_section.
10915 Add is_relro_ field.
10916 (Output_section_definition::Output_section_definition): Initialize
10917 evaluated_address_, evaluated_load_address, evaluated_addralign_,
10918 and is_relro_ fields.
10919 (Output_section_definition::place_orphan_here): Add is_relro
10921 (Output_section_definition::set_section_addresses): Set relro for
10923 (Output_section_definition::alternate_constraint): Likewise.
10924 (class Orphan_output_section): Add new bool* parameter to
10925 place_orphan_here. Add get_output_section.
10926 (Orphan_output_section::place_orphan_here): Add is_relro
10928 (Script_sections::Script_sections): Initialize
10929 data_segment_align_index_ and saw_relro_end_.
10930 (Script_sections::data_segment_align): New function.
10931 (Script_sections::data_segment_relro_end): New function.
10932 (Script_sections::place_orphan): Set or clear is_relro.
10933 (Script_sections::set_section_addresses): Force alignment of first
10935 * yyscript.y (exp): Call script_data_segment_align and
10936 script_data_segment_relro_end.
10937 * testsuite/relro_script_test.t: New file.
10938 * testsuite/relro_test.cc (using_script): Declare.
10939 (t1, t2): Test using_script.
10940 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
10941 (relro_script_test_SOURCES): Define.
10942 (relro_script_test_DEPENDENCIES): Define.
10943 (relro_script_test_LDFLAGS): Define.
10944 (relro_script_test_LDADD): Define.
10945 (relro_script_test.so): New target.
10946 * testsuite/Makefile.in: Rebuild.
10948 2008-08-06 Cary Coutant <ccoutant@google.com>
10950 * archive.cc (Archive::total_archives, Archive::total_members)
10951 (Archive::total_members_loaded): New variables.
10952 (Archive::setup): Add parameter. Add option to preread
10954 (Archive::read_armap): Add counter.
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::add_symbols): Add counters.
10960 (Archive::include_all_members): Use armap to find members if it's
10962 (Archive::include_member): Skip reading symbols if already read.
10963 Factored code into Archive::get_file_and_offset and
10964 Archive::get_elf_object_for_member. Changed call to
10965 Mapfile::report_include_archive_member.
10966 (Archive::print_stats): New function.
10967 * archive.h: Declare Object and Read_symbols_data classes.
10968 (Archive::Archive): Add initializers for new members.
10969 (Archive::setup): Add parameter.
10970 (Archive::print_stats): New function.
10971 (Archive::total_archives, Archive::total_members)
10972 (Archive::total_members_loaded): New variables.
10973 (Archive::get_file_and_offset): New function.
10974 (Archive::get_elf_object_for_member): New function.
10975 (Archive::read_all_symbols): New function.
10976 (Archive::read_symbols): New function.
10977 (Archive::Archive_member): New class.
10978 (Archive::members_): New member.
10979 (Archive::num_members_): New member.
10980 * main.cc: Include archive.h.
10981 (main): Call Archive::print_stats.
10982 * mapfile.cc (Mapfile::report_include_archive_member): Delete
10983 archive parameter; member_name is now the fully-decorated name.
10984 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
10985 * options.h: (General_options): Add --preread-archive-symbols option.
10986 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
10989 2008-08-04 Ian Lance Taylor <iant@google.com>
10991 * symtab.h (Symbol::use_plt_offset): New function.
10992 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
10993 * powerpc.cc (Relocate::relocate): Likewise.
10994 * sparc.cc (Relocate::relocate): Likewise.
10995 * x86_64.cc (Relocate::relocate): Likewise.
10996 * testsuite/weak_plt.sh: New test.
10997 * testsuite/weak_plt_main.cc: New test.
10998 * testsuite/weak_plt_shared.cc: New test.
10999 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
11000 (check_PROGRAMS): Add weak_plt.
11001 (check_DATA): Add weak_plt_shared.so.
11002 (weak_plt_main_pic.o, weak_plt): New targets.
11003 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
11004 * testsuite/Makefile.in: Rebuild.
11006 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
11008 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
11009 * testsuite/Makefile.in: Rebuild.
11011 2008-08-04 Alan Modra <amodra@bigpond.net.au>
11013 * Makefile.am (POTFILES.in): Set LC_ALL=C.
11014 * Makefile.in: Regenerate.
11015 * po/POTFILES.in: Regenerate.
11017 2008-07-29 Ian Lance Taylor <iant@google.com>
11019 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
11020 symbols before other symbols.
11021 * testsuite/script_test_2.cc (test_addr): Declare.
11022 (test_addr_alias): Declare.
11023 (main): Check that test_addr and test_addr_alias have the right
11025 * testsuite/script_test_2.t: Define test_addr_alias and
11028 2008-07-24 Ian Lance Taylor <iant@google.com>
11031 * descriptors.cc: New file.
11032 * descriptors.h: New file.
11033 * gold-threads.h (class Hold_optional_lock): New class.
11034 * fileread.cc: Include "descriptors.h".
11035 (File_read::~File_read): Release descriptor rather than closing
11037 (File_read::open) [file]: Call open_descriptor rather than open.
11038 Set is_descriptor_opened_.
11039 (File_read::open) [memory]: Assert that descriptor is not open.
11040 (File_read::reopen_descriptor): New function.
11041 (File_read::release): Release descriptor.
11042 (File_read::do_read): Make non-const. Reopen descriptor.
11043 (File_read::read): Make non-const.
11044 (File_read::make_view): Reopen descriptor.
11045 (File_read::do_readv): Likewise.
11046 * fileread.h (class File_read): Add is_descriptor_opened_ field.
11047 Update declarations.
11048 * layout.cc: Include "descriptors.h".
11049 (Layout::create_build_id): Use open_descriptor rather than open.
11050 * output.cc: Include "descriptors.h".
11051 (Output_file::open): Use open_descriptor rather than open.
11052 * archive.cc (Archive::const_iterator): Change Archive to be
11054 (Archive::begin, Archive::end): Make non-const.
11055 (Archive::count_members): Likewise.
11056 * archive.h (class Archive): Update declarations.
11057 * object.h (Object::read): Make non-const.
11058 * Makefile.am (CCFILES): Add descriptors.cc.
11059 (HFILES): Add descriptors.h.
11060 * Makefile.in: Rebuild.
11063 * gold.h: Always include <clocale>. Add Solaris workarounds
11064 following code in binutils/sysdep.h.
11067 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
11068 this->eh_frame_hdr_ is NULL before using it.
11070 * dynobj.cc (Versions::Versions): Update comment.
11072 * dynobj.cc (Versions::Versions): If there is an soname, use it as
11073 the base version name.
11075 * stringpool.cc (Stringpool_template::add_with_length): Set key to
11076 array size plus one.
11077 (Stringpool_template::set_string_offsets): Subtract one from key
11078 before using it as an array index.
11079 (Stringpool_template::get_offset_with_length): Likewise.
11080 (Stringpool_template::write_to_buffer): Likewise.
11081 * stringpool.h (Stringpool_template::get_offset_from_key):
11084 2008-07-23 Ian Lance Taylor <iant@google.com>
11087 * object.h (Merged_symbol_value::value): Do our best to handle a
11091 * script.cc (Version_script_info::get_versions): Don't add empty
11092 version tag to return value.
11093 (Version_script_info::get_symbol_version_helper): Change return
11094 type to bool. Add pversion parameter. Change all callers.
11095 (script_register_vers_node): Don't require a non-NULL tag.
11096 * script.h (class Version_script_info): Update declarations.
11097 (Version_script_info::get_symbol_version): Change return type to
11098 bool. Add version parameter. Change all callers.
11099 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
11100 handling. Handle an empty version from a version script.
11101 (Symbol_table::define_special_symbol): Likewise.
11102 * testsuite/ver_test_10.script: New file.
11103 * testsuite/ver_test_10.sh: New file.
11104 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
11105 (check_DATA): Add ver_test_10.syms.
11106 (ver_test_10.syms, ver_test_10.so): New target.
11107 * testsuite/Makefile.in: Rebuild.
11109 2008-07-23 Simon Baldwin <simonb@google.com>
11111 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
11112 to zero for undefined symbols from dynamic libraries.
11114 2008-07-23 Ian Lance Taylor <iant@google.com>
11116 * symtab.cc (Symbol_table::resolve): Remove version parameter.
11117 Change all callers.
11118 * symtab.h (class Symbol_table): Update declaration.
11119 * testsuite/ver_test_9.cc: New file.
11120 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
11121 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
11122 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
11123 (ver_test_9.so, ver_test_9.o): New targets.
11124 * testsuite/Makefile.in: Rebuild.
11126 2008-07-22 Ian Lance Taylor <iant@google.com>
11128 * options.h (class General_options): Define --check-sections.
11129 * layout.cc (Layout::set_segment_offsets): Handle
11132 * options.h (class General_options): Define -n/--nmagic and
11134 * options.cc (General_options::finalize): For -n/--nmagic or
11135 -N/--omagic, set -static.
11136 * layout.cc (Layout::attach_allocated_section_to_segment): If
11137 -N/--omagic, don't put read-only and read-write sections in
11138 different segments.
11139 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
11140 finding a read-only segment.
11141 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
11142 don't set the minimum segment alignment to the common page size,
11143 and don't set the file offset to the address modulo the page size.
11144 * script-sections.cc (Script_sections::create_segments): If
11145 -n/--omagic, don't put read-only and read-write sections in
11146 different segments.
11148 * cref.cc: New file.
11149 * cref.h: New file.
11150 * options.h (class General_options): Add --print-symbol-counts.
11151 * main.cc (main): Issue defined symbol report if requested.
11152 * archive.cc (Archive::interpret_header): Make into a const member
11154 (Archive::add_symbols): Call Input_objects::archive_start and
11156 (Archive::const_iterator): Define new class.
11157 (Archive::begin, Archive::end): New functions.
11158 (Archive::include_all_members): Rewrite to use iterator.
11159 (Archive::count_members): New function.
11160 * archive.h (class Archive): Update declarations.
11161 (Archive::filename): New function.
11162 * object.cc: Include "cref.h".
11163 (Sized_relobj::Sized_relobj): Initialize defined_count_.
11164 (Sized_relobj::do_get_global_symbol_counts): New function.
11165 (Input_objects::add_object): Add object to cross-referencer.
11166 (Input_objects::archive_start): New function.
11167 (Input_objects::archive_stop): New function.
11168 (Input_objects::print_symbol_counts): New function.
11169 * object.h: Declare Cref and Archive.
11170 (Object::get_global_symbol_counts): New function.
11171 (Object::do_get_global_symbol_counts): New pure virtual function.
11172 (class Sized_relobj): Add defined_count_ field. Update
11174 (class Input_objects): Add cref_ field. Update constructor.
11175 Update declarations.
11176 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
11178 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
11180 (Sized_dynobj::do_get_global_symbol_counts): New function.
11181 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
11182 defined_count_. Update declarations. Define Symbols typedef.
11183 * symtab.cc (Symbol_table::add_from_relobj): Add defined
11184 parameter. Change all callers.
11185 (Symbol_table::add_from_dynobj): Add sympointers and defined
11186 parameters. Change all callers.
11187 * symtab.h (class Symbol_table): Update declarations.
11188 * Makefile.am (CCFILES): Add cref.cc.
11189 (HFILES): Add cref.h.
11190 * Makefile.in: Rebuild.
11192 2008-07-22 Simon Baldwin <simonb@google.com>
11194 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
11195 to zero when writing undefined symbols.
11197 2008-07-22 Ian Lance Taylor <iant@google.com>
11199 * output.cc (Output_section::add_input_section): Don't try to
11200 merge empty merge sections.
11202 2008-07-21 Craig Silverstein <csilvers@google.com>
11204 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11205 Include symbol version in error message.
11207 2008-07-20 Chris Demetriou <cgd@google.com>
11209 * configure.ac (gold_cv_c_random_seed): New configured variable.
11210 (RANDOM_SEED_CFLAGS): New substituted variable.
11211 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
11212 * configure: Rebuild.
11213 * Makefile.in: Likewise.
11214 * testsuite/Makefile.in: Likewise.
11216 2008-07-18 Ian Lance Taylor <iant@google.com>
11218 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
11219 where we see NAME/NULL and NAME/VERSION as separate symbols.
11220 * testsuite/ver_test_main.cc (main): Call t4.
11221 (t4, t4_2a): Define.
11222 * testsuite/ver_test_2.cc (t4_2): Define.
11223 * testsuite/ver_test_2.script: Put t4_2a in VER2.
11224 * testsuite/ver_test_4.cc (t4_2a): Define.
11225 * testsuite/ver_test_4.script: Put t4_2a in VER2.
11226 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
11228 2008-07-17 Ian Lance Taylor <iant@google.com>
11230 * dynobj.cc (Versions::add_def): If we give an error about a
11231 missing version, go ahead and create the version anyhow.
11233 2008-07-10 Ian Lance Taylor <iant@google.com>
11235 Handle output sections with more than 0x7fffffff bytes.
11236 * object.h (class Relobj): Change map_to_output_ to
11237 output_sections_, and just keep a section pointer. Change all
11238 uses. Move comdat group support to Sized_relobj.
11239 (Relobj::is_section_specially_mapped): Remove.
11240 (Relobj::output_section): Remove poff parameter. Change all
11242 (Relobj::output_section_offset): New function.
11243 (Relobj::set_section_offset): Rewrite.
11244 (Relobj::map_to_output): Remove.
11245 (Relobj::output_sections): New function.
11246 (Relobj::do_output_section_offset): New pure virtual function.
11247 (Relobj::do_set_section_offset): Likewise.
11248 (class Sized_relobj): Add section_offsets_ field. Add comdat
11249 group support from Relobj. Update declarations.
11250 (Sized_relobj::get_output_section_offset): New function.
11251 (Sized_relobj::do_output_section_offset): New function.
11252 (Sized_relobj::do_set_section_offset): New function.
11253 * object.cc (Relobj::output_section_address): Remove.
11254 (Sized_relobj::Sized_relobj): Initialize new fields.
11255 (Sized_relobj::include_section_group): Cast find_kept_object to
11257 (Sized_relobj::include_linkonce_section): Likewise.
11258 (Sized_relobj::do_layout): Use separate arrays for output section
11260 (Sized_relobj::do_count_local_symbols): Change map_to_output to
11262 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
11263 output_sections and section_offsets.
11264 (Sized_relobj::write_local_symbols): Likewise.
11265 (map_to_kept_section): Compute output address directly.
11266 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
11267 output_sections and section_offsets.
11268 (Sized_relobj::write_sections): Likewise.
11269 (Sized_relobj::relocate_sections): Likewise.
11270 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
11271 * output.h (class Output_reloc): Update declarations. Change
11272 u2_.relobj to Sized_relobj*.
11273 (class Output_data_reloc): Change add functions to use
11275 * output.cc (Output_reloc::Output_reloc): Change relobj to
11277 (Output_reloc::local_section_offset): Change return type to
11278 Elf_Addr. Use get_output_section_offset.
11279 (Output_reloc::get_address): Likewise.
11280 (Output_section::is_input_address_mapped): Don't call
11281 is_section_specially_mapped.
11282 (Output_section::output_offset): Likewise.
11283 (Output_section::output_address): Likewise.
11284 (Output_section::starting_output_address): Likewise.
11285 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
11286 parameter to Sized_relobj*.
11287 (Copy_relocs::need_copy_reloc): Likewise.
11288 (Copy_relocs::save): Likewise.
11289 * copy-relocs.h (class Copy_relocs): Update declarations.
11290 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
11291 Sized_relobj*. Change relobj_ field to Sized_relobj*.
11292 * target-reloc.h (relocate_for_relocatable): Change
11293 offset_in_output_section type to Elf_Addr. Change code that uses
11295 * layout.cc (Layout::layout): Always set *off.
11296 * mapfile.cc (Mapfile::print_input_section): Use
11297 output_section_offset.
11298 * i386.cc (Target_i386::copy_reloc): Change object parameter to
11300 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
11301 * sparc.cc (Target_sparc::copy_reloc): Likewise.
11302 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
11304 2008-07-03 Ian Lance Taylor <iant@google.com>
11306 * layout.cc (Layout::include_section): Do not discard unrecognized
11307 SHT_STRTAB sections.
11309 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
11311 * script.cc (Lex::can_continue_name): Make '?' allowable in
11312 version-script names.
11313 * testsuite/version_script.map: Change glob pattern to use '?'
11315 2008-06-30 Manish Singh <yosh@gimp.org>
11318 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
11321 2008-06-30 Ian Lance Taylor <iant@google.com>
11325 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
11326 versions]: Don't try to read the value in the contents, since we
11327 don't use it. Use the template endianness when writing.
11329 2008-06-25 Cary Coutant <ccoutant@google.com>
11331 * fileread.cc (File_read::make_view): Assert on zero-length view.
11332 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
11333 symbol table when there are no symbols to read.
11335 2008-06-23 Craig Silverstein <csilvers@google.com>
11337 * version.cc (version_string): Bump to 1.7
11339 2008-06-18 Craig Silverstein <csilvers@google.com>
11341 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
11342 constant 0xFFFF to type Valtype.
11343 (Powerpc_relocate_functions::rel16_ha): Likewise.
11345 2008-06-17 Ian Lance Taylor <iant@google.com>
11347 * output.h (Output_section::Input_section): Initialize p2align_ to
11348 zero for Output_section_data constructors.
11349 (Output_section::Input_section::addralign): If not an input
11350 section, return the alignment of the Output_section_data.
11351 * testsuite/copy_test.cc: New file.
11352 * testsuite/copy_test_1.cc: New file.
11353 * testsuite/copy_test_2.cc: New file.
11354 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
11355 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
11356 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
11357 (copy_test_1_pic.o, copy_test_1.so): New targets.
11358 (copy_test_2_pic.o, copy_test_2.so): New targets.
11359 * testsuite/Makefile.in: Rebuild.
11361 * script-sections.cc (Script_sections::place_orphan): Initialize
11362 local variable exact.
11364 2008-06-13 David Edelsohn <edelsohn@gnu.org>
11366 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
11368 2008-06-12 David Edelsohn <edelsohn@gnu.org>
11369 David S. Miller <davem@davemloft.net>
11371 * powerpc.cc: New file.
11372 * Makefile.am (TARGETSOURCES): Add powerpc.cc
11373 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
11374 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
11375 * Makefile.in: Rebuild.
11377 2008-06-09 Ian Lance Taylor <iant@google.com>
11379 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
11381 (throwing, orig_terminate): New static variables.
11382 (terminate_handler): New static function.
11383 (t2): Set terminate handler.
11385 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
11388 * binary.cc (Binary_to_elf::sized_convert): Fix .data
11391 2008-05-30 Cary Coutant <ccoutant@google.com>
11393 * archive.cc (Archive::include_all_members) Correct to step
11394 over symbol table and extended name table in thin archives.
11396 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
11399 * target-reloc.h (relocate_for_relocatable): Fix new_offset
11402 2008-05-28 Caleb Howe <cshowe@google.com>
11404 * reduced_debug_output.cc: New file.
11405 * reduced_debug_output.h: New file.
11406 * options.h (class General_options): Add --strip-debug-non-line.
11407 * options.cc (General_options::finalize): Add strip_debug_non_line
11408 to the strip heirarchy.
11409 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
11411 * layout.cc: Include "reduced_debug_output.h".
11412 (Layout::Layout): Initialize new fields.
11413 (line_only_debug_sections): New static array.
11414 (is_lines_only_debug_sections): New static inline function.
11415 (Layout::include_section): Handle --strip-debug-non-line.
11416 (Layout::make_output_section): If --strip-debug-non-line, build
11417 new output sections for .debug_abbrev and .debug_info.
11418 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
11419 gold. Warn about possible overflow.
11420 (read_signed_LEB_128): Likewise.
11421 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
11422 (read_signed_LEB_128): Declare.
11423 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
11424 (HFILES): Add reduced_debug_output.h.
11425 * Makefile.in: Rebuild.
11427 2008-05-21 Ian Lance Taylor <iant@google.com>
11429 * mapfile.cc: New file.
11430 * mapfile.h: New file.
11431 * options.h (class General_options): Add -M/--print-map and -Map.
11432 * options.cc (General_options::finalize): Make -M equivalent to
11434 * main.cc: Include <cstdio> and "mapfile.h".
11435 (main): Open mapfile if requested.
11436 * gold.cc (class Middle_runner): Add mapfile_ field. Update
11437 constructor. Change caller.
11438 (queue_initial_tasks): Add mapfile parameter. Change caller.
11439 (queue_middle_tasks): Likewise.
11440 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
11442 * archive.cc: Include "mapfile.h".
11443 (Archive::add_symbols): Add mapfile parameter. Change all
11444 callers. Pass mapfile, symbol, and reason to include_member.
11445 (Archive::include_all_members): Add mapfile parameter. Change all
11447 (Archive::include_member): Add mapfile, sym, and why parameters.
11448 Change all callers. Report inclusion to map file.
11449 * archive.h: Include "fileread.h".
11450 (class Archive): Update declarations.
11451 (Archive::file): New const method.
11452 (class Add_archive_symbols): Add mapfile_ field. Update
11453 constructor. Change all callers.
11454 * readsyms.h (class Read_symbols): Likewise.
11455 (class Finish_group): Likewise.
11456 (class Read_script): Likewise.
11457 * common.cc: Include "mapfile.h".
11458 (Symbol_table::allocate_commons): Add mapfile parameter. Change
11460 (Symbol_table::do_allocate_commons): Likewise.
11461 (Symbol_table::do_allocate_commons_list): Likewise. Report common
11462 symbol allocation to mapfile.
11463 * common.h (class Allocate_commons_task): Add mapfile_ field.
11464 Update constructor. Change all callers.
11465 * symtab.h (class Symbol_table): Update declarations.
11466 * layout.cc: Include "mapfile.h".
11467 (Layout_task_runner::run): Print information to mapfile.
11468 (Layout::create_gold_note): Change Output_data_fixed_space to
11469 Output_data_zero_fill.
11470 (Layout::create_build_id): Likewise.
11471 (Layout::print_to_mapfile): New function.
11472 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
11473 constructor. Change caller.
11474 (class Layout): Declare print_to_mapfile.
11475 * output.cc (Output_section::Input_section::print_to_mapfile): New
11477 (Output_section::add_input_section): If producing a map, always
11478 add to input_sections_ list.
11479 (Output_section::do_print_to_mapfile): New function.
11480 (Output_segment::print_sections_to_mapfile): New function.
11481 (Output_segment::print_section_list_to_mapfile): New function.
11482 * output.h: Include "mapfile.h".
11483 (Output_data::print_to_mapfile): New function.
11484 (Output_data::do_print_to_mapfile): New virtual function.
11485 (Output_segment_headers::do_print_to_mapfile): New function.
11486 (Output_file_header::do_print_to_mapfile): New function.
11487 (Output_data_const::do_print_to_mapfile): New function.
11488 (class Output_data_const_buffer): Add map_name_ field. Update
11489 constructor. Change all callers. Add do_print_to_mapfile
11491 (class Output_data_fixed_space): Likewise.
11492 (class Output_data_space): Likewise.
11493 (class Output_data_zero_fill): New class.
11494 (Output_data_strtab::do_print_to_mapfile): New function.
11495 (Output_data_reloc_base::do_print_to_mapfile): New function.
11496 (Output_relocatable_relocs::do_print_to_mapfile): New function.
11497 (Output_data_group::do_print_to_mapfile): New function.
11498 (Output_data_got::do_print_to_mapfile): New function.
11499 (Output_data_dynamic::do_print_to_mapfile): New function.
11500 (Output_symtab_xindex::do_print_to_mapfile): New function.
11501 (class Output_section): Declare do_print_to_mapflie. Declare
11502 print_to_mapfile in Input_section.
11503 (class Output_segment): Declare new functions.
11504 * object.h (Sized_relobj::symbol_count): New function.
11505 * script-sections.cc
11506 (Output_section_element_dot_assignment::set_section_addresses):
11507 Change Output_data_fixed_space to Output_data_zero_fill.
11508 (Output_data_expression::do_print_to_mapfile): New function.
11509 * script.cc (read_input_script): Add mapfile parameter. Change
11511 * script.h (read_input_script): Update declaration.
11512 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
11513 (Eh_frame::do_print_to_mapfile): New function.
11514 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
11515 (Output_merge_string::do_print_to_mapfile): New function.
11516 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
11518 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
11520 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
11522 * Makefile.am (CCFILES): Add mapfile.cc.
11523 (HFILES): Add mapfile.h.
11524 * Makefile.in: Rebuild.
11526 2008-05-19 Ian Lance Taylor <iant@google.com>
11528 * options.h (class General_options): Add -z relro.
11529 * layout.cc (Layout::Layout): Initialize relro_segment_.
11530 (Layout::add_output_section_data): Return the output section.
11531 (Layout::make_output_section): Rcognize relro sections and mark
11532 them appropriately.
11533 (Layout::attach_allocated_section_to_segment): Put relro sections
11534 in a PT_GNU_RELRO segment.
11535 (Layout::create_initial_dynamic_sections): Mark the .dynamic
11537 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11539 (Layout::linkonce_mapping): Map d.rel.ro.local to
11540 .data.rel.ro.local.
11541 (Layout::output_section_name): Us .data.rel.ro.local for any
11542 section which begins with that.
11543 * layout.h (class Layout): Update add_output_section_data
11544 declaration. Add relro_segment_ field.
11545 * output.cc (Output_section::Output_section): Initialize is_relro_
11546 and is_relro_local_ fields.
11547 (Output_segment::add_output_section): Group relro sections.
11548 (Output_segment::is_first_section_relro): New function.
11549 (Output_segment::maximum_alignment): If there is a relro section,
11550 align the segment to the common page size.
11551 (Output_segment::set_section_addresses): Track whether we are
11552 looking at relro sections. If the last section is a relro
11553 section, align to the common page size.
11554 (Output_segment::set_section_list_addresses): Add in_relro
11555 parameter. Change all callers. Align to the page size when
11556 moving from relro to non-relro section.
11557 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
11559 * output.h (class Output_section): Add is_relro_ and
11560 is_relro_local_ fields.
11561 (Output_section::is_relro): New function.
11562 (Output_section::set_is_relro): New function.
11563 (Output_section::is_relro_local): New function.
11564 (Output_section::set_is_relro_local): New function.
11565 (class Output_segment): Update declarations.
11566 * i386.cc (Target_i386::got_section): Mark .got section as relro.
11567 * sparc.cc (Target_sparc::got_section): Likewise.
11568 * x86_64.cc (Target_x86_64::got_section): Likewise.
11569 * testsuite/relro_test_main.cc: New file.
11570 * testsuite/relro_test.cc: New file.
11571 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11572 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11573 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11574 (relro_test.so, relro_test_pic.o): New targets.
11575 * testsuite/Makefile.in: Rebuild.
11577 2008-05-16 Ian Lance Taylor <iant@google.com>
11579 * output.cc (Output_segment::add_output_section): Remove front
11581 * output.h (class Output_segment): Remove
11582 add_initial_output_section and overloaded add_output_section.
11583 Update declaration of remaining add_output_section.
11584 * layout.cc (Layout::create_interp): Call add_output_section
11585 rather than add_initial_output_section.
11586 (Layout::finish_dynamic_section): Likewise.
11588 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
11589 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
11590 know the dynamic type.
11591 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
11592 field. Initialize it in constructor.
11593 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
11594 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
11595 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
11598 * output.cc (Output_reloc::get_address): Change return type to
11600 * output.h (class Output_reloc): Update get_address declaration.
11601 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
11602 for section addresses.
11604 2008-05-09 Ian Lance Taylor <iant@google.com>
11607 * gold.cc (gold_nomem): Use return value of write.
11609 2008-05-08 Ian Lance Taylor <iant@google.com>
11611 * symtab.c (Symbol::init_base_output_data): Add version
11612 parameter. Change all callers.
11613 (Symbol::init_base_output_segment): Likewise.
11614 (Symbol::init_base_constant): Likewise.
11615 (Symbol::init_base_undefined): Likewise.
11616 (Sized_symbol::init_output_data): Likewise.
11617 (Sized_symbol::init_output_segment): Likewise.
11618 (Sized_symbol::init_constant): Likewise.
11619 (Sized_symbol::init_undefined): Likewise.
11620 (Symbol_table::do_define_in_output_data): If the new symbol has a
11621 version, mark it as the default.
11622 (Symbol_table::do_define_in_output_segment): Likewise.
11623 (Symbol_table::do_define_as_constant): Likewise.
11624 * symtab.h (class Symbol): Update declarations.
11625 (class Sized_symbol): Likewise.
11626 * resolve.cc (Symbol::override_version): New function.
11627 (Symbol::override_base): Call override_version.
11628 (Symbol::override_base_with_special): Likewise.
11629 * testsuite/ver_script_8.script: New file.
11630 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
11631 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
11632 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
11633 (ver_test_8_1.so, ver_test_8_2.so): New targets.
11635 2008-05-06 Ian Lance Taylor <iant@google.com>
11638 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
11640 (class General_options): Remove existing --undefined, and add
11641 --no-undefined instead. Add new --undefined as synonym for -u.
11642 * archive.cc (Archive::add_symbols): Check whether symbol was
11644 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
11645 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
11646 all uses. Add IS_UNDEFINED. Update declarations to split
11647 different versions of init_base. Declare init_base_undefined.
11648 (Symbol::is_defined): Handle IS_UNDEFINED.
11649 (Symbol::is_undefined): Likewise.
11650 (Symbol::is_weak_undefined): Call is_undefined.
11651 (Symbol::is_absolute): Handle IS_CONSTANT.
11652 (class Sized_symbol): Update declarations to split different
11653 versions of init. Declare init_undefined.
11654 (class Symbol_table): Declare new functions.
11655 * symtab.cc (Symbol::init_base_object): Rename from init_base.
11656 Change all callers.
11657 (Symbol::init_base_output_data): Likewise.
11658 (Symbol::init_base_output_segment): Likewise.
11659 (Symbol::init_base_constant): Likewise.
11660 (Symbol::init_base_undefined): New function.
11661 (Sized_symbol::init_object): Rename from init. Change all
11663 (Sized_symbol::init_output_data): Likewise.
11664 (Sized_symbol::init_output_segment): Likewise.
11665 (Sized_symbol::init_constant): Likewise.
11666 (Sized_symbol::init_undefined): New function.
11667 (Symbol_table::add_undefined_symbols_from_command_line): New
11669 (Symbol_table::do_add_undefined_symbols_from_command_line): New
11671 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
11672 (Symbol::output_section): Likewise.
11673 (Symbol::set_output_section): Likewise.
11674 (Symbol_table::sized_finalize_symbol): Likewise.
11675 (Symbol_table::sized_write_globals): Likewise.
11676 * resolve.cc (Symbol_table::should_override): Likewise.
11677 (Symbol::override_base_with_special): Likewise.
11679 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
11680 symbol, change it to have default visibility.
11681 * testsuite/protected_1.cc: New file.
11682 * testsuite/protected_2.cc: New file.
11683 * testsuite/protected_3.cc: New file.
11684 * testsuite/protected_main_1.cc: New file.
11685 * testsuite/protected_main_2.cc: New file.
11686 * testsuite/protected_main_3.cc: New file.
11687 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
11688 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
11689 (protected_1_LDFLAGS, protected_1_LDADD): Define.
11690 (protected_1.so): New target.
11691 (protected_1_pic.o, protected_2_pic.o): New targets.
11692 (protected_3_pic.o): New target.
11693 (check_PROGRAMS): Add protected_2.
11694 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
11695 (protected_2_LDFLAGS, protected_2_LDADD): Define.
11696 * testsuite/Makefile.in: Rebuild.
11698 * options.h (DEFINE_var): Add set_user_set_##varname__.
11699 (DEFINE_bool_alias): New macro.
11700 (class General_options): Define -Bstatic using DEFINE_bool_alias
11701 rather than DEFINE_special. Add --undefined as an alias for -z
11703 * options.cc (General_options::parse_Bstatic): Remove.
11705 * options.h (class General_options): Add --fatal-warnings.
11706 * main.cc (main): Implement --fatal-warnings.
11707 * errors.h (Errors::warning_count): New function.
11709 * options.h (class General_options): Add -Bsymbolic-functions.
11710 * symtab.h (Symbol::is_preemptible): Check for
11711 -Bsymbolic-functions.
11713 2008-05-05 Ian Lance Taylor <iant@google.com>
11715 * options.h (DEFINE_bool): For DASH_Z, create the negative option
11716 as noVARNAME rather than no-VARNAME.
11717 (class General_options): Add option -z combreloc.
11718 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
11720 (Output_reloc::sort_before) [SHT_REL]: New function.
11721 (Output_reloc::sort_before) [SHT_RELA]: New function.
11722 (class Output_data_reloc_base): Add sort_relocs_ field. Define
11723 Sort_relocs_comparison.
11724 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
11725 parameter. Change all callers.
11726 (Output_data_reloc::Output_data_reloc) [both versions]: Add
11727 sort_relocs parameter. Change all callers.
11728 * output.cc (Output_reloc::get_address): New function, broken out
11730 (Output_reloc::write_rel): Call it.
11731 (Output_reloc::compare): New function.
11732 (Output_data_reloc_base::do_write): Optionally sort relocs.
11734 * configure.ac: If targ_extra_obj is set, link it in.
11735 * configure.tgt: Initialize all variables.
11736 (x86_64*): Set targ_extra_obj and targ_extra_size.
11737 * configure: Rebuild.
11739 * object.cc (Sized_relobj::include_section_group): Adjust section
11740 indexes read from group data. Build vector to pass to
11742 * layout.cc (Layout::layout_group): Add flags and shndxes
11743 parameters. Remove contents parameter. Change caller. Update
11744 explicit instantiations.
11745 * layout.h (class Layout): Update layout_group declaration.
11746 * output.cc (Output_data_group::Output_data_group): Add flags and
11747 input_shndxes parameters. Remove contents parameter. Change
11749 (Output_data_group::do_write): Change input_sections_ to
11751 * output.h (class Output_data_group): Update constructor
11752 declaration. Rename input_sections_ to input_shndxes_.
11753 * testsuite/many_sections_test.cc: Add template.
11755 2008-04-30 Cary Coutant <ccoutant@google.com>
11757 * target-reloc.h (relocate_section): Fix dead-pointer bug.
11759 * layout.cc (Layout::include_section): Refactored check for debug
11761 (Layout::add_comdat): Add new parameters. Change type
11762 of signature parameter. Add object and shndx to signatures table.
11763 (Layout::find_kept_object): New function.
11764 * layout.h: Include <cstring>.
11765 (Layout::is_debug_info_section): New function.
11766 (Layout::add_comdat): Add new parameters.
11767 (Layout::find_kept_object): New function.
11768 (Layout::Kept_section): New struct.
11769 (Layout::Signatures): Change type of map range.
11770 * object.cc (Relobj::output_section_address): New function.
11771 (Sized_relobj::include_section_group): Add new parameters. Change
11772 calls to Layout::add_comdat. Change to build table of kept comdat
11773 groups and table mapping discarded sections to kept sections.
11774 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
11775 (Sized_relobj::do_layout): Change calls to include_section_group and
11776 include_linkonce_section.
11777 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
11778 value to zero when section is discarded.
11779 (Sized_relobj::map_to_kept_section): New function.
11780 * object.h (Relobj::output_section_address): New function.
11781 (Relobj::Comdat_group): New type.
11782 (Relobj::find_comdat_group): New function.
11783 (Relobj::Comdat_group_table): New type.
11784 (Relobj::Kept_comdat_section): New type.
11785 (Relobj::Kept_comdat_section_table): New type.
11786 (Relobj::add_comdat_group): New function.
11787 (Relobj::set_kept_comdat_section): New function.
11788 (Relobj::get_kept_comdat_section): New function.
11789 (Relobj::comdat_groups_): New field.
11790 (Relobj::kept_comdat_sections_): New field.
11791 (Symbol_value::input_value): Update comment.
11792 (Sized_relobj::map_to_kept_section) New function.
11793 (Sized_relobj::include_linkonce_section): Add new parameter.
11794 * target-reloc.h (Comdat_behavior): New type.
11795 (get_comdat_behavior): New function.
11796 (relocate_section): Add code to map a discarded section to the
11797 corresponding kept section when applying a relocation.
11799 2008-04-30 Craig Silverstein <csilvers@google.com>
11801 * dwarf_reader.cc (next_generation_count): New static var.
11802 (Addr2line_cache_entry): New struct.
11803 (addr2line_cache): New static var.
11804 (Dwarf_line_info::one_addr2line): Added caching.
11805 (Dwarf_line_info::clear_addr2line_cache): New function.
11806 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
11807 cache-size parameter.
11808 (Dwarf_line_info::one_addr2line_cache): New function.
11809 * symtab.cc (Symbol_table::detect_odr_violations): Pass
11810 new cache-size argument to one_addr2line(), and clear cache.
11812 2008-04-28 Cary Coutant <ccoutant@google.com>
11814 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
11815 R_386_PC8 relocations.
11817 2008-04-23 Ian Lance Taylor <iant@google.com>
11819 * object.cc (Sized_relobj::include_section_group): Check for
11820 invalid section group.
11822 * object.cc (make_elf_object): Correct test for 64-bit ELF file
11825 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
11826 than read for file header.
11827 * archive.cc (Archive::include_member): Likewise.
11829 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
11831 * aclocal.m4: Regenerate.
11832 * configure: Regenerate.
11834 2008-04-19 Ian Lance Taylor <iant@google.com>
11836 * version.cc (version_string): Bump to 1.6.
11838 * testsuite/Makefile.am (many_sections_r_test): New target.
11839 (many_sections_r_test_SOURCES): Remove.
11840 (many_sections_r_test_DEPENDENCIES): Remove.
11841 (many_sections_r_test_LDFLAGS): Remove.
11842 (many_sections_r_test_LDADD): Remove.
11844 * object.cc (Sized_relobj::do_add_symbols): Always pass
11845 local_symbol_count_ to add_from_relobj.
11847 * testsuite/Makefile.am (many_sections_check.h): Only check one in
11848 every thousand variables.
11849 * testsuite/Makefile.in: Rebuild.
11851 * object.cc (Xindex::initialize_symtab_xindex): New function.
11852 (Xindex::read_symtab_xindex): New function.
11853 (Xindex::sym_xindex_to_shndx): New function.
11854 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
11856 (Sized_relobj::do_initialize_xindex): New function.
11857 (Sized_relobj::do_read_symbols): Adjust section links.
11858 (Sized_relobj::symbol_section_and_value): Add is_ordinary
11859 parameter. Change all callers.
11860 (Sized_relobj::include_section_group): Adjust section links and
11861 symbol section indexes.
11862 (Sized_relobj::do_layout): Adjust section links.
11863 (Sized_relobj::do_count_local_symbols): Adjust section links and
11864 symbol section indexes.
11865 (Sized_relobj::do_finalize_local_symbols): Distinguish between
11866 ordinary and special symbols.
11867 (Sized_relobj::write_local_symbols): Add symtab_xindex and
11868 dynsym_xindex parameters. Change all callers. Adjust section
11869 links. Use SHN_XINDEX when needed.
11870 (Sized_relobj::get_symbol_location_info): Adjust section links.
11871 Don't get fooled by special symbols.
11872 * object.h (class Xindex): Define.
11873 (class Object): Add xindex_ parameter. Declare virtual functoin
11874 do_initialize_xindex.
11875 (Object::adjust_sym_shndx): New function.
11876 (Object::set_xindex): New protected function.
11877 (class Symbol_value): Add is_ordinary_shndx_ field.
11878 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
11879 (Symbol_value::value): Assert ordinary section.
11880 (Symbol_value::initialize_input_to_output_map): Likewise.
11881 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
11882 Change all callers.
11883 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
11885 (class Sized_relobj): Update declarations.
11886 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
11887 parameter. Change all callers.
11888 (Sized_relobj::adjust_shndx): New function.
11889 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
11891 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
11892 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
11893 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
11894 (Sized_dynobj::read_dynsym_section): Adjust section links.
11895 (Sized_dynobj::read_dynamic): Likewise.
11896 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
11898 (Sized_dynobj::do_initialize_xindex): New function.
11899 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
11900 do_initialize_xindex.
11901 (Sized_dynobj::adjust_shndx): New function.
11902 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
11903 dynsym_xindex_ fields.
11904 (Layout::finalize): Add a call to set_section_indexes before
11905 creating the symtab sections.
11906 (Layout::set_section_indexes): Don't do anything if the section
11907 already has a section index.
11908 (Layout::create_symtab_sections): Add shnum parameter. Change
11909 caller. Create .symtab_shndx section if needed.
11910 (Layout::create_shdrs): Add shstrtab_section parameter. Change
11912 (Layout::allocated_output_section_count): New function.
11913 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
11915 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
11916 fields. Update declarations.
11917 (Layout::symtab_xindex): New function.
11918 (Layout::dynsym_xindex): New function.
11919 (class Write_symbols_task): Add layout_ field.
11920 (Write_symbols_task::Write_symbols_task): Add layout parameter.
11922 * output.cc (Output_section_headers::Output_section_headers): Add
11923 shstrtab_section parameter. Change all callers.
11924 (Output_section_headers::do_sized_write): Store overflow values
11925 for section count and section string table section index in
11926 section header zero.
11927 (Output_file_header::do_sized_write): Check for overflow of
11928 section count and section string table section index.
11929 (Output_symtab_xindex::do_write): New function.
11930 (Output_symtab_xindex::endian_do_write): New function.
11931 * output.h (class Output_section_headers): Add shstrtab_section_.
11932 Update declarations.
11933 (class Output_symtab_xindex): Define.
11934 (Output_section::has_out_shndx): New function.
11935 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
11937 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
11938 Change all callers.
11939 (Sized_symbol::init): Likewise.
11940 (Symbol::output_section): Check for ordinary symbol.
11941 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
11942 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
11944 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
11945 Change all callers. Simplify handling of symbols from sections
11946 not included in the link.
11947 (Symbol_table::add_from_dynobj): Handle ordinary symbol
11949 (Weak_alias_sorter::operator()): Assert that symbols are
11951 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
11953 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
11954 parameters. Change all callers.
11955 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
11956 symbol distinction. Use SHN_XINDEX when needed.
11957 (Symbol_table::write_section_symbol): Add symtab_xindex
11958 parameter. Change all callers.
11959 (Symbol_table::sized_write_section_symbol): Likewise. Use
11960 SHN_XINDEX when needed.
11961 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
11963 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
11964 (Symbol::is_defined): Check is_ordinary.
11965 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
11966 (Symbol::is_absolute, Symbol::is_common): Likewise.
11967 (class Sized_symbol): Update declarations.
11968 (class Symbol_table): Update declarations.
11969 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
11970 parameters. Change all callers.
11971 (Sized_symbol::override): Likewise.
11972 (Symbol_table::override): Likewise.
11973 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
11974 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
11975 is_ordinary, and orig_st_shndx parameters. Change all callers.
11976 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
11977 to be in an ordinary section.
11978 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
11979 object and is_ordinary parameters. Change all callers.
11980 (Sized_dwarf_line_info::read_relocs): Add object parameter.
11981 Change all callers. Don't add undefined or non-ordinary symbols
11983 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
11984 Change all callers.
11985 * dwarf_reader.h (class Sized_dwarf_line_info): Update
11987 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
11988 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
11989 (Sized_relobj::relocate_sections): Likewise.
11990 * target-reloc.h (scan_relocs): Adjust section symbol index.
11991 (scan_relocatable_relocs): Likewise.
11992 * i386.cc (Scan::local): Check for ordinary symbols.
11993 * sparc.cc (Scan::local): Likewise.
11994 * x86_64.cc (Scan::local): Likewise.
11995 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
11996 to symbol_section_and_value.
11997 * testsuite/many_sections_test.cc: New file.
11998 * testsuite/Makefile.am (BUILT_SOURCES): Define.
11999 (check_PROGRAMS): Add many_sections_test.
12000 (many_sections_test_SOURCES): Define.
12001 (many_sections_test_DEPENDENCIES): Define.
12002 (many_sections_test_LDFLAGS): Define.
12003 (BUILT_SOURCES): Add many_sections_define.h.
12004 (many_sections_define.h): New target.
12005 (BUILT_SOURCES): Add many_sections_check.h.
12006 (many_sections_check.h): New target.
12007 (check_PROGRAMS): Add many_sections_r_test.
12008 (many_sections_r_test_SOURCES): Define.
12009 (many_sections_r_test_DEPENDENCIES): Define.
12010 (many_sections_r_test_LDFLAGS): Define.
12011 (many_sections_r_test_LDADD): Define.
12012 (many_sections_r_test.o): New target.
12013 * testsuite/Makefile.in: Rebuild.
12015 2008-04-17 Cary Coutant <ccoutant@google.com>
12017 * errors.cc (Errors::info): New function.
12018 (gold_info): New function.
12019 * errors.h (Errors::info): New function.
12020 * gold.h (gold_info): New function.
12021 * object.cc (Input_objects::add_object): Print trace output.
12022 * options.cc (options::parse_set): New function.
12023 (General_options::parse_wrap): Deleted.
12024 (General_options::General_options): Deleted initializer.
12025 * options.h (options::String_set): New typedef.
12026 (options::parse_set): New function.
12027 (DEFINE_set): New macro.
12028 (General_options::wrap): Changed to use DEFINE_set. Changed
12029 callers of any_wrap_symbols and is_wrap_symbol.
12030 (General_options::trace, General_options::trace_symbol):
12032 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
12033 (General_options::wrap_symbols_): Deleted.
12034 * symtab.cc (Symbol_table::add_from_object): Print trace output.
12036 2008-04-17 David S. Miller <davem@davemloft.net>
12038 * options.cc (General_options::parse_V): New function.
12039 * options.h: Add entries for -V and -Qy.
12041 2008-04-17 Ian Lance Taylor <iant@google.com>
12043 * common.cc (Symbol_table::allocate_commons): Remove options
12044 parameter. Change caller.
12045 (Symbol_table::do_allocate_commons): Remove options parameter.
12046 Change caller. Just call do_allocate_commons_list twice.
12047 (Symbol_table::do_allocate_commons_list): New function, broken out
12048 of do_allocate_commons.
12049 * common.h (class Allocate_commons_task): Remove options_ field.
12050 Update constructor.
12051 * symtab.cc (Symbol_table::Symbol_table): Initialize
12053 (Symbol_table::add_from_object): Put TLS common symbols on
12055 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
12056 which are IN_OUTPUT_DATA.
12057 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
12058 allocate_commons and do_allocate_commons declarations. Declare
12059 do_allocate_commons_list.
12060 * gold.cc (queue_middle_tasks): Update creation of
12061 Allocate_commons_task to not pass options.
12062 * testsuite/Makefile.am (INCLUDES): Add -I.. .
12063 (TLS_TEST_C_FLAGS): New variable.
12064 (tls_test_c_pic.o): New target.
12065 (tls_test_shared.so): Link in tls_test_c_pic.o.
12066 (tls_test_c_pic_ie.o): New target.
12067 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
12068 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
12069 (tls_test_c.o): New target.
12070 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
12071 (tls_pic_test_LDADD): Likewise.
12072 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
12073 (tls_shared_gd_to_ie_test_LDADD): Likewise.
12074 (tls_test_c_gnu2.o): New target.
12075 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
12077 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
12078 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
12079 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
12080 * testsuite/tls_test.cc: Include "config.h".
12081 (t_last): Call t11_last.
12082 * testsuite/tls_test.h (t11, t11_last): Declare.
12083 * testsuite/tls_test_c.c: New file.
12084 * testsuite/tls_test_main.cc (thread_routine): Call t11.
12085 * configure.ac: Check for OpenMP support.
12086 * configure, config.in, Makefile.in: Rebuild.
12087 * testsuite/Makefile.in: Rebuild.
12089 2008-04-16 Cary Coutant <ccoutant@google.com>
12091 * i386.cc (Target_i386::define_tls_base_symbol): New function.
12092 (Target_i386::tls_base_symbol_defined_): New field.
12093 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12094 (Target_i386::Scan::global): Likewise.
12095 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
12096 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
12097 (Target_x86_64::tls_base_symbol_defined_): New field.
12098 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12099 (Target_x86_64::Scan::global): Likewise.
12101 2008-04-16 Cary Coutant <ccoutant@google.com>
12103 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
12104 (Symbol::needs_plt_entry): Allow weak undefined symbols.
12105 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
12106 building shared libraries.
12107 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
12108 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
12109 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
12110 * testsuite/Makefile.in: Rebuild.
12111 * testsuite/weak_undef.h: New file.
12112 * testsuite/weak_undef_file1.cc: Add extra test cases.
12113 * testsuite/weak_undef_file2.cc: Likewise.
12114 * testsuite/weak_undef_test.cc: Likewise.
12116 2008-04-16 David S. Miller <davem@davemloft.net>
12118 * sparc.cc (Target_sparc::Scan): Change from struct to class.
12119 Add issued_non_pic_error_ field. Declare check_non_pic.
12120 (Target_sparc::Scan::check_non_pic): New function.
12121 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
12122 (Target_sparc::Scan::global): Likewise.
12124 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
12125 * configure: Rebuild.
12127 * options.h (DEFINE_enable): New macro.
12128 (new_dtags): New enable option.
12129 (initfirst, interpose, loadfltr, nodefaultlib,
12130 nodelete, nodlopen, nodump): New -z options.
12131 * layout.cc (Layout:finish_dynamic_section): If new
12132 dtags enabled, emit DT_RUNPATH. Also, emit a
12133 DT_FLAGS_1 containing any specified -z flags.
12135 2008-04-16 Ian Lance Taylor <iant@google.com>
12137 * copy-relocs.cc: New file.
12138 * copy-relocs.h: New file.
12139 * reloc.cc: Remove Copy_relocs code.
12140 * reloc.h: Likewise.
12141 * reloc-types.h (struct Reloc_types) [both versions]: Add
12142 get_reloc_addend_noerror.
12143 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
12144 variants of add_global which take an addend which must be zero.
12145 * i386.cc: Include "copy-relocs.h".
12146 (class Target_i386): Change type of copy_relocs_ to variable,
12147 update initializer.
12148 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
12149 Change all callers.
12150 (Target_i386::do_finalize_sections): Change handling of
12152 * sparc.cc: Include "copy-relocs.h".
12153 (class Target_sparc): Change type of copy_relocs_ to variable,
12154 update initializer.
12155 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
12156 Change all callers.
12157 (Target_sparc::do_finalize_sections): Change handling of
12159 * x86_64.cc: Include "copy-relocs.h".
12160 (class Target_x86_64): Change type of copy_relocs_ to variable,
12161 update initializer.
12162 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
12163 class. Change all callers.
12164 (Target_x86_64::do_finalize_sections): Change handling of
12166 * Makefile.am (CCFILES): Add copy-relocs.cc.
12167 (HFILES): Add copy-relocs.h.
12169 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
12171 * testsuite/script_test_4.sh: Permit leading zeroes.
12173 2008-04-15 Ian Lance Taylor <iant@google.com>
12175 * script-sections.cc (Script_sections::create_segments): Use
12176 header_size_adjustment even when there is enough room for the
12178 * testsuite/script_test_4.sh: New file.
12179 * testsuite/script_test_4.t: New file.
12180 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
12181 (check_DATA): Add script_test_4.stdout.
12182 (MOSTLYCLEANFILES): Likewise.
12183 (script_test_4): New target.
12184 (script_test_4.stdout): New target.
12185 * testsuite/Makefile.in: Rebuild.
12187 * sparc.cc: Add definitions for Output_data_plt_sparc class
12190 2008-04-14 David S. Miller <davem@davemloft.net>
12192 * sparc.cc: New file.
12193 * Makefile.am (TARGETSOURCES): Add sparc.cc
12194 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
12195 * configure.tgt: Document targ_extra_size and
12196 targ_extra_big_endian. Add entries for sparc-* and
12198 * configure.ac: Handle targ_extra_size and
12199 targ_extra_big_endian.
12200 * Makefile.in: Rebuild.
12201 * configure: Likewise.
12202 * po/POTFILES.in: Likewise.
12203 * po/gold.pot: Likewise.
12205 2008-04-14 Ian Lance Taylor <iant@google.com>
12207 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
12208 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
12209 in the name/type/flags to section mapping. Don't call
12210 allocate_output_section.
12211 (Layout::choose_output_section): Change parameter from adjust_name
12212 to is_input_section. Don't permit input sections after sections
12213 are attached to segments. Don't call allocate_output_section.
12214 (Layout::layout_eh_frame): Call update_flags_for_input_section,
12215 not write_enable_output_section.
12216 (Layout::make_output_section): Don't push to
12217 unattached_section_list_ nor call attach_to_segment. Call
12218 attach_section_to_segment if sections are attached.
12219 (Layout::attach_sections_to_segments): New function.
12220 (Layout::attach_section_to_segment): New function.
12221 (Layout::attach_allocated_section_to_segment): Rename from
12222 attach_to_segment. Remove flags parameter.
12223 (Layout::allocate_output_section): Remove function.
12224 (Layout::write_enable_output_section): Remove function.
12225 * layout.h (class Layout): Update for above changes. Add new
12226 field sections_are_attached_.
12227 * output.h (Output_section::update_flags_for_input_section): New
12229 * output.cc (Output_section::add_input_section): Call
12230 update_flags_for_input_section.
12231 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
12233 2008-04-11 Cary Coutant <ccoutant@google.com>
12235 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
12236 thought unnecessary.
12237 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
12239 2008-04-11 Ian Lance Taylor <iant@google.com>
12241 * output.h (class Output_section_data): Remove inline definition
12243 * output.cc (Output_section_data::set_addralign): New function.
12245 2008-04-11 Cary Coutant <ccoutant@google.com>
12247 Add support for TLS descriptors for i386 and x86_64.
12248 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
12249 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
12250 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
12252 (Target_i386::got_mod_index_entry): Remove unnecessary code.
12253 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
12254 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
12256 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
12257 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
12258 Fix problem with initial-exec relocations.
12259 (Target_i386::Relocate::relocate_tls): Likewise.
12260 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
12262 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
12263 support for section-plus-offset dynamic table entries.
12264 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
12265 (Output_data_dynamic::Dynamic_entry): Add support for
12266 section-plus-offset dynamic table entries.
12267 (Output_data_dynamic::Classification): Likewise.
12268 (Output_data_dynamic::classification_): Renamed offset_.
12269 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
12270 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
12271 (Target_x86_64::make_plt_section): New function.
12272 (Target_x86_64::reserve_tlsdesc_entries): New function.
12273 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
12274 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
12275 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
12276 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
12277 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
12278 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
12279 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
12280 add extra PLT entry for TLS descriptors.
12281 (Output_data_plt_x86_64::got_): New field.
12282 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
12283 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
12285 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
12287 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
12288 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
12289 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
12290 R_386_TLS_DESC_CALL relocations.
12291 (Target_x86_64::Scan::global): Likewise.
12292 (Target_x86_64::do_finalize_sections): Add dynamic table entries
12293 for TLS descriptors.
12294 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
12295 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
12296 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
12297 GD-to-IE relaxation.
12298 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
12299 and TLS_DESCRIPTORS.
12300 * Makefile.in: Rebuild.
12301 * configure: Rebuild.
12302 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
12303 (tls_test_shared2.so): New target.
12304 (tls_shared_gd_to_ie_test_SOURCES): New variable.
12305 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
12306 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
12307 (tls_shared_gd_to_ie_test_LDADD): New variable.
12308 (tls_shared_gnu2_gd_to_ie_test): New target.
12309 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
12311 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
12312 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
12313 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
12314 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
12315 (tls_shared_gnu2_test): New target.
12316 (tls_test_gnu2_shared.so): New target.
12317 (tls_shared_gnu2_test_SOURCES): New variable.
12318 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
12319 (tls_shared_gnu2_test_LDFLAGS): New variable.
12320 (tls_shared_gnu2_test_LDADD): New variable.
12321 * testsuite/Makefile.in: Rebuild.
12322 * testsuite/Makefile.
12324 2008-04-11 Ian Lance Taylor <iant@google.com>
12326 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
12328 * testsuite/Makefile.in: Rebuild.
12330 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
12332 * testsuite/script_test_2.cc (main): Adjust test.
12334 2008-04-11 David S. Miller <davem@davemloft.net>
12335 Ian Lance Taylor <iant@google.com>
12337 * options.h (General_options): Add entries for '-Y' and
12339 * options.cc (General_options:finalize): If -Y was used, add those
12340 entries to the library path instead of the default "/lib" and
12343 2008-04-11 David S. Miller <davem@davemloft.net>
12345 * testsuite/justsyms.t: Start at 0x100.
12346 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
12347 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
12349 * testsuite/script_test_2.cc: Adjust string and section length
12352 2008-04-09 Ian Lance Taylor <iant@google.com>
12355 * script-sections.cc (Sections_element::allocate_to_segment): Add
12357 (Output_section_definition::allocate_to_segment): Likewise.
12358 (Orphan_output_section::allocate_to_segment): Likewise.
12359 (Script_sections::attach_sections_using_phdrs_clause): Don't
12360 propagate non-PT_LOAD segments to orphan sections.
12361 * testsuite/Makefile.am (script_test_3.stdout): Generate using
12362 readelf rather than objdump.
12363 * testsuite/script_test_3.sh: Adjust accordingly. Test that
12364 .interp section and PT_INTERP segment are the same size.
12365 * testsuite/Makefile.in: Rebuild.
12367 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
12368 aliases for symbols defined in the same object.
12369 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
12370 (weak_alias_test_SOURCES): New variable.
12371 (weak_alias_test_DEPENDENCIES): New variable.
12372 (weak_alias_test_LDFLAGS): New variable.
12373 (weak_alias_test_LDADD): New variable.
12374 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
12375 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
12376 (weak_alias_test_3.o): New target.
12377 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
12378 * testsuite/weak_alias_test_main.cc: New file.
12379 * testsuite/weak_alias_test_1.cc: New file.
12380 * testsuite/weak_alias_test_2.cc: New file.
12381 * testsuite/weak_alias_test_3.cc: New file.
12383 2008-04-08 Ian Lance Taylor <iant@google.com>
12385 * options.h (class General_options): Add --noinhibit-exec option.
12386 * main.cc (main): Check --noinhibit-exec.
12388 * options.h (class General_options): Define --wrap as a special
12389 option. Add wrap_symbols_ field.
12390 (General_options::any_wrap_symbols): New function.
12391 (General_options::is_wrap_symbol): New function.
12392 * options.cc (General_options::parse_wrap): New function.
12393 (General_options::General_options): Initialize wrap_symbols_.
12394 * symtab.cc (Symbol_table::wrap_symbol): New function.
12395 (Symbol_table::add_from_object): Handle --wrap.
12396 * symtab.h (class Symbol_table): Declare wrap_symbol.
12397 * target.h (Target::wrap_char): New function.
12398 (Target::Target_info): Add wrap_char field.
12399 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
12400 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12401 * testsuite/testfile.cc (Target_test::test_target_info):
12404 * errors.cc (Errors::undefined_symbol): Mention symbol version if
12407 * layout.h (class Layout): Add added_eh_frame_data_ field.
12408 * layout.cc (Layout::Layout): Initialize new field.
12409 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
12410 output section until we find a section we merged successfully.
12411 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
12412 that the size be non-zero.
12414 * merge.cc (Object_merge_map::get_output_offset): Remove inline
12417 2008-04-08 Craig Silverstein <csilvers@google.com>
12419 * configure.ac: Export new conditional variable HAVE_ZLIB.
12420 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
12422 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
12423 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12425 2008-04-07 Ian Lance Taylor <iant@google.com>
12427 * version.cc (version_string): Set to "1.5".
12429 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
12430 Add issued_non_pic_error_ field. Declare check_non_pic.
12431 (Target_x86_64::Scan::check_non_pic): New function.
12432 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
12433 (Target_x86_64::Scan::global): Likewise.
12435 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
12436 addend parameter. Change caller. Handle merge sections.
12437 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
12438 Address to Addend. Don't add in the result of
12439 local_section_offset, pass down the addend and use the returned
12441 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
12442 Update declarations of local_section_offset and symbol_value.
12443 * testsuite/two_file_test_1.cc (t18): New function.
12444 * testsuite/two_file_test_2.cc (f18): New function.
12445 * testsuite/two_file_test_main.cc (main): Call t18.
12446 * testsuite/two_file_test.h (t18, f18): Declare.
12448 * configure.ac: Don't test for objdump, c++filt, or readelf.
12449 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
12451 (TEST_READELF): New variable.
12452 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
12453 (check_PROGRAMS): Add two_file_strip_test.
12454 (two_file_strip_test): New target.
12455 (check_PROGRAMS): Add two_file_same_shared_strip_test.
12456 (two_file_same_shared_strip_test_SOURCES): New variable.
12457 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
12458 (two_file_same_shared_strip_test_LDFLAGS): New variable.
12459 (two_file_same_shared_strip_test_LDADD): New variable.
12460 (two_file_shared_strip.so): New target.
12461 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
12462 (ver_test_5.syms, ver_test_7.syms): Likewise.
12463 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
12464 (strip_test_3.stdout): Use TEST_OBJDUMP.
12465 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12467 2008-04-04 Cary Coutant <ccoutant@google.com>
12469 * symtab.h (Symbol::is_weak_undefined): New function.
12470 (Symbol::is_strong_undefined): New function.
12471 (Symbol::is_absolute): New function.
12472 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
12473 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
12475 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
12476 (weak_undef_test): New target.
12477 * testsuite/Makefile.in: Rebuild.
12478 * testsuite/weak_undef_file1.cc: New file.
12479 * testsuite/weak_undef_file2.cc: New file.
12480 * testsuite/weak_undef_test.cc: New file.
12482 2008-04-03 Craig Silverstein <csilvers@google.com>
12484 * compressed_output.h (class Output_compressed_section): Use
12486 * compressed_output.cc (zlib_compress): Use unsigned buffers,
12488 (zlib_compressed_suffix): Removed.
12489 (Output_compressed_section::set_final_data_size): Use unsigned
12491 * testsuite/Makefile.am (flagstest_compress_debug_sections):
12492 Fix linker invocation.
12493 (flagstest_o_specialfile_and_compress_debug_sections):
12495 * testsuite/Makefile.in: Regenerated.
12497 2008-04-02 David S. Miller <davem@davemloft.net>
12499 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
12500 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
12502 2008-04-02 Craig Silverstein <csilvers@google.com>
12506 2008-04-02 Ian Lance Taylor <iant@google.com>
12508 * fileread.cc (File_read::find_view): Add byteshift and vshifted
12509 parameters. Update for new key type to views_. Change all
12511 (File_read::read): Adjust for byteshift in returned view.
12512 (File_read::add_view): New function, broken out of
12513 find_and_make_view.
12514 (File_read::make_view): New function, broken out of
12515 find_and_make_view.
12516 (File_read::find_or_make_view): Add offset and aligned
12517 parameters. Rewrite accordingly. Change all callers.
12518 (File_read::get_view): Add offset and aligned parameters. Adjust
12519 for byteshift in return value.
12520 (File_read::get_lasting_view): Likewise.
12521 * fileread.h (class File_read): Update declarations.
12522 (class File_read::View): Add byteshift_ field. Add byteshift to
12523 constructor. Add byteshift method.
12524 * archive.h (Archive::clear_uncached_views): New function.
12525 (Archive::get_view): Add aligned parameter. Change all callers.
12526 * object.h (Object::get_view): Add aligned parameter. Change all
12528 (Object::get_lasting_view): Likewise.
12530 * fileread.cc (File_read::release): Don't call clear_views if
12531 there are multiple objects.
12532 * fileread.h (File_read::clear_uncached_views): New function.
12533 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
12536 2008-03-31 Cary Coutant <ccoutant@google.com>
12538 Add thin archive support.
12539 * archive.cc (Archive::armagt): New const.
12540 (Archive::setup): Remove task parameter and calls to unlock.
12541 (Archive::unlock_nested_archives): New function.
12542 (Archive::read_header): Add nested_off parameter. Change
12544 (Archive::interpret_header): Likewise.
12545 (Archive::include_all_members): Change to handle thin
12547 (Archive::include_member): Likewise.
12548 * archive.h (Archive::Archive): Add new parameters and
12550 (Archive::armagt): New const.
12551 (Archive::setup): Remove task parameter.
12552 (Archive::unlock_nested_archives): New function.
12553 (Archive::read_header): Add nested_off parameter.
12554 (Archive::interpret_header): Likewise.
12555 (Archive::Nested_archive_table): New typedef.
12556 (Archive::is_thin_archive_): New field.
12557 (Archive::nested_archives_): New field.
12558 (Archive::options_): New field.
12559 (Archive::dirpath_): New field.
12560 (Archive::task_): New field.
12561 * readsyms.cc (Read_symbols::do_read_symbols): Add check
12562 for thin archives. Pass additional parameters to
12563 Archive::Archive. Unlock the archive file after calling
12566 2008-03-29 Ian Lance Taylor <iant@google.com>
12568 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12569 version symbol to be local.
12570 * testsuite/ver_test_4.sh: New file.
12571 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12572 (check_DATA): Add ver_test_4.syms.
12573 (ver_test_4.syms): New target.
12574 * testsuite/Makefile.in: Rebuild.
12577 (Output_section::Input_section_sort_entry::has_priority): New
12579 (Output_section::Input_section_sort_entry::match_file_name): New
12581 (Output_section::Input_section_sort_entry::match_section_name):
12583 (Output_section::Input_section_sort_entry::match_section_name_prefix):
12585 (Output_section::Input_section_sort_entry::match_section_file):
12587 (Output_section::Input_section_sort_compare::operator()): Rewrite
12588 using new Input_section_sort_entry functions. Sort crtbegin and
12589 crtend first. Sort sections with no priority before sections with
12591 * testsuite/initpri1.c (d3): Check j != 4.
12592 (cd5): New constructor/destructor function.
12593 (main): Check j != 2.
12595 * symtab.cc (Symbol_table::add_from_object): If we don't use the
12596 new symbol when resolving, don't call set_is_default.
12597 * testsuite/ver_test_7.cc: New file.
12598 * testsuite/ver_test_7.sh: New file.
12599 * testsuite/Makefile.am (ver_test_7.so): New target.
12600 (ver_test_7.o): New target.
12601 (check_SCRIPTS): Add ver_test_7.sh.
12602 (check_DATA): Add ver_test_7.syms.
12603 (ver_test_7.syms): New target.
12605 2008-03-28 Ian Lance Taylor <iant@google.com>
12607 * layout.cc (Layout::layout): If we see an input section with a
12608 name that needs sorting, set the must_sort flag for the output
12610 (Layout::make_output_section): If the name of the output section
12611 indicates that it might require sorting, set the may_sort flag.
12612 * output.h (Output_section::may_sort_attached_input_sections): New
12614 (Output_section::set_may_sort_attached_input_sections): New
12616 (Output_section::must_sort_attached_input_sections): New
12618 (Output_section::set_must_sort_attached_input_sections): New
12620 (class Output_section): Declare Input_section_sort_entry. Define
12621 Input_section_sort_compare. Declare
12622 sort_attached_input_sections. Add new fields:
12623 may_sort_attached_input_sections_,
12624 must_sort_attached_input_sections_,
12625 attached_input_sections_are_sorted_.
12626 * output.cc (Output_section::Output_section): Initialize new
12628 (Output_section::add_input_section): Add an entry to
12629 input_sections_ if may_sort or must_sort are true.
12630 (Output_section::set_final_data_size): Call
12631 sort_attached_input_sections if necessary.
12632 (Output_section::Input_section_sort_entry): Define new class.
12633 (Output_section::Input_section_sort_compare::operator()): New
12635 (Output_section::sort_attached_input_sections): New function.
12636 * configure.ac: Check whether the compiler supports constructor
12637 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
12638 * testsuite/initpri1.c: New file.
12639 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
12640 CONSTRUCTOR_PRIORITY.
12641 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
12642 (initpri1_LDFLAGS): New variable.
12643 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12645 2008-03-27 Ian Lance Taylor <iant@google.com>
12647 * common.cc (Sort_commons::operator): Correct sorting algorithm.
12648 * testsuite/common_test_1.c: New file.
12649 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
12650 (common_test_1_SOURCES): New variable.
12651 (common_test_1_DEPENDENCIES): New variable.
12652 (common_test_1_LDFLAGS): New variable.
12654 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
12655 and commons_ correctly when NAME/VERSION does not override
12657 * testsuite/ver_test_6.c: New file.
12658 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
12659 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
12660 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
12662 2008-03-26 Ian Lance Taylor <iant@google.com>
12664 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
12665 of an undefined symbol from a version script.
12666 * testsuite/Makefile.am (ver_test_5.so): New target.
12667 (ver_test_5.o): New target.
12668 (check_SCRIPTS): Add ver_test_5.sh.
12669 (check_DATA): Add ver_test_5.syms.
12670 (ver_test_5.syms): New target.
12671 * testsuite/ver_test_5.cc: New file.
12672 * testsuite/ver_test_5.script: New file.
12673 * testsuite/ver_test_5.sh: New file.
12674 * Makefile.in, testsuite/Makefile.in: Rebuild.
12677 Fix problems building gold with gcc 4.3.0.
12678 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
12679 (gold_error_at_location, gold_warning_at_location): Use it.
12680 * configure.ac: Check whether we can compile and use a template
12681 function with a printf attribute.
12682 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
12683 when jumping over bytes.
12684 * object.cc: Instantiate Object::read_section_data.
12685 * debug.h: Include <cstring>
12686 * dwarf_reader.cc: Include <algorithm>
12687 * main.cc: Include <cstring>.
12688 * options.cc: Include <cstring>.
12689 * output.cc: Include <cstring>.
12690 * script.cc: Include <cstring>.
12691 * script.h: Include <string>.
12692 * symtab.cc: Include <cstring> and <algorithm>.
12693 * target-select.cc: Include <cstring>.
12694 * version.cc: Include <string>.
12695 * testsuite/testmain.cc: Include <cstdlib>.
12696 * configure, config.in: Rebuild.
12698 2008-03-25 Ian Lance Taylor <iant@google.com>
12700 * options.cc: Include "../bfd/bfdver.h".
12701 (options::help): Print bug reporting address.
12703 * version.cc (print_version): Adjust output for current value of
12704 BFD_VERSION_STRING.
12708 * options.cc (options::help): Print list of supported targets.
12709 * target-select.h: Include <vector>.
12710 (class Target_selector): Make machine_, size_, and is_big_endian_
12711 fields const. Add bfd_name_ and instantiated_target_ fields.
12712 (Target_selector::Target_selector): Add bfd_name parameter.
12713 (Target_selector::recognize): Make non-virtual, call
12715 (Target_selector::recognize_by_name): Make non-virtual, call
12716 do_recognize_by_name.
12717 (Target_selector::supported_names): New function.
12718 (Target_selector::bfd_name): New function.
12719 (Target_selector::do_instantiate_target): New pure virtual
12721 (Target_selector::do_recognize): New virtual function.
12722 (Target_selector::do_recognize_by_name): New virtual function.
12723 (Target_selector::instantiate_target): New private function.
12724 (supported_target_names): Declare.
12725 * target-select.cc (Target_selector::Target_selector): Update for
12726 new parameter and fields.
12727 (select_target_by_name): Check that the name matches before
12728 calling recognize_by_name.
12729 (supported_target_names): New function.
12730 * i386.cc (class Target_selector_i386): Update Target_selector
12731 constructor call. Remove recognize and recognize_by_name. Add
12732 do_instantiate_target.
12733 * x86_64.cc (class Target_selector_x86_64): Likewise.
12734 * testsuite/testfile.cc (class Target_selector_test): Update for
12735 changes to Target_selector.
12737 * README: Rewrite, with some notes on unsupported features.
12739 2008-03-24 Cary Coutant <ccoutant@google.com>
12741 * i386.cc (Target_i386::Got_type): New enum declaration.
12742 (Target_i386::Scan::local): Updated callers of Output_data_got
12744 (Target_i386::Scan::global): Likewise.
12745 (Target_i386::Relocate::relocate): Likewise.
12746 (Target_i386::Relocate::relocate_tls): Likewise.
12747 * object.h (Got_offset_list): New class.
12748 (Sized_relobj::local_has_got_offset): Added got_type parameter.
12749 (Sized_relobj::local_got_offset): Likewise.
12750 (Sized_relobj::set_local_got_offset): Likewise.
12751 (Sized_relobj::local_has_tls_got_offset): Removed.
12752 (Sized_relobj::local_tls_got_offset): Removed.
12753 (Sized_relobj::set_local_tls_got_offset): Removed.
12754 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
12755 * output.cc (Output_data_got::add_global): Added got_type parameter.
12756 (Output_data_got::add_global_with_rel): Likewise.
12757 (Output_data_got::add_global_with_rela): Likewise.
12758 (Output_data_got::add_global_pair_with_rel): New function.
12759 (Output_data_got::add_global_pair_with_rela): New function.
12760 (Output_data_got::add_local): Added got_type parameter.
12761 (Output_data_got::add_local_with_rel): Likewise.
12762 (Output_data_got::add_local_with_rela): Likewise.
12763 (Output_data_got::add_local_pair_with_rel): New function.
12764 (Output_data_got::add_local_pair_with_rela): New function.
12765 (Output_data_got::add_global_tls): Removed.
12766 (Output_data_got::add_global_tls_with_rel): Removed.
12767 (Output_data_got::add_global_tls_with_rela): Removed.
12768 (Output_data_got::add_local_tls): Removed.
12769 (Output_data_got::add_local_tls_with_rel): Removed.
12770 (Output_data_got::add_local_tls_with_rela): Removed.
12771 * output.h (Output_data_got::add_global): Added got_type parameter.
12772 (Output_data_got::add_global_with_rel): Likewise.
12773 (Output_data_got::add_global_with_rela): Likewise.
12774 (Output_data_got::add_global_pair_with_rel): New function.
12775 (Output_data_got::add_global_pair_with_rela): New function.
12776 (Output_data_got::add_local): Added got_type parameter.
12777 (Output_data_got::add_local_with_rel): Likewise.
12778 (Output_data_got::add_local_with_rela): Likewise.
12779 (Output_data_got::add_local_pair_with_rel): New function.
12780 (Output_data_got::add_local_pair_with_rela): New function.
12781 (Output_data_got::add_global_tls): Removed.
12782 (Output_data_got::add_global_tls_with_rel): Removed.
12783 (Output_data_got::add_global_tls_with_rela): Removed.
12784 (Output_data_got::add_local_tls): Removed.
12785 (Output_data_got::add_local_tls_with_rel): Removed.
12786 (Output_data_got::add_local_tls_with_rela): Removed.
12787 * resolve.cc (Symbol::override_base_with_special): Removed
12788 reference to has_got_offset_ field.
12789 * symtab.cc (Symbol::init_fields): Replaced initialization
12790 of got_offset_ with got_offsets_. Removed initialization
12792 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
12793 (Symbol::got_offset): Likewise.
12794 (Symbol::set_got_offset): Likewise.
12795 (Symbol::has_tls_got_offset): Removed.
12796 (Symbol::tls_got_offset): Removed.
12797 (Symbol::set_tls_got_offset): Removed.
12798 (Symbol::got_offset_): Removed.
12799 (Symbol::tls_mod_got_offset_): Removed.
12800 (Symbol::tls_pair_got_offset_): Removed.
12801 (Symbol::got_offsets_): New field.
12802 (Symbol::has_got_offset): Removed.
12803 (Symbol::has_tls_mod_got_offset): Removed.
12804 (Symbol::has_tls_pair_got_offset): Removed.
12805 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
12806 (Target_x86_64::Scan::local): Updated callers of Output_data_got
12808 (Target_x86_64::Scan::global): Likewise.
12809 (Target_x86_64::Relocate::relocate): Likewise.
12810 (Target_x86_64::Relocate::relocate_tls): Likewise.
12812 2008-03-25 Ben Elliston <bje@au.ibm.com>
12814 * yyscript.y: Fix spelling error in comment.
12816 2008-03-24 Ian Lance Taylor <iant@google.com>
12818 * options.h (class General_options): Define build_id option.
12819 * layout.h (class Layout): Declare write_build_id, create_note,
12820 create_build_id. Add build_id_note_ member.
12821 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
12822 "libiberty.h", "md5.h", "sha1.h".
12823 (Layout::Layout): Initialize eh_frame_data_,
12824 eh_frame_hdr_section_, and build_id_note_.
12825 (Layout::finalize): Call create_build_id.
12826 (Layout::create_note): New function, broken out of
12827 Layout::create_gold_note.
12828 (Layout::create_gold_note): Call create_note.
12829 (Layout::create_build_id): New function.
12830 (Layout::write_build_id): New function.
12831 (Close_task_runner::run): Call write_build_id.
12833 * x86_64.cc: Correct license to GPLv3.
12835 2008-03-23 Ian Lance Taylor <iant@google.com>
12837 * options.cc: Include "demangle.h".
12838 (parse_optional_string): New function.
12839 (parse_long_option): Handle takes_optional_argument.
12840 (parse_short_option): Update dash_z initializer. Handle
12841 takes_optional_argument.
12842 (General_options::General_options): Initialize do_demangle_.
12843 (General_options::finalize): Set do_demangle_. Handle demangling
12845 * options.h (parse_optional_string): Declare.
12846 (struct One_option): Add optional_arg field. Update constructor.
12847 Update call constructor calls. Add takes_optional_argument
12849 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
12850 (DEFINE_optional_string): Define.
12851 (General_options::demangle): Change from DEFINE_bool to
12852 DEFINE_optional_string.
12853 (General_options::no_demangle): New function.
12854 (General_options::do_demangle): New function.
12855 (General_options::set_do_demangle): New function.
12856 (General_options::execstack_status_): Move definition to end of
12858 (General_options::static_): Likewise.
12859 (General_options::do_demangle_): New field.
12860 * object.cc (big_endian>::get_symbol_location_info): Call
12861 Options::do_demangle, not Options::demangle.
12862 * symtab.cc (demangle): Likewise.
12864 2008-03-22 Ian Lance Taylor <iant@google.com>
12866 * gold.h: Include <cstddef> and <sys/types.h>
12867 * options.h: Include <cstring>.
12869 2008-03-21 Ian Lance Taylor <iant@google.com>
12871 * Added source code to GNU binutils.