1 2012-04-26 Mark Wielaard <mjw@redhat.com>
3 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
4 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
5 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
6 DW_AT_high_pc as offset from DW_AT_low_pc.
8 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
9 * testsuite/Makefile.in: Regenerate.
10 * testsuite/gdb_index_test_3.c: New test source file.
11 * testsuite/gdb_index_test_3.sh: New test source file.
13 2012-04-25 Ian Lance Taylor <iant@google.com>
15 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
17 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
18 as a class, not a struct.
19 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
20 (Target_arm::apply_cortex_a8_workaround): Likewise.
21 * gc.h: Declare Reloc_types as a struct, not a class.
22 * object.h: Declare Symbols_data as a struct.
23 * reloc.h: Declare Read_relocs_data as a struct.
24 * target.h: Declare Relocate_info as a struct.
26 2012-04-24 David S. Miller <davem@davemloft.net>
28 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
29 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
32 2012-04-24 Cary Coutant <ccoutant@google.com>
34 * incremental-dump.cc (find_input_containing_global): Replace
35 magic number with symbolic constant.
36 (dump_incremental_inputs): Update version number.
37 * incremental.cc (Output_section_incremental_inputs): Update version
38 number; import symbolic constants from Incremental_inputs_reader.
39 (Incremental_inputs::create_data_sections): Align relocations
40 section correctly for 64-bit targets.
41 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
42 constants; add padding.
43 (Output_section_incremental_inputs::write_header): Add assert for
45 (Output_section_incremental_inputs::write_input_files): Add assert
47 (Output_section_incremental_inputs::write_info_blocks): Add padding;
48 add assert for object_info_size, input_section_entry_size,
49 global_sym_entry_size.
50 * incremental.h (Incremental_inputs_reader): Add symbolic constants
51 for data structure sizes; use them.
52 (Incremental_input_entry_reader): Import symbolic constants from
53 Incremental_inputs_reader; use them.
55 2012-04-23 David S. Miller <davem@davemloft.net>
57 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
59 (Target_sparc::Target_sparc): Initialize new fields.
60 (Target_sparc::do_make_elf_object): New function.
61 (Target_sparc::do_adjust_elf_header): New function.
63 2012-04-23 Cary Coutant <ccoutant@google.com>
65 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
66 CU range table of gdb index.
68 2012-04-20 David S. Miller <davem@davemloft.net>
70 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
73 2012-04-16 David S. Miller <davem@davemloft.net>
75 * sparc.cc (Target_sparc::got_address): New function.
76 (Sparc_relocate_functions::gdop_hix22): New function.
77 (Sparc_relocate_functions::gdop_lox10): New function.
78 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
80 (Target_sparc::Scan::local): Likewise if the global symbol is not
81 preemptible and is not IFUNC.
82 (Target_sparc::Relocate::relocate): Perform GOTDATA code
83 transformations for local and non-preemptible non-IFUNC global
86 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
87 writing out 64-bit part of ranges.
89 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
90 -fpic and -fpie respectively.
91 * Makefile.in: Regenerate.
93 * sparc.cc (class Target_sparc): Add rela_ifunc_.
94 (Target_sparc::Target_sparc): Initialize new field.
95 (Target_sparc::do_plt_section_for_global): New function.
96 (Target_sparc::do_plt_section_for_local): New function.
97 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
98 (Target_sparc::make_plt_section): New function, broken out of
99 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
100 (Target_sparc::make_plt_entry): Call make_plt_section.
101 (Target_sparc::make_local_ifunc_plt_entry): New function.
102 (Target_sparc::rela_ifunc_section): New function.
103 (Target_sparc::plt_section): Remove const.
104 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
105 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
106 and ifunc_count_ fields.
107 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
108 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
109 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
110 (Output_data_plt_sparc::rela_ifunc): New function.
111 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
112 (Output_data_plt_sparc::has_ifunc_section): New function.
113 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
114 (Output_data_plt_sparc::address_for_global): New function.
115 (Output_data_plt_sparc::address_for_local): New function.
116 (Output_data_plt_sparc::plt_index_to_offset): New function.
117 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
119 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
121 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
122 R_SPARC_JMP_IREL to switch.
123 (Target_sparc::Scan::check_non_pic): Likewise.
124 (Target_sparc::Scan::local): Handle IFUNC symbols.
125 (Target_sparc::Scan::local): Likewise.
126 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
127 and plt_address_for_local.
128 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
129 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
131 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
132 (class Output_data_reloc): Adjust calls to Output_reloc_type.
133 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
134 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
136 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
137 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
139 * sparc.cc (Target_sparc::Scan::global): Likewise.
140 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
142 2012-04-16 Cary Coutant <ccoutant@google.com>
144 * archive.cc (Library_base::should_include_member): Check for
145 --export-dynamic-symbol.
146 * options.h (class General_options): Add --export-dynamic-symbol.
147 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
148 --export-dynamic-symbol.
149 (Symbol_table::gc_mark_undef_symbols): Likewise.
150 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
152 2012-04-12 David S. Miller <davem@davemloft.net>
154 * sparc.cc (Reloc::wdisp10): New relocation method.
155 (Reloc::h34): Likewise.
156 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
157 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
159 (Target_sparc::Scan::local): Likewise.
160 (Target_sparc::Scan::global): Likewise.
161 (Target_sparc::Relocate::relocate): Likewise.
163 2012-04-09 Cary Coutant <ccoutant@google.com>
165 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
168 2012-04-06 Ian Lance Taylor <iant@google.com>
170 * timer.cc: #include <unistd.h>.
172 2012-04-06 Roland McGrath <mcgrathr@google.com>
174 * configure.in (AC_CHECK_HEADERS): Add locale.h.
175 * config.in: Regenerate.
176 * configure: Regenerate.
178 2012-04-05 Nick Clifton <nickc@redhat.com>
180 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
181 (AM_LC_MESSAGES): Add.
182 * aclocal.m4: Regenerate.
183 * config.in: Regenerate.
184 * configure: Regenerate.
186 2012-03-21 Cary Coutant <ccoutant@google.com>
188 * Makefile.am: Add gdb-index.cc, gdb-index.h.
189 * Makefile.in: Regenerate.
190 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
191 (Sized_elf_reloc_mapper::symbol_section): New function.
192 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
193 (make_elf_reloc_mapper): New function.
194 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
195 (Dwarf_abbrev_table::do_read_abbrevs): New function.
196 (Dwarf_abbrev_table::do_get_abbrev): New function.
197 (Dwarf_ranges_table::read_ranges_table): New function.
198 (Dwarf_ranges_table::read_range_list): New function.
199 (Dwarf_pubnames_table::read_section): New function.
200 (Dwarf_pubnames_table::read_header): New function.
201 (Dwarf_pubnames_table::next_name): New function.
202 (Dwarf_die::Dwarf_die): New function.
203 (Dwarf_die::read_attributes): New function.
204 (Dwarf_die::skip_attributes): New function.
205 (Dwarf_die::set_name): New function.
206 (Dwarf_die::set_linkage_name): New function.
207 (Dwarf_die::attribute): New function.
208 (Dwarf_die::string_attribute): New function.
209 (Dwarf_die::int_attribute): New function.
210 (Dwarf_die::uint_attribute): New function.
211 (Dwarf_die::ref_attribute): New function.
212 (Dwarf_die::child_offset): New function.
213 (Dwarf_die::sibling_offset): New function.
214 (Dwarf_info_reader::check_buffer): New function.
215 (Dwarf_info_reader::parse): New function.
216 (Dwarf_info_reader::do_parse): New function.
217 (Dwarf_info_reader::do_read_string_table): New function.
218 (Dwarf_info_reader::lookup_reloc): New function.
219 (Dwarf_info_reader::get_string): New function.
220 (Dwarf_info_reader::visit_compilation_unit): New function.
221 (Dwarf_info_reader::visit_type_unit): New function.
222 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
223 Sized_elf_reloc_mapper.
224 (Sized_dwarf_line_info::symbol_section): Remove function.
225 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
226 (Sized_dwarf_line_info::read_line_mappings): Remove object
227 parameter, adjust callers.
228 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
229 * dwarf_reader.h: Include <sys/types.h>.
230 (class Track_relocs): Remove forward declaration.
231 (class Elf_reloc_mapper): New class.
232 (class Sized_elf_reloc_mapper): New class.
233 (class Dwarf_abbrev_table): New class.
234 (class Dwarf_range_list): New class.
235 (class Dwarf_ranges_table): New class.
236 (class Dwarf_pubnames_table): New class.
237 (class Dwarf_die): New class.
238 (class Dwarf_info_reader): New class.
239 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
240 (Sized_dwarf_line_info::symbol_section): Remove member function.
241 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
243 * gdb-index.cc: New source file.
244 * gdb-index.h: New source file.
245 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
246 and .debug_types sections, call Layout::add_to_gdb_index.
247 (Sized_relobj_incr::do_section_name): Implement.
248 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
249 return type; Implement.
250 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
252 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
253 parameter list and return type.
254 (Sized_incr_dynobj::do_section_contents): Likewise.
255 * layout.cc: Include gdb-index.h.
256 (Layout::Layout): Initialize gdb_index_data_.
257 (Layout::init_fixed_output_section): Check for .gdb_index section.
258 (Layout::add_to_gdb_index): New function. Instantiate.
259 * layout.h: Add forward declaration for class Gdb_index.
260 (Layout::add_to_gdb_index): New member function.
261 (Layout::gdb_index_data_): New data member.
262 * main.cc: Include gdb-index.h.
263 (main): Print statistics for gdb index.
264 * object.cc (Object::section_contents): Move code into
266 (need_decompressed_section): Check for sections needed when building
268 (build_compressed_section_map): Likewise.
269 (Sized_relobj_file::do_read_symbols): Need local symbols when building
271 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
272 sections; call Layout::add_to_gdb_index.
273 (Sized_relobj_file::do_decompressed_section_contents): Call
274 do_section_contents directly.
275 * object.h (Object::do_section_contents): Adjust parameter list and
277 (Object::do_decompressed_section_contents): Call do_section_contents
279 (Sized_relobj_file::do_section_contents): Adjust parameter list and
281 * options.h (class General_options): Add --gdb-index option.
282 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
283 list and return type.
284 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
285 * reloc.h (Track_relocs::checkpoint): New function.
286 (Track_relocs::reset): New function.
288 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
290 * testsuite/Makefile.in: Regenerate.
291 * testsuite/gdb_index_test.cc: New test source file.
292 * testsuite/gdb_index_test_1.sh: New test source file.
293 * testsuite/gdb_index_test_2.sh: New test source file.
295 2012-03-19 Doug Kwan <dougkwan@google.com>
297 * arm.cc (Target_arm::do_define_standard_symbols): New method.
298 (Target_arm::do_finalize_sections): Remove code which defines
299 __exidx_start and __exidx_end. Make symbol table parameter
300 anonymous as it is not used.
301 * gold.cc (queue_middle_tasks): Call target hook to define any
302 target-specific symbols.
303 * target.h (Target::define_standard_symbols): New method.
304 (Target::do_define_standard_symbols): Same.
305 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
306 * testsuite/Makefile.in: Regenerate.
307 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
309 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
310 relocations are generated for __exidx_start and __exidx_end.
312 2012-03-16 Doug Kwan <dougkwan@google.com>
314 * testsuite/Makefile.am: Disable test initpri3b.
315 * testsuite/Makefile.in: Regenerate.
317 2012-03-15 Doug Kwan <dougkwan@google.com>
319 * arm.cc (Target_arm::got_section): Make .got section read-only
322 2012-03-15 Ian Lance Taylor <iant@google.com>
325 * layout.cc (Layout::make_output_section): Correctly mark
326 SHT_INIT_ARRAY, et. al., as relro.
328 2012-03-14 Doug Kwan <dougkwan@google.com>
330 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
331 dynamic relocations for protected symbols in shared objects.
333 2012-03-13 Ian Lance Taylor <iant@google.com>
335 * resolve.cc (Symbol_table::resolve): When merging common symbols,
336 keep the larger alignment.
338 2012-03-12 Cary Coutant <ccoutant@google.com>
340 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
341 handling of DW_LNE_define_file.
343 2012-03-12 Cary Coutant <ccoutant@google.com>
345 * reduced_debug_output.cc
346 (Output_reduced_debug_info_section::get_die_end): Add new FORM
349 2012-02-29 Cary Coutant <ccoutant@google.com>
351 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
353 2012-02-29 Cary Coutant <ccoutant@google.com>
355 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
356 Call Object::decompressed_section_contents.
357 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
359 (Sized_dwarf_line_info::buffer_start_): New data member.
360 * merge.cc (Output_merge_data::do_add_input_section): Call
361 Object::decompressed_section_contents.
362 (Output_merge_string::do_add_input_section): Likewise.
363 * object.cc (need_decompressed_section): New function.
364 (build_compressed_section_map): Decompress sections needed later.
365 (Sized_relobj_file::do_decompressed_section_contents): New function.
366 (Sized_relobj_file::do_discard_decompressed_sections): New function.
367 * object.h (Object::decompressed_section_contents): New function.
368 (Object::discard_decompressed_sections): New function.
369 (Object::do_decompressed_section_contents): New function.
370 (Object::do_discard_decompressed_sections): New function.
371 (Compressed_section_info): New type.
372 (Compressed_section_map): Include decompressed section contents.
373 (Sized_relobj_file::do_decompressed_section_contents): New function.
374 (Sized_relobj_file::do_discard_decompressed_sections): New function.
376 2012-02-16 Cary Coutant <ccoutant@google.com>
378 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
379 * testsuite/Makefile.in: Regenerate.
381 2012-02-14 Cary Coutant <ccoutant@google.com>
383 * options.cc (General_options::finalize): Disallow -pie and -static.
385 2012-02-03 Doug Kwan <dougkwan@google.com>
387 * arm.cc (Arm_relocate_functions::abs8,
388 Arm_relocate_functions::abs16): Use
389 Bits::has_signed_unsigned_overflow32.
390 (Arm_relocate_functions::thm_abs8): Correct range of
392 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
395 2012-02-02 Doug Kwan <dougkwan@google.com>
397 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
398 position independent outputs, not just shared objects.
400 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
402 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
403 * configure: Regenerated.
405 2012-01-27 Ian Lance Taylor <iant@google.com>
407 * reloc.h (Bits): New class with static functions, copied from
408 namespace utils in arm.cc.
409 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
412 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
414 * incremental.cc (write_info_blocks): Correct relocation offset.
416 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
418 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
419 (Relocate::tls_gd_to_le): Likewise.
421 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
423 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
425 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
427 * configure.ac: Check if -mcmodel=medium works.
428 * configure: Regenerated.
430 2012-01-24 Cary Coutant <ccoutant@google.com>
432 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
434 (read_unsigned_LEB_128_x): ... this new function.
435 (read_signed_LEB_128): Replaced with inline definition and ...
436 (read_signed_LEB_128_x): ... this new function.
437 * int_encoding.h (read_unsigned_LEB_128_x): New function.
438 (read_unsigned_LEB_128): Add inline definition.
439 (read_signed_LEB_128_x): New function.
440 (read_signed_LEB_128): Add inline definition.
441 * testsuite/Makefile.am (leb128_unittest): New unit test.
442 * testsuite/Makefile.in: Regenerate.
443 * testsuite/leb128_unittest.cc: New unit test.
445 2012-01-23 Ian Lance Taylor <iant@google.com>
448 * i386.cc (Target_i386::do_code_fill): When using a jmp
449 instruction, pad with nop instructions.
450 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
452 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
454 * x86_64.cc (gc_process_relocs): Add typename on types used in
456 (scan_relocs): Likewise.
457 (relocate_section): Likewise.
458 (apply_relocation): Likewise.
460 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
462 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
463 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
466 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
468 * x86_64.cc: Initial support for x32.
470 2012-01-03 Cary Coutant <ccoutant@google.com>
472 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
473 Use abstract base class for GOT.
474 * gold/output.h (class Output_data_got_base): New abstract base class.
475 (class Output_data_got): Derive from new base class, adjust ctors.
476 (Output_data_got::reserve_slot): Make virtual; rename to
477 do_reserve_slot; Adjust callers.
478 * gold/target.h (Sized_target::init_got_plt_for_update): Return
479 pointer to abstract base class.
480 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
482 2011-12-18 Ian Lance Taylor <iant@google.com>
484 * object.h (Relobj::local_symbol_value): New function.
485 (Relobj::local_plt_offset): New function.
486 (Relobj::local_has_got_offset): New function.
487 (Relobj::local_got_offset): New function.
488 (Relobj::set_local_got_offset): New function.
489 (Relobj::do_local_symbol_value): New pure virtual function.
490 (Relobj::do_local_plt_offset): Likewise.
491 (Relobj::do_local_has_got_offset): Likewise.
492 (Relobj::do_local_got_offset): Likewise.
493 (Relobj::do_set_local_got_offset): Likewise.
494 (Sized_relobj::do_local_has_got_offset): Rename from
495 local_has_got_offset.
496 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
497 (Sized_relobj::do_set_local_got_offset): Rename from
498 set_local_got_offset.
499 (Sized_relobj_file::do_local_plt_offset): Rename from
501 (Sized_relobj_file::do_local_symbol_value): New function.
502 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
504 * output.cc (Output_data_got::Got_entry::write): Change object to
505 Relobj. Use local_symbol_value.
506 (Output_data_got::add_global_with_rel): Change rel_dyn to
507 Output_data_reloc_generic*. Use add_global_generic.
508 (Output_data_got::add_global_with_rela): Remove. Change all
509 callers to use add_global_with_rel.
510 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
511 Output_data_reloc_generic*. Use add_global_generic.
512 (Output_data_got::add_global_pair_with_rela): Remove. Change all
513 callers to use add_global_pair_with_rel.
514 (Output_data_got::add_local): Change object to Relobj*.
515 (Output_data_got::add_local_plt): Likewise.
516 (Output_data_got::add_local_with_rel): Change object to Relobj*,
517 change rel_dyn to Output_data_reloc_generic*. Use
519 (Output_data_got::add_local_with_rela): Remove. Change all
520 callers to use all_local_with_rel.
521 (Output_data_got::add_local_pair_with_rel): Change object to
522 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
523 add_output_section_generic.
524 (Output_data_got::add_local_pair_with_rela): Remove. Change all
525 callers to use add_local_pair_with_rel.
526 (Output_data_got::reserve_local): Change object to Relobj*.
527 * output.h: (class Output_data_reloc_generic): Add pure virtual
528 declarations for add_global_generic, add_local_generic,
529 add_output_section_generic.
530 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
531 functions for Output_data_reloc_generic. Update declarations for
532 changes listed in output.cc.
533 (class Output_data_got): Change template parameter to got_size.
534 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
535 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
537 (Sized_relobj_incr::do_local_plt_offset): New function.
538 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
541 2011-12-17 Cary Coutant <ccoutant@google.com>
543 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
544 * resolve.cc (Symbol_table::resolve): Likewise.
545 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
547 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
549 2011-12-16 Ian Lance Taylor <iant@google.com>
551 * output.h (Output_data_reloc_generic::add): Only call
552 add_dynamic_reloc if this is a dynamic reloc section.
554 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
557 * target-reloc.h (apply_relocation): Replace <64, false> with
560 2011-11-25 Nick Clifton <nickc@redhat.com>
562 * po/it.po: New Italian translation.
564 2011-11-17 Sterling Augustine <saugustine@google.com>
566 * script.cc (script_include_directive): Implement.
567 (read_script_file): New local variables name and search_path. Update
568 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
569 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
570 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
572 2011-11-11 Sterling Augustine <saugustine@google.com>
574 * yyscript.y (section_cmd): Add support for INCLUDE directive.
575 (file_or_sections_cmd): Likewise.
577 2011-11-11 Doug Kwan <dougkwan@google.com>
579 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
580 if --just-symbols is given.
582 2011-11-10 Doug Kwan <dougkwan@google.com>
585 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
586 when processing data relocs.
587 * reloc.h (Relocate_functions::rel_unaligned): New method.
588 (Relocate_functions::pcrel_unaligned): Ditto.
589 (Relocate_functions::rel32_unaligned): Ditto.
590 (Relocate_functions::pcrel32_unaligned): Ditto.
592 2011-11-09 Doug Kwan <dougkwan@google.com>
595 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
596 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
597 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
598 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
599 (Relocate_functions::rel_unaligned): New.
600 (Relocate_functions::rel32_unaligned): New.
601 * target-reloc.h (relocate_for_relocatable): Add code to handle
602 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
603 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
604 arm_unaligned_reloc_r): New targets.
605 * testsuite/Makefile.in: Regenerate.
606 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
609 2011-11-02 Ian Lance Taylor <iant@google.com>
611 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
613 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
614 * options.cc (General_options::finalize): Use library search path
615 from configure script if specified. If not native and no sysroot,
616 only search TOOLLIBDIR.
617 * options.h (Search_directory::Search_directory): Change name to
619 (General_options::add_to_library_path_with_sysroot): Change arg to
621 * configure, Makefile.in, config.in: Rebuild.
623 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
625 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
626 we are working around the ARM1176 Erratum.
627 * options.h (General_options::fix_arm1176): Add option.
628 * testsuite/Makefile.am: Add testcases, and keep current ones
630 * testsuite/Makefile.in: Regenerate.
631 * testsuite/arm_fix_1176.s: New file.
632 * testsuite/arm_fix_1176.sh: Likewise.
634 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
636 * arm.cc (Target_arm::Target_arm): Remove initialisation of
638 (Target_arm::may_use_blx): Remove method.
639 (Target_arm::set_may_use_blx): Likewise.
640 (Target_arm::may_use_v4t_interworking): New method.
641 (Target_arm::may_use_v5t_interworking): Likewise.
642 (Target_arm::may_use_blx_): Remove member variable.
643 (Arm_relocate_functions::arm_branch_common): Check for v5T
645 (Arm_relocate_functions::thumb_branch_common): Likewise.
646 (Reloc_stub::stub_type_for_reloc): Likewise.
647 (Target_arm::do_finalize_sections): Correct interworking checks.
648 * testsuite/Makefile.am: Add new tests.
649 * testsuite/Makefile.in: Regenerate.
650 * testsuite/arm_farcall_arm_arm.s: New test.
651 * testsuite/arm_farcall_arm_arm.sh: Likewise.
652 * testsuite/arm_farcall_arm_thumb.s: Likewise.
653 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
654 * testsuite/arm_farcall_thumb_arm.s: Likewise.
655 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
656 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
657 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
659 2011-10-31 Cary Coutant <ccoutant@google.com>
662 * expression.cc (Expression::eval_with_dot): Add
663 is_section_dot_assignment parameter.
664 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
665 absolute and assigning to dot within a section.
667 (Output_section_element_assignment::set_section_addresses): Pass
668 dot_section to set_if_absolute.
669 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
670 as is_section_dot_assignment flag to eval_with_dot.
671 (Output_section_element_dot_assignment::set_section_addresses):
673 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
674 parameter. Also set value if relative to dot_section; set the
675 symbol's output_section.
676 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
677 parameter. Adjust all callers.
678 (Expression::eval_maybe_dot): Likewise.
679 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
681 * testsuite/script_test_2.t: Test assignment of an absolute value
682 to dot within an output section element.
684 2011-10-31 Cary Coutant <ccoutant@google.com>
686 * options.h (class General_options): Add --[no-]gnu-unique options.
687 * symtab.cc (Symbol_table::sized_write_globals): Convert
688 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
690 2011-10-31 Cary Coutant <ccoutant@google.com>
693 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
694 unnecessary assertion.
695 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
697 2011-10-31 Sriraman Tallam <tmsriram@google.com>
699 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
701 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
703 Change to just keep the section associated with symbol.
704 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
705 they are externally visible and --export-dynamic is turned on.
706 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
708 2011-10-19 Ian Lance Taylor <iant@google.com>
712 (Output_section_element_dot_assignment::needs_output_section): New
715 2011-10-19 Ian Lance Taylor <iant@google.com>
718 * layout.cc (Layout::segment_precedes): Don't assert failure if a
719 --section-start option was seen.
720 * options.h (General_options::any_section_start): New function.
722 2011-10-18 David S. Miller <davem@davemloft.net>
725 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
726 member to track relocation locations that have moved during TLS
728 (Target_sparc::Relocate::Relocate): Initialize to NULL.
729 (Target_sparc::Relocate::relocate): Adjust view down by 4
730 bytes if it matches reloc_adjust_addr_.
731 (Target_sparc::Relocate::relocate_tls): Always move the
732 __tls_get_addr call delay slot instruction forward 4 bytes when
733 performing relaxation.
735 2011-10-18 Cary Coutant <ccoutant@google.com>
737 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
738 (Output_file::map_no_anonymous): Check for non-zero
739 return code from posix_fallocate.
741 2011-10-17 Cary Coutant <ccoutant@google.com>
744 * plugin.cc (is_visible_from_outside): Check for symbols
745 referenced from dynamic objects.
746 * resolve.cc (Symbol_table::resolve): Don't count references
747 from dynamic objects as references from real ELF files.
748 * testsuite/plugin_test_2.sh: Adjust expected result.
750 2011-10-17 Cary Coutant <ccoutant@google.com>
752 * gold.cc: Include timer.h.
753 (queue_middle_tasks): Stamp time.
754 (queue_final_tasks): Likewise.
755 * main.cc (main): Store timer in parameters. Print timers
757 * parameters.cc (Parameters::Parameters): Initialize timer_.
758 (Parameters::set_timer): New function.
759 (set_parameters_timer): New function.
760 * parameters.h (Parameters::set_timer): New function.
761 (Parameters::timer): New function.
762 (Parameters::timer_): New data member.
763 (set_parameters_timer): New function.
764 * timer.cc (Timer::stamp): New function.
765 (Timer::get_pass_time): New function.
766 * timer.h (Timer::stamp): New function.
767 (Timer::get_pass_time): New function.
768 (Timer::pass_times_): New data member.
770 2011-10-17 Cary Coutant <ccoutant@google.com>
772 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
773 task for members of lib groups.
775 2011-10-17 Cary Coutant <ccoutant@google.com>
778 * fileread.cc (File_read::find_view): Add assert.
779 (File_read::make_view): Move bounds check (replace with assert)...
780 (File_read::find_or_make_view): ... to here.
782 2011-10-12 Cary Coutant <ccoutant@google.com>
784 * output.cc (Output_file::open_base_file): Handle case where
785 ::read returns less than requested size.
787 2011-10-10 Cary Coutant <ccoutant@google.com>
789 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
790 Initialize defined_count_.
791 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
792 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
793 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
794 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
795 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
796 * incremental.h (Sized_relobj_incr::defined_count_): New data
798 (Sized_incr_dynobj::defined_count_): New data member.
799 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
800 Return zeroes instead of internal error.
802 2011-10-10 Cary Coutant <ccoutant@google.com>
805 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
806 (Output_reloc::symbol_value): Return PLT offset if flag is set.
807 * output.h (class Output_reloc): Add use_plt_offset flag.
808 (Output_reloc::type_): Adjust size of bit field.
809 (Output_reloc::use_plt_offset_): New bit field.
810 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
811 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
812 flag. Adjust all callers.
813 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
814 creating RELATIVE relocations.
816 2011-10-10 Nick Clifton <nickc@redhat.com>
818 * po/es.po: Updated Spanish translation.
819 * po/fi.po: Updated Finnish translation.
821 2011-10-03 Diego Novillo <dnovillo@google.com>
823 * options.cc (parse_uint): Fix dereference of RETVAL.
825 2011-09-29 Sriraman Tallam <tmsriram@google.com>
827 * layout.h (section_order_map_): New member.
828 (get_section_order_map): New member function.
829 * output.cc (Output_section::add_input_section): Check for patterns
830 only when --section-ordering-file is specified.
831 * gold.cc (queue_middle_tasks): Delay updating order of sections till
832 output_sections have been formed.
833 * layout.cc (Layout_Layout): Initialize section_order_map_.
834 * plugin.cc (update_section_order): Store order in order_map. Do not
836 * testsuite/Makefile.am: Add test case for plugin_final_layout.
837 * testsuite/Makefile.in: Regenerate.
838 * testsuite/plugin_section_order.c: New file.
839 * testsuite/plugin_final_layout.cc: New file.
840 * testsuite/plugin_final_layout.sh: New file.
842 2011-09-29 Cary Coutant <ccoutant@google.com>
844 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
846 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
847 symbols during incremental update.
848 (Symbol_table::add_from_dynobj): Likewise.
850 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
851 Ian Lance Taylor <iant@google.com>
853 * symtab.cc (Symbol_table::define_special_symbol): Always
854 canonicalize version string.
856 2011-09-26 Cary Coutant <ccoutant@google.com>
858 * gold.cc (queue_initial_tasks): Move option checks ...
859 * options.cc (General_options::finalize): ... to here. Disable
860 some options; make others fatal.
862 2011-09-26 Cary Coutant <ccoutant@google.com>
865 * plugin.cc (get_symbols_v2): New function.
866 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
867 (is_referenced_from_outside): New function.
868 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
869 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
870 (get_symbols): Pass version parameter.
871 (get_symbols_v2): New function.
872 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
874 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
875 (onload): Add LDPT_GET_SYMBOLS_V2.
876 (all_symbols_read_hook): Use get_symbols_v2; check for
877 LDPR_PREVAILING_DEF_IRONLY_EXP.
878 * testsuite/plugin_test_3.sh: Update expected results.
880 2011-09-23 Simon Baldwin <simonb@google.com>
882 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
883 configuration options.
884 * configure: Regenerate.
885 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
886 * Makefile.in: Regenerate.
887 * testsuite/Makefile.in: Regenerate.
889 2011-09-19 Sriraman Tallam <tmsriram@google.com>
891 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
893 2011-09-19 Cary Coutant <ccoutant@google.com>
895 * incremental.cc (can_incremental_update): Fix typo in comment.
896 * incremental.h (can_incremental_update): Likewise.
898 2011-09-18 Cary Coutant <ccoutant@google.com>
900 * incremental.cc (can_incremental_update): New function.
901 * incremental.h (can_incremental_update): New function.
902 * layout.cc (Layout::init_fixed_output_section): Call it.
903 (Layout::make_output_section): Don't allow patch space in .eh_frame.
904 * object.cc (Sized_relobj_file::do_layout): Call
905 can_incremental_update.
907 2011-09-13 Cary Coutant <ccoutant@google.com>
909 * configure.ac: Check for glibc support for gnu_indirect_function
910 support with static linking, setting automake conditional
912 * Makefile.in: Regenerate.
913 * configure: Regenerate.
915 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
916 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
918 * testsuite/Makefile.in: Regenerate.
920 2011-09-13 Cary Coutant <ccoutant@google.com>
922 * incremental.cc (Sized_relobj_incr::do_layout): Call
923 report_comdat_group for kept comdat sections.
924 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
925 * testsuite/Makefile.in: Regenerate.
926 * testsuite/incr_comdat_test_1.cc: New source file.
927 * testsuite/incr_comdat_test_2_v1.cc: New source file.
928 * testsuite/incr_comdat_test_2_v2.cc: New source file.
929 * testsuite/incr_comdat_test_2_v3.cc: New source file.
931 2011-09-13 Ian Lance Taylor <iant@google.com>
933 * object.cc (Sized_relobj_file::do_layout): Remove unused local
934 variable external_symbols_offset.
936 2011-09-12 Ian Lance Taylor <iant@google.com>
938 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
939 triggered if object has no symbols.
941 2011-09-09 David S. Miller <davem@davemloft.net>
943 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
944 (Output_fill_debug_line::do_write): Likewise.
946 2011-08-29 Cary Coutant <ccoutant@google.com>
948 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
949 casts to match formatting specs.
950 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
952 2011-08-26 Cary Coutant <ccoutant@google.com>
954 * layout.cc (Free_list::allocate): Provide guarantee of minimum
955 remaining hole size when allocating.
956 (Layout::make_output_section): Set fill methods for debug sections.
957 * layout.h (Free_list::Free_list_node): Move from private to
959 (Free_list::set_min_hole_size): New function.
960 (Free_list::begin, Free_list::end): New functions.
961 (Free_list::min_hole_): New data member.
962 * output.cc: Include dwarf.h.
963 (Output_fill_debug_info::do_minimum_hole_size): New function.
964 (Output_fill_debug_info::do_write): New function.
965 (Output_fill_debug_line::do_minimum_hole_size): New function.
966 (Output_fill_debug_line::do_write): New function.
967 (Output_section::Output_section): Initialize new data member.
968 (Output_section::set_final_data_size): Ensure patch space is larger
969 than minimum hole size.
970 (Output_section::do_write): Fill holes in debug sections.
971 * output.h (Output_fill): New class.
972 (Output_fill_debug_info): New class.
973 (Output_fill_debug_line): New class.
974 (Output_section::set_free_space_fill): New function.
975 (Output_section::free_space_fill_): New data member.
976 * testsuite/Makefile.am (incremental_test_3): Add
977 --incremental-patch option.
978 (incremental_test_4): Likewise.
979 (incremental_test_5): Likewise.
980 (incremental_test_6): Likewise.
981 (incremental_copy_test): Likewise.
982 (incremental_common_test_1): Likewise.
983 * testsuite/Makefile.in: Regenerate.
985 2011-08-26 Nick Clifton <nickc@redhat.com>
987 * po/es.po: Updated Spanish translation.
989 2011-08-01 Cary Coutant <ccoutant@google.com>
991 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
992 * gold/testsuite/Makefile.in: Regenerate.
993 * gold/testsuite/justsyms_exec.c: New source file.
994 * gold/testsuite/justsyms_lib.c: New source file.
996 2011-08-01 Cary Coutant <ccoutant@google.com>
998 * layout.cc (Layout::set_segment_offsets): Don't realign text
999 segment if -Ttext was specified.
1000 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
1002 * object.h (Sized_relobj_file::e_type): New function.
1003 (Sized_relobj_file::e_type_): New data member.
1004 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
1005 base address for ET_EXEC files.
1006 * target.cc (Target::do_make_elf_object_implementation): Allow
1007 ET_EXEC files with --just-symbols option.
1009 2011-07-28 Cary Coutant <ccoutant@google.com>
1011 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
1012 Add thread_number parameter.
1013 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
1014 * workqueue-threads.cc
1015 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
1016 current thread if its thread number is greater than desired thread
1018 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
1019 Add thread_number parameter.
1020 (Workqueue::should_cancel_thread): Likewise.
1021 (Workqueue::find_runnable_or_wait): Pass thread_number to
1022 should_cancel_thread.
1023 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
1026 2011-07-22 Sriraman Tallam <tmsriram@google.com>
1028 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
1029 only after checking if it cannot be forced local.
1030 * symtab.h (is_externally_visible): Check if the symbol is not forced
1033 2011-07-15 Ian Lance Taylor <iant@google.com>
1035 * options.h (class General_options): Add --print-output-format.
1036 Move -EL next to -EB, for better --help output.
1037 * target-select.cc: Include <cstdio>, "options.h", and
1039 (Target_selector::do_target_bfd_name): New function.
1040 (print_output_format): New function.
1041 * target-select.h (class Target_selector): Update declarations.
1042 (Target_selector::target_bfd_name): New function.
1043 (print_output_format): Declare.
1044 * main.cc: Include "target-select.h".
1045 (main): Handle --print-output-format.
1046 * gold.cc: Include "target-select.h".
1047 (queue_initial_tasks): Handle --print-output-format when there are
1049 * parameters.cc (parameters_force_valid_target): Give a better
1050 error message if -EB/-EL does not match target.
1051 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
1054 2011-07-15 Ian Lance Taylor <iant@google.com>
1056 * i386.cc (class Output_data_plt_i386): Add layout_ field.
1057 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
1058 (Output_data_plt_i386::do_write): Write address of .dynamic
1059 section to first entry in .got.plt section.
1060 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
1061 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1063 (Output_data_plt_x86_64::do_write): Write address of .dynamic
1064 section to first entry in .got.plt section.
1065 * layout.h (Layout::dynamic_section): New function.
1067 2011-07-13 Sriraman Tallam <tmsriram@google.com>
1069 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
1071 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
1072 input_section_position_, and input_section_glob_.
1073 (read_layout_from_file): Call function section_ordering_specified.
1074 * layout.h (is_section_ordering_specified): New function.
1075 (section_ordering_specified): New function.
1076 (section_ordering_specified_): New boolean member.
1077 * main.cc(main): Call load_plugins after layout object is defined.
1078 * output.cc (Output_section::add_input_section): Use
1079 function section_ordering_specified to check if section ordering is
1081 * output.cc (Output_section::add_relaxed_input_section): Use
1082 function section_ordering_specified to check if section ordering is
1084 (Output_section::update_section_layout): New function.
1085 (Output_section::sort_attached_input_sections): Check if input section
1087 * output.h (Output_section::update_section_layout): New function.
1088 * plugin.cc (get_section_count): New function.
1089 (get_section_type): New function.
1090 (get_section_name): New function.
1091 (get_section_contents): New function.
1092 (update_section_order): New function.
1093 (allow_section_ordering): New function.
1094 (Plugin::load): Add the new interfaces to the transfer vector.
1095 (Plugin_manager::load_plugins): New parameter.
1096 (Plugin_manager::all_symbols_read): New parameter.
1097 (Plugin_manager::claim_file): New parameter. Save the elf object for
1099 (Plugin_manager::get_elf_object): New function.
1100 (Plugin_manager::get_view): Change to directly use the bool to check
1101 if get_view is called from claim_file_hook.
1102 * plugin.h (input_objects): New function
1103 (Plugin__manager::load_plugins): New parameter.
1104 (Plugin_manager::claim_file): New parameter.
1105 (Plugin_manager::get_elf_object): New function.
1106 (Plugin_manager::in_claim_file_handler): New function.
1107 (Plugin_manager::in_claim_file_handler_): New member.
1108 (layout): New function.
1109 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
1110 handler with an extra parameter. Make the elf object before calling
1112 * testsuite/plugin_test.c (get_section_count): New function pointer.
1113 (get_section_type): New function pointer.
1114 (get_section_name): New function pointer.
1115 (get_section_contents): New function pointer.
1116 (update_section_order): New function pointer.
1117 (allow_section_ordering): New function pointer.
1118 (onload): Check if the new interfaces exist.
1120 2011-07-13 Ian Lance Taylor <iant@google.com>
1122 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
1124 * x86_64.cc (Target_x86_64::got_section): Likewise.
1125 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
1126 (relro_now_test_SOURCES): New variable.
1127 (relro_now_test_DEPENDENCIES): New variable.
1128 (relro_now_test_LDFLAGS): New variable.
1129 (relro_now_test_LDADD): New variable.
1130 (relro_now_test.so): New target.
1131 * testsuite/Makefile.in: Rebuild.
1133 2011-07-12 Ian Lance Taylor <iant@google.com>
1136 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
1137 GLOB_DAT relocation rather than a RELATIVE relocation for a
1138 protected symbol when creating a shared library.
1139 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1140 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
1141 * testsuite/protected_main_1.cc (main): Test that protected
1142 function has same address.
1144 2011-07-11 Ian Lance Taylor <iant@google.com>
1147 * options.h (class General_options): Add -Bgroup.
1148 * options.cc (General_options::finalize): If -Bgroup is set,
1149 default to --unresolved-symbols=report-all.
1150 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
1151 * target-reloc.h (issue_undefined_symbol_error): Handle
1152 --unresolved-symbols=report-all.
1154 2011-07-08 Ian Lance Taylor <iant@google.com>
1157 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
1158 if linker script discards key sections.
1159 (Layout::create_dynamic_symtab): Likewise.
1160 (Layout::assign_local_dynsym_offsets): Likewise.
1161 (Layout::sized_create_version_sections): Likewise.
1162 (Layout::create_interp): Likewise.
1163 (Layout::finish_dynamic_section): Likewise.
1164 (Layout::set_dynamic_symbol_size): Likewise.
1166 2011-07-08 Ian Lance Taylor <iant@google.com>
1169 * options.h (class General_options): Add --unresolved-symbols.
1170 * target-reloc.h (issue_undefined_symbol_error): Check
1171 --unresolved-symbols. Add comments.
1173 2011-07-08 Ian Lance Taylor <iant@google.com>
1175 * testsuite/odr_violation2.cc (Ordering::operator()): Make
1176 expression more complex.
1178 2011-07-08 Ian Lance Taylor <iant@google.com>
1181 * target-reloc.h (issue_undefined_symbol_error): New inline
1182 function, broken out of relocate_section.
1183 (relocate_section): Call issue_undefined_symbol_error.
1184 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1185 there is no TLS segment if we are about to issue an undefined
1187 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1189 2011-07-08 Ian Lance Taylor <iant@google.com>
1192 * resolve.cc (Symbol_table::should_override): Add fromtype
1193 parameter. Change all callers. Give error when linking together
1194 TLS and non-TLS symbol.
1195 (Symbol_table::should_override_with_special): Add fromtype
1196 parameter. Change all callers.
1197 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1198 there is no TLS segment if we have reported some errors.
1199 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1201 2011-07-08 Ian Lance Taylor <iant@google.com>
1204 * target.h (Target::plt_address_for_global): New function.
1205 (Target::plt_address_for_local): New function.
1206 (Target::plt_section_for_global): Remove.
1207 (Target::plt_section_for_local): Remove.
1208 (Target::do_plt_address_for_global): New virtual function.
1209 (Target::do_plt_address_for_local): New virtual function.
1210 (Target::do_plt_section_for_global): Remove.
1211 (Target::do_plt_section_for_local): Remove.
1212 (Target::register_global_plt_entry): Add Symbol_table and Layout
1214 * output.cc (Output_data_got::Got_entry::write): Use
1215 plt_address_for_global and plt_address_for_local.
1216 * layout.cc (Layout::add_target_dynamic_tags): Use size and
1217 address of output section.
1218 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
1219 got_irelative_, and irelative_count_ fields. Update
1221 (Output_data_plt_i386::has_irelative_section): New function.
1222 (Output_data_plt_i386::entry_count): Add irelative_count_.
1223 (Output_data_plt_i386::set_final_data_size): Likewise.
1224 (class Target_i386): Add got_irelative_ and rel_irelative_
1225 fields. Update declarations.
1226 (Target_i386::Target_i386): Initialize new fields.
1227 (Target_i386::do_plt_address_for_global): New function replacing
1228 do_plt_section_for_global.
1229 (Target_i386::do_plt_address_for_local): New function replacing
1230 do_plt_section_for_local.
1231 (Target_i386::got_section): Create got_irelative_.
1232 (Target_i386::rel_irelative_section): New function.
1233 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
1234 fields. Don't define __rel_iplt_{start,end}.
1235 (Output_data_plt_i386::add_entry): Add symtab and layout
1236 parameters. Change all callers. Use different PLT and GOT for
1238 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
1239 layout parameters. Change all callers. Use different PLT and
1241 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
1242 (Output_data_plt_i386::rel_irelative): New function.
1243 (Output_data_plt_i386::address_for_global): New function.
1244 (Output_data_plt_i386::address_for_local): New function.
1245 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
1246 IRELATIVE GOT when changing IFUNC GOT entries.
1247 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
1249 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
1250 if we didn't create an IRELATIVE GOT.
1251 (Target_i386::Relocate::relocate): Use plt_address_for_global and
1252 plt_address_for_local.
1253 (Target_i386::do_dynsym_value): Use plt_address_for_global.
1254 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
1255 got_irelative_, and irelative_count_ fields. Update
1257 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1258 Initialize new fields. Remove symtab parameter. Change all
1260 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
1262 (Output_data_plt_x86_64::has_irelative_section): New function.
1263 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
1264 (class Target_x86_64): Add got_irelative_ and rel_irelative_
1265 fields. Update declarations.
1266 (Target_x86_64::Target_x86_64): Initialize new fields.
1267 (Target_x86_64::do_plt_address_for_global): New function replacing
1268 do_plt_section_for_global.
1269 (Target_x86_64::do_plt_address_for_local): New function replacing
1270 do_plt_section_for_local.
1271 (Target_x86_64::got_section): Create got_irelative_.
1272 (Target_x86_64::rela_irelative_section): New function.
1273 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
1274 all callers. Don't create __rel_iplt_{start,end}.
1275 (Output_data_plt_x86_64::add_entry): Add symtab and layout
1276 parameters. Change all callers. Use different PLT and GOT for
1278 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
1279 layout parameters. Change all callers. Use different PLT and
1281 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
1282 parameters. Change all callers. Use different PLT and GOT for
1284 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
1285 (Output_data_plt_x86_64::rela_irelative): New function.
1286 (Output_data_plt_x86_64::address_for_global): New function.
1287 (Output_data_plt_x86_64::address_for_local): New function.
1288 (Output_data_plt_x86_64::set_final_data_size): Likewise.
1289 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
1290 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
1291 (Target_x86_64::register_global_plt_entry): Add symtab and layout
1293 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
1295 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
1296 symbols if we didn't create an IRELATIVE GOT.
1297 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
1298 plt_address_for_local.
1299 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
1300 * testsuite/ifuncvar1.c: New test file.
1301 * testsuite/ifuncvar2.c: New test file.
1302 * testsuite/ifuncvar3.c: New test file.
1303 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
1304 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
1305 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
1306 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
1307 * testsuite/Makefile.in: Rebuild.
1309 2011-07-07 Cary Coutant <ccoutant@google.com>
1311 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
1312 (two_file_test_1_ndebug.o): Likewise.
1313 (two_file_test_1b_ndebug.o): Likewise.
1314 (two_file_test_2_ndebug.o): Likewise.
1315 (two_file_test_main_ndebug.o): Likewise.
1316 (incremental_test_2): Link with no-debug versions.
1318 2011-07-06 Cary Coutant <ccoutant@google.com>
1320 * gold/incremental.cc
1321 (Output_section_incremental_inputs::write_info_blocks): Check for
1322 hidden and internal symbols.
1324 2011-07-06 Cary Coutant <ccoutant@google.com>
1326 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
1327 Check disposition for startup file.
1328 (Incremental_inputs::report_command_line): Ignore
1329 --incremental-startup-unchanged option.
1330 * options.cc (General_options::parse_incremental_startup_unchanged):
1332 (General_options::General_options): Initialize new data member.
1333 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
1334 (General_options): Add --incremental-startup-unchanged option.
1335 (General_options::incremental_startup_disposition): New function.
1336 (General_options::incremental_startup_disposition_): New data member.
1338 2011-07-06 Cary Coutant <ccoutant@google.com>
1340 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
1341 input file index to Script_info ctor.
1342 (Sized_incremental_binary::do_file_has_changed): Find the
1343 command-line argument for files named in scripts.
1344 * incremental.h (Script_info::Script_info): New ctor
1345 with input file index.
1346 (Script_info::input_file_index): New function.
1347 (Script_info::input_file_index_): New data member.
1348 (Incremental_binary::get_library): Add const.
1349 (Incremental_binary::get_script_info): Add const.
1350 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
1351 * testsuite/Makefile.am (incremental_test_5): New test case.
1352 (incremental_test_6): New test case.
1353 * testsuite/Makefile.in: Regenerate.
1355 2011-07-06 Cary Coutant <ccoutant@google.com>
1357 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
1358 debug output when command lines differ.
1360 2011-07-06 Cary Coutant <ccoutant@google.com>
1362 * incremental.cc (Incremental_inputs::report_command_line): Ignore
1363 --incremental-patch option.
1364 * layout.cc (Free_list::allocate): Extend allocation beyond original
1366 (Layout::make_output_section): Mark sections that should get
1368 * options.cc (parse_percent): New function.
1369 * options.h (parse_percent): New function.
1370 (DEFINE_percent): New macro.
1371 (General_options): Add --incremental-patch option.
1372 * output.cc (Output_section::Output_section): Initialize new data
1374 (Output_section::add_input_section): Print section name when out
1376 (Output_section::add_output_section_data): Likewise.
1377 (Output_section::set_final_data_size): Add patch space when
1378 doing --incremental-full.
1379 (Output_section::do_reset_address_and_file_offset): Remove patch
1381 (Output_segment::set_section_list_addresses): Print debug output
1382 only if --incremental-update.
1383 * output.h (Output_section::set_is_patch_space_allowed): New function.
1384 (Output_section::is_patch_space_allowed_): New data member.
1385 (Output_section::patch_space_): New data member.
1386 * parameters.cc (Parameters::incremental_full): New function.
1387 * parameters.h (Parameters::incremental_full): New function
1388 * testsuite/Makefile.am (incremental_test_2): Add test for
1389 --incremental-patch option.
1390 * testsuite/Makefile.in: Regenerate.
1391 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
1392 (t18): Remove function body.
1394 2011-07-05 Doug Kwan <dougkwan@google.com>
1397 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
1398 Arm_Address type for relocation result.
1399 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
1401 (Arm_relocate_functions::abs32): Use unaligned access.
1402 (Arm_relocate_functions::rel32): Ditto.
1403 (Arm_relocate_functions::prel31): Ditto.
1404 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
1405 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
1406 static data relocations.
1407 * testsuite/Makefile.in: Regnerate.
1408 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
1410 2011-07-05 Ian Lance Taylor <iant@google.com>
1413 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
1414 symbols if necessary.
1415 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1417 2011-07-05 Ian Lance Taylor <iant@google.com>
1420 * resolve.cc (Symbol::override_base_with_special): Simply override
1421 version with special symbol version, ignoring previous version.
1423 2011-07-05 Ian Lance Taylor <iant@google.com>
1425 * object.cc (Sized_relobj_file::include_section_group): Add
1426 information to comment about signature location.
1428 2011-07-02 Ian Lance Taylor <iant@google.com>
1431 * options.h (class General_options): Add -f and -F.
1432 * options.cc (General_options::finalize): Fatal error if -f/-F
1433 are used without -shared.
1434 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
1436 2011-07-02 Ian Lance Taylor <iant@google.com>
1438 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
1440 2011-07-01 Ian Lance Taylor <iant@google.com>
1444 * resolve.cc (Symbol::override_base_with_special): Don't override
1445 the version if the overriding symbol has a different name.
1446 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
1447 all callers. If we give an error about an undefined version,
1448 define the base version if necessary.
1449 * dynobj.h (class Versions): Update declaration.
1450 * testsuite/weak_alias_test_5.cc: New file.
1451 * testsuite/weak_alias_test.script: New file.
1452 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
1453 and versioned_alias have the right value, and call t2.
1454 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
1455 weak_alias_test_5.so.
1456 (weak_alias_test_LDADD): Likewise.
1457 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
1458 * testsuite/Makefile.in: Rebuild.
1460 2011-07-01 Ian Lance Taylor <iant@google.com>
1463 * options.h (class General_options): Support -z notext.
1464 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
1466 (two_file_shared_nonpic.so): Likewise.
1467 (two_file_shared_mixed.so): Likewise.
1468 (two_file_shared_mixed_1.so): Likewise.
1469 (weak_undef_lib_nonpic.so): Likewise.
1470 (alt/weak_undef_lib_nonpic.so): Likewise.
1471 (tls_test_shared_nonpic.so): Likewise.
1472 * testsuite/Makefile.in: Rebuild.
1474 2011-07-01 Ian Lance Taylor <iant@google.com>
1477 * configure.ac: Test whether static linking works, setting
1478 the automake conditional HAVE_STATIC.
1479 * testsuite/Makefile.am: Disable tests using -static if
1480 HAVE_STATIC is not true.
1481 * configure, testsuite/Makefile.in: Rebuild.
1483 2011-07-01 Ian Lance Taylor <iant@google.com>
1486 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
1487 Assert if we see DW_EH_PE_indirect.
1488 * target.h (Target::ehframe_datarel_base): New function.
1489 (Target::do_ehframe_datarel_base): New target function.
1490 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
1491 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
1494 2011-07-01 Ian Lance Taylor <iant@google.com>
1497 * options.h (class General_options): Add
1498 --ld-generated-unwind-info.
1499 * ehframe.cc (Fde::write): Add address parameter. Change all
1500 callers. If associated with PLT, fill in address and size.
1501 (Cie::set_output_offset): Only add merge mapping if there is an
1503 (Cie::write): Add address parameter. Change all callers.
1504 (Eh_frame::add_ehframe_for_plt): New function.
1505 * ehframe.h (class Fde): Update declarations. Move shndx_ and
1506 input_offset_ fields into union u_, with new plt field.
1507 (Fde::Fde): Adjust for new union field.
1508 (Fde::Fde) [Output_data version]: New constructor.
1509 (Fde::add_mapping): Only add merge mapping if there is an object.
1510 (class Cie): Update declarations.
1511 (class Eh_frame): Declare add_ehframe_for_plt.
1512 * layout.cc (Layout::layout_eh_frame): Break out code into
1513 make_eh_frame_section, and call it.
1514 (Layout::make_eh_frame_section): New function.
1515 (Layout::add_eh_frame_for_plt): New function.
1516 * layout.h (class Layout): Update declarations.
1517 * merge.cc (Merge_map::add_mapping): Add assertion.
1518 * i386.cc: Include "dwarf.h".
1519 (class Output_data_plt_i386): Make first_plt_entry,
1520 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
1521 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1522 and plt_eh_frame_fde.
1523 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
1524 boundary. Call add_eh_frame_for_plt if appropriate.
1525 * x86_64.cc: Include "dwarf.h".
1526 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
1527 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
1528 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1529 and plt_eh_frame_fde.
1530 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
1533 2011-06-29 Ian Lance Taylor <iant@google.com>
1536 * object.cc (Sized_relobj_file::layout_section): Change shdr
1537 parameter to be const.
1538 (Sized_relobj_file::layout_eh_frame_section): New function, broken
1540 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
1541 appropriate. Call layout_eh_frame_section.
1542 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
1544 * object.h (class Sized_relobj_file): Update declarations.
1546 2011-06-29 Ian Lance Taylor <iant@google.com>
1549 * script.cc (Token::integer_value): Accept trailing M/m/K/k
1551 (Lex::gather_token): Accept trailing M/m/K/k for integers.
1553 2011-06-29 Ian Lance Taylor <iant@google.com>
1556 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
1558 * layout.cc (Layout::layout_eh_frame): Likewise.
1560 2011-06-29 Ian Lance Taylor <iant@google.com>
1563 * layout.cc (Layout::symtab_section_shndx): New function.
1564 * layout.h (class Layout): Declare symtab_section_shndx.
1565 * output.cc (Output_section::write_header): Call it.
1567 2011-06-29 Ian Lance Taylor <iant@google.com>
1570 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
1571 symbols which are not used in a relocation.
1573 2011-06-28 Ian Lance Taylor <iant@google.com>
1576 * layout.cc (Layout::segment_precedes): Don't crash if a linker
1577 script create indistinguishable segments.
1578 (Layout::set_segment_offsets): Use stable_sort when sorting
1579 segments. Pass this to Compare_segments constructor.
1580 * layout.h (class Layout): Make segment_precedes non-static.
1581 (class Compare_segments): Change from struct to class. Add
1582 layout_ field. Add constructor.
1583 * script-sections.cc
1584 (Script_sections::attach_sections_using_phdrs_clause): Rename
1585 local orphan to is_orphan. Don't report failure to put empty
1586 section in segment. On attachment failure, report name of
1587 section, and attach to first PT_LOAD segment.
1589 2011-06-28 Ian Lance Taylor <iant@google.com>
1592 * target-select.cc (Target_selector::Target_selector): Add
1593 emulation parameter. Change all callers.
1594 (select_target_by_bfd_name): Rename from select_target_by_name.
1596 (select_target_by_emulation): New function.
1597 (supported_emulation_names): New function.
1598 * target-select.h (class Target_selector): Add emulation_ field.
1599 Update declarations.
1600 (Target_selector::recognize_by_bfd_name): Rename from
1601 recognize_by_name. Change all callers.
1602 (Target_selector::supported_bfd_names): Rename from
1603 supported_names. Change all callers.
1604 (Target_selector::recognize_by_emulation): New function.
1605 (Target_selector::supported_emulations): New function.
1606 (Target_selector::emulation): New function.
1607 (Target_selector::do_recognize_by_bfd_name): Rename from
1608 do_recognize_by_name. Change all callers.
1609 (Target_selector::do_supported_bfd_names): Rename from
1610 do_supported_names. Change all callers.
1611 (Target_selector::do_recognize_by_emulation): New function.
1612 (Target_selector::do_supported_emulations): New function.
1613 (select_target_by_bfd_name): Change name in declaration.
1614 (select_target_by_emulation): Declare.
1615 (supported_emulation_names): Declare.
1616 * parameters.cc (parameters_force_valid_target): Try to find
1617 target based on emulation from -m option.
1618 * options.h (class General_options): Change doc string for -m.
1619 * options.cc (help): Print emulations.
1620 (General_options::parse_V): Likewise.
1621 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1622 Add emulation parameter. Change all callers.
1624 2011-06-28 Ian Lance Taylor <iant@google.com>
1626 * target.h (class Target): Add osabi_ field.
1627 (Target::osabi): New function.
1628 (Target::set_osabi): New function.
1629 (Target::Target): Initialize osabi_.
1630 (Target::do_adjust_elf_header): Make pure virtual.
1631 (Sized_target::do_adjust_elf_header): Declare.
1632 * target.cc (Sized_target::do_adjust_elf_header): New function.
1633 (class Sized_target): Instantiate all versions.
1634 * freebsd.h (class Target_freebsd): Remove.
1635 (Target_selector_freebsd::do_recognize): Call set_osabi on
1637 (Target_selector_freebsd::do_recognize_by_name): Likewise.
1638 (Target_selector_freebsd::set_osabi): Remove.
1639 * i386.cc (class Target_i386): Inherit from Sized_target rather
1640 than Target_freebsd.
1641 * x86_64.cc (class Target_x86_64): Likewise.
1643 2011-06-28 Ian Lance Taylor <iant@google.com>
1645 * target.h (Target::can_check_for_function_pointers): Rewrite.
1647 (Target::can_icf_inline_merge_sections): Likewise.
1648 (Target::section_may_have_icf_unsafe_poineters): Likewise.
1649 (Target::Target_info): Add can_icf_inline_merge_sections field.
1650 (Target::do_can_check_for_function_pointers): New virtual
1652 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
1653 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
1654 from can_check_for_function_pointers, move in file.
1655 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
1656 section_may_have_icf_unsafe_poineters, move in file.
1657 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
1658 * i386.cc (Target_i386::do_can_check_for_function_pointers):
1659 Rename from can_check_for_function_pointers, move in file.
1660 (Target_i386::can_icf_inline_merge_sections): Remove.
1661 (Target_i386::i386_info): Initialize
1662 can_icf_inline_merge_sections.
1663 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1664 Initialize can_icf_inline_merge_sections.
1665 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
1666 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
1667 Rename from can_check_for_function_pointers, move in file.
1668 (Target_x86_64::can_icf_inline_merge_sections): Remove.
1669 (Target_x86_64::x86_64_info): Initialize
1670 can_icf_inline_merge_sections.
1671 * testsuite/testfile.cc (Target_test::test_target_info):
1673 * icf.cc (get_section_contents): Correct formatting.
1675 2011-06-27 Ian Lance Taylor <iant@google.com>
1677 * symtab.cc (Symbol::versioned_name): New function.
1678 (Symbol_table::add_to_final_symtab): Use versioned_name when
1680 (Symbol_table::sized_write_symbol): Likewise.
1681 * symtab.h (class Symbol): Declare versioned_name.
1682 * stringpool.h (class Stringpool_template): Add variant of add
1683 which takes a std::basic_string.
1684 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
1685 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
1686 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
1687 (ver_test_12.o): New target.
1688 * testsuite/Makefile.in: Rebuild.
1690 2011-06-27 Doug Kwan <dougkwan@google.com>
1692 * arm.cc (Arm_relocate_functions::thm_jump8,
1693 Arm_relocate_functions::thm_jump11): Use a wider signed
1694 type to compute offset.
1695 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
1697 * testsuite/Makefile.in: Regenerate.
1698 * testsuite/arm_branch_in_range.sh: Check test results of
1699 arm_thm_jump11 and arm_thm_jump8.
1700 * testsuite/arm_thm_jump11.s: New test source file.
1701 * testsuite/arm_thm_jump11.t: New linker script.
1702 * testsuite/arm_thm_jump8.s: New test source file.
1703 * testsuite/arm_thm_jump8.t: New linker script.
1705 2011-06-24 Ian Lance Taylor <iant@google.com>
1707 * layout.cc: Include "object.h".
1708 (ctors_sections_in_init_array): New static variable.
1709 (Layout::is_ctors_in_init_array): New function.
1710 (Layout::layout): Add entry to ctors_sections_in_init_array if
1712 * layout.h (class Layout): Declare is_ctors_in_init_array.
1713 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
1714 is_ctors_reverse_view is set.
1715 (Sized_relobj_file::write_sections): Add layout parameter. Change
1716 all callers. Set is_ctors_reverse_view field of View_size.
1717 (Sized_relobj_file::reverse_words): New function.
1718 * object.h (Sized_relobj_file::View_size): Add
1719 is_ctors_reverse_view field.
1720 (class Sized_relobj_file): Update declarations.
1721 * testsuite/initpri3.c: New test.
1722 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
1724 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
1725 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
1726 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
1727 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
1728 * testsuite/Makefile.in: Rebuild.
1730 2011-06-24 Cary Coutant <ccoutant@google.com>
1732 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
1733 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
1734 (debug_msg_cdebug.err): New targets.
1735 * testsuite/Makefile.in: Regenerate.
1736 * testsuite/debug_msg.sh: Check output of link with compressed debug.
1737 Fix checks for link with shared library.
1739 2011-06-24 Doug Kwan <dougkwan@google.com>
1741 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
1742 skip empty text sections.
1743 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
1745 2011-06-22 Ian Lance Taylor <iant@google.com>
1748 * options.h (class General_options): Add --ctors-in-init-array.
1749 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
1750 friends as SHT_PROGBITS for merging sections.
1751 (Layout::layout): Remove special handling of .init_array and
1752 friends. Don't sort if doing relocatable link. Sort for .ctors
1753 and .dtors if ctors_in_init_array.
1754 (Layout::make_output_section): Force correct section types for
1755 .init_array and friends. Don't sort if doing relocatable link,
1756 Don't sort .ctors and .dtors if ctors_in_init_array.
1757 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
1758 (Layout::output_section_name): Add relobj parameter. Change all
1759 callers. Handle .ctors. and .dtors. in code rather than table.
1760 Handle .ctors and .dtors if ctors_in_init_array.
1761 (Layout::match_file_name): New function, moved from output.cc.
1762 * layout.h (class Layout): Update declarations.
1763 * output.cc: Include "layout.h".
1764 (Input_section_sort_entry::get_priority): New function.
1765 (Input_section_sort_entry::match_file_name): Just call
1766 Layout::match_file_name.
1767 (Output_section::Input_section_sort_init_fini_compare::operator()):
1768 Handle .ctors and .dtors. Sort by explicit priority rather than
1770 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
1771 * testsuite/initpri2.c: New test.
1772 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
1773 (check_PROGRAMS): Add initpri2.
1774 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
1775 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
1776 * configure, testsuite/Makefile.in: Rebuild.
1778 2011-06-19 Ian Lance Taylor <iant@google.com>
1781 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
1782 .interp section to a PT_INTERP segment even if we have seen a
1783 --dynamic-linker option. Don't do it if we have seen a PHDRS
1784 clause in a linker script.
1785 (Layout::finalize): Don't create a .interp section if we've
1786 already create a PT_INTERP segment.
1787 (Layout::create_interp): Always call choose_output_section (revert
1788 patch of 2011-06-17). Don't create PT_INTERP segment.
1789 * script-sections.cc
1790 (Script_sections::create_note_and_tls_segments): Add a .interp
1791 section to a PT_INTERP segment even if we have seen a
1792 --dynamic-linker option.
1794 2011-06-18 Ian Lance Taylor <iant@google.com>
1796 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
1797 merely because a non-PT_LOAD segment has a dynamic reloc.
1799 2011-06-18 Ian Lance Taylor <iant@google.com>
1801 * layout.cc (Layout::finish_dynamic_section): Don't create
1802 DT_FLAGS entry if not needed.
1804 2011-06-18 Ian Lance Taylor <iant@google.com>
1807 * layout.cc (Layout::layout_eh_frame): Correct handling of
1808 writable .eh_frame section.
1810 2011-06-17 Ian Lance Taylor <iant@google.com>
1813 * resolve.cc (Symbol_table::resolve): Don't give an error if a
1814 symbol is redefined with the exact same object and value.
1816 2011-06-17 Ian Lance Taylor <iant@google.com>
1819 * layout.h (class Layout): Add interp_segment_ field.
1820 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
1821 (Layout::attach_allocated_section_to_segment): If making shared
1822 library, put .interp section in PT_INTERP segment.
1823 (Layout::finalize): Also call create_interp if -dynamic-linker
1825 (Layout::create_interp): Assert that there is no PT_INTERP
1826 segment. If not using a SECTIONS clause, use make_output_section.
1827 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
1828 * script-sections.cc
1829 (Script_sections::create_note_and_tls_segments): If making shared
1830 library, put .interp section in PT_INTERP segment.
1832 2011-06-17 Ian Lance Taylor <iant@google.com>
1834 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
1835 when making a shared library.
1837 2011-06-17 Ian Lance Taylor <iant@google.com>
1839 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
1840 parameter. Change all callers. Don't issue warning about PC32
1841 against locally defined symbol.
1843 2011-06-16 Ian Lance Taylor <iant@google.com>
1845 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
1846 occurs in same object.
1848 2011-06-14 Alan Modra <amodra@gmail.com>
1850 * po/POTFILES.in: Regenerate.
1852 2011-06-09 Ian Lance Taylor <iant@google.com>
1854 * script-sections.cc
1855 (Orphan_output_section::set_section_addresses): For a relocatable
1856 link set address to 0.
1858 2011-06-09 Cary Coutant <ccoutant@google.com>
1861 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
1862 used with --compress-debug-sections.
1863 * gold/object.cc (Sized_relobj_file::do_layout): Report
1864 uncompressed size of compressed input sections.
1866 2011-06-08 Cary Coutant <ccoutant@google.com>
1869 * testsuite/two_file_test_2_v1.cc: Change initialization of
1870 v2 to keep it in .data.
1872 2011-06-07 Cary Coutant <ccoutant@google.com>
1874 * common.cc (Symbol_table::do_allocate_commons_list): Call
1876 * errors.cc (Errors::fatal): Adjust call to gold_exit.
1877 (Errors::fallback): New function.
1878 (gold_fallback): New function.
1879 * errors.h (Errors::fallback): New function.
1880 * gold.cc (gold_exit): Change status parameter to enum; adjust
1882 (queue_initial_tasks): Call gold_fallback.
1883 * gold.h: Include cstdlib.
1884 (Exit_status): New enum type.
1885 (gold_exit): Change status parameter to enum.
1886 (gold_fallback): New function.
1887 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
1888 (Layout::create_symtab_sections): Likewise.
1889 (Layout::create_shdrs): Likewise.
1890 * main.cc (main): Adjust call to gold_exit.
1891 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
1892 (Output_data_got::add_got_entry_pair): Likewise.
1893 (Output_section::add_input_section): Likewise.
1894 (Output_section::add_output_section_data): Likewise.
1895 (Output_segment::set_section_list_addresses): Likewise.
1896 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
1898 2011-06-07 Cary Coutant <ccoutant@google.com>
1900 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
1901 for incremental links.
1902 * output.cc (Output_segment::set_section_list_addresses): Remove
1903 FIXME and test for TLS or BSS.
1905 2011-06-07 Cary Coutant <ccoutant@google.com>
1907 * testsuite/Makefile.am: Add incremental_copy_test,
1908 incremental_common_test_1.
1909 * testsuite/Makefile.in: Regenerate.
1910 * testsuite/common_test_1_v1.c: New source file.
1911 * testsuite/common_test_1_v2.c: New source file.
1912 * testsuite/copy_test_v1.cc: New source file.
1914 2011-06-07 Cary Coutant <ccoutant@google.com>
1916 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
1917 update, allocate common from bss section's free list.
1918 * incremental-dump.cc (dump_incremental_inputs): Print flag for
1919 linker-defined symbols.
1920 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1921 Skip GOT and PLT entries that are no longer referenced.
1922 (Output_section_incremental_inputs::write_info_blocks): Mark
1923 linker-defined symbols.
1924 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
1925 * output.cc (Output_section::allocate): New function.
1926 * output.h (Output_section::allocate): New function.
1927 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
1928 linker-defined symbols.
1929 (Symbol::override_base_with_special): Copy is_predefined_ flag.
1930 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
1931 (Symbol::init_base_output_data): Likewise.
1932 (Symbol::init_base_output_segment): Likewise.
1933 (Symbol::init_base_constant): Likewise.
1934 (Sized_symbol::init_output_data): Likewise.
1935 (Sized_symbol::init_output_segment): Likewise.
1936 (Sized_symbol::init_constant): Likewise.
1937 (Symbol_table::do_define_in_output_data): Likewise.
1938 (Symbol_table::do_define_in_output_segment): Likewise.
1939 (Symbol_table::do_define_as_constant): Likewise.
1940 * symtab.h (Symbol::is_predefined): New function.
1941 (Symbol::init_base_output_data): Add is_predefined parameter.
1942 (Symbol::init_base_output_segment): Likewise.
1943 (Symbol::init_base_constant): Likewise.
1944 (Symbol::is_predefined_): New data member.
1945 (Sized_symbol::init_output_data): Add is_predefined parameter.
1946 (Sized_symbol::init_output_segment): Likewise.
1947 (Sized_symbol::init_constant): Likewise.
1948 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
1950 2011-06-07 Cary Coutant <ccoutant@google.com>
1952 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
1953 instead of emit_copy_reloc.
1954 (Copy_relocs::emit_copy_reloc): Refactor.
1955 (Copy_relocs::make_copy_reloc): New function.
1956 (Copy_relocs::add_copy_reloc): Remove.
1957 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
1959 (Copy_relocs::make_copy_reloc): New function.
1960 (Copy_relocs::add_copy_reloc): Remove.
1961 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
1962 unchanged input files.
1963 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
1964 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
1965 Reserve BSS space for COPY relocations.
1966 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1967 (Output_section_incremental_inputs::write_info_blocks): Record
1968 whether a symbol is copied from a shared object.
1969 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
1970 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
1971 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
1972 (Incremental_input_entry_reader::get_output_symbol_index): Add
1974 (Incremental_binary::emit_copy_relocs): New function.
1975 (Incremental_binary::do_emit_copy_relocs): New function.
1976 (Sized_incremental_binary::Sized_incremental_binary): Initialize
1978 (Sized_incremental_binary::add_copy_reloc): New function.
1979 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1980 (Sized_incremental_binary::Copy_reloc): New struct.
1981 (Sized_incremental_binary::Copy_relocs): New typedef.
1982 (Sized_incremental_binary::copy_relocs_): New data member.
1983 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
1984 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
1985 * target.h (Sized_target::emit_copy_reloc): New function.
1986 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
1988 2011-06-02 Cary Coutant <ccoutant@google.com>
1991 * gold/archive.cc (Archive::Archive): Initialize new data member.
1992 (Archive::include_all_members): Return if archive has already been
1994 * gold/archive.h (Archive::include_all_members_): New data member.
1996 2011-06-02 Nick Clifton <nickc@redhat.com>
1998 * dynobj.h: Fix spelling mistake in comment.
1999 * output.cc: Likewise.
2001 2011-05-31 Doug Kwan <dougkwan@google.com>
2005 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
2006 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
2007 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
2008 redundant arm_exidx_test.so.
2009 * testsuite/Makefile.in: Regenerate.
2010 (check_SCRIPTS): Add pr12826.sh
2011 (check_DATA): Add pr12826.stdout
2012 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
2013 * testsuite/pr12826.sh: New file.
2014 * testsuite/pr12826_1.s: Ditto.
2015 * testsuite/pr12826_1.s: Ditto.
2017 2011-05-30 Ian Lance Taylor <iant@google.com>
2019 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
2022 2011-05-29 Ian Lance Taylor <iant@google.com>
2025 * testsuite/Makefile.am: Use different file name for two_file_test
2026 temporary file for each incremental test.
2027 * testsuite/Makefile.in: Rebuild.
2029 2011-05-29 Ian Lance Taylor <iant@google.com>
2031 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
2032 binary input file is empty.
2034 2011-05-27 Ian Lance Taylor <iant@google.com>
2036 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
2037 (ver_test_9.so): Likewise.
2038 * testsuite/Makefile.in: Rebuild.
2040 2011-05-26 Cary Coutant <ccoutant@google.com>
2042 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
2043 * incremental.cc (Incremental_inputs::report_input_section): Fix
2044 comment, indentation.
2045 (Incremental_inputs::report_comdat_group): New function.
2046 (Output_section_incremental_inputs::set_final_data_size): Adjust size
2047 of data for incremental input file entry.
2048 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
2049 group count, COMDAT group signatures.
2050 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
2051 an unchanged input file.
2052 * incremental.h (Incremental_object_entry::Incremental_object_entry):
2053 Initialize new data member.
2054 (Incremental_object_entry::add_comdat_group): New function.
2055 (Incremental_object_entry::get_comdat_group_count): New function.
2056 (Incremental_object_entry::get_comdat_signature_key): New function.
2057 (Incremental_object_entry::groups_): New data member.
2058 (Incremental_inputs::report_comdat_group): New function.
2059 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
2060 data for incremental input file entry.
2061 (Incremental_input_entry_reader::get_comdat_group_count): New function.
2062 (Incremental_input_entry_reader::get_input_section): Adjust size of
2063 data for incremental input file entry.
2064 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
2065 (Incremental_input_entry_reader::get_comdat_group_signature): New
2067 * object.cc (Sized_relobj::include_section_group): Report kept
2068 COMDAT groups for incremental links.
2070 2011-05-24 David Meyer <pdox@google.com>
2072 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
2073 with name parameter. Add found_name parameter.
2074 * fileread.cc (Input_file::find_file): Adjust code accordingly.
2075 * dirsearch.h (class Dirsearch): Update declaration.
2077 2011-05-24 Ian Lance Taylor <iant@google.com>
2079 * archive.cc (Library_base::should_include_member): Pull in object
2080 from archive if it defines the entry symbol.
2081 * parameters.cc (Parameters::entry): New function.
2082 * parameters.h (class Parameters): Declare entry.
2083 * output.h (class Output_file_header): Remove entry_ field.
2084 * output.cc (Output_file_header::Output_file_header): Remove entry
2085 parameter. Change all callers.
2086 (Output_file_header::entry): Use parameters->entry.
2087 * gold.cc (queue_middle_tasks): Likewise.
2088 * plugin.cc (Plugin_hook::run): Likewise.
2090 2011-05-24 Cary Coutant <ccoutant@google.com>
2092 * gold.cc (queue_initial_tasks): Pass incremental base filename
2093 to Output_file::open_base_file; don't print error message.
2094 * incremental-dump.cc (main): Adjust call to
2095 Output_file::open_for_modification.
2096 * incremental-dump.cc (main): Likewise.
2097 * incremental.cc (Incremental_inputs::report_command_line):
2098 Ignore --incremental-base option when comparing command lines.
2099 Ignore parameter when given as separate argument.
2100 * options.h (class General_options): Add --incremental-base.
2101 * output.cc (Output_file::Output_file):
2102 (Output_file::open_base_file): Add base_name and writable parameters;
2103 read base file into new file; print error message here.
2104 (Output_file::map_no_anonymous): Add writable parameter; adjust all
2106 * output.h (Output_file::open_for_modification): Rename to...
2107 (Output_file::open_base_file): ...this; add base_name and
2108 writable parameters; adjust all callers.
2109 (Output_file::map_no_anonymous): Add writable parameter; adjust all
2111 * testsuite/Makefile.am (incremental_test_4): Test
2113 * testsuite/Makefile.in: Regenerate.
2115 2011-05-24 Cary Coutant <ccoutant@google.com>
2117 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
2119 * testsuite/Makefile.in: Regenerate.
2120 * testsuite/two_file_test_1_v1.cc: New test source file.
2121 * testsuite/two_file_test_1b_v1.cc: New test source file.
2122 * testsuite/two_file_test_2_v1.cc: New test source file.
2124 2011-05-24 Cary Coutant <ccoutant@google.com>
2126 * dynobj.h (Dynobj::do_dynobj): New function.
2127 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
2128 flag and soname for shared objects.
2129 * incremental.cc (Incremental_inputs::report_object): Make
2130 either Incremental_object_entry or Incremental_dynobj_entry; add
2131 soname to string table.
2132 (Incremental_inputs::report_input_section): Add assertion.
2133 (Output_section_incremental_inputs::set_final_data_size): Adjust
2134 type of input file entry for shared libraries; adjust size of
2135 shared library info entry.
2136 (Output_section_incremental_inputs::write_input_files): Write
2137 as_needed flag for shared libraries.
2138 (Output_section_incremental_inputs::write_info_blocks): Adjust type
2139 of input file entry for shared libraries; write soname.
2140 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
2141 soname from incremental info.
2142 * incremental.h (enum Incremental_input_flags): Add
2143 INCREMENTAL_INPUT_AS_NEEDED.
2144 (Incremental_input_entry::Incremental_input_entry): Initialize new
2146 (Incremental_input_entry::set_as_needed): New function.
2147 (Incremental_input_entry::as_needed): New function.
2148 (Incremental_input_entry::do_dynobj_entry): New function.
2149 (Incremental_input_entry::as_needed_): New data member.
2150 (Incremental_object_entry::Incremental_object_entry): Don't check
2152 (Incremental_object_entry::do_type): Likewise.
2153 (class Incremental_dynobj_entry): New class.
2154 (Incremental_input_entry_reader::as_needed): New function.
2155 (Incremental_input_entry_reader::get_soname): New function.
2156 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
2157 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
2158 size of shared library info entry.
2159 * layout.cc (Layout::finish_dynamic_section): Don't test for
2160 incremental link when adding DT_NEEDED entries.
2161 * object.h (Object::Object): Initialize new data member.
2162 (Object::dynobj): New function.
2163 (Object::set_as_needed): New function.
2164 (Object::as_needed): New function.
2165 (Object::do_dynobj): New function.
2166 (Object::as_needed_): New data member.
2168 2011-05-24 Cary Coutant <ccoutant@google.com>
2170 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
2171 info; adjust display of GOT entries.
2172 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2173 vector of input objects; remove file_status_.
2174 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
2175 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
2176 got_plt reader; call target hooks to reserve GOT entries.
2177 (Output_section_incremental_inputs::set_final_data_size): Adjust size
2178 of input file info header and GOT info entry.
2179 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
2181 (Got_plt_view_info::got_descriptor): Remove.
2182 (Got_plt_view_info::sym_index): New data member.
2183 (Got_plt_view_info::input_index): New data member.
2184 (Local_got_offset_visitor::visit): Write input file index.
2185 (Global_got_offset_visitor::visit): Write 0 for input file index.
2186 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
2187 with sym_index and input_index.
2188 (Output_section_incremental_inputs::write_got_plt): Adjust size of
2189 incremental info GOT entry; replace got_descriptor with input_index.
2190 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
2191 map from input file index to object.
2192 (Sized_relobj_incr::do_layout): Replace direct data member reference
2193 with accessor function.
2194 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
2195 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
2196 Adjust size of input file info header.
2197 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
2198 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
2199 (Incremental_input_entry_reader::get_input_section): Adjust size of
2200 input file info header.
2201 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
2202 of incremental info GOT entry.
2203 (Incremental_got_plt_reader::get_got_desc): Remove.
2204 (Incremental_got_plt_reader::get_got_symndx): New function.
2205 (Incremental_got_plt_reader::get_got_input_index): New function.
2206 (Sized_incremental_binary::Sized_incremental_binary): Remove
2207 file_status_; add input_objects_.
2208 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
2209 (Sized_incremental_binary::set_file_is_unchanged): Remove.
2210 (Sized_incremental_binary::file_is_unchanged): Remove.
2211 (Sized_incremental_binary::set_input_object): New function.
2212 (Sized_incremental_binary::input_object): New function.
2213 (Sized_incremental_binary::file_status_): Remove.
2214 (Sized_incremental_binary::input_objects_): New data member.
2215 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
2217 (Sized_relobj_incr::invalid_address): Move to base class.
2218 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
2220 (Sized_relobj_incr::do_output_section_offset): Likewise.
2221 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
2222 (Sized_relobj_incr::section_offsets_): Likewise.
2223 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
2225 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
2226 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
2227 with accessor function.
2228 (Sized_relobj_file::do_layout): Likewise.
2229 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
2230 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
2231 (Sized_relobj_file::compute_final_local_value): Replace refs to
2232 section_offsets_ with accessor function.
2233 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
2234 * object.h (Relobj::Relobj): Initialize new data members.
2235 (Relobj::add_dyn_reloc): New function.
2236 (Relobj::first_dyn_reloc): New function.
2237 (Relobj::dyn_reloc_count): New function.
2238 (Relobj::first_dyn_reloc_): New data member.
2239 (Relobj::dyn_reloc_count_): New data member.
2240 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
2242 (Sized_relobj::Address): New typedef.
2243 (Sized_relobj::invalid_address): Move here from child class.
2244 (Sized_relobj::Sized_relobj): Initialize new data members.
2245 (Sized_relobj::sized_relobj): New function.
2246 (Sized_relobj::is_output_section_offset_invalid): Move here from
2248 (Sized_relobj::get_output_section_offset): Likewise.
2249 (Sized_relobj::local_has_got_offset): Likewise.
2250 (Sized_relobj::local_got_offset): Likewise.
2251 (Sized_relobj::set_local_got_offset): Likewise.
2252 (Sized_relobj::do_for_all_local_got_entries): Likewise.
2253 (Sized_relobj::clear_got_offsets): New function.
2254 (Sized_relobj::section_offsets): Move here from child class.
2255 (Sized_relobj::do_output_section_offset): Likewise.
2256 (Sized_relobj::do_set_section_offset): Likewise.
2257 (Sized_relobj::Local_got_offsets): Likewise.
2258 (Sized_relobj::local_got_offsets_): Likewise.
2259 (Sized_relobj::section_offsets_): Likewise.
2260 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
2262 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
2264 (Sized_relobj_file::sized_relobj): New function
2265 (Sized_relobj_file::local_has_got_offset): Move to base class.
2266 (Sized_relobj_file::local_got_offset): Likewise.
2267 (Sized_relobj_file::set_local_got_offset): Likewise.
2268 (Sized_relobj_file::get_output_section_offset): Likewise.
2269 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
2270 (Sized_relobj_file::do_output_section_offset): Likewise.
2271 (Sized_relobj_file::do_set_section_offset): Likewise.
2272 (Sized_relobj_file::Local_got_offsets): Likewise.
2273 (Sized_relobj_file::local_got_offsets_): Likewise.
2274 (Sized_relobj_file::section_offsets_): Likewise.
2275 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
2277 (set_needs_dynsym_index): Convert relobj to derived class pointer.
2278 (Output_reloc::get_symbol_index): Likewise.
2279 (Output_reloc::local_section_offset): Likewise.
2280 (Output_reloc::get_address): Likewise.
2281 (Output_reloc::symbol_value): Likewise.
2282 (Output_data_got::reserve_slot): Move to class definition.
2283 (Output_data_got::reserve_local): New function.
2284 (Output_data_got::reserve_slot_for_global): Remove.
2285 (Output_data_got::reserve_global): New function.
2286 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
2287 (all constructors, two instantiations).
2288 (Output_reloc::get_relobj): New function (two instantiations).
2289 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
2290 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
2291 (Output_data_reloc::add_global): Adjust type of relobj.
2292 (Output_data_reloc::add_global_relative): Likewise.
2293 (Output_data_reloc::add_symbolless_global_addend): Likewise.
2294 (Output_data_reloc::add_local): Likewise.
2295 (Output_data_reloc::add_local_relative): Likewise.
2296 (Output_data_reloc::add_symbolless_local_addend): Likewise.
2297 (Output_data_reloc::add_local_section): Likewise.
2298 (Output_data_reloc::add_output_section): Likewise.
2299 (Output_data_reloc::add_absolute): Likewise.
2300 (Output_data_reloc::add_target_specific): Likewise.
2301 (Output_data_got::reserve_slot): Move definition here.
2302 (Output_data_got::reserve_local): New function.
2303 (Output_data_got::reserve_global): New function.
2304 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
2305 section_offsets_ with accessor function.
2306 (Sized_relobj_file::write_sections): Likewise.
2307 (Sized_relobj_file::do_relocate_sections): Likewise.
2308 * target.h (Sized_target::reserve_local_got_entry): New function.
2309 (Sized_target::reserve_global_got_entry): New function.
2310 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
2311 (Target_x86_64::reserve_global_got_entry): New function.
2312 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
2314 2011-05-23 Cary Coutant <ccoutant@google.com>
2316 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
2317 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
2318 bit when checking got_type.
2319 * incremental.cc (Sized_incremental_binary::setup_readers):
2320 Store symbol table and string table locations; initialize bit vector
2321 of file status flags.
2322 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
2324 (Sized_incremental_binary::do_process_got_plt): New function.
2325 (Sized_incremental_binary::get_symtab_view): Use stored locations.
2326 (Output_section_incremental_inputs::set_final_data_size): Record
2327 file index for each input file.
2328 (Output_section_incremental_inputs::write_got_plt): Store file index
2329 instead of input entry offset for each GOT entry.
2331 (Incremental_input_entry::Incremental_input_entry): Initialize new
2333 (Incremental_input_entry::set_offset): Store file index.
2334 (Incremental_input_entry::get_file_index): New function.
2335 (Incremental_input_entry::file_index_): New data member.
2336 (Incremental_binary::process_got_plt): New function.
2337 (Incremental_binary::do_process_got_plt): New function.
2338 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2340 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
2341 (Sized_incremental_binary::set_file_is_unchanged): New function.
2342 (Sized_incremental_binary::file_is_unchanged): New function.
2343 (Sized_incremental_binary::do_process_got_plt): New function.
2344 (Sized_incremental_binary::file_status_): New data member.
2345 (Sized_incremental_binary::main_symtab_loc_): New data member.
2346 (Sized_incremental_binary::main_strtab_loc_): New data member.
2347 * output.cc (Output_data_got::Got_entry::write): Add case
2349 (Output_data_got::add_global): Call add_got_entry.
2350 (Output_data_got::add_global_plt): Likewise.
2351 (Output_data_got::add_global_with_rel): Likewise.
2352 (Output_data_got::add_global_with_rela): Likewise.
2353 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
2354 (Output_data_got::add_global_pair_with_rela): Likewise.
2355 (Output_data_got::add_local): Call add_got_entry.
2356 (Output_data_got::add_local_plt): Likewise.
2357 (Output_data_got::add_local_with_rel): Likewise.
2358 (Output_data_got::add_local_with_rela): Likewise.
2359 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
2360 (Output_data_got::add_local_pair_with_rela): Likewise.
2361 (Output_data_got::reserve_slot): New function.
2362 (Output_data_got::reserve_slot_for_global): New function.
2363 (Output_data_got::add_got_entry): New function.
2364 (Output_data_got::add_got_entry_pair): New function.
2365 (Output_section::add_output_section_data): Edit FIXME.
2367 (Output_section_data_build::Output_section_data_build): New
2368 constructor with size parameter.
2369 (Output_data_space::Output_data_space): Likewise.
2370 (Output_data_got::Output_data_got): Initialize new data member; new
2371 constructor with size parameter.
2372 (Output_data_got::add_constant): Call add_got_entry.
2373 (Output_data_got::reserve_slot): New function.
2374 (Output_data_got::reserve_slot_for_global): New function.
2375 (class Output_data_got::Got_entry): Add RESERVED_CODE.
2376 (Output_data_got::add_got_entry): New function.
2377 (Output_data_got::add_got_entry_pair): New function.
2378 (Output_data_got::free_list_): New data member.
2379 * target.h (Sized_target::init_got_plt_for_update): New function.
2380 (Sized_target::register_global_plt_entry): New function.
2381 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2382 Initialize new data member; call init; add constructor with PLT count.
2383 (Output_data_plt_x86_64::init): New function.
2384 (Output_data_plt_x86_64::add_relocation): New function.
2385 (Output_data_plt_x86_64::reserve_slot): New function.
2386 (Output_data_plt_x86_64::free_list_): New data member.
2387 (Target_x86_64::init_got_plt_for_update): New function.
2388 (Target_x86_64::register_global_plt_entry): New function.
2389 (Output_data_plt_x86_64::add_entry): Allocate from free list for
2390 incremental updates.
2391 (Output_data_plt_x86_64::add_relocation): New function.
2392 * testsuite/object_unittest.cc (Object_test): Set default options.
2394 2011-05-16 Ian Lance Taylor <iant@google.com>
2396 * options.h (class General_options): Make -i a synonym for -r.
2398 2011-05-16 Ian Lance Taylor <iant@google.com>
2400 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
2402 2011-05-10 Cary Coutant <ccoutant@google.com>
2404 * object.cc (Sized_relobj::do_count_local_symbols): Check for
2407 2011-05-06 Ian Lance Taylor <iant@google.com>
2409 * layout.cc (Layout::layout): If the output section flags change,
2410 update the ordering.
2412 2011-04-25 Cary Coutant <ccoutant@google.com>
2414 * incremental-dump.cc (dump_incremental_inputs): Print local
2415 symbol info for each input file.
2417 (Output_section_incremental_inputs::set_final_data_size): Add local
2418 symbol info to input file entries in incremental info.
2419 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2420 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
2421 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
2422 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
2424 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
2425 (Sized_incr_relobj::do_relocate): Write the local symbols.
2426 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
2427 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
2428 Adjust size of input file header.
2429 (Incremental_inputs_reader::get_local_symbol_offset): New function.
2430 (Incremental_inputs_reader::get_local_symbol_count): New function.
2431 (Incremental_inputs_reader::get_input_section): Adjust size of input
2433 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
2434 (Sized_incr_relobj::This): New typedef.
2435 (Sized_incr_relobj::sym_size): New const data member.
2436 (Sized_incr_relobj::Local_symbol): New struct.
2437 (Sized_incr_relobj::do_output_local_symbol_count): New function.
2438 (Sized_incr_relobj::do_local_symbol_offset): New function.
2439 (Sized_incr_relobj::local_symbol_count_): New data member.
2440 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
2441 (Sized_incr_relobj::local_symbol_index_): New data member.
2442 (Sized_incr_relobj::local_symbol_offset_): New data member.
2443 (Sized_incr_relobj::local_dynsym_offset_): New data member.
2444 (Sized_incr_relobj::local_symbols_): New data member.
2445 * object.h (Relobj::output_local_symbol_count): New function.
2446 (Relobj::local_symbol_offset): New function.
2447 (Relobj::do_output_local_symbol_count): New function.
2448 (Relobj::do_local_symbol_offset): New function.
2449 (Sized_relobj::do_output_local_symbol_count): New function.
2450 (Sized_relobj::do_local_symbol_offset): New function.
2452 2011-04-22 Vladimir Simonov <sv@sw.ru>
2454 * descriptors.cc (set_close_on_exec): New function.
2455 (Descriptors::open): Use set_close_on_exec.
2456 * output.cc (S_ISLNK): Define if not defined.
2458 2011-04-22 Cary Coutant <ccoutant@google.com>
2460 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2462 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2463 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
2464 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
2466 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
2467 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
2468 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
2470 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
2472 (Incremental_binary::apply_incremental_relocs): New function.
2473 (Incremental_binary::do_apply_incremental_relocs): New function.
2474 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2476 (Sized_incremental_binary::add_global_symbol): New function.
2477 (Sized_incremental_binary::global_symbol): New function.
2478 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2479 (Sized_incremental_binary::symbol_map_): New data member.
2480 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
2481 * target.h (Sized_target::apply_relocation): New function.
2482 * target-reloc.h (apply_relocation): New function.
2483 * x86_64.cc (Target_x86_64::apply_relocation): New function.
2485 2011-04-22 Doug Kwan <dougkwan@google.com>
2487 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
2488 flag of a SHT_ARM_EXIDX section.
2489 * testsuite/Makefile.am (arm_exidx_test): New test rules.
2490 * testsuite/Makefile.in: Regenerate.
2491 * testsuite/arm_exidx_test.s: New file.
2492 * testsuite/arm_exidx_test.sh: Same.
2494 2011-04-20 Cary Coutant <ccoutant@google.com>
2497 * archive.h (Incremental_archive_entry::Archive_member):
2498 Initialize arg_serial_ (second constructor).
2500 2011-04-17 Ian Lance Taylor <iant@google.com>
2502 * object.cc (Relocate_info::location): Simplify location string.
2503 * errors.cc (Errors::error_at_location): Don't print program
2505 (Errors::warning_at_location): Likewise.
2506 (Errors::undefined_symbol): Likewise.
2507 * testsuite/debug_msg.sh: Update accordingly.
2509 2011-04-14 Cary Coutant <ccoutant@google.com>
2511 * gold/layout.cc (Layout::symtab_section_offset): New function.
2512 * gold/layout.h (Layout::symtab_section_offset): New function.
2513 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
2515 2011-04-12 Ian Lance Taylor <iant@google.com>
2517 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
2518 with MREMAP_MAYMOVE.
2519 * output.h (class Output_file): Add map_is_allocated_ field.
2520 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
2521 not available, provide stubs. If mremap is not available, #define
2523 (MREMAP_MAYMOVE): Define if not defined.
2524 (Output_file::Output_file): Initialize map_is_allocated_.
2525 (Output_file::resize): Check map_is_allocated_.
2526 (Output_file::map_anonymous): If mmap fails, use malloc.
2527 (Output_file::unmap): Don't do anything for an anonymous map.
2528 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
2529 is not available, provide stubs.
2530 (File_read::View::~View): Use free rather than delete[].
2531 (File_read::make_view): Use malloc rather than new[]. If mmap
2533 (File_read::find_or_make_view): Use malloc rather than new[].
2534 * gold.h: Remove HAVE_REMAP code.
2535 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
2536 exists. Rename mremap to gold_mremap. If mmap is not available
2538 * configure, config.in: Rebuild.
2540 2011-04-11 Ian Lance Taylor <iant@google.com>
2542 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
2543 initialize local variable v.
2545 2011-04-11 Cary Coutant <ccoutant@google.com>
2547 * archive.cc (Archive::include_member): Adjust call to
2549 (Add_archive_symbols::run): Track argument serial numbers.
2550 (Lib_group::include_member): Likewise.
2551 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
2552 * archive.h (Incremental_archive_entry::Archive_member):
2553 Initialize arg_serial_.
2554 (Archive_member::arg_serial_): New data member.
2555 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
2556 (Sized_dynobj::do_add_symbols): Track symbols when doing an
2558 (Sized_dynobj::do_for_all_local_got_entries): New function.
2559 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
2561 * fileread.cc (get_mtime): New function.
2562 * fileread.h (get_mtime): New function.
2563 * gold.cc (queue_initial_tasks): Check for incremental update.
2564 (process_incremental_input): New function.
2565 (queue_middle_tasks): Don't force valid target for incremental
2567 * incremental-dump.cc (find_input_containing_global): Adjust
2568 size of symbol info entry.
2569 (dump_incremental_inputs): Dump argument serial number and
2570 in_system_directory flag; bias shndx by 1; print symbol names
2571 when dumping per-file symbol lists; use new symbol info readers.
2573 (Output_section_incremental_inputs:update_data_size): New function.
2574 (Sized_incremental_binary::setup_readers): Setup input readers
2575 for each input file; build maps for files added from libraries
2577 (Sized_incremental_binary::check_input_args): New function.
2578 (Sized_incremental_binary::do_check_inputs): Build map of argument
2579 serial numbers to input arguments.
2580 (Sized_incremental_binary::do_file_has_changed): Rename
2581 do_file_is_unchanged to this; compare file modification times.
2582 (Sized_incremental_binary::do_init_layout): New function.
2583 (Sized_incremental_binary::do_reserve_layout): New function.
2584 (Sized_incremental_binary::do_get_input_reader): Remove.
2585 (Sized_incremental_binary::get_symtab_view): New function.
2586 (Incremental_checker::can_incrementally_link_output_file): Remove.
2587 (Incremental_inputs::report_command_line): Exclude --debug options.
2588 (Incremental_inputs::report_archive_begin): Add parameter; track
2589 argument serial numbers; don't put input file entry for archive
2590 before archive members.
2591 (Incremental_inputs::report_archive_end): Put input file entry
2592 for archive after archive members.
2593 (Incremental_inputs::report_object): Add parameter; track argument
2594 serial numbers and in_system_directory flag.
2595 (Incremental_inputs::report_script): Add parameter; track argument
2597 (Output_section_incremental_inputs::set_final_data_size): Adjust
2598 size of symbol info entry; check for forwarding symbols.
2599 (Output_section_incremental_inputs::write_input_files): Write
2600 in_system_directory flag and argument serial number.
2601 (Output_section_incremental_inputs::write_info_blocks): Map section
2602 indices between incremental info and original input file; store
2603 input section index for each symbol.
2604 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2605 change operator() to visit().
2606 (class Global_got_offset_visitor): Likewise.
2607 (class Global_symbol_visitor_got_plt):
2608 (Output_section_incremental_inputs::write_got_plt): Use new visitor
2610 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
2611 (Sized_incr_relobj::do_read_symbols): New function.
2612 (Sized_incr_relobj::do_layout): New function.
2613 (Sized_incr_relobj::do_layout_deferred_sections): New function.
2614 (Sized_incr_relobj::do_add_symbols): New function.
2615 (Sized_incr_relobj::do_should_include_member): New function.
2616 (Sized_incr_relobj::do_for_all_global_symbols): New function.
2617 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
2618 (Sized_incr_relobj::do_section_size): New function.
2619 (Sized_incr_relobj::do_section_name): New function.
2620 (Sized_incr_relobj::do_section_contents): New function.
2621 (Sized_incr_relobj::do_section_flags): New function.
2622 (Sized_incr_relobj::do_section_entsize): New function.
2623 (Sized_incr_relobj::do_section_address): New function.
2624 (Sized_incr_relobj::do_section_type): New function.
2625 (Sized_incr_relobj::do_section_link): New function.
2626 (Sized_incr_relobj::do_section_info): New function.
2627 (Sized_incr_relobj::do_section_addralign): New function.
2628 (Sized_incr_relobj::do_initialize_xindex): New function.
2629 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2630 (Sized_incr_relobj::do_read_relocs): New function.
2631 (Sized_incr_relobj::do_gc_process_relocs): New function.
2632 (Sized_incr_relobj::do_scan_relocs): New function.
2633 (Sized_incr_relobj::do_count_local_symbols): New function.
2634 (Sized_incr_relobj::do_finalize_local_symbols): New function.
2635 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2636 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2637 (Sized_incr_relobj::do_relocate): New function.
2638 (Sized_incr_relobj::do_set_section_offset): New function.
2639 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2640 (Sized_incr_dynobj::do_read_symbols): New function.
2641 (Sized_incr_dynobj::do_layout): New function.
2642 (Sized_incr_dynobj::do_add_symbols): New function.
2643 (Sized_incr_dynobj::do_should_include_member): New function.
2644 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
2645 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
2646 (Sized_incr_dynobj::do_section_size): New function.
2647 (Sized_incr_dynobj::do_section_name): New function.
2648 (Sized_incr_dynobj::do_section_contents): New function.
2649 (Sized_incr_dynobj::do_section_flags): New function.
2650 (Sized_incr_dynobj::do_section_entsize): New function.
2651 (Sized_incr_dynobj::do_section_address): New function.
2652 (Sized_incr_dynobj::do_section_type): New function.
2653 (Sized_incr_dynobj::do_section_link): New function.
2654 (Sized_incr_dynobj::do_section_info): New function.
2655 (Sized_incr_dynobj::do_section_addralign): New function.
2656 (Sized_incr_dynobj::do_initialize_xindex): New function.
2657 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
2658 (make_sized_incremental_object): New function.
2659 (Incremental_library::copy_unused_symbols): New function.
2660 (Incremental_library::do_for_all_unused_symbols): New function.
2661 * incremental.h (enum Incremental_input_flags): New type.
2662 (class Incremental_checker): Remove.
2663 (Incremental_input_entry::Incremental_input_entry): Add argument
2665 (Incremental_input_entry::arg_serial): New function.
2666 (Incremental_input_entry::set_is_in_system_directory): New function.
2667 (Incremental_input_entry::is_in_system_directory): New function.
2668 (Incremental_input_entry::arg_serial_): New data member.
2669 (Incremental_input_entry::is_in_system_directory_): New data member.
2670 (class Script_info): Move here from script.h.
2671 (Script_info::Script_info): Add filename parameter.
2672 (Script_info::filename): New function.
2673 (Script_info::filename_): New data member.
2674 (Incremental_script_entry::Incremental_script_entry): Add argument
2676 (Incremental_object_entry::Incremental_object_entry): Likewise.
2677 (Incremental_object_entry::add_input_section): Build list of input
2678 sections with map to original shndx.
2679 (Incremental_object_entry::get_input_section_index): New function.
2680 (Incremental_object_entry::shndx_): New data member.
2681 (Incremental_object_entry::name_key_): Rename; adjust all refs.
2682 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
2683 (Incremental_archive_entry::Incremental_archive_entry): Add argument
2685 (Incremental_inputs::report_archive_begin): Likewise.
2686 (Incremental_inputs::report_object): Likewise.
2687 (Incremental_inputs::report_script): Likewise.
2688 (class Incremental_global_symbol_reader): New class.
2689 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
2690 and store flags and input file type.
2691 (Incremental_input_entry_reader::arg_serial): New function.
2692 (Incremental_input_entry_reader::type): Extract type from flags.
2693 (Incremental_input_entry_reader::is_in_system_directory): New function.
2694 (Incremental_input_entry_reader::get_input_section_count): Call
2695 accessor function for type.
2696 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
2697 function for type; adjust size of global symbol entry.
2698 (Incremental_input_entry_reader::get_global_symbol_count): Call
2699 accessor function for type.
2700 (Incremental_input_entry_reader::get_object_count): Likewise.
2701 (Incremental_input_entry_reader::get_object_offset): Likewise.
2702 (Incremental_input_entry_reader::get_member_count): Likewise.
2703 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
2704 (Incremental_input_entry_reader::get_member_offset): Likewise.
2705 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
2706 (Incremental_input_entry_reader::Global_symbol_info): Remove.
2707 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
2708 (Incremental_input_entry_reader::get_global_symbol_reader): New
2710 (Incremental_input_entry_reader::get_output_symbol_index): New
2712 (Incremental_input_entry_reader::type_): Remove.
2713 (Incremental_input_entry_reader::flags_): New data member.
2714 (Incremental_inputs_reader::input_file_offset): New function.
2715 (Incremental_inputs_reader::input_file_index): New function.
2716 (Incremental_inputs_reader::input_file): Call input_file_offset.
2717 (Incremental_inputs_reader::input_file_at_offset): New function.
2718 (Incremental_relocs_reader::get_r_type): Reformat.
2719 (Incremental_relocs_reader::get_r_shndx): Reformat.
2720 (Incremental_relocs_reader::get_r_offset): Reformat.
2721 (Incremental_relocs_reader::data): New function.
2722 (Incremental_binary::Incremental_binary): Initialize new data members.
2723 (Incremental_binary::check_inputs): Add cmdline parameter.
2724 (Incremental_binary::file_is_unchanged): Remove.
2725 (Input_reader::arg_serial): New function.
2726 (Input_reader::get_unused_symbol_count): New function.
2727 (Input_reader::get_unused_symbol): New function.
2728 (Input_reader::do_arg_serial): New function.
2729 (Input_reader::do_get_unused_symbol_count): New function.
2730 (Input_reader::do_get_unused_symbol): New function.
2731 (Incremental_binary::input_file_count): New function.
2732 (Incremental_binary::get_input_reader): Change signature to use
2733 index instead of filename.
2734 (Incremental_binary::file_has_changed): New function.
2735 (Incremental_binary::get_input_argument): New function.
2736 (Incremental_binary::get_library): New function.
2737 (Incremental_binary::get_script_info): New function.
2738 (Incremental_binary::init_layout): New function.
2739 (Incremental_binary::reserve_layout): New function.
2740 (Incremental_binary::output_file): New function.
2741 (Incremental_binary::do_check_inputs): New function.
2742 (Incremental_binary::do_file_is_unchanged): Remove.
2743 (Incremental_binary::do_file_has_changed): New function.
2744 (Incremental_binary::do_init_layout): New function.
2745 (Incremental_binary::do_reserve_layout): New function.
2746 (Incremental_binary::do_input_file_count): New function.
2747 (Incremental_binary::do_get_input_reader): Change signature.
2748 (Incremental_binary::input_args_map_): New data member.
2749 (Incremental_binary::library_map_): New data member.
2750 (Incremental_binary::script_map_): New data member.
2751 (Sized_incremental_binary::Sized_incremental_binary): Initialize
2753 (Sized_incremental_binary::output_section): New function.
2754 (Sized_incremental_binary::inputs_reader): Add const.
2755 (Sized_incremental_binary::symtab_reader): Add const.
2756 (Sized_incremental_binary::relocs_reader): Add const.
2757 (Sized_incremental_binary::got_plt_reader): Add const.
2758 (Sized_incremental_binary::get_symtab_view): New function.
2759 (Sized_incremental_binary::Inputs_reader): New typedef.
2760 (Sized_incremental_binary::Input_entry_reader): New typedef.
2761 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
2762 (Sized_incremental_binary::do_file_is_unchanged): Remove.
2763 (Sized_incremental_binary::do_file_has_changed): New function.
2764 (Sized_incremental_binary::do_init_layout): New function.
2765 (Sized_incremental_binary::do_reserve_layout): New function.
2766 (Sized_input_reader::Inputs_reader): Remove.
2767 (Sized_input_reader::Input_entry_reader): Remove.
2768 (Sized_input_reader::do_arg_serial): New function.
2769 (Sized_input_reader::do_get_unused_symbol_count): New function.
2770 (Sized_input_reader::do_get_unused_symbol): New function.
2771 (Sized_incremental_binary::do_input_file_count): New function.
2772 (Sized_incremental_binary::do_get_input_reader): Change signature;
2773 use index instead of filename.
2774 (Sized_incremental_binary::section_map_): New data member.
2775 (Sized_incremental_binary::input_entry_readers_): New data member.
2776 (class Sized_incr_relobj): New class.
2777 (class Sized_incr_dynobj): New class.
2778 (make_sized_incremental_object): New function.
2779 (class Incremental_library): New class.
2780 * layout.cc (Free_list::num_lists): New static data member.
2781 (Free_list::num_nodes): New static data member.
2782 (Free_list::num_removes): New static data member.
2783 (Free_list::num_remove_visits): New static data member.
2784 (Free_list::num_allocates): New static data member.
2785 (Free_list::num_allocate_visits): New static data member.
2786 (Free_list::init): New function.
2787 (Free_list::remove): New function.
2788 (Free_list::allocate): New function.
2789 (Free_list::dump): New function.
2790 (Free_list::print_stats): New function.
2791 (Layout_task_runner::run): Resize output file for incremental updates.
2792 (Layout::Layout): Initialize new data members.
2793 (Layout::set_incremental_base): New function.
2794 (Layout::init_fixed_output_section): New function.
2795 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
2796 incremental updates.
2797 (Layout::create_gold_note): Do not create gold note section for
2798 incremental updates.
2799 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
2800 for incremental updates.
2801 (Layout::set_section_offsets): For incremental updates, allocate space
2803 (Layout::create_symtab_sections): Layout with offsets relative to
2804 start of section; for incremental updates, allocate space from free
2806 (Layout::create_shdrs): For incremental updates, allocate space from
2808 (Layout::finish_dynamic_section): For incremental updates, do not
2809 check --as-needed (fixed in subsequent patch).
2810 * layout.h (class Free_list): New class.
2811 (Layout::set_incremental_base): New function.
2812 (Layout::incremental_base): New function.
2813 (Layout::init_fixed_output_section): New function.
2814 (Layout::allocate): New function.
2815 (Layout::incremental_base_): New data member.
2816 (Layout::free_list_): New data member.
2817 * main.cc (main): Print Free_list statistics.
2818 * object.cc (Relobj::finalize_incremental_relocs): Add
2819 clear_counts parameter; clear counts only when clear_counts is set.
2820 (Sized_relobj::Sized_relobj): Initialize new base class.
2821 (Sized_relobj::do_layout): Don't report special sections.
2822 (Sized_relobj::do_for_all_local_got_entries): New function.
2823 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
2824 symtab_off to all symbol table offsets.
2825 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
2826 * object.h (class Got_offset_list): Move to top of file.
2827 (Object::Object): Allow case where input_file == NULL.
2828 (Object::~Object): Likewise.
2829 (Object::input_file): Assert that input_file != NULL.
2830 (Object::lock): Allow case where input_file == NULL.
2831 (Object::unlock): Likewise.
2832 (Object::is_locked): Likewise.
2833 (Object::token): Likewise.
2834 (Object::release): Likewise.
2835 (Object::is_incremental): New function.
2836 (Object::get_mtime): New function.
2837 (Object::for_all_local_got_entries): New function.
2838 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
2839 (Object::set_is_in_system_directory): New function.
2840 (Object::is_in_system_directory): New function.
2841 (Object::do_is_incremental): New function.
2842 (Object::do_get_mtime): New function.
2843 (Object::do_for_all_local_got_entries): New function.
2844 (Object::is_in_system_directory_): New data member.
2845 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
2846 (class Sized_relobj_base): New class.
2847 (class Sized_relobj): Derive from Sized_relobj_base.
2848 (class Sized_relobj::Symbols): Redeclare from base class.
2849 (class Sized_relobj::local_got_offset_list): Remove.
2850 (class Sized_relobj::Output_sections): Redeclare from base class.
2851 (class Sized_relobj::do_for_all_local_got_entries): New function.
2852 (class Sized_relobj::write_local_symbols): Add offset parameter.
2853 (class Sized_relobj::local_symbol_offset_): Update comment.
2854 (class Sized_relobj::local_dynsym_offset_): Update comment.
2855 * options.cc (Input_arguments::add_file): Remove const.
2856 * options.h (Input_file_argument::Input_file_argument):
2857 Initialize arg_serial_ (all constructors).
2858 (Input_file_argument::set_arg_serial): New function.
2859 (Input_file_argument::arg_serial): New function.
2860 (Input_file_argument::arg_serial_): New data member.
2861 (Input_arguments::Input_arguments): Initialize file_count_.
2862 (Input_arguments::add_file): Remove const.
2863 (Input_arguments::number_of_input_files): New function.
2864 (Input_arguments::file_count_): New data member.
2865 (Command_line::number_of_input_files): Call
2866 Input_arguments::number_of_input_files.
2867 * output.cc (Output_segment_headers::Output_segment_headers):
2869 (Output_section::Input_section::current_data_size): New function.
2870 (Output_section::Output_section): Initialize new data members.
2871 (Output_section::add_input_section): Don't do merge sections for
2872 an incremental link; allocate space from free list for an
2874 (Output_section::add_output_section_data): Allocate space from
2875 free list for an incremental update.
2876 (Output_section::update_data_size): New function.
2877 (Output_section::set_fixed_layout): New function.
2878 (Output_section::reserve): New function.
2879 (Output_segment::set_section_addresses): Remove const.
2880 (Output_segment::set_section_list_addresses): Remove const; allocate
2881 space from free list for an incremental update.
2882 (Output_segment::set_offset): Adjust size of RELRO segment for an
2884 * output.h (Output_data::current_data_size): Move here from
2886 (Output_data::pre_finalize_data_size): New function.
2887 (Output_data::update_data_size): New function.
2888 (Output_section_headers::update_data_size): new function.
2889 (Output_section_data_build::current_data_size): Move to Output_data.
2890 (Output_data_strtab::update_data_size): New function.
2891 (Output_section::current_data_size): Move to Output_data.
2892 (Output_section::set_fixed_layout): New function.
2893 (Output_section::has_fixed_layout): New function.
2894 (Output_section::reserve): New function.
2895 (Output_section::update_data_size): New function.
2896 (Output_section::has_fixed_layout_): New data member.
2897 (Output_section::free_list_): New data member.
2898 (Output_segment::set_section_addresses): Remove const.
2899 (Output_segment::set_section_list_addresses): Remove const.
2900 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
2902 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
2904 * readsyms.cc (Read_symbols::do_read_symbols): Add library
2905 parameter when calling Add_symbols constructor; store argument
2906 serial number for members of a lib group.
2907 (Add_symbols::locks): Allow case where token == NULL.
2908 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
2909 (Read_member::~Read_member): New function.
2910 (Read_member::is_runnable): New function.
2911 (Read_member::locks): New function.
2912 (Read_member::run): New function.
2913 (Check_script::~Check_script): New function.
2914 (Check_script::is_runnable): New function.
2915 (Check_script::locks): New function.
2916 (Check_script::run): New function.
2917 (Check_library::~Check_library): New function.
2918 (Check_library::is_runnable): New function.
2919 (Check_library::locks): New function.
2920 (Check_library::run): New function.
2921 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
2922 (Add_symbols::library_): New data member.
2923 (class Read_member): New class.
2924 (class Check_script): New class.
2925 (class Check_library): New class.
2926 * reloc.cc (Read_relocs::is_runnable): Allow case where
2928 (Read_relocs::locks): Likewise.
2929 (Scan_relocs::locks): Likewise.
2930 (Relocate_task::locks): Likewise.
2931 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
2933 (Sized_relobj::incremental_relocs_scan): Fix comment.
2934 (Sized_relobj::do_relocate): Pass output file offset to
2935 write_local_symbols.
2936 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
2937 from class declaration.
2938 * script.cc (read_input_script): Allocate Script_info; pass
2939 argument serial number to report_script.
2940 * script.h (class Script_info): Move to incremental.h.
2941 * symtab.cc (Symbol_table::add_from_incrobj): New function.
2942 * symtab.h (Symbol_table::add_from_incrobj): New function.
2943 (Symbol_table::set_file_offset): New function.
2945 2011-04-05 Cary Coutant <ccoutant@google.com>
2947 * incremental-dump.cc (dump_incremental_inputs): Change signature
2948 to take a Sized_incremental_binary; change caller. Use readers
2949 in Sized_incremental_binary.
2951 (Sized_incremental_binary::find_incremental_inputs_sections):
2952 Rename do_find_incremental_inputs_sections to this.
2953 (Sized_incremental_binary::setup_readers): New function.
2954 (Sized_incremental_binary::do_check_inputs): Check
2955 has_incremental_info_ flag; move setup code to setup_readers;
2957 (Sized_incremental_binary::do_file_is_unchanged): New function.
2958 (Sized_incremental_binary::do_get_input_reader): New function.
2959 * incremental.h (class Incremental_binary): Move to end of file.
2960 (Incremental_binary::file_is_unchanged): New function.
2961 (Incremental_binary::do_file_is_unchanged): New function.
2962 (Incremental_binary::Input_reader): New class.
2963 (Incremental_binary::get_input_reader): New function.
2964 (class Sized_incremental_binary): Move to end of file.
2965 (Sized_incremental_binary::Sized_incremental_binary): Setup the
2966 input section reader classes.
2967 (Sized_incremental_binary::has_incremental_info): New function.
2968 (Sized_incremental_binary::inputs_reader): New function.
2969 (Sized_incremental_binary::symtab_reader): New function.
2970 (Sized_incremental_binary::relocs_reader): New function.
2971 (Sized_incremental_binary::got_plt_reader): New function.
2972 (Sized_incremental_binary::do_file_is_unchanged): New function.
2973 (Sized_incremental_binary::Sized_input_reader): New class.
2974 (Sized_incremental_binary::get_input_reader): New function.
2975 (Sized_incremental_binary::find_incremental_inputs_sections):
2976 Rename do_find_incremental_inputs_sections to this.
2977 (Sized_incremental_binary::setup_readers): New function.
2978 (Sized_incremental_binary::has_incremental_info_): New data member.
2979 (Sized_incremental_binary::inputs_reader_): New data member.
2980 (Sized_incremental_binary::symtab_reader_): New data member.
2981 (Sized_incremental_binary::relocs_reader_): New data member.
2982 (Sized_incremental_binary::got_plt_reader_): New data member.
2983 (Sized_incremental_binary::current_input_file_): New data member.
2985 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
2988 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
2991 2011-03-30 Cary Coutant <ccoutant@google.com>
2993 * archive.cc (Archive::include_member): Adjust call to report_object.
2994 (Add_archive_symbols::run): Add script_info to call to
2995 report_archive_begin.
2996 (Lib_group::include_member): Adjust call to report_object.
2997 (Add_lib_group_symbols::run): Adjust call to report_object.
2998 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
2999 blocks. Add object count for script input files.
3000 * incremental.cc (Incremental_inputs::report_archive_begin): Add
3001 script_info parameter; change all callers.
3002 (Incremental_inputs::report_object): Add script_info parameter;
3004 (Incremental_inputs::report_script): Store backpointer to
3005 incremental info entry.
3006 (Output_section_incremental_inputs::set_final_data_size): Record
3007 additional information for scripts.
3008 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3009 * incremental.h (Incremental_script_entry::add_object): New function.
3010 (Incremental_script_entry::get_object_count): New function.
3011 (Incremental_script_entry::get_object): New function.
3012 (Incremental_script_entry::objects_): New data member; adjust
3014 (Incremental_inputs::report_archive_begin): Add script_info parameter.
3015 (Incremental_inputs::report_object): Add script_info parameter.
3016 (Incremental_inputs_reader::get_object_count): New function.
3017 (Incremental_inputs_reader::get_object_offset): New function.
3018 * options.cc (Input_arguments::add_file): Return reference to
3020 * options.h (Input_argument::set_script_info): New function.
3021 (Input_argument::script_info): New function.
3022 (Input_argument::script_info_): New data member; adjust all
3024 (Input_file_group::add_file): Return reference to new input argument.
3025 (Input_file_lib::add_file): Likewise.
3026 (Input_arguments::add_file): Likewise.
3027 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
3028 * script.cc (Parser_closure::Parser_closure): Add script_info
3029 parameter; adjust all callers.
3030 (Parser_closure::script_info): New function.
3031 (Parser_closure::script_info_): New data member.
3032 (read_input_script): Report scripts earlier to incremental info.
3033 (script_add_file): Set script_info in Input_argument.
3034 (script_add_library): Likewise.
3035 * script.h (Script_options::Script_info): Rewrite class.
3037 2011-03-29 Cary Coutant <ccoutant@google.com>
3039 * archive.cc (Library_base::should_include_member): Move
3040 method here from class Archive.
3041 (Archive::Archive): Initialize base class.
3042 (Archive::should_include_member): Move to base class.
3043 (Archive::do_for_all_unused_symbols): New function.
3044 (Add_archive_symbols::run): Remove redundant access to
3046 (Lib_group::Lib_group): Initialize base class.
3047 (Lib_group::do_filename): New function.
3048 (Lib_group::include_member): Pass pointer to Lib_group to
3050 (Lib_group::do_for_all_unused_symbols): New function.
3051 (Add_lib_group_symbols::run): Report archive information for
3053 * archive.h (class Library_base): New base class.
3054 (class Archive): Derive from Library_base.
3055 (Archive::filename): Move to base class.
3056 (Archive::set_incremental_info): Likewise.
3057 (Archive::incremental_info): Likewise.
3058 (Archive::Should_include): Likewise.
3059 (Archive::should_include_member): Likewise.
3060 (Archive::Armap_entry): Remove.
3061 (Archive::Unused_symbol_iterator): Remove.
3062 (Archive::unused_symbols_begin): Remove.
3063 (Archive::unused_symbols_end): Remove.
3064 (Archive::do_filename): New function.
3065 (Archive::do_get_mtime): New function.
3066 (Archive::do_for_all_unused_symbols): New function.
3067 (Archive::task_): Move to base class.
3068 (Archive::incremental_info_): Likewise.
3069 (class Lib_group): Derive from Library_base.
3070 (Lib_group::do_filename): New function.
3071 (Lib_group::do_get_mtime): New function.
3072 (Lib_group::do_for_all_unused_symbols): New function.
3073 (Lib_group::task_): Move to base class.
3074 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
3076 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
3078 * incremental.cc (Incremental_inputs::report_archive_begin):
3079 Use Library_base; call library's get_mtime; add incremental inputs
3080 entry before members.
3081 (class Unused_symbol_visitor): New class.
3082 (Incremental_inputs::report_archive_end): Use Library_base; use
3083 visitor class to record unused symbols; don't add incremental inputs
3084 entry after members.
3085 (Incremental_inputs::report_object): Use Library_base.
3087 (Incremental_archive_entry::Incremental_archive_entry): Remove
3088 unused Archive parameter.
3089 (Incremental_inputs::report_archive_begin): Use Library_base.
3090 (Incremental_inputs::report_archive_end): Likewise.
3091 (Incremental_inputs::report_object): Likewise.
3092 * object.cc (Sized_relobj::do_for_all_global_symbols): New
3094 * object.h (Object::for_all_global_symbols): New function.
3095 (Object::do_for_all_global_symbols): New function.
3096 (Sized_relobj::do_for_all_global_symbols): New function.
3097 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
3099 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
3102 2011-03-27 Ian Lance Taylor <iant@google.com>
3104 * archive.cc (Archive::interpret_header): Return -1 if something
3105 goes wrong. Change callers accordingly.
3107 2011-03-25 Cary Coutant <ccoutant@google.com>
3109 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
3110 * testsuite/Makefile.in: Regenerate.
3112 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
3114 * plugin.cc (get_view): New.
3115 (Plugin::load): Pass get_view to the plugin.
3116 (Plugin_manager::get_view): New.
3118 2011-03-21 Ian Lance Taylor <iant@google.com>
3120 * testsuite/final_layout.sh: Rewrite to not use dc.
3121 * testsuite/relro_test.sh: Fail if dc is not present.
3123 2011-03-21 Sriraman Tallam <tmsriram@google.com>
3125 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
3127 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
3128 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
3130 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
3131 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
3133 2011-03-14 Ian Lance Taylor <iant@google.com>
3135 * script-sections.cc (Sort_output_sections::script_compare):
3136 Rename from is_before, change return type.
3137 (Sort_output_sections::operator()): Adjust accordingly.
3139 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
3142 * testsuite/odr_violation2.cc: Add comment to make all error line
3143 numbers double digits.
3144 * testsuite/debug_msg.sh: Adjust expected errors.
3146 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
3148 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
3149 but mark earlier ones as non-canonical
3150 (offset_to_iterator): Update search target and example
3151 (do_addr2line): Return extra lines in a vector*
3152 (format_file_lineno): Extract from do_addr2line
3153 (one_addr2line): Add vector* out-param
3154 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
3155 when a lineno entry appeared last for its instruction
3156 (Dwarf_line_info): Add vector* out-param
3157 * object.cc (Relocate_info): Pass NULL for the vector* out-param
3158 * symtab.cc (Odr_violation_compare): Include the lineno in the
3160 (linenos_from_loc): New. Combine the canonical line for an
3161 address with its other lines.
3162 (True_if_intersect): New. Helper functor to make
3163 std::set_intersection a query.
3164 (detect_odr_violations): Compare sets of lines instead of just
3165 one line for each function. This became less deterministic, but
3166 has fewer false positives.
3167 * symtab.h: Declarations.
3168 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
3169 mix an optimized and non-optimized object in the same binary
3170 (odr_violation2.so): Same.
3171 * testsuite/Makefile.in: Regenerate from Makefile.am.
3172 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
3173 * testsuite/debug_msg.sh: Update line numbers and add
3175 * testsuite/odr_violation1.cc: Use OdrDerived, in a
3176 non-optimized context.
3177 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
3178 isn't inlined, and use OdrDerived in an optimized context.
3179 * testsuite/odr_header1.h: Defines OdrDerived, where
3180 optimization will change the
3181 first-instruction-in-the-destructor's file and line number.
3182 * testsuite/odr_header2.h: Defines OdrBase.
3184 2011-03-09 Ian Lance Taylor <iant@google.com>
3186 * fileread.cc (File_read::clear_views): Don't delete the whole
3189 2011-03-08 Ian Lance Taylor <iant@google.com>
3192 * fileread.cc: #include <climits>.
3193 (GOLD_IOV_MAX): Define.
3194 (File_read::read_multiple): Limit number of entries by iov_max.
3195 * fileread.h (class File_read): Always set max_readv_entries to
3198 2011-03-07 Ian Lance Taylor <iant@google.com>
3201 * options.h (class General_options): Add -dy and -dn.
3203 2011-03-02 Cary Coutant <ccoutant@google.com>
3205 * testsuite/script_test_9.t: Add TLS segment.
3207 2011-03-02 Simon Baldwin <simonb@google.com>
3209 * configure.ac: Add check for gnu_indirect_function support in
3210 the toolchain building binutils.
3211 * configure: Rebuild.
3213 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
3215 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
3216 plugin only symbols.
3217 (Symbol_table::sized_finalize_symbol) Mark symbol only present
3218 in plugin files as not needed in the symbol table.
3220 2011-02-11 Sriraman Tallam <tmsriram@google.com>
3222 * output.cc (Output_section::add_input_section): Delay fill
3223 generation for section ordering.
3225 2011-02-09 Ian Lance Taylor <iant@google.com>
3228 * object.h (class Sized_relobj): Remove clear_local_symbols.
3229 * reloc.cc (Sized_relobj::do_relocate): Don't call
3230 clear_local_symbols.
3232 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
3234 * plugin.cc (is_visible_from_outside): Return true for symbols
3237 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
3239 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
3242 2011-02-02 Sriraman Tallam <tmsriram@google.com>
3244 * icf.h (is_section_foldable_candidate): Change type of parameter
3246 * icf.cc (Icf::find_identical_sections): Change type of local variable
3247 section_name to be std::string.
3248 (is_function_ctor_or_dtor): Change type of parameter to std::string.
3250 2011-01-25 Ian Lance Taylor <iant@google.com>
3252 * script.cc (script_add_extern): Rewrite to use
3253 add_symbol_reference.
3255 2011-01-25 Doug Kwan <dougkwan@google.com>
3257 * icf.cc (get_section_contents): Always lock section's object.
3259 2011-01-24 Ian Lance Taylor <iant@google.com>
3261 * options.h (class General_options): Accept
3262 --no-detect-odr-violations.
3264 2011-01-24 Ian Lance Taylor <iant@google.com>
3266 * version.cc (version_string): Bump to 1.11.
3268 2011-01-24 Ian Lance Taylor <iant@google.com>
3270 * plugin.cc (class Plugin_rescan): Define new class.
3271 (Plugin_manager::claim_file): Set any_claimed_.
3272 (Plugin_manager::save_archive): New function.
3273 (Plugin_manager::save_input_group): New function.
3274 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
3276 (Plugin_manager::new_undefined_symbol): New function.
3277 (Plugin_manager::rescan): New function.
3278 (Plugin_manager::rescannable_defines): New function.
3279 (Plugin_manager::add_input_file): Set any_added_.
3280 * plugin.h (class Plugin_manager): define new fields rescannable_,
3281 undefined_symbols_, any_claimed_, and any_added_. Declare
3282 Plugin_rescan as friend. Declare new functions.
3283 (Plugin_manager::Rescannable): Define type.
3284 (Plugin_manager::Rescannable_list): Define type.
3285 (Plugin_manager::Undefined_symbol_list): Define type.
3286 (Plugin_manager::Plugin_manager): Initialize new fields.
3287 * archive.cc (Archive::defines_symbol): New function.
3288 (Add_archive_symbols::run): Pass archive to plugins if any.
3289 * archive.h (class Archive): Declare defines_symbol.
3290 * readsyms.cc (Input_group::~Input_group): New function.
3291 (Finish_group::run): Pass input_group to plugins if any.
3292 * readsyms.h (class Input_group): Declare destructor.
3293 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
3296 2011-01-10 Ian Lance Taylor <iant@google.com>
3298 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
3300 (Layout::set_segment_offsets): Reset increase_relro before calling
3301 set_section_addresses a second time.
3303 2011-01-04 Cary Coutant <ccoutant@google.com>
3305 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
3306 sections before NOBITS sections.
3308 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
3310 * version.cc (print_version): Update copyright to 2011.
3312 2010-12-23 Cary Coutant <ccoutant@google.com>
3314 * output.h (Output_data_reloc::add_output_section): Pass OD instead
3315 of OS to this->add. Add OD parameter to second form of the function.
3317 2010-12-20 Ian Lance Taylor <iant@google.com>
3319 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
3320 second of two consecutive entries with same offset.
3322 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3324 * testsuite/Makefile.am (ifuncmain2static_LDADD)
3325 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
3326 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
3327 to avoid unneeded links against $(LDADD).
3328 * testsuite/Makefile.in: Regenerate.
3330 2010-12-15 Ian Lance Taylor <iant@google.com>
3333 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
3334 for R_X86_64_32 and R_X86_64_PC32.
3335 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
3336 ver_matching_def_pic.o.
3337 (ver_matching_def_pic.o): New target.
3339 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3341 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
3342 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
3343 Move definition before File_read::View member definitions.
3344 (File_read::View::~View): Initialize and hold lock before
3345 updating current_mapped_bytes.
3347 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3349 * dwarf_reader.cc: Remove outdated comment.
3350 * gold-threads.cc: Fix typo in error message.
3351 * archive.cc: Fix typos in comments.
3352 * archive.h: Likewise.
3353 * arm-reloc-property.cc: Likewise.
3354 * arm-reloc-property.h: Likewise.
3355 * arm-reloc.def: Likewise.
3357 * attributes.h: Likewise.
3358 * cref.cc: Likewise.
3359 * ehframe.cc: Likewise.
3360 * fileread.h: Likewise.
3362 * i386.cc: Likewise.
3364 * incremental.h: Likewise.
3365 * int_encoding.cc: Likewise.
3366 * layout.h: Likewise.
3367 * main.cc: Likewise.
3368 * merge.h: Likewise.
3369 * object.cc: Likewise.
3370 * object.h: Likewise.
3371 * options.cc: Likewise.
3372 * readsyms.cc: Likewise.
3373 * reduced_debug_output.cc: Likewise.
3374 * reloc.cc: Likewise.
3375 * script-sections.cc: Likewise.
3376 * sparc.cc: Likewise.
3377 * symtab.h: Likewise.
3378 * target-reloc.h: Likewise.
3379 * target.cc: Likewise.
3380 * target.h: Likewise.
3381 * timer.cc: Likewise.
3382 * timer.h: Likewise.
3383 * x86_64.cc: Likewise.
3385 2010-12-09 Cary Coutant <ccoutant@google.com>
3387 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
3389 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
3390 parameter; change all callers.
3391 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
3392 * options.h (warn_execstack): New option.
3394 2010-12-07 Doug Kwan <dougkwan@google.com>
3396 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
3397 like function call relocations.
3399 2010-12-07 Ian Lance Taylor <iant@google.com>
3401 * archive.cc (Archive::get_elf_object_for_member): Permit
3402 punconfigured to be NULL.
3403 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
3404 (Archive::include_member): Pass NULL to get_elf_object_for_member
3405 if we searched for the archive and this is the first included
3408 2010-12-01 Ian Lance Taylor <iant@google.com>
3410 * dwarf_reader.h (class Sized_dwarf_line_info): Add
3411 track_relocs_type_ field.
3412 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3413 Set track_relocs_type_.
3414 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
3415 contents when using RELA relocs.
3416 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
3418 * reloc.cc (Track_relocs::next_addend): New function.
3419 * reloc.h (class Track_relocs): Declare next_addend.
3421 2010-12-01 Ian Lance Taylor <iant@google.com>
3423 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
3426 2010-12-01 Ian Lance Taylor <iant@google.com>
3428 * README: Update compilers known to work and fail.
3430 2010-11-23 Matthias Klose <doko@ubuntu.com>
3432 * configure.in: For --enable-gold, handle value `default' instead of
3433 `both*'. Always install ld as ld.bfd, install as ld if gold is
3435 * configure: Regenerate.
3437 2010-11-18 Doug Kwan <dougkwan@google.com>
3439 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
3440 and right_alignment to be zero. Store result alignment only if it is
3441 greater than existing alignment.
3443 2010-11-16 Cary Coutant <ccoutant@google.com>
3446 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3447 Check for ".zdebug_line".
3449 2010-11-16 Doug Kwan <dougkwan@google.com>
3450 Cary Coutant <ccoutant@google.com>
3452 * output.h (Output_segment::set_section_addresses): Pass increase_relro
3453 by reference; adjust all callers.
3454 * output.cc (Output_segment::set_section_addresses): Adjust references
3455 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
3457 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
3458 end at page boundary.
3460 2010-11-16 Cary Coutant <ccoutant@google.com>
3463 * layout.cc (Layout::choose_output_section): Transform names of
3464 compressed sections even when using a script with a SECTIONS clause.
3465 (Layout::output_section_name): Remove code to transform
3466 compressed debug section names.
3467 * output.cc (Output_section::add_input_section): Use uncompressed
3468 section size when tracking input sections.
3470 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
3472 * symtab.h (Symbol::NON_PIC_REF): Remove.
3473 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
3474 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
3475 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
3476 (Symbol::use_plt_offset): Take a flags argument and pass it
3477 directly to needs_dynamic_reloc. Restrict check for undefined
3478 weak symbols to function calls.
3479 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
3480 (Target_arm::Scan::global): Use it.
3481 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
3482 (Target_arm::Relocate::relocate): Likewise.
3483 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
3484 parameter with an r_type parameter. Use get_reference_flags
3486 (Target_arm::Relocate::relocate): Update accordingly.
3487 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
3488 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
3489 (Target_i386::Scan::global): Likewise.
3490 (Target_i386::Relocate::relocate): Likewise.
3491 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
3492 parameter with an r_type parameter. Use get_reference_flags
3494 (Target_i386::Relocate::relocate): Update accordingly.
3495 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
3496 (Target_powerpc::Scan::global): Use it.
3497 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
3498 (Target_powerpc::Relocate::relocate): Likewise.
3499 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
3500 (Target_sparc::Scan::global): Use it.
3501 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
3502 (Target_sparc::Relocate::relocate): Likewise.
3503 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
3504 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
3505 (Target_x86_64::Scan::global): Likewise.
3506 (Target_x86_64::Relocate::relocate): Likewise.
3508 2010-11-08 Doug Kwan <dougkwan@google.com>
3509 Cary Coutant <ccoutant@google.com>
3511 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
3512 (Arm_exidx_merge_section::section_contents_): New data member.
3513 (Arm_input_section::Arm_input_section): Initialize original_contents_.
3514 (Arm_input_section::~Arm_input_section): De-allocate memory.
3515 (Arm_input_section::original_contents_): New data member.
3516 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
3517 in parameters instead of calling Object::section_contents without
3519 (Arm_output_section::group_section): New parameter TASK. Pass it
3520 to callees that need locking objects.
3521 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
3522 to lock EXIDX input sections. Fix a formatting issue. Call
3523 Arm_exidx_merged_section::build_contents to create merged section
3525 (Arm_output_section::create_stub_group): New parameter TASK. Use it
3526 to lock object of stub table owner.
3527 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
3528 TEXT_SIZE to initialize data member TEXT_SIZE_.
3529 (Arm_exidx_input_section::addralign): Fix typo in comment.
3530 (Arm_exidx_input_section::text_size): New method.
3531 (Target_arm::do_relax): New parameter TASK. Pass it to callees
3532 that require locking objects. Lock objects before scanning for stubs
3533 and updating local symbols.
3534 (Arm_input_section<big_endian>::init): Copy contents of original
3536 (Arm_input_section<big_endian>::do_write): Use saved contents of
3537 original input section instead of calling Object::section_contents
3539 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
3540 size without calling Object::section_size().
3541 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
3542 for size. Allocate a buffer for merged EXIDX entries.
3543 (Arm_exidx_merged_section::build_contents): New method.
3544 (Arm_exidx_merged_section::do_write): Move merge section contents
3545 building code to Arm_exidx_merged_section::build_contetns. Write
3546 out contetns in buffer instead of building it on the fly.
3547 (Arm_relobj::make_exidx_input_section): Also pass text section size
3548 to Arm_exidx_input_section constructor.
3549 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
3550 (Arm_dynobj::do_read_symbols): Fix memory leak.
3551 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
3552 * target.h: (class Task): Add forward declaration.
3553 (Target::relax): Add new parameter TASK and pass it to
3555 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
3557 2010-11-05 Cary Coutant <ccoutant@google.com>
3560 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
3561 object when reading from the file.
3562 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
3564 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
3565 when reading section contents.
3566 (get_section_contents): Likewise.
3567 (icf::find_identical_sections): Likewise.
3568 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
3569 object when reading from the file.
3570 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
3571 the object when doing deferred section layout.
3573 2010-11-03 Nick Clifton <nickc@redhat.com>
3576 * script.h (class Symbol_assignment: name): New member. Returns
3577 the name of the symbol.
3578 * scrfipt.cc (Script_options::is_pending_assignment): New member.
3579 Returns true if the given symbol name is on the list of
3580 assignments wating to be processed.
3581 * archive.cc (should_incldue_member): If the symbol is undefined,
3582 check to see if it is on the list of symbols pending assignment.
3584 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
3586 * script-sections.cc (Script_sections::find_memory_region): Check
3587 for a NULL output section pointer.
3589 2010-10-29 Doug Kwan <dougkwan@google.com>
3591 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3592 Output_section::add_relaxed_input_section.
3593 * output.cc (Output_section::add_relaxed_input_section): Add new
3594 arguments LAYOUT and NAME. Set section order index.
3595 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3596 Copy section order index.
3597 * output.h (Output_section::add_relaxed_input_section): Add new
3598 arguments LAYOUT and NAME.
3600 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3602 * testsuite/Makefile.am: Move gcctestdir/ld rule to
3603 NATIVE_OR_CROSS_LINKER.
3604 * testsuite/Makefile.in: Regenerate.
3606 2010-10-20 Doug Kwan <dougkwan@google.com>
3608 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
3609 without SHF_LINK_ORDER flags.
3610 * layout.cc (Layout::choose_output_section): Do not filter
3611 SHF_LINK_ORDER flag in a relocatable link.
3613 2010-10-17 Cary Coutant <ccoutant@google.com>
3615 * output.h (Output_segment::set_section_addresses): Change function
3616 signature. Update all callers.
3617 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
3619 (Output_segment::set_section_addresses): Align after last TLS
3620 section. Add padding before last relro section instead of after.
3622 2010-10-17 Doug Kwan <dougkwan@google.com>
3624 * gold/arm.cc (Target_arm::got_section): Use correct order and set
3625 GOT output section to be writable.
3627 2010-10-14 Cary Coutant <ccoutant@google.com>
3629 * debug.h (DEBUG_INCREMENTAL): New flag.
3630 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3631 * gold.cc (queue_initial_tasks): Check parameters for incremental link
3633 * incremental.cc (report_command_line): Ignore all forms of
3635 * layout.cc (Layout::Layout): Check parameters for incremental link
3637 * options.cc (General_options::parse_incremental): New function.
3638 (General_options::parse_no_incremental): New function.
3639 (General_options::parse_incremental_full): New function.
3640 (General_options::parse_incremental_update): New function.
3641 (General_options::incremental_mode_): New data member.
3642 (General_options::finalize): Check incremental_mode_.
3643 * options.h (General_options): Update help text for --incremental.
3644 Add --no-incremental, --incremental-full, --incremental-update.
3645 (General_options::Incremental_mode): New enum type.
3646 (General_options::incremental_mode): New function.
3647 (General_options::incremental_mode_): New data member.
3648 * parameters.cc (Parameters::incremental_mode_): New data member.
3649 (Parameters::set_options): Set incremental_mode_.
3650 (Parameters::set_incremental_full): New function.
3651 (Parameters::incremental): New function.
3652 (Parameters::incremental_update): New function.
3653 (set_parameters_incremental_full): New function.
3654 * parameters.h (Parameters::set_incremental_full): New function.
3655 (Parameters::incremental): New function.
3656 (Parameters::incremental_update): New function.
3657 (Parameters::incremental_mode_): New data member.
3658 (set_parameters_incremental_full): New function.
3659 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
3660 incremental link mode.
3661 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
3662 (Sized_relobj::do_relocate_sections): Likewise.
3663 * testsuite/Makefile.am (incremental_test): Use --incremental-full
3665 * testsuite/Makefile.in: Regenerate.
3666 * testsuite/incremental_test.sh: Filter all forms of --incremental.
3668 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3670 * script-sections.h (class Script_sections): Make
3671 Sections_elements typedef public.
3672 * script-sections.cc (class Sort_output_sections): Add elements_
3673 field. Add constructor which sets it; change all callers.
3674 (Sort_output_sections::is_before): New function.
3675 (Sort_output_sections::operator()): Call is_before.
3676 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
3678 * testsuite/script_test_10.sh: New test. Test script section
3680 * testsuite/script_test_10.t: Likewise.
3681 * testsuite/script_test_10.s: Likewise.
3682 * testsuite/Makefile.am: Wrap the cross linker tests and the
3683 common tests into NATIVE_OR_CROSS_LINKER.
3684 (check_SCRIPTS): Add script_test_10.sh.
3685 (check_DATA): Add script_test_10.stdout.
3686 (script_test_10.o, script_test_10): New targets.
3687 (script_test_10.stdout): New target.
3688 * configure, testsuite/Makefile.in: Regenerate.
3690 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3692 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
3693 error for the deprecated relocations.
3694 (Target_arm::Scan::global): Likewise.
3695 (Target_arm::Relocate::relocate): Likewise.
3697 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
3699 * fileread.cc (Input_file::find_file): Initialize *found_name
3700 and *namep when using the fallback search for case 4.
3702 2010-10-11 Cary Coutant <ccoutant@google.com>
3704 * options.h (class General_options): Redefine -z lazy as an alias for
3705 the negation of -z now.
3707 2010-10-11 Ian Lance Taylor <iant@google.com>
3709 * resolve.cc (symbol_to_bits): Report the value of the unsupported
3712 2010-10-06 Nick Clifton <nickc@redhat.com>
3714 * script-sections.cc(class Memory_region): Remove
3715 current_lma_offset_ field. Rename current_vma_offset_ to
3716 current_offset_. Add last_section_ field.
3717 (Memory_region::get_current_vma_address): Rename to
3718 get_current_address.
3719 (Memory_region::get_current_lma_address): Delete.
3720 (Memory_region::increment_vma_offset): Rename to
3722 (Memory_region::increment_lma_offset): Delete.
3723 (Memory_region::attributes_compatible): New method. Returns
3724 true if the provided section is compatible with the region.
3725 (Memory_region::get_last_section): New method. Returns the last
3726 section to use the region.
3727 (Memory_region::set_last_section): New method. Stores the last
3728 section to use the region.
3729 (Script_sections::block_in_region): New method. Returns true if
3730 a block of memory is contained within a region.
3731 (Script_sections::find_memory_region): New method. Locates a
3732 memory region to be used to set a VMA or LMA address.
3733 (Output_section_definition::set_section_addresses): Add code to
3734 check for addresses set by memory regions.
3735 (Output_segment::set_section_addresses): Remove memory region
3737 (Script_sections::create_segment): Add a warning if a header
3738 segment is created outside of any region.
3739 * script-sections.h (class Script_sections): Add prototypes for
3740 find_memory_region and block_in_region methods.
3741 * testsuite/memory_test.s: Use .long instead of .word.
3742 * testsuite/memory_test.t: Add some more output sections.
3743 * testsuite/memory_test.sh: Update expected output.
3745 2010-10-02 Doug Kwan <dougkwan@google.com>
3747 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
3748 defintion to symtab.h
3749 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
3750 declaration to defintion.
3752 2010-10-01 Nick Clifton <nickc@redhat.com>
3754 * expression.cc (eval): Replace dummy argument with NULL.
3755 (eval_maybe_dot): Check for a NULL result section pointer.
3756 (Symbol_expression::value): Likewise.
3757 (Dot_expression::value): Likewise.
3758 (BINARY_EXPRESSION): Likewise.
3759 (Max_expression::value): Likewise.
3760 (Min_expression::value): Likewise.
3761 (Absolute_expression::value): Likewise.
3762 (Addr_expression::value_from_output_section): Likewise.
3763 (Loaddddr_expression::value_from_output_section): Likewise.
3764 (Segment_start_expression::value): Likewise.
3765 * script-sections.cc
3766 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
3768 (Sections_elememt_dot_assignment::set_section_addresses):
3770 (Output_data_expression::do_write_to_buffer): Likewise.
3771 (Output_section_definition::finalize_symbols): Likewise.
3772 (Output_section_definition::set_section_addresses): Likewise.
3774 2010-09-30 Doug Kwan <dougkwan@google.com>
3776 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
3778 2010-09-28 Sriraman Tallam <tmsriram@google.com>
3780 * target.h (Target::can_icf_inline_merge_sections): New virtual
3782 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
3784 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
3786 * icf.cc (get_section_contents): Inline merge sections only when
3789 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3791 * configure: Regenerate.
3793 2010-09-17 Ian Lance Taylor <iant@google.com>
3795 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
3796 * testsuite/Makefile.am (memory_test.o): New target.
3797 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
3799 * testsuite/Makefile.in: Rebuild.
3801 2010-09-17 Doug Kwan <dougkwan@google.com>
3803 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
3804 defintion if relocation uses GOT entries of the symbol.
3805 * testsuite/icf_safe_test.sh: Fix test.
3806 * testsuite/icf_safe_so_test.sh: Fix test.
3808 2010-09-16 Cary Coutant <ccoutant@google.com>
3810 * script_sections.cc (class Memory_region): Remove "NULL" from
3811 vector initializations.
3813 2010-09-15 Cary Coutant <ccoutant@google.com>
3815 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
3816 Resolve forwarding symbols.
3818 2010-09-15 Doug Kwan <dougkwan@google.com>
3820 * gold/testsuite/script_test_3.t: Add ARM special sections.
3821 * gold/testsuite/script_test_4.t: Same.
3822 * gold/testsuite/script_test_5.t: Same.
3823 * gold/testsuite/script_test_6.t: Same.
3824 * gold/testsuite/script_test_7.t: Same.
3825 * gold/testsuite/script_test_7.t: Same.
3826 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
3828 2010-09-14 Cary Coutant <ccoutant@google.com>
3830 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
3831 (Target_x86_64::Relocate::relocate_tls): Replace check for
3832 saw_tls_block_reloc_ with test for executable section.
3834 2010-09-12 Cary Coutant <ccoutant@google.com>
3836 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
3837 position-independent executables to shared libraries need dynamic
3839 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
3840 position-independent executables.
3841 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
3842 * testsuite/Makefile.in: Regenerate.
3844 2010-09-10 Nick Clifton <nickc@redhat.com>
3847 * testsuite/memory_test.t: Discard any sections that are not
3850 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
3853 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
3854 "This::" to work around a bug in gcc 4.2.
3856 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
3858 2010-09-09 Rafael Espindola <espindola@google.com>
3860 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
3861 sections with different PF_X flags in the same segment.
3862 (Layout::find_first_load_seg): Search all segments to find the first
3864 * options.h (rosegment): New.
3866 2010-09-08 Rafael Espindola <espindola@google.com>
3868 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
3870 2010-09-08 Doug Kwan <dougkwan@google.com>
3872 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
3873 (Arm_relobj::do_relocate_sections): Add new parameter for output
3874 file to match the parent.
3875 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
3876 of local symbols instead of input values. Update code to track
3877 changes in gold::relocate_section.
3878 * object.cc (Sized_relobj::compute_final_local_value): New methods.
3879 (Sized_relobj::compute_final_local_value_internal): New methods.
3880 (Sized_relobj::do_finalize_local_symbols): Move code from loop
3881 body into private version of Sized_relobj::compute_final_local_value.
3882 Call the inline method.
3883 * object.h (Symbol_value::Symbol_value): Define destructor. Free
3884 merged symbol value if there is one.
3885 (Symbol_value::has_output_value): New method defintiion.
3886 (Sized_relobj::Compute_final_local_value_status): New enum type.
3887 (Sized_relobj::compute_final_local_value): New methods.
3888 (Sized_relobj::compute_final_local_value_internal): New methods.
3889 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
3890 and arm_cortex_a8.sh.
3891 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
3892 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
3894 * Makefile.in: Regenerate.
3895 * testsuite/arm_bl_out_of_range.s: Update test.
3896 * testsuite/thumb_bl_out_of_range.s: Ditto.
3897 * testsuite/thumb_blx_out_of_range.s: Ditto.
3898 * testsuite/arm_branch_out_of_range.sh: New file.
3899 * testsuite/arm_cortex_a8.sh: Ditto.
3900 * testsuite/arm_cortex_a8_b.s: Ditto.
3901 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
3902 * testsuite/arm_cortex_a8_b_local.s: Ditto.
3903 * testsuite/arm_cortex_a8_bl.s: Ditto.
3904 * testsuite/arm_cortex_a8_blx.s: Ditto.
3905 * testsuite/arm_cortex_a8_local.s: Ditto.
3906 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
3907 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
3909 2010-09-08 Rafael Espindola <espindola@google.com>
3911 * Makefile.am (memory_test.stdout): Run readelf with -W.
3912 * Makefile.in: Regenerate.
3913 * testsuite/memory_test.sh: Make the regexps accept both 32 and
3916 2010-09-08 Rafael Espindola <espindola@google.com>
3918 * script-sections.cc (Script_sections::add_memory_region): Convert
3919 field precision to int.
3920 * script.cc (script_set_section_region, script_set_section_region):
3921 Convert field precision to int.
3923 2010-09-08 Rafael Espindola <espindola@google.com>
3925 * arm.cc (do_finalize_sections): Create the __exidx_start and
3926 __exdix_end symbols even when the section is missing.
3928 2010-09-08 Nick Clifton <nickc@redhat.com>
3930 * README: Remove claim that MEMORY is not supported.
3931 * expression.cc (script_exp_function_origin)
3932 (script_exp_function_length): Move from here to ...
3933 * script.cc: ... here.
3934 (script_set_section_region, script_add_memory)
3935 (script_parse_memory_attr, script_include_directive): New
3937 * script-sections.cc
3938 (class Memory_region): New class.
3939 (class Output_section_definition): Add set_memory_region,
3940 set_section_vma, set_section_lma and get_section_name methods.
3941 (class Script_Sections): Add add_memory_region,
3942 find_memory_region, find_memory_region_origin,
3943 find_memory_region_length and set_memory_region methods.
3944 Have set_section_addresses method walk the list of set memory
3946 Extend the print methos to display memory regions.
3947 * script-sections.h: Add prototypes for new methods.
3948 Add enum for MEMORY region attributes.
3949 * yyscript.y: Add support for parsing MEMORY regions.
3950 * script-c.h: Add prototypes for new functions.
3951 * testsuite/Makefile.am: Add test of MEMORY region functionality.
3952 * testsuite/Makefile.in: Regenerate.
3953 * testsuite/memory_test.sh: New script.
3954 * testsuite/memory_test.s: New assembler source file.
3955 * testsuite/memory_test.t: New linker script.
3957 2010-08-27 Doug Kwan <dougkwan@google.com>
3959 * gold/resolve.cc (Symbol_table::should_override): Let a weak
3960 reference override an existing dynamic weak reference.
3961 * testsuite/Makefile.am: Add new test dyn_weak_ref.
3962 * testsuite/Makefile.in: Regenerate.
3963 * testsuite/dyn_weak_ref.sh: New file.
3964 * testsuite/dyn_weak_ref_1.c: Ditto.
3965 * testsuite/dyn_weak_ref_2.c: Ditto.
3967 2010-08-27 Ian Lance Taylor <iant@google.com>
3969 * incremental.h (class Incremental_input_entry): Add virtual
3972 2010-08-27 Ian Lance Taylor <iant@google.com>
3974 * testsuite/start_lib_test_3.c: Mark t3 as used.
3976 2010-08-27 Nick Clifton <nickc@redhat.com>
3978 * options.cc (version_script): Fix small typo in previous
3981 2010-08-25 Nick Clifton <nickc@redhat.com>
3983 * archive.cc: Formatting fixes: Remove whitespace between
3984 typename and following asterisk. Remove whitespace between
3985 function name and opening parenthesis.
3986 * archive.h: Likewise.
3988 * attributes.cc: Likewise.
3989 * attributes.h: Likewise.
3990 * common.cc: Likewise.
3991 * copy-relocs.cc: Likewise.
3992 * dirsearch.h: Likewise.
3993 * dynobj.cc: Likewise.
3994 * ehframe.cc: Likewise.
3995 * ehframe.h: Likewise.
3996 * expression.cc: Likewise.
3997 * fileread.cc: Likewise.
3998 * fileread.h: Likewise.
4000 * gold-threads.cc: Likewise.
4001 * gold.cc: Likewise.
4002 * i386.cc: Likewise.
4004 * incremental-dump.cc: Likewise.
4005 * incremental.cc: Likewise.
4006 * layout.cc: Likewise.
4007 * layout.h: Likewise.
4008 * main.cc: Likewise.
4009 * merge.cc: Likewise.
4010 * merge.h: Likewise.
4011 * object.cc: Likewise.
4012 * object.h: Likewise.
4013 * options.cc: Likewise.
4014 * options.h: Likewise.
4015 * output.cc: Likewise.
4016 * output.h: Likewise.
4017 * plugin.cc: Likewise.
4018 * plugin.h: Likewise.
4019 * powerpc.cc: Likewise.
4020 * reloc.cc: Likewise.
4021 * script-c.h: Likewise.
4022 * script-sections.cc: Likewise.
4023 * script.cc: Likewise.
4024 * stringpool.cc: Likewise.
4025 * symtab.cc: Likewise.
4026 * symtab.h: Likewise.
4027 * target.cc: Likewise.
4028 * timer.cc: Likewise.
4029 * timer.h: Likewise.
4030 * version.cc: Likewise.
4031 * x86_64.cc: Likewise.
4033 2010-08-24 Nick Clifton <nickc@redhat.com>
4036 * layout.cc (segment_precedes): Sort segments by their physical
4037 addresses, if they have been set.
4039 2010-08-23 Cary Coutant <ccoutant@google.com>
4041 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
4043 (Lib_group::include_member): Unlock object after deleting its
4045 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
4048 2010-08-19 Neil Vachharajani <nvachhar@google.com>
4049 Cary Coutant <ccoutant@google.com>
4051 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
4052 constructor, and set_blocker.
4053 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
4055 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
4056 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
4057 * testsuite/Makefile.am (start_lib_test): New test case.
4058 * testsuite/Makefile.in: Regenerate.
4059 * testsuite/start_lib_test_main.c: New file.
4060 * testsuite/start_lib_test_1.c: New file.
4061 * testsuite/start_lib_test_2.c: New file.
4062 * testsuite/start_lib_test_3.c: New file.
4064 2010-08-19 Ian Lance Taylor <iant@google.com>
4066 * Makefile.in: Rebuild with automake 1.11.1.
4067 * aclocal.m4: Likewise.
4068 * testsuite/Makefile.in: Likewise.
4070 2010-08-19 Ian Lance Taylor <iant@google.com>
4073 * i386.cc (class Output_data_plt_i386): Update declarations.
4074 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
4075 local_ifuncs_ fields.
4076 (Target_i386::do_plt_section_for_global): New function.
4077 (Target_i386::do_plt_section_for_local): New function.
4078 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
4079 parameter; change all callers. Initialize global_ifuncs_ and
4080 local_ifuncs_. If doing a static link define __rel_iplt_start and
4082 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
4083 (Output_data_plt_i386::add_local_ifunc_entry): New function.
4084 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
4086 (Target_i386::make_plt_section): New function, broken out of
4087 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
4088 (Target_i386::make_plt_entry): Call make_plt_section.
4089 (Target_i386::make_local_ifunc_plt_entry): New function.
4090 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
4091 (Target_i386::Scan::local): Handle IFUNC symbols. Add
4092 R_386_IRELATIVE to switch.
4093 (Target_i386::Scan::global): Likewise.
4094 (Target_i386::Relocate::relocate): Likewise.
4095 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
4097 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
4098 (Target_x86_64::do_plt_section_for_global): New function.
4099 (Target_x86_64::do_plt_section_for_local): New function.
4100 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
4101 parameter; change all callers. If doing a static link define
4102 __rela_iplt_start and __rela_iplt_end.
4103 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
4104 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
4105 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
4107 (Target_x86_64::make_local_ifunc_plt_entry): New function.
4108 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
4110 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
4111 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
4112 R_X86_64_IRELATIVE to switch.
4113 (Target_x86_64::Scan::global): Likewise.
4114 (Target_x86_64::Relocate::relocate): Likewise.
4115 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
4117 * target.h (class Target): Add plt_section_for_global and
4118 plt_section_for_local functions. Add do_plt_section_for_global
4119 and do_plt_section_for_local virtual functions.
4120 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
4121 clarifying comments.
4122 (Symbol::use_plt_offset): Handle IFUNC symbol.
4123 * object.cc (Sized_relobj::Sized_relobj): Initialize
4125 (Sized_relobj::local_has_plt_offset): New function.
4126 (Sized_relobj::local_plt_offset): New function.
4127 (Sized_relobj::set_local_plt_offset): New function.
4128 (Sized_relobj::do_count): Handle IFUNC symbol.
4129 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
4130 a bit away from input_shndx_ field. Add set_is_func_symbol and
4131 is_ifunc_symbol functions.
4132 (class Sized_relobj): Update declarations. Remove Tls_got_entry
4133 and Local_tls_got_offsets. Define Local_plt_offsets. Add
4134 local_plt_offsets_ field.
4135 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
4136 * output.h (class Output_section_data): Add non-const
4137 output_section function.
4138 (class Output_data_got): Update declarations.
4139 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
4140 Add use_plt_offset parameter to global and local constructors.
4141 Change all callers. Change local_sym_index_ field to 31 bits.
4142 Change GSYM_CODE and CONSTANT_CODE accordingly.
4143 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
4144 doing a static link don't set sh_link field.
4145 (Output_data_got::Got_entry::write): Use PLT offset if
4147 (Output_data_got::add_global_plt): New function.
4148 (Output_data_got::add_local_plt): New function.
4149 * target-reloc.h (relocate_section): Handle IFUNC symbol.
4150 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
4151 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
4152 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
4153 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
4155 * testsuite/ifunc-sel.h: New file.
4156 * testsuite/ifuncmain1.c: New file.
4157 * testsuite/ifuncmain1vis.c: New file.
4158 * testsuite/ifuncmod1.c: New file.
4159 * testsuite/ifuncdep2.c: New file.
4160 * testsuite/ifuncmain2.c: New file.
4161 * testsuite/ifuncmain3.c: New file.
4162 * testsuite/ifuncmod3.c: New file.
4163 * testsuite/ifuncmain4.c: New file.
4164 * testsuite/ifuncmain5.c: New file.
4165 * testsuite/ifuncmod5.c: New file.
4166 * testsuite/ifuncmain6pie.c: New file.
4167 * testsuite/ifuncmod6.c: New file.
4168 * testsuite/ifuncmain7.c: New file.
4169 * configure, testsuite/Makefile.in: Rebuild.
4171 2010-08-18 Ian Lance Taylor <iant@google.com>
4174 (Output_section_incremental_inputs::write_input_files): Add cast
4175 to avoid signed/unsigned comparison warning.
4176 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4178 2010-08-12 Cary Coutant <ccoutant@google.com>
4180 * common.cc (Sort_commons::operator()): Remove unnecessary code.
4182 2010-08-13 Ian Lance Taylor <iant@google.com>
4184 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
4186 2010-08-12 Cary Coutant <ccoutant@google.com>
4187 Doug Kwan <dougkwan@google.com>
4189 * resolve.cc (Symbol_table::should_override): When a weak dynamic
4190 defintion overrides non-weak undef, remember that the original undef
4192 * symtab.cc (Symbol_table::sized_write_global): For undef without
4193 an original weak binding, set binding to global in output.
4194 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
4195 * testsuite/Makefile.in: Regenerate.
4196 * testsuite/strong_ref_weak_def.sh: New file.
4197 * testsuite/strong_ref_weak_def_1.c: Ditto.
4198 * testsuite/strong_ref_weak_def_2.c: Ditto.
4200 2010-08-12 Cary Coutant <ccoutant@google.com>
4202 * testsuite/incremental_test.sh: Rewrite.
4203 * testsuite/incremental_test_1.c: Rewrite.
4204 * testsuite/incremental_test_2.c: Rewrite.
4206 2010-08-12 Cary Coutant <ccoutant@google.com>
4208 * arm.cc (Target_arm::got_size): Add const.
4209 (Target_arm::got_entry_count): New function.
4210 (Target_arm::plt_entry_count): New function.
4211 (Target_arm::first_plt_entry_offset): New function.
4212 (Target_arm::plt_entry_size): New function.
4213 (Output_data_plt_arm::entry_count): New function.
4214 (Output_data_plt_arm::first_plt_entry_offset): New function.
4215 (Output_data_plt_arm::get_plt_entry_size): New function.
4216 * i386.cc (Target_i386::got_size): Add const.
4217 (Target_i386::got_entry_count): New function.
4218 (Target_i386::plt_entry_count): New function.
4219 (Target_i386::first_plt_entry_offset): New function.
4220 (Target_i386::plt_entry_size): New function.
4221 (Output_data_plt_i386::entry_count): New function.
4222 (Output_data_plt_i386::first_plt_entry_offset): New function.
4223 (Output_data_plt_i386::get_plt_entry_size): New function.
4224 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
4225 find_incremental_inputs_sections. Dump incremental_got_plt section.
4226 * incremental.cc: Include target.h.
4227 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
4228 parameter. Adjust all callers. Find incremental_got_plt section.
4229 (Incremental_inputs::create_data_sections): Create incremental_got_plt
4231 (Output_section_incremental_inputs::set_final_data_size): Calculate
4232 size of incremental_got_plt section.
4233 (Output_section_incremental_inputs::do_write): Write the
4234 incremental_got_plt section.
4235 (Got_plt_view_info): New struct.
4236 (Local_got_offset_visitor): New class.
4237 (Global_got_offset_visitor): New class.
4238 (Global_symbol_visitor_got_plt): New class.
4239 (Output_section_incremental_inputs::write_got_plt): New function.
4240 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
4241 Add parameter. Adjust all callers.
4242 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4243 (Incremental_inputs::got_plt_section): New function.
4244 (Incremental_inputs::got_plt_section_): New data member.
4245 (Incremental_got_plt_reader): New class.
4246 * layout.cc (Layout::create_incremental_info_sections): Add the
4247 incremental_got_plt section.
4248 * object.h (Got_offset_list::get_list): New function.
4249 (Got offset_list::for_all_got_offsets): New function.
4250 (Sized_relobj::local_got_offset_list): New function.
4251 * powerpc.cc (Target_powerpc::got_size): Add const.
4252 (Target_powerpc::got_entry_count): New function.
4253 (Target_powerpc::plt_entry_count): New function.
4254 (Target_powerpc::first_plt_entry_offset): New function.
4255 (Target_powerpc::plt_entry_size): New function.
4256 (Output_data_plt_powerpc::entry_count): New function.
4257 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
4258 (Output_data_plt_powerpc::get_plt_entry_size): New function.
4259 * sparc.cc (Target_sparc::got_size): Add const.
4260 (Target_sparc::got_entry_count): New function.
4261 (Target_sparc::plt_entry_count): New function.
4262 (Target_sparc::first_plt_entry_offset): New function.
4263 (Target_sparc::plt_entry_size): New function.
4264 (Output_data_plt_sparc::entry_count): New function.
4265 (Output_data_plt_sparc::first_plt_entry_offset): New function.
4266 (Output_data_plt_sparc::get_plt_entry_size): New function.
4267 * symtab.h (Symbol::got_offset_list): New function.
4268 (Symbol_table::for_all_symbols): New function.
4269 * target.h (Sized_target::got_entry_count): New function.
4270 (Sized_target::plt_entry_count): New function.
4271 (Sized_target::plt_entry_size): New function.
4272 * x86_64.cc (Target_x86_64::got_size): Add const.
4273 (Target_x86_64::got_entry_count): New function.
4274 (Target_x86_64::plt_entry_count): New function.
4275 (Target_x86_64::first_plt_entry_offset): New function.
4276 (Target_x86_64::plt_entry_size): New function.
4277 (Output_data_plt_x86_64::entry_count): New function.
4278 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
4279 (Output_data_plt_x86_64::get_plt_entry_size): New function.
4281 2010-08-12 Cary Coutant <ccoutant@google.com>
4283 * archive.cc: Include incremental.h.
4284 (Archive::Archive): Initialize incremental_info_.
4285 (Archive::include_member): Record archive members in incremental info.
4286 (Add_archive_symbols::run): Record begin and end of an archive in
4288 (Lib_group::include_member): Record objects in incremental info.
4289 * archive.h (Incremental_archive_entry): Forward declaration.
4290 (Archive::set_incremental_info): New member function.
4291 (Archive::incremental_info): New member function.
4292 (Archive::Unused_symbol_iterator): New class.
4293 (Archive::unused_symbols_begin): New member function.
4294 (Archive::unused_symbols_end): New member function.
4295 (Archive::incremental_info_): New data member.
4296 * incremental-dump.cc (find_input_containing_global): New function.
4297 (dump_incremental_inputs): Dump new incremental info sections.
4298 * incremental.cc: Include symtab.h.
4299 (Output_section_incremental_inputs): New class.
4300 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
4301 new incremental info sections.
4302 (Sized_incremental_binary::do_check_inputs): Likewise.
4303 (Incremental_inputs::report_archive): Remove.
4304 (Incremental_inputs::report_archive_begin): New function.
4305 (Incremental_inputs::report_archive_end): New function.
4306 (Incremental_inputs::report_object): New function.
4307 (Incremental_inputs::finalize_inputs): Remove.
4308 (Incremental_inputs::report_input_section): New function.
4309 (Incremental_inputs::report_script): Rewrite.
4310 (Incremental_inputs::finalize): Do nothing but finalize string table.
4311 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4312 (Incremental_inputs::sized_create_inputs_section_data): Remove.
4313 (Incremental_inputs::create_data_sections): New function.
4314 (Incremental_inputs::relocs_entsize): New function.
4315 (Output_section_incremental_inputs::set_final_data_size): New function.
4316 (Output_section_incremental_inputs::do_write): New function.
4317 (Output_section_incremental_inputs::write_header): New function.
4318 (Output_section_incremental_inputs::write_input_files): New function.
4319 (Output_section_incremental_inputs::write_info_blocks): New function.
4320 (Output_section_incremental_inputs::write_symtab): New function.
4321 * incremental.h (Incremental_script_entry): Forward declaration.
4322 (Incremental_object_entry): Forward declaration.
4323 (Incremental_archive_entry): Forward declaration.
4324 (Incremental_inputs): Forward declaration.
4325 (Incremental_inputs_header_data): Remove.
4326 (Incremental_inputs_header): Remove.
4327 (Incremental_inputs_header_write): Remove.
4328 (Incremental_inputs_entry_data): Remove.
4329 (Incremental_inputs_entry): Remove.
4330 (Incremental_inputs_entry_write): Remove.
4331 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
4332 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
4333 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4334 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
4336 (Incremental_input_entry): New class.
4337 (Incremental_script_entry): New class.
4338 (Incremental_object_entry): New class.
4339 (Incremental_archive_entry): New class.
4340 (Incremental_inputs::Incremental_inputs): Initialize new data members.
4341 (Incremental_inputs::report_inputs): Remove.
4342 (Incremental_inputs::report_archive): Remove.
4343 (Incremental_inputs::report_archive_begin): New function.
4344 (Incremental_inputs::report_archive_end): New function.
4345 (Incremental_inputs::report_object): Change prototype.
4346 (Incremental_inputs::report_input_section): New function.
4347 (Incremental_inputs::report_script): Change prototype.
4348 (Incremental_inputs::get_reloc_count): New function.
4349 (Incremental_inputs::set_reloc_count): New function.
4350 (Incremental_inputs::create_data_sections): New function.
4351 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4352 (Incremental_inputs::inputs_section): New function.
4353 (Incremental_inputs::symtab_section): New function.
4354 (Incremental_inputs::relocs_section): New function.
4355 (Incremental_inputs::get_stringpool): Add const.
4356 (Incremental_inputs::command_line): Add const.
4357 (Incremental_inputs::inputs): Remove.
4358 (Incremental_inputs::command_line_key): New function.
4359 (Incremental_inputs::input_file_count): New function.
4360 (Incremental_inputs::input_files): New function.
4361 (Incremental_inputs::relocs_entsize): New function.
4362 (Incremental_inputs::sized_create_inputs_section_data): Remove.
4363 (Incremental_inputs::finalize_inputs): Remove.
4364 (Incremental_inputs::Input_info): Remove.
4365 (Incremental_inputs::lock_): Remove.
4366 (Incremental_inputs::inputs_): Change type.
4367 (Incremental_inputs::inputs_map_): Remove.
4368 (Incremental_inputs::current_object_entry_): New data member.
4369 (Incremental_inputs::inputs_section_): New data member.
4370 (Incremental_inputs::symtab_section_): New data member.
4371 (Incremental_inputs::relocs_section_): New data member.
4372 (Incremental_inputs::reloc_count_): New data member.
4373 (Incremental_inputs_reader): New class.
4374 (Incremental_symtab_reader): New class.
4375 (Incremental_relocs_reader): New class.
4376 * layout.cc (Layout::finalize): Move finalization of incremental info
4377 and creation of incremental info sections to follow finalization of
4378 symbol table. Set offsets for postprocessing sections.
4379 (Layout::create_incremental_info_sections): Call
4380 Incremental_inputs::create_data_sections. Add incremental symtab
4381 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
4382 sections to layout after input sections.
4383 * layout.h (struct Timespec): Forward declaration.
4384 (Layout::incremental_inputs): Add const.
4385 (Layout::create_incremental_info_sections): Add parameter.
4386 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
4387 * object.cc: Include incremental.h.
4388 (Relobj::finalize_incremental_relocs): New function.
4389 (Sized_relobj::do_layout): Record input sections in incremental info.
4390 * object.h (Object::output_section): New function.
4391 (Object::output_section_offset): Moved from Relobj.
4392 (Object::get_incremental_reloc_base): New function.
4393 (Object::get_incremental_reloc_count): New function.
4394 (Object::do_output_section): New function.
4395 (Object::do_output_section_offset): Moved from Relobj.
4396 (Object::do_get_incremental_reloc_base): New function.
4397 (Object::do_get_incremental_reloc_count): New function.
4398 (Object::Object): Initialize new data members.
4399 (Relobj::output_section): Renamed do_output_section and moved to
4401 (Relobj::output_section_offset): Moved to Object.
4402 (Relobj::do_get_incremental_reloc_base): New function.
4403 (Relobj::do_get_incremental_reloc_count): New function.
4404 (Relobj::allocate_incremental_reloc_counts): New function.
4405 (Relobj::count_incremental_reloc): New function.
4406 (Relobj::finalize_incremental_relocs): New function.
4407 (Relobj::next_incremental_reloc_index): New function.
4408 (Relobj::reloc_counts_): New data member.
4409 (Relobj::reloc_bases_): New data member.
4410 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
4411 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
4412 (Sized_relobj::incremental_relocs_scan): New function.
4413 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4414 (Sized_relobj::incremental_relocs_write): New function.
4415 (Sized_relobj::incremental_relocs_write_reltype): New function.
4416 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
4418 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
4419 archives and object files elsewhere.
4420 (Add_symbols::run): Report object files here.
4421 (Finish_group::run): Report end of archive at end of group.
4422 * reloc.cc: Include layout.h, incremental.h.
4423 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
4424 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
4425 (Sized_relobj::incremental_relocs_scan): New function.
4426 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4427 (Sized_relobj::do_relocate_sections): Write incremental relocations.
4428 (Sized_relobj::incremental_relocs_write): New function.
4429 (Sized_relobj::incremental_relocs_write_reltype): New function.
4430 * script.cc (read_input_script): Rewrite test for incremental link.
4431 Change call to Incremental_inputs::report_script.
4432 * symtab.h (Symbol_table::first_global_index): New function.
4433 (Symbol_table::output_count): New function.
4435 2010-08-12 Doug Kwan <dougkwan@google.com>
4437 * arm.cc (Target_arm::merge_object_attributes): Check command line
4438 options --no-wchar-size-warning and --no-enum-size-warning.
4439 * options.h (General_options): Add ld-compatible options
4440 --no-enum-size-warning and --no-wchar-size-warning.
4442 2010-08-04 Ian Lance Taylor <iant@google.com>
4444 * x86_64.cc (Target_x86_64::Scan::local): Use
4445 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
4446 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
4447 (Target_x86_64::Scan::global): Likewise.
4448 (Target_x86_64::Relocate::relocate): Likewise.
4449 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
4452 2010-08-03 Cary Coutant <ccoutant@google.com>
4454 * merge.cc (Output_merge_string::do_add_input_section): Count strings
4455 to reserve space in merged_strings vector. Keep total input size
4457 (Output_merge_string::do_print_merge_stats): Print total input size.
4458 * merge.h (Output_merge_string): Add input_size_ field.
4459 * stringpool.cc (Stringpool_template::string_length): Move
4460 implementations out of Stringpool_template class and place in
4462 * stringpool.h (string_length): Move out of Stringpool_template.
4464 2010-08-03 Ian Lance Taylor <iant@google.com>
4467 * layout.cc (relaxation_loop_body): If address of load segment is
4468 set, adjust address to include headers if possible.
4470 2010-08-03 Ian Lance Taylor <iant@google.com>
4472 * version.cc (version_string): Bump to 1.10.
4474 2010-08-03 Ian Lance Taylor <iant@google.com>
4477 * layout.h (enum Output_section_order): Define.
4478 (class Layout): Update declarations.
4479 * layout.cc (Layout::get_output_section): Add order parameter.
4480 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
4481 is_first_non_relro parameters. Change all callers.
4482 (Layout::choose_output_section): Likewise.
4483 (Layout::add_output_section_data): Likewise.
4484 (Layout::make_output_section): Likewise. Set order.
4485 (Layout::default_section_order): New function.
4486 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
4487 * output.cc (Output_section::Output_section): Initialize order_.
4488 Don't initialize deleted fields.
4489 (Output_segment::Output_segment): Don't initialize deleted
4491 (Output_segment::add_output_section_to_load): New function
4492 replacing add_output_section. Change all callers to call this or
4493 add_output_section_to_nonload.
4494 (Output_segment::add_output_section_to_nonload): New function.
4495 (Output_segment::remove_output_section): Rewrite.
4496 (Output_segment::add_initial_output_data): Likewise.
4497 (Output_segment::has_any_data_sections): Likewise.
4498 (Output_segment::is_first_section_relro): Likewise.
4499 (Output_segment::maximum_alignment): Likewise.
4500 (Output_segment::has_dynamic_reloc): New function replacing
4501 dynamic_reloc_count. Change all callers.
4502 (Output_segment::has_dynamic_reloc_list): New function replacing
4503 dynamic_reloc_count_list. Change all callers.
4504 (Output_segment::set_section_addresses): Rewrite.
4505 (Output_segment::set_offset): Rewrite.
4506 (Output_segment::find_first_and_last_list): Remove.
4507 (Output_segment::set_tls_offsets): Rewrite.
4508 (Output_segment::first_section_load_address): Likewise.
4509 (Output_segment::output_section_count): Likewise.
4510 (Output_segment::section_with_lowest_load_address): Likewise.
4511 (Output_segment::write_section_headers): Likewise.
4512 (Output_segment::print_sections_to_map): Likewise.
4513 * output.h (class Output_data): Remove dynamic_reloc_count_
4514 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
4515 (Output_data::add_dynamic_reloc): Rewrite.
4516 (Output_data::has_dynamic_reloc): New function.
4517 (Output_data::dynamic_reloc_count): Remove.
4518 (class Output_section): Add order_ field. Remvoe is_relro_local_,
4519 is_last_relro_, is_first_non_relro_, is_interp_,
4520 is_dynamic_linker_section_ fields. Add order and set_order
4521 functions. Remove is_relro_local, set_is_relro_local,
4522 is_last_relro, set_is_last_relro, is_first_non_relro,
4523 set_is_first_non_relro functions, is_interp, set_is_interp,
4524 is_dynamic_linker_section, and set_is_dynamic_linker_section
4526 (class Output_segment): Change Output_data_list from std::list to
4527 std:;vector. Add output_lists_ field. Remove output_data_ and
4528 output_bss_ fields. Update declarations.
4530 2010-08-02 Ian Lance Taylor <iant@google.com>
4532 * arm.cc (Target_arm::gc_process_relocs): Use typename.
4533 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
4534 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
4536 2010-08-02 Ian Lance Taylor <iant@google.com>
4539 * script.cc (Script_options::Script_options): Initialize
4540 symbol_definitions_ and symbol_references_.
4541 (Script_options::add_symbol_assignment): Update
4542 symbol_definitions_ and symbol_references_.
4543 (Script_options::add_symbol_reference): New function.
4544 (script_symbol): New function.
4545 * script.h (class Script_options): Add symbol_definitions_ and
4546 symbol_references_ fields.
4547 (Script_options::referenced_const_iterator): New type.
4548 (Script_options::referenced_begin): New function.
4549 (Script_options::referenced_end): New function.
4550 (Script_options::is_referenced): New function.
4551 (Script_options::any_unreferenced): New function.
4552 * script-c.h (script_symbol): Declare.
4553 * yyscript.y (exp): Call script_symbol.
4554 * symtab.cc: Include "script.h".
4555 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
4556 Change all callers. Check symbols referenced by scripts.
4557 (Symbol_table::add_undefined_symbols_from_command_line): Add
4558 layout parameter. Change all callers.
4559 (Symbol_table::do_add_undefined_symbols_from_command_line):
4560 Likewise. Break out loop body. Check symbols referenced by
4562 (Symbol_table::add_undefined_symbol_from_command_line): New
4563 function broken out of
4564 do_add_undefined_symbols_from_command_line.
4565 * symtab.h (class Symbol_table): Update declarations.
4566 * archive.cc: Include "layout.h".
4567 (Archive::should_include_member): Add layout parameter. Change
4568 all callers. Check for symbol mentioned in expression.
4569 * archive.h (class Archive): Update declaration.
4570 * object.cc (Sized_relobj::do_should_include_member): Add layout
4572 * object.h (Object::should_include_member): Add layout parameter.
4574 (Object::do_should_include_member): Add layout parameter.
4575 (class Sized_relobj): Update declaration.
4576 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
4578 * dynobj.h (class Sized_dynobj): Update declaration.
4579 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
4581 * plugin.h (class Sized_pluginobj): Update declaration.
4583 2010-08-02 Ian Lance Taylor <iant@google.com>
4586 * output.cc (Output_segment::set_offset): Search for the first and
4587 last sections rather than assuming that the list is in order.
4588 (Output_segment::find_first_and_last_list): New function.
4589 * output.h (class Output_segment): Update declarations.
4590 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4591 (relro_strip_test_SOURCES): New variable.
4592 (relro_strip_test_DEPENDENCIES): New variable.
4593 (relro_strip_test_LDFLAGS): New variable.
4594 (relro_strip_test_LDADD): New variable.
4595 (relro_strip_test.so): New target.
4597 2010-08-02 Ian Lance Taylor <iant@google.com>
4599 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4600 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4601 (Target_i386::got_tlsdesc_section): New function.
4602 (Target_i386::got_section): Create space for GOT entries for
4603 TLSDESC relocations.
4604 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4606 (Target_i386::Scan::global): Likewise.
4607 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
4609 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
4610 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
4611 (Target_x86_64::got_tlsdesc_section): New function.
4612 (Target_x86_64::got_section): Create space for GOT entries for
4613 TLSDESC relocations.
4614 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
4616 (Target_x86_64::Scan::global): Likewise.
4617 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
4620 2010-08-02 Ian Lance Taylor <iant@google.com>
4622 * testsuite/final_layout.sh: Use dc to convert from hex to
4625 2010-07-29 Sriraman Tallam <tmsriram@google.com>
4627 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4628 paramter to the call to gold::gc_process_relocs.
4629 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4630 paramter to the call to gold::gc_process_relocs.
4631 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4632 parameter to the call to gold::gc_process_relocs.
4633 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4634 template parameter to the call to gold::gc_process_relocs.
4635 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4636 paramter to the call to gold::gc_process_relocs.
4637 * gc.h (get_embedded_addend_size): New function.
4638 (gc_process_relocs): Save the size of the reloc for use by ICF.
4639 * icf.cc (get_section_contents): Get the addend from the text section
4640 for SHT_REL relocation sections.
4641 * icf.h (Icf::Reloc_addend_size_info): New typedef.
4642 (Icf::Reloc_info): Add new member reloc_addend_size_info.
4643 * int_encoding.h (read_from_pointer): New overloaded function.
4644 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
4645 * testsuite/icf_sht_rel_addend_test.sh: New file.
4646 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
4647 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
4649 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4651 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
4652 * Makefile.in: Regenerate.
4653 * testsuite/Makefile.in: Regenerate.
4655 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
4657 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
4658 * gold/testsuite/debug_msg.cc: Likewise.
4659 * gold/testsuite/odr_violation1.cc
4660 * gold/testsuite/odr_violation2.cc
4662 2010-07-21 Cary Coutant <ccoutant@google.com>
4664 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
4665 string, and length fields.
4666 (Output_merge_string::Merged_strings_list): New type.
4667 (Output_merge_string::Merged_strings_lists): New typedef.
4668 (Output_merge_string): Replace merged_strings_ with
4669 merged_strings_lists_.
4670 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
4671 Merged_strings_list per input object and section. Don't store pointer
4672 to the string. Don't store length with each merged string entry.
4673 (Output_merge_string::finalize_merged_data): Loop over list of merged
4674 strings lists. Recompute length of each merged string.
4676 2010-07-15 Cary Coutant <ccoutant@google.com>
4678 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
4681 2010-07-14 Ian Lance Taylor <iant@google.com>
4683 * descriptors.cc (Descriptors::open): Report correct name in error
4686 2010-07-13 Doug Kwan <dougkwan@google.com>
4688 * arm.cc (Arm_input_section::Arm_input_section): For a
4689 SHT_ARM_EXIDX section, always keeps the input sections.
4690 (Arm_input_section::set_exidx_section_link): New method.
4691 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
4692 has_errors_ to false.
4693 (Arm_exidx_input_section::has_errors,
4694 Arm_exidx_input_section::set_has_errors): New methods.
4695 (Arm_exidx_input_section::has_errors_): New data member.
4696 (Arm_relobj::get_exidx_shndx_list): New method.
4697 (Arm_output_section::append_text_sections_to_list): Do not skip
4698 section without SHF_EXECINSTR.
4699 (Arm_output_section::fix_exidx_coverage): Skip input sections with
4701 (Arm_relobj::make_exidx_input_section): Add new parameter for text
4702 section header. Make error messages more verbose. Check for
4703 a non-executable section linked to an EXIDX section.
4704 (Arm_relobj::do_read_symbols): Remove error checking, which has been
4705 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
4706 check that there is no deferred EXIDX section if we exit early.
4707 Instead of not making an EXIDX section in case of an error, make one
4708 and set the has_errors flag of it.
4709 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
4710 in a relocatable link.
4711 (Target_arm::do_relax): Look for the EXIDX output section instead of
4712 assuming that it is called .ARM.exidx.
4713 (Target_arm::fix_exidx_coverage): Add a new parameter for input
4714 section list. Do not check for SHF_EXECINSTR section flags but
4715 skip any input section with errors.
4716 * output.cc (Output_section::Output_section): Initialize
4717 always_keeps_input_sections_ to false.
4718 (Output_section::add_input_section): Check for
4719 always_keeps_input_sections_.
4720 * output.h (Output_section::always_keeps_input_sections,
4721 Output_section::set_always_keeps_input_sections): New methods.
4722 (Output_section::always_keeps_input_sections): New data member.
4724 2010-07-13 Rafael Espindola <espindola@google.com>
4726 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
4727 * fileread.h (Input_file): Add try_extra_search_path and find_file.
4729 2010-07-13 Philip Herron <herron.philip@googlemail.com>
4730 Ian Lance Taylor <iant@google.com>
4732 * output.h (Output_section_lookup_maps::add_merge_section):
4733 Correct check of whether value was inserted.
4734 (Output_section_lookup_maps::add_merge_input_section): Likewise.
4735 (Output_section_lookup_maps::add_relaxed_input_section):
4737 * arm.cc (Target_arm::got_section): Remove used local os.
4738 * i386.cc (Target_i386::got_section): Likewise.
4739 * x86_64.cc (Target_x86_64::got_section): Likewise.
4740 * sparc.cc (Target_sparc::got_section): Likewise.
4741 (Target_sparc::relocate): Remove unused local have_got_offset.
4742 * powerpc.cc (Target_powerpc::relocate): Likewise.
4744 2010-07-13 Ian Lance Taylor <iant@google.com>
4746 * compressed_output.cc (zlib_decompress): Fix signature in
4749 * archive.cc (Archive::include_member): Unlock an external member
4750 of a thin archive. Don't bother to delete an object we know is
4753 2010-07-12 Cary Coutant <ccoutant@google.com>
4755 * compressed_output.cc (zlib_decompress): New function.
4756 (get_uncompressed_size): New function.
4757 (decompress_input_section): New function.
4758 * compressed_output.h (get_uncompressed_size): New function.
4759 (decompress_input_section): New function.
4760 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
4761 Handle compressed debug sections.
4762 * layout.cc (is_compressed_debug_section): New function.
4763 (Layout::output_section_name): Map compressed section names to
4765 * layout.h (is_compressed_debug_section): New function.
4766 (is_debug_info_section): Recognize compressed debug sections.
4767 * merge.cc: Include compressed_output.h.
4768 (Output_merge_data::do_add_input_section): Handle compressed
4770 (Output_merge_string::do_add_input_section): Handle compressed
4772 * object.cc: Include compressed_output.h.
4773 (Sized_relobj::Sized_relobj): Initialize new data members.
4774 (build_compressed_section_map): New function.
4775 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
4776 * object.h (Object::section_is_compressed): New method.
4777 (Object::do_section_is_compressed): New method.
4778 (Sized_relobj::Compressed_section_map): New type.
4779 (Sized_relobj::do_section_is_compressed): New method.
4780 (Sized_relobj::compressed_sections_): New data member.
4781 * output.cc (Output_section::add_input_section): Handle compressed
4783 * reloc.cc: Include compressed_output.h.
4784 (Sized_relobj::write_sections): Handle compressed debug sections.
4786 2010-07-08 Cary Coutant <ccoutant@google.com>
4788 * resolve.cc (Symbol_table::resolve): Remember whether undef was
4789 weak when resolving to a dynamic def.
4790 (Symbol_table::should_override): Add adjust_dyndef flag; set it
4791 for weak undef/dynamic def cases. Adjust callers.
4792 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
4793 undef_binding_weak_.
4794 (Symbol_table::sized_write_globals): Adjust symbol binding.
4795 (Symbol_table::sized_write_symbol): Add binding parameter.
4796 * symtab.h (Symbol::set_undef_binding): New method.
4797 (Symbol::is_undef_binding_weak): New method.
4798 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
4799 (Symbol_table::should_override): Add new parameter.
4800 (Symbol_table::sized_write_symbol): Add new parameter.
4802 * testsuite/weak_undef_file1.cc: Add new test case.
4803 * testsuite/weak_undef_file2.cc: Fix header comment.
4804 * testsuite/weak_undef_test.cc: Add new test case.
4806 2010-06-29 Doug Kwan <dougkwan@google.com>
4808 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
4809 Initialize USE_SYMBOL_.
4810 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
4812 (Arm_reloc_property::uses_symbol_): New data member declaration.
4813 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
4814 uses symbol value and symbol is undefined but not weakly undefined.
4816 2010-06-28 Rafael Espindola <espindola@google.com>
4818 * plugin.cc (Plugin::load): Use dlerror.
4820 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
4822 * symtab.cc (detect_odr_violations): When reporting an ODR
4823 violation, report an object where the symbol is defined.
4825 2010-06-25 Doug Kwan <dougkwan@google.com>
4827 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
4828 (Target_arm::section_may_have_icf_unsafe_pointers): New method
4830 (Target_arm::Scan::local_reloc_may_be_function_pointer,
4831 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
4832 target hook to detect function points.
4833 (Target_arm::Scan::possible_function_pointer_reloc): New method.
4834 * icf.h (Icf::check_section_for_function_pointers): Change type of
4835 parameter SECTION_NAME to const reference to std::string. Use
4836 target hook to determine if section may have unsafe pointers.
4837 * target.h (Target::section_may_have_icf_unsafe_pointers): New
4840 2010-06-21 Rafael Espindola <espindola@google.com>
4842 * fileread.cc (Input_file::find_fie): New
4843 (Input_file::open): Use Input_file::find_fie.
4844 * fileread.h (Input_file::find_fie): New
4845 * plugin.cc (set_extra_library_path): New.
4846 (Plugin::load): Add set_extra_library_path to the transfer vector.
4847 (Plugin_manager::set_extra_library_path): New.
4848 (Plugin_manager::add_input_file): Use the extra search path if set.
4849 (set_extra_library_path(): New.
4850 * plugin.h (Plugin_manager): Add set_extra_library_path and
4853 2010-06-19 Cary Coutant <ccoutant@google.com>
4855 * layout.cc (gdb_sections): Add .debug_types.
4856 (lines_only_debug_sections): Likewise.
4858 2010-06-18 Rafael Espindola <espindola@google.com>
4860 * plugin.cc (add_input_file,add_input_library)
4861 (Plugin_manager::add_input_file): Make filename arguments const.
4862 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
4865 2010-06-16 Doug Kwan <dougkwan@google.com>
4867 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
4868 .ARM.attributes section if we have not merged any input
4869 attributes sections.
4871 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4873 * arm.cc: Allow combining objects with no EABI version
4876 2010-06-15 Rafael Espindola <espindola@google.com>
4878 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
4880 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4882 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
4883 (struct iovec): Correct !HAVE_READV definition.
4885 2010-06-10 Cary Coutant <ccoutant@google.com>
4887 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
4888 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
4890 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
4893 * symtab.h (Symbol::is_placeholder): New member function.
4894 * target-reloc.h (relocate_section): Check for placeholder symbols.
4896 * testsuite/Makefile.am (plugin_test_8): New test.
4897 (plugin_test_9): New test.
4898 * testsuite/Makefile.in: Regenerate.
4900 2010-06-09 Nick Clifton <nickc@redhat.com>
4902 * yyscript.y (input_list_element): Allow strings prefixed with
4903 the '-' character. Treat these as libraries.
4904 * script.cc (script_add_library): New function. Adds a library
4905 specified by "-l<name>" found in an input script.
4906 * script-c.h: Add prototype for script_add_library.
4908 2010-06-07 Doug Kwan <dougkwan@google.com>
4910 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
4911 Restrict stub-group size to be within long conditional branch
4912 range when working around cortex-A8 erratum.
4914 2010-06-07 Damien Diederen <dd@crosstwine.com>
4916 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
4919 2010-06-03 Sriraman Tallam <tmsriram@google.com>
4923 (Output_section::Input_section_sort_entry::compare_section_ordering):
4924 Change to return non-zero correctly.
4925 (Output_section::Input_section_sort_section_order_index_compare
4926 ::operator()): Change to fix ambiguity in comparisons.
4928 2010-06-01 Sriraman Tallam <tmsriram@google.com>
4930 * gold.h (is_wildcard_string): New function.
4931 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
4932 (Layout::layout_eh_frame): Ditto.
4933 (Layout::find_section_order_index): New method.
4934 (Layout::read_layout_from_file): New method.
4935 * layout.h (Layout::find_section_order_index): New method.
4936 (Layout::read_layout_from_file): New method.
4937 (Layout::input_section_position_): New private member.
4938 (Layout::input_section_glob_): New private member.
4939 * main.cc (main): Call read_layout_from_file here.
4940 * options.h (--section-ordering-file): New option.
4941 * output.cc (Output_section::input_section_order_specified_): New
4943 (Output_section::Output_section): Initialize new member.
4944 (Output_section::add_input_section): Add new parameter.
4945 Keep input sections when --section-ordering-file is used.
4946 (Output_section::set_final_data_size): Sort input sections when
4947 section ordering file is specified.
4948 (Output_section::Input_section_sort_entry): Add new parameter.
4950 (Output_section::Input_section_sort_entry::compare_section_ordering):
4952 (Output_section::Input_section_sort_compare::operator()): Change to
4953 consider section_order_index.
4954 (Output_section::Input_section_sort_init_fini_compare::operator()):
4955 Change to consider section_order_index.
4956 (Output_section::Input_section_sort_section_order_index_compare
4957 ::operator()): New method.
4958 (Output_section::sort_attached_input_sections): Change to sort
4959 according to section order when specified.
4960 (Output_section::add_input_section<32, true>): Add new parameter.
4961 (Output_section::add_input_section<64, true>): Add new parameter.
4962 (Output_section::add_input_section<32, false>): Add new parameter.
4963 (Output_section::add_input_section<64, false>): Add new parameter.
4964 * output.h (Output_section::add_input_section): Add new parameter.
4965 (Output_section::input_section_order_specified): New
4967 (Output_section::set_input_section_order_specified): New method.
4968 (Input_section::Input_section): Initialize section_order_index_.
4969 (Input_section::section_order_index): New method.
4970 (Input_section::set_section_order_index): New method.
4971 (Input_section::section_order_index_): New member.
4972 (Input_section::Input_section_sort_section_order_index_compare): New
4974 (Output_section::input_section_order_specified_): New member.
4975 * script-sections.cc (is_wildcard_string): Delete and move modified
4977 (Output_section_element_input::Output_section_element_input): Modify
4978 call to is_wildcard_string.
4979 (Output_section_element_input::Input_section_pattern
4980 ::Input_section_pattern): Ditto.
4981 (Output_section_element_input::Output_section_element_input): Ditto.
4982 * testsuite/Makefile.am (final_layout): New test case.
4983 * testsuite/Makefile.in: Regenerate.
4984 * testsuite/final_layout.cc: New file.
4985 * testsuite/final_layout.sh: New file.
4987 2010-06-01 Rafael Espindola <espindola@google.com>
4989 * plugin.cc (Plugin::load): Pass the output name to the plugin.
4991 2010-06-01 Rafael Espindola <espindola@google.com>
4993 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
4994 visibility of symbols.
4996 2010-05-27 Doug Kwan <dougkwan@google.com>
4998 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
4999 from start of output section instead of address for a local symbol
5000 in a merged or relaxed section when doing a relocatable link.
5002 2010-05-26 Rafael Espindola <espindola@google.com>
5005 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
5006 adding sections the garbage collector removed.
5007 * gold/testsuite/Makefile.am: Add test.
5008 * gold/testsuite/Makefile.in: Regenerate.
5009 * gold/testsuite/plugin_test_7.sh: New.
5010 * gold/testsuite/plugin_test_7_1.c: New.
5011 * gold/testsuite/plugin_test_7_2.c: New.
5013 2010-05-26 Rafael Espindola <espindola@google.com>
5015 * script-sections.cc (Output_section_definition::set_section_addresses):
5016 Check for --section-start.
5018 2010-05-26 Doug Kwan <dougkwan@google.com>
5020 * arm.cc (Arm_scan_relocatable_relocs): New class.
5021 (Target_arm::relocate_special_relocatable): New method.
5022 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
5023 (Arm_relocate_functions::thumb_branch_common): Same.
5024 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
5025 instead of Default_scan_relocatable_relocs.
5026 * target-reloc.h (relocate_for_relocatable): Let target handle
5027 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
5028 * target.h (Sized_target::relocate_special_relocatable): New method.
5030 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5032 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
5034 2010-05-23 Doug Kwan <dougkwan@google.com>
5036 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
5038 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
5039 with a direct branch, not a conditional branch, to a stub.
5040 * merge.cc (Output_merge_base::record_input_section): New method
5042 (Output_merge_data::do_add_input_section): Record input section if
5043 keeps-input-sections flag is set.
5044 (Output_merge_string::do_add_input_section): Ditto.
5045 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
5046 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
5048 (Output_merge_base::keeps_input_sections,
5049 Output_merge_base::set_keeps_input_sections,
5050 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
5052 (Output_merge_base::Input_sections): New type declaration.
5053 (Output_merge_base::input_sections_begin,
5054 Output_merge_base::input_sections_end,
5055 Output_merge_base::do_set_keeps_input_sections): New method definitions.
5056 (Output_merge_base::bool keeps_input_sections_,
5057 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
5058 Output_merge_base::input_sections_): New data members.
5059 (Output_merge_data::do_set_keeps_input_sections): New method
5061 (Output_merge_string::do_set_keeps_input_sections): Ditto.
5062 * output.cc (Output_section::Input_section::relobj): Move method
5063 defintion from class declaration to here and handle merge sections.
5064 (Output_section::Input_section::shndx): Ditto.
5065 (Output_section::Output_section): Remove initializations of removed
5066 data members and initialize new data member LOOKUP_MAPS_.
5067 (Output_section::add_input_section): Set keeps-input-sections flag
5068 for a newly created merge output section as appropriate. Adjust code
5069 to use Output_section_lookup_maps class.
5070 (Output_section::add_relaxed_input_section): Adjst code for lookup
5071 maps code refactoring.
5072 (Output_section::add_merge_input_section): Add a new parameter
5073 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
5074 class. If adding input section to a newly created merge output
5075 section fails, remove the new merge section.
5076 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
5077 Adjust code for use of the Output_section_lookup_maps class.
5078 (Output_section::find_merge_section): Ditto.
5079 (Output_section::build_lookup_maps): New method defintion.
5080 (Output_section::find_relaxed_input_section): Adjust code to use
5081 Output_section_lookup_maps class.
5082 (Output_section::get_input_sections): Export merge sections. Adjust
5083 code to use Output_section_lookup_maps class.
5084 (Output_section:::add_script_input_section): Adjust code to use
5085 Output_section_lookup_maps class. Update lookup maps for merge
5087 (Output_section::discard_states): Use Output_section_lookup_maps.
5088 (Output_section::restore_states): Same.
5089 * output.h (Merge_section_properties): Move class defintion out of
5091 (Output_section_lookup_maps): New class.
5092 (Output_section::Input_section::is_merge_section): New method
5094 (Output_section::Input_section::relobj): Move defintion out of class
5095 defintion. Declare method only.
5096 (Output_section::Input_section::shndx): Ditto.
5097 (Output_section::Input_section::output_merge_base): New method defintion.
5098 (Output_section::Input_section::u2_.pomb): New union field.
5099 (Output_section::Merge_section_by_properties_map,
5100 Output_section::Output_section_data_by_input_section_map,
5101 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
5103 (Output_section::add_merge_input_section): Add new parameter
5104 KEEPS_INPUT_SECTIONS.
5105 (Output_section::build_lookup_maps): New method declaration.
5106 (Output_section::merge_section_map_,
5107 Output_section::merge_section_by_properties_map_,
5108 Output_section::relaxed_input_section_map_,
5109 Output_section::is_relaxed_input_section_map_valid_): Remove data
5111 (Output_section::lookup_maps_): New data member.
5113 2010-05-21 Doug Kwan <dougkwan@google.com>
5116 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
5117 avoid a compilation error.
5119 2010-05-19 Rafael Espindola <espindola@google.com>
5121 * script-sections.cc (Output_section_definition::allocate_to_segment):
5122 Update the phdrs_list even when the output section is NULL.
5123 * testsuite/Makefile.am: Add test.
5124 * testsuite/Makefile.in: Regenerate.
5125 * testsuite/script_test_9.cc: New.
5126 * testsuite/script_test_9.sh: New.
5127 * testsuite/script_test_9.t: New.
5129 2010-05-19 Doug Kwan <dougkwan@google.com>
5131 * arm.cc (Arm_input_section::original_size): New method.
5132 (Arm_input_section::do_addralign): Add a cast.
5133 (Arm_input_section::do_output_offset): Remove static cast.
5134 (Arm_input_section::original_addralign,
5135 Arm_input_section::original_size_): Change type to uint32_t.
5136 (Arm_input_section::init): Add safe casts for section alignment
5138 (Arm_input_section::set_final_data_size): Do not set address and
5139 offset of stub table.
5140 (Arm_output_section::fix_exidx_coverage): Change use of of
5141 Output_section::Simple_input_section to that of
5142 Output_section::Input_section.
5143 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
5144 except for the first pass.
5145 * output.cc (Output_section::get_input_sections): Change type of
5146 input_sections to std::list<Input_section>.
5147 (Output_section::add_script_input_section): Rename from
5148 Output_section::add_simple_input_section. Change type of SIS
5149 parameter from Simple_input_section to Input_section.
5150 * output.h (Output_section::Simple_input_section): Remove class.
5151 (Output_section::Input_section): Change class visibility to public.
5152 (Output_section::Input_section::addralign): Use stored alignments
5153 for special input sections if set.
5154 (Output_section::Input_section::set_addralign): New method.
5155 (Output_section::get_input_sections): Change parameter type from
5156 list of Simple_input_section to list of Input_section.
5157 (Output_section::add_script_input_section): Rename from
5158 Output_section::add_simple_input_section. Change first parameter's
5159 type from Simple_input_section to Input_section and remove the
5160 second and third parameters.
5161 * script-sections.cc (Input_section::Input_section_list): Change
5162 type to list of Output_section::Input_section/
5163 (Input_section_info::Input_section_info): Change parameter type of
5164 INPUT_SECTION to Output_section::Input_section.
5165 (Input_section_info::input_section): Change return type.
5166 (Input_section_info::input_section_): Change type to
5167 Output_section::Input_section.
5168 (Output_section_element_input::set_section_addresses): Adjust code
5169 to use Output_section::Input_section instead of
5170 Output_section::Simple_input_section. Adjust code for renaming
5171 of Output_section::add_simple_input_section.
5172 (Orphan_output_section::set_section_addresses): Ditto.
5174 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5176 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
5177 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
5179 2010-05-18 Rafael Espindola <espindola@google.com>
5181 * options.cc (General_options::finalize): Handle -nostdlib.
5182 * options.h (nostdlib): New option.
5183 * script.cc (script_add_search_dir): Handle -nostdlib.
5185 2010-05-12 Doug Kwan <dougkwan@google.com>
5187 * arm.cc (Target_arm::do_finalize_sections): Create an empty
5188 attributes section only if there no attributes section after merging.
5189 (Target_arm::merge_object_attributes): Move value of
5190 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
5191 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
5192 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
5193 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
5194 and arm_attr_merge_7.stdout.
5195 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
5196 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
5197 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
5198 arm_attr_merge_7b.o): New rules.
5199 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
5201 * testsuite/Makefile.in: Regenerate.
5202 * testsuite/arm_attr_merge.sh: New file.
5203 * testsuite/arm_attr_merge_[67][ab].s: Same.
5205 2010-05-05 Nick Clifton <nickc@redhat.com>
5207 * po/es.po: Updated Spanish translation.
5209 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
5211 * Makefile.am (install-exec-local): Properly install gold as
5212 default cross linker.
5213 * Makefile.in: Regenerated.
5215 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
5216 Nick Clifton <nickc@redhat.com>
5218 * configure.ac (install_as_default): Define and set to false
5219 unless --enable-gold or --enable-gold=both/gold has been
5221 * configure: Regenerate.
5223 * Makefile.am (install-exec-local): Install the executable as
5224 'ld.gold'. If install_as_default is true then also install it as
5226 * Makefile.in: Regenerated.
5228 2010-04-24 Ian Lance Taylor <iant@google.com>
5230 * layout.cc (Layout::layout_reloc): In relocatable link don't
5231 combine reloc sections for grouped sections.
5233 2010-04-23 Sriraman Tallam <tmsriram@google.com>
5235 * gc.h (gc_process_relocs): Pass information on relocs pointing to
5236 sections that are not ordinary to icf.
5237 * icf.cc (get_section_contents): Handle relocation pointing to section
5238 with no object or shndx information.
5239 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
5240 * testsuite/Makefile.in: Regenerate.
5241 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
5242 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
5244 2010-04-22 Ian Lance Taylor <iant@google.com>
5246 * expression.cc (Expression::Expression_eval_info): Add
5247 result_alignment_pointer field.
5248 (Expression::eval_with_dot): Add result_alignment_pointer
5249 parameter. Change all callers.
5250 (Expression::eval_maybe_dot): Likewise.
5251 (class Binary_expression): Add alignment_pointer parameter to
5252 left_value and right_value. Change all callers.
5253 (BINARY_EXPRESSION): Set result alignment.
5254 (class Trinary_expression): Add alignment_pointer parameter to
5255 arg2_value and arg3_value. Change all callers.
5256 (Trinary_cond::value): Set result alignment.
5257 (Max_expression::value, Min_expression::value): Likewise.
5258 (Align_expression::value): Likewise.
5259 * script-sections.cc (class Sections_element): Add dot_alignment
5260 parameter to set_section_addresses virtual function. Update
5262 (class Output_section_element): Likewise.
5263 (Script_sections::create_segments): Add dot_alignment parameter.
5265 (Script_sections::create_segments_from_phdrs_clause): Likewise.
5266 (Script_sections::set_phdrs_clause_addresses): Likewise.
5267 * script-sections.h: Update declarations.
5268 * script.h: Update declarations.
5269 * output.h (Output_segment::set_minimum_p_align): Don't decrease
5271 * testsuite/script_test_3.t: Set large alignment.
5272 * testsuite/script_test_3.sh: Make sure that at least one LOAD
5273 segment has expected alignment.
5275 2010-04-22 Nick Clifton <nickc@redhat.com>
5277 * po/gold.pot: Updated by the Translation project.
5278 * po/vi.po: Updated Vietnamese translation.
5280 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
5282 * testsuite/Makefile.am (check_PROGRAMS): Add
5283 icf_virtual_function_folding_test.
5284 * testsuite/Makefile.in: Regenerated.
5286 2010-04-15 Andrew Haley <aph@redhat.com>
5288 * options.h (merge_exidx_entries): New option.
5289 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
5290 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
5291 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
5292 (Target_arm::merge_exidx_entries): New function.
5293 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
5294 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
5295 to Arm_exidx_fixup constructor.
5296 Add new arg, merge_exidx_entries.
5297 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
5298 Arm_output_section::fix_exidx_coverage.
5300 2010-04-18 Sriraman Tallam <tmsriram@google.com>
5302 * icf.cc (get_section_contents): Check for preemptible functions.
5303 Ignore addend when appropriate.
5304 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
5306 (add_from_relobj): Check for section folded.
5307 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
5308 * symtab.h (should_add_dynsym_entry): Add new parameter.
5309 * target-reloc.h (scan_relocs): Check for section folded.
5310 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
5311 Check reloc types for function pointers in shared objects.
5312 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
5314 (icf_preemptible_functions_test): New test case.
5315 (icf_string_merge_test): New test case.
5316 * testsuite.Makefile.in: Regenerate.
5317 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
5318 bar_glob. Refactor code.
5319 * testsuite/icf_preemptible_functions_test.cc: New file.
5320 * testsuite/icf_preemptible_functions_test.sh: New file.
5321 * testsuite/icf_string_merge_test.cc: New file.
5322 * testsuite/icf_string_merge_test.sh: New file.
5323 * testsuite/icf_virtual_function_folding_test.cc: New file.
5324 * testsuite/icf_virtual_function_folding_test.sh: New file.
5326 2010-04-14 Doug Kwan <dougkwan@google.com>
5328 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
5329 for local symbol recounting if we remove a section due to ICF.
5330 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
5331 there are no regular objects in input.
5333 2010-04-13 Doug Kwan <dougkwan@google.com>
5335 * arm.cc (Arm_input_section::set_final_data_size): Compute
5336 accurate final data size instead of using current data size.
5338 2010-04-09 Doug Kwan <dougkwan@google.com>
5340 * layout.cc (Layout::choose_output_section): Handle script section
5342 (Layout::make_output_section_for_script): Add section type parameter.
5343 Handle script section types.
5344 * layout.h (Layout::make_output_section_for_script): Add section
5346 * output.cc (Output_section::Output_section): Initialize data member
5348 (Output_section::do_reset_address_and_file_offset): Do not set address
5349 to 0 if section is a NOLOAD section.
5350 * output.h (Output_section::is_noload): New method.
5351 (Output_section::set_is_noload): Ditto.
5352 (Output_section::is_noload_): New data member.
5353 * script-c.h (Script_section_type): New enum type.
5354 (struct Parser_output_section_header): Add new file section_type.
5355 * script-sections.cc (Sections_element::output_section_name): Add
5356 parameter for returning script section type.
5357 (Output_section_definition::output_section_name): Ditto.
5358 (Output_section_definition::section_type)P; New method.
5359 (Output_section_definiton::script_section_type_name): Ditto.
5360 (Output_section_definition::script_section_type_): New data member.
5361 (Output_section_definition::Output_section_definition): Initialize
5362 data member Output_section_definition::script_section_type_.
5363 (Output_section_definition::create_sections): Pass script section type
5364 to Layout::make_output_section_for_script.
5365 (Output_section_definition::output_section_name): Return script
5366 section type to caller.
5367 (Output_section_definition::set_section_address): Do not advance
5368 dot value and load address if section type is NOLOAD. Set address
5369 of NOLOAD sections regardless of section flags.
5370 (Output_section_definition::print): Print section type if it is
5371 not SCRIPT_SECTION_TYPE_NONE.
5372 (Output_section_definition::section_type): New method.
5373 (Output_section_definition::script_section_type_name): Ditto.
5374 (Script_sections::output_section_name): Add new parameter
5375 PSECTION_TYPE for returning script section type. Pass it to
5376 section elements. Handle discard sections.
5377 (Sort_output_sections::operator()): Handle NOLOAD sections.
5378 * script-sections.h (Script_sections::Section_type): New enum type.
5379 (Script_sections::output_section_name): Add a new parameter for
5380 returning script section type.
5381 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
5383 * yyscript.y (union): Add new field SECTION_TYPE.
5384 (COPY, DSECT, INFO, NOLOAD): New tokens.
5385 (opt_address_and_section_type): Change type to output_section_header.
5386 (section_type): New non-terminal
5387 (section_header): Handle section type.
5388 (opt_address_and_section_type): Return section type value.
5390 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
5392 * testsuite/plugin_common_test_1.c (foo): Add prototype.
5393 * testsuite/plugin_common_test_2.c (foo): Likewise.
5395 2010-04-08 Doug Kwan <dougkwan@google.com>
5397 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
5399 * output.cc (Output_section::add_merge_input_section): Simplify
5400 code and return status of Output_merge_base::add_input_section.
5401 Update merge section map only if Output_merge_base::add_input_section
5404 2010-04-07 Doug Kwan <dougkwan@google.com>
5406 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
5407 if section is marked as containing instructions but has no mapping
5409 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
5410 correct section index.
5411 (Arm_relobj::find_linked_text_section): Ditto.
5413 2010-04-07 Cary Coutant <ccoutant@google.com>
5415 * archive.cc (include_member): Destroy Read_symbols_data object before
5417 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
5418 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
5419 (Read_symbols_data::~Read_symbols_data) New destructor.
5420 (Section_relocs::Section_relocs) New constructor.
5421 (Section_relocs::~Section_relocs) New destructor.
5422 (Read_relocs_data::Read_relocs_data) New constructor.
5423 (Read_relocs_data::~Read_relocs_data) New destructor.
5424 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
5425 pointers to NULL after deleting.
5427 2010-04-07 Doug Kwan <dougkwan@google.com>
5429 * arm.cc: Replace "endianity" with "endianness" in comments.
5430 (Arm_exidx_cantunwind): Ditto.
5431 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
5432 (Arm_relobj::merge_flags_and_attributes): New method.
5433 (Arm_relobj::merge_flags_and_attributes_): New data member.
5434 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
5435 (Arm_relobj::scan_sections_for_stubs): Ditto.
5436 (Arm_relobj::do_read_symbols): Check to see if we really want to
5437 merge processor-specific flags and attributes. Exit early if
5438 an object is empty except for section names and the undefined symbol.
5439 (Target_arm::do_finalize_sections): Move check for ELF format to
5440 Arm_relobj::do_read_symbols. Merge processor specific flags and
5441 attributes from a regular object only when we have determined that
5442 it is aapropriate. Do not create an .ARM.attributes section in
5443 output if there is no regular input object.
5444 (Target_arm::merge_processor_specific_flags): Check
5445 --warn-mismatch before printing any error.
5446 (Target_arm::merge_object_attributes): Ditto.
5447 * gold.cc (queue_middle_tasks): Handle the case in which there is
5448 no regular object in input.
5449 * options.cc (General_options::parse_EB): New method.
5450 (General_options::parse_EL): Same.
5451 (General_options::General_options): Initialize endianness_.
5452 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
5454 (General_options::Endianness): New enum.
5455 (General_options::endianness): New method.
5456 (General_options::endianness_): New data member.
5457 * parameters.cc (Parameters::set_options): Check target endianness.
5458 (Parameters::set_target_once): Ditto.
5459 (Parameters::check_target_endianness): New method.
5460 (parameters_force_valid_target): If either -EL or -EB is specified,
5461 use it to define endianness of default target.
5462 * parameters.h (Parameters::check_target_endianness): New method
5464 * target.h (class Target): Change "endianity" to "endianness"
5467 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5469 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
5470 * configure: Regenerate.
5471 * Makefile.in: Regenerate.
5472 * testsuite/Makefile.in: Regenerate.
5474 2010-04-06 Cary Coutant <ccoutant@google.com>
5477 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
5478 prevailing definitions of common symbols.
5479 * testsuite/plugin_test_6.sh: New test case.
5480 * testsuite/plugin_common_test_1.c: New test case.
5481 * testsuite/plugin_common_test_2.c: New test case.
5482 * testsuite/Makefile.am (plugin_test_6): New test case.
5483 * testsuite/Makefile.in: Regenerate.
5485 2010-04-06 Nick Clifton <nickc@redhat.com>
5487 * po/vi.po: New Vietnamese translation.
5489 2010-03-30 Doug Kwan <dougkwan@google.com>
5491 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
5493 2010-03-25 Doug Kwan <dougkwan@google.com>
5495 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
5496 to avoid a conversion warning on a 32-bit host.
5498 2010-03-24 Ian Lance Taylor <iant@google.com>
5500 * testsuite/script_test_3.t: Add a TLS segment.
5501 * testsuite/Makefile.am (check_PROGRAMS): Add
5502 tls_phdrs_script_test.
5503 (tls_phdrs_script_test_SOURCES): Define.
5504 (tls_phdrs_script_test_DEPENDENCIES): Define.
5505 (tls_phdrs_script_test_LDFLAGS): Define.
5506 (tls_phdrs_script_test_LDADD): Define.
5507 * testsuite/Makefile.in: Rebuild.
5509 2010-03-23 Cary Coutant <ccoutant@google.com>
5511 * fileread.cc (find_or_make_view): Fix comment.
5513 2010-03-23 Ian Lance Taylor <iant@google.com>
5515 * script-sections.cc (class Orphan_section_placement): Define
5516 PLACE_TLS and PLACE_TLS_BSS.
5517 (Orphan_section_placement::Orphan_section_placement): Initialize
5519 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
5520 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
5521 (tls_script_test_SOURCES): Define.
5522 (tls_script_test_DEPENDENCIES): Define.
5523 (tls_script_test_LDFLAGS): Define.
5524 (tls_script_test_LDADD): Define.
5525 * testsuite/Makefile.in: Rebuild.
5527 2010-03-22 Doug Kwan <dougkwan@google.com>
5529 * arm.cc (Arm_relocate_functions::abs8,
5530 Arm_relocate_functions::abs16): Use correct check for overflow
5531 specified in the ARM ELF specs.
5532 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
5533 target of a BLX instruction specially.
5534 (Reloc_stub::stub_type_for_reloc): Ditto.
5535 (Relocate::relocate): Use symbolic names instead of numeric relocation
5536 codes to report error.
5537 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
5539 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
5540 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
5541 thumb2_blx_out_of_range.stdout
5542 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
5543 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
5544 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
5545 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
5546 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
5547 thumb2_blx_in_range, thumb2_blx_in_range.o,
5548 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
5549 thumb2_blx_out_of_range.o): New rules.
5550 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
5551 thumb2_blx_in_range and thumb2_blx_out_of_range.
5552 * testsuite/Makefile.in: Regenerate.
5553 * arm_branch_in_range.sh: Add tests for THUMB BLX.
5554 * testsuite/thumb_blx_in_range.s: New file.
5555 * testsuite/thumb_blx_out_of_range.s: New file.
5557 2010-03-22 Rafael Espindola <espindola@google.com>
5559 * archive.cc (Should_include): Move to archive.h.
5560 (should_include_member): Make it a member of Archive.
5562 (Add_lib_group_symbols): New.
5563 * archive.h: Include options.h.
5564 (Archive_member): Moved from Archive.
5565 (Should_include): Moved from archive.cc.
5567 (Add_lib_group_symbols): New.
5568 * dynobj.cc (do_should_include_member): New.
5569 * dynobj.h (do_should_include_member): New.
5570 * gold.cc (queue_initial_tasks): Update call to queue.
5571 * main.cc (main): Print lib group stats.
5572 * object.cc (do_should_include_member): New.
5573 * object.h: Include archive.h.
5574 (Object::should_include_member): New.
5575 (Object::do_should_include_member): New.
5576 (Sized_relobj::do_should_include_member): New.
5577 * options.cc (General_options::parse_start_lib): New.
5578 (General_options::parse_end_lib): New.
5579 (Input_arguments::add_file): Handle lib groups.
5580 (Input_arguments::start_group): Check we are not in a lib.
5581 (Input_arguments::start_lib): New.
5582 (Input_arguments::end_lib): New.
5583 * options.h (General_options): Add start_lib and end_lib.
5584 (Input_argument::lib_): New.
5585 (Input_argument::lib): New.
5586 (Input_argument::is_lib): New.
5587 (Input_file_lib): New.
5588 (Input_arguments::in_lib_): New.
5589 (Input_arguments::in_lib): New.
5590 (Input_arguments::start_lib): New.
5591 (Input_arguments::end_lib_): New.
5592 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5593 in unused members as preempted.
5594 (Sized_pluginobj::do_should_include_member): New.
5595 * plugin.h (Sized_pluginobj::do_should_include_member): New.
5596 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5598 (Read_symbols::do_whole_lib_group): New.
5599 (Read_symbols::do_lib_group): New.
5600 (Read_symbols::do_read_symbols): Handle lib groups.
5601 (Read_symbols::get_name): Handle lib groups.
5602 * readsyms.h (Read_symbols): Add an archive member pointer.
5603 (Read_symbols::do_whole_lib_group): New.
5604 (Read_symbols::do_lib_group): New.
5605 (Read_symbols::member_): New.
5606 * script.cc (read_input_script): Update call to queue_soon.
5608 2010-03-19 Doug Kwan <dougkwan@google.com>
5610 * arm.cc (Stub_table::Stub_table): Initialize new data members
5611 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5612 (Stub_table::add_reloc_stub): Assign stub offset and update
5613 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5614 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
5616 (Stub_table::update_data_size_and_addralign): Use
5617 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
5618 instead of going over all reloc stubs.
5619 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
5620 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5621 Stringpool_template::offset_ to size of Stringpool_char.
5622 (Stringpool_template::new_key_offset): Remove code to initialize
5623 Stringpool_template::offset_.
5624 * stringpool.h (Stringpool_template::set_no_zero_null): Set
5625 Stringpool_template::offset_ to zero.
5627 2010-03-15 Doug Kwan <dougkwan@google.com>
5629 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5631 (Stringpool_template::new_key_offset): New method.
5632 (Stringpool_template::add_string): Assign offsets when adding new
5634 (Stringpool_template::set_string_offsets): Do not set string offsets
5635 when not optimizing.
5636 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5638 (Chunked_vector::clear): Clear size_.
5639 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5640 (Chunked_vector::size): Return size_.
5641 (Chunked_vector::push_back): Use size_ to find insert position.
5642 (Chunked_vector::size_): New data member.
5643 (Stringpool_template::set_no_zero_null): Assert string set is empty.
5644 (Stringpool_template::new_key_offset): New method declaration.
5645 (Stringpool_template::offset_): New data member.
5647 2010-03-15 Rafael Espindola <espindola@google.com>
5649 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
5650 Add_symbols' constructor.
5651 * readsyms.h (Add_symbols): Remove the input_group member.
5653 2010-03-10 Ian Lance Taylor <iant@google.com>
5655 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
5656 target to ask whether a reference to a symbol requires a stack
5658 * target.h (Target::is_call_to_non_split): New function.
5659 (Target::do_is_call_to_non_split): Declare virtual function.
5660 * target.cc: Include "symtab.h".
5661 (Target::do_is_call_to_non_split): New function.
5662 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
5664 2010-03-10 Cary Coutant <ccoutant@google.com>
5666 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
5667 (File_read::open[1]): Remove initial mapping of whole_file_view_.
5668 (File_read::open[2]): Add whole_file_view_ to list of views.
5669 (File_read::make_view): Remove test of whole_file_view_.
5670 (File_read::find_or_make_view): Create whole_file_view_ if
5672 (File_read::clear_views): Replace bool parameter with enum;
5673 adjust all callers. Don't delete views with permanent data;
5674 do delete cached views and views from archives if
5675 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
5676 if clearing the corresponding view.
5677 * fileread.h (File_read::Clear_views_mode): New enum.
5678 (File_read::View::is_permanent_view): New method.
5679 (File_read::clear_views): Replace bool parameter
5680 with enum; adjust all callers.
5681 * options.h (General_options): Change keep_files_mapped option;
5682 add map_whole_files.
5683 * readsyms.cc (Add_symbols::run): Delete sd_ object before
5685 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
5688 2010-03-10 David S. Miller <davem@davemloft.net>
5690 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
5692 2010-03-09 Sriraman Tallam <tmsriram@google.com>
5694 * icf.cc (get_section_contents): Add '@' marker after processing the
5697 2010-03-08 Doug Kwan <dougkwan@google.com>
5699 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
5700 due to a conversion warning.
5701 (Arm_relobj::update_output_local_symbol_count): Check for local
5702 symbol with unset output index.
5704 2010-03-05 Ian Lance Taylor <iant@google.com>
5706 * options.h (class General_options): Add --spare-dynamic-tags.
5707 * output.cc (Output_data_dynamic::set_final_data_size): Implement
5708 --spare-dynamic-tags.
5710 2010-03-05 Ian Lance Taylor <iant@google.com>
5712 * incremental.cc: Include "libiberty.h".
5714 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
5716 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
5717 function, is_info_ member.
5718 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
5719 (Versions::Versions): Update caller.
5720 (Versions::define_base_version): Likewise.
5721 (Versions::add_def): Likewise.
5723 2010-03-03 Sriraman Tallam <tmsriram@google.com>
5725 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
5726 (Scan::possible_function_pointer_reloc): New function.
5727 (Scan::local_reloc_may_be_function_pointer): Change to call
5728 possible_function_pointer_reloc.
5729 (Scan::global_reloc_may_be_function_pointer): Ditto.
5730 * icf.h (Icf::check_section_for_function_pointers): Change to reject
5731 relocations in ".data.rel.ro._ZTV" section.
5732 * testsuite/icf_safe_so_test.sh: Change to pass i386.
5733 * testsuite/icf_safe_so_test.cc: Ditto.
5734 * testsuite/icf_safe_test.cc: Ditto.
5735 * testsuite/icf_safe_test.sh: Ditto.
5737 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5738 Ian Lance Taylor <iant@google.com>
5740 * target-reloc.h (relocate_section): Check the symbol table index
5741 for -1U before setting the local symbol index.
5742 (scan_relocatable_relocs): If copying the relocation, record that
5743 the local symbol is required.
5744 * object.h (Symbol_value::is_output_symtab_index_set): New
5746 (Symbol_value::may_be_discarded_from_output_symtab): New
5748 (Symbol_value::has_output_symtab_entry): New function.
5749 (Symbol_value::needs_output_symtab_entry): Remove.
5750 (Symbol_value::output_symtab_index): Make sure the symbol index is
5752 (Symbol_value::set_output_symtab_index): Make sure the symbol
5753 index is not set. Make sure the new index is valid.
5754 (Symbol_value::set_must_have_output_symtab_entry): New function.
5755 (Symbol_value::has_output_dynsym_entry): New function.
5756 (Symbol_value::set_output_dynsym_index): Make sure the new index
5758 (Sized_relobj::set_must_have_output_symtab_entry): New function.
5759 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
5760 local symbol if permitted.
5761 (Sized_relobj::do_finalize_local_symbols): Call
5762 is_output_symtab_index_set rather than needs_output_symtab_entry.
5763 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
5764 rather than needs_output_symtab_entry. Call
5765 has_output_dynsym_entry rather than needs_output_dynsym_entry.
5766 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
5767 is_output_symtab_index_set rather than needs_output_symtab_entry.
5768 * testsuite/discard_locals_relocatable_test.c: New file.
5769 * testsuite/discard_locals_test.sh: Test -r.
5770 * testsuite/Makefile.am (check_DATA): Add
5771 discard_locals_relocatable_test1.syms,
5772 discard_local_relocatable_test2.syms.
5773 (MOSTLYCLEANFILES): Likewise. Also add
5774 discard_locals_relocatable_test1.lout and
5775 discard_locals_relocatable_test2.out.
5776 (discard_locals_relocatable_test1.syms): New target.
5777 (discard_locals_relocatable_test.o): New target.
5778 (discard_locals_relocatable_test1.out): New target.
5779 (discard_locals_relocatable_test2.syms): New target.
5780 (discard_locals_relocatable_test2.out): New target.
5781 (various): Add missing ../ld-new dependencies.
5782 * testsuite/Makefile.in: Rebuild.
5784 2010-03-03 Nick Clifton <nickc@redhat.com>
5786 * po/fi.po: New Finnish translation.
5788 2010-03-01 Doug Kwan <dougkwan@google.com>
5790 * layout.cc (Layout::Layout): Force section types of .init_array*,
5791 .preinit_array* and .fini_array* sections.
5792 * output.cc (Output_section::Input_section_sort_entry::has_priority):
5793 Fix check of return value of std::string::find.().
5794 (Output_section::Input_section_sort_compare::operator()): Remove
5795 comment about .init_array.
5796 (Output_section::Input_section_sort_init_fini_compare::operator()):
5798 (Output_section::sort_attached_input_sections): Handle .init_array
5799 and .fini_array specially.
5800 * output.h (Output_section::Inut_section_sort_compare): Update
5802 (Output_section::Input_section_sort_init_fini_compare): New struct.
5804 2010-02-26 Doug Kwan <dougkwan@google.com>
5806 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
5807 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
5808 * testsuite/debug_msg.sh: Avoid matching source line number for
5809 use of global variable undef_int.
5811 2010-02-26 Doug Kwan <dougkwan@google.com>
5813 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
5814 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
5815 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
5816 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
5817 * options.cc (General_options::General_options): Initialize member
5819 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
5820 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
5821 and rm_no_fix_v4bx.stdout
5822 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
5823 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
5824 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
5825 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
5826 and arm_no_fix_v4bx.
5827 * Makefile.in: Regenerate.
5828 * testsuite/arm_fix_v4bx.s: New file.
5829 * testsuite/arm_fix_v4bx.sh: Ditto.
5831 2010-02-24 Doug Kwan <dougkwan@google.com>
5833 * arm.cc (Target_arm::got_section): Make the .got section the first
5834 non RELRO section in the data segment.
5835 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
5836 suffixes of section names.
5838 2010-02-24 Doug Kwan <dougkwan@google.com>
5840 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
5841 flags and attributes merging if an input file is a binary file.
5842 * fileread.cc (Input_file::open): Record format of original file.
5843 * fileread.h (Input_file::Format): New enum type.
5844 (Input_file::Input_file): Initialize data member format_.
5845 (Input_file::format): New method definition.
5846 (Input_file::format_):: New data member.
5848 2010-02-24 Doug Kwan <dougkwan@google.com>
5850 * arm.cc (Arm_output_data_got): New class.
5851 (ARM_TCB_SIZE): New constant
5852 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
5853 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
5854 If user uses a script with a SECTIONS clause, issue only a warning
5855 for a misplaced EXIDX input section. Otherwise, issue an error.
5856 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
5858 (Target_arm::got_mode_index_entry): Handle static linking.
5859 (Target_arm::Scan::local): Ditto.
5860 (Target_arm::Scan::global): Ditto.
5861 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
5862 all incorrectly implemented relocations.
5863 (Target_arm::fix_exidx_coverage): Pass layout to
5864 Arm_output_section::fix_exidx_coverage.
5865 * layout.cc (Layout::section_name_mapping): Remove trailing dots
5866 from ".ARM.exidx." and ".ARM.extab.".
5868 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5870 * arm.cc (Target_arm::do_finalize_sections): Create attribute
5871 section if it does not already exist.
5872 * attributes.cc (Attributes_section_data::Attributes_section_data):
5873 Don't crash if size is zero.
5875 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5876 Ian Lance Taylor <iant@google.com>
5878 * gold.cc (queue_middle_tasks): If no input files were opened,
5880 * workqueue.h (Task_function::Task_function): Assert that there is
5883 2010-02-22 Doug Kwan <dougkwan@google.com>
5885 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
5886 * icf.cc (get_section_contents): Cast snprintf arguments to long long
5887 types to avoid warnings due to different uint64_t implementations
5890 2010-02-21 Doug Kwan <dougkwan@google.com>
5892 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
5893 handling of the maximum backward branch offset.
5894 (Arm_relocate_functions::thumb_branch_common): Ditto.
5895 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
5896 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
5897 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
5898 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
5899 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
5900 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
5901 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
5902 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
5903 thumb_bl_out_of_range thumb_bl_out_of_range.o,
5904 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
5905 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
5906 thumb2_bl_out_of_range.o): New rules.
5907 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
5908 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
5909 thumb2_bl_out_of_range
5910 * testsuite/Makefile.in: Regenerate.
5911 * testsuite/arm_bl_in_range.s: New file.
5912 * testsuite/arm_bl_out_of_range.s: Ditto.
5913 * testsuite/arm_branch_in_range.sh: Ditto.
5914 * testsuite/arm_branch_range.t: Ditto.
5915 * testsuite/thumb2_branch_range.t: Ditto.
5916 * testsuite/thumb_bl_in_range.s: Ditto.
5917 * testsuite/thumb_bl_out_of_range.s: Ditto.
5918 * testsuite/thumb_branch_range.t: Ditto.
5920 2010-02-20 Sriraman Tallam <tmsriram@google.com>
5922 * gc.h (gc_process_relocs): Change vectors to point to the new list.
5923 Add reloc offset information.
5924 * icf.cc (get_section_contents): Change iterators to point to the new
5925 vectors. Add reloc offset information to the contents.
5926 * icf.h (Icf::Sections_reachable_info): New typedef.
5927 (Icf::Sections_reachable_list): New typedef.
5928 (Icf::Offset_info): New typedef.
5929 (Icf::Reloc_info): New struct typedef.
5930 (Icf::Reloc_info_list): New typedef.
5931 (Icf::symbol_reloc_list): Delete method.
5932 (Icf::addend_reloc_list): Delete method.
5933 (Icf::section_reloc_list): Delete method.
5934 (Icf::reloc_info_list): New method.
5935 (Icf::reloc_info_list_): New member.
5937 2010-02-19 Doug Kwan <dougkwan@google.com>
5939 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
5940 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
5941 * arm.cc (Arm_relocation_functions): New forward declaration.
5942 (Target_arm::Target_arm): Initialize new data members
5943 got_mod_index_offset_ and tls_base_symbol_defined_.
5944 (Target_arm::Relocate::relocate_tls): New method.
5945 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
5946 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
5948 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
5949 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
5950 (Target_arm::got_mod_index_offset_,
5951 Target_arm::tls_base_symbol_defined_): New data members.
5952 (Target_arm::Scan::local, Target::Scan::global,
5953 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
5956 2010-02-18 Doug Kwan <dougkwan@google.com>
5958 * arm.cc (Arm_relobj::find_linked_text_section): New method.
5959 (Arm_relobj::make_exidx_input_section): Pass section index of linked
5960 text section as a parameter becuase some broken tools may not set
5961 the link in section header.
5962 (Target_arm::has_got_section): New method.
5963 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
5964 without any mapping symbol as data only. Remove warning.
5965 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
5966 link in its section header, try to discover the link by inspecting the
5967 REL31 relocation at the beginning of the section.
5968 (Target_arm::Scan::check_non_pic): Report name of offending relocation
5970 (Target_arm::Scan::global): Treat any reference to the symbol
5971 _GLOBAL_OFFSET_TABLE_ as a GOT access.
5973 2010-02-12 Sriraman Tallam <tmsriram@google.com>
5975 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
5976 (Scan::global_reloc_may_be_function_pointer): New function.
5977 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5978 (Scan::global_reloc_may_be_function_pointer): New function.
5979 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5980 (Scan::global_reloc_may_be_function_pointer): New function.
5981 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
5982 (Scan::global_reloc_may_be_function_pointer): New function.
5983 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
5984 (Scan::global_reloc_may_be_function_pointer): New function.
5985 (Scan::possible_function_pointer_reloc): New function.
5986 (Target_x86_64::can_check_for_function_pointers): New function.
5987 * gc.h (gc_process_relocs): Scan relocation types to determine if
5988 function pointers were taken for targets that support it.
5989 * icf.cc (Icf::find_identical_sections): Include functions for
5990 folding in safe ICF whose pointer is not taken.
5991 * icf.h (Secn_fptr_taken_set): New typedef.
5992 (fptr_section_id_): New member.
5993 (section_has_function_pointers): New function.
5994 (set_section_has_function_pointers): New function.
5995 (check_section_for_function_pointers): New function.
5996 * options.h: Fix comment for safe ICF option.
5997 * target.h (can_check_for_function_pointers): New function.
5998 * testsuite/Makefile.am: Add icf_safe_so_test test case.
5999 Modify icf_safe_test for X86-64.
6000 * testsuite/Makefile.in: Regenerate.
6001 * testsuite/icf_safe_so_test.cc: New file.
6002 * testsuite/icf_safe_so_test.sh: New file.
6003 * testsuite/icf_safe_test.cc (kept_func_3): New function.
6004 (main): Change to take pointer to function kept_func_3.
6005 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
6006 folding is done correctly for X86-64.
6008 2010-02-12 David S. Miller <davem@davemloft.net>
6010 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
6011 is_symbolless parameter.
6012 (Output_reloc<SHT_REL>::is_symbolless): New.
6013 (Output_reloc<SHT_REL>::is_symbolless_): New.
6014 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
6015 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
6016 (Output_reloc<SHT_RELA>::is_symbolless): New.
6017 (Output_data_reloc::add_global): Handle is_symbolless.
6018 (Output_data_reloc::add_global_relative): Likewise.
6019 (Output_data_reloc::add_local): Likewise.
6020 (Output_data_reloc::add_local_relative): Likewise.
6021 (Output_data_reloc::add_symbolless_global_addend): New.
6022 (Output_data_reloc::add_symbolless_local_addend): New.
6023 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
6025 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
6026 instead of ->is_relative_
6027 (Output_reloc::write): Likewise.
6028 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
6029 (Output_reloc::write_rel): Simplify.
6031 * sparc.cc (Target_sparc::Scan::local): Use
6032 ->add_symbolless_local_addend as needed.
6033 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
6034 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
6035 based upon relocation offset.
6037 2010-02-11 Doug Kwan <dougkwan@google.com>
6039 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
6040 (Target_arm::Scan::global): Ditto. Also remove a comment before the
6041 beginning of function.
6042 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
6043 and MOVT_ABS relocations. Those are non issued in scanning. Fix
6044 parameter is_32bit in calls to should_apply_static_reloc.
6045 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
6046 (check_DATA): Add arm_abs_global.stdout.
6047 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
6048 arm_abs_global.stdout): New rules.
6049 (MOSTLLYCLEANFILES): Add arm_abs_global
6050 * Makefile.in: Regenerate.
6051 * testsuite/arm_abs_global.s: New file.
6052 * testsuite/arm_abs_global.sh: Ditto.
6053 * testsuite/arm_abs_lib.s: Ditto.
6055 2010-02-11 Ian Lance Taylor <iant@google.com>
6057 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
6059 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
6060 Allocate_commons_task first.
6061 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
6062 task, rather than symtab_lock_.
6063 (Gc_process_relocs::~Gc_process_relocs): New function.
6064 (Gc_process_relocs::is_runnable): Check this_blocker_.
6065 (Gc_process_relocs::locks): Use next_blocker_ rather than
6067 (Scan_relocs::~Scan_relocs): New function.
6068 (Scan_relocs::is_runnable): Check this_blocker_ rather than
6070 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
6072 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
6073 fields. Add this_blocker_ and next_blocker_ fields. Adjust
6074 constructor accordingly.
6075 (class Gc_process_relocs): Likewise.
6076 (class Scan_relocs): Likewise.
6077 * common.h (class Allocate_commons_task): Remove symtab_lock_
6078 field, and corresponding constructor parameter.
6079 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
6081 (Allocate_commons_task::locks): Likewise.
6083 2010-02-11 Ian Lance Taylor <iant@google.com>
6085 * gold-threads.h (class Once): Define.
6086 (class Initialize_lock): Rewrite as child of Once.
6087 * gold-threads.cc (class Once_initialize): Define.
6088 (once_pointer_control): New static variable.
6089 (once_pointer, once_arg): New static variables.
6090 (c_run_once): New static function.
6091 (Once::Once, Once::run_once, Once::internal_run): New functions.
6092 (class Initialize_lock_once): Remove.
6093 (initialize_lock_control): Remove.
6094 (initialize_lock_pointer): Remove.
6095 (initialize_lock_once): Remove.
6096 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
6097 (Initialize_lock::initialize): Rewrite.
6098 (Initialize_lock::do_run_once): New function.
6099 * archive.cc (Archive::interpret_header): Only clear name if it is
6101 * fileread.cc: Include "gold-threads.h"
6102 (file_counts_lock): New static variable.
6103 (file_counts_initialize_lock): Likewise.
6104 (File_read::release): Only increment counts when using --stats.
6105 Use a lock around the increment.
6106 * parameters.cc (class Set_parameters_target_once): Define.
6107 (set_parameters_target_once): New static variable.
6108 (Parameters::Parameters): Move here from parameters.h.
6109 (Parameters::set_target): Rewrite.
6110 (Parameters::set_target_once): New function.
6111 (Parameters::clear_target): Move here and rewrite.
6112 * parameters.h (class Parameters): Update declarations. Add
6113 set_parameters_target_once_ field.
6114 (Parameters::Parameters): Move to parameters.cc.
6115 (Parameters::clear_target): Likewise.
6116 * readsyms.cc (Read_symbols::do_group): Create a Start_group
6118 (Start_group::~Start_group): New function.
6119 (Start_group::is_runnable): New function.
6120 (Start_group::locks, Start_group::run): New functions.
6121 (Finish_group::run): Change saw_undefined to size_t.
6122 * readsyms.h (class Start_group): Define.
6123 (class Finish_group): Change saw_undefined_ field to size_t.
6124 (Finish_group::Finish_group): Remove saw_undefined and
6125 this_blocker parameters. Change all callers.
6126 (Finish_group::set_saw_undefined): New function.
6127 (Finish_group::set_blocker): New function.
6128 * symtab.h (class Symbol_table): Change saw_undefined to return
6129 size_t. Change saw_undefined_ field to size_t.
6130 * target-select.cc (Set_target_once::do_run_once): New function.
6131 (Target_selector::Target_selector): Initialize set_target_once_
6132 field. Don't initialize lock_ and initialize_lock_ fields.
6133 (Target_selector::instantiate_target): Rewrite.
6134 (Target_selector::set_target): New function.
6135 * target-select.h (class Set_target_once): Define.
6136 (class Target_selector): Update declarations. Make
6137 Set_target_once a friend. Remove lock_ and initialize_lock_
6138 fields. Add set_target_once_ field.
6140 2010-02-10 Ian Lance Taylor <iant@google.com>
6142 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
6144 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
6145 (queue_middle_tasks): Add all blockers before queueing any tasks.
6146 (queue_final_tasks): Likewise.
6147 * token.h (Task_token::add_blockers): New function.
6148 * object.h (Input_objects::number_of_relobjs): New function.
6150 2010-02-10 Ian Lance Taylor <iant@google.com>
6152 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
6153 shared, not if not position independent.
6154 * x86_64.cc (Relocate::relocate_tls): Likewise.
6155 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
6156 (tls_pie_pic_test): New target.
6157 * testsuite/Makefile.in: Rebuild.
6159 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
6160 (tls_test_main_pie.o, tls_test_pie.o): New targets.
6161 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
6162 * testsuite/Makefile.in: Rebuild.
6164 2010-02-09 David S. Miller <davem@davemloft.net>
6166 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
6167 R_SPARC_RELATIVE using ->add_local_relative().
6168 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
6170 * output.h (Output_data_dynamic::add_section_size): New method
6171 that takes two Output_data objects.
6172 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
6173 entry param. Handle it in initializers.
6174 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
6175 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
6176 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
6178 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
6179 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
6180 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
6181 for dynrel_includes_plt.
6182 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6183 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6184 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
6186 (Target_sparc::do_finalize_sections): Update to pass true for
6187 dynrel_includes_plt.
6188 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
6189 output before .rela.plt
6190 (Target_powerpc::do_finalize_sections): Update to pass true for
6191 dynrel_includes_plt when 32-bit.
6193 2010-02-08 Doug Kwan <dougkwan@google.com>
6195 * arm.cc (Arm_relobj::simple_input_section_output_address): New
6197 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
6198 Arm_relobj::scan_section_for_cortex_a8_stubs,
6199 Arm_relobj::do_relocation_section): Instead of calling
6200 Output_section::output_address, use faster
6201 Arm_relobj::simple_input_section_output_address.
6203 2010-02-08 David S. Miller <davem@davemloft.net>
6205 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
6206 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
6207 relocation helper function.
6209 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
6210 just like R_SPARC_GOT{10,13,22}.
6211 (Target_sparc::Scan::local): Likewise.
6212 (Target_sparc::Relocate:relocate): Likewise.
6214 2010-02-06 Ian Lance Taylor <iant@google.com>
6216 * configure.ac: Rewrite targetobjs duplicate removal code to use
6217 only shell constructs.
6218 * configure: Rebuild.
6220 2010-02-05 Doug Kwan <dougkwan@google.com>
6223 * arm.cc (Arm_relobj::section_is_scannable): New method.
6224 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
6225 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
6227 2010-02-04 Doug Kwan <dougkwan@google.com>
6230 * arm-reloc-property.cc (cstdio): Include.
6231 * configure.ac (targetobjs): Remove duplicates.
6232 * configure: Regenerate.
6233 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
6234 big and little endian version for a given address size.
6236 2010-02-03 Doug Kwan <dougkwan@google.com>
6238 * arm-reloc-property.cc
6239 (Arm_reloc_property_table::reloc_name_in_error_message): New method
6241 * arm-reloc-property.h
6242 (Arm_reloc_property_table::get_implemented_static_reloc_property):
6243 New method definition.
6244 (Arm_reloc_property_table::reloc_name_in_error_message): New method
6246 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
6248 (GOT_PREL): Change implemented to Y.
6249 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
6250 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
6251 (Arm_relocate_functions::movw_abs_nc): Remove method.
6252 (Arm_relocate_functions::movt_abs): Ditto.
6253 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
6254 (Arm_relocate_functions::thm_movt_abs): Ditto.
6255 (Arm_relocate_functions::movw_rel_nc): Ditto.
6256 (Arm_relocate_functions::movw_rel): Ditto.
6257 (Arm_relocate_functions::movt_rel): Ditto.
6258 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
6259 (Arm_relocate_functions:thm_movw_rel): Ditto.
6260 (Arm_relocate_functions:thm_movt_rel): Ditto.
6261 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
6262 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
6263 New method definitions.
6264 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
6265 (Arm_relocation_functions::arm_grp_ldr): Ditto.
6266 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
6267 (Arm_relocation_functions::arm_grp_ldc): Ditto.
6268 (Target_arm::Relocate::relocate): Check for non-static or
6269 unimplemented relocation code and exit early. Change calls to
6270 Target_arm::reloc_uses_thumb_bit and
6271 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
6272 instead. Refactor code to handle similar relocations to increase
6273 code sharing. Remove check for unsupported relocation code in switch
6275 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
6276 relocation property table to find out size. Change error message to
6277 print out the name of a relocation code instead of the numeric value.
6278 (Target_arm::scan_reloc_for_stub): Use relocation property table
6279 instead of calling Target_arm::reloc_uses_thumb_bit().
6281 2010-02-02 Doug Kwan <dougkwan@google.com>
6283 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
6284 types of relaxed input section.
6286 2010-02-02 Doug Kwan <dougkwan@google.com>
6288 * Makefile.am (HFILES): Add arm-reloc-property.h.
6290 (TARGETSOURCES): Add arm-reloc-property.cc
6291 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
6292 (libgold_a_SOURCES): $(DEFFILES)
6293 * Makefile.in: Regenerate.
6294 * arm-reloc-property.cc: New file.
6295 * arm-reloc-property.h: New file.
6296 * arm-reloc.def: New file.
6297 * arm.cc: Update comments.
6298 (arm-reloc-property.h): New included header.
6299 (arm_reloc_property_table): New global variable.
6300 (Target_arm::do_select_as_default_target): New method definition.
6301 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
6302 arm-reloc-property to targ_extra_obj.
6303 * parameters.cc (set_parameters_target): Call
6304 Target::select_as_default_target().
6305 * target.h (Target::select_as_default_target): New method definition.
6306 (Target::do_select_as_default_target): Same.
6308 2010-02-01 Doug Kwan <dougkwan@google.com>
6310 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
6311 first_output_text_section_.
6312 (Arm_exidx_fixup::first_output_text_section): New method definition.
6313 (Arm_exidx_fixup::first_output_text_section_): New data member.
6314 (Arm_exidx_fixup::process_exidx_section): Record the first text
6315 output section seen.
6316 (Arm_output_section::fix_exidx_coverage): Set correct linked section
6317 and entsize in output section header.
6319 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6321 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
6322 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
6323 (Arm_relocate_functions::thm_alu11): New Method.
6324 (Arm_relocate_functions::thm_pc8): New Method.
6325 (Arm_relocate_functions::thm_pc12): New Method.
6326 (Target_arm::Scan::local): Handle the relocations.
6327 (Target_arm::Scan::global): Likewise.
6328 (Target_arm::Relocate::relocate): Likewise.
6329 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6331 2010-01-29 Doug Kwan <dougkwan@google.com>
6333 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
6334 of relocation types as ld.
6336 2010-01-29 Doug Kwan <dougkwan@google.com>
6338 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
6340 (Arm_relocate_functions::thumb_branch_common): Ditto.
6341 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
6342 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
6343 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
6344 Arm_relocate_functions::jump24): Remove.
6345 (Target_arm::Relocate::relocate): Adjust code to call
6346 Arm_relocation_functions::arm_branch_common and
6347 Arm_relocation_functions::thumb_branch_common instead of their removed
6348 wrappers. Merge switch-cases together to reduce source code size.
6350 2010-01-29 Doug Kwan <dougkwan@google.com>
6352 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
6353 output_local_symbol_count_needs_update_.
6354 (Arm_relobj::output_local_symbol_count_needs_update,
6355 Arm_relobj::set_output_local_symbol_count_needs_update,
6356 Arm_relobj::update_output_local_symbol_count): New methods.
6357 (Arm_relobj::output_local_symbol_count_needs_update_): New data
6359 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
6360 of pointed function as in a R_ARM_PREL31 relocation.
6361 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
6362 for output local symbol count updating.
6363 (Target_arm::do_relax): Update output local symbol counts in objects
6365 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
6367 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6369 * arm.cc: Added support for the ARM relocations:
6370 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
6371 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
6372 (Arm_relocate_functions::movw_rel_nc): Renamed (was
6374 (Arm_relocate_functions::movw_rel): New method.
6375 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
6376 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
6378 (Arm_relocate_functions::thm_movw_rel): New method.
6379 (Arm_relocate_functions::thm_movt_rel): Renamed (was
6381 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
6383 (Target_arm::Scan::global): Likewise.
6384 (Target_arm::Relocate::relocate): Likewise.
6385 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6388 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6390 * arm.cc: Added support for ARM group relocations.
6391 (Target_arm::reloc_needs_sym_origin): New method.
6392 (Arm_relocate_functions::calc_grp_kn): New method.
6393 (Arm_relocate_functions::calc_grp_residual): New method.
6394 (Arm_relocate_functions::calc_grp_gn): New method.
6395 (Arm_relocate_functions::arm_grp_alu): New Method.
6396 (Arm_relocate_functions::arm_grp_ldr): New Method.
6397 (Arm_relocate_functions::arm_grp_ldrs): New Method.
6398 (Arm_relocate_functions::arm_grp_ldc): New Method.
6399 (Target_arm::Scan::local): Handle the ARM group relocations.
6400 (Target_arm::Scan::global): Likewise.
6401 (Target_arm::Relocate::relocate): Likewise.
6402 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6405 2010-01-26 Doug Kwan <dougkwan@google.com>
6407 * arm.cc (set): Include.
6408 (class Arm_exidx_fixup): Change type of last_input_section_ to const
6410 (Arm_output_section::Text_section_list): New type.
6411 (Arm_output_section::append_text_sections_to_list): New method.
6412 (Arm_output_section::fix_exidx_coverage): Ditto.
6413 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
6414 (Arm_relobj::convert_input_section_to_relaxed_section): Use
6415 Relobj::set_section_offset() instead of
6416 Sized_relobj::invalidate_section_offset().
6417 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
6418 parameter for section headers. Ignore relocation sections for
6419 unallocated sections and EXIDX sections.
6420 (Target_arm::fix_exidx_coverage): New method.
6421 (Target_arm::output_section_address_less_than): New type.
6422 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
6423 linked text section instead of the EXIDX section.
6424 (Arm_output_section::create_stub_group): Add an assertion to check
6425 that this is not an EXIDX output section.
6426 (Arm_output_section::append_text_sections_to_list): New method.
6427 (Arm_output_section::fix_exidx_coverage): Ditto.
6428 (Arm_relobj::scan_sections_for_stubs): Adjust call to
6429 Arm_relobj::section_needs_reloc_stub_scanning.
6430 (Target_arm::do_relax): Fix EXIDX output section coverage in the
6432 (Target_arm::fix_exidx_coverage): New method.
6433 * object.h (Relobj::set_output_section): New method.
6434 (Sized_relobj::invalidate_section_offset): Remove method.
6435 (Sized_relobj::do_invalidate_section_offset): Remove method.
6436 (Sized_relobj::do_set_section_offset): Handle offset value -1.
6438 2010-01-25 Doug Kwan <dougkwan@google.com>
6440 * arm.cc (Arm_exidx_merged_section::do_output_offset):
6441 Fix warning due to signed and unsigned comparison on a 32-bit host.
6443 2010-01-22 Doug Kwan <dougkwan@google.com>
6445 * arm.cc (Target_arm::do_relax): Record an output section for section
6446 offset adjustment it contains any stub table that has changed.
6447 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
6448 offsets in an output section if necessary.
6449 * output.cc (Output_section::Output_section): Initialize
6450 section_offsets_need_adjustments_.
6451 (Output_section::add_input_section_for_script): Renamed to
6452 Output_section::add_simple_input_section.
6453 (Output_section::save_states): Add a comment.
6454 (Output_section::discard_states): New method defintion.
6455 (Output_section::adjust_section_offsets): Same.
6456 * output.h (Output_section::add_input_section_for_script): Renamed to
6457 Output_section::add_simple_input_section.
6458 (Output_section::discard_states): New method declaration.
6459 (Output_section::adjust_section_offsets): Same.
6460 (Output_section::section_offsets_need_adjustment,
6461 Output_section::set_section_offsets_need_adjustment): New method
6463 (Output_section::section_offsets_need_adjustment_): New data member.
6464 * script-sections.cc
6465 (Output_section_element_input::set_section_address): Adjust code for
6466 renaming of Output_section::add_input_section_for_script.
6467 (Orphan_output_section::set_section_address): Same.
6469 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6471 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
6472 Fix_v4bx enum values .
6473 * gold/options.h (General_options): New option definitions.
6474 (General_options::fix_v4bx): New method.
6475 (General_options::Fix_v4bx): New enum.
6476 * gold/options.cc (General_options::parse_fix_v4bx): New method.
6477 (General_options::parse_fix_v4bx_interworking): New method.
6479 2010-01-22 Doug Kwan <dougkwan@google.com>
6481 * arm.cc (Arm_exidx_fixup): New class.
6483 2010-01-21 Doug Kwan <dougkwan@google.com>
6485 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
6487 (Arm_exidx_section_offset_map): New type.
6489 2010-01-21 Doug Kwan <dougkwan@google.com>
6491 * arm.cc (Arm_exidx_input_section): New class.
6492 (Arm_relobj::exidx_input_section_by_link,
6493 Arm_relobj::exidx_input_section_by_shndx,
6494 Arm_relobj::make_exidx_input_section): New methods.
6495 (read_arm_attributes_section): Remove.
6496 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
6497 information about them.
6498 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
6501 2010-01-20 Doug Kwan <dougkwan@google.com>
6503 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
6504 Input_section_specifier to Section_id.
6505 (Target_arm::new_arm_input_section: Adjust code for change of key
6507 (Target_arm::find_arm_input_section): Ditto.
6508 * gc.h (object.h): Include for Section_id nand Section_id_hash.
6509 (Section_id): Remove.
6510 (Garbage_collection::Section_id_hash): Remove.
6511 * icf.h (object.h): Include for Section_id nand Section_id_hash.
6512 (Section_id): Remove.
6513 (Icf::Section_id_hash): Remove.
6514 * object.h (Section_id, Const_section_id, Section_id_hash,
6515 Const_section_id_hash): New type definitions.
6516 * output.cc (Output_section::add_relaxed_input_section): Change to
6517 use Const_section_id instead of Input_section_specifier as key type.
6518 (Output_section::add_merge_input_section): Ditto.
6519 (Output_section::build_relaxation_map): Change to use Section_id
6520 instead of Input_section_specifier as key type.
6521 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6523 (Output_section::convert_input_sections_to_relaxed_sections): Change
6524 to use Const_section_id instead of Input_section_specifier as key type.
6525 (Output_section::find_merge_section): Ditto.
6526 (Output_section::find_relaxed_input_section): Ditto.
6527 * output.h (Input_section_specifier): Remove class.
6528 (Output_section::Output_section_data_by_input_section_map): Change
6529 key type to Const_section_id.
6530 (Output_section::Output_relaxed_input_section_by_input_section_map):
6532 (Output_section::Relaxation_map): Change key type to Section_id.
6534 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6536 * gold/arm.cc: Added support for R_ARM_V4BX relocation
6537 (class Arm_v4bx_stub): New class.
6538 (DEF_STUBS): Updated definition to support v4_veneer_bx.
6539 (Stub_factory::make_arm_v4bx_stub): New method.
6540 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
6541 (Stub_table::empty): Handle v4bx stubs.
6542 (Stub_table::add_arm_v4bx_stub): New method.
6543 (Stub_table::find_arm_v4bx_stub): New method.
6544 (Arm_relocate_functions::v4bx): New method.
6545 (Target_arm::fix_v4bx): New method.
6546 (Target_arm::Target_arm): Handle R_ARM_V4BX.
6547 (Stub_table::relocate_stubs): Likewise.
6548 (Stub_table::do_write): Likewise.
6549 (Stub_table::update_data_size_and_addralign): Likewise.
6550 (Stub_table::finalize_stubs): Likewise.
6551 (Target_arm::Scan::local): Likewise.
6552 (Target_arm::Scan::global): Likewise.
6553 (Target_arm::do_finalize_sections): Likewise.
6554 (Target_arm::Relocate::relocate): Likewise.
6555 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6557 (Target_arm::scan_reloc_for_stub): Likewise.
6558 (Target_arm::scan_reloc_section_for_stubs): Likewise.
6560 2010-01-19 Ian Lance Taylor <iant@google.com>
6562 * output.cc (Output_section_headers::do_sized_write): Write large
6563 segment count to sh_info field.
6564 (Output_file_header::do_sized_write): For large segment count,
6565 write PN_XNUM to e_phnum field.
6567 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6569 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
6570 (Arm_relocate_functions::thm_jump8): New function.
6571 (Arm_relocate_functions::thm_jump11): New function.
6572 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
6574 (Target_arm::Scan::global): Likewise.
6575 (Target_arm::Relocate::relocate): Likewise.
6576 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6579 2010-01-14 Doug Kwan <dougkwan@google.com>
6581 * arm.cc (map, utility): Include headers.
6582 (Target_arm::apply_cortex_a8_workaround): New method.
6583 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
6584 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
6585 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
6586 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
6587 the --[no-]fix-cortex-a8 command line options.
6588 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
6589 (Target_arm::relocate_stub): Use addend in instruction template.
6590 * options.h (DEFINE_bool): Set the user-set flag.
6591 (General_options): Add --[no-]-fix-cortex options.
6592 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
6593 : Update fast look-up map after conversion.
6595 2010-01-14 Sriraman Tallam <tmsriram@google.com>
6597 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6598 in the first pass of do_layout.
6600 2010-01-13 Doug Kwan <dougkwan@google.com>
6602 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6603 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6604 apparent compiler problem of not folding static constant integral
6605 data members of elfcpp::Elf_sizes<32>.
6607 2010-01-13 Doug Kwan <dougkwan@google.com>
6609 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6610 Arm_relobj::section_needs_cortex_a8_stub_scanning,
6611 Arm_relobj::scan_section_for_cortex_a8_erratum,
6612 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
6613 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
6614 sections to scan for relocation stubs into a new method
6615 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
6616 relocation and Cortex-A8 stub scanning.
6617 (Target_arm::do_relax): Force stubs to be after stubbed sections
6618 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
6619 the beginning of a new relaxation pass. Update a comment.
6620 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
6622 2010-01-12 Ian Lance Taylor <iant@google.com>
6624 * target-reloc.h (visibility_error): New inline function.
6625 (relocate_section): Call visibility_error.
6626 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6627 (MOSTLYCLEANFILES): Likewise.
6628 (protected_4_pic.o, protected_3.err): New targets.
6629 * testsuite/protected_4.cc: New file.
6631 2010-01-12 Doug Kwan <dougkwan@google.com>
6633 * arm.cc (Cortex_a8_reloc): New class.
6634 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6635 and cortex_a8_relocs_info_.
6636 (Target_arm::fix_cortex_a8): New method definition.
6637 (Target_arm::Cortex_a8_relocs_info): New type.
6638 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6639 New data member declarations.
6640 (Target_arm::scan_reloc_for_stub): Record information about
6641 relocations for THUMB branches that might be exempted from the
6642 Cortex-A8 workaround.
6643 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
6644 at the beginning of a relaxation pass.
6646 2010-01-12 Doug Kwan <dougkwan@google.com>
6648 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
6649 (Arm_relobj::Mapping_symbol_position,
6650 Arm_reloj::Mapping_symbol_position_less,
6651 Arm_relobj::Mapping_symbols_info): New types.
6652 (Target_arm::is_mapping_symbol_name): New method definition.
6653 (Arm_relobj::do_count_local_symbols): Save information about mapping
6656 2010-01-11 Doug Kwan <dougkwan@google.com>
6658 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
6659 Arm_relocate_functions::thumb32_branch_upper,
6660 Arm_relocate_functions::thumb32_branch_lower,
6661 Arm_relocate_functions::thumb32_cond_branch_offset,
6662 Arm_relocate_functions::thumb32_cond_branch_upper,
6663 Arm_relocate_functions::thumb32_cond_branch_lower,
6664 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
6665 branch offset encoding.
6666 (Arm_relocate_functions::thumb_branch_common): Use new branch
6667 offset encoding methods to avoid code duplication.
6668 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
6669 (Stub_addend_reader::operator()): Use new branch encoding method
6670 to avoid code duplication.
6672 2010-01-11 Doug Kwan <dougkwan@google.com>
6674 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
6675 (Target_arm::do_finalize_sections): Define special EXIDX section
6676 symbols only if referenced.
6677 * gc.h (Garbage_collection::add_reference): New method.
6678 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
6681 2010-01-11 Ian Lance Taylor <iant@google.com>
6683 * script.cc (Version_script_info::build_expression_list_lookup):
6684 Change complaing about duplicate wildcard match from error to
6687 * script.cc (class Lazy_demangler): Recreate--revert part of patch
6689 (Version_script_info::Version_script_info): Initialize globs_,
6690 default_version_, default_is_global_, and exact_. Don't
6691 initialize globals_ or locals_.
6692 (Version_script_info::build_lookup_tables): Build local symbols
6694 (Version_script_info::unquote): New function.
6695 (Version_script_info::add_exact_match): New function.
6696 (Version_script_info::build_expression_list_lookup): Remove lookup
6697 parameter. Add is_global parameter. Change all callers. Handle
6698 wildcard pattern specially. Unquote pattern. Call
6700 (Version_script_info::get_name_to_match): New function.
6701 (Version_script_info::get_symbol_version): New function.
6702 (Version_script_info::get_symbol_version_helper): Remove.
6703 (Version_script_info::check_unmatched_names): Call unquote.
6704 * script.h (class Version_script_info): Change get_symbol_version
6705 to be non-inline and add is_global parameter; change all callers.
6706 Rewrite symbol_is_local. Update declarations. Define struct
6707 Version_tree_match, Exact, Globs. Don't define struct Lookup.
6708 Remove globals_ and locals_ members. Add exact_, globs_,
6709 default_version_, is_global_.
6710 (Version_script_info::Glob): Remove pattern, add expression and
6711 is_global. Update constructor. Change all callers.
6712 * dynobj.cc (Versions::finalize): Mark the version symbol as the
6714 (Versions::symbol_section_contents): If a symbol is undefined, or
6715 defined in a dynamic object, set the version index to
6717 * symtab.cc (Symbol_table::add_from_relobj): Don't call
6719 (Symbol_table::add_from_pluginobj): Likewise.
6720 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
6722 2010-01-11 Doug Kwan <dougkwan@google.com>
6724 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
6725 (incremental_dump_LDADD): Add linking option for libintl.
6726 * Makefile.in: Regenerate.
6728 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
6731 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
6733 * testsuite/Makefile.in: Regenerated.
6735 2010-01-10 Doug Kwan <dougkwan@google.com>
6737 * options.h (DEFINE_var): Use parentheses around argument varname__
6738 in macro body to avoid any unintended subsequent substitutions.
6740 2010-01-10 Ian Lance Taylor <iant@google.com>
6742 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
6743 candidates before doing symbol resolution.
6745 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
6746 ODR candidates if only one is weak.
6748 2010-01-08 Ian Lance Taylor <iant@google.com>
6750 * script.cc (Version_script_info::build_expression_list_lookup):
6751 Don't warn about ambiguous version, just record the ambiguity.
6752 (Version_script_info::get_symbol_version_helper): Give error if
6753 version is ambiguous.
6755 2010-01-08 Doug Kwan <dougkwan@google.com>
6757 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
6758 prev_data_size_ and prev_addralign_. Remove initializer for
6759 deleted data member has_been_changed_.
6760 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
6761 to determine if the table is empty.
6762 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
6764 (Stub_table::add_reloc_stub): Define method in class definition
6765 instead of just declaring it there.
6766 (Stub_table::add_cortex_a8_stub): New method definition.
6767 (Stub_table::update_data_size_and_addralign): Ditto.
6768 (Stub_table::finalize_stubs): Ditto.
6769 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
6770 (Stub_table::do_addralign_): Return address alignment in the
6771 (Stub_table::do_reset_address_and_file_offset): Define method in
6772 class definition instead of declaring it there. Set current data
6773 size to be the data size of the previous pass.
6774 (Stub_table::set_final_data_size): Use current data size as the
6776 (Stub_table::relocate_stub): Change parameter type of stub from
6777 Reloc_stub pointer to Stub pointer.
6778 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
6779 (Stub_table::Cortex_a8_stub_list): New typedef.
6780 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
6781 Stub_table::prev_addralign_): New data member.
6782 (Arm_relobj::Arm_relobj): Initialize data member
6783 section_has_cortex_a8_workaround_.
6784 (Arm_relobj::section_has_cortex_a8_workaround,
6785 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
6787 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
6789 (Target_arm::relocate_stub): Change parameter type of stub from
6790 Reloc_stub pointer to Stub pointer.
6791 (Insn_template::size, Insn_template::alignment): Handle
6792 THUMB16_SPECIAL_TYPE.
6793 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
6794 Stub_table::update_data_size_and_addralign,
6795 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
6797 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
6798 (Stub_table::do_write): Ditto.
6799 (Target_arm::do_relax): Adjust code for changes in Stub_table.
6801 2010-01-08 Ian Lance Taylor <iant@google.com>
6804 * symtab.h (class Symbol): Remove fields is_target_special_ and
6805 has_plt_offset_. Add field is_defined_in_discarded_section_.
6806 (Symbol::is_defined_in_discarded_section): New function.
6807 (Symbol::set_is_defined_in_discarded_section): New function.
6808 (Symbol::has_plt_offset): Rewrite.
6809 (Symbol::set_plt_offset): Verify that new offset is not -1U.
6810 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
6811 Don't initialize is_target_special_ or has_plt_offset_.
6812 Initialize is_defined_in_discarded_section_.
6813 (Symbol_table::add_from_relobj): If appropriate, set
6814 is_defined_in_discarded_section.
6815 * resolve.cc (Symbol::override_base_with_special): Don't test
6816 is_target_special_. Change has_plt_offset_ to has_plt_offset().
6817 * target-reloc.h (relocate_section): Do special handling for
6818 symbols defined in discarded sections for global symbols as well
6821 2010-01-08 Ian Lance Taylor <iant@google.com>
6823 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
6824 the SHT_SYMTAB case.
6826 2010-01-08 Ian Lance Taylor <iant@google.com>
6828 * object.cc (Sized_relobj::do_layout): Don't get confused if
6829 layout_eh_frame returns NULL.
6831 2010-01-08 Ian Lance Taylor <iant@google.com>
6834 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
6835 dynamic symbol table, use the normal symbol table.
6836 (Sized_dynobj::do_read_symbols): Remove assertion about type of
6839 2010-01-08 Ian Lance Taylor <iant@google.com>
6842 * layout.cc (Layout::include_section): Remove .gnu_debuglink
6845 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
6847 * version.cc (print_version): Change to "Copyright 2010".
6849 2010-01-08 Ian Lance Taylor <iant@google.com>
6853 * i386.cc (class Target_i386): Change return type of plt_section
6855 (class Output_data_plt_i386): Add tls_desc_rel_ field.
6856 (Output_data_plt_i386::Output_data_plt_i386): Initialize
6857 tls_desc_rel_ field.
6858 (Output_data_plt_i386::rel_tls_desc): New function.
6859 (Target_i386::rel_tls_desc_section): New function.
6860 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
6861 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
6862 R_386_TLS_DESC reloc in rel_tls_desc_section.
6863 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
6864 Define struct Tlsdesc_info.
6865 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
6866 (Target_x86_64::do_reloc_symbol_index): New function.
6867 (Target_x86_64::add_tlsdesc_info): New function.
6868 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
6869 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
6871 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
6873 (Output_data_plt_x86_64::rela_tlsdesc): New function.
6874 (Target_x86_64::rela_tlsdesc_section): New function.
6875 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
6877 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
6878 (Target_x86_64::do_reloc_addend): New function.
6879 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
6880 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
6881 declarations. Define TARGET_CODE. Add arg field to u1_ union.
6882 (Output_reloc::type): New function.
6883 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
6884 (Output_reloc::is_target_specific): New function.
6885 (Output_reloc::target_arg): New function.
6886 (class Output_reloc) [SHT_RELA]: Add four new constructors for
6887 absolute relocs and target specific relocs.
6888 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
6889 add_target_specific.
6890 (class Output_data_reloc) [SHT_RELA]: Likewise.
6891 * output.cc (Output_reloc::Output_reloc): Add four new versions
6892 for absolute relocs and target specific relocs.
6893 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
6894 (Output_reloc::get_symbol_index): Likewise.
6895 (Output_reloc::local_section_offset): Check that local_sym_index_
6896 is not TARGET_CODE or 0.
6897 (Output_reloc::symbol_value): Likewise.
6898 (Output_reloc::write) [SHT_RELA]: Call target for target specific
6900 * target.h (class Target): Add reloc_symbol_index and reloc_addend
6901 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
6903 * layout.cc (add_target_dynamic_tags): Use output section for
6904 DT_PLTRELSZ and DT_JMPREL.
6906 2010-01-07 Ian Lance Taylor <iant@google.com>
6909 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
6911 (class Output_data_reloc_generic): Define.
6912 (class Output_data_reloc_base): Change base class to
6913 Output_data_reloc_generic. Change add() method to call
6914 bump_relative_reloc_count for a relative reloc. Remove
6916 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
6918 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
6919 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
6921 * layout.h (class Layout): Update declaration.
6923 2010-01-07 Ian Lance Taylor <iant@google.com>
6925 * output.h (class Output_data): Add const version of
6926 output_section and do_output_section.
6927 (class Output_section_data): Add const version of
6929 (class Output_section): Likewise.
6930 * layout.cc (Layout::add_target_dynamic_tags): New function.
6931 * layout.h (class Layout): Update declarations.
6932 * arm.cc (Target_arm::do_finalize_sections): Use
6933 add_target_dynamic_tags.
6934 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6935 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6936 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6937 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6939 2010-01-07 Ian Lance Taylor <iant@google.com>
6942 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
6945 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
6946 Ian Lance Taylor <iant@google.com>
6949 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
6950 Xindex::read_symtab_xindex.
6952 2010-01-07 Doug Kwan <dougkwan@google.com>
6954 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
6955 (Insn_template::thumb16_bcond_insn): New method declaration.
6956 (Insn_template): Fix spelling.
6957 (Stub::thumb16_special): New method declaration.
6958 (Stub::do_write): Define virtual method which was previously pure
6960 (Stub::do_thumb16_special): New method declaration.
6961 (Stub::do_fixed_endian_write): New template member.
6962 (Reloc_stub::do_write): Remove.
6963 (Reloc_stub::do_fixed_endian_write): Remove.
6964 (Cortex_a8_stub): New class definition.
6965 (Stub_factory::make_cortex_a8_stub): New method definition.
6966 (Stub_factory::Stub_factory): Add missing static storage class
6967 qualifier for elf32_arm_stub_a8_veneer_blx.
6969 2010-01-07 Ian Lance Taylor <iant@google.com>
6972 * options.h (class General_options): Add --warn-unresolved-symbols
6973 and --error-unresolved-symbols.
6974 * errors.cc (Errors::undefined_symbol): Implement
6975 --warn-unresolved-symbols.
6977 * options.h (class General_options): Add -z text and -z textoff.
6978 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
6980 2010-01-06 Sriraman Tallam <tmsriram@google.com>
6982 * gc.h (Garbage_collection::Cident_section_map): New typedef.
6983 (Garbage_collection::cident_sections): New function.
6984 (Garbage_collection::add_cident_section): New function.
6985 (Garbage_collection::cident_sections_): New member.
6986 (gc_process_relocs): Add references to sections whose names are C
6988 * gold.h (cident_section_start_prefix): New constant.
6989 (cident_section_stop_prefix): New constant.
6990 (is_cident): New function.
6991 * layout.cc (Layout::define_section_symbols): Replace string constants
6992 with the newly defined constants.
6993 * object.cc (Sized_relobj::do_layout): Track sections whose names are
6995 * testsuite/Makefile.am: Add gc_orphan_section_test.
6996 * testsuite/Makefile.in: Regenerate.
6997 * testsuite/gc_orphan_section_test.cc: New file.
6998 * testsuite/gc_orphan_section_test.sh: New file.
7000 2010-01-06 Ian Lance Taylor <iant@google.com>
7003 * options.h (class General_options): Add --warn-shared-textrel.
7004 * layout.cc (Layout::finish_dynamic_section): Implement
7005 --warn-shared-textrel.
7008 * options.h (class General_options): Add --warn-multiple-gp.
7010 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7012 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
7013 $(THREADSLIB) and $(LIBDL).
7014 * Makefile.in: Rebuild.
7016 2010-01-06 Ian Lance Taylor <iant@google.com>
7019 * options.cc (General_options::parse_section_start): New function.
7020 (General_options::section_start): New function.
7021 (General_options::General_options): Initialize all members.
7022 * options.h: Include <map>
7023 (class General_options): Add --section-start. Add section_starts_
7025 * layout.cc (Layout::attach_allocated_section_to_segment): If
7026 --section-start was used, set the address of the segment. Remove
7027 local sort_sections.
7028 (Layout::relaxation_loop_body): If the address of the load segment
7029 has been set by --section-start, don't use it.
7030 * output.h (Output_segment::update_flags_for_output_section): New
7032 * output.cc (Output_segment::add_output_section): Call
7033 update_flags_for_output_section.
7035 2010-01-05 Ian Lance Taylor <iant@google.com>
7038 * options.h (class General_options): Add --undefined-version.
7039 * script.cc (struct Version_expression): Add was_matched_by_symbol
7041 (Version_script_info::matched_symbol): New function.
7042 (Version_script_info::get_symbol_version_helper): Call
7044 (Version_script_info::check_unmatched_names): New function.
7045 * script.h (class Version_script_info): Update declarations.
7046 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
7048 * options.h (class General_options): Use DEFINE_bool_alias for
7049 allow_multiple_definition.
7050 * resolve.cc (Symbol_table::should_override): Don't test
7051 allow_multiple_definition.
7054 * options.h (class General_options): Add --cref.
7055 * main.cc (main): Print cref table if --cref. Don't close mapfile
7056 until after printing cref table.
7057 * cref.cc: Include "symtab.h".
7058 (class Cref_inputs): Define Cref_table_compare and Cref_table.
7059 (Cref_table_compare::operator()): New function.
7060 (Cref_inputs::gather_cref): New function.
7061 (filecol): New static const.
7062 (Cref_inputs::print_cref): New function.
7063 (Cref::print_cref): New function.
7064 * cref.h: Include <cstdio>.
7065 (class Cref): Update declarations.
7066 * mapfile.h (Mapfile::file): New function.
7067 * object.h (class Object): Define Symbols. Declare virtual
7068 do_get_global_symbols.
7069 (Object::get_global_symbols): New function.
7070 * object.cc (Input_objects::add_object): Pass object to cref_ if
7072 (Input_objects::archive_start): Likewise.
7073 (Input_objects::archive_stop): Likewise.
7074 (Input_objects::print_cref): New function.
7075 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
7076 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
7078 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
7080 * plugin.h (class Sized_pluginobj): Update declarations.
7082 2010-01-05 Ian Lance Taylor <iant@google.com>
7084 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
7085 to is_default_version. Rename insdef to insdefault.
7086 (Symbol_table::add_from_relobj): Rename def to is_default_version
7087 and local to is_forced_local.
7088 (Symbol_table::add_from_pluginobj): Likewise.
7089 (Symbol_table::add_from_dynobj): Likewise.
7090 (Symbol_table::define_special_symbol): Rename insdef to
7093 2010-01-04 Ian Lance Taylor <iant@google.com>
7096 * options.h (class General_options): Add
7097 --allow-multiple-definition and -z muldefs.
7098 * resolve.cc (Symbol_table::should_override): Don't warn about a
7099 multiple symbol definition if --allow-multiple-definition or -z
7103 * options.h (class General_options): Add --add-needed and
7104 --copy-dt-needed-entries. Tweak --as-needed help entry.
7105 * object.cc (Input_objects::check_dynamic_dependencies): Give an
7106 error if --copy-dt-needed-entries aka --add-needed is used and
7107 would cause a change in behaviour.
7110 * options.h (class General_options): Add -G as a short version of
7111 --shared. Add no-op options -assert, -g, and -i.
7113 2010-01-04 Sriraman Tallam <tmsriram@google.com>
7115 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
7116 check for .text or .gnu.linkonce.t sections.
7117 * icf.cc (Icf::find_identical_sections): Ditto.
7118 Change the detection for mangled function name within the section
7120 * icf.h (is_section_foldable_candidate): New function.
7122 2009-12-30 Ian Lance Taylor <iant@google.com>
7125 * options.h (class General_options): Permit two dashes with
7126 --retain-symbols-file.
7128 2009-12-30 Ian Lance Taylor <iant@google.com>
7131 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
7132 don't put the file header and segment headers in the text
7136 * common.cc (Sort_commons::operator()): Stabilize sort when both
7138 (Symbol_table::do_allocate_commons_list): When allocating common
7139 symbols, skip a symbol which is no longer common.
7140 * symtab.h (Symbol::is_common): Test whether the symbol comes from
7141 an object before checking its type.
7142 * testsuite/common_test_2.c: New file.
7143 * testsuite/common_test_3.c: New file.
7144 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
7145 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
7146 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
7147 (common_test_2_pic.o, common_test_2.so): New targets.
7148 (common_test_3_pic.o, common_test_3.so): New targets.
7149 * testsuite/Makefile.in: Rebuild.
7152 * script.cc (read_input_script): If we see a new SECTIONS clause,
7153 and we have added an input section, give an error.
7154 * layout.h (class Layout): Add have_added_input_section function.
7155 Add have_added_input_section_ field.
7156 * layout.cc (Layout::Layout): Initialize
7157 have_added_input_section_.
7158 (Layout::layout): Set have_added_input_section_.
7159 (Layout::layout_eh_frame): Likewise.
7161 2009-12-30 Ian Lance Taylor <iant@google.com>
7164 * options.h (class General_options): Add --sort-common option.
7165 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
7166 * common.cc (Sort_common): Add sort_order parameter to
7167 constructor. Add sort_order_ field.
7168 (Sort_commons::operator): Check sort_order_.
7169 (Symbol_table::allocate_commons): Determine the sort order.
7170 (Symbol_table::do_allocate_commons): Add sort_order parameter.
7172 (Symbol_table::do_allocate_commons_list): Likewise.
7174 2009-12-30 Ian Lance Taylor <iant@google.com>
7177 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
7178 symbols from this object, don't change the visibility of an
7180 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
7182 2009-12-30 Ian Lance Taylor <iant@google.com>
7185 * script.h (class Version_script_info): Define Language enum.
7186 Update declarations. Define Glob, Exact, and Lookup types. Add
7187 new fields globals_, locals_, and is_finalized_.
7188 * script.cc: Various formatting fixes.
7189 (class Parser_closure): Change language_stack_ from a vector of
7190 std::string to one of Version_script_info::Language. Adjust all
7192 (class Lazy_demangler): Remove.
7193 (struct Version_expression): Change language from std::string to
7194 Version_script_info::Language.
7195 (Version_script_info::Version_script_info): New function.
7196 (Version_script_info::~Version_script_info): Don't call clear.
7197 (Version_script_info::finalize): New function.
7198 (Version_script_info::build_lookup_tables): New function.
7199 (Version_script_info::build_expression_list_lookup): New
7201 (Version_script_info::get_symbol_version_helper): Rewrite to use
7203 (Version_script_info::print_expression_list): Adjust to use
7204 Version_script_info::Language.
7205 (script_push_lex_into_version_mode): Check that the version script
7206 has not been finalized.
7207 (version_script_push_lang): Change language string to
7208 Version_script_info::Language.
7209 * options.cc (Command_line::version_script): New function.
7210 * options.h (class General_options): Add finalize_dynamic_list
7211 function. Change version_script from declaration to definition.
7212 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
7213 * testsuite/version_script.map: Remove duplicate def of foo.
7214 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
7216 * testsuite/Makefile.in: Rebuild.
7218 2009-12-30 Ian Lance Taylor <iant@google.com>
7221 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
7222 if the input symbol index is 0, make the output symbol index 0.
7224 2009-12-30 Ian Lance Taylor <iant@google.com>
7227 * options.h (class General_options): Add -x/--discard-all.
7228 * object.cc (Sized_relobj::do_count_local_symbols): Handle
7229 --discard-all. If the local symbol needs a dynamic entry, check
7230 that before handling --discard-locals.
7232 2009-12-30 Ian Lance Taylor <iant@google.com>
7235 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
7237 (Output_segment::add_output_section): Don't change the flags if
7241 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
7242 GNU hash table if they need a dynamic value. Otherwise, don't add
7243 them if they are defined in a dynamic object or are forced local.
7245 2009-12-29 Ian Lance Taylor <iant@google.com>
7248 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
7249 .gnu.hash table for a 32-bit target.
7252 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
7253 regular and a dynamic object only needs a dynamic symbol table
7254 entry if it is externally visible.
7257 * i386.cc (class Target_i386): Initialize global_offset_table_ in
7258 constructor. Add global_offset_table_ field.
7259 (Target_i386::got_section): Set global_offset_table_.
7260 (Target_i386::do_finalize_sections): Set global_offset_table_
7262 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
7263 in constructor. Add global_offset_table_ field.
7264 (Target_x86_64::got_section): Set global_offset_table_.
7265 (Target_x86_64::do_finalize_sections): Set global_offset_table_
7268 * layout.cc (Layout::Layout): Initialize increase_relro_.
7269 (Layout::get_output_section): Add is_relro, is_last_relro, and
7270 is_first_non_relro parameters. Change all callers.
7271 (Layout::choose_output_section): Likewise.
7272 (Layout::add_output_section_data): Likewise.
7273 (Layout::make_output_section): Likewise.
7274 (Layout::set_segment_offsets): Clear increase_relro when using a
7276 * layout.h (class Layout): Add increase_relro method. Add
7277 increase_relro_ field. Update declarations.
7278 * output.cc (Output_section::Output_section): Initialize
7279 is_last_relro_ and is_first_non_relro_.
7280 (Output_segment::add_output_section): Group relro sections is
7281 do_sort is true. Handle is_last_relro and is_first_non_relro.
7282 (Output_segment::maximum_alignment): Remove relro handling.
7283 (Output_segment::set_section_addresses): Add increase_relro
7284 parameter. Change all callers. Add initial alignment to align
7285 relro sections on separate page. Remove old relro handling.
7286 (Output_segment::set_section_list_addresses): Remove in_relro
7287 parameter. Change all callers.
7288 (Output_segment::set_offset): Add increase parameter. Change all
7289 callers. Remove old relro handling.
7290 * output.h (class Output_section): Add new methods: is_last_relro,
7291 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
7292 Add is_last_relro_ and is_first_non_relro_ fields.
7293 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
7294 Create separate .got.plt section. Call increase_relro.
7295 * x86_64.cc (Target_x86_64::got_section): Likewise.
7296 * testsuite/relro_script_test.t: Add .got.plt.
7299 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
7300 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
7301 (Layout::finalize): Call set_dynamic_symbol_size.
7302 (Layout::set_dynamic_symbol_size): New function.
7303 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
7304 set_dynamic_symbol_size.
7307 * output.h (class Output_section): Add is_entsize_zero_ field.
7308 * output.cc (Output_section::Output_section): Initialize
7310 (Output_section::set_entsize): If two different entsizes are
7311 requested, force it to zero.
7312 (Output_section::add_input_section): Set flags for .debug_str
7313 before updating section flags. Set entsize.
7314 (Output_section::update_flags_for_input_section): Set SHF_MERGE
7315 and SHF_STRING if all input sections have those flags.
7317 2009-12-29 Rafael Espindola <espindola@google.com>
7319 * main.cc (main): Fix the sys time reporting.
7320 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
7323 2009-12-29 Sriraman Tallam <tmsriram@google.com>
7325 * options.cc (General_options::parse_version): Allow -v to exit
7326 without an error if there is nothing to link.
7328 2009-12-29 Ian Lance Taylor <iant@google.com>
7330 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
7331 using a version of gcc before 4.1.
7332 * configure: Rebuild.
7334 2009-12-28 Chris Demetriou <cgd@google.com>
7336 * attributes.cc (Output_attributes_section_data::do_write): Use
7337 std::vector::front rather than std::vector::data.
7339 2009-12-28 Ian Lance Taylor <iant@google.com>
7341 * symtab.h (class Symbol_table): Add enum Defined.
7342 * resolve.cc (Symbol_table::should_override): Add defined
7343 parameter. Change all callers. Test whether object is NULL
7344 before calling a method on it.
7345 (Symbol_table::report_resolve_problem): Add defined parameter.
7347 (Symbol_table::should_override_with_special): Likewise.
7348 * symtab.cc (Symbol_table::define_in_output_data): Add defined
7349 parameter. Change all callers.
7350 (Symbol_table::do_define_in_output_data): Likewise.
7351 (Symbol_table::define_in_output_segment): Likewise.
7352 (Symbol_table::do_define_in_output_segment): Likewise.
7353 (Symbol_table::define_as_constant): Likewise.
7354 (Symbol_table::do_define_as_constant): Likewise.
7355 * script.h (class Symbol_assignment): Add is_defsym parameter to
7356 constructor; change all callers.
7357 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
7358 parameter. Change all callers. Add is_defsym_ field.
7359 (class Parser_closure): Add parsing_defsym parameter to
7360 constructor; change all callers. Add parsing_defsym accessor
7361 function. Add parsing_defsym_ field.
7363 2009-12-28 Ian Lance Taylor <iant@google.com>
7365 * gold.cc (queue_middle_tasks): Fix formatting.
7366 * object.cc (Relobj::is_section_name_included): Likewise.
7368 2009-12-23 Ian Lance Taylor <iant@google.com>
7370 * i386.cc (Target_i386::do_calls_non_split): Recognize
7371 -fsplit-stack prologue for a function with a static chain.
7372 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
7373 -fsplit-stack prologue when using %r11.
7375 2009-12-21 Sriraman Tallam <tmsriram@google.com>
7377 * options.cc (General_options::parse_version): Make -v continue and do
7378 the link like GNU ld does.
7380 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
7382 * Makefile.am (CCFILES): Add timer.cc.
7383 (HFILES): Add timer.h.
7384 * configure.ac: Check for sysconf and times.
7385 * main.cc: include timer.h.
7386 (main): Use Timer instead of get_run_time.
7389 * workqueue.cc: include timer.h.
7390 (Workqueue::find_and_run_task):
7391 Report user, sys and wall time.
7392 * Makefile.in: Regenerate.
7393 * config.in: Regenerate.
7394 * configure: Regenerate.
7396 2009-12-16 Doug Kwan <dougkwan@google.com>
7398 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
7400 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
7401 relaxed input sections.
7402 * output.cc (Output_section::find_relaxed_input_section): Change
7403 return type to Output_relaxed_input_section pointer. Adjust code
7404 for new type of relaxed_input_section_map_.
7405 * output.h (Output_section::find_relaxed_input_section): Change
7406 return type to Output_relaxed_input_section pointer.
7407 (Output_section::Output_relaxed_input_section_by_input_section_map):
7409 (Output_section::relaxed_input_section_map_): Change type to
7410 Output_section::Output_relaxed_input_section_by_input_section_map.
7411 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
7414 2009-12-15 Ian Lance Taylor <iant@google.com>
7416 * layout.cc (Layout::create_shstrtab): Only write out after input
7417 sections if we are compressing debug sections.
7419 2009-12-15 Ian Lance Taylor <iant@google.com>
7421 * archive.cc (Archive::add_symbols): Only look up a symbol without
7422 a version if there is, in fact, a version.
7424 2009-12-14 Ian Lance Taylor <iant@google.com>
7426 Revert -Wshadow changes, all changes from:
7427 2009-12-11 Doug Kwan <dougkwan@google.com>
7428 2009-12-11 Nick Clifton <nickc@redhat.com>
7429 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
7431 2009-12-11 Doug Kwan <dougkwan@google.com>
7433 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
7435 * attributes.cc (Object_attribute::size): Ditto.
7436 (Attributes_section_data::size): Ditto.
7437 (Attributes_section_data::Attributes_section_data): Ditto.
7438 (Output_attributes_section_data::do_write): Ditto.
7439 * attributes.h (Object_attribute::set_type): Ditto.
7440 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
7442 2009-12-11 Nick Clifton <nickc@redhat.com>
7444 * archive.cc: Fix shadowed variable warnings.
7446 * compressed_output.cc: Likewise.
7447 * compressed_output.h: Likewise.
7448 * configure: Likewise.
7449 * dwarf_reader.cc: Likewise.
7450 * dynobj.cc: Likewise.
7451 * dynobj.h: Likewise.
7452 * ehframe.cc: Likewise.
7453 * ehframe.h: Likewise.
7454 * errors.cc: Likewise.
7455 * expression.cc: Likewise.
7456 * fileread.cc: Likewise.
7457 * fileread.h: Likewise.
7458 * freebsd.h: Likewise.
7459 * i386.cc: Likewise.
7461 * incremental.h: Likewise.
7462 * layout.cc: Likewise.
7463 * layout.h: Likewise.
7464 * mapfile.cc: Likewise.
7465 * merge.cc: Likewise.
7466 * merge.h: Likewise.
7467 * object.cc: Likewise.
7468 * object.h: Likewise.
7469 * options.h: Likewise.
7470 * output.cc: Likewise.
7471 * output.h: Likewise.
7472 * parameters.cc: Likewise.
7473 * plugin.cc: Likewise.
7474 * powerpc.cc: Likewise.
7475 * reduced_debug_output.cc: Likewise.
7476 * reduced_debug_output.h: Likewise.
7477 * reloc.cc: Likewise.
7478 * reloc.h: Likewise.
7479 * resolve.cc: Likewise.
7480 * script-sections.cc: Likewise.
7481 * script.cc: Likewise.
7482 * script.h: Likewise.
7483 * sparc.cc: Likewise.
7484 * symtab.cc: Likewise.
7485 * symtab.h: Likewise.
7486 * target-select.cc: Likewise.
7487 * target-select.h: Likewise.
7488 * token.h: Likewise.
7489 * workqueue.cc: Likewise.
7490 * workqueue.h: Likewise.
7491 * x86_64.cc: Likewise.
7493 2009-12-10 Doug Kwan <dougkwan@google.com>
7495 * arm.cc (attributes.h): New include.
7496 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
7497 (Arm_relobj::~Arm_relobj): Delete object pointed by
7498 attributes_section_data_.
7499 (Arm_relobj::attributes_section_data): New method definition.
7500 (Arm_relobj::attributes_section_data_): New data member declaration.
7501 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
7502 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
7503 attributes_section_data_.
7504 (Arm_dynobj::attributes_section_data): New method definition.
7505 (Arm_dynobj::attributes_section_data_): New data member declaration.
7506 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
7507 initialization value of may_use_blx_ to false.
7508 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
7509 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
7510 object attributes to compute results instead of hard-coding.
7511 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
7512 Target_arm::get_secondary_compatible_arch,
7513 Target_arm::set_secondary_compatible_arch
7514 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7515 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
7516 New method declarations.
7517 (Target_arm::get_aeabi_object_attribute): New method definition.
7518 (Target_arm::attributes_section_data_): New data member declaration.
7519 (read_arm_attributes_section): New template definition.
7520 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
7521 (Arm_dynobj::do_read_symbols): Ditto.
7522 (Target_arm::do_finalize_sections): Merge attributes sections from
7523 input. Check for BLX use after attributes section merging.
7524 Fix __exidx_start and __exidx_end visibility. Create an
7525 .ARM.attributes section if necessary.
7526 (Target_arm::get_secondary_compatible_arch,
7527 Target_arm::set_secondary_compatible_arch,
7528 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7529 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
7530 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
7531 New method definitions.
7533 2009-12-09 Ian Lance Taylor <iant@google.com>
7535 * plugin.cc (Plugin::load): Don't cast from void* to a function
7538 2009-12-09 Ian Lance Taylor <iant@google.com>
7540 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
7543 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
7545 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
7546 Replace two_file_shared_1.so with two_file_shared_2.so.
7547 * testsuite/Makefile.in: Regenerated.
7549 2009-12-08 Doug Kwan <dougkwan@google.com>
7551 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
7552 (HFILES): Add attributes.h and int_encoding.h.
7553 * Makefile.in: Regenerate.
7554 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
7555 function definitions to int_encoding.cc
7556 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
7557 prototypes to int_encoding.h
7558 * reduced_debug_output.cc (int_encoding.h): New include.
7559 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
7560 function definitions to int_encoding.cc
7561 (insert_into_vector, read_from_pointer): Move template definitions to
7563 * attributes.cc: New file.
7564 * attributes.h: New file.
7565 * int_encoding.cc: New file.
7566 * int_encoding.h: New file.
7568 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
7571 * incremental-dump.cc (dump_incremental_inputs): New.
7572 (main): Use dump_incremental_inputs.
7574 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
7577 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
7578 checking elfcpp::STT_FUNC.
7579 (Target_i386::Relocate::relocate): Likewise.
7580 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
7582 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
7583 symbols from shared libraries into normal FUNC symbols.
7585 * symtab.h (Symbol): Add is_func and use it.
7587 2009-12-05 Doug Kwan <dougkwan@google.com>
7589 * arm.cc (Target_arm::arm_info): Initialize new fields
7590 attributes_section and attributes_vendor.
7591 * i386.cc (Target_i386::i386_info): Same.
7592 * object.cc (Sized_relobj::do_layout): Skip attribute section.
7593 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7594 fields attributes_section and attributes_vendor.
7595 * sparc.cc (Target_sparc::sparc_info): Same.
7596 * target.h (Target::attributes_section, Target::attributes_vendor,
7597 Target::is_attributes_section, Target::attribute_arg_type,
7598 Target::attributes_order): New method definitions.
7599 (Target::Target_info::attributes_section,
7600 Target::Target_info::attributes_vendor): New fields.
7601 (Target::do_attribute_arg_type, Target::do_attributes_order): New
7602 virtual method definitions.
7603 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7604 attributes_section and attributes_vendor.
7605 * testsuite/testfile.cc (Target_test::test_target_info): Same.
7607 2009-12-05 Doug Kwan <dougkwan@google.com>
7609 * arm.cc: Update comments about interworking and stub generation.
7610 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
7611 considered as non-PIC.
7612 (Arm_relocate_functions::base_abs): Fix formatting.
7613 (Arm_relocate_functions::got_prel): Fix comment. Change interface
7614 of function to use GOT entry address instead of offset.
7615 (Target_arm::Scan::global): Issue an error if a symbol would need a
7616 PLT does not get one because it is untyped. Remove code to create
7617 dynamic symbols for relative branches.
7618 (Target_arm::Relocate::relocate: Use 0 instead of false since function
7619 takes unsigned integer instead of boolean.
7621 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
7623 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7624 (two_file_test_LDADD): Likewise.
7625 (common_test_1_LDADD): Likewise.
7626 (exception_test_LDADD) Likewise.
7627 (weak_test_LDADD): Likewise.
7628 (many_sections_test_LDADD): Likewise.
7629 (initpri1_LDADD): Likewise.
7630 (script_test_1_LDADD): Likewise.
7631 (script_test_2_LDADD): Likewise.
7632 (justsyms_LDADD): Likewise.
7633 (binary_test_LDADD): Likewise.
7634 (large_LDADD): Likewise.
7635 * testsuite/Makefile.in: Regenerated.
7637 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
7639 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7640 (Symbol_table::override_with_special): Likewise.
7641 (Symbol_table::add_from_object): Likewise.
7643 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
7645 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7646 Don't set the data_offset twice.
7648 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
7650 * testsuite/Makefile.in: Regenerate.
7652 2009-12-03 Doug Kwan <dougkwan@google.com>
7654 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
7655 (Target_arm::do_finalize_sections): Add parameter for symbol table
7656 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
7657 * i386.cc (Target_i386::do_finalize_sections): Add an additional
7658 parameter for symbol table pointer.
7659 * layout.cc (Layout::finalize): Call Target::finalize_sections with
7660 an additional parameter for a pointer to symbol table.
7661 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
7662 parameter for a symbol table pointer.
7663 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
7664 * target.h (Target::finalize_sections, Target::do_finalize_sections):
7666 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
7667 parameter for a symbol table pointer.
7669 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
7671 * incremental.cc (Incremental_inputs_header)
7672 (Incremental_inputs_header_write, Incremental_inputs_entry)
7673 (Incremental_inputs_entry_write): Move ...
7674 * incremental.h (Incremental_inputs_header)
7675 (Incremental_inputs_header_write, Incremental_inputs_entry)
7676 (Incremental_inputs_entry_write): here.
7678 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7680 * incremental.cc (make_sized_incremental_binary): Set the target.
7681 Error if it is incompatible.
7682 * output.h (Output_file): Add filename method.
7684 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7686 * incremental.cc (Incremental_inputs_entry): Remove unused argument
7687 from the get_* methods.
7689 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7691 * incremental-dump.cc (main): Check that the offeset of a script is 0.
7692 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7693 Write 0 for the data_offset of scripts.
7695 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7697 * testsuite/Makefile.am: Add the incremental_test.sh test.
7698 * testsuite/incremental_test.sh: New.
7699 * testsuite/incremental_test_1.c: New.
7700 * testsuite/incremental_test_2.c: New.
7702 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
7704 * incremental-dump.cc (main): Fix typos.
7706 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
7709 * incremental-dump.cc (main): Use llu to print 64 bit values.
7711 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
7712 H.J. Lu <hongjiu.lu@intel.com>
7714 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
7716 (incremental_dump_LDADD): Likewise.
7717 * Makefile.in: Regenerated.
7719 2009-11-25 Doug Kwan <dougkwan@google.com>
7723 2009-11-25 Doug Kwan <dougkwan@google.com>
7725 * arm.cc (Target_arm::Target_arm): Move method definition
7726 outside of class definition. Add code to handle
7727 --target1-rel, --target1-abs and --target2= options.
7728 (Target_arm::get_reloc_reloc_type): Change method to be
7729 non-static and const.
7730 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
7731 New data member declaration.
7732 (Target_arm::Scan::local, Target_arm::Scan::global,
7733 Target_arm::Relocate::relocate,
7734 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7735 Adjust call to Target_arm::get_real_reloc_type.
7736 (Target_arm::get_real_reloc_type): Use command line options
7737 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7738 * options.h (--target1-rel, --target1-abs, --target2): New
7741 2009-11-25 Doug Kwan <dougkwan@google.com>
7743 * arm.cc (Target_arm::Target_arm): Move method definition outside of
7744 class definition. Add code to handle --target1-rel, --target1-abs
7745 and --target2= options.
7746 (Target_arm::get_reloc_reloc_type): Change method to be non-static
7748 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
7750 (Target_arm::Scan::local, Target_arm::Scan::global,
7751 Target_arm::Relocate::relocate,
7752 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
7753 call to Target_arm::get_real_reloc_type.
7754 (Target_arm::get_real_reloc_type): Use command line options to
7755 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7756 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
7759 2009-11-25 Doug Kwan <dougkwan@google.com>
7761 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
7762 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
7763 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
7765 (Arm_relocate_functions::thm_call): Replace body with a call to
7766 Arm_relocate_functions::thumb_branch_common.
7767 (Arm_relocate_functions::thm_jump24,
7768 Arm_relocate_functions::thm_xpc22): New method definitions.
7769 (Arm_relocate_functions::thumb_branch_common): New method definition.
7770 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
7772 (Target_arm::Relocate::relocate): Adjust call to thm_call.
7773 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
7775 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
7777 * Makefile.am: Build incremental-dump
7778 * Makefile.in: Regenerate.
7779 * incremental-dump.cc: New.
7780 * incremental.cc (Incremental_inputs_header_data,
7781 Incremental_inputs_entry_data): Move to incremental.h
7782 * incremental.h: (Incremental_inputs_header_data,
7783 Incremental_inputs_entry_data): Move from incremental.cc
7785 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
7787 * incremental.cc (Incremental_inputs_header,
7788 Incremental_inputs_header_write, Incremental_inputs_entry,
7789 Incremental_inputs_entry_write): Add a typedef with the data type.
7791 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
7793 * incremental.cc (Incremental_inputs_header,
7794 Incremental_inputs_header_write, Incremental_inputs_entry,
7795 Incremental_inputs_entry_write): Update comment about which
7796 type has the filed descriptions.
7798 2009-11-15 Doug Kwan <dougkwan@google.com>
7800 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
7801 (Arm_relocate_functions::arm_branch_common): Change method defintion
7802 in class definition to a method declaration and update list of formal
7804 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
7805 Arm_relocation_functions::jump24): Adjust call to
7806 Arm_relocate_functions::arm_branch_common. Update list of formal
7808 (Arm_relocate_functions::xpc25): New method definition.
7809 (Arm_relocate_functions::arm_branch_common): Move method defintion
7810 out from class definition. Use stubs for mode-switching and extending
7812 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
7813 specially. Change code to enable use of stubs in ARM branches.
7815 2009-11-10 Doug Kwan <dougkwan@google.com>
7817 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
7818 in method declaration.
7819 (Target_arm::relocate_stub): New method declaration.
7820 (Target_arm::default_target): Change to return a pointer instead of
7822 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
7823 Target_arm::default_target.
7824 (Arm_Relobj::do_relocate_sections): Remove options paramater in
7826 (Target_arm::relocate_section): Adjust view.
7827 (Target_arm::relocate_stub): New method definition.
7829 2009-11-10 Doug Kwan <dougkwan@google.com>
7831 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
7833 * incremental.cc (open_incremental_binary): Initialized local
7834 variables to avoid warnings.
7835 * object.cc (make_elf_object): Ditto.
7836 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
7839 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
7842 * testsuite/plugin_test.c: Include "config.h".
7844 2009-11-09 Doug Kwan <dougkwan@google.com>
7846 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
7847 (arm_symbol_value): Remove.
7848 (Arm_relocate_functions::arm_branch_common,
7849 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
7850 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
7851 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
7852 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
7853 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
7854 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
7855 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
7856 Arm_relocate_functions::thm_mobw_abs_nc,
7857 Arm_relocate_functions::thm_mov_abs,
7858 Arm_relocate_functions::movw_prel_nc,
7859 Arm_relocate_functions::thm_movt_abs,
7860 Arm_relocate_functions::movt_prel,
7861 Arm_relocate_functions::thm_movw_prel_nc,
7862 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
7863 (Target_arm::Relocate::relocate): Only decompose address into two
7864 parts if relocation type uses the thumb-bit and pass the actual
7865 bit instead of a flag indicating that the thumb-bit is used. Adjust
7866 calls to methods in Arm_relocate_functions for this change.
7868 2009-11-08 Ian Lance Taylor <iant@google.com>
7871 * reloc.cc: Instantiate
7872 Sized_relobj::initialize_input_to_output_maps and
7873 Sized_relobj:free_input_to_output_maps.
7875 2009-11-06 Ian Lance Taylor <iant@google.com>
7878 * defstd.cc (in_segment): Set only_if_ref true for "end".
7880 2009-11-06 Doug Kwan <dougkwan@google.com>
7882 * arm.cc (class Reloc_stub): Correct a comment.
7883 (Target_arm::Target_arm): Initialize arm_input_section_map_.
7884 (Target_arm::scan_section_for_stubs): New method declaration.
7885 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
7886 Change methods from private to protected.
7887 (Target_arm::do_may_relax): New method definition.
7888 (Target_arm::do_relax, Target_arm::group_sections,
7889 Target_arm::scan_reloc_for_stub,
7890 Target_arm::scan_reloc_section_for_stubs): New method declarations.
7891 (Target_arm::arm_input_section_map_): New data member declaration.
7892 (Target_arm::scan_reloc_for_stub,
7893 Target_arm::scan_reloc_section_for_stubs,
7894 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
7895 Target_arm::do_relax): New method definitions.
7897 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
7899 * configure.ac: Check for (struct stat)::st_mtim
7900 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
7901 * config.in: Regenerate.
7902 * configure: Regenerate.
7904 2009-11-05 Ian Lance Taylor <iant@google.com>
7907 * output.cc (Output_segment::add_output_section): Add missing
7910 2009-11-04 Ian Lance Taylor <iant@google.com>
7913 * object.h (class Object): Add is_needed and set_is_needed
7914 methods. Add is_needed_ field. Make bool fields into bitfields.
7915 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
7916 defined in a dynamic object and referenced by a regular object,
7917 set is_needed for the dynamic object.
7918 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
7919 if the file is marked with as_needed and it is not needed.
7921 2009-11-04 Ian Lance Taylor <iant@google.com>
7924 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
7925 tags if data is discarded by linker script.
7926 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7927 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7928 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7929 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7931 2009-11-04 Ian Lance Taylor <iant@google.com>
7933 * layout.cc (Layout::get_output_section): Add is_interp and
7934 is_dynamic_linker_section parameters. Change all callers.
7935 (Layout::choose_output_section): Likewise.
7936 (Layout::make_output_section): Likewise.
7937 (Layout::add_output_section_data): Add is_dynamic_linker_section
7938 parameter. Change all callers.
7939 * layout.h (class Layout): Update declarations.
7940 * output.h (class Output_section): Add is_interp, set_is_interp,
7941 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
7942 Add is_interp_, is_dynamic_linker_section_ fields. Change
7943 generate_code_fills_at_write_ to a bitfield.
7944 * output.cc (Output_section::Output_sections): Initialize new
7946 (Output_segment::add_output_section): Add do_sort parameter.
7949 2009-11-03 Ian Lance Taylor <iant@google.com>
7952 * options.h (class General_options): Add --warn-common.
7953 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
7954 merging two common symbols.
7955 (Symbol_table::should_override): Handle --warn-common when merging
7956 a common symbol with a defined symbol. Use report_resolve_problem
7957 for multiple definitions.
7958 (Symbol_table::report_resolve_problem): New function.
7959 * symtab.h (class Symbol_table): Declare report_resolve_problem.
7961 2009-11-03 Doug Kwan <dougkwan@google.com>
7963 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
7965 (Target_arm::stub_factory): New method definition.
7966 (Target_arm::new_arm_input_section,
7967 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
7968 Target_arm::reloc_uses_thumb_bit): New method declarations.
7969 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
7970 New type definitions.
7971 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
7972 member declarations.
7973 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
7974 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
7975 New method definitions.
7977 2009-11-03 Ian Lance Taylor <iant@google.com>
7979 * options.h (class General_options): Add --warn_constructors.
7981 2009-11-03 Ian Lance Taylor <iant@google.com>
7984 * defstd.cc (in_section): Add entries for __rel_iplt_start,
7985 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
7987 2009-11-03 Ian Lance Taylor <iant@google.com>
7990 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
7991 --msgid-bugs-address.
7992 (install-pdf): New target.
7993 (install-data_yes): Look up one directory to find mkinstalldirs.
7995 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
7997 * po/Make-in (.po.gmo): Don't generate .gmo files in source
8000 2009-10-30 Doug Kwan <dougkwan@google.com>
8002 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
8004 2009-10-30 Doug Kwan <dougkwan@google.com>
8006 * arm.cc (Stub_addend_reader): New struct template definition
8007 and partial specializations.
8008 (Stub_addend_reader::operator()): New method definition for a
8009 partially specialized template.
8011 2009-10-30 Doug Kwan <dougkwan@google.com>
8013 * arm.cc (Arm_relobj::processor_specific_flags): New method
8015 (Arm_relobj::do_read_symbols): New method declaration.
8016 (Arm_relobj::processor_specific_flags_): New data member declaration.
8017 (Arm_dynobj): New class definition.
8018 (Target_arm::do_finalize_sections): Add input_objects parameter.
8019 (Target_arm::do_adjust_elf_header): New method declaration.
8020 (Target_arm::are_eabi_versions_compatible,
8021 (Target_arm::merge_processor_specific_flags): New method declaration.
8022 (Target_arm::do_make_elf_object): New overloaded method definitions
8024 (Arm_relobj::do_read_symbols): New method definition.
8025 (Arm_dynobj::do_read_symbols): Ditto.
8026 (Target_arm::do_finalize_sections): Add input_objects parameters.
8027 Merge processor-specific flags from all input objects.
8028 (Target_arm::are_eabi_versions_compatible,
8029 Target_arm::merge_processor_specific_flags,
8030 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
8031 New method definitions.
8032 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
8033 Input_objects pointer type parameter.
8034 * layout.cc (Layout::finalize): Pass input objects to target's.
8035 finalize_sections function.
8036 * output.cc (Output_file_header::do_sized_write): Set ELF file
8037 header's processor-specific flags.
8038 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
8039 Input_objects pointer type parameter.
8040 * sparc.cc (Target_sparc::do_finalize_sections): Same.
8041 * target.h (Input_objects): New forward class declaration.
8042 (Target::processor_specific_flags,
8043 Target::are_processor_specific_flags_sect): New method definitions.
8044 (Target::finalize_sections): Add input_objects parameter.
8045 (Target::Target): Initialize processor_specific_flags_ and
8046 are_processor_specific_flags_set_.
8047 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
8049 (Target::set_processor_specific_flags): New method definition.
8050 (Target::processor_specific_flags_,
8051 Target::are_processor_specific_flags_set_): New data member
8053 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
8054 Input_objects pointer type parameter.
8056 2009-10-30 Doug Kwan <dougkwan@google.com>
8058 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
8060 2009-10-28 Ian Lance Taylor <iant@google.com>
8062 * object.h (class Relobj): Drop options parameter from
8063 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
8064 do_scan_relocs, do_relocate. Change all callers.
8065 (class Sized_relobj): Drop options parameters from
8066 do_gc_process_relocs, do_scan_relocs, do_relocate,
8067 do_relocate_sections, relocate_sections, emit_relocs_scan,
8068 emit_relocs_scan_reltype. Change all callers.
8069 (struct Relocate_info): Remove options field and all references to
8071 * reloc.h (class Read_relocs): Remove options constructor
8072 parameter and options_ field. Change all callers.
8073 (class Gc_process_relocs, class Scan_relocs): Likewise.
8074 (class Relocate_task): Likewise.
8075 * target-reloc.h (scan_relocs): Remove options parameter. Change
8077 (scan_relocatable_relocs): Likewise.
8078 * target.h (class Sized_target): Remove options parameter from
8079 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
8081 * gc.h (gc_process_relocs): Remove options parameter. Change all
8083 * arm.cc: Update functions to remove options parameters.
8084 * i386.cc: Likewise.
8085 * powerpc.cc: Likewise.
8086 * sparc.cc: Likewise.
8087 * x86_64.cc: Likewise.
8088 * testsuite/testfile.cc: Likewise.
8090 2009-10-28 Doug Kwan <dougkwan@google.com>
8092 * arm.cc (Arm_relobj): New class definition.
8093 (Arm_relobj::scan_sections_for_stubs,
8094 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
8095 New method definitions.
8097 2009-10-28 Cary Coutant <ccoutant@google.com>
8099 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
8100 (Plugin::cleanup_done_): New member.
8101 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
8102 (Plugin_manager::cleanup_done_): Remove.
8103 (Plugin_manager::add_input_file): Edit error message.
8104 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
8105 (Plugin_manager::cleanup): Remove use of cleanup_done_.
8107 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
8109 * fileread.cc: (File_read::View::~View): Use the new
8110 data_ownership_ filed.
8111 (File_read::~File_read): Dispose the new whole_file_view_.
8112 (File_read::open): Mmap the whole file if needed.
8113 (File_read::open): Use whole_file_view_ instead of contents_.
8114 (File_read::find_view): Use whole_file_view_ if applicable.
8115 (File_read::do_read): Use whole_file_view_ instead of contents_.
8116 (File_read::make_view): Use whole_file_view_ instead of contents_,
8117 update File_read::View::View call.
8118 (File_read::find_or_make_view): Update File_read::View::View
8120 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
8122 (File_read::View::Data_ownership): New enum.
8123 (File_read::View::View): Replace bool mapped_ with Data_ownership
8125 (File_read::View::mapped_): Remove (replaced by data_ownership_).
8126 (File_read::View::data_ownership_): New field.
8127 (File_read::contents_): Remove (replaced by whole_file_view_).
8128 (File_read::whole_file_view_): New field.
8129 * options.h (class General_options): Add --keep-files-mapped.
8131 2009-10-27 Cary Coutant <ccoutant@google.com>
8133 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
8134 * testsuite/Makefile.am (plugin_test_5): New test case.
8135 * testsuite/Makefile.in: Regenerate.
8137 2009-10-25 Doug Kwan <dougkwan@google.com>
8139 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
8140 from private to protected to allow access by child class.
8141 (Sized_relobj::do_relocate_sections): New method declaration.
8142 (Sized_relobj::relocate_sections): Virtualize.
8143 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
8144 Sized_relobj::relocate_sections. Instantiate template explicitly
8145 for different target sizes and endianity.
8147 2009-10-24 Doug Kwan <dougkwan@google.com>
8149 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
8150 (Arm_input_section::as_arm_input_section): New method.
8151 (Arm_output_section): New class definition.
8152 (Arm_output_section::create_stub_group,
8153 Arm_output_section::group_sections): New method definitions.
8155 2009-10-22 Doug Kwan <dougkwan@google.com>
8157 * arm.cc (Arm_input_section): New class definition.
8158 (Arm_input_section::init, Arm_input_section:do_write,
8159 Arm_input_section::set_final_data_size,
8160 Arm_input_section::do_reset_address_and_file_offset): New method
8163 2009-10-21 Doug Kwan <dougkwan@google.com>
8165 * arm.cc (Stub_table, Arm_input_section): New forward class
8167 (Stub_table): New class defintion.
8168 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
8169 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
8170 New method definition.
8172 2009-10-21 Doug Kwan <dougkwan@google.com>
8174 * arm.cc: Update copyright comments.
8175 (Target_arm): New forward class template declaration.
8176 (Arm_address): New type.
8177 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
8178 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
8179 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
8181 (Insn_template): Same.
8182 (DEF_STUBS): New macro.
8183 (Stub_type): New enum type.
8184 (Stub_template): New class definition.
8187 (Stub_factory): Same.
8188 (Target_arm::Target_arm): Initialize may_use_blx_ and
8189 should_force_pic_veneer_.
8190 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
8191 Target_arm::should_force_pic_veneer,
8192 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
8193 Target_arm::using_thumb_only, Target_arm:;default_target): New
8195 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
8196 New data member declarations.
8197 (Insn_template::size, Insn_template::alignment): New method defintions.
8198 (Stub_template::Stub_template): New method definition.
8199 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
8200 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
8201 (Stub_factory::Stub_factory): New method definition.
8202 * gold.h (string_hash): New template.
8203 * output.h (Input_section_specifier::hash_value): Use
8205 (Input_section_specifier::string_hash): Remove.
8206 * stringpool.cc (Stringpool_template::string_hash): Use
8209 2009-10-20 Doug Kwan <dougkwan@google.com>
8211 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
8212 symbols of relaxed input sections.
8213 * output.h (Output_section::find_relaxed_input_section): Make
8216 2009-10-16 Doug Kwan <dougkwan@google.com>
8218 * dynobj.cc (Versions::Versions): Initialize version_script_.
8219 Only insert base version symbol definition for a shared object
8220 if version script defines any version versions.
8221 (Versions::define_base_version): New method definition.
8222 (Versions::add_def): Check that base version is not needed.
8223 (Versions::add_need): Define base version lazily.
8224 * dynobj.h (Versions::define_base_version): New method declaration.
8225 (Versions::needs_base_version_): New data member declaration.
8226 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
8227 (check_DATA): Add no_version_test.stdout.
8228 (libno_version_test.so, no_version_test.o no_version_test.stdout):
8230 * testsuite/Makefile.in: Regenerate.
8231 * testsuite/no_version_test.c: New file.
8232 * testsuite/no_version_test.sh: Ditto.
8234 2009-10-16 Doug Kwan <dougkwan@google.com>
8236 * expression.cc (class Segment_start_expression): New class definition.
8237 (Segment_start_expression::value): New method definition.
8238 (script_exp_function_segment_start): Return a new
8239 Segment_start_expression.
8240 * gold/script-c.h (script_saw_segment_start_expression): New function
8242 * script-sections.cc (Script_sections::Script_sections): Initialize
8243 SAW_SEGMENT_START_EXPRESSION_ to false.
8244 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
8245 and -Tbbs options to specify section addresses if given in
8246 command line and no SEGMENT_START expression is seen in a script.
8247 * script-sections.h (Script_sections::saw_segment_start_expression,
8248 Script_sections::set_saw_segment_start_expression): New method
8250 (Script_sections::saw_segment_start_expression_): New data member
8252 * script.cc (script_saw_segment_start_expression): New function.
8253 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
8254 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
8255 script_test_7.sh and script_test_8.sh.
8256 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
8257 script_test_8.stdout.
8258 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
8259 (script_test_6, script_test_6.stdout, script_test_7,
8260 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
8261 * Makefile.in: Regenerate.
8262 * testsuite/script_test_6.sh: New file.
8263 * testsuite/script_test_6.t: Same.
8264 * testsuite/script_test_7.sh: Same.
8265 * testsuite/script_test_7.t: Same.
8266 * testsuite/script_test_8.sh: Same.
8268 2009-10-16 Doug Kwan <dougkwan@google.com>
8270 * output.cc (Output_segment::set_section_list_address): Cast
8271 expressions to unsigned long long type to avoid format warnings.
8273 2009-10-15 Ian Lance Taylor <iant@google.com>
8275 * script.cc (Script_options::add_symbol_assignment): Always add a
8276 dot assignment to script_sections_.
8277 * script-sections.cc (Script_sections::add_dot_assignment):
8278 Initialize if necessary.
8280 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
8281 program headers with no load segment if there is a linker script.
8283 * layout.cc (Layout::set_segment_offsets): Align the file offset
8284 to the segment aligment for -N or -n with no load segment.
8285 * output.cc (Output_segment::add_output_section): Don't crash if
8286 the first section is a TLS section.
8287 (Output_segment::set_section_list_addresses): Print an error
8288 message if the address moves backward in a linker script.
8289 * script-sections.cc
8290 (Output_section_element_input::set_section_addresses): Don't
8291 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
8292 (Orphan_output_section::set_section_addresses): Likewise.
8294 2009-10-15 Doug Kwan <dougkwan@google.com>
8296 * layout.cc (Layout::finish_dynamic_section): Generate tags
8297 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
8298 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
8299 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
8301 2009-10-14 Ian Lance Taylor <iant@google.com>
8303 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
8305 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
8306 data_shdr fields of relinfo.
8307 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
8308 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
8309 R_386_TLS_LDO_32, adjust based on section flags.
8310 (Target_i386::Relocate::fix_up_ldo): Remove.
8312 2009-10-13 Ian Lance Taylor <iant@google.com>
8314 Add support for -pie.
8315 * options.h (class General_options): Add -pie and
8317 (General_options::output_is_position_independent): Test -pie.
8318 (General_options::output_is_executable): Return true if not shared
8319 and not relocatable.
8320 (General_options::output_is_pie): Remove.
8321 * options.cc (General_options::finalize): Reject incompatible uses
8323 * gold.cc (queue_middle_tasks): A -pie link is not static.
8324 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
8325 * symtab.cc (Symbol::final_value_is_known): Return false if
8326 output_is_position_independent.
8327 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
8328 output_is_position_independent.
8329 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
8330 output_is_position_independent.
8331 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
8332 output_is_position_independent.
8333 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
8335 (basic_pie_test.o, basic_pie_test): New targets.
8336 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
8337 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
8338 (two_file_pie_test): New target.
8339 * testsuite/Makefile.in: Rebuild.
8340 * README: Remove note saying that -pie is not supported.
8342 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
8344 * options.h (class General_options): Add -init and -fini.
8345 * layout.cc (Layout::finish_dynamic_section): Emit
8346 given init and fini functions.
8348 2009-10-13 Sriraman Tallam <tmsriram@google.com>
8350 * gc.h (gc_process_relocs): Check if icf is enabled using new
8352 * gold.cc (queue_initial_tasks): Likewise.
8353 (queue_middle_tasks): Likewise.
8354 * object.cc (do_layout): Likewise.
8355 * symtab.cc (is_section_folded): Likewise.
8356 * main.cc (main): Likewise.
8357 * reloc.cc (Read_relocs::run): Likewise.
8358 (Sized_relobj::do_scan_relocs): Likewise.
8359 * icf.cc (is_function_ctor_or_dtor): New function.
8360 (Icf::find_identical_sections): Check if function is ctor or dtor when
8362 * options.h (General_options::icf): Change option to be an enum.
8363 (Icf_status): New enum.
8364 (icf_enabled): New method.
8365 (icf_safe_folding): New method.
8366 (set_icf_status): New method.
8367 (icf_status_): New variable.
8368 * (options.cc) (General_options::finalize): Set icf_status_.
8369 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
8370 icf_test and icf_keep_unique_test to use the --icf enum flag.
8371 * testsuite/icf_safe_test.sh: New file.
8372 * testsuite/icf_safe_test.cc: New file.
8374 2009-10-12 Sriraman Tallam <tmsriram@google.com>
8376 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
8377 includes to gc.h and icf.h.
8378 * arm.cc: Include gc.h.
8379 * gold.cc: Likewise.
8380 * i386.cc: Likewise.
8381 * powerpc.cc: Likewise.
8382 * sparc.cc: Likewise.
8383 * x86_64.cc: Likewise.
8384 * gc.h: Include icf.h.
8386 2009-10-11 Ian Lance Taylor <iant@google.com>
8388 * plugin.cc: Include "gold.h" before other header files.
8390 2009-10-10 Chris Demetriou <cgd@google.com>
8392 * options.h (Input_file_argument::Input_file_type): New enum.
8393 (Input_file_argument::is_lib_): Replace with...
8394 (Input_file_argument::type_): New member.
8395 (Input_file_argument::Input_file_argument): Take Input_file_type
8396 'type' rather than boolean 'is_lib' as second argument.
8397 (Input_file_argument::is_lib): Use type_.
8398 (Input_file_argument::is_searched_file): New function.
8399 (Input_file_argument::may_need_search): Handle is_searched_file.
8400 * options.cc (General_options::parse_library): Support -l:filename.
8401 (General_options::parse_just_symbols): Update for Input_file_argument
8403 (Command_line::process): Likewise.
8404 * archive.cc (Archive::get_file_and_offset): Likewise.
8405 * plugin.cc (Plugin_manager::release_input_file): Likewise.
8406 * script.cc (read_script_file, script_add_file): Likewise.
8407 * fileread.cc (Input_file::Input_file): Likewise.
8408 (Input_file::will_search_for): Handle is_searched_file.
8409 (Input_file::open): Likewise.
8410 * readsyms.cc (Read_symbols::get_name): Likewise.
8411 * testsuite/Makefile.am (searched_file_test): New test.
8412 * testsuite/Makefile.in: Regenerate.
8413 * testsuite/searched_file_test.cc: New file.
8414 * testsuite/searched_file_test_lib.cc: New file.
8416 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8417 Ian Lance Taylor <iant@google.com>
8419 * descriptor.cc: Include <cstdio> and "binary-io.h".
8420 (Descriptors::open): Open the files in binary mode always.
8421 * script.cc (Lex::get_token): Treat \r as whitespace.
8423 2009-10-09 Ian Lance Taylor <iant@google.com>
8425 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
8427 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8428 Ian Lance Taylor <iant@google.com>
8430 * configure.ac: Check for readv function also.
8431 * fileread.cc (readv): Define if not HAVE_READV.
8432 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
8434 * config.in: Regenerate.
8435 * configure: Regenerate.
8437 2009-10-09 Doug Kwan <dougkwan@google.com>
8439 * layout.cc (Layout::make_output_section): Call target hook to make
8440 ordinary output section.
8441 (Layout::finalize): Adjust parameter list of call the
8442 Target::may_relax().
8443 * layout.h (class Layout::section_list): New method.
8444 * merge.h (Output_merge_base::entsize): Change visibility to public.
8445 (Output_merge_base::is_string, Output_merge_base::do_is_string):
8447 (Output_merge_string::do_is_string): New method.
8448 * object.cc (Sized_relobj::do_setup): renamed from
8449 Sized_relobj::set_up.
8450 * object.h (Sized_relobj::adjust_shndx,
8451 Sized_relobj::initializ_input_to_output_maps,
8452 Sized_relobj::free_input_to_output_maps): Change visibilities to
8454 (Sized_relobj::setup): Virtualize.
8455 (Sized_relobj::do_setup): New method declaration.
8456 (Sized_relobj::invalidate_section_offset,
8457 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
8458 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
8459 * options.cc (parse_int): New function.
8460 * options.h (parse_int): New declaration.
8461 (DEFINE_int): New macro.
8462 (stub_group_size): New option.
8463 * output.cc (Output_section::Output_section): Initialize memebers
8464 merge_section_map_, merge_section_by_properties_map_,
8465 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
8466 (Output_section::add_input_section): Handled deferred code-fill
8467 generation and remove an old comment.
8468 (Output_section::add_relaxed_input_section): New method definition.
8469 (Output_section::add_merge_input_section): Use merge section by
8470 properties map to speed to search. Update merge section maps
8472 (Output_section::build_relaxation_map): New method definition.
8473 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8475 (Output_section::relax_input_section): Renamed to
8476 Output_section::convert_input_sections_to_relaxed_sections and change
8477 interface to take a vector of pointers to relaxed sections.
8478 (Output_section::find_merge_section,
8479 Output_section::find_relaxed_input_section): New method definitions.
8480 (Output_section::is_input_address_mapped,
8481 Output_section::output_offset, Output_section::output_address):
8482 Use output section data maps to speed up searching.
8483 (Output_section::find_starting_output_address): Add comments.
8484 (Output_section::do_write,
8485 Output_section::write_to_postprocessing_buffer): Do code-fill
8486 generation as appropriate.
8487 (Output_section::get_input_sections): Invalidate relaxed input section
8489 (Output_section::restore_states): Adjust type of checkpoint .
8490 Invalidate relaxed input section map.
8491 * output.h (Output_merge_base): New class declaration.
8492 (Input_section_specifier): New class defintion.
8493 (class Output_relaxed_input_section) Change base class to
8494 Output_section_data_build.
8495 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
8496 base class initializer.
8497 (Output_section::add_relaxed_input_section): New method declaration.
8498 (Output_section::Input_section): Change visibility to protected.
8499 (Output_section::Input_section::relobj,
8500 Output_section::Input_section::shndx): Handle relaxed input sections.
8501 Output_section::input_sections) Change visibility to protected. Also
8502 define overload to return a non-const pointer.
8503 (Output_section::Merge_section_properties): New class defintion.
8504 (Output_section::Merge_section_by_properties_map,
8505 Output_section::Output_section_data_by_input_section_map,
8506 Output_section::Relaxation_map): New types.
8507 (Output_section::relax_input_section): Rename method to
8508 Output_section::convert_input_sections_to_relaxed_sections and change
8509 interface to take a vector of relaxed section pointers.
8510 (Output_section::find_merge_section,
8511 Output_section::find_relaxed_input_section,
8512 Output_section::build_relaxation_map,
8513 Output_section::convert_input_sections_in_list_to_relaxed_sections):
8514 New method declarations.
8515 (Output_section::merge_section_map_
8516 Output_section::merge_section_by_properties_map_,
8517 Output_section::relaxed_input_section_map_,
8518 Output_section::is_relaxed_input_section_map_valid_,
8519 Output_section::generate_code_fills_at_write_): New data members.
8520 * script-sections.cc
8521 (Output_section_element_input::set_section_addresses): Call
8522 current_data_size and addralign methods of relaxed input sections.
8523 (Orphan_output_section::set_section_addresses): Call current_data_size
8524 and addralign methods of relaxed input sections.
8525 * symtab.cc (Symbol_table::compute_final_value): Extract template
8526 from the body of Symbol_table::sized_finalize_symbol.
8527 (Symbol_table::sized_finalized_symbol): Call
8528 Symbol_table::compute_final_value.
8529 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
8530 (Symbol_table::compute_final_value): New templated method declaration.
8531 * target.cc (Target::do_make_output_section): New method defintion.
8532 * target.h (Target::make_output_section): New method declaration.
8533 (Target::relax): Add more parameters for input objects, symbol table
8534 and layout. Adjust call to do_relax.
8535 (Target::do_make_output_section): New method declaration.
8536 (Target::do_relax): Add parameters for input objects, symbol table
8539 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8541 * pread.c: Include stdio.h.
8543 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8545 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
8548 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8550 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8551 Change read_shndx type to unsigned int.
8552 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8554 (Sized_dwarf_line_info::read_line_mappings): Likewise.
8555 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
8556 Change read_shndx type to unsigned int.
8557 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8559 (Sized_dwarf_line_info::read_line_mappings): Likewise.
8560 * layout.cc (Layout::create_symtab_sections): Cast the result of
8561 local_symcount * symsize to off_t in the gold_assert.
8563 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8565 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
8566 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
8568 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
8569 (Arm_relocate_functions::thm_abs5): New function.
8570 (Arm_relocate_functions::abs12): New function.
8571 (Arm_relocate_functions::abs16): New function.
8572 (Arm_relocate_functions::base_abs): New function.
8573 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
8574 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
8575 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
8577 (Scan::global): Likewise.
8578 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
8579 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
8580 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
8581 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
8584 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8586 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
8587 (Arm_relocate_functions::movt_prel): New function.
8588 (Arm_relocate_functions::thm_movw_prel_nc): New function.
8589 (Arm_relocate_functions::thm_movt_prel): New function.
8590 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8591 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8592 (Scan::global, Relocate::relocate): Likewise.
8593 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8595 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8597 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8598 Incremental_checker.
8599 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8601 (class Incremental_inputs_header): New class.
8602 (Incremental_inputs_header_writer): Edit comment.
8603 (Incremental_inputs_entry): New class.
8604 (Incremental_inputs_entry_writer): Edit comment.
8605 (Sized_incremental_binary::do_find_incremental_inputs_section):
8606 Add *strtab_shndx parameter, fill it.
8607 (Sized_incremental_binary::do_check_inputs): New method.
8608 (Incremental_checker::can_incrementally_link_output_file): Use
8609 Sized_incremental_binary::check_inputs.
8610 (Incremental_inputs::report_command_line): Save command line in
8613 (Incremental_binary::find_incremental_inputs_section): New
8615 (Incremental_binary::do_find_incremental_inputs_section): Add
8616 strtab_shndx parameter.
8617 (Incremental_binary::do_check_inputs): New pure virtual method.
8618 (Sized_incremental_binary::do_check_inputs): Declare.
8619 (Incremental_checker::Incremental_checker): Add incremental_inputs
8620 parameter, use it to initialize incremental_inputs_.
8621 (Incremental_checker::incremental_inputs_): New field.
8622 (Incremental_checker::command_line): New method.
8623 (Incremental_checker::inputs): New method.
8624 (Incremental_checker::command_line_): New field.
8626 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8628 * incremental.cc: Include <cstdarg> and "target-select.h".
8629 (vexplain_no_incremental): New function.
8630 (explain_no_incremental): New function.
8631 (Incremental_binary::error): New method.
8632 (Sized_incremental_binary::do_find_incremental_inputs_section): New
8634 (make_sized_incremental_binary): New function.
8635 (open_incremental_binary): New function.
8636 (can_incrementally_link_file): Add checks if output is ELF and has
8638 * incremental.h: Include "elfcpp_file.h" and "output.h".
8639 (Incremental_binary): New class.
8640 (Sized_incremental_binary): New class.
8641 (open_incremental_binary): Declare.
8642 * object.cc (is_elf_object): Use
8643 elfcpp::Elf_recognizer::is_elf_file.
8644 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
8645 * output.h (Output_file::filesize): New method.
8647 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8649 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
8651 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
8652 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
8654 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
8656 (Arm_relocate_functions::movw_abs_nc): New function.
8657 (Arm_relocate_functions::movt_abs): New function.
8658 (Arm_relocate_functions::thm_movw_abs_nc): New function.
8659 (Arm_relocate_functions::thm_movt_abs): New function.
8660 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
8661 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
8662 (Scan::global): Likewise.
8663 (Relocate::relocate): Likewise.
8664 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8666 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8668 * arm.cc (Arm_relocate_functions::got_prel) New function.
8669 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
8670 (Relocate::relocate): Likewise.
8671 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8673 2009-10-06 Ian Lance Taylor <iant@google.com>
8675 * options.h (class General_options): Define
8676 split_stack_adjust_size parameter.
8677 * object.h (class Object): Add uses_split_stack_ and
8678 has_no_split_stack_ fields. Add uses_split_stack and
8679 has_no_split_stack accessor functions. Declare
8680 handle_split_stack_section.
8681 (class Reloc_symbol_changes): Define.
8682 (class Sized_relobj): Define Function_offsets. Declare
8683 split_stack_adjust, split_stack_adjust_reltype, and
8685 * object.cc (Object::handle_split_stack_section): New function.
8686 (Sized_relobj::do_layout): Call handle_split_stack_section.
8687 * dynobj.cc (Sized_dynobj::do_layout): Call
8688 handle_split_stack_section.
8689 * reloc.cc (Sized_relobj::relocate_sections): Call
8690 split_stack_adjust for executable sections in split_stack
8691 objects. Pass reloc_map to relocate_section.
8692 (Sized_relobj::split_stack_adjust): New function.
8693 (Sized_relobj::split_stack_adjust_reltype): New function.
8694 (Sized_relobj::find_functions): New function.
8695 * target-reloc.h: Include "object.h".
8696 (relocate_section): Add reloc_symbol_changes parameter. Change
8698 * target.h (class Target): Add calls_non_split method. Declare
8699 do_calls_non_split virtual method. Declare match_view and
8701 * target.cc: Include "elfcpp.h".
8702 (Target::do_calls_non_split): New function.
8703 (Target::match_view): New function.
8704 (Target::set_view_to_nop): New function.
8705 * gold.cc (queue_middle_tasks): Give an error if mixing
8706 split-stack and non-split-stack objects with -r.
8707 * i386.cc (Target_i386::relocate_section): Add
8708 reloc_symbol_changes parameter.
8709 (Target_i386::do_calls_non_split): New function.
8710 * x86_64.cc (Target_x86_64::relocate_section): Add
8711 reloc_symbol_changes parameter.
8712 (Target_x86_64::do_calls_non_split): New function.
8713 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
8715 * powerpc.cc (Target_powerpc::relocate_section): Add
8716 reloc_symbol_changes parameter.
8717 * sparc.cc (Target_sparc::relocate_section): Add
8718 reloc_symbol_changes parameter.
8719 * configure.ac: Call AM_CONDITIONAL for the default target.
8720 * configure: Rebuild.
8721 * testsuite/Makefile.am (TEST_AS): New variable.
8722 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
8723 (check_DATA): Add split_i386 and split_x86_64 files.
8724 (SPLIT_DEFSYMS): Define.
8725 (split_i386_[1234n].o): New targets.
8726 (split_i386_[124]): New targets.
8727 (split_i386_[1234r].stdout): New targets.
8728 (split_x86_64_[1234n].o): New targets.
8729 (split_x86_64_[124]): New targets.
8730 (split_x86_64_[1234r].stdout): New targets.
8731 (MOSTLYCLEANFILES): Add new executables.
8732 * testsuite/split_i386.sh: New file.
8733 * testsuite/split_x86_64.sh: New file.
8734 * testsuite/split_i386_1.s: New file.
8735 * testsuite/split_i386_2.s: New file.
8736 * testsuite/split_i386_3.s: New file.
8737 * testsuite/split_i386_4.s: New file.
8738 * testsuite/split_i386_n.s: New file.
8739 * testsuite/split_x86_64_1.s: New file.
8740 * testsuite/split_x86_64_2.s: New file.
8741 * testsuite/split_x86_64_3.s: New file.
8742 * testsuite/split_x86_64_4.s: New file.
8743 * testsuite/split_x86_64_n.s: New file.
8744 * testsuite/testfile.cc (Target_test): Update relocation_section
8746 * testsuite/Makefile.in: Rebuild.
8748 2009-10-06 Ian Lance Taylor <iant@google.com>
8750 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
8751 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
8752 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
8753 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
8754 the address on ldo_addrs_.
8755 (Target_i386::Relocate::fix_up_ldo): New function.
8757 2009-10-06 Rafael Espindola <espindola@google.com>
8759 * plugin.cc (add_input_library): New.
8760 (Plugin::load): Add add_input_library to tv.
8761 (Plugin_manager::add_input_file): Add the is_lib argument.
8762 (add_input_file): Update call to Plugin_manager::add_input_file.
8763 (add_input_library): New.
8764 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
8766 2009-09-30 Doug Kwan <dougkwan@google.com>
8768 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
8769 symbol and call Symbol::may_need_copy_reloc to determine if
8770 a copy reloc is needed.
8771 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
8772 nocopyreloc is given in command line.
8773 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
8774 given in command line.
8775 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
8776 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
8777 of the removed Target_i386::may_need_copy_reloc.
8778 * options.h (copyreloc): New option with default value false.
8779 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8780 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
8781 instead of the removed Target_powerpc::may_need_copy_reloc.
8782 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8783 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
8784 instead of the removed Target_sparc::may_need_copy_reloc.
8785 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
8786 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
8787 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
8788 instead of the removed Target_x86_64::may_need_copy_reloc.
8790 2009-09-30 Ian Lance Taylor <iant@google.com>
8792 * object.h (class Object): Remove target_ field, and target,
8793 sized_target, and set_target methods.
8794 (Object::sized_target): Remove.
8795 (class Sized_relobj): Update declarations. Remove sized_target.
8796 * object.cc (Sized_relobj::setup): Remove target parameter.
8798 (Input_objects::add_object): Don't do anything with the target.
8799 (make_elf_sized_object): Add punconfigured parameter. Change all
8800 callers. Set or test parameter target.
8801 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
8803 * parameters.cc (Parameters::set_target): Change parameter type to
8805 (Parameters::default_target): Remove.
8806 (set_parameters_target): Change parameter type to be non-const.
8807 (parameters_force_valid_target): New function.
8808 (parameters_clear_target): New function.
8809 * parameters.h (class Parameters): Update declarations. Remove
8810 default_target method. Add sized_target and clear_target
8811 methods. Change target_ to be non-const.
8812 (set_parameters_target): Update declaration.
8813 (parameters_force_valid_target): Declare.
8814 (parameters_clear_target): Declare.
8815 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
8816 as NULL if we aren't searching.
8817 (Add_symbols::run): Don't check for compatible target.
8818 * fileread.cc (Input_file::open_binary): Call
8819 parameters_force_valid_target.
8820 * gold.cc (queue_middle_tasks): Likewise.
8821 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
8822 set_target on object.
8823 * dynobj.h (class Sized_dynobj): Update declarations.
8824 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
8825 make_elf_object returns NULL.
8826 (Archive::include_member): Don't check whether object target is
8828 * output.cc (Output_section::add_input_section): Get target from
8830 (Output_section::relax_input_section): Likewise.
8831 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
8833 (Sized_relobj::do_scan_relocs): Likewise.
8834 (Sized_relobj::relocate_sections): Likewise.
8835 * resolve.cc (Symbol_table::resolve): Likewise.
8836 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
8837 parameter. Change all callers.
8838 (Symbol_table::add_from_object): Get target from parameters.
8839 (Symbol_table::add_from_relobj): Don't check object target.
8840 (Symbol_table::add_from_dynobj): Likewise.
8841 (Symbol_table::define_special_symbol): Get target from
8843 * symtab.h (class Symbol_table): Update declaration.
8844 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
8845 parameter. Change all callers. Clear parameter target.
8846 (Binary_test): Test target here.
8847 * testsuite/object_unittest.cc (gold_testsuite): Remove
8848 target_test_pointer parameter. Change all callers.
8849 (Object_test): Test target here.
8851 2009-09-26 Ian Lance Taylor <iant@google.com>
8853 * testsuite/initpri1.c: Don't try to use constructor priorities if
8854 compiling with gcc before 4.3.
8856 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
8858 * testsuite/retain_symbols_file_test.sh (check_present): Change
8859 output file name to retain_symbols_file_test.stdout.
8860 (check_absent): Likewise.
8862 2009-09-18 Craig Silverstein <csilvers@google.com>
8864 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
8865 * options.cc: Include <cerrno> and <fstream>.
8866 (General_options::finalize): Parse -retain-symbols-file tag.
8867 * options.h: New flag.
8868 (General_options): New method should_retain_symbol, new
8869 variable symbols_to_retain.
8870 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
8871 should_retain_symbol map.
8872 * testsuite/Makefile.am (retain_symbols_file_test): New test.
8873 * testsuite/Makefile.in: Regenerate.
8874 * testsuite/retain_symbols_file_test.sh: New file.
8876 2009-09-18 Nick Clifton <nickc@redhat.com>
8878 * po/es.po: Updated Spanish translation.
8880 2009-09-17 Doug Kwan <dougkwan@google.com>
8882 * debug.h (DEBUG_RELAXATION): New constant.
8883 (DEBUG_ALL): Add DEBUG_RELAXATION.
8884 (debug_string_to_enum): Add relaxation debug option.
8886 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
8887 Layout::Relaxation_debug_check::read_sections,
8888 Layout::Relaxation_debug_check::read_sections): New method definitions.
8889 (Layout::Layout): Initialize data members
8890 record_output_section_data_from_scrips_,
8891 script_output_section_data_list_ and relaxation_debug_check_.
8892 (Layout::save_segments, Layout::restore_segments,
8893 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8894 Layout::relaxation_loop_body): New method definitions.
8895 (Layout::finalize): Support relaxation. Move section layout code to
8896 Layout::relaxation_loop_body.
8897 (Layout::set_asection_address_from_script): Move code for orphan
8898 section placement out.
8899 (Layout::place_orphan_sections_in_script): New method definition.
8900 * layout.h (Output_segment_headers, Output_file_header):
8901 New forward class declarations.
8902 (Layout::~Layout): Define.
8903 (Layout::new_output_section_data_from_script): New method definition.
8904 (Layout::place_orphan_sections_in_script): New method declaration.
8905 (Layout::Segment_states): New type declaration.
8906 (Layout::save_segments, Layout::restore_segments,
8907 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8908 Layout::relaxation_loop_body): New method declarations.
8909 (Layout::Output_section_data_list): New type declaration.
8910 (Layout::Relaxation_debug_check): New class definition.
8911 (Layout::record_output_section_data_from_script_,
8912 Layout::script_output_section_data_list_, Layout::segment_states_,
8913 Layout::relaxation_debug_check_): New data members.
8914 * output.cc: (Output_section_headers::do_size): New method definition.
8915 (Output_section_headers::Output_section_headers): Move size
8916 computation to Output_section_headers::do_size.
8917 (Output_segment_headers::do_size): New method definition.
8918 (Output_file_header::Output_file_header): Move size computation to
8919 Output_file_header::do_size and call it.
8920 (Output_file_header::do_size): New method definition.
8921 (Output_data_group::Output_data_group): Adjust call to
8922 Output_section_data.
8923 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
8924 (Output_symtab_xindex::do_write): Add array bound check.
8925 (Output_section::Input_section::print_to_mapfile): Handle
8926 RELAXED_INPUT_SECTION_CODE.
8927 (Output_section::Output_section): Initialize data member checkpoint_.
8928 (Output_section::~Output_section): Delete checkpoint object pointed
8930 (Output_section::add_input_section): Always add an Input_section if
8932 (Output_section::add_merge_input_section): Add assert.
8933 (Output_section::relax_input_section): New method definition.
8934 (Output_section::set_final_data_size): Set load address to zero for
8935 an unallocated section.
8936 (Output_section::do_address_and_file_offset_have_reset_values):
8937 New method definition.
8938 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
8939 Handle relaxed input section.
8940 (Output_section::sort_attached_input_sections): Checkpoint input
8941 section list lazily.
8942 (Output_section::get_input_sections): Change type of input_sections to
8943 list of Simple_input_section pointers. Checkpoint input section list
8944 lazily. Also handle relaxed input sections.
8945 (Output_section::add_input_section_for_script): Take a reference to
8946 a Simple_input_section object instead of Relobj pointer and section
8947 index as parameter. Handle relaxed input sections.
8948 (Output_section::save_states, Output_section::restore_states): New
8950 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
8951 (Output_data::is_data_size_fixed): New method definition.
8952 (Output_data::reset_addresss_and_file_offset): Do not reset data size
8954 (Output_data::address_and_file_offset_have_reset_values): New method
8956 (Output_data::do_address_and_file_offset_have_reset_values): New method
8958 (Output_data::set_data_size): Check that data size is not fixed.
8959 (Output_data::fix_data_size): New method definition.
8960 (Output_data::is_data_size_fixed_): New data member.
8961 (Output_section_headers::set_final_data_size): New method definition.
8962 (Output_section_headers::do_size): New method declaration.
8963 (Output_segment_headers::set_final_data_size): New method definition.
8964 (Output_segment_headers::do_size): New method declaration.
8965 (Output_file_header::set_final_data_size)::New method definition.
8966 (Output_file_header::do_size)::New method declaration.
8967 (Output_section_data::Output_section_data): Add new parameter
8968 is_data_size_fixed and use it to fix data size.
8969 (Output_data_const::Output_data_const): Adjust call to base class
8970 constructor and fix data size.
8971 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
8972 base class constructor and fix data size.
8973 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
8974 base class constructor and fix data size.
8975 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
8976 class constructor and fix data size.
8977 (Output_data_group::set_final_data_size): New method definition.
8978 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
8979 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
8980 class constructor and fix data size.
8981 (Output_relaxed_input_section): New class definition.
8982 (Output_section::Simple_input_section): New class definition.
8983 (Output_section::get_input_sections): Adjust parameter list.
8984 (Output_section::add_input_section_for_script): Same.
8985 (Output_section::save_states, Output_section::restore_states,
8986 Output_section::do_address_and_file_offset_have_reset_values,
8987 (Output_section::Input_section::Input_section): Handle
8988 RELAXED_INPUT_SECTION_CODE. Add new overload for
8989 Output_relaxed_input_section.
8990 (Output_section::Input_section::is_input_section,
8991 Output_section::Input_section::set_output_section): Handle relaxed
8993 (Output_section::Input_section::is_relaxed_input_section,
8994 Output_section::Input_section::output_section_data,
8995 Output_section::Input_section::relaxed_input_section): New method
8997 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
8999 (Output_section::Input_section::u1_): Update comments.
9000 (Output_section::Input_section::u2_): Add new union member poris.
9001 (Output_section::Checkpoint_output_section): New classs definition.
9002 (Output_section::relax_input_section): New method declaration.
9003 (Output_section::checkpoint_): New data member.
9004 (Output_segment): Update comments.
9005 (Output_segment::Output_segment): Un-privatize copy constructor.
9006 (Output_segment::operator=): Un-privatize.
9007 * script-sections.cc (Output_section_element::Input_section_list):
9008 Change element type to Output_section::Simple_input_section.
9009 (Output_section_element_dot_assignment::set_section_addresses):
9010 Register output section data for relaxation clean up.
9011 (Output_data_exression::Output_data_expression): Adjust call to base
9012 constructor to fix data size.
9013 (Output_section_element_data::set_section_addresses): Register
9014 Output_data_expression object for relaxation clean up.
9015 (struct Input_section_info): Replace Relobj pointer and section index
9016 pair with Output_section::Simple_input_section and Convert struct to a
9018 (Input_section_sorter::operator()): Adjust access to
9019 Input_section_info data member to use accessors.
9020 (Output_section_element_input::set_section_addresses): Use layout
9021 parameter. Adjust code to use Output_section::Simple_input_section
9022 and Input_secction_info classes. Register filler for relaxation
9024 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
9025 and section index pair with Output_section::Simple_input_section
9026 class. Adjust code accordingly.
9027 (Phdrs_element::release_segment): New method definition.
9028 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
9030 (Script_sections::release_segments): New method definition.
9031 * gold/script-sections.h (Script_sections::release_segments): New
9033 * gold/target.h (Target::may_relax, Target::relax,
9034 Target::do_may_relax, Target::do_relax): New method definitions.
9036 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9038 * arm.cc (has_signed_unsigned_overflow): New function.
9039 (Arm_relocate_functions::abs8): New function.
9040 (Target_arm::Scan::local): Handle R_ARM_ABS8.
9041 (Target_arm::Scan::global): Likewise.
9042 (Target_arm::relocate::relocate): Likewise.
9043 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9046 2009-09-16 Cary Coutant <ccoutant@google.com>
9048 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
9049 * testsuite/Makefile.in: Regenerate.
9051 2009-09-11 Nick Clifton <nickc@redhat.com>
9053 * po/gold.pot: Updated by the Translation project.
9055 2009-09-08 Cary Coutant <ccoutant@google.com>
9057 * output.cc (Output_file::open): Add execute permission to empty file.
9058 * testsuite/Makefile.am (permission_test): New test.
9059 * testsuite/Makefile.in: Regenerate.
9061 2009-09-02 Ian Lance Taylor <iant@google.com>
9063 * output.cc (Output_file::resize): Call map_no_anonymous rather
9066 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
9068 * gold.cc: Include "incremental.h".
9069 (queue_initial_tasks): Call Incremental_checker methods.
9070 * incremental.cc: Include "output.h".
9071 (Incremental_checker::can_incrementally_link_output_file): New
9073 * incremental.h (Incremental_checker): New class.
9075 * output.cc (Output_file::open_for_modification): New method.
9076 (Output_file::map_anonymous): Changed return type to bool. Record
9078 (Output_file::map_no_anonymous): New method, broken out of map.
9079 (Output_file::map): Use map_no_anonymous and map_anonymous.
9080 * output.h (class Output_file): Update declarations.
9082 2009-08-24 Cary Coutant <ccoutant@google.com>
9084 * options.h (Command_line::Pre_options): New class.
9085 (Command_line::pre_options): New member.
9086 * options.cc (gold::options::ready_to_register): New variable.
9087 (One_option::register_option): Do nothing if not registering options.
9088 Assert if same short option registered twice.
9089 (General_options::General_options): Turn off option registration when
9091 (Command_line::Pre_options::Pre_options): New constructor.
9093 2009-08-24 Cary Coutant <ccoutant@google.com>
9095 * options.h (General_options::no_keep_memory): Remove incorrect
9098 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9100 * Makefile.am (am__skiplex, am__skipyacc): New.
9101 * Makefile.in: Regenerate.
9103 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9105 * Makefile.am (AM_CPPFLAGS): Renamed from ...
9106 (INCLUDES): ... this.
9107 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
9108 (AM_CPPFLAGS): Renamed from ...
9109 (INCLUDE): ... this.
9110 * Makefile.in, testsuite/Makefile.in: Regenerate.
9112 * Makefile.in: Regenerate.
9113 * aclocal.m4: Likewise.
9114 * config.in: Likewise.
9115 * configure: Likewise.
9116 * testsuite/Makefile.in: Likewise.
9118 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9119 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9120 * Makefile.in: Regenerate.
9121 * testsuite/Makefile.in: Regenerate.
9123 2009-08-19 Cary Coutant <ccoutant@google.com>
9125 * resolve.cc (Symbol_table::resolve): Don't complain about defined
9126 symbols in shared libraries overridden by hidden or internal symbols
9127 in the main program.
9129 2009-08-19 Chris Demetriou <cgd@google.com>
9131 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
9132 checking source file names in error messages.
9134 2009-08-18 Doug Kwan <dougkwan@google.com>
9136 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
9137 an elcpp::Ehdr as parameter. Adjust call to set_target.
9138 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
9139 an elfcpp::Ehdr as parameter.
9140 * object.cc (Object::set_target): Remove the version that looks up
9141 a target and sets it.
9142 (Sized_relobj::setup): Take a Target object instead of
9143 an elfcpp::Ehdr as parameter. Adjust call to set_target.
9144 (make_elf_sized_object): Find target and ask target to
9146 * object.h: (Object::set_target): Remove the version that looks up
9147 a target and sets it.
9148 (Sized_relobj::setup): Take a Target object instead of
9149 an elfcpp:Ehdr as parameter.
9150 * target.cc: Include dynobj.h.
9151 (Target::do_make_elf_object_implementation): New.
9152 (Target::do_make_elf_object): New.
9153 * target.h (Target::make_elf_object): New template declaration.
9154 (Target::do_make_elf_object): New method declarations.
9155 (Target::do_make_elf_object_implementation): New template declaration.
9157 2009-08-14 Ian Lance Taylor <iant@google.com>
9159 * gold.h (FUNCTION_NAME): Define.
9160 (gold_unreachable): Use FUNCTION_NAME.
9162 2009-08-12 Sriraman Tallam <tmsriram@google.com>
9164 * icf.cc (Icf::find_identical_sections): Issue a warning when a
9165 symbol in the --keep-unique list is not found.
9167 2009-08-12 Sriraman Tallam <tmsriram@google.com>
9169 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
9170 been maked as --keep-unique.
9171 (Icf::unfold_section): New function.
9172 * icf.h (Icf::unfold_section): New function.
9173 * options.h (General_options::keep_unique): New option.
9174 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
9175 * testsuite/Makefile.in: Regenerate.
9176 * testsuite/icf_keep_unique_test.sh: New file.
9177 * testsuite/icf_keep_unique_test.cc: New file.
9179 2009-08-12 Cary Coutant <ccoutant@google.com>
9182 * resolve.cc (Symbol_table::resolve): Check for references from
9183 dynamic objects to hidden and internal symbols.
9184 * testsuite/Makefile.am (hidden_test.sh): New test.
9185 * testsuite/Makefile.in: Regenerate.
9186 * testsuite/hidden_test.sh: New script.
9187 * testsuite/hidden_test_1.c: New test source.
9188 * testsuite/hidden_test_main.c: New test source.
9190 2009-08-11 Doug Kwan <dougkwan@google.com>
9192 * arm.cc: Update comments.
9193 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
9194 segment to locate the .ARM.exidx section if present.
9196 2009-08-09 Doug Kwan <dougkwan@google.com>
9198 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
9201 2009-08-07 Sriraman Tallam <tmsriram@google.com>
9202 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
9205 2009-08-06 Sriraman Tallam <tmsriram@google.com>
9207 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
9208 valid tls_segment only for non-debug-section relocations.
9209 * testsuite/Makefile.am: Add gc_tls_test.
9210 * testsuite/Makefile.in: Regenerate.
9211 * testsuite/gc_tls_test.cc: New file.
9212 * testsuite/gc_tls_test.sh: New file.
9214 2009-08-05 Sriraman Tallam <tmsriram@google.com>
9218 * Makefile.am (CCFILES): Add icf.cc.
9220 * Makefile.in: Regenerate.
9221 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
9222 * gc.h (gc_process_relocs): Populate lists used by icf to contain
9223 section, symbol and addend information for the relocs.
9224 * gold.cc (queue_middle_tasks): Call identical code folding.
9225 * gold.h: Add defines for multimap.
9226 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
9227 to the call of finalize_local_symbols.
9228 * main.cc (main): Create object of class Icf.
9229 * object.cc (Sized_relobj::do_layout): Allow this function to be
9230 called twice during icf.
9231 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
9232 to sections marked as identical by icf.
9233 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
9235 (Sized_relobj::do_section_entsize): New function.
9236 * object.h (Object::section_entsize): New function.
9237 (Object::do_section_entsize): New pure virtual function.
9238 (Relobj::finalize_local_symbols): Add new parameter.
9239 (Relobj::do_section_entsize): New function.
9240 * options.h (General_options::icf): New option.
9241 (General_options::icf_iterations): New option.
9242 (General_options::print_icf_sections): New option.
9243 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
9244 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
9245 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
9247 * symtab.cc (Symbol_table::is_section_folded): New function.
9248 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
9249 to sections marked as identical by icf.
9250 * symtab.h (Symbol_table::set_icf): New function.
9251 (Symbol_table::icf): New function.
9252 (Symbol_table::is_section_folded): New function.
9253 (Symbol_table::icf_): New data member.
9254 * target-reloc.h (relocate_section): Ignore sections folded by icf.
9255 * testsuite/Makefile.am: Add commands to build icf_test.
9256 * testsuite/Makefile.in: Regenerate.
9257 * testsuite/icf_test.sh: New file.
9258 * testsuite/icf_test.cc: New file.
9260 2009-07-24 Chris Demetriou <cgd@google.com>
9262 * layout.cc (is_compressible_debug_section): Fix incorrect
9263 comment about compressed section names.
9265 2009-07-20 Ian Lance Taylor <ian@airs.com>
9268 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
9270 2009-07-16 Ian Lance Taylor <iant@google.com>
9273 * layout.h: #include <map>.
9274 (class Kept_section): Change from struct to class. Add accessors
9275 and setters. Add section size to Comdat_group mapping. Change
9276 Comdat_group to std::map. Add is_comdat_ field. Add
9277 linkonce_size field in union.
9278 (class Layout): Update declaration of find_or_add_kept_section.
9279 Don't declare find_kept_object.
9280 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
9281 parameter. Add object, shndx, is_comdat, and is_group_name
9282 parameters. Change all callers. Adjust for new Kept_section.
9283 (Layout::find_kept_object): Remove.
9284 * object.cc (Sized_relobj::include_section_group): Update use of
9285 Kept_section. Rename secnum to shndx. Only record
9286 Kept_comdat_section if sections are the same size.
9287 (Sized_relobj::include_linkonce_section): Update use of
9288 Kept_section. Only record Kept_comdat_section if sections are the
9289 same size. Set size of linkonce section.
9290 (Sized_relobj::map_to_kept_section): Update call to
9291 get_kept_comdat_section.
9292 * object.h (class Sized_relobj): Rename fields in
9293 Kept_comdat_section to drop trailing underscores; change object
9294 field to Relobj*. Change Kept_comdat_section_table to store
9295 struct rather than pointer.
9296 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
9297 Add kept_object and kept_shndx parameters. Change all callers.
9298 (Sized_relobj::get_kept_comdat_section): Change return type to
9299 bool. Add kept_object and kept_shndx parameters. Change all
9301 * plugin.cc (Pluginobj::include_comdat_group): Update call to
9302 Layout::find_or_add_kept_section.
9304 2009-07-09 Ian Lance Taylor <iant@google.com>
9306 * merge.cc (Object_merge_map::initialize_input_to_output_map):
9307 Reserve space in the hash table.
9309 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
9311 * fileread.cc (File_read::get_mtime): New method.
9312 * fileread.h (Timespec): New structure.
9313 (File_read::get_mtime): New method.
9314 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
9315 Renamed from timestamp_nsec.
9316 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
9318 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
9320 (Incremental_inputs::report_archive): Save mtime; style fix.
9321 (Incremental_inputs::report_obejct): Save mtime; style fix.
9322 (Incremental_inputs::report_script): Save mtime; style fix.
9323 (Incremental_inputs::finalize_inputs): Style fix.
9324 (Incremental_inputs::finalize): Style fix.
9325 (Incremental_inputs::create_input_section_data): Store inputs
9327 * incremental.h (Incremental_inputs::report_script): Add mtime
9329 (Incremental_inputs::Input_info::Input_info): Intialize only one
9331 (Incremental_inputs::Input_info::archive): Move to nameless
9333 (Incremental_inputs::Input_info::obejct): Move to nameless union.
9334 (Incremental_inputs::Input_info::script): Move to nameless union.
9335 (Incremental_inputs::mtime): New field.
9336 * script.cc (read_input_script): Pass file mtime to
9338 * script.h (Script_info::inputs): Style fix.
9340 2009-07-01 Ian Lance Taylor <ian@airs.com>
9342 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
9345 2009-06-24 Ian Lance Taylor <iant@google.com>
9348 * layout.cc (Layout::choose_output_section): If we find an
9349 existing section, update the flags.
9350 (Layout::create_notes): New function, broken out of
9352 (Layout::finalize): Don't create note sections.
9353 (Layout::create_note): Don't crash if linker script discards
9355 (Layout::create_gold_note): Likewise.
9356 (Layout::create_build_id): Likewise. Don't set
9357 after_input_sections on the section.
9358 (Layout::create_executable_stack_info): Remove target parameter.
9360 * layout.h (class Layout): Declare create_notes. Update
9361 declaration of create_executable_stack_info.
9362 * gold.cc (queue_middle_tasks): Call create_notes.
9363 * output.cc (Output_section::update_flags_for_input_section): Move
9364 here from output.h. If SHF_ALLOC flag is newly set, mark address
9366 * output.h (Output_data::mark_address_invalid): New function.
9367 (class Output_section): Only declare, not define,
9368 update_flags_for_input_section. Remove set_flags.
9370 2009-06-24 Ian Lance Taylor <iant@google.com>
9372 * script-sections.cc (Output_section_definition::
9373 set_section_addresses): Rename shadowing local load_address to
9376 2009-06-24 Ian Lance Taylor <iant@google.com>
9379 * reloc.cc (relocate_sections): Skip empty relocation sections.
9381 2009-06-23 Ian Lance Taylor <iant@google.com>
9384 * layout.cc (Layout::create_note): Use choose_output_section
9385 rather than make_output_section.
9387 2009-06-23 Ian Lance Taylor <iant@google.com>
9390 * options.cc (General_options::parse_V): Set printed_version_.
9391 (General_options::General_options): Initialize printed_version_.
9392 * options.h (class General_options): Add printed_version_ field.
9393 * gold.cc (queue_initial_tasks): If there are no input files,
9394 don't give a fatal error if we printed the version information.
9395 (queue_middle_tasks): If using -r with a shared object, give a
9396 fatal error rather than an ordinary error.
9398 2009-06-23 Ian Lance Taylor <iant@google.com>
9401 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
9402 (Layout::make_output_section): Set have_stabstr_section_ if we see
9403 a .stab*str section.
9404 (Layout::finalize): Call link_stabs_sections.
9405 (Layout::link_stabs_sections): New file.
9406 * layout.h (class Layout): Add have_stabstr_section_ field.
9407 Declare link_stabs_sections.
9409 2009-06-23 Doug Kwan <dougkwan@google.com>
9411 * Makefile.am (libgold_a_LIBADD): New.
9412 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
9413 * Makefile.in: Regenerate.
9414 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
9415 * configure: Regenerate.
9416 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
9417 * fileread.cc: Include sys/state.h
9418 * gold.h: Declare memmem and strndup if found missing.
9419 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
9421 2009-06-23 Ian Lance Taylor <iant@google.com>
9423 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
9424 * configure: Rebuild.
9426 2009-06-23 Ian Lance Taylor <iant@google.com>
9429 * object.cc (Object::section_contents): Don't try to get a view if
9430 the section has length zero.
9431 (Object::handle_gnu_warning_section): If the section is empty, use
9432 the name of the section as the warning.
9434 2009-06-23 Ian Lance Taylor <iant@google.com>
9437 * stringpool.h (class Stringpool_template): Add optimize_ field.
9438 (Stringpool_template::set_optimize): New function.
9439 * stringpool.cc (Stringpool_template::Stringpool_template):
9440 Initialize optimize_ field.
9441 (Stringpool_template::set_string_offsets): Test local optimize
9442 fild rather than parameter.
9443 * layout.cc (Layout::Layout): Call set_optimize on the section
9446 2009-06-22 Ian Lance Taylor <iant@google.com>
9449 * yyscript.y: Parse TARGET.
9450 * script.cc (script_set_target): New function.
9451 * script-c.h (script_set_target): Declare.
9452 * options.cc (General_options::string_to_object_format): Rename
9453 from string_to_object_format in anonymous namespace. Change
9455 * options.h (class General_options): Declare
9456 string_to_object_format.
9458 2009-06-22 Ian Lance Taylor <iant@google.com>
9460 * script-sections.cc (Script_sections::create_segments): Don't put
9461 program headers in a PT_LOAD segment if -n or -N.
9463 2009-06-22 Ian Lance Taylor <iant@google.com>
9466 * options.h (class General_options): Add -z lazy and -z now. Sort
9467 -z options into alphabetical order.
9468 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
9470 2009-06-21 Ian Lance Taylor <iant@google.com>
9472 * layout.cc (Layout::make_output_section): Call
9473 Target::new_output_section.
9474 (Layout::attach_allocated_section_to_segment): Put large section
9475 sections in a separate load segment with the large segment flag
9477 (Layout::segment_precedes): Sort large data segments after other
9479 (align_file_offset): New static function.
9480 (Layout::set_segment_offsets): Use align_file_offset.
9481 * output.h (class Output_section): Add is_small_section_ and
9482 is_large_section_ fields.
9483 (Output_section::is_small_section): New function.
9484 (Output_section::set_is_small_section): New function.
9485 (Output_section::is_large_section): New function.
9486 (Output_section::set_is_large_section): New function.
9487 (Output_section::is_large_data_section): New function.
9488 (class Output_segment): Add is_large_data_segment_ field.
9489 (Output_segment::is_large_data_segment): New function.
9490 (Output_segment::set_is_large_data_segment): New function.
9491 * output.cc (Output_section::Output_section): Initialize new
9493 (Output_segment::Output_segment): Likewise.
9494 (Output_segment::add_output_section): Add assertion that large
9495 data sections always go in large data segments. Force small data
9496 sections to the end of the list of data sections. Force small BSS
9497 sections to the start of the list of BSS sections. For large BSS
9498 sections to the end of the list of BSS sections.
9499 * symtab.h (class Symbol): Declare is_common_shndx.
9500 (Symbol::is_defined): Check Symbol::is_common_shndx.
9501 (Symbol::is_common): Likewise.
9502 (class Symbol_table): Define enum Commons_section_type. Update
9503 declarations. Add small_commons_ and large_commons_ fields.
9504 * symtab.cc (Symbol::is_common_shndx): New function.
9505 (Symbol_table::Symbol_table): Initialize new fields.
9506 (Symbol_table::add_from_object): Put small and large common
9507 symbols in the right list.
9508 (Symbol_table::sized_finalized_symbol): Check
9509 Symbol::is_common_shndx.
9510 (Symbol_table::sized_write_globals): Likewise.
9511 * common.cc (Symbol_table::do_allocate_commons): Allocate new
9512 common symbol lists. Don't call do_allocate_commons_list if the
9514 (Symbol_table::do_allocate_commons_list): Remove is_tls
9515 parameter. Add comons_section_type parameter. Change all
9516 callers. Handle small and large common symbols.
9517 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
9518 Symbol::is_common_shndx.
9519 * resolve.cc (symbol_to_bits): Likewise.
9520 * target.h (Target::small_common_shndx): New function.
9521 (Target::small_common_section_flags): New function.
9522 (Target::large_common_shndx): New function.
9523 (Target::large_common_section_flags): New function.
9524 (Target::new_output_section): New function.
9525 (Target::Target_info): Add small_common_shndx, large_common_shndx,
9526 small_common_section_flags, and large_common_section_flags
9528 (Target::do_new_output_section): New virtual function.
9529 * arm.cc (Target_arm::arm_info): Initialize new fields.
9530 * i386.cc (Target_i386::i386_info): Likewise.
9531 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
9533 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
9534 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9535 (Target_x86_64::do_new_output_section): New function.
9536 * configure.ac: Define conditional MCMODEL_MEDIUM.
9537 * testsuite/Makefile.am (check_PROGRAMS): Add large.
9538 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
9539 (large_LDFLAGS): Define.
9540 * testsuite/large.c: New file.
9541 * testsuite/testfile.cc (Target_test::test_target_info):
9542 Initialize new fields.
9543 * configure, testsuite/Makefile.in: Rebuild.
9545 2009-06-05 Doug Kwan <dougkwan@google.com>
9547 * Makefile.am (CCFILES): Add target.cc.
9548 * Makefile.in: Regenerate.
9549 * i386.cc (class Target_i386): Define new virtual method to
9550 override do_is_local_label_name in parent.
9551 * object.cc (Sized_relobj::do_count_local_symbols): Discard
9552 local symbols if --discard-locals or -X is given.
9553 * options.h (class General_options): Declare new options
9554 '--discard-locals' and '-X' for discarding locals.
9555 * target.h (class Target): Define new methods is_local_label_name.
9556 Declare new virtual method do_is_local_label_name.
9557 * target.cc: New file.
9558 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
9559 (check_SCRIPTS): Add discard_locals_test.sh.
9560 (check_DATA): Add discard_local_tests.syms.
9561 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
9562 (discard_local_tests.syms, discard_locals_test.o): New make rules.
9563 * testsuite/Makefile.in: Regenerate.
9564 * testsuite/discard_locals_test.c: New file.
9565 * testsuite/discard_locals_test.sh: Same.
9567 2009-06-05 Doug Kwan <dougkwan@google.com>
9569 * object.cc (Sized_relobj::Sized_relobj): Initialize
9570 discarded_eh_frame_shndx_ to -1U.
9571 (Sized_relobj::do_layout): Record index of a discard .eh_frame
9573 (Sized_relobj::do_count_local_symbols): Skip local symbols in
9574 a discarded .eh_frame section.
9575 (Sized_relobj::do_finalize_local_symbols): Ditto.
9576 * object.h (class Sized_relobj): Declare new member
9577 discarded_eh_frame_shndx_.
9578 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
9579 (local_labels_test.o, local_labels_test): New rules.
9580 * testsuite/Makefile.in: Regenerate.
9582 2009-06-04 Doug Kwan <dougkwan@google.com>
9584 * layout.cc (Layout::section_name_mapping): Add mapping for
9585 special ARM sections.
9587 2009-06-03 Doug Kwan <dougkwan@google.com>
9589 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
9590 (utils::has_overflow): Same.
9592 2009-06-03 Ian Lance Taylor <iant@google.com>
9594 * layout.cc (Layout::section_name_mapping): New array, replacing
9595 Layout::linkonce_mapping.
9596 (Layout::section_name_mapping_count): New variable, replacing
9597 Layout::linkonce_mapping_count.
9598 (Layout::linkonce_output_name): Remove.
9599 (Layout::output_section_name): Rewrite.
9600 * layout.h (class Layout): Rename Linkonce_mapping to
9601 Section_name_mapping, linkonce_mapping to section_name_mapping,
9602 linkonce_mapping_count to section_name_mapping_count. Don't
9603 declare linkonce_output_name.
9605 2009-06-03 Doug Kwan <dougkwan@google.com>
9607 * gold/arm.cc (namespace utils): New.
9608 (Target_arm::reloc_is_non_pic): Define new method.
9609 (class Arm_relocate_functions): New.
9610 (Target_arm::Relocate::relocate): Handle relocation types used by
9613 2009-06-03 Ian Lance Taylor <iant@google.com>
9615 * arm.cc (Target_arm::scan::global): Use || instead of |.
9617 2009-06-02 Doug Kwan <dougkwan@google.com>
9619 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
9620 issued_non_pic_error_.
9621 (class Target_arm::Scan): Declare new method check_non_pic.
9622 Define new method symbol_needs_plt_entry.
9623 Declare new data member issued_non_pic_error_.
9624 (class Target_arm::Relocate): Declare new method
9625 should_apply_static_reloc.
9626 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9627 (Target_arm::Scan::check_non_pic): Define new method.
9628 (Target_arm::Scan::local): Handle a small subset of reloc types used
9630 (Target_arm::Scan::local): Same.
9631 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9633 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
9635 * incremental.cc (Incremental_inputs::report_command_line): Filter
9636 out --incremental-* options.
9638 2009-05-29 Doug Kwan <dougkwan@google.com>
9640 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9642 (class Target_arm): Update comment.
9643 (Target_arm::Target_arm): Initialize new data members GOT_,
9644 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
9645 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
9646 and Target_arm::rel_dyn_section.
9647 Declare new_enum Target_arm::Got_type.
9648 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
9650 Update commments for member do_dynsym_value.
9651 (Target_arm::got_size, Target_arm::plt_section,
9652 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
9653 new methods inside class defintion.
9654 (Target_arm::got_section): Define new method.
9655 (Target_arm::rel_dyn_section): Same.
9656 (Output_data_plt_arm): New template class.
9657 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
9658 (Output_data_plt_arm:do_adjust_output_section): Define new method.
9659 (Output_data_plt_arm::add_entry): Same.
9660 (Output_data_plt_arm::first_plt_entry): Define new
9661 static data member for PLT instruction template.
9662 (Output_data_plt_arm::plt_entry): Same.
9663 (Output_data_plt_arm::do_write): Define new method.
9664 (Target_arm::make_plt_entry): Same.
9665 (Target_arm::do_finalize_sections): Same.
9666 (Target_arm::do_dynsym_value): Same.
9668 2009-05-28 Doug Kwan <dougkwan@google.com>
9670 * Makefile.am (TARGETSOURCES): Add arm.cc.
9671 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
9672 * Makefile.in: Regenerate.
9674 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
9676 2009-05-26 Doug Kwan <dougkwan@google.com>
9678 * options.cc (General_options::parse_exclude_libs). Fix a comment.
9679 (General_options::check_excluded_libs): Strip off directories in
9680 archive name before matching like GNU ld does.
9681 * testsuite/Makefile.am (MOSTLYCLEANFILES,
9682 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
9683 (exclude_libs_test_LDFLAGS): Add linker option
9684 -Wl,--exclude-libs,libexclude_libs_test_3
9685 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
9686 an explicit archive without using -l.
9687 (alt/libexclude_libs_test_3.a): New make rule.
9688 * testsuite/Makefile.in: Regenerate.
9689 * testsuite/exclude_libs_test.c : Declare lib3_default().
9691 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
9692 * exclude_libs_test_3.c: New file.
9694 2009-05-26 Nick Clifton <nickc@redhat.com>
9696 * po/id.po: New Indonesian translation.
9697 * po/gold.pot: Updated template file.
9699 2009-05-22 Sriraman Tallam <tmsriram@google.com>
9701 * testsuite/Makefile.am: Add -ffunction-sections to compile
9702 gc_comdat_test files. Add -Wl,--gc-sections to build
9704 * testsuite/Makefile.in: Regenerate.
9705 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
9707 2009-05-21 Sriraman Tallam <tmsriram@google.com>
9709 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
9710 kept comdat section was garbage collected.
9711 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
9712 * testsuite/Makefile.in: Regenerate.
9713 * testsuite/gc_comdat_test.sh: New file.
9714 * testsuite/gc_comdat_test_1.cc: New file.
9715 * testsuite/gc_comdat_test_2.cc: New file.
9717 2009-05-19 Doug Kwan <dougkwan@google.com>
9719 * archive.cc (Archive::Archive): Move constructor from archive.h
9720 to here. Initialize no_export_.
9721 (Archive::get_elf_object_for_member): Set no_export flag of object.
9722 * archive.h (Archive::Archive): Move constructor body to
9724 (Archive::no_export): New method.
9725 (Archive::no_export_): New field.
9726 * object.h (Object::Object): Initialize no_export_ to false.
9727 (Object::no_export, Object::set_no_export): New methods.
9728 (Object::no_export_): New field.
9729 * options.cc (General_options::parse_exclude_libs): New method.
9730 (General_options::check_excluded_libs) Same.
9731 * options.h (exclude_libs): New option.
9732 (General_options::check_excluded_libs): New method declaration.
9733 (General_options::excluded_libs_): New field.
9734 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
9735 default or protected visibility if an object has no-export flag set.
9736 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
9737 (check_SCRIPTS): Add exclude_libs_test.sh.
9738 (check_DATA): Add exclude_libs_test.syms.
9739 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
9740 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
9741 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
9742 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
9743 (exclude_libs_test.syms, libexclude_libs_test_1.a,
9744 libexclude_libs_test_2.a): New rules.
9745 * testsuite/Makefile.in: Regenerate.
9746 * testsuite/exclude_libs_test.c: New file.
9747 * testsuite/exclude_libs_test.sh: Ditto.
9748 * testsuite/exclude_libs_test_1.c: Ditto.
9749 * testsuite/exclude_libs_test_2.c: Ditto.
9751 2009-05-15 Ian Lance Taylor <iant@google.com>
9753 * configure.ac: Check for declarations for cases where libiberty.h
9754 checks HAVE_DECL_xxx.
9755 * configure, config.in: Rebuild.
9757 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
9759 * gold.h (Incremental_argument_list): Remove (invalid) forward
9761 * incremental.cc (Incremental_inputs::report_achive): New method.
9762 (Incremental_inputs::report_object): New method.
9763 (Incremental_inputs::report_script): New method.
9764 (Incremental_inputs::finalize_inputs): New method.
9765 (Incremental_inputs::finalize): Call finalize_inputs().
9766 (Incremental_inputs::sized_create_incremental_inputs_section_data):
9767 Create inputs entries.
9768 * incremental.h (Incremental_input_type): New enum.
9769 (Incremental_inputs::Incremental_input): Initialize new fields.
9770 (Incremental_inputs::report_inputs): New method.
9771 (Incremental_inputs::report_achive): New method.
9772 (Incremental_inputs::report_object): New method.
9773 (Incremental_inputs::report_script): New method.
9774 (Incremental_inputs::finalize_inputs): New method.
9775 (Incremental_inputs::Input_info): New struct.
9776 (Incremental_inputs::Input_info_map): New typedef.
9777 (Incremental_inputs::lock_): New field.
9778 (Incremental_inputs::Inputs_): New field.
9779 (Incremental_inputs::Inputs_map): New field.
9780 * main.cc (main): Call Incremental_input::report_inputs.
9781 * options.h (Input_argument_list): Typedef moved from
9783 (Input_file_group::Files): Remove, use ::Input_argument_list.
9784 (Input_file_group::Input_argument_list): Remove, use
9785 ::Input_argument_list.
9786 * plugin.cc (Plugin_manager::add_input_file): Add error in
9788 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
9790 * script.cc (read_input_script): Call
9791 Incremental_input::report_script.
9792 * script.h (Script_info): New class.
9794 2009-04-27 Ian Lance Taylor <iant@google.com>
9796 * x86_64.cc (do_adjust_output_section): Set entsize to
9799 2009-04-23 Elliott Hughes <enh@google.com>
9801 * output.cc (Output_file::close): After short writes, continue
9802 writing from the correct offset in the buffer being written.
9804 2009-04-23 Chris Demetriou <cgd@google.com>
9806 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
9807 * configure: Regenerate.
9808 * config.in: Regenerate.
9809 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
9810 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
9812 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
9814 * incremental.cc (Incremental_inputs_header_data): Renamed from
9815 Incremental_input_header_data.
9816 (Incremental_inputs_header_data::data_size): New field.
9817 (Incremental_inputs_header_data::put_input_file_count): Renamed
9818 from input_file_count.
9819 (Incremental_inputs_header_data::put_command_line_offset): Renamed
9820 from command_line_offset.
9821 (Incremental_inputs_header_data::put_reserved): Renamed from
9823 (Incremental_inputs_entry_data): Renamed from
9824 Incremental_input_entry_data.
9825 (Incremental_inputs_entry_data::data_size): New field.
9826 (Incremental_inputs::report_command_line): New method.
9827 (Incremental_inputs::finalize): New method.
9828 (Incremental_inputs::create_incremental_inputs_data): New method.
9829 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
9830 * incremental.h: New file.
9831 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
9832 (Layout::finalize): Create incremental inputs section in
9834 (Layout::create_incremental_info_sections): New method.
9835 * layout.h (Layout::incremental_inputs): New method.
9836 (Layout::create_incremental_info_sections): New method.
9837 (Layout::incremental_inputs_): New field.
9838 * main.cc (main): Notify Incremental_input of the command line.
9840 2009-04-01 Ian Lance Taylor <iant@google.com>
9841 Mikolaj Zalewski <mikolajz@google.com>
9843 * gold.h (reserve_unordered_map): Define, three versions, one for
9844 each version of Unordered_map.
9845 * layout.cc (Layout::Layout): Remove options parameter. Add
9846 number_of_input_files parameter. Don't initialize options_.
9847 Initialize number_of_input_files_ and resized_signatures_. Move
9848 sections_are_attached_.
9849 (Layout::layout_group): Reserve space for group_signatures_.
9850 (Layout::find_or_add_kept_section): Change name parameter to be a
9851 reference. Resize signatures_ map when it gets large enough.
9852 (Layout::layout_eh_frame): Use parameters->options() instead of
9854 (Layout::make_output_section): Likewise.
9855 (Layout::attach_allocated_section_to_segment): Likewise.
9856 (Layout::finalize, Layout::create_executable_stack): Likewise.
9857 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
9858 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
9859 * layout.h (class Layout): Update declarations. Remove options_
9860 field. Add number_of_input_files_ and resized_signatures_
9861 fields. Move sections_are_attached_ field.
9862 * main.cc (main): Pass number of input files to Layout
9863 constructor. Don't pass options.
9865 2009-03-30 Ian Lance Taylor <iant@google.com>
9867 * ffsll.c (ffsll): Correct implementation.
9869 2009-03-27 Ian Lance Taylor <iant@google.com>
9871 * ffsll.c: New file.
9872 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
9873 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
9874 * ftruncate.c (ftruncate): Declare before definition.
9875 * mremap.c (mremap): Likewise.
9876 * pread.c (pread): Likewise.
9877 * configure, Makefile.in, config.in: Rebuild.
9879 * mremap.c: New file.
9880 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
9881 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
9882 (mremap): Declare if HAVE_MREMAP is not defined.
9883 * configure, Makefile.in, config.in: Rebuild.
9885 2009-03-27 Cary Coutant <ccoutant@google.com>
9887 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
9888 position independent.
9889 * sparc.cc (Target_sparc::check_non_pic): Likewise.
9890 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
9892 2009-03-24 Cary Coutant <ccoutant@google.com>
9894 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
9896 (needs_dynamic_reloc): Likewise.
9898 2009-03-24 Ian Lance Taylor <iant@google.com>
9900 * yyscript.y (file_cmd): Recognize EXTERN.
9901 (extern_name_list, extern_name_list_body): New nonterminals.
9902 * script.cc (script_add_extern): Define.
9903 * script-c.h (script_add_extern): Declare.
9905 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
9907 * object.cc (is_elf_object): Define.
9908 * object.h (is_elf_object): Declare.
9909 * archive.cc (Archive::get_elf_object_for_member): Call
9911 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
9913 2009-03-24 Elliott Hughes <enh@google.com>
9915 * output.cc (Output_file::map_anonymous): Define.
9916 (Output_file::map): Use map_anonymous. If the regular mmap fails,
9917 try an anonymous one. Report the size if the mmap fails.
9918 * output.h (class Output_file): Declare map_anonymous.
9920 2009-03-24 Ian Lance Taylor <iant@google.com>
9922 * target-select.cc (instantiate_target): Don't acquire the lock if
9923 the instantiated_target_ field has already been set.
9925 2009-03-23 Ian Lance Taylor <iant@google.com>
9927 * gold-threads.h (class Initialize_lock): Define.
9928 * gold-threads.cc (class Initialize_lock_once): Define.
9929 (initialize_lock_control): New static variable.
9930 (initialize_lock_pointer): New static variable.
9931 (initialize_lock_once): New static function.
9932 (Initialize_lock::Initialize_lock): Define.
9933 (Initialize_lock::initialize): Define.
9934 * target-select.h: Include "gold-threads.h".
9935 (class Target_selector): Add lock_ and initialize_lock_ fields.
9936 Don't define instantiate_target, just declare it.
9937 * target-select.cc (Target_selector::Target_selector): Initialize
9939 (Target_selector::instantiate_target): Define.
9940 * descriptors.h: Include "gold-threads.h".
9941 (class Descriptors): Add initialize_lock_ field.
9942 * descriptors.cc (Descriptors::Descriptors): Initialize new
9944 (Descriptors::open): Use initialize_lock_ field
9945 * errors.h (class Errors): Add initialize_lock_ field.
9946 * errors.cc (Errors::Errors): Initialize new field.
9947 (Errors::initialize_lock): Use initialize_lock_ field.
9948 * powerpc.cc (class Target_selector_powerpc): Remove
9949 instantiated_target_ field. In do_recognize call
9950 instantiate_target rather than do_instantiate_target. In
9951 do_instantiate_target just allocate a new target.
9952 * sparc.cc (class Target_selector_sparc): Likewise.
9954 * freebsd.h: New file.
9955 * i386.cc: Include "freebsd.h".
9956 (Target_i386): Derive from Target_freebsd rather than
9958 (Target_selector_i386): Derive from Target_selector_freebsd rather
9959 than Target_selector.
9960 * x86_64.cc: Include "freebsd.h".
9961 (Target_x86_64): Derive from Target_freebsd rather than
9963 (Target_selector_x86_64): Derive from Target_selector_freebsd
9964 rather than Target_selector.
9965 * target.h (class Target): Add adjust_elf_header and
9966 do_adjust_elf_header.
9967 * output.cc (Output_file_header:: do_sized_write): Call target
9968 adjust_elf_header routine.
9969 * configure.tgt: Set targ_osabi.
9970 * configure.ac: Define GOLD_DEFAULT_OSABI.
9971 * parameters.cc (Parameters::default_target): Pass
9972 GOLD_DEFAULT_OSABI to select_target.
9973 * target-select.h (class Target_selector): Make instantiate_target
9974 protected rather than private.
9975 * Makefile.am (HFILES): Add freebsd.h.
9976 * configure, Makefile.in, config.in: Rebuild.
9978 * merge.cc (do_add_input_section): Correct pend value. Change
9979 message about last entry not being null terminated from error to
9982 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
9984 * incremental.cc: New file.
9985 * Makefile.am (CCFILES): Add incremental.cc.
9986 * Makefile.in: Rebuild.
9988 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
9990 * layout.cc (Layout::output_section_name): Preserve names
9991 of '.note.' sections.
9993 2009-03-19 Ian Lance Taylor <iant@google.com>
9995 * descriptors.cc (Descriptors::open): Check that the options are
9996 valid before using them.
9998 2009-03-18 Ian Lance Taylor <iant@google.com>
10000 * script-sections.h: Include <list>.
10001 (class Script_sections): Change Sections_elements from std::vector
10002 to std::list. Typedef public Elements_iterator. Add
10003 orphan_section_placement_, data_segment_align_start_, and
10004 saw_data_segment_align_ fields. Remove data_segment_align_index_
10006 * script-sections.cc (class Orphan_section_placement): New class.
10007 (class Sections_element): Add virtual functions is_relro and
10008 orphan_section_init. Remove virtual function place_orphan_here.
10009 (class Output_section_definition): Add is_relro and
10010 orphan_section_init. Remove place_orphan_here.
10011 (class Orphan_output_section): Likewise.
10012 (Script_sections::Script_sections): Update for field changes.
10013 (Script_sections::data_segment_align): Set saw_data_segment_align_
10014 and data_segment_align_start_, not data_segment_align_index.
10015 (Script_sections::data_segment_relro_end): Check
10016 saw_data_segment_align_. Use data_segment_align_start_ rather
10017 than data_segment_align_index_.
10018 (Script_sections::place_orphan): Rewrite to use
10019 Orphan_section_placement.
10021 2009-03-17 Ian Lance Taylor <iant@google.com>
10023 * archive.cc (Archive::add_symbols): Check for a version attached
10024 to the symbol name in the archive map.
10025 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
10026 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
10027 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
10028 (ver_test_11.a): New target.
10029 * testsuite/Makefile.in: Rebuild.
10031 * configure.ac: Check for chsize and posix_fallocate. Replace
10033 * ftruncate.c: New file, from gnulib.
10034 * output.cc (posix_fallocate): Define dummy version if not
10035 HAVE_POSIX_FALLOCATE.
10036 (Output_file::map): Call posix_fallocate rather than lseek and
10038 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
10039 * configure, Makefile.in, config.in: Rebuild.
10041 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
10043 * layout.h (Layout::create_note): Add section_name parameter.
10044 * layout.cc (Layout::create_note): Likewise.
10045 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
10047 2009-03-17 Ian Lance Taylor <iant@google.com>
10049 * descriptors.cc: Include "options.h".
10050 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
10051 (Descriptors::open): Always use O_CLOEXEC when opening a new
10052 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
10053 then set FD_CLOEXEC.
10055 * sparc.cc (class Target_sparc): Add has_got_section.
10056 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
10057 make sure we have a GOT section.
10059 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
10060 (Target_sparc::Scan::local): Likewise.
10061 (Target_sparc::Scan::global): Likewise.
10062 (Target_sparc::Relocate::relocate): Likewise.
10063 (Target_sparc::Relocate::relocate_tls): Likewise.
10065 * symtab.cc (Symbol_table::define_default_version): New function,
10066 broken out of add_from_object.
10067 (Symbol_table::add_from_object): Call define_default_version.
10068 (Symbol_table::define_special_symbol): Add resolve_oldsym
10069 parameter. Change all callers. If the version for a symbol comes
10070 from a version script, resolve it with the symbol with the same
10071 name with no version. Also add the symbol without a version if
10073 (do_define_in_output_data): If resolving with oldsym, don't delete
10075 (do_define_in_output_segment): Likewise.
10076 (do_define_as_constant): Likewise.
10077 * symtab.h (class Symbol_table): Update declarations.
10079 2009-03-13 Ian Lance Taylor <iant@google.com>
10081 * readsyms.cc (Read_symbols::incompatible_warning): New function.
10082 (Read_symbols::requeue): New function.
10083 (Read_symbols::do_read_symbols): If make_elf_object fails because
10084 the target type is not configured, and the file was searched for,
10085 issue a warning and retry with the next directory.
10086 (Add_symbols::run): If the file has an incompatible format, and
10087 it was searched for, requeue the Read_symbols task. On error,
10088 release the object.
10089 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
10090 dirindex parameter to constructor. Change all callers. Declare
10091 incompatible_warning and requeue.
10092 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
10093 input_argument_ and input_group_ fields. Add them to
10094 constructor. Change all callers.
10095 (class Read_script): Add dirindex_ field. Add it to constructor.
10096 Change all callers.
10097 * archive.cc (Archive::setup): Remove input_objects parameter.
10098 Change all callers.
10099 (Archive::get_file_and_offset): Likewise.
10100 (Archive::read_all_symbols): Likewise.
10101 (Archive::read_symbols): Likewise.
10102 (Archive::get_elf_object_for_member): Remove input_objects
10103 parameter. Add punconfigured parameter. Change all callers.
10104 (Archive::add_symbols): Change return type to bool. Check return
10105 value of include_member.
10106 (Archive::include_all_members): Likewise.
10107 (Archive::include_member): Change return type to bool. Return
10108 false if first included object has incompatible target. Set
10109 included_member_ field.
10110 (Add_archive_symbols::run): If add_symbols returns false, requeue
10112 * archive.h (class Archive): Add included_member_ field.
10113 Initialize it in constructor. Add input_file and searched_for
10114 methods. Update declarations.
10115 (class Add_archive_symbols): Add dirpath_, dirindex_, and
10116 input_argument_ fields. Add them to constructor. Change all
10118 * script.cc: Include "target-select.h".
10119 (class Parser_closure): Add skip_on_incompatible_target_ and
10120 found_incompatible_target_ fields. Add
10121 skip_on_incompatible_target parameter to constructor. Change all
10122 callers. Add methods skip_on_incompatible_target,
10123 clear_skip_on_incompatible_target, found_incompatible_target, and
10124 set_found_incompatible_target.
10125 (read_input_script): Add dirindex parameter. Change all callers.
10126 If parser finds an incompatible target, requeue Read_symbols
10128 (script_set_symbol): Clear skip_on_incompatible_target in
10130 (script_add_assertion, script_parse_option): Likewise.
10131 (script_start_sections, script_add_phdr): Likewise.
10132 (script_check_output_format): New function.
10133 * script.h (read_input_script): Update declaration.
10134 * script-c.h (script_check_output_format): Declare.
10135 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
10136 (ignore_cmd): Remove OUTPUT_FORMAT.
10137 * fileread.cc (Input_file::Input_file): Add explicit this.
10138 (Input_file::will_search_for): New function.
10139 (Input_file::open): Add pindex parameter. Change all callers.
10140 * fileread.h (class Input_file): Add input_file_argument method.
10141 Declare will_search_for. Update declarations.
10142 * object.cc (make_elf_object): Add punconfigured parameter.
10143 Change all callers.
10144 * object.h (class Object): Make input_file public. Add
10145 searched_for method.
10146 (make_elf_object): Update declaration.
10147 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
10149 * dirsearch.h (class Dirsearch): Update declaration.
10150 * options.h (class General_options): Add --warn-search-mismatch.
10151 * parameters.cc (Parameters::is_compatible_target): New function.
10152 * parameters.h (class Parameters): Declare is_compatible_target.
10153 * workqueue.cc (Workqueue::add_blocker): New function.
10154 * workqueue.h (class Workqueue): Declare add_blocker.
10156 * fileread.cc (Input_file::open): Remove options parameter.
10157 Change all callers.
10158 (Input_file::open_binary): Likewise.
10159 * script.cc (read_input_script): Likewise.
10160 * readsyms.h (class Read_symbols): Remove options_ field. Remove
10161 options parameter from constructor. Change all callers.
10162 (class Read_script): Likewise.
10163 * fileread.h (class Input_file): Update declarations.
10164 * script.h (read_input_script): Update declaration.
10166 2009-03-10 Nick Clifton <nickc@redhat.com>
10168 * po/es.po: New Spanish translation.
10170 2009-03-06 Cary Coutant <ccoutant@google.com>
10172 * options.cc (parse_short_option): Keep dash_z from registering itself.
10174 2009-03-03 Ian Lance Taylor <iant@google.com>
10177 * target-reloc.h (relocate_section): Pass output_section to
10179 * i386.cc (Target_i386::should_apply_static_reloc): Add
10180 output_section parameter. Change all callers.
10181 (Target_i386::Relocate::relocate): Add output_section parameter.
10182 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10183 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
10184 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
10185 * testsuite/two_file_shared.sh: New script.
10186 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
10187 (check_DATA): Add two_file_shared.dbg.
10188 (two_file_shared.dbg): New target.
10189 * testsuite/Makefile.in: Rebuild.
10191 2009-03-01 Ian Lance Taylor <iant@google.com>
10193 * configure.ac: Check for byteswap.h.
10194 * configure: Rebuild.
10195 * config.in: Rebuild.
10197 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
10199 * layout.cc (Layout::find_or_add_kept_section): New function.
10200 (Layout::add_comdat): Removed.
10201 * layout.h (struct Kept_section): Move out of class Layout.
10202 Remove trailing underscores from field names. Add group_sections
10203 field. Rename group_ field to is_group. Change all uses.
10204 (class Layout): Declare find_or_add_kept_section, not add_comdat.
10205 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
10206 comdat_groups_ field.
10207 (Sized_relobj::include_section_group): Use
10208 find_or_add_kept_section and Kept_section::group_sections.
10209 (Sized_relobj::include_linkonce_section): Likewise.
10210 * object.cc (class Sized_relobj): Don't define Comdat_group or
10211 Comdat_group_table. Remove find_comdat_group and
10212 add_comdat_group. Remove comdat_groups_ field.
10213 * plugin.cc (include_comdat_group): Use
10214 Layout::find_or_add_kept_section.
10216 2009-02-28 Ian Lance Taylor <iant@google.com>
10218 * README: --gc-sections and map files are now supported. Document
10219 some build requirements.
10222 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
10223 relocatable link set the value of the section symbol to zero.
10224 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
10225 relocatable link don't include the section address in the local
10228 2009-02-27 Ian Lance Taylor <iant@google.com>
10231 * options.h (class Search_directory): Add is_system_directory.
10232 (class General_options): Declare is_in_system_directory.
10233 * options.cc (get_relative_sysroot): Make static.
10234 (get_default_sysroot): Make static.
10235 (General_optoins::is_in_system_directory): New function.
10236 * fileread.cc (Input_file::is_in_system_directory): New function.
10237 * fileread.h (class Input_file): Declare is_in_system_directory.
10238 * object.h (class Object): Add is_in_system_directory.
10239 (class Input_objects): Remove system_library_directory_ field.
10240 * object.cc (Input_objects::add_object): Don't set
10241 system_library_directory_.
10242 (input_objects::found_in_system_library_directory): Remove.
10243 * symtab.cc (Symbol_table::write_globals): Remove input_objects
10244 parameter. Change all callers.
10245 (Symbol_table::sized_write_globals): Likewise.
10246 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
10247 Call Object::is_in_system_directory.
10248 * symtab.h (class Symbol_table): Update declarations.
10251 * descriptors.h (Open_descriptor): Add is_on_stack field.
10252 * descriptors.cc (Descriptors::open): If the descriptor is on the
10253 top of the stack, remove it. Initialize is_on_stack field.
10254 (Descriptors::release): Only add pod to stack if it is not on the
10256 (Descriptors::close_some_descriptor): Clear stack_next and
10257 is_on_stack fields.
10260 * output.cc (Output_section::find_starting_output_address): Rename
10261 from starting_output_address; add PADDR parameter; change return
10263 * output.h (class Output_section): Declare
10264 find_starting_output_address instead of starting_output_address.
10265 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
10266 section symbol for which we can't find a merge section.
10269 * symtab.cc (Symbol_table::add_from_object): If the visibility is
10270 hidden or internal, force the symbol to be local.
10271 * resolve.cc (Symbol::override_visibility): Define.
10272 (Symbol::override_base): Use override_visibility.
10273 (Symbol_table::resolve): Likewise.
10274 (Symbol::override_base_with_special): Likewise.
10275 (Symbol_table::override_with_special): If the visibility is hidden
10276 or internal, force the symbol to be local.
10277 * symtab.h (class Symbol): Add set_visibility and
10278 override_visibility.
10279 * testsuite/ver_test_1.sh: New file.
10280 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
10281 (check_DATA): Add ver_test_1.syms.
10282 (ver_test_1.syms): New target.
10283 * testsuite/Makefile.in: Rebuild.
10285 2009-02-25 Cary Coutant <ccoutant@google.com>
10287 * layout.cc (Layout::choose_output_section): Don't rename sections
10288 when using a linker script that has a SECTIONS clause.
10289 * Makefile.in: Regenerate.
10291 * testsuite/Makefile.am (script_test_5.sh): New test case.
10292 * testsuite/Makefile.in: Regenerate.
10293 * testsuite/script_test_5.cc: New file.
10294 * testsuite/script_test_5.sh: New file.
10295 * testsuite/script_test_5.t: New file.
10297 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
10299 * archive.cc (Archive::include_member): Update calls to add_symbols.
10300 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
10301 the Layout argument.
10302 * dynobj.h (do_add_symbols): Add the Layout argument.
10303 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
10305 * object.h (Object::add_symbols): Add the Layout argument.
10306 (Object::do_add_symbols): Add the Layout argument.
10307 (Sized_relobj::do_add_symbols): Add the Layout argument.
10308 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
10309 Unify the two versions.
10310 (Add_plugin_symbols): Remove.
10311 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
10312 (Sized_pluginobj::do_add_symbols): Unify the two versions.
10313 (Add_plugin_symbols): Remove.
10314 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
10315 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
10316 (Add_symbols::run): Make it work with Pulginobj.
10318 2009-02-06 Ian Lance Taylor <iant@google.com>
10320 * object.cc (Sized_relobj::do_layout): Make info message start
10321 with lower case letter.
10323 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
10325 * binary.cc: Fix file comment.
10327 * options.h (enum Incremental_disposition): Define.
10328 (class General_options): Add new options: --incremental,
10329 --incremental_changed, --incremental_unchanged,
10330 --incremental_unknown. Add incremental_disposition_ and
10331 implicit_incremental_ fields.
10332 (General_options::incremental_disposition): New function.
10333 (class Position_dependent_options): Add incremental_disposition
10335 (Position_dependent_options::copy_from_options): Set incremental
10337 * options.cc (General_options::parse_incremental_changed): New
10339 (General_options::parse_incremental_unchanged): New function.
10340 (General_options::parse_incremental_unknown): New function.
10341 (General_options::General_options): Initialize new fields
10342 incremental_disposition_ and implicit_incremental_.
10343 (General_options::finalize): Check for uasge of --incremental-*
10344 without --incremental.
10346 2009-02-06 Chris Demetriou <cgd@google.com>
10348 * gold.h (gold_undefined_symbol): Change to take only a Symbol
10349 pointer and to report location as the file name associated with
10351 (gold_undefined_symbol_at_location): New function to replace the
10352 old gold_undefined_symbol functionality.
10353 * target-reloc.h (relocate_section): Update to use
10354 gold_undefined_symbol_at_location.
10355 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10356 Call gold_undefined_symbol function rather than gold_error.
10357 * errors.h (Errors::undefined_symbol): Take location as a
10358 string, rather than calculating it from a relocation.
10359 * errors.cc (Errors::fatal): Print "fatal error:" before the
10361 (Errors::error, Errors::error_at_location): Print "error: "
10362 before the formatted message.
10363 (Errors::undefined_symbol): Take location as a string, rather
10364 than calculating it from a relocation.
10365 (gold_undefined_symbol_at_location): New function akin to
10366 old gold_undefined_symbol, calculates location from relocation.
10367 (gold_undefined_symbol): Change to take only a Symbol pointer
10368 and to report location as the file name associated with the symbol.
10369 * testsuite/debug_msg.sh: Update for changed error messages.
10370 * testsuite/undef_symbol.sh: Likewise.
10372 2009-02-04 Duncan Sands <baldrick@free.fr>
10375 * reduced_debug_output.h
10376 (Output_reduced_debug_abbrev_section::failed): Use format for
10378 (Output_reduced_debug_info_section::faild): Likewise.
10380 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
10382 * script.cc (Lazy_demangler): New class.
10383 (Version_script_info::get_symbol_version_helper): Demangle a
10386 2009-01-29 Cary Coutant <ccoutant@google.com>
10388 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
10390 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10392 2009-01-28 Ian Lance Taylor <iant@google.com>
10394 * version.cc (version_string): Bump to 1.9.
10396 * gold.h: Include <cstring> and <stdint.h>.
10397 * version.cc: Include <cstdio>.
10398 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
10400 * reduced_debug_output.cc (insert_into_vector): Rename from
10401 Insert_into_vector; change all callers. Use Swap_unaligned to
10402 avoid aliasing issue; remove union since it is unnecessary.
10404 2009-01-27 Sriraman Tallam <tmsriram@google.com>
10406 * Makefile.am (CCFILES): Add gc.cc.
10407 (HFILES): Add gc.h.
10408 * Makefile.in: Regenerate.
10409 * gold.cc (Gc_runner): New class.
10410 (queue_initial_tasks): Call garbage collection related tasks
10411 when corresponding options are invoked.
10412 (queue_middle_gc_tasks): New function.
10413 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
10414 processed early before laying out sections during garbage collection.
10415 * gold.h (queue_middle_gc_tasks): New function.
10416 (is_prefix_of): Move from "layout.cc".
10417 * i386.cc (Target_i386::gc_process_relocs): New function.
10418 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
10419 * main.cc (main): Create object of class "Garbage_collection".
10420 * object.cc (Relobj::copy_symbols_data): New function.
10421 (Relobj::is_section_name_included): New function.
10422 (Sized_relobj::do_layout): Allow this function to be called twice
10423 during garbage collection and defer layout of section during the
10425 * object.h (Relobj::get_symbols_data): New function.
10426 (Relobj::is_section_name_included): New function.
10427 (Relobj::copy_symbols_data): New function.
10428 (Relobj::set_symbols_data): New function.
10429 (Relobj::get_relocs_data): New function.
10430 (Relobj::set_relocs_data): New function.
10431 (Relobj::is_output_section_offset_invalid): New pure virtual function.
10432 (Relobj::gc_process_relocs): New function.
10433 (Relobj::do_gc_process_relocs): New pure virtual function.
10434 (Relobj::sd_): New data member.
10435 (Sized_relobj::is_output_section_offset_invalid): New function.
10436 (Sized_relobj::do_gc_process_relocs): New function.
10437 * options.h (General_options::gc_sections): Modify to not be a no-op.
10438 (General_options::print_gc_sections): New option.
10439 * plugin.cc (Plugin_finish::run): Remove function call to
10440 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
10441 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
10442 * reloc.cc (Read_relocs::run): Add task to process relocs and
10443 determine unreferenced sections when doing garbage collection.
10444 (Gc_process_relocs): New class.
10445 (Sized_relobj::do_gc_process_relocs): New function.
10446 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
10447 sections that are garbage collected.
10448 * reloc.h (Gc_process_relocs): New class.
10449 * sparc.cc (Target_sparc::gc_process_relocs): New function.
10450 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
10451 symbols whose corresponding sections are garbage collected.
10452 (Symbol_table::Symbol_table): Add new parameter for the garbage
10454 (Symbol_table::gc_mark_undef_symbols): New function.
10455 (Symbol_table::gc_mark_symbol_for_shlib): New function.
10456 (Symbol_table::gc_mark_dyn_syms): New function.
10457 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
10459 (Symbol_table::add_from_object): Likewise.
10460 (Symbol_table::add_from_relobj): When building shared objects, do not
10461 treat externally visible symbols as garbage.
10462 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
10463 table information for static and relocatable links.
10464 * symtab.h (Symbol_table::set_gc): New function.
10465 (Symbol_table::gc): New function.
10466 (Symbol_table::gc_mark_undef_symbols): New function.
10467 (Symbol_table::gc_mark_symbol_for_shlib): New function.
10468 (Symbol_table::gc_mark_dyn_syms): New function.
10469 (Symbol_table::gc_): New data member.
10470 * target.h (Sized_target::gc_process_relocs): New pure virtual
10472 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
10473 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
10475 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
10477 * options.h (General_options::gc_sections): Define as a no-op for now.
10478 (General_options::no_keep_memory): Ditto.
10479 (General_options::Bshareable): Define.
10480 * options.cc (General_options::finalize): Honor -Bshareable.
10482 2009-01-20 Andreas Schwab <schwab@suse.de>
10484 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
10485 read the value in the contents, since we don't use it. Use the
10486 template endianness when writing.
10487 (Relocate::relocate): Use it for R_PPC_REL16_HA.
10489 2009-01-19 Andreas Schwab <schwab@suse.de>
10491 * configure.tgt (powerpc64-*): Fix targ_obj.
10493 2009-01-15 Ian Lance Taylor <iant@google.com>
10495 * object.cc (Sized_relobj::write_local_symbols): Don't write out
10496 local symbols when stripping all symbols.
10498 2009-01-14 Cary Coutant <ccoutant@google.com>
10500 * output.cc (Output_reloc): Add explicit instantiations.
10502 2009-01-14 Cary Coutant <ccoutant@google.com>
10504 * archive.cc (Archive::get_elf_object_for_member): Remove call
10505 to File_read::claim_for_plugin.
10506 * descriptors.cc (Descriptors::open): Remove reference to
10508 (Descriptors::claim_for_plugin): Remove.
10509 * descriptors.h (Descriptors::claim_for_plugin): Remove.
10510 (Descriptors::is_claimed): Remove.
10511 (claim_descriptor_for_plugin): Remove.
10512 * fileread.cc (File_read::claim_for_plugin): Remove.
10513 * fileread.h (File_read::claim_for_plugin): Remove.
10514 (File_read::descriptor): Reopen descriptor if necessary.
10515 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
10516 (Plugin_manager::all_symbols_read): Add task parameter. Change
10518 (Plugin_manager::get_input_file): New function.
10519 (Plugin_manager::release_input_file): New function.
10520 (Pluginobj::Pluginobj): Add filesize parameter and initialize
10521 corresponding data member.
10522 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
10523 and pass to base constructor. Change all callers.
10524 (get_input_file, release_input_file): New functions.
10525 (make_sized_plugin_object): Add filesize parameter. Change all callers.
10526 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
10527 (Plugin_manager::all_symbols_read): Add task parameter.
10528 (Plugin_manager::get_input_file): New function.
10529 (Plugin_manager::release_input_file): New function.
10530 (Plugin_manager::task_): New data member.
10531 (Pluginobj::Pluginobj): Add filesize parameter.
10532 (Pluginobj::filename): New function.
10533 (Pluginobj::descriptor): New function.
10534 (Pluginobj::filesize): New function.
10535 (Pluginobj::filesize_): New data member.
10536 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
10537 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
10538 File_read::claim_for_plugin; use Object::unlock to unlock the file.
10540 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
10541 with archive libraries.
10542 * testsuite/Makefile.in: Regenerate.
10543 * testsuite/plugin_test.c (struct sym_info): New type.
10544 (get_input_file, release_input_file): New static variables.
10545 (onload): Capture new transfer vector entries.
10546 (claim_file_hook): Stop reading at end of file according to filesize.
10547 Factor out parsing of readelf output into separate function.
10548 (all_symbols_read_hook): Exercise get_input_file and release_input_file
10549 APIs and get the source file name from the symbol table. Convert
10550 source file name to corresponding object file name. Print info
10551 message when adding new input files.
10552 (parse_readelf_line): New function.
10553 * testsuite/plugin_test_1.sh: Add checks for new info messages.
10554 * testsuite/plugin_test_2.sh: Likewise.
10555 * testsuite/plugin_test_3.sh: Likewise.
10556 * testsuite/plugin_test_4.sh: New test case.
10558 2009-01-07 Ian Lance Taylor <iant@google.com>
10560 * version.cc (version_string): Bump to 1.8.
10562 2008-12-23 Cary Coutant <ccoutant@google.com>
10564 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
10565 * plugin.cc (Plugin_manager::finish): Rename as
10566 layout_deferred_objects. Move cleanup to separate function.
10567 (Plugin_manager::cleanup): New function.
10568 (Plugin_finish::run): Call layout_deferred_objects and cleanup
10570 * plugin.h (Plugin_manager::finish): Rename as
10571 layout_deferred_objects.
10572 (Plugin_manager::cleanup): New function.
10573 (Plugin_manager::cleanup_done): New field.
10575 2008-12-23 Cary Coutant <ccoutant@google.com>
10577 * plugin.cc (is_visible_from_outside): New function.
10578 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
10579 so we don't return "IR only" status for exported symbols or -r links.
10581 * testsuite/Makefile.am (plugin_test_3): New test case.
10582 * testsuite/Makefile.in: Regenerate.
10583 * testsuite/plugin_test_3.sh: New file.
10585 2008-12-22 Cary Coutant <ccoutant@google.com>
10587 * object.cc (Sized_relobj::layout_section): New function.
10588 (Sized_relobj::do_layout): Defer layout of input sections until after
10589 plugin has provided replacement files.
10590 (Sized_relobj::do_layout_deferred_sections): New function.
10591 * object.h (Relobj::set_section_offset): Remove virtual keyword.
10592 (Relobj::layout_deferred_sections): New function.
10593 (Relobj::do_layout_deferred_sections): New function.
10594 (Sized_relobj::do_layout_deferred_sections): New function.
10595 (Sized_relobj::layout_section): New function.
10596 (Sized_relobj::Deferred_layout): New structure.
10597 (Sized_relobj::deferred_layout_): New field.
10598 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10599 Change all callers. Layout deferred sections.
10600 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
10602 (Plugin_hook::run): Move code from do_plugin_hook inline.
10603 (Plugin_hook::do_plugin_hook): Remove.
10604 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10605 (Plugin_manager::finish): Renamed, was cleanup.
10606 (Plugin_manager::should_defer_layout): New function.
10607 (Plugin_manager::add_deferred_layout_object): New function.
10608 (Plugin_manager::Deferred_layout_list): New type.
10609 (Plugin_manager::deferred_layout_objects_): New field.
10610 (Plugin_hook::do_plugin_hook): Remove.
10612 2008-12-17 Ian Lance Taylor <iant@google.com>
10614 * options.h (class General_options): Add --no case for
10617 2008-12-16 Cary Coutant <ccoutant@google.com>
10619 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
10621 (Plugin_manager::claim_file): Create plugin object even if
10622 plugin did not call the add_symbols callback.
10623 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10624 asking for more symbols than were added.
10625 * testsuite/Makefile.am (plugin_test_1): Add test case with
10627 (empty.syms): New target.
10628 * testsuite/Makefile.in: Regenerate.
10629 * testsuite/plugin_test.c (claim_file_hook): Add new debug
10630 message. Don't call add_symbols if no globals.
10631 (all_symbols_read_hook): Don't provide replacement for empty
10634 2008-12-12 Ian Lance Taylor <iant@google.com>
10636 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10637 r_type == 0 for a local symbol with r_sym == 0.
10638 (scan_relocatable_relocs): Pass r_sym to
10639 local_non_section_strategy.
10640 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10643 * configure.ac: Update test for TLS descriptors: they are
10644 supported as of glibc 2.9.
10645 * configure: Rebuild.
10647 2008-12-11 Ian Lance Taylor <iant@google.com>
10650 * target-reloc.h (Default_scan_relocatable_relocs): For each
10651 function, map r_type == 0 to RELOC_DISCARD.
10653 2008-12-10 Cary Coutant <ccoutant@google.com>
10655 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
10656 object to override a kept COMDAT group from a plugin object.
10658 2008-12-09 Ian Lance Taylor <iant@google.com>
10661 * yyscript.y (file_cmd): Handle INPUT.
10663 * testsuite/initpri1.c: Change all declarations to be full
10664 prototypes by adding void, to avoid compiler warnings.
10666 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
10668 * options.cc (General_options::parse_plugin_opt): New.
10669 (General_options::add_plugin): The argument now is just the filename.
10670 (General_options::add_plugin_option): New.
10671 * options.h (plugin_opt): New.
10672 (add_plugin): Change argument name.
10673 (add_plugin_option): New.
10674 * plugin.cc (Plugin::load): Don't parse the plugin option.
10675 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
10676 (Plugin::add_option): New.
10677 (Plugin::args_): Change type.
10678 (Plugin::filename_): New.
10679 (Plugin_manager::add_plugin_option): New.
10680 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
10681 * testsuite/Makefile.in: Regenerate.
10683 2008-12-05 Cary Coutant <ccoutant@google.com>
10685 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
10686 Handle --strip-lto-sections option.
10687 * options.h (strip_lto_sections): New option.
10689 2008-12-01 Cary Coutant <ccoutant@google.com>
10691 * plugin.cc (ld_plugin_message): Change format parameter to const.
10692 Fix mismatch between new[] and delete.
10694 2008-11-14 Cary Coutant <ccoutant@google.com>
10696 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
10699 2008-11-05 Craig Silverstein <csilvers@google.com>
10701 * options.cc (General_options::parse_dynamic_list): New function.
10702 * options.h (General_options): New flags dynamic_list,
10703 dynamic_list_data, dynamic_list_cpp_new, and
10704 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
10705 (General_options::in_dynamic_list): New function.
10706 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
10707 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
10708 (Lex::can_continue_name): Likewise.
10710 (read_script_file): New parameter script_options.
10711 (read_dynamic_list): New function.
10712 (Script_options::define_dynamic_list): New function.
10713 (dynamic_list_keyword_parsecodes): New variable.
10714 (dynamic_list_keywords): New variable.
10715 * script.h (Script_options::define_dynamic_list): New function
10717 (read_dynamic_list): New function prototype.
10718 * symtab.cc (strprefix): New macro.
10719 (Symbol::should_add_dynsym_entry): Support dynamic_list,
10720 dynamic_list_data, dynamic_list_cpp_new, and
10721 dynamic_list_cpp_typeinfo.
10722 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
10723 (dynamic_list_expr): New rule.
10724 (dynamic_list_nodes): Likewise.
10725 (dynamic_list_node): Likewise.
10726 * testsuite/Makefile.am (dynamic_list): New test.
10727 * testsuite/Makefile.in: Regenerated.
10728 * testsuite/dynamic_list.t: New file.
10729 * testsuite/dynamic_list.sh: New file.
10731 2008-11-05 Craig Silverstein <csilvers@google.com>
10733 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
10734 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
10735 (t11_last): Likewise.
10736 * testsuite/ver_test_6.c (main): Likewise.
10738 2008-10-07 Cary Coutant <ccoutant@google.com>
10740 * options.c (General_options::finalize): Add check for -static and
10742 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
10745 2008-10-02 Cary Coutant <ccoutant@google.com>
10747 * plugin.cc (make_sized_plugin_object): Fix conditional
10748 compilation to work when not all targets are enabled.
10750 2008-09-29 Cary Coutant <ccoutant@google.com>
10752 * archive.cc (Archive::get_file_and_offset): Use filename instead
10753 of name to get library path.
10754 (Archive::include_member): Unlock external member of a thin archive.
10756 * testsuite/Makefile.am (TEST_AR): New variable.
10757 (thin_archive_test_1): New test.
10758 (thin_archive_test_2): New test.
10759 * testsuite/Makefile.in: Regenerate.
10760 * testsuite/thin_archive_main.cc: New file.
10761 * testsuite/thin_archive_test_1.cc: New file.
10762 * testsuite/thin_archive_test_2.cc: New file.
10763 * testsuite/thin_archive_test_3.cc: New file.
10764 * testsuite/thin_archive_test_4.cc: New file.
10766 2008-09-29 Cary Coutant <ccoutant@google.com>
10768 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
10769 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
10771 (Sized_relobj::do_finalize_local_symbols): Likewise.
10772 (Sized_relobj::map_to_kept_section): Likewise.
10773 * object.h (Sized_relobj::invalid_address): New constant.
10774 (Sized_relobj::do_output_section_offset): Check for invalid_address
10776 * output.cc (Output_reloc::local_section_offset): Use constant
10777 invalid_address instead of -1U.
10778 (Output_reloc::get_address): Likewise.
10779 (Output_section::output_address): Change -1U to -1ULL.
10780 * output.h (Output_reloc::invalid_address): New constant.
10781 * reloc.cc (Sized_relobj::write_sections): Use constant
10782 invalid_address instead of -1U.
10783 (Sized_relobj::relocate_sections): Likewise.
10784 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
10785 values for merge sections.
10786 * target-reloc.h (relocate_for_relocatable): Use constant
10787 invalid_address instead of -1U.
10789 2008-09-19 Cary Coutant <ccoutant@google.com>
10791 Add plugin functionality for link-time optimization (LTO).
10792 * configure.ac (plugins): Add --enable-plugins option.
10793 * configure: Regenerate.
10794 * config.in: Regenerate.
10795 * Makefile.am (LIBDL): New variable.
10796 (CCFILES): Add plugin.cc.
10797 (HFILES): Add plugin.h.
10798 (ldadd_var): Add LIBDL.
10799 * Makefile.in: Regenerate.
10801 * archive.cc: Include "plugin.h".
10802 (Archive::setup): Don't preread archive symbols when using a plugin.
10803 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
10804 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
10806 (Archive::include_member): Add symbols from plugin objects.
10807 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
10808 * descriptors.cc (Descriptors::open): Check for file descriptors
10809 abandoned by plugins.
10810 (Descriptors::claim_for_plugin): New function.
10811 * descriptors.h (Descriptors::claim_for_plugin): New function.
10812 (Open_descriptor::is_claimed): New field.
10813 (claim_descriptor_for_plugin): New function.
10814 * fileread.cc (File_read::claim_for_plugin): New function.
10815 * fileread.h (File_read::claim_for_plugin): New function.
10816 (File_read::descriptor): New function.
10817 * gold.cc: Include "plugin.h".
10818 (queue_initial_tasks): Add task to call plugin hooks for generating
10820 * main.cc: Include "plugin.h".
10821 (main): Load plugin libraries.
10822 * object.h (Pluginobj): Declare.
10823 (Object::pluginobj): New function.
10824 (Object::do_pluginobj): New function.
10825 (Object::set_target): New function.
10826 * options.cc: Include "plugin.h".
10827 (General_options::parse_plugin): New function.
10828 (General_options::General_options): Initialize plugins_ field.
10829 (General_options::add_plugin): New function.
10830 * options.h (Plugin_manager): Declare.
10831 (General_options): Add --plugin option.
10832 (General_options::has_plugins): New function.
10833 (General_options::plugins): New function.
10834 (General_options::add_plugin): New function.
10835 (General_options::plugins_): New field.
10836 * plugin.cc: New file.
10837 * plugin.h: New file.
10838 * readsyms.cc: Include "plugin.h".
10839 (Read_symbols::do_read_symbols): Check for archive before checking
10840 for ELF file. Call plugin hooks to claim files.
10841 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
10842 from a real object file; force override when processing replacement
10844 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
10845 (Symbol::init_base_object): Likewise.
10846 (Symbol::init_base_output_data): Likewise.
10847 (Symbol::init_base_output_segment): Likewise.
10848 (Symbol::init_base_constant): Likewise.
10849 (Symbol::init_base_undefined): Likewise.
10850 (Symbol::output_section): Assert that object is not a plugin.
10851 (Symbol_table::add_from_pluginobj): New function.
10852 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
10854 (Symbol_table::sized_write_globals): Likewise.
10855 (Symbol_table::add_from_pluginobj): Instantiate template.
10856 * symtab.h (Sized_pluginobj): Declare.
10857 (Symbol::in_real_elf): New function.
10858 (Symbol::set_in_real_elf): New function.
10859 (Symbol::in_real_elf_): New field.
10860 (Symbol_table::add_from_pluginobj): New function.
10862 * testsuite/Makefile.am (AM_CFLAGS): New variable.
10863 (LIBDL): New variable.
10864 (LDADD): Add LIBDL.
10865 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
10866 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
10867 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
10868 (MOSTLYCLEANFILES): Likewise.
10869 * testsuite/Makefile.in: Regenerate.
10870 * testsuite/plugin_test.c: New file.
10871 * testsuite/plugin_test_1.sh: New file.
10872 * testsuite/plugin_test_2.sh: New file.
10874 2008-09-16 Ian Lance Taylor <iant@google.com>
10876 * target-reloc.h (relocate_section): Check whether a symbol is
10877 defined by the ABI before reporting an undefined symbol error.
10878 * target.h (Target::is_defined_by_abi): Make parameter const.
10879 (Target::do_is_defined_by_abi): Likewise.
10880 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
10881 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
10882 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
10883 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
10884 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
10885 * testsuite/Makefile.in: Rebuild.
10887 * fileread.cc (make_view): Add casts to avoid warning.
10889 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
10891 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
10892 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10894 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
10896 * options.h (General_options::output_is_executable): New.
10897 (General_options::output_is_pie): New.
10898 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
10899 for shared libraries.
10900 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10902 2008-09-11 Chris Demetriou <cgd@google.com>
10904 * options.h (origin): New -z option.
10905 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
10906 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
10909 2008-09-05 Cary Coutant <ccoutant@google.com>
10911 * fileread.cc (File_read::make_view): Add check for attempt to map
10912 beyond end of file.
10914 2008-09-05 Cary Coutant <ccoutant@google.com>
10916 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
10917 explicit instantiations.
10919 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
10922 * options.cc (General_options::finalize): Allow undefined symbols
10923 in shlibs if linking -shared.
10926 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
10927 symbols as not needing a dynsym entry.
10929 2008-08-20 Craig Silverstein <csilvers@google.com>
10931 * fileread.cc (File_read::open): Do not lock the file unless it
10932 was successfully opened.
10934 2008-08-14 Cary Coutant <ccoutant@google.com>
10936 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
10937 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
10938 * testsuite/tls_test.cc (struct int128): 128-bit struct
10939 for testing TLS relocs with non-zero addend.
10940 (v12): New TLS variable.
10942 (t_last): Add check for v12.
10943 * testsuite/tls_test.h (t12): New function.
10944 * testsuite/tls_test_main.cc (thread_routine): Call new test.
10946 2008-08-13 Ian Lance Taylor <iant@google.com>
10948 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
10949 set tls_segment_ or relro_segment_.
10950 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
10952 * output.h (Output_section::clear_is_relro): New function.
10953 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
10954 sections specially even when output_data_ is empty.
10955 (Output_segment::maximum_alignment): When first section is relro,
10956 only force alignment for PT_LOAD segments.
10957 * script.cc (script_data_segment_align): New function.
10958 (script_data_segment_relro_end): New function.
10959 * script-c.h (script_data_segment_align): Declare.
10960 (script_data_segment_relro_end): Declare.
10961 * script-sections.h (class Script_sections): Declare
10962 data_segment_align and data_segment_relro_end. Add fields
10963 segment_align_index_ and saw_relro_end_.
10964 * script-sections.cc (class Sections_element): Add set_is_relro
10965 virtual function. Add new bool* parameter to place_orphan_here.
10966 Add get_output_section virtual function.
10967 (class Output_section_definition): Add set_is_relro. Add new
10968 bool* parameter to place_orphan_here. Add get_output_section.
10969 Add is_relro_ field.
10970 (Output_section_definition::Output_section_definition): Initialize
10971 evaluated_address_, evaluated_load_address, evaluated_addralign_,
10972 and is_relro_ fields.
10973 (Output_section_definition::place_orphan_here): Add is_relro
10975 (Output_section_definition::set_section_addresses): Set relro for
10977 (Output_section_definition::alternate_constraint): Likewise.
10978 (class Orphan_output_section): Add new bool* parameter to
10979 place_orphan_here. Add get_output_section.
10980 (Orphan_output_section::place_orphan_here): Add is_relro
10982 (Script_sections::Script_sections): Initialize
10983 data_segment_align_index_ and saw_relro_end_.
10984 (Script_sections::data_segment_align): New function.
10985 (Script_sections::data_segment_relro_end): New function.
10986 (Script_sections::place_orphan): Set or clear is_relro.
10987 (Script_sections::set_section_addresses): Force alignment of first
10989 * yyscript.y (exp): Call script_data_segment_align and
10990 script_data_segment_relro_end.
10991 * testsuite/relro_script_test.t: New file.
10992 * testsuite/relro_test.cc (using_script): Declare.
10993 (t1, t2): Test using_script.
10994 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
10995 (relro_script_test_SOURCES): Define.
10996 (relro_script_test_DEPENDENCIES): Define.
10997 (relro_script_test_LDFLAGS): Define.
10998 (relro_script_test_LDADD): Define.
10999 (relro_script_test.so): New target.
11000 * testsuite/Makefile.in: Rebuild.
11002 2008-08-06 Cary Coutant <ccoutant@google.com>
11004 * archive.cc (Archive::total_archives, Archive::total_members)
11005 (Archive::total_members_loaded): New variables.
11006 (Archive::setup): Add parameter. Add option to preread
11008 (Archive::read_armap): Add counter.
11009 (Archive::get_file_and_offset): New function.
11010 (Archive::get_elf_object_for_member): New function.
11011 (Archive::read_all_symbols): New function.
11012 (Archive::read_symbols): New function.
11013 (Archive::add_symbols): Add counters.
11014 (Archive::include_all_members): Use armap to find members if it's
11016 (Archive::include_member): Skip reading symbols if already read.
11017 Factored code into Archive::get_file_and_offset and
11018 Archive::get_elf_object_for_member. Changed call to
11019 Mapfile::report_include_archive_member.
11020 (Archive::print_stats): New function.
11021 * archive.h: Declare Object and Read_symbols_data classes.
11022 (Archive::Archive): Add initializers for new members.
11023 (Archive::setup): Add parameter.
11024 (Archive::print_stats): New function.
11025 (Archive::total_archives, Archive::total_members)
11026 (Archive::total_members_loaded): New variables.
11027 (Archive::get_file_and_offset): New function.
11028 (Archive::get_elf_object_for_member): New function.
11029 (Archive::read_all_symbols): New function.
11030 (Archive::read_symbols): New function.
11031 (Archive::Archive_member): New class.
11032 (Archive::members_): New member.
11033 (Archive::num_members_): New member.
11034 * main.cc: Include archive.h.
11035 (main): Call Archive::print_stats.
11036 * mapfile.cc (Mapfile::report_include_archive_member): Delete
11037 archive parameter; member_name is now the fully-decorated name.
11038 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
11039 * options.h: (General_options): Add --preread-archive-symbols option.
11040 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
11043 2008-08-04 Ian Lance Taylor <iant@google.com>
11045 * symtab.h (Symbol::use_plt_offset): New function.
11046 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
11047 * powerpc.cc (Relocate::relocate): Likewise.
11048 * sparc.cc (Relocate::relocate): Likewise.
11049 * x86_64.cc (Relocate::relocate): Likewise.
11050 * testsuite/weak_plt.sh: New test.
11051 * testsuite/weak_plt_main.cc: New test.
11052 * testsuite/weak_plt_shared.cc: New test.
11053 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
11054 (check_PROGRAMS): Add weak_plt.
11055 (check_DATA): Add weak_plt_shared.so.
11056 (weak_plt_main_pic.o, weak_plt): New targets.
11057 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
11058 * testsuite/Makefile.in: Rebuild.
11060 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
11062 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
11063 * testsuite/Makefile.in: Rebuild.
11065 2008-08-04 Alan Modra <amodra@bigpond.net.au>
11067 * Makefile.am (POTFILES.in): Set LC_ALL=C.
11068 * Makefile.in: Regenerate.
11069 * po/POTFILES.in: Regenerate.
11071 2008-07-29 Ian Lance Taylor <iant@google.com>
11073 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
11074 symbols before other symbols.
11075 * testsuite/script_test_2.cc (test_addr): Declare.
11076 (test_addr_alias): Declare.
11077 (main): Check that test_addr and test_addr_alias have the right
11079 * testsuite/script_test_2.t: Define test_addr_alias and
11082 2008-07-24 Ian Lance Taylor <iant@google.com>
11085 * descriptors.cc: New file.
11086 * descriptors.h: New file.
11087 * gold-threads.h (class Hold_optional_lock): New class.
11088 * fileread.cc: Include "descriptors.h".
11089 (File_read::~File_read): Release descriptor rather than closing
11091 (File_read::open) [file]: Call open_descriptor rather than open.
11092 Set is_descriptor_opened_.
11093 (File_read::open) [memory]: Assert that descriptor is not open.
11094 (File_read::reopen_descriptor): New function.
11095 (File_read::release): Release descriptor.
11096 (File_read::do_read): Make non-const. Reopen descriptor.
11097 (File_read::read): Make non-const.
11098 (File_read::make_view): Reopen descriptor.
11099 (File_read::do_readv): Likewise.
11100 * fileread.h (class File_read): Add is_descriptor_opened_ field.
11101 Update declarations.
11102 * layout.cc: Include "descriptors.h".
11103 (Layout::create_build_id): Use open_descriptor rather than open.
11104 * output.cc: Include "descriptors.h".
11105 (Output_file::open): Use open_descriptor rather than open.
11106 * archive.cc (Archive::const_iterator): Change Archive to be
11108 (Archive::begin, Archive::end): Make non-const.
11109 (Archive::count_members): Likewise.
11110 * archive.h (class Archive): Update declarations.
11111 * object.h (Object::read): Make non-const.
11112 * Makefile.am (CCFILES): Add descriptors.cc.
11113 (HFILES): Add descriptors.h.
11114 * Makefile.in: Rebuild.
11117 * gold.h: Always include <clocale>. Add Solaris workarounds
11118 following code in binutils/sysdep.h.
11121 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
11122 this->eh_frame_hdr_ is NULL before using it.
11124 * dynobj.cc (Versions::Versions): Update comment.
11126 * dynobj.cc (Versions::Versions): If there is an soname, use it as
11127 the base version name.
11129 * stringpool.cc (Stringpool_template::add_with_length): Set key to
11130 array size plus one.
11131 (Stringpool_template::set_string_offsets): Subtract one from key
11132 before using it as an array index.
11133 (Stringpool_template::get_offset_with_length): Likewise.
11134 (Stringpool_template::write_to_buffer): Likewise.
11135 * stringpool.h (Stringpool_template::get_offset_from_key):
11138 2008-07-23 Ian Lance Taylor <iant@google.com>
11141 * object.h (Merged_symbol_value::value): Do our best to handle a
11145 * script.cc (Version_script_info::get_versions): Don't add empty
11146 version tag to return value.
11147 (Version_script_info::get_symbol_version_helper): Change return
11148 type to bool. Add pversion parameter. Change all callers.
11149 (script_register_vers_node): Don't require a non-NULL tag.
11150 * script.h (class Version_script_info): Update declarations.
11151 (Version_script_info::get_symbol_version): Change return type to
11152 bool. Add version parameter. Change all callers.
11153 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
11154 handling. Handle an empty version from a version script.
11155 (Symbol_table::define_special_symbol): Likewise.
11156 * testsuite/ver_test_10.script: New file.
11157 * testsuite/ver_test_10.sh: New file.
11158 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
11159 (check_DATA): Add ver_test_10.syms.
11160 (ver_test_10.syms, ver_test_10.so): New target.
11161 * testsuite/Makefile.in: Rebuild.
11163 2008-07-23 Simon Baldwin <simonb@google.com>
11165 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
11166 to zero for undefined symbols from dynamic libraries.
11168 2008-07-23 Ian Lance Taylor <iant@google.com>
11170 * symtab.cc (Symbol_table::resolve): Remove version parameter.
11171 Change all callers.
11172 * symtab.h (class Symbol_table): Update declaration.
11173 * testsuite/ver_test_9.cc: New file.
11174 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
11175 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
11176 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
11177 (ver_test_9.so, ver_test_9.o): New targets.
11178 * testsuite/Makefile.in: Rebuild.
11180 2008-07-22 Ian Lance Taylor <iant@google.com>
11182 * options.h (class General_options): Define --check-sections.
11183 * layout.cc (Layout::set_segment_offsets): Handle
11186 * options.h (class General_options): Define -n/--nmagic and
11188 * options.cc (General_options::finalize): For -n/--nmagic or
11189 -N/--omagic, set -static.
11190 * layout.cc (Layout::attach_allocated_section_to_segment): If
11191 -N/--omagic, don't put read-only and read-write sections in
11192 different segments.
11193 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
11194 finding a read-only segment.
11195 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
11196 don't set the minimum segment alignment to the common page size,
11197 and don't set the file offset to the address modulo the page size.
11198 * script-sections.cc (Script_sections::create_segments): If
11199 -n/--omagic, don't put read-only and read-write sections in
11200 different segments.
11202 * cref.cc: New file.
11203 * cref.h: New file.
11204 * options.h (class General_options): Add --print-symbol-counts.
11205 * main.cc (main): Issue defined symbol report if requested.
11206 * archive.cc (Archive::interpret_header): Make into a const member
11208 (Archive::add_symbols): Call Input_objects::archive_start and
11210 (Archive::const_iterator): Define new class.
11211 (Archive::begin, Archive::end): New functions.
11212 (Archive::include_all_members): Rewrite to use iterator.
11213 (Archive::count_members): New function.
11214 * archive.h (class Archive): Update declarations.
11215 (Archive::filename): New function.
11216 * object.cc: Include "cref.h".
11217 (Sized_relobj::Sized_relobj): Initialize defined_count_.
11218 (Sized_relobj::do_get_global_symbol_counts): New function.
11219 (Input_objects::add_object): Add object to cross-referencer.
11220 (Input_objects::archive_start): New function.
11221 (Input_objects::archive_stop): New function.
11222 (Input_objects::print_symbol_counts): New function.
11223 * object.h: Declare Cref and Archive.
11224 (Object::get_global_symbol_counts): New function.
11225 (Object::do_get_global_symbol_counts): New pure virtual function.
11226 (class Sized_relobj): Add defined_count_ field. Update
11228 (class Input_objects): Add cref_ field. Update constructor.
11229 Update declarations.
11230 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
11232 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
11234 (Sized_dynobj::do_get_global_symbol_counts): New function.
11235 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
11236 defined_count_. Update declarations. Define Symbols typedef.
11237 * symtab.cc (Symbol_table::add_from_relobj): Add defined
11238 parameter. Change all callers.
11239 (Symbol_table::add_from_dynobj): Add sympointers and defined
11240 parameters. Change all callers.
11241 * symtab.h (class Symbol_table): Update declarations.
11242 * Makefile.am (CCFILES): Add cref.cc.
11243 (HFILES): Add cref.h.
11244 * Makefile.in: Rebuild.
11246 2008-07-22 Simon Baldwin <simonb@google.com>
11248 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
11249 to zero when writing undefined symbols.
11251 2008-07-22 Ian Lance Taylor <iant@google.com>
11253 * output.cc (Output_section::add_input_section): Don't try to
11254 merge empty merge sections.
11256 2008-07-21 Craig Silverstein <csilvers@google.com>
11258 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11259 Include symbol version in error message.
11261 2008-07-20 Chris Demetriou <cgd@google.com>
11263 * configure.ac (gold_cv_c_random_seed): New configured variable.
11264 (RANDOM_SEED_CFLAGS): New substituted variable.
11265 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
11266 * configure: Rebuild.
11267 * Makefile.in: Likewise.
11268 * testsuite/Makefile.in: Likewise.
11270 2008-07-18 Ian Lance Taylor <iant@google.com>
11272 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
11273 where we see NAME/NULL and NAME/VERSION as separate symbols.
11274 * testsuite/ver_test_main.cc (main): Call t4.
11275 (t4, t4_2a): Define.
11276 * testsuite/ver_test_2.cc (t4_2): Define.
11277 * testsuite/ver_test_2.script: Put t4_2a in VER2.
11278 * testsuite/ver_test_4.cc (t4_2a): Define.
11279 * testsuite/ver_test_4.script: Put t4_2a in VER2.
11280 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
11282 2008-07-17 Ian Lance Taylor <iant@google.com>
11284 * dynobj.cc (Versions::add_def): If we give an error about a
11285 missing version, go ahead and create the version anyhow.
11287 2008-07-10 Ian Lance Taylor <iant@google.com>
11289 Handle output sections with more than 0x7fffffff bytes.
11290 * object.h (class Relobj): Change map_to_output_ to
11291 output_sections_, and just keep a section pointer. Change all
11292 uses. Move comdat group support to Sized_relobj.
11293 (Relobj::is_section_specially_mapped): Remove.
11294 (Relobj::output_section): Remove poff parameter. Change all
11296 (Relobj::output_section_offset): New function.
11297 (Relobj::set_section_offset): Rewrite.
11298 (Relobj::map_to_output): Remove.
11299 (Relobj::output_sections): New function.
11300 (Relobj::do_output_section_offset): New pure virtual function.
11301 (Relobj::do_set_section_offset): Likewise.
11302 (class Sized_relobj): Add section_offsets_ field. Add comdat
11303 group support from Relobj. Update declarations.
11304 (Sized_relobj::get_output_section_offset): New function.
11305 (Sized_relobj::do_output_section_offset): New function.
11306 (Sized_relobj::do_set_section_offset): New function.
11307 * object.cc (Relobj::output_section_address): Remove.
11308 (Sized_relobj::Sized_relobj): Initialize new fields.
11309 (Sized_relobj::include_section_group): Cast find_kept_object to
11311 (Sized_relobj::include_linkonce_section): Likewise.
11312 (Sized_relobj::do_layout): Use separate arrays for output section
11314 (Sized_relobj::do_count_local_symbols): Change map_to_output to
11316 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
11317 output_sections and section_offsets.
11318 (Sized_relobj::write_local_symbols): Likewise.
11319 (map_to_kept_section): Compute output address directly.
11320 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
11321 output_sections and section_offsets.
11322 (Sized_relobj::write_sections): Likewise.
11323 (Sized_relobj::relocate_sections): Likewise.
11324 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
11325 * output.h (class Output_reloc): Update declarations. Change
11326 u2_.relobj to Sized_relobj*.
11327 (class Output_data_reloc): Change add functions to use
11329 * output.cc (Output_reloc::Output_reloc): Change relobj to
11331 (Output_reloc::local_section_offset): Change return type to
11332 Elf_Addr. Use get_output_section_offset.
11333 (Output_reloc::get_address): Likewise.
11334 (Output_section::is_input_address_mapped): Don't call
11335 is_section_specially_mapped.
11336 (Output_section::output_offset): Likewise.
11337 (Output_section::output_address): Likewise.
11338 (Output_section::starting_output_address): Likewise.
11339 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
11340 parameter to Sized_relobj*.
11341 (Copy_relocs::need_copy_reloc): Likewise.
11342 (Copy_relocs::save): Likewise.
11343 * copy-relocs.h (class Copy_relocs): Update declarations.
11344 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
11345 Sized_relobj*. Change relobj_ field to Sized_relobj*.
11346 * target-reloc.h (relocate_for_relocatable): Change
11347 offset_in_output_section type to Elf_Addr. Change code that uses
11349 * layout.cc (Layout::layout): Always set *off.
11350 * mapfile.cc (Mapfile::print_input_section): Use
11351 output_section_offset.
11352 * i386.cc (Target_i386::copy_reloc): Change object parameter to
11354 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
11355 * sparc.cc (Target_sparc::copy_reloc): Likewise.
11356 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
11358 2008-07-03 Ian Lance Taylor <iant@google.com>
11360 * layout.cc (Layout::include_section): Do not discard unrecognized
11361 SHT_STRTAB sections.
11363 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
11365 * script.cc (Lex::can_continue_name): Make '?' allowable in
11366 version-script names.
11367 * testsuite/version_script.map: Change glob pattern to use '?'
11369 2008-06-30 Manish Singh <yosh@gimp.org>
11372 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
11375 2008-06-30 Ian Lance Taylor <iant@google.com>
11379 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
11380 versions]: Don't try to read the value in the contents, since we
11381 don't use it. Use the template endianness when writing.
11383 2008-06-25 Cary Coutant <ccoutant@google.com>
11385 * fileread.cc (File_read::make_view): Assert on zero-length view.
11386 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
11387 symbol table when there are no symbols to read.
11389 2008-06-23 Craig Silverstein <csilvers@google.com>
11391 * version.cc (version_string): Bump to 1.7
11393 2008-06-18 Craig Silverstein <csilvers@google.com>
11395 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
11396 constant 0xFFFF to type Valtype.
11397 (Powerpc_relocate_functions::rel16_ha): Likewise.
11399 2008-06-17 Ian Lance Taylor <iant@google.com>
11401 * output.h (Output_section::Input_section): Initialize p2align_ to
11402 zero for Output_section_data constructors.
11403 (Output_section::Input_section::addralign): If not an input
11404 section, return the alignment of the Output_section_data.
11405 * testsuite/copy_test.cc: New file.
11406 * testsuite/copy_test_1.cc: New file.
11407 * testsuite/copy_test_2.cc: New file.
11408 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
11409 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
11410 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
11411 (copy_test_1_pic.o, copy_test_1.so): New targets.
11412 (copy_test_2_pic.o, copy_test_2.so): New targets.
11413 * testsuite/Makefile.in: Rebuild.
11415 * script-sections.cc (Script_sections::place_orphan): Initialize
11416 local variable exact.
11418 2008-06-13 David Edelsohn <edelsohn@gnu.org>
11420 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
11422 2008-06-12 David Edelsohn <edelsohn@gnu.org>
11423 David S. Miller <davem@davemloft.net>
11425 * powerpc.cc: New file.
11426 * Makefile.am (TARGETSOURCES): Add powerpc.cc
11427 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
11428 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
11429 * Makefile.in: Rebuild.
11431 2008-06-09 Ian Lance Taylor <iant@google.com>
11433 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
11435 (throwing, orig_terminate): New static variables.
11436 (terminate_handler): New static function.
11437 (t2): Set terminate handler.
11439 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
11442 * binary.cc (Binary_to_elf::sized_convert): Fix .data
11445 2008-05-30 Cary Coutant <ccoutant@google.com>
11447 * archive.cc (Archive::include_all_members) Correct to step
11448 over symbol table and extended name table in thin archives.
11450 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
11453 * target-reloc.h (relocate_for_relocatable): Fix new_offset
11456 2008-05-28 Caleb Howe <cshowe@google.com>
11458 * reduced_debug_output.cc: New file.
11459 * reduced_debug_output.h: New file.
11460 * options.h (class General_options): Add --strip-debug-non-line.
11461 * options.cc (General_options::finalize): Add strip_debug_non_line
11462 to the strip heirarchy.
11463 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
11465 * layout.cc: Include "reduced_debug_output.h".
11466 (Layout::Layout): Initialize new fields.
11467 (line_only_debug_sections): New static array.
11468 (is_lines_only_debug_sections): New static inline function.
11469 (Layout::include_section): Handle --strip-debug-non-line.
11470 (Layout::make_output_section): If --strip-debug-non-line, build
11471 new output sections for .debug_abbrev and .debug_info.
11472 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
11473 gold. Warn about possible overflow.
11474 (read_signed_LEB_128): Likewise.
11475 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
11476 (read_signed_LEB_128): Declare.
11477 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
11478 (HFILES): Add reduced_debug_output.h.
11479 * Makefile.in: Rebuild.
11481 2008-05-21 Ian Lance Taylor <iant@google.com>
11483 * mapfile.cc: New file.
11484 * mapfile.h: New file.
11485 * options.h (class General_options): Add -M/--print-map and -Map.
11486 * options.cc (General_options::finalize): Make -M equivalent to
11488 * main.cc: Include <cstdio> and "mapfile.h".
11489 (main): Open mapfile if requested.
11490 * gold.cc (class Middle_runner): Add mapfile_ field. Update
11491 constructor. Change caller.
11492 (queue_initial_tasks): Add mapfile parameter. Change caller.
11493 (queue_middle_tasks): Likewise.
11494 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
11496 * archive.cc: Include "mapfile.h".
11497 (Archive::add_symbols): Add mapfile parameter. Change all
11498 callers. Pass mapfile, symbol, and reason to include_member.
11499 (Archive::include_all_members): Add mapfile parameter. Change all
11501 (Archive::include_member): Add mapfile, sym, and why parameters.
11502 Change all callers. Report inclusion to map file.
11503 * archive.h: Include "fileread.h".
11504 (class Archive): Update declarations.
11505 (Archive::file): New const method.
11506 (class Add_archive_symbols): Add mapfile_ field. Update
11507 constructor. Change all callers.
11508 * readsyms.h (class Read_symbols): Likewise.
11509 (class Finish_group): Likewise.
11510 (class Read_script): Likewise.
11511 * common.cc: Include "mapfile.h".
11512 (Symbol_table::allocate_commons): Add mapfile parameter. Change
11514 (Symbol_table::do_allocate_commons): Likewise.
11515 (Symbol_table::do_allocate_commons_list): Likewise. Report common
11516 symbol allocation to mapfile.
11517 * common.h (class Allocate_commons_task): Add mapfile_ field.
11518 Update constructor. Change all callers.
11519 * symtab.h (class Symbol_table): Update declarations.
11520 * layout.cc: Include "mapfile.h".
11521 (Layout_task_runner::run): Print information to mapfile.
11522 (Layout::create_gold_note): Change Output_data_fixed_space to
11523 Output_data_zero_fill.
11524 (Layout::create_build_id): Likewise.
11525 (Layout::print_to_mapfile): New function.
11526 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
11527 constructor. Change caller.
11528 (class Layout): Declare print_to_mapfile.
11529 * output.cc (Output_section::Input_section::print_to_mapfile): New
11531 (Output_section::add_input_section): If producing a map, always
11532 add to input_sections_ list.
11533 (Output_section::do_print_to_mapfile): New function.
11534 (Output_segment::print_sections_to_mapfile): New function.
11535 (Output_segment::print_section_list_to_mapfile): New function.
11536 * output.h: Include "mapfile.h".
11537 (Output_data::print_to_mapfile): New function.
11538 (Output_data::do_print_to_mapfile): New virtual function.
11539 (Output_segment_headers::do_print_to_mapfile): New function.
11540 (Output_file_header::do_print_to_mapfile): New function.
11541 (Output_data_const::do_print_to_mapfile): New function.
11542 (class Output_data_const_buffer): Add map_name_ field. Update
11543 constructor. Change all callers. Add do_print_to_mapfile
11545 (class Output_data_fixed_space): Likewise.
11546 (class Output_data_space): Likewise.
11547 (class Output_data_zero_fill): New class.
11548 (Output_data_strtab::do_print_to_mapfile): New function.
11549 (Output_data_reloc_base::do_print_to_mapfile): New function.
11550 (Output_relocatable_relocs::do_print_to_mapfile): New function.
11551 (Output_data_group::do_print_to_mapfile): New function.
11552 (Output_data_got::do_print_to_mapfile): New function.
11553 (Output_data_dynamic::do_print_to_mapfile): New function.
11554 (Output_symtab_xindex::do_print_to_mapfile): New function.
11555 (class Output_section): Declare do_print_to_mapflie. Declare
11556 print_to_mapfile in Input_section.
11557 (class Output_segment): Declare new functions.
11558 * object.h (Sized_relobj::symbol_count): New function.
11559 * script-sections.cc
11560 (Output_section_element_dot_assignment::set_section_addresses):
11561 Change Output_data_fixed_space to Output_data_zero_fill.
11562 (Output_data_expression::do_print_to_mapfile): New function.
11563 * script.cc (read_input_script): Add mapfile parameter. Change
11565 * script.h (read_input_script): Update declaration.
11566 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
11567 (Eh_frame::do_print_to_mapfile): New function.
11568 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
11569 (Output_merge_string::do_print_to_mapfile): New function.
11570 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
11572 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
11574 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
11576 * Makefile.am (CCFILES): Add mapfile.cc.
11577 (HFILES): Add mapfile.h.
11578 * Makefile.in: Rebuild.
11580 2008-05-19 Ian Lance Taylor <iant@google.com>
11582 * options.h (class General_options): Add -z relro.
11583 * layout.cc (Layout::Layout): Initialize relro_segment_.
11584 (Layout::add_output_section_data): Return the output section.
11585 (Layout::make_output_section): Rcognize relro sections and mark
11586 them appropriately.
11587 (Layout::attach_allocated_section_to_segment): Put relro sections
11588 in a PT_GNU_RELRO segment.
11589 (Layout::create_initial_dynamic_sections): Mark the .dynamic
11591 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11593 (Layout::linkonce_mapping): Map d.rel.ro.local to
11594 .data.rel.ro.local.
11595 (Layout::output_section_name): Us .data.rel.ro.local for any
11596 section which begins with that.
11597 * layout.h (class Layout): Update add_output_section_data
11598 declaration. Add relro_segment_ field.
11599 * output.cc (Output_section::Output_section): Initialize is_relro_
11600 and is_relro_local_ fields.
11601 (Output_segment::add_output_section): Group relro sections.
11602 (Output_segment::is_first_section_relro): New function.
11603 (Output_segment::maximum_alignment): If there is a relro section,
11604 align the segment to the common page size.
11605 (Output_segment::set_section_addresses): Track whether we are
11606 looking at relro sections. If the last section is a relro
11607 section, align to the common page size.
11608 (Output_segment::set_section_list_addresses): Add in_relro
11609 parameter. Change all callers. Align to the page size when
11610 moving from relro to non-relro section.
11611 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
11613 * output.h (class Output_section): Add is_relro_ and
11614 is_relro_local_ fields.
11615 (Output_section::is_relro): New function.
11616 (Output_section::set_is_relro): New function.
11617 (Output_section::is_relro_local): New function.
11618 (Output_section::set_is_relro_local): New function.
11619 (class Output_segment): Update declarations.
11620 * i386.cc (Target_i386::got_section): Mark .got section as relro.
11621 * sparc.cc (Target_sparc::got_section): Likewise.
11622 * x86_64.cc (Target_x86_64::got_section): Likewise.
11623 * testsuite/relro_test_main.cc: New file.
11624 * testsuite/relro_test.cc: New file.
11625 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11626 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11627 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11628 (relro_test.so, relro_test_pic.o): New targets.
11629 * testsuite/Makefile.in: Rebuild.
11631 2008-05-16 Ian Lance Taylor <iant@google.com>
11633 * output.cc (Output_segment::add_output_section): Remove front
11635 * output.h (class Output_segment): Remove
11636 add_initial_output_section and overloaded add_output_section.
11637 Update declaration of remaining add_output_section.
11638 * layout.cc (Layout::create_interp): Call add_output_section
11639 rather than add_initial_output_section.
11640 (Layout::finish_dynamic_section): Likewise.
11642 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
11643 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
11644 know the dynamic type.
11645 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
11646 field. Initialize it in constructor.
11647 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
11648 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
11649 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
11652 * output.cc (Output_reloc::get_address): Change return type to
11654 * output.h (class Output_reloc): Update get_address declaration.
11655 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
11656 for section addresses.
11658 2008-05-09 Ian Lance Taylor <iant@google.com>
11661 * gold.cc (gold_nomem): Use return value of write.
11663 2008-05-08 Ian Lance Taylor <iant@google.com>
11665 * symtab.c (Symbol::init_base_output_data): Add version
11666 parameter. Change all callers.
11667 (Symbol::init_base_output_segment): Likewise.
11668 (Symbol::init_base_constant): Likewise.
11669 (Symbol::init_base_undefined): Likewise.
11670 (Sized_symbol::init_output_data): Likewise.
11671 (Sized_symbol::init_output_segment): Likewise.
11672 (Sized_symbol::init_constant): Likewise.
11673 (Sized_symbol::init_undefined): Likewise.
11674 (Symbol_table::do_define_in_output_data): If the new symbol has a
11675 version, mark it as the default.
11676 (Symbol_table::do_define_in_output_segment): Likewise.
11677 (Symbol_table::do_define_as_constant): Likewise.
11678 * symtab.h (class Symbol): Update declarations.
11679 (class Sized_symbol): Likewise.
11680 * resolve.cc (Symbol::override_version): New function.
11681 (Symbol::override_base): Call override_version.
11682 (Symbol::override_base_with_special): Likewise.
11683 * testsuite/ver_script_8.script: New file.
11684 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
11685 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
11686 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
11687 (ver_test_8_1.so, ver_test_8_2.so): New targets.
11689 2008-05-06 Ian Lance Taylor <iant@google.com>
11692 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
11694 (class General_options): Remove existing --undefined, and add
11695 --no-undefined instead. Add new --undefined as synonym for -u.
11696 * archive.cc (Archive::add_symbols): Check whether symbol was
11698 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
11699 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
11700 all uses. Add IS_UNDEFINED. Update declarations to split
11701 different versions of init_base. Declare init_base_undefined.
11702 (Symbol::is_defined): Handle IS_UNDEFINED.
11703 (Symbol::is_undefined): Likewise.
11704 (Symbol::is_weak_undefined): Call is_undefined.
11705 (Symbol::is_absolute): Handle IS_CONSTANT.
11706 (class Sized_symbol): Update declarations to split different
11707 versions of init. Declare init_undefined.
11708 (class Symbol_table): Declare new functions.
11709 * symtab.cc (Symbol::init_base_object): Rename from init_base.
11710 Change all callers.
11711 (Symbol::init_base_output_data): Likewise.
11712 (Symbol::init_base_output_segment): Likewise.
11713 (Symbol::init_base_constant): Likewise.
11714 (Symbol::init_base_undefined): New function.
11715 (Sized_symbol::init_object): Rename from init. Change all
11717 (Sized_symbol::init_output_data): Likewise.
11718 (Sized_symbol::init_output_segment): Likewise.
11719 (Sized_symbol::init_constant): Likewise.
11720 (Sized_symbol::init_undefined): New function.
11721 (Symbol_table::add_undefined_symbols_from_command_line): New
11723 (Symbol_table::do_add_undefined_symbols_from_command_line): New
11725 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
11726 (Symbol::output_section): Likewise.
11727 (Symbol::set_output_section): Likewise.
11728 (Symbol_table::sized_finalize_symbol): Likewise.
11729 (Symbol_table::sized_write_globals): Likewise.
11730 * resolve.cc (Symbol_table::should_override): Likewise.
11731 (Symbol::override_base_with_special): Likewise.
11733 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
11734 symbol, change it to have default visibility.
11735 * testsuite/protected_1.cc: New file.
11736 * testsuite/protected_2.cc: New file.
11737 * testsuite/protected_3.cc: New file.
11738 * testsuite/protected_main_1.cc: New file.
11739 * testsuite/protected_main_2.cc: New file.
11740 * testsuite/protected_main_3.cc: New file.
11741 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
11742 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
11743 (protected_1_LDFLAGS, protected_1_LDADD): Define.
11744 (protected_1.so): New target.
11745 (protected_1_pic.o, protected_2_pic.o): New targets.
11746 (protected_3_pic.o): New target.
11747 (check_PROGRAMS): Add protected_2.
11748 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
11749 (protected_2_LDFLAGS, protected_2_LDADD): Define.
11750 * testsuite/Makefile.in: Rebuild.
11752 * options.h (DEFINE_var): Add set_user_set_##varname__.
11753 (DEFINE_bool_alias): New macro.
11754 (class General_options): Define -Bstatic using DEFINE_bool_alias
11755 rather than DEFINE_special. Add --undefined as an alias for -z
11757 * options.cc (General_options::parse_Bstatic): Remove.
11759 * options.h (class General_options): Add --fatal-warnings.
11760 * main.cc (main): Implement --fatal-warnings.
11761 * errors.h (Errors::warning_count): New function.
11763 * options.h (class General_options): Add -Bsymbolic-functions.
11764 * symtab.h (Symbol::is_preemptible): Check for
11765 -Bsymbolic-functions.
11767 2008-05-05 Ian Lance Taylor <iant@google.com>
11769 * options.h (DEFINE_bool): For DASH_Z, create the negative option
11770 as noVARNAME rather than no-VARNAME.
11771 (class General_options): Add option -z combreloc.
11772 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
11774 (Output_reloc::sort_before) [SHT_REL]: New function.
11775 (Output_reloc::sort_before) [SHT_RELA]: New function.
11776 (class Output_data_reloc_base): Add sort_relocs_ field. Define
11777 Sort_relocs_comparison.
11778 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
11779 parameter. Change all callers.
11780 (Output_data_reloc::Output_data_reloc) [both versions]: Add
11781 sort_relocs parameter. Change all callers.
11782 * output.cc (Output_reloc::get_address): New function, broken out
11784 (Output_reloc::write_rel): Call it.
11785 (Output_reloc::compare): New function.
11786 (Output_data_reloc_base::do_write): Optionally sort relocs.
11788 * configure.ac: If targ_extra_obj is set, link it in.
11789 * configure.tgt: Initialize all variables.
11790 (x86_64*): Set targ_extra_obj and targ_extra_size.
11791 * configure: Rebuild.
11793 * object.cc (Sized_relobj::include_section_group): Adjust section
11794 indexes read from group data. Build vector to pass to
11796 * layout.cc (Layout::layout_group): Add flags and shndxes
11797 parameters. Remove contents parameter. Change caller. Update
11798 explicit instantiations.
11799 * layout.h (class Layout): Update layout_group declaration.
11800 * output.cc (Output_data_group::Output_data_group): Add flags and
11801 input_shndxes parameters. Remove contents parameter. Change
11803 (Output_data_group::do_write): Change input_sections_ to
11805 * output.h (class Output_data_group): Update constructor
11806 declaration. Rename input_sections_ to input_shndxes_.
11807 * testsuite/many_sections_test.cc: Add template.
11809 2008-04-30 Cary Coutant <ccoutant@google.com>
11811 * target-reloc.h (relocate_section): Fix dead-pointer bug.
11813 * layout.cc (Layout::include_section): Refactored check for debug
11815 (Layout::add_comdat): Add new parameters. Change type
11816 of signature parameter. Add object and shndx to signatures table.
11817 (Layout::find_kept_object): New function.
11818 * layout.h: Include <cstring>.
11819 (Layout::is_debug_info_section): New function.
11820 (Layout::add_comdat): Add new parameters.
11821 (Layout::find_kept_object): New function.
11822 (Layout::Kept_section): New struct.
11823 (Layout::Signatures): Change type of map range.
11824 * object.cc (Relobj::output_section_address): New function.
11825 (Sized_relobj::include_section_group): Add new parameters. Change
11826 calls to Layout::add_comdat. Change to build table of kept comdat
11827 groups and table mapping discarded sections to kept sections.
11828 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
11829 (Sized_relobj::do_layout): Change calls to include_section_group and
11830 include_linkonce_section.
11831 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
11832 value to zero when section is discarded.
11833 (Sized_relobj::map_to_kept_section): New function.
11834 * object.h (Relobj::output_section_address): New function.
11835 (Relobj::Comdat_group): New type.
11836 (Relobj::find_comdat_group): New function.
11837 (Relobj::Comdat_group_table): New type.
11838 (Relobj::Kept_comdat_section): New type.
11839 (Relobj::Kept_comdat_section_table): New type.
11840 (Relobj::add_comdat_group): New function.
11841 (Relobj::set_kept_comdat_section): New function.
11842 (Relobj::get_kept_comdat_section): New function.
11843 (Relobj::comdat_groups_): New field.
11844 (Relobj::kept_comdat_sections_): New field.
11845 (Symbol_value::input_value): Update comment.
11846 (Sized_relobj::map_to_kept_section) New function.
11847 (Sized_relobj::include_linkonce_section): Add new parameter.
11848 * target-reloc.h (Comdat_behavior): New type.
11849 (get_comdat_behavior): New function.
11850 (relocate_section): Add code to map a discarded section to the
11851 corresponding kept section when applying a relocation.
11853 2008-04-30 Craig Silverstein <csilvers@google.com>
11855 * dwarf_reader.cc (next_generation_count): New static var.
11856 (Addr2line_cache_entry): New struct.
11857 (addr2line_cache): New static var.
11858 (Dwarf_line_info::one_addr2line): Added caching.
11859 (Dwarf_line_info::clear_addr2line_cache): New function.
11860 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
11861 cache-size parameter.
11862 (Dwarf_line_info::one_addr2line_cache): New function.
11863 * symtab.cc (Symbol_table::detect_odr_violations): Pass
11864 new cache-size argument to one_addr2line(), and clear cache.
11866 2008-04-28 Cary Coutant <ccoutant@google.com>
11868 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
11869 R_386_PC8 relocations.
11871 2008-04-23 Ian Lance Taylor <iant@google.com>
11873 * object.cc (Sized_relobj::include_section_group): Check for
11874 invalid section group.
11876 * object.cc (make_elf_object): Correct test for 64-bit ELF file
11879 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
11880 than read for file header.
11881 * archive.cc (Archive::include_member): Likewise.
11883 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
11885 * aclocal.m4: Regenerate.
11886 * configure: Regenerate.
11888 2008-04-19 Ian Lance Taylor <iant@google.com>
11890 * version.cc (version_string): Bump to 1.6.
11892 * testsuite/Makefile.am (many_sections_r_test): New target.
11893 (many_sections_r_test_SOURCES): Remove.
11894 (many_sections_r_test_DEPENDENCIES): Remove.
11895 (many_sections_r_test_LDFLAGS): Remove.
11896 (many_sections_r_test_LDADD): Remove.
11898 * object.cc (Sized_relobj::do_add_symbols): Always pass
11899 local_symbol_count_ to add_from_relobj.
11901 * testsuite/Makefile.am (many_sections_check.h): Only check one in
11902 every thousand variables.
11903 * testsuite/Makefile.in: Rebuild.
11905 * object.cc (Xindex::initialize_symtab_xindex): New function.
11906 (Xindex::read_symtab_xindex): New function.
11907 (Xindex::sym_xindex_to_shndx): New function.
11908 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
11910 (Sized_relobj::do_initialize_xindex): New function.
11911 (Sized_relobj::do_read_symbols): Adjust section links.
11912 (Sized_relobj::symbol_section_and_value): Add is_ordinary
11913 parameter. Change all callers.
11914 (Sized_relobj::include_section_group): Adjust section links and
11915 symbol section indexes.
11916 (Sized_relobj::do_layout): Adjust section links.
11917 (Sized_relobj::do_count_local_symbols): Adjust section links and
11918 symbol section indexes.
11919 (Sized_relobj::do_finalize_local_symbols): Distinguish between
11920 ordinary and special symbols.
11921 (Sized_relobj::write_local_symbols): Add symtab_xindex and
11922 dynsym_xindex parameters. Change all callers. Adjust section
11923 links. Use SHN_XINDEX when needed.
11924 (Sized_relobj::get_symbol_location_info): Adjust section links.
11925 Don't get fooled by special symbols.
11926 * object.h (class Xindex): Define.
11927 (class Object): Add xindex_ parameter. Declare virtual functoin
11928 do_initialize_xindex.
11929 (Object::adjust_sym_shndx): New function.
11930 (Object::set_xindex): New protected function.
11931 (class Symbol_value): Add is_ordinary_shndx_ field.
11932 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
11933 (Symbol_value::value): Assert ordinary section.
11934 (Symbol_value::initialize_input_to_output_map): Likewise.
11935 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
11936 Change all callers.
11937 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
11939 (class Sized_relobj): Update declarations.
11940 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
11941 parameter. Change all callers.
11942 (Sized_relobj::adjust_shndx): New function.
11943 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
11945 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
11946 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
11947 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
11948 (Sized_dynobj::read_dynsym_section): Adjust section links.
11949 (Sized_dynobj::read_dynamic): Likewise.
11950 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
11952 (Sized_dynobj::do_initialize_xindex): New function.
11953 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
11954 do_initialize_xindex.
11955 (Sized_dynobj::adjust_shndx): New function.
11956 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
11957 dynsym_xindex_ fields.
11958 (Layout::finalize): Add a call to set_section_indexes before
11959 creating the symtab sections.
11960 (Layout::set_section_indexes): Don't do anything if the section
11961 already has a section index.
11962 (Layout::create_symtab_sections): Add shnum parameter. Change
11963 caller. Create .symtab_shndx section if needed.
11964 (Layout::create_shdrs): Add shstrtab_section parameter. Change
11966 (Layout::allocated_output_section_count): New function.
11967 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
11969 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
11970 fields. Update declarations.
11971 (Layout::symtab_xindex): New function.
11972 (Layout::dynsym_xindex): New function.
11973 (class Write_symbols_task): Add layout_ field.
11974 (Write_symbols_task::Write_symbols_task): Add layout parameter.
11976 * output.cc (Output_section_headers::Output_section_headers): Add
11977 shstrtab_section parameter. Change all callers.
11978 (Output_section_headers::do_sized_write): Store overflow values
11979 for section count and section string table section index in
11980 section header zero.
11981 (Output_file_header::do_sized_write): Check for overflow of
11982 section count and section string table section index.
11983 (Output_symtab_xindex::do_write): New function.
11984 (Output_symtab_xindex::endian_do_write): New function.
11985 * output.h (class Output_section_headers): Add shstrtab_section_.
11986 Update declarations.
11987 (class Output_symtab_xindex): Define.
11988 (Output_section::has_out_shndx): New function.
11989 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
11991 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
11992 Change all callers.
11993 (Sized_symbol::init): Likewise.
11994 (Symbol::output_section): Check for ordinary symbol.
11995 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
11996 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
11998 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
11999 Change all callers. Simplify handling of symbols from sections
12000 not included in the link.
12001 (Symbol_table::add_from_dynobj): Handle ordinary symbol
12003 (Weak_alias_sorter::operator()): Assert that symbols are
12005 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
12007 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
12008 parameters. Change all callers.
12009 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
12010 symbol distinction. Use SHN_XINDEX when needed.
12011 (Symbol_table::write_section_symbol): Add symtab_xindex
12012 parameter. Change all callers.
12013 (Symbol_table::sized_write_section_symbol): Likewise. Use
12014 SHN_XINDEX when needed.
12015 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
12017 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
12018 (Symbol::is_defined): Check is_ordinary.
12019 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
12020 (Symbol::is_absolute, Symbol::is_common): Likewise.
12021 (class Sized_symbol): Update declarations.
12022 (class Symbol_table): Update declarations.
12023 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
12024 parameters. Change all callers.
12025 (Sized_symbol::override): Likewise.
12026 (Symbol_table::override): Likewise.
12027 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
12028 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
12029 is_ordinary, and orig_st_shndx parameters. Change all callers.
12030 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
12031 to be in an ordinary section.
12032 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
12033 object and is_ordinary parameters. Change all callers.
12034 (Sized_dwarf_line_info::read_relocs): Add object parameter.
12035 Change all callers. Don't add undefined or non-ordinary symbols
12037 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
12038 Change all callers.
12039 * dwarf_reader.h (class Sized_dwarf_line_info): Update
12041 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
12042 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
12043 (Sized_relobj::relocate_sections): Likewise.
12044 * target-reloc.h (scan_relocs): Adjust section symbol index.
12045 (scan_relocatable_relocs): Likewise.
12046 * i386.cc (Scan::local): Check for ordinary symbols.
12047 * sparc.cc (Scan::local): Likewise.
12048 * x86_64.cc (Scan::local): Likewise.
12049 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
12050 to symbol_section_and_value.
12051 * testsuite/many_sections_test.cc: New file.
12052 * testsuite/Makefile.am (BUILT_SOURCES): Define.
12053 (check_PROGRAMS): Add many_sections_test.
12054 (many_sections_test_SOURCES): Define.
12055 (many_sections_test_DEPENDENCIES): Define.
12056 (many_sections_test_LDFLAGS): Define.
12057 (BUILT_SOURCES): Add many_sections_define.h.
12058 (many_sections_define.h): New target.
12059 (BUILT_SOURCES): Add many_sections_check.h.
12060 (many_sections_check.h): New target.
12061 (check_PROGRAMS): Add many_sections_r_test.
12062 (many_sections_r_test_SOURCES): Define.
12063 (many_sections_r_test_DEPENDENCIES): Define.
12064 (many_sections_r_test_LDFLAGS): Define.
12065 (many_sections_r_test_LDADD): Define.
12066 (many_sections_r_test.o): New target.
12067 * testsuite/Makefile.in: Rebuild.
12069 2008-04-17 Cary Coutant <ccoutant@google.com>
12071 * errors.cc (Errors::info): New function.
12072 (gold_info): New function.
12073 * errors.h (Errors::info): New function.
12074 * gold.h (gold_info): New function.
12075 * object.cc (Input_objects::add_object): Print trace output.
12076 * options.cc (options::parse_set): New function.
12077 (General_options::parse_wrap): Deleted.
12078 (General_options::General_options): Deleted initializer.
12079 * options.h (options::String_set): New typedef.
12080 (options::parse_set): New function.
12081 (DEFINE_set): New macro.
12082 (General_options::wrap): Changed to use DEFINE_set. Changed
12083 callers of any_wrap_symbols and is_wrap_symbol.
12084 (General_options::trace, General_options::trace_symbol):
12086 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
12087 (General_options::wrap_symbols_): Deleted.
12088 * symtab.cc (Symbol_table::add_from_object): Print trace output.
12090 2008-04-17 David S. Miller <davem@davemloft.net>
12092 * options.cc (General_options::parse_V): New function.
12093 * options.h: Add entries for -V and -Qy.
12095 2008-04-17 Ian Lance Taylor <iant@google.com>
12097 * common.cc (Symbol_table::allocate_commons): Remove options
12098 parameter. Change caller.
12099 (Symbol_table::do_allocate_commons): Remove options parameter.
12100 Change caller. Just call do_allocate_commons_list twice.
12101 (Symbol_table::do_allocate_commons_list): New function, broken out
12102 of do_allocate_commons.
12103 * common.h (class Allocate_commons_task): Remove options_ field.
12104 Update constructor.
12105 * symtab.cc (Symbol_table::Symbol_table): Initialize
12107 (Symbol_table::add_from_object): Put TLS common symbols on
12109 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
12110 which are IN_OUTPUT_DATA.
12111 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
12112 allocate_commons and do_allocate_commons declarations. Declare
12113 do_allocate_commons_list.
12114 * gold.cc (queue_middle_tasks): Update creation of
12115 Allocate_commons_task to not pass options.
12116 * testsuite/Makefile.am (INCLUDES): Add -I.. .
12117 (TLS_TEST_C_FLAGS): New variable.
12118 (tls_test_c_pic.o): New target.
12119 (tls_test_shared.so): Link in tls_test_c_pic.o.
12120 (tls_test_c_pic_ie.o): New target.
12121 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
12122 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
12123 (tls_test_c.o): New target.
12124 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
12125 (tls_pic_test_LDADD): Likewise.
12126 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
12127 (tls_shared_gd_to_ie_test_LDADD): Likewise.
12128 (tls_test_c_gnu2.o): New target.
12129 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
12131 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
12132 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
12133 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
12134 * testsuite/tls_test.cc: Include "config.h".
12135 (t_last): Call t11_last.
12136 * testsuite/tls_test.h (t11, t11_last): Declare.
12137 * testsuite/tls_test_c.c: New file.
12138 * testsuite/tls_test_main.cc (thread_routine): Call t11.
12139 * configure.ac: Check for OpenMP support.
12140 * configure, config.in, Makefile.in: Rebuild.
12141 * testsuite/Makefile.in: Rebuild.
12143 2008-04-16 Cary Coutant <ccoutant@google.com>
12145 * i386.cc (Target_i386::define_tls_base_symbol): New function.
12146 (Target_i386::tls_base_symbol_defined_): New field.
12147 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12148 (Target_i386::Scan::global): Likewise.
12149 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
12150 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
12151 (Target_x86_64::tls_base_symbol_defined_): New field.
12152 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12153 (Target_x86_64::Scan::global): Likewise.
12155 2008-04-16 Cary Coutant <ccoutant@google.com>
12157 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
12158 (Symbol::needs_plt_entry): Allow weak undefined symbols.
12159 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
12160 building shared libraries.
12161 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
12162 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
12163 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
12164 * testsuite/Makefile.in: Rebuild.
12165 * testsuite/weak_undef.h: New file.
12166 * testsuite/weak_undef_file1.cc: Add extra test cases.
12167 * testsuite/weak_undef_file2.cc: Likewise.
12168 * testsuite/weak_undef_test.cc: Likewise.
12170 2008-04-16 David S. Miller <davem@davemloft.net>
12172 * sparc.cc (Target_sparc::Scan): Change from struct to class.
12173 Add issued_non_pic_error_ field. Declare check_non_pic.
12174 (Target_sparc::Scan::check_non_pic): New function.
12175 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
12176 (Target_sparc::Scan::global): Likewise.
12178 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
12179 * configure: Rebuild.
12181 * options.h (DEFINE_enable): New macro.
12182 (new_dtags): New enable option.
12183 (initfirst, interpose, loadfltr, nodefaultlib,
12184 nodelete, nodlopen, nodump): New -z options.
12185 * layout.cc (Layout:finish_dynamic_section): If new
12186 dtags enabled, emit DT_RUNPATH. Also, emit a
12187 DT_FLAGS_1 containing any specified -z flags.
12189 2008-04-16 Ian Lance Taylor <iant@google.com>
12191 * copy-relocs.cc: New file.
12192 * copy-relocs.h: New file.
12193 * reloc.cc: Remove Copy_relocs code.
12194 * reloc.h: Likewise.
12195 * reloc-types.h (struct Reloc_types) [both versions]: Add
12196 get_reloc_addend_noerror.
12197 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
12198 variants of add_global which take an addend which must be zero.
12199 * i386.cc: Include "copy-relocs.h".
12200 (class Target_i386): Change type of copy_relocs_ to variable,
12201 update initializer.
12202 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
12203 Change all callers.
12204 (Target_i386::do_finalize_sections): Change handling of
12206 * sparc.cc: Include "copy-relocs.h".
12207 (class Target_sparc): Change type of copy_relocs_ to variable,
12208 update initializer.
12209 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
12210 Change all callers.
12211 (Target_sparc::do_finalize_sections): Change handling of
12213 * x86_64.cc: Include "copy-relocs.h".
12214 (class Target_x86_64): Change type of copy_relocs_ to variable,
12215 update initializer.
12216 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
12217 class. Change all callers.
12218 (Target_x86_64::do_finalize_sections): Change handling of
12220 * Makefile.am (CCFILES): Add copy-relocs.cc.
12221 (HFILES): Add copy-relocs.h.
12223 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
12225 * testsuite/script_test_4.sh: Permit leading zeroes.
12227 2008-04-15 Ian Lance Taylor <iant@google.com>
12229 * script-sections.cc (Script_sections::create_segments): Use
12230 header_size_adjustment even when there is enough room for the
12232 * testsuite/script_test_4.sh: New file.
12233 * testsuite/script_test_4.t: New file.
12234 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
12235 (check_DATA): Add script_test_4.stdout.
12236 (MOSTLYCLEANFILES): Likewise.
12237 (script_test_4): New target.
12238 (script_test_4.stdout): New target.
12239 * testsuite/Makefile.in: Rebuild.
12241 * sparc.cc: Add definitions for Output_data_plt_sparc class
12244 2008-04-14 David S. Miller <davem@davemloft.net>
12246 * sparc.cc: New file.
12247 * Makefile.am (TARGETSOURCES): Add sparc.cc
12248 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
12249 * configure.tgt: Document targ_extra_size and
12250 targ_extra_big_endian. Add entries for sparc-* and
12252 * configure.ac: Handle targ_extra_size and
12253 targ_extra_big_endian.
12254 * Makefile.in: Rebuild.
12255 * configure: Likewise.
12256 * po/POTFILES.in: Likewise.
12257 * po/gold.pot: Likewise.
12259 2008-04-14 Ian Lance Taylor <iant@google.com>
12261 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
12262 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
12263 in the name/type/flags to section mapping. Don't call
12264 allocate_output_section.
12265 (Layout::choose_output_section): Change parameter from adjust_name
12266 to is_input_section. Don't permit input sections after sections
12267 are attached to segments. Don't call allocate_output_section.
12268 (Layout::layout_eh_frame): Call update_flags_for_input_section,
12269 not write_enable_output_section.
12270 (Layout::make_output_section): Don't push to
12271 unattached_section_list_ nor call attach_to_segment. Call
12272 attach_section_to_segment if sections are attached.
12273 (Layout::attach_sections_to_segments): New function.
12274 (Layout::attach_section_to_segment): New function.
12275 (Layout::attach_allocated_section_to_segment): Rename from
12276 attach_to_segment. Remove flags parameter.
12277 (Layout::allocate_output_section): Remove function.
12278 (Layout::write_enable_output_section): Remove function.
12279 * layout.h (class Layout): Update for above changes. Add new
12280 field sections_are_attached_.
12281 * output.h (Output_section::update_flags_for_input_section): New
12283 * output.cc (Output_section::add_input_section): Call
12284 update_flags_for_input_section.
12285 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
12287 2008-04-11 Cary Coutant <ccoutant@google.com>
12289 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
12290 thought unnecessary.
12291 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
12293 2008-04-11 Ian Lance Taylor <iant@google.com>
12295 * output.h (class Output_section_data): Remove inline definition
12297 * output.cc (Output_section_data::set_addralign): New function.
12299 2008-04-11 Cary Coutant <ccoutant@google.com>
12301 Add support for TLS descriptors for i386 and x86_64.
12302 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
12303 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
12304 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
12306 (Target_i386::got_mod_index_entry): Remove unnecessary code.
12307 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
12308 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
12310 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
12311 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
12312 Fix problem with initial-exec relocations.
12313 (Target_i386::Relocate::relocate_tls): Likewise.
12314 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
12316 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
12317 support for section-plus-offset dynamic table entries.
12318 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
12319 (Output_data_dynamic::Dynamic_entry): Add support for
12320 section-plus-offset dynamic table entries.
12321 (Output_data_dynamic::Classification): Likewise.
12322 (Output_data_dynamic::classification_): Renamed offset_.
12323 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
12324 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
12325 (Target_x86_64::make_plt_section): New function.
12326 (Target_x86_64::reserve_tlsdesc_entries): New function.
12327 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
12328 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
12329 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
12330 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
12331 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
12332 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
12333 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
12334 add extra PLT entry for TLS descriptors.
12335 (Output_data_plt_x86_64::got_): New field.
12336 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
12337 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
12339 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
12341 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
12342 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
12343 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
12344 R_386_TLS_DESC_CALL relocations.
12345 (Target_x86_64::Scan::global): Likewise.
12346 (Target_x86_64::do_finalize_sections): Add dynamic table entries
12347 for TLS descriptors.
12348 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
12349 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
12350 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
12351 GD-to-IE relaxation.
12352 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
12353 and TLS_DESCRIPTORS.
12354 * Makefile.in: Rebuild.
12355 * configure: Rebuild.
12356 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
12357 (tls_test_shared2.so): New target.
12358 (tls_shared_gd_to_ie_test_SOURCES): New variable.
12359 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
12360 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
12361 (tls_shared_gd_to_ie_test_LDADD): New variable.
12362 (tls_shared_gnu2_gd_to_ie_test): New target.
12363 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
12365 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
12366 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
12367 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
12368 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
12369 (tls_shared_gnu2_test): New target.
12370 (tls_test_gnu2_shared.so): New target.
12371 (tls_shared_gnu2_test_SOURCES): New variable.
12372 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
12373 (tls_shared_gnu2_test_LDFLAGS): New variable.
12374 (tls_shared_gnu2_test_LDADD): New variable.
12375 * testsuite/Makefile.in: Rebuild.
12376 * testsuite/Makefile.
12378 2008-04-11 Ian Lance Taylor <iant@google.com>
12380 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
12382 * testsuite/Makefile.in: Rebuild.
12384 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
12386 * testsuite/script_test_2.cc (main): Adjust test.
12388 2008-04-11 David S. Miller <davem@davemloft.net>
12389 Ian Lance Taylor <iant@google.com>
12391 * options.h (General_options): Add entries for '-Y' and
12393 * options.cc (General_options:finalize): If -Y was used, add those
12394 entries to the library path instead of the default "/lib" and
12397 2008-04-11 David S. Miller <davem@davemloft.net>
12399 * testsuite/justsyms.t: Start at 0x100.
12400 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
12401 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
12403 * testsuite/script_test_2.cc: Adjust string and section length
12406 2008-04-09 Ian Lance Taylor <iant@google.com>
12409 * script-sections.cc (Sections_element::allocate_to_segment): Add
12411 (Output_section_definition::allocate_to_segment): Likewise.
12412 (Orphan_output_section::allocate_to_segment): Likewise.
12413 (Script_sections::attach_sections_using_phdrs_clause): Don't
12414 propagate non-PT_LOAD segments to orphan sections.
12415 * testsuite/Makefile.am (script_test_3.stdout): Generate using
12416 readelf rather than objdump.
12417 * testsuite/script_test_3.sh: Adjust accordingly. Test that
12418 .interp section and PT_INTERP segment are the same size.
12419 * testsuite/Makefile.in: Rebuild.
12421 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
12422 aliases for symbols defined in the same object.
12423 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
12424 (weak_alias_test_SOURCES): New variable.
12425 (weak_alias_test_DEPENDENCIES): New variable.
12426 (weak_alias_test_LDFLAGS): New variable.
12427 (weak_alias_test_LDADD): New variable.
12428 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
12429 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
12430 (weak_alias_test_3.o): New target.
12431 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
12432 * testsuite/weak_alias_test_main.cc: New file.
12433 * testsuite/weak_alias_test_1.cc: New file.
12434 * testsuite/weak_alias_test_2.cc: New file.
12435 * testsuite/weak_alias_test_3.cc: New file.
12437 2008-04-08 Ian Lance Taylor <iant@google.com>
12439 * options.h (class General_options): Add --noinhibit-exec option.
12440 * main.cc (main): Check --noinhibit-exec.
12442 * options.h (class General_options): Define --wrap as a special
12443 option. Add wrap_symbols_ field.
12444 (General_options::any_wrap_symbols): New function.
12445 (General_options::is_wrap_symbol): New function.
12446 * options.cc (General_options::parse_wrap): New function.
12447 (General_options::General_options): Initialize wrap_symbols_.
12448 * symtab.cc (Symbol_table::wrap_symbol): New function.
12449 (Symbol_table::add_from_object): Handle --wrap.
12450 * symtab.h (class Symbol_table): Declare wrap_symbol.
12451 * target.h (Target::wrap_char): New function.
12452 (Target::Target_info): Add wrap_char field.
12453 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
12454 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12455 * testsuite/testfile.cc (Target_test::test_target_info):
12458 * errors.cc (Errors::undefined_symbol): Mention symbol version if
12461 * layout.h (class Layout): Add added_eh_frame_data_ field.
12462 * layout.cc (Layout::Layout): Initialize new field.
12463 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
12464 output section until we find a section we merged successfully.
12465 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
12466 that the size be non-zero.
12468 * merge.cc (Object_merge_map::get_output_offset): Remove inline
12471 2008-04-08 Craig Silverstein <csilvers@google.com>
12473 * configure.ac: Export new conditional variable HAVE_ZLIB.
12474 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
12476 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
12477 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12479 2008-04-07 Ian Lance Taylor <iant@google.com>
12481 * version.cc (version_string): Set to "1.5".
12483 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
12484 Add issued_non_pic_error_ field. Declare check_non_pic.
12485 (Target_x86_64::Scan::check_non_pic): New function.
12486 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
12487 (Target_x86_64::Scan::global): Likewise.
12489 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
12490 addend parameter. Change caller. Handle merge sections.
12491 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
12492 Address to Addend. Don't add in the result of
12493 local_section_offset, pass down the addend and use the returned
12495 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
12496 Update declarations of local_section_offset and symbol_value.
12497 * testsuite/two_file_test_1.cc (t18): New function.
12498 * testsuite/two_file_test_2.cc (f18): New function.
12499 * testsuite/two_file_test_main.cc (main): Call t18.
12500 * testsuite/two_file_test.h (t18, f18): Declare.
12502 * configure.ac: Don't test for objdump, c++filt, or readelf.
12503 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
12505 (TEST_READELF): New variable.
12506 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
12507 (check_PROGRAMS): Add two_file_strip_test.
12508 (two_file_strip_test): New target.
12509 (check_PROGRAMS): Add two_file_same_shared_strip_test.
12510 (two_file_same_shared_strip_test_SOURCES): New variable.
12511 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
12512 (two_file_same_shared_strip_test_LDFLAGS): New variable.
12513 (two_file_same_shared_strip_test_LDADD): New variable.
12514 (two_file_shared_strip.so): New target.
12515 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
12516 (ver_test_5.syms, ver_test_7.syms): Likewise.
12517 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
12518 (strip_test_3.stdout): Use TEST_OBJDUMP.
12519 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12521 2008-04-04 Cary Coutant <ccoutant@google.com>
12523 * symtab.h (Symbol::is_weak_undefined): New function.
12524 (Symbol::is_strong_undefined): New function.
12525 (Symbol::is_absolute): New function.
12526 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
12527 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
12529 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
12530 (weak_undef_test): New target.
12531 * testsuite/Makefile.in: Rebuild.
12532 * testsuite/weak_undef_file1.cc: New file.
12533 * testsuite/weak_undef_file2.cc: New file.
12534 * testsuite/weak_undef_test.cc: New file.
12536 2008-04-03 Craig Silverstein <csilvers@google.com>
12538 * compressed_output.h (class Output_compressed_section): Use
12540 * compressed_output.cc (zlib_compress): Use unsigned buffers,
12542 (zlib_compressed_suffix): Removed.
12543 (Output_compressed_section::set_final_data_size): Use unsigned
12545 * testsuite/Makefile.am (flagstest_compress_debug_sections):
12546 Fix linker invocation.
12547 (flagstest_o_specialfile_and_compress_debug_sections):
12549 * testsuite/Makefile.in: Regenerated.
12551 2008-04-02 David S. Miller <davem@davemloft.net>
12553 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
12554 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
12556 2008-04-02 Craig Silverstein <csilvers@google.com>
12560 2008-04-02 Ian Lance Taylor <iant@google.com>
12562 * fileread.cc (File_read::find_view): Add byteshift and vshifted
12563 parameters. Update for new key type to views_. Change all
12565 (File_read::read): Adjust for byteshift in returned view.
12566 (File_read::add_view): New function, broken out of
12567 find_and_make_view.
12568 (File_read::make_view): New function, broken out of
12569 find_and_make_view.
12570 (File_read::find_or_make_view): Add offset and aligned
12571 parameters. Rewrite accordingly. Change all callers.
12572 (File_read::get_view): Add offset and aligned parameters. Adjust
12573 for byteshift in return value.
12574 (File_read::get_lasting_view): Likewise.
12575 * fileread.h (class File_read): Update declarations.
12576 (class File_read::View): Add byteshift_ field. Add byteshift to
12577 constructor. Add byteshift method.
12578 * archive.h (Archive::clear_uncached_views): New function.
12579 (Archive::get_view): Add aligned parameter. Change all callers.
12580 * object.h (Object::get_view): Add aligned parameter. Change all
12582 (Object::get_lasting_view): Likewise.
12584 * fileread.cc (File_read::release): Don't call clear_views if
12585 there are multiple objects.
12586 * fileread.h (File_read::clear_uncached_views): New function.
12587 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
12590 2008-03-31 Cary Coutant <ccoutant@google.com>
12592 Add thin archive support.
12593 * archive.cc (Archive::armagt): New const.
12594 (Archive::setup): Remove task parameter and calls to unlock.
12595 (Archive::unlock_nested_archives): New function.
12596 (Archive::read_header): Add nested_off parameter. Change
12598 (Archive::interpret_header): Likewise.
12599 (Archive::include_all_members): Change to handle thin
12601 (Archive::include_member): Likewise.
12602 * archive.h (Archive::Archive): Add new parameters and
12604 (Archive::armagt): New const.
12605 (Archive::setup): Remove task parameter.
12606 (Archive::unlock_nested_archives): New function.
12607 (Archive::read_header): Add nested_off parameter.
12608 (Archive::interpret_header): Likewise.
12609 (Archive::Nested_archive_table): New typedef.
12610 (Archive::is_thin_archive_): New field.
12611 (Archive::nested_archives_): New field.
12612 (Archive::options_): New field.
12613 (Archive::dirpath_): New field.
12614 (Archive::task_): New field.
12615 * readsyms.cc (Read_symbols::do_read_symbols): Add check
12616 for thin archives. Pass additional parameters to
12617 Archive::Archive. Unlock the archive file after calling
12620 2008-03-29 Ian Lance Taylor <iant@google.com>
12622 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12623 version symbol to be local.
12624 * testsuite/ver_test_4.sh: New file.
12625 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12626 (check_DATA): Add ver_test_4.syms.
12627 (ver_test_4.syms): New target.
12628 * testsuite/Makefile.in: Rebuild.
12631 (Output_section::Input_section_sort_entry::has_priority): New
12633 (Output_section::Input_section_sort_entry::match_file_name): New
12635 (Output_section::Input_section_sort_entry::match_section_name):
12637 (Output_section::Input_section_sort_entry::match_section_name_prefix):
12639 (Output_section::Input_section_sort_entry::match_section_file):
12641 (Output_section::Input_section_sort_compare::operator()): Rewrite
12642 using new Input_section_sort_entry functions. Sort crtbegin and
12643 crtend first. Sort sections with no priority before sections with
12645 * testsuite/initpri1.c (d3): Check j != 4.
12646 (cd5): New constructor/destructor function.
12647 (main): Check j != 2.
12649 * symtab.cc (Symbol_table::add_from_object): If we don't use the
12650 new symbol when resolving, don't call set_is_default.
12651 * testsuite/ver_test_7.cc: New file.
12652 * testsuite/ver_test_7.sh: New file.
12653 * testsuite/Makefile.am (ver_test_7.so): New target.
12654 (ver_test_7.o): New target.
12655 (check_SCRIPTS): Add ver_test_7.sh.
12656 (check_DATA): Add ver_test_7.syms.
12657 (ver_test_7.syms): New target.
12659 2008-03-28 Ian Lance Taylor <iant@google.com>
12661 * layout.cc (Layout::layout): If we see an input section with a
12662 name that needs sorting, set the must_sort flag for the output
12664 (Layout::make_output_section): If the name of the output section
12665 indicates that it might require sorting, set the may_sort flag.
12666 * output.h (Output_section::may_sort_attached_input_sections): New
12668 (Output_section::set_may_sort_attached_input_sections): New
12670 (Output_section::must_sort_attached_input_sections): New
12672 (Output_section::set_must_sort_attached_input_sections): New
12674 (class Output_section): Declare Input_section_sort_entry. Define
12675 Input_section_sort_compare. Declare
12676 sort_attached_input_sections. Add new fields:
12677 may_sort_attached_input_sections_,
12678 must_sort_attached_input_sections_,
12679 attached_input_sections_are_sorted_.
12680 * output.cc (Output_section::Output_section): Initialize new
12682 (Output_section::add_input_section): Add an entry to
12683 input_sections_ if may_sort or must_sort are true.
12684 (Output_section::set_final_data_size): Call
12685 sort_attached_input_sections if necessary.
12686 (Output_section::Input_section_sort_entry): Define new class.
12687 (Output_section::Input_section_sort_compare::operator()): New
12689 (Output_section::sort_attached_input_sections): New function.
12690 * configure.ac: Check whether the compiler supports constructor
12691 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
12692 * testsuite/initpri1.c: New file.
12693 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
12694 CONSTRUCTOR_PRIORITY.
12695 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
12696 (initpri1_LDFLAGS): New variable.
12697 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12699 2008-03-27 Ian Lance Taylor <iant@google.com>
12701 * common.cc (Sort_commons::operator): Correct sorting algorithm.
12702 * testsuite/common_test_1.c: New file.
12703 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
12704 (common_test_1_SOURCES): New variable.
12705 (common_test_1_DEPENDENCIES): New variable.
12706 (common_test_1_LDFLAGS): New variable.
12708 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
12709 and commons_ correctly when NAME/VERSION does not override
12711 * testsuite/ver_test_6.c: New file.
12712 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
12713 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
12714 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
12716 2008-03-26 Ian Lance Taylor <iant@google.com>
12718 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
12719 of an undefined symbol from a version script.
12720 * testsuite/Makefile.am (ver_test_5.so): New target.
12721 (ver_test_5.o): New target.
12722 (check_SCRIPTS): Add ver_test_5.sh.
12723 (check_DATA): Add ver_test_5.syms.
12724 (ver_test_5.syms): New target.
12725 * testsuite/ver_test_5.cc: New file.
12726 * testsuite/ver_test_5.script: New file.
12727 * testsuite/ver_test_5.sh: New file.
12728 * Makefile.in, testsuite/Makefile.in: Rebuild.
12731 Fix problems building gold with gcc 4.3.0.
12732 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
12733 (gold_error_at_location, gold_warning_at_location): Use it.
12734 * configure.ac: Check whether we can compile and use a template
12735 function with a printf attribute.
12736 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
12737 when jumping over bytes.
12738 * object.cc: Instantiate Object::read_section_data.
12739 * debug.h: Include <cstring>
12740 * dwarf_reader.cc: Include <algorithm>
12741 * main.cc: Include <cstring>.
12742 * options.cc: Include <cstring>.
12743 * output.cc: Include <cstring>.
12744 * script.cc: Include <cstring>.
12745 * script.h: Include <string>.
12746 * symtab.cc: Include <cstring> and <algorithm>.
12747 * target-select.cc: Include <cstring>.
12748 * version.cc: Include <string>.
12749 * testsuite/testmain.cc: Include <cstdlib>.
12750 * configure, config.in: Rebuild.
12752 2008-03-25 Ian Lance Taylor <iant@google.com>
12754 * options.cc: Include "../bfd/bfdver.h".
12755 (options::help): Print bug reporting address.
12757 * version.cc (print_version): Adjust output for current value of
12758 BFD_VERSION_STRING.
12762 * options.cc (options::help): Print list of supported targets.
12763 * target-select.h: Include <vector>.
12764 (class Target_selector): Make machine_, size_, and is_big_endian_
12765 fields const. Add bfd_name_ and instantiated_target_ fields.
12766 (Target_selector::Target_selector): Add bfd_name parameter.
12767 (Target_selector::recognize): Make non-virtual, call
12769 (Target_selector::recognize_by_name): Make non-virtual, call
12770 do_recognize_by_name.
12771 (Target_selector::supported_names): New function.
12772 (Target_selector::bfd_name): New function.
12773 (Target_selector::do_instantiate_target): New pure virtual
12775 (Target_selector::do_recognize): New virtual function.
12776 (Target_selector::do_recognize_by_name): New virtual function.
12777 (Target_selector::instantiate_target): New private function.
12778 (supported_target_names): Declare.
12779 * target-select.cc (Target_selector::Target_selector): Update for
12780 new parameter and fields.
12781 (select_target_by_name): Check that the name matches before
12782 calling recognize_by_name.
12783 (supported_target_names): New function.
12784 * i386.cc (class Target_selector_i386): Update Target_selector
12785 constructor call. Remove recognize and recognize_by_name. Add
12786 do_instantiate_target.
12787 * x86_64.cc (class Target_selector_x86_64): Likewise.
12788 * testsuite/testfile.cc (class Target_selector_test): Update for
12789 changes to Target_selector.
12791 * README: Rewrite, with some notes on unsupported features.
12793 2008-03-24 Cary Coutant <ccoutant@google.com>
12795 * i386.cc (Target_i386::Got_type): New enum declaration.
12796 (Target_i386::Scan::local): Updated callers of Output_data_got
12798 (Target_i386::Scan::global): Likewise.
12799 (Target_i386::Relocate::relocate): Likewise.
12800 (Target_i386::Relocate::relocate_tls): Likewise.
12801 * object.h (Got_offset_list): New class.
12802 (Sized_relobj::local_has_got_offset): Added got_type parameter.
12803 (Sized_relobj::local_got_offset): Likewise.
12804 (Sized_relobj::set_local_got_offset): Likewise.
12805 (Sized_relobj::local_has_tls_got_offset): Removed.
12806 (Sized_relobj::local_tls_got_offset): Removed.
12807 (Sized_relobj::set_local_tls_got_offset): Removed.
12808 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
12809 * output.cc (Output_data_got::add_global): Added got_type parameter.
12810 (Output_data_got::add_global_with_rel): Likewise.
12811 (Output_data_got::add_global_with_rela): Likewise.
12812 (Output_data_got::add_global_pair_with_rel): New function.
12813 (Output_data_got::add_global_pair_with_rela): New function.
12814 (Output_data_got::add_local): Added got_type parameter.
12815 (Output_data_got::add_local_with_rel): Likewise.
12816 (Output_data_got::add_local_with_rela): Likewise.
12817 (Output_data_got::add_local_pair_with_rel): New function.
12818 (Output_data_got::add_local_pair_with_rela): New function.
12819 (Output_data_got::add_global_tls): Removed.
12820 (Output_data_got::add_global_tls_with_rel): Removed.
12821 (Output_data_got::add_global_tls_with_rela): Removed.
12822 (Output_data_got::add_local_tls): Removed.
12823 (Output_data_got::add_local_tls_with_rel): Removed.
12824 (Output_data_got::add_local_tls_with_rela): Removed.
12825 * output.h (Output_data_got::add_global): Added got_type parameter.
12826 (Output_data_got::add_global_with_rel): Likewise.
12827 (Output_data_got::add_global_with_rela): Likewise.
12828 (Output_data_got::add_global_pair_with_rel): New function.
12829 (Output_data_got::add_global_pair_with_rela): New function.
12830 (Output_data_got::add_local): Added got_type parameter.
12831 (Output_data_got::add_local_with_rel): Likewise.
12832 (Output_data_got::add_local_with_rela): Likewise.
12833 (Output_data_got::add_local_pair_with_rel): New function.
12834 (Output_data_got::add_local_pair_with_rela): New function.
12835 (Output_data_got::add_global_tls): Removed.
12836 (Output_data_got::add_global_tls_with_rel): Removed.
12837 (Output_data_got::add_global_tls_with_rela): Removed.
12838 (Output_data_got::add_local_tls): Removed.
12839 (Output_data_got::add_local_tls_with_rel): Removed.
12840 (Output_data_got::add_local_tls_with_rela): Removed.
12841 * resolve.cc (Symbol::override_base_with_special): Removed
12842 reference to has_got_offset_ field.
12843 * symtab.cc (Symbol::init_fields): Replaced initialization
12844 of got_offset_ with got_offsets_. Removed initialization
12846 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
12847 (Symbol::got_offset): Likewise.
12848 (Symbol::set_got_offset): Likewise.
12849 (Symbol::has_tls_got_offset): Removed.
12850 (Symbol::tls_got_offset): Removed.
12851 (Symbol::set_tls_got_offset): Removed.
12852 (Symbol::got_offset_): Removed.
12853 (Symbol::tls_mod_got_offset_): Removed.
12854 (Symbol::tls_pair_got_offset_): Removed.
12855 (Symbol::got_offsets_): New field.
12856 (Symbol::has_got_offset): Removed.
12857 (Symbol::has_tls_mod_got_offset): Removed.
12858 (Symbol::has_tls_pair_got_offset): Removed.
12859 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
12860 (Target_x86_64::Scan::local): Updated callers of Output_data_got
12862 (Target_x86_64::Scan::global): Likewise.
12863 (Target_x86_64::Relocate::relocate): Likewise.
12864 (Target_x86_64::Relocate::relocate_tls): Likewise.
12866 2008-03-25 Ben Elliston <bje@au.ibm.com>
12868 * yyscript.y: Fix spelling error in comment.
12870 2008-03-24 Ian Lance Taylor <iant@google.com>
12872 * options.h (class General_options): Define build_id option.
12873 * layout.h (class Layout): Declare write_build_id, create_note,
12874 create_build_id. Add build_id_note_ member.
12875 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
12876 "libiberty.h", "md5.h", "sha1.h".
12877 (Layout::Layout): Initialize eh_frame_data_,
12878 eh_frame_hdr_section_, and build_id_note_.
12879 (Layout::finalize): Call create_build_id.
12880 (Layout::create_note): New function, broken out of
12881 Layout::create_gold_note.
12882 (Layout::create_gold_note): Call create_note.
12883 (Layout::create_build_id): New function.
12884 (Layout::write_build_id): New function.
12885 (Close_task_runner::run): Call write_build_id.
12887 * x86_64.cc: Correct license to GPLv3.
12889 2008-03-23 Ian Lance Taylor <iant@google.com>
12891 * options.cc: Include "demangle.h".
12892 (parse_optional_string): New function.
12893 (parse_long_option): Handle takes_optional_argument.
12894 (parse_short_option): Update dash_z initializer. Handle
12895 takes_optional_argument.
12896 (General_options::General_options): Initialize do_demangle_.
12897 (General_options::finalize): Set do_demangle_. Handle demangling
12899 * options.h (parse_optional_string): Declare.
12900 (struct One_option): Add optional_arg field. Update constructor.
12901 Update call constructor calls. Add takes_optional_argument
12903 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
12904 (DEFINE_optional_string): Define.
12905 (General_options::demangle): Change from DEFINE_bool to
12906 DEFINE_optional_string.
12907 (General_options::no_demangle): New function.
12908 (General_options::do_demangle): New function.
12909 (General_options::set_do_demangle): New function.
12910 (General_options::execstack_status_): Move definition to end of
12912 (General_options::static_): Likewise.
12913 (General_options::do_demangle_): New field.
12914 * object.cc (big_endian>::get_symbol_location_info): Call
12915 Options::do_demangle, not Options::demangle.
12916 * symtab.cc (demangle): Likewise.
12918 2008-03-22 Ian Lance Taylor <iant@google.com>
12920 * gold.h: Include <cstddef> and <sys/types.h>
12921 * options.h: Include <cstring>.
12923 2008-03-21 Ian Lance Taylor <iant@google.com>
12925 * Added source code to GNU binutils.